Diff: STRATO-apps/wordpress_03/app/wp-includes/js/dist/patterns.js
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
/******/ (() => { // webpackBootstrap
2
+
/******/ "use strict";
3
+
/******/ // The require scope
4
+
/******/ var __webpack_require__ = {};
5
+
/******/
6
+
/************************************************************************/
7
+
/******/ /* webpack/runtime/define property getters */
8
+
/******/ (() => {
9
+
/******/ // define getter functions for harmony exports
10
+
/******/ __webpack_require__.d = (exports, definition) => {
11
+
/******/ for(var key in definition) {
12
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
13
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
14
+
/******/ }
15
+
/******/ }
16
+
/******/ };
17
+
/******/ })();
18
+
/******/
19
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
20
+
/******/ (() => {
21
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
22
+
/******/ })();
23
+
/******/
24
+
/******/ /* webpack/runtime/make namespace object */
25
+
/******/ (() => {
26
+
/******/ // define __esModule on exports
27
+
/******/ __webpack_require__.r = (exports) => {
28
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
29
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
30
+
/******/ }
31
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
32
+
/******/ };
33
+
/******/ })();
34
+
/******/
35
+
/************************************************************************/
36
+
var __webpack_exports__ = {};
37
+
// ESM COMPAT FLAG
38
+
__webpack_require__.r(__webpack_exports__);
39
+
40
+
// EXPORTS
41
+
__webpack_require__.d(__webpack_exports__, {
42
+
privateApis: () => (/* reexport */ privateApis),
43
+
store: () => (/* reexport */ store)
44
+
});
45
+
46
+
// NAMESPACE OBJECT: ./node_modules/@wordpress/patterns/build-module/store/actions.js
47
+
var actions_namespaceObject = {};
48
+
__webpack_require__.r(actions_namespaceObject);
49
+
__webpack_require__.d(actions_namespaceObject, {
50
+
convertSyncedPatternToStatic: () => (convertSyncedPatternToStatic),
51
+
createPattern: () => (createPattern),
52
+
createPatternFromFile: () => (createPatternFromFile),
53
+
setEditingPattern: () => (setEditingPattern)
54
+
});
55
+
56
+
// NAMESPACE OBJECT: ./node_modules/@wordpress/patterns/build-module/store/selectors.js
57
+
var selectors_namespaceObject = {};
58
+
__webpack_require__.r(selectors_namespaceObject);
59
+
__webpack_require__.d(selectors_namespaceObject, {
60
+
isEditingPattern: () => (selectors_isEditingPattern)
61
+
});
62
+
63
+
;// external ["wp","data"]
64
+
const external_wp_data_namespaceObject = window["wp"]["data"];
65
+
;// ./node_modules/@wordpress/patterns/build-module/store/reducer.js
66
+
67
+
function isEditingPattern(state = {}, action) {
68
+
if (action?.type === "SET_EDITING_PATTERN") {
69
+
return {
70
+
...state,
71
+
[action.clientId]: action.isEditing
72
+
};
73
+
}
74
+
return state;
75
+
}
76
+
var reducer_default = (0,external_wp_data_namespaceObject.combineReducers)({
77
+
isEditingPattern
78
+
});
79
+
80
+
81
+
;// external ["wp","blocks"]
82
+
const external_wp_blocks_namespaceObject = window["wp"]["blocks"];
83
+
;// external ["wp","coreData"]
84
+
const external_wp_coreData_namespaceObject = window["wp"]["coreData"];
85
+
;// external ["wp","blockEditor"]
86
+
const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
87
+
;// ./node_modules/@wordpress/patterns/build-module/constants.js
88
+
const PATTERN_TYPES = {
89
+
theme: "pattern",
90
+
user: "wp_block"
91
+
};
92
+
const PATTERN_DEFAULT_CATEGORY = "all-patterns";
93
+
const PATTERN_USER_CATEGORY = "my-patterns";
94
+
const EXCLUDED_PATTERN_SOURCES = [
95
+
"core",
96
+
"pattern-directory/core",
97
+
"pattern-directory/featured"
98
+
];
99
+
const PATTERN_SYNC_TYPES = {
100
+
full: "fully",
101
+
unsynced: "unsynced"
102
+
};
103
+
const PARTIAL_SYNCING_SUPPORTED_BLOCKS = {
104
+
"core/paragraph": ["content"],
105
+
"core/heading": ["content"],
106
+
"core/button": ["text", "url", "linkTarget", "rel"],
107
+
"core/image": ["id", "url", "title", "alt", "caption"]
108
+
};
109
+
const PATTERN_OVERRIDES_BINDING_SOURCE = "core/pattern-overrides";
110
+
111
+
112
+
;// ./node_modules/@wordpress/patterns/build-module/store/actions.js
113
+
114
+
115
+
116
+
117
+
const createPattern = (title, syncType, content, categories) => async ({ registry }) => {
118
+
const meta = syncType === PATTERN_SYNC_TYPES.unsynced ? {
119
+
wp_pattern_sync_status: syncType
120
+
} : void 0;
121
+
const reusableBlock = {
122
+
title,
123
+
content,
124
+
status: "publish",
125
+
meta,
126
+
wp_pattern_category: categories
127
+
};
128
+
const updatedRecord = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord("postType", "wp_block", reusableBlock);
129
+
return updatedRecord;
130
+
};
131
+
const createPatternFromFile = (file, categories) => async ({ dispatch }) => {
132
+
const fileContent = await file.text();
133
+
let parsedContent;
134
+
try {
135
+
parsedContent = JSON.parse(fileContent);
136
+
} catch (e) {
137
+
throw new Error("Invalid JSON file");
138
+
}
139
+
if (parsedContent.__file !== "wp_block" || !parsedContent.title || !parsedContent.content || typeof parsedContent.title !== "string" || typeof parsedContent.content !== "string" || parsedContent.syncStatus && typeof parsedContent.syncStatus !== "string") {
140
+
throw new Error("Invalid pattern JSON file");
141
+
}
142
+
const pattern = await dispatch.createPattern(
143
+
parsedContent.title,
144
+
parsedContent.syncStatus,
145
+
parsedContent.content,
146
+
categories
147
+
);
148
+
return pattern;
149
+
};
150
+
const convertSyncedPatternToStatic = (clientId) => ({ registry }) => {
151
+
const patternBlock = registry.select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId);
152
+
const existingOverrides = patternBlock.attributes?.content;
153
+
function cloneBlocksAndRemoveBindings(blocks) {
154
+
return blocks.map((block) => {
155
+
let metadata = block.attributes.metadata;
156
+
if (metadata) {
157
+
metadata = { ...metadata };
158
+
delete metadata.id;
159
+
delete metadata.bindings;
160
+
if (existingOverrides?.[metadata.name]) {
161
+
for (const [attributeName, value] of Object.entries(
162
+
existingOverrides[metadata.name]
163
+
)) {
164
+
if (!(0,external_wp_blocks_namespaceObject.getBlockType)(block.name)?.attributes[attributeName]) {
165
+
continue;
166
+
}
167
+
block.attributes[attributeName] = value;
168
+
}
169
+
}
170
+
}
171
+
return (0,external_wp_blocks_namespaceObject.cloneBlock)(
172
+
block,
173
+
{
174
+
metadata: metadata && Object.keys(metadata).length > 0 ? metadata : void 0
175
+
},
176
+
cloneBlocksAndRemoveBindings(block.innerBlocks)
177
+
);
178
+
});
179
+
}
180
+
const patternInnerBlocks = registry.select(external_wp_blockEditor_namespaceObject.store).getBlocks(patternBlock.clientId);
181
+
registry.dispatch(external_wp_blockEditor_namespaceObject.store).replaceBlocks(
182
+
patternBlock.clientId,
183
+
cloneBlocksAndRemoveBindings(patternInnerBlocks)
184
+
);
185
+
};
186
+
function setEditingPattern(clientId, isEditing) {
187
+
return {
188
+
type: "SET_EDITING_PATTERN",
189
+
clientId,
190
+
isEditing
191
+
};
192
+
}
193
+
194
+
195
+
;// ./node_modules/@wordpress/patterns/build-module/store/constants.js
196
+
const STORE_NAME = "core/patterns";
197
+
198
+
199
+
;// ./node_modules/@wordpress/patterns/build-module/store/selectors.js
200
+
function selectors_isEditingPattern(state, clientId) {
201
+
return state.isEditingPattern[clientId];
202
+
}
203
+
204
+
205
+
;// external ["wp","privateApis"]
206
+
const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
207
+
;// ./node_modules/@wordpress/patterns/build-module/lock-unlock.js
208
+
209
+
const { lock, unlock } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
210
+
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
211
+
"@wordpress/patterns"
212
+
);
213
+
214
+
215
+
;// ./node_modules/@wordpress/patterns/build-module/store/index.js
216
+
217
+
218
+
219
+
220
+
221
+
222
+
const storeConfig = {
223
+
reducer: reducer_default
224
+
};
225
+
const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
226
+
...storeConfig
227
+
});
228
+
(0,external_wp_data_namespaceObject.register)(store);
229
+
unlock(store).registerPrivateActions(actions_namespaceObject);
230
+
unlock(store).registerPrivateSelectors(selectors_namespaceObject);
231
+
232
+
233
+
;// external "ReactJSXRuntime"
234
+
const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"];
235
+
;// external ["wp","components"]
236
+
const external_wp_components_namespaceObject = window["wp"]["components"];
237
+
;// external ["wp","element"]
238
+
const external_wp_element_namespaceObject = window["wp"]["element"];
239
+
;// external ["wp","i18n"]
240
+
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
241
+
;// ./node_modules/@wordpress/patterns/build-module/api/index.js
242
+
243
+
function isOverridableBlock(block) {
244
+
return Object.keys(PARTIAL_SYNCING_SUPPORTED_BLOCKS).includes(
245
+
block.name
246
+
) && !!block.attributes.metadata?.name && !!block.attributes.metadata?.bindings && Object.values(block.attributes.metadata.bindings).some(
247
+
(binding) => binding.source === "core/pattern-overrides"
248
+
);
249
+
}
250
+
function hasOverridableBlocks(blocks) {
251
+
return blocks.some((block) => {
252
+
if (isOverridableBlock(block)) {
253
+
return true;
254
+
}
255
+
return hasOverridableBlocks(block.innerBlocks);
256
+
});
257
+
}
258
+
259
+
260
+
;// ./node_modules/@wordpress/patterns/build-module/components/overrides-panel.js
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
const { BlockQuickNavigation } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
270
+
function OverridesPanel() {
271
+
const allClientIds = (0,external_wp_data_namespaceObject.useSelect)(
272
+
(select) => select(external_wp_blockEditor_namespaceObject.store).getClientIdsWithDescendants(),
273
+
[]
274
+
);
275
+
const { getBlock } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
276
+
const clientIdsWithOverrides = (0,external_wp_element_namespaceObject.useMemo)(
277
+
() => allClientIds.filter((clientId) => {
278
+
const block = getBlock(clientId);
279
+
return isOverridableBlock(block);
280
+
}),
281
+
[allClientIds, getBlock]
282
+
);
283
+
if (!clientIdsWithOverrides?.length) {
284
+
return null;
285
+
}
286
+
return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, { title: (0,external_wp_i18n_namespaceObject.__)("Overrides"), children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockQuickNavigation, { clientIds: clientIdsWithOverrides }) });
287
+
}
288
+
289
+
290
+
;// external ["wp","notices"]
291
+
const external_wp_notices_namespaceObject = window["wp"]["notices"];
292
+
;// external ["wp","compose"]
293
+
const external_wp_compose_namespaceObject = window["wp"]["compose"];
294
+
;// external ["wp","htmlEntities"]
295
+
const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
296
+
;// ./node_modules/@wordpress/patterns/build-module/components/category-selector.js
297
+
298
+
299
+
300
+
301
+
302
+
303
+
const unescapeString = (arg) => {
304
+
return (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(arg);
305
+
};
306
+
const CATEGORY_SLUG = "wp_pattern_category";
307
+
function CategorySelector({
308
+
categoryTerms,
309
+
onChange,
310
+
categoryMap
311
+
}) {
312
+
const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)("");
313
+
const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 500);
314
+
const suggestions = (0,external_wp_element_namespaceObject.useMemo)(() => {
315
+
return Array.from(categoryMap.values()).map((category) => unescapeString(category.label)).filter((category) => {
316
+
if (search !== "") {
317
+
return category.toLowerCase().includes(search.toLowerCase());
318
+
}
319
+
return true;
320
+
}).sort((a, b) => a.localeCompare(b));
321
+
}, [search, categoryMap]);
322
+
function handleChange(termNames) {
323
+
const uniqueTerms = termNames.reduce((terms, newTerm) => {
324
+
if (!terms.some(
325
+
(term) => term.toLowerCase() === newTerm.toLowerCase()
326
+
)) {
327
+
terms.push(newTerm);
328
+
}
329
+
return terms;
330
+
}, []);
331
+
onChange(uniqueTerms);
332
+
}
333
+
return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
334
+
external_wp_components_namespaceObject.FormTokenField,
335
+
{
336
+
className: "patterns-menu-items__convert-modal-categories",
337
+
value: categoryTerms,
338
+
suggestions,
339
+
onChange: handleChange,
340
+
onInputChange: debouncedSearch,
341
+
label: (0,external_wp_i18n_namespaceObject.__)("Categories"),
342
+
tokenizeOnBlur: true,
343
+
__experimentalExpandOnFocus: true,
344
+
__next40pxDefaultSize: true,
345
+
__nextHasNoMarginBottom: true
346
+
}
347
+
);
348
+
}
349
+
350
+
351
+
;// ./node_modules/@wordpress/patterns/build-module/private-hooks.js
352
+
353
+
354
+
355
+
356
+
function useAddPatternCategory() {
357
+
const { saveEntityRecord, invalidateResolution } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
358
+
const { corePatternCategories, userPatternCategories } = (0,external_wp_data_namespaceObject.useSelect)(
359
+
(select) => {
360
+
const { getUserPatternCategories, getBlockPatternCategories } = select(external_wp_coreData_namespaceObject.store);
361
+
return {
362
+
corePatternCategories: getBlockPatternCategories(),
363
+
userPatternCategories: getUserPatternCategories()
364
+
};
365
+
},
366
+
[]
367
+
);
368
+
const categoryMap = (0,external_wp_element_namespaceObject.useMemo)(() => {
369
+
const uniqueCategories = /* @__PURE__ */ new Map();
370
+
userPatternCategories.forEach((category) => {
371
+
uniqueCategories.set(category.label.toLowerCase(), {
372
+
label: category.label,
373
+
name: category.name,
374
+
id: category.id
375
+
});
376
+
});
377
+
corePatternCategories.forEach((category) => {
378
+
if (!uniqueCategories.has(category.label.toLowerCase()) && // There are two core categories with `Post` label so explicitly remove the one with
379
+
// the `query` slug to avoid any confusion.
380
+
category.name !== "query") {
381
+
uniqueCategories.set(category.label.toLowerCase(), {
382
+
label: category.label,
383
+
name: category.name
384
+
});
385
+
}
386
+
});
387
+
return uniqueCategories;
388
+
}, [userPatternCategories, corePatternCategories]);
389
+
async function findOrCreateTerm(term) {
390
+
try {
391
+
const existingTerm = categoryMap.get(term.toLowerCase());
392
+
if (existingTerm?.id) {
393
+
return existingTerm.id;
394
+
}
395
+
const termData = existingTerm ? { name: existingTerm.label, slug: existingTerm.name } : { name: term };
396
+
const newTerm = await saveEntityRecord(
397
+
"taxonomy",
398
+
CATEGORY_SLUG,
399
+
termData,
400
+
{ throwOnError: true }
401
+
);
402
+
invalidateResolution("getUserPatternCategories");
403
+
return newTerm.id;
404
+
} catch (error) {
405
+
if (error.code !== "term_exists") {
406
+
throw error;
407
+
}
408
+
return error.data.term_id;
409
+
}
410
+
}
411
+
return { categoryMap, findOrCreateTerm };
412
+
}
413
+
414
+
415
+
;// ./node_modules/@wordpress/patterns/build-module/components/create-pattern-modal.js
416
+
417
+
418
+
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+
function CreatePatternModal({
429
+
className = "patterns-menu-items__convert-modal",
430
+
modalTitle,
431
+
...restProps
432
+
}) {
433
+
const defaultModalTitle = (0,external_wp_data_namespaceObject.useSelect)(
434
+
(select) => select(external_wp_coreData_namespaceObject.store).getPostType(PATTERN_TYPES.user)?.labels?.add_new_item,
435
+
[]
436
+
);
437
+
return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
438
+
external_wp_components_namespaceObject.Modal,
439
+
{
440
+
title: modalTitle || defaultModalTitle,
441
+
onRequestClose: restProps.onClose,
442
+
overlayClassName: className,
443
+
focusOnMount: "firstContentElement",
444
+
size: "small",
445
+
children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(CreatePatternModalContents, { ...restProps })
446
+
}
447
+
);
448
+
}
449
+
function CreatePatternModalContents({
450
+
confirmLabel = (0,external_wp_i18n_namespaceObject.__)("Add"),
451
+
defaultCategories = [],
452
+
content,
453
+
onClose,
454
+
onError,
455
+
onSuccess,
456
+
defaultSyncType = PATTERN_SYNC_TYPES.full,
457
+
defaultTitle = ""
458
+
}) {
459
+
const [syncType, setSyncType] = (0,external_wp_element_namespaceObject.useState)(defaultSyncType);
460
+
const [categoryTerms, setCategoryTerms] = (0,external_wp_element_namespaceObject.useState)(defaultCategories);
461
+
const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(defaultTitle);
462
+
const [isSaving, setIsSaving] = (0,external_wp_element_namespaceObject.useState)(false);
463
+
const { createPattern } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
464
+
const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
465
+
const { categoryMap, findOrCreateTerm } = useAddPatternCategory();
466
+
async function onCreate(patternTitle, sync) {
467
+
if (!title || isSaving) {
468
+
return;
469
+
}
470
+
try {
471
+
setIsSaving(true);
472
+
const categories = await Promise.all(
473
+
categoryTerms.map(
474
+
(termName) => findOrCreateTerm(termName)
475
+
)
476
+
);
477
+
const newPattern = await createPattern(
478
+
patternTitle,
479
+
sync,
480
+
typeof content === "function" ? content() : content,
481
+
categories
482
+
);
483
+
onSuccess({
484
+
pattern: newPattern,
485
+
categoryId: PATTERN_DEFAULT_CATEGORY
486
+
});
487
+
} catch (error) {
488
+
createErrorNotice(error.message, {
489
+
type: "snackbar",
490
+
id: "pattern-create"
491
+
});
492
+
onError?.();
493
+
} finally {
494
+
setIsSaving(false);
495
+
setCategoryTerms([]);
496
+
setTitle("");
497
+
}
498
+
}
499
+
return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
500
+
"form",
501
+
{
502
+
onSubmit: (event) => {
503
+
event.preventDefault();
504
+
onCreate(title, syncType);
505
+
},
506
+
children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [
507
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
508
+
external_wp_components_namespaceObject.TextControl,
509
+
{
510
+
label: (0,external_wp_i18n_namespaceObject.__)("Name"),
511
+
value: title,
512
+
onChange: setTitle,
513
+
placeholder: (0,external_wp_i18n_namespaceObject.__)("My pattern"),
514
+
className: "patterns-create-modal__name-input",
515
+
__nextHasNoMarginBottom: true,
516
+
__next40pxDefaultSize: true
517
+
}
518
+
),
519
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
520
+
CategorySelector,
521
+
{
522
+
categoryTerms,
523
+
onChange: setCategoryTerms,
524
+
categoryMap
525
+
}
526
+
),
527
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
528
+
external_wp_components_namespaceObject.ToggleControl,
529
+
{
530
+
__nextHasNoMarginBottom: true,
531
+
label: (0,external_wp_i18n_namespaceObject._x)("Synced", "pattern (singular)"),
532
+
help: (0,external_wp_i18n_namespaceObject.__)(
533
+
"Sync this pattern across multiple locations."
534
+
),
535
+
checked: syncType === PATTERN_SYNC_TYPES.full,
536
+
onChange: () => {
537
+
setSyncType(
538
+
syncType === PATTERN_SYNC_TYPES.full ? PATTERN_SYNC_TYPES.unsynced : PATTERN_SYNC_TYPES.full
539
+
);
540
+
}
541
+
}
542
+
),
543
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [
544
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
545
+
external_wp_components_namespaceObject.Button,
546
+
{
547
+
__next40pxDefaultSize: true,
548
+
variant: "tertiary",
549
+
onClick: () => {
550
+
onClose();
551
+
setTitle("");
552
+
},
553
+
children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
554
+
}
555
+
),
556
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
557
+
external_wp_components_namespaceObject.Button,
558
+
{
559
+
__next40pxDefaultSize: true,
560
+
variant: "primary",
561
+
type: "submit",
562
+
"aria-disabled": !title || isSaving,
563
+
isBusy: isSaving,
564
+
children: confirmLabel
565
+
}
566
+
)
567
+
] })
568
+
] })
569
+
}
570
+
);
571
+
}
572
+
573
+
574
+
;// ./node_modules/@wordpress/patterns/build-module/components/duplicate-pattern-modal.js
575
+
576
+
577
+
578
+
579
+
580
+
581
+
582
+
function getTermLabels(pattern, categories) {
583
+
if (pattern.type !== PATTERN_TYPES.user) {
584
+
return categories.core?.filter(
585
+
(category) => pattern.categories?.includes(category.name)
586
+
).map((category) => category.label);
587
+
}
588
+
return categories.user?.filter(
589
+
(category) => pattern.wp_pattern_category?.includes(category.id)
590
+
).map((category) => category.label);
591
+
}
592
+
function useDuplicatePatternProps({ pattern, onSuccess }) {
593
+
const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
594
+
const categories = (0,external_wp_data_namespaceObject.useSelect)((select) => {
595
+
const { getUserPatternCategories, getBlockPatternCategories } = select(external_wp_coreData_namespaceObject.store);
596
+
return {
597
+
core: getBlockPatternCategories(),
598
+
user: getUserPatternCategories()
599
+
};
600
+
});
601
+
if (!pattern) {
602
+
return null;
603
+
}
604
+
return {
605
+
content: pattern.content,
606
+
defaultCategories: getTermLabels(pattern, categories),
607
+
defaultSyncType: pattern.type !== PATTERN_TYPES.user ? PATTERN_SYNC_TYPES.unsynced : pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full,
608
+
defaultTitle: (0,external_wp_i18n_namespaceObject.sprintf)(
609
+
/* translators: %s: Existing pattern title */
610
+
(0,external_wp_i18n_namespaceObject._x)("%s (Copy)", "pattern"),
611
+
typeof pattern.title === "string" ? pattern.title : pattern.title.raw
612
+
),
613
+
onSuccess: ({ pattern: newPattern }) => {
614
+
createSuccessNotice(
615
+
(0,external_wp_i18n_namespaceObject.sprintf)(
616
+
// translators: %s: The new pattern's title e.g. 'Call to action (copy)'.
617
+
(0,external_wp_i18n_namespaceObject._x)('"%s" duplicated.', "pattern"),
618
+
newPattern.title.raw
619
+
),
620
+
{
621
+
type: "snackbar",
622
+
id: "patterns-create"
623
+
}
624
+
);
625
+
onSuccess?.({ pattern: newPattern });
626
+
}
627
+
};
628
+
}
629
+
function DuplicatePatternModal({
630
+
pattern,
631
+
onClose,
632
+
onSuccess
633
+
}) {
634
+
const duplicatedProps = useDuplicatePatternProps({ pattern, onSuccess });
635
+
if (!pattern) {
636
+
return null;
637
+
}
638
+
return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
639
+
CreatePatternModal,
640
+
{
641
+
modalTitle: (0,external_wp_i18n_namespaceObject.__)("Duplicate pattern"),
642
+
confirmLabel: (0,external_wp_i18n_namespaceObject.__)("Duplicate"),
643
+
onClose,
644
+
onError: onClose,
645
+
...duplicatedProps
646
+
}
647
+
);
648
+
}
649
+
650
+
651
+
;// ./node_modules/@wordpress/patterns/build-module/components/rename-pattern-modal.js
652
+
653
+
654
+
655
+
656
+
657
+
658
+
659
+
660
+
function RenamePatternModal({
661
+
onClose,
662
+
onError,
663
+
onSuccess,
664
+
pattern,
665
+
...props
666
+
}) {
667
+
const originalName = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(pattern.title);
668
+
const [name, setName] = (0,external_wp_element_namespaceObject.useState)(originalName);
669
+
const [isSaving, setIsSaving] = (0,external_wp_element_namespaceObject.useState)(false);
670
+
const {
671
+
editEntityRecord,
672
+
__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
673
+
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
674
+
const { createSuccessNotice, createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
675
+
const onRename = async (event) => {
676
+
event.preventDefault();
677
+
if (!name || name === pattern.title || isSaving) {
678
+
return;
679
+
}
680
+
try {
681
+
await editEntityRecord("postType", pattern.type, pattern.id, {
682
+
title: name
683
+
});
684
+
setIsSaving(true);
685
+
setName("");
686
+
onClose?.();
687
+
const savedRecord = await saveSpecifiedEntityEdits(
688
+
"postType",
689
+
pattern.type,
690
+
pattern.id,
691
+
["title"],
692
+
{ throwOnError: true }
693
+
);
694
+
onSuccess?.(savedRecord);
695
+
createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Pattern renamed"), {
696
+
type: "snackbar",
697
+
id: "pattern-update"
698
+
});
699
+
} catch (error) {
700
+
onError?.();
701
+
const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0,external_wp_i18n_namespaceObject.__)("An error occurred while renaming the pattern.");
702
+
createErrorNotice(errorMessage, {
703
+
type: "snackbar",
704
+
id: "pattern-update"
705
+
});
706
+
} finally {
707
+
setIsSaving(false);
708
+
setName("");
709
+
}
710
+
};
711
+
const onRequestClose = () => {
712
+
onClose?.();
713
+
setName("");
714
+
};
715
+
return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
716
+
external_wp_components_namespaceObject.Modal,
717
+
{
718
+
title: (0,external_wp_i18n_namespaceObject.__)("Rename"),
719
+
...props,
720
+
onRequestClose: onClose,
721
+
focusOnMount: "firstContentElement",
722
+
size: "small",
723
+
children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onRename, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [
724
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
725
+
external_wp_components_namespaceObject.TextControl,
726
+
{
727
+
__nextHasNoMarginBottom: true,
728
+
__next40pxDefaultSize: true,
729
+
label: (0,external_wp_i18n_namespaceObject.__)("Name"),
730
+
value: name,
731
+
onChange: setName,
732
+
required: true
733
+
}
734
+
),
735
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [
736
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
737
+
external_wp_components_namespaceObject.Button,
738
+
{
739
+
__next40pxDefaultSize: true,
740
+
variant: "tertiary",
741
+
onClick: onRequestClose,
742
+
children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
743
+
}
744
+
),
745
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
746
+
external_wp_components_namespaceObject.Button,
747
+
{
748
+
__next40pxDefaultSize: true,
749
+
variant: "primary",
750
+
type: "submit",
751
+
children: (0,external_wp_i18n_namespaceObject.__)("Save")
752
+
}
753
+
)
754
+
] })
755
+
] }) })
756
+
}
757
+
);
758
+
}
759
+
760
+
761
+
;// external ["wp","primitives"]
762
+
const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
763
+
;// ./node_modules/@wordpress/icons/build-module/library/symbol.js
764
+
765
+
766
+
var symbol_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 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-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 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" }) });
767
+
768
+
769
+
;// ./node_modules/@wordpress/patterns/build-module/components/pattern-convert-button.js
770
+
771
+
772
+
773
+
774
+
775
+
776
+
777
+
778
+
779
+
780
+
781
+
782
+
783
+
784
+
function PatternConvertButton({
785
+
clientIds,
786
+
rootClientId,
787
+
closeBlockSettingsMenu
788
+
}) {
789
+
const { createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
790
+
const { replaceBlocks, updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
791
+
const { setEditingPattern } = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
792
+
const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
793
+
const { getBlockAttributes } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
794
+
const canConvert = (0,external_wp_data_namespaceObject.useSelect)(
795
+
(select) => {
796
+
const { canUser } = select(external_wp_coreData_namespaceObject.store);
797
+
const {
798
+
getBlocksByClientId: getBlocksByClientId2,
799
+
canInsertBlockType,
800
+
getBlockRootClientId
801
+
} = select(external_wp_blockEditor_namespaceObject.store);
802
+
const rootId = rootClientId || (clientIds.length > 0 ? getBlockRootClientId(clientIds[0]) : void 0);
803
+
const blocks = getBlocksByClientId2(clientIds) ?? [];
804
+
const hasReusableBlockSupport = (blockName) => {
805
+
const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName);
806
+
const hasParent = blockType && "parent" in blockType;
807
+
return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, "reusable", !hasParent);
808
+
};
809
+
const isSyncedPattern = blocks.length === 1 && blocks[0] && (0,external_wp_blocks_namespaceObject.isReusableBlock)(blocks[0]) && !!select(external_wp_coreData_namespaceObject.store).getEntityRecord(
810
+
"postType",
811
+
"wp_block",
812
+
blocks[0].attributes.ref
813
+
);
814
+
const isUnsyncedPattern = window?.__experimentalContentOnlyPatternInsertion && blocks.length === 1 && blocks?.[0]?.attributes?.metadata?.patternName;
815
+
const _canConvert = (
816
+
// Hide when this is already a pattern.
817
+
!isUnsyncedPattern && !isSyncedPattern && // Hide when patterns are disabled.
818
+
canInsertBlockType("core/block", rootId) && blocks.every(
819
+
(block) => (
820
+
// Guard against the case where a regular block has *just* been converted.
821
+
!!block && // Hide on invalid blocks.
822
+
block.isValid && // Hide when block doesn't support being made into a pattern.
823
+
hasReusableBlockSupport(block.name)
824
+
)
825
+
) && // Hide when current doesn't have permission to do that.
826
+
// Blocks refers to the wp_block post type, this checks the ability to create a post of that type.
827
+
!!canUser("create", {
828
+
kind: "postType",
829
+
name: "wp_block"
830
+
})
831
+
);
832
+
return _canConvert;
833
+
},
834
+
[clientIds, rootClientId]
835
+
);
836
+
const { getBlocksByClientId } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
837
+
const getContent = (0,external_wp_element_namespaceObject.useCallback)(
838
+
() => (0,external_wp_blocks_namespaceObject.serialize)(getBlocksByClientId(clientIds)),
839
+
[getBlocksByClientId, clientIds]
840
+
);
841
+
if (!canConvert) {
842
+
return null;
843
+
}
844
+
const handleSuccess = ({ pattern }) => {
845
+
if (pattern.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced) {
846
+
if (clientIds?.length === 1) {
847
+
const existingAttributes = getBlockAttributes(clientIds[0]);
848
+
updateBlockAttributes(clientIds[0], {
849
+
metadata: {
850
+
...existingAttributes?.metadata ? existingAttributes.metadata : {},
851
+
patternName: `core/block/${pattern.id}`,
852
+
name: pattern.title.raw
853
+
}
854
+
});
855
+
}
856
+
} else {
857
+
const newBlock = (0,external_wp_blocks_namespaceObject.createBlock)("core/block", {
858
+
ref: pattern.id
859
+
});
860
+
replaceBlocks(clientIds, newBlock);
861
+
setEditingPattern(newBlock.clientId, true);
862
+
closeBlockSettingsMenu();
863
+
}
864
+
createSuccessNotice(
865
+
pattern.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced ? (0,external_wp_i18n_namespaceObject.sprintf)(
866
+
// translators: %s: the name the user has given to the pattern.
867
+
(0,external_wp_i18n_namespaceObject.__)("Unsynced pattern created: %s"),
868
+
pattern.title.raw
869
+
) : (0,external_wp_i18n_namespaceObject.sprintf)(
870
+
// translators: %s: the name the user has given to the pattern.
871
+
(0,external_wp_i18n_namespaceObject.__)("Synced pattern created: %s"),
872
+
pattern.title.raw
873
+
),
874
+
{
875
+
type: "snackbar",
876
+
id: "convert-to-pattern-success"
877
+
}
878
+
);
879
+
setIsModalOpen(false);
880
+
};
881
+
return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
882
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
883
+
external_wp_components_namespaceObject.MenuItem,
884
+
{
885
+
icon: symbol_default,
886
+
onClick: () => setIsModalOpen(true),
887
+
"aria-expanded": isModalOpen,
888
+
"aria-haspopup": "dialog",
889
+
children: (0,external_wp_i18n_namespaceObject.__)("Create pattern")
890
+
}
891
+
),
892
+
isModalOpen && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
893
+
CreatePatternModal,
894
+
{
895
+
content: getContent,
896
+
onSuccess: (pattern) => {
897
+
handleSuccess(pattern);
898
+
},
899
+
onError: () => {
900
+
setIsModalOpen(false);
901
+
},
902
+
onClose: () => {
903
+
setIsModalOpen(false);
904
+
}
905
+
}
906
+
)
907
+
] });
908
+
}
909
+
910
+
911
+
;// external ["wp","url"]
912
+
const external_wp_url_namespaceObject = window["wp"]["url"];
913
+
;// ./node_modules/@wordpress/patterns/build-module/components/patterns-manage-button.js
914
+
915
+
916
+
917
+
918
+
919
+
920
+
921
+
922
+
923
+
924
+
function PatternsManageButton({ clientId }) {
925
+
const {
926
+
attributes,
927
+
canDetach,
928
+
isVisible,
929
+
managePatternsUrl,
930
+
isSyncedPattern,
931
+
isUnsyncedPattern
932
+
} = (0,external_wp_data_namespaceObject.useSelect)(
933
+
(select) => {
934
+
const { canRemoveBlock, getBlock } = select(external_wp_blockEditor_namespaceObject.store);
935
+
const { canUser } = select(external_wp_coreData_namespaceObject.store);
936
+
const block = getBlock(clientId);
937
+
const _isUnsyncedPattern = window?.__experimentalContentOnlyPatternInsertion && !!block?.attributes?.metadata?.patternName;
938
+
const _isSyncedPattern = !!block && (0,external_wp_blocks_namespaceObject.isReusableBlock)(block) && !!canUser("update", {
939
+
kind: "postType",
940
+
name: "wp_block",
941
+
id: block.attributes.ref
942
+
});
943
+
return {
944
+
attributes: block.attributes,
945
+
// For unsynced patterns, detaching is simply removing the `patternName` attribute.
946
+
// For synced patterns, the `core:block` block is replaced with its inner blocks,
947
+
// so checking whether `canRemoveBlock` is possible is required.
948
+
canDetach: _isUnsyncedPattern || _isSyncedPattern && canRemoveBlock(clientId),
949
+
isUnsyncedPattern: _isUnsyncedPattern,
950
+
isSyncedPattern: _isSyncedPattern,
951
+
isVisible: _isUnsyncedPattern || _isSyncedPattern,
952
+
// The site editor and templates both check whether the user
953
+
// has edit_theme_options capabilities. We can leverage that here
954
+
// and omit the manage patterns link if the user can't access it.
955
+
managePatternsUrl: canUser("create", {
956
+
kind: "postType",
957
+
name: "wp_template"
958
+
}) ? (0,external_wp_url_namespaceObject.addQueryArgs)("site-editor.php", {
959
+
p: "/pattern"
960
+
}) : (0,external_wp_url_namespaceObject.addQueryArgs)("edit.php", {
961
+
post_type: "wp_block"
962
+
})
963
+
};
964
+
},
965
+
[clientId]
966
+
);
967
+
const { updateBlockAttributes } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
968
+
const { convertSyncedPatternToStatic } = unlock(
969
+
(0,external_wp_data_namespaceObject.useDispatch)(store)
970
+
);
971
+
if (!isVisible) {
972
+
return null;
973
+
}
974
+
return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
975
+
canDetach && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
976
+
external_wp_components_namespaceObject.MenuItem,
977
+
{
978
+
onClick: () => {
979
+
if (isSyncedPattern) {
980
+
convertSyncedPatternToStatic(clientId);
981
+
}
982
+
if (isUnsyncedPattern) {
983
+
const {
984
+
patternName,
985
+
...attributesWithoutPatternName
986
+
} = attributes?.metadata ?? {};
987
+
updateBlockAttributes(clientId, {
988
+
metadata: attributesWithoutPatternName
989
+
});
990
+
}
991
+
},
992
+
children: (0,external_wp_i18n_namespaceObject.__)("Detach")
993
+
}
994
+
),
995
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { href: managePatternsUrl, children: (0,external_wp_i18n_namespaceObject.__)("Manage patterns") })
996
+
] });
997
+
}
998
+
var patterns_manage_button_default = PatternsManageButton;
999
+
1000
+
1001
+
;// ./node_modules/@wordpress/patterns/build-module/components/index.js
1002
+
1003
+
1004
+
1005
+
1006
+
function PatternsMenuItems({ rootClientId }) {
1007
+
return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, { children: ({ selectedClientIds, onClose }) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
1008
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1009
+
PatternConvertButton,
1010
+
{
1011
+
clientIds: selectedClientIds,
1012
+
rootClientId,
1013
+
closeBlockSettingsMenu: onClose
1014
+
}
1015
+
),
1016
+
selectedClientIds.length === 1 && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1017
+
patterns_manage_button_default,
1018
+
{
1019
+
clientId: selectedClientIds[0]
1020
+
}
1021
+
)
1022
+
] }) });
1023
+
}
1024
+
1025
+
1026
+
;// external ["wp","a11y"]
1027
+
const external_wp_a11y_namespaceObject = window["wp"]["a11y"];
1028
+
;// ./node_modules/@wordpress/patterns/build-module/components/rename-pattern-category-modal.js
1029
+
1030
+
1031
+
1032
+
1033
+
1034
+
1035
+
1036
+
1037
+
1038
+
1039
+
function RenamePatternCategoryModal({
1040
+
category,
1041
+
existingCategories,
1042
+
onClose,
1043
+
onError,
1044
+
onSuccess,
1045
+
...props
1046
+
}) {
1047
+
const id = (0,external_wp_element_namespaceObject.useId)();
1048
+
const textControlRef = (0,external_wp_element_namespaceObject.useRef)();
1049
+
const [name, setName] = (0,external_wp_element_namespaceObject.useState)((0,external_wp_htmlEntities_namespaceObject.decodeEntities)(category.name));
1050
+
const [isSaving, setIsSaving] = (0,external_wp_element_namespaceObject.useState)(false);
1051
+
const [validationMessage, setValidationMessage] = (0,external_wp_element_namespaceObject.useState)(false);
1052
+
const validationMessageId = validationMessage ? `patterns-rename-pattern-category-modal__validation-message-${id}` : void 0;
1053
+
const { saveEntityRecord, invalidateResolution } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
1054
+
const { createErrorNotice, createSuccessNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
1055
+
const onChange = (newName) => {
1056
+
if (validationMessage) {
1057
+
setValidationMessage(void 0);
1058
+
}
1059
+
setName(newName);
1060
+
};
1061
+
const onSave = async (event) => {
1062
+
event.preventDefault();
1063
+
if (isSaving) {
1064
+
return;
1065
+
}
1066
+
if (!name || name === category.name) {
1067
+
const message = (0,external_wp_i18n_namespaceObject.__)("Please enter a new name for this category.");
1068
+
(0,external_wp_a11y_namespaceObject.speak)(message, "assertive");
1069
+
setValidationMessage(message);
1070
+
textControlRef.current?.focus();
1071
+
return;
1072
+
}
1073
+
if (existingCategories.patternCategories.find((existingCategory) => {
1074
+
return existingCategory.id !== category.id && existingCategory.label.toLowerCase() === name.toLowerCase();
1075
+
})) {
1076
+
const message = (0,external_wp_i18n_namespaceObject.__)(
1077
+
"This category already exists. Please use a different name."
1078
+
);
1079
+
(0,external_wp_a11y_namespaceObject.speak)(message, "assertive");
1080
+
setValidationMessage(message);
1081
+
textControlRef.current?.focus();
1082
+
return;
1083
+
}
1084
+
try {
1085
+
setIsSaving(true);
1086
+
const savedRecord = await saveEntityRecord(
1087
+
"taxonomy",
1088
+
CATEGORY_SLUG,
1089
+
{
1090
+
id: category.id,
1091
+
slug: category.slug,
1092
+
name
1093
+
}
1094
+
);
1095
+
invalidateResolution("getUserPatternCategories");
1096
+
onSuccess?.(savedRecord);
1097
+
onClose();
1098
+
createSuccessNotice((0,external_wp_i18n_namespaceObject.__)("Pattern category renamed."), {
1099
+
type: "snackbar",
1100
+
id: "pattern-category-update"
1101
+
});
1102
+
} catch (error) {
1103
+
onError?.();
1104
+
createErrorNotice(error.message, {
1105
+
type: "snackbar",
1106
+
id: "pattern-category-update"
1107
+
});
1108
+
} finally {
1109
+
setIsSaving(false);
1110
+
setName("");
1111
+
}
1112
+
};
1113
+
const onRequestClose = () => {
1114
+
onClose();
1115
+
setName("");
1116
+
};
1117
+
return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1118
+
external_wp_components_namespaceObject.Modal,
1119
+
{
1120
+
title: (0,external_wp_i18n_namespaceObject.__)("Rename"),
1121
+
onRequestClose,
1122
+
...props,
1123
+
children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { onSubmit: onSave, children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "5", children: [
1124
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "2", children: [
1125
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1126
+
external_wp_components_namespaceObject.TextControl,
1127
+
{
1128
+
ref: textControlRef,
1129
+
__nextHasNoMarginBottom: true,
1130
+
__next40pxDefaultSize: true,
1131
+
label: (0,external_wp_i18n_namespaceObject.__)("Name"),
1132
+
value: name,
1133
+
onChange,
1134
+
"aria-describedby": validationMessageId,
1135
+
required: true
1136
+
}
1137
+
),
1138
+
validationMessage && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1139
+
"span",
1140
+
{
1141
+
className: "patterns-rename-pattern-category-modal__validation-message",
1142
+
id: validationMessageId,
1143
+
children: validationMessage
1144
+
}
1145
+
)
1146
+
] }),
1147
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [
1148
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1149
+
external_wp_components_namespaceObject.Button,
1150
+
{
1151
+
__next40pxDefaultSize: true,
1152
+
variant: "tertiary",
1153
+
onClick: onRequestClose,
1154
+
children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
1155
+
}
1156
+
),
1157
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1158
+
external_wp_components_namespaceObject.Button,
1159
+
{
1160
+
__next40pxDefaultSize: true,
1161
+
variant: "primary",
1162
+
type: "submit",
1163
+
"aria-disabled": !name || name === category.name || isSaving,
1164
+
isBusy: isSaving,
1165
+
children: (0,external_wp_i18n_namespaceObject.__)("Save")
1166
+
}
1167
+
)
1168
+
] })
1169
+
] }) })
1170
+
}
1171
+
);
1172
+
}
1173
+
1174
+
1175
+
;// ./node_modules/@wordpress/patterns/build-module/components/allow-overrides-modal.js
1176
+
1177
+
1178
+
1179
+
1180
+
1181
+
function AllowOverridesModal({
1182
+
placeholder,
1183
+
initialName = "",
1184
+
onClose,
1185
+
onSave
1186
+
}) {
1187
+
const [editedBlockName, setEditedBlockName] = (0,external_wp_element_namespaceObject.useState)(initialName);
1188
+
const descriptionId = (0,external_wp_element_namespaceObject.useId)();
1189
+
const isNameValid = !!editedBlockName.trim();
1190
+
const handleSubmit = () => {
1191
+
if (editedBlockName !== initialName) {
1192
+
const message = (0,external_wp_i18n_namespaceObject.sprintf)(
1193
+
/* translators: %s: new name/label for the block */
1194
+
(0,external_wp_i18n_namespaceObject.__)('Block name changed to: "%s".'),
1195
+
editedBlockName
1196
+
);
1197
+
(0,external_wp_a11y_namespaceObject.speak)(message, "assertive");
1198
+
}
1199
+
onSave(editedBlockName);
1200
+
onClose();
1201
+
};
1202
+
return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1203
+
external_wp_components_namespaceObject.Modal,
1204
+
{
1205
+
title: (0,external_wp_i18n_namespaceObject.__)("Enable overrides"),
1206
+
onRequestClose: onClose,
1207
+
focusOnMount: "firstContentElement",
1208
+
aria: { describedby: descriptionId },
1209
+
size: "small",
1210
+
children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1211
+
"form",
1212
+
{
1213
+
onSubmit: (event) => {
1214
+
event.preventDefault();
1215
+
if (!isNameValid) {
1216
+
return;
1217
+
}
1218
+
handleSubmit();
1219
+
},
1220
+
children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "6", children: [
1221
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { id: descriptionId, children: (0,external_wp_i18n_namespaceObject.__)(
1222
+
"Overrides are changes you make to a block within a synced pattern instance. Use overrides to customize a synced pattern instance to suit its new context. Name this block to specify an override."
1223
+
) }),
1224
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1225
+
external_wp_components_namespaceObject.TextControl,
1226
+
{
1227
+
__nextHasNoMarginBottom: true,
1228
+
__next40pxDefaultSize: true,
1229
+
value: editedBlockName,
1230
+
label: (0,external_wp_i18n_namespaceObject.__)("Name"),
1231
+
help: (0,external_wp_i18n_namespaceObject.__)(
1232
+
'For example, if you are creating a recipe pattern, you use "Recipe Title", "Recipe Description", etc.'
1233
+
),
1234
+
placeholder,
1235
+
onChange: setEditedBlockName
1236
+
}
1237
+
),
1238
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [
1239
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1240
+
external_wp_components_namespaceObject.Button,
1241
+
{
1242
+
__next40pxDefaultSize: true,
1243
+
variant: "tertiary",
1244
+
onClick: onClose,
1245
+
children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
1246
+
}
1247
+
),
1248
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1249
+
external_wp_components_namespaceObject.Button,
1250
+
{
1251
+
__next40pxDefaultSize: true,
1252
+
"aria-disabled": !isNameValid,
1253
+
variant: "primary",
1254
+
type: "submit",
1255
+
children: (0,external_wp_i18n_namespaceObject.__)("Enable")
1256
+
}
1257
+
)
1258
+
] })
1259
+
] })
1260
+
}
1261
+
)
1262
+
}
1263
+
);
1264
+
}
1265
+
function DisallowOverridesModal({ onClose, onSave }) {
1266
+
const descriptionId = (0,external_wp_element_namespaceObject.useId)();
1267
+
return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1268
+
external_wp_components_namespaceObject.Modal,
1269
+
{
1270
+
title: (0,external_wp_i18n_namespaceObject.__)("Disable overrides"),
1271
+
onRequestClose: onClose,
1272
+
aria: { describedby: descriptionId },
1273
+
size: "small",
1274
+
children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1275
+
"form",
1276
+
{
1277
+
onSubmit: (event) => {
1278
+
event.preventDefault();
1279
+
onSave();
1280
+
onClose();
1281
+
},
1282
+
children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { spacing: "6", children: [
1283
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { id: descriptionId, children: (0,external_wp_i18n_namespaceObject.__)(
1284
+
"Are you sure you want to disable overrides? Disabling overrides will revert all applied overrides for this block throughout instances of this pattern."
1285
+
) }),
1286
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, { justify: "right", children: [
1287
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1288
+
external_wp_components_namespaceObject.Button,
1289
+
{
1290
+
__next40pxDefaultSize: true,
1291
+
variant: "tertiary",
1292
+
onClick: onClose,
1293
+
children: (0,external_wp_i18n_namespaceObject.__)("Cancel")
1294
+
}
1295
+
),
1296
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1297
+
external_wp_components_namespaceObject.Button,
1298
+
{
1299
+
__next40pxDefaultSize: true,
1300
+
variant: "primary",
1301
+
type: "submit",
1302
+
children: (0,external_wp_i18n_namespaceObject.__)("Disable")
1303
+
}
1304
+
)
1305
+
] })
1306
+
] })
1307
+
}
1308
+
)
1309
+
}
1310
+
);
1311
+
}
1312
+
1313
+
1314
+
;// ./node_modules/@wordpress/patterns/build-module/components/pattern-overrides-controls.js
1315
+
1316
+
1317
+
1318
+
1319
+
1320
+
1321
+
1322
+
function PatternOverridesControls({
1323
+
attributes,
1324
+
setAttributes,
1325
+
name: blockName
1326
+
}) {
1327
+
const controlId = (0,external_wp_element_namespaceObject.useId)();
1328
+
const [showAllowOverridesModal, setShowAllowOverridesModal] = (0,external_wp_element_namespaceObject.useState)(false);
1329
+
const [showDisallowOverridesModal, setShowDisallowOverridesModal] = (0,external_wp_element_namespaceObject.useState)(false);
1330
+
const hasName = !!attributes.metadata?.name;
1331
+
const defaultBindings = attributes.metadata?.bindings?.__default;
1332
+
const hasOverrides = hasName && defaultBindings?.source === PATTERN_OVERRIDES_BINDING_SOURCE;
1333
+
const isConnectedToOtherSources = defaultBindings?.source && defaultBindings.source !== PATTERN_OVERRIDES_BINDING_SOURCE;
1334
+
const { updateBlockBindings } = (0,external_wp_blockEditor_namespaceObject.useBlockBindingsUtils)();
1335
+
function updateBindings(isChecked, customName) {
1336
+
if (customName) {
1337
+
setAttributes({
1338
+
metadata: {
1339
+
...attributes.metadata,
1340
+
name: customName
1341
+
}
1342
+
});
1343
+
}
1344
+
updateBlockBindings({
1345
+
__default: isChecked ? { source: PATTERN_OVERRIDES_BINDING_SOURCE } : void 0
1346
+
});
1347
+
}
1348
+
if (isConnectedToOtherSources) {
1349
+
return null;
1350
+
}
1351
+
const hasUnsupportedImageAttributes = blockName === "core/image" && !!attributes.href?.length;
1352
+
const helpText = !hasOverrides && hasUnsupportedImageAttributes ? (0,external_wp_i18n_namespaceObject.__)(
1353
+
`Overrides currently don't support image links. Remove the link first before enabling overrides.`
1354
+
) : (0,external_wp_i18n_namespaceObject.__)(
1355
+
"Allow changes to this block throughout instances of this pattern."
1356
+
);
1357
+
return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: [
1358
+
/* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { group: "advanced", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1359
+
external_wp_components_namespaceObject.BaseControl,
1360
+
{
1361
+
__nextHasNoMarginBottom: true,
1362
+
id: controlId,
1363
+
label: (0,external_wp_i18n_namespaceObject.__)("Overrides"),
1364
+
help: helpText,
1365
+
children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1366
+
external_wp_components_namespaceObject.Button,
1367
+
{
1368
+
__next40pxDefaultSize: true,
1369
+
className: "pattern-overrides-control__allow-overrides-button",
1370
+
variant: "secondary",
1371
+
"aria-haspopup": "dialog",
1372
+
onClick: () => {
1373
+
if (hasOverrides) {
1374
+
setShowDisallowOverridesModal(true);
1375
+
} else {
1376
+
setShowAllowOverridesModal(true);
1377
+
}
1378
+
},
1379
+
disabled: !hasOverrides && hasUnsupportedImageAttributes,
1380
+
accessibleWhenDisabled: true,
1381
+
children: hasOverrides ? (0,external_wp_i18n_namespaceObject.__)("Disable overrides") : (0,external_wp_i18n_namespaceObject.__)("Enable overrides")
1382
+
}
1383
+
)
1384
+
}
1385
+
) }),
1386
+
showAllowOverridesModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1387
+
AllowOverridesModal,
1388
+
{
1389
+
initialName: attributes.metadata?.name,
1390
+
onClose: () => setShowAllowOverridesModal(false),
1391
+
onSave: (newName) => {
1392
+
updateBindings(true, newName);
1393
+
}
1394
+
}
1395
+
),
1396
+
showDisallowOverridesModal && /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1397
+
DisallowOverridesModal,
1398
+
{
1399
+
onClose: () => setShowDisallowOverridesModal(false),
1400
+
onSave: () => updateBindings(false)
1401
+
}
1402
+
)
1403
+
] });
1404
+
}
1405
+
var pattern_overrides_controls_default = PatternOverridesControls;
1406
+
1407
+
1408
+
;// ./node_modules/@wordpress/patterns/build-module/components/reset-overrides-control.js
1409
+
1410
+
1411
+
1412
+
1413
+
1414
+
const CONTENT = "content";
1415
+
function ResetOverridesControl(props) {
1416
+
const name = props.attributes.metadata?.name;
1417
+
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
1418
+
const isOverridden = (0,external_wp_data_namespaceObject.useSelect)(
1419
+
(select) => {
1420
+
if (!name) {
1421
+
return;
1422
+
}
1423
+
const { getBlockAttributes, getBlockParentsByBlockName } = select(external_wp_blockEditor_namespaceObject.store);
1424
+
const [patternClientId] = getBlockParentsByBlockName(
1425
+
props.clientId,
1426
+
"core/block",
1427
+
true
1428
+
);
1429
+
if (!patternClientId) {
1430
+
return;
1431
+
}
1432
+
const overrides = getBlockAttributes(patternClientId)[CONTENT];
1433
+
if (!overrides) {
1434
+
return;
1435
+
}
1436
+
return overrides.hasOwnProperty(name);
1437
+
},
1438
+
[props.clientId, name]
1439
+
);
1440
+
function onClick() {
1441
+
const { getBlockAttributes, getBlockParentsByBlockName } = registry.select(external_wp_blockEditor_namespaceObject.store);
1442
+
const [patternClientId] = getBlockParentsByBlockName(
1443
+
props.clientId,
1444
+
"core/block",
1445
+
true
1446
+
);
1447
+
if (!patternClientId) {
1448
+
return;
1449
+
}
1450
+
const overrides = getBlockAttributes(patternClientId)[CONTENT];
1451
+
if (!overrides.hasOwnProperty(name)) {
1452
+
return;
1453
+
}
1454
+
const { updateBlockAttributes, __unstableMarkLastChangeAsPersistent } = registry.dispatch(external_wp_blockEditor_namespaceObject.store);
1455
+
__unstableMarkLastChangeAsPersistent();
1456
+
let newOverrides = { ...overrides };
1457
+
delete newOverrides[name];
1458
+
if (!Object.keys(newOverrides).length) {
1459
+
newOverrides = void 0;
1460
+
}
1461
+
updateBlockAttributes(patternClientId, {
1462
+
[CONTENT]: newOverrides
1463
+
});
1464
+
}
1465
+
return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.__unstableBlockToolbarLastItem, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { onClick, disabled: !isOverridden, children: (0,external_wp_i18n_namespaceObject.__)("Reset") }) }) });
1466
+
}
1467
+
1468
+
1469
+
;// ./node_modules/@wordpress/icons/build-module/library/copy.js
1470
+
1471
+
1472
+
var copy_default = /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1473
+
external_wp_primitives_namespaceObject.Path,
1474
+
{
1475
+
fillRule: "evenodd",
1476
+
clipRule: "evenodd",
1477
+
d: "M5 4.5h11a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5ZM3 5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5Zm17 3v10.75c0 .69-.56 1.25-1.25 1.25H6v1.5h12.75a2.75 2.75 0 0 0 2.75-2.75V8H20Z"
1478
+
}
1479
+
) });
1480
+
1481
+
1482
+
;// ./node_modules/@wordpress/patterns/build-module/components/pattern-overrides-block-controls.js
1483
+
1484
+
1485
+
1486
+
1487
+
1488
+
1489
+
1490
+
1491
+
1492
+
1493
+
const { useBlockDisplayTitle } = unlock(external_wp_blockEditor_namespaceObject.privateApis);
1494
+
function PatternOverridesToolbarIndicator({ clientIds }) {
1495
+
const isSingleBlockSelected = clientIds.length === 1;
1496
+
const { icon, firstBlockName } = (0,external_wp_data_namespaceObject.useSelect)(
1497
+
(select) => {
1498
+
const { getBlockAttributes, getBlockNamesByClientId } = select(external_wp_blockEditor_namespaceObject.store);
1499
+
const { getBlockType, getActiveBlockVariation } = select(external_wp_blocks_namespaceObject.store);
1500
+
const blockTypeNames = getBlockNamesByClientId(clientIds);
1501
+
const _firstBlockTypeName = blockTypeNames[0];
1502
+
const firstBlockType = getBlockType(_firstBlockTypeName);
1503
+
let _icon;
1504
+
if (isSingleBlockSelected) {
1505
+
const match = getActiveBlockVariation(
1506
+
_firstBlockTypeName,
1507
+
getBlockAttributes(clientIds[0])
1508
+
);
1509
+
_icon = match?.icon || firstBlockType.icon;
1510
+
} else {
1511
+
const isSelectionOfSameType = new Set(blockTypeNames).size === 1;
1512
+
_icon = isSelectionOfSameType ? firstBlockType.icon : copy_default;
1513
+
}
1514
+
return {
1515
+
icon: _icon,
1516
+
firstBlockName: getBlockAttributes(clientIds[0]).metadata.name
1517
+
};
1518
+
},
1519
+
[clientIds, isSingleBlockSelected]
1520
+
);
1521
+
const firstBlockTitle = useBlockDisplayTitle({
1522
+
clientId: clientIds[0],
1523
+
maximumLength: 35
1524
+
});
1525
+
const blockDescription = isSingleBlockSelected ? (0,external_wp_i18n_namespaceObject.sprintf)(
1526
+
/* translators: 1: The block type's name. 2: The block's user-provided name (the same as the override name). */
1527
+
(0,external_wp_i18n_namespaceObject.__)('This %1$s is editable using the "%2$s" override.'),
1528
+
firstBlockTitle.toLowerCase(),
1529
+
firstBlockName
1530
+
) : (0,external_wp_i18n_namespaceObject.__)("These blocks are editable using overrides.");
1531
+
const descriptionId = (0,external_wp_element_namespaceObject.useId)();
1532
+
return /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { children: (toggleProps) => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1533
+
external_wp_components_namespaceObject.DropdownMenu,
1534
+
{
1535
+
className: "patterns-pattern-overrides-toolbar-indicator",
1536
+
label: firstBlockTitle,
1537
+
popoverProps: {
1538
+
placement: "bottom-start",
1539
+
className: "patterns-pattern-overrides-toolbar-indicator__popover"
1540
+
},
1541
+
icon: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(
1542
+
external_wp_blockEditor_namespaceObject.BlockIcon,
1543
+
{
1544
+
icon,
1545
+
className: "patterns-pattern-overrides-toolbar-indicator-icon",
1546
+
showColors: true
1547
+
}
1548
+
) }),
1549
+
toggleProps: {
1550
+
description: blockDescription,
1551
+
...toggleProps
1552
+
},
1553
+
menuProps: {
1554
+
orientation: "both",
1555
+
"aria-describedby": descriptionId
1556
+
},
1557
+
children: () => /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalText, { id: descriptionId, children: blockDescription })
1558
+
}
1559
+
) });
1560
+
}
1561
+
function PatternOverridesBlockControls() {
1562
+
const { clientIds, hasPatternOverrides, hasParentPattern } = (0,external_wp_data_namespaceObject.useSelect)(
1563
+
(select) => {
1564
+
const {
1565
+
getBlockAttributes,
1566
+
getSelectedBlockClientIds,
1567
+
getBlockParentsByBlockName
1568
+
} = select(external_wp_blockEditor_namespaceObject.store);
1569
+
const selectedClientIds = getSelectedBlockClientIds();
1570
+
const _hasPatternOverrides = selectedClientIds.every(
1571
+
(clientId) => Object.values(
1572
+
getBlockAttributes(clientId)?.metadata?.bindings ?? {}
1573
+
).some(
1574
+
(binding) => binding?.source === PATTERN_OVERRIDES_BINDING_SOURCE
1575
+
)
1576
+
);
1577
+
const _hasParentPattern = selectedClientIds.every(
1578
+
(clientId) => getBlockParentsByBlockName(clientId, "core/block", true).length > 0
1579
+
);
1580
+
return {
1581
+
clientIds: selectedClientIds,
1582
+
hasPatternOverrides: _hasPatternOverrides,
1583
+
hasParentPattern: _hasParentPattern
1584
+
};
1585
+
},
1586
+
[]
1587
+
);
1588
+
return hasPatternOverrides && hasParentPattern ? /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { group: "parent", children: /* @__PURE__ */ (0,external_ReactJSXRuntime_namespaceObject.jsx)(PatternOverridesToolbarIndicator, { clientIds }) }) : null;
1589
+
}
1590
+
1591
+
1592
+
;// ./node_modules/@wordpress/patterns/build-module/private-apis.js
1593
+
1594
+
1595
+
1596
+
1597
+
1598
+
1599
+
1600
+
1601
+
1602
+
1603
+
1604
+
1605
+
1606
+
const privateApis = {};
1607
+
lock(privateApis, {
1608
+
OverridesPanel: OverridesPanel,
1609
+
CreatePatternModal: CreatePatternModal,
1610
+
CreatePatternModalContents: CreatePatternModalContents,
1611
+
DuplicatePatternModal: DuplicatePatternModal,
1612
+
isOverridableBlock: isOverridableBlock,
1613
+
hasOverridableBlocks: hasOverridableBlocks,
1614
+
useDuplicatePatternProps: useDuplicatePatternProps,
1615
+
RenamePatternModal: RenamePatternModal,
1616
+
PatternsMenuItems: PatternsMenuItems,
1617
+
RenamePatternCategoryModal: RenamePatternCategoryModal,
1618
+
PatternOverridesControls: pattern_overrides_controls_default,
1619
+
ResetOverridesControl: ResetOverridesControl,
1620
+
PatternOverridesBlockControls: PatternOverridesBlockControls,
1621
+
useAddPatternCategory: useAddPatternCategory,
1622
+
PATTERN_TYPES: PATTERN_TYPES,
1623
+
PATTERN_DEFAULT_CATEGORY: PATTERN_DEFAULT_CATEGORY,
1624
+
PATTERN_USER_CATEGORY: PATTERN_USER_CATEGORY,
1625
+
EXCLUDED_PATTERN_SOURCES: EXCLUDED_PATTERN_SOURCES,
1626
+
PATTERN_SYNC_TYPES: PATTERN_SYNC_TYPES,
1627
+
PARTIAL_SYNCING_SUPPORTED_BLOCKS: PARTIAL_SYNCING_SUPPORTED_BLOCKS
1628
+
});
1629
+
1630
+
1631
+
;// ./node_modules/@wordpress/patterns/build-module/index.js
1632
+
1633
+
1634
+
1635
+
1636
+
(window.wp = window.wp || {}).patterns = __webpack_exports__;
1637
+
/******/ })()
1638
+
;