PluginProbe
Gutenberg / 8.5.1
Gutenberg v8.5.1
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
← All changes | build/editor/index.js +34 -11952 12.6.0 → 8.5.1 View file →
@@ -1,11956 +1,38 @@
1 -/******/ (function() { // webpackBootstrap
2 -/******/ var __webpack_modules__ = ({
3 -
4 -/***/ 9367:
5 -/***/ (function(module, exports) {
6 -
7 -var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
8 - autosize 4.0.2
9 - license: MIT
10 - http://www.jacklmoore.com/autosize
11 -*/
12 -(function (global, factory) {
13 - if (true) {
14 - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
15 - __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
16 - (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
17 - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
18 - } else { var mod; }
19 -})(this, function (module, exports) {
20 - 'use strict';
21 -
22 - var map = typeof Map === "function" ? new Map() : function () {
23 - var keys = [];
24 - var values = [];
25 -
26 - return {
27 - has: function has(key) {
28 - return keys.indexOf(key) > -1;
29 - },
30 - get: function get(key) {
31 - return values[keys.indexOf(key)];
32 - },
33 - set: function set(key, value) {
34 - if (keys.indexOf(key) === -1) {
35 - keys.push(key);
36 - values.push(value);
37 - }
38 - },
39 - delete: function _delete(key) {
40 - var index = keys.indexOf(key);
41 - if (index > -1) {
42 - keys.splice(index, 1);
43 - values.splice(index, 1);
44 - }
45 - }
46 - };
47 - }();
48 -
49 - var createEvent = function createEvent(name) {
50 - return new Event(name, { bubbles: true });
51 - };
52 - try {
53 - new Event('test');
54 - } catch (e) {
55 - // IE does not support `new Event()`
56 - createEvent = function createEvent(name) {
57 - var evt = document.createEvent('Event');
58 - evt.initEvent(name, true, false);
59 - return evt;
60 - };
61 - }
62 -
63 - function assign(ta) {
64 - if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
65 -
66 - var heightOffset = null;
67 - var clientWidth = null;
68 - var cachedHeight = null;
69 -
70 - function init() {
71 - var style = window.getComputedStyle(ta, null);
72 -
73 - if (style.resize === 'vertical') {
74 - ta.style.resize = 'none';
75 - } else if (style.resize === 'both') {
76 - ta.style.resize = 'horizontal';
77 - }
78 -
79 - if (style.boxSizing === 'content-box') {
80 - heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
81 - } else {
82 - heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
83 - }
84 - // Fix when a textarea is not on document body and heightOffset is Not a Number
85 - if (isNaN(heightOffset)) {
86 - heightOffset = 0;
87 - }
88 -
89 - update();
90 - }
91 -
92 - function changeOverflow(value) {
93 - {
94 - // Chrome/Safari-specific fix:
95 - // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
96 - // made available by removing the scrollbar. The following forces the necessary text reflow.
97 - var width = ta.style.width;
98 - ta.style.width = '0px';
99 - // Force reflow:
100 - /* jshint ignore:start */
101 - ta.offsetWidth;
102 - /* jshint ignore:end */
103 - ta.style.width = width;
104 - }
105 -
106 - ta.style.overflowY = value;
107 - }
108 -
109 - function getParentOverflows(el) {
110 - var arr = [];
111 -
112 - while (el && el.parentNode && el.parentNode instanceof Element) {
113 - if (el.parentNode.scrollTop) {
114 - arr.push({
115 - node: el.parentNode,
116 - scrollTop: el.parentNode.scrollTop
117 - });
118 - }
119 - el = el.parentNode;
120 - }
121 -
122 - return arr;
123 - }
124 -
125 - function resize() {
126 - if (ta.scrollHeight === 0) {
127 - // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
128 - return;
129 - }
130 -
131 - var overflows = getParentOverflows(ta);
132 - var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
133 -
134 - ta.style.height = '';
135 - ta.style.height = ta.scrollHeight + heightOffset + 'px';
136 -
137 - // used to check if an update is actually necessary on window.resize
138 - clientWidth = ta.clientWidth;
139 -
140 - // prevents scroll-position jumping
141 - overflows.forEach(function (el) {
142 - el.node.scrollTop = el.scrollTop;
143 - });
144 -
145 - if (docTop) {
146 - document.documentElement.scrollTop = docTop;
147 - }
148 - }
149 -
150 - function update() {
151 - resize();
152 -
153 - var styleHeight = Math.round(parseFloat(ta.style.height));
154 - var computed = window.getComputedStyle(ta, null);
155 -
156 - // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
157 - var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
158 -
159 - // The actual height not matching the style height (set via the resize method) indicates that
160 - // the max-height has been exceeded, in which case the overflow should be allowed.
161 - if (actualHeight < styleHeight) {
162 - if (computed.overflowY === 'hidden') {
163 - changeOverflow('scroll');
164 - resize();
165 - actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
166 - }
167 - } else {
168 - // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
169 - if (computed.overflowY !== 'hidden') {
170 - changeOverflow('hidden');
171 - resize();
172 - actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
173 - }
174 - }
175 -
176 - if (cachedHeight !== actualHeight) {
177 - cachedHeight = actualHeight;
178 - var evt = createEvent('autosize:resized');
179 - try {
180 - ta.dispatchEvent(evt);
181 - } catch (err) {
182 - // Firefox will throw an error on dispatchEvent for a detached element
183 - // https://bugzilla.mozilla.org/show_bug.cgi?id=889376
184 - }
185 - }
186 - }
187 -
188 - var pageResize = function pageResize() {
189 - if (ta.clientWidth !== clientWidth) {
190 - update();
191 - }
192 - };
193 -
194 - var destroy = function (style) {
195 - window.removeEventListener('resize', pageResize, false);
196 - ta.removeEventListener('input', update, false);
197 - ta.removeEventListener('keyup', update, false);
198 - ta.removeEventListener('autosize:destroy', destroy, false);
199 - ta.removeEventListener('autosize:update', update, false);
200 -
201 - Object.keys(style).forEach(function (key) {
202 - ta.style[key] = style[key];
203 - });
204 -
205 - map.delete(ta);
206 - }.bind(ta, {
207 - height: ta.style.height,
208 - resize: ta.style.resize,
209 - overflowY: ta.style.overflowY,
210 - overflowX: ta.style.overflowX,
211 - wordWrap: ta.style.wordWrap
212 - });
213 -
214 - ta.addEventListener('autosize:destroy', destroy, false);
215 -
216 - // IE9 does not fire onpropertychange or oninput for deletions,
217 - // so binding to onkeyup to catch most of those events.
218 - // There is no way that I know of to detect something like 'cut' in IE9.
219 - if ('onpropertychange' in ta && 'oninput' in ta) {
220 - ta.addEventListener('keyup', update, false);
221 - }
222 -
223 - window.addEventListener('resize', pageResize, false);
224 - ta.addEventListener('input', update, false);
225 - ta.addEventListener('autosize:update', update, false);
226 - ta.style.overflowX = 'hidden';
227 - ta.style.wordWrap = 'break-word';
228 -
229 - map.set(ta, {
230 - destroy: destroy,
231 - update: update
232 - });
233 -
234 - init();
235 - }
236 -
237 - function destroy(ta) {
238 - var methods = map.get(ta);
239 - if (methods) {
240 - methods.destroy();
241 - }
242 - }
243 -
244 - function update(ta) {
245 - var methods = map.get(ta);
246 - if (methods) {
247 - methods.update();
248 - }
249 - }
250 -
251 - var autosize = null;
252 -
253 - // Do nothing in Node.js environment and IE8 (or lower)
254 - if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
255 - autosize = function autosize(el) {
256 - return el;
257 - };
258 - autosize.destroy = function (el) {
259 - return el;
260 - };
261 - autosize.update = function (el) {
262 - return el;
263 - };
264 - } else {
265 - autosize = function autosize(el, options) {
266 - if (el) {
267 - Array.prototype.forEach.call(el.length ? el : [el], function (x) {
268 - return assign(x, options);
269 - });
270 - }
271 - return el;
272 - };
273 - autosize.destroy = function (el) {
274 - if (el) {
275 - Array.prototype.forEach.call(el.length ? el : [el], destroy);
276 - }
277 - return el;
278 - };
279 - autosize.update = function (el) {
280 - if (el) {
281 - Array.prototype.forEach.call(el.length ? el : [el], update);
282 - }
283 - return el;
284 - };
285 - }
286 -
287 - exports.default = autosize;
288 - module.exports = exports['default'];
289 -});
290 -
291 -/***/ }),
292 -
293 -/***/ 4184:
294 -/***/ (function(module, exports) {
295 -
296 -var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
297 - Copyright (c) 2018 Jed Watson.
298 - Licensed under the MIT License (MIT), see
299 - http://jedwatson.github.io/classnames
300 -*/
301 -/* global define */
302 -
303 -(function () {
304 - 'use strict';
305 -
306 - var hasOwn = {}.hasOwnProperty;
307 -
308 - function classNames() {
309 - var classes = [];
310 -
311 - for (var i = 0; i < arguments.length; i++) {
312 - var arg = arguments[i];
313 - if (!arg) continue;
314 -
315 - var argType = typeof arg;
316 -
317 - if (argType === 'string' || argType === 'number') {
318 - classes.push(arg);
319 - } else if (Array.isArray(arg)) {
320 - if (arg.length) {
321 - var inner = classNames.apply(null, arg);
322 - if (inner) {
323 - classes.push(inner);
324 - }
325 - }
326 - } else if (argType === 'object') {
327 - if (arg.toString === Object.prototype.toString) {
328 - for (var key in arg) {
329 - if (hasOwn.call(arg, key) && arg[key]) {
330 - classes.push(key);
331 - }
332 - }
333 - } else {
334 - classes.push(arg.toString());
335 - }
336 - }
337 - }
338 -
339 - return classes.join(' ');
340 - }
341 -
342 - if ( true && module.exports) {
343 - classNames.default = classNames;
344 - module.exports = classNames;
345 - } else if (true) {
346 - // register as 'classnames', consistent with npm package name
347 - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
348 - return classNames;
349 - }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
350 - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
351 - } else {}
352 -}());
353 -
354 -
355 -/***/ }),
356 -
357 -/***/ 1934:
358 -/***/ (function(module) {
359 -
360 -// This code has been refactored for 140 bytes
361 -// You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js
362 -var computedStyle = function (el, prop, getComputedStyle) {
363 - getComputedStyle = window.getComputedStyle;
364 -
365 - // In one fell swoop
366 - return (
367 - // If we have getComputedStyle
368 - getComputedStyle ?
369 - // Query it
370 - // TODO: From CSS-Query notes, we might need (node, null) for FF
371 - getComputedStyle(el) :
372 -
373 - // Otherwise, we are in IE and use currentStyle
374 - el.currentStyle
375 - )[
376 - // Switch to camelCase for CSSOM
377 - // DEV: Grabbed from jQuery
378 - // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
379 - // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
380 - prop.replace(/-(\w)/gi, function (word, letter) {
381 - return letter.toUpperCase();
382 - })
383 - ];
384 -};
385 -
386 -module.exports = computedStyle;
387 -
388 -
389 -/***/ }),
390 -
391 -/***/ 8303:
392 -/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
393 -
394 -// Load in dependencies
395 -var computedStyle = __webpack_require__(1934);
396 -
397 -/**
398 - * Calculate the `line-height` of a given node
399 - * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM.
400 - * @returns {Number} `line-height` of the element in pixels
401 - */
402 -function lineHeight(node) {
403 - // Grab the line-height via style
404 - var lnHeightStr = computedStyle(node, 'line-height');
405 - var lnHeight = parseFloat(lnHeightStr, 10);
406 -
407 - // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em')
408 - if (lnHeightStr === lnHeight + '') {
409 - // Save the old lineHeight style and update the em unit to the element
410 - var _lnHeightStyle = node.style.lineHeight;
411 - node.style.lineHeight = lnHeightStr + 'em';
412 -
413 - // Calculate the em based height
414 - lnHeightStr = computedStyle(node, 'line-height');
415 - lnHeight = parseFloat(lnHeightStr, 10);
416 -
417 - // Revert the lineHeight style
418 - if (_lnHeightStyle) {
419 - node.style.lineHeight = _lnHeightStyle;
420 - } else {
421 - delete node.style.lineHeight;
422 - }
423 - }
424 -
425 - // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt)
426 - // DEV: `em` units are converted to `pt` in IE6
427 - // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length
428 - if (lnHeightStr.indexOf('pt') !== -1) {
429 - lnHeight *= 4;
430 - lnHeight /= 3;
431 - // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm)
432 - } else if (lnHeightStr.indexOf('mm') !== -1) {
433 - lnHeight *= 96;
434 - lnHeight /= 25.4;
435 - // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm)
436 - } else if (lnHeightStr.indexOf('cm') !== -1) {
437 - lnHeight *= 96;
438 - lnHeight /= 2.54;
439 - // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in)
440 - } else if (lnHeightStr.indexOf('in') !== -1) {
441 - lnHeight *= 96;
442 - // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc)
443 - } else if (lnHeightStr.indexOf('pc') !== -1) {
444 - lnHeight *= 16;
445 - }
446 -
447 - // Continue our computation
448 - lnHeight = Math.round(lnHeight);
449 -
450 - // If the line-height is "normal", calculate by font-size
451 - if (lnHeightStr === 'normal') {
452 - // Create a temporary node
453 - var nodeName = node.nodeName;
454 - var _node = document.createElement(nodeName);
455 - _node.innerHTML = '&nbsp;';
456 -
457 - // If we have a text area, reset it to only 1 row
458 - // https://github.com/twolfson/line-height/issues/4
459 - if (nodeName.toUpperCase() === 'TEXTAREA') {
460 - _node.setAttribute('rows', '1');
461 - }
462 -
463 - // Set the font-size of the element
464 - var fontSizeStr = computedStyle(node, 'font-size');
465 - _node.style.fontSize = fontSizeStr;
466 -
467 - // Remove default padding/border which can affect offset height
468 - // https://github.com/twolfson/line-height/issues/4
469 - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight
470 - _node.style.padding = '0px';
471 - _node.style.border = '0px';
472 -
473 - // Append it to the body
474 - var body = document.body;
475 - body.appendChild(_node);
476 -
477 - // Assume the line height of the element is the height
478 - var height = _node.offsetHeight;
479 - lnHeight = height;
480 -
481 - // Remove our child from the DOM
482 - body.removeChild(_node);
483 - }
484 -
485 - // Return the calculated height
486 - return lnHeight;
487 -}
488 -
489 -// Export lineHeight
490 -module.exports = lineHeight;
491 -
492 -
493 -/***/ }),
494 -
495 -/***/ 2703:
496 -/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
497 -
498 -"use strict";
499 -/**
500 - * Copyright (c) 2013-present, Facebook, Inc.
501 - *
502 - * This source code is licensed under the MIT license found in the
503 - * LICENSE file in the root directory of this source tree.
504 - */
505 -
506 -
507 -
508 -var ReactPropTypesSecret = __webpack_require__(414);
509 -
510 -function emptyFunction() {}
511 -function emptyFunctionWithReset() {}
512 -emptyFunctionWithReset.resetWarningCache = emptyFunction;
513 -
514 -module.exports = function() {
515 - function shim(props, propName, componentName, location, propFullName, secret) {
516 - if (secret === ReactPropTypesSecret) {
517 - // It is still safe when called from React.
518 - return;
519 - }
520 - var err = new Error(
521 - 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
522 - 'Use PropTypes.checkPropTypes() to call them. ' +
523 - 'Read more at http://fb.me/use-check-prop-types'
524 - );
525 - err.name = 'Invariant Violation';
526 - throw err;
527 - };
528 - shim.isRequired = shim;
529 - function getShim() {
530 - return shim;
531 - };
532 - // Important!
533 - // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
534 - var ReactPropTypes = {
535 - array: shim,
536 - bool: shim,
537 - func: shim,
538 - number: shim,
539 - object: shim,
540 - string: shim,
541 - symbol: shim,
542 -
543 - any: shim,
544 - arrayOf: getShim,
545 - element: shim,
546 - elementType: shim,
547 - instanceOf: getShim,
548 - node: shim,
549 - objectOf: getShim,
550 - oneOf: getShim,
551 - oneOfType: getShim,
552 - shape: getShim,
553 - exact: getShim,
554 -
555 - checkPropTypes: emptyFunctionWithReset,
556 - resetWarningCache: emptyFunction
557 - };
558 -
559 - ReactPropTypes.PropTypes = ReactPropTypes;
560 -
561 - return ReactPropTypes;
562 -};
563 -
564 -
565 -/***/ }),
566 -
567 -/***/ 5697:
568 -/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
569 -
570 -/**
571 - * Copyright (c) 2013-present, Facebook, Inc.
572 - *
573 - * This source code is licensed under the MIT license found in the
574 - * LICENSE file in the root directory of this source tree.
575 - */
576 -
577 -if (false) { var throwOnDirectAccess, ReactIs; } else {
578 - // By explicitly using `prop-types` you are opting into new production behavior.
579 - // http://fb.me/prop-types-in-prod
580 - module.exports = __webpack_require__(2703)();
581 -}
582 -
583 -
584 -/***/ }),
585 -
586 -/***/ 414:
587 -/***/ (function(module) {
588 -
589 -"use strict";
590 -/**
591 - * Copyright (c) 2013-present, Facebook, Inc.
592 - *
593 - * This source code is licensed under the MIT license found in the
594 - * LICENSE file in the root directory of this source tree.
595 - */
596 -
597 -
598 -
599 -var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
600 -
601 -module.exports = ReactPropTypesSecret;
602 -
603 -
604 -/***/ }),
605 -
606 -/***/ 4857:
607 -/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
608 -
609 -"use strict";
610 -
611 -var __extends = (this && this.__extends) || (function () {
612 - var extendStatics = Object.setPrototypeOf ||
613 - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
614 - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
615 - return function (d, b) {
616 - extendStatics(d, b);
617 - function __() { this.constructor = d; }
618 - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
619 - };
620 -})();
621 -var __assign = (this && this.__assign) || Object.assign || function(t) {
622 - for (var s, i = 1, n = arguments.length; i < n; i++) {
623 - s = arguments[i];
624 - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
625 - t[p] = s[p];
626 - }
627 - return t;
628 -};
629 -var __rest = (this && this.__rest) || function (s, e) {
630 - var t = {};
631 - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
632 - t[p] = s[p];
633 - if (s != null && typeof Object.getOwnPropertySymbols === "function")
634 - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
635 - t[p[i]] = s[p[i]];
636 - return t;
637 -};
638 -exports.__esModule = true;
639 -var React = __webpack_require__(9196);
640 -var PropTypes = __webpack_require__(5697);
641 -var autosize = __webpack_require__(9367);
642 -var _getLineHeight = __webpack_require__(8303);
643 -var getLineHeight = _getLineHeight;
644 -var RESIZED = "autosize:resized";
645 -/**
646 - * A light replacement for built-in textarea component
647 - * which automaticaly adjusts its height to match the content
648 - */
649 -var TextareaAutosizeClass = /** @class */ (function (_super) {
650 - __extends(TextareaAutosizeClass, _super);
651 - function TextareaAutosizeClass() {
652 - var _this = _super !== null && _super.apply(this, arguments) || this;
653 - _this.state = {
654 - lineHeight: null
655 - };
656 - _this.textarea = null;
657 - _this.onResize = function (e) {
658 - if (_this.props.onResize) {
659 - _this.props.onResize(e);
660 - }
661 - };
662 - _this.updateLineHeight = function () {
663 - if (_this.textarea) {
664 - _this.setState({
665 - lineHeight: getLineHeight(_this.textarea)
666 - });
667 - }
668 - };
669 - _this.onChange = function (e) {
670 - var onChange = _this.props.onChange;
671 - _this.currentValue = e.currentTarget.value;
672 - onChange && onChange(e);
673 - };
674 - return _this;
675 - }
676 - TextareaAutosizeClass.prototype.componentDidMount = function () {
677 - var _this = this;
678 - var _a = this.props, maxRows = _a.maxRows, async = _a.async;
679 - if (typeof maxRows === "number") {
680 - this.updateLineHeight();
681 - }
682 - if (typeof maxRows === "number" || async) {
683 - /*
684 - the defer is needed to:
685 - - force "autosize" to activate the scrollbar when this.props.maxRows is passed
686 - - support StyledComponents (see #71)
687 - */
688 - setTimeout(function () { return _this.textarea && autosize(_this.textarea); });
689 - }
690 - else {
691 - this.textarea && autosize(this.textarea);
692 - }
693 - if (this.textarea) {
694 - this.textarea.addEventListener(RESIZED, this.onResize);
695 - }
696 - };
697 - TextareaAutosizeClass.prototype.componentWillUnmount = function () {
698 - if (this.textarea) {
699 - this.textarea.removeEventListener(RESIZED, this.onResize);
700 - autosize.destroy(this.textarea);
701 - }
702 - };
703 - TextareaAutosizeClass.prototype.render = function () {
704 - var _this = this;
705 - var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight;
706 - var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null;
707 - return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) {
708 - _this.textarea = element;
709 - if (typeof _this.props.innerRef === 'function') {
710 - _this.props.innerRef(element);
711 - }
712 - else if (_this.props.innerRef) {
713 - _this.props.innerRef.current = element;
714 - }
715 - } }), children));
716 - };
717 - TextareaAutosizeClass.prototype.componentDidUpdate = function () {
718 - this.textarea && autosize.update(this.textarea);
719 - };
720 - TextareaAutosizeClass.defaultProps = {
721 - rows: 1,
722 - async: false
723 - };
724 - TextareaAutosizeClass.propTypes = {
725 - rows: PropTypes.number,
726 - maxRows: PropTypes.number,
727 - onResize: PropTypes.func,
728 - innerRef: PropTypes.any,
729 - async: PropTypes.bool
730 - };
731 - return TextareaAutosizeClass;
732 -}(React.Component));
733 -exports.TextareaAutosize = React.forwardRef(function (props, ref) {
734 - return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref }));
735 -});
736 -
737 -
738 -/***/ }),
739 -
740 -/***/ 4042:
741 -/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
742 -
743 -"use strict";
744 -var __webpack_unused_export__;
745 -
746 -__webpack_unused_export__ = true;
747 -var TextareaAutosize_1 = __webpack_require__(4857);
748 -exports.Z = TextareaAutosize_1.TextareaAutosize;
749 -
750 -
751 -/***/ }),
752 -
753 -/***/ 9196:
754 -/***/ (function(module) {
755 -
756 -"use strict";
757 -module.exports = window["React"];
758 -
759 -/***/ })
760 -
761 -/******/ });
762 -/************************************************************************/
763 -/******/ // The module cache
764 -/******/ var __webpack_module_cache__ = {};
765 -/******/
766 -/******/ // The require function
767 -/******/ function __webpack_require__(moduleId) {
768 -/******/ // Check if module is in cache
769 -/******/ var cachedModule = __webpack_module_cache__[moduleId];
770 -/******/ if (cachedModule !== undefined) {
771 -/******/ return cachedModule.exports;
772 -/******/ }
773 -/******/ // Create a new module (and put it into the cache)
774 -/******/ var module = __webpack_module_cache__[moduleId] = {
775 -/******/ // no module.id needed
776 -/******/ // no module.loaded needed
777 -/******/ exports: {}
778 -/******/ };
779 -/******/
780 -/******/ // Execute the module function
781 -/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
782 -/******/
783 -/******/ // Return the exports of the module
784 -/******/ return module.exports;
785 -/******/ }
786 -/******/
787 -/************************************************************************/
788 -/******/ /* webpack/runtime/compat get default export */
789 -/******/ !function() {
790 -/******/ // getDefaultExport function for compatibility with non-harmony modules
791 -/******/ __webpack_require__.n = function(module) {
792 -/******/ var getter = module && module.__esModule ?
793 -/******/ function() { return module['default']; } :
794 -/******/ function() { return module; };
795 -/******/ __webpack_require__.d(getter, { a: getter });
796 -/******/ return getter;
797 -/******/ };
798 -/******/ }();
799 -/******/
800 -/******/ /* webpack/runtime/define property getters */
801 -/******/ !function() {
802 -/******/ // define getter functions for harmony exports
803 -/******/ __webpack_require__.d = function(exports, definition) {
804 -/******/ for(var key in definition) {
805 -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
806 -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
807 -/******/ }
808 -/******/ }
809 -/******/ };
810 -/******/ }();
811 -/******/
812 -/******/ /* webpack/runtime/hasOwnProperty shorthand */
813 -/******/ !function() {
814 -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
815 -/******/ }();
816 -/******/
817 -/******/ /* webpack/runtime/make namespace object */
818 -/******/ !function() {
819 -/******/ // define __esModule on exports
820 -/******/ __webpack_require__.r = function(exports) {
821 -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
822 -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
823 -/******/ }
824 -/******/ Object.defineProperty(exports, '__esModule', { value: true });
825 -/******/ };
826 -/******/ }();
827 -/******/
828 -/************************************************************************/
829 -var __webpack_exports__ = {};
830 -// This entry need to be wrapped in an IIFE because it need to be in strict mode.
831 -!function() {
832 -"use strict";
833 -// ESM COMPAT FLAG
834 -__webpack_require__.r(__webpack_exports__);
835 -
836 -// EXPORTS
837 -__webpack_require__.d(__webpack_exports__, {
838 - "AlignmentToolbar": function() { return /* reexport */ AlignmentToolbar; },
839 - "Autocomplete": function() { return /* reexport */ Autocomplete; },
840 - "AutosaveMonitor": function() { return /* reexport */ autosave_monitor; },
841 - "BlockAlignmentToolbar": function() { return /* reexport */ BlockAlignmentToolbar; },
842 - "BlockControls": function() { return /* reexport */ BlockControls; },
843 - "BlockEdit": function() { return /* reexport */ BlockEdit; },
844 - "BlockEditorKeyboardShortcuts": function() { return /* reexport */ BlockEditorKeyboardShortcuts; },
845 - "BlockFormatControls": function() { return /* reexport */ BlockFormatControls; },
846 - "BlockIcon": function() { return /* reexport */ BlockIcon; },
847 - "BlockInspector": function() { return /* reexport */ BlockInspector; },
848 - "BlockList": function() { return /* reexport */ BlockList; },
849 - "BlockMover": function() { return /* reexport */ BlockMover; },
850 - "BlockNavigationDropdown": function() { return /* reexport */ BlockNavigationDropdown; },
851 - "BlockSelectionClearer": function() { return /* reexport */ BlockSelectionClearer; },
852 - "BlockSettingsMenu": function() { return /* reexport */ BlockSettingsMenu; },
853 - "BlockTitle": function() { return /* reexport */ BlockTitle; },
854 - "BlockToolbar": function() { return /* reexport */ BlockToolbar; },
855 - "ColorPalette": function() { return /* reexport */ ColorPalette; },
856 - "ContrastChecker": function() { return /* reexport */ ContrastChecker; },
857 - "CopyHandler": function() { return /* reexport */ CopyHandler; },
858 - "DefaultBlockAppender": function() { return /* reexport */ DefaultBlockAppender; },
859 - "DocumentOutline": function() { return /* reexport */ document_outline; },
860 - "DocumentOutlineCheck": function() { return /* reexport */ check; },
861 - "EditorHistoryRedo": function() { return /* reexport */ editor_history_redo; },
862 - "EditorHistoryUndo": function() { return /* reexport */ editor_history_undo; },
863 - "EditorKeyboardShortcutsRegister": function() { return /* reexport */ register_shortcuts; },
864 - "EditorNotices": function() { return /* reexport */ editor_notices; },
865 - "EditorProvider": function() { return /* reexport */ provider; },
866 - "EditorSnackbars": function() { return /* reexport */ EditorSnackbars; },
867 - "EntitiesSavedStates": function() { return /* reexport */ EntitiesSavedStates; },
868 - "ErrorBoundary": function() { return /* reexport */ error_boundary; },
869 - "FontSizePicker": function() { return /* reexport */ FontSizePicker; },
870 - "InnerBlocks": function() { return /* reexport */ InnerBlocks; },
871 - "Inserter": function() { return /* reexport */ Inserter; },
872 - "InspectorAdvancedControls": function() { return /* reexport */ InspectorAdvancedControls; },
873 - "InspectorControls": function() { return /* reexport */ InspectorControls; },
874 - "LocalAutosaveMonitor": function() { return /* reexport */ local_autosave_monitor; },
875 - "MediaPlaceholder": function() { return /* reexport */ MediaPlaceholder; },
876 - "MediaUpload": function() { return /* reexport */ MediaUpload; },
877 - "MediaUploadCheck": function() { return /* reexport */ MediaUploadCheck; },
878 - "MultiSelectScrollIntoView": function() { return /* reexport */ MultiSelectScrollIntoView; },
879 - "NavigableToolbar": function() { return /* reexport */ NavigableToolbar; },
880 - "ObserveTyping": function() { return /* reexport */ ObserveTyping; },
881 - "PageAttributesCheck": function() { return /* reexport */ page_attributes_check; },
882 - "PageAttributesOrder": function() { return /* reexport */ order; },
883 - "PageAttributesParent": function() { return /* reexport */ page_attributes_parent; },
884 - "PageTemplate": function() { return /* reexport */ post_template; },
885 - "PanelColorSettings": function() { return /* reexport */ PanelColorSettings; },
886 - "PlainText": function() { return /* reexport */ PlainText; },
887 - "PostAuthor": function() { return /* reexport */ post_author; },
888 - "PostAuthorCheck": function() { return /* reexport */ PostAuthorCheck; },
889 - "PostComments": function() { return /* reexport */ post_comments; },
890 - "PostExcerpt": function() { return /* reexport */ post_excerpt; },
891 - "PostExcerptCheck": function() { return /* reexport */ post_excerpt_check; },
892 - "PostFeaturedImage": function() { return /* reexport */ post_featured_image; },
893 - "PostFeaturedImageCheck": function() { return /* reexport */ post_featured_image_check; },
894 - "PostFormat": function() { return /* reexport */ PostFormat; },
895 - "PostFormatCheck": function() { return /* reexport */ post_format_check; },
896 - "PostLastRevision": function() { return /* reexport */ post_last_revision; },
897 - "PostLastRevisionCheck": function() { return /* reexport */ post_last_revision_check; },
898 - "PostLockedModal": function() { return /* reexport */ PostLockedModal; },
899 - "PostPendingStatus": function() { return /* reexport */ post_pending_status; },
900 - "PostPendingStatusCheck": function() { return /* reexport */ post_pending_status_check; },
901 - "PostPingbacks": function() { return /* reexport */ post_pingbacks; },
902 - "PostPreviewButton": function() { return /* reexport */ post_preview_button; },
903 - "PostPublishButton": function() { return /* reexport */ post_publish_button; },
904 - "PostPublishButtonLabel": function() { return /* reexport */ label; },
905 - "PostPublishPanel": function() { return /* reexport */ post_publish_panel; },
906 - "PostSavedState": function() { return /* reexport */ PostSavedState; },
907 - "PostSchedule": function() { return /* reexport */ PostSchedule; },
908 - "PostScheduleCheck": function() { return /* reexport */ post_schedule_check; },
909 - "PostScheduleLabel": function() { return /* reexport */ post_schedule_label; },
910 - "PostSlug": function() { return /* reexport */ post_slug; },
911 - "PostSlugCheck": function() { return /* reexport */ PostSlugCheck; },
912 - "PostSticky": function() { return /* reexport */ post_sticky; },
913 - "PostStickyCheck": function() { return /* reexport */ post_sticky_check; },
914 - "PostSwitchToDraftButton": function() { return /* reexport */ post_switch_to_draft_button; },
915 - "PostTaxonomies": function() { return /* reexport */ post_taxonomies; },
916 - "PostTaxonomiesCheck": function() { return /* reexport */ post_taxonomies_check; },
917 - "PostTaxonomiesFlatTermSelector": function() { return /* reexport */ flat_term_selector; },
918 - "PostTaxonomiesHierarchicalTermSelector": function() { return /* reexport */ hierarchical_term_selector; },
919 - "PostTextEditor": function() { return /* reexport */ PostTextEditor; },
920 - "PostTitle": function() { return /* reexport */ PostTitle; },
921 - "PostTrash": function() { return /* reexport */ post_trash; },
922 - "PostTrashCheck": function() { return /* reexport */ post_trash_check; },
923 - "PostTypeSupportCheck": function() { return /* reexport */ post_type_support_check; },
924 - "PostVisibility": function() { return /* reexport */ post_visibility; },
925 - "PostVisibilityCheck": function() { return /* reexport */ post_visibility_check; },
926 - "PostVisibilityLabel": function() { return /* reexport */ post_visibility_label; },
927 - "RichText": function() { return /* reexport */ RichText; },
928 - "RichTextShortcut": function() { return /* reexport */ RichTextShortcut; },
929 - "RichTextToolbarButton": function() { return /* reexport */ RichTextToolbarButton; },
930 - "ServerSideRender": function() { return /* reexport */ (external_wp_serverSideRender_default()); },
931 - "SkipToSelectedBlock": function() { return /* reexport */ SkipToSelectedBlock; },
932 - "TableOfContents": function() { return /* reexport */ table_of_contents; },
933 - "TextEditorGlobalKeyboardShortcuts": function() { return /* reexport */ TextEditorGlobalKeyboardShortcuts; },
934 - "ThemeSupportCheck": function() { return /* reexport */ theme_support_check; },
935 - "URLInput": function() { return /* reexport */ URLInput; },
936 - "URLInputButton": function() { return /* reexport */ URLInputButton; },
937 - "URLPopover": function() { return /* reexport */ URLPopover; },
938 - "UnsavedChangesWarning": function() { return /* reexport */ UnsavedChangesWarning; },
939 - "VisualEditorGlobalKeyboardShortcuts": function() { return /* reexport */ visual_editor_shortcuts; },
940 - "Warning": function() { return /* reexport */ Warning; },
941 - "WordCount": function() { return /* reexport */ WordCount; },
942 - "WritingFlow": function() { return /* reexport */ WritingFlow; },
943 - "__unstableRichTextInputEvent": function() { return /* reexport */ __unstableRichTextInputEvent; },
944 - "cleanForSlug": function() { return /* reexport */ cleanForSlug; },
945 - "createCustomColorsHOC": function() { return /* reexport */ createCustomColorsHOC; },
946 - "getColorClassName": function() { return /* reexport */ getColorClassName; },
947 - "getColorObjectByAttributeValues": function() { return /* reexport */ getColorObjectByAttributeValues; },
948 - "getColorObjectByColorValue": function() { return /* reexport */ getColorObjectByColorValue; },
949 - "getFontSize": function() { return /* reexport */ getFontSize; },
950 - "getFontSizeClass": function() { return /* reexport */ getFontSizeClass; },
951 - "getTemplatePartIcon": function() { return /* reexport */ getTemplatePartIcon; },
952 - "mediaUpload": function() { return /* reexport */ mediaUpload; },
953 - "store": function() { return /* reexport */ store; },
954 - "storeConfig": function() { return /* reexport */ storeConfig; },
955 - "transformStyles": function() { return /* reexport */ external_wp_blockEditor_namespaceObject.transformStyles; },
956 - "userAutocompleter": function() { return /* reexport */ user; },
957 - "withColorContext": function() { return /* reexport */ withColorContext; },
958 - "withColors": function() { return /* reexport */ withColors; },
959 - "withFontSizes": function() { return /* reexport */ withFontSizes; }
960 -});
961 -
962 -// NAMESPACE OBJECT: ./packages/editor/build-module/store/selectors.js
963 -var selectors_namespaceObject = {};
964 -__webpack_require__.r(selectors_namespaceObject);
965 -__webpack_require__.d(selectors_namespaceObject, {
966 - "__experimentalGetDefaultTemplatePartAreas": function() { return __experimentalGetDefaultTemplatePartAreas; },
967 - "__experimentalGetDefaultTemplateType": function() { return __experimentalGetDefaultTemplateType; },
968 - "__experimentalGetDefaultTemplateTypes": function() { return __experimentalGetDefaultTemplateTypes; },
969 - "__experimentalGetTemplateInfo": function() { return __experimentalGetTemplateInfo; },
970 - "__unstableIsEditorReady": function() { return __unstableIsEditorReady; },
971 - "canInsertBlockType": function() { return canInsertBlockType; },
972 - "canUserUseUnfilteredHTML": function() { return canUserUseUnfilteredHTML; },
973 - "didPostSaveRequestFail": function() { return didPostSaveRequestFail; },
974 - "didPostSaveRequestSucceed": function() { return didPostSaveRequestSucceed; },
975 - "getActivePostLock": function() { return getActivePostLock; },
976 - "getAdjacentBlockClientId": function() { return getAdjacentBlockClientId; },
977 - "getAutosaveAttribute": function() { return getAutosaveAttribute; },
978 - "getBlock": function() { return getBlock; },
979 - "getBlockAttributes": function() { return getBlockAttributes; },
980 - "getBlockCount": function() { return getBlockCount; },
981 - "getBlockHierarchyRootClientId": function() { return getBlockHierarchyRootClientId; },
982 - "getBlockIndex": function() { return getBlockIndex; },
983 - "getBlockInsertionPoint": function() { return getBlockInsertionPoint; },
984 - "getBlockListSettings": function() { return getBlockListSettings; },
985 - "getBlockMode": function() { return getBlockMode; },
986 - "getBlockName": function() { return getBlockName; },
987 - "getBlockOrder": function() { return getBlockOrder; },
988 - "getBlockRootClientId": function() { return getBlockRootClientId; },
989 - "getBlockSelectionEnd": function() { return getBlockSelectionEnd; },
990 - "getBlockSelectionStart": function() { return getBlockSelectionStart; },
991 - "getBlocks": function() { return getBlocks; },
992 - "getBlocksByClientId": function() { return getBlocksByClientId; },
993 - "getClientIdsOfDescendants": function() { return getClientIdsOfDescendants; },
994 - "getClientIdsWithDescendants": function() { return getClientIdsWithDescendants; },
995 - "getCurrentPost": function() { return getCurrentPost; },
996 - "getCurrentPostAttribute": function() { return getCurrentPostAttribute; },
997 - "getCurrentPostId": function() { return getCurrentPostId; },
998 - "getCurrentPostLastRevisionId": function() { return getCurrentPostLastRevisionId; },
999 - "getCurrentPostRevisionsCount": function() { return getCurrentPostRevisionsCount; },
1000 - "getCurrentPostType": function() { return getCurrentPostType; },
1001 - "getEditedPostAttribute": function() { return getEditedPostAttribute; },
1002 - "getEditedPostContent": function() { return getEditedPostContent; },
1003 - "getEditedPostPreviewLink": function() { return getEditedPostPreviewLink; },
1004 - "getEditedPostSlug": function() { return getEditedPostSlug; },
1005 - "getEditedPostVisibility": function() { return getEditedPostVisibility; },
1006 - "getEditorBlocks": function() { return getEditorBlocks; },
1007 - "getEditorSelection": function() { return getEditorSelection; },
1008 - "getEditorSelectionEnd": function() { return getEditorSelectionEnd; },
1009 - "getEditorSelectionStart": function() { return getEditorSelectionStart; },
1010 - "getEditorSettings": function() { return getEditorSettings; },
1011 - "getFirstMultiSelectedBlockClientId": function() { return getFirstMultiSelectedBlockClientId; },
1012 - "getGlobalBlockCount": function() { return getGlobalBlockCount; },
1013 - "getInserterItems": function() { return getInserterItems; },
1014 - "getLastMultiSelectedBlockClientId": function() { return getLastMultiSelectedBlockClientId; },
1015 - "getMultiSelectedBlockClientIds": function() { return getMultiSelectedBlockClientIds; },
1016 - "getMultiSelectedBlocks": function() { return getMultiSelectedBlocks; },
1017 - "getMultiSelectedBlocksEndClientId": function() { return getMultiSelectedBlocksEndClientId; },
1018 - "getMultiSelectedBlocksStartClientId": function() { return getMultiSelectedBlocksStartClientId; },
1019 - "getNextBlockClientId": function() { return getNextBlockClientId; },
1020 - "getPermalink": function() { return getPermalink; },
1021 - "getPermalinkParts": function() { return getPermalinkParts; },
1022 - "getPostEdits": function() { return getPostEdits; },
1023 - "getPostLockUser": function() { return getPostLockUser; },
1024 - "getPostTypeLabel": function() { return getPostTypeLabel; },
1025 - "getPreviousBlockClientId": function() { return getPreviousBlockClientId; },
1026 - "getSelectedBlock": function() { return getSelectedBlock; },
1027 - "getSelectedBlockClientId": function() { return getSelectedBlockClientId; },
1028 - "getSelectedBlockCount": function() { return getSelectedBlockCount; },
1029 - "getSelectedBlocksInitialCaretPosition": function() { return getSelectedBlocksInitialCaretPosition; },
1030 - "getStateBeforeOptimisticTransaction": function() { return getStateBeforeOptimisticTransaction; },
1031 - "getSuggestedPostFormat": function() { return getSuggestedPostFormat; },
1032 - "getTemplate": function() { return getTemplate; },
1033 - "getTemplateLock": function() { return getTemplateLock; },
1034 - "hasChangedContent": function() { return hasChangedContent; },
1035 - "hasEditorRedo": function() { return hasEditorRedo; },
1036 - "hasEditorUndo": function() { return hasEditorUndo; },
1037 - "hasInserterItems": function() { return hasInserterItems; },
1038 - "hasMultiSelection": function() { return hasMultiSelection; },
1039 - "hasNonPostEntityChanges": function() { return hasNonPostEntityChanges; },
1040 - "hasSelectedBlock": function() { return hasSelectedBlock; },
1041 - "hasSelectedInnerBlock": function() { return hasSelectedInnerBlock; },
1042 - "inSomeHistory": function() { return inSomeHistory; },
1043 - "isAncestorMultiSelected": function() { return isAncestorMultiSelected; },
1044 - "isAutosavingPost": function() { return isAutosavingPost; },
1045 - "isBlockInsertionPointVisible": function() { return isBlockInsertionPointVisible; },
1046 - "isBlockMultiSelected": function() { return isBlockMultiSelected; },
1047 - "isBlockSelected": function() { return isBlockSelected; },
1048 - "isBlockValid": function() { return isBlockValid; },
1049 - "isBlockWithinSelection": function() { return isBlockWithinSelection; },
1050 - "isCaretWithinFormattedText": function() { return isCaretWithinFormattedText; },
1051 - "isCleanNewPost": function() { return isCleanNewPost; },
1052 - "isCurrentPostPending": function() { return isCurrentPostPending; },
1053 - "isCurrentPostPublished": function() { return isCurrentPostPublished; },
1054 - "isCurrentPostScheduled": function() { return isCurrentPostScheduled; },
1055 - "isEditedPostAutosaveable": function() { return isEditedPostAutosaveable; },
1056 - "isEditedPostBeingScheduled": function() { return isEditedPostBeingScheduled; },
1057 - "isEditedPostDateFloating": function() { return isEditedPostDateFloating; },
1058 - "isEditedPostDirty": function() { return isEditedPostDirty; },
1059 - "isEditedPostEmpty": function() { return isEditedPostEmpty; },
1060 - "isEditedPostNew": function() { return isEditedPostNew; },
1061 - "isEditedPostPublishable": function() { return isEditedPostPublishable; },
1062 - "isEditedPostSaveable": function() { return isEditedPostSaveable; },
1063 - "isFirstMultiSelectedBlock": function() { return isFirstMultiSelectedBlock; },
1064 - "isMultiSelecting": function() { return isMultiSelecting; },
1065 - "isPermalinkEditable": function() { return isPermalinkEditable; },
1066 - "isPostAutosavingLocked": function() { return isPostAutosavingLocked; },
1067 - "isPostLockTakeover": function() { return isPostLockTakeover; },
1068 - "isPostLocked": function() { return isPostLocked; },
1069 - "isPostSavingLocked": function() { return isPostSavingLocked; },
1070 - "isPreviewingPost": function() { return isPreviewingPost; },
1071 - "isPublishSidebarEnabled": function() { return isPublishSidebarEnabled; },
1072 - "isPublishingPost": function() { return isPublishingPost; },
1073 - "isSavingNonPostEntityChanges": function() { return isSavingNonPostEntityChanges; },
1074 - "isSavingPost": function() { return isSavingPost; },
1075 - "isSelectionEnabled": function() { return isSelectionEnabled; },
1076 - "isTyping": function() { return isTyping; },
1077 - "isValidTemplate": function() { return isValidTemplate; }
1078 -});
1079 -
1080 -// NAMESPACE OBJECT: ./packages/editor/build-module/store/actions.js
1081 -var actions_namespaceObject = {};
1082 -__webpack_require__.r(actions_namespaceObject);
1083 -__webpack_require__.d(actions_namespaceObject, {
1084 - "__experimentalRequestPostUpdateFinish": function() { return __experimentalRequestPostUpdateFinish; },
1085 - "__experimentalRequestPostUpdateStart": function() { return __experimentalRequestPostUpdateStart; },
1086 - "__experimentalTearDownEditor": function() { return __experimentalTearDownEditor; },
1087 - "autosave": function() { return autosave; },
1088 - "clearSelectedBlock": function() { return clearSelectedBlock; },
1089 - "createUndoLevel": function() { return createUndoLevel; },
1090 - "disablePublishSidebar": function() { return disablePublishSidebar; },
1091 - "editPost": function() { return editPost; },
1092 - "enablePublishSidebar": function() { return enablePublishSidebar; },
1093 - "enterFormattedText": function() { return enterFormattedText; },
1094 - "exitFormattedText": function() { return exitFormattedText; },
1095 - "hideInsertionPoint": function() { return hideInsertionPoint; },
1096 - "insertBlock": function() { return insertBlock; },
1097 - "insertBlocks": function() { return insertBlocks; },
1098 - "insertDefaultBlock": function() { return insertDefaultBlock; },
1099 - "lockPostAutosaving": function() { return lockPostAutosaving; },
1100 - "lockPostSaving": function() { return lockPostSaving; },
1101 - "mergeBlocks": function() { return mergeBlocks; },
1102 - "moveBlockToPosition": function() { return moveBlockToPosition; },
1103 - "moveBlocksDown": function() { return moveBlocksDown; },
1104 - "moveBlocksUp": function() { return moveBlocksUp; },
1105 - "multiSelect": function() { return multiSelect; },
1106 - "receiveBlocks": function() { return receiveBlocks; },
1107 - "redo": function() { return redo; },
1108 - "refreshPost": function() { return refreshPost; },
1109 - "removeBlock": function() { return removeBlock; },
1110 - "removeBlocks": function() { return removeBlocks; },
1111 - "replaceBlock": function() { return replaceBlock; },
1112 - "replaceBlocks": function() { return replaceBlocks; },
1113 - "resetBlocks": function() { return resetBlocks; },
1114 - "resetEditorBlocks": function() { return resetEditorBlocks; },
1115 - "resetPost": function() { return resetPost; },
1116 - "savePost": function() { return savePost; },
1117 - "selectBlock": function() { return selectBlock; },
1118 - "setTemplateValidity": function() { return setTemplateValidity; },
1119 - "setupEditor": function() { return setupEditor; },
1120 - "setupEditorState": function() { return setupEditorState; },
1121 - "showInsertionPoint": function() { return showInsertionPoint; },
1122 - "startMultiSelect": function() { return startMultiSelect; },
1123 - "startTyping": function() { return startTyping; },
1124 - "stopMultiSelect": function() { return stopMultiSelect; },
1125 - "stopTyping": function() { return stopTyping; },
1126 - "synchronizeTemplate": function() { return synchronizeTemplate; },
1127 - "toggleBlockMode": function() { return toggleBlockMode; },
1128 - "toggleSelection": function() { return toggleSelection; },
1129 - "trashPost": function() { return trashPost; },
1130 - "undo": function() { return undo; },
1131 - "unlockPostAutosaving": function() { return unlockPostAutosaving; },
1132 - "unlockPostSaving": function() { return unlockPostSaving; },
1133 - "updateBlock": function() { return updateBlock; },
1134 - "updateBlockAttributes": function() { return updateBlockAttributes; },
1135 - "updateBlockListSettings": function() { return updateBlockListSettings; },
1136 - "updateEditorSettings": function() { return updateEditorSettings; },
1137 - "updatePost": function() { return updatePost; },
1138 - "updatePostLock": function() { return updatePostLock; }
1139 -});
1140 -
1141 -;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
1142 -function _extends() {
1143 - _extends = Object.assign || function (target) {
1144 - for (var i = 1; i < arguments.length; i++) {
1145 - var source = arguments[i];
1146 -
1147 - for (var key in source) {
1148 - if (Object.prototype.hasOwnProperty.call(source, key)) {
1149 - target[key] = source[key];
1150 - }
1151 - }
1152 - }
1153 -
1154 - return target;
1155 - };
1156 -
1157 - return _extends.apply(this, arguments);
1158 -}
1159 -;// CONCATENATED MODULE: external ["wp","element"]
1160 -var external_wp_element_namespaceObject = window["wp"]["element"];
1161 -;// CONCATENATED MODULE: external "lodash"
1162 -var external_lodash_namespaceObject = window["lodash"];
1163 -;// CONCATENATED MODULE: external ["wp","blocks"]
1164 -var external_wp_blocks_namespaceObject = window["wp"]["blocks"];
1165 -;// CONCATENATED MODULE: external ["wp","data"]
1166 -var external_wp_data_namespaceObject = window["wp"]["data"];
1167 -;// CONCATENATED MODULE: external ["wp","coreData"]
1168 -var external_wp_coreData_namespaceObject = window["wp"]["coreData"];
1169 -;// CONCATENATED MODULE: external ["wp","compose"]
1170 -var external_wp_compose_namespaceObject = window["wp"]["compose"];
1171 -;// CONCATENATED MODULE: external ["wp","hooks"]
1172 -var external_wp_hooks_namespaceObject = window["wp"]["hooks"];
1173 -;// CONCATENATED MODULE: external ["wp","dataControls"]
1174 -var external_wp_dataControls_namespaceObject = window["wp"]["dataControls"];
1175 -;// CONCATENATED MODULE: external ["wp","blockEditor"]
1176 -var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
1177 -;// CONCATENATED MODULE: ./packages/editor/build-module/store/defaults.js
1178 -/**
1179 - * WordPress dependencies
1180 - */
1181 -
1182 -const PREFERENCES_DEFAULTS = {
1183 - insertUsage: {},
1184 - // Should be kept for backward compatibility, see: https://github.com/WordPress/gutenberg/issues/14580.
1185 - isPublishSidebarEnabled: true
1186 -};
1187 -/**
1188 - * The default post editor settings
1189 - *
1190 - * allowedBlockTypes boolean|Array Allowed block types
1191 - * richEditingEnabled boolean Whether rich editing is enabled or not
1192 - * codeEditingEnabled boolean Whether code editing is enabled or not
1193 - * enableCustomFields boolean Whether the WordPress custom fields are enabled or not.
1194 - * true = the user has opted to show the Custom Fields panel at the bottom of the editor.
1195 - * false = the user has opted to hide the Custom Fields panel at the bottom of the editor.
1196 - * undefined = the current environment does not support Custom Fields,
1197 - * so the option toggle in Preferences -> Panels to
1198 - * enable the Custom Fields panel is not displayed.
1199 - * autosaveInterval number Autosave Interval
1200 - * availableTemplates array? The available post templates
1201 - * disablePostFormats boolean Whether or not the post formats are disabled
1202 - * allowedMimeTypes array? List of allowed mime types and file extensions
1203 - * maxUploadFileSize number Maximum upload file size
1204 - * supportsLayout boolean Whether the editor supports layouts.
1205 - */
1206 -
1207 -const EDITOR_SETTINGS_DEFAULTS = { ...external_wp_blockEditor_namespaceObject.SETTINGS_DEFAULTS,
1208 - richEditingEnabled: true,
1209 - codeEditingEnabled: true,
1210 - enableCustomFields: undefined,
1211 - supportsLayout: true
1212 -};
1213 -//# sourceMappingURL=defaults.js.map
1214 -;// CONCATENATED MODULE: ./packages/editor/build-module/store/reducer.js
1215 -/**
1216 - * External dependencies
1217 - */
1218 -
1219 -/**
1220 - * WordPress dependencies
1221 - */
1222 -
1223 -
1224 -/**
1225 - * Internal dependencies
1226 - */
1227 -
1228 -
1229 -/**
1230 - * Returns a post attribute value, flattening nested rendered content using its
1231 - * raw value in place of its original object form.
1232 - *
1233 - * @param {*} value Original value.
1234 - *
1235 - * @return {*} Raw value.
1236 - */
1237 -
1238 -function getPostRawValue(value) {
1239 - if (value && 'object' === typeof value && 'raw' in value) {
1240 - return value.raw;
1241 - }
1242 -
1243 - return value;
1244 -}
1245 -/**
1246 - * Returns true if the two object arguments have the same keys, or false
1247 - * otherwise.
1248 - *
1249 - * @param {Object} a First object.
1250 - * @param {Object} b Second object.
1251 - *
1252 - * @return {boolean} Whether the two objects have the same keys.
1253 - */
1254 -
1255 -function hasSameKeys(a, b) {
1256 - return isEqual(keys(a), keys(b));
1257 -}
1258 -/**
1259 - * Returns true if, given the currently dispatching action and the previously
1260 - * dispatched action, the two actions are editing the same post property, or
1261 - * false otherwise.
1262 - *
1263 - * @param {Object} action Currently dispatching action.
1264 - * @param {Object} previousAction Previously dispatched action.
1265 - *
1266 - * @return {boolean} Whether actions are updating the same post property.
1267 - */
1268 -
1269 -function isUpdatingSamePostProperty(action, previousAction) {
1270 - return action.type === 'EDIT_POST' && hasSameKeys(action.edits, previousAction.edits);
1271 -}
1272 -/**
1273 - * Returns true if, given the currently dispatching action and the previously
1274 - * dispatched action, the two actions are modifying the same property such that
1275 - * undo history should be batched.
1276 - *
1277 - * @param {Object} action Currently dispatching action.
1278 - * @param {Object} previousAction Previously dispatched action.
1279 - *
1280 - * @return {boolean} Whether to overwrite present state.
1281 - */
1282 -
1283 -function shouldOverwriteState(action, previousAction) {
1284 - if (action.type === 'RESET_EDITOR_BLOCKS') {
1285 - return !action.shouldCreateUndoLevel;
1286 - }
1287 -
1288 - if (!previousAction || action.type !== previousAction.type) {
1289 - return false;
1290 - }
1291 -
1292 - return isUpdatingSamePostProperty(action, previousAction);
1293 -}
1294 -function postId() {
1295 - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1296 - let action = arguments.length > 1 ? arguments[1] : undefined;
1297 -
1298 - switch (action.type) {
1299 - case 'SETUP_EDITOR_STATE':
1300 - case 'RESET_POST':
1301 - return action.post.id;
1302 - }
1303 -
1304 - return state;
1305 -}
1306 -function postType() {
1307 - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1308 - let action = arguments.length > 1 ? arguments[1] : undefined;
1309 -
1310 - switch (action.type) {
1311 - case 'SETUP_EDITOR_STATE':
1312 - case 'RESET_POST':
1313 - return action.post.type;
1314 - }
1315 -
1316 - return state;
1317 -}
1318 -/**
1319 - * Reducer returning whether the post blocks match the defined template or not.
1320 - *
1321 - * @param {Object} state Current state.
1322 - * @param {Object} action Dispatched action.
1323 - *
1324 - * @return {boolean} Updated state.
1325 - */
1326 -
1327 -function template() {
1328 - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
1329 - isValid: true
1330 - };
1331 - let action = arguments.length > 1 ? arguments[1] : undefined;
1332 -
1333 - switch (action.type) {
1334 - case 'SET_TEMPLATE_VALIDITY':
1335 - return { ...state,
1336 - isValid: action.isValid
1337 - };
1338 - }
1339 -
1340 - return state;
1341 -}
1342 -/**
1343 - * Reducer returning the user preferences.
1344 - *
1345 - * @param {Object} state Current state.
1346 - * @param {Object} action Dispatched action.
1347 - *
1348 - * @return {string} Updated state.
1349 - */
1350 -
1351 -function preferences() {
1352 - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : PREFERENCES_DEFAULTS;
1353 - let action = arguments.length > 1 ? arguments[1] : undefined;
1354 -
1355 - switch (action.type) {
1356 - case 'ENABLE_PUBLISH_SIDEBAR':
1357 - return { ...state,
1358 - isPublishSidebarEnabled: true
1359 - };
1360 -
1361 - case 'DISABLE_PUBLISH_SIDEBAR':
1362 - return { ...state,
1363 - isPublishSidebarEnabled: false
1364 - };
1365 - }
1366 -
1367 - return state;
1368 -}
1369 -/**
1370 - * Reducer returning current network request state (whether a request to
1371 - * the WP REST API is in progress, successful, or failed).
1372 - *
1373 - * @param {Object} state Current state.
1374 - * @param {Object} action Dispatched action.
1375 - *
1376 - * @return {Object} Updated state.
1377 - */
1378 -
1379 -function saving() {
1380 - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1381 - let action = arguments.length > 1 ? arguments[1] : undefined;
1382 -
1383 - switch (action.type) {
1384 - case 'REQUEST_POST_UPDATE_START':
1385 - case 'REQUEST_POST_UPDATE_FINISH':
1386 - return {
1387 - pending: action.type === 'REQUEST_POST_UPDATE_START',
1388 - options: action.options || {}
1389 - };
1390 - }
1391 -
1392 - return state;
1393 -}
1394 -/**
1395 - * Post Lock State.
1396 - *
1397 - * @typedef {Object} PostLockState
1398 - *
1399 - * @property {boolean} isLocked Whether the post is locked.
1400 - * @property {?boolean} isTakeover Whether the post editing has been taken over.
1401 - * @property {?boolean} activePostLock Active post lock value.
1402 - * @property {?Object} user User that took over the post.
1403 - */
1404 -
1405 -/**
1406 - * Reducer returning the post lock status.
1407 - *
1408 - * @param {PostLockState} state Current state.
1409 - * @param {Object} action Dispatched action.
1410 - *
1411 - * @return {PostLockState} Updated state.
1412 - */
1413 -
1414 -function postLock() {
1415 - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
1416 - isLocked: false
1417 - };
1418 - let action = arguments.length > 1 ? arguments[1] : undefined;
1419 -
1420 - switch (action.type) {
1421 - case 'UPDATE_POST_LOCK':
1422 - return action.lock;
1423 - }
1424 -
1425 - return state;
1426 -}
1427 -/**
1428 - * Post saving lock.
1429 - *
1430 - * When post saving is locked, the post cannot be published or updated.
1431 - *
1432 - * @param {PostLockState} state Current state.
1433 - * @param {Object} action Dispatched action.
1434 - *
1435 - * @return {PostLockState} Updated state.
1436 - */
1437 -
1438 -function postSavingLock() {
1439 - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1440 - let action = arguments.length > 1 ? arguments[1] : undefined;
1441 -
1442 - switch (action.type) {
1443 - case 'LOCK_POST_SAVING':
1444 - return { ...state,
1445 - [action.lockName]: true
1446 - };
1447 -
1448 - case 'UNLOCK_POST_SAVING':
1449 - return (0,external_lodash_namespaceObject.omit)(state, action.lockName);
1450 - }
1451 -
1452 - return state;
1453 -}
1454 -/**
1455 - * Post autosaving lock.
1456 - *
1457 - * When post autosaving is locked, the post will not autosave.
1458 - *
1459 - * @param {PostLockState} state Current state.
1460 - * @param {Object} action Dispatched action.
1461 - *
1462 - * @return {PostLockState} Updated state.
1463 - */
1464 -
1465 -function postAutosavingLock() {
1466 - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1467 - let action = arguments.length > 1 ? arguments[1] : undefined;
1468 -
1469 - switch (action.type) {
1470 - case 'LOCK_POST_AUTOSAVING':
1471 - return { ...state,
1472 - [action.lockName]: true
1473 - };
1474 -
1475 - case 'UNLOCK_POST_AUTOSAVING':
1476 - return (0,external_lodash_namespaceObject.omit)(state, action.lockName);
1477 - }
1478 -
1479 - return state;
1480 -}
1481 -/**
1482 - * Reducer returning whether the editor is ready to be rendered.
1483 - * The editor is considered ready to be rendered once
1484 - * the post object is loaded properly and the initial blocks parsed.
1485 - *
1486 - * @param {boolean} state
1487 - * @param {Object} action
1488 - *
1489 - * @return {boolean} Updated state.
1490 - */
1491 -
1492 -function isReady() {
1493 - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1494 - let action = arguments.length > 1 ? arguments[1] : undefined;
1495 -
1496 - switch (action.type) {
1497 - case 'SETUP_EDITOR_STATE':
1498 - return true;
1499 -
1500 - case 'TEAR_DOWN_EDITOR':
1501 - return false;
1502 - }
1503 -
1504 - return state;
1505 -}
1506 -/**
1507 - * Reducer returning the post editor setting.
1508 - *
1509 - * @param {Object} state Current state.
1510 - * @param {Object} action Dispatched action.
1511 - *
1512 - * @return {Object} Updated state.
1513 - */
1514 -
1515 -function editorSettings() {
1516 - let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : EDITOR_SETTINGS_DEFAULTS;
1517 - let action = arguments.length > 1 ? arguments[1] : undefined;
1518 -
1519 - switch (action.type) {
1520 - case 'UPDATE_EDITOR_SETTINGS':
1521 - return { ...state,
1522 - ...action.settings
1523 - };
1524 - }
1525 -
1526 - return state;
1527 -}
1528 -/* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
1529 - postId,
1530 - postType,
1531 - preferences,
1532 - saving,
1533 - postLock,
1534 - template,
1535 - postSavingLock,
1536 - isReady,
1537 - editorSettings,
1538 - postAutosavingLock
1539 -}));
1540 -//# sourceMappingURL=reducer.js.map
1541 -;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js
1542 -
1543 -
1544 -var LEAF_KEY, hasWeakMap;
1545 -
1546 -/**
1547 - * Arbitrary value used as key for referencing cache object in WeakMap tree.
1548 - *
1549 - * @type {Object}
1550 - */
1551 -LEAF_KEY = {};
1552 -
1553 -/**
1554 - * Whether environment supports WeakMap.
1555 - *
1556 - * @type {boolean}
1557 - */
1558 -hasWeakMap = typeof WeakMap !== 'undefined';
1559 -
1560 -/**
1561 - * Returns the first argument as the sole entry in an array.
1562 - *
1563 - * @param {*} value Value to return.
1564 - *
1565 - * @return {Array} Value returned as entry in array.
1566 - */
1567 -function arrayOf( value ) {
1568 - return [ value ];
1569 -}
1570 -
1571 -/**
1572 - * Returns true if the value passed is object-like, or false otherwise. A value
1573 - * is object-like if it can support property assignment, e.g. object or array.
1574 - *
1575 - * @param {*} value Value to test.
1576 - *
1577 - * @return {boolean} Whether value is object-like.
1578 - */
1579 -function isObjectLike( value ) {
1580 - return !! value && 'object' === typeof value;
1581 -}
1582 -
1583 -/**
1584 - * Creates and returns a new cache object.
1585 - *
1586 - * @return {Object} Cache object.
1587 - */
1588 -function createCache() {
1589 - var cache = {
1590 - clear: function() {
1591 - cache.head = null;
1592 - },
1593 - };
1594 -
1595 - return cache;
1596 -}
1597 -
1598 -/**
1599 - * Returns true if entries within the two arrays are strictly equal by
1600 - * reference from a starting index.
1601 - *
1602 - * @param {Array} a First array.
1603 - * @param {Array} b Second array.
1604 - * @param {number} fromIndex Index from which to start comparison.
1605 - *
1606 - * @return {boolean} Whether arrays are shallowly equal.
1607 - */
1608 -function isShallowEqual( a, b, fromIndex ) {
1609 - var i;
1610 -
1611 - if ( a.length !== b.length ) {
1612 - return false;
1613 - }
1614 -
1615 - for ( i = fromIndex; i < a.length; i++ ) {
1616 - if ( a[ i ] !== b[ i ] ) {
1617 - return false;
1618 - }
1619 - }
1620 -
1621 - return true;
1622 -}
1623 -
1624 -/**
1625 - * Returns a memoized selector function. The getDependants function argument is
1626 - * called before the memoized selector and is expected to return an immutable
1627 - * reference or array of references on which the selector depends for computing
1628 - * its own return value. The memoize cache is preserved only as long as those
1629 - * dependant references remain the same. If getDependants returns a different
1630 - * reference(s), the cache is cleared and the selector value regenerated.
1631 - *
1632 - * @param {Function} selector Selector function.
1633 - * @param {Function} getDependants Dependant getter returning an immutable
1634 - * reference or array of reference used in
1635 - * cache bust consideration.
1636 - *
1637 - * @return {Function} Memoized selector.
1638 - */
1639 -/* harmony default export */ function rememo(selector, getDependants ) {
1640 - var rootCache, getCache;
1641 -
1642 - // Use object source as dependant if getter not provided
1643 - if ( ! getDependants ) {
1644 - getDependants = arrayOf;
1645 - }
1646 -
1647 - /**
1648 - * Returns the root cache. If WeakMap is supported, this is assigned to the
1649 - * root WeakMap cache set, otherwise it is a shared instance of the default
1650 - * cache object.
1651 - *
1652 - * @return {(WeakMap|Object)} Root cache object.
1653 - */
1654 - function getRootCache() {
1655 - return rootCache;
1656 - }
1657 -
1658 - /**
1659 - * Returns the cache for a given dependants array. When possible, a WeakMap
1660 - * will be used to create a unique cache for each set of dependants. This
1661 - * is feasible due to the nature of WeakMap in allowing garbage collection
1662 - * to occur on entries where the key object is no longer referenced. Since
1663 - * WeakMap requires the key to be an object, this is only possible when the
1664 - * dependant is object-like. The root cache is created as a hierarchy where
1665 - * each top-level key is the first entry in a dependants set, the value a
1666 - * WeakMap where each key is the next dependant, and so on. This continues
1667 - * so long as the dependants are object-like. If no dependants are object-
1668 - * like, then the cache is shared across all invocations.
1669 - *
1670 - * @see isObjectLike
1671 - *
1672 - * @param {Array} dependants Selector dependants.
1673 - *
1674 - * @return {Object} Cache object.
1675 - */
1676 - function getWeakMapCache( dependants ) {
1677 - var caches = rootCache,
1678 - isUniqueByDependants = true,
1679 - i, dependant, map, cache;
1680 -
1681 - for ( i = 0; i < dependants.length; i++ ) {
1682 - dependant = dependants[ i ];
1683 -
1684 - // Can only compose WeakMap from object-like key.
1685 - if ( ! isObjectLike( dependant ) ) {
1686 - isUniqueByDependants = false;
1687 - break;
1688 - }
1689 -
1690 - // Does current segment of cache already have a WeakMap?
1691 - if ( caches.has( dependant ) ) {
1692 - // Traverse into nested WeakMap.
1693 - caches = caches.get( dependant );
1694 - } else {
1695 - // Create, set, and traverse into a new one.
1696 - map = new WeakMap();
1697 - caches.set( dependant, map );
1698 - caches = map;
1699 - }
1700 - }
1701 -
1702 - // We use an arbitrary (but consistent) object as key for the last item
1703 - // in the WeakMap to serve as our running cache.
1704 - if ( ! caches.has( LEAF_KEY ) ) {
1705 - cache = createCache();
1706 - cache.isUniqueByDependants = isUniqueByDependants;
1707 - caches.set( LEAF_KEY, cache );
1708 - }
1709 -
1710 - return caches.get( LEAF_KEY );
1711 - }
1712 -
1713 - // Assign cache handler by availability of WeakMap
1714 - getCache = hasWeakMap ? getWeakMapCache : getRootCache;
1715 -
1716 - /**
1717 - * Resets root memoization cache.
1718 - */
1719 - function clear() {
1720 - rootCache = hasWeakMap ? new WeakMap() : createCache();
1721 - }
1722 -
1723 - // eslint-disable-next-line jsdoc/check-param-names
1724 - /**
1725 - * The augmented selector call, considering first whether dependants have
1726 - * changed before passing it to underlying memoize function.
1727 - *
1728 - * @param {Object} source Source object for derivation.
1729 - * @param {...*} extraArgs Additional arguments to pass to selector.
1730 - *
1731 - * @return {*} Selector result.
1732 - */
1733 - function callSelector( /* source, ...extraArgs */ ) {
1734 - var len = arguments.length,
1735 - cache, node, i, args, dependants;
1736 -
1737 - // Create copy of arguments (avoid leaking deoptimization).
1738 - args = new Array( len );
1739 - for ( i = 0; i < len; i++ ) {
1740 - args[ i ] = arguments[ i ];
1741 - }
1742 -
1743 - dependants = getDependants.apply( null, args );
1744 - cache = getCache( dependants );
1745 -
1746 - // If not guaranteed uniqueness by dependants (primitive type or lack
1747 - // of WeakMap support), shallow compare against last dependants and, if
1748 - // references have changed, destroy cache to recalculate result.
1749 - if ( ! cache.isUniqueByDependants ) {
1750 - if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
1751 - cache.clear();
1752 - }
1753 -
1754 - cache.lastDependants = dependants;
1755 - }
1756 -
1757 - node = cache.head;
1758 - while ( node ) {
1759 - // Check whether node arguments match arguments
1760 - if ( ! isShallowEqual( node.args, args, 1 ) ) {
1761 - node = node.next;
1762 - continue;
1763 - }
1764 -
1765 - // At this point we can assume we've found a match
1766 -
1767 - // Surface matched node to head if not already
1768 - if ( node !== cache.head ) {
1769 - // Adjust siblings to point to each other.
1770 - node.prev.next = node.next;
1771 - if ( node.next ) {
1772 - node.next.prev = node.prev;
1773 - }
1774 -
1775 - node.next = cache.head;
1776 - node.prev = null;
1777 - cache.head.prev = node;
1778 - cache.head = node;
1779 - }
1780 -
1781 - // Return immediately
1782 - return node.val;
1783 - }
1784 -
1785 - // No cached value found. Continue to insertion phase:
1786 -
1787 - node = {
1788 - // Generate the result from original function
1789 - val: selector.apply( null, args ),
1790 - };
1791 -
1792 - // Avoid including the source object in the cache.
1793 - args[ 0 ] = null;
1794 - node.args = args;
1795 -
1796 - // Don't need to check whether node is already head, since it would
1797 - // have been returned above already if it was
1798 -
1799 - // Shift existing head down list
1800 - if ( cache.head ) {
1801 - cache.head.prev = node;
1802 - node.next = cache.head;
1803 - }
1804 -
1805 - cache.head = node;
1806 -
1807 - return node.val;
1808 - }
1809 -
1810 - callSelector.getDependants = getDependants;
1811 - callSelector.clear = clear;
1812 - clear();
1813 -
1814 - return callSelector;
1815 -}
1816 -
1817 -;// CONCATENATED MODULE: external ["wp","date"]
1818 -var external_wp_date_namespaceObject = window["wp"]["date"];
1819 -;// CONCATENATED MODULE: external ["wp","url"]
1820 -var external_wp_url_namespaceObject = window["wp"]["url"];
1821 -;// CONCATENATED MODULE: external ["wp","deprecated"]
1822 -var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
1823 -var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
1824 -;// CONCATENATED MODULE: external ["wp","primitives"]
1825 -var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
1826 -;// CONCATENATED MODULE: ./packages/icons/build-module/library/layout.js
1827 -
1828 -
1829 -/**
1830 - * WordPress dependencies
1831 - */
1832 -
1833 -const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1834 - xmlns: "http://www.w3.org/2000/svg",
1835 - viewBox: "0 0 24 24"
1836 -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1837 - d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
1838 -}));
1839 -/* harmony default export */ var library_layout = (layout);
1840 -//# sourceMappingURL=layout.js.map
1841 -;// CONCATENATED MODULE: ./packages/editor/build-module/store/constants.js
1842 -/**
1843 - * Set of post properties for which edits should assume a merging behavior,
1844 - * assuming an object value.
1845 - *
1846 - * @type {Set}
1847 - */
1848 -const EDIT_MERGE_PROPERTIES = new Set(['meta']);
1849 -/**
1850 - * Constant for the store module (or reducer) key.
1851 - *
1852 - * @type {string}
1853 - */
1854 -
1855 -const STORE_NAME = 'core/editor';
1856 -const SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID';
1857 -const TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID';
1858 -const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/;
1859 -const ONE_MINUTE_IN_MS = 60 * 1000;
1860 -const AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content'];
1861 -//# sourceMappingURL=constants.js.map
1862 -;// CONCATENATED MODULE: ./packages/editor/build-module/utils/url.js
1863 -/**
1864 - * External dependencies
1865 - */
1866 -
1867 -/**
1868 - * WordPress dependencies
1869 - */
1870 -
1871 -
1872 -/**
1873 - * Returns the URL of a WPAdmin Page.
1874 - *
1875 - * TODO: This should be moved to a module less specific to the editor.
1876 - *
1877 - * @param {string} page Page to navigate to.
1878 - * @param {Object} query Query Args.
1879 - *
1880 - * @return {string} WPAdmin URL.
1881 - */
1882 -
1883 -function getWPAdminURL(page, query) {
1884 - return (0,external_wp_url_namespaceObject.addQueryArgs)(page, query);
1885 -}
1886 -/**
1887 - * Performs some basic cleanup of a string for use as a post slug
1888 - *
1889 - * This replicates some of what sanitize_title() does in WordPress core, but
1890 - * is only designed to approximate what the slug will be.
1891 - *
1892 - * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin letters.
1893 - * Removes combining diacritical marks. Converts whitespace, periods,
1894 - * and forward slashes to hyphens. Removes any remaining non-word characters
1895 - * except hyphens and underscores. Converts remaining string to lowercase.
1896 - * It does not account for octets, HTML entities, or other encoded characters.
1897 - *
1898 - * @param {string} string Title or slug to be processed
1899 - *
1900 - * @return {string} Processed string
1901 - */
1902 -
1903 -function cleanForSlug(string) {
1904 - if (!string) {
1905 - return '';
1906 - }
1907 -
1908 - return (0,external_lodash_namespaceObject.trim)((0,external_lodash_namespaceObject.deburr)(string).replace(/[\s\./]+/g, '-').replace(/[^\p{L}\p{N}_-]+/gu, '').toLowerCase(), '-');
1909 -}
1910 -//# sourceMappingURL=url.js.map
1911 -;// CONCATENATED MODULE: ./packages/icons/build-module/library/header.js
1912 -
1913 -
1914 -/**
1915 - * WordPress dependencies
1916 - */
1917 -
1918 -const header = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1919 - xmlns: "http://www.w3.org/2000/svg",
1920 - viewBox: "0 0 24 24"
1921 -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1922 - d: "M18.5 10.5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
1923 -}));
1924 -/* harmony default export */ var library_header = (header);
1925 -//# sourceMappingURL=header.js.map
1926 -;// CONCATENATED MODULE: ./packages/icons/build-module/library/footer.js
1927 -
1928 -
1929 -/**
1930 - * WordPress dependencies
1931 - */
1932 -
1933 -const footer = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1934 - xmlns: "http://www.w3.org/2000/svg",
1935 - viewBox: "0 0 24 24"
1936 -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1937 - fillRule: "evenodd",
1938 - d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
1939 -}));
1940 -/* harmony default export */ var library_footer = (footer);
1941 -//# sourceMappingURL=footer.js.map
1942 -;// CONCATENATED MODULE: ./packages/icons/build-module/library/sidebar.js
1943 -
1944 -
1945 -/**
1946 - * WordPress dependencies
1947 - */
1948 -
1949 -const sidebar = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1950 - xmlns: "http://www.w3.org/2000/svg",
1951 - viewBox: "0 0 24 24"
1952 -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1953 - d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
1954 -}));
1955 -/* harmony default export */ var library_sidebar = (sidebar);
1956 -//# sourceMappingURL=sidebar.js.map
1957 -;// CONCATENATED MODULE: ./packages/icons/build-module/library/symbol-filled.js
1958 -
1959 -
1960 -/**
1961 - * WordPress dependencies
1962 - */
1963 -
1964 -const symbolFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1965 - xmlns: "http://www.w3.org/2000/svg",
1966 - viewBox: "0 0 24 24"
1967 -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1968 - d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"
1969 -}));
1970 -/* harmony default export */ var symbol_filled = (symbolFilled);
1971 -//# sourceMappingURL=symbol-filled.js.map
1972 -;// CONCATENATED MODULE: ./packages/editor/build-module/utils/get-template-part-icon.js
1973 -/**
1974 - * WordPress dependencies
1975 - */
1976 -
1977 -/**
1978 - * Helper function to retrieve the corresponding icon by name.
1979 - *
1980 - * @param {string} iconName The name of the icon.
1981 - *
1982 - * @return {Object} The corresponding icon.
1983 - */
1984 -
1985 -function getTemplatePartIcon(iconName) {
1986 - if ('header' === iconName) {
1987 - return library_header;
1988 - } else if ('footer' === iconName) {
1989 - return library_footer;
1990 - } else if ('sidebar' === iconName) {
1991 - return library_sidebar;
1992 - }
1993 -
1994 - return symbol_filled;
1995 -}
1996 -//# sourceMappingURL=get-template-part-icon.js.map
1997 -;// CONCATENATED MODULE: ./packages/editor/build-module/store/selectors.js
1998 -/**
1999 - * External dependencies
2000 - */
2001 -
2002 -
2003 -/**
2004 - * WordPress dependencies
2005 - */
2006 -
2007 -
2008 -
2009 -
2010 -
2011 -
2012 -
2013 -
2014 -
2015 -
2016 -/**
2017 - * Internal dependencies
2018 - */
2019 -
2020 -
2021 -
2022 -
2023 -
2024 -
2025 -/**
2026 - * Shared reference to an empty object for cases where it is important to avoid
2027 - * returning a new object reference on every invocation, as in a connected or
2028 - * other pure component which performs `shouldComponentUpdate` check on props.
2029 - * This should be used as a last resort, since the normalized data should be
2030 - * maintained by the reducer result in state.
2031 - */
2032 -
2033 -const EMPTY_OBJECT = {};
2034 -/**
2035 - * Shared reference to an empty array for cases where it is important to avoid
2036 - * returning a new array reference on every invocation, as in a connected or
2037 - * other pure component which performs `shouldComponentUpdate` check on props.
2038 - * This should be used as a last resort, since the normalized data should be
2039 - * maintained by the reducer result in state.
2040 - */
2041 -
2042 -const EMPTY_ARRAY = [];
2043 -/**
2044 - * Returns true if any past editor history snapshots exist, or false otherwise.
2045 - *
2046 - * @param {Object} state Global application state.
2047 - *
2048 - * @return {boolean} Whether undo history exists.
2049 - */
2050 -
2051 -const hasEditorUndo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
2052 - return select(external_wp_coreData_namespaceObject.store).hasUndo();
2053 -});
2054 -/**
2055 - * Returns true if any future editor history snapshots exist, or false
2056 - * otherwise.
2057 - *
2058 - * @param {Object} state Global application state.
2059 - *
2060 - * @return {boolean} Whether redo history exists.
2061 - */
2062 -
2063 -const hasEditorRedo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
2064 - return select(external_wp_coreData_namespaceObject.store).hasRedo();
2065 -});
2066 -/**
2067 - * Returns true if the currently edited post is yet to be saved, or false if
2068 - * the post has been saved.
2069 - *
2070 - * @param {Object} state Global application state.
2071 - *
2072 - * @return {boolean} Whether the post is new.
2073 - */
2074 -
2075 -function isEditedPostNew(state) {
2076 - return getCurrentPost(state).status === 'auto-draft';
2077 -}
2078 -/**
2079 - * Returns true if content includes unsaved changes, or false otherwise.
2080 - *
2081 - * @param {Object} state Editor state.
2082 - *
2083 - * @return {boolean} Whether content includes unsaved changes.
2084 - */
2085 -
2086 -function hasChangedContent(state) {
2087 - const edits = getPostEdits(state);
2088 - return 'blocks' in edits || // `edits` is intended to contain only values which are different from
2089 - // the saved post, so the mere presence of a property is an indicator
2090 - // that the value is different than what is known to be saved. While
2091 - // content in Visual mode is represented by the blocks state, in Text
2092 - // mode it is tracked by `edits.content`.
2093 - 'content' in edits;
2094 -}
2095 -/**
2096 - * Returns true if there are unsaved values for the current edit session, or
2097 - * false if the editing state matches the saved or new post.
2098 - *
2099 - * @param {Object} state Global application state.
2100 - *
2101 - * @return {boolean} Whether unsaved values exist.
2102 - */
2103 -
2104 -const isEditedPostDirty = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2105 - // Edits should contain only fields which differ from the saved post (reset
2106 - // at initial load and save complete). Thus, a non-empty edits state can be
2107 - // inferred to contain unsaved values.
2108 - const postType = getCurrentPostType(state);
2109 - const postId = getCurrentPostId(state);
2110 -
2111 - if (select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord('postType', postType, postId)) {
2112 - return true;
2113 - }
2114 -
2115 - return false;
2116 -});
2117 -/**
2118 - * Returns true if there are unsaved edits for entities other than
2119 - * the editor's post, and false otherwise.
2120 - *
2121 - * @param {Object} state Global application state.
2122 - *
2123 - * @return {boolean} Whether there are edits or not.
2124 - */
2125 -
2126 -const hasNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2127 - const dirtyEntityRecords = select(external_wp_coreData_namespaceObject.store).__experimentalGetDirtyEntityRecords();
2128 -
2129 - const {
2130 - type,
2131 - id
2132 - } = getCurrentPost(state);
2133 - return (0,external_lodash_namespaceObject.some)(dirtyEntityRecords, entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id);
2134 -});
2135 -/**
2136 - * Returns true if there are no unsaved values for the current edit session and
2137 - * if the currently edited post is new (has never been saved before).
2138 - *
2139 - * @param {Object} state Global application state.
2140 - *
2141 - * @return {boolean} Whether new post and unsaved values exist.
2142 - */
2143 -
2144 -function isCleanNewPost(state) {
2145 - return !isEditedPostDirty(state) && isEditedPostNew(state);
2146 -}
2147 -/**
2148 - * Returns the post currently being edited in its last known saved state, not
2149 - * including unsaved edits. Returns an object containing relevant default post
2150 - * values if the post has not yet been saved.
2151 - *
2152 - * @param {Object} state Global application state.
2153 - *
2154 - * @return {Object} Post object.
2155 - */
2156 -
2157 -const getCurrentPost = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2158 - const postId = getCurrentPostId(state);
2159 - const postType = getCurrentPostType(state);
2160 - const post = select(external_wp_coreData_namespaceObject.store).getRawEntityRecord('postType', postType, postId);
2161 -
2162 - if (post) {
2163 - return post;
2164 - } // This exists for compatibility with the previous selector behavior
2165 - // which would guarantee an object return based on the editor reducer's
2166 - // default empty object state.
2167 -
2168 -
2169 - return EMPTY_OBJECT;
2170 -});
2171 -/**
2172 - * Returns the post type of the post currently being edited.
2173 - *
2174 - * @param {Object} state Global application state.
2175 - *
2176 - * @return {string} Post type.
2177 - */
2178 -
2179 -function getCurrentPostType(state) {
2180 - return state.postType;
2181 -}
2182 -/**
2183 - * Returns the ID of the post currently being edited, or null if the post has
2184 - * not yet been saved.
2185 - *
2186 - * @param {Object} state Global application state.
2187 - *
2188 - * @return {?number} ID of current post.
2189 - */
2190 -
2191 -function getCurrentPostId(state) {
2192 - return state.postId;
2193 -}
2194 -/**
2195 - * Returns the number of revisions of the post currently being edited.
2196 - *
2197 - * @param {Object} state Global application state.
2198 - *
2199 - * @return {number} Number of revisions.
2200 - */
2201 -
2202 -function getCurrentPostRevisionsCount(state) {
2203 - return (0,external_lodash_namespaceObject.get)(getCurrentPost(state), ['_links', 'version-history', 0, 'count'], 0);
2204 -}
2205 -/**
2206 - * Returns the last revision ID of the post currently being edited,
2207 - * or null if the post has no revisions.
2208 - *
2209 - * @param {Object} state Global application state.
2210 - *
2211 - * @return {?number} ID of the last revision.
2212 - */
2213 -
2214 -function getCurrentPostLastRevisionId(state) {
2215 - return (0,external_lodash_namespaceObject.get)(getCurrentPost(state), ['_links', 'predecessor-version', 0, 'id'], null);
2216 -}
2217 -/**
2218 - * Returns any post values which have been changed in the editor but not yet
2219 - * been saved.
2220 - *
2221 - * @param {Object} state Global application state.
2222 - *
2223 - * @return {Object} Object of key value pairs comprising unsaved edits.
2224 - */
2225 -
2226 -const getPostEdits = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2227 - const postType = getCurrentPostType(state);
2228 - const postId = getCurrentPostId(state);
2229 - return select(external_wp_coreData_namespaceObject.store).getEntityRecordEdits('postType', postType, postId) || EMPTY_OBJECT;
2230 -});
2231 -/**
2232 - * Returns an attribute value of the saved post.
2233 - *
2234 - * @param {Object} state Global application state.
2235 - * @param {string} attributeName Post attribute name.
2236 - *
2237 - * @return {*} Post attribute value.
2238 - */
2239 -
2240 -function getCurrentPostAttribute(state, attributeName) {
2241 - switch (attributeName) {
2242 - case 'type':
2243 - return getCurrentPostType(state);
2244 -
2245 - case 'id':
2246 - return getCurrentPostId(state);
2247 -
2248 - default:
2249 - const post = getCurrentPost(state);
2250 -
2251 - if (!post.hasOwnProperty(attributeName)) {
2252 - break;
2253 - }
2254 -
2255 - return getPostRawValue(post[attributeName]);
2256 - }
2257 -}
2258 -/**
2259 - * Returns a single attribute of the post being edited, preferring the unsaved
2260 - * edit if one exists, but merging with the attribute value for the last known
2261 - * saved state of the post (this is needed for some nested attributes like meta).
2262 - *
2263 - * @param {Object} state Global application state.
2264 - * @param {string} attributeName Post attribute name.
2265 - *
2266 - * @return {*} Post attribute value.
2267 - */
2268 -
2269 -const getNestedEditedPostProperty = (state, attributeName) => {
2270 - const edits = getPostEdits(state);
2271 -
2272 - if (!edits.hasOwnProperty(attributeName)) {
2273 - return getCurrentPostAttribute(state, attributeName);
2274 - }
2275 -
2276 - return { ...getCurrentPostAttribute(state, attributeName),
2277 - ...edits[attributeName]
2278 - };
2279 -};
2280 -/**
2281 - * Returns a single attribute of the post being edited, preferring the unsaved
2282 - * edit if one exists, but falling back to the attribute for the last known
2283 - * saved state of the post.
2284 - *
2285 - * @param {Object} state Global application state.
2286 - * @param {string} attributeName Post attribute name.
2287 - *
2288 - * @return {*} Post attribute value.
2289 - */
2290 -
2291 -
2292 -function getEditedPostAttribute(state, attributeName) {
2293 - // Special cases
2294 - switch (attributeName) {
2295 - case 'content':
2296 - return getEditedPostContent(state);
2297 - } // Fall back to saved post value if not edited.
2298 -
2299 -
2300 - const edits = getPostEdits(state);
2301 -
2302 - if (!edits.hasOwnProperty(attributeName)) {
2303 - return getCurrentPostAttribute(state, attributeName);
2304 - } // Merge properties are objects which contain only the patch edit in state,
2305 - // and thus must be merged with the current post attribute.
2306 -
2307 -
2308 - if (EDIT_MERGE_PROPERTIES.has(attributeName)) {
2309 - return getNestedEditedPostProperty(state, attributeName);
2310 - }
2311 -
2312 - return edits[attributeName];
2313 -}
2314 -/**
2315 - * Returns an attribute value of the current autosave revision for a post, or
2316 - * null if there is no autosave for the post.
2317 - *
2318 - * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector
2319 - * from the '@wordpress/core-data' package and access properties on the returned
2320 - * autosave object using getPostRawValue.
2321 - *
2322 - * @param {Object} state Global application state.
2323 - * @param {string} attributeName Autosave attribute name.
2324 - *
2325 - * @return {*} Autosave attribute value.
2326 - */
2327 -
2328 -const getAutosaveAttribute = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, attributeName) => {
2329 - if (!(0,external_lodash_namespaceObject.includes)(AUTOSAVE_PROPERTIES, attributeName) && attributeName !== 'preview_link') {
2330 - return;
2331 - }
2332 -
2333 - const postType = getCurrentPostType(state);
2334 - const postId = getCurrentPostId(state);
2335 - const currentUserId = (0,external_lodash_namespaceObject.get)(select(external_wp_coreData_namespaceObject.store).getCurrentUser(), ['id']);
2336 - const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId);
2337 -
2338 - if (autosave) {
2339 - return getPostRawValue(autosave[attributeName]);
2340 - }
2341 -});
2342 -/**
2343 - * Returns the current visibility of the post being edited, preferring the
2344 - * unsaved value if different than the saved post. The return value is one of
2345 - * "private", "password", or "public".
2346 - *
2347 - * @param {Object} state Global application state.
2348 - *
2349 - * @return {string} Post visibility.
2350 - */
2351 -
2352 -function getEditedPostVisibility(state) {
2353 - const status = getEditedPostAttribute(state, 'status');
2354 -
2355 - if (status === 'private') {
2356 - return 'private';
2357 - }
2358 -
2359 - const password = getEditedPostAttribute(state, 'password');
2360 -
2361 - if (password) {
2362 - return 'password';
2363 - }
2364 -
2365 - return 'public';
2366 -}
2367 -/**
2368 - * Returns true if post is pending review.
2369 - *
2370 - * @param {Object} state Global application state.
2371 - *
2372 - * @return {boolean} Whether current post is pending review.
2373 - */
2374 -
2375 -function isCurrentPostPending(state) {
2376 - return getCurrentPost(state).status === 'pending';
2377 -}
2378 -/**
2379 - * Return true if the current post has already been published.
2380 - *
2381 - * @param {Object} state Global application state.
2382 - * @param {Object?} currentPost Explicit current post for bypassing registry selector.
2383 - *
2384 - * @return {boolean} Whether the post has been published.
2385 - */
2386 -
2387 -function isCurrentPostPublished(state, currentPost) {
2388 - const post = currentPost || getCurrentPost(state);
2389 - return ['publish', 'private'].indexOf(post.status) !== -1 || post.status === 'future' && !(0,external_wp_date_namespaceObject.isInTheFuture)(new Date(Number((0,external_wp_date_namespaceObject.getDate)(post.date)) - ONE_MINUTE_IN_MS));
2390 -}
2391 -/**
2392 - * Returns true if post is already scheduled.
2393 - *
2394 - * @param {Object} state Global application state.
2395 - *
2396 - * @return {boolean} Whether current post is scheduled to be posted.
2397 - */
2398 -
2399 -function isCurrentPostScheduled(state) {
2400 - return getCurrentPost(state).status === 'future' && !isCurrentPostPublished(state);
2401 -}
2402 -/**
2403 - * Return true if the post being edited can be published.
2404 - *
2405 - * @param {Object} state Global application state.
2406 - *
2407 - * @return {boolean} Whether the post can been published.
2408 - */
2409 -
2410 -function isEditedPostPublishable(state) {
2411 - const post = getCurrentPost(state); // TODO: Post being publishable should be superset of condition of post
2412 - // being saveable. Currently this restriction is imposed at UI.
2413 - //
2414 - // See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`)
2415 -
2416 - return isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1;
2417 -}
2418 -/**
2419 - * Returns true if the post can be saved, or false otherwise. A post must
2420 - * contain a title, an excerpt, or non-empty content to be valid for save.
2421 - *
2422 - * @param {Object} state Global application state.
2423 - *
2424 - * @return {boolean} Whether the post can be saved.
2425 - */
2426 -
2427 -function isEditedPostSaveable(state) {
2428 - if (isSavingPost(state)) {
2429 - return false;
2430 - } // TODO: Post should not be saveable if not dirty. Cannot be added here at
2431 - // this time since posts where meta boxes are present can be saved even if
2432 - // the post is not dirty. Currently this restriction is imposed at UI, but
2433 - // should be moved here.
2434 - //
2435 - // See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition)
2436 - // See: <PostSavedState /> (`forceIsDirty` prop)
2437 - // See: <PostPublishButton /> (`forceIsDirty` prop)
2438 - // See: https://github.com/WordPress/gutenberg/pull/4184
2439 -
2440 -
2441 - return !!getEditedPostAttribute(state, 'title') || !!getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state) || external_wp_element_namespaceObject.Platform.OS === 'native';
2442 -}
2443 -/**
2444 - * Returns true if the edited post has content. A post has content if it has at
2445 - * least one saveable block or otherwise has a non-empty content property
2446 - * assigned.
2447 - *
2448 - * @param {Object} state Global application state.
2449 - *
2450 - * @return {boolean} Whether post has content.
2451 - */
2452 -
2453 -function isEditedPostEmpty(state) {
2454 - // While the condition of truthy content string is sufficient to determine
2455 - // emptiness, testing saveable blocks length is a trivial operation. Since
2456 - // this function can be called frequently, optimize for the fast case as a
2457 - // condition of the mere existence of blocks. Note that the value of edited
2458 - // content takes precedent over block content, and must fall through to the
2459 - // default logic.
2460 - const blocks = getEditorBlocks(state);
2461 -
2462 - if (blocks.length) {
2463 - // Pierce the abstraction of the serializer in knowing that blocks are
2464 - // joined with with newlines such that even if every individual block
2465 - // produces an empty save result, the serialized content is non-empty.
2466 - if (blocks.length > 1) {
2467 - return false;
2468 - } // There are two conditions under which the optimization cannot be
2469 - // assumed, and a fallthrough to getEditedPostContent must occur:
2470 - //
2471 - // 1. getBlocksForSerialization has special treatment in omitting a
2472 - // single unmodified default block.
2473 - // 2. Comment delimiters are omitted for a freeform or unregistered
2474 - // block in its serialization. The freeform block specifically may
2475 - // produce an empty string in its saved output.
2476 - //
2477 - // For all other content, the single block is assumed to make a post
2478 - // non-empty, if only by virtue of its own comment delimiters.
2479 -
2480 -
2481 - const blockName = blocks[0].name;
2482 -
2483 - if (blockName !== (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() && blockName !== (0,external_wp_blocks_namespaceObject.getFreeformContentHandlerName)()) {
2484 - return false;
2485 - }
2486 - }
2487 -
2488 - return !getEditedPostContent(state);
2489 -}
2490 -/**
2491 - * Returns true if the post can be autosaved, or false otherwise.
2492 - *
2493 - * @param {Object} state Global application state.
2494 - * @param {Object} autosave A raw autosave object from the REST API.
2495 - *
2496 - * @return {boolean} Whether the post can be autosaved.
2497 - */
2498 -
2499 -const isEditedPostAutosaveable = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2500 - // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving.
2501 - if (!isEditedPostSaveable(state)) {
2502 - return false;
2503 - } // A post is not autosavable when there is a post autosave lock.
2504 -
2505 -
2506 - if (isPostAutosavingLocked(state)) {
2507 - return false;
2508 - }
2509 -
2510 - const postType = getCurrentPostType(state);
2511 - const postId = getCurrentPostId(state);
2512 - const hasFetchedAutosave = select(external_wp_coreData_namespaceObject.store).hasFetchedAutosaves(postType, postId);
2513 - const currentUserId = (0,external_lodash_namespaceObject.get)(select(external_wp_coreData_namespaceObject.store).getCurrentUser(), ['id']); // Disable reason - this line causes the side-effect of fetching the autosave
2514 - // via a resolver, moving below the return would result in the autosave never
2515 - // being fetched.
2516 - // eslint-disable-next-line @wordpress/no-unused-vars-before-return
2517 -
2518 - const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId); // If any existing autosaves have not yet been fetched, this function is
2519 - // unable to determine if the post is autosaveable, so return false.
2520 -
2521 - if (!hasFetchedAutosave) {
2522 - return false;
2523 - } // If we don't already have an autosave, the post is autosaveable.
2524 -
2525 -
2526 - if (!autosave) {
2527 - return true;
2528 - } // To avoid an expensive content serialization, use the content dirtiness
2529 - // flag in place of content field comparison against the known autosave.
2530 - // This is not strictly accurate, and relies on a tolerance toward autosave
2531 - // request failures for unnecessary saves.
2532 -
2533 -
2534 - if (hasChangedContent(state)) {
2535 - return true;
2536 - } // If the title or excerpt has changed, the post is autosaveable.
2537 -
2538 -
2539 - return ['title', 'excerpt'].some(field => getPostRawValue(autosave[field]) !== getEditedPostAttribute(state, field));
2540 -});
2541 -/**
2542 - * Return true if the post being edited is being scheduled. Preferring the
2543 - * unsaved status values.
2544 - *
2545 - * @param {Object} state Global application state.
2546 - *
2547 - * @return {boolean} Whether the post has been published.
2548 - */
2549 -
2550 -function isEditedPostBeingScheduled(state) {
2551 - const date = getEditedPostAttribute(state, 'date'); // Offset the date by one minute (network latency)
2552 -
2553 - const checkedDate = new Date(Number((0,external_wp_date_namespaceObject.getDate)(date)) - ONE_MINUTE_IN_MS);
2554 - return (0,external_wp_date_namespaceObject.isInTheFuture)(checkedDate);
2555 -}
2556 -/**
2557 - * Returns whether the current post should be considered to have a "floating"
2558 - * date (i.e. that it would publish "Immediately" rather than at a set time).
2559 - *
2560 - * Unlike in the PHP backend, the REST API returns a full date string for posts
2561 - * where the 0000-00-00T00:00:00 placeholder is present in the database. To
2562 - * infer that a post is set to publish "Immediately" we check whether the date
2563 - * and modified date are the same.
2564 - *
2565 - * @param {Object} state Editor state.
2566 - *
2567 - * @return {boolean} Whether the edited post has a floating date value.
2568 - */
2569 -
2570 -function isEditedPostDateFloating(state) {
2571 - const date = getEditedPostAttribute(state, 'date');
2572 - const modified = getEditedPostAttribute(state, 'modified'); // This should be the status of the persisted post
2573 - // It shouldn't use the "edited" status otherwise it breaks the
2574 - // inferred post data floating status
2575 - // See https://github.com/WordPress/gutenberg/issues/28083
2576 -
2577 - const status = getCurrentPost(state).status;
2578 -
2579 - if (status === 'draft' || status === 'auto-draft' || status === 'pending') {
2580 - return date === modified || date === null;
2581 - }
2582 -
2583 - return false;
2584 -}
2585 -/**
2586 - * Returns true if the post is currently being saved, or false otherwise.
2587 - *
2588 - * @param {Object} state Global application state.
2589 - *
2590 - * @return {boolean} Whether post is being saved.
2591 - */
2592 -
2593 -const isSavingPost = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2594 - const postType = getCurrentPostType(state);
2595 - const postId = getCurrentPostId(state);
2596 - return select(external_wp_coreData_namespaceObject.store).isSavingEntityRecord('postType', postType, postId);
2597 -});
2598 -/**
2599 - * Returns true if non-post entities are currently being saved, or false otherwise.
2600 - *
2601 - * @param {Object} state Global application state.
2602 - *
2603 - * @return {boolean} Whether non-post entities are being saved.
2604 - */
2605 -
2606 -const isSavingNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2607 - const entitiesBeingSaved = select(external_wp_coreData_namespaceObject.store).__experimentalGetEntitiesBeingSaved();
2608 -
2609 - const {
2610 - type,
2611 - id
2612 - } = getCurrentPost(state);
2613 - return (0,external_lodash_namespaceObject.some)(entitiesBeingSaved, entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id);
2614 -});
2615 -/**
2616 - * Returns true if a previous post save was attempted successfully, or false
2617 - * otherwise.
2618 - *
2619 - * @param {Object} state Global application state.
2620 - *
2621 - * @return {boolean} Whether the post was saved successfully.
2622 - */
2623 -
2624 -const didPostSaveRequestSucceed = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2625 - const postType = getCurrentPostType(state);
2626 - const postId = getCurrentPostId(state);
2627 - return !select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId);
2628 -});
2629 -/**
2630 - * Returns true if a previous post save was attempted but failed, or false
2631 - * otherwise.
2632 - *
2633 - * @param {Object} state Global application state.
2634 - *
2635 - * @return {boolean} Whether the post save failed.
2636 - */
2637 -
2638 -const didPostSaveRequestFail = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2639 - const postType = getCurrentPostType(state);
2640 - const postId = getCurrentPostId(state);
2641 - return !!select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId);
2642 -});
2643 -/**
2644 - * Returns true if the post is autosaving, or false otherwise.
2645 - *
2646 - * @param {Object} state Global application state.
2647 - *
2648 - * @return {boolean} Whether the post is autosaving.
2649 - */
2650 -
2651 -function isAutosavingPost(state) {
2652 - if (!isSavingPost(state)) {
2653 - return false;
2654 - }
2655 -
2656 - return !!(0,external_lodash_namespaceObject.get)(state.saving, ['options', 'isAutosave']);
2657 -}
2658 -/**
2659 - * Returns true if the post is being previewed, or false otherwise.
2660 - *
2661 - * @param {Object} state Global application state.
2662 - *
2663 - * @return {boolean} Whether the post is being previewed.
2664 - */
2665 -
2666 -function isPreviewingPost(state) {
2667 - if (!isSavingPost(state)) {
2668 - return false;
2669 - }
2670 -
2671 - return !!(0,external_lodash_namespaceObject.get)(state.saving, ['options', 'isPreview']);
2672 -}
2673 -/**
2674 - * Returns the post preview link
2675 - *
2676 - * @param {Object} state Global application state.
2677 - *
2678 - * @return {string?} Preview Link.
2679 - */
2680 -
2681 -function getEditedPostPreviewLink(state) {
2682 - if (state.saving.pending || isSavingPost(state)) {
2683 - return;
2684 - }
2685 -
2686 - let previewLink = getAutosaveAttribute(state, 'preview_link'); // Fix for issue: https://github.com/WordPress/gutenberg/issues/33616
2687 - // If the post is draft, ignore the preview link from the autosave record,
2688 - // because the preview could be a stale autosave if the post was switched from
2689 - // published to draft.
2690 - // See: https://github.com/WordPress/gutenberg/pull/37952
2691 -
2692 - if (!previewLink || 'draft' === getCurrentPost(state).status) {
2693 - previewLink = getEditedPostAttribute(state, 'link');
2694 -
2695 - if (previewLink) {
2696 - previewLink = (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, {
2697 - preview: true
2698 - });
2699 - }
2700 - }
2701 -
2702 - const featuredImageId = getEditedPostAttribute(state, 'featured_media');
2703 -
2704 - if (previewLink && featuredImageId) {
2705 - return (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, {
2706 - _thumbnail_id: featuredImageId
2707 - });
2708 - }
2709 -
2710 - return previewLink;
2711 -}
2712 -/**
2713 - * Returns a suggested post format for the current post, inferred only if there
2714 - * is a single block within the post and it is of a type known to match a
2715 - * default post format. Returns null if the format cannot be determined.
2716 - *
2717 - * @param {Object} state Global application state.
2718 - *
2719 - * @return {?string} Suggested post format.
2720 - */
2721 -
2722 -function getSuggestedPostFormat(state) {
2723 - const blocks = getEditorBlocks(state);
2724 - if (blocks.length > 2) return null;
2725 - let name; // If there is only one block in the content of the post grab its name
2726 - // so we can derive a suitable post format from it.
2727 -
2728 - if (blocks.length === 1) {
2729 - name = blocks[0].name; // check for core/embed `video` and `audio` eligible suggestions
2730 -
2731 - if (name === 'core/embed') {
2732 - var _blocks$0$attributes;
2733 -
2734 - const provider = (_blocks$0$attributes = blocks[0].attributes) === null || _blocks$0$attributes === void 0 ? void 0 : _blocks$0$attributes.providerNameSlug;
2735 -
2736 - if (['youtube', 'vimeo'].includes(provider)) {
2737 - name = 'core/video';
2738 - } else if (['spotify', 'soundcloud'].includes(provider)) {
2739 - name = 'core/audio';
2740 - }
2741 - }
2742 - } // If there are two blocks in the content and the last one is a text blocks
2743 - // grab the name of the first one to also suggest a post format from it.
2744 -
2745 -
2746 - if (blocks.length === 2 && blocks[1].name === 'core/paragraph') {
2747 - name = blocks[0].name;
2748 - } // We only convert to default post formats in core.
2749 -
2750 -
2751 - switch (name) {
2752 - case 'core/image':
2753 - return 'image';
2754 -
2755 - case 'core/quote':
2756 - case 'core/pullquote':
2757 - return 'quote';
2758 -
2759 - case 'core/gallery':
2760 - return 'gallery';
2761 -
2762 - case 'core/video':
2763 - return 'video';
2764 -
2765 - case 'core/audio':
2766 - return 'audio';
2767 -
2768 - default:
2769 - return null;
2770 - }
2771 -}
2772 -/**
2773 - * Returns the content of the post being edited.
2774 - *
2775 - * @param {Object} state Global application state.
2776 - *
2777 - * @return {string} Post content.
2778 - */
2779 -
2780 -const getEditedPostContent = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
2781 - const postId = getCurrentPostId(state);
2782 - const postType = getCurrentPostType(state);
2783 - const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId);
2784 -
2785 - if (record) {
2786 - if (typeof record.content === 'function') {
2787 - return record.content(record);
2788 - } else if (record.blocks) {
2789 - return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks);
2790 - } else if (record.content) {
2791 - return record.content;
2792 - }
2793 - }
2794 -
2795 - return '';
2796 -});
2797 -/**
2798 - * Returns true if the post is being published, or false otherwise.
2799 - *
2800 - * @param {Object} state Global application state.
2801 - *
2802 - * @return {boolean} Whether post is being published.
2803 - */
2804 -
2805 -function isPublishingPost(state) {
2806 - return isSavingPost(state) && !isCurrentPostPublished(state) && getEditedPostAttribute(state, 'status') === 'publish';
2807 -}
2808 -/**
2809 - * Returns whether the permalink is editable or not.
2810 - *
2811 - * @param {Object} state Editor state.
2812 - *
2813 - * @return {boolean} Whether or not the permalink is editable.
2814 - */
2815 -
2816 -function isPermalinkEditable(state) {
2817 - const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template');
2818 - return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate);
2819 -}
2820 -/**
2821 - * Returns the permalink for the post.
2822 - *
2823 - * @param {Object} state Editor state.
2824 - *
2825 - * @return {?string} The permalink, or null if the post is not viewable.
2826 - */
2827 -
2828 -function getPermalink(state) {
2829 - const permalinkParts = getPermalinkParts(state);
2830 -
2831 - if (!permalinkParts) {
2832 - return null;
2833 - }
2834 -
2835 - const {
2836 - prefix,
2837 - postName,
2838 - suffix
2839 - } = permalinkParts;
2840 -
2841 - if (isPermalinkEditable(state)) {
2842 - return prefix + postName + suffix;
2843 - }
2844 -
2845 - return prefix;
2846 -}
2847 -/**
2848 - * Returns the slug for the post being edited, preferring a manually edited
2849 - * value if one exists, then a sanitized version of the current post title, and
2850 - * finally the post ID.
2851 - *
2852 - * @param {Object} state Editor state.
2853 - *
2854 - * @return {string} The current slug to be displayed in the editor
2855 - */
2856 -
2857 -function getEditedPostSlug(state) {
2858 - return getEditedPostAttribute(state, 'slug') || cleanForSlug(getEditedPostAttribute(state, 'title')) || getCurrentPostId(state);
2859 -}
2860 -/**
2861 - * Returns the permalink for a post, split into it's three parts: the prefix,
2862 - * the postName, and the suffix.
2863 - *
2864 - * @param {Object} state Editor state.
2865 - *
2866 - * @return {Object} An object containing the prefix, postName, and suffix for
2867 - * the permalink, or null if the post is not viewable.
2868 - */
2869 -
2870 -function getPermalinkParts(state) {
2871 - const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template');
2872 -
2873 - if (!permalinkTemplate) {
2874 - return null;
2875 - }
2876 -
2877 - const postName = getEditedPostAttribute(state, 'slug') || getEditedPostAttribute(state, 'generated_slug');
2878 - const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX);
2879 - return {
2880 - prefix,
2881 - postName,
2882 - suffix
2883 - };
2884 -}
2885 -/**
2886 - * Returns whether the post is locked.
2887 - *
2888 - * @param {Object} state Global application state.
2889 - *
2890 - * @return {boolean} Is locked.
2891 - */
2892 -
2893 -function isPostLocked(state) {
2894 - return state.postLock.isLocked;
2895 -}
2896 -/**
2897 - * Returns whether post saving is locked.
2898 - *
2899 - * @param {Object} state Global application state.
2900 - *
2901 - * @return {boolean} Is locked.
2902 - */
2903 -
2904 -function isPostSavingLocked(state) {
2905 - return Object.keys(state.postSavingLock).length > 0;
2906 -}
2907 -/**
2908 - * Returns whether post autosaving is locked.
2909 - *
2910 - * @param {Object} state Global application state.
2911 - *
2912 - * @return {boolean} Is locked.
2913 - */
2914 -
2915 -function isPostAutosavingLocked(state) {
2916 - return Object.keys(state.postAutosavingLock).length > 0;
2917 -}
2918 -/**
2919 - * Returns whether the edition of the post has been taken over.
2920 - *
2921 - * @param {Object} state Global application state.
2922 - *
2923 - * @return {boolean} Is post lock takeover.
2924 - */
2925 -
2926 -function isPostLockTakeover(state) {
2927 - return state.postLock.isTakeover;
2928 -}
2929 -/**
2930 - * Returns details about the post lock user.
2931 - *
2932 - * @param {Object} state Global application state.
2933 - *
2934 - * @return {Object} A user object.
2935 - */
2936 -
2937 -function getPostLockUser(state) {
2938 - return state.postLock.user;
2939 -}
2940 -/**
2941 - * Returns the active post lock.
2942 - *
2943 - * @param {Object} state Global application state.
2944 - *
2945 - * @return {Object} The lock object.
2946 - */
2947 -
2948 -function getActivePostLock(state) {
2949 - return state.postLock.activePostLock;
2950 -}
2951 -/**
2952 - * Returns whether or not the user has the unfiltered_html capability.
2953 - *
2954 - * @param {Object} state Editor state.
2955 - *
2956 - * @return {boolean} Whether the user can or can't post unfiltered HTML.
2957 - */
2958 -
2959 -function canUserUseUnfilteredHTML(state) {
2960 - return (0,external_lodash_namespaceObject.has)(getCurrentPost(state), ['_links', 'wp:action-unfiltered-html']);
2961 -}
2962 -/**
2963 - * Returns whether the pre-publish panel should be shown
2964 - * or skipped when the user clicks the "publish" button.
2965 - *
2966 - * @param {Object} state Global application state.
2967 - *
2968 - * @return {boolean} Whether the pre-publish panel should be shown or not.
2969 - */
2970 -
2971 -function isPublishSidebarEnabled(state) {
2972 - if (state.preferences.hasOwnProperty('isPublishSidebarEnabled')) {
2973 - return state.preferences.isPublishSidebarEnabled;
2974 - }
2975 -
2976 - return PREFERENCES_DEFAULTS.isPublishSidebarEnabled;
2977 -}
2978 -/**
2979 - * Return the current block list.
2980 - *
2981 - * @param {Object} state
2982 - * @return {Array} Block list.
2983 - */
2984 -
2985 -function getEditorBlocks(state) {
2986 - return getEditedPostAttribute(state, 'blocks') || EMPTY_ARRAY;
2987 -}
2988 -/**
2989 - * A block selection object.
2990 - *
2991 - * @typedef {Object} WPBlockSelection
2992 - *
2993 - * @property {string} clientId A block client ID.
2994 - * @property {string} attributeKey A block attribute key.
2995 - * @property {number} offset An attribute value offset, based on the rich
2996 - * text value. See `wp.richText.create`.
2997 - */
2998 -
2999 -/**
3000 - * Returns the current selection start.
3001 - *
3002 - * @param {Object} state
3003 - * @return {WPBlockSelection} The selection start.
3004 - *
3005 - * @deprecated since Gutenberg 10.0.0.
3006 - */
3007 -
3008 -function getEditorSelectionStart(state) {
3009 - var _getEditedPostAttribu;
3010 -
3011 - external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", {
3012 - since: '5.8',
3013 - alternative: "select('core/editor').getEditorSelection"
3014 - });
3015 - return (_getEditedPostAttribu = getEditedPostAttribute(state, 'selection')) === null || _getEditedPostAttribu === void 0 ? void 0 : _getEditedPostAttribu.selectionStart;
3016 -}
3017 -/**
3018 - * Returns the current selection end.
3019 - *
3020 - * @param {Object} state
3021 - * @return {WPBlockSelection} The selection end.
3022 - *
3023 - * @deprecated since Gutenberg 10.0.0.
3024 - */
3025 -
3026 -function getEditorSelectionEnd(state) {
3027 - var _getEditedPostAttribu2;
3028 -
3029 - external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", {
3030 - since: '5.8',
3031 - alternative: "select('core/editor').getEditorSelection"
3032 - });
3033 - return (_getEditedPostAttribu2 = getEditedPostAttribute(state, 'selection')) === null || _getEditedPostAttribu2 === void 0 ? void 0 : _getEditedPostAttribu2.selectionEnd;
3034 -}
3035 -/**
3036 - * Returns the current selection.
3037 - *
3038 - * @param {Object} state
3039 - * @return {WPBlockSelection} The selection end.
3040 - */
3041 -
3042 -function getEditorSelection(state) {
3043 - return getEditedPostAttribute(state, 'selection');
3044 -}
3045 -/**
3046 - * Is the editor ready
3047 - *
3048 - * @param {Object} state
3049 - * @return {boolean} is Ready.
3050 - */
3051 -
3052 -function __unstableIsEditorReady(state) {
3053 - return state.isReady;
3054 -}
3055 -/**
3056 - * Returns the post editor settings.
3057 - *
3058 - * @param {Object} state Editor state.
3059 - *
3060 - * @return {Object} The editor settings object.
3061 - */
3062 -
3063 -function getEditorSettings(state) {
3064 - return state.editorSettings;
3065 -}
1 +this.wp=this.wp||{},this.wp.editor=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=379)}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},10:function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r))e.push(o.apply(null,r));else if("object"===i)for(var c in r)n.call(r,c)&&r[c]&&e.push(c)}}return e.join(" ")}e.exports?e.exports=o:void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},103:function(e,t,n){e.exports=function(){"use strict";return function(e){var t={};return function e(t,n){var r;if(Array.isArray(n))for(r=0;r<n.length;r++)e(t,n[r]);else for(r in n)t[r]=(t[r]||[]).concat(n[r])}(t,e),function(e){return function(n){return function(r){var o,i,c=t[r.type],a=n(r);if(c)for(o=0;o<c.length;o++)(i=c[o](r,e))&&e.dispatch(i);return a}}}}}()},11:function(e,t){!function(){e.exports=this.wp.blocks}()},12:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(36);var o=n(29),i=n(37);function c(e,t){return Object(r.a)(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var c,a=e[Symbol.iterator]();!(r=(c=a.next()).done)&&(n.push(c.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return n}}(e,t)||Object(o.a)(e,t)||Object(i.a)()}},120:function(e,t,n){"use strict";var r=n(5),o=n(14),i=n(0);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}t.a=function(e){var t=e.icon,n=e.size,a=void 0===n?24:n,s=Object(o.a)(e,["icon","size"]);return Object(i.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){Object(r.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({width:a,height:a},s))}},121:function(e,t,n){"use strict";var r=n(0),o=n(7),i=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M9 18.6L3.5 13l1-1L9 16.4l9.5-9.9 1 1z"}));t.a=i},129:function(e,t,n){e.exports=n(362)},13:function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,"a",(function(){return r}))},130:function(e,t,n){"use strict";var r=n(131);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,c){if(c!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},131:function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},132:function(e,t,n){"use strict";var r=n(0),o=n(7),i=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M13 11.9l3.3-3.4-1.1-1-3.2 3.3-3.2-3.3-1.1 1 3.3 3.4-3.5 3.6 1 1L12 13l3.5 3.5 1-1z"}));t.a=i},133:function(e,t,n){"use strict";var r=n(0),o=n(7),i=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));t.a=i},14:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(41);function o(e,t){if(null==e)return{};var n,o,i=Object(r.a)(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(o=0;o<c.length;o++)n=c[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}},140:function(e,t){!function(){e.exports=this.wp.wordcount}()},147:function(e,t,n){"use strict";var r=n(0),o=n(7),i=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"}));t.a=i},15:function(e,t,n){"use strict";function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.d(t,"a",(function(){return r}))},16:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(27);var o=n(35),i=n(29);function c(e){return function(e){if(Array.isArray(e))return Object(r.a)(e)}(e)||Object(o.a)(e)||Object(i.a)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},17:function(e,t){!function(){e.exports=this.React}()},171:function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},c=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&(n[r[o]]=e[r[o]])}return n};t.__esModule=!0;var a=n(17),s=n(30),u=n(172),l=n(173),d=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={lineHeight:null},t.dispatchEvent=function(e){var n=document.createEvent("Event");n.initEvent(e,!0,!1),t.textarea.dispatchEvent(n)},t.updateLineHeight=function(){t.setState({lineHeight:l(t.textarea)})},t.onChange=function(e){var n=t.props.onChange;t.currentValue=e.currentTarget.value,n&&n(e)},t.saveDOMNodeRef=function(e){var n=t.props.innerRef;n&&n(e),t.textarea=e},t.getLocals=function(){var e=t,n=e.props,r=(n.onResize,n.maxRows),o=(n.onChange,n.style),a=(n.innerRef,c(n,["onResize","maxRows","onChange","style","innerRef"])),s=e.state.lineHeight,u=e.saveDOMNodeRef,l=r&&s?s*r:null;return i({},a,{saveDOMNodeRef:u,style:l?i({},o,{maxHeight:l}):o,onChange:t.onChange})},t}return o(t,e),t.prototype.componentDidMount=function(){var e=this,t=this.props,n=t.onResize;"number"==typeof t.maxRows&&this.updateLineHeight(),setTimeout((function(){return u(e.textarea)})),n&&this.textarea.addEventListener("autosize:resized",n)},t.prototype.componentWillUnmount=function(){var e=this.props.onResize;e&&this.textarea.removeEventListener("autosize:resized",e),this.dispatchEvent("autosize:destroy")},t.prototype.render=function(){var e=this.getLocals(),t=e.children,n=e.saveDOMNodeRef,r=c(e,["children","saveDOMNodeRef"]);return a.createElement("textarea",i({},r,{ref:n}),t)},t.prototype.componentDidUpdate=function(){this.props.value!==this.currentValue&&this.dispatchEvent("autosize:update")},t.defaultProps={rows:1},t.propTypes={rows:s.number,maxRows:s.number,onResize:s.func,innerRef:s.func},t}(a.Component);t.default=d},172:function(e,t,n){var r,o,i;o=[e,t],void 0===(i="function"==typeof(r=function(e,t){"use strict";var n,r,o="function"==typeof Map?new Map:(n=[],r=[],{has:function(e){return n.indexOf(e)>-1},get:function(e){return r[n.indexOf(e)]},set:function(e,t){-1===n.indexOf(e)&&(n.push(e),r.push(t))},delete:function(e){var t=n.indexOf(e);t>-1&&(n.splice(t,1),r.splice(t,1))}}),i=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){i=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function c(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!o.has(e)){var t,n=null,r=null,c=null,a=function(){e.clientWidth!==r&&d()},s=function(t){window.removeEventListener("resize",a,!1),e.removeEventListener("input",d,!1),e.removeEventListener("keyup",d,!1),e.removeEventListener("autosize:destroy",s,!1),e.removeEventListener("autosize:update",d,!1),Object.keys(t).forEach((function(n){e.style[n]=t[n]})),o.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",s,!1),"onpropertychange"in e&&"oninput"in e&&e.addEventListener("keyup",d,!1),window.addEventListener("resize",a,!1),e.addEventListener("input",d,!1),e.addEventListener("autosize:update",d,!1),e.style.overflowX="hidden",e.style.wordWrap="break-word",o.set(e,{destroy:s,update:d}),"vertical"===(t=window.getComputedStyle(e,null)).resize?e.style.resize="none":"both"===t.resize&&(e.style.resize="horizontal"),n="content-box"===t.boxSizing?-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),isNaN(n)&&(n=0),d()}function u(t){var n=e.style.width;e.style.width="0px",e.offsetWidth,e.style.width=n,e.style.overflowY=t}function l(){if(0!==e.scrollHeight){var t=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}(e),o=document.documentElement&&document.documentElement.scrollTop;e.style.height="",e.style.height=e.scrollHeight+n+"px",r=e.clientWidth,t.forEach((function(e){e.node.scrollTop=e.scrollTop})),o&&(document.documentElement.scrollTop=o)}}function d(){l();var t=Math.round(parseFloat(e.style.height)),n=window.getComputedStyle(e,null),r="content-box"===n.boxSizing?Math.round(parseFloat(n.height)):e.offsetHeight;if(r<t?"hidden"===n.overflowY&&(u("scroll"),l(),r="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight):"hidden"!==n.overflowY&&(u("hidden"),l(),r="content-box"===n.boxSizing?Math.round(parseFloat(window.getComputedStyle(e,null).height)):e.offsetHeight),c!==r){c=r;var o=i("autosize:resized");try{e.dispatchEvent(o)}catch(e){}}}}function a(e){var t=o.get(e);t&&t.destroy()}function s(e){var t=o.get(e);t&&t.update()}var u=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((u=function(e){return e}).destroy=function(e){return e},u.update=function(e){return e}):((u=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],(function(e){return c(e)})),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],a),e},u.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],s),e}),t.default=u,e.exports=t.default})?r.apply(t,o):r)||(e.exports=i)},173:function(e,t,n){var r=n(174);e.exports=function(e){var t=r(e,"line-height"),n=parseFloat(t,10);if(t===n+""){var o=e.style.lineHeight;e.style.lineHeight=t+"em",t=r(e,"line-height"),n=parseFloat(t,10),o?e.style.lineHeight=o:delete e.style.lineHeight}if(-1!==t.indexOf("pt")?(n*=4,n/=3):-1!==t.indexOf("mm")?(n*=96,n/=25.4):-1!==t.indexOf("cm")?(n*=96,n/=2.54):-1!==t.indexOf("in")?n*=96:-1!==t.indexOf("pc")&&(n*=16),n=Math.round(n),"normal"===t){var i=e.nodeName,c=document.createElement(i);c.innerHTML="&nbsp;","TEXTAREA"===i.toUpperCase()&&c.setAttribute("rows","1");var a=r(e,"font-size");c.style.fontSize=a,c.style.padding="0px",c.style.border="0px";var s=document.body;s.appendChild(c),n=c.offsetHeight,s.removeChild(c)}return n}},174:function(e,t){e.exports=function(e,t,n){return((n=window.getComputedStyle)?n(e):e.currentStyle)[t.replace(/-(\w)/gi,(function(e,t){return t.toUpperCase()}))]}},18:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}n.d(t,"a",(function(){return o}))},19:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,"a",(function(){return r}))},2:function(e,t){!function(){e.exports=this.lodash}()},20:function(e,t){!function(){e.exports=this.wp.keycodes}()},21:function(e,t,n){"use strict";function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}n.d(t,"a",(function(){return o}))},22:function(e,t){!function(){e.exports=this.regeneratorRuntime}()},23:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(40),o=n(13);function i(e,t){return!t||"object"!==Object(r.a)(t)&&"function"!=typeof t?Object(o.a)(e):t}},233:function(e,t,n){"use strict";var r=n(0),o=n(7),i=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"}));t.a=i},234:function(e,t,n){"use strict";var r=n(0),o=n(7),i=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"}));t.a=i},25:function(e,t){!function(){e.exports=this.wp.richText}()},27:function(e,t,n){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}n.d(t,"a",(function(){return r}))},274:function(e,t,n){"use strict";var r=n(0),o=n(7),i=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(r.createElement)(o.Path,{d:"M2 2h5v11H2V2zm6 0h5v5H8V2zm6 0h4v16h-4V2zM8 8h5v5H8V8zm-6 6h11v4H2v-4z"}));t.a=i},277:function(e,t,n){"use strict";var r=n(0),o=n(7),i=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(r.createElement)(o.Path,{d:"M9 9V3H3v6h6zm8 0V3h-6v6h6zm-8 8v-6H3v6h6zm8 0v-6h-6v6h6z"}));t.a=i},28:function(e,t){!function(){e.exports=this.wp.url}()},29:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(27);function o(e,t){if(e){if("string"==typeof e)return Object(r.a)(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Object(r.a)(e,t):void 0}}},3:function(e,t){!function(){e.exports=this.wp.components}()},30:function(e,t,n){e.exports=n(130)()},32:function(e,t){!function(){e.exports=this.wp.hooks}()},34:function(e,t){!function(){e.exports=this.wp.dataControls}()},35:function(e,t,n){"use strict";function r(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}n.d(t,"a",(function(){return r}))},36:function(e,t,n){"use strict";function r(e){if(Array.isArray(e))return e}n.d(t,"a",(function(){return r}))},362:function(e,t,n){"use strict";var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};var o=[];function i(e,t){return e.optimist&&e.optimist.id===t}function c(e,t){if(!e||"object"!=typeof e||Array.isArray(e))throw new TypeError('Error while handling "'+t.type+'": Optimist requires that state is always a plain object.')}function a(e){if(e){var t=e.optimist;return{optimist:void 0===t?o:t,innerState:function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["optimist"])}}return{optimist:o,innerState:e}}e.exports=function(e){function t(t,n,o){return t.length&&(t=t.concat([{action:o}])),c(n=e(n,o),o),r({optimist:t},n)}return function(n,o){if(o.optimist)switch(o.optimist.type){case"BEGIN":return function(t,n){var o=a(t),i=o.optimist,s=o.innerState;return i=i.concat([{beforeState:s,action:n}]),c(s=e(s,n),n),r({optimist:i},s)}(n,o);case"COMMIT":return function(e,n){var r=a(e),o=r.optimist,c=r.innerState,s=[],u=!1,l=!1;return o.forEach((function(e){u?e.beforeState&&i(e.action,n.optimist.id)?(l=!0,s.push({action:e.action})):s.push(e):e.beforeState&&!i(e.action,n.optimist.id)?(u=!0,s.push(e)):e.beforeState&&i(e.action,n.optimist.id)&&(l=!0)})),l||console.error('Cannot commit transaction with id "'+n.optimist.id+'" because it does not exist'),t(o=s,c,n)}(n,o);case"REVERT":return function(n,r){var o=a(n),s=o.optimist,u=o.innerState,l=[],d=!1,p=!1,b=u;return s.forEach((function(t){t.beforeState&&i(t.action,r.optimist.id)&&(b=t.beforeState,p=!0),i(t.action,r.optimist.id)||(t.beforeState&&(d=!0),d&&(p&&t.beforeState?l.push({beforeState:b,action:t.action}):l.push(t)),p&&(b=e(b,t.action),c(u,r)))})),p||console.error('Cannot revert transaction with id "'+r.optimist.id+'" because it does not exist'),t(s=l,b,r)}(n,o)}var s=a(n),u=s.optimist,l=s.innerState;if(n&&!u.length){var d=e(l,o);return d===l?n:(c(d,o),r({optimist:u},d))}return t(u,l,o)}},e.exports.BEGIN="BEGIN",e.exports.COMMIT="COMMIT",e.exports.REVERT="REVERT"},37:function(e,t,n){"use strict";function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}n.d(t,"a",(function(){return r}))},379:function(e,t,n){"use strict";n.r(t),n.d(t,"userAutocompleter",(function(){return oo})),n.d(t,"AutosaveMonitor",(function(){return bo})),n.d(t,"DocumentOutline",(function(){return Eo})),n.d(t,"DocumentOutlineCheck",(function(){return So})),n.d(t,"VisualEditorGlobalKeyboardShortcuts",(function(){return Co})),n.d(t,"EditorGlobalKeyboardShortcuts",(function(){return To})),n.d(t,"TextEditorGlobalKeyboardShortcuts",(function(){return xo})),n.d(t,"EditorKeyboardShortcutsRegister",(function(){return Bo})),n.d(t,"EditorHistoryRedo",(function(){return Do})),n.d(t,"EditorHistoryUndo",(function(){return No})),n.d(t,"EditorNotices",(function(){return Fo})),n.d(t,"EntitiesSavedStates",(function(){return Xo})),n.d(t,"ErrorBoundary",(function(){return ei})),n.d(t,"LocalAutosaveMonitor",(function(){return oi})),n.d(t,"PageAttributesCheck",(function(){return ii})),n.d(t,"PageAttributesOrder",(function(){return si})),n.d(t,"PageAttributesParent",(function(){return fi})),n.d(t,"PageTemplate",(function(){return hi})),n.d(t,"PostAuthor",(function(){return ji})),n.d(t,"PostAuthorCheck",(function(){return vi})),n.d(t,"PostComments",(function(){return yi})),n.d(t,"PostExcerpt",(function(){return _i})),n.d(t,"PostExcerptCheck",(function(){return ki})),n.d(t,"PostFeaturedImage",(function(){return Ri})),n.d(t,"PostFeaturedImageCheck",(function(){return Si})),n.d(t,"PostFormat",(function(){return Di})),n.d(t,"PostFormatCheck",(function(){return Ii})),n.d(t,"PostLastRevision",(function(){return Ui})),n.d(t,"PostLastRevisionCheck",(function(){return Ni})),n.d(t,"PostLockedModal",(function(){return Wi})),n.d(t,"PostPendingStatus",(function(){return Ki})),n.d(t,"PostPendingStatusCheck",(function(){return Gi})),n.d(t,"PostPingbacks",(function(){return qi})),n.d(t,"PostPreviewButton",(function(){return Vi})),n.d(t,"PostPublishButton",(function(){return Xi})),n.d(t,"PostPublishButtonLabel",(function(){return $i})),n.d(t,"PostPublishPanel",(function(){return Cc})),n.d(t,"PostSavedState",(function(){return Lc})),n.d(t,"PostSchedule",(function(){return oc})),n.d(t,"PostScheduleCheck",(function(){return Nc})),n.d(t,"PostScheduleLabel",(function(){return ic})),n.d(t,"PostSlug",(function(){return Vc})),n.d(t,"PostSlugCheck",(function(){return Uc})),n.d(t,"PostSticky",(function(){return Hc})),n.d(t,"PostStickyCheck",(function(){return zc})),n.d(t,"PostSwitchToDraftButton",(function(){return Ic})),n.d(t,"PostTaxonomies",(function(){return Yc})),n.d(t,"PostTaxonomiesCheck",(function(){return Xc})),n.d(t,"PostTextEditor",(function(){return na})),n.d(t,"PostTitle",(function(){return sa})),n.d(t,"PostTrash",(function(){return ua})),n.d(t,"PostTrashCheck",(function(){return la})),n.d(t,"PostTypeSupportCheck",(function(){return ci})),n.d(t,"PostVisibility",(function(){return nc})),n.d(t,"PostVisibilityLabel",(function(){return rc})),n.d(t,"PostVisibilityCheck",(function(){return da})),n.d(t,"TableOfContents",(function(){return ma})),n.d(t,"UnsavedChangesWarning",(function(){return ga})),n.d(t,"WordCount",(function(){return fa})),n.d(t,"EditorProvider",(function(){return Aa})),n.d(t,"ServerSideRender",(function(){return La.a})),n.d(t,"RichText",(function(){return Fa})),n.d(t,"Autocomplete",(function(){return Ma})),n.d(t,"AlignmentToolbar",(function(){return Va})),n.d(t,"BlockAlignmentToolbar",(function(){return za})),n.d(t,"BlockControls",(function(){return Ha})),n.d(t,"BlockEdit",(function(){return Wa})),n.d(t,"BlockEditorKeyboardShortcuts",(function(){return Ga})),n.d(t,"BlockFormatControls",(function(){return Ka})),n.d(t,"BlockIcon",(function(){return qa})),n.d(t,"BlockInspector",(function(){return $a})),n.d(t,"BlockList",(function(){return Qa})),n.d(t,"BlockMover",(function(){return Ya})),n.d(t,"BlockNavigationDropdown",(function(){return Xa})),n.d(t,"BlockSelectionClearer",(function(){return Ja})),n.d(t,"BlockSettingsMenu",(function(){return Za})),n.d(t,"BlockTitle",(function(){return es})),n.d(t,"BlockToolbar",(function(){return ts})),n.d(t,"ColorPalette",(function(){return ns})),n.d(t,"ContrastChecker",(function(){return rs})),n.d(t,"CopyHandler",(function(){return os})),n.d(t,"DefaultBlockAppender",(function(){return is})),n.d(t,"FontSizePicker",(function(){return cs})),n.d(t,"Inserter",(function(){return as})),n.d(t,"InnerBlocks",(function(){return ss})),n.d(t,"InspectorAdvancedControls",(function(){return us})),n.d(t,"InspectorControls",(function(){return ls})),n.d(t,"PanelColorSettings",(function(){return ds})),n.d(t,"PlainText",(function(){return ps})),n.d(t,"RichTextShortcut",(function(){return bs})),n.d(t,"RichTextToolbarButton",(function(){return fs})),n.d(t,"__unstableRichTextInputEvent",(function(){return hs})),n.d(t,"MediaPlaceholder",(function(){return ms})),n.d(t,"MediaUpload",(function(){return vs})),n.d(t,"MediaUploadCheck",(function(){return Os})),n.d(t,"MultiSelectScrollIntoView",(function(){return gs})),n.d(t,"NavigableToolbar",(function(){return js})),n.d(t,"ObserveTyping",(function(){return ys})),n.d(t,"PreserveScrollInReorder",(function(){return _s})),n.d(t,"SkipToSelectedBlock",(function(){return ks})),n.d(t,"URLInput",(function(){return Es})),n.d(t,"URLInputButton",(function(){return Ss})),n.d(t,"URLPopover",(function(){return Ps})),n.d(t,"Warning",(function(){return ws})),n.d(t,"WritingFlow",(function(){return Cs})),n.d(t,"createCustomColorsHOC",(function(){return Ts})),n.d(t,"getColorClassName",(function(){return xs})),n.d(t,"getColorObjectByAttributeValues",(function(){return Bs})),n.d(t,"getColorObjectByColorValue",(function(){return Rs})),n.d(t,"getFontSize",(function(){return Is})),n.d(t,"getFontSizeClass",(function(){return As})),n.d(t,"withColorContext",(function(){return Ds})),n.d(t,"withColors",(function(){return Ls})),n.d(t,"withFontSizes",(function(){return Ns})),n.d(t,"mediaUpload",(function(){return Ea})),n.d(t,"cleanForSlug",(function(){return kt})),n.d(t,"storeConfig",(function(){return $r})),n.d(t,"transformStyles",(function(){return i.transformStyles}));var r={};n.r(r),n.d(r,"setupEditor",(function(){return ce})),n.d(r,"__experimentalTearDownEditor",(function(){return ae})),n.d(r,"resetPost",(function(){return se})),n.d(r,"resetAutosave",(function(){return ue})),n.d(r,"__experimentalRequestPostUpdateStart",(function(){return le})),n.d(r,"__experimentalRequestPostUpdateFinish",(function(){return de})),n.d(r,"updatePost",(function(){return pe})),n.d(r,"setupEditorState",(function(){return be})),n.d(r,"editPost",(function(){return fe})),n.d(r,"__experimentalOptimisticUpdatePost",(function(){return he})),n.d(r,"savePost",(function(){return me})),n.d(r,"refreshPost",(function(){return ve})),n.d(r,"trashPost",(function(){return Oe})),n.d(r,"autosave",(function(){return ge})),n.d(r,"__experimentalLocalAutosave",(function(){return je})),n.d(r,"redo",(function(){return ye})),n.d(r,"undo",(function(){return _e})),n.d(r,"createUndoLevel",(function(){return ke})),n.d(r,"updatePostLock",(function(){return Ee})),n.d(r,"__experimentalFetchReusableBlocks",(function(){return Se})),n.d(r,"__experimentalReceiveReusableBlocks",(function(){return Pe})),n.d(r,"__experimentalSaveReusableBlock",(function(){return we})),n.d(r,"__experimentalDeleteReusableBlock",(function(){return Ce})),n.d(r,"__experimentalUpdateReusableBlock",(function(){return Te})),n.d(r,"__experimentalConvertBlockToStatic",(function(){return xe})),n.d(r,"__experimentalConvertBlockToReusable",(function(){return Be})),n.d(r,"enablePublishSidebar",(function(){return Re})),n.d(r,"disablePublishSidebar",(function(){return Ie})),n.d(r,"lockPostSaving",(function(){return Ae})),n.d(r,"unlockPostSaving",(function(){return De})),n.d(r,"lockPostAutosaving",(function(){return Le})),n.d(r,"unlockPostAutosaving",(function(){return Ne})),n.d(r,"resetEditorBlocks",(function(){return Ue})),n.d(r,"updateEditorSettings",(function(){return Fe})),n.d(r,"resetBlocks",(function(){return Ve})),n.d(r,"receiveBlocks",(function(){return ze})),n.d(r,"updateBlock",(function(){return He})),n.d(r,"updateBlockAttributes",(function(){return We})),n.d(r,"selectBlock",(function(){return Ge})),n.d(r,"startMultiSelect",(function(){return Ke})),n.d(r,"stopMultiSelect",(function(){return qe})),n.d(r,"multiSelect",(function(){return $e})),n.d(r,"clearSelectedBlock",(function(){return Qe})),n.d(r,"toggleSelection",(function(){return Ye})),n.d(r,"replaceBlocks",(function(){return Xe})),n.d(r,"replaceBlock",(function(){return Je})),n.d(r,"moveBlocksDown",(function(){return Ze})),n.d(r,"moveBlocksUp",(function(){return et})),n.d(r,"moveBlockToPosition",(function(){return tt})),n.d(r,"insertBlock",(function(){return nt})),n.d(r,"insertBlocks",(function(){return rt})),n.d(r,"showInsertionPoint",(function(){return ot})),n.d(r,"hideInsertionPoint",(function(){return it})),n.d(r,"setTemplateValidity",(function(){return ct})),n.d(r,"synchronizeTemplate",(function(){return at})),n.d(r,"mergeBlocks",(function(){return st})),n.d(r,"removeBlocks",(function(){return ut})),n.d(r,"removeBlock",(function(){return lt})),n.d(r,"toggleBlockMode",(function(){return dt})),n.d(r,"startTyping",(function(){return pt})),n.d(r,"stopTyping",(function(){return bt})),n.d(r,"enterFormattedText",(function(){return ft})),n.d(r,"exitFormattedText",(function(){return ht})),n.d(r,"insertDefaultBlock",(function(){return mt})),n.d(r,"updateBlockListSettings",(function(){return vt}));var o={};n.r(o),n.d(o,"hasEditorUndo",(function(){return Ct})),n.d(o,"hasEditorRedo",(function(){return Tt})),n.d(o,"isEditedPostNew",(function(){return xt})),n.d(o,"hasChangedContent",(function(){return Bt})),n.d(o,"isEditedPostDirty",(function(){return Rt})),n.d(o,"hasNonPostEntityChanges",(function(){return It})),n.d(o,"isCleanNewPost",(function(){return At})),n.d(o,"getCurrentPost",(function(){return Dt})),n.d(o,"getCurrentPostType",(function(){return Lt})),n.d(o,"getCurrentPostId",(function(){return Nt})),n.d(o,"getCurrentPostRevisionsCount",(function(){return Ut})),n.d(o,"getCurrentPostLastRevisionId",(function(){return Ft})),n.d(o,"getPostEdits",(function(){return Mt})),n.d(o,"getReferenceByDistinctEdits",(function(){return Vt})),n.d(o,"getCurrentPostAttribute",(function(){return zt})),n.d(o,"getEditedPostAttribute",(function(){return Ht})),n.d(o,"getAutosaveAttribute",(function(){return Wt})),n.d(o,"getEditedPostVisibility",(function(){return Gt})),n.d(o,"isCurrentPostPending",(function(){return Kt})),n.d(o,"isCurrentPostPublished",(function(){return qt})),n.d(o,"isCurrentPostScheduled",(function(){return $t})),n.d(o,"isEditedPostPublishable",(function(){return Qt})),n.d(o,"isEditedPostSaveable",(function(){return Yt})),n.d(o,"isEditedPostEmpty",(function(){return Xt})),n.d(o,"isEditedPostAutosaveable",(function(){return Jt})),n.d(o,"getAutosave",(function(){return Zt})),n.d(o,"hasAutosave",(function(){return en})),n.d(o,"isEditedPostBeingScheduled",(function(){return tn})),n.d(o,"isEditedPostDateFloating",(function(){return nn})),n.d(o,"isSavingPost",(function(){return rn})),n.d(o,"didPostSaveRequestSucceed",(function(){return on})),n.d(o,"didPostSaveRequestFail",(function(){return cn})),n.d(o,"isAutosavingPost",(function(){return an})),n.d(o,"isPreviewingPost",(function(){return sn})),n.d(o,"getEditedPostPreviewLink",(function(){return un})),n.d(o,"getSuggestedPostFormat",(function(){return ln})),n.d(o,"getBlocksForSerialization",(function(){return dn})),n.d(o,"getEditedPostContent",(function(){return pn})),n.d(o,"__experimentalGetReusableBlock",(function(){return bn})),n.d(o,"__experimentalIsSavingReusableBlock",(function(){return fn})),n.d(o,"__experimentalIsFetchingReusableBlock",(function(){return hn})),n.d(o,"__experimentalGetReusableBlocks",(function(){return mn})),n.d(o,"getStateBeforeOptimisticTransaction",(function(){return vn})),n.d(o,"isPublishingPost",(function(){return On})),n.d(o,"isPermalinkEditable",(function(){return gn})),n.d(o,"getPermalink",(function(){return jn})),n.d(o,"getEditedPostSlug",(function(){return yn})),n.d(o,"getPermalinkParts",(function(){return _n})),n.d(o,"inSomeHistory",(function(){return kn})),n.d(o,"isPostLocked",(function(){return En})),n.d(o,"isPostSavingLocked",(function(){return Sn})),n.d(o,"isPostAutosavingLocked",(function(){return Pn})),n.d(o,"isPostLockTakeover",(function(){return wn})),n.d(o,"getPostLockUser",(function(){return Cn})),n.d(o,"getActivePostLock",(function(){return Tn})),n.d(o,"canUserUseUnfilteredHTML",(function(){return xn})),n.d(o,"isPublishSidebarEnabled",(function(){return Bn})),n.d(o,"getEditorBlocks",(function(){return Rn})),n.d(o,"getEditorSelectionStart",(function(){return In})),n.d(o,"getEditorSelectionEnd",(function(){return An})),n.d(o,"__unstableIsEditorReady",(function(){return Dn})),n.d(o,"getEditorSettings",(function(){return Ln})),n.d(o,"getBlockName",(function(){return Un})),n.d(o,"isBlockValid",(function(){return Fn})),n.d(o,"getBlockAttributes",(function(){return Mn})),n.d(o,"getBlock",(function(){return Vn})),n.d(o,"getBlocks",(function(){return zn})),n.d(o,"__unstableGetBlockWithoutInnerBlocks",(function(){return Hn})),n.d(o,"getClientIdsOfDescendants",(function(){return Wn})),n.d(o,"getClientIdsWithDescendants",(function(){return Gn})),n.d(o,"getGlobalBlockCount",(function(){return Kn})),n.d(o,"getBlocksByClientId",(function(){return qn})),n.d(o,"getBlockCount",(function(){return $n})),n.d(o,"getBlockSelectionStart",(function(){return Qn})),n.d(o,"getBlockSelectionEnd",(function(){return Yn})),n.d(o,"getSelectedBlockCount",(function(){return Xn})),n.d(o,"hasSelectedBlock",(function(){return Jn})),n.d(o,"getSelectedBlockClientId",(function(){return Zn})),n.d(o,"getSelectedBlock",(function(){return er})),n.d(o,"getBlockRootClientId",(function(){return tr})),n.d(o,"getBlockHierarchyRootClientId",(function(){return nr})),n.d(o,"getAdjacentBlockClientId",(function(){return rr})),n.d(o,"getPreviousBlockClientId",(function(){return or})),n.d(o,"getNextBlockClientId",(function(){return ir})),n.d(o,"getSelectedBlocksInitialCaretPosition",(function(){return cr})),n.d(o,"getMultiSelectedBlockClientIds",(function(){return ar})),n.d(o,"getMultiSelectedBlocks",(function(){return sr})),n.d(o,"getFirstMultiSelectedBlockClientId",(function(){return ur})),n.d(o,"getLastMultiSelectedBlockClientId",(function(){return lr})),n.d(o,"isFirstMultiSelectedBlock",(function(){return dr})),n.d(o,"isBlockMultiSelected",(function(){return pr})),n.d(o,"isAncestorMultiSelected",(function(){return br})),n.d(o,"getMultiSelectedBlocksStartClientId",(function(){return fr})),n.d(o,"getMultiSelectedBlocksEndClientId",(function(){return hr})),n.d(o,"getBlockOrder",(function(){return mr})),n.d(o,"getBlockIndex",(function(){return vr})),n.d(o,"isBlockSelected",(function(){return Or})),n.d(o,"hasSelectedInnerBlock",(function(){return gr})),n.d(o,"isBlockWithinSelection",(function(){return jr})),n.d(o,"hasMultiSelection",(function(){return yr})),n.d(o,"isMultiSelecting",(function(){return _r})),n.d(o,"isSelectionEnabled",(function(){return kr})),n.d(o,"getBlockMode",(function(){return Er})),n.d(o,"isTyping",(function(){return Sr})),n.d(o,"isCaretWithinFormattedText",(function(){return Pr})),n.d(o,"getBlockInsertionPoint",(function(){return wr})),n.d(o,"isBlockInsertionPointVisible",(function(){return Cr})),n.d(o,"isValidTemplate",(function(){return Tr})),n.d(o,"getTemplate",(function(){return xr})),n.d(o,"getTemplateLock",(function(){return Br})),n.d(o,"canInsertBlockType",(function(){return Rr})),n.d(o,"getInserterItems",(function(){return Ir})),n.d(o,"hasInserterItems",(function(){return Ar})),n.d(o,"getBlockListSettings",(function(){return Dr}));var i=n(6),c=n(11),a=n(47),s=n(48),u=(n(69),n(25)),l=n(77),d=n(5),p=n(4),b=n(34),f=n(40),h=n(129),m=n.n(h),v=n(2);function O(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var g={insertUsage:{},isPublishSidebarEnabled:!0},j=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){Object(d.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},i.SETTINGS_DEFAULTS,{richEditingEnabled:!0,codeEditingEnabled:!0,enableCustomFields:!1});function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){Object(d.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function k(e){return e&&"object"===Object(f.a)(e)&&"raw"in e?e.raw:e}var E=Object(p.combineReducers)({data:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"RECEIVE_REUSABLE_BLOCKS":return _({},e,{},Object(v.keyBy)(t.results,"id"));case"UPDATE_REUSABLE_BLOCK":var n=t.id,r=t.changes;return _({},e,Object(d.a)({},n,_({},e[n],{},r)));case"SAVE_REUSABLE_BLOCK_SUCCESS":var o=t.id,i=t.updatedId;if(o===i)return e;var c=e[o];return _({},Object(v.omit)(e,o),Object(d.a)({},i,_({},c,{id:i})));case"REMOVE_REUSABLE_BLOCK":var a=t.id;return Object(v.omit)(e,a)}return e},isFetching:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"FETCH_REUSABLE_BLOCKS":var n=t.id;return n?_({},e,Object(d.a)({},n,!0)):e;case"FETCH_REUSABLE_BLOCKS_SUCCESS":case"FETCH_REUSABLE_BLOCKS_FAILURE":var r=t.id;return Object(v.omit)(e,r)}return e},isSaving:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SAVE_REUSABLE_BLOCK":return _({},e,Object(d.a)({},t.id,!0));case"SAVE_REUSABLE_BLOCK_SUCCESS":case"SAVE_REUSABLE_BLOCK_FAILURE":var n=t.id;return Object(v.omit)(e,n)}return e}});var S=m()(Object(p.combineReducers)({postId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SETUP_EDITOR_STATE":case"RESET_POST":case"UPDATE_POST":return t.post.id}return e},postType:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SETUP_EDITOR_STATE":case"RESET_POST":case"UPDATE_POST":return t.post.type}return e},preferences:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ENABLE_PUBLISH_SIDEBAR":return _({},e,{isPublishSidebarEnabled:!0});case"DISABLE_PUBLISH_SIDEBAR":return _({},e,{isPublishSidebarEnabled:!1})}return e},saving:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"REQUEST_POST_UPDATE_START":case"REQUEST_POST_UPDATE_FINISH":return{pending:"REQUEST_POST_UPDATE_START"===t.type,options:t.options||{}}}return e},postLock:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{isLocked:!1},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"UPDATE_POST_LOCK":return t.lock}return e},reusableBlocks:E,template:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{isValid:!0},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_TEMPLATE_VALIDITY":return _({},e,{isValid:t.isValid})}return e},postSavingLock:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"LOCK_POST_SAVING":return _({},e,Object(d.a)({},t.lockName,!0));case"UNLOCK_POST_SAVING":return Object(v.omit)(e,t.lockName)}return e},isReady:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SETUP_EDITOR_STATE":return!0;case"TEAR_DOWN_EDITOR":return!1}return e},editorSettings:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:j,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"UPDATE_EDITOR_SETTINGS":return _({},e,{},t.settings)}return e},postAutosavingLock:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"LOCK_POST_AUTOSAVING":return _({},e,Object(d.a)({},t.lockName,!0));case"UNLOCK_POST_AUTOSAVING":return Object(v.omit)(e,t.lockName)}return e}})),P=n(103),w=n.n(P),C=n(22),T=n.n(C),x=n(43),B=n(38),R=n.n(B),I=n(1),A=n(16),D=n(42),L=n.n(D),N=new Set(["meta"]),U="core/editor",F=/%(?:postname|pagename)%/,M=["title","excerpt","content"];function V(e){var t=e.previousPost,n=e.post,r=e.postType;if(Object(v.get)(e.options,["isAutosave"]))return[];var o,i=["publish","private","future"],c=Object(v.includes)(i,t.status),a=Object(v.includes)(i,n.status),s=Object(v.get)(r,["viewable"],!1);if(c||a?c&&!a?(o=r.labels.item_reverted_to_draft,s=!1):o=!c&&a?{publish:r.labels.item_published,private:r.labels.item_published_privately,future:r.labels.item_scheduled}[n.status]:r.labels.item_updated:o=null,o){var u=[];return s&&u.push({label:r.labels.view_item,url:n.link}),[o,{id:"SAVE_POST_NOTICE_ID",type:"snackbar",actions:u}]}return[]}function z(e){var t=e.post,n=e.edits,r=e.error;if(r&&"rest_autosave_no_changes"===r.code)return[];var o=["publish","private","future"],i=-1!==o.indexOf(t.status),c={publish:Object(I.__)("Publishing failed."),private:Object(I.__)("Publishing failed."),future:Object(I.__)("Scheduling failed.")},a=i||-1===o.indexOf(n.status)?Object(I.__)("Updating failed."):c[n.status];return r.message&&!/<\/?[^>]*>/.test(r.message)&&(a=[a,r.message].join(" ")),[a,{id:"SAVE_POST_NOTICE_ID"}]}var H=n(52),W=n.n(H),G=n(95),K=W()((function(e){1===e.length&&Object(c.isUnmodifiedDefaultBlock)(e[0])&&(e=[]);var t=Object(c.serialize)(e);return 1===e.length&&e[0].name===Object(c.getFreeformContentHandlerName)()&&(t=Object(G.removep)(t)),t}),{maxSize:1});function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function $(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach((function(t){Object(d.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Q=T.a.mark(ce),Y=T.a.mark(ue),X=T.a.mark(fe),J=T.a.mark(me),Z=T.a.mark(ve),ee=T.a.mark(Oe),te=T.a.mark(ge),ne=T.a.mark(je),re=T.a.mark(ye),oe=T.a.mark(_e),ie=T.a.mark(Ue);function ce(e,t,n){var r,o;return T.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return r=Object(v.has)(t,["content"])?t.content:e.content.raw,o=Object(c.parse)(r),"auto-draft"===e.status&&n&&(o=Object(c.synchronizeBlocksWithTemplate)(o,n)),i.next=6,se(e);case 6:return i.next=8,{type:"SETUP_EDITOR",post:e,edits:t,template:n};case 8:return i.next=10,Ue(o,{__unstableShouldCreateUndoLevel:!1});case 10:return i.next=12,be(e);case 12:if(!t||!Object.keys(t).some((function(n){return t[n]!==(Object(v.has)(e,[n,"raw"])?e[n].raw:e[n])}))){i.next=15;break}return i.next=15,fe(t);case 15:case"end":return i.stop()}}),Q)}function ae(){return{type:"TEAR_DOWN_EDITOR"}}function se(e){return{type:"RESET_POST",post:e}}function ue(e){var t;return T.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return L()("resetAutosave action (`core/editor` store)",{alternative:"receiveAutosaves action (`core` store)",plugin:"Gutenberg"}),n.next=3,Object(b.select)(U,"getCurrentPostId");case 3:return t=n.sent,n.next=6,Object(b.dispatch)("core","receiveAutosaves",t,e);case 6:return n.abrupt("return",{type:"__INERT__"});case 7:case"end":return n.stop()}}),Y)}function le(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:"REQUEST_POST_UPDATE_START",options:e}}function de(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:"REQUEST_POST_UPDATE_FINISH",options:e}}function pe(e){return{type:"UPDATE_POST",edits:e}}function be(e){return{type:"SETUP_EDITOR_STATE",post:e}}function fe(e,t){var n,r,o;return T.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,Object(b.select)(U,"getCurrentPost");case 2:return n=i.sent,r=n.id,o=n.type,i.next=7,Object(b.dispatch)("core","editEntityRecord","postType",o,r,e,t);case 7:case"end":return i.stop()}}),X)}function he(e){return $({},pe(e),{optimist:{id:"post-update"}})}function me(){var e,t,n,r,o,i,c,a=arguments;return T.a.wrap((function(s){for(;;)switch(s.prev=s.next){case 0:return e=a.length>0&&void 0!==a[0]?a[0]:{},s.next=3,Object(b.select)(U,"isEditedPostSaveable");case 3:if(s.sent){s.next=5;break}return s.abrupt("return");case 5:return s.next=7,Object(b.select)(U,"getEditedPostContent");case 7:if(s.t0=s.sent,t={content:s.t0},e.isAutosave){s.next=12;break}return s.next=12,Object(b.dispatch)(U,"editPost",t,{undoIgnore:!0});case 12:return s.next=14,le(e);case 14:return s.next=16,Object(b.select)(U,"getCurrentPost");case 16:return n=s.sent,s.t1=$,s.t2={id:n.id},s.next=21,Object(b.select)("core","getEntityRecordNonTransientEdits","postType",n.type,n.id);case 21:return s.t3=s.sent,s.t4={},s.t5=t,t=(0,s.t1)(s.t2,s.t3,s.t4,s.t5),s.next=27,Object(b.dispatch)("core","saveEntityRecord","postType",n.type,t,e);case 27:return s.next=29,de(e);case 29:return s.next=31,Object(b.select)("core","getLastEntitySaveError","postType",n.type,n.id);case 31:if(!(r=s.sent)){s.next=39;break}if(!(o=z({post:n,edits:t,error:r})).length){s.next=37;break}return s.next=37,b.dispatch.apply(void 0,["core/notices","createErrorNotice"].concat(Object(A.a)(o)));case 37:s.next=57;break;case 39:return s.next=41,Object(b.select)(U,"getCurrentPost");case 41:return i=s.sent,s.t6=V,s.t7=n,s.t8=i,s.next=47,Object(b.select)("core","getPostType",i.type);case 47:if(s.t9=s.sent,s.t10=e,s.t11={previousPost:s.t7,post:s.t8,postType:s.t9,options:s.t10},!(c=(0,s.t6)(s.t11)).length){s.next=54;break}return s.next=54,b.dispatch.apply(void 0,["core/notices","createSuccessNotice"].concat(Object(A.a)(c)));case 54:if(e.isAutosave){s.next=57;break}return s.next=57,Object(b.dispatch)("core/block-editor","__unstableMarkLastChangeAsPersistent");case 57:case"end":return s.stop()}}),J)}function ve(){var e,t,n,r;return T.a.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,Object(b.select)(U,"getCurrentPost");case 2:return e=o.sent,o.next=5,Object(b.select)(U,"getCurrentPostType");case 5:return t=o.sent,o.next=8,Object(b.select)("core","getPostType",t);case 8:return n=o.sent,o.next=11,Object(b.apiFetch)({path:"/wp/v2/".concat(n.rest_base,"/").concat(e.id)+"?context=edit&_timestamp=".concat(Date.now())});case 11:return r=o.sent,o.next=14,Object(b.dispatch)(U,"resetPost",r);case 14:case"end":return o.stop()}}),Z)}function Oe(){var e,t,n;return T.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Object(b.select)(U,"getCurrentPostType");case 2:return e=r.sent,r.next=5,Object(b.select)("core","getPostType",e);case 5:return t=r.sent,r.next=8,Object(b.dispatch)("core/notices","removeNotice","TRASH_POST_NOTICE_ID");case 8:return r.prev=8,r.next=11,Object(b.select)(U,"getCurrentPost");case 11:return n=r.sent,r.next=14,Object(b.apiFetch)({path:"/wp/v2/".concat(t.rest_base,"/").concat(n.id),method:"DELETE"});case 14:return r.next=16,Object(b.dispatch)(U,"savePost");case 16:r.next=22;break;case 18:return r.prev=18,r.t0=r.catch(8),r.next=22,b.dispatch.apply(void 0,["core/notices","createErrorNotice"].concat(Object(A.a)([(o={error:r.t0}).error.message&&"unknown_error"!==o.error.code?o.error.message:Object(I.__)("Trashing failed"),{id:"TRASH_POST_NOTICE_ID"}])));case 22:case"end":return r.stop()}var o}),ee,null,[[8,18]])}function ge(e){return T.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(b.dispatch)(U,"savePost",$({isAutosave:!0},e));case 2:case"end":return t.stop()}}),te)}function je(){var e,t,n,r;return T.a.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,Object(b.select)(U,"getCurrentPost");case 2:return e=o.sent,o.next=5,Object(b.select)(U,"getEditedPostAttribute","title");case 5:return t=o.sent,o.next=8,Object(b.select)(U,"getEditedPostAttribute","content");case 8:return n=o.sent,o.next=11,Object(b.select)(U,"getEditedPostAttribute","excerpt");case 11:return r=o.sent,o.next=14,{type:"LOCAL_AUTOSAVE_SET",postId:e.id,title:t,content:n,excerpt:r};case 14:case"end":return o.stop()}}),ne)}function ye(){return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(b.dispatch)("core","redo");case 2:case"end":return e.stop()}}),re)}function _e(){return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(b.dispatch)("core","undo");case 2:case"end":return e.stop()}}),oe)}function ke(){return{type:"CREATE_UNDO_LEVEL"}}function Ee(e){return{type:"UPDATE_POST_LOCK",lock:e}}function Se(e){return{type:"FETCH_REUSABLE_BLOCKS",id:e}}function Pe(e){return{type:"RECEIVE_REUSABLE_BLOCKS",results:e}}function we(e){return{type:"SAVE_REUSABLE_BLOCK",id:e}}function Ce(e){return{type:"DELETE_REUSABLE_BLOCK",id:e}}function Te(e,t){return{type:"UPDATE_REUSABLE_BLOCK",id:e,changes:t}}function xe(e){return{type:"CONVERT_BLOCK_TO_STATIC",clientId:e}}function Be(e){return{type:"CONVERT_BLOCK_TO_REUSABLE",clientIds:Object(v.castArray)(e)}}function Re(){return{type:"ENABLE_PUBLISH_SIDEBAR"}}function Ie(){return{type:"DISABLE_PUBLISH_SIDEBAR"}}function Ae(e){return{type:"LOCK_POST_SAVING",lockName:e}}function De(e){return{type:"UNLOCK_POST_SAVING",lockName:e}}function Le(e){return{type:"LOCK_POST_AUTOSAVING",lockName:e}}function Ne(e){return{type:"UNLOCK_POST_AUTOSAVING",lockName:e}}function Ue(e){var t,n,r,o,i,c,a,s,u=arguments;return T.a.wrap((function(l){for(;;)switch(l.prev=l.next){case 0:if(t=u.length>1&&void 0!==u[1]?u[1]:{},n=t.__unstableShouldCreateUndoLevel,r=t.selectionStart,o=t.selectionEnd,i={blocks:e,selectionStart:r,selectionEnd:o},!1===n){l.next=19;break}return l.next=6,Object(b.select)(U,"getCurrentPost");case 6:return c=l.sent,a=c.id,s=c.type,l.next=11,Object(b.__unstableSyncSelect)("core","getEditedEntityRecord","postType",s,a);case 11:if(l.t0=l.sent.blocks,l.t1=i.blocks,!(l.t0===l.t1)){l.next=18;break}return l.next=17,Object(b.dispatch)("core","__unstableCreateUndoLevel","postType",s,a);case 17:return l.abrupt("return",l.sent);case 18:i.content=function(e){var t=e.blocks;return K(void 0===t?[]:t)};case 19:return l.delegateYield(fe(i),"t2",20);case 20:case"end":return l.stop()}}),ie)}function Fe(e){return{type:"UPDATE_EDITOR_SETTINGS",settings:e}}var Me=function(e){return T.a.mark((function t(){var n,r,o,i=arguments;return T.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(L()("`wp.data.dispatch( 'core/editor' )."+e+"`",{alternative:"`wp.data.dispatch( 'core/block-editor' )."+e+"`"}),n=i.length,r=new Array(n),o=0;o<n;o++)r[o]=i[o];return t.next=4,b.dispatch.apply(void 0,["core/block-editor",e].concat(r));case 4:case"end":return t.stop()}}),t)}))},Ve=Me("resetBlocks"),ze=Me("receiveBlocks"),He=Me("updateBlock"),We=Me("updateBlockAttributes"),Ge=Me("selectBlock"),Ke=Me("startMultiSelect"),qe=Me("stopMultiSelect"),$e=Me("multiSelect"),Qe=Me("clearSelectedBlock"),Ye=Me("toggleSelection"),Xe=Me("replaceBlocks"),Je=Me("replaceBlock"),Ze=Me("moveBlocksDown"),et=Me("moveBlocksUp"),tt=Me("moveBlockToPosition"),nt=Me("insertBlock"),rt=Me("insertBlocks"),ot=Me("showInsertionPoint"),it=Me("hideInsertionPoint"),ct=Me("setTemplateValidity"),at=Me("synchronizeTemplate"),st=Me("mergeBlocks"),ut=Me("removeBlocks"),lt=Me("removeBlock"),dt=Me("toggleBlockMode"),pt=Me("startTyping"),bt=Me("stopTyping"),ft=Me("enterFormattedText"),ht=Me("exitFormattedText"),mt=Me("insertDefaultBlock"),vt=Me("updateBlockListSettings"),Ot=n(12),gt=n(44),jt=n(61),yt=n(28);function _t(e,t){return Object(yt.addQueryArgs)(e,t)}function kt(e){return e?Object(v.trim)(Object(v.deburr)(e).replace(/[\s\./]+/g,"-").replace(/[^\w-]+/g,"").toLowerCase(),"-"):""}function Et(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function St(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Et(Object(n),!0).forEach((function(t){Object(d.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Et(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Pt={},wt=[],Ct=Object(p.createRegistrySelector)((function(e){return function(){return e("core").hasUndo()}})),Tt=Object(p.createRegistrySelector)((function(e){return function(){return e("core").hasRedo()}}));function xt(e){return"auto-draft"===Dt(e).status}function Bt(e){var t=Mt(e);return"blocks"in t||"content"in t}var Rt=Object(p.createRegistrySelector)((function(e){return function(t){var n=Lt(t),r=Nt(t);return!!e("core").hasEditsForEntityRecord("postType",n,r)}})),It=Object(p.createRegistrySelector)((function(e){return function(t){if(!Ln(t).__experimentalEnableFullSiteEditing)return!1;var n=e("core").__experimentalGetDirtyEntityRecords(),r=Dt(t),o=r.type,i=r.id;return Object(v.some)(n,(function(e){return"postType"!==e.kind||e.name!==o||e.key!==i}))}}));function At(e){return!Rt(e)&&xt(e)}var Dt=Object(p.createRegistrySelector)((function(e){return function(t){var n=Nt(t),r=Lt(t),o=e("core").getRawEntityRecord("postType",r,n);return o||Pt}}));function Lt(e){return e.postType}function Nt(e){return e.postId}function Ut(e){return Object(v.get)(Dt(e),["_links","version-history",0,"count"],0)}function Ft(e){return Object(v.get)(Dt(e),["_links","predecessor-version",0,"id"],null)}var Mt=Object(p.createRegistrySelector)((function(e){return function(t){var n=Lt(t),r=Nt(t);return e("core").getEntityRecordEdits("postType",n,r)||Pt}})),Vt=Object(p.createRegistrySelector)((function(e){return function(){return L()("`wp.data.select( 'core/editor' ).getReferenceByDistinctEdits`",{alternative:"`wp.data.select( 'core' ).getReferenceByDistinctEdits`"}),e("core").getReferenceByDistinctEdits()}}));function zt(e,t){switch(t){case"type":return Lt(e);case"id":return Nt(e);default:var n=Dt(e);if(!n.hasOwnProperty(t))break;return k(n[t])}}function Ht(e,t){switch(t){case"content":return pn(e)}var n=Mt(e);return n.hasOwnProperty(t)?N.has(t)?function(e,t){var n=Mt(e);return n.hasOwnProperty(t)?St({},zt(e,t),{},n[t]):zt(e,t)}(e,t):n[t]:zt(e,t)}var Wt=Object(p.createRegistrySelector)((function(e){return function(t,n){if(Object(v.includes)(M,n)||"preview_link"===n){var r=Lt(t),o=Nt(t),i=Object(v.get)(e("core").getCurrentUser(),["id"]),c=e("core").getAutosave(r,o,i);return c?k(c[n]):void 0}}}));function Gt(e){return"private"===Ht(e,"status")?"private":Ht(e,"password")?"password":"public"}function Kt(e){return"pending"===Dt(e).status}function qt(e,t){var n=t||Dt(e);return-1!==["publish","private"].indexOf(n.status)||"future"===n.status&&!Object(jt.isInTheFuture)(new Date(Number(Object(jt.getDate)(n.date))-6e4))}function $t(e){return"future"===Dt(e).status&&!qt(e)}function Qt(e){var t=Dt(e);return Rt(e)||-1===["publish","private","future"].indexOf(t.status)}function Yt(e){return!rn(e)&&(!!Ht(e,"title")||!!Ht(e,"excerpt")||!Xt(e))}function Xt(e){var t=Rn(e);if(t.length){if(t.length>1)return!1;var n=t[0].name;if(n!==Object(c.getDefaultBlockName)()&&n!==Object(c.getFreeformContentHandlerName)())return!1}return!pn(e)}var Jt=Object(p.createRegistrySelector)((function(e){return function(t){if(!Yt(t))return!1;if(Pn(t))return!1;var n=Lt(t),r=Nt(t),o=e("core").hasFetchedAutosaves(n,r),i=Object(v.get)(e("core").getCurrentUser(),["id"]),c=e("core").getAutosave(n,r,i);return!!o&&(!c||(!!Bt(t)||["title","excerpt"].some((function(e){return k(c[e])!==Ht(t,e)}))))}})),Zt=Object(p.createRegistrySelector)((function(e){return function(t){L()("`wp.data.select( 'core/editor' ).getAutosave()`",{alternative:"`wp.data.select( 'core' ).getAutosave( postType, postId, userId )`",plugin:"Gutenberg"});var n=Lt(t),r=Nt(t),o=Object(v.get)(e("core").getCurrentUser(),["id"]),i=e("core").getAutosave(n,r,o);return Object(v.mapValues)(Object(v.pick)(i,M),k)}})),en=Object(p.createRegistrySelector)((function(e){return function(t){L()("`wp.data.select( 'core/editor' ).hasAutosave()`",{alternative:"`!! wp.data.select( 'core' ).getAutosave( postType, postId, userId )`",plugin:"Gutenberg"});var n=Lt(t),r=Nt(t),o=Object(v.get)(e("core").getCurrentUser(),["id"]);return!!e("core").getAutosave(n,r,o)}}));function tn(e){var t=Ht(e,"date"),n=new Date(Number(Object(jt.getDate)(t))-6e4);return Object(jt.isInTheFuture)(n)}function nn(e){var t=Ht(e,"date"),n=Ht(e,"modified"),r=Ht(e,"status");return("draft"===r||"auto-draft"===r||"pending"===r)&&(t===n||null===t)}var rn=Object(p.createRegistrySelector)((function(e){return function(t){var n=Lt(t),r=Nt(t);return e("core").isSavingEntityRecord("postType",n,r)}})),on=Object(p.createRegistrySelector)((function(e){return function(t){var n=Lt(t),r=Nt(t);return!e("core").getLastEntitySaveError("postType",n,r)}})),cn=Object(p.createRegistrySelector)((function(e){return function(t){var n=Lt(t),r=Nt(t);return!!e("core").getLastEntitySaveError("postType",n,r)}}));function an(e){return!!rn(e)&&!!Object(v.get)(e.saving,["options","isAutosave"])}function sn(e){return!!rn(e)&&!!e.saving.options.isPreview}function un(e){if(!e.saving.pending&&!rn(e)){var t=Wt(e,"preview_link");t||(t=Ht(e,"link"))&&(t=Object(yt.addQueryArgs)(t,{preview:!0}));var n=Ht(e,"featured_media");return t&&n?Object(yt.addQueryArgs)(t,{_thumbnail_id:n}):t}}function ln(e){var t,n=Rn(e);switch(1===n.length&&(t=n[0].name),2===n.length&&"core/paragraph"===n[1].name&&(t=n[0].name),t){case"core/image":return"image";case"core/quote":case"core/pullquote":return"quote";case"core/gallery":return"gallery";case"core/video":case"core-embed/youtube":case"core-embed/vimeo":return"video";case"core/audio":case"core-embed/spotify":case"core-embed/soundcloud":return"audio"}return null}function dn(e){L()("`core/editor` getBlocksForSerialization selector",{plugin:"Gutenberg",alternative:"getEditorBlocks",hint:"Blocks serialization pre-processing occurs at save time"});var t=e.editor.present.blocks.value;return 1===t.length&&Object(c.isUnmodifiedDefaultBlock)(t[0])?[]:t}var pn=Object(p.createRegistrySelector)((function(e){return function(t){var n=Nt(t),r=Lt(t),o=e("core").getEditedEntityRecord("postType",r,n);if(o){if("function"==typeof o.content)return o.content(o);if(o.blocks)return K(o.blocks);if(o.content)return o.content}return""}})),bn=Object(gt.a)((function(e,t){var n=e.reusableBlocks.data[t];if(!n)return null;var r=isNaN(parseInt(t));return St({},n,{id:r?t:+t,isTemporary:r})}),(function(e,t){return[e.reusableBlocks.data[t]]}));function fn(e,t){return e.reusableBlocks.isSaving[t]||!1}function hn(e,t){return!!e.reusableBlocks.isFetching[t]}var mn=Object(gt.a)((function(e){return Object(v.map)(e.reusableBlocks.data,(function(t,n){return bn(e,n)}))}),(function(e){return[e.reusableBlocks.data]}));function vn(e,t){var n=Object(v.find)(e.optimist,(function(e){return e.beforeState&&Object(v.get)(e.action,["optimist","id"])===t}));return n?n.beforeState:null}function On(e){if(!rn(e))return!1;if(!qt(e))return!1;var t=vn(e,"post-update");return!!t&&!qt(null,t.currentPost)}function gn(e){var t=Ht(e,"permalink_template");return F.test(t)}function jn(e){var t=_n(e);if(!t)return null;var n=t.prefix,r=t.postName,o=t.suffix;return gn(e)?n+r+o:n}function yn(e){return Ht(e,"slug")||kt(Ht(e,"title"))||Nt(e)}function _n(e){var t=Ht(e,"permalink_template");if(!t)return null;var n=Ht(e,"slug")||Ht(e,"generated_slug"),r=t.split(F),o=Object(Ot.a)(r,2);return{prefix:o[0],postName:n,suffix:o[1]}}function kn(e,t){var n=e.optimist;return!!n&&n.some((function(e){var n=e.beforeState;return n&&t(n)}))}function En(e){return e.postLock.isLocked}function Sn(e){return Object.keys(e.postSavingLock).length>0}function Pn(e){return Object.keys(e.postAutosavingLock).length>0}function wn(e){return e.postLock.isTakeover}function Cn(e){return e.postLock.user}function Tn(e){return e.postLock.activePostLock}function xn(e){return Object(v.has)(Dt(e),["_links","wp:action-unfiltered-html"])}function Bn(e){return e.preferences.hasOwnProperty("isPublishSidebarEnabled")?e.preferences.isPublishSidebarEnabled:g.isPublishSidebarEnabled}function Rn(e){return Ht(e,"blocks")||wt}function In(e){return Ht(e,"selectionStart")}function An(e){return Ht(e,"selectionEnd")}function Dn(e){return e.isReady}function Ln(e){return e.editorSettings}function Nn(e){return Object(p.createRegistrySelector)((function(t){return function(n){var r;L()("`wp.data.select( 'core/editor' )."+e+"`",{alternative:"`wp.data.select( 'core/block-editor' )."+e+"`"});for(var o=arguments.length,i=new Array(o>1?o-1:0),c=1;c<o;c++)i[c-1]=arguments[c];return(r=t("core/block-editor"))[e].apply(r,i)}}))}var Un=Nn("getBlockName"),Fn=Nn("isBlockValid"),Mn=Nn("getBlockAttributes"),Vn=Nn("getBlock"),zn=Nn("getBlocks"),Hn=Nn("__unstableGetBlockWithoutInnerBlocks"),Wn=Nn("getClientIdsOfDescendants"),Gn=Nn("getClientIdsWithDescendants"),Kn=Nn("getGlobalBlockCount"),qn=Nn("getBlocksByClientId"),$n=Nn("getBlockCount"),Qn=Nn("getBlockSelectionStart"),Yn=Nn("getBlockSelectionEnd"),Xn=Nn("getSelectedBlockCount"),Jn=Nn("hasSelectedBlock"),Zn=Nn("getSelectedBlockClientId"),er=Nn("getSelectedBlock"),tr=Nn("getBlockRootClientId"),nr=Nn("getBlockHierarchyRootClientId"),rr=Nn("getAdjacentBlockClientId"),or=Nn("getPreviousBlockClientId"),ir=Nn("getNextBlockClientId"),cr=Nn("getSelectedBlocksInitialCaretPosition"),ar=Nn("getMultiSelectedBlockClientIds"),sr=Nn("getMultiSelectedBlocks"),ur=Nn("getFirstMultiSelectedBlockClientId"),lr=Nn("getLastMultiSelectedBlockClientId"),dr=Nn("isFirstMultiSelectedBlock"),pr=Nn("isBlockMultiSelected"),br=Nn("isAncestorMultiSelected"),fr=Nn("getMultiSelectedBlocksStartClientId"),hr=Nn("getMultiSelectedBlocksEndClientId"),mr=Nn("getBlockOrder"),vr=Nn("getBlockIndex"),Or=Nn("isBlockSelected"),gr=Nn("hasSelectedInnerBlock"),jr=Nn("isBlockWithinSelection"),yr=Nn("hasMultiSelection"),_r=Nn("isMultiSelecting"),kr=Nn("isSelectionEnabled"),Er=Nn("getBlockMode"),Sr=Nn("isTyping"),Pr=Nn("isCaretWithinFormattedText"),wr=Nn("getBlockInsertionPoint"),Cr=Nn("isBlockInsertionPointVisible"),Tr=Nn("isValidTemplate"),xr=Nn("getTemplate"),Br=Nn("getTemplateLock"),Rr=Nn("canInsertBlockType"),Ir=Nn("getInserterItems"),Ar=Nn("hasInserterItems"),Dr=Nn("getBlockListSettings");function Lr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Nr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Lr(Object(n),!0).forEach((function(t){Object(d.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ur=function(){var e=Object(x.a)(T.a.mark((function e(t,n){var r,o,i,c,a;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.id,o=n.dispatch,e.next=4,R()({path:"/wp/v2/types/wp_block"});case 4:if(i=e.sent){e.next=7;break}return e.abrupt("return");case 7:if(e.prev=7,!r){e.next=15;break}return e.next=11,R()({path:"/wp/v2/".concat(i.rest_base,"/").concat(r)});case 11:e.t0=e.sent,c=[e.t0],e.next=18;break;case 15:return e.next=17,R()({path:"/wp/v2/".concat(i.rest_base,"?per_page=-1")});case 17:c=e.sent;case 18:(a=Object(v.compact)(Object(v.map)(c,(function(e){return"publish"!==e.status||e.content.protected?null:Nr({},e,{content:e.content.raw,title:e.title.raw})})))).length&&o(Pe(a)),o({type:"FETCH_REUSABLE_BLOCKS_SUCCESS",id:r}),e.next=26;break;case 23:e.prev=23,e.t1=e.catch(7),o({type:"FETCH_REUSABLE_BLOCKS_FAILURE",id:r,error:e.t1});case 26:case"end":return e.stop()}}),e,null,[[7,23]])})));return function(t,n){return e.apply(this,arguments)}}(),Fr=function(){var e=Object(x.a)(T.a.mark((function e(t,n){var r,o,i,c,a,s,u,l,d,b,f,h,m;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,R()({path:"/wp/v2/types/wp_block"});case 2:if(r=e.sent){e.next=5;break}return e.abrupt("return");case 5:return o=t.id,i=n.dispatch,c=n.getState(),a=bn(c,o),s=a.title,u=a.content,l=a.isTemporary,d=l?{title:s,content:u,status:"publish"}:{id:o,title:s,content:u,status:"publish"},b=l?"/wp/v2/".concat(r.rest_base):"/wp/v2/".concat(r.rest_base,"/").concat(o),f=l?"POST":"PUT",e.prev=12,e.next=15,R()({path:b,data:d,method:f});case 15:h=e.sent,i({type:"SAVE_REUSABLE_BLOCK_SUCCESS",updatedId:h.id,id:o}),m=l?Object(I.__)("Block created."):Object(I.__)("Block updated."),Object(p.dispatch)("core/notices").createSuccessNotice(m,{id:"REUSABLE_BLOCK_NOTICE_ID",type:"snackbar"}),Object(p.dispatch)("core/block-editor").__unstableSaveReusableBlock(o,h.id),e.next=26;break;case 22:e.prev=22,e.t0=e.catch(12),i({type:"SAVE_REUSABLE_BLOCK_FAILURE",id:o}),Object(p.dispatch)("core/notices").createErrorNotice(e.t0.message,{id:"REUSABLE_BLOCK_NOTICE_ID"});case 26:case"end":return e.stop()}}),e,null,[[12,22]])})));return function(t,n){return e.apply(this,arguments)}}(),Mr=function(){var e=Object(x.a)(T.a.mark((function e(t,n){var r,o,i,a,s,u,l,d,b,f;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,R()({path:"/wp/v2/types/wp_block"});case 2:if(r=e.sent){e.next=5;break}return e.abrupt("return");case 5:if(o=t.id,i=n.getState,a=n.dispatch,(s=bn(i(),o))&&!s.isTemporary){e.next=10;break}return e.abrupt("return");case 10:return u=Object(p.select)("core/block-editor").getBlocks(),l=u.filter((function(e){return Object(c.isReusableBlock)(e)&&e.attributes.ref===o})),d=l.map((function(e){return e.clientId})),b=Object(v.uniqueId)(),a({type:"REMOVE_REUSABLE_BLOCK",id:o,optimist:{type:h.BEGIN,id:b}}),d.length&&Object(p.dispatch)("core/block-editor").removeBlocks(d),e.prev=16,e.next=19,R()({path:"/wp/v2/".concat(r.rest_base,"/").concat(o),method:"DELETE"});case 19:a({type:"DELETE_REUSABLE_BLOCK_SUCCESS",id:o,optimist:{type:h.COMMIT,id:b}}),f=Object(I.__)("Block deleted."),Object(p.dispatch)("core/notices").createSuccessNotice(f,{id:"REUSABLE_BLOCK_NOTICE_ID",type:"snackbar"}),e.next=28;break;case 24:e.prev=24,e.t0=e.catch(16),a({type:"DELETE_REUSABLE_BLOCK_FAILURE",id:o,optimist:{type:h.REVERT,id:b}}),Object(p.dispatch)("core/notices").createErrorNotice(e.t0.message,{id:"REUSABLE_BLOCK_NOTICE_ID"});case 28:case"end":return e.stop()}}),e,null,[[16,24]])})));return function(t,n){return e.apply(this,arguments)}}(),Vr={FETCH_REUSABLE_BLOCKS:function(e,t){Ur(e,t)},SAVE_REUSABLE_BLOCK:function(e,t){Fr(e,t)},DELETE_REUSABLE_BLOCK:function(e,t){Mr(e,t)},CONVERT_BLOCK_TO_STATIC:function(e,t){var n=t.getState(),r=Object(p.select)("core/block-editor").getBlock(e.clientId),o=bn(n,r.attributes.ref),i=Object(c.parse)(o.content);Object(p.dispatch)("core/block-editor").replaceBlocks(r.clientId,i)},CONVERT_BLOCK_TO_REUSABLE:function(e,t){var n=t.dispatch,r={id:Object(v.uniqueId)("reusable"),title:Object(I.__)("Untitled Reusable Block"),content:Object(c.serialize)(Object(p.select)("core/block-editor").getBlocksByClientId(e.clientIds))};n(Pe([r])),n(we(r.id)),Object(p.dispatch)("core/block-editor").replaceBlocks(e.clientIds,Object(c.createBlock)("core/block",{ref:r.id}))}};var zr=function(e){var t=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},n={getState:e.getState,dispatch:function(){return t.apply(void 0,arguments)}};return t=w()(Vr)(n)(e.dispatch),e.dispatch=t,e};function Hr(e){return"wp-autosave-block-editor-post-".concat(e)}function Wr(e){window.sessionStorage.removeItem(Hr(e))}var Gr={AWAIT_NEXT_STATE_CHANGE:Object(p.createRegistryControl)((function(e){return function(){return new Promise((function(t){var n=e.subscribe((function(){n(),t()}))}))}})),GET_REGISTRY:Object(p.createRegistryControl)((function(e){return function(){return e}})),LOCAL_AUTOSAVE_SET:function(e){!function(e,t,n,r){window.sessionStorage.setItem(Hr(e),JSON.stringify({post_title:t,content:n,excerpt:r}))}(e.postId,e.title,e.content,e.excerpt)}};function Kr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kr(Object(n),!0).forEach((function(t){Object(d.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var $r={reducer:S,selectors:o,actions:r,controls:qr({},b.controls,{},Gr)},Qr=Object(p.registerStore)(U,qr({},$r,{persist:["preferences"]}));zr(Qr);var Yr=n(8),Xr=n(14),Jr=n(0),Zr=n(9),eo=n(32);function to(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var no=function(e){return Object(Zr.createHigherOrderComponent)((function(t){return function(n){var r=n.attributes,o=n.setAttributes,i=Object(Xr.a)(n,["attributes","setAttributes"]),c=Object(p.useSelect)((function(e){return e("core/editor").getCurrentPostType()}),[]),s=Object(a.useEntityProp)("postType",c,"meta"),u=Object(Ot.a)(s,2),l=u[0],b=u[1],f=Object(Jr.useMemo)((function(){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?to(Object(n),!0).forEach((function(t){Object(d.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):to(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},r,{},Object(v.mapValues)(e,(function(e){return l[e]})))}),[r,l]);return Object(Jr.createElement)(t,Object(Yr.a)({attributes:f,setAttributes:function(t){var n=Object(v.mapKeys)(Object(v.pickBy)(t,(function(t,n){return e[n]})),(function(t,n){return e[n]}));Object(v.isEmpty)(n)||b(n),o(t)}},i))}}),"withMetaAttributeSource")};function ro(e){var t=Object(v.mapValues)(Object(v.pickBy)(e.attributes,{source:"meta"}),"meta");return Object(v.isEmpty)(t)||(e.edit=no(t)(e.edit)),e}Object(eo.addFilter)("blocks.registerBlockType","core/editor/custom-sources-backwards-compatibility/shim-attribute-source",ro),Object(p.select)("core/blocks").getBlockTypes().map((function(e){var t=e.name;return Object(p.select)("core/blocks").getBlockType(t)})).forEach(ro);var oo={name:"users",className:"editor-autocompleters__user",triggerPrefix:"@",options:function(e){var t="";return e&&(t="?search="+encodeURIComponent(e)),R()({path:"/wp/v2/users"+t})},isDebounced:!0,getOptionKeywords:function(e){return[e.slug,e.name]},getOptionLabel:function(e){return[e.avatar_urls&&e.avatar_urls[24]?Object(Jr.createElement)("img",{key:"avatar",className:"editor-autocompleters__user-avatar",alt:"",src:e.avatar_urls[24]}):Object(Jr.createElement)("span",{className:"editor-autocompleters__no-avatar"}),Object(Jr.createElement)("span",{key:"name",className:"editor-autocompleters__user-name"},e.name),Object(Jr.createElement)("span",{key:"slug",className:"editor-autocompleters__user-slug"},e.slug)]},getOptionCompletion:function(e){return"@".concat(e.slug)}};Object(eo.addFilter)("editor.Autocomplete.completers","editor/autocompleters/set-default-completers",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.push(Object(v.clone)(oo)),e}));var io=n(19),co=n(18),ao=n(23),so=n(15),uo=n(21);function lo(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var po=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(lo()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(){return Object(io.a)(this,r),n.apply(this,arguments)}return Object(co.a)(r,[{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.isDirty,r=t.editsReference,o=t.isAutosaveable,i=t.isAutosaving;r!==e.editsReference&&(this.didAutosaveForEditsReference=!1),!i&&e.isAutosaving&&(this.didAutosaveForEditsReference=!0),e.isDirty===n&&e.isAutosaveable===o&&e.editsReference===r||this.toggleTimer(n&&o&&!this.didAutosaveForEditsReference)}},{key:"componentWillUnmount",value:function(){this.toggleTimer(!1)}},{key:"toggleTimer",value:function(e){var t=this,n=this.props,r=n.interval,o=n.shouldThrottle,i=void 0!==o&&o;!i&&this.pendingSave&&(clearTimeout(this.pendingSave),delete this.pendingSave),!e||i&&this.pendingSave||(this.pendingSave=setTimeout((function(){t.props.autosave(),delete t.pendingSave}),1e3*r))}},{key:"render",value:function(){return null}}]),r}(Jr.Component),bo=Object(Zr.compose)([Object(p.withSelect)((function(e,t){var n=e("core").getReferenceByDistinctEdits,r=e("core/editor"),o=r.isEditedPostDirty,i=r.isEditedPostAutosaveable,c=r.isAutosavingPost,a=r.getEditorSettings,s=t.interval,u=void 0===s?a().autosaveInterval:s;return{isDirty:o(),isAutosaveable:i(),editsReference:n(),isAutosaving:c(),interval:u}})),Object(p.withDispatch)((function(e,t){return{autosave:function(){var n=t.autosave,r=void 0===n?e("core/editor").autosave:n;r()}}}))])(po),fo=n(10),ho=n.n(fo),mo=function(e){var t=e.children,n=e.isValid,r=e.level,o=e.path,c=void 0===o?[]:o,a=e.href,s=e.onSelect;return Object(Jr.createElement)("li",{className:ho()("document-outline__item","is-".concat(r.toLowerCase()),{"is-invalid":!n})},Object(Jr.createElement)("a",{href:a,className:"document-outline__button",onClick:s},Object(Jr.createElement)("span",{className:"document-outline__emdash","aria-hidden":"true"}),c.map((function(e,t){var n=e.clientId;return Object(Jr.createElement)("strong",{key:t,className:"document-outline__level"},Object(Jr.createElement)(i.BlockTitle,{clientId:n}))})),Object(Jr.createElement)("strong",{className:"document-outline__level"},r),Object(Jr.createElement)("span",{className:"document-outline__item-content"},t)))};function vo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Oo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vo(Object(n),!0).forEach((function(t){Object(d.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vo(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var go=Object(Jr.createElement)("em",null,Object(I.__)("(Empty heading)")),jo=[Object(Jr.createElement)("br",{key:"incorrect-break"}),Object(Jr.createElement)("em",{key:"incorrect-message"},Object(I.__)("(Incorrect heading level)"))],yo=[Object(Jr.createElement)("br",{key:"incorrect-break-h1"}),Object(Jr.createElement)("em",{key:"incorrect-message-h1"},Object(I.__)("(Your theme may already use a H1 for the post title)"))],_o=[Object(Jr.createElement)("br",{key:"incorrect-break-multiple-h1"}),Object(Jr.createElement)("em",{key:"incorrect-message-multiple-h1"},Object(I.__)("(Multiple H1 headings are not recommended)"))],ko=function(e){return!e.attributes.content||0===e.attributes.content.length},Eo=Object(Zr.compose)(Object(p.withSelect)((function(e){var t=e("core/block-editor").getBlocks,n=e("core/editor").getEditedPostAttribute,r=(0,e("core").getPostType)(n("type"));return{title:n("title"),blocks:t(),isTitleSupported:Object(v.get)(r,["supports","title"],!1)}})))((function(e){var t=e.blocks,n=void 0===t?[]:t,r=e.title,o=e.onSelect,i=e.isTitleSupported,c=e.hasOutlineItemsDisabled,a=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Object(v.flatMap)(t,(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"core/heading"===t.name?Oo({},t,{path:n,level:t.attributes.level,isEmpty:ko(t)}):e(t.innerBlocks,[].concat(Object(A.a)(n),[t]))}))}(n);if(a.length<1)return null;var s=1,l=document.querySelector(".editor-post-title__input"),d=i&&r&&l,p=Object(v.countBy)(a,"level")[1]>1;return Object(Jr.createElement)("div",{className:"document-outline"},Object(Jr.createElement)("ul",null,d&&Object(Jr.createElement)(mo,{level:Object(I.__)("Title"),isValid:!0,onSelect:o,href:"#".concat(l.id),isDisabled:c},r),a.map((function(e,t){var n=e.level>s+1,r=!(e.isEmpty||n||!e.level||1===e.level&&(p||d));return s=e.level,Object(Jr.createElement)(mo,{key:t,level:"H".concat(e.level),isValid:r,path:e.path,isDisabled:c,href:"#block-".concat(e.clientId),onSelect:o},e.isEmpty?go:Object(u.getTextContent)(Object(u.create)({html:e.attributes.content})),n&&jo,1===e.level&&p&&_o,d&&1===e.level&&!p&&yo)}))))}));var So=Object(p.withSelect)((function(e){return{blocks:e("core/block-editor").getBlocks()}}))((function(e){var t=e.blocks,n=e.children;return Object(v.filter)(t,(function(e){return"core/heading"===e.name})).length<1?null:n}));var Po=function(){var e=Object(p.useDispatch)("core/editor").savePost,t=Object(p.useSelect)((function(e){return e("core/editor").isEditedPostDirty}),[]);return Object(s.useShortcut)("core/editor/save",(function(n){n.preventDefault(),t()&&e()}),{bindGlobal:!0}),null};function wo(){var e=Object(p.useDispatch)("core/editor"),t=e.redo,n=e.undo,r=e.savePost,o=Object(p.useSelect)((function(e){return e("core/editor").isEditedPostDirty}),[]);return Object(s.useShortcut)("core/editor/undo",(function(e){n(),e.preventDefault()}),{bindGlobal:!0}),Object(s.useShortcut)("core/editor/redo",(function(e){t(),e.preventDefault()}),{bindGlobal:!0}),Object(s.useShortcut)("core/editor/save",(function(e){e.preventDefault(),o()&&r()}),{bindGlobal:!0}),Object(Jr.createElement)(Jr.Fragment,null,Object(Jr.createElement)(i.BlockEditorKeyboardShortcuts,null),Object(Jr.createElement)(Po,null))}var Co=wo;function To(){return L()("EditorGlobalKeyboardShortcuts",{alternative:"VisualEditorGlobalKeyboardShortcuts",plugin:"Gutenberg"}),Object(Jr.createElement)(wo,null)}function xo(){return Object(Jr.createElement)(Po,null)}var Bo=function(){var e=Object(p.useDispatch)("core/keyboard-shortcuts").registerShortcut;return Object(Jr.useEffect)((function(){e({name:"core/editor/save",category:"global",description:Object(I.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}}),e({name:"core/editor/undo",category:"global",description:Object(I.__)("Undo your last changes."),keyCombination:{modifier:"primary",character:"z"}}),e({name:"core/editor/redo",category:"global",description:Object(I.__)("Redo your last undo."),keyCombination:{modifier:"primaryShift",character:"z"}})}),[e]),Object(Jr.createElement)(i.BlockEditorKeyboardShortcuts.Register,null)},Ro=n(3),Io=n(20),Ao=n(234);var Do=Object(Jr.forwardRef)((function(e,t){var n=Object(p.useSelect)((function(e){return e("core/editor").hasEditorRedo()}),[]),r=Object(p.useDispatch)("core/editor").redo;return Object(Jr.createElement)(Ro.Button,Object(Yr.a)({},e,{ref:t,icon:Ao.a,label:Object(I.__)("Redo"),shortcut:Io.displayShortcut.primaryShift("z"),"aria-disabled":!n,onClick:n?r:void 0,className:"editor-history__redo"}))})),Lo=n(233);var No=Object(Jr.forwardRef)((function(e,t){var n=Object(p.useSelect)((function(e){return e("core/editor").hasEditorUndo()}),[]),r=Object(p.useDispatch)("core/editor").undo;return Object(Jr.createElement)(Ro.Button,Object(Yr.a)({},e,{ref:t,icon:Lo.a,label:Object(I.__)("Undo"),shortcut:Io.displayShortcut.primary("z"),"aria-disabled":!n,onClick:n?r:void 0,className:"editor-history__undo"}))}));var Uo=Object(Zr.compose)([Object(p.withSelect)((function(e){return{isValid:e("core/block-editor").isValidTemplate()}})),Object(p.withDispatch)((function(e){var t=e("core/block-editor"),n=t.setTemplateValidity;return{resetTemplateValidity:function(){return n(!0)},synchronizeTemplate:t.synchronizeTemplate}}))])((function(e){var t=e.isValid,n=Object(Xr.a)(e,["isValid"]);return t?null:Object(Jr.createElement)(Ro.Notice,{className:"editor-template-validation-notice",isDismissible:!1,status:"warning",actions:[{label:Object(I.__)("Keep it as is"),onClick:n.resetTemplateValidity},{label:Object(I.__)("Reset the template"),onClick:function(){window.confirm(Object(I.__)("Resetting the template may result in loss of content, do you want to continue?"))&&n.synchronizeTemplate()},isPrimary:!0}]},Object(I.__)("The content of your post doesn’t match the template assigned to your post type."))}));var Fo=Object(Zr.compose)([Object(p.withSelect)((function(e){return{notices:e("core/notices").getNotices()}})),Object(p.withDispatch)((function(e){return{onRemove:e("core/notices").removeNotice}}))])((function(e){var t=e.notices,n=e.onRemove,r=Object(v.filter)(t,{isDismissible:!0,type:"default"}),o=Object(v.filter)(t,{isDismissible:!1,type:"default"}),i=Object(v.filter)(t,{type:"snackbar"});return Object(Jr.createElement)(Jr.Fragment,null,Object(Jr.createElement)(Ro.NoticeList,{notices:o,className:"components-editor-notices__pinned"}),Object(Jr.createElement)(Ro.NoticeList,{notices:r,className:"components-editor-notices__dismissible",onRemove:n},Object(Jr.createElement)(Uo,null)),Object(Jr.createElement)(Ro.SnackbarList,{notices:i,className:"components-editor-notices__snackbar",onRemove:n}))})),Mo=n(133),Vo=n(274),zo=n(7),Ho=Object(Jr.createElement)(zo.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(Jr.createElement)(zo.Path,{d:"M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z"})),Wo=n(277),Go=n(147);function Ko(e){var t=e.record,n=e.checked,r=e.onChange,o=e.closePanel,i=t.name,c=t.kind,a=t.title,s=t.key,u=Object(p.useSelect)((function(e){var t,n=e("core").getEditedEntityRecord(c,i,s).blocks,r=void 0===n?[]:n,o=e("core/block-editor").getBlockParents(null===(t=r[0])||void 0===t?void 0:t.clientId);return o[o.length-1]}),[]),l=Object(p.useSelect)((function(e){return e("core/block-editor").getSelectedBlockClientId()===u}),[u]),d=l?Object(I.__)("Selected"):Object(I.__)("Select"),b=Object(p.useDispatch)("core/block-editor").selectBlock,f=Object(Jr.useCallback)((function(){return b(u)}),[u]),h=Object(Jr.useCallback)((function(){b(u),o()}),[u]);return Object(Jr.createElement)(Ro.PanelRow,null,Object(Jr.createElement)(Ro.CheckboxControl,{label:Object(Jr.createElement)("strong",null,a||Object(I.__)("Untitled")),checked:n,onChange:r}),u?Object(Jr.createElement)(Jr.Fragment,null,Object(Jr.createElement)(Ro.Button,{onClick:f,className:"entities-saved-states__find-entity",disabled:l},d),Object(Jr.createElement)(Ro.Button,{onClick:h,className:"entities-saved-states__find-entity-small",disabled:l},d)):null)}var qo={site:Vo.a,page:Ho,post:Wo.a,wp_template:Wo.a};function $o(e){var t=e.list,n=e.unselectedEntities,r=e.setUnselectedEntities,o=e.closePanel,i=t[0],c=Object(p.useSelect)((function(e){return e("core").getEntity(i.kind,i.name)}),[i.kind,i.name]),a=i.name,s=qo[a]||Go.a;return Object(Jr.createElement)(Ro.PanelBody,{title:c.label,initialOpen:!0,icon:s},t.map((function(e){return Object(Jr.createElement)(Ko,{key:e.key||"site",record:e,checked:!Object(v.some)(n,(function(t){return t.kind===e.kind&&t.name===e.name&&t.key===e.key})),onChange:function(t){return r(e,t)},closePanel:o})})))}var Qo={wp_template_part:function(e){return Object(I._n)("template part","template parts",e)},wp_template:function(e){return Object(I._n)("template","templates",e)},post:function(e){return Object(I._n)("post","posts",e)},page:function(e){return Object(I._n)("page","pages",e)},site:function(e){return Object(I._n)("site","sites",e)}},Yo={0:Object(I.__)("There are no changes."),
2 +/* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */
3 +1:Object(I.__)("Changes have been made to your %s."),
4 +/* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */
5 +2:Object(I.__)("Changes have been made to your %1$s and %2$s."),
6 +/* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */
7 +3:Object(I.__)("Changes have been made to your %1$s, %2$s, and %3$s."),
8 +/* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */
9 +4:Object(I.__)("Changes have been made to your %1$s, %2$s, %3$s, and %4$s."),
10 +/* translators: placeholders represent pre-translated singular/plural entity names (page, post, template, site, etc.) */
11 +5:Object(I.__)("Changes have been made to your %1$s, %2$s, %3$s, %4$s, and %5$s.")};function Xo(e){var t=e.isOpen,n=e.close,r=Object(p.useSelect)((function(e){return{dirtyEntityRecords:e("core").__experimentalGetDirtyEntityRecords()}}),[]).dirtyEntityRecords,o=Object(p.useDispatch)("core").saveEditedEntityRecord,i=Object.values(Object(v.groupBy)(r,"name")),c=[];i.forEach((function(e){Qo[e[0].name]&&c.push(Qo[e[0].name](e.length))}));var a=Yo[c.length]||Object(I.__)("Changes have been made to multiple entity types."),s=I.sprintf.apply(void 0,[a].concat(c)),u=Object(Jr.useState)([]),l=Object(Ot.a)(u,2),d=l[0],b=l[1],f=function(e,t){var n=e.kind,r=e.name,o=e.key;b(t?d.filter((function(e){return e.kind!==n||e.name!==r||e.key!==o})):[].concat(Object(A.a)(d),[{kind:n,name:r,key:o}]))},h=Object(Jr.useState)(!1),m=Object(Ot.a)(h,2),O=m[0],g=m[1],j=Object(Jr.useCallback)((function(){return n()}),[n]);return t?Object(Jr.createElement)("div",{className:"entities-saved-states__panel"},Object(Jr.createElement)("div",{className:"entities-saved-states__panel-header"},Object(Jr.createElement)(Ro.Button,{isPrimary:!0,disabled:r.length-d.length==0,onClick:function(){var e=r.filter((function(e){var t=e.kind,n=e.name,r=e.key;return!Object(v.some)(d,(function(e){return e.kind===t&&e.name===n&&e.key===r}))}));n(e),e.forEach((function(e){var t=e.kind,n=e.name,r=e.key;o(t,n,r)}))},className:"editor-entities-saved-states__save-button"},Object(I.__)("Save")),Object(Jr.createElement)(Ro.Button,{onClick:j,icon:Mo.a,label:Object(I.__)("Close panel")})),Object(Jr.createElement)("div",{className:"entities-saved-states__text-prompt"},Object(Jr.createElement)("strong",null,Object(I.__)("Are you ready to save?")),Object(Jr.createElement)("p",null,s),Object(Jr.createElement)("p",null,Object(Jr.createElement)(Ro.Button,{onClick:function(){return g((function(e){return!e}))},isLink:!0,className:"entities-saved-states__review-changes-button"},O?Object(I.__)("Hide changes."):Object(I.__)("Review changes.")))),O&&i.map((function(e){return Object(Jr.createElement)($o,{key:e[0].name,list:e,closePanel:j,unselectedEntities:d,setUnselectedEntities:f})}))):null}var Jo=n(13);function Zo(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var ei=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(Zo()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(){var e;return Object(io.a)(this,r),(e=n.apply(this,arguments)).reboot=e.reboot.bind(Object(Jo.a)(e)),e.getContent=e.getContent.bind(Object(Jo.a)(e)),e.state={error:null},e}return Object(co.a)(r,[{key:"componentDidCatch",value:function(e){this.setState({error:e})}},{key:"reboot",value:function(){this.props.onError()}},{key:"getContent",value:function(){try{return Object(p.select)("core/editor").getEditedPostContent()}catch(e){}}},{key:"render",value:function(){var e=this.state.error;return e?Object(Jr.createElement)(i.Warning,{className:"editor-error-boundary",actions:[Object(Jr.createElement)(Ro.Button,{key:"recovery",onClick:this.reboot,isSecondary:!0},Object(I.__)("Attempt Recovery")),Object(Jr.createElement)(Ro.ClipboardButton,{key:"copy-post",text:this.getContent,isSecondary:!0},Object(I.__)("Copy Post Text")),Object(Jr.createElement)(Ro.ClipboardButton,{key:"copy-error",text:e.stack,isSecondary:!0},Object(I.__)("Copy Error"))]},Object(I.__)("The editor has encountered an unexpected error.")):this.props.children}}]),r}(Jr.Component),ti=window.requestIdleCallback?window.requestIdleCallback:window.requestAnimationFrame,ni=Object(v.once)((function(){try{return window.sessionStorage.setItem("__wpEditorTestSessionStorage",""),window.sessionStorage.removeItem("__wpEditorTestSessionStorage"),!0}catch(e){return!1}}));function ri(){var e=Object(p.useSelect)((function(e){return{postId:e("core/editor").getCurrentPostId(),getEditedPostAttribute:e("core/editor").getEditedPostAttribute,hasRemoteAutosave:!!e("core/editor").getEditorSettings().autosave}}),[]),t=e.postId,n=e.getEditedPostAttribute,r=e.hasRemoteAutosave,o=Object(p.useDispatch)("core/notices"),i=o.createWarningNotice,a=o.removeNotice,s=Object(p.useDispatch)("core/editor"),u=s.editPost,l=s.resetEditorBlocks;Object(Jr.useEffect)((function(){var e=function(e){return window.sessionStorage.getItem(Hr(e))}(t);if(e){try{e=JSON.parse(e)}catch(e){return}var o=e,s={title:o.post_title,content:o.content,excerpt:o.excerpt};if(Object.keys(s).some((function(e){return s[e]!==n(e)}))){if(!r){var d=Object(v.uniqueId)("wpEditorAutosaveRestore");i(Object(I.__)("The backup of this post in your browser is different from the version below."),{id:d,actions:[{label:Object(I.__)("Restore the backup"),onClick:function(){u(Object(v.omit)(s,["content"])),l(Object(c.parse)(s.content)),a(d)}}]})}}else Wr(t)}}),[t])}var oi=Object(Zr.ifCondition)(ni)((function(){var e,t,n,r,o,i,c,a=Object(p.useDispatch)("core/editor").__experimentalLocalAutosave,s=Object(Jr.useCallback)((function(){ti(a)}),[]);ri(),e=Object(p.useSelect)((function(e){return{postId:e("core/editor").getCurrentPostId(),isDirty:e("core/editor").isEditedPostDirty(),isAutosaving:e("core/editor").isAutosavingPost(),didError:e("core/editor").didPostSaveRequestFail()}}),[]),t=e.postId,n=e.isDirty,r=e.isAutosaving,o=e.didError,i=Object(Jr.useRef)(n),c=Object(Jr.useRef)(r),Object(Jr.useEffect)((function(){!o&&(c.current&&!r||i.current&&!n)&&Wr(t),i.current=n,c.current=r}),[n,r,o]);var u=Object(p.useSelect)((function(e){return{localAutosaveInterval:e("core/editor").getEditorSettings().__experimentalLocalAutosaveInterval}}),[]).localAutosaveInterval;return Object(Jr.createElement)(bo,{interval:u,autosave:s,shouldThrottle:!0})}));var ii=Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.getEditedPostAttribute,r=t.getEditorSettings,o=e("core").getPostType,i=r().availableTemplates;return{postType:o(n("type")),availableTemplates:i}}))((function(e){var t=e.availableTemplates,n=e.postType,r=e.children;return!Object(v.get)(n,["supports","page-attributes"],!1)&&Object(v.isEmpty)(t)?null:r}));var ci=Object(p.withSelect)((function(e){var t=e("core/editor").getEditedPostAttribute;return{postType:(0,e("core").getPostType)(t("type"))}}))((function(e){var t=e.postType,n=e.children,r=e.supportKeys,o=!0;return t&&(o=Object(v.some)(Object(v.castArray)(r),(function(e){return!!t.supports[e]}))),o?n:null})),ai=Object(Zr.withState)({orderInput:null})((function(e){var t=e.onUpdateOrder,n=e.order,r=void 0===n?0:n,o=e.orderInput,i=e.setState,c=null===o?r:o;return Object(Jr.createElement)(Ro.TextControl,{className:"editor-page-attributes__order",type:"number",label:Object(I.__)("Order"),value:c,onChange:function(e){i({orderInput:e});var n=Number(e);Number.isInteger(n)&&""!==Object(v.invoke)(e,["trim"])&&t(Number(e))},size:6,onBlur:function(){i({orderInput:null})}})}));var si=Object(Zr.compose)([Object(p.withSelect)((function(e){return{order:e("core/editor").getEditedPostAttribute("menu_order")}})),Object(p.withDispatch)((function(e){return{onUpdateOrder:function(t){e("core/editor").editPost({menu_order:t})}}}))])((function(e){return Object(Jr.createElement)(ci,{supportKeys:"page-attributes"},Object(Jr.createElement)(ai,e))}));function ui(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function li(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ui(Object(n),!0).forEach((function(t){Object(d.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ui(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function di(e){var t=e.map((function(e){return li({children:[],parent:null},e)})),n=Object(v.groupBy)(t,"parent");if(n.null&&n.null.length)return t;return function e(t){return t.map((function(t){var r=n[t.id];return li({},t,{children:r&&r.length?e(r):[]})}))}(n[0]||[])}var pi=Object(p.withSelect)((function(e){var t=e("core"),n=t.getPostType,r=t.getEntityRecords,o=e("core/editor"),i=o.getCurrentPostId,c=o.getEditedPostAttribute,a=c("type"),s=n(a),u=i(),l=Object(v.get)(s,["hierarchical"],!1),d={per_page:-1,exclude:u,parent_exclude:u,orderby:"menu_order",order:"asc"};return{parent:c("parent"),items:l?r("postType",a,d):[],postType:s}})),bi=Object(p.withDispatch)((function(e){var t=e("core/editor").editPost;return{onUpdateParent:function(e){t({parent:e||0})}}})),fi=Object(Zr.compose)([pi,bi])((function(e){var t=e.parent,n=e.postType,r=e.items,o=e.onUpdateParent,i=Object(v.get)(n,["hierarchical"],!1),c=Object(v.get)(n,["labels","parent_item_colon"]),a=r||[];if(!i||!c||!a.length)return null;var s=di(a.map((function(e){return{id:e.id,parent:e.parent,name:e.title&&e.title.raw?e.title.raw:"#".concat(e.id," (").concat(Object(I.__)("no title"),")")}})));return Object(Jr.createElement)(Ro.TreeSelect,{className:"editor-page-attributes__parent",label:c,noOptionLabel:"(".concat(Object(I.__)("no parent"),")"),tree:s,selectedId:t,onChange:o})}));var hi=Object(Zr.compose)(Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.getEditedPostAttribute,r=(0,t.getEditorSettings)().availableTemplates;return{selectedTemplate:n("template"),availableTemplates:r}})),Object(p.withDispatch)((function(e){return{onUpdate:function(t){e("core/editor").editPost({template:t||""})}}})))((function(e){var t=e.availableTemplates,n=e.selectedTemplate,r=e.onUpdate;return Object(v.isEmpty)(t)?null:Object(Jr.createElement)(Ro.SelectControl,{label:Object(I.__)("Template:"),value:n,onChange:r,className:"editor-page-attributes__template",options:Object(v.map)(t,(function(e,t){return{value:t,label:e}}))})})),mi=n(60);var vi=Object(Zr.compose)([Object(p.withSelect)((function(e){var t=e("core/editor").getCurrentPost();return{hasAssignAuthorAction:Object(v.get)(t,["_links","wp:action-assign-author"],!1),postType:e("core/editor").getCurrentPostType(),authors:e("core").getAuthors()}})),Zr.withInstanceId])((function(e){var t=e.hasAssignAuthorAction,n=e.authors,r=e.children;return!t||n.length<2?null:Object(Jr.createElement)(ci,{supportKeys:"author"},r)}));function Oi(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var gi=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(Oi()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(){var e;return Object(io.a)(this,r),(e=n.apply(this,arguments)).setAuthorId=e.setAuthorId.bind(Object(Jo.a)(e)),e}return Object(co.a)(r,[{key:"setAuthorId",value:function(e){var t=this.props.onUpdateAuthor,n=e.target.value;t(Number(n))}},{key:"render",value:function(){var e=this.props,t=e.postAuthor,n=e.instanceId,r=e.authors,o="post-author-selector-"+n;return Object(Jr.createElement)(vi,null,Object(Jr.createElement)("label",{htmlFor:o},Object(I.__)("Author")),Object(Jr.createElement)("select",{id:o,value:t,onChange:this.setAuthorId,className:"editor-post-author__select"},r.map((function(e){return Object(Jr.createElement)("option",{key:e.id,value:e.id},Object(mi.decodeEntities)(e.name))}))))}}]),r}(Jr.Component),ji=Object(Zr.compose)([Object(p.withSelect)((function(e){return{postAuthor:e("core/editor").getEditedPostAttribute("author"),authors:e("core").getAuthors()}})),Object(p.withDispatch)((function(e){return{onUpdateAuthor:function(t){e("core/editor").editPost({author:t})}}})),Zr.withInstanceId])(gi);var yi=Object(Zr.compose)([Object(p.withSelect)((function(e){return{commentStatus:e("core/editor").getEditedPostAttribute("comment_status")}})),Object(p.withDispatch)((function(e){return{editPost:e("core/editor").editPost}}))])((function(e){var t=e.commentStatus,n=void 0===t?"open":t,r=Object(Xr.a)(e,["commentStatus"]);return Object(Jr.createElement)(Ro.CheckboxControl,{label:Object(I.__)("Allow comments"),checked:"open"===n,onChange:function(){return r.editPost({comment_status:"open"===n?"closed":"open"})}})}));var _i=Object(Zr.compose)([Object(p.withSelect)((function(e){return{excerpt:e("core/editor").getEditedPostAttribute("excerpt")}})),Object(p.withDispatch)((function(e){return{onUpdateExcerpt:function(t){e("core/editor").editPost({excerpt:t})}}}))])((function(e){var t=e.excerpt,n=e.onUpdateExcerpt;return Object(Jr.createElement)("div",{className:"editor-post-excerpt"},Object(Jr.createElement)(Ro.TextareaControl,{label:Object(I.__)("Write an excerpt (optional)"),className:"editor-post-excerpt__textarea",onChange:function(e){return n(e)},value:t}),Object(Jr.createElement)(Ro.ExternalLink,{href:Object(I.__)("https://wordpress.org/support/article/excerpt/")},Object(I.__)("Learn more about manual excerpts")))}));var ki=function(e){return Object(Jr.createElement)(ci,Object(Yr.a)({},e,{supportKeys:"excerpt"}))};var Ei=Object(p.withSelect)((function(e){var t=e("core").getThemeSupports;return{postType:(0,e("core/editor").getEditedPostAttribute)("type"),themeSupports:t()}}))((function(e){var t=e.themeSupports,n=e.children,r=e.postType,o=e.supportKeys;return Object(v.some)(Object(v.castArray)(o),(function(e){var n=Object(v.get)(t,[e],!1);return"post-thumbnails"===e&&Object(v.isArray)(n)?Object(v.includes)(n,r):n}))?n:null}));var Si=function(e){return Object(Jr.createElement)(Ei,{supportKeys:"post-thumbnails"},Object(Jr.createElement)(ci,Object(Yr.a)({},e,{supportKeys:"thumbnail"})))},Pi=["image"],wi=Object(I.__)("Featured image"),Ci=Object(I.__)("Set featured image"),Ti=Object(I.__)("Remove image");var xi=Object(p.withSelect)((function(e){var t=e("core"),n=t.getMedia,r=t.getPostType,o=e("core/editor"),i=o.getCurrentPostId,c=o.getEditedPostAttribute,a=c("featured_media");return{media:a?n(a):null,currentPostId:i(),postType:r(c("type")),featuredImageId:a}})),Bi=Object(p.withDispatch)((function(e,t,n){var r=t.noticeOperations,o=n.select,i=e("core/editor").editPost;return{onUpdateImage:function(e){i({featured_media:e.id})},onDropImage:function(e){o("core/block-editor").getSettings().mediaUpload({allowedTypes:["image"],filesList:e,onFileChange:function(e){var t=Object(Ot.a)(e,1)[0];i({featured_media:t.id})},onError:function(e){r.removeAllNotices(),r.createErrorNotice(e)}})},onRemoveImage:function(){i({featured_media:0})}}})),Ri=Object(Zr.compose)(Ro.withNotices,xi,Bi,Object(Ro.withFilters)("editor.PostFeaturedImage"))((function(e){var t,n,r,o=e.currentPostId,c=e.featuredImageId,a=e.onUpdateImage,s=e.onDropImage,u=e.onRemoveImage,l=e.media,d=e.postType,p=e.noticeUI,b=Object(v.get)(d,["labels"],{}),f=Object(Jr.createElement)("p",null,Object(I.__)("To edit the featured image, you need permission to upload media."));if(l){var h=Object(eo.applyFilters)("editor.PostFeaturedImage.imageSize","post-thumbnail",l.id,o);if(Object(v.has)(l,["media_details","sizes",h]))t=l.media_details.sizes[h].width,n=l.media_details.sizes[h].height,r=l.media_details.sizes[h].source_url;else{var m=Object(eo.applyFilters)("editor.PostFeaturedImage.imageSize","thumbnail",l.id,o);Object(v.has)(l,["media_details","sizes",m])?(t=l.media_details.sizes[m].width,n=l.media_details.sizes[m].height,r=l.media_details.sizes[m].source_url):(t=l.media_details.width,n=l.media_details.height,r=l.source_url)}}return Object(Jr.createElement)(Si,null,p,Object(Jr.createElement)("div",{className:"editor-post-featured-image"},Object(Jr.createElement)(i.MediaUploadCheck,{fallback:f},Object(Jr.createElement)(i.MediaUpload,{title:b.featured_image||wi,onSelect:a,unstableFeaturedImageFlow:!0,allowedTypes:Pi,modalClass:"editor-post-featured-image__media-modal",render:function(e){var o=e.open;return Object(Jr.createElement)("div",{className:"editor-post-featured-image__container"},Object(Jr.createElement)(Ro.Button,{className:c?"editor-post-featured-image__preview":"editor-post-featured-image__toggle",onClick:o,"aria-label":c?Object(I.__)("Edit or update the image"):null},!!c&&l&&Object(Jr.createElement)(Ro.ResponsiveWrapper,{naturalWidth:t,naturalHeight:n,isInline:!0},Object(Jr.createElement)("img",{src:r,alt:""})),!!c&&!l&&Object(Jr.createElement)(Ro.Spinner,null),!c&&(b.set_featured_image||Ci)),Object(Jr.createElement)(Ro.DropZone,{onFilesDrop:s}))},value:c})),!!c&&l&&!l.isLoading&&Object(Jr.createElement)(i.MediaUploadCheck,null,Object(Jr.createElement)(i.MediaUpload,{title:b.featured_image||wi,onSelect:a,unstableFeaturedImageFlow:!0,allowedTypes:Pi,modalClass:"editor-post-featured-image__media-modal",render:function(e){var t=e.open;return Object(Jr.createElement)(Ro.Button,{onClick:t,isSecondary:!0},Object(I.__)("Replace Image"))}})),!!c&&Object(Jr.createElement)(i.MediaUploadCheck,null,Object(Jr.createElement)(Ro.Button,{onClick:u,isLink:!0,isDestructive:!0},b.remove_featured_image||Ti))))}));var Ii=Object(p.withSelect)((function(e){return{disablePostFormats:e("core/editor").getEditorSettings().disablePostFormats}}))((function(e){var t=e.disablePostFormats,n=Object(Xr.a)(e,["disablePostFormats"]);return!t&&Object(Jr.createElement)(ci,Object(Yr.a)({},n,{supportKeys:"post-formats"}))})),Ai=[{id:"aside",caption:Object(I.__)("Aside")},{id:"gallery",caption:Object(I.__)("Gallery")},{id:"link",caption:Object(I.__)("Link")},{id:"image",caption:Object(I.__)("Image")},{id:"quote",caption:Object(I.__)("Quote")},{id:"standard",caption:Object(I.__)("Standard")},{id:"status",caption:Object(I.__)("Status")},{id:"video",caption:Object(I.__)("Video")},{id:"audio",caption:Object(I.__)("Audio")},{id:"chat",caption:Object(I.__)("Chat")}];var Di=Object(Zr.compose)([Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.getEditedPostAttribute,r=t.getSuggestedPostFormat,o=n("format"),i=e("core").getThemeSupports();return{postFormat:o,supportedFormats:Object(v.union)([o],Object(v.get)(i,["formats"],[])),suggestedFormat:r()}})),Object(p.withDispatch)((function(e){return{onUpdatePostFormat:function(t){e("core/editor").editPost({format:t})}}})),Zr.withInstanceId])((function(e){var t=e.onUpdatePostFormat,n=e.postFormat,r=void 0===n?"standard":n,o=e.supportedFormats,i=e.suggestedFormat,c="post-format-selector-"+e.instanceId,a=Ai.filter((function(e){return Object(v.includes)(o,e.id)})),s=Object(v.find)(a,(function(e){return e.id===i}));return Object(Jr.createElement)(Ii,null,Object(Jr.createElement)("div",{className:"editor-post-format"},Object(Jr.createElement)("div",{className:"editor-post-format__content"},Object(Jr.createElement)("label",{htmlFor:c},Object(I.__)("Post Format")),Object(Jr.createElement)(Ro.SelectControl,{value:r,onChange:function(e){return t(e)},id:c,options:a.map((function(e){return{label:e.caption,value:e.id}}))})),s&&s.id!==r&&Object(Jr.createElement)("div",{className:"editor-post-format__suggestion"},Object(I.__)("Suggestion:")," ",Object(Jr.createElement)(Ro.Button,{isLink:!0,onClick:function(){return t(s.id)}},s.caption))))})),Li=Object(Jr.createElement)(zo.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(Jr.createElement)(zo.Path,{d:"M13.65 2.88c3.93 2.01 5.48 6.84 3.47 10.77s-6.83 5.48-10.77 3.47c-1.87-.96-3.2-2.56-3.86-4.4l1.64-1.03c.45 1.57 1.52 2.95 3.08 3.76 3.01 1.54 6.69.35 8.23-2.66 1.55-3.01.36-6.69-2.65-8.24C9.78 3.01 6.1 4.2 4.56 7.21l1.88.97-4.95 3.08-.39-5.82 1.78.91C4.9 2.4 9.75.89 13.65 2.88zm-4.36 7.83C9.11 10.53 9 10.28 9 10c0-.07.03-.12.04-.19h-.01L10 5l.97 4.81L14 13l-4.5-2.12.02-.02c-.08-.04-.16-.09-.23-.15z"}));var Ni=Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.getCurrentPostLastRevisionId,r=t.getCurrentPostRevisionsCount;return{lastRevisionId:n(),revisionsCount:r()}}))((function(e){var t=e.lastRevisionId,n=e.revisionsCount,r=e.children;return!t||n<2?null:Object(Jr.createElement)(ci,{supportKeys:"revisions"},r)}));var Ui=Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.getCurrentPostLastRevisionId,r=t.getCurrentPostRevisionsCount;return{lastRevisionId:n(),revisionsCount:r()}}))((function(e){var t=e.lastRevisionId,n=e.revisionsCount;return Object(Jr.createElement)(Ni,null,Object(Jr.createElement)(Ro.Button,{href:_t("revision.php",{revision:t,gutenberg:!0}),className:"editor-post-last-revision__title",icon:Li},Object(I.sprintf)(
12 +/* translators: %d: number of revisions */
13 +Object(I._n)("%d Revision","%d Revisions",n),n)))}));function Fi(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var Mi=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(Fi()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(){var e;return Object(io.a)(this,r),(e=n.apply(this,arguments)).buttonRef=Object(Jr.createRef)(),e.openPreviewWindow=e.openPreviewWindow.bind(Object(Jo.a)(e)),e}return Object(co.a)(r,[{key:"componentDidUpdate",value:function(e){var t=this.props.previewLink;t&&!e.previewLink&&this.setPreviewWindowLink(t)}},{key:"setPreviewWindowLink",value:function(e){var t=this.previewWindow;t&&!t.closed&&(t.location=e,this.buttonRef.current&&this.buttonRef.current.focus())}},{key:"getWindowTarget",value:function(){var e=this.props.postId;return"wp-preview-".concat(e)}},{key:"openPreviewWindow",value:function(e){var t,n;(e.preventDefault(),this.previewWindow&&!this.previewWindow.closed||(this.previewWindow=window.open("",this.getWindowTarget())),this.previewWindow.focus(),this.props.isAutosaveable)?(this.props.isDraft?this.props.savePost({isPreview:!0}):this.props.autosave({isPreview:!0}),t=this.previewWindow.document,n=Object(Jr.renderToString)(Object(Jr.createElement)("div",{className:"editor-post-preview-button__interstitial-message"},Object(Jr.createElement)(Ro.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 96 96"},Object(Jr.createElement)(Ro.Path,{className:"outer",d:"M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",fill:"none"}),Object(Jr.createElement)(Ro.Path,{className:"inner",d:"M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z",fill:"none"})),Object(Jr.createElement)("p",null,Object(I.__)("Generating preview…")))),n+='\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 192px;\n\t\t\t\theight: 192px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\t\t}\n\t\t</style>\n\t',n=Object(eo.applyFilters)("editor.PostPreview.interstitialMarkup",n),t.write(n),t.title=Object(I.__)("Generating preview…"),t.close()):this.setPreviewWindowLink(e.target.href)}},{key:"render",value:function(){var e=this.props,t=e.previewLink,n=e.currentPostLink,r=e.isSaveable,o=t||n,i=ho()({"editor-post-preview":!this.props.className},this.props.className);return Object(Jr.createElement)(Ro.Button,{isTertiary:!this.props.className,className:i,href:o,target:this.getWindowTarget(),disabled:!r,onClick:this.openPreviewWindow,ref:this.buttonRef},this.props.textContent?this.props.textContent:Object(I._x)("Preview","imperative verb"),Object(Jr.createElement)(Ro.VisuallyHidden,{as:"span"},
14 +/* translators: accessibility text */
15 +Object(I.__)("(opens in a new tab)")))}}]),r}(Jr.Component),Vi=Object(Zr.compose)([Object(p.withSelect)((function(e,t){var n=t.forcePreviewLink,r=t.forceIsAutosaveable,o=e("core/editor"),i=o.getCurrentPostId,c=o.getCurrentPostAttribute,a=o.getEditedPostAttribute,s=o.isEditedPostSaveable,u=o.isEditedPostAutosaveable,l=o.getEditedPostPreviewLink,d=e("core").getPostType,p=l(),b=d(a("type"));return{postId:i(),currentPostLink:c("link"),previewLink:void 0!==n?n:p,isSaveable:s(),isAutosaveable:r||u(),isViewable:Object(v.get)(b,["viewable"],!1),isDraft:-1!==["draft","auto-draft"].indexOf(a("status"))}})),Object(p.withDispatch)((function(e){return{autosave:e("core/editor").autosave,savePost:e("core/editor").savePost}})),Object(Zr.ifCondition)((function(e){return e.isViewable}))])(Mi);function zi(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var Hi=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(zi()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(){var e;return Object(io.a)(this,r),(e=n.apply(this,arguments)).sendPostLock=e.sendPostLock.bind(Object(Jo.a)(e)),e.receivePostLock=e.receivePostLock.bind(Object(Jo.a)(e)),e.releasePostLock=e.releasePostLock.bind(Object(Jo.a)(e)),e}return Object(co.a)(r,[{key:"componentDidMount",value:function(){var e=this.getHookName();Object(eo.addAction)("heartbeat.send",e,this.sendPostLock),Object(eo.addAction)("heartbeat.tick",e,this.receivePostLock)}},{key:"componentWillUnmount",value:function(){var e=this.getHookName();Object(eo.removeAction)("heartbeat.send",e),Object(eo.removeAction)("heartbeat.tick",e)}},{key:"getHookName",value:function(){return"core/editor/post-locked-modal-"+this.props.instanceId}},{key:"sendPostLock",value:function(e){var t=this.props,n=t.isLocked,r=t.activePostLock,o=t.postId;n||(e["wp-refresh-post-lock"]={lock:r,post_id:o})}},{key:"receivePostLock",value:function(e){if(e["wp-refresh-post-lock"]){var t=this.props,n=t.autosave,r=t.updatePostLock,o=e["wp-refresh-post-lock"];o.lock_error?(n(),r({isLocked:!0,isTakeover:!0,user:{avatar:o.lock_error.avatar_src}})):o.new_lock&&r({isLocked:!1,activePostLock:o.new_lock})}}},{key:"releasePostLock",value:function(){var e=this.props,t=e.isLocked,n=e.activePostLock,r=e.postLockUtils,o=e.postId;if(!t&&n){var i=new window.FormData;if(i.append("action","wp-remove-post-lock"),i.append("_wpnonce",r.unlockNonce),i.append("post_ID",o),i.append("active_post_lock",n),window.navigator.sendBeacon)window.navigator.sendBeacon(r.ajaxUrl,i);else{var c=new window.XMLHttpRequest;c.open("POST",r.ajaxUrl,!1),c.send(i)}}}},{key:"render",value:function(){var e=this.props,t=e.user,n=e.postId,r=e.isLocked,o=e.isTakeover,i=e.postLockUtils,c=e.postType;if(!r)return null;var a=t.name,s=t.avatar,u=Object(yt.addQueryArgs)("post.php",{"get-post-lock":"1",lockKey:!0,post:n,action:"edit",_wpnonce:i.nonce}),l=_t("edit.php",{post_type:Object(v.get)(c,["slug"])}),d=Object(I.__)("Exit the Editor");return Object(Jr.createElement)(Ro.Modal,{title:o?Object(I.__)("Someone else has taken over this post."):Object(I.__)("This post is already being edited."),focusOnMount:!0,shouldCloseOnClickOutside:!1,shouldCloseOnEsc:!1,isDismissible:!1,className:"editor-post-locked-modal"},!!s&&Object(Jr.createElement)("img",{src:s,alt:Object(I.__)("Avatar"),className:"editor-post-locked-modal__avatar"}),!!o&&Object(Jr.createElement)("div",null,Object(Jr.createElement)("div",null,a?Object(I.sprintf)(
16 +/* translators: %s: user's display name */
17 +Object(I.__)("%s now has editing control of this post. Don’t worry, your changes up to this moment have been saved."),a):Object(I.__)("Another user now has editing control of this post. Don’t worry, your changes up to this moment have been saved.")),Object(Jr.createElement)("div",{className:"editor-post-locked-modal__buttons"},Object(Jr.createElement)(Ro.Button,{isPrimary:!0,href:l},d))),!o&&Object(Jr.createElement)("div",null,Object(Jr.createElement)("div",null,a?Object(I.sprintf)(
18 +/* translators: %s: user's display name */
19 +Object(I.__)("%s is currently working on this post, which means you cannot make changes, unless you take over."),a):Object(I.__)("Another user is currently working on this post, which means you cannot make changes, unless you take over.")),Object(Jr.createElement)("div",{className:"editor-post-locked-modal__buttons"},Object(Jr.createElement)(Ro.Button,{isSecondary:!0,href:l},d),Object(Jr.createElement)(Vi,null),Object(Jr.createElement)(Ro.Button,{isPrimary:!0,href:u},Object(I.__)("Take Over")))))}}]),r}(Jr.Component),Wi=Object(Zr.compose)(Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.isPostLocked,r=t.isPostLockTakeover,o=t.getPostLockUser,i=t.getCurrentPostId,c=t.getActivePostLock,a=t.getEditedPostAttribute,s=t.getEditorSettings,u=e("core").getPostType;return{isLocked:n(),isTakeover:r(),user:o(),postId:i(),postLockUtils:s().postLockUtils,activePostLock:c(),postType:u(a("type"))}})),Object(p.withDispatch)((function(e){var t=e("core/editor");return{autosave:t.autosave,updatePostLock:t.updatePostLock}})),Zr.withInstanceId,Object(Zr.withGlobalEvents)({beforeunload:"releasePostLock"}))(Hi);var Gi=Object(Zr.compose)(Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.isCurrentPostPublished,r=t.getCurrentPostType,o=t.getCurrentPost;return{hasPublishAction:Object(v.get)(o(),["_links","wp:action-publish"],!1),isPublished:n(),postType:r()}})))((function(e){var t=e.hasPublishAction,n=e.isPublished,r=e.children;return n||!t?null:r}));var Ki=Object(Zr.compose)(Object(p.withSelect)((function(e){return{status:e("core/editor").getEditedPostAttribute("status")}})),Object(p.withDispatch)((function(e){return{onUpdateStatus:function(t){e("core/editor").editPost({status:t})}}})))((function(e){var t=e.status,n=e.onUpdateStatus;return Object(Jr.createElement)(Gi,null,Object(Jr.createElement)(Ro.CheckboxControl,{label:Object(I.__)("Pending review"),checked:"pending"===t,onChange:function(){n("pending"===t?"draft":"pending")}}))}));var qi=Object(Zr.compose)([Object(p.withSelect)((function(e){return{pingStatus:e("core/editor").getEditedPostAttribute("ping_status")}})),Object(p.withDispatch)((function(e){return{editPost:e("core/editor").editPost}}))])((function(e){var t=e.pingStatus,n=void 0===t?"open":t,r=Object(Xr.a)(e,["pingStatus"]);return Object(Jr.createElement)(Ro.CheckboxControl,{label:Object(I.__)("Allow pingbacks & trackbacks"),checked:"open"===n,onChange:function(){return r.editPost({ping_status:"open"===n?"closed":"open"})}})}));var $i=Object(Zr.compose)([Object(p.withSelect)((function(e,t){var n=t.forceIsSaving,r=e("core/editor"),o=r.isCurrentPostPublished,i=r.isEditedPostBeingScheduled,c=r.isSavingPost,a=r.isPublishingPost,s=r.getCurrentPost,u=r.getCurrentPostType,l=r.isAutosavingPost;return{isPublished:o(),isBeingScheduled:i(),isSaving:n||c(),isPublishing:a(),hasPublishAction:Object(v.get)(s(),["_links","wp:action-publish"],!1),postType:u(),isAutosaving:l()}}))])((function(e){var t=e.isPublished,n=e.isBeingScheduled,r=e.isSaving,o=e.isPublishing,i=e.hasPublishAction,c=e.isAutosaving,a=e.hasNonPostEntityChanges;return o?Object(I.__)("Publishing…"):t&&r&&!c?Object(I.__)("Updating…"):n&&r&&!c?Object(I.__)("Scheduling…"):i?t?a?Object(I.__)("Update…"):Object(I.__)("Update"):n?a?Object(I.__)("Schedule…"):Object(I.__)("Schedule"):Object(I.__)("Publish"):a?Object(I.__)("Submit for Review…"):Object(I.__)("Submit for Review")}));function Qi(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var Yi=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(Qi()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(e){var t;return Object(io.a)(this,r),(t=n.call(this,e)).buttonNode=Object(Jr.createRef)(),t.createOnClick=t.createOnClick.bind(Object(Jo.a)(t)),t.closeEntitiesSavedStates=t.closeEntitiesSavedStates.bind(Object(Jo.a)(t)),t.state={entitiesSavedStatesCallback:!1},t}return Object(co.a)(r,[{key:"componentDidMount",value:function(){this.props.focusOnMount&&this.buttonNode.current.focus()}},{key:"createOnClick",value:function(e){var t=this;return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var i=t.props.hasNonPostEntityChanges;return i?(t.setState({entitiesSavedStatesCallback:function(){return e.apply(void 0,r)}}),t.props.setEntitiesSavedStatesCallback((function(){return t.closeEntitiesSavedStates})),v.noop):e.apply(void 0,r)}}},{key:"closeEntitiesSavedStates",value:function(e){var t=this.props,n=t.postType,r=t.postId,o=this.state.entitiesSavedStatesCallback;this.setState({entitiesSavedStatesCallback:!1},(function(){e&&Object(v.some)(e,(function(e){return"postType"===e.kind&&e.name===n&&e.key===r}))&&o()}))}},{key:"render",value:function(){var e,t=this.props,n=t.forceIsDirty,r=t.forceIsSaving,o=t.hasPublishAction,i=t.isBeingScheduled,c=t.isOpen,a=t.isPostSavingLocked,s=t.isPublishable,u=t.isPublished,l=t.isSaveable,d=t.isSaving,p=t.isToggle,b=t.onSave,f=t.onStatusChange,h=t.onSubmit,m=void 0===h?v.noop:h,O=t.onToggle,g=t.visibility,j=t.hasNonPostEntityChanges,y=d||r||!l||a||!s&&!n,_=u||d||r||!l||!s&&!n;e=o?"private"===g?"private":i?"future":"publish":"pending";var k={"aria-disabled":y&&!j,className:"editor-post-publish-button",isBusy:d&&u,isPrimary:!0,onClick:this.createOnClick((function(){y||(m(),f(e),b())}))},E={"aria-disabled":_&&!j,"aria-expanded":c,className:"editor-post-publish-panel__toggle",isBusy:d&&u,isPrimary:!0,onClick:this.createOnClick((function(){_||O()}))},S=i?Object(I.__)("Schedule…"):Object(I.__)("Publish"),P=Object(Jr.createElement)($i,{forceIsSaving:r,hasNonPostEntityChanges:j}),w=p?E:k,C=p?S:P;return Object(Jr.createElement)(Jr.Fragment,null,Object(Jr.createElement)(Ro.Button,Object(Yr.a)({ref:this.buttonNode},w,{className:ho()(w.className,"editor-post-publish-button__button",{"has-changes-dot":j})}),C))}}]),r}(Jr.Component),Xi=Object(Zr.compose)([Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.isSavingPost,r=t.isEditedPostBeingScheduled,o=t.getEditedPostVisibility,i=t.isCurrentPostPublished,c=t.isEditedPostSaveable,a=t.isEditedPostPublishable,s=t.isPostSavingLocked,u=t.getCurrentPost,l=t.getCurrentPostType,d=t.getCurrentPostId,p=t.hasNonPostEntityChanges;return{isSaving:n(),isBeingScheduled:r(),visibility:o(),isSaveable:c(),isPostSavingLocked:s(),isPublishable:a(),isPublished:i(),hasPublishAction:Object(v.get)(u(),["_links","wp:action-publish"],!1),postType:l(),postId:d(),hasNonPostEntityChanges:p()}})),Object(p.withDispatch)((function(e){var t=e("core/editor"),n=t.editPost;return{onStatusChange:function(e){return n({status:e},{undoIgnore:!0})},onSave:t.savePost}}))])(Yi),Ji=n(132),Zi=[{value:"public",label:Object(I.__)("Public"),info:Object(I.__)("Visible to everyone.")},{value:"private",label:Object(I.__)("Private"),info:Object(I.__)("Only visible to site admins and editors.")},{value:"password",label:Object(I.__)("Password Protected"),info:Object(I.__)("Protected with a password you choose. Only those with the password can view this post.")}];function ec(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var tc=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(ec()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(e){var t;return Object(io.a)(this,r),(t=n.apply(this,arguments)).setPublic=t.setPublic.bind(Object(Jo.a)(t)),t.setPrivate=t.setPrivate.bind(Object(Jo.a)(t)),t.setPasswordProtected=t.setPasswordProtected.bind(Object(Jo.a)(t)),t.updatePassword=t.updatePassword.bind(Object(Jo.a)(t)),t.state={hasPassword:!!e.password},t}return Object(co.a)(r,[{key:"setPublic",value:function(){var e=this.props,t=e.visibility,n=e.onUpdateVisibility,r=e.status;n("private"===t?"draft":r),this.setState({hasPassword:!1})}},{key:"setPrivate",value:function(){if(window.confirm(Object(I.__)("Would you like to privately publish this post now?"))){var e=this.props,t=e.onUpdateVisibility,n=e.onSave;t("private"),this.setState({hasPassword:!1}),n()}}},{key:"setPasswordProtected",value:function(){var e=this.props,t=e.visibility,n=e.onUpdateVisibility,r=e.status;n("private"===t?"draft":r,e.password||""),this.setState({hasPassword:!0})}},{key:"updatePassword",value:function(e){var t=this.props,n=t.status;(0,t.onUpdateVisibility)(n,e.target.value)}},{key:"render",value:function(){var e=this.props,t=e.visibility,n=e.password,r=e.instanceId,o={public:{onSelect:this.setPublic,checked:"public"===t&&!this.state.hasPassword},private:{onSelect:this.setPrivate,checked:"private"===t},password:{onSelect:this.setPasswordProtected,checked:this.state.hasPassword}};return[Object(Jr.createElement)("fieldset",{key:"visibility-selector",className:"editor-post-visibility__dialog-fieldset"},Object(Jr.createElement)("legend",{className:"editor-post-visibility__dialog-legend"},Object(I.__)("Post Visibility")),Zi.map((function(e){var t=e.value,n=e.label,i=e.info;return Object(Jr.createElement)("div",{key:t,className:"editor-post-visibility__choice"},Object(Jr.createElement)("input",{type:"radio",name:"editor-post-visibility__setting-".concat(r),value:t,onChange:o[t].onSelect,checked:o[t].checked,id:"editor-post-".concat(t,"-").concat(r),"aria-describedby":"editor-post-".concat(t,"-").concat(r,"-description"),className:"editor-post-visibility__dialog-radio"}),Object(Jr.createElement)("label",{htmlFor:"editor-post-".concat(t,"-").concat(r),className:"editor-post-visibility__dialog-label"},n),Object(Jr.createElement)("p",{id:"editor-post-".concat(t,"-").concat(r,"-description"),className:"editor-post-visibility__dialog-info"},i))}))),this.state.hasPassword&&Object(Jr.createElement)("div",{className:"editor-post-visibility__dialog-password",key:"password-selector"},Object(Jr.createElement)(Ro.VisuallyHidden,{as:"label",htmlFor:"editor-post-visibility__dialog-password-input-".concat(r)},Object(I.__)("Create password")),Object(Jr.createElement)("input",{className:"editor-post-visibility__dialog-password-input",id:"editor-post-visibility__dialog-password-input-".concat(r),type:"text",onChange:this.updatePassword,value:n,placeholder:Object(I.__)("Use a secure password")}))]}}]),r}(Jr.Component),nc=Object(Zr.compose)([Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.getEditedPostAttribute,r=t.getEditedPostVisibility;return{status:n("status"),visibility:r(),password:n("password")}})),Object(p.withDispatch)((function(e){var t=e("core/editor"),n=t.savePost,r=t.editPost;return{onSave:n,onUpdateVisibility:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";r({status:e,password:t})}}})),Zr.withInstanceId])(tc);var rc=Object(p.withSelect)((function(e){return{visibility:e("core/editor").getEditedPostVisibility()}}))((function(e){var t=e.visibility;return Object(v.find)(Zi,{value:t}).label}));var oc=Object(Zr.compose)([Object(p.withSelect)((function(e){return{date:e("core/editor").getEditedPostAttribute("date")}})),Object(p.withDispatch)((function(e){return{onUpdateDate:function(t){e("core/editor").editPost({date:t})}}}))])((function(e){var t=e.date,n=e.onUpdateDate,r=Object(jt.__experimentalGetSettings)(),o=/a(?!\\)/i.test(r.formats.time.toLowerCase().replace(/\\\\/g,"").split("").reverse().join(""));return Object(Jr.createElement)(Ro.DateTimePicker,{key:"date-time-picker",currentDate:t,onChange:function(e){n(e),document.activeElement.blur()},is12Hour:o})}));var ic=Object(p.withSelect)((function(e){return{date:e("core/editor").getEditedPostAttribute("date"),isFloating:e("core/editor").isEditedPostDateFloating()}}))((function(e){var t=e.date,n=e.isFloating,r=Object(jt.__experimentalGetSettings)();return t&&!n?Object(jt.dateI18n)("".concat(r.formats.date," ").concat(r.formats.time),t):Object(I.__)("Immediately")}));function cc(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function ac(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function sc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ac(Object(n),!0).forEach((function(t){Object(d.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ac(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var uc={per_page:-1,orderby:"count",order:"desc",_fields:"id,name"},lc=function(e,t){return e.toLowerCase()===t.toLowerCase()},dc=function(e){return sc({},e,{name:Object(v.unescape)(e.name)})},pc=function(e){return Object(v.map)(e,dc)},bc=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(cc()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(){var e;return Object(io.a)(this,r),(e=n.apply(this,arguments)).onChange=e.onChange.bind(Object(Jo.a)(e)),e.searchTerms=Object(v.throttle)(e.searchTerms.bind(Object(Jo.a)(e)),500),e.findOrCreateTerm=e.findOrCreateTerm.bind(Object(Jo.a)(e)),e.state={loading:!Object(v.isEmpty)(e.props.terms),availableTerms:[],selectedTerms:[]},e}return Object(co.a)(r,[{key:"componentDidMount",value:function(){var e=this;Object(v.isEmpty)(this.props.terms)||(this.initRequest=this.fetchTerms({include:this.props.terms.join(","),per_page:-1}),this.initRequest.then((function(){e.setState({loading:!1})}),(function(t){"abort"!==t.statusText&&e.setState({loading:!1})})))}},{key:"componentWillUnmount",value:function(){Object(v.invoke)(this.initRequest,["abort"]),Object(v.invoke)(this.searchRequest,["abort"])}},{key:"componentDidUpdate",value:function(e){e.terms!==this.props.terms&&this.updateSelectedTerms(this.props.terms)}},{key:"fetchTerms",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.props.taxonomy,r=sc({},uc,{},t),o=R()({path:Object(yt.addQueryArgs)("/wp/v2/".concat(n.rest_base),r)});return o.then(pc).then((function(t){e.setState((function(e){return{availableTerms:e.availableTerms.concat(t.filter((function(t){return!Object(v.find)(e.availableTerms,(function(e){return e.id===t.id}))})))}})),e.updateSelectedTerms(e.props.terms)})),o}},{key:"updateSelectedTerms",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=t.reduce((function(t,n){var r=Object(v.find)(e.state.availableTerms,(function(e){return e.id===n}));return r&&t.push(r.name),t}),[]);this.setState({selectedTerms:n})}},{key:"findOrCreateTerm",value:function(e){var t=this,n=this.props.taxonomy,r=Object(v.escape)(e);return R()({path:"/wp/v2/".concat(n.rest_base),method:"POST",data:{name:r}}).catch((function(o){return"term_exists"===o.code?(t.addRequest=R()({path:Object(yt.addQueryArgs)("/wp/v2/".concat(n.rest_base),sc({},uc,{search:r}))}).then(pc),t.addRequest.then((function(t){return Object(v.find)(t,(function(t){return lc(t.name,e)}))}))):Promise.reject(o)})).then(dc)}},{key:"onChange",value:function(e){var t=this,n=Object(v.uniqBy)(e,(function(e){return e.toLowerCase()}));this.setState({selectedTerms:n});var r=n.filter((function(e){return!Object(v.find)(t.state.availableTerms,(function(t){return lc(t.name,e)}))})),o=function(e,t){return e.map((function(e){return Object(v.find)(t,(function(t){return lc(t.name,e)})).id}))};if(0===r.length)return this.props.onUpdateTerms(o(n,this.state.availableTerms),this.props.taxonomy.rest_base);Promise.all(r.map(this.findOrCreateTerm)).then((function(e){var r=t.state.availableTerms.concat(e);return t.setState({availableTerms:r}),t.props.onUpdateTerms(o(n,r),t.props.taxonomy.rest_base)}))}},{key:"searchTerms",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";Object(v.invoke)(this.searchRequest,["abort"]),this.searchRequest=this.fetchTerms({search:e})}},{key:"render",value:function(){var e=this.props,t=e.slug,n=e.taxonomy;if(!e.hasAssignAction)return null;var r=this.state,o=r.loading,i=r.availableTerms,c=r.selectedTerms,a=i.map((function(e){return e.name})),s=Object(v.get)(n,["labels","add_new_item"],"post_tag"===t?Object(I.__)("Add new tag"):Object(I.__)("Add new Term")),u=Object(v.get)(n,["labels","singular_name"],"post_tag"===t?Object(I.__)("Tag"):Object(I.__)("Term")),l=Object(I.sprintf)(
20 +/* translators: %s: term name. */
21 +Object(I._x)("%s added","term"),u),d=Object(I.sprintf)(
22 +/* translators: %s: term name. */
23 +Object(I._x)("%s removed","term"),u),p=Object(I.sprintf)(
24 +/* translators: %s: term name. */
25 +Object(I._x)("Remove %s","term"),u);return Object(Jr.createElement)(Ro.FormTokenField,{value:c,suggestions:a,onChange:this.onChange,onInputChange:this.searchTerms,maxSuggestions:20,disabled:o,label:s,messages:{added:l,removed:d,remove:p}})}}]),r}(Jr.Component),fc=Object(Zr.compose)(Object(p.withSelect)((function(e,t){var n=t.slug,r=e("core/editor").getCurrentPost,o=(0,e("core").getTaxonomy)(n);return{hasCreateAction:!!o&&Object(v.get)(r(),["_links","wp:action-create-"+o.rest_base],!1),hasAssignAction:!!o&&Object(v.get)(r(),["_links","wp:action-assign-"+o.rest_base],!1),terms:o?e("core/editor").getEditedPostAttribute(o.rest_base):[],taxonomy:o}})),Object(p.withDispatch)((function(e){return{onUpdateTerms:function(t,n){e("core/editor").editPost(Object(d.a)({},n,t))}}})),Object(Ro.withFilters)("editor.PostTaxonomyType"))(bc);function hc(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var mc=function(){var e=[Object(I.__)("Suggestion:"),Object(Jr.createElement)("span",{className:"editor-post-publish-panel__link",key:"label"},Object(I.__)("Add tags"))];return Object(Jr.createElement)(Ro.PanelBody,{initialOpen:!1,title:e},Object(Jr.createElement)("p",null,Object(I.__)("Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.")),Object(Jr.createElement)(fc,{slug:"post_tag"}))},vc=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(hc()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(e){var t;return Object(io.a)(this,r),(t=n.call(this,e)).state={hadTagsWhenOpeningThePanel:e.hasTags},t}return Object(co.a)(r,[{key:"render",value:function(){return this.state.hadTagsWhenOpeningThePanel?null:Object(Jr.createElement)(mc,null)}}]),r}(Jr.Component),Oc=Object(Zr.compose)(Object(p.withSelect)((function(e){var t=e("core/editor").getCurrentPostType(),n=e("core").getTaxonomy("post_tag"),r=n&&e("core/editor").getEditedPostAttribute(n.rest_base);return{areTagsFetched:void 0!==n,isPostTypeSupported:n&&Object(v.some)(n.types,(function(e){return e===t})),hasTags:r&&r.length}})),Object(Zr.ifCondition)((function(e){var t=e.areTagsFetched;return e.isPostTypeSupported&&t})))(vc),gc=function(e){var t=e.suggestedPostFormat,n=e.suggestionText,r=e.onUpdatePostFormat;return Object(Jr.createElement)(Ro.Button,{isLink:!0,onClick:function(){return r(t)}},n)},jc=function(e,t){var n=Ai.filter((function(t){return Object(v.includes)(e,t.id)}));return Object(v.find)(n,(function(e){return e.id===t}))},yc=Object(Zr.compose)(Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.getEditedPostAttribute,r=t.getSuggestedPostFormat,o=Object(v.get)(e("core").getThemeSupports(),["formats"],[]);return{currentPostFormat:n("format"),suggestion:jc(o,r())}})),Object(p.withDispatch)((function(e){return{onUpdatePostFormat:function(t){e("core/editor").editPost({format:t})}}})),Object(Zr.ifCondition)((function(e){var t=e.suggestion,n=e.currentPostFormat;return t&&t.id!==n})))((function(e){var t=e.suggestion,n=e.onUpdatePostFormat,r=[Object(I.__)("Suggestion:"),Object(Jr.createElement)("span",{className:"editor-post-publish-panel__link",key:"label"},Object(I.__)("Use a post format"))];return Object(Jr.createElement)(Ro.PanelBody,{initialOpen:!1,title:r},Object(Jr.createElement)("p",null,Object(I.__)("Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.")),Object(Jr.createElement)("p",null,Object(Jr.createElement)(gc,{onUpdatePostFormat:n,suggestedPostFormat:t.id,suggestionText:Object(I.sprintf)(
26 +/* translators: %s: post format */
27 +Object(I.__)('Apply the "%1$s" format.'),t.caption)})))}));var _c=Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.getCurrentPost,r=t.isEditedPostBeingScheduled;return{hasPublishAction:Object(v.get)(n(),["_links","wp:action-publish"],!1),isBeingScheduled:r()}}))((function(e){var t,n,r=e.hasPublishAction,o=e.isBeingScheduled,i=e.children;return r?o?(t=Object(I.__)("Are you ready to schedule?"),n=Object(I.__)("Your work will be published at the specified date and time.")):(t=Object(I.__)("Are you ready to publish?"),n=Object(I.__)("Double-check your settings before publishing.")):(t=Object(I.__)("Are you ready to submit for review?"),n=Object(I.__)("When you’re ready, submit your work for review, and an Editor will be able to approve it for you.")),Object(Jr.createElement)("div",{className:"editor-post-publish-panel__prepublish"},Object(Jr.createElement)("div",null,Object(Jr.createElement)("strong",null,t)),Object(Jr.createElement)("p",null,n),r&&Object(Jr.createElement)(Jr.Fragment,null,Object(Jr.createElement)(Ro.PanelBody,{initialOpen:!1,title:[Object(I.__)("Visibility:"),Object(Jr.createElement)("span",{className:"editor-post-publish-panel__link",key:"label"},Object(Jr.createElement)(rc,null))]},Object(Jr.createElement)(nc,null)),Object(Jr.createElement)(Ro.PanelBody,{initialOpen:!1,title:[Object(I.__)("Publish:"),Object(Jr.createElement)("span",{className:"editor-post-publish-panel__link",key:"label"},Object(Jr.createElement)(ic,null))]},Object(Jr.createElement)(oc,null))),Object(Jr.createElement)(yc,null),Object(Jr.createElement)(Oc,null),i)}));function kc(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var Ec=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(kc()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(){var e;return Object(io.a)(this,r),(e=n.apply(this,arguments)).state={showCopyConfirmation:!1},e.onCopy=e.onCopy.bind(Object(Jo.a)(e)),e.onSelectInput=e.onSelectInput.bind(Object(Jo.a)(e)),e.postLink=Object(Jr.createRef)(),e}return Object(co.a)(r,[{key:"componentDidMount",value:function(){this.props.focusOnMount&&this.postLink.current.focus()}},{key:"componentWillUnmount",value:function(){clearTimeout(this.dismissCopyConfirmation)}},{key:"onCopy",value:function(){var e=this;this.setState({showCopyConfirmation:!0}),clearTimeout(this.dismissCopyConfirmation),this.dismissCopyConfirmation=setTimeout((function(){e.setState({showCopyConfirmation:!1})}),4e3)}},{key:"onSelectInput",value:function(e){e.target.select()}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.isScheduled,r=e.post,o=e.postType,i=Object(v.get)(o,["labels","singular_name"]),c=Object(v.get)(o,["labels","view_item"]),a="future"===r.status?function(e){var t=e.slug;return e.permalink_template.includes("%postname%")?e.permalink_template.replace("%postname%",t):e.permalink_template}(r):r.link,s=n?Object(Jr.createElement)(Jr.Fragment,null,Object(I.__)("is now scheduled. It will go live on")," ",Object(Jr.createElement)(ic,null),"."):Object(I.__)("is now live.");return Object(Jr.createElement)("div",{className:"post-publish-panel__postpublish"},Object(Jr.createElement)(Ro.PanelBody,{className:"post-publish-panel__postpublish-header"},Object(Jr.createElement)("a",{ref:this.postLink,href:a},Object(mi.decodeEntities)(r.title)||Object(I.__)("(no title)"))," ",s),Object(Jr.createElement)(Ro.PanelBody,null,Object(Jr.createElement)("p",{className:"post-publish-panel__postpublish-subheader"},Object(Jr.createElement)("strong",null,Object(I.__)("What’s next?"))),Object(Jr.createElement)(Ro.TextControl,{className:"post-publish-panel__postpublish-post-address",readOnly:!0,label:Object(I.sprintf)(
28 +/* translators: %s: post type singular name */
29 +Object(I.__)("%s address"),i),value:Object(yt.safeDecodeURIComponent)(a),onFocus:this.onSelectInput}),Object(Jr.createElement)("div",{className:"post-publish-panel__postpublish-buttons"},!n&&Object(Jr.createElement)(Ro.Button,{isSecondary:!0,href:a},c),Object(Jr.createElement)(Ro.ClipboardButton,{isSecondary:!0,text:a,onCopy:this.onCopy},this.state.showCopyConfirmation?Object(I.__)("Copied!"):Object(I.__)("Copy Link")))),t)}}]),r}(Jr.Component),Sc=Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.getEditedPostAttribute,r=t.getCurrentPost,o=t.isCurrentPostScheduled,i=e("core").getPostType;return{post:r(),postType:i(n("type")),isScheduled:o()}}))(Ec);function Pc(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var wc=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(Pc()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(){var e;return Object(io.a)(this,r),(e=n.apply(this,arguments)).onSubmit=e.onSubmit.bind(Object(Jo.a)(e)),e}return Object(co.a)(r,[{key:"componentDidUpdate",value:function(e){e.isPublished&&!this.props.isSaving&&this.props.isDirty&&this.props.onClose()}},{key:"onSubmit",value:function(){var e=this.props,t=e.onClose,n=e.hasPublishAction,r=e.isPostTypeViewable;n&&r||t()}},{key:"render",value:function(){var e=this.props,t=e.forceIsDirty,n=e.forceIsSaving,r=e.isBeingScheduled,o=e.isPublished,i=e.isPublishSidebarEnabled,c=e.isScheduled,a=e.isSaving,s=e.onClose,u=e.onTogglePublishSidebar,l=e.PostPublishExtension,d=e.PrePublishExtension,p=Object(Xr.a)(e,["forceIsDirty","forceIsSaving","isBeingScheduled","isPublished","isPublishSidebarEnabled","isScheduled","isSaving","onClose","onTogglePublishSidebar","PostPublishExtension","PrePublishExtension"]),b=Object(v.omit)(p,["hasPublishAction","isDirty","isPostTypeViewable"]),f=o||c&&r,h=!f&&!a,m=f&&!a;return Object(Jr.createElement)("div",Object(Yr.a)({className:"editor-post-publish-panel"},b),Object(Jr.createElement)("div",{className:"editor-post-publish-panel__header"},m?Object(Jr.createElement)(Ro.Button,{onClick:s,icon:Ji.a,label:Object(I.__)("Close panel")}):Object(Jr.createElement)(Jr.Fragment,null,Object(Jr.createElement)("div",{className:"editor-post-publish-panel__header-publish-button"},Object(Jr.createElement)(Xi,{focusOnMount:!0,onSubmit:this.onSubmit,forceIsDirty:t,forceIsSaving:n})),Object(Jr.createElement)("div",{className:"editor-post-publish-panel__header-cancel-button"},Object(Jr.createElement)(Ro.Button,{onClick:s,label:Object(I.__)("Close panel"),isSecondary:!0},Object(I.__)("Cancel"))))),Object(Jr.createElement)("div",{className:"editor-post-publish-panel__content"},h&&Object(Jr.createElement)(_c,null,d&&Object(Jr.createElement)(d,null)),m&&Object(Jr.createElement)(Sc,{focusOnMount:!0},l&&Object(Jr.createElement)(l,null)),a&&Object(Jr.createElement)(Ro.Spinner,null)),Object(Jr.createElement)("div",{className:"editor-post-publish-panel__footer"},Object(Jr.createElement)(Ro.CheckboxControl,{label:Object(I.__)("Always show pre-publish checks."),checked:i,onChange:u})))}}]),r}(Jr.Component),Cc=Object(Zr.compose)([Object(p.withSelect)((function(e){var t=e("core").getPostType,n=e("core/editor"),r=n.getCurrentPost,o=n.getEditedPostAttribute,i=n.isCurrentPostPublished,c=n.isCurrentPostScheduled,a=n.isEditedPostBeingScheduled,s=n.isEditedPostDirty,u=n.isSavingPost,l=e("core/editor").isPublishSidebarEnabled,d=t(o("type"));return{hasPublishAction:Object(v.get)(r(),["_links","wp:action-publish"],!1),isPostTypeViewable:Object(v.get)(d,["viewable"],!1),isBeingScheduled:a(),isDirty:s(),isPublished:i(),isPublishSidebarEnabled:l(),isSaving:u(),isScheduled:c()}})),Object(p.withDispatch)((function(e,t){var n=t.isPublishSidebarEnabled,r=e("core/editor"),o=r.disablePublishSidebar,i=r.enablePublishSidebar;return{onTogglePublishSidebar:function(){n?o():i()}}})),Ro.withFocusReturn,Ro.withConstrainedTabbing])(wc),Tc=n(120),xc=Object(Jr.createElement)(zo.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(Jr.createElement)(zo.Path,{d:"M14.9 9c1.8.2 3.1 1.7 3.1 3.5 0 1.9-1.6 3.5-3.5 3.5h-10C2.6 16 1 14.4 1 12.5 1 10.7 2.3 9.3 4.1 9 4 8.9 4 8.7 4 8.5 4 7.1 5.1 6 6.5 6c.3 0 .7.1.9.2C8.1 4.9 9.4 4 11 4c2.2 0 4 1.8 4 4 0 .4-.1.7-.1 1z"})),Bc=n(121),Rc=Object(Jr.createElement)(zo.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(Jr.createElement)(zo.Path,{d:"M14.8 9c.1-.3.2-.6.2-1 0-2.2-1.8-4-4-4-1.5 0-2.9.9-3.5 2.2-.3-.1-.7-.2-1-.2C5.1 6 4 7.1 4 8.5c0 .2 0 .4.1.5-1.8.3-3.1 1.7-3.1 3.5C1 14.4 2.6 16 4.5 16H8v-3H5l4.5-4.5L14 13h-3v3h3.5c1.9 0 3.5-1.6 3.5-3.5 0-1.8-1.4-3.3-3.2-3.5z"}));var Ic=Object(Zr.compose)([Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.isSavingPost,r=t.isCurrentPostPublished,o=t.isCurrentPostScheduled;return{isSaving:n(),isPublished:r(),isScheduled:o()}})),Object(p.withDispatch)((function(e){var t=e("core/editor"),n=t.editPost,r=t.savePost;return{onClick:function(){n({status:"draft"}),r()}}}))])((function(e){var t=e.isSaving,n=e.isPublished,r=e.isScheduled,o=e.onClick,i=Object(Zr.useViewportMatch)("small","<");return n||r?Object(Jr.createElement)(Ro.Button,{className:"editor-post-switch-to-draft",onClick:function(){var e;n?e=Object(I.__)("Are you sure you want to unpublish this post?"):r&&(e=Object(I.__)("Are you sure you want to unschedule this post?")),window.confirm(e)&&o()},disabled:t,isTertiary:!0},i?Object(I.__)("Draft"):Object(I.__)("Switch to draft")):null}));function Ac(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var Dc=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(Ac()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(){var e;return Object(io.a)(this,r),(e=n.apply(this,arguments)).state={forceSavedMessage:!1},e}return Object(co.a)(r,[{key:"componentDidUpdate",value:function(e){var t=this;e.isSaving&&!this.props.isSaving&&(this.setState({forceSavedMessage:!0}),this.props.setTimeout((function(){t.setState({forceSavedMessage:!1})}),1e3))}},{key:"render",value:function(){var e=this.props,t=e.post,n=e.isNew,r=e.isScheduled,o=e.isPublished,i=e.isDirty,c=e.isSaving,a=e.isSaveable,s=e.onSave,u=e.isAutosaving,l=e.isPending,d=e.isLargeViewport,p=this.state.forceSavedMessage;if(c){var b=ho()("editor-post-saved-state","is-saving",{"is-autosaving":u});return Object(Jr.createElement)(Ro.Animate,{type:"loading"},(function(e){var t=e.className;return Object(Jr.createElement)("span",{className:ho()(b,t)},Object(Jr.createElement)(Tc.a,{icon:xc}),u?Object(I.__)("Autosaving"):Object(I.__)("Saving"))}))}if(o||r)return Object(Jr.createElement)(Ic,null);if(!a)return null;if(p||!n&&!i)return Object(Jr.createElement)("span",{className:"editor-post-saved-state is-saved"},Object(Jr.createElement)(Tc.a,{icon:Bc.a}),Object(I.__)("Saved"));if(!Object(v.get)(t,["_links","wp:action-publish"],!1)&&l)return null;var f=l?Object(I.__)("Save as pending"):Object(I.__)("Save draft");return d?Object(Jr.createElement)(Ro.Button,{className:"editor-post-save-draft",onClick:function(){return s()},shortcut:Io.displayShortcut.primary("s"),isTertiary:!0},f):Object(Jr.createElement)(Ro.Button,{className:"editor-post-save-draft",label:f,onClick:function(){return s()},shortcut:Io.displayShortcut.primary("s"),icon:Rc})}}]),r}(Jr.Component),Lc=Object(Zr.compose)([Object(p.withSelect)((function(e,t){var n=t.forceIsDirty,r=t.forceIsSaving,o=e("core/editor"),i=o.isEditedPostNew,c=o.isCurrentPostPublished,a=o.isCurrentPostScheduled,s=o.isEditedPostDirty,u=o.isSavingPost,l=o.isEditedPostSaveable,d=o.getCurrentPost,p=o.isAutosavingPost,b=o.getEditedPostAttribute;return{post:d(),isNew:i(),isPublished:c(),isScheduled:a(),isDirty:n||s(),isSaving:r||u(),isSaveable:l(),isAutosaving:p(),isPending:"pending"===b("status")}})),Object(p.withDispatch)((function(e){return{onSave:e("core/editor").savePost}})),Zr.withSafeTimeout,Object(l.withViewportMatch)({isLargeViewport:"small"})])(Dc);var Nc=Object(Zr.compose)([Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.getCurrentPost,r=t.getCurrentPostType;return{hasPublishAction:Object(v.get)(n(),["_links","wp:action-publish"],!1),postType:r()}}))])((function(e){var t=e.hasPublishAction,n=e.children;return t?n:null}));function Uc(e){var t=e.children;return Object(Jr.createElement)(ci,{supportKeys:"slug"},t)}function Fc(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var Mc=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(Fc()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(e){var t,o=e.postSlug,i=e.postTitle,c=e.postID;return Object(io.a)(this,r),(t=n.apply(this,arguments)).state={editedSlug:Object(yt.safeDecodeURIComponent)(o)||kt(i)||c},t.setSlug=t.setSlug.bind(Object(Jo.a)(t)),t}return Object(co.a)(r,[{key:"setSlug",value:function(e){var t=this.props,n=t.postSlug,r=t.onUpdateSlug,o=kt(e.target.value);o!==n&&r(o)}},{key:"render",value:function(){var e=this,t=this.props.instanceId,n=this.state.editedSlug,r="editor-post-slug-"+t;return Object(Jr.createElement)(Uc,null,Object(Jr.createElement)("label",{htmlFor:r},Object(I.__)("Slug")),Object(Jr.createElement)("input",{type:"text",id:r,value:n,onChange:function(t){return e.setState({editedSlug:t.target.value})},onBlur:this.setSlug,className:"editor-post-slug__input"}))}}]),r}(Jr.Component),Vc=Object(Zr.compose)([Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.getCurrentPost,r=t.getEditedPostAttribute,o=n().id;return{postSlug:r("slug"),postTitle:r("title"),postID:o}})),Object(p.withDispatch)((function(e){var t=e("core/editor").editPost;return{onUpdateSlug:function(e){t({slug:e})}}})),Zr.withInstanceId])(Mc);var zc=Object(Zr.compose)([Object(p.withSelect)((function(e){var t=e("core/editor").getCurrentPost();return{hasStickyAction:Object(v.get)(t,["_links","wp:action-sticky"],!1),postType:e("core/editor").getCurrentPostType()}}))])((function(e){var t=e.hasStickyAction,n=e.postType,r=e.children;return"post"===n&&t?r:null}));var Hc=Object(Zr.compose)([Object(p.withSelect)((function(e){return{postSticky:e("core/editor").getEditedPostAttribute("sticky")}})),Object(p.withDispatch)((function(e){return{onUpdateSticky:function(t){e("core/editor").editPost({sticky:t})}}}))])((function(e){var t=e.onUpdateSticky,n=e.postSticky,r=void 0!==n&&n;return Object(Jr.createElement)(zc,null,Object(Jr.createElement)(Ro.CheckboxControl,{label:Object(I.__)("Stick to the top of the blog"),checked:r,onChange:function(){return t(!r)}}))}));function Wc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Gc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wc(Object(n),!0).forEach((function(t){Object(d.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Kc(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var qc={per_page:-1,orderby:"name",order:"asc",_fields:"id,name,parent"},$c=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(Kc()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(){var e;return Object(io.a)(this,r),(e=n.apply(this,arguments)).findTerm=e.findTerm.bind(Object(Jo.a)(e)),e.onChange=e.onChange.bind(Object(Jo.a)(e)),e.onChangeFormName=e.onChangeFormName.bind(Object(Jo.a)(e)),e.onChangeFormParent=e.onChangeFormParent.bind(Object(Jo.a)(e)),e.onAddTerm=e.onAddTerm.bind(Object(Jo.a)(e)),e.onToggleForm=e.onToggleForm.bind(Object(Jo.a)(e)),e.setFilterValue=e.setFilterValue.bind(Object(Jo.a)(e)),e.sortBySelected=e.sortBySelected.bind(Object(Jo.a)(e)),e.state={loading:!0,availableTermsTree:[],availableTerms:[],adding:!1,formName:"",formParent:"",showForm:!1,filterValue:"",filteredTermsTree:[]},e}return Object(co.a)(r,[{key:"onChange",value:function(e){var t=this.props,n=t.onUpdateTerms,r=t.terms,o=void 0===r?[]:r,i=t.taxonomy;n(-1!==o.indexOf(e)?Object(v.without)(o,e):[].concat(Object(A.a)(o),[e]),i.rest_base)}},{key:"onChangeFormName",value:function(e){var t=""===e.target.value.trim()?"":e.target.value;this.setState({formName:t})}},{key:"onChangeFormParent",value:function(e){this.setState({formParent:e})}},{key:"onToggleForm",value:function(){this.setState((function(e){return{showForm:!e.showForm}}))}},{key:"findTerm",value:function(e,t,n){return Object(v.find)(e,(function(e){return(!e.parent&&!t||parseInt(e.parent)===parseInt(t))&&e.name.toLowerCase()===n.toLowerCase()}))}},{key:"onAddTerm",value:function(e){var t=this;e.preventDefault();var n=this.props,r=n.onUpdateTerms,o=n.taxonomy,i=n.terms,c=n.slug,a=this.state,s=a.formName,u=a.formParent,l=a.adding,d=a.availableTerms;if(""!==s&&!l){var p=this.findTerm(d,u,s);if(p)return Object(v.some)(i,(function(e){return e===p.id}))||r([].concat(Object(A.a)(i),[p.id]),o.rest_base),void this.setState({formName:"",formParent:""});this.setState({adding:!0}),this.addRequest=R()({path:"/wp/v2/".concat(o.rest_base),method:"POST",data:{name:s,parent:u||void 0}}),this.addRequest.catch((function(e){return"term_exists"===e.code?(t.addRequest=R()({path:Object(yt.addQueryArgs)("/wp/v2/".concat(o.rest_base),Gc({},qc,{parent:u||0,search:s}))}),t.addRequest.then((function(e){return t.findTerm(e,u,s)}))):Promise.reject(e)})).then((function(e){var n=!!Object(v.find)(t.state.availableTerms,(function(t){return t.id===e.id}))?t.state.availableTerms:[e].concat(Object(A.a)(t.state.availableTerms)),a=Object(I.sprintf)(
30 +/* translators: %s: taxonomy name */
31 +Object(I._x)("%s added","term"),Object(v.get)(t.props.taxonomy,["labels","singular_name"],"category"===c?Object(I.__)("Category"):Object(I.__)("Term")));t.props.speak(a,"assertive"),t.addRequest=null,t.setState({adding:!1,formName:"",formParent:"",availableTerms:n,availableTermsTree:t.sortBySelected(di(n))}),r([].concat(Object(A.a)(i),[e.id]),o.rest_base)}),(function(e){"abort"!==e.statusText&&(t.addRequest=null,t.setState({adding:!1}))}))}}},{key:"componentDidMount",value:function(){this.fetchTerms()}},{key:"componentWillUnmount",value:function(){Object(v.invoke)(this.fetchRequest,["abort"]),Object(v.invoke)(this.addRequest,["abort"])}},{key:"componentDidUpdate",value:function(e){this.props.taxonomy!==e.taxonomy&&this.fetchTerms()}},{key:"fetchTerms",value:function(){var e=this,t=this.props.taxonomy;t&&(this.fetchRequest=R()({path:Object(yt.addQueryArgs)("/wp/v2/".concat(t.rest_base),qc)}),this.fetchRequest.then((function(t){var n=e.sortBySelected(di(t));e.fetchRequest=null,e.setState({loading:!1,availableTermsTree:n,availableTerms:t})}),(function(t){"abort"!==t.statusText&&(e.fetchRequest=null,e.setState({loading:!1}))})))}},{key:"sortBySelected",value:function(e){var t=this.props.terms,n=function e(n){return-1!==t.indexOf(n.id)||void 0!==n.children&&!!(n.children.map(e).filter((function(e){return e})).length>0)};return e.sort((function(e,t){var r=n(e),o=n(t);return r===o?0:r&&!o?-1:!r&&o?1:0})),e}},{key:"setFilterValue",value:function(e){var t=this.state.availableTermsTree,n=e.target.value,r=t.map(this.getFilterMatcher(n)).filter((function(e){return e}));this.setState({filterValue:n,filteredTermsTree:r});var o=function e(t){for(var n=0,r=0;r<t.length;r++)n++,void 0!==t[r].children&&(n+=e(t[r].children));return n}(r),i=Object(I.sprintf)(
32 +/* translators: %d: number of results */
33 +Object(I._n)("%d result found.","%d results found.",o),o);this.props.debouncedSpeak(i,"assertive")}},{key:"getFilterMatcher",value:function(e){return function t(n){if(""===e)return n;var r=Gc({},n);return r.children.length>0&&(r.children=r.children.map(t).filter((function(e){return e}))),(-1!==r.name.toLowerCase().indexOf(e.toLowerCase())||r.children.length>0)&&r}}},{key:"renderTerms",value:function(e){var t=this,n=this.props.terms,r=void 0===n?[]:n;return e.map((function(e){return Object(Jr.createElement)("div",{key:e.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},Object(Jr.createElement)(Ro.CheckboxControl,{checked:-1!==r.indexOf(e.id),onChange:function(){var n=parseInt(e.id,10);t.onChange(n)},label:Object(v.unescape)(e.name)}),!!e.children.length&&Object(Jr.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-subchoices"},t.renderTerms(e.children)))}))}},{key:"render",value:function(){var e=this.props,t=e.slug,n=e.taxonomy,r=e.instanceId,o=e.hasCreateAction;if(!e.hasAssignAction)return null;var i=this.state,c=i.availableTermsTree,a=i.availableTerms,s=i.filteredTermsTree,u=i.formName,l=i.formParent,d=i.loading,p=i.showForm,b=i.filterValue,f=function(e,r,o){return Object(v.get)(n,["labels",e],"category"===t?r:o)},h=f("add_new_item",Object(I.__)("Add new category"),Object(I.__)("Add new term")),m=f("new_item_name",Object(I.__)("Add new category"),Object(I.__)("Add new term")),O=f("parent_item",Object(I.__)("Parent Category"),Object(I.__)("Parent Term")),g="— ".concat(O," —"),j=h,y="editor-post-taxonomies__hierarchical-terms-input-".concat(r),_="editor-post-taxonomies__hierarchical-terms-filter-".concat(r),k=Object(v.get)(this.props.taxonomy,["labels","search_items"],Object(I.__)("Search Terms")),E=Object(v.get)(this.props.taxonomy,["name"],Object(I.__)("Terms")),S=a.length>=8;return[S&&Object(Jr.createElement)("label",{key:"filter-label",htmlFor:_},k),S&&Object(Jr.createElement)("input",{type:"search",id:_,value:b,onChange:this.setFilterValue,className:"editor-post-taxonomies__hierarchical-terms-filter",key:"term-filter-input"}),Object(Jr.createElement)("div",{className:"editor-post-taxonomies__hierarchical-terms-list",key:"term-list",tabIndex:"0",role:"group","aria-label":E},this.renderTerms(""!==b?s:c)),!d&&o&&Object(Jr.createElement)(Ro.Button,{key:"term-add-button",onClick:this.onToggleForm,className:"editor-post-taxonomies__hierarchical-terms-add","aria-expanded":p,isLink:!0},h),p&&Object(Jr.createElement)("form",{onSubmit:this.onAddTerm,key:"hierarchical-terms-form"},Object(Jr.createElement)("label",{htmlFor:y,className:"editor-post-taxonomies__hierarchical-terms-label"},m),Object(Jr.createElement)("input",{type:"text",id:y,className:"editor-post-taxonomies__hierarchical-terms-input",value:u,onChange:this.onChangeFormName,required:!0}),!!a.length&&Object(Jr.createElement)(Ro.TreeSelect,{label:O,noOptionLabel:g,onChange:this.onChangeFormParent,selectedId:l,tree:c}),Object(Jr.createElement)(Ro.Button,{isSecondary:!0,type:"submit",className:"editor-post-taxonomies__hierarchical-terms-submit"},j))]}}]),r}(Jr.Component),Qc=Object(Zr.compose)([Object(p.withSelect)((function(e,t){var n=t.slug,r=e("core/editor").getCurrentPost,o=(0,e("core").getTaxonomy)(n);return{hasCreateAction:!!o&&Object(v.get)(r(),["_links","wp:action-create-"+o.rest_base],!1),hasAssignAction:!!o&&Object(v.get)(r(),["_links","wp:action-assign-"+o.rest_base],!1),terms:o?e("core/editor").getEditedPostAttribute(o.rest_base):[],taxonomy:o}})),Object(p.withDispatch)((function(e){return{onUpdateTerms:function(t,n){e("core/editor").editPost(Object(d.a)({},n,t))}}})),Ro.withSpokenMessages,Zr.withInstanceId,Object(Ro.withFilters)("editor.PostTaxonomyType")])($c);var Yc=Object(Zr.compose)([Object(p.withSelect)((function(e){return{postType:e("core/editor").getCurrentPostType(),taxonomies:e("core").getTaxonomies({per_page:-1})}}))])((function(e){var t=e.postType,n=e.taxonomies,r=e.taxonomyWrapper,o=void 0===r?v.identity:r,i=Object(v.filter)(n,(function(e){return Object(v.includes)(e.types,t)}));return Object(v.filter)(i,(function(e){return e.visibility.show_ui})).map((function(e){var t=e.hierarchical?Qc:fc;return Object(Jr.createElement)(Jr.Fragment,{key:"taxonomy-".concat(e.slug)},o(Object(Jr.createElement)(t,{slug:e.slug}),e))}))}));var Xc=Object(Zr.compose)([Object(p.withSelect)((function(e){return{postType:e("core/editor").getCurrentPostType(),taxonomies:e("core").getTaxonomies({per_page:-1})}}))])((function(e){var t=e.postType,n=e.taxonomies,r=e.children;return Object(v.some)(n,(function(e){return Object(v.includes)(e.types,t)}))?r:null})),Jc=n(89),Zc=n.n(Jc);function ea(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var ta=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(ea()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(){var e;return Object(io.a)(this,r),(e=n.apply(this,arguments)).edit=e.edit.bind(Object(Jo.a)(e)),e.stopEditing=e.stopEditing.bind(Object(Jo.a)(e)),e.state={},e}return Object(co.a)(r,[{key:"edit",value:function(e){var t=e.target.value;this.props.onChange(t),this.setState({value:t,isDirty:!0})}},{key:"stopEditing",value:function(){this.state.isDirty&&(this.props.onPersist(this.state.value),this.setState({isDirty:!1}))}},{key:"render",value:function(){var e=this.state.value,t=this.props.instanceId;return Object(Jr.createElement)(Jr.Fragment,null,Object(Jr.createElement)(Ro.VisuallyHidden,{as:"label",htmlFor:"post-content-".concat(t)},Object(I.__)("Type text or HTML")),Object(Jr.createElement)(Zc.a,{autoComplete:"off",dir:"auto",value:e,onChange:this.edit,onBlur:this.stopEditing,className:"editor-post-text-editor",id:"post-content-".concat(t),placeholder:Object(I.__)("Start writing with text or HTML")}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return t.isDirty?null:{value:e.value,isDirty:!1}}}]),r}(Jr.Component),na=Object(Zr.compose)([Object(p.withSelect)((function(e){return{value:(0,e("core/editor").getEditedPostContent)()}})),Object(p.withDispatch)((function(e){var t=e("core/editor"),n=t.editPost,r=t.resetEditorBlocks;return{onChange:function(e){n({content:e})},onPersist:function(e){var t=Object(c.parse)(e);r(t)}}})),Zr.withInstanceId])(ta);function ra(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var oa=/[\r\n]+/g,ia=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(ra()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(){var e;return Object(io.a)(this,r),(e=n.apply(this,arguments)).onChange=e.onChange.bind(Object(Jo.a)(e)),e.onSelect=e.onSelect.bind(Object(Jo.a)(e)),e.onUnselect=e.onUnselect.bind(Object(Jo.a)(e)),e.onKeyDown=e.onKeyDown.bind(Object(Jo.a)(e)),e.onPaste=e.onPaste.bind(Object(Jo.a)(e)),e.state={isSelected:!1},e}return Object(co.a)(r,[{key:"onSelect",value:function(){this.setState({isSelected:!0}),this.props.clearSelectedBlock()}},{key:"onUnselect",value:function(){this.setState({isSelected:!1})}},{key:"onChange",value:function(e){var t=e.target.value.replace(oa," ");this.props.onUpdate(t)}},{key:"onKeyDown",value:function(e){e.keyCode===Io.ENTER&&(e.preventDefault(),this.props.onEnterPress())}},{key:"onPaste",value:function(e){var t=this.props,n=t.title,r=t.onInsertBlockAfter,o=t.onUpdate,i=e.clipboardData,a="",s="";try{a=i.getData("text/plain"),s=i.getData("text/html")}catch(e){try{s=i.getData("Text")}catch(e){return}}window.console.log("Received HTML:\n\n",s),window.console.log("Received plain text:\n\n",a);var u=Object(c.pasteHandler)({HTML:s,plainText:a});if("string"!=typeof u&&u.length){e.preventDefault();var l=Object(Ot.a)(u,1)[0];n||"core/heading"!==l.name&&"core/paragraph"!==l.name?r(u):(o(l.attributes.content),r(u.slice(1)))}}},{key:"render",value:function(){var e=this.props,t=e.hasFixedToolbar,n=e.isCleanNewPost,r=e.isFocusMode,o=e.instanceId,i=e.placeholder,c=e.title,a=this.state.isSelected,s=ho()("wp-block editor-post-title editor-post-title__block",{"is-selected":a,"is-focus-mode":r,"has-fixed-toolbar":t}),u=Object(mi.decodeEntities)(i);return Object(Jr.createElement)(ci,{supportKeys:"title"},Object(Jr.createElement)("div",{className:s},Object(Jr.createElement)(Ro.VisuallyHidden,{as:"label",htmlFor:"post-title-".concat(o)},u||Object(I.__)("Add title")),Object(Jr.createElement)(Zc.a,{id:"post-title-".concat(o),className:"editor-post-title__input",value:c,onChange:this.onChange,placeholder:u||Object(I.__)("Add title"),onFocus:this.onSelect,onBlur:this.onUnselect,onKeyDown:this.onKeyDown,onKeyPress:this.onUnselect,onPaste:this.onPaste,autoFocus:(document.body===document.activeElement||!document.activeElement)&&n})))}}]),r}(Jr.Component),ca=Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.getEditedPostAttribute,r=t.isCleanNewPost,o=(0,e("core/block-editor").getSettings)(),i=o.titlePlaceholder,c=o.focusMode,a=o.hasFixedToolbar;return{isCleanNewPost:r(),title:n("title"),placeholder:i,isFocusMode:c,hasFixedToolbar:a}})),aa=Object(p.withDispatch)((function(e){var t=e("core/block-editor"),n=t.insertDefaultBlock,r=t.clearSelectedBlock,o=t.insertBlocks,i=e("core/editor").editPost;return{onEnterPress:function(){n(void 0,void 0,0)},onInsertBlockAfter:function(e){o(e,0)},onUpdate:function(e){i({title:e})},clearSelectedBlock:r}})),sa=Object(Zr.compose)(ca,aa,Zr.withInstanceId)(ia);var ua=Object(Zr.compose)([Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.isEditedPostNew,r=t.getCurrentPostId,o=t.getCurrentPostType;return{isNew:n(),postId:r(),postType:o()}})),Object(p.withDispatch)((function(e){return{trashPost:e("core/editor").trashPost}}))])((function(e){var t=e.isNew,n=e.postId,r=e.postType,o=Object(Xr.a)(e,["isNew","postId","postType"]);return t||!n?null:Object(Jr.createElement)(Ro.Button,{className:"editor-post-trash",isDestructive:!0,isTertiary:!0,onClick:function(){return o.trashPost(n,r)}},Object(I.__)("Move to trash"))}));var la=Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.isEditedPostNew,r=t.getCurrentPostId,o=t.getCurrentPostType,i=e("core"),c=i.getPostType,a=i.canUser,s=r(),u=c(o()),l=(null==u?void 0:u.rest_base)||"";return{isNew:n(),postId:s,canUserDelete:!(!s||!l)&&a("delete",l,s)}}))((function(e){var t=e.isNew,n=e.postId,r=e.canUserDelete,o=e.children;return!t&&n&&r?o:null}));var da=Object(Zr.compose)([Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.getCurrentPost,r=t.getCurrentPostType;return{hasPublishAction:Object(v.get)(n(),["_links","wp:action-publish"],!1),postType:r()}}))])((function(e){var t=e.hasPublishAction;return(0,e.render)({canEdit:t})})),pa=Object(Jr.createElement)(zo.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(Jr.createElement)(zo.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"})),ba=n(140);var fa=Object(p.withSelect)((function(e){return{content:e("core/editor").getEditedPostAttribute("content")}}))((function(e){var t=e.content,n=Object(I._x)("words","Word count type. Do not translate!");
3066 34 /*
3067 - * Backward compatibility
3068 - */
3069 -
3070 -/**
3071 - * Returns state object prior to a specified optimist transaction ID, or `null`
3072 - * if the transaction corresponding to the given ID cannot be found.
3073 - *
3074 - * @deprecated since Gutenberg 9.7.0.
3075 - */
3076 -
3077 -function getStateBeforeOptimisticTransaction() {
3078 - external_wp_deprecated_default()("select('core/editor').getStateBeforeOptimisticTransaction", {
3079 - since: '5.7',
3080 - hint: 'No state history is kept on this store anymore'
3081 - });
3082 - return null;
3083 -}
3084 -/**
3085 - * Returns true if an optimistic transaction is pending commit, for which the
3086 - * before state satisfies the given predicate function.
3087 - *
3088 - * @deprecated since Gutenberg 9.7.0.
3089 - */
3090 -
3091 -function inSomeHistory() {
3092 - external_wp_deprecated_default()("select('core/editor').inSomeHistory", {
3093 - since: '5.7',
3094 - hint: 'No state history is kept on this store anymore'
3095 - });
3096 - return false;
3097 -}
3098 -
3099 -function getBlockEditorSelector(name) {
3100 - return (0,external_wp_data_namespaceObject.createRegistrySelector)(select => function (state) {
3101 - external_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + '`', {
3102 - since: '5.3',
3103 - alternative: "`wp.data.select( 'core/block-editor' )." + name + '`',
3104 - version: '6.2'
3105 - });
3106 -
3107 - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
3108 - args[_key - 1] = arguments[_key];
3109 - }
3110 -
3111 - return select(external_wp_blockEditor_namespaceObject.store)[name](...args);
3112 - });
3113 -}
3114 -/**
3115 - * @see getBlockName in core/block-editor store.
3116 - */
3117 -
3118 -
3119 -const getBlockName = getBlockEditorSelector('getBlockName');
3120 -/**
3121 - * @see isBlockValid in core/block-editor store.
3122 - */
3123 -
3124 -const isBlockValid = getBlockEditorSelector('isBlockValid');
3125 -/**
3126 - * @see getBlockAttributes in core/block-editor store.
3127 - */
3128 -
3129 -const getBlockAttributes = getBlockEditorSelector('getBlockAttributes');
3130 -/**
3131 - * @see getBlock in core/block-editor store.
3132 - */
3133 -
3134 -const getBlock = getBlockEditorSelector('getBlock');
3135 -/**
3136 - * @see getBlocks in core/block-editor store.
3137 - */
3138 -
3139 -const getBlocks = getBlockEditorSelector('getBlocks');
3140 -/**
3141 - * @see getClientIdsOfDescendants in core/block-editor store.
3142 - */
3143 -
3144 -const getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants');
3145 -/**
3146 - * @see getClientIdsWithDescendants in core/block-editor store.
3147 - */
3148 -
3149 -const getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants');
3150 -/**
3151 - * @see getGlobalBlockCount in core/block-editor store.
3152 - */
3153 -
3154 -const getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount');
3155 -/**
3156 - * @see getBlocksByClientId in core/block-editor store.
3157 - */
3158 -
3159 -const getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId');
3160 -/**
3161 - * @see getBlockCount in core/block-editor store.
3162 - */
3163 -
3164 -const getBlockCount = getBlockEditorSelector('getBlockCount');
3165 -/**
3166 - * @see getBlockSelectionStart in core/block-editor store.
3167 - */
3168 -
3169 -const getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart');
3170 -/**
3171 - * @see getBlockSelectionEnd in core/block-editor store.
3172 - */
3173 -
3174 -const getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd');
3175 -/**
3176 - * @see getSelectedBlockCount in core/block-editor store.
3177 - */
3178 -
3179 -const getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount');
3180 -/**
3181 - * @see hasSelectedBlock in core/block-editor store.
3182 - */
3183 -
3184 -const hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock');
3185 -/**
3186 - * @see getSelectedBlockClientId in core/block-editor store.
3187 - */
3188 -
3189 -const getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId');
3190 -/**
3191 - * @see getSelectedBlock in core/block-editor store.
3192 - */
3193 -
3194 -const getSelectedBlock = getBlockEditorSelector('getSelectedBlock');
3195 -/**
3196 - * @see getBlockRootClientId in core/block-editor store.
3197 - */
3198 -
3199 -const getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId');
3200 -/**
3201 - * @see getBlockHierarchyRootClientId in core/block-editor store.
3202 - */
3203 -
3204 -const getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId');
3205 -/**
3206 - * @see getAdjacentBlockClientId in core/block-editor store.
3207 - */
3208 -
3209 -const getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId');
3210 -/**
3211 - * @see getPreviousBlockClientId in core/block-editor store.
3212 - */
3213 -
3214 -const getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId');
3215 -/**
3216 - * @see getNextBlockClientId in core/block-editor store.
3217 - */
3218 -
3219 -const getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId');
3220 -/**
3221 - * @see getSelectedBlocksInitialCaretPosition in core/block-editor store.
3222 - */
3223 -
3224 -const getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('getSelectedBlocksInitialCaretPosition');
3225 -/**
3226 - * @see getMultiSelectedBlockClientIds in core/block-editor store.
3227 - */
3228 -
3229 -const getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds');
3230 -/**
3231 - * @see getMultiSelectedBlocks in core/block-editor store.
3232 - */
3233 -
3234 -const getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks');
3235 -/**
3236 - * @see getFirstMultiSelectedBlockClientId in core/block-editor store.
3237 - */
3238 -
3239 -const getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId');
3240 -/**
3241 - * @see getLastMultiSelectedBlockClientId in core/block-editor store.
3242 - */
3243 -
3244 -const getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId');
3245 -/**
3246 - * @see isFirstMultiSelectedBlock in core/block-editor store.
3247 - */
3248 -
3249 -const isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock');
3250 -/**
3251 - * @see isBlockMultiSelected in core/block-editor store.
3252 - */
3253 -
3254 -const isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected');
3255 -/**
3256 - * @see isAncestorMultiSelected in core/block-editor store.
3257 - */
3258 -
3259 -const isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected');
3260 -/**
3261 - * @see getMultiSelectedBlocksStartClientId in core/block-editor store.
3262 - */
3263 -
3264 -const getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId');
3265 -/**
3266 - * @see getMultiSelectedBlocksEndClientId in core/block-editor store.
3267 - */
3268 -
3269 -const getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId');
3270 -/**
3271 - * @see getBlockOrder in core/block-editor store.
3272 - */
3273 -
3274 -const getBlockOrder = getBlockEditorSelector('getBlockOrder');
3275 -/**
3276 - * @see getBlockIndex in core/block-editor store.
3277 - */
3278 -
3279 -const getBlockIndex = getBlockEditorSelector('getBlockIndex');
3280 -/**
3281 - * @see isBlockSelected in core/block-editor store.
3282 - */
3283 -
3284 -const isBlockSelected = getBlockEditorSelector('isBlockSelected');
3285 -/**
3286 - * @see hasSelectedInnerBlock in core/block-editor store.
3287 - */
3288 -
3289 -const hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock');
3290 -/**
3291 - * @see isBlockWithinSelection in core/block-editor store.
3292 - */
3293 -
3294 -const isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection');
3295 -/**
3296 - * @see hasMultiSelection in core/block-editor store.
3297 - */
3298 -
3299 -const hasMultiSelection = getBlockEditorSelector('hasMultiSelection');
3300 -/**
3301 - * @see isMultiSelecting in core/block-editor store.
3302 - */
3303 -
3304 -const isMultiSelecting = getBlockEditorSelector('isMultiSelecting');
3305 -/**
3306 - * @see isSelectionEnabled in core/block-editor store.
3307 - */
3308 -
3309 -const isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled');
3310 -/**
3311 - * @see getBlockMode in core/block-editor store.
3312 - */
3313 -
3314 -const getBlockMode = getBlockEditorSelector('getBlockMode');
3315 -/**
3316 - * @see isTyping in core/block-editor store.
3317 - */
3318 -
3319 -const isTyping = getBlockEditorSelector('isTyping');
3320 -/**
3321 - * @see isCaretWithinFormattedText in core/block-editor store.
3322 - */
3323 -
3324 -const isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText');
3325 -/**
3326 - * @see getBlockInsertionPoint in core/block-editor store.
3327 - */
3328 -
3329 -const getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint');
3330 -/**
3331 - * @see isBlockInsertionPointVisible in core/block-editor store.
3332 - */
3333 -
3334 -const isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible');
3335 -/**
3336 - * @see isValidTemplate in core/block-editor store.
3337 - */
3338 -
3339 -const isValidTemplate = getBlockEditorSelector('isValidTemplate');
3340 -/**
3341 - * @see getTemplate in core/block-editor store.
3342 - */
3343 -
3344 -const getTemplate = getBlockEditorSelector('getTemplate');
3345 -/**
3346 - * @see getTemplateLock in core/block-editor store.
3347 - */
3348 -
3349 -const getTemplateLock = getBlockEditorSelector('getTemplateLock');
3350 -/**
3351 - * @see canInsertBlockType in core/block-editor store.
3352 - */
3353 -
3354 -const canInsertBlockType = getBlockEditorSelector('canInsertBlockType');
3355 -/**
3356 - * @see getInserterItems in core/block-editor store.
3357 - */
3358 -
3359 -const getInserterItems = getBlockEditorSelector('getInserterItems');
3360 -/**
3361 - * @see hasInserterItems in core/block-editor store.
3362 - */
3363 -
3364 -const hasInserterItems = getBlockEditorSelector('hasInserterItems');
3365 -/**
3366 - * @see getBlockListSettings in core/block-editor store.
3367 - */
3368 -
3369 -const getBlockListSettings = getBlockEditorSelector('getBlockListSettings');
3370 -/**
3371 - * Returns the default template types.
3372 - *
3373 - * @param {Object} state Global application state.
3374 - *
3375 - * @return {Object} The template types.
3376 - */
3377 -
3378 -function __experimentalGetDefaultTemplateTypes(state) {
3379 - var _getEditorSettings;
3380 -
3381 - return (_getEditorSettings = getEditorSettings(state)) === null || _getEditorSettings === void 0 ? void 0 : _getEditorSettings.defaultTemplateTypes;
3382 -}
3383 -/**
3384 - * Returns the default template part areas.
3385 - *
3386 - * @param {Object} state Global application state.
3387 - *
3388 - * @return {Array} The template part areas.
3389 - */
3390 -
3391 -const __experimentalGetDefaultTemplatePartAreas = rememo(state => {
3392 - var _getEditorSettings2;
3393 -
3394 - const areas = ((_getEditorSettings2 = getEditorSettings(state)) === null || _getEditorSettings2 === void 0 ? void 0 : _getEditorSettings2.defaultTemplatePartAreas) || [];
3395 - return areas === null || areas === void 0 ? void 0 : areas.map(item => {
3396 - return { ...item,
3397 - icon: getTemplatePartIcon(item.icon)
3398 - };
3399 - });
3400 -}, state => {
3401 - var _getEditorSettings3;
3402 -
3403 - return [(_getEditorSettings3 = getEditorSettings(state)) === null || _getEditorSettings3 === void 0 ? void 0 : _getEditorSettings3.defaultTemplatePartAreas];
3404 -});
3405 -/**
3406 - * Returns a default template type searched by slug.
3407 - *
3408 - * @param {Object} state Global application state.
3409 - * @param {string} slug The template type slug.
3410 - *
3411 - * @return {Object} The template type.
3412 - */
3413 -
3414 -const __experimentalGetDefaultTemplateType = rememo((state, slug) => (0,external_lodash_namespaceObject.find)(__experimentalGetDefaultTemplateTypes(state), {
3415 - slug
3416 -}) || {}, (state, slug) => [__experimentalGetDefaultTemplateTypes(state), slug]);
3417 -/**
3418 - * Given a template entity, return information about it which is ready to be
3419 - * rendered, such as the title, description, and icon.
3420 - *
3421 - * @param {Object} state Global application state.
3422 - * @param {Object} template The template for which we need information.
3423 - * @return {Object} Information about the template, including title, description, and icon.
3424 - */
3425 -
3426 -function __experimentalGetTemplateInfo(state, template) {
3427 - var _experimentalGetDefa;
3428 -
3429 - if (!template) {
3430 - return {};
3431 - }
3432 -
3433 - const {
3434 - excerpt,
3435 - slug,
3436 - title,
3437 - area
3438 - } = template;
3439 -
3440 - const {
3441 - title: defaultTitle,
3442 - description: defaultDescription
3443 - } = __experimentalGetDefaultTemplateType(state, slug);
3444 -
3445 - const templateTitle = (0,external_lodash_namespaceObject.isString)(title) ? title : title === null || title === void 0 ? void 0 : title.rendered;
3446 - const templateDescription = (0,external_lodash_namespaceObject.isString)(excerpt) ? excerpt : excerpt === null || excerpt === void 0 ? void 0 : excerpt.raw;
3447 - const templateIcon = ((_experimentalGetDefa = __experimentalGetDefaultTemplatePartAreas(state).find(item => area === item.area)) === null || _experimentalGetDefa === void 0 ? void 0 : _experimentalGetDefa.icon) || library_layout;
3448 - return {
3449 - title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug,
3450 - description: templateDescription || defaultDescription,
3451 - icon: templateIcon
3452 - };
3453 -}
3454 -/**
3455 - * Returns a post type label depending on the current post.
3456 - *
3457 - * @param {Object} state Global application state.
3458 - *
3459 - * @return {string|undefined} The post type label if available, otherwise undefined.
3460 - */
3461 -
3462 -const getPostTypeLabel = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
3463 - var _postType$labels;
3464 -
3465 - const currentPostType = getCurrentPostType(state);
3466 - const postType = select(external_wp_coreData_namespaceObject.store).getPostType(currentPostType); // Disable reason: Post type labels object is shaped like this.
3467 - // eslint-disable-next-line camelcase
3468 -
3469 - return postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.singular_name;
3470 -});
3471 -//# sourceMappingURL=selectors.js.map
3472 -;// CONCATENATED MODULE: external ["wp","notices"]
3473 -var external_wp_notices_namespaceObject = window["wp"]["notices"];
3474 -;// CONCATENATED MODULE: external ["wp","i18n"]
3475 -var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
3476 -;// CONCATENATED MODULE: ./packages/editor/build-module/store/utils/notice-builder.js
3477 -/**
3478 - * WordPress dependencies
3479 - */
3480 -
3481 -/**
3482 - * Internal dependencies
3483 - */
3484 -
3485 -
3486 -/**
3487 - * External dependencies
3488 - */
3489 -
3490 -
3491 -/**
3492 - * Builds the arguments for a success notification dispatch.
3493 - *
3494 - * @param {Object} data Incoming data to build the arguments from.
3495 - *
3496 - * @return {Array} Arguments for dispatch. An empty array signals no
3497 - * notification should be sent.
3498 - */
3499 -
3500 -function getNotificationArgumentsForSaveSuccess(data) {
3501 - const {
3502 - previousPost,
3503 - post,
3504 - postType
3505 - } = data; // Autosaves are neither shown a notice nor redirected.
3506 -
3507 - if ((0,external_lodash_namespaceObject.get)(data.options, ['isAutosave'])) {
3508 - return [];
3509 - }
3510 -
3511 - const publishStatus = ['publish', 'private', 'future'];
3512 - const isPublished = (0,external_lodash_namespaceObject.includes)(publishStatus, previousPost.status);
3513 - const willPublish = (0,external_lodash_namespaceObject.includes)(publishStatus, post.status);
3514 - let noticeMessage;
3515 - let shouldShowLink = (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false); // Always should a notice, which will be spoken for accessibility.
3516 -
3517 - if (!isPublished && !willPublish) {
3518 - // If saving a non-published post, don't show notice.
3519 - noticeMessage = (0,external_wp_i18n_namespaceObject.__)('Draft saved');
3520 - shouldShowLink = false;
3521 - } else if (isPublished && !willPublish) {
3522 - // If undoing publish status, show specific notice
3523 - noticeMessage = postType.labels.item_reverted_to_draft;
3524 - shouldShowLink = false;
3525 - } else if (!isPublished && willPublish) {
3526 - // If publishing or scheduling a post, show the corresponding
3527 - // publish message
3528 - noticeMessage = {
3529 - publish: postType.labels.item_published,
3530 - private: postType.labels.item_published_privately,
3531 - future: postType.labels.item_scheduled
3532 - }[post.status];
3533 - } else {
3534 - // Generic fallback notice
3535 - noticeMessage = postType.labels.item_updated;
3536 - }
3537 -
3538 - const actions = [];
3539 -
3540 - if (shouldShowLink) {
3541 - actions.push({
3542 - label: postType.labels.view_item,
3543 - url: post.link
3544 - });
3545 - }
3546 -
3547 - return [noticeMessage, {
3548 - id: SAVE_POST_NOTICE_ID,
3549 - type: 'snackbar',
3550 - actions
3551 - }];
3552 -}
3553 -/**
3554 - * Builds the fail notification arguments for dispatch.
3555 - *
3556 - * @param {Object} data Incoming data to build the arguments with.
3557 - *
3558 - * @return {Array} Arguments for dispatch. An empty array signals no
3559 - * notification should be sent.
3560 - */
3561 -
3562 -function getNotificationArgumentsForSaveFail(data) {
3563 - const {
3564 - post,
3565 - edits,
3566 - error
3567 - } = data;
3568 -
3569 - if (error && 'rest_autosave_no_changes' === error.code) {
3570 - // Autosave requested a new autosave, but there were no changes. This shouldn't
3571 - // result in an error notice for the user.
3572 - return [];
3573 - }
3574 -
3575 - const publishStatus = ['publish', 'private', 'future'];
3576 - const isPublished = publishStatus.indexOf(post.status) !== -1; // If the post was being published, we show the corresponding publish error message
3577 - // Unless we publish an "updating failed" message
3578 -
3579 - const messages = {
3580 - publish: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'),
3581 - private: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'),
3582 - future: (0,external_wp_i18n_namespaceObject.__)('Scheduling failed.')
3583 - };
3584 - let noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : (0,external_wp_i18n_namespaceObject.__)('Updating failed.'); // Check if message string contains HTML. Notice text is currently only
3585 - // supported as plaintext, and stripping the tags may muddle the meaning.
3586 -
3587 - if (error.message && !/<\/?[^>]*>/.test(error.message)) {
3588 - noticeMessage = [noticeMessage, error.message].join(' ');
3589 - }
3590 -
3591 - return [noticeMessage, {
3592 - id: SAVE_POST_NOTICE_ID
3593 - }];
3594 -}
3595 -/**
3596 - * Builds the trash fail notification arguments for dispatch.
3597 - *
3598 - * @param {Object} data
3599 - *
3600 - * @return {Array} Arguments for dispatch.
3601 - */
3602 -
3603 -function getNotificationArgumentsForTrashFail(data) {
3604 - return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : (0,external_wp_i18n_namespaceObject.__)('Trashing failed'), {
3605 - id: TRASH_POST_NOTICE_ID
3606 - }];
3607 -}
3608 -//# sourceMappingURL=notice-builder.js.map
3609 -;// CONCATENATED MODULE: ./packages/editor/build-module/store/actions.js
3610 -/**
3611 - * External dependencies
3612 - */
3613 -
3614 -/**
3615 - * WordPress dependencies
3616 - */
3617 -
3618 -
3619 -
3620 -
3621 -
3622 -
3623 -
3624 -
3625 -/**
3626 - * Internal dependencies
3627 - */
3628 -
3629 -
3630 -
3631 -/**
3632 - * Returns an action generator used in signalling that editor has initialized with
3633 - * the specified post object and editor settings.
3634 - *
3635 - * @param {Object} post Post object.
3636 - * @param {Object} edits Initial edited attributes object.
3637 - * @param {Array?} template Block Template.
3638 - */
3639 -
3640 -function* setupEditor(post, edits, template) {
3641 - yield resetPost(post);
3642 - yield {
3643 - type: 'SETUP_EDITOR',
3644 - post,
3645 - edits,
3646 - template
3647 - };
3648 - yield setupEditorState(post); // Apply a template for new posts only, if exists.
3649 -
3650 - const isNewPost = post.status === 'auto-draft';
3651 -
3652 - if (isNewPost && template) {
3653 - // In order to ensure maximum of a single parse during setup, edits are
3654 - // included as part of editor setup action. Assume edited content as
3655 - // canonical if provided, falling back to post.
3656 - let content;
3657 -
3658 - if ((0,external_lodash_namespaceObject.has)(edits, ['content'])) {
3659 - content = edits.content;
3660 - } else {
3661 - content = post.content.raw;
3662 - }
3663 -
3664 - let blocks = (0,external_wp_blocks_namespaceObject.parse)(content);
3665 - blocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template);
3666 - yield resetEditorBlocks(blocks, {
3667 - __unstableShouldCreateUndoLevel: false
3668 - });
3669 - }
3670 -
3671 - if (edits && Object.keys(edits).some(key => edits[key] !== ((0,external_lodash_namespaceObject.has)(post, [key, 'raw']) ? post[key].raw : post[key]))) {
3672 - yield editPost(edits);
3673 - }
3674 -}
3675 -/**
3676 - * Returns an action object signalling that the editor is being destroyed and
3677 - * that any necessary state or side-effect cleanup should occur.
3678 - *
3679 - * @return {Object} Action object.
3680 - */
3681 -
3682 -function __experimentalTearDownEditor() {
3683 - return {
3684 - type: 'TEAR_DOWN_EDITOR'
3685 - };
3686 -}
3687 -/**
3688 - * Returns an action object used in signalling that the latest version of the
3689 - * post has been received, either by initialization or save.
3690 - *
3691 - * @param {Object} post Post object.
3692 - *
3693 - * @return {Object} Action object.
3694 - */
3695 -
3696 -function resetPost(post) {
3697 - return {
3698 - type: 'RESET_POST',
3699 - post
3700 - };
3701 -}
3702 -/**
3703 - * Action for dispatching that a post update request has started.
3704 - *
3705 - * @param {Object} options
3706 - *
3707 - * @return {Object} An action object
3708 - */
3709 -
3710 -function __experimentalRequestPostUpdateStart() {
3711 - let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3712 - return {
3713 - type: 'REQUEST_POST_UPDATE_START',
3714 - options
3715 - };
3716 -}
3717 -/**
3718 - * Action for dispatching that a post update request has finished.
3719 - *
3720 - * @param {Object} options
3721 - *
3722 - * @return {Object} An action object
3723 - */
3724 -
3725 -function __experimentalRequestPostUpdateFinish() {
3726 - let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3727 - return {
3728 - type: 'REQUEST_POST_UPDATE_FINISH',
3729 - options
3730 - };
3731 -}
3732 -/**
3733 - * Returns an action object used in signalling that a patch of updates for the
3734 - * latest version of the post have been received.
3735 - *
3736 - * @return {Object} Action object.
3737 - * @deprecated since Gutenberg 9.7.0.
3738 - */
3739 -
3740 -function updatePost() {
3741 - external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", {
3742 - since: '5.7',
3743 - alternative: 'Use the core entities store instead'
3744 - });
3745 - return {
3746 - type: 'DO_NOTHING'
3747 - };
3748 -}
3749 -/**
3750 - * Returns an action object used to setup the editor state when first opening
3751 - * an editor.
3752 - *
3753 - * @param {Object} post Post object.
3754 - *
3755 - * @return {Object} Action object.
3756 - */
3757 -
3758 -function setupEditorState(post) {
3759 - return {
3760 - type: 'SETUP_EDITOR_STATE',
3761 - post
3762 - };
3763 -}
3764 -/**
3765 - * Returns an action object used in signalling that attributes of the post have
3766 - * been edited.
3767 - *
3768 - * @param {Object} edits Post attributes to edit.
3769 - * @param {Object} options Options for the edit.
3770 - *
3771 - * @yield {Object} Action object or control.
3772 - */
3773 -
3774 -function* editPost(edits, options) {
3775 - const {
3776 - id,
3777 - type
3778 - } = yield external_wp_data_namespaceObject.controls.select(STORE_NAME, 'getCurrentPost');
3779 - yield external_wp_data_namespaceObject.controls.dispatch(external_wp_coreData_namespaceObject.store, 'editEntityRecord', 'postType', type, id, edits, options);
3780 -}
3781 -/**
3782 - * Action generator for saving the current post in the editor.
3783 - *
3784 - * @param {Object} options
3785 - */
3786 -
3787 -function* savePost() {
3788 - let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3789 -
3790 - if (!(yield external_wp_data_namespaceObject.controls.select(STORE_NAME, 'isEditedPostSaveable'))) {
3791 - return;
3792 - }
3793 -
3794 - let edits = {
3795 - content: yield external_wp_data_namespaceObject.controls.select(STORE_NAME, 'getEditedPostContent')
3796 - };
3797 -
3798 - if (!options.isAutosave) {
3799 - yield external_wp_data_namespaceObject.controls.dispatch(STORE_NAME, 'editPost', edits, {
3800 - undoIgnore: true
3801 - });
3802 - }
3803 -
3804 - yield __experimentalRequestPostUpdateStart(options);
3805 - const previousRecord = yield external_wp_data_namespaceObject.controls.select(STORE_NAME, 'getCurrentPost');
3806 - edits = {
3807 - id: previousRecord.id,
3808 - ...(yield external_wp_data_namespaceObject.controls.select(external_wp_coreData_namespaceObject.store, 'getEntityRecordNonTransientEdits', 'postType', previousRecord.type, previousRecord.id)),
3809 - ...edits
3810 - };
3811 - yield external_wp_data_namespaceObject.controls.dispatch(external_wp_coreData_namespaceObject.store, 'saveEntityRecord', 'postType', previousRecord.type, edits, options);
3812 - yield __experimentalRequestPostUpdateFinish(options);
3813 - const error = yield external_wp_data_namespaceObject.controls.select(external_wp_coreData_namespaceObject.store, 'getLastEntitySaveError', 'postType', previousRecord.type, previousRecord.id);
3814 -
3815 - if (error) {
3816 - const args = getNotificationArgumentsForSaveFail({
3817 - post: previousRecord,
3818 - edits,
3819 - error
3820 - });
3821 -
3822 - if (args.length) {
3823 - yield external_wp_data_namespaceObject.controls.dispatch(external_wp_notices_namespaceObject.store, 'createErrorNotice', ...args);
3824 - }
3825 - } else {
3826 - const updatedRecord = yield external_wp_data_namespaceObject.controls.select(STORE_NAME, 'getCurrentPost');
3827 - const args = getNotificationArgumentsForSaveSuccess({
3828 - previousPost: previousRecord,
3829 - post: updatedRecord,
3830 - postType: yield external_wp_data_namespaceObject.controls.resolveSelect(external_wp_coreData_namespaceObject.store, 'getPostType', updatedRecord.type),
3831 - options
3832 - });
3833 -
3834 - if (args.length) {
3835 - yield external_wp_data_namespaceObject.controls.dispatch(external_wp_notices_namespaceObject.store, 'createSuccessNotice', ...args);
3836 - } // Make sure that any edits after saving create an undo level and are
3837 - // considered for change detection.
3838 -
3839 -
3840 - if (!options.isAutosave) {
3841 - yield external_wp_data_namespaceObject.controls.dispatch(external_wp_blockEditor_namespaceObject.store, '__unstableMarkLastChangeAsPersistent');
3842 - }
3843 - }
3844 -}
3845 -/**
3846 - * Action for refreshing the current post.
3847 - *
3848 - * @deprecated Since WordPress 6.0.
3849 - */
3850 -
3851 -function refreshPost() {
3852 - external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).refreshPost", {
3853 - since: '6.0',
3854 - version: '6.3',
3855 - alternative: 'Use the core entities store instead'
3856 - });
3857 - return {
3858 - type: 'DO_NOTHING'
3859 - };
3860 -}
3861 -/**
3862 - * Action generator for trashing the current post in the editor.
3863 - */
3864 -
3865 -function* trashPost() {
3866 - const postTypeSlug = yield external_wp_data_namespaceObject.controls.select(STORE_NAME, 'getCurrentPostType');
3867 - const postType = yield external_wp_data_namespaceObject.controls.resolveSelect(external_wp_coreData_namespaceObject.store, 'getPostType', postTypeSlug);
3868 - yield external_wp_data_namespaceObject.controls.dispatch(external_wp_notices_namespaceObject.store, 'removeNotice', TRASH_POST_NOTICE_ID);
3869 -
3870 - try {
3871 - const post = yield external_wp_data_namespaceObject.controls.select(STORE_NAME, 'getCurrentPost');
3872 - yield (0,external_wp_dataControls_namespaceObject.apiFetch)({
3873 - path: `/wp/v2/${postType.rest_base}/${post.id}`,
3874 - method: 'DELETE'
3875 - });
3876 - yield external_wp_data_namespaceObject.controls.dispatch(STORE_NAME, 'savePost');
3877 - } catch (error) {
3878 - yield external_wp_data_namespaceObject.controls.dispatch(external_wp_notices_namespaceObject.store, 'createErrorNotice', ...getNotificationArgumentsForTrashFail({
3879 - error
3880 - }));
3881 - }
3882 -}
3883 -/**
3884 - * Action generator used in signalling that the post should autosave. This
3885 - * includes server-side autosaving (default) and client-side (a.k.a. local)
3886 - * autosaving (e.g. on the Web, the post might be committed to Session
3887 - * Storage).
3888 - *
3889 - * @param {Object?} options Extra flags to identify the autosave.
3890 - */
3891 -
3892 -function* autosave() {
3893 - let {
3894 - local = false,
3895 - ...options
3896 - } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3897 -
3898 - if (local) {
3899 - const post = yield external_wp_data_namespaceObject.controls.select(STORE_NAME, 'getCurrentPost');
3900 - const isPostNew = yield external_wp_data_namespaceObject.controls.select(STORE_NAME, 'isEditedPostNew');
3901 - const title = yield external_wp_data_namespaceObject.controls.select(STORE_NAME, 'getEditedPostAttribute', 'title');
3902 - const content = yield external_wp_data_namespaceObject.controls.select(STORE_NAME, 'getEditedPostAttribute', 'content');
3903 - const excerpt = yield external_wp_data_namespaceObject.controls.select(STORE_NAME, 'getEditedPostAttribute', 'excerpt');
3904 - yield {
3905 - type: 'LOCAL_AUTOSAVE_SET',
3906 - postId: post.id,
3907 - isPostNew,
3908 - title,
3909 - content,
3910 - excerpt
3911 - };
3912 - } else {
3913 - yield external_wp_data_namespaceObject.controls.dispatch(STORE_NAME, 'savePost', {
3914 - isAutosave: true,
3915 - ...options
3916 - });
3917 - }
3918 -}
3919 -/**
3920 - * Returns an action object used in signalling that undo history should
3921 - * restore last popped state.
3922 - *
3923 - * @yield {Object} Action object.
3924 - */
3925 -
3926 -function* redo() {
3927 - yield external_wp_data_namespaceObject.controls.dispatch(external_wp_coreData_namespaceObject.store, 'redo');
3928 -}
3929 -/**
3930 - * Returns an action object used in signalling that undo history should pop.
3931 - *
3932 - * @yield {Object} Action object.
3933 - */
3934 -
3935 -function* undo() {
3936 - yield external_wp_data_namespaceObject.controls.dispatch(external_wp_coreData_namespaceObject.store, 'undo');
3937 -}
3938 -/**
3939 - * Action that creates an undo history record.
3940 - *
3941 - * @deprecated Since WordPress 6.0
3942 - */
3943 -
3944 -function createUndoLevel() {
3945 - external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).createUndoLevel", {
3946 - since: '6.0',
3947 - version: '6.3',
3948 - alternative: 'Use the core entities store instead'
3949 - });
3950 - return {
3951 - type: 'DO_NOTHING'
3952 - };
3953 -}
3954 -/**
3955 - * Returns an action object used to lock the editor.
3956 - *
3957 - * @param {Object} lock Details about the post lock status, user, and nonce.
3958 - *
3959 - * @return {Object} Action object.
3960 - */
3961 -
3962 -function updatePostLock(lock) {
3963 - return {
3964 - type: 'UPDATE_POST_LOCK',
3965 - lock
3966 - };
3967 -}
3968 -/**
3969 - * Returns an action object used in signalling that the user has enabled the
3970 - * publish sidebar.
3971 - *
3972 - * @return {Object} Action object
3973 - */
3974 -
3975 -function enablePublishSidebar() {
3976 - return {
3977 - type: 'ENABLE_PUBLISH_SIDEBAR'
3978 - };
3979 -}
3980 -/**
3981 - * Returns an action object used in signalling that the user has disabled the
3982 - * publish sidebar.
3983 - *
3984 - * @return {Object} Action object
3985 - */
3986 -
3987 -function disablePublishSidebar() {
3988 - return {
3989 - type: 'DISABLE_PUBLISH_SIDEBAR'
3990 - };
3991 -}
3992 -/**
3993 - * Returns an action object used to signal that post saving is locked.
3994 - *
3995 - * @param {string} lockName The lock name.
3996 - *
3997 - * @example
3998 - * ```
3999 - * const { subscribe } = wp.data;
4000 - *
4001 - * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );
4002 - *
4003 - * // Only allow publishing posts that are set to a future date.
4004 - * if ( 'publish' !== initialPostStatus ) {
4005 - *
4006 - * // Track locking.
4007 - * let locked = false;
4008 - *
4009 - * // Watch for the publish event.
4010 - * let unssubscribe = subscribe( () => {
4011 - * const currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );
4012 - * if ( 'publish' !== currentPostStatus ) {
4013 - *
4014 - * // Compare the post date to the current date, lock the post if the date isn't in the future.
4015 - * const postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) );
4016 - * const currentDate = new Date();
4017 - * if ( postDate.getTime() <= currentDate.getTime() ) {
4018 - * if ( ! locked ) {
4019 - * locked = true;
4020 - * wp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' );
4021 - * }
4022 - * } else {
4023 - * if ( locked ) {
4024 - * locked = false;
4025 - * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' );
4026 - * }
4027 - * }
4028 - * }
4029 - * } );
4030 - * }
4031 - * ```
4032 - *
4033 - * @return {Object} Action object
4034 - */
4035 -
4036 -function lockPostSaving(lockName) {
4037 - return {
4038 - type: 'LOCK_POST_SAVING',
4039 - lockName
4040 - };
4041 -}
4042 -/**
4043 - * Returns an action object used to signal that post saving is unlocked.
4044 - *
4045 - * @param {string} lockName The lock name.
4046 - *
4047 - * @example
4048 - * ```
4049 - * // Unlock post saving with the lock key `mylock`:
4050 - * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' );
4051 - * ```
4052 - *
4053 - * @return {Object} Action object
4054 - */
4055 -
4056 -function unlockPostSaving(lockName) {
4057 - return {
4058 - type: 'UNLOCK_POST_SAVING',
4059 - lockName
4060 - };
4061 -}
4062 -/**
4063 - * Returns an action object used to signal that post autosaving is locked.
4064 - *
4065 - * @param {string} lockName The lock name.
4066 - *
4067 - * @example
4068 - * ```
4069 - * // Lock post autosaving with the lock key `mylock`:
4070 - * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' );
4071 - * ```
4072 - *
4073 - * @return {Object} Action object
4074 - */
4075 -
4076 -function lockPostAutosaving(lockName) {
4077 - return {
4078 - type: 'LOCK_POST_AUTOSAVING',
4079 - lockName
4080 - };
4081 -}
4082 -/**
4083 - * Returns an action object used to signal that post autosaving is unlocked.
4084 - *
4085 - * @param {string} lockName The lock name.
4086 - *
4087 - * @example
4088 - * ```
4089 - * // Unlock post saving with the lock key `mylock`:
4090 - * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' );
4091 - * ```
4092 - *
4093 - * @return {Object} Action object
4094 - */
4095 -
4096 -function unlockPostAutosaving(lockName) {
4097 - return {
4098 - type: 'UNLOCK_POST_AUTOSAVING',
4099 - lockName
4100 - };
4101 -}
4102 -/**
4103 - * Returns an action object used to signal that the blocks have been updated.
4104 - *
4105 - * @param {Array} blocks Block Array.
4106 - * @param {?Object} options Optional options.
4107 - *
4108 - * @yield {Object} Action object
4109 - */
4110 -
4111 -function* resetEditorBlocks(blocks) {
4112 - let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4113 - const {
4114 - __unstableShouldCreateUndoLevel,
4115 - selection
4116 - } = options;
4117 - const edits = {
4118 - blocks,
4119 - selection
4120 - };
4121 -
4122 - if (__unstableShouldCreateUndoLevel !== false) {
4123 - const {
4124 - id,
4125 - type
4126 - } = yield external_wp_data_namespaceObject.controls.select(STORE_NAME, 'getCurrentPost');
4127 - const noChange = (yield external_wp_data_namespaceObject.controls.select(external_wp_coreData_namespaceObject.store, 'getEditedEntityRecord', 'postType', type, id)).blocks === edits.blocks;
4128 -
4129 - if (noChange) {
4130 - return yield external_wp_data_namespaceObject.controls.dispatch(external_wp_coreData_namespaceObject.store, '__unstableCreateUndoLevel', 'postType', type, id);
4131 - } // We create a new function here on every persistent edit
4132 - // to make sure the edit makes the post dirty and creates
4133 - // a new undo level.
4134 -
4135 -
4136 - edits.content = _ref => {
4137 - let {
4138 - blocks: blocksForSerialization = []
4139 - } = _ref;
4140 - return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization);
4141 - };
4142 - }
4143 -
4144 - yield* editPost(edits);
4145 -}
4146 -/*
4147 - * Returns an action object used in signalling that the post editor settings have been updated.
4148 - *
4149 - * @param {Object} settings Updated settings
4150 - *
4151 - * @return {Object} Action object
4152 - */
4153 -
4154 -function updateEditorSettings(settings) {
4155 - return {
4156 - type: 'UPDATE_EDITOR_SETTINGS',
4157 - settings
4158 - };
4159 -}
4160 -/**
4161 - * Backward compatibility
4162 - */
4163 -
4164 -const getBlockEditorAction = name => function* () {
4165 - external_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + '`', {
4166 - since: '5.3',
4167 - alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`',
4168 - version: '6.2'
4169 - });
4170 -
4171 - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
4172 - args[_key] = arguments[_key];
4173 - }
4174 -
4175 - yield external_wp_data_namespaceObject.controls.dispatch(external_wp_blockEditor_namespaceObject.store, name, ...args);
4176 -};
4177 -/**
4178 - * @see resetBlocks in core/block-editor store.
4179 - */
4180 -
4181 -
4182 -const resetBlocks = getBlockEditorAction('resetBlocks');
4183 -/**
4184 - * @see receiveBlocks in core/block-editor store.
4185 - */
4186 -
4187 -const receiveBlocks = getBlockEditorAction('receiveBlocks');
4188 -/**
4189 - * @see updateBlock in core/block-editor store.
4190 - */
4191 -
4192 -const updateBlock = getBlockEditorAction('updateBlock');
4193 -/**
4194 - * @see updateBlockAttributes in core/block-editor store.
4195 - */
4196 -
4197 -const updateBlockAttributes = getBlockEditorAction('updateBlockAttributes');
4198 -/**
4199 - * @see selectBlock in core/block-editor store.
4200 - */
4201 -
4202 -const selectBlock = getBlockEditorAction('selectBlock');
4203 -/**
4204 - * @see startMultiSelect in core/block-editor store.
4205 - */
4206 -
4207 -const startMultiSelect = getBlockEditorAction('startMultiSelect');
4208 -/**
4209 - * @see stopMultiSelect in core/block-editor store.
4210 - */
4211 -
4212 -const stopMultiSelect = getBlockEditorAction('stopMultiSelect');
4213 -/**
4214 - * @see multiSelect in core/block-editor store.
4215 - */
4216 -
4217 -const multiSelect = getBlockEditorAction('multiSelect');
4218 -/**
4219 - * @see clearSelectedBlock in core/block-editor store.
4220 - */
4221 -
4222 -const clearSelectedBlock = getBlockEditorAction('clearSelectedBlock');
4223 -/**
4224 - * @see toggleSelection in core/block-editor store.
4225 - */
4226 -
4227 -const toggleSelection = getBlockEditorAction('toggleSelection');
4228 -/**
4229 - * @see replaceBlocks in core/block-editor store.
4230 - */
4231 -
4232 -const replaceBlocks = getBlockEditorAction('replaceBlocks');
4233 -/**
4234 - * @see replaceBlock in core/block-editor store.
4235 - */
4236 -
4237 -const replaceBlock = getBlockEditorAction('replaceBlock');
4238 -/**
4239 - * @see moveBlocksDown in core/block-editor store.
4240 - */
4241 -
4242 -const moveBlocksDown = getBlockEditorAction('moveBlocksDown');
4243 -/**
4244 - * @see moveBlocksUp in core/block-editor store.
4245 - */
4246 -
4247 -const moveBlocksUp = getBlockEditorAction('moveBlocksUp');
4248 -/**
4249 - * @see moveBlockToPosition in core/block-editor store.
4250 - */
4251 -
4252 -const moveBlockToPosition = getBlockEditorAction('moveBlockToPosition');
4253 -/**
4254 - * @see insertBlock in core/block-editor store.
4255 - */
4256 -
4257 -const insertBlock = getBlockEditorAction('insertBlock');
4258 -/**
4259 - * @see insertBlocks in core/block-editor store.
4260 - */
4261 -
4262 -const insertBlocks = getBlockEditorAction('insertBlocks');
4263 -/**
4264 - * @see showInsertionPoint in core/block-editor store.
4265 - */
4266 -
4267 -const showInsertionPoint = getBlockEditorAction('showInsertionPoint');
4268 -/**
4269 - * @see hideInsertionPoint in core/block-editor store.
4270 - */
4271 -
4272 -const hideInsertionPoint = getBlockEditorAction('hideInsertionPoint');
4273 -/**
4274 - * @see setTemplateValidity in core/block-editor store.
4275 - */
4276 -
4277 -const setTemplateValidity = getBlockEditorAction('setTemplateValidity');
4278 -/**
4279 - * @see synchronizeTemplate in core/block-editor store.
4280 - */
4281 -
4282 -const synchronizeTemplate = getBlockEditorAction('synchronizeTemplate');
4283 -/**
4284 - * @see mergeBlocks in core/block-editor store.
4285 - */
4286 -
4287 -const mergeBlocks = getBlockEditorAction('mergeBlocks');
4288 -/**
4289 - * @see removeBlocks in core/block-editor store.
4290 - */
4291 -
4292 -const removeBlocks = getBlockEditorAction('removeBlocks');
4293 -/**
4294 - * @see removeBlock in core/block-editor store.
4295 - */
4296 -
4297 -const removeBlock = getBlockEditorAction('removeBlock');
4298 -/**
4299 - * @see toggleBlockMode in core/block-editor store.
4300 - */
4301 -
4302 -const toggleBlockMode = getBlockEditorAction('toggleBlockMode');
4303 -/**
4304 - * @see startTyping in core/block-editor store.
4305 - */
4306 -
4307 -const startTyping = getBlockEditorAction('startTyping');
4308 -/**
4309 - * @see stopTyping in core/block-editor store.
4310 - */
4311 -
4312 -const stopTyping = getBlockEditorAction('stopTyping');
4313 -/**
4314 - * @see enterFormattedText in core/block-editor store.
4315 - */
4316 -
4317 -const enterFormattedText = getBlockEditorAction('enterFormattedText');
4318 -/**
4319 - * @see exitFormattedText in core/block-editor store.
4320 - */
4321 -
4322 -const exitFormattedText = getBlockEditorAction('exitFormattedText');
4323 -/**
4324 - * @see insertDefaultBlock in core/block-editor store.
4325 - */
4326 -
4327 -const insertDefaultBlock = getBlockEditorAction('insertDefaultBlock');
4328 -/**
4329 - * @see updateBlockListSettings in core/block-editor store.
4330 - */
4331 -
4332 -const updateBlockListSettings = getBlockEditorAction('updateBlockListSettings');
4333 -//# sourceMappingURL=actions.js.map
4334 -;// CONCATENATED MODULE: ./packages/editor/build-module/store/controls.js
4335 -/**
4336 - * Function returning a sessionStorage key to set or retrieve a given post's
4337 - * automatic session backup.
4338 - *
4339 - * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's
4340 - * `loggedout` handler can clear sessionStorage of any user-private content.
4341 - *
4342 - * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103
4343 - *
4344 - * @param {string} postId Post ID.
4345 - * @param {boolean} isPostNew Whether post new.
4346 - *
4347 - * @return {string} sessionStorage key
4348 - */
4349 -function postKey(postId, isPostNew) {
4350 - return `wp-autosave-block-editor-post-${isPostNew ? 'auto-draft' : postId}`;
4351 -}
4352 -
4353 -function localAutosaveGet(postId, isPostNew) {
4354 - return window.sessionStorage.getItem(postKey(postId, isPostNew));
4355 -}
4356 -function localAutosaveSet(postId, isPostNew, title, content, excerpt) {
4357 - window.sessionStorage.setItem(postKey(postId, isPostNew), JSON.stringify({
4358 - post_title: title,
4359 - content,
4360 - excerpt
4361 - }));
4362 -}
4363 -function localAutosaveClear(postId, isPostNew) {
4364 - window.sessionStorage.removeItem(postKey(postId, isPostNew));
4365 -}
4366 -const controls = {
4367 - LOCAL_AUTOSAVE_SET(_ref) {
4368 - let {
4369 - postId,
4370 - isPostNew,
4371 - title,
4372 - content,
4373 - excerpt
4374 - } = _ref;
4375 - localAutosaveSet(postId, isPostNew, title, content, excerpt);
4376 - }
4377 -
4378 -};
4379 -/* harmony default export */ var store_controls = (controls);
4380 -//# sourceMappingURL=controls.js.map
4381 -;// CONCATENATED MODULE: ./packages/editor/build-module/store/index.js
4382 -/**
4383 - * WordPress dependencies
4384 - */
4385 -
4386 -
4387 -/**
4388 - * Internal dependencies
4389 - */
4390 -
4391 -
4392 -
4393 -
4394 -
4395 -
4396 -/**
4397 - * Post editor data store configuration.
4398 - *
4399 - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore
4400 - *
4401 - * @type {Object}
4402 - */
4403 -
4404 -const storeConfig = {
4405 - reducer: reducer,
4406 - selectors: selectors_namespaceObject,
4407 - actions: actions_namespaceObject,
4408 - controls: { ...external_wp_dataControls_namespaceObject.controls,
4409 - ...store_controls
4410 - }
4411 -};
4412 -/**
4413 - * Store definition for the editor namespace.
4414 - *
4415 - * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
4416 - *
4417 - * @type {Object}
4418 - */
4419 -
4420 -const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { ...storeConfig,
4421 - persist: ['preferences']
4422 -}); // Once we build a more generic persistence plugin that works across types of stores
4423 -// we'd be able to replace this with a register call.
4424 -
4425 -(0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, { ...storeConfig,
4426 - persist: ['preferences']
4427 -});
4428 -//# sourceMappingURL=index.js.map
4429 -;// CONCATENATED MODULE: ./packages/editor/build-module/hooks/custom-sources-backwards-compatibility.js
4430 -
4431 -
4432 -
4433 -/**
4434 - * External dependencies
4435 - */
4436 -
4437 -/**
4438 - * WordPress dependencies
4439 - */
4440 -
4441 -
4442 -
4443 -
4444 -
4445 -
4446 -
4447 -/**
4448 - * Internal dependencies
4449 - */
4450 -
4451 -
4452 -/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */
4453 -
4454 -/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */
4455 -
4456 -/**
4457 - * Object whose keys are the names of block attributes, where each value
4458 - * represents the meta key to which the block attribute is intended to save.
4459 - *
4460 - * @see https://developer.wordpress.org/reference/functions/register_meta/
4461 - *
4462 - * @typedef {Object<string,string>} WPMetaAttributeMapping
4463 - */
4464 -
4465 -/**
4466 - * Given a mapping of attribute names (meta source attributes) to their
4467 - * associated meta key, returns a higher order component that overrides its
4468 - * `attributes` and `setAttributes` props to sync any changes with the edited
4469 - * post's meta keys.
4470 - *
4471 - * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.
4472 - *
4473 - * @return {WPHigherOrderComponent} Higher-order component.
4474 - */
4475 -
4476 -const createWithMetaAttributeSource = metaAttributes => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => _ref => {
4477 - let {
4478 - attributes,
4479 - setAttributes,
4480 - ...props
4481 - } = _ref;
4482 - const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getCurrentPostType(), []);
4483 - const [meta, setMeta] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'meta');
4484 - const mergedAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...attributes,
4485 - ...(0,external_lodash_namespaceObject.mapValues)(metaAttributes, metaKey => meta[metaKey])
4486 - }), [attributes, meta]);
4487 - return (0,external_wp_element_namespaceObject.createElement)(BlockEdit, _extends({
4488 - attributes: mergedAttributes,
4489 - setAttributes: nextAttributes => {
4490 - const nextMeta = (0,external_lodash_namespaceObject.mapKeys)( // Filter to intersection of keys between the updated
4491 - // attributes and those with an associated meta key.
4492 - (0,external_lodash_namespaceObject.pickBy)(nextAttributes, (value, key) => metaAttributes[key]), // Rename the keys to the expected meta key name.
4493 - (value, attributeKey) => metaAttributes[attributeKey]);
4494 -
4495 - if (!(0,external_lodash_namespaceObject.isEmpty)(nextMeta)) {
4496 - setMeta(nextMeta);
4497 - }
4498 -
4499 - setAttributes(nextAttributes);
4500 - }
4501 - }, props));
4502 -}, 'withMetaAttributeSource');
4503 -/**
4504 - * Filters a registered block's settings to enhance a block's `edit` component
4505 - * to upgrade meta-sourced attributes to use the post's meta entity property.
4506 - *
4507 - * @param {WPBlockSettings} settings Registered block settings.
4508 - *
4509 - * @return {WPBlockSettings} Filtered block settings.
4510 - */
4511 -
4512 -
4513 -function shimAttributeSource(settings) {
4514 - /** @type {WPMetaAttributeMapping} */
4515 - const metaAttributes = (0,external_lodash_namespaceObject.mapValues)((0,external_lodash_namespaceObject.pickBy)(settings.attributes, {
4516 - source: 'meta'
4517 - }), 'meta');
4518 -
4519 - if (!(0,external_lodash_namespaceObject.isEmpty)(metaAttributes)) {
4520 - settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit);
4521 - }
4522 -
4523 - return settings;
4524 -}
4525 -
4526 -(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource); // The above filter will only capture blocks registered after the filter was
4527 -// added. There may already be blocks registered by this point, and those must
4528 -// be updated to apply the shim.
4529 -//
4530 -// The following implementation achieves this, albeit with a couple caveats:
4531 -// - Only blocks registered on the global store will be modified.
4532 -// - The block settings are directly mutated, since there is currently no
4533 -// mechanism to update an existing block registration. This is the reason for
4534 -// `getBlockType` separate from `getBlockTypes`, since the latter returns a
4535 -// _copy_ of the block registration (i.e. the mutation would not affect the
4536 -// actual registered block settings).
4537 -//
4538 -// `getBlockTypes` or `getBlockType` implementation could change in the future
4539 -// in regards to creating settings clones, but the corresponding end-to-end
4540 -// tests for meta blocks should cover against any potential regressions.
4541 -//
4542 -// In the future, we could support updating block settings, at which point this
4543 -// implementation could use that mechanism instead.
4544 -
4545 -(0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getBlockTypes().map(_ref2 => {
4546 - let {
4547 - name
4548 - } = _ref2;
4549 - return (0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getBlockType(name);
4550 -}).forEach(shimAttributeSource);
4551 -//# sourceMappingURL=custom-sources-backwards-compatibility.js.map
4552 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/autocompleters/user.js
4553 -
4554 -
4555 -/**
4556 - * WordPress dependencies
4557 - */
4558 -
4559 -
4560 -
4561 -/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */
4562 -
4563 -function getUserLabel(user) {
4564 - const avatar = user.avatar_urls && user.avatar_urls[24] ? (0,external_wp_element_namespaceObject.createElement)("img", {
4565 - className: "editor-autocompleters__user-avatar",
4566 - alt: "",
4567 - src: user.avatar_urls[24]
4568 - }) : (0,external_wp_element_namespaceObject.createElement)("span", {
4569 - className: "editor-autocompleters__no-avatar"
4570 - });
4571 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, avatar, (0,external_wp_element_namespaceObject.createElement)("span", {
4572 - className: "editor-autocompleters__user-name"
4573 - }, user.name), (0,external_wp_element_namespaceObject.createElement)("span", {
4574 - className: "editor-autocompleters__user-slug"
4575 - }, user.slug));
4576 -}
4577 -/**
4578 - * A user mentions completer.
4579 - *
4580 - * @type {WPCompleter}
4581 - */
4582 -
4583 -/* harmony default export */ var user = ({
4584 - name: 'users',
4585 - className: 'editor-autocompleters__user',
4586 - triggerPrefix: '@',
4587 -
4588 - useItems(filterValue) {
4589 - const users = (0,external_wp_data_namespaceObject.useSelect)(select => {
4590 - const {
4591 - getUsers
4592 - } = select(external_wp_coreData_namespaceObject.store);
4593 - return getUsers({
4594 - context: 'view',
4595 - search: encodeURIComponent(filterValue)
4596 - });
4597 - }, [filterValue]);
4598 - const options = (0,external_wp_element_namespaceObject.useMemo)(() => users ? users.map(user => ({
4599 - key: `user-${user.slug}`,
4600 - value: user,
4601 - label: getUserLabel(user)
4602 - })) : [], [users]);
4603 - return [options];
4604 - },
4605 -
4606 - getOptionCompletion(user) {
4607 - return `@${user.slug}`;
4608 - }
4609 -
4610 -});
4611 -//# sourceMappingURL=user.js.map
4612 -;// CONCATENATED MODULE: ./packages/editor/build-module/hooks/default-autocompleters.js
4613 -/**
4614 - * External dependencies
4615 - */
4616 -
4617 -/**
4618 - * WordPress dependencies
4619 - */
4620 -
4621 -
4622 -/**
4623 - * Internal dependencies
4624 - */
4625 -
4626 -
4627 -
4628 -function setDefaultCompleters() {
4629 - let completers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4630 - // Provide copies so filters may directly modify them.
4631 - completers.push((0,external_lodash_namespaceObject.clone)(user));
4632 - return completers;
4633 -}
4634 -
4635 -(0,external_wp_hooks_namespaceObject.addFilter)('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters);
4636 -//# sourceMappingURL=default-autocompleters.js.map
4637 -;// CONCATENATED MODULE: ./packages/editor/build-module/hooks/index.js
4638 -/**
4639 - * Internal dependencies
4640 - */
4641 -
4642 -
4643 -//# sourceMappingURL=index.js.map
4644 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/autocompleters/index.js
4645 -
4646 -//# sourceMappingURL=index.js.map
4647 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/autosave-monitor/index.js
4648 -/**
4649 - * WordPress dependencies
4650 - */
4651 -
4652 -
4653 -
4654 -
4655 -/**
4656 - * Internal dependencies
4657 - */
4658 -
4659 -
4660 -/**
4661 - * AutosaveMonitor invokes `props.autosave()` within at most `interval` seconds after an unsaved change is detected.
4662 - *
4663 - * The logic is straightforward: a check is performed every `props.interval` seconds. If any changes are detected, `props.autosave()` is called.
4664 - * The time between the change and the autosave varies but is no larger than `props.interval` seconds. Refer to the code below for more details, such as
4665 - * the specific way of detecting changes.
4666 - *
4667 - * There are two caveats:
4668 - * * If `props.isAutosaveable` happens to be false at a time of checking for changes, the check is retried every second.
4669 - * * The timer may be disabled by setting `props.disableIntervalChecks` to `true`. In that mode, any change will immediately trigger `props.autosave()`.
4670 - */
4671 -
4672 -class AutosaveMonitor extends external_wp_element_namespaceObject.Component {
4673 - constructor(props) {
4674 - super(props);
4675 - this.needsAutosave = !!(props.isDirty && props.isAutosaveable);
4676 - }
4677 -
4678 - componentDidMount() {
4679 - if (!this.props.disableIntervalChecks) {
4680 - this.setAutosaveTimer();
4681 - }
4682 - }
4683 -
4684 - componentDidUpdate(prevProps) {
4685 - if (this.props.disableIntervalChecks) {
4686 - if (this.props.editsReference !== prevProps.editsReference) {
4687 - this.props.autosave();
4688 - }
4689 -
4690 - return;
4691 - }
4692 -
4693 - if (this.props.interval !== prevProps.interval) {
4694 - clearTimeout(this.timerId);
4695 - this.setAutosaveTimer();
4696 - }
4697 -
4698 - if (!this.props.isDirty) {
4699 - this.needsAutosave = false;
4700 - return;
4701 - }
4702 -
4703 - if (this.props.isAutosaving && !prevProps.isAutosaving) {
4704 - this.needsAutosave = false;
4705 - return;
4706 - }
4707 -
4708 - if (this.props.editsReference !== prevProps.editsReference) {
4709 - this.needsAutosave = true;
4710 - }
4711 - }
4712 -
4713 - componentWillUnmount() {
4714 - clearTimeout(this.timerId);
4715 - }
4716 -
4717 - setAutosaveTimer() {
4718 - let timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props.interval * 1000;
4719 - this.timerId = setTimeout(() => {
4720 - this.autosaveTimerHandler();
4721 - }, timeout);
4722 - }
4723 -
4724 - autosaveTimerHandler() {
4725 - if (!this.props.isAutosaveable) {
4726 - this.setAutosaveTimer(1000);
4727 - return;
4728 - }
4729 -
4730 - if (this.needsAutosave) {
4731 - this.needsAutosave = false;
4732 - this.props.autosave();
4733 - }
4734 -
4735 - this.setAutosaveTimer();
4736 - }
4737 -
4738 - render() {
4739 - return null;
4740 - }
4741 -
4742 -}
4743 -/* harmony default export */ var autosave_monitor = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => {
4744 - const {
4745 - getReferenceByDistinctEdits
4746 - } = select(external_wp_coreData_namespaceObject.store);
4747 - const {
4748 - isEditedPostDirty,
4749 - isEditedPostAutosaveable,
4750 - isAutosavingPost,
4751 - getEditorSettings
4752 - } = select(store);
4753 - const {
4754 - interval = getEditorSettings().autosaveInterval
4755 - } = ownProps;
4756 - return {
4757 - editsReference: getReferenceByDistinctEdits(),
4758 - isDirty: isEditedPostDirty(),
4759 - isAutosaveable: isEditedPostAutosaveable(),
4760 - isAutosaving: isAutosavingPost(),
4761 - interval
4762 - };
4763 -}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({
4764 - autosave() {
4765 - const {
4766 - autosave = dispatch(store).autosave
4767 - } = ownProps;
4768 - autosave();
4769 - }
4770 -
4771 -}))])(AutosaveMonitor));
4772 -//# sourceMappingURL=index.js.map
4773 -;// CONCATENATED MODULE: external ["wp","richText"]
4774 -var external_wp_richText_namespaceObject = window["wp"]["richText"];
4775 -// EXTERNAL MODULE: ./node_modules/classnames/index.js
4776 -var classnames = __webpack_require__(4184);
4777 -var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
4778 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/document-outline/item.js
4779 -
4780 -
4781 -/**
4782 - * External dependencies
4783 - */
4784 -
4785 -
4786 -const TableOfContentsItem = _ref => {
4787 - let {
4788 - children,
4789 - isValid,
4790 - level,
4791 - href,
4792 - onSelect
4793 - } = _ref;
4794 - return (0,external_wp_element_namespaceObject.createElement)("li", {
4795 - className: classnames_default()('document-outline__item', `is-${level.toLowerCase()}`, {
4796 - 'is-invalid': !isValid
4797 - })
4798 - }, (0,external_wp_element_namespaceObject.createElement)("a", {
4799 - href: href,
4800 - className: "document-outline__button",
4801 - onClick: onSelect
4802 - }, (0,external_wp_element_namespaceObject.createElement)("span", {
4803 - className: "document-outline__emdash",
4804 - "aria-hidden": "true"
4805 - }), (0,external_wp_element_namespaceObject.createElement)("strong", {
4806 - className: "document-outline__level"
4807 - }, level), (0,external_wp_element_namespaceObject.createElement)("span", {
4808 - className: "document-outline__item-content"
4809 - }, children)));
4810 -};
4811 -
4812 -/* harmony default export */ var document_outline_item = (TableOfContentsItem);
4813 -//# sourceMappingURL=item.js.map
4814 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/document-outline/index.js
4815 -
4816 -
4817 -/**
4818 - * External dependencies
4819 - */
4820 -
4821 -/**
4822 - * WordPress dependencies
4823 - */
4824 -
4825 -
4826 -
4827 -
4828 -
4829 -
4830 -
4831 -/**
4832 - * Internal dependencies
4833 - */
4834 -
4835 -
4836 -
4837 -/**
4838 - * Module constants
4839 - */
4840 -
4841 -const emptyHeadingContent = (0,external_wp_element_namespaceObject.createElement)("em", null, (0,external_wp_i18n_namespaceObject.__)('(Empty heading)'));
4842 -const incorrectLevelContent = [(0,external_wp_element_namespaceObject.createElement)("br", {
4843 - key: "incorrect-break"
4844 -}), (0,external_wp_element_namespaceObject.createElement)("em", {
4845 - key: "incorrect-message"
4846 -}, (0,external_wp_i18n_namespaceObject.__)('(Incorrect heading level)'))];
4847 -const singleH1Headings = [(0,external_wp_element_namespaceObject.createElement)("br", {
4848 - key: "incorrect-break-h1"
4849 -}), (0,external_wp_element_namespaceObject.createElement)("em", {
4850 - key: "incorrect-message-h1"
4851 -}, (0,external_wp_i18n_namespaceObject.__)('(Your theme may already use a H1 for the post title)'))];
4852 -const multipleH1Headings = [(0,external_wp_element_namespaceObject.createElement)("br", {
4853 - key: "incorrect-break-multiple-h1"
4854 -}), (0,external_wp_element_namespaceObject.createElement)("em", {
4855 - key: "incorrect-message-multiple-h1"
4856 -}, (0,external_wp_i18n_namespaceObject.__)('(Multiple H1 headings are not recommended)'))];
4857 -/**
4858 - * Returns an array of heading blocks enhanced with the following properties:
4859 - * level - An integer with the heading level.
4860 - * isEmpty - Flag indicating if the heading has no content.
4861 - *
4862 - * @param {?Array} blocks An array of blocks.
4863 - *
4864 - * @return {Array} An array of heading blocks enhanced with the properties described above.
4865 - */
4866 -
4867 -const computeOutlineHeadings = function () {
4868 - let blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4869 - return (0,external_lodash_namespaceObject.flatMap)(blocks, function () {
4870 - let block = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4871 -
4872 - if (block.name === 'core/heading') {
4873 - return { ...block,
4874 - level: block.attributes.level,
4875 - isEmpty: isEmptyHeading(block)
4876 - };
4877 - }
4878 -
4879 - return computeOutlineHeadings(block.innerBlocks);
4880 - });
4881 -};
4882 -
4883 -const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.length === 0;
4884 -
4885 -const DocumentOutline = _ref => {
4886 - let {
4887 - blocks = [],
4888 - title,
4889 - onSelect,
4890 - isTitleSupported,
4891 - hasOutlineItemsDisabled
4892 - } = _ref;
4893 - const headings = computeOutlineHeadings(blocks);
4894 -
4895 - if (headings.length < 1) {
4896 - return null;
4897 - }
4898 -
4899 - let prevHeadingLevel = 1; // Not great but it's the simplest way to locate the title right now.
4900 -
4901 - const titleNode = document.querySelector('.editor-post-title__input');
4902 - const hasTitle = isTitleSupported && title && titleNode;
4903 - const countByLevel = (0,external_lodash_namespaceObject.countBy)(headings, 'level');
4904 - const hasMultipleH1 = countByLevel[1] > 1;
4905 - return (0,external_wp_element_namespaceObject.createElement)("div", {
4906 - className: "document-outline"
4907 - }, (0,external_wp_element_namespaceObject.createElement)("ul", null, hasTitle && (0,external_wp_element_namespaceObject.createElement)(document_outline_item, {
4908 - level: (0,external_wp_i18n_namespaceObject.__)('Title'),
4909 - isValid: true,
4910 - onSelect: onSelect,
4911 - href: `#${titleNode.id}`,
4912 - isDisabled: hasOutlineItemsDisabled
4913 - }, title), headings.map((item, index) => {
4914 - // Headings remain the same, go up by one, or down by any amount.
4915 - // Otherwise there are missing levels.
4916 - const isIncorrectLevel = item.level > prevHeadingLevel + 1;
4917 - const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle);
4918 - prevHeadingLevel = item.level;
4919 - return (0,external_wp_element_namespaceObject.createElement)(document_outline_item, {
4920 - key: index,
4921 - level: `H${item.level}`,
4922 - isValid: isValid,
4923 - isDisabled: hasOutlineItemsDisabled,
4924 - href: `#block-${item.clientId}`,
4925 - onSelect: onSelect
4926 - }, item.isEmpty ? emptyHeadingContent : (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.create)({
4927 - html: item.attributes.content
4928 - })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings);
4929 - })));
4930 -};
4931 -/* harmony default export */ var document_outline = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => {
4932 - const {
4933 - getBlocks
4934 - } = select(external_wp_blockEditor_namespaceObject.store);
4935 - const {
4936 - getEditedPostAttribute
4937 - } = select(store);
4938 - const {
4939 - getPostType
4940 - } = select(external_wp_coreData_namespaceObject.store);
4941 - const postType = getPostType(getEditedPostAttribute('type'));
4942 - return {
4943 - title: getEditedPostAttribute('title'),
4944 - blocks: getBlocks(),
4945 - isTitleSupported: (0,external_lodash_namespaceObject.get)(postType, ['supports', 'title'], false)
4946 - };
4947 -}))(DocumentOutline));
4948 -//# sourceMappingURL=index.js.map
4949 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/document-outline/check.js
4950 -/**
4951 - * External dependencies
4952 - */
4953 -
4954 -/**
4955 - * WordPress dependencies
4956 - */
4957 -
4958 -
4959 -
4960 -
4961 -function DocumentOutlineCheck(_ref) {
4962 - let {
4963 - blocks,
4964 - children
4965 - } = _ref;
4966 - const headings = (0,external_lodash_namespaceObject.filter)(blocks, block => block.name === 'core/heading');
4967 -
4968 - if (headings.length < 1) {
4969 - return null;
4970 - }
4971 -
4972 - return children;
4973 -}
4974 -
4975 -/* harmony default export */ var check = ((0,external_wp_data_namespaceObject.withSelect)(select => ({
4976 - blocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks()
4977 -}))(DocumentOutlineCheck));
4978 -//# sourceMappingURL=check.js.map
4979 -;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
4980 -var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
4981 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/global-keyboard-shortcuts/save-shortcut.js
4982 -/**
4983 - * WordPress dependencies
4984 - */
4985 -
4986 -
4987 -
4988 -/**
4989 - * Internal dependencies
4990 - */
4991 -
4992 -
4993 -
4994 -function SaveShortcut(_ref) {
4995 - let {
4996 - resetBlocksOnSave
4997 - } = _ref;
4998 - const {
4999 - resetEditorBlocks,
5000 - savePost
5001 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
5002 - const {
5003 - isEditedPostDirty,
5004 - getPostEdits,
5005 - isPostSavingLocked
5006 - } = (0,external_wp_data_namespaceObject.useSelect)(store);
5007 - (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/save', event => {
5008 - event.preventDefault();
5009 - /**
5010 - * Do not save the post if post saving is locked.
5011 - */
5012 -
5013 - if (isPostSavingLocked()) {
5014 - return;
5015 - } // TODO: This should be handled in the `savePost` effect in
5016 - // considering `isSaveable`. See note on `isEditedPostSaveable`
5017 - // selector about dirtiness and meta-boxes.
5018 - //
5019 - // See: `isEditedPostSaveable`
5020 -
5021 -
5022 - if (!isEditedPostDirty()) {
5023 - return;
5024 - } // The text editor requires that editor blocks are updated for a
5025 - // save to work correctly. Usually this happens when the textarea
5026 - // for the code editors blurs, but the shortcut can be used without
5027 - // blurring the textarea.
5028 -
5029 -
5030 - if (resetBlocksOnSave) {
5031 - const postEdits = getPostEdits();
5032 -
5033 - if (postEdits.content && typeof postEdits.content === 'string') {
5034 - const blocks = (0,external_wp_blocks_namespaceObject.parse)(postEdits.content);
5035 - resetEditorBlocks(blocks);
5036 - }
5037 - }
5038 -
5039 - savePost();
5040 - });
5041 - return null;
5042 -}
5043 -
5044 -/* harmony default export */ var save_shortcut = (SaveShortcut);
5045 -//# sourceMappingURL=save-shortcut.js.map
5046 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js
5047 -
5048 -
5049 -/**
5050 - * WordPress dependencies
5051 - */
5052 -
5053 -
5054 -/**
5055 - * Internal dependencies
5056 - */
5057 -
5058 -
5059 -
5060 -
5061 -function VisualEditorGlobalKeyboardShortcuts() {
5062 - const {
5063 - redo,
5064 - undo
5065 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
5066 - (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/undo', event => {
5067 - undo();
5068 - event.preventDefault();
5069 - });
5070 - (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/redo', event => {
5071 - redo();
5072 - event.preventDefault();
5073 - });
5074 - return (0,external_wp_element_namespaceObject.createElement)(save_shortcut, null);
5075 -}
5076 -
5077 -/* harmony default export */ var visual_editor_shortcuts = (VisualEditorGlobalKeyboardShortcuts);
5078 -//# sourceMappingURL=visual-editor-shortcuts.js.map
5079 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/global-keyboard-shortcuts/text-editor-shortcuts.js
5080 -
5081 -
5082 -/**
5083 - * Internal dependencies
5084 - */
5085 -
5086 -function TextEditorGlobalKeyboardShortcuts() {
5087 - return (0,external_wp_element_namespaceObject.createElement)(save_shortcut, {
5088 - resetBlocksOnSave: true
5089 - });
5090 -}
5091 -//# sourceMappingURL=text-editor-shortcuts.js.map
5092 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js
5093 -
5094 -
5095 -/**
5096 - * WordPress dependencies
5097 - */
5098 -
5099 -
5100 -
5101 -
5102 -
5103 -
5104 -function EditorKeyboardShortcutsRegister() {
5105 - // Registering the shortcuts
5106 - const {
5107 - registerShortcut
5108 - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
5109 - (0,external_wp_element_namespaceObject.useEffect)(() => {
5110 - registerShortcut({
5111 - name: 'core/editor/save',
5112 - category: 'global',
5113 - description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'),
5114 - keyCombination: {
5115 - modifier: 'primary',
5116 - character: 's'
5117 - }
5118 - });
5119 - registerShortcut({
5120 - name: 'core/editor/undo',
5121 - category: 'global',
5122 - description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'),
5123 - keyCombination: {
5124 - modifier: 'primary',
5125 - character: 'z'
5126 - }
5127 - });
5128 - registerShortcut({
5129 - name: 'core/editor/redo',
5130 - category: 'global',
5131 - description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'),
5132 - keyCombination: {
5133 - modifier: 'primaryShift',
5134 - character: 'z'
5135 - }
5136 - });
5137 - }, [registerShortcut]);
5138 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, null);
5139 -}
5140 -
5141 -/* harmony default export */ var register_shortcuts = (EditorKeyboardShortcutsRegister);
5142 -//# sourceMappingURL=register-shortcuts.js.map
5143 -;// CONCATENATED MODULE: external ["wp","components"]
5144 -var external_wp_components_namespaceObject = window["wp"]["components"];
5145 -;// CONCATENATED MODULE: external ["wp","keycodes"]
5146 -var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
5147 -;// CONCATENATED MODULE: ./packages/icons/build-module/library/redo.js
5148 -
5149 -
5150 -/**
5151 - * WordPress dependencies
5152 - */
5153 -
5154 -const redo_redo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
5155 - xmlns: "http://www.w3.org/2000/svg",
5156 - viewBox: "0 0 24 24"
5157 -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
5158 - d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"
5159 -}));
5160 -/* harmony default export */ var library_redo = (redo_redo);
5161 -//# sourceMappingURL=redo.js.map
5162 -;// CONCATENATED MODULE: ./packages/icons/build-module/library/undo.js
5163 -
5164 -
5165 -/**
5166 - * WordPress dependencies
5167 - */
5168 -
5169 -const undo_undo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
5170 - xmlns: "http://www.w3.org/2000/svg",
5171 - viewBox: "0 0 24 24"
5172 -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
5173 - d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"
5174 -}));
5175 -/* harmony default export */ var library_undo = (undo_undo);
5176 -//# sourceMappingURL=undo.js.map
5177 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/editor-history/redo.js
5178 -
5179 -
5180 -
5181 -/**
5182 - * WordPress dependencies
5183 - */
5184 -
5185 -
5186 -
5187 -
5188 -
5189 -
5190 -/**
5191 - * Internal dependencies
5192 - */
5193 -
5194 -
5195 -
5196 -function EditorHistoryRedo(props, ref) {
5197 - const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).hasEditorRedo(), []);
5198 - const {
5199 - redo
5200 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
5201 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, props, {
5202 - ref: ref,
5203 - icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo
5204 - /* translators: button label text should, if possible, be under 16 characters. */
5205 - ,
5206 - label: (0,external_wp_i18n_namespaceObject.__)('Redo'),
5207 - shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') // If there are no redo levels we don't want to actually disable this
5208 - // button, because it will remove focus for keyboard users.
5209 - // See: https://github.com/WordPress/gutenberg/issues/3486
5210 - ,
5211 - "aria-disabled": !hasRedo,
5212 - onClick: hasRedo ? redo : undefined,
5213 - className: "editor-history__redo"
5214 - }));
5215 -}
5216 -
5217 -/* harmony default export */ var editor_history_redo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryRedo));
5218 -//# sourceMappingURL=redo.js.map
5219 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/editor-history/undo.js
5220 -
5221 -
5222 -
5223 -/**
5224 - * WordPress dependencies
5225 - */
5226 -
5227 -
5228 -
5229 -
5230 -
5231 -
5232 -/**
5233 - * Internal dependencies
5234 - */
5235 -
5236 -
5237 -
5238 -function EditorHistoryUndo(props, ref) {
5239 - const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).hasEditorUndo(), []);
5240 - const {
5241 - undo
5242 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
5243 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, props, {
5244 - ref: ref,
5245 - icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo
5246 - /* translators: button label text should, if possible, be under 16 characters. */
5247 - ,
5248 - label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
5249 - shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') // If there are no undo levels we don't want to actually disable this
5250 - // button, because it will remove focus for keyboard users.
5251 - // See: https://github.com/WordPress/gutenberg/issues/3486
5252 - ,
5253 - "aria-disabled": !hasUndo,
5254 - onClick: hasUndo ? undo : undefined,
5255 - className: "editor-history__undo"
5256 - }));
5257 -}
5258 -
5259 -/* harmony default export */ var editor_history_undo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryUndo));
5260 -//# sourceMappingURL=undo.js.map
5261 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/template-validation-notice/index.js
5262 -
5263 -
5264 -/**
5265 - * WordPress dependencies
5266 - */
5267 -
5268 -
5269 -
5270 -
5271 -
5272 -
5273 -function TemplateValidationNotice(_ref) {
5274 - let {
5275 - isValid,
5276 - ...props
5277 - } = _ref;
5278 -
5279 - if (isValid) {
5280 - return null;
5281 - }
5282 -
5283 - const confirmSynchronization = () => {
5284 - if ( // eslint-disable-next-line no-alert
5285 - window.confirm((0,external_wp_i18n_namespaceObject.__)('Resetting the template may result in loss of content, do you want to continue?'))) {
5286 - props.synchronizeTemplate();
5287 - }
5288 - };
5289 -
5290 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
5291 - className: "editor-template-validation-notice",
5292 - isDismissible: false,
5293 - status: "warning",
5294 - actions: [{
5295 - label: (0,external_wp_i18n_namespaceObject.__)('Keep it as is'),
5296 - onClick: props.resetTemplateValidity
5297 - }, {
5298 - label: (0,external_wp_i18n_namespaceObject.__)('Reset the template'),
5299 - onClick: confirmSynchronization
5300 - }]
5301 - }, (0,external_wp_i18n_namespaceObject.__)('The content of your post doesn’t match the template assigned to your post type.'));
5302 -}
5303 -
5304 -/* harmony default export */ var template_validation_notice = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({
5305 - isValid: select(external_wp_blockEditor_namespaceObject.store).isValidTemplate()
5306 -})), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
5307 - const {
5308 - setTemplateValidity,
5309 - synchronizeTemplate
5310 - } = dispatch(external_wp_blockEditor_namespaceObject.store);
5311 - return {
5312 - resetTemplateValidity: () => setTemplateValidity(true),
5313 - synchronizeTemplate
5314 - };
5315 -})])(TemplateValidationNotice));
5316 -//# sourceMappingURL=index.js.map
5317 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/editor-notices/index.js
5318 -
5319 -
5320 -/**
5321 - * External dependencies
5322 - */
5323 -
5324 -/**
5325 - * WordPress dependencies
5326 - */
5327 -
5328 -
5329 -
5330 -
5331 -
5332 -/**
5333 - * Internal dependencies
5334 - */
5335 -
5336 -
5337 -function EditorNotices(_ref) {
5338 - let {
5339 - notices,
5340 - onRemove
5341 - } = _ref;
5342 - const dismissibleNotices = (0,external_lodash_namespaceObject.filter)(notices, {
5343 - isDismissible: true,
5344 - type: 'default'
5345 - });
5346 - const nonDismissibleNotices = (0,external_lodash_namespaceObject.filter)(notices, {
5347 - isDismissible: false,
5348 - type: 'default'
5349 - });
5350 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NoticeList, {
5351 - notices: nonDismissibleNotices,
5352 - className: "components-editor-notices__pinned"
5353 - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NoticeList, {
5354 - notices: dismissibleNotices,
5355 - className: "components-editor-notices__dismissible",
5356 - onRemove: onRemove
5357 - }, (0,external_wp_element_namespaceObject.createElement)(template_validation_notice, null)));
5358 -}
5359 -/* harmony default export */ var editor_notices = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({
5360 - notices: select(external_wp_notices_namespaceObject.store).getNotices()
5361 -})), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
5362 - onRemove: dispatch(external_wp_notices_namespaceObject.store).removeNotice
5363 -}))])(EditorNotices));
5364 -//# sourceMappingURL=index.js.map
5365 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/editor-snackbars/index.js
5366 -
5367 -
5368 -/**
5369 - * External dependencies
5370 - */
5371 -
5372 -/**
5373 - * WordPress dependencies
5374 - */
5375 -
5376 -
5377 -
5378 -
5379 -function EditorSnackbars() {
5380 - const notices = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_notices_namespaceObject.store).getNotices(), []);
5381 - const {
5382 - removeNotice
5383 - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
5384 - const snackbarNotices = (0,external_lodash_namespaceObject.filter)(notices, {
5385 - type: 'snackbar'
5386 - });
5387 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SnackbarList, {
5388 - notices: snackbarNotices,
5389 - className: "components-editor-notices__snackbar",
5390 - onRemove: removeNotice
5391 - });
5392 -}
5393 -//# sourceMappingURL=index.js.map
5394 -;// CONCATENATED MODULE: external ["wp","htmlEntities"]
5395 -var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
5396 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/entities-saved-states/entity-record-item.js
5397 -
5398 -
5399 -/**
5400 - * WordPress dependencies
5401 - */
5402 -
5403 -
5404 -
5405 -
5406 -
5407 -
5408 -
5409 -/**
5410 - * Internal dependencies
5411 - */
5412 -
5413 -
5414 -function EntityRecordItem(_ref) {
5415 - let {
5416 - record,
5417 - checked,
5418 - onChange,
5419 - closePanel
5420 - } = _ref;
5421 - const {
5422 - name,
5423 - kind,
5424 - title,
5425 - key
5426 - } = record;
5427 - const parentBlockId = (0,external_wp_data_namespaceObject.useSelect)(select => {
5428 - var _blocks$;
5429 -
5430 - // Get entity's blocks.
5431 - const {
5432 - blocks = []
5433 - } = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(kind, name, key); // Get parents of the entity's first block.
5434 -
5435 - const parents = select(external_wp_blockEditor_namespaceObject.store).getBlockParents((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.clientId); // Return closest parent block's clientId.
5436 -
5437 - return parents[parents.length - 1];
5438 - }, []); // Handle templates that might use default descriptive titles
5439 -
5440 - const entityRecordTitle = (0,external_wp_data_namespaceObject.useSelect)(select => {
5441 - if ('postType' !== kind || 'wp_template' !== name) {
5442 - return title;
5443 - }
5444 -
5445 - const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(kind, name, key);
5446 - return select(store).__experimentalGetTemplateInfo(template).title;
5447 - }, [name, kind, title, key]);
5448 - const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => {
5449 - const selectedBlockId = select(external_wp_blockEditor_namespaceObject.store).getSelectedBlockClientId();
5450 - return selectedBlockId === parentBlockId;
5451 - }, [parentBlockId]);
5452 - const isSelectedText = isSelected ? (0,external_wp_i18n_namespaceObject.__)('Selected') : (0,external_wp_i18n_namespaceObject.__)('Select');
5453 - const {
5454 - selectBlock
5455 - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
5456 - const selectParentBlock = (0,external_wp_element_namespaceObject.useCallback)(() => selectBlock(parentBlockId), [parentBlockId]);
5457 - const selectAndDismiss = (0,external_wp_element_namespaceObject.useCallback)(() => {
5458 - selectBlock(parentBlockId);
5459 - closePanel();
5460 - }, [parentBlockId]);
5461 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
5462 - label: (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(entityRecordTitle) || (0,external_wp_i18n_namespaceObject.__)('Untitled')),
5463 - checked: checked,
5464 - onChange: onChange
5465 - }), parentBlockId ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
5466 - onClick: selectParentBlock,
5467 - className: "entities-saved-states__find-entity",
5468 - disabled: isSelected
5469 - }, isSelectedText), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
5470 - onClick: selectAndDismiss,
5471 - className: "entities-saved-states__find-entity-small",
5472 - disabled: isSelected
5473 - }, isSelectedText)) : null);
5474 -}
5475 -//# sourceMappingURL=entity-record-item.js.map
5476 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/entities-saved-states/entity-type-list.js
5477 -
5478 -
5479 -/**
5480 - * External dependencies
5481 - */
5482 -
5483 -/**
5484 - * WordPress dependencies
5485 - */
5486 -
5487 -
5488 -
5489 -
5490 -
5491 -/**
5492 - * Internal dependencies
5493 - */
5494 -
5495 -
5496 -
5497 -function getEntityDescription(entity, length) {
5498 - switch (entity) {
5499 - case 'site':
5500 - return (0,external_wp_i18n_namespaceObject._n)('This change will affect your whole site.', 'These changes will affect your whole site.', length);
5501 -
5502 - case 'wp_template':
5503 - return (0,external_wp_i18n_namespaceObject._n)('This change will affect pages and posts that use this template.', 'These changes will affect pages and posts that use these templates.', length);
5504 -
5505 - case 'page':
5506 - case 'post':
5507 - return (0,external_wp_i18n_namespaceObject.__)('The following content has been modified.');
5508 - }
5509 -}
5510 -
5511 -function EntityTypeList(_ref) {
5512 - let {
5513 - list,
5514 - unselectedEntities,
5515 - setUnselectedEntities,
5516 - closePanel
5517 - } = _ref;
5518 - const firstRecord = list[0];
5519 - const entity = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntity(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]);
5520 - const {
5521 - name
5522 - } = firstRecord;
5523 - const entityLabel = name === 'wp_template_part' ? (0,external_wp_i18n_namespaceObject._n)('Template Part', 'Template Parts', list.length) : entity.label; // Set description based on type of entity.
5524 -
5525 - const description = getEntityDescription(name, list.length);
5526 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
5527 - title: entityLabel,
5528 - initialOpen: true
5529 - }, description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, description), list.map(record => {
5530 - return (0,external_wp_element_namespaceObject.createElement)(EntityRecordItem, {
5531 - key: record.key || record.property,
5532 - record: record,
5533 - checked: !(0,external_lodash_namespaceObject.some)(unselectedEntities, elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property),
5534 - onChange: value => setUnselectedEntities(record, value),
5535 - closePanel: closePanel
5536 - });
5537 - }));
5538 -}
5539 -//# sourceMappingURL=entity-type-list.js.map
5540 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/entities-saved-states/index.js
5541 -
5542 -
5543 -
5544 -/**
5545 - * External dependencies
5546 - */
5547 -
5548 -/**
5549 - * WordPress dependencies
5550 - */
5551 -
5552 -
5553 -
5554 -
5555 -
5556 -
5557 -
5558 -
5559 -
5560 -/**
5561 - * Internal dependencies
5562 - */
5563 -
5564 -
5565 -const TRANSLATED_SITE_PROPERTIES = {
5566 - title: (0,external_wp_i18n_namespaceObject.__)('Title'),
5567 - description: (0,external_wp_i18n_namespaceObject.__)('Tagline'),
5568 - site_logo: (0,external_wp_i18n_namespaceObject.__)('Logo'),
5569 - site_icon: (0,external_wp_i18n_namespaceObject.__)('Icon'),
5570 - show_on_front: (0,external_wp_i18n_namespaceObject.__)('Show on front'),
5571 - page_on_front: (0,external_wp_i18n_namespaceObject.__)('Page on front')
5572 -};
5573 -const PUBLISH_ON_SAVE_ENTITIES = [{
5574 - kind: 'postType',
5575 - name: 'wp_navigation'
5576 -}];
5577 -function EntitiesSavedStates(_ref) {
5578 - let {
5579 - close
5580 - } = _ref;
5581 - const saveButtonRef = (0,external_wp_element_namespaceObject.useRef)();
5582 - const {
5583 - dirtyEntityRecords
5584 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
5585 - const dirtyRecords = select(external_wp_coreData_namespaceObject.store).__experimentalGetDirtyEntityRecords(); // Remove site object and decouple into its edited pieces.
5586 -
5587 -
5588 - const dirtyRecordsWithoutSite = dirtyRecords.filter(record => !(record.kind === 'root' && record.name === 'site'));
5589 - const siteEdits = select(external_wp_coreData_namespaceObject.store).getEntityRecordEdits('root', 'site');
5590 - const siteEditsAsEntities = [];
5591 -
5592 - for (const property in siteEdits) {
5593 - siteEditsAsEntities.push({
5594 - kind: 'root',
5595 - name: 'site',
5596 - title: TRANSLATED_SITE_PROPERTIES[property] || property,
5597 - property
5598 - });
5599 - }
5600 -
5601 - const dirtyRecordsWithSiteItems = [...dirtyRecordsWithoutSite, ...siteEditsAsEntities];
5602 - return {
5603 - dirtyEntityRecords: dirtyRecordsWithSiteItems
5604 - };
5605 - }, []);
5606 - const {
5607 - editEntityRecord,
5608 - saveEditedEntityRecord,
5609 - __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
5610 - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
5611 - const {
5612 - __unstableMarkLastChangeAsPersistent
5613 - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
5614 - const {
5615 - createSuccessNotice,
5616 - createErrorNotice
5617 - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); // To group entities by type.
5618 -
5619 - const partitionedSavables = (0,external_lodash_namespaceObject.groupBy)(dirtyEntityRecords, 'name'); // Sort entity groups.
5620 -
5621 - const {
5622 - site: siteSavables,
5623 - wp_template: templateSavables,
5624 - wp_template_part: templatePartSavables,
5625 - ...contentSavables
5626 - } = partitionedSavables;
5627 - const sortedPartitionedSavables = [siteSavables, templateSavables, templatePartSavables, ...Object.values(contentSavables)].filter(Array.isArray); // Unchecked entities to be ignored by save function.
5628 -
5629 - const [unselectedEntities, _setUnselectedEntities] = (0,external_wp_element_namespaceObject.useState)([]);
5630 -
5631 - const setUnselectedEntities = (_ref2, checked) => {
5632 - let {
5633 - kind,
5634 - name,
5635 - key,
5636 - property
5637 - } = _ref2;
5638 -
5639 - if (checked) {
5640 - _setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property));
5641 - } else {
5642 - _setUnselectedEntities([...unselectedEntities, {
5643 - kind,
5644 - name,
5645 - key,
5646 - property
5647 - }]);
5648 - }
5649 - };
5650 -
5651 - const saveCheckedEntities = () => {
5652 - const entitiesToSave = dirtyEntityRecords.filter(_ref3 => {
5653 - let {
5654 - kind,
5655 - name,
5656 - key,
5657 - property
5658 - } = _ref3;
5659 - return !(0,external_lodash_namespaceObject.some)(unselectedEntities, elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property);
5660 - });
5661 - close(entitiesToSave);
5662 - const siteItemsToSave = [];
5663 - const pendingSavedRecords = [];
5664 - entitiesToSave.forEach(_ref4 => {
5665 - let {
5666 - kind,
5667 - name,
5668 - key,
5669 - property
5670 - } = _ref4;
5671 -
5672 - if ('root' === kind && 'site' === name) {
5673 - siteItemsToSave.push(property);
5674 - } else {
5675 - if (PUBLISH_ON_SAVE_ENTITIES.some(typeToPublish => typeToPublish.kind === kind && typeToPublish.name === name)) {
5676 - editEntityRecord(kind, name, key, {
5677 - status: 'publish'
5678 - });
5679 - }
5680 -
5681 - pendingSavedRecords.push(saveEditedEntityRecord(kind, name, key));
5682 - }
5683 - });
5684 -
5685 - if (siteItemsToSave.length) {
5686 - pendingSavedRecords.push(saveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave));
5687 - }
5688 -
5689 - __unstableMarkLastChangeAsPersistent();
5690 -
5691 - Promise.all(pendingSavedRecords).then(values => {
5692 - if (values.some(value => typeof value === 'undefined')) {
5693 - createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Saving failed.'));
5694 - } else {
5695 - createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Site updated.'), {
5696 - type: 'snackbar'
5697 - });
5698 - }
5699 - }).catch(error => createErrorNotice(`${(0,external_wp_i18n_namespaceObject.__)('Saving failed.')} ${error}`));
5700 - }; // Explicitly define this with no argument passed. Using `close` on
5701 - // its own will use the event object in place of the expected saved entities.
5702 -
5703 -
5704 - const dismissPanel = (0,external_wp_element_namespaceObject.useCallback)(() => close(), [close]);
5705 - const [saveDialogRef, saveDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
5706 - onClose: () => dismissPanel()
5707 - });
5708 - return (0,external_wp_element_namespaceObject.createElement)("div", _extends({
5709 - ref: saveDialogRef
5710 - }, saveDialogProps, {
5711 - className: "entities-saved-states__panel"
5712 - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
5713 - className: "entities-saved-states__panel-header",
5714 - gap: 2
5715 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
5716 - isBlock: true,
5717 - as: external_wp_components_namespaceObject.Button,
5718 - ref: saveButtonRef,
5719 - variant: "primary",
5720 - disabled: dirtyEntityRecords.length - unselectedEntities.length === 0,
5721 - onClick: saveCheckedEntities,
5722 - className: "editor-entities-saved-states__save-button"
5723 - }, (0,external_wp_i18n_namespaceObject.__)('Save')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
5724 - isBlock: true,
5725 - as: external_wp_components_namespaceObject.Button,
5726 - variant: "secondary",
5727 - onClick: dismissPanel
5728 - }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)("div", {
5729 - className: "entities-saved-states__text-prompt"
5730 - }, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('Are you ready to save?')), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('The following changes have been made to your site, templates, and content.'))), sortedPartitionedSavables.map(list => {
5731 - return (0,external_wp_element_namespaceObject.createElement)(EntityTypeList, {
5732 - key: list[0].name,
5733 - list: list,
5734 - closePanel: dismissPanel,
5735 - unselectedEntities: unselectedEntities,
5736 - setUnselectedEntities: setUnselectedEntities
5737 - });
5738 - }));
5739 -}
5740 -//# sourceMappingURL=index.js.map
5741 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/error-boundary/index.js
5742 -
5743 -
5744 -/**
5745 - * WordPress dependencies
5746 - */
5747 -
5748 -
5749 -
5750 -
5751 -
5752 -
5753 -/**
5754 - * Internal dependencies
5755 - */
5756 -
5757 -
5758 -
5759 -function CopyButton(_ref) {
5760 - let {
5761 - text,
5762 - children
5763 - } = _ref;
5764 - const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text);
5765 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
5766 - variant: "secondary",
5767 - ref: ref
5768 - }, children);
5769 -}
5770 -
5771 -class ErrorBoundary extends external_wp_element_namespaceObject.Component {
5772 - constructor() {
5773 - super(...arguments);
5774 - this.reboot = this.reboot.bind(this);
5775 - this.getContent = this.getContent.bind(this);
5776 - this.state = {
5777 - error: null
5778 - };
5779 - }
5780 -
5781 - componentDidCatch(error) {
5782 - this.setState({
5783 - error
5784 - });
5785 - }
5786 -
5787 - reboot() {
5788 - this.props.onError();
5789 - }
5790 -
5791 - getContent() {
5792 - try {
5793 - // While `select` in a component is generally discouraged, it is
5794 - // used here because it (a) reduces the chance of data loss in the
5795 - // case of additional errors by performing a direct retrieval and
5796 - // (b) avoids the performance cost associated with unnecessary
5797 - // content serialization throughout the lifetime of a non-erroring
5798 - // application.
5799 - return (0,external_wp_data_namespaceObject.select)(store).getEditedPostContent();
5800 - } catch (error) {}
5801 - }
5802 -
5803 - render() {
5804 - const {
5805 - error
5806 - } = this.state;
5807 -
5808 - if (!error) {
5809 - return this.props.children;
5810 - }
5811 -
5812 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
5813 - className: "editor-error-boundary",
5814 - actions: [(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
5815 - key: "recovery",
5816 - onClick: this.reboot,
5817 - variant: "secondary"
5818 - }, (0,external_wp_i18n_namespaceObject.__)('Attempt Recovery')), (0,external_wp_element_namespaceObject.createElement)(CopyButton, {
5819 - key: "copy-post",
5820 - text: this.getContent
5821 - }, (0,external_wp_i18n_namespaceObject.__)('Copy Post Text')), (0,external_wp_element_namespaceObject.createElement)(CopyButton, {
5822 - key: "copy-error",
5823 - text: error.stack
5824 - }, (0,external_wp_i18n_namespaceObject.__)('Copy Error'))]
5825 - }, (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.'));
5826 - }
5827 -
5828 -}
5829 -
5830 -/* harmony default export */ var error_boundary = (ErrorBoundary);
5831 -//# sourceMappingURL=index.js.map
5832 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/local-autosave-monitor/index.js
5833 -
5834 -
5835 -/**
5836 - * External dependencies
5837 - */
5838 -
5839 -/**
5840 - * WordPress dependencies
5841 - */
5842 -
5843 -
5844 -
5845 -
5846 -
5847 -
5848 -
5849 -/**
5850 - * Internal dependencies
5851 - */
5852 -
5853 -
5854 -
5855 -
5856 -const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame;
5857 -/**
5858 - * Function which returns true if the current environment supports browser
5859 - * sessionStorage, or false otherwise. The result of this function is cached and
5860 - * reused in subsequent invocations.
5861 - */
5862 -
5863 -const hasSessionStorageSupport = (0,external_lodash_namespaceObject.once)(() => {
5864 - try {
5865 - // Private Browsing in Safari 10 and earlier will throw an error when
5866 - // attempting to set into sessionStorage. The test here is intentional in
5867 - // causing a thrown error as condition bailing from local autosave.
5868 - window.sessionStorage.setItem('__wpEditorTestSessionStorage', '');
5869 - window.sessionStorage.removeItem('__wpEditorTestSessionStorage');
5870 - return true;
5871 - } catch (error) {
5872 - return false;
5873 - }
5874 -});
5875 -/**
5876 - * Custom hook which manages the creation of a notice prompting the user to
5877 - * restore a local autosave, if one exists.
5878 - */
5879 -
5880 -function useAutosaveNotice() {
5881 - const {
5882 - postId,
5883 - isEditedPostNew,
5884 - hasRemoteAutosave
5885 - } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
5886 - postId: select(store).getCurrentPostId(),
5887 - isEditedPostNew: select(store).isEditedPostNew(),
5888 - hasRemoteAutosave: !!select(store).getEditorSettings().autosave
5889 - }), []);
5890 - const {
5891 - getEditedPostAttribute
5892 - } = (0,external_wp_data_namespaceObject.useSelect)(store);
5893 - const {
5894 - createWarningNotice,
5895 - removeNotice
5896 - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
5897 - const {
5898 - editPost,
5899 - resetEditorBlocks
5900 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
5901 - (0,external_wp_element_namespaceObject.useEffect)(() => {
5902 - let localAutosave = localAutosaveGet(postId, isEditedPostNew);
5903 -
5904 - if (!localAutosave) {
5905 - return;
5906 - }
5907 -
5908 - try {
5909 - localAutosave = JSON.parse(localAutosave);
5910 - } catch (error) {
5911 - // Not usable if it can't be parsed.
5912 - return;
5913 - }
5914 -
5915 - const {
5916 - post_title: title,
5917 - content,
5918 - excerpt
5919 - } = localAutosave;
5920 - const edits = {
5921 - title,
5922 - content,
5923 - excerpt
5924 - };
5925 - {
5926 - // Only display a notice if there is a difference between what has been
5927 - // saved and that which is stored in sessionStorage.
5928 - const hasDifference = Object.keys(edits).some(key => {
5929 - return edits[key] !== getEditedPostAttribute(key);
5930 - });
5931 -
5932 - if (!hasDifference) {
5933 - // If there is no difference, it can be safely ejected from storage.
5934 - localAutosaveClear(postId, isEditedPostNew);
5935 - return;
5936 - }
5937 - }
5938 -
5939 - if (hasRemoteAutosave) {
5940 - return;
5941 - }
5942 -
5943 - const noticeId = (0,external_lodash_namespaceObject.uniqueId)('wpEditorAutosaveRestore');
5944 - createWarningNotice((0,external_wp_i18n_namespaceObject.__)('The backup of this post in your browser is different from the version below.'), {
5945 - id: noticeId,
5946 - actions: [{
5947 - label: (0,external_wp_i18n_namespaceObject.__)('Restore the backup'),
5948 -
5949 - onClick() {
5950 - editPost((0,external_lodash_namespaceObject.omit)(edits, ['content']));
5951 - resetEditorBlocks((0,external_wp_blocks_namespaceObject.parse)(edits.content));
5952 - removeNotice(noticeId);
5953 - }
5954 -
5955 - }]
5956 - });
5957 - }, [isEditedPostNew, postId]);
5958 -}
5959 -/**
5960 - * Custom hook which ejects a local autosave after a successful save occurs.
5961 - */
5962 -
5963 -
5964 -function useAutosavePurge() {
5965 - const {
5966 - postId,
5967 - isEditedPostNew,
5968 - isDirty,
5969 - isAutosaving,
5970 - didError
5971 - } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
5972 - postId: select(store).getCurrentPostId(),
5973 - isEditedPostNew: select(store).isEditedPostNew(),
5974 - isDirty: select(store).isEditedPostDirty(),
5975 - isAutosaving: select(store).isAutosavingPost(),
5976 - didError: select(store).didPostSaveRequestFail()
5977 - }), []);
5978 - const lastIsDirty = (0,external_wp_element_namespaceObject.useRef)(isDirty);
5979 - const lastIsAutosaving = (0,external_wp_element_namespaceObject.useRef)(isAutosaving);
5980 - (0,external_wp_element_namespaceObject.useEffect)(() => {
5981 - if (!didError && (lastIsAutosaving.current && !isAutosaving || lastIsDirty.current && !isDirty)) {
5982 - localAutosaveClear(postId, isEditedPostNew);
5983 - }
5984 -
5985 - lastIsDirty.current = isDirty;
5986 - lastIsAutosaving.current = isAutosaving;
5987 - }, [isDirty, isAutosaving, didError]); // Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave.
5988 -
5989 - const wasEditedPostNew = (0,external_wp_compose_namespaceObject.usePrevious)(isEditedPostNew);
5990 - const prevPostId = (0,external_wp_compose_namespaceObject.usePrevious)(postId);
5991 - (0,external_wp_element_namespaceObject.useEffect)(() => {
5992 - if (prevPostId === postId && wasEditedPostNew && !isEditedPostNew) {
5993 - localAutosaveClear(postId, true);
5994 - }
5995 - }, [isEditedPostNew, postId]);
5996 -}
5997 -
5998 -function LocalAutosaveMonitor() {
5999 - const {
6000 - autosave
6001 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
6002 - const deferredAutosave = (0,external_wp_element_namespaceObject.useCallback)(() => {
6003 - requestIdleCallback(() => autosave({
6004 - local: true
6005 - }));
6006 - }, []);
6007 - useAutosaveNotice();
6008 - useAutosavePurge();
6009 - const {
6010 - localAutosaveInterval
6011 - } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
6012 - localAutosaveInterval: select(store).getEditorSettings().__experimentalLocalAutosaveInterval
6013 - }), []);
6014 - return (0,external_wp_element_namespaceObject.createElement)(autosave_monitor, {
6015 - interval: localAutosaveInterval,
6016 - autosave: deferredAutosave
6017 - });
6018 -}
6019 -
6020 -/* harmony default export */ var local_autosave_monitor = ((0,external_wp_compose_namespaceObject.ifCondition)(hasSessionStorageSupport)(LocalAutosaveMonitor));
6021 -//# sourceMappingURL=index.js.map
6022 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/page-attributes/check.js
6023 -/**
6024 - * External dependencies
6025 - */
6026 -
6027 -/**
6028 - * WordPress dependencies
6029 - */
6030 -
6031 -
6032 -
6033 -/**
6034 - * Internal dependencies
6035 - */
6036 -
6037 -
6038 -function PageAttributesCheck(_ref) {
6039 - let {
6040 - children
6041 - } = _ref;
6042 - const postType = (0,external_wp_data_namespaceObject.useSelect)(select => {
6043 - const {
6044 - getEditedPostAttribute
6045 - } = select(store);
6046 - const {
6047 - getPostType
6048 - } = select(external_wp_coreData_namespaceObject.store);
6049 - return getPostType(getEditedPostAttribute('type'));
6050 - }, []);
6051 - const supportsPageAttributes = (0,external_lodash_namespaceObject.get)(postType, ['supports', 'page-attributes'], false); // Only render fields if post type supports page attributes or available templates exist.
6052 -
6053 - if (!supportsPageAttributes) {
6054 - return null;
6055 - }
6056 -
6057 - return children;
6058 -}
6059 -/* harmony default export */ var page_attributes_check = (PageAttributesCheck);
6060 -//# sourceMappingURL=check.js.map
6061 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-type-support-check/index.js
6062 -/**
6063 - * External dependencies
6064 - */
6065 -
6066 -/**
6067 - * WordPress dependencies
6068 - */
6069 -
6070 -
6071 -
6072 -/**
6073 - * Internal dependencies
6074 - */
6075 -
6076 -
6077 -/**
6078 - * A component which renders its own children only if the current editor post
6079 - * type supports one of the given `supportKeys` prop.
6080 - *
6081 - * @param {Object} props Props.
6082 - * @param {string} [props.postType] Current post type.
6083 - * @param {WPElement} props.children Children to be rendered if post
6084 - * type supports.
6085 - * @param {(string|string[])} props.supportKeys String or string array of keys
6086 - * to test.
6087 - *
6088 - * @return {WPComponent} The component to be rendered.
6089 - */
6090 -
6091 -function PostTypeSupportCheck(_ref) {
6092 - let {
6093 - postType,
6094 - children,
6095 - supportKeys
6096 - } = _ref;
6097 - let isSupported = true;
6098 -
6099 - if (postType) {
6100 - isSupported = (0,external_lodash_namespaceObject.some)((0,external_lodash_namespaceObject.castArray)(supportKeys), key => !!postType.supports[key]);
6101 - }
6102 -
6103 - if (!isSupported) {
6104 - return null;
6105 - }
6106 -
6107 - return children;
6108 -}
6109 -/* harmony default export */ var post_type_support_check = ((0,external_wp_data_namespaceObject.withSelect)(select => {
6110 - const {
6111 - getEditedPostAttribute
6112 - } = select(store);
6113 - const {
6114 - getPostType
6115 - } = select(external_wp_coreData_namespaceObject.store);
6116 - return {
6117 - postType: getPostType(getEditedPostAttribute('type'))
6118 - };
6119 -})(PostTypeSupportCheck));
6120 -//# sourceMappingURL=index.js.map
6121 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/page-attributes/order.js
6122 -
6123 -
6124 -/**
6125 - * External dependencies
6126 - */
6127 -
6128 -/**
6129 - * WordPress dependencies
6130 - */
6131 -
6132 -
6133 -
6134 -
6135 -
6136 -
6137 -/**
6138 - * Internal dependencies
6139 - */
6140 -
6141 -
6142 -
6143 -const PageAttributesOrder = _ref => {
6144 - let {
6145 - onUpdateOrder,
6146 - order = 0
6147 - } = _ref;
6148 - const [orderInput, setOrderInput] = (0,external_wp_element_namespaceObject.useState)(null);
6149 -
6150 - const setUpdatedOrder = value => {
6151 - setOrderInput(value);
6152 - const newOrder = Number(value);
6153 -
6154 - if (Number.isInteger(newOrder) && (0,external_lodash_namespaceObject.invoke)(value, ['trim']) !== '') {
6155 - onUpdateOrder(Number(value));
6156 - }
6157 - };
6158 -
6159 - const value = orderInput === null ? order : orderInput;
6160 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
6161 - className: "editor-page-attributes__order",
6162 - type: "number",
6163 - label: (0,external_wp_i18n_namespaceObject.__)('Order'),
6164 - value: value,
6165 - onChange: setUpdatedOrder,
6166 - size: 6,
6167 - onBlur: () => {
6168 - setOrderInput(null);
6169 - }
6170 - });
6171 -};
6172 -
6173 -function PageAttributesOrderWithChecks(props) {
6174 - return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
6175 - supportKeys: "page-attributes"
6176 - }, (0,external_wp_element_namespaceObject.createElement)(PageAttributesOrder, props));
6177 -}
6178 -
6179 -/* harmony default export */ var order = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
6180 - return {
6181 - order: select(store).getEditedPostAttribute('menu_order')
6182 - };
6183 -}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
6184 - onUpdateOrder(order) {
6185 - dispatch(store).editPost({
6186 - menu_order: order
6187 - });
6188 - }
6189 -
6190 -}))])(PageAttributesOrderWithChecks));
6191 -//# sourceMappingURL=order.js.map
6192 -;// CONCATENATED MODULE: ./packages/editor/build-module/utils/terms.js
6193 -/**
6194 - * External dependencies
6195 - */
6196 -
6197 -/**
6198 - * Returns terms in a tree form.
6199 - *
6200 - * @param {Array} flatTerms Array of terms in flat format.
6201 - *
6202 - * @return {Array} Array of terms in tree format.
6203 - */
6204 -
6205 -function buildTermsTree(flatTerms) {
6206 - const flatTermsWithParentAndChildren = flatTerms.map(term => {
6207 - return {
6208 - children: [],
6209 - parent: null,
6210 - ...term
6211 - };
6212 - });
6213 - const termsByParent = (0,external_lodash_namespaceObject.groupBy)(flatTermsWithParentAndChildren, 'parent');
6214 -
6215 - if (termsByParent.null && termsByParent.null.length) {
6216 - return flatTermsWithParentAndChildren;
6217 - }
6218 -
6219 - const fillWithChildren = terms => {
6220 - return terms.map(term => {
6221 - const children = termsByParent[term.id];
6222 - return { ...term,
6223 - children: children && children.length ? fillWithChildren(children) : []
6224 - };
6225 - });
6226 - };
6227 -
6228 - return fillWithChildren(termsByParent['0'] || []);
6229 -} // Lodash unescape function handles &#39; but not &#039; which may be return in some API requests.
6230 -
6231 -const unescapeString = arg => {
6232 - return (0,external_lodash_namespaceObject.unescape)(arg.replace('&#039;', "'"));
6233 -};
6234 -/**
6235 - * Returns a term object with name unescaped.
6236 - * The unescape of the name property is done using lodash unescape function.
6237 - *
6238 - * @param {Object} term The term object to unescape.
6239 - *
6240 - * @return {Object} Term object with name property unescaped.
6241 - */
6242 -
6243 -const unescapeTerm = term => {
6244 - return { ...term,
6245 - name: unescapeString(term.name)
6246 - };
6247 -};
6248 -/**
6249 - * Returns an array of term objects with names unescaped.
6250 - * The unescape of each term is performed using the unescapeTerm function.
6251 - *
6252 - * @param {Object[]} terms Array of term objects to unescape.
6253 - *
6254 - * @return {Object[]} Array of term objects unescaped.
6255 - */
6256 -
6257 -const unescapeTerms = terms => {
6258 - return (0,external_lodash_namespaceObject.map)(terms, unescapeTerm);
6259 -};
6260 -//# sourceMappingURL=terms.js.map
6261 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/page-attributes/parent.js
6262 -
6263 -
6264 -/**
6265 - * External dependencies
6266 - */
6267 -
6268 -/**
6269 - * WordPress dependencies
6270 - */
6271 -
6272 -
6273 -
6274 -
6275 -
6276 -
6277 -
6278 -/**
6279 - * Internal dependencies
6280 - */
6281 -
6282 -
6283 -
6284 -
6285 -function getTitle(post) {
6286 - var _post$title;
6287 -
6288 - return post !== null && post !== void 0 && (_post$title = post.title) !== null && _post$title !== void 0 && _post$title.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#${post.id} (${(0,external_wp_i18n_namespaceObject.__)('no title')})`;
6289 -}
6290 -
6291 -const getItemPriority = (name, searchValue) => {
6292 - const normalizedName = (0,external_lodash_namespaceObject.deburr)(name).toLowerCase();
6293 - const normalizedSearch = (0,external_lodash_namespaceObject.deburr)(searchValue).toLowerCase();
6294 -
6295 - if (normalizedName === normalizedSearch) {
6296 - return 0;
6297 - }
6298 -
6299 - if (normalizedName.startsWith(normalizedSearch)) {
6300 - return normalizedName.length;
6301 - }
6302 -
6303 - return Infinity;
6304 -};
6305 -function PageAttributesParent() {
6306 - const {
6307 - editPost
6308 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
6309 - const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(false);
6310 - const {
6311 - parentPost,
6312 - parentPostId,
6313 - items,
6314 - postType
6315 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6316 - const {
6317 - getPostType,
6318 - getEntityRecords,
6319 - getEntityRecord
6320 - } = select(external_wp_coreData_namespaceObject.store);
6321 - const {
6322 - getCurrentPostId,
6323 - getEditedPostAttribute
6324 - } = select(store);
6325 - const postTypeSlug = getEditedPostAttribute('type');
6326 - const pageId = getEditedPostAttribute('parent');
6327 - const pType = getPostType(postTypeSlug);
6328 - const postId = getCurrentPostId();
6329 - const isHierarchical = (0,external_lodash_namespaceObject.get)(pType, ['hierarchical'], false);
6330 - const query = {
6331 - per_page: 100,
6332 - exclude: postId,
6333 - parent_exclude: postId,
6334 - orderby: 'menu_order',
6335 - order: 'asc',
6336 - _fields: 'id,title,parent'
6337 - }; // Perform a search when the field is changed.
6338 -
6339 - if (!!fieldValue) {
6340 - query.search = fieldValue;
6341 - }
6342 -
6343 - return {
6344 - parentPostId: pageId,
6345 - parentPost: pageId ? getEntityRecord('postType', postTypeSlug, pageId) : null,
6346 - items: isHierarchical ? getEntityRecords('postType', postTypeSlug, query) : [],
6347 - postType: pType
6348 - };
6349 - }, [fieldValue]);
6350 - const isHierarchical = (0,external_lodash_namespaceObject.get)(postType, ['hierarchical'], false);
6351 - const parentPageLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels', 'parent_item_colon']);
6352 - const pageItems = items || [];
6353 - const parentOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
6354 - const getOptionsFromTree = function (tree) {
6355 - let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
6356 - const mappedNodes = tree.map(treeNode => [{
6357 - value: treeNode.id,
6358 - label: (0,external_lodash_namespaceObject.repeat)('— ', level) + (0,external_lodash_namespaceObject.unescape)(treeNode.name),
6359 - rawName: treeNode.name
6360 - }, ...getOptionsFromTree(treeNode.children || [], level + 1)]);
6361 - const sortedNodes = mappedNodes.sort((_ref, _ref2) => {
6362 - let [a] = _ref;
6363 - let [b] = _ref2;
6364 - const priorityA = getItemPriority(a.rawName, fieldValue);
6365 - const priorityB = getItemPriority(b.rawName, fieldValue);
6366 - return priorityA >= priorityB ? 1 : -1;
6367 - });
6368 - return (0,external_lodash_namespaceObject.flatten)(sortedNodes);
6369 - };
6370 -
6371 - let tree = pageItems.map(item => ({
6372 - id: item.id,
6373 - parent: item.parent,
6374 - name: getTitle(item)
6375 - })); // Only build a hierarchical tree when not searching.
6376 -
6377 - if (!fieldValue) {
6378 - tree = buildTermsTree(tree);
6379 - }
6380 -
6381 - const opts = getOptionsFromTree(tree); // Ensure the current parent is in the options list.
6382 -
6383 - const optsHasParent = (0,external_lodash_namespaceObject.find)(opts, item => item.value === parentPostId);
6384 -
6385 - if (parentPost && !optsHasParent) {
6386 - opts.unshift({
6387 - value: parentPostId,
6388 - label: getTitle(parentPost)
6389 - });
6390 - }
6391 -
6392 - return opts;
6393 - }, [pageItems, fieldValue]);
6394 -
6395 - if (!isHierarchical || !parentPageLabel) {
6396 - return null;
6397 - }
6398 - /**
6399 - * Handle user input.
6400 - *
6401 - * @param {string} inputValue The current value of the input field.
6402 - */
6403 -
6404 -
6405 - const handleKeydown = inputValue => {
6406 - setFieldValue(inputValue);
6407 - };
6408 - /**
6409 - * Handle author selection.
6410 - *
6411 - * @param {Object} selectedPostId The selected Author.
6412 - */
6413 -
6414 -
6415 - const handleChange = selectedPostId => {
6416 - editPost({
6417 - parent: selectedPostId
6418 - });
6419 - };
6420 -
6421 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ComboboxControl, {
6422 - className: "editor-page-attributes__parent",
6423 - label: parentPageLabel,
6424 - value: parentPostId,
6425 - options: parentOptions,
6426 - onFilterValueChange: (0,external_lodash_namespaceObject.debounce)(handleKeydown, 300),
6427 - onChange: handleChange
6428 - });
6429 -}
6430 -/* harmony default export */ var page_attributes_parent = (PageAttributesParent);
6431 -//# sourceMappingURL=parent.js.map
6432 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-template/index.js
6433 -
6434 -
6435 -/**
6436 - * External dependencies
6437 - */
6438 -
6439 -/**
6440 - * WordPress dependencies
6441 - */
6442 -
6443 -
6444 -
6445 -
6446 -
6447 -/**
6448 - * Internal dependencies
6449 - */
6450 -
6451 -
6452 -function PostTemplate(_ref) {
6453 - let {} = _ref;
6454 - const {
6455 - availableTemplates,
6456 - selectedTemplate,
6457 - isViewable
6458 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6459 - var _getPostType$viewable, _getPostType;
6460 -
6461 - const {
6462 - getEditedPostAttribute,
6463 - getEditorSettings,
6464 - getCurrentPostType
6465 - } = select(store);
6466 - const {
6467 - getPostType
6468 - } = select(external_wp_coreData_namespaceObject.store);
6469 - return {
6470 - selectedTemplate: getEditedPostAttribute('template'),
6471 - availableTemplates: getEditorSettings().availableTemplates,
6472 - isViewable: (_getPostType$viewable = (_getPostType = getPostType(getCurrentPostType())) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false
6473 - };
6474 - }, []);
6475 - const {
6476 - editPost
6477 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
6478 -
6479 - if (!isViewable || (0,external_lodash_namespaceObject.isEmpty)(availableTemplates)) {
6480 - return null;
6481 - }
6482 -
6483 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
6484 - label: (0,external_wp_i18n_namespaceObject.__)('Template:'),
6485 - value: selectedTemplate,
6486 - onChange: templateSlug => {
6487 - editPost({
6488 - template: templateSlug || ''
6489 - });
6490 - },
6491 - options: (0,external_lodash_namespaceObject.map)(availableTemplates, (templateName, templateSlug) => ({
6492 - value: templateSlug,
6493 - label: templateName
6494 - }))
6495 - });
6496 -}
6497 -/* harmony default export */ var post_template = (PostTemplate);
6498 -//# sourceMappingURL=index.js.map
6499 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-author/constants.js
6500 -const AUTHORS_QUERY = {
6501 - who: 'authors',
6502 - per_page: 50,
6503 - _fields: 'id,name',
6504 - context: 'view' // Allows non-admins to perform requests.
6505 -
6506 -};
6507 -//# sourceMappingURL=constants.js.map
6508 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-author/combobox.js
6509 -
6510 -
6511 -/**
6512 - * External dependencies
6513 - */
6514 -
6515 -/**
6516 - * WordPress dependencies
6517 - */
6518 -
6519 -
6520 -
6521 -
6522 -
6523 -
6524 -
6525 -/**
6526 - * Internal dependencies
6527 - */
6528 -
6529 -
6530 -
6531 -
6532 -function PostAuthorCombobox() {
6533 - const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)();
6534 - const {
6535 - authorId,
6536 - isLoading,
6537 - authors,
6538 - postAuthor
6539 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6540 - const {
6541 - getUser,
6542 - getUsers,
6543 - isResolving
6544 - } = select(external_wp_coreData_namespaceObject.store);
6545 - const {
6546 - getEditedPostAttribute
6547 - } = select(store);
6548 - const author = getUser(getEditedPostAttribute('author'), {
6549 - context: 'view'
6550 - });
6551 - const query = { ...AUTHORS_QUERY
6552 - };
6553 -
6554 - if (fieldValue) {
6555 - query.search = fieldValue;
6556 - }
6557 -
6558 - return {
6559 - authorId: getEditedPostAttribute('author'),
6560 - postAuthor: author,
6561 - authors: getUsers(query),
6562 - isLoading: isResolving('core', 'getUsers', [query])
6563 - };
6564 - }, [fieldValue]);
6565 - const {
6566 - editPost
6567 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
6568 - const authorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
6569 - const fetchedAuthors = (authors !== null && authors !== void 0 ? authors : []).map(author => {
6570 - return {
6571 - value: author.id,
6572 - label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(author.name)
6573 - };
6574 - }); // Ensure the current author is included in the dropdown list.
6575 -
6576 - const foundAuthor = fetchedAuthors.findIndex(_ref => {
6577 - let {
6578 - value
6579 - } = _ref;
6580 - return (postAuthor === null || postAuthor === void 0 ? void 0 : postAuthor.id) === value;
6581 - });
6582 -
6583 - if (foundAuthor < 0 && postAuthor) {
6584 - return [{
6585 - value: postAuthor.id,
6586 - label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor.name)
6587 - }, ...fetchedAuthors];
6588 - }
6589 -
6590 - return fetchedAuthors;
6591 - }, [authors, postAuthor]);
6592 - /**
6593 - * Handle author selection.
6594 - *
6595 - * @param {number} postAuthorId The selected Author.
6596 - */
6597 -
6598 - const handleSelect = postAuthorId => {
6599 - if (!postAuthorId) {
6600 - return;
6601 - }
6602 -
6603 - editPost({
6604 - author: postAuthorId
6605 - });
6606 - };
6607 - /**
6608 - * Handle user input.
6609 - *
6610 - * @param {string} inputValue The current value of the input field.
6611 - */
6612 -
6613 -
6614 - const handleKeydown = inputValue => {
6615 - setFieldValue(inputValue);
6616 - };
6617 -
6618 - if (!postAuthor) {
6619 - return null;
6620 - }
6621 -
6622 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ComboboxControl, {
6623 - label: (0,external_wp_i18n_namespaceObject.__)('Author'),
6624 - options: authorOptions,
6625 - value: authorId,
6626 - onFilterValueChange: (0,external_lodash_namespaceObject.debounce)(handleKeydown, 300),
6627 - onChange: handleSelect,
6628 - isLoading: isLoading,
6629 - allowReset: false
6630 - });
6631 -}
6632 -
6633 -/* harmony default export */ var combobox = (PostAuthorCombobox);
6634 -//# sourceMappingURL=combobox.js.map
6635 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-author/select.js
6636 -
6637 -
6638 -/**
6639 - * WordPress dependencies
6640 - */
6641 -
6642 -
6643 -
6644 -
6645 -
6646 -
6647 -/**
6648 - * Internal dependencies
6649 - */
6650 -
6651 -
6652 -
6653 -
6654 -function PostAuthorSelect() {
6655 - const {
6656 - editPost
6657 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
6658 - const {
6659 - postAuthor,
6660 - authors
6661 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6662 - return {
6663 - postAuthor: select(store).getEditedPostAttribute('author'),
6664 - authors: select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY)
6665 - };
6666 - }, []);
6667 - const authorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
6668 - return (authors !== null && authors !== void 0 ? authors : []).map(author => {
6669 - return {
6670 - value: author.id,
6671 - label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(author.name)
6672 - };
6673 - });
6674 - }, [authors]);
6675 -
6676 - const setAuthorId = value => {
6677 - const author = Number(value);
6678 - editPost({
6679 - author
6680 - });
6681 - };
6682 -
6683 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
6684 - className: "post-author-selector",
6685 - label: (0,external_wp_i18n_namespaceObject.__)('Author'),
6686 - options: authorOptions,
6687 - onChange: setAuthorId,
6688 - value: postAuthor
6689 - });
6690 -}
6691 -
6692 -/* harmony default export */ var post_author_select = (PostAuthorSelect);
6693 -//# sourceMappingURL=select.js.map
6694 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-author/index.js
6695 -
6696 -
6697 -/**
6698 - * WordPress dependencies
6699 - */
6700 -
6701 -
6702 -/**
6703 - * Internal dependencies
6704 - */
6705 -
6706 -
6707 -
6708 -
6709 -const minimumUsersForCombobox = 25;
6710 -
6711 -function PostAuthor() {
6712 - const showCombobox = (0,external_wp_data_namespaceObject.useSelect)(select => {
6713 - const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY);
6714 - return (authors === null || authors === void 0 ? void 0 : authors.length) >= minimumUsersForCombobox;
6715 - }, []);
6716 -
6717 - if (showCombobox) {
6718 - return (0,external_wp_element_namespaceObject.createElement)(combobox, null);
6719 - }
6720 -
6721 - return (0,external_wp_element_namespaceObject.createElement)(post_author_select, null);
6722 -}
6723 -
6724 -/* harmony default export */ var post_author = (PostAuthor);
6725 -//# sourceMappingURL=index.js.map
6726 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-author/check.js
6727 -
6728 -
6729 -/**
6730 - * External dependencies
6731 - */
6732 -
6733 -/**
6734 - * WordPress dependencies
6735 - */
6736 -
6737 -
6738 -
6739 -/**
6740 - * Internal dependencies
6741 - */
6742 -
6743 -
6744 -
6745 -
6746 -function PostAuthorCheck(_ref) {
6747 - let {
6748 - children
6749 - } = _ref;
6750 - const {
6751 - hasAssignAuthorAction,
6752 - hasAuthors
6753 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6754 - const post = select(store).getCurrentPost();
6755 - const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY);
6756 - return {
6757 - hasAssignAuthorAction: (0,external_lodash_namespaceObject.get)(post, ['_links', 'wp:action-assign-author'], false),
6758 - hasAuthors: (authors === null || authors === void 0 ? void 0 : authors.length) >= 1
6759 - };
6760 - }, []);
6761 -
6762 - if (!hasAssignAuthorAction || !hasAuthors) {
6763 - return null;
6764 - }
6765 -
6766 - return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
6767 - supportKeys: "author"
6768 - }, children);
6769 -}
6770 -//# sourceMappingURL=check.js.map
6771 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-comments/index.js
6772 -
6773 -
6774 -/**
6775 - * WordPress dependencies
6776 - */
6777 -
6778 -
6779 -
6780 -
6781 -/**
6782 - * Internal dependencies
6783 - */
6784 -
6785 -
6786 -
6787 -function PostComments(_ref) {
6788 - let {
6789 - commentStatus = 'open',
6790 - ...props
6791 - } = _ref;
6792 -
6793 - const onToggleComments = () => props.editPost({
6794 - comment_status: commentStatus === 'open' ? 'closed' : 'open'
6795 - });
6796 -
6797 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
6798 - label: (0,external_wp_i18n_namespaceObject.__)('Allow comments'),
6799 - checked: commentStatus === 'open',
6800 - onChange: onToggleComments
6801 - });
6802 -}
6803 -
6804 -/* harmony default export */ var post_comments = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
6805 - return {
6806 - commentStatus: select(store).getEditedPostAttribute('comment_status')
6807 - };
6808 -}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
6809 - editPost: dispatch(store).editPost
6810 -}))])(PostComments));
6811 -//# sourceMappingURL=index.js.map
6812 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-excerpt/index.js
6813 -
6814 -
6815 -/**
6816 - * WordPress dependencies
6817 - */
6818 -
6819 -
6820 -
6821 -
6822 -/**
6823 - * Internal dependencies
6824 - */
6825 -
6826 -
6827 -
6828 -function PostExcerpt(_ref) {
6829 - let {
6830 - excerpt,
6831 - onUpdateExcerpt
6832 - } = _ref;
6833 - return (0,external_wp_element_namespaceObject.createElement)("div", {
6834 - className: "editor-post-excerpt"
6835 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextareaControl, {
6836 - label: (0,external_wp_i18n_namespaceObject.__)('Write an excerpt (optional)'),
6837 - className: "editor-post-excerpt__textarea",
6838 - onChange: value => onUpdateExcerpt(value),
6839 - value: excerpt
6840 - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
6841 - href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/excerpt/')
6842 - }, (0,external_wp_i18n_namespaceObject.__)('Learn more about manual excerpts')));
6843 -}
6844 -
6845 -/* harmony default export */ var post_excerpt = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
6846 - return {
6847 - excerpt: select(store).getEditedPostAttribute('excerpt')
6848 - };
6849 -}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
6850 - onUpdateExcerpt(excerpt) {
6851 - dispatch(store).editPost({
6852 - excerpt
6853 - });
6854 - }
6855 -
6856 -}))])(PostExcerpt));
6857 -//# sourceMappingURL=index.js.map
6858 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-excerpt/check.js
6859 -
6860 -
6861 -
6862 -/**
6863 - * Internal dependencies
6864 - */
6865 -
6866 -
6867 -function PostExcerptCheck(props) {
6868 - return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, _extends({}, props, {
6869 - supportKeys: "excerpt"
6870 - }));
6871 -}
6872 -
6873 -/* harmony default export */ var post_excerpt_check = (PostExcerptCheck);
6874 -//# sourceMappingURL=check.js.map
6875 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/theme-support-check/index.js
6876 -/**
6877 - * External dependencies
6878 - */
6879 -
6880 -/**
6881 - * WordPress dependencies
6882 - */
6883 -
6884 -
6885 -
6886 -/**
6887 - * Internal dependencies
6888 - */
6889 -
6890 -
6891 -function ThemeSupportCheck(_ref) {
6892 - let {
6893 - themeSupports,
6894 - children,
6895 - postType,
6896 - supportKeys
6897 - } = _ref;
6898 - const isSupported = (0,external_lodash_namespaceObject.some)((0,external_lodash_namespaceObject.castArray)(supportKeys), key => {
6899 - const supported = (0,external_lodash_namespaceObject.get)(themeSupports, [key], false); // 'post-thumbnails' can be boolean or an array of post types.
6900 - // In the latter case, we need to verify `postType` exists
6901 - // within `supported`. If `postType` isn't passed, then the check
6902 - // should fail.
6903 -
6904 - if ('post-thumbnails' === key && (0,external_lodash_namespaceObject.isArray)(supported)) {
6905 - return (0,external_lodash_namespaceObject.includes)(supported, postType);
6906 - }
6907 -
6908 - return supported;
6909 - });
6910 -
6911 - if (!isSupported) {
6912 - return null;
6913 - }
6914 -
6915 - return children;
6916 -}
6917 -/* harmony default export */ var theme_support_check = ((0,external_wp_data_namespaceObject.withSelect)(select => {
6918 - const {
6919 - getThemeSupports
6920 - } = select(external_wp_coreData_namespaceObject.store);
6921 - const {
6922 - getEditedPostAttribute
6923 - } = select(store);
6924 - return {
6925 - postType: getEditedPostAttribute('type'),
6926 - themeSupports: getThemeSupports()
6927 - };
6928 -})(ThemeSupportCheck));
6929 -//# sourceMappingURL=index.js.map
6930 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-featured-image/check.js
6931 -
6932 -
6933 -
6934 -/**
6935 - * Internal dependencies
6936 - */
6937 -
6938 -
6939 -
6940 -function PostFeaturedImageCheck(props) {
6941 - return (0,external_wp_element_namespaceObject.createElement)(theme_support_check, {
6942 - supportKeys: "post-thumbnails"
6943 - }, (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, _extends({}, props, {
6944 - supportKeys: "thumbnail"
6945 - })));
6946 -}
6947 -
6948 -/* harmony default export */ var post_featured_image_check = (PostFeaturedImageCheck);
6949 -//# sourceMappingURL=check.js.map
6950 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-featured-image/index.js
6951 -
6952 -
6953 -/**
6954 - * External dependencies
6955 - */
6956 -
6957 -/**
6958 - * WordPress dependencies
6959 - */
6960 -
6961 -
6962 -
6963 -
6964 -
6965 -
6966 -
6967 -
6968 -/**
6969 - * Internal dependencies
6970 - */
6971 -
6972 -
6973 -
6974 -const ALLOWED_MEDIA_TYPES = ['image']; // Used when labels from post type were not yet loaded or when they are not present.
6975 -
6976 -const DEFAULT_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Featured image');
6977 -
6978 -const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Set featured image');
6979 -
6980 -const DEFAULT_REMOVE_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Remove image');
6981 -
6982 -function PostFeaturedImage(_ref) {
6983 - var _media$media_details$, _media$media_details$2;
6984 -
6985 - let {
6986 - currentPostId,
6987 - featuredImageId,
6988 - onUpdateImage,
6989 - onDropImage,
6990 - onRemoveImage,
6991 - media,
6992 - postType,
6993 - noticeUI
6994 - } = _ref;
6995 - const postLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels'], {});
6996 - const instructions = (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('To edit the featured image, you need permission to upload media.'));
6997 - let mediaWidth, mediaHeight, mediaSourceUrl;
6998 -
6999 - if (media) {
7000 - const mediaSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'post-thumbnail', media.id, currentPostId);
7001 -
7002 - if ((0,external_lodash_namespaceObject.has)(media, ['media_details', 'sizes', mediaSize])) {
7003 - // use mediaSize when available
7004 - mediaWidth = media.media_details.sizes[mediaSize].width;
7005 - mediaHeight = media.media_details.sizes[mediaSize].height;
7006 - mediaSourceUrl = media.media_details.sizes[mediaSize].source_url;
7007 - } else {
7008 - // get fallbackMediaSize if mediaSize is not available
7009 - const fallbackMediaSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, currentPostId);
7010 -
7011 - if ((0,external_lodash_namespaceObject.has)(media, ['media_details', 'sizes', fallbackMediaSize])) {
7012 - // use fallbackMediaSize when mediaSize is not available
7013 - mediaWidth = media.media_details.sizes[fallbackMediaSize].width;
7014 - mediaHeight = media.media_details.sizes[fallbackMediaSize].height;
7015 - mediaSourceUrl = media.media_details.sizes[fallbackMediaSize].source_url;
7016 - } else {
7017 - // use full image size when mediaFallbackSize and mediaSize are not available
7018 - mediaWidth = media.media_details.width;
7019 - mediaHeight = media.media_details.height;
7020 - mediaSourceUrl = media.source_url;
7021 - }
7022 - }
7023 - }
7024 -
7025 - return (0,external_wp_element_namespaceObject.createElement)(post_featured_image_check, null, noticeUI, (0,external_wp_element_namespaceObject.createElement)("div", {
7026 - className: "editor-post-featured-image"
7027 - }, media && (0,external_wp_element_namespaceObject.createElement)("div", {
7028 - id: `editor-post-featured-image-${featuredImageId}-describedby`,
7029 - className: "hidden"
7030 - }, media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: The selected image alt text.
7031 - (0,external_wp_i18n_namespaceObject.__)('Current image: %s'), media.alt_text), !media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: The selected image filename.
7032 - (0,external_wp_i18n_namespaceObject.__)('The current image has no alternative text. The file name is: %s'), ((_media$media_details$ = media.media_details.sizes) === null || _media$media_details$ === void 0 ? void 0 : (_media$media_details$2 = _media$media_details$.full) === null || _media$media_details$2 === void 0 ? void 0 : _media$media_details$2.file) || media.slug)), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, {
7033 - fallback: instructions
7034 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUpload, {
7035 - title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
7036 - onSelect: onUpdateImage,
7037 - unstableFeaturedImageFlow: true,
7038 - allowedTypes: ALLOWED_MEDIA_TYPES,
7039 - modalClass: "editor-post-featured-image__media-modal",
7040 - render: _ref2 => {
7041 - let {
7042 - open
7043 - } = _ref2;
7044 - return (0,external_wp_element_namespaceObject.createElement)("div", {
7045 - className: "editor-post-featured-image__container"
7046 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7047 - className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
7048 - onClick: open,
7049 - "aria-label": !featuredImageId ? null : (0,external_wp_i18n_namespaceObject.__)('Edit or update the image'),
7050 - "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby`
7051 - }, !!featuredImageId && media && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ResponsiveWrapper, {
7052 - naturalWidth: mediaWidth,
7053 - naturalHeight: mediaHeight,
7054 - isInline: true
7055 - }, (0,external_wp_element_namespaceObject.createElement)("img", {
7056 - src: mediaSourceUrl,
7057 - alt: ""
7058 - })), !!featuredImageId && !media && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), !featuredImageId && (postLabel.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropZone, {
7059 - onFilesDrop: onDropImage
7060 - }));
7061 - },
7062 - value: featuredImageId
7063 - })), !!featuredImageId && media && !media.isLoading && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUpload, {
7064 - title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
7065 - onSelect: onUpdateImage,
7066 - unstableFeaturedImageFlow: true,
7067 - allowedTypes: ALLOWED_MEDIA_TYPES,
7068 - modalClass: "editor-post-featured-image__media-modal",
7069 - render: _ref3 => {
7070 - let {
7071 - open
7072 - } = _ref3;
7073 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7074 - onClick: open,
7075 - variant: "secondary"
7076 - }, (0,external_wp_i18n_namespaceObject.__)('Replace Image'));
7077 - }
7078 - })), !!featuredImageId && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7079 - onClick: onRemoveImage,
7080 - variant: "link",
7081 - isDestructive: true
7082 - }, postLabel.remove_featured_image || DEFAULT_REMOVE_FEATURE_IMAGE_LABEL))));
7083 -}
7084 -
7085 -const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)(select => {
7086 - const {
7087 - getMedia,
7088 - getPostType
7089 - } = select(external_wp_coreData_namespaceObject.store);
7090 - const {
7091 - getCurrentPostId,
7092 - getEditedPostAttribute
7093 - } = select(store);
7094 - const featuredImageId = getEditedPostAttribute('featured_media');
7095 - return {
7096 - media: featuredImageId ? getMedia(featuredImageId, {
7097 - context: 'view'
7098 - }) : null,
7099 - currentPostId: getCurrentPostId(),
7100 - postType: getPostType(getEditedPostAttribute('type')),
7101 - featuredImageId
7102 - };
7103 -});
7104 -const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref4, _ref5) => {
7105 - let {
7106 - noticeOperations
7107 - } = _ref4;
7108 - let {
7109 - select
7110 - } = _ref5;
7111 - const {
7112 - editPost
7113 - } = dispatch(store);
7114 - return {
7115 - onUpdateImage(image) {
7116 - editPost({
7117 - featured_media: image.id
7118 - });
7119 - },
7120 -
7121 - onDropImage(filesList) {
7122 - select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload({
7123 - allowedTypes: ['image'],
7124 - filesList,
7125 -
7126 - onFileChange(_ref6) {
7127 - let [image] = _ref6;
7128 - editPost({
7129 - featured_media: image.id
7130 - });
7131 - },
7132 -
7133 - onError(message) {
7134 - noticeOperations.removeAllNotices();
7135 - noticeOperations.createErrorNotice(message);
7136 - }
7137 -
7138 - });
7139 - },
7140 -
7141 - onRemoveImage() {
7142 - editPost({
7143 - featured_media: 0
7144 - });
7145 - }
7146 -
7147 - };
7148 -});
7149 -/* harmony default export */ var post_featured_image = ((0,external_wp_compose_namespaceObject.compose)(external_wp_components_namespaceObject.withNotices, applyWithSelect, applyWithDispatch, (0,external_wp_components_namespaceObject.withFilters)('editor.PostFeaturedImage'))(PostFeaturedImage));
7150 -//# sourceMappingURL=index.js.map
7151 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-format/check.js
7152 -
7153 -
7154 -
7155 -/**
7156 - * WordPress dependencies
7157 - */
7158 -
7159 -/**
7160 - * Internal dependencies
7161 - */
7162 -
7163 -
7164 -
7165 -
7166 -function PostFormatCheck(_ref) {
7167 - let {
7168 - disablePostFormats,
7169 - ...props
7170 - } = _ref;
7171 - return !disablePostFormats && (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, _extends({}, props, {
7172 - supportKeys: "post-formats"
7173 - }));
7174 -}
7175 -
7176 -/* harmony default export */ var post_format_check = ((0,external_wp_data_namespaceObject.withSelect)(select => {
7177 - const editorSettings = select(store).getEditorSettings();
7178 - return {
7179 - disablePostFormats: editorSettings.disablePostFormats
7180 - };
7181 -})(PostFormatCheck));
7182 -//# sourceMappingURL=check.js.map
7183 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-format/index.js
7184 -
7185 -
7186 -/**
7187 - * External dependencies
7188 - */
7189 -
7190 -/**
7191 - * WordPress dependencies
7192 - */
7193 -
7194 -
7195 -
7196 -
7197 -
7198 -
7199 -/**
7200 - * Internal dependencies
7201 - */
7202 -
7203 -
7204 - // All WP post formats, sorted alphabetically by translated name.
7205 -
7206 -const POST_FORMATS = [{
7207 - id: 'aside',
7208 - caption: (0,external_wp_i18n_namespaceObject.__)('Aside')
7209 -}, {
7210 - id: 'audio',
7211 - caption: (0,external_wp_i18n_namespaceObject.__)('Audio')
7212 -}, {
7213 - id: 'chat',
7214 - caption: (0,external_wp_i18n_namespaceObject.__)('Chat')
7215 -}, {
7216 - id: 'gallery',
7217 - caption: (0,external_wp_i18n_namespaceObject.__)('Gallery')
7218 -}, {
7219 - id: 'image',
7220 - caption: (0,external_wp_i18n_namespaceObject.__)('Image')
7221 -}, {
7222 - id: 'link',
7223 - caption: (0,external_wp_i18n_namespaceObject.__)('Link')
7224 -}, {
7225 - id: 'quote',
7226 - caption: (0,external_wp_i18n_namespaceObject.__)('Quote')
7227 -}, {
7228 - id: 'standard',
7229 - caption: (0,external_wp_i18n_namespaceObject.__)('Standard')
7230 -}, {
7231 - id: 'status',
7232 - caption: (0,external_wp_i18n_namespaceObject.__)('Status')
7233 -}, {
7234 - id: 'video',
7235 - caption: (0,external_wp_i18n_namespaceObject.__)('Video')
7236 -}].sort((a, b) => {
7237 - const normalizedA = a.caption.toUpperCase();
7238 - const normalizedB = b.caption.toUpperCase();
7239 -
7240 - if (normalizedA < normalizedB) {
7241 - return -1;
7242 - }
7243 -
7244 - if (normalizedA > normalizedB) {
7245 - return 1;
7246 - }
7247 -
7248 - return 0;
7249 -});
7250 -function PostFormat() {
7251 - const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostFormat);
7252 - const postFormatSelectorId = `post-format-selector-${instanceId}`;
7253 - const {
7254 - postFormat,
7255 - suggestedFormat,
7256 - supportedFormats
7257 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7258 - const {
7259 - getEditedPostAttribute,
7260 - getSuggestedPostFormat
7261 - } = select(store);
7262 -
7263 - const _postFormat = getEditedPostAttribute('format');
7264 -
7265 - const themeSupports = select(external_wp_coreData_namespaceObject.store).getThemeSupports();
7266 - return {
7267 - postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard',
7268 - suggestedFormat: getSuggestedPostFormat(),
7269 - supportedFormats: themeSupports.formats
7270 - };
7271 - }, []);
7272 - const formats = POST_FORMATS.filter(format => {
7273 - // Ensure current format is always in the set.
7274 - // The current format may not be a format supported by the theme.
7275 - return (0,external_lodash_namespaceObject.includes)(supportedFormats, format.id) || postFormat === format.id;
7276 - });
7277 - const suggestion = (0,external_lodash_namespaceObject.find)(formats, format => format.id === suggestedFormat);
7278 - const {
7279 - editPost
7280 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
7281 -
7282 - const onUpdatePostFormat = format => editPost({
7283 - format
7284 - });
7285 -
7286 - return (0,external_wp_element_namespaceObject.createElement)(post_format_check, null, (0,external_wp_element_namespaceObject.createElement)("div", {
7287 - className: "editor-post-format"
7288 - }, (0,external_wp_element_namespaceObject.createElement)("div", {
7289 - className: "editor-post-format__content"
7290 - }, (0,external_wp_element_namespaceObject.createElement)("label", {
7291 - htmlFor: postFormatSelectorId
7292 - }, (0,external_wp_i18n_namespaceObject.__)('Post Format')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
7293 - value: postFormat,
7294 - onChange: format => onUpdatePostFormat(format),
7295 - id: postFormatSelectorId,
7296 - options: formats.map(format => ({
7297 - label: format.caption,
7298 - value: format.id
7299 - }))
7300 - })), suggestion && suggestion.id !== postFormat && (0,external_wp_element_namespaceObject.createElement)("div", {
7301 - className: "editor-post-format__suggestion"
7302 - }, (0,external_wp_i18n_namespaceObject.__)('Suggestion:'), ' ', (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7303 - variant: "link",
7304 - onClick: () => onUpdatePostFormat(suggestion.id)
7305 - }, (0,external_wp_i18n_namespaceObject.sprintf)(
7306 - /* translators: %s: post format */
7307 - (0,external_wp_i18n_namespaceObject.__)('Apply format: %s'), suggestion.caption)))));
7308 -}
7309 -//# sourceMappingURL=index.js.map
7310 -;// CONCATENATED MODULE: ./packages/icons/build-module/library/backup.js
7311 -
7312 -
7313 -/**
7314 - * WordPress dependencies
7315 - */
7316 -
7317 -const backup = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
7318 - xmlns: "http://www.w3.org/2000/svg",
7319 - viewBox: "0 0 24 24"
7320 -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
7321 - d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"
7322 -}));
7323 -/* harmony default export */ var library_backup = (backup);
7324 -//# sourceMappingURL=backup.js.map
7325 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-last-revision/check.js
7326 -
7327 -
7328 -/**
7329 - * WordPress dependencies
7330 - */
7331 -
7332 -/**
7333 - * Internal dependencies
7334 - */
7335 -
7336 -
7337 -
7338 -function PostLastRevisionCheck(_ref) {
7339 - let {
7340 - lastRevisionId,
7341 - revisionsCount,
7342 - children
7343 - } = _ref;
7344 -
7345 - if (!lastRevisionId || revisionsCount < 2) {
7346 - return null;
7347 - }
7348 -
7349 - return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
7350 - supportKeys: "revisions"
7351 - }, children);
7352 -}
7353 -/* harmony default export */ var post_last_revision_check = ((0,external_wp_data_namespaceObject.withSelect)(select => {
7354 - const {
7355 - getCurrentPostLastRevisionId,
7356 - getCurrentPostRevisionsCount
7357 - } = select(store);
7358 - return {
7359 - lastRevisionId: getCurrentPostLastRevisionId(),
7360 - revisionsCount: getCurrentPostRevisionsCount()
7361 - };
7362 -})(PostLastRevisionCheck));
7363 -//# sourceMappingURL=check.js.map
7364 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-last-revision/index.js
7365 -
7366 -
7367 -/**
7368 - * WordPress dependencies
7369 - */
7370 -
7371 -
7372 -
7373 -
7374 -/**
7375 - * Internal dependencies
7376 - */
7377 -
7378 -
7379 -
7380 -
7381 -
7382 -function LastRevision(_ref) {
7383 - let {
7384 - lastRevisionId,
7385 - revisionsCount
7386 - } = _ref;
7387 - return (0,external_wp_element_namespaceObject.createElement)(post_last_revision_check, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7388 - href: getWPAdminURL('revision.php', {
7389 - revision: lastRevisionId,
7390 - gutenberg: true
7391 - }),
7392 - className: "editor-post-last-revision__title",
7393 - icon: library_backup
7394 - }, (0,external_wp_i18n_namespaceObject.sprintf)(
7395 - /* translators: %d: number of revisions */
7396 - (0,external_wp_i18n_namespaceObject._n)('%d Revision', '%d Revisions', revisionsCount), revisionsCount)));
7397 -}
7398 -
7399 -/* harmony default export */ var post_last_revision = ((0,external_wp_data_namespaceObject.withSelect)(select => {
7400 - const {
7401 - getCurrentPostLastRevisionId,
7402 - getCurrentPostRevisionsCount
7403 - } = select(store);
7404 - return {
7405 - lastRevisionId: getCurrentPostLastRevisionId(),
7406 - revisionsCount: getCurrentPostRevisionsCount()
7407 - };
7408 -})(LastRevision));
7409 -//# sourceMappingURL=index.js.map
7410 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-locked-modal/index.js
7411 -
7412 -
7413 -/**
7414 - * External dependencies
7415 - */
7416 -
7417 -/**
7418 - * WordPress dependencies
7419 - */
7420 -
7421 -
7422 -
7423 -
7424 -
7425 -
7426 -
7427 -
7428 -
7429 -/**
7430 - * Internal dependencies
7431 - */
7432 -
7433 -
7434 -
7435 -function PostLockedModal() {
7436 - const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostLockedModal);
7437 - const hookName = 'core/editor/post-locked-modal-' + instanceId;
7438 - const {
7439 - autosave,
7440 - updatePostLock
7441 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
7442 - const {
7443 - isLocked,
7444 - isTakeover,
7445 - user,
7446 - postId,
7447 - postLockUtils,
7448 - activePostLock,
7449 - postType,
7450 - previewLink
7451 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7452 - const {
7453 - isPostLocked,
7454 - isPostLockTakeover,
7455 - getPostLockUser,
7456 - getCurrentPostId,
7457 - getActivePostLock,
7458 - getEditedPostAttribute,
7459 - getEditedPostPreviewLink,
7460 - getEditorSettings
7461 - } = select(store);
7462 - const {
7463 - getPostType
7464 - } = select(external_wp_coreData_namespaceObject.store);
7465 - return {
7466 - isLocked: isPostLocked(),
7467 - isTakeover: isPostLockTakeover(),
7468 - user: getPostLockUser(),
7469 - postId: getCurrentPostId(),
7470 - postLockUtils: getEditorSettings().postLockUtils,
7471 - activePostLock: getActivePostLock(),
7472 - postType: getPostType(getEditedPostAttribute('type')),
7473 - previewLink: getEditedPostPreviewLink()
7474 - };
7475 - }, []);
7476 - (0,external_wp_element_namespaceObject.useEffect)(() => {
7477 - /**
7478 - * Keep the lock refreshed.
7479 - *
7480 - * When the user does not send a heartbeat in a heartbeat-tick
7481 - * the user is no longer editing and another user can start editing.
7482 - *
7483 - * @param {Object} data Data to send in the heartbeat request.
7484 - */
7485 - function sendPostLock(data) {
7486 - if (isLocked) {
7487 - return;
7488 - }
7489 -
7490 - data['wp-refresh-post-lock'] = {
7491 - lock: activePostLock,
7492 - post_id: postId
7493 - };
7494 - }
7495 - /**
7496 - * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing.
7497 - *
7498 - * @param {Object} data Data received in the heartbeat request
7499 - */
7500 -
7501 -
7502 - function receivePostLock(data) {
7503 - if (!data['wp-refresh-post-lock']) {
7504 - return;
7505 - }
7506 -
7507 - const received = data['wp-refresh-post-lock'];
7508 -
7509 - if (received.lock_error) {
7510 - // Auto save and display the takeover modal.
7511 - autosave();
7512 - updatePostLock({
7513 - isLocked: true,
7514 - isTakeover: true,
7515 - user: {
7516 - name: received.lock_error.name,
7517 - avatar: received.lock_error.avatar_src_2x
7518 - }
7519 - });
7520 - } else if (received.new_lock) {
7521 - updatePostLock({
7522 - isLocked: false,
7523 - activePostLock: received.new_lock
7524 - });
7525 - }
7526 - }
7527 - /**
7528 - * Unlock the post before the window is exited.
7529 - */
7530 -
7531 -
7532 - function releasePostLock() {
7533 - if (isLocked || !activePostLock) {
7534 - return;
7535 - }
7536 -
7537 - const data = new window.FormData();
7538 - data.append('action', 'wp-remove-post-lock');
7539 - data.append('_wpnonce', postLockUtils.unlockNonce);
7540 - data.append('post_ID', postId);
7541 - data.append('active_post_lock', activePostLock);
7542 -
7543 - if (window.navigator.sendBeacon) {
7544 - window.navigator.sendBeacon(postLockUtils.ajaxUrl, data);
7545 - } else {
7546 - const xhr = new window.XMLHttpRequest();
7547 - xhr.open('POST', postLockUtils.ajaxUrl, false);
7548 - xhr.send(data);
7549 - }
7550 - } // Details on these events on the Heartbeat API docs
7551 - // https://developer.wordpress.org/plugins/javascript/heartbeat-api/
7552 -
7553 -
7554 - (0,external_wp_hooks_namespaceObject.addAction)('heartbeat.send', hookName, sendPostLock);
7555 - (0,external_wp_hooks_namespaceObject.addAction)('heartbeat.tick', hookName, receivePostLock);
7556 - window.addEventListener('beforeunload', releasePostLock);
7557 - return () => {
7558 - (0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.send', hookName);
7559 - (0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.tick', hookName);
7560 - window.removeEventListener('beforeunload', releasePostLock);
7561 - };
7562 - }, []);
7563 -
7564 - if (!isLocked) {
7565 - return null;
7566 - }
7567 -
7568 - const userDisplayName = user.name;
7569 - const userAvatar = user.avatar;
7570 - const unlockUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', {
7571 - 'get-post-lock': '1',
7572 - lockKey: true,
7573 - post: postId,
7574 - action: 'edit',
7575 - _wpnonce: postLockUtils.nonce
7576 - });
7577 - const allPostsUrl = getWPAdminURL('edit.php', {
7578 - post_type: (0,external_lodash_namespaceObject.get)(postType, ['slug'])
7579 - });
7580 -
7581 - const allPostsLabel = (0,external_wp_i18n_namespaceObject.__)('Exit editor');
7582 -
7583 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
7584 - title: isTakeover ? (0,external_wp_i18n_namespaceObject.__)('Someone else has taken over this post') : (0,external_wp_i18n_namespaceObject.__)('This post is already being edited'),
7585 - focusOnMount: true,
7586 - shouldCloseOnClickOutside: false,
7587 - shouldCloseOnEsc: false,
7588 - isDismissible: false,
7589 - className: "editor-post-locked-modal"
7590 - }, !!userAvatar && (0,external_wp_element_namespaceObject.createElement)("img", {
7591 - src: userAvatar,
7592 - alt: (0,external_wp_i18n_namespaceObject.__)('Avatar'),
7593 - className: "editor-post-locked-modal__avatar",
7594 - width: 64,
7595 - height: 64
7596 - }), (0,external_wp_element_namespaceObject.createElement)("div", null, !!isTakeover && (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)(
7597 - /* translators: %s: user's display name */
7598 - (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> now has editing control of this posts (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), {
7599 - strong: (0,external_wp_element_namespaceObject.createElement)("strong", null),
7600 - PreviewLink: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
7601 - href: previewLink
7602 - }, (0,external_wp_i18n_namespaceObject.__)('preview'))
7603 - })), !isTakeover && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)(
7604 - /* translators: %s: user's display name */
7605 - (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), {
7606 - strong: (0,external_wp_element_namespaceObject.createElement)("strong", null),
7607 - PreviewLink: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
7608 - href: previewLink
7609 - }, (0,external_wp_i18n_namespaceObject.__)('preview'))
7610 - })), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('If you take over, the other user will lose editing control to the post, but their changes will be saved.'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
7611 - className: "editor-post-locked-modal__buttons",
7612 - justify: "flex-end",
7613 - expanded: false
7614 - }, !isTakeover && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7615 - variant: "tertiary",
7616 - href: unlockUrl
7617 - }, (0,external_wp_i18n_namespaceObject.__)('Take over'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7618 - variant: "primary",
7619 - href: allPostsUrl
7620 - }, allPostsLabel)))));
7621 -}
7622 -//# sourceMappingURL=index.js.map
7623 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-pending-status/check.js
7624 -/**
7625 - * External dependencies
7626 - */
7627 -
7628 -/**
7629 - * WordPress dependencies
7630 - */
7631 -
7632 -
7633 -
7634 -/**
7635 - * Internal dependencies
7636 - */
7637 -
7638 -
7639 -function PostPendingStatusCheck(_ref) {
7640 - let {
7641 - hasPublishAction,
7642 - isPublished,
7643 - children
7644 - } = _ref;
7645 -
7646 - if (isPublished || !hasPublishAction) {
7647 - return null;
7648 - }
7649 -
7650 - return children;
7651 -}
7652 -/* harmony default export */ var post_pending_status_check = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => {
7653 - const {
7654 - isCurrentPostPublished,
7655 - getCurrentPostType,
7656 - getCurrentPost
7657 - } = select(store);
7658 - return {
7659 - hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false),
7660 - isPublished: isCurrentPostPublished(),
7661 - postType: getCurrentPostType()
7662 - };
7663 -}))(PostPendingStatusCheck));
7664 -//# sourceMappingURL=check.js.map
7665 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-pending-status/index.js
7666 -
7667 -
7668 -/**
7669 - * WordPress dependencies
7670 - */
7671 -
7672 -
7673 -
7674 -
7675 -/**
7676 - * Internal dependencies
7677 - */
7678 -
7679 -
7680 -
7681 -function PostPendingStatus(_ref) {
7682 - let {
7683 - status,
7684 - onUpdateStatus
7685 - } = _ref;
7686 -
7687 - const togglePendingStatus = () => {
7688 - const updatedStatus = status === 'pending' ? 'draft' : 'pending';
7689 - onUpdateStatus(updatedStatus);
7690 - };
7691 -
7692 - return (0,external_wp_element_namespaceObject.createElement)(post_pending_status_check, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
7693 - label: (0,external_wp_i18n_namespaceObject.__)('Pending review'),
7694 - checked: status === 'pending',
7695 - onChange: togglePendingStatus
7696 - }));
7697 -}
7698 -/* harmony default export */ var post_pending_status = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({
7699 - status: select(store).getEditedPostAttribute('status')
7700 -})), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
7701 - onUpdateStatus(status) {
7702 - dispatch(store).editPost({
7703 - status
7704 - });
7705 - }
7706 -
7707 -})))(PostPendingStatus));
7708 -//# sourceMappingURL=index.js.map
7709 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-pingbacks/index.js
7710 -
7711 -
7712 -/**
7713 - * WordPress dependencies
7714 - */
7715 -
7716 -
7717 -
7718 -
7719 -/**
7720 - * Internal dependencies
7721 - */
7722 -
7723 -
7724 -
7725 -function PostPingbacks(_ref) {
7726 - let {
7727 - pingStatus = 'open',
7728 - ...props
7729 - } = _ref;
7730 -
7731 - const onTogglePingback = () => props.editPost({
7732 - ping_status: pingStatus === 'open' ? 'closed' : 'open'
7733 - });
7734 -
7735 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
7736 - label: (0,external_wp_i18n_namespaceObject.__)('Allow pingbacks & trackbacks'),
7737 - checked: pingStatus === 'open',
7738 - onChange: onTogglePingback
7739 - });
7740 -}
7741 -
7742 -/* harmony default export */ var post_pingbacks = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
7743 - return {
7744 - pingStatus: select(store).getEditedPostAttribute('ping_status')
7745 - };
7746 -}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
7747 - editPost: dispatch(store).editPost
7748 -}))])(PostPingbacks));
7749 -//# sourceMappingURL=index.js.map
7750 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-preview-button/index.js
7751 -
7752 -
7753 -/**
7754 - * External dependencies
7755 - */
7756 -
7757 -
7758 -/**
7759 - * WordPress dependencies
7760 - */
7761 -
7762 -
7763 -
7764 -
7765 -
7766 -
7767 -
7768 -
7769 -/**
7770 - * Internal dependencies
7771 - */
7772 -
7773 -
7774 -
7775 -function writeInterstitialMessage(targetDocument) {
7776 - let markup = (0,external_wp_element_namespaceObject.renderToString)((0,external_wp_element_namespaceObject.createElement)("div", {
7777 - className: "editor-post-preview-button__interstitial-message"
7778 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, {
7779 - xmlns: "http://www.w3.org/2000/svg",
7780 - viewBox: "0 0 96 96"
7781 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
7782 - className: "outer",
7783 - d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",
7784 - fill: "none"
7785 - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, {
7786 - className: "inner",
7787 - d: "M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z",
7788 - fill: "none"
7789 - })), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Generating preview…'))));
7790 - markup += `
7791 - <style>
7792 - body {
7793 - margin: 0;
7794 - }
7795 - .editor-post-preview-button__interstitial-message {
7796 - display: flex;
7797 - flex-direction: column;
7798 - align-items: center;
7799 - justify-content: center;
7800 - height: 100vh;
7801 - width: 100vw;
7802 - }
7803 - @-webkit-keyframes paint {
7804 - 0% {
7805 - stroke-dashoffset: 0;
7806 - }
7807 - }
7808 - @-moz-keyframes paint {
7809 - 0% {
7810 - stroke-dashoffset: 0;
7811 - }
7812 - }
7813 - @-o-keyframes paint {
7814 - 0% {
7815 - stroke-dashoffset: 0;
7816 - }
7817 - }
7818 - @keyframes paint {
7819 - 0% {
7820 - stroke-dashoffset: 0;
7821 - }
7822 - }
7823 - .editor-post-preview-button__interstitial-message svg {
7824 - width: 192px;
7825 - height: 192px;
7826 - stroke: #555d66;
7827 - stroke-width: 0.75;
7828 - }
7829 - .editor-post-preview-button__interstitial-message svg .outer,
7830 - .editor-post-preview-button__interstitial-message svg .inner {
7831 - stroke-dasharray: 280;
7832 - stroke-dashoffset: 280;
7833 - -webkit-animation: paint 1.5s ease infinite alternate;
7834 - -moz-animation: paint 1.5s ease infinite alternate;
7835 - -o-animation: paint 1.5s ease infinite alternate;
7836 - animation: paint 1.5s ease infinite alternate;
7837 - }
7838 - p {
7839 - text-align: center;
7840 - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
7841 - }
7842 - </style>
7843 - `;
7844 - /**
7845 - * Filters the interstitial message shown when generating previews.
7846 - *
7847 - * @param {string} markup The preview interstitial markup.
7848 - */
7849 -
7850 - markup = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostPreview.interstitialMarkup', markup);
7851 - targetDocument.write(markup);
7852 - targetDocument.title = (0,external_wp_i18n_namespaceObject.__)('Generating preview…');
7853 - targetDocument.close();
7854 -}
7855 -
7856 -class PostPreviewButton extends external_wp_element_namespaceObject.Component {
7857 - constructor() {
7858 - super(...arguments);
7859 - this.buttonRef = (0,external_wp_element_namespaceObject.createRef)();
7860 - this.openPreviewWindow = this.openPreviewWindow.bind(this);
7861 - }
7862 -
7863 - componentDidUpdate(prevProps) {
7864 - const {
7865 - previewLink
7866 - } = this.props; // This relies on the window being responsible to unset itself when
7867 - // navigation occurs or a new preview window is opened, to avoid
7868 - // unintentional forceful redirects.
7869 -
7870 - if (previewLink && !prevProps.previewLink) {
7871 - this.setPreviewWindowLink(previewLink);
7872 - }
7873 - }
7874 - /**
7875 - * Sets the preview window's location to the given URL, if a preview window
7876 - * exists and is not closed.
7877 - *
7878 - * @param {string} url URL to assign as preview window location.
7879 - */
7880 -
7881 -
7882 - setPreviewWindowLink(url) {
7883 - const {
7884 - previewWindow
7885 - } = this;
7886 -
7887 - if (previewWindow && !previewWindow.closed) {
7888 - previewWindow.location = url;
7889 -
7890 - if (this.buttonRef.current) {
7891 - this.buttonRef.current.focus();
7892 - }
7893 - }
7894 - }
7895 -
7896 - getWindowTarget() {
7897 - const {
7898 - postId
7899 - } = this.props;
7900 - return `wp-preview-${postId}`;
7901 - }
7902 -
7903 - openPreviewWindow(event) {
7904 - // Our Preview button has its 'href' and 'target' set correctly for a11y
7905 - // purposes. Unfortunately, though, we can't rely on the default 'click'
7906 - // handler since sometimes it incorrectly opens a new tab instead of reusing
7907 - // the existing one.
7908 - // https://github.com/WordPress/gutenberg/pull/8330
7909 - event.preventDefault(); // Open up a Preview tab if needed. This is where we'll show the preview.
7910 -
7911 - if (!this.previewWindow || this.previewWindow.closed) {
7912 - this.previewWindow = window.open('', this.getWindowTarget());
7913 - } // Focus the Preview tab. This might not do anything, depending on the browser's
7914 - // and user's preferences.
7915 - // https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus
7916 -
7917 -
7918 - this.previewWindow.focus();
7919 -
7920 - if ( // If we don't need to autosave the post before previewing, then we simply
7921 - // load the Preview URL in the Preview tab.
7922 - !this.props.isAutosaveable || // Do not save or overwrite the post, if the post is already locked.
7923 - this.props.isPostLocked) {
7924 - this.setPreviewWindowLink(event.target.href);
7925 - return;
7926 - } // Request an autosave. This happens asynchronously and causes the component
7927 - // to update when finished.
7928 -
7929 -
7930 - if (this.props.isDraft) {
7931 - this.props.savePost({
7932 - isPreview: true
7933 - });
7934 - } else {
7935 - this.props.autosave({
7936 - isPreview: true
7937 - });
7938 - } // Display a 'Generating preview' message in the Preview tab while we wait for the
7939 - // autosave to finish.
7940 -
7941 -
7942 - writeInterstitialMessage(this.previewWindow.document);
7943 - }
7944 -
7945 - render() {
7946 - const {
7947 - previewLink,
7948 - currentPostLink,
7949 - isSaveable,
7950 - role
7951 - } = this.props; // Link to the `?preview=true` URL if we have it, since this lets us see
7952 - // changes that were autosaved since the post was last published. Otherwise,
7953 - // just link to the post's URL.
7954 -
7955 - const href = previewLink || currentPostLink;
7956 - const classNames = classnames_default()({
7957 - 'editor-post-preview': !this.props.className
7958 - }, this.props.className);
7959 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7960 - variant: !this.props.className ? 'tertiary' : undefined,
7961 - className: classNames,
7962 - href: href,
7963 - target: this.getWindowTarget(),
7964 - disabled: !isSaveable,
7965 - onClick: this.openPreviewWindow,
7966 - ref: this.buttonRef,
7967 - role: role
7968 - }, this.props.textContent ? this.props.textContent : (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject._x)('Preview', 'imperative verb'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
7969 - as: "span"
7970 - },
7971 - /* translators: accessibility text */
7972 - (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))));
7973 - }
7974 -
7975 -}
7976 -/* harmony default export */ var post_preview_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, _ref) => {
7977 - let {
7978 - forcePreviewLink,
7979 - forceIsAutosaveable
7980 - } = _ref;
7981 - const {
7982 - getCurrentPostId,
7983 - getCurrentPostAttribute,
7984 - getEditedPostAttribute,
7985 - isEditedPostSaveable,
7986 - isEditedPostAutosaveable,
7987 - getEditedPostPreviewLink,
7988 - isPostLocked
7989 - } = select(store);
7990 - const {
7991 - getPostType
7992 - } = select(external_wp_coreData_namespaceObject.store);
7993 - const previewLink = getEditedPostPreviewLink();
7994 - const postType = getPostType(getEditedPostAttribute('type'));
7995 - return {
7996 - postId: getCurrentPostId(),
7997 - currentPostLink: getCurrentPostAttribute('link'),
7998 - previewLink: forcePreviewLink !== undefined ? forcePreviewLink : previewLink,
7999 - isSaveable: isEditedPostSaveable(),
8000 - isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(),
8001 - isViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false),
8002 - isDraft: ['draft', 'auto-draft'].indexOf(getEditedPostAttribute('status')) !== -1,
8003 - isPostLocked: isPostLocked()
8004 - };
8005 -}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
8006 - autosave: dispatch(store).autosave,
8007 - savePost: dispatch(store).savePost
8008 -})), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => {
8009 - let {
8010 - isViewable
8011 - } = _ref2;
8012 - return isViewable;
8013 -})])(PostPreviewButton));
8014 -//# sourceMappingURL=index.js.map
8015 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-button/label.js
8016 -/**
8017 - * External dependencies
8018 - */
8019 -
8020 -/**
8021 - * WordPress dependencies
8022 - */
8023 -
8024 -
8025 -
8026 -
8027 -/**
8028 - * Internal dependencies
8029 - */
8030 -
8031 -
8032 -function PublishButtonLabel(_ref) {
8033 - let {
8034 - isPublished,
8035 - isBeingScheduled,
8036 - isSaving,
8037 - isPublishing,
8038 - hasPublishAction,
8039 - isAutosaving,
8040 - hasNonPostEntityChanges
8041 - } = _ref;
8042 -
8043 - if (isPublishing) {
8044 - /* translators: button label text should, if possible, be under 16 characters. */
8045 - return (0,external_wp_i18n_namespaceObject.__)('Publishing…');
8046 - } else if (isPublished && isSaving && !isAutosaving) {
8047 - /* translators: button label text should, if possible, be under 16 characters. */
8048 - return (0,external_wp_i18n_namespaceObject.__)('Updating…');
8049 - } else if (isBeingScheduled && isSaving && !isAutosaving) {
8050 - /* translators: button label text should, if possible, be under 16 characters. */
8051 - return (0,external_wp_i18n_namespaceObject.__)('Scheduling…');
8052 - }
8053 -
8054 - if (!hasPublishAction) {
8055 - return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Submit for Review…') : (0,external_wp_i18n_namespaceObject.__)('Submit for Review');
8056 - } else if (isPublished) {
8057 - return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Update…') : (0,external_wp_i18n_namespaceObject.__)('Update');
8058 - } else if (isBeingScheduled) {
8059 - return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Schedule…') : (0,external_wp_i18n_namespaceObject.__)('Schedule');
8060 - }
8061 -
8062 - return (0,external_wp_i18n_namespaceObject.__)('Publish');
8063 -}
8064 -/* harmony default export */ var label = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => {
8065 - let {
8066 - forceIsSaving
8067 - } = _ref2;
8068 - const {
8069 - isCurrentPostPublished,
8070 - isEditedPostBeingScheduled,
8071 - isSavingPost,
8072 - isPublishingPost,
8073 - getCurrentPost,
8074 - getCurrentPostType,
8075 - isAutosavingPost
8076 - } = select(store);
8077 - return {
8078 - isPublished: isCurrentPostPublished(),
8079 - isBeingScheduled: isEditedPostBeingScheduled(),
8080 - isSaving: forceIsSaving || isSavingPost(),
8081 - isPublishing: isPublishingPost(),
8082 - hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false),
8083 - postType: getCurrentPostType(),
8084 - isAutosaving: isAutosavingPost()
8085 - };
8086 -})])(PublishButtonLabel));
8087 -//# sourceMappingURL=label.js.map
8088 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-button/index.js
8089 -
8090 -
8091 -
8092 -/**
8093 - * External dependencies
8094 - */
8095 -
8096 -
8097 -/**
8098 - * WordPress dependencies
8099 - */
8100 -
8101 -
8102 -
8103 -
8104 -
8105 -
8106 -/**
8107 - * Internal dependencies
8108 - */
8109 -
8110 -
8111 -
8112 -class PostPublishButton extends external_wp_element_namespaceObject.Component {
8113 - constructor(props) {
8114 - super(props);
8115 - this.buttonNode = (0,external_wp_element_namespaceObject.createRef)();
8116 - this.createOnClick = this.createOnClick.bind(this);
8117 - this.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(this);
8118 - this.state = {
8119 - entitiesSavedStatesCallback: false
8120 - };
8121 - }
8122 -
8123 - componentDidMount() {
8124 - if (this.props.focusOnMount) {
8125 - this.buttonNode.current.focus();
8126 - }
8127 - }
8128 -
8129 - createOnClick(callback) {
8130 - var _this = this;
8131 -
8132 - return function () {
8133 - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
8134 - args[_key] = arguments[_key];
8135 - }
8136 -
8137 - const {
8138 - hasNonPostEntityChanges,
8139 - setEntitiesSavedStatesCallback
8140 - } = _this.props; // If a post with non-post entities is published, but the user
8141 - // elects to not save changes to the non-post entities, those
8142 - // entities will still be dirty when the Publish button is clicked.
8143 - // We also need to check that the `setEntitiesSavedStatesCallback`
8144 - // prop was passed. See https://github.com/WordPress/gutenberg/pull/37383
8145 -
8146 - if (hasNonPostEntityChanges && setEntitiesSavedStatesCallback) {
8147 - // The modal for multiple entity saving will open,
8148 - // hold the callback for saving/publishing the post
8149 - // so that we can call it if the post entity is checked.
8150 - _this.setState({
8151 - entitiesSavedStatesCallback: () => callback(...args)
8152 - }); // Open the save panel by setting its callback.
8153 - // To set a function on the useState hook, we must set it
8154 - // with another function (() => myFunction). Passing the
8155 - // function on its own will cause an error when called.
8156 -
8157 -
8158 - setEntitiesSavedStatesCallback(() => _this.closeEntitiesSavedStates);
8159 - return external_lodash_namespaceObject.noop;
8160 - }
8161 -
8162 - return callback(...args);
8163 - };
8164 - }
8165 -
8166 - closeEntitiesSavedStates(savedEntities) {
8167 - const {
8168 - postType,
8169 - postId
8170 - } = this.props;
8171 - const {
8172 - entitiesSavedStatesCallback
8173 - } = this.state;
8174 - this.setState({
8175 - entitiesSavedStatesCallback: false
8176 - }, () => {
8177 - if (savedEntities && (0,external_lodash_namespaceObject.some)(savedEntities, elt => elt.kind === 'postType' && elt.name === postType && elt.key === postId)) {
8178 - // The post entity was checked, call the held callback from `createOnClick`.
8179 - entitiesSavedStatesCallback();
8180 - }
8181 - });
8182 - }
8183 -
8184 - render() {
8185 - const {
8186 - forceIsDirty,
8187 - forceIsSaving,
8188 - hasPublishAction,
8189 - isBeingScheduled,
8190 - isOpen,
8191 - isPostSavingLocked,
8192 - isPublishable,
8193 - isPublished,
8194 - isSaveable,
8195 - isSaving,
8196 - isAutoSaving,
8197 - isToggle,
8198 - onSave,
8199 - onStatusChange,
8200 - onSubmit = external_lodash_namespaceObject.noop,
8201 - onToggle,
8202 - visibility,
8203 - hasNonPostEntityChanges,
8204 - isSavingNonPostEntityChanges
8205 - } = this.props;
8206 - const isButtonDisabled = (isSaving || forceIsSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges);
8207 - const isToggleDisabled = (isPublished || isSaving || forceIsSaving || !isSaveable || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges);
8208 - let publishStatus;
8209 -
8210 - if (!hasPublishAction) {
8211 - publishStatus = 'pending';
8212 - } else if (visibility === 'private') {
8213 - publishStatus = 'private';
8214 - } else if (isBeingScheduled) {
8215 - publishStatus = 'future';
8216 - } else {
8217 - publishStatus = 'publish';
8218 - }
8219 -
8220 - const onClickButton = () => {
8221 - if (isButtonDisabled) {
8222 - return;
8223 - }
8224 -
8225 - onSubmit();
8226 - onStatusChange(publishStatus);
8227 - onSave();
8228 - };
8229 -
8230 - const onClickToggle = () => {
8231 - if (isToggleDisabled) {
8232 - return;
8233 - }
8234 -
8235 - onToggle();
8236 - };
8237 -
8238 - const buttonProps = {
8239 - 'aria-disabled': isButtonDisabled,
8240 - className: 'editor-post-publish-button',
8241 - isBusy: !isAutoSaving && isSaving && isPublished,
8242 - variant: 'primary',
8243 - onClick: this.createOnClick(onClickButton)
8244 - };
8245 - const toggleProps = {
8246 - 'aria-disabled': isToggleDisabled,
8247 - 'aria-expanded': isOpen,
8248 - className: 'editor-post-publish-panel__toggle',
8249 - isBusy: isSaving && isPublished,
8250 - variant: 'primary',
8251 - onClick: this.createOnClick(onClickToggle)
8252 - };
8253 - const toggleChildren = isBeingScheduled ? (0,external_wp_i18n_namespaceObject.__)('Schedule…') : (0,external_wp_i18n_namespaceObject.__)('Publish');
8254 - const buttonChildren = (0,external_wp_element_namespaceObject.createElement)(label, {
8255 - forceIsSaving: forceIsSaving,
8256 - hasNonPostEntityChanges: hasNonPostEntityChanges
8257 - });
8258 - const componentProps = isToggle ? toggleProps : buttonProps;
8259 - const componentChildren = isToggle ? toggleChildren : buttonChildren;
8260 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({
8261 - ref: this.buttonNode
8262 - }, componentProps, {
8263 - className: classnames_default()(componentProps.className, 'editor-post-publish-button__button', {
8264 - 'has-changes-dot': hasNonPostEntityChanges
8265 - })
8266 - }), componentChildren));
8267 - }
8268 -
8269 -}
8270 -/* harmony default export */ var post_publish_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
8271 - const {
8272 - isSavingPost,
8273 - isAutosavingPost,
8274 - isEditedPostBeingScheduled,
8275 - getEditedPostVisibility,
8276 - isCurrentPostPublished,
8277 - isEditedPostSaveable,
8278 - isEditedPostPublishable,
8279 - isPostSavingLocked,
8280 - getCurrentPost,
8281 - getCurrentPostType,
8282 - getCurrentPostId,
8283 - hasNonPostEntityChanges,
8284 - isSavingNonPostEntityChanges
8285 - } = select(store);
8286 -
8287 - const _isAutoSaving = isAutosavingPost();
8288 -
8289 - return {
8290 - isSaving: isSavingPost() || _isAutoSaving,
8291 - isAutoSaving: _isAutoSaving,
8292 - isBeingScheduled: isEditedPostBeingScheduled(),
8293 - visibility: getEditedPostVisibility(),
8294 - isSaveable: isEditedPostSaveable(),
8295 - isPostSavingLocked: isPostSavingLocked(),
8296 - isPublishable: isEditedPostPublishable(),
8297 - isPublished: isCurrentPostPublished(),
8298 - hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false),
8299 - postType: getCurrentPostType(),
8300 - postId: getCurrentPostId(),
8301 - hasNonPostEntityChanges: hasNonPostEntityChanges(),
8302 - isSavingNonPostEntityChanges: isSavingNonPostEntityChanges()
8303 - };
8304 -}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
8305 - const {
8306 - editPost,
8307 - savePost
8308 - } = dispatch(store);
8309 - return {
8310 - onStatusChange: status => editPost({
8311 - status
8312 - }, {
8313 - undoIgnore: true
8314 - }),
8315 - onSave: savePost
8316 - };
8317 -})])(PostPublishButton));
8318 -//# sourceMappingURL=index.js.map
8319 -;// CONCATENATED MODULE: ./packages/icons/build-module/library/close-small.js
8320 -
8321 -
8322 -/**
8323 - * WordPress dependencies
8324 - */
8325 -
8326 -const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
8327 - xmlns: "http://www.w3.org/2000/svg",
8328 - viewBox: "0 0 24 24"
8329 -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
8330 - d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"
8331 -}));
8332 -/* harmony default export */ var close_small = (closeSmall);
8333 -//# sourceMappingURL=close-small.js.map
8334 -;// CONCATENATED MODULE: ./packages/icons/build-module/library/wordpress.js
8335 -
8336 -
8337 -/**
8338 - * WordPress dependencies
8339 - */
8340 -
8341 -const wordpress = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
8342 - xmlns: "http://www.w3.org/2000/svg",
8343 - viewBox: "-2 -2 24 24"
8344 -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
8345 - d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"
8346 -}));
8347 -/* harmony default export */ var library_wordpress = (wordpress);
8348 -//# sourceMappingURL=wordpress.js.map
8349 -;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
8350 -function _defineProperty(obj, key, value) {
8351 - if (key in obj) {
8352 - Object.defineProperty(obj, key, {
8353 - value: value,
8354 - enumerable: true,
8355 - configurable: true,
8356 - writable: true
8357 - });
8358 - } else {
8359 - obj[key] = value;
8360 - }
8361 -
8362 - return obj;
8363 -}
8364 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-visibility/utils.js
8365 -/**
8366 - * WordPress dependencies
8367 - */
8368 -
8369 -const visibilityOptions = [{
8370 - value: 'public',
8371 - label: (0,external_wp_i18n_namespaceObject.__)('Public'),
8372 - info: (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.')
8373 -}, {
8374 - value: 'private',
8375 - label: (0,external_wp_i18n_namespaceObject.__)('Private'),
8376 - info: (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.')
8377 -}, {
8378 - value: 'password',
8379 - label: (0,external_wp_i18n_namespaceObject.__)('Password Protected'),
8380 - info: (0,external_wp_i18n_namespaceObject.__)('Protected with a password you choose. Only those with the password can view this post.')
8381 -}];
8382 -//# sourceMappingURL=utils.js.map
8383 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-visibility/index.js
8384 -
8385 -
8386 -
8387 -/**
8388 - * WordPress dependencies
8389 - */
8390 -
8391 -
8392 -
8393 -
8394 -
8395 -/**
8396 - * Internal dependencies
8397 - */
8398 -
8399 -
8400 -
8401 -class PostVisibility extends external_wp_element_namespaceObject.Component {
8402 - constructor(props) {
8403 - super(...arguments);
8404 -
8405 - _defineProperty(this, "confirmPrivate", () => {
8406 - const {
8407 - onUpdateVisibility,
8408 - onSave
8409 - } = this.props;
8410 - onUpdateVisibility('private');
8411 - this.setState({
8412 - hasPassword: false,
8413 - showPrivateConfirmDialog: false
8414 - });
8415 - onSave();
8416 - });
8417 -
8418 - _defineProperty(this, "handleDialogCancel", () => {
8419 - this.setState({
8420 - showPrivateConfirmDialog: false
8421 - });
8422 - });
8423 -
8424 - this.setPublic = this.setPublic.bind(this);
8425 - this.setPrivate = this.setPrivate.bind(this);
8426 - this.setPasswordProtected = this.setPasswordProtected.bind(this);
8427 - this.updatePassword = this.updatePassword.bind(this);
8428 - this.state = {
8429 - hasPassword: !!props.password,
8430 - showPrivateConfirmDialog: false
8431 - };
8432 - }
8433 -
8434 - setPublic() {
8435 - const {
8436 - visibility,
8437 - onUpdateVisibility,
8438 - status
8439 - } = this.props;
8440 - onUpdateVisibility(visibility === 'private' ? 'draft' : status);
8441 - this.setState({
8442 - hasPassword: false
8443 - });
8444 - }
8445 -
8446 - setPrivate() {
8447 - this.setState({
8448 - showPrivateConfirmDialog: true
8449 - });
8450 - }
8451 -
8452 - setPasswordProtected() {
8453 - const {
8454 - visibility,
8455 - onUpdateVisibility,
8456 - status,
8457 - password
8458 - } = this.props;
8459 - onUpdateVisibility(visibility === 'private' ? 'draft' : status, password || '');
8460 - this.setState({
8461 - hasPassword: true
8462 - });
8463 - }
8464 -
8465 - updatePassword(event) {
8466 - const {
8467 - status,
8468 - onUpdateVisibility
8469 - } = this.props;
8470 - onUpdateVisibility(status, event.target.value);
8471 - }
8472 -
8473 - render() {
8474 - const {
8475 - visibility,
8476 - password,
8477 - instanceId
8478 - } = this.props;
8479 - const visibilityHandlers = {
8480 - public: {
8481 - onSelect: this.setPublic,
8482 - checked: visibility === 'public' && !this.state.hasPassword
8483 - },
8484 - private: {
8485 - onSelect: this.setPrivate,
8486 - checked: visibility === 'private'
8487 - },
8488 - password: {
8489 - onSelect: this.setPasswordProtected,
8490 - checked: this.state.hasPassword
8491 - }
8492 - };
8493 - return [(0,external_wp_element_namespaceObject.createElement)("fieldset", {
8494 - key: "visibility-selector",
8495 - className: "editor-post-visibility__dialog-fieldset"
8496 - }, (0,external_wp_element_namespaceObject.createElement)("legend", {
8497 - className: "editor-post-visibility__dialog-legend"
8498 - }, (0,external_wp_i18n_namespaceObject.__)('Post Visibility')), visibilityOptions.map(_ref => {
8499 - let {
8500 - value,
8501 - label,
8502 - info
8503 - } = _ref;
8504 - return (0,external_wp_element_namespaceObject.createElement)("div", {
8505 - key: value,
8506 - className: "editor-post-visibility__choice"
8507 - }, (0,external_wp_element_namespaceObject.createElement)("input", {
8508 - type: "radio",
8509 - name: `editor-post-visibility__setting-${instanceId}`,
8510 - value: value,
8511 - onChange: visibilityHandlers[value].onSelect,
8512 - checked: visibilityHandlers[value].checked,
8513 - id: `editor-post-${value}-${instanceId}`,
8514 - "aria-describedby": `editor-post-${value}-${instanceId}-description`,
8515 - className: "editor-post-visibility__dialog-radio"
8516 - }), (0,external_wp_element_namespaceObject.createElement)("label", {
8517 - htmlFor: `editor-post-${value}-${instanceId}`,
8518 - className: "editor-post-visibility__dialog-label"
8519 - }, label), (0,external_wp_element_namespaceObject.createElement)("p", {
8520 - id: `editor-post-${value}-${instanceId}-description`,
8521 - className: "editor-post-visibility__dialog-info"
8522 - }, info));
8523 - })), this.state.hasPassword && (0,external_wp_element_namespaceObject.createElement)("div", {
8524 - className: "editor-post-visibility__dialog-password",
8525 - key: "password-selector"
8526 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
8527 - as: "label",
8528 - htmlFor: `editor-post-visibility__dialog-password-input-${instanceId}`
8529 - }, (0,external_wp_i18n_namespaceObject.__)('Create password')), (0,external_wp_element_namespaceObject.createElement)("input", {
8530 - className: "editor-post-visibility__dialog-password-input",
8531 - id: `editor-post-visibility__dialog-password-input-${instanceId}`,
8532 - type: "text",
8533 - onChange: this.updatePassword,
8534 - value: password,
8535 - placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password')
8536 - })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
8537 - key: "private-publish-confirmation",
8538 - isOpen: this.state.showPrivateConfirmDialog,
8539 - onConfirm: this.confirmPrivate,
8540 - onCancel: this.handleDialogCancel
8541 - }, (0,external_wp_i18n_namespaceObject.__)('Would you like to privately publish this post now?'))];
8542 - }
8543 -
8544 -}
8545 -/* harmony default export */ var post_visibility = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
8546 - const {
8547 - getEditedPostAttribute,
8548 - getEditedPostVisibility
8549 - } = select(store);
8550 - return {
8551 - status: getEditedPostAttribute('status'),
8552 - visibility: getEditedPostVisibility(),
8553 - password: getEditedPostAttribute('password')
8554 - };
8555 -}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
8556 - const {
8557 - savePost,
8558 - editPost
8559 - } = dispatch(store);
8560 - return {
8561 - onSave: savePost,
8562 -
8563 - onUpdateVisibility(status) {
8564 - let password = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
8565 - editPost({
8566 - status,
8567 - password
8568 - });
8569 - }
8570 -
8571 - };
8572 -}), external_wp_compose_namespaceObject.withInstanceId])(PostVisibility));
8573 -//# sourceMappingURL=index.js.map
8574 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-visibility/label.js
8575 -/**
8576 - * External dependencies
8577 - */
8578 -
8579 -/**
8580 - * WordPress dependencies
8581 - */
8582 -
8583 -
8584 -/**
8585 - * Internal dependencies
8586 - */
8587 -
8588 -
8589 -
8590 -
8591 -function PostVisibilityLabel(_ref) {
8592 - let {
8593 - visibility
8594 - } = _ref;
8595 -
8596 - const getVisibilityLabel = () => (0,external_lodash_namespaceObject.find)(visibilityOptions, {
8597 - value: visibility
8598 - }).label;
8599 -
8600 - return getVisibilityLabel(visibility);
8601 -}
8602 -
8603 -/* harmony default export */ var post_visibility_label = ((0,external_wp_data_namespaceObject.withSelect)(select => ({
8604 - visibility: select(store).getEditedPostVisibility()
8605 -}))(PostVisibilityLabel));
8606 -//# sourceMappingURL=label.js.map
8607 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-schedule/index.js
8608 -
8609 -
8610 -/**
8611 - * WordPress dependencies
8612 - */
8613 -
8614 -
8615 -
8616 -
8617 -
8618 -/**
8619 - * Internal dependencies
8620 - */
8621 -
8622 -
8623 -
8624 -function getDayOfTheMonth() {
8625 - let date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
8626 - let firstDay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
8627 - const d = new Date(date);
8628 - return new Date(d.getFullYear(), d.getMonth() + (firstDay ? 0 : 1), firstDay ? 1 : 0).toISOString();
8629 -}
8630 -
8631 -function PostSchedule() {
8632 - const {
8633 - postDate,
8634 - postType
8635 - } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
8636 - postDate: select(store).getEditedPostAttribute('date'),
8637 - postType: select(store).getCurrentPostType()
8638 - }), []);
8639 - const {
8640 - editPost
8641 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
8642 -
8643 - const onUpdateDate = date => editPost({
8644 - date
8645 - });
8646 -
8647 - const [previewedMonth, setPreviewedMonth] = (0,external_wp_element_namespaceObject.useState)(getDayOfTheMonth(postDate)); // Pick up published and schduled site posts.
8648 -
8649 - const eventsByPostType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', postType, {
8650 - status: 'publish,future',
8651 - after: getDayOfTheMonth(previewedMonth),
8652 - before: getDayOfTheMonth(previewedMonth, false),
8653 - exclude: [select(store).getCurrentPostId()]
8654 - }), [previewedMonth, postType]);
8655 - const events = (0,external_wp_element_namespaceObject.useMemo)(() => (eventsByPostType || []).map(_ref => {
8656 - let {
8657 - title,
8658 - type,
8659 - date: eventDate
8660 - } = _ref;
8661 - return {
8662 - title: title === null || title === void 0 ? void 0 : title.rendered,
8663 - type,
8664 - date: new Date(eventDate)
8665 - };
8666 - }), [eventsByPostType]);
8667 - const ref = (0,external_wp_element_namespaceObject.useRef)();
8668 -
8669 - const settings = (0,external_wp_date_namespaceObject.__experimentalGetSettings)(); // To know if the current timezone is a 12 hour time with look for "a" in the time format
8670 - // We also make sure this a is not escaped by a "/"
8671 -
8672 -
8673 - const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a
8674 - .replace(/\\\\/g, '') // Replace "//" with empty strings
8675 - .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash
8676 - );
8677 -
8678 - function onChange(newDate) {
8679 - onUpdateDate(newDate);
8680 - const {
8681 - ownerDocument
8682 - } = ref.current;
8683 - ownerDocument.activeElement.blur();
8684 - }
8685 -
8686 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DateTimePicker, {
8687 - ref: ref,
8688 - currentDate: postDate,
8689 - onChange: onChange,
8690 - is12Hour: is12HourTime,
8691 - events: events,
8692 - onMonthPreviewed: setPreviewedMonth
8693 - });
8694 -}
8695 -//# sourceMappingURL=index.js.map
8696 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-schedule/label.js
8697 -/**
8698 - * WordPress dependencies
8699 - */
8700 -
8701 -
8702 -
8703 -/**
8704 - * Internal dependencies
8705 - */
8706 -
8707 -
8708 -function PostScheduleLabel(_ref) {
8709 - let {
8710 - date,
8711 - isFloating
8712 - } = _ref;
8713 -
8714 - const settings = (0,external_wp_date_namespaceObject.__experimentalGetSettings)();
8715 -
8716 - return date && !isFloating ? (0,external_wp_date_namespaceObject.format)(`${settings.formats.date} ${settings.formats.time}`, date) : (0,external_wp_i18n_namespaceObject.__)('Immediately');
8717 -}
8718 -/* harmony default export */ var post_schedule_label = ((0,external_wp_data_namespaceObject.withSelect)(select => {
8719 - return {
8720 - date: select(store).getEditedPostAttribute('date'),
8721 - isFloating: select(store).isEditedPostDateFloating()
8722 - };
8723 -})(PostScheduleLabel));
8724 -//# sourceMappingURL=label.js.map
8725 -;// CONCATENATED MODULE: external ["wp","apiFetch"]
8726 -var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
8727 -var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
8728 -;// CONCATENATED MODULE: external ["wp","a11y"]
8729 -var external_wp_a11y_namespaceObject = window["wp"]["a11y"];
8730 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-taxonomies/most-used-terms.js
8731 -
8732 -
8733 -/**
8734 - * External dependencies
8735 - */
8736 -
8737 -/**
8738 - * WordPress dependencies
8739 - */
8740 -
8741 -
8742 -
8743 -
8744 -/**
8745 - * Internal dependencies
8746 - */
8747 -
8748 -
8749 -const MIN_MOST_USED_TERMS = 3;
8750 -const DEFAULT_QUERY = {
8751 - per_page: 10,
8752 - orderby: 'count',
8753 - order: 'desc',
8754 - hide_empty: true,
8755 - _fields: 'id,name,count',
8756 - context: 'view'
8757 -};
8758 -function MostUsedTerms(_ref) {
8759 - let {
8760 - onSelect,
8761 - taxonomy
8762 - } = _ref;
8763 - const {
8764 - _terms,
8765 - showTerms
8766 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
8767 - const mostUsedTerms = select(external_wp_coreData_namespaceObject.store).getEntityRecords('taxonomy', taxonomy.slug, DEFAULT_QUERY);
8768 - return {
8769 - _terms: mostUsedTerms,
8770 - showTerms: (mostUsedTerms === null || mostUsedTerms === void 0 ? void 0 : mostUsedTerms.length) >= MIN_MOST_USED_TERMS
8771 - };
8772 - }, []);
8773 -
8774 - if (!showTerms) {
8775 - return null;
8776 - }
8777 -
8778 - const terms = unescapeTerms(_terms);
8779 - const label = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'most_used']);
8780 - return (0,external_wp_element_namespaceObject.createElement)("div", {
8781 - className: "editor-post-taxonomies__flat-term-most-used"
8782 - }, (0,external_wp_element_namespaceObject.createElement)("h3", {
8783 - className: "editor-post-taxonomies__flat-term-most-used-label"
8784 - }, label), (0,external_wp_element_namespaceObject.createElement)("ul", {
8785 - role: "list",
8786 - className: "editor-post-taxonomies__flat-term-most-used-list"
8787 - }, terms.map(term => (0,external_wp_element_namespaceObject.createElement)("li", {
8788 - key: term.id
8789 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
8790 - variant: "link",
8791 - onClick: () => onSelect(term)
8792 - }, term.name)))));
8793 -}
8794 -//# sourceMappingURL=most-used-terms.js.map
8795 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-taxonomies/flat-term-selector.js
8796 -
8797 -
8798 -/**
8799 - * External dependencies
8800 - */
8801 -
8802 -/**
8803 - * WordPress dependencies
8804 - */
8805 -
8806 -
8807 -
8808 -
8809 -
8810 -
8811 -
8812 -
8813 -
8814 -
8815 -/**
8816 - * Internal dependencies
8817 - */
8818 -
8819 -
8820 -
8821 -
8822 -/**
8823 - * Shared reference to an empty array for cases where it is important to avoid
8824 - * returning a new array reference on every invocation.
8825 - *
8826 - * @type {Array<any>}
8827 - */
8828 -
8829 -const flat_term_selector_EMPTY_ARRAY = [];
8830 -/**
8831 - * Module constants
8832 - */
8833 -
8834 -const MAX_TERMS_SUGGESTIONS = 20;
8835 -const flat_term_selector_DEFAULT_QUERY = {
8836 - per_page: MAX_TERMS_SUGGESTIONS,
8837 - orderby: 'count',
8838 - order: 'desc',
8839 - _fields: 'id,name',
8840 - context: 'view'
8841 -};
8842 -
8843 -const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase();
8844 -
8845 -const termNamesToIds = (names, terms) => {
8846 - return names.map(termName => (0,external_lodash_namespaceObject.find)(terms, term => isSameTermName(term.name, termName)).id);
8847 -}; // Tries to create a term or fetch it if it already exists.
8848 -
8849 -
8850 -function findOrCreateTerm(termName, restBase) {
8851 - const escapedTermName = (0,external_lodash_namespaceObject.escape)(termName);
8852 - return external_wp_apiFetch_default()({
8853 - path: `/wp/v2/${restBase}`,
8854 - method: 'POST',
8855 - data: {
8856 - name: escapedTermName
8857 - }
8858 - }).catch(error => {
8859 - const errorCode = error.code;
8860 -
8861 - if (errorCode === 'term_exists') {
8862 - // If the terms exist, fetch it instead of creating a new one.
8863 - const addRequest = external_wp_apiFetch_default()({
8864 - path: (0,external_wp_url_namespaceObject.addQueryArgs)(`/wp/v2/${restBase}`, { ...flat_term_selector_DEFAULT_QUERY,
8865 - search: escapedTermName
8866 - })
8867 - }).then(unescapeTerms);
8868 - return addRequest.then(searchResult => {
8869 - return (0,external_lodash_namespaceObject.find)(searchResult, result => isSameTermName(result.name, termName));
8870 - });
8871 - }
8872 -
8873 - return Promise.reject(error);
8874 - }).then(unescapeTerm);
8875 -}
8876 -
8877 -function FlatTermSelector(_ref) {
8878 - let {
8879 - slug
8880 - } = _ref;
8881 - const [values, setValues] = (0,external_wp_element_namespaceObject.useState)([]);
8882 - const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)('');
8883 - const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 500);
8884 - const {
8885 - terms,
8886 - termIds,
8887 - taxonomy,
8888 - hasAssignAction,
8889 - hasCreateAction,
8890 - hasResolvedTerms
8891 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
8892 - const {
8893 - getCurrentPost,
8894 - getEditedPostAttribute
8895 - } = select(store);
8896 - const {
8897 - getEntityRecords,
8898 - getTaxonomy,
8899 - hasFinishedResolution
8900 - } = select(external_wp_coreData_namespaceObject.store);
8901 - const post = getCurrentPost();
8902 -
8903 - const _taxonomy = getTaxonomy(slug);
8904 -
8905 - const _termIds = _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : flat_term_selector_EMPTY_ARRAY;
8906 -
8907 - const query = { ...flat_term_selector_DEFAULT_QUERY,
8908 - include: _termIds.join(','),
8909 - per_page: -1
8910 - };
8911 - return {
8912 - hasCreateAction: _taxonomy ? (0,external_lodash_namespaceObject.get)(post, ['_links', 'wp:action-create-' + _taxonomy.rest_base], false) : false,
8913 - hasAssignAction: _taxonomy ? (0,external_lodash_namespaceObject.get)(post, ['_links', 'wp:action-assign-' + _taxonomy.rest_base], false) : false,
8914 - taxonomy: _taxonomy,
8915 - termIds: _termIds,
8916 - terms: _termIds.length ? getEntityRecords('taxonomy', slug, query) : flat_term_selector_EMPTY_ARRAY,
8917 - hasResolvedTerms: hasFinishedResolution('getEntityRecords', ['taxonomy', slug, query])
8918 - };
8919 - }, [slug]);
8920 - const {
8921 - searchResults
8922 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
8923 - const {
8924 - getEntityRecords
8925 - } = select(external_wp_coreData_namespaceObject.store);
8926 - return {
8927 - searchResults: !!search ? getEntityRecords('taxonomy', slug, { ...flat_term_selector_DEFAULT_QUERY,
8928 - search
8929 - }) : flat_term_selector_EMPTY_ARRAY
8930 - };
8931 - }, [search]); // Update terms state only after the selectors are resolved.
8932 - // We're using this to avoid terms temporarily disappearing on slow networks
8933 - // while core data makes REST API requests.
8934 -
8935 - (0,external_wp_element_namespaceObject.useEffect)(() => {
8936 - if (hasResolvedTerms) {
8937 - const newValues = terms.map(term => unescapeString(term.name));
8938 - setValues(newValues);
8939 - }
8940 - }, [terms, hasResolvedTerms]);
8941 - const suggestions = (0,external_wp_element_namespaceObject.useMemo)(() => {
8942 - return (searchResults !== null && searchResults !== void 0 ? searchResults : []).map(term => unescapeString(term.name));
8943 - }, [searchResults]);
8944 - const {
8945 - editPost
8946 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
8947 -
8948 - if (!hasAssignAction) {
8949 - return null;
8950 - }
8951 -
8952 - function onUpdateTerms(newTermIds) {
8953 - editPost({
8954 - [taxonomy.rest_base]: newTermIds
8955 - });
8956 - }
8957 -
8958 - function onChange(termNames) {
8959 - const availableTerms = [...terms, ...(searchResults !== null && searchResults !== void 0 ? searchResults : [])];
8960 - const uniqueTerms = (0,external_lodash_namespaceObject.uniqBy)(termNames, term => term.toLowerCase());
8961 - const newTermNames = uniqueTerms.filter(termName => !(0,external_lodash_namespaceObject.find)(availableTerms, term => isSameTermName(term.name, termName))); // Optimistically update term values.
8962 - // The selector will always re-fetch terms later.
8963 -
8964 - setValues(uniqueTerms);
8965 -
8966 - if (newTermNames.length === 0) {
8967 - return onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms));
8968 - }
8969 -
8970 - if (!hasCreateAction) {
8971 - return;
8972 - }
8973 -
8974 - Promise.all(newTermNames.map(termName => findOrCreateTerm(termName, taxonomy.rest_base))).then(newTerms => {
8975 - const newAvailableTerms = availableTerms.concat(newTerms);
8976 - return onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms));
8977 - });
8978 - }
8979 -
8980 - function appendTerm(newTerm) {
8981 - if (termIds.includes(newTerm.id)) {
8982 - return;
8983 - }
8984 -
8985 - const newTermIds = [...termIds, newTerm.id];
8986 - const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
8987 - /* translators: %s: term name. */
8988 - (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term')));
8989 - (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive');
8990 - onUpdateTerms(newTermIds);
8991 - }
8992 -
8993 - const newTermLabel = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'add_new_item'], slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Add new tag') : (0,external_wp_i18n_namespaceObject.__)('Add new Term'));
8994 - const singularName = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term'));
8995 - const termAddedLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
8996 - /* translators: %s: term name. */
8997 - (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), singularName);
8998 - const termRemovedLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
8999 - /* translators: %s: term name. */
9000 - (0,external_wp_i18n_namespaceObject._x)('%s removed', 'term'), singularName);
9001 - const removeTermLabel = (0,external_wp_i18n_namespaceObject.sprintf)(
9002 - /* translators: %s: term name. */
9003 - (0,external_wp_i18n_namespaceObject._x)('Remove %s', 'term'), singularName);
9004 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FormTokenField, {
9005 - value: values,
9006 - suggestions: suggestions,
9007 - onChange: onChange,
9008 - onInputChange: debouncedSearch,
9009 - maxSuggestions: MAX_TERMS_SUGGESTIONS,
9010 - label: newTermLabel,
9011 - messages: {
9012 - added: termAddedLabel,
9013 - removed: termRemovedLabel,
9014 - remove: removeTermLabel
9015 - }
9016 - }), (0,external_wp_element_namespaceObject.createElement)(MostUsedTerms, {
9017 - taxonomy: taxonomy,
9018 - onSelect: appendTerm
9019 - }));
9020 -}
9021 -
9022 -/* harmony default export */ var flat_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(FlatTermSelector));
9023 -//# sourceMappingURL=flat-term-selector.js.map
9024 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-panel/maybe-tags-panel.js
9025 -
9026 -
9027 -/**
9028 - * External dependencies
9029 - */
9030 -
9031 -/**
9032 - * WordPress dependencies
9033 - */
9034 -
9035 -
9036 -
9037 -
9038 -
9039 -
9040 -
9041 -/**
9042 - * Internal dependencies
9043 - */
9044 -
9045 -
9046 -
9047 -
9048 -const TagsPanel = () => {
9049 - const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_wp_element_namespaceObject.createElement)("span", {
9050 - className: "editor-post-publish-panel__link",
9051 - key: "label"
9052 - }, (0,external_wp_i18n_namespaceObject.__)('Add tags'))];
9053 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
9054 - initialOpen: false,
9055 - title: panelBodyTitle
9056 - }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.')), (0,external_wp_element_namespaceObject.createElement)(flat_term_selector, {
9057 - slug: 'post_tag'
9058 - }));
9059 -};
9060 -
9061 -class MaybeTagsPanel extends external_wp_element_namespaceObject.Component {
9062 - constructor(props) {
9063 - super(props);
9064 - this.state = {
9065 - hadTagsWhenOpeningThePanel: props.hasTags
9066 - };
9067 - }
9068 - /*
9069 - * We only want to show the tag panel if the post didn't have
9070 - * any tags when the user hit the Publish button.
9071 - *
9072 - * We can't use the prop.hasTags because it'll change to true
9073 - * if the user adds a new tag within the pre-publish panel.
9074 - * This would force a re-render and a new prop.hasTags check,
9075 - * hiding this panel and keeping the user from adding
9076 - * more than one tag.
9077 - */
9078 -
9079 -
9080 - render() {
9081 - if (!this.state.hadTagsWhenOpeningThePanel) {
9082 - return (0,external_wp_element_namespaceObject.createElement)(TagsPanel, null);
9083 - }
9084 -
9085 - return null;
9086 - }
9087 -
9088 -}
9089 -
9090 -/* harmony default export */ var maybe_tags_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => {
9091 - const postType = select(store).getCurrentPostType();
9092 - const tagsTaxonomy = select(external_wp_coreData_namespaceObject.store).getTaxonomy('post_tag');
9093 - const tags = tagsTaxonomy && select(store).getEditedPostAttribute(tagsTaxonomy.rest_base);
9094 - return {
9095 - areTagsFetched: tagsTaxonomy !== undefined,
9096 - isPostTypeSupported: tagsTaxonomy && (0,external_lodash_namespaceObject.some)(tagsTaxonomy.types, type => type === postType),
9097 - hasTags: tags && tags.length
9098 - };
9099 -}), (0,external_wp_compose_namespaceObject.ifCondition)(_ref => {
9100 - let {
9101 - areTagsFetched,
9102 - isPostTypeSupported
9103 - } = _ref;
9104 - return isPostTypeSupported && areTagsFetched;
9105 -}))(MaybeTagsPanel));
9106 -//# sourceMappingURL=maybe-tags-panel.js.map
9107 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js
9108 -
9109 -
9110 -/**
9111 - * External dependencies
9112 - */
9113 -
9114 -/**
9115 - * WordPress dependencies
9116 - */
9117 -
9118 -
9119 -
9120 -
9121 -
9122 -/**
9123 - * Internal dependencies
9124 - */
9125 -
9126 -
9127 -
9128 -
9129 -const getSuggestion = (supportedFormats, suggestedPostFormat) => {
9130 - const formats = POST_FORMATS.filter(format => (0,external_lodash_namespaceObject.includes)(supportedFormats, format.id));
9131 - return (0,external_lodash_namespaceObject.find)(formats, format => format.id === suggestedPostFormat);
9132 -};
9133 -
9134 -const PostFormatSuggestion = _ref => {
9135 - let {
9136 - suggestedPostFormat,
9137 - suggestionText,
9138 - onUpdatePostFormat
9139 - } = _ref;
9140 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
9141 - variant: "link",
9142 - onClick: () => onUpdatePostFormat(suggestedPostFormat)
9143 - }, suggestionText);
9144 -};
9145 -
9146 -function PostFormatPanel() {
9147 - const {
9148 - currentPostFormat,
9149 - suggestion
9150 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
9151 - const {
9152 - getEditedPostAttribute,
9153 - getSuggestedPostFormat
9154 - } = select(store);
9155 - const supportedFormats = (0,external_lodash_namespaceObject.get)(select(external_wp_coreData_namespaceObject.store).getThemeSupports(), ['formats'], []);
9156 - return {
9157 - currentPostFormat: getEditedPostAttribute('format'),
9158 - suggestion: getSuggestion(supportedFormats, getSuggestedPostFormat())
9159 - };
9160 - }, []);
9161 - const {
9162 - editPost
9163 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
9164 -
9165 - const onUpdatePostFormat = format => editPost({
9166 - format
9167 - });
9168 -
9169 - const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_wp_element_namespaceObject.createElement)("span", {
9170 - className: "editor-post-publish-panel__link",
9171 - key: "label"
9172 - }, (0,external_wp_i18n_namespaceObject.__)('Use a post format'))];
9173 -
9174 - if (!suggestion || suggestion.id === currentPostFormat) {
9175 - return null;
9176 - }
9177 -
9178 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
9179 - initialOpen: false,
9180 - title: panelBodyTitle
9181 - }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.')), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createElement)(PostFormatSuggestion, {
9182 - onUpdatePostFormat: onUpdatePostFormat,
9183 - suggestedPostFormat: suggestion.id,
9184 - suggestionText: (0,external_wp_i18n_namespaceObject.sprintf)(
9185 - /* translators: %s: post format */
9186 - (0,external_wp_i18n_namespaceObject.__)('Apply the "%1$s" format.'), suggestion.caption)
9187 - })));
9188 -}
9189 -//# sourceMappingURL=maybe-post-format-panel.js.map
9190 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js
9191 -
9192 -
9193 -/**
9194 - * External dependencies
9195 - */
9196 -
9197 -/**
9198 - * WordPress dependencies
9199 - */
9200 -
9201 -
9202 -
9203 -
9204 -
9205 -
9206 -
9207 -
9208 -/**
9209 - * Internal dependencies
9210 - */
9211 -
9212 -
9213 -
9214 -/**
9215 - * Module Constants
9216 - */
9217 -
9218 -const hierarchical_term_selector_DEFAULT_QUERY = {
9219 - per_page: -1,
9220 - orderby: 'name',
9221 - order: 'asc',
9222 - _fields: 'id,name,parent',
9223 - context: 'view'
9224 -};
9225 -const MIN_TERMS_COUNT_FOR_FILTER = 8;
9226 -const hierarchical_term_selector_EMPTY_ARRAY = [];
9227 -/**
9228 - * Sort Terms by Selected.
9229 - *
9230 - * @param {Object[]} termsTree Array of terms in tree format.
9231 - * @param {number[]} terms Selected terms.
9232 - *
9233 - * @return {Object[]} Sorted array of terms.
9234 - */
9235 -
9236 -function sortBySelected(termsTree, terms) {
9237 - const treeHasSelection = termTree => {
9238 - if (terms.indexOf(termTree.id) !== -1) {
9239 - return true;
9240 - }
9241 -
9242 - if (undefined === termTree.children) {
9243 - return false;
9244 - }
9245 -
9246 - return termTree.children.map(treeHasSelection).filter(child => child).length > 0;
9247 - };
9248 -
9249 - const termOrChildIsSelected = (termA, termB) => {
9250 - const termASelected = treeHasSelection(termA);
9251 - const termBSelected = treeHasSelection(termB);
9252 -
9253 - if (termASelected === termBSelected) {
9254 - return 0;
9255 - }
9256 -
9257 - if (termASelected && !termBSelected) {
9258 - return -1;
9259 - }
9260 -
9261 - if (!termASelected && termBSelected) {
9262 - return 1;
9263 - }
9264 -
9265 - return 0;
9266 - };
9267 -
9268 - const newTermTree = [...termsTree];
9269 - newTermTree.sort(termOrChildIsSelected);
9270 - return newTermTree;
9271 -}
9272 -/**
9273 - * Find term by parent id or name.
9274 - *
9275 - * @param {Object[]} terms Array of Terms.
9276 - * @param {number|string} parent id.
9277 - * @param {string} name Term name.
9278 - * @return {Object} Term object.
9279 - */
9280 -
9281 -function findTerm(terms, parent, name) {
9282 - return (0,external_lodash_namespaceObject.find)(terms, term => {
9283 - return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase();
9284 - });
9285 -}
9286 -/**
9287 - * Get filter matcher function.
9288 - *
9289 - * @param {string} filterValue Filter value.
9290 - * @return {(function(Object): (Object|boolean))} Matcher function.
9291 - */
9292 -
9293 -function getFilterMatcher(filterValue) {
9294 - const matchTermsForFilter = originalTerm => {
9295 - if ('' === filterValue) {
9296 - return originalTerm;
9297 - } // Shallow clone, because we'll be filtering the term's children and
9298 - // don't want to modify the original term.
9299 -
9300 -
9301 - const term = { ...originalTerm
9302 - }; // Map and filter the children, recursive so we deal with grandchildren
9303 - // and any deeper levels.
9304 -
9305 - if (term.children.length > 0) {
9306 - term.children = term.children.map(matchTermsForFilter).filter(child => child);
9307 - } // If the term's name contains the filterValue, or it has children
9308 - // (i.e. some child matched at some point in the tree) then return it.
9309 -
9310 -
9311 - if (-1 !== term.name.toLowerCase().indexOf(filterValue.toLowerCase()) || term.children.length > 0) {
9312 - return term;
9313 - } // Otherwise, return false. After mapping, the list of terms will need
9314 - // to have false values filtered out.
9315 -
9316 -
9317 - return false;
9318 - };
9319 -
9320 - return matchTermsForFilter;
9321 -}
9322 -/**
9323 - * Hierarchical term selector.
9324 - *
9325 - * @param {Object} props Component props.
9326 - * @param {string} props.slug Taxonomy slug.
9327 - * @return {WPElement} Hierarchical term selector component.
9328 - */
9329 -
9330 -function HierarchicalTermSelector(_ref) {
9331 - let {
9332 - slug
9333 - } = _ref;
9334 - const [adding, setAdding] = (0,external_wp_element_namespaceObject.useState)(false);
9335 - const [formName, setFormName] = (0,external_wp_element_namespaceObject.useState)('');
9336 - /**
9337 - * @type {[number|'', Function]}
9338 - */
9339 -
9340 - const [formParent, setFormParent] = (0,external_wp_element_namespaceObject.useState)('');
9341 - const [showForm, setShowForm] = (0,external_wp_element_namespaceObject.useState)(false);
9342 - const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)('');
9343 - const [filteredTermsTree, setFilteredTermsTree] = (0,external_wp_element_namespaceObject.useState)([]);
9344 - const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
9345 - const {
9346 - hasCreateAction,
9347 - hasAssignAction,
9348 - terms,
9349 - loading,
9350 - availableTerms,
9351 - taxonomy
9352 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
9353 - const {
9354 - getCurrentPost,
9355 - getEditedPostAttribute
9356 - } = select(store);
9357 - const {
9358 - getTaxonomy,
9359 - getEntityRecords,
9360 - isResolving
9361 - } = select(external_wp_coreData_namespaceObject.store);
9362 -
9363 - const _taxonomy = getTaxonomy(slug);
9364 -
9365 - return {
9366 - hasCreateAction: _taxonomy ? (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-create-' + _taxonomy.rest_base], false) : false,
9367 - hasAssignAction: _taxonomy ? (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-assign-' + _taxonomy.rest_base], false) : false,
9368 - terms: _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : hierarchical_term_selector_EMPTY_ARRAY,
9369 - loading: isResolving('getEntityRecords', ['taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY]),
9370 - availableTerms: getEntityRecords('taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY) || hierarchical_term_selector_EMPTY_ARRAY,
9371 - taxonomy: _taxonomy
9372 - };
9373 - }, [slug]);
9374 - const {
9375 - editPost
9376 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
9377 - const {
9378 - saveEntityRecord
9379 - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
9380 - const availableTermsTree = (0,external_wp_element_namespaceObject.useMemo)(() => sortBySelected(buildTermsTree(availableTerms), terms), // Remove `terms` from the dependency list to avoid reordering every time
9381 - // checking or unchecking a term.
9382 - [availableTerms]);
9383 -
9384 - if (!hasAssignAction) {
9385 - return null;
9386 - }
9387 - /**
9388 - * Append new term.
9389 - *
9390 - * @param {Object} term Term object.
9391 - * @return {Promise} A promise that resolves to save term object.
9392 - */
9393 -
9394 -
9395 - const addTerm = term => {
9396 - return saveEntityRecord('taxonomy', slug, term);
9397 - };
9398 - /**
9399 - * Update terms for post.
9400 - *
9401 - * @param {number[]} termIds Term ids.
9402 - */
9403 -
9404 -
9405 - const onUpdateTerms = termIds => {
9406 - editPost({
9407 - [taxonomy.rest_base]: termIds
9408 - });
9409 - };
9410 - /**
9411 - * Handler for checking term.
9412 - *
9413 - * @param {number} termId
9414 - */
9415 -
9416 -
9417 - const onChange = termId => {
9418 - const hasTerm = terms.includes(termId);
9419 - const newTerms = hasTerm ? (0,external_lodash_namespaceObject.without)(terms, termId) : [...terms, termId];
9420 - onUpdateTerms(newTerms);
9421 - };
9422 -
9423 - const onChangeFormName = value => {
9424 - setFormName(value);
9425 - };
9426 - /**
9427 - * Handler for changing form parent.
9428 - *
9429 - * @param {number|''} parentId Parent post id.
9430 - */
9431 -
9432 -
9433 - const onChangeFormParent = parentId => {
9434 - setFormParent(parentId);
9435 - };
9436 -
9437 - const onToggleForm = () => {
9438 - setShowForm(!showForm);
9439 - };
9440 -
9441 - const onAddTerm = async event => {
9442 - event.preventDefault();
9443 -
9444 - if (formName === '' || adding) {
9445 - return;
9446 - } // check if the term we are adding already exists
9447 -
9448 -
9449 - const existingTerm = findTerm(availableTerms, formParent, formName);
9450 -
9451 - if (existingTerm) {
9452 - // if the term we are adding exists but is not selected select it
9453 - if (!(0,external_lodash_namespaceObject.some)(terms, term => term === existingTerm.id)) {
9454 - onUpdateTerms([...terms, existingTerm.id]);
9455 - }
9456 -
9457 - setFormName('');
9458 - setFormParent('');
9459 - return;
9460 - }
9461 -
9462 - setAdding(true);
9463 - const newTerm = await addTerm({
9464 - name: formName,
9465 - parent: formParent ? formParent : undefined
9466 - });
9467 - const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
9468 - /* translators: %s: taxonomy name */
9469 - (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'singular_name'], slug === 'category' ? (0,external_wp_i18n_namespaceObject.__)('Category') : (0,external_wp_i18n_namespaceObject.__)('Term')));
9470 - (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive');
9471 - setAdding(false);
9472 - setFormName('');
9473 - setFormParent('');
9474 - onUpdateTerms([...terms, newTerm.id]);
9475 - };
9476 -
9477 - const setFilter = value => {
9478 - const newFilteredTermsTree = availableTermsTree.map(getFilterMatcher(value)).filter(term => term);
9479 -
9480 - const getResultCount = termsTree => {
9481 - let count = 0;
9482 -
9483 - for (let i = 0; i < termsTree.length; i++) {
9484 - count++;
9485 -
9486 - if (undefined !== termsTree[i].children) {
9487 - count += getResultCount(termsTree[i].children);
9488 - }
9489 - }
9490 -
9491 - return count;
9492 - };
9493 -
9494 - setFilterValue(value);
9495 - setFilteredTermsTree(newFilteredTermsTree);
9496 - const resultCount = getResultCount(newFilteredTermsTree);
9497 - const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
9498 - /* translators: %d: number of results */
9499 - (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', resultCount), resultCount);
9500 - debouncedSpeak(resultsFoundMessage, 'assertive');
9501 - };
9502 -
9503 - const renderTerms = renderedTerms => {
9504 - return renderedTerms.map(term => {
9505 - return (0,external_wp_element_namespaceObject.createElement)("div", {
9506 - key: term.id,
9507 - className: "editor-post-taxonomies__hierarchical-terms-choice"
9508 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
9509 - checked: terms.indexOf(term.id) !== -1,
9510 - onChange: () => {
9511 - const termId = parseInt(term.id, 10);
9512 - onChange(termId);
9513 - },
9514 - label: (0,external_lodash_namespaceObject.unescape)(term.name)
9515 - }), !!term.children.length && (0,external_wp_element_namespaceObject.createElement)("div", {
9516 - className: "editor-post-taxonomies__hierarchical-terms-subchoices"
9517 - }, renderTerms(term.children)));
9518 - });
9519 - };
9520 -
9521 - const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', labelProperty], slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory);
9522 -
9523 - const newTermButtonLabel = labelWithFallback('add_new_item', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term'));
9524 - const newTermLabel = labelWithFallback('new_item_name', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term'));
9525 - const parentSelectLabel = labelWithFallback('parent_item', (0,external_wp_i18n_namespaceObject.__)('Parent Category'), (0,external_wp_i18n_namespaceObject.__)('Parent Term'));
9526 - const noParentOption = `— ${parentSelectLabel} —`;
9527 - const newTermSubmitLabel = newTermButtonLabel;
9528 - const filterLabel = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'search_items'], (0,external_wp_i18n_namespaceObject.__)('Search Terms'));
9529 - const groupLabel = (0,external_lodash_namespaceObject.get)(taxonomy, ['name'], (0,external_wp_i18n_namespaceObject.__)('Terms'));
9530 - const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;
9531 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, showFilter && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
9532 - className: "editor-post-taxonomies__hierarchical-terms-filter",
9533 - label: filterLabel,
9534 - value: filterValue,
9535 - onChange: setFilter
9536 - }), (0,external_wp_element_namespaceObject.createElement)("div", {
9537 - className: "editor-post-taxonomies__hierarchical-terms-list",
9538 - tabIndex: "0",
9539 - role: "group",
9540 - "aria-label": groupLabel
9541 - }, renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree)), !loading && hasCreateAction && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
9542 - onClick: onToggleForm,
9543 - className: "editor-post-taxonomies__hierarchical-terms-add",
9544 - "aria-expanded": showForm,
9545 - variant: "link"
9546 - }, newTermButtonLabel), showForm && (0,external_wp_element_namespaceObject.createElement)("form", {
9547 - onSubmit: onAddTerm
9548 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
9549 - className: "editor-post-taxonomies__hierarchical-terms-input",
9550 - label: newTermLabel,
9551 - value: formName,
9552 - onChange: onChangeFormName,
9553 - required: true
9554 - }), !!availableTerms.length && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TreeSelect, {
9555 - label: parentSelectLabel,
9556 - noOptionLabel: noParentOption,
9557 - onChange: onChangeFormParent,
9558 - selectedId: formParent,
9559 - tree: availableTermsTree
9560 - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
9561 - variant: "secondary",
9562 - type: "submit",
9563 - className: "editor-post-taxonomies__hierarchical-terms-submit"
9564 - }, newTermSubmitLabel)));
9565 -}
9566 -
9567 -/* harmony default export */ var hierarchical_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(HierarchicalTermSelector));
9568 -//# sourceMappingURL=hierarchical-term-selector.js.map
9569 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-panel/maybe-category-panel.js
9570 -
9571 -
9572 -/**
9573 - * External dependencies
9574 - */
9575 -
9576 -/**
9577 - * WordPress dependencies
9578 - */
9579 -
9580 -
9581 -
9582 -
9583 -
9584 -
9585 -/**
9586 - * Internal dependencies
9587 - */
9588 -
9589 -
9590 -
9591 -
9592 -function MaybeCategoryPanel() {
9593 - const hasNoCategory = (0,external_wp_data_namespaceObject.useSelect)(select => {
9594 - var _select$getEntityReco;
9595 -
9596 - const postType = select(store).getCurrentPostType();
9597 - const categoriesTaxonomy = select(external_wp_coreData_namespaceObject.store).getTaxonomy('category');
9598 - const defaultCategorySlug = 'uncategorized';
9599 - const defaultCategory = (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecords('taxonomy', 'category', {
9600 - slug: defaultCategorySlug
9601 - })) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco[0];
9602 - const postTypeSupportsCategories = categoriesTaxonomy && (0,external_lodash_namespaceObject.some)(categoriesTaxonomy.types, type => type === postType);
9603 - const categories = categoriesTaxonomy && select(store).getEditedPostAttribute(categoriesTaxonomy.rest_base); // This boolean should return true if everything is loaded
9604 - // ( categoriesTaxonomy, defaultCategory )
9605 - // and the post has not been assigned a category different than "uncategorized".
9606 -
9607 - return !!categoriesTaxonomy && !!defaultCategory && postTypeSupportsCategories && ((categories === null || categories === void 0 ? void 0 : categories.length) === 0 || (categories === null || categories === void 0 ? void 0 : categories.length) === 1 && defaultCategory.id === categories[0]);
9608 - }, []);
9609 - const [shouldShowPanel, setShouldShowPanel] = (0,external_wp_element_namespaceObject.useState)(false);
9610 - (0,external_wp_element_namespaceObject.useEffect)(() => {
9611 - // We use state to avoid hiding the panel if the user edits the categories
9612 - // and adds one within the panel itself (while visible).
9613 - if (hasNoCategory) {
9614 - setShouldShowPanel(true);
9615 - }
9616 - }, [hasNoCategory]);
9617 -
9618 - if (!shouldShowPanel) {
9619 - return null;
9620 - }
9621 -
9622 - const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_wp_element_namespaceObject.createElement)("span", {
9623 - className: "editor-post-publish-panel__link",
9624 - key: "label"
9625 - }, (0,external_wp_i18n_namespaceObject.__)('Assign a category'))];
9626 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
9627 - initialOpen: false,
9628 - title: panelBodyTitle
9629 - }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.')), (0,external_wp_element_namespaceObject.createElement)(hierarchical_term_selector, {
9630 - slug: "category"
9631 - }));
9632 -}
9633 -
9634 -/* harmony default export */ var maybe_category_panel = (MaybeCategoryPanel);
9635 -//# sourceMappingURL=maybe-category-panel.js.map
9636 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-panel/prepublish.js
9637 -
9638 -
9639 -/**
9640 - * External dependencies
9641 - */
9642 -
9643 -/**
9644 - * WordPress dependencies
9645 - */
9646 -
9647 -
9648 -
9649 -
9650 -
9651 -
9652 -
9653 -
9654 -/**
9655 - * Internal dependencies
9656 - */
9657 -
9658 -
9659 -
9660 -
9661 -
9662 -
9663 -
9664 -
9665 -
9666 -
9667 -function PostPublishPanelPrepublish(_ref) {
9668 - let {
9669 - children
9670 - } = _ref;
9671 - const {
9672 - isBeingScheduled,
9673 - isRequestingSiteIcon,
9674 - hasPublishAction,
9675 - siteIconUrl,
9676 - siteTitle,
9677 - siteHome
9678 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
9679 - const {
9680 - getCurrentPost,
9681 - isEditedPostBeingScheduled
9682 - } = select(store);
9683 - const {
9684 - getEntityRecord,
9685 - isResolving
9686 - } = select(external_wp_coreData_namespaceObject.store);
9687 - const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
9688 - return {
9689 - hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false),
9690 - isBeingScheduled: isEditedPostBeingScheduled(),
9691 - isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]),
9692 - siteIconUrl: siteData.site_icon_url,
9693 - siteTitle: siteData.name,
9694 - siteHome: siteData.home && (0,external_wp_url_namespaceObject.filterURLForDisplay)(siteData.home)
9695 - };
9696 - }, []);
9697 - let siteIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
9698 - className: "components-site-icon",
9699 - size: "36px",
9700 - icon: library_wordpress
9701 - });
9702 -
9703 - if (siteIconUrl) {
9704 - siteIcon = (0,external_wp_element_namespaceObject.createElement)("img", {
9705 - alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'),
9706 - className: "components-site-icon",
9707 - src: siteIconUrl
9708 - });
9709 - }
9710 -
9711 - if (isRequestingSiteIcon) {
9712 - siteIcon = null;
9713 - }
9714 -
9715 - let prePublishTitle, prePublishBodyText;
9716 -
9717 - if (!hasPublishAction) {
9718 - prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to submit for review?');
9719 - prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('When you’re ready, submit your work for review, and an Editor will be able to approve it for you.');
9720 - } else if (isBeingScheduled) {
9721 - prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to schedule?');
9722 - prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Your work will be published at the specified date and time.');
9723 - } else {
9724 - prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to publish?');
9725 - prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Double-check your settings before publishing.');
9726 - }
9727 -
9728 - return (0,external_wp_element_namespaceObject.createElement)("div", {
9729 - className: "editor-post-publish-panel__prepublish"
9730 - }, (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)("strong", null, prePublishTitle)), (0,external_wp_element_namespaceObject.createElement)("p", null, prePublishBodyText), (0,external_wp_element_namespaceObject.createElement)("div", {
9731 - className: "components-site-card"
9732 - }, siteIcon, (0,external_wp_element_namespaceObject.createElement)("div", {
9733 - className: "components-site-info"
9734 - }, (0,external_wp_element_namespaceObject.createElement)("span", {
9735 - className: "components-site-name"
9736 - }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) || (0,external_wp_i18n_namespaceObject.__)('(Untitled)')), (0,external_wp_element_namespaceObject.createElement)("span", {
9737 - className: "components-site-home"
9738 - }, siteHome))), hasPublishAction && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
9739 - initialOpen: false,
9740 - title: [(0,external_wp_i18n_namespaceObject.__)('Visibility:'), (0,external_wp_element_namespaceObject.createElement)("span", {
9741 - className: "editor-post-publish-panel__link",
9742 - key: "label"
9743 - }, (0,external_wp_element_namespaceObject.createElement)(post_visibility_label, null))]
9744 - }, (0,external_wp_element_namespaceObject.createElement)(post_visibility, null)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
9745 - initialOpen: false,
9746 - title: [(0,external_wp_i18n_namespaceObject.__)('Publish:'), (0,external_wp_element_namespaceObject.createElement)("span", {
9747 - className: "editor-post-publish-panel__link",
9748 - key: "label"
9749 - }, (0,external_wp_element_namespaceObject.createElement)(post_schedule_label, null))]
9750 - }, (0,external_wp_element_namespaceObject.createElement)(PostSchedule, null))), (0,external_wp_element_namespaceObject.createElement)(PostFormatPanel, null), (0,external_wp_element_namespaceObject.createElement)(maybe_tags_panel, null), (0,external_wp_element_namespaceObject.createElement)(maybe_category_panel, null), children);
9751 -}
9752 -
9753 -/* harmony default export */ var prepublish = (PostPublishPanelPrepublish);
9754 -//# sourceMappingURL=prepublish.js.map
9755 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-panel/postpublish.js
9756 -
9757 -
9758 -/**
9759 - * External dependencies
9760 - */
9761 -
9762 -/**
9763 - * WordPress dependencies
9764 - */
9765 -
9766 -
9767 -
9768 -
9769 -
9770 -
9771 -
9772 -
9773 -
9774 -/**
9775 - * Internal dependencies
9776 - */
9777 -
9778 -
9779 -
9780 -const POSTNAME = '%postname%';
9781 -/**
9782 - * Returns URL for a future post.
9783 - *
9784 - * @param {Object} post Post object.
9785 - *
9786 - * @return {string} PostPublish URL.
9787 - */
9788 -
9789 -const getFuturePostUrl = post => {
9790 - const {
9791 - slug
9792 - } = post;
9793 -
9794 - if (post.permalink_template.includes(POSTNAME)) {
9795 - return post.permalink_template.replace(POSTNAME, slug);
9796 - }
9797 -
9798 - return post.permalink_template;
9799 -};
9800 -
9801 -function postpublish_CopyButton(_ref) {
9802 - let {
9803 - text,
9804 - onCopy,
9805 - children
9806 - } = _ref;
9807 - const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text, onCopy);
9808 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
9809 - variant: "secondary",
9810 - ref: ref
9811 - }, children);
9812 -}
9813 -
9814 -class PostPublishPanelPostpublish extends external_wp_element_namespaceObject.Component {
9815 - constructor() {
9816 - super(...arguments);
9817 - this.state = {
9818 - showCopyConfirmation: false
9819 - };
9820 - this.onCopy = this.onCopy.bind(this);
9821 - this.onSelectInput = this.onSelectInput.bind(this);
9822 - this.postLink = (0,external_wp_element_namespaceObject.createRef)();
9823 - }
9824 -
9825 - componentDidMount() {
9826 - if (this.props.focusOnMount) {
9827 - this.postLink.current.focus();
9828 - }
9829 - }
9830 -
9831 - componentWillUnmount() {
9832 - clearTimeout(this.dismissCopyConfirmation);
9833 - }
9834 -
9835 - onCopy() {
9836 - this.setState({
9837 - showCopyConfirmation: true
9838 - });
9839 - clearTimeout(this.dismissCopyConfirmation);
9840 - this.dismissCopyConfirmation = setTimeout(() => {
9841 - this.setState({
9842 - showCopyConfirmation: false
9843 - });
9844 - }, 4000);
9845 - }
9846 -
9847 - onSelectInput(event) {
9848 - event.target.select();
9849 - }
9850 -
9851 - render() {
9852 - const {
9853 - children,
9854 - isScheduled,
9855 - post,
9856 - postType
9857 - } = this.props;
9858 - const postLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels', 'singular_name']);
9859 - const viewPostLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels', 'view_item']);
9860 - const addNewPostLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels', 'add_new_item']);
9861 - const link = post.status === 'future' ? getFuturePostUrl(post) : post.link;
9862 - const addLink = (0,external_wp_url_namespaceObject.addQueryArgs)('post-new.php', {
9863 - post_type: post.type
9864 - });
9865 - const postPublishNonLinkHeader = isScheduled ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('is now scheduled. It will go live on'), ' ', (0,external_wp_element_namespaceObject.createElement)(post_schedule_label, null), ".") : (0,external_wp_i18n_namespaceObject.__)('is now live.');
9866 - return (0,external_wp_element_namespaceObject.createElement)("div", {
9867 - className: "post-publish-panel__postpublish"
9868 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
9869 - className: "post-publish-panel__postpublish-header"
9870 - }, (0,external_wp_element_namespaceObject.createElement)("a", {
9871 - ref: this.postLink,
9872 - href: link
9873 - }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title) || (0,external_wp_i18n_namespaceObject.__)('(no title)')), ' ', postPublishNonLinkHeader), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_wp_element_namespaceObject.createElement)("p", {
9874 - className: "post-publish-panel__postpublish-subheader"
9875 - }, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('What’s next?'))), (0,external_wp_element_namespaceObject.createElement)("div", {
9876 - className: "post-publish-panel__postpublish-post-address-container"
9877 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
9878 - className: "post-publish-panel__postpublish-post-address",
9879 - readOnly: true,
9880 - label: (0,external_wp_i18n_namespaceObject.sprintf)(
9881 - /* translators: %s: post type singular name */
9882 - (0,external_wp_i18n_namespaceObject.__)('%s address'), postLabel),
9883 - value: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(link),
9884 - onFocus: this.onSelectInput
9885 - }), (0,external_wp_element_namespaceObject.createElement)("div", {
9886 - className: "post-publish-panel__postpublish-post-address__copy-button-wrap"
9887 - }, (0,external_wp_element_namespaceObject.createElement)(postpublish_CopyButton, {
9888 - text: link,
9889 - onCopy: this.onCopy
9890 - }, this.state.showCopyConfirmation ? (0,external_wp_i18n_namespaceObject.__)('Copied!') : (0,external_wp_i18n_namespaceObject.__)('Copy')))), (0,external_wp_element_namespaceObject.createElement)("div", {
9891 - className: "post-publish-panel__postpublish-buttons"
9892 - }, !isScheduled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
9893 - variant: "primary",
9894 - href: link
9895 - }, viewPostLabel), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
9896 - variant: isScheduled ? 'primary' : 'secondary',
9897 - href: addLink
9898 - }, addNewPostLabel))), children);
9899 - }
9900 -
9901 -}
9902 -
9903 -/* harmony default export */ var postpublish = ((0,external_wp_data_namespaceObject.withSelect)(select => {
9904 - const {
9905 - getEditedPostAttribute,
9906 - getCurrentPost,
9907 - isCurrentPostScheduled
9908 - } = select(store);
9909 - const {
9910 - getPostType
9911 - } = select(external_wp_coreData_namespaceObject.store);
9912 - return {
9913 - post: getCurrentPost(),
9914 - postType: getPostType(getEditedPostAttribute('type')),
9915 - isScheduled: isCurrentPostScheduled()
9916 - };
9917 -})(PostPublishPanelPostpublish));
9918 -//# sourceMappingURL=postpublish.js.map
9919 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-publish-panel/index.js
9920 -
9921 -
9922 -
9923 -/**
9924 - * External dependencies
9925 - */
9926 -
9927 -/**
9928 - * WordPress dependencies
9929 - */
9930 -
9931 -
9932 -
9933 -
9934 -
9935 -
9936 -
9937 -
9938 -/**
9939 - * Internal dependencies
9940 - */
9941 -
9942 -
9943 -
9944 -
9945 -
9946 -class PostPublishPanel extends external_wp_element_namespaceObject.Component {
9947 - constructor() {
9948 - super(...arguments);
9949 - this.onSubmit = this.onSubmit.bind(this);
9950 - }
9951 -
9952 - componentDidUpdate(prevProps) {
9953 - // Automatically collapse the publish sidebar when a post
9954 - // is published and the user makes an edit.
9955 - if (prevProps.isPublished && !this.props.isSaving && this.props.isDirty) {
9956 - this.props.onClose();
9957 - }
9958 - }
9959 -
9960 - onSubmit() {
9961 - const {
9962 - onClose,
9963 - hasPublishAction,
9964 - isPostTypeViewable
9965 - } = this.props;
9966 -
9967 - if (!hasPublishAction || !isPostTypeViewable) {
9968 - onClose();
9969 - }
9970 - }
9971 -
9972 - render() {
9973 - const {
9974 - forceIsDirty,
9975 - forceIsSaving,
9976 - isBeingScheduled,
9977 - isPublished,
9978 - isPublishSidebarEnabled,
9979 - isScheduled,
9980 - isSaving,
9981 - isSavingNonPostEntityChanges,
9982 - onClose,
9983 - onTogglePublishSidebar,
9984 - PostPublishExtension,
9985 - PrePublishExtension,
9986 - ...additionalProps
9987 - } = this.props;
9988 - const propsForPanel = (0,external_lodash_namespaceObject.omit)(additionalProps, ['hasPublishAction', 'isDirty', 'isPostTypeViewable']);
9989 - const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled;
9990 - const isPrePublish = !isPublishedOrScheduled && !isSaving;
9991 - const isPostPublish = isPublishedOrScheduled && !isSaving;
9992 - return (0,external_wp_element_namespaceObject.createElement)("div", _extends({
9993 - className: "editor-post-publish-panel"
9994 - }, propsForPanel), (0,external_wp_element_namespaceObject.createElement)("div", {
9995 - className: "editor-post-publish-panel__header"
9996 - }, isPostPublish ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
9997 - onClick: onClose,
9998 - icon: close_small,
9999 - label: (0,external_wp_i18n_namespaceObject.__)('Close panel')
10000 - }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
10001 - className: "editor-post-publish-panel__header-publish-button"
10002 - }, (0,external_wp_element_namespaceObject.createElement)(post_publish_button, {
10003 - focusOnMount: true,
10004 - onSubmit: this.onSubmit,
10005 - forceIsDirty: forceIsDirty,
10006 - forceIsSaving: forceIsSaving
10007 - })), (0,external_wp_element_namespaceObject.createElement)("div", {
10008 - className: "editor-post-publish-panel__header-cancel-button"
10009 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
10010 - disabled: isSavingNonPostEntityChanges,
10011 - onClick: onClose,
10012 - variant: "secondary"
10013 - }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))))), (0,external_wp_element_namespaceObject.createElement)("div", {
10014 - className: "editor-post-publish-panel__content"
10015 - }, isPrePublish && (0,external_wp_element_namespaceObject.createElement)(prepublish, null, PrePublishExtension && (0,external_wp_element_namespaceObject.createElement)(PrePublishExtension, null)), isPostPublish && (0,external_wp_element_namespaceObject.createElement)(postpublish, {
10016 - focusOnMount: true
10017 - }, PostPublishExtension && (0,external_wp_element_namespaceObject.createElement)(PostPublishExtension, null)), isSaving && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)), (0,external_wp_element_namespaceObject.createElement)("div", {
10018 - className: "editor-post-publish-panel__footer"
10019 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
10020 - label: (0,external_wp_i18n_namespaceObject.__)('Always show pre-publish checks.'),
10021 - checked: isPublishSidebarEnabled,
10022 - onChange: onTogglePublishSidebar
10023 - })));
10024 - }
10025 -
10026 -}
10027 -/* harmony default export */ var post_publish_panel = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
10028 - const {
10029 - getPostType
10030 - } = select(external_wp_coreData_namespaceObject.store);
10031 - const {
10032 - getCurrentPost,
10033 - getEditedPostAttribute,
10034 - isCurrentPostPublished,
10035 - isCurrentPostScheduled,
10036 - isEditedPostBeingScheduled,
10037 - isEditedPostDirty,
10038 - isSavingPost,
10039 - isSavingNonPostEntityChanges
10040 - } = select(store);
10041 - const {
10042 - isPublishSidebarEnabled
10043 - } = select(store);
10044 - const postType = getPostType(getEditedPostAttribute('type'));
10045 - return {
10046 - hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false),
10047 - isPostTypeViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false),
10048 - isBeingScheduled: isEditedPostBeingScheduled(),
10049 - isDirty: isEditedPostDirty(),
10050 - isPublished: isCurrentPostPublished(),
10051 - isPublishSidebarEnabled: isPublishSidebarEnabled(),
10052 - isSaving: isSavingPost(),
10053 - isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),
10054 - isScheduled: isCurrentPostScheduled()
10055 - };
10056 -}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref) => {
10057 - let {
10058 - isPublishSidebarEnabled
10059 - } = _ref;
10060 - const {
10061 - disablePublishSidebar,
10062 - enablePublishSidebar
10063 - } = dispatch(store);
10064 - return {
10065 - onTogglePublishSidebar: () => {
10066 - if (isPublishSidebarEnabled) {
10067 - disablePublishSidebar();
10068 - } else {
10069 - enablePublishSidebar();
10070 - }
10071 - }
10072 - };
10073 -}), external_wp_components_namespaceObject.withFocusReturn, external_wp_components_namespaceObject.withConstrainedTabbing])(PostPublishPanel));
10074 -//# sourceMappingURL=index.js.map
10075 -;// CONCATENATED MODULE: ./packages/icons/build-module/library/cloud-upload.js
10076 -
10077 -
10078 -/**
10079 - * WordPress dependencies
10080 - */
10081 -
10082 -const cloudUpload = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
10083 - xmlns: "http://www.w3.org/2000/svg",
10084 - viewBox: "0 0 24 24"
10085 -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
10086 - d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-4v-2.4L14 14l1-1-3-3-3 3 1 1 1.2-1.2v2.4H7.7c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4H9l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8 0 1-.8 1.8-1.7 1.8z"
10087 -}));
10088 -/* harmony default export */ var cloud_upload = (cloudUpload);
10089 -//# sourceMappingURL=cloud-upload.js.map
10090 -;// CONCATENATED MODULE: ./packages/icons/build-module/icon/index.js
10091 -/**
10092 - * WordPress dependencies
10093 - */
10094 -
10095 -/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
10096 -
10097 -/**
10098 - * Return an SVG icon.
10099 - *
10100 - * @param {IconProps} props icon is the SVG component to render
10101 - * size is a number specifiying the icon size in pixels
10102 - * Other props will be passed to wrapped SVG component
10103 - *
10104 - * @return {JSX.Element} Icon component
10105 - */
10106 -
10107 -function Icon(_ref) {
10108 - let {
10109 - icon,
10110 - size = 24,
10111 - ...props
10112 - } = _ref;
10113 - return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
10114 - width: size,
10115 - height: size,
10116 - ...props
10117 - });
10118 -}
10119 -
10120 -/* harmony default export */ var icon = (Icon);
10121 -//# sourceMappingURL=index.js.map
10122 -;// CONCATENATED MODULE: ./packages/icons/build-module/library/check.js
10123 -
10124 -
10125 -/**
10126 - * WordPress dependencies
10127 - */
10128 -
10129 -const check_check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
10130 - xmlns: "http://www.w3.org/2000/svg",
10131 - viewBox: "0 0 24 24"
10132 -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
10133 - d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
10134 -}));
10135 -/* harmony default export */ var library_check = (check_check);
10136 -//# sourceMappingURL=check.js.map
10137 -;// CONCATENATED MODULE: ./packages/icons/build-module/library/cloud.js
10138 -
10139 -
10140 -/**
10141 - * WordPress dependencies
10142 - */
10143 -
10144 -const cloud = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
10145 - xmlns: "http://www.w3.org/2000/svg",
10146 - viewBox: "0 0 24 24"
10147 -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
10148 - d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z"
10149 -}));
10150 -/* harmony default export */ var library_cloud = (cloud);
10151 -//# sourceMappingURL=cloud.js.map
10152 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-switch-to-draft-button/index.js
10153 -
10154 -
10155 -/**
10156 - * WordPress dependencies
10157 - */
10158 -
10159 -
10160 -
10161 -
10162 -/**
10163 - * Internal dependencies
10164 - */
10165 -
10166 -
10167 -
10168 -function PostSwitchToDraftButton(_ref) {
10169 - let {
10170 - isSaving,
10171 - isPublished,
10172 - isScheduled,
10173 - onClick
10174 - } = _ref;
10175 - const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<');
10176 -
10177 - if (!isPublished && !isScheduled) {
10178 - return null;
10179 - }
10180 -
10181 - const onSwitch = () => {
10182 - let alertMessage;
10183 -
10184 - if (isPublished) {
10185 - alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unpublish this post?');
10186 - } else if (isScheduled) {
10187 - alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unschedule this post?');
10188 - } // eslint-disable-next-line no-alert
10189 -
10190 -
10191 - if (window.confirm(alertMessage)) {
10192 - onClick();
10193 - }
10194 - };
10195 -
10196 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
10197 - className: "editor-post-switch-to-draft",
10198 - onClick: onSwitch,
10199 - disabled: isSaving,
10200 - variant: "tertiary"
10201 - }, isMobileViewport ? (0,external_wp_i18n_namespaceObject.__)('Draft') : (0,external_wp_i18n_namespaceObject.__)('Switch to draft'));
10202 -}
10203 -
10204 -/* harmony default export */ var post_switch_to_draft_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
10205 - const {
10206 - isSavingPost,
10207 - isCurrentPostPublished,
10208 - isCurrentPostScheduled
10209 - } = select(store);
10210 - return {
10211 - isSaving: isSavingPost(),
10212 - isPublished: isCurrentPostPublished(),
10213 - isScheduled: isCurrentPostScheduled()
10214 - };
10215 -}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
10216 - const {
10217 - editPost,
10218 - savePost
10219 - } = dispatch(store);
10220 - return {
10221 - onClick: () => {
10222 - editPost({
10223 - status: 'draft'
10224 - });
10225 - savePost();
10226 - }
10227 - };
10228 -})])(PostSwitchToDraftButton));
10229 -//# sourceMappingURL=index.js.map
10230 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-saved-state/index.js
10231 -
10232 -
10233 -/**
10234 - * External dependencies
10235 - */
10236 -
10237 -/**
10238 - * WordPress dependencies
10239 - */
10240 -
10241 -
10242 -
10243 -
10244 -
10245 -
10246 -
10247 -
10248 -/**
10249 - * Internal dependencies
10250 - */
10251 -
10252 -
10253 -
10254 -/**
10255 - * Component showing whether the post is saved or not and providing save
10256 - * buttons.
10257 - *
10258 - * @param {Object} props Component props.
10259 - * @param {?boolean} props.forceIsDirty Whether to force the post to be marked
10260 - * as dirty.
10261 - * @param {?boolean} props.forceIsSaving Whether to force the post to be marked
10262 - * as being saved.
10263 - * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons
10264 - * @return {import('@wordpress/element').WPComponent} The component.
10265 - */
10266 -
10267 -function PostSavedState(_ref) {
10268 - let {
10269 - forceIsDirty,
10270 - forceIsSaving,
10271 - showIconLabels = false
10272 - } = _ref;
10273 - const [forceSavedMessage, setForceSavedMessage] = (0,external_wp_element_namespaceObject.useState)(false);
10274 - const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small');
10275 - const {
10276 - isAutosaving,
10277 - isDirty,
10278 - isNew,
10279 - isPending,
10280 - isPublished,
10281 - isSaveable,
10282 - isSaving,
10283 - isScheduled,
10284 - hasPublishAction
10285 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
10286 - var _getCurrentPost$_link, _getCurrentPost, _getCurrentPost$_link2;
10287 -
10288 - const {
10289 - isEditedPostNew,
10290 - isCurrentPostPublished,
10291 - isCurrentPostScheduled,
10292 - isEditedPostDirty,
10293 - isSavingPost,
10294 - isEditedPostSaveable,
10295 - getCurrentPost,
10296 - isAutosavingPost,
10297 - getEditedPostAttribute
10298 - } = select(store);
10299 - return {
10300 - isAutosaving: isAutosavingPost(),
10301 - isDirty: forceIsDirty || isEditedPostDirty(),
10302 - isNew: isEditedPostNew(),
10303 - isPending: 'pending' === getEditedPostAttribute('status'),
10304 - isPublished: isCurrentPostPublished(),
10305 - isSaving: forceIsSaving || isSavingPost(),
10306 - isSaveable: isEditedPostSaveable(),
10307 - isScheduled: isCurrentPostScheduled(),
10308 - hasPublishAction: (_getCurrentPost$_link = (_getCurrentPost = getCurrentPost()) === null || _getCurrentPost === void 0 ? void 0 : (_getCurrentPost$_link2 = _getCurrentPost._links) === null || _getCurrentPost$_link2 === void 0 ? void 0 : _getCurrentPost$_link2['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false
10309 - };
10310 - }, [forceIsDirty, forceIsSaving]);
10311 - const {
10312 - savePost
10313 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
10314 - const wasSaving = (0,external_wp_compose_namespaceObject.usePrevious)(isSaving);
10315 - (0,external_wp_element_namespaceObject.useEffect)(() => {
10316 - let timeoutId;
10317 -
10318 - if (wasSaving && !isSaving) {
10319 - setForceSavedMessage(true);
10320 - timeoutId = setTimeout(() => {
10321 - setForceSavedMessage(false);
10322 - }, 1000);
10323 - }
10324 -
10325 - return () => clearTimeout(timeoutId);
10326 - }, [isSaving]); // Once the post has been submitted for review this button
10327 - // is not needed for the contributor role.
10328 -
10329 - if (!hasPublishAction && isPending) {
10330 - return null;
10331 - }
10332 -
10333 - if (isPublished || isScheduled) {
10334 - return (0,external_wp_element_namespaceObject.createElement)(post_switch_to_draft_button, null);
10335 - }
10336 - /* translators: button label text should, if possible, be under 16 characters. */
10337 -
10338 -
10339 - const label = isPending ? (0,external_wp_i18n_namespaceObject.__)('Save as pending') : (0,external_wp_i18n_namespaceObject.__)('Save draft');
10340 - /* translators: button label text should, if possible, be under 16 characters. */
10341 -
10342 - const shortLabel = (0,external_wp_i18n_namespaceObject.__)('Save');
10343 -
10344 - const isSaved = forceSavedMessage || !isNew && !isDirty;
10345 - const isSavedState = isSaving || isSaved;
10346 - const isDisabled = isSaving || isSaved || !isSaveable;
10347 - let text;
10348 -
10349 - if (isSaving) {
10350 - text = isAutosaving ? (0,external_wp_i18n_namespaceObject.__)('Autosaving') : (0,external_wp_i18n_namespaceObject.__)('Saving');
10351 - } else if (isSaved) {
10352 - text = (0,external_wp_i18n_namespaceObject.__)('Saved');
10353 - } else if (isLargeViewport) {
10354 - text = label;
10355 - } else if (showIconLabels) {
10356 - text = shortLabel;
10357 - } // Use common Button instance for all saved states so that focus is not
10358 - // lost.
10359 -
10360 -
10361 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
10362 - className: isSaveable || isSaving ? classnames_default()({
10363 - 'editor-post-save-draft': !isSavedState,
10364 - 'editor-post-saved-state': isSavedState,
10365 - 'is-saving': isSaving,
10366 - 'is-autosaving': isAutosaving,
10367 - 'is-saved': isSaved,
10368 - [(0,external_wp_components_namespaceObject.__unstableGetAnimateClassName)({
10369 - type: 'loading'
10370 - })]: isSaving
10371 - }) : undefined,
10372 - onClick: isDisabled ? undefined : () => savePost(),
10373 - shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('s'),
10374 - variant: isLargeViewport ? 'tertiary' : undefined,
10375 - icon: isLargeViewport ? undefined : cloud_upload,
10376 - label: label,
10377 - "aria-disabled": isDisabled
10378 - }, isSavedState && (0,external_wp_element_namespaceObject.createElement)(icon, {
10379 - icon: isSaved ? library_check : library_cloud
10380 - }), text);
10381 -}
10382 -//# sourceMappingURL=index.js.map
10383 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-schedule/check.js
10384 -/**
10385 - * External dependencies
10386 - */
10387 -
10388 -/**
10389 - * WordPress dependencies
10390 - */
10391 -
10392 -
10393 -
10394 -/**
10395 - * Internal dependencies
10396 - */
10397 -
10398 -
10399 -function PostScheduleCheck(_ref) {
10400 - let {
10401 - hasPublishAction,
10402 - children
10403 - } = _ref;
10404 -
10405 - if (!hasPublishAction) {
10406 - return null;
10407 - }
10408 -
10409 - return children;
10410 -}
10411 -/* harmony default export */ var post_schedule_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
10412 - const {
10413 - getCurrentPost,
10414 - getCurrentPostType
10415 - } = select(store);
10416 - return {
10417 - hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false),
10418 - postType: getCurrentPostType()
10419 - };
10420 -})])(PostScheduleCheck));
10421 -//# sourceMappingURL=check.js.map
10422 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-slug/check.js
10423 -
10424 -
10425 -/**
10426 - * Internal dependencies
10427 - */
10428 -
10429 -function PostSlugCheck(_ref) {
10430 - let {
10431 - children
10432 - } = _ref;
10433 - return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
10434 - supportKeys: "slug"
10435 - }, children);
10436 -}
10437 -//# sourceMappingURL=check.js.map
10438 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-slug/index.js
10439 -
10440 -
10441 -/**
10442 - * WordPress dependencies
10443 - */
10444 -
10445 -
10446 -
10447 -
10448 -
10449 -/**
10450 - * Internal dependencies
10451 - */
10452 -
10453 -
10454 -
10455 -
10456 -class PostSlug extends external_wp_element_namespaceObject.Component {
10457 - constructor(_ref) {
10458 - let {
10459 - postSlug,
10460 - postTitle,
10461 - postID
10462 - } = _ref;
10463 - super(...arguments);
10464 - this.state = {
10465 - editedSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(postSlug) || cleanForSlug(postTitle) || postID
10466 - };
10467 - this.setSlug = this.setSlug.bind(this);
10468 - }
10469 -
10470 - setSlug(event) {
10471 - const {
10472 - postSlug,
10473 - onUpdateSlug
10474 - } = this.props;
10475 - const {
10476 - value
10477 - } = event.target;
10478 - const editedSlug = cleanForSlug(value);
10479 -
10480 - if (editedSlug === postSlug) {
10481 - return;
10482 - }
10483 -
10484 - onUpdateSlug(editedSlug);
10485 - }
10486 -
10487 - render() {
10488 - const {
10489 - instanceId
10490 - } = this.props;
10491 - const {
10492 - editedSlug
10493 - } = this.state;
10494 - const inputId = 'editor-post-slug-' + instanceId;
10495 - return (0,external_wp_element_namespaceObject.createElement)(PostSlugCheck, null, (0,external_wp_element_namespaceObject.createElement)("label", {
10496 - htmlFor: inputId
10497 - }, (0,external_wp_i18n_namespaceObject.__)('Slug')), (0,external_wp_element_namespaceObject.createElement)("input", {
10498 - autoComplete: "off",
10499 - spellCheck: "false",
10500 - type: "text",
10501 - id: inputId,
10502 - value: editedSlug,
10503 - onChange: event => this.setState({
10504 - editedSlug: event.target.value
10505 - }),
10506 - onBlur: this.setSlug,
10507 - className: "editor-post-slug__input"
10508 - }));
10509 - }
10510 -
10511 -}
10512 -/* harmony default export */ var post_slug = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
10513 - const {
10514 - getCurrentPost,
10515 - getEditedPostAttribute
10516 - } = select(store);
10517 - const {
10518 - id
10519 - } = getCurrentPost();
10520 - return {
10521 - postSlug: getEditedPostAttribute('slug'),
10522 - postTitle: getEditedPostAttribute('title'),
10523 - postID: id
10524 - };
10525 -}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
10526 - const {
10527 - editPost
10528 - } = dispatch(store);
10529 - return {
10530 - onUpdateSlug(slug) {
10531 - editPost({
10532 - slug
10533 - });
10534 - }
10535 -
10536 - };
10537 -}), external_wp_compose_namespaceObject.withInstanceId])(PostSlug));
10538 -//# sourceMappingURL=index.js.map
10539 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-sticky/check.js
10540 -/**
10541 - * External dependencies
10542 - */
10543 -
10544 -/**
10545 - * WordPress dependencies
10546 - */
10547 -
10548 -
10549 -
10550 -/**
10551 - * Internal dependencies
10552 - */
10553 -
10554 -
10555 -function PostStickyCheck(_ref) {
10556 - let {
10557 - hasStickyAction,
10558 - postType,
10559 - children
10560 - } = _ref;
10561 -
10562 - if (postType !== 'post' || !hasStickyAction) {
10563 - return null;
10564 - }
10565 -
10566 - return children;
10567 -}
10568 -/* harmony default export */ var post_sticky_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
10569 - const post = select(store).getCurrentPost();
10570 - return {
10571 - hasStickyAction: (0,external_lodash_namespaceObject.get)(post, ['_links', 'wp:action-sticky'], false),
10572 - postType: select(store).getCurrentPostType()
10573 - };
10574 -})])(PostStickyCheck));
10575 -//# sourceMappingURL=check.js.map
10576 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-sticky/index.js
10577 -
10578 -
10579 -/**
10580 - * WordPress dependencies
10581 - */
10582 -
10583 -
10584 -
10585 -
10586 -/**
10587 - * Internal dependencies
10588 - */
10589 -
10590 -
10591 -
10592 -function PostSticky(_ref) {
10593 - let {
10594 - onUpdateSticky,
10595 - postSticky = false
10596 - } = _ref;
10597 - return (0,external_wp_element_namespaceObject.createElement)(post_sticky_check, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
10598 - label: (0,external_wp_i18n_namespaceObject.__)('Stick to the top of the blog'),
10599 - checked: postSticky,
10600 - onChange: () => onUpdateSticky(!postSticky)
10601 - }));
10602 -}
10603 -/* harmony default export */ var post_sticky = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
10604 - return {
10605 - postSticky: select(store).getEditedPostAttribute('sticky')
10606 - };
10607 -}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
10608 - return {
10609 - onUpdateSticky(postSticky) {
10610 - dispatch(store).editPost({
10611 - sticky: postSticky
10612 - });
10613 - }
10614 -
10615 - };
10616 -})])(PostSticky));
10617 -//# sourceMappingURL=index.js.map
10618 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-taxonomies/index.js
10619 -
10620 -
10621 -/**
10622 - * External dependencies
10623 - */
10624 -
10625 -/**
10626 - * WordPress dependencies
10627 - */
10628 -
10629 -
10630 -
10631 -
10632 -
10633 -/**
10634 - * Internal dependencies
10635 - */
10636 -
10637 -
10638 -
10639 -
10640 -function PostTaxonomies(_ref) {
10641 - let {
10642 - postType,
10643 - taxonomies,
10644 - taxonomyWrapper = external_lodash_namespaceObject.identity
10645 - } = _ref;
10646 - const availableTaxonomies = (0,external_lodash_namespaceObject.filter)(taxonomies, taxonomy => (0,external_lodash_namespaceObject.includes)(taxonomy.types, postType));
10647 - const visibleTaxonomies = (0,external_lodash_namespaceObject.filter)(availableTaxonomies, taxonomy => taxonomy.visibility.show_ui);
10648 - return visibleTaxonomies.map(taxonomy => {
10649 - const TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector;
10650 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, {
10651 - key: `taxonomy-${taxonomy.slug}`
10652 - }, taxonomyWrapper((0,external_wp_element_namespaceObject.createElement)(TaxonomyComponent, {
10653 - slug: taxonomy.slug
10654 - }), taxonomy));
10655 - });
10656 -}
10657 -/* harmony default export */ var post_taxonomies = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
10658 - return {
10659 - postType: select(store).getCurrentPostType(),
10660 - taxonomies: select(external_wp_coreData_namespaceObject.store).getTaxonomies({
10661 - per_page: -1
10662 - })
10663 - };
10664 -})])(PostTaxonomies));
10665 -//# sourceMappingURL=index.js.map
10666 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-taxonomies/check.js
10667 -/**
10668 - * External dependencies
10669 - */
10670 -
10671 -/**
10672 - * WordPress dependencies
10673 - */
10674 -
10675 -
10676 -
10677 -
10678 -/**
10679 - * Internal dependencies
10680 - */
10681 -
10682 -
10683 -function PostTaxonomiesCheck(_ref) {
10684 - let {
10685 - postType,
10686 - taxonomies,
10687 - children
10688 - } = _ref;
10689 - const hasTaxonomies = (0,external_lodash_namespaceObject.some)(taxonomies, taxonomy => (0,external_lodash_namespaceObject.includes)(taxonomy.types, postType));
10690 -
10691 - if (!hasTaxonomies) {
10692 - return null;
10693 - }
10694 -
10695 - return children;
10696 -}
10697 -/* harmony default export */ var post_taxonomies_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
10698 - return {
10699 - postType: select(store).getCurrentPostType(),
10700 - taxonomies: select(external_wp_coreData_namespaceObject.store).getTaxonomies({
10701 - per_page: -1
10702 - })
10703 - };
10704 -})])(PostTaxonomiesCheck));
10705 -//# sourceMappingURL=check.js.map
10706 -// EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js
10707 -var lib = __webpack_require__(4042);
10708 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-text-editor/index.js
10709 -
10710 -
10711 -/**
10712 - * External dependencies
10713 - */
10714 -
10715 -/**
10716 - * WordPress dependencies
10717 - */
10718 -
10719 -
10720 -
10721 -
10722 -
10723 -
10724 -
10725 -/**
10726 - * Internal dependencies
10727 - */
10728 -
10729 -
10730 -function PostTextEditor() {
10731 - const postContent = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getEditedPostContent(), []);
10732 - const {
10733 - editPost,
10734 - resetEditorBlocks
10735 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
10736 - const [value, setValue] = (0,external_wp_element_namespaceObject.useState)(postContent);
10737 - const [isDirty, setIsDirty] = (0,external_wp_element_namespaceObject.useState)(false);
10738 - const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostTextEditor);
10739 -
10740 - if (!isDirty && value !== postContent) {
10741 - setValue(postContent);
10742 - }
10743 - /**
10744 - * Handles a textarea change event to notify the onChange prop callback and
10745 - * reflect the new value in the component's own state. This marks the start
10746 - * of the user's edits, if not already changed, preventing future props
10747 - * changes to value from replacing the rendered value. This is expected to
10748 - * be followed by a reset to dirty state via `stopEditing`.
10749 - *
10750 - * @see stopEditing
10751 - *
10752 - * @param {Event} event Change event.
10753 - */
10754 -
10755 -
10756 - const onChange = event => {
10757 - const newValue = event.target.value;
10758 - editPost({
10759 - content: newValue
10760 - });
10761 - setValue(newValue);
10762 - setIsDirty(true);
10763 - };
10764 - /**
10765 - * Function called when the user has completed their edits, responsible for
10766 - * ensuring that changes, if made, are surfaced to the onPersist prop
10767 - * callback and resetting dirty state.
10768 - */
10769 -
10770 -
10771 - const stopEditing = () => {
10772 - if (isDirty) {
10773 - const blocks = (0,external_wp_blocks_namespaceObject.parse)(value);
10774 - resetEditorBlocks(blocks);
10775 - setIsDirty(false);
10776 - }
10777 - };
10778 -
10779 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
10780 - as: "label",
10781 - htmlFor: `post-content-${instanceId}`
10782 - }, (0,external_wp_i18n_namespaceObject.__)('Type text or HTML')), (0,external_wp_element_namespaceObject.createElement)(lib/* default */.Z, {
10783 - autoComplete: "off",
10784 - dir: "auto",
10785 - value: value,
10786 - onChange: onChange,
10787 - onBlur: stopEditing,
10788 - className: "editor-post-text-editor",
10789 - id: `post-content-${instanceId}`,
10790 - placeholder: (0,external_wp_i18n_namespaceObject.__)('Start writing with text or HTML')
10791 - }));
10792 -}
10793 -//# sourceMappingURL=index.js.map
10794 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-title/index.js
10795 -
10796 -
10797 -/**
10798 - * External dependencies
10799 - */
10800 -
10801 -/**
10802 - * WordPress dependencies
10803 - */
10804 -
10805 -
10806 -
10807 -
10808 -
10809 -
10810 -
10811 -
10812 -
10813 -
10814 -/**
10815 - * Internal dependencies
10816 - */
10817 -
10818 -
10819 -
10820 -/**
10821 - * Constants
10822 - */
10823 -
10824 -const REGEXP_NEWLINES = /[\r\n]+/g;
10825 -function PostTitle() {
10826 - const ref = (0,external_wp_element_namespaceObject.useRef)();
10827 - const [isSelected, setIsSelected] = (0,external_wp_element_namespaceObject.useState)(false);
10828 - const {
10829 - editPost
10830 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
10831 - const {
10832 - insertDefaultBlock,
10833 - clearSelectedBlock,
10834 - insertBlocks
10835 - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
10836 - const {
10837 - isCleanNewPost,
10838 - title,
10839 - placeholder,
10840 - isFocusMode,
10841 - hasFixedToolbar
10842 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
10843 - const {
10844 - getEditedPostAttribute,
10845 - isCleanNewPost: _isCleanNewPost
10846 - } = select(store);
10847 - const {
10848 - getSettings
10849 - } = select(external_wp_blockEditor_namespaceObject.store);
10850 - const {
10851 - titlePlaceholder,
10852 - focusMode,
10853 - hasFixedToolbar: _hasFixedToolbar
10854 - } = getSettings();
10855 - return {
10856 - isCleanNewPost: _isCleanNewPost(),
10857 - title: getEditedPostAttribute('title'),
10858 - placeholder: titlePlaceholder,
10859 - isFocusMode: focusMode,
10860 - hasFixedToolbar: _hasFixedToolbar
10861 - };
10862 - }, []);
10863 - (0,external_wp_element_namespaceObject.useEffect)(() => {
10864 - if (!ref.current) {
10865 - return;
10866 - }
10867 -
10868 - const {
10869 - ownerDocument
10870 - } = ref.current;
10871 - const {
10872 - activeElement,
10873 - body
10874 - } = ownerDocument; // Only autofocus the title when the post is entirely empty. This should
10875 - // only happen for a new post, which means we focus the title on new
10876 - // post so the author can start typing right away, without needing to
10877 - // click anything.
10878 -
10879 - if (isCleanNewPost && (!activeElement || body === activeElement)) {
10880 - ref.current.focus();
10881 - }
10882 - }, [isCleanNewPost]);
10883 -
10884 - function onEnterPress() {
10885 - insertDefaultBlock(undefined, undefined, 0);
10886 - }
10887 -
10888 - function onInsertBlockAfter(blocks) {
10889 - insertBlocks(blocks, 0);
10890 - }
10891 -
10892 - function onUpdate(newTitle) {
10893 - editPost({
10894 - title: newTitle
10895 - });
10896 - }
10897 -
10898 - const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)({});
10899 -
10900 - function onSelect() {
10901 - setIsSelected(true);
10902 - clearSelectedBlock();
10903 - }
10904 -
10905 - function onUnselect() {
10906 - setIsSelected(false);
10907 - setSelection({});
10908 - }
10909 -
10910 - function onChange(value) {
10911 - onUpdate(value.replace(REGEXP_NEWLINES, ' '));
10912 - }
10913 -
10914 - function onKeyDown(event) {
10915 - if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) {
10916 - event.preventDefault();
10917 - onEnterPress();
10918 - }
10919 - }
10920 -
10921 - function onPaste(event) {
10922 - const clipboardData = event.clipboardData;
10923 - let plainText = '';
10924 - let html = ''; // IE11 only supports `Text` as an argument for `getData` and will
10925 - // otherwise throw an invalid argument error, so we try the standard
10926 - // arguments first, then fallback to `Text` if they fail.
10927 -
10928 - try {
10929 - plainText = clipboardData.getData('text/plain');
10930 - html = clipboardData.getData('text/html');
10931 - } catch (error1) {
10932 - try {
10933 - html = clipboardData.getData('Text');
10934 - } catch (error2) {
10935 - // Some browsers like UC Browser paste plain text by default and
10936 - // don't support clipboardData at all, so allow default
10937 - // behaviour.
10938 - return;
10939 - }
10940 - } // Allows us to ask for this information when we get a report.
10941 -
10942 -
10943 - window.console.log('Received HTML:\n\n', html);
10944 - window.console.log('Received plain text:\n\n', plainText);
10945 - const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({
10946 - HTML: html,
10947 - plainText
10948 - });
10949 -
10950 - if (typeof content !== 'string' && content.length) {
10951 - event.preventDefault();
10952 - const [firstBlock] = content;
10953 -
10954 - if (!title && (firstBlock.name === 'core/heading' || firstBlock.name === 'core/paragraph')) {
10955 - onUpdate(firstBlock.attributes.content);
10956 - onInsertBlockAfter(content.slice(1));
10957 - } else {
10958 - onInsertBlockAfter(content);
10959 - }
10960 - }
10961 - } // The wp-block className is important for editor styles.
10962 - // This same block is used in both the visual and the code editor.
10963 -
10964 -
10965 - const className = classnames_default()('wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text', {
10966 - 'is-selected': isSelected,
10967 - 'is-focus-mode': isFocusMode,
10968 - 'has-fixed-toolbar': hasFixedToolbar
10969 - });
10970 -
10971 - const decodedPlaceholder = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Add title');
10972 -
10973 - const {
10974 - ref: richTextRef
10975 - } = (0,external_wp_richText_namespaceObject.__unstableUseRichText)({
10976 - value: title,
10977 - onChange,
10978 - placeholder: decodedPlaceholder,
10979 - selectionStart: selection.start,
10980 - selectionEnd: selection.end,
10981 -
10982 - onSelectionChange(newStart, newEnd) {
10983 - setSelection(sel => {
10984 - const {
10985 - start,
10986 - end
10987 - } = sel;
10988 -
10989 - if (start === newStart && end === newEnd) {
10990 - return sel;
10991 - }
10992 -
10993 - return {
10994 - start: newStart,
10995 - end: newEnd
10996 - };
10997 - });
10998 - },
10999 -
11000 - __unstableDisableFormats: true,
11001 - preserveWhiteSpace: true
11002 - });
11003 - /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
11004 -
11005 - return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, {
11006 - supportKeys: "title"
11007 - }, (0,external_wp_element_namespaceObject.createElement)("h1", {
11008 - ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([richTextRef, ref]),
11009 - contentEditable: true,
11010 - className: className,
11011 - "aria-label": decodedPlaceholder,
11012 - role: "textbox",
11013 - "aria-multiline": "true",
11014 - onFocus: onSelect,
11015 - onBlur: onUnselect,
11016 - onKeyDown: onKeyDown,
11017 - onKeyPress: onUnselect,
11018 - onPaste: onPaste
11019 - }));
11020 - /* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */
11021 -}
11022 -//# sourceMappingURL=index.js.map
11023 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-trash/index.js
11024 -
11025 -
11026 -/**
11027 - * WordPress dependencies
11028 - */
11029 -
11030 -
11031 -
11032 -
11033 -/**
11034 - * Internal dependencies
11035 - */
11036 -
11037 -
11038 -
11039 -function PostTrash(_ref) {
11040 - let {
11041 - isNew,
11042 - postId,
11043 - postType,
11044 - ...props
11045 - } = _ref;
11046 -
11047 - if (isNew || !postId) {
11048 - return null;
11049 - }
11050 -
11051 - const onClick = () => props.trashPost(postId, postType);
11052 -
11053 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
11054 - className: "editor-post-trash",
11055 - isDestructive: true,
11056 - variant: "secondary",
11057 - onClick: onClick
11058 - }, (0,external_wp_i18n_namespaceObject.__)('Move to trash'));
11059 -}
11060 -
11061 -/* harmony default export */ var post_trash = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
11062 - const {
11063 - isEditedPostNew,
11064 - getCurrentPostId,
11065 - getCurrentPostType
11066 - } = select(store);
11067 - return {
11068 - isNew: isEditedPostNew(),
11069 - postId: getCurrentPostId(),
11070 - postType: getCurrentPostType()
11071 - };
11072 -}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
11073 - trashPost: dispatch(store).trashPost
11074 -}))])(PostTrash));
11075 -//# sourceMappingURL=index.js.map
11076 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-trash/check.js
11077 -/**
11078 - * WordPress dependencies
11079 - */
11080 -
11081 -
11082 -/**
11083 - * Internal dependencies
11084 - */
11085 -
11086 -
11087 -
11088 -function PostTrashCheck(_ref) {
11089 - let {
11090 - isNew,
11091 - postId,
11092 - canUserDelete,
11093 - children
11094 - } = _ref;
11095 -
11096 - if (isNew || !postId || !canUserDelete) {
11097 - return null;
11098 - }
11099 -
11100 - return children;
11101 -}
11102 -
11103 -/* harmony default export */ var post_trash_check = ((0,external_wp_data_namespaceObject.withSelect)(select => {
11104 - const {
11105 - isEditedPostNew,
11106 - getCurrentPostId,
11107 - getCurrentPostType
11108 - } = select(store);
11109 - const {
11110 - getPostType,
11111 - canUser
11112 - } = select(external_wp_coreData_namespaceObject.store);
11113 - const postId = getCurrentPostId();
11114 - const postType = getPostType(getCurrentPostType());
11115 - const resource = (postType === null || postType === void 0 ? void 0 : postType.rest_base) || ''; // eslint-disable-line camelcase
11116 -
11117 - return {
11118 - isNew: isEditedPostNew(),
11119 - postId,
11120 - canUserDelete: postId && resource ? canUser('delete', resource, postId) : false
11121 - };
11122 -})(PostTrashCheck));
11123 -//# sourceMappingURL=check.js.map
11124 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/post-visibility/check.js
11125 -/**
11126 - * External dependencies
11127 - */
11128 -
11129 -/**
11130 - * WordPress dependencies
11131 - */
11132 -
11133 -
11134 -
11135 -/**
11136 - * Internal dependencies
11137 - */
11138 -
11139 -
11140 -function PostVisibilityCheck(_ref) {
11141 - let {
11142 - hasPublishAction,
11143 - render
11144 - } = _ref;
11145 - const canEdit = hasPublishAction;
11146 - return render({
11147 - canEdit
11148 - });
11149 -}
11150 -/* harmony default export */ var post_visibility_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
11151 - const {
11152 - getCurrentPost,
11153 - getCurrentPostType
11154 - } = select(store);
11155 - return {
11156 - hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false),
11157 - postType: getCurrentPostType()
11158 - };
11159 -})])(PostVisibilityCheck));
11160 -//# sourceMappingURL=check.js.map
11161 -;// CONCATENATED MODULE: ./packages/icons/build-module/library/info.js
11162 -
11163 -
11164 -/**
11165 - * WordPress dependencies
11166 - */
11167 -
11168 -const info = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
11169 - xmlns: "http://www.w3.org/2000/svg",
11170 - viewBox: "0 0 24 24"
11171 -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
11172 - d: "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"
11173 -}));
11174 -/* harmony default export */ var library_info = (info);
11175 -//# sourceMappingURL=info.js.map
11176 -;// CONCATENATED MODULE: external ["wp","wordcount"]
11177 -var external_wp_wordcount_namespaceObject = window["wp"]["wordcount"];
11178 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/word-count/index.js
11179 -
11180 -
11181 -/**
11182 - * WordPress dependencies
11183 - */
11184 -
11185 -
11186 -
11187 -/**
11188 - * Internal dependencies
11189 - */
11190 -
11191 -
11192 -function WordCount() {
11193 - const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getEditedPostAttribute('content'), []);
11194 - /*
11195 35 * translators: If your word count is based on single characters (e.g. East Asian characters),
11196 36 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
11197 37 * Do not translate into your own language.
11198 - */
11199 -
11200 - const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!');
11201 -
11202 - return (0,external_wp_element_namespaceObject.createElement)("span", {
11203 - className: "word-count"
11204 - }, (0,external_wp_wordcount_namespaceObject.count)(content, wordCountType));
11205 -}
11206 -//# sourceMappingURL=index.js.map
11207 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/character-count/index.js
11208 -/**
11209 - * WordPress dependencies
11210 - */
11211 -
11212 -
11213 -/**
11214 - * Internal dependencies
11215 - */
11216 -
11217 -
11218 -function CharacterCount() {
11219 - const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getEditedPostAttribute('content'), []);
11220 - return (0,external_wp_wordcount_namespaceObject.count)(content, 'characters_including_spaces');
11221 -}
11222 -//# sourceMappingURL=index.js.map
11223 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/table-of-contents/panel.js
11224 -
11225 -
11226 -/**
11227 - * WordPress dependencies
11228 - */
11229 -
11230 -
11231 -
11232 -/**
11233 - * Internal dependencies
11234 - */
11235 -
11236 -
11237 -
11238 -
11239 -
11240 -function TableOfContentsPanel(_ref) {
11241 - let {
11242 - hasOutlineItemsDisabled,
11243 - onRequestClose
11244 - } = _ref;
11245 - const {
11246 - headingCount,
11247 - paragraphCount,
11248 - numberOfBlocks
11249 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
11250 - const {
11251 - getGlobalBlockCount
11252 - } = select(external_wp_blockEditor_namespaceObject.store);
11253 - return {
11254 - headingCount: getGlobalBlockCount('core/heading'),
11255 - paragraphCount: getGlobalBlockCount('core/paragraph'),
11256 - numberOfBlocks: getGlobalBlockCount()
11257 - };
11258 - }, []);
11259 - return (
11260 - /*
11261 - * Disable reason: The `list` ARIA role is redundant but
11262 - * Safari+VoiceOver won't announce the list otherwise.
11263 - */
11264 -
11265 - /* eslint-disable jsx-a11y/no-redundant-roles */
11266 - (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
11267 - className: "table-of-contents__wrapper",
11268 - role: "note",
11269 - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document Statistics'),
11270 - tabIndex: "0"
11271 - }, (0,external_wp_element_namespaceObject.createElement)("ul", {
11272 - role: "list",
11273 - className: "table-of-contents__counts"
11274 - }, (0,external_wp_element_namespaceObject.createElement)("li", {
11275 - className: "table-of-contents__count"
11276 - }, (0,external_wp_i18n_namespaceObject.__)('Characters'), (0,external_wp_element_namespaceObject.createElement)("span", {
11277 - className: "table-of-contents__number"
11278 - }, (0,external_wp_element_namespaceObject.createElement)(CharacterCount, null))), (0,external_wp_element_namespaceObject.createElement)("li", {
11279 - className: "table-of-contents__count"
11280 - }, (0,external_wp_i18n_namespaceObject.__)('Words'), (0,external_wp_element_namespaceObject.createElement)(WordCount, null)), (0,external_wp_element_namespaceObject.createElement)("li", {
11281 - className: "table-of-contents__count"
11282 - }, (0,external_wp_i18n_namespaceObject.__)('Headings'), (0,external_wp_element_namespaceObject.createElement)("span", {
11283 - className: "table-of-contents__number"
11284 - }, headingCount)), (0,external_wp_element_namespaceObject.createElement)("li", {
11285 - className: "table-of-contents__count"
11286 - }, (0,external_wp_i18n_namespaceObject.__)('Paragraphs'), (0,external_wp_element_namespaceObject.createElement)("span", {
11287 - className: "table-of-contents__number"
11288 - }, paragraphCount)), (0,external_wp_element_namespaceObject.createElement)("li", {
11289 - className: "table-of-contents__count"
11290 - }, (0,external_wp_i18n_namespaceObject.__)('Blocks'), (0,external_wp_element_namespaceObject.createElement)("span", {
11291 - className: "table-of-contents__number"
11292 - }, numberOfBlocks)))), headingCount > 0 && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("hr", null), (0,external_wp_element_namespaceObject.createElement)("h2", {
11293 - className: "table-of-contents__title"
11294 - }, (0,external_wp_i18n_namespaceObject.__)('Document Outline')), (0,external_wp_element_namespaceObject.createElement)(document_outline, {
11295 - onSelect: onRequestClose,
11296 - hasOutlineItemsDisabled: hasOutlineItemsDisabled
11297 - })))
11298 - /* eslint-enable jsx-a11y/no-redundant-roles */
11299 -
11300 - );
11301 -}
11302 -
11303 -/* harmony default export */ var panel = (TableOfContentsPanel);
11304 -//# sourceMappingURL=panel.js.map
11305 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/table-of-contents/index.js
11306 -
11307 -
11308 -
11309 -/**
11310 - * WordPress dependencies
11311 - */
11312 -
11313 -
11314 -
11315 -
11316 -
11317 -
11318 -/**
11319 - * Internal dependencies
11320 - */
11321 -
11322 -
11323 -
11324 -function TableOfContents(_ref, ref) {
11325 - let {
11326 - hasOutlineItemsDisabled,
11327 - repositionDropdown,
11328 - ...props
11329 - } = _ref;
11330 - const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_blockEditor_namespaceObject.store).getBlockCount(), []);
11331 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
11332 - position: repositionDropdown ? 'middle right right' : 'bottom',
11333 - className: "table-of-contents",
11334 - contentClassName: "table-of-contents__popover",
11335 - renderToggle: _ref2 => {
11336 - let {
11337 - isOpen,
11338 - onToggle
11339 - } = _ref2;
11340 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, props, {
11341 - ref: ref,
11342 - onClick: hasBlocks ? onToggle : undefined,
11343 - icon: library_info,
11344 - "aria-expanded": isOpen,
11345 - "aria-haspopup": "true"
11346 - /* translators: button label text should, if possible, be under 16 characters. */
11347 - ,
11348 - label: (0,external_wp_i18n_namespaceObject.__)('Details'),
11349 - tooltipPosition: "bottom",
11350 - "aria-disabled": !hasBlocks
11351 - }));
11352 - },
11353 - renderContent: _ref3 => {
11354 - let {
11355 - onClose
11356 - } = _ref3;
11357 - return (0,external_wp_element_namespaceObject.createElement)(panel, {
11358 - onRequestClose: onClose,
11359 - hasOutlineItemsDisabled: hasOutlineItemsDisabled
11360 - });
11361 - }
11362 - });
11363 -}
11364 -
11365 -/* harmony default export */ var table_of_contents = ((0,external_wp_element_namespaceObject.forwardRef)(TableOfContents));
11366 -//# sourceMappingURL=index.js.map
11367 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/unsaved-changes-warning/index.js
11368 -/**
11369 - * WordPress dependencies
11370 - */
11371 -
11372 -
11373 -
11374 -
11375 -/**
11376 - * Warns the user if there are unsaved changes before leaving the editor.
11377 - * Compatible with Post Editor and Site Editor.
11378 - *
11379 - * @return {WPComponent} The component.
11380 - */
11381 -
11382 -function UnsavedChangesWarning() {
11383 - const isDirty = (0,external_wp_data_namespaceObject.useSelect)(select => {
11384 - return () => {
11385 - const {
11386 - __experimentalGetDirtyEntityRecords
11387 - } = select(external_wp_coreData_namespaceObject.store);
11388 -
11389 - const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
11390 -
11391 - return dirtyEntityRecords.length > 0;
11392 - };
11393 - }, []);
11394 - /**
11395 - * Warns the user if there are unsaved changes before leaving the editor.
11396 - *
11397 - * @param {Event} event `beforeunload` event.
11398 - *
11399 - * @return {?string} Warning prompt message, if unsaved changes exist.
11400 - */
11401 -
11402 - const warnIfUnsavedChanges = event => {
11403 - // We need to call the selector directly in the listener to avoid race
11404 - // conditions with `BrowserURL` where `componentDidUpdate` gets the
11405 - // new value of `isEditedPostDirty` before this component does,
11406 - // causing this component to incorrectly think a trashed post is still dirty.
11407 - if (isDirty()) {
11408 - event.returnValue = (0,external_wp_i18n_namespaceObject.__)('You have unsaved changes. If you proceed, they will be lost.');
11409 - return event.returnValue;
11410 - }
11411 - };
11412 -
11413 - (0,external_wp_element_namespaceObject.useEffect)(() => {
11414 - window.addEventListener('beforeunload', warnIfUnsavedChanges);
11415 - return () => {
11416 - window.removeEventListener('beforeunload', warnIfUnsavedChanges);
11417 - };
11418 - }, []);
11419 - return null;
11420 -}
11421 -//# sourceMappingURL=index.js.map
11422 -;// CONCATENATED MODULE: external ["wp","reusableBlocks"]
11423 -var external_wp_reusableBlocks_namespaceObject = window["wp"]["reusableBlocks"];
11424 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/provider/with-registry-provider.js
11425 -
11426 -
11427 -/**
11428 - * WordPress dependencies
11429 - */
11430 -
11431 -
11432 -
11433 -
11434 -/**
11435 - * Internal dependencies
11436 - */
11437 -
11438 -
11439 -const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => (0,external_wp_data_namespaceObject.withRegistry)(props => {
11440 - const {
11441 - useSubRegistry = true,
11442 - registry,
11443 - ...additionalProps
11444 - } = props;
11445 -
11446 - if (!useSubRegistry) {
11447 - return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, additionalProps);
11448 - }
11449 -
11450 - const [subRegistry, setSubRegistry] = (0,external_wp_element_namespaceObject.useState)(null);
11451 - (0,external_wp_element_namespaceObject.useEffect)(() => {
11452 - const newRegistry = (0,external_wp_data_namespaceObject.createRegistry)({
11453 - 'core/block-editor': external_wp_blockEditor_namespaceObject.storeConfig
11454 - }, registry);
11455 - newRegistry.registerStore('core/editor', storeConfig);
11456 - setSubRegistry(newRegistry);
11457 - }, [registry]);
11458 -
11459 - if (!subRegistry) {
11460 - return null;
11461 - }
11462 -
11463 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_data_namespaceObject.RegistryProvider, {
11464 - value: subRegistry
11465 - }, (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, additionalProps));
11466 -}), 'withRegistryProvider');
11467 -/* harmony default export */ var with_registry_provider = (withRegistryProvider);
11468 -//# sourceMappingURL=with-registry-provider.js.map
11469 -;// CONCATENATED MODULE: external ["wp","mediaUtils"]
11470 -var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
11471 -;// CONCATENATED MODULE: ./packages/editor/build-module/utils/media-upload/index.js
11472 -/**
11473 - * External dependencies
11474 - */
11475 -
11476 -/**
11477 - * WordPress dependencies
11478 - */
11479 -
11480 -
11481 -
11482 -/**
11483 - * Internal dependencies
11484 - */
11485 -
11486 -
11487 -/**
11488 - * Upload a media file when the file upload button is activated.
11489 - * Wrapper around mediaUpload() that injects the current post ID.
11490 - *
11491 - * @param {Object} $0 Parameters object passed to the function.
11492 - * @param {?Object} $0.additionalData Additional data to include in the request.
11493 - * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed.
11494 - * @param {Array} $0.filesList List of files.
11495 - * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site.
11496 - * @param {Function} $0.onError Function called when an error happens.
11497 - * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available.
11498 - */
11499 -
11500 -function mediaUpload(_ref) {
11501 - let {
11502 - additionalData = {},
11503 - allowedTypes,
11504 - filesList,
11505 - maxUploadFileSize,
11506 - onError = external_lodash_namespaceObject.noop,
11507 - onFileChange
11508 - } = _ref;
11509 - const {
11510 - getCurrentPostId,
11511 - getEditorSettings
11512 - } = (0,external_wp_data_namespaceObject.select)(store);
11513 - const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes;
11514 - maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize;
11515 - (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({
11516 - allowedTypes,
11517 - filesList,
11518 - onFileChange,
11519 - additionalData: {
11520 - post: getCurrentPostId(),
11521 - ...additionalData
11522 - },
11523 - maxUploadFileSize,
11524 - onError: _ref2 => {
11525 - let {
11526 - message
11527 - } = _ref2;
11528 - return onError(message);
11529 - },
11530 - wpAllowedMimeTypes
11531 - });
11532 -}
11533 -//# sourceMappingURL=index.js.map
11534 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/provider/use-block-editor-settings.js
11535 -/**
11536 - * External dependencies
11537 - */
11538 -
11539 -/**
11540 - * WordPress dependencies
11541 - */
11542 -
11543 -
11544 -
11545 -
11546 -
11547 -/**
11548 - * Internal dependencies
11549 - */
11550 -
11551 -
11552 -
11553 -/**
11554 - * React hook used to compute the block editor settings to use for the post editor.
11555 - *
11556 - * @param {Object} settings EditorProvider settings prop.
11557 - * @param {boolean} hasTemplate Whether template mode is enabled.
11558 - *
11559 - * @return {Object} Block Editor Settings.
11560 - */
11561 -
11562 -function useBlockEditorSettings(settings, hasTemplate) {
11563 - const {
11564 - reusableBlocks,
11565 - hasUploadPermissions,
11566 - canUseUnfilteredHTML,
11567 - userCanCreatePages,
11568 - pageOnFront
11569 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
11570 - const {
11571 - canUserUseUnfilteredHTML
11572 - } = select(store);
11573 - const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web';
11574 - const {
11575 - canUser,
11576 - getUnstableBase,
11577 - hasFinishedResolution,
11578 - getEntityRecord
11579 - } = select(external_wp_coreData_namespaceObject.store);
11580 - const siteSettings = getEntityRecord('root', 'site');
11581 - const siteData = getUnstableBase();
11582 - const hasFinishedResolvingSiteData = hasFinishedResolution('getUnstableBase');
11583 - return {
11584 - canUseUnfilteredHTML: canUserUseUnfilteredHTML(),
11585 - reusableBlocks: isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block', {
11586 - per_page: -1
11587 - }) : [],
11588 - // Reusable blocks are fetched in the native version of this hook.
11589 - hasUploadPermissions: (0,external_lodash_namespaceObject.defaultTo)(canUser('create', 'media'), true),
11590 - hasResolvedLocalSiteData: hasFinishedResolvingSiteData,
11591 - baseUrl: (siteData === null || siteData === void 0 ? void 0 : siteData.url) || '',
11592 - userCanCreatePages: canUser('create', 'pages'),
11593 - pageOnFront: siteSettings === null || siteSettings === void 0 ? void 0 : siteSettings.page_on_front
11594 - };
11595 - }, []);
11596 - const {
11597 - undo
11598 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
11599 - const {
11600 - saveEntityRecord
11601 - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
11602 - /**
11603 - * Creates a Post entity.
11604 - * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.
11605 - *
11606 - * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.
11607 - * @return {Object} the post type object that was created.
11608 - */
11609 -
11610 - const createPageEntity = options => {
11611 - if (!userCanCreatePages) {
11612 - return Promise.reject({
11613 - message: (0,external_wp_i18n_namespaceObject.__)('You do not have permission to create Pages.')
11614 - });
11615 - }
11616 -
11617 - return saveEntityRecord('postType', 'page', options);
11618 - };
11619 -
11620 - return (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...(0,external_lodash_namespaceObject.pick)(settings, ['__experimentalBlockDirectory', '__experimentalBlockPatternCategories', '__experimentalBlockPatterns', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomGradients', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'hasFixedToolbar', 'hasReducedUI', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableResolvedAssets']),
11621 - mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
11622 - __experimentalReusableBlocks: reusableBlocks,
11623 - __experimentalFetchLinkSuggestions: (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings),
11624 - __experimentalFetchRichUrlData: external_wp_coreData_namespaceObject.__experimentalFetchUrlData,
11625 - __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,
11626 - __experimentalUndo: undo,
11627 - outlineMode: hasTemplate,
11628 - __experimentalCreatePageEntity: createPageEntity,
11629 - __experimentalUserCanCreatePages: userCanCreatePages,
11630 - pageOnFront
11631 - }), [settings, hasUploadPermissions, reusableBlocks, canUseUnfilteredHTML, undo, hasTemplate, userCanCreatePages, pageOnFront]);
11632 -}
11633 -
11634 -/* harmony default export */ var use_block_editor_settings = (useBlockEditorSettings);
11635 -//# sourceMappingURL=use-block-editor-settings.js.map
11636 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/provider/index.js
11637 -
11638 -
11639 -/**
11640 - * WordPress dependencies
11641 - */
11642 -
11643 -
11644 -
11645 -
11646 -
11647 -
11648 -
11649 -/**
11650 - * Internal dependencies
11651 - */
11652 -
11653 -
11654 -
11655 -
11656 -
11657 -function EditorProvider(_ref) {
11658 - let {
11659 - __unstableTemplate,
11660 - post,
11661 - settings,
11662 - recovery,
11663 - initialEdits,
11664 - children
11665 - } = _ref;
11666 - const defaultBlockContext = (0,external_wp_element_namespaceObject.useMemo)(() => {
11667 - if (post.type === 'wp_template') {
11668 - return {};
11669 - }
11670 -
11671 - return {
11672 - postId: post.id,
11673 - postType: post.type
11674 - };
11675 - }, [post.id, post.type]);
11676 - const {
11677 - selection,
11678 - isReady
11679 - } = (0,external_wp_data_namespaceObject.useSelect)(select => {
11680 - const {
11681 - getEditorSelection,
11682 - __unstableIsEditorReady
11683 - } = select(store);
11684 - return {
11685 - isReady: __unstableIsEditorReady(),
11686 - selection: getEditorSelection()
11687 - };
11688 - }, []);
11689 - const {
11690 - id,
11691 - type
11692 - } = __unstableTemplate !== null && __unstableTemplate !== void 0 ? __unstableTemplate : post;
11693 - const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', type, {
11694 - id
11695 - });
11696 - const editorSettings = use_block_editor_settings(settings, !!__unstableTemplate);
11697 - const {
11698 - updatePostLock,
11699 - setupEditor,
11700 - updateEditorSettings,
11701 - __experimentalTearDownEditor
11702 - } = (0,external_wp_data_namespaceObject.useDispatch)(store);
11703 - const {
11704 - createWarningNotice
11705 - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); // Initialize and tear down the editor.
11706 - // Ideally this should be synced on each change and not just something you do once.
11707 -
11708 - (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
11709 - // Assume that we don't need to initialize in the case of an error recovery.
11710 - if (recovery) {
11711 - return;
11712 - }
11713 -
11714 - updatePostLock(settings.postLock);
11715 - setupEditor(post, initialEdits, settings.template);
11716 -
11717 - if (settings.autosave) {
11718 - createWarningNotice((0,external_wp_i18n_namespaceObject.__)('There is an autosave of this post that is more recent than the version below.'), {
11719 - id: 'autosave-exists',
11720 - actions: [{
11721 - label: (0,external_wp_i18n_namespaceObject.__)('View the autosave'),
11722 - url: settings.autosave.editLink
11723 - }]
11724 - });
11725 - }
11726 -
11727 - return () => {
11728 - __experimentalTearDownEditor();
11729 - };
11730 - }, []); // Synchronize the editor settings as they change
11731 -
11732 - (0,external_wp_element_namespaceObject.useEffect)(() => {
11733 - updateEditorSettings(settings);
11734 - }, [settings]);
11735 -
11736 - if (!isReady) {
11737 - return null;
11738 - }
11739 -
11740 - return (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, {
11741 - kind: "root",
11742 - type: "site"
11743 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, {
11744 - kind: "postType",
11745 - type: post.type,
11746 - id: post.id
11747 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockContextProvider, {
11748 - value: defaultBlockContext
11749 - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, {
11750 - value: blocks,
11751 - onChange: onChange,
11752 - onInput: onInput,
11753 - selection: selection,
11754 - settings: editorSettings,
11755 - useSubRegistry: false
11756 - }, children, (0,external_wp_element_namespaceObject.createElement)(external_wp_reusableBlocks_namespaceObject.ReusableBlocksMenuItems, null)))));
11757 -}
11758 -
11759 -/* harmony default export */ var provider = (with_registry_provider(EditorProvider));
11760 -//# sourceMappingURL=index.js.map
11761 -;// CONCATENATED MODULE: external ["wp","serverSideRender"]
11762 -var external_wp_serverSideRender_namespaceObject = window["wp"]["serverSideRender"];
11763 -var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_namespaceObject);
11764 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/deprecated.js
11765 -
11766 -
11767 -// Block Creation Components
11768 -
11769 -/**
11770 - * WordPress dependencies
11771 - */
11772 -
11773 -
11774 -
11775 -
11776 -
11777 -function deprecateComponent(name, Wrapped) {
11778 - let staticsToHoist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
11779 - const Component = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
11780 - external_wp_deprecated_default()('wp.editor.' + name, {
11781 - since: '5.3',
11782 - alternative: 'wp.blockEditor.' + name,
11783 - version: '6.2'
11784 - });
11785 - return (0,external_wp_element_namespaceObject.createElement)(Wrapped, _extends({
11786 - ref: ref
11787 - }, props));
11788 - });
11789 - staticsToHoist.forEach(staticName => {
11790 - Component[staticName] = deprecateComponent(name + '.' + staticName, Wrapped[staticName]);
11791 - });
11792 - return Component;
11793 -}
11794 -
11795 -function deprecateFunction(name, func) {
11796 - return function () {
11797 - external_wp_deprecated_default()('wp.editor.' + name, {
11798 - since: '5.3',
11799 - alternative: 'wp.blockEditor.' + name,
11800 - version: '6.2'
11801 - });
11802 - return func(...arguments);
11803 - };
11804 -}
11805 -
11806 -const RichText = deprecateComponent('RichText', external_wp_blockEditor_namespaceObject.RichText, ['Content']);
11807 -RichText.isEmpty = deprecateFunction('RichText.isEmpty', external_wp_blockEditor_namespaceObject.RichText.isEmpty);
11808 -
11809 -const Autocomplete = deprecateComponent('Autocomplete', external_wp_blockEditor_namespaceObject.Autocomplete);
11810 -const AlignmentToolbar = deprecateComponent('AlignmentToolbar', external_wp_blockEditor_namespaceObject.AlignmentToolbar);
11811 -const BlockAlignmentToolbar = deprecateComponent('BlockAlignmentToolbar', external_wp_blockEditor_namespaceObject.BlockAlignmentToolbar);
11812 -const BlockControls = deprecateComponent('BlockControls', external_wp_blockEditor_namespaceObject.BlockControls, ['Slot']);
11813 -const BlockEdit = deprecateComponent('BlockEdit', external_wp_blockEditor_namespaceObject.BlockEdit);
11814 -const BlockEditorKeyboardShortcuts = deprecateComponent('BlockEditorKeyboardShortcuts', external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts);
11815 -const BlockFormatControls = deprecateComponent('BlockFormatControls', external_wp_blockEditor_namespaceObject.BlockFormatControls, ['Slot']);
11816 -const BlockIcon = deprecateComponent('BlockIcon', external_wp_blockEditor_namespaceObject.BlockIcon);
11817 -const BlockInspector = deprecateComponent('BlockInspector', external_wp_blockEditor_namespaceObject.BlockInspector);
11818 -const BlockList = deprecateComponent('BlockList', external_wp_blockEditor_namespaceObject.BlockList);
11819 -const BlockMover = deprecateComponent('BlockMover', external_wp_blockEditor_namespaceObject.BlockMover);
11820 -const BlockNavigationDropdown = deprecateComponent('BlockNavigationDropdown', external_wp_blockEditor_namespaceObject.BlockNavigationDropdown);
11821 -const BlockSelectionClearer = deprecateComponent('BlockSelectionClearer', external_wp_blockEditor_namespaceObject.BlockSelectionClearer);
11822 -const BlockSettingsMenu = deprecateComponent('BlockSettingsMenu', external_wp_blockEditor_namespaceObject.BlockSettingsMenu);
11823 -const BlockTitle = deprecateComponent('BlockTitle', external_wp_blockEditor_namespaceObject.BlockTitle);
11824 -const BlockToolbar = deprecateComponent('BlockToolbar', external_wp_blockEditor_namespaceObject.BlockToolbar);
11825 -const ColorPalette = deprecateComponent('ColorPalette', external_wp_blockEditor_namespaceObject.ColorPalette);
11826 -const ContrastChecker = deprecateComponent('ContrastChecker', external_wp_blockEditor_namespaceObject.ContrastChecker);
11827 -const CopyHandler = deprecateComponent('CopyHandler', external_wp_blockEditor_namespaceObject.CopyHandler);
11828 -const DefaultBlockAppender = deprecateComponent('DefaultBlockAppender', external_wp_blockEditor_namespaceObject.DefaultBlockAppender);
11829 -const FontSizePicker = deprecateComponent('FontSizePicker', external_wp_blockEditor_namespaceObject.FontSizePicker);
11830 -const Inserter = deprecateComponent('Inserter', external_wp_blockEditor_namespaceObject.Inserter);
11831 -const InnerBlocks = deprecateComponent('InnerBlocks', external_wp_blockEditor_namespaceObject.InnerBlocks, ['ButtonBlockAppender', 'DefaultBlockAppender', 'Content']);
11832 -const InspectorAdvancedControls = deprecateComponent('InspectorAdvancedControls', external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, ['Slot']);
11833 -const InspectorControls = deprecateComponent('InspectorControls', external_wp_blockEditor_namespaceObject.InspectorControls, ['Slot']);
11834 -const PanelColorSettings = deprecateComponent('PanelColorSettings', external_wp_blockEditor_namespaceObject.PanelColorSettings);
11835 -const PlainText = deprecateComponent('PlainText', external_wp_blockEditor_namespaceObject.PlainText);
11836 -const RichTextShortcut = deprecateComponent('RichTextShortcut', external_wp_blockEditor_namespaceObject.RichTextShortcut);
11837 -const RichTextToolbarButton = deprecateComponent('RichTextToolbarButton', external_wp_blockEditor_namespaceObject.RichTextToolbarButton);
11838 -const __unstableRichTextInputEvent = deprecateComponent('__unstableRichTextInputEvent', external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent);
11839 -const MediaPlaceholder = deprecateComponent('MediaPlaceholder', external_wp_blockEditor_namespaceObject.MediaPlaceholder);
11840 -const MediaUpload = deprecateComponent('MediaUpload', external_wp_blockEditor_namespaceObject.MediaUpload);
11841 -const MediaUploadCheck = deprecateComponent('MediaUploadCheck', external_wp_blockEditor_namespaceObject.MediaUploadCheck);
11842 -const MultiSelectScrollIntoView = deprecateComponent('MultiSelectScrollIntoView', external_wp_blockEditor_namespaceObject.MultiSelectScrollIntoView);
11843 -const NavigableToolbar = deprecateComponent('NavigableToolbar', external_wp_blockEditor_namespaceObject.NavigableToolbar);
11844 -const ObserveTyping = deprecateComponent('ObserveTyping', external_wp_blockEditor_namespaceObject.ObserveTyping);
11845 -const SkipToSelectedBlock = deprecateComponent('SkipToSelectedBlock', external_wp_blockEditor_namespaceObject.SkipToSelectedBlock);
11846 -const URLInput = deprecateComponent('URLInput', external_wp_blockEditor_namespaceObject.URLInput);
11847 -const URLInputButton = deprecateComponent('URLInputButton', external_wp_blockEditor_namespaceObject.URLInputButton);
11848 -const URLPopover = deprecateComponent('URLPopover', external_wp_blockEditor_namespaceObject.URLPopover);
11849 -const Warning = deprecateComponent('Warning', external_wp_blockEditor_namespaceObject.Warning);
11850 -const WritingFlow = deprecateComponent('WritingFlow', external_wp_blockEditor_namespaceObject.WritingFlow);
11851 -const createCustomColorsHOC = deprecateFunction('createCustomColorsHOC', external_wp_blockEditor_namespaceObject.createCustomColorsHOC);
11852 -const getColorClassName = deprecateFunction('getColorClassName', external_wp_blockEditor_namespaceObject.getColorClassName);
11853 -const getColorObjectByAttributeValues = deprecateFunction('getColorObjectByAttributeValues', external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues);
11854 -const getColorObjectByColorValue = deprecateFunction('getColorObjectByColorValue', external_wp_blockEditor_namespaceObject.getColorObjectByColorValue);
11855 -const getFontSize = deprecateFunction('getFontSize', external_wp_blockEditor_namespaceObject.getFontSize);
11856 -const getFontSizeClass = deprecateFunction('getFontSizeClass', external_wp_blockEditor_namespaceObject.getFontSizeClass);
11857 -const withColorContext = deprecateFunction('withColorContext', external_wp_blockEditor_namespaceObject.withColorContext);
11858 -const withColors = deprecateFunction('withColors', external_wp_blockEditor_namespaceObject.withColors);
11859 -const withFontSizes = deprecateFunction('withFontSizes', external_wp_blockEditor_namespaceObject.withFontSizes);
11860 -//# sourceMappingURL=deprecated.js.map
11861 -;// CONCATENATED MODULE: ./packages/editor/build-module/components/index.js
11862 -// Block Creation Components
11863 - // Post Related Components
11864 -
11865 -
11866 -
11867 -
11868 -
11869 -
11870 -
11871 -
11872 -
11873 -
11874 -
11875 -
11876 -
11877 -
11878 -
11879 -
11880 -
11881 -
11882 -
11883 -
11884 -
11885 -
11886 -
11887 -
11888 -
11889 -
11890 -
11891 -
11892 -
11893 -
11894 -
11895 -
11896 -
11897 -
11898 -
11899 -
11900 -
11901 -
11902 -
11903 -
11904 -
11905 -
11906 -
11907 -
11908 -
11909 -
11910 -
11911 -
11912 -
11913 -
11914 -
11915 -
11916 -
11917 -
11918 -
11919 -
11920 -
11921 -
11922 -
11923 -
11924 -
11925 - // State Related Components
11926 -
11927 -
11928 -
11929 -//# sourceMappingURL=index.js.map
11930 -;// CONCATENATED MODULE: ./packages/editor/build-module/utils/index.js
11931 -/**
11932 - * Internal dependencies
11933 - */
11934 -
11935 -
11936 -
11937 -
11938 -//# sourceMappingURL=index.js.map
11939 -;// CONCATENATED MODULE: ./packages/editor/build-module/index.js
11940 -/**
11941 - * Internal dependencies
11942 - */
11943 -
11944 -
11945 -
11946 -
11947 -/*
11948 - * Backward compatibility
11949 - */
11950 -
11951 -
11952 -//# sourceMappingURL=index.js.map
11953 -}();
11954 -(window.wp = window.wp || {}).editor = __webpack_exports__;
11955 -/******/ })()
11956 -;
38 + */return Object(Jr.createElement)("span",{className:"word-count"},Object(ba.count)(t,n))}));var ha=function(e){var t=e.hasOutlineItemsDisabled,n=e.onRequestClose,r=Object(p.useSelect)((function(e){var t=e("core/block-editor").getGlobalBlockCount;return{headingCount:t("core/heading"),paragraphCount:t("core/paragraph"),numberOfBlocks:t()}}),[]),o=r.headingCount,i=r.paragraphCount,c=r.numberOfBlocks;return Object(Jr.createElement)(Jr.Fragment,null,Object(Jr.createElement)("div",{className:"table-of-contents__wrapper",role:"note","aria-label":Object(I.__)("Document Statistics"),tabIndex:"0"},Object(Jr.createElement)("ul",{role:"list",className:"table-of-contents__counts"},Object(Jr.createElement)("li",{className:"table-of-contents__count"},Object(I.__)("Words"),Object(Jr.createElement)(fa,null)),Object(Jr.createElement)("li",{className:"table-of-contents__count"},Object(I.__)("Headings"),Object(Jr.createElement)("span",{className:"table-of-contents__number"},o)),Object(Jr.createElement)("li",{className:"table-of-contents__count"},Object(I.__)("Paragraphs"),Object(Jr.createElement)("span",{className:"table-of-contents__number"},i)),Object(Jr.createElement)("li",{className:"table-of-contents__count"},Object(I.__)("Blocks"),Object(Jr.createElement)("span",{className:"table-of-contents__number"},c)))),o>0&&Object(Jr.createElement)(Jr.Fragment,null,Object(Jr.createElement)("hr",null),Object(Jr.createElement)("h2",{className:"table-of-contents__title"},Object(I.__)("Document Outline")),Object(Jr.createElement)(Eo,{onSelect:n,hasOutlineItemsDisabled:t})))};var ma=Object(Jr.forwardRef)((function(e,t){var n=e.hasOutlineItemsDisabled,r=Object(Xr.a)(e,["hasOutlineItemsDisabled"]),o=Object(p.useSelect)((function(e){return!!e("core/block-editor").getBlockCount()}),[]);return Object(Jr.createElement)(Ro.Dropdown,{position:"bottom",className:"table-of-contents",contentClassName:"table-of-contents__popover",renderToggle:function(e){var n=e.isOpen,i=e.onToggle;return Object(Jr.createElement)(Ro.Button,Object(Yr.a)({},r,{ref:t,onClick:o?i:void 0,icon:pa,"aria-expanded":n,label:Object(I.__)("Content structure"),tooltipPosition:"bottom","aria-disabled":!o}))},renderContent:function(e){var t=e.onClose;return Object(Jr.createElement)(ha,{onRequestClose:t,hasOutlineItemsDisabled:n})}})}));function va(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var Oa=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(va()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(){var e;return Object(io.a)(this,r),(e=n.apply(this,arguments)).warnIfUnsavedChanges=e.warnIfUnsavedChanges.bind(Object(Jo.a)(e)),e}return Object(co.a)(r,[{key:"componentDidMount",value:function(){window.addEventListener("beforeunload",this.warnIfUnsavedChanges)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("beforeunload",this.warnIfUnsavedChanges)}},{key:"warnIfUnsavedChanges",value:function(e){if((0,this.props.isEditedPostDirty)())return e.returnValue=Object(I.__)("You have unsaved changes. If you proceed, they will be lost."),e.returnValue}},{key:"render",value:function(){return null}}]),r}(Jr.Component),ga=Object(p.withSelect)((function(e){return{isEditedPostDirty:e("core/editor").isEditedPostDirty}}))(Oa),ja=Object(Zr.createHigherOrderComponent)((function(e){return Object(p.withRegistry)((function(t){var n=t.useSubRegistry,r=void 0===n||n,o=t.registry,c=Object(Xr.a)(t,["useSubRegistry","registry"]);if(!r)return Object(Jr.createElement)(e,c);var a=Object(Jr.useState)(null),s=Object(Ot.a)(a,2),u=s[0],l=s[1];return Object(Jr.useEffect)((function(){var e=Object(p.createRegistry)({"core/block-editor":i.storeConfig},o),t=e.registerStore("core/editor",$r);zr(t),l(e)}),[o]),u?Object(Jr.createElement)(p.RegistryProvider,{value:u},Object(Jr.createElement)(e,c)):null}))}),"withRegistryProvider"),ya=n(73);function _a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ka(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_a(Object(n),!0).forEach((function(t){Object(d.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ea(e){var t=e.additionalData,n=void 0===t?{}:t,r=e.allowedTypes,o=e.filesList,i=e.maxUploadFileSize,c=e.onError,a=void 0===c?v.noop:c,s=e.onFileChange,u=Object(p.select)("core/editor"),l=u.getCurrentPostId,d=u.getEditorSettings,b=d().allowedMimeTypes;i=i||d().maxUploadFileSize,Object(ya.uploadMedia)({allowedTypes:r,filesList:o,onFileChange:s,additionalData:ka({post:l()},n),maxUploadFileSize:i,onError:function(e){var t=e.message;return a(t)},wpAllowedMimeTypes:b})}var Sa=Object(Zr.compose)([Object(p.withSelect)((function(e,t){var n=t.clientIds,r=e("core/block-editor"),o=r.getBlocksByClientId,i=r.canInsertBlockType,a=e("core/editor").__experimentalGetReusableBlock,s=e("core").canUser,u=o(n),l=1===u.length&&u[0]&&Object(c.isReusableBlock)(u[0])&&!!a(u[0].attributes.ref);return{isReusable:l,isVisible:l||i("core/block")&&Object(v.every)(u,(function(e){return!!e&&e.isValid&&Object(c.hasBlockSupport)(e.name,"reusable",!0)}))&&!!s("create","blocks")}})),Object(p.withDispatch)((function(e,t){var n=t.clientIds,r=e("core/editor"),o=r.__experimentalConvertBlockToReusable,i=r.__experimentalConvertBlockToStatic;return{onConvertToStatic:function(){i(n[0])},onConvertToReusable:function(){o(n)}}}))])((function(e){var t=e.isVisible,n=e.isReusable,r=e.onConvertToStatic,o=e.onConvertToReusable;return t?Object(Jr.createElement)(i.BlockSettingsMenuControls,null,(function(e){var t=e.onClose;return Object(Jr.createElement)(Jr.Fragment,null,!n&&Object(Jr.createElement)(Ro.MenuItem,{onClick:function(){o(),t()}},Object(I.__)("Add to Reusable blocks")),n&&Object(Jr.createElement)(Ro.MenuItem,{onClick:function(){r(),t()}},Object(I.__)("Convert to Regular Block")))})):null}));var Pa=Object(Zr.compose)([Object(p.withSelect)((function(e,t){var n=t.clientId,r=e("core/block-editor").getBlock,o=e("core").canUser,i=e("core/editor").__experimentalGetReusableBlock,a=r(n),s=a&&Object(c.isReusableBlock)(a)?i(a.attributes.ref):null;return{isVisible:!!s&&(s.isTemporary||!!o("delete","blocks",s.id)),isDisabled:s&&s.isTemporary}})),Object(p.withDispatch)((function(e,t,n){var r=t.clientId,o=n.select,i=e("core/editor").__experimentalDeleteReusableBlock,c=o("core/block-editor").getBlock;return{onDelete:function(){var e=window.confirm(Object(I.__)("Are you sure you want to delete this Reusable Block?\n\nIt will be permanently removed from all posts and pages that use it."));if(e){var t=c(r);i(t.attributes.ref)}return e}}}))])((function(e){var t=e.isVisible,n=e.isDisabled,r=e.onDelete;return t?Object(Jr.createElement)(i.BlockSettingsMenuControls,null,(function(e){var t=e.onClose;return Object(Jr.createElement)(Ro.MenuItem,{disabled:n,onClick:function(){r()&&t()}},Object(I.__)("Remove from Reusable blocks"))})):null}));var wa=Object(p.withSelect)((function(e){return{clientIds:(0,e("core/block-editor").getSelectedBlockClientIds)()}}))((function(e){var t=e.clientIds;return Object(Jr.createElement)(Jr.Fragment,null,Object(Jr.createElement)(Sa,{clientIds:t}),1===t.length&&Object(Jr.createElement)(Pa,{clientId:t[0]}))}));var Ca=Object(Zr.compose)([Object(p.withSelect)((function(e){var t=e("core/block-editor"),n=t.getBlockRootClientId,r=t.getBlocksByClientId,o=t.canInsertBlockType,i=t.getSelectedBlockClientIds,c=e("core/blocks").getGroupingBlockName,a=i(),s=c(),u=o(s,a&&a.length>0?n(a[0]):void 0),l=r(a),d=1===l.length&&l[0]&&l[0].name===s;return{clientIds:a,isGroupable:u&&l.length&&!d,isUngroupable:d&&!!l[0].innerBlocks.length,blocksSelection:l,groupingBlockName:s}})),Object(p.withDispatch)((function(e,t){var n=t.clientIds,r=t.blocksSelection,o=void 0===r?[]:r,i=t.groupingBlockName,a=e("core/block-editor").replaceBlocks;return{onConvertToGroup:function(){var e=Object(c.switchToBlockType)(o,i);e&&a(n,e)},onConvertFromGroup:function(){var e=o[0].innerBlocks;e.length&&a(n,e)}}}))])((function(e){var t=e.onConvertToGroup,n=e.onConvertFromGroup,r=e.isGroupable,o=void 0!==r&&r,c=e.isUngroupable,a=void 0!==c&&c;return o||a?Object(Jr.createElement)(i.BlockSettingsMenuControls,null,(function(e){var r=e.onClose;return Object(Jr.createElement)(Jr.Fragment,null,o&&Object(Jr.createElement)(Ro.MenuItem,{onClick:function(){t(),r()}},Object(I._x)("Group","verb")),a&&Object(Jr.createElement)(Ro.MenuItem,{onClick:function(){n(),r()}},Object(I._x)("Ungroup","Ungrouping blocks from within a Group block back into individual blocks within the Editor ")))})):null}));function Ta(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function xa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ta(Object(n),!0).forEach((function(t){Object(d.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ta(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ba(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}var Ra=function(){var e=Object(x.a)(T.a.mark((function e(t){var n,r,o,i,c=arguments;return T.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=c.length>1&&void 0!==c[1]?c[1]:{},r=n.perPage,o=void 0===r?20:r,e.next=3,R()({path:Object(yt.addQueryArgs)("/wp/v2/search",{search:t,per_page:o,type:"post"})});case 3:return i=e.sent,e.abrupt("return",Object(v.map)(i,(function(e){return{id:e.id,url:e.url,title:Object(mi.decodeEntities)(e.title)||Object(I.__)("(no title)"),type:e.subtype||e.type}})));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ia=function(e){Object(uo.a)(r,e);var t,n=(t=r,function(){var e,n=Object(so.a)(t);if(Ba()){var r=Object(so.a)(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return Object(ao.a)(this,e)});function r(e){var t;return Object(io.a)(this,r),(t=n.apply(this,arguments)).getBlockEditorSettings=W()(t.getBlockEditorSettings,{maxSize:1}),t.getDefaultBlockContext=W()(t.getDefaultBlockContext,{maxSize:1}),e.recovery?Object(ao.a)(t):(e.updatePostLock(e.settings.postLock),e.setupEditor(e.post,e.initialEdits,e.settings.template),e.settings.autosave&&e.createWarningNotice(Object(I.__)("There is an autosave of this post that is more recent than the version below."),{id:"autosave-exists",actions:[{label:Object(I.__)("View the autosave"),url:e.settings.autosave.editLink}]}),t)}return Object(co.a)(r,[{key:"getBlockEditorSettings",value:function(e,t,n,r,o,i,c){return xa({},Object(v.pick)(e,["__experimentalBlockDirectory","__experimentalBlockPatterns","__experimentalBlockPatternCategories","__experimentalDisableCustomUnits","__experimentalDisableCustomLineHeight","__experimentalEnableCustomSpacing","__experimentalEnableLegacyWidgetBlock","__experimentalEnableLinkColor","__experimentalEnableFullSiteEditing","__experimentalEnableFullSiteEditingDemo","__experimentalFeatures","__experimentalGlobalStylesUserEntityId","__experimentalGlobalStylesBase","__experimentalPreferredStyleVariations","__experimentalSetIsInserterOpened","alignWide","allowedBlockTypes","availableLegacyWidgets","bodyPlaceholder","codeEditingEnabled","colors","disableCustomColors","disableCustomFontSizes","disableCustomGradients","focusMode","fontSizes","gradients","hasFixedToolbar","hasPermissionsToManageWidgets","imageSizes","imageDimensions","isRTL","keepCaretInsideBlock","maxWidth","onUpdateDefaultBlockStyles","styles","template","templateLock","titlePlaceholder"]),{mediaUpload:r?Ea:void 0,__experimentalReusableBlocks:t,__experimentalFetchReusableBlocks:n,__experimentalFetchLinkSuggestions:Ra,__experimentalCanUserUseUnfilteredHTML:o,__experimentalUndo:i,__experimentalShouldInsertAtTheTop:c})}},{key:"getDefaultBlockContext",value:function(e,t){return{postId:e,postType:t}}},{key:"componentDidMount",value:function(){this.props.updateEditorSettings(this.props.settings)}},{key:"componentDidUpdate",value:function(e){this.props.settings!==e.settings&&this.props.updateEditorSettings(this.props.settings)}},{key:"componentWillUnmount",value:function(){this.props.tearDownEditor()}},{key:"render",value:function(){var e=this.props,t=e.canUserUseUnfilteredHTML,n=e.children,r=e.post,o=e.blocks,c=e.resetEditorBlocks,s=e.selectionStart,u=e.selectionEnd,l=e.isReady,d=e.settings,p=e.reusableBlocks,b=e.resetEditorBlocksWithoutUndoLevel,f=e.hasUploadPermissions,h=e.isPostTitleSelected,m=e.__experimentalFetchReusableBlocks,v=e.undo;if(!l)return null;var O=this.getBlockEditorSettings(d,p,m,f,t,v,h),g=this.getDefaultBlockContext(r.id,r.type);return Object(Jr.createElement)(Jr.Fragment,null,Object(Jr.createElement)(i.__unstableEditorStyles,{styles:d.styles}),Object(Jr.createElement)(a.EntityProvider,{kind:"root",type:"site"},Object(Jr.createElement)(a.EntityProvider,{kind:"postType",type:r.type,id:r.id},Object(Jr.createElement)(i.BlockContextProvider,{value:g},Object(Jr.createElement)(i.BlockEditorProvider,{value:o,onInput:b,onChange:c,selectionStart:s,selectionEnd:u,settings:O,useSubRegistry:!1},n,Object(Jr.createElement)(wa,null),Object(Jr.createElement)(Ca,null))))))}}]),r}(Jr.Component),Aa=Object(Zr.compose)([ja,Object(p.withSelect)((function(e){var t=e("core/editor"),n=t.canUserUseUnfilteredHTML,r=t.__unstableIsEditorReady,o=t.getEditorBlocks,i=t.getEditorSelectionStart,c=t.getEditorSelectionEnd,a=t.__experimentalGetReusableBlocks,s=t.isPostTitleSelected,u=e("core").canUser;return{canUserUseUnfilteredHTML:n(),isReady:r(),blocks:o(),selectionStart:i(),selectionEnd:c(),reusableBlocks:a(),hasUploadPermissions:Object(v.defaultTo)(u("create","media"),!0),isPostTitleSelected:s&&s()}})),Object(p.withDispatch)((function(e){var t=e("core/editor"),n=t.setupEditor,r=t.updatePostLock,o=t.resetEditorBlocks,i=t.updateEditorSettings,c=t.__experimentalFetchReusableBlocks,a=t.__experimentalTearDownEditor,s=t.undo;return{setupEditor:n,updatePostLock:r,createWarningNotice:e("core/notices").createWarningNotice,resetEditorBlocks:o,updateEditorSettings:i,resetEditorBlocksWithoutUndoLevel:function(e,t){o(e,xa({},t,{__unstableShouldCreateUndoLevel:!1}))},tearDownEditor:a,__experimentalFetchReusableBlocks:c,undo:s}}))])(Ia),Da=n(72),La=n.n(Da);function Na(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=Object(Jr.forwardRef)((function(n,r){return L()("wp.editor."+e,{alternative:"wp.blockEditor."+e}),Object(Jr.createElement)(t,Object(Yr.a)({ref:r},n))}));return n.forEach((function(n){r[n]=Na(e+"."+n,t[n])})),r}function Ua(e,t){return function(){return L()("wp.editor."+e,{alternative:"wp.blockEditor."+e}),t.apply(void 0,arguments)}}var Fa=Na("RichText",i.RichText,["Content"]);Fa.isEmpty=Ua("RichText.isEmpty",i.RichText.isEmpty);var Ma=Na("Autocomplete",i.Autocomplete),Va=Na("AlignmentToolbar",i.AlignmentToolbar),za=Na("BlockAlignmentToolbar",i.BlockAlignmentToolbar),Ha=Na("BlockControls",i.BlockControls,["Slot"]),Wa=Na("BlockEdit",i.BlockEdit),Ga=Na("BlockEditorKeyboardShortcuts",i.BlockEditorKeyboardShortcuts),Ka=Na("BlockFormatControls",i.BlockFormatControls,["Slot"]),qa=Na("BlockIcon",i.BlockIcon),$a=Na("BlockInspector",i.BlockInspector),Qa=Na("BlockList",i.BlockList),Ya=Na("BlockMover",i.BlockMover),Xa=Na("BlockNavigationDropdown",i.BlockNavigationDropdown),Ja=Na("BlockSelectionClearer",i.BlockSelectionClearer),Za=Na("BlockSettingsMenu",i.BlockSettingsMenu),es=Na("BlockTitle",i.BlockTitle),ts=Na("BlockToolbar",i.BlockToolbar),ns=Na("ColorPalette",i.ColorPalette),rs=Na("ContrastChecker",i.ContrastChecker),os=Na("CopyHandler",i.CopyHandler),is=Na("DefaultBlockAppender",i.DefaultBlockAppender),cs=Na("FontSizePicker",i.FontSizePicker),as=Na("Inserter",i.Inserter),ss=Na("InnerBlocks",i.InnerBlocks,["ButtonBlockAppender","DefaultBlockAppender","Content"]),us=Na("InspectorAdvancedControls",i.InspectorAdvancedControls,["Slot"]),ls=Na("InspectorControls",i.InspectorControls,["Slot"]),ds=Na("PanelColorSettings",i.PanelColorSettings),ps=Na("PlainText",i.PlainText),bs=Na("RichTextShortcut",i.RichTextShortcut),fs=Na("RichTextToolbarButton",i.RichTextToolbarButton),hs=Na("__unstableRichTextInputEvent",i.__unstableRichTextInputEvent),ms=Na("MediaPlaceholder",i.MediaPlaceholder),vs=Na("MediaUpload",i.MediaUpload),Os=Na("MediaUploadCheck",i.MediaUploadCheck),gs=Na("MultiSelectScrollIntoView",i.MultiSelectScrollIntoView),js=Na("NavigableToolbar",i.NavigableToolbar),ys=Na("ObserveTyping",i.ObserveTyping),_s=Na("PreserveScrollInReorder",i.PreserveScrollInReorder),ks=Na("SkipToSelectedBlock",i.SkipToSelectedBlock),Es=Na("URLInput",i.URLInput),Ss=Na("URLInputButton",i.URLInputButton),Ps=Na("URLPopover",i.URLPopover),ws=Na("Warning",i.Warning),Cs=Na("WritingFlow",i.WritingFlow),Ts=Ua("createCustomColorsHOC",i.createCustomColorsHOC),xs=Ua("getColorClassName",i.getColorClassName),Bs=Ua("getColorObjectByAttributeValues",i.getColorObjectByAttributeValues),Rs=Ua("getColorObjectByColorValue",i.getColorObjectByColorValue),Is=Ua("getFontSize",i.getFontSize),As=Ua("getFontSizeClass",i.getFontSizeClass),Ds=Ua("withColorContext",i.withColorContext),Ls=Ua("withColors",i.withColors),Ns=Ua("withFontSizes",i.withFontSizes)},38:function(e,t){!function(){e.exports=this.wp.apiFetch}()},4:function(e,t){!function(){e.exports=this.wp.data}()},40:function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.d(t,"a",(function(){return r}))},41:function(e,t,n){"use strict";function r(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}n.d(t,"a",(function(){return r}))},42:function(e,t){!function(){e.exports=this.wp.deprecated}()},43:function(e,t,n){"use strict";function r(e,t,n,r,o,i,c){try{var a=e[i](c),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(r,o)}function o(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var c=e.apply(t,n);function a(e){r(c,o,i,a,s,"next",e)}function s(e){r(c,o,i,a,s,"throw",e)}a(void 0)}))}}n.d(t,"a",(function(){return o}))},44:function(e,t,n){"use strict";var r,o;function i(e){return[e]}function c(){var e={clear:function(){e.head=null}};return e}function a(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}r={},o="undefined"!=typeof WeakMap,t.a=function(e,t){var n,s;function u(){n=o?new WeakMap:c()}function l(){var n,r,o,i,c,u=arguments.length;for(i=new Array(u),o=0;o<u;o++)i[o]=arguments[o];for(c=t.apply(null,i),(n=s(c)).isUniqueByDependants||(n.lastDependants&&!a(c,n.lastDependants,0)&&n.clear(),n.lastDependants=c),r=n.head;r;){if(a(r.args,i,1))return r!==n.head&&(r.prev.next=r.next,r.next&&(r.next.prev=r.prev),r.next=n.head,r.prev=null,n.head.prev=r,n.head=r),r.val;r=r.next}return r={val:e.apply(null,i)},i[0]=null,r.args=i,n.head&&(n.head.prev=r,r.next=n.head),n.head=r,r.val}return t||(t=i),s=o?function(e){var t,o,i,a,s,u=n,l=!0;for(t=0;t<e.length;t++){if(o=e[t],!(s=o)||"object"!=typeof s){l=!1;break}u.has(o)?u=u.get(o):(i=new WeakMap,u.set(o,i),u=i)}return u.has(r)||((a=c()).isUniqueByDependants=l,u.set(r,a)),u.get(r)}:function(){return n},l.getDependants=t,l.clear=u,u(),l}},47:function(e,t){!function(){e.exports=this.wp.coreData}()},48:function(e,t){!function(){e.exports=this.wp.keyboardShortcuts}()},5:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"a",(function(){return r}))},52:function(e,t,n){e.exports=function(e,t){var n,r,o=0;function i(){var i,c,a=n,s=arguments.length;e:for(;a;){if(a.args.length===arguments.length){for(c=0;c<s;c++)if(a.args[c]!==arguments[c]){a=a.next;continue e}return a!==n&&(a===r&&(r=a.prev),a.prev.next=a.next,a.next&&(a.next.prev=a.prev),a.next=n,a.prev=null,n.prev=a,n=a),a.val}a=a.next}for(i=new Array(s),c=0;c<s;c++)i[c]=arguments[c];return a={args:i,val:e.apply(null,i)},n?(n.prev=a,a.next=n):r=a,o===t.maxSize?(r=r.prev).next=null:o++,n=a,a.val}return t=t||{},i.clear=function(){n=null,r=null,o=0},i}},6:function(e,t){!function(){e.exports=this.wp.blockEditor}()},60:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},61:function(e,t){!function(){e.exports=this.wp.date}()},69:function(e,t){!function(){e.exports=this.wp.notices}()},7:function(e,t){!function(){e.exports=this.wp.primitives}()},72:function(e,t){!function(){e.exports=this.wp.serverSideRender}()},73:function(e,t){!function(){e.exports=this.wp.mediaUtils}()},77:function(e,t){!function(){e.exports=this.wp.viewport}()},8:function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},89:function(e,t,n){"use strict";t.__esModule=!0;var r=n(171);t.default=r.default},9:function(e,t){!function(){e.exports=this.wp.compose}()},95:function(e,t){!function(){e.exports=this.wp.autop}()}});