80 /******/ // __webpack_public_path__ |
80 /******/ // __webpack_public_path__ |
81 /******/ __webpack_require__.p = ""; |
81 /******/ __webpack_require__.p = ""; |
82 /******/ |
82 /******/ |
83 /******/ |
83 /******/ |
84 /******/ // Load entry module and return exports |
84 /******/ // Load entry module and return exports |
85 /******/ return __webpack_require__(__webpack_require__.s = 352); |
85 /******/ return __webpack_require__(__webpack_require__.s = 431); |
86 /******/ }) |
86 /******/ }) |
87 /************************************************************************/ |
87 /************************************************************************/ |
88 /******/ ({ |
88 /******/ ({ |
89 |
89 |
90 /***/ 2: |
90 /***/ 2: |
92 |
92 |
93 (function() { module.exports = this["lodash"]; }()); |
93 (function() { module.exports = this["lodash"]; }()); |
94 |
94 |
95 /***/ }), |
95 /***/ }), |
96 |
96 |
97 /***/ 352: |
97 /***/ 431: |
98 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
98 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
99 |
99 |
100 "use strict"; |
100 "use strict"; |
101 __webpack_require__.r(__webpack_exports__); |
101 __webpack_require__.r(__webpack_exports__); |
102 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "next", function() { return next; }); |
102 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "next", function() { return next; }); |
105 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "regexp", function() { return regexp; }); |
105 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "regexp", function() { return regexp; }); |
106 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "attrs", function() { return attrs; }); |
106 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "attrs", function() { return attrs; }); |
107 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromMatch", function() { return fromMatch; }); |
107 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromMatch", function() { return fromMatch; }); |
108 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); |
108 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); |
109 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__); |
109 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__); |
110 /* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(41); |
110 /* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(60); |
111 /* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(memize__WEBPACK_IMPORTED_MODULE_1__); |
111 /* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(memize__WEBPACK_IMPORTED_MODULE_1__); |
112 /** |
112 /** |
113 * External dependencies |
113 * External dependencies |
114 */ |
114 */ |
115 |
115 |
197 * |
197 * |
198 * @return {string} Text with shortcodes replaced. |
198 * @return {string} Text with shortcodes replaced. |
199 */ |
199 */ |
200 |
200 |
201 function replace(tag, text, callback) { |
201 function replace(tag, text, callback) { |
202 var _arguments = arguments; |
|
203 return text.replace(regexp(tag), function (match, left, $3, attrs, slash, content, closing, right) { |
202 return text.replace(regexp(tag), function (match, left, $3, attrs, slash, content, closing, right) { |
204 // If both extra brackets exist, the shortcode has been properly |
203 // If both extra brackets exist, the shortcode has been properly |
205 // escaped. |
204 // escaped. |
206 if (left === '[' && right === ']') { |
205 if (left === '[' && right === ']') { |
207 return match; |
206 return match; |
208 } // Create the match object and pass it through the callback. |
207 } // Create the match object and pass it through the callback. |
209 |
208 |
210 |
209 |
211 var result = callback(fromMatch(_arguments)); // Make sure to return any of the extra brackets if they weren't used to |
210 var result = callback(fromMatch(arguments)); // Make sure to return any of the extra brackets if they weren't used to |
212 // escape the shortcode. |
211 // escape the shortcode. |
213 |
212 |
214 return result ? left + result + right : match; |
213 return result ? left + result + right : match; |
215 }); |
214 }); |
216 } |
215 } |
462 /* harmony default export */ __webpack_exports__["default"] = (shortcode); |
461 /* harmony default export */ __webpack_exports__["default"] = (shortcode); |
463 |
462 |
464 |
463 |
465 /***/ }), |
464 /***/ }), |
466 |
465 |
467 /***/ 41: |
466 /***/ 60: |
468 /***/ (function(module, exports, __webpack_require__) { |
467 /***/ (function(module, exports, __webpack_require__) { |
469 |
468 |
470 module.exports = function memize( fn, options ) { |
469 /** |
471 var size = 0, |
470 * Memize options object. |
472 maxSize, head, tail; |
471 * |
473 |
472 * @typedef MemizeOptions |
474 if ( options && options.maxSize ) { |
473 * |
475 maxSize = options.maxSize; |
474 * @property {number} [maxSize] Maximum size of the cache. |
476 } |
475 */ |
|
476 |
|
477 /** |
|
478 * Internal cache entry. |
|
479 * |
|
480 * @typedef MemizeCacheNode |
|
481 * |
|
482 * @property {?MemizeCacheNode|undefined} [prev] Previous node. |
|
483 * @property {?MemizeCacheNode|undefined} [next] Next node. |
|
484 * @property {Array<*>} args Function arguments for cache |
|
485 * entry. |
|
486 * @property {*} val Function result. |
|
487 */ |
|
488 |
|
489 /** |
|
490 * Properties of the enhanced function for controlling cache. |
|
491 * |
|
492 * @typedef MemizeMemoizedFunction |
|
493 * |
|
494 * @property {()=>void} clear Clear the cache. |
|
495 */ |
|
496 |
|
497 /** |
|
498 * Accepts a function to be memoized, and returns a new memoized function, with |
|
499 * optional options. |
|
500 * |
|
501 * @template {Function} F |
|
502 * |
|
503 * @param {F} fn Function to memoize. |
|
504 * @param {MemizeOptions} [options] Options object. |
|
505 * |
|
506 * @return {F & MemizeMemoizedFunction} Memoized function. |
|
507 */ |
|
508 function memize( fn, options ) { |
|
509 var size = 0; |
|
510 |
|
511 /** @type {?MemizeCacheNode|undefined} */ |
|
512 var head; |
|
513 |
|
514 /** @type {?MemizeCacheNode|undefined} */ |
|
515 var tail; |
|
516 |
|
517 options = options || {}; |
477 |
518 |
478 function memoized( /* ...args */ ) { |
519 function memoized( /* ...args */ ) { |
479 var node = head, |
520 var node = head, |
480 len = arguments.length, |
521 len = arguments.length, |
481 args, i; |
522 args, i; |
511 tail = node.prev; |
552 tail = node.prev; |
512 } |
553 } |
513 |
554 |
514 // Adjust siblings to point to each other. If node was tail, |
555 // Adjust siblings to point to each other. If node was tail, |
515 // this also handles new tail's empty `next` assignment. |
556 // this also handles new tail's empty `next` assignment. |
516 node.prev.next = node.next; |
557 /** @type {MemizeCacheNode} */ ( node.prev ).next = node.next; |
517 if ( node.next ) { |
558 if ( node.next ) { |
518 node.next.prev = node.prev; |
559 node.next.prev = node.prev; |
519 } |
560 } |
520 |
561 |
521 node.next = head; |
562 node.next = head; |
522 node.prev = null; |
563 node.prev = null; |
523 head.prev = node; |
564 /** @type {MemizeCacheNode} */ ( head ).prev = node; |
524 head = node; |
565 head = node; |
525 } |
566 } |
526 |
567 |
527 // Return immediately |
568 // Return immediately |
528 return node.val; |
569 return node.val; |
538 |
579 |
539 node = { |
580 node = { |
540 args: args, |
581 args: args, |
541 |
582 |
542 // Generate the result from original function |
583 // Generate the result from original function |
543 val: fn.apply( null, args ) |
584 val: fn.apply( null, args ), |
544 }; |
585 }; |
545 |
586 |
546 // Don't need to check whether node is already head, since it would |
587 // Don't need to check whether node is already head, since it would |
547 // have been returned above already if it was |
588 // have been returned above already if it was |
548 |
589 |
554 // If no head, follows that there's no tail (at initial or reset) |
595 // If no head, follows that there's no tail (at initial or reset) |
555 tail = node; |
596 tail = node; |
556 } |
597 } |
557 |
598 |
558 // Trim tail if we're reached max size and are pending cache insertion |
599 // Trim tail if we're reached max size and are pending cache insertion |
559 if ( size === maxSize ) { |
600 if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) { |
560 tail = tail.prev; |
601 tail = /** @type {MemizeCacheNode} */ ( tail ).prev; |
561 tail.next = null; |
602 /** @type {MemizeCacheNode} */ ( tail ).next = null; |
562 } else { |
603 } else { |
563 size++; |
604 size++; |
564 } |
605 } |
565 |
606 |
566 head = node; |
607 head = node; |