/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/client"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 0); /******/ }) /************************************************************************/ /******/ ({ /***/ "./client/App.js": /*!***********************!*\ !*** ./client/App.js ***! \***********************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _page_Main__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./page/Main */ "./client/page/Main.js"); /* harmony import */ var _page_Login__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./page/Login */ "./client/page/Login.js"); /* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router-dom/es/index.js"); function _typeof(obj) {if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {_typeof = function _typeof(obj) {return typeof obj;};} else {_typeof = function _typeof(obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;};}return _typeof(obj);}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a 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);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}function _possibleConstructorReturn(self, call) {if (call && (_typeof(call) === "object" || typeof call === "function")) {return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self) {if (self === void 0) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o) {_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {return o.__proto__ || Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function");}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });if (superClass) _setPrototypeOf(subClass, superClass);}function _setPrototypeOf(o, p) {_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {o.__proto__ = p;return o;};return _setPrototypeOf(o, p);} //import { ApolloProvider } from "react-apollo"; //import { client } from "./lib/apollo"; var App = /*#__PURE__*/function (_React$Component) {_inherits(App, _React$Component);function App() {_classCallCheck(this, App);return _possibleConstructorReturn(this, _getPrototypeOf(App).apply(this, arguments));}_createClass(App, [{ key: "render", value: function render() { /**/ /**/ return ( react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_3__["BrowserRouter"], null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_3__["Switch"], null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_3__["Route"], { path: "/main", render: function render() {return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_page_Main__WEBPACK_IMPORTED_MODULE_1__["default"], null);} }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_3__["Route"], { render: function render(props) {return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_page_Login__WEBPACK_IMPORTED_MODULE_2__["default"], props);} })))); } }]);return App;}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component); /* harmony default export */ __webpack_exports__["default"] = (App); /***/ }), /***/ "./client/component/AppleTVModal.js": /*!******************************************!*\ !*** ./client/component/AppleTVModal.js ***! \******************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return AppleTVModal; }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _Modal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Modal */ "./client/component/Modal.js"); function _typeof(obj) {if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {_typeof = function _typeof(obj) {return typeof obj;};} else {_typeof = function _typeof(obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;};}return _typeof(obj);}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a 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);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}function _possibleConstructorReturn(self, call) {if (call && (_typeof(call) === "object" || typeof call === "function")) {return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self) {if (self === void 0) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o) {_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {return o.__proto__ || Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function");}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });if (superClass) _setPrototypeOf(subClass, superClass);}function _setPrototypeOf(o, p) {_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {o.__proto__ = p;return o;};return _setPrototypeOf(o, p);} var AppleTVModal = /*#__PURE__*/function (_Component) {_inherits(AppleTVModal, _Component);function AppleTVModal() {_classCallCheck(this, AppleTVModal);return _possibleConstructorReturn(this, _getPrototypeOf(AppleTVModal).apply(this, arguments));}_createClass(AppleTVModal, [{ key: "render", value: function render() { if (!this.props.appleTVKey) { return; } return ( react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_Modal__WEBPACK_IMPORTED_MODULE_1__["default"], { didClose: this.props.onClose, className: " apple-tv" }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("h3", null, "Enter code on Apple TV Menu App"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p", { className: "key" }, this.props.appleTVKey), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", null, "Code expires in 24 hours"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button", { className: "button close-on-click" }, "Okay"))); } }]);return AppleTVModal;}(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); /***/ }), /***/ "./client/component/Modal.js": /*!***********************************!*\ !*** ./client/component/Modal.js ***! \***********************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); function _typeof(obj) {if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {_typeof = function _typeof(obj) {return typeof obj;};} else {_typeof = function _typeof(obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;};}return _typeof(obj);}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a 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);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}function _possibleConstructorReturn(self, call) {if (call && (_typeof(call) === "object" || typeof call === "function")) {return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o) {_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {return o.__proto__ || Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self) {if (self === void 0) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function");}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });if (superClass) _setPrototypeOf(subClass, superClass);}function _setPrototypeOf(o, p) {_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {o.__proto__ = p;return o;};return _setPrototypeOf(o, p);} //import { noScroll } from "../lib/util"; var Modal = /*#__PURE__*/function (_Component) {_inherits(Modal, _Component); function Modal(props) {var _this;_classCallCheck(this, Modal); _this = _possibleConstructorReturn(this, _getPrototypeOf(Modal).call(this, props)); _this.state = { isShowing: true, show: false }; _this.close = _this.close.bind(_assertThisInitialized(_this));return _this; }_createClass(Modal, [{ key: "componentDidMount", value: function componentDidMount() { this.setState({ show: true }); // Disabling the noscroll for now // noScroll(true); } }, { key: "componentDidUpdate", value: function componentDidUpdate() { var content = window.document.getElementById("modal-content"); if (content) { content.style["margin-top"] = window.scrollY + 20 + "px"; } } }, { key: "componentWillUnmount", value: function componentWillUnmount() { // noScroll(false); } }, { key: "render", value: function render() { if (!this.state.isShowing) { return null; } return ( react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "modal close-on-click" + this.props.className, "data-show": this.state.show, onClick: this.close }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "modal-content", id: "modal-content" }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", { className: "modal-close-button close-on-click", onClick: this.close }, "\xD7"), this.props.children))); } }, { key: "close", value: function close( e) { if (!e.target.className.includes("close-on-click")) { return false; } if (this.props.didClose) { this.props.didClose(); } this.setState({ isShowing: false }); e.stopPropagation(); } }]);return Modal;}(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); /* harmony default export */ __webpack_exports__["default"] = (Modal); /***/ }), /***/ "./client/component/MovieModal.js": /*!****************************************!*\ !*** ./client/component/MovieModal.js ***! \****************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return MovieModal; }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _Modal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Modal */ "./client/component/Modal.js"); /* harmony import */ var _lib_apollo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/apollo */ "./client/lib/apollo.js"); /* harmony import */ var graphql_tag__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! graphql-tag */ "./node_modules/graphql-tag/src/index.js"); /* harmony import */ var graphql_tag__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(graphql_tag__WEBPACK_IMPORTED_MODULE_3__); function _typeof(obj) {if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {_typeof = function _typeof(obj) {return typeof obj;};} else {_typeof = function _typeof(obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;};}return _typeof(obj);}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a 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);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}function _possibleConstructorReturn(self, call) {if (call && (_typeof(call) === "object" || typeof call === "function")) {return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o) {_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {return o.__proto__ || Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self) {if (self === void 0) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function");}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });if (superClass) _setPrototypeOf(subClass, superClass);}function _setPrototypeOf(o, p) {_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {o.__proto__ = p;return o;};return _setPrototypeOf(o, p);} var MovieModal = /*#__PURE__*/function (_Component) {_inherits(MovieModal, _Component); function MovieModal(props) {var _this;_classCallCheck(this, MovieModal); _this = _possibleConstructorReturn(this, _getPrototypeOf(MovieModal).call(this, props)); _this.state = { url: "", saving: false }; _this.setURL = _this.setURL.bind(_assertThisInitialized(_this)); _this.saveMovie = _this.saveMovie.bind(_assertThisInitialized(_this));return _this; }_createClass(MovieModal, [{ key: "render", value: function render() { return ( react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_Modal__WEBPACK_IMPORTED_MODULE_1__["default"], { didClose: this.props.onClose }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "movie-modal" }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("h3", null, "Add Movie"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("input", { type: "text", className: "inputtext", placeholder: "Youtube or MP4 URL", value: this.state.url, onChange: this.setURL }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button", { onClick: this.saveMovie }, this.state.saving ? react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", null, "Saving") : react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", null, "Save"))))); } }, { key: "setURL", value: function setURL( e) { this.setState({ url: e.target.value }); } }, { key: "saveMovie", value: function saveMovie() { if (!this.state.url || this.state.saving) { return; } this.setState({ saving: true }); if (this.props.onSave) { this.props.onSave(this.state.url); } } }]);return MovieModal;}(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); /***/ }), /***/ "./client/component/PlaylistItem.js": /*!******************************************!*\ !*** ./client/component/PlaylistItem.js ***! \******************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return PlaylistItem; }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _Modal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Modal */ "./client/component/Modal.js"); /* harmony import */ var _lib_apollo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/apollo */ "./client/lib/apollo.js"); /* harmony import */ var graphql_tag__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! graphql-tag */ "./node_modules/graphql-tag/src/index.js"); /* harmony import */ var graphql_tag__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(graphql_tag__WEBPACK_IMPORTED_MODULE_3__); function _typeof(obj) {if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {_typeof = function _typeof(obj) {return typeof obj;};} else {_typeof = function _typeof(obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;};}return _typeof(obj);}function _templateObject3() {var data = _taggedTemplateLiteral(["\n mutation UpdatePlaylistItem($playlistItemId: ID!, $duration: Float) {\n updatePlaylistItem(playlistItemId: $playlistItemId, duration: $duration)\n }\n "]);_templateObject3 = function _templateObject3() {return data;};return data;}function _templateObject2() {var data = _taggedTemplateLiteral(["\n mutation UpdatePlaylistItem($playlistItemId: ID!, $fadeToNextItem: Boolean) {\n updatePlaylistItem(playlistItemId: $playlistItemId, fadeToNextItem: $fadeToNextItem)\n }\n "]);_templateObject2 = function _templateObject2() {return data;};return data;}function _templateObject() {var data = _taggedTemplateLiteral(["\n mutation Remove($playlistItemId: ID!) {\n removePlaylistItem(playlistItemId: $playlistItemId)\n }\n "]);_templateObject = function _templateObject() {return data;};return data;}function _taggedTemplateLiteral(strings, raw) {if (!raw) {raw = strings.slice(0);}return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } }));}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a 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);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}function _possibleConstructorReturn(self, call) {if (call && (_typeof(call) === "object" || typeof call === "function")) {return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o) {_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {return o.__proto__ || Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self) {if (self === void 0) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function");}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });if (superClass) _setPrototypeOf(subClass, superClass);}function _setPrototypeOf(o, p) {_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {o.__proto__ = p;return o;};return _setPrototypeOf(o, p);} var PlaylistItem = /*#__PURE__*/function (_Component) {_inherits(PlaylistItem, _Component); function PlaylistItem(props) {var _this;_classCallCheck(this, PlaylistItem); _this = _possibleConstructorReturn(this, _getPrototypeOf(PlaylistItem).call(this, props)); _this.state = { selectedItemId: props.item.item.playlistItemId, fadeToNextItem: props.item.item.fadeToNextItem || false, duration: props.item.item.duration || 7 }; _this.changeDuration = _this.changeDuration.bind(_assertThisInitialized(_this)); _this.deleteItem = _this.deleteItem.bind(_assertThisInitialized(_this)); _this.fade = _this.fade.bind(_assertThisInitialized(_this)); _this.updateDuration = _this.updateDuration.bind(_assertThisInitialized(_this));return _this; }_createClass(PlaylistItem, [{ key: "render", value: function render() {var item = this.props.item; return ( react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "playlist-item" }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "view" }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "stage" }, item.item.type == "VIDEO" ? react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("video", { width: "100%", height: "100%", controls: true, src: item.item.url }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("source", { src: item.item.url, type: "video/mp4" })) : react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "image-view", style: { backgroundImage: "url(".concat(item.item.url, ")") } }))), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "pane" }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("label", { className: "checkbox" }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("input", { type: "checkbox", onChange: this.fade, checked: this.state.fadeToNextItem || false }), " Fade to next item"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("input", { type: "text", className: "inputtext", placeholder: "Duration", onChange: this.changeDuration, onBlur: this.updateDuration, value: this.state.duration || this.props.item.item.duration || 7 })), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("a", { href: "#", onClick: this.deleteItem }, "Delete Item"))))); } }, { key: "deleteItem", value: function deleteItem() {var _this2 = this;var item = this.props.item.item; if (!item) { return; } if (confirm("Are you sure you want to delete this item?")) { console.log("deleting", { playlistItemId: item.playlistItemId }); var query = graphql_tag__WEBPACK_IMPORTED_MODULE_3___default()(_templateObject()); return Object(_lib_apollo__WEBPACK_IMPORTED_MODULE_2__["mutate"])(query, { variables: { playlistItemId: item.playlistItemId } }). then(function (a) { if (_this2.props.onUpdate) { _this2.props.onUpdate(); } }); } } }, { key: "fade", value: function fade( e) {var item = this.props.item.item; var query = graphql_tag__WEBPACK_IMPORTED_MODULE_3___default()(_templateObject2()); var fadeToNextItem = e.target.checked; this.setState({ fadeToNextItem: fadeToNextItem }); return Object(_lib_apollo__WEBPACK_IMPORTED_MODULE_2__["mutate"])(query, { variables: { playlistItemId: item.playlistItemId, fadeToNextItem: fadeToNextItem } }). then(function (a) { item.fadeToNextItem = fadeToNextItem; }); } }, { key: "updateDuration", value: function updateDuration( e) {var item = this.props.item.item; var query = graphql_tag__WEBPACK_IMPORTED_MODULE_3___default()(_templateObject3()); var duration = +e.target.value; this.setState({ duration: duration }); return Object(_lib_apollo__WEBPACK_IMPORTED_MODULE_2__["mutate"])(query, { variables: { playlistItemId: item.playlistItemId, duration: duration } }). then(function (a) { item.duration = duration; }); } }, { key: "changeDuration", value: function changeDuration( e) { this.setState({ duration: e.target.value }); } }], [{ key: "getDerivedStateFromProps", value: function getDerivedStateFromProps(props, state) {var _props$item$item, _props$item$item2;if (props.item.item.playlistItemId == state.selectedItemId) {return state;}return { duration: (_props$item$item = props.item.item) === null || _props$item$item === void 0 ? void 0 : _props$item$item.duration, fadeToNextItem: (_props$item$item2 = props.item.item) === null || _props$item$item2 === void 0 ? void 0 : _props$item$item2.fadeToNextItem, selectedItemId: props.item.item.playlistItemId };} }]);return PlaylistItem;}(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); /***/ }), /***/ "./client/component/PlaylistModal.js": /*!*******************************************!*\ !*** ./client/component/PlaylistModal.js ***! \*******************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return PlaylistModal; }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _Modal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Modal */ "./client/component/Modal.js"); /* harmony import */ var _lib_apollo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/apollo */ "./client/lib/apollo.js"); /* harmony import */ var graphql_tag__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! graphql-tag */ "./node_modules/graphql-tag/src/index.js"); /* harmony import */ var graphql_tag__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(graphql_tag__WEBPACK_IMPORTED_MODULE_3__); function _typeof(obj) {if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {_typeof = function _typeof(obj) {return typeof obj;};} else {_typeof = function _typeof(obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;};}return _typeof(obj);}function _templateObject() {var data = _taggedTemplateLiteral(["\n query CreatePlaylist($name: String) {\n me {\n createPlaylist(name: $name)\n }\n }\n "]);_templateObject = function _templateObject() {return data;};return data;}function _taggedTemplateLiteral(strings, raw) {if (!raw) {raw = strings.slice(0);}return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } }));}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a 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);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}function _possibleConstructorReturn(self, call) {if (call && (_typeof(call) === "object" || typeof call === "function")) {return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o) {_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {return o.__proto__ || Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self) {if (self === void 0) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function");}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });if (superClass) _setPrototypeOf(subClass, superClass);}function _setPrototypeOf(o, p) {_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {o.__proto__ = p;return o;};return _setPrototypeOf(o, p);} var PlaylistModal = /*#__PURE__*/function (_Component) {_inherits(PlaylistModal, _Component); function PlaylistModal(props) {var _this;_classCallCheck(this, PlaylistModal); _this = _possibleConstructorReturn(this, _getPrototypeOf(PlaylistModal).call(this, props)); _this.state = { name: "", saving: false }; _this.setName = _this.setName.bind(_assertThisInitialized(_this)); _this.savePlaylist = _this.savePlaylist.bind(_assertThisInitialized(_this));return _this; }_createClass(PlaylistModal, [{ key: "render", value: function render() { return ( react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_Modal__WEBPACK_IMPORTED_MODULE_1__["default"], { didClose: this.props.onClose }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "playlist-modal" }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("h3", null, "Add Slideshow"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("label", null, "Slideshow Name"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("input", { type: "text", className: "inputtext", placeholder: "Name", value: this.state.name, onChange: this.setName }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button", { onClick: this.savePlaylist }, this.state.saving ? react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", null, "Saving") : react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("span", null, "Save"))))); } }, { key: "setName", value: function setName( e) { this.setState({ name: e.target.value }); } }, { key: "savePlaylist", value: function savePlaylist() {var _this2 = this; if (!this.state.name || this.state.saving) { return; } this.setState({ saving: true }); var query = graphql_tag__WEBPACK_IMPORTED_MODULE_3___default()(_templateObject()); Object(_lib_apollo__WEBPACK_IMPORTED_MODULE_2__["fetch"])(query, { variables: { name: this.state.name } }). then(function (data) { _this2.setState({ "false": true }); _this2.props.onClose(); }); } }]);return PlaylistModal;}(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); /***/ }), /***/ "./client/component/PlaylistSettingsModal.js": /*!***************************************************!*\ !*** ./client/component/PlaylistSettingsModal.js ***! \***************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return PlaylistSettingsModal; }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _Modal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Modal */ "./client/component/Modal.js"); /* harmony import */ var _lib_apollo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/apollo */ "./client/lib/apollo.js"); /* harmony import */ var graphql_tag__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! graphql-tag */ "./node_modules/graphql-tag/src/index.js"); /* harmony import */ var graphql_tag__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(graphql_tag__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _lib_util_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../lib/util.js */ "./client/lib/util.js"); function _typeof(obj) {if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {_typeof = function _typeof(obj) {return typeof obj;};} else {_typeof = function _typeof(obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;};}return _typeof(obj);}function _templateObject3() {var data = _taggedTemplateLiteral(["\n mutation Share($playlistId: ID!, $phone: String!) {\n sharePlaylist(playlistId: $playlistId, phone: $phone)\n }\n "]);_templateObject3 = function _templateObject3() {return data;};return data;}function _templateObject2() {var data = _taggedTemplateLiteral(["\n mutation UpdatePlaylist($playlistId: ID!, $name: String!) {\n updatePlaylist(playlistId: $playlistId, name: $name)\n }\n "]);_templateObject2 = function _templateObject2() {return data;};return data;}function _templateObject() {var data = _taggedTemplateLiteral(["\n mutation RemovePlaylist($playlistId: ID!) {\n removePlaylist(playlistId: $playlistId)\n }\n "]);_templateObject = function _templateObject() {return data;};return data;}function _taggedTemplateLiteral(strings, raw) {if (!raw) {raw = strings.slice(0);}return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } }));}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a 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);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}function _possibleConstructorReturn(self, call) {if (call && (_typeof(call) === "object" || typeof call === "function")) {return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o) {_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {return o.__proto__ || Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self) {if (self === void 0) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function");}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });if (superClass) _setPrototypeOf(subClass, superClass);}function _setPrototypeOf(o, p) {_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {o.__proto__ = p;return o;};return _setPrototypeOf(o, p);} var PlaylistSettingsModal = /*#__PURE__*/function (_Component) {_inherits(PlaylistSettingsModal, _Component); function PlaylistSettingsModal(props) {var _this$props$item;var _this;_classCallCheck(this, PlaylistSettingsModal); _this = _possibleConstructorReturn(this, _getPrototypeOf(PlaylistSettingsModal).call(this, props)); _this.state = { deleting: false, name: ((_this$props$item = _this.props.item) === null || _this$props$item === void 0 ? void 0 : _this$props$item.label) || "", sharing: "" }; _this.confirmDelete = _this.confirmDelete.bind(_assertThisInitialized(_this)); _this.update = _this.update.bind(_assertThisInitialized(_this)); _this.submit = _this.submit.bind(_assertThisInitialized(_this)); _this.share = _this.share.bind(_assertThisInitialized(_this));return _this; }_createClass(PlaylistSettingsModal, [{ key: "render", value: function render() {var _this2 = this; return ( react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_Modal__WEBPACK_IMPORTED_MODULE_1__["default"], { didClose: this.props.onClose }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "settings-modal" }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("h3", null, "Settings"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p", null, "Change playlist name"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "_share" }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("input", { type: "text", className: "inputtext", onChange: function onChange(e) {return _this2.update("shareNumber", e.target.value);}, placeholder: "Phone Number", value: this.state.shareNumber || "" }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button", { onClick: this.share, className: this.state.sharing == "Shared" ? "_success" : "" }, this.state.sharing || "Share"))), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("hr", null), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("input", { type: "text", className: "inputtext", onChange: function onChange(e) {return _this2.update("name", e.target.value);}, placeholder: "Name", value: this.state.name }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "submit-block" }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("a", { href: "#", className: "red-link", onClick: this.confirmDelete }, this.state.deleting ? "Deleting" : "Delete", " Slideshow"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button", { onClick: this.submit }, "Save"))))); } }, { key: "confirmDelete", value: function confirmDelete() {var _this$props$item2; var playlistId = (_this$props$item2 = this.props.item) === null || _this$props$item2 === void 0 ? void 0 : _this$props$item2.value; if (confirm("Are you sure you want to delete this slideshow?")) { this.setState({ deleting: true }); var query = graphql_tag__WEBPACK_IMPORTED_MODULE_3___default()(_templateObject()); this.setState({ deleting: true }); return Object(_lib_apollo__WEBPACK_IMPORTED_MODULE_2__["mutate"])(query, { variables: { playlistId: playlistId } }). then(function () { location.reload(); }); } } }, { key: "update", value: function update( name, value) { this.setState(function (state) { state[name] = value; if (name == "shareNumber") { state["sharing"] = ""; } return state; }); } }, { key: "submit", value: function submit() {var _this$props$item3,_this3 = this; var playlistId = (_this$props$item3 = this.props.item) === null || _this$props$item3 === void 0 ? void 0 : _this$props$item3.value; if (!playlistId) { return; } console.log("submit..."); var query = graphql_tag__WEBPACK_IMPORTED_MODULE_3___default()(_templateObject2()); return Object(_lib_apollo__WEBPACK_IMPORTED_MODULE_2__["mutate"])(query, { variables: { playlistId: playlistId, name: this.state.name } }). then(function (a) { console.log("yay"); _this3.props.onUpdate({ playlistId: playlistId, name: _this3.state.name }); }); } }, { key: "share", value: function share() {var _this$props$item4,_this4 = this; this.setState({ sharing: "Sharing" }); var phone = Object(_lib_util_js__WEBPACK_IMPORTED_MODULE_4__["formatPhone"])(this.state.shareNumber); var playlistId = (_this$props$item4 = this.props.item) === null || _this$props$item4 === void 0 ? void 0 : _this$props$item4.value; var query = graphql_tag__WEBPACK_IMPORTED_MODULE_3___default()(_templateObject3()); return Object(_lib_apollo__WEBPACK_IMPORTED_MODULE_2__["mutate"])(query, { variables: { playlistId: playlistId, phone: phone } }). then(function (a) { _this4.setState({ sharing: "Shared" }); }); } }]);return PlaylistSettingsModal;}(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); /***/ }), /***/ "./client/component/UploadToS3.js": /*!****************************************!*\ !*** ./client/component/UploadToS3.js ***! \****************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return UploadToS3; }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _lib_xhr__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/xhr */ "./client/lib/xhr.js"); /* harmony import */ var _lib_apollo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/apollo */ "./client/lib/apollo.js"); /* harmony import */ var graphql_tag__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! graphql-tag */ "./node_modules/graphql-tag/src/index.js"); /* harmony import */ var graphql_tag__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(graphql_tag__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var react_dropzone_s3_uploader__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-dropzone-s3-uploader */ "./node_modules/react-dropzone-s3-uploader/lib/index.js"); /* harmony import */ var react_dropzone_s3_uploader__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_dropzone_s3_uploader__WEBPACK_IMPORTED_MODULE_4__); function _typeof(obj) {if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {_typeof = function _typeof(obj) {return typeof obj;};} else {_typeof = function _typeof(obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;};}return _typeof(obj);}function _templateObject() {var data = _taggedTemplateLiteral(["\n query UploadUrl {\n uploadUrl\n }\n "]);_templateObject = function _templateObject() {return data;};return data;}function _taggedTemplateLiteral(strings, raw) {if (!raw) {raw = strings.slice(0);}return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } }));}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a 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);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}function _possibleConstructorReturn(self, call) {if (call && (_typeof(call) === "object" || typeof call === "function")) {return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o) {_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {return o.__proto__ || Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self) {if (self === void 0) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function");}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });if (superClass) _setPrototypeOf(subClass, superClass);}function _setPrototypeOf(o, p) {_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {o.__proto__ = p;return o;};return _setPrototypeOf(o, p);} var UploadToS3 = /*#__PURE__*/function (_Component) {_inherits(UploadToS3, _Component); function UploadToS3(props) {var _this;_classCallCheck(this, UploadToS3); _this = _possibleConstructorReturn(this, _getPrototypeOf(UploadToS3).call(this, props)); _this.handleFinishedUpload = _this.handleFinishedUpload.bind(_assertThisInitialized(_this)); _this.onProgress = _this.onProgress.bind(_assertThisInitialized(_this)); _this.state = { progress: 0 };return _this; }_createClass(UploadToS3, [{ key: "handleFinishedUpload", value: function handleFinishedUpload( info) { this.setState({ progress: 0 }); this.props.onUpload({ url: info.fileUrl }); } }, { key: "onProgress", value: function onProgress( progress) { this.setState({ progress: progress }); } }, { key: "render", value: function render() { var uploadOptions = { server: window.location.origin, signingUrlQueryParams: { uploadType: "avatar" } }; var s3Url = "https://s3-us-west-2.amazonaws.com/media.crumbl.com"; return ( react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_dropzone_s3_uploader__WEBPACK_IMPORTED_MODULE_4___default.a, { onFinish: this.handleFinishedUpload, onProgress: this.onProgress, s3Url: s3Url, maxSize: 1024 * 1024 * 400 // 200 mb , upload: uploadOptions, style: { width: "100%", height: "100px" }, progressComponent: function progressComponent() {return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null);}, imageComponent: function imageComponent() {return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null);}, fileComponent: function fileComponent() {return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null);} }), this.state.progress > 0 && react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "progress-bar" }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { style: { width: "".concat(this.state.progress, "%") } })))); } }, { key: "uploadFile", value: function uploadFile( files) { var query = graphql_tag__WEBPACK_IMPORTED_MODULE_3___default()(_templateObject()); Object(_lib_apollo__WEBPACK_IMPORTED_MODULE_2__["fetch"])(query, {}).then(function (_ref) {var uploadUrl = _ref.uploadUrl; console.log("uploadurl:", uploadUrl); }); } }]);return UploadToS3;}(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); /***/ }), /***/ "./client/index.js": /*!*************************!*\ !*** ./client/index.js ***! \*************************/ /*! no exports provided */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _App__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./App */ "./client/App.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _style_app_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./style/app.scss */ "./client/style/app.scss"); /* harmony import */ var _style_app_scss__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_style_app_scss__WEBPACK_IMPORTED_MODULE_3__); react_dom__WEBPACK_IMPORTED_MODULE_2___default.a.render(react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_App__WEBPACK_IMPORTED_MODULE_0__["default"], null), document.getElementById("app")); /***/ }), /***/ "./client/lib/apollo.js": /*!******************************!*\ !*** ./client/lib/apollo.js ***! \******************************/ /*! exports provided: client, fetch, mutate */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "client", function() { return client; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fetch", function() { return fetch; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mutate", function() { return mutate; }); /* harmony import */ var apollo_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! apollo-client */ "./node_modules/apollo-client/bundle.esm.js"); /* harmony import */ var apollo_link_http__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! apollo-link-http */ "./node_modules/apollo-link-http/lib/bundle.esm.js"); /* harmony import */ var apollo_cache_inmemory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! apollo-cache-inmemory */ "./node_modules/apollo-cache-inmemory/lib/bundle.esm.js"); /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./util */ "./client/lib/util.js"); function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(source, true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(source).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}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;} var client = new apollo_client__WEBPACK_IMPORTED_MODULE_0__["ApolloClient"]({ name: "signage", link: new apollo_link_http__WEBPACK_IMPORTED_MODULE_1__["HttpLink"](), cache: new apollo_cache_inmemory__WEBPACK_IMPORTED_MODULE_2__["InMemoryCache"](), defaultOptions: { query: { fetchPolicy: "network-only", errorPolicy: "all" } } }); var mutate = function mutate(mutation) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; options = addHeaders(options); var body = _objectSpread({ mutation: mutation }, options); console.log("Graphql mutate: ", body); return client.mutate(body).then(function (_ref) {var data = _ref.data;return data;}); }; var fetch = function fetch(query) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; options = addHeaders(options); var body = _objectSpread({ query: query }, options); console.log("Graphql fetch: ", body); return client.query(body).then(function (_ref2) {var data = _ref2.data;return data;}); }; function addHeaders(options) { var token = Object(_util__WEBPACK_IMPORTED_MODULE_3__["fetchLocal"])("x-menu-token"); if (!options.context) options.context = {}; if (!options.context.headers) options.context.headers = {}; options.context.headers["x-menu-token"] = token || ""; return options; } /***/ }), /***/ "./client/lib/util.js": /*!****************************!*\ !*** ./client/lib/util.js ***! \****************************/ /*! exports provided: split, passThrough, passThroughAwait, extractId, isSingleFieldRequest, sortArrayOfObjects, formatPhone, fetchLocal, storeLocal */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "split", function() { return split; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "passThrough", function() { return passThrough; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "passThroughAwait", function() { return passThroughAwait; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extractId", function() { return extractId; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isSingleFieldRequest", function() { return isSingleFieldRequest; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sortArrayOfObjects", function() { return sortArrayOfObjects; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatPhone", function() { return formatPhone; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fetchLocal", function() { return fetchLocal; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "storeLocal", function() { return storeLocal; }); var split = function split(array, func) { var a = array.filter(func); var b = array.filter(function (i) {return !func(i);}); return [a, b]; }; var passThrough = function passThrough(fn) {return function (arg) { // Invoke fn but return the passed arg right away. try { fn(arg); return arg; } catch (e) { // If there's an error make sure the Promise Chain stops. throw e; } };}; var formatPhone = function formatPhone(number) { if (!number) return ""; number = number.replace(/[^0-9]/g, ""); if (number.length > 0 && number[0] == "1") { number = number.slice(1, number.length); } var string = "("; for (var i = 0; i < Math.min(10, number.length); i++) { string += number[i]; if (i == 2 && number.length != 3) string += ") "; if (i == 5 && number.length != 6) string += "-"; } return string; }; var passThroughAwait = function passThroughAwait(fn) {return function (arg) { return Promise.resolve(fn.call(fn, arg)).then(function () {return arg;}); };}; function isSingleFieldRequest(parentName, info) { var parentNode = info.fieldNodes.find(function (n) {return n.name.value == parentName;}); if (!parentNode) { return null; } var selections = parentNode.selectionSet.selections; if (selections.length == 1 && selections[0].kind == "Field" && selections[0].name.kind == "Name") { return selections[0].name.value; } return null; } function extractId(input) { var id = input.id; delete input.id; return { id: id, fields: input }; } function sortArrayOfObjects(arrayOfObjects, fieldToSortBy) { function mergeSort(arr) { if (arr.length < 2) return arr; var middle = Math.floor(arr.length / 2); var left = arr.slice(0, middle); var right = arr.slice(middle, arr.length); return merge(mergeSort(left), mergeSort(right)); } function merge(left, right) { var result = []; while (left.length && right.length) { if (left[0][fieldToSortBy] <= right[0][fieldToSortBy]) { result.push(left.shift()); } else { result.push(right.shift()); } } while (left.length) {result.push(left.shift());} while (right.length) {result.push(right.shift());} return result; } return mergeSort(arrayOfObjects); } var storeLocal = function storeLocal(key, val) { if (val) { window.localStorage[key] = JSON.stringify(val); } else { delete window.localStorage[key]; } }; var fetchLocal = function fetchLocal(key) { var item = window.localStorage[key]; if (item) { return JSON.parse(item); } return null; }; /***/ }), /***/ "./client/lib/xhr.js": /*!***************************!*\ !*** ./client/lib/xhr.js ***! \***************************/ /*! exports provided: get, post, put, deleteRequest, cancel, setToken */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return get; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "post", function() { return post; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "put", function() { return put; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deleteRequest", function() { return deleteRequest; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cancel", function() { return cancel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setToken", function() { return setToken; }); /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! axios */ "./node_modules/axios/index.js"); /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util */ "./client/lib/util.js"); var token = Object(_util__WEBPACK_IMPORTED_MODULE_1__["fetchLocal"])("token") || ""; var createApi = function createApi() { return axios__WEBPACK_IMPORTED_MODULE_0___default.a.create({ // eslint-disable-next-line no-undef //baseURL: ", timeout: 5 * 60 * 1000, headers: { Accept: "application/json", "Content-Type": "application/json", "x-menu-token": token } }); }; var crumbl = createApi(); var setToken = function setToken(t) { token = t; Object(_util__WEBPACK_IMPORTED_MODULE_1__["storeLocal"])("token", t); crumbl = createApi(); }; var cancel = function cancel() { return axios__WEBPACK_IMPORTED_MODULE_0__["CancelToken"].source(); }; var post = function post(path, body) {var cancel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; return crumbl.post(path, body, { cancelToken: cancel.token }); }; var put = function put(path, body) {var cancel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; return crumbl.put(path, body, { cancelToken: cancel.token }); }; var deleteRequest = function deleteRequest(path, body) {var cancel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; return crumbl["delete"](path, { cancelToken: cancel.token }); }; var get = function get(path) {var cancel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return crumbl.get(path, { cancelToken: cancel.token }); }; /***/ }), /***/ "./client/page/Login.js": /*!******************************!*\ !*** ./client/page/Login.js ***! \******************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Login; }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _lib_apollo__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/apollo */ "./client/lib/apollo.js"); /* harmony import */ var _lib_xhr__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/xhr */ "./client/lib/xhr.js"); /* harmony import */ var _lib_util_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lib/util.js */ "./client/lib/util.js"); /* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router-dom/es/index.js"); /* harmony import */ var graphql_tag__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! graphql-tag */ "./node_modules/graphql-tag/src/index.js"); /* harmony import */ var graphql_tag__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(graphql_tag__WEBPACK_IMPORTED_MODULE_5__); function _typeof(obj) {if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {_typeof = function _typeof(obj) {return typeof obj;};} else {_typeof = function _typeof(obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;};}return _typeof(obj);}function _templateObject2() {var data = _taggedTemplateLiteral(["\n query Validate($phone: String, $code: String) {\n validate(phone: $phone, code: $code) {\n token\n user {\n userId\n phoneNumber\n }\n }\n }\n "]);_templateObject2 = function _templateObject2() {return data;};return data;}function _templateObject() {var data = _taggedTemplateLiteral(["\n query RequestValidation($phone: String) {\n requestValidation(phone: $phone)\n }\n "]);_templateObject = function _templateObject() {return data;};return data;}function _taggedTemplateLiteral(strings, raw) {if (!raw) {raw = strings.slice(0);}return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } }));}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 _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a 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);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}function _possibleConstructorReturn(self, call) {if (call && (_typeof(call) === "object" || typeof call === "function")) {return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o) {_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {return o.__proto__ || Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self) {if (self === void 0) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function");}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });if (superClass) _setPrototypeOf(subClass, superClass);}function _setPrototypeOf(o, p) {_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {o.__proto__ = p;return o;};return _setPrototypeOf(o, p);} var Login = /*#__PURE__*/function (_Component) {_inherits(Login, _Component); function Login(props) {var _this;_classCallCheck(this, Login); _this = _possibleConstructorReturn(this, _getPrototypeOf(Login).call(this, props)); _this.login = _this.login.bind(_assertThisInitialized(_this)); _this.update = _this.update.bind(_assertThisInitialized(_this)); _this.sendVerification = _this.sendVerification.bind(_assertThisInitialized(_this)); _this.state = { didSendVerification: false, phone: "", verification: "", formattedPhone: "" };return _this; }_createClass(Login, [{ key: "update", value: function update( e) { this.setState(_defineProperty({}, e.target.name, e.target.value)); } }, { key: "render", value: function render() { if (Object(_lib_util_js__WEBPACK_IMPORTED_MODULE_3__["fetchLocal"])("x-menu-token")) { return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_4__["Redirect"], { to: "/main" }); } return ( react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "login-page bg-pan-tl" }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "login-form" }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("h2", null, "Menu App"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("label", null, "Phone Number"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("input", { type: "text", className: "inputtext", name: "phone", value: Object(_lib_util_js__WEBPACK_IMPORTED_MODULE_3__["formatPhone"])(this.state.phone), onChange: this.update, pattern: "\\d*" }), this.state.didSendVerification && react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("label", null, "Verification Code"), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("input", { type: "text", className: "inputtext", name: "verification", value: this.state.verification, onChange: this.update, pattern: "\\d*" }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button", { className: "light", onClick: this.login }, "Login")), !this.state.didSendVerification && react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button", { className: "light", onClick: this.sendVerification }, "Send Verification")), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "login-copyright" }, "\xA9 2019. All Rights Reserved"))); } }, { key: "sendVerification", value: function sendVerification() { var query = graphql_tag__WEBPACK_IMPORTED_MODULE_5___default()(_templateObject()); this.setState({ didSendVerification: true }); Object(_lib_apollo__WEBPACK_IMPORTED_MODULE_1__["fetch"])(query, { variables: { phone: this.state.phone } }); } }, { key: "login", value: function login() {var _this2 = this; var query = graphql_tag__WEBPACK_IMPORTED_MODULE_5___default()(_templateObject2()); Object(_lib_apollo__WEBPACK_IMPORTED_MODULE_1__["fetch"])(query, { variables: { phone: this.state.phone, code: this.state.verification } }). then(function (data) {var _data$validate = data.validate,token = _data$validate.token,user = _data$validate.user; Object(_lib_util_js__WEBPACK_IMPORTED_MODULE_3__["storeLocal"])("x-menu-token", token); Object(_lib_util_js__WEBPACK_IMPORTED_MODULE_3__["storeLocal"])("user", user); Object(_lib_xhr__WEBPACK_IMPORTED_MODULE_2__["setToken"])(token); _this2.props.history.push("/main"); }); } }]);return Login;}(react__WEBPACK_IMPORTED_MODULE_0__["Component"]); /***/ }), /***/ "./client/page/Main.js": /*!*****************************!*\ !*** ./client/page/Main.js ***! \*****************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Main; }); /* harmony import */ var _component_AppleTVModal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../component/AppleTVModal */ "./client/component/AppleTVModal.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var react_drag_sortable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-drag-sortable */ "./node_modules/react-drag-sortable/lib/index.js"); /* harmony import */ var react_drag_sortable__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_drag_sortable__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _lib_apollo__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lib/apollo */ "./client/lib/apollo.js"); /* harmony import */ var graphql_tag__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! graphql-tag */ "./node_modules/graphql-tag/src/index.js"); /* harmony import */ var graphql_tag__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(graphql_tag__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var _component_PlaylistItem__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../component/PlaylistItem */ "./client/component/PlaylistItem.js"); /* harmony import */ var _component_PlaylistModal__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../component/PlaylistModal */ "./client/component/PlaylistModal.js"); /* harmony import */ var _component_PlaylistSettingsModal__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../component/PlaylistSettingsModal */ "./client/component/PlaylistSettingsModal.js"); /* harmony import */ var _component_MovieModal__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../component/MovieModal */ "./client/component/MovieModal.js"); /* harmony import */ var react_dropdown__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react-dropdown */ "./node_modules/react-dropdown/dist/index.js"); /* harmony import */ var react_dropdown__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(react_dropdown__WEBPACK_IMPORTED_MODULE_9__); /* harmony import */ var _component_UploadToS3__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../component/UploadToS3 */ "./client/component/UploadToS3.js"); /* harmony import */ var react_dropdown_style_css__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! react-dropdown/style.css */ "./node_modules/react-dropdown/style.css"); /* harmony import */ var react_dropdown_style_css__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(react_dropdown_style_css__WEBPACK_IMPORTED_MODULE_11__); /* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router-dom/es/index.js"); /* harmony import */ var _lib_xhr__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../lib/xhr */ "./client/lib/xhr.js"); /* harmony import */ var _lib_util_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../lib/util.js */ "./client/lib/util.js"); function _typeof(obj) {if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {_typeof = function _typeof(obj) {return typeof obj;};} else {_typeof = function _typeof(obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;};}return _typeof(obj);}function _templateObject6() {var data = _taggedTemplateLiteral(["\n query CreatePlaylist($name: String) {\n me {\n createPlaylist(name: $name)\n }\n }\n "]);_templateObject6 = function _templateObject6() {return data;};return data;}function _templateObject5() {var data = _taggedTemplateLiteral(["\n query PlaylistQuery {\n me {\n userId\n playlistConnection {\n playlists {\n playlistId\n name\n }\n }\n }\n }\n "]);_templateObject5 = function _templateObject5() {return data;};return data;}function _templateObject4() {var data = _taggedTemplateLiteral(["\n mutation UpdatePlaylistItem($playlistItemId: ID!, $order: Int) {\n updatePlaylistItem(playlistItemId: $playlistItemId, order: $order)\n }\n "]);_templateObject4 = function _templateObject4() {return data;};return data;}function _templateObject3() {var data = _taggedTemplateLiteral(["\n query A($playlistId: ID!) {\n playlist(id: $playlistId) {\n playlistId\n itemConnection {\n items {\n playlistItemId\n url\n thumbnailUrl\n duration\n fadeToNextItem\n type\n }\n }\n }\n }\n "]);_templateObject3 = function _templateObject3() {return data;};return data;}function _templateObject2() {var data = _taggedTemplateLiteral(["\n query GenerateCode($id: ID!) {\n playlist(id: $id) {\n appleTVCode\n }\n }\n "]);_templateObject2 = function _templateObject2() {return data;};return data;}function _templateObject() {var data = _taggedTemplateLiteral(["\n query AddItem($playlist: ID!, $url: String!, $type: Type!, $order: Int!) {\n playlist(id: $playlist) {\n addItem(order: $order, url: $url, type: $type) {\n playlistItemId\n url\n type\n thumbnailUrl\n order\n }\n }\n }\n "]);_templateObject = function _templateObject() {return data;};return data;}function _taggedTemplateLiteral(strings, raw) {if (!raw) {raw = strings.slice(0);}return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } }));}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a 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);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}function _possibleConstructorReturn(self, call) {if (call && (_typeof(call) === "object" || typeof call === "function")) {return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o) {_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {return o.__proto__ || Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self) {if (self === void 0) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function");}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });if (superClass) _setPrototypeOf(subClass, superClass);}function _setPrototypeOf(o, p) {_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {o.__proto__ = p;return o;};return _setPrototypeOf(o, p);} var Main = /*#__PURE__*/function (_Component) {_inherits(Main, _Component); function Main(props) {var _this;_classCallCheck(this, Main); _this = _possibleConstructorReturn(this, _getPrototypeOf(Main).call(this, props)); _this.onSort = _this.onSort.bind(_assertThisInitialized(_this)); _this.activate = _this.setActive.bind(_assertThisInitialized(_this)); _this.didUpload = _this.didUpload.bind(_assertThisInitialized(_this)); _this.updateUrl = _this.updateUrl.bind(_assertThisInitialized(_this)); _this.generateCode = _this.generateCode.bind(_assertThisInitialized(_this)); _this.selectPlaylist = _this.selectPlaylist.bind(_assertThisInitialized(_this)); _this.createBasePlaylist = _this.createBasePlaylist.bind(_assertThisInitialized(_this)); _this.fetchPlaylist = _this.fetchPlaylist.bind(_assertThisInitialized(_this)); _this.logout = _this.logout.bind(_assertThisInitialized(_this)); _this.onPlaylistItemUpdate = _this.onPlaylistItemUpdate.bind(_assertThisInitialized(_this)); _this.toggleModal = _this.toggleModal.bind(_assertThisInitialized(_this)); _this.state = { playlists: [], activeItemIndex: 0, items: [], url: "", appleTVKey: "", showAppleTVModal: false, showPlaylistSettingsModal: false, showPlaylistModal: false, showMovieModal: false, redirect: Object(_lib_util_js__WEBPACK_IMPORTED_MODULE_14__["fetchLocal"])("x-menu-token") === null ? "/" : false, showUpload: true };return _this; }_createClass(Main, [{ key: "componentDidMount", value: function componentDidMount() { this.fetchPlaylist(); } }, { key: "render", value: function render() {var _this2 = this; if (this.state.redirect) { return react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__["Redirect"], { to: this.state.redirect }); }var _this$state = this.state,items = _this$state.items,activeItemIndex = _this$state.activeItemIndex; var list = items.map(function (item, i) {return { content: react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("div", { className: "content-cnt" }, react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("span", null, i + 1), react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("div", { className: "content", style: { backgroundImage: "url(".concat(item.type == "IMAGE" ? item.url : item.thumbnailUrl, ")"), backgroundColor: "gray" }, onClick: function onClick() {return _this2.setActive(i);} })), classes: activeItemIndex == i ? ["active thumbnail"] : ["thumbnail"], image: item.url, item: item };}); var options = this.state.playlists.map(function (p) {return { value: p.playlistId, label: p.name };}) || []; var defaultOption = options.find(function (option) {return option.value == _this2.state.selectedPlaylistId;}); options.push({ value: "+", label: "Add Slideshow" }); return ( react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("div", { className: "main" }, react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("div", { className: "header" }, react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("div", { className: "header-left" }, react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react_dropdown__WEBPACK_IMPORTED_MODULE_9___default.a, { style: { width: "200px" }, options: options, onChange: this.selectPlaylist, value: defaultOption, placeholder: "Select an option" }), defaultOption && react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("a", { href: "#", onClick: function onClick() {return _this2.toggleModal("showPlaylistSettingsModal");} }, "Settings")), react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("button", { onClick: this.generateCode }, "Generate code"), react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("button", { className: "darker", onClick: this.logout }, "Logout")), this.state.showAppleTVModal && react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_component_AppleTVModal__WEBPACK_IMPORTED_MODULE_0__["default"], { appleTVKey: this.state.appleTVKey, onClose: function onClose() {return _this2.toggleModal("showAppleTVModal");} }), this.state.showPlaylistModal && react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_component_PlaylistModal__WEBPACK_IMPORTED_MODULE_6__["default"], { onClose: function onClose() {return _this2.toggleModal("showPlaylistModal");} }), this.state.showPlaylistSettingsModal && react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_component_PlaylistSettingsModal__WEBPACK_IMPORTED_MODULE_7__["default"], { item: defaultOption, onClose: function onClose() {return _this2.toggleModal("showPlaylistSettingsModal");}, onUpdate: function onUpdate(update) {return _this2.updatePlaylist(update);} }), react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("div", { className: "presentation" }, react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("div", { className: "thumbnails", style: { textAlign: "center" } }, react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(react_drag_sortable__WEBPACK_IMPORTED_MODULE_2___default.a, { items: list, type: "vertical", onSort: this.onSort, moveTransitionDuration: 0.3 }), react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("div", { className: "add-block" }, react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_component_UploadToS3__WEBPACK_IMPORTED_MODULE_10__["default"], { onUpload: this.didUpload }))), list.length > 0 && list[activeItemIndex] && react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(_component_PlaylistItem__WEBPACK_IMPORTED_MODULE_5__["default"], { item: list[activeItemIndex], onUpdate: this.onPlaylistItemUpdate })))); } }, { key: "updateUrl", value: function updateUrl( e) { this.setState({ url: e.target.value }); } }, { key: "didUpload", value: function didUpload(_ref) {var _this3 = this;var url = _ref.url; var type = ["jpg", "jpeg", "png"].find(function (ext) {return url.endsWith(ext);}) ? "IMAGE" : "VIDEO"; var query = graphql_tag__WEBPACK_IMPORTED_MODULE_4___default()(_templateObject()); var item = { playlist: this.state.selectedPlaylistId, url: url, type: type, order: 0 }; console.log("Saving", url); this.setState({ showUpload: false }); Object(_lib_apollo__WEBPACK_IMPORTED_MODULE_3__["fetch"])(query, { variables: item }). then(function (data) { var item = data.playlist.addItem; _this3.setState({ items: [item].concat(_this3.state.items || []), showUpload: true }); }); } }, { key: "generateCode", value: function generateCode() {var _this4 = this; var query = graphql_tag__WEBPACK_IMPORTED_MODULE_4___default()(_templateObject2()); Object(_lib_apollo__WEBPACK_IMPORTED_MODULE_3__["fetch"])(query, { variables: { id: this.state.selectedPlaylistId } }).then( //data => alert("Enter code in apple TV:" + data.playlist.appleTVCode) function (data) {return ( _this4.setState({ showAppleTVModal: true, appleTVKey: data.playlist.appleTVCode }));}); } }, { key: "selectPlaylist", value: function selectPlaylist(_ref2) {var _this5 = this;var value = _ref2.value; if (value == "+") { return this.toggleModal("showPlaylistModal"); } this.setState({ items: [], selectedPlaylistId: value }); var query = graphql_tag__WEBPACK_IMPORTED_MODULE_4___default()(_templateObject3()); Object(_lib_apollo__WEBPACK_IMPORTED_MODULE_3__["fetch"])(query, { variables: { playlistId: value } }).then(function (data) { _this5.setState({ items: data.playlist.itemConnection.items }); }); } }, { key: "setActive", value: function setActive( activeItemIndex) { this.setState({ activeItemIndex: activeItemIndex }); } }, { key: "onSort", value: function onSort( list) { console.log(list); var items = list.map(function (li) {return li.item;}); this.setState({ items: items }); Promise.all( list.map(function (_ref3, index) {var item = _ref3.item; var query = graphql_tag__WEBPACK_IMPORTED_MODULE_4___default()(_templateObject4()); return Object(_lib_apollo__WEBPACK_IMPORTED_MODULE_3__["mutate"])(query, { variables: { playlistItemId: item.playlistItemId, order: index } }). then(function (a) {return console.log(a);}); })); } }, { key: "toggleModal", value: function toggleModal( modal) {var _this6 = this; this.setState(function (state) { state[modal] = !state[modal]; //update on hide if (modal == "showPlaylistModal" && !state[modal]) { _this6.fetchPlaylist(); } return { state: state }; }); } }, { key: "fetchPlaylist", value: function fetchPlaylist() {var _this7 = this; var query = graphql_tag__WEBPACK_IMPORTED_MODULE_4___default()(_templateObject5()); Object(_lib_apollo__WEBPACK_IMPORTED_MODULE_3__["fetch"])(query).then(function (data) {var _data$me$playlistConn; if (_this7.state.redirect) { return; } var playlists = (_data$me$playlistConn = data.me.playlistConnection.playlists) === null || _data$me$playlistConn === void 0 ? void 0 : _data$me$playlistConn.sort(function (a, b) {return (a.name || "").localeCompare(b.name || "");}); _this7.setState( { playlists: playlists }, function () { if (playlists.length > 0) { _this7.selectPlaylist({ value: playlists[0].playlistId }); } else { _this7.createBasePlaylist(); } }); }); } }, { key: "createBasePlaylist", value: function createBasePlaylist() {var _this8 = this; var query = graphql_tag__WEBPACK_IMPORTED_MODULE_4___default()(_templateObject6()); Object(_lib_apollo__WEBPACK_IMPORTED_MODULE_3__["fetch"])(query, { variables: { name: "My Playlist" } }). then(function () { _this8.fetchPlaylist(); }); } }, { key: "logout", value: function logout() { Object(_lib_util_js__WEBPACK_IMPORTED_MODULE_14__["storeLocal"])("x-menu-token", null); Object(_lib_util_js__WEBPACK_IMPORTED_MODULE_14__["storeLocal"])("user", null); Object(_lib_xhr__WEBPACK_IMPORTED_MODULE_13__["setToken"])(null); this.setState({ redirect: "/" }); } }, { key: "onPlaylistItemUpdate", value: function onPlaylistItemUpdate() { this.setState({ activeItemIndex: 0 }); this.selectPlaylist({ value: this.state.selectedPlaylistId }); } }, { key: "updatePlaylist", value: function updatePlaylist(_ref4) {var _this9 = this;var name = _ref4.name,playlistId = _ref4.playlistId; this.setState( function (state) { state.playlists = state.playlists.map(function (playlist) { if (playlist.playlistId == playlistId) { playlist.name = name; } return playlist; }); return state; }, function () {return _this9.toggleModal("showPlaylistSettingsModal");}); } }]);return Main;}(react__WEBPACK_IMPORTED_MODULE_1__["Component"]); /***/ }), /***/ "./client/style/app.scss": /*!*******************************!*\ !*** ./client/style/app.scss ***! \*******************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(/*! !../../node_modules/css-loader??ref--6-1!../../node_modules/sass-loader/lib/loader.js??ref--6-2!./app.scss */ "./node_modules/css-loader/index.js?!./node_modules/sass-loader/lib/loader.js?!./client/style/app.scss"); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(/*! ../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /***/ "./node_modules/@babel/runtime/helpers/esm/extends.js": /*!************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/esm/extends.js ***! \************************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _extends; }); function _extends() { _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; }; return _extends.apply(this, arguments); } /***/ }), /***/ "./node_modules/@wry/context/lib/context.esm.js": /*!******************************************************!*\ !*** ./node_modules/@wry/context/lib/context.esm.js ***! \******************************************************/ /*! exports provided: Slot, asyncFromGen, bind, noContext, setTimeout, wrapYieldingFiberMethods */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Slot", function() { return Slot; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asyncFromGen", function() { return asyncFromGen; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bind", function() { return bind; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "noContext", function() { return noContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTimeout", function() { return setTimeoutWithContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrapYieldingFiberMethods", function() { return wrapYieldingFiberMethods; }); // This currentContext variable will only be used if the makeSlotClass // function is called, which happens only if this is the first copy of the // @wry/context package to be imported. var currentContext = null; // This unique internal object is used to denote the absence of a value // for a given Slot, and is never exposed to outside code. var MISSING_VALUE = {}; var idCounter = 1; // Although we can't do anything about the cost of duplicated code from // accidentally bundling multiple copies of the @wry/context package, we can // avoid creating the Slot class more than once using makeSlotClass. var makeSlotClass = function () { return /** @class */ (function () { function Slot() { // If you have a Slot object, you can find out its slot.id, but you cannot // guess the slot.id of a Slot you don't have access to, thanks to the // randomized suffix. this.id = [ "slot", idCounter++, Date.now(), Math.random().toString(36).slice(2), ].join(":"); } Slot.prototype.hasValue = function () { for (var context_1 = currentContext; context_1; context_1 = context_1.parent) { // We use the Slot object iself as a key to its value, which means the // value cannot be obtained without a reference to the Slot object. if (this.id in context_1.slots) { var value = context_1.slots[this.id]; if (value === MISSING_VALUE) break; if (context_1 !== currentContext) { // Cache the value in currentContext.slots so the next lookup will // be faster. This caching is safe because the tree of contexts and // the values of the slots are logically immutable. currentContext.slots[this.id] = value; } return true; } } if (currentContext) { // If a value was not found for this Slot, it's never going to be found // no matter how many times we look it up, so we might as well cache // the absence of the value, too. currentContext.slots[this.id] = MISSING_VALUE; } return false; }; Slot.prototype.getValue = function () { if (this.hasValue()) { return currentContext.slots[this.id]; } }; Slot.prototype.withValue = function (value, callback, // Given the prevalence of arrow functions, specifying arguments is likely // to be much more common than specifying `this`, hence this ordering: args, thisArg) { var _a; var slots = (_a = { __proto__: null }, _a[this.id] = value, _a); var parent = currentContext; currentContext = { parent: parent, slots: slots }; try { // Function.prototype.apply allows the arguments array argument to be // omitted or undefined, so args! is fine here. return callback.apply(thisArg, args); } finally { currentContext = parent; } }; // Capture the current context and wrap a callback function so that it // reestablishes the captured context when called. Slot.bind = function (callback) { var context = currentContext; return function () { var saved = currentContext; try { currentContext = context; return callback.apply(this, arguments); } finally { currentContext = saved; } }; }; // Immediately run a callback function without any captured context. Slot.noContext = function (callback, // Given the prevalence of arrow functions, specifying arguments is likely // to be much more common than specifying `this`, hence this ordering: args, thisArg) { if (currentContext) { var saved = currentContext; try { currentContext = null; // Function.prototype.apply allows the arguments array argument to be // omitted or undefined, so args! is fine here. return callback.apply(thisArg, args); } finally { currentContext = saved; } } else { return callback.apply(thisArg, args); } }; return Slot; }()); }; // We store a single global implementation of the Slot class as a permanent // non-enumerable symbol property of the Array constructor. This obfuscation // does nothing to prevent access to the Slot class, but at least it ensures // the implementation (i.e. currentContext) cannot be tampered with, and all // copies of the @wry/context package (hopefully just one) will share the // same Slot implementation. Since the first copy of the @wry/context package // to be imported wins, this technique imposes a very high cost for any // future breaking changes to the Slot class. var globalKey = "@wry/context:Slot"; var host = Array; var Slot = host[globalKey] || function () { var Slot = makeSlotClass(); try { Object.defineProperty(host, globalKey, { value: host[globalKey] = Slot, enumerable: false, writable: false, configurable: false, }); } finally { return Slot; } }(); var bind = Slot.bind, noContext = Slot.noContext; function setTimeoutWithContext(callback, delay) { return setTimeout(bind(callback), delay); } // Turn any generator function into an async function (using yield instead // of await), with context automatically preserved across yields. function asyncFromGen(genFn) { return function () { var gen = genFn.apply(this, arguments); var boundNext = bind(gen.next); var boundThrow = bind(gen.throw); return new Promise(function (resolve, reject) { function invoke(method, argument) { try { var result = method.call(gen, argument); } catch (error) { return reject(error); } var next = result.done ? resolve : invokeNext; if (isPromiseLike(result.value)) { result.value.then(next, result.done ? reject : invokeThrow); } else { next(result.value); } } var invokeNext = function (value) { return invoke(boundNext, value); }; var invokeThrow = function (error) { return invoke(boundThrow, error); }; invokeNext(); }); }; } function isPromiseLike(value) { return value && typeof value.then === "function"; } // If you use the fibers npm package to implement coroutines in Node.js, // you should call this function at least once to ensure context management // remains coherent across any yields. var wrappedFibers = []; function wrapYieldingFiberMethods(Fiber) { // There can be only one implementation of Fiber per process, so this array // should never grow longer than one element. if (wrappedFibers.indexOf(Fiber) < 0) { var wrap = function (obj, method) { var fn = obj[method]; obj[method] = function () { return noContext(fn, arguments, this); }; }; // These methods can yield, according to // https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100 wrap(Fiber, "yield"); wrap(Fiber.prototype, "run"); wrap(Fiber.prototype, "throwInto"); wrappedFibers.push(Fiber); } return Fiber; } //# sourceMappingURL=context.esm.js.map /***/ }), /***/ "./node_modules/@wry/equality/lib/equality.esm.js": /*!********************************************************!*\ !*** ./node_modules/@wry/equality/lib/equality.esm.js ***! \********************************************************/ /*! exports provided: default, equal */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "equal", function() { return equal; }); var _a = Object.prototype, toString = _a.toString, hasOwnProperty = _a.hasOwnProperty; var previousComparisons = new Map(); /** * Performs a deep equality check on two JavaScript values, tolerating cycles. */ function equal(a, b) { try { return check(a, b); } finally { previousComparisons.clear(); } } function check(a, b) { // If the two values are strictly equal, our job is easy. if (a === b) { return true; } // Object.prototype.toString returns a representation of the runtime type of // the given value that is considerably more precise than typeof. var aTag = toString.call(a); var bTag = toString.call(b); // If the runtime types of a and b are different, they could maybe be equal // under some interpretation of equality, but for simplicity and performance // we just return false instead. if (aTag !== bTag) { return false; } switch (aTag) { case '[object Array]': // Arrays are a lot like other objects, but we can cheaply compare their // lengths as a short-cut before comparing their elements. if (a.length !== b.length) return false; // Fall through to object case... case '[object Object]': { if (previouslyCompared(a, b)) return true; var aKeys = Object.keys(a); var bKeys = Object.keys(b); // If `a` and `b` have a different number of enumerable keys, they // must be different. var keyCount = aKeys.length; if (keyCount !== bKeys.length) return false; // Now make sure they have the same keys. for (var k = 0; k < keyCount; ++k) { if (!hasOwnProperty.call(b, aKeys[k])) { return false; } } // Finally, check deep equality of all child properties. for (var k = 0; k < keyCount; ++k) { var key = aKeys[k]; if (!check(a[key], b[key])) { return false; } } return true; } case '[object Error]': return a.name === b.name && a.message === b.message; case '[object Number]': // Handle NaN, which is !== itself. if (a !== a) return b !== b; // Fall through to shared +a === +b case... case '[object Boolean]': case '[object Date]': return +a === +b; case '[object RegExp]': case '[object String]': return a == "" + b; case '[object Map]': case '[object Set]': { if (a.size !== b.size) return false; if (previouslyCompared(a, b)) return true; var aIterator = a.entries(); var isMap = aTag === '[object Map]'; while (true) { var info = aIterator.next(); if (info.done) break; // If a instanceof Set, aValue === aKey. var _a = info.value, aKey = _a[0], aValue = _a[1]; // So this works the same way for both Set and Map. if (!b.has(aKey)) { return false; } // However, we care about deep equality of values only when dealing // with Map structures. if (isMap && !check(aValue, b.get(aKey))) { return false; } } return true; } } // Otherwise the values are not equal. return false; } function previouslyCompared(a, b) { // Though cyclic references can make an object graph appear infinite from the // perspective of a depth-first traversal, the graph still contains a finite // number of distinct object references. We use the previousComparisons cache // to avoid comparing the same pair of object references more than once, which // guarantees termination (even if we end up comparing every object in one // graph to every object in the other graph, which is extremely unlikely), // while still allowing weird isomorphic structures (like rings with different // lengths) a chance to pass the equality test. var bSet = previousComparisons.get(a); if (bSet) { // Return true here because we can be sure false will be returned somewhere // else if the objects are not equivalent. if (bSet.has(b)) return true; } else { previousComparisons.set(a, bSet = new Set); } bSet.add(b); return false; } /* harmony default export */ __webpack_exports__["default"] = (equal); //# sourceMappingURL=equality.esm.js.map /***/ }), /***/ "./node_modules/apollo-cache-inmemory/lib/bundle.esm.js": /*!**************************************************************!*\ !*** ./node_modules/apollo-cache-inmemory/lib/bundle.esm.js ***! \**************************************************************/ /*! exports provided: HeuristicFragmentMatcher, InMemoryCache, IntrospectionFragmentMatcher, ObjectCache, StoreReader, StoreWriter, WriteError, assertIdValue, defaultDataIdFromObject, defaultNormalizedCacheFactory, enhanceErrorWithDocument */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HeuristicFragmentMatcher", function() { return HeuristicFragmentMatcher; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InMemoryCache", function() { return InMemoryCache; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IntrospectionFragmentMatcher", function() { return IntrospectionFragmentMatcher; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObjectCache", function() { return ObjectCache; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreReader", function() { return StoreReader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreWriter", function() { return StoreWriter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WriteError", function() { return WriteError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assertIdValue", function() { return assertIdValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultDataIdFromObject", function() { return defaultDataIdFromObject; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultNormalizedCacheFactory", function() { return defaultNormalizedCacheFactory$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enhanceErrorWithDocument", function() { return enhanceErrorWithDocument; }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var apollo_cache__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! apollo-cache */ "./node_modules/apollo-cache/lib/bundle.esm.js"); /* harmony import */ var apollo_utilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! apollo-utilities */ "./node_modules/apollo-utilities/lib/bundle.esm.js"); /* harmony import */ var optimism__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! optimism */ "./node_modules/optimism/lib/bundle.esm.js"); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); var testMap = new Map(); if (testMap.set(1, 2) !== testMap) { var set_1 = testMap.set; Map.prototype.set = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } set_1.apply(this, args); return this; }; } var testSet = new Set(); if (testSet.add(3) !== testSet) { var add_1 = testSet.add; Set.prototype.add = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } add_1.apply(this, args); return this; }; } var frozen = {}; if (typeof Object.freeze === 'function') { Object.freeze(frozen); } try { testMap.set(frozen, frozen).delete(frozen); } catch (_a) { var wrap = function (method) { return method && (function (obj) { try { testMap.set(obj, obj).delete(obj); } finally { return method.call(Object, obj); } }); }; Object.freeze = wrap(Object.freeze); Object.seal = wrap(Object.seal); Object.preventExtensions = wrap(Object.preventExtensions); } var haveWarned = false; function shouldWarn() { var answer = !haveWarned; if (!Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["isTest"])()) { haveWarned = true; } return answer; } var HeuristicFragmentMatcher = (function () { function HeuristicFragmentMatcher() { } HeuristicFragmentMatcher.prototype.ensureReady = function () { return Promise.resolve(); }; HeuristicFragmentMatcher.prototype.canBypassInit = function () { return true; }; HeuristicFragmentMatcher.prototype.match = function (idValue, typeCondition, context) { var obj = context.store.get(idValue.id); var isRootQuery = idValue.id === 'ROOT_QUERY'; if (!obj) { return isRootQuery; } var _a = obj.__typename, __typename = _a === void 0 ? isRootQuery && 'Query' : _a; if (!__typename) { if (shouldWarn()) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"].warn("You're using fragments in your queries, but either don't have the addTypename:\n true option set in Apollo Client, or you are trying to write a fragment to the store without the __typename.\n Please turn on the addTypename option and include __typename when writing fragments so that Apollo Client\n can accurately match fragments."); false || ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"].warn('Could not find __typename on Fragment ', typeCondition, obj); false || ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"].warn("DEPRECATION WARNING: using fragments without __typename is unsupported behavior " + "and will be removed in future versions of Apollo client. You should fix this and set addTypename to true now."); } return 'heuristic'; } if (__typename === typeCondition) { return true; } if (shouldWarn()) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"].error('You are using the simple (heuristic) fragment matcher, but your ' + 'queries contain union or interface types. Apollo Client will not be ' + 'able to accurately map fragments. To make this error go away, use ' + 'the `IntrospectionFragmentMatcher` as described in the docs: ' + 'https://www.apollographql.com/docs/react/advanced/fragments.html#fragment-matcher'); } return 'heuristic'; }; return HeuristicFragmentMatcher; }()); var IntrospectionFragmentMatcher = (function () { function IntrospectionFragmentMatcher(options) { if (options && options.introspectionQueryResultData) { this.possibleTypesMap = this.parseIntrospectionResult(options.introspectionQueryResultData); this.isReady = true; } else { this.isReady = false; } this.match = this.match.bind(this); } IntrospectionFragmentMatcher.prototype.match = function (idValue, typeCondition, context) { false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(this.isReady, 'FragmentMatcher.match() was called before FragmentMatcher.init()'); var obj = context.store.get(idValue.id); var isRootQuery = idValue.id === 'ROOT_QUERY'; if (!obj) { return isRootQuery; } var _a = obj.__typename, __typename = _a === void 0 ? isRootQuery && 'Query' : _a; false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(__typename, "Cannot match fragment because __typename property is missing: " + JSON.stringify(obj)); if (__typename === typeCondition) { return true; } var implementingTypes = this.possibleTypesMap[typeCondition]; if (implementingTypes && implementingTypes.indexOf(__typename) > -1) { return true; } return false; }; IntrospectionFragmentMatcher.prototype.parseIntrospectionResult = function (introspectionResultData) { var typeMap = {}; introspectionResultData.__schema.types.forEach(function (type) { if (type.kind === 'UNION' || type.kind === 'INTERFACE') { typeMap[type.name] = type.possibleTypes.map(function (implementingType) { return implementingType.name; }); } }); return typeMap; }; return IntrospectionFragmentMatcher; }()); var hasOwn = Object.prototype.hasOwnProperty; var DepTrackingCache = (function () { function DepTrackingCache(data) { var _this = this; if (data === void 0) { data = Object.create(null); } this.data = data; this.depend = Object(optimism__WEBPACK_IMPORTED_MODULE_3__["wrap"])(function (dataId) { return _this.data[dataId]; }, { disposable: true, makeCacheKey: function (dataId) { return dataId; } }); } DepTrackingCache.prototype.toObject = function () { return this.data; }; DepTrackingCache.prototype.get = function (dataId) { this.depend(dataId); return this.data[dataId]; }; DepTrackingCache.prototype.set = function (dataId, value) { var oldValue = this.data[dataId]; if (value !== oldValue) { this.data[dataId] = value; this.depend.dirty(dataId); } }; DepTrackingCache.prototype.delete = function (dataId) { if (hasOwn.call(this.data, dataId)) { delete this.data[dataId]; this.depend.dirty(dataId); } }; DepTrackingCache.prototype.clear = function () { this.replace(null); }; DepTrackingCache.prototype.replace = function (newData) { var _this = this; if (newData) { Object.keys(newData).forEach(function (dataId) { _this.set(dataId, newData[dataId]); }); Object.keys(this.data).forEach(function (dataId) { if (!hasOwn.call(newData, dataId)) { _this.delete(dataId); } }); } else { Object.keys(this.data).forEach(function (dataId) { _this.delete(dataId); }); } }; return DepTrackingCache; }()); function defaultNormalizedCacheFactory(seed) { return new DepTrackingCache(seed); } var StoreReader = (function () { function StoreReader(_a) { var _this = this; var _b = _a === void 0 ? {} : _a, _c = _b.cacheKeyRoot, cacheKeyRoot = _c === void 0 ? new optimism__WEBPACK_IMPORTED_MODULE_3__["KeyTrie"](apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["canUseWeakMap"]) : _c, _d = _b.freezeResults, freezeResults = _d === void 0 ? false : _d; var _e = this, executeStoreQuery = _e.executeStoreQuery, executeSelectionSet = _e.executeSelectionSet, executeSubSelectedArray = _e.executeSubSelectedArray; this.freezeResults = freezeResults; this.executeStoreQuery = Object(optimism__WEBPACK_IMPORTED_MODULE_3__["wrap"])(function (options) { return executeStoreQuery.call(_this, options); }, { makeCacheKey: function (_a) { var query = _a.query, rootValue = _a.rootValue, contextValue = _a.contextValue, variableValues = _a.variableValues, fragmentMatcher = _a.fragmentMatcher; if (contextValue.store instanceof DepTrackingCache) { return cacheKeyRoot.lookup(contextValue.store, query, fragmentMatcher, JSON.stringify(variableValues), rootValue.id); } } }); this.executeSelectionSet = Object(optimism__WEBPACK_IMPORTED_MODULE_3__["wrap"])(function (options) { return executeSelectionSet.call(_this, options); }, { makeCacheKey: function (_a) { var selectionSet = _a.selectionSet, rootValue = _a.rootValue, execContext = _a.execContext; if (execContext.contextValue.store instanceof DepTrackingCache) { return cacheKeyRoot.lookup(execContext.contextValue.store, selectionSet, execContext.fragmentMatcher, JSON.stringify(execContext.variableValues), rootValue.id); } } }); this.executeSubSelectedArray = Object(optimism__WEBPACK_IMPORTED_MODULE_3__["wrap"])(function (options) { return executeSubSelectedArray.call(_this, options); }, { makeCacheKey: function (_a) { var field = _a.field, array = _a.array, execContext = _a.execContext; if (execContext.contextValue.store instanceof DepTrackingCache) { return cacheKeyRoot.lookup(execContext.contextValue.store, field, array, JSON.stringify(execContext.variableValues)); } } }); } StoreReader.prototype.readQueryFromStore = function (options) { var optsPatch = { returnPartialData: false }; return this.diffQueryAgainstStore(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, options, optsPatch)).result; }; StoreReader.prototype.diffQueryAgainstStore = function (_a) { var store = _a.store, query = _a.query, variables = _a.variables, previousResult = _a.previousResult, _b = _a.returnPartialData, returnPartialData = _b === void 0 ? true : _b, _c = _a.rootId, rootId = _c === void 0 ? 'ROOT_QUERY' : _c, fragmentMatcherFunction = _a.fragmentMatcherFunction, config = _a.config; var queryDefinition = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["getQueryDefinition"])(query); variables = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["assign"])({}, Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["getDefaultValues"])(queryDefinition), variables); var context = { store: store, dataIdFromObject: (config && config.dataIdFromObject) || null, cacheRedirects: (config && config.cacheRedirects) || {}, }; var execResult = this.executeStoreQuery({ query: query, rootValue: { type: 'id', id: rootId, generated: true, typename: 'Query', }, contextValue: context, variableValues: variables, fragmentMatcher: fragmentMatcherFunction, }); var hasMissingFields = execResult.missing && execResult.missing.length > 0; if (hasMissingFields && !returnPartialData) { execResult.missing.forEach(function (info) { if (info.tolerable) return; throw false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_4__["InvariantError"]("Can't find field " + info.fieldName + " on object " + JSON.stringify(info.object, null, 2) + "."); }); } if (previousResult) { if (Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["isEqual"])(previousResult, execResult.result)) { execResult.result = previousResult; } } return { result: execResult.result, complete: !hasMissingFields, }; }; StoreReader.prototype.executeStoreQuery = function (_a) { var query = _a.query, rootValue = _a.rootValue, contextValue = _a.contextValue, variableValues = _a.variableValues, _b = _a.fragmentMatcher, fragmentMatcher = _b === void 0 ? defaultFragmentMatcher : _b; var mainDefinition = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["getMainDefinition"])(query); var fragments = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["getFragmentDefinitions"])(query); var fragmentMap = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["createFragmentMap"])(fragments); var execContext = { query: query, fragmentMap: fragmentMap, contextValue: contextValue, variableValues: variableValues, fragmentMatcher: fragmentMatcher, }; return this.executeSelectionSet({ selectionSet: mainDefinition.selectionSet, rootValue: rootValue, execContext: execContext, }); }; StoreReader.prototype.executeSelectionSet = function (_a) { var _this = this; var selectionSet = _a.selectionSet, rootValue = _a.rootValue, execContext = _a.execContext; var fragmentMap = execContext.fragmentMap, contextValue = execContext.contextValue, variables = execContext.variableValues; var finalResult = { result: null }; var objectsToMerge = []; var object = contextValue.store.get(rootValue.id); var typename = (object && object.__typename) || (rootValue.id === 'ROOT_QUERY' && 'Query') || void 0; function handleMissing(result) { var _a; if (result.missing) { finalResult.missing = finalResult.missing || []; (_a = finalResult.missing).push.apply(_a, result.missing); } return result.result; } selectionSet.selections.forEach(function (selection) { var _a; if (!Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["shouldInclude"])(selection, variables)) { return; } if (Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["isField"])(selection)) { var fieldResult = handleMissing(_this.executeField(object, typename, selection, execContext)); if (typeof fieldResult !== 'undefined') { objectsToMerge.push((_a = {}, _a[Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["resultKeyNameFromField"])(selection)] = fieldResult, _a)); } } else { var fragment = void 0; if (Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["isInlineFragment"])(selection)) { fragment = selection; } else { fragment = fragmentMap[selection.name.value]; if (!fragment) { throw false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_4__["InvariantError"]("No fragment named " + selection.name.value); } } var typeCondition = fragment.typeCondition.name.value; var match = execContext.fragmentMatcher(rootValue, typeCondition, contextValue); if (match) { var fragmentExecResult = _this.executeSelectionSet({ selectionSet: fragment.selectionSet, rootValue: rootValue, execContext: execContext, }); if (match === 'heuristic' && fragmentExecResult.missing) { fragmentExecResult = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, fragmentExecResult, { missing: fragmentExecResult.missing.map(function (info) { return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, info, { tolerable: true }); }) }); } objectsToMerge.push(handleMissing(fragmentExecResult)); } } }); finalResult.result = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["mergeDeepArray"])(objectsToMerge); if (this.freezeResults && "development" !== 'production') { Object.freeze(finalResult.result); } return finalResult; }; StoreReader.prototype.executeField = function (object, typename, field, execContext) { var variables = execContext.variableValues, contextValue = execContext.contextValue; var fieldName = field.name.value; var args = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["argumentsObjectFromField"])(field, variables); var info = { resultKey: Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["resultKeyNameFromField"])(field), directives: Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["getDirectiveInfoFromField"])(field, variables), }; var readStoreResult = readStoreResolver(object, typename, fieldName, args, contextValue, info); if (Array.isArray(readStoreResult.result)) { return this.combineExecResults(readStoreResult, this.executeSubSelectedArray({ field: field, array: readStoreResult.result, execContext: execContext, })); } if (!field.selectionSet) { assertSelectionSetForIdValue(field, readStoreResult.result); if (this.freezeResults && "development" !== 'production') { Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["maybeDeepFreeze"])(readStoreResult); } return readStoreResult; } if (readStoreResult.result == null) { return readStoreResult; } return this.combineExecResults(readStoreResult, this.executeSelectionSet({ selectionSet: field.selectionSet, rootValue: readStoreResult.result, execContext: execContext, })); }; StoreReader.prototype.combineExecResults = function () { var execResults = []; for (var _i = 0; _i < arguments.length; _i++) { execResults[_i] = arguments[_i]; } var missing = null; execResults.forEach(function (execResult) { if (execResult.missing) { missing = missing || []; missing.push.apply(missing, execResult.missing); } }); return { result: execResults.pop().result, missing: missing, }; }; StoreReader.prototype.executeSubSelectedArray = function (_a) { var _this = this; var field = _a.field, array = _a.array, execContext = _a.execContext; var missing = null; function handleMissing(childResult) { if (childResult.missing) { missing = missing || []; missing.push.apply(missing, childResult.missing); } return childResult.result; } array = array.map(function (item) { if (item === null) { return null; } if (Array.isArray(item)) { return handleMissing(_this.executeSubSelectedArray({ field: field, array: item, execContext: execContext, })); } if (field.selectionSet) { return handleMissing(_this.executeSelectionSet({ selectionSet: field.selectionSet, rootValue: item, execContext: execContext, })); } assertSelectionSetForIdValue(field, item); return item; }); if (this.freezeResults && "development" !== 'production') { Object.freeze(array); } return { result: array, missing: missing }; }; return StoreReader; }()); function assertSelectionSetForIdValue(field, value) { if (!field.selectionSet && Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["isIdValue"])(value)) { throw false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_4__["InvariantError"]("Missing selection set for object of type " + value.typename + " returned for query field " + field.name.value); } } function defaultFragmentMatcher() { return true; } function assertIdValue(idValue) { false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["isIdValue"])(idValue), "Encountered a sub-selection on the query, but the store doesn't have an object reference. This should never happen during normal use unless you have custom code that is directly manipulating the store; please file an issue."); } function readStoreResolver(object, typename, fieldName, args, context, _a) { var resultKey = _a.resultKey, directives = _a.directives; var storeKeyName = fieldName; if (args || directives) { storeKeyName = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["getStoreKeyName"])(storeKeyName, args, directives); } var fieldValue = void 0; if (object) { fieldValue = object[storeKeyName]; if (typeof fieldValue === 'undefined' && context.cacheRedirects && typeof typename === 'string') { var type = context.cacheRedirects[typename]; if (type) { var resolver = type[fieldName]; if (resolver) { fieldValue = resolver(object, args, { getCacheKey: function (storeObj) { return Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["toIdValue"])({ id: context.dataIdFromObject(storeObj), typename: storeObj.__typename, }); }, }); } } } } if (typeof fieldValue === 'undefined') { return { result: fieldValue, missing: [{ object: object, fieldName: storeKeyName, tolerable: false, }], }; } if (Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["isJsonValue"])(fieldValue)) { fieldValue = fieldValue.json; } return { result: fieldValue, }; } var ObjectCache = (function () { function ObjectCache(data) { if (data === void 0) { data = Object.create(null); } this.data = data; } ObjectCache.prototype.toObject = function () { return this.data; }; ObjectCache.prototype.get = function (dataId) { return this.data[dataId]; }; ObjectCache.prototype.set = function (dataId, value) { this.data[dataId] = value; }; ObjectCache.prototype.delete = function (dataId) { this.data[dataId] = void 0; }; ObjectCache.prototype.clear = function () { this.data = Object.create(null); }; ObjectCache.prototype.replace = function (newData) { this.data = newData || Object.create(null); }; return ObjectCache; }()); function defaultNormalizedCacheFactory$1(seed) { return new ObjectCache(seed); } var WriteError = (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(WriteError, _super); function WriteError() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.type = 'WriteError'; return _this; } return WriteError; }(Error)); function enhanceErrorWithDocument(error, document) { var enhancedError = new WriteError("Error writing result to store for query:\n " + JSON.stringify(document)); enhancedError.message += '\n' + error.message; enhancedError.stack = error.stack; return enhancedError; } var StoreWriter = (function () { function StoreWriter() { } StoreWriter.prototype.writeQueryToStore = function (_a) { var query = _a.query, result = _a.result, _b = _a.store, store = _b === void 0 ? defaultNormalizedCacheFactory() : _b, variables = _a.variables, dataIdFromObject = _a.dataIdFromObject, fragmentMatcherFunction = _a.fragmentMatcherFunction; return this.writeResultToStore({ dataId: 'ROOT_QUERY', result: result, document: query, store: store, variables: variables, dataIdFromObject: dataIdFromObject, fragmentMatcherFunction: fragmentMatcherFunction, }); }; StoreWriter.prototype.writeResultToStore = function (_a) { var dataId = _a.dataId, result = _a.result, document = _a.document, _b = _a.store, store = _b === void 0 ? defaultNormalizedCacheFactory() : _b, variables = _a.variables, dataIdFromObject = _a.dataIdFromObject, fragmentMatcherFunction = _a.fragmentMatcherFunction; var operationDefinition = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["getOperationDefinition"])(document); try { return this.writeSelectionSetToStore({ result: result, dataId: dataId, selectionSet: operationDefinition.selectionSet, context: { store: store, processedData: {}, variables: Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["assign"])({}, Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["getDefaultValues"])(operationDefinition), variables), dataIdFromObject: dataIdFromObject, fragmentMap: Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["createFragmentMap"])(Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["getFragmentDefinitions"])(document)), fragmentMatcherFunction: fragmentMatcherFunction, }, }); } catch (e) { throw enhanceErrorWithDocument(e, document); } }; StoreWriter.prototype.writeSelectionSetToStore = function (_a) { var _this = this; var result = _a.result, dataId = _a.dataId, selectionSet = _a.selectionSet, context = _a.context; var variables = context.variables, store = context.store, fragmentMap = context.fragmentMap; selectionSet.selections.forEach(function (selection) { var _a; if (!Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["shouldInclude"])(selection, variables)) { return; } if (Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["isField"])(selection)) { var resultFieldKey = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["resultKeyNameFromField"])(selection); var value = result[resultFieldKey]; if (typeof value !== 'undefined') { _this.writeFieldToStore({ dataId: dataId, value: value, field: selection, context: context, }); } else { var isDefered = false; var isClient = false; if (selection.directives && selection.directives.length) { isDefered = selection.directives.some(function (directive) { return directive.name && directive.name.value === 'defer'; }); isClient = selection.directives.some(function (directive) { return directive.name && directive.name.value === 'client'; }); } if (!isDefered && !isClient && context.fragmentMatcherFunction) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"].warn("Missing field " + resultFieldKey + " in " + JSON.stringify(result, null, 2).substring(0, 100)); } } } else { var fragment = void 0; if (Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["isInlineFragment"])(selection)) { fragment = selection; } else { fragment = (fragmentMap || {})[selection.name.value]; false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(fragment, "No fragment named " + selection.name.value + "."); } var matches = true; if (context.fragmentMatcherFunction && fragment.typeCondition) { var id = dataId || 'self'; var idValue = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["toIdValue"])({ id: id, typename: undefined }); var fakeContext = { store: new ObjectCache((_a = {}, _a[id] = result, _a)), cacheRedirects: {}, }; var match = context.fragmentMatcherFunction(idValue, fragment.typeCondition.name.value, fakeContext); if (!Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["isProduction"])() && match === 'heuristic') { false || ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"].error('WARNING: heuristic fragment matching going on!'); } matches = !!match; } if (matches) { _this.writeSelectionSetToStore({ result: result, selectionSet: fragment.selectionSet, dataId: dataId, context: context, }); } } }); return store; }; StoreWriter.prototype.writeFieldToStore = function (_a) { var _b; var field = _a.field, value = _a.value, dataId = _a.dataId, context = _a.context; var variables = context.variables, dataIdFromObject = context.dataIdFromObject, store = context.store; var storeValue; var storeObject; var storeFieldName = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["storeKeyNameFromField"])(field, variables); if (!field.selectionSet || value === null) { storeValue = value != null && typeof value === 'object' ? { type: 'json', json: value } : value; } else if (Array.isArray(value)) { var generatedId = dataId + "." + storeFieldName; storeValue = this.processArrayValue(value, generatedId, field.selectionSet, context); } else { var valueDataId = dataId + "." + storeFieldName; var generated = true; if (!isGeneratedId(valueDataId)) { valueDataId = '$' + valueDataId; } if (dataIdFromObject) { var semanticId = dataIdFromObject(value); false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(!semanticId || !isGeneratedId(semanticId), 'IDs returned by dataIdFromObject cannot begin with the "$" character.'); if (semanticId || (typeof semanticId === 'number' && semanticId === 0)) { valueDataId = semanticId; generated = false; } } if (!isDataProcessed(valueDataId, field, context.processedData)) { this.writeSelectionSetToStore({ dataId: valueDataId, result: value, selectionSet: field.selectionSet, context: context, }); } var typename = value.__typename; storeValue = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["toIdValue"])({ id: valueDataId, typename: typename }, generated); storeObject = store.get(dataId); var escapedId = storeObject && storeObject[storeFieldName]; if (escapedId !== storeValue && Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["isIdValue"])(escapedId)) { var hadTypename = escapedId.typename !== undefined; var hasTypename = typename !== undefined; var typenameChanged = hadTypename && hasTypename && escapedId.typename !== typename; false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(!generated || escapedId.generated || typenameChanged, "Store error: the application attempted to write an object with no provided id but the store already contains an id of " + escapedId.id + " for this object. The selectionSet that was trying to be written is:\n" + JSON.stringify(field)); false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(!hadTypename || hasTypename, "Store error: the application attempted to write an object with no provided typename but the store already contains an object with typename of " + escapedId.typename + " for the object of id " + escapedId.id + ". The selectionSet that was trying to be written is:\n" + JSON.stringify(field)); if (escapedId.generated) { if (typenameChanged) { if (!generated) { store.delete(escapedId.id); } } else { mergeWithGenerated(escapedId.id, storeValue.id, store); } } } } storeObject = store.get(dataId); if (!storeObject || !Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["isEqual"])(storeValue, storeObject[storeFieldName])) { store.set(dataId, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, storeObject, (_b = {}, _b[storeFieldName] = storeValue, _b))); } }; StoreWriter.prototype.processArrayValue = function (value, generatedId, selectionSet, context) { var _this = this; return value.map(function (item, index) { if (item === null) { return null; } var itemDataId = generatedId + "." + index; if (Array.isArray(item)) { return _this.processArrayValue(item, itemDataId, selectionSet, context); } var generated = true; if (context.dataIdFromObject) { var semanticId = context.dataIdFromObject(item); if (semanticId) { itemDataId = semanticId; generated = false; } } if (!isDataProcessed(itemDataId, selectionSet, context.processedData)) { _this.writeSelectionSetToStore({ dataId: itemDataId, result: item, selectionSet: selectionSet, context: context, }); } return Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["toIdValue"])({ id: itemDataId, typename: item.__typename }, generated); }); }; return StoreWriter; }()); function isGeneratedId(id) { return id[0] === '$'; } function mergeWithGenerated(generatedKey, realKey, cache) { if (generatedKey === realKey) { return false; } var generated = cache.get(generatedKey); var real = cache.get(realKey); var madeChanges = false; Object.keys(generated).forEach(function (key) { var value = generated[key]; var realValue = real[key]; if (Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["isIdValue"])(value) && isGeneratedId(value.id) && Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["isIdValue"])(realValue) && !Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["isEqual"])(value, realValue) && mergeWithGenerated(value.id, realValue.id, cache)) { madeChanges = true; } }); cache.delete(generatedKey); var newRealValue = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, generated, real); if (Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["isEqual"])(newRealValue, real)) { return madeChanges; } cache.set(realKey, newRealValue); return true; } function isDataProcessed(dataId, field, processedData) { if (!processedData) { return false; } if (processedData[dataId]) { if (processedData[dataId].indexOf(field) >= 0) { return true; } else { processedData[dataId].push(field); } } else { processedData[dataId] = [field]; } return false; } var defaultConfig = { fragmentMatcher: new HeuristicFragmentMatcher(), dataIdFromObject: defaultDataIdFromObject, addTypename: true, resultCaching: true, freezeResults: false, }; function defaultDataIdFromObject(result) { if (result.__typename) { if (result.id !== undefined) { return result.__typename + ":" + result.id; } if (result._id !== undefined) { return result.__typename + ":" + result._id; } } return null; } var hasOwn$1 = Object.prototype.hasOwnProperty; var OptimisticCacheLayer = (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(OptimisticCacheLayer, _super); function OptimisticCacheLayer(optimisticId, parent, transaction) { var _this = _super.call(this, Object.create(null)) || this; _this.optimisticId = optimisticId; _this.parent = parent; _this.transaction = transaction; return _this; } OptimisticCacheLayer.prototype.toObject = function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this.parent.toObject(), this.data); }; OptimisticCacheLayer.prototype.get = function (dataId) { return hasOwn$1.call(this.data, dataId) ? this.data[dataId] : this.parent.get(dataId); }; return OptimisticCacheLayer; }(ObjectCache)); var InMemoryCache = (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(InMemoryCache, _super); function InMemoryCache(config) { if (config === void 0) { config = {}; } var _this = _super.call(this) || this; _this.watches = new Set(); _this.typenameDocumentCache = new Map(); _this.cacheKeyRoot = new optimism__WEBPACK_IMPORTED_MODULE_3__["KeyTrie"](apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["canUseWeakMap"]); _this.silenceBroadcast = false; _this.config = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, defaultConfig, config); if (_this.config.customResolvers) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"].warn('customResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating customResolvers in the next major version.'); _this.config.cacheRedirects = _this.config.customResolvers; } if (_this.config.cacheResolvers) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"].warn('cacheResolvers have been renamed to cacheRedirects. Please update your config as we will be deprecating cacheResolvers in the next major version.'); _this.config.cacheRedirects = _this.config.cacheResolvers; } _this.addTypename = _this.config.addTypename; _this.data = _this.config.resultCaching ? new DepTrackingCache() : new ObjectCache(); _this.optimisticData = _this.data; _this.storeWriter = new StoreWriter(); _this.storeReader = new StoreReader({ cacheKeyRoot: _this.cacheKeyRoot, freezeResults: config.freezeResults, }); var cache = _this; var maybeBroadcastWatch = cache.maybeBroadcastWatch; _this.maybeBroadcastWatch = Object(optimism__WEBPACK_IMPORTED_MODULE_3__["wrap"])(function (c) { return maybeBroadcastWatch.call(_this, c); }, { makeCacheKey: function (c) { if (c.optimistic) { return; } if (c.previousResult) { return; } if (cache.data instanceof DepTrackingCache) { return cache.cacheKeyRoot.lookup(c.query, JSON.stringify(c.variables)); } } }); return _this; } InMemoryCache.prototype.restore = function (data) { if (data) this.data.replace(data); return this; }; InMemoryCache.prototype.extract = function (optimistic) { if (optimistic === void 0) { optimistic = false; } return (optimistic ? this.optimisticData : this.data).toObject(); }; InMemoryCache.prototype.read = function (options) { if (typeof options.rootId === 'string' && typeof this.data.get(options.rootId) === 'undefined') { return null; } return this.storeReader.readQueryFromStore({ store: options.optimistic ? this.optimisticData : this.data, query: this.transformDocument(options.query), variables: options.variables, rootId: options.rootId, fragmentMatcherFunction: this.config.fragmentMatcher.match, previousResult: options.previousResult, config: this.config, }); }; InMemoryCache.prototype.write = function (write) { this.storeWriter.writeResultToStore({ dataId: write.dataId, result: write.result, variables: write.variables, document: this.transformDocument(write.query), store: this.data, dataIdFromObject: this.config.dataIdFromObject, fragmentMatcherFunction: this.config.fragmentMatcher.match, }); this.broadcastWatches(); }; InMemoryCache.prototype.diff = function (query) { return this.storeReader.diffQueryAgainstStore({ store: query.optimistic ? this.optimisticData : this.data, query: this.transformDocument(query.query), variables: query.variables, returnPartialData: query.returnPartialData, previousResult: query.previousResult, fragmentMatcherFunction: this.config.fragmentMatcher.match, config: this.config, }); }; InMemoryCache.prototype.watch = function (watch) { var _this = this; this.watches.add(watch); return function () { _this.watches.delete(watch); }; }; InMemoryCache.prototype.evict = function (query) { throw false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_4__["InvariantError"]("eviction is not implemented on InMemory Cache"); }; InMemoryCache.prototype.reset = function () { this.data.clear(); this.broadcastWatches(); return Promise.resolve(); }; InMemoryCache.prototype.removeOptimistic = function (idToRemove) { var toReapply = []; var removedCount = 0; var layer = this.optimisticData; while (layer instanceof OptimisticCacheLayer) { if (layer.optimisticId === idToRemove) { ++removedCount; } else { toReapply.push(layer); } layer = layer.parent; } if (removedCount > 0) { this.optimisticData = layer; while (toReapply.length > 0) { var layer_1 = toReapply.pop(); this.performTransaction(layer_1.transaction, layer_1.optimisticId); } this.broadcastWatches(); } }; InMemoryCache.prototype.performTransaction = function (transaction, optimisticId) { var _a = this, data = _a.data, silenceBroadcast = _a.silenceBroadcast; this.silenceBroadcast = true; if (typeof optimisticId === 'string') { this.data = this.optimisticData = new OptimisticCacheLayer(optimisticId, this.optimisticData, transaction); } try { transaction(this); } finally { this.silenceBroadcast = silenceBroadcast; this.data = data; } this.broadcastWatches(); }; InMemoryCache.prototype.recordOptimisticTransaction = function (transaction, id) { return this.performTransaction(transaction, id); }; InMemoryCache.prototype.transformDocument = function (document) { if (this.addTypename) { var result = this.typenameDocumentCache.get(document); if (!result) { result = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_2__["addTypenameToDocument"])(document); this.typenameDocumentCache.set(document, result); this.typenameDocumentCache.set(result, result); } return result; } return document; }; InMemoryCache.prototype.broadcastWatches = function () { var _this = this; if (!this.silenceBroadcast) { this.watches.forEach(function (c) { return _this.maybeBroadcastWatch(c); }); } }; InMemoryCache.prototype.maybeBroadcastWatch = function (c) { c.callback(this.diff({ query: c.query, variables: c.variables, previousResult: c.previousResult && c.previousResult(), optimistic: c.optimistic, })); }; return InMemoryCache; }(apollo_cache__WEBPACK_IMPORTED_MODULE_1__["ApolloCache"])); //# sourceMappingURL=bundle.esm.js.map /***/ }), /***/ "./node_modules/apollo-cache/lib/bundle.esm.js": /*!*****************************************************!*\ !*** ./node_modules/apollo-cache/lib/bundle.esm.js ***! \*****************************************************/ /*! exports provided: ApolloCache, Cache */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApolloCache", function() { return ApolloCache; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Cache", function() { return Cache; }); /* harmony import */ var apollo_utilities__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! apollo-utilities */ "./node_modules/apollo-utilities/lib/bundle.esm.js"); function queryFromPojo(obj) { var op = { kind: 'OperationDefinition', operation: 'query', name: { kind: 'Name', value: 'GeneratedClientQuery', }, selectionSet: selectionSetFromObj(obj), }; var out = { kind: 'Document', definitions: [op], }; return out; } function fragmentFromPojo(obj, typename) { var frag = { kind: 'FragmentDefinition', typeCondition: { kind: 'NamedType', name: { kind: 'Name', value: typename || '__FakeType', }, }, name: { kind: 'Name', value: 'GeneratedClientQuery', }, selectionSet: selectionSetFromObj(obj), }; var out = { kind: 'Document', definitions: [frag], }; return out; } function selectionSetFromObj(obj) { if (typeof obj === 'number' || typeof obj === 'boolean' || typeof obj === 'string' || typeof obj === 'undefined' || obj === null) { return null; } if (Array.isArray(obj)) { return selectionSetFromObj(obj[0]); } var selections = []; Object.keys(obj).forEach(function (key) { var nestedSelSet = selectionSetFromObj(obj[key]); var field = { kind: 'Field', name: { kind: 'Name', value: key, }, selectionSet: nestedSelSet || undefined, }; selections.push(field); }); var selectionSet = { kind: 'SelectionSet', selections: selections, }; return selectionSet; } var justTypenameQuery = { kind: 'Document', definitions: [ { kind: 'OperationDefinition', operation: 'query', name: null, variableDefinitions: null, directives: [], selectionSet: { kind: 'SelectionSet', selections: [ { kind: 'Field', alias: null, name: { kind: 'Name', value: '__typename', }, arguments: [], directives: [], selectionSet: null, }, ], }, }, ], }; var ApolloCache = (function () { function ApolloCache() { } ApolloCache.prototype.transformDocument = function (document) { return document; }; ApolloCache.prototype.transformForLink = function (document) { return document; }; ApolloCache.prototype.readQuery = function (options, optimistic) { if (optimistic === void 0) { optimistic = false; } return this.read({ query: options.query, variables: options.variables, optimistic: optimistic, }); }; ApolloCache.prototype.readFragment = function (options, optimistic) { if (optimistic === void 0) { optimistic = false; } return this.read({ query: Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_0__["getFragmentQueryDocument"])(options.fragment, options.fragmentName), variables: options.variables, rootId: options.id, optimistic: optimistic, }); }; ApolloCache.prototype.writeQuery = function (options) { this.write({ dataId: 'ROOT_QUERY', result: options.data, query: options.query, variables: options.variables, }); }; ApolloCache.prototype.writeFragment = function (options) { this.write({ dataId: options.id, result: options.data, variables: options.variables, query: Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_0__["getFragmentQueryDocument"])(options.fragment, options.fragmentName), }); }; ApolloCache.prototype.writeData = function (_a) { var id = _a.id, data = _a.data; if (typeof id !== 'undefined') { var typenameResult = null; try { typenameResult = this.read({ rootId: id, optimistic: false, query: justTypenameQuery, }); } catch (e) { } var __typename = (typenameResult && typenameResult.__typename) || '__ClientData'; var dataToWrite = Object.assign({ __typename: __typename }, data); this.writeFragment({ id: id, fragment: fragmentFromPojo(dataToWrite, __typename), data: dataToWrite, }); } else { this.writeQuery({ query: queryFromPojo(data), data: data }); } }; return ApolloCache; }()); var Cache; (function (Cache) { })(Cache || (Cache = {})); //# sourceMappingURL=bundle.esm.js.map /***/ }), /***/ "./node_modules/apollo-client/bundle.esm.js": /*!**************************************************!*\ !*** ./node_modules/apollo-client/bundle.esm.js ***! \**************************************************/ /*! exports provided: default, ApolloClient, ApolloError, FetchType, NetworkStatus, ObservableQuery, isApolloError */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApolloClient", function() { return ApolloClient; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApolloError", function() { return ApolloError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FetchType", function() { return FetchType; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NetworkStatus", function() { return NetworkStatus; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObservableQuery", function() { return ObservableQuery; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isApolloError", function() { return isApolloError; }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var apollo_utilities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! apollo-utilities */ "./node_modules/apollo-utilities/lib/bundle.esm.js"); /* harmony import */ var apollo_link__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! apollo-link */ "./node_modules/apollo-link/lib/bundle.esm.js"); /* harmony import */ var symbol_observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! symbol-observable */ "./node_modules/symbol-observable/es/index.js"); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); /* harmony import */ var graphql_language_visitor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! graphql/language/visitor */ "./node_modules/graphql/language/visitor.js"); /* harmony import */ var graphql_language_visitor__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(graphql_language_visitor__WEBPACK_IMPORTED_MODULE_5__); var NetworkStatus; (function (NetworkStatus) { NetworkStatus[NetworkStatus["loading"] = 1] = "loading"; NetworkStatus[NetworkStatus["setVariables"] = 2] = "setVariables"; NetworkStatus[NetworkStatus["fetchMore"] = 3] = "fetchMore"; NetworkStatus[NetworkStatus["refetch"] = 4] = "refetch"; NetworkStatus[NetworkStatus["poll"] = 6] = "poll"; NetworkStatus[NetworkStatus["ready"] = 7] = "ready"; NetworkStatus[NetworkStatus["error"] = 8] = "error"; })(NetworkStatus || (NetworkStatus = {})); function isNetworkRequestInFlight(networkStatus) { return networkStatus < 7; } var Observable = (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(Observable, _super); function Observable() { return _super !== null && _super.apply(this, arguments) || this; } Observable.prototype[symbol_observable__WEBPACK_IMPORTED_MODULE_3__["default"]] = function () { return this; }; Observable.prototype['@@observable'] = function () { return this; }; return Observable; }(apollo_link__WEBPACK_IMPORTED_MODULE_2__["Observable"])); function isNonEmptyArray(value) { return Array.isArray(value) && value.length > 0; } function isApolloError(err) { return err.hasOwnProperty('graphQLErrors'); } var generateErrorMessage = function (err) { var message = ''; if (isNonEmptyArray(err.graphQLErrors)) { err.graphQLErrors.forEach(function (graphQLError) { var errorMessage = graphQLError ? graphQLError.message : 'Error message not found.'; message += "GraphQL error: " + errorMessage + "\n"; }); } if (err.networkError) { message += 'Network error: ' + err.networkError.message + '\n'; } message = message.replace(/\n$/, ''); return message; }; var ApolloError = (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ApolloError, _super); function ApolloError(_a) { var graphQLErrors = _a.graphQLErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo; var _this = _super.call(this, errorMessage) || this; _this.graphQLErrors = graphQLErrors || []; _this.networkError = networkError || null; if (!errorMessage) { _this.message = generateErrorMessage(_this); } else { _this.message = errorMessage; } _this.extraInfo = extraInfo; _this.__proto__ = ApolloError.prototype; return _this; } return ApolloError; }(Error)); var FetchType; (function (FetchType) { FetchType[FetchType["normal"] = 1] = "normal"; FetchType[FetchType["refetch"] = 2] = "refetch"; FetchType[FetchType["poll"] = 3] = "poll"; })(FetchType || (FetchType = {})); var hasError = function (storeValue, policy) { if (policy === void 0) { policy = 'none'; } return storeValue && (storeValue.networkError || (policy === 'none' && isNonEmptyArray(storeValue.graphQLErrors))); }; var ObservableQuery = (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ObservableQuery, _super); function ObservableQuery(_a) { var queryManager = _a.queryManager, options = _a.options, _b = _a.shouldSubscribe, shouldSubscribe = _b === void 0 ? true : _b; var _this = _super.call(this, function (observer) { return _this.onSubscribe(observer); }) || this; _this.observers = new Set(); _this.subscriptions = new Set(); _this.isTornDown = false; _this.options = options; _this.variables = options.variables || {}; _this.queryId = queryManager.generateQueryId(); _this.shouldSubscribe = shouldSubscribe; var opDef = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["getOperationDefinition"])(options.query); _this.queryName = opDef && opDef.name && opDef.name.value; _this.queryManager = queryManager; return _this; } ObservableQuery.prototype.result = function () { var _this = this; return new Promise(function (resolve, reject) { var observer = { next: function (result) { resolve(result); _this.observers.delete(observer); if (!_this.observers.size) { _this.queryManager.removeQuery(_this.queryId); } setTimeout(function () { subscription.unsubscribe(); }, 0); }, error: reject, }; var subscription = _this.subscribe(observer); }); }; ObservableQuery.prototype.currentResult = function () { var result = this.getCurrentResult(); if (result.data === undefined) { result.data = {}; } return result; }; ObservableQuery.prototype.getCurrentResult = function () { if (this.isTornDown) { var lastResult = this.lastResult; return { data: !this.lastError && lastResult && lastResult.data || void 0, error: this.lastError, loading: false, networkStatus: NetworkStatus.error, }; } var _a = this.queryManager.getCurrentQueryResult(this), data = _a.data, partial = _a.partial; var queryStoreValue = this.queryManager.queryStore.get(this.queryId); var result; var fetchPolicy = this.options.fetchPolicy; var isNetworkFetchPolicy = fetchPolicy === 'network-only' || fetchPolicy === 'no-cache'; if (queryStoreValue) { var networkStatus = queryStoreValue.networkStatus; if (hasError(queryStoreValue, this.options.errorPolicy)) { return { data: void 0, loading: false, networkStatus: networkStatus, error: new ApolloError({ graphQLErrors: queryStoreValue.graphQLErrors, networkError: queryStoreValue.networkError, }), }; } if (queryStoreValue.variables) { this.options.variables = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this.options.variables, queryStoreValue.variables); this.variables = this.options.variables; } result = { data: data, loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus, }; if (queryStoreValue.graphQLErrors && this.options.errorPolicy === 'all') { result.errors = queryStoreValue.graphQLErrors; } } else { var loading = isNetworkFetchPolicy || (partial && fetchPolicy !== 'cache-only'); result = { data: data, loading: loading, networkStatus: loading ? NetworkStatus.loading : NetworkStatus.ready, }; } if (!partial) { this.updateLastResult(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, result, { stale: false })); } return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, result, { partial: partial }); }; ObservableQuery.prototype.isDifferentFromLastResult = function (newResult) { var snapshot = this.lastResultSnapshot; return !(snapshot && newResult && snapshot.networkStatus === newResult.networkStatus && snapshot.stale === newResult.stale && Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["isEqual"])(snapshot.data, newResult.data)); }; ObservableQuery.prototype.getLastResult = function () { return this.lastResult; }; ObservableQuery.prototype.getLastError = function () { return this.lastError; }; ObservableQuery.prototype.resetLastResults = function () { delete this.lastResult; delete this.lastResultSnapshot; delete this.lastError; this.isTornDown = false; }; ObservableQuery.prototype.resetQueryStoreErrors = function () { var queryStore = this.queryManager.queryStore.get(this.queryId); if (queryStore) { queryStore.networkError = null; queryStore.graphQLErrors = []; } }; ObservableQuery.prototype.refetch = function (variables) { var fetchPolicy = this.options.fetchPolicy; if (fetchPolicy === 'cache-only') { return Promise.reject( false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_4__["InvariantError"]('cache-only fetchPolicy option should not be used together with query refetch.')); } if (fetchPolicy !== 'no-cache' && fetchPolicy !== 'cache-and-network') { fetchPolicy = 'network-only'; } if (!Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["isEqual"])(this.variables, variables)) { this.variables = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this.variables, variables); } if (!Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["isEqual"])(this.options.variables, this.variables)) { this.options.variables = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this.options.variables, this.variables); } return this.queryManager.fetchQuery(this.queryId, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this.options, { fetchPolicy: fetchPolicy }), FetchType.refetch); }; ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) { var _this = this; false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(fetchMoreOptions.updateQuery, 'updateQuery option is required. This function defines how to update the query data with the new results.'); var combinedOptions = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, (fetchMoreOptions.query ? fetchMoreOptions : Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this.options, fetchMoreOptions, { variables: Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this.variables, fetchMoreOptions.variables) })), { fetchPolicy: 'network-only' }); var qid = this.queryManager.generateQueryId(); return this.queryManager .fetchQuery(qid, combinedOptions, FetchType.normal, this.queryId) .then(function (fetchMoreResult) { _this.updateQuery(function (previousResult) { return fetchMoreOptions.updateQuery(previousResult, { fetchMoreResult: fetchMoreResult.data, variables: combinedOptions.variables, }); }); _this.queryManager.stopQuery(qid); return fetchMoreResult; }, function (error) { _this.queryManager.stopQuery(qid); throw error; }); }; ObservableQuery.prototype.subscribeToMore = function (options) { var _this = this; var subscription = this.queryManager .startGraphQLSubscription({ query: options.document, variables: options.variables, }) .subscribe({ next: function (subscriptionData) { var updateQuery = options.updateQuery; if (updateQuery) { _this.updateQuery(function (previous, _a) { var variables = _a.variables; return updateQuery(previous, { subscriptionData: subscriptionData, variables: variables, }); }); } }, error: function (err) { if (options.onError) { options.onError(err); return; } false || ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"].error('Unhandled GraphQL subscription error', err); }, }); this.subscriptions.add(subscription); return function () { if (_this.subscriptions.delete(subscription)) { subscription.unsubscribe(); } }; }; ObservableQuery.prototype.setOptions = function (opts) { var oldFetchPolicy = this.options.fetchPolicy; this.options = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this.options, opts); if (opts.pollInterval) { this.startPolling(opts.pollInterval); } else if (opts.pollInterval === 0) { this.stopPolling(); } var fetchPolicy = opts.fetchPolicy; return this.setVariables(this.options.variables, oldFetchPolicy !== fetchPolicy && (oldFetchPolicy === 'cache-only' || oldFetchPolicy === 'standby' || fetchPolicy === 'network-only'), opts.fetchResults); }; ObservableQuery.prototype.setVariables = function (variables, tryFetch, fetchResults) { if (tryFetch === void 0) { tryFetch = false; } if (fetchResults === void 0) { fetchResults = true; } this.isTornDown = false; variables = variables || this.variables; if (!tryFetch && Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["isEqual"])(variables, this.variables)) { return this.observers.size && fetchResults ? this.result() : Promise.resolve(); } this.variables = this.options.variables = variables; if (!this.observers.size) { return Promise.resolve(); } return this.queryManager.fetchQuery(this.queryId, this.options); }; ObservableQuery.prototype.updateQuery = function (mapFn) { var queryManager = this.queryManager; var _a = queryManager.getQueryWithPreviousResult(this.queryId), previousResult = _a.previousResult, variables = _a.variables, document = _a.document; var newResult = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["tryFunctionOrLogError"])(function () { return mapFn(previousResult, { variables: variables }); }); if (newResult) { queryManager.dataStore.markUpdateQueryResult(document, variables, newResult); queryManager.broadcastQueries(); } }; ObservableQuery.prototype.stopPolling = function () { this.queryManager.stopPollingQuery(this.queryId); this.options.pollInterval = undefined; }; ObservableQuery.prototype.startPolling = function (pollInterval) { assertNotCacheFirstOrOnly(this); this.options.pollInterval = pollInterval; this.queryManager.startPollingQuery(this.options, this.queryId); }; ObservableQuery.prototype.updateLastResult = function (newResult) { var previousResult = this.lastResult; this.lastResult = newResult; this.lastResultSnapshot = this.queryManager.assumeImmutableResults ? newResult : Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["cloneDeep"])(newResult); return previousResult; }; ObservableQuery.prototype.onSubscribe = function (observer) { var _this = this; try { var subObserver = observer._subscription._observer; if (subObserver && !subObserver.error) { subObserver.error = defaultSubscriptionObserverErrorCallback; } } catch (_a) { } var first = !this.observers.size; this.observers.add(observer); if (observer.next && this.lastResult) observer.next(this.lastResult); if (observer.error && this.lastError) observer.error(this.lastError); if (first) { this.setUpQuery(); } return function () { if (_this.observers.delete(observer) && !_this.observers.size) { _this.tearDownQuery(); } }; }; ObservableQuery.prototype.setUpQuery = function () { var _this = this; var _a = this, queryManager = _a.queryManager, queryId = _a.queryId; if (this.shouldSubscribe) { queryManager.addObservableQuery(queryId, this); } if (this.options.pollInterval) { assertNotCacheFirstOrOnly(this); queryManager.startPollingQuery(this.options, queryId); } var onError = function (error) { iterateObserversSafely(_this.observers, 'error', _this.lastError = error); }; queryManager.observeQuery(queryId, this.options, { next: function (result) { if (_this.lastError || _this.isDifferentFromLastResult(result)) { var previousResult_1 = _this.updateLastResult(result); var _a = _this.options, query_1 = _a.query, variables = _a.variables, fetchPolicy_1 = _a.fetchPolicy; if (queryManager.transform(query_1).hasClientExports) { queryManager.getLocalState().addExportedVariables(query_1, variables).then(function (variables) { var previousVariables = _this.variables; _this.variables = _this.options.variables = variables; if (!result.loading && previousResult_1 && fetchPolicy_1 !== 'cache-only' && queryManager.transform(query_1).serverQuery && !Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["isEqual"])(previousVariables, variables)) { _this.refetch(); } else { iterateObserversSafely(_this.observers, 'next', result); } }); } else { iterateObserversSafely(_this.observers, 'next', result); } } }, error: onError, }).catch(onError); }; ObservableQuery.prototype.tearDownQuery = function () { var queryManager = this.queryManager; this.isTornDown = true; queryManager.stopPollingQuery(this.queryId); this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); }); this.subscriptions.clear(); queryManager.removeObservableQuery(this.queryId); queryManager.stopQuery(this.queryId); this.observers.clear(); }; return ObservableQuery; }(Observable)); function defaultSubscriptionObserverErrorCallback(error) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"].error('Unhandled error', error.message, error.stack); } function iterateObserversSafely(observers, method, argument) { var observersWithMethod = []; observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); }); observersWithMethod.forEach(function (obs) { return obs[method](argument); }); } function assertNotCacheFirstOrOnly(obsQuery) { var fetchPolicy = obsQuery.options.fetchPolicy; false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(fetchPolicy !== 'cache-first' && fetchPolicy !== 'cache-only', 'Queries that specify the cache-first and cache-only fetchPolicies cannot also be polling queries.'); } var MutationStore = (function () { function MutationStore() { this.store = {}; } MutationStore.prototype.getStore = function () { return this.store; }; MutationStore.prototype.get = function (mutationId) { return this.store[mutationId]; }; MutationStore.prototype.initMutation = function (mutationId, mutation, variables) { this.store[mutationId] = { mutation: mutation, variables: variables || {}, loading: true, error: null, }; }; MutationStore.prototype.markMutationError = function (mutationId, error) { var mutation = this.store[mutationId]; if (mutation) { mutation.loading = false; mutation.error = error; } }; MutationStore.prototype.markMutationResult = function (mutationId) { var mutation = this.store[mutationId]; if (mutation) { mutation.loading = false; mutation.error = null; } }; MutationStore.prototype.reset = function () { this.store = {}; }; return MutationStore; }()); var QueryStore = (function () { function QueryStore() { this.store = {}; } QueryStore.prototype.getStore = function () { return this.store; }; QueryStore.prototype.get = function (queryId) { return this.store[queryId]; }; QueryStore.prototype.initQuery = function (query) { var previousQuery = this.store[query.queryId]; false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(!previousQuery || previousQuery.document === query.document || Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["isEqual"])(previousQuery.document, query.document), 'Internal Error: may not update existing query string in store'); var isSetVariables = false; var previousVariables = null; if (query.storePreviousVariables && previousQuery && previousQuery.networkStatus !== NetworkStatus.loading) { if (!Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["isEqual"])(previousQuery.variables, query.variables)) { isSetVariables = true; previousVariables = previousQuery.variables; } } var networkStatus; if (isSetVariables) { networkStatus = NetworkStatus.setVariables; } else if (query.isPoll) { networkStatus = NetworkStatus.poll; } else if (query.isRefetch) { networkStatus = NetworkStatus.refetch; } else { networkStatus = NetworkStatus.loading; } var graphQLErrors = []; if (previousQuery && previousQuery.graphQLErrors) { graphQLErrors = previousQuery.graphQLErrors; } this.store[query.queryId] = { document: query.document, variables: query.variables, previousVariables: previousVariables, networkError: null, graphQLErrors: graphQLErrors, networkStatus: networkStatus, metadata: query.metadata, }; if (typeof query.fetchMoreForQueryId === 'string' && this.store[query.fetchMoreForQueryId]) { this.store[query.fetchMoreForQueryId].networkStatus = NetworkStatus.fetchMore; } }; QueryStore.prototype.markQueryResult = function (queryId, result, fetchMoreForQueryId) { if (!this.store || !this.store[queryId]) return; this.store[queryId].networkError = null; this.store[queryId].graphQLErrors = isNonEmptyArray(result.errors) ? result.errors : []; this.store[queryId].previousVariables = null; this.store[queryId].networkStatus = NetworkStatus.ready; if (typeof fetchMoreForQueryId === 'string' && this.store[fetchMoreForQueryId]) { this.store[fetchMoreForQueryId].networkStatus = NetworkStatus.ready; } }; QueryStore.prototype.markQueryError = function (queryId, error, fetchMoreForQueryId) { if (!this.store || !this.store[queryId]) return; this.store[queryId].networkError = error; this.store[queryId].networkStatus = NetworkStatus.error; if (typeof fetchMoreForQueryId === 'string') { this.markQueryResultClient(fetchMoreForQueryId, true); } }; QueryStore.prototype.markQueryResultClient = function (queryId, complete) { var storeValue = this.store && this.store[queryId]; if (storeValue) { storeValue.networkError = null; storeValue.previousVariables = null; if (complete) { storeValue.networkStatus = NetworkStatus.ready; } } }; QueryStore.prototype.stopQuery = function (queryId) { delete this.store[queryId]; }; QueryStore.prototype.reset = function (observableQueryIds) { var _this = this; Object.keys(this.store).forEach(function (queryId) { if (observableQueryIds.indexOf(queryId) < 0) { _this.stopQuery(queryId); } else { _this.store[queryId].networkStatus = NetworkStatus.loading; } }); }; return QueryStore; }()); function capitalizeFirstLetter(str) { return str.charAt(0).toUpperCase() + str.slice(1); } var LocalState = (function () { function LocalState(_a) { var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher; this.cache = cache; if (client) { this.client = client; } if (resolvers) { this.addResolvers(resolvers); } if (fragmentMatcher) { this.setFragmentMatcher(fragmentMatcher); } } LocalState.prototype.addResolvers = function (resolvers) { var _this = this; this.resolvers = this.resolvers || {}; if (Array.isArray(resolvers)) { resolvers.forEach(function (resolverGroup) { _this.resolvers = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["mergeDeep"])(_this.resolvers, resolverGroup); }); } else { this.resolvers = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["mergeDeep"])(this.resolvers, resolvers); } }; LocalState.prototype.setResolvers = function (resolvers) { this.resolvers = {}; this.addResolvers(resolvers); }; LocalState.prototype.getResolvers = function () { return this.resolvers || {}; }; LocalState.prototype.runResolvers = function (_a) { var document = _a.document, remoteResult = _a.remoteResult, context = _a.context, variables = _a.variables, _b = _a.onlyRunForcedResolvers, onlyRunForcedResolvers = _b === void 0 ? false : _b; return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_c) { if (document) { return [2, this.resolveDocument(document, remoteResult.data, context, variables, this.fragmentMatcher, onlyRunForcedResolvers).then(function (localResult) { return (Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, remoteResult, { data: localResult.result })); })]; } return [2, remoteResult]; }); }); }; LocalState.prototype.setFragmentMatcher = function (fragmentMatcher) { this.fragmentMatcher = fragmentMatcher; }; LocalState.prototype.getFragmentMatcher = function () { return this.fragmentMatcher; }; LocalState.prototype.clientQuery = function (document) { if (Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["hasDirectives"])(['client'], document)) { if (this.resolvers) { return document; } false || ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"].warn('Found @client directives in a query but no ApolloClient resolvers ' + 'were specified. This means ApolloClient local resolver handling ' + 'has been disabled, and @client directives will be passed through ' + 'to your link chain.'); } return null; }; LocalState.prototype.serverQuery = function (document) { return this.resolvers ? Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["removeClientSetsFromDocument"])(document) : document; }; LocalState.prototype.prepareContext = function (context) { if (context === void 0) { context = {}; } var cache = this.cache; var newContext = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, context, { cache: cache, getCacheKey: function (obj) { if (cache.config) { return cache.config.dataIdFromObject(obj); } else { false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(false, 'To use context.getCacheKey, you need to use a cache that has ' + 'a configurable dataIdFromObject, like apollo-cache-inmemory.'); } } }); return newContext; }; LocalState.prototype.addExportedVariables = function (document, variables, context) { if (variables === void 0) { variables = {}; } if (context === void 0) { context = {}; } return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () { return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_a) { if (document) { return [2, this.resolveDocument(document, this.buildRootValueFromCache(document, variables) || {}, this.prepareContext(context), variables).then(function (data) { return (Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, variables, data.exportedVariables)); })]; } return [2, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, variables)]; }); }); }; LocalState.prototype.shouldForceResolvers = function (document) { var forceResolvers = false; Object(graphql_language_visitor__WEBPACK_IMPORTED_MODULE_5__["visit"])(document, { Directive: { enter: function (node) { if (node.name.value === 'client' && node.arguments) { forceResolvers = node.arguments.some(function (arg) { return arg.name.value === 'always' && arg.value.kind === 'BooleanValue' && arg.value.value === true; }); if (forceResolvers) { return graphql_language_visitor__WEBPACK_IMPORTED_MODULE_5__["BREAK"]; } } }, }, }); return forceResolvers; }; LocalState.prototype.buildRootValueFromCache = function (document, variables) { return this.cache.diff({ query: Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["buildQueryFromSelectionSet"])(document), variables: variables, returnPartialData: true, optimistic: false, }).result; }; LocalState.prototype.resolveDocument = function (document, rootValue, context, variables, fragmentMatcher, onlyRunForcedResolvers) { if (context === void 0) { context = {}; } if (variables === void 0) { variables = {}; } if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; } if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; } return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () { var mainDefinition, fragments, fragmentMap, definitionOperation, defaultOperationType, _a, cache, client, execContext; return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_b) { mainDefinition = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["getMainDefinition"])(document); fragments = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["getFragmentDefinitions"])(document); fragmentMap = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["createFragmentMap"])(fragments); definitionOperation = mainDefinition .operation; defaultOperationType = definitionOperation ? capitalizeFirstLetter(definitionOperation) : 'Query'; _a = this, cache = _a.cache, client = _a.client; execContext = { fragmentMap: fragmentMap, context: Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, context, { cache: cache, client: client }), variables: variables, fragmentMatcher: fragmentMatcher, defaultOperationType: defaultOperationType, exportedVariables: {}, onlyRunForcedResolvers: onlyRunForcedResolvers, }; return [2, this.resolveSelectionSet(mainDefinition.selectionSet, rootValue, execContext).then(function (result) { return ({ result: result, exportedVariables: execContext.exportedVariables, }); })]; }); }); }; LocalState.prototype.resolveSelectionSet = function (selectionSet, rootValue, execContext) { return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () { var fragmentMap, context, variables, resultsToMerge, execute; var _this = this; return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_a) { fragmentMap = execContext.fragmentMap, context = execContext.context, variables = execContext.variables; resultsToMerge = [rootValue]; execute = function (selection) { return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(_this, void 0, void 0, function () { var fragment, typeCondition; return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_a) { if (!Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["shouldInclude"])(selection, variables)) { return [2]; } if (Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["isField"])(selection)) { return [2, this.resolveField(selection, rootValue, execContext).then(function (fieldResult) { var _a; if (typeof fieldResult !== 'undefined') { resultsToMerge.push((_a = {}, _a[Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["resultKeyNameFromField"])(selection)] = fieldResult, _a)); } })]; } if (Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["isInlineFragment"])(selection)) { fragment = selection; } else { fragment = fragmentMap[selection.name.value]; false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(fragment, "No fragment named " + selection.name.value); } if (fragment && fragment.typeCondition) { typeCondition = fragment.typeCondition.name.value; if (execContext.fragmentMatcher(rootValue, typeCondition, context)) { return [2, this.resolveSelectionSet(fragment.selectionSet, rootValue, execContext).then(function (fragmentResult) { resultsToMerge.push(fragmentResult); })]; } } return [2]; }); }); }; return [2, Promise.all(selectionSet.selections.map(execute)).then(function () { return Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["mergeDeepArray"])(resultsToMerge); })]; }); }); }; LocalState.prototype.resolveField = function (field, rootValue, execContext) { return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () { var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve; var _this = this; return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_a) { variables = execContext.variables; fieldName = field.name.value; aliasedFieldName = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["resultKeyNameFromField"])(field); aliasUsed = fieldName !== aliasedFieldName; defaultResult = rootValue[aliasedFieldName] || rootValue[fieldName]; resultPromise = Promise.resolve(defaultResult); if (!execContext.onlyRunForcedResolvers || this.shouldForceResolvers(field)) { resolverType = rootValue.__typename || execContext.defaultOperationType; resolverMap = this.resolvers && this.resolvers[resolverType]; if (resolverMap) { resolve = resolverMap[aliasUsed ? fieldName : aliasedFieldName]; if (resolve) { resultPromise = Promise.resolve(resolve(rootValue, Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["argumentsObjectFromField"])(field, variables), execContext.context, { field: field })); } } } return [2, resultPromise.then(function (result) { if (result === void 0) { result = defaultResult; } if (field.directives) { field.directives.forEach(function (directive) { if (directive.name.value === 'export' && directive.arguments) { directive.arguments.forEach(function (arg) { if (arg.name.value === 'as' && arg.value.kind === 'StringValue') { execContext.exportedVariables[arg.value.value] = result; } }); } }); } if (!field.selectionSet) { return result; } if (result == null) { return result; } if (Array.isArray(result)) { return _this.resolveSubSelectedArray(field, result, execContext); } if (field.selectionSet) { return _this.resolveSelectionSet(field.selectionSet, result, execContext); } })]; }); }); }; LocalState.prototype.resolveSubSelectedArray = function (field, result, execContext) { var _this = this; return Promise.all(result.map(function (item) { if (item === null) { return null; } if (Array.isArray(item)) { return _this.resolveSubSelectedArray(field, item, execContext); } if (field.selectionSet) { return _this.resolveSelectionSet(field.selectionSet, item, execContext); } })); }; return LocalState; }()); function multiplex(inner) { var observers = new Set(); var sub = null; return new Observable(function (observer) { observers.add(observer); sub = sub || inner.subscribe({ next: function (value) { observers.forEach(function (obs) { return obs.next && obs.next(value); }); }, error: function (error) { observers.forEach(function (obs) { return obs.error && obs.error(error); }); }, complete: function () { observers.forEach(function (obs) { return obs.complete && obs.complete(); }); }, }); return function () { if (observers.delete(observer) && !observers.size && sub) { sub.unsubscribe(); sub = null; } }; }); } function asyncMap(observable, mapFn) { return new Observable(function (observer) { var next = observer.next, error = observer.error, complete = observer.complete; var activeNextCount = 0; var completed = false; var handler = { next: function (value) { ++activeNextCount; new Promise(function (resolve) { resolve(mapFn(value)); }).then(function (result) { --activeNextCount; next && next.call(observer, result); completed && handler.complete(); }, function (e) { --activeNextCount; error && error.call(observer, e); }); }, error: function (e) { error && error.call(observer, e); }, complete: function () { completed = true; if (!activeNextCount) { complete && complete.call(observer); } }, }; var sub = observable.subscribe(handler); return function () { return sub.unsubscribe(); }; }); } var hasOwnProperty = Object.prototype.hasOwnProperty; var QueryManager = (function () { function QueryManager(_a) { var link = _a.link, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, store = _a.store, _c = _a.onBroadcast, onBroadcast = _c === void 0 ? function () { return undefined; } : _c, _d = _a.ssrMode, ssrMode = _d === void 0 ? false : _d, _e = _a.clientAwareness, clientAwareness = _e === void 0 ? {} : _e, localState = _a.localState, assumeImmutableResults = _a.assumeImmutableResults; this.mutationStore = new MutationStore(); this.queryStore = new QueryStore(); this.clientAwareness = {}; this.idCounter = 1; this.queries = new Map(); this.fetchQueryRejectFns = new Map(); this.transformCache = new (apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["canUseWeakMap"] ? WeakMap : Map)(); this.inFlightLinkObservables = new Map(); this.pollingInfoByQueryId = new Map(); this.link = link; this.queryDeduplication = queryDeduplication; this.dataStore = store; this.onBroadcast = onBroadcast; this.clientAwareness = clientAwareness; this.localState = localState || new LocalState({ cache: store.getCache() }); this.ssrMode = ssrMode; this.assumeImmutableResults = !!assumeImmutableResults; } QueryManager.prototype.stop = function () { var _this = this; this.queries.forEach(function (_info, queryId) { _this.stopQueryNoBroadcast(queryId); }); this.fetchQueryRejectFns.forEach(function (reject) { reject( false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_4__["InvariantError"]('QueryManager stopped while query was in flight')); }); }; QueryManager.prototype.mutate = function (_a) { var mutation = _a.mutation, variables = _a.variables, optimisticResponse = _a.optimisticResponse, updateQueriesByName = _a.updateQueries, _b = _a.refetchQueries, refetchQueries = _b === void 0 ? [] : _b, _c = _a.awaitRefetchQueries, awaitRefetchQueries = _c === void 0 ? false : _c, updateWithProxyFn = _a.update, _d = _a.errorPolicy, errorPolicy = _d === void 0 ? 'none' : _d, fetchPolicy = _a.fetchPolicy, _e = _a.context, context = _e === void 0 ? {} : _e; return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () { var mutationId, generateUpdateQueriesInfo, self; var _this = this; return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_f) { switch (_f.label) { case 0: false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.'); false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(!fetchPolicy || fetchPolicy === 'no-cache', "fetchPolicy for mutations currently only supports the 'no-cache' policy"); mutationId = this.generateQueryId(); mutation = this.transform(mutation).document; this.setQuery(mutationId, function () { return ({ document: mutation }); }); variables = this.getVariables(mutation, variables); if (!this.transform(mutation).hasClientExports) return [3, 2]; return [4, this.localState.addExportedVariables(mutation, variables, context)]; case 1: variables = _f.sent(); _f.label = 2; case 2: generateUpdateQueriesInfo = function () { var ret = {}; if (updateQueriesByName) { _this.queries.forEach(function (_a, queryId) { var observableQuery = _a.observableQuery; if (observableQuery) { var queryName = observableQuery.queryName; if (queryName && hasOwnProperty.call(updateQueriesByName, queryName)) { ret[queryId] = { updater: updateQueriesByName[queryName], query: _this.queryStore.get(queryId), }; } } }); } return ret; }; this.mutationStore.initMutation(mutationId, mutation, variables); this.dataStore.markMutationInit({ mutationId: mutationId, document: mutation, variables: variables, updateQueries: generateUpdateQueriesInfo(), update: updateWithProxyFn, optimisticResponse: optimisticResponse, }); this.broadcastQueries(); self = this; return [2, new Promise(function (resolve, reject) { var storeResult; var error; self.getObservableFromLink(mutation, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, context, { optimisticResponse: optimisticResponse }), variables, false).subscribe({ next: function (result) { if (Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["graphQLResultHasError"])(result) && errorPolicy === 'none') { error = new ApolloError({ graphQLErrors: result.errors, }); return; } self.mutationStore.markMutationResult(mutationId); if (fetchPolicy !== 'no-cache') { self.dataStore.markMutationResult({ mutationId: mutationId, result: result, document: mutation, variables: variables, updateQueries: generateUpdateQueriesInfo(), update: updateWithProxyFn, }); } storeResult = result; }, error: function (err) { self.mutationStore.markMutationError(mutationId, err); self.dataStore.markMutationComplete({ mutationId: mutationId, optimisticResponse: optimisticResponse, }); self.broadcastQueries(); self.setQuery(mutationId, function () { return ({ document: null }); }); reject(new ApolloError({ networkError: err, })); }, complete: function () { if (error) { self.mutationStore.markMutationError(mutationId, error); } self.dataStore.markMutationComplete({ mutationId: mutationId, optimisticResponse: optimisticResponse, }); self.broadcastQueries(); if (error) { reject(error); return; } if (typeof refetchQueries === 'function') { refetchQueries = refetchQueries(storeResult); } var refetchQueryPromises = []; if (isNonEmptyArray(refetchQueries)) { refetchQueries.forEach(function (refetchQuery) { if (typeof refetchQuery === 'string') { self.queries.forEach(function (_a) { var observableQuery = _a.observableQuery; if (observableQuery && observableQuery.queryName === refetchQuery) { refetchQueryPromises.push(observableQuery.refetch()); } }); } else { var queryOptions = { query: refetchQuery.query, variables: refetchQuery.variables, fetchPolicy: 'network-only', }; if (refetchQuery.context) { queryOptions.context = refetchQuery.context; } refetchQueryPromises.push(self.query(queryOptions)); } }); } Promise.all(awaitRefetchQueries ? refetchQueryPromises : []).then(function () { self.setQuery(mutationId, function () { return ({ document: null }); }); if (errorPolicy === 'ignore' && storeResult && Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["graphQLResultHasError"])(storeResult)) { delete storeResult.errors; } resolve(storeResult); }); }, }); })]; } }); }); }; QueryManager.prototype.fetchQuery = function (queryId, options, fetchType, fetchMoreForQueryId) { return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function () { var _a, metadata, _b, fetchPolicy, _c, context, query, variables, storeResult, isNetworkOnly, needToFetch, _d, complete, result, shouldFetch, requestId, cancel, networkResult; var _this = this; return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__generator"])(this, function (_e) { switch (_e.label) { case 0: _a = options.metadata, metadata = _a === void 0 ? null : _a, _b = options.fetchPolicy, fetchPolicy = _b === void 0 ? 'cache-first' : _b, _c = options.context, context = _c === void 0 ? {} : _c; query = this.transform(options.query).document; variables = this.getVariables(query, options.variables); if (!this.transform(query).hasClientExports) return [3, 2]; return [4, this.localState.addExportedVariables(query, variables, context)]; case 1: variables = _e.sent(); _e.label = 2; case 2: options = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, options, { variables: variables }); isNetworkOnly = fetchPolicy === 'network-only' || fetchPolicy === 'no-cache'; needToFetch = isNetworkOnly; if (!isNetworkOnly) { _d = this.dataStore.getCache().diff({ query: query, variables: variables, returnPartialData: true, optimistic: false, }), complete = _d.complete, result = _d.result; needToFetch = !complete || fetchPolicy === 'cache-and-network'; storeResult = result; } shouldFetch = needToFetch && fetchPolicy !== 'cache-only' && fetchPolicy !== 'standby'; if (Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["hasDirectives"])(['live'], query)) shouldFetch = true; requestId = this.idCounter++; cancel = fetchPolicy !== 'no-cache' ? this.updateQueryWatch(queryId, query, options) : undefined; this.setQuery(queryId, function () { return ({ document: query, lastRequestId: requestId, invalidated: true, cancel: cancel, }); }); this.invalidate(fetchMoreForQueryId); this.queryStore.initQuery({ queryId: queryId, document: query, storePreviousVariables: shouldFetch, variables: variables, isPoll: fetchType === FetchType.poll, isRefetch: fetchType === FetchType.refetch, metadata: metadata, fetchMoreForQueryId: fetchMoreForQueryId, }); this.broadcastQueries(); if (shouldFetch) { networkResult = this.fetchRequest({ requestId: requestId, queryId: queryId, document: query, options: options, fetchMoreForQueryId: fetchMoreForQueryId, }).catch(function (error) { if (isApolloError(error)) { throw error; } else { if (requestId >= _this.getQuery(queryId).lastRequestId) { _this.queryStore.markQueryError(queryId, error, fetchMoreForQueryId); _this.invalidate(queryId); _this.invalidate(fetchMoreForQueryId); _this.broadcastQueries(); } throw new ApolloError({ networkError: error }); } }); if (fetchPolicy !== 'cache-and-network') { return [2, networkResult]; } networkResult.catch(function () { }); } this.queryStore.markQueryResultClient(queryId, !shouldFetch); this.invalidate(queryId); this.invalidate(fetchMoreForQueryId); if (this.transform(query).hasForcedResolvers) { return [2, this.localState.runResolvers({ document: query, remoteResult: { data: storeResult }, context: context, variables: variables, onlyRunForcedResolvers: true, }).then(function (result) { _this.markQueryResult(queryId, result, options, fetchMoreForQueryId); _this.broadcastQueries(); return result; })]; } this.broadcastQueries(); return [2, { data: storeResult }]; } }); }); }; QueryManager.prototype.markQueryResult = function (queryId, result, _a, fetchMoreForQueryId) { var fetchPolicy = _a.fetchPolicy, variables = _a.variables, errorPolicy = _a.errorPolicy; if (fetchPolicy === 'no-cache') { this.setQuery(queryId, function () { return ({ newData: { result: result.data, complete: true }, }); }); } else { this.dataStore.markQueryResult(result, this.getQuery(queryId).document, variables, fetchMoreForQueryId, errorPolicy === 'ignore' || errorPolicy === 'all'); } }; QueryManager.prototype.queryListenerForObserver = function (queryId, options, observer) { var _this = this; function invoke(method, argument) { if (observer[method]) { try { observer[method](argument); } catch (e) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"].error(e); } } else if (method === 'error') { false || ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"].error(argument); } } return function (queryStoreValue, newData) { _this.invalidate(queryId, false); if (!queryStoreValue) return; var _a = _this.getQuery(queryId), observableQuery = _a.observableQuery, document = _a.document; var fetchPolicy = observableQuery ? observableQuery.options.fetchPolicy : options.fetchPolicy; if (fetchPolicy === 'standby') return; var loading = isNetworkRequestInFlight(queryStoreValue.networkStatus); var lastResult = observableQuery && observableQuery.getLastResult(); var networkStatusChanged = !!(lastResult && lastResult.networkStatus !== queryStoreValue.networkStatus); var shouldNotifyIfLoading = options.returnPartialData || (!newData && queryStoreValue.previousVariables) || (networkStatusChanged && options.notifyOnNetworkStatusChange) || fetchPolicy === 'cache-only' || fetchPolicy === 'cache-and-network'; if (loading && !shouldNotifyIfLoading) { return; } var hasGraphQLErrors = isNonEmptyArray(queryStoreValue.graphQLErrors); var errorPolicy = observableQuery && observableQuery.options.errorPolicy || options.errorPolicy || 'none'; if (errorPolicy === 'none' && hasGraphQLErrors || queryStoreValue.networkError) { return invoke('error', new ApolloError({ graphQLErrors: queryStoreValue.graphQLErrors, networkError: queryStoreValue.networkError, })); } try { var data = void 0; var isMissing = void 0; if (newData) { if (fetchPolicy !== 'no-cache' && fetchPolicy !== 'network-only') { _this.setQuery(queryId, function () { return ({ newData: null }); }); } data = newData.result; isMissing = !newData.complete; } else { var lastError = observableQuery && observableQuery.getLastError(); var errorStatusChanged = errorPolicy !== 'none' && (lastError && lastError.graphQLErrors) !== queryStoreValue.graphQLErrors; if (lastResult && lastResult.data && !errorStatusChanged) { data = lastResult.data; isMissing = false; } else { var diffResult = _this.dataStore.getCache().diff({ query: document, variables: queryStoreValue.previousVariables || queryStoreValue.variables, returnPartialData: true, optimistic: true, }); data = diffResult.result; isMissing = !diffResult.complete; } } var stale = isMissing && !(options.returnPartialData || fetchPolicy === 'cache-only'); var resultFromStore = { data: stale ? lastResult && lastResult.data : data, loading: loading, networkStatus: queryStoreValue.networkStatus, stale: stale, }; if (errorPolicy === 'all' && hasGraphQLErrors) { resultFromStore.errors = queryStoreValue.graphQLErrors; } invoke('next', resultFromStore); } catch (networkError) { invoke('error', new ApolloError({ networkError: networkError })); } }; }; QueryManager.prototype.transform = function (document) { var transformCache = this.transformCache; if (!transformCache.has(document)) { var cache = this.dataStore.getCache(); var transformed = cache.transformDocument(document); var forLink = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["removeConnectionDirectiveFromDocument"])(cache.transformForLink(transformed)); var clientQuery = this.localState.clientQuery(transformed); var serverQuery = this.localState.serverQuery(forLink); var cacheEntry_1 = { document: transformed, hasClientExports: Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["hasClientExports"])(transformed), hasForcedResolvers: this.localState.shouldForceResolvers(transformed), clientQuery: clientQuery, serverQuery: serverQuery, defaultVars: Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["getDefaultValues"])(Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["getOperationDefinition"])(transformed)), }; var add = function (doc) { if (doc && !transformCache.has(doc)) { transformCache.set(doc, cacheEntry_1); } }; add(document); add(transformed); add(clientQuery); add(serverQuery); } return transformCache.get(document); }; QueryManager.prototype.getVariables = function (document, variables) { return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this.transform(document).defaultVars, variables); }; QueryManager.prototype.watchQuery = function (options, shouldSubscribe) { if (shouldSubscribe === void 0) { shouldSubscribe = true; } false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(options.fetchPolicy !== 'standby', 'client.watchQuery cannot be called with fetchPolicy set to "standby"'); options.variables = this.getVariables(options.query, options.variables); if (typeof options.notifyOnNetworkStatusChange === 'undefined') { options.notifyOnNetworkStatusChange = false; } var transformedOptions = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, options); return new ObservableQuery({ queryManager: this, options: transformedOptions, shouldSubscribe: shouldSubscribe, }); }; QueryManager.prototype.query = function (options) { var _this = this; false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(options.query, 'query option is required. You must specify your GraphQL document ' + 'in the query option.'); false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.'); false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.'); false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(!options.pollInterval, 'pollInterval option only supported on watchQuery.'); return new Promise(function (resolve, reject) { var watchedQuery = _this.watchQuery(options, false); _this.fetchQueryRejectFns.set("query:" + watchedQuery.queryId, reject); watchedQuery .result() .then(resolve, reject) .then(function () { return _this.fetchQueryRejectFns.delete("query:" + watchedQuery.queryId); }); }); }; QueryManager.prototype.generateQueryId = function () { return String(this.idCounter++); }; QueryManager.prototype.stopQueryInStore = function (queryId) { this.stopQueryInStoreNoBroadcast(queryId); this.broadcastQueries(); }; QueryManager.prototype.stopQueryInStoreNoBroadcast = function (queryId) { this.stopPollingQuery(queryId); this.queryStore.stopQuery(queryId); this.invalidate(queryId); }; QueryManager.prototype.addQueryListener = function (queryId, listener) { this.setQuery(queryId, function (_a) { var listeners = _a.listeners; listeners.add(listener); return { invalidated: false }; }); }; QueryManager.prototype.updateQueryWatch = function (queryId, document, options) { var _this = this; var cancel = this.getQuery(queryId).cancel; if (cancel) cancel(); var previousResult = function () { var previousResult = null; var observableQuery = _this.getQuery(queryId).observableQuery; if (observableQuery) { var lastResult = observableQuery.getLastResult(); if (lastResult) { previousResult = lastResult.data; } } return previousResult; }; return this.dataStore.getCache().watch({ query: document, variables: options.variables, optimistic: true, previousResult: previousResult, callback: function (newData) { _this.setQuery(queryId, function () { return ({ invalidated: true, newData: newData }); }); }, }); }; QueryManager.prototype.addObservableQuery = function (queryId, observableQuery) { this.setQuery(queryId, function () { return ({ observableQuery: observableQuery }); }); }; QueryManager.prototype.removeObservableQuery = function (queryId) { var cancel = this.getQuery(queryId).cancel; this.setQuery(queryId, function () { return ({ observableQuery: null }); }); if (cancel) cancel(); }; QueryManager.prototype.clearStore = function () { this.fetchQueryRejectFns.forEach(function (reject) { reject( false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_4__["InvariantError"]('Store reset while query was in flight (not completed in link chain)')); }); var resetIds = []; this.queries.forEach(function (_a, queryId) { var observableQuery = _a.observableQuery; if (observableQuery) resetIds.push(queryId); }); this.queryStore.reset(resetIds); this.mutationStore.reset(); return this.dataStore.reset(); }; QueryManager.prototype.resetStore = function () { var _this = this; return this.clearStore().then(function () { return _this.reFetchObservableQueries(); }); }; QueryManager.prototype.reFetchObservableQueries = function (includeStandby) { var _this = this; if (includeStandby === void 0) { includeStandby = false; } var observableQueryPromises = []; this.queries.forEach(function (_a, queryId) { var observableQuery = _a.observableQuery; if (observableQuery) { var fetchPolicy = observableQuery.options.fetchPolicy; observableQuery.resetLastResults(); if (fetchPolicy !== 'cache-only' && (includeStandby || fetchPolicy !== 'standby')) { observableQueryPromises.push(observableQuery.refetch()); } _this.setQuery(queryId, function () { return ({ newData: null }); }); _this.invalidate(queryId); } }); this.broadcastQueries(); return Promise.all(observableQueryPromises); }; QueryManager.prototype.observeQuery = function (queryId, options, observer) { this.addQueryListener(queryId, this.queryListenerForObserver(queryId, options, observer)); return this.fetchQuery(queryId, options); }; QueryManager.prototype.startQuery = function (queryId, options, listener) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"].warn("The QueryManager.startQuery method has been deprecated"); this.addQueryListener(queryId, listener); this.fetchQuery(queryId, options) .catch(function () { return undefined; }); return queryId; }; QueryManager.prototype.startGraphQLSubscription = function (_a) { var _this = this; var query = _a.query, fetchPolicy = _a.fetchPolicy, variables = _a.variables; query = this.transform(query).document; variables = this.getVariables(query, variables); var makeObservable = function (variables) { return _this.getObservableFromLink(query, {}, variables, false).map(function (result) { if (!fetchPolicy || fetchPolicy !== 'no-cache') { _this.dataStore.markSubscriptionResult(result, query, variables); _this.broadcastQueries(); } if (Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["graphQLResultHasError"])(result)) { throw new ApolloError({ graphQLErrors: result.errors, }); } return result; }); }; if (this.transform(query).hasClientExports) { var observablePromise_1 = this.localState.addExportedVariables(query, variables).then(makeObservable); return new Observable(function (observer) { var sub = null; observablePromise_1.then(function (observable) { return sub = observable.subscribe(observer); }, observer.error); return function () { return sub && sub.unsubscribe(); }; }); } return makeObservable(variables); }; QueryManager.prototype.stopQuery = function (queryId) { this.stopQueryNoBroadcast(queryId); this.broadcastQueries(); }; QueryManager.prototype.stopQueryNoBroadcast = function (queryId) { this.stopQueryInStoreNoBroadcast(queryId); this.removeQuery(queryId); }; QueryManager.prototype.removeQuery = function (queryId) { this.fetchQueryRejectFns.delete("query:" + queryId); this.fetchQueryRejectFns.delete("fetchRequest:" + queryId); this.getQuery(queryId).subscriptions.forEach(function (x) { return x.unsubscribe(); }); this.queries.delete(queryId); }; QueryManager.prototype.getCurrentQueryResult = function (observableQuery, optimistic) { if (optimistic === void 0) { optimistic = true; } var _a = observableQuery.options, variables = _a.variables, query = _a.query, fetchPolicy = _a.fetchPolicy, returnPartialData = _a.returnPartialData; var lastResult = observableQuery.getLastResult(); var newData = this.getQuery(observableQuery.queryId).newData; if (newData && newData.complete) { return { data: newData.result, partial: false }; } if (fetchPolicy === 'no-cache' || fetchPolicy === 'network-only') { return { data: undefined, partial: false }; } var _b = this.dataStore.getCache().diff({ query: query, variables: variables, previousResult: lastResult ? lastResult.data : undefined, returnPartialData: true, optimistic: optimistic, }), result = _b.result, complete = _b.complete; return { data: (complete || returnPartialData) ? result : void 0, partial: !complete, }; }; QueryManager.prototype.getQueryWithPreviousResult = function (queryIdOrObservable) { var observableQuery; if (typeof queryIdOrObservable === 'string') { var foundObserveableQuery = this.getQuery(queryIdOrObservable).observableQuery; false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(foundObserveableQuery, "ObservableQuery with this id doesn't exist: " + queryIdOrObservable); observableQuery = foundObserveableQuery; } else { observableQuery = queryIdOrObservable; } var _a = observableQuery.options, variables = _a.variables, query = _a.query; return { previousResult: this.getCurrentQueryResult(observableQuery, false).data, variables: variables, document: query, }; }; QueryManager.prototype.broadcastQueries = function () { var _this = this; this.onBroadcast(); this.queries.forEach(function (info, id) { if (info.invalidated) { info.listeners.forEach(function (listener) { if (listener) { listener(_this.queryStore.get(id), info.newData); } }); } }); }; QueryManager.prototype.getLocalState = function () { return this.localState; }; QueryManager.prototype.getObservableFromLink = function (query, context, variables, deduplication) { var _this = this; if (deduplication === void 0) { deduplication = this.queryDeduplication; } var observable; var serverQuery = this.transform(query).serverQuery; if (serverQuery) { var _a = this, inFlightLinkObservables_1 = _a.inFlightLinkObservables, link = _a.link; var operation = { query: serverQuery, variables: variables, operationName: Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["getOperationName"])(serverQuery) || void 0, context: this.prepareContext(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, context, { forceFetch: !deduplication })), }; context = operation.context; if (deduplication) { var byVariables_1 = inFlightLinkObservables_1.get(serverQuery) || new Map(); inFlightLinkObservables_1.set(serverQuery, byVariables_1); var varJson_1 = JSON.stringify(variables); observable = byVariables_1.get(varJson_1); if (!observable) { byVariables_1.set(varJson_1, observable = multiplex(Object(apollo_link__WEBPACK_IMPORTED_MODULE_2__["execute"])(link, operation))); var cleanup = function () { byVariables_1.delete(varJson_1); if (!byVariables_1.size) inFlightLinkObservables_1.delete(serverQuery); cleanupSub_1.unsubscribe(); }; var cleanupSub_1 = observable.subscribe({ next: cleanup, error: cleanup, complete: cleanup, }); } } else { observable = multiplex(Object(apollo_link__WEBPACK_IMPORTED_MODULE_2__["execute"])(link, operation)); } } else { observable = Observable.of({ data: {} }); context = this.prepareContext(context); } var clientQuery = this.transform(query).clientQuery; if (clientQuery) { observable = asyncMap(observable, function (result) { return _this.localState.runResolvers({ document: clientQuery, remoteResult: result, context: context, variables: variables, }); }); } return observable; }; QueryManager.prototype.fetchRequest = function (_a) { var _this = this; var requestId = _a.requestId, queryId = _a.queryId, document = _a.document, options = _a.options, fetchMoreForQueryId = _a.fetchMoreForQueryId; var variables = options.variables, _b = options.errorPolicy, errorPolicy = _b === void 0 ? 'none' : _b, fetchPolicy = options.fetchPolicy; var resultFromStore; var errorsFromStore; return new Promise(function (resolve, reject) { var observable = _this.getObservableFromLink(document, options.context, variables); var fqrfId = "fetchRequest:" + queryId; _this.fetchQueryRejectFns.set(fqrfId, reject); var cleanup = function () { _this.fetchQueryRejectFns.delete(fqrfId); _this.setQuery(queryId, function (_a) { var subscriptions = _a.subscriptions; subscriptions.delete(subscription); }); }; var subscription = observable.map(function (result) { if (requestId >= _this.getQuery(queryId).lastRequestId) { _this.markQueryResult(queryId, result, options, fetchMoreForQueryId); _this.queryStore.markQueryResult(queryId, result, fetchMoreForQueryId); _this.invalidate(queryId); _this.invalidate(fetchMoreForQueryId); _this.broadcastQueries(); } if (errorPolicy === 'none' && isNonEmptyArray(result.errors)) { return reject(new ApolloError({ graphQLErrors: result.errors, })); } if (errorPolicy === 'all') { errorsFromStore = result.errors; } if (fetchMoreForQueryId || fetchPolicy === 'no-cache') { resultFromStore = result.data; } else { var _a = _this.dataStore.getCache().diff({ variables: variables, query: document, optimistic: false, returnPartialData: true, }), result_1 = _a.result, complete = _a.complete; if (complete || options.returnPartialData) { resultFromStore = result_1; } } }).subscribe({ error: function (error) { cleanup(); reject(error); }, complete: function () { cleanup(); resolve({ data: resultFromStore, errors: errorsFromStore, loading: false, networkStatus: NetworkStatus.ready, stale: false, }); }, }); _this.setQuery(queryId, function (_a) { var subscriptions = _a.subscriptions; subscriptions.add(subscription); }); }); }; QueryManager.prototype.getQuery = function (queryId) { return (this.queries.get(queryId) || { listeners: new Set(), invalidated: false, document: null, newData: null, lastRequestId: 1, observableQuery: null, subscriptions: new Set(), }); }; QueryManager.prototype.setQuery = function (queryId, updater) { var prev = this.getQuery(queryId); var newInfo = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, prev, updater(prev)); this.queries.set(queryId, newInfo); }; QueryManager.prototype.invalidate = function (queryId, invalidated) { if (invalidated === void 0) { invalidated = true; } if (queryId) { this.setQuery(queryId, function () { return ({ invalidated: invalidated }); }); } }; QueryManager.prototype.prepareContext = function (context) { if (context === void 0) { context = {}; } var newContext = this.localState.prepareContext(context); return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, newContext, { clientAwareness: this.clientAwareness }); }; QueryManager.prototype.checkInFlight = function (queryId) { var query = this.queryStore.get(queryId); return (query && query.networkStatus !== NetworkStatus.ready && query.networkStatus !== NetworkStatus.error); }; QueryManager.prototype.startPollingQuery = function (options, queryId, listener) { var _this = this; var pollInterval = options.pollInterval; false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(pollInterval, 'Attempted to start a polling query without a polling interval.'); if (!this.ssrMode) { var info = this.pollingInfoByQueryId.get(queryId); if (!info) { this.pollingInfoByQueryId.set(queryId, (info = {})); } info.interval = pollInterval; info.options = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, options, { fetchPolicy: 'network-only' }); var maybeFetch_1 = function () { var info = _this.pollingInfoByQueryId.get(queryId); if (info) { if (_this.checkInFlight(queryId)) { poll_1(); } else { _this.fetchQuery(queryId, info.options, FetchType.poll).then(poll_1, poll_1); } } }; var poll_1 = function () { var info = _this.pollingInfoByQueryId.get(queryId); if (info) { clearTimeout(info.timeout); info.timeout = setTimeout(maybeFetch_1, info.interval); } }; if (listener) { this.addQueryListener(queryId, listener); } poll_1(); } return queryId; }; QueryManager.prototype.stopPollingQuery = function (queryId) { this.pollingInfoByQueryId.delete(queryId); }; return QueryManager; }()); var DataStore = (function () { function DataStore(initialCache) { this.cache = initialCache; } DataStore.prototype.getCache = function () { return this.cache; }; DataStore.prototype.markQueryResult = function (result, document, variables, fetchMoreForQueryId, ignoreErrors) { if (ignoreErrors === void 0) { ignoreErrors = false; } var writeWithErrors = !Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["graphQLResultHasError"])(result); if (ignoreErrors && Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["graphQLResultHasError"])(result) && result.data) { writeWithErrors = true; } if (!fetchMoreForQueryId && writeWithErrors) { this.cache.write({ result: result.data, dataId: 'ROOT_QUERY', query: document, variables: variables, }); } }; DataStore.prototype.markSubscriptionResult = function (result, document, variables) { if (!Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["graphQLResultHasError"])(result)) { this.cache.write({ result: result.data, dataId: 'ROOT_SUBSCRIPTION', query: document, variables: variables, }); } }; DataStore.prototype.markMutationInit = function (mutation) { var _this = this; if (mutation.optimisticResponse) { var optimistic_1; if (typeof mutation.optimisticResponse === 'function') { optimistic_1 = mutation.optimisticResponse(mutation.variables); } else { optimistic_1 = mutation.optimisticResponse; } this.cache.recordOptimisticTransaction(function (c) { var orig = _this.cache; _this.cache = c; try { _this.markMutationResult({ mutationId: mutation.mutationId, result: { data: optimistic_1 }, document: mutation.document, variables: mutation.variables, updateQueries: mutation.updateQueries, update: mutation.update, }); } finally { _this.cache = orig; } }, mutation.mutationId); } }; DataStore.prototype.markMutationResult = function (mutation) { var _this = this; if (!Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["graphQLResultHasError"])(mutation.result)) { var cacheWrites_1 = [{ result: mutation.result.data, dataId: 'ROOT_MUTATION', query: mutation.document, variables: mutation.variables, }]; var updateQueries_1 = mutation.updateQueries; if (updateQueries_1) { Object.keys(updateQueries_1).forEach(function (id) { var _a = updateQueries_1[id], query = _a.query, updater = _a.updater; var _b = _this.cache.diff({ query: query.document, variables: query.variables, returnPartialData: true, optimistic: false, }), currentQueryResult = _b.result, complete = _b.complete; if (complete) { var nextQueryResult = Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["tryFunctionOrLogError"])(function () { return updater(currentQueryResult, { mutationResult: mutation.result, queryName: Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["getOperationName"])(query.document) || undefined, queryVariables: query.variables, }); }); if (nextQueryResult) { cacheWrites_1.push({ result: nextQueryResult, dataId: 'ROOT_QUERY', query: query.document, variables: query.variables, }); } } }); } this.cache.performTransaction(function (c) { cacheWrites_1.forEach(function (write) { return c.write(write); }); var update = mutation.update; if (update) { Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_1__["tryFunctionOrLogError"])(function () { return update(c, mutation.result); }); } }); } }; DataStore.prototype.markMutationComplete = function (_a) { var mutationId = _a.mutationId, optimisticResponse = _a.optimisticResponse; if (optimisticResponse) { this.cache.removeOptimistic(mutationId); } }; DataStore.prototype.markUpdateQueryResult = function (document, variables, newResult) { this.cache.write({ result: newResult, dataId: 'ROOT_QUERY', variables: variables, query: document, }); }; DataStore.prototype.reset = function () { return this.cache.reset(); }; return DataStore; }()); var version = "2.6.3"; var hasSuggestedDevtools = false; var ApolloClient = (function () { function ApolloClient(options) { var _this = this; this.defaultOptions = {}; this.resetStoreCallbacks = []; this.clearStoreCallbacks = []; var cache = options.cache, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, connectToDevTools = options.connectToDevTools, _c = options.queryDeduplication, queryDeduplication = _c === void 0 ? true : _c, defaultOptions = options.defaultOptions, _d = options.assumeImmutableResults, assumeImmutableResults = _d === void 0 ? false : _d, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version; var link = options.link; if (!link && resolvers) { link = apollo_link__WEBPACK_IMPORTED_MODULE_2__["ApolloLink"].empty(); } if (!link || !cache) { throw false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_4__["InvariantError"]("In order to initialize Apollo Client, you must specify 'link' and 'cache' properties in the options object.\n" + "These options are part of the upgrade requirements when migrating from Apollo Client 1.x to Apollo Client 2.x.\n" + "For more information, please visit: https://www.apollographql.com/docs/tutorial/client.html#apollo-client-setup"); } this.link = link; this.cache = cache; this.store = new DataStore(cache); this.disableNetworkFetches = ssrMode || ssrForceFetchDelay > 0; this.queryDeduplication = queryDeduplication; this.defaultOptions = defaultOptions || {}; this.typeDefs = typeDefs; if (ssrForceFetchDelay) { setTimeout(function () { return (_this.disableNetworkFetches = false); }, ssrForceFetchDelay); } this.watchQuery = this.watchQuery.bind(this); this.query = this.query.bind(this); this.mutate = this.mutate.bind(this); this.resetStore = this.resetStore.bind(this); this.reFetchObservableQueries = this.reFetchObservableQueries.bind(this); var defaultConnectToDevTools = true && typeof window !== 'undefined' && !window.__APOLLO_CLIENT__; if (typeof connectToDevTools === 'undefined' ? defaultConnectToDevTools : connectToDevTools && typeof window !== 'undefined') { window.__APOLLO_CLIENT__ = this; } if (!hasSuggestedDevtools && "development" !== 'production') { hasSuggestedDevtools = true; if (typeof window !== 'undefined' && window.document && window.top === window.self) { if (typeof window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { if (window.navigator && window.navigator.userAgent && window.navigator.userAgent.indexOf('Chrome') > -1) { console.debug('Download the Apollo DevTools ' + 'for a better development experience: ' + 'https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm'); } } } } this.version = version; this.localState = new LocalState({ cache: cache, client: this, resolvers: resolvers, fragmentMatcher: fragmentMatcher, }); this.queryManager = new QueryManager({ link: this.link, store: this.store, queryDeduplication: queryDeduplication, ssrMode: ssrMode, clientAwareness: { name: clientAwarenessName, version: clientAwarenessVersion, }, localState: this.localState, assumeImmutableResults: assumeImmutableResults, onBroadcast: function () { if (_this.devToolsHookCb) { _this.devToolsHookCb({ action: {}, state: { queries: _this.queryManager.queryStore.getStore(), mutations: _this.queryManager.mutationStore.getStore(), }, dataWithOptimisticResults: _this.cache.extract(true), }); } }, }); } ApolloClient.prototype.stop = function () { this.queryManager.stop(); }; ApolloClient.prototype.watchQuery = function (options) { if (this.defaultOptions.watchQuery) { options = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this.defaultOptions.watchQuery, options); } if (this.disableNetworkFetches && (options.fetchPolicy === 'network-only' || options.fetchPolicy === 'cache-and-network')) { options = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, options, { fetchPolicy: 'cache-first' }); } return this.queryManager.watchQuery(options); }; ApolloClient.prototype.query = function (options) { if (this.defaultOptions.query) { options = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this.defaultOptions.query, options); } false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"])(options.fetchPolicy !== 'cache-and-network', 'The cache-and-network fetchPolicy does not work with client.query, because ' + 'client.query can only return a single result. Please use client.watchQuery ' + 'to receive multiple results from the cache and the network, or consider ' + 'using a different fetchPolicy, such as cache-first or network-only.'); if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') { options = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, options, { fetchPolicy: 'cache-first' }); } return this.queryManager.query(options); }; ApolloClient.prototype.mutate = function (options) { if (this.defaultOptions.mutate) { options = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this.defaultOptions.mutate, options); } return this.queryManager.mutate(options); }; ApolloClient.prototype.subscribe = function (options) { return this.queryManager.startGraphQLSubscription(options); }; ApolloClient.prototype.readQuery = function (options, optimistic) { if (optimistic === void 0) { optimistic = false; } return this.cache.readQuery(options, optimistic); }; ApolloClient.prototype.readFragment = function (options, optimistic) { if (optimistic === void 0) { optimistic = false; } return this.cache.readFragment(options, optimistic); }; ApolloClient.prototype.writeQuery = function (options) { var result = this.cache.writeQuery(options); this.queryManager.broadcastQueries(); return result; }; ApolloClient.prototype.writeFragment = function (options) { var result = this.cache.writeFragment(options); this.queryManager.broadcastQueries(); return result; }; ApolloClient.prototype.writeData = function (options) { var result = this.cache.writeData(options); this.queryManager.broadcastQueries(); return result; }; ApolloClient.prototype.__actionHookForDevTools = function (cb) { this.devToolsHookCb = cb; }; ApolloClient.prototype.__requestRaw = function (payload) { return Object(apollo_link__WEBPACK_IMPORTED_MODULE_2__["execute"])(this.link, payload); }; ApolloClient.prototype.initQueryManager = function () { false || ts_invariant__WEBPACK_IMPORTED_MODULE_4__["invariant"].warn('Calling the initQueryManager method is no longer necessary, ' + 'and it will be removed from ApolloClient in version 3.0.'); return this.queryManager; }; ApolloClient.prototype.resetStore = function () { var _this = this; return Promise.resolve() .then(function () { return _this.queryManager.clearStore(); }) .then(function () { return Promise.all(_this.resetStoreCallbacks.map(function (fn) { return fn(); })); }) .then(function () { return _this.reFetchObservableQueries(); }); }; ApolloClient.prototype.clearStore = function () { var _this = this; return Promise.resolve() .then(function () { return _this.queryManager.clearStore(); }) .then(function () { return Promise.all(_this.clearStoreCallbacks.map(function (fn) { return fn(); })); }); }; ApolloClient.prototype.onResetStore = function (cb) { var _this = this; this.resetStoreCallbacks.push(cb); return function () { _this.resetStoreCallbacks = _this.resetStoreCallbacks.filter(function (c) { return c !== cb; }); }; }; ApolloClient.prototype.onClearStore = function (cb) { var _this = this; this.clearStoreCallbacks.push(cb); return function () { _this.clearStoreCallbacks = _this.clearStoreCallbacks.filter(function (c) { return c !== cb; }); }; }; ApolloClient.prototype.reFetchObservableQueries = function (includeStandby) { return this.queryManager.reFetchObservableQueries(includeStandby); }; ApolloClient.prototype.extract = function (optimistic) { return this.cache.extract(optimistic); }; ApolloClient.prototype.restore = function (serializedState) { return this.cache.restore(serializedState); }; ApolloClient.prototype.addResolvers = function (resolvers) { this.localState.addResolvers(resolvers); }; ApolloClient.prototype.setResolvers = function (resolvers) { this.localState.setResolvers(resolvers); }; ApolloClient.prototype.getResolvers = function () { return this.localState.getResolvers(); }; ApolloClient.prototype.setLocalStateFragmentMatcher = function (fragmentMatcher) { this.localState.setFragmentMatcher(fragmentMatcher); }; return ApolloClient; }()); /* harmony default export */ __webpack_exports__["default"] = (ApolloClient); //# sourceMappingURL=bundle.esm.js.map /***/ }), /***/ "./node_modules/apollo-link-http-common/lib/bundle.esm.js": /*!****************************************************************!*\ !*** ./node_modules/apollo-link-http-common/lib/bundle.esm.js ***! \****************************************************************/ /*! exports provided: checkFetcher, createSignalIfSupported, fallbackHttpConfig, parseAndCheckHttpResponse, selectHttpOptionsAndBody, selectURI, serializeFetchParameter, throwServerError */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "checkFetcher", function() { return checkFetcher; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSignalIfSupported", function() { return createSignalIfSupported; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fallbackHttpConfig", function() { return fallbackHttpConfig; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseAndCheckHttpResponse", function() { return parseAndCheckHttpResponse; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectHttpOptionsAndBody", function() { return selectHttpOptionsAndBody; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectURI", function() { return selectURI; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "serializeFetchParameter", function() { return serializeFetchParameter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "throwServerError", function() { return throwServerError; }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var graphql_language_printer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphql/language/printer */ "./node_modules/graphql/language/printer.js"); /* harmony import */ var graphql_language_printer__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(graphql_language_printer__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); var defaultHttpOptions = { includeQuery: true, includeExtensions: false, }; var defaultHeaders = { accept: '*/*', 'content-type': 'application/json', }; var defaultOptions = { method: 'POST', }; var fallbackHttpConfig = { http: defaultHttpOptions, headers: defaultHeaders, options: defaultOptions, }; var throwServerError = function (response, result, message) { var error = new Error(message); error.name = 'ServerError'; error.response = response; error.statusCode = response.status; error.result = result; throw error; }; var parseAndCheckHttpResponse = function (operations) { return function (response) { return (response .text() .then(function (bodyText) { try { return JSON.parse(bodyText); } catch (err) { var parseError = err; parseError.name = 'ServerParseError'; parseError.response = response; parseError.statusCode = response.status; parseError.bodyText = bodyText; return Promise.reject(parseError); } }) .then(function (result) { if (response.status >= 300) { throwServerError(response, result, "Response not successful: Received status code " + response.status); } if (!Array.isArray(result) && !result.hasOwnProperty('data') && !result.hasOwnProperty('errors')) { throwServerError(response, result, "Server response was missing for query '" + (Array.isArray(operations) ? operations.map(function (op) { return op.operationName; }) : operations.operationName) + "'."); } return result; })); }; }; var checkFetcher = function (fetcher) { if (!fetcher && typeof fetch === 'undefined') { var library = 'unfetch'; if (typeof window === 'undefined') library = 'node-fetch'; throw false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_2__["InvariantError"]("\nfetch is not found globally and no fetcher passed, to fix pass a fetch for\nyour environment like https://www.npmjs.com/package/" + library + ".\n\nFor example:\nimport fetch from '" + library + "';\nimport { createHttpLink } from 'apollo-link-http';\n\nconst link = createHttpLink({ uri: '/graphql', fetch: fetch });"); } }; var createSignalIfSupported = function () { if (typeof AbortController === 'undefined') return { controller: false, signal: false }; var controller = new AbortController(); var signal = controller.signal; return { controller: controller, signal: signal }; }; var selectHttpOptionsAndBody = function (operation, fallbackConfig) { var configs = []; for (var _i = 2; _i < arguments.length; _i++) { configs[_i - 2] = arguments[_i]; } var options = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, fallbackConfig.options, { headers: fallbackConfig.headers, credentials: fallbackConfig.credentials }); var http = fallbackConfig.http; configs.forEach(function (config) { options = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, options, config.options, { headers: Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, options.headers, config.headers) }); if (config.credentials) options.credentials = config.credentials; http = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, http, config.http); }); var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query; var body = { operationName: operationName, variables: variables }; if (http.includeExtensions) body.extensions = extensions; if (http.includeQuery) body.query = Object(graphql_language_printer__WEBPACK_IMPORTED_MODULE_1__["print"])(query); return { options: options, body: body, }; }; var serializeFetchParameter = function (p, label) { var serialized; try { serialized = JSON.stringify(p); } catch (e) { var parseError = false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_2__["InvariantError"]("Network request failed. " + label + " is not serializable: " + e.message); parseError.parseError = e; throw parseError; } return serialized; }; var selectURI = function (operation, fallbackURI) { var context = operation.getContext(); var contextURI = context.uri; if (contextURI) { return contextURI; } else if (typeof fallbackURI === 'function') { return fallbackURI(operation); } else { return fallbackURI || '/graphql'; } }; //# sourceMappingURL=bundle.esm.js.map /***/ }), /***/ "./node_modules/apollo-link-http/lib/bundle.esm.js": /*!*********************************************************!*\ !*** ./node_modules/apollo-link-http/lib/bundle.esm.js ***! \*********************************************************/ /*! exports provided: HttpLink, createHttpLink */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpLink", function() { return HttpLink; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createHttpLink", function() { return createHttpLink; }); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var apollo_link__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! apollo-link */ "./node_modules/apollo-link/lib/bundle.esm.js"); /* harmony import */ var apollo_link_http_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! apollo-link-http-common */ "./node_modules/apollo-link-http-common/lib/bundle.esm.js"); var createHttpLink = function (linkOptions) { if (linkOptions === void 0) { linkOptions = {}; } var _a = linkOptions.uri, uri = _a === void 0 ? '/graphql' : _a, fetcher = linkOptions.fetch, includeExtensions = linkOptions.includeExtensions, useGETForQueries = linkOptions.useGETForQueries, requestOptions = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__rest"])(linkOptions, ["uri", "fetch", "includeExtensions", "useGETForQueries"]); Object(apollo_link_http_common__WEBPACK_IMPORTED_MODULE_2__["checkFetcher"])(fetcher); if (!fetcher) { fetcher = fetch; } var linkConfig = { http: { includeExtensions: includeExtensions }, options: requestOptions.fetchOptions, credentials: requestOptions.credentials, headers: requestOptions.headers, }; return new apollo_link__WEBPACK_IMPORTED_MODULE_1__["ApolloLink"](function (operation) { var chosenURI = Object(apollo_link_http_common__WEBPACK_IMPORTED_MODULE_2__["selectURI"])(operation, uri); var context = operation.getContext(); var clientAwarenessHeaders = {}; if (context.clientAwareness) { var _a = context.clientAwareness, name_1 = _a.name, version = _a.version; if (name_1) { clientAwarenessHeaders['apollographql-client-name'] = name_1; } if (version) { clientAwarenessHeaders['apollographql-client-version'] = version; } } var contextHeaders = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, clientAwarenessHeaders, context.headers); var contextConfig = { http: context.http, options: context.fetchOptions, credentials: context.credentials, headers: contextHeaders, }; var _b = Object(apollo_link_http_common__WEBPACK_IMPORTED_MODULE_2__["selectHttpOptionsAndBody"])(operation, apollo_link_http_common__WEBPACK_IMPORTED_MODULE_2__["fallbackHttpConfig"], linkConfig, contextConfig), options = _b.options, body = _b.body; var controller; if (!options.signal) { var _c = Object(apollo_link_http_common__WEBPACK_IMPORTED_MODULE_2__["createSignalIfSupported"])(), _controller = _c.controller, signal = _c.signal; controller = _controller; if (controller) options.signal = signal; } var definitionIsMutation = function (d) { return d.kind === 'OperationDefinition' && d.operation === 'mutation'; }; if (useGETForQueries && !operation.query.definitions.some(definitionIsMutation)) { options.method = 'GET'; } if (options.method === 'GET') { var _d = rewriteURIForGET(chosenURI, body), newURI = _d.newURI, parseError = _d.parseError; if (parseError) { return Object(apollo_link__WEBPACK_IMPORTED_MODULE_1__["fromError"])(parseError); } chosenURI = newURI; } else { try { options.body = Object(apollo_link_http_common__WEBPACK_IMPORTED_MODULE_2__["serializeFetchParameter"])(body, 'Payload'); } catch (parseError) { return Object(apollo_link__WEBPACK_IMPORTED_MODULE_1__["fromError"])(parseError); } } return new apollo_link__WEBPACK_IMPORTED_MODULE_1__["Observable"](function (observer) { fetcher(chosenURI, options) .then(function (response) { operation.setContext({ response: response }); return response; }) .then(Object(apollo_link_http_common__WEBPACK_IMPORTED_MODULE_2__["parseAndCheckHttpResponse"])(operation)) .then(function (result) { observer.next(result); observer.complete(); return result; }) .catch(function (err) { if (err.name === 'AbortError') return; if (err.result && err.result.errors && err.result.data) { observer.next(err.result); } observer.error(err); }); return function () { if (controller) controller.abort(); }; }); }); }; function rewriteURIForGET(chosenURI, body) { var queryParams = []; var addQueryParam = function (key, value) { queryParams.push(key + "=" + encodeURIComponent(value)); }; if ('query' in body) { addQueryParam('query', body.query); } if (body.operationName) { addQueryParam('operationName', body.operationName); } if (body.variables) { var serializedVariables = void 0; try { serializedVariables = Object(apollo_link_http_common__WEBPACK_IMPORTED_MODULE_2__["serializeFetchParameter"])(body.variables, 'Variables map'); } catch (parseError) { return { parseError: parseError }; } addQueryParam('variables', serializedVariables); } if (body.extensions) { var serializedExtensions = void 0; try { serializedExtensions = Object(apollo_link_http_common__WEBPACK_IMPORTED_MODULE_2__["serializeFetchParameter"])(body.extensions, 'Extensions map'); } catch (parseError) { return { parseError: parseError }; } addQueryParam('extensions', serializedExtensions); } var fragment = '', preFragment = chosenURI; var fragmentStart = chosenURI.indexOf('#'); if (fragmentStart !== -1) { fragment = chosenURI.substr(fragmentStart); preFragment = chosenURI.substr(0, fragmentStart); } var queryParamsPrefix = preFragment.indexOf('?') === -1 ? '?' : '&'; var newURI = preFragment + queryParamsPrefix + queryParams.join('&') + fragment; return { newURI: newURI }; } var HttpLink = (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(HttpLink, _super); function HttpLink(opts) { return _super.call(this, createHttpLink(opts).request) || this; } return HttpLink; }(apollo_link__WEBPACK_IMPORTED_MODULE_1__["ApolloLink"])); //# sourceMappingURL=bundle.esm.js.map /***/ }), /***/ "./node_modules/apollo-link/lib/bundle.esm.js": /*!****************************************************!*\ !*** ./node_modules/apollo-link/lib/bundle.esm.js ***! \****************************************************/ /*! exports provided: Observable, getOperationName, ApolloLink, concat, createOperation, empty, execute, from, fromError, fromPromise, makePromise, split, toPromise */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApolloLink", function() { return ApolloLink; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concat", function() { return concat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createOperation", function() { return createOperation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "empty", function() { return empty; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "execute", function() { return execute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "from", function() { return from; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromError", function() { return fromError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromPromise", function() { return fromPromise; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makePromise", function() { return makePromise; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "split", function() { return split; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toPromise", function() { return toPromise; }); /* harmony import */ var zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! zen-observable-ts */ "./node_modules/zen-observable-ts/lib/bundle.esm.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Observable", function() { return zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"]; }); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var apollo_utilities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! apollo-utilities */ "./node_modules/apollo-utilities/lib/bundle.esm.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getOperationName", function() { return apollo_utilities__WEBPACK_IMPORTED_MODULE_3__["getOperationName"]; }); function validateOperation(operation) { var OPERATION_FIELDS = [ 'query', 'operationName', 'variables', 'extensions', 'context', ]; for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) { var key = _a[_i]; if (OPERATION_FIELDS.indexOf(key) < 0) { throw false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_1__["InvariantError"]("illegal argument: " + key); } } return operation; } var LinkError = (function (_super) { Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(LinkError, _super); function LinkError(message, link) { var _this = _super.call(this, message) || this; _this.link = link; return _this; } return LinkError; }(Error)); function isTerminating(link) { return link.request.length <= 1; } function toPromise(observable) { var completed = false; return new Promise(function (resolve, reject) { observable.subscribe({ next: function (data) { if (completed) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_1__["invariant"].warn("Promise Wrapper does not support multiple results from Observable"); } else { completed = true; resolve(data); } }, error: reject, }); }); } var makePromise = toPromise; function fromPromise(promise) { return new zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"](function (observer) { promise .then(function (value) { observer.next(value); observer.complete(); }) .catch(observer.error.bind(observer)); }); } function fromError(errorValue) { return new zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"](function (observer) { observer.error(errorValue); }); } function transformOperation(operation) { var transformedOperation = { variables: operation.variables || {}, extensions: operation.extensions || {}, operationName: operation.operationName, query: operation.query, }; if (!transformedOperation.operationName) { transformedOperation.operationName = typeof transformedOperation.query !== 'string' ? Object(apollo_utilities__WEBPACK_IMPORTED_MODULE_3__["getOperationName"])(transformedOperation.query) : ''; } return transformedOperation; } function createOperation(starting, operation) { var context = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, starting); var setContext = function (next) { if (typeof next === 'function') { context = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, context, next(context)); } else { context = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, context, next); } }; var getContext = function () { return (Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, context)); }; Object.defineProperty(operation, 'setContext', { enumerable: false, value: setContext, }); Object.defineProperty(operation, 'getContext', { enumerable: false, value: getContext, }); Object.defineProperty(operation, 'toKey', { enumerable: false, value: function () { return getKey(operation); }, }); return operation; } function getKey(operation) { var query = operation.query, variables = operation.variables, operationName = operation.operationName; return JSON.stringify([operationName, query, variables]); } function passthrough(op, forward) { return forward ? forward(op) : zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"].of(); } function toLink(handler) { return typeof handler === 'function' ? new ApolloLink(handler) : handler; } function empty() { return new ApolloLink(function () { return zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"].of(); }); } function from(links) { if (links.length === 0) return empty(); return links.map(toLink).reduce(function (x, y) { return x.concat(y); }); } function split(test, left, right) { var leftLink = toLink(left); var rightLink = toLink(right || new ApolloLink(passthrough)); if (isTerminating(leftLink) && isTerminating(rightLink)) { return new ApolloLink(function (operation) { return test(operation) ? leftLink.request(operation) || zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"].of() : rightLink.request(operation) || zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"].of(); }); } else { return new ApolloLink(function (operation, forward) { return test(operation) ? leftLink.request(operation, forward) || zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"].of() : rightLink.request(operation, forward) || zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"].of(); }); } } var concat = function (first, second) { var firstLink = toLink(first); if (isTerminating(firstLink)) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_1__["invariant"].warn(new LinkError("You are calling concat on a terminating link, which will have no effect", firstLink)); return firstLink; } var nextLink = toLink(second); if (isTerminating(nextLink)) { return new ApolloLink(function (operation) { return firstLink.request(operation, function (op) { return nextLink.request(op) || zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"].of(); }) || zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"].of(); }); } else { return new ApolloLink(function (operation, forward) { return (firstLink.request(operation, function (op) { return nextLink.request(op, forward) || zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"].of(); }) || zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"].of()); }); } }; var ApolloLink = (function () { function ApolloLink(request) { if (request) this.request = request; } ApolloLink.prototype.split = function (test, left, right) { return this.concat(split(test, left, right || new ApolloLink(passthrough))); }; ApolloLink.prototype.concat = function (next) { return concat(this, next); }; ApolloLink.prototype.request = function (operation, forward) { throw false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_1__["InvariantError"]('request is not implemented'); }; ApolloLink.empty = empty; ApolloLink.from = from; ApolloLink.split = split; ApolloLink.execute = execute; return ApolloLink; }()); function execute(link, operation) { return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || zen_observable_ts__WEBPACK_IMPORTED_MODULE_0__["default"].of()); } //# sourceMappingURL=bundle.esm.js.map /***/ }), /***/ "./node_modules/apollo-utilities/lib/bundle.esm.js": /*!*********************************************************!*\ !*** ./node_modules/apollo-utilities/lib/bundle.esm.js ***! \*********************************************************/ /*! exports provided: isEqual, addTypenameToDocument, argumentsObjectFromField, assign, buildQueryFromSelectionSet, canUseWeakMap, checkDocument, cloneDeep, createFragmentMap, getDefaultValues, getDirectiveInfoFromField, getDirectiveNames, getDirectivesFromDocument, getEnv, getFragmentDefinition, getFragmentDefinitions, getFragmentQueryDocument, getInclusionDirectives, getMainDefinition, getMutationDefinition, getOperationDefinition, getOperationDefinitionOrDie, getOperationName, getQueryDefinition, getStoreKeyName, graphQLResultHasError, hasClientExports, hasDirectives, isDevelopment, isEnv, isField, isIdValue, isInlineFragment, isJsonValue, isNumberValue, isProduction, isScalarValue, isTest, maybeDeepFreeze, mergeDeep, mergeDeepArray, removeArgumentsFromDocument, removeClientSetsFromDocument, removeConnectionDirectiveFromDocument, removeDirectivesFromDocument, removeFragmentSpreadFromDocument, resultKeyNameFromField, shouldInclude, storeKeyNameFromField, stripSymbols, toIdValue, tryFunctionOrLogError, valueFromNode, valueToObjectRepresentation, variablesInOperation, warnOnceInDevelopment */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addTypenameToDocument", function() { return addTypenameToDocument; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "argumentsObjectFromField", function() { return argumentsObjectFromField; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assign", function() { return assign; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildQueryFromSelectionSet", function() { return buildQueryFromSelectionSet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "canUseWeakMap", function() { return canUseWeakMap; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "checkDocument", function() { return checkDocument; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloneDeep", function() { return cloneDeep; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFragmentMap", function() { return createFragmentMap; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDefaultValues", function() { return getDefaultValues; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDirectiveInfoFromField", function() { return getDirectiveInfoFromField; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDirectiveNames", function() { return getDirectiveNames; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDirectivesFromDocument", function() { return getDirectivesFromDocument; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getEnv", function() { return getEnv; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getFragmentDefinition", function() { return getFragmentDefinition; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getFragmentDefinitions", function() { return getFragmentDefinitions; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getFragmentQueryDocument", function() { return getFragmentQueryDocument; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getInclusionDirectives", function() { return getInclusionDirectives; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMainDefinition", function() { return getMainDefinition; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMutationDefinition", function() { return getMutationDefinition; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getOperationDefinition", function() { return getOperationDefinition; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getOperationDefinitionOrDie", function() { return getOperationDefinitionOrDie; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getOperationName", function() { return getOperationName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getQueryDefinition", function() { return getQueryDefinition; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getStoreKeyName", function() { return getStoreKeyName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "graphQLResultHasError", function() { return graphQLResultHasError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasClientExports", function() { return hasClientExports; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasDirectives", function() { return hasDirectives; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isDevelopment", function() { return isDevelopment; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isEnv", function() { return isEnv; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isField", function() { return isField; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isIdValue", function() { return isIdValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isInlineFragment", function() { return isInlineFragment; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isJsonValue", function() { return isJsonValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNumberValue", function() { return isNumberValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isProduction", function() { return isProduction; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isScalarValue", function() { return isScalarValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isTest", function() { return isTest; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "maybeDeepFreeze", function() { return maybeDeepFreeze; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeDeep", function() { return mergeDeep; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeDeepArray", function() { return mergeDeepArray; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeArgumentsFromDocument", function() { return removeArgumentsFromDocument; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeClientSetsFromDocument", function() { return removeClientSetsFromDocument; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeConnectionDirectiveFromDocument", function() { return removeConnectionDirectiveFromDocument; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeDirectivesFromDocument", function() { return removeDirectivesFromDocument; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeFragmentSpreadFromDocument", function() { return removeFragmentSpreadFromDocument; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resultKeyNameFromField", function() { return resultKeyNameFromField; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shouldInclude", function() { return shouldInclude; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "storeKeyNameFromField", function() { return storeKeyNameFromField; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stripSymbols", function() { return stripSymbols; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toIdValue", function() { return toIdValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tryFunctionOrLogError", function() { return tryFunctionOrLogError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "valueFromNode", function() { return valueFromNode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "valueToObjectRepresentation", function() { return valueToObjectRepresentation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "variablesInOperation", function() { return variablesInOperation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "warnOnceInDevelopment", function() { return warnOnceInDevelopment; }); /* harmony import */ var graphql_language_visitor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphql/language/visitor */ "./node_modules/graphql/language/visitor.js"); /* harmony import */ var graphql_language_visitor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphql_language_visitor__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var ts_invariant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ts-invariant */ "./node_modules/ts-invariant/lib/invariant.esm.js"); /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); /* harmony import */ var fast_json_stable_stringify__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! fast-json-stable-stringify */ "./node_modules/fast-json-stable-stringify/index.js"); /* harmony import */ var fast_json_stable_stringify__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(fast_json_stable_stringify__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _wry_equality__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wry/equality */ "./node_modules/@wry/equality/lib/equality.esm.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isEqual", function() { return _wry_equality__WEBPACK_IMPORTED_MODULE_4__["equal"]; }); function isScalarValue(value) { return ['StringValue', 'BooleanValue', 'EnumValue'].indexOf(value.kind) > -1; } function isNumberValue(value) { return ['IntValue', 'FloatValue'].indexOf(value.kind) > -1; } function isStringValue(value) { return value.kind === 'StringValue'; } function isBooleanValue(value) { return value.kind === 'BooleanValue'; } function isIntValue(value) { return value.kind === 'IntValue'; } function isFloatValue(value) { return value.kind === 'FloatValue'; } function isVariable(value) { return value.kind === 'Variable'; } function isObjectValue(value) { return value.kind === 'ObjectValue'; } function isListValue(value) { return value.kind === 'ListValue'; } function isEnumValue(value) { return value.kind === 'EnumValue'; } function isNullValue(value) { return value.kind === 'NullValue'; } function valueToObjectRepresentation(argObj, name, value, variables) { if (isIntValue(value) || isFloatValue(value)) { argObj[name.value] = Number(value.value); } else if (isBooleanValue(value) || isStringValue(value)) { argObj[name.value] = value.value; } else if (isObjectValue(value)) { var nestedArgObj_1 = {}; value.fields.map(function (obj) { return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables); }); argObj[name.value] = nestedArgObj_1; } else if (isVariable(value)) { var variableValue = (variables || {})[value.name.value]; argObj[name.value] = variableValue; } else if (isListValue(value)) { argObj[name.value] = value.values.map(function (listValue) { var nestedArgArrayObj = {}; valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables); return nestedArgArrayObj[name.value]; }); } else if (isEnumValue(value)) { argObj[name.value] = value.value; } else if (isNullValue(value)) { argObj[name.value] = null; } else { throw false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_1__["InvariantError"]("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" + 'is not supported. Use variables instead of inline arguments to ' + 'overcome this limitation.'); } } function storeKeyNameFromField(field, variables) { var directivesObj = null; if (field.directives) { directivesObj = {}; field.directives.forEach(function (directive) { directivesObj[directive.name.value] = {}; if (directive.arguments) { directive.arguments.forEach(function (_a) { var name = _a.name, value = _a.value; return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables); }); } }); } var argObj = null; if (field.arguments && field.arguments.length) { argObj = {}; field.arguments.forEach(function (_a) { var name = _a.name, value = _a.value; return valueToObjectRepresentation(argObj, name, value, variables); }); } return getStoreKeyName(field.name.value, argObj, directivesObj); } var KNOWN_DIRECTIVES = [ 'connection', 'include', 'skip', 'client', 'rest', 'export', ]; function getStoreKeyName(fieldName, args, directives) { if (directives && directives['connection'] && directives['connection']['key']) { if (directives['connection']['filter'] && directives['connection']['filter'].length > 0) { var filterKeys = directives['connection']['filter'] ? directives['connection']['filter'] : []; filterKeys.sort(); var queryArgs_1 = args; var filteredArgs_1 = {}; filterKeys.forEach(function (key) { filteredArgs_1[key] = queryArgs_1[key]; }); return directives['connection']['key'] + "(" + JSON.stringify(filteredArgs_1) + ")"; } else { return directives['connection']['key']; } } var completeFieldName = fieldName; if (args) { var stringifiedArgs = fast_json_stable_stringify__WEBPACK_IMPORTED_MODULE_3___default()(args); completeFieldName += "(" + stringifiedArgs + ")"; } if (directives) { Object.keys(directives).forEach(function (key) { if (KNOWN_DIRECTIVES.indexOf(key) !== -1) return; if (directives[key] && Object.keys(directives[key]).length) { completeFieldName += "@" + key + "(" + JSON.stringify(directives[key]) + ")"; } else { completeFieldName += "@" + key; } }); } return completeFieldName; } function argumentsObjectFromField(field, variables) { if (field.arguments && field.arguments.length) { var argObj_1 = {}; field.arguments.forEach(function (_a) { var name = _a.name, value = _a.value; return valueToObjectRepresentation(argObj_1, name, value, variables); }); return argObj_1; } return null; } function resultKeyNameFromField(field) { return field.alias ? field.alias.value : field.name.value; } function isField(selection) { return selection.kind === 'Field'; } function isInlineFragment(selection) { return selection.kind === 'InlineFragment'; } function isIdValue(idObject) { return idObject && idObject.type === 'id' && typeof idObject.generated === 'boolean'; } function toIdValue(idConfig, generated) { if (generated === void 0) { generated = false; } return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({ type: 'id', generated: generated }, (typeof idConfig === 'string' ? { id: idConfig, typename: undefined } : idConfig)); } function isJsonValue(jsonObject) { return (jsonObject != null && typeof jsonObject === 'object' && jsonObject.type === 'json'); } function defaultValueFromVariable(node) { throw false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_1__["InvariantError"]("Variable nodes are not supported by valueFromNode"); } function valueFromNode(node, onVariable) { if (onVariable === void 0) { onVariable = defaultValueFromVariable; } switch (node.kind) { case 'Variable': return onVariable(node); case 'NullValue': return null; case 'IntValue': return parseInt(node.value, 10); case 'FloatValue': return parseFloat(node.value); case 'ListValue': return node.values.map(function (v) { return valueFromNode(v, onVariable); }); case 'ObjectValue': { var value = {}; for (var _i = 0, _a = node.fields; _i < _a.length; _i++) { var field = _a[_i]; value[field.name.value] = valueFromNode(field.value, onVariable); } return value; } default: return node.value; } } function getDirectiveInfoFromField(field, variables) { if (field.directives && field.directives.length) { var directiveObj_1 = {}; field.directives.forEach(function (directive) { directiveObj_1[directive.name.value] = argumentsObjectFromField(directive, variables); }); return directiveObj_1; } return null; } function shouldInclude(selection, variables) { if (variables === void 0) { variables = {}; } return getInclusionDirectives(selection.directives).every(function (_a) { var directive = _a.directive, ifArgument = _a.ifArgument; var evaledValue = false; if (ifArgument.value.kind === 'Variable') { evaledValue = variables[ifArgument.value.name.value]; false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_1__["invariant"])(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive."); } else { evaledValue = ifArgument.value.value; } return directive.name.value === 'skip' ? !evaledValue : evaledValue; }); } function getDirectiveNames(doc) { var names = []; Object(graphql_language_visitor__WEBPACK_IMPORTED_MODULE_0__["visit"])(doc, { Directive: function (node) { names.push(node.name.value); }, }); return names; } function hasDirectives(names, doc) { return getDirectiveNames(doc).some(function (name) { return names.indexOf(name) > -1; }); } function hasClientExports(document) { return (document && hasDirectives(['client'], document) && hasDirectives(['export'], document)); } function isInclusionDirective(_a) { var value = _a.name.value; return value === 'skip' || value === 'include'; } function getInclusionDirectives(directives) { return directives ? directives.filter(isInclusionDirective).map(function (directive) { var directiveArguments = directive.arguments; var directiveName = directive.name.value; false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_1__["invariant"])(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive."); var ifArgument = directiveArguments[0]; false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_1__["invariant"])(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive."); var ifValue = ifArgument.value; false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_1__["invariant"])(ifValue && (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value."); return { directive: directive, ifArgument: ifArgument }; }) : []; } function getFragmentQueryDocument(document, fragmentName) { var actualFragmentName = fragmentName; var fragments = []; document.definitions.forEach(function (definition) { if (definition.kind === 'OperationDefinition') { throw false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_1__["InvariantError"]("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " + 'No operations are allowed when using a fragment as a query. Only fragments are allowed.'); } if (definition.kind === 'FragmentDefinition') { fragments.push(definition); } }); if (typeof actualFragmentName === 'undefined') { false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_1__["invariant"])(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment."); actualFragmentName = fragments[0].name.value; } var query = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, document, { definitions: [ { kind: 'OperationDefinition', operation: 'query', selectionSet: { kind: 'SelectionSet', selections: [ { kind: 'FragmentSpread', name: { kind: 'Name', value: actualFragmentName, }, }, ], }, } ].concat(document.definitions) }); return query; } function assign(target) { var sources = []; for (var _i = 1; _i < arguments.length; _i++) { sources[_i - 1] = arguments[_i]; } sources.forEach(function (source) { if (typeof source === 'undefined' || source === null) { return; } Object.keys(source).forEach(function (key) { target[key] = source[key]; }); }); return target; } function getMutationDefinition(doc) { checkDocument(doc); var mutationDef = doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition' && definition.operation === 'mutation'; })[0]; false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_1__["invariant"])(mutationDef, 'Must contain a mutation definition.'); return mutationDef; } function checkDocument(doc) { false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_1__["invariant"])(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); var operations = doc.definitions .filter(function (d) { return d.kind !== 'FragmentDefinition'; }) .map(function (definition) { if (definition.kind !== 'OperationDefinition') { throw false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_1__["InvariantError"]("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\""); } return definition; }); false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_1__["invariant"])(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations"); return doc; } function getOperationDefinition(doc) { checkDocument(doc); return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0]; } function getOperationDefinitionOrDie(document) { var def = getOperationDefinition(document); false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_1__["invariant"])(def, "GraphQL document is missing an operation"); return def; } function getOperationName(doc) { return (doc.definitions .filter(function (definition) { return definition.kind === 'OperationDefinition' && definition.name; }) .map(function (x) { return x.name.value; })[0] || null); } function getFragmentDefinitions(doc) { return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; }); } function getQueryDefinition(doc) { var queryDef = getOperationDefinition(doc); false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_1__["invariant"])(queryDef && queryDef.operation === 'query', 'Must contain a query definition.'); return queryDef; } function getFragmentDefinition(doc) { false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_1__["invariant"])(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"); false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_1__["invariant"])(doc.definitions.length <= 1, 'Fragment must have exactly one definition.'); var fragmentDef = doc.definitions[0]; false ? undefined : Object(ts_invariant__WEBPACK_IMPORTED_MODULE_1__["invariant"])(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.'); return fragmentDef; } function getMainDefinition(queryDoc) { checkDocument(queryDoc); var fragmentDefinition; for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) { var definition = _a[_i]; if (definition.kind === 'OperationDefinition') { var operation = definition.operation; if (operation === 'query' || operation === 'mutation' || operation === 'subscription') { return definition; } } if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) { fragmentDefinition = definition; } } if (fragmentDefinition) { return fragmentDefinition; } throw false ? undefined : new ts_invariant__WEBPACK_IMPORTED_MODULE_1__["InvariantError"]('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.'); } function createFragmentMap(fragments) { if (fragments === void 0) { fragments = []; } var symTable = {}; fragments.forEach(function (fragment) { symTable[fragment.name.value] = fragment; }); return symTable; } function getDefaultValues(definition) { if (definition && definition.variableDefinitions && definition.variableDefinitions.length) { var defaultValues = definition.variableDefinitions .filter(function (_a) { var defaultValue = _a.defaultValue; return defaultValue; }) .map(function (_a) { var variable = _a.variable, defaultValue = _a.defaultValue; var defaultValueObj = {}; valueToObjectRepresentation(defaultValueObj, variable.name, defaultValue); return defaultValueObj; }); return assign.apply(void 0, [{}].concat(defaultValues)); } return {}; } function variablesInOperation(operation) { var names = new Set(); if (operation.variableDefinitions) { for (var _i = 0, _a = operation.variableDefinitions; _i < _a.length; _i++) { var definition = _a[_i]; names.add(definition.variable.name.value); } } return names; } function filterInPlace(array, test, context) { var target = 0; array.forEach(function (elem, i) { if (test.call(this, elem, i, array)) { array[target++] = elem; } }, context); array.length = target; return array; } var TYPENAME_FIELD = { kind: 'Field', name: { kind: 'Name', value: '__typename', }, }; function isEmpty(op, fragments) { return op.selectionSet.selections.every(function (selection) { return selection.kind === 'FragmentSpread' && isEmpty(fragments[selection.name.value], fragments); }); } function nullIfDocIsEmpty(doc) { return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc))) ? null : doc; } function getDirectiveMatcher(directives) { return function directiveMatcher(directive) { return directives.some(function (dir) { return (dir.name && dir.name === directive.name.value) || (dir.test && dir.test(directive)); }); }; } function removeDirectivesFromDocument(directives, doc) { var variablesInUse = Object.create(null); var variablesToRemove = []; var fragmentSpreadsInUse = Object.create(null); var fragmentSpreadsToRemove = []; var modifiedDoc = nullIfDocIsEmpty(Object(graphql_language_visitor__WEBPACK_IMPORTED_MODULE_0__["visit"])(doc, { Variable: { enter: function (node, _key, parent) { if (parent.kind !== 'VariableDefinition') { variablesInUse[node.name.value] = true; } }, }, Field: { enter: function (node) { if (directives && node.directives) { var shouldRemoveField = directives.some(function (directive) { return directive.remove; }); if (shouldRemoveField && node.directives && node.directives.some(getDirectiveMatcher(directives))) { if (node.arguments) { node.arguments.forEach(function (arg) { if (arg.value.kind === 'Variable') { variablesToRemove.push({ name: arg.value.name.value, }); } }); } if (node.selectionSet) { getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) { fragmentSpreadsToRemove.push({ name: frag.name.value, }); }); } return null; } } }, }, FragmentSpread: { enter: function (node) { fragmentSpreadsInUse[node.name.value] = true; }, }, Directive: { enter: function (node) { if (getDirectiveMatcher(directives)(node)) { return null; } }, }, })); if (modifiedDoc && filterInPlace(variablesToRemove, function (v) { return !variablesInUse[v.name]; }).length) { modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc); } if (modifiedDoc && filterInPlace(fragmentSpreadsToRemove, function (fs) { return !fragmentSpreadsInUse[fs.name]; }) .length) { modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc); } return modifiedDoc; } function addTypenameToDocument(doc) { return Object(graphql_language_visitor__WEBPACK_IMPORTED_MODULE_0__["visit"])(checkDocument(doc), { SelectionSet: { enter: function (node, _key, parent) { if (parent && parent.kind === 'OperationDefinition') { return; } var selections = node.selections; if (!selections) { return; } var skip = selections.some(function (selection) { return (isField(selection) && (selection.name.value === '__typename' || selection.name.value.lastIndexOf('__', 0) === 0)); }); if (skip) { return; } var field = parent; if (isField(field) && field.directives && field.directives.some(function (d) { return d.name.value === 'export'; })) { return; } return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, node, { selections: selections.concat([TYPENAME_FIELD]) }); }, }, }); } var connectionRemoveConfig = { test: function (directive) { var willRemove = directive.name.value === 'connection'; if (willRemove) { if (!directive.arguments || !directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) { false || ts_invariant__WEBPACK_IMPORTED_MODULE_1__["invariant"].warn('Removing an @connection directive even though it does not have a key. ' + 'You may want to use the key parameter to specify a store key.'); } } return willRemove; }, }; function removeConnectionDirectiveFromDocument(doc) { return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc)); } function hasDirectivesInSelectionSet(directives, selectionSet, nestedCheck) { if (nestedCheck === void 0) { nestedCheck = true; } return (selectionSet && selectionSet.selections && selectionSet.selections.some(function (selection) { return hasDirectivesInSelection(directives, selection, nestedCheck); })); } function hasDirectivesInSelection(directives, selection, nestedCheck) { if (nestedCheck === void 0) { nestedCheck = true; } if (!isField(selection)) { return true; } if (!selection.directives) { return false; } return (selection.directives.some(getDirectiveMatcher(directives)) || (nestedCheck && hasDirectivesInSelectionSet(directives, selection.selectionSet, nestedCheck))); } function getDirectivesFromDocument(directives, doc) { checkDocument(doc); var parentPath; return nullIfDocIsEmpty(Object(graphql_language_visitor__WEBPACK_IMPORTED_MODULE_0__["visit"])(doc, { SelectionSet: { enter: function (node, _key, _parent, path) { var currentPath = path.join('-'); if (!parentPath || currentPath === parentPath || !currentPath.startsWith(parentPath)) { if (node.selections) { var selectionsWithDirectives = node.selections.filter(function (selection) { return hasDirectivesInSelection(directives, selection); }); if (hasDirectivesInSelectionSet(directives, node, false)) { parentPath = currentPath; } return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, node, { selections: selectionsWithDirectives }); } else { return null; } } }, }, })); } function getArgumentMatcher(config) { return function argumentMatcher(argument) { return config.some(function (aConfig) { return argument.value && argument.value.kind === 'Variable' && argument.value.name && (aConfig.name === argument.value.name.value || (aConfig.test && aConfig.test(argument))); }); }; } function removeArgumentsFromDocument(config, doc) { var argMatcher = getArgumentMatcher(config); return nullIfDocIsEmpty(Object(graphql_language_visitor__WEBPACK_IMPORTED_MODULE_0__["visit"])(doc, { OperationDefinition: { enter: function (node) { return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, node, { variableDefinitions: node.variableDefinitions.filter(function (varDef) { return !config.some(function (arg) { return arg.name === varDef.variable.name.value; }); }) }); }, }, Field: { enter: function (node) { var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; }); if (shouldRemoveField) { var argMatchCount_1 = 0; node.arguments.forEach(function (arg) { if (argMatcher(arg)) { argMatchCount_1 += 1; } }); if (argMatchCount_1 === 1) { return null; } } }, }, Argument: { enter: function (node) { if (argMatcher(node)) { return null; } }, }, })); } function removeFragmentSpreadFromDocument(config, doc) { function enter(node) { if (config.some(function (def) { return def.name === node.name.value; })) { return null; } } return nullIfDocIsEmpty(Object(graphql_language_visitor__WEBPACK_IMPORTED_MODULE_0__["visit"])(doc, { FragmentSpread: { enter: enter }, FragmentDefinition: { enter: enter }, })); } function getAllFragmentSpreadsFromSelectionSet(selectionSet) { var allFragments = []; selectionSet.selections.forEach(function (selection) { if ((isField(selection) || isInlineFragment(selection)) && selection.selectionSet) { getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); }); } else if (selection.kind === 'FragmentSpread') { allFragments.push(selection); } }); return allFragments; } function buildQueryFromSelectionSet(document) { var definition = getMainDefinition(document); var definitionOperation = definition.operation; if (definitionOperation === 'query') { return document; } var modifiedDoc = Object(graphql_language_visitor__WEBPACK_IMPORTED_MODULE_0__["visit"])(document, { OperationDefinition: { enter: function (node) { return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, node, { operation: 'query' }); }, }, }); return modifiedDoc; } function removeClientSetsFromDocument(document) { checkDocument(document); var modifiedDoc = removeDirectivesFromDocument([ { test: function (directive) { return directive.name.value === 'client'; }, remove: true, }, ], document); if (modifiedDoc) { modifiedDoc = Object(graphql_language_visitor__WEBPACK_IMPORTED_MODULE_0__["visit"])(modifiedDoc, { FragmentDefinition: { enter: function (node) { if (node.selectionSet) { var isTypenameOnly = node.selectionSet.selections.every(function (selection) { return isField(selection) && selection.name.value === '__typename'; }); if (isTypenameOnly) { return null; } } }, }, }); } return modifiedDoc; } var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' && navigator.product === 'ReactNative'); var toString = Object.prototype.toString; function cloneDeep(value) { return cloneDeepHelper(value, new Map()); } function cloneDeepHelper(val, seen) { switch (toString.call(val)) { case "[object Array]": { if (seen.has(val)) return seen.get(val); var copy_1 = val.slice(0); seen.set(val, copy_1); copy_1.forEach(function (child, i) { copy_1[i] = cloneDeepHelper(child, seen); }); return copy_1; } case "[object Object]": { if (seen.has(val)) return seen.get(val); var copy_2 = Object.create(Object.getPrototypeOf(val)); seen.set(val, copy_2); Object.keys(val).forEach(function (key) { copy_2[key] = cloneDeepHelper(val[key], seen); }); return copy_2; } default: return val; } } function getEnv() { if (typeof process !== 'undefined' && "development") { return "development"; } return 'development'; } function isEnv(env) { return getEnv() === env; } function isProduction() { return isEnv('production') === true; } function isDevelopment() { return isEnv('development') === true; } function isTest() { return isEnv('test') === true; } function tryFunctionOrLogError(f) { try { return f(); } catch (e) { if (console.error) { console.error(e); } } } function graphQLResultHasError(result) { return result.errors && result.errors.length; } function deepFreeze(o) { Object.freeze(o); Object.getOwnPropertyNames(o).forEach(function (prop) { if (o[prop] !== null && (typeof o[prop] === 'object' || typeof o[prop] === 'function') && !Object.isFrozen(o[prop])) { deepFreeze(o[prop]); } }); return o; } function maybeDeepFreeze(obj) { if (isDevelopment() || isTest()) { var symbolIsPolyfilled = typeof Symbol === 'function' && typeof Symbol('') === 'string'; if (!symbolIsPolyfilled) { return deepFreeze(obj); } } return obj; } var hasOwnProperty = Object.prototype.hasOwnProperty; function mergeDeep() { var sources = []; for (var _i = 0; _i < arguments.length; _i++) { sources[_i] = arguments[_i]; } return mergeDeepArray(sources); } function mergeDeepArray(sources) { var target = sources[0] || {}; var count = sources.length; if (count > 1) { var pastCopies = []; target = shallowCopyForMerge(target, pastCopies); for (var i = 1; i < count; ++i) { target = mergeHelper(target, sources[i], pastCopies); } } return target; } function isObject(obj) { return obj !== null && typeof obj === 'object'; } function mergeHelper(target, source, pastCopies) { if (isObject(source) && isObject(target)) { if (Object.isExtensible && !Object.isExtensible(target)) { target = shallowCopyForMerge(target, pastCopies); } Object.keys(source).forEach(function (sourceKey) { var sourceValue = source[sourceKey]; if (hasOwnProperty.call(target, sourceKey)) { var targetValue = target[sourceKey]; if (sourceValue !== targetValue) { target[sourceKey] = mergeHelper(shallowCopyForMerge(targetValue, pastCopies), sourceValue, pastCopies); } } else { target[sourceKey] = sourceValue; } }); return target; } return source; } function shallowCopyForMerge(value, pastCopies) { if (value !== null && typeof value === 'object' && pastCopies.indexOf(value) < 0) { if (Array.isArray(value)) { value = value.slice(0); } else { value = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({ __proto__: Object.getPrototypeOf(value) }, value); } pastCopies.push(value); } return value; } var haveWarned = Object.create({}); function warnOnceInDevelopment(msg, type) { if (type === void 0) { type = 'warn'; } if (!isProduction() && !haveWarned[msg]) { if (!isTest()) { haveWarned[msg] = true; } if (type === 'error') { console.error(msg); } else { console.warn(msg); } } } function stripSymbols(data) { return JSON.parse(JSON.stringify(data)); } //# sourceMappingURL=bundle.esm.js.map /***/ }), /***/ "./node_modules/attr-accept/dist/index.js": /*!************************************************!*\ !*** ./node_modules/attr-accept/dist/index.js ***! \************************************************/ /*! no static exports found */ /***/ (function(module, exports) { module.exports=function(t){function n(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r={};return n.m=t,n.c=r,n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:e})},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,"a",r),r},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=13)}([function(t,n){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n){var r=t.exports={version:"2.5.0"};"number"==typeof __e&&(__e=r)},function(t,n,r){t.exports=!r(4)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,n,r){var e=r(32)("wks"),o=r(9),i=r(0).Symbol,u="function"==typeof i;(t.exports=function(t){return e[t]||(e[t]=u&&i[t]||(u?i:o)("Symbol."+t))}).store=e},function(t,n,r){var e=r(0),o=r(2),i=r(8),u=r(22),c=r(10),f=function(t,n,r){var a,s,p,l,v=t&f.F,y=t&f.G,h=t&f.S,d=t&f.P,x=t&f.B,g=y?e:h?e[n]||(e[n]={}):(e[n]||{}).prototype,m=y?o:o[n]||(o[n]={}),b=m.prototype||(m.prototype={});y&&(r=n);for(a in r)s=!v&&g&&void 0!==g[a],p=(s?g:r)[a],l=x&&s?c(p,e):d&&"function"==typeof p?c(Function.call,p):p,g&&u(g,a,p,t&f.U),m[a]!=p&&i(m,a,l),d&&b[a]!=p&&(b[a]=p)};e.core=o,f.F=1,f.G=2,f.S=4,f.P=8,f.B=16,f.W=32,f.U=64,f.R=128,t.exports=f},function(t,n,r){var e=r(16),o=r(21);t.exports=r(3)?function(t,n,r){return e.f(t,n,o(1,r))}:function(t,n,r){return t[n]=r,t}},function(t,n){var r=0,e=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+e).toString(36))}},function(t,n,r){var e=r(24);t.exports=function(t,n,r){if(e(t),void 0===n)return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,o){return t.call(n,r,e,o)}}return function(){return t.apply(n,arguments)}}},function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,n,r){var e=r(28),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},function(t,n,r){"use strict";n.__esModule=!0,n.default=function(t,n){if(t&&n){var r=Array.isArray(n)?n:n.split(","),e=t.name||"",o=t.type||"",i=o.replace(/\/.*$/,"");return r.some(function(t){var n=t.trim();return"."===n.charAt(0)?e.toLowerCase().endsWith(n.toLowerCase()):n.endsWith("/*")?i===n.replace(/\/.*$/,""):o===n})}return!0},r(14),r(34)},function(t,n,r){r(15),t.exports=r(2).Array.some},function(t,n,r){"use strict";var e=r(7),o=r(25)(3);e(e.P+e.F*!r(33)([].some,!0),"Array",{some:function(t){return o(this,t,arguments[1])}})},function(t,n,r){var e=r(17),o=r(18),i=r(20),u=Object.defineProperty;n.f=r(3)?Object.defineProperty:function(t,n,r){if(e(t),n=i(n,!0),e(r),o)try{return u(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[n]=r.value),t}},function(t,n,r){var e=r(1);t.exports=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t}},function(t,n,r){t.exports=!r(3)&&!r(4)(function(){return 7!=Object.defineProperty(r(19)("div"),"a",{get:function(){return 7}}).a})},function(t,n,r){var e=r(1),o=r(0).document,i=e(o)&&e(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,n,r){var e=r(1);t.exports=function(t,n){if(!e(t))return t;var r,o;if(n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!e(o=r.call(t)))return o;if(!n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n,r){var e=r(0),o=r(8),i=r(23),u=r(9)("src"),c=Function.toString,f=(""+c).split("toString");r(2).inspectSource=function(t){return c.call(t)},(t.exports=function(t,n,r,c){var a="function"==typeof r;a&&(i(r,"name")||o(r,"name",n)),t[n]!==r&&(a&&(i(r,u)||o(r,u,t[n]?""+t[n]:f.join(String(n)))),t===e?t[n]=r:c?t[n]?t[n]=r:o(t,n,r):(delete t[n],o(t,n,r)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[u]||c.call(this)})},function(t,n){var r={}.hasOwnProperty;t.exports=function(t,n){return r.call(t,n)}},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n,r){var e=r(10),o=r(26),i=r(27),u=r(12),c=r(29);t.exports=function(t,n){var r=1==t,f=2==t,a=3==t,s=4==t,p=6==t,l=5==t||p,v=n||c;return function(n,c,y){for(var h,d,x=i(n),g=o(x),m=e(c,y,3),b=u(g.length),_=0,w=r?v(n,b):f?v(n,0):void 0;b>_;_++)if((l||_ in g)&&(h=g[_],d=m(h,_,x),t))if(r)w[_]=d;else if(d)switch(t){case 3:return!0;case 5:return h;case 6:return _;case 2:w.push(h)}else if(s)return!1;return p?-1:a||s?s:w}}},function(t,n,r){var e=r(5);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==e(t)?t.split(""):Object(t)}},function(t,n,r){var e=r(11);t.exports=function(t){return Object(e(t))}},function(t,n){var r=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?e:r)(t)}},function(t,n,r){var e=r(30);t.exports=function(t,n){return new(e(t))(n)}},function(t,n,r){var e=r(1),o=r(31),i=r(6)("species");t.exports=function(t){var n;return o(t)&&(n=t.constructor,"function"!=typeof n||n!==Array&&!o(n.prototype)||(n=void 0),e(n)&&null===(n=n[i])&&(n=void 0)),void 0===n?Array:n}},function(t,n,r){var e=r(5);t.exports=Array.isArray||function(t){return"Array"==e(t)}},function(t,n,r){var e=r(0),o=e["__core-js_shared__"]||(e["__core-js_shared__"]={});t.exports=function(t){return o[t]||(o[t]={})}},function(t,n,r){"use strict";var e=r(4);t.exports=function(t,n){return!!t&&e(function(){n?t.call(null,function(){},1):t.call(null)})}},function(t,n,r){r(35),t.exports=r(2).String.endsWith},function(t,n,r){"use strict";var e=r(7),o=r(12),i=r(36),u="".endsWith;e(e.P+e.F*r(38)("endsWith"),"String",{endsWith:function(t){var n=i(this,t,"endsWith"),r=arguments.length>1?arguments[1]:void 0,e=o(n.length),c=void 0===r?e:Math.min(o(r),e),f=String(t);return u?u.call(n,f,c):n.slice(c-f.length,c)===f}})},function(t,n,r){var e=r(37),o=r(11);t.exports=function(t,n,r){if(e(n))throw TypeError("String#"+r+" doesn't accept regex!");return String(o(t))}},function(t,n,r){var e=r(1),o=r(5),i=r(6)("match");t.exports=function(t){var n;return e(t)&&(void 0!==(n=t[i])?!!n:"RegExp"==o(t))}},function(t,n,r){var e=r(6)("match");t.exports=function(t){var n=/./;try{"/./"[t](n)}catch(r){try{return n[e]=!1,!"/./"[t](n)}catch(t){}}return!0}}]); /***/ }), /***/ "./node_modules/axios/index.js": /*!*************************************!*\ !*** ./node_modules/axios/index.js ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js"); /***/ }), /***/ "./node_modules/axios/lib/adapters/http.js": /*!*************************************************!*\ !*** ./node_modules/axios/lib/adapters/http.js ***! \*************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js"); var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); var http = __webpack_require__(/*! http */ "http"); var https = __webpack_require__(/*! https */ "https"); var httpFollow = __webpack_require__(/*! follow-redirects */ "./node_modules/follow-redirects/index.js").http; var httpsFollow = __webpack_require__(/*! follow-redirects */ "./node_modules/follow-redirects/index.js").https; var url = __webpack_require__(/*! url */ "url"); var zlib = __webpack_require__(/*! zlib */ "zlib"); var pkg = __webpack_require__(/*! ./../../package.json */ "./node_modules/axios/package.json"); var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js"); var enhanceError = __webpack_require__(/*! ../core/enhanceError */ "./node_modules/axios/lib/core/enhanceError.js"); /*eslint consistent-return:0*/ module.exports = function httpAdapter(config) { return new Promise(function dispatchHttpRequest(resolve, reject) { var data = config.data; var headers = config.headers; var timer; // Set User-Agent (required by some servers) // Only set header if it hasn't been set in config // See https://github.com/axios/axios/issues/69 if (!headers['User-Agent'] && !headers['user-agent']) { headers['User-Agent'] = 'axios/' + pkg.version; } if (data && !utils.isStream(data)) { if (Buffer.isBuffer(data)) { // Nothing to do... } else if (utils.isArrayBuffer(data)) { data = new Buffer(new Uint8Array(data)); } else if (utils.isString(data)) { data = new Buffer(data, 'utf-8'); } else { return reject(createError( 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream', config )); } // Add Content-Length header if data exists headers['Content-Length'] = data.length; } // HTTP basic authentication var auth = undefined; if (config.auth) { var username = config.auth.username || ''; var password = config.auth.password || ''; auth = username + ':' + password; } // Parse url var parsed = url.parse(config.url); var protocol = parsed.protocol || 'http:'; if (!auth && parsed.auth) { var urlAuth = parsed.auth.split(':'); var urlUsername = urlAuth[0] || ''; var urlPassword = urlAuth[1] || ''; auth = urlUsername + ':' + urlPassword; } if (auth) { delete headers.Authorization; } var isHttps = protocol === 'https:'; var agent = isHttps ? config.httpsAgent : config.httpAgent; var options = { path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''), method: config.method, headers: headers, agent: agent, auth: auth }; if (config.socketPath) { options.socketPath = config.socketPath; } else { options.hostname = parsed.hostname; options.port = parsed.port; } var proxy = config.proxy; if (!proxy && proxy !== false) { var proxyEnv = protocol.slice(0, -1) + '_proxy'; var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()]; if (proxyUrl) { var parsedProxyUrl = url.parse(proxyUrl); proxy = { host: parsedProxyUrl.hostname, port: parsedProxyUrl.port }; if (parsedProxyUrl.auth) { var proxyUrlAuth = parsedProxyUrl.auth.split(':'); proxy.auth = { username: proxyUrlAuth[0], password: proxyUrlAuth[1] }; } } } if (proxy) { options.hostname = proxy.host; options.host = proxy.host; options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : ''); options.port = proxy.port; options.path = protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path; // Basic proxy authorization if (proxy.auth) { var base64 = new Buffer(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64'); options.headers['Proxy-Authorization'] = 'Basic ' + base64; } } var transport; if (config.transport) { transport = config.transport; } else if (config.maxRedirects === 0) { transport = isHttps ? https : http; } else { if (config.maxRedirects) { options.maxRedirects = config.maxRedirects; } transport = isHttps ? httpsFollow : httpFollow; } if (config.maxContentLength && config.maxContentLength > -1) { options.maxBodyLength = config.maxContentLength; } // Create the request var req = transport.request(options, function handleResponse(res) { if (req.aborted) return; // Response has been received so kill timer that handles request timeout clearTimeout(timer); timer = null; // uncompress the response body transparently if required var stream = res; switch (res.headers['content-encoding']) { /*eslint default-case:0*/ case 'gzip': case 'compress': case 'deflate': // add the unzipper to the body stream processing pipeline stream = stream.pipe(zlib.createUnzip()); // remove the content-encoding in order to not confuse downstream operations delete res.headers['content-encoding']; break; } // return the last request in case of redirects var lastRequest = res.req || req; var response = { status: res.statusCode, statusText: res.statusMessage, headers: res.headers, config: config, request: lastRequest }; if (config.responseType === 'stream') { response.data = stream; settle(resolve, reject, response); } else { var responseBuffer = []; stream.on('data', function handleStreamData(chunk) { responseBuffer.push(chunk); // make sure the content length is not over the maxContentLength if specified if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) { stream.destroy(); reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded', config, null, lastRequest)); } }); stream.on('error', function handleStreamError(err) { if (req.aborted) return; reject(enhanceError(err, config, null, lastRequest)); }); stream.on('end', function handleStreamEnd() { var responseData = Buffer.concat(responseBuffer); if (config.responseType !== 'arraybuffer') { responseData = responseData.toString('utf8'); } response.data = responseData; settle(resolve, reject, response); }); } }); // Handle errors req.on('error', function handleRequestError(err) { if (req.aborted) return; reject(enhanceError(err, config, null, req)); }); // Handle request timeout if (config.timeout && !timer) { timer = setTimeout(function handleRequestTimeout() { req.abort(); reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', req)); }, config.timeout); } if (config.cancelToken) { // Handle cancellation config.cancelToken.promise.then(function onCanceled(cancel) { if (req.aborted) return; req.abort(); reject(cancel); }); } // Send the request if (utils.isStream(data)) { data.pipe(req); } else { req.end(data); } }); }; /***/ }), /***/ "./node_modules/axios/lib/adapters/xhr.js": /*!************************************************!*\ !*** ./node_modules/axios/lib/adapters/xhr.js ***! \************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js"); var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js"); var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js"); var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js"); module.exports = function xhrAdapter(config) { return new Promise(function dispatchXhrRequest(resolve, reject) { var requestData = config.data; var requestHeaders = config.headers; if (utils.isFormData(requestData)) { delete requestHeaders['Content-Type']; // Let the browser set it } var request = new XMLHttpRequest(); // HTTP basic authentication if (config.auth) { var username = config.auth.username || ''; var password = config.auth.password || ''; requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); } request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true); // Set the request timeout in MS request.timeout = config.timeout; // Listen for ready state request.onreadystatechange = function handleLoad() { if (!request || request.readyState !== 4) { return; } // The request errored out and we didn't get a response, this will be // handled by onerror instead // With one exception: request that using file: protocol, most browsers // will return status as 0 even though it's a successful request if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { return; } // Prepare the response var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; var response = { data: responseData, status: request.status, statusText: request.statusText, headers: responseHeaders, config: config, request: request }; settle(resolve, reject, response); // Clean up request request = null; }; // Handle low level network errors request.onerror = function handleError() { // Real errors are hidden from us by the browser // onerror should only fire if it's a network error reject(createError('Network Error', config, null, request)); // Clean up request request = null; }; // Handle timeout request.ontimeout = function handleTimeout() { reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', request)); // Clean up request request = null; }; // Add xsrf header // This is only done if running in a standard browser environment. // Specifically not if we're in a web worker, or react-native. if (utils.isStandardBrowserEnv()) { var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js"); // Add xsrf header var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ? cookies.read(config.xsrfCookieName) : undefined; if (xsrfValue) { requestHeaders[config.xsrfHeaderName] = xsrfValue; } } // Add headers to the request if ('setRequestHeader' in request) { utils.forEach(requestHeaders, function setRequestHeader(val, key) { if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { // Remove Content-Type if data is undefined delete requestHeaders[key]; } else { // Otherwise add header to the request request.setRequestHeader(key, val); } }); } // Add withCredentials to request if needed if (config.withCredentials) { request.withCredentials = true; } // Add responseType to request if needed if (config.responseType) { try { request.responseType = config.responseType; } catch (e) { // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. if (config.responseType !== 'json') { throw e; } } } // Handle progress if needed if (typeof config.onDownloadProgress === 'function') { request.addEventListener('progress', config.onDownloadProgress); } // Not all browsers support upload events if (typeof config.onUploadProgress === 'function' && request.upload) { request.upload.addEventListener('progress', config.onUploadProgress); } if (config.cancelToken) { // Handle cancellation config.cancelToken.promise.then(function onCanceled(cancel) { if (!request) { return; } request.abort(); reject(cancel); // Clean up request request = null; }); } if (requestData === undefined) { requestData = null; } // Send the request request.send(requestData); }); }; /***/ }), /***/ "./node_modules/axios/lib/axios.js": /*!*****************************************!*\ !*** ./node_modules/axios/lib/axios.js ***! \*****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js"); var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js"); var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js"); var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js"); /** * Create an instance of Axios * * @param {Object} defaultConfig The default config for the instance * @return {Axios} A new instance of Axios */ function createInstance(defaultConfig) { var context = new Axios(defaultConfig); var instance = bind(Axios.prototype.request, context); // Copy axios.prototype to instance utils.extend(instance, Axios.prototype, context); // Copy context to instance utils.extend(instance, context); return instance; } // Create the default instance to be exported var axios = createInstance(defaults); // Expose Axios class to allow class inheritance axios.Axios = Axios; // Factory for creating new instances axios.create = function create(instanceConfig) { return createInstance(utils.merge(defaults, instanceConfig)); }; // Expose Cancel & CancelToken axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js"); axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js"); axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js"); // Expose all/spread axios.all = function all(promises) { return Promise.all(promises); }; axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js"); module.exports = axios; // Allow use of default import syntax in TypeScript module.exports.default = axios; /***/ }), /***/ "./node_modules/axios/lib/cancel/Cancel.js": /*!*************************************************!*\ !*** ./node_modules/axios/lib/cancel/Cancel.js ***! \*************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * A `Cancel` is an object that is thrown when an operation is canceled. * * @class * @param {string=} message The message. */ function Cancel(message) { this.message = message; } Cancel.prototype.toString = function toString() { return 'Cancel' + (this.message ? ': ' + this.message : ''); }; Cancel.prototype.__CANCEL__ = true; module.exports = Cancel; /***/ }), /***/ "./node_modules/axios/lib/cancel/CancelToken.js": /*!******************************************************!*\ !*** ./node_modules/axios/lib/cancel/CancelToken.js ***! \******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js"); /** * A `CancelToken` is an object that can be used to request cancellation of an operation. * * @class * @param {Function} executor The executor function. */ function CancelToken(executor) { if (typeof executor !== 'function') { throw new TypeError('executor must be a function.'); } var resolvePromise; this.promise = new Promise(function promiseExecutor(resolve) { resolvePromise = resolve; }); var token = this; executor(function cancel(message) { if (token.reason) { // Cancellation has already been requested return; } token.reason = new Cancel(message); resolvePromise(token.reason); }); } /** * Throws a `Cancel` if cancellation has been requested. */ CancelToken.prototype.throwIfRequested = function throwIfRequested() { if (this.reason) { throw this.reason; } }; /** * Returns an object that contains a new `CancelToken` and a function that, when called, * cancels the `CancelToken`. */ CancelToken.source = function source() { var cancel; var token = new CancelToken(function executor(c) { cancel = c; }); return { token: token, cancel: cancel }; }; module.exports = CancelToken; /***/ }), /***/ "./node_modules/axios/lib/cancel/isCancel.js": /*!***************************************************!*\ !*** ./node_modules/axios/lib/cancel/isCancel.js ***! \***************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function isCancel(value) { return !!(value && value.__CANCEL__); }; /***/ }), /***/ "./node_modules/axios/lib/core/Axios.js": /*!**********************************************!*\ !*** ./node_modules/axios/lib/core/Axios.js ***! \**********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var defaults = __webpack_require__(/*! ./../defaults */ "./node_modules/axios/lib/defaults.js"); var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js"); var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js"); /** * Create a new instance of Axios * * @param {Object} instanceConfig The default config for the instance */ function Axios(instanceConfig) { this.defaults = instanceConfig; this.interceptors = { request: new InterceptorManager(), response: new InterceptorManager() }; } /** * Dispatch a request * * @param {Object} config The config specific for this request (merged with this.defaults) */ Axios.prototype.request = function request(config) { /*eslint no-param-reassign:0*/ // Allow for axios('example/url'[, config]) a la fetch API if (typeof config === 'string') { config = utils.merge({ url: arguments[0] }, arguments[1]); } config = utils.merge(defaults, {method: 'get'}, this.defaults, config); config.method = config.method.toLowerCase(); // Hook up interceptors middleware var chain = [dispatchRequest, undefined]; var promise = Promise.resolve(config); this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { chain.unshift(interceptor.fulfilled, interceptor.rejected); }); this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { chain.push(interceptor.fulfilled, interceptor.rejected); }); while (chain.length) { promise = promise.then(chain.shift(), chain.shift()); } return promise; }; // Provide aliases for supported request methods utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { /*eslint func-names:0*/ Axios.prototype[method] = function(url, config) { return this.request(utils.merge(config || {}, { method: method, url: url })); }; }); utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { /*eslint func-names:0*/ Axios.prototype[method] = function(url, data, config) { return this.request(utils.merge(config || {}, { method: method, url: url, data: data })); }; }); module.exports = Axios; /***/ }), /***/ "./node_modules/axios/lib/core/InterceptorManager.js": /*!***********************************************************!*\ !*** ./node_modules/axios/lib/core/InterceptorManager.js ***! \***********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); function InterceptorManager() { this.handlers = []; } /** * Add a new interceptor to the stack * * @param {Function} fulfilled The function to handle `then` for a `Promise` * @param {Function} rejected The function to handle `reject` for a `Promise` * * @return {Number} An ID used to remove interceptor later */ InterceptorManager.prototype.use = function use(fulfilled, rejected) { this.handlers.push({ fulfilled: fulfilled, rejected: rejected }); return this.handlers.length - 1; }; /** * Remove an interceptor from the stack * * @param {Number} id The ID that was returned by `use` */ InterceptorManager.prototype.eject = function eject(id) { if (this.handlers[id]) { this.handlers[id] = null; } }; /** * Iterate over all the registered interceptors * * This method is particularly useful for skipping over any * interceptors that may have become `null` calling `eject`. * * @param {Function} fn The function to call for each interceptor */ InterceptorManager.prototype.forEach = function forEach(fn) { utils.forEach(this.handlers, function forEachHandler(h) { if (h !== null) { fn(h); } }); }; module.exports = InterceptorManager; /***/ }), /***/ "./node_modules/axios/lib/core/createError.js": /*!****************************************************!*\ !*** ./node_modules/axios/lib/core/createError.js ***! \****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js"); /** * Create an Error with the specified message, config, error code, request and response. * * @param {string} message The error message. * @param {Object} config The config. * @param {string} [code] The error code (for example, 'ECONNABORTED'). * @param {Object} [request] The request. * @param {Object} [response] The response. * @returns {Error} The created error. */ module.exports = function createError(message, config, code, request, response) { var error = new Error(message); return enhanceError(error, config, code, request, response); }; /***/ }), /***/ "./node_modules/axios/lib/core/dispatchRequest.js": /*!********************************************************!*\ !*** ./node_modules/axios/lib/core/dispatchRequest.js ***! \********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js"); var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js"); var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js"); var isAbsoluteURL = __webpack_require__(/*! ./../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js"); var combineURLs = __webpack_require__(/*! ./../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js"); /** * Throws a `Cancel` if cancellation has been requested. */ function throwIfCancellationRequested(config) { if (config.cancelToken) { config.cancelToken.throwIfRequested(); } } /** * Dispatch a request to the server using the configured adapter. * * @param {object} config The config that is to be used for the request * @returns {Promise} The Promise to be fulfilled */ module.exports = function dispatchRequest(config) { throwIfCancellationRequested(config); // Support baseURL config if (config.baseURL && !isAbsoluteURL(config.url)) { config.url = combineURLs(config.baseURL, config.url); } // Ensure headers exist config.headers = config.headers || {}; // Transform request data config.data = transformData( config.data, config.headers, config.transformRequest ); // Flatten headers config.headers = utils.merge( config.headers.common || {}, config.headers[config.method] || {}, config.headers || {} ); utils.forEach( ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function cleanHeaderConfig(method) { delete config.headers[method]; } ); var adapter = config.adapter || defaults.adapter; return adapter(config).then(function onAdapterResolution(response) { throwIfCancellationRequested(config); // Transform response data response.data = transformData( response.data, response.headers, config.transformResponse ); return response; }, function onAdapterRejection(reason) { if (!isCancel(reason)) { throwIfCancellationRequested(config); // Transform response data if (reason && reason.response) { reason.response.data = transformData( reason.response.data, reason.response.headers, config.transformResponse ); } } return Promise.reject(reason); }); }; /***/ }), /***/ "./node_modules/axios/lib/core/enhanceError.js": /*!*****************************************************!*\ !*** ./node_modules/axios/lib/core/enhanceError.js ***! \*****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Update an Error with the specified config, error code, and response. * * @param {Error} error The error to update. * @param {Object} config The config. * @param {string} [code] The error code (for example, 'ECONNABORTED'). * @param {Object} [request] The request. * @param {Object} [response] The response. * @returns {Error} The error. */ module.exports = function enhanceError(error, config, code, request, response) { error.config = config; if (code) { error.code = code; } error.request = request; error.response = response; return error; }; /***/ }), /***/ "./node_modules/axios/lib/core/settle.js": /*!***********************************************!*\ !*** ./node_modules/axios/lib/core/settle.js ***! \***********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js"); /** * Resolve or reject a Promise based on response status. * * @param {Function} resolve A function that resolves the promise. * @param {Function} reject A function that rejects the promise. * @param {object} response The response. */ module.exports = function settle(resolve, reject, response) { var validateStatus = response.config.validateStatus; // Note: status is not exposed by XDomainRequest if (!response.status || !validateStatus || validateStatus(response.status)) { resolve(response); } else { reject(createError( 'Request failed with status code ' + response.status, response.config, null, response.request, response )); } }; /***/ }), /***/ "./node_modules/axios/lib/core/transformData.js": /*!******************************************************!*\ !*** ./node_modules/axios/lib/core/transformData.js ***! \******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); /** * Transform the data for a request or a response * * @param {Object|String} data The data to be transformed * @param {Array} headers The headers for the request or response * @param {Array|Function} fns A single function or Array of functions * @returns {*} The resulting transformed data */ module.exports = function transformData(data, headers, fns) { /*eslint no-param-reassign:0*/ utils.forEach(fns, function transform(fn) { data = fn(data, headers); }); return data; }; /***/ }), /***/ "./node_modules/axios/lib/defaults.js": /*!********************************************!*\ !*** ./node_modules/axios/lib/defaults.js ***! \********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js"); var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js"); var DEFAULT_CONTENT_TYPE = { 'Content-Type': 'application/x-www-form-urlencoded' }; function setContentTypeIfUnset(headers, value) { if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { headers['Content-Type'] = value; } } function getDefaultAdapter() { var adapter; if (typeof XMLHttpRequest !== 'undefined') { // For browsers use XHR adapter adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js"); } else if (typeof process !== 'undefined') { // For node use HTTP adapter adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/http.js"); } return adapter; } var defaults = { adapter: getDefaultAdapter(), transformRequest: [function transformRequest(data, headers) { normalizeHeaderName(headers, 'Content-Type'); if (utils.isFormData(data) || utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data) ) { return data; } if (utils.isArrayBufferView(data)) { return data.buffer; } if (utils.isURLSearchParams(data)) { setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); return data.toString(); } if (utils.isObject(data)) { setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); return JSON.stringify(data); } return data; }], transformResponse: [function transformResponse(data) { /*eslint no-param-reassign:0*/ if (typeof data === 'string') { try { data = JSON.parse(data); } catch (e) { /* Ignore */ } } return data; }], /** * A timeout in milliseconds to abort a request. If set to 0 (default) a * timeout is not created. */ timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, validateStatus: function validateStatus(status) { return status >= 200 && status < 300; } }; defaults.headers = { common: { 'Accept': 'application/json, text/plain, */*' } }; utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { defaults.headers[method] = {}; }); utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); }); module.exports = defaults; /***/ }), /***/ "./node_modules/axios/lib/helpers/bind.js": /*!************************************************!*\ !*** ./node_modules/axios/lib/helpers/bind.js ***! \************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function bind(fn, thisArg) { return function wrap() { var args = new Array(arguments.length); for (var i = 0; i < args.length; i++) { args[i] = arguments[i]; } return fn.apply(thisArg, args); }; }; /***/ }), /***/ "./node_modules/axios/lib/helpers/buildURL.js": /*!****************************************************!*\ !*** ./node_modules/axios/lib/helpers/buildURL.js ***! \****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); function encode(val) { return encodeURIComponent(val). replace(/%40/gi, '@'). replace(/%3A/gi, ':'). replace(/%24/g, '$'). replace(/%2C/gi, ','). replace(/%20/g, '+'). replace(/%5B/gi, '['). replace(/%5D/gi, ']'); } /** * Build a URL by appending params to the end * * @param {string} url The base of the url (e.g., http://www.google.com) * @param {object} [params] The params to be appended * @returns {string} The formatted url */ module.exports = function buildURL(url, params, paramsSerializer) { /*eslint no-param-reassign:0*/ if (!params) { return url; } var serializedParams; if (paramsSerializer) { serializedParams = paramsSerializer(params); } else if (utils.isURLSearchParams(params)) { serializedParams = params.toString(); } else { var parts = []; utils.forEach(params, function serialize(val, key) { if (val === null || typeof val === 'undefined') { return; } if (utils.isArray(val)) { key = key + '[]'; } else { val = [val]; } utils.forEach(val, function parseValue(v) { if (utils.isDate(v)) { v = v.toISOString(); } else if (utils.isObject(v)) { v = JSON.stringify(v); } parts.push(encode(key) + '=' + encode(v)); }); }); serializedParams = parts.join('&'); } if (serializedParams) { url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; } return url; }; /***/ }), /***/ "./node_modules/axios/lib/helpers/combineURLs.js": /*!*******************************************************!*\ !*** ./node_modules/axios/lib/helpers/combineURLs.js ***! \*******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Creates a new URL by combining the specified URLs * * @param {string} baseURL The base URL * @param {string} relativeURL The relative URL * @returns {string} The combined URL */ module.exports = function combineURLs(baseURL, relativeURL) { return relativeURL ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL; }; /***/ }), /***/ "./node_modules/axios/lib/helpers/cookies.js": /*!***************************************************!*\ !*** ./node_modules/axios/lib/helpers/cookies.js ***! \***************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); module.exports = ( utils.isStandardBrowserEnv() ? // Standard browser envs support document.cookie (function standardBrowserEnv() { return { write: function write(name, value, expires, path, domain, secure) { var cookie = []; cookie.push(name + '=' + encodeURIComponent(value)); if (utils.isNumber(expires)) { cookie.push('expires=' + new Date(expires).toGMTString()); } if (utils.isString(path)) { cookie.push('path=' + path); } if (utils.isString(domain)) { cookie.push('domain=' + domain); } if (secure === true) { cookie.push('secure'); } document.cookie = cookie.join('; '); }, read: function read(name) { var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); return (match ? decodeURIComponent(match[3]) : null); }, remove: function remove(name) { this.write(name, '', Date.now() - 86400000); } }; })() : // Non standard browser env (web workers, react-native) lack needed support. (function nonStandardBrowserEnv() { return { write: function write() {}, read: function read() { return null; }, remove: function remove() {} }; })() ); /***/ }), /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js": /*!*********************************************************!*\ !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***! \*********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Determines whether the specified URL is absolute * * @param {string} url The URL to test * @returns {boolean} True if the specified URL is absolute, otherwise false */ module.exports = function isAbsoluteURL(url) { // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed // by any combination of letters, digits, plus, period, or hyphen. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); }; /***/ }), /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js": /*!***********************************************************!*\ !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***! \***********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); module.exports = ( utils.isStandardBrowserEnv() ? // Standard browser envs have full support of the APIs needed to test // whether the request URL is of the same origin as current location. (function standardBrowserEnv() { var msie = /(msie|trident)/i.test(navigator.userAgent); var urlParsingNode = document.createElement('a'); var originURL; /** * Parse a URL to discover it's components * * @param {String} url The URL to be parsed * @returns {Object} */ function resolveURL(url) { var href = url; if (msie) { // IE needs attribute set twice to normalize properties urlParsingNode.setAttribute('href', href); href = urlParsingNode.href; } urlParsingNode.setAttribute('href', href); // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils return { href: urlParsingNode.href, protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', host: urlParsingNode.host, search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', hostname: urlParsingNode.hostname, port: urlParsingNode.port, pathname: (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname }; } originURL = resolveURL(window.location.href); /** * Determine if a URL shares the same origin as the current location * * @param {String} requestURL The URL to test * @returns {boolean} True if URL shares the same origin, otherwise false */ return function isURLSameOrigin(requestURL) { var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; return (parsed.protocol === originURL.protocol && parsed.host === originURL.host); }; })() : // Non standard browser envs (web workers, react-native) lack needed support. (function nonStandardBrowserEnv() { return function isURLSameOrigin() { return true; }; })() ); /***/ }), /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js": /*!***************************************************************!*\ !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***! \***************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js"); module.exports = function normalizeHeaderName(headers, normalizedName) { utils.forEach(headers, function processHeader(value, name) { if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { headers[normalizedName] = value; delete headers[name]; } }); }; /***/ }), /***/ "./node_modules/axios/lib/helpers/parseHeaders.js": /*!********************************************************!*\ !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***! \********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); // Headers whose duplicates are ignored by node // c.f. https://nodejs.org/api/http.html#http_message_headers var ignoreDuplicateOf = [ 'age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent' ]; /** * Parse headers into an object * * ``` * Date: Wed, 27 Aug 2014 08:58:49 GMT * Content-Type: application/json * Connection: keep-alive * Transfer-Encoding: chunked * ``` * * @param {String} headers Headers needing to be parsed * @returns {Object} Headers parsed into an object */ module.exports = function parseHeaders(headers) { var parsed = {}; var key; var val; var i; if (!headers) { return parsed; } utils.forEach(headers.split('\n'), function parser(line) { i = line.indexOf(':'); key = utils.trim(line.substr(0, i)).toLowerCase(); val = utils.trim(line.substr(i + 1)); if (key) { if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { return; } if (key === 'set-cookie') { parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); } else { parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; } } }); return parsed; }; /***/ }), /***/ "./node_modules/axios/lib/helpers/spread.js": /*!**************************************************!*\ !*** ./node_modules/axios/lib/helpers/spread.js ***! \**************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Syntactic sugar for invoking a function and expanding an array for arguments. * * Common use case would be to use `Function.prototype.apply`. * * ```js * function f(x, y, z) {} * var args = [1, 2, 3]; * f.apply(null, args); * ``` * * With `spread` this example can be re-written. * * ```js * spread(function(x, y, z) {})([1, 2, 3]); * ``` * * @param {Function} callback * @returns {Function} */ module.exports = function spread(callback) { return function wrap(arr) { return callback.apply(null, arr); }; }; /***/ }), /***/ "./node_modules/axios/lib/utils.js": /*!*****************************************!*\ !*** ./node_modules/axios/lib/utils.js ***! \*****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js"); var isBuffer = __webpack_require__(/*! is-buffer */ "./node_modules/axios/node_modules/is-buffer/index.js"); /*global toString:true*/ // utils is a library of generic helper functions non-specific to axios var toString = Object.prototype.toString; /** * Determine if a value is an Array * * @param {Object} val The value to test * @returns {boolean} True if value is an Array, otherwise false */ function isArray(val) { return toString.call(val) === '[object Array]'; } /** * Determine if a value is an ArrayBuffer * * @param {Object} val The value to test * @returns {boolean} True if value is an ArrayBuffer, otherwise false */ function isArrayBuffer(val) { return toString.call(val) === '[object ArrayBuffer]'; } /** * Determine if a value is a FormData * * @param {Object} val The value to test * @returns {boolean} True if value is an FormData, otherwise false */ function isFormData(val) { return (typeof FormData !== 'undefined') && (val instanceof FormData); } /** * Determine if a value is a view on an ArrayBuffer * * @param {Object} val The value to test * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false */ function isArrayBufferView(val) { var result; if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { result = ArrayBuffer.isView(val); } else { result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); } return result; } /** * Determine if a value is a String * * @param {Object} val The value to test * @returns {boolean} True if value is a String, otherwise false */ function isString(val) { return typeof val === 'string'; } /** * Determine if a value is a Number * * @param {Object} val The value to test * @returns {boolean} True if value is a Number, otherwise false */ function isNumber(val) { return typeof val === 'number'; } /** * Determine if a value is undefined * * @param {Object} val The value to test * @returns {boolean} True if the value is undefined, otherwise false */ function isUndefined(val) { return typeof val === 'undefined'; } /** * Determine if a value is an Object * * @param {Object} val The value to test * @returns {boolean} True if value is an Object, otherwise false */ function isObject(val) { return val !== null && typeof val === 'object'; } /** * Determine if a value is a Date * * @param {Object} val The value to test * @returns {boolean} True if value is a Date, otherwise false */ function isDate(val) { return toString.call(val) === '[object Date]'; } /** * Determine if a value is a File * * @param {Object} val The value to test * @returns {boolean} True if value is a File, otherwise false */ function isFile(val) { return toString.call(val) === '[object File]'; } /** * Determine if a value is a Blob * * @param {Object} val The value to test * @returns {boolean} True if value is a Blob, otherwise false */ function isBlob(val) { return toString.call(val) === '[object Blob]'; } /** * Determine if a value is a Function * * @param {Object} val The value to test * @returns {boolean} True if value is a Function, otherwise false */ function isFunction(val) { return toString.call(val) === '[object Function]'; } /** * Determine if a value is a Stream * * @param {Object} val The value to test * @returns {boolean} True if value is a Stream, otherwise false */ function isStream(val) { return isObject(val) && isFunction(val.pipe); } /** * Determine if a value is a URLSearchParams object * * @param {Object} val The value to test * @returns {boolean} True if value is a URLSearchParams object, otherwise false */ function isURLSearchParams(val) { return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; } /** * Trim excess whitespace off the beginning and end of a string * * @param {String} str The String to trim * @returns {String} The String freed of excess whitespace */ function trim(str) { return str.replace(/^\s*/, '').replace(/\s*$/, ''); } /** * Determine if we're running in a standard browser environment * * This allows axios to run in a web worker, and react-native. * Both environments support XMLHttpRequest, but not fully standard globals. * * web workers: * typeof window -> undefined * typeof document -> undefined * * react-native: * navigator.product -> 'ReactNative' */ function isStandardBrowserEnv() { if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') { return false; } return ( typeof window !== 'undefined' && typeof document !== 'undefined' ); } /** * Iterate over an Array or an Object invoking a function for each item. * * If `obj` is an Array callback will be called passing * the value, index, and complete array for each item. * * If 'obj' is an Object callback will be called passing * the value, key, and complete object for each property. * * @param {Object|Array} obj The object to iterate * @param {Function} fn The callback to invoke for each item */ function forEach(obj, fn) { // Don't bother if no value provided if (obj === null || typeof obj === 'undefined') { return; } // Force an array if not already something iterable if (typeof obj !== 'object') { /*eslint no-param-reassign:0*/ obj = [obj]; } if (isArray(obj)) { // Iterate over array values for (var i = 0, l = obj.length; i < l; i++) { fn.call(null, obj[i], i, obj); } } else { // Iterate over object keys for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { fn.call(null, obj[key], key, obj); } } } } /** * Accepts varargs expecting each argument to be an object, then * immutably merges the properties of each object and returns result. * * When multiple objects contain the same key the later object in * the arguments list will take precedence. * * Example: * * ```js * var result = merge({foo: 123}, {foo: 456}); * console.log(result.foo); // outputs 456 * ``` * * @param {Object} obj1 Object to merge * @returns {Object} Result of all merge properties */ function merge(/* obj1, obj2, obj3, ... */) { var result = {}; function assignValue(val, key) { if (typeof result[key] === 'object' && typeof val === 'object') { result[key] = merge(result[key], val); } else { result[key] = val; } } for (var i = 0, l = arguments.length; i < l; i++) { forEach(arguments[i], assignValue); } return result; } /** * Extends object a by mutably adding to it the properties of object b. * * @param {Object} a The object to be extended * @param {Object} b The object to copy properties from * @param {Object} thisArg The object to bind function to * @return {Object} The resulting value of object a */ function extend(a, b, thisArg) { forEach(b, function assignValue(val, key) { if (thisArg && typeof val === 'function') { a[key] = bind(val, thisArg); } else { a[key] = val; } }); return a; } module.exports = { isArray: isArray, isArrayBuffer: isArrayBuffer, isBuffer: isBuffer, isFormData: isFormData, isArrayBufferView: isArrayBufferView, isString: isString, isNumber: isNumber, isObject: isObject, isUndefined: isUndefined, isDate: isDate, isFile: isFile, isBlob: isBlob, isFunction: isFunction, isStream: isStream, isURLSearchParams: isURLSearchParams, isStandardBrowserEnv: isStandardBrowserEnv, forEach: forEach, merge: merge, extend: extend, trim: trim }; /***/ }), /***/ "./node_modules/axios/node_modules/is-buffer/index.js": /*!************************************************************!*\ !*** ./node_modules/axios/node_modules/is-buffer/index.js ***! \************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh * @license MIT */ module.exports = function isBuffer (obj) { return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) } /***/ }), /***/ "./node_modules/axios/package.json": /*!*****************************************!*\ !*** ./node_modules/axios/package.json ***! \*****************************************/ /*! exports provided: name, version, description, main, scripts, repository, keywords, author, license, bugs, homepage, devDependencies, browser, typings, dependencies, bundlesize, default */ /***/ (function(module) { module.exports = JSON.parse("{\"name\":\"axios\",\"version\":\"0.18.1\",\"description\":\"Promise based HTTP client for the browser and node.js\",\"main\":\"index.js\",\"scripts\":{\"test\":\"grunt test && bundlesize\",\"start\":\"node ./sandbox/server.js\",\"build\":\"NODE_ENV=production grunt build\",\"preversion\":\"npm test\",\"version\":\"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json\",\"postversion\":\"git push && git push --tags\",\"examples\":\"node ./examples/server.js\",\"coveralls\":\"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/axios/axios.git\"},\"keywords\":[\"xhr\",\"http\",\"ajax\",\"promise\",\"node\"],\"author\":\"Matt Zabriskie\",\"license\":\"MIT\",\"bugs\":{\"url\":\"https://github.com/axios/axios/issues\"},\"homepage\":\"https://github.com/axios/axios\",\"devDependencies\":{\"bundlesize\":\"^0.5.7\",\"coveralls\":\"^2.11.9\",\"es6-promise\":\"^4.0.5\",\"grunt\":\"^1.0.1\",\"grunt-banner\":\"^0.6.0\",\"grunt-cli\":\"^1.2.0\",\"grunt-contrib-clean\":\"^1.0.0\",\"grunt-contrib-nodeunit\":\"^1.0.0\",\"grunt-contrib-watch\":\"^1.0.0\",\"grunt-eslint\":\"^19.0.0\",\"grunt-karma\":\"^2.0.0\",\"grunt-ts\":\"^6.0.0-beta.3\",\"grunt-webpack\":\"^1.0.18\",\"istanbul-instrumenter-loader\":\"^1.0.0\",\"jasmine-core\":\"^2.4.1\",\"karma\":\"^1.3.0\",\"karma-chrome-launcher\":\"^2.0.0\",\"karma-coverage\":\"^1.0.0\",\"karma-firefox-launcher\":\"^1.0.0\",\"karma-jasmine\":\"^1.0.2\",\"karma-jasmine-ajax\":\"^0.1.13\",\"karma-opera-launcher\":\"^1.0.0\",\"karma-safari-launcher\":\"^1.0.0\",\"karma-sauce-launcher\":\"^1.1.0\",\"karma-sinon\":\"^1.0.5\",\"karma-sourcemap-loader\":\"^0.3.7\",\"karma-webpack\":\"^1.7.0\",\"load-grunt-tasks\":\"^3.5.2\",\"minimist\":\"^1.2.0\",\"sinon\":\"^1.17.4\",\"webpack\":\"^1.13.1\",\"webpack-dev-server\":\"^1.14.1\",\"url-search-params\":\"^0.6.1\",\"typescript\":\"^2.0.3\"},\"browser\":{\"./lib/adapters/http.js\":\"./lib/adapters/xhr.js\"},\"typings\":\"./index.d.ts\",\"dependencies\":{\"follow-redirects\":\"1.5.10\",\"is-buffer\":\"^2.0.2\"},\"bundlesize\":[{\"path\":\"./dist/axios.min.js\",\"threshold\":\"5kB\"}]}"); /***/ }), /***/ "./node_modules/classnames/index.js": /*!******************************************!*\ !*** ./node_modules/classnames/index.js ***! \******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ /* global define */ (function () { 'use strict'; var hasOwn = {}.hasOwnProperty; function classNames () { var classes = []; for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if (!arg) continue; var argType = typeof arg; if (argType === 'string' || argType === 'number') { classes.push(arg); } else if (Array.isArray(arg) && arg.length) { var inner = classNames.apply(null, arg); if (inner) { classes.push(inner); } } else if (argType === 'object') { for (var key in arg) { if (hasOwn.call(arg, key) && arg[key]) { classes.push(key); } } } } return classes.join(' '); } if ( true && module.exports) { classNames.default = classNames; module.exports = classNames; } else if (true) { // register as 'classnames', consistent with npm package name !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { return classNames; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} }()); /***/ }), /***/ "./node_modules/css-loader/index.js?!./node_modules/sass-loader/lib/loader.js?!./client/style/app.scss": /*!**********************************************************************************************************************!*\ !*** ./node_modules/css-loader??ref--6-1!./node_modules/sass-loader/lib/loader.js??ref--6-2!./client/style/app.scss ***! \**********************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(/*! ../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(true); // imports // module exports.push([module.i, "/* reset */\nhtml,\nbody,\ndiv,\nspan,\napplet,\nobject,\niframe,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\np,\nblockquote,\npre,\na,\nabbr,\nacronym,\naddress,\nbig,\ncite,\ncode,\ndel,\ndfn,\nem,\nimg,\nins,\nkbd,\nq,\ns,\nsamp,\nsmall,\nstrike,\nstrong,\nsub,\nsup,\ntt,\nvar,\nb,\nu,\ni,\ncenter,\ndl,\ndt,\ndd,\nol,\nul,\nli,\nfieldset,\nform,\nlabel,\nlegend,\ntable,\ncaption,\ntbody,\ntfoot,\nthead,\ntr,\nth,\ntd,\narticle,\naside,\ncanvas,\ndetails,\nembed,\nfigure,\nfigcaption,\nfooter,\nheader,\nhgroup,\nmenu,\nnav,\noutput,\nruby,\nsection,\nsummary,\ntime,\nmark,\naudio,\nvideo {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline; }\n\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmenu,\nnav,\nsection {\n display: block; }\n\nbody {\n line-height: 1; }\n\nol,\nul {\n list-style: none; }\n\nblockquote,\nq {\n quotes: none; }\n\nblockquote:before, blockquote:after {\n content: \"\";\n content: none; }\n\nq:before, q:after {\n content: \"\";\n content: none; }\n\ntable {\n border-collapse: collapse;\n border-spacing: 0; }\n\n* {\n outline: none; }\n\nbutton {\n background: none;\n border: none;\n font-size: 1em;\n color: blue; }\n\nbody {\n font: 15px \"Avenir\", \"HelveticaNeue-Light\", \"Helvetica Neue Light\", \"Helvetica Neue\", Helvetica, Arial, \"Lucida Grande\", sans-serif; }\n\na {\n color: #3378aa;\n text-decoration: none; }\n\n.inputtext,\nbutton {\n border-radius: 2px;\n box-sizing: border-box;\n font-size: 1em; }\n\n.inputtext {\n border: 1px solid #ccc;\n padding: 0.5em;\n max-width: 100%; }\n\nbutton {\n background: #3378aa;\n border: 0;\n color: #f4f4ec;\n display: block;\n font-size: 0.95em;\n font-weight: bold;\n padding: 1em 1.5em;\n text-align: center;\n text-transform: uppercase;\n width: 100%; }\n button.darker {\n background: #555; }\n\n.image-upload {\n -webkit-align-items: center;\n align-items: center;\n display: -webkit-box;\n display: -moz-box;\n display: -ms-flexbox;\n display: -webkit-flex;\n display: flex;\n -webkit-justify-content: center;\n -moz-justify-content: center;\n justify-content: center;\n background: rgba(51, 120, 170, 0.15);\n border: 2px dashed #3378aa;\n border-radius: 0.5em;\n color: #3378aa;\n font-size: 2em;\n font-weight: bold;\n margin-right: 0.5em;\n height: 100px;\n overflow: hidden;\n position: relative;\n width: 100px; }\n .image-upload input {\n bottom: 0;\n cursor: hand;\n cursor: pointer;\n left: 0;\n opacity: 0;\n position: absolute;\n right: 0;\n top: 0; }\n .image-upload small {\n color: #999;\n display: block;\n font-size: 0.45em;\n font-weight: normal; }\n\n.image-uploaded {\n text-align: center;\n width: auto; }\n .image-uploaded img {\n margin-bottom: 0.25em;\n max-width: 100px; }\n .image-uploaded a {\n color: #2196f3;\n font-size: 0.9em; }\n\n.image-uploaded {\n width: auto;\n max-height: 100px;\n margin-right: 1em; }\n\n.loader {\n animation: spin 2s linear infinite;\n border: 4px solid rgba(255, 255, 255, 0.9);\n border-top: 4px solid #84c6e2;\n border-radius: 50%;\n display: inline-block;\n height: 12px;\n width: 12px; }\n\n@keyframes spin {\n 0% {\n transform: rotate(0deg); }\n 100% {\n transform: rotate(360deg); } }\n\nlabel.checkbox {\n -webkit-align-items: center;\n align-items: center;\n display: -webkit-box;\n display: -moz-box;\n display: -ms-flexbox;\n display: -webkit-flex;\n display: flex; }\n label.checkbox input {\n border-radius: 0;\n margin-right: 0.5em; }\n\n.submit-block {\n -webkit-align-items: center;\n align-items: center;\n display: -webkit-box;\n display: -moz-box;\n display: -ms-flexbox;\n display: -webkit-flex;\n display: flex;\n -webkit-justify-content: space-between;\n -moz-justify-content: space-between;\n justify-content: space-between; }\n .submit-block button {\n font-size: 0.9em;\n padding: 0.75em 1.5em;\n width: auto; }\n\n.red-link {\n color: #e57373; }\n\n.settings-modal .inputtext {\n margin-bottom: 1em;\n width: 100%; }\n\n.login-page {\n background: #000 linear-gradient(315deg, #555, #3e91cc, #888) no-repeat 50% 50%;\n background-size: 600% 600%;\n background-repeat: repeat;\n color: #fff;\n min-height: 100vh;\n -webkit-align-items: center;\n align-items: center;\n display: -webkit-box;\n display: -moz-box;\n display: -ms-flexbox;\n display: -webkit-flex;\n display: flex;\n -moz-flex-direction: column;\n -webkit-flex-direction: column;\n flex-direction: column;\n -webkit-justify-content: center;\n -moz-justify-content: center;\n justify-content: center; }\n\n.login-form {\n background: #fff;\n border-radius: 0.5em;\n box-sizing: border-box;\n color: #333;\n margin-bottom: 0.5em;\n max-width: 400px;\n padding: 2em;\n width: 90%; }\n @media (min-width: 768px) {\n .login-form {\n width: 50%; } }\n .login-form h2 {\n font-size: 2em;\n font-weight: bold;\n text-align: center; }\n .login-form label {\n display: block;\n margin: 1em 0 0.25em; }\n .login-form label.checkbox {\n -webkit-align-items: center;\n align-items: center;\n display: -webkit-box;\n display: -moz-box;\n display: -ms-flexbox;\n display: -webkit-flex;\n display: flex; }\n .login-form label.checkbox input {\n border-radius: 0;\n margin-right: 0.5em; }\n .login-form .inputtext {\n width: 100%; }\n .login-form button {\n font-weight: bold;\n letter-spacing: 0.05em;\n margin: 1em 0;\n text-transform: uppercase; }\n .login-form > a {\n color: inherit;\n display: block;\n text-align: center; }\n\n.main {\n display: -webkit-box;\n display: -moz-box;\n display: -ms-flexbox;\n display: -webkit-flex;\n display: flex;\n -moz-flex-direction: column;\n -webkit-flex-direction: column;\n flex-direction: column;\n height: 100vh; }\n\n.bg-pan-tl {\n -webkit-animation: bg-pan-tl 8s ease-in-out infinite alternate both;\n animation: bg-pan-tl 8s ease-in-out infinite alternate both; }\n\n@-webkit-keyframes bg-pan-tl {\n 0% {\n background-position: 100% 100%; }\n 100% {\n background-position: 0% 0%; } }\n\n@keyframes bg-pan-tl {\n 0% {\n background-position: 100% 100%; }\n 100% {\n background-position: 0% 0%; } }\n\n.header {\n width: 100%;\n display: flex;\n -moz-flex-shrink: 0;\n -webkit-flex-shrink: 0;\n flex-shrink: 0; }\n .header button {\n width: 150px;\n padding: 10px;\n margin: 20px 10px 20px 0; }\n .header .header-left {\n -webkit-align-items: center;\n align-items: center;\n -moz-flex-grow: 1;\n -webkit-flex-grow: 1;\n flex-grow: 1;\n display: -webkit-box;\n display: -moz-box;\n display: -ms-flexbox;\n display: -webkit-flex;\n display: flex; }\n\n.Dropdown-root {\n width: 400px;\n margin: 20px; }\n\n.Dropdown-control {\n height: 35px; }\n\n.presentation {\n display: -webkit-box;\n display: -moz-box;\n display: -ms-flexbox;\n display: -webkit-flex;\n display: flex;\n -moz-flex-grow: 1;\n -webkit-flex-grow: 1;\n flex-grow: 1; }\n .presentation .thumbnails {\n display: -webkit-box;\n display: -moz-box;\n display: -ms-flexbox;\n display: -webkit-flex;\n display: flex;\n -moz-flex-direction: column;\n -webkit-flex-direction: column;\n flex-direction: column;\n -moz-flex-shrink: 0;\n -webkit-flex-shrink: 0;\n flex-shrink: 0;\n -webkit-justify-content: space-between;\n -moz-justify-content: space-between;\n justify-content: space-between;\n background: #e8dfbd;\n overflow-x: hidden;\n overflow-y: auto;\n width: calc(150px + 2em); }\n .presentation .thumbnails .thumbnail {\n padding: 0.5em 1em; }\n .presentation .thumbnails .thumbnail .content-cnt {\n display: -webkit-box;\n display: -moz-box;\n display: -ms-flexbox;\n display: -webkit-flex;\n display: flex;\n -webkit-align-items: flex-end;\n align-items: flex-end;\n color: #777; }\n .presentation .thumbnails .thumbnail .content {\n background-size: cover;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n border: 2px solid #fcfcf9;\n box-shadow: 0 0 10px #666;\n display: block;\n height: 100px;\n margin-left: 0.5em;\n width: 150px; }\n .presentation .thumbnails .thumbnail.active {\n background: #3378aa; }\n .presentation .thumbnails .thumbnail.active .content {\n border-color: #fbe163;\n box-shadow: none; }\n .presentation .thumbnails .thumbnail.active .content-cnt {\n color: #fff; }\n .presentation .thumbnails .thumbnail.dragged span {\n visibility: hidden; }\n @media (max-width: 767px) {\n .presentation .thumbnails {\n width: calc(80px + 2em); }\n .presentation .thumbnails .thumbnail > div {\n height: 60px;\n width: 80px; } }\n .presentation .add-block {\n background: #fcfcf9;\n border: 1px solid #f4f4ec;\n border-width: 1px 1px 0 0;\n padding: 1em;\n position: relative; }\n .presentation .add-block button {\n margin-top: 1em; }\n .presentation .add-block .image-upload {\n box-sizing: border-box;\n width: 100%; }\n .presentation .add-block .progress-bar {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 5px;\n background: #eee; }\n .presentation .add-block .progress-bar > div {\n height: 100%;\n background: #3378aa; }\n\n.react-dropzone-s3-uploader img {\n height: 100px;\n width: 100px; }\n\n.content {\n transition: transform 0.3s ease 0s; }\n\n.modal {\n background-color: black;\n background-color: rgba(0, 0, 0, 0.4);\n left: 0;\n opacity: 0;\n overflow-y: hide;\n position: absolute;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: 3;\n width: 100%;\n height: 9999px; }\n .modal[data-show=\"true\"] {\n opacity: 1; }\n\n.modal-content {\n border-radius: 0.5em;\n background-color: #fefefe;\n margin: 5% 1rem;\n border: 1px solid #888;\n overflow: hidden;\n max-width: 800px;\n padding: 20px;\n position: relative; }\n @media screen and (min-width: 601px) {\n .modal-content {\n margin: 5% auto;\n width: 400px; } }\n .modal-content h3 {\n color: #333;\n font-size: 1.25em;\n font-weight: bold;\n margin-bottom: 0.5em;\n padding: 5px 0;\n text-align: center;\n text-transform: uppercase; }\n\n.modal-close-button {\n color: #84c6e2;\n font-size: 2em;\n font-weight: bold;\n left: 0;\n padding: 16px 0 0 25px;\n position: absolute;\n top: 0; }\n\n.modal-close-button:hover {\n color: black;\n text-decoration: none;\n cursor: pointer; }\n\n/* class specific */\n.movie-modal label,\n.playlist-modal label {\n display: block;\n margin: 1em 0 0.25em; }\n\n.movie-modal .inputtext,\n.playlist-modal .inputtext {\n width: 100%;\n margin-bottom: 1em; }\n\n.settings-modal a {\n display: inline-block;\n padding: 0.5em 0; }\n\n.settings-modal ._share {\n display: -webkit-box;\n display: -moz-box;\n display: -ms-flexbox;\n display: -webkit-flex;\n display: flex;\n margin-top: 0.25em; }\n .settings-modal ._share .inputtext {\n border-radius: 2px 0 0 2px;\n border-right: 0;\n margin: 0; }\n .settings-modal ._share button {\n border-radius: 0 2px 2px 0;\n width: auto; }\n .settings-modal ._share button._success {\n background: #66bb6a; }\n\n.apple-tv {\n height: 100vh;\n position: fixed; }\n .apple-tv .modal-content {\n background: #000 linear-gradient(315deg, #555, #3e91cc, #888);\n border: 0;\n border-radius: 0;\n color: #fff;\n height: 100%;\n margin: 0 !important;\n max-width: unset;\n width: auto;\n -webkit-align-items: center;\n align-items: center;\n display: -webkit-box;\n display: -moz-box;\n display: -ms-flexbox;\n display: -webkit-flex;\n display: flex;\n -moz-flex-direction: column;\n -webkit-flex-direction: column;\n flex-direction: column;\n -webkit-justify-content: center;\n -moz-justify-content: center;\n justify-content: center; }\n .apple-tv .modal-content h3,\n .apple-tv .modal-content button {\n text-transform: none; }\n .apple-tv .modal-content h3 {\n color: inherit;\n font-size: 2em;\n margin-bottom: 0; }\n .apple-tv .modal-content .key {\n background: #fff;\n border-radius: 0.5em;\n box-shadow: 0 0 50px rgba(0, 0, 0, 0.25);\n box-sizing: border-box;\n color: #555;\n font-size: 1.5em;\n font-weight: bold;\n margin: 1em 0;\n padding: 1em;\n max-width: 500px;\n width: 100%; }\n .apple-tv .modal-content button {\n border-radius: 0.5em;\n padding: 1em 2em;\n margin-top: 1.5em;\n min-width: 200px;\n width: auto; }\n .apple-tv .modal-close-button {\n display: none; }\n\n.playlist-item {\n display: -webkit-box;\n display: -moz-box;\n display: -ms-flexbox;\n display: -webkit-flex;\n display: flex;\n -moz-flex-grow: 1;\n -webkit-flex-grow: 1;\n flex-grow: 1; }\n .playlist-item .view {\n -webkit-align-items: center;\n align-items: center;\n display: -webkit-box;\n display: -moz-box;\n display: -ms-flexbox;\n display: -webkit-flex;\n display: flex;\n background-color: gray;\n border: 5px solid #fff;\n border-width: 0 5px;\n overflow: hidden;\n position: relative;\n -moz-flex-grow: 1;\n -webkit-flex-grow: 1;\n flex-grow: 1;\n -moz-flex: 1;\n -webkit-flex: 1;\n -ms-flex: 1;\n flex: 1; }\n .playlist-item .view .stage {\n padding-bottom: 56.25%;\n position: relative;\n width: 100%; }\n .playlist-item .view .stage .image-view {\n background-repeat: no-repeat;\n background-position: 50% 50%;\n background-size: contain; }\n .playlist-item .view .stage .image-view,\n .playlist-item .view .stage video {\n bottom: 0;\n left: 0;\n position: absolute;\n right: 0;\n top: 0; }\n .playlist-item .pane {\n width: 200px; }\n .playlist-item .pane > div {\n border-top: 1px solid #f4f4ec;\n padding: 1em; }\n .playlist-item .pane label {\n color: #555;\n padding-bottom: 0.5em; }\n\n.react-dropzone-s3-uploader {\n -webkit-align-items: center;\n align-items: center;\n display: -webkit-box;\n display: -moz-box;\n display: -ms-flexbox;\n display: -webkit-flex;\n display: flex;\n -moz-flex-direction: column;\n -webkit-flex-direction: column;\n flex-direction: column;\n -webkit-justify-content: center;\n -moz-justify-content: center;\n justify-content: center;\n border: 2px dashed #3378aa;\n border-radius: 1em; }\n .react-dropzone-s3-uploader:before {\n display: block;\n color: #3378aa;\n content: \"+\";\n font-size: 2em;\n font-weight: bold;\n line-height: 1em; }\n .react-dropzone-s3-uploader:after {\n display: block;\n color: #3378aa;\n content: \"Drop image or video\";\n font-size: 0.75em;\n padding: 0 0.5em; }\n", "", {"version":3,"sources":["/Users/bryceredd/crumbl/websites/menu.crumbl.com/client/style/client/style/reset.scss","/Users/bryceredd/crumbl/websites/menu.crumbl.com/client/style/client/style/global.scss","/Users/bryceredd/crumbl/websites/menu.crumbl.com/client/style/client/style/colors.scss","/Users/bryceredd/crumbl/websites/menu.crumbl.com/client/style/client/style/login.scss","/Users/bryceredd/crumbl/websites/menu.crumbl.com/client/style/client/style/main.scss","/Users/bryceredd/crumbl/websites/menu.crumbl.com/client/style/client/style/modal.scss","/Users/bryceredd/crumbl/websites/menu.crumbl.com/client/style/client/style/playlist-item.scss","/Users/bryceredd/crumbl/websites/menu.crumbl.com/client/style/client/style/react-dropzone-s3-uploader.scss"],"names":[],"mappings":"AAAA,WAAW;AAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiFE,UAAS;EACT,WAAU;EACV,UAAS;EACT,gBAAe;EACf,cAAa;EACb,yBAAwB,EACzB;;AAED;;;;;;;;;;;EAWE,eAAc,EACf;;AAED;EACE,eAAc,EACf;;AAED;;EAEE,iBAAgB,EACjB;;AAED;;EAEE,aAAY,EACb;;AAED;EAGI,YAAW;EACX,cAAa,EACd;;AAGH;EAGI,YAAW;EACX,cAAa,EACd;;AAGH;EACE,0BAAyB;EACzB,kBAAiB,EAClB;;AAED;EACE,cAAa,EACd;;AAgFD;EACE,iBAAgB;EAChB,aAAY;EACZ,eAAc;EACd,YAAW,EACZ;;ACnOD;EACE,oIAC6B,EAC9B;;AAED;EACE,eCNqB;EDOrB,sBAAqB,EACtB;;AAED;;EAEE,mBAAkB;EAClB,uBAAsB;EACtB,eAAc,EACf;;AAED;EACE,uBAAsB;EACtB,eAAc;EACd,gBAAe,EAChB;;AAED;EACE,oBCxBqB;EDyBrB,UAAS;EACT,eCvBmB;EDwBnB,eAAc;EACd,kBAAiB;EACjB,kBAAiB;EACjB,mBAAkB;EAClB,mBAAkB;EAClB,0BAAyB;EACzB,YAAW,EAKZ;EAfD;IAaI,iBAAgB,EACjB;;AAGH;EDkKE,4BCjK2B;EDkK3B,oBClK2B;EDwG3B,qBAAoB;EACpB,kBAAiB;EACjB,qBAAoB;EACpB,sBAAqB;EACrB,cAAa;EA0Db,gCCpK+B;EDqK/B,6BCrK+B;EDsK/B,wBCtK+B;EAC/B,qCAAoC;EACpC,2BC7CqB;ED8CrB,qBAAoB;EACpB,eC/CqB;EDgDrB,eAAc;EACd,kBAAiB;EACjB,oBAAmB;EACnB,cAAa;EACb,iBAAgB;EAChB,mBAAkB;EAClB,aAAY,EAmBb;EAjCD;IAiBI,UAAS;IACT,aAAY;IACZ,gBAAe;IACf,QAAO;IACP,WAAU;IACV,mBAAkB;IAClB,SAAQ;IACR,OAAM,EACP;EAzBH;IA4BI,YAAW;IACX,eAAc;IACd,kBAAiB;IACjB,oBAAmB,EACpB;;AAGH;EACE,mBAAkB;EASlB,YAAW,EACZ;EAXD;IAGI,sBAAqB;IACrB,iBAAgB,EACjB;EALH;IAOI,eAAc;IACd,iBAAgB,EACjB;;AAIH;EACE,YAAW;EACX,kBAAiB;EACjB,kBAAiB,EAClB;;AAED;EACE,mCAAkC;EAClC,2CAA0C;EAC1C,8BChGsB;EDiGtB,mBAAkB;EAClB,sBAAqB;EACrB,aAAY;EACZ,YAAW,EACZ;;AAED;EACE;IACE,wBAAuB,EAAA;EAEzB;IACE,0BAAyB,EAAA,EAAA;;AAI7B;EDyFE,4BCvF6B;EDwF7B,oBCxF6B;ED8B7B,qBAAoB;EACpB,kBAAiB;EACjB,qBAAoB;EACpB,sBAAqB;EACrB,cAAa,EC3BZ;EATH;IAMM,iBAAgB;IAChB,oBAAmB,EACpB;;AAIL;ED6EE,4BC5E2B;ED6E3B,oBC7E2B;EDmB3B,qBAAoB;EACpB,kBAAiB;EACjB,qBAAoB;EACpB,sBAAqB;EACrB,cAAa;EA0Db,uCC/EsC;EDgFtC,oCChFsC;EDiFtC,+BCjFsC,EAOvC;EAVD;IAMI,iBAAgB;IAChB,sBAAqB;IACrB,YAAW,EACZ;;AAGH;EACE,eAAc,EACf;;AAED;EAEI,mBAAkB;EAClB,YAAW,EACZ;;AEjJH;EACE,gFAA+E;EAC/E,2BAA0B;EAC1B,0BAAyB;EACzB,YAAW;EACX,kBAAiB;EHqMjB,4BGnM2B;EHoM3B,oBGpM2B;EH0I3B,qBAAoB;EACpB,kBAAiB;EACjB,qBAAoB;EACpB,sBAAqB;EACrB,cAAa;EAUb,4BGtJ8B;EHuJ9B,+BGvJ8B;EHwJ9B,uBGxJ8B;EHsM9B,gCGrM+B;EHsM/B,6BGtM+B;EHuM/B,wBGvM+B,EAChC;;AAED;EACE,iBAAgB;EAChB,qBAAoB;EACpB,uBAAsB;EACtB,YAAW;EACX,qBAAoB;EACpB,iBAAgB;EAChB,aAAY;EACZ,WAAU,EA2CX;EHquBG;IGxxBJ;MAWI,WAAU,EAwCb,EAAA;EAnDD;IAeI,eAAc;IACd,kBAAiB;IACjB,mBAAkB,EACnB;EAlBH;IAqBI,eAAc;IACd,qBAAoB,EAWrB;IAjCH;MH6LE,4BGpK+B;MHqK/B,oBGrK+B;MH2G/B,qBAAoB;MACpB,kBAAiB;MACjB,qBAAoB;MACpB,sBAAqB;MACrB,cAAa,EGxGV;MAhCL;QA6BQ,iBAAgB;QAChB,oBAAmB,EACpB;EA/BP;IAoCI,YAAW,EACZ;EArCH;IAwCI,kBAAiB;IACjB,uBAAsB;IACtB,cAAa;IACb,0BAAyB,EAC1B;EA5CH;IA+CI,eAAc;IACd,eAAc;IACd,mBAAkB,EACnB;;AC/DH;EJiJE,qBAAoB;EACpB,kBAAiB;EACjB,qBAAoB;EACpB,sBAAqB;EACrB,cAAa;EAUb,4BI7J8B;EJ8J9B,+BI9J8B;EJ+J9B,uBI/J8B;EAC9B,cAAa,EACd;;AAED;EACE,oEAAmE;EACnE,4DAA2D,EAC5D;;AACD;EACE;IACE,+BAA8B,EAAA;EAEhC;IACE,2BAA0B,EAAA,EAAA;;AAG9B;EACE;IACE,+BAA8B,EAAA;EAEhC;IACE,2BAA0B,EAAA,EAAA;;AAI9B;EACE,YAAW;EACX,cAAa;EJoJb,oBInJsB;EJoJtB,uBIpJsB;EJqJtB,eIrJsB,EAavB;EAhBD;IAMI,aAAY;IACZ,cAAa;IACb,yBAAwB,EACzB;EATH;IJ+KE,4BInK6B;IJoK7B,oBIpK6B;IJoI7B,kBInIsB;IJoItB,qBIpIsB;IJqItB,aIrIsB;IJyGtB,qBAAoB;IACpB,kBAAiB;IACjB,qBAAoB;IACpB,sBAAqB;IACrB,cAAa,EI3GZ;;AAGH;EACE,aAAY;EACZ,aAAY,EACb;;AAED;EACE,aAAY,EACb;;AAED;EJ2FE,qBAAoB;EACpB,kBAAiB;EACjB,qBAAoB;EACpB,sBAAqB;EACrB,cAAa;EAsBb,kBInHoB;EJoHpB,qBIpHoB;EJqHpB,aIrHoB,EA2FrB;EA7FD;IJ2FE,qBAAoB;IACpB,kBAAiB;IACjB,qBAAoB;IACpB,sBAAqB;IACrB,cAAa;IAUb,4BInGgC;IJoGhC,+BIpGgC;IJqGhC,uBIrGgC;IJqHhC,oBIpHwB;IJqHxB,uBIrHwB;IJsHxB,eItHwB;IJkJxB,uCIjJwC;IJkJxC,oCIlJwC;IJmJxC,+BInJwC;IACtC,oBAAmB;IACnB,mBAAkB;IAClB,iBAAgB;IAChB,yBAAwB,EAiDzB;IA7DH;MAeM,mBAAkB,EAoCnB;MAnDL;QJ2FE,qBAAoB;QACpB,kBAAiB;QACjB,qBAAoB;QACpB,sBAAqB;QACrB,cAAa;QAqDb,8BIjImC;QJkInC,sBIlImC;QAC7B,YAAW,EACZ;MArBP;QAwBQ,uBAAsB;QACtB,6BAA4B;QAC5B,6BAA4B;QAC5B,0BF7Ee;QE8Ef,0BAAyB;QACzB,eAAc;QACd,cAAa;QACb,mBAAkB;QAClB,aAAY,EACb;MAjCP;QAoCQ,oBF1Fe,EEoGhB;QA9CP;UAuCU,sBAAqB;UACrB,iBAAgB,EACjB;QAzCT;UA4CU,YAAW,EACZ;MA7CT;QAiDQ,mBAAkB,EACnB;IJ6rBH;MI/uBJ;QAsDM,wBAAuB,EAO1B;QA7DH;UAyDQ,aAAY;UACZ,YAAW,EACZ,EAAA;EA3DP;IAgEI,oBFlHmB;IEmHnB,0BFpHiB;IEqHjB,0BAAyB;IACzB,aAAY;IACZ,mBAAkB,EAwBnB;IA5FH;MAuEM,gBAAe,EAChB;IAxEL;MA2EM,uBAAsB;MACtB,YAAW,EACZ;IA7EL;MAgFM,mBAAkB;MAClB,UAAS;MACT,QAAO;MACP,SAAQ;MACR,YAAW;MACX,iBAAgB,EAMjB;MA3FL;QAwFQ,aAAY;QACZ,oBF/Ie,EEgJhB;;AAKP;EACE,cAAa;EACb,aAAY,EACb;;AAED;EACE,mCAAkC,EACnC;;AC5JD;EACE,wBAA8B;EAC9B,qCAAoC;EACpC,QAAO;EACP,WAAU;EACV,iBAAgB;EAChB,mBAAkB;EAClB,SAAQ;EACR,OAAM;EACN,UAAS;EACT,WAAU;EAEV,YAAW;EACX,eAAc,EAKf;EAlBD;IAgBI,WAAU,EACX;;AAGH;EACE,qBAAoB;EACpB,0BAAyB;EACzB,gBAAe;EACf,uBAAsB;EACtB,iBAAgB;EAChB,iBAAgB;EAChB,cAAa;EACb,mBAAkB,EAgBnB;EAdC;IAVF;MAWI,gBAAe;MACf,aAAY,EAYf,EAAA;EAxBD;IAgBI,YAAW;IACX,kBAAiB;IACjB,kBAAiB;IACjB,qBAAoB;IACpB,eAAc;IACd,mBAAkB;IAClB,0BAAyB,EAC1B;;AAGH;EACE,eH9CsB;EG+CtB,eAAc;EACd,kBAAiB;EACjB,QAAO;EACP,uBAAsB;EACtB,mBAAkB;EAClB,OAAM,EACP;;AACD;EACE,aAAY;EACZ,sBAAqB;EACrB,gBAAe,EAChB;;AAED,oBAAoB;AAEpB;;EAGI,eAAc;EACd,qBAAoB,EACrB;;AALH;;EAOI,YAAW;EACX,mBAAkB,EACnB;;AAGH;EAEI,sBAAqB;EACrB,iBAAgB,EACjB;;AAJH;ELsEE,qBAAoB;EACpB,kBAAiB;EACjB,qBAAoB;EACpB,sBAAqB;EACrB,cAAa;EKnEX,mBAAkB,EAgBnB;EAvBH;IAUM,2BAA0B;IAC1B,gBAAe;IACf,UAAS,EACV;EAbL;IAgBM,2BAA0B;IAC1B,YAAW,EAKZ;IAtBL;MAoBQ,oBAAmB,EACpB;;AAKP;EACE,cAAa;EACb,gBAAe,EAqDhB;EAvDD;IAKI,8DAA6D;IAC7D,UAAS;IACT,iBAAgB;IAChB,YAAW;IACX,aAAY;IACZ,qBAAoB;IACpB,iBAAgB;IAChB,YAAW;ILyFb,4BKvF6B;ILwF7B,oBKxF6B;IL8B7B,qBAAoB;IACpB,kBAAiB;IACjB,qBAAoB;IACpB,sBAAqB;IACrB,cAAa;IAUb,4BK1CgC;IL2ChC,+BK3CgC;IL4ChC,uBK5CgC;IL0FhC,gCKzFiC;IL0FjC,6BK1FiC;IL2FjC,wBK3FiC,EAiChC;IAlDH;;MAqBM,qBAAoB,EACrB;IAtBL;MAwBM,eAAc;MACd,eAAc;MACd,iBAAgB,EACjB;IA3BL;MA8BM,iBAAgB;MAChB,qBAAoB;MACpB,yCAAwC;MACxC,uBAAsB;MACtB,YAAW;MACX,iBAAgB;MAChB,kBAAiB;MACjB,cAAa;MACb,aAAY;MACZ,iBAAgB;MAChB,YAAW,EACZ;IAzCL;MA4CM,qBAAoB;MACpB,iBAAgB;MAChB,kBAAiB;MACjB,iBAAgB;MAChB,YAAW,EACZ;EAjDL;IAqDI,cAAa,EACd;;AC3JH;ENiJE,qBAAoB;EACpB,kBAAiB;EACjB,qBAAoB;EACpB,sBAAqB;EACrB,cAAa;EAsBb,kBMzKoB;EN0KpB,qBM1KoB;EN2KpB,aM3KoB,EAgDrB;EAlDD;IN0ME,4BMrM6B;INsM7B,oBMtM6B;IN4I7B,qBAAoB;IACpB,kBAAiB;IACjB,qBAAoB;IACpB,sBAAqB;IACrB,cAAa;IM9IX,uBAAsB;IACtB,uBAAsB;IACtB,oBAAmB;IACnB,iBAAgB;IAChB,mBAAkB;INgKpB,kBM/JsB;INgKtB,qBMhKsB;INiKtB,aMjKsB;INuLtB,aMtLiB;INuLjB,gBMvLiB;INwLjB,YMxLiB;INyLjB,QMzLiB,EAsBhB;IAnCH;MAgBM,uBAAsB;MACtB,mBAAkB;MAClB,YAAW,EAgBZ;MAlCL;QAqBQ,6BAA4B;QAC5B,6BAA4B;QAC5B,yBAAwB,EACzB;MAxBP;;QA4BQ,UAAS;QACT,QAAO;QACP,mBAAkB;QAClB,SAAQ;QACR,OAAM,EACP;EAjCP;IAsCI,aAAY,EAWb;IAjDH;MAyCM,8BJtCe;MIuCf,aAAY,EACb;IA3CL;MA8CM,YAAW;MACX,sBAAqB,EACtB;;AChDL;EP0ME,4BOzM2B;EP0M3B,oBO1M2B;EPgJ3B,qBAAoB;EACpB,kBAAiB;EACjB,qBAAoB;EACpB,sBAAqB;EACrB,cAAa;EAUb,4BO5J8B;EP6J9B,+BO7J8B;EP8J9B,uBO9J8B;EP4M9B,gCO3M+B;EP4M/B,6BO5M+B;EP6M/B,wBO7M+B;EAC/B,2BLLqB;EKMrB,mBAAkB,EAkBnB;EAxBD;IASI,eAAc;IACd,eLVmB;IKWnB,aAAY;IACZ,eAAc;IACd,kBAAiB;IACjB,iBAAgB,EACjB;EAfH;IAkBI,eAAc;IACd,eLnBmB;IKoBnB,+BAA8B;IAC9B,kBAAiB;IACjB,iBAAgB,EACjB","file":"app.scss","sourcesContent":["/* reset */\n\nhtml,\nbody,\ndiv,\nspan,\napplet,\nobject,\niframe,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\np,\nblockquote,\npre,\na,\nabbr,\nacronym,\naddress,\nbig,\ncite,\ncode,\ndel,\ndfn,\nem,\nimg,\nins,\nkbd,\nq,\ns,\nsamp,\nsmall,\nstrike,\nstrong,\nsub,\nsup,\ntt,\nvar,\nb,\nu,\ni,\ncenter,\ndl,\ndt,\ndd,\nol,\nul,\nli,\nfieldset,\nform,\nlabel,\nlegend,\ntable,\ncaption,\ntbody,\ntfoot,\nthead,\ntr,\nth,\ntd,\narticle,\naside,\ncanvas,\ndetails,\nembed,\nfigure,\nfigcaption,\nfooter,\nheader,\nhgroup,\nmenu,\nnav,\noutput,\nruby,\nsection,\nsummary,\ntime,\nmark,\naudio,\nvideo {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n}\n\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmenu,\nnav,\nsection {\n display: block;\n}\n\nbody {\n line-height: 1;\n}\n\nol,\nul {\n list-style: none;\n}\n\nblockquote,\nq {\n quotes: none;\n}\n\nblockquote {\n &:before,\n &:after {\n content: \"\";\n content: none;\n }\n}\n\nq {\n &:before,\n &:after {\n content: \"\";\n content: none;\n }\n}\n\ntable {\n border-collapse: collapse;\n border-spacing: 0;\n}\n\n* {\n outline: none;\n}\n\n@mixin display-flex() {\n display: -webkit-box;\n display: -moz-box;\n display: -ms-flexbox;\n display: -webkit-flex;\n display: flex;\n}\n\n@mixin flex-basis($basis) {\n -moz-flex-basis: $basis;\n -webkit-flex-basis: $basis;\n flex-basis: $basis;\n}\n\n@mixin flex-direction($direction) {\n -moz-flex-direction: $direction;\n -webkit-flex-direction: $direction;\n flex-direction: $direction;\n}\n\n@mixin flex-flow($flow) {\n -moz-flex-flow: $flow;\n -webkit-flex-flow: $flow;\n flex-flow: $flow;\n}\n\n@mixin flex-grow($grow) {\n -moz-flex-grow: $grow;\n -webkit-flex-grow: $grow;\n flex-grow: $grow;\n}\n\n@mixin flex-shrink($shrink) {\n -moz-flex-shrink: $shrink;\n -webkit-flex-shrink: $shrink;\n flex-shrink: $shrink;\n}\n\n@mixin flex-wrap($wrap) {\n -moz-flex-wrap: $wrap;\n -webkit-flex-wrap: $wrap;\n flex-wrap: $wrap;\n}\n\n@mixin flex-order($order) {\n -moz-order: $order;\n -webkit-order: $order;\n order: $order;\n}\n\n@mixin flex($flex) {\n -moz-flex: $flex;\n -webkit-flex: $flex;\n -ms-flex: $flex;\n flex: $flex;\n}\n\n@mixin align-items($align) {\n -webkit-align-items: $align;\n align-items: $align;\n}\n\n@mixin justify-content($justify) {\n -webkit-justify-content: $justify;\n -moz-justify-content: $justify;\n justify-content: $justify;\n}\n\n@mixin align-content($align) {\n -webkit-align-content: $align;\n align-content: $align;\n}\n\n@mixin align-self($align) {\n -webkit-align-self: $align;\n align-self: $align;\n}\n\nbutton {\n background: none;\n border: none;\n font-size: 1em;\n color: blue;\n}\n\n@charset \"UTF-8\";\n\n// _ _ _ _ _\n// (_) | | | | | (_)\n// _ _ __ ___| |_ _ __| | ___ _ __ ___ ___ __| |_ __ _\n// | | '_ \\ / __| | | | |/ _` |/ _ \\ | '_ ` _ \\ / _ \\/ _` | |/ _` |\n// | | | | | (__| | |_| | (_| | __/ | | | | | | __/ (_| | | (_| |\n// |_|_| |_|\\___|_|\\__,_|\\__,_|\\___| |_| |_| |_|\\___|\\__,_|_|\\__,_|\n//\n// Simple, elegant and maintainable media queries in Sass\n// v1.4.9\n//\n// http://include-media.com\n//\n// Authors: Eduardo Boucas (@eduardoboucas)\n// Hugo Giraudel (@hugogiraudel)\n//\n// This project is licensed under the terms of the MIT license\n\n////\n/// include-media library public configuration\n/// @author Eduardo Boucas\n/// @access public\n////\n\n///\n/// Creates a list of global breakpoints\n///\n/// @example scss - Creates a single breakpoint with the label `phone`\n/// $breakpoints: ('phone': 320px);\n///\n$breakpoints: (\n \"phone\": 401px,\n \"tablet\": 768px,\n \"desktop\": 1024px\n) !default;\n\n///\n/// Creates a list of static expressions or media types\n///\n/// @example scss - Creates a single media type (screen)\n/// $media-expressions: ('screen': 'screen');\n///\n/// @example scss - Creates a static expression with logical disjunction (OR operator)\n/// $media-expressions: (\n/// 'retina2x': '(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)'\n/// );\n///\n$media-expressions: (\n \"screen\": \"screen\",\n \"print\": \"print\",\n \"handheld\": \"handheld\",\n \"landscape\": \"(orientation: landscape)\",\n \"portrait\": \"(orientation: portrait)\",\n \"retina2x\": \"(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi), (min-resolution: 2dppx)\",\n \"retina3x\": \"(-webkit-min-device-pixel-ratio: 3), (min-resolution: 350dpi), (min-resolution: 3dppx)\"\n) !default;\n\n///\n/// Defines a number to be added or subtracted from each unit when declaring breakpoints with exclusive intervals\n///\n/// @example scss - Interval for pixels is defined as `1` by default\n/// @include media('>128px') {}\n///\n/// /* Generates: */\n/// @media (min-width: 129px) {}\n///\n/// @example scss - Interval for ems is defined as `0.01` by default\n/// @include media('>20em') {}\n///\n/// /* Generates: */\n/// @media (min-width: 20.01em) {}\n///\n/// @example scss - Interval for rems is defined as `0.1` by default, to be used with `font-size: 62.5%;`\n/// @include media('>2.0rem') {}\n///\n/// /* Generates: */\n/// @media (min-width: 2.1rem) {}\n///\n$unit-intervals: (\n \"px\": 1,\n \"em\": 0.01,\n \"rem\": 0.1,\n \"\": 0\n) !default;\n\n///\n/// Defines whether support for media queries is available, useful for creating separate stylesheets\n/// for browsers that don't support media queries.\n///\n/// @example scss - Disables support for media queries\n/// $im-media-support: false;\n/// @include media('>=tablet') {\n/// .foo {\n/// color: tomato;\n/// }\n/// }\n///\n/// /* Generates: */\n/// .foo {\n/// color: tomato;\n/// }\n///\n$im-media-support: true !default;\n\n///\n/// Selects which breakpoint to emulate when support for media queries is disabled. Media queries that start at or\n/// intercept the breakpoint will be displayed, any others will be ignored.\n///\n/// @example scss - This media query will show because it intercepts the static breakpoint\n/// $im-media-support: false;\n/// $im-no-media-breakpoint: 'desktop';\n/// @include media('>=tablet') {\n/// .foo {\n/// color: tomato;\n/// }\n/// }\n///\n/// /* Generates: */\n/// .foo {\n/// color: tomato;\n/// }\n///\n/// @example scss - This media query will NOT show because it does not intercept the desktop breakpoint\n/// $im-media-support: false;\n/// $im-no-media-breakpoint: 'tablet';\n/// @include media('>=desktop') {\n/// .foo {\n/// color: tomato;\n/// }\n/// }\n///\n/// /* No output */\n///\n$im-no-media-breakpoint: \"desktop\" !default;\n\n///\n/// Selects which media expressions are allowed in an expression for it to be used when media queries\n/// are not supported.\n///\n/// @example scss - This media query will show because it intercepts the static breakpoint and contains only accepted media expressions\n/// $im-media-support: false;\n/// $im-no-media-breakpoint: 'desktop';\n/// $im-no-media-expressions: ('screen');\n/// @include media('>=tablet', 'screen') {\n/// .foo {\n/// color: tomato;\n/// }\n/// }\n///\n/// /* Generates: */\n/// .foo {\n/// color: tomato;\n/// }\n///\n/// @example scss - This media query will NOT show because it intercepts the static breakpoint but contains a media expression that is not accepted\n/// $im-media-support: false;\n/// $im-no-media-breakpoint: 'desktop';\n/// $im-no-media-expressions: ('screen');\n/// @include media('>=tablet', 'retina2x') {\n/// .foo {\n/// color: tomato;\n/// }\n/// }\n///\n/// /* No output */\n///\n$im-no-media-expressions: (\"screen\", \"portrait\", \"landscape\") !default;\n\n////\n/// Cross-engine logging engine\n/// @author Hugo Giraudel\n/// @access private\n////\n\n///\n/// Log a message either with `@error` if supported\n/// else with `@warn`, using `feature-exists('at-error')`\n/// to detect support.\n///\n/// @param {String} $message - Message to log\n///\n@function im-log($message) {\n @if feature-exists(\"at-error\") {\n @error $message;\n } @else {\n @warn $message;\n $_: noop();\n }\n\n @return $message;\n}\n\n///\n/// Wrapper mixin for the log function so it can be used with a more friendly\n/// API than `@if im-log('..') {}` or `$_: im-log('..')`. Basically, use the function\n/// within functions because it is not possible to include a mixin in a function\n/// and use the mixin everywhere else because it's much more elegant.\n///\n/// @param {String} $message - Message to log\n///\n@mixin log($message) {\n @if im-log($message) {\n }\n}\n\n///\n/// Function with no `@return` called next to `@warn` in Sass 3.3\n/// to trigger a compiling error and stop the process.\n///\n@function noop() {\n}\n\n///\n/// Determines whether a list of conditions is intercepted by the static breakpoint.\n///\n/// @param {Arglist} $conditions - Media query conditions\n///\n/// @return {Boolean} - Returns true if the conditions are intercepted by the static breakpoint\n///\n@function im-intercepts-static-breakpoint($conditions...) {\n $no-media-breakpoint-value: map-get($breakpoints, $im-no-media-breakpoint);\n\n @if not $no-media-breakpoint-value {\n @if im-log(\"`#{$im-no-media-breakpoint}` is not a valid breakpoint.\") {\n }\n }\n\n @each $condition in $conditions {\n @if not map-has-key($media-expressions, $condition) {\n $operator: get-expression-operator($condition);\n $prefix: get-expression-prefix($operator);\n $value: get-expression-value($condition, $operator);\n\n @if ($prefix == \"max\" and $value <= $no-media-breakpoint-value) or\n ($prefix == \"min\" and $value > $no-media-breakpoint-value)\n {\n @return false;\n }\n } @else if not index($im-no-media-expressions, $condition) {\n @return false;\n }\n }\n\n @return true;\n}\n\n////\n/// Parsing engine\n/// @author Hugo Giraudel\n/// @access private\n////\n\n///\n/// Get operator of an expression\n///\n/// @param {String} $expression - Expression to extract operator from\n///\n/// @return {String} - Any of `>=`, `>`, `<=`, `<`, `≥`, `≤`\n///\n@function get-expression-operator($expression) {\n @each $operator in (\">=\", \">\", \"<=\", \"<\", \"≥\", \"≤\") {\n @if str-index($expression, $operator) {\n @return $operator;\n }\n }\n\n // It is not possible to include a mixin inside a function, so we have to\n // rely on the `im-log(..)` function rather than the `log(..)` mixin. Because\n // functions cannot be called anywhere in Sass, we need to hack the call in\n // a dummy variable, such as `$_`. If anybody ever raise a scoping issue with\n // Sass 3.3, change this line in `@if im-log(..) {}` instead.\n $_: im-log(\"No operator found in `#{$expression}`.\");\n}\n\n///\n/// Get dimension of an expression, based on a found operator\n///\n/// @param {String} $expression - Expression to extract dimension from\n/// @param {String} $operator - Operator from `$expression`\n///\n/// @return {String} - `width` or `height` (or potentially anything else)\n///\n@function get-expression-dimension($expression, $operator) {\n $operator-index: str-index($expression, $operator);\n $parsed-dimension: str-slice($expression, 0, $operator-index - 1);\n $dimension: \"width\";\n\n @if str-length($parsed-dimension) > 0 {\n $dimension: $parsed-dimension;\n }\n\n @return $dimension;\n}\n\n///\n/// Get dimension prefix based on an operator\n///\n/// @param {String} $operator - Operator\n///\n/// @return {String} - `min` or `max`\n///\n@function get-expression-prefix($operator) {\n @return if(index((\"<\", \"<=\", \"≤\"), $operator), \"max\", \"min\");\n}\n\n///\n/// Get value of an expression, based on a found operator\n///\n/// @param {String} $expression - Expression to extract value from\n/// @param {String} $operator - Operator from `$expression`\n///\n/// @return {Number} - A numeric value\n///\n@function get-expression-value($expression, $operator) {\n $operator-index: str-index($expression, $operator);\n $value: str-slice($expression, $operator-index + str-length($operator));\n\n @if map-has-key($breakpoints, $value) {\n $value: map-get($breakpoints, $value);\n } @else {\n $value: to-number($value);\n }\n\n $interval: map-get($unit-intervals, unit($value));\n\n @if not $interval {\n // It is not possible to include a mixin inside a function, so we have to\n // rely on the `im-log(..)` function rather than the `log(..)` mixin. Because\n // functions cannot be called anywhere in Sass, we need to hack the call in\n // a dummy variable, such as `$_`. If anybody ever raise a scoping issue with\n // Sass 3.3, change this line in `@if im-log(..) {}` instead.\n $_: im-log(\"Unknown unit `#{unit($value)}`.\");\n }\n\n @if $operator == \">\" {\n $value: $value + $interval;\n } @else if $operator == \"<\" {\n $value: $value - $interval;\n }\n\n @return $value;\n}\n\n///\n/// Parse an expression to return a valid media-query expression\n///\n/// @param {String} $expression - Expression to parse\n///\n/// @return {String} - Valid media query\n///\n@function parse-expression($expression) {\n // If it is part of $media-expressions, it has no operator\n // then there is no need to go any further, just return the value\n @if map-has-key($media-expressions, $expression) {\n @return map-get($media-expressions, $expression);\n }\n\n $operator: get-expression-operator($expression);\n $dimension: get-expression-dimension($expression, $operator);\n $prefix: get-expression-prefix($operator);\n $value: get-expression-value($expression, $operator);\n\n @return \"(#{$prefix}-#{$dimension}: #{$value})\";\n}\n\n///\n/// Slice `$list` between `$start` and `$end` indexes\n///\n/// @access private\n///\n/// @param {List} $list - List to slice\n/// @param {Number} $start [1] - Start index\n/// @param {Number} $end [length($list)] - End index\n///\n/// @return {List} Sliced list\n///\n@function slice($list, $start: 1, $end: length($list)) {\n @if length($list) < 1 or $start > $end {\n @return ();\n }\n\n $result: ();\n\n @for $i from $start through $end {\n $result: append($result, nth($list, $i));\n }\n\n @return $result;\n}\n\n////\n/// String to number converter\n/// @author Hugo Giraudel\n/// @access private\n////\n\n///\n/// Casts a string into a number\n///\n/// @param {String | Number} $value - Value to be parsed\n///\n/// @return {Number}\n///\n@function to-number($value) {\n @if type-of($value) == \"number\" {\n @return $value;\n } @else if type-of($value) != \"string\" {\n $_: im-log(\"Value for `to-number` should be a number or a string.\");\n }\n\n $first-character: str-slice($value, 1, 1);\n $result: 0;\n $digits: 0;\n $minus: ($first-character == \"-\");\n $numbers: (\n \"0\": 0,\n \"1\": 1,\n \"2\": 2,\n \"3\": 3,\n \"4\": 4,\n \"5\": 5,\n \"6\": 6,\n \"7\": 7,\n \"8\": 8,\n \"9\": 9\n );\n\n // Remove +/- sign if present at first character\n @if ($first-character == \"+\" or $first-character == \"-\") {\n $value: str-slice($value, 2);\n }\n\n @for $i from 1 through str-length($value) {\n $character: str-slice($value, $i, $i);\n\n @if not(index(map-keys($numbers), $character) or $character == \".\") {\n @return to-length(if($minus, -$result, $result), str-slice($value, $i));\n }\n\n @if $character == \".\" {\n $digits: 1;\n } @else if $digits == 0 {\n $result: $result * 10 + map-get($numbers, $character);\n } @else {\n $digits: $digits * 10;\n $result: $result + map-get($numbers, $character) / $digits;\n }\n }\n\n @return if($minus, -$result, $result);\n}\n\n///\n/// Add `$unit` to `$value`\n///\n/// @param {Number} $value - Value to add unit to\n/// @param {String} $unit - String representation of the unit\n///\n/// @return {Number} - `$value` expressed in `$unit`\n///\n@function to-length($value, $unit) {\n $units: (\n \"px\": 1px,\n \"cm\": 1cm,\n \"mm\": 1mm,\n \"%\": 1%,\n \"ch\": 1ch,\n \"pc\": 1pc,\n \"in\": 1in,\n \"em\": 1em,\n \"rem\": 1rem,\n \"pt\": 1pt,\n \"ex\": 1ex,\n \"vw\": 1vw,\n \"vh\": 1vh,\n \"vmin\": 1vmin,\n \"vmax\": 1vmax\n );\n\n @if not index(map-keys($units), $unit) {\n $_: im-log(\"Invalid unit `#{$unit}`.\");\n }\n\n @return $value * map-get($units, $unit);\n}\n\n///\n/// This mixin aims at redefining the configuration just for the scope of\n/// the call. It is helpful when having a component needing an extended\n/// configuration such as custom breakpoints (referred to as tweakpoints)\n/// for instance.\n///\n/// @author Hugo Giraudel\n///\n/// @param {Map} $tweakpoints [()] - Map of tweakpoints to be merged with `$breakpoints`\n/// @param {Map} $tweak-media-expressions [()] - Map of tweaked media expressions to be merged with `$media-expression`\n///\n/// @example scss - Extend the global breakpoints with a tweakpoint\n/// @include media-context(('custom': 678px)) {\n/// .foo {\n/// @include media('>phone', '<=custom') {\n/// // ...\n/// }\n/// }\n/// }\n///\n/// @example scss - Extend the global media expressions with a custom one\n/// @include media-context($tweak-media-expressions: ('all': 'all')) {\n/// .foo {\n/// @include media('all', '>phone') {\n/// // ...\n/// }\n/// }\n/// }\n///\n/// @example scss - Extend both configuration maps\n/// @include media-context(('custom': 678px), ('all': 'all')) {\n/// .foo {\n/// @include media('all', '>phone', '<=custom') {\n/// // ...\n/// }\n/// }\n/// }\n///\n@mixin media-context($tweakpoints: (), $tweak-media-expressions: ()) {\n // Save global configuration\n $global-breakpoints: $breakpoints;\n $global-media-expressions: $media-expressions;\n\n // Update global configuration\n $breakpoints: map-merge($breakpoints, $tweakpoints) !global;\n $media-expressions: map-merge($media-expressions, $tweak-media-expressions) !global;\n\n @content;\n\n // Restore global configuration\n $breakpoints: $global-breakpoints !global;\n $media-expressions: $global-media-expressions !global;\n}\n\n////\n/// include-media public exposed API\n/// @author Eduardo Boucas\n/// @access public\n////\n\n///\n/// Generates a media query based on a list of conditions\n///\n/// @param {Arglist} $conditions - Media query conditions\n///\n/// @example scss - With a single set breakpoint\n/// @include media('>phone') { }\n///\n/// @example scss - With two set breakpoints\n/// @include media('>phone', '<=tablet') { }\n///\n/// @example scss - With custom values\n/// @include media('>=358px', '<850px') { }\n///\n/// @example scss - With set breakpoints with custom values\n/// @include media('>desktop', '<=1350px') { }\n///\n/// @example scss - With a static expression\n/// @include media('retina2x') { }\n///\n/// @example scss - Mixing everything\n/// @include media('>=350px', ' 0) {\n @media #{unquote(parse-expression(nth($conditions, 1)))} {\n // Recursive call\n @include media(slice($conditions, 2)...) {\n @content;\n }\n }\n }\n}\n","body {\n font: 15px \"Avenir\", \"HelveticaNeue-Light\", \"Helvetica Neue Light\", \"Helvetica Neue\", Helvetica, Arial,\n \"Lucida Grande\", sans-serif;\n}\n\na {\n color: $primary-color;\n text-decoration: none;\n}\n\n.inputtext,\nbutton {\n border-radius: 2px;\n box-sizing: border-box;\n font-size: 1em;\n}\n\n.inputtext {\n border: 1px solid #ccc;\n padding: 0.5em;\n max-width: 100%;\n}\n\nbutton {\n background: $primary-color;\n border: 0;\n color: $light-color;\n display: block;\n font-size: 0.95em;\n font-weight: bold;\n padding: 1em 1.5em;\n text-align: center;\n text-transform: uppercase;\n width: 100%;\n\n &.darker {\n background: #555;\n }\n}\n\n.image-upload {\n @include align-items(center);\n @include display-flex();\n @include justify-content(center);\n background: rgba(51, 120, 170, 0.15);\n border: 2px dashed $primary-color;\n border-radius: 0.5em;\n color: $primary-color;\n font-size: 2em;\n font-weight: bold;\n margin-right: 0.5em;\n height: 100px;\n overflow: hidden;\n position: relative;\n width: 100px;\n\n input {\n bottom: 0;\n cursor: hand;\n cursor: pointer;\n left: 0;\n opacity: 0;\n position: absolute;\n right: 0;\n top: 0;\n }\n\n small {\n color: #999;\n display: block;\n font-size: 0.45em;\n font-weight: normal;\n }\n}\n\n.image-uploaded {\n text-align: center;\n img {\n margin-bottom: 0.25em;\n max-width: 100px;\n }\n a {\n color: #2196f3;\n font-size: 0.9em;\n }\n width: auto;\n}\n\n.image-uploaded {\n width: auto;\n max-height: 100px;\n margin-right: 1em;\n}\n\n.loader {\n animation: spin 2s linear infinite;\n border: 4px solid rgba(255, 255, 255, 0.9);\n border-top: 4px solid $lprimary-color;\n border-radius: 50%;\n display: inline-block;\n height: 12px;\n width: 12px;\n}\n\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\nlabel {\n &.checkbox {\n @include align-items(center);\n @include display-flex();\n\n input {\n border-radius: 0;\n margin-right: 0.5em;\n }\n }\n}\n\n.submit-block {\n @include align-items(center);\n @include display-flex();\n @include justify-content(space-between);\n\n button {\n font-size: 0.9em;\n padding: 0.75em 1.5em;\n width: auto;\n }\n}\n\n.red-link {\n color: #e57373;\n}\n\n.settings-modal {\n .inputtext {\n margin-bottom: 1em;\n width: 100%;\n }\n}\n","$primary-color: #3378aa;\n$lprimary-color: #84c6e2;\n$primary-grey-color: #d4dcee;\n$light-color: #f4f4ec;\n$lighter-color: #fcfcf9;\n$accent-color: #e6d9c9;\n",".login-page {\n background: #000 linear-gradient(315deg, #555, #3e91cc, #888) no-repeat 50% 50%;\n background-size: 600% 600%;\n background-repeat: repeat;\n color: #fff;\n min-height: 100vh;\n\n @include align-items(center);\n @include display-flex();\n @include flex-direction(column);\n @include justify-content(center);\n}\n\n.login-form {\n background: #fff;\n border-radius: 0.5em;\n box-sizing: border-box;\n color: #333;\n margin-bottom: 0.5em;\n max-width: 400px;\n padding: 2em;\n width: 90%;\n\n @include media(\">=tablet\") {\n width: 50%;\n }\n\n h2 {\n font-size: 2em;\n font-weight: bold;\n text-align: center;\n }\n\n label {\n display: block;\n margin: 1em 0 0.25em;\n\n &.checkbox {\n @include align-items(center);\n @include display-flex();\n\n input {\n border-radius: 0;\n margin-right: 0.5em;\n }\n }\n }\n\n .inputtext {\n width: 100%;\n }\n\n button {\n font-weight: bold;\n letter-spacing: 0.05em;\n margin: 1em 0;\n text-transform: uppercase;\n }\n\n > a {\n color: inherit;\n display: block;\n text-align: center;\n }\n}\n",".main {\n @include display-flex();\n @include flex-direction(column);\n height: 100vh;\n}\n\n.bg-pan-tl {\n -webkit-animation: bg-pan-tl 8s ease-in-out infinite alternate both;\n animation: bg-pan-tl 8s ease-in-out infinite alternate both;\n}\n@-webkit-keyframes bg-pan-tl {\n 0% {\n background-position: 100% 100%;\n }\n 100% {\n background-position: 0% 0%;\n }\n}\n@keyframes bg-pan-tl {\n 0% {\n background-position: 100% 100%;\n }\n 100% {\n background-position: 0% 0%;\n }\n}\n\n.header {\n width: 100%;\n display: flex;\n @include flex-shrink(0);\n\n button {\n width: 150px;\n padding: 10px;\n margin: 20px 10px 20px 0;\n }\n\n .header-left {\n @include align-items(center);\n @include flex-grow(1);\n @include display-flex();\n }\n}\n\n.Dropdown-root {\n width: 400px;\n margin: 20px;\n}\n\n.Dropdown-control {\n height: 35px;\n}\n\n.presentation {\n @include display-flex();\n @include flex-grow(1);\n\n .thumbnails {\n @include display-flex();\n @include flex-direction(column);\n @include flex-shrink(0);\n @include justify-content(space-between);\n background: #e8dfbd;\n overflow-x: hidden;\n overflow-y: auto;\n width: calc(150px + 2em);\n\n .thumbnail {\n padding: 0.5em 1em;\n\n .content-cnt {\n @include display-flex();\n @include align-items(flex-end);\n color: #777;\n }\n\n .content {\n background-size: cover;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n border: 2px solid $lighter-color;\n box-shadow: 0 0 10px #666;\n display: block;\n height: 100px;\n margin-left: 0.5em;\n width: 150px;\n }\n\n &.active {\n background: $primary-color;\n\n .content {\n border-color: #fbe163;\n box-shadow: none;\n }\n\n .content-cnt {\n color: #fff;\n }\n }\n\n &.dragged span {\n visibility: hidden;\n }\n }\n\n @include media(\" div {\n height: 60px;\n width: 80px;\n }\n }\n }\n\n .add-block {\n background: $lighter-color;\n border: 1px solid $light-color;\n border-width: 1px 1px 0 0;\n padding: 1em;\n position: relative;\n\n button {\n margin-top: 1em;\n }\n\n .image-upload {\n box-sizing: border-box;\n width: 100%;\n }\n\n .progress-bar {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 5px;\n background: #eee;\n\n > div {\n height: 100%;\n background: $primary-color;\n }\n }\n }\n}\n\n.react-dropzone-s3-uploader img {\n height: 100px;\n width: 100px;\n}\n\n.content {\n transition: transform 0.3s ease 0s;\n}\n",".modal {\n background-color: rgb(0, 0, 0);\n background-color: rgba(0, 0, 0, 0.4);\n left: 0;\n opacity: 0;\n overflow-y: hide;\n position: absolute;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: 3;\n\n width: 100%;\n height: 9999px;\n\n &[data-show=\"true\"] {\n opacity: 1;\n }\n}\n\n.modal-content {\n border-radius: 0.5em;\n background-color: #fefefe;\n margin: 5% 1rem;\n border: 1px solid #888;\n overflow: hidden;\n max-width: 800px;\n padding: 20px;\n position: relative;\n\n @media screen and (min-width: 601px) {\n margin: 5% auto;\n width: 400px;\n }\n\n h3 {\n color: #333;\n font-size: 1.25em;\n font-weight: bold;\n margin-bottom: 0.5em;\n padding: 5px 0;\n text-align: center;\n text-transform: uppercase;\n }\n}\n\n.modal-close-button {\n color: $lprimary-color;\n font-size: 2em;\n font-weight: bold;\n left: 0;\n padding: 16px 0 0 25px;\n position: absolute;\n top: 0;\n}\n.modal-close-button:hover {\n color: black;\n text-decoration: none;\n cursor: pointer;\n}\n\n/* class specific */\n\n.movie-modal,\n.playlist-modal {\n label {\n display: block;\n margin: 1em 0 0.25em;\n }\n .inputtext {\n width: 100%;\n margin-bottom: 1em;\n }\n}\n\n.settings-modal {\n a {\n display: inline-block;\n padding: 0.5em 0;\n }\n ._share {\n @include display-flex();\n margin-top: 0.25em;\n\n .inputtext {\n border-radius: 2px 0 0 2px;\n border-right: 0;\n margin: 0;\n }\n\n button {\n border-radius: 0 2px 2px 0;\n width: auto;\n\n &._success {\n background: #66bb6a;\n }\n }\n }\n}\n\n.apple-tv {\n height: 100vh;\n position: fixed;\n\n .modal-content {\n background: #000 linear-gradient(315deg, #555, #3e91cc, #888);\n border: 0;\n border-radius: 0;\n color: #fff;\n height: 100%;\n margin: 0 !important;\n max-width: unset;\n width: auto;\n\n @include align-items(center);\n @include display-flex();\n @include flex-direction(column);\n @include justify-content(center);\n\n h3,\n button {\n text-transform: none;\n }\n h3 {\n color: inherit;\n font-size: 2em;\n margin-bottom: 0;\n }\n\n .key {\n background: #fff;\n border-radius: 0.5em;\n box-shadow: 0 0 50px rgba(0, 0, 0, 0.25);\n box-sizing: border-box;\n color: #555;\n font-size: 1.5em;\n font-weight: bold;\n margin: 1em 0;\n padding: 1em;\n max-width: 500px;\n width: 100%;\n }\n\n button {\n border-radius: 0.5em;\n padding: 1em 2em;\n margin-top: 1.5em;\n min-width: 200px;\n width: auto;\n }\n }\n\n .modal-close-button {\n display: none;\n }\n}\n",".playlist-item {\n @include display-flex();\n @include flex-grow(1);\n\n .view {\n @include align-items(center);\n @include display-flex();\n background-color: gray;\n border: 5px solid #fff;\n border-width: 0 5px;\n overflow: hidden;\n position: relative;\n @include flex-grow(1);\n @include flex(1);\n\n .stage {\n padding-bottom: 56.25%;\n position: relative;\n width: 100%;\n\n .image-view {\n background-repeat: no-repeat;\n background-position: 50% 50%;\n background-size: contain;\n }\n\n .image-view,\n video {\n bottom: 0;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n }\n }\n }\n\n .pane {\n width: 200px;\n\n > div {\n border-top: 1px solid $light-color;\n padding: 1em;\n }\n\n label {\n color: #555;\n padding-bottom: 0.5em;\n }\n }\n}\n",".react-dropzone-s3-uploader {\n @include align-items(center);\n @include display-flex();\n @include flex-direction(column);\n @include justify-content(center);\n border: 2px dashed $primary-color;\n border-radius: 1em;\n\n &:before {\n display: block;\n color: $primary-color;\n content: \"+\";\n font-size: 2em;\n font-weight: bold;\n line-height: 1em;\n }\n\n &:after {\n display: block;\n color: $primary-color;\n content: \"Drop image or video\";\n font-size: 0.75em;\n padding: 0 0.5em;\n }\n}\n"],"sourceRoot":""}]); // exports /***/ }), /***/ "./node_modules/css-loader/index.js?!./node_modules/sass-loader/lib/loader.js?!./node_modules/react-dropdown/style.css": /*!**************************************************************************************************************************************!*\ !*** ./node_modules/css-loader??ref--6-1!./node_modules/sass-loader/lib/loader.js??ref--6-2!./node_modules/react-dropdown/style.css ***! \**************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(/*! ../css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(true); // imports // module exports.push([module.i, ".Dropdown-root {\n position: relative; }\n\n.Dropdown-control {\n position: relative;\n overflow: hidden;\n background-color: white;\n border: 1px solid #ccc;\n border-radius: 2px;\n box-sizing: border-box;\n color: #333;\n cursor: default;\n outline: none;\n padding: 8px 52px 8px 10px;\n transition: all 200ms ease; }\n\n.Dropdown-control:hover {\n box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06); }\n\n.Dropdown-arrow {\n border-color: #999 transparent transparent;\n border-style: solid;\n border-width: 5px 5px 0;\n content: ' ';\n display: block;\n height: 0;\n margin-top: -ceil(2.5);\n position: absolute;\n right: 10px;\n top: 14px;\n width: 0; }\n\n.is-open .Dropdown-arrow {\n border-color: transparent transparent #999;\n border-width: 0 5px 5px; }\n\n.Dropdown-menu {\n background-color: white;\n border: 1px solid #ccc;\n box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);\n box-sizing: border-box;\n margin-top: -1px;\n max-height: 200px;\n overflow-y: auto;\n position: absolute;\n top: 100%;\n width: 100%;\n z-index: 1000;\n -webkit-overflow-scrolling: touch; }\n\n.Dropdown-menu .Dropdown-group > .Dropdown-title {\n padding: 8px 10px;\n color: #333333;\n font-weight: bold;\n text-transform: capitalize; }\n\n.Dropdown-option {\n box-sizing: border-box;\n color: rgba(51, 51, 51, 0.8);\n cursor: pointer;\n display: block;\n padding: 8px 10px; }\n\n.Dropdown-option:last-child {\n border-bottom-right-radius: 2px;\n border-bottom-left-radius: 2px; }\n\n.Dropdown-option:hover {\n background-color: #f2f9fc;\n color: #333; }\n\n.Dropdown-option.is-selected {\n background-color: #f2f9fc;\n color: #333; }\n\n.Dropdown-noresults {\n box-sizing: border-box;\n color: #ccc;\n cursor: default;\n display: block;\n padding: 8px 10px; }\n", "", {"version":3,"sources":["/Users/bryceredd/crumbl/websites/menu.crumbl.com/node_modules/react-dropdown/node_modules/react-dropdown/style.css"],"names":[],"mappings":"AAAA;EACE,mBAAkB,EACnB;;AAED;EACE,mBAAkB;EAClB,iBAAgB;EAChB,wBAAuB;EACvB,uBAAsB;EACtB,mBAAkB;EAClB,uBAAsB;EACtB,YAAW;EACX,gBAAe;EACf,cAAa;EACb,2BAA0B;EAC1B,2BAA0B,EAC3B;;AAED;EACE,wCAAuC,EACxC;;AAED;EACE,2CAA0C;EAC1C,oBAAmB;EACnB,wBAAuB;EACvB,aAAY;EACZ,eAAc;EACd,UAAS;EACT,uBAAsB;EACtB,mBAAkB;EAClB,YAAW;EACX,UAAS;EACT,SACF,EAAC;;AAED;EACE,2CAA0C;EAC1C,wBAAuB,EACxB;;AAED;EACE,wBAAuB;EACvB,uBAAsB;EACtB,wCAAuC;EACvC,uBAAsB;EACtB,iBAAgB;EAChB,kBAAiB;EACjB,iBAAgB;EAChB,mBAAkB;EAClB,UAAS;EACT,YAAW;EACX,cAAa;EACb,kCAAiC,EAClC;;AAED;EACE,kBAAiB;EACjB,eAA0B;EAC1B,kBAAiB;EACjB,2BAA0B,EAC3B;;AAED;EACE,uBAAsB;EACtB,6BAA4B;EAC5B,gBAAe;EACf,eAAc;EACd,kBAAiB,EAClB;;AAED;EACE,gCAA+B;EAC9B,+BAA8B,EAChC;;AAED;EACE,0BAAyB;EACzB,YAAW,EACZ;;AAED;EACE,0BAAyB;EACzB,YAAW,EACZ;;AAED;EACE,uBAAsB;EACtB,YAAW;EACX,gBAAe;EACf,eAAc;EACd,kBAAiB,EAClB","file":"style.css","sourcesContent":[".Dropdown-root {\n position: relative;\n}\n\n.Dropdown-control {\n position: relative;\n overflow: hidden;\n background-color: white;\n border: 1px solid #ccc;\n border-radius: 2px;\n box-sizing: border-box;\n color: #333;\n cursor: default;\n outline: none;\n padding: 8px 52px 8px 10px;\n transition: all 200ms ease;\n}\n\n.Dropdown-control:hover {\n box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);\n}\n\n.Dropdown-arrow {\n border-color: #999 transparent transparent;\n border-style: solid;\n border-width: 5px 5px 0;\n content: ' ';\n display: block;\n height: 0;\n margin-top: -ceil(2.5);\n position: absolute;\n right: 10px;\n top: 14px;\n width: 0\n}\n\n.is-open .Dropdown-arrow {\n border-color: transparent transparent #999;\n border-width: 0 5px 5px;\n}\n\n.Dropdown-menu {\n background-color: white;\n border: 1px solid #ccc;\n box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);\n box-sizing: border-box;\n margin-top: -1px;\n max-height: 200px;\n overflow-y: auto;\n position: absolute;\n top: 100%;\n width: 100%;\n z-index: 1000;\n -webkit-overflow-scrolling: touch;\n}\n\n.Dropdown-menu .Dropdown-group > .Dropdown-title{\n padding: 8px 10px;\n color: rgba(51, 51, 51, 1);\n font-weight: bold;\n text-transform: capitalize;\n}\n\n.Dropdown-option {\n box-sizing: border-box;\n color: rgba(51, 51, 51, 0.8);\n cursor: pointer;\n display: block;\n padding: 8px 10px;\n}\n\n.Dropdown-option:last-child {\n border-bottom-right-radius: 2px;\n border-bottom-left-radius: 2px;\n}\n\n.Dropdown-option:hover {\n background-color: #f2f9fc;\n color: #333;\n}\n\n.Dropdown-option.is-selected {\n background-color: #f2f9fc;\n color: #333;\n}\n\n.Dropdown-noresults {\n box-sizing: border-box;\n color: #ccc;\n cursor: default;\n display: block;\n padding: 8px 10px;\n}\n"],"sourceRoot":""}]); // exports /***/ }), /***/ "./node_modules/css-loader/lib/css-base.js": /*!*************************************************!*\ !*** ./node_modules/css-loader/lib/css-base.js ***! \*************************************************/ /*! no static exports found */ /***/ (function(module, exports) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ // css base code, injected by the css-loader module.exports = function(useSourceMap) { var list = []; // return the list of modules as css string list.toString = function toString() { return this.map(function (item) { var content = cssWithMappingToString(item, useSourceMap); if(item[2]) { return "@media " + item[2] + "{" + content + "}"; } else { return content; } }).join(""); }; // import a list of modules into the list list.i = function(modules, mediaQuery) { if(typeof modules === "string") modules = [[null, modules, ""]]; var alreadyImportedModules = {}; for(var i = 0; i < this.length; i++) { var id = this[i][0]; if(typeof id === "number") alreadyImportedModules[id] = true; } for(i = 0; i < modules.length; i++) { var item = modules[i]; // skip already imported module // this implementation is not 100% perfect for weird media query combinations // when a module is imported multiple times with different media queries. // I hope this will never occur (Hey this way we have smaller bundles) if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { if(mediaQuery && !item[2]) { item[2] = mediaQuery; } else if(mediaQuery) { item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; } list.push(item); } } }; return list; }; function cssWithMappingToString(item, useSourceMap) { var content = item[1] || ''; var cssMapping = item[3]; if (!cssMapping) { return content; } if (useSourceMap && typeof btoa === 'function') { var sourceMapping = toComment(cssMapping); var sourceURLs = cssMapping.sources.map(function (source) { return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' }); return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); } return [content].join('\n'); } // Adapted from convert-source-map (MIT) function toComment(sourceMap) { // eslint-disable-next-line no-undef var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; return '/*# ' + data + ' */'; } /***/ }), /***/ "./node_modules/fast-json-stable-stringify/index.js": /*!**********************************************************!*\ !*** ./node_modules/fast-json-stable-stringify/index.js ***! \**********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function (data, opts) { if (!opts) opts = {}; if (typeof opts === 'function') opts = { cmp: opts }; var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false; var cmp = opts.cmp && (function (f) { return function (node) { return function (a, b) { var aobj = { key: a, value: node[a] }; var bobj = { key: b, value: node[b] }; return f(aobj, bobj); }; }; })(opts.cmp); var seen = []; return (function stringify (node) { if (node && node.toJSON && typeof node.toJSON === 'function') { node = node.toJSON(); } if (node === undefined) return; if (typeof node == 'number') return isFinite(node) ? '' + node : 'null'; if (typeof node !== 'object') return JSON.stringify(node); var i, out; if (Array.isArray(node)) { out = '['; for (i = 0; i < node.length; i++) { if (i) out += ','; out += stringify(node[i]) || 'null'; } return out + ']'; } if (node === null) return 'null'; if (seen.indexOf(node) !== -1) { if (cycles) return JSON.stringify('__cycle__'); throw new TypeError('Converting circular structure to JSON'); } var seenIndex = seen.push(node) - 1; var keys = Object.keys(node).sort(cmp && cmp(node)); out = ''; for (i = 0; i < keys.length; i++) { var key = keys[i]; var value = stringify(node[key]); if (!value) continue; if (out) out += ','; out += JSON.stringify(key) + ':' + value; } seen.splice(seenIndex, 1); return '{' + out + '}'; })(data); }; /***/ }), /***/ "./node_modules/follow-redirects/index.js": /*!************************************************!*\ !*** ./node_modules/follow-redirects/index.js ***! \************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var url = __webpack_require__(/*! url */ "url"); var http = __webpack_require__(/*! http */ "http"); var https = __webpack_require__(/*! https */ "https"); var assert = __webpack_require__(/*! assert */ "assert"); var Writable = __webpack_require__(/*! stream */ "stream").Writable; var debug = __webpack_require__(/*! debug */ "./node_modules/follow-redirects/node_modules/debug/src/index.js")("follow-redirects"); // RFC7231§4.2.1: Of the request methods defined by this specification, // the GET, HEAD, OPTIONS, and TRACE methods are defined to be safe. var SAFE_METHODS = { GET: true, HEAD: true, OPTIONS: true, TRACE: true }; // Create handlers that pass events from native requests var eventHandlers = Object.create(null); ["abort", "aborted", "error", "socket", "timeout"].forEach(function (event) { eventHandlers[event] = function (arg) { this._redirectable.emit(event, arg); }; }); // An HTTP(S) request that can be redirected function RedirectableRequest(options, responseCallback) { // Initialize the request Writable.call(this); options.headers = options.headers || {}; this._options = options; this._redirectCount = 0; this._redirects = []; this._requestBodyLength = 0; this._requestBodyBuffers = []; // Since http.request treats host as an alias of hostname, // but the url module interprets host as hostname plus port, // eliminate the host property to avoid confusion. if (options.host) { // Use hostname if set, because it has precedence if (!options.hostname) { options.hostname = options.host; } delete options.host; } // Attach a callback if passed if (responseCallback) { this.on("response", responseCallback); } // React to responses of native requests var self = this; this._onNativeResponse = function (response) { self._processResponse(response); }; // Complete the URL object when necessary if (!options.pathname && options.path) { var searchPos = options.path.indexOf("?"); if (searchPos < 0) { options.pathname = options.path; } else { options.pathname = options.path.substring(0, searchPos); options.search = options.path.substring(searchPos); } } // Perform the first request this._performRequest(); } RedirectableRequest.prototype = Object.create(Writable.prototype); // Writes buffered data to the current native request RedirectableRequest.prototype.write = function (data, encoding, callback) { // Validate input and shift parameters if necessary if (!(typeof data === "string" || typeof data === "object" && ("length" in data))) { throw new Error("data should be a string, Buffer or Uint8Array"); } if (typeof encoding === "function") { callback = encoding; encoding = null; } // Ignore empty buffers, since writing them doesn't invoke the callback // https://github.com/nodejs/node/issues/22066 if (data.length === 0) { if (callback) { callback(); } return; } // Only write when we don't exceed the maximum body length if (this._requestBodyLength + data.length <= this._options.maxBodyLength) { this._requestBodyLength += data.length; this._requestBodyBuffers.push({ data: data, encoding: encoding }); this._currentRequest.write(data, encoding, callback); } // Error when we exceed the maximum body length else { this.emit("error", new Error("Request body larger than maxBodyLength limit")); this.abort(); } }; // Ends the current native request RedirectableRequest.prototype.end = function (data, encoding, callback) { // Shift parameters if necessary if (typeof data === "function") { callback = data; data = encoding = null; } else if (typeof encoding === "function") { callback = encoding; encoding = null; } // Write data and end var currentRequest = this._currentRequest; this.write(data || "", encoding, function () { currentRequest.end(null, null, callback); }); }; // Sets a header value on the current native request RedirectableRequest.prototype.setHeader = function (name, value) { this._options.headers[name] = value; this._currentRequest.setHeader(name, value); }; // Clears a header value on the current native request RedirectableRequest.prototype.removeHeader = function (name) { delete this._options.headers[name]; this._currentRequest.removeHeader(name); }; // Proxy all other public ClientRequest methods [ "abort", "flushHeaders", "getHeader", "setNoDelay", "setSocketKeepAlive", "setTimeout", ].forEach(function (method) { RedirectableRequest.prototype[method] = function (a, b) { return this._currentRequest[method](a, b); }; }); // Proxy all public ClientRequest properties ["aborted", "connection", "socket"].forEach(function (property) { Object.defineProperty(RedirectableRequest.prototype, property, { get: function () { return this._currentRequest[property]; }, }); }); // Executes the next native request (initial or redirect) RedirectableRequest.prototype._performRequest = function () { // Load the native protocol var protocol = this._options.protocol; var nativeProtocol = this._options.nativeProtocols[protocol]; if (!nativeProtocol) { this.emit("error", new Error("Unsupported protocol " + protocol)); return; } // If specified, use the agent corresponding to the protocol // (HTTP and HTTPS use different types of agents) if (this._options.agents) { var scheme = protocol.substr(0, protocol.length - 1); this._options.agent = this._options.agents[scheme]; } // Create the native request var request = this._currentRequest = nativeProtocol.request(this._options, this._onNativeResponse); this._currentUrl = url.format(this._options); // Set up event handlers request._redirectable = this; for (var event in eventHandlers) { /* istanbul ignore else */ if (event) { request.on(event, eventHandlers[event]); } } // End a redirected request // (The first request must be ended explicitly with RedirectableRequest#end) if (this._isRedirect) { // Write the request entity and end. var i = 0; var buffers = this._requestBodyBuffers; (function writeNext() { if (i < buffers.length) { var buffer = buffers[i++]; request.write(buffer.data, buffer.encoding, writeNext); } else { request.end(); } }()); } }; // Processes a response from the current native request RedirectableRequest.prototype._processResponse = function (response) { // Store the redirected response if (this._options.trackRedirects) { this._redirects.push({ url: this._currentUrl, headers: response.headers, statusCode: response.statusCode, }); } // RFC7231§6.4: The 3xx (Redirection) class of status code indicates // that further action needs to be taken by the user agent in order to // fulfill the request. If a Location header field is provided, // the user agent MAY automatically redirect its request to the URI // referenced by the Location field value, // even if the specific status code is not understood. var location = response.headers.location; if (location && this._options.followRedirects !== false && response.statusCode >= 300 && response.statusCode < 400) { // RFC7231§6.4: A client SHOULD detect and intervene // in cyclical redirections (i.e., "infinite" redirection loops). if (++this._redirectCount > this._options.maxRedirects) { this.emit("error", new Error("Max redirects exceeded.")); return; } // RFC7231§6.4: Automatic redirection needs to done with // care for methods not known to be safe […], // since the user might not wish to redirect an unsafe request. // RFC7231§6.4.7: The 307 (Temporary Redirect) status code indicates // that the target resource resides temporarily under a different URI // and the user agent MUST NOT change the request method // if it performs an automatic redirection to that URI. var header; var headers = this._options.headers; if (response.statusCode !== 307 && !(this._options.method in SAFE_METHODS)) { this._options.method = "GET"; // Drop a possible entity and headers related to it this._requestBodyBuffers = []; for (header in headers) { if (/^content-/i.test(header)) { delete headers[header]; } } } // Drop the Host header, as the redirect might lead to a different host if (!this._isRedirect) { for (header in headers) { if (/^host$/i.test(header)) { delete headers[header]; } } } // Perform the redirected request var redirectUrl = url.resolve(this._currentUrl, location); debug("redirecting to", redirectUrl); Object.assign(this._options, url.parse(redirectUrl)); this._isRedirect = true; this._performRequest(); // Discard the remainder of the response to avoid waiting for data response.destroy(); } else { // The response is not a redirect; return it as-is response.responseUrl = this._currentUrl; response.redirects = this._redirects; this.emit("response", response); // Clean up this._requestBodyBuffers = []; } }; // Wraps the key/value object of protocols with redirect functionality function wrap(protocols) { // Default settings var exports = { maxRedirects: 21, maxBodyLength: 10 * 1024 * 1024, }; // Wrap each protocol var nativeProtocols = {}; Object.keys(protocols).forEach(function (scheme) { var protocol = scheme + ":"; var nativeProtocol = nativeProtocols[protocol] = protocols[scheme]; var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol); // Executes a request, following redirects wrappedProtocol.request = function (options, callback) { if (typeof options === "string") { options = url.parse(options); options.maxRedirects = exports.maxRedirects; } else { options = Object.assign({ protocol: protocol, maxRedirects: exports.maxRedirects, maxBodyLength: exports.maxBodyLength, }, options); } options.nativeProtocols = nativeProtocols; assert.equal(options.protocol, protocol, "protocol mismatch"); debug("options", options); return new RedirectableRequest(options, callback); }; // Executes a GET request, following redirects wrappedProtocol.get = function (options, callback) { var request = wrappedProtocol.request(options, callback); request.end(); return request; }; }); return exports; } // Exports module.exports = wrap({ http: http, https: https }); module.exports.wrap = wrap; /***/ }), /***/ "./node_modules/follow-redirects/node_modules/debug/src/browser.js": /*!*************************************************************************!*\ !*** ./node_modules/follow-redirects/node_modules/debug/src/browser.js ***! \*************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { /** * This is the web browser implementation of `debug()`. * * Expose `debug()` as the module. */ exports = module.exports = __webpack_require__(/*! ./debug */ "./node_modules/follow-redirects/node_modules/debug/src/debug.js"); 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(); /** * Colors. */ exports.colors = [ '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33' ]; /** * Currently only WebKit-based Web Inspectors, Firefox >= v31, * and the Firebug extension (any Firefox version) are known * to support "%c" CSS customizations. * * 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.process && window.process.type === 'renderer') { return true; } // Internet Explorer and Edge do not support colors. if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { return false; } // 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.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || // is firebug? http://stackoverflow.com/a/398120/376773 (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || // is firefox >= v31? // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages (typeof navigator !== 'undefined' && 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.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. * * @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". * * @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`. * * @param {String} namespaces * @api private */ function save(namespaces) { try { if (null == namespaces) { exports.storage.removeItem('debug'); } else { exports.storage.debug = namespaces; } } catch(e) {} } /** * Load `namespaces`. * * @return {String} returns the previously persisted debug modes * @api private */ function load() { var r; try { r = exports.storage.debug; } catch(e) {} // If debug isn't set in LS, and we're in Electron, try to load $DEBUG if (!r && typeof process !== 'undefined' && 'env' in process) { r = process.env.DEBUG; } return r; } /** * 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) {} } /***/ }), /***/ "./node_modules/follow-redirects/node_modules/debug/src/debug.js": /*!***********************************************************************!*\ !*** ./node_modules/follow-redirects/node_modules/debug/src/debug.js ***! \***********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { /** * This is the common logic for both the Node.js and web browser * implementations of `debug()`. * * Expose `debug()` as the module. */ exports = module.exports = createDebug.debug = createDebug['default'] = createDebug; exports.coerce = coerce; exports.disable = disable; exports.enable = enable; exports.enabled = enabled; exports.humanize = __webpack_require__(/*! ms */ "./node_modules/follow-redirects/node_modules/ms/index.js"); /** * Active `debug` instances. */ exports.instances = []; /** * The currently active debug mode names, and names to skip. */ exports.names = []; exports.skips = []; /** * Map of special "%n" handling functions, for the debug "format" argument. * * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". */ exports.formatters = {}; /** * Select a color. * @param {String} namespace * @return {Number} * @api private */ function selectColor(namespace) { var hash = 0, i; for (i in namespace) { hash = ((hash << 5) - hash) + namespace.charCodeAt(i); hash |= 0; // Convert to 32bit integer } return exports.colors[Math.abs(hash) % exports.colors.length]; } /** * Create a debugger with the given `namespace`. * * @param {String} namespace * @return {Function} * @api public */ function createDebug(namespace) { var prevTime; function debug() { // disabled? if (!debug.enabled) return; var self = debug; // set `diff` timestamp var curr = +new Date(); var ms = curr - (prevTime || curr); self.diff = ms; self.prev = prevTime; self.curr = curr; prevTime = curr; // turn the `arguments` into a proper Array var args = new Array(arguments.length); for (var i = 0; i < args.length; i++) { args[i] = arguments[i]; } args[0] = exports.coerce(args[0]); if ('string' !== typeof args[0]) { // anything else let's inspect with %O args.unshift('%O'); } // apply any `formatters` transformations var index = 0; args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { // if we encounter an escaped % then don't increase the array index if (match === '%%') return match; index++; var formatter = exports.formatters[format]; if ('function' === typeof formatter) { var val = args[index]; match = formatter.call(self, val); // now we need to remove `args[index]` since it's inlined in the `format` args.splice(index, 1); index--; } return match; }); // apply env-specific formatting (colors, etc.) exports.formatArgs.call(self, args); var logFn = debug.log || exports.log || console.log.bind(console); logFn.apply(self, args); } debug.namespace = namespace; debug.enabled = exports.enabled(namespace); debug.useColors = exports.useColors(); debug.color = selectColor(namespace); debug.destroy = destroy; // env-specific initialization logic for debug instances if ('function' === typeof exports.init) { exports.init(debug); } exports.instances.push(debug); return debug; } function destroy () { var index = exports.instances.indexOf(this); if (index !== -1) { exports.instances.splice(index, 1); return true; } else { return false; } } /** * Enables a debug mode by namespaces. This can include modes * separated by a colon and wildcards. * * @param {String} namespaces * @api public */ function enable(namespaces) { exports.save(namespaces); exports.names = []; exports.skips = []; var i; var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); var len = split.length; for (i = 0; i < len; i++) { if (!split[i]) continue; // ignore empty strings namespaces = split[i].replace(/\*/g, '.*?'); if (namespaces[0] === '-') { exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); } else { exports.names.push(new RegExp('^' + namespaces + '$')); } } for (i = 0; i < exports.instances.length; i++) { var instance = exports.instances[i]; instance.enabled = exports.enabled(instance.namespace); } } /** * Disable debug output. * * @api public */ function disable() { exports.enable(''); } /** * Returns true if the given mode name is enabled, false otherwise. * * @param {String} name * @return {Boolean} * @api public */ function enabled(name) { if (name[name.length - 1] === '*') { return true; } var i, len; for (i = 0, len = exports.skips.length; i < len; i++) { if (exports.skips[i].test(name)) { return false; } } for (i = 0, len = exports.names.length; i < len; i++) { if (exports.names[i].test(name)) { return true; } } return false; } /** * Coerce `val`. * * @param {Mixed} val * @return {Mixed} * @api private */ function coerce(val) { if (val instanceof Error) return val.stack || val.message; return val; } /***/ }), /***/ "./node_modules/follow-redirects/node_modules/debug/src/index.js": /*!***********************************************************************!*\ !*** ./node_modules/follow-redirects/node_modules/debug/src/index.js ***! \***********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { /** * Detect Electron renderer process, which is node, but we should * treat as a browser. */ if (typeof process === 'undefined' || process.type === 'renderer') { module.exports = __webpack_require__(/*! ./browser.js */ "./node_modules/follow-redirects/node_modules/debug/src/browser.js"); } else { module.exports = __webpack_require__(/*! ./node.js */ "./node_modules/follow-redirects/node_modules/debug/src/node.js"); } /***/ }), /***/ "./node_modules/follow-redirects/node_modules/debug/src/node.js": /*!**********************************************************************!*\ !*** ./node_modules/follow-redirects/node_modules/debug/src/node.js ***! \**********************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { /** * Module dependencies. */ var tty = __webpack_require__(/*! tty */ "tty"); var util = __webpack_require__(/*! util */ "util"); /** * This is the Node.js implementation of `debug()`. * * Expose `debug()` as the module. */ exports = module.exports = __webpack_require__(/*! ./debug */ "./node_modules/follow-redirects/node_modules/debug/src/debug.js"); exports.init = init; exports.log = log; exports.formatArgs = formatArgs; exports.save = save; exports.load = load; exports.useColors = useColors; /** * Colors. */ exports.colors = [ 6, 2, 3, 4, 5, 1 ]; try { var supportsColor = __webpack_require__(/*! supports-color */ "./node_modules/supports-color/index.js"); if (supportsColor && supportsColor.level >= 2) { exports.colors = [ 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221 ]; } } catch (err) { // swallow - we only care if `supports-color` is available; it doesn't have to be. } /** * Build up the default `inspectOpts` object from the environment variables. * * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js */ exports.inspectOpts = Object.keys(process.env).filter(function (key) { return /^debug_/i.test(key); }).reduce(function (obj, key) { // camel-case var prop = key .substring(6) .toLowerCase() .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() }); // coerce string value into JS value var val = process.env[key]; if (/^(yes|on|true|enabled)$/i.test(val)) val = true; else if (/^(no|off|false|disabled)$/i.test(val)) val = false; else if (val === 'null') val = null; else val = Number(val); obj[prop] = val; return obj; }, {}); /** * Is stdout a TTY? Colored output is enabled when `true`. */ function useColors() { return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd); } /** * Map %o to `util.inspect()`, all on a single line. */ exports.formatters.o = function(v) { this.inspectOpts.colors = this.useColors; return util.inspect(v, this.inspectOpts) .split('\n').map(function(str) { return str.trim() }).join(' '); }; /** * Map %o to `util.inspect()`, allowing multiple lines if needed. */ exports.formatters.O = function(v) { this.inspectOpts.colors = this.useColors; return util.inspect(v, this.inspectOpts); }; /** * Adds ANSI color escape codes if enabled. * * @api public */ function formatArgs(args) { var name = this.namespace; var useColors = this.useColors; if (useColors) { var c = this.color; var colorCode = '\u001b[3' + (c < 8 ? c : '8;5;' + c); var prefix = ' ' + colorCode + ';1m' + name + ' ' + '\u001b[0m'; args[0] = prefix + args[0].split('\n').join('\n' + prefix); args.push(colorCode + 'm+' + exports.humanize(this.diff) + '\u001b[0m'); } else { args[0] = getDate() + name + ' ' + args[0]; } } function getDate() { if (exports.inspectOpts.hideDate) { return ''; } else { return new Date().toISOString() + ' '; } } /** * Invokes `util.format()` with the specified arguments and writes to stderr. */ function log() { return process.stderr.write(util.format.apply(util, arguments) + '\n'); } /** * Save `namespaces`. * * @param {String} namespaces * @api private */ function save(namespaces) { if (null == namespaces) { // If you set a process.env field to null or undefined, it gets cast to the // string 'null' or 'undefined'. Just delete instead. delete process.env.DEBUG; } else { process.env.DEBUG = namespaces; } } /** * Load `namespaces`. * * @return {String} returns the previously persisted debug modes * @api private */ function load() { return process.env.DEBUG; } /** * Init logic for `debug` instances. * * Create a new `inspectOpts` object in case `useColors` is set * differently for a particular `debug` instance. */ function init (debug) { debug.inspectOpts = {}; var keys = Object.keys(exports.inspectOpts); for (var i = 0; i < keys.length; i++) { debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; } } /** * Enable namespaces listed in `process.env.DEBUG` initially. */ exports.enable(load()); /***/ }), /***/ "./node_modules/follow-redirects/node_modules/ms/index.js": /*!****************************************************************!*\ !*** ./node_modules/follow-redirects/node_modules/ms/index.js ***! \****************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { /** * Helpers. */ var s = 1000; var m = s * 60; var h = m * 60; var d = h * 24; var y = d * 365.25; /** * Parse or format the given `val`. * * Options: * * - `long` verbose formatting [false] * * @param {String|Number} val * @param {Object} [options] * @throws {Error} throw an error if val is not a non-empty string or a number * @return {String|Number} * @api public */ module.exports = function(val, options) { options = options || {}; var type = typeof val; if (type === 'string' && val.length > 0) { return parse(val); } else if (type === 'number' && isNaN(val) === false) { return options.long ? fmtLong(val) : fmtShort(val); } throw new Error( 'val is not a non-empty string or a valid number. val=' + JSON.stringify(val) ); }; /** * Parse the given `str` and return milliseconds. * * @param {String} str * @return {Number} * @api private */ function parse(str) { str = String(str); if (str.length > 100) { return; } var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( str ); if (!match) { return; } var n = parseFloat(match[1]); var type = (match[2] || 'ms').toLowerCase(); switch (type) { case 'years': case 'year': case 'yrs': case 'yr': case 'y': return n * y; case 'days': case 'day': case 'd': return n * d; case 'hours': case 'hour': case 'hrs': case 'hr': case 'h': return n * h; case 'minutes': case 'minute': case 'mins': case 'min': case 'm': return n * m; case 'seconds': case 'second': case 'secs': case 'sec': case 's': return n * s; case 'milliseconds': case 'millisecond': case 'msecs': case 'msec': case 'ms': return n; default: return undefined; } } /** * Short format for `ms`. * * @param {Number} ms * @return {String} * @api private */ function fmtShort(ms) { if (ms >= d) { return Math.round(ms / d) + 'd'; } if (ms >= h) { return Math.round(ms / h) + 'h'; } if (ms >= m) { return Math.round(ms / m) + 'm'; } if (ms >= s) { return Math.round(ms / s) + 's'; } return ms + 'ms'; } /** * Long format for `ms`. * * @param {Number} ms * @return {String} * @api private */ function fmtLong(ms) { return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; } /** * Pluralization helper. */ function plural(ms, n, name) { if (ms < n) { return; } if (ms < n * 1.5) { return Math.floor(ms / n) + ' ' + name; } return Math.ceil(ms / n) + ' ' + name + 's'; } /***/ }), /***/ "./node_modules/graphql-tag/src/index.js": /*!***********************************************!*\ !*** ./node_modules/graphql-tag/src/index.js ***! \***********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var parser = __webpack_require__(/*! graphql/language/parser */ "./node_modules/graphql/language/parser.js"); var parse = parser.parse; // Strip insignificant whitespace // Note that this could do a lot more, such as reorder fields etc. function normalize(string) { return string.replace(/[\s,]+/g, ' ').trim(); } // A map docString -> graphql document var docCache = {}; // A map fragmentName -> [normalized source] var fragmentSourceMap = {}; function cacheKeyFromLoc(loc) { return normalize(loc.source.body.substring(loc.start, loc.end)); } // For testing. function resetCaches() { docCache = {}; fragmentSourceMap = {}; } // Take a unstripped parsed document (query/mutation or even fragment), and // check all fragment definitions, checking for name->source uniqueness. // We also want to make sure only unique fragments exist in the document. var printFragmentWarnings = true; function processFragments(ast) { var astFragmentMap = {}; var definitions = []; for (var i = 0; i < ast.definitions.length; i++) { var fragmentDefinition = ast.definitions[i]; if (fragmentDefinition.kind === 'FragmentDefinition') { var fragmentName = fragmentDefinition.name.value; var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc); // We know something about this fragment if (fragmentSourceMap.hasOwnProperty(fragmentName) && !fragmentSourceMap[fragmentName][sourceKey]) { // this is a problem because the app developer is trying to register another fragment with // the same name as one previously registered. So, we tell them about it. if (printFragmentWarnings) { console.warn("Warning: fragment with name " + fragmentName + " already exists.\n" + "graphql-tag enforces all fragment names across your application to be unique; read more about\n" + "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"); } fragmentSourceMap[fragmentName][sourceKey] = true; } else if (!fragmentSourceMap.hasOwnProperty(fragmentName)) { fragmentSourceMap[fragmentName] = {}; fragmentSourceMap[fragmentName][sourceKey] = true; } if (!astFragmentMap[sourceKey]) { astFragmentMap[sourceKey] = true; definitions.push(fragmentDefinition); } } else { definitions.push(fragmentDefinition); } } ast.definitions = definitions; return ast; } function disableFragmentWarnings() { printFragmentWarnings = false; } function stripLoc(doc, removeLocAtThisLevel) { var docType = Object.prototype.toString.call(doc); if (docType === '[object Array]') { return doc.map(function (d) { return stripLoc(d, removeLocAtThisLevel); }); } if (docType !== '[object Object]') { throw new Error('Unexpected input.'); } // We don't want to remove the root loc field so we can use it // for fragment substitution (see below) if (removeLocAtThisLevel && doc.loc) { delete doc.loc; } // https://github.com/apollographql/graphql-tag/issues/40 if (doc.loc) { delete doc.loc.startToken; delete doc.loc.endToken; } var keys = Object.keys(doc); var key; var value; var valueType; for (key in keys) { if (keys.hasOwnProperty(key)) { value = doc[keys[key]]; valueType = Object.prototype.toString.call(value); if (valueType === '[object Object]' || valueType === '[object Array]') { doc[keys[key]] = stripLoc(value, true); } } } return doc; } var experimentalFragmentVariables = false; function parseDocument(doc) { var cacheKey = normalize(doc); if (docCache[cacheKey]) { return docCache[cacheKey]; } var parsed = parse(doc, { experimentalFragmentVariables: experimentalFragmentVariables }); if (!parsed || parsed.kind !== 'Document') { throw new Error('Not a valid GraphQL document.'); } // check that all "new" fragments inside the documents are consistent with // existing fragments of the same name parsed = processFragments(parsed); parsed = stripLoc(parsed, false); docCache[cacheKey] = parsed; return parsed; } function enableExperimentalFragmentVariables() { experimentalFragmentVariables = true; } function disableExperimentalFragmentVariables() { experimentalFragmentVariables = false; } // XXX This should eventually disallow arbitrary string interpolation, like Relay does function gql(/* arguments */) { var args = Array.prototype.slice.call(arguments); var literals = args[0]; // We always get literals[0] and then matching post literals for each arg given var result = (typeof(literals) === "string") ? literals : literals[0]; for (var i = 1; i < args.length; i++) { if (args[i] && args[i].kind && args[i].kind === 'Document') { result += args[i].loc.source.body; } else { result += args[i]; } result += literals[i]; } return parseDocument(result); } // Support typescript, which isn't as nice as Babel about default exports gql.default = gql; gql.resetCaches = resetCaches; gql.disableFragmentWarnings = disableFragmentWarnings; gql.enableExperimentalFragmentVariables = enableExperimentalFragmentVariables; gql.disableExperimentalFragmentVariables = disableExperimentalFragmentVariables; module.exports = gql; /***/ }), /***/ "./node_modules/graphql/error/GraphQLError.js": /*!****************************************************!*\ !*** ./node_modules/graphql/error/GraphQLError.js ***! \****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GraphQLError = GraphQLError; exports.printError = printError; var _isObjectLike = _interopRequireDefault(__webpack_require__(/*! ../jsutils/isObjectLike */ "./node_modules/graphql/jsutils/isObjectLike.js")); var _location = __webpack_require__(/*! ../language/location */ "./node_modules/graphql/language/location.js"); var _printLocation = __webpack_require__(/*! ../language/printLocation */ "./node_modules/graphql/language/printLocation.js"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function GraphQLError( // eslint-disable-line no-redeclare message, nodes, source, positions, path, originalError, extensions) { // Compute list of blame nodes. var _nodes = Array.isArray(nodes) ? nodes.length !== 0 ? nodes : undefined : nodes ? [nodes] : undefined; // Compute locations in the source for the given nodes/positions. var _source = source; if (!_source && _nodes) { var node = _nodes[0]; _source = node && node.loc && node.loc.source; } var _positions = positions; if (!_positions && _nodes) { _positions = _nodes.reduce(function (list, node) { if (node.loc) { list.push(node.loc.start); } return list; }, []); } if (_positions && _positions.length === 0) { _positions = undefined; } var _locations; if (positions && source) { _locations = positions.map(function (pos) { return (0, _location.getLocation)(source, pos); }); } else if (_nodes) { _locations = _nodes.reduce(function (list, node) { if (node.loc) { list.push((0, _location.getLocation)(node.loc.source, node.loc.start)); } return list; }, []); } var _extensions = extensions; if (_extensions == null && originalError != null) { var originalExtensions = originalError.extensions; if ((0, _isObjectLike.default)(originalExtensions)) { _extensions = originalExtensions; } } Object.defineProperties(this, { message: { value: message, // By being enumerable, JSON.stringify will include `message` in the // resulting output. This ensures that the simplest possible GraphQL // service adheres to the spec. enumerable: true, writable: true }, locations: { // Coercing falsey values to undefined ensures they will not be included // in JSON.stringify() when not provided. value: _locations || undefined, // By being enumerable, JSON.stringify will include `locations` in the // resulting output. This ensures that the simplest possible GraphQL // service adheres to the spec. enumerable: Boolean(_locations) }, path: { // Coercing falsey values to undefined ensures they will not be included // in JSON.stringify() when not provided. value: path || undefined, // By being enumerable, JSON.stringify will include `path` in the // resulting output. This ensures that the simplest possible GraphQL // service adheres to the spec. enumerable: Boolean(path) }, nodes: { value: _nodes || undefined }, source: { value: _source || undefined }, positions: { value: _positions || undefined }, originalError: { value: originalError }, extensions: { // Coercing falsey values to undefined ensures they will not be included // in JSON.stringify() when not provided. value: _extensions || undefined, // By being enumerable, JSON.stringify will include `path` in the // resulting output. This ensures that the simplest possible GraphQL // service adheres to the spec. enumerable: Boolean(_extensions) } }); // Include (non-enumerable) stack trace. if (originalError && originalError.stack) { Object.defineProperty(this, 'stack', { value: originalError.stack, writable: true, configurable: true }); } else if (Error.captureStackTrace) { Error.captureStackTrace(this, GraphQLError); } else { Object.defineProperty(this, 'stack', { value: Error().stack, writable: true, configurable: true }); } } GraphQLError.prototype = Object.create(Error.prototype, { constructor: { value: GraphQLError }, name: { value: 'GraphQLError' }, toString: { value: function toString() { return printError(this); } } }); /** * Prints a GraphQLError to a string, representing useful location information * about the error's position in the source. */ function printError(error) { var output = error.message; if (error.nodes) { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = error.nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var node = _step.value; if (node.loc) { output += '\n\n' + (0, _printLocation.printLocation)(node.loc); } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return != null) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } else if (error.source && error.locations) { var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = error.locations[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var location = _step2.value; output += '\n\n' + (0, _printLocation.printSourceLocation)(error.source, location); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return != null) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } } return output; } /***/ }), /***/ "./node_modules/graphql/error/syntaxError.js": /*!***************************************************!*\ !*** ./node_modules/graphql/error/syntaxError.js ***! \***************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.syntaxError = syntaxError; var _GraphQLError = __webpack_require__(/*! ./GraphQLError */ "./node_modules/graphql/error/GraphQLError.js"); /** * Produces a GraphQLError representing a syntax error, containing useful * descriptive information about the syntax error's position in the source. */ function syntaxError(source, position, description) { return new _GraphQLError.GraphQLError("Syntax Error: ".concat(description), undefined, source, [position]); } /***/ }), /***/ "./node_modules/graphql/jsutils/defineToJSON.js": /*!******************************************************!*\ !*** ./node_modules/graphql/jsutils/defineToJSON.js ***! \******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = defineToJSON; var _nodejsCustomInspectSymbol = _interopRequireDefault(__webpack_require__(/*! ./nodejsCustomInspectSymbol */ "./node_modules/graphql/jsutils/nodejsCustomInspectSymbol.js")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * The `defineToJSON()` function defines toJSON() and inspect() prototype * methods, if no function provided they become aliases for toString(). */ function defineToJSON(classObject) { var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : classObject.prototype.toString; classObject.prototype.toJSON = fn; classObject.prototype.inspect = fn; if (_nodejsCustomInspectSymbol.default) { classObject.prototype[_nodejsCustomInspectSymbol.default] = fn; } } /***/ }), /***/ "./node_modules/graphql/jsutils/defineToStringTag.js": /*!***********************************************************!*\ !*** ./node_modules/graphql/jsutils/defineToStringTag.js ***! \***********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = defineToStringTag; /** * The `defineToStringTag()` function checks first to see if the runtime * supports the `Symbol` class and then if the `Symbol.toStringTag` constant * is defined as a `Symbol` instance. If both conditions are met, the * Symbol.toStringTag property is defined as a getter that returns the * supplied class constructor's name. * * @method defineToStringTag * * @param {Class} classObject a class such as Object, String, Number but * typically one of your own creation through the class keyword; `class A {}`, * for example. */ function defineToStringTag(classObject) { if (typeof Symbol === 'function' && Symbol.toStringTag) { Object.defineProperty(classObject.prototype, Symbol.toStringTag, { get: function get() { return this.constructor.name; } }); } } /***/ }), /***/ "./node_modules/graphql/jsutils/inspect.js": /*!*************************************************!*\ !*** ./node_modules/graphql/jsutils/inspect.js ***! \*************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = inspect; var _nodejsCustomInspectSymbol = _interopRequireDefault(__webpack_require__(/*! ./nodejsCustomInspectSymbol */ "./node_modules/graphql/jsutils/nodejsCustomInspectSymbol.js")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } var MAX_ARRAY_LENGTH = 10; var MAX_RECURSIVE_DEPTH = 2; /** * Used to print values in error messages. */ function inspect(value) { return formatValue(value, []); } function formatValue(value, seenValues) { switch (_typeof(value)) { case 'string': return JSON.stringify(value); case 'function': return value.name ? "[function ".concat(value.name, "]") : '[function]'; case 'object': if (value === null) { return 'null'; } return formatObjectValue(value, seenValues); default: return String(value); } } function formatObjectValue(value, previouslySeenValues) { if (previouslySeenValues.indexOf(value) !== -1) { return '[Circular]'; } var seenValues = [].concat(previouslySeenValues, [value]); var customInspectFn = getCustomFn(value); if (customInspectFn !== undefined) { // $FlowFixMe(>=0.90.0) var customValue = customInspectFn.call(value); // check for infinite recursion if (customValue !== value) { return typeof customValue === 'string' ? customValue : formatValue(customValue, seenValues); } } else if (Array.isArray(value)) { return formatArray(value, seenValues); } return formatObject(value, seenValues); } function formatObject(object, seenValues) { var keys = Object.keys(object); if (keys.length === 0) { return '{}'; } if (seenValues.length > MAX_RECURSIVE_DEPTH) { return '[' + getObjectTag(object) + ']'; } var properties = keys.map(function (key) { var value = formatValue(object[key], seenValues); return key + ': ' + value; }); return '{ ' + properties.join(', ') + ' }'; } function formatArray(array, seenValues) { if (array.length === 0) { return '[]'; } if (seenValues.length > MAX_RECURSIVE_DEPTH) { return '[Array]'; } var len = Math.min(MAX_ARRAY_LENGTH, array.length); var remaining = array.length - len; var items = []; for (var i = 0; i < len; ++i) { items.push(formatValue(array[i], seenValues)); } if (remaining === 1) { items.push('... 1 more item'); } else if (remaining > 1) { items.push("... ".concat(remaining, " more items")); } return '[' + items.join(', ') + ']'; } function getCustomFn(object) { var customInspectFn = object[String(_nodejsCustomInspectSymbol.default)]; if (typeof customInspectFn === 'function') { return customInspectFn; } if (typeof object.inspect === 'function') { return object.inspect; } } function getObjectTag(object) { var tag = Object.prototype.toString.call(object).replace(/^\[object /, '').replace(/]$/, ''); if (tag === 'Object' && typeof object.constructor === 'function') { var name = object.constructor.name; if (typeof name === 'string') { return name; } } return tag; } /***/ }), /***/ "./node_modules/graphql/jsutils/invariant.js": /*!***************************************************!*\ !*** ./node_modules/graphql/jsutils/invariant.js ***! \***************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = invariant; function invariant(condition, message) { var booleanCondition = Boolean(condition); /* istanbul ignore else */ if (!booleanCondition) { throw new Error(message); } } /***/ }), /***/ "./node_modules/graphql/jsutils/isObjectLike.js": /*!******************************************************!*\ !*** ./node_modules/graphql/jsutils/isObjectLike.js ***! \******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = isObjectLike; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } /** * Return true if `value` is object-like. A value is object-like if it's not * `null` and has a `typeof` result of "object". */ function isObjectLike(value) { return _typeof(value) == 'object' && value !== null; } /***/ }), /***/ "./node_modules/graphql/jsutils/nodejsCustomInspectSymbol.js": /*!*******************************************************************!*\ !*** ./node_modules/graphql/jsutils/nodejsCustomInspectSymbol.js ***! \*******************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined; var _default = nodejsCustomInspectSymbol; exports.default = _default; /***/ }), /***/ "./node_modules/graphql/language/blockString.js": /*!******************************************************!*\ !*** ./node_modules/graphql/language/blockString.js ***! \******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.dedentBlockStringValue = dedentBlockStringValue; exports.getBlockStringIndentation = getBlockStringIndentation; exports.printBlockString = printBlockString; /** * Produces the value of a block string from its parsed raw value, similar to * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. * * This implements the GraphQL spec's BlockStringValue() static algorithm. */ function dedentBlockStringValue(rawString) { // Expand a block string's raw value into independent lines. var lines = rawString.split(/\r\n|[\n\r]/g); // Remove common indentation from all lines but first. var commonIndent = getBlockStringIndentation(lines); if (commonIndent !== 0) { for (var i = 1; i < lines.length; i++) { lines[i] = lines[i].slice(commonIndent); } } // Remove leading and trailing blank lines. while (lines.length > 0 && isBlank(lines[0])) { lines.shift(); } while (lines.length > 0 && isBlank(lines[lines.length - 1])) { lines.pop(); } // Return a string of the lines joined with U+000A. return lines.join('\n'); } // @internal function getBlockStringIndentation(lines) { var commonIndent = null; for (var i = 1; i < lines.length; i++) { var line = lines[i]; var indent = leadingWhitespace(line); if (indent === line.length) { continue; // skip empty lines } if (commonIndent === null || indent < commonIndent) { commonIndent = indent; if (commonIndent === 0) { break; } } } return commonIndent === null ? 0 : commonIndent; } function leadingWhitespace(str) { var i = 0; while (i < str.length && (str[i] === ' ' || str[i] === '\t')) { i++; } return i; } function isBlank(str) { return leadingWhitespace(str) === str.length; } /** * Print a block string in the indented block form by adding a leading and * trailing blank line. However, if a block string starts with whitespace and is * a single-line, adding a leading blank line would strip that whitespace. */ function printBlockString(value) { var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; var preferMultipleLines = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var isSingleLine = value.indexOf('\n') === -1; var hasLeadingSpace = value[0] === ' ' || value[0] === '\t'; var hasTrailingQuote = value[value.length - 1] === '"'; var printAsMultipleLines = !isSingleLine || hasTrailingQuote || preferMultipleLines; var result = ''; // Format a multi-line block quote to account for leading space. if (printAsMultipleLines && !(isSingleLine && hasLeadingSpace)) { result += '\n' + indentation; } result += indentation ? value.replace(/\n/g, '\n' + indentation) : value; if (printAsMultipleLines) { result += '\n'; } return '"""' + result.replace(/"""/g, '\\"""') + '"""'; } /***/ }), /***/ "./node_modules/graphql/language/directiveLocation.js": /*!************************************************************!*\ !*** ./node_modules/graphql/language/directiveLocation.js ***! \************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DirectiveLocation = void 0; /** * The set of allowed directive location values. */ var DirectiveLocation = Object.freeze({ // Request Definitions QUERY: 'QUERY', MUTATION: 'MUTATION', SUBSCRIPTION: 'SUBSCRIPTION', FIELD: 'FIELD', FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION', FRAGMENT_SPREAD: 'FRAGMENT_SPREAD', INLINE_FRAGMENT: 'INLINE_FRAGMENT', VARIABLE_DEFINITION: 'VARIABLE_DEFINITION', // Type System Definitions SCHEMA: 'SCHEMA', SCALAR: 'SCALAR', OBJECT: 'OBJECT', FIELD_DEFINITION: 'FIELD_DEFINITION', ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION', INTERFACE: 'INTERFACE', UNION: 'UNION', ENUM: 'ENUM', ENUM_VALUE: 'ENUM_VALUE', INPUT_OBJECT: 'INPUT_OBJECT', INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION' }); /** * The enum type representing the directive location values. */ exports.DirectiveLocation = DirectiveLocation; /***/ }), /***/ "./node_modules/graphql/language/kinds.js": /*!************************************************!*\ !*** ./node_modules/graphql/language/kinds.js ***! \************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Kind = void 0; /** * The set of allowed kind values for AST nodes. */ var Kind = Object.freeze({ // Name NAME: 'Name', // Document DOCUMENT: 'Document', OPERATION_DEFINITION: 'OperationDefinition', VARIABLE_DEFINITION: 'VariableDefinition', SELECTION_SET: 'SelectionSet', FIELD: 'Field', ARGUMENT: 'Argument', // Fragments FRAGMENT_SPREAD: 'FragmentSpread', INLINE_FRAGMENT: 'InlineFragment', FRAGMENT_DEFINITION: 'FragmentDefinition', // Values VARIABLE: 'Variable', INT: 'IntValue', FLOAT: 'FloatValue', STRING: 'StringValue', BOOLEAN: 'BooleanValue', NULL: 'NullValue', ENUM: 'EnumValue', LIST: 'ListValue', OBJECT: 'ObjectValue', OBJECT_FIELD: 'ObjectField', // Directives DIRECTIVE: 'Directive', // Types NAMED_TYPE: 'NamedType', LIST_TYPE: 'ListType', NON_NULL_TYPE: 'NonNullType', // Type System Definitions SCHEMA_DEFINITION: 'SchemaDefinition', OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition', // Type Definitions SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition', OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition', FIELD_DEFINITION: 'FieldDefinition', INPUT_VALUE_DEFINITION: 'InputValueDefinition', INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition', UNION_TYPE_DEFINITION: 'UnionTypeDefinition', ENUM_TYPE_DEFINITION: 'EnumTypeDefinition', ENUM_VALUE_DEFINITION: 'EnumValueDefinition', INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition', // Directive Definitions DIRECTIVE_DEFINITION: 'DirectiveDefinition', // Type System Extensions SCHEMA_EXTENSION: 'SchemaExtension', // Type Extensions SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension', OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension', INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension', UNION_TYPE_EXTENSION: 'UnionTypeExtension', ENUM_TYPE_EXTENSION: 'EnumTypeExtension', INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension' }); /** * The enum type representing the possible kind values of AST nodes. */ exports.Kind = Kind; /***/ }), /***/ "./node_modules/graphql/language/lexer.js": /*!************************************************!*\ !*** ./node_modules/graphql/language/lexer.js ***! \************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createLexer = createLexer; exports.isPunctuatorToken = isPunctuatorToken; exports.getTokenDesc = getTokenDesc; var _defineToJSON = _interopRequireDefault(__webpack_require__(/*! ../jsutils/defineToJSON */ "./node_modules/graphql/jsutils/defineToJSON.js")); var _tokenKind = __webpack_require__(/*! ./tokenKind */ "./node_modules/graphql/language/tokenKind.js"); var _syntaxError = __webpack_require__(/*! ../error/syntaxError */ "./node_modules/graphql/error/syntaxError.js"); var _blockString = __webpack_require__(/*! ./blockString */ "./node_modules/graphql/language/blockString.js"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Given a Source object, this returns a Lexer for that source. * A Lexer is a stateful stream generator in that every time * it is advanced, it returns the next token in the Source. Assuming the * source lexes, the final Token emitted by the lexer will be of kind * EOF, after which the lexer will repeatedly return the same EOF token * whenever called. */ function createLexer(source, options) { var startOfFileToken = new Tok(_tokenKind.TokenKind.SOF, 0, 0, 0, 0, null); var lexer = { source: source, options: options, lastToken: startOfFileToken, token: startOfFileToken, line: 1, lineStart: 0, advance: advanceLexer, lookahead: lookahead }; return lexer; } function advanceLexer() { this.lastToken = this.token; var token = this.token = this.lookahead(); return token; } function lookahead() { var token = this.token; if (token.kind !== _tokenKind.TokenKind.EOF) { do { // Note: next is only mutable during parsing, so we cast to allow this. token = token.next || (token.next = readToken(this, token)); } while (token.kind === _tokenKind.TokenKind.COMMENT); } return token; } /** * The return type of createLexer. */ // @internal function isPunctuatorToken(token) { var kind = token.kind; return kind === _tokenKind.TokenKind.BANG || kind === _tokenKind.TokenKind.DOLLAR || kind === _tokenKind.TokenKind.AMP || kind === _tokenKind.TokenKind.PAREN_L || kind === _tokenKind.TokenKind.PAREN_R || kind === _tokenKind.TokenKind.SPREAD || kind === _tokenKind.TokenKind.COLON || kind === _tokenKind.TokenKind.EQUALS || kind === _tokenKind.TokenKind.AT || kind === _tokenKind.TokenKind.BRACKET_L || kind === _tokenKind.TokenKind.BRACKET_R || kind === _tokenKind.TokenKind.BRACE_L || kind === _tokenKind.TokenKind.PIPE || kind === _tokenKind.TokenKind.BRACE_R; } /** * A helper function to describe a token as a string for debugging */ function getTokenDesc(token) { var value = token.value; return value ? "".concat(token.kind, " \"").concat(value, "\"") : token.kind; } /** * Helper function for constructing the Token object. */ function Tok(kind, start, end, line, column, prev, value) { this.kind = kind; this.start = start; this.end = end; this.line = line; this.column = column; this.value = value; this.prev = prev; this.next = null; } // Print a simplified form when appearing in JSON/util.inspect. (0, _defineToJSON.default)(Tok, function () { return { kind: this.kind, value: this.value, line: this.line, column: this.column }; }); function printCharCode(code) { return (// NaN/undefined represents access beyond the end of the file. isNaN(code) ? _tokenKind.TokenKind.EOF : // Trust JSON for ASCII. code < 0x007f ? JSON.stringify(String.fromCharCode(code)) : // Otherwise print the escaped form. "\"\\u".concat(('00' + code.toString(16).toUpperCase()).slice(-4), "\"") ); } /** * Gets the next token from the source starting at the given position. * * This skips over whitespace until it finds the next lexable token, then lexes * punctuators immediately or calls the appropriate helper function for more * complicated tokens. */ function readToken(lexer, prev) { var source = lexer.source; var body = source.body; var bodyLength = body.length; var pos = positionAfterWhitespace(body, prev.end, lexer); var line = lexer.line; var col = 1 + pos - lexer.lineStart; if (pos >= bodyLength) { return new Tok(_tokenKind.TokenKind.EOF, bodyLength, bodyLength, line, col, prev); } var code = body.charCodeAt(pos); // SourceCharacter switch (code) { // ! case 33: return new Tok(_tokenKind.TokenKind.BANG, pos, pos + 1, line, col, prev); // # case 35: return readComment(source, pos, line, col, prev); // $ case 36: return new Tok(_tokenKind.TokenKind.DOLLAR, pos, pos + 1, line, col, prev); // & case 38: return new Tok(_tokenKind.TokenKind.AMP, pos, pos + 1, line, col, prev); // ( case 40: return new Tok(_tokenKind.TokenKind.PAREN_L, pos, pos + 1, line, col, prev); // ) case 41: return new Tok(_tokenKind.TokenKind.PAREN_R, pos, pos + 1, line, col, prev); // . case 46: if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) { return new Tok(_tokenKind.TokenKind.SPREAD, pos, pos + 3, line, col, prev); } break; // : case 58: return new Tok(_tokenKind.TokenKind.COLON, pos, pos + 1, line, col, prev); // = case 61: return new Tok(_tokenKind.TokenKind.EQUALS, pos, pos + 1, line, col, prev); // @ case 64: return new Tok(_tokenKind.TokenKind.AT, pos, pos + 1, line, col, prev); // [ case 91: return new Tok(_tokenKind.TokenKind.BRACKET_L, pos, pos + 1, line, col, prev); // ] case 93: return new Tok(_tokenKind.TokenKind.BRACKET_R, pos, pos + 1, line, col, prev); // { case 123: return new Tok(_tokenKind.TokenKind.BRACE_L, pos, pos + 1, line, col, prev); // | case 124: return new Tok(_tokenKind.TokenKind.PIPE, pos, pos + 1, line, col, prev); // } case 125: return new Tok(_tokenKind.TokenKind.BRACE_R, pos, pos + 1, line, col, prev); // A-Z _ a-z case 65: case 66: case 67: case 68: case 69: case 70: case 71: case 72: case 73: case 74: case 75: case 76: case 77: case 78: case 79: case 80: case 81: case 82: case 83: case 84: case 85: case 86: case 87: case 88: case 89: case 90: case 95: case 97: case 98: case 99: case 100: case 101: case 102: case 103: case 104: case 105: case 106: case 107: case 108: case 109: case 110: case 111: case 112: case 113: case 114: case 115: case 116: case 117: case 118: case 119: case 120: case 121: case 122: return readName(source, pos, line, col, prev); // - 0-9 case 45: case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: return readNumber(source, pos, code, line, col, prev); // " case 34: if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) { return readBlockString(source, pos, line, col, prev, lexer); } return readString(source, pos, line, col, prev); } throw (0, _syntaxError.syntaxError)(source, pos, unexpectedCharacterMessage(code)); } /** * Report a message that an unexpected character was encountered. */ function unexpectedCharacterMessage(code) { if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) { return "Cannot contain the invalid character ".concat(printCharCode(code), "."); } if (code === 39) { // ' return 'Unexpected single quote character (\'), did you mean to use a double quote (")?'; } return "Cannot parse the unexpected character ".concat(printCharCode(code), "."); } /** * Reads from body starting at startPosition until it finds a non-whitespace * character, then returns the position of that character for lexing. */ function positionAfterWhitespace(body, startPosition, lexer) { var bodyLength = body.length; var position = startPosition; while (position < bodyLength) { var code = body.charCodeAt(position); // tab | space | comma | BOM if (code === 9 || code === 32 || code === 44 || code === 0xfeff) { ++position; } else if (code === 10) { // new line ++position; ++lexer.line; lexer.lineStart = position; } else if (code === 13) { // carriage return if (body.charCodeAt(position + 1) === 10) { position += 2; } else { ++position; } ++lexer.line; lexer.lineStart = position; } else { break; } } return position; } /** * Reads a comment token from the source file. * * #[\u0009\u0020-\uFFFF]* */ function readComment(source, start, line, col, prev) { var body = source.body; var code; var position = start; do { code = body.charCodeAt(++position); } while (!isNaN(code) && ( // SourceCharacter but not LineTerminator code > 0x001f || code === 0x0009)); return new Tok(_tokenKind.TokenKind.COMMENT, start, position, line, col, prev, body.slice(start + 1, position)); } /** * Reads a number token from the source file, either a float * or an int depending on whether a decimal point appears. * * Int: -?(0|[1-9][0-9]*) * Float: -?(0|[1-9][0-9]*)(\.[0-9]+)?((E|e)(+|-)?[0-9]+)? */ function readNumber(source, start, firstCode, line, col, prev) { var body = source.body; var code = firstCode; var position = start; var isFloat = false; if (code === 45) { // - code = body.charCodeAt(++position); } if (code === 48) { // 0 code = body.charCodeAt(++position); if (code >= 48 && code <= 57) { throw (0, _syntaxError.syntaxError)(source, position, "Invalid number, unexpected digit after 0: ".concat(printCharCode(code), ".")); } } else { position = readDigits(source, position, code); code = body.charCodeAt(position); } if (code === 46) { // . isFloat = true; code = body.charCodeAt(++position); position = readDigits(source, position, code); code = body.charCodeAt(position); } if (code === 69 || code === 101) { // E e isFloat = true; code = body.charCodeAt(++position); if (code === 43 || code === 45) { // + - code = body.charCodeAt(++position); } position = readDigits(source, position, code); } return new Tok(isFloat ? _tokenKind.TokenKind.FLOAT : _tokenKind.TokenKind.INT, start, position, line, col, prev, body.slice(start, position)); } /** * Returns the new position in the source after reading digits. */ function readDigits(source, start, firstCode) { var body = source.body; var position = start; var code = firstCode; if (code >= 48 && code <= 57) { // 0 - 9 do { code = body.charCodeAt(++position); } while (code >= 48 && code <= 57); // 0 - 9 return position; } throw (0, _syntaxError.syntaxError)(source, position, "Invalid number, expected digit but got: ".concat(printCharCode(code), ".")); } /** * Reads a string token from the source file. * * "([^"\\\u000A\u000D]|(\\(u[0-9a-fA-F]{4}|["\\/bfnrt])))*" */ function readString(source, start, line, col, prev) { var body = source.body; var position = start + 1; var chunkStart = position; var code = 0; var value = ''; while (position < body.length && !isNaN(code = body.charCodeAt(position)) && // not LineTerminator code !== 0x000a && code !== 0x000d) { // Closing Quote (") if (code === 34) { value += body.slice(chunkStart, position); return new Tok(_tokenKind.TokenKind.STRING, start, position + 1, line, col, prev, value); } // SourceCharacter if (code < 0x0020 && code !== 0x0009) { throw (0, _syntaxError.syntaxError)(source, position, "Invalid character within String: ".concat(printCharCode(code), ".")); } ++position; if (code === 92) { // \ value += body.slice(chunkStart, position - 1); code = body.charCodeAt(position); switch (code) { case 34: value += '"'; break; case 47: value += '/'; break; case 92: value += '\\'; break; case 98: value += '\b'; break; case 102: value += '\f'; break; case 110: value += '\n'; break; case 114: value += '\r'; break; case 116: value += '\t'; break; case 117: { // uXXXX var charCode = uniCharCode(body.charCodeAt(position + 1), body.charCodeAt(position + 2), body.charCodeAt(position + 3), body.charCodeAt(position + 4)); if (charCode < 0) { var invalidSequence = body.slice(position + 1, position + 5); throw (0, _syntaxError.syntaxError)(source, position, "Invalid character escape sequence: \\u".concat(invalidSequence, ".")); } value += String.fromCharCode(charCode); position += 4; break; } default: throw (0, _syntaxError.syntaxError)(source, position, "Invalid character escape sequence: \\".concat(String.fromCharCode(code), ".")); } ++position; chunkStart = position; } } throw (0, _syntaxError.syntaxError)(source, position, 'Unterminated string.'); } /** * Reads a block string token from the source file. * * """("?"?(\\"""|\\(?!=""")|[^"\\]))*""" */ function readBlockString(source, start, line, col, prev, lexer) { var body = source.body; var position = start + 3; var chunkStart = position; var code = 0; var rawValue = ''; while (position < body.length && !isNaN(code = body.charCodeAt(position))) { // Closing Triple-Quote (""") if (code === 34 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) { rawValue += body.slice(chunkStart, position); return new Tok(_tokenKind.TokenKind.BLOCK_STRING, start, position + 3, line, col, prev, (0, _blockString.dedentBlockStringValue)(rawValue)); } // SourceCharacter if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) { throw (0, _syntaxError.syntaxError)(source, position, "Invalid character within String: ".concat(printCharCode(code), ".")); } if (code === 10) { // new line ++position; ++lexer.line; lexer.lineStart = position; } else if (code === 13) { // carriage return if (body.charCodeAt(position + 1) === 10) { position += 2; } else { ++position; } ++lexer.line; lexer.lineStart = position; } else if ( // Escape Triple-Quote (\""") code === 92 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34 && body.charCodeAt(position + 3) === 34) { rawValue += body.slice(chunkStart, position) + '"""'; position += 4; chunkStart = position; } else { ++position; } } throw (0, _syntaxError.syntaxError)(source, position, 'Unterminated string.'); } /** * Converts four hexadecimal chars to the integer that the * string represents. For example, uniCharCode('0','0','0','f') * will return 15, and uniCharCode('0','0','f','f') returns 255. * * Returns a negative number on error, if a char was invalid. * * This is implemented by noting that char2hex() returns -1 on error, * which means the result of ORing the char2hex() will also be negative. */ function uniCharCode(a, b, c, d) { return char2hex(a) << 12 | char2hex(b) << 8 | char2hex(c) << 4 | char2hex(d); } /** * Converts a hex character to its integer value. * '0' becomes 0, '9' becomes 9 * 'A' becomes 10, 'F' becomes 15 * 'a' becomes 10, 'f' becomes 15 * * Returns -1 on error. */ function char2hex(a) { return a >= 48 && a <= 57 ? a - 48 // 0-9 : a >= 65 && a <= 70 ? a - 55 // A-F : a >= 97 && a <= 102 ? a - 87 // a-f : -1; } /** * Reads an alphanumeric + underscore name from the source. * * [_A-Za-z][_0-9A-Za-z]* */ function readName(source, start, line, col, prev) { var body = source.body; var bodyLength = body.length; var position = start + 1; var code = 0; while (position !== bodyLength && !isNaN(code = body.charCodeAt(position)) && (code === 95 || // _ code >= 48 && code <= 57 || // 0-9 code >= 65 && code <= 90 || // A-Z code >= 97 && code <= 122) // a-z ) { ++position; } return new Tok(_tokenKind.TokenKind.NAME, start, position, line, col, prev, body.slice(start, position)); } /***/ }), /***/ "./node_modules/graphql/language/location.js": /*!***************************************************!*\ !*** ./node_modules/graphql/language/location.js ***! \***************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getLocation = getLocation; /** * Represents a location in a Source. */ /** * Takes a Source and a UTF-8 character offset, and returns the corresponding * line and column as a SourceLocation. */ function getLocation(source, position) { var lineRegexp = /\r\n|[\n\r]/g; var line = 1; var column = position + 1; var match; while ((match = lineRegexp.exec(source.body)) && match.index < position) { line += 1; column = position + 1 - (match.index + match[0].length); } return { line: line, column: column }; } /***/ }), /***/ "./node_modules/graphql/language/parser.js": /*!*************************************************!*\ !*** ./node_modules/graphql/language/parser.js ***! \*************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parse = parse; exports.parseValue = parseValue; exports.parseType = parseType; exports.parseConstValue = parseConstValue; exports.parseTypeReference = parseTypeReference; exports.parseNamedType = parseNamedType; var _inspect = _interopRequireDefault(__webpack_require__(/*! ../jsutils/inspect */ "./node_modules/graphql/jsutils/inspect.js")); var _defineToJSON = _interopRequireDefault(__webpack_require__(/*! ../jsutils/defineToJSON */ "./node_modules/graphql/jsutils/defineToJSON.js")); var _source = __webpack_require__(/*! ./source */ "./node_modules/graphql/language/source.js"); var _syntaxError = __webpack_require__(/*! ../error/syntaxError */ "./node_modules/graphql/error/syntaxError.js"); var _tokenKind = __webpack_require__(/*! ./tokenKind */ "./node_modules/graphql/language/tokenKind.js"); var _lexer = __webpack_require__(/*! ./lexer */ "./node_modules/graphql/language/lexer.js"); var _kinds = __webpack_require__(/*! ./kinds */ "./node_modules/graphql/language/kinds.js"); var _directiveLocation = __webpack_require__(/*! ./directiveLocation */ "./node_modules/graphql/language/directiveLocation.js"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Given a GraphQL source, parses it into a Document. * Throws GraphQLError if a syntax error is encountered. */ function parse(source, options) { var sourceObj = typeof source === 'string' ? new _source.Source(source) : source; if (!(sourceObj instanceof _source.Source)) { throw new TypeError("Must provide Source. Received: ".concat((0, _inspect.default)(sourceObj))); } var lexer = (0, _lexer.createLexer)(sourceObj, options || {}); return parseDocument(lexer); } /** * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for * that value. * Throws GraphQLError if a syntax error is encountered. * * This is useful within tools that operate upon GraphQL Values directly and * in isolation of complete GraphQL documents. * * Consider providing the results to the utility function: valueFromAST(). */ function parseValue(source, options) { var sourceObj = typeof source === 'string' ? new _source.Source(source) : source; var lexer = (0, _lexer.createLexer)(sourceObj, options || {}); expectToken(lexer, _tokenKind.TokenKind.SOF); var value = parseValueLiteral(lexer, false); expectToken(lexer, _tokenKind.TokenKind.EOF); return value; } /** * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for * that type. * Throws GraphQLError if a syntax error is encountered. * * This is useful within tools that operate upon GraphQL Types directly and * in isolation of complete GraphQL documents. * * Consider providing the results to the utility function: typeFromAST(). */ function parseType(source, options) { var sourceObj = typeof source === 'string' ? new _source.Source(source) : source; var lexer = (0, _lexer.createLexer)(sourceObj, options || {}); expectToken(lexer, _tokenKind.TokenKind.SOF); var type = parseTypeReference(lexer); expectToken(lexer, _tokenKind.TokenKind.EOF); return type; } /** * Converts a name lex token into a name parse node. */ function parseName(lexer) { var token = expectToken(lexer, _tokenKind.TokenKind.NAME); return { kind: _kinds.Kind.NAME, value: token.value, loc: loc(lexer, token) }; } // Implements the parsing rules in the Document section. /** * Document : Definition+ */ function parseDocument(lexer) { var start = lexer.token; return { kind: _kinds.Kind.DOCUMENT, definitions: many(lexer, _tokenKind.TokenKind.SOF, parseDefinition, _tokenKind.TokenKind.EOF), loc: loc(lexer, start) }; } /** * Definition : * - ExecutableDefinition * - TypeSystemDefinition * - TypeSystemExtension */ function parseDefinition(lexer) { if (peek(lexer, _tokenKind.TokenKind.NAME)) { switch (lexer.token.value) { case 'query': case 'mutation': case 'subscription': case 'fragment': return parseExecutableDefinition(lexer); case 'schema': case 'scalar': case 'type': case 'interface': case 'union': case 'enum': case 'input': case 'directive': return parseTypeSystemDefinition(lexer); case 'extend': return parseTypeSystemExtension(lexer); } } else if (peek(lexer, _tokenKind.TokenKind.BRACE_L)) { return parseExecutableDefinition(lexer); } else if (peekDescription(lexer)) { return parseTypeSystemDefinition(lexer); } throw unexpected(lexer); } /** * ExecutableDefinition : * - OperationDefinition * - FragmentDefinition */ function parseExecutableDefinition(lexer) { if (peek(lexer, _tokenKind.TokenKind.NAME)) { switch (lexer.token.value) { case 'query': case 'mutation': case 'subscription': return parseOperationDefinition(lexer); case 'fragment': return parseFragmentDefinition(lexer); } } else if (peek(lexer, _tokenKind.TokenKind.BRACE_L)) { return parseOperationDefinition(lexer); } throw unexpected(lexer); } // Implements the parsing rules in the Operations section. /** * OperationDefinition : * - SelectionSet * - OperationType Name? VariableDefinitions? Directives? SelectionSet */ function parseOperationDefinition(lexer) { var start = lexer.token; if (peek(lexer, _tokenKind.TokenKind.BRACE_L)) { return { kind: _kinds.Kind.OPERATION_DEFINITION, operation: 'query', name: undefined, variableDefinitions: [], directives: [], selectionSet: parseSelectionSet(lexer), loc: loc(lexer, start) }; } var operation = parseOperationType(lexer); var name; if (peek(lexer, _tokenKind.TokenKind.NAME)) { name = parseName(lexer); } return { kind: _kinds.Kind.OPERATION_DEFINITION, operation: operation, name: name, variableDefinitions: parseVariableDefinitions(lexer), directives: parseDirectives(lexer, false), selectionSet: parseSelectionSet(lexer), loc: loc(lexer, start) }; } /** * OperationType : one of query mutation subscription */ function parseOperationType(lexer) { var operationToken = expectToken(lexer, _tokenKind.TokenKind.NAME); switch (operationToken.value) { case 'query': return 'query'; case 'mutation': return 'mutation'; case 'subscription': return 'subscription'; } throw unexpected(lexer, operationToken); } /** * VariableDefinitions : ( VariableDefinition+ ) */ function parseVariableDefinitions(lexer) { return peek(lexer, _tokenKind.TokenKind.PAREN_L) ? many(lexer, _tokenKind.TokenKind.PAREN_L, parseVariableDefinition, _tokenKind.TokenKind.PAREN_R) : []; } /** * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? */ function parseVariableDefinition(lexer) { var start = lexer.token; return { kind: _kinds.Kind.VARIABLE_DEFINITION, variable: parseVariable(lexer), type: (expectToken(lexer, _tokenKind.TokenKind.COLON), parseTypeReference(lexer)), defaultValue: expectOptionalToken(lexer, _tokenKind.TokenKind.EQUALS) ? parseValueLiteral(lexer, true) : undefined, directives: parseDirectives(lexer, true), loc: loc(lexer, start) }; } /** * Variable : $ Name */ function parseVariable(lexer) { var start = lexer.token; expectToken(lexer, _tokenKind.TokenKind.DOLLAR); return { kind: _kinds.Kind.VARIABLE, name: parseName(lexer), loc: loc(lexer, start) }; } /** * SelectionSet : { Selection+ } */ function parseSelectionSet(lexer) { var start = lexer.token; return { kind: _kinds.Kind.SELECTION_SET, selections: many(lexer, _tokenKind.TokenKind.BRACE_L, parseSelection, _tokenKind.TokenKind.BRACE_R), loc: loc(lexer, start) }; } /** * Selection : * - Field * - FragmentSpread * - InlineFragment */ function parseSelection(lexer) { return peek(lexer, _tokenKind.TokenKind.SPREAD) ? parseFragment(lexer) : parseField(lexer); } /** * Field : Alias? Name Arguments? Directives? SelectionSet? * * Alias : Name : */ function parseField(lexer) { var start = lexer.token; var nameOrAlias = parseName(lexer); var alias; var name; if (expectOptionalToken(lexer, _tokenKind.TokenKind.COLON)) { alias = nameOrAlias; name = parseName(lexer); } else { name = nameOrAlias; } return { kind: _kinds.Kind.FIELD, alias: alias, name: name, arguments: parseArguments(lexer, false), directives: parseDirectives(lexer, false), selectionSet: peek(lexer, _tokenKind.TokenKind.BRACE_L) ? parseSelectionSet(lexer) : undefined, loc: loc(lexer, start) }; } /** * Arguments[Const] : ( Argument[?Const]+ ) */ function parseArguments(lexer, isConst) { var item = isConst ? parseConstArgument : parseArgument; return peek(lexer, _tokenKind.TokenKind.PAREN_L) ? many(lexer, _tokenKind.TokenKind.PAREN_L, item, _tokenKind.TokenKind.PAREN_R) : []; } /** * Argument[Const] : Name : Value[?Const] */ function parseArgument(lexer) { var start = lexer.token; var name = parseName(lexer); expectToken(lexer, _tokenKind.TokenKind.COLON); return { kind: _kinds.Kind.ARGUMENT, name: name, value: parseValueLiteral(lexer, false), loc: loc(lexer, start) }; } function parseConstArgument(lexer) { var start = lexer.token; return { kind: _kinds.Kind.ARGUMENT, name: parseName(lexer), value: (expectToken(lexer, _tokenKind.TokenKind.COLON), parseConstValue(lexer)), loc: loc(lexer, start) }; } // Implements the parsing rules in the Fragments section. /** * Corresponds to both FragmentSpread and InlineFragment in the spec. * * FragmentSpread : ... FragmentName Directives? * * InlineFragment : ... TypeCondition? Directives? SelectionSet */ function parseFragment(lexer) { var start = lexer.token; expectToken(lexer, _tokenKind.TokenKind.SPREAD); var hasTypeCondition = expectOptionalKeyword(lexer, 'on'); if (!hasTypeCondition && peek(lexer, _tokenKind.TokenKind.NAME)) { return { kind: _kinds.Kind.FRAGMENT_SPREAD, name: parseFragmentName(lexer), directives: parseDirectives(lexer, false), loc: loc(lexer, start) }; } return { kind: _kinds.Kind.INLINE_FRAGMENT, typeCondition: hasTypeCondition ? parseNamedType(lexer) : undefined, directives: parseDirectives(lexer, false), selectionSet: parseSelectionSet(lexer), loc: loc(lexer, start) }; } /** * FragmentDefinition : * - fragment FragmentName on TypeCondition Directives? SelectionSet * * TypeCondition : NamedType */ function parseFragmentDefinition(lexer) { var start = lexer.token; expectKeyword(lexer, 'fragment'); // Experimental support for defining variables within fragments changes // the grammar of FragmentDefinition: // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet if (lexer.options.experimentalFragmentVariables) { return { kind: _kinds.Kind.FRAGMENT_DEFINITION, name: parseFragmentName(lexer), variableDefinitions: parseVariableDefinitions(lexer), typeCondition: (expectKeyword(lexer, 'on'), parseNamedType(lexer)), directives: parseDirectives(lexer, false), selectionSet: parseSelectionSet(lexer), loc: loc(lexer, start) }; } return { kind: _kinds.Kind.FRAGMENT_DEFINITION, name: parseFragmentName(lexer), typeCondition: (expectKeyword(lexer, 'on'), parseNamedType(lexer)), directives: parseDirectives(lexer, false), selectionSet: parseSelectionSet(lexer), loc: loc(lexer, start) }; } /** * FragmentName : Name but not `on` */ function parseFragmentName(lexer) { if (lexer.token.value === 'on') { throw unexpected(lexer); } return parseName(lexer); } // Implements the parsing rules in the Values section. /** * Value[Const] : * - [~Const] Variable * - IntValue * - FloatValue * - StringValue * - BooleanValue * - NullValue * - EnumValue * - ListValue[?Const] * - ObjectValue[?Const] * * BooleanValue : one of `true` `false` * * NullValue : `null` * * EnumValue : Name but not `true`, `false` or `null` */ function parseValueLiteral(lexer, isConst) { var token = lexer.token; switch (token.kind) { case _tokenKind.TokenKind.BRACKET_L: return parseList(lexer, isConst); case _tokenKind.TokenKind.BRACE_L: return parseObject(lexer, isConst); case _tokenKind.TokenKind.INT: lexer.advance(); return { kind: _kinds.Kind.INT, value: token.value, loc: loc(lexer, token) }; case _tokenKind.TokenKind.FLOAT: lexer.advance(); return { kind: _kinds.Kind.FLOAT, value: token.value, loc: loc(lexer, token) }; case _tokenKind.TokenKind.STRING: case _tokenKind.TokenKind.BLOCK_STRING: return parseStringLiteral(lexer); case _tokenKind.TokenKind.NAME: if (token.value === 'true' || token.value === 'false') { lexer.advance(); return { kind: _kinds.Kind.BOOLEAN, value: token.value === 'true', loc: loc(lexer, token) }; } else if (token.value === 'null') { lexer.advance(); return { kind: _kinds.Kind.NULL, loc: loc(lexer, token) }; } lexer.advance(); return { kind: _kinds.Kind.ENUM, value: token.value, loc: loc(lexer, token) }; case _tokenKind.TokenKind.DOLLAR: if (!isConst) { return parseVariable(lexer); } break; } throw unexpected(lexer); } function parseStringLiteral(lexer) { var token = lexer.token; lexer.advance(); return { kind: _kinds.Kind.STRING, value: token.value, block: token.kind === _tokenKind.TokenKind.BLOCK_STRING, loc: loc(lexer, token) }; } function parseConstValue(lexer) { return parseValueLiteral(lexer, true); } function parseValueValue(lexer) { return parseValueLiteral(lexer, false); } /** * ListValue[Const] : * - [ ] * - [ Value[?Const]+ ] */ function parseList(lexer, isConst) { var start = lexer.token; var item = isConst ? parseConstValue : parseValueValue; return { kind: _kinds.Kind.LIST, values: any(lexer, _tokenKind.TokenKind.BRACKET_L, item, _tokenKind.TokenKind.BRACKET_R), loc: loc(lexer, start) }; } /** * ObjectValue[Const] : * - { } * - { ObjectField[?Const]+ } */ function parseObject(lexer, isConst) { var start = lexer.token; var item = function item() { return parseObjectField(lexer, isConst); }; return { kind: _kinds.Kind.OBJECT, fields: any(lexer, _tokenKind.TokenKind.BRACE_L, item, _tokenKind.TokenKind.BRACE_R), loc: loc(lexer, start) }; } /** * ObjectField[Const] : Name : Value[?Const] */ function parseObjectField(lexer, isConst) { var start = lexer.token; var name = parseName(lexer); expectToken(lexer, _tokenKind.TokenKind.COLON); return { kind: _kinds.Kind.OBJECT_FIELD, name: name, value: parseValueLiteral(lexer, isConst), loc: loc(lexer, start) }; } // Implements the parsing rules in the Directives section. /** * Directives[Const] : Directive[?Const]+ */ function parseDirectives(lexer, isConst) { var directives = []; while (peek(lexer, _tokenKind.TokenKind.AT)) { directives.push(parseDirective(lexer, isConst)); } return directives; } /** * Directive[Const] : @ Name Arguments[?Const]? */ function parseDirective(lexer, isConst) { var start = lexer.token; expectToken(lexer, _tokenKind.TokenKind.AT); return { kind: _kinds.Kind.DIRECTIVE, name: parseName(lexer), arguments: parseArguments(lexer, isConst), loc: loc(lexer, start) }; } // Implements the parsing rules in the Types section. /** * Type : * - NamedType * - ListType * - NonNullType */ function parseTypeReference(lexer) { var start = lexer.token; var type; if (expectOptionalToken(lexer, _tokenKind.TokenKind.BRACKET_L)) { type = parseTypeReference(lexer); expectToken(lexer, _tokenKind.TokenKind.BRACKET_R); type = { kind: _kinds.Kind.LIST_TYPE, type: type, loc: loc(lexer, start) }; } else { type = parseNamedType(lexer); } if (expectOptionalToken(lexer, _tokenKind.TokenKind.BANG)) { return { kind: _kinds.Kind.NON_NULL_TYPE, type: type, loc: loc(lexer, start) }; } return type; } /** * NamedType : Name */ function parseNamedType(lexer) { var start = lexer.token; return { kind: _kinds.Kind.NAMED_TYPE, name: parseName(lexer), loc: loc(lexer, start) }; } // Implements the parsing rules in the Type Definition section. /** * TypeSystemDefinition : * - SchemaDefinition * - TypeDefinition * - DirectiveDefinition * * TypeDefinition : * - ScalarTypeDefinition * - ObjectTypeDefinition * - InterfaceTypeDefinition * - UnionTypeDefinition * - EnumTypeDefinition * - InputObjectTypeDefinition */ function parseTypeSystemDefinition(lexer) { // Many definitions begin with a description and require a lookahead. var keywordToken = peekDescription(lexer) ? lexer.lookahead() : lexer.token; if (keywordToken.kind === _tokenKind.TokenKind.NAME) { switch (keywordToken.value) { case 'schema': return parseSchemaDefinition(lexer); case 'scalar': return parseScalarTypeDefinition(lexer); case 'type': return parseObjectTypeDefinition(lexer); case 'interface': return parseInterfaceTypeDefinition(lexer); case 'union': return parseUnionTypeDefinition(lexer); case 'enum': return parseEnumTypeDefinition(lexer); case 'input': return parseInputObjectTypeDefinition(lexer); case 'directive': return parseDirectiveDefinition(lexer); } } throw unexpected(lexer, keywordToken); } function peekDescription(lexer) { return peek(lexer, _tokenKind.TokenKind.STRING) || peek(lexer, _tokenKind.TokenKind.BLOCK_STRING); } /** * Description : StringValue */ function parseDescription(lexer) { if (peekDescription(lexer)) { return parseStringLiteral(lexer); } } /** * SchemaDefinition : schema Directives[Const]? { OperationTypeDefinition+ } */ function parseSchemaDefinition(lexer) { var start = lexer.token; expectKeyword(lexer, 'schema'); var directives = parseDirectives(lexer, true); var operationTypes = many(lexer, _tokenKind.TokenKind.BRACE_L, parseOperationTypeDefinition, _tokenKind.TokenKind.BRACE_R); return { kind: _kinds.Kind.SCHEMA_DEFINITION, directives: directives, operationTypes: operationTypes, loc: loc(lexer, start) }; } /** * OperationTypeDefinition : OperationType : NamedType */ function parseOperationTypeDefinition(lexer) { var start = lexer.token; var operation = parseOperationType(lexer); expectToken(lexer, _tokenKind.TokenKind.COLON); var type = parseNamedType(lexer); return { kind: _kinds.Kind.OPERATION_TYPE_DEFINITION, operation: operation, type: type, loc: loc(lexer, start) }; } /** * ScalarTypeDefinition : Description? scalar Name Directives[Const]? */ function parseScalarTypeDefinition(lexer) { var start = lexer.token; var description = parseDescription(lexer); expectKeyword(lexer, 'scalar'); var name = parseName(lexer); var directives = parseDirectives(lexer, true); return { kind: _kinds.Kind.SCALAR_TYPE_DEFINITION, description: description, name: name, directives: directives, loc: loc(lexer, start) }; } /** * ObjectTypeDefinition : * Description? * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? */ function parseObjectTypeDefinition(lexer) { var start = lexer.token; var description = parseDescription(lexer); expectKeyword(lexer, 'type'); var name = parseName(lexer); var interfaces = parseImplementsInterfaces(lexer); var directives = parseDirectives(lexer, true); var fields = parseFieldsDefinition(lexer); return { kind: _kinds.Kind.OBJECT_TYPE_DEFINITION, description: description, name: name, interfaces: interfaces, directives: directives, fields: fields, loc: loc(lexer, start) }; } /** * ImplementsInterfaces : * - implements `&`? NamedType * - ImplementsInterfaces & NamedType */ function parseImplementsInterfaces(lexer) { var types = []; if (expectOptionalKeyword(lexer, 'implements')) { // Optional leading ampersand expectOptionalToken(lexer, _tokenKind.TokenKind.AMP); do { types.push(parseNamedType(lexer)); } while (expectOptionalToken(lexer, _tokenKind.TokenKind.AMP) || // Legacy support for the SDL? lexer.options.allowLegacySDLImplementsInterfaces && peek(lexer, _tokenKind.TokenKind.NAME)); } return types; } /** * FieldsDefinition : { FieldDefinition+ } */ function parseFieldsDefinition(lexer) { // Legacy support for the SDL? if (lexer.options.allowLegacySDLEmptyFields && peek(lexer, _tokenKind.TokenKind.BRACE_L) && lexer.lookahead().kind === _tokenKind.TokenKind.BRACE_R) { lexer.advance(); lexer.advance(); return []; } return peek(lexer, _tokenKind.TokenKind.BRACE_L) ? many(lexer, _tokenKind.TokenKind.BRACE_L, parseFieldDefinition, _tokenKind.TokenKind.BRACE_R) : []; } /** * FieldDefinition : * - Description? Name ArgumentsDefinition? : Type Directives[Const]? */ function parseFieldDefinition(lexer) { var start = lexer.token; var description = parseDescription(lexer); var name = parseName(lexer); var args = parseArgumentDefs(lexer); expectToken(lexer, _tokenKind.TokenKind.COLON); var type = parseTypeReference(lexer); var directives = parseDirectives(lexer, true); return { kind: _kinds.Kind.FIELD_DEFINITION, description: description, name: name, arguments: args, type: type, directives: directives, loc: loc(lexer, start) }; } /** * ArgumentsDefinition : ( InputValueDefinition+ ) */ function parseArgumentDefs(lexer) { if (!peek(lexer, _tokenKind.TokenKind.PAREN_L)) { return []; } return many(lexer, _tokenKind.TokenKind.PAREN_L, parseInputValueDef, _tokenKind.TokenKind.PAREN_R); } /** * InputValueDefinition : * - Description? Name : Type DefaultValue? Directives[Const]? */ function parseInputValueDef(lexer) { var start = lexer.token; var description = parseDescription(lexer); var name = parseName(lexer); expectToken(lexer, _tokenKind.TokenKind.COLON); var type = parseTypeReference(lexer); var defaultValue; if (expectOptionalToken(lexer, _tokenKind.TokenKind.EQUALS)) { defaultValue = parseConstValue(lexer); } var directives = parseDirectives(lexer, true); return { kind: _kinds.Kind.INPUT_VALUE_DEFINITION, description: description, name: name, type: type, defaultValue: defaultValue, directives: directives, loc: loc(lexer, start) }; } /** * InterfaceTypeDefinition : * - Description? interface Name Directives[Const]? FieldsDefinition? */ function parseInterfaceTypeDefinition(lexer) { var start = lexer.token; var description = parseDescription(lexer); expectKeyword(lexer, 'interface'); var name = parseName(lexer); var directives = parseDirectives(lexer, true); var fields = parseFieldsDefinition(lexer); return { kind: _kinds.Kind.INTERFACE_TYPE_DEFINITION, description: description, name: name, directives: directives, fields: fields, loc: loc(lexer, start) }; } /** * UnionTypeDefinition : * - Description? union Name Directives[Const]? UnionMemberTypes? */ function parseUnionTypeDefinition(lexer) { var start = lexer.token; var description = parseDescription(lexer); expectKeyword(lexer, 'union'); var name = parseName(lexer); var directives = parseDirectives(lexer, true); var types = parseUnionMemberTypes(lexer); return { kind: _kinds.Kind.UNION_TYPE_DEFINITION, description: description, name: name, directives: directives, types: types, loc: loc(lexer, start) }; } /** * UnionMemberTypes : * - = `|`? NamedType * - UnionMemberTypes | NamedType */ function parseUnionMemberTypes(lexer) { var types = []; if (expectOptionalToken(lexer, _tokenKind.TokenKind.EQUALS)) { // Optional leading pipe expectOptionalToken(lexer, _tokenKind.TokenKind.PIPE); do { types.push(parseNamedType(lexer)); } while (expectOptionalToken(lexer, _tokenKind.TokenKind.PIPE)); } return types; } /** * EnumTypeDefinition : * - Description? enum Name Directives[Const]? EnumValuesDefinition? */ function parseEnumTypeDefinition(lexer) { var start = lexer.token; var description = parseDescription(lexer); expectKeyword(lexer, 'enum'); var name = parseName(lexer); var directives = parseDirectives(lexer, true); var values = parseEnumValuesDefinition(lexer); return { kind: _kinds.Kind.ENUM_TYPE_DEFINITION, description: description, name: name, directives: directives, values: values, loc: loc(lexer, start) }; } /** * EnumValuesDefinition : { EnumValueDefinition+ } */ function parseEnumValuesDefinition(lexer) { return peek(lexer, _tokenKind.TokenKind.BRACE_L) ? many(lexer, _tokenKind.TokenKind.BRACE_L, parseEnumValueDefinition, _tokenKind.TokenKind.BRACE_R) : []; } /** * EnumValueDefinition : Description? EnumValue Directives[Const]? * * EnumValue : Name */ function parseEnumValueDefinition(lexer) { var start = lexer.token; var description = parseDescription(lexer); var name = parseName(lexer); var directives = parseDirectives(lexer, true); return { kind: _kinds.Kind.ENUM_VALUE_DEFINITION, description: description, name: name, directives: directives, loc: loc(lexer, start) }; } /** * InputObjectTypeDefinition : * - Description? input Name Directives[Const]? InputFieldsDefinition? */ function parseInputObjectTypeDefinition(lexer) { var start = lexer.token; var description = parseDescription(lexer); expectKeyword(lexer, 'input'); var name = parseName(lexer); var directives = parseDirectives(lexer, true); var fields = parseInputFieldsDefinition(lexer); return { kind: _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION, description: description, name: name, directives: directives, fields: fields, loc: loc(lexer, start) }; } /** * InputFieldsDefinition : { InputValueDefinition+ } */ function parseInputFieldsDefinition(lexer) { return peek(lexer, _tokenKind.TokenKind.BRACE_L) ? many(lexer, _tokenKind.TokenKind.BRACE_L, parseInputValueDef, _tokenKind.TokenKind.BRACE_R) : []; } /** * TypeSystemExtension : * - SchemaExtension * - TypeExtension * * TypeExtension : * - ScalarTypeExtension * - ObjectTypeExtension * - InterfaceTypeExtension * - UnionTypeExtension * - EnumTypeExtension * - InputObjectTypeDefinition */ function parseTypeSystemExtension(lexer) { var keywordToken = lexer.lookahead(); if (keywordToken.kind === _tokenKind.TokenKind.NAME) { switch (keywordToken.value) { case 'schema': return parseSchemaExtension(lexer); case 'scalar': return parseScalarTypeExtension(lexer); case 'type': return parseObjectTypeExtension(lexer); case 'interface': return parseInterfaceTypeExtension(lexer); case 'union': return parseUnionTypeExtension(lexer); case 'enum': return parseEnumTypeExtension(lexer); case 'input': return parseInputObjectTypeExtension(lexer); } } throw unexpected(lexer, keywordToken); } /** * SchemaExtension : * - extend schema Directives[Const]? { OperationTypeDefinition+ } * - extend schema Directives[Const] */ function parseSchemaExtension(lexer) { var start = lexer.token; expectKeyword(lexer, 'extend'); expectKeyword(lexer, 'schema'); var directives = parseDirectives(lexer, true); var operationTypes = peek(lexer, _tokenKind.TokenKind.BRACE_L) ? many(lexer, _tokenKind.TokenKind.BRACE_L, parseOperationTypeDefinition, _tokenKind.TokenKind.BRACE_R) : []; if (directives.length === 0 && operationTypes.length === 0) { throw unexpected(lexer); } return { kind: _kinds.Kind.SCHEMA_EXTENSION, directives: directives, operationTypes: operationTypes, loc: loc(lexer, start) }; } /** * ScalarTypeExtension : * - extend scalar Name Directives[Const] */ function parseScalarTypeExtension(lexer) { var start = lexer.token; expectKeyword(lexer, 'extend'); expectKeyword(lexer, 'scalar'); var name = parseName(lexer); var directives = parseDirectives(lexer, true); if (directives.length === 0) { throw unexpected(lexer); } return { kind: _kinds.Kind.SCALAR_TYPE_EXTENSION, name: name, directives: directives, loc: loc(lexer, start) }; } /** * ObjectTypeExtension : * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition * - extend type Name ImplementsInterfaces? Directives[Const] * - extend type Name ImplementsInterfaces */ function parseObjectTypeExtension(lexer) { var start = lexer.token; expectKeyword(lexer, 'extend'); expectKeyword(lexer, 'type'); var name = parseName(lexer); var interfaces = parseImplementsInterfaces(lexer); var directives = parseDirectives(lexer, true); var fields = parseFieldsDefinition(lexer); if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) { throw unexpected(lexer); } return { kind: _kinds.Kind.OBJECT_TYPE_EXTENSION, name: name, interfaces: interfaces, directives: directives, fields: fields, loc: loc(lexer, start) }; } /** * InterfaceTypeExtension : * - extend interface Name Directives[Const]? FieldsDefinition * - extend interface Name Directives[Const] */ function parseInterfaceTypeExtension(lexer) { var start = lexer.token; expectKeyword(lexer, 'extend'); expectKeyword(lexer, 'interface'); var name = parseName(lexer); var directives = parseDirectives(lexer, true); var fields = parseFieldsDefinition(lexer); if (directives.length === 0 && fields.length === 0) { throw unexpected(lexer); } return { kind: _kinds.Kind.INTERFACE_TYPE_EXTENSION, name: name, directives: directives, fields: fields, loc: loc(lexer, start) }; } /** * UnionTypeExtension : * - extend union Name Directives[Const]? UnionMemberTypes * - extend union Name Directives[Const] */ function parseUnionTypeExtension(lexer) { var start = lexer.token; expectKeyword(lexer, 'extend'); expectKeyword(lexer, 'union'); var name = parseName(lexer); var directives = parseDirectives(lexer, true); var types = parseUnionMemberTypes(lexer); if (directives.length === 0 && types.length === 0) { throw unexpected(lexer); } return { kind: _kinds.Kind.UNION_TYPE_EXTENSION, name: name, directives: directives, types: types, loc: loc(lexer, start) }; } /** * EnumTypeExtension : * - extend enum Name Directives[Const]? EnumValuesDefinition * - extend enum Name Directives[Const] */ function parseEnumTypeExtension(lexer) { var start = lexer.token; expectKeyword(lexer, 'extend'); expectKeyword(lexer, 'enum'); var name = parseName(lexer); var directives = parseDirectives(lexer, true); var values = parseEnumValuesDefinition(lexer); if (directives.length === 0 && values.length === 0) { throw unexpected(lexer); } return { kind: _kinds.Kind.ENUM_TYPE_EXTENSION, name: name, directives: directives, values: values, loc: loc(lexer, start) }; } /** * InputObjectTypeExtension : * - extend input Name Directives[Const]? InputFieldsDefinition * - extend input Name Directives[Const] */ function parseInputObjectTypeExtension(lexer) { var start = lexer.token; expectKeyword(lexer, 'extend'); expectKeyword(lexer, 'input'); var name = parseName(lexer); var directives = parseDirectives(lexer, true); var fields = parseInputFieldsDefinition(lexer); if (directives.length === 0 && fields.length === 0) { throw unexpected(lexer); } return { kind: _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION, name: name, directives: directives, fields: fields, loc: loc(lexer, start) }; } /** * DirectiveDefinition : * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations */ function parseDirectiveDefinition(lexer) { var start = lexer.token; var description = parseDescription(lexer); expectKeyword(lexer, 'directive'); expectToken(lexer, _tokenKind.TokenKind.AT); var name = parseName(lexer); var args = parseArgumentDefs(lexer); var repeatable = expectOptionalKeyword(lexer, 'repeatable'); expectKeyword(lexer, 'on'); var locations = parseDirectiveLocations(lexer); return { kind: _kinds.Kind.DIRECTIVE_DEFINITION, description: description, name: name, arguments: args, repeatable: repeatable, locations: locations, loc: loc(lexer, start) }; } /** * DirectiveLocations : * - `|`? DirectiveLocation * - DirectiveLocations | DirectiveLocation */ function parseDirectiveLocations(lexer) { // Optional leading pipe expectOptionalToken(lexer, _tokenKind.TokenKind.PIPE); var locations = []; do { locations.push(parseDirectiveLocation(lexer)); } while (expectOptionalToken(lexer, _tokenKind.TokenKind.PIPE)); return locations; } /* * DirectiveLocation : * - ExecutableDirectiveLocation * - TypeSystemDirectiveLocation * * ExecutableDirectiveLocation : one of * `QUERY` * `MUTATION` * `SUBSCRIPTION` * `FIELD` * `FRAGMENT_DEFINITION` * `FRAGMENT_SPREAD` * `INLINE_FRAGMENT` * * TypeSystemDirectiveLocation : one of * `SCHEMA` * `SCALAR` * `OBJECT` * `FIELD_DEFINITION` * `ARGUMENT_DEFINITION` * `INTERFACE` * `UNION` * `ENUM` * `ENUM_VALUE` * `INPUT_OBJECT` * `INPUT_FIELD_DEFINITION` */ function parseDirectiveLocation(lexer) { var start = lexer.token; var name = parseName(lexer); if (_directiveLocation.DirectiveLocation[name.value] !== undefined) { return name; } throw unexpected(lexer, start); } // Core parsing utility functions /** * Returns a location object, used to identify the place in * the source that created a given parsed object. */ function loc(lexer, startToken) { if (!lexer.options.noLocation) { return new Loc(startToken, lexer.lastToken, lexer.source); } } function Loc(startToken, endToken, source) { this.start = startToken.start; this.end = endToken.end; this.startToken = startToken; this.endToken = endToken; this.source = source; } // Print a simplified form when appearing in JSON/util.inspect. (0, _defineToJSON.default)(Loc, function () { return { start: this.start, end: this.end }; }); /** * Determines if the next token is of a given kind */ function peek(lexer, kind) { return lexer.token.kind === kind; } /** * If the next token is of the given kind, return that token after advancing * the lexer. Otherwise, do not change the parser state and throw an error. */ function expectToken(lexer, kind) { var token = lexer.token; if (token.kind === kind) { lexer.advance(); return token; } throw (0, _syntaxError.syntaxError)(lexer.source, token.start, "Expected ".concat(kind, ", found ").concat((0, _lexer.getTokenDesc)(token))); } /** * If the next token is of the given kind, return that token after advancing * the lexer. Otherwise, do not change the parser state and return undefined. */ function expectOptionalToken(lexer, kind) { var token = lexer.token; if (token.kind === kind) { lexer.advance(); return token; } return undefined; } /** * If the next token is a given keyword, advance the lexer. * Otherwise, do not change the parser state and throw an error. */ function expectKeyword(lexer, value) { var token = lexer.token; if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) { lexer.advance(); } else { throw (0, _syntaxError.syntaxError)(lexer.source, token.start, "Expected \"".concat(value, "\", found ").concat((0, _lexer.getTokenDesc)(token))); } } /** * If the next token is a given keyword, return "true" after advancing * the lexer. Otherwise, do not change the parser state and return "false". */ function expectOptionalKeyword(lexer, value) { var token = lexer.token; if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) { lexer.advance(); return true; } return false; } /** * Helper function for creating an error when an unexpected lexed token * is encountered. */ function unexpected(lexer, atToken) { var token = atToken || lexer.token; return (0, _syntaxError.syntaxError)(lexer.source, token.start, "Unexpected ".concat((0, _lexer.getTokenDesc)(token))); } /** * Returns a possibly empty list of parse nodes, determined by * the parseFn. This list begins with a lex token of openKind * and ends with a lex token of closeKind. Advances the parser * to the next lex token after the closing token. */ function any(lexer, openKind, parseFn, closeKind) { expectToken(lexer, openKind); var nodes = []; while (!expectOptionalToken(lexer, closeKind)) { nodes.push(parseFn(lexer)); } return nodes; } /** * Returns a non-empty list of parse nodes, determined by * the parseFn. This list begins with a lex token of openKind * and ends with a lex token of closeKind. Advances the parser * to the next lex token after the closing token. */ function many(lexer, openKind, parseFn, closeKind) { expectToken(lexer, openKind); var nodes = [parseFn(lexer)]; while (!expectOptionalToken(lexer, closeKind)) { nodes.push(parseFn(lexer)); } return nodes; } /***/ }), /***/ "./node_modules/graphql/language/printLocation.js": /*!********************************************************!*\ !*** ./node_modules/graphql/language/printLocation.js ***! \********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.printLocation = printLocation; exports.printSourceLocation = printSourceLocation; var _location = __webpack_require__(/*! ../language/location */ "./node_modules/graphql/language/location.js"); /** * Render a helpful description of the location in the GraphQL Source document. */ function printLocation(location) { return printSourceLocation(location.source, (0, _location.getLocation)(location.source, location.start)); } /** * Render a helpful description of the location in the GraphQL Source document. */ function printSourceLocation(source, sourceLocation) { var firstLineColumnOffset = source.locationOffset.column - 1; var body = whitespace(firstLineColumnOffset) + source.body; var lineIndex = sourceLocation.line - 1; var lineOffset = source.locationOffset.line - 1; var lineNum = sourceLocation.line + lineOffset; var columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0; var columnNum = sourceLocation.column + columnOffset; var locationStr = "".concat(source.name, ":").concat(lineNum, ":").concat(columnNum, "\n"); var lines = body.split(/\r\n|[\n\r]/g); var locationLine = lines[lineIndex]; // Special case for minified documents if (locationLine.length > 120) { var sublineIndex = Math.floor(columnNum / 80); var sublineColumnNum = columnNum % 80; var sublines = []; for (var i = 0; i < locationLine.length; i += 80) { sublines.push(locationLine.slice(i, i + 80)); } return locationStr + printPrefixedLines([["".concat(lineNum), sublines[0]]].concat(sublines.slice(1, sublineIndex + 1).map(function (subline) { return ['', subline]; }), [[' ', whitespace(sublineColumnNum - 1) + '^'], ['', sublines[sublineIndex + 1]]])); } return locationStr + printPrefixedLines([// Lines specified like this: ["prefix", "string"], ["".concat(lineNum - 1), lines[lineIndex - 1]], ["".concat(lineNum), locationLine], ['', whitespace(columnNum - 1) + '^'], ["".concat(lineNum + 1), lines[lineIndex + 1]]]); } function printPrefixedLines(lines) { var existingLines = lines.filter(function (_ref) { var _ = _ref[0], line = _ref[1]; return line !== undefined; }); var padLen = Math.max.apply(Math, existingLines.map(function (_ref2) { var prefix = _ref2[0]; return prefix.length; })); return existingLines.map(function (_ref3) { var prefix = _ref3[0], line = _ref3[1]; return lpad(padLen, prefix) + ' | ' + line; }).join('\n'); } function whitespace(len) { return Array(len + 1).join(' '); } function lpad(len, str) { return whitespace(len - str.length) + str; } /***/ }), /***/ "./node_modules/graphql/language/printer.js": /*!**************************************************!*\ !*** ./node_modules/graphql/language/printer.js ***! \**************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.print = print; var _visitor = __webpack_require__(/*! ./visitor */ "./node_modules/graphql/language/visitor.js"); var _blockString = __webpack_require__(/*! ./blockString */ "./node_modules/graphql/language/blockString.js"); /** * Converts an AST into a string, using one set of reasonable * formatting rules. */ function print(ast) { return (0, _visitor.visit)(ast, { leave: printDocASTReducer }); } // TODO: provide better type coverage in future var printDocASTReducer = { Name: function Name(node) { return node.value; }, Variable: function Variable(node) { return '$' + node.name; }, // Document Document: function Document(node) { return join(node.definitions, '\n\n') + '\n'; }, OperationDefinition: function OperationDefinition(node) { var op = node.operation; var name = node.name; var varDefs = wrap('(', join(node.variableDefinitions, ', '), ')'); var directives = join(node.directives, ' '); var selectionSet = node.selectionSet; // Anonymous queries with no directives or variable definitions can use // the query short form. return !name && !directives && !varDefs && op === 'query' ? selectionSet : join([op, join([name, varDefs]), directives, selectionSet], ' '); }, VariableDefinition: function VariableDefinition(_ref) { var variable = _ref.variable, type = _ref.type, defaultValue = _ref.defaultValue, directives = _ref.directives; return variable + ': ' + type + wrap(' = ', defaultValue) + wrap(' ', join(directives, ' ')); }, SelectionSet: function SelectionSet(_ref2) { var selections = _ref2.selections; return block(selections); }, Field: function Field(_ref3) { var alias = _ref3.alias, name = _ref3.name, args = _ref3.arguments, directives = _ref3.directives, selectionSet = _ref3.selectionSet; return join([wrap('', alias, ': ') + name + wrap('(', join(args, ', '), ')'), join(directives, ' '), selectionSet], ' '); }, Argument: function Argument(_ref4) { var name = _ref4.name, value = _ref4.value; return name + ': ' + value; }, // Fragments FragmentSpread: function FragmentSpread(_ref5) { var name = _ref5.name, directives = _ref5.directives; return '...' + name + wrap(' ', join(directives, ' ')); }, InlineFragment: function InlineFragment(_ref6) { var typeCondition = _ref6.typeCondition, directives = _ref6.directives, selectionSet = _ref6.selectionSet; return join(['...', wrap('on ', typeCondition), join(directives, ' '), selectionSet], ' '); }, FragmentDefinition: function FragmentDefinition(_ref7) { var name = _ref7.name, typeCondition = _ref7.typeCondition, variableDefinitions = _ref7.variableDefinitions, directives = _ref7.directives, selectionSet = _ref7.selectionSet; return (// Note: fragment variable definitions are experimental and may be changed // or removed in the future. "fragment ".concat(name).concat(wrap('(', join(variableDefinitions, ', '), ')'), " ") + "on ".concat(typeCondition, " ").concat(wrap('', join(directives, ' '), ' ')) + selectionSet ); }, // Value IntValue: function IntValue(_ref8) { var value = _ref8.value; return value; }, FloatValue: function FloatValue(_ref9) { var value = _ref9.value; return value; }, StringValue: function StringValue(_ref10, key) { var value = _ref10.value, isBlockString = _ref10.block; return isBlockString ? (0, _blockString.printBlockString)(value, key === 'description' ? '' : ' ') : JSON.stringify(value); }, BooleanValue: function BooleanValue(_ref11) { var value = _ref11.value; return value ? 'true' : 'false'; }, NullValue: function NullValue() { return 'null'; }, EnumValue: function EnumValue(_ref12) { var value = _ref12.value; return value; }, ListValue: function ListValue(_ref13) { var values = _ref13.values; return '[' + join(values, ', ') + ']'; }, ObjectValue: function ObjectValue(_ref14) { var fields = _ref14.fields; return '{' + join(fields, ', ') + '}'; }, ObjectField: function ObjectField(_ref15) { var name = _ref15.name, value = _ref15.value; return name + ': ' + value; }, // Directive Directive: function Directive(_ref16) { var name = _ref16.name, args = _ref16.arguments; return '@' + name + wrap('(', join(args, ', '), ')'); }, // Type NamedType: function NamedType(_ref17) { var name = _ref17.name; return name; }, ListType: function ListType(_ref18) { var type = _ref18.type; return '[' + type + ']'; }, NonNullType: function NonNullType(_ref19) { var type = _ref19.type; return type + '!'; }, // Type System Definitions SchemaDefinition: function SchemaDefinition(_ref20) { var directives = _ref20.directives, operationTypes = _ref20.operationTypes; return join(['schema', join(directives, ' '), block(operationTypes)], ' '); }, OperationTypeDefinition: function OperationTypeDefinition(_ref21) { var operation = _ref21.operation, type = _ref21.type; return operation + ': ' + type; }, ScalarTypeDefinition: addDescription(function (_ref22) { var name = _ref22.name, directives = _ref22.directives; return join(['scalar', name, join(directives, ' ')], ' '); }), ObjectTypeDefinition: addDescription(function (_ref23) { var name = _ref23.name, interfaces = _ref23.interfaces, directives = _ref23.directives, fields = _ref23.fields; return join(['type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); }), FieldDefinition: addDescription(function (_ref24) { var name = _ref24.name, args = _ref24.arguments, type = _ref24.type, directives = _ref24.directives; return name + (hasMultilineItems(args) ? wrap('(\n', indent(join(args, '\n')), '\n)') : wrap('(', join(args, ', '), ')')) + ': ' + type + wrap(' ', join(directives, ' ')); }), InputValueDefinition: addDescription(function (_ref25) { var name = _ref25.name, type = _ref25.type, defaultValue = _ref25.defaultValue, directives = _ref25.directives; return join([name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], ' '); }), InterfaceTypeDefinition: addDescription(function (_ref26) { var name = _ref26.name, directives = _ref26.directives, fields = _ref26.fields; return join(['interface', name, join(directives, ' '), block(fields)], ' '); }), UnionTypeDefinition: addDescription(function (_ref27) { var name = _ref27.name, directives = _ref27.directives, types = _ref27.types; return join(['union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' '); }), EnumTypeDefinition: addDescription(function (_ref28) { var name = _ref28.name, directives = _ref28.directives, values = _ref28.values; return join(['enum', name, join(directives, ' '), block(values)], ' '); }), EnumValueDefinition: addDescription(function (_ref29) { var name = _ref29.name, directives = _ref29.directives; return join([name, join(directives, ' ')], ' '); }), InputObjectTypeDefinition: addDescription(function (_ref30) { var name = _ref30.name, directives = _ref30.directives, fields = _ref30.fields; return join(['input', name, join(directives, ' '), block(fields)], ' '); }), DirectiveDefinition: addDescription(function (_ref31) { var name = _ref31.name, args = _ref31.arguments, repeatable = _ref31.repeatable, locations = _ref31.locations; return 'directive @' + name + (hasMultilineItems(args) ? wrap('(\n', indent(join(args, '\n')), '\n)') : wrap('(', join(args, ', '), ')')) + (repeatable ? ' repeatable' : '') + ' on ' + join(locations, ' | '); }), SchemaExtension: function SchemaExtension(_ref32) { var directives = _ref32.directives, operationTypes = _ref32.operationTypes; return join(['extend schema', join(directives, ' '), block(operationTypes)], ' '); }, ScalarTypeExtension: function ScalarTypeExtension(_ref33) { var name = _ref33.name, directives = _ref33.directives; return join(['extend scalar', name, join(directives, ' ')], ' '); }, ObjectTypeExtension: function ObjectTypeExtension(_ref34) { var name = _ref34.name, interfaces = _ref34.interfaces, directives = _ref34.directives, fields = _ref34.fields; return join(['extend type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); }, InterfaceTypeExtension: function InterfaceTypeExtension(_ref35) { var name = _ref35.name, directives = _ref35.directives, fields = _ref35.fields; return join(['extend interface', name, join(directives, ' '), block(fields)], ' '); }, UnionTypeExtension: function UnionTypeExtension(_ref36) { var name = _ref36.name, directives = _ref36.directives, types = _ref36.types; return join(['extend union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' '); }, EnumTypeExtension: function EnumTypeExtension(_ref37) { var name = _ref37.name, directives = _ref37.directives, values = _ref37.values; return join(['extend enum', name, join(directives, ' '), block(values)], ' '); }, InputObjectTypeExtension: function InputObjectTypeExtension(_ref38) { var name = _ref38.name, directives = _ref38.directives, fields = _ref38.fields; return join(['extend input', name, join(directives, ' '), block(fields)], ' '); } }; function addDescription(cb) { return function (node) { return join([node.description, cb(node)], '\n'); }; } /** * Given maybeArray, print an empty string if it is null or empty, otherwise * print all items together separated by separator if provided */ function join(maybeArray, separator) { return maybeArray ? maybeArray.filter(function (x) { return x; }).join(separator || '') : ''; } /** * Given array, print each item on its own line, wrapped in an * indented "{ }" block. */ function block(array) { return array && array.length !== 0 ? '{\n' + indent(join(array, '\n')) + '\n}' : ''; } /** * If maybeString is not null or empty, then wrap with start and end, otherwise * print an empty string. */ function wrap(start, maybeString, end) { return maybeString ? start + maybeString + (end || '') : ''; } function indent(maybeString) { return maybeString && ' ' + maybeString.replace(/\n/g, '\n '); } function isMultiline(string) { return string.indexOf('\n') !== -1; } function hasMultilineItems(maybeArray) { return maybeArray && maybeArray.some(isMultiline); } /***/ }), /***/ "./node_modules/graphql/language/source.js": /*!*************************************************!*\ !*** ./node_modules/graphql/language/source.js ***! \*************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Source = void 0; var _invariant = _interopRequireDefault(__webpack_require__(/*! ../jsutils/invariant */ "./node_modules/graphql/jsutils/invariant.js")); var _defineToStringTag = _interopRequireDefault(__webpack_require__(/*! ../jsutils/defineToStringTag */ "./node_modules/graphql/jsutils/defineToStringTag.js")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * A representation of source input to GraphQL. * `name` and `locationOffset` are optional. They are useful for clients who * store GraphQL documents in source files; for example, if the GraphQL input * starts at line 40 in a file named Foo.graphql, it might be useful for name to * be "Foo.graphql" and location to be `{ line: 40, column: 0 }`. * line and column in locationOffset are 1-indexed */ var Source = function Source(body, name, locationOffset) { this.body = body; this.name = name || 'GraphQL request'; this.locationOffset = locationOffset || { line: 1, column: 1 }; !(this.locationOffset.line > 0) ? (0, _invariant.default)(0, 'line in locationOffset is 1-indexed and must be positive') : void 0; !(this.locationOffset.column > 0) ? (0, _invariant.default)(0, 'column in locationOffset is 1-indexed and must be positive') : void 0; }; // Conditionally apply `[Symbol.toStringTag]` if `Symbol`s are supported exports.Source = Source; (0, _defineToStringTag.default)(Source); /***/ }), /***/ "./node_modules/graphql/language/tokenKind.js": /*!****************************************************!*\ !*** ./node_modules/graphql/language/tokenKind.js ***! \****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TokenKind = void 0; /** * An exported enum describing the different kinds of tokens that the * lexer emits. */ var TokenKind = Object.freeze({ SOF: '', EOF: '', BANG: '!', DOLLAR: '$', AMP: '&', PAREN_L: '(', PAREN_R: ')', SPREAD: '...', COLON: ':', EQUALS: '=', AT: '@', BRACKET_L: '[', BRACKET_R: ']', BRACE_L: '{', PIPE: '|', BRACE_R: '}', NAME: 'Name', INT: 'Int', FLOAT: 'Float', STRING: 'String', BLOCK_STRING: 'BlockString', COMMENT: 'Comment' }); /** * The enum type representing the token kinds values. */ exports.TokenKind = TokenKind; /***/ }), /***/ "./node_modules/graphql/language/visitor.js": /*!**************************************************!*\ !*** ./node_modules/graphql/language/visitor.js ***! \**************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.visit = visit; exports.visitInParallel = visitInParallel; exports.visitWithTypeInfo = visitWithTypeInfo; exports.getVisitFn = getVisitFn; exports.BREAK = exports.QueryDocumentKeys = void 0; var _inspect = _interopRequireDefault(__webpack_require__(/*! ../jsutils/inspect */ "./node_modules/graphql/jsutils/inspect.js")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var QueryDocumentKeys = { Name: [], Document: ['definitions'], OperationDefinition: ['name', 'variableDefinitions', 'directives', 'selectionSet'], VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'], Variable: ['name'], SelectionSet: ['selections'], Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'], Argument: ['name', 'value'], FragmentSpread: ['name', 'directives'], InlineFragment: ['typeCondition', 'directives', 'selectionSet'], FragmentDefinition: ['name', // Note: fragment variable definitions are experimental and may be changed // or removed in the future. 'variableDefinitions', 'typeCondition', 'directives', 'selectionSet'], IntValue: [], FloatValue: [], StringValue: [], BooleanValue: [], NullValue: [], EnumValue: [], ListValue: ['values'], ObjectValue: ['fields'], ObjectField: ['name', 'value'], Directive: ['name', 'arguments'], NamedType: ['name'], ListType: ['type'], NonNullType: ['type'], SchemaDefinition: ['directives', 'operationTypes'], OperationTypeDefinition: ['type'], ScalarTypeDefinition: ['description', 'name', 'directives'], ObjectTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'], FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'], InputValueDefinition: ['description', 'name', 'type', 'defaultValue', 'directives'], InterfaceTypeDefinition: ['description', 'name', 'directives', 'fields'], UnionTypeDefinition: ['description', 'name', 'directives', 'types'], EnumTypeDefinition: ['description', 'name', 'directives', 'values'], EnumValueDefinition: ['description', 'name', 'directives'], InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'], DirectiveDefinition: ['description', 'name', 'arguments', 'locations'], SchemaExtension: ['directives', 'operationTypes'], ScalarTypeExtension: ['name', 'directives'], ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'], InterfaceTypeExtension: ['name', 'directives', 'fields'], UnionTypeExtension: ['name', 'directives', 'types'], EnumTypeExtension: ['name', 'directives', 'values'], InputObjectTypeExtension: ['name', 'directives', 'fields'] }; exports.QueryDocumentKeys = QueryDocumentKeys; var BREAK = Object.freeze({}); /** * visit() will walk through an AST using a depth first traversal, calling * the visitor's enter function at each node in the traversal, and calling the * leave function after visiting that node and all of its child nodes. * * By returning different values from the enter and leave functions, the * behavior of the visitor can be altered, including skipping over a sub-tree of * the AST (by returning false), editing the AST by returning a value or null * to remove the value, or to stop the whole traversal by returning BREAK. * * When using visit() to edit an AST, the original AST will not be modified, and * a new version of the AST with the changes applied will be returned from the * visit function. * * const editedAST = visit(ast, { * enter(node, key, parent, path, ancestors) { * // @return * // undefined: no action * // false: skip visiting this node * // visitor.BREAK: stop visiting altogether * // null: delete this node * // any value: replace this node with the returned value * }, * leave(node, key, parent, path, ancestors) { * // @return * // undefined: no action * // false: no action * // visitor.BREAK: stop visiting altogether * // null: delete this node * // any value: replace this node with the returned value * } * }); * * Alternatively to providing enter() and leave() functions, a visitor can * instead provide functions named the same as the kinds of AST nodes, or * enter/leave visitors at a named key, leading to four permutations of * visitor API: * * 1) Named visitors triggered when entering a node a specific kind. * * visit(ast, { * Kind(node) { * // enter the "Kind" node * } * }) * * 2) Named visitors that trigger upon entering and leaving a node of * a specific kind. * * visit(ast, { * Kind: { * enter(node) { * // enter the "Kind" node * } * leave(node) { * // leave the "Kind" node * } * } * }) * * 3) Generic visitors that trigger upon entering and leaving any node. * * visit(ast, { * enter(node) { * // enter any node * }, * leave(node) { * // leave any node * } * }) * * 4) Parallel visitors for entering and leaving nodes of a specific kind. * * visit(ast, { * enter: { * Kind(node) { * // enter the "Kind" node * } * }, * leave: { * Kind(node) { * // leave the "Kind" node * } * } * }) */ exports.BREAK = BREAK; function visit(root, visitor) { var visitorKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : QueryDocumentKeys; /* eslint-disable no-undef-init */ var stack = undefined; var inArray = Array.isArray(root); var keys = [root]; var index = -1; var edits = []; var node = undefined; var key = undefined; var parent = undefined; var path = []; var ancestors = []; var newRoot = root; /* eslint-enable no-undef-init */ do { index++; var isLeaving = index === keys.length; var isEdited = isLeaving && edits.length !== 0; if (isLeaving) { key = ancestors.length === 0 ? undefined : path[path.length - 1]; node = parent; parent = ancestors.pop(); if (isEdited) { if (inArray) { node = node.slice(); } else { var clone = {}; for (var _i = 0, _Object$keys = Object.keys(node); _i < _Object$keys.length; _i++) { var k = _Object$keys[_i]; clone[k] = node[k]; } node = clone; } var editOffset = 0; for (var ii = 0; ii < edits.length; ii++) { var editKey = edits[ii][0]; var editValue = edits[ii][1]; if (inArray) { editKey -= editOffset; } if (inArray && editValue === null) { node.splice(editKey, 1); editOffset++; } else { node[editKey] = editValue; } } } index = stack.index; keys = stack.keys; edits = stack.edits; inArray = stack.inArray; stack = stack.prev; } else { key = parent ? inArray ? index : keys[index] : undefined; node = parent ? parent[key] : newRoot; if (node === null || node === undefined) { continue; } if (parent) { path.push(key); } } var result = void 0; if (!Array.isArray(node)) { if (!isNode(node)) { throw new Error('Invalid AST Node: ' + (0, _inspect.default)(node)); } var visitFn = getVisitFn(visitor, node.kind, isLeaving); if (visitFn) { result = visitFn.call(visitor, node, key, parent, path, ancestors); if (result === BREAK) { break; } if (result === false) { if (!isLeaving) { path.pop(); continue; } } else if (result !== undefined) { edits.push([key, result]); if (!isLeaving) { if (isNode(result)) { node = result; } else { path.pop(); continue; } } } } } if (result === undefined && isEdited) { edits.push([key, node]); } if (isLeaving) { path.pop(); } else { stack = { inArray: inArray, index: index, keys: keys, edits: edits, prev: stack }; inArray = Array.isArray(node); keys = inArray ? node : visitorKeys[node.kind] || []; index = -1; edits = []; if (parent) { ancestors.push(parent); } parent = node; } } while (stack !== undefined); if (edits.length !== 0) { newRoot = edits[edits.length - 1][1]; } return newRoot; } function isNode(maybeNode) { return Boolean(maybeNode && typeof maybeNode.kind === 'string'); } /** * Creates a new visitor instance which delegates to many visitors to run in * parallel. Each visitor will be visited for each node before moving on. * * If a prior visitor edits a node, no following visitors will see that node. */ function visitInParallel(visitors) { var skipping = new Array(visitors.length); return { enter: function enter(node) { for (var i = 0; i < visitors.length; i++) { if (!skipping[i]) { var fn = getVisitFn(visitors[i], node.kind, /* isLeaving */ false); if (fn) { var result = fn.apply(visitors[i], arguments); if (result === false) { skipping[i] = node; } else if (result === BREAK) { skipping[i] = BREAK; } else if (result !== undefined) { return result; } } } } }, leave: function leave(node) { for (var i = 0; i < visitors.length; i++) { if (!skipping[i]) { var fn = getVisitFn(visitors[i], node.kind, /* isLeaving */ true); if (fn) { var result = fn.apply(visitors[i], arguments); if (result === BREAK) { skipping[i] = BREAK; } else if (result !== undefined && result !== false) { return result; } } } else if (skipping[i] === node) { skipping[i] = null; } } } }; } /** * Creates a new visitor instance which maintains a provided TypeInfo instance * along with visiting visitor. */ function visitWithTypeInfo(typeInfo, visitor) { return { enter: function enter(node) { typeInfo.enter(node); var fn = getVisitFn(visitor, node.kind, /* isLeaving */ false); if (fn) { var result = fn.apply(visitor, arguments); if (result !== undefined) { typeInfo.leave(node); if (isNode(result)) { typeInfo.enter(result); } } return result; } }, leave: function leave(node) { var fn = getVisitFn(visitor, node.kind, /* isLeaving */ true); var result; if (fn) { result = fn.apply(visitor, arguments); } typeInfo.leave(node); return result; } }; } /** * Given a visitor instance, if it is leaving or not, and a node kind, return * the function the visitor runtime should call. */ function getVisitFn(visitor, kind, isLeaving) { var kindVisitor = visitor[kind]; if (kindVisitor) { if (!isLeaving && typeof kindVisitor === 'function') { // { Kind() {} } return kindVisitor; } var kindSpecificVisitor = isLeaving ? kindVisitor.leave : kindVisitor.enter; if (typeof kindSpecificVisitor === 'function') { // { Kind: { enter() {}, leave() {} } } return kindSpecificVisitor; } } else { var specificVisitor = isLeaving ? visitor.leave : visitor.enter; if (specificVisitor) { if (typeof specificVisitor === 'function') { // { enter() {}, leave() {} } return specificVisitor; } var specificKindVisitor = specificVisitor[kind]; if (typeof specificKindVisitor === 'function') { // { enter: { Kind() {} }, leave: { Kind() {} } } return specificKindVisitor; } } } } /***/ }), /***/ "./node_modules/history/esm/history.js": /*!*********************************************!*\ !*** ./node_modules/history/esm/history.js ***! \*********************************************/ /*! exports provided: createBrowserHistory, createHashHistory, createMemoryHistory, createLocation, locationsAreEqual, parsePath, createPath */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createBrowserHistory", function() { return createBrowserHistory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createHashHistory", function() { return createHashHistory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMemoryHistory", function() { return createMemoryHistory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLocation", function() { return createLocation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "locationsAreEqual", function() { return locationsAreEqual; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parsePath", function() { return parsePath; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPath", function() { return createPath; }); /* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js"); /* harmony import */ var resolve_pathname__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! resolve-pathname */ "./node_modules/resolve-pathname/index.js"); /* harmony import */ var value_equal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! value-equal */ "./node_modules/value-equal/index.js"); /* harmony import */ var tiny_warning__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tiny-warning */ "./node_modules/tiny-warning/dist/tiny-warning.esm.js"); /* harmony import */ var tiny_invariant__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! tiny-invariant */ "./node_modules/tiny-invariant/dist/tiny-invariant.esm.js"); function addLeadingSlash(path) { return path.charAt(0) === '/' ? path : '/' + path; } function stripLeadingSlash(path) { return path.charAt(0) === '/' ? path.substr(1) : path; } function hasBasename(path, prefix) { return new RegExp('^' + prefix + '(\\/|\\?|#|$)', 'i').test(path); } function stripBasename(path, prefix) { return hasBasename(path, prefix) ? path.substr(prefix.length) : path; } function stripTrailingSlash(path) { return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path; } function parsePath(path) { var pathname = path || '/'; var search = ''; var hash = ''; var hashIndex = pathname.indexOf('#'); if (hashIndex !== -1) { hash = pathname.substr(hashIndex); pathname = pathname.substr(0, hashIndex); } var searchIndex = pathname.indexOf('?'); if (searchIndex !== -1) { search = pathname.substr(searchIndex); pathname = pathname.substr(0, searchIndex); } return { pathname: pathname, search: search === '?' ? '' : search, hash: hash === '#' ? '' : hash }; } function createPath(location) { var pathname = location.pathname, search = location.search, hash = location.hash; var path = pathname || '/'; if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search; if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash; return path; } function createLocation(path, state, key, currentLocation) { var location; if (typeof path === 'string') { // Two-arg form: push(path, state) location = parsePath(path); location.state = state; } else { // One-arg form: push(location) location = Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, path); if (location.pathname === undefined) location.pathname = ''; if (location.search) { if (location.search.charAt(0) !== '?') location.search = '?' + location.search; } else { location.search = ''; } if (location.hash) { if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash; } else { location.hash = ''; } if (state !== undefined && location.state === undefined) location.state = state; } try { location.pathname = decodeURI(location.pathname); } catch (e) { if (e instanceof URIError) { throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.'); } else { throw e; } } if (key) location.key = key; if (currentLocation) { // Resolve incomplete/relative pathname relative to current location. if (!location.pathname) { location.pathname = currentLocation.pathname; } else if (location.pathname.charAt(0) !== '/') { location.pathname = Object(resolve_pathname__WEBPACK_IMPORTED_MODULE_1__["default"])(location.pathname, currentLocation.pathname); } } else { // When there is no prior location and pathname is empty, set it to / if (!location.pathname) { location.pathname = '/'; } } return location; } function locationsAreEqual(a, b) { return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && Object(value_equal__WEBPACK_IMPORTED_MODULE_2__["default"])(a.state, b.state); } function createTransitionManager() { var prompt = null; function setPrompt(nextPrompt) { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(prompt == null, 'A history supports only one prompt at a time') : undefined; prompt = nextPrompt; return function () { if (prompt === nextPrompt) prompt = null; }; } function confirmTransitionTo(location, action, getUserConfirmation, callback) { // TODO: If another transition starts while we're still confirming // the previous one, we may end up in a weird state. Figure out the // best way to handle this. if (prompt != null) { var result = typeof prompt === 'function' ? prompt(location, action) : prompt; if (typeof result === 'string') { if (typeof getUserConfirmation === 'function') { getUserConfirmation(result, callback); } else { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(false, 'A history needs a getUserConfirmation function in order to use a prompt message') : undefined; callback(true); } } else { // Return false from a transition hook to cancel the transition. callback(result !== false); } } else { callback(true); } } var listeners = []; function appendListener(fn) { var isActive = true; function listener() { if (isActive) fn.apply(void 0, arguments); } listeners.push(listener); return function () { isActive = false; listeners = listeners.filter(function (item) { return item !== listener; }); }; } function notifyListeners() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } listeners.forEach(function (listener) { return listener.apply(void 0, args); }); } return { setPrompt: setPrompt, confirmTransitionTo: confirmTransitionTo, appendListener: appendListener, notifyListeners: notifyListeners }; } var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); function getConfirmation(message, callback) { callback(window.confirm(message)); // eslint-disable-line no-alert } /** * Returns true if the HTML5 history API is supported. Taken from Modernizr. * * https://github.com/Modernizr/Modernizr/blob/master/LICENSE * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js * changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586 */ function supportsHistory() { var ua = window.navigator.userAgent; if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false; return window.history && 'pushState' in window.history; } /** * Returns true if browser fires popstate on hash change. * IE10 and IE11 do not. */ function supportsPopStateOnHashChange() { return window.navigator.userAgent.indexOf('Trident') === -1; } /** * Returns false if using go(n) with hash history causes a full page reload. */ function supportsGoWithoutReloadUsingHash() { return window.navigator.userAgent.indexOf('Firefox') === -1; } /** * Returns true if a given popstate event is an extraneous WebKit event. * Accounts for the fact that Chrome on iOS fires real popstate events * containing undefined state when pressing the back button. */ function isExtraneousPopstateEvent(event) { event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1; } var PopStateEvent = 'popstate'; var HashChangeEvent = 'hashchange'; function getHistoryState() { try { return window.history.state || {}; } catch (e) { // IE 11 sometimes throws when accessing window.history.state // See https://github.com/ReactTraining/history/pull/289 return {}; } } /** * Creates a history object that uses the HTML5 history API including * pushState, replaceState, and the popstate event. */ function createBrowserHistory(props) { if (props === void 0) { props = {}; } !canUseDOM ? true ? Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_4__["default"])(false, 'Browser history needs a DOM') : undefined : void 0; var globalHistory = window.history; var canUseHistory = supportsHistory(); var needsHashChangeListener = !supportsPopStateOnHashChange(); var _props = props, _props$forceRefresh = _props.forceRefresh, forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh, _props$getUserConfirm = _props.getUserConfirmation, getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm, _props$keyLength = _props.keyLength, keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength; var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : ''; function getDOMLocation(historyState) { var _ref = historyState || {}, key = _ref.key, state = _ref.state; var _window$location = window.location, pathname = _window$location.pathname, search = _window$location.search, hash = _window$location.hash; var path = pathname + search + hash; true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".') : undefined; if (basename) path = stripBasename(path, basename); return createLocation(path, state, key); } function createKey() { return Math.random().toString(36).substr(2, keyLength); } var transitionManager = createTransitionManager(); function setState(nextState) { Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])(history, nextState); history.length = globalHistory.length; transitionManager.notifyListeners(history.location, history.action); } function handlePopState(event) { // Ignore extraneous popstate events in WebKit. if (isExtraneousPopstateEvent(event)) return; handlePop(getDOMLocation(event.state)); } function handleHashChange() { handlePop(getDOMLocation(getHistoryState())); } var forceNextPop = false; function handlePop(location) { if (forceNextPop) { forceNextPop = false; setState(); } else { var action = 'POP'; transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (ok) { setState({ action: action, location: location }); } else { revertPop(location); } }); } } function revertPop(fromLocation) { var toLocation = history.location; // TODO: We could probably make this more reliable by // keeping a list of keys we've seen in sessionStorage. // Instead, we just default to 0 for keys we don't know. var toIndex = allKeys.indexOf(toLocation.key); if (toIndex === -1) toIndex = 0; var fromIndex = allKeys.indexOf(fromLocation.key); if (fromIndex === -1) fromIndex = 0; var delta = toIndex - fromIndex; if (delta) { forceNextPop = true; go(delta); } } var initialLocation = getDOMLocation(getHistoryState()); var allKeys = [initialLocation.key]; // Public interface function createHref(location) { return basename + createPath(location); } function push(path, state) { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : undefined; var action = 'PUSH'; var location = createLocation(path, state, createKey(), history.location); transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (!ok) return; var href = createHref(location); var key = location.key, state = location.state; if (canUseHistory) { globalHistory.pushState({ key: key, state: state }, null, href); if (forceRefresh) { window.location.href = href; } else { var prevIndex = allKeys.indexOf(history.location.key); var nextKeys = allKeys.slice(0, prevIndex === -1 ? 0 : prevIndex + 1); nextKeys.push(location.key); allKeys = nextKeys; setState({ action: action, location: location }); } } else { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history') : undefined; window.location.href = href; } }); } function replace(path, state) { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : undefined; var action = 'REPLACE'; var location = createLocation(path, state, createKey(), history.location); transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (!ok) return; var href = createHref(location); var key = location.key, state = location.state; if (canUseHistory) { globalHistory.replaceState({ key: key, state: state }, null, href); if (forceRefresh) { window.location.replace(href); } else { var prevIndex = allKeys.indexOf(history.location.key); if (prevIndex !== -1) allKeys[prevIndex] = location.key; setState({ action: action, location: location }); } } else { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history') : undefined; window.location.replace(href); } }); } function go(n) { globalHistory.go(n); } function goBack() { go(-1); } function goForward() { go(1); } var listenerCount = 0; function checkDOMListeners(delta) { listenerCount += delta; if (listenerCount === 1 && delta === 1) { window.addEventListener(PopStateEvent, handlePopState); if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange); } else if (listenerCount === 0) { window.removeEventListener(PopStateEvent, handlePopState); if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange); } } var isBlocked = false; function block(prompt) { if (prompt === void 0) { prompt = false; } var unblock = transitionManager.setPrompt(prompt); if (!isBlocked) { checkDOMListeners(1); isBlocked = true; } return function () { if (isBlocked) { isBlocked = false; checkDOMListeners(-1); } return unblock(); }; } function listen(listener) { var unlisten = transitionManager.appendListener(listener); checkDOMListeners(1); return function () { checkDOMListeners(-1); unlisten(); }; } var history = { length: globalHistory.length, action: 'POP', location: initialLocation, createHref: createHref, push: push, replace: replace, go: go, goBack: goBack, goForward: goForward, block: block, listen: listen }; return history; } var HashChangeEvent$1 = 'hashchange'; var HashPathCoders = { hashbang: { encodePath: function encodePath(path) { return path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path); }, decodePath: function decodePath(path) { return path.charAt(0) === '!' ? path.substr(1) : path; } }, noslash: { encodePath: stripLeadingSlash, decodePath: addLeadingSlash }, slash: { encodePath: addLeadingSlash, decodePath: addLeadingSlash } }; function getHashPath() { // We can't use window.location.hash here because it's not // consistent across browsers - Firefox will pre-decode it! var href = window.location.href; var hashIndex = href.indexOf('#'); return hashIndex === -1 ? '' : href.substring(hashIndex + 1); } function pushHashPath(path) { window.location.hash = path; } function replaceHashPath(path) { var hashIndex = window.location.href.indexOf('#'); window.location.replace(window.location.href.slice(0, hashIndex >= 0 ? hashIndex : 0) + '#' + path); } function createHashHistory(props) { if (props === void 0) { props = {}; } !canUseDOM ? true ? Object(tiny_invariant__WEBPACK_IMPORTED_MODULE_4__["default"])(false, 'Hash history needs a DOM') : undefined : void 0; var globalHistory = window.history; var canGoWithoutReload = supportsGoWithoutReloadUsingHash(); var _props = props, _props$getUserConfirm = _props.getUserConfirmation, getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm, _props$hashType = _props.hashType, hashType = _props$hashType === void 0 ? 'slash' : _props$hashType; var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : ''; var _HashPathCoders$hashT = HashPathCoders[hashType], encodePath = _HashPathCoders$hashT.encodePath, decodePath = _HashPathCoders$hashT.decodePath; function getDOMLocation() { var path = decodePath(getHashPath()); true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".') : undefined; if (basename) path = stripBasename(path, basename); return createLocation(path); } var transitionManager = createTransitionManager(); function setState(nextState) { Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])(history, nextState); history.length = globalHistory.length; transitionManager.notifyListeners(history.location, history.action); } var forceNextPop = false; var ignorePath = null; function handleHashChange() { var path = getHashPath(); var encodedPath = encodePath(path); if (path !== encodedPath) { // Ensure we always have a properly-encoded hash. replaceHashPath(encodedPath); } else { var location = getDOMLocation(); var prevLocation = history.location; if (!forceNextPop && locationsAreEqual(prevLocation, location)) return; // A hashchange doesn't always == location change. if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace. ignorePath = null; handlePop(location); } } function handlePop(location) { if (forceNextPop) { forceNextPop = false; setState(); } else { var action = 'POP'; transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (ok) { setState({ action: action, location: location }); } else { revertPop(location); } }); } } function revertPop(fromLocation) { var toLocation = history.location; // TODO: We could probably make this more reliable by // keeping a list of paths we've seen in sessionStorage. // Instead, we just default to 0 for paths we don't know. var toIndex = allPaths.lastIndexOf(createPath(toLocation)); if (toIndex === -1) toIndex = 0; var fromIndex = allPaths.lastIndexOf(createPath(fromLocation)); if (fromIndex === -1) fromIndex = 0; var delta = toIndex - fromIndex; if (delta) { forceNextPop = true; go(delta); } } // Ensure the hash is encoded properly before doing anything else. var path = getHashPath(); var encodedPath = encodePath(path); if (path !== encodedPath) replaceHashPath(encodedPath); var initialLocation = getDOMLocation(); var allPaths = [createPath(initialLocation)]; // Public interface function createHref(location) { return '#' + encodePath(basename + createPath(location)); } function push(path, state) { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(state === undefined, 'Hash history cannot push state; it is ignored') : undefined; var action = 'PUSH'; var location = createLocation(path, undefined, undefined, history.location); transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (!ok) return; var path = createPath(location); var encodedPath = encodePath(basename + path); var hashChanged = getHashPath() !== encodedPath; if (hashChanged) { // We cannot tell if a hashchange was caused by a PUSH, so we'd // rather setState here and ignore the hashchange. The caveat here // is that other hash histories in the page will consider it a POP. ignorePath = path; pushHashPath(encodedPath); var prevIndex = allPaths.lastIndexOf(createPath(history.location)); var nextPaths = allPaths.slice(0, prevIndex === -1 ? 0 : prevIndex + 1); nextPaths.push(path); allPaths = nextPaths; setState({ action: action, location: location }); } else { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(false, 'Hash history cannot PUSH the same path; a new entry will not be added to the history stack') : undefined; setState(); } }); } function replace(path, state) { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(state === undefined, 'Hash history cannot replace state; it is ignored') : undefined; var action = 'REPLACE'; var location = createLocation(path, undefined, undefined, history.location); transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (!ok) return; var path = createPath(location); var encodedPath = encodePath(basename + path); var hashChanged = getHashPath() !== encodedPath; if (hashChanged) { // We cannot tell if a hashchange was caused by a REPLACE, so we'd // rather setState here and ignore the hashchange. The caveat here // is that other hash histories in the page will consider it a POP. ignorePath = path; replaceHashPath(encodedPath); } var prevIndex = allPaths.indexOf(createPath(history.location)); if (prevIndex !== -1) allPaths[prevIndex] = path; setState({ action: action, location: location }); }); } function go(n) { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(canGoWithoutReload, 'Hash history go(n) causes a full page reload in this browser') : undefined; globalHistory.go(n); } function goBack() { go(-1); } function goForward() { go(1); } var listenerCount = 0; function checkDOMListeners(delta) { listenerCount += delta; if (listenerCount === 1 && delta === 1) { window.addEventListener(HashChangeEvent$1, handleHashChange); } else if (listenerCount === 0) { window.removeEventListener(HashChangeEvent$1, handleHashChange); } } var isBlocked = false; function block(prompt) { if (prompt === void 0) { prompt = false; } var unblock = transitionManager.setPrompt(prompt); if (!isBlocked) { checkDOMListeners(1); isBlocked = true; } return function () { if (isBlocked) { isBlocked = false; checkDOMListeners(-1); } return unblock(); }; } function listen(listener) { var unlisten = transitionManager.appendListener(listener); checkDOMListeners(1); return function () { checkDOMListeners(-1); unlisten(); }; } var history = { length: globalHistory.length, action: 'POP', location: initialLocation, createHref: createHref, push: push, replace: replace, go: go, goBack: goBack, goForward: goForward, block: block, listen: listen }; return history; } function clamp(n, lowerBound, upperBound) { return Math.min(Math.max(n, lowerBound), upperBound); } /** * Creates a history object that stores locations in memory. */ function createMemoryHistory(props) { if (props === void 0) { props = {}; } var _props = props, getUserConfirmation = _props.getUserConfirmation, _props$initialEntries = _props.initialEntries, initialEntries = _props$initialEntries === void 0 ? ['/'] : _props$initialEntries, _props$initialIndex = _props.initialIndex, initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex, _props$keyLength = _props.keyLength, keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength; var transitionManager = createTransitionManager(); function setState(nextState) { Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])(history, nextState); history.length = history.entries.length; transitionManager.notifyListeners(history.location, history.action); } function createKey() { return Math.random().toString(36).substr(2, keyLength); } var index = clamp(initialIndex, 0, initialEntries.length - 1); var entries = initialEntries.map(function (entry) { return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey()); }); // Public interface var createHref = createPath; function push(path, state) { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : undefined; var action = 'PUSH'; var location = createLocation(path, state, createKey(), history.location); transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (!ok) return; var prevIndex = history.index; var nextIndex = prevIndex + 1; var nextEntries = history.entries.slice(0); if (nextEntries.length > nextIndex) { nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location); } else { nextEntries.push(location); } setState({ action: action, location: location, index: nextIndex, entries: nextEntries }); }); } function replace(path, state) { true ? Object(tiny_warning__WEBPACK_IMPORTED_MODULE_3__["default"])(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : undefined; var action = 'REPLACE'; var location = createLocation(path, state, createKey(), history.location); transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (!ok) return; history.entries[history.index] = location; setState({ action: action, location: location }); }); } function go(n) { var nextIndex = clamp(history.index + n, 0, history.entries.length - 1); var action = 'POP'; var location = history.entries[nextIndex]; transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) { if (ok) { setState({ action: action, location: location, index: nextIndex }); } else { // Mimic the behavior of DOM histories by // causing a render after a cancelled POP. setState(); } }); } function goBack() { go(-1); } function goForward() { go(1); } function canGo(n) { var nextIndex = history.index + n; return nextIndex >= 0 && nextIndex < history.entries.length; } function block(prompt) { if (prompt === void 0) { prompt = false; } return transitionManager.setPrompt(prompt); } function listen(listener) { return transitionManager.appendListener(listener); } var history = { length: entries.length, action: 'POP', location: entries[index], index: index, entries: entries, createHref: createHref, push: push, replace: replace, go: go, goBack: goBack, goForward: goForward, canGo: canGo, block: block, listen: listen }; return history; } /***/ }), /***/ "./node_modules/interactjs/dist/interact.js": /*!**************************************************!*\ !*** ./node_modules/interactjs/dist/interact.js ***! \**************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { /** * interact.js 1.5.4 * * Copyright (c) 2012-2019 Taye Adeyemi * Released under the MIT License. * https://raw.github.com/taye/interact.js/master/LICENSE */ (function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports; var createModuleFactory = function createModuleFactory(t){var e;return function(r){return e||t(e={exports:{},parent:r},e.exports),e.exports}}; var _$scope_24 = createModuleFactory(function (module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /* common-shake removed: exports.createScope = */ void createScope; /* common-shake removed: exports.initScope = */ void initScope; exports.Scope = exports.ActionName = void 0; var utils = _interopRequireWildcard(_$utils_56); var _domObjects = _interopRequireDefault(_$domObjects_50); var _defaultOptions = _interopRequireDefault(_$defaultOptions_20); var _Eventable = _interopRequireDefault(_$Eventable_14); var _Interactable = _interopRequireDefault(_$Interactable_16); var _InteractableSet = _interopRequireDefault(_$InteractableSet_17); var _InteractEvent = _interopRequireDefault(_$InteractEvent_15); var _interactions = _interopRequireDefault(_$interactions_23({})); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var win = utils.win, browser = utils.browser, raf = utils.raf, Signals = utils.Signals, events = utils.events; var ActionName; exports.ActionName = ActionName; (function (ActionName) {})(ActionName || (exports.ActionName = ActionName = {})); function createScope() { return new Scope(); } var Scope = /*#__PURE__*/ function () { function Scope() { var _this = this; _classCallCheck(this, Scope); this.id = "__interact_scope_".concat(Math.floor(Math.random() * 100)); this.signals = new Signals(); this.browser = browser; this.events = events; this.utils = utils; this.defaults = utils.clone(_defaultOptions["default"]); this.Eventable = _Eventable["default"]; this.actions = { names: [], methodDict: {}, eventTypes: [] }; this.InteractEvent = _InteractEvent["default"]; this.interactables = new _InteractableSet["default"](this); // all documents being listened to this.documents = []; this._plugins = []; this._pluginMap = {}; this.onWindowUnload = function (event) { return _this.removeDocument(event.target); }; var scope = this; this.Interactable = /*#__PURE__*/ function (_InteractableBase) { _inherits(Interactable, _InteractableBase); function Interactable() { _classCallCheck(this, Interactable); return _possibleConstructorReturn(this, _getPrototypeOf(Interactable).apply(this, arguments)); } _createClass(Interactable, [{ key: "set", value: function set(options) { _get(_getPrototypeOf(Interactable.prototype), "set", this).call(this, options); scope.interactables.signals.fire('set', { options: options, interactable: this }); return this; } }, { key: "unset", value: function unset() { _get(_getPrototypeOf(Interactable.prototype), "unset", this).call(this); for (var i = scope.interactions.list.length - 1; i >= 0; i--) { var interaction = scope.interactions.list[i]; if (interaction.interactable === this) { interaction.stop(); scope.interactions.signals.fire('destroy', { interaction: interaction }); interaction.destroy(); if (scope.interactions.list.length > 2) { scope.interactions.list.splice(i, 1); } } } scope.interactables.signals.fire('unset', { interactable: this }); } }, { key: "_defaults", get: function get() { return scope.defaults; } }]); return Interactable; }(_Interactable["default"]); } _createClass(Scope, [{ key: "init", value: function init(window) { return initScope(this, window); } }, { key: "pluginIsInstalled", value: function pluginIsInstalled(plugin) { return this._pluginMap[plugin.id] || this._plugins.indexOf(plugin) !== -1; } }, { key: "usePlugin", value: function usePlugin(plugin, options) { if (this.pluginIsInstalled(plugin)) { return this; } if (plugin.id) { this._pluginMap[plugin.id] = plugin; } plugin.install(this, options); this._plugins.push(plugin); return this; } }, { key: "addDocument", value: function addDocument(doc, options) { // do nothing if document is already known if (this.getDocIndex(doc) !== -1) { return false; } var window = win.getWindow(doc); options = options ? utils.extend({}, options) : {}; this.documents.push({ doc: doc, options: options }); events.documents.push(doc); // don't add an unload event for the main document // so that the page may be cached in browser history if (doc !== this.document) { events.add(window, 'unload', this.onWindowUnload); } this.signals.fire('add-document', { doc: doc, window: window, scope: this, options: options }); } }, { key: "removeDocument", value: function removeDocument(doc) { var index = this.getDocIndex(doc); var window = win.getWindow(doc); var options = this.documents[index].options; events.remove(window, 'unload', this.onWindowUnload); this.documents.splice(index, 1); events.documents.splice(index, 1); this.signals.fire('remove-document', { doc: doc, window: window, scope: this, options: options }); } }, { key: "getDocIndex", value: function getDocIndex(doc) { for (var i = 0; i < this.documents.length; i++) { if (this.documents[i].doc === doc) { return i; } } return -1; } }, { key: "getDocOptions", value: function getDocOptions(doc) { var docIndex = this.getDocIndex(doc); return docIndex === -1 ? null : this.documents[docIndex].options; } }, { key: "now", value: function now() { return (this.window.Date || Date).now(); } }]); return Scope; }(); exports.Scope = Scope; function initScope(scope, window) { win.init(window); _domObjects["default"].init(window); browser.init(window); raf.init(window); events.init(window); scope.usePlugin(_interactions["default"]); scope.document = window.document; scope.window = window; return scope; } }); var _$interactions_23 = createModuleFactory(function (module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _browser = _interopRequireDefault(_$browser_48); var _domObjects = _interopRequireDefault(_$domObjects_50); /* removed: var _$domUtils_51 = require("@interactjs/utils/domUtils"); */; var _events = _interopRequireDefault(_$events_52); var _pointerUtils = _interopRequireDefault(_$pointerUtils_61); var _Signals = _interopRequireDefault(_$Signals_46); var _Interaction = _interopRequireDefault(_$Interaction_18({})); var _interactionFinder = _interopRequireDefault(_$interactionFinder_22); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var methodNames = ['pointerDown', 'pointerMove', 'pointerUp', 'updatePointer', 'removePointer', 'windowBlur']; function install(scope) { var signals = new _Signals["default"](); var listeners = {}; for (var _i = 0; _i < methodNames.length; _i++) { var method = methodNames[_i]; listeners[method] = doOnInteractions(method, scope); } var pEventTypes = _browser["default"].pEventTypes; var docEvents; if (_domObjects["default"].PointerEvent) { docEvents = [{ type: pEventTypes.down, listener: releasePointersOnRemovedEls }, { type: pEventTypes.down, listener: listeners.pointerDown }, { type: pEventTypes.move, listener: listeners.pointerMove }, { type: pEventTypes.up, listener: listeners.pointerUp }, { type: pEventTypes.cancel, listener: listeners.pointerUp }]; } else { docEvents = [{ type: 'mousedown', listener: listeners.pointerDown }, { type: 'mousemove', listener: listeners.pointerMove }, { type: 'mouseup', listener: listeners.pointerUp }, { type: 'touchstart', listener: releasePointersOnRemovedEls }, { type: 'touchstart', listener: listeners.pointerDown }, { type: 'touchmove', listener: listeners.pointerMove }, { type: 'touchend', listener: listeners.pointerUp }, { type: 'touchcancel', listener: listeners.pointerUp }]; } docEvents.push({ type: 'blur', listener: function listener(event) { for (var _i2 = 0; _i2 < scope.interactions.list.length; _i2++) { var _ref; _ref = scope.interactions.list[_i2]; var interaction = _ref; interaction.documentBlur(event); } } }); scope.signals.on('add-document', onDocSignal); scope.signals.on('remove-document', onDocSignal); // for ignoring browser's simulated mouse events scope.prevTouchTime = 0; scope.Interaction = /*#__PURE__*/ function (_InteractionBase) { _inherits(Interaction, _InteractionBase); function Interaction() { _classCallCheck(this, Interaction); return _possibleConstructorReturn(this, _getPrototypeOf(Interaction).apply(this, arguments)); } _createClass(Interaction, [{ key: "_now", value: function _now() { return scope.now(); } }, { key: "pointerMoveTolerance", get: function get() { return scope.interactions.pointerMoveTolerance; }, set: function set(value) { scope.interactions.pointerMoveTolerance = value; } }]); return Interaction; }(_Interaction["default"]); scope.interactions = { signals: signals, // all active and idle interactions list: [], "new": function _new(options) { options.signals = signals; var interaction = new scope.Interaction(options); scope.interactions.list.push(interaction); return interaction; }, listeners: listeners, docEvents: docEvents, pointerMoveTolerance: 1 }; function releasePointersOnRemovedEls() { // for all inactive touch interactions with pointers down for (var _i3 = 0; _i3 < scope.interactions.list.length; _i3++) { var _ref2; _ref2 = scope.interactions.list[_i3]; var interaction = _ref2; if (!interaction.pointerIsDown || interaction.pointerType !== 'touch' || interaction._interacting) { continue; } // if a pointer is down on an element that is no longer in the DOM tree var _loop = function _loop() { _ref3 = interaction.pointers[_i4]; var pointer = _ref3; if (!scope.documents.some(function (_ref4) { var doc = _ref4.doc; return (0, _$domUtils_51.nodeContains)(doc, pointer.downTarget); })) { // remove the pointer from the interaction interaction.removePointer(pointer.pointer, pointer.event); } }; for (var _i4 = 0; _i4 < interaction.pointers.length; _i4++) { var _ref3; _loop(); } } } } function doOnInteractions(method, scope) { return function (event) { var interactions = scope.interactions.list; var pointerType = _pointerUtils["default"].getPointerType(event); var _pointerUtils$getEven = _pointerUtils["default"].getEventTargets(event), _pointerUtils$getEven2 = _slicedToArray(_pointerUtils$getEven, 2), eventTarget = _pointerUtils$getEven2[0], curEventTarget = _pointerUtils$getEven2[1]; var matches = []; // [ [pointer, interaction], ...] if (/^touch/.test(event.type)) { scope.prevTouchTime = scope.now(); for (var _i5 = 0; _i5 < event.changedTouches.length; _i5++) { var _ref5; _ref5 = event.changedTouches[_i5]; var changedTouch = _ref5; var pointer = changedTouch; var pointerId = _pointerUtils["default"].getPointerId(pointer); var searchDetails = { pointer: pointer, pointerId: pointerId, pointerType: pointerType, eventType: event.type, eventTarget: eventTarget, curEventTarget: curEventTarget, scope: scope }; var interaction = getInteraction(searchDetails); matches.push([searchDetails.pointer, searchDetails.eventTarget, searchDetails.curEventTarget, interaction]); } } else { var invalidPointer = false; if (!_browser["default"].supportsPointerEvent && /mouse/.test(event.type)) { // ignore mouse events while touch interactions are active for (var i = 0; i < interactions.length && !invalidPointer; i++) { invalidPointer = interactions[i].pointerType !== 'mouse' && interactions[i].pointerIsDown; } // try to ignore mouse events that are simulated by the browser // after a touch event invalidPointer = invalidPointer || scope.now() - scope.prevTouchTime < 500 || // on iOS and Firefox Mobile, MouseEvent.timeStamp is zero if simulated event.timeStamp === 0; } if (!invalidPointer) { var _searchDetails = { pointer: event, pointerId: _pointerUtils["default"].getPointerId(event), pointerType: pointerType, eventType: event.type, curEventTarget: curEventTarget, eventTarget: eventTarget, scope: scope }; var _interaction = getInteraction(_searchDetails); matches.push([_searchDetails.pointer, _searchDetails.eventTarget, _searchDetails.curEventTarget, _interaction]); } } // eslint-disable-next-line no-shadow for (var _i6 = 0; _i6 < matches.length; _i6++) { var _matches$_i = _slicedToArray(matches[_i6], 4), _pointer = _matches$_i[0], _eventTarget = _matches$_i[1], _curEventTarget = _matches$_i[2], _interaction2 = _matches$_i[3]; _interaction2[method](_pointer, event, _eventTarget, _curEventTarget); } }; } function getInteraction(searchDetails) { var pointerType = searchDetails.pointerType, scope = searchDetails.scope; var foundInteraction = _interactionFinder["default"].search(searchDetails); var signalArg = { interaction: foundInteraction, searchDetails: searchDetails }; scope.interactions.signals.fire('find', signalArg); return signalArg.interaction || scope.interactions["new"]({ pointerType: pointerType }); } function onDocSignal(_ref6, signalName) { var doc = _ref6.doc, scope = _ref6.scope, options = _ref6.options; var docEvents = scope.interactions.docEvents; var eventMethod = signalName.indexOf('add') === 0 ? _events["default"].add : _events["default"].remove; if (scope.browser.isIOS && !options.events) { options.events = { passive: false }; } // delegate event listener for (var eventType in _events["default"].delegatedEvents) { eventMethod(doc, eventType, _events["default"].delegateListener); eventMethod(doc, eventType, _events["default"].delegateUseCapture, true); } var eventOptions = options && options.events; for (var _i7 = 0; _i7 < docEvents.length; _i7++) { var _ref7; _ref7 = docEvents[_i7]; var _ref8 = _ref7, type = _ref8.type, listener = _ref8.listener; eventMethod(doc, type, listener, eventOptions); } } var _default = { id: 'core/interactions', install: install, onDocSignal: onDocSignal, doOnInteractions: doOnInteractions, methodNames: methodNames }; exports["default"] = _default; }); var _$Interaction_18 = createModuleFactory(function (module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "PointerInfo", { enumerable: true, get: function get() { return _PointerInfo["default"]; } }); exports["default"] = exports.Interaction = exports._ProxyMethods = exports._ProxyValues = void 0; var utils = _interopRequireWildcard(_$utils_56); var _InteractEvent = _interopRequireWildcard(_$InteractEvent_15); var _PointerInfo = _interopRequireDefault(_$PointerInfo_19); var _scope = _$scope_24({}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var _ProxyValues; exports._ProxyValues = _ProxyValues; (function (_ProxyValues) { _ProxyValues["interactable"] = ""; _ProxyValues["element"] = ""; _ProxyValues["prepared"] = ""; _ProxyValues["pointerIsDown"] = ""; _ProxyValues["pointerWasMoved"] = ""; _ProxyValues["_proxy"] = ""; })(_ProxyValues || (exports._ProxyValues = _ProxyValues = {})); var _ProxyMethods; exports._ProxyMethods = _ProxyMethods; (function (_ProxyMethods) { _ProxyMethods["start"] = ""; _ProxyMethods["move"] = ""; _ProxyMethods["end"] = ""; _ProxyMethods["stop"] = ""; _ProxyMethods["interacting"] = ""; })(_ProxyMethods || (exports._ProxyMethods = _ProxyMethods = {})); var Interaction = /*#__PURE__*/ function () { /** */ function Interaction(_ref) { var _this = this; var pointerType = _ref.pointerType, signals = _ref.signals; _classCallCheck(this, Interaction); // current interactable being interacted with this.interactable = null; // the target element of the interactable this.element = null; // action that's ready to be fired on next move event this.prepared = { name: null, axis: null, edges: null }; // keep track of added pointers this.pointers = []; // pointerdown/mousedown/touchstart event this.downEvent = null; this.downPointer = {}; this._latestPointer = { pointer: null, event: null, eventTarget: null }; // previous action event this.prevEvent = null; this.pointerIsDown = false; this.pointerWasMoved = false; this._interacting = false; this._ending = false; this._stopped = true; this._proxy = null; this.simulation = null; /** * @alias Interaction.prototype.move */ this.doMove = utils.warnOnce(function (signalArg) { this.move(signalArg); }, 'The interaction.doMove() method has been renamed to interaction.move()'); this.coords = { // Starting InteractEvent pointer coordinates start: utils.pointer.newCoords(), // Previous native pointer move event coordinates prev: utils.pointer.newCoords(), // current native pointer move event coordinates cur: utils.pointer.newCoords(), // Change in coordinates and time of the pointer delta: utils.pointer.newCoords(), // pointer velocity velocity: utils.pointer.newCoords() }; this._signals = signals; this.pointerType = pointerType; var that = this; this._proxy = {}; var _loop = function _loop(key) { Object.defineProperty(_this._proxy, key, { get: function get() { return that[key]; } }); }; for (var key in _ProxyValues) { _loop(key); } var _loop2 = function _loop2(key) { Object.defineProperty(_this._proxy, key, { value: function value() { return that[key].apply(that, arguments); } }); }; for (var key in _ProxyMethods) { _loop2(key); } this._signals.fire('new', { interaction: this }); } _createClass(Interaction, [{ key: "pointerDown", value: function pointerDown(pointer, event, eventTarget) { var pointerIndex = this.updatePointer(pointer, event, eventTarget, true); this._signals.fire('down', { pointer: pointer, event: event, eventTarget: eventTarget, pointerIndex: pointerIndex, interaction: this }); } /** * ```js * interact(target) * .draggable({ * // disable the default drag start by down->move * manualStart: true * }) * // start dragging after the user holds the pointer down * .on('hold', function (event) { * var interaction = event.interaction * * if (!interaction.interacting()) { * interaction.start({ name: 'drag' }, * event.interactable, * event.currentTarget) * } * }) * ``` * * Start an action with the given Interactable and Element as tartgets. The * action must be enabled for the target Interactable and an appropriate * number of pointers must be held down - 1 for drag/resize, 2 for gesture. * * Use it with `interactable.able({ manualStart: false })` to always * [start actions manually](https://github.com/taye/interact.js/issues/114) * * @param {object} action The action to be performed - drag, resize, etc. * @param {Interactable} target The Interactable to target * @param {Element} element The DOM Element to target * @return {object} interact */ }, { key: "start", value: function start(action, interactable, element) { if (this.interacting() || !this.pointerIsDown || this.pointers.length < (action.name === _scope.ActionName.Gesture ? 2 : 1) || !interactable.options[action.name].enabled) { return false; } utils.copyAction(this.prepared, action); this.interactable = interactable; this.element = element; this.rect = interactable.getRect(element); this.edges = this.prepared.edges; this._stopped = false; this._interacting = this._doPhase({ interaction: this, event: this.downEvent, phase: _InteractEvent.EventPhase.Start }) && !this._stopped; return this._interacting; } }, { key: "pointerMove", value: function pointerMove(pointer, event, eventTarget) { if (!this.simulation && !(this.modifiers && this.modifiers.endPrevented)) { this.updatePointer(pointer, event, eventTarget, false); utils.pointer.setCoords(this.coords.cur, this.pointers.map(function (p) { return p.pointer; }), this._now()); } var duplicateMove = this.coords.cur.page.x === this.coords.prev.page.x && this.coords.cur.page.y === this.coords.prev.page.y && this.coords.cur.client.x === this.coords.prev.client.x && this.coords.cur.client.y === this.coords.prev.client.y; var dx; var dy; // register movement greater than pointerMoveTolerance if (this.pointerIsDown && !this.pointerWasMoved) { dx = this.coords.cur.client.x - this.coords.start.client.x; dy = this.coords.cur.client.y - this.coords.start.client.y; this.pointerWasMoved = utils.hypot(dx, dy) > this.pointerMoveTolerance; } var signalArg = { pointer: pointer, pointerIndex: this.getPointerIndex(pointer), event: event, eventTarget: eventTarget, dx: dx, dy: dy, duplicate: duplicateMove, interaction: this }; if (!duplicateMove) { // set pointer coordinate, time changes and velocity utils.pointer.setCoordDeltas(this.coords.delta, this.coords.prev, this.coords.cur); utils.pointer.setCoordVelocity(this.coords.velocity, this.coords.delta); } this._signals.fire('move', signalArg); if (!duplicateMove) { // if interacting, fire an 'action-move' signal etc if (this.interacting()) { this.move(signalArg); } if (this.pointerWasMoved) { utils.pointer.copyCoords(this.coords.prev, this.coords.cur); } } } /** * ```js * interact(target) * .draggable(true) * .on('dragmove', function (event) { * if (someCondition) { * // change the snap settings * event.interactable.draggable({ snap: { targets: [] }}) * // fire another move event with re-calculated snap * event.interaction.move() * } * }) * ``` * * Force a move of the current action at the same coordinates. Useful if * snap/restrict has been changed and you want a movement with the new * settings. */ }, { key: "move", value: function move(signalArg) { signalArg = utils.extend({ pointer: this._latestPointer.pointer, event: this._latestPointer.event, eventTarget: this._latestPointer.eventTarget, interaction: this }, signalArg || {}); signalArg.phase = _InteractEvent.EventPhase.Move; this._doPhase(signalArg); } // End interact move events and stop auto-scroll unless simulation is running }, { key: "pointerUp", value: function pointerUp(pointer, event, eventTarget, curEventTarget) { var pointerIndex = this.getPointerIndex(pointer); if (pointerIndex === -1) { pointerIndex = this.updatePointer(pointer, event, eventTarget, false); } this._signals.fire(/cancel$/i.test(event.type) ? 'cancel' : 'up', { pointer: pointer, pointerIndex: pointerIndex, event: event, eventTarget: eventTarget, curEventTarget: curEventTarget, interaction: this }); if (!this.simulation) { this.end(event); } this.pointerIsDown = false; this.removePointer(pointer, event); } }, { key: "documentBlur", value: function documentBlur(event) { this.end(event); this._signals.fire('blur', { event: event, interaction: this }); } /** * ```js * interact(target) * .draggable(true) * .on('move', function (event) { * if (event.pageX > 1000) { * // end the current action * event.interaction.end() * // stop all further listeners from being called * event.stopImmediatePropagation() * } * }) * ``` * * @param {PointerEvent} [event] */ }, { key: "end", value: function end(event) { this._ending = true; event = event || this._latestPointer.event; var endPhaseResult; if (this.interacting()) { endPhaseResult = this._doPhase({ event: event, interaction: this, phase: _InteractEvent.EventPhase.End }); } this._ending = false; if (endPhaseResult === true) { this.stop(); } } }, { key: "currentAction", value: function currentAction() { return this._interacting ? this.prepared.name : null; } }, { key: "interacting", value: function interacting() { return this._interacting; } /** */ }, { key: "stop", value: function stop() { this._signals.fire('stop', { interaction: this }); this.interactable = this.element = null; this._interacting = false; this._stopped = true; this.prepared.name = this.prevEvent = null; } }, { key: "getPointerIndex", value: function getPointerIndex(pointer) { var pointerId = utils.pointer.getPointerId(pointer); // mouse and pen interactions may have only one pointer return this.pointerType === 'mouse' || this.pointerType === 'pen' ? this.pointers.length - 1 : utils.arr.findIndex(this.pointers, function (curPointer) { return curPointer.id === pointerId; }); } }, { key: "getPointerInfo", value: function getPointerInfo(pointer) { return this.pointers[this.getPointerIndex(pointer)]; } }, { key: "updatePointer", value: function updatePointer(pointer, event, eventTarget, down) { var id = utils.pointer.getPointerId(pointer); var pointerIndex = this.getPointerIndex(pointer); var pointerInfo = this.pointers[pointerIndex]; down = down === false ? false : down || /(down|start)$/i.test(event.type); if (!pointerInfo) { pointerInfo = new _PointerInfo["default"](id, pointer, event, null, null); pointerIndex = this.pointers.length; this.pointers.push(pointerInfo); } else { pointerInfo.pointer = pointer; } if (down) { this.pointerIsDown = true; if (!this.interacting()) { utils.pointer.setCoords(this.coords.start, this.pointers.map(function (p) { return p.pointer; }), this._now()); utils.pointer.copyCoords(this.coords.cur, this.coords.start); utils.pointer.copyCoords(this.coords.prev, this.coords.start); utils.pointer.pointerExtend(this.downPointer, pointer); this.downEvent = event; pointerInfo.downTime = this.coords.cur.timeStamp; pointerInfo.downTarget = eventTarget; this.pointerWasMoved = false; } } this._updateLatestPointer(pointer, event, eventTarget); this._signals.fire('update-pointer', { pointer: pointer, event: event, eventTarget: eventTarget, down: down, pointerInfo: pointerInfo, pointerIndex: pointerIndex, interaction: this }); return pointerIndex; } }, { key: "removePointer", value: function removePointer(pointer, event) { var pointerIndex = this.getPointerIndex(pointer); if (pointerIndex === -1) { return; } var pointerInfo = this.pointers[pointerIndex]; this._signals.fire('remove-pointer', { pointer: pointer, event: event, pointerIndex: pointerIndex, pointerInfo: pointerInfo, interaction: this }); this.pointers.splice(pointerIndex, 1); } }, { key: "_updateLatestPointer", value: function _updateLatestPointer(pointer, event, eventTarget) { this._latestPointer.pointer = pointer; this._latestPointer.event = event; this._latestPointer.eventTarget = eventTarget; } }, { key: "destroy", value: function destroy() { this._latestPointer.pointer = null; this._latestPointer.event = null; this._latestPointer.eventTarget = null; } }, { key: "_createPreparedEvent", value: function _createPreparedEvent(event, phase, preEnd, type) { var actionName = this.prepared.name; return new _InteractEvent["default"](this, event, actionName, phase, this.element, null, preEnd, type); } }, { key: "_fireEvent", value: function _fireEvent(iEvent) { this.interactable.fire(iEvent); if (!this.prevEvent || iEvent.timeStamp >= this.prevEvent.timeStamp) { this.prevEvent = iEvent; } } }, { key: "_doPhase", value: function _doPhase(signalArg) { var event = signalArg.event, phase = signalArg.phase, preEnd = signalArg.preEnd, type = signalArg.type; var beforeResult = this._signals.fire("before-action-".concat(phase), signalArg); if (beforeResult === false) { return false; } var iEvent = signalArg.iEvent = this._createPreparedEvent(event, phase, preEnd, type); var rect = this.rect; if (rect) { // update the rect modifications var edges = this.edges || this.prepared.edges || { left: true, right: true, top: true, bottom: true }; if (edges.top) { rect.top += iEvent.delta.y; } if (edges.bottom) { rect.bottom += iEvent.delta.y; } if (edges.left) { rect.left += iEvent.delta.x; } if (edges.right) { rect.right += iEvent.delta.x; } rect.width = rect.right - rect.left; rect.height = rect.bottom - rect.top; } this._signals.fire("action-".concat(phase), signalArg); this._fireEvent(iEvent); this._signals.fire("after-action-".concat(phase), signalArg); return true; } }, { key: "_now", value: function _now() { return Date.now(); } }, { key: "pointerMoveTolerance", get: function get() { return 1; } }]); return Interaction; }(); exports.Interaction = Interaction; var _default = Interaction; exports["default"] = _default; }); var _$arr_47 = {}; "use strict"; Object.defineProperty(_$arr_47, "__esModule", { value: true }); _$arr_47.contains = contains; _$arr_47.remove = remove; _$arr_47.merge = merge; _$arr_47.from = from; _$arr_47.findIndex = findIndex; _$arr_47.find = find; function contains(array, target) { return array.indexOf(target) !== -1; } function remove(array, target) { return array.splice(array.indexOf(target), 1); } function merge(target, source) { for (var _i = 0; _i < source.length; _i++) { var _ref; _ref = source[_i]; var item = _ref; target.push(item); } return target; } function from(source) { return merge([], source); } function findIndex(array, func) { for (var i = 0; i < array.length; i++) { if (func(array[i], i, array)) { return i; } } return -1; } function find(array, func) { return array[findIndex(array, func)]; } var _$domObjects_50 = {}; "use strict"; Object.defineProperty(_$domObjects_50, "__esModule", { value: true }); _$domObjects_50["default"] = void 0; var domObjects = { init: init, document: null, DocumentFragment: null, SVGElement: null, SVGSVGElement: null, // eslint-disable-next-line no-undef SVGElementInstance: null, Element: null, HTMLElement: null, Event: null, Touch: null, PointerEvent: null }; function blank() {} var _default = domObjects; _$domObjects_50["default"] = _default; function init(window) { var win = window; domObjects.document = win.document; domObjects.DocumentFragment = win.DocumentFragment || blank; domObjects.SVGElement = win.SVGElement || blank; domObjects.SVGSVGElement = win.SVGSVGElement || blank; domObjects.SVGElementInstance = win.SVGElementInstance || blank; domObjects.Element = win.Element || blank; domObjects.HTMLElement = win.HTMLElement || domObjects.Element; domObjects.Event = win.Event; domObjects.Touch = win.Touch || blank; domObjects.PointerEvent = win.PointerEvent || win.MSPointerEvent; } var _$isWindow_58 = {}; "use strict"; Object.defineProperty(_$isWindow_58, "__esModule", { value: true }); _$isWindow_58["default"] = void 0; var ___default_58 = function _default(thing) { return !!(thing && thing.Window) && thing instanceof thing.Window; }; _$isWindow_58["default"] = ___default_58; var _$window_66 = {}; "use strict"; Object.defineProperty(_$window_66, "__esModule", { value: true }); _$window_66.init = __init_66; _$window_66.getWindow = getWindow; _$window_66["default"] = void 0; var _isWindow = _interopRequireDefault(_$isWindow_58); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var win = { realWindow: undefined, window: undefined, getWindow: getWindow, init: __init_66 }; function __init_66(window) { // get wrapped window if using Shadow DOM polyfill win.realWindow = window; // create a TextNode var el = window.document.createTextNode(''); // check if it's wrapped by a polyfill if (el.ownerDocument !== window.document && typeof window.wrap === 'function' && window.wrap(el) === el) { // use wrapped window window = window.wrap(window); } win.window = window; } if (typeof window === 'undefined') { win.window = undefined; win.realWindow = undefined; } else { __init_66(window); } function getWindow(node) { if ((0, _isWindow["default"])(node)) { return node; } var rootNode = node.ownerDocument || node; return rootNode.defaultView || win.window; } win.init = __init_66; var ___default_66 = win; _$window_66["default"] = ___default_66; var _$is_57 = {}; "use strict"; Object.defineProperty(_$is_57, "__esModule", { value: true }); _$is_57.array = _$is_57.plainObject = _$is_57.element = _$is_57.string = _$is_57.bool = _$is_57.number = _$is_57.func = _$is_57.object = _$is_57.docFrag = _$is_57.window = void 0; var ___isWindow_57 = ___interopRequireDefault_57(_$isWindow_58); var _window2 = ___interopRequireDefault_57(_$window_66); function ___interopRequireDefault_57(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } var __window_57 = function window(thing) { return thing === _window2["default"].window || (0, ___isWindow_57["default"])(thing); }; _$is_57.window = __window_57; var docFrag = function docFrag(thing) { return object(thing) && thing.nodeType === 11; }; _$is_57.docFrag = docFrag; var object = function object(thing) { return !!thing && _typeof(thing) === 'object'; }; _$is_57.object = object; var func = function func(thing) { return typeof thing === 'function'; }; _$is_57.func = func; var number = function number(thing) { return typeof thing === 'number'; }; _$is_57.number = number; var bool = function bool(thing) { return typeof thing === 'boolean'; }; _$is_57.bool = bool; var string = function string(thing) { return typeof thing === 'string'; }; _$is_57.string = string; var element = function element(thing) { if (!thing || _typeof(thing) !== 'object') { return false; } var _window = _window2["default"].getWindow(thing) || _window2["default"].window; return /object|function/.test(_typeof(_window.Element)) ? thing instanceof _window.Element // DOM2 : thing.nodeType === 1 && typeof thing.nodeName === 'string'; }; _$is_57.element = element; var plainObject = function plainObject(thing) { return object(thing) && !!thing.constructor && /function Object\b/.test(thing.constructor.toString()); }; _$is_57.plainObject = plainObject; var array = function array(thing) { return object(thing) && typeof thing.length !== 'undefined' && func(thing.splice); }; _$is_57.array = array; var _$browser_48 = {}; "use strict"; Object.defineProperty(_$browser_48, "__esModule", { value: true }); _$browser_48["default"] = void 0; var _domObjects = ___interopRequireDefault_48(_$domObjects_50); var is = _interopRequireWildcard(_$is_57); var _window = ___interopRequireDefault_48(_$window_66); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function ___interopRequireDefault_48(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var browser = { init: __init_48, supportsTouch: null, supportsPointerEvent: null, isIOS7: null, isIOS: null, isIe9: null, isOperaMobile: null, prefixedMatchesSelector: null, pEventTypes: null, wheelEvent: null }; function __init_48(window) { var Element = _domObjects["default"].Element; var navigator = _window["default"].window.navigator; // Does the browser support touch input? browser.supportsTouch = 'ontouchstart' in window || is.func(window.DocumentTouch) && _domObjects["default"].document instanceof window.DocumentTouch; // Does the browser support PointerEvents browser.supportsPointerEvent = navigator.pointerEnabled !== false && !!_domObjects["default"].PointerEvent; browser.isIOS = /iP(hone|od|ad)/.test(navigator.platform); // scrolling doesn't change the result of getClientRects on iOS 7 browser.isIOS7 = /iP(hone|od|ad)/.test(navigator.platform) && /OS 7[^\d]/.test(navigator.appVersion); browser.isIe9 = /MSIE 9/.test(navigator.userAgent); // Opera Mobile must be handled differently browser.isOperaMobile = navigator.appName === 'Opera' && browser.supportsTouch && /Presto/.test(navigator.userAgent); // prefix matchesSelector browser.prefixedMatchesSelector = 'matches' in Element.prototype ? 'matches' : 'webkitMatchesSelector' in Element.prototype ? 'webkitMatchesSelector' : 'mozMatchesSelector' in Element.prototype ? 'mozMatchesSelector' : 'oMatchesSelector' in Element.prototype ? 'oMatchesSelector' : 'msMatchesSelector'; browser.pEventTypes = browser.supportsPointerEvent ? _domObjects["default"].PointerEvent === window.MSPointerEvent ? { up: 'MSPointerUp', down: 'MSPointerDown', over: 'mouseover', out: 'mouseout', move: 'MSPointerMove', cancel: 'MSPointerCancel' } : { up: 'pointerup', down: 'pointerdown', over: 'pointerover', out: 'pointerout', move: 'pointermove', cancel: 'pointercancel' } : null; // because Webkit and Opera still use 'mousewheel' event type browser.wheelEvent = 'onmousewheel' in _domObjects["default"].document ? 'mousewheel' : 'wheel'; } var ___default_48 = browser; _$browser_48["default"] = ___default_48; var _$domUtils_51 = {}; "use strict"; Object.defineProperty(_$domUtils_51, "__esModule", { value: true }); _$domUtils_51.nodeContains = nodeContains; _$domUtils_51.closest = closest; _$domUtils_51.parentNode = parentNode; _$domUtils_51.matchesSelector = matchesSelector; _$domUtils_51.indexOfDeepestElement = indexOfDeepestElement; _$domUtils_51.matchesUpTo = matchesUpTo; _$domUtils_51.getActualElement = getActualElement; _$domUtils_51.getScrollXY = getScrollXY; _$domUtils_51.getElementClientRect = getElementClientRect; _$domUtils_51.getElementRect = getElementRect; _$domUtils_51.getPath = getPath; _$domUtils_51.trySelector = trySelector; var _browser = ___interopRequireDefault_51(_$browser_48); var ___domObjects_51 = ___interopRequireDefault_51(_$domObjects_50); var __is_51 = ___interopRequireWildcard_51(_$is_57); var ___window_51 = ___interopRequireDefault_51(_$window_66); function ___interopRequireWildcard_51(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function ___interopRequireDefault_51(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function nodeContains(parent, child) { while (child) { if (child === parent) { return true; } child = child.parentNode; } return false; } function closest(element, selector) { while (__is_51.element(element)) { if (matchesSelector(element, selector)) { return element; } element = parentNode(element); } return null; } function parentNode(node) { var parent = node.parentNode; if (__is_51.docFrag(parent)) { // skip past #shado-root fragments // tslint:disable-next-line while ((parent = parent.host) && __is_51.docFrag(parent)) { continue; } return parent; } return parent; } function matchesSelector(element, selector) { // remove /deep/ from selectors if shadowDOM polyfill is used if (___window_51["default"].window !== ___window_51["default"].realWindow) { selector = selector.replace(/\/deep\//g, ' '); } return element[_browser["default"].prefixedMatchesSelector](selector); } var getParent = function getParent(el) { return el.parentNode ? el.parentNode : el.host; }; // Test for the element that's "above" all other qualifiers function indexOfDeepestElement(elements) { var deepestZoneParents = []; var dropzoneParents = []; var dropzone; var deepestZone = elements[0]; var index = deepestZone ? 0 : -1; var parent; var child; var i; var n; for (i = 1; i < elements.length; i++) { dropzone = elements[i]; // an element might belong to multiple selector dropzones if (!dropzone || dropzone === deepestZone) { continue; } if (!deepestZone) { deepestZone = dropzone; index = i; continue; } // check if the deepest or current are document.documentElement or document.rootElement // - if the current dropzone is, do nothing and continue if (dropzone.parentNode === dropzone.ownerDocument) { continue; } // - if deepest is, update with the current dropzone and continue to next else if (deepestZone.parentNode === dropzone.ownerDocument) { deepestZone = dropzone; index = i; continue; } if (!deepestZoneParents.length) { parent = deepestZone; while (getParent(parent) && getParent(parent) !== parent.ownerDocument) { deepestZoneParents.unshift(parent); parent = getParent(parent); } } // if this element is an svg element and the current deepest is // an HTMLElement if (deepestZone instanceof ___domObjects_51["default"].HTMLElement && dropzone instanceof ___domObjects_51["default"].SVGElement && !(dropzone instanceof ___domObjects_51["default"].SVGSVGElement)) { if (dropzone === deepestZone.parentNode) { continue; } parent = dropzone.ownerSVGElement; } else { parent = dropzone; } dropzoneParents = []; while (parent.parentNode !== parent.ownerDocument) { dropzoneParents.unshift(parent); parent = getParent(parent); } n = 0; // get (position of last common ancestor) + 1 while (dropzoneParents[n] && dropzoneParents[n] === deepestZoneParents[n]) { n++; } var parents = [dropzoneParents[n - 1], dropzoneParents[n], deepestZoneParents[n]]; child = parents[0].lastChild; while (child) { if (child === parents[1]) { deepestZone = dropzone; index = i; deepestZoneParents = []; break; } else if (child === parents[2]) { break; } child = child.previousSibling; } } return index; } function matchesUpTo(element, selector, limit) { while (__is_51.element(element)) { if (matchesSelector(element, selector)) { return true; } element = parentNode(element); if (element === limit) { return matchesSelector(element, selector); } } return false; } function getActualElement(element) { return element instanceof ___domObjects_51["default"].SVGElementInstance ? element.correspondingUseElement : element; } function getScrollXY(relevantWindow) { relevantWindow = relevantWindow || ___window_51["default"].window; return { x: relevantWindow.scrollX || relevantWindow.document.documentElement.scrollLeft, y: relevantWindow.scrollY || relevantWindow.document.documentElement.scrollTop }; } function getElementClientRect(element) { var clientRect = element instanceof ___domObjects_51["default"].SVGElement ? element.getBoundingClientRect() : element.getClientRects()[0]; return clientRect && { left: clientRect.left, right: clientRect.right, top: clientRect.top, bottom: clientRect.bottom, width: clientRect.width || clientRect.right - clientRect.left, height: clientRect.height || clientRect.bottom - clientRect.top }; } function getElementRect(element) { var clientRect = getElementClientRect(element); if (!_browser["default"].isIOS7 && clientRect) { var scroll = getScrollXY(___window_51["default"].getWindow(element)); clientRect.left += scroll.x; clientRect.right += scroll.x; clientRect.top += scroll.y; clientRect.bottom += scroll.y; } return clientRect; } function getPath(node) { var path = []; while (node) { path.push(node); node = parentNode(node); } return path; } function trySelector(value) { if (!__is_51.string(value)) { return false; } // an exception will be raised if it is invalid ___domObjects_51["default"].document.querySelector(value); return true; } var _$clone_49 = {}; "use strict"; Object.defineProperty(_$clone_49, "__esModule", { value: true }); _$clone_49["default"] = clone; var arr = ___interopRequireWildcard_49(_$arr_47); var __is_49 = ___interopRequireWildcard_49(_$is_57); function ___interopRequireWildcard_49(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function clone(source) { var dest = {}; for (var prop in source) { var value = source[prop]; if (__is_49.plainObject(value)) { dest[prop] = clone(value); } else if (__is_49.array(value)) { dest[prop] = arr.from(value); } else { dest[prop] = value; } } return dest; } var _$pointerExtend_60 = {}; "use strict"; Object.defineProperty(_$pointerExtend_60, "__esModule", { value: true }); _$pointerExtend_60["default"] = void 0; function pointerExtend(dest, source) { for (var prop in source) { var prefixedPropREs = pointerExtend.prefixedPropREs; var deprecated = false; // skip deprecated prefixed properties for (var vendor in prefixedPropREs) { if (prop.indexOf(vendor) === 0 && prefixedPropREs[vendor].test(prop)) { deprecated = true; break; } } if (!deprecated && typeof source[prop] !== 'function') { dest[prop] = source[prop]; } } return dest; } pointerExtend.prefixedPropREs = { webkit: /(Movement[XY]|Radius[XY]|RotationAngle|Force)$/ }; var ___default_60 = pointerExtend; _$pointerExtend_60["default"] = ___default_60; var _$hypot_55 = {}; "use strict"; Object.defineProperty(_$hypot_55, "__esModule", { value: true }); _$hypot_55["default"] = void 0; var ___default_55 = function _default(x, y) { return Math.sqrt(x * x + y * y); }; _$hypot_55["default"] = ___default_55; var _$pointerUtils_61 = {}; "use strict"; Object.defineProperty(_$pointerUtils_61, "__esModule", { value: true }); _$pointerUtils_61["default"] = void 0; var ___browser_61 = ___interopRequireDefault_61(_$browser_48); var ___domObjects_61 = ___interopRequireDefault_61(_$domObjects_50); var domUtils = ___interopRequireWildcard_61(_$domUtils_51); var _hypot = ___interopRequireDefault_61(_$hypot_55); var __is_61 = ___interopRequireWildcard_61(_$is_57); var _pointerExtend = ___interopRequireDefault_61(_$pointerExtend_60); function ___interopRequireWildcard_61(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function ___interopRequireDefault_61(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var pointerUtils = { copyCoords: function copyCoords(dest, src) { dest.page = dest.page || {}; dest.page.x = src.page.x; dest.page.y = src.page.y; dest.client = dest.client || {}; dest.client.x = src.client.x; dest.client.y = src.client.y; dest.timeStamp = src.timeStamp; }, setCoordDeltas: function setCoordDeltas(targetObj, prev, cur) { targetObj.page.x = cur.page.x - prev.page.x; targetObj.page.y = cur.page.y - prev.page.y; targetObj.client.x = cur.client.x - prev.client.x; targetObj.client.y = cur.client.y - prev.client.y; targetObj.timeStamp = cur.timeStamp - prev.timeStamp; }, setCoordVelocity: function setCoordVelocity(targetObj, delta) { var dt = Math.max(delta.timeStamp / 1000, 0.001); targetObj.page.x = delta.page.x / dt; targetObj.page.y = delta.page.y / dt; targetObj.client.x = delta.client.x / dt; targetObj.client.y = delta.client.y / dt; targetObj.timeStamp = dt; }, isNativePointer: function isNativePointer(pointer) { return pointer instanceof ___domObjects_61["default"].Event || pointer instanceof ___domObjects_61["default"].Touch; }, // Get specified X/Y coords for mouse or event.touches[0] getXY: function getXY(type, pointer, xy) { xy = xy || {}; type = type || 'page'; xy.x = pointer[type + 'X']; xy.y = pointer[type + 'Y']; return xy; }, getPageXY: function getPageXY(pointer, page) { page = page || { x: 0, y: 0 }; // Opera Mobile handles the viewport and scrolling oddly if (___browser_61["default"].isOperaMobile && pointerUtils.isNativePointer(pointer)) { pointerUtils.getXY('screen', pointer, page); page.x += window.scrollX; page.y += window.scrollY; } else { pointerUtils.getXY('page', pointer, page); } return page; }, getClientXY: function getClientXY(pointer, client) { client = client || {}; if (___browser_61["default"].isOperaMobile && pointerUtils.isNativePointer(pointer)) { // Opera Mobile handles the viewport and scrolling oddly pointerUtils.getXY('screen', pointer, client); } else { pointerUtils.getXY('client', pointer, client); } return client; }, getPointerId: function getPointerId(pointer) { return __is_61.number(pointer.pointerId) ? pointer.pointerId : pointer.identifier; }, setCoords: function setCoords(targetObj, pointers, timeStamp) { var pointer = pointers.length > 1 ? pointerUtils.pointerAverage(pointers) : pointers[0]; var tmpXY = {}; pointerUtils.getPageXY(pointer, tmpXY); targetObj.page.x = tmpXY.x; targetObj.page.y = tmpXY.y; pointerUtils.getClientXY(pointer, tmpXY); targetObj.client.x = tmpXY.x; targetObj.client.y = tmpXY.y; targetObj.timeStamp = timeStamp; }, pointerExtend: _pointerExtend["default"], getTouchPair: function getTouchPair(event) { var touches = []; // array of touches is supplied if (__is_61.array(event)) { touches[0] = event[0]; touches[1] = event[1]; } // an event else { if (event.type === 'touchend') { if (event.touches.length === 1) { touches[0] = event.touches[0]; touches[1] = event.changedTouches[0]; } else if (event.touches.length === 0) { touches[0] = event.changedTouches[0]; touches[1] = event.changedTouches[1]; } } else { touches[0] = event.touches[0]; touches[1] = event.touches[1]; } } return touches; }, pointerAverage: function pointerAverage(pointers) { var average = { pageX: 0, pageY: 0, clientX: 0, clientY: 0, screenX: 0, screenY: 0 }; for (var _i = 0; _i < pointers.length; _i++) { var _ref; _ref = pointers[_i]; var pointer = _ref; for (var _prop in average) { average[_prop] += pointer[_prop]; } } for (var prop in average) { average[prop] /= pointers.length; } return average; }, touchBBox: function touchBBox(event) { if (!event.length && !(event.touches && event.touches.length > 1)) { return null; } var touches = pointerUtils.getTouchPair(event); var minX = Math.min(touches[0].pageX, touches[1].pageX); var minY = Math.min(touches[0].pageY, touches[1].pageY); var maxX = Math.max(touches[0].pageX, touches[1].pageX); var maxY = Math.max(touches[0].pageY, touches[1].pageY); return { x: minX, y: minY, left: minX, top: minY, right: maxX, bottom: maxY, width: maxX - minX, height: maxY - minY }; }, touchDistance: function touchDistance(event, deltaSource) { var sourceX = deltaSource + 'X'; var sourceY = deltaSource + 'Y'; var touches = pointerUtils.getTouchPair(event); var dx = touches[0][sourceX] - touches[1][sourceX]; var dy = touches[0][sourceY] - touches[1][sourceY]; return (0, _hypot["default"])(dx, dy); }, touchAngle: function touchAngle(event, deltaSource) { var sourceX = deltaSource + 'X'; var sourceY = deltaSource + 'Y'; var touches = pointerUtils.getTouchPair(event); var dx = touches[1][sourceX] - touches[0][sourceX]; var dy = touches[1][sourceY] - touches[0][sourceY]; var angle = 180 * Math.atan2(dy, dx) / Math.PI; return angle; }, getPointerType: function getPointerType(pointer) { return __is_61.string(pointer.pointerType) ? pointer.pointerType : __is_61.number(pointer.pointerType) ? [undefined, undefined, 'touch', 'pen', 'mouse'][pointer.pointerType] // if the PointerEvent API isn't available, then the "pointer" must // be either a MouseEvent, TouchEvent, or Touch object : /touch/.test(pointer.type) || pointer instanceof ___domObjects_61["default"].Touch ? 'touch' : 'mouse'; }, // [ event.target, event.currentTarget ] getEventTargets: function getEventTargets(event) { var path = __is_61.func(event.composedPath) ? event.composedPath() : event.path; return [domUtils.getActualElement(path ? path[0] : event.target), domUtils.getActualElement(event.currentTarget)]; }, newCoords: function newCoords() { return { page: { x: 0, y: 0 }, client: { x: 0, y: 0 }, timeStamp: 0 }; }, coordsToEvent: function coordsToEvent(coords) { var event = { coords: coords, get page() { return this.coords.page; }, get client() { return this.coords.client; }, get timeStamp() { return this.coords.timeStamp; }, get pageX() { return this.coords.page.x; }, get pageY() { return this.coords.page.y; }, get clientX() { return this.coords.client.x; }, get clientY() { return this.coords.client.y; }, get pointerId() { return this.coords.pointerId; }, get target() { return this.coords.target; }, get type() { return this.coords.type; }, get pointerType() { return this.coords.pointerType; }, get buttons() { return this.coords.buttons; } }; return event; } }; var ___default_61 = pointerUtils; _$pointerUtils_61["default"] = ___default_61; var _$events_52 = {}; "use strict"; Object.defineProperty(_$events_52, "__esModule", { value: true }); _$events_52["default"] = _$events_52.FakeEvent = void 0; /* removed: var _$arr_47 = require("./arr"); */; var __domUtils_52 = ___interopRequireWildcard_52(_$domUtils_51); var __is_52 = ___interopRequireWildcard_52(_$is_57); var ___pointerExtend_52 = ___interopRequireDefault_52(_$pointerExtend_60); var _pointerUtils = ___interopRequireDefault_52(_$pointerUtils_61); function ___interopRequireDefault_52(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___interopRequireWildcard_52(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } var elements = []; var targets = []; var delegatedEvents = {}; var documents = []; function add(element, type, listener, optionalArg) { var options = getOptions(optionalArg); var elementIndex = elements.indexOf(element); var target = targets[elementIndex]; if (!target) { target = { events: {}, typeCount: 0 }; elementIndex = elements.push(element) - 1; targets.push(target); } if (!target.events[type]) { target.events[type] = []; target.typeCount++; } if (!(0, _$arr_47.contains)(target.events[type], listener)) { element.addEventListener(type, listener, events.supportsOptions ? options : !!options.capture); target.events[type].push(listener); } } function __remove_52(element, type, listener, optionalArg) { var options = getOptions(optionalArg); var elementIndex = elements.indexOf(element); var target = targets[elementIndex]; if (!target || !target.events) { return; } if (type === 'all') { for (type in target.events) { if (target.events.hasOwnProperty(type)) { __remove_52(element, type, 'all'); } } return; } if (target.events[type]) { var len = target.events[type].length; if (listener === 'all') { for (var i = 0; i < len; i++) { __remove_52(element, type, target.events[type][i], options); } return; } else { for (var _i = 0; _i < len; _i++) { if (target.events[type][_i] === listener) { element.removeEventListener(type, listener, events.supportsOptions ? options : !!options.capture); target.events[type].splice(_i, 1); break; } } } if (target.events[type] && target.events[type].length === 0) { target.events[type] = null; target.typeCount--; } } if (!target.typeCount) { targets.splice(elementIndex, 1); elements.splice(elementIndex, 1); } } function addDelegate(selector, context, type, listener, optionalArg) { var options = getOptions(optionalArg); if (!delegatedEvents[type]) { delegatedEvents[type] = { contexts: [], listeners: [], selectors: [] }; // add delegate listener functions for (var _i2 = 0; _i2 < documents.length; _i2++) { var doc = documents[_i2]; add(doc, type, delegateListener); add(doc, type, delegateUseCapture, true); } } var delegated = delegatedEvents[type]; var index; for (index = delegated.selectors.length - 1; index >= 0; index--) { if (delegated.selectors[index] === selector && delegated.contexts[index] === context) { break; } } if (index === -1) { index = delegated.selectors.length; delegated.selectors.push(selector); delegated.contexts.push(context); delegated.listeners.push([]); } // keep listener and capture and passive flags delegated.listeners[index].push([listener, !!options.capture, options.passive]); } function removeDelegate(selector, context, type, listener, optionalArg) { var options = getOptions(optionalArg); var delegated = delegatedEvents[type]; var matchFound = false; var index; if (!delegated) { return; } // count from last index of delegated to 0 for (index = delegated.selectors.length - 1; index >= 0; index--) { // look for matching selector and context Node if (delegated.selectors[index] === selector && delegated.contexts[index] === context) { var listeners = delegated.listeners[index]; // each item of the listeners array is an array: [function, capture, passive] for (var i = listeners.length - 1; i >= 0; i--) { var _listeners$i = _slicedToArray(listeners[i], 3), fn = _listeners$i[0], capture = _listeners$i[1], passive = _listeners$i[2]; // check if the listener functions and capture and passive flags match if (fn === listener && capture === !!options.capture && passive === options.passive) { // remove the listener from the array of listeners listeners.splice(i, 1); // if all listeners for this interactable have been removed // remove the interactable from the delegated arrays if (!listeners.length) { delegated.selectors.splice(index, 1); delegated.contexts.splice(index, 1); delegated.listeners.splice(index, 1); // remove delegate function from context __remove_52(context, type, delegateListener); __remove_52(context, type, delegateUseCapture, true); // remove the arrays if they are empty if (!delegated.selectors.length) { delegatedEvents[type] = null; } } // only remove one listener matchFound = true; break; } } if (matchFound) { break; } } } } // bound to the interactable context when a DOM event // listener is added to a selector interactable function delegateListener(event, optionalArg) { var options = getOptions(optionalArg); var fakeEvent = new FakeEvent(event); var delegated = delegatedEvents[event.type]; var _pointerUtils$getEven = _pointerUtils["default"].getEventTargets(event), _pointerUtils$getEven2 = _slicedToArray(_pointerUtils$getEven, 1), eventTarget = _pointerUtils$getEven2[0]; var element = eventTarget; // climb up document tree looking for selector matches while (__is_52.element(element)) { for (var i = 0; i < delegated.selectors.length; i++) { var selector = delegated.selectors[i]; var context = delegated.contexts[i]; if (__domUtils_52.matchesSelector(element, selector) && __domUtils_52.nodeContains(context, eventTarget) && __domUtils_52.nodeContains(context, element)) { var listeners = delegated.listeners[i]; fakeEvent.currentTarget = element; for (var _i3 = 0; _i3 < listeners.length; _i3++) { var _ref; _ref = listeners[_i3]; var _ref2 = _ref, _ref3 = _slicedToArray(_ref2, 3), fn = _ref3[0], capture = _ref3[1], passive = _ref3[2]; if (capture === !!options.capture && passive === options.passive) { fn(fakeEvent); } } } } element = __domUtils_52.parentNode(element); } } function delegateUseCapture(event) { return delegateListener.call(this, event, true); } function getOptions(param) { return __is_52.object(param) ? param : { capture: param }; } var FakeEvent = /*#__PURE__*/ function () { function FakeEvent(originalEvent) { _classCallCheck(this, FakeEvent); this.originalEvent = originalEvent; // duplicate the event so that currentTarget can be changed (0, ___pointerExtend_52["default"])(this, originalEvent); } _createClass(FakeEvent, [{ key: "preventOriginalDefault", value: function preventOriginalDefault() { this.originalEvent.preventDefault(); } }, { key: "stopPropagation", value: function stopPropagation() { this.originalEvent.stopPropagation(); } }, { key: "stopImmediatePropagation", value: function stopImmediatePropagation() { this.originalEvent.stopImmediatePropagation(); } }]); return FakeEvent; }(); _$events_52.FakeEvent = FakeEvent; var events = { add: add, remove: __remove_52, addDelegate: addDelegate, removeDelegate: removeDelegate, delegateListener: delegateListener, delegateUseCapture: delegateUseCapture, delegatedEvents: delegatedEvents, documents: documents, supportsOptions: false, supportsPassive: false, _elements: elements, _targets: targets, init: function init(window) { window.document.createElement('div').addEventListener('test', null, { get capture() { return events.supportsOptions = true; }, get passive() { return events.supportsPassive = true; } }); } }; var ___default_52 = events; _$events_52["default"] = ___default_52; var _$extend_53 = {}; "use strict"; Object.defineProperty(_$extend_53, "__esModule", { value: true }); _$extend_53["default"] = extend; function extend(dest, source) { for (var prop in source) { dest[prop] = source[prop]; } return dest; } var _$rect_63 = {}; "use strict"; Object.defineProperty(_$rect_63, "__esModule", { value: true }); _$rect_63.getStringOptionResult = getStringOptionResult; _$rect_63.resolveRectLike = resolveRectLike; _$rect_63.rectToXY = rectToXY; _$rect_63.xywhToTlbr = xywhToTlbr; _$rect_63.tlbrToXywh = tlbrToXywh; _$rect_63["default"] = void 0; /* removed: var _$domUtils_51 = require("./domUtils"); */; var _extend = ___interopRequireDefault_63(_$extend_53); var __is_63 = ___interopRequireWildcard_63(_$is_57); function ___interopRequireWildcard_63(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function ___interopRequireDefault_63(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } function getStringOptionResult(value, interactable, element) { if (value === 'parent') { return (0, _$domUtils_51.parentNode)(element); } if (value === 'self') { return interactable.getRect(element); } return (0, _$domUtils_51.closest)(element, value); } function resolveRectLike(value, interactable, element, functionArgs) { if (__is_63.string(value)) { value = getStringOptionResult(value, interactable, element); } else if (__is_63.func(value)) { value = value.apply(void 0, _toConsumableArray(functionArgs)); } if (__is_63.element(value)) { value = (0, _$domUtils_51.getElementRect)(value); } return value; } function rectToXY(rect) { return rect && { x: 'x' in rect ? rect.x : rect.left, y: 'y' in rect ? rect.y : rect.top }; } function xywhToTlbr(rect) { if (rect && !('left' in rect && 'top' in rect)) { rect = (0, _extend["default"])({}, rect); rect.left = rect.x || 0; rect.top = rect.y || 0; rect.right = rect.right || rect.left + rect.width; rect.bottom = rect.bottom || rect.top + rect.height; } return rect; } function tlbrToXywh(rect) { if (rect && !('x' in rect && 'y' in rect)) { rect = (0, _extend["default"])({}, rect); rect.x = rect.left || 0; rect.y = rect.top || 0; rect.width = rect.width || rect.right - rect.x; rect.height = rect.height || rect.bottom - rect.y; } return rect; } var ___default_63 = { getStringOptionResult: getStringOptionResult, resolveRectLike: resolveRectLike, rectToXY: rectToXY, xywhToTlbr: xywhToTlbr, tlbrToXywh: tlbrToXywh }; _$rect_63["default"] = ___default_63; var _$getOriginXY_54 = {}; "use strict"; Object.defineProperty(_$getOriginXY_54, "__esModule", { value: true }); _$getOriginXY_54["default"] = ___default_54; /* removed: var _$rect_63 = require("./rect"); */; function ___default_54(target, element, action) { var actionOptions = target.options[action]; var actionOrigin = actionOptions && actionOptions.origin; var origin = actionOrigin || target.options.origin; var originRect = (0, _$rect_63.resolveRectLike)(origin, target, element, [target && element]); return (0, _$rect_63.rectToXY)(originRect) || { x: 0, y: 0 }; } var _$normalizeListeners_59 = {}; "use strict"; Object.defineProperty(_$normalizeListeners_59, "__esModule", { value: true }); _$normalizeListeners_59["default"] = normalize; var ___extend_59 = ___interopRequireDefault_59(_$extend_53); var __is_59 = ___interopRequireWildcard_59(_$is_57); function ___interopRequireWildcard_59(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function ___interopRequireDefault_59(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function normalize(type, listeners, result) { result = result || {}; if (__is_59.string(type) && type.search(' ') !== -1) { type = split(type); } if (__is_59.array(type)) { return type.reduce(function (acc, t) { return (0, ___extend_59["default"])(acc, normalize(t, listeners, result)); }, result); } // ({ type: fn }) -> ('', { type: fn }) if (__is_59.object(type)) { listeners = type; type = ''; } if (__is_59.func(listeners)) { result[type] = result[type] || []; result[type].push(listeners); } else if (__is_59.array(listeners)) { for (var _i = 0; _i < listeners.length; _i++) { var _ref; _ref = listeners[_i]; var l = _ref; normalize(type, l, result); } } else if (__is_59.object(listeners)) { for (var prefix in listeners) { var combinedTypes = split(prefix).map(function (p) { return "".concat(type).concat(p); }); normalize(combinedTypes, listeners[prefix], result); } } return result; } function split(type) { return type.trim().split(/ +/); } var _$raf_62 = {}; "use strict"; Object.defineProperty(_$raf_62, "__esModule", { value: true }); _$raf_62["default"] = void 0; var lastTime = 0; var _request; var _cancel; function __init_62(window) { _request = window.requestAnimationFrame; _cancel = window.cancelAnimationFrame; if (!_request) { var vendors = ['ms', 'moz', 'webkit', 'o']; for (var _i = 0; _i < vendors.length; _i++) { var vendor = vendors[_i]; _request = window["".concat(vendor, "RequestAnimationFrame")]; _cancel = window["".concat(vendor, "CancelAnimationFrame")] || window["".concat(vendor, "CancelRequestAnimationFrame")]; } } if (!_request) { _request = function request(callback) { var currTime = Date.now(); var timeToCall = Math.max(0, 16 - (currTime - lastTime)); // eslint-disable-next-line standard/no-callback-literal var token = setTimeout(function () { callback(currTime + timeToCall); }, timeToCall); lastTime = currTime + timeToCall; return token; }; _cancel = function cancel(token) { return clearTimeout(token); }; } } var ___default_62 = { request: function request(callback) { return _request(callback); }, cancel: function cancel(token) { return _cancel(token); }, init: __init_62 }; _$raf_62["default"] = ___default_62; var _$Signals_46 = {}; "use strict"; Object.defineProperty(_$Signals_46, "__esModule", { value: true }); _$Signals_46["default"] = void 0; function ___classCallCheck_46(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function ___defineProperties_46(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); } } function ___createClass_46(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_46(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_46(Constructor, staticProps); return Constructor; } var Signals = /*#__PURE__*/ function () { function Signals() { ___classCallCheck_46(this, Signals); this.listeners = {}; } ___createClass_46(Signals, [{ key: "on", value: function on(name, listener) { if (!this.listeners[name]) { this.listeners[name] = [listener]; return; } this.listeners[name].push(listener); } }, { key: "off", value: function off(name, listener) { if (!this.listeners[name]) { return; } var index = this.listeners[name].indexOf(listener); if (index !== -1) { this.listeners[name].splice(index, 1); } } }, { key: "fire", value: function fire(name, arg) { var targetListeners = this.listeners[name]; if (!targetListeners) { return; } for (var _i = 0; _i < targetListeners.length; _i++) { var _ref; _ref = targetListeners[_i]; var listener = _ref; if (listener(arg, name) === false) { return false; } } } }]); return Signals; }(); var ___default_46 = Signals; _$Signals_46["default"] = ___default_46; var _$utils_56 = {}; "use strict"; Object.defineProperty(_$utils_56, "__esModule", { value: true }); _$utils_56.warnOnce = warnOnce; _$utils_56._getQBezierValue = _getQBezierValue; _$utils_56.getQuadraticCurvePoint = getQuadraticCurvePoint; _$utils_56.easeOutQuad = easeOutQuad; _$utils_56.copyAction = copyAction; Object.defineProperty(_$utils_56, "win", { enumerable: true, get: function get() { return ___window_56["default"]; } }); Object.defineProperty(_$utils_56, "browser", { enumerable: true, get: function get() { return ___browser_56["default"]; } }); Object.defineProperty(_$utils_56, "clone", { enumerable: true, get: function get() { return _clone["default"]; } }); Object.defineProperty(_$utils_56, "events", { enumerable: true, get: function get() { return _events["default"]; } }); Object.defineProperty(_$utils_56, "extend", { enumerable: true, get: function get() { return ___extend_56["default"]; } }); Object.defineProperty(_$utils_56, "getOriginXY", { enumerable: true, get: function get() { return _getOriginXY["default"]; } }); Object.defineProperty(_$utils_56, "hypot", { enumerable: true, get: function get() { return ___hypot_56["default"]; } }); Object.defineProperty(_$utils_56, "normalizeListeners", { enumerable: true, get: function get() { return _normalizeListeners["default"]; } }); Object.defineProperty(_$utils_56, "pointer", { enumerable: true, get: function get() { return ___pointerUtils_56["default"]; } }); Object.defineProperty(_$utils_56, "raf", { enumerable: true, get: function get() { return _raf["default"]; } }); Object.defineProperty(_$utils_56, "rect", { enumerable: true, get: function get() { return ___rect_56["default"]; } }); Object.defineProperty(_$utils_56, "Signals", { enumerable: true, get: function get() { return _Signals["default"]; } }); _$utils_56.is = _$utils_56.dom = _$utils_56.arr = void 0; var __arr_56 = ___interopRequireWildcard_56(_$arr_47); _$utils_56.arr = __arr_56; var dom = ___interopRequireWildcard_56(_$domUtils_51); _$utils_56.dom = dom; var __is_56 = ___interopRequireWildcard_56(_$is_57); _$utils_56.is = __is_56; var ___window_56 = ___interopRequireDefault_56(_$window_66); var ___browser_56 = ___interopRequireDefault_56(_$browser_48); var _clone = ___interopRequireDefault_56(_$clone_49); var _events = ___interopRequireDefault_56(_$events_52); var ___extend_56 = ___interopRequireDefault_56(_$extend_53); var _getOriginXY = ___interopRequireDefault_56(_$getOriginXY_54); var ___hypot_56 = ___interopRequireDefault_56(_$hypot_55); var _normalizeListeners = ___interopRequireDefault_56(_$normalizeListeners_59); var ___pointerUtils_56 = ___interopRequireDefault_56(_$pointerUtils_61); var _raf = ___interopRequireDefault_56(_$raf_62); var ___rect_56 = ___interopRequireDefault_56(_$rect_63); var _Signals = ___interopRequireDefault_56(_$Signals_46); function ___interopRequireDefault_56(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___interopRequireWildcard_56(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function warnOnce(method, message) { var warned = false; // eslint-disable-next-line no-shadow return function () { if (!warned) { ___window_56["default"].window.console.warn(message); warned = true; } return method.apply(this, arguments); }; } // http://stackoverflow.com/a/5634528/2280888 function _getQBezierValue(t, p1, p2, p3) { var iT = 1 - t; return iT * iT * p1 + 2 * iT * t * p2 + t * t * p3; } function getQuadraticCurvePoint(startX, startY, cpX, cpY, endX, endY, position) { return { x: _getQBezierValue(position, startX, cpX, endX), y: _getQBezierValue(position, startY, cpY, endY) }; } // http://gizma.com/easing/ function easeOutQuad(t, b, c, d) { t /= d; return -c * t * (t - 2) + b; } function copyAction(dest, src) { dest.name = src.name; dest.axis = src.axis; dest.edges = src.edges; return dest; } var _$defaultOptions_20 = {}; "use strict"; Object.defineProperty(_$defaultOptions_20, "__esModule", { value: true }); _$defaultOptions_20["default"] = _$defaultOptions_20.defaults = void 0; // tslint:disable no-empty-interface var defaults = { base: { preventDefault: 'auto', deltaSource: 'page' }, perAction: { enabled: false, origin: { x: 0, y: 0 } }, actions: {} }; _$defaultOptions_20.defaults = defaults; var ___default_20 = defaults; _$defaultOptions_20["default"] = ___default_20; var _$Eventable_14 = {}; "use strict"; Object.defineProperty(_$Eventable_14, "__esModule", { value: true }); _$Eventable_14["default"] = void 0; var __arr_14 = ___interopRequireWildcard_14(_$arr_47); var ___extend_14 = ___interopRequireDefault_14(_$extend_53); var ___normalizeListeners_14 = ___interopRequireDefault_14(_$normalizeListeners_59); function ___interopRequireDefault_14(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___interopRequireWildcard_14(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function ___classCallCheck_14(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function ___defineProperties_14(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); } } function ___createClass_14(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_14(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_14(Constructor, staticProps); return Constructor; } function fireUntilImmediateStopped(event, listeners) { for (var _i = 0; _i < listeners.length; _i++) { var _ref; _ref = listeners[_i]; var listener = _ref; if (event.immediatePropagationStopped) { break; } listener(event); } } var Eventable = /*#__PURE__*/ function () { function Eventable(options) { ___classCallCheck_14(this, Eventable); this.types = {}; this.propagationStopped = false; this.immediatePropagationStopped = false; this.options = (0, ___extend_14["default"])({}, options || {}); } ___createClass_14(Eventable, [{ key: "fire", value: function fire(event) { var listeners; var global = this.global; // Interactable#on() listeners // tslint:disable no-conditional-assignment if (listeners = this.types[event.type]) { fireUntilImmediateStopped(event, listeners); } // interact.on() listeners if (!event.propagationStopped && global && (listeners = global[event.type])) { fireUntilImmediateStopped(event, listeners); } } }, { key: "on", value: function on(type, listener) { var listeners = (0, ___normalizeListeners_14["default"])(type, listener); for (type in listeners) { this.types[type] = __arr_14.merge(this.types[type] || [], listeners[type]); } } }, { key: "off", value: function off(type, listener) { var listeners = (0, ___normalizeListeners_14["default"])(type, listener); for (type in listeners) { var eventList = this.types[type]; if (!eventList || !eventList.length) { continue; } for (var _i2 = 0; _i2 < listeners[type].length; _i2++) { var _ref2; _ref2 = listeners[type][_i2]; var subListener = _ref2; var index = eventList.indexOf(subListener); if (index !== -1) { eventList.splice(index, 1); } } } } }]); return Eventable; }(); var ___default_14 = Eventable; _$Eventable_14["default"] = ___default_14; var _$Interactable_16 = {}; "use strict"; Object.defineProperty(_$Interactable_16, "__esModule", { value: true }); _$Interactable_16["default"] = _$Interactable_16.Interactable = void 0; var __arr_16 = ___interopRequireWildcard_16(_$arr_47); var ___browser_16 = ___interopRequireDefault_16(_$browser_48); var ___clone_16 = ___interopRequireDefault_16(_$clone_49); /* removed: var _$domUtils_51 = require("@interactjs/utils/domUtils"); */; var ___events_16 = ___interopRequireDefault_16(_$events_52); var ___extend_16 = ___interopRequireDefault_16(_$extend_53); var __is_16 = ___interopRequireWildcard_16(_$is_57); var ___normalizeListeners_16 = ___interopRequireDefault_16(_$normalizeListeners_59); /* removed: var _$window_66 = require("@interactjs/utils/window"); */; var _Eventable = ___interopRequireDefault_16(_$Eventable_14); function ___interopRequireDefault_16(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___interopRequireWildcard_16(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function ___classCallCheck_16(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function ___defineProperties_16(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); } } function ___createClass_16(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_16(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_16(Constructor, staticProps); return Constructor; } /** */ var Interactable = /*#__PURE__*/ function () { /** */ function Interactable(target, options, defaultContext) { ___classCallCheck_16(this, Interactable); this.events = new _Eventable["default"](); this._actions = options.actions; this.target = target; this._context = options.context || defaultContext; this._win = (0, _$window_66.getWindow)((0, _$domUtils_51.trySelector)(target) ? this._context : target); this._doc = this._win.document; this.set(options); } ___createClass_16(Interactable, [{ key: "setOnEvents", value: function setOnEvents(actionName, phases) { if (__is_16.func(phases.onstart)) { this.on("".concat(actionName, "start"), phases.onstart); } if (__is_16.func(phases.onmove)) { this.on("".concat(actionName, "move"), phases.onmove); } if (__is_16.func(phases.onend)) { this.on("".concat(actionName, "end"), phases.onend); } if (__is_16.func(phases.oninertiastart)) { this.on("".concat(actionName, "inertiastart"), phases.oninertiastart); } return this; } }, { key: "updatePerActionListeners", value: function updatePerActionListeners(actionName, prev, cur) { if (__is_16.array(prev) || __is_16.object(prev)) { this.off(actionName, prev); } if (__is_16.array(cur) || __is_16.object(cur)) { this.on(actionName, cur); } } }, { key: "setPerAction", value: function setPerAction(actionName, options) { var defaults = this._defaults; // for all the default per-action options for (var optionName in options) { var actionOptions = this.options[actionName]; var optionValue = options[optionName]; var isArray = __is_16.array(optionValue); // remove old event listeners and add new ones if (optionName === 'listeners') { this.updatePerActionListeners(actionName, actionOptions.listeners, optionValue); } // if the option value is an array if (isArray) { actionOptions[optionName] = __arr_16.from(optionValue); } // if the option value is an object else if (!isArray && __is_16.plainObject(optionValue)) { // copy the object actionOptions[optionName] = (0, ___extend_16["default"])(actionOptions[optionName] || {}, (0, ___clone_16["default"])(optionValue)); // set anabled field to true if it exists in the defaults if (__is_16.object(defaults.perAction[optionName]) && 'enabled' in defaults.perAction[optionName]) { actionOptions[optionName].enabled = optionValue.enabled !== false; } } // if the option value is a boolean and the default is an object else if (__is_16.bool(optionValue) && __is_16.object(defaults.perAction[optionName])) { actionOptions[optionName].enabled = optionValue; } // if it's anything else, do a plain assignment else { actionOptions[optionName] = optionValue; } } } /** * The default function to get an Interactables bounding rect. Can be * overridden using {@link Interactable.rectChecker}. * * @param {Element} [element] The element to measure. * @return {object} The object's bounding rectangle. */ }, { key: "getRect", value: function getRect(element) { element = element || (__is_16.element(this.target) ? this.target : null); if (__is_16.string(this.target)) { element = element || this._context.querySelector(this.target); } return (0, _$domUtils_51.getElementRect)(element); } /** * Returns or sets the function used to calculate the interactable's * element's rectangle * * @param {function} [checker] A function which returns this Interactable's * bounding rectangle. See {@link Interactable.getRect} * @return {function | object} The checker function or this Interactable */ }, { key: "rectChecker", value: function rectChecker(checker) { if (__is_16.func(checker)) { this.getRect = checker; return this; } if (checker === null) { delete this.getRect; return this; } return this.getRect; } }, { key: "_backCompatOption", value: function _backCompatOption(optionName, newValue) { if ((0, _$domUtils_51.trySelector)(newValue) || __is_16.object(newValue)) { this.options[optionName] = newValue; for (var _i = 0; _i < this._actions.names.length; _i++) { var _ref; _ref = this._actions.names[_i]; var action = _ref; this.options[action][optionName] = newValue; } return this; } return this.options[optionName]; } /** * Gets or sets the origin of the Interactable's element. The x and y * of the origin will be subtracted from action event coordinates. * * @param {Element | object | string} [origin] An HTML or SVG Element whose * rect will be used, an object eg. { x: 0, y: 0 } or string 'parent', 'self' * or any CSS selector * * @return {object} The current origin or this Interactable */ }, { key: "origin", value: function origin(newValue) { return this._backCompatOption('origin', newValue); } /** * Returns or sets the mouse coordinate types used to calculate the * movement of the pointer. * * @param {string} [newValue] Use 'client' if you will be scrolling while * interacting; Use 'page' if you want autoScroll to work * @return {string | object} The current deltaSource or this Interactable */ }, { key: "deltaSource", value: function deltaSource(newValue) { if (newValue === 'page' || newValue === 'client') { this.options.deltaSource = newValue; return this; } return this.options.deltaSource; } /** * Gets the selector context Node of the Interactable. The default is * `window.document`. * * @return {Node} The context Node of this Interactable */ }, { key: "context", value: function context() { return this._context; } }, { key: "inContext", value: function inContext(element) { return this._context === element.ownerDocument || (0, _$domUtils_51.nodeContains)(this._context, element); } }, { key: "testIgnoreAllow", value: function testIgnoreAllow(options, targetNode, eventTarget) { return !this.testIgnore(options.ignoreFrom, targetNode, eventTarget) && this.testAllow(options.allowFrom, targetNode, eventTarget); } }, { key: "testAllow", value: function testAllow(allowFrom, targetNode, element) { if (!allowFrom) { return true; } if (!__is_16.element(element)) { return false; } if (__is_16.string(allowFrom)) { return (0, _$domUtils_51.matchesUpTo)(element, allowFrom, targetNode); } else if (__is_16.element(allowFrom)) { return (0, _$domUtils_51.nodeContains)(allowFrom, element); } return false; } }, { key: "testIgnore", value: function testIgnore(ignoreFrom, targetNode, element) { if (!ignoreFrom || !__is_16.element(element)) { return false; } if (__is_16.string(ignoreFrom)) { return (0, _$domUtils_51.matchesUpTo)(element, ignoreFrom, targetNode); } else if (__is_16.element(ignoreFrom)) { return (0, _$domUtils_51.nodeContains)(ignoreFrom, element); } return false; } /** * Calls listeners for the given InteractEvent type bound globally * and directly to this Interactable * * @param {InteractEvent} iEvent The InteractEvent object to be fired on this * Interactable * @return {Interactable} this Interactable */ }, { key: "fire", value: function fire(iEvent) { this.events.fire(iEvent); return this; } }, { key: "_onOff", value: function _onOff(method, typeArg, listenerArg, options) { if (__is_16.object(typeArg) && !__is_16.array(typeArg)) { options = listenerArg; listenerArg = null; } var addRemove = method === 'on' ? 'add' : 'remove'; var listeners = (0, ___normalizeListeners_16["default"])(typeArg, listenerArg); for (var type in listeners) { if (type === 'wheel') { type = ___browser_16["default"].wheelEvent; } for (var _i2 = 0; _i2 < listeners[type].length; _i2++) { var _ref2; _ref2 = listeners[type][_i2]; var listener = _ref2; // if it is an action event type if (__arr_16.contains(this._actions.eventTypes, type)) { this.events[method](type, listener); } // delegated event else if (__is_16.string(this.target)) { ___events_16["default"]["".concat(addRemove, "Delegate")](this.target, this._context, type, listener, options); } // remove listener from this Interatable's element else { ___events_16["default"][addRemove](this.target, type, listener, options); } } } return this; } /** * Binds a listener for an InteractEvent, pointerEvent or DOM event. * * @param {string | array | object} types The types of events to listen * for * @param {function | array | object} [listener] The event listener function(s) * @param {object | boolean} [options] options object or useCapture flag for * addEventListener * @return {Interactable} This Interactable */ }, { key: "on", value: function on(types, listener, options) { return this._onOff('on', types, listener, options); } /** * Removes an InteractEvent, pointerEvent or DOM event listener. * * @param {string | array | object} types The types of events that were * listened for * @param {function | array | object} [listener] The event listener function(s) * @param {object | boolean} [options] options object or useCapture flag for * removeEventListener * @return {Interactable} This Interactable */ }, { key: "off", value: function off(types, listener, options) { return this._onOff('off', types, listener, options); } /** * Reset the options of this Interactable * * @param {object} options The new settings to apply * @return {object} This Interactable */ }, { key: "set", value: function set(options) { var defaults = this._defaults; if (!__is_16.object(options)) { options = {}; } this.options = (0, ___clone_16["default"])(defaults.base); for (var actionName in this._actions.methodDict) { var methodName = this._actions.methodDict[actionName]; this.options[actionName] = {}; this.setPerAction(actionName, (0, ___extend_16["default"])((0, ___extend_16["default"])({}, defaults.perAction), defaults.actions[actionName])); this[methodName](options[actionName]); } for (var setting in options) { if (__is_16.func(this[setting])) { this[setting](options[setting]); } } return this; } /** * Remove this interactable from the list of interactables and remove it's * action capabilities and event listeners * * @return {interact} */ }, { key: "unset", value: function unset() { ___events_16["default"].remove(this.target, 'all'); if (__is_16.string(this.target)) { // remove delegated events for (var type in ___events_16["default"].delegatedEvents) { var delegated = ___events_16["default"].delegatedEvents[type]; if (delegated.selectors[0] === this.target && delegated.contexts[0] === this._context) { delegated.selectors.splice(0, 1); delegated.contexts.splice(0, 1); delegated.listeners.splice(0, 1); // remove the arrays if they are empty if (!delegated.selectors.length) { delegated[type] = null; } } ___events_16["default"].remove(this._context, type, ___events_16["default"].delegateListener); ___events_16["default"].remove(this._context, type, ___events_16["default"].delegateUseCapture, true); } } else { ___events_16["default"].remove(this.target, 'all'); } } }, { key: "_defaults", get: function get() { return { base: {}, perAction: {}, actions: {} }; } }]); return Interactable; }(); _$Interactable_16.Interactable = Interactable; var ___default_16 = Interactable; _$Interactable_16["default"] = ___default_16; var _$InteractableSet_17 = {}; "use strict"; Object.defineProperty(_$InteractableSet_17, "__esModule", { value: true }); _$InteractableSet_17["default"] = void 0; var __arr_17 = ___interopRequireWildcard_17(_$arr_47); var __domUtils_17 = ___interopRequireWildcard_17(_$domUtils_51); var ___extend_17 = ___interopRequireDefault_17(_$extend_53); var __is_17 = ___interopRequireWildcard_17(_$is_57); var ___Signals_17 = ___interopRequireDefault_17(_$Signals_46); function ___interopRequireDefault_17(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___interopRequireWildcard_17(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function ___classCallCheck_17(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function ___defineProperties_17(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); } } function ___createClass_17(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_17(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_17(Constructor, staticProps); return Constructor; } var InteractableSet = /*#__PURE__*/ function () { function InteractableSet(scope) { var _this = this; ___classCallCheck_17(this, InteractableSet); this.scope = scope; this.signals = new ___Signals_17["default"](); // all set interactables this.list = []; this.selectorMap = {}; this.signals.on('unset', function (_ref) { var interactable = _ref.interactable; var target = interactable.target, context = interactable._context; var targetMappings = __is_17.string(target) ? _this.selectorMap[target] : target[_this.scope.id]; var targetIndex = targetMappings.findIndex(function (m) { return m.context === context; }); if (targetMappings[targetIndex]) { // Destroying mappingInfo's context and interactable targetMappings[targetIndex].context = null; targetMappings[targetIndex].interactable = null; } targetMappings.splice(targetIndex, 1); }); } ___createClass_17(InteractableSet, [{ key: "new", value: function _new(target, options) { options = (0, ___extend_17["default"])(options || {}, { actions: this.scope.actions }); var interactable = new this.scope.Interactable(target, options, this.scope.document); var mappingInfo = { context: interactable._context, interactable: interactable }; this.scope.addDocument(interactable._doc); this.list.push(interactable); if (__is_17.string(target)) { if (!this.selectorMap[target]) { this.selectorMap[target] = []; } this.selectorMap[target].push(mappingInfo); } else { if (!interactable.target[this.scope.id]) { Object.defineProperty(target, this.scope.id, { value: [], configurable: true }); } target[this.scope.id].push(mappingInfo); } this.signals.fire('new', { target: target, options: options, interactable: interactable, win: this.scope._win }); return interactable; } }, { key: "get", value: function get(target, options) { var context = options && options.context || this.scope.document; var isSelector = __is_17.string(target); var targetMappings = isSelector ? this.selectorMap[target] : target[this.scope.id]; if (!targetMappings) { return null; } var found = __arr_17.find(targetMappings, function (m) { return m.context === context && (isSelector || m.interactable.inContext(target)); }); return found && found.interactable; } }, { key: "forEachMatch", value: function forEachMatch(node, callback) { for (var _i = 0; _i < this.list.length; _i++) { var _ref2; _ref2 = this.list[_i]; var interactable = _ref2; var ret = void 0; if ((__is_17.string(interactable.target) // target is a selector and the element matches ? __is_17.element(node) && __domUtils_17.matchesSelector(node, interactable.target) : // target is the element node === interactable.target) && // the element is in context interactable.inContext(node)) { ret = callback(interactable); } if (ret !== undefined) { return ret; } } } }]); return InteractableSet; }(); _$InteractableSet_17["default"] = InteractableSet; var _$BaseEvent_13 = {}; "use strict"; Object.defineProperty(_$BaseEvent_13, "__esModule", { value: true }); _$BaseEvent_13["default"] = _$BaseEvent_13.BaseEvent = _$BaseEvent_13.EventPhase = void 0; function ___classCallCheck_13(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function ___defineProperties_13(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); } } function ___createClass_13(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_13(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_13(Constructor, staticProps); return Constructor; } var EventPhase; _$BaseEvent_13.EventPhase = EventPhase; (function (EventPhase) { EventPhase["Start"] = "start"; EventPhase["Move"] = "move"; EventPhase["End"] = "end"; EventPhase["_NONE"] = ""; })(EventPhase || (_$BaseEvent_13.EventPhase = EventPhase = {})); var BaseEvent = /*#__PURE__*/ function () { function BaseEvent(interaction) { ___classCallCheck_13(this, BaseEvent); this.immediatePropagationStopped = false; this.propagationStopped = false; this._interaction = interaction; } ___createClass_13(BaseEvent, [{ key: "preventDefault", value: function preventDefault() {} /** * Don't call any other listeners (even on the current target) */ }, { key: "stopPropagation", value: function stopPropagation() { this.propagationStopped = true; } /** * Don't call listeners on the remaining targets */ }, { key: "stopImmediatePropagation", value: function stopImmediatePropagation() { this.immediatePropagationStopped = this.propagationStopped = true; } }, { key: "interaction", get: function get() { return this._interaction._proxy; } }]); return BaseEvent; }(); _$BaseEvent_13.BaseEvent = BaseEvent; var ___default_13 = BaseEvent; _$BaseEvent_13["default"] = ___default_13; var _$InteractEvent_15 = {}; "use strict"; Object.defineProperty(_$InteractEvent_15, "__esModule", { value: true }); _$InteractEvent_15["default"] = _$InteractEvent_15.InteractEvent = _$InteractEvent_15.EventPhase = void 0; var ___extend_15 = ___interopRequireDefault_15(_$extend_53); var ___getOriginXY_15 = ___interopRequireDefault_15(_$getOriginXY_54); var ___hypot_15 = ___interopRequireDefault_15(_$hypot_55); var _BaseEvent2 = ___interopRequireDefault_15(_$BaseEvent_13); var _defaultOptions = ___interopRequireDefault_15(_$defaultOptions_20); function ___interopRequireDefault_15(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___typeof_15(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_15 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_15 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_15(obj); } function ___classCallCheck_15(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function ___defineProperties_15(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); } } function ___createClass_15(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_15(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_15(Constructor, staticProps); return Constructor; } function _possibleConstructorReturn(self, call) { if (call && (___typeof_15(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var __EventPhase_15; _$InteractEvent_15.EventPhase = __EventPhase_15; (function (EventPhase) { EventPhase["Start"] = "start"; EventPhase["Move"] = "move"; EventPhase["End"] = "end"; EventPhase["_NONE"] = ""; })(__EventPhase_15 || (_$InteractEvent_15.EventPhase = __EventPhase_15 = {})); var InteractEvent = /*#__PURE__*/ function (_BaseEvent) { _inherits(InteractEvent, _BaseEvent); /** */ function InteractEvent(interaction, event, actionName, phase, element, related, preEnd, type) { var _this; ___classCallCheck_15(this, InteractEvent); _this = _possibleConstructorReturn(this, _getPrototypeOf(InteractEvent).call(this, interaction)); element = element || interaction.element; var target = interaction.interactable; var deltaSource = (target && target.options || _defaultOptions["default"]).deltaSource; var origin = (0, ___getOriginXY_15["default"])(target, element, actionName); var starting = phase === 'start'; var ending = phase === 'end'; var prevEvent = starting ? _assertThisInitialized(_this) : interaction.prevEvent; var coords = starting ? interaction.coords.start : ending ? { page: prevEvent.page, client: prevEvent.client, timeStamp: interaction.coords.cur.timeStamp } : interaction.coords.cur; _this.page = (0, ___extend_15["default"])({}, coords.page); _this.client = (0, ___extend_15["default"])({}, coords.client); _this.rect = (0, ___extend_15["default"])({}, interaction.rect); _this.timeStamp = coords.timeStamp; if (!ending) { _this.page.x -= origin.x; _this.page.y -= origin.y; _this.client.x -= origin.x; _this.client.y -= origin.y; } _this.ctrlKey = event.ctrlKey; _this.altKey = event.altKey; _this.shiftKey = event.shiftKey; _this.metaKey = event.metaKey; _this.button = event.button; _this.buttons = event.buttons; _this.target = element; _this.currentTarget = element; _this.relatedTarget = related || null; _this.preEnd = preEnd; _this.type = type || actionName + (phase || ''); _this.interactable = target; _this.t0 = starting ? interaction.pointers[interaction.pointers.length - 1].downTime : prevEvent.t0; _this.x0 = interaction.coords.start.page.x - origin.x; _this.y0 = interaction.coords.start.page.y - origin.y; _this.clientX0 = interaction.coords.start.client.x - origin.x; _this.clientY0 = interaction.coords.start.client.y - origin.y; if (starting || ending) { _this.delta = { x: 0, y: 0 }; } else { _this.delta = { x: _this[deltaSource].x - prevEvent[deltaSource].x, y: _this[deltaSource].y - prevEvent[deltaSource].y }; } _this.dt = interaction.coords.delta.timeStamp; _this.duration = _this.timeStamp - _this.t0; // velocity and speed in pixels per second _this.velocity = (0, ___extend_15["default"])({}, interaction.coords.velocity[deltaSource]); _this.speed = (0, ___hypot_15["default"])(_this.velocity.x, _this.velocity.y); _this.swipe = ending || phase === 'inertiastart' ? _this.getSwipe() : null; return _this; } ___createClass_15(InteractEvent, [{ key: "getSwipe", value: function getSwipe() { var interaction = this._interaction; if (interaction.prevEvent.speed < 600 || this.timeStamp - interaction.prevEvent.timeStamp > 150) { return null; } var angle = 180 * Math.atan2(interaction.prevEvent.velocityY, interaction.prevEvent.velocityX) / Math.PI; var overlap = 22.5; if (angle < 0) { angle += 360; } var left = 135 - overlap <= angle && angle < 225 + overlap; var up = 225 - overlap <= angle && angle < 315 + overlap; var right = !left && (315 - overlap <= angle || angle < 45 + overlap); var down = !up && 45 - overlap <= angle && angle < 135 + overlap; return { up: up, down: down, left: left, right: right, angle: angle, speed: interaction.prevEvent.speed, velocity: { x: interaction.prevEvent.velocityX, y: interaction.prevEvent.velocityY } }; } }, { key: "preventDefault", value: function preventDefault() {} /** * Don't call listeners on the remaining targets */ }, { key: "stopImmediatePropagation", value: function stopImmediatePropagation() { this.immediatePropagationStopped = this.propagationStopped = true; } /** * Don't call any other listeners (even on the current target) */ }, { key: "stopPropagation", value: function stopPropagation() { this.propagationStopped = true; } }, { key: "pageX", get: function get() { return this.page.x; }, set: function set(value) { this.page.x = value; } }, { key: "pageY", get: function get() { return this.page.y; }, set: function set(value) { this.page.y = value; } }, { key: "clientX", get: function get() { return this.client.x; }, set: function set(value) { this.client.x = value; } }, { key: "clientY", get: function get() { return this.client.y; }, set: function set(value) { this.client.y = value; } }, { key: "dx", get: function get() { return this.delta.x; }, set: function set(value) { this.delta.x = value; } }, { key: "dy", get: function get() { return this.delta.y; }, set: function set(value) { this.delta.y = value; } }, { key: "velocityX", get: function get() { return this.velocity.x; }, set: function set(value) { this.velocity.x = value; } }, { key: "velocityY", get: function get() { return this.velocity.y; }, set: function set(value) { this.velocity.y = value; } }]); return InteractEvent; }(_BaseEvent2["default"]); _$InteractEvent_15.InteractEvent = InteractEvent; var ___default_15 = InteractEvent; _$InteractEvent_15["default"] = ___default_15; var _$PointerInfo_19 = {}; "use strict"; Object.defineProperty(_$PointerInfo_19, "__esModule", { value: true }); _$PointerInfo_19["default"] = _$PointerInfo_19.PointerInfo = void 0; function ___classCallCheck_19(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /* eslint-disable @typescript-eslint/no-parameter-properties */ var PointerInfo = function PointerInfo(id, pointer, event, downTime, downTarget) { ___classCallCheck_19(this, PointerInfo); this.id = id; this.pointer = pointer; this.event = event; this.downTime = downTime; this.downTarget = downTarget; }; _$PointerInfo_19.PointerInfo = PointerInfo; var ___default_19 = PointerInfo; _$PointerInfo_19["default"] = ___default_19; var _$interactionFinder_22 = {}; "use strict"; Object.defineProperty(_$interactionFinder_22, "__esModule", { value: true }); _$interactionFinder_22["default"] = void 0; var __dom_22 = ___interopRequireWildcard_22(_$domUtils_51); function ___interopRequireWildcard_22(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } var finder = { methodOrder: ['simulationResume', 'mouseOrPen', 'hasPointer', 'idle'], search: function search(details) { for (var _i = 0; _i < finder.methodOrder.length; _i++) { var _ref; _ref = finder.methodOrder[_i]; var method = _ref; var interaction = finder[method](details); if (interaction) { return interaction; } } }, // try to resume simulation with a new pointer simulationResume: function simulationResume(_ref2) { var pointerType = _ref2.pointerType, eventType = _ref2.eventType, eventTarget = _ref2.eventTarget, scope = _ref2.scope; if (!/down|start/i.test(eventType)) { return null; } for (var _i2 = 0; _i2 < scope.interactions.list.length; _i2++) { var _ref3; _ref3 = scope.interactions.list[_i2]; var interaction = _ref3; var element = eventTarget; if (interaction.simulation && interaction.simulation.allowResume && interaction.pointerType === pointerType) { while (element) { // if the element is the interaction element if (element === interaction.element) { return interaction; } element = __dom_22.parentNode(element); } } } return null; }, // if it's a mouse or pen interaction mouseOrPen: function mouseOrPen(_ref4) { var pointerId = _ref4.pointerId, pointerType = _ref4.pointerType, eventType = _ref4.eventType, scope = _ref4.scope; if (pointerType !== 'mouse' && pointerType !== 'pen') { return null; } var firstNonActive; for (var _i3 = 0; _i3 < scope.interactions.list.length; _i3++) { var _ref5; _ref5 = scope.interactions.list[_i3]; var interaction = _ref5; if (interaction.pointerType === pointerType) { // if it's a down event, skip interactions with running simulations if (interaction.simulation && !hasPointerId(interaction, pointerId)) { continue; } // if the interaction is active, return it immediately if (interaction.interacting()) { return interaction; } // otherwise save it and look for another active interaction else if (!firstNonActive) { firstNonActive = interaction; } } } // if no active mouse interaction was found use the first inactive mouse // interaction if (firstNonActive) { return firstNonActive; } // find any mouse or pen interaction. // ignore the interaction if the eventType is a *down, and a simulation // is active for (var _i4 = 0; _i4 < scope.interactions.list.length; _i4++) { var _ref6; _ref6 = scope.interactions.list[_i4]; var _interaction = _ref6; if (_interaction.pointerType === pointerType && !(/down/i.test(eventType) && _interaction.simulation)) { return _interaction; } } return null; }, // get interaction that has this pointer hasPointer: function hasPointer(_ref7) { var pointerId = _ref7.pointerId, scope = _ref7.scope; for (var _i5 = 0; _i5 < scope.interactions.list.length; _i5++) { var _ref8; _ref8 = scope.interactions.list[_i5]; var interaction = _ref8; if (hasPointerId(interaction, pointerId)) { return interaction; } } return null; }, // get first idle interaction with a matching pointerType idle: function idle(_ref9) { var pointerType = _ref9.pointerType, scope = _ref9.scope; for (var _i6 = 0; _i6 < scope.interactions.list.length; _i6++) { var _ref10; _ref10 = scope.interactions.list[_i6]; var interaction = _ref10; // if there's already a pointer held down if (interaction.pointers.length === 1) { var target = interaction.interactable; // don't add this pointer if there is a target interactable and it // isn't gesturable if (target && !(target.options.gesture && target.options.gesture.enabled)) { continue; } } // maximum of 2 pointers per interaction else if (interaction.pointers.length >= 2) { continue; } if (!interaction.interacting() && pointerType === interaction.pointerType) { return interaction; } } return null; } }; function hasPointerId(interaction, pointerId) { return interaction.pointers.some(function (_ref11) { var id = _ref11.id; return id === pointerId; }); } var ___default_22 = finder; _$interactionFinder_22["default"] = ___default_22; var _$drag_1 = {}; "use strict"; Object.defineProperty(_$drag_1, "__esModule", { value: true }); _$drag_1["default"] = void 0; var ___scope_1 = _$scope_24({}); var __arr_1 = ___interopRequireWildcard_1(_$arr_47); var __is_1 = ___interopRequireWildcard_1(_$is_57); function ___interopRequireWildcard_1(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } ___scope_1.ActionName.Drag = 'drag'; function __install_1(scope) { var actions = scope.actions, Interactable = scope.Interactable, interactions = scope.interactions, defaults = scope.defaults; interactions.signals.on('before-action-move', beforeMove); interactions.signals.on('action-resume', beforeMove); // dragmove interactions.signals.on('action-move', move); Interactable.prototype.draggable = drag.draggable; actions[___scope_1.ActionName.Drag] = drag; actions.names.push(___scope_1.ActionName.Drag); __arr_1.merge(actions.eventTypes, ['dragstart', 'dragmove', 'draginertiastart', 'dragresume', 'dragend']); actions.methodDict.drag = 'draggable'; defaults.actions.drag = drag.defaults; } function beforeMove(_ref) { var interaction = _ref.interaction; if (interaction.prepared.name !== 'drag') { return; } var axis = interaction.prepared.axis; if (axis === 'x') { interaction.coords.cur.page.y = interaction.coords.start.page.y; interaction.coords.cur.client.y = interaction.coords.start.client.y; interaction.coords.velocity.client.y = 0; interaction.coords.velocity.page.y = 0; } else if (axis === 'y') { interaction.coords.cur.page.x = interaction.coords.start.page.x; interaction.coords.cur.client.x = interaction.coords.start.client.x; interaction.coords.velocity.client.x = 0; interaction.coords.velocity.page.x = 0; } } function move(_ref2) { var iEvent = _ref2.iEvent, interaction = _ref2.interaction; if (interaction.prepared.name !== 'drag') { return; } var axis = interaction.prepared.axis; if (axis === 'x' || axis === 'y') { var opposite = axis === 'x' ? 'y' : 'x'; iEvent.page[opposite] = interaction.coords.start.page[opposite]; iEvent.client[opposite] = interaction.coords.start.client[opposite]; iEvent.delta[opposite] = 0; } } /** * ```js * interact(element).draggable({ * onstart: function (event) {}, * onmove : function (event) {}, * onend : function (event) {}, * * // the axis in which the first movement must be * // for the drag sequence to start * // 'xy' by default - any direction * startAxis: 'x' || 'y' || 'xy', * * // 'xy' by default - don't restrict to one axis (move in any direction) * // 'x' or 'y' to restrict movement to either axis * // 'start' to restrict movement to the axis the drag started in * lockAxis: 'x' || 'y' || 'xy' || 'start', * * // max number of drags that can happen concurrently * // with elements of this Interactable. Infinity by default * max: Infinity, * * // max number of drags that can target the same element+Interactable * // 1 by default * maxPerElement: 2 * }) * * var isDraggable = interact('element').draggable(); // true * ``` * * Get or set whether drag actions can be performed on the target * * @alias Interactable.prototype.draggable * * @param {boolean | object} [options] true/false or An object with event * listeners to be fired on drag events (object makes the Interactable * draggable) * @return {boolean | Interactable} boolean indicating if this can be the * target of drag events, or this Interctable */ var draggable = function draggable(options) { if (__is_1.object(options)) { this.options.drag.enabled = options.enabled !== false; this.setPerAction('drag', options); this.setOnEvents('drag', options); if (/^(xy|x|y|start)$/.test(options.lockAxis)) { this.options.drag.lockAxis = options.lockAxis; } if (/^(xy|x|y)$/.test(options.startAxis)) { this.options.drag.startAxis = options.startAxis; } return this; } if (__is_1.bool(options)) { this.options.drag.enabled = options; return this; } return this.options.drag; }; var drag = { id: 'actions/drag', install: __install_1, draggable: draggable, beforeMove: beforeMove, move: move, defaults: { startAxis: 'xy', lockAxis: 'xy' }, checker: function checker(_pointer, _event, interactable) { var dragOptions = interactable.options.drag; return dragOptions.enabled ? { name: 'drag', axis: dragOptions.lockAxis === 'start' ? dragOptions.startAxis : dragOptions.lockAxis } : null; }, getCursor: function getCursor() { return 'move'; } }; var ___default_1 = drag; _$drag_1["default"] = ___default_1; var _$DropEvent_2 = {}; "use strict"; Object.defineProperty(_$DropEvent_2, "__esModule", { value: true }); _$DropEvent_2["default"] = void 0; var ___BaseEvent2_2 = ___interopRequireDefault_2(_$BaseEvent_13); var __arr_2 = ___interopRequireWildcard_2(_$arr_47); function ___interopRequireWildcard_2(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function ___interopRequireDefault_2(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___typeof_2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_2 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_2 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_2(obj); } function ___toConsumableArray_2(arr) { return ___arrayWithoutHoles_2(arr) || ___iterableToArray_2(arr) || ___nonIterableSpread_2(); } function ___nonIterableSpread_2() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } function ___iterableToArray_2(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } function ___arrayWithoutHoles_2(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } function ___classCallCheck_2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function ___defineProperties_2(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); } } function ___createClass_2(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_2(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_2(Constructor, staticProps); return Constructor; } function ___possibleConstructorReturn_2(self, call) { if (call && (___typeof_2(call) === "object" || typeof call === "function")) { return call; } return ___assertThisInitialized_2(self); } function ___assertThisInitialized_2(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function ___getPrototypeOf_2(o) { ___getPrototypeOf_2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ___getPrototypeOf_2(o); } function ___inherits_2(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ___setPrototypeOf_2(subClass, superClass); } function ___setPrototypeOf_2(o, p) { ___setPrototypeOf_2 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ___setPrototypeOf_2(o, p); } var DropEvent = /*#__PURE__*/ function (_BaseEvent) { ___inherits_2(DropEvent, _BaseEvent); /** * Class of events fired on dropzones during drags with acceptable targets. */ function DropEvent(dropState, dragEvent, type) { var _this; ___classCallCheck_2(this, DropEvent); _this = ___possibleConstructorReturn_2(this, ___getPrototypeOf_2(DropEvent).call(this, dragEvent._interaction)); _this.propagationStopped = false; _this.immediatePropagationStopped = false; var _ref = type === 'dragleave' ? dropState.prev : dropState.cur, element = _ref.element, dropzone = _ref.dropzone; _this.type = type; _this.target = element; _this.currentTarget = element; _this.dropzone = dropzone; _this.dragEvent = dragEvent; _this.relatedTarget = dragEvent.target; _this.draggable = dragEvent.interactable; _this.timeStamp = dragEvent.timeStamp; return _this; } /** * If this is a `dropactivate` event, the dropzone element will be * deactivated. * * If this is a `dragmove` or `dragenter`, a `dragleave` will be fired on the * dropzone element and more. */ ___createClass_2(DropEvent, [{ key: "reject", value: function reject() { var _this2 = this; var dropState = this._interaction.dropState; if (this.type !== 'dropactivate' && (!this.dropzone || dropState.cur.dropzone !== this.dropzone || dropState.cur.element !== this.target)) { return; } dropState.prev.dropzone = this.dropzone; dropState.prev.element = this.target; dropState.rejected = true; dropState.events.enter = null; this.stopImmediatePropagation(); if (this.type === 'dropactivate') { var activeDrops = dropState.activeDrops; var index = __arr_2.findIndex(activeDrops, function (_ref2) { var dropzone = _ref2.dropzone, element = _ref2.element; return dropzone === _this2.dropzone && element === _this2.target; }); dropState.activeDrops = [].concat(___toConsumableArray_2(activeDrops.slice(0, index)), ___toConsumableArray_2(activeDrops.slice(index + 1))); var deactivateEvent = new DropEvent(dropState, this.dragEvent, 'dropdeactivate'); deactivateEvent.dropzone = this.dropzone; deactivateEvent.target = this.target; this.dropzone.fire(deactivateEvent); } else { this.dropzone.fire(new DropEvent(dropState, this.dragEvent, 'dragleave')); } } }, { key: "preventDefault", value: function preventDefault() {} }, { key: "stopPropagation", value: function stopPropagation() { this.propagationStopped = true; } }, { key: "stopImmediatePropagation", value: function stopImmediatePropagation() { this.immediatePropagationStopped = this.propagationStopped = true; } }]); return DropEvent; }(___BaseEvent2_2["default"]); var ___default_2 = DropEvent; _$DropEvent_2["default"] = ___default_2; var _$drop_3 = {}; "use strict"; Object.defineProperty(_$drop_3, "__esModule", { value: true }); _$drop_3["default"] = void 0; var __utils_3 = ___interopRequireWildcard_3(_$utils_56); var _drag = ___interopRequireDefault_3(_$drag_1); var _DropEvent = ___interopRequireDefault_3(_$DropEvent_2); function ___interopRequireDefault_3(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___interopRequireWildcard_3(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function __install_3(scope) { var actions = scope.actions, interact = scope.interact, Interactable = scope.Interactable, interactions = scope.interactions, defaults = scope.defaults; scope.usePlugin(_drag["default"]); interactions.signals.on('before-action-start', function (_ref) { var interaction = _ref.interaction; if (interaction.prepared.name !== 'drag') { return; } interaction.dropState = { cur: { dropzone: null, element: null }, prev: { dropzone: null, element: null }, rejected: null, events: null, activeDrops: null }; }); interactions.signals.on('after-action-start', function (_ref2) { var interaction = _ref2.interaction, event = _ref2.event, dragEvent = _ref2.iEvent; if (interaction.prepared.name !== 'drag') { return; } var dropState = interaction.dropState; // reset active dropzones dropState.activeDrops = null; dropState.events = null; dropState.activeDrops = getActiveDrops(scope, interaction.element); dropState.events = getDropEvents(interaction, event, dragEvent); if (dropState.events.activate) { fireActivationEvents(dropState.activeDrops, dropState.events.activate); } }); // FIXME proper signal types interactions.signals.on('action-move', function (arg) { return onEventCreated(arg, scope); }); interactions.signals.on('action-end', function (arg) { return onEventCreated(arg, scope); }); interactions.signals.on('after-action-move', function (_ref3) { var interaction = _ref3.interaction; if (interaction.prepared.name !== 'drag') { return; } fireDropEvents(interaction, interaction.dropState.events); interaction.dropState.events = {}; }); interactions.signals.on('after-action-end', function (_ref4) { var interaction = _ref4.interaction; if (interaction.prepared.name !== 'drag') { return; } fireDropEvents(interaction, interaction.dropState.events); }); interactions.signals.on('stop', function (_ref5) { var interaction = _ref5.interaction; if (interaction.prepared.name !== 'drag') { return; } var dropState = interaction.dropState; if (dropState) { dropState.activeDrops = null; dropState.events = null; dropState.cur.dropzone = null; dropState.cur.element = null; dropState.prev.dropzone = null; dropState.prev.element = null; dropState.rejected = false; } }); /** * * ```js * interact('.drop').dropzone({ * accept: '.can-drop' || document.getElementById('single-drop'), * overlap: 'pointer' || 'center' || zeroToOne * } * ``` * * Returns or sets whether draggables can be dropped onto this target to * trigger drop events * * Dropzones can receive the following events: * - `dropactivate` and `dropdeactivate` when an acceptable drag starts and ends * - `dragenter` and `dragleave` when a draggable enters and leaves the dropzone * - `dragmove` when a draggable that has entered the dropzone is moved * - `drop` when a draggable is dropped into this dropzone * * Use the `accept` option to allow only elements that match the given CSS * selector or element. The value can be: * * - **an Element** - only that element can be dropped into this dropzone. * - **a string**, - the element being dragged must match it as a CSS selector. * - **`null`** - accept options is cleared - it accepts any element. * * Use the `overlap` option to set how drops are checked for. The allowed * values are: * * - `'pointer'`, the pointer must be over the dropzone (default) * - `'center'`, the draggable element's center must be over the dropzone * - a number from 0-1 which is the `(intersection area) / (draggable area)`. * e.g. `0.5` for drop to happen when half of the area of the draggable is * over the dropzone * * Use the `checker` option to specify a function to check if a dragged element * is over this Interactable. * * @param {boolean | object | null} [options] The new options to be set. * @return {boolean | Interactable} The current setting or this Interactable */ Interactable.prototype.dropzone = function (options) { return dropzoneMethod(this, options); }; /** * ```js * interact(target) * .dropChecker(function(dragEvent, // related dragmove or dragend event * event, // TouchEvent/PointerEvent/MouseEvent * dropped, // bool result of the default checker * dropzone, // dropzone Interactable * dropElement, // dropzone elemnt * draggable, // draggable Interactable * draggableElement) {// draggable element * * return dropped && event.target.hasAttribute('allow-drop') * } * ``` */ Interactable.prototype.dropCheck = function (dragEvent, event, draggable, draggableElement, dropElement, rect) { return dropCheckMethod(this, dragEvent, event, draggable, draggableElement, dropElement, rect); }; /** * Returns or sets whether the dimensions of dropzone elements are calculated * on every dragmove or only on dragstart for the default dropChecker * * @param {boolean} [newValue] True to check on each move. False to check only * before start * @return {boolean | interact} The current setting or interact */ interact.dynamicDrop = function (newValue) { if (__utils_3.is.bool(newValue)) { // if (dragging && scope.dynamicDrop !== newValue && !newValue) { // calcRects(dropzones) // } scope.dynamicDrop = newValue; return interact; } return scope.dynamicDrop; }; __utils_3.arr.merge(actions.eventTypes, ['dragenter', 'dragleave', 'dropactivate', 'dropdeactivate', 'dropmove', 'drop']); actions.methodDict.drop = 'dropzone'; scope.dynamicDrop = false; defaults.actions.drop = drop.defaults; } function collectDrops(_ref6, draggableElement) { var interactables = _ref6.interactables; var drops = []; // collect all dropzones and their elements which qualify for a drop for (var _i = 0; _i < interactables.list.length; _i++) { var _ref7; _ref7 = interactables.list[_i]; var dropzone = _ref7; if (!dropzone.options.drop.enabled) { continue; } var accept = dropzone.options.drop.accept; // test the draggable draggableElement against the dropzone's accept setting if (__utils_3.is.element(accept) && accept !== draggableElement || __utils_3.is.string(accept) && !__utils_3.dom.matchesSelector(draggableElement, accept) || __utils_3.is.func(accept) && !accept({ dropzone: dropzone, draggableElement: draggableElement })) { continue; } // query for new elements if necessary var dropElements = __utils_3.is.string(dropzone.target) ? dropzone._context.querySelectorAll(dropzone.target) : __utils_3.is.array(dropzone.target) ? dropzone.target : [dropzone.target]; for (var _i2 = 0; _i2 < dropElements.length; _i2++) { var _ref8; _ref8 = dropElements[_i2]; var dropzoneElement = _ref8; if (dropzoneElement !== draggableElement) { drops.push({ dropzone: dropzone, element: dropzoneElement }); } } } return drops; } function fireActivationEvents(activeDrops, event) { // loop through all active dropzones and trigger event for (var _i3 = 0; _i3 < activeDrops.length; _i3++) { var _ref9; _ref9 = activeDrops[_i3]; var _ref10 = _ref9, dropzone = _ref10.dropzone, element = _ref10.element; event.dropzone = dropzone; // set current element as event target event.target = element; dropzone.fire(event); event.propagationStopped = event.immediatePropagationStopped = false; } } // return a new array of possible drops. getActiveDrops should always be // called when a drag has just started or a drag event happens while // dynamicDrop is true function getActiveDrops(scope, dragElement) { // get dropzones and their elements that could receive the draggable var activeDrops = collectDrops(scope, dragElement); for (var _i4 = 0; _i4 < activeDrops.length; _i4++) { var _ref11; _ref11 = activeDrops[_i4]; var activeDrop = _ref11; activeDrop.rect = activeDrop.dropzone.getRect(activeDrop.element); } return activeDrops; } function getDrop(_ref12, dragEvent, pointerEvent) { var dropState = _ref12.dropState, draggable = _ref12.interactable, dragElement = _ref12.element; var validDrops = []; // collect all dropzones and their elements which qualify for a drop for (var _i5 = 0; _i5 < dropState.activeDrops.length; _i5++) { var _ref13; _ref13 = dropState.activeDrops[_i5]; var _ref14 = _ref13, dropzone = _ref14.dropzone, dropzoneElement = _ref14.element, rect = _ref14.rect; validDrops.push(dropzone.dropCheck(dragEvent, pointerEvent, draggable, dragElement, dropzoneElement, rect) ? dropzoneElement : null); } // get the most appropriate dropzone based on DOM depth and order var dropIndex = __utils_3.dom.indexOfDeepestElement(validDrops); return dropState.activeDrops[dropIndex] || null; } function getDropEvents(interaction, _pointerEvent, dragEvent) { var dropState = interaction.dropState; var dropEvents = { enter: null, leave: null, activate: null, deactivate: null, move: null, drop: null }; if (dragEvent.type === 'dragstart') { dropEvents.activate = new _DropEvent["default"](dropState, dragEvent, 'dropactivate'); dropEvents.activate.target = null; dropEvents.activate.dropzone = null; } if (dragEvent.type === 'dragend') { dropEvents.deactivate = new _DropEvent["default"](dropState, dragEvent, 'dropdeactivate'); dropEvents.deactivate.target = null; dropEvents.deactivate.dropzone = null; } if (dropState.rejected) { return dropEvents; } if (dropState.cur.element !== dropState.prev.element) { // if there was a previous dropzone, create a dragleave event if (dropState.prev.dropzone) { dropEvents.leave = new _DropEvent["default"](dropState, dragEvent, 'dragleave'); dragEvent.dragLeave = dropEvents.leave.target = dropState.prev.element; dragEvent.prevDropzone = dropEvents.leave.dropzone = dropState.prev.dropzone; } // if dropzone is not null, create a dragenter event if (dropState.cur.dropzone) { dropEvents.enter = new _DropEvent["default"](dropState, dragEvent, 'dragenter'); dragEvent.dragEnter = dropState.cur.element; dragEvent.dropzone = dropState.cur.dropzone; } } if (dragEvent.type === 'dragend' && dropState.cur.dropzone) { dropEvents.drop = new _DropEvent["default"](dropState, dragEvent, 'drop'); dragEvent.dropzone = dropState.cur.dropzone; dragEvent.relatedTarget = dropState.cur.element; } if (dragEvent.type === 'dragmove' && dropState.cur.dropzone) { dropEvents.move = new _DropEvent["default"](dropState, dragEvent, 'dropmove'); dropEvents.move.dragmove = dragEvent; dragEvent.dropzone = dropState.cur.dropzone; } return dropEvents; } function fireDropEvents(interaction, events) { var dropState = interaction.dropState; var activeDrops = dropState.activeDrops, cur = dropState.cur, prev = dropState.prev; if (events.leave) { prev.dropzone.fire(events.leave); } if (events.move) { cur.dropzone.fire(events.move); } if (events.enter) { cur.dropzone.fire(events.enter); } if (events.drop) { cur.dropzone.fire(events.drop); } if (events.deactivate) { fireActivationEvents(activeDrops, events.deactivate); } dropState.prev.dropzone = cur.dropzone; dropState.prev.element = cur.element; } function onEventCreated(_ref15, scope) { var interaction = _ref15.interaction, iEvent = _ref15.iEvent, event = _ref15.event; if (iEvent.type !== 'dragmove' && iEvent.type !== 'dragend') { return; } var dropState = interaction.dropState; if (scope.dynamicDrop) { dropState.activeDrops = getActiveDrops(scope, interaction.element); } var dragEvent = iEvent; var dropResult = getDrop(interaction, dragEvent, event); // update rejected status dropState.rejected = dropState.rejected && !!dropResult && dropResult.dropzone === dropState.cur.dropzone && dropResult.element === dropState.cur.element; dropState.cur.dropzone = dropResult && dropResult.dropzone; dropState.cur.element = dropResult && dropResult.element; dropState.events = getDropEvents(interaction, event, dragEvent); } function dropzoneMethod(interactable, options) { if (__utils_3.is.object(options)) { interactable.options.drop.enabled = options.enabled !== false; if (options.listeners) { var normalized = __utils_3.normalizeListeners(options.listeners); // rename 'drop' to '' as it will be prefixed with 'drop' var corrected = Object.keys(normalized).reduce(function (acc, type) { var correctedType = /^(enter|leave)/.test(type) ? "drag".concat(type) : /^(activate|deactivate|move)/.test(type) ? "drop".concat(type) : type; acc[correctedType] = normalized[type]; return acc; }, {}); interactable.off(interactable.options.drop.listeners); interactable.on(corrected); interactable.options.drop.listeners = corrected; } if (__utils_3.is.func(options.ondrop)) { interactable.on('drop', options.ondrop); } if (__utils_3.is.func(options.ondropactivate)) { interactable.on('dropactivate', options.ondropactivate); } if (__utils_3.is.func(options.ondropdeactivate)) { interactable.on('dropdeactivate', options.ondropdeactivate); } if (__utils_3.is.func(options.ondragenter)) { interactable.on('dragenter', options.ondragenter); } if (__utils_3.is.func(options.ondragleave)) { interactable.on('dragleave', options.ondragleave); } if (__utils_3.is.func(options.ondropmove)) { interactable.on('dropmove', options.ondropmove); } if (/^(pointer|center)$/.test(options.overlap)) { interactable.options.drop.overlap = options.overlap; } else if (__utils_3.is.number(options.overlap)) { interactable.options.drop.overlap = Math.max(Math.min(1, options.overlap), 0); } if ('accept' in options) { interactable.options.drop.accept = options.accept; } if ('checker' in options) { interactable.options.drop.checker = options.checker; } return interactable; } if (__utils_3.is.bool(options)) { interactable.options.drop.enabled = options; return interactable; } return interactable.options.drop; } function dropCheckMethod(interactable, dragEvent, event, draggable, draggableElement, dropElement, rect) { var dropped = false; // if the dropzone has no rect (eg. display: none) // call the custom dropChecker or just return false if (!(rect = rect || interactable.getRect(dropElement))) { return interactable.options.drop.checker ? interactable.options.drop.checker(dragEvent, event, dropped, interactable, dropElement, draggable, draggableElement) : false; } var dropOverlap = interactable.options.drop.overlap; if (dropOverlap === 'pointer') { var origin = __utils_3.getOriginXY(draggable, draggableElement, 'drag'); var page = __utils_3.pointer.getPageXY(dragEvent); page.x += origin.x; page.y += origin.y; var horizontal = page.x > rect.left && page.x < rect.right; var vertical = page.y > rect.top && page.y < rect.bottom; dropped = horizontal && vertical; } var dragRect = draggable.getRect(draggableElement); if (dragRect && dropOverlap === 'center') { var cx = dragRect.left + dragRect.width / 2; var cy = dragRect.top + dragRect.height / 2; dropped = cx >= rect.left && cx <= rect.right && cy >= rect.top && cy <= rect.bottom; } if (dragRect && __utils_3.is.number(dropOverlap)) { var overlapArea = Math.max(0, Math.min(rect.right, dragRect.right) - Math.max(rect.left, dragRect.left)) * Math.max(0, Math.min(rect.bottom, dragRect.bottom) - Math.max(rect.top, dragRect.top)); var overlapRatio = overlapArea / (dragRect.width * dragRect.height); dropped = overlapRatio >= dropOverlap; } if (interactable.options.drop.checker) { dropped = interactable.options.drop.checker(dragEvent, event, dropped, interactable, dropElement, draggable, draggableElement); } return dropped; } var drop = { id: 'actions/drop', install: __install_3, getActiveDrops: getActiveDrops, getDrop: getDrop, getDropEvents: getDropEvents, fireDropEvents: fireDropEvents, defaults: { enabled: false, accept: null, overlap: 'pointer' } }; var ___default_3 = drop; _$drop_3["default"] = ___default_3; var _$gesture_4 = {}; "use strict"; Object.defineProperty(_$gesture_4, "__esModule", { value: true }); _$gesture_4["default"] = void 0; var ___InteractEvent_4 = ___interopRequireDefault_4(_$InteractEvent_15); var ___scope_4 = _$scope_24({}); var __utils_4 = ___interopRequireWildcard_4(_$utils_56); function ___interopRequireWildcard_4(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function ___interopRequireDefault_4(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } ___scope_4.ActionName.Gesture = 'gesture'; function __install_4(scope) { var actions = scope.actions, Interactable = scope.Interactable, interactions = scope.interactions, defaults = scope.defaults; /** * ```js * interact(element).gesturable({ * onstart: function (event) {}, * onmove : function (event) {}, * onend : function (event) {}, * * // limit multiple gestures. * // See the explanation in {@link Interactable.draggable} example * max: Infinity, * maxPerElement: 1, * }) * * var isGestureable = interact(element).gesturable() * ``` * * Gets or sets whether multitouch gestures can be performed on the target * * @param {boolean | object} [options] true/false or An object with event * listeners to be fired on gesture events (makes the Interactable gesturable) * @return {boolean | Interactable} A boolean indicating if this can be the * target of gesture events, or this Interactable */ Interactable.prototype.gesturable = function (options) { if (__utils_4.is.object(options)) { this.options.gesture.enabled = options.enabled !== false; this.setPerAction('gesture', options); this.setOnEvents('gesture', options); return this; } if (__utils_4.is.bool(options)) { this.options.gesture.enabled = options; return this; } return this.options.gesture; }; interactions.signals.on('action-start', updateGestureProps); interactions.signals.on('action-move', updateGestureProps); interactions.signals.on('action-end', updateGestureProps); interactions.signals.on('new', function (_ref) { var interaction = _ref.interaction; interaction.gesture = { angle: 0, distance: 0, scale: 1, startAngle: 0, startDistance: 0 }; }); actions[___scope_4.ActionName.Gesture] = gesture; actions.names.push(___scope_4.ActionName.Gesture); __utils_4.arr.merge(actions.eventTypes, ['gesturestart', 'gesturemove', 'gestureend']); actions.methodDict.gesture = 'gesturable'; defaults.actions.gesture = gesture.defaults; } var gesture = { id: 'actions/gesture', install: __install_4, defaults: {}, checker: function checker(_pointer, _event, _interactable, _element, interaction) { if (interaction.pointers.length >= 2) { return { name: 'gesture' }; } return null; }, getCursor: function getCursor() { return ''; } }; function updateGestureProps(_ref2) { var interaction = _ref2.interaction, iEvent = _ref2.iEvent, event = _ref2.event, phase = _ref2.phase; if (interaction.prepared.name !== 'gesture') { return; } var pointers = interaction.pointers.map(function (p) { return p.pointer; }); var starting = phase === 'start'; var ending = phase === 'end'; var deltaSource = interaction.interactable.options.deltaSource; iEvent.touches = [pointers[0], pointers[1]]; if (starting) { iEvent.distance = __utils_4.pointer.touchDistance(pointers, deltaSource); iEvent.box = __utils_4.pointer.touchBBox(pointers); iEvent.scale = 1; iEvent.ds = 0; iEvent.angle = __utils_4.pointer.touchAngle(pointers, deltaSource); iEvent.da = 0; interaction.gesture.startDistance = iEvent.distance; interaction.gesture.startAngle = iEvent.angle; } else if (ending || event instanceof ___InteractEvent_4["default"]) { var prevEvent = interaction.prevEvent; iEvent.distance = prevEvent.distance; iEvent.box = prevEvent.box; iEvent.scale = prevEvent.scale; iEvent.ds = 0; iEvent.angle = prevEvent.angle; iEvent.da = 0; } else { iEvent.distance = __utils_4.pointer.touchDistance(pointers, deltaSource); iEvent.box = __utils_4.pointer.touchBBox(pointers); iEvent.scale = iEvent.distance / interaction.gesture.startDistance; iEvent.angle = __utils_4.pointer.touchAngle(pointers, deltaSource); iEvent.ds = iEvent.scale - interaction.gesture.scale; iEvent.da = iEvent.angle - interaction.gesture.angle; } interaction.gesture.distance = iEvent.distance; interaction.gesture.angle = iEvent.angle; if (__utils_4.is.number(iEvent.scale) && iEvent.scale !== Infinity && !isNaN(iEvent.scale)) { interaction.gesture.scale = iEvent.scale; } } var ___default_4 = gesture; _$gesture_4["default"] = ___default_4; var _$resize_6 = {}; "use strict"; Object.defineProperty(_$resize_6, "__esModule", { value: true }); _$resize_6["default"] = void 0; var ___scope_6 = _$scope_24({}); var __arr_6 = ___interopRequireWildcard_6(_$arr_47); var __dom_6 = ___interopRequireWildcard_6(_$domUtils_51); var ___extend_6 = ___interopRequireDefault_6(_$extend_53); var __is_6 = ___interopRequireWildcard_6(_$is_57); function ___interopRequireDefault_6(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___interopRequireWildcard_6(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } ___scope_6.ActionName.Resize = 'resize'; function __install_6(scope) { var actions = scope.actions, browser = scope.browser, Interactable = scope.Interactable, interactions = scope.interactions, defaults = scope.defaults; // Less Precision with touch input interactions.signals.on('new', function (interaction) { interaction.resizeAxes = 'xy'; }); interactions.signals.on('action-start', start); interactions.signals.on('action-move', __move_6); interactions.signals.on('action-start', updateEventAxes); interactions.signals.on('action-move', updateEventAxes); resize.cursors = initCursors(browser); resize.defaultMargin = browser.supportsTouch || browser.supportsPointerEvent ? 20 : 10; /** * ```js * interact(element).resizable({ * onstart: function (event) {}, * onmove : function (event) {}, * onend : function (event) {}, * * edges: { * top : true, // Use pointer coords to check for resize. * left : false, // Disable resizing from left edge. * bottom: '.resize-s',// Resize if pointer target matches selector * right : handleEl // Resize if pointer target is the given Element * }, * * // Width and height can be adjusted independently. When `true`, width and * // height are adjusted at a 1:1 ratio. * square: false, * * // Width and height can be adjusted independently. When `true`, width and * // height maintain the aspect ratio they had when resizing started. * preserveAspectRatio: false, * * // a value of 'none' will limit the resize rect to a minimum of 0x0 * // 'negate' will allow the rect to have negative width/height * // 'reposition' will keep the width/height positive by swapping * // the top and bottom edges and/or swapping the left and right edges * invert: 'none' || 'negate' || 'reposition' * * // limit multiple resizes. * // See the explanation in the {@link Interactable.draggable} example * max: Infinity, * maxPerElement: 1, * }) * * var isResizeable = interact(element).resizable() * ``` * * Gets or sets whether resize actions can be performed on the target * * @param {boolean | object} [options] true/false or An object with event * listeners to be fired on resize events (object makes the Interactable * resizable) * @return {boolean | Interactable} A boolean indicating if this can be the * target of resize elements, or this Interactable */ Interactable.prototype.resizable = function (options) { return resizable(this, options, scope); }; actions[___scope_6.ActionName.Resize] = resize; actions.names.push(___scope_6.ActionName.Resize); __arr_6.merge(actions.eventTypes, ['resizestart', 'resizemove', 'resizeinertiastart', 'resizeresume', 'resizeend']); actions.methodDict.resize = 'resizable'; defaults.actions.resize = resize.defaults; } var resize = { id: 'actions/resize', install: __install_6, defaults: { square: false, preserveAspectRatio: false, axis: 'xy', // use default margin margin: NaN, // object with props left, right, top, bottom which are // true/false values to resize when the pointer is over that edge, // CSS selectors to match the handles for each direction // or the Elements for each handle edges: null, // a value of 'none' will limit the resize rect to a minimum of 0x0 // 'negate' will alow the rect to have negative width/height // 'reposition' will keep the width/height positive by swapping // the top and bottom edges and/or swapping the left and right edges invert: 'none' }, checker: function checker(_pointer, _event, interactable, element, interaction, rect) { if (!rect) { return null; } var page = (0, ___extend_6["default"])({}, interaction.coords.cur.page); var options = interactable.options; if (options.resize.enabled) { var resizeOptions = options.resize; var resizeEdges = { left: false, right: false, top: false, bottom: false }; // if using resize.edges if (__is_6.object(resizeOptions.edges)) { for (var edge in resizeEdges) { resizeEdges[edge] = checkResizeEdge(edge, resizeOptions.edges[edge], page, interaction._latestPointer.eventTarget, element, rect, resizeOptions.margin || this.defaultMargin); } resizeEdges.left = resizeEdges.left && !resizeEdges.right; resizeEdges.top = resizeEdges.top && !resizeEdges.bottom; if (resizeEdges.left || resizeEdges.right || resizeEdges.top || resizeEdges.bottom) { return { name: 'resize', edges: resizeEdges }; } } else { var right = options.resize.axis !== 'y' && page.x > rect.right - this.defaultMargin; var bottom = options.resize.axis !== 'x' && page.y > rect.bottom - this.defaultMargin; if (right || bottom) { return { name: 'resize', axes: (right ? 'x' : '') + (bottom ? 'y' : '') }; } } } return null; }, cursors: null, getCursor: function getCursor(_ref) { var edges = _ref.edges, axis = _ref.axis, name = _ref.name; var cursors = resize.cursors; var result = null; if (axis) { result = cursors[name + axis]; } else if (edges) { var cursorKey = ''; var _arr = ['top', 'bottom', 'left', 'right']; for (var _i = 0; _i < _arr.length; _i++) { var edge = _arr[_i]; if (edges[edge]) { cursorKey += edge; } } result = cursors[cursorKey]; } return result; }, defaultMargin: null }; function resizable(interactable, options, scope) { if (__is_6.object(options)) { interactable.options.resize.enabled = options.enabled !== false; interactable.setPerAction('resize', options); interactable.setOnEvents('resize', options); if (__is_6.string(options.axis) && /^x$|^y$|^xy$/.test(options.axis)) { interactable.options.resize.axis = options.axis; } else if (options.axis === null) { interactable.options.resize.axis = scope.defaults.actions.resize.axis; } if (__is_6.bool(options.preserveAspectRatio)) { interactable.options.resize.preserveAspectRatio = options.preserveAspectRatio; } else if (__is_6.bool(options.square)) { interactable.options.resize.square = options.square; } return interactable; } if (__is_6.bool(options)) { interactable.options.resize.enabled = options; return interactable; } return interactable.options.resize; } function checkResizeEdge(name, value, page, element, interactableElement, rect, margin) { // false, '', undefined, null if (!value) { return false; } // true value, use pointer coords and element rect if (value === true) { // if dimensions are negative, "switch" edges var width = __is_6.number(rect.width) ? rect.width : rect.right - rect.left; var height = __is_6.number(rect.height) ? rect.height : rect.bottom - rect.top; // don't use margin greater than half the relevent dimension margin = Math.min(margin, (name === 'left' || name === 'right' ? width : height) / 2); if (width < 0) { if (name === 'left') { name = 'right'; } else if (name === 'right') { name = 'left'; } } if (height < 0) { if (name === 'top') { name = 'bottom'; } else if (name === 'bottom') { name = 'top'; } } if (name === 'left') { return page.x < (width >= 0 ? rect.left : rect.right) + margin; } if (name === 'top') { return page.y < (height >= 0 ? rect.top : rect.bottom) + margin; } if (name === 'right') { return page.x > (width >= 0 ? rect.right : rect.left) - margin; } if (name === 'bottom') { return page.y > (height >= 0 ? rect.bottom : rect.top) - margin; } } // the remaining checks require an element if (!__is_6.element(element)) { return false; } return __is_6.element(value) // the value is an element to use as a resize handle ? value === element // otherwise check if element matches value as selector : __dom_6.matchesUpTo(element, value, interactableElement); } function initCursors(browser) { return browser.isIe9 ? { x: 'e-resize', y: 's-resize', xy: 'se-resize', top: 'n-resize', left: 'w-resize', bottom: 's-resize', right: 'e-resize', topleft: 'se-resize', bottomright: 'se-resize', topright: 'ne-resize', bottomleft: 'ne-resize' } : { x: 'ew-resize', y: 'ns-resize', xy: 'nwse-resize', top: 'ns-resize', left: 'ew-resize', bottom: 'ns-resize', right: 'ew-resize', topleft: 'nwse-resize', bottomright: 'nwse-resize', topright: 'nesw-resize', bottomleft: 'nesw-resize' }; } function start(_ref2) { var iEvent = _ref2.iEvent, interaction = _ref2.interaction; if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { return; } var startRect = interaction.rect; var resizeOptions = interaction.interactable.options.resize; /* * When using the `resizable.square` or `resizable.preserveAspectRatio` options, resizing from one edge * will affect another. E.g. with `resizable.square`, resizing to make the right edge larger will make * the bottom edge larger by the same amount. We call these 'linked' edges. Any linked edges will depend * on the active edges and the edge being interacted with. */ if (resizeOptions.square || resizeOptions.preserveAspectRatio) { var linkedEdges = (0, ___extend_6["default"])({}, interaction.prepared.edges); linkedEdges.top = linkedEdges.top || linkedEdges.left && !linkedEdges.bottom; linkedEdges.left = linkedEdges.left || linkedEdges.top && !linkedEdges.right; linkedEdges.bottom = linkedEdges.bottom || linkedEdges.right && !linkedEdges.top; linkedEdges.right = linkedEdges.right || linkedEdges.bottom && !linkedEdges.left; interaction.prepared._linkedEdges = linkedEdges; } else { interaction.prepared._linkedEdges = null; } // if using `resizable.preserveAspectRatio` option, record aspect ratio at the start of the resize if (resizeOptions.preserveAspectRatio) { interaction.resizeStartAspectRatio = startRect.width / startRect.height; } interaction.resizeRects = { start: startRect, current: (0, ___extend_6["default"])({}, startRect), inverted: (0, ___extend_6["default"])({}, startRect), previous: (0, ___extend_6["default"])({}, startRect), delta: { left: 0, right: 0, width: 0, top: 0, bottom: 0, height: 0 } }; iEvent.rect = interaction.resizeRects.inverted; iEvent.deltaRect = interaction.resizeRects.delta; } function __move_6(_ref3) { var iEvent = _ref3.iEvent, interaction = _ref3.interaction; if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { return; } var resizeOptions = interaction.interactable.options.resize; var invert = resizeOptions.invert; var invertible = invert === 'reposition' || invert === 'negate'; var edges = interaction.prepared.edges; // eslint-disable-next-line no-shadow var start = interaction.resizeRects.start; var current = interaction.resizeRects.current; var inverted = interaction.resizeRects.inverted; var deltaRect = interaction.resizeRects.delta; var previous = (0, ___extend_6["default"])(interaction.resizeRects.previous, inverted); var originalEdges = edges; var eventDelta = (0, ___extend_6["default"])({}, iEvent.delta); if (resizeOptions.preserveAspectRatio || resizeOptions.square) { // `resize.preserveAspectRatio` takes precedence over `resize.square` var startAspectRatio = resizeOptions.preserveAspectRatio ? interaction.resizeStartAspectRatio : 1; edges = interaction.prepared._linkedEdges; if (originalEdges.left && originalEdges.bottom || originalEdges.right && originalEdges.top) { eventDelta.y = -eventDelta.x / startAspectRatio; } else if (originalEdges.left || originalEdges.right) { eventDelta.y = eventDelta.x / startAspectRatio; } else if (originalEdges.top || originalEdges.bottom) { eventDelta.x = eventDelta.y * startAspectRatio; } } // update the 'current' rect without modifications if (edges.top) { current.top += eventDelta.y; } if (edges.bottom) { current.bottom += eventDelta.y; } if (edges.left) { current.left += eventDelta.x; } if (edges.right) { current.right += eventDelta.x; } if (invertible) { // if invertible, copy the current rect (0, ___extend_6["default"])(inverted, current); if (invert === 'reposition') { // swap edge values if necessary to keep width/height positive var swap; if (inverted.top > inverted.bottom) { swap = inverted.top; inverted.top = inverted.bottom; inverted.bottom = swap; } if (inverted.left > inverted.right) { swap = inverted.left; inverted.left = inverted.right; inverted.right = swap; } } } else { // if not invertible, restrict to minimum of 0x0 rect inverted.top = Math.min(current.top, start.bottom); inverted.bottom = Math.max(current.bottom, start.top); inverted.left = Math.min(current.left, start.right); inverted.right = Math.max(current.right, start.left); } inverted.width = inverted.right - inverted.left; inverted.height = inverted.bottom - inverted.top; for (var edge in inverted) { deltaRect[edge] = inverted[edge] - previous[edge]; } iEvent.edges = interaction.prepared.edges; iEvent.rect = inverted; iEvent.deltaRect = deltaRect; } function updateEventAxes(_ref4) { var interaction = _ref4.interaction, iEvent = _ref4.iEvent, action = _ref4.action; if (action !== 'resize' || !interaction.resizeAxes) { return; } var options = interaction.interactable.options; if (options.resize.square) { if (interaction.resizeAxes === 'y') { iEvent.delta.x = iEvent.delta.y; } else { iEvent.delta.y = iEvent.delta.x; } iEvent.axes = 'xy'; } else { iEvent.axes = interaction.resizeAxes; if (interaction.resizeAxes === 'x') { iEvent.delta.y = 0; } else if (interaction.resizeAxes === 'y') { iEvent.delta.x = 0; } } } var ___default_6 = resize; _$resize_6["default"] = ___default_6; var _$actions_5 = {}; "use strict"; Object.defineProperty(_$actions_5, "__esModule", { value: true }); _$actions_5.install = __install_5; Object.defineProperty(_$actions_5, "drag", { enumerable: true, get: function get() { return ___drag_5["default"]; } }); Object.defineProperty(_$actions_5, "drop", { enumerable: true, get: function get() { return _drop["default"]; } }); Object.defineProperty(_$actions_5, "gesture", { enumerable: true, get: function get() { return _gesture["default"]; } }); Object.defineProperty(_$actions_5, "resize", { enumerable: true, get: function get() { return _resize["default"]; } }); _$actions_5.id = void 0; var ___drag_5 = ___interopRequireDefault_5(_$drag_1); var _drop = ___interopRequireDefault_5(_$drop_3); var _gesture = ___interopRequireDefault_5(_$gesture_4); var _resize = ___interopRequireDefault_5(_$resize_6); function ___interopRequireDefault_5(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function __install_5(scope) { scope.usePlugin(_gesture["default"]); scope.usePlugin(_resize["default"]); scope.usePlugin(___drag_5["default"]); scope.usePlugin(_drop["default"]); } var id = 'actions'; _$actions_5.id = id; var _$autoScroll_7 = {}; "use strict"; Object.defineProperty(_$autoScroll_7, "__esModule", { value: true }); _$autoScroll_7.getContainer = getContainer; _$autoScroll_7.getScroll = getScroll; _$autoScroll_7.getScrollSize = getScrollSize; _$autoScroll_7.getScrollSizeDelta = getScrollSizeDelta; _$autoScroll_7["default"] = void 0; var __domUtils_7 = ___interopRequireWildcard_7(_$domUtils_51); var __is_7 = ___interopRequireWildcard_7(_$is_57); var ___raf_7 = ___interopRequireDefault_7(_$raf_62); /* removed: var _$rect_63 = require("@interactjs/utils/rect"); */; /* removed: var _$window_66 = require("@interactjs/utils/window"); */; function ___interopRequireDefault_7(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___interopRequireWildcard_7(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function __install_7(scope) { var interactions = scope.interactions, defaults = scope.defaults, actions = scope.actions; scope.autoScroll = autoScroll; autoScroll.now = function () { return scope.now(); }; interactions.signals.on('new', function (_ref) { var interaction = _ref.interaction; interaction.autoScroll = null; }); interactions.signals.on('destroy', function (_ref2) { var interaction = _ref2.interaction; interaction.autoScroll = null; autoScroll.stop(); if (autoScroll.interaction) { autoScroll.interaction = null; } }); interactions.signals.on('stop', autoScroll.stop); interactions.signals.on('action-move', function (arg) { return autoScroll.onInteractionMove(arg); }); actions.eventTypes.push('autoscroll'); defaults.perAction.autoScroll = autoScroll.defaults; } var autoScroll = { defaults: { enabled: false, margin: 60, // the item that is scrolled (Window or HTMLElement) container: null, // the scroll speed in pixels per second speed: 300 }, now: Date.now, interaction: null, i: null, x: 0, y: 0, isScrolling: false, prevTime: 0, margin: 0, speed: 0, start: function start(interaction) { autoScroll.isScrolling = true; ___raf_7["default"].cancel(autoScroll.i); interaction.autoScroll = autoScroll; autoScroll.interaction = interaction; autoScroll.prevTime = autoScroll.now(); autoScroll.i = ___raf_7["default"].request(autoScroll.scroll); }, stop: function stop() { autoScroll.isScrolling = false; if (autoScroll.interaction) { autoScroll.interaction.autoScroll = null; } ___raf_7["default"].cancel(autoScroll.i); }, // scroll the window by the values in scroll.x/y scroll: function scroll() { var interaction = autoScroll.interaction; var interactable = interaction.interactable, element = interaction.element; var options = interactable.options[autoScroll.interaction.prepared.name].autoScroll; var container = getContainer(options.container, interactable, element); var now = autoScroll.now(); // change in time in seconds var dt = (now - autoScroll.prevTime) / 1000; // displacement var s = options.speed * dt; if (s >= 1) { var scrollBy = { x: autoScroll.x * s, y: autoScroll.y * s }; if (scrollBy.x || scrollBy.y) { var prevScroll = getScroll(container); if (__is_7.window(container)) { container.scrollBy(scrollBy.x, scrollBy.y); } else if (container) { container.scrollLeft += scrollBy.x; container.scrollTop += scrollBy.y; } var curScroll = getScroll(container); var delta = { x: curScroll.x - prevScroll.x, y: curScroll.y - prevScroll.y }; if (delta.x || delta.y) { interactable.fire({ type: 'autoscroll', target: element, interactable: interactable, delta: delta, interaction: interaction, container: container }); } } autoScroll.prevTime = now; } if (autoScroll.isScrolling) { ___raf_7["default"].cancel(autoScroll.i); autoScroll.i = ___raf_7["default"].request(autoScroll.scroll); } }, check: function check(interactable, actionName) { var options = interactable.options; return options[actionName].autoScroll && options[actionName].autoScroll.enabled; }, onInteractionMove: function onInteractionMove(_ref3) { var interaction = _ref3.interaction, pointer = _ref3.pointer; if (!(interaction.interacting() && autoScroll.check(interaction.interactable, interaction.prepared.name))) { return; } if (interaction.simulation) { autoScroll.x = autoScroll.y = 0; return; } var top; var right; var bottom; var left; var interactable = interaction.interactable, element = interaction.element; var options = interactable.options[interaction.prepared.name].autoScroll; var container = getContainer(options.container, interactable, element); if (__is_7.window(container)) { left = pointer.clientX < autoScroll.margin; top = pointer.clientY < autoScroll.margin; right = pointer.clientX > container.innerWidth - autoScroll.margin; bottom = pointer.clientY > container.innerHeight - autoScroll.margin; } else { var rect = __domUtils_7.getElementClientRect(container); left = pointer.clientX < rect.left + autoScroll.margin; top = pointer.clientY < rect.top + autoScroll.margin; right = pointer.clientX > rect.right - autoScroll.margin; bottom = pointer.clientY > rect.bottom - autoScroll.margin; } autoScroll.x = right ? 1 : left ? -1 : 0; autoScroll.y = bottom ? 1 : top ? -1 : 0; if (!autoScroll.isScrolling) { // set the autoScroll properties to those of the target autoScroll.margin = options.margin; autoScroll.speed = options.speed; autoScroll.start(interaction); } } }; function getContainer(value, interactable, element) { return (__is_7.string(value) ? (0, _$rect_63.getStringOptionResult)(value, interactable, element) : value) || (0, _$window_66.getWindow)(element); } function getScroll(container) { if (__is_7.window(container)) { container = window.document.body; } return { x: container.scrollLeft, y: container.scrollTop }; } function getScrollSize(container) { if (__is_7.window(container)) { container = window.document.body; } return { x: container.scrollWidth, y: container.scrollHeight }; } function getScrollSizeDelta(_ref4, func) { var interaction = _ref4.interaction, element = _ref4.element; var scrollOptions = interaction && interaction.interactable.options[interaction.prepared.name].autoScroll; if (!scrollOptions || !scrollOptions.enabled) { func(); return { x: 0, y: 0 }; } var scrollContainer = getContainer(scrollOptions.container, interaction.interactable, element); var prevSize = getScroll(scrollContainer); func(); var curSize = getScroll(scrollContainer); return { x: curSize.x - prevSize.x, y: curSize.y - prevSize.y }; } var ___default_7 = { id: 'auto-scroll', install: __install_7 }; _$autoScroll_7["default"] = ___default_7; var _$InteractableMethods_8 = {}; "use strict"; Object.defineProperty(_$InteractableMethods_8, "__esModule", { value: true }); _$InteractableMethods_8["default"] = void 0; /* removed: var _$utils_56 = require("@interactjs/utils"); */; var __is_8 = ___interopRequireWildcard_8(_$is_57); function ___interopRequireWildcard_8(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function __install_8(scope) { var Interactable = scope.Interactable, actions = scope.actions; Interactable.prototype.getAction = getAction; /** * ```js * interact(element, { ignoreFrom: document.getElementById('no-action') }) * // or * interact(element).ignoreFrom('input, textarea, a') * ``` * @deprecated * If the target of the `mousedown`, `pointerdown` or `touchstart` event or any * of it's parents match the given CSS selector or Element, no * drag/resize/gesture is started. * * Don't use this method. Instead set the `ignoreFrom` option for each action * or for `pointerEvents` * * @example * interact(targett) * .draggable({ * ignoreFrom: 'input, textarea, a[href]'', * }) * .pointerEvents({ * ignoreFrom: '[no-pointer]', * }) * * @param {string | Element | null} [newValue] a CSS selector string, an * Element or `null` to not ignore any elements * @return {string | Element | object} The current ignoreFrom value or this * Interactable */ Interactable.prototype.ignoreFrom = (0, _$utils_56.warnOnce)(function (newValue) { return this._backCompatOption('ignoreFrom', newValue); }, 'Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue}).'); /** * @deprecated * * A drag/resize/gesture is started only If the target of the `mousedown`, * `pointerdown` or `touchstart` event or any of it's parents match the given * CSS selector or Element. * * Don't use this method. Instead set the `allowFrom` option for each action * or for `pointerEvents` * * @example * interact(targett) * .resizable({ * allowFrom: '.resize-handle', * .pointerEvents({ * allowFrom: '.handle',, * }) * * @param {string | Element | null} [newValue] a CSS selector string, an * Element or `null` to allow from any element * @return {string | Element | object} The current allowFrom value or this * Interactable */ Interactable.prototype.allowFrom = (0, _$utils_56.warnOnce)(function (newValue) { return this._backCompatOption('allowFrom', newValue); }, 'Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue}).'); /** * ```js * interact('.resize-drag') * .resizable(true) * .draggable(true) * .actionChecker(function (pointer, event, action, interactable, element, interaction) { * * if (interact.matchesSelector(event.target, '.drag-handle')) { * // force drag with handle target * action.name = drag * } * else { * // resize from the top and right edges * action.name = 'resize' * action.edges = { top: true, right: true } * } * * return action * }) * ``` * * Returns or sets the function used to check action to be performed on * pointerDown * * @param {function | null} [checker] A function which takes a pointer event, * defaultAction string, interactable, element and interaction as parameters * and returns an object with name property 'drag' 'resize' or 'gesture' and * optionally an `edges` object with boolean 'top', 'left', 'bottom' and right * props. * @return {Function | Interactable} The checker function or this Interactable */ Interactable.prototype.actionChecker = actionChecker; /** * Returns or sets whether the the cursor should be changed depending on the * action that would be performed if the mouse were pressed and dragged. * * @param {boolean} [newValue] * @return {boolean | Interactable} The current setting or this Interactable */ Interactable.prototype.styleCursor = styleCursor; Interactable.prototype.defaultActionChecker = function (pointer, event, interaction, element) { return defaultActionChecker(this, pointer, event, interaction, element, actions); }; } function getAction(pointer, event, interaction, element) { var action = this.defaultActionChecker(pointer, event, interaction, element); if (this.options.actionChecker) { return this.options.actionChecker(pointer, event, action, this, element, interaction); } return action; } function defaultActionChecker(interactable, pointer, event, interaction, element, actions) { var rect = interactable.getRect(element); var buttons = event.buttons || { 0: 1, 1: 4, 3: 8, 4: 16 }[event.button]; var action = null; for (var _i = 0; _i < actions.names.length; _i++) { var _ref; _ref = actions.names[_i]; var actionName = _ref; // check mouseButton setting if the pointer is down if (interaction.pointerIsDown && /mouse|pointer/.test(interaction.pointerType) && (buttons & interactable.options[actionName].mouseButtons) === 0) { continue; } action = actions[actionName].checker(pointer, event, interactable, element, interaction, rect); if (action) { return action; } } } function styleCursor(newValue) { if (__is_8.bool(newValue)) { this.options.styleCursor = newValue; return this; } if (newValue === null) { delete this.options.styleCursor; return this; } return this.options.styleCursor; } function actionChecker(checker) { if (__is_8.func(checker)) { this.options.actionChecker = checker; return this; } if (checker === null) { delete this.options.actionChecker; return this; } return this.options.actionChecker; } var ___default_8 = { id: 'auto-start/interactableMethods', install: __install_8 }; _$InteractableMethods_8["default"] = ___default_8; var _$base_9 = {}; "use strict"; Object.defineProperty(_$base_9, "__esModule", { value: true }); _$base_9["default"] = void 0; var __utils_9 = ___interopRequireWildcard_9(_$utils_56); var _InteractableMethods = ___interopRequireDefault_9(_$InteractableMethods_8); function ___interopRequireDefault_9(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___interopRequireWildcard_9(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function __install_9(scope) { var interact = scope.interact, interactions = scope.interactions, defaults = scope.defaults; scope.usePlugin(_InteractableMethods["default"]); // set cursor style on mousedown interactions.signals.on('down', function (_ref) { var interaction = _ref.interaction, pointer = _ref.pointer, event = _ref.event, eventTarget = _ref.eventTarget; if (interaction.interacting()) { return; } var actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope); prepare(interaction, actionInfo, scope); }); // set cursor style on mousemove interactions.signals.on('move', function (_ref2) { var interaction = _ref2.interaction, pointer = _ref2.pointer, event = _ref2.event, eventTarget = _ref2.eventTarget; if (interaction.pointerType !== 'mouse' || interaction.pointerIsDown || interaction.interacting()) { return; } var actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope); prepare(interaction, actionInfo, scope); }); interactions.signals.on('move', function (arg) { var interaction = arg.interaction; if (!interaction.pointerIsDown || interaction.interacting() || !interaction.pointerWasMoved || !interaction.prepared.name) { return; } scope.autoStart.signals.fire('before-start', arg); var interactable = interaction.interactable; if (interaction.prepared.name && interactable) { // check manualStart and interaction limit if (interactable.options[interaction.prepared.name].manualStart || !withinInteractionLimit(interactable, interaction.element, interaction.prepared, scope)) { interaction.stop(); } else { interaction.start(interaction.prepared, interactable, interaction.element); } } }); interactions.signals.on('stop', function (_ref3) { var interaction = _ref3.interaction; var interactable = interaction.interactable; if (interactable && interactable.options.styleCursor) { setCursor(interaction.element, '', scope); } }); defaults.base.actionChecker = null; defaults.base.styleCursor = true; __utils_9.extend(defaults.perAction, { manualStart: false, max: Infinity, maxPerElement: 1, allowFrom: null, ignoreFrom: null, // only allow left button by default // see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#Return_value mouseButtons: 1 }); /** * Returns or sets the maximum number of concurrent interactions allowed. By * default only 1 interaction is allowed at a time (for backwards * compatibility). To allow multiple interactions on the same Interactables and * elements, you need to enable it in the draggable, resizable and gesturable * `'max'` and `'maxPerElement'` options. * * @alias module:interact.maxInteractions * * @param {number} [newValue] Any number. newValue <= 0 means no interactions. */ interact.maxInteractions = function (newValue) { return maxInteractions(newValue, scope); }; scope.autoStart = { // Allow this many interactions to happen simultaneously maxInteractions: Infinity, withinInteractionLimit: withinInteractionLimit, cursorElement: null, signals: new __utils_9.Signals() }; } // Check if the current interactable supports the action. // If so, return the validated action. Otherwise, return null function validateAction(action, interactable, element, eventTarget, scope) { if (interactable.testIgnoreAllow(interactable.options[action.name], element, eventTarget) && interactable.options[action.name].enabled && withinInteractionLimit(interactable, element, action, scope)) { return action; } return null; } function validateMatches(interaction, pointer, event, matches, matchElements, eventTarget, scope) { for (var i = 0, len = matches.length; i < len; i++) { var match = matches[i]; var matchElement = matchElements[i]; var matchAction = match.getAction(pointer, event, interaction, matchElement); if (!matchAction) { continue; } var action = validateAction(matchAction, match, matchElement, eventTarget, scope); if (action) { return { action: action, interactable: match, element: matchElement }; } } return { action: null, interactable: null, element: null }; } function getActionInfo(interaction, pointer, event, eventTarget, scope) { var matches = []; var matchElements = []; var element = eventTarget; function pushMatches(interactable) { matches.push(interactable); matchElements.push(element); } while (__utils_9.is.element(element)) { matches = []; matchElements = []; scope.interactables.forEachMatch(element, pushMatches); var actionInfo = validateMatches(interaction, pointer, event, matches, matchElements, eventTarget, scope); if (actionInfo.action && !actionInfo.interactable.options[actionInfo.action.name].manualStart) { return actionInfo; } element = __utils_9.dom.parentNode(element); } return { action: null, interactable: null, element: null }; } function prepare(interaction, _ref4, scope) { var action = _ref4.action, interactable = _ref4.interactable, element = _ref4.element; action = action || {}; if (interaction.interactable && interaction.interactable.options.styleCursor) { setCursor(interaction.element, '', scope); } interaction.interactable = interactable; interaction.element = element; __utils_9.copyAction(interaction.prepared, action); interaction.rect = interactable && action.name ? interactable.getRect(element) : null; if (interaction.pointerType === 'mouse' && interactable && interactable.options.styleCursor) { var cursor = ''; if (action) { var cursorChecker = interactable.options[action.name].cursorChecker; if (__utils_9.is.func(cursorChecker)) { cursor = cursorChecker(action, interactable, element); } else { cursor = scope.actions[action.name].getCursor(action); } } setCursor(interaction.element, cursor || '', scope); } scope.autoStart.signals.fire('prepared', { interaction: interaction }); } function withinInteractionLimit(interactable, element, action, scope) { var options = interactable.options; var maxActions = options[action.name].max; var maxPerElement = options[action.name].maxPerElement; var autoStartMax = scope.autoStart.maxInteractions; var activeInteractions = 0; var interactableCount = 0; var elementCount = 0; // no actions if any of these values == 0 if (!(maxActions && maxPerElement && autoStartMax)) { return false; } for (var _i = 0; _i < scope.interactions.list.length; _i++) { var _ref5; _ref5 = scope.interactions.list[_i]; var interaction = _ref5; var otherAction = interaction.prepared.name; if (!interaction.interacting()) { continue; } activeInteractions++; if (activeInteractions >= autoStartMax) { return false; } if (interaction.interactable !== interactable) { continue; } interactableCount += otherAction === action.name ? 1 : 0; if (interactableCount >= maxActions) { return false; } if (interaction.element === element) { elementCount++; if (otherAction === action.name && elementCount >= maxPerElement) { return false; } } } return autoStartMax > 0; } function maxInteractions(newValue, scope) { if (__utils_9.is.number(newValue)) { scope.autoStart.maxInteractions = newValue; return this; } return scope.autoStart.maxInteractions; } function setCursor(element, cursor, scope) { if (scope.autoStart.cursorElement) { scope.autoStart.cursorElement.style.cursor = ''; } element.ownerDocument.documentElement.style.cursor = cursor; element.style.cursor = cursor; scope.autoStart.cursorElement = cursor ? element : null; } var ___default_9 = { id: 'auto-start/base', install: __install_9, maxInteractions: maxInteractions, withinInteractionLimit: withinInteractionLimit, validateAction: validateAction }; _$base_9["default"] = ___default_9; var _$dragAxis_10 = {}; "use strict"; Object.defineProperty(_$dragAxis_10, "__esModule", { value: true }); _$dragAxis_10["default"] = void 0; var ___scope_10 = _$scope_24({}); /* removed: var _$domUtils_51 = require("@interactjs/utils/domUtils"); */; var __is_10 = ___interopRequireWildcard_10(_$is_57); var _base = ___interopRequireDefault_10(_$base_9); function ___interopRequireDefault_10(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___interopRequireWildcard_10(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function __install_10(scope) { scope.autoStart.signals.on('before-start', function (_ref) { var interaction = _ref.interaction, eventTarget = _ref.eventTarget, dx = _ref.dx, dy = _ref.dy; if (interaction.prepared.name !== 'drag') { return; } // check if a drag is in the correct axis var absX = Math.abs(dx); var absY = Math.abs(dy); var targetOptions = interaction.interactable.options.drag; var startAxis = targetOptions.startAxis; var currentAxis = absX > absY ? 'x' : absX < absY ? 'y' : 'xy'; interaction.prepared.axis = targetOptions.lockAxis === 'start' ? currentAxis[0] // always lock to one axis even if currentAxis === 'xy' : targetOptions.lockAxis; // if the movement isn't in the startAxis of the interactable if (currentAxis !== 'xy' && startAxis !== 'xy' && startAxis !== currentAxis) { // cancel the prepared action interaction.prepared.name = null; // then try to get a drag from another ineractable var element = eventTarget; var getDraggable = function getDraggable(interactable) { if (interactable === interaction.interactable) { return; } var options = interaction.interactable.options.drag; if (!options.manualStart && interactable.testIgnoreAllow(options, element, eventTarget)) { var action = interactable.getAction(interaction.downPointer, interaction.downEvent, interaction, element); if (action && action.name === ___scope_10.ActionName.Drag && checkStartAxis(currentAxis, interactable) && _base["default"].validateAction(action, interactable, element, eventTarget, scope)) { return interactable; } } }; // check all interactables while (__is_10.element(element)) { var interactable = scope.interactables.forEachMatch(element, getDraggable); if (interactable) { interaction.prepared.name = ___scope_10.ActionName.Drag; interaction.interactable = interactable; interaction.element = element; break; } element = (0, _$domUtils_51.parentNode)(element); } } }); function checkStartAxis(startAxis, interactable) { if (!interactable) { return false; } var thisAxis = interactable.options[___scope_10.ActionName.Drag].startAxis; return startAxis === 'xy' || thisAxis === 'xy' || thisAxis === startAxis; } } var ___default_10 = { id: 'auto-start/dragAxis', install: __install_10 }; _$dragAxis_10["default"] = ___default_10; var _$hold_11 = {}; "use strict"; Object.defineProperty(_$hold_11, "__esModule", { value: true }); _$hold_11["default"] = void 0; var ___base_11 = ___interopRequireDefault_11(_$base_9); function ___interopRequireDefault_11(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function __install_11(scope) { var autoStart = scope.autoStart, interactions = scope.interactions, defaults = scope.defaults; scope.usePlugin(___base_11["default"]); defaults.perAction.hold = 0; defaults.perAction.delay = 0; interactions.signals.on('new', function (interaction) { interaction.autoStartHoldTimer = null; }); autoStart.signals.on('prepared', function (_ref) { var interaction = _ref.interaction; var hold = getHoldDuration(interaction); if (hold > 0) { interaction.autoStartHoldTimer = setTimeout(function () { interaction.start(interaction.prepared, interaction.interactable, interaction.element); }, hold); } }); interactions.signals.on('move', function (_ref2) { var interaction = _ref2.interaction, duplicate = _ref2.duplicate; if (interaction.pointerWasMoved && !duplicate) { clearTimeout(interaction.autoStartHoldTimer); } }); // prevent regular down->move autoStart autoStart.signals.on('before-start', function (_ref3) { var interaction = _ref3.interaction; var hold = getHoldDuration(interaction); if (hold > 0) { interaction.prepared.name = null; } }); } function getHoldDuration(interaction) { var actionName = interaction.prepared && interaction.prepared.name; if (!actionName) { return null; } var options = interaction.interactable.options; return options[actionName].hold || options[actionName].delay; } var ___default_11 = { id: 'auto-start/hold', install: __install_11, getHoldDuration: getHoldDuration }; _$hold_11["default"] = ___default_11; var _$autoStart_12 = {}; "use strict"; Object.defineProperty(_$autoStart_12, "__esModule", { value: true }); _$autoStart_12.install = __install_12; Object.defineProperty(_$autoStart_12, "autoStart", { enumerable: true, get: function get() { return ___base_12["default"]; } }); Object.defineProperty(_$autoStart_12, "dragAxis", { enumerable: true, get: function get() { return _dragAxis["default"]; } }); Object.defineProperty(_$autoStart_12, "hold", { enumerable: true, get: function get() { return _hold["default"]; } }); _$autoStart_12.id = void 0; var ___base_12 = ___interopRequireDefault_12(_$base_9); var _dragAxis = ___interopRequireDefault_12(_$dragAxis_10); var _hold = ___interopRequireDefault_12(_$hold_11); function ___interopRequireDefault_12(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function __install_12(scope) { scope.usePlugin(___base_12["default"]); scope.usePlugin(_hold["default"]); scope.usePlugin(_dragAxis["default"]); } var __id_12 = 'auto-start'; _$autoStart_12.id = __id_12; var _$interactablePreventDefault_21 = {}; "use strict"; Object.defineProperty(_$interactablePreventDefault_21, "__esModule", { value: true }); _$interactablePreventDefault_21.install = __install_21; _$interactablePreventDefault_21["default"] = void 0; /* removed: var _$domUtils_51 = require("@interactjs/utils/domUtils"); */; var ___events_21 = ___interopRequireDefault_21(_$events_52); var __is_21 = ___interopRequireWildcard_21(_$is_57); /* removed: var _$window_66 = require("@interactjs/utils/window"); */; function ___interopRequireWildcard_21(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function ___interopRequireDefault_21(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function preventDefault(newValue) { if (/^(always|never|auto)$/.test(newValue)) { this.options.preventDefault = newValue; return this; } if (__is_21.bool(newValue)) { this.options.preventDefault = newValue ? 'always' : 'never'; return this; } return this.options.preventDefault; } function checkAndPreventDefault(interactable, scope, event) { var setting = interactable.options.preventDefault; if (setting === 'never') { return; } if (setting === 'always') { event.preventDefault(); return; } // setting === 'auto' // if the browser supports passive event listeners and isn't running on iOS, // don't preventDefault of touch{start,move} events. CSS touch-action and // user-select should be used instead of calling event.preventDefault(). if (___events_21["default"].supportsPassive && /^touch(start|move)$/.test(event.type)) { var doc = (0, _$window_66.getWindow)(event.target).document; var docOptions = scope.getDocOptions(doc); if (!(docOptions && docOptions.events) || docOptions.events.passive !== false) { return; } } // don't preventDefault of pointerdown events if (/^(mouse|pointer|touch)*(down|start)/i.test(event.type)) { return; } // don't preventDefault on editable elements if (__is_21.element(event.target) && (0, _$domUtils_51.matchesSelector)(event.target, 'input,select,textarea,[contenteditable=true],[contenteditable=true] *')) { return; } event.preventDefault(); } function onInteractionEvent(_ref) { var interaction = _ref.interaction, event = _ref.event; if (interaction.interactable) { interaction.interactable.checkAndPreventDefault(event); } } function __install_21(scope) { /** @lends Interactable */ var Interactable = scope.Interactable; /** * Returns or sets whether to prevent the browser's default behaviour in * response to pointer events. Can be set to: * - `'always'` to always prevent * - `'never'` to never prevent * - `'auto'` to let interact.js try to determine what would be best * * @param {string} [newValue] `'always'`, `'never'` or `'auto'` * @return {string | Interactable} The current setting or this Interactable */ Interactable.prototype.preventDefault = preventDefault; Interactable.prototype.checkAndPreventDefault = function (event) { return checkAndPreventDefault(this, scope, event); }; var _arr = ['down', 'move', 'up', 'cancel']; for (var _i = 0; _i < _arr.length; _i++) { var eventSignal = _arr[_i]; scope.interactions.signals.on(eventSignal, onInteractionEvent); } // prevent native HTML5 drag on interact.js target elements scope.interactions.docEvents.push({ type: 'dragstart', listener: function listener(event) { for (var _i2 = 0; _i2 < scope.interactions.list.length; _i2++) { var _ref2; _ref2 = scope.interactions.list[_i2]; var interaction = _ref2; if (interaction.element && (interaction.element === event.target || (0, _$domUtils_51.nodeContains)(interaction.element, event.target))) { interaction.interactable.checkAndPreventDefault(event); return; } } } }); } var ___default_21 = { id: 'core/interactablePreventDefault', install: __install_21 }; _$interactablePreventDefault_21["default"] = ___default_21; var _$devTools_25 = {}; "use strict"; Object.defineProperty(_$devTools_25, "__esModule", { value: true }); _$devTools_25["default"] = void 0; var ___domObjects_25 = ___interopRequireDefault_25(_$domObjects_50); /* removed: var _$domUtils_51 = require("@interactjs/utils/domUtils"); */; var ___extend_25 = ___interopRequireDefault_25(_$extend_53); var __is_25 = ___interopRequireWildcard_25(_$is_57); var ___window_25 = ___interopRequireDefault_25(_$window_66); function ___interopRequireWildcard_25(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function ___interopRequireDefault_25(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___toConsumableArray_25(arr) { return ___arrayWithoutHoles_25(arr) || ___iterableToArray_25(arr) || ___nonIterableSpread_25(); } function ___nonIterableSpread_25() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } function ___iterableToArray_25(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } function ___arrayWithoutHoles_25(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } var CheckName; (function (CheckName) { CheckName["touchAction"] = ""; CheckName["boxSizing"] = ""; CheckName["noListeners"] = ""; })(CheckName || (CheckName = {})); var prefix = '[interact.js] '; var links = { touchAction: 'https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action', boxSizing: 'https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing' }; var isProduction = "production" === 'production'; // eslint-disable-next-line no-restricted-syntax function __install_25(scope) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, logger = _ref.logger; var interactions = scope.interactions, Interactable = scope.Interactable, defaults = scope.defaults; logger = logger || console; interactions.signals.on('action-start', function (_ref2) { var interaction = _ref2.interaction; for (var _i = 0; _i < checks.length; _i++) { var _ref3; _ref3 = checks[_i]; var check = _ref3; var options = interaction.interactable && interaction.interactable.options[interaction.prepared.name]; if (!(options && options.devTools && options.devTools.ignore[check.name]) && check.perform(interaction)) { var _logger; (_logger = logger).warn.apply(_logger, [prefix + check.text].concat(___toConsumableArray_25(check.getInfo(interaction)))); } } }); defaults.base.devTools = { ignore: {} }; Interactable.prototype.devTools = function (options) { if (options) { (0, ___extend_25["default"])(this.options.devTools, options); return this; } return this.options.devTools; }; } var checks = [{ name: 'touchAction', perform: function perform(_ref4) { var element = _ref4.element; return !parentHasStyle(element, 'touchAction', /pan-|pinch|none/); }, getInfo: function getInfo(_ref5) { var element = _ref5.element; return [element, links.touchAction]; }, text: 'Consider adding CSS "touch-action: none" to this element\n' }, { name: 'boxSizing', perform: function perform(interaction) { var element = interaction.element; return interaction.prepared.name === 'resize' && element instanceof ___domObjects_25["default"].HTMLElement && !hasStyle(element, 'boxSizing', /border-box/); }, text: 'Consider adding CSS "box-sizing: border-box" to this resizable element', getInfo: function getInfo(_ref6) { var element = _ref6.element; return [element, links.boxSizing]; } }, { name: 'noListeners', perform: function perform(interaction) { var actionName = interaction.prepared.name; var moveListeners = interaction.interactable.events.types["".concat(actionName, "move")] || []; return !moveListeners.length; }, getInfo: function getInfo(interaction) { return [interaction.prepared.name, interaction.interactable]; }, text: 'There are no listeners set for this action' }]; function hasStyle(element, prop, styleRe) { return styleRe.test(element.style[prop] || ___window_25["default"].window.getComputedStyle(element)[prop]); } function parentHasStyle(element, prop, styleRe) { var parent = element; while (__is_25.element(parent)) { if (hasStyle(parent, prop, styleRe)) { return true; } parent = (0, _$domUtils_51.parentNode)(parent); } return false; } var __id_25 = 'dev-tools'; var defaultExport = isProduction ? { id: __id_25, install: function install() {} } : { id: __id_25, install: __install_25, checks: checks, CheckName: CheckName, links: links, prefix: prefix }; var ___default_25 = defaultExport; _$devTools_25["default"] = ___default_25; var _$base_30 = {}; "use strict"; Object.defineProperty(_$base_30, "__esModule", { value: true }); _$base_30.startAll = startAll; _$base_30.setAll = setAll; _$base_30.prepareStates = prepareStates; _$base_30.makeModifier = makeModifier; _$base_30["default"] = void 0; var ___extend_30 = ___interopRequireDefault_30(_$extend_53); function ___interopRequireDefault_30(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___slicedToArray_30(arr, i) { return ___arrayWithHoles_30(arr) || ___iterableToArrayLimit_30(arr, i) || ___nonIterableRest_30(); } function ___nonIterableRest_30() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } function ___iterableToArrayLimit_30(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function ___arrayWithHoles_30(arr) { if (Array.isArray(arr)) return arr; } function __install_30(scope) { var interactions = scope.interactions; scope.defaults.perAction.modifiers = []; interactions.signals.on('new', function (_ref) { var interaction = _ref.interaction; interaction.modifiers = { startOffset: { left: 0, right: 0, top: 0, bottom: 0 }, offsets: {}, states: null, result: null, endPrevented: false, startDelta: null }; }); interactions.signals.on('before-action-start', function (arg) { __start_30(arg, arg.interaction.coords.start.page); }); interactions.signals.on('action-resume', function (arg) { stop(arg); __start_30(arg, arg.interaction.coords.cur.page); __beforeMove_30(arg); }); interactions.signals.on('after-action-move', restoreCoords); interactions.signals.on('before-action-move', __beforeMove_30); interactions.signals.on('before-action-start', setCoords); interactions.signals.on('after-action-start', restoreCoords); interactions.signals.on('before-action-end', beforeEnd); interactions.signals.on('stop', stop); } function __start_30(_ref2, pageCoords) { var interaction = _ref2.interaction, phase = _ref2.phase; var interactable = interaction.interactable, element = interaction.element; var modifierList = getModifierList(interaction); var states = prepareStates(modifierList); var rect = (0, ___extend_30["default"])({}, interaction.rect); if (!('width' in rect)) { rect.width = rect.right - rect.left; } if (!('height' in rect)) { rect.height = rect.bottom - rect.top; } var startOffset = getRectOffset(rect, pageCoords); interaction.modifiers.startOffset = startOffset; interaction.modifiers.startDelta = { x: 0, y: 0 }; var arg = { interaction: interaction, interactable: interactable, element: element, pageCoords: pageCoords, phase: phase, rect: rect, startOffset: startOffset, states: states, preEnd: false, requireEndOnly: false }; interaction.modifiers.states = states; interaction.modifiers.result = null; startAll(arg); arg.pageCoords = (0, ___extend_30["default"])({}, interaction.coords.start.page); var result = interaction.modifiers.result = setAll(arg); return result; } function startAll(arg) { var states = arg.states; for (var _i = 0; _i < states.length; _i++) { var _ref3; _ref3 = states[_i]; var state = _ref3; if (state.methods.start) { arg.state = state; state.methods.start(arg); } } } function setAll(arg) { var interaction = arg.interaction, _arg$modifiersState = arg.modifiersState, modifiersState = _arg$modifiersState === void 0 ? interaction.modifiers : _arg$modifiersState, _arg$prevCoords = arg.prevCoords, prevCoords = _arg$prevCoords === void 0 ? modifiersState.result ? modifiersState.result.coords : interaction.coords.prev.page : _arg$prevCoords, phase = arg.phase, preEnd = arg.preEnd, requireEndOnly = arg.requireEndOnly, rect = arg.rect, skipModifiers = arg.skipModifiers; var states = skipModifiers ? arg.states.slice(skipModifiers) : arg.states; arg.coords = (0, ___extend_30["default"])({}, arg.pageCoords); arg.rect = (0, ___extend_30["default"])({}, rect); var result = { delta: { x: 0, y: 0 }, rectDelta: { left: 0, right: 0, top: 0, bottom: 0 }, coords: arg.coords, changed: true }; for (var _i2 = 0; _i2 < states.length; _i2++) { var _ref4; _ref4 = states[_i2]; var state = _ref4; var options = state.options; if (!state.methods.set || !shouldDo(options, preEnd, requireEndOnly, phase)) { continue; } arg.state = state; state.methods.set(arg); } result.delta.x = arg.coords.x - arg.pageCoords.x; result.delta.y = arg.coords.y - arg.pageCoords.y; var rectChanged = false; if (rect) { result.rectDelta.left = arg.rect.left - rect.left; result.rectDelta.right = arg.rect.right - rect.right; result.rectDelta.top = arg.rect.top - rect.top; result.rectDelta.bottom = arg.rect.bottom - rect.bottom; rectChanged = result.rectDelta.left !== 0 || result.rectDelta.right !== 0 || result.rectDelta.top !== 0 || result.rectDelta.bottom !== 0; } result.changed = prevCoords.x !== result.coords.x || prevCoords.y !== result.coords.y || rectChanged; return result; } function __beforeMove_30(arg) { var interaction = arg.interaction, phase = arg.phase, preEnd = arg.preEnd, skipModifiers = arg.skipModifiers; var interactable = interaction.interactable, element = interaction.element; var modifierResult = setAll({ interaction: interaction, interactable: interactable, element: element, preEnd: preEnd, phase: phase, pageCoords: interaction.coords.cur.page, rect: interaction.rect, states: interaction.modifiers.states, requireEndOnly: false, skipModifiers: skipModifiers }); interaction.modifiers.result = modifierResult; // don't fire an action move if a modifier would keep the event in the same // cordinates as before if (!modifierResult.changed && interaction.interacting()) { return false; } setCoords(arg); } function beforeEnd(arg) { var interaction = arg.interaction, event = arg.event, noPreEnd = arg.noPreEnd; var states = interaction.modifiers.states; if (noPreEnd || !states || !states.length) { return; } var didPreEnd = false; for (var _i3 = 0; _i3 < states.length; _i3++) { var _ref5; _ref5 = states[_i3]; var state = _ref5; arg.state = state; var options = state.options, methods = state.methods; var endResult = methods.beforeEnd && methods.beforeEnd(arg); if (endResult === false) { interaction.modifiers.endPrevented = true; return false; } // if the endOnly option is true for any modifier if (!didPreEnd && shouldDo(options, true, true)) { // fire a move event at the modified coordinates interaction.move({ event: event, preEnd: true }); didPreEnd = true; } } } function stop(arg) { var interaction = arg.interaction; var states = interaction.modifiers.states; if (!states || !states.length) { return; } var modifierArg = (0, ___extend_30["default"])({ states: states, interactable: interaction.interactable, element: interaction.element }, arg); restoreCoords(arg); for (var _i4 = 0; _i4 < states.length; _i4++) { var _ref6; _ref6 = states[_i4]; var state = _ref6; modifierArg.state = state; if (state.methods.stop) { state.methods.stop(modifierArg); } } arg.interaction.modifiers.states = null; arg.interaction.modifiers.endPrevented = false; } function getModifierList(interaction) { var actionOptions = interaction.interactable.options[interaction.prepared.name]; var actionModifiers = actionOptions.modifiers; if (actionModifiers && actionModifiers.length) { return actionModifiers.filter(function (modifier) { return !modifier.options || modifier.options.enabled !== false; }); } return ['snap', 'snapSize', 'snapEdges', 'restrict', 'restrictEdges', 'restrictSize'].map(function (type) { var options = actionOptions[type]; return options && options.enabled && { options: options, methods: options._methods }; }).filter(function (m) { return !!m; }); } function prepareStates(modifierList) { var states = []; for (var index = 0; index < modifierList.length; index++) { var _modifierList$index = modifierList[index], options = _modifierList$index.options, methods = _modifierList$index.methods, name = _modifierList$index.name; if (options && options.enabled === false) { continue; } states.push({ options: options, methods: methods, index: index, name: name }); } return states; } function setCoords(arg) { var interaction = arg.interaction, phase = arg.phase; var curCoords = arg.curCoords || interaction.coords.cur; var startCoords = arg.startCoords || interaction.coords.start; var _interaction$modifier = interaction.modifiers, result = _interaction$modifier.result, startDelta = _interaction$modifier.startDelta; var curDelta = result.delta; if (phase === 'start') { (0, ___extend_30["default"])(interaction.modifiers.startDelta, result.delta); } var _arr = [[startCoords, startDelta], [curCoords, curDelta]]; for (var _i5 = 0; _i5 < _arr.length; _i5++) { var _arr$_i = ___slicedToArray_30(_arr[_i5], 2), coordsSet = _arr$_i[0], delta = _arr$_i[1]; coordsSet.page.x += delta.x; coordsSet.page.y += delta.y; coordsSet.client.x += delta.x; coordsSet.client.y += delta.y; } var rectDelta = interaction.modifiers.result.rectDelta; var rect = arg.rect || interaction.rect; rect.left += rectDelta.left; rect.right += rectDelta.right; rect.top += rectDelta.top; rect.bottom += rectDelta.bottom; rect.width = rect.right - rect.left; rect.height = rect.bottom - rect.top; } function restoreCoords(_ref7) { var _ref7$interaction = _ref7.interaction, coords = _ref7$interaction.coords, rect = _ref7$interaction.rect, modifiers = _ref7$interaction.modifiers; if (!modifiers.result) { return; } var startDelta = modifiers.startDelta; var _modifiers$result = modifiers.result, curDelta = _modifiers$result.delta, rectDelta = _modifiers$result.rectDelta; var coordsAndDeltas = [[coords.start, startDelta], [coords.cur, curDelta]]; for (var _i6 = 0; _i6 < coordsAndDeltas.length; _i6++) { var _coordsAndDeltas$_i = ___slicedToArray_30(coordsAndDeltas[_i6], 2), coordsSet = _coordsAndDeltas$_i[0], delta = _coordsAndDeltas$_i[1]; coordsSet.page.x -= delta.x; coordsSet.page.y -= delta.y; coordsSet.client.x -= delta.x; coordsSet.client.y -= delta.y; } rect.left -= rectDelta.left; rect.right -= rectDelta.right; rect.top -= rectDelta.top; rect.bottom -= rectDelta.bottom; } function shouldDo(options, preEnd, requireEndOnly, phase) { return options ? options.enabled !== false && (preEnd || !options.endOnly) && (!requireEndOnly || options.endOnly || options.alwaysOnEnd) && (options.setStart || phase !== 'start') : !requireEndOnly; } function getRectOffset(rect, coords) { return rect ? { left: coords.x - rect.left, top: coords.y - rect.top, right: rect.right - coords.x, bottom: rect.bottom - coords.y } : { left: 0, top: 0, right: 0, bottom: 0 }; } function makeModifier(module, name) { var defaults = module.defaults; var methods = { start: module.start, set: module.set, beforeEnd: module.beforeEnd, stop: module.stop }; var modifier = function modifier(_options) { var options = _options || {}; options.enabled = options.enabled !== false; // add missing defaults to options for (var prop in defaults) { if (!(prop in options)) { options[prop] = defaults[prop]; } } var m = { options: options, methods: methods, name: name }; return m; }; if (name && typeof name === 'string') { // for backwrads compatibility modifier._defaults = defaults; modifier._methods = methods; } return modifier; } var ___default_30 = { id: 'modifiers/base', install: __install_30, startAll: startAll, setAll: setAll, prepareStates: prepareStates, start: __start_30, beforeMove: __beforeMove_30, beforeEnd: beforeEnd, stop: stop, shouldDo: shouldDo, getModifierList: getModifierList, getRectOffset: getRectOffset, makeModifier: makeModifier }; _$base_30["default"] = ___default_30; var _$inertia_26 = {}; "use strict"; Object.defineProperty(_$inertia_26, "__esModule", { value: true }); _$inertia_26["default"] = void 0; /* removed: var _$InteractEvent_15 = require("@interactjs/core/InteractEvent"); */; var ___base_26 = ___interopRequireDefault_26(_$base_30); var __utils_26 = ___interopRequireWildcard_26(_$utils_56); var ___raf_26 = ___interopRequireDefault_26(_$raf_62); function ___interopRequireWildcard_26(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function ___interopRequireDefault_26(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } _$InteractEvent_15.EventPhase.Resume = 'resume'; _$InteractEvent_15.EventPhase.InertiaStart = 'inertiastart'; function __install_26(scope) { var interactions = scope.interactions, defaults = scope.defaults; interactions.signals.on('new', function (_ref) { var interaction = _ref.interaction; interaction.inertia = { active: false, smoothEnd: false, allowResume: false, upCoords: {}, timeout: null }; }); // FIXME proper signal typing interactions.signals.on('before-action-end', function (arg) { return release(arg, scope); }); interactions.signals.on('down', function (arg) { return resume(arg, scope); }); interactions.signals.on('stop', function (arg) { return __stop_26(arg); }); defaults.perAction.inertia = { enabled: false, resistance: 10, minSpeed: 100, endSpeed: 10, allowResume: true, smoothEndDuration: 300 }; scope.usePlugin(___base_26["default"]); } function resume(_ref2, scope) { var interaction = _ref2.interaction, event = _ref2.event, pointer = _ref2.pointer, eventTarget = _ref2.eventTarget; var state = interaction.inertia; // Check if the down event hits the current inertia target if (state.active) { var element = eventTarget; // climb up the DOM tree from the event target while (__utils_26.is.element(element)) { // if interaction element is the current inertia target element if (element === interaction.element) { // stop inertia ___raf_26["default"].cancel(state.timeout); state.active = false; interaction.simulation = null; // update pointers to the down event's coordinates interaction.updatePointer(pointer, event, eventTarget, true); __utils_26.pointer.setCoords(interaction.coords.cur, interaction.pointers.map(function (p) { return p.pointer; }), interaction._now()); // fire appropriate signals var signalArg = { interaction: interaction }; scope.interactions.signals.fire('action-resume', signalArg); // fire a reume event var resumeEvent = new scope.InteractEvent(interaction, event, interaction.prepared.name, _$InteractEvent_15.EventPhase.Resume, interaction.element); interaction._fireEvent(resumeEvent); __utils_26.pointer.copyCoords(interaction.coords.prev, interaction.coords.cur); break; } element = __utils_26.dom.parentNode(element); } } } function release(_ref3, scope) { var interaction = _ref3.interaction, event = _ref3.event, noPreEnd = _ref3.noPreEnd; var state = interaction.inertia; if (!interaction.interacting() || interaction.simulation && interaction.simulation.active || noPreEnd) { return null; } var options = __getOptions_26(interaction); var now = interaction._now(); var velocityClient = interaction.coords.velocity.client; var pointerSpeed = __utils_26.hypot(velocityClient.x, velocityClient.y); var smoothEnd = false; var modifierResult; // check if inertia should be started var inertiaPossible = options && options.enabled && interaction.prepared.name !== 'gesture' && event !== state.startEvent; var inertia = inertiaPossible && now - interaction.coords.cur.timeStamp < 50 && pointerSpeed > options.minSpeed && pointerSpeed > options.endSpeed; var modifierArg = { interaction: interaction, pageCoords: __utils_26.extend({}, interaction.coords.cur.page), states: inertiaPossible && interaction.modifiers.states.map(function (modifierStatus) { return __utils_26.extend({}, modifierStatus); }), preEnd: true, prevCoords: undefined, requireEndOnly: null }; // smoothEnd if (inertiaPossible && !inertia) { modifierArg.prevCoords = interaction.prevEvent.page; modifierArg.requireEndOnly = false; modifierResult = ___base_26["default"].setAll(modifierArg); if (modifierResult.changed) { smoothEnd = true; } } if (!(inertia || smoothEnd)) { return null; } __utils_26.pointer.copyCoords(state.upCoords, interaction.coords.cur); interaction.pointers[0].pointer = state.startEvent = new scope.InteractEvent(interaction, event, // FIXME add proper typing Action.name interaction.prepared.name, _$InteractEvent_15.EventPhase.InertiaStart, interaction.element); state.t0 = now; state.active = true; state.allowResume = options.allowResume; interaction.simulation = state; interaction.interactable.fire(state.startEvent); if (inertia) { state.vx0 = interaction.coords.velocity.client.x; state.vy0 = interaction.coords.velocity.client.y; state.v0 = pointerSpeed; calcInertia(interaction, state); __utils_26.extend(modifierArg.pageCoords, interaction.coords.cur.page); modifierArg.pageCoords.x += state.xe; modifierArg.pageCoords.y += state.ye; modifierArg.prevCoords = undefined; modifierArg.requireEndOnly = true; modifierResult = ___base_26["default"].setAll(modifierArg); state.modifiedXe += modifierResult.delta.x; state.modifiedYe += modifierResult.delta.y; state.timeout = ___raf_26["default"].request(function () { return inertiaTick(interaction); }); } else { state.smoothEnd = true; state.xe = modifierResult.delta.x; state.ye = modifierResult.delta.y; state.sx = state.sy = 0; state.timeout = ___raf_26["default"].request(function () { return smothEndTick(interaction); }); } return false; } function __stop_26(_ref4) { var interaction = _ref4.interaction; var state = interaction.inertia; if (state.active) { ___raf_26["default"].cancel(state.timeout); state.active = false; interaction.simulation = null; } } function calcInertia(interaction, state) { var options = __getOptions_26(interaction); var lambda = options.resistance; var inertiaDur = -Math.log(options.endSpeed / state.v0) / lambda; state.x0 = interaction.prevEvent.page.x; state.y0 = interaction.prevEvent.page.y; state.t0 = state.startEvent.timeStamp / 1000; state.sx = state.sy = 0; state.modifiedXe = state.xe = (state.vx0 - inertiaDur) / lambda; state.modifiedYe = state.ye = (state.vy0 - inertiaDur) / lambda; state.te = inertiaDur; state.lambda_v0 = lambda / state.v0; state.one_ve_v0 = 1 - options.endSpeed / state.v0; } function inertiaTick(interaction) { updateInertiaCoords(interaction); __utils_26.pointer.setCoordDeltas(interaction.coords.delta, interaction.coords.prev, interaction.coords.cur); __utils_26.pointer.setCoordVelocity(interaction.coords.velocity, interaction.coords.delta); var state = interaction.inertia; var options = __getOptions_26(interaction); var lambda = options.resistance; var t = interaction._now() / 1000 - state.t0; if (t < state.te) { var progress = 1 - (Math.exp(-lambda * t) - state.lambda_v0) / state.one_ve_v0; if (state.modifiedXe === state.xe && state.modifiedYe === state.ye) { state.sx = state.xe * progress; state.sy = state.ye * progress; } else { var quadPoint = __utils_26.getQuadraticCurvePoint(0, 0, state.xe, state.ye, state.modifiedXe, state.modifiedYe, progress); state.sx = quadPoint.x; state.sy = quadPoint.y; } interaction.move(); state.timeout = ___raf_26["default"].request(function () { return inertiaTick(interaction); }); } else { state.sx = state.modifiedXe; state.sy = state.modifiedYe; interaction.move(); interaction.end(state.startEvent); state.active = false; interaction.simulation = null; } __utils_26.pointer.copyCoords(interaction.coords.prev, interaction.coords.cur); } function smothEndTick(interaction) { updateInertiaCoords(interaction); var state = interaction.inertia; var t = interaction._now() - state.t0; var _getOptions = __getOptions_26(interaction), duration = _getOptions.smoothEndDuration; if (t < duration) { state.sx = __utils_26.easeOutQuad(t, 0, state.xe, duration); state.sy = __utils_26.easeOutQuad(t, 0, state.ye, duration); interaction.move(); state.timeout = ___raf_26["default"].request(function () { return smothEndTick(interaction); }); } else { state.sx = state.xe; state.sy = state.ye; interaction.move(); interaction.end(state.startEvent); state.smoothEnd = state.active = false; interaction.simulation = null; } } function updateInertiaCoords(interaction) { var state = interaction.inertia; // return if inertia isn't running if (!state.active) { return; } var pageUp = state.upCoords.page; var clientUp = state.upCoords.client; __utils_26.pointer.setCoords(interaction.coords.cur, [{ pageX: pageUp.x + state.sx, pageY: pageUp.y + state.sy, clientX: clientUp.x + state.sx, clientY: clientUp.y + state.sy }], interaction._now()); } function __getOptions_26(_ref5) { var interactable = _ref5.interactable, prepared = _ref5.prepared; return interactable && interactable.options && prepared.name && interactable.options[prepared.name].inertia; } var ___default_26 = { id: 'inertia', install: __install_26, calcInertia: calcInertia, inertiaTick: inertiaTick, smothEndTick: smothEndTick, updateInertiaCoords: updateInertiaCoords }; _$inertia_26["default"] = ___default_26; var _$pointer_33 = {}; "use strict"; Object.defineProperty(_$pointer_33, "__esModule", { value: true }); _$pointer_33["default"] = void 0; var ___extend_33 = ___interopRequireDefault_33(_$extend_53); var __is_33 = ___interopRequireWildcard_33(_$is_57); var ___rect_33 = ___interopRequireDefault_33(_$rect_63); function ___interopRequireWildcard_33(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function ___interopRequireDefault_33(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function __start_33(_ref) { var rect = _ref.rect, startOffset = _ref.startOffset, state = _ref.state, interaction = _ref.interaction, pageCoords = _ref.pageCoords; var options = state.options; var elementRect = options.elementRect; var offset = (0, ___extend_33["default"])({ left: 0, top: 0, right: 0, bottom: 0 }, options.offset || {}); if (rect && elementRect) { var restriction = getRestrictionRect(options.restriction, interaction, pageCoords); if (restriction) { var widthDiff = restriction.right - restriction.left - rect.width; var heightDiff = restriction.bottom - restriction.top - rect.height; if (widthDiff < 0) { offset.left += widthDiff; offset.right += widthDiff; } if (heightDiff < 0) { offset.top += heightDiff; offset.bottom += heightDiff; } } offset.left += startOffset.left - rect.width * elementRect.left; offset.top += startOffset.top - rect.height * elementRect.top; offset.right += startOffset.right - rect.width * (1 - elementRect.right); offset.bottom += startOffset.bottom - rect.height * (1 - elementRect.bottom); } state.offset = offset; } function set(_ref2) { var coords = _ref2.coords, interaction = _ref2.interaction, state = _ref2.state; var options = state.options, offset = state.offset; var restriction = getRestrictionRect(options.restriction, interaction, coords); if (!restriction) { return; } var rect = ___rect_33["default"].xywhToTlbr(restriction); coords.x = Math.max(Math.min(rect.right - offset.right, coords.x), rect.left + offset.left); coords.y = Math.max(Math.min(rect.bottom - offset.bottom, coords.y), rect.top + offset.top); } function getRestrictionRect(value, interaction, coords) { if (__is_33.func(value)) { return ___rect_33["default"].resolveRectLike(value, interaction.interactable, interaction.element, [coords.x, coords.y, interaction]); } else { return ___rect_33["default"].resolveRectLike(value, interaction.interactable, interaction.element); } } var __defaults_33 = { restriction: null, elementRect: null, offset: null, endOnly: false, enabled: false }; var restrict = { start: __start_33, set: set, getRestrictionRect: getRestrictionRect, defaults: __defaults_33 }; var ___default_33 = restrict; _$pointer_33["default"] = ___default_33; var _$edges_32 = {}; "use strict"; Object.defineProperty(_$edges_32, "__esModule", { value: true }); _$edges_32["default"] = void 0; var ___extend_32 = ___interopRequireDefault_32(_$extend_53); var ___rect_32 = ___interopRequireDefault_32(_$rect_63); var _pointer = ___interopRequireDefault_32(_$pointer_33); function ___interopRequireDefault_32(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } // This module adds the options.resize.restrictEdges setting which sets min and // max for the top, left, bottom and right edges of the target being resized. // // interact(target).resize({ // edges: { top: true, left: true }, // restrictEdges: { // inner: { top: 200, left: 200, right: 400, bottom: 400 }, // outer: { top: 0, left: 0, right: 600, bottom: 600 }, // }, // }) var __getRestrictionRect_32 = _pointer["default"].getRestrictionRect; var noInner = { top: +Infinity, left: +Infinity, bottom: -Infinity, right: -Infinity }; var noOuter = { top: -Infinity, left: -Infinity, bottom: +Infinity, right: +Infinity }; function __start_32(_ref) { var interaction = _ref.interaction, state = _ref.state; var options = state.options; var startOffset = interaction.modifiers.startOffset; var offset; if (options) { var offsetRect = __getRestrictionRect_32(options.offset, interaction, interaction.coords.start.page); offset = ___rect_32["default"].rectToXY(offsetRect); } offset = offset || { x: 0, y: 0 }; state.offset = { top: offset.y + startOffset.top, left: offset.x + startOffset.left, bottom: offset.y - startOffset.bottom, right: offset.x - startOffset.right }; } function __set_32(_ref2) { var coords = _ref2.coords, interaction = _ref2.interaction, state = _ref2.state; var offset = state.offset, options = state.options; var edges = interaction.prepared._linkedEdges || interaction.prepared.edges; if (!edges) { return; } var page = (0, ___extend_32["default"])({}, coords); var inner = __getRestrictionRect_32(options.inner, interaction, page) || {}; var outer = __getRestrictionRect_32(options.outer, interaction, page) || {}; fixRect(inner, noInner); fixRect(outer, noOuter); if (edges.top) { coords.y = Math.min(Math.max(outer.top + offset.top, page.y), inner.top + offset.top); } else if (edges.bottom) { coords.y = Math.max(Math.min(outer.bottom + offset.bottom, page.y), inner.bottom + offset.bottom); } if (edges.left) { coords.x = Math.min(Math.max(outer.left + offset.left, page.x), inner.left + offset.left); } else if (edges.right) { coords.x = Math.max(Math.min(outer.right + offset.right, page.x), inner.right + offset.right); } } function fixRect(rect, defaults) { var _arr = ['top', 'left', 'bottom', 'right']; for (var _i = 0; _i < _arr.length; _i++) { var edge = _arr[_i]; if (!(edge in rect)) { rect[edge] = defaults[edge]; } } return rect; } var __defaults_32 = { inner: null, outer: null, offset: null, endOnly: false, enabled: false }; var restrictEdges = { noInner: noInner, noOuter: noOuter, getRestrictionRect: __getRestrictionRect_32, start: __start_32, set: __set_32, defaults: __defaults_32 }; var ___default_32 = restrictEdges; _$edges_32["default"] = ___default_32; var _$rect_34 = {}; "use strict"; Object.defineProperty(_$rect_34, "__esModule", { value: true }); _$rect_34["default"] = void 0; var ___extend_34 = ___interopRequireDefault_34(_$extend_53); var ___pointer_34 = ___interopRequireDefault_34(_$pointer_33); function ___interopRequireDefault_34(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var __defaults_34 = (0, ___extend_34["default"])({ get elementRect() { return { top: 0, left: 0, bottom: 1, right: 1 }; }, set elementRect(_) {} }, ___pointer_34["default"].defaults); var restrictRect = { start: ___pointer_34["default"].start, set: ___pointer_34["default"].set, defaults: __defaults_34 }; var ___default_34 = restrictRect; _$rect_34["default"] = ___default_34; var _$size_35 = {}; "use strict"; Object.defineProperty(_$size_35, "__esModule", { value: true }); _$size_35["default"] = void 0; var ___extend_35 = ___interopRequireDefault_35(_$extend_53); var ___rect_35 = ___interopRequireDefault_35(_$rect_63); var _edges = ___interopRequireDefault_35(_$edges_32); function ___interopRequireDefault_35(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var noMin = { width: -Infinity, height: -Infinity }; var noMax = { width: +Infinity, height: +Infinity }; function __start_35(arg) { return _edges["default"].start(arg); } function __set_35(arg) { var interaction = arg.interaction, state = arg.state; var options = state.options; var edges = interaction.prepared._linkedEdges || interaction.prepared.edges; if (!edges) { return; } var rect = ___rect_35["default"].xywhToTlbr(interaction.resizeRects.inverted); var minSize = ___rect_35["default"].tlbrToXywh(_edges["default"].getRestrictionRect(options.min, interaction, arg.coords)) || noMin; var maxSize = ___rect_35["default"].tlbrToXywh(_edges["default"].getRestrictionRect(options.max, interaction, arg.coords)) || noMax; state.options = { endOnly: options.endOnly, inner: (0, ___extend_35["default"])({}, _edges["default"].noInner), outer: (0, ___extend_35["default"])({}, _edges["default"].noOuter) }; if (edges.top) { state.options.inner.top = rect.bottom - minSize.height; state.options.outer.top = rect.bottom - maxSize.height; } else if (edges.bottom) { state.options.inner.bottom = rect.top + minSize.height; state.options.outer.bottom = rect.top + maxSize.height; } if (edges.left) { state.options.inner.left = rect.right - minSize.width; state.options.outer.left = rect.right - maxSize.width; } else if (edges.right) { state.options.inner.right = rect.left + minSize.width; state.options.outer.right = rect.left + maxSize.width; } _edges["default"].set(arg); state.options = options; } var __defaults_35 = { min: null, max: null, endOnly: false, enabled: false }; var restrictSize = { start: __start_35, set: __set_35, defaults: __defaults_35 }; var ___default_35 = restrictSize; _$size_35["default"] = ___default_35; var _$pointer_37 = {}; "use strict"; Object.defineProperty(_$pointer_37, "__esModule", { value: true }); _$pointer_37["default"] = void 0; var __utils_37 = ___interopRequireWildcard_37(_$utils_56); function ___interopRequireWildcard_37(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function __start_37(arg) { var interaction = arg.interaction, interactable = arg.interactable, element = arg.element, rect = arg.rect, state = arg.state, startOffset = arg.startOffset; var options = state.options; var offsets = []; var origin = options.offsetWithOrigin ? getOrigin(arg) : { x: 0, y: 0 }; var snapOffset; if (options.offset === 'startCoords') { snapOffset = { x: interaction.coords.start.page.x, y: interaction.coords.start.page.y }; } else { var offsetRect = __utils_37.rect.resolveRectLike(options.offset, interactable, element, [interaction]); snapOffset = __utils_37.rect.rectToXY(offsetRect) || { x: 0, y: 0 }; snapOffset.x += origin.x; snapOffset.y += origin.y; } var relativePoints = options.relativePoints || []; if (rect && options.relativePoints && options.relativePoints.length) { for (var index = 0; index < relativePoints.length; index++) { var relativePoint = relativePoints[index]; offsets.push({ index: index, relativePoint: relativePoint, x: startOffset.left - rect.width * relativePoint.x + snapOffset.x, y: startOffset.top - rect.height * relativePoint.y + snapOffset.y }); } } else { offsets.push(__utils_37.extend({ index: 0, relativePoint: null }, snapOffset)); } state.offsets = offsets; } function __set_37(arg) { var interaction = arg.interaction, coords = arg.coords, state = arg.state; var options = state.options, offsets = state.offsets; var origin = __utils_37.getOriginXY(interaction.interactable, interaction.element, interaction.prepared.name); var page = __utils_37.extend({}, coords); var targets = []; var target; if (!options.offsetWithOrigin) { page.x -= origin.x; page.y -= origin.y; } state.realX = page.x; state.realY = page.y; for (var _i = 0; _i < offsets.length; _i++) { var _ref; _ref = offsets[_i]; var offset = _ref; var relativeX = page.x - offset.x; var relativeY = page.y - offset.y; for (var index = 0, _len = options.targets.length; index < _len; index++) { var snapTarget = options.targets[index]; if (__utils_37.is.func(snapTarget)) { target = snapTarget(relativeX, relativeY, interaction, offset, index); } else { target = snapTarget; } if (!target) { continue; } targets.push({ x: (__utils_37.is.number(target.x) ? target.x : relativeX) + offset.x, y: (__utils_37.is.number(target.y) ? target.y : relativeY) + offset.y, range: __utils_37.is.number(target.range) ? target.range : options.range }); } } var closest = { target: null, inRange: false, distance: 0, range: 0, dx: 0, dy: 0 }; for (var i = 0, len = targets.length; i < len; i++) { target = targets[i]; var range = target.range; var dx = target.x - page.x; var dy = target.y - page.y; var distance = __utils_37.hypot(dx, dy); var inRange = distance <= range; // Infinite targets count as being out of range // compared to non infinite ones that are in range if (range === Infinity && closest.inRange && closest.range !== Infinity) { inRange = false; } if (!closest.target || (inRange // is the closest target in range? ? closest.inRange && range !== Infinity // the pointer is relatively deeper in this target ? distance / range < closest.distance / closest.range // this target has Infinite range and the closest doesn't : range === Infinity && closest.range !== Infinity || // OR this target is closer that the previous closest distance < closest.distance : // The other is not in range and the pointer is closer to this target !closest.inRange && distance < closest.distance)) { closest.target = target; closest.distance = distance; closest.range = range; closest.inRange = inRange; closest.dx = dx; closest.dy = dy; state.range = range; } } if (closest.inRange) { coords.x = closest.target.x; coords.y = closest.target.y; } state.closest = closest; } function getOrigin(arg) { var optionsOrigin = __utils_37.rect.rectToXY(__utils_37.rect.resolveRectLike(arg.state.options.origin, [arg.interaction.element])); var origin = optionsOrigin || __utils_37.getOriginXY(arg.interactable, arg.interaction.element, arg.interaction.prepared.name); return origin; } var __defaults_37 = { range: Infinity, targets: null, offset: null, offsetWithOrigin: true, origin: null, relativePoints: null, endOnly: false, enabled: false }; var snap = { start: __start_37, set: __set_37, defaults: __defaults_37 }; var ___default_37 = snap; _$pointer_37["default"] = ___default_37; var _$size_38 = {}; "use strict"; Object.defineProperty(_$size_38, "__esModule", { value: true }); _$size_38["default"] = void 0; var ___extend_38 = ___interopRequireDefault_38(_$extend_53); var __is_38 = ___interopRequireWildcard_38(_$is_57); var ___pointer_38 = ___interopRequireDefault_38(_$pointer_37); function ___interopRequireWildcard_38(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function ___interopRequireDefault_38(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___slicedToArray_38(arr, i) { return ___arrayWithHoles_38(arr) || ___iterableToArrayLimit_38(arr, i) || ___nonIterableRest_38(); } function ___nonIterableRest_38() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } function ___iterableToArrayLimit_38(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function ___arrayWithHoles_38(arr) { if (Array.isArray(arr)) return arr; } function __start_38(arg) { var interaction = arg.interaction, state = arg.state; var options = state.options; var edges = interaction.prepared.edges; if (!edges) { return null; } arg.state = { options: { targets: null, relativePoints: [{ x: edges.left ? 0 : 1, y: edges.top ? 0 : 1 }], offset: options.offset || 'self', origin: { x: 0, y: 0 }, range: options.range } }; state.targetFields = state.targetFields || [['width', 'height'], ['x', 'y']]; ___pointer_38["default"].start(arg); state.offsets = arg.state.offsets; arg.state = state; } function __set_38(arg) { var interaction = arg.interaction, state = arg.state, coords = arg.coords; var options = state.options, offsets = state.offsets; var relative = { x: coords.x - offsets[0].x, y: coords.y - offsets[0].y }; state.options = (0, ___extend_38["default"])({}, options); state.options.targets = []; for (var _i = 0; _i < (options.targets || []).length; _i++) { var _ref; _ref = (options.targets || [])[_i]; var snapTarget = _ref; var target = void 0; if (__is_38.func(snapTarget)) { target = snapTarget(relative.x, relative.y, interaction); } else { target = snapTarget; } if (!target) { continue; } for (var _i2 = 0; _i2 < state.targetFields.length; _i2++) { var _ref2; _ref2 = state.targetFields[_i2]; var _ref3 = _ref2, _ref4 = ___slicedToArray_38(_ref3, 2), xField = _ref4[0], yField = _ref4[1]; if (xField in target || yField in target) { target.x = target[xField]; target.y = target[yField]; break; } } state.options.targets.push(target); } ___pointer_38["default"].set(arg); state.options = options; } var __defaults_38 = { range: Infinity, targets: null, offset: null, endOnly: false, enabled: false }; var snapSize = { start: __start_38, set: __set_38, defaults: __defaults_38 }; var ___default_38 = snapSize; _$size_38["default"] = ___default_38; var _$edges_36 = {}; "use strict"; Object.defineProperty(_$edges_36, "__esModule", { value: true }); _$edges_36["default"] = void 0; var ___clone_36 = ___interopRequireDefault_36(_$clone_49); var ___extend_36 = ___interopRequireDefault_36(_$extend_53); var _size = ___interopRequireDefault_36(_$size_38); function ___interopRequireDefault_36(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } /** * @module modifiers/snapEdges * * @description * This module allows snapping of the edges of targets during resize * interactions. * * @example * interact(target).resizable({ * snapEdges: { * targets: [interact.snappers.grid({ x: 100, y: 50 })], * }, * }) * * interact(target).resizable({ * snapEdges: { * targets: [ * interact.snappers.grid({ * top: 50, * left: 50, * bottom: 100, * right: 100, * }), * ], * }, * }) */ function __start_36(arg) { var edges = arg.interaction.prepared.edges; if (!edges) { return null; } arg.state.targetFields = arg.state.targetFields || [[edges.left ? 'left' : 'right', edges.top ? 'top' : 'bottom']]; return _size["default"].start(arg); } function __set_36(arg) { return _size["default"].set(arg); } var snapEdges = { start: __start_36, set: __set_36, defaults: (0, ___extend_36["default"])((0, ___clone_36["default"])(_size["default"].defaults), { offset: { x: 0, y: 0 } }) }; var ___default_36 = snapEdges; _$edges_36["default"] = ___default_36; var _$modifiers_31 = {}; "use strict"; Object.defineProperty(_$modifiers_31, "__esModule", { value: true }); _$modifiers_31.restrictSize = _$modifiers_31.restrictEdges = _$modifiers_31.restrictRect = _$modifiers_31.restrict = _$modifiers_31.snapEdges = _$modifiers_31.snapSize = _$modifiers_31.snap = void 0; var ___base_31 = ___interopRequireDefault_31(_$base_30); var ___edges_31 = ___interopRequireDefault_31(_$edges_32); var ___pointer_31 = ___interopRequireDefault_31(_$pointer_33); var ___rect_31 = ___interopRequireDefault_31(_$rect_34); var ___size_31 = ___interopRequireDefault_31(_$size_35); var _edges2 = ___interopRequireDefault_31(_$edges_36); var _pointer2 = ___interopRequireDefault_31(_$pointer_37); var _size2 = ___interopRequireDefault_31(_$size_38); function ___interopRequireDefault_31(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var __makeModifier_31 = ___base_31["default"].makeModifier; var __snap_31 = __makeModifier_31(_pointer2["default"], 'snap'); _$modifiers_31.snap = __snap_31; var __snapSize_31 = __makeModifier_31(_size2["default"], 'snapSize'); _$modifiers_31.snapSize = __snapSize_31; var __snapEdges_31 = __makeModifier_31(_edges2["default"], 'snapEdges'); _$modifiers_31.snapEdges = __snapEdges_31; var __restrict_31 = __makeModifier_31(___pointer_31["default"], 'restrict'); _$modifiers_31.restrict = __restrict_31; var __restrictRect_31 = __makeModifier_31(___rect_31["default"], 'restrictRect'); _$modifiers_31.restrictRect = __restrictRect_31; var __restrictEdges_31 = __makeModifier_31(___edges_31["default"], 'restrictEdges'); _$modifiers_31.restrictEdges = __restrictEdges_31; var __restrictSize_31 = __makeModifier_31(___size_31["default"], 'restrictSize'); _$modifiers_31.restrictSize = __restrictSize_31; var _$PointerEvent_39 = {}; "use strict"; Object.defineProperty(_$PointerEvent_39, "__esModule", { value: true }); _$PointerEvent_39["default"] = void 0; var ___BaseEvent2_39 = ___interopRequireDefault_39(_$BaseEvent_13); var ___pointerUtils_39 = ___interopRequireDefault_39(_$pointerUtils_61); function ___interopRequireDefault_39(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___typeof_39(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_39 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_39 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_39(obj); } function ___classCallCheck_39(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function ___defineProperties_39(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); } } function ___createClass_39(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_39(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_39(Constructor, staticProps); return Constructor; } function ___possibleConstructorReturn_39(self, call) { if (call && (___typeof_39(call) === "object" || typeof call === "function")) { return call; } return ___assertThisInitialized_39(self); } function ___getPrototypeOf_39(o) { ___getPrototypeOf_39 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ___getPrototypeOf_39(o); } function ___assertThisInitialized_39(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function ___inherits_39(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ___setPrototypeOf_39(subClass, superClass); } function ___setPrototypeOf_39(o, p) { ___setPrototypeOf_39 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ___setPrototypeOf_39(o, p); } /** */ var PointerEvent = /*#__PURE__*/ function (_BaseEvent) { ___inherits_39(PointerEvent, _BaseEvent); /** */ function PointerEvent(type, pointer, event, eventTarget, interaction, timeStamp) { var _this; ___classCallCheck_39(this, PointerEvent); _this = ___possibleConstructorReturn_39(this, ___getPrototypeOf_39(PointerEvent).call(this, interaction)); ___pointerUtils_39["default"].pointerExtend(___assertThisInitialized_39(_this), event); if (event !== pointer) { ___pointerUtils_39["default"].pointerExtend(___assertThisInitialized_39(_this), pointer); } _this.timeStamp = timeStamp; _this.originalEvent = event; _this.type = type; _this.pointerId = ___pointerUtils_39["default"].getPointerId(pointer); _this.pointerType = ___pointerUtils_39["default"].getPointerType(pointer); _this.target = eventTarget; _this.currentTarget = null; if (type === 'tap') { var pointerIndex = interaction.getPointerIndex(pointer); _this.dt = _this.timeStamp - interaction.pointers[pointerIndex].downTime; var interval = _this.timeStamp - interaction.tapTime; _this["double"] = !!(interaction.prevTap && interaction.prevTap.type !== 'doubletap' && interaction.prevTap.target === _this.target && interval < 500); } else if (type === 'doubletap') { _this.dt = pointer.timeStamp - interaction.tapTime; } return _this; } ___createClass_39(PointerEvent, [{ key: "_subtractOrigin", value: function _subtractOrigin(_ref) { var originX = _ref.x, originY = _ref.y; this.pageX -= originX; this.pageY -= originY; this.clientX -= originX; this.clientY -= originY; return this; } }, { key: "_addOrigin", value: function _addOrigin(_ref2) { var originX = _ref2.x, originY = _ref2.y; this.pageX += originX; this.pageY += originY; this.clientX += originX; this.clientY += originY; return this; } /** * Prevent the default behaviour of the original Event */ }, { key: "preventDefault", value: function preventDefault() { this.originalEvent.preventDefault(); } }]); return PointerEvent; }(___BaseEvent2_39["default"]); _$PointerEvent_39["default"] = PointerEvent; var _$base_40 = {}; "use strict"; Object.defineProperty(_$base_40, "__esModule", { value: true }); _$base_40["default"] = void 0; var __utils_40 = ___interopRequireWildcard_40(_$utils_56); var _PointerEvent = ___interopRequireDefault_40(_$PointerEvent_39); function ___interopRequireDefault_40(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___interopRequireWildcard_40(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } var signals = new __utils_40.Signals(); var simpleSignals = ['down', 'up', 'cancel']; var simpleEvents = ['down', 'up', 'cancel']; var __defaults_40 = { holdDuration: 600, ignoreFrom: null, allowFrom: null, origin: { x: 0, y: 0 } }; var pointerEvents = { id: 'pointer-events/base', install: __install_40, signals: signals, PointerEvent: _PointerEvent["default"], fire: fire, collectEventTargets: collectEventTargets, createSignalListener: createSignalListener, defaults: __defaults_40, types: ['down', 'move', 'up', 'cancel', 'tap', 'doubletap', 'hold'] }; function fire(arg, scope) { var interaction = arg.interaction, pointer = arg.pointer, event = arg.event, eventTarget = arg.eventTarget, _arg$type = arg.type, type = _arg$type === void 0 ? arg.pointerEvent.type : _arg$type, _arg$targets = arg.targets, targets = _arg$targets === void 0 ? collectEventTargets(arg) : _arg$targets; var _arg$pointerEvent = arg.pointerEvent, pointerEvent = _arg$pointerEvent === void 0 ? new _PointerEvent["default"](type, pointer, event, eventTarget, interaction, scope.now()) : _arg$pointerEvent; var signalArg = { interaction: interaction, pointer: pointer, event: event, eventTarget: eventTarget, targets: targets, type: type, pointerEvent: pointerEvent }; for (var i = 0; i < targets.length; i++) { var target = targets[i]; for (var prop in target.props || {}) { pointerEvent[prop] = target.props[prop]; } var origin = __utils_40.getOriginXY(target.eventable, target.node); pointerEvent._subtractOrigin(origin); pointerEvent.eventable = target.eventable; pointerEvent.currentTarget = target.node; target.eventable.fire(pointerEvent); pointerEvent._addOrigin(origin); if (pointerEvent.immediatePropagationStopped || pointerEvent.propagationStopped && i + 1 < targets.length && targets[i + 1].node !== pointerEvent.currentTarget) { break; } } signals.fire('fired', signalArg); if (type === 'tap') { // if pointerEvent should make a double tap, create and fire a doubletap // PointerEvent and use that as the prevTap var prevTap = pointerEvent["double"] ? fire({ interaction: interaction, pointer: pointer, event: event, eventTarget: eventTarget, type: 'doubletap' }, scope) : pointerEvent; interaction.prevTap = prevTap; interaction.tapTime = prevTap.timeStamp; } return pointerEvent; } function collectEventTargets(_ref) { var interaction = _ref.interaction, pointer = _ref.pointer, event = _ref.event, eventTarget = _ref.eventTarget, type = _ref.type; var pointerIndex = interaction.getPointerIndex(pointer); var pointerInfo = interaction.pointers[pointerIndex]; // do not fire a tap event if the pointer was moved before being lifted if (type === 'tap' && (interaction.pointerWasMoved || // or if the pointerup target is different to the pointerdown target !(pointerInfo && pointerInfo.downTarget === eventTarget))) { return []; } var path = __utils_40.dom.getPath(eventTarget); var signalArg = { interaction: interaction, pointer: pointer, event: event, eventTarget: eventTarget, type: type, path: path, targets: [], node: null }; for (var _i = 0; _i < path.length; _i++) { var _ref2; _ref2 = path[_i]; var node = _ref2; signalArg.node = node; signals.fire('collect-targets', signalArg); } if (type === 'hold') { signalArg.targets = signalArg.targets.filter(function (target) { return target.eventable.options.holdDuration === interaction.pointers[pointerIndex].hold.duration; }); } return signalArg.targets; } function __install_40(scope) { var interactions = scope.interactions; scope.pointerEvents = pointerEvents; scope.defaults.actions.pointerEvents = pointerEvents.defaults; interactions.signals.on('new', function (_ref3) { var interaction = _ref3.interaction; interaction.prevTap = null; // the most recent tap event on this interaction interaction.tapTime = 0; // time of the most recent tap event }); interactions.signals.on('update-pointer', function (_ref4) { var down = _ref4.down, pointerInfo = _ref4.pointerInfo; if (!down && pointerInfo.hold) { return; } pointerInfo.hold = { duration: Infinity, timeout: null }; }); interactions.signals.on('move', function (_ref5) { var interaction = _ref5.interaction, pointer = _ref5.pointer, event = _ref5.event, eventTarget = _ref5.eventTarget, duplicateMove = _ref5.duplicateMove; var pointerIndex = interaction.getPointerIndex(pointer); if (!duplicateMove && (!interaction.pointerIsDown || interaction.pointerWasMoved)) { if (interaction.pointerIsDown) { clearTimeout(interaction.pointers[pointerIndex].hold.timeout); } fire({ interaction: interaction, pointer: pointer, event: event, eventTarget: eventTarget, type: 'move' }, scope); } }); interactions.signals.on('down', function (_ref6) { var interaction = _ref6.interaction, pointer = _ref6.pointer, event = _ref6.event, eventTarget = _ref6.eventTarget, pointerIndex = _ref6.pointerIndex; var timer = interaction.pointers[pointerIndex].hold; var path = __utils_40.dom.getPath(eventTarget); var signalArg = { interaction: interaction, pointer: pointer, event: event, eventTarget: eventTarget, type: 'hold', targets: [], path: path, node: null }; for (var _i2 = 0; _i2 < path.length; _i2++) { var _ref7; _ref7 = path[_i2]; var node = _ref7; signalArg.node = node; signals.fire('collect-targets', signalArg); } if (!signalArg.targets.length) { return; } var minDuration = Infinity; for (var _i3 = 0; _i3 < signalArg.targets.length; _i3++) { var _ref8; _ref8 = signalArg.targets[_i3]; var target = _ref8; var holdDuration = target.eventable.options.holdDuration; if (holdDuration < minDuration) { minDuration = holdDuration; } } timer.duration = minDuration; timer.timeout = setTimeout(function () { fire({ interaction: interaction, eventTarget: eventTarget, pointer: pointer, event: event, type: 'hold' }, scope); }, minDuration); }); var _arr = ['up', 'cancel']; for (var _i4 = 0; _i4 < _arr.length; _i4++) { var signalName = _arr[_i4]; interactions.signals.on(signalName, function (_ref10) { var interaction = _ref10.interaction, pointerIndex = _ref10.pointerIndex; if (interaction.pointers[pointerIndex].hold) { clearTimeout(interaction.pointers[pointerIndex].hold.timeout); } }); } for (var i = 0; i < simpleSignals.length; i++) { interactions.signals.on(simpleSignals[i], createSignalListener(simpleEvents[i], scope)); } interactions.signals.on('up', function (_ref9) { var interaction = _ref9.interaction, pointer = _ref9.pointer, event = _ref9.event, eventTarget = _ref9.eventTarget; if (!interaction.pointerWasMoved) { fire({ interaction: interaction, eventTarget: eventTarget, pointer: pointer, event: event, type: 'tap' }, scope); } }); } function createSignalListener(type, scope) { return function (_ref11) { var interaction = _ref11.interaction, pointer = _ref11.pointer, event = _ref11.event, eventTarget = _ref11.eventTarget; fire({ interaction: interaction, eventTarget: eventTarget, pointer: pointer, event: event, type: type }, scope); }; } var ___default_40 = pointerEvents; _$base_40["default"] = ___default_40; var _$holdRepeat_41 = {}; "use strict"; Object.defineProperty(_$holdRepeat_41, "__esModule", { value: true }); _$holdRepeat_41["default"] = void 0; var ___base_41 = ___interopRequireDefault_41(_$base_40); function ___interopRequireDefault_41(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function __install_41(scope) { var pointerEvents = scope.pointerEvents, interactions = scope.interactions; scope.usePlugin(___base_41["default"]); pointerEvents.signals.on('new', onNew); pointerEvents.signals.on('fired', function (arg) { return onFired(arg, scope); }); var _arr = ['move', 'up', 'cancel', 'endall']; for (var _i = 0; _i < _arr.length; _i++) { var signal = _arr[_i]; interactions.signals.on(signal, endHoldRepeat); } // don't repeat by default pointerEvents.defaults.holdRepeatInterval = 0; pointerEvents.types.push('holdrepeat'); } function onNew(_ref) { var pointerEvent = _ref.pointerEvent; if (pointerEvent.type !== 'hold') { return; } pointerEvent.count = (pointerEvent.count || 0) + 1; } function onFired(_ref2, scope) { var interaction = _ref2.interaction, pointerEvent = _ref2.pointerEvent, eventTarget = _ref2.eventTarget, targets = _ref2.targets; if (pointerEvent.type !== 'hold' || !targets.length) { return; } // get the repeat interval from the first eventable var interval = targets[0].eventable.options.holdRepeatInterval; // don't repeat if the interval is 0 or less if (interval <= 0) { return; } // set a timeout to fire the holdrepeat event interaction.holdIntervalHandle = setTimeout(function () { scope.pointerEvents.fire({ interaction: interaction, eventTarget: eventTarget, type: 'hold', pointer: pointerEvent, event: pointerEvent }, scope); }, interval); } function endHoldRepeat(_ref3) { var interaction = _ref3.interaction; // set the interaction's holdStopTime property // to stop further holdRepeat events if (interaction.holdIntervalHandle) { clearInterval(interaction.holdIntervalHandle); interaction.holdIntervalHandle = null; } } var ___default_41 = { id: 'pointer-events/holdRepeat', install: __install_41 }; _$holdRepeat_41["default"] = ___default_41; var _$interactableTargets_43 = {}; "use strict"; Object.defineProperty(_$interactableTargets_43, "__esModule", { value: true }); _$interactableTargets_43["default"] = void 0; /* removed: var _$arr_47 = require("@interactjs/utils/arr"); */; var ___extend_43 = ___interopRequireDefault_43(_$extend_53); function ___interopRequireDefault_43(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function __install_43(scope) { var pointerEvents = scope.pointerEvents, actions = scope.actions, Interactable = scope.Interactable, interactables = scope.interactables; pointerEvents.signals.on('collect-targets', function (_ref) { var targets = _ref.targets, node = _ref.node, type = _ref.type, eventTarget = _ref.eventTarget; scope.interactables.forEachMatch(node, function (interactable) { var eventable = interactable.events; var options = eventable.options; if (eventable.types[type] && eventable.types[type].length && interactable.testIgnoreAllow(options, node, eventTarget)) { targets.push({ node: node, eventable: eventable, props: { interactable: interactable } }); } }); }); interactables.signals.on('new', function (_ref2) { var interactable = _ref2.interactable; interactable.events.getRect = function (element) { return interactable.getRect(element); }; }); interactables.signals.on('set', function (_ref3) { var interactable = _ref3.interactable, options = _ref3.options; (0, ___extend_43["default"])(interactable.events.options, pointerEvents.defaults); (0, ___extend_43["default"])(interactable.events.options, options.pointerEvents || {}); }); (0, _$arr_47.merge)(actions.eventTypes, pointerEvents.types); Interactable.prototype.pointerEvents = pointerEventsMethod; var __backCompatOption = Interactable.prototype._backCompatOption; Interactable.prototype._backCompatOption = function (optionName, newValue) { var ret = __backCompatOption.call(this, optionName, newValue); if (ret === this) { this.events.options[optionName] = newValue; } return ret; }; } function pointerEventsMethod(options) { (0, ___extend_43["default"])(this.events.options, options); return this; } var ___default_43 = { id: 'pointer-events/interactableTargets', install: __install_43 }; _$interactableTargets_43["default"] = ___default_43; var _$pointerEvents_42 = {}; "use strict"; Object.defineProperty(_$pointerEvents_42, "__esModule", { value: true }); _$pointerEvents_42.install = __install_42; Object.defineProperty(_$pointerEvents_42, "pointerEvents", { enumerable: true, get: function get() { return ___base_42["default"]; } }); Object.defineProperty(_$pointerEvents_42, "holdRepeat", { enumerable: true, get: function get() { return _holdRepeat["default"]; } }); Object.defineProperty(_$pointerEvents_42, "interactableTargets", { enumerable: true, get: function get() { return _interactableTargets["default"]; } }); _$pointerEvents_42.id = void 0; var ___base_42 = ___interopRequireDefault_42(_$base_40); var _holdRepeat = ___interopRequireDefault_42(_$holdRepeat_41); var _interactableTargets = ___interopRequireDefault_42(_$interactableTargets_43); function ___interopRequireDefault_42(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function __install_42(scope) { scope.usePlugin(___base_42["default"]); scope.usePlugin(_holdRepeat["default"]); scope.usePlugin(_interactableTargets["default"]); } var __id_42 = 'pointer-events'; _$pointerEvents_42.id = __id_42; var _$reflow_44 = {}; "use strict"; Object.defineProperty(_$reflow_44, "__esModule", { value: true }); _$reflow_44.install = __install_44; _$reflow_44["default"] = void 0; /* removed: var _$InteractEvent_15 = require("@interactjs/core/InteractEvent"); */; /* removed: var _$utils_56 = require("@interactjs/utils"); */; _$InteractEvent_15.EventPhase.Reflow = 'reflow'; function __install_44(scope) { var actions = scope.actions, interactions = scope.interactions, Interactable = scope.Interactable; // add action reflow event types for (var _i = 0; _i < actions.names.length; _i++) { var _ref; _ref = actions.names[_i]; var actionName = _ref; actions.eventTypes.push("".concat(actionName, "reflow")); } // remove completed reflow interactions interactions.signals.on('stop', function (_ref2) { var interaction = _ref2.interaction; if (interaction.pointerType === _$InteractEvent_15.EventPhase.Reflow) { if (interaction._reflowResolve) { interaction._reflowResolve(); } _$utils_56.arr.remove(scope.interactions.list, interaction); } }); /** * ```js * const interactable = interact(target) * const drag = { name: drag, axis: 'x' } * const resize = { name: resize, edges: { left: true, bottom: true } * * interactable.reflow(drag) * interactable.reflow(resize) * ``` * * Start an action sequence to re-apply modifiers, check drops, etc. * * @param { Object } action The action to begin * @param { string } action.name The name of the action * @returns { Promise } */ Interactable.prototype.reflow = function (action) { return reflow(this, action, scope); }; } function reflow(interactable, action, scope) { var elements = _$utils_56.is.string(interactable.target) ? _$utils_56.arr.from(interactable._context.querySelectorAll(interactable.target)) : [interactable.target]; // tslint:disable-next-line variable-name var Promise = _$utils_56.win.window.Promise; var promises = Promise ? [] : null; var _loop = function _loop() { _ref3 = elements[_i2]; var element = _ref3; var rect = interactable.getRect(element); if (!rect) { return "break"; } var runningInteraction = _$utils_56.arr.find(scope.interactions.list, function (interaction) { return interaction.interacting() && interaction.interactable === interactable && interaction.element === element && interaction.prepared.name === action.name; }); var reflowPromise = void 0; if (runningInteraction) { runningInteraction.move(); if (promises) { reflowPromise = runningInteraction._reflowPromise || new Promise(function (resolve) { runningInteraction._reflowResolve = resolve; }); } } else { var xywh = _$utils_56.rect.tlbrToXywh(rect); var coords = { page: { x: xywh.x, y: xywh.y }, client: { x: xywh.x, y: xywh.y }, timeStamp: scope.now() }; var event = _$utils_56.pointer.coordsToEvent(coords); reflowPromise = startReflow(scope, interactable, element, action, event); } if (promises) { promises.push(reflowPromise); } }; for (var _i2 = 0; _i2 < elements.length; _i2++) { var _ref3; var _ret = _loop(); if (_ret === "break") break; } return promises && Promise.all(promises).then(function () { return interactable; }); } function startReflow(scope, interactable, element, action, event) { var interaction = scope.interactions["new"]({ pointerType: 'reflow' }); var signalArg = { interaction: interaction, event: event, pointer: event, eventTarget: element, phase: _$InteractEvent_15.EventPhase.Reflow }; interaction.interactable = interactable; interaction.element = element; interaction.prepared = (0, _$utils_56.extend)({}, action); interaction.prevEvent = event; interaction.updatePointer(event, event, element, true); interaction._doPhase(signalArg); var reflowPromise = _$utils_56.win.window.Promise ? new _$utils_56.win.window.Promise(function (resolve) { interaction._reflowResolve = resolve; }) : null; interaction._reflowPromise = reflowPromise; interaction.start(action, interactable, element); if (interaction._interacting) { interaction.move(signalArg); interaction.end(event); } else { interaction.stop(); } interaction.removePointer(event, event); interaction.pointerIsDown = false; return reflowPromise; } var ___default_44 = { id: 'reflow', install: __install_44 }; _$reflow_44["default"] = ___default_44; var _$interact_28 = {}; "use strict"; Object.defineProperty(_$interact_28, "__esModule", { value: true }); _$interact_28["default"] = _$interact_28.scope = _$interact_28.interact = void 0; var ___scope_28 = _$scope_24({}); var __utils_28 = ___interopRequireWildcard_28(_$utils_56); var ___browser_28 = ___interopRequireDefault_28(_$browser_48); var ___events_28 = ___interopRequireDefault_28(_$events_52); function ___interopRequireDefault_28(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___interopRequireWildcard_28(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } /** @module interact */ var globalEvents = {}; var scope = new ___scope_28.Scope(); /** * ```js * interact('#draggable').draggable(true) * * var rectables = interact('rect') * rectables * .gesturable(true) * .on('gesturemove', function (event) { * // ... * }) * ``` * * The methods of this variable can be used to set elements as interactables * and also to change various default settings. * * Calling it as a function and passing an element or a valid CSS selector * string returns an Interactable object which has various methods to configure * it. * * @global * * @param {Element | string} target The HTML or SVG Element to interact with * or CSS selector * @return {Interactable} */ _$interact_28.scope = scope; var interact = function interact(target, options) { var interactable = scope.interactables.get(target, options); if (!interactable) { interactable = scope.interactables["new"](target, options); interactable.events.global = globalEvents; } return interactable; }; /** * Use a plugin * * @alias module:interact.use * * @param {Object} plugin * @param {function} plugin.install * @return {interact} */ _$interact_28.interact = interact; interact.use = use; function use(plugin, options) { scope.usePlugin(plugin, options); return interact; } /** * Check if an element or selector has been set with the {@link interact} * function * * @alias module:interact.isSet * * @param {Element} element The Element being searched for * @return {boolean} Indicates if the element or CSS selector was previously * passed to interact */ interact.isSet = isSet; function isSet(target, options) { return !!scope.interactables.get(target, options && options.context); } /** * Add a global listener for an InteractEvent or adds a DOM event to `document` * * @alias module:interact.on * * @param {string | array | object} type The types of events to listen for * @param {function} listener The function event (s) * @param {object | boolean} [options] object or useCapture flag for * addEventListener * @return {object} interact */ interact.on = on; function on(type, listener, options) { if (__utils_28.is.string(type) && type.search(' ') !== -1) { type = type.trim().split(/ +/); } if (__utils_28.is.array(type)) { for (var _i = 0; _i < type.length; _i++) { var _ref; _ref = type[_i]; var eventType = _ref; interact.on(eventType, listener, options); } return interact; } if (__utils_28.is.object(type)) { for (var prop in type) { interact.on(prop, type[prop], listener); } return interact; } // if it is an InteractEvent type, add listener to globalEvents if (__utils_28.arr.contains(scope.actions.eventTypes, type)) { // if this type of event was never bound if (!globalEvents[type]) { globalEvents[type] = [listener]; } else { globalEvents[type].push(listener); } } // If non InteractEvent type, addEventListener to document else { ___events_28["default"].add(scope.document, type, listener, { options: options }); } return interact; } /** * Removes a global InteractEvent listener or DOM event from `document` * * @alias module:interact.off * * @param {string | array | object} type The types of events that were listened * for * @param {function} listener The listener function to be removed * @param {object | boolean} options [options] object or useCapture flag for * removeEventListener * @return {object} interact */ interact.off = off; function off(type, listener, options) { if (__utils_28.is.string(type) && type.search(' ') !== -1) { type = type.trim().split(/ +/); } if (__utils_28.is.array(type)) { for (var _i2 = 0; _i2 < type.length; _i2++) { var _ref2; _ref2 = type[_i2]; var eventType = _ref2; interact.off(eventType, listener, options); } return interact; } if (__utils_28.is.object(type)) { for (var prop in type) { interact.off(prop, type[prop], listener); } return interact; } if (!__utils_28.arr.contains(scope.actions.eventTypes, type)) { ___events_28["default"].remove(scope.document, type, listener, options); } else { var index; if (type in globalEvents && (index = globalEvents[type].indexOf(listener)) !== -1) { globalEvents[type].splice(index, 1); } } return interact; } /** * Returns an object which exposes internal data * @alias module:interact.debug * * @return {object} An object with properties that outline the current state * and expose internal functions and variables */ interact.debug = debug; function debug() { return scope; } // expose the functions used to calculate multi-touch properties interact.getPointerAverage = __utils_28.pointer.pointerAverage; interact.getTouchBBox = __utils_28.pointer.touchBBox; interact.getTouchDistance = __utils_28.pointer.touchDistance; interact.getTouchAngle = __utils_28.pointer.touchAngle; interact.getElementRect = __utils_28.dom.getElementRect; interact.getElementClientRect = __utils_28.dom.getElementClientRect; interact.matchesSelector = __utils_28.dom.matchesSelector; interact.closest = __utils_28.dom.closest; /** * @alias module:interact.supportsTouch * * @return {boolean} Whether or not the browser supports touch input */ interact.supportsTouch = supportsTouch; function supportsTouch() { return ___browser_28["default"].supportsTouch; } /** * @alias module:interact.supportsPointerEvent * * @return {boolean} Whether or not the browser supports PointerEvents */ interact.supportsPointerEvent = supportsPointerEvent; function supportsPointerEvent() { return ___browser_28["default"].supportsPointerEvent; } /** * Cancels all interactions (end events are not fired) * * @alias module:interact.stop * * @return {object} interact */ interact.stop = __stop_28; function __stop_28() { for (var _i3 = 0; _i3 < scope.interactions.list.length; _i3++) { var _ref3; _ref3 = scope.interactions.list[_i3]; var interaction = _ref3; interaction.stop(); } return interact; } /** * Returns or sets the distance the pointer must be moved before an action * sequence occurs. This also affects tolerance for tap events. * * @alias module:interact.pointerMoveTolerance * * @param {number} [newValue] The movement from the start position must be greater than this value * @return {interact | number} */ interact.pointerMoveTolerance = pointerMoveTolerance; function pointerMoveTolerance(newValue) { if (__utils_28.is.number(newValue)) { scope.interactions.pointerMoveTolerance = newValue; return interact; } return scope.interactions.pointerMoveTolerance; } scope.interactables.signals.on('unset', function (_ref4) { var interactable = _ref4.interactable; scope.interactables.list.splice(scope.interactables.list.indexOf(interactable), 1); // Stop related interactions when an Interactable is unset for (var _i4 = 0; _i4 < scope.interactions.list.length; _i4++) { var _ref5; _ref5 = scope.interactions.list[_i4]; var interaction = _ref5; if (interaction.interactable === interactable && interaction.interacting() && !interaction._ending) { interaction.stop(); } } }); interact.addDocument = function (doc, options) { return scope.addDocument(doc, options); }; interact.removeDocument = function (doc) { return scope.removeDocument(doc); }; scope.interact = interact; var ___default_28 = interact; _$interact_28["default"] = ___default_28; var _$interact_27 = {}; "use strict"; Object.defineProperty(_$interact_27, "__esModule", { value: true }); _$interact_27.init = __init_27; Object.defineProperty(_$interact_27, "autoScroll", { enumerable: true, get: function get() { return _autoScroll["default"]; } }); Object.defineProperty(_$interact_27, "interactablePreventDefault", { enumerable: true, get: function get() { return _interactablePreventDefault["default"]; } }); Object.defineProperty(_$interact_27, "inertia", { enumerable: true, get: function get() { return _inertia["default"]; } }); Object.defineProperty(_$interact_27, "modifiers", { enumerable: true, get: function get() { return ___base_27["default"]; } }); Object.defineProperty(_$interact_27, "reflow", { enumerable: true, get: function get() { return _reflow["default"]; } }); Object.defineProperty(_$interact_27, "interact", { enumerable: true, get: function get() { return _interact["default"]; } }); _$interact_27.pointerEvents = _$interact_27.actions = _$interact_27["default"] = void 0; var actions = ___interopRequireWildcard_27(_$actions_5); _$interact_27.actions = actions; var _autoScroll = ___interopRequireDefault_27(_$autoScroll_7); var autoStart = ___interopRequireWildcard_27(_$autoStart_12); var _interactablePreventDefault = ___interopRequireDefault_27(_$interactablePreventDefault_21); var _devTools = ___interopRequireDefault_27(_$devTools_25); var _inertia = ___interopRequireDefault_27(_$inertia_26); var modifiers = ___interopRequireWildcard_27(_$modifiers_31); var ___base_27 = ___interopRequireDefault_27(_$base_30); var __pointerEvents_27 = ___interopRequireWildcard_27(_$pointerEvents_42); _$interact_27.pointerEvents = __pointerEvents_27; var _reflow = ___interopRequireDefault_27(_$reflow_44); var _interact = ___interopRequireWildcard_27(_$interact_28); function ___interopRequireDefault_27(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___interopRequireWildcard_27(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function __init_27(window) { _interact.scope.init(window); _interact["default"].use(_interactablePreventDefault["default"]); // pointerEvents _interact["default"].use(__pointerEvents_27); // inertia _interact["default"].use(_inertia["default"]); // autoStart, hold _interact["default"].use(autoStart); // drag and drop, resize, gesture _interact["default"].use(actions); // snap, resize, etc. _interact["default"].use(___base_27["default"]); // for backwrads compatibility for (var type in modifiers) { var _modifiers$type = modifiers[type], _defaults = _modifiers$type._defaults, _methods = _modifiers$type._methods; _defaults._methods = _methods; _interact.scope.defaults.perAction[type] = _defaults; } // autoScroll _interact["default"].use(_autoScroll["default"]); // reflow _interact["default"].use(_reflow["default"]); // eslint-disable-next-line no-undef if (false) {} return _interact["default"]; } // eslint-disable-next-line no-undef _interact["default"].version = "1.5.4"; var ___default_27 = _interact["default"]; _$interact_27["default"] = ___default_27; var _$types_45 = {}; /// "use strict"; var _$grid_64 = {}; "use strict"; Object.defineProperty(_$grid_64, "__esModule", { value: true }); _$grid_64["default"] = void 0; function ___slicedToArray_64(arr, i) { return ___arrayWithHoles_64(arr) || ___iterableToArrayLimit_64(arr, i) || ___nonIterableRest_64(); } function ___nonIterableRest_64() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } function ___iterableToArrayLimit_64(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function ___arrayWithHoles_64(arr) { if (Array.isArray(arr)) return arr; } function createGrid(grid) { var coordFields = [['x', 'y'], ['left', 'top'], ['right', 'bottom'], ['width', 'height']].filter(function (_ref) { var _ref2 = ___slicedToArray_64(_ref, 2), xField = _ref2[0], yField = _ref2[1]; return xField in grid || yField in grid; }); return function (x, y) { var range = grid.range, _grid$limits = grid.limits, limits = _grid$limits === void 0 ? { left: -Infinity, right: Infinity, top: -Infinity, bottom: Infinity } : _grid$limits, _grid$offset = grid.offset, offset = _grid$offset === void 0 ? { x: 0, y: 0 } : _grid$offset; var result = { range: range }; for (var _i2 = 0; _i2 < coordFields.length; _i2++) { var _ref3; _ref3 = coordFields[_i2]; var _ref4 = _ref3, _ref5 = ___slicedToArray_64(_ref4, 2), xField = _ref5[0], yField = _ref5[1]; var gridx = Math.round((x - offset.x) / grid[xField]); var gridy = Math.round((y - offset.y) / grid[yField]); result[xField] = Math.max(limits.left, Math.min(limits.right, gridx * grid[xField] + offset.x)); result[yField] = Math.max(limits.top, Math.min(limits.bottom, gridy * grid[yField] + offset.y)); } return result; }; } var ___default_64 = createGrid; _$grid_64["default"] = ___default_64; var _$snappers_65 = {}; "use strict"; Object.defineProperty(_$snappers_65, "__esModule", { value: true }); Object.defineProperty(_$snappers_65, "grid", { enumerable: true, get: function get() { return _grid["default"]; } }); var _grid = ___interopRequireDefault_65(_$grid_64); function ___interopRequireDefault_65(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var _$index_29 = { exports: {} }; "use strict"; Object.defineProperty(_$index_29.exports, "__esModule", { value: true }); _$index_29.exports.init = __init_29; _$index_29.exports["default"] = void 0; var ___interact_29 = ___interopRequireWildcard_29(_$interact_27); var __modifiers_29 = ___interopRequireWildcard_29(_$modifiers_31); _$types_45; var ___extend_29 = ___interopRequireDefault_29(_$extend_53); var snappers = ___interopRequireWildcard_29(_$snappers_65); function ___interopRequireDefault_29(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ___interopRequireWildcard_29(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } function ___typeof_29(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_29 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_29 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_29(obj); } if ((typeof window === "undefined" ? "undefined" : ___typeof_29(window)) === 'object' && !!window) { __init_29(window); } function __init_29(win) { (0, ___interact_29.init)(win); return ___interact_29["default"].use({ id: 'interactjs', install: function install() { ___interact_29["default"].modifiers = (0, ___extend_29["default"])({}, __modifiers_29); ___interact_29["default"].snappers = snappers; ___interact_29["default"].createSnapGrid = ___interact_29["default"].snappers.grid; } }); } var ___default_29 = ___interact_29["default"]; _$index_29.exports["default"] = ___default_29; ___interact_29["default"]['default'] = ___interact_29["default"]; // tslint:disable-line no-string-literal ___interact_29["default"]['init'] = __init_29; // tslint:disable-line no-string-literal if (( false ? undefined : ___typeof_29(_$index_29)) === 'object' && !!_$index_29) { _$index_29.exports = ___interact_29["default"]; } _$index_29 = _$index_29.exports return _$index_29; }); //# sourceMappingURL=interact.js.map /***/ }), /***/ "./node_modules/invariant/invariant.js": /*!*********************************************!*\ !*** ./node_modules/invariant/invariant.js ***! \*********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /** * Use invariant() to assert state which your program assumes to be true. * * Provide sprintf-style format (only %s is supported) and arguments * to provide information about what broke and what you were * expecting. * * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production. */ var NODE_ENV = "development"; var invariant = function(condition, format, a, b, c, d, e, f) { if (NODE_ENV !== 'production') { if (format === undefined) { throw new Error('invariant requires an error message argument'); } } if (!condition) { var error; if (format === undefined) { error = new Error( 'Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.' ); } else { var args = [a, b, c, d, e, f]; var argIndex = 0; error = new Error( format.replace(/%s/g, function() { return args[argIndex++]; }) ); error.name = 'Invariant Violation'; } error.framesToPop = 1; // we don't care about invariant's own frame throw error; } }; module.exports = invariant; /***/ }), /***/ "./node_modules/object-assign/index.js": /*!*********************************************!*\ !*** ./node_modules/object-assign/index.js ***! \*********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* object-assign (c) Sindre Sorhus @license MIT */ /* eslint-disable no-unused-vars */ var getOwnPropertySymbols = Object.getOwnPropertySymbols; var hasOwnProperty = Object.prototype.hasOwnProperty; var propIsEnumerable = Object.prototype.propertyIsEnumerable; function toObject(val) { if (val === null || val === undefined) { throw new TypeError('Object.assign cannot be called with null or undefined'); } return Object(val); } function shouldUseNative() { try { if (!Object.assign) { return false; } // Detect buggy property enumeration order in older V8 versions. // https://bugs.chromium.org/p/v8/issues/detail?id=4118 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers test1[5] = 'de'; if (Object.getOwnPropertyNames(test1)[0] === '5') { return false; } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test2 = {}; for (var i = 0; i < 10; i++) { test2['_' + String.fromCharCode(i)] = i; } var order2 = Object.getOwnPropertyNames(test2).map(function (n) { return test2[n]; }); if (order2.join('') !== '0123456789') { return false; } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test3 = {}; 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { test3[letter] = letter; }); if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') { return false; } return true; } catch (err) { // We don't expect any of the above to throw, but better to be safe. return false; } } module.exports = shouldUseNative() ? Object.assign : function (target, source) { var from; var to = toObject(target); var symbols; for (var s = 1; s < arguments.length; s++) { from = Object(arguments[s]); for (var key in from) { if (hasOwnProperty.call(from, key)) { to[key] = from[key]; } } if (getOwnPropertySymbols) { symbols = getOwnPropertySymbols(from); for (var i = 0; i < symbols.length; i++) { if (propIsEnumerable.call(from, symbols[i])) { to[symbols[i]] = from[symbols[i]]; } } } } return to; }; /***/ }), /***/ "./node_modules/optimism/lib/bundle.esm.js": /*!*************************************************!*\ !*** ./node_modules/optimism/lib/bundle.esm.js ***! \*************************************************/ /*! exports provided: asyncFromGen, bindContext, noContext, setTimeout, KeyTrie, defaultMakeCacheKey, wrap */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyTrie", function() { return KeyTrie; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultMakeCacheKey", function() { return defaultMakeCacheKey; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrap", function() { return wrap; }); /* harmony import */ var _wry_context__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wry/context */ "./node_modules/@wry/context/lib/context.esm.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "asyncFromGen", function() { return _wry_context__WEBPACK_IMPORTED_MODULE_0__["asyncFromGen"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bindContext", function() { return _wry_context__WEBPACK_IMPORTED_MODULE_0__["bind"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "noContext", function() { return _wry_context__WEBPACK_IMPORTED_MODULE_0__["noContext"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setTimeout", function() { return _wry_context__WEBPACK_IMPORTED_MODULE_0__["setTimeout"]; }); function defaultDispose() { } var Cache = /** @class */ (function () { function Cache(max, dispose) { if (max === void 0) { max = Infinity; } if (dispose === void 0) { dispose = defaultDispose; } this.max = max; this.dispose = dispose; this.map = new Map(); this.newest = null; this.oldest = null; } Cache.prototype.has = function (key) { return this.map.has(key); }; Cache.prototype.get = function (key) { var entry = this.getEntry(key); return entry && entry.value; }; Cache.prototype.getEntry = function (key) { var entry = this.map.get(key); if (entry && entry !== this.newest) { var older = entry.older, newer = entry.newer; if (newer) { newer.older = older; } if (older) { older.newer = newer; } entry.older = this.newest; entry.older.newer = entry; entry.newer = null; this.newest = entry; if (entry === this.oldest) { this.oldest = newer; } } return entry; }; Cache.prototype.set = function (key, value) { var entry = this.getEntry(key); if (entry) { return entry.value = value; } entry = { key: key, value: value, newer: null, older: this.newest }; if (this.newest) { this.newest.newer = entry; } this.newest = entry; this.oldest = this.oldest || entry; this.map.set(key, entry); return entry.value; }; Cache.prototype.clean = function () { while (this.oldest && this.map.size > this.max) { this.delete(this.oldest.key); } }; Cache.prototype.delete = function (key) { var entry = this.map.get(key); if (entry) { if (entry === this.newest) { this.newest = entry.older; } if (entry === this.oldest) { this.oldest = entry.newer; } if (entry.newer) { entry.newer.older = entry.older; } if (entry.older) { entry.older.newer = entry.newer; } this.map.delete(key); this.dispose(entry.value, key); return true; } return false; }; return Cache; }()); var parentEntrySlot = new _wry_context__WEBPACK_IMPORTED_MODULE_0__["Slot"](); var UNKNOWN_VALUE = Object.create(null); var reusableEmptyArray = []; var emptySetPool = []; var POOL_TARGET_SIZE = 100; // Since this package might be used browsers, we should avoid using the // Node built-in assert module. function assert(condition, optionalMessage) { if (!condition) { throw new Error(optionalMessage || "assertion failure"); } } var Entry = /** @class */ (function () { function Entry(fn, args) { this.fn = fn; this.args = args; this.parents = new Set(); this.childValues = new Map(); // When this Entry has children that are dirty, this property becomes // a Set containing other Entry objects, borrowed from emptySetPool. // When the set becomes empty, it gets recycled back to emptySetPool. this.dirtyChildren = null; this.dirty = true; this.recomputing = false; this.value = UNKNOWN_VALUE; ++Entry.count; } Entry.prototype.recompute = function () { if (!rememberParent(this) && maybeReportOrphan(this)) { // The recipient of the entry.reportOrphan callback decided to dispose // of this orphan entry by calling entry.dispose(), so we don't need to // (and should not) proceed with the recomputation. return void 0; } return recomputeIfDirty(this); }; Entry.prototype.setDirty = function () { if (this.dirty) return; this.dirty = true; this.value = UNKNOWN_VALUE; reportDirty(this); // We can go ahead and unsubscribe here, since any further dirty // notifications we receive will be redundant, and unsubscribing may // free up some resources, e.g. file watchers. maybeUnsubscribe(this); }; Entry.prototype.dispose = function () { var _this = this; forgetChildren(this).forEach(maybeReportOrphan); maybeUnsubscribe(this); // Because this entry has been kicked out of the cache (in index.js), // we've lost the ability to find out if/when this entry becomes dirty, // whether that happens through a subscription, because of a direct call // to entry.setDirty(), or because one of its children becomes dirty. // Because of this loss of future information, we have to assume the // worst (that this entry might have become dirty very soon), so we must // immediately mark this entry's parents as dirty. Normally we could // just call entry.setDirty() rather than calling parent.setDirty() for // each parent, but that would leave this entry in parent.childValues // and parent.dirtyChildren, which would prevent the child from being // truly forgotten. this.parents.forEach(function (parent) { parent.setDirty(); forgetChild(parent, _this); }); }; Entry.count = 0; return Entry; }()); function rememberParent(child) { var parent = parentEntrySlot.getValue(); if (parent) { child.parents.add(parent); if (!parent.childValues.has(child)) { parent.childValues.set(child, UNKNOWN_VALUE); } if (mightBeDirty(child)) { reportDirtyChild(parent, child); } else { reportCleanChild(parent, child); } return parent; } } // This is the most important method of the Entry API, because it // determines whether the cached entry.value can be returned immediately, // or must be recomputed. The overall performance of the caching system // depends on the truth of the following observations: (1) this.dirty is // usually false, (2) this.dirtyChildren is usually null/empty, and thus // (3) this.value is usally returned very quickly, without recomputation. function recomputeIfDirty(entry) { if (entry.dirty) { // If this Entry is explicitly dirty because someone called // entry.setDirty(), recompute. return reallyRecompute(entry); } if (mightBeDirty(entry)) { // Get fresh values for any dirty children, and if those values // disagree with this.childValues, mark this Entry explicitly dirty. entry.dirtyChildren.forEach(function (child) { assert(entry.childValues.has(child)); try { recomputeIfDirty(child); } catch (e) { entry.setDirty(); } }); if (entry.dirty) { // If this Entry has become explicitly dirty after comparing the fresh // values of its dirty children against this.childValues, recompute. return reallyRecompute(entry); } } assert(entry.value !== UNKNOWN_VALUE); return entry.value; } function reallyRecompute(entry) { assert(!entry.recomputing, "already recomputing"); entry.recomputing = true; // Since this recomputation is likely to re-remember some of this // entry's children, we forget our children here but do not call // maybeReportOrphan until after the recomputation finishes. var originalChildren = forgetChildren(entry); var threw = true; try { parentEntrySlot.withValue(entry, function () { entry.value = entry.fn.apply(null, entry.args); }); threw = false; } finally { entry.recomputing = false; if (threw || !maybeSubscribe(entry)) { // Mark this Entry dirty if entry.fn threw or we failed to // resubscribe. This is important because, if we have a subscribe // function and it failed, then we're going to miss important // notifications about the potential dirtiness of entry.value. entry.setDirty(); } else { // If we successfully recomputed entry.value and did not fail to // (re)subscribe, then this Entry is no longer explicitly dirty. setClean(entry); } } // Now that we've had a chance to re-remember any children that were // involved in the recomputation, we can safely report any orphan // children that remain. originalChildren.forEach(maybeReportOrphan); return entry.value; } function mightBeDirty(entry) { return entry.dirty || !!(entry.dirtyChildren && entry.dirtyChildren.size); } function setClean(entry) { entry.dirty = false; if (mightBeDirty(entry)) { // This Entry may still have dirty children, in which case we can't // let our parents know we're clean just yet. return; } reportClean(entry); } function reportDirty(child) { child.parents.forEach(function (parent) { return reportDirtyChild(parent, child); }); } function reportClean(child) { child.parents.forEach(function (parent) { return reportCleanChild(parent, child); }); } // Let a parent Entry know that one of its children may be dirty. function reportDirtyChild(parent, child) { // Must have called rememberParent(child) before calling // reportDirtyChild(parent, child). assert(parent.childValues.has(child)); assert(mightBeDirty(child)); if (!parent.dirtyChildren) { parent.dirtyChildren = emptySetPool.pop() || new Set; } else if (parent.dirtyChildren.has(child)) { // If we already know this child is dirty, then we must have already // informed our own parents that we are dirty, so we can terminate // the recursion early. return; } parent.dirtyChildren.add(child); reportDirty(parent); } // Let a parent Entry know that one of its children is no longer dirty. function reportCleanChild(parent, child) { // Must have called rememberChild(child) before calling // reportCleanChild(parent, child). assert(parent.childValues.has(child)); assert(!mightBeDirty(child)); var childValue = parent.childValues.get(child); if (childValue === UNKNOWN_VALUE) { parent.childValues.set(child, child.value); } else if (childValue !== child.value) { parent.setDirty(); } removeDirtyChild(parent, child); if (mightBeDirty(parent)) { return; } reportClean(parent); } function removeDirtyChild(parent, child) { var dc = parent.dirtyChildren; if (dc) { dc.delete(child); if (dc.size === 0) { if (emptySetPool.length < POOL_TARGET_SIZE) { emptySetPool.push(dc); } parent.dirtyChildren = null; } } } // If the given entry has a reportOrphan method, and no remaining parents, // call entry.reportOrphan and return true iff it returns true. The // reportOrphan function should return true to indicate entry.dispose() // has been called, and the entry has been removed from any other caches // (see index.js for the only current example). function maybeReportOrphan(entry) { return entry.parents.size === 0 && typeof entry.reportOrphan === "function" && entry.reportOrphan() === true; } // Removes all children from this entry and returns an array of the // removed children. function forgetChildren(parent) { var children = reusableEmptyArray; if (parent.childValues.size > 0) { children = []; parent.childValues.forEach(function (value, child) { forgetChild(parent, child); children.push(child); }); } // After we forget all our children, this.dirtyChildren must be empty // and therefore must have been reset to null. assert(parent.dirtyChildren === null); return children; } function forgetChild(parent, child) { child.parents.delete(parent); parent.childValues.delete(child); removeDirtyChild(parent, child); } function maybeSubscribe(entry) { if (typeof entry.subscribe === "function") { try { maybeUnsubscribe(entry); // Prevent double subscriptions. entry.unsubscribe = entry.subscribe.apply(null, entry.args); } catch (e) { // If this Entry has a subscribe function and it threw an exception // (or an unsubscribe function it previously returned now throws), // return false to indicate that we were not able to subscribe (or // unsubscribe), and this Entry should remain dirty. entry.setDirty(); return false; } } // Returning true indicates either that there was no entry.subscribe // function or that it succeeded. return true; } function maybeUnsubscribe(entry) { var unsubscribe = entry.unsubscribe; if (typeof unsubscribe === "function") { entry.unsubscribe = void 0; unsubscribe(); } } // A trie data structure that holds object keys weakly, yet can also hold // non-object keys, unlike the native `WeakMap`. var KeyTrie = /** @class */ (function () { function KeyTrie(weakness) { this.weakness = weakness; } KeyTrie.prototype.lookup = function () { var array = []; for (var _i = 0; _i < arguments.length; _i++) { array[_i] = arguments[_i]; } return this.lookupArray(array); }; KeyTrie.prototype.lookupArray = function (array) { var node = this; array.forEach(function (key) { return node = node.getChildTrie(key); }); return node.data || (node.data = Object.create(null)); }; KeyTrie.prototype.getChildTrie = function (key) { var map = this.weakness && isObjRef(key) ? this.weak || (this.weak = new WeakMap()) : this.strong || (this.strong = new Map()); var child = map.get(key); if (!child) map.set(key, child = new KeyTrie(this.weakness)); return child; }; return KeyTrie; }()); function isObjRef(value) { switch (typeof value) { case "object": if (value === null) break; // Fall through to return true... case "function": return true; } return false; } // The defaultMakeCacheKey function is remarkably powerful, because it gives // a unique object for any shallow-identical list of arguments. If you need // to implement a custom makeCacheKey function, you may find it helpful to // delegate the final work to defaultMakeCacheKey, which is why we export it // here. However, you may want to avoid defaultMakeCacheKey if your runtime // does not support WeakMap, or you have the ability to return a string key. // In those cases, just write your own custom makeCacheKey functions. var keyTrie = new KeyTrie(typeof WeakMap === "function"); function defaultMakeCacheKey() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return keyTrie.lookupArray(args); } function wrap(originalFunction, options) { if (options === void 0) { options = Object.create(null); } var cache = new Cache(options.max || Math.pow(2, 16), function (entry) { return entry.dispose(); }); var disposable = !!options.disposable; var makeCacheKey = options.makeCacheKey || defaultMakeCacheKey; function optimistic() { if (disposable && !parentEntrySlot.hasValue()) { // If there's no current parent computation, and this wrapped // function is disposable (meaning we don't care about entry.value, // just dependency tracking), then we can short-cut everything else // in this function, because entry.recompute() is going to recycle // the entry object without recomputing anything, anyway. return void 0; } var key = makeCacheKey.apply(null, arguments); if (!key) { return originalFunction.apply(null, arguments); } var args = Array.prototype.slice.call(arguments); var entry = cache.get(key); if (entry) { entry.args = args; } else { entry = new Entry(originalFunction, args); cache.set(key, entry); entry.subscribe = options.subscribe; if (disposable) { entry.reportOrphan = function () { return cache.delete(key); }; } } var value = entry.recompute(); // Move this entry to the front of the least-recently used queue, // since we just finished computing its value. cache.set(key, entry); // Clean up any excess entries in the cache, but only if there is no // active parent entry, meaning we're not in the middle of a larger // computation that might be flummoxed by the cleaning. if (!parentEntrySlot.hasValue()) { cache.clean(); } // If options.disposable is truthy, the caller of wrap is telling us // they don't care about the result of entry.recompute(), so we should // avoid returning the value, so it won't be accidentally used. return disposable ? void 0 : value; } optimistic.dirty = function () { var key = makeCacheKey.apply(null, arguments); var child = key && cache.get(key); if (child) { child.setDirty(); } }; return optimistic; } //# sourceMappingURL=bundle.esm.js.map /***/ }), /***/ "./node_modules/prop-types/checkPropTypes.js": /*!***************************************************!*\ !*** ./node_modules/prop-types/checkPropTypes.js ***! \***************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var printWarning = function() {}; if (true) { var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js"); var loggedTypeFailures = {}; var has = Function.call.bind(Object.prototype.hasOwnProperty); printWarning = function(text) { var message = 'Warning: ' + text; if (typeof console !== 'undefined') { console.error(message); } try { // --- Welcome to debugging React --- // This error was thrown as a convenience so that you can use this stack // to find the callsite that caused this warning to fire. throw new Error(message); } catch (x) {} }; } /** * Assert that the values match with the type specs. * Error messages are memorized and will only be shown once. * * @param {object} typeSpecs Map of name to a ReactPropType * @param {object} values Runtime values that need to be type-checked * @param {string} location e.g. "prop", "context", "child context" * @param {string} componentName Name of the component for error messages. * @param {?Function} getStack Returns the component stack. * @private */ function checkPropTypes(typeSpecs, values, location, componentName, getStack) { if (true) { for (var typeSpecName in typeSpecs) { if (has(typeSpecs, typeSpecName)) { var error; // Prop type validation may throw. In case they do, we don't want to // fail the render phase where it didn't fail before. So we log it. // After these have been cleaned up, we'll let them throw. try { // This is intentionally an invariant that gets caught. It's the same // behavior as without this statement except with a better message. if (typeof typeSpecs[typeSpecName] !== 'function') { var err = Error( (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' ); err.name = 'Invariant Violation'; throw err; } error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); } catch (ex) { error = ex; } if (error && !(error instanceof Error)) { printWarning( (componentName || 'React class') + ': type specification of ' + location + ' `' + typeSpecName + '` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).' ); } if (error instanceof Error && !(error.message in loggedTypeFailures)) { // Only monitor this failure once because there tends to be a lot of the // same error. loggedTypeFailures[error.message] = true; var stack = getStack ? getStack() : ''; printWarning( 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') ); } } } } } /** * Resets warning cache when testing. * * @private */ checkPropTypes.resetWarningCache = function() { if (true) { loggedTypeFailures = {}; } } module.exports = checkPropTypes; /***/ }), /***/ "./node_modules/prop-types/factoryWithTypeCheckers.js": /*!************************************************************!*\ !*** ./node_modules/prop-types/factoryWithTypeCheckers.js ***! \************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/react-is/index.js"); var assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js"); var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js"); var checkPropTypes = __webpack_require__(/*! ./checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js"); var has = Function.call.bind(Object.prototype.hasOwnProperty); var printWarning = function() {}; if (true) { printWarning = function(text) { var message = 'Warning: ' + text; if (typeof console !== 'undefined') { console.error(message); } try { // --- Welcome to debugging React --- // This error was thrown as a convenience so that you can use this stack // to find the callsite that caused this warning to fire. throw new Error(message); } catch (x) {} }; } function emptyFunctionThatReturnsNull() { return null; } module.exports = function(isValidElement, throwOnDirectAccess) { /* global Symbol */ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. /** * Returns the iterator method function contained on the iterable object. * * Be sure to invoke the function with the iterable as context: * * var iteratorFn = getIteratorFn(myIterable); * if (iteratorFn) { * var iterator = iteratorFn.call(myIterable); * ... * } * * @param {?object} maybeIterable * @return {?function} */ function getIteratorFn(maybeIterable) { var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); if (typeof iteratorFn === 'function') { return iteratorFn; } } /** * Collection of methods that allow declaration and validation of props that are * supplied to React components. Example usage: * * var Props = require('ReactPropTypes'); * var MyArticle = React.createClass({ * propTypes: { * // An optional string prop named "description". * description: Props.string, * * // A required enum prop named "category". * category: Props.oneOf(['News','Photos']).isRequired, * * // A prop named "dialog" that requires an instance of Dialog. * dialog: Props.instanceOf(Dialog).isRequired * }, * render: function() { ... } * }); * * A more formal specification of how these methods are used: * * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) * decl := ReactPropTypes.{type}(.isRequired)? * * Each and every declaration produces a function with the same signature. This * allows the creation of custom validation functions. For example: * * var MyLink = React.createClass({ * propTypes: { * // An optional string or URI prop named "href". * href: function(props, propName, componentName) { * var propValue = props[propName]; * if (propValue != null && typeof propValue !== 'string' && * !(propValue instanceof URI)) { * return new Error( * 'Expected a string or an URI for ' + propName + ' in ' + * componentName * ); * } * } * }, * render: function() {...} * }); * * @internal */ var ANONYMOUS = '<>'; // Important! // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. var ReactPropTypes = { array: createPrimitiveTypeChecker('array'), bool: createPrimitiveTypeChecker('boolean'), func: createPrimitiveTypeChecker('function'), number: createPrimitiveTypeChecker('number'), object: createPrimitiveTypeChecker('object'), string: createPrimitiveTypeChecker('string'), symbol: createPrimitiveTypeChecker('symbol'), any: createAnyTypeChecker(), arrayOf: createArrayOfTypeChecker, element: createElementTypeChecker(), elementType: createElementTypeTypeChecker(), instanceOf: createInstanceTypeChecker, node: createNodeChecker(), objectOf: createObjectOfTypeChecker, oneOf: createEnumTypeChecker, oneOfType: createUnionTypeChecker, shape: createShapeTypeChecker, exact: createStrictShapeTypeChecker, }; /** * inlined Object.is polyfill to avoid requiring consumers ship their own * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is */ /*eslint-disable no-self-compare*/ function is(x, y) { // SameValue algorithm if (x === y) { // Steps 1-5, 7-10 // Steps 6.b-6.e: +0 != -0 return x !== 0 || 1 / x === 1 / y; } else { // Step 6.a: NaN == NaN return x !== x && y !== y; } } /*eslint-enable no-self-compare*/ /** * We use an Error-like object for backward compatibility as people may call * PropTypes directly and inspect their output. However, we don't use real * Errors anymore. We don't inspect their stack anyway, and creating them * is prohibitively expensive if they are created too often, such as what * happens in oneOfType() for any type before the one that matched. */ function PropTypeError(message) { this.message = message; this.stack = ''; } // Make `instanceof Error` still work for returned errors. PropTypeError.prototype = Error.prototype; function createChainableTypeChecker(validate) { if (true) { var manualPropTypeCallCache = {}; var manualPropTypeWarningCount = 0; } function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { componentName = componentName || ANONYMOUS; propFullName = propFullName || propName; if (secret !== ReactPropTypesSecret) { if (throwOnDirectAccess) { // New behavior only for users of `prop-types` package var err = new Error( 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types' ); err.name = 'Invariant Violation'; throw err; } else if ( true && typeof console !== 'undefined') { // Old behavior for people using React.PropTypes var cacheKey = componentName + ':' + propName; if ( !manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors manualPropTypeWarningCount < 3 ) { printWarning( 'You are manually calling a React.PropTypes validation ' + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' ); manualPropTypeCallCache[cacheKey] = true; manualPropTypeWarningCount++; } } } if (props[propName] == null) { if (isRequired) { if (props[propName] === null) { return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); } return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); } return null; } else { return validate(props, propName, componentName, location, propFullName); } } var chainedCheckType = checkType.bind(null, false); chainedCheckType.isRequired = checkType.bind(null, true); return chainedCheckType; } function createPrimitiveTypeChecker(expectedType) { function validate(props, propName, componentName, location, propFullName, secret) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== expectedType) { // `propValue` being instance of, say, date/regexp, pass the 'object' // check, but we can offer a more precise error message here rather than // 'of type `object`'. var preciseType = getPreciseType(propValue); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); } return null; } return createChainableTypeChecker(validate); } function createAnyTypeChecker() { return createChainableTypeChecker(emptyFunctionThatReturnsNull); } function createArrayOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); } var propValue = props[propName]; if (!Array.isArray(propValue)) { var propType = getPropType(propValue); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); } for (var i = 0; i < propValue.length; i++) { var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); if (error instanceof Error) { return error; } } return null; } return createChainableTypeChecker(validate); } function createElementTypeChecker() { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; if (!isValidElement(propValue)) { var propType = getPropType(propValue); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); } return null; } return createChainableTypeChecker(validate); } function createElementTypeTypeChecker() { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; if (!ReactIs.isValidElementType(propValue)) { var propType = getPropType(propValue); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.')); } return null; } return createChainableTypeChecker(validate); } function createInstanceTypeChecker(expectedClass) { function validate(props, propName, componentName, location, propFullName) { if (!(props[propName] instanceof expectedClass)) { var expectedClassName = expectedClass.name || ANONYMOUS; var actualClassName = getClassName(props[propName]); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); } return null; } return createChainableTypeChecker(validate); } function createEnumTypeChecker(expectedValues) { if (!Array.isArray(expectedValues)) { if (true) { if (arguments.length > 1) { printWarning( 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).' ); } else { printWarning('Invalid argument supplied to oneOf, expected an array.'); } } return emptyFunctionThatReturnsNull; } function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; for (var i = 0; i < expectedValues.length; i++) { if (is(propValue, expectedValues[i])) { return null; } } var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { var type = getPreciseType(value); if (type === 'symbol') { return String(value); } return value; }); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); } return createChainableTypeChecker(validate); } function createObjectOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); } var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); } for (var key in propValue) { if (has(propValue, key)) { var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); if (error instanceof Error) { return error; } } } return null; } return createChainableTypeChecker(validate); } function createUnionTypeChecker(arrayOfTypeCheckers) { if (!Array.isArray(arrayOfTypeCheckers)) { true ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : undefined; return emptyFunctionThatReturnsNull; } for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; if (typeof checker !== 'function') { printWarning( 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' ); return emptyFunctionThatReturnsNull; } } function validate(props, propName, componentName, location, propFullName) { for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { return null; } } return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); } return createChainableTypeChecker(validate); } function createNodeChecker() { function validate(props, propName, componentName, location, propFullName) { if (!isNode(props[propName])) { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); } return null; } return createChainableTypeChecker(validate); } function createShapeTypeChecker(shapeTypes) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); } for (var key in shapeTypes) { var checker = shapeTypes[key]; if (!checker) { continue; } var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); if (error) { return error; } } return null; } return createChainableTypeChecker(validate); } function createStrictShapeTypeChecker(shapeTypes) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); } // We need to check all keys in case some are required but missing from // props. var allKeys = assign({}, props[propName], shapeTypes); for (var key in allKeys) { var checker = shapeTypes[key]; if (!checker) { return new PropTypeError( 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') ); } var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); if (error) { return error; } } return null; } return createChainableTypeChecker(validate); } function isNode(propValue) { switch (typeof propValue) { case 'number': case 'string': case 'undefined': return true; case 'boolean': return !propValue; case 'object': if (Array.isArray(propValue)) { return propValue.every(isNode); } if (propValue === null || isValidElement(propValue)) { return true; } var iteratorFn = getIteratorFn(propValue); if (iteratorFn) { var iterator = iteratorFn.call(propValue); var step; if (iteratorFn !== propValue.entries) { while (!(step = iterator.next()).done) { if (!isNode(step.value)) { return false; } } } else { // Iterator will provide entry [k,v] tuples rather than values. while (!(step = iterator.next()).done) { var entry = step.value; if (entry) { if (!isNode(entry[1])) { return false; } } } } } else { return false; } return true; default: return false; } } function isSymbol(propType, propValue) { // Native Symbol. if (propType === 'symbol') { return true; } // falsy value can't be a Symbol if (!propValue) { return false; } // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' if (propValue['@@toStringTag'] === 'Symbol') { return true; } // Fallback for non-spec compliant Symbols which are polyfilled. if (typeof Symbol === 'function' && propValue instanceof Symbol) { return true; } return false; } // Equivalent of `typeof` but with special handling for array and regexp. function getPropType(propValue) { var propType = typeof propValue; if (Array.isArray(propValue)) { return 'array'; } if (propValue instanceof RegExp) { // Old webkits (at least until Android 4.0) return 'function' rather than // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ // passes PropTypes.object. return 'object'; } if (isSymbol(propType, propValue)) { return 'symbol'; } return propType; } // This handles more types than `getPropType`. Only used for error messages. // See `createPrimitiveTypeChecker`. function getPreciseType(propValue) { if (typeof propValue === 'undefined' || propValue === null) { return '' + propValue; } var propType = getPropType(propValue); if (propType === 'object') { if (propValue instanceof Date) { return 'date'; } else if (propValue instanceof RegExp) { return 'regexp'; } } return propType; } // Returns a string that is postfixed to a warning about an invalid type. // For example, "undefined" or "of type array" function getPostfixForTypeWarning(value) { var type = getPreciseType(value); switch (type) { case 'array': case 'object': return 'an ' + type; case 'boolean': case 'date': case 'regexp': return 'a ' + type; default: return type; } } // Returns class name of the object, if any. function getClassName(propValue) { if (!propValue.constructor || !propValue.constructor.name) { return ANONYMOUS; } return propValue.constructor.name; } ReactPropTypes.checkPropTypes = checkPropTypes; ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; ReactPropTypes.PropTypes = ReactPropTypes; return ReactPropTypes; }; /***/ }), /***/ "./node_modules/prop-types/index.js": /*!******************************************!*\ !*** ./node_modules/prop-types/index.js ***! \******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ if (true) { var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/react-is/index.js"); // By explicitly using `prop-types` you are opting into new development behavior. // http://fb.me/prop-types-in-prod var throwOnDirectAccess = true; module.exports = __webpack_require__(/*! ./factoryWithTypeCheckers */ "./node_modules/prop-types/factoryWithTypeCheckers.js")(ReactIs.isElement, throwOnDirectAccess); } else {} /***/ }), /***/ "./node_modules/prop-types/lib/ReactPropTypesSecret.js": /*!*************************************************************!*\ !*** ./node_modules/prop-types/lib/ReactPropTypesSecret.js ***! \*************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; module.exports = ReactPropTypesSecret; /***/ }), /***/ "./node_modules/react-dom/cjs/react-dom.development.js": /*!*************************************************************!*\ !*** ./node_modules/react-dom/cjs/react-dom.development.js ***! \*************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** @license React v16.8.6 * react-dom.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ if (true) { (function() { 'use strict'; var React = __webpack_require__(/*! react */ "./node_modules/react/index.js"); var _assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js"); var checkPropTypes = __webpack_require__(/*! prop-types/checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js"); var scheduler = __webpack_require__(/*! scheduler */ "./node_modules/scheduler/index.js"); var tracing = __webpack_require__(/*! scheduler/tracing */ "./node_modules/scheduler/tracing.js"); /** * Use invariant() to assert state which your program assumes to be true. * * Provide sprintf-style format (only %s is supported) and arguments * to provide information about what broke and what you were * expecting. * * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production. */ var validateFormat = function () {}; { validateFormat = function (format) { if (format === undefined) { throw new Error('invariant requires an error message argument'); } }; } function invariant(condition, format, a, b, c, d, e, f) { validateFormat(format); if (!condition) { var error = void 0; if (format === undefined) { error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); } else { var args = [a, b, c, d, e, f]; var argIndex = 0; error = new Error(format.replace(/%s/g, function () { return args[argIndex++]; })); error.name = 'Invariant Violation'; } error.framesToPop = 1; // we don't care about invariant's own frame throw error; } } // Relying on the `invariant()` implementation lets us // preserve the format and params in the www builds. !React ? invariant(false, 'ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.') : void 0; var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) { var funcArgs = Array.prototype.slice.call(arguments, 3); try { func.apply(context, funcArgs); } catch (error) { this.onError(error); } }; { // In DEV mode, we swap out invokeGuardedCallback for a special version // that plays more nicely with the browser's DevTools. The idea is to preserve // "Pause on exceptions" behavior. Because React wraps all user-provided // functions in invokeGuardedCallback, and the production version of // invokeGuardedCallback uses a try-catch, all user exceptions are treated // like caught exceptions, and the DevTools won't pause unless the developer // takes the extra step of enabling pause on caught exceptions. This is // unintuitive, though, because even though React has caught the error, from // the developer's perspective, the error is uncaught. // // To preserve the expected "Pause on exceptions" behavior, we don't use a // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake // DOM node, and call the user-provided callback from inside an event handler // for that fake event. If the callback throws, the error is "captured" using // a global event handler. But because the error happens in a different // event loop context, it does not interrupt the normal program flow. // Effectively, this gives us try-catch behavior without actually using // try-catch. Neat! // Check that the browser supports the APIs we need to implement our special // DEV version of invokeGuardedCallback if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { var fakeNode = document.createElement('react'); var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) { // If document doesn't exist we know for sure we will crash in this method // when we call document.createEvent(). However this can cause confusing // errors: https://github.com/facebookincubator/create-react-app/issues/3482 // So we preemptively throw with a better message instead. !(typeof document !== 'undefined') ? invariant(false, 'The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.') : void 0; var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We // set this to true at the beginning, then set it to false right after // calling the function. If the function errors, `didError` will never be // set to false. This strategy works even if the browser is flaky and // fails to call our global error handler, because it doesn't rely on // the error event at all. var didError = true; // Keeps track of the value of window.event so that we can reset it // during the callback to let user code access window.event in the // browsers that support it. var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event // dispatching: https://github.com/facebook/react/issues/13688 var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event'); // Create an event handler for our fake event. We will synchronously // dispatch our fake event using `dispatchEvent`. Inside the handler, we // call the user-provided callback. var funcArgs = Array.prototype.slice.call(arguments, 3); function callCallback() { // We immediately remove the callback from event listeners so that // nested `invokeGuardedCallback` calls do not clash. Otherwise, a // nested call would trigger the fake event handlers of any call higher // in the stack. fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the // window.event assignment in both IE <= 10 as they throw an error // "Member not found" in strict mode, and in Firefox which does not // support window.event. if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) { window.event = windowEvent; } func.apply(context, funcArgs); didError = false; } // Create a global error event handler. We use this to capture the value // that was thrown. It's possible that this error handler will fire more // than once; for example, if non-React code also calls `dispatchEvent` // and a handler for that event throws. We should be resilient to most of // those cases. Even if our error event handler fires more than once, the // last error event is always used. If the callback actually does error, // we know that the last error event is the correct one, because it's not // possible for anything else to have happened in between our callback // erroring and the code that follows the `dispatchEvent` call below. If // the callback doesn't error, but the error event was fired, we know to // ignore it because `didError` will be false, as described above. var error = void 0; // Use this to track whether the error event is ever called. var didSetError = false; var isCrossOriginError = false; function handleWindowError(event) { error = event.error; didSetError = true; if (error === null && event.colno === 0 && event.lineno === 0) { isCrossOriginError = true; } if (event.defaultPrevented) { // Some other error handler has prevented default. // Browsers silence the error report if this happens. // We'll remember this to later decide whether to log it or not. if (error != null && typeof error === 'object') { try { error._suppressLogging = true; } catch (inner) { // Ignore. } } } } // Create a fake event type. var evtType = 'react-' + (name ? name : 'invokeguardedcallback'); // Attach our event handlers window.addEventListener('error', handleWindowError); fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function // errors, it will trigger our global error handler. evt.initEvent(evtType, false, false); fakeNode.dispatchEvent(evt); if (windowEventDescriptor) { Object.defineProperty(window, 'event', windowEventDescriptor); } if (didError) { if (!didSetError) { // The callback errored, but the error event never fired. error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.'); } else if (isCrossOriginError) { error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.'); } this.onError(error); } // Remove our event listeners window.removeEventListener('error', handleWindowError); }; invokeGuardedCallbackImpl = invokeGuardedCallbackDev; } } var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl; // Used by Fiber to simulate a try-catch. var hasError = false; var caughtError = null; // Used by event system to capture/rethrow the first error. var hasRethrowError = false; var rethrowError = null; var reporter = { onError: function (error) { hasError = true; caughtError = error; } }; /** * Call a function while guarding against errors that happens within it. * Returns an error if it throws, otherwise null. * * In production, this is implemented using a try-catch. The reason we don't * use a try-catch directly is so that we can swap out a different * implementation in DEV mode. * * @param {String} name of the guard to use for logging or debugging * @param {Function} func The function to invoke * @param {*} context The context to use when calling the function * @param {...*} args Arguments for function */ function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { hasError = false; caughtError = null; invokeGuardedCallbackImpl$1.apply(reporter, arguments); } /** * Same as invokeGuardedCallback, but instead of returning an error, it stores * it in a global so it can be rethrown by `rethrowCaughtError` later. * TODO: See if caughtError and rethrowError can be unified. * * @param {String} name of the guard to use for logging or debugging * @param {Function} func The function to invoke * @param {*} context The context to use when calling the function * @param {...*} args Arguments for function */ function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) { invokeGuardedCallback.apply(this, arguments); if (hasError) { var error = clearCaughtError(); if (!hasRethrowError) { hasRethrowError = true; rethrowError = error; } } } /** * During execution of guarded functions we will capture the first error which * we will rethrow to be handled by the top level error handler. */ function rethrowCaughtError() { if (hasRethrowError) { var error = rethrowError; hasRethrowError = false; rethrowError = null; throw error; } } function hasCaughtError() { return hasError; } function clearCaughtError() { if (hasError) { var error = caughtError; hasError = false; caughtError = null; return error; } else { invariant(false, 'clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.'); } } /** * Injectable ordering of event plugins. */ var eventPluginOrder = null; /** * Injectable mapping from names to event plugin modules. */ var namesToPlugins = {}; /** * Recomputes the plugin list using the injected plugins and plugin ordering. * * @private */ function recomputePluginOrdering() { if (!eventPluginOrder) { // Wait until an `eventPluginOrder` is injected. return; } for (var pluginName in namesToPlugins) { var pluginModule = namesToPlugins[pluginName]; var pluginIndex = eventPluginOrder.indexOf(pluginName); !(pluginIndex > -1) ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : void 0; if (plugins[pluginIndex]) { continue; } !pluginModule.extractEvents ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : void 0; plugins[pluginIndex] = pluginModule; var publishedEvents = pluginModule.eventTypes; for (var eventName in publishedEvents) { !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : void 0; } } } /** * Publishes an event so that it can be dispatched by the supplied plugin. * * @param {object} dispatchConfig Dispatch configuration for the event. * @param {object} PluginModule Plugin publishing the event. * @return {boolean} True if the event was successfully published. * @private */ function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0; eventNameDispatchConfigs[eventName] = dispatchConfig; var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; if (phasedRegistrationNames) { for (var phaseName in phasedRegistrationNames) { if (phasedRegistrationNames.hasOwnProperty(phaseName)) { var phasedRegistrationName = phasedRegistrationNames[phaseName]; publishRegistrationName(phasedRegistrationName, pluginModule, eventName); } } return true; } else if (dispatchConfig.registrationName) { publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); return true; } return false; } /** * Publishes a registration name that is used to identify dispatched events. * * @param {string} registrationName Registration name to add. * @param {object} PluginModule Plugin publishing the event. * @private */ function publishRegistrationName(registrationName, pluginModule, eventName) { !!registrationNameModules[registrationName] ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : void 0; registrationNameModules[registrationName] = pluginModule; registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies; { var lowerCasedName = registrationName.toLowerCase(); possibleRegistrationNames[lowerCasedName] = registrationName; if (registrationName === 'onDoubleClick') { possibleRegistrationNames.ondblclick = registrationName; } } } /** * Registers plugins so that they can extract and dispatch events. * * @see {EventPluginHub} */ /** * Ordered list of injected plugins. */ var plugins = []; /** * Mapping from event name to dispatch config */ var eventNameDispatchConfigs = {}; /** * Mapping from registration name to plugin module */ var registrationNameModules = {}; /** * Mapping from registration name to event name */ var registrationNameDependencies = {}; /** * Mapping from lowercase registration names to the properly cased version, * used to warn in the case of missing event handlers. Available * only in true. * @type {Object} */ var possibleRegistrationNames = {}; // Trust the developer to only use possibleRegistrationNames in true /** * Injects an ordering of plugins (by plugin name). This allows the ordering * to be decoupled from injection of the actual plugins so that ordering is * always deterministic regardless of packaging, on-the-fly injection, etc. * * @param {array} InjectedEventPluginOrder * @internal * @see {EventPluginHub.injection.injectEventPluginOrder} */ function injectEventPluginOrder(injectedEventPluginOrder) { !!eventPluginOrder ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : void 0; // Clone the ordering so it cannot be dynamically mutated. eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder); recomputePluginOrdering(); } /** * Injects plugins to be used by `EventPluginHub`. The plugin names must be * in the ordering injected by `injectEventPluginOrder`. * * Plugins can be injected as part of page initialization or on-the-fly. * * @param {object} injectedNamesToPlugins Map from names to plugin modules. * @internal * @see {EventPluginHub.injection.injectEventPluginsByName} */ function injectEventPluginsByName(injectedNamesToPlugins) { var isOrderingDirty = false; for (var pluginName in injectedNamesToPlugins) { if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { continue; } var pluginModule = injectedNamesToPlugins[pluginName]; if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { !!namesToPlugins[pluginName] ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0; namesToPlugins[pluginName] = pluginModule; isOrderingDirty = true; } } if (isOrderingDirty) { recomputePluginOrdering(); } } /** * Similar to invariant but only logs a warning if the condition is not met. * This can be used to log issues in development environments in critical * paths. Removing the logging code for production environments will keep the * same logic and follow the same code paths. */ var warningWithoutStack = function () {}; { warningWithoutStack = function (condition, format) { for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } if (format === undefined) { throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument'); } if (args.length > 8) { // Check before the condition to catch violations early. throw new Error('warningWithoutStack() currently supports at most 8 arguments.'); } if (condition) { return; } if (typeof console !== 'undefined') { var argsWithFormat = args.map(function (item) { return '' + item; }); argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it // breaks IE9: https://github.com/facebook/react/issues/13610 Function.prototype.apply.call(console.error, console, argsWithFormat); } try { // --- Welcome to debugging React --- // This error was thrown as a convenience so that you can use this stack // to find the callsite that caused this warning to fire. var argIndex = 0; var message = 'Warning: ' + format.replace(/%s/g, function () { return args[argIndex++]; }); throw new Error(message); } catch (x) {} }; } var warningWithoutStack$1 = warningWithoutStack; var getFiberCurrentPropsFromNode = null; var getInstanceFromNode = null; var getNodeFromInstance = null; function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) { getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl; getInstanceFromNode = getInstanceFromNodeImpl; getNodeFromInstance = getNodeFromInstanceImpl; { !(getNodeFromInstance && getInstanceFromNode) ? warningWithoutStack$1(false, 'EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0; } } var validateEventDispatches = void 0; { validateEventDispatches = function (event) { var dispatchListeners = event._dispatchListeners; var dispatchInstances = event._dispatchInstances; var listenersIsArr = Array.isArray(dispatchListeners); var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; var instancesIsArr = Array.isArray(dispatchInstances); var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0; }; } /** * Dispatch the event to the listener. * @param {SyntheticEvent} event SyntheticEvent to handle * @param {function} listener Application-level callback * @param {*} inst Internal component instance */ function executeDispatch(event, listener, inst) { var type = event.type || 'unknown-event'; event.currentTarget = getNodeFromInstance(inst); invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event); event.currentTarget = null; } /** * Standard/simple iteration through an event's collected dispatches. */ function executeDispatchesInOrder(event) { var dispatchListeners = event._dispatchListeners; var dispatchInstances = event._dispatchInstances; { validateEventDispatches(event); } if (Array.isArray(dispatchListeners)) { for (var i = 0; i < dispatchListeners.length; i++) { if (event.isPropagationStopped()) { break; } // Listeners and Instances are two parallel arrays that are always in sync. executeDispatch(event, dispatchListeners[i], dispatchInstances[i]); } } else if (dispatchListeners) { executeDispatch(event, dispatchListeners, dispatchInstances); } event._dispatchListeners = null; event._dispatchInstances = null; } /** * @see executeDispatchesInOrderStopAtTrueImpl */ /** * Execution of a "direct" dispatch - there must be at most one dispatch * accumulated on the event or it is considered an error. It doesn't really make * sense for an event with multiple dispatches (bubbled) to keep track of the * return values at each dispatch execution, but it does tend to make sense when * dealing with "direct" dispatches. * * @return {*} The return value of executing the single dispatch. */ /** * @param {SyntheticEvent} event * @return {boolean} True iff number of dispatches accumulated is greater than 0. */ /** * 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. */ function accumulateInto(current, next) { !(next != null) ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : void 0; if (current == null) { return next; } // 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; } current.push(next); return current; } if (Array.isArray(next)) { // A bit too dangerous to mutate `next`. return [current].concat(next); } return [current, next]; } /** * @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). * @param {function} cb Callback invoked with each element or a collection. * @param {?} [scope] Scope used as `this` in a callback. */ function forEachAccumulated(arr, cb, scope) { if (Array.isArray(arr)) { arr.forEach(cb, scope); } else if (arr) { cb.call(scope, arr); } } /** * Internal queue of events that have accumulated their dispatches and are * waiting to have their dispatches executed. */ var eventQueue = null; /** * Dispatches an event and releases it back into the pool, unless persistent. * * @param {?object} event Synthetic event to be dispatched. * @private */ var executeDispatchesAndRelease = function (event) { if (event) { executeDispatchesInOrder(event); if (!event.isPersistent()) { event.constructor.release(event); } } }; var executeDispatchesAndReleaseTopLevel = function (e) { return executeDispatchesAndRelease(e); }; function isInteractive(tag) { return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; } function shouldPreventMouseEvent(name, type, props) { switch (name) { case 'onClick': case 'onClickCapture': case 'onDoubleClick': case 'onDoubleClickCapture': case 'onMouseDown': case 'onMouseDownCapture': case 'onMouseMove': case 'onMouseMoveCapture': case 'onMouseUp': case 'onMouseUpCapture': return !!(props.disabled && isInteractive(type)); default: return false; } } /** * This is a unified interface for event plugins to be installed and configured. * * Event plugins can implement the following properties: * * `extractEvents` {function(string, DOMEventTarget, string, object): *} * Required. When a top-level event is fired, this method is expected to * extract synthetic events that will in turn be queued and dispatched. * * `eventTypes` {object} * Optional, plugins that fire events must publish a mapping of registration * names that are used to register listeners. Values of this mapping must * be objects that contain `registrationName` or `phasedRegistrationNames`. * * `executeDispatch` {function(object, function, string)} * Optional, allows plugins to override how an event gets dispatched. By * default, the listener is simply invoked. * * Each plugin that is injected into `EventsPluginHub` is immediately operable. * * @public */ /** * Methods for injecting dependencies. */ var injection = { /** * @param {array} InjectedEventPluginOrder * @public */ injectEventPluginOrder: injectEventPluginOrder, /** * @param {object} injectedNamesToPlugins Map from names to plugin modules. */ injectEventPluginsByName: injectEventPluginsByName }; /** * @param {object} inst The instance, which is the source of events. * @param {string} registrationName Name of listener (e.g. `onClick`). * @return {?function} The stored callback. */ function getListener(inst, registrationName) { var listener = void 0; // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not // live here; needs to be moved to a better place soon var stateNode = inst.stateNode; if (!stateNode) { // Work in progress (ex: onload events in incremental mode). return null; } var props = getFiberCurrentPropsFromNode(stateNode); if (!props) { // Work in progress. return null; } listener = props[registrationName]; if (shouldPreventMouseEvent(registrationName, inst.type, props)) { return null; } !(!listener || typeof listener === 'function') ? invariant(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener) : void 0; return listener; } /** * Allows registered plugins an opportunity to extract events from top-level * native browser events. * * @return {*} An accumulation of synthetic events. * @internal */ function extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget) { var events = null; for (var i = 0; i < plugins.length; i++) { // Not every plugin in the ordering may be loaded at runtime. var possiblePlugin = plugins[i]; if (possiblePlugin) { var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); if (extractedEvents) { events = accumulateInto(events, extractedEvents); } } } return events; } function runEventsInBatch(events) { if (events !== null) { eventQueue = accumulateInto(eventQueue, events); } // Set `eventQueue` to null before processing it so that we can tell if more // events get enqueued while processing. var processingEventQueue = eventQueue; eventQueue = null; if (!processingEventQueue) { return; } forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); !!eventQueue ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : void 0; // This would be a good time to rethrow if any of the event handlers threw. rethrowCaughtError(); } function runExtractedEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget) { var events = extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget); runEventsInBatch(events); } var FunctionComponent = 0; var ClassComponent = 1; var IndeterminateComponent = 2; // Before we know whether it is function or class var HostRoot = 3; // Root of a host tree. Could be nested inside another node. var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. var HostComponent = 5; var HostText = 6; var Fragment = 7; var Mode = 8; var ContextConsumer = 9; var ContextProvider = 10; var ForwardRef = 11; var Profiler = 12; var SuspenseComponent = 13; var MemoComponent = 14; var SimpleMemoComponent = 15; var LazyComponent = 16; var IncompleteClassComponent = 17; var DehydratedSuspenseComponent = 18; var randomKey = Math.random().toString(36).slice(2); var internalInstanceKey = '__reactInternalInstance$' + randomKey; var internalEventHandlersKey = '__reactEventHandlers$' + randomKey; function precacheFiberNode(hostInst, node) { node[internalInstanceKey] = hostInst; } /** * Given a DOM node, return the closest ReactDOMComponent or * ReactDOMTextComponent instance ancestor. */ function getClosestInstanceFromNode(node) { if (node[internalInstanceKey]) { return node[internalInstanceKey]; } while (!node[internalInstanceKey]) { if (node.parentNode) { node = node.parentNode; } else { // Top of the tree. This node must not be part of a React tree (or is // unmounted, potentially). return null; } } var inst = node[internalInstanceKey]; if (inst.tag === HostComponent || inst.tag === HostText) { // In Fiber, this will always be the deepest root. return inst; } return null; } /** * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent * instance, or null if the node was not rendered by this React. */ function getInstanceFromNode$1(node) { var inst = node[internalInstanceKey]; if (inst) { if (inst.tag === HostComponent || inst.tag === HostText) { return inst; } else { return null; } } return null; } /** * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding * DOM node. */ function getNodeFromInstance$1(inst) { if (inst.tag === HostComponent || inst.tag === HostText) { // In Fiber this, is just the state node right now. We assume it will be // a host component or host text. return inst.stateNode; } // Without this first invariant, passing a non-DOM-component triggers the next // invariant for a missing parent, which is super confusing. invariant(false, 'getNodeFromInstance: Invalid argument.'); } function getFiberCurrentPropsFromNode$1(node) { return node[internalEventHandlersKey] || null; } function updateFiberProps(node, props) { node[internalEventHandlersKey] = props; } function getParent(inst) { do { inst = inst.return; // TODO: If this is a HostRoot we might want to bail out. // That is depending on if we want nested subtrees (layers) to bubble // events to their parent. We could also go through parentNode on the // host node but that wouldn't work for React Native and doesn't let us // do the portal feature. } while (inst && inst.tag !== HostComponent); if (inst) { return inst; } return null; } /** * Return the lowest common ancestor of A and B, or null if they are in * different trees. */ function getLowestCommonAncestor(instA, instB) { var depthA = 0; for (var tempA = instA; tempA; tempA = getParent(tempA)) { depthA++; } var depthB = 0; for (var tempB = instB; tempB; tempB = getParent(tempB)) { depthB++; } // If A is deeper, crawl up. while (depthA - depthB > 0) { instA = getParent(instA); depthA--; } // If B is deeper, crawl up. while (depthB - depthA > 0) { instB = getParent(instB); depthB--; } // Walk in lockstep until we find a match. var depth = depthA; while (depth--) { if (instA === instB || instA === instB.alternate) { return instA; } instA = getParent(instA); instB = getParent(instB); } return null; } /** * Return if A is an ancestor of B. */ /** * Return the parent instance of the passed-in instance. */ /** * Simulates the traversal of a two-phase, capture/bubble event dispatch. */ function traverseTwoPhase(inst, fn, arg) { var path = []; while (inst) { path.push(inst); inst = getParent(inst); } var i = void 0; for (i = path.length; i-- > 0;) { fn(path[i], 'captured', arg); } for (i = 0; i < path.length; i++) { fn(path[i], 'bubbled', arg); } } /** * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that * should would receive a `mouseEnter` or `mouseLeave` event. * * Does not invoke the callback on the nearest common ancestor because nothing * "entered" or "left" that element. */ function traverseEnterLeave(from, to, fn, argFrom, argTo) { var common = from && to ? getLowestCommonAncestor(from, to) : null; var pathFrom = []; while (true) { if (!from) { break; } if (from === common) { break; } var alternate = from.alternate; if (alternate !== null && alternate === common) { break; } pathFrom.push(from); from = getParent(from); } var pathTo = []; while (true) { if (!to) { break; } if (to === common) { break; } var _alternate = to.alternate; if (_alternate !== null && _alternate === common) { break; } pathTo.push(to); to = getParent(to); } for (var i = 0; i < pathFrom.length; i++) { fn(pathFrom[i], 'bubbled', argFrom); } for (var _i = pathTo.length; _i-- > 0;) { fn(pathTo[_i], 'captured', argTo); } } /** * Some event types have a notion of different registration names for different * "phases" of propagation. This finds listeners by a given phase. */ function listenerAtPhase(inst, event, propagationPhase) { var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; return getListener(inst, registrationName); } /** * A small set of propagation patterns, each of which will accept a small amount * of information, and generate a set of "dispatch ready event objects" - which * are sets of events that have already been annotated with a set of dispatched * listener functions/ids. The API is designed this way to discourage these * propagation strategies from actually executing the dispatches, since we * always want to collect the entire set of dispatches before executing even a * single one. */ /** * Tags a `SyntheticEvent` with dispatched listeners. Creating this function * here, allows us to not have to bind or create functions for each event. * Mutating the event's members allows us to not have to create a wrapping * "dispatch" object that pairs the event with the listener. */ function accumulateDirectionalDispatches(inst, phase, event) { { !inst ? warningWithoutStack$1(false, 'Dispatching inst must not be null') : void 0; } var listener = listenerAtPhase(inst, event, phase); if (listener) { event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); } } /** * Collect dispatches (must be entirely collected before dispatching - see unit * tests). Lazily allocate the array to conserve memory. We must loop through * each event and perform the traversal for each one. We cannot perform a * single traversal for the entire collection of events because each event may * have a different target. */ function accumulateTwoPhaseDispatchesSingle(event) { if (event && event.dispatchConfig.phasedRegistrationNames) { traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); } } /** * Accumulates without regard to direction, does not look for phased * registration names. Same as `accumulateDirectDispatchesSingle` but without * requiring that the `dispatchMarker` be the same as the dispatched ID. */ function accumulateDispatches(inst, ignoredDirection, event) { if (inst && event && event.dispatchConfig.registrationName) { var registrationName = event.dispatchConfig.registrationName; var listener = getListener(inst, registrationName); if (listener) { event._dispatchListeners = accumulateInto(event._dispatchListeners, listener); event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); } } } /** * Accumulates dispatches on an `SyntheticEvent`, but only for the * `dispatchMarker`. * @param {SyntheticEvent} event */ function accumulateDirectDispatchesSingle(event) { if (event && event.dispatchConfig.registrationName) { accumulateDispatches(event._targetInst, null, event); } } function accumulateTwoPhaseDispatches(events) { forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); } function accumulateEnterLeaveDispatches(leave, enter, from, to) { traverseEnterLeave(from, to, accumulateDispatches, leave, enter); } function accumulateDirectDispatches(events) { forEachAccumulated(events, accumulateDirectDispatchesSingle); } var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); // Do not uses the below two methods directly! // Instead use constants exported from DOMTopLevelEventTypes in ReactDOM. // (It is the only module that is allowed to access these methods.) function unsafeCastStringToDOMTopLevelType(topLevelType) { return topLevelType; } function unsafeCastDOMTopLevelTypeToString(topLevelType) { return topLevelType; } /** * Generate a mapping of standard vendor prefixes using the defined style property and event name. * * @param {string} styleProp * @param {string} eventName * @returns {object} */ function makePrefixMap(styleProp, eventName) { var prefixes = {}; prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); prefixes['Webkit' + styleProp] = 'webkit' + eventName; prefixes['Moz' + styleProp] = 'moz' + eventName; return prefixes; } /** * A list of event names to a configurable list of vendor prefixes. */ var vendorPrefixes = { animationend: makePrefixMap('Animation', 'AnimationEnd'), animationiteration: makePrefixMap('Animation', 'AnimationIteration'), animationstart: makePrefixMap('Animation', 'AnimationStart'), transitionend: makePrefixMap('Transition', 'TransitionEnd') }; /** * Event names that have already been detected and prefixed (if applicable). */ var prefixedEventNames = {}; /** * Element to check for prefixes on. */ var style = {}; /** * Bootstrap if a DOM exists. */ if (canUseDOM) { style = document.createElement('div').style; // On some platforms, in particular some releases of Android 4.x, // the un-prefixed "animation" and "transition" properties are defined on the // style object but the events that fire will still be prefixed, so we need // to check if the un-prefixed events are usable, and if not remove them from the map. if (!('AnimationEvent' in window)) { delete vendorPrefixes.animationend.animation; delete vendorPrefixes.animationiteration.animation; delete vendorPrefixes.animationstart.animation; } // Same as above if (!('TransitionEvent' in window)) { delete vendorPrefixes.transitionend.transition; } } /** * Attempts to determine the correct vendor prefixed event name. * * @param {string} eventName * @returns {string} */ function getVendorPrefixedEventName(eventName) { if (prefixedEventNames[eventName]) { return prefixedEventNames[eventName]; } else if (!vendorPrefixes[eventName]) { return eventName; } var prefixMap = vendorPrefixes[eventName]; for (var styleProp in prefixMap) { if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) { return prefixedEventNames[eventName] = prefixMap[styleProp]; } } return eventName; } /** * To identify top level events in ReactDOM, we use constants defined by this * module. This is the only module that uses the unsafe* methods to express * that the constants actually correspond to the browser event names. This lets * us save some bundle size by avoiding a top level type -> event name map. * The rest of ReactDOM code should import top level types from this file. */ var TOP_ABORT = unsafeCastStringToDOMTopLevelType('abort'); var TOP_ANIMATION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationend')); var TOP_ANIMATION_ITERATION = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationiteration')); var TOP_ANIMATION_START = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationstart')); var TOP_BLUR = unsafeCastStringToDOMTopLevelType('blur'); var TOP_CAN_PLAY = unsafeCastStringToDOMTopLevelType('canplay'); var TOP_CAN_PLAY_THROUGH = unsafeCastStringToDOMTopLevelType('canplaythrough'); var TOP_CANCEL = unsafeCastStringToDOMTopLevelType('cancel'); var TOP_CHANGE = unsafeCastStringToDOMTopLevelType('change'); var TOP_CLICK = unsafeCastStringToDOMTopLevelType('click'); var TOP_CLOSE = unsafeCastStringToDOMTopLevelType('close'); var TOP_COMPOSITION_END = unsafeCastStringToDOMTopLevelType('compositionend'); var TOP_COMPOSITION_START = unsafeCastStringToDOMTopLevelType('compositionstart'); var TOP_COMPOSITION_UPDATE = unsafeCastStringToDOMTopLevelType('compositionupdate'); var TOP_CONTEXT_MENU = unsafeCastStringToDOMTopLevelType('contextmenu'); var TOP_COPY = unsafeCastStringToDOMTopLevelType('copy'); var TOP_CUT = unsafeCastStringToDOMTopLevelType('cut'); var TOP_DOUBLE_CLICK = unsafeCastStringToDOMTopLevelType('dblclick'); var TOP_AUX_CLICK = unsafeCastStringToDOMTopLevelType('auxclick'); var TOP_DRAG = unsafeCastStringToDOMTopLevelType('drag'); var TOP_DRAG_END = unsafeCastStringToDOMTopLevelType('dragend'); var TOP_DRAG_ENTER = unsafeCastStringToDOMTopLevelType('dragenter'); var TOP_DRAG_EXIT = unsafeCastStringToDOMTopLevelType('dragexit'); var TOP_DRAG_LEAVE = unsafeCastStringToDOMTopLevelType('dragleave'); var TOP_DRAG_OVER = unsafeCastStringToDOMTopLevelType('dragover'); var TOP_DRAG_START = unsafeCastStringToDOMTopLevelType('dragstart'); var TOP_DROP = unsafeCastStringToDOMTopLevelType('drop'); var TOP_DURATION_CHANGE = unsafeCastStringToDOMTopLevelType('durationchange'); var TOP_EMPTIED = unsafeCastStringToDOMTopLevelType('emptied'); var TOP_ENCRYPTED = unsafeCastStringToDOMTopLevelType('encrypted'); var TOP_ENDED = unsafeCastStringToDOMTopLevelType('ended'); var TOP_ERROR = unsafeCastStringToDOMTopLevelType('error'); var TOP_FOCUS = unsafeCastStringToDOMTopLevelType('focus'); var TOP_GOT_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('gotpointercapture'); var TOP_INPUT = unsafeCastStringToDOMTopLevelType('input'); var TOP_INVALID = unsafeCastStringToDOMTopLevelType('invalid'); var TOP_KEY_DOWN = unsafeCastStringToDOMTopLevelType('keydown'); var TOP_KEY_PRESS = unsafeCastStringToDOMTopLevelType('keypress'); var TOP_KEY_UP = unsafeCastStringToDOMTopLevelType('keyup'); var TOP_LOAD = unsafeCastStringToDOMTopLevelType('load'); var TOP_LOAD_START = unsafeCastStringToDOMTopLevelType('loadstart'); var TOP_LOADED_DATA = unsafeCastStringToDOMTopLevelType('loadeddata'); var TOP_LOADED_METADATA = unsafeCastStringToDOMTopLevelType('loadedmetadata'); var TOP_LOST_POINTER_CAPTURE = unsafeCastStringToDOMTopLevelType('lostpointercapture'); var TOP_MOUSE_DOWN = unsafeCastStringToDOMTopLevelType('mousedown'); var TOP_MOUSE_MOVE = unsafeCastStringToDOMTopLevelType('mousemove'); var TOP_MOUSE_OUT = unsafeCastStringToDOMTopLevelType('mouseout'); var TOP_MOUSE_OVER = unsafeCastStringToDOMTopLevelType('mouseover'); var TOP_MOUSE_UP = unsafeCastStringToDOMTopLevelType('mouseup'); var TOP_PASTE = unsafeCastStringToDOMTopLevelType('paste'); var TOP_PAUSE = unsafeCastStringToDOMTopLevelType('pause'); var TOP_PLAY = unsafeCastStringToDOMTopLevelType('play'); var TOP_PLAYING = unsafeCastStringToDOMTopLevelType('playing'); var TOP_POINTER_CANCEL = unsafeCastStringToDOMTopLevelType('pointercancel'); var TOP_POINTER_DOWN = unsafeCastStringToDOMTopLevelType('pointerdown'); var TOP_POINTER_MOVE = unsafeCastStringToDOMTopLevelType('pointermove'); var TOP_POINTER_OUT = unsafeCastStringToDOMTopLevelType('pointerout'); var TOP_POINTER_OVER = unsafeCastStringToDOMTopLevelType('pointerover'); var TOP_POINTER_UP = unsafeCastStringToDOMTopLevelType('pointerup'); var TOP_PROGRESS = unsafeCastStringToDOMTopLevelType('progress'); var TOP_RATE_CHANGE = unsafeCastStringToDOMTopLevelType('ratechange'); var TOP_RESET = unsafeCastStringToDOMTopLevelType('reset'); var TOP_SCROLL = unsafeCastStringToDOMTopLevelType('scroll'); var TOP_SEEKED = unsafeCastStringToDOMTopLevelType('seeked'); var TOP_SEEKING = unsafeCastStringToDOMTopLevelType('seeking'); var TOP_SELECTION_CHANGE = unsafeCastStringToDOMTopLevelType('selectionchange'); var TOP_STALLED = unsafeCastStringToDOMTopLevelType('stalled'); var TOP_SUBMIT = unsafeCastStringToDOMTopLevelType('submit'); var TOP_SUSPEND = unsafeCastStringToDOMTopLevelType('suspend'); var TOP_TEXT_INPUT = unsafeCastStringToDOMTopLevelType('textInput'); var TOP_TIME_UPDATE = unsafeCastStringToDOMTopLevelType('timeupdate'); var TOP_TOGGLE = unsafeCastStringToDOMTopLevelType('toggle'); var TOP_TOUCH_CANCEL = unsafeCastStringToDOMTopLevelType('touchcancel'); var TOP_TOUCH_END = unsafeCastStringToDOMTopLevelType('touchend'); var TOP_TOUCH_MOVE = unsafeCastStringToDOMTopLevelType('touchmove'); var TOP_TOUCH_START = unsafeCastStringToDOMTopLevelType('touchstart'); var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('transitionend')); var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange'); var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting'); var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel'); // List of events that need to be individually attached to media elements. // Note that events in this list will *not* be listened to at the top level // unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`. var mediaEventTypes = [TOP_ABORT, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_VOLUME_CHANGE, TOP_WAITING]; function getRawEventName(topLevelType) { return unsafeCastDOMTopLevelTypeToString(topLevelType); } /** * These variables store information about text content of a target node, * allowing comparison of content before and after a given event. * * Identify the node where selection currently begins, then observe * both its text content and its current position in the DOM. Since the * browser may natively replace the target node during composition, we can * use its position to find its replacement. * * */ var root = null; var startText = null; var fallbackText = null; function initialize(nativeEventTarget) { root = nativeEventTarget; startText = getText(); return true; } function reset() { root = null; startText = null; fallbackText = null; } function getData() { if (fallbackText) { return fallbackText; } var start = void 0; var startValue = startText; var startLength = startValue.length; var end = void 0; var endValue = getText(); var endLength = endValue.length; for (start = 0; start < startLength; start++) { if (startValue[start] !== endValue[start]) { break; } } var minEnd = startLength - start; for (end = 1; end <= minEnd; end++) { if (startValue[startLength - end] !== endValue[endLength - end]) { break; } } var sliceTail = end > 1 ? 1 - end : undefined; fallbackText = endValue.slice(start, sliceTail); return fallbackText; } function getText() { if ('value' in root) { return root.value; } return root.textContent; } /* eslint valid-typeof: 0 */ var EVENT_POOL_SIZE = 10; /** * @interface Event * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var EventInterface = { type: null, target: null, // currentTarget is set when dispatching; no use in copying it here currentTarget: function () { return null; }, eventPhase: null, bubbles: null, cancelable: null, timeStamp: function (event) { return event.timeStamp || Date.now(); }, defaultPrevented: null, isTrusted: null }; function functionThatReturnsTrue() { return true; } function functionThatReturnsFalse() { return false; } /** * Synthetic events are dispatched by event plugins, typically in response to a * top-level event delegation handler. * * These systems should generally use pooling to reduce the frequency of garbage * collection. The system should check `isPersistent` to determine whether the * event should be released into the pool after being dispatched. Users that * need a persisted event should invoke `persist`. * * Synthetic events (and subclasses) implement the DOM Level 3 Events API by * normalizing browser quirks. Subclasses do not necessarily have to implement a * DOM interface; custom application-specific events can also subclass this. * * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {*} targetInst Marker identifying the event target. * @param {object} nativeEvent Native browser event. * @param {DOMEventTarget} nativeEventTarget Target node. */ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) { { // these have a getter/setter for warnings delete this.nativeEvent; delete this.preventDefault; delete this.stopPropagation; delete this.isDefaultPrevented; delete this.isPropagationStopped; } this.dispatchConfig = dispatchConfig; this._targetInst = targetInst; this.nativeEvent = nativeEvent; var Interface = this.constructor.Interface; for (var propName in Interface) { if (!Interface.hasOwnProperty(propName)) { continue; } { delete this[propName]; // this has a getter/setter for warnings } var normalize = Interface[propName]; if (normalize) { this[propName] = normalize(nativeEvent); } else { if (propName === 'target') { this.target = nativeEventTarget; } else { this[propName] = nativeEvent[propName]; } } } var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; if (defaultPrevented) { this.isDefaultPrevented = functionThatReturnsTrue; } else { this.isDefaultPrevented = functionThatReturnsFalse; } this.isPropagationStopped = functionThatReturnsFalse; return this; } _assign(SyntheticEvent.prototype, { preventDefault: function () { this.defaultPrevented = true; var event = this.nativeEvent; if (!event) { return; } if (event.preventDefault) { event.preventDefault(); } else if (typeof event.returnValue !== 'unknown') { event.returnValue = false; } this.isDefaultPrevented = functionThatReturnsTrue; }, stopPropagation: function () { var event = this.nativeEvent; if (!event) { return; } if (event.stopPropagation) { event.stopPropagation(); } else if (typeof event.cancelBubble !== 'unknown') { // The ChangeEventPlugin registers a "propertychange" event for // IE. This event does not support bubbling or cancelling, and // any references to cancelBubble throw "Member not found". A // typeof check of "unknown" circumvents this issue (and is also // IE specific). event.cancelBubble = true; } this.isPropagationStopped = functionThatReturnsTrue; }, /** * We release all dispatched `SyntheticEvent`s after each event loop, adding * them back into the pool. This allows a way to hold onto a reference that * won't be added back into the pool. */ persist: function () { this.isPersistent = functionThatReturnsTrue; }, /** * Checks if this event should be released back into the pool. * * @return {boolean} True if this should not be released, false otherwise. */ isPersistent: functionThatReturnsFalse, /** * `PooledClass` looks for `destructor` on each instance it releases. */ destructor: function () { var Interface = this.constructor.Interface; for (var propName in Interface) { { Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName])); } } this.dispatchConfig = null; this._targetInst = null; this.nativeEvent = null; this.isDefaultPrevented = functionThatReturnsFalse; this.isPropagationStopped = functionThatReturnsFalse; this._dispatchListeners = null; this._dispatchInstances = null; { Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null)); Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse)); Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse)); Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {})); Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {})); } } }); SyntheticEvent.Interface = EventInterface; /** * Helper to reduce boilerplate when creating subclasses. */ SyntheticEvent.extend = function (Interface) { var Super = this; var E = function () {}; E.prototype = Super.prototype; var prototype = new E(); function Class() { return Super.apply(this, arguments); } _assign(prototype, Class.prototype); Class.prototype = prototype; Class.prototype.constructor = Class; Class.Interface = _assign({}, Super.Interface, Interface); Class.extend = Super.extend; addEventPoolingTo(Class); return Class; }; addEventPoolingTo(SyntheticEvent); /** * Helper to nullify syntheticEvent instance properties when destructing * * @param {String} propName * @param {?object} getVal * @return {object} defineProperty object */ function getPooledWarningPropertyDefinition(propName, getVal) { var isFunction = typeof getVal === 'function'; return { configurable: true, set: set, get: get }; function set(val) { var action = isFunction ? 'setting the method' : 'setting the property'; warn(action, 'This is effectively a no-op'); return val; } function get() { var action = isFunction ? 'accessing the method' : 'accessing the property'; var result = isFunction ? 'This is a no-op function' : 'This is set to null'; warn(action, result); return getVal; } function warn(action, result) { var warningCondition = false; !warningCondition ? warningWithoutStack$1(false, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0; } } function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { var EventConstructor = this; if (EventConstructor.eventPool.length) { var instance = EventConstructor.eventPool.pop(); EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst); return instance; } return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst); } function releasePooledEvent(event) { var EventConstructor = this; !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0; event.destructor(); if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) { EventConstructor.eventPool.push(event); } } function addEventPoolingTo(EventConstructor) { EventConstructor.eventPool = []; EventConstructor.getPooled = getPooledEvent; EventConstructor.release = releasePooledEvent; } /** * @interface Event * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents */ var SyntheticCompositionEvent = SyntheticEvent.extend({ data: null }); /** * @interface Event * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 * /#events-inputevents */ var SyntheticInputEvent = SyntheticEvent.extend({ data: null }); var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space var START_KEYCODE = 229; var canUseCompositionEvent = canUseDOM && 'CompositionEvent' in window; var documentMode = null; if (canUseDOM && 'documentMode' in document) { documentMode = document.documentMode; } // Webkit offers a very useful `textInput` event that can be used to // directly represent `beforeInput`. The IE `textinput` event is not as // useful, so we don't use it. var canUseTextInputEvent = canUseDOM && 'TextEvent' in window && !documentMode; // In IE9+, we have access to composition events, but the data supplied // by the native compositionend event may be incorrect. Japanese ideographic // spaces, for instance (\u3000) are not recorded correctly. var useFallbackCompositionData = canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); var SPACEBAR_CODE = 32; var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); // Events and their corresponding property names. var eventTypes = { beforeInput: { phasedRegistrationNames: { bubbled: 'onBeforeInput', captured: 'onBeforeInputCapture' }, dependencies: [TOP_COMPOSITION_END, TOP_KEY_PRESS, TOP_TEXT_INPUT, TOP_PASTE] }, compositionEnd: { phasedRegistrationNames: { bubbled: 'onCompositionEnd', captured: 'onCompositionEndCapture' }, dependencies: [TOP_BLUR, TOP_COMPOSITION_END, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN] }, compositionStart: { phasedRegistrationNames: { bubbled: 'onCompositionStart', captured: 'onCompositionStartCapture' }, dependencies: [TOP_BLUR, TOP_COMPOSITION_START, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN] }, compositionUpdate: { phasedRegistrationNames: { bubbled: 'onCompositionUpdate', captured: 'onCompositionUpdateCapture' }, dependencies: [TOP_BLUR, TOP_COMPOSITION_UPDATE, TOP_KEY_DOWN, TOP_KEY_PRESS, TOP_KEY_UP, TOP_MOUSE_DOWN] } }; // Track whether we've ever handled a keypress on the space key. var hasSpaceKeypress = false; /** * Return whether a native keypress event is assumed to be a command. * This is required because Firefox fires `keypress` events for key commands * (cut, copy, select-all, etc.) even though no character is inserted. */ function isKeypressCommand(nativeEvent) { return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && // ctrlKey && altKey is equivalent to AltGr, and is not a command. !(nativeEvent.ctrlKey && nativeEvent.altKey); } /** * Translate native top level events into event types. * * @param {string} topLevelType * @return {object} */ function getCompositionEventType(topLevelType) { switch (topLevelType) { case TOP_COMPOSITION_START: return eventTypes.compositionStart; case TOP_COMPOSITION_END: return eventTypes.compositionEnd; case TOP_COMPOSITION_UPDATE: return eventTypes.compositionUpdate; } } /** * Does our fallback best-guess model think this event signifies that * composition has begun? * * @param {string} topLevelType * @param {object} nativeEvent * @return {boolean} */ function isFallbackCompositionStart(topLevelType, nativeEvent) { return topLevelType === TOP_KEY_DOWN && nativeEvent.keyCode === START_KEYCODE; } /** * Does our fallback mode think that this event is the end of composition? * * @param {string} topLevelType * @param {object} nativeEvent * @return {boolean} */ function isFallbackCompositionEnd(topLevelType, nativeEvent) { switch (topLevelType) { case TOP_KEY_UP: // Command keys insert or clear IME input. return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; case TOP_KEY_DOWN: // Expect IME keyCode on each keydown. If we get any other // code we must have exited earlier. return nativeEvent.keyCode !== START_KEYCODE; case TOP_KEY_PRESS: case TOP_MOUSE_DOWN: case TOP_BLUR: // Events are not possible without cancelling IME. return true; default: return false; } } /** * Google Input Tools provides composition data via a CustomEvent, * with the `data` property populated in the `detail` object. If this * is available on the event object, use it. If not, this is a plain * composition event and we have nothing special to extract. * * @param {object} nativeEvent * @return {?string} */ function getDataFromCustomEvent(nativeEvent) { var detail = nativeEvent.detail; if (typeof detail === 'object' && 'data' in detail) { return detail.data; } return null; } /** * Check if a composition event was triggered by Korean IME. * Our fallback mode does not work well with IE's Korean IME, * so just use native composition events when Korean IME is used. * Although CompositionEvent.locale property is deprecated, * it is available in IE, where our fallback mode is enabled. * * @param {object} nativeEvent * @return {boolean} */ function isUsingKoreanIME(nativeEvent) { return nativeEvent.locale === 'ko'; } // Track the current IME composition status, if any. var isComposing = false; /** * @return {?object} A SyntheticCompositionEvent. */ function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { var eventType = void 0; var fallbackData = void 0; if (canUseCompositionEvent) { eventType = getCompositionEventType(topLevelType); } else if (!isComposing) { if (isFallbackCompositionStart(topLevelType, nativeEvent)) { eventType = eventTypes.compositionStart; } } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { eventType = eventTypes.compositionEnd; } if (!eventType) { return null; } if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) { // The current composition is stored statically and must not be // overwritten while composition continues. if (!isComposing && eventType === eventTypes.compositionStart) { isComposing = initialize(nativeEventTarget); } else if (eventType === eventTypes.compositionEnd) { if (isComposing) { fallbackData = getData(); } } } var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget); if (fallbackData) { // Inject data generated from fallback path into the synthetic event. // This matches the property of native CompositionEventInterface. event.data = fallbackData; } else { var customData = getDataFromCustomEvent(nativeEvent); if (customData !== null) { event.data = customData; } } accumulateTwoPhaseDispatches(event); return event; } /** * @param {TopLevelType} topLevelType Number from `TopLevelType`. * @param {object} nativeEvent Native browser event. * @return {?string} The string corresponding to this `beforeInput` event. */ function getNativeBeforeInputChars(topLevelType, nativeEvent) { switch (topLevelType) { case TOP_COMPOSITION_END: return getDataFromCustomEvent(nativeEvent); case TOP_KEY_PRESS: /** * If native `textInput` events are available, our goal is to make * use of them. However, there is a special case: the spacebar key. * In Webkit, preventing default on a spacebar `textInput` event * cancels character insertion, but it *also* causes the browser * to fall back to its default spacebar behavior of scrolling the * page. * * Tracking at: * https://code.google.com/p/chromium/issues/detail?id=355103 * * To avoid this issue, use the keypress event as if no `textInput` * event is available. */ var which = nativeEvent.which; if (which !== SPACEBAR_CODE) { return null; } hasSpaceKeypress = true; return SPACEBAR_CHAR; case TOP_TEXT_INPUT: // Record the characters to be added to the DOM. var chars = nativeEvent.data; // If it's a spacebar character, assume that we have already handled // it at the keypress level and bail immediately. Android Chrome // doesn't give us keycodes, so we need to ignore it. if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { return null; } return chars; default: // For other native event types, do nothing. return null; } } /** * For browsers that do not provide the `textInput` event, extract the * appropriate string to use for SyntheticInputEvent. * * @param {number} topLevelType Number from `TopLevelEventTypes`. * @param {object} nativeEvent Native browser event. * @return {?string} The fallback string for this `beforeInput` event. */ function getFallbackBeforeInputChars(topLevelType, nativeEvent) { // If we are currently composing (IME) and using a fallback to do so, // try to extract the composed characters from the fallback object. // If composition event is available, we extract a string only at // compositionevent, otherwise extract it at fallback events. if (isComposing) { if (topLevelType === TOP_COMPOSITION_END || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) { var chars = getData(); reset(); isComposing = false; return chars; } return null; } switch (topLevelType) { case TOP_PASTE: // If a paste event occurs after a keypress, throw out the input // chars. Paste events should not lead to BeforeInput events. return null; case TOP_KEY_PRESS: /** * As of v27, Firefox may fire keypress events even when no character * will be inserted. A few possibilities: * * - `which` is `0`. Arrow keys, Esc key, etc. * * - `which` is the pressed key code, but no char is available. * Ex: 'AltGr + d` in Polish. There is no modified character for * this key combination and no character is inserted into the * document, but FF fires the keypress for char code `100` anyway. * No `input` event will occur. * * - `which` is the pressed key code, but a command combination is * being used. Ex: `Cmd+C`. No character is inserted, and no * `input` event will occur. */ if (!isKeypressCommand(nativeEvent)) { // IE fires the `keypress` event when a user types an emoji via // Touch keyboard of Windows. In such a case, the `char` property // holds an emoji character like `\uD83D\uDE0A`. Because its length // is 2, the property `which` does not represent an emoji correctly. // In such a case, we directly return the `char` property instead of // using `which`. if (nativeEvent.char && nativeEvent.char.length > 1) { return nativeEvent.char; } else if (nativeEvent.which) { return String.fromCharCode(nativeEvent.which); } } return null; case TOP_COMPOSITION_END: return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data; default: return null; } } /** * Extract a SyntheticInputEvent for `beforeInput`, based on either native * `textInput` or fallback behavior. * * @return {?object} A SyntheticInputEvent. */ function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { var chars = void 0; if (canUseTextInputEvent) { chars = getNativeBeforeInputChars(topLevelType, nativeEvent); } else { chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); } // If no characters are being inserted, no BeforeInput event should // be fired. if (!chars) { return null; } var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget); event.data = chars; accumulateTwoPhaseDispatches(event); return event; } /** * Create an `onBeforeInput` event to match * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. * * This event plugin is based on the native `textInput` event * available in Chrome, Safari, Opera, and IE. This event fires after * `onKeyPress` and `onCompositionEnd`, but before `onInput`. * * `beforeInput` is spec'd but not implemented in any browsers, and * the `input` event does not provide any useful information about what has * actually been added, contrary to the spec. Thus, `textInput` is the best * available event to identify the characters that have actually been inserted * into the target node. * * This plugin is also responsible for emitting `composition` events, thus * allowing us to share composition fallback code for both `beforeInput` and * `composition` event types. */ var BeforeInputEventPlugin = { eventTypes: eventTypes, extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { var composition = extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget); var beforeInput = extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget); if (composition === null) { return beforeInput; } if (beforeInput === null) { return composition; } return [composition, beforeInput]; } }; // Use to restore controlled state after a change event has fired. var restoreImpl = null; var restoreTarget = null; var restoreQueue = null; function restoreStateOfTarget(target) { // We perform this translation at the end of the event loop so that we // always receive the correct fiber here var internalInstance = getInstanceFromNode(target); if (!internalInstance) { // Unmounted return; } !(typeof restoreImpl === 'function') ? invariant(false, 'setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue.') : void 0; var props = getFiberCurrentPropsFromNode(internalInstance.stateNode); restoreImpl(internalInstance.stateNode, internalInstance.type, props); } function setRestoreImplementation(impl) { restoreImpl = impl; } function enqueueStateRestore(target) { if (restoreTarget) { if (restoreQueue) { restoreQueue.push(target); } else { restoreQueue = [target]; } } else { restoreTarget = target; } } function needsStateRestore() { return restoreTarget !== null || restoreQueue !== null; } function restoreStateIfNeeded() { if (!restoreTarget) { return; } var target = restoreTarget; var queuedTargets = restoreQueue; restoreTarget = null; restoreQueue = null; restoreStateOfTarget(target); if (queuedTargets) { for (var i = 0; i < queuedTargets.length; i++) { restoreStateOfTarget(queuedTargets[i]); } } } // Used as a way to call batchedUpdates when we don't have a reference to // the renderer. Such as when we're dispatching events or if third party // libraries need to call batchedUpdates. Eventually, this API will go away when // everything is batched by default. We'll then have a similar API to opt-out of // scheduled work and instead do synchronous work. // Defaults var _batchedUpdatesImpl = function (fn, bookkeeping) { return fn(bookkeeping); }; var _interactiveUpdatesImpl = function (fn, a, b) { return fn(a, b); }; var _flushInteractiveUpdatesImpl = function () {}; var isBatching = false; function batchedUpdates(fn, bookkeeping) { if (isBatching) { // If we are currently inside another batch, we need to wait until it // fully completes before restoring state. return fn(bookkeeping); } isBatching = true; try { return _batchedUpdatesImpl(fn, bookkeeping); } finally { // Here we wait until all updates have propagated, which is important // when using controlled components within layers: // https://github.com/facebook/react/issues/1698 // Then we restore state of any controlled component. isBatching = false; var controlledComponentsHavePendingUpdates = needsStateRestore(); if (controlledComponentsHavePendingUpdates) { // If a controlled event was fired, we may need to restore the state of // the DOM node back to the controlled value. This is necessary when React // bails out of the update without touching the DOM. _flushInteractiveUpdatesImpl(); restoreStateIfNeeded(); } } } function interactiveUpdates(fn, a, b) { return _interactiveUpdatesImpl(fn, a, b); } function setBatchingImplementation(batchedUpdatesImpl, interactiveUpdatesImpl, flushInteractiveUpdatesImpl) { _batchedUpdatesImpl = batchedUpdatesImpl; _interactiveUpdatesImpl = interactiveUpdatesImpl; _flushInteractiveUpdatesImpl = flushInteractiveUpdatesImpl; } /** * @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(); if (nodeName === 'input') { return !!supportedInputTypes[elem.type]; } if (nodeName === 'textarea') { return true; } return false; } /** * HTML nodeType values that represent the type of the node */ var ELEMENT_NODE = 1; var TEXT_NODE = 3; var COMMENT_NODE = 8; var DOCUMENT_NODE = 9; var DOCUMENT_FRAGMENT_NODE = 11; /** * Gets the target node from a native browser event by accounting for * inconsistencies in browser DOM APIs. * * @param {object} nativeEvent Native browser event. * @return {DOMEventTarget} Target node. */ function getEventTarget(nativeEvent) { // Fallback to nativeEvent.srcElement for IE9 // https://github.com/facebook/react/issues/12506 var target = nativeEvent.target || nativeEvent.srcElement || window; // Normalize SVG element events #4963 if (target.correspondingUseElement) { target = target.correspondingUseElement; } // Safari may fire events on text nodes (Node.TEXT_NODE is 3). // @see http://www.quirksmode.org/js/events_properties.html return target.nodeType === TEXT_NODE ? target.parentNode : target; } /** * Checks if an event is supported in the current execution environment. * * NOTE: This will not work correctly for non-generic events such as `change`, * `reset`, `load`, `error`, and `select`. * * Borrows from Modernizr. * * @param {string} eventNameSuffix Event name, e.g. "click". * @return {boolean} True if the event is supported. * @internal * @license Modernizr 3.0.0pre (Custom Build) | MIT */ function isEventSupported(eventNameSuffix) { if (!canUseDOM) { return false; } var eventName = 'on' + eventNameSuffix; var isSupported = eventName in document; if (!isSupported) { var element = document.createElement('div'); element.setAttribute(eventName, 'return;'); isSupported = typeof element[eventName] === 'function'; } return isSupported; } function isCheckable(elem) { var type = elem.type; var nodeName = elem.nodeName; return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio'); } function getTracker(node) { return node._valueTracker; } function detachTracker(node) { node._valueTracker = null; } function getValueFromNode(node) { var value = ''; if (!node) { return value; } if (isCheckable(node)) { value = node.checked ? 'true' : 'false'; } else { value = node.value; } return value; } function trackValueOnNode(node) { var valueField = isCheckable(node) ? 'checked' : 'value'; var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField); var currentValue = '' + node[valueField]; // if someone has already defined a value or Safari, then bail // and don't track value will cause over reporting of changes, // but it's better then a hard failure // (needed for certain tests that spyOn input values and Safari) if (node.hasOwnProperty(valueField) || typeof descriptor === 'undefined' || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') { return; } var get = descriptor.get, set = descriptor.set; Object.defineProperty(node, valueField, { configurable: true, get: function () { return get.call(this); }, set: function (value) { currentValue = '' + value; set.call(this, value); } }); // We could've passed this the first time // but it triggers a bug in IE11 and Edge 14/15. // Calling defineProperty() again should be equivalent. // https://github.com/facebook/react/issues/11768 Object.defineProperty(node, valueField, { enumerable: descriptor.enumerable }); var tracker = { getValue: function () { return currentValue; }, setValue: function (value) { currentValue = '' + value; }, stopTracking: function () { detachTracker(node); delete node[valueField]; } }; return tracker; } function track(node) { if (getTracker(node)) { return; } // TODO: Once it's just Fiber we can move this to node._wrapperState node._valueTracker = trackValueOnNode(node); } function updateValueIfChanged(node) { if (!node) { return false; } var tracker = getTracker(node); // if there is no tracker at this point it's unlikely // that trying again will succeed if (!tracker) { return true; } var lastValue = tracker.getValue(); var nextValue = getValueFromNode(node); if (nextValue !== lastValue) { tracker.setValue(nextValue); return true; } return false; } var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions. // Current owner and dispatcher used to share the same ref, // but PR #14548 split them out to better support the react-debug-tools package. if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) { ReactSharedInternals.ReactCurrentDispatcher = { current: null }; } var BEFORE_SLASH_RE = /^(.*)[\\\/]/; var describeComponentFrame = function (name, source, ownerName) { var sourceInfo = ''; if (source) { var path = source.fileName; var fileName = path.replace(BEFORE_SLASH_RE, ''); { // In DEV, include code for a common special case: // prefer "folder/index.js" instead of just "index.js". if (/^index\./.test(fileName)) { var match = path.match(BEFORE_SLASH_RE); if (match) { var pathBeforeSlash = match[1]; if (pathBeforeSlash) { var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, ''); fileName = folderName + '/' + fileName; } } } } sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')'; } else if (ownerName) { sourceInfo = ' (created by ' + ownerName + ')'; } return '\n in ' + (name || 'Unknown') + sourceInfo; }; // The Symbol used to tag the ReactElement-like types. If there is no native Symbol // nor polyfill, then a plain number is used for performance. var hasSymbol = typeof Symbol === 'function' && Symbol.for; var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; var FAUX_ITERATOR_SYMBOL = '@@iterator'; function getIteratorFn(maybeIterable) { if (maybeIterable === null || typeof maybeIterable !== 'object') { return null; } var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; if (typeof maybeIterator === 'function') { return maybeIterator; } return null; } var Pending = 0; var Resolved = 1; var Rejected = 2; function refineResolvedLazyComponent(lazyComponent) { return lazyComponent._status === Resolved ? lazyComponent._result : null; } function getWrappedName(outerType, innerType, wrapperName) { var functionName = innerType.displayName || innerType.name || ''; return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName); } function getComponentName(type) { if (type == null) { // Host root, text node or just invalid type. return null; } { if (typeof type.tag === 'number') { warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.'); } } if (typeof type === 'function') { return type.displayName || type.name || null; } if (typeof type === 'string') { return type; } switch (type) { case REACT_CONCURRENT_MODE_TYPE: return 'ConcurrentMode'; case REACT_FRAGMENT_TYPE: return 'Fragment'; case REACT_PORTAL_TYPE: return 'Portal'; case REACT_PROFILER_TYPE: return 'Profiler'; case REACT_STRICT_MODE_TYPE: return 'StrictMode'; case REACT_SUSPENSE_TYPE: return 'Suspense'; } if (typeof type === 'object') { switch (type.$$typeof) { case REACT_CONTEXT_TYPE: return 'Context.Consumer'; case REACT_PROVIDER_TYPE: return 'Context.Provider'; case REACT_FORWARD_REF_TYPE: return getWrappedName(type, type.render, 'ForwardRef'); case REACT_MEMO_TYPE: return getComponentName(type.type); case REACT_LAZY_TYPE: { var thenable = type; var resolvedThenable = refineResolvedLazyComponent(thenable); if (resolvedThenable) { return getComponentName(resolvedThenable); } } } } return null; } var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; function describeFiber(fiber) { switch (fiber.tag) { case HostRoot: case HostPortal: case HostText: case Fragment: case ContextProvider: case ContextConsumer: return ''; default: var owner = fiber._debugOwner; var source = fiber._debugSource; var name = getComponentName(fiber.type); var ownerName = null; if (owner) { ownerName = getComponentName(owner.type); } return describeComponentFrame(name, source, ownerName); } } function getStackByFiberInDevAndProd(workInProgress) { var info = ''; var node = workInProgress; do { info += describeFiber(node); node = node.return; } while (node); return info; } var current = null; var phase = null; function getCurrentFiberOwnerNameInDevOrNull() { { if (current === null) { return null; } var owner = current._debugOwner; if (owner !== null && typeof owner !== 'undefined') { return getComponentName(owner.type); } } return null; } function getCurrentFiberStackInDev() { { if (current === null) { return ''; } // Safe because if current fiber exists, we are reconciling, // and it is guaranteed to be the work-in-progress version. return getStackByFiberInDevAndProd(current); } return ''; } function resetCurrentFiber() { { ReactDebugCurrentFrame.getCurrentStack = null; current = null; phase = null; } } function setCurrentFiber(fiber) { { ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackInDev; current = fiber; phase = null; } } function setCurrentPhase(lifeCyclePhase) { { phase = lifeCyclePhase; } } /** * Similar to invariant but only logs a warning if the condition is not met. * This can be used to log issues in development environments in critical * paths. Removing the logging code for production environments will keep the * same logic and follow the same code paths. */ var warning = warningWithoutStack$1; { warning = function (condition, format) { if (condition) { return; } var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; var stack = ReactDebugCurrentFrame.getStackAddendum(); // eslint-disable-next-line react-internal/warning-and-invariant-args for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack])); }; } var warning$1 = warning; // A reserved attribute. // It is handled by React separately and shouldn't be written to the DOM. var RESERVED = 0; // A simple string attribute. // Attributes that aren't in the whitelist are presumed to have this type. var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called // "enumerated" attributes with "true" and "false" as possible values. // When true, it should be set to a "true" string. // When false, it should be set to a "false" string. var BOOLEANISH_STRING = 2; // A real boolean attribute. // When true, it should be present (set either to an empty string or its name). // When false, it should be omitted. var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value. // When true, it should be present (set either to an empty string or its name). // When false, it should be omitted. // For any other value, should be present with that value. var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric. // When falsy, it should be removed. var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric. // When falsy, it should be removed. var POSITIVE_NUMERIC = 6; /* eslint-disable max-len */ var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD'; /* eslint-enable max-len */ var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040'; var ROOT_ATTRIBUTE_NAME = 'data-reactroot'; var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$'); var hasOwnProperty = Object.prototype.hasOwnProperty; var illegalAttributeNameCache = {}; var validatedAttributeNameCache = {}; function isAttributeNameSafe(attributeName) { if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) { return true; } if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) { return false; } if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { validatedAttributeNameCache[attributeName] = true; return true; } illegalAttributeNameCache[attributeName] = true; { warning$1(false, 'Invalid attribute name: `%s`', attributeName); } return false; } function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) { if (propertyInfo !== null) { return propertyInfo.type === RESERVED; } if (isCustomComponentTag) { return false; } if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) { return true; } return false; } function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) { if (propertyInfo !== null && propertyInfo.type === RESERVED) { return false; } switch (typeof value) { case 'function': // $FlowIssue symbol is perfectly valid here case 'symbol': // eslint-disable-line return true; case 'boolean': { if (isCustomComponentTag) { return false; } if (propertyInfo !== null) { return !propertyInfo.acceptsBooleans; } else { var prefix = name.toLowerCase().slice(0, 5); return prefix !== 'data-' && prefix !== 'aria-'; } } default: return false; } } function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) { if (value === null || typeof value === 'undefined') { return true; } if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) { return true; } if (isCustomComponentTag) { return false; } if (propertyInfo !== null) { switch (propertyInfo.type) { case BOOLEAN: return !value; case OVERLOADED_BOOLEAN: return value === false; case NUMERIC: return isNaN(value); case POSITIVE_NUMERIC: return isNaN(value) || value < 1; } } return false; } function getPropertyInfo(name) { return properties.hasOwnProperty(name) ? properties[name] : null; } function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace) { this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN; this.attributeName = attributeName; this.attributeNamespace = attributeNamespace; this.mustUseProperty = mustUseProperty; this.propertyName = name; this.type = type; } // When adding attributes to this list, be sure to also add them to // the `possibleStandardNames` module to ensure casing and incorrect // name warnings. var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM. ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular // elements (not just inputs). Now that ReactDOMInput assigns to the // defaultValue property -- do we need this? 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty name, // attributeName null); } // attributeNamespace ); // A few React string attributes have a different name. // This is a mapping from React prop names to the attribute names. [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) { var name = _ref[0], attributeName = _ref[1]; properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty attributeName, // attributeName null); } // attributeNamespace ); // These are "enumerated" HTML attributes that accept "true" and "false". // In React, we let users pass `true` and `false` even though technically // these aren't boolean attributes (they are coerced to strings). ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty name.toLowerCase(), // attributeName null); } // attributeNamespace ); // These are "enumerated" SVG attributes that accept "true" and "false". // In React, we let users pass `true` and `false` even though technically // these aren't boolean attributes (they are coerced to strings). // Since these are SVG attributes, their attribute names are case-sensitive. ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty name, // attributeName null); } // attributeNamespace ); // These are HTML boolean attributes. ['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM // on the client side because the browsers are inconsistent. Instead we call focus(). 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata 'itemScope'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty name.toLowerCase(), // attributeName null); } // attributeNamespace ); // These are the few React props that we set as DOM properties // rather than attributes. These are all booleans. ['checked', // Note: `option.selected` is not updated if `select.multiple` is // disabled with `removeAttribute`. We have special logic for handling this. 'multiple', 'muted', 'selected'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty name, // attributeName null); } // attributeNamespace ); // These are HTML attributes that are "overloaded booleans": they behave like // booleans, but can also accept a string value. ['capture', 'download'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty name, // attributeName null); } // attributeNamespace ); // These are HTML attributes that must be positive numbers. ['cols', 'rows', 'size', 'span'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty name, // attributeName null); } // attributeNamespace ); // These are HTML attributes that must be numbers. ['rowSpan', 'start'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty name.toLowerCase(), // attributeName null); } // attributeNamespace ); var CAMELIZE = /[\-\:]([a-z])/g; var capitalize = function (token) { return token[1].toUpperCase(); }; // This is a list of all SVG attributes that need special casing, namespacing, // or boolean value assignment. Regular attributes that just accept strings // and have the same names are omitted, just like in the HTML whitelist. // Some of these attributes can be hard to find. This list was created by // scrapping the MDN documentation. ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (attributeName) { var name = attributeName.replace(CAMELIZE, capitalize); properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty attributeName, null); } // attributeNamespace ); // String SVG attributes with the xlink namespace. ['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) { var name = attributeName.replace(CAMELIZE, capitalize); properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty attributeName, 'http://www.w3.org/1999/xlink'); }); // String SVG attributes with the xml namespace. ['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) { var name = attributeName.replace(CAMELIZE, capitalize); properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty attributeName, 'http://www.w3.org/XML/1998/namespace'); }); // These attribute exists both in HTML and SVG. // The attribute name is case-sensitive in SVG so we can't just use // the React name like we do for attributes that exist only in HTML. ['tabIndex', 'crossOrigin'].forEach(function (attributeName) { properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty attributeName.toLowerCase(), // attributeName null); } // attributeNamespace ); /** * Get the value for a property on a node. Only used in DEV for SSR validation. * The "expected" argument is used as a hint of what the expected value is. * Some properties have multiple equivalent values. */ function getValueForProperty(node, name, expected, propertyInfo) { { if (propertyInfo.mustUseProperty) { var propertyName = propertyInfo.propertyName; return node[propertyName]; } else { var attributeName = propertyInfo.attributeName; var stringValue = null; if (propertyInfo.type === OVERLOADED_BOOLEAN) { if (node.hasAttribute(attributeName)) { var value = node.getAttribute(attributeName); if (value === '') { return true; } if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { return value; } if (value === '' + expected) { return expected; } return value; } } else if (node.hasAttribute(attributeName)) { if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { // We had an attribute but shouldn't have had one, so read it // for the error message. return node.getAttribute(attributeName); } if (propertyInfo.type === BOOLEAN) { // If this was a boolean, it doesn't matter what the value is // the fact that we have it is the same as the expected. return expected; } // Even if this property uses a namespace we use getAttribute // because we assume its namespaced name is the same as our config. // To use getAttributeNS we need the local name which we don't have // in our config atm. stringValue = node.getAttribute(attributeName); } if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { return stringValue === null ? expected : stringValue; } else if (stringValue === '' + expected) { return expected; } else { return stringValue; } } } } /** * Get the value for a attribute on a node. Only used in DEV for SSR validation. * The third argument is used as a hint of what the expected value is. Some * attributes have multiple equivalent values. */ function getValueForAttribute(node, name, expected) { { if (!isAttributeNameSafe(name)) { return; } if (!node.hasAttribute(name)) { return expected === undefined ? undefined : null; } var value = node.getAttribute(name); if (value === '' + expected) { return expected; } return value; } } /** * Sets the value for a property on a node. * * @param {DOMElement} node * @param {string} name * @param {*} value */ function setValueForProperty(node, name, value, isCustomComponentTag) { var propertyInfo = getPropertyInfo(name); if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) { return; } if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) { value = null; } // If the prop isn't in the special list, treat it as a simple attribute. if (isCustomComponentTag || propertyInfo === null) { if (isAttributeNameSafe(name)) { var _attributeName = name; if (value === null) { node.removeAttribute(_attributeName); } else { node.setAttribute(_attributeName, '' + value); } } return; } var mustUseProperty = propertyInfo.mustUseProperty; if (mustUseProperty) { var propertyName = propertyInfo.propertyName; if (value === null) { var type = propertyInfo.type; node[propertyName] = type === BOOLEAN ? false : ''; } else { // Contrary to `setAttribute`, object properties are properly // `toString`ed by IE8/9. node[propertyName] = value; } return; } // The rest are treated as attributes with special cases. var attributeName = propertyInfo.attributeName, attributeNamespace = propertyInfo.attributeNamespace; if (value === null) { node.removeAttribute(attributeName); } else { var _type = propertyInfo.type; var attributeValue = void 0; if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) { attributeValue = ''; } else { // `setAttribute` with objects becomes only `[object]` in IE8/9, // ('' + value) makes it output the correct toString()-value. attributeValue = '' + value; } if (attributeNamespace) { node.setAttributeNS(attributeNamespace, attributeName, attributeValue); } else { node.setAttribute(attributeName, attributeValue); } } } // Flow does not allow string concatenation of most non-string types. To work // around this limitation, we use an opaque type that can only be obtained by // passing the value through getToStringValue first. function toString(value) { return '' + value; } function getToStringValue(value) { switch (typeof value) { case 'boolean': case 'number': case 'object': case 'string': case 'undefined': return value; default: // function, symbol are assigned as empty strings return ''; } } var ReactDebugCurrentFrame$1 = null; var ReactControlledValuePropTypes = { checkPropTypes: null }; { ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; var hasReadOnlyValue = { button: true, checkbox: true, image: true, hidden: true, radio: true, reset: true, submit: true }; var propTypes = { value: function (props, propName, componentName) { if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null) { return null; } return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); }, checked: function (props, propName, componentName) { if (props.onChange || props.readOnly || props.disabled || props[propName] == null) { return null; } return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); } }; /** * Provide a linked `value` attribute for controlled forms. You should not use * this outside of the ReactDOM controlled form components. */ ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) { checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$1.getStackAddendum); }; } var enableUserTimingAPI = true; // Helps identify side effects in begin-phase lifecycle hooks and setState reducers: var debugRenderPhaseSideEffects = false; // In some cases, StrictMode should also double-render lifecycles. // This can be confusing for tests though, // And it can be bad for performance in production. // This feature flag can be used to control the behavior: var debugRenderPhaseSideEffectsForStrictMode = true; // To preserve the "Pause on caught exceptions" behavior of the debugger, we // replay the begin phase of a failed component inside invokeGuardedCallback. var replayFailedUnitOfWorkWithInvokeGuardedCallback = true; // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6: var warnAboutDeprecatedLifecycles = false; // Gather advanced timing metrics for Profiler subtrees. var enableProfilerTimer = true; // Trace which interactions trigger each commit. var enableSchedulerTracing = true; // Only used in www builds. var enableSuspenseServerRenderer = false; // TODO: true? Here it might just be false. // Only used in www builds. // Only used in www builds. // React Fire: prevent the value and checked attributes from syncing // with their related DOM properties var disableInputAttributeSyncing = false; // These APIs will no longer be "unstable" in the upcoming 16.7 release, // Control this behavior with a flag to support 16.6 minor releases in the meanwhile. var enableStableConcurrentModeAPIs = false; var warnAboutShorthandPropertyCollision = false; // TODO: direct imports like some-package/src/* are bad. Fix me. var didWarnValueDefaultValue = false; var didWarnCheckedDefaultChecked = false; var didWarnControlledToUncontrolled = false; var didWarnUncontrolledToControlled = false; function isControlled(props) { var usesChecked = props.type === 'checkbox' || props.type === 'radio'; return usesChecked ? props.checked != null : props.value != null; } /** * Implements an host component that allows setting these optional * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. * * If `checked` or `value` are not supplied (or null/undefined), user actions * that affect the checked state or value will trigger updates to the element. * * If they are supplied (and not null/undefined), the rendered element will not * trigger updates to the element. Instead, the props must change in order for * the rendered element to be updated. * * The rendered element will be initialized as unchecked (or `defaultChecked`) * with an empty value (or `defaultValue`). * * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html */ function getHostProps(element, props) { var node = element; var checked = props.checked; var hostProps = _assign({}, props, { defaultChecked: undefined, defaultValue: undefined, value: undefined, checked: checked != null ? checked : node._wrapperState.initialChecked }); return hostProps; } function initWrapperState(element, props) { { ReactControlledValuePropTypes.checkPropTypes('input', props); if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) { warning$1(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type); didWarnCheckedDefaultChecked = true; } if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { warning$1(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input 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 input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type); didWarnValueDefaultValue = true; } } var node = element; var defaultValue = props.defaultValue == null ? '' : props.defaultValue; node._wrapperState = { initialChecked: props.checked != null ? props.checked : props.defaultChecked, initialValue: getToStringValue(props.value != null ? props.value : defaultValue), controlled: isControlled(props) }; } function updateChecked(element, props) { var node = element; var checked = props.checked; if (checked != null) { setValueForProperty(node, 'checked', checked, false); } } function updateWrapper(element, props) { var node = element; { var _controlled = isControlled(props); if (!node._wrapperState.controlled && _controlled && !didWarnUncontrolledToControlled) { warning$1(false, 'A component is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type); didWarnUncontrolledToControlled = true; } if (node._wrapperState.controlled && !_controlled && !didWarnControlledToUncontrolled) { warning$1(false, 'A component is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', props.type); didWarnControlledToUncontrolled = true; } } updateChecked(element, props); var value = getToStringValue(props.value); var type = props.type; if (value != null) { if (type === 'number') { if (value === 0 && node.value === '' || // We explicitly want to coerce to number here if possible. // eslint-disable-next-line node.value != value) { node.value = toString(value); } } else if (node.value !== toString(value)) { node.value = toString(value); } } else if (type === 'submit' || type === 'reset') { // Submit/reset inputs need the attribute removed completely to avoid // blank-text buttons. node.removeAttribute('value'); return; } if (disableInputAttributeSyncing) { // When not syncing the value attribute, React only assigns a new value // whenever the defaultValue React prop has changed. When not present, // React does nothing if (props.hasOwnProperty('defaultValue')) { setDefaultValue(node, props.type, getToStringValue(props.defaultValue)); } } else { // When syncing the value attribute, the value comes from a cascade of // properties: // 1. The value React property // 2. The defaultValue React property // 3. Otherwise there should be no change if (props.hasOwnProperty('value')) { setDefaultValue(node, props.type, value); } else if (props.hasOwnProperty('defaultValue')) { setDefaultValue(node, props.type, getToStringValue(props.defaultValue)); } } if (disableInputAttributeSyncing) { // When not syncing the checked attribute, the attribute is directly // controllable from the defaultValue React property. It needs to be // updated as new props come in. if (props.defaultChecked == null) { node.removeAttribute('checked'); } else { node.defaultChecked = !!props.defaultChecked; } } else { // When syncing the checked attribute, it only changes when it needs // to be removed, such as transitioning from a checkbox into a text input if (props.checked == null && props.defaultChecked != null) { node.defaultChecked = !!props.defaultChecked; } } } function postMountWrapper(element, props, isHydrating) { var node = element; // Do not assign value if it is already set. This prevents user text input // from being lost during SSR hydration. if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) { var type = props.type; var isButton = type === 'submit' || type === 'reset'; // Avoid setting value attribute on submit/reset inputs as it overrides the // default value provided by the browser. See: #12872 if (isButton && (props.value === undefined || props.value === null)) { return; } var _initialValue = toString(node._wrapperState.initialValue); // Do not assign value if it is already set. This prevents user text input // from being lost during SSR hydration. if (!isHydrating) { if (disableInputAttributeSyncing) { var value = getToStringValue(props.value); // When not syncing the value attribute, the value property points // directly to the React prop. Only assign it if it exists. if (value != null) { // Always assign on buttons so that it is possible to assign an // empty string to clear button text. // // Otherwise, do not re-assign the value property if is empty. This // potentially avoids a DOM write and prevents Firefox (~60.0.1) from // prematurely marking required inputs as invalid. Equality is compared // to the current value in case the browser provided value is not an // empty string. if (isButton || value !== node.value) { node.value = toString(value); } } } else { // When syncing the value attribute, the value property should use // the wrapperState._initialValue property. This uses: // // 1. The value React property when present // 2. The defaultValue React property when present // 3. An empty string if (_initialValue !== node.value) { node.value = _initialValue; } } } if (disableInputAttributeSyncing) { // When not syncing the value attribute, assign the value attribute // directly from the defaultValue React property (when present) var defaultValue = getToStringValue(props.defaultValue); if (defaultValue != null) { node.defaultValue = toString(defaultValue); } } else { // Otherwise, the value attribute is synchronized to the property, // so we assign defaultValue to the same thing as the value property // assignment step above. node.defaultValue = _initialValue; } } // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug // this is needed to work around a chrome bug where setting defaultChecked // will sometimes influence the value of checked (even after detachment). // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416 // We need to temporarily unset name to avoid disrupting radio button groups. var name = node.name; if (name !== '') { node.name = ''; } if (disableInputAttributeSyncing) { // When not syncing the checked attribute, the checked property // never gets assigned. It must be manually set. We don't want // to do this when hydrating so that existing user input isn't // modified if (!isHydrating) { updateChecked(element, props); } // Only assign the checked attribute if it is defined. This saves // a DOM write when controlling the checked attribute isn't needed // (text inputs, submit/reset) if (props.hasOwnProperty('defaultChecked')) { node.defaultChecked = !node.defaultChecked; node.defaultChecked = !!props.defaultChecked; } } else { // When syncing the checked attribute, both the checked property and // attribute are assigned at the same time using defaultChecked. This uses: // // 1. The checked React property when present // 2. The defaultChecked React property when present // 3. Otherwise, false node.defaultChecked = !node.defaultChecked; node.defaultChecked = !!node._wrapperState.initialChecked; } if (name !== '') { node.name = name; } } function restoreControlledState(element, props) { var node = element; updateWrapper(node, props); updateNamedCousins(node, props); } function updateNamedCousins(rootNode, props) { var name = props.name; if (props.type === 'radio' && name != null) { var queryRoot = rootNode; while (queryRoot.parentNode) { queryRoot = queryRoot.parentNode; } // If `rootNode.form` was non-null, then we could try `form.elements`, // but that sometimes behaves strangely in IE8. We could also try using // `form.getElementsByName`, but that will only return direct children // and won't include inputs that use the HTML5 `form=` attribute. Since // the input might not even be in a form. It might not even be in the // document. Let's just use the local `querySelectorAll` to ensure we don't // miss anything. var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]'); for (var i = 0; i < group.length; i++) { var otherNode = group[i]; if (otherNode === rootNode || otherNode.form !== rootNode.form) { continue; } // This will throw if radio buttons rendered by different copies of React // and the same name are rendered into the same form (same as #1939). // That's probably okay; we don't support it just as we don't support // mixing React radio buttons with non-React ones. var otherProps = getFiberCurrentPropsFromNode$1(otherNode); !otherProps ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : void 0; // We need update the tracked value on the named cousin since the value // was changed but the input saw no event or value set updateValueIfChanged(otherNode); // If this is a controlled radio button group, forcing the input that // was previously checked to update will cause it to be come re-checked // as appropriate. updateWrapper(otherNode, otherProps); } } } // In Chrome, assigning defaultValue to certain input types triggers input validation. // For number inputs, the display value loses trailing decimal points. For email inputs, // Chrome raises "The specified value is not a valid email address". // // Here we check to see if the defaultValue has actually changed, avoiding these problems // when the user is inputting text // // https://github.com/facebook/react/issues/7253 function setDefaultValue(node, type, value) { if ( // Focused number inputs synchronize on blur. See ChangeEventPlugin.js type !== 'number' || node.ownerDocument.activeElement !== node) { if (value == null) { node.defaultValue = toString(node._wrapperState.initialValue); } else if (node.defaultValue !== toString(value)) { node.defaultValue = toString(value); } } } var eventTypes$1 = { change: { phasedRegistrationNames: { bubbled: 'onChange', captured: 'onChangeCapture' }, dependencies: [TOP_BLUR, TOP_CHANGE, TOP_CLICK, TOP_FOCUS, TOP_INPUT, TOP_KEY_DOWN, TOP_KEY_UP, TOP_SELECTION_CHANGE] } }; function createAndAccumulateChangeEvent(inst, nativeEvent, target) { var event = SyntheticEvent.getPooled(eventTypes$1.change, inst, nativeEvent, target); event.type = 'change'; // Flag this event loop as needing state restore. enqueueStateRestore(target); accumulateTwoPhaseDispatches(event); return event; } /** * For IE shims */ var activeElement = null; var activeElementInst = null; /** * SECTION: handle `change` event */ function shouldUseChangeEvent(elem) { var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; } function manualDispatchChangeEvent(nativeEvent) { var event = createAndAccumulateChangeEvent(activeElementInst, nativeEvent, getEventTarget(nativeEvent)); // If change and propertychange bubbled, we'd just bind to it like all the // other events and have it go through ReactBrowserEventEmitter. Since it // doesn't, we manually listen for the events and so we have to enqueue and // process the abstract event manually. // // Batching is necessary here in order to ensure that all event handlers run // before the next rerender (including event handlers attached to ancestor // elements instead of directly on the input). Without this, controlled // components don't work properly in conjunction with event bubbling because // the component is rerendered and the value reverted before all the event // handlers can run. See https://github.com/facebook/react/issues/708. batchedUpdates(runEventInBatch, event); } function runEventInBatch(event) { runEventsInBatch(event); } function getInstIfValueChanged(targetInst) { var targetNode = getNodeFromInstance$1(targetInst); if (updateValueIfChanged(targetNode)) { return targetInst; } } function getTargetInstForChangeEvent(topLevelType, targetInst) { if (topLevelType === TOP_CHANGE) { return targetInst; } } /** * SECTION: handle `input` event */ var isInputEventSupported = false; if (canUseDOM) { // IE9 claims to support the input event but fails to trigger it when // deleting text, so we ignore its input events. isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9); } /** * (For IE <=9) Starts tracking propertychange events on the passed-in element * and override the value property so that we can distinguish user events from * value changes in JS. */ function startWatchingForValueChange(target, targetInst) { activeElement = target; activeElementInst = targetInst; activeElement.attachEvent('onpropertychange', handlePropertyChange); } /** * (For IE <=9) Removes the event listeners from the currently-tracked element, * if any exists. */ function stopWatchingForValueChange() { if (!activeElement) { return; } activeElement.detachEvent('onpropertychange', handlePropertyChange); activeElement = null; activeElementInst = null; } /** * (For IE <=9) Handles a propertychange event, sending a `change` event if * the value of the active element has changed. */ function handlePropertyChange(nativeEvent) { if (nativeEvent.propertyName !== 'value') { return; } if (getInstIfValueChanged(activeElementInst)) { manualDispatchChangeEvent(nativeEvent); } } function handleEventsForInputEventPolyfill(topLevelType, target, targetInst) { if (topLevelType === TOP_FOCUS) { // In IE9, propertychange fires for most input events but is buggy and // doesn't fire when text is deleted, but conveniently, selectionchange // appears to fire in all of the remaining cases so we catch those and // forward the event if the value has changed // In either case, we don't want to call the event handler if the value // is changed from JS so we redefine a setter for `.value` that updates // our activeElementValue variable, allowing us to ignore those changes // // stopWatching() should be a noop here but we call it just in case we // missed a blur event somehow. stopWatchingForValueChange(); startWatchingForValueChange(target, targetInst); } else if (topLevelType === TOP_BLUR) { stopWatchingForValueChange(); } } // For IE8 and IE9. function getTargetInstForInputEventPolyfill(topLevelType, targetInst) { if (topLevelType === TOP_SELECTION_CHANGE || topLevelType === TOP_KEY_UP || topLevelType === TOP_KEY_DOWN) { // On the selectionchange event, the target is just document which isn't // helpful for us so just check activeElement instead. // // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire // propertychange on the first input event after setting `value` from a // script and fires only keydown, keypress, keyup. Catching keyup usually // gets it and catching keydown lets us fire an event for the first // keystroke if user does a key repeat (it'll be a little delayed: right // before the second keystroke). Other input methods (e.g., paste) seem to // fire selectionchange normally. return getInstIfValueChanged(activeElementInst); } } /** * SECTION: handle `click` event */ function shouldUseClickEvent(elem) { // Use the `click` event to detect changes to checkbox and radio inputs. // This approach works across all browsers, whereas `change` does not fire // until `blur` in IE8. var nodeName = elem.nodeName; return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio'); } function getTargetInstForClickEvent(topLevelType, targetInst) { if (topLevelType === TOP_CLICK) { return getInstIfValueChanged(targetInst); } } function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) { if (topLevelType === TOP_INPUT || topLevelType === TOP_CHANGE) { return getInstIfValueChanged(targetInst); } } function handleControlledInputBlur(node) { var state = node._wrapperState; if (!state || !state.controlled || node.type !== 'number') { return; } if (!disableInputAttributeSyncing) { // If controlled, assign the value attribute to the current value on blur setDefaultValue(node, 'number', node.value); } } /** * This plugin creates an `onChange` event that normalizes change events * across form elements. This event fires at a time when it's possible to * change the element's value without seeing a flicker. * * Supported elements are: * - input (see `isTextInputElement`) * - textarea * - select */ var ChangeEventPlugin = { eventTypes: eventTypes$1, _isInputEventSupported: isInputEventSupported, extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window; var getTargetInstFunc = void 0, handleEventFunc = void 0; if (shouldUseChangeEvent(targetNode)) { getTargetInstFunc = getTargetInstForChangeEvent; } else if (isTextInputElement(targetNode)) { if (isInputEventSupported) { getTargetInstFunc = getTargetInstForInputOrChangeEvent; } else { getTargetInstFunc = getTargetInstForInputEventPolyfill; handleEventFunc = handleEventsForInputEventPolyfill; } } else if (shouldUseClickEvent(targetNode)) { getTargetInstFunc = getTargetInstForClickEvent; } if (getTargetInstFunc) { var inst = getTargetInstFunc(topLevelType, targetInst); if (inst) { var event = createAndAccumulateChangeEvent(inst, nativeEvent, nativeEventTarget); return event; } } if (handleEventFunc) { handleEventFunc(topLevelType, targetNode, targetInst); } // When blurring, set the value attribute for number inputs if (topLevelType === TOP_BLUR) { handleControlledInputBlur(targetNode); } } }; /** * Module that is injectable into `EventPluginHub`, that specifies a * deterministic ordering of `EventPlugin`s. A convenient way to reason about * plugins, without having to package every one of them. This is better than * having plugins be ordered in the same order that they are injected because * that ordering would be influenced by the packaging order. * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that * preventing default on events is convenient in `SimpleEventPlugin` handlers. */ var DOMEventPluginOrder = ['ResponderEventPlugin', 'SimpleEventPlugin', 'EnterLeaveEventPlugin', 'ChangeEventPlugin', 'SelectEventPlugin', 'BeforeInputEventPlugin']; var SyntheticUIEvent = SyntheticEvent.extend({ view: null, detail: null }); var modifierKeyToProp = { Alt: 'altKey', Control: 'ctrlKey', Meta: 'metaKey', Shift: 'shiftKey' }; // Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support // getModifierState. If getModifierState is not supported, we map it to a set of // modifier keys exposed by the event. In this case, Lock-keys are not supported. /** * Translation from modifier key to the associated property in the event. * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers */ function modifierStateGetter(keyArg) { var syntheticEvent = this; var nativeEvent = syntheticEvent.nativeEvent; if (nativeEvent.getModifierState) { return nativeEvent.getModifierState(keyArg); } var keyProp = modifierKeyToProp[keyArg]; return keyProp ? !!nativeEvent[keyProp] : false; } function getEventModifierState(nativeEvent) { return modifierStateGetter; } var previousScreenX = 0; var previousScreenY = 0; // Use flags to signal movementX/Y has already been set var isMovementXSet = false; var isMovementYSet = false; /** * @interface MouseEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var SyntheticMouseEvent = SyntheticUIEvent.extend({ screenX: null, screenY: null, clientX: null, clientY: null, pageX: null, pageY: null, ctrlKey: null, shiftKey: null, altKey: null, metaKey: null, getModifierState: getEventModifierState, button: null, buttons: null, relatedTarget: function (event) { return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement); }, movementX: function (event) { if ('movementX' in event) { return event.movementX; } var screenX = previousScreenX; previousScreenX = event.screenX; if (!isMovementXSet) { isMovementXSet = true; return 0; } return event.type === 'mousemove' ? event.screenX - screenX : 0; }, movementY: function (event) { if ('movementY' in event) { return event.movementY; } var screenY = previousScreenY; previousScreenY = event.screenY; if (!isMovementYSet) { isMovementYSet = true; return 0; } return event.type === 'mousemove' ? event.screenY - screenY : 0; } }); /** * @interface PointerEvent * @see http://www.w3.org/TR/pointerevents/ */ var SyntheticPointerEvent = SyntheticMouseEvent.extend({ pointerId: null, width: null, height: null, pressure: null, tangentialPressure: null, tiltX: null, tiltY: null, twist: null, pointerType: null, isPrimary: null }); var eventTypes$2 = { mouseEnter: { registrationName: 'onMouseEnter', dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER] }, mouseLeave: { registrationName: 'onMouseLeave', dependencies: [TOP_MOUSE_OUT, TOP_MOUSE_OVER] }, pointerEnter: { registrationName: 'onPointerEnter', dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER] }, pointerLeave: { registrationName: 'onPointerLeave', dependencies: [TOP_POINTER_OUT, TOP_POINTER_OVER] } }; var EnterLeaveEventPlugin = { eventTypes: eventTypes$2, /** * For almost every interaction we care about, there will be both a top-level * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that * we do not extract duplicate events. However, moving the mouse into the * browser from outside will not fire a `mouseout` event. In this case, we use * the `mouseover` top-level event. */ extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { var isOverEvent = topLevelType === TOP_MOUSE_OVER || topLevelType === TOP_POINTER_OVER; var isOutEvent = topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_POINTER_OUT; if (isOverEvent && (nativeEvent.relatedTarget || nativeEvent.fromElement)) { return null; } if (!isOutEvent && !isOverEvent) { // Must not be a mouse or pointer in or out - ignoring. return null; } var win = void 0; if (nativeEventTarget.window === nativeEventTarget) { // `nativeEventTarget` is probably a window object. win = nativeEventTarget; } else { // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. var doc = nativeEventTarget.ownerDocument; if (doc) { win = doc.defaultView || doc.parentWindow; } else { win = window; } } var from = void 0; var to = void 0; if (isOutEvent) { from = targetInst; var related = nativeEvent.relatedTarget || nativeEvent.toElement; to = related ? getClosestInstanceFromNode(related) : null; } else { // Moving to a node from outside the window. from = null; to = targetInst; } if (from === to) { // Nothing pertains to our managed components. return null; } var eventInterface = void 0, leaveEventType = void 0, enterEventType = void 0, eventTypePrefix = void 0; if (topLevelType === TOP_MOUSE_OUT || topLevelType === TOP_MOUSE_OVER) { eventInterface = SyntheticMouseEvent; leaveEventType = eventTypes$2.mouseLeave; enterEventType = eventTypes$2.mouseEnter; eventTypePrefix = 'mouse'; } else if (topLevelType === TOP_POINTER_OUT || topLevelType === TOP_POINTER_OVER) { eventInterface = SyntheticPointerEvent; leaveEventType = eventTypes$2.pointerLeave; enterEventType = eventTypes$2.pointerEnter; eventTypePrefix = 'pointer'; } var fromNode = from == null ? win : getNodeFromInstance$1(from); var toNode = to == null ? win : getNodeFromInstance$1(to); var leave = eventInterface.getPooled(leaveEventType, from, nativeEvent, nativeEventTarget); leave.type = eventTypePrefix + 'leave'; leave.target = fromNode; leave.relatedTarget = toNode; var enter = eventInterface.getPooled(enterEventType, to, nativeEvent, nativeEventTarget); enter.type = eventTypePrefix + 'enter'; enter.target = toNode; enter.relatedTarget = fromNode; accumulateEnterLeaveDispatches(leave, enter, from, to); return [leave, enter]; } }; /** * inlined Object.is polyfill to avoid requiring consumers ship their own * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is */ function is(x, y) { return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare ; } var hasOwnProperty$1 = Object.prototype.hasOwnProperty; /** * Performs equality by iterating through keys on an object and returning false * when any key has values which are not strictly equal between the arguments. * Returns true when the values of all keys are strictly equal. */ function shallowEqual(objA, objB) { if (is(objA, objB)) { return true; } if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { return false; } var keysA = Object.keys(objA); var keysB = Object.keys(objB); if (keysA.length !== keysB.length) { return false; } // Test for A's keys different from B. for (var i = 0; i < keysA.length; i++) { if (!hasOwnProperty$1.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { return false; } } return true; } /** * `ReactInstanceMap` maintains a mapping from a public facing stateful * instance (key) and the internal representation (value). This allows public * methods to accept the user facing instance as an argument and map them back * to internal methods. * * Note that this module is currently shared and assumed to be stateless. * If this becomes an actual Map, that will break. */ /** * This API should be called `delete` but we'd have to make sure to always * transform these to strings for IE support. When this transform is fully * supported we can rename it. */ function get(key) { return key._reactInternalFiber; } function has(key) { return key._reactInternalFiber !== undefined; } function set(key, value) { key._reactInternalFiber = value; } // Don't change these two values. They're used by React Dev Tools. var NoEffect = /* */0; var PerformedWork = /* */1; // You can change the rest (and add more). var Placement = /* */2; var Update = /* */4; var PlacementAndUpdate = /* */6; var Deletion = /* */8; var ContentReset = /* */16; var Callback = /* */32; var DidCapture = /* */64; var Ref = /* */128; var Snapshot = /* */256; var Passive = /* */512; // Passive & Update & Callback & Ref & Snapshot var LifecycleEffectMask = /* */932; // Union of all host effects var HostEffectMask = /* */1023; var Incomplete = /* */1024; var ShouldCapture = /* */2048; var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; var MOUNTING = 1; var MOUNTED = 2; var UNMOUNTED = 3; function isFiberMountedImpl(fiber) { var node = fiber; if (!fiber.alternate) { // If there is no alternate, this might be a new tree that isn't inserted // yet. If it is, then it will have a pending insertion effect on it. if ((node.effectTag & Placement) !== NoEffect) { return MOUNTING; } while (node.return) { node = node.return; if ((node.effectTag & Placement) !== NoEffect) { return MOUNTING; } } } else { while (node.return) { node = node.return; } } if (node.tag === HostRoot) { // TODO: Check if this was a nested HostRoot when used with // renderContainerIntoSubtree. return MOUNTED; } // If we didn't hit the root, that means that we're in an disconnected tree // that has been unmounted. return UNMOUNTED; } function isFiberMounted(fiber) { return isFiberMountedImpl(fiber) === MOUNTED; } function isMounted(component) { { var owner = ReactCurrentOwner$1.current; if (owner !== null && owner.tag === ClassComponent) { var ownerFiber = owner; var instance = ownerFiber.stateNode; !instance._warnedAboutRefsInRender ? warningWithoutStack$1(false, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentName(ownerFiber.type) || 'A component') : void 0; instance._warnedAboutRefsInRender = true; } } var fiber = get(component); if (!fiber) { return false; } return isFiberMountedImpl(fiber) === MOUNTED; } function assertIsMounted(fiber) { !(isFiberMountedImpl(fiber) === MOUNTED) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0; } function findCurrentFiberUsingSlowPath(fiber) { var alternate = fiber.alternate; if (!alternate) { // If there is no alternate, then we only need to check if it is mounted. var state = isFiberMountedImpl(fiber); !(state !== UNMOUNTED) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0; if (state === MOUNTING) { return null; } return fiber; } // If we have two possible branches, we'll walk backwards up to the root // to see what path the root points to. On the way we may hit one of the // special cases and we'll deal with them. var a = fiber; var b = alternate; while (true) { var parentA = a.return; var parentB = parentA ? parentA.alternate : null; if (!parentA || !parentB) { // We're at the root. break; } // If both copies of the parent fiber point to the same child, we can // assume that the child is current. This happens when we bailout on low // priority: the bailed out fiber's child reuses the current child. if (parentA.child === parentB.child) { var child = parentA.child; while (child) { if (child === a) { // We've determined that A is the current branch. assertIsMounted(parentA); return fiber; } if (child === b) { // We've determined that B is the current branch. assertIsMounted(parentA); return alternate; } child = child.sibling; } // We should never have an alternate for any mounting node. So the only // way this could possibly happen is if this was unmounted, if at all. invariant(false, 'Unable to find node on an unmounted component.'); } if (a.return !== b.return) { // The return pointer of A and the return pointer of B point to different // fibers. We assume that return pointers never criss-cross, so A must // belong to the child set of A.return, and B must belong to the child // set of B.return. a = parentA; b = parentB; } else { // The return pointers point to the same fiber. We'll have to use the // default, slow path: scan the child sets of each parent alternate to see // which child belongs to which set. // // Search parent A's child set var didFindChild = false; var _child = parentA.child; while (_child) { if (_child === a) { didFindChild = true; a = parentA; b = parentB; break; } if (_child === b) { didFindChild = true; b = parentA; a = parentB; break; } _child = _child.sibling; } if (!didFindChild) { // Search parent B's child set _child = parentB.child; while (_child) { if (_child === a) { didFindChild = true; a = parentB; b = parentA; break; } if (_child === b) { didFindChild = true; b = parentB; a = parentA; break; } _child = _child.sibling; } !didFindChild ? invariant(false, 'Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.') : void 0; } } !(a.alternate === b) ? invariant(false, 'Return fibers should always be each others\' alternates. This error is likely caused by a bug in React. Please file an issue.') : void 0; } // If the root is not a host container, we're in a disconnected tree. I.e. // unmounted. !(a.tag === HostRoot) ? invariant(false, 'Unable to find node on an unmounted component.') : void 0; if (a.stateNode.current === a) { // We've determined that A is the current branch. return fiber; } // Otherwise B has to be current branch. return alternate; } function findCurrentHostFiber(parent) { var currentParent = findCurrentFiberUsingSlowPath(parent); if (!currentParent) { return null; } // Next we'll drill down this component to find the first HostComponent/Text. var node = currentParent; while (true) { if (node.tag === HostComponent || node.tag === HostText) { return node; } else if (node.child) { node.child.return = node; node = node.child; continue; } if (node === currentParent) { return null; } while (!node.sibling) { if (!node.return || node.return === currentParent) { return null; } node = node.return; } node.sibling.return = node.return; node = node.sibling; } // Flow needs the return null here, but ESLint complains about it. // eslint-disable-next-line no-unreachable return null; } function findCurrentHostFiberWithNoPortals(parent) { var currentParent = findCurrentFiberUsingSlowPath(parent); if (!currentParent) { return null; } // Next we'll drill down this component to find the first HostComponent/Text. var node = currentParent; while (true) { if (node.tag === HostComponent || node.tag === HostText) { return node; } else if (node.child && node.tag !== HostPortal) { node.child.return = node; node = node.child; continue; } if (node === currentParent) { return null; } while (!node.sibling) { if (!node.return || node.return === currentParent) { return null; } node = node.return; } node.sibling.return = node.return; node = node.sibling; } // Flow needs the return null here, but ESLint complains about it. // eslint-disable-next-line no-unreachable return null; } function addEventBubbleListener(element, eventType, listener) { element.addEventListener(eventType, listener, false); } function addEventCaptureListener(element, eventType, listener) { element.addEventListener(eventType, listener, true); } /** * @interface Event * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent */ var SyntheticAnimationEvent = SyntheticEvent.extend({ animationName: null, elapsedTime: null, pseudoElement: null }); /** * @interface Event * @see http://www.w3.org/TR/clipboard-apis/ */ var SyntheticClipboardEvent = SyntheticEvent.extend({ clipboardData: function (event) { return 'clipboardData' in event ? event.clipboardData : window.clipboardData; } }); /** * @interface FocusEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var SyntheticFocusEvent = SyntheticUIEvent.extend({ relatedTarget: null }); /** * `charCode` represents the actual "character code" and is safe to use with * `String.fromCharCode`. As such, only keys that correspond to printable * characters produce a valid `charCode`, the only exception to this is Enter. * The Tab-key is considered non-printable and does not have a `charCode`, * presumably because it does not produce a tab-character in browsers. * * @param {object} nativeEvent Native browser event. * @return {number} Normalized `charCode` property. */ function getEventCharCode(nativeEvent) { var charCode = void 0; var keyCode = nativeEvent.keyCode; if ('charCode' in nativeEvent) { charCode = nativeEvent.charCode; // FF does not set `charCode` for the Enter-key, check against `keyCode`. if (charCode === 0 && keyCode === 13) { charCode = 13; } } else { // IE8 does not implement `charCode`, but `keyCode` has the correct value. charCode = keyCode; } // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux) // report Enter as charCode 10 when ctrl is pressed. if (charCode === 10) { charCode = 13; } // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. // Must not discard the (non-)printable Enter-key. if (charCode >= 32 || charCode === 13) { return charCode; } return 0; } /** * Normalization of deprecated HTML5 `key` values * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names */ var normalizeKey = { Esc: 'Escape', Spacebar: ' ', Left: 'ArrowLeft', Up: 'ArrowUp', Right: 'ArrowRight', Down: 'ArrowDown', Del: 'Delete', Win: 'OS', Menu: 'ContextMenu', Apps: 'ContextMenu', Scroll: 'ScrollLock', MozPrintableKey: 'Unidentified' }; /** * Translation from legacy `keyCode` to HTML5 `key` * Only special keys supported, all others depend on keyboard layout or browser * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names */ var translateToKey = { '8': 'Backspace', '9': 'Tab', '12': 'Clear', '13': 'Enter', '16': 'Shift', '17': 'Control', '18': 'Alt', '19': 'Pause', '20': 'CapsLock', '27': 'Escape', '32': ' ', '33': 'PageUp', '34': 'PageDown', '35': 'End', '36': 'Home', '37': 'ArrowLeft', '38': 'ArrowUp', '39': 'ArrowRight', '40': 'ArrowDown', '45': 'Insert', '46': 'Delete', '112': 'F1', '113': 'F2', '114': 'F3', '115': 'F4', '116': 'F5', '117': 'F6', '118': 'F7', '119': 'F8', '120': 'F9', '121': 'F10', '122': 'F11', '123': 'F12', '144': 'NumLock', '145': 'ScrollLock', '224': 'Meta' }; /** * @param {object} nativeEvent Native browser event. * @return {string} Normalized `key` property. */ function getEventKey(nativeEvent) { if (nativeEvent.key) { // Normalize inconsistent values reported by browsers due to // implementations of a working draft specification. // FireFox implements `key` but returns `MozPrintableKey` for all // printable characters (normalized to `Unidentified`), ignore it. var key = normalizeKey[nativeEvent.key] || nativeEvent.key; if (key !== 'Unidentified') { return key; } } // Browser does not implement `key`, polyfill as much of it as we can. if (nativeEvent.type === 'keypress') { var charCode = getEventCharCode(nativeEvent); // The enter-key is technically both printable and non-printable and can // thus be captured by `keypress`, no other non-printable key should. return charCode === 13 ? 'Enter' : String.fromCharCode(charCode); } if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') { // While user keyboard layout determines the actual meaning of each // `keyCode` value, almost all function keys have a universal value. return translateToKey[nativeEvent.keyCode] || 'Unidentified'; } return ''; } /** * @interface KeyboardEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var SyntheticKeyboardEvent = SyntheticUIEvent.extend({ key: getEventKey, location: null, ctrlKey: null, shiftKey: null, altKey: null, metaKey: null, repeat: null, locale: null, getModifierState: getEventModifierState, // Legacy Interface charCode: function (event) { // `charCode` is the result of a KeyPress event and represents the value of // the actual printable character. // KeyPress is deprecated, but its replacement is not yet final and not // implemented in any major browser. Only KeyPress has charCode. if (event.type === 'keypress') { return getEventCharCode(event); } return 0; }, keyCode: function (event) { // `keyCode` is the result of a KeyDown/Up event and represents the value of // physical keyboard key. // The actual meaning of the value depends on the users' keyboard layout // which cannot be detected. Assuming that it is a US keyboard layout // provides a surprisingly accurate mapping for US and European users. // Due to this, it is left to the user to implement at this time. if (event.type === 'keydown' || event.type === 'keyup') { return event.keyCode; } return 0; }, which: function (event) { // `which` is an alias for either `keyCode` or `charCode` depending on the // type of the event. if (event.type === 'keypress') { return getEventCharCode(event); } if (event.type === 'keydown' || event.type === 'keyup') { return event.keyCode; } return 0; } }); /** * @interface DragEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var SyntheticDragEvent = SyntheticMouseEvent.extend({ dataTransfer: null }); /** * @interface TouchEvent * @see http://www.w3.org/TR/touch-events/ */ var SyntheticTouchEvent = SyntheticUIEvent.extend({ touches: null, targetTouches: null, changedTouches: null, altKey: null, metaKey: null, ctrlKey: null, shiftKey: null, getModifierState: getEventModifierState }); /** * @interface Event * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events- * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent */ var SyntheticTransitionEvent = SyntheticEvent.extend({ propertyName: null, elapsedTime: null, pseudoElement: null }); /** * @interface WheelEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ */ var SyntheticWheelEvent = SyntheticMouseEvent.extend({ deltaX: function (event) { return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive). 'wheelDeltaX' in event ? -event.wheelDeltaX : 0; }, deltaY: function (event) { return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive). 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive). 'wheelDelta' in event ? -event.wheelDelta : 0; }, deltaZ: null, // Browsers without "deltaMode" is reporting in raw wheel delta where one // notch on the scroll is always +/- 120, roughly equivalent to pixels. // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size. deltaMode: null }); /** * Turns * ['abort', ...] * into * eventTypes = { * 'abort': { * phasedRegistrationNames: { * bubbled: 'onAbort', * captured: 'onAbortCapture', * }, * dependencies: [TOP_ABORT], * }, * ... * }; * topLevelEventsToDispatchConfig = new Map([ * [TOP_ABORT, { sameConfig }], * ]); */ var interactiveEventTypeNames = [[TOP_BLUR, 'blur'], [TOP_CANCEL, 'cancel'], [TOP_CLICK, 'click'], [TOP_CLOSE, 'close'], [TOP_CONTEXT_MENU, 'contextMenu'], [TOP_COPY, 'copy'], [TOP_CUT, 'cut'], [TOP_AUX_CLICK, 'auxClick'], [TOP_DOUBLE_CLICK, 'doubleClick'], [TOP_DRAG_END, 'dragEnd'], [TOP_DRAG_START, 'dragStart'], [TOP_DROP, 'drop'], [TOP_FOCUS, 'focus'], [TOP_INPUT, 'input'], [TOP_INVALID, 'invalid'], [TOP_KEY_DOWN, 'keyDown'], [TOP_KEY_PRESS, 'keyPress'], [TOP_KEY_UP, 'keyUp'], [TOP_MOUSE_DOWN, 'mouseDown'], [TOP_MOUSE_UP, 'mouseUp'], [TOP_PASTE, 'paste'], [TOP_PAUSE, 'pause'], [TOP_PLAY, 'play'], [TOP_POINTER_CANCEL, 'pointerCancel'], [TOP_POINTER_DOWN, 'pointerDown'], [TOP_POINTER_UP, 'pointerUp'], [TOP_RATE_CHANGE, 'rateChange'], [TOP_RESET, 'reset'], [TOP_SEEKED, 'seeked'], [TOP_SUBMIT, 'submit'], [TOP_TOUCH_CANCEL, 'touchCancel'], [TOP_TOUCH_END, 'touchEnd'], [TOP_TOUCH_START, 'touchStart'], [TOP_VOLUME_CHANGE, 'volumeChange']]; var nonInteractiveEventTypeNames = [[TOP_ABORT, 'abort'], [TOP_ANIMATION_END, 'animationEnd'], [TOP_ANIMATION_ITERATION, 'animationIteration'], [TOP_ANIMATION_START, 'animationStart'], [TOP_CAN_PLAY, 'canPlay'], [TOP_CAN_PLAY_THROUGH, 'canPlayThrough'], [TOP_DRAG, 'drag'], [TOP_DRAG_ENTER, 'dragEnter'], [TOP_DRAG_EXIT, 'dragExit'], [TOP_DRAG_LEAVE, 'dragLeave'], [TOP_DRAG_OVER, 'dragOver'], [TOP_DURATION_CHANGE, 'durationChange'], [TOP_EMPTIED, 'emptied'], [TOP_ENCRYPTED, 'encrypted'], [TOP_ENDED, 'ended'], [TOP_ERROR, 'error'], [TOP_GOT_POINTER_CAPTURE, 'gotPointerCapture'], [TOP_LOAD, 'load'], [TOP_LOADED_DATA, 'loadedData'], [TOP_LOADED_METADATA, 'loadedMetadata'], [TOP_LOAD_START, 'loadStart'], [TOP_LOST_POINTER_CAPTURE, 'lostPointerCapture'], [TOP_MOUSE_MOVE, 'mouseMove'], [TOP_MOUSE_OUT, 'mouseOut'], [TOP_MOUSE_OVER, 'mouseOver'], [TOP_PLAYING, 'playing'], [TOP_POINTER_MOVE, 'pointerMove'], [TOP_POINTER_OUT, 'pointerOut'], [TOP_POINTER_OVER, 'pointerOver'], [TOP_PROGRESS, 'progress'], [TOP_SCROLL, 'scroll'], [TOP_SEEKING, 'seeking'], [TOP_STALLED, 'stalled'], [TOP_SUSPEND, 'suspend'], [TOP_TIME_UPDATE, 'timeUpdate'], [TOP_TOGGLE, 'toggle'], [TOP_TOUCH_MOVE, 'touchMove'], [TOP_TRANSITION_END, 'transitionEnd'], [TOP_WAITING, 'waiting'], [TOP_WHEEL, 'wheel']]; var eventTypes$4 = {}; var topLevelEventsToDispatchConfig = {}; function addEventTypeNameToConfig(_ref, isInteractive) { var topEvent = _ref[0], event = _ref[1]; var capitalizedEvent = event[0].toUpperCase() + event.slice(1); var onEvent = 'on' + capitalizedEvent; var type = { phasedRegistrationNames: { bubbled: onEvent, captured: onEvent + 'Capture' }, dependencies: [topEvent], isInteractive: isInteractive }; eventTypes$4[event] = type; topLevelEventsToDispatchConfig[topEvent] = type; } interactiveEventTypeNames.forEach(function (eventTuple) { addEventTypeNameToConfig(eventTuple, true); }); nonInteractiveEventTypeNames.forEach(function (eventTuple) { addEventTypeNameToConfig(eventTuple, false); }); // Only used in DEV for exhaustiveness validation. var knownHTMLTopLevelTypes = [TOP_ABORT, TOP_CANCEL, TOP_CAN_PLAY, TOP_CAN_PLAY_THROUGH, TOP_CLOSE, TOP_DURATION_CHANGE, TOP_EMPTIED, TOP_ENCRYPTED, TOP_ENDED, TOP_ERROR, TOP_INPUT, TOP_INVALID, TOP_LOAD, TOP_LOADED_DATA, TOP_LOADED_METADATA, TOP_LOAD_START, TOP_PAUSE, TOP_PLAY, TOP_PLAYING, TOP_PROGRESS, TOP_RATE_CHANGE, TOP_RESET, TOP_SEEKED, TOP_SEEKING, TOP_STALLED, TOP_SUBMIT, TOP_SUSPEND, TOP_TIME_UPDATE, TOP_TOGGLE, TOP_VOLUME_CHANGE, TOP_WAITING]; var SimpleEventPlugin = { eventTypes: eventTypes$4, isInteractiveTopLevelEventType: function (topLevelType) { var config = topLevelEventsToDispatchConfig[topLevelType]; return config !== undefined && config.isInteractive === true; }, extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType]; if (!dispatchConfig) { return null; } var EventConstructor = void 0; switch (topLevelType) { case TOP_KEY_PRESS: // Firefox creates a keypress event for function keys too. This removes // the unwanted keypress events. Enter is however both printable and // non-printable. One would expect Tab to be as well (but it isn't). if (getEventCharCode(nativeEvent) === 0) { return null; } /* falls through */ case TOP_KEY_DOWN: case TOP_KEY_UP: EventConstructor = SyntheticKeyboardEvent; break; case TOP_BLUR: case TOP_FOCUS: EventConstructor = SyntheticFocusEvent; break; case TOP_CLICK: // Firefox creates a click event on right mouse clicks. This removes the // unwanted click events. if (nativeEvent.button === 2) { return null; } /* falls through */ case TOP_AUX_CLICK: case TOP_DOUBLE_CLICK: case TOP_MOUSE_DOWN: case TOP_MOUSE_MOVE: case TOP_MOUSE_UP: // TODO: Disabled elements should not respond to mouse events /* falls through */ case TOP_MOUSE_OUT: case TOP_MOUSE_OVER: case TOP_CONTEXT_MENU: EventConstructor = SyntheticMouseEvent; break; case TOP_DRAG: case TOP_DRAG_END: case TOP_DRAG_ENTER: case TOP_DRAG_EXIT: case TOP_DRAG_LEAVE: case TOP_DRAG_OVER: case TOP_DRAG_START: case TOP_DROP: EventConstructor = SyntheticDragEvent; break; case TOP_TOUCH_CANCEL: case TOP_TOUCH_END: case TOP_TOUCH_MOVE: case TOP_TOUCH_START: EventConstructor = SyntheticTouchEvent; break; case TOP_ANIMATION_END: case TOP_ANIMATION_ITERATION: case TOP_ANIMATION_START: EventConstructor = SyntheticAnimationEvent; break; case TOP_TRANSITION_END: EventConstructor = SyntheticTransitionEvent; break; case TOP_SCROLL: EventConstructor = SyntheticUIEvent; break; case TOP_WHEEL: EventConstructor = SyntheticWheelEvent; break; case TOP_COPY: case TOP_CUT: case TOP_PASTE: EventConstructor = SyntheticClipboardEvent; break; case TOP_GOT_POINTER_CAPTURE: case TOP_LOST_POINTER_CAPTURE: case TOP_POINTER_CANCEL: case TOP_POINTER_DOWN: case TOP_POINTER_MOVE: case TOP_POINTER_OUT: case TOP_POINTER_OVER: case TOP_POINTER_UP: EventConstructor = SyntheticPointerEvent; break; default: { if (knownHTMLTopLevelTypes.indexOf(topLevelType) === -1) { warningWithoutStack$1(false, 'SimpleEventPlugin: Unhandled event type, `%s`. This warning ' + 'is likely caused by a bug in React. Please file an issue.', topLevelType); } } // HTML Events // @see http://www.w3.org/TR/html5/index.html#events-0 EventConstructor = SyntheticEvent; break; } var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget); accumulateTwoPhaseDispatches(event); return event; } }; var isInteractiveTopLevelEventType = SimpleEventPlugin.isInteractiveTopLevelEventType; var CALLBACK_BOOKKEEPING_POOL_SIZE = 10; var callbackBookkeepingPool = []; /** * Find the deepest React component completely containing the root of the * passed-in instance (for use when entire React trees are nested within each * other). If React trees are not nested, returns null. */ function findRootContainerNode(inst) { // TODO: It may be a good idea to cache this to prevent unnecessary DOM // traversal, but caching is difficult to do correctly without using a // mutation observer to listen for all DOM changes. while (inst.return) { inst = inst.return; } if (inst.tag !== HostRoot) { // This can happen if we're in a detached tree. return null; } return inst.stateNode.containerInfo; } // Used to store ancestor hierarchy in top level callback function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) { if (callbackBookkeepingPool.length) { var instance = callbackBookkeepingPool.pop(); instance.topLevelType = topLevelType; instance.nativeEvent = nativeEvent; instance.targetInst = targetInst; return instance; } return { topLevelType: topLevelType, nativeEvent: nativeEvent, targetInst: targetInst, ancestors: [] }; } function releaseTopLevelCallbackBookKeeping(instance) { instance.topLevelType = null; instance.nativeEvent = null; instance.targetInst = null; instance.ancestors.length = 0; if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) { callbackBookkeepingPool.push(instance); } } function handleTopLevel(bookKeeping) { var targetInst = bookKeeping.targetInst; // Loop through the hierarchy, in case there's any nested components. // It's important that we build the array of ancestors before calling any // event handlers, because event handlers can modify the DOM, leading to // inconsistencies with ReactMount's node cache. See #1105. var ancestor = targetInst; do { if (!ancestor) { bookKeeping.ancestors.push(ancestor); break; } var root = findRootContainerNode(ancestor); if (!root) { break; } bookKeeping.ancestors.push(ancestor); ancestor = getClosestInstanceFromNode(root); } while (ancestor); for (var i = 0; i < bookKeeping.ancestors.length; i++) { targetInst = bookKeeping.ancestors[i]; runExtractedEventsInBatch(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent)); } } // TODO: can we stop exporting these? var _enabled = true; function setEnabled(enabled) { _enabled = !!enabled; } function isEnabled() { return _enabled; } /** * Traps top-level events by using event bubbling. * * @param {number} topLevelType Number from `TopLevelEventTypes`. * @param {object} element Element on which to attach listener. * @return {?object} An object with a remove function which will forcefully * remove the listener. * @internal */ function trapBubbledEvent(topLevelType, element) { if (!element) { return null; } var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent; addEventBubbleListener(element, getRawEventName(topLevelType), // Check if interactive and wrap in interactiveUpdates dispatch.bind(null, topLevelType)); } /** * Traps a top-level event by using event capturing. * * @param {number} topLevelType Number from `TopLevelEventTypes`. * @param {object} element Element on which to attach listener. * @return {?object} An object with a remove function which will forcefully * remove the listener. * @internal */ function trapCapturedEvent(topLevelType, element) { if (!element) { return null; } var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent; addEventCaptureListener(element, getRawEventName(topLevelType), // Check if interactive and wrap in interactiveUpdates dispatch.bind(null, topLevelType)); } function dispatchInteractiveEvent(topLevelType, nativeEvent) { interactiveUpdates(dispatchEvent, topLevelType, nativeEvent); } function dispatchEvent(topLevelType, nativeEvent) { if (!_enabled) { return; } var nativeEventTarget = getEventTarget(nativeEvent); var targetInst = getClosestInstanceFromNode(nativeEventTarget); if (targetInst !== null && typeof targetInst.tag === 'number' && !isFiberMounted(targetInst)) { // If we get an event (ex: img onload) before committing that // component's mount, ignore it for now (that is, treat it as if it was an // event on a non-React tree). We might also consider queueing events and // dispatching them after the mount. targetInst = null; } var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst); try { // Event queue being processed in the same cycle allows // `preventDefault`. batchedUpdates(handleTopLevel, bookKeeping); } finally { releaseTopLevelCallbackBookKeeping(bookKeeping); } } /** * Summary of `ReactBrowserEventEmitter` event handling: * * - Top-level delegation is used to trap most native browser events. This * may only occur in the main thread and is the responsibility of * ReactDOMEventListener, which is injected and can therefore support * pluggable event sources. This is the only work that occurs in the main * thread. * * - We normalize and de-duplicate events to account for browser quirks. This * may be done in the worker thread. * * - Forward these native events (with the associated top-level type used to * trap it) to `EventPluginHub`, which in turn will ask plugins if they want * to extract any synthetic events. * * - The `EventPluginHub` will then process each event by annotating them with * "dispatches", a sequence of listeners and IDs that care about that event. * * - The `EventPluginHub` then dispatches the events. * * Overview of React and the event system: * * +------------+ . * | DOM | . * +------------+ . * | . * v . * +------------+ . * | ReactEvent | . * | Listener | . * +------------+ . +-----------+ * | . +--------+|SimpleEvent| * | . | |Plugin | * +-----|------+ . v +-----------+ * | | | . +--------------+ +------------+ * | +-----------.--->|EventPluginHub| | Event | * | | . | | +-----------+ | Propagators| * | ReactEvent | . | | |TapEvent | |------------| * | Emitter | . | |<---+|Plugin | |other plugin| * | | . | | +-----------+ | utilities | * | +-----------.--->| | +------------+ * | | | . +--------------+ * +-----|------+ . ^ +-----------+ * | . | |Enter/Leave| * + . +-------+|Plugin | * +-------------+ . +-----------+ * | application | . * |-------------| . * | | . * | | . * +-------------+ . * . * React Core . General Purpose Event Plugin System */ var alreadyListeningTo = {}; var reactTopListenersCounter = 0; /** * To ensure no conflicts with other potential React instances on the page */ var topListenersIDKey = '_reactListenersID' + ('' + Math.random()).slice(2); function getListeningForDocument(mountAt) { // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` // directly. if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { mountAt[topListenersIDKey] = reactTopListenersCounter++; alreadyListeningTo[mountAt[topListenersIDKey]] = {}; } return alreadyListeningTo[mountAt[topListenersIDKey]]; } /** * We listen for bubbled touch events on the document object. * * Firefox v8.01 (and possibly others) exhibited strange behavior when * mounting `onmousemove` events at some node that was not the document * element. The symptoms were that if your mouse is not moving over something * contained within that mount point (for example on the background) the * top-level listeners for `onmousemove` won't be called. However, if you * register the `mousemove` on the document object, then it will of course * catch all `mousemove`s. This along with iOS quirks, justifies restricting * top-level listeners to the document object only, at least for these * movement types of events and possibly all events. * * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html * * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but * they bubble to document. * * @param {string} registrationName Name of listener (e.g. `onClick`). * @param {object} mountAt Container where to mount the listener */ function listenTo(registrationName, mountAt) { var isListening = getListeningForDocument(mountAt); var dependencies = registrationNameDependencies[registrationName]; for (var i = 0; i < dependencies.length; i++) { var dependency = dependencies[i]; if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { switch (dependency) { case TOP_SCROLL: trapCapturedEvent(TOP_SCROLL, mountAt); break; case TOP_FOCUS: case TOP_BLUR: trapCapturedEvent(TOP_FOCUS, mountAt); trapCapturedEvent(TOP_BLUR, mountAt); // We set the flag for a single dependency later in this function, // but this ensures we mark both as attached rather than just one. isListening[TOP_BLUR] = true; isListening[TOP_FOCUS] = true; break; case TOP_CANCEL: case TOP_CLOSE: if (isEventSupported(getRawEventName(dependency))) { trapCapturedEvent(dependency, mountAt); } break; case TOP_INVALID: case TOP_SUBMIT: case TOP_RESET: // We listen to them on the target DOM elements. // Some of them bubble so we don't want them to fire twice. break; default: // By default, listen on the top level to all non-media events. // Media events don't bubble so adding the listener wouldn't do anything. var isMediaEvent = mediaEventTypes.indexOf(dependency) !== -1; if (!isMediaEvent) { trapBubbledEvent(dependency, mountAt); } break; } isListening[dependency] = true; } } } function isListeningToAllDependencies(registrationName, mountAt) { var isListening = getListeningForDocument(mountAt); var dependencies = registrationNameDependencies[registrationName]; for (var i = 0; i < dependencies.length; i++) { var dependency = dependencies[i]; if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) { return false; } } return true; } function getActiveElement(doc) { doc = doc || (typeof document !== 'undefined' ? document : undefined); if (typeof doc === 'undefined') { return null; } try { return doc.activeElement || doc.body; } catch (e) { return doc.body; } } /** * Given any node return the first leaf node without children. * * @param {DOMElement|DOMTextNode} node * @return {DOMElement|DOMTextNode} */ function getLeafNode(node) { while (node && node.firstChild) { node = node.firstChild; } return node; } /** * Get the next sibling within a container. This will walk up the * DOM if a node's siblings have been exhausted. * * @param {DOMElement|DOMTextNode} node * @return {?DOMElement|DOMTextNode} */ function getSiblingNode(node) { while (node) { if (node.nextSibling) { return node.nextSibling; } node = node.parentNode; } } /** * Get object describing the nodes which contain characters at offset. * * @param {DOMElement|DOMTextNode} root * @param {number} offset * @return {?object} */ function getNodeForCharacterOffset(root, offset) { var node = getLeafNode(root); var nodeStart = 0; var nodeEnd = 0; while (node) { if (node.nodeType === TEXT_NODE) { nodeEnd = nodeStart + node.textContent.length; if (nodeStart <= offset && nodeEnd >= offset) { return { node: node, offset: offset - nodeStart }; } nodeStart = nodeEnd; } node = getLeafNode(getSiblingNode(node)); } } /** * @param {DOMElement} outerNode * @return {?object} */ function getOffsets(outerNode) { var ownerDocument = outerNode.ownerDocument; var win = ownerDocument && ownerDocument.defaultView || window; var selection = win.getSelection && win.getSelection(); if (!selection || selection.rangeCount === 0) { return null; } var anchorNode = selection.anchorNode, anchorOffset = selection.anchorOffset, focusNode = selection.focusNode, focusOffset = selection.focusOffset; // In Firefox, anchorNode and focusNode can be "anonymous divs", e.g. the // up/down buttons on an . Anonymous divs do not seem to // expose properties, triggering a "Permission denied error" if any of its // properties are accessed. The only seemingly possible way to avoid erroring // is to access a property that typically works for non-anonymous divs and // catch any error that may otherwise arise. See // https://bugzilla.mozilla.org/show_bug.cgi?id=208427 try { /* eslint-disable no-unused-expressions */ anchorNode.nodeType; focusNode.nodeType; /* eslint-enable no-unused-expressions */ } catch (e) { return null; } return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset); } /** * Returns {start, end} where `start` is the character/codepoint index of * (anchorNode, anchorOffset) within the textContent of `outerNode`, and * `end` is the index of (focusNode, focusOffset). * * Returns null if you pass in garbage input but we should probably just crash. * * Exported only for testing. */ function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) { var length = 0; var start = -1; var end = -1; var indexWithinAnchor = 0; var indexWithinFocus = 0; var node = outerNode; var parentNode = null; outer: while (true) { var next = null; while (true) { if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) { start = length + anchorOffset; } if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) { end = length + focusOffset; } if (node.nodeType === TEXT_NODE) { length += node.nodeValue.length; } if ((next = node.firstChild) === null) { break; } // Moving from `node` to its first child `next`. parentNode = node; node = next; } while (true) { if (node === outerNode) { // If `outerNode` has children, this is always the second time visiting // it. If it has no children, this is still the first loop, and the only // valid selection is anchorNode and focusNode both equal to this node // and both offsets 0, in which case we will have handled above. break outer; } if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) { start = length; } if (parentNode === focusNode && ++indexWithinFocus === focusOffset) { end = length; } if ((next = node.nextSibling) !== null) { break; } node = parentNode; parentNode = node.parentNode; } // Moving from `node` to its next sibling `next`. node = next; } if (start === -1 || end === -1) { // This should never happen. (Would happen if the anchor/focus nodes aren't // actually inside the passed-in node.) return null; } return { start: start, end: end }; } /** * In modern non-IE browsers, we can support both forward and backward * selections. * * Note: IE10+ supports the Selection object, but it does not support * the `extend` method, which means that even in modern IE, it's not possible * to programmatically create a backward selection. Thus, for all IE * versions, we use the old IE API to create our selections. * * @param {DOMElement|DOMTextNode} node * @param {object} offsets */ function setOffsets(node, offsets) { var doc = node.ownerDocument || document; var win = doc && doc.defaultView || window; // Edge fails with "Object expected" in some scenarios. // (For instance: TinyMCE editor used in a list component that supports pasting to add more, // fails when pasting 100+ items) if (!win.getSelection) { return; } var selection = win.getSelection(); var length = node.textContent.length; var start = Math.min(offsets.start, length); var end = offsets.end === undefined ? start : Math.min(offsets.end, length); // IE 11 uses modern selection, but doesn't support the extend method. // Flip backward selections, so we can set with a single range. if (!selection.extend && start > end) { var temp = end; end = start; start = temp; } var startMarker = getNodeForCharacterOffset(node, start); var endMarker = getNodeForCharacterOffset(node, end); if (startMarker && endMarker) { if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) { return; } var range = doc.createRange(); range.setStart(startMarker.node, startMarker.offset); selection.removeAllRanges(); if (start > end) { selection.addRange(range); selection.extend(endMarker.node, endMarker.offset); } else { range.setEnd(endMarker.node, endMarker.offset); selection.addRange(range); } } } function isTextNode(node) { return node && node.nodeType === TEXT_NODE; } function containsNode(outerNode, innerNode) { if (!outerNode || !innerNode) { return false; } else if (outerNode === innerNode) { return true; } else if (isTextNode(outerNode)) { return false; } else if (isTextNode(innerNode)) { return containsNode(outerNode, innerNode.parentNode); } else if ('contains' in outerNode) { return outerNode.contains(innerNode); } else if (outerNode.compareDocumentPosition) { return !!(outerNode.compareDocumentPosition(innerNode) & 16); } else { return false; } } function isInDocument(node) { return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node); } function isSameOriginFrame(iframe) { try { // Accessing the contentDocument of a HTMLIframeElement can cause the browser // to throw, e.g. if it has a cross-origin src attribute. // Safari will show an error in the console when the access results in "Blocked a frame with origin". e.g: // iframe.contentDocument.defaultView; // A safety way is to access one of the cross origin properties: Window or Location // Which might result in "SecurityError" DOM Exception and it is compatible to Safari. // https://html.spec.whatwg.org/multipage/browsers.html#integration-with-idl return typeof iframe.contentWindow.location.href === 'string'; } catch (err) { return false; } } function getActiveElementDeep() { var win = window; var element = getActiveElement(); while (element instanceof win.HTMLIFrameElement) { if (isSameOriginFrame(element)) { win = element.contentWindow; } else { return element; } element = getActiveElement(win.document); } return element; } /** * @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. */ /** * @hasSelectionCapabilities: we get the element types that support selection * from https://html.spec.whatwg.org/#do-not-apply, looking at `selectionStart` * and `selectionEnd` rows. */ function hasSelectionCapabilities(elem) { var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); return nodeName && (nodeName === 'input' && (elem.type === 'text' || elem.type === 'search' || elem.type === 'tel' || elem.type === 'url' || elem.type === 'password') || nodeName === 'textarea' || elem.contentEditable === 'true'); } function getSelectionInformation() { var focusedElem = getActiveElementDeep(); return { focusedElem: focusedElem, selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection$1(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. */ function restoreSelection(priorSelectionInformation) { var curFocusedElem = getActiveElementDeep(); var priorFocusedElem = priorSelectionInformation.focusedElem; var priorSelectionRange = priorSelectionInformation.selectionRange; if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { if (priorSelectionRange !== null && hasSelectionCapabilities(priorFocusedElem)) { setSelection(priorFocusedElem, priorSelectionRange); } // Focusing a node can change the scroll position, which is undesirable var ancestors = []; var ancestor = priorFocusedElem; while (ancestor = ancestor.parentNode) { if (ancestor.nodeType === ELEMENT_NODE) { ancestors.push({ element: ancestor, left: ancestor.scrollLeft, top: ancestor.scrollTop }); } } if (typeof priorFocusedElem.focus === 'function') { priorFocusedElem.focus(); } for (var i = 0; i < ancestors.length; i++) { var info = ancestors[i]; info.element.scrollLeft = info.left; info.element.scrollTop = info.top; } } } /** * @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} */ function getSelection$1(input) { var selection = void 0; if ('selectionStart' in input) { // Modern browser with input or textarea. selection = { start: input.selectionStart, end: input.selectionEnd }; } else { // Content editable or old IE textarea. selection = getOffsets(input); } return selection || { start: 0, end: 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* */ function setSelection(input, offsets) { var start = offsets.start, end = offsets.end; if (end === undefined) { end = start; } if ('selectionStart' in input) { input.selectionStart = start; input.selectionEnd = Math.min(end, input.value.length); } else { setOffsets(input, offsets); } } var skipSelectionChangeEvent = canUseDOM && 'documentMode' in document && document.documentMode <= 11; var eventTypes$3 = { select: { phasedRegistrationNames: { bubbled: 'onSelect', captured: 'onSelectCapture' }, dependencies: [TOP_BLUR, TOP_CONTEXT_MENU, TOP_DRAG_END, TOP_FOCUS, TOP_KEY_DOWN, TOP_KEY_UP, TOP_MOUSE_DOWN, TOP_MOUSE_UP, TOP_SELECTION_CHANGE] } }; var activeElement$1 = null; var activeElementInst$1 = null; var lastSelection = null; var mouseDown = false; /** * Get an object which is a unique representation of the current selection. * * The return value will not be consistent across nodes or browsers, but * two identical selections on the same node will return identical objects. * * @param {DOMElement} node * @return {object} */ function getSelection(node) { if ('selectionStart' in node && hasSelectionCapabilities(node)) { return { start: node.selectionStart, end: node.selectionEnd }; } else { var win = node.ownerDocument && node.ownerDocument.defaultView || window; var selection = win.getSelection(); return { anchorNode: selection.anchorNode, anchorOffset: selection.anchorOffset, focusNode: selection.focusNode, focusOffset: selection.focusOffset }; } } /** * Get document associated with the event target. * * @param {object} nativeEventTarget * @return {Document} */ function getEventTargetDocument(eventTarget) { return eventTarget.window === eventTarget ? eventTarget.document : eventTarget.nodeType === DOCUMENT_NODE ? eventTarget : eventTarget.ownerDocument; } /** * Poll selection to see whether it's changed. * * @param {object} nativeEvent * @param {object} nativeEventTarget * @return {?SyntheticEvent} */ function constructSelectEvent(nativeEvent, nativeEventTarget) { // Ensure we have the right element, and that the user is not dragging a // selection (this matches native `select` event behavior). In HTML5, select // fires only on input and textarea thus if there's no focused element we // won't dispatch. var doc = getEventTargetDocument(nativeEventTarget); if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement(doc)) { return null; } // Only fire when selection has actually changed. var currentSelection = getSelection(activeElement$1); if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { lastSelection = currentSelection; var syntheticEvent = SyntheticEvent.getPooled(eventTypes$3.select, activeElementInst$1, nativeEvent, nativeEventTarget); syntheticEvent.type = 'select'; syntheticEvent.target = activeElement$1; accumulateTwoPhaseDispatches(syntheticEvent); return syntheticEvent; } return null; } /** * This plugin creates an `onSelect` event that normalizes select events * across form elements. * * Supported elements are: * - input (see `isTextInputElement`) * - textarea * - contentEditable * * This differs from native browser implementations in the following ways: * - Fires on contentEditable fields as well as inputs. * - Fires for collapsed selection. * - Fires after user input. */ var SelectEventPlugin = { eventTypes: eventTypes$3, extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { var doc = getEventTargetDocument(nativeEventTarget); // Track whether all listeners exists for this plugin. If none exist, we do // not extract events. See #3639. if (!doc || !isListeningToAllDependencies('onSelect', doc)) { return null; } var targetNode = targetInst ? getNodeFromInstance$1(targetInst) : window; switch (topLevelType) { // Track the input node that has focus. case TOP_FOCUS: if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') { activeElement$1 = targetNode; activeElementInst$1 = targetInst; lastSelection = null; } break; case TOP_BLUR: activeElement$1 = null; activeElementInst$1 = null; lastSelection = null; break; // Don't fire the event while the user is dragging. This matches the // semantics of the native select event. case TOP_MOUSE_DOWN: mouseDown = true; break; case TOP_CONTEXT_MENU: case TOP_MOUSE_UP: case TOP_DRAG_END: mouseDown = false; return constructSelectEvent(nativeEvent, nativeEventTarget); // Chrome and IE fire non-standard event when selection is changed (and // sometimes when it hasn't). IE's event fires out of order with respect // to key and input events on deletion, so we discard it. // // Firefox doesn't support selectionchange, so check selection status // after each key entry. The selection changes after keydown and before // keyup, but we check on keydown as well in the case of holding down a // key, when multiple keydown events are fired but only one keyup is. // This is also our approach for IE handling, for the reason above. case TOP_SELECTION_CHANGE: if (skipSelectionChangeEvent) { break; } // falls through case TOP_KEY_DOWN: case TOP_KEY_UP: return constructSelectEvent(nativeEvent, nativeEventTarget); } return null; } }; /** * Inject modules for resolving DOM hierarchy and plugin ordering. */ injection.injectEventPluginOrder(DOMEventPluginOrder); setComponentTree(getFiberCurrentPropsFromNode$1, getInstanceFromNode$1, getNodeFromInstance$1); /** * Some important event plugins included by default (without having to require * them). */ injection.injectEventPluginsByName({ SimpleEventPlugin: SimpleEventPlugin, EnterLeaveEventPlugin: EnterLeaveEventPlugin, ChangeEventPlugin: ChangeEventPlugin, SelectEventPlugin: SelectEventPlugin, BeforeInputEventPlugin: BeforeInputEventPlugin }); var didWarnSelectedSetOnOption = false; var didWarnInvalidChild = false; function flattenChildren(children) { var content = ''; // Flatten children. We'll warn if they are invalid // during validateProps() which runs for hydration too. // Note that this would throw on non-element objects. // Elements are stringified (which is normally irrelevant // but matters for ). React.Children.forEach(children, function (child) { if (child == null) { return; } content += child; // Note: we don't warn about invalid children here. // Instead, this is done separately below so that // it happens during the hydration codepath too. }); return content; } /** * Implements an