[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 this["wp"] = this["wp"] || {}; this["wp"]["components"] = 2 /******/ (function(modules) { // webpackBootstrap 3 /******/ // The module cache 4 /******/ var installedModules = {}; 5 /******/ 6 /******/ // The require function 7 /******/ function __webpack_require__(moduleId) { 8 /******/ 9 /******/ // Check if module is in cache 10 /******/ if(installedModules[moduleId]) { 11 /******/ return installedModules[moduleId].exports; 12 /******/ } 13 /******/ // Create a new module (and put it into the cache) 14 /******/ var module = installedModules[moduleId] = { 15 /******/ i: moduleId, 16 /******/ l: false, 17 /******/ exports: {} 18 /******/ }; 19 /******/ 20 /******/ // Execute the module function 21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 /******/ 23 /******/ // Flag the module as loaded 24 /******/ module.l = true; 25 /******/ 26 /******/ // Return the exports of the module 27 /******/ return module.exports; 28 /******/ } 29 /******/ 30 /******/ 31 /******/ // expose the modules object (__webpack_modules__) 32 /******/ __webpack_require__.m = modules; 33 /******/ 34 /******/ // expose the module cache 35 /******/ __webpack_require__.c = installedModules; 36 /******/ 37 /******/ // define getter function for harmony exports 38 /******/ __webpack_require__.d = function(exports, name, getter) { 39 /******/ if(!__webpack_require__.o(exports, name)) { 40 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 /******/ } 42 /******/ }; 43 /******/ 44 /******/ // define __esModule on exports 45 /******/ __webpack_require__.r = function(exports) { 46 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 /******/ } 49 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 /******/ }; 51 /******/ 52 /******/ // create a fake namespace object 53 /******/ // mode & 1: value is a module id, require it 54 /******/ // mode & 2: merge all properties of value into the ns 55 /******/ // mode & 4: return value when already ns object 56 /******/ // mode & 8|1: behave like require 57 /******/ __webpack_require__.t = function(value, mode) { 58 /******/ if(mode & 1) value = __webpack_require__(value); 59 /******/ if(mode & 8) return value; 60 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 /******/ var ns = Object.create(null); 62 /******/ __webpack_require__.r(ns); 63 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 /******/ return ns; 66 /******/ }; 67 /******/ 68 /******/ // getDefaultExport function for compatibility with non-harmony modules 69 /******/ __webpack_require__.n = function(module) { 70 /******/ var getter = module && module.__esModule ? 71 /******/ function getDefault() { return module['default']; } : 72 /******/ function getModuleExports() { return module; }; 73 /******/ __webpack_require__.d(getter, 'a', getter); 74 /******/ return getter; 75 /******/ }; 76 /******/ 77 /******/ // Object.prototype.hasOwnProperty.call 78 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 /******/ 80 /******/ // __webpack_public_path__ 81 /******/ __webpack_require__.p = ""; 82 /******/ 83 /******/ 84 /******/ // Load entry module and return exports 85 /******/ return __webpack_require__(__webpack_require__.s = 273); 86 /******/ }) 87 /************************************************************************/ 88 /******/ ([ 89 /* 0 */ 90 /***/ (function(module, exports) { 91 92 (function() { module.exports = this["wp"]["element"]; }()); 93 94 /***/ }), 95 /* 1 */ 96 /***/ (function(module, exports) { 97 98 (function() { module.exports = this["wp"]["i18n"]; }()); 99 100 /***/ }), 101 /* 2 */ 102 /***/ (function(module, exports) { 103 104 (function() { module.exports = this["lodash"]; }()); 105 106 /***/ }), 107 /* 3 */, 108 /* 4 */, 109 /* 5 */ 110 /***/ (function(module, __webpack_exports__, __webpack_require__) { 111 112 "use strict"; 113 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); 114 function _defineProperty(obj, key, value) { 115 if (key in obj) { 116 Object.defineProperty(obj, key, { 117 value: value, 118 enumerable: true, 119 configurable: true, 120 writable: true 121 }); 122 } else { 123 obj[key] = value; 124 } 125 126 return obj; 127 } 128 129 /***/ }), 130 /* 6 */, 131 /* 7 */ 132 /***/ (function(module, exports) { 133 134 (function() { module.exports = this["wp"]["primitives"]; }()); 135 136 /***/ }), 137 /* 8 */ 138 /***/ (function(module, __webpack_exports__, __webpack_require__) { 139 140 "use strict"; 141 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); 142 function _extends() { 143 _extends = Object.assign || function (target) { 144 for (var i = 1; i < arguments.length; i++) { 145 var source = arguments[i]; 146 147 for (var key in source) { 148 if (Object.prototype.hasOwnProperty.call(source, key)) { 149 target[key] = source[key]; 150 } 151 } 152 } 153 154 return target; 155 }; 156 157 return _extends.apply(this, arguments); 158 } 159 160 /***/ }), 161 /* 9 */ 162 /***/ (function(module, exports, __webpack_require__) { 163 164 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 165 Copyright (c) 2017 Jed Watson. 166 Licensed under the MIT License (MIT), see 167 http://jedwatson.github.io/classnames 168 */ 169 /* global define */ 170 171 (function () { 172 'use strict'; 173 174 var hasOwn = {}.hasOwnProperty; 175 176 function classNames () { 177 var classes = []; 178 179 for (var i = 0; i < arguments.length; i++) { 180 var arg = arguments[i]; 181 if (!arg) continue; 182 183 var argType = typeof arg; 184 185 if (argType === 'string' || argType === 'number') { 186 classes.push(arg); 187 } else if (Array.isArray(arg) && arg.length) { 188 var inner = classNames.apply(null, arg); 189 if (inner) { 190 classes.push(inner); 191 } 192 } else if (argType === 'object') { 193 for (var key in arg) { 194 if (hasOwn.call(arg, key) && arg[key]) { 195 classes.push(key); 196 } 197 } 198 } 199 } 200 201 return classes.join(' '); 202 } 203 204 if ( true && module.exports) { 205 classNames.default = classNames; 206 module.exports = classNames; 207 } else if (true) { 208 // register as 'classnames', consistent with npm package name 209 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { 210 return classNames; 211 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 212 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 213 } else {} 214 }()); 215 216 217 /***/ }), 218 /* 10 */ 219 /***/ (function(module, exports) { 220 221 (function() { module.exports = this["wp"]["compose"]; }()); 222 223 /***/ }), 224 /* 11 */, 225 /* 12 */ 226 /***/ (function(module, __webpack_exports__, __webpack_require__) { 227 228 "use strict"; 229 230 // EXPORTS 231 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; }); 232 233 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js 234 var arrayWithHoles = __webpack_require__(38); 235 236 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js 237 function _iterableToArrayLimit(arr, i) { 238 if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; 239 var _arr = []; 240 var _n = true; 241 var _d = false; 242 var _e = undefined; 243 244 try { 245 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { 246 _arr.push(_s.value); 247 248 if (i && _arr.length === i) break; 249 } 250 } catch (err) { 251 _d = true; 252 _e = err; 253 } finally { 254 try { 255 if (!_n && _i["return"] != null) _i["return"](); 256 } finally { 257 if (_d) throw _e; 258 } 259 } 260 261 return _arr; 262 } 263 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js 264 var unsupportedIterableToArray = __webpack_require__(31); 265 266 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js 267 var nonIterableRest = __webpack_require__(39); 268 269 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js 270 271 272 273 274 function _slicedToArray(arr, i) { 275 return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])(); 276 } 277 278 /***/ }), 279 /* 13 */ 280 /***/ (function(module, exports) { 281 282 (function() { module.exports = this["React"]; }()); 283 284 /***/ }), 285 /* 14 */ 286 /***/ (function(module, __webpack_exports__, __webpack_require__) { 287 288 "use strict"; 289 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; }); 290 /* harmony import */ var _objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(43); 291 292 function _objectWithoutProperties(source, excluded) { 293 if (source == null) return {}; 294 var target = Object(_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(source, excluded); 295 var key, i; 296 297 if (Object.getOwnPropertySymbols) { 298 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 299 300 for (i = 0; i < sourceSymbolKeys.length; i++) { 301 key = sourceSymbolKeys[i]; 302 if (excluded.indexOf(key) >= 0) continue; 303 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; 304 target[key] = source[key]; 305 } 306 } 307 308 return target; 309 } 310 311 /***/ }), 312 /* 15 */ 313 /***/ (function(module, __webpack_exports__, __webpack_require__) { 314 315 "use strict"; 316 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; }); 317 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _objectSpread2; }); 318 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return _createForOfIteratorHelperLoose; }); 319 function _defineProperty(obj, key, value) { 320 if (key in obj) { 321 Object.defineProperty(obj, key, { 322 value: value, 323 enumerable: true, 324 configurable: true, 325 writable: true 326 }); 327 } else { 328 obj[key] = value; 329 } 330 331 return obj; 332 } 333 334 function ownKeys(object, enumerableOnly) { 335 var keys = Object.keys(object); 336 337 if (Object.getOwnPropertySymbols) { 338 var symbols = Object.getOwnPropertySymbols(object); 339 if (enumerableOnly) symbols = symbols.filter(function (sym) { 340 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 341 }); 342 keys.push.apply(keys, symbols); 343 } 344 345 return keys; 346 } 347 348 function _objectSpread2(target) { 349 for (var i = 1; i < arguments.length; i++) { 350 var source = arguments[i] != null ? arguments[i] : {}; 351 352 if (i % 2) { 353 ownKeys(Object(source), true).forEach(function (key) { 354 _defineProperty(target, key, source[key]); 355 }); 356 } else if (Object.getOwnPropertyDescriptors) { 357 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 358 } else { 359 ownKeys(Object(source)).forEach(function (key) { 360 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 361 }); 362 } 363 } 364 365 return target; 366 } 367 368 function _objectWithoutPropertiesLoose(source, excluded) { 369 if (source == null) return {}; 370 var target = {}; 371 var sourceKeys = Object.keys(source); 372 var key, i; 373 374 for (i = 0; i < sourceKeys.length; i++) { 375 key = sourceKeys[i]; 376 if (excluded.indexOf(key) >= 0) continue; 377 target[key] = source[key]; 378 } 379 380 return target; 381 } 382 383 function _unsupportedIterableToArray(o, minLen) { 384 if (!o) return; 385 if (typeof o === "string") return _arrayLikeToArray(o, minLen); 386 var n = Object.prototype.toString.call(o).slice(8, -1); 387 if (n === "Object" && o.constructor) n = o.constructor.name; 388 if (n === "Map" || n === "Set") return Array.from(o); 389 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); 390 } 391 392 function _arrayLikeToArray(arr, len) { 393 if (len == null || len > arr.length) len = arr.length; 394 395 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; 396 397 return arr2; 398 } 399 400 function _createForOfIteratorHelperLoose(o, allowArrayLike) { 401 var it; 402 403 if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { 404 if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { 405 if (it) o = it; 406 var i = 0; 407 return function () { 408 if (i >= o.length) return { 409 done: true 410 }; 411 return { 412 done: false, 413 value: o[i++] 414 }; 415 }; 416 } 417 418 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 419 } 420 421 it = o[Symbol.iterator](); 422 return it.next.bind(it); 423 } 424 425 426 427 428 /***/ }), 429 /* 16 */ 430 /***/ (function(module, __webpack_exports__, __webpack_require__) { 431 432 "use strict"; 433 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; }); 434 function _assertThisInitialized(self) { 435 if (self === void 0) { 436 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 437 } 438 439 return self; 440 } 441 442 /***/ }), 443 /* 17 */ 444 /***/ (function(module, __webpack_exports__, __webpack_require__) { 445 446 "use strict"; 447 448 // EXPORTS 449 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; }); 450 451 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js 452 var arrayLikeToArray = __webpack_require__(27); 453 454 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js 455 456 function _arrayWithoutHoles(arr) { 457 if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr); 458 } 459 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js 460 var iterableToArray = __webpack_require__(37); 461 462 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js 463 var unsupportedIterableToArray = __webpack_require__(31); 464 465 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js 466 function _nonIterableSpread() { 467 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 468 } 469 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js 470 471 472 473 474 function _toConsumableArray(arr) { 475 return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread(); 476 } 477 478 /***/ }), 479 /* 18 */ 480 /***/ (function(module, exports) { 481 482 (function() { module.exports = this["wp"]["keycodes"]; }()); 483 484 /***/ }), 485 /* 19 */ 486 /***/ (function(module, __webpack_exports__, __webpack_require__) { 487 488 "use strict"; 489 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; }); 490 function _getPrototypeOf(o) { 491 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { 492 return o.__proto__ || Object.getPrototypeOf(o); 493 }; 494 return _getPrototypeOf(o); 495 } 496 497 /***/ }), 498 /* 20 */ 499 /***/ (function(module, exports) { 500 501 (function() { module.exports = this["regeneratorRuntime"]; }()); 502 503 /***/ }), 504 /* 21 */ 505 /***/ (function(module, __webpack_exports__, __webpack_require__) { 506 507 "use strict"; 508 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; }); 509 function _classCallCheck(instance, Constructor) { 510 if (!(instance instanceof Constructor)) { 511 throw new TypeError("Cannot call a class as a function"); 512 } 513 } 514 515 /***/ }), 516 /* 22 */ 517 /***/ (function(module, __webpack_exports__, __webpack_require__) { 518 519 "use strict"; 520 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; }); 521 function _defineProperties(target, props) { 522 for (var i = 0; i < props.length; i++) { 523 var descriptor = props[i]; 524 descriptor.enumerable = descriptor.enumerable || false; 525 descriptor.configurable = true; 526 if ("value" in descriptor) descriptor.writable = true; 527 Object.defineProperty(target, descriptor.key, descriptor); 528 } 529 } 530 531 function _createClass(Constructor, protoProps, staticProps) { 532 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 533 if (staticProps) _defineProperties(Constructor, staticProps); 534 return Constructor; 535 } 536 537 /***/ }), 538 /* 23 */ 539 /***/ (function(module, __webpack_exports__, __webpack_require__) { 540 541 "use strict"; 542 543 // EXPORTS 544 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _inherits; }); 545 546 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js 547 function _setPrototypeOf(o, p) { 548 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { 549 o.__proto__ = p; 550 return o; 551 }; 552 553 return _setPrototypeOf(o, p); 554 } 555 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js 556 557 function _inherits(subClass, superClass) { 558 if (typeof superClass !== "function" && superClass !== null) { 559 throw new TypeError("Super expression must either be null or a function"); 560 } 561 562 subClass.prototype = Object.create(superClass && superClass.prototype, { 563 constructor: { 564 value: subClass, 565 writable: true, 566 configurable: true 567 } 568 }); 569 if (superClass) _setPrototypeOf(subClass, superClass); 570 } 571 572 /***/ }), 573 /* 24 */ 574 /***/ (function(module, __webpack_exports__, __webpack_require__) { 575 576 "use strict"; 577 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; }); 578 /* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(40); 579 /* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16); 580 581 582 function _possibleConstructorReturn(self, call) { 583 if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) { 584 return call; 585 } 586 587 return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self); 588 } 589 590 /***/ }), 591 /* 25 */ 592 /***/ (function(module, exports) { 593 594 (function() { module.exports = this["wp"]["richText"]; }()); 595 596 /***/ }), 597 /* 26 */, 598 /* 27 */ 599 /***/ (function(module, __webpack_exports__, __webpack_require__) { 600 601 "use strict"; 602 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; }); 603 function _arrayLikeToArray(arr, len) { 604 if (len == null || len > arr.length) len = arr.length; 605 606 for (var i = 0, arr2 = new Array(len); i < len; i++) { 607 arr2[i] = arr[i]; 608 } 609 610 return arr2; 611 } 612 613 /***/ }), 614 /* 28 */ 615 /***/ (function(module, exports, __webpack_require__) { 616 617 /** 618 * Copyright (c) 2013-present, Facebook, Inc. 619 * 620 * This source code is licensed under the MIT license found in the 621 * LICENSE file in the root directory of this source tree. 622 */ 623 624 if (false) { var throwOnDirectAccess, ReactIs; } else { 625 // By explicitly using `prop-types` you are opting into new production behavior. 626 // http://fb.me/prop-types-in-prod 627 module.exports = __webpack_require__(142)(); 628 } 629 630 631 /***/ }), 632 /* 29 */ 633 /***/ (function(module, exports) { 634 635 (function() { module.exports = this["wp"]["dom"]; }()); 636 637 /***/ }), 638 /* 30 */, 639 /* 31 */ 640 /***/ (function(module, __webpack_exports__, __webpack_require__) { 641 642 "use strict"; 643 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; }); 644 /* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27); 645 646 function _unsupportedIterableToArray(o, minLen) { 647 if (!o) return; 648 if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); 649 var n = Object.prototype.toString.call(o).slice(8, -1); 650 if (n === "Object" && o.constructor) n = o.constructor.name; 651 if (n === "Map" || n === "Set") return Array.from(o); 652 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); 653 } 654 655 /***/ }), 656 /* 32 */, 657 /* 33 */ 658 /***/ (function(module, exports) { 659 660 (function() { module.exports = this["wp"]["hooks"]; }()); 661 662 /***/ }), 663 /* 34 */, 664 /* 35 */ 665 /***/ (function(module, __webpack_exports__, __webpack_require__) { 666 667 "use strict"; 668 /* unused harmony export Button */ 669 /* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8); 670 /* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(14); 671 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0); 672 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); 673 /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9); 674 /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__); 675 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2); 676 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_4__); 677 /* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(36); 678 /* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_5__); 679 /* harmony import */ var _tooltip__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(84); 680 /* harmony import */ var _icon__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(85); 681 682 683 684 685 function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } 686 687 function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 688 689 function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 690 691 /** 692 * External dependencies 693 */ 694 695 696 /** 697 * WordPress dependencies 698 */ 699 700 701 702 /** 703 * Internal dependencies 704 */ 705 706 707 708 var disabledEventsOnDisabledButton = ['onMouseDown', 'onClick']; 709 function Button(props, ref) { 710 var href = props.href, 711 target = props.target, 712 isPrimary = props.isPrimary, 713 isSmall = props.isSmall, 714 isTertiary = props.isTertiary, 715 isPressed = props.isPressed, 716 isBusy = props.isBusy, 717 isDefault = props.isDefault, 718 isSecondary = props.isSecondary, 719 isLink = props.isLink, 720 isDestructive = props.isDestructive, 721 className = props.className, 722 disabled = props.disabled, 723 icon = props.icon, 724 iconSize = props.iconSize, 725 showTooltip = props.showTooltip, 726 tooltipPosition = props.tooltipPosition, 727 shortcut = props.shortcut, 728 label = props.label, 729 children = props.children, 730 isFocusable = props.__experimentalIsFocusable, 731 additionalProps = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(props, ["href", "target", "isPrimary", "isSmall", "isTertiary", "isPressed", "isBusy", "isDefault", "isSecondary", "isLink", "isDestructive", "className", "disabled", "icon", "iconSize", "showTooltip", "tooltipPosition", "shortcut", "label", "children", "__experimentalIsFocusable"]); 732 733 if (isDefault) { 734 _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_5___default()('Button isDefault prop', { 735 alternative: 'isSecondary' 736 }); 737 } 738 739 var classes = classnames__WEBPACK_IMPORTED_MODULE_3___default()('components-button', className, { 740 'is-secondary': isDefault || isSecondary, 741 'is-primary': isPrimary, 742 'is-small': isSmall, 743 'is-tertiary': isTertiary, 744 'is-pressed': isPressed, 745 'is-busy': isBusy, 746 'is-link': isLink, 747 'is-destructive': isDestructive, 748 'has-text': !!icon && !!children, 749 'has-icon': !!icon 750 }); 751 var trulyDisabled = disabled && !isFocusable; 752 var Tag = href !== undefined && !trulyDisabled ? 'a' : 'button'; 753 var tagProps = Tag === 'a' ? { 754 href: href, 755 target: target 756 } : { 757 type: 'button', 758 disabled: trulyDisabled, 759 'aria-pressed': isPressed 760 }; 761 762 if (disabled && isFocusable) { 763 // In this case, the button will be disabled, but still focusable and 764 // perceivable by screen reader users. 765 tagProps['aria-disabled'] = true; 766 767 var _iterator = _createForOfIteratorHelper(disabledEventsOnDisabledButton), 768 _step; 769 770 try { 771 for (_iterator.s(); !(_step = _iterator.n()).done;) { 772 var disabledEvent = _step.value; 773 774 additionalProps[disabledEvent] = function (event) { 775 event.stopPropagation(); 776 event.preventDefault(); 777 }; 778 } 779 } catch (err) { 780 _iterator.e(err); 781 } finally { 782 _iterator.f(); 783 } 784 } // Should show the tooltip if... 785 786 787 var shouldShowTooltip = !trulyDisabled && ( // an explicit tooltip is passed or... 788 showTooltip && label || // there's a shortcut or... 789 shortcut || // there's a label and... 790 !!label && ( // the children are empty and... 791 !children || Object(lodash__WEBPACK_IMPORTED_MODULE_4__["isArray"])(children) && !children.length) && // the tooltip is not explicitly disabled. 792 false !== showTooltip); 793 var element = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["createElement"])(Tag, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({}, tagProps, additionalProps, { 794 className: classes, 795 "aria-label": additionalProps['aria-label'] || label, 796 ref: ref 797 }), icon && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["createElement"])(_icon__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"], { 798 icon: icon, 799 size: iconSize 800 }), children); 801 802 if (!shouldShowTooltip) { 803 return element; 804 } 805 806 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["createElement"])(_tooltip__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"], { 807 text: label, 808 shortcut: shortcut, 809 position: tooltipPosition 810 }, element); 811 } 812 /* harmony default export */ __webpack_exports__["a"] = (Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["forwardRef"])(Button)); 813 814 815 /***/ }), 816 /* 36 */ 817 /***/ (function(module, exports) { 818 819 (function() { module.exports = this["wp"]["deprecated"]; }()); 820 821 /***/ }), 822 /* 37 */ 823 /***/ (function(module, __webpack_exports__, __webpack_require__) { 824 825 "use strict"; 826 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; }); 827 function _iterableToArray(iter) { 828 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); 829 } 830 831 /***/ }), 832 /* 38 */ 833 /***/ (function(module, __webpack_exports__, __webpack_require__) { 834 835 "use strict"; 836 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); 837 function _arrayWithHoles(arr) { 838 if (Array.isArray(arr)) return arr; 839 } 840 841 /***/ }), 842 /* 39 */ 843 /***/ (function(module, __webpack_exports__, __webpack_require__) { 844 845 "use strict"; 846 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); 847 function _nonIterableRest() { 848 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 849 } 850 851 /***/ }), 852 /* 40 */ 853 /***/ (function(module, __webpack_exports__, __webpack_require__) { 854 855 "use strict"; 856 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; }); 857 function _typeof(obj) { 858 "@babel/helpers - typeof"; 859 860 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { 861 _typeof = function _typeof(obj) { 862 return typeof obj; 863 }; 864 } else { 865 _typeof = function _typeof(obj) { 866 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 867 }; 868 } 869 870 return _typeof(obj); 871 } 872 873 /***/ }), 874 /* 41 */, 875 /* 42 */, 876 /* 43 */ 877 /***/ (function(module, __webpack_exports__, __webpack_require__) { 878 879 "use strict"; 880 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; }); 881 function _objectWithoutPropertiesLoose(source, excluded) { 882 if (source == null) return {}; 883 var target = {}; 884 var sourceKeys = Object.keys(source); 885 var key, i; 886 887 for (i = 0; i < sourceKeys.length; i++) { 888 key = sourceKeys[i]; 889 if (excluded.indexOf(key) >= 0) continue; 890 target[key] = source[key]; 891 } 892 893 return target; 894 } 895 896 /***/ }), 897 /* 44 */ 898 /***/ (function(module, exports) { 899 900 (function() { module.exports = this["moment"]; }()); 901 902 /***/ }), 903 /* 45 */ 904 /***/ (function(module, __webpack_exports__, __webpack_require__) { 905 906 "use strict"; 907 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _asyncToGenerator; }); 908 function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { 909 try { 910 var info = gen[key](arg); 911 var value = info.value; 912 } catch (error) { 913 reject(error); 914 return; 915 } 916 917 if (info.done) { 918 resolve(value); 919 } else { 920 Promise.resolve(value).then(_next, _throw); 921 } 922 } 923 924 function _asyncToGenerator(fn) { 925 return function () { 926 var self = this, 927 args = arguments; 928 return new Promise(function (resolve, reject) { 929 var gen = fn.apply(self, args); 930 931 function _next(value) { 932 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); 933 } 934 935 function _throw(err) { 936 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); 937 } 938 939 _next(undefined); 940 }); 941 }; 942 } 943 944 /***/ }), 945 /* 46 */ 946 /***/ (function(module, exports) { 947 948 (function() { module.exports = this["wp"]["a11y"]; }()); 949 950 /***/ }), 951 /* 47 */, 952 /* 48 */ 953 /***/ (function(module, __webpack_exports__, __webpack_require__) { 954 955 "use strict"; 956 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useLiveRef; }); 957 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); 958 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 959 /* harmony import */ var _useIsomorphicEffect_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(59); 960 961 962 963 /** 964 * A `React.Ref` that keeps track of the passed `value`. 965 */ 966 967 function useLiveRef(value) { 968 var ref = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(value); 969 Object(_useIsomorphicEffect_js__WEBPACK_IMPORTED_MODULE_1__[/* useIsomorphicEffect */ "a"])(function () { 970 ref.current = value; 971 }); 972 return ref; 973 } 974 975 976 977 978 /***/ }), 979 /* 49 */ 980 /***/ (function(module, __webpack_exports__, __webpack_require__) { 981 982 "use strict"; 983 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getDocument; }); 984 /** 985 * Returns `element.ownerDocument || window.document`. 986 */ 987 function getDocument(element) { 988 return element ? element.ownerDocument || element : window.document; 989 } 990 991 992 993 994 /***/ }), 995 /* 50 */ 996 /***/ (function(module, __webpack_exports__, __webpack_require__) { 997 998 "use strict"; 999 1000 // EXPORTS 1001 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ createHook; }); 1002 1003 // EXTERNAL MODULE: external {"this":"React"} 1004 var external_this_React_ = __webpack_require__(13); 1005 1006 // EXTERNAL MODULE: ./node_modules/reakit-system/es/SystemContext.js 1007 var SystemContext = __webpack_require__(76); 1008 1009 // CONCATENATED MODULE: ./node_modules/reakit-system/es/useToken.js 1010 1011 1012 1013 /** 1014 * React custom hook that returns the value of any token defined in the 1015 * SystemContext. It's mainly used internally in [`useOptions`](#useoptions) 1016 * and [`useProps`](#useprops). 1017 * 1018 * @example 1019 * import { SystemProvider, useToken } from "reakit-system"; 1020 * 1021 * const system = { 1022 * token: "value", 1023 * }; 1024 * 1025 * function Component(props) { 1026 * const token = useToken("token", "default value"); 1027 * return <div {...props}>{token}</div>; 1028 * } 1029 * 1030 * function App() { 1031 * return ( 1032 * <SystemProvider unstable_system={system}> 1033 * <Component /> 1034 * </SystemProvider> 1035 * ); 1036 * } 1037 */ 1038 1039 function useToken(token, defaultValue) { 1040 Object(external_this_React_["useDebugValue"])(token); 1041 var context = Object(external_this_React_["useContext"])(SystemContext["a" /* SystemContext */]); 1042 return context[token] != null ? context[token] : defaultValue; 1043 } 1044 1045 1046 1047 // CONCATENATED MODULE: ./node_modules/reakit-system/es/useProps.js 1048 1049 1050 1051 1052 /** 1053 * React custom hook that returns the props returned by a given 1054 * `use${name}Props` in the SystemContext. 1055 * 1056 * @example 1057 * import { SystemProvider, useProps } from "reakit-system"; 1058 * 1059 * const system = { 1060 * useAProps(options, htmlProps) { 1061 * return { 1062 * ...htmlProps, 1063 * href: options.url, 1064 * }; 1065 * }, 1066 * }; 1067 * 1068 * function A({ url, ...htmlProps }) { 1069 * const props = useProps("A", { url }, htmlProps); 1070 * return <a {...props} />; 1071 * } 1072 * 1073 * function App() { 1074 * return ( 1075 * <SystemProvider unstable_system={system}> 1076 * <A url="url">It will convert url into href in useAProps</A> 1077 * </SystemProvider> 1078 * ); 1079 * } 1080 */ 1081 1082 function useProps(name, options, htmlProps) { 1083 if (options === void 0) { 1084 options = {}; 1085 } 1086 1087 if (htmlProps === void 0) { 1088 htmlProps = {}; 1089 } 1090 1091 var hookName = "use" + name + "Props"; 1092 Object(external_this_React_["useDebugValue"])(hookName); 1093 var useHook = useToken(hookName); 1094 1095 if (useHook) { 1096 return useHook(options, htmlProps); 1097 } 1098 1099 return htmlProps; 1100 } 1101 1102 1103 1104 // EXTERNAL MODULE: ./node_modules/reakit-system/es/_rollupPluginBabelHelpers-0c84a174.js 1105 var _rollupPluginBabelHelpers_0c84a174 = __webpack_require__(55); 1106 1107 // CONCATENATED MODULE: ./node_modules/reakit-system/es/useOptions.js 1108 1109 1110 1111 1112 1113 /** 1114 * React custom hook that returns the options returned by a given 1115 * `use${name}Options` in the SystemContext. 1116 * 1117 * @example 1118 * import React from "react"; 1119 * import { SystemProvider, useOptions } from "reakit-system"; 1120 * 1121 * const system = { 1122 * useAOptions(options, htmlProps) { 1123 * return { 1124 * ...options, 1125 * url: htmlProps.href, 1126 * }; 1127 * }, 1128 * }; 1129 * 1130 * function A({ url, ...htmlProps }) { 1131 * const options = useOptions("A", { url }, htmlProps); 1132 * return <a href={options.url} {...htmlProps} />; 1133 * } 1134 * 1135 * function App() { 1136 * return ( 1137 * <SystemProvider unstable_system={system}> 1138 * <A href="url"> 1139 * It will convert href into url in useAOptions and then url into href in A 1140 * </A> 1141 * </SystemProvider> 1142 * ); 1143 * } 1144 */ 1145 1146 function useOptions(name, options, htmlProps) { 1147 if (options === void 0) { 1148 options = {}; 1149 } 1150 1151 if (htmlProps === void 0) { 1152 htmlProps = {}; 1153 } 1154 1155 var hookName = "use" + name + "Options"; 1156 Object(external_this_React_["useDebugValue"])(hookName); 1157 var useHook = useToken(hookName); 1158 1159 if (useHook) { 1160 return Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])(Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])({}, options), useHook(options, htmlProps)); 1161 } 1162 1163 return options; 1164 } 1165 1166 1167 1168 // EXTERNAL MODULE: ./node_modules/reakit-utils/es/shallowEqual.js 1169 var shallowEqual = __webpack_require__(56); 1170 1171 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/toArray.js 1172 /** 1173 * Transforms `arg` into an array if it's not already. 1174 * 1175 * @example 1176 * import { toArray } from "reakit-utils"; 1177 * 1178 * toArray("a"); // ["a"] 1179 * toArray(["a"]); // ["a"] 1180 */ 1181 function toArray(arg) { 1182 if (Array.isArray(arg)) { 1183 return arg; 1184 } 1185 1186 return typeof arg !== "undefined" ? [arg] : []; 1187 } 1188 1189 1190 1191 // CONCATENATED MODULE: ./node_modules/reakit-system/es/createHook.js 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 /** 1202 * Creates a React custom hook that will return component props. 1203 * 1204 * @example 1205 * import { createHook } from "reakit-system"; 1206 * 1207 * const useA = createHook({ 1208 * name: "A", 1209 * keys: ["url"], // custom props/options keys 1210 * useProps(options, htmlProps) { 1211 * return { 1212 * ...htmlProps, 1213 * href: options.url, 1214 * }; 1215 * }, 1216 * }); 1217 * 1218 * function A({ url, ...htmlProps }) { 1219 * const props = useA({ url }, htmlProps); 1220 * return <a {...props} />; 1221 * } 1222 * 1223 * @param options 1224 */ 1225 function createHook(options) { 1226 var _options$useState, _composedHooks$; 1227 1228 var composedHooks = toArray(options.compose); 1229 1230 var __useOptions = function __useOptions(hookOptions, htmlProps) { 1231 // Call the current hook's useOptions first 1232 if (options.useOptions) { 1233 hookOptions = options.useOptions(hookOptions, htmlProps); 1234 } // If there's name, call useOptions from the system context 1235 1236 1237 if (options.name) { 1238 hookOptions = useOptions(options.name, hookOptions, htmlProps); 1239 } // Run composed hooks useOptions 1240 1241 1242 if (options.compose) { 1243 for (var _iterator = Object(_rollupPluginBabelHelpers_0c84a174["c" /* b */])(composedHooks), _step; !(_step = _iterator()).done;) { 1244 var hook = _step.value; 1245 hookOptions = hook.__useOptions(hookOptions, htmlProps); 1246 } 1247 } 1248 1249 return hookOptions; 1250 }; 1251 1252 var useHook = function useHook(hookOptions, htmlProps, unstable_ignoreUseOptions) { 1253 if (hookOptions === void 0) { 1254 hookOptions = {}; 1255 } 1256 1257 if (htmlProps === void 0) { 1258 htmlProps = {}; 1259 } 1260 1261 if (unstable_ignoreUseOptions === void 0) { 1262 unstable_ignoreUseOptions = false; 1263 } 1264 1265 // This won't execute when useHook was called from within another useHook 1266 if (!unstable_ignoreUseOptions) { 1267 hookOptions = __useOptions(hookOptions, htmlProps); 1268 } // Call the current hook's useProps 1269 1270 1271 if (options.useProps) { 1272 htmlProps = options.useProps(hookOptions, htmlProps); 1273 } // If there's name, call useProps from the system context 1274 1275 1276 if (options.name) { 1277 htmlProps = useProps(options.name, hookOptions, htmlProps); 1278 } 1279 1280 if (options.compose) { 1281 if (options.useComposeOptions) { 1282 hookOptions = options.useComposeOptions(hookOptions, htmlProps); 1283 } 1284 1285 if (options.useComposeProps) { 1286 htmlProps = options.useComposeProps(hookOptions, htmlProps); 1287 } else { 1288 for (var _iterator2 = Object(_rollupPluginBabelHelpers_0c84a174["c" /* b */])(composedHooks), _step2; !(_step2 = _iterator2()).done;) { 1289 var hook = _step2.value; 1290 htmlProps = hook(hookOptions, htmlProps, true); 1291 } 1292 } 1293 } // Remove undefined values from htmlProps 1294 1295 1296 var finalHTMLProps = {}; 1297 var definedHTMLProps = htmlProps || {}; 1298 1299 for (var prop in definedHTMLProps) { 1300 if (definedHTMLProps[prop] !== undefined) { 1301 finalHTMLProps[prop] = definedHTMLProps[prop]; 1302 } 1303 } 1304 1305 return finalHTMLProps; 1306 }; 1307 1308 useHook.__useOptions = __useOptions; 1309 var composedKeys = composedHooks.reduce(function (keys, hook) { 1310 keys.push.apply(keys, hook.__keys || []); 1311 return keys; 1312 }, []); // It's used by createComponent to split option props (keys) and html props 1313 1314 useHook.__keys = [].concat(composedKeys, ((_options$useState = options.useState) === null || _options$useState === void 0 ? void 0 : _options$useState.__keys) || [], options.keys || []); 1315 useHook.unstable_propsAreEqual = options.propsAreEqual || ((_composedHooks$ = composedHooks[0]) === null || _composedHooks$ === void 0 ? void 0 : _composedHooks$.unstable_propsAreEqual) || shallowEqual["a" /* shallowEqual */]; 1316 1317 if (false) {} 1318 1319 return useHook; 1320 } 1321 1322 1323 1324 1325 /***/ }), 1326 /* 51 */ 1327 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1328 1329 "use strict"; 1330 1331 // EXPORTS 1332 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ createComponent; }); 1333 1334 // EXTERNAL MODULE: external {"this":"React"} 1335 var external_this_React_ = __webpack_require__(13); 1336 1337 // EXTERNAL MODULE: ./node_modules/reakit-system/es/_rollupPluginBabelHelpers-0c84a174.js 1338 var _rollupPluginBabelHelpers_0c84a174 = __webpack_require__(55); 1339 1340 // EXTERNAL MODULE: ./node_modules/reakit-system/es/useCreateElement.js 1341 var useCreateElement = __webpack_require__(79); 1342 1343 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/splitProps.js 1344 /** 1345 * Splits an object (`props`) into a tuple where the first item is an object 1346 * with the passed `keys`, and the second item is an object with these keys 1347 * omitted. 1348 * 1349 * @example 1350 * import { splitProps } from "reakit-utils"; 1351 * 1352 * splitProps({ a: "a", b: "b" }, ["a"]); // [{ a: "a" }, { b: "b" }] 1353 */ 1354 function splitProps(props, keys) { 1355 var propsKeys = Object.keys(props); 1356 var picked = {}; 1357 var omitted = {}; 1358 1359 for (var _i = 0, _propsKeys = propsKeys; _i < _propsKeys.length; _i++) { 1360 var key = _propsKeys[_i]; 1361 1362 if (keys.indexOf(key) >= 0) { 1363 picked[key] = props[key]; 1364 } else { 1365 omitted[key] = props[key]; 1366 } 1367 } 1368 1369 return [picked, omitted]; 1370 } 1371 1372 1373 1374 // EXTERNAL MODULE: ./node_modules/reakit-utils/es/shallowEqual.js 1375 var shallowEqual = __webpack_require__(56); 1376 1377 // CONCATENATED MODULE: ./node_modules/reakit-system/es/createComponent.js 1378 1379 1380 1381 1382 1383 1384 1385 function forwardRef(component) { 1386 return /*#__PURE__*/Object(external_this_React_["forwardRef"])(component); 1387 } 1388 1389 function memo(component, propsAreEqual) { 1390 return /*#__PURE__*/Object(external_this_React_["memo"])(component, propsAreEqual); 1391 } 1392 1393 /** 1394 * Creates a React component. 1395 * 1396 * @example 1397 * import { createComponent } from "reakit-system"; 1398 * 1399 * const A = createComponent({ as: "a" }); 1400 * 1401 * @param options 1402 */ 1403 function createComponent(_ref) { 1404 var type = _ref.as, 1405 useHook = _ref.useHook, 1406 shouldMemo = _ref.memo, 1407 _ref$propsAreEqual = _ref.propsAreEqual, 1408 propsAreEqual = _ref$propsAreEqual === void 0 ? useHook === null || useHook === void 0 ? void 0 : useHook.unstable_propsAreEqual : _ref$propsAreEqual, 1409 _ref$keys = _ref.keys, 1410 keys = _ref$keys === void 0 ? (useHook === null || useHook === void 0 ? void 0 : useHook.__keys) || [] : _ref$keys, 1411 _ref$useCreateElement = _ref.useCreateElement, 1412 useCreateElement$1 = _ref$useCreateElement === void 0 ? useCreateElement["a" /* useCreateElement */] : _ref$useCreateElement; 1413 1414 var Comp = function Comp(_ref2, ref) { 1415 var _ref2$as = _ref2.as, 1416 as = _ref2$as === void 0 ? type : _ref2$as, 1417 props = Object(_rollupPluginBabelHelpers_0c84a174["b" /* a */])(_ref2, ["as"]); 1418 1419 if (useHook) { 1420 var _as$render; 1421 1422 var _splitProps = splitProps(props, keys), 1423 _options = _splitProps[0], 1424 htmlProps = _splitProps[1]; 1425 1426 var _useHook = useHook(_options, Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])({ 1427 ref: ref 1428 }, htmlProps)), 1429 wrapElement = _useHook.wrapElement, 1430 elementProps = Object(_rollupPluginBabelHelpers_0c84a174["b" /* a */])(_useHook, ["wrapElement"]); // @ts-ignore 1431 1432 1433 var asKeys = ((_as$render = as.render) === null || _as$render === void 0 ? void 0 : _as$render.__keys) || as.__keys; 1434 var asOptions = asKeys && splitProps(props, asKeys)[0]; 1435 var allProps = asOptions ? Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])(Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])({}, elementProps), asOptions) : elementProps; 1436 1437 var _element = useCreateElement$1(as, allProps); 1438 1439 if (wrapElement) { 1440 return wrapElement(_element); 1441 } 1442 1443 return _element; 1444 } 1445 1446 return useCreateElement$1(as, Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])({ 1447 ref: ref 1448 }, props)); 1449 }; 1450 1451 if (false) {} 1452 1453 Comp = forwardRef(Comp); 1454 1455 if (shouldMemo) { 1456 Comp = memo(Comp, propsAreEqual); 1457 } 1458 1459 Comp.__keys = keys; 1460 Comp.unstable_propsAreEqual = propsAreEqual || shallowEqual["a" /* shallowEqual */]; 1461 return Comp; 1462 } 1463 1464 1465 1466 1467 /***/ }), 1468 /* 52 */ 1469 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1470 1471 "use strict"; 1472 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return findFirstEnabledItem; }); 1473 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return flatten; }); 1474 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return groupItems; }); 1475 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return findEnabledItemById; }); 1476 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getCurrentId; }); 1477 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return reverse; }); 1478 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return useCompositeState; }); 1479 /* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); 1480 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(13); 1481 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); 1482 /* harmony import */ var reakit_utils_useIsomorphicEffect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(59); 1483 /* harmony import */ var reakit_utils_useSealedState__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(62); 1484 /* harmony import */ var reakit_utils_applyState__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(61); 1485 /* harmony import */ var _Id_IdState_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65); 1486 1487 1488 1489 1490 1491 1492 1493 function reverse(array) { 1494 return array.slice().reverse(); 1495 } 1496 1497 function isElementPreceding(element1, element2) { 1498 return Boolean(element2.compareDocumentPosition(element1) & Node.DOCUMENT_POSITION_PRECEDING); 1499 } 1500 1501 function findDOMIndex(items, item) { 1502 return items.findIndex(function (currentItem) { 1503 if (!currentItem.ref.current || !item.ref.current) { 1504 return false; 1505 } 1506 1507 return isElementPreceding(item.ref.current, currentItem.ref.current); 1508 }); 1509 } 1510 1511 function findFirstEnabledItem(items, excludeId) { 1512 if (excludeId) { 1513 return items.find(function (item) { 1514 return !item.disabled && item.id !== excludeId; 1515 }); 1516 } 1517 1518 return items.find(function (item) { 1519 return !item.disabled; 1520 }); 1521 } 1522 1523 function findEnabledItemById(items, id) { 1524 if (!id) return undefined; 1525 return items === null || items === void 0 ? void 0 : items.find(function (item) { 1526 return item.id === id && !item.disabled; 1527 }); 1528 } 1529 1530 function groupItems(items) { 1531 var groups = [[]]; 1532 1533 var _loop = function _loop() { 1534 var item = _step.value; 1535 var group = groups.find(function (g) { 1536 return !g[0] || g[0].groupId === item.groupId; 1537 }); 1538 1539 if (group) { 1540 group.push(item); 1541 } else { 1542 groups.push([item]); 1543 } 1544 }; 1545 1546 for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* b */ "c"])(items), _step; !(_step = _iterator()).done;) { 1547 _loop(); 1548 } 1549 1550 return groups; 1551 } 1552 1553 function getMaxLength(rows) { 1554 var maxLength = 0; 1555 1556 for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* b */ "c"])(rows), _step; !(_step = _iterator()).done;) { 1557 var length = _step.value.length; 1558 1559 if (length > maxLength) { 1560 maxLength = length; 1561 } 1562 } 1563 1564 return maxLength; 1565 } 1566 1567 /** 1568 * Turns [row1, row1, row2, row2] into [row1, row2, row1, row2] 1569 */ 1570 1571 function verticalizeItems(items) { 1572 var groups = groupItems(items); 1573 var maxLength = getMaxLength(groups); 1574 var verticalized = []; 1575 1576 for (var i = 0; i < maxLength; i += 1) { 1577 for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* b */ "c"])(groups), _step; !(_step = _iterator()).done;) { 1578 var group = _step.value; 1579 1580 if (group[i]) { 1581 verticalized.push(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, group[i]), {}, { 1582 // If there's no groupId, it means that it's not a grid composite, 1583 // but a single row instead. So, instead of verticalizing it, that 1584 // is, assigning a different groupId based on the column index, we 1585 // keep it undefined so they will be part of the same group. 1586 // It's useful when using up/down on one-dimensional composites. 1587 groupId: group[i].groupId ? "" + i : undefined 1588 })); 1589 } 1590 } 1591 } 1592 1593 return verticalized; 1594 } 1595 1596 function flatten(grid) { 1597 var flattened = []; 1598 1599 for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* b */ "c"])(grid), _step; !(_step = _iterator()).done;) { 1600 var row = _step.value; 1601 flattened.push.apply(flattened, row); 1602 } 1603 1604 return flattened; 1605 } 1606 1607 /** 1608 * Turns [[row1, row1], [row2]] into [[row1, row1], [row2, row2]] 1609 */ 1610 1611 function fillGroups(groups) { 1612 var maxLength = getMaxLength(groups); 1613 1614 for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* b */ "c"])(groups), _step; !(_step = _iterator()).done;) { 1615 var group = _step.value; 1616 1617 if (group.length < maxLength) { 1618 for (var i = 0; i < maxLength; i += 1) { 1619 if (!group[i]) { 1620 group[i] = { 1621 id: "__EMPTY_ITEM__", 1622 disabled: true, 1623 ref: { 1624 current: null 1625 }, 1626 groupId: group[i - 1].groupId 1627 }; 1628 } 1629 } 1630 } 1631 } 1632 1633 return groups; 1634 } 1635 1636 function getCurrentId(options, passedId) { 1637 var _findFirstEnabledItem; 1638 1639 if (passedId || passedId === null) { 1640 return passedId; 1641 } 1642 1643 if (options.currentId || options.currentId === null) { 1644 return options.currentId; 1645 } 1646 1647 return (_findFirstEnabledItem = findFirstEnabledItem(options.items || [])) === null || _findFirstEnabledItem === void 0 ? void 0 : _findFirstEnabledItem.id; 1648 } 1649 1650 var nullItem = { 1651 id: null, 1652 ref: { 1653 current: null 1654 } 1655 }; 1656 function placeItemsAfter(items, id, shouldInsertNullItem) { 1657 var index = items.findIndex(function (item) { 1658 return item.id === id; 1659 }); 1660 return [].concat(items.slice(index + 1), shouldInsertNullItem ? [nullItem] : [], items.slice(0, index)); 1661 } 1662 1663 function getItemsInGroup(items, groupId) { 1664 return items.filter(function (item) { 1665 return item.groupId === groupId; 1666 }); 1667 } 1668 1669 var map = { 1670 horizontal: "vertical", 1671 vertical: "horizontal" 1672 }; 1673 function getOppositeOrientation(orientation) { 1674 return orientation && map[orientation]; 1675 } 1676 1677 function addItemAtIndex(array, item, index) { 1678 if (!(index in array)) { 1679 return [].concat(array, [item]); 1680 } 1681 1682 return [].concat(array.slice(0, index), [item], array.slice(index)); 1683 } 1684 1685 function sortBasedOnDOMPosition(items) { 1686 var copy = items.slice(); 1687 var isOrderDifferent = false; 1688 copy.sort(function (a, b) { 1689 var elementA = a.ref.current; 1690 var elementB = b.ref.current; 1691 1692 if (elementA && elementB && isElementPreceding(elementA, elementB)) { 1693 isOrderDifferent = true; 1694 return -1; 1695 } 1696 1697 return 0; 1698 }); 1699 1700 if (isOrderDifferent) { 1701 return copy; 1702 } 1703 1704 return items; 1705 } 1706 1707 function reducer(state, action) { 1708 var virtual = state.unstable_virtual, 1709 rtl = state.rtl, 1710 orientation = state.orientation, 1711 items = state.items, 1712 groups = state.groups, 1713 currentId = state.currentId, 1714 loop = state.loop, 1715 wrap = state.wrap, 1716 pastIds = state.pastIds, 1717 moves = state.unstable_moves, 1718 initialVirtual = state.initialVirtual, 1719 initialRTL = state.initialRTL, 1720 initialOrientation = state.initialOrientation, 1721 initialCurrentId = state.initialCurrentId, 1722 initialLoop = state.initialLoop, 1723 initialWrap = state.initialWrap, 1724 hasSetCurrentId = state.hasSetCurrentId; 1725 1726 switch (action.type) { 1727 case "registerGroup": 1728 { 1729 var _group = action.group; // If there are no groups yet, just add it as the first one 1730 1731 if (groups.length === 0) { 1732 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 1733 groups: [_group] 1734 }); 1735 } // Finds the group index based on DOM position 1736 1737 1738 var index = findDOMIndex(groups, _group); 1739 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 1740 groups: addItemAtIndex(groups, _group, index) 1741 }); 1742 } 1743 1744 case "unregisterGroup": 1745 { 1746 var _id = action.id; 1747 var nextGroups = groups.filter(function (group) { 1748 return group.id !== _id; 1749 }); // The group isn't registered, so do nothing 1750 1751 if (nextGroups.length === groups.length) { 1752 return state; 1753 } 1754 1755 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 1756 groups: nextGroups 1757 }); 1758 } 1759 1760 case "registerItem": 1761 { 1762 var _item = action.item; // Finds the item group based on the DOM hierarchy 1763 1764 var _group2 = groups.find(function (r) { 1765 var _r$ref$current; 1766 1767 return (_r$ref$current = r.ref.current) === null || _r$ref$current === void 0 ? void 0 : _r$ref$current.contains(_item.ref.current); 1768 }); // Group will be null if it's a one-dimensional composite 1769 1770 1771 var nextItem = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({ 1772 groupId: _group2 === null || _group2 === void 0 ? void 0 : _group2.id 1773 }, _item); 1774 1775 var _index = findDOMIndex(items, nextItem); 1776 1777 var nextState = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 1778 items: addItemAtIndex(items, nextItem, _index) 1779 }); 1780 1781 if (!hasSetCurrentId && !moves && initialCurrentId === undefined) { 1782 var _findFirstEnabledItem; 1783 1784 // Sets currentId to the first enabled item. This runs whenever an item 1785 // is registered because the first enabled item may be registered 1786 // asynchronously. 1787 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, nextState), {}, { 1788 currentId: (_findFirstEnabledItem = findFirstEnabledItem(nextState.items)) === null || _findFirstEnabledItem === void 0 ? void 0 : _findFirstEnabledItem.id 1789 }); 1790 } 1791 1792 return nextState; 1793 } 1794 1795 case "unregisterItem": 1796 { 1797 var _id2 = action.id; 1798 var nextItems = items.filter(function (item) { 1799 return item.id !== _id2; 1800 }); // The item isn't registered, so do nothing 1801 1802 if (nextItems.length === items.length) { 1803 return state; 1804 } // Filters out the item that is being removed from the pastIds list 1805 1806 1807 var nextPastIds = pastIds.filter(function (pastId) { 1808 return pastId !== _id2; 1809 }); 1810 1811 var _nextState = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 1812 pastIds: nextPastIds, 1813 items: nextItems 1814 }); // If the current item is the item that is being removed, focus pastId 1815 1816 1817 if (currentId && currentId === _id2) { 1818 var nextId = getCurrentId(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, _nextState), {}, { 1819 currentId: nextPastIds[0] 1820 })); 1821 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, _nextState), {}, { 1822 currentId: nextId 1823 }); 1824 } 1825 1826 return _nextState; 1827 } 1828 1829 case "move": 1830 { 1831 var _id3 = action.id; // move() does nothing 1832 1833 if (_id3 === undefined) { 1834 return state; 1835 } // Removes the current item and the item that is receiving focus from the 1836 // pastIds list 1837 1838 1839 var filteredPastIds = pastIds.filter(function (pastId) { 1840 return pastId !== currentId && pastId !== _id3; 1841 }); // If there's a currentId, add it to the pastIds list so it can be focused 1842 // if the new item gets removed or disabled 1843 1844 var _nextPastIds = currentId ? [currentId].concat(filteredPastIds) : filteredPastIds; 1845 1846 var _nextState2 = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 1847 pastIds: _nextPastIds 1848 }); // move(null) will focus the composite element itself, not an item 1849 1850 1851 if (_id3 === null) { 1852 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, _nextState2), {}, { 1853 unstable_moves: moves + 1, 1854 currentId: getCurrentId(_nextState2, _id3) 1855 }); 1856 } 1857 1858 var _item2 = findEnabledItemById(items, _id3); 1859 1860 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, _nextState2), {}, { 1861 unstable_moves: _item2 ? moves + 1 : moves, 1862 currentId: getCurrentId(_nextState2, _item2 === null || _item2 === void 0 ? void 0 : _item2.id) 1863 }); 1864 } 1865 1866 case "next": 1867 { 1868 // If there's no item focused, we just move the first one 1869 if (currentId == null) { 1870 return reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 1871 type: "first" 1872 })); 1873 } // RTL doesn't make sense on vertical navigation 1874 1875 1876 var isHorizontal = orientation !== "vertical"; 1877 var isRTL = rtl && isHorizontal; 1878 var allItems = isRTL ? reverse(items) : items; 1879 var currentItem = allItems.find(function (item) { 1880 return item.id === currentId; 1881 }); // If there's no item focused, we just move the first one 1882 1883 if (!currentItem) { 1884 return reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 1885 type: "first" 1886 })); 1887 } 1888 1889 var isGrid = !!currentItem.groupId; 1890 var currentIndex = allItems.indexOf(currentItem); 1891 1892 var _nextItems = allItems.slice(currentIndex + 1); 1893 1894 var nextItemsInGroup = getItemsInGroup(_nextItems, currentItem.groupId); // Home, End 1895 1896 if (action.allTheWay) { 1897 // We reverse so we can get the last enabled item in the group. If it's 1898 // RTL, nextItems and nextItemsInGroup are already reversed and don't 1899 // have the items before the current one anymore. So we have to get 1900 // items in group again with allItems. 1901 var _nextItem2 = findFirstEnabledItem(isRTL ? getItemsInGroup(allItems, currentItem.groupId) : reverse(nextItemsInGroup)); 1902 1903 return reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 1904 type: "move", 1905 id: _nextItem2 === null || _nextItem2 === void 0 ? void 0 : _nextItem2.id 1906 })); 1907 } 1908 1909 var oppositeOrientation = getOppositeOrientation( // If it's a grid and orientation is not set, it's a next/previous 1910 // call, which is inherently horizontal. up/down will call next with 1911 // orientation set to vertical by default (see below on up/down cases). 1912 isGrid ? orientation || "horizontal" : orientation); 1913 var canLoop = loop && loop !== oppositeOrientation; 1914 var canWrap = isGrid && wrap && wrap !== oppositeOrientation; 1915 var hasNullItem = // `previous` and `up` will set action.hasNullItem, but when calling 1916 // next directly, hasNullItem will only be true if it's not a grid and 1917 // loop is set to true, which means that pressing right or down keys on 1918 // grids will never focus the composite element. On one-dimensional 1919 // composites that don't loop, pressing right or down keys also doesn't 1920 // focus the composite element. 1921 action.hasNullItem || !isGrid && canLoop && initialCurrentId === null; 1922 1923 if (canLoop) { 1924 var loopItems = canWrap && !hasNullItem ? allItems : getItemsInGroup(allItems, currentItem.groupId); // Turns [0, 1, current, 3, 4] into [3, 4, 0, 1] 1925 1926 var sortedItems = placeItemsAfter(loopItems, currentId, hasNullItem); 1927 1928 var _nextItem3 = findFirstEnabledItem(sortedItems, currentId); 1929 1930 return reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 1931 type: "move", 1932 id: _nextItem3 === null || _nextItem3 === void 0 ? void 0 : _nextItem3.id 1933 })); 1934 } 1935 1936 if (canWrap) { 1937 var _nextItem4 = findFirstEnabledItem( // We can use nextItems, which contains all the next items, including 1938 // items from other groups, to wrap between groups. However, if there 1939 // is a null item (the composite element), we'll only use the next 1940 // items in the group. So moving next from the last item will focus 1941 // the composite element (null). On grid composites, horizontal 1942 // navigation never focuses the composite element, only vertical. 1943 hasNullItem ? nextItemsInGroup : _nextItems, currentId); 1944 1945 var _nextId = hasNullItem ? (_nextItem4 === null || _nextItem4 === void 0 ? void 0 : _nextItem4.id) || null : _nextItem4 === null || _nextItem4 === void 0 ? void 0 : _nextItem4.id; 1946 1947 return reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 1948 type: "move", 1949 id: _nextId 1950 })); 1951 } 1952 1953 var _nextItem = findFirstEnabledItem(nextItemsInGroup, currentId); 1954 1955 if (!_nextItem && hasNullItem) { 1956 return reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 1957 type: "move", 1958 id: null 1959 })); 1960 } 1961 1962 return reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 1963 type: "move", 1964 id: _nextItem === null || _nextItem === void 0 ? void 0 : _nextItem.id 1965 })); 1966 } 1967 1968 case "previous": 1969 { 1970 // If currentId is initially set to null, the composite element will be 1971 // focusable while navigating with arrow keys. But, if it's a grid, we 1972 // don't want to focus the composite element with horizontal navigation. 1973 var _isGrid = !!groups.length; 1974 1975 var _hasNullItem = !_isGrid && initialCurrentId === null; 1976 1977 var _nextState3 = reducer(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 1978 items: reverse(items) 1979 }), Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 1980 type: "next", 1981 hasNullItem: _hasNullItem 1982 })); 1983 1984 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, _nextState3), {}, { 1985 items: items 1986 }); 1987 } 1988 1989 case "down": 1990 { 1991 // First, we make sure groups have the same number of items by filling it 1992 // with disabled fake items. Then, we reorganize the items list so 1993 // [1-1, 1-2, 2-1, 2-2] becomes [1-1, 2-1, 1-2, 2-2]. 1994 var verticalItems = verticalizeItems(flatten(fillGroups(groupItems(items)))); 1995 1996 var _canLoop = loop && loop !== "horizontal"; // Pressing down arrow key will only focus the composite element if loop 1997 // is true or vertical. 1998 1999 2000 var _hasNullItem2 = _canLoop && initialCurrentId === null; 2001 2002 var _nextState4 = reducer(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2003 orientation: "vertical", 2004 items: verticalItems 2005 }), Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 2006 type: "next", 2007 hasNullItem: _hasNullItem2 2008 })); 2009 2010 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, _nextState4), {}, { 2011 orientation: orientation, 2012 items: items 2013 }); 2014 } 2015 2016 case "up": 2017 { 2018 var _verticalItems = verticalizeItems(reverse(flatten(fillGroups(groupItems(items))))); // If currentId is initially set to null, we'll always focus the 2019 // composite element when the up arrow key is pressed in the first row. 2020 2021 2022 var _hasNullItem3 = initialCurrentId === null; 2023 2024 var _nextState5 = reducer(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2025 orientation: "vertical", 2026 items: _verticalItems 2027 }), Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 2028 type: "next", 2029 hasNullItem: _hasNullItem3 2030 })); 2031 2032 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, _nextState5), {}, { 2033 orientation: orientation, 2034 items: items 2035 }); 2036 } 2037 2038 case "first": 2039 { 2040 var firstItem = findFirstEnabledItem(items); 2041 return reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 2042 type: "move", 2043 id: firstItem === null || firstItem === void 0 ? void 0 : firstItem.id 2044 })); 2045 } 2046 2047 case "last": 2048 { 2049 var _nextState6 = reducer(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2050 items: reverse(items) 2051 }), Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 2052 type: "first" 2053 })); 2054 2055 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, _nextState6), {}, { 2056 items: items 2057 }); 2058 } 2059 2060 case "sort": 2061 { 2062 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2063 items: sortBasedOnDOMPosition(items), 2064 groups: sortBasedOnDOMPosition(groups) 2065 }); 2066 } 2067 2068 case "setVirtual": 2069 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2070 unstable_virtual: Object(reakit_utils_applyState__WEBPACK_IMPORTED_MODULE_4__[/* applyState */ "a"])(action.virtual, virtual) 2071 }); 2072 2073 case "setRTL": 2074 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2075 rtl: Object(reakit_utils_applyState__WEBPACK_IMPORTED_MODULE_4__[/* applyState */ "a"])(action.rtl, rtl) 2076 }); 2077 2078 case "setOrientation": 2079 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2080 orientation: Object(reakit_utils_applyState__WEBPACK_IMPORTED_MODULE_4__[/* applyState */ "a"])(action.orientation, orientation) 2081 }); 2082 2083 case "setCurrentId": 2084 { 2085 var nextCurrentId = getCurrentId(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2086 currentId: Object(reakit_utils_applyState__WEBPACK_IMPORTED_MODULE_4__[/* applyState */ "a"])(action.currentId, currentId) 2087 })); 2088 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2089 currentId: nextCurrentId, 2090 hasSetCurrentId: true 2091 }); 2092 } 2093 2094 case "setLoop": 2095 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2096 loop: Object(reakit_utils_applyState__WEBPACK_IMPORTED_MODULE_4__[/* applyState */ "a"])(action.loop, loop) 2097 }); 2098 2099 case "setWrap": 2100 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2101 wrap: Object(reakit_utils_applyState__WEBPACK_IMPORTED_MODULE_4__[/* applyState */ "a"])(action.wrap, wrap) 2102 }); 2103 2104 case "reset": 2105 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2106 unstable_virtual: initialVirtual, 2107 rtl: initialRTL, 2108 orientation: initialOrientation, 2109 currentId: getCurrentId(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2110 currentId: initialCurrentId 2111 })), 2112 loop: initialLoop, 2113 wrap: initialWrap, 2114 unstable_moves: 0, 2115 pastIds: [] 2116 }); 2117 2118 default: 2119 throw new Error(); 2120 } 2121 } 2122 2123 function useAction(fn) { 2124 return Object(react__WEBPACK_IMPORTED_MODULE_1__["useCallback"])(fn, []); 2125 } 2126 2127 function useIsUnmountedRef() { 2128 var isUnmountedRef = Object(react__WEBPACK_IMPORTED_MODULE_1__["useRef"])(false); 2129 Object(reakit_utils_useIsomorphicEffect__WEBPACK_IMPORTED_MODULE_2__[/* useIsomorphicEffect */ "a"])(function () { 2130 return function () { 2131 isUnmountedRef.current = true; 2132 }; 2133 }, []); 2134 return isUnmountedRef; 2135 } 2136 2137 function useCompositeState(initialState) { 2138 if (initialState === void 0) { 2139 initialState = {}; 2140 } 2141 2142 var _useSealedState = Object(reakit_utils_useSealedState__WEBPACK_IMPORTED_MODULE_3__[/* useSealedState */ "a"])(initialState), 2143 _useSealedState$unsta = _useSealedState.unstable_virtual, 2144 virtual = _useSealedState$unsta === void 0 ? false : _useSealedState$unsta, 2145 _useSealedState$rtl = _useSealedState.rtl, 2146 rtl = _useSealedState$rtl === void 0 ? false : _useSealedState$rtl, 2147 orientation = _useSealedState.orientation, 2148 currentId = _useSealedState.currentId, 2149 _useSealedState$loop = _useSealedState.loop, 2150 loop = _useSealedState$loop === void 0 ? false : _useSealedState$loop, 2151 _useSealedState$wrap = _useSealedState.wrap, 2152 wrap = _useSealedState$wrap === void 0 ? false : _useSealedState$wrap, 2153 sealed = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_useSealedState, ["unstable_virtual", "rtl", "orientation", "currentId", "loop", "wrap"]); 2154 2155 var _React$useReducer = Object(react__WEBPACK_IMPORTED_MODULE_1__["useReducer"])(reducer, { 2156 unstable_virtual: virtual, 2157 rtl: rtl, 2158 orientation: orientation, 2159 items: [], 2160 groups: [], 2161 currentId: currentId, 2162 loop: loop, 2163 wrap: wrap, 2164 unstable_moves: 0, 2165 pastIds: [], 2166 initialVirtual: virtual, 2167 initialRTL: rtl, 2168 initialOrientation: orientation, 2169 initialCurrentId: currentId, 2170 initialLoop: loop, 2171 initialWrap: wrap 2172 }), 2173 _React$useReducer$ = _React$useReducer[0], 2174 pastIds = _React$useReducer$.pastIds, 2175 initialVirtual = _React$useReducer$.initialVirtual, 2176 initialRTL = _React$useReducer$.initialRTL, 2177 initialOrientation = _React$useReducer$.initialOrientation, 2178 initialCurrentId = _React$useReducer$.initialCurrentId, 2179 initialLoop = _React$useReducer$.initialLoop, 2180 initialWrap = _React$useReducer$.initialWrap, 2181 hasSetCurrentId = _React$useReducer$.hasSetCurrentId, 2182 state = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_React$useReducer$, ["pastIds", "initialVirtual", "initialRTL", "initialOrientation", "initialCurrentId", "initialLoop", "initialWrap", "hasSetCurrentId"]), 2183 dispatch = _React$useReducer[1]; 2184 2185 var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_1__["useState"])(false), 2186 hasActiveWidget = _React$useState[0], 2187 setHasActiveWidget = _React$useState[1]; 2188 2189 var idState = Object(_Id_IdState_js__WEBPACK_IMPORTED_MODULE_5__[/* unstable_useIdState */ "a"])(sealed); // register/unregister may be called when this component is unmounted. We 2190 // store the unmounted state here so we don't update the state if it's true. 2191 // This only happens in a very specific situation. 2192 // See https://github.com/reakit/reakit/issues/650 2193 2194 var isUnmountedRef = useIsUnmountedRef(); 2195 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, idState), state), {}, { 2196 unstable_hasActiveWidget: hasActiveWidget, 2197 unstable_setHasActiveWidget: setHasActiveWidget, 2198 registerItem: useAction(function (item) { 2199 if (isUnmountedRef.current) return; 2200 dispatch({ 2201 type: "registerItem", 2202 item: item 2203 }); 2204 }), 2205 unregisterItem: useAction(function (id) { 2206 if (isUnmountedRef.current) return; 2207 dispatch({ 2208 type: "unregisterItem", 2209 id: id 2210 }); 2211 }), 2212 registerGroup: useAction(function (group) { 2213 if (isUnmountedRef.current) return; 2214 dispatch({ 2215 type: "registerGroup", 2216 group: group 2217 }); 2218 }), 2219 unregisterGroup: useAction(function (id) { 2220 if (isUnmountedRef.current) return; 2221 dispatch({ 2222 type: "unregisterGroup", 2223 id: id 2224 }); 2225 }), 2226 move: useAction(function (id) { 2227 return dispatch({ 2228 type: "move", 2229 id: id 2230 }); 2231 }), 2232 next: useAction(function (allTheWay) { 2233 return dispatch({ 2234 type: "next", 2235 allTheWay: allTheWay 2236 }); 2237 }), 2238 previous: useAction(function (allTheWay) { 2239 return dispatch({ 2240 type: "previous", 2241 allTheWay: allTheWay 2242 }); 2243 }), 2244 up: useAction(function (allTheWay) { 2245 return dispatch({ 2246 type: "up", 2247 allTheWay: allTheWay 2248 }); 2249 }), 2250 down: useAction(function (allTheWay) { 2251 return dispatch({ 2252 type: "down", 2253 allTheWay: allTheWay 2254 }); 2255 }), 2256 first: useAction(function () { 2257 return dispatch({ 2258 type: "first" 2259 }); 2260 }), 2261 last: useAction(function () { 2262 return dispatch({ 2263 type: "last" 2264 }); 2265 }), 2266 unstable_sort: useAction(function () { 2267 return dispatch({ 2268 type: "sort" 2269 }); 2270 }), 2271 unstable_setVirtual: useAction(function (value) { 2272 return dispatch({ 2273 type: "setVirtual", 2274 virtual: value 2275 }); 2276 }), 2277 setRTL: useAction(function (value) { 2278 return dispatch({ 2279 type: "setRTL", 2280 rtl: value 2281 }); 2282 }), 2283 setOrientation: useAction(function (value) { 2284 return dispatch({ 2285 type: "setOrientation", 2286 orientation: value 2287 }); 2288 }), 2289 setCurrentId: useAction(function (value) { 2290 return dispatch({ 2291 type: "setCurrentId", 2292 currentId: value 2293 }); 2294 }), 2295 setLoop: useAction(function (value) { 2296 return dispatch({ 2297 type: "setLoop", 2298 loop: value 2299 }); 2300 }), 2301 setWrap: useAction(function (value) { 2302 return dispatch({ 2303 type: "setWrap", 2304 wrap: value 2305 }); 2306 }), 2307 reset: useAction(function () { 2308 return dispatch({ 2309 type: "reset" 2310 }); 2311 }) 2312 }); 2313 } 2314 var keys = [].concat(_Id_IdState_js__WEBPACK_IMPORTED_MODULE_5__[/* unstable_useIdState */ "a"].__keys, ["unstable_virtual", "rtl", "orientation", "items", "groups", "currentId", "loop", "wrap", "unstable_moves", "unstable_hasActiveWidget", "registerItem", "unregisterItem", "registerGroup", "unregisterGroup", "move", "next", "previous", "up", "down", "first", "last", "unstable_sort", "unstable_setVirtual", "setRTL", "setOrientation", "setCurrentId", "setLoop", "setWrap", "reset", "unstable_setHasActiveWidget"]); 2315 useCompositeState.__keys = keys; 2316 2317 2318 2319 2320 /***/ }), 2321 /* 53 */, 2322 /* 54 */ 2323 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2324 2325 "use strict"; 2326 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isSelfTarget; }); 2327 /** 2328 * Returns `true` if `event.target` and `event.currentTarget` are the same. 2329 */ 2330 function isSelfTarget(event) { 2331 return event.target === event.currentTarget; 2332 } 2333 2334 2335 2336 2337 /***/ }), 2338 /* 55 */ 2339 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2340 2341 "use strict"; 2342 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread2; }); 2343 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _objectWithoutPropertiesLoose; }); 2344 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return _createForOfIteratorHelperLoose; }); 2345 function _defineProperty(obj, key, value) { 2346 if (key in obj) { 2347 Object.defineProperty(obj, key, { 2348 value: value, 2349 enumerable: true, 2350 configurable: true, 2351 writable: true 2352 }); 2353 } else { 2354 obj[key] = value; 2355 } 2356 2357 return obj; 2358 } 2359 2360 function ownKeys(object, enumerableOnly) { 2361 var keys = Object.keys(object); 2362 2363 if (Object.getOwnPropertySymbols) { 2364 var symbols = Object.getOwnPropertySymbols(object); 2365 if (enumerableOnly) symbols = symbols.filter(function (sym) { 2366 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 2367 }); 2368 keys.push.apply(keys, symbols); 2369 } 2370 2371 return keys; 2372 } 2373 2374 function _objectSpread2(target) { 2375 for (var i = 1; i < arguments.length; i++) { 2376 var source = arguments[i] != null ? arguments[i] : {}; 2377 2378 if (i % 2) { 2379 ownKeys(Object(source), true).forEach(function (key) { 2380 _defineProperty(target, key, source[key]); 2381 }); 2382 } else if (Object.getOwnPropertyDescriptors) { 2383 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 2384 } else { 2385 ownKeys(Object(source)).forEach(function (key) { 2386 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 2387 }); 2388 } 2389 } 2390 2391 return target; 2392 } 2393 2394 function _objectWithoutPropertiesLoose(source, excluded) { 2395 if (source == null) return {}; 2396 var target = {}; 2397 var sourceKeys = Object.keys(source); 2398 var key, i; 2399 2400 for (i = 0; i < sourceKeys.length; i++) { 2401 key = sourceKeys[i]; 2402 if (excluded.indexOf(key) >= 0) continue; 2403 target[key] = source[key]; 2404 } 2405 2406 return target; 2407 } 2408 2409 function _unsupportedIterableToArray(o, minLen) { 2410 if (!o) return; 2411 if (typeof o === "string") return _arrayLikeToArray(o, minLen); 2412 var n = Object.prototype.toString.call(o).slice(8, -1); 2413 if (n === "Object" && o.constructor) n = o.constructor.name; 2414 if (n === "Map" || n === "Set") return Array.from(o); 2415 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); 2416 } 2417 2418 function _arrayLikeToArray(arr, len) { 2419 if (len == null || len > arr.length) len = arr.length; 2420 2421 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; 2422 2423 return arr2; 2424 } 2425 2426 function _createForOfIteratorHelperLoose(o, allowArrayLike) { 2427 var it; 2428 2429 if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { 2430 if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { 2431 if (it) o = it; 2432 var i = 0; 2433 return function () { 2434 if (i >= o.length) return { 2435 done: true 2436 }; 2437 return { 2438 done: false, 2439 value: o[i++] 2440 }; 2441 }; 2442 } 2443 2444 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 2445 } 2446 2447 it = o[Symbol.iterator](); 2448 return it.next.bind(it); 2449 } 2450 2451 2452 2453 2454 /***/ }), 2455 /* 56 */ 2456 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2457 2458 "use strict"; 2459 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return shallowEqual; }); 2460 /** 2461 * Compares two objects. 2462 * 2463 * @example 2464 * import { shallowEqual } from "reakit-utils"; 2465 * 2466 * shallowEqual({ a: "a" }, {}); // false 2467 * shallowEqual({ a: "a" }, { b: "b" }); // false 2468 * shallowEqual({ a: "a" }, { a: "a" }); // true 2469 * shallowEqual({ a: "a" }, { a: "a", b: "b" }); // false 2470 */ 2471 function shallowEqual(objA, objB) { 2472 if (objA === objB) return true; 2473 if (!objA) return false; 2474 if (!objB) return false; 2475 if (typeof objA !== "object") return false; 2476 if (typeof objB !== "object") return false; 2477 var aKeys = Object.keys(objA); 2478 var bKeys = Object.keys(objB); 2479 var length = aKeys.length; 2480 if (bKeys.length !== length) return false; 2481 2482 for (var _i = 0, _aKeys = aKeys; _i < _aKeys.length; _i++) { 2483 var key = _aKeys[_i]; 2484 2485 if (objA[key] !== objB[key]) { 2486 return false; 2487 } 2488 } 2489 2490 return true; 2491 } 2492 2493 2494 2495 2496 /***/ }), 2497 /* 57 */ 2498 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2499 2500 "use strict"; 2501 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getActiveElement; }); 2502 /* harmony import */ var _getDocument_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(49); 2503 2504 2505 /** 2506 * Returns `element.ownerDocument.activeElement`. 2507 */ 2508 2509 function getActiveElement(element) { 2510 return Object(_getDocument_js__WEBPACK_IMPORTED_MODULE_0__[/* getDocument */ "a"])(element).activeElement; 2511 } 2512 2513 2514 2515 2516 /***/ }), 2517 /* 58 */ 2518 /***/ (function(module, exports, __webpack_require__) { 2519 2520 "use strict"; 2521 2522 2523 /* globals 2524 Atomics, 2525 SharedArrayBuffer, 2526 */ 2527 2528 var undefined; 2529 2530 var $TypeError = TypeError; 2531 2532 var $gOPD = Object.getOwnPropertyDescriptor; 2533 if ($gOPD) { 2534 try { 2535 $gOPD({}, ''); 2536 } catch (e) { 2537 $gOPD = null; // this is IE 8, which has a broken gOPD 2538 } 2539 } 2540 2541 var throwTypeError = function () { throw new $TypeError(); }; 2542 var ThrowTypeError = $gOPD 2543 ? (function () { 2544 try { 2545 // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties 2546 arguments.callee; // IE 8 does not throw here 2547 return throwTypeError; 2548 } catch (calleeThrows) { 2549 try { 2550 // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') 2551 return $gOPD(arguments, 'callee').get; 2552 } catch (gOPDthrows) { 2553 return throwTypeError; 2554 } 2555 } 2556 }()) 2557 : throwTypeError; 2558 2559 var hasSymbols = __webpack_require__(220)(); 2560 2561 var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto 2562 2563 var generator; // = function * () {}; 2564 var generatorFunction = generator ? getProto(generator) : undefined; 2565 var asyncFn; // async function() {}; 2566 var asyncFunction = asyncFn ? asyncFn.constructor : undefined; 2567 var asyncGen; // async function * () {}; 2568 var asyncGenFunction = asyncGen ? getProto(asyncGen) : undefined; 2569 var asyncGenIterator = asyncGen ? asyncGen() : undefined; 2570 2571 var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array); 2572 2573 var INTRINSICS = { 2574 '%Array%': Array, 2575 '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, 2576 '%ArrayBufferPrototype%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer.prototype, 2577 '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined, 2578 '%ArrayPrototype%': Array.prototype, 2579 '%ArrayProto_entries%': Array.prototype.entries, 2580 '%ArrayProto_forEach%': Array.prototype.forEach, 2581 '%ArrayProto_keys%': Array.prototype.keys, 2582 '%ArrayProto_values%': Array.prototype.values, 2583 '%AsyncFromSyncIteratorPrototype%': undefined, 2584 '%AsyncFunction%': asyncFunction, 2585 '%AsyncFunctionPrototype%': asyncFunction ? asyncFunction.prototype : undefined, 2586 '%AsyncGenerator%': asyncGen ? getProto(asyncGenIterator) : undefined, 2587 '%AsyncGeneratorFunction%': asyncGenFunction, 2588 '%AsyncGeneratorPrototype%': asyncGenFunction ? asyncGenFunction.prototype : undefined, 2589 '%AsyncIteratorPrototype%': asyncGenIterator && hasSymbols && Symbol.asyncIterator ? asyncGenIterator[Symbol.asyncIterator]() : undefined, 2590 '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, 2591 '%Boolean%': Boolean, 2592 '%BooleanPrototype%': Boolean.prototype, 2593 '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, 2594 '%DataViewPrototype%': typeof DataView === 'undefined' ? undefined : DataView.prototype, 2595 '%Date%': Date, 2596 '%DatePrototype%': Date.prototype, 2597 '%decodeURI%': decodeURI, 2598 '%decodeURIComponent%': decodeURIComponent, 2599 '%encodeURI%': encodeURI, 2600 '%encodeURIComponent%': encodeURIComponent, 2601 '%Error%': Error, 2602 '%ErrorPrototype%': Error.prototype, 2603 '%eval%': eval, // eslint-disable-line no-eval 2604 '%EvalError%': EvalError, 2605 '%EvalErrorPrototype%': EvalError.prototype, 2606 '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, 2607 '%Float32ArrayPrototype%': typeof Float32Array === 'undefined' ? undefined : Float32Array.prototype, 2608 '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, 2609 '%Float64ArrayPrototype%': typeof Float64Array === 'undefined' ? undefined : Float64Array.prototype, 2610 '%Function%': Function, 2611 '%FunctionPrototype%': Function.prototype, 2612 '%Generator%': generator ? getProto(generator()) : undefined, 2613 '%GeneratorFunction%': generatorFunction, 2614 '%GeneratorPrototype%': generatorFunction ? generatorFunction.prototype : undefined, 2615 '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array, 2616 '%Int8ArrayPrototype%': typeof Int8Array === 'undefined' ? undefined : Int8Array.prototype, 2617 '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array, 2618 '%Int16ArrayPrototype%': typeof Int16Array === 'undefined' ? undefined : Int8Array.prototype, 2619 '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, 2620 '%Int32ArrayPrototype%': typeof Int32Array === 'undefined' ? undefined : Int32Array.prototype, 2621 '%isFinite%': isFinite, 2622 '%isNaN%': isNaN, 2623 '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined, 2624 '%JSON%': typeof JSON === 'object' ? JSON : undefined, 2625 '%JSONParse%': typeof JSON === 'object' ? JSON.parse : undefined, 2626 '%Map%': typeof Map === 'undefined' ? undefined : Map, 2627 '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()), 2628 '%MapPrototype%': typeof Map === 'undefined' ? undefined : Map.prototype, 2629 '%Math%': Math, 2630 '%Number%': Number, 2631 '%NumberPrototype%': Number.prototype, 2632 '%Object%': Object, 2633 '%ObjectPrototype%': Object.prototype, 2634 '%ObjProto_toString%': Object.prototype.toString, 2635 '%ObjProto_valueOf%': Object.prototype.valueOf, 2636 '%parseFloat%': parseFloat, 2637 '%parseInt%': parseInt, 2638 '%Promise%': typeof Promise === 'undefined' ? undefined : Promise, 2639 '%PromisePrototype%': typeof Promise === 'undefined' ? undefined : Promise.prototype, 2640 '%PromiseProto_then%': typeof Promise === 'undefined' ? undefined : Promise.prototype.then, 2641 '%Promise_all%': typeof Promise === 'undefined' ? undefined : Promise.all, 2642 '%Promise_reject%': typeof Promise === 'undefined' ? undefined : Promise.reject, 2643 '%Promise_resolve%': typeof Promise === 'undefined' ? undefined : Promise.resolve, 2644 '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, 2645 '%RangeError%': RangeError, 2646 '%RangeErrorPrototype%': RangeError.prototype, 2647 '%ReferenceError%': ReferenceError, 2648 '%ReferenceErrorPrototype%': ReferenceError.prototype, 2649 '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, 2650 '%RegExp%': RegExp, 2651 '%RegExpPrototype%': RegExp.prototype, 2652 '%Set%': typeof Set === 'undefined' ? undefined : Set, 2653 '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()), 2654 '%SetPrototype%': typeof Set === 'undefined' ? undefined : Set.prototype, 2655 '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, 2656 '%SharedArrayBufferPrototype%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer.prototype, 2657 '%String%': String, 2658 '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined, 2659 '%StringPrototype%': String.prototype, 2660 '%Symbol%': hasSymbols ? Symbol : undefined, 2661 '%SymbolPrototype%': hasSymbols ? Symbol.prototype : undefined, 2662 '%SyntaxError%': SyntaxError, 2663 '%SyntaxErrorPrototype%': SyntaxError.prototype, 2664 '%ThrowTypeError%': ThrowTypeError, 2665 '%TypedArray%': TypedArray, 2666 '%TypedArrayPrototype%': TypedArray ? TypedArray.prototype : undefined, 2667 '%TypeError%': $TypeError, 2668 '%TypeErrorPrototype%': $TypeError.prototype, 2669 '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, 2670 '%Uint8ArrayPrototype%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array.prototype, 2671 '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, 2672 '%Uint8ClampedArrayPrototype%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray.prototype, 2673 '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, 2674 '%Uint16ArrayPrototype%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array.prototype, 2675 '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, 2676 '%Uint32ArrayPrototype%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array.prototype, 2677 '%URIError%': URIError, 2678 '%URIErrorPrototype%': URIError.prototype, 2679 '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, 2680 '%WeakMapPrototype%': typeof WeakMap === 'undefined' ? undefined : WeakMap.prototype, 2681 '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet, 2682 '%WeakSetPrototype%': typeof WeakSet === 'undefined' ? undefined : WeakSet.prototype 2683 }; 2684 2685 var bind = __webpack_require__(120); 2686 var $replace = bind.call(Function.call, String.prototype.replace); 2687 2688 /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ 2689 var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; 2690 var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */ 2691 var stringToPath = function stringToPath(string) { 2692 var result = []; 2693 $replace(string, rePropName, function (match, number, quote, subString) { 2694 result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : (number || match); 2695 }); 2696 return result; 2697 }; 2698 /* end adaptation */ 2699 2700 var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) { 2701 if (!(name in INTRINSICS)) { 2702 throw new SyntaxError('intrinsic ' + name + ' does not exist!'); 2703 } 2704 2705 // istanbul ignore if // hopefully this is impossible to test :-) 2706 if (typeof INTRINSICS[name] === 'undefined' && !allowMissing) { 2707 throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); 2708 } 2709 2710 return INTRINSICS[name]; 2711 }; 2712 2713 module.exports = function GetIntrinsic(name, allowMissing) { 2714 if (typeof name !== 'string' || name.length === 0) { 2715 throw new TypeError('intrinsic name must be a non-empty string'); 2716 } 2717 if (arguments.length > 1 && typeof allowMissing !== 'boolean') { 2718 throw new TypeError('"allowMissing" argument must be a boolean'); 2719 } 2720 2721 var parts = stringToPath(name); 2722 2723 var value = getBaseIntrinsic('%' + (parts.length > 0 ? parts[0] : '') + '%', allowMissing); 2724 for (var i = 1; i < parts.length; i += 1) { 2725 if (value != null) { 2726 if ($gOPD && (i + 1) >= parts.length) { 2727 var desc = $gOPD(value, parts[i]); 2728 if (!allowMissing && !(parts[i] in value)) { 2729 throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); 2730 } 2731 // By convention, when a data property is converted to an accessor 2732 // property to emulate a data property that does not suffer from 2733 // the override mistake, that accessor's getter is marked with 2734 // an `originalValue` property. Here, when we detect this, we 2735 // uphold the illusion by pretending to see that original data 2736 // property, i.e., returning the value rather than the getter 2737 // itself. 2738 value = desc && 'get' in desc && !('originalValue' in desc.get) ? desc.get : value[parts[i]]; 2739 } else { 2740 value = value[parts[i]]; 2741 } 2742 } 2743 } 2744 return value; 2745 }; 2746 2747 2748 /***/ }), 2749 /* 59 */ 2750 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2751 2752 "use strict"; 2753 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useIsomorphicEffect; }); 2754 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); 2755 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 2756 2757 2758 /** 2759 * `React.useLayoutEffect` that fallbacks to `React.useEffect` on server side 2760 * rendering. 2761 */ 2762 2763 var useIsomorphicEffect = typeof window === "undefined" ? react__WEBPACK_IMPORTED_MODULE_0__["useEffect"] : react__WEBPACK_IMPORTED_MODULE_0__["useLayoutEffect"]; 2764 2765 2766 2767 2768 /***/ }), 2769 /* 60 */, 2770 /* 61 */ 2771 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2772 2773 "use strict"; 2774 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return applyState; }); 2775 function isUpdater(argument) { 2776 return typeof argument === "function"; 2777 } 2778 /** 2779 * Receives a `setState` argument and calls it with `currentValue` if it's a 2780 * function. Otherwise return the argument as the new value. 2781 * 2782 * @example 2783 * import { applyState } from "reakit-utils"; 2784 * 2785 * applyState((value) => value + 1, 1); // 2 2786 * applyState(2, 1); // 2 2787 */ 2788 2789 2790 function applyState(argument, currentValue) { 2791 if (isUpdater(argument)) { 2792 return argument(currentValue); 2793 } 2794 2795 return argument; 2796 } 2797 2798 2799 2800 2801 /***/ }), 2802 /* 62 */ 2803 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2804 2805 "use strict"; 2806 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useSealedState; }); 2807 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); 2808 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 2809 2810 2811 /** 2812 * React custom hook that returns the very first value passed to `initialState`, 2813 * even if it changes between re-renders. 2814 */ 2815 function useSealedState(initialState) { 2816 var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])(initialState), 2817 sealed = _React$useState[0]; 2818 2819 return sealed; 2820 } 2821 2822 2823 2824 2825 /***/ }), 2826 /* 63 */ 2827 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2828 2829 "use strict"; 2830 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useForkRef; }); 2831 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); 2832 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 2833 2834 2835 // https://github.com/mui-org/material-ui/blob/2bcc874cf07b81202968f769cb9c2398c7c11311/packages/material-ui/src/utils/useForkRef.js 2836 2837 function setRef(ref, value) { 2838 if (value === void 0) { 2839 value = null; 2840 } 2841 2842 if (!ref) return; 2843 2844 if (typeof ref === "function") { 2845 ref(value); 2846 } else { 2847 ref.current = value; 2848 } 2849 } 2850 /** 2851 * Merges up to two React Refs into a single memoized function React Ref so you 2852 * can pass it to an element. 2853 * 2854 * @example 2855 * import React from "react"; 2856 * import { useForkRef } from "reakit-utils"; 2857 * 2858 * const Component = React.forwardRef((props, ref) => { 2859 * const internalRef = React.useRef(); 2860 * return <div {...props} ref={useForkRef(internalRef, ref)} />; 2861 * }); 2862 */ 2863 2864 2865 function useForkRef(refA, refB) { 2866 return Object(react__WEBPACK_IMPORTED_MODULE_0__["useMemo"])(function () { 2867 if (refA == null && refB == null) { 2868 return null; 2869 } 2870 2871 return function (value) { 2872 setRef(refA, value); 2873 setRef(refB, value); 2874 }; 2875 }, [refA, refB]); 2876 } 2877 2878 2879 2880 2881 /***/ }), 2882 /* 64 */ 2883 /***/ (function(module, exports) { 2884 2885 (function() { module.exports = this["wp"]["isShallowEqual"]; }()); 2886 2887 /***/ }), 2888 /* 65 */ 2889 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2890 2891 "use strict"; 2892 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return unstable_useIdState; }); 2893 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); 2894 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 2895 /* harmony import */ var reakit_utils_useSealedState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(62); 2896 /* harmony import */ var _IdProvider_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(68); 2897 2898 2899 2900 2901 function unstable_useIdState(initialState) { 2902 if (initialState === void 0) { 2903 initialState = {}; 2904 } 2905 2906 var _useSealedState = Object(reakit_utils_useSealedState__WEBPACK_IMPORTED_MODULE_1__[/* useSealedState */ "a"])(initialState), 2907 initialBaseId = _useSealedState.baseId; 2908 2909 var generateId = Object(react__WEBPACK_IMPORTED_MODULE_0__["useContext"])(_IdProvider_js__WEBPACK_IMPORTED_MODULE_2__[/* unstable_IdContext */ "a"]); 2910 var idCountRef = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(0); 2911 2912 var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])(function () { 2913 return initialBaseId || generateId(); 2914 }), 2915 baseId = _React$useState[0], 2916 setBaseId = _React$useState[1]; 2917 2918 return { 2919 baseId: baseId, 2920 unstable_setBaseId: setBaseId, 2921 unstable_idCountRef: idCountRef 2922 }; 2923 } 2924 var keys = ["baseId", "unstable_setBaseId", "unstable_idCountRef"]; 2925 unstable_useIdState.__keys = keys; 2926 2927 2928 2929 2930 /***/ }), 2931 /* 66 */ 2932 /***/ (function(module, exports, __webpack_require__) { 2933 2934 var __WEBPACK_AMD_DEFINE_RESULT__;// TinyColor v1.4.2 2935 // https://github.com/bgrins/TinyColor 2936 // Brian Grinstead, MIT License 2937 2938 (function(Math) { 2939 2940 var trimLeft = /^\s+/, 2941 trimRight = /\s+$/, 2942 tinyCounter = 0, 2943 mathRound = Math.round, 2944 mathMin = Math.min, 2945 mathMax = Math.max, 2946 mathRandom = Math.random; 2947 2948 function tinycolor (color, opts) { 2949 2950 color = (color) ? color : ''; 2951 opts = opts || { }; 2952 2953 // If input is already a tinycolor, return itself 2954 if (color instanceof tinycolor) { 2955 return color; 2956 } 2957 // If we are called as a function, call using new instead 2958 if (!(this instanceof tinycolor)) { 2959 return new tinycolor(color, opts); 2960 } 2961 2962 var rgb = inputToRGB(color); 2963 this._originalInput = color, 2964 this._r = rgb.r, 2965 this._g = rgb.g, 2966 this._b = rgb.b, 2967 this._a = rgb.a, 2968 this._roundA = mathRound(100*this._a) / 100, 2969 this._format = opts.format || rgb.format; 2970 this._gradientType = opts.gradientType; 2971 2972 // Don't let the range of [0,255] come back in [0,1]. 2973 // Potentially lose a little bit of precision here, but will fix issues where 2974 // .5 gets interpreted as half of the total, instead of half of 1 2975 // If it was supposed to be 128, this was already taken care of by `inputToRgb` 2976 if (this._r < 1) { this._r = mathRound(this._r); } 2977 if (this._g < 1) { this._g = mathRound(this._g); } 2978 if (this._b < 1) { this._b = mathRound(this._b); } 2979 2980 this._ok = rgb.ok; 2981 this._tc_id = tinyCounter++; 2982 } 2983 2984 tinycolor.prototype = { 2985 isDark: function() { 2986 return this.getBrightness() < 128; 2987 }, 2988 isLight: function() { 2989 return !this.isDark(); 2990 }, 2991 isValid: function() { 2992 return this._ok; 2993 }, 2994 getOriginalInput: function() { 2995 return this._originalInput; 2996 }, 2997 getFormat: function() { 2998 return this._format; 2999 }, 3000 getAlpha: function() { 3001 return this._a; 3002 }, 3003 getBrightness: function() { 3004 //http://www.w3.org/TR/AERT#color-contrast 3005 var rgb = this.toRgb(); 3006 return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; 3007 }, 3008 getLuminance: function() { 3009 //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef 3010 var rgb = this.toRgb(); 3011 var RsRGB, GsRGB, BsRGB, R, G, B; 3012 RsRGB = rgb.r/255; 3013 GsRGB = rgb.g/255; 3014 BsRGB = rgb.b/255; 3015 3016 if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);} 3017 if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);} 3018 if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);} 3019 return (0.2126 * R) + (0.7152 * G) + (0.0722 * B); 3020 }, 3021 setAlpha: function(value) { 3022 this._a = boundAlpha(value); 3023 this._roundA = mathRound(100*this._a) / 100; 3024 return this; 3025 }, 3026 toHsv: function() { 3027 var hsv = rgbToHsv(this._r, this._g, this._b); 3028 return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a }; 3029 }, 3030 toHsvString: function() { 3031 var hsv = rgbToHsv(this._r, this._g, this._b); 3032 var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); 3033 return (this._a == 1) ? 3034 "hsv(" + h + ", " + s + "%, " + v + "%)" : 3035 "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")"; 3036 }, 3037 toHsl: function() { 3038 var hsl = rgbToHsl(this._r, this._g, this._b); 3039 return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a }; 3040 }, 3041 toHslString: function() { 3042 var hsl = rgbToHsl(this._r, this._g, this._b); 3043 var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); 3044 return (this._a == 1) ? 3045 "hsl(" + h + ", " + s + "%, " + l + "%)" : 3046 "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")"; 3047 }, 3048 toHex: function(allow3Char) { 3049 return rgbToHex(this._r, this._g, this._b, allow3Char); 3050 }, 3051 toHexString: function(allow3Char) { 3052 return '#' + this.toHex(allow3Char); 3053 }, 3054 toHex8: function(allow4Char) { 3055 return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); 3056 }, 3057 toHex8String: function(allow4Char) { 3058 return '#' + this.toHex8(allow4Char); 3059 }, 3060 toRgb: function() { 3061 return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; 3062 }, 3063 toRgbString: function() { 3064 return (this._a == 1) ? 3065 "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : 3066 "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; 3067 }, 3068 toPercentageRgb: function() { 3069 return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a }; 3070 }, 3071 toPercentageRgbString: function() { 3072 return (this._a == 1) ? 3073 "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" : 3074 "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; 3075 }, 3076 toName: function() { 3077 if (this._a === 0) { 3078 return "transparent"; 3079 } 3080 3081 if (this._a < 1) { 3082 return false; 3083 } 3084 3085 return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; 3086 }, 3087 toFilter: function(secondColor) { 3088 var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a); 3089 var secondHex8String = hex8String; 3090 var gradientType = this._gradientType ? "GradientType = 1, " : ""; 3091 3092 if (secondColor) { 3093 var s = tinycolor(secondColor); 3094 secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a); 3095 } 3096 3097 return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")"; 3098 }, 3099 toString: function(format) { 3100 var formatSet = !!format; 3101 format = format || this._format; 3102 3103 var formattedString = false; 3104 var hasAlpha = this._a < 1 && this._a >= 0; 3105 var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); 3106 3107 if (needsAlphaFormat) { 3108 // Special case for "transparent", all other non-alpha formats 3109 // will return rgba when there is transparency. 3110 if (format === "name" && this._a === 0) { 3111 return this.toName(); 3112 } 3113 return this.toRgbString(); 3114 } 3115 if (format === "rgb") { 3116 formattedString = this.toRgbString(); 3117 } 3118 if (format === "prgb") { 3119 formattedString = this.toPercentageRgbString(); 3120 } 3121 if (format === "hex" || format === "hex6") { 3122 formattedString = this.toHexString(); 3123 } 3124 if (format === "hex3") { 3125 formattedString = this.toHexString(true); 3126 } 3127 if (format === "hex4") { 3128 formattedString = this.toHex8String(true); 3129 } 3130 if (format === "hex8") { 3131 formattedString = this.toHex8String(); 3132 } 3133 if (format === "name") { 3134 formattedString = this.toName(); 3135 } 3136 if (format === "hsl") { 3137 formattedString = this.toHslString(); 3138 } 3139 if (format === "hsv") { 3140 formattedString = this.toHsvString(); 3141 } 3142 3143 return formattedString || this.toHexString(); 3144 }, 3145 clone: function() { 3146 return tinycolor(this.toString()); 3147 }, 3148 3149 _applyModification: function(fn, args) { 3150 var color = fn.apply(null, [this].concat([].slice.call(args))); 3151 this._r = color._r; 3152 this._g = color._g; 3153 this._b = color._b; 3154 this.setAlpha(color._a); 3155 return this; 3156 }, 3157 lighten: function() { 3158 return this._applyModification(lighten, arguments); 3159 }, 3160 brighten: function() { 3161 return this._applyModification(brighten, arguments); 3162 }, 3163 darken: function() { 3164 return this._applyModification(darken, arguments); 3165 }, 3166 desaturate: function() { 3167 return this._applyModification(desaturate, arguments); 3168 }, 3169 saturate: function() { 3170 return this._applyModification(saturate, arguments); 3171 }, 3172 greyscale: function() { 3173 return this._applyModification(greyscale, arguments); 3174 }, 3175 spin: function() { 3176 return this._applyModification(spin, arguments); 3177 }, 3178 3179 _applyCombination: function(fn, args) { 3180 return fn.apply(null, [this].concat([].slice.call(args))); 3181 }, 3182 analogous: function() { 3183 return this._applyCombination(analogous, arguments); 3184 }, 3185 complement: function() { 3186 return this._applyCombination(complement, arguments); 3187 }, 3188 monochromatic: function() { 3189 return this._applyCombination(monochromatic, arguments); 3190 }, 3191 splitcomplement: function() { 3192 return this._applyCombination(splitcomplement, arguments); 3193 }, 3194 triad: function() { 3195 return this._applyCombination(triad, arguments); 3196 }, 3197 tetrad: function() { 3198 return this._applyCombination(tetrad, arguments); 3199 } 3200 }; 3201 3202 // If input is an object, force 1 into "1.0" to handle ratios properly 3203 // String input requires "1.0" as input, so 1 will be treated as 1 3204 tinycolor.fromRatio = function(color, opts) { 3205 if (typeof color == "object") { 3206 var newColor = {}; 3207 for (var i in color) { 3208 if (color.hasOwnProperty(i)) { 3209 if (i === "a") { 3210 newColor[i] = color[i]; 3211 } 3212 else { 3213 newColor[i] = convertToPercentage(color[i]); 3214 } 3215 } 3216 } 3217 color = newColor; 3218 } 3219 3220 return tinycolor(color, opts); 3221 }; 3222 3223 // Given a string or object, convert that input to RGB 3224 // Possible string inputs: 3225 // 3226 // "red" 3227 // "#f00" or "f00" 3228 // "#ff0000" or "ff0000" 3229 // "#ff000000" or "ff000000" 3230 // "rgb 255 0 0" or "rgb (255, 0, 0)" 3231 // "rgb 1.0 0 0" or "rgb (1, 0, 0)" 3232 // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" 3233 // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" 3234 // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" 3235 // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" 3236 // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" 3237 // 3238 function inputToRGB(color) { 3239 3240 var rgb = { r: 0, g: 0, b: 0 }; 3241 var a = 1; 3242 var s = null; 3243 var v = null; 3244 var l = null; 3245 var ok = false; 3246 var format = false; 3247 3248 if (typeof color == "string") { 3249 color = stringInputToObject(color); 3250 } 3251 3252 if (typeof color == "object") { 3253 if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { 3254 rgb = rgbToRgb(color.r, color.g, color.b); 3255 ok = true; 3256 format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; 3257 } 3258 else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { 3259 s = convertToPercentage(color.s); 3260 v = convertToPercentage(color.v); 3261 rgb = hsvToRgb(color.h, s, v); 3262 ok = true; 3263 format = "hsv"; 3264 } 3265 else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { 3266 s = convertToPercentage(color.s); 3267 l = convertToPercentage(color.l); 3268 rgb = hslToRgb(color.h, s, l); 3269 ok = true; 3270 format = "hsl"; 3271 } 3272 3273 if (color.hasOwnProperty("a")) { 3274 a = color.a; 3275 } 3276 } 3277 3278 a = boundAlpha(a); 3279 3280 return { 3281 ok: ok, 3282 format: color.format || format, 3283 r: mathMin(255, mathMax(rgb.r, 0)), 3284 g: mathMin(255, mathMax(rgb.g, 0)), 3285 b: mathMin(255, mathMax(rgb.b, 0)), 3286 a: a 3287 }; 3288 } 3289 3290 3291 // Conversion Functions 3292 // -------------------- 3293 3294 // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: 3295 // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript> 3296 3297 // `rgbToRgb` 3298 // Handle bounds / percentage checking to conform to CSS color spec 3299 // <http://www.w3.org/TR/css3-color/> 3300 // *Assumes:* r, g, b in [0, 255] or [0, 1] 3301 // *Returns:* { r, g, b } in [0, 255] 3302 function rgbToRgb(r, g, b){ 3303 return { 3304 r: bound01(r, 255) * 255, 3305 g: bound01(g, 255) * 255, 3306 b: bound01(b, 255) * 255 3307 }; 3308 } 3309 3310 // `rgbToHsl` 3311 // Converts an RGB color value to HSL. 3312 // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] 3313 // *Returns:* { h, s, l } in [0,1] 3314 function rgbToHsl(r, g, b) { 3315 3316 r = bound01(r, 255); 3317 g = bound01(g, 255); 3318 b = bound01(b, 255); 3319 3320 var max = mathMax(r, g, b), min = mathMin(r, g, b); 3321 var h, s, l = (max + min) / 2; 3322 3323 if(max == min) { 3324 h = s = 0; // achromatic 3325 } 3326 else { 3327 var d = max - min; 3328 s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 3329 switch(max) { 3330 case r: h = (g - b) / d + (g < b ? 6 : 0); break; 3331 case g: h = (b - r) / d + 2; break; 3332 case b: h = (r - g) / d + 4; break; 3333 } 3334 3335 h /= 6; 3336 } 3337 3338 return { h: h, s: s, l: l }; 3339 } 3340 3341 // `hslToRgb` 3342 // Converts an HSL color value to RGB. 3343 // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] 3344 // *Returns:* { r, g, b } in the set [0, 255] 3345 function hslToRgb(h, s, l) { 3346 var r, g, b; 3347 3348 h = bound01(h, 360); 3349 s = bound01(s, 100); 3350 l = bound01(l, 100); 3351 3352 function hue2rgb(p, q, t) { 3353 if(t < 0) t += 1; 3354 if(t > 1) t -= 1; 3355 if(t < 1/6) return p + (q - p) * 6 * t; 3356 if(t < 1/2) return q; 3357 if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; 3358 return p; 3359 } 3360 3361 if(s === 0) { 3362 r = g = b = l; // achromatic 3363 } 3364 else { 3365 var q = l < 0.5 ? l * (1 + s) : l + s - l * s; 3366 var p = 2 * l - q; 3367 r = hue2rgb(p, q, h + 1/3); 3368 g = hue2rgb(p, q, h); 3369 b = hue2rgb(p, q, h - 1/3); 3370 } 3371 3372 return { r: r * 255, g: g * 255, b: b * 255 }; 3373 } 3374 3375 // `rgbToHsv` 3376 // Converts an RGB color value to HSV 3377 // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] 3378 // *Returns:* { h, s, v } in [0,1] 3379 function rgbToHsv(r, g, b) { 3380 3381 r = bound01(r, 255); 3382 g = bound01(g, 255); 3383 b = bound01(b, 255); 3384 3385 var max = mathMax(r, g, b), min = mathMin(r, g, b); 3386 var h, s, v = max; 3387 3388 var d = max - min; 3389 s = max === 0 ? 0 : d / max; 3390 3391 if(max == min) { 3392 h = 0; // achromatic 3393 } 3394 else { 3395 switch(max) { 3396 case r: h = (g - b) / d + (g < b ? 6 : 0); break; 3397 case g: h = (b - r) / d + 2; break; 3398 case b: h = (r - g) / d + 4; break; 3399 } 3400 h /= 6; 3401 } 3402 return { h: h, s: s, v: v }; 3403 } 3404 3405 // `hsvToRgb` 3406 // Converts an HSV color value to RGB. 3407 // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] 3408 // *Returns:* { r, g, b } in the set [0, 255] 3409 function hsvToRgb(h, s, v) { 3410 3411 h = bound01(h, 360) * 6; 3412 s = bound01(s, 100); 3413 v = bound01(v, 100); 3414 3415 var i = Math.floor(h), 3416 f = h - i, 3417 p = v * (1 - s), 3418 q = v * (1 - f * s), 3419 t = v * (1 - (1 - f) * s), 3420 mod = i % 6, 3421 r = [v, q, p, p, t, v][mod], 3422 g = [t, v, v, q, p, p][mod], 3423 b = [p, p, t, v, v, q][mod]; 3424 3425 return { r: r * 255, g: g * 255, b: b * 255 }; 3426 } 3427 3428 // `rgbToHex` 3429 // Converts an RGB color to hex 3430 // Assumes r, g, and b are contained in the set [0, 255] 3431 // Returns a 3 or 6 character hex 3432 function rgbToHex(r, g, b, allow3Char) { 3433 3434 var hex = [ 3435 pad2(mathRound(r).toString(16)), 3436 pad2(mathRound(g).toString(16)), 3437 pad2(mathRound(b).toString(16)) 3438 ]; 3439 3440 // Return a 3 character hex if possible 3441 if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { 3442 return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); 3443 } 3444 3445 return hex.join(""); 3446 } 3447 3448 // `rgbaToHex` 3449 // Converts an RGBA color plus alpha transparency to hex 3450 // Assumes r, g, b are contained in the set [0, 255] and 3451 // a in [0, 1]. Returns a 4 or 8 character rgba hex 3452 function rgbaToHex(r, g, b, a, allow4Char) { 3453 3454 var hex = [ 3455 pad2(mathRound(r).toString(16)), 3456 pad2(mathRound(g).toString(16)), 3457 pad2(mathRound(b).toString(16)), 3458 pad2(convertDecimalToHex(a)) 3459 ]; 3460 3461 // Return a 4 character hex if possible 3462 if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { 3463 return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); 3464 } 3465 3466 return hex.join(""); 3467 } 3468 3469 // `rgbaToArgbHex` 3470 // Converts an RGBA color to an ARGB Hex8 string 3471 // Rarely used, but required for "toFilter()" 3472 function rgbaToArgbHex(r, g, b, a) { 3473 3474 var hex = [ 3475 pad2(convertDecimalToHex(a)), 3476 pad2(mathRound(r).toString(16)), 3477 pad2(mathRound(g).toString(16)), 3478 pad2(mathRound(b).toString(16)) 3479 ]; 3480 3481 return hex.join(""); 3482 } 3483 3484 // `equals` 3485 // Can be called with any tinycolor input 3486 tinycolor.equals = function (color1, color2) { 3487 if (!color1 || !color2) { return false; } 3488 return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); 3489 }; 3490 3491 tinycolor.random = function() { 3492 return tinycolor.fromRatio({ 3493 r: mathRandom(), 3494 g: mathRandom(), 3495 b: mathRandom() 3496 }); 3497 }; 3498 3499 3500 // Modification Functions 3501 // ---------------------- 3502 // Thanks to less.js for some of the basics here 3503 // <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js> 3504 3505 function desaturate(color, amount) { 3506 amount = (amount === 0) ? 0 : (amount || 10); 3507 var hsl = tinycolor(color).toHsl(); 3508 hsl.s -= amount / 100; 3509 hsl.s = clamp01(hsl.s); 3510 return tinycolor(hsl); 3511 } 3512 3513 function saturate(color, amount) { 3514 amount = (amount === 0) ? 0 : (amount || 10); 3515 var hsl = tinycolor(color).toHsl(); 3516 hsl.s += amount / 100; 3517 hsl.s = clamp01(hsl.s); 3518 return tinycolor(hsl); 3519 } 3520 3521 function greyscale(color) { 3522 return tinycolor(color).desaturate(100); 3523 } 3524 3525 function lighten (color, amount) { 3526 amount = (amount === 0) ? 0 : (amount || 10); 3527 var hsl = tinycolor(color).toHsl(); 3528 hsl.l += amount / 100; 3529 hsl.l = clamp01(hsl.l); 3530 return tinycolor(hsl); 3531 } 3532 3533 function brighten(color, amount) { 3534 amount = (amount === 0) ? 0 : (amount || 10); 3535 var rgb = tinycolor(color).toRgb(); 3536 rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100)))); 3537 rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100)))); 3538 rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100)))); 3539 return tinycolor(rgb); 3540 } 3541 3542 function darken (color, amount) { 3543 amount = (amount === 0) ? 0 : (amount || 10); 3544 var hsl = tinycolor(color).toHsl(); 3545 hsl.l -= amount / 100; 3546 hsl.l = clamp01(hsl.l); 3547 return tinycolor(hsl); 3548 } 3549 3550 // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. 3551 // Values outside of this range will be wrapped into this range. 3552 function spin(color, amount) { 3553 var hsl = tinycolor(color).toHsl(); 3554 var hue = (hsl.h + amount) % 360; 3555 hsl.h = hue < 0 ? 360 + hue : hue; 3556 return tinycolor(hsl); 3557 } 3558 3559 // Combination Functions 3560 // --------------------- 3561 // Thanks to jQuery xColor for some of the ideas behind these 3562 // <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js> 3563 3564 function complement(color) { 3565 var hsl = tinycolor(color).toHsl(); 3566 hsl.h = (hsl.h + 180) % 360; 3567 return tinycolor(hsl); 3568 } 3569 3570 function triad(color) { 3571 var hsl = tinycolor(color).toHsl(); 3572 var h = hsl.h; 3573 return [ 3574 tinycolor(color), 3575 tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), 3576 tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) 3577 ]; 3578 } 3579 3580 function tetrad(color) { 3581 var hsl = tinycolor(color).toHsl(); 3582 var h = hsl.h; 3583 return [ 3584 tinycolor(color), 3585 tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), 3586 tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), 3587 tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) 3588 ]; 3589 } 3590 3591 function splitcomplement(color) { 3592 var hsl = tinycolor(color).toHsl(); 3593 var h = hsl.h; 3594 return [ 3595 tinycolor(color), 3596 tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}), 3597 tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l}) 3598 ]; 3599 } 3600 3601 function analogous(color, results, slices) { 3602 results = results || 6; 3603 slices = slices || 30; 3604 3605 var hsl = tinycolor(color).toHsl(); 3606 var part = 360 / slices; 3607 var ret = [tinycolor(color)]; 3608 3609 for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) { 3610 hsl.h = (hsl.h + part) % 360; 3611 ret.push(tinycolor(hsl)); 3612 } 3613 return ret; 3614 } 3615 3616 function monochromatic(color, results) { 3617 results = results || 6; 3618 var hsv = tinycolor(color).toHsv(); 3619 var h = hsv.h, s = hsv.s, v = hsv.v; 3620 var ret = []; 3621 var modification = 1 / results; 3622 3623 while (results--) { 3624 ret.push(tinycolor({ h: h, s: s, v: v})); 3625 v = (v + modification) % 1; 3626 } 3627 3628 return ret; 3629 } 3630 3631 // Utility Functions 3632 // --------------------- 3633 3634 tinycolor.mix = function(color1, color2, amount) { 3635 amount = (amount === 0) ? 0 : (amount || 50); 3636 3637 var rgb1 = tinycolor(color1).toRgb(); 3638 var rgb2 = tinycolor(color2).toRgb(); 3639 3640 var p = amount / 100; 3641 3642 var rgba = { 3643 r: ((rgb2.r - rgb1.r) * p) + rgb1.r, 3644 g: ((rgb2.g - rgb1.g) * p) + rgb1.g, 3645 b: ((rgb2.b - rgb1.b) * p) + rgb1.b, 3646 a: ((rgb2.a - rgb1.a) * p) + rgb1.a 3647 }; 3648 3649 return tinycolor(rgba); 3650 }; 3651 3652 3653 // Readability Functions 3654 // --------------------- 3655 // <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2) 3656 3657 // `contrast` 3658 // Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2) 3659 tinycolor.readability = function(color1, color2) { 3660 var c1 = tinycolor(color1); 3661 var c2 = tinycolor(color2); 3662 return (Math.max(c1.getLuminance(),c2.getLuminance())+0.05) / (Math.min(c1.getLuminance(),c2.getLuminance())+0.05); 3663 }; 3664 3665 // `isReadable` 3666 // Ensure that foreground and background color combinations meet WCAG2 guidelines. 3667 // The third argument is an optional Object. 3668 // the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA'; 3669 // the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'. 3670 // If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}. 3671 3672 // *Example* 3673 // tinycolor.isReadable("#000", "#111") => false 3674 // tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false 3675 tinycolor.isReadable = function(color1, color2, wcag2) { 3676 var readability = tinycolor.readability(color1, color2); 3677 var wcag2Parms, out; 3678 3679 out = false; 3680 3681 wcag2Parms = validateWCAG2Parms(wcag2); 3682 switch (wcag2Parms.level + wcag2Parms.size) { 3683 case "AAsmall": 3684 case "AAAlarge": 3685 out = readability >= 4.5; 3686 break; 3687 case "AAlarge": 3688 out = readability >= 3; 3689 break; 3690 case "AAAsmall": 3691 out = readability >= 7; 3692 break; 3693 } 3694 return out; 3695 3696 }; 3697 3698 // `mostReadable` 3699 // Given a base color and a list of possible foreground or background 3700 // colors for that base, returns the most readable color. 3701 // Optionally returns Black or White if the most readable color is unreadable. 3702 // *Example* 3703 // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" 3704 // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" 3705 // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" 3706 // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" 3707 tinycolor.mostReadable = function(baseColor, colorList, args) { 3708 var bestColor = null; 3709 var bestScore = 0; 3710 var readability; 3711 var includeFallbackColors, level, size ; 3712 args = args || {}; 3713 includeFallbackColors = args.includeFallbackColors ; 3714 level = args.level; 3715 size = args.size; 3716 3717 for (var i= 0; i < colorList.length ; i++) { 3718 readability = tinycolor.readability(baseColor, colorList[i]); 3719 if (readability > bestScore) { 3720 bestScore = readability; 3721 bestColor = tinycolor(colorList[i]); 3722 } 3723 } 3724 3725 if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) { 3726 return bestColor; 3727 } 3728 else { 3729 args.includeFallbackColors=false; 3730 return tinycolor.mostReadable(baseColor,["#fff", "#000"],args); 3731 } 3732 }; 3733 3734 3735 // Big List of Colors 3736 // ------------------ 3737 // <http://www.w3.org/TR/css3-color/#svg-color> 3738 var names = tinycolor.names = { 3739 aliceblue: "f0f8ff", 3740 antiquewhite: "faebd7", 3741 aqua: "0ff", 3742 aquamarine: "7fffd4", 3743 azure: "f0ffff", 3744 beige: "f5f5dc", 3745 bisque: "ffe4c4", 3746 black: "000", 3747 blanchedalmond: "ffebcd", 3748 blue: "00f", 3749 blueviolet: "8a2be2", 3750 brown: "a52a2a", 3751 burlywood: "deb887", 3752 burntsienna: "ea7e5d", 3753 cadetblue: "5f9ea0", 3754 chartreuse: "7fff00", 3755 chocolate: "d2691e", 3756 coral: "ff7f50", 3757 cornflowerblue: "6495ed", 3758 cornsilk: "fff8dc", 3759 crimson: "dc143c", 3760 cyan: "0ff", 3761 darkblue: "00008b", 3762 darkcyan: "008b8b", 3763 darkgoldenrod: "b8860b", 3764 darkgray: "a9a9a9", 3765 darkgreen: "006400", 3766 darkgrey: "a9a9a9", 3767 darkkhaki: "bdb76b", 3768 darkmagenta: "8b008b", 3769 darkolivegreen: "556b2f", 3770 darkorange: "ff8c00", 3771 darkorchid: "9932cc", 3772 darkred: "8b0000", 3773 darksalmon: "e9967a", 3774 darkseagreen: "8fbc8f", 3775 darkslateblue: "483d8b", 3776 darkslategray: "2f4f4f", 3777 darkslategrey: "2f4f4f", 3778 darkturquoise: "00ced1", 3779 darkviolet: "9400d3", 3780 deeppink: "ff1493", 3781 deepskyblue: "00bfff", 3782 dimgray: "696969", 3783 dimgrey: "696969", 3784 dodgerblue: "1e90ff", 3785 firebrick: "b22222", 3786 floralwhite: "fffaf0", 3787 forestgreen: "228b22", 3788 fuchsia: "f0f", 3789 gainsboro: "dcdcdc", 3790 ghostwhite: "f8f8ff", 3791 gold: "ffd700", 3792 goldenrod: "daa520", 3793 gray: "808080", 3794 green: "008000", 3795 greenyellow: "adff2f", 3796 grey: "808080", 3797 honeydew: "f0fff0", 3798 hotpink: "ff69b4", 3799 indianred: "cd5c5c", 3800 indigo: "4b0082", 3801 ivory: "fffff0", 3802 khaki: "f0e68c", 3803 lavender: "e6e6fa", 3804 lavenderblush: "fff0f5", 3805 lawngreen: "7cfc00", 3806 lemonchiffon: "fffacd", 3807 lightblue: "add8e6", 3808 lightcoral: "f08080", 3809 lightcyan: "e0ffff", 3810 lightgoldenrodyellow: "fafad2", 3811 lightgray: "d3d3d3", 3812 lightgreen: "90ee90", 3813 lightgrey: "d3d3d3", 3814 lightpink: "ffb6c1", 3815 lightsalmon: "ffa07a", 3816 lightseagreen: "20b2aa", 3817 lightskyblue: "87cefa", 3818 lightslategray: "789", 3819 lightslategrey: "789", 3820 lightsteelblue: "b0c4de", 3821 lightyellow: "ffffe0", 3822 lime: "0f0", 3823 limegreen: "32cd32", 3824 linen: "faf0e6", 3825 magenta: "f0f", 3826 maroon: "800000", 3827 mediumaquamarine: "66cdaa", 3828 mediumblue: "0000cd", 3829 mediumorchid: "ba55d3", 3830 mediumpurple: "9370db", 3831 mediumseagreen: "3cb371", 3832 mediumslateblue: "7b68ee", 3833 mediumspringgreen: "00fa9a", 3834 mediumturquoise: "48d1cc", 3835 mediumvioletred: "c71585", 3836 midnightblue: "191970", 3837 mintcream: "f5fffa", 3838 mistyrose: "ffe4e1", 3839 moccasin: "ffe4b5", 3840 navajowhite: "ffdead", 3841 navy: "000080", 3842 oldlace: "fdf5e6", 3843 olive: "808000", 3844 olivedrab: "6b8e23", 3845 orange: "ffa500", 3846 orangered: "ff4500", 3847 orchid: "da70d6", 3848 palegoldenrod: "eee8aa", 3849 palegreen: "98fb98", 3850 paleturquoise: "afeeee", 3851 palevioletred: "db7093", 3852 papayawhip: "ffefd5", 3853 peachpuff: "ffdab9", 3854 peru: "cd853f", 3855 pink: "ffc0cb", 3856 plum: "dda0dd", 3857 powderblue: "b0e0e6", 3858 purple: "800080", 3859 rebeccapurple: "663399", 3860 red: "f00", 3861 rosybrown: "bc8f8f", 3862 royalblue: "4169e1", 3863 saddlebrown: "8b4513", 3864 salmon: "fa8072", 3865 sandybrown: "f4a460", 3866 seagreen: "2e8b57", 3867 seashell: "fff5ee", 3868 sienna: "a0522d", 3869 silver: "c0c0c0", 3870 skyblue: "87ceeb", 3871 slateblue: "6a5acd", 3872 slategray: "708090", 3873 slategrey: "708090", 3874 snow: "fffafa", 3875 springgreen: "00ff7f", 3876 steelblue: "4682b4", 3877 tan: "d2b48c", 3878 teal: "008080", 3879 thistle: "d8bfd8", 3880 tomato: "ff6347", 3881 turquoise: "40e0d0", 3882 violet: "ee82ee", 3883 wheat: "f5deb3", 3884 white: "fff", 3885 whitesmoke: "f5f5f5", 3886 yellow: "ff0", 3887 yellowgreen: "9acd32" 3888 }; 3889 3890 // Make it easy to access colors via `hexNames[hex]` 3891 var hexNames = tinycolor.hexNames = flip(names); 3892 3893 3894 // Utilities 3895 // --------- 3896 3897 // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` 3898 function flip(o) { 3899 var flipped = { }; 3900 for (var i in o) { 3901 if (o.hasOwnProperty(i)) { 3902 flipped[o[i]] = i; 3903 } 3904 } 3905 return flipped; 3906 } 3907 3908 // Return a valid alpha value [0,1] with all invalid values being set to 1 3909 function boundAlpha(a) { 3910 a = parseFloat(a); 3911 3912 if (isNaN(a) || a < 0 || a > 1) { 3913 a = 1; 3914 } 3915 3916 return a; 3917 } 3918 3919 // Take input from [0, n] and return it as [0, 1] 3920 function bound01(n, max) { 3921 if (isOnePointZero(n)) { n = "100%"; } 3922 3923 var processPercent = isPercentage(n); 3924 n = mathMin(max, mathMax(0, parseFloat(n))); 3925 3926 // Automatically convert percentage into number 3927 if (processPercent) { 3928 n = parseInt(n * max, 10) / 100; 3929 } 3930 3931 // Handle floating point rounding errors 3932 if ((Math.abs(n - max) < 0.000001)) { 3933 return 1; 3934 } 3935 3936 // Convert into [0, 1] range if it isn't already 3937 return (n % max) / parseFloat(max); 3938 } 3939 3940 // Force a number between 0 and 1 3941 function clamp01(val) { 3942 return mathMin(1, mathMax(0, val)); 3943 } 3944 3945 // Parse a base-16 hex value into a base-10 integer 3946 function parseIntFromHex(val) { 3947 return parseInt(val, 16); 3948 } 3949 3950 // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 3951 // <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0> 3952 function isOnePointZero(n) { 3953 return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; 3954 } 3955 3956 // Check to see if string passed in is a percentage 3957 function isPercentage(n) { 3958 return typeof n === "string" && n.indexOf('%') != -1; 3959 } 3960 3961 // Force a hex value to have 2 characters 3962 function pad2(c) { 3963 return c.length == 1 ? '0' + c : '' + c; 3964 } 3965 3966 // Replace a decimal with it's percentage value 3967 function convertToPercentage(n) { 3968 if (n <= 1) { 3969 n = (n * 100) + "%"; 3970 } 3971 3972 return n; 3973 } 3974 3975 // Converts a decimal to a hex value 3976 function convertDecimalToHex(d) { 3977 return Math.round(parseFloat(d) * 255).toString(16); 3978 } 3979 // Converts a hex value to a decimal 3980 function convertHexToDecimal(h) { 3981 return (parseIntFromHex(h) / 255); 3982 } 3983 3984 var matchers = (function() { 3985 3986 // <http://www.w3.org/TR/css3-values/#integers> 3987 var CSS_INTEGER = "[-\\+]?\\d+%?"; 3988 3989 // <http://www.w3.org/TR/css3-values/#number-value> 3990 var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; 3991 3992 // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. 3993 var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; 3994 3995 // Actual matching. 3996 // Parentheses and commas are optional, but not required. 3997 // Whitespace can take the place of commas or opening paren 3998 var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; 3999 var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; 4000 4001 return { 4002 CSS_UNIT: new RegExp(CSS_UNIT), 4003 rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), 4004 rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), 4005 hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), 4006 hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), 4007 hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), 4008 hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), 4009 hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, 4010 hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, 4011 hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, 4012 hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ 4013 }; 4014 })(); 4015 4016 // `isValidCSSUnit` 4017 // Take in a single string / number and check to see if it looks like a CSS unit 4018 // (see `matchers` above for definition). 4019 function isValidCSSUnit(color) { 4020 return !!matchers.CSS_UNIT.exec(color); 4021 } 4022 4023 // `stringInputToObject` 4024 // Permissive string parsing. Take in a number of formats, and output an object 4025 // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` 4026 function stringInputToObject(color) { 4027 4028 color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase(); 4029 var named = false; 4030 if (names[color]) { 4031 color = names[color]; 4032 named = true; 4033 } 4034 else if (color == 'transparent') { 4035 return { r: 0, g: 0, b: 0, a: 0, format: "name" }; 4036 } 4037 4038 // Try to match string input using regular expressions. 4039 // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] 4040 // Just return an object and let the conversion functions handle that. 4041 // This way the result will be the same whether the tinycolor is initialized with string or object. 4042 var match; 4043 if ((match = matchers.rgb.exec(color))) { 4044 return { r: match[1], g: match[2], b: match[3] }; 4045 } 4046 if ((match = matchers.rgba.exec(color))) { 4047 return { r: match[1], g: match[2], b: match[3], a: match[4] }; 4048 } 4049 if ((match = matchers.hsl.exec(color))) { 4050 return { h: match[1], s: match[2], l: match[3] }; 4051 } 4052 if ((match = matchers.hsla.exec(color))) { 4053 return { h: match[1], s: match[2], l: match[3], a: match[4] }; 4054 } 4055 if ((match = matchers.hsv.exec(color))) { 4056 return { h: match[1], s: match[2], v: match[3] }; 4057 } 4058 if ((match = matchers.hsva.exec(color))) { 4059 return { h: match[1], s: match[2], v: match[3], a: match[4] }; 4060 } 4061 if ((match = matchers.hex8.exec(color))) { 4062 return { 4063 r: parseIntFromHex(match[1]), 4064 g: parseIntFromHex(match[2]), 4065 b: parseIntFromHex(match[3]), 4066 a: convertHexToDecimal(match[4]), 4067 format: named ? "name" : "hex8" 4068 }; 4069 } 4070 if ((match = matchers.hex6.exec(color))) { 4071 return { 4072 r: parseIntFromHex(match[1]), 4073 g: parseIntFromHex(match[2]), 4074 b: parseIntFromHex(match[3]), 4075 format: named ? "name" : "hex" 4076 }; 4077 } 4078 if ((match = matchers.hex4.exec(color))) { 4079 return { 4080 r: parseIntFromHex(match[1] + '' + match[1]), 4081 g: parseIntFromHex(match[2] + '' + match[2]), 4082 b: parseIntFromHex(match[3] + '' + match[3]), 4083 a: convertHexToDecimal(match[4] + '' + match[4]), 4084 format: named ? "name" : "hex8" 4085 }; 4086 } 4087 if ((match = matchers.hex3.exec(color))) { 4088 return { 4089 r: parseIntFromHex(match[1] + '' + match[1]), 4090 g: parseIntFromHex(match[2] + '' + match[2]), 4091 b: parseIntFromHex(match[3] + '' + match[3]), 4092 format: named ? "name" : "hex" 4093 }; 4094 } 4095 4096 return false; 4097 } 4098 4099 function validateWCAG2Parms(parms) { 4100 // return valid WCAG2 parms for isReadable. 4101 // If input parms are invalid, return {"level":"AA", "size":"small"} 4102 var level, size; 4103 parms = parms || {"level":"AA", "size":"small"}; 4104 level = (parms.level || "AA").toUpperCase(); 4105 size = (parms.size || "small").toLowerCase(); 4106 if (level !== "AA" && level !== "AAA") { 4107 level = "AA"; 4108 } 4109 if (size !== "small" && size !== "large") { 4110 size = "small"; 4111 } 4112 return {"level":level, "size":size}; 4113 } 4114 4115 // Node: Export function 4116 if ( true && module.exports) { 4117 module.exports = tinycolor; 4118 } 4119 // AMD/requirejs: Define the module 4120 else if (true) { 4121 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {return tinycolor;}).call(exports, __webpack_require__, exports, module), 4122 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 4123 } 4124 // Browser: Expose to window 4125 else {} 4126 4127 })(Math); 4128 4129 4130 /***/ }), 4131 /* 67 */ 4132 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4133 4134 "use strict"; 4135 /* unused harmony export Box */ 4136 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useBox; }); 4137 /* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); 4138 /* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(51); 4139 /* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(50); 4140 /* harmony import */ var reakit_utils_shallowEqual__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(56); 4141 4142 4143 4144 4145 4146 var useBox = Object(reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__[/* createHook */ "a"])({ 4147 name: "Box", 4148 keys: ["unstable_system"], 4149 propsAreEqual: function propsAreEqual(prev, next) { 4150 var prevSystem = prev.unstable_system, 4151 prevProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(prev, ["unstable_system"]); 4152 4153 var nextSystem = next.unstable_system, 4154 nextProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(next, ["unstable_system"]); 4155 4156 if (prevSystem !== nextSystem && !Object(reakit_utils_shallowEqual__WEBPACK_IMPORTED_MODULE_3__[/* shallowEqual */ "a"])(prevSystem, nextSystem)) { 4157 return false; 4158 } 4159 4160 return Object(reakit_utils_shallowEqual__WEBPACK_IMPORTED_MODULE_3__[/* shallowEqual */ "a"])(prevProps, nextProps); 4161 } 4162 }); 4163 var Box = Object(reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__[/* createComponent */ "a"])({ 4164 as: "div", 4165 useHook: useBox 4166 }); 4167 4168 4169 4170 4171 /***/ }), 4172 /* 68 */ 4173 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4174 4175 "use strict"; 4176 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return unstable_IdContext; }); 4177 /* unused harmony export unstable_IdProvider */ 4178 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); 4179 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 4180 4181 4182 var defaultPrefix = "id"; 4183 function generateRandomString(prefix) { 4184 if (prefix === void 0) { 4185 prefix = defaultPrefix; 4186 } 4187 4188 return "" + (prefix ? prefix + "-" : "") + Math.random().toString(32).substr(2, 6); 4189 } 4190 4191 var unstable_IdContext = Object(react__WEBPACK_IMPORTED_MODULE_0__["createContext"])(generateRandomString); 4192 function unstable_IdProvider(_ref) { 4193 var children = _ref.children, 4194 _ref$prefix = _ref.prefix, 4195 prefix = _ref$prefix === void 0 ? defaultPrefix : _ref$prefix; 4196 var count = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(0); 4197 var generateId = Object(react__WEBPACK_IMPORTED_MODULE_0__["useCallback"])(function (localPrefix) { 4198 if (localPrefix === void 0) { 4199 localPrefix = prefix; 4200 } 4201 4202 return "" + (localPrefix ? localPrefix + "-" : "") + ++count.current; 4203 }, [prefix]); 4204 return /*#__PURE__*/Object(react__WEBPACK_IMPORTED_MODULE_0__["createElement"])(unstable_IdContext.Provider, { 4205 value: generateId 4206 }, children); 4207 } 4208 4209 4210 4211 4212 /***/ }), 4213 /* 69 */, 4214 /* 70 */ 4215 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4216 4217 "use strict"; 4218 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasFocusWithin; }); 4219 /* harmony import */ var _getActiveElement_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57); 4220 4221 4222 4223 /** 4224 * Checks if `element` has focus. 4225 * 4226 * @example 4227 * import { hasFocusWithin } from "reakit-utils"; 4228 * 4229 * hasFocusWithin(document.getElementById("id")); 4230 */ 4231 4232 function hasFocusWithin(element) { 4233 var activeElement = Object(_getActiveElement_js__WEBPACK_IMPORTED_MODULE_0__[/* getActiveElement */ "a"])(element); 4234 if (!activeElement) return false; 4235 if (element.contains(activeElement)) return true; 4236 var activeDescendant = activeElement.getAttribute("aria-activedescendant"); 4237 if (!activeDescendant) return false; 4238 return activeDescendant === element.id || !!element.querySelector("#" + activeDescendant); 4239 } 4240 4241 4242 4243 4244 /***/ }), 4245 /* 71 */ 4246 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4247 4248 "use strict"; 4249 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isButton; }); 4250 var buttonInputTypes = ["button", "color", "file", "image", "reset", "submit"]; 4251 /** 4252 * Checks whether `element` is a native HTML button element or not. 4253 * 4254 * @example 4255 * import { isButton } from "reakit-utils"; 4256 * 4257 * isButton(document.querySelector("button")); // true 4258 * isButton(document.querySelector("input[type='button']")); // true 4259 * isButton(document.querySelector("div")); // false 4260 * isButton(document.querySelector("input[type='text']")); // false 4261 * 4262 * @returns {boolean} 4263 */ 4264 4265 function isButton(element) { 4266 if (element.tagName === "BUTTON") return true; 4267 4268 if (element.tagName === "INPUT") { 4269 var input = element; 4270 return buttonInputTypes.indexOf(input.type) !== -1; 4271 } 4272 4273 return false; 4274 } 4275 4276 4277 4278 4279 /***/ }), 4280 /* 72 */ 4281 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4282 4283 "use strict"; 4284 4285 // EXPORTS 4286 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ ensureFocus; }); 4287 __webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ getClosestFocusable; }); 4288 4289 // UNUSED EXPORTS: getAllFocusableIn, getAllTabbableIn, getFirstFocusableIn, getFirstTabbableIn, getLastTabbableIn, getNextTabbableIn, getPreviousTabbableIn, isFocusable, isTabbable 4290 4291 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/matches.js 4292 /** 4293 * Ponyfill for `Element.prototype.matches` 4294 * 4295 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches 4296 */ 4297 function matches(element, selectors) { 4298 if ("matches" in element) return element.matches(selectors); 4299 if ("msMatchesSelector" in element) return element.msMatchesSelector(selectors); 4300 return element.webkitMatchesSelector(selectors); 4301 } 4302 4303 4304 4305 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/closest.js 4306 4307 4308 /** 4309 * Ponyfill for `Element.prototype.closest` 4310 * 4311 * @example 4312 * import { closest } from "reakit-utils"; 4313 * 4314 * closest(document.getElementById("id"), "div"); 4315 * // same as 4316 * document.getElementById("id").closest("div"); 4317 */ 4318 function closest(element, selectors) { 4319 if ("closest" in element) return element.closest(selectors); 4320 4321 do { 4322 if (matches(element, selectors)) return element; 4323 element = element.parentElement || element.parentNode; 4324 } while (element !== null && element.nodeType === 1); 4325 4326 return null; 4327 } 4328 4329 4330 4331 // EXTERNAL MODULE: ./node_modules/reakit-utils/es/getActiveElement.js 4332 var getActiveElement = __webpack_require__(57); 4333 4334 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/tabbable.js 4335 4336 4337 4338 4339 4340 /** @module tabbable */ 4341 var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), " + "textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], " + "iframe, object, embed, area[href], audio[controls], video[controls], " + "[contenteditable]:not([contenteditable='false'])"; 4342 4343 function isVisible(element) { 4344 return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0; 4345 } 4346 4347 function hasNegativeTabIndex(element) { 4348 var tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10); 4349 return tabIndex < 0; 4350 } 4351 /** 4352 * Checks whether `element` is focusable or not. 4353 * 4354 * @memberof tabbable 4355 * 4356 * @example 4357 * import { isFocusable } from "reakit-utils"; 4358 * 4359 * isFocusable(document.querySelector("input")); // true 4360 * isFocusable(document.querySelector("input[tabindex='-1']")); // true 4361 * isFocusable(document.querySelector("input[hidden]")); // false 4362 * isFocusable(document.querySelector("input:disabled")); // false 4363 */ 4364 4365 4366 function isFocusable(element) { 4367 return matches(element, selector) && isVisible(element); 4368 } 4369 /** 4370 * Checks whether `element` is tabbable or not. 4371 * 4372 * @memberof tabbable 4373 * 4374 * @example 4375 * import { isTabbable } from "reakit-utils"; 4376 * 4377 * isTabbable(document.querySelector("input")); // true 4378 * isTabbable(document.querySelector("input[tabindex='-1']")); // false 4379 * isTabbable(document.querySelector("input[hidden]")); // false 4380 * isTabbable(document.querySelector("input:disabled")); // false 4381 */ 4382 4383 function isTabbable(element) { 4384 return isFocusable(element) && !hasNegativeTabIndex(element); 4385 } 4386 /** 4387 * Returns all the focusable elements in `container`. 4388 * 4389 * @memberof tabbable 4390 * 4391 * @param {Element} container 4392 * 4393 * @returns {Element[]} 4394 */ 4395 4396 function getAllFocusableIn(container) { 4397 var allFocusable = Array.from(container.querySelectorAll(selector)); 4398 allFocusable.unshift(container); 4399 return allFocusable.filter(isFocusable); 4400 } 4401 /** 4402 * Returns the first focusable element in `container`. 4403 * 4404 * @memberof tabbable 4405 * 4406 * @param {Element} container 4407 * 4408 * @returns {Element|null} 4409 */ 4410 4411 function getFirstFocusableIn(container) { 4412 var allFocusable = getAllFocusableIn(container); 4413 return allFocusable.length ? allFocusable[0] : null; 4414 } 4415 /** 4416 * Returns all the tabbable elements in `container`, including the container 4417 * itself. 4418 * 4419 * @memberof tabbable 4420 * 4421 * @param {Element} container 4422 * @param fallbackToFocusable If `true`, it'll return focusable elements if there are no tabbable ones. 4423 * 4424 * @returns {Element[]} 4425 */ 4426 4427 function getAllTabbableIn(container, fallbackToFocusable) { 4428 var allFocusable = Array.from(container.querySelectorAll(selector)); 4429 var allTabbable = allFocusable.filter(isTabbable); 4430 4431 if (isTabbable(container)) { 4432 allTabbable.unshift(container); 4433 } 4434 4435 if (!allTabbable.length && fallbackToFocusable) { 4436 return allFocusable; 4437 } 4438 4439 return allTabbable; 4440 } 4441 /** 4442 * Returns the first tabbable element in `container`, including the container 4443 * itself if it's tabbable. 4444 * 4445 * @memberof tabbable 4446 * 4447 * @param {Element} container 4448 * @param fallbackToFocusable If `true`, it'll return the first focusable element if there are no tabbable ones. 4449 * 4450 * @returns {Element|null} 4451 */ 4452 4453 function getFirstTabbableIn(container, fallbackToFocusable) { 4454 var _getAllTabbableIn = getAllTabbableIn(container, fallbackToFocusable), 4455 first = _getAllTabbableIn[0]; 4456 4457 return first || null; 4458 } 4459 /** 4460 * Returns the last tabbable element in `container`, including the container 4461 * itself if it's tabbable. 4462 * 4463 * @memberof tabbable 4464 * 4465 * @param {Element} container 4466 * @param fallbackToFocusable If `true`, it'll return the last focusable element if there are no tabbable ones. 4467 * 4468 * @returns {Element|null} 4469 */ 4470 4471 function getLastTabbableIn(container, fallbackToFocusable) { 4472 var allTabbable = getAllTabbableIn(container, fallbackToFocusable); 4473 return allTabbable[allTabbable.length - 1] || null; 4474 } 4475 /** 4476 * Returns the next tabbable element in `container`. 4477 * 4478 * @memberof tabbable 4479 * 4480 * @param {Element} container 4481 * @param fallbackToFocusable If `true`, it'll return the next focusable element if there are no tabbable ones. 4482 * 4483 * @returns {Element|null} 4484 */ 4485 4486 function getNextTabbableIn(container, fallbackToFocusable) { 4487 var activeElement = Object(getActiveElement["a" /* getActiveElement */])(container); 4488 var allFocusable = getAllFocusableIn(container); 4489 var index = allFocusable.indexOf(activeElement); 4490 var slice = allFocusable.slice(index + 1); 4491 return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null); 4492 } 4493 /** 4494 * Returns the previous tabbable element in `container`. 4495 * 4496 * @memberof tabbable 4497 * 4498 * @param {Element} container 4499 * @param fallbackToFocusable If `true`, it'll return the previous focusable element if there are no tabbable ones. 4500 * 4501 * @returns {Element|null} 4502 */ 4503 4504 function getPreviousTabbableIn(container, fallbackToFocusable) { 4505 var activeElement = Object(getActiveElement["a" /* getActiveElement */])(container); 4506 var allFocusable = getAllFocusableIn(container).reverse(); 4507 var index = allFocusable.indexOf(activeElement); 4508 var slice = allFocusable.slice(index + 1); 4509 return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null); 4510 } 4511 /** 4512 * Returns the closest focusable element. 4513 * 4514 * @memberof tabbable 4515 * 4516 * @param {Element} container 4517 * 4518 * @returns {Element|null} 4519 */ 4520 4521 function getClosestFocusable(element) { 4522 while (element && !isFocusable(element)) { 4523 element = closest(element, selector); 4524 } 4525 4526 return element; 4527 } 4528 4529 function defaultIsActive(element) { 4530 return Object(getActiveElement["a" /* getActiveElement */])(element) === element; 4531 } 4532 4533 /** 4534 * Ensures `element` will receive focus if it's not already. 4535 * 4536 * @memberof tabbable 4537 * 4538 * @example 4539 * import { ensureFocus } from "reakit-utils"; 4540 * 4541 * ensureFocus(document.activeElement); // does nothing 4542 * 4543 * const element = document.querySelector("input"); 4544 * 4545 * ensureFocus(element); // focuses element 4546 * ensureFocus(element, { preventScroll: true }); // focuses element preventing scroll jump 4547 * 4548 * function isActive(el) { 4549 * return el.dataset.active === "true"; 4550 * } 4551 * 4552 * ensureFocus(document.querySelector("[data-active='true']"), { isActive }); // does nothing 4553 * 4554 * @returns {number} `requestAnimationFrame` call ID so it can be passed to `cancelAnimationFrame` if needed. 4555 */ 4556 function ensureFocus(element, _temp) { 4557 var _ref = _temp === void 0 ? {} : _temp, 4558 _ref$isActive = _ref.isActive, 4559 isActive = _ref$isActive === void 0 ? defaultIsActive : _ref$isActive, 4560 preventScroll = _ref.preventScroll; 4561 4562 if (isActive(element)) return -1; 4563 element.focus({ 4564 preventScroll: preventScroll 4565 }); 4566 if (isActive(element)) return -1; 4567 return requestAnimationFrame(function () { 4568 element.focus({ 4569 preventScroll: preventScroll 4570 }); 4571 }); 4572 } 4573 4574 4575 4576 4577 /***/ }), 4578 /* 73 */ 4579 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4580 4581 "use strict"; 4582 4583 // EXPORTS 4584 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ isPortalEvent; }); 4585 4586 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/contains.js 4587 /** 4588 * Similar to `Element.prototype.contains`. 4589 */ 4590 function contains(parent, child) { 4591 return parent === child || parent.contains(child); 4592 } 4593 4594 4595 4596 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/isPortalEvent.js 4597 4598 4599 /** 4600 * Returns `true` if `event` has been fired within a React Portal element. 4601 */ 4602 4603 function isPortalEvent(event) { 4604 return !contains(event.currentTarget, event.target); 4605 } 4606 4607 4608 4609 4610 /***/ }), 4611 /* 74 */ 4612 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4613 4614 "use strict"; 4615 /* unused harmony export Tabbable */ 4616 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useTabbable; }); 4617 /* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); 4618 /* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(51); 4619 /* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(50); 4620 /* harmony import */ var _Box_Box_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(67); 4621 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(13); 4622 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__); 4623 /* harmony import */ var reakit_utils_useForkRef__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(63); 4624 /* harmony import */ var reakit_utils_isButton__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(71); 4625 /* harmony import */ var reakit_warning__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(81); 4626 /* harmony import */ var reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(48); 4627 /* harmony import */ var reakit_utils_useIsomorphicEffect__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(59); 4628 /* harmony import */ var reakit_utils_hasFocusWithin__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(70); 4629 /* harmony import */ var reakit_utils_isPortalEvent__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(73); 4630 /* harmony import */ var reakit_utils_getActiveElement__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(57); 4631 /* harmony import */ var reakit_utils_tabbable__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(72); 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 function isUA(string) { 4649 if (typeof window === "undefined") return false; 4650 return window.navigator.userAgent.indexOf(string) !== -1; 4651 } 4652 4653 var isSafariOrFirefoxOnMac = isUA("Mac") && !isUA("Chrome") && (isUA("Safari") || isUA("Firefox")); 4654 4655 function focusIfNeeded(element) { 4656 if (!Object(reakit_utils_hasFocusWithin__WEBPACK_IMPORTED_MODULE_10__[/* hasFocusWithin */ "a"])(element)) { 4657 element.focus(); 4658 } 4659 } // Safari and Firefox on MacOS don't focus on buttons on mouse down like other 4660 // browsers/platforms. Instead, they focus on the closest focusable ancestor 4661 // element, which is ultimately the body element. So we make sure to give focus 4662 // to the tabbable element on mouse down so it works consistently across 4663 // browsers. 4664 // istanbul ignore next 4665 4666 4667 function useFocusOnMouseDown() { 4668 if (!isSafariOrFirefoxOnMac) return undefined; 4669 4670 var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_4__["useState"])(null), 4671 tabbable = _React$useState[0], 4672 scheduleFocus = _React$useState[1]; 4673 4674 Object(react__WEBPACK_IMPORTED_MODULE_4__["useEffect"])(function () { 4675 if (!tabbable) return; 4676 focusIfNeeded(tabbable); 4677 scheduleFocus(null); 4678 }, [tabbable]); 4679 var onMouseDown = Object(react__WEBPACK_IMPORTED_MODULE_4__["useCallback"])(function (event) { 4680 var element = event.currentTarget; 4681 if (Object(reakit_utils_isPortalEvent__WEBPACK_IMPORTED_MODULE_11__[/* isPortalEvent */ "a"])(event)) return; 4682 if (!Object(reakit_utils_isButton__WEBPACK_IMPORTED_MODULE_6__[/* isButton */ "a"])(element)) return; 4683 var activeElement = Object(reakit_utils_getActiveElement__WEBPACK_IMPORTED_MODULE_12__[/* getActiveElement */ "a"])(element); 4684 if (!activeElement) return; 4685 var activeElementIsBody = activeElement.tagName === "BODY"; 4686 var focusableAncestor = Object(reakit_utils_tabbable__WEBPACK_IMPORTED_MODULE_13__[/* getClosestFocusable */ "b"])(element.parentElement); 4687 4688 if (activeElement === focusableAncestor || activeElementIsBody && !focusableAncestor) { 4689 // When the active element is the focusable ancestor, it'll not emit 4690 // focus/blur events. After all, it's already focused. So we can't 4691 // listen to those events to focus this tabbable element. 4692 // When the active element is body and there's no focusable ancestor, 4693 // we also don't have any other event to listen to since body never 4694 // emits focus/blur events on itself. 4695 // In both of these cases, we have to schedule focus on this tabbable 4696 // element. 4697 scheduleFocus(element); 4698 } else if (focusableAncestor) { 4699 // Clicking (mouse down) on the tabbable element on Safari and Firefox 4700 // on MacOS will fire focus on the focusable ancestor element if 4701 // there's any and if it's not the current active element. So we wait 4702 // for this event to happen before moving focus to this element. 4703 // Instead of moving focus right away, we have to schedule it, 4704 // otherwise it's gonna prevent drag events from happening. 4705 var onFocus = function onFocus() { 4706 return scheduleFocus(element); 4707 }; 4708 4709 focusableAncestor.addEventListener("focusin", onFocus, { 4710 once: true 4711 }); 4712 } else { 4713 // Finally, if there's no focsuable ancestor and there's another 4714 // element with focus, we wait for that element to get blurred before 4715 // focusing this one. 4716 var onBlur = function onBlur() { 4717 return focusIfNeeded(element); 4718 }; 4719 4720 activeElement.addEventListener("blur", onBlur, { 4721 once: true 4722 }); 4723 } 4724 }, []); 4725 return onMouseDown; 4726 } 4727 4728 function isNativeTabbable(element) { 4729 return element.tagName === "BUTTON" || element.tagName === "INPUT" || element.tagName === "SELECT" || element.tagName === "TEXTAREA" || element.tagName === "A" || element.tagName === "AUDIO" || element.tagName === "VIDEO"; 4730 } 4731 4732 var useTabbable = Object(reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__[/* createHook */ "a"])({ 4733 name: "Tabbable", 4734 compose: _Box_Box_js__WEBPACK_IMPORTED_MODULE_3__[/* useBox */ "a"], 4735 keys: ["disabled", "focusable"], 4736 useOptions: function useOptions(options, _ref) { 4737 var disabled = _ref.disabled; 4738 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({ 4739 disabled: disabled 4740 }, options); 4741 }, 4742 useProps: function useProps(options, _ref2) { 4743 var htmlRef = _ref2.ref, 4744 htmlTabIndex = _ref2.tabIndex, 4745 htmlOnClick = _ref2.onClick, 4746 htmlOnMouseDown = _ref2.onMouseDown, 4747 htmlStyle = _ref2.style, 4748 htmlProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_ref2, ["ref", "tabIndex", "onClick", "onMouseDown", "style"]); 4749 4750 var ref = Object(react__WEBPACK_IMPORTED_MODULE_4__["useRef"])(null); 4751 var onClickRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_8__[/* useLiveRef */ "a"])(htmlOnClick); 4752 var onMouseDownRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_8__[/* useLiveRef */ "a"])(htmlOnMouseDown); 4753 var trulyDisabled = options.disabled && !options.focusable; 4754 4755 var _React$useState2 = Object(react__WEBPACK_IMPORTED_MODULE_4__["useState"])(true), 4756 nativeTabbable = _React$useState2[0], 4757 setNativeTabbable = _React$useState2[1]; 4758 4759 var tabIndex = nativeTabbable ? htmlTabIndex : htmlTabIndex || 0; 4760 var style = options.disabled ? Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({ 4761 pointerEvents: "none" 4762 }, htmlStyle) : htmlStyle; 4763 var focusOnMouseDown = useFocusOnMouseDown(); 4764 Object(reakit_utils_useIsomorphicEffect__WEBPACK_IMPORTED_MODULE_9__[/* useIsomorphicEffect */ "a"])(function () { 4765 var tabbable = ref.current; 4766 4767 if (!tabbable) { 4768 false ? undefined : void 0; 4769 return; 4770 } 4771 4772 if (!isNativeTabbable(tabbable)) { 4773 setNativeTabbable(false); 4774 } 4775 }, []); 4776 var onClick = Object(react__WEBPACK_IMPORTED_MODULE_4__["useCallback"])(function (event) { 4777 var _onClickRef$current; 4778 4779 if (options.disabled) { 4780 event.stopPropagation(); 4781 event.preventDefault(); 4782 return; 4783 } 4784 4785 (_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event); 4786 }, [options.disabled]); 4787 var onMouseDown = Object(react__WEBPACK_IMPORTED_MODULE_4__["useCallback"])(function (event) { 4788 var _onMouseDownRef$curre; 4789 4790 if (options.disabled) { 4791 event.stopPropagation(); 4792 event.preventDefault(); 4793 return; 4794 } 4795 4796 (_onMouseDownRef$curre = onMouseDownRef.current) === null || _onMouseDownRef$curre === void 0 ? void 0 : _onMouseDownRef$curre.call(onMouseDownRef, event); 4797 if (event.defaultPrevented) return; 4798 focusOnMouseDown === null || focusOnMouseDown === void 0 ? void 0 : focusOnMouseDown(event); 4799 }, [options.disabled, focusOnMouseDown]); 4800 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({ 4801 ref: Object(reakit_utils_useForkRef__WEBPACK_IMPORTED_MODULE_5__[/* useForkRef */ "a"])(ref, htmlRef), 4802 style: style, 4803 tabIndex: !trulyDisabled ? tabIndex : undefined, 4804 disabled: trulyDisabled && nativeTabbable ? true : undefined, 4805 "aria-disabled": options.disabled ? true : undefined, 4806 onClick: onClick, 4807 onMouseDown: onMouseDown 4808 }, htmlProps); 4809 } 4810 }); 4811 var Tabbable = Object(reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__[/* createComponent */ "a"])({ 4812 as: "div", 4813 useHook: useTabbable 4814 }); 4815 4816 4817 4818 4819 /***/ }), 4820 /* 75 */ 4821 /***/ (function(module, exports) { 4822 4823 (function() { module.exports = this["wp"]["date"]; }()); 4824 4825 /***/ }), 4826 /* 76 */ 4827 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4828 4829 "use strict"; 4830 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SystemContext; }); 4831 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); 4832 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 4833 4834 4835 var SystemContext = /*#__PURE__*/Object(react__WEBPACK_IMPORTED_MODULE_0__["createContext"])({}); 4836 4837 4838 4839 4840 /***/ }), 4841 /* 77 */, 4842 /* 78 */ 4843 /***/ (function(module, exports, __webpack_require__) { 4844 4845 "use strict"; 4846 4847 4848 Object.defineProperty(exports, "__esModule", { 4849 value: true 4850 }); 4851 var DISPLAY_FORMAT = exports.DISPLAY_FORMAT = 'L'; 4852 var ISO_FORMAT = exports.ISO_FORMAT = 'YYYY-MM-DD'; 4853 var ISO_MONTH_FORMAT = exports.ISO_MONTH_FORMAT = 'YYYY-MM'; 4854 4855 var START_DATE = exports.START_DATE = 'startDate'; 4856 var END_DATE = exports.END_DATE = 'endDate'; 4857 4858 var HORIZONTAL_ORIENTATION = exports.HORIZONTAL_ORIENTATION = 'horizontal'; 4859 var VERTICAL_ORIENTATION = exports.VERTICAL_ORIENTATION = 'vertical'; 4860 var VERTICAL_SCROLLABLE = exports.VERTICAL_SCROLLABLE = 'verticalScrollable'; 4861 4862 var ICON_BEFORE_POSITION = exports.ICON_BEFORE_POSITION = 'before'; 4863 var ICON_AFTER_POSITION = exports.ICON_AFTER_POSITION = 'after'; 4864 4865 var INFO_POSITION_TOP = exports.INFO_POSITION_TOP = 'top'; 4866 var INFO_POSITION_BOTTOM = exports.INFO_POSITION_BOTTOM = 'bottom'; 4867 var INFO_POSITION_BEFORE = exports.INFO_POSITION_BEFORE = 'before'; 4868 var INFO_POSITION_AFTER = exports.INFO_POSITION_AFTER = 'after'; 4869 4870 var ANCHOR_LEFT = exports.ANCHOR_LEFT = 'left'; 4871 var ANCHOR_RIGHT = exports.ANCHOR_RIGHT = 'right'; 4872 4873 var OPEN_DOWN = exports.OPEN_DOWN = 'down'; 4874 var OPEN_UP = exports.OPEN_UP = 'up'; 4875 4876 var DAY_SIZE = exports.DAY_SIZE = 39; 4877 var BLOCKED_MODIFIER = exports.BLOCKED_MODIFIER = 'blocked'; 4878 var WEEKDAYS = exports.WEEKDAYS = [0, 1, 2, 3, 4, 5, 6]; 4879 4880 var FANG_WIDTH_PX = exports.FANG_WIDTH_PX = 20; 4881 var FANG_HEIGHT_PX = exports.FANG_HEIGHT_PX = 10; 4882 var DEFAULT_VERTICAL_SPACING = exports.DEFAULT_VERTICAL_SPACING = 22; 4883 4884 var MODIFIER_KEY_NAMES = exports.MODIFIER_KEY_NAMES = new Set(['Shift', 'Control', 'Alt', 'Meta']); 4885 4886 /***/ }), 4887 /* 79 */ 4888 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4889 4890 "use strict"; 4891 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useCreateElement; }); 4892 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); 4893 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 4894 /* harmony import */ var _SystemContext_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(76); 4895 /* harmony import */ var _rollupPluginBabelHelpers_0c84a174_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(55); 4896 4897 4898 4899 4900 function isRenderProp(children) { 4901 return typeof children === "function"; 4902 } 4903 4904 /** 4905 * Custom hook that will call `children` if it's a function. If 4906 * `useCreateElement` has been passed to the context, it'll be used instead. 4907 * 4908 * @example 4909 * import React from "react"; 4910 * import { SystemProvider, useCreateElement } from "reakit-system"; 4911 * 4912 * const system = { 4913 * useCreateElement(type, props, children = props.children) { 4914 * // very similar to what `useCreateElement` does already 4915 * if (typeof children === "function") { 4916 * const { children: _, ...rest } = props; 4917 * return children(rest); 4918 * } 4919 * return React.createElement(type, props, children); 4920 * }, 4921 * }; 4922 * 4923 * function Component(props) { 4924 * return useCreateElement("div", props); 4925 * } 4926 * 4927 * function App() { 4928 * return ( 4929 * <SystemProvider unstable_system={system}> 4930 * <Component url="url">{({ url }) => <a href={url}>link</a>}</Component> 4931 * </SystemProvider> 4932 * ); 4933 * } 4934 */ 4935 4936 var useCreateElement = function useCreateElement(type, props, children) { 4937 if (children === void 0) { 4938 children = props.children; 4939 } 4940 4941 var context = Object(react__WEBPACK_IMPORTED_MODULE_0__["useContext"])(_SystemContext_js__WEBPACK_IMPORTED_MODULE_1__[/* SystemContext */ "a"]); 4942 4943 if (context.useCreateElement) { 4944 return context.useCreateElement(type, props, children); 4945 } 4946 4947 if (typeof type === "string" && isRenderProp(children)) { 4948 var _ = props.children, 4949 rest = Object(_rollupPluginBabelHelpers_0c84a174_js__WEBPACK_IMPORTED_MODULE_2__[/* a */ "b"])(props, ["children"]); 4950 4951 return children(rest); 4952 } 4953 4954 return /*#__PURE__*/Object(react__WEBPACK_IMPORTED_MODULE_0__["createElement"])(type, props, children); 4955 }; 4956 4957 4958 4959 4960 /***/ }), 4961 /* 80 */, 4962 /* 81 */ 4963 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4964 4965 "use strict"; 4966 4967 // UNUSED EXPORTS: warning, useWarning 4968 4969 // EXTERNAL MODULE: ./node_modules/reakit-warning/es/warning.js 4970 var warning = __webpack_require__(109); 4971 4972 // EXTERNAL MODULE: external {"this":"React"} 4973 var external_this_React_ = __webpack_require__(13); 4974 4975 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/isObject.js 4976 /** 4977 * Checks whether `arg` is an object or not. 4978 * 4979 * @returns {boolean} 4980 */ 4981 function isObject(arg) { 4982 return typeof arg === "object" && arg != null; 4983 } 4984 4985 4986 4987 // CONCATENATED MODULE: ./node_modules/reakit-warning/es/useWarning.js 4988 4989 4990 4991 4992 4993 function isRefObject(ref) { 4994 return isObject(ref) && "current" in ref; 4995 } 4996 /** 4997 * Logs `messages` to the console using `console.warn` based on a `condition`. 4998 * This should be used inside components. 4999 */ 5000 5001 5002 function useWarning(condition) { 5003 for (var _len = arguments.length, messages = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 5004 messages[_key - 1] = arguments[_key]; 5005 } 5006 5007 if (false) {} 5008 } 5009 5010 5011 5012 // CONCATENATED MODULE: ./node_modules/reakit-warning/es/index.js 5013 5014 5015 5016 5017 5018 5019 5020 /***/ }), 5021 /* 82 */ 5022 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5023 5024 "use strict"; 5025 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createOnKeyDown; }); 5026 /** 5027 * Returns an `onKeyDown` handler to be passed to a component. 5028 * 5029 * @param options 5030 */ 5031 function createOnKeyDown(_temp) { 5032 var _ref = _temp === void 0 ? {} : _temp, 5033 keyMap = _ref.keyMap, 5034 onKey = _ref.onKey, 5035 stopPropagation = _ref.stopPropagation, 5036 onKeyDown = _ref.onKeyDown, 5037 _ref$shouldKeyDown = _ref.shouldKeyDown, 5038 shouldKeyDown = _ref$shouldKeyDown === void 0 ? function () { 5039 return true; 5040 } : _ref$shouldKeyDown, 5041 _ref$preventDefault = _ref.preventDefault, 5042 preventDefault = _ref$preventDefault === void 0 ? true : _ref$preventDefault; 5043 5044 return function (event) { 5045 if (!keyMap) return; 5046 var finalKeyMap = typeof keyMap === "function" ? keyMap(event) : keyMap; 5047 var shouldPreventDefault = typeof preventDefault === "function" ? preventDefault(event) : preventDefault; 5048 var shouldStopPropagation = typeof stopPropagation === "function" ? stopPropagation(event) : stopPropagation; 5049 5050 if (event.key in finalKeyMap) { 5051 var action = finalKeyMap[event.key]; 5052 5053 if (typeof action === "function" && shouldKeyDown(event)) { 5054 if (shouldPreventDefault) event.preventDefault(); 5055 if (shouldStopPropagation) event.stopPropagation(); 5056 if (onKey) onKey(event); 5057 action(event); // Prevent onKeyDown from being called twice for the same keys 5058 5059 return; 5060 } 5061 } 5062 5063 if (onKeyDown && "current" in onKeyDown) { 5064 var _onKeyDown$current; 5065 5066 (_onKeyDown$current = onKeyDown.current) === null || _onKeyDown$current === void 0 ? void 0 : _onKeyDown$current.call(onKeyDown, event); 5067 } else { 5068 onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event); 5069 } 5070 }; 5071 } 5072 5073 5074 5075 5076 /***/ }), 5077 /* 83 */, 5078 /* 84 */ 5079 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5080 5081 "use strict"; 5082 /* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21); 5083 /* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22); 5084 /* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(23); 5085 /* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(24); 5086 /* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(19); 5087 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(0); 5088 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__); 5089 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(2); 5090 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_6__); 5091 /* harmony import */ var _popover__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(114); 5092 /* harmony import */ var _shortcut__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(172); 5093 5094 5095 5096 5097 5098 5099 5100 function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(this, result); }; } 5101 5102 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 5103 5104 /** 5105 * External dependencies 5106 */ 5107 5108 /** 5109 * WordPress dependencies 5110 */ 5111 5112 5113 /** 5114 * Internal dependencies 5115 */ 5116 5117 5118 5119 /** 5120 * Time over children to wait before showing tooltip 5121 * 5122 * @type {number} 5123 */ 5124 5125 var TOOLTIP_DELAY = 700; 5126 5127 var Tooltip = /*#__PURE__*/function (_Component) { 5128 Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(Tooltip, _Component); 5129 5130 var _super = _createSuper(Tooltip); 5131 5132 function Tooltip() { 5133 var _this; 5134 5135 Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(this, Tooltip); 5136 5137 _this = _super.apply(this, arguments); 5138 _this.delayedSetIsOver = Object(lodash__WEBPACK_IMPORTED_MODULE_6__["debounce"])(function (isOver) { 5139 return _this.setState({ 5140 isOver: isOver 5141 }); 5142 }, TOOLTIP_DELAY); 5143 /** 5144 * Prebound `isInMouseDown` handler, created as a constant reference to 5145 * assure ability to remove in component unmount. 5146 * 5147 * @type {Function} 5148 */ 5149 5150 _this.cancelIsMouseDown = _this.createSetIsMouseDown(false); 5151 /** 5152 * Whether a the mouse is currently pressed, used in determining whether 5153 * to handle a focus event as displaying the tooltip immediately. 5154 * 5155 * @type {boolean} 5156 */ 5157 5158 _this.isInMouseDown = false; 5159 _this.state = { 5160 isOver: false 5161 }; 5162 return _this; 5163 } 5164 5165 Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(Tooltip, [{ 5166 key: "componentWillUnmount", 5167 value: function componentWillUnmount() { 5168 this.delayedSetIsOver.cancel(); 5169 document.removeEventListener('mouseup', this.cancelIsMouseDown); 5170 } 5171 }, { 5172 key: "emitToChild", 5173 value: function emitToChild(eventName, event) { 5174 var children = this.props.children; 5175 5176 if (_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["Children"].count(children) !== 1) { 5177 return; 5178 } 5179 5180 var child = _wordpress_element__WEBPACK_IMPORTED_MODULE_5__["Children"].only(children); 5181 5182 if (typeof child.props[eventName] === 'function') { 5183 child.props[eventName](event); 5184 } 5185 } 5186 }, { 5187 key: "createToggleIsOver", 5188 value: function createToggleIsOver(eventName, isDelayed) { 5189 var _this2 = this; 5190 5191 return function (event) { 5192 // Preserve original child callback behavior 5193 _this2.emitToChild(eventName, event); // Mouse events behave unreliably in React for disabled elements, 5194 // firing on mouseenter but not mouseleave. Further, the default 5195 // behavior for disabled elements in some browsers is to ignore 5196 // mouse events. Don't bother trying to to handle them. 5197 // 5198 // See: https://github.com/facebook/react/issues/4251 5199 5200 5201 if (event.currentTarget.disabled) { 5202 return; 5203 } // A focus event will occur as a result of a mouse click, but it 5204 // should be disambiguated between interacting with the button and 5205 // using an explicit focus shift as a cue to display the tooltip. 5206 5207 5208 if ('focus' === event.type && _this2.isInMouseDown) { 5209 return; 5210 } // Needed in case unsetting is over while delayed set pending, i.e. 5211 // quickly blur/mouseleave before delayedSetIsOver is called 5212 5213 5214 _this2.delayedSetIsOver.cancel(); 5215 5216 var isOver = Object(lodash__WEBPACK_IMPORTED_MODULE_6__["includes"])(['focus', 'mouseenter'], event.type); 5217 5218 if (isOver === _this2.state.isOver) { 5219 return; 5220 } 5221 5222 if (isDelayed) { 5223 _this2.delayedSetIsOver(isOver); 5224 } else { 5225 _this2.setState({ 5226 isOver: isOver 5227 }); 5228 } 5229 }; 5230 } 5231 /** 5232 * Creates an event callback to handle assignment of the `isInMouseDown` 5233 * instance property in response to a `mousedown` or `mouseup` event. 5234 * 5235 * @param {boolean} isMouseDown Whether handler is to be created for the 5236 * `mousedown` event, as opposed to `mouseup`. 5237 * 5238 * @return {Function} Event callback handler. 5239 */ 5240 5241 }, { 5242 key: "createSetIsMouseDown", 5243 value: function createSetIsMouseDown(isMouseDown) { 5244 var _this3 = this; 5245 5246 return function (event) { 5247 // Preserve original child callback behavior 5248 _this3.emitToChild(isMouseDown ? 'onMouseDown' : 'onMouseUp', event); // On mouse down, the next `mouseup` should revert the value of the 5249 // instance property and remove its own event handler. The bind is 5250 // made on the document since the `mouseup` might not occur within 5251 // the bounds of the element. 5252 5253 5254 document[isMouseDown ? 'addEventListener' : 'removeEventListener']('mouseup', _this3.cancelIsMouseDown); 5255 _this3.isInMouseDown = isMouseDown; 5256 }; 5257 } 5258 }, { 5259 key: "render", 5260 value: function render() { 5261 var _this$props = this.props, 5262 children = _this$props.children, 5263 position = _this$props.position, 5264 text = _this$props.text, 5265 shortcut = _this$props.shortcut; 5266 5267 if (_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["Children"].count(children) !== 1) { 5268 if (false) {} 5269 5270 return children; 5271 } 5272 5273 var child = _wordpress_element__WEBPACK_IMPORTED_MODULE_5__["Children"].only(children); 5274 var isOver = this.state.isOver; 5275 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["cloneElement"])(child, { 5276 onMouseEnter: this.createToggleIsOver('onMouseEnter', true), 5277 onMouseLeave: this.createToggleIsOver('onMouseLeave'), 5278 onClick: this.createToggleIsOver('onClick'), 5279 onFocus: this.createToggleIsOver('onFocus'), 5280 onBlur: this.createToggleIsOver('onBlur'), 5281 onMouseDown: this.createSetIsMouseDown(true), 5282 children: Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["concatChildren"])(child.props.children, isOver && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["createElement"])(_popover__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"], { 5283 focusOnMount: false, 5284 position: position, 5285 className: "components-tooltip", 5286 "aria-hidden": "true", 5287 animate: false, 5288 noArrow: true 5289 }, text, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["createElement"])(_shortcut__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"], { 5290 className: "components-tooltip__shortcut", 5291 shortcut: shortcut 5292 }))) 5293 }); 5294 } 5295 }]); 5296 5297 return Tooltip; 5298 }(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__["Component"]); 5299 5300 /* harmony default export */ __webpack_exports__["a"] = (Tooltip); 5301 5302 5303 /***/ }), 5304 /* 85 */ 5305 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5306 5307 "use strict"; 5308 /* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5); 5309 /* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8); 5310 /* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(14); 5311 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(0); 5312 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__); 5313 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7); 5314 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_4__); 5315 /* harmony import */ var _dashicon__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(150); 5316 5317 5318 5319 5320 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; } 5321 5322 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 5323 5324 /** 5325 * WordPress dependencies 5326 */ 5327 5328 5329 /** 5330 * Internal dependencies 5331 */ 5332 5333 5334 5335 function Icon(_ref) { 5336 var _ref$icon = _ref.icon, 5337 icon = _ref$icon === void 0 ? null : _ref$icon, 5338 size = _ref.size, 5339 additionalProps = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(_ref, ["icon", "size"]); 5340 5341 if ('string' === typeof icon) { 5342 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_dashicon__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"], Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])({ 5343 icon: icon 5344 }, additionalProps)); 5345 } 5346 5347 if (icon && _dashicon__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"] === icon.type) { 5348 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["cloneElement"])(icon, _objectSpread({}, additionalProps)); 5349 } // Icons should be 24x24 by default. 5350 5351 5352 var iconSize = size || 24; 5353 5354 if ('function' === typeof icon) { 5355 if (icon.prototype instanceof _wordpress_element__WEBPACK_IMPORTED_MODULE_3__["Component"]) { 5356 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(icon, _objectSpread({ 5357 size: iconSize 5358 }, additionalProps)); 5359 } 5360 5361 return icon(_objectSpread({ 5362 size: iconSize 5363 }, additionalProps)); 5364 } 5365 5366 if (icon && (icon.type === 'svg' || icon.type === _wordpress_primitives__WEBPACK_IMPORTED_MODULE_4__["SVG"])) { 5367 var appliedProps = _objectSpread(_objectSpread({ 5368 width: iconSize, 5369 height: iconSize 5370 }, icon.props), additionalProps); 5371 5372 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_4__["SVG"], appliedProps); 5373 } 5374 5375 if (Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["isValidElement"])(icon)) { 5376 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_3__["cloneElement"])(icon, _objectSpread({ 5377 size: iconSize 5378 }, additionalProps)); 5379 } 5380 5381 return icon; 5382 } 5383 5384 /* harmony default export */ __webpack_exports__["a"] = (Icon); 5385 5386 5387 /***/ }), 5388 /* 86 */, 5389 /* 87 */, 5390 /* 88 */ 5391 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5392 5393 "use strict"; 5394 /* unused harmony export Clickable */ 5395 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useClickable; }); 5396 /* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); 5397 /* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(51); 5398 /* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(50); 5399 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(13); 5400 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__); 5401 /* harmony import */ var reakit_utils_isButton__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(71); 5402 /* harmony import */ var reakit_warning__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(81); 5403 /* harmony import */ var reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(48); 5404 /* harmony import */ var reakit_utils_isSelfTarget__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(54); 5405 /* harmony import */ var _Tabbable_Tabbable_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(74); 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 function isNativeClick(event) { 5425 var element = event.currentTarget; 5426 if (!event.isTrusted) return false; // istanbul ignore next: can't test trusted events yet 5427 5428 return Object(reakit_utils_isButton__WEBPACK_IMPORTED_MODULE_4__[/* isButton */ "a"])(element) || element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.tagName === "A" || element.tagName === "SELECT"; 5429 } 5430 5431 var useClickable = Object(reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__[/* createHook */ "a"])({ 5432 name: "Clickable", 5433 compose: _Tabbable_Tabbable_js__WEBPACK_IMPORTED_MODULE_8__[/* useTabbable */ "a"], 5434 keys: ["unstable_clickOnEnter", "unstable_clickOnSpace"], 5435 useOptions: function useOptions(_ref) { 5436 var _ref$unstable_clickOn = _ref.unstable_clickOnEnter, 5437 unstable_clickOnEnter = _ref$unstable_clickOn === void 0 ? true : _ref$unstable_clickOn, 5438 _ref$unstable_clickOn2 = _ref.unstable_clickOnSpace, 5439 unstable_clickOnSpace = _ref$unstable_clickOn2 === void 0 ? true : _ref$unstable_clickOn2, 5440 options = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_ref, ["unstable_clickOnEnter", "unstable_clickOnSpace"]); 5441 5442 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({ 5443 unstable_clickOnEnter: unstable_clickOnEnter, 5444 unstable_clickOnSpace: unstable_clickOnSpace 5445 }, options); 5446 }, 5447 useProps: function useProps(options, _ref2) { 5448 var htmlOnKeyDown = _ref2.onKeyDown, 5449 htmlOnKeyUp = _ref2.onKeyUp, 5450 htmlProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_ref2, ["onKeyDown", "onKeyUp"]); 5451 5452 var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_3__["useState"])(false), 5453 active = _React$useState[0], 5454 setActive = _React$useState[1]; 5455 5456 var onKeyDownRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__[/* useLiveRef */ "a"])(htmlOnKeyDown); 5457 var onKeyUpRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__[/* useLiveRef */ "a"])(htmlOnKeyUp); 5458 var onKeyDown = Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) { 5459 var _onKeyDownRef$current; 5460 5461 (_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event); 5462 if (event.defaultPrevented) return; 5463 if (options.disabled) return; 5464 if (event.metaKey) return; 5465 if (!Object(reakit_utils_isSelfTarget__WEBPACK_IMPORTED_MODULE_7__[/* isSelfTarget */ "a"])(event)) return; 5466 var isEnter = options.unstable_clickOnEnter && event.key === "Enter"; 5467 var isSpace = options.unstable_clickOnSpace && event.key === " "; 5468 5469 if (isEnter || isSpace) { 5470 if (isNativeClick(event)) return; 5471 event.preventDefault(); 5472 5473 if (isEnter) { 5474 event.currentTarget.click(); 5475 } else if (isSpace) { 5476 setActive(true); 5477 } 5478 } 5479 }, [options.disabled, options.unstable_clickOnEnter, options.unstable_clickOnSpace]); 5480 var onKeyUp = Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) { 5481 var _onKeyUpRef$current; 5482 5483 (_onKeyUpRef$current = onKeyUpRef.current) === null || _onKeyUpRef$current === void 0 ? void 0 : _onKeyUpRef$current.call(onKeyUpRef, event); 5484 if (event.defaultPrevented) return; 5485 if (options.disabled) return; 5486 if (event.metaKey) return; 5487 var isSpace = options.unstable_clickOnSpace && event.key === " "; 5488 5489 if (active && isSpace) { 5490 setActive(false); 5491 event.currentTarget.click(); 5492 } 5493 }, [options.disabled, options.unstable_clickOnSpace, active]); 5494 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({ 5495 "data-active": active || undefined, 5496 onKeyDown: onKeyDown, 5497 onKeyUp: onKeyUp 5498 }, htmlProps); 5499 } 5500 }); 5501 var Clickable = Object(reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__[/* createComponent */ "a"])({ 5502 as: "button", 5503 memo: true, 5504 useHook: useClickable 5505 }); 5506 5507 5508 5509 5510 /***/ }), 5511 /* 89 */ 5512 /***/ (function(module, exports, __webpack_require__) { 5513 5514 module.exports = true ? __webpack_require__(379) : undefined; 5515 5516 5517 5518 /***/ }), 5519 /* 90 */ 5520 /***/ (function(module, exports) { 5521 5522 (function() { module.exports = this["wp"]["warning"]; }()); 5523 5524 /***/ }), 5525 /* 91 */ 5526 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5527 5528 "use strict"; 5529 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); 5530 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 5531 /** 5532 * WordPress dependencies 5533 */ 5534 5535 var ToolbarContext = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createContext"])(); 5536 /* harmony default export */ __webpack_exports__["a"] = (ToolbarContext); 5537 5538 5539 /***/ }), 5540 /* 92 */, 5541 /* 93 */ 5542 /***/ (function(module, exports, __webpack_require__) { 5543 5544 "use strict"; 5545 5546 5547 var ES5Type = __webpack_require__(340); 5548 5549 // https://ecma-international.org/ecma-262/6.0/#sec-ecmascript-data-types-and-values 5550 5551 module.exports = function Type(x) { 5552 if (typeof x === 'symbol') { 5553 return 'Symbol'; 5554 } 5555 return ES5Type(x); 5556 }; 5557 5558 5559 /***/ }), 5560 /* 94 */ 5561 /***/ (function(module, exports, __webpack_require__) { 5562 5563 "use strict"; 5564 5565 5566 var bind = __webpack_require__(120); 5567 5568 module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); 5569 5570 5571 /***/ }), 5572 /* 95 */ 5573 /***/ (function(module, exports, __webpack_require__) { 5574 5575 "use strict"; 5576 5577 5578 var defineProperties = __webpack_require__(104); 5579 5580 var implementation = __webpack_require__(239); 5581 var getPolyfill = __webpack_require__(240); 5582 var shim = __webpack_require__(376); 5583 5584 var polyfill = getPolyfill(); 5585 5586 defineProperties(polyfill, { 5587 getPolyfill: getPolyfill, 5588 implementation: implementation, 5589 shim: shim 5590 }); 5591 5592 module.exports = polyfill; 5593 5594 5595 /***/ }), 5596 /* 96 */ 5597 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5598 5599 "use strict"; 5600 /* unused harmony export unstable_Id */ 5601 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return unstable_useId; }); 5602 /* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); 5603 /* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(51); 5604 /* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(50); 5605 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(13); 5606 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__); 5607 /* harmony import */ var _IdProvider_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(68); 5608 /* harmony import */ var _IdState_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65); 5609 5610 5611 5612 5613 5614 5615 5616 5617 var unstable_useId = Object(reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__[/* createHook */ "a"])({ 5618 useState: _IdState_js__WEBPACK_IMPORTED_MODULE_5__[/* unstable_useIdState */ "a"], 5619 keys: ["id"], 5620 useOptions: function useOptions(options, htmlProps) { 5621 var generateId = Object(react__WEBPACK_IMPORTED_MODULE_3__["useContext"])(_IdProvider_js__WEBPACK_IMPORTED_MODULE_4__[/* unstable_IdContext */ "a"]); 5622 5623 var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_3__["useState"])(function () { 5624 // This comes from useIdState 5625 if (options.unstable_idCountRef) { 5626 options.unstable_idCountRef.current += 1; 5627 return "-" + options.unstable_idCountRef.current; 5628 } // If there's no useIdState, we check if `baseId` was passed (as a prop, 5629 // not from useIdState). 5630 5631 5632 if (options.baseId) { 5633 return "-" + generateId(""); 5634 } 5635 5636 return ""; 5637 }), 5638 suffix = _React$useState[0]; // `baseId` will be the prop passed directly as a prop or via useIdState. 5639 // If there's neither, then it'll fallback to Context's generateId. 5640 // This generateId can result in a sequential ID (if there's a Provider) 5641 // or a random string (without Provider). 5642 5643 5644 var baseId = Object(react__WEBPACK_IMPORTED_MODULE_3__["useMemo"])(function () { 5645 return options.baseId || generateId(); 5646 }, [options.baseId, generateId]); 5647 var id = htmlProps.id || options.id || "" + baseId + suffix; 5648 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, options), {}, { 5649 id: id 5650 }); 5651 }, 5652 useProps: function useProps(options, htmlProps) { 5653 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({ 5654 id: options.id 5655 }, htmlProps); 5656 } 5657 }); 5658 var unstable_Id = Object(reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__[/* createComponent */ "a"])({ 5659 as: "div", 5660 useHook: unstable_useId 5661 }); 5662 5663 5664 5665 5666 /***/ }), 5667 /* 97 */ 5668 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5669 5670 "use strict"; 5671 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return fireEvent; }); 5672 /* harmony import */ var _createEvent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(126); 5673 5674 5675 5676 /** 5677 * Creates and dispatches `Event` in a way that also works on IE 11. 5678 * 5679 * @example 5680 * import { fireEvent } from "reakit-utils"; 5681 * 5682 * fireEvent(document.getElementById("id"), "blur", { 5683 * bubbles: true, 5684 * cancelable: true, 5685 * }); 5686 */ 5687 5688 function fireEvent(element, type, eventInit) { 5689 return element.dispatchEvent(Object(_createEvent_js__WEBPACK_IMPORTED_MODULE_0__[/* createEvent */ "a"])(element, type, eventInit)); 5690 } 5691 5692 5693 5694 5695 /***/ }), 5696 /* 98 */ 5697 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5698 5699 "use strict"; 5700 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isTextField; }); 5701 /** 5702 * Check whether the given element is a text field, where text field is defined 5703 * by the ability to select within the input, or that it is contenteditable. 5704 */ 5705 function isTextField(element) { 5706 try { 5707 var isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null; 5708 var isTextArea = element.tagName === "TEXTAREA"; 5709 var isContentEditable = element.contentEditable === "true"; 5710 return isTextInput || isTextArea || isContentEditable || false; 5711 } catch (error) { 5712 // Safari throws an exception when trying to get `selectionStart` 5713 // on non-text <input> elements (which, understandably, don't 5714 // have the text selection API). We catch this via a try/catch 5715 // block, as opposed to a more explicit check of the element's 5716 // input types, because of Safari's non-standard behavior. This 5717 // also means we don't have to worry about the list of input 5718 // types that support `selectionStart` changing as the HTML spec 5719 // evolves over time. 5720 return false; 5721 } 5722 } 5723 5724 5725 5726 5727 /***/ }), 5728 /* 99 */ 5729 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5730 5731 "use strict"; 5732 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return setTextFieldValue; }); 5733 function setTextFieldValue(element, value) { 5734 element.value = value; 5735 } 5736 5737 5738 5739 5740 /***/ }), 5741 /* 100 */, 5742 /* 101 */, 5743 /* 102 */ 5744 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5745 5746 "use strict"; 5747 /* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8); 5748 /* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21); 5749 /* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(22); 5750 /* harmony import */ var _babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(16); 5751 /* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23); 5752 /* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(24); 5753 /* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(19); 5754 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(0); 5755 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__); 5756 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2); 5757 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_8__); 5758 /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(10); 5759 /* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_9__); 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])(this, result); }; } 5770 5771 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 5772 5773 /** 5774 * External dependencies 5775 */ 5776 5777 /** 5778 * WordPress dependencies 5779 */ 5780 5781 5782 5783 /** 5784 * Input types which are classified as button types, for use in considering 5785 * whether element is a (focus-normalized) button. 5786 * 5787 * @type {string[]} 5788 */ 5789 5790 var INPUT_BUTTON_TYPES = ['button', 'submit']; 5791 /** 5792 * Returns true if the given element is a button element subject to focus 5793 * normalization, or false otherwise. 5794 * 5795 * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus 5796 * 5797 * @param {Element} element Element to test. 5798 * 5799 * @return {boolean} Whether element is a button. 5800 */ 5801 5802 function isFocusNormalizedButton(element) { 5803 switch (element.nodeName) { 5804 case 'A': 5805 case 'BUTTON': 5806 return true; 5807 5808 case 'INPUT': 5809 return Object(lodash__WEBPACK_IMPORTED_MODULE_8__["includes"])(INPUT_BUTTON_TYPES, element.type); 5810 } 5811 5812 return false; 5813 } 5814 5815 /* harmony default export */ __webpack_exports__["a"] = (Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_9__["createHigherOrderComponent"])(function (WrappedComponent) { 5816 return /*#__PURE__*/function (_Component) { 5817 Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])(_class, _Component); 5818 5819 var _super = _createSuper(_class); 5820 5821 function _class() { 5822 var _this; 5823 5824 Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(this, _class); 5825 5826 _this = _super.apply(this, arguments); 5827 _this.bindNode = _this.bindNode.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(_this)); 5828 _this.cancelBlurCheck = _this.cancelBlurCheck.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(_this)); 5829 _this.queueBlurCheck = _this.queueBlurCheck.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(_this)); 5830 _this.normalizeButtonFocus = _this.normalizeButtonFocus.bind(Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(_this)); 5831 return _this; 5832 } 5833 5834 Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(_class, [{ 5835 key: "componentWillUnmount", 5836 value: function componentWillUnmount() { 5837 this.cancelBlurCheck(); 5838 } 5839 }, { 5840 key: "bindNode", 5841 value: function bindNode(node) { 5842 if (node) { 5843 this.node = node; 5844 } else { 5845 delete this.node; 5846 this.cancelBlurCheck(); 5847 } 5848 } 5849 }, { 5850 key: "queueBlurCheck", 5851 value: function queueBlurCheck(event) { 5852 var _this2 = this; 5853 5854 // React does not allow using an event reference asynchronously 5855 // due to recycling behavior, except when explicitly persisted. 5856 event.persist(); // Skip blur check if clicking button. See `normalizeButtonFocus`. 5857 5858 if (this.preventBlurCheck) { 5859 return; 5860 } 5861 5862 this.blurCheckTimeout = setTimeout(function () { 5863 // If document is not focused then focus should remain 5864 // inside the wrapped component and therefore we cancel 5865 // this blur event thereby leaving focus in place. 5866 // https://developer.mozilla.org/en-US/docs/Web/API/Document/hasFocus. 5867 if (!document.hasFocus()) { 5868 event.preventDefault(); 5869 return; 5870 } 5871 5872 if ('function' === typeof _this2.node.handleFocusOutside) { 5873 _this2.node.handleFocusOutside(event); 5874 } 5875 }, 0); 5876 } 5877 }, { 5878 key: "cancelBlurCheck", 5879 value: function cancelBlurCheck() { 5880 clearTimeout(this.blurCheckTimeout); 5881 } 5882 /** 5883 * Handles a mousedown or mouseup event to respectively assign and 5884 * unassign a flag for preventing blur check on button elements. Some 5885 * browsers, namely Firefox and Safari, do not emit a focus event on 5886 * button elements when clicked, while others do. The logic here 5887 * intends to normalize this as treating click on buttons as focus. 5888 * 5889 * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus 5890 * 5891 * @param {MouseEvent} event Event for mousedown or mouseup. 5892 */ 5893 5894 }, { 5895 key: "normalizeButtonFocus", 5896 value: function normalizeButtonFocus(event) { 5897 var type = event.type, 5898 target = event.target; 5899 var isInteractionEnd = Object(lodash__WEBPACK_IMPORTED_MODULE_8__["includes"])(['mouseup', 'touchend'], type); 5900 5901 if (isInteractionEnd) { 5902 this.preventBlurCheck = false; 5903 } else if (isFocusNormalizedButton(target)) { 5904 this.preventBlurCheck = true; 5905 } 5906 } 5907 }, { 5908 key: "render", 5909 value: function render() { 5910 // Disable reason: See `normalizeButtonFocus` for browser-specific 5911 // focus event normalization. 5912 5913 /* eslint-disable jsx-a11y/no-static-element-interactions */ 5914 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__["createElement"])("div", { 5915 onFocus: this.cancelBlurCheck, 5916 onMouseDown: this.normalizeButtonFocus, 5917 onMouseUp: this.normalizeButtonFocus, 5918 onTouchStart: this.normalizeButtonFocus, 5919 onTouchEnd: this.normalizeButtonFocus, 5920 onBlur: this.queueBlurCheck 5921 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__["createElement"])(WrappedComponent, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({ 5922 ref: this.bindNode 5923 }, this.props))); 5924 /* eslint-enable jsx-a11y/no-static-element-interactions */ 5925 } 5926 }]); 5927 5928 return _class; 5929 }(_wordpress_element__WEBPACK_IMPORTED_MODULE_7__["Component"]); 5930 }, 'withFocusOutside')); 5931 5932 5933 /***/ }), 5934 /* 103 */ 5935 /***/ (function(module, exports) { 5936 5937 // shim for using process in browser 5938 var process = module.exports = {}; 5939 5940 // cached from whatever global is present so that test runners that stub it 5941 // don't break things. But we need to wrap it in a try catch in case it is 5942 // wrapped in strict mode code which doesn't define any globals. It's inside a 5943 // function because try/catches deoptimize in certain engines. 5944 5945 var cachedSetTimeout; 5946 var cachedClearTimeout; 5947 5948 function defaultSetTimout() { 5949 throw new Error('setTimeout has not been defined'); 5950 } 5951 function defaultClearTimeout () { 5952 throw new Error('clearTimeout has not been defined'); 5953 } 5954 (function () { 5955 try { 5956 if (typeof setTimeout === 'function') { 5957 cachedSetTimeout = setTimeout; 5958 } else { 5959 cachedSetTimeout = defaultSetTimout; 5960 } 5961 } catch (e) { 5962 cachedSetTimeout = defaultSetTimout; 5963 } 5964 try { 5965 if (typeof clearTimeout === 'function') { 5966 cachedClearTimeout = clearTimeout; 5967 } else { 5968 cachedClearTimeout = defaultClearTimeout; 5969 } 5970 } catch (e) { 5971 cachedClearTimeout = defaultClearTimeout; 5972 } 5973 } ()) 5974 function runTimeout(fun) { 5975 if (cachedSetTimeout === setTimeout) { 5976 //normal enviroments in sane situations 5977 return setTimeout(fun, 0); 5978 } 5979 // if setTimeout wasn't available but was latter defined 5980 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 5981 cachedSetTimeout = setTimeout; 5982 return setTimeout(fun, 0); 5983 } 5984 try { 5985 // when when somebody has screwed with setTimeout but no I.E. maddness 5986 return cachedSetTimeout(fun, 0); 5987 } catch(e){ 5988 try { 5989 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 5990 return cachedSetTimeout.call(null, fun, 0); 5991 } catch(e){ 5992 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error 5993 return cachedSetTimeout.call(this, fun, 0); 5994 } 5995 } 5996 5997 5998 } 5999 function runClearTimeout(marker) { 6000 if (cachedClearTimeout === clearTimeout) { 6001 //normal enviroments in sane situations 6002 return clearTimeout(marker); 6003 } 6004 // if clearTimeout wasn't available but was latter defined 6005 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 6006 cachedClearTimeout = clearTimeout; 6007 return clearTimeout(marker); 6008 } 6009 try { 6010 // when when somebody has screwed with setTimeout but no I.E. maddness 6011 return cachedClearTimeout(marker); 6012 } catch (e){ 6013 try { 6014 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 6015 return cachedClearTimeout.call(null, marker); 6016 } catch (e){ 6017 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. 6018 // Some versions of I.E. have different rules for clearTimeout vs setTimeout 6019 return cachedClearTimeout.call(this, marker); 6020 } 6021 } 6022 6023 6024 6025 } 6026 var queue = []; 6027 var draining = false; 6028 var currentQueue; 6029 var queueIndex = -1; 6030 6031 function cleanUpNextTick() { 6032 if (!draining || !currentQueue) { 6033 return; 6034 } 6035 draining = false; 6036 if (currentQueue.length) { 6037 queue = currentQueue.concat(queue); 6038 } else { 6039 queueIndex = -1; 6040 } 6041 if (queue.length) { 6042 drainQueue(); 6043 } 6044 } 6045 6046 function drainQueue() { 6047 if (draining) { 6048 return; 6049 } 6050 var timeout = runTimeout(cleanUpNextTick); 6051 draining = true; 6052 6053 var len = queue.length; 6054 while(len) { 6055 currentQueue = queue; 6056 queue = []; 6057 while (++queueIndex < len) { 6058 if (currentQueue) { 6059 currentQueue[queueIndex].run(); 6060 } 6061 } 6062 queueIndex = -1; 6063 len = queue.length; 6064 } 6065 currentQueue = null; 6066 draining = false; 6067 runClearTimeout(timeout); 6068 } 6069 6070 process.nextTick = function (fun) { 6071 var args = new Array(arguments.length - 1); 6072 if (arguments.length > 1) { 6073 for (var i = 1; i < arguments.length; i++) { 6074 args[i - 1] = arguments[i]; 6075 } 6076 } 6077 queue.push(new Item(fun, args)); 6078 if (queue.length === 1 && !draining) { 6079 runTimeout(drainQueue); 6080 } 6081 }; 6082 6083 // v8 likes predictible objects 6084 function Item(fun, array) { 6085 this.fun = fun; 6086 this.array = array; 6087 } 6088 Item.prototype.run = function () { 6089 this.fun.apply(null, this.array); 6090 }; 6091 process.title = 'browser'; 6092 process.browser = true; 6093 process.env = {}; 6094 process.argv = []; 6095 process.version = ''; // empty string to avoid regexp issues 6096 process.versions = {}; 6097 6098 function noop() {} 6099 6100 process.on = noop; 6101 process.addListener = noop; 6102 process.once = noop; 6103 process.off = noop; 6104 process.removeListener = noop; 6105 process.removeAllListeners = noop; 6106 process.emit = noop; 6107 process.prependListener = noop; 6108 process.prependOnceListener = noop; 6109 6110 process.listeners = function (name) { return [] } 6111 6112 process.binding = function (name) { 6113 throw new Error('process.binding is not supported'); 6114 }; 6115 6116 process.cwd = function () { return '/' }; 6117 process.chdir = function (dir) { 6118 throw new Error('process.chdir is not supported'); 6119 }; 6120 process.umask = function() { return 0; }; 6121 6122 6123 /***/ }), 6124 /* 104 */ 6125 /***/ (function(module, exports, __webpack_require__) { 6126 6127 "use strict"; 6128 6129 6130 var keys = __webpack_require__(187); 6131 var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; 6132 6133 var toStr = Object.prototype.toString; 6134 var concat = Array.prototype.concat; 6135 var origDefineProperty = Object.defineProperty; 6136 6137 var isFunction = function (fn) { 6138 return typeof fn === 'function' && toStr.call(fn) === '[object Function]'; 6139 }; 6140 6141 var arePropertyDescriptorsSupported = function () { 6142 var obj = {}; 6143 try { 6144 origDefineProperty(obj, 'x', { enumerable: false, value: obj }); 6145 // eslint-disable-next-line no-unused-vars, no-restricted-syntax 6146 for (var _ in obj) { // jscs:ignore disallowUnusedVariables 6147 return false; 6148 } 6149 return obj.x === obj; 6150 } catch (e) { /* this is IE 8. */ 6151 return false; 6152 } 6153 }; 6154 var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported(); 6155 6156 var defineProperty = function (object, name, value, predicate) { 6157 if (name in object && (!isFunction(predicate) || !predicate())) { 6158 return; 6159 } 6160 if (supportsDescriptors) { 6161 origDefineProperty(object, name, { 6162 configurable: true, 6163 enumerable: false, 6164 value: value, 6165 writable: true 6166 }); 6167 } else { 6168 object[name] = value; 6169 } 6170 }; 6171 6172 var defineProperties = function (object, map) { 6173 var predicates = arguments.length > 2 ? arguments[2] : {}; 6174 var props = keys(map); 6175 if (hasSymbols) { 6176 props = concat.call(props, Object.getOwnPropertySymbols(map)); 6177 } 6178 for (var i = 0; i < props.length; i += 1) { 6179 defineProperty(object, props[i], map[props[i]], predicates[props[i]]); 6180 } 6181 }; 6182 6183 defineProperties.supportsDescriptors = !!supportsDescriptors; 6184 6185 module.exports = defineProperties; 6186 6187 6188 /***/ }), 6189 /* 105 */ 6190 /***/ (function(module, __webpack_exports__, __webpack_require__) { 6191 6192 "use strict"; 6193 6194 // EXPORTS 6195 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ fireKeyboardEvent; }); 6196 6197 // EXTERNAL MODULE: ./node_modules/reakit-utils/es/getDocument.js 6198 var getDocument = __webpack_require__(49); 6199 6200 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/getDefaultView.js 6201 6202 6203 /** 6204 * Returns `element.ownerDocument.defaultView || window`. 6205 */ 6206 6207 function getDefaultView(element) { 6208 return Object(getDocument["a" /* getDocument */])(element).defaultView || window; 6209 } 6210 6211 6212 6213 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/createKeyboardEvent.js 6214 6215 6216 6217 /** 6218 * Creates a `KeyboardEvent` in a way that also works on IE 11. 6219 * 6220 * @example 6221 * import { createKeyboardEvent } from "reakit-utils"; 6222 * 6223 * const el = document.getElementById("id"); 6224 * el.dispatchEvent(createKeyboardEvent(el, "keydown", { key: "ArrowDown" })); 6225 */ 6226 6227 function createKeyboardEvent(element, type, eventInit) { 6228 if (eventInit === void 0) { 6229 eventInit = {}; 6230 } 6231 6232 if (typeof KeyboardEvent === "function") { 6233 return new KeyboardEvent(type, eventInit); 6234 } // IE 11 doesn't support Event constructors 6235 6236 6237 var event = Object(getDocument["a" /* getDocument */])(element).createEvent("KeyboardEvent"); 6238 event.initKeyboardEvent(type, eventInit.bubbles, eventInit.cancelable, getDefaultView(element), eventInit.key, eventInit.location, eventInit.ctrlKey, eventInit.altKey, eventInit.shiftKey, eventInit.metaKey); 6239 return event; 6240 } 6241 6242 6243 6244 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/fireKeyboardEvent.js 6245 6246 6247 6248 6249 /** 6250 * Creates and dispatches `KeyboardEvent` in a way that also works on IE 11. 6251 * 6252 * @example 6253 * import { fireKeyboardEvent } from "reakit-utils"; 6254 * 6255 * fireKeyboardEvent(document.getElementById("id"), "keydown", { 6256 * key: "ArrowDown", 6257 * shiftKey: true, 6258 * }); 6259 */ 6260 6261 function fireKeyboardEvent(element, type, eventInit) { 6262 return element.dispatchEvent(createKeyboardEvent(element, type, eventInit)); 6263 } 6264 6265 6266 6267 6268 /***/ }), 6269 /* 106 */, 6270 /* 107 */, 6271 /* 108 */, 6272 /* 109 */ 6273 /***/ (function(module, __webpack_exports__, __webpack_require__) { 6274 6275 "use strict"; 6276 /* unused harmony export warning */ 6277 6278 6279 /** 6280 * Logs `messages` to the console using `console.warn` based on a `condition`. 6281 * 6282 * @example 6283 * import { warning } from "reakit-warning"; 6284 * 6285 * warning(true, "a", "b"); // console.warn("a", "\n", "b") 6286 * warning(false, "a", "b"); // does nothing 6287 */ 6288 6289 function warning(condition) { 6290 if (false) { var warns, _len, messages, _key, _console; } 6291 } 6292 6293 6294 6295 6296 /***/ }), 6297 /* 110 */, 6298 /* 111 */ 6299 /***/ (function(module, exports, __webpack_require__) { 6300 6301 "use strict"; 6302 6303 6304 Object.defineProperty(exports, "__esModule", { 6305 value: true 6306 }); 6307 var calendarLabel = 'Calendar'; 6308 var closeDatePicker = 'Close'; 6309 var focusStartDate = 'Interact with the calendar and add the check-in date for your trip.'; 6310 var clearDate = 'Clear Date'; 6311 var clearDates = 'Clear Dates'; 6312 var jumpToPrevMonth = 'Move backward to switch to the previous month.'; 6313 var jumpToNextMonth = 'Move forward to switch to the next month.'; 6314 var keyboardShortcuts = 'Keyboard Shortcuts'; 6315 var showKeyboardShortcutsPanel = 'Open the keyboard shortcuts panel.'; 6316 var hideKeyboardShortcutsPanel = 'Close the shortcuts panel.'; 6317 var openThisPanel = 'Open this panel.'; 6318 var enterKey = 'Enter key'; 6319 var leftArrowRightArrow = 'Right and left arrow keys'; 6320 var upArrowDownArrow = 'up and down arrow keys'; 6321 var pageUpPageDown = 'page up and page down keys'; 6322 var homeEnd = 'Home and end keys'; 6323 var escape = 'Escape key'; 6324 var questionMark = 'Question mark'; 6325 var selectFocusedDate = 'Select the date in focus.'; 6326 var moveFocusByOneDay = 'Move backward (left) and forward (right) by one day.'; 6327 var moveFocusByOneWeek = 'Move backward (up) and forward (down) by one week.'; 6328 var moveFocusByOneMonth = 'Switch months.'; 6329 var moveFocustoStartAndEndOfWeek = 'Go to the first or last day of a week.'; 6330 var returnFocusToInput = 'Return to the date input field.'; 6331 var keyboardNavigationInstructions = 'Press the down arrow key to interact with the calendar and\n select a date. Press the question mark key to get the keyboard shortcuts for changing dates.'; 6332 6333 var chooseAvailableStartDate = function chooseAvailableStartDate(_ref) { 6334 var date = _ref.date; 6335 return 'Choose ' + String(date) + ' as your check-in date. It\u2019s available.'; 6336 }; 6337 var chooseAvailableEndDate = function chooseAvailableEndDate(_ref2) { 6338 var date = _ref2.date; 6339 return 'Choose ' + String(date) + ' as your check-out date. It\u2019s available.'; 6340 }; 6341 var chooseAvailableDate = function chooseAvailableDate(_ref3) { 6342 var date = _ref3.date; 6343 return date; 6344 }; 6345 var dateIsUnavailable = function dateIsUnavailable(_ref4) { 6346 var date = _ref4.date; 6347 return 'Not available. ' + String(date); 6348 }; 6349 var dateIsSelected = function dateIsSelected(_ref5) { 6350 var date = _ref5.date; 6351 return 'Selected. ' + String(date); 6352 }; 6353 6354 exports['default'] = { 6355 calendarLabel: calendarLabel, 6356 closeDatePicker: closeDatePicker, 6357 focusStartDate: focusStartDate, 6358 clearDate: clearDate, 6359 clearDates: clearDates, 6360 jumpToPrevMonth: jumpToPrevMonth, 6361 jumpToNextMonth: jumpToNextMonth, 6362 keyboardShortcuts: keyboardShortcuts, 6363 showKeyboardShortcutsPanel: showKeyboardShortcutsPanel, 6364 hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel, 6365 openThisPanel: openThisPanel, 6366 enterKey: enterKey, 6367 leftArrowRightArrow: leftArrowRightArrow, 6368 upArrowDownArrow: upArrowDownArrow, 6369 pageUpPageDown: pageUpPageDown, 6370 homeEnd: homeEnd, 6371 escape: escape, 6372 questionMark: questionMark, 6373 selectFocusedDate: selectFocusedDate, 6374 moveFocusByOneDay: moveFocusByOneDay, 6375 moveFocusByOneWeek: moveFocusByOneWeek, 6376 moveFocusByOneMonth: moveFocusByOneMonth, 6377 moveFocustoStartAndEndOfWeek: moveFocustoStartAndEndOfWeek, 6378 returnFocusToInput: returnFocusToInput, 6379 keyboardNavigationInstructions: keyboardNavigationInstructions, 6380 6381 chooseAvailableStartDate: chooseAvailableStartDate, 6382 chooseAvailableEndDate: chooseAvailableEndDate, 6383 dateIsUnavailable: dateIsUnavailable, 6384 dateIsSelected: dateIsSelected 6385 }; 6386 var DateRangePickerPhrases = exports.DateRangePickerPhrases = { 6387 calendarLabel: calendarLabel, 6388 closeDatePicker: closeDatePicker, 6389 clearDates: clearDates, 6390 focusStartDate: focusStartDate, 6391 jumpToPrevMonth: jumpToPrevMonth, 6392 jumpToNextMonth: jumpToNextMonth, 6393 keyboardShortcuts: keyboardShortcuts, 6394 showKeyboardShortcutsPanel: showKeyboardShortcutsPanel, 6395 hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel, 6396 openThisPanel: openThisPanel, 6397 enterKey: enterKey, 6398 leftArrowRightArrow: leftArrowRightArrow, 6399 upArrowDownArrow: upArrowDownArrow, 6400 pageUpPageDown: pageUpPageDown, 6401 homeEnd: homeEnd, 6402 escape: escape, 6403 questionMark: questionMark, 6404 selectFocusedDate: selectFocusedDate, 6405 moveFocusByOneDay: moveFocusByOneDay, 6406 moveFocusByOneWeek: moveFocusByOneWeek, 6407 moveFocusByOneMonth: moveFocusByOneMonth, 6408 moveFocustoStartAndEndOfWeek: moveFocustoStartAndEndOfWeek, 6409 returnFocusToInput: returnFocusToInput, 6410 keyboardNavigationInstructions: keyboardNavigationInstructions, 6411 chooseAvailableStartDate: chooseAvailableStartDate, 6412 chooseAvailableEndDate: chooseAvailableEndDate, 6413 dateIsUnavailable: dateIsUnavailable, 6414 dateIsSelected: dateIsSelected 6415 }; 6416 6417 var DateRangePickerInputPhrases = exports.DateRangePickerInputPhrases = { 6418 focusStartDate: focusStartDate, 6419 clearDates: clearDates, 6420 keyboardNavigationInstructions: keyboardNavigationInstructions 6421 }; 6422 6423 var SingleDatePickerPhrases = exports.SingleDatePickerPhrases = { 6424 calendarLabel: calendarLabel, 6425 closeDatePicker: closeDatePicker, 6426 clearDate: clearDate, 6427 jumpToPrevMonth: jumpToPrevMonth, 6428 jumpToNextMonth: jumpToNextMonth, 6429 keyboardShortcuts: keyboardShortcuts, 6430 showKeyboardShortcutsPanel: showKeyboardShortcutsPanel, 6431 hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel, 6432 openThisPanel: openThisPanel, 6433 enterKey: enterKey, 6434 leftArrowRightArrow: leftArrowRightArrow, 6435 upArrowDownArrow: upArrowDownArrow, 6436 pageUpPageDown: pageUpPageDown, 6437 homeEnd: homeEnd, 6438 escape: escape, 6439 questionMark: questionMark, 6440 selectFocusedDate: selectFocusedDate, 6441 moveFocusByOneDay: moveFocusByOneDay, 6442 moveFocusByOneWeek: moveFocusByOneWeek, 6443 moveFocusByOneMonth: moveFocusByOneMonth, 6444 moveFocustoStartAndEndOfWeek: moveFocustoStartAndEndOfWeek, 6445 returnFocusToInput: returnFocusToInput, 6446 keyboardNavigationInstructions: keyboardNavigationInstructions, 6447 chooseAvailableDate: chooseAvailableDate, 6448 dateIsUnavailable: dateIsUnavailable, 6449 dateIsSelected: dateIsSelected 6450 }; 6451 6452 var SingleDatePickerInputPhrases = exports.SingleDatePickerInputPhrases = { 6453 clearDate: clearDate, 6454 keyboardNavigationInstructions: keyboardNavigationInstructions 6455 }; 6456 6457 var DayPickerPhrases = exports.DayPickerPhrases = { 6458 calendarLabel: calendarLabel, 6459 jumpToPrevMonth: jumpToPrevMonth, 6460 jumpToNextMonth: jumpToNextMonth, 6461 keyboardShortcuts: keyboardShortcuts, 6462 showKeyboardShortcutsPanel: showKeyboardShortcutsPanel, 6463 hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel, 6464 openThisPanel: openThisPanel, 6465 enterKey: enterKey, 6466 leftArrowRightArrow: leftArrowRightArrow, 6467 upArrowDownArrow: upArrowDownArrow, 6468 pageUpPageDown: pageUpPageDown, 6469 homeEnd: homeEnd, 6470 escape: escape, 6471 questionMark: questionMark, 6472 selectFocusedDate: selectFocusedDate, 6473 moveFocusByOneDay: moveFocusByOneDay, 6474 moveFocusByOneWeek: moveFocusByOneWeek, 6475 moveFocusByOneMonth: moveFocusByOneMonth, 6476 moveFocustoStartAndEndOfWeek: moveFocustoStartAndEndOfWeek, 6477 returnFocusToInput: returnFocusToInput, 6478 chooseAvailableStartDate: chooseAvailableStartDate, 6479 chooseAvailableEndDate: chooseAvailableEndDate, 6480 chooseAvailableDate: chooseAvailableDate, 6481 dateIsUnavailable: dateIsUnavailable, 6482 dateIsSelected: dateIsSelected 6483 }; 6484 6485 var DayPickerKeyboardShortcutsPhrases = exports.DayPickerKeyboardShortcutsPhrases = { 6486 keyboardShortcuts: keyboardShortcuts, 6487 showKeyboardShortcutsPanel: showKeyboardShortcutsPanel, 6488 hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel, 6489 openThisPanel: openThisPanel, 6490 enterKey: enterKey, 6491 leftArrowRightArrow: leftArrowRightArrow, 6492 upArrowDownArrow: upArrowDownArrow, 6493 pageUpPageDown: pageUpPageDown, 6494 homeEnd: homeEnd, 6495 escape: escape, 6496 questionMark: questionMark, 6497 selectFocusedDate: selectFocusedDate, 6498 moveFocusByOneDay: moveFocusByOneDay, 6499 moveFocusByOneWeek: moveFocusByOneWeek, 6500 moveFocusByOneMonth: moveFocusByOneMonth, 6501 moveFocustoStartAndEndOfWeek: moveFocustoStartAndEndOfWeek, 6502 returnFocusToInput: returnFocusToInput 6503 }; 6504 6505 var DayPickerNavigationPhrases = exports.DayPickerNavigationPhrases = { 6506 jumpToPrevMonth: jumpToPrevMonth, 6507 jumpToNextMonth: jumpToNextMonth 6508 }; 6509 6510 var CalendarDayPhrases = exports.CalendarDayPhrases = { 6511 chooseAvailableDate: chooseAvailableDate, 6512 dateIsUnavailable: dateIsUnavailable, 6513 dateIsSelected: dateIsSelected 6514 }; 6515 6516 /***/ }), 6517 /* 112 */ 6518 /***/ (function(module, exports, __webpack_require__) { 6519 6520 "use strict"; 6521 6522 6523 Object.defineProperty(exports, "__esModule", { 6524 value: true 6525 }); 6526 exports['default'] = getPhrasePropTypes; 6527 6528 var _object = __webpack_require__(95); 6529 6530 var _object2 = _interopRequireDefault(_object); 6531 6532 var _propTypes = __webpack_require__(28); 6533 6534 var _propTypes2 = _interopRequireDefault(_propTypes); 6535 6536 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 6537 6538 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; } 6539 6540 function getPhrasePropTypes(defaultPhrases) { 6541 return Object.keys(defaultPhrases).reduce(function (phrases, key) { 6542 return (0, _object2['default'])({}, phrases, _defineProperty({}, key, _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].func, _propTypes2['default'].node]))); 6543 }, {}); 6544 } 6545 6546 /***/ }), 6547 /* 113 */ 6548 /***/ (function(module, exports, __webpack_require__) { 6549 6550 "use strict"; 6551 6552 6553 Object.defineProperty(exports, "__esModule", { 6554 value: true 6555 }); 6556 exports.withStylesPropTypes = exports.css = undefined; 6557 6558 var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; 6559 6560 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 6561 6562 exports.withStyles = withStyles; 6563 6564 var _object = __webpack_require__(95); 6565 6566 var _object2 = _interopRequireDefault(_object); 6567 6568 var _react = __webpack_require__(13); 6569 6570 var _react2 = _interopRequireDefault(_react); 6571 6572 var _propTypes = __webpack_require__(28); 6573 6574 var _propTypes2 = _interopRequireDefault(_propTypes); 6575 6576 var _hoistNonReactStatics = __webpack_require__(393); 6577 6578 var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics); 6579 6580 var _constants = __webpack_require__(396); 6581 6582 var _brcast = __webpack_require__(397); 6583 6584 var _brcast2 = _interopRequireDefault(_brcast); 6585 6586 var _ThemedStyleSheet = __webpack_require__(237); 6587 6588 var _ThemedStyleSheet2 = _interopRequireDefault(_ThemedStyleSheet); 6589 6590 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 6591 6592 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6593 6594 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 6595 6596 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 6597 6598 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; } /* eslint react/forbid-foreign-prop-types: off */ 6599 6600 // Add some named exports to assist in upgrading and for convenience 6601 var css = exports.css = _ThemedStyleSheet2['default'].resolveLTR; 6602 var withStylesPropTypes = exports.withStylesPropTypes = { 6603 styles: _propTypes2['default'].object.isRequired, // eslint-disable-line react/forbid-prop-types 6604 theme: _propTypes2['default'].object.isRequired, // eslint-disable-line react/forbid-prop-types 6605 css: _propTypes2['default'].func.isRequired 6606 }; 6607 6608 var EMPTY_STYLES = {}; 6609 var EMPTY_STYLES_FN = function EMPTY_STYLES_FN() { 6610 return EMPTY_STYLES; 6611 }; 6612 6613 var START_MARK = 'react-with-styles.createStyles.start'; 6614 var END_MARK = 'react-with-styles.createStyles.end'; 6615 6616 function baseClass(pureComponent) { 6617 if (pureComponent) { 6618 if (!_react2['default'].PureComponent) { 6619 throw new ReferenceError('withStyles() pureComponent option requires React 15.3.0 or later'); 6620 } 6621 6622 return _react2['default'].PureComponent; 6623 } 6624 6625 return _react2['default'].Component; 6626 } 6627 6628 var contextTypes = _defineProperty({}, _constants.CHANNEL, _brcast2['default']); 6629 6630 var defaultDirection = _constants.DIRECTIONS.LTR; 6631 6632 function withStyles(styleFn) { 6633 var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, 6634 _ref$stylesPropName = _ref.stylesPropName, 6635 stylesPropName = _ref$stylesPropName === undefined ? 'styles' : _ref$stylesPropName, 6636 _ref$themePropName = _ref.themePropName, 6637 themePropName = _ref$themePropName === undefined ? 'theme' : _ref$themePropName, 6638 _ref$cssPropName = _ref.cssPropName, 6639 cssPropName = _ref$cssPropName === undefined ? 'css' : _ref$cssPropName, 6640 _ref$flushBefore = _ref.flushBefore, 6641 flushBefore = _ref$flushBefore === undefined ? false : _ref$flushBefore, 6642 _ref$pureComponent = _ref.pureComponent, 6643 pureComponent = _ref$pureComponent === undefined ? false : _ref$pureComponent; 6644 6645 var styleDefLTR = void 0; 6646 var styleDefRTL = void 0; 6647 var currentThemeLTR = void 0; 6648 var currentThemeRTL = void 0; 6649 var BaseClass = baseClass(pureComponent); 6650 6651 function getResolveMethod(direction) { 6652 return direction === _constants.DIRECTIONS.LTR ? _ThemedStyleSheet2['default'].resolveLTR : _ThemedStyleSheet2['default'].resolveRTL; 6653 } 6654 6655 function getCurrentTheme(direction) { 6656 return direction === _constants.DIRECTIONS.LTR ? currentThemeLTR : currentThemeRTL; 6657 } 6658 6659 function getStyleDef(direction, wrappedComponentName) { 6660 var currentTheme = getCurrentTheme(direction); 6661 var styleDef = direction === _constants.DIRECTIONS.LTR ? styleDefLTR : styleDefRTL; 6662 6663 var registeredTheme = _ThemedStyleSheet2['default'].get(); 6664 6665 // Return the existing styles if they've already been defined 6666 // and if the theme used to create them corresponds to the theme 6667 // registered with ThemedStyleSheet 6668 if (styleDef && currentTheme === registeredTheme) { 6669 return styleDef; 6670 } 6671 6672 if (false) {} 6673 6674 var isRTL = direction === _constants.DIRECTIONS.RTL; 6675 6676 if (isRTL) { 6677 styleDefRTL = styleFn ? _ThemedStyleSheet2['default'].createRTL(styleFn) : EMPTY_STYLES_FN; 6678 6679 currentThemeRTL = registeredTheme; 6680 styleDef = styleDefRTL; 6681 } else { 6682 styleDefLTR = styleFn ? _ThemedStyleSheet2['default'].createLTR(styleFn) : EMPTY_STYLES_FN; 6683 6684 currentThemeLTR = registeredTheme; 6685 styleDef = styleDefLTR; 6686 } 6687 6688 if (false) { var measureName; } 6689 6690 return styleDef; 6691 } 6692 6693 function getState(direction, wrappedComponentName) { 6694 return { 6695 resolveMethod: getResolveMethod(direction), 6696 styleDef: getStyleDef(direction, wrappedComponentName) 6697 }; 6698 } 6699 6700 return function () { 6701 function withStylesHOC(WrappedComponent) { 6702 var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component'; 6703 6704 // NOTE: Use a class here so components are ref-able if need be: 6705 // eslint-disable-next-line react/prefer-stateless-function 6706 6707 var WithStyles = function (_BaseClass) { 6708 _inherits(WithStyles, _BaseClass); 6709 6710 function WithStyles(props, context) { 6711 _classCallCheck(this, WithStyles); 6712 6713 var _this = _possibleConstructorReturn(this, (WithStyles.__proto__ || Object.getPrototypeOf(WithStyles)).call(this, props, context)); 6714 6715 var direction = _this.context[_constants.CHANNEL] ? _this.context[_constants.CHANNEL].getState() : defaultDirection; 6716 6717 _this.state = getState(direction, wrappedComponentName); 6718 return _this; 6719 } 6720 6721 _createClass(WithStyles, [{ 6722 key: 'componentDidMount', 6723 value: function () { 6724 function componentDidMount() { 6725 var _this2 = this; 6726 6727 if (this.context[_constants.CHANNEL]) { 6728 // subscribe to future direction changes 6729 this.channelUnsubscribe = this.context[_constants.CHANNEL].subscribe(function (direction) { 6730 _this2.setState(getState(direction, wrappedComponentName)); 6731 }); 6732 } 6733 } 6734 6735 return componentDidMount; 6736 }() 6737 }, { 6738 key: 'componentWillUnmount', 6739 value: function () { 6740 function componentWillUnmount() { 6741 if (this.channelUnsubscribe) { 6742 this.channelUnsubscribe(); 6743 } 6744 } 6745 6746 return componentWillUnmount; 6747 }() 6748 }, { 6749 key: 'render', 6750 value: function () { 6751 function render() { 6752 var _ref2; 6753 6754 // As some components will depend on previous styles in 6755 // the component tree, we provide the option of flushing the 6756 // buffered styles (i.e. to a style tag) **before** the rendering 6757 // cycle begins. 6758 // 6759 // The interfaces provide the optional "flush" method which 6760 // is run in turn by ThemedStyleSheet.flush. 6761 if (flushBefore) { 6762 _ThemedStyleSheet2['default'].flush(); 6763 } 6764 6765 var _state = this.state, 6766 resolveMethod = _state.resolveMethod, 6767 styleDef = _state.styleDef; 6768 6769 6770 return _react2['default'].createElement(WrappedComponent, _extends({}, this.props, (_ref2 = {}, _defineProperty(_ref2, themePropName, _ThemedStyleSheet2['default'].get()), _defineProperty(_ref2, stylesPropName, styleDef()), _defineProperty(_ref2, cssPropName, resolveMethod), _ref2))); 6771 } 6772 6773 return render; 6774 }() 6775 }]); 6776 6777 return WithStyles; 6778 }(BaseClass); 6779 6780 WithStyles.WrappedComponent = WrappedComponent; 6781 WithStyles.displayName = 'withStyles(' + String(wrappedComponentName) + ')'; 6782 WithStyles.contextTypes = contextTypes; 6783 if (WrappedComponent.propTypes) { 6784 WithStyles.propTypes = (0, _object2['default'])({}, WrappedComponent.propTypes); 6785 delete WithStyles.propTypes[stylesPropName]; 6786 delete WithStyles.propTypes[themePropName]; 6787 delete WithStyles.propTypes[cssPropName]; 6788 } 6789 if (WrappedComponent.defaultProps) { 6790 WithStyles.defaultProps = (0, _object2['default'])({}, WrappedComponent.defaultProps); 6791 } 6792 6793 return (0, _hoistNonReactStatics2['default'])(WithStyles, WrappedComponent); 6794 } 6795 6796 return withStylesHOC; 6797 }(); 6798 } 6799 6800 /***/ }), 6801 /* 114 */ 6802 /***/ (function(module, __webpack_exports__, __webpack_require__) { 6803 6804 "use strict"; 6805 6806 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js 6807 var esm_extends = __webpack_require__(8); 6808 6809 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules 6810 var slicedToArray = __webpack_require__(12); 6811 6812 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js 6813 var objectWithoutProperties = __webpack_require__(14); 6814 6815 // EXTERNAL MODULE: external {"this":["wp","element"]} 6816 var external_this_wp_element_ = __webpack_require__(0); 6817 6818 // EXTERNAL MODULE: ./node_modules/classnames/index.js 6819 var classnames = __webpack_require__(9); 6820 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); 6821 6822 // EXTERNAL MODULE: external {"this":["wp","dom"]} 6823 var external_this_wp_dom_ = __webpack_require__(29); 6824 6825 // EXTERNAL MODULE: external {"this":["wp","keycodes"]} 6826 var external_this_wp_keycodes_ = __webpack_require__(18); 6827 6828 // EXTERNAL MODULE: external {"this":["wp","deprecated"]} 6829 var external_this_wp_deprecated_ = __webpack_require__(36); 6830 var external_this_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_deprecated_); 6831 6832 // EXTERNAL MODULE: external {"this":["wp","compose"]} 6833 var external_this_wp_compose_ = __webpack_require__(10); 6834 6835 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js 6836 var library_close = __webpack_require__(160); 6837 6838 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js 6839 var defineProperty = __webpack_require__(5); 6840 6841 // CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/utils.js 6842 6843 6844 6845 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; } 6846 6847 function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } 6848 6849 /** 6850 * WordPress dependencies 6851 */ 6852 6853 /** 6854 * Module constants 6855 */ 6856 6857 var HEIGHT_OFFSET = 10; // used by the arrow and a bit of empty space 6858 6859 /** 6860 * Utility used to compute the popover position over the xAxis 6861 * 6862 * @param {Object} anchorRect Anchor Rect. 6863 * @param {Object} contentSize Content Size. 6864 * @param {string} xAxis Desired xAxis. 6865 * @param {string} corner Desired corner. 6866 * @param {boolean} sticky Whether or not to stick the popover to the 6867 * scroll container edge when part of the anchor 6868 * leaves view. 6869 * @param {string} chosenYAxis yAxis to be used. 6870 * @param {Element} boundaryElement Boundary element. 6871 * 6872 * @return {Object} Popover xAxis position and constraints. 6873 */ 6874 6875 function computePopoverXAxisPosition(anchorRect, contentSize, xAxis, corner, sticky, chosenYAxis, boundaryElement) { 6876 var width = contentSize.width; 6877 var isRTL = document.documentElement.dir === 'rtl'; // Correct xAxis for RTL support 6878 6879 if (xAxis === 'left' && isRTL) { 6880 xAxis = 'right'; 6881 } else if (xAxis === 'right' && isRTL) { 6882 xAxis = 'left'; 6883 } 6884 6885 if (corner === 'left' && isRTL) { 6886 corner = 'right'; 6887 } else if (corner === 'right' && isRTL) { 6888 corner = 'left'; 6889 } // x axis alignment choices 6890 6891 6892 var anchorMidPoint = Math.round(anchorRect.left + anchorRect.width / 2); 6893 var centerAlignment = { 6894 popoverLeft: anchorMidPoint, 6895 contentWidth: (anchorMidPoint - width / 2 > 0 ? width / 2 : anchorMidPoint) + (anchorMidPoint + width / 2 > window.innerWidth ? window.innerWidth - anchorMidPoint : width / 2) 6896 }; 6897 var leftAlignmentX = anchorRect.left; 6898 6899 if (corner === 'right') { 6900 leftAlignmentX = anchorRect.right; 6901 } else if (chosenYAxis !== 'middle') { 6902 leftAlignmentX = anchorMidPoint; 6903 } 6904 6905 var rightAlignmentX = anchorRect.right; 6906 6907 if (corner === 'left') { 6908 rightAlignmentX = anchorRect.left; 6909 } else if (chosenYAxis !== 'middle') { 6910 rightAlignmentX = anchorMidPoint; 6911 } 6912 6913 var leftAlignment = { 6914 popoverLeft: leftAlignmentX, 6915 contentWidth: leftAlignmentX - width > 0 ? width : leftAlignmentX 6916 }; 6917 var rightAlignment = { 6918 popoverLeft: rightAlignmentX, 6919 contentWidth: rightAlignmentX + width > window.innerWidth ? window.innerWidth - rightAlignmentX : width 6920 }; // Choosing the x axis 6921 6922 var chosenXAxis = xAxis; 6923 var contentWidth = null; 6924 6925 if (!sticky) { 6926 if (xAxis === 'center' && centerAlignment.contentWidth === width) { 6927 chosenXAxis = 'center'; 6928 } else if (xAxis === 'left' && leftAlignment.contentWidth === width) { 6929 chosenXAxis = 'left'; 6930 } else if (xAxis === 'right' && rightAlignment.contentWidth === width) { 6931 chosenXAxis = 'right'; 6932 } else { 6933 chosenXAxis = leftAlignment.contentWidth > rightAlignment.contentWidth ? 'left' : 'right'; 6934 var chosenWidth = chosenXAxis === 'left' ? leftAlignment.contentWidth : rightAlignment.contentWidth; 6935 contentWidth = chosenWidth !== width ? chosenWidth : null; 6936 } 6937 } 6938 6939 var popoverLeft; 6940 6941 if (chosenXAxis === 'center') { 6942 popoverLeft = centerAlignment.popoverLeft; 6943 } else if (chosenXAxis === 'left') { 6944 popoverLeft = leftAlignment.popoverLeft; 6945 } else { 6946 popoverLeft = rightAlignment.popoverLeft; 6947 } 6948 6949 if (boundaryElement) { 6950 var boundaryRect = boundaryElement.getBoundingClientRect(); 6951 popoverLeft = Math.min(popoverLeft, boundaryRect.right - width); 6952 } 6953 6954 return { 6955 xAxis: chosenXAxis, 6956 popoverLeft: popoverLeft, 6957 contentWidth: contentWidth 6958 }; 6959 } 6960 /** 6961 * Utility used to compute the popover position over the yAxis 6962 * 6963 * @param {Object} anchorRect Anchor Rect. 6964 * @param {Object} contentSize Content Size. 6965 * @param {string} yAxis Desired yAxis. 6966 * @param {string} corner Desired corner. 6967 * @param {boolean} sticky Whether or not to stick the popover to the 6968 * scroll container edge when part of the 6969 * anchor leaves view. 6970 * @param {Element} anchorRef The anchor element. 6971 * @param {Element} relativeOffsetTop If applicable, top offset of the relative 6972 * positioned parent container. 6973 * 6974 * @return {Object} Popover xAxis position and constraints. 6975 */ 6976 6977 function computePopoverYAxisPosition(anchorRect, contentSize, yAxis, corner, sticky, anchorRef, relativeOffsetTop) { 6978 var height = contentSize.height; 6979 6980 if (sticky) { 6981 var scrollContainerEl = Object(external_this_wp_dom_["getScrollContainer"])(anchorRef) || document.body; 6982 var scrollRect = scrollContainerEl.getBoundingClientRect(); 6983 var stickyPosition = scrollRect.top + height - relativeOffsetTop; 6984 6985 if (anchorRect.top <= stickyPosition) { 6986 return { 6987 yAxis: yAxis, 6988 popoverTop: Math.min(anchorRect.bottom, stickyPosition) 6989 }; 6990 } 6991 } // y axis alignment choices 6992 6993 6994 var anchorMidPoint = anchorRect.top + anchorRect.height / 2; 6995 6996 if (corner === 'bottom') { 6997 anchorMidPoint = anchorRect.bottom; 6998 } else if (corner === 'top') { 6999 anchorMidPoint = anchorRect.top; 7000 } 7001 7002 var middleAlignment = { 7003 popoverTop: anchorMidPoint, 7004 contentHeight: (anchorMidPoint - height / 2 > 0 ? height / 2 : anchorMidPoint) + (anchorMidPoint + height / 2 > window.innerHeight ? window.innerHeight - anchorMidPoint : height / 2) 7005 }; 7006 var topAlignment = { 7007 popoverTop: anchorRect.top, 7008 contentHeight: anchorRect.top - HEIGHT_OFFSET - height > 0 ? height : anchorRect.top - HEIGHT_OFFSET 7009 }; 7010 var bottomAlignment = { 7011 popoverTop: anchorRect.bottom, 7012 contentHeight: anchorRect.bottom + HEIGHT_OFFSET + height > window.innerHeight ? window.innerHeight - HEIGHT_OFFSET - anchorRect.bottom : height 7013 }; // Choosing the y axis 7014 7015 var chosenYAxis = yAxis; 7016 var contentHeight = null; 7017 7018 if (!sticky) { 7019 if (yAxis === 'middle' && middleAlignment.contentHeight === height) { 7020 chosenYAxis = 'middle'; 7021 } else if (yAxis === 'top' && topAlignment.contentHeight === height) { 7022 chosenYAxis = 'top'; 7023 } else if (yAxis === 'bottom' && bottomAlignment.contentHeight === height) { 7024 chosenYAxis = 'bottom'; 7025 } else { 7026 chosenYAxis = topAlignment.contentHeight > bottomAlignment.contentHeight ? 'top' : 'bottom'; 7027 var chosenHeight = chosenYAxis === 'top' ? topAlignment.contentHeight : bottomAlignment.contentHeight; 7028 contentHeight = chosenHeight !== height ? chosenHeight : null; 7029 } 7030 } 7031 7032 var popoverTop; 7033 7034 if (chosenYAxis === 'middle') { 7035 popoverTop = middleAlignment.popoverTop; 7036 } else if (chosenYAxis === 'top') { 7037 popoverTop = topAlignment.popoverTop; 7038 } else { 7039 popoverTop = bottomAlignment.popoverTop; 7040 } 7041 7042 return { 7043 yAxis: chosenYAxis, 7044 popoverTop: popoverTop, 7045 contentHeight: contentHeight 7046 }; 7047 } 7048 /** 7049 * Utility used to compute the popover position and the content max width/height 7050 * for a popover given its anchor rect and its content size. 7051 * 7052 * @param {Object} anchorRect Anchor Rect. 7053 * @param {Object} contentSize Content Size. 7054 * @param {string} position Position. 7055 * @param {boolean} sticky Whether or not to stick the popover to the 7056 * scroll container edge when part of the 7057 * anchor leaves view. 7058 * @param {Element} anchorRef The anchor element. 7059 * @param {number} relativeOffsetTop If applicable, top offset of the relative 7060 * positioned parent container. 7061 * @param {Element} boundaryElement Boundary element. 7062 * 7063 * @return {Object} Popover position and constraints. 7064 */ 7065 7066 function computePopoverPosition(anchorRect, contentSize) { 7067 var position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'top'; 7068 var sticky = arguments.length > 3 ? arguments[3] : undefined; 7069 var anchorRef = arguments.length > 4 ? arguments[4] : undefined; 7070 var relativeOffsetTop = arguments.length > 5 ? arguments[5] : undefined; 7071 var boundaryElement = arguments.length > 6 ? arguments[6] : undefined; 7072 7073 var _position$split = position.split(' '), 7074 _position$split2 = Object(slicedToArray["a" /* default */])(_position$split, 3), 7075 yAxis = _position$split2[0], 7076 _position$split2$ = _position$split2[1], 7077 xAxis = _position$split2$ === void 0 ? 'center' : _position$split2$, 7078 corner = _position$split2[2]; 7079 7080 var yAxisPosition = computePopoverYAxisPosition(anchorRect, contentSize, yAxis, corner, sticky, anchorRef, relativeOffsetTop); 7081 var xAxisPosition = computePopoverXAxisPosition(anchorRect, contentSize, xAxis, corner, sticky, yAxisPosition.yAxis, boundaryElement); 7082 return _objectSpread(_objectSpread({}, xAxisPosition), yAxisPosition); 7083 } 7084 7085 // EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-focus-return/index.js 7086 var with_focus_return = __webpack_require__(135); 7087 7088 // EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-constrained-tabbing/index.js 7089 var with_constrained_tabbing = __webpack_require__(134); 7090 7091 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js 7092 var classCallCheck = __webpack_require__(21); 7093 7094 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js 7095 var createClass = __webpack_require__(22); 7096 7097 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules 7098 var inherits = __webpack_require__(23); 7099 7100 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js 7101 var possibleConstructorReturn = __webpack_require__(24); 7102 7103 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js 7104 var getPrototypeOf = __webpack_require__(19); 7105 7106 // EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-focus-outside/index.js 7107 var with_focus_outside = __webpack_require__(102); 7108 7109 // CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/detect-outside.js 7110 7111 7112 7113 7114 7115 7116 function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } 7117 7118 function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } 7119 7120 /** 7121 * WordPress dependencies 7122 */ 7123 7124 /** 7125 * Internal dependencies 7126 */ 7127 7128 7129 7130 var detect_outside_PopoverDetectOutside = /*#__PURE__*/function (_Component) { 7131 Object(inherits["a" /* default */])(PopoverDetectOutside, _Component); 7132 7133 var _super = _createSuper(PopoverDetectOutside); 7134 7135 function PopoverDetectOutside() { 7136 Object(classCallCheck["a" /* default */])(this, PopoverDetectOutside); 7137 7138 return _super.apply(this, arguments); 7139 } 7140 7141 Object(createClass["a" /* default */])(PopoverDetectOutside, [{ 7142 key: "handleFocusOutside", 7143 value: function handleFocusOutside(event) { 7144 this.props.onFocusOutside(event); 7145 } 7146 }, { 7147 key: "render", 7148 value: function render() { 7149 return this.props.children; 7150 } 7151 }]); 7152 7153 return PopoverDetectOutside; 7154 }(external_this_wp_element_["Component"]); 7155 7156 /* harmony default export */ var detect_outside = (Object(with_focus_outside["a" /* default */])(detect_outside_PopoverDetectOutside)); 7157 7158 // EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/button/index.js 7159 var build_module_button = __webpack_require__(35); 7160 7161 // EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/scroll-lock/index.js 7162 var scroll_lock = __webpack_require__(166); 7163 7164 // EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/isolated-event-container/index.js 7165 var isolated_event_container = __webpack_require__(136); 7166 7167 // EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js 7168 var use_slot = __webpack_require__(165); 7169 7170 // EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/index.js + 6 modules 7171 var slot_fill = __webpack_require__(125); 7172 7173 // EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/animate/index.js 7174 var build_module_animate = __webpack_require__(124); 7175 7176 // CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/index.js 7177 7178 7179 7180 7181 7182 /** 7183 * External dependencies 7184 */ 7185 7186 /** 7187 * WordPress dependencies 7188 */ 7189 7190 7191 7192 7193 7194 7195 7196 /** 7197 * Internal dependencies 7198 */ 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 var FocusManaged = Object(with_constrained_tabbing["a" /* default */])(Object(with_focus_return["a" /* default */])(function (_ref) { 7210 var children = _ref.children; 7211 return children; 7212 })); 7213 /** 7214 * Name of slot in which popover should fill. 7215 * 7216 * @type {string} 7217 */ 7218 7219 var SLOT_NAME = 'Popover'; 7220 7221 function computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect) { 7222 var anchorRef = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; 7223 var shouldAnchorIncludePadding = arguments.length > 4 ? arguments[4] : undefined; 7224 7225 if (anchorRect) { 7226 return anchorRect; 7227 } 7228 7229 if (getAnchorRect) { 7230 if (!anchorRefFallback.current) { 7231 return; 7232 } 7233 7234 return getAnchorRect(anchorRefFallback.current); 7235 } 7236 7237 if (anchorRef !== false) { 7238 if (!anchorRef || !window.Range || !window.Element || !window.DOMRect) { 7239 return; 7240 } 7241 7242 if (anchorRef instanceof window.Range) { 7243 return Object(external_this_wp_dom_["getRectangleFromRange"])(anchorRef); 7244 } 7245 7246 if (anchorRef instanceof window.Element) { 7247 var _rect2 = anchorRef.getBoundingClientRect(); 7248 7249 if (shouldAnchorIncludePadding) { 7250 return _rect2; 7251 } 7252 7253 return withoutPadding(_rect2, anchorRef); 7254 } 7255 7256 var top = anchorRef.top, 7257 bottom = anchorRef.bottom; 7258 var topRect = top.getBoundingClientRect(); 7259 var bottomRect = bottom.getBoundingClientRect(); 7260 7261 var _rect = new window.DOMRect(topRect.left, topRect.top, topRect.width, bottomRect.bottom - topRect.top); 7262 7263 if (shouldAnchorIncludePadding) { 7264 return _rect; 7265 } 7266 7267 return withoutPadding(_rect, anchorRef); 7268 } 7269 7270 if (!anchorRefFallback.current) { 7271 return; 7272 } 7273 7274 var parentNode = anchorRefFallback.current.parentNode; 7275 var rect = parentNode.getBoundingClientRect(); 7276 7277 if (shouldAnchorIncludePadding) { 7278 return rect; 7279 } 7280 7281 return withoutPadding(rect, parentNode); 7282 } 7283 7284 function getComputedStyle(node) { 7285 return node.ownerDocument.defaultView.getComputedStyle(node); 7286 } 7287 7288 function withoutPadding(rect, element) { 7289 var _getComputedStyle = getComputedStyle(element), 7290 paddingTop = _getComputedStyle.paddingTop, 7291 paddingBottom = _getComputedStyle.paddingBottom, 7292 paddingLeft = _getComputedStyle.paddingLeft, 7293 paddingRight = _getComputedStyle.paddingRight; 7294 7295 var top = paddingTop ? parseInt(paddingTop, 10) : 0; 7296 var bottom = paddingBottom ? parseInt(paddingBottom, 10) : 0; 7297 var left = paddingLeft ? parseInt(paddingLeft, 10) : 0; 7298 var right = paddingRight ? parseInt(paddingRight, 10) : 0; 7299 return { 7300 x: rect.left + left, 7301 y: rect.top + top, 7302 width: rect.width - left - right, 7303 height: rect.height - top - bottom, 7304 left: rect.left + left, 7305 right: rect.right - right, 7306 top: rect.top + top, 7307 bottom: rect.bottom - bottom 7308 }; 7309 } 7310 /** 7311 * Hook used to focus the first tabbable element on mount. 7312 * 7313 * @param {boolean|string} focusOnMount Focus on mount mode. 7314 * @param {Object} contentRef Reference to the popover content element. 7315 */ 7316 7317 7318 function useFocusContentOnMount(focusOnMount, contentRef) { 7319 // Focus handling 7320 Object(external_this_wp_element_["useEffect"])(function () { 7321 /* 7322 * Without the setTimeout, the dom node is not being focused. Related: 7323 * https://stackoverflow.com/questions/35522220/react-ref-with-focus-doesnt-work-without-settimeout-my-example 7324 * 7325 * TODO: Treat the cause, not the symptom. 7326 */ 7327 var focusTimeout = setTimeout(function () { 7328 if (!focusOnMount || !contentRef.current) { 7329 return; 7330 } 7331 7332 if (focusOnMount === 'firstElement') { 7333 // Find first tabbable node within content and shift focus, falling 7334 // back to the popover panel itself. 7335 var firstTabbable = external_this_wp_dom_["focus"].tabbable.find(contentRef.current)[0]; 7336 7337 if (firstTabbable) { 7338 firstTabbable.focus(); 7339 } else { 7340 contentRef.current.focus(); 7341 } 7342 7343 return; 7344 } 7345 7346 if (focusOnMount === 'container') { 7347 // Focus the popover panel itself so items in the popover are easily 7348 // accessed via keyboard navigation. 7349 contentRef.current.focus(); 7350 } 7351 }, 0); 7352 return function () { 7353 return clearTimeout(focusTimeout); 7354 }; 7355 }, []); 7356 } 7357 /** 7358 * Sets or removes an element attribute. 7359 * 7360 * @param {Element} element The element to modify. 7361 * @param {string} name The attribute name to set or remove. 7362 * @param {?string} value The value to set. A falsy value will remove the 7363 * attribute. 7364 */ 7365 7366 7367 function setAttribute(element, name, value) { 7368 if (!value) { 7369 if (element.hasAttribute(name)) { 7370 element.removeAttribute(name); 7371 } 7372 } else if (element.getAttribute(name) !== value) { 7373 element.setAttribute(name, value); 7374 } 7375 } 7376 /** 7377 * Sets or removes an element style property. 7378 * 7379 * @param {Element} element The element to modify. 7380 * @param {string} property The property to set or remove. 7381 * @param {?string} value The value to set. A falsy value will remove the 7382 * property. 7383 */ 7384 7385 7386 function setStyle(element, property) { 7387 var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; 7388 7389 if (element.style[property] !== value) { 7390 element.style[property] = value; 7391 } 7392 } 7393 /** 7394 * Sets or removes an element class. 7395 * 7396 * @param {Element} element The element to modify. 7397 * @param {string} name The class to set or remove. 7398 * @param {boolean} toggle True to set the class, false to remove. 7399 */ 7400 7401 7402 function setClass(element, name, toggle) { 7403 if (toggle) { 7404 if (!element.classList.contains(name)) { 7405 element.classList.add(name); 7406 } 7407 } else if (element.classList.contains(name)) { 7408 element.classList.remove(name); 7409 } 7410 } 7411 7412 var popover_Popover = function Popover(_ref2) { 7413 var headerTitle = _ref2.headerTitle, 7414 onClose = _ref2.onClose, 7415 onKeyDown = _ref2.onKeyDown, 7416 children = _ref2.children, 7417 className = _ref2.className, 7418 _ref2$noArrow = _ref2.noArrow, 7419 noArrow = _ref2$noArrow === void 0 ? true : _ref2$noArrow, 7420 isAlternate = _ref2.isAlternate, 7421 _ref2$position = _ref2.position, 7422 position = _ref2$position === void 0 ? 'bottom right' : _ref2$position, 7423 range = _ref2.range, 7424 _ref2$focusOnMount = _ref2.focusOnMount, 7425 focusOnMount = _ref2$focusOnMount === void 0 ? 'firstElement' : _ref2$focusOnMount, 7426 anchorRef = _ref2.anchorRef, 7427 shouldAnchorIncludePadding = _ref2.shouldAnchorIncludePadding, 7428 anchorRect = _ref2.anchorRect, 7429 getAnchorRect = _ref2.getAnchorRect, 7430 expandOnMobile = _ref2.expandOnMobile, 7431 _ref2$animate = _ref2.animate, 7432 animate = _ref2$animate === void 0 ? true : _ref2$animate, 7433 onClickOutside = _ref2.onClickOutside, 7434 onFocusOutside = _ref2.onFocusOutside, 7435 __unstableSticky = _ref2.__unstableSticky, 7436 _ref2$__unstableSlotN = _ref2.__unstableSlotName, 7437 __unstableSlotName = _ref2$__unstableSlotN === void 0 ? SLOT_NAME : _ref2$__unstableSlotN, 7438 __unstableObserveElement = _ref2.__unstableObserveElement, 7439 __unstableBoundaryParent = _ref2.__unstableBoundaryParent, 7440 contentProps = Object(objectWithoutProperties["a" /* default */])(_ref2, ["headerTitle", "onClose", "onKeyDown", "children", "className", "noArrow", "isAlternate", "position", "range", "focusOnMount", "anchorRef", "shouldAnchorIncludePadding", "anchorRect", "getAnchorRect", "expandOnMobile", "animate", "onClickOutside", "onFocusOutside", "__unstableSticky", "__unstableSlotName", "__unstableObserveElement", "__unstableBoundaryParent"]); 7441 7442 var anchorRefFallback = Object(external_this_wp_element_["useRef"])(null); 7443 var contentRef = Object(external_this_wp_element_["useRef"])(null); 7444 var containerRef = Object(external_this_wp_element_["useRef"])(); 7445 var isMobileViewport = Object(external_this_wp_compose_["useViewportMatch"])('medium', '<'); 7446 7447 var _useState = Object(external_this_wp_element_["useState"])(), 7448 _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), 7449 animateOrigin = _useState2[0], 7450 setAnimateOrigin = _useState2[1]; 7451 7452 var slot = Object(use_slot["a" /* default */])(__unstableSlotName); 7453 var isExpanded = expandOnMobile && isMobileViewport; 7454 7455 var _useResizeObserver = Object(external_this_wp_compose_["useResizeObserver"])(), 7456 _useResizeObserver2 = Object(slicedToArray["a" /* default */])(_useResizeObserver, 2), 7457 containerResizeListener = _useResizeObserver2[0], 7458 contentSize = _useResizeObserver2[1]; 7459 7460 noArrow = isExpanded || noArrow; 7461 Object(external_this_wp_element_["useLayoutEffect"])(function () { 7462 if (isExpanded) { 7463 setClass(containerRef.current, 'is-without-arrow', noArrow); 7464 setClass(containerRef.current, 'is-alternate', isAlternate); 7465 setAttribute(containerRef.current, 'data-x-axis'); 7466 setAttribute(containerRef.current, 'data-y-axis'); 7467 setStyle(containerRef.current, 'top'); 7468 setStyle(containerRef.current, 'left'); 7469 setStyle(contentRef.current, 'maxHeight'); 7470 setStyle(contentRef.current, 'maxWidth'); 7471 return; 7472 } 7473 7474 var refresh = function refresh() { 7475 if (!containerRef.current || !contentRef.current) { 7476 return; 7477 } 7478 7479 var anchor = computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect, anchorRef, shouldAnchorIncludePadding); 7480 7481 if (!anchor) { 7482 return; 7483 } 7484 7485 var _containerRef$current = containerRef.current, 7486 offsetParent = _containerRef$current.offsetParent, 7487 ownerDocument = _containerRef$current.ownerDocument; 7488 var relativeOffsetTop = 0; // If there is a positioned ancestor element that is not the body, 7489 // subtract the position from the anchor rect. If the position of 7490 // the popover is fixed, the offset parent is null or the body 7491 // element, in which case the position is relative to the viewport. 7492 // See https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent 7493 7494 if (offsetParent && offsetParent !== ownerDocument.body) { 7495 var offsetParentRect = offsetParent.getBoundingClientRect(); 7496 relativeOffsetTop = offsetParentRect.top; 7497 anchor = new window.DOMRect(anchor.left - offsetParentRect.left, anchor.top - offsetParentRect.top, anchor.width, anchor.height); 7498 } 7499 7500 var boundaryElement; 7501 7502 if (__unstableBoundaryParent) { 7503 var _containerRef$current2; 7504 7505 boundaryElement = (_containerRef$current2 = containerRef.current.closest('.popover-slot')) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.parentNode; 7506 } 7507 7508 var usedContentSize = !contentSize.height ? contentRef.current.getBoundingClientRect() : contentSize; 7509 7510 var _computePopoverPositi = computePopoverPosition(anchor, usedContentSize, position, __unstableSticky, containerRef.current, relativeOffsetTop, boundaryElement), 7511 popoverTop = _computePopoverPositi.popoverTop, 7512 popoverLeft = _computePopoverPositi.popoverLeft, 7513 xAxis = _computePopoverPositi.xAxis, 7514 yAxis = _computePopoverPositi.yAxis, 7515 contentHeight = _computePopoverPositi.contentHeight, 7516 contentWidth = _computePopoverPositi.contentWidth; 7517 7518 if (typeof popoverTop === 'number' && typeof popoverLeft === 'number') { 7519 setStyle(containerRef.current, 'top', popoverTop + 'px'); 7520 setStyle(containerRef.current, 'left', popoverLeft + 'px'); 7521 } 7522 7523 setClass(containerRef.current, 'is-without-arrow', noArrow || xAxis === 'center' && yAxis === 'middle'); 7524 setClass(containerRef.current, 'is-alternate', isAlternate); 7525 setAttribute(containerRef.current, 'data-x-axis', xAxis); 7526 setAttribute(containerRef.current, 'data-y-axis', yAxis); 7527 setStyle(contentRef.current, 'maxHeight', typeof contentHeight === 'number' ? contentHeight + 'px' : ''); 7528 setStyle(contentRef.current, 'maxWidth', typeof contentWidth === 'number' ? contentWidth + 'px' : ''); // Compute the animation position 7529 7530 var yAxisMapping = { 7531 top: 'bottom', 7532 bottom: 'top' 7533 }; 7534 var xAxisMapping = { 7535 left: 'right', 7536 right: 'left' 7537 }; 7538 var animateYAxis = yAxisMapping[yAxis] || 'middle'; 7539 var animateXAxis = xAxisMapping[xAxis] || 'center'; 7540 setAnimateOrigin(animateXAxis + ' ' + animateYAxis); 7541 }; 7542 7543 refresh(); 7544 /* 7545 * There are sometimes we need to reposition or resize the popover that 7546 * are not handled by the resize/scroll window events (i.e. CSS changes 7547 * in the layout that changes the position of the anchor). 7548 * 7549 * For these situations, we refresh the popover every 0.5s 7550 */ 7551 7552 var intervalHandle = window.setInterval(refresh, 500); 7553 var rafId; 7554 7555 var refreshOnAnimationFrame = function refreshOnAnimationFrame() { 7556 window.cancelAnimationFrame(rafId); 7557 rafId = window.requestAnimationFrame(refresh); 7558 }; // Sometimes a click trigger a layout change that affects the popover 7559 // position. This is an opportunity to immediately refresh rather than 7560 // at the interval. 7561 7562 7563 window.addEventListener('click', refreshOnAnimationFrame); 7564 window.addEventListener('resize', refresh); 7565 window.addEventListener('scroll', refresh, true); 7566 var observer; 7567 7568 if (__unstableObserveElement) { 7569 observer = new window.MutationObserver(refresh); 7570 observer.observe(__unstableObserveElement, { 7571 attributes: true 7572 }); 7573 } 7574 7575 return function () { 7576 window.clearInterval(intervalHandle); 7577 window.removeEventListener('resize', refresh); 7578 window.removeEventListener('scroll', refresh, true); 7579 window.removeEventListener('click', refreshOnAnimationFrame); 7580 window.cancelAnimationFrame(rafId); 7581 7582 if (observer) { 7583 observer.disconnect(); 7584 } 7585 }; 7586 }, [isExpanded, anchorRect, getAnchorRect, anchorRef, shouldAnchorIncludePadding, position, contentSize, __unstableSticky, __unstableObserveElement, __unstableBoundaryParent]); 7587 useFocusContentOnMount(focusOnMount, contentRef); // Event handlers 7588 7589 var maybeClose = function maybeClose(event) { 7590 // Close on escape 7591 if (event.keyCode === external_this_wp_keycodes_["ESCAPE"] && onClose) { 7592 event.stopPropagation(); 7593 onClose(); 7594 } // Preserve original content prop behavior 7595 7596 7597 if (onKeyDown) { 7598 onKeyDown(event); 7599 } 7600 }; 7601 /** 7602 * Shims an onFocusOutside callback to be compatible with a deprecated 7603 * onClickOutside prop function, if provided. 7604 * 7605 * @param {FocusEvent} event Focus event from onFocusOutside. 7606 */ 7607 7608 7609 function handleOnFocusOutside(event) { 7610 // Defer to given `onFocusOutside` if specified. Call `onClose` only if 7611 // both `onFocusOutside` and `onClickOutside` are unspecified. Doing so 7612 // assures backwards-compatibility for prior `onClickOutside` default. 7613 if (onFocusOutside) { 7614 onFocusOutside(event); 7615 return; 7616 } else if (!onClickOutside) { 7617 if (onClose) { 7618 onClose(); 7619 } 7620 7621 return; 7622 } // Simulate MouseEvent using FocusEvent#relatedTarget as emulated click 7623 // target. MouseEvent constructor is unsupported in Internet Explorer. 7624 7625 7626 var clickEvent; 7627 7628 try { 7629 clickEvent = new window.MouseEvent('click'); 7630 } catch (error) { 7631 clickEvent = document.createEvent('MouseEvent'); 7632 clickEvent.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); 7633 } 7634 7635 Object.defineProperty(clickEvent, 'target', { 7636 get: function get() { 7637 return event.relatedTarget; 7638 } 7639 }); 7640 external_this_wp_deprecated_default()('Popover onClickOutside prop', { 7641 alternative: 'onFocusOutside' 7642 }); 7643 onClickOutside(clickEvent); 7644 } // Disable reason: We care to capture the _bubbled_ events from inputs 7645 // within popover as inferring close intent. 7646 7647 7648 var content = Object(external_this_wp_element_["createElement"])(detect_outside, { 7649 onFocusOutside: handleOnFocusOutside 7650 }, Object(external_this_wp_element_["createElement"])(build_module_animate["a" /* default */], { 7651 type: animate && animateOrigin ? 'appear' : null, 7652 options: { 7653 origin: animateOrigin 7654 } 7655 }, function (_ref3) { 7656 var animateClassName = _ref3.className; 7657 return Object(external_this_wp_element_["createElement"])(isolated_event_container["a" /* default */], Object(esm_extends["a" /* default */])({ 7658 className: classnames_default()('components-popover', className, animateClassName, { 7659 'is-expanded': isExpanded, 7660 'is-without-arrow': noArrow, 7661 'is-alternate': isAlternate 7662 }) 7663 }, contentProps, { 7664 onKeyDown: maybeClose, 7665 ref: containerRef 7666 }), isExpanded && Object(external_this_wp_element_["createElement"])(scroll_lock["a" /* default */], null), isExpanded && Object(external_this_wp_element_["createElement"])("div", { 7667 className: "components-popover__header" 7668 }, Object(external_this_wp_element_["createElement"])("span", { 7669 className: "components-popover__header-title" 7670 }, headerTitle), Object(external_this_wp_element_["createElement"])(build_module_button["a" /* default */], { 7671 className: "components-popover__close", 7672 icon: library_close["a" /* default */], 7673 onClick: onClose 7674 })), Object(external_this_wp_element_["createElement"])("div", { 7675 ref: contentRef, 7676 className: "components-popover__content", 7677 tabIndex: "-1" 7678 }, Object(external_this_wp_element_["createElement"])("div", { 7679 style: { 7680 position: 'relative' 7681 } 7682 }, containerResizeListener, children))); 7683 })); // Apply focus to element as long as focusOnMount is truthy; false is 7684 // the only "disabled" value. 7685 7686 if (focusOnMount) { 7687 content = Object(external_this_wp_element_["createElement"])(FocusManaged, null, content); 7688 } 7689 7690 if (slot.ref) { 7691 content = Object(external_this_wp_element_["createElement"])(slot_fill["a" /* Fill */], { 7692 name: __unstableSlotName 7693 }, content); 7694 } 7695 7696 if (anchorRef || anchorRect) { 7697 return content; 7698 } 7699 7700 return Object(external_this_wp_element_["createElement"])("span", { 7701 ref: anchorRefFallback 7702 }, content); 7703 }; 7704 7705 var PopoverContainer = popover_Popover; 7706 7707 PopoverContainer.Slot = function (_ref4) { 7708 var _ref4$name = _ref4.name, 7709 name = _ref4$name === void 0 ? SLOT_NAME : _ref4$name; 7710 return Object(external_this_wp_element_["createElement"])(slot_fill["b" /* Slot */], { 7711 bubblesVirtually: true, 7712 name: name, 7713 className: "popover-slot" 7714 }); 7715 }; 7716 7717 /* harmony default export */ var popover = __webpack_exports__["a"] = (PopoverContainer); 7718 7719 7720 /***/ }), 7721 /* 115 */ 7722 /***/ (function(module, exports, __webpack_require__) { 7723 7724 "use strict"; 7725 7726 7727 Object.defineProperty(exports, '__esModule', { value: true }); 7728 7729 function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } 7730 7731 var _extends = _interopDefault(__webpack_require__(177)); 7732 var _objectWithoutPropertiesLoose = _interopDefault(__webpack_require__(178)); 7733 var React = __webpack_require__(13); 7734 var React__default = _interopDefault(React); 7735 var _inheritsLoose = _interopDefault(__webpack_require__(158)); 7736 var _assertThisInitialized = _interopDefault(__webpack_require__(179)); 7737 7738 var is = { 7739 arr: Array.isArray, 7740 obj: function obj(a) { 7741 return Object.prototype.toString.call(a) === '[object Object]'; 7742 }, 7743 fun: function fun(a) { 7744 return typeof a === 'function'; 7745 }, 7746 str: function str(a) { 7747 return typeof a === 'string'; 7748 }, 7749 num: function num(a) { 7750 return typeof a === 'number'; 7751 }, 7752 und: function und(a) { 7753 return a === void 0; 7754 }, 7755 nul: function nul(a) { 7756 return a === null; 7757 }, 7758 set: function set(a) { 7759 return a instanceof Set; 7760 }, 7761 map: function map(a) { 7762 return a instanceof Map; 7763 }, 7764 equ: function equ(a, b) { 7765 if (typeof a !== typeof b) return false; 7766 if (is.str(a) || is.num(a)) return a === b; 7767 if (is.obj(a) && is.obj(b) && Object.keys(a).length + Object.keys(b).length === 0) return true; 7768 var i; 7769 7770 for (i in a) { 7771 if (!(i in b)) return false; 7772 } 7773 7774 for (i in b) { 7775 if (a[i] !== b[i]) return false; 7776 } 7777 7778 return is.und(i) ? a === b : true; 7779 } 7780 }; 7781 function merge(target, lowercase) { 7782 if (lowercase === void 0) { 7783 lowercase = true; 7784 } 7785 7786 return function (object) { 7787 return (is.arr(object) ? object : Object.keys(object)).reduce(function (acc, element) { 7788 var key = lowercase ? element[0].toLowerCase() + element.substring(1) : element; 7789 acc[key] = target(key); 7790 return acc; 7791 }, target); 7792 }; 7793 } 7794 function useForceUpdate() { 7795 var _useState = React.useState(false), 7796 f = _useState[1]; 7797 7798 var forceUpdate = React.useCallback(function () { 7799 return f(function (v) { 7800 return !v; 7801 }); 7802 }, []); 7803 return forceUpdate; 7804 } 7805 function withDefault(value, defaultValue) { 7806 return is.und(value) || is.nul(value) ? defaultValue : value; 7807 } 7808 function toArray(a) { 7809 return !is.und(a) ? is.arr(a) ? a : [a] : []; 7810 } 7811 function callProp(obj) { 7812 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 7813 args[_key - 1] = arguments[_key]; 7814 } 7815 7816 return is.fun(obj) ? obj.apply(void 0, args) : obj; 7817 } 7818 7819 function getForwardProps(props) { 7820 var to = props.to, 7821 from = props.from, 7822 config = props.config, 7823 onStart = props.onStart, 7824 onRest = props.onRest, 7825 onFrame = props.onFrame, 7826 children = props.children, 7827 reset = props.reset, 7828 reverse = props.reverse, 7829 force = props.force, 7830 immediate = props.immediate, 7831 delay = props.delay, 7832 attach = props.attach, 7833 destroyed = props.destroyed, 7834 interpolateTo = props.interpolateTo, 7835 ref = props.ref, 7836 lazy = props.lazy, 7837 forward = _objectWithoutPropertiesLoose(props, ["to", "from", "config", "onStart", "onRest", "onFrame", "children", "reset", "reverse", "force", "immediate", "delay", "attach", "destroyed", "interpolateTo", "ref", "lazy"]); 7838 7839 return forward; 7840 } 7841 7842 function interpolateTo(props) { 7843 var forward = getForwardProps(props); 7844 if (is.und(forward)) return _extends({ 7845 to: forward 7846 }, props); 7847 var rest = Object.keys(props).reduce(function (a, k) { 7848 var _extends2; 7849 7850 return !is.und(forward[k]) ? a : _extends({}, a, (_extends2 = {}, _extends2[k] = props[k], _extends2)); 7851 }, {}); 7852 return _extends({ 7853 to: forward 7854 }, rest); 7855 } 7856 function handleRef(ref, forward) { 7857 if (forward) { 7858 // If it's a function, assume it's a ref callback 7859 if (is.fun(forward)) forward(ref);else if (is.obj(forward)) { 7860 forward.current = ref; 7861 } 7862 } 7863 7864 return ref; 7865 } 7866 7867 var Animated = 7868 /*#__PURE__*/ 7869 function () { 7870 function Animated() { 7871 this.payload = void 0; 7872 this.children = []; 7873 } 7874 7875 var _proto = Animated.prototype; 7876 7877 _proto.getAnimatedValue = function getAnimatedValue() { 7878 return this.getValue(); 7879 }; 7880 7881 _proto.getPayload = function getPayload() { 7882 return this.payload || this; 7883 }; 7884 7885 _proto.attach = function attach() {}; 7886 7887 _proto.detach = function detach() {}; 7888 7889 _proto.getChildren = function getChildren() { 7890 return this.children; 7891 }; 7892 7893 _proto.addChild = function addChild(child) { 7894 if (this.children.length === 0) this.attach(); 7895 this.children.push(child); 7896 }; 7897 7898 _proto.removeChild = function removeChild(child) { 7899 var index = this.children.indexOf(child); 7900 this.children.splice(index, 1); 7901 if (this.children.length === 0) this.detach(); 7902 }; 7903 7904 return Animated; 7905 }(); 7906 var AnimatedArray = 7907 /*#__PURE__*/ 7908 function (_Animated) { 7909 _inheritsLoose(AnimatedArray, _Animated); 7910 7911 function AnimatedArray() { 7912 var _this; 7913 7914 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 7915 args[_key] = arguments[_key]; 7916 } 7917 7918 _this = _Animated.call.apply(_Animated, [this].concat(args)) || this; 7919 _this.payload = []; 7920 7921 _this.attach = function () { 7922 return _this.payload.forEach(function (p) { 7923 return p instanceof Animated && p.addChild(_assertThisInitialized(_this)); 7924 }); 7925 }; 7926 7927 _this.detach = function () { 7928 return _this.payload.forEach(function (p) { 7929 return p instanceof Animated && p.removeChild(_assertThisInitialized(_this)); 7930 }); 7931 }; 7932 7933 return _this; 7934 } 7935 7936 return AnimatedArray; 7937 }(Animated); 7938 var AnimatedObject = 7939 /*#__PURE__*/ 7940 function (_Animated2) { 7941 _inheritsLoose(AnimatedObject, _Animated2); 7942 7943 function AnimatedObject() { 7944 var _this2; 7945 7946 for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { 7947 args[_key3] = arguments[_key3]; 7948 } 7949 7950 _this2 = _Animated2.call.apply(_Animated2, [this].concat(args)) || this; 7951 _this2.payload = {}; 7952 7953 _this2.attach = function () { 7954 return Object.values(_this2.payload).forEach(function (s) { 7955 return s instanceof Animated && s.addChild(_assertThisInitialized(_this2)); 7956 }); 7957 }; 7958 7959 _this2.detach = function () { 7960 return Object.values(_this2.payload).forEach(function (s) { 7961 return s instanceof Animated && s.removeChild(_assertThisInitialized(_this2)); 7962 }); 7963 }; 7964 7965 return _this2; 7966 } 7967 7968 var _proto2 = AnimatedObject.prototype; 7969 7970 _proto2.getValue = function getValue(animated) { 7971 if (animated === void 0) { 7972 animated = false; 7973 } 7974 7975 var payload = {}; 7976 7977 for (var _key4 in this.payload) { 7978 var value = this.payload[_key4]; 7979 if (animated && !(value instanceof Animated)) continue; 7980 payload[_key4] = value instanceof Animated ? value[animated ? 'getAnimatedValue' : 'getValue']() : value; 7981 } 7982 7983 return payload; 7984 }; 7985 7986 _proto2.getAnimatedValue = function getAnimatedValue() { 7987 return this.getValue(true); 7988 }; 7989 7990 return AnimatedObject; 7991 }(Animated); 7992 7993 var applyAnimatedValues; 7994 function injectApplyAnimatedValues(fn, transform) { 7995 applyAnimatedValues = { 7996 fn: fn, 7997 transform: transform 7998 }; 7999 } 8000 var colorNames; 8001 function injectColorNames(names) { 8002 colorNames = names; 8003 } 8004 var requestFrame = function requestFrame(cb) { 8005 return typeof window !== 'undefined' ? window.requestAnimationFrame(cb) : -1; 8006 }; 8007 var cancelFrame = function cancelFrame(id) { 8008 typeof window !== 'undefined' && window.cancelAnimationFrame(id); 8009 }; 8010 function injectFrame(raf, caf) { 8011 requestFrame = raf; 8012 cancelFrame = caf; 8013 } 8014 var interpolation; 8015 function injectStringInterpolator(fn) { 8016 interpolation = fn; 8017 } 8018 var now = function now() { 8019 return Date.now(); 8020 }; 8021 function injectNow(nowFn) { 8022 now = nowFn;