9
|
1 |
this["wp"] = this["wp"] || {}; this["wp"]["annotations"] = |
|
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 = 370); |
|
86 |
/******/ }) |
|
87 |
/************************************************************************/ |
|
88 |
/******/ ({ |
|
89 |
|
|
90 |
/***/ 1: |
|
91 |
/***/ (function(module, exports) { |
|
92 |
|
|
93 |
(function() { module.exports = this["wp"]["i18n"]; }()); |
|
94 |
|
|
95 |
/***/ }), |
|
96 |
|
|
97 |
/***/ 15: |
|
98 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
99 |
|
|
100 |
"use strict"; |
|
101 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); |
|
102 |
function _defineProperty(obj, key, value) { |
|
103 |
if (key in obj) { |
|
104 |
Object.defineProperty(obj, key, { |
|
105 |
value: value, |
|
106 |
enumerable: true, |
|
107 |
configurable: true, |
|
108 |
writable: true |
|
109 |
}); |
|
110 |
} else { |
|
111 |
obj[key] = value; |
|
112 |
} |
|
113 |
|
|
114 |
return obj; |
|
115 |
} |
|
116 |
|
|
117 |
/***/ }), |
|
118 |
|
|
119 |
/***/ 17: |
|
120 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
121 |
|
|
122 |
"use strict"; |
|
123 |
|
|
124 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js |
|
125 |
function _arrayWithoutHoles(arr) { |
|
126 |
if (Array.isArray(arr)) { |
|
127 |
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { |
|
128 |
arr2[i] = arr[i]; |
|
129 |
} |
|
130 |
|
|
131 |
return arr2; |
|
132 |
} |
|
133 |
} |
|
134 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js |
|
135 |
var iterableToArray = __webpack_require__(34); |
|
136 |
|
|
137 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js |
|
138 |
function _nonIterableSpread() { |
|
139 |
throw new TypeError("Invalid attempt to spread non-iterable instance"); |
|
140 |
} |
|
141 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js |
|
142 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; }); |
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
function _toConsumableArray(arr) { |
|
147 |
return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread(); |
|
148 |
} |
|
149 |
|
|
150 |
/***/ }), |
|
151 |
|
|
152 |
/***/ 2: |
|
153 |
/***/ (function(module, exports) { |
|
154 |
|
|
155 |
(function() { module.exports = this["lodash"]; }()); |
|
156 |
|
|
157 |
/***/ }), |
|
158 |
|
|
159 |
/***/ 20: |
|
160 |
/***/ (function(module, exports) { |
|
161 |
|
|
162 |
(function() { module.exports = this["wp"]["richText"]; }()); |
|
163 |
|
|
164 |
/***/ }), |
|
165 |
|
|
166 |
/***/ 21: |
|
167 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
168 |
|
|
169 |
"use strict"; |
|
170 |
|
|
171 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js |
|
172 |
function _objectWithoutPropertiesLoose(source, excluded) { |
|
173 |
if (source == null) return {}; |
|
174 |
var target = {}; |
|
175 |
var sourceKeys = Object.keys(source); |
|
176 |
var key, i; |
|
177 |
|
|
178 |
for (i = 0; i < sourceKeys.length; i++) { |
|
179 |
key = sourceKeys[i]; |
|
180 |
if (excluded.indexOf(key) >= 0) continue; |
|
181 |
target[key] = source[key]; |
|
182 |
} |
|
183 |
|
|
184 |
return target; |
|
185 |
} |
|
186 |
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js |
|
187 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; }); |
|
188 |
|
|
189 |
function _objectWithoutProperties(source, excluded) { |
|
190 |
if (source == null) return {}; |
|
191 |
var target = _objectWithoutPropertiesLoose(source, excluded); |
|
192 |
var key, i; |
|
193 |
|
|
194 |
if (Object.getOwnPropertySymbols) { |
|
195 |
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); |
|
196 |
|
|
197 |
for (i = 0; i < sourceSymbolKeys.length; i++) { |
|
198 |
key = sourceSymbolKeys[i]; |
|
199 |
if (excluded.indexOf(key) >= 0) continue; |
|
200 |
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; |
|
201 |
target[key] = source[key]; |
|
202 |
} |
|
203 |
} |
|
204 |
|
|
205 |
return target; |
|
206 |
} |
|
207 |
|
|
208 |
/***/ }), |
|
209 |
|
|
210 |
/***/ 26: |
|
211 |
/***/ (function(module, exports) { |
|
212 |
|
|
213 |
(function() { module.exports = this["wp"]["hooks"]; }()); |
|
214 |
|
|
215 |
/***/ }), |
|
216 |
|
|
217 |
/***/ 30: |
|
218 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
219 |
|
|
220 |
"use strict"; |
|
221 |
|
|
222 |
|
|
223 |
var LEAF_KEY, hasWeakMap; |
|
224 |
|
|
225 |
/** |
|
226 |
* Arbitrary value used as key for referencing cache object in WeakMap tree. |
|
227 |
* |
|
228 |
* @type {Object} |
|
229 |
*/ |
|
230 |
LEAF_KEY = {}; |
|
231 |
|
|
232 |
/** |
|
233 |
* Whether environment supports WeakMap. |
|
234 |
* |
|
235 |
* @type {boolean} |
|
236 |
*/ |
|
237 |
hasWeakMap = typeof WeakMap !== 'undefined'; |
|
238 |
|
|
239 |
/** |
|
240 |
* Returns the first argument as the sole entry in an array. |
|
241 |
* |
|
242 |
* @param {*} value Value to return. |
|
243 |
* |
|
244 |
* @return {Array} Value returned as entry in array. |
|
245 |
*/ |
|
246 |
function arrayOf( value ) { |
|
247 |
return [ value ]; |
|
248 |
} |
|
249 |
|
|
250 |
/** |
|
251 |
* Returns true if the value passed is object-like, or false otherwise. A value |
|
252 |
* is object-like if it can support property assignment, e.g. object or array. |
|
253 |
* |
|
254 |
* @param {*} value Value to test. |
|
255 |
* |
|
256 |
* @return {boolean} Whether value is object-like. |
|
257 |
*/ |
|
258 |
function isObjectLike( value ) { |
|
259 |
return !! value && 'object' === typeof value; |
|
260 |
} |
|
261 |
|
|
262 |
/** |
|
263 |
* Creates and returns a new cache object. |
|
264 |
* |
|
265 |
* @return {Object} Cache object. |
|
266 |
*/ |
|
267 |
function createCache() { |
|
268 |
var cache = { |
|
269 |
clear: function() { |
|
270 |
cache.head = null; |
|
271 |
}, |
|
272 |
}; |
|
273 |
|
|
274 |
return cache; |
|
275 |
} |
|
276 |
|
|
277 |
/** |
|
278 |
* Returns true if entries within the two arrays are strictly equal by |
|
279 |
* reference from a starting index. |
|
280 |
* |
|
281 |
* @param {Array} a First array. |
|
282 |
* @param {Array} b Second array. |
|
283 |
* @param {number} fromIndex Index from which to start comparison. |
|
284 |
* |
|
285 |
* @return {boolean} Whether arrays are shallowly equal. |
|
286 |
*/ |
|
287 |
function isShallowEqual( a, b, fromIndex ) { |
|
288 |
var i; |
|
289 |
|
|
290 |
if ( a.length !== b.length ) { |
|
291 |
return false; |
|
292 |
} |
|
293 |
|
|
294 |
for ( i = fromIndex; i < a.length; i++ ) { |
|
295 |
if ( a[ i ] !== b[ i ] ) { |
|
296 |
return false; |
|
297 |
} |
|
298 |
} |
|
299 |
|
|
300 |
return true; |
|
301 |
} |
|
302 |
|
|
303 |
/** |
|
304 |
* Returns a memoized selector function. The getDependants function argument is |
|
305 |
* called before the memoized selector and is expected to return an immutable |
|
306 |
* reference or array of references on which the selector depends for computing |
|
307 |
* its own return value. The memoize cache is preserved only as long as those |
|
308 |
* dependant references remain the same. If getDependants returns a different |
|
309 |
* reference(s), the cache is cleared and the selector value regenerated. |
|
310 |
* |
|
311 |
* @param {Function} selector Selector function. |
|
312 |
* @param {Function} getDependants Dependant getter returning an immutable |
|
313 |
* reference or array of reference used in |
|
314 |
* cache bust consideration. |
|
315 |
* |
|
316 |
* @return {Function} Memoized selector. |
|
317 |
*/ |
|
318 |
/* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) { |
|
319 |
var rootCache, getCache; |
|
320 |
|
|
321 |
// Use object source as dependant if getter not provided |
|
322 |
if ( ! getDependants ) { |
|
323 |
getDependants = arrayOf; |
|
324 |
} |
|
325 |
|
|
326 |
/** |
|
327 |
* Returns the root cache. If WeakMap is supported, this is assigned to the |
|
328 |
* root WeakMap cache set, otherwise it is a shared instance of the default |
|
329 |
* cache object. |
|
330 |
* |
|
331 |
* @return {(WeakMap|Object)} Root cache object. |
|
332 |
*/ |
|
333 |
function getRootCache() { |
|
334 |
return rootCache; |
|
335 |
} |
|
336 |
|
|
337 |
/** |
|
338 |
* Returns the cache for a given dependants array. When possible, a WeakMap |
|
339 |
* will be used to create a unique cache for each set of dependants. This |
|
340 |
* is feasible due to the nature of WeakMap in allowing garbage collection |
|
341 |
* to occur on entries where the key object is no longer referenced. Since |
|
342 |
* WeakMap requires the key to be an object, this is only possible when the |
|
343 |
* dependant is object-like. The root cache is created as a hierarchy where |
|
344 |
* each top-level key is the first entry in a dependants set, the value a |
|
345 |
* WeakMap where each key is the next dependant, and so on. This continues |
|
346 |
* so long as the dependants are object-like. If no dependants are object- |
|
347 |
* like, then the cache is shared across all invocations. |
|
348 |
* |
|
349 |
* @see isObjectLike |
|
350 |
* |
|
351 |
* @param {Array} dependants Selector dependants. |
|
352 |
* |
|
353 |
* @return {Object} Cache object. |
|
354 |
*/ |
|
355 |
function getWeakMapCache( dependants ) { |
|
356 |
var caches = rootCache, |
|
357 |
isUniqueByDependants = true, |
|
358 |
i, dependant, map, cache; |
|
359 |
|
|
360 |
for ( i = 0; i < dependants.length; i++ ) { |
|
361 |
dependant = dependants[ i ]; |
|
362 |
|
|
363 |
// Can only compose WeakMap from object-like key. |
|
364 |
if ( ! isObjectLike( dependant ) ) { |
|
365 |
isUniqueByDependants = false; |
|
366 |
break; |
|
367 |
} |
|
368 |
|
|
369 |
// Does current segment of cache already have a WeakMap? |
|
370 |
if ( caches.has( dependant ) ) { |
|
371 |
// Traverse into nested WeakMap. |
|
372 |
caches = caches.get( dependant ); |
|
373 |
} else { |
|
374 |
// Create, set, and traverse into a new one. |
|
375 |
map = new WeakMap(); |
|
376 |
caches.set( dependant, map ); |
|
377 |
caches = map; |
|
378 |
} |
|
379 |
} |
|
380 |
|
|
381 |
// We use an arbitrary (but consistent) object as key for the last item |
|
382 |
// in the WeakMap to serve as our running cache. |
|
383 |
if ( ! caches.has( LEAF_KEY ) ) { |
|
384 |
cache = createCache(); |
|
385 |
cache.isUniqueByDependants = isUniqueByDependants; |
|
386 |
caches.set( LEAF_KEY, cache ); |
|
387 |
} |
|
388 |
|
|
389 |
return caches.get( LEAF_KEY ); |
|
390 |
} |
|
391 |
|
|
392 |
// Assign cache handler by availability of WeakMap |
|
393 |
getCache = hasWeakMap ? getWeakMapCache : getRootCache; |
|
394 |
|
|
395 |
/** |
|
396 |
* Resets root memoization cache. |
|
397 |
*/ |
|
398 |
function clear() { |
|
399 |
rootCache = hasWeakMap ? new WeakMap() : createCache(); |
|
400 |
} |
|
401 |
|
|
402 |
// eslint-disable-next-line jsdoc/check-param-names |
|
403 |
/** |
|
404 |
* The augmented selector call, considering first whether dependants have |
|
405 |
* changed before passing it to underlying memoize function. |
|
406 |
* |
|
407 |
* @param {Object} source Source object for derivation. |
|
408 |
* @param {...*} extraArgs Additional arguments to pass to selector. |
|
409 |
* |
|
410 |
* @return {*} Selector result. |
|
411 |
*/ |
|
412 |
function callSelector( /* source, ...extraArgs */ ) { |
|
413 |
var len = arguments.length, |
|
414 |
cache, node, i, args, dependants; |
|
415 |
|
|
416 |
// Create copy of arguments (avoid leaking deoptimization). |
|
417 |
args = new Array( len ); |
|
418 |
for ( i = 0; i < len; i++ ) { |
|
419 |
args[ i ] = arguments[ i ]; |
|
420 |
} |
|
421 |
|
|
422 |
dependants = getDependants.apply( null, args ); |
|
423 |
cache = getCache( dependants ); |
|
424 |
|
|
425 |
// If not guaranteed uniqueness by dependants (primitive type or lack |
|
426 |
// of WeakMap support), shallow compare against last dependants and, if |
|
427 |
// references have changed, destroy cache to recalculate result. |
|
428 |
if ( ! cache.isUniqueByDependants ) { |
|
429 |
if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) { |
|
430 |
cache.clear(); |
|
431 |
} |
|
432 |
|
|
433 |
cache.lastDependants = dependants; |
|
434 |
} |
|
435 |
|
|
436 |
node = cache.head; |
|
437 |
while ( node ) { |
|
438 |
// Check whether node arguments match arguments |
|
439 |
if ( ! isShallowEqual( node.args, args, 1 ) ) { |
|
440 |
node = node.next; |
|
441 |
continue; |
|
442 |
} |
|
443 |
|
|
444 |
// At this point we can assume we've found a match |
|
445 |
|
|
446 |
// Surface matched node to head if not already |
|
447 |
if ( node !== cache.head ) { |
|
448 |
// Adjust siblings to point to each other. |
|
449 |
node.prev.next = node.next; |
|
450 |
if ( node.next ) { |
|
451 |
node.next.prev = node.prev; |
|
452 |
} |
|
453 |
|
|
454 |
node.next = cache.head; |
|
455 |
node.prev = null; |
|
456 |
cache.head.prev = node; |
|
457 |
cache.head = node; |
|
458 |
} |
|
459 |
|
|
460 |
// Return immediately |
|
461 |
return node.val; |
|
462 |
} |
|
463 |
|
|
464 |
// No cached value found. Continue to insertion phase: |
|
465 |
|
|
466 |
node = { |
|
467 |
// Generate the result from original function |
|
468 |
val: selector.apply( null, args ), |
|
469 |
}; |
|
470 |
|
|
471 |
// Avoid including the source object in the cache. |
|
472 |
args[ 0 ] = null; |
|
473 |
node.args = args; |
|
474 |
|
|
475 |
// Don't need to check whether node is already head, since it would |
|
476 |
// have been returned above already if it was |
|
477 |
|
|
478 |
// Shift existing head down list |
|
479 |
if ( cache.head ) { |
|
480 |
cache.head.prev = node; |
|
481 |
node.next = cache.head; |
|
482 |
} |
|
483 |
|
|
484 |
cache.head = node; |
|
485 |
|
|
486 |
return node.val; |
|
487 |
} |
|
488 |
|
|
489 |
callSelector.getDependants = getDependants; |
|
490 |
callSelector.clear = clear; |
|
491 |
clear(); |
|
492 |
|
|
493 |
return callSelector; |
|
494 |
}); |
|
495 |
|
|
496 |
|
|
497 |
/***/ }), |
|
498 |
|
|
499 |
/***/ 34: |
|
500 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
501 |
|
|
502 |
"use strict"; |
|
503 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; }); |
|
504 |
function _iterableToArray(iter) { |
|
505 |
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); |
|
506 |
} |
|
507 |
|
|
508 |
/***/ }), |
|
509 |
|
|
510 |
/***/ 370: |
|
511 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
512 |
|
|
513 |
"use strict"; |
|
514 |
__webpack_require__.r(__webpack_exports__); |
|
515 |
var selectors_namespaceObject = {}; |
|
516 |
__webpack_require__.r(selectors_namespaceObject); |
|
517 |
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetAnnotationsForBlock", function() { return __experimentalGetAnnotationsForBlock; }); |
|
518 |
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetAllAnnotationsForBlock", function() { return selectors_experimentalGetAllAnnotationsForBlock; }); |
|
519 |
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetAnnotationsForRichText", function() { return __experimentalGetAnnotationsForRichText; }); |
|
520 |
__webpack_require__.d(selectors_namespaceObject, "__experimentalGetAnnotations", function() { return __experimentalGetAnnotations; }); |
|
521 |
var actions_namespaceObject = {}; |
|
522 |
__webpack_require__.r(actions_namespaceObject); |
|
523 |
__webpack_require__.d(actions_namespaceObject, "__experimentalAddAnnotation", function() { return __experimentalAddAnnotation; }); |
|
524 |
__webpack_require__.d(actions_namespaceObject, "__experimentalRemoveAnnotation", function() { return __experimentalRemoveAnnotation; }); |
|
525 |
__webpack_require__.d(actions_namespaceObject, "__experimentalUpdateAnnotationRange", function() { return __experimentalUpdateAnnotationRange; }); |
|
526 |
__webpack_require__.d(actions_namespaceObject, "__experimentalRemoveAnnotationsBySource", function() { return __experimentalRemoveAnnotationsBySource; }); |
|
527 |
|
|
528 |
// EXTERNAL MODULE: external {"this":["wp","data"]} |
|
529 |
var external_this_wp_data_ = __webpack_require__(5); |
|
530 |
|
|
531 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js |
|
532 |
var defineProperty = __webpack_require__(15); |
|
533 |
|
|
534 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules |
|
535 |
var toConsumableArray = __webpack_require__(17); |
|
536 |
|
|
537 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js |
|
538 |
var objectSpread = __webpack_require__(7); |
|
539 |
|
|
540 |
// EXTERNAL MODULE: external "lodash" |
|
541 |
var external_lodash_ = __webpack_require__(2); |
|
542 |
|
|
543 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/reducer.js |
|
544 |
|
|
545 |
|
|
546 |
|
|
547 |
|
|
548 |
/** |
|
549 |
* External dependencies |
|
550 |
*/ |
|
551 |
|
|
552 |
/** |
|
553 |
* Filters an array based on the predicate, but keeps the reference the same if |
|
554 |
* the array hasn't changed. |
|
555 |
* |
|
556 |
* @param {Array} collection The collection to filter. |
|
557 |
* @param {Function} predicate Function that determines if the item should stay |
|
558 |
* in the array. |
|
559 |
* @return {Array} Filtered array. |
|
560 |
*/ |
|
561 |
|
|
562 |
function filterWithReference(collection, predicate) { |
|
563 |
var filteredCollection = collection.filter(predicate); |
|
564 |
return collection.length === filteredCollection.length ? collection : filteredCollection; |
|
565 |
} |
|
566 |
/** |
|
567 |
* Verifies whether the given annotations is a valid annotation. |
|
568 |
* |
|
569 |
* @param {Object} annotation The annotation to verify. |
|
570 |
* @return {boolean} Whether the given annotation is valid. |
|
571 |
*/ |
|
572 |
|
|
573 |
|
|
574 |
function isValidAnnotationRange(annotation) { |
|
575 |
return Object(external_lodash_["isNumber"])(annotation.start) && Object(external_lodash_["isNumber"])(annotation.end) && annotation.start <= annotation.end; |
|
576 |
} |
|
577 |
/** |
|
578 |
* Reducer managing annotations. |
|
579 |
* |
|
580 |
* @param {Array} state The annotations currently shown in the editor. |
|
581 |
* @param {Object} action Dispatched action. |
|
582 |
* |
|
583 |
* @return {Array} Updated state. |
|
584 |
*/ |
|
585 |
|
|
586 |
|
|
587 |
function reducer_annotations() { |
|
588 |
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
589 |
var action = arguments.length > 1 ? arguments[1] : undefined; |
|
590 |
|
|
591 |
switch (action.type) { |
|
592 |
case 'ANNOTATION_ADD': |
|
593 |
var blockClientId = action.blockClientId; |
|
594 |
var newAnnotation = { |
|
595 |
id: action.id, |
|
596 |
blockClientId: blockClientId, |
|
597 |
richTextIdentifier: action.richTextIdentifier, |
|
598 |
source: action.source, |
|
599 |
selector: action.selector, |
|
600 |
range: action.range |
|
601 |
}; |
|
602 |
|
|
603 |
if (newAnnotation.selector === 'range' && !isValidAnnotationRange(newAnnotation.range)) { |
|
604 |
return state; |
|
605 |
} |
|
606 |
|
|
607 |
var previousAnnotationsForBlock = Object(external_lodash_["get"])(state, blockClientId, []); |
|
608 |
return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, blockClientId, [].concat(Object(toConsumableArray["a" /* default */])(previousAnnotationsForBlock), [newAnnotation]))); |
|
609 |
|
|
610 |
case 'ANNOTATION_REMOVE': |
|
611 |
return Object(external_lodash_["mapValues"])(state, function (annotationsForBlock) { |
|
612 |
return filterWithReference(annotationsForBlock, function (annotation) { |
|
613 |
return annotation.id !== action.annotationId; |
|
614 |
}); |
|
615 |
}); |
|
616 |
|
|
617 |
case 'ANNOTATION_UPDATE_RANGE': |
|
618 |
return Object(external_lodash_["mapValues"])(state, function (annotationsForBlock) { |
|
619 |
var hasChangedRange = false; |
|
620 |
var newAnnotations = annotationsForBlock.map(function (annotation) { |
|
621 |
if (annotation.id === action.annotationId) { |
|
622 |
hasChangedRange = true; |
|
623 |
return Object(objectSpread["a" /* default */])({}, annotation, { |
|
624 |
range: { |
|
625 |
start: action.start, |
|
626 |
end: action.end |
|
627 |
} |
|
628 |
}); |
|
629 |
} |
|
630 |
|
|
631 |
return annotation; |
|
632 |
}); |
|
633 |
return hasChangedRange ? newAnnotations : annotationsForBlock; |
|
634 |
}); |
|
635 |
|
|
636 |
case 'ANNOTATION_REMOVE_SOURCE': |
|
637 |
return Object(external_lodash_["mapValues"])(state, function (annotationsForBlock) { |
|
638 |
return filterWithReference(annotationsForBlock, function (annotation) { |
|
639 |
return annotation.source !== action.source; |
|
640 |
}); |
|
641 |
}); |
|
642 |
} |
|
643 |
|
|
644 |
return state; |
|
645 |
} |
|
646 |
/* harmony default export */ var reducer = (reducer_annotations); |
|
647 |
|
|
648 |
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js + 1 modules |
|
649 |
var objectWithoutProperties = __webpack_require__(21); |
|
650 |
|
|
651 |
// EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js |
|
652 |
var rememo = __webpack_require__(30); |
|
653 |
|
|
654 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/selectors.js |
|
655 |
|
|
656 |
|
|
657 |
|
|
658 |
/** |
|
659 |
* External dependencies |
|
660 |
*/ |
|
661 |
|
|
662 |
|
|
663 |
/** |
|
664 |
* Shared reference to an empty array for cases where it is important to avoid |
|
665 |
* returning a new array reference on every invocation, as in a connected or |
|
666 |
* other pure component which performs `shouldComponentUpdate` check on props. |
|
667 |
* This should be used as a last resort, since the normalized data should be |
|
668 |
* maintained by the reducer result in state. |
|
669 |
* |
|
670 |
* @type {Array} |
|
671 |
*/ |
|
672 |
|
|
673 |
var EMPTY_ARRAY = []; |
|
674 |
/** |
|
675 |
* Returns the annotations for a specific client ID. |
|
676 |
* |
|
677 |
* @param {Object} state Editor state. |
|
678 |
* @param {string} clientId The ID of the block to get the annotations for. |
|
679 |
* |
|
680 |
* @return {Array} The annotations applicable to this block. |
|
681 |
*/ |
|
682 |
|
|
683 |
var __experimentalGetAnnotationsForBlock = Object(rememo["a" /* default */])(function (state, blockClientId) { |
|
684 |
return Object(external_lodash_["get"])(state, blockClientId, []).filter(function (annotation) { |
|
685 |
return annotation.selector === 'block'; |
|
686 |
}); |
|
687 |
}, function (state, blockClientId) { |
|
688 |
return [Object(external_lodash_["get"])(state, blockClientId, EMPTY_ARRAY)]; |
|
689 |
}); |
|
690 |
var selectors_experimentalGetAllAnnotationsForBlock = function __experimentalGetAllAnnotationsForBlock(state, blockClientId) { |
|
691 |
return Object(external_lodash_["get"])(state, blockClientId, EMPTY_ARRAY); |
|
692 |
}; |
|
693 |
/** |
|
694 |
* Returns the annotations that apply to the given RichText instance. |
|
695 |
* |
|
696 |
* Both a blockClientId and a richTextIdentifier are required. This is because |
|
697 |
* a block might have multiple `RichText` components. This does mean that every |
|
698 |
* block needs to implement annotations itself. |
|
699 |
* |
|
700 |
* @param {Object} state Editor state. |
|
701 |
* @param {string} blockClientId The client ID for the block. |
|
702 |
* @param {string} richTextIdentifier Unique identifier that identifies the given RichText. |
|
703 |
* @return {Array} All the annotations relevant for the `RichText`. |
|
704 |
*/ |
|
705 |
|
|
706 |
var __experimentalGetAnnotationsForRichText = Object(rememo["a" /* default */])(function (state, blockClientId, richTextIdentifier) { |
|
707 |
return Object(external_lodash_["get"])(state, blockClientId, []).filter(function (annotation) { |
|
708 |
return annotation.selector === 'range' && richTextIdentifier === annotation.richTextIdentifier; |
|
709 |
}).map(function (annotation) { |
|
710 |
var range = annotation.range, |
|
711 |
other = Object(objectWithoutProperties["a" /* default */])(annotation, ["range"]); |
|
712 |
|
|
713 |
return Object(objectSpread["a" /* default */])({}, range, other); |
|
714 |
}); |
|
715 |
}, function (state, blockClientId) { |
|
716 |
return [Object(external_lodash_["get"])(state, blockClientId, EMPTY_ARRAY)]; |
|
717 |
}); |
|
718 |
/** |
|
719 |
* Returns all annotations in the editor state. |
|
720 |
* |
|
721 |
* @param {Object} state Editor state. |
|
722 |
* @return {Array} All annotations currently applied. |
|
723 |
*/ |
|
724 |
|
|
725 |
function __experimentalGetAnnotations(state) { |
|
726 |
return Object(external_lodash_["flatMap"])(state, function (annotations) { |
|
727 |
return annotations; |
|
728 |
}); |
|
729 |
} |
|
730 |
|
|
731 |
// EXTERNAL MODULE: ./node_modules/uuid/v4.js |
|
732 |
var v4 = __webpack_require__(65); |
|
733 |
var v4_default = /*#__PURE__*/__webpack_require__.n(v4); |
|
734 |
|
|
735 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/actions.js |
|
736 |
/** |
|
737 |
* External dependencies |
|
738 |
*/ |
|
739 |
|
|
740 |
/** |
|
741 |
* Adds an annotation to a block. |
|
742 |
* |
|
743 |
* The `block` attribute refers to a block ID that needs to be annotated. |
|
744 |
* `isBlockAnnotation` controls whether or not the annotation is a block |
|
745 |
* annotation. The `source` is the source of the annotation, this will be used |
|
746 |
* to identity groups of annotations. |
|
747 |
* |
|
748 |
* The `range` property is only relevant if the selector is 'range'. |
|
749 |
* |
|
750 |
* @param {Object} annotation The annotation to add. |
|
751 |
* @param {string} blockClientId The blockClientId to add the annotation to. |
|
752 |
* @param {string} richTextIdentifier Identifier for the RichText instance the annotation applies to. |
|
753 |
* @param {Object} range The range at which to apply this annotation. |
|
754 |
* @param {number} range.start The offset where the annotation should start. |
|
755 |
* @param {number} range.end The offset where the annotation should end. |
|
756 |
* @param {string} [selector="range"] The way to apply this annotation. |
|
757 |
* @param {string} [source="default"] The source that added the annotation. |
|
758 |
* @param {string} [id=uuid()] The ID the annotation should have. |
|
759 |
* Generates a UUID by default. |
|
760 |
* |
|
761 |
* @return {Object} Action object. |
|
762 |
*/ |
|
763 |
|
|
764 |
function __experimentalAddAnnotation(_ref) { |
|
765 |
var blockClientId = _ref.blockClientId, |
|
766 |
_ref$richTextIdentifi = _ref.richTextIdentifier, |
|
767 |
richTextIdentifier = _ref$richTextIdentifi === void 0 ? null : _ref$richTextIdentifi, |
|
768 |
_ref$range = _ref.range, |
|
769 |
range = _ref$range === void 0 ? null : _ref$range, |
|
770 |
_ref$selector = _ref.selector, |
|
771 |
selector = _ref$selector === void 0 ? 'range' : _ref$selector, |
|
772 |
_ref$source = _ref.source, |
|
773 |
source = _ref$source === void 0 ? 'default' : _ref$source, |
|
774 |
_ref$id = _ref.id, |
|
775 |
id = _ref$id === void 0 ? v4_default()() : _ref$id; |
|
776 |
var action = { |
|
777 |
type: 'ANNOTATION_ADD', |
|
778 |
id: id, |
|
779 |
blockClientId: blockClientId, |
|
780 |
richTextIdentifier: richTextIdentifier, |
|
781 |
source: source, |
|
782 |
selector: selector |
|
783 |
}; |
|
784 |
|
|
785 |
if (selector === 'range') { |
|
786 |
action.range = range; |
|
787 |
} |
|
788 |
|
|
789 |
return action; |
|
790 |
} |
|
791 |
/** |
|
792 |
* Removes an annotation with a specific ID. |
|
793 |
* |
|
794 |
* @param {string} annotationId The annotation to remove. |
|
795 |
* |
|
796 |
* @return {Object} Action object. |
|
797 |
*/ |
|
798 |
|
|
799 |
function __experimentalRemoveAnnotation(annotationId) { |
|
800 |
return { |
|
801 |
type: 'ANNOTATION_REMOVE', |
|
802 |
annotationId: annotationId |
|
803 |
}; |
|
804 |
} |
|
805 |
/** |
|
806 |
* Updates the range of an annotation. |
|
807 |
* |
|
808 |
* @param {string} annotationId ID of the annotation to update. |
|
809 |
* @param {number} start The start of the new range. |
|
810 |
* @param {number} end The end of the new range. |
|
811 |
* |
|
812 |
* @return {Object} Action object. |
|
813 |
*/ |
|
814 |
|
|
815 |
function __experimentalUpdateAnnotationRange(annotationId, start, end) { |
|
816 |
return { |
|
817 |
type: 'ANNOTATION_UPDATE_RANGE', |
|
818 |
annotationId: annotationId, |
|
819 |
start: start, |
|
820 |
end: end |
|
821 |
}; |
|
822 |
} |
|
823 |
/** |
|
824 |
* Removes all annotations of a specific source. |
|
825 |
* |
|
826 |
* @param {string} source The source to remove. |
|
827 |
* |
|
828 |
* @return {Object} Action object. |
|
829 |
*/ |
|
830 |
|
|
831 |
function __experimentalRemoveAnnotationsBySource(source) { |
|
832 |
return { |
|
833 |
type: 'ANNOTATION_REMOVE_SOURCE', |
|
834 |
source: source |
|
835 |
}; |
|
836 |
} |
|
837 |
|
|
838 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/store/index.js |
|
839 |
/** |
|
840 |
* WordPress dependencies |
|
841 |
*/ |
|
842 |
|
|
843 |
/** |
|
844 |
* Internal dependencies |
|
845 |
*/ |
|
846 |
|
|
847 |
|
|
848 |
|
|
849 |
|
|
850 |
/** |
|
851 |
* Module Constants |
|
852 |
*/ |
|
853 |
|
|
854 |
var MODULE_KEY = 'core/annotations'; |
|
855 |
var store = Object(external_this_wp_data_["registerStore"])(MODULE_KEY, { |
|
856 |
reducer: reducer, |
|
857 |
selectors: selectors_namespaceObject, |
|
858 |
actions: actions_namespaceObject |
|
859 |
}); |
|
860 |
/* harmony default export */ var build_module_store = (store); |
|
861 |
|
|
862 |
// EXTERNAL MODULE: external {"this":["wp","richText"]} |
|
863 |
var external_this_wp_richText_ = __webpack_require__(20); |
|
864 |
|
|
865 |
// EXTERNAL MODULE: ./node_modules/memize/index.js |
|
866 |
var memize = __webpack_require__(41); |
|
867 |
var memize_default = /*#__PURE__*/__webpack_require__.n(memize); |
|
868 |
|
|
869 |
// EXTERNAL MODULE: external {"this":["wp","i18n"]} |
|
870 |
var external_this_wp_i18n_ = __webpack_require__(1); |
|
871 |
|
|
872 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/format/annotation.js |
|
873 |
/** |
|
874 |
* External dependencies |
|
875 |
*/ |
|
876 |
|
|
877 |
/** |
|
878 |
* WordPress dependencies |
|
879 |
*/ |
|
880 |
|
|
881 |
|
|
882 |
|
|
883 |
var FORMAT_NAME = 'core/annotation'; |
|
884 |
var ANNOTATION_ATTRIBUTE_PREFIX = 'annotation-text-'; |
|
885 |
var STORE_KEY = 'core/annotations'; |
|
886 |
/** |
|
887 |
* Applies given annotations to the given record. |
|
888 |
* |
|
889 |
* @param {Object} record The record to apply annotations to. |
|
890 |
* @param {Array} annotations The annotation to apply. |
|
891 |
* @return {Object} A record with the annotations applied. |
|
892 |
*/ |
|
893 |
|
|
894 |
function applyAnnotations(record) { |
|
895 |
var annotations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; |
|
896 |
annotations.forEach(function (annotation) { |
|
897 |
var start = annotation.start, |
|
898 |
end = annotation.end; |
|
899 |
|
|
900 |
if (start > record.text.length) { |
|
901 |
start = record.text.length; |
|
902 |
} |
|
903 |
|
|
904 |
if (end > record.text.length) { |
|
905 |
end = record.text.length; |
|
906 |
} |
|
907 |
|
|
908 |
var className = ANNOTATION_ATTRIBUTE_PREFIX + annotation.source; |
|
909 |
var id = ANNOTATION_ATTRIBUTE_PREFIX + annotation.id; |
|
910 |
record = Object(external_this_wp_richText_["applyFormat"])(record, { |
|
911 |
type: FORMAT_NAME, |
|
912 |
attributes: { |
|
913 |
className: className, |
|
914 |
id: id |
|
915 |
} |
|
916 |
}, start, end); |
|
917 |
}); |
|
918 |
return record; |
|
919 |
} |
|
920 |
/** |
|
921 |
* Removes annotations from the given record. |
|
922 |
* |
|
923 |
* @param {Object} record Record to remove annotations from. |
|
924 |
* @return {Object} The cleaned record. |
|
925 |
*/ |
|
926 |
|
|
927 |
function removeAnnotations(record) { |
|
928 |
return Object(external_this_wp_richText_["removeFormat"])(record, 'core/annotation', 0, record.text.length); |
|
929 |
} |
|
930 |
/** |
|
931 |
* Retrieves the positions of annotations inside an array of formats. |
|
932 |
* |
|
933 |
* @param {Array} formats Formats with annotations in there. |
|
934 |
* @return {Object} ID keyed positions of annotations. |
|
935 |
*/ |
|
936 |
|
|
937 |
function retrieveAnnotationPositions(formats) { |
|
938 |
var positions = {}; |
|
939 |
formats.forEach(function (characterFormats, i) { |
|
940 |
characterFormats = characterFormats || []; |
|
941 |
characterFormats = characterFormats.filter(function (format) { |
|
942 |
return format.type === FORMAT_NAME; |
|
943 |
}); |
|
944 |
characterFormats.forEach(function (format) { |
|
945 |
var id = format.attributes.id; |
|
946 |
id = id.replace(ANNOTATION_ATTRIBUTE_PREFIX, ''); |
|
947 |
|
|
948 |
if (!positions.hasOwnProperty(id)) { |
|
949 |
positions[id] = { |
|
950 |
start: i |
|
951 |
}; |
|
952 |
} // Annotations refer to positions between characters. |
|
953 |
// Formats refer to the character themselves. |
|
954 |
// So we need to adjust for that here. |
|
955 |
|
|
956 |
|
|
957 |
positions[id].end = i + 1; |
|
958 |
}); |
|
959 |
}); |
|
960 |
return positions; |
|
961 |
} |
|
962 |
/** |
|
963 |
* Updates annotations in the state based on positions retrieved from RichText. |
|
964 |
* |
|
965 |
* @param {Array} annotations The annotations that are currently applied. |
|
966 |
* @param {Array} positions The current positions of the given annotations. |
|
967 |
* @param {Function} removeAnnotation Function to remove an annotation from the state. |
|
968 |
* @param {Function} updateAnnotationRange Function to update an annotation range in the state. |
|
969 |
*/ |
|
970 |
|
|
971 |
|
|
972 |
function updateAnnotationsWithPositions(annotations, positions, _ref) { |
|
973 |
var removeAnnotation = _ref.removeAnnotation, |
|
974 |
updateAnnotationRange = _ref.updateAnnotationRange; |
|
975 |
annotations.forEach(function (currentAnnotation) { |
|
976 |
var position = positions[currentAnnotation.id]; // If we cannot find an annotation, delete it. |
|
977 |
|
|
978 |
if (!position) { |
|
979 |
// Apparently the annotation has been removed, so remove it from the state: |
|
980 |
// Remove... |
|
981 |
removeAnnotation(currentAnnotation.id); |
|
982 |
return; |
|
983 |
} |
|
984 |
|
|
985 |
var start = currentAnnotation.start, |
|
986 |
end = currentAnnotation.end; |
|
987 |
|
|
988 |
if (start !== position.start || end !== position.end) { |
|
989 |
updateAnnotationRange(currentAnnotation.id, position.start, position.end); |
|
990 |
} |
|
991 |
}); |
|
992 |
} |
|
993 |
/** |
|
994 |
* Create prepareEditableTree memoized based on the annotation props. |
|
995 |
* |
|
996 |
* @param {Object} The props with annotations in them. |
|
997 |
* |
|
998 |
* @return {Function} The prepareEditableTree. |
|
999 |
*/ |
|
1000 |
|
|
1001 |
|
|
1002 |
var createPrepareEditableTree = memize_default()(function (props) { |
|
1003 |
var annotations = props.annotations; |
|
1004 |
return function (formats, text) { |
|
1005 |
if (annotations.length === 0) { |
|
1006 |
return formats; |
|
1007 |
} |
|
1008 |
|
|
1009 |
var record = { |
|
1010 |
formats: formats, |
|
1011 |
text: text |
|
1012 |
}; |
|
1013 |
record = applyAnnotations(record, annotations); |
|
1014 |
return record.formats; |
|
1015 |
}; |
|
1016 |
}); |
|
1017 |
/** |
|
1018 |
* Returns the annotations as a props object. Memoized to prevent re-renders. |
|
1019 |
* |
|
1020 |
* @param {Array} The annotations to put in the object. |
|
1021 |
* |
|
1022 |
* @return {Object} The annotations props object. |
|
1023 |
*/ |
|
1024 |
|
|
1025 |
var getAnnotationObject = memize_default()(function (annotations) { |
|
1026 |
return { |
|
1027 |
annotations: annotations |
|
1028 |
}; |
|
1029 |
}); |
|
1030 |
var annotation_annotation = { |
|
1031 |
name: FORMAT_NAME, |
|
1032 |
title: Object(external_this_wp_i18n_["__"])('Annotation'), |
|
1033 |
tagName: 'mark', |
|
1034 |
className: 'annotation-text', |
|
1035 |
attributes: { |
|
1036 |
className: 'class', |
|
1037 |
id: 'id' |
|
1038 |
}, |
|
1039 |
edit: function edit() { |
|
1040 |
return null; |
|
1041 |
}, |
|
1042 |
__experimentalGetPropsForEditableTreePreparation: function __experimentalGetPropsForEditableTreePreparation(select, _ref2) { |
|
1043 |
var richTextIdentifier = _ref2.richTextIdentifier, |
|
1044 |
blockClientId = _ref2.blockClientId; |
|
1045 |
return getAnnotationObject(select(STORE_KEY).__experimentalGetAnnotationsForRichText(blockClientId, richTextIdentifier)); |
|
1046 |
}, |
|
1047 |
__experimentalCreatePrepareEditableTree: createPrepareEditableTree, |
|
1048 |
__experimentalGetPropsForEditableTreeChangeHandler: function __experimentalGetPropsForEditableTreeChangeHandler(dispatch) { |
|
1049 |
return { |
|
1050 |
removeAnnotation: dispatch(STORE_KEY).__experimentalRemoveAnnotation, |
|
1051 |
updateAnnotationRange: dispatch(STORE_KEY).__experimentalUpdateAnnotationRange |
|
1052 |
}; |
|
1053 |
}, |
|
1054 |
__experimentalCreateOnChangeEditableValue: function __experimentalCreateOnChangeEditableValue(props) { |
|
1055 |
return function (formats) { |
|
1056 |
var positions = retrieveAnnotationPositions(formats); |
|
1057 |
var removeAnnotation = props.removeAnnotation, |
|
1058 |
updateAnnotationRange = props.updateAnnotationRange, |
|
1059 |
annotations = props.annotations; |
|
1060 |
updateAnnotationsWithPositions(annotations, positions, { |
|
1061 |
removeAnnotation: removeAnnotation, |
|
1062 |
updateAnnotationRange: updateAnnotationRange |
|
1063 |
}); |
|
1064 |
}; |
|
1065 |
} |
|
1066 |
}; |
|
1067 |
|
|
1068 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/format/index.js |
|
1069 |
|
|
1070 |
|
|
1071 |
/** |
|
1072 |
* WordPress dependencies |
|
1073 |
*/ |
|
1074 |
|
|
1075 |
/** |
|
1076 |
* Internal dependencies |
|
1077 |
*/ |
|
1078 |
|
|
1079 |
|
|
1080 |
|
|
1081 |
var format_name = annotation_annotation.name, |
|
1082 |
settings = Object(objectWithoutProperties["a" /* default */])(annotation_annotation, ["name"]); |
|
1083 |
|
|
1084 |
Object(external_this_wp_richText_["registerFormatType"])(format_name, settings); |
|
1085 |
|
|
1086 |
// EXTERNAL MODULE: external {"this":["wp","hooks"]} |
|
1087 |
var external_this_wp_hooks_ = __webpack_require__(26); |
|
1088 |
|
|
1089 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/block/index.js |
|
1090 |
/** |
|
1091 |
* WordPress dependencies |
|
1092 |
*/ |
|
1093 |
|
|
1094 |
|
|
1095 |
/** |
|
1096 |
* Adds annotation className to the block-list-block component. |
|
1097 |
* |
|
1098 |
* @param {Object} OriginalComponent The original BlockListBlock component. |
|
1099 |
* @return {Object} The enhanced component. |
|
1100 |
*/ |
|
1101 |
|
|
1102 |
var block_addAnnotationClassName = function addAnnotationClassName(OriginalComponent) { |
|
1103 |
return Object(external_this_wp_data_["withSelect"])(function (select, _ref) { |
|
1104 |
var clientId = _ref.clientId; |
|
1105 |
|
|
1106 |
var annotations = select('core/annotations').__experimentalGetAnnotationsForBlock(clientId); |
|
1107 |
|
|
1108 |
return { |
|
1109 |
className: annotations.map(function (annotation) { |
|
1110 |
return 'is-annotated-by-' + annotation.source; |
|
1111 |
}).join(' ') |
|
1112 |
}; |
|
1113 |
})(OriginalComponent); |
|
1114 |
}; |
|
1115 |
|
|
1116 |
Object(external_this_wp_hooks_["addFilter"])('editor.BlockListBlock', 'core/annotations', block_addAnnotationClassName); |
|
1117 |
|
|
1118 |
// CONCATENATED MODULE: ./node_modules/@wordpress/annotations/build-module/index.js |
|
1119 |
/** |
|
1120 |
* Internal dependencies |
|
1121 |
*/ |
|
1122 |
|
|
1123 |
|
|
1124 |
|
|
1125 |
|
|
1126 |
|
|
1127 |
/***/ }), |
|
1128 |
|
|
1129 |
/***/ 41: |
|
1130 |
/***/ (function(module, exports, __webpack_require__) { |
|
1131 |
|
|
1132 |
module.exports = function memize( fn, options ) { |
|
1133 |
var size = 0, |
|
1134 |
maxSize, head, tail; |
|
1135 |
|
|
1136 |
if ( options && options.maxSize ) { |
|
1137 |
maxSize = options.maxSize; |
|
1138 |
} |
|
1139 |
|
|
1140 |
function memoized( /* ...args */ ) { |
|
1141 |
var node = head, |
|
1142 |
len = arguments.length, |
|
1143 |
args, i; |
|
1144 |
|
|
1145 |
searchCache: while ( node ) { |
|
1146 |
// Perform a shallow equality test to confirm that whether the node |
|
1147 |
// under test is a candidate for the arguments passed. Two arrays |
|
1148 |
// are shallowly equal if their length matches and each entry is |
|
1149 |
// strictly equal between the two sets. Avoid abstracting to a |
|
1150 |
// function which could incur an arguments leaking deoptimization. |
|
1151 |
|
|
1152 |
// Check whether node arguments match arguments length |
|
1153 |
if ( node.args.length !== arguments.length ) { |
|
1154 |
node = node.next; |
|
1155 |
continue; |
|
1156 |
} |
|
1157 |
|
|
1158 |
// Check whether node arguments match arguments values |
|
1159 |
for ( i = 0; i < len; i++ ) { |
|
1160 |
if ( node.args[ i ] !== arguments[ i ] ) { |
|
1161 |
node = node.next; |
|
1162 |
continue searchCache; |
|
1163 |
} |
|
1164 |
} |
|
1165 |
|
|
1166 |
// At this point we can assume we've found a match |
|
1167 |
|
|
1168 |
// Surface matched node to head if not already |
|
1169 |
if ( node !== head ) { |
|
1170 |
// As tail, shift to previous. Must only shift if not also |
|
1171 |
// head, since if both head and tail, there is no previous. |
|
1172 |
if ( node === tail ) { |
|
1173 |
tail = node.prev; |
|
1174 |
} |
|
1175 |
|
|
1176 |
// Adjust siblings to point to each other. If node was tail, |
|
1177 |
// this also handles new tail's empty `next` assignment. |
|
1178 |
node.prev.next = node.next; |
|
1179 |
if ( node.next ) { |
|
1180 |
node.next.prev = node.prev; |
|
1181 |
} |
|
1182 |
|
|
1183 |
node.next = head; |
|
1184 |
node.prev = null; |
|
1185 |
head.prev = node; |
|
1186 |
head = node; |
|
1187 |
} |
|
1188 |
|
|
1189 |
// Return immediately |
|
1190 |
return node.val; |
|
1191 |
} |
|
1192 |
|
|
1193 |
// No cached value found. Continue to insertion phase: |
|
1194 |
|
|
1195 |
// Create a copy of arguments (avoid leaking deoptimization) |
|
1196 |
args = new Array( len ); |
|
1197 |
for ( i = 0; i < len; i++ ) { |
|
1198 |
args[ i ] = arguments[ i ]; |
|
1199 |
} |
|
1200 |
|
|
1201 |
node = { |
|
1202 |
args: args, |
|
1203 |
|
|
1204 |
// Generate the result from original function |
|
1205 |
val: fn.apply( null, args ) |
|
1206 |
}; |
|
1207 |
|
|
1208 |
// Don't need to check whether node is already head, since it would |
|
1209 |
// have been returned above already if it was |
|
1210 |
|
|
1211 |
// Shift existing head down list |
|
1212 |
if ( head ) { |
|
1213 |
head.prev = node; |
|
1214 |
node.next = head; |
|
1215 |
} else { |
|
1216 |
// If no head, follows that there's no tail (at initial or reset) |
|
1217 |
tail = node; |
|
1218 |
} |
|
1219 |
|
|
1220 |
// Trim tail if we're reached max size and are pending cache insertion |
|
1221 |
if ( size === maxSize ) { |
|
1222 |
tail = tail.prev; |
|
1223 |
tail.next = null; |
|
1224 |
} else { |
|
1225 |
size++; |
|
1226 |
} |
|
1227 |
|
|
1228 |
head = node; |
|
1229 |
|
|
1230 |
return node.val; |
|
1231 |
} |
|
1232 |
|
|
1233 |
memoized.clear = function() { |
|
1234 |
head = null; |
|
1235 |
tail = null; |
|
1236 |
size = 0; |
|
1237 |
}; |
|
1238 |
|
|
1239 |
if ( false ) {} |
|
1240 |
|
|
1241 |
return memoized; |
|
1242 |
}; |
|
1243 |
|
|
1244 |
|
|
1245 |
/***/ }), |
|
1246 |
|
|
1247 |
/***/ 5: |
|
1248 |
/***/ (function(module, exports) { |
|
1249 |
|
|
1250 |
(function() { module.exports = this["wp"]["data"]; }()); |
|
1251 |
|
|
1252 |
/***/ }), |
|
1253 |
|
|
1254 |
/***/ 65: |
|
1255 |
/***/ (function(module, exports, __webpack_require__) { |
|
1256 |
|
|
1257 |
var rng = __webpack_require__(87); |
|
1258 |
var bytesToUuid = __webpack_require__(88); |
|
1259 |
|
|
1260 |
function v4(options, buf, offset) { |
|
1261 |
var i = buf && offset || 0; |
|
1262 |
|
|
1263 |
if (typeof(options) == 'string') { |
|
1264 |
buf = options === 'binary' ? new Array(16) : null; |
|
1265 |
options = null; |
|
1266 |
} |
|
1267 |
options = options || {}; |
|
1268 |
|
|
1269 |
var rnds = options.random || (options.rng || rng)(); |
|
1270 |
|
|
1271 |
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved` |
|
1272 |
rnds[6] = (rnds[6] & 0x0f) | 0x40; |
|
1273 |
rnds[8] = (rnds[8] & 0x3f) | 0x80; |
|
1274 |
|
|
1275 |
// Copy bytes to buffer, if provided |
|
1276 |
if (buf) { |
|
1277 |
for (var ii = 0; ii < 16; ++ii) { |
|
1278 |
buf[i + ii] = rnds[ii]; |
|
1279 |
} |
|
1280 |
} |
|
1281 |
|
|
1282 |
return buf || bytesToUuid(rnds); |
|
1283 |
} |
|
1284 |
|
|
1285 |
module.exports = v4; |
|
1286 |
|
|
1287 |
|
|
1288 |
/***/ }), |
|
1289 |
|
|
1290 |
/***/ 7: |
|
1291 |
/***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
1292 |
|
|
1293 |
"use strict"; |
|
1294 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; }); |
|
1295 |
/* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); |
|
1296 |
|
|
1297 |
function _objectSpread(target) { |
|
1298 |
for (var i = 1; i < arguments.length; i++) { |
|
1299 |
var source = arguments[i] != null ? arguments[i] : {}; |
|
1300 |
var ownKeys = Object.keys(source); |
|
1301 |
|
|
1302 |
if (typeof Object.getOwnPropertySymbols === 'function') { |
|
1303 |
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { |
|
1304 |
return Object.getOwnPropertyDescriptor(source, sym).enumerable; |
|
1305 |
})); |
|
1306 |
} |
|
1307 |
|
|
1308 |
ownKeys.forEach(function (key) { |
|
1309 |
Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); |
|
1310 |
}); |
|
1311 |
} |
|
1312 |
|
|
1313 |
return target; |
|
1314 |
} |
|
1315 |
|
|
1316 |
/***/ }), |
|
1317 |
|
|
1318 |
/***/ 87: |
|
1319 |
/***/ (function(module, exports) { |
|
1320 |
|
|
1321 |
// Unique ID creation requires a high quality random # generator. In the |
|
1322 |
// browser this is a little complicated due to unknown quality of Math.random() |
|
1323 |
// and inconsistent support for the `crypto` API. We do the best we can via |
|
1324 |
// feature-detection |
|
1325 |
|
|
1326 |
// getRandomValues needs to be invoked in a context where "this" is a Crypto |
|
1327 |
// implementation. Also, find the complete implementation of crypto on IE11. |
|
1328 |
var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) || |
|
1329 |
(typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto)); |
|
1330 |
|
|
1331 |
if (getRandomValues) { |
|
1332 |
// WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto |
|
1333 |
var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef |
|
1334 |
|
|
1335 |
module.exports = function whatwgRNG() { |
|
1336 |
getRandomValues(rnds8); |
|
1337 |
return rnds8; |
|
1338 |
}; |
|
1339 |
} else { |
|
1340 |
// Math.random()-based (RNG) |
|
1341 |
// |
|
1342 |
// If all else fails, use Math.random(). It's fast, but is of unspecified |
|
1343 |
// quality. |
|
1344 |
var rnds = new Array(16); |
|
1345 |
|
|
1346 |
module.exports = function mathRNG() { |
|
1347 |
for (var i = 0, r; i < 16; i++) { |
|
1348 |
if ((i & 0x03) === 0) r = Math.random() * 0x100000000; |
|
1349 |
rnds[i] = r >>> ((i & 0x03) << 3) & 0xff; |
|
1350 |
} |
|
1351 |
|
|
1352 |
return rnds; |
|
1353 |
}; |
|
1354 |
} |
|
1355 |
|
|
1356 |
|
|
1357 |
/***/ }), |
|
1358 |
|
|
1359 |
/***/ 88: |
|
1360 |
/***/ (function(module, exports) { |
|
1361 |
|
|
1362 |
/** |
|
1363 |
* Convert array of 16 byte values to UUID string format of the form: |
|
1364 |
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX |
|
1365 |
*/ |
|
1366 |
var byteToHex = []; |
|
1367 |
for (var i = 0; i < 256; ++i) { |
|
1368 |
byteToHex[i] = (i + 0x100).toString(16).substr(1); |
|
1369 |
} |
|
1370 |
|
|
1371 |
function bytesToUuid(buf, offset) { |
|
1372 |
var i = offset || 0; |
|
1373 |
var bth = byteToHex; |
|
1374 |
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 |
|
1375 |
return ([bth[buf[i++]], bth[buf[i++]], |
|
1376 |
bth[buf[i++]], bth[buf[i++]], '-', |
|
1377 |
bth[buf[i++]], bth[buf[i++]], '-', |
|
1378 |
bth[buf[i++]], bth[buf[i++]], '-', |
|
1379 |
bth[buf[i++]], bth[buf[i++]], '-', |
|
1380 |
bth[buf[i++]], bth[buf[i++]], |
|
1381 |
bth[buf[i++]], bth[buf[i++]], |
|
1382 |
bth[buf[i++]], bth[buf[i++]]]).join(''); |
|
1383 |
} |
|
1384 |
|
|
1385 |
module.exports = bytesToUuid; |
|
1386 |
|
|
1387 |
|
|
1388 |
/***/ }) |
|
1389 |
|
|
1390 |
/******/ }); |