| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 (function() { 2 "use strict"; 3 var wp; 4 (wp ||= {}).patterns = (() => { 5 var __create = Object.create; 6 var __defProp = Object.defineProperty; 7 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 8 var __getOwnPropNames = Object.getOwnPropertyNames; 9 var __getProtoOf = Object.getPrototypeOf; 10 var __hasOwnProp = Object.prototype.hasOwnProperty; 11 var __commonJS = (cb, mod) => function __require() { 12 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 13 }; 14 var __export = (target, all) => { 15 for (var name in all) 16 __defProp(target, name, { get: all[name], enumerable: true }); 17 }; 18 var __copyProps = (to, from, except, desc) => { 19 if (from && typeof from === "object" || typeof from === "function") { 20 for (let key of __getOwnPropNames(from)) 21 if (!__hasOwnProp.call(to, key) && key !== except) 22 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 23 } 24 return to; 25 }; 26 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 27 // If the importer is in node compatibility mode or this is not an ESM 28 // file that has been converted to a CommonJS file using a Babel- 29 // compatible transform (i.e. "__esModule" has not been set), then set 30 // "default" to the CommonJS "module.exports" for node compatibility. 31 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 32 mod 33 )); 34 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 35 36 // package-external:@wordpress/data 37 var require_data = __commonJS({ 38 "package-external:@wordpress/data"(exports, module) { 39 module.exports = window.wp.data; 40 } 41 }); 42 43 // package-external:@wordpress/blocks 44 var require_blocks = __commonJS({ 45 "package-external:@wordpress/blocks"(exports, module) { 46 module.exports = window.wp.blocks; 47 } 48 }); 49 50 // package-external:@wordpress/core-data 51 var require_core_data = __commonJS({ 52 "package-external:@wordpress/core-data"(exports, module) { 53 module.exports = window.wp.coreData; 54 } 55 }); 56 57 // package-external:@wordpress/block-editor 58 var require_block_editor = __commonJS({ 59 "package-external:@wordpress/block-editor"(exports, module) { 60 module.exports = window.wp.blockEditor; 61 } 62 }); 63 64 // package-external:@wordpress/private-apis 65 var require_private_apis = __commonJS({ 66 "package-external:@wordpress/private-apis"(exports, module) { 67 module.exports = window.wp.privateApis; 68 } 69 }); 70 71 // package-external:@wordpress/components 72 var require_components = __commonJS({ 73 "package-external:@wordpress/components"(exports, module) { 74 module.exports = window.wp.components; 75 } 76 }); 77 78 // package-external:@wordpress/element 79 var require_element = __commonJS({ 80 "package-external:@wordpress/element"(exports, module) { 81 module.exports = window.wp.element; 82 } 83 }); 84 85 // package-external:@wordpress/i18n 86 var require_i18n = __commonJS({ 87 "package-external:@wordpress/i18n"(exports, module) { 88 module.exports = window.wp.i18n; 89 } 90 }); 91 92 // vendor-external:react/jsx-runtime 93 var require_jsx_runtime = __commonJS({ 94 "vendor-external:react/jsx-runtime"(exports, module) { 95 module.exports = window.ReactJSXRuntime; 96 } 97 }); 98 99 // vendor-external:react 100 var require_react = __commonJS({ 101 "vendor-external:react"(exports, module) { 102 module.exports = window.React; 103 } 104 }); 105 106 // package-external:@wordpress/primitives 107 var require_primitives = __commonJS({ 108 "package-external:@wordpress/primitives"(exports, module) { 109 module.exports = window.wp.primitives; 110 } 111 }); 112 113 // package-external:@wordpress/compose 114 var require_compose = __commonJS({ 115 "package-external:@wordpress/compose"(exports, module) { 116 module.exports = window.wp.compose; 117 } 118 }); 119 120 // package-external:@wordpress/a11y 121 var require_a11y = __commonJS({ 122 "package-external:@wordpress/a11y"(exports, module) { 123 module.exports = window.wp.a11y; 124 } 125 }); 126 127 // package-external:@wordpress/notices 128 var require_notices = __commonJS({ 129 "package-external:@wordpress/notices"(exports, module) { 130 module.exports = window.wp.notices; 131 } 132 }); 133 134 // package-external:@wordpress/html-entities 135 var require_html_entities = __commonJS({ 136 "package-external:@wordpress/html-entities"(exports, module) { 137 module.exports = window.wp.htmlEntities; 138 } 139 }); 140 141 // package-external:@wordpress/url 142 var require_url = __commonJS({ 143 "package-external:@wordpress/url"(exports, module) { 144 module.exports = window.wp.url; 145 } 146 }); 147 148 // packages/patterns/build-module/index.mjs 149 var index_exports = {}; 150 __export(index_exports, { 151 privateApis: () => privateApis, 152 store: () => store 153 }); 154 155 // packages/patterns/build-module/store/index.mjs 156 var import_data2 = __toESM(require_data(), 1); 157 158 // packages/patterns/build-module/store/reducer.mjs 159 var import_data = __toESM(require_data(), 1); 160 function isEditingPattern(state = {}, action) { 161 if (action?.type === "SET_EDITING_PATTERN") { 162 return { 163 ...state, 164 [action.clientId]: action.isEditing 165 }; 166 } 167 return state; 168 } 169 var reducer_default = (0, import_data.combineReducers)({ 170 isEditingPattern 171 }); 172 173 // packages/patterns/build-module/store/actions.mjs 174 var actions_exports = {}; 175 __export(actions_exports, { 176 convertSyncedPatternToStatic: () => convertSyncedPatternToStatic, 177 createPattern: () => createPattern, 178 createPatternFromFile: () => createPatternFromFile, 179 setEditingPattern: () => setEditingPattern 180 }); 181 var import_blocks = __toESM(require_blocks(), 1); 182 var import_core_data = __toESM(require_core_data(), 1); 183 var import_block_editor = __toESM(require_block_editor(), 1); 184 185 // packages/patterns/build-module/constants.mjs 186 var PATTERN_TYPES = { 187 theme: "pattern", 188 user: "wp_block" 189 }; 190 var PATTERN_DEFAULT_CATEGORY = "all-patterns"; 191 var PATTERN_USER_CATEGORY = "my-patterns"; 192 var EXCLUDED_PATTERN_SOURCES = [ 193 "core", 194 "pattern-directory/core", 195 "pattern-directory/featured" 196 ]; 197 var PATTERN_SYNC_TYPES = { 198 full: "fully", 199 unsynced: "unsynced" 200 }; 201 var PATTERN_OVERRIDES_BINDING_SOURCE = "core/pattern-overrides"; 202 203 // packages/patterns/build-module/store/actions.mjs 204 var createPattern = (title, syncType, content, categories) => async ({ registry }) => { 205 const meta = syncType === PATTERN_SYNC_TYPES.unsynced ? { 206 wp_pattern_sync_status: syncType 207 } : void 0; 208 const reusableBlock = { 209 title, 210 content, 211 status: "publish", 212 meta, 213 wp_pattern_category: categories 214 }; 215 const updatedRecord = await registry.dispatch(import_core_data.store).saveEntityRecord("postType", "wp_block", reusableBlock); 216 return updatedRecord; 217 }; 218 var createPatternFromFile = (file, categories) => async ({ dispatch }) => { 219 const fileContent = await file.text(); 220 let parsedContent; 221 try { 222 parsedContent = JSON.parse(fileContent); 223 } catch { 224 throw new Error("Invalid JSON file"); 225 } 226 if (parsedContent.__file !== "wp_block" || !parsedContent.title || !parsedContent.content || typeof parsedContent.title !== "string" || typeof parsedContent.content !== "string" || parsedContent.syncStatus && typeof parsedContent.syncStatus !== "string") { 227 throw new Error("Invalid pattern JSON file"); 228 } 229 const pattern = await dispatch.createPattern( 230 parsedContent.title, 231 parsedContent.syncStatus, 232 parsedContent.content, 233 categories 234 ); 235 return pattern; 236 }; 237 var convertSyncedPatternToStatic = (clientId) => ({ registry }) => { 238 const patternBlock = registry.select(import_block_editor.store).getBlock(clientId); 239 const existingOverrides = patternBlock.attributes?.content; 240 function cloneBlocksAndRemoveBindings(blocks) { 241 return blocks.map((block) => { 242 let metadata = block.attributes.metadata; 243 if (metadata) { 244 metadata = { ...metadata }; 245 delete metadata.id; 246 delete metadata.bindings; 247 if (existingOverrides?.[metadata.name]) { 248 for (const [attributeName, value] of Object.entries( 249 existingOverrides[metadata.name] 250 )) { 251 if (!(0, import_blocks.getBlockType)(block.name)?.attributes[attributeName]) { 252 continue; 253 } 254 block.attributes[attributeName] = value; 255 } 256 } 257 } 258 return (0, import_blocks.cloneBlock)( 259 block, 260 { 261 metadata: metadata && Object.keys(metadata).length > 0 ? metadata : void 0 262 }, 263 cloneBlocksAndRemoveBindings(block.innerBlocks) 264 ); 265 }); 266 } 267 const patternInnerBlocks = registry.select(import_block_editor.store).getBlocks(patternBlock.clientId); 268 registry.dispatch(import_block_editor.store).replaceBlocks( 269 patternBlock.clientId, 270 cloneBlocksAndRemoveBindings(patternInnerBlocks) 271 ); 272 }; 273 function setEditingPattern(clientId, isEditing) { 274 return { 275 type: "SET_EDITING_PATTERN", 276 clientId, 277 isEditing 278 }; 279 } 280 281 // packages/patterns/build-module/store/constants.mjs 282 var STORE_NAME = "core/patterns"; 283 284 // packages/patterns/build-module/store/selectors.mjs 285 var selectors_exports = {}; 286 __export(selectors_exports, { 287 isEditingPattern: () => isEditingPattern2 288 }); 289 function isEditingPattern2(state, clientId) { 290 return state.isEditingPattern[clientId]; 291 } 292 293 // packages/patterns/build-module/lock-unlock.mjs 294 var import_private_apis = __toESM(require_private_apis(), 1); 295 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 296 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 297 "@wordpress/patterns" 298 ); 299 300 // packages/patterns/build-module/store/index.mjs 301 var storeConfig = { 302 reducer: reducer_default 303 }; 304 var store = (0, import_data2.createReduxStore)(STORE_NAME, { 305 ...storeConfig 306 }); 307 (0, import_data2.register)(store); 308 unlock(store).registerPrivateActions(actions_exports); 309 unlock(store).registerPrivateSelectors(selectors_exports); 310 311 // packages/patterns/build-module/components/overrides-panel.mjs 312 var import_block_editor2 = __toESM(require_block_editor(), 1); 313 var import_components = __toESM(require_components(), 1); 314 var import_data3 = __toESM(require_data(), 1); 315 var import_element = __toESM(require_element(), 1); 316 var import_i18n = __toESM(require_i18n(), 1); 317 318 // packages/patterns/build-module/api/index.mjs 319 function isOverridableBlock(block) { 320 return !!block.attributes.metadata?.name && !!block.attributes.metadata?.bindings && Object.values(block.attributes.metadata.bindings).some( 321 (binding) => binding.source === "core/pattern-overrides" 322 ); 323 } 324 325 // packages/patterns/build-module/components/overrides-panel.mjs 326 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 327 var { BlockQuickNavigation } = unlock(import_block_editor2.privateApis); 328 function OverridesPanel() { 329 const { allClientIds, supportedBlockTypesRaw } = (0, import_data3.useSelect)( 330 (select) => ({ 331 allClientIds: select(import_block_editor2.store).getClientIdsWithDescendants(), 332 supportedBlockTypesRaw: select(import_block_editor2.store).getSettings()?.__experimentalBlockBindingsSupportedAttributes 333 }), 334 [] 335 ); 336 const { getBlock } = (0, import_data3.useSelect)(import_block_editor2.store); 337 const clientIdsWithOverrides = (0, import_element.useMemo)(() => { 338 const supportedBlockTypes = Object.keys(supportedBlockTypesRaw ?? {}); 339 return allClientIds.filter((clientId) => { 340 const block = getBlock(clientId); 341 return supportedBlockTypes.includes(block.name) && isOverridableBlock(block); 342 }); 343 }, [allClientIds, getBlock, supportedBlockTypesRaw]); 344 if (!clientIdsWithOverrides?.length) { 345 return null; 346 } 347 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.PanelBody, { title: (0, import_i18n.__)("Overrides"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BlockQuickNavigation, { clientIds: clientIdsWithOverrides }) }); 348 } 349 350 // packages/patterns/build-module/components/create-pattern-modal.mjs 351 var import_components3 = __toESM(require_components(), 1); 352 353 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/useRenderElement.mjs 354 var React4 = __toESM(require_react(), 1); 355 356 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/useRefWithInit.mjs 357 var React = __toESM(require_react(), 1); 358 var UNINITIALIZED = {}; 359 function useRefWithInit(init, initArg) { 360 const ref = React.useRef(UNINITIALIZED); 361 if (ref.current === UNINITIALIZED) { 362 ref.current = init(initArg); 363 } 364 return ref; 365 } 366 367 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/useMergedRefs.mjs 368 function useMergedRefs(a, b, c, d) { 369 const forkRef = useRefWithInit(createForkRef).current; 370 if (didChange(forkRef, a, b, c, d)) { 371 update(forkRef, [a, b, c, d]); 372 } 373 return forkRef.callback; 374 } 375 function useMergedRefsN(refs) { 376 const forkRef = useRefWithInit(createForkRef).current; 377 if (didChangeN(forkRef, refs)) { 378 update(forkRef, refs); 379 } 380 return forkRef.callback; 381 } 382 function createForkRef() { 383 return { 384 callback: null, 385 cleanup: null, 386 refs: [] 387 }; 388 } 389 function didChange(forkRef, a, b, c, d) { 390 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; 391 } 392 function didChangeN(forkRef, newRefs) { 393 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]); 394 } 395 function update(forkRef, refs) { 396 forkRef.refs = refs; 397 if (refs.every((ref) => ref == null)) { 398 forkRef.callback = null; 399 return; 400 } 401 forkRef.callback = (instance) => { 402 if (forkRef.cleanup) { 403 forkRef.cleanup(); 404 forkRef.cleanup = null; 405 } 406 if (instance != null) { 407 const cleanupCallbacks = Array(refs.length).fill(null); 408 for (let i = 0; i < refs.length; i += 1) { 409 const ref = refs[i]; 410 if (ref == null) { 411 continue; 412 } 413 switch (typeof ref) { 414 case "function": { 415 const refCleanup = ref(instance); 416 if (typeof refCleanup === "function") { 417 cleanupCallbacks[i] = refCleanup; 418 } 419 break; 420 } 421 case "object": { 422 ref.current = instance; 423 break; 424 } 425 default: 426 } 427 } 428 forkRef.cleanup = () => { 429 for (let i = 0; i < refs.length; i += 1) { 430 const ref = refs[i]; 431 if (ref == null) { 432 continue; 433 } 434 switch (typeof ref) { 435 case "function": { 436 const cleanupCallback = cleanupCallbacks[i]; 437 if (typeof cleanupCallback === "function") { 438 cleanupCallback(); 439 } else { 440 void ref(null); 441 } 442 break; 443 } 444 case "object": { 445 ref.current = null; 446 break; 447 } 448 default: 449 } 450 } 451 }; 452 } 453 }; 454 } 455 456 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/getReactElementRef.mjs 457 var React3 = __toESM(require_react(), 1); 458 459 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/reactVersion.mjs 460 var React2 = __toESM(require_react(), 1); 461 var majorVersion = parseInt(React2.version, 10); 462 function isReactVersionAtLeast(reactVersionToCheck) { 463 return majorVersion >= reactVersionToCheck; 464 } 465 466 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/getReactElementRef.mjs 467 function getReactElementRef(element) { 468 if (!/* @__PURE__ */ React3.isValidElement(element)) { 469 return null; 470 } 471 const reactElement = element; 472 const propsWithRef = reactElement.props; 473 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; 474 } 475 476 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/mergeObjects.mjs 477 function mergeObjects(a, b) { 478 if (a && !b) { 479 return a; 480 } 481 if (!a && b) { 482 return b; 483 } 484 if (a || b) { 485 return { 486 ...a, 487 ...b 488 }; 489 } 490 return void 0; 491 } 492 493 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/createLogOnce.mjs 494 var loggedMessages; 495 if (true) { 496 loggedMessages = /* @__PURE__ */ new Set(); 497 } 498 function createLogOnce(severity, prefix) { 499 return function logOnce(...messages) { 500 if (true) { 501 const message = messages.join(" "); 502 const output = prefix ? `$prefix}: $message}` : message; 503 const key = `$severity}:$output}`; 504 if (!loggedMessages.has(key)) { 505 loggedMessages.add(key); 506 if (severity === "warn") { 507 console.warn(output); 508 } else { 509 console.error(output); 510 } 511 } 512 } 513 }; 514 } 515 516 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/warn.mjs 517 var warn = createLogOnce("warn", "Base UI"); 518 519 // node_modules/.store/@base-ui/utils@0.5.0--7My7Lubseca8je9LSEweA/node_modules/@base-ui/utils/empty.mjs 520 var EMPTY_ARRAY = Object.freeze([]); 521 var EMPTY_OBJECT = Object.freeze({}); 522 523 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/getStateAttributesProps.mjs 524 function getStateAttributesProps(state, customMapping) { 525 const props = {}; 526 for (const key in state) { 527 const value = state[key]; 528 if (customMapping?.hasOwnProperty(key)) { 529 const customProps = customMapping[key](value); 530 if (customProps != null) { 531 Object.assign(props, customProps); 532 } 533 continue; 534 } 535 if (value === true) { 536 props[`data-$key.toLowerCase()}`] = ""; 537 } else if (value) { 538 props[`data-$key.toLowerCase()}`] = value.toString(); 539 } 540 } 541 return props; 542 } 543 544 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/resolveClassName.mjs 545 function resolveClassName(className, state) { 546 return typeof className === "function" ? className(state) : className; 547 } 548 549 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/utils/resolveStyle.mjs 550 function resolveStyle(style, state) { 551 return typeof style === "function" ? style(state) : style; 552 } 553 554 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/merge-props/mergeProps.mjs 555 var EMPTY_PROPS = {}; 556 function mergeProps(a, b, c, d, e) { 557 if (!c && !d && !e && !a) { 558 return createInitialMergedProps(b); 559 } 560 let merged = createInitialMergedProps(a); 561 if (b) { 562 merged = mergeInto(merged, b); 563 } 564 if (c) { 565 merged = mergeInto(merged, c); 566 } 567 if (d) { 568 merged = mergeInto(merged, d); 569 } 570 if (e) { 571 merged = mergeInto(merged, e); 572 } 573 return merged; 574 } 575 function mergePropsN(props) { 576 if (props.length === 0) { 577 return EMPTY_PROPS; 578 } 579 if (props.length === 1) { 580 return createInitialMergedProps(props[0]); 581 } 582 let merged = createInitialMergedProps(props[0]); 583 for (let i = 1; i < props.length; i += 1) { 584 merged = mergeInto(merged, props[i]); 585 } 586 return merged; 587 } 588 function createInitialMergedProps(inputProps) { 589 if (isPropsGetter(inputProps)) { 590 return { 591 ...inputProps(EMPTY_PROPS) 592 }; 593 } 594 return copyInitialProps(inputProps); 595 } 596 function mergeInto(merged, inputProps) { 597 if (isPropsGetter(inputProps)) { 598 return inputProps(merged); 599 } 600 return mutablyMergeInto(merged, inputProps); 601 } 602 function copyInitialProps(inputProps) { 603 const copiedProps = { 604 ...inputProps 605 }; 606 for (const propName in copiedProps) { 607 const propValue = copiedProps[propName]; 608 if (isEventHandler(propName, propValue)) { 609 copiedProps[propName] = wrapEventHandler(propValue); 610 } 611 } 612 return copiedProps; 613 } 614 function mutablyMergeInto(mergedProps, externalProps) { 615 if (!externalProps) { 616 return mergedProps; 617 } 618 for (const propName in externalProps) { 619 const externalPropValue = externalProps[propName]; 620 switch (propName) { 621 case "style": { 622 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); 623 break; 624 } 625 case "className": { 626 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); 627 break; 628 } 629 default: { 630 if (isEventHandler(propName, externalPropValue)) { 631 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); 632 } else { 633 mergedProps[propName] = externalPropValue; 634 } 635 } 636 } 637 } 638 return mergedProps; 639 } 640 function isEventHandler(key, value) { 641 const code0 = key.charCodeAt(0); 642 const code1 = key.charCodeAt(1); 643 const code2 = key.charCodeAt(2); 644 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); 645 } 646 function isPropsGetter(inputProps) { 647 return typeof inputProps === "function"; 648 } 649 function mergeEventHandlers(ourHandler, theirHandler) { 650 if (!theirHandler) { 651 return ourHandler; 652 } 653 if (!ourHandler) { 654 return wrapEventHandler(theirHandler); 655 } 656 return (...args) => { 657 const event = args[0]; 658 if (isSyntheticEvent(event)) { 659 const baseUIEvent = event; 660 makeEventPreventable(baseUIEvent); 661 const result2 = theirHandler(...args); 662 if (!baseUIEvent.baseUIHandlerPrevented) { 663 ourHandler?.(...args); 664 } 665 return result2; 666 } 667 const result = theirHandler(...args); 668 ourHandler?.(...args); 669 return result; 670 }; 671 } 672 function wrapEventHandler(handler) { 673 if (!handler) { 674 return handler; 675 } 676 return (...args) => { 677 const event = args[0]; 678 if (isSyntheticEvent(event)) { 679 makeEventPreventable(event); 680 } 681 return handler(...args); 682 }; 683 } 684 function makeEventPreventable(event) { 685 event.preventBaseUIHandler = () => { 686 event.baseUIHandlerPrevented = true; 687 }; 688 return event; 689 } 690 function mergeClassNames(ourClassName, theirClassName) { 691 if (theirClassName) { 692 if (ourClassName) { 693 return theirClassName + " " + ourClassName; 694 } 695 return theirClassName; 696 } 697 return ourClassName; 698 } 699 function isSyntheticEvent(event) { 700 return event != null && typeof event === "object" && "nativeEvent" in event; 701 } 702 703 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/internals/useRenderElement.mjs 704 var import_react = __toESM(require_react(), 1); 705 function useRenderElement(element, componentProps, params = {}) { 706 let renderProp = componentProps.render; 707 if (params.enabled !== false) { 708 renderProp = unwrapLazyRenderProp(renderProp); 709 } 710 const outProps = useRenderElementProps(componentProps, params, renderProp); 711 if (params.enabled === false) { 712 return null; 713 } 714 const state = params.state ?? EMPTY_OBJECT; 715 return evaluateRenderProp(element, renderProp, outProps, state); 716 } 717 function useRenderElementProps(componentProps, params, renderProp) { 718 const { 719 className: classNameProp, 720 style: styleProp 721 } = componentProps; 722 const { 723 state = EMPTY_OBJECT, 724 ref, 725 props, 726 stateAttributesMapping, 727 enabled = true 728 } = params; 729 const className = enabled ? resolveClassName(classNameProp, state) : void 0; 730 const style = enabled ? resolveStyle(styleProp, state) : void 0; 731 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT; 732 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; 733 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; 734 if (typeof document !== "undefined") { 735 if (!enabled) { 736 void useMergedRefs(null, null); 737 } else if (Array.isArray(ref)) { 738 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); 739 } else { 740 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); 741 } 742 } 743 if (!enabled) { 744 return EMPTY_OBJECT; 745 } 746 if (className !== void 0) { 747 outProps.className = mergeClassNames(outProps.className, className); 748 } 749 if (style !== void 0) { 750 outProps.style = mergeObjects(outProps.style, style); 751 } 752 return outProps; 753 } 754 function resolveRenderFunctionProps(props) { 755 if (Array.isArray(props)) { 756 return mergePropsN(props); 757 } 758 return mergeProps(void 0, props); 759 } 760 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 761 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; 762 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; 763 function unwrapLazyRenderProp(render) { 764 if (render?.$$typeof !== REACT_LAZY_TYPE) { 765 return render; 766 } 767 const unwrapped = React4.Children.toArray(render)[0]; 768 return /* @__PURE__ */ React4.isValidElement(unwrapped) ? unwrapped : render; 769 } 770 function evaluateRenderProp(element, render, props, state) { 771 if (render) { 772 if (typeof render === "function") { 773 if (true) { 774 warnIfRenderPropLooksLikeComponent(render); 775 } 776 return render(props, state); 777 } 778 const mergedProps = mergeProps(props, render.props); 779 mergedProps.ref = props.ref; 780 if (true) { 781 if (!/* @__PURE__ */ React4.isValidElement(render)) { 782 throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n")); 783 } 784 } 785 return /* @__PURE__ */ React4.cloneElement(render, mergedProps); 786 } 787 return renderTag(element, props); 788 } 789 function warnIfRenderPropLooksLikeComponent(renderFn) { 790 const functionName = renderFn.name; 791 if (functionName.length === 0) { 792 return; 793 } 794 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { 795 return; 796 } 797 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { 798 return; 799 } 800 warn(`The \`render\` prop received a function named \`$functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop"); 801 } 802 function renderTag(Tag, props) { 803 if (Tag === "button") { 804 return /* @__PURE__ */ (0, import_react.createElement)("button", { 805 type: "button", 806 ...props, 807 key: props.key 808 }); 809 } 810 if (Tag === "img") { 811 return /* @__PURE__ */ (0, import_react.createElement)("img", { 812 alt: "", 813 ...props, 814 key: props.key 815 }); 816 } 817 return /* @__PURE__ */ React4.createElement(Tag, props); 818 } 819 820 // node_modules/.store/clsx@2.1.1-XOLP1vUL9vEGfpiXm37fAw/node_modules/clsx/dist/clsx.mjs 821 function r(e) { 822 var t, f, n = ""; 823 if ("string" == typeof e || "number" == typeof e) n += e; 824 else if ("object" == typeof e) if (Array.isArray(e)) { 825 var o = e.length; 826 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); 827 } else for (f in e) e[f] && (n && (n += " "), n += f); 828 return n; 829 } 830 function clsx() { 831 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); 832 return n; 833 } 834 var clsx_default = clsx; 835 836 // node_modules/.store/@base-ui/react@1.9.0-uHNeM94OdjIeOtpyYGvL0A/node_modules/@base-ui/react/use-render/useRender.mjs 837 function useRender(params) { 838 return useRenderElement(params.defaultTagName ?? "div", params, params); 839 } 840 841 // packages/ui/build-module/text/text.mjs 842 var import_element2 = __toESM(require_element(), 1); 843 var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; 844 function getRuntime() { 845 const globalScope = globalThis; 846 if (globalScope.__wpStyleRuntime) { 847 return globalScope.__wpStyleRuntime; 848 } 849 globalScope.__wpStyleRuntime = { 850 documents: /* @__PURE__ */ new Map(), 851 styles: /* @__PURE__ */ new Map(), 852 injectedStyles: /* @__PURE__ */ new WeakMap() 853 }; 854 if (typeof document !== "undefined") { 855 registerDocument(document); 856 } 857 return globalScope.__wpStyleRuntime; 858 } 859 function documentContainsStyleHash(targetDocument, hash) { 860 if (!targetDocument.head) { 861 return false; 862 } 863 for (const style of targetDocument.head.querySelectorAll( 864 `style[$STYLE_HASH_ATTRIBUTE}]` 865 )) { 866 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { 867 return true; 868 } 869 } 870 return false; 871 } 872 function injectStyle(targetDocument, hash, css) { 873 if (!targetDocument.head) { 874 return; 875 } 876 const runtime = getRuntime(); 877 let injectedStyles = runtime.injectedStyles.get(targetDocument); 878 if (!injectedStyles) { 879 injectedStyles = /* @__PURE__ */ new Set(); 880 runtime.injectedStyles.set(targetDocument, injectedStyles); 881 } 882 if (injectedStyles.has(hash)) { 883 return; 884 } 885 if (documentContainsStyleHash(targetDocument, hash)) { 886 injectedStyles.add(hash); 887 return; 888 } 889 const style = targetDocument.createElement("style"); 890 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); 891 style.appendChild(targetDocument.createTextNode(css)); 892 targetDocument.head.appendChild(style); 893 injectedStyles.add(hash); 894 } 895 function registerDocument(targetDocument) { 896 const runtime = getRuntime(); 897 runtime.documents.set( 898 targetDocument, 899 (runtime.documents.get(targetDocument) ?? 0) + 1 900 ); 901 for (const [hash, css] of runtime.styles) { 902 injectStyle(targetDocument, hash, css); 903 } 904 return () => { 905 const count = runtime.documents.get(targetDocument); 906 if (count === void 0) { 907 return; 908 } 909 if (count <= 1) { 910 runtime.documents.delete(targetDocument); 911 return; 912 } 913 runtime.documents.set(targetDocument, count - 1); 914 }; 915 } 916 function registerStyle(hash, css) { 917 const runtime = getRuntime(); 918 runtime.styles.set(hash, css); 919 for (const targetDocument of runtime.documents.keys()) { 920 injectStyle(targetDocument, hash, css); 921 } 922 } 923 if (typeof process === "undefined" || true) { 924 registerStyle("09bae534ff", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._9745ffa515d864cf__text{text-wrap:pretty;margin:0}._8882b6a7feb4fd3d__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._664e3e7687c45603__heading-xl,._8882b6a7feb4fd3d__heading-2xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600)}._664e3e7687c45603__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.dac661a5de0ed2bd__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}._59c7f3f740e2f96e__heading-md,.dac661a5de0ed2bd__heading-lg{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-sm,20px)}._59c7f3f740e2f96e__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.cf052fbad8d93b7e__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._212b9cfef57a0af4__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._07f57bc0aa36b2c6__body-lg,._212b9cfef57a0af4__body-xl{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}._07f57bc0aa36b2c6__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._0c6da4457aec9e62__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0c6da4457aec9e62__body-md,.b998f87ff17b7bec__body-sm{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}.b998f87ff17b7bec__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); 925 } 926 var style_default = { "text": "_9745ffa515d864cf__text", "heading-2xl": "_8882b6a7feb4fd3d__heading-2xl", "heading-xl": "_664e3e7687c45603__heading-xl", "heading-lg": "dac661a5de0ed2bd__heading-lg", "heading-md": "_59c7f3f740e2f96e__heading-md", "heading-sm": "cf052fbad8d93b7e__heading-sm", "body-xl": "_212b9cfef57a0af4__body-xl", "body-lg": "_07f57bc0aa36b2c6__body-lg", "body-md": "_0c6da4457aec9e62__body-md", "body-sm": "b998f87ff17b7bec__body-sm" }; 927 if (typeof process === "undefined" || true) { 928 registerStyle("726f348f3f", "._78c10a0773e51a91__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}._5b33aa2d48624b4f__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._980b3b4776ac8f81__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._43e478b4279a076c__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._698099e25b0fb1a6__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6)._326aee4184d261fd__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}.e9576240835601ba__a,.e9576240835601ba__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}._3f05789653864a73__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._3c72ff72abe57859__li{margin:var(--_gcd-li-margin,0)}[role=treeitem] span._79d16267c15d9eb2__span[aria-hidden]{display:var(--_gcd-span-display,inline);font-family:var(--_gcd-span-font-family,inherit);font-size:var(--_gcd-span-font-size,inherit);line-height:var(--_gcd-span-line-height,1);pointer-events:var(--_gcd-span-pointer-events,auto);position:var(--_gcd-span-position,static)}"); 929 } 930 var global_css_defense_default = { "button": "_78c10a0773e51a91__button", "input": "_5b33aa2d48624b4f__input", "textarea": "_980b3b4776ac8f81__textarea", "div": "_43e478b4279a076c__div", "p": "_698099e25b0fb1a6__p", "heading": "_326aee4184d261fd__heading", "a": "e9576240835601ba__a", "ol": "_3f05789653864a73__ol", "li": "_3c72ff72abe57859__li", "span": "_79d16267c15d9eb2__span" }; 931 var Text = (0, import_element2.forwardRef)( 932 function UnforwardedText({ variant = "body-md", render, className, ...props }, ref) { 933 const element = useRender({ 934 render, 935 defaultTagName: "span", 936 ref, 937 props: mergeProps(props, { 938 className: clsx_default( 939 style_default.text, 940 global_css_defense_default.heading, 941 global_css_defense_default.p, 942 style_default[variant], 943 className 944 ) 945 }) 946 }); 947 return element; 948 } 949 ); 950 951 // packages/icons/build-module/library/check.mjs 952 var import_primitives = __toESM(require_primitives(), 1); 953 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 954 var check_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives.Path, { d: "M7 12L10 15L17 8" }) }); 955 956 // packages/icons/build-module/library/footer.mjs 957 var import_primitives2 = __toESM(require_primitives(), 1); 958 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 959 var footer_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 960 /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives2.Path, { d: "M9.75 4.75H18C18.6904 4.75 19.25 5.30964 19.25 6V14.25M9.75 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V14.25M9.75 4.75V14.25M19.25 14.25V18C19.25 18.6904 18.6904 19.25 18 19.25H6C5.30964 19.25 4.75 18.6904 4.75 18V14.25M19.25 14.25H9.75M9.75 14.25H4.75" }), 961 /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives2.Path, { d: "M19.25 15.5V18C19.25 18.6904 18.6904 19.25 18 19.25H6C5.30964 19.25 4.75 18.6904 4.75 18V15.5C4.75 14.8096 5.30964 14.25 6 14.25H18C18.6904 14.25 19.25 14.8096 19.25 15.5Z", fill: "currentColor" }) 962 ] }); 963 964 // packages/icons/build-module/library/header.mjs 965 var import_primitives3 = __toESM(require_primitives(), 1); 966 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 967 var header_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 968 /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives3.Path, { d: "M9.75 19.25H18C18.6904 19.25 19.25 18.6904 19.25 18V9.75M9.75 19.25H6C5.30964 19.25 4.75 18.6904 4.75 18V9.75M9.75 19.25V9.75M19.25 9.75V6C19.25 5.30964 18.6904 4.75 18 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V9.75M19.25 9.75H9.75M9.75 9.75H4.75" }), 969 /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives3.Path, { d: "M19.25 8.5V6C19.25 5.30964 18.6904 4.75 18 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V8.5C4.75 9.19036 5.30964 9.75 6 9.75H18C18.6904 9.75 19.25 9.19036 19.25 8.5Z", fill: "currentColor" }) 970 ] }); 971 972 // packages/icons/build-module/library/navigation-overlay.mjs 973 var import_primitives4 = __toESM(require_primitives(), 1); 974 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 975 var navigation_overlay_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 976 /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives4.Path, { d: "M4.75 9.25V16C4.75 16.6904 5.30964 17.25 6 17.25H8M4.75 9.25V6C4.75 5.30964 5.30964 4.75 6 4.75H16C16.6904 4.75 17.25 5.30964 17.25 6V8M4.75 9.25H8" }), 977 /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives4.Path, { d: "M10.75 11.25C10.75 10.9739 10.9739 10.75 11.25 10.75H18.75C19.0261 10.75 19.25 10.9739 19.25 11.25V18.75C19.25 19.0261 19.0261 19.25 18.75 19.25H11.25C10.9739 19.25 10.75 19.0261 10.75 18.75V11.25Z", fill: "currentColor" }) 978 ] }); 979 980 // packages/icons/build-module/library/sidebar.mjs 981 var import_primitives5 = __toESM(require_primitives(), 1); 982 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 983 var sidebar_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 984 /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives5.Path, { d: "M9.75 19.25H18C18.6904 19.25 19.25 18.6904 19.25 18V9.75M9.75 19.25H6C5.30964 19.25 4.75 18.6904 4.75 18V9.75M9.75 19.25V9.75M19.25 9.75V6C19.25 5.30964 18.6904 4.75 18 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V9.75M19.25 9.75H9.75M9.75 9.75H4.75" }), 985 /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives5.Path, { d: "M6 19.25H9.75V9.75H4.75V18C4.75 18.6904 5.30964 19.25 6 19.25Z", fill: "currentColor" }) 986 ] }); 987 988 // packages/icons/build-module/library/symbol-filled.mjs 989 var import_primitives6 = __toESM(require_primitives(), 1); 990 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 991 var symbol_filled_default = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 992 /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives6.Path, { d: "M15.2071 6.20711L20.2929 11.2929C20.6834 11.6834 20.6834 12.3166 20.2929 12.7071L15.2071 17.7929C14.8166 18.1834 14.1834 18.1834 13.7929 17.7929L8.70711 12.7071C8.31658 12.3166 8.31658 11.6834 8.70711 11.2929L13.7929 6.20711C14.1834 5.81658 14.8166 5.81658 15.2071 6.20711Z", fill: "currentColor" }), 993 /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives6.Path, { d: "M9.5 5.5L3.70711 11.2929C3.31658 11.6834 3.31658 12.3166 3.70711 12.7071L9.5 18.5" }) 994 ] }); 995 996 // packages/icons/build-module/library/symbol.mjs 997 var import_primitives7 = __toESM(require_primitives(), 1); 998 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 999 var symbol_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 1000 /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives7.Path, { d: "M15.2071 6.20711L20.2929 11.2929C20.6834 11.6834 20.6834 12.3166 20.2929 12.7071L15.2071 17.7929C14.8166 18.1834 14.1834 18.1834 13.7929 17.7929L8.70711 12.7071C8.31658 12.3166 8.31658 11.6834 8.70711 11.2929L13.7929 6.20711C14.1834 5.81658 14.8166 5.81658 15.2071 6.20711Z" }), 1001 /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives7.Path, { d: "M9.5 5.5L3.70711 11.2929C3.31658 11.6834 3.31658 12.3166 3.70711 12.7071L9.5 18.5" }) 1002 ] }); 1003 1004 // packages/ui/build-module/stack/stack.mjs 1005 var import_element3 = __toESM(require_element(), 1); 1006 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; 1007 function getRuntime2() { 1008 const globalScope = globalThis; 1009 if (globalScope.__wpStyleRuntime) { 1010 return globalScope.__wpStyleRuntime; 1011 } 1012 globalScope.__wpStyleRuntime = { 1013 documents: /* @__PURE__ */ new Map(), 1014 styles: /* @__PURE__ */ new Map(), 1015 injectedStyles: /* @__PURE__ */ new WeakMap() 1016 }; 1017 if (typeof document !== "undefined") { 1018 registerDocument2(document); 1019 } 1020 return globalScope.__wpStyleRuntime; 1021 } 1022 function documentContainsStyleHash2(targetDocument, hash) { 1023 if (!targetDocument.head) { 1024 return false; 1025 } 1026 for (const style of targetDocument.head.querySelectorAll( 1027 `style[$STYLE_HASH_ATTRIBUTE2}]` 1028 )) { 1029 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { 1030 return true; 1031 } 1032 } 1033 return false; 1034 } 1035 function injectStyle2(targetDocument, hash, css) { 1036 if (!targetDocument.head) { 1037 return; 1038 } 1039 const runtime = getRuntime2(); 1040 let injectedStyles = runtime.injectedStyles.get(targetDocument); 1041 if (!injectedStyles) { 1042 injectedStyles = /* @__PURE__ */ new Set(); 1043 runtime.injectedStyles.set(targetDocument, injectedStyles); 1044 } 1045 if (injectedStyles.has(hash)) { 1046 return; 1047 } 1048 if (documentContainsStyleHash2(targetDocument, hash)) { 1049 injectedStyles.add(hash); 1050 return; 1051 } 1052 const style = targetDocument.createElement("style"); 1053 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); 1054 style.appendChild(targetDocument.createTextNode(css)); 1055 targetDocument.head.appendChild(style); 1056 injectedStyles.add(hash); 1057 } 1058 function registerDocument2(targetDocument) { 1059 const runtime = getRuntime2(); 1060 runtime.documents.set( 1061 targetDocument, 1062 (runtime.documents.get(targetDocument) ?? 0) + 1 1063 ); 1064 for (const [hash, css] of runtime.styles) { 1065 injectStyle2(targetDocument, hash, css); 1066 } 1067 return () => { 1068 const count = runtime.documents.get(targetDocument); 1069 if (count === void 0) { 1070 return; 1071 } 1072 if (count <= 1) { 1073 runtime.documents.delete(targetDocument); 1074 return; 1075 } 1076 runtime.documents.set(targetDocument, count - 1); 1077 }; 1078 } 1079 function registerStyle2(hash, css) { 1080 const runtime = getRuntime2(); 1081 runtime.styles.set(hash, css); 1082 for (const targetDocument of runtime.documents.keys()) { 1083 injectStyle2(targetDocument, hash, css); 1084 } 1085 } 1086 if (typeof process === "undefined" || true) { 1087 registerStyle2("67591fa198", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._8e8e79c1a2eec43b__stack{display:flex}}}"); 1088 } 1089 var style_default2 = { "stack": "_8e8e79c1a2eec43b__stack" }; 1090 var gapTokens = { 1091 xs: "var(--wpds-dimension-gap-xs, 4px)", 1092 sm: "var(--wpds-dimension-gap-sm, 8px)", 1093 md: "var(--wpds-dimension-gap-md, 12px)", 1094 lg: "var(--wpds-dimension-gap-lg, 16px)", 1095 xl: "var(--wpds-dimension-gap-xl, 24px)", 1096 "2xl": "var(--wpds-dimension-gap-2xl, 32px)", 1097 "3xl": "var(--wpds-dimension-gap-3xl, 40px)" 1098 }; 1099 var Stack = (0, import_element3.forwardRef)( 1100 function UnforwardedStack({ direction, gap, align, justify, wrap, render, ...props }, ref) { 1101 const style = { 1102 gap: gap && gapTokens[gap], 1103 alignItems: align, 1104 justifyContent: justify, 1105 flexDirection: direction, 1106 flexWrap: wrap 1107 }; 1108 const element = useRender({ 1109 render, 1110 ref, 1111 props: mergeProps(props, { 1112 style, 1113 className: style_default2.stack 1114 }) 1115 }); 1116 return element; 1117 } 1118 ); 1119 1120 // packages/patterns/build-module/components/create-pattern-modal.mjs 1121 var import_i18n3 = __toESM(require_i18n(), 1); 1122 var import_element6 = __toESM(require_element(), 1); 1123 var import_data5 = __toESM(require_data(), 1); 1124 var import_notices = __toESM(require_notices(), 1); 1125 var import_core_data3 = __toESM(require_core_data(), 1); 1126 1127 // packages/patterns/build-module/components/category-selector.mjs 1128 var import_i18n2 = __toESM(require_i18n(), 1); 1129 var import_element4 = __toESM(require_element(), 1); 1130 var import_components2 = __toESM(require_components(), 1); 1131 var import_compose = __toESM(require_compose(), 1); 1132 var import_html_entities = __toESM(require_html_entities(), 1); 1133 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 1134 var unescapeString = (arg) => { 1135 return (0, import_html_entities.decodeEntities)(arg); 1136 }; 1137 var CATEGORY_SLUG = "wp_pattern_category"; 1138 function CategorySelector({ 1139 categoryTerms, 1140 onChange, 1141 categoryMap 1142 }) { 1143 const [search, setSearch] = (0, import_element4.useState)(""); 1144 const debouncedSearch = (0, import_compose.useDebounce)(setSearch, 500); 1145 const suggestions = (0, import_element4.useMemo)(() => { 1146 return Array.from(categoryMap.values()).map((category) => unescapeString(category.label)).filter((category) => { 1147 if (search !== "") { 1148 return category.toLowerCase().includes(search.toLowerCase()); 1149 } 1150 return true; 1151 }).sort((a, b) => a.localeCompare(b)); 1152 }, [search, categoryMap]); 1153 function handleChange(termNames) { 1154 const uniqueTerms = termNames.reduce((terms, newTerm) => { 1155 if (!terms.some( 1156 (term) => term.toLowerCase() === newTerm.toLowerCase() 1157 )) { 1158 terms.push(newTerm); 1159 } 1160 return terms; 1161 }, []); 1162 onChange(uniqueTerms); 1163 } 1164 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( 1165 import_components2.FormTokenField, 1166 { 1167 className: "patterns-menu-items__convert-modal-categories", 1168 value: categoryTerms, 1169 suggestions, 1170 onChange: handleChange, 1171 onInputChange: debouncedSearch, 1172 label: (0, import_i18n2.__)("Categories"), 1173 tokenizeOnBlur: true, 1174 __experimentalExpandOnFocus: true 1175 } 1176 ); 1177 } 1178 1179 // packages/patterns/build-module/private-hooks.mjs 1180 var import_data4 = __toESM(require_data(), 1); 1181 var import_core_data2 = __toESM(require_core_data(), 1); 1182 var import_element5 = __toESM(require_element(), 1); 1183 function useAddPatternCategory() { 1184 const { saveEntityRecord, invalidateResolution } = (0, import_data4.useDispatch)(import_core_data2.store); 1185 const { corePatternCategories, userPatternCategories } = (0, import_data4.useSelect)( 1186 (select) => { 1187 const { getUserPatternCategories, getBlockPatternCategories } = select(import_core_data2.store); 1188 return { 1189 corePatternCategories: getBlockPatternCategories(), 1190 userPatternCategories: getUserPatternCategories() 1191 }; 1192 }, 1193 [] 1194 ); 1195 const categoryMap = (0, import_element5.useMemo)(() => { 1196 const uniqueCategories = /* @__PURE__ */ new Map(); 1197 userPatternCategories.forEach((category) => { 1198 uniqueCategories.set(category.label.toLowerCase(), { 1199 label: category.label, 1200 name: category.name, 1201 id: category.id 1202 }); 1203 }); 1204 corePatternCategories.forEach((category) => { 1205 if (!uniqueCategories.has(category.label.toLowerCase()) && // There are two core categories with `Post` label so explicitly remove the one with 1206 // the `query` slug to avoid any confusion. 1207 category.name !== "query") { 1208 uniqueCategories.set(category.label.toLowerCase(), { 1209 label: category.label, 1210 name: category.name 1211 }); 1212 } 1213 }); 1214 return uniqueCategories; 1215 }, [userPatternCategories, corePatternCategories]); 1216 async function findOrCreateTerm(term) { 1217 try { 1218 const existingTerm = categoryMap.get(term.toLowerCase()); 1219 if (existingTerm?.id) { 1220 return existingTerm.id; 1221 } 1222 const termData = existingTerm ? { name: existingTerm.label, slug: existingTerm.name } : { name: term }; 1223 const newTerm = await saveEntityRecord( 1224 "taxonomy", 1225 CATEGORY_SLUG, 1226 termData, 1227 { throwOnError: true } 1228 ); 1229 invalidateResolution("getUserPatternCategories"); 1230 return newTerm.id; 1231 } catch (error) { 1232 if (error.code !== "term_exists") { 1233 throw error; 1234 } 1235 return error.data.term_id; 1236 } 1237 } 1238 return { categoryMap, findOrCreateTerm }; 1239 } 1240 1241 // packages/patterns/build-module/components/create-pattern-modal.mjs 1242 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 1243 function CreatePatternModal({ 1244 className = "patterns-menu-items__convert-modal", 1245 modalTitle, 1246 ...restProps 1247 }) { 1248 const defaultModalTitle = (0, import_data5.useSelect)( 1249 (select) => select(import_core_data3.store).getPostType(PATTERN_TYPES.user)?.labels?.add_new_item, 1250 [] 1251 ); 1252 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 1253 import_components3.Modal, 1254 { 1255 title: modalTitle || defaultModalTitle, 1256 onRequestClose: restProps.onClose, 1257 overlayClassName: className, 1258 focusOnMount: "firstContentElement", 1259 size: "small", 1260 children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CreatePatternModalContents, { ...restProps }) 1261 } 1262 ); 1263 } 1264 function CreatePatternModalContents({ 1265 confirmLabel = (0, import_i18n3.__)("Add"), 1266 defaultCategories = [], 1267 content, 1268 onClose, 1269 onError, 1270 onSuccess, 1271 defaultSyncType = PATTERN_SYNC_TYPES.full, 1272 defaultTitle = "" 1273 }) { 1274 const [syncType, setSyncType] = (0, import_element6.useState)(defaultSyncType); 1275 const [categoryTerms, setCategoryTerms] = (0, import_element6.useState)(defaultCategories); 1276 const [title, setTitle] = (0, import_element6.useState)(defaultTitle); 1277 const [isSaving, setIsSaving] = (0, import_element6.useState)(false); 1278 const { createPattern: createPattern2 } = unlock((0, import_data5.useDispatch)(store)); 1279 const { createErrorNotice } = (0, import_data5.useDispatch)(import_notices.store); 1280 const { categoryMap, findOrCreateTerm } = useAddPatternCategory(); 1281 async function onCreate(patternTitle, sync) { 1282 if (!title || isSaving) { 1283 return; 1284 } 1285 try { 1286 setIsSaving(true); 1287 const categories = await Promise.all( 1288 categoryTerms.map( 1289 (termName) => findOrCreateTerm(termName) 1290 ) 1291 ); 1292 const newPattern = await createPattern2( 1293 patternTitle, 1294 sync, 1295 typeof content === "function" ? content() : content, 1296 categories 1297 ); 1298 onSuccess({ 1299 pattern: newPattern, 1300 categoryId: PATTERN_DEFAULT_CATEGORY 1301 }); 1302 } catch (error) { 1303 createErrorNotice(error.message, { 1304 type: "snackbar", 1305 id: "pattern-create" 1306 }); 1307 onError?.(); 1308 } finally { 1309 setIsSaving(false); 1310 setCategoryTerms([]); 1311 setTitle(""); 1312 } 1313 } 1314 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 1315 "form", 1316 { 1317 onSubmit: (event) => { 1318 event.preventDefault(); 1319 onCreate(title, syncType); 1320 }, 1321 children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 1322 /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 1323 import_components3.TextControl, 1324 { 1325 label: (0, import_i18n3.__)("Name"), 1326 value: title, 1327 onChange: setTitle, 1328 placeholder: (0, import_i18n3.__)("My pattern"), 1329 className: "patterns-create-modal__name-input" 1330 } 1331 ), 1332 /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 1333 CategorySelector, 1334 { 1335 categoryTerms, 1336 onChange: setCategoryTerms, 1337 categoryMap 1338 } 1339 ), 1340 /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 1341 import_components3.ToggleControl, 1342 { 1343 label: (0, import_i18n3._x)("Synced", "pattern (singular)"), 1344 help: (0, import_i18n3.__)( 1345 "Sync this pattern across multiple locations." 1346 ), 1347 checked: syncType === PATTERN_SYNC_TYPES.full, 1348 onChange: () => { 1349 setSyncType( 1350 syncType === PATTERN_SYNC_TYPES.full ? PATTERN_SYNC_TYPES.unsynced : PATTERN_SYNC_TYPES.full 1351 ); 1352 } 1353 } 1354 ), 1355 /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Stack, { gap: "sm", justify: "end", children: [ 1356 /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 1357 import_components3.Button, 1358 { 1359 __next40pxDefaultSize: true, 1360 variant: "tertiary", 1361 onClick: () => { 1362 onClose(); 1363 setTitle(""); 1364 }, 1365 children: (0, import_i18n3.__)("Cancel") 1366 } 1367 ), 1368 /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 1369 import_components3.Button, 1370 { 1371 __next40pxDefaultSize: true, 1372 variant: "primary", 1373 type: "submit", 1374 "aria-disabled": !title || isSaving, 1375 isBusy: isSaving, 1376 children: confirmLabel 1377 } 1378 ) 1379 ] }) 1380 ] }) 1381 } 1382 ); 1383 } 1384 1385 // packages/patterns/build-module/components/duplicate-pattern-modal.mjs 1386 var import_core_data4 = __toESM(require_core_data(), 1); 1387 var import_data6 = __toESM(require_data(), 1); 1388 var import_i18n4 = __toESM(require_i18n(), 1); 1389 var import_notices2 = __toESM(require_notices(), 1); 1390 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); 1391 function getTermLabels(pattern, categories) { 1392 if (pattern.type !== PATTERN_TYPES.user) { 1393 return categories.core?.filter( 1394 (category) => pattern.categories?.includes(category.name) 1395 ).map((category) => category.label); 1396 } 1397 return categories.user?.filter( 1398 (category) => pattern.wp_pattern_category?.includes(category.id) 1399 ).map((category) => category.label); 1400 } 1401 function useDuplicatePatternProps({ pattern, onSuccess }) { 1402 const { createSuccessNotice } = (0, import_data6.useDispatch)(import_notices2.store); 1403 const categories = (0, import_data6.useSelect)((select) => { 1404 const { getUserPatternCategories, getBlockPatternCategories } = select(import_core_data4.store); 1405 return { 1406 core: getBlockPatternCategories(), 1407 user: getUserPatternCategories() 1408 }; 1409 }); 1410 if (!pattern) { 1411 return null; 1412 } 1413 return { 1414 content: pattern.content, 1415 defaultCategories: getTermLabels(pattern, categories), 1416 defaultSyncType: pattern.type !== PATTERN_TYPES.user ? PATTERN_SYNC_TYPES.unsynced : pattern.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full, 1417 defaultTitle: (0, import_i18n4.sprintf)( 1418 /* translators: %s: Existing pattern title */ 1419 (0, import_i18n4._x)("%s (Copy)", "pattern"), 1420 typeof pattern.title === "string" ? pattern.title : pattern.title.raw 1421 ), 1422 onSuccess: ({ pattern: newPattern }) => { 1423 createSuccessNotice( 1424 (0, import_i18n4.sprintf)( 1425 // translators: %s: The new pattern's title e.g. 'Call to action (copy)'. 1426 (0, import_i18n4._x)('"%s" duplicated.', "pattern"), 1427 newPattern.title.raw 1428 ), 1429 { 1430 type: "snackbar", 1431 id: "patterns-create" 1432 } 1433 ); 1434 onSuccess?.({ pattern: newPattern }); 1435 } 1436 }; 1437 } 1438 function DuplicatePatternModal({ 1439 pattern, 1440 onClose, 1441 onSuccess 1442 }) { 1443 const duplicatedProps = useDuplicatePatternProps({ pattern, onSuccess }); 1444 if (!pattern) { 1445 return null; 1446 } 1447 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( 1448 CreatePatternModal, 1449 { 1450 modalTitle: (0, import_i18n4.__)("Duplicate pattern"), 1451 confirmLabel: (0, import_i18n4.__)("Duplicate"), 1452 onClose, 1453 onError: onClose, 1454 ...duplicatedProps 1455 } 1456 ); 1457 } 1458 1459 // packages/patterns/build-module/components/create-template-part-modal/index.mjs 1460 var import_components4 = __toESM(require_components(), 1); 1461 var import_compose2 = __toESM(require_compose(), 1); 1462 var import_core_data6 = __toESM(require_core_data(), 1); 1463 var import_data8 = __toESM(require_data(), 1); 1464 var import_element7 = __toESM(require_element(), 1); 1465 var import_i18n5 = __toESM(require_i18n(), 1); 1466 var import_notices3 = __toESM(require_notices(), 1); 1467 var import_blocks2 = __toESM(require_blocks(), 1); 1468 1469 // node_modules/.store/tslib@2.8.1-LT-dxu1EkVy7OUDyVf5glQ/node_modules/tslib/tslib.es6.mjs 1470 var __assign = function() { 1471 __assign = Object.assign || function __assign2(t) { 1472 for (var s, i = 1, n = arguments.length; i < n; i++) { 1473 s = arguments[i]; 1474 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 1475 } 1476 return t; 1477 }; 1478 return __assign.apply(this, arguments); 1479 }; 1480 1481 // node_modules/.store/lower-case@2.0.2-5YZP5nczP5_f_8Vt5KBPjA/node_modules/lower-case/dist.es2015/index.js 1482 function lowerCase(str) { 1483 return str.toLowerCase(); 1484 } 1485 1486 // node_modules/.store/no-case@3.0.4-R4Hzt6qn-erEsTak7ojDpg/node_modules/no-case/dist.es2015/index.js 1487 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; 1488 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; 1489 function noCase(input, options) { 1490 if (options === void 0) { 1491 options = {}; 1492 } 1493 var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; 1494 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); 1495 var start = 0; 1496 var end = result.length; 1497 while (result.charAt(start) === "\0") 1498 start++; 1499 while (result.charAt(end - 1) === "\0") 1500 end--; 1501 return result.slice(start, end).split("\0").map(transform).join(delimiter); 1502 } 1503 function replace(input, re, value) { 1504 if (re instanceof RegExp) 1505 return input.replace(re, value); 1506 return re.reduce(function(input2, re2) { 1507 return input2.replace(re2, value); 1508 }, input); 1509 } 1510 1511 // node_modules/.store/dot-case@3.0.4-hi-rLWlWmiZ169n4dWcbUA/node_modules/dot-case/dist.es2015/index.js 1512 function dotCase(input, options) { 1513 if (options === void 0) { 1514 options = {}; 1515 } 1516 return noCase(input, __assign({ delimiter: "." }, options)); 1517 } 1518 1519 // node_modules/.store/param-case@3.0.4-rdAht_VwpGpefPRylN2bTA/node_modules/param-case/dist.es2015/index.js 1520 function paramCase(input, options) { 1521 if (options === void 0) { 1522 options = {}; 1523 } 1524 return dotCase(input, __assign({ delimiter: "-" }, options)); 1525 } 1526 1527 // packages/patterns/build-module/components/create-template-part-modal/utils.mjs 1528 var import_data7 = __toESM(require_data(), 1); 1529 var import_core_data5 = __toESM(require_core_data(), 1); 1530 var EMPTY_ARRAY2 = []; 1531 function useExistingTemplateParts() { 1532 return (0, import_data7.useSelect)( 1533 (select) => select(import_core_data5.store).getEntityRecords( 1534 "postType", 1535 "wp_template_part", 1536 { per_page: -1 } 1537 ) ?? EMPTY_ARRAY2, 1538 [] 1539 ); 1540 } 1541 function getUniqueTemplatePartTitle(title, templateParts) { 1542 const lowercaseTitle = title.toLowerCase(); 1543 const existingTitles = templateParts.map( 1544 (templatePart) => templatePart.title.rendered.toLowerCase() 1545 ); 1546 if (!existingTitles.includes(lowercaseTitle)) { 1547 return title; 1548 } 1549 let suffix = 2; 1550 while (existingTitles.includes(`$lowercaseTitle} $suffix}`)) { 1551 suffix++; 1552 } 1553 return `$title} $suffix}`; 1554 } 1555 function getCleanTemplatePartSlug(title) { 1556 return paramCase(title).replace(/[^\w-]+/g, "") || "wp-custom-part"; 1557 } 1558 1559 // packages/patterns/build-module/components/create-template-part-modal/index.mjs 1560 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); 1561 function getAreaRadioId(value, instanceId) { 1562 return `patterns-create-template-part-modal__area-option-$value}-$instanceId}`; 1563 } 1564 function getAreaRadioDescriptionId(value, instanceId) { 1565 return `patterns-create-template-part-modal__area-option-description-$value}-$instanceId}`; 1566 } 1567 function CreateTemplatePartModal({ 1568 modalTitle, 1569 ...restProps 1570 }) { 1571 const defaultModalTitle = (0, import_data8.useSelect)( 1572 (select) => select(import_core_data6.store).getPostType("wp_template_part")?.labels?.add_new_item, 1573 [] 1574 ); 1575 return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1576 import_components4.Modal, 1577 { 1578 title: modalTitle || defaultModalTitle, 1579 onRequestClose: restProps.closeModal, 1580 overlayClassName: "patterns-create-template-part-modal", 1581 focusOnMount: "firstContentElement", 1582 size: "medium", 1583 children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CreateTemplatePartModalContents, { ...restProps }) 1584 } 1585 ); 1586 } 1587 var getTemplatePartIcon = (areaOrIconName) => { 1588 if ("header" === areaOrIconName) { 1589 return header_default; 1590 } else if ("footer" === areaOrIconName) { 1591 return footer_default; 1592 } else if ("sidebar" === areaOrIconName) { 1593 return sidebar_default; 1594 } else if ("navigation-overlay" === areaOrIconName) { 1595 return navigation_overlay_default; 1596 } 1597 return symbol_filled_default; 1598 }; 1599 function CreateTemplatePartModalContents({ 1600 defaultArea = "uncategorized", 1601 blocks = [], 1602 confirmLabel = (0, import_i18n5.__)("Add"), 1603 closeModal, 1604 onCreate, 1605 onError, 1606 defaultTitle = "" 1607 }) { 1608 const { createErrorNotice } = (0, import_data8.useDispatch)(import_notices3.store); 1609 const { saveEntityRecord } = (0, import_data8.useDispatch)(import_core_data6.store); 1610 const existingTemplateParts = useExistingTemplateParts(); 1611 const [title, setTitle] = (0, import_element7.useState)(defaultTitle); 1612 const [area, setArea] = (0, import_element7.useState)(defaultArea); 1613 const [isSubmitting, setIsSubmitting] = (0, import_element7.useState)(false); 1614 const instanceId = (0, import_compose2.useInstanceId)(CreateTemplatePartModal); 1615 const defaultTemplatePartAreas = (0, import_data8.useSelect)( 1616 (select) => select(import_core_data6.store).getCurrentTheme()?.default_template_part_areas, 1617 [] 1618 ); 1619 async function createTemplatePart() { 1620 if (!title || isSubmitting) { 1621 return; 1622 } 1623 try { 1624 setIsSubmitting(true); 1625 const uniqueTitle = getUniqueTemplatePartTitle( 1626 title, 1627 existingTemplateParts 1628 ); 1629 const cleanSlug = getCleanTemplatePartSlug(uniqueTitle); 1630 const templatePart = await saveEntityRecord( 1631 "postType", 1632 "wp_template_part", 1633 { 1634 slug: cleanSlug, 1635 title: uniqueTitle, 1636 content: (0, import_blocks2.serialize)(blocks), 1637 area 1638 }, 1639 { throwOnError: true } 1640 ); 1641 await onCreate(templatePart); 1642 } catch (error) { 1643 const errorMessage = error instanceof Error && "code" in error && error.message && error.code !== "unknown_error" ? error.message : (0, import_i18n5.__)( 1644 "An error occurred while creating the template part." 1645 ); 1646 createErrorNotice(errorMessage, { type: "snackbar" }); 1647 onError?.(); 1648 } finally { 1649 setIsSubmitting(false); 1650 } 1651 } 1652 return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1653 "form", 1654 { 1655 onSubmit: async (event) => { 1656 event.preventDefault(); 1657 await createTemplatePart(); 1658 }, 1659 children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_components4.__experimentalVStack, { spacing: "4", children: [ 1660 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1661 import_components4.TextControl, 1662 { 1663 label: (0, import_i18n5.__)("Name"), 1664 value: title, 1665 onChange: setTitle, 1666 required: true 1667 } 1668 ), 1669 /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("fieldset", { className: "patterns-create-template-part-modal__area-fieldset", children: [ 1670 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_components4.BaseControl.VisualLabel, { as: "legend", children: (0, import_i18n5.__)("Area") }), 1671 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "patterns-create-template-part-modal__area-radio-group", children: (defaultTemplatePartAreas ?? []).map( 1672 (item) => { 1673 const icon = getTemplatePartIcon(item.icon); 1674 return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)( 1675 "div", 1676 { 1677 className: "patterns-create-template-part-modal__area-radio-wrapper", 1678 children: [ 1679 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1680 "input", 1681 { 1682 type: "radio", 1683 id: getAreaRadioId( 1684 item.area, 1685 instanceId 1686 ), 1687 name: `patterns-create-template-part-modal__area-$instanceId}`, 1688 value: item.area, 1689 checked: area === item.area, 1690 onChange: () => { 1691 setArea(item.area); 1692 }, 1693 "aria-describedby": getAreaRadioDescriptionId( 1694 item.area, 1695 instanceId 1696 ) 1697 } 1698 ), 1699 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1700 import_components4.Icon, 1701 { 1702 icon, 1703 className: "patterns-create-template-part-modal__area-radio-icon" 1704 } 1705 ), 1706 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1707 "label", 1708 { 1709 htmlFor: getAreaRadioId( 1710 item.area, 1711 instanceId 1712 ), 1713 className: "patterns-create-template-part-modal__area-radio-label", 1714 children: item.label 1715 } 1716 ), 1717 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1718 import_components4.Icon, 1719 { 1720 icon: check_default, 1721 className: "patterns-create-template-part-modal__area-radio-checkmark" 1722 } 1723 ), 1724 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1725 "p", 1726 { 1727 className: "patterns-create-template-part-modal__area-radio-description", 1728 id: getAreaRadioDescriptionId( 1729 item.area, 1730 instanceId 1731 ), 1732 children: item.description 1733 } 1734 ) 1735 ] 1736 }, 1737 item.area 1738 ); 1739 } 1740 ) }) 1741 ] }), 1742 /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_components4.__experimentalHStack, { justify: "right", children: [ 1743 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1744 import_components4.Button, 1745 { 1746 __next40pxDefaultSize: true, 1747 variant: "tertiary", 1748 onClick: () => { 1749 closeModal(); 1750 }, 1751 children: (0, import_i18n5.__)("Cancel") 1752 } 1753 ), 1754 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1755 import_components4.Button, 1756 { 1757 __next40pxDefaultSize: true, 1758 variant: "primary", 1759 type: "submit", 1760 "aria-disabled": !title || isSubmitting, 1761 isBusy: isSubmitting, 1762 children: confirmLabel 1763 } 1764 ) 1765 ] }) 1766 ] }) 1767 } 1768 ); 1769 } 1770 1771 // packages/patterns/build-module/components/rename-pattern-modal.mjs 1772 var import_components5 = __toESM(require_components(), 1); 1773 var import_core_data7 = __toESM(require_core_data(), 1); 1774 var import_data9 = __toESM(require_data(), 1); 1775 var import_element8 = __toESM(require_element(), 1); 1776 var import_html_entities2 = __toESM(require_html_entities(), 1); 1777 var import_i18n6 = __toESM(require_i18n(), 1); 1778 var import_notices4 = __toESM(require_notices(), 1); 1779 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); 1780 function RenamePatternModal({ 1781 onClose, 1782 onError, 1783 onSuccess, 1784 pattern, 1785 ...props 1786 }) { 1787 const originalName = (0, import_html_entities2.decodeEntities)(pattern.title); 1788 const [name, setName] = (0, import_element8.useState)(originalName); 1789 const [isSaving, setIsSaving] = (0, import_element8.useState)(false); 1790 const { 1791 editEntityRecord, 1792 __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits 1793 } = (0, import_data9.useDispatch)(import_core_data7.store); 1794 const { createSuccessNotice, createErrorNotice } = (0, import_data9.useDispatch)(import_notices4.store); 1795 const onRename = async (event) => { 1796 event.preventDefault(); 1797 if (!name || name === pattern.title || isSaving) { 1798 return; 1799 } 1800 try { 1801 await editEntityRecord("postType", pattern.type, pattern.id, { 1802 title: name 1803 }); 1804 setIsSaving(true); 1805 setName(""); 1806 onClose?.(); 1807 const savedRecord = await saveSpecifiedEntityEdits( 1808 "postType", 1809 pattern.type, 1810 pattern.id, 1811 ["title"], 1812 { throwOnError: true } 1813 ); 1814 onSuccess?.(savedRecord); 1815 createSuccessNotice((0, import_i18n6.__)("Pattern renamed"), { 1816 type: "snackbar", 1817 id: "pattern-update" 1818 }); 1819 } catch (error) { 1820 onError?.(); 1821 const errorMessage = error.message && error.code !== "unknown_error" ? error.message : (0, import_i18n6.__)("An error occurred while renaming the pattern."); 1822 createErrorNotice(errorMessage, { 1823 type: "snackbar", 1824 id: "pattern-update" 1825 }); 1826 } finally { 1827 setIsSaving(false); 1828 setName(""); 1829 } 1830 }; 1831 const onRequestClose = () => { 1832 onClose?.(); 1833 setName(""); 1834 }; 1835 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 1836 import_components5.Modal, 1837 { 1838 title: (0, import_i18n6.__)("Rename"), 1839 ...props, 1840 onRequestClose: onClose, 1841 focusOnMount: "firstContentElement", 1842 size: "small", 1843 children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("form", { onSubmit: onRename, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 1844 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 1845 import_components5.TextControl, 1846 { 1847 label: (0, import_i18n6.__)("Name"), 1848 value: name, 1849 onChange: setName, 1850 required: true 1851 } 1852 ), 1853 /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Stack, { gap: "sm", justify: "end", children: [ 1854 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 1855 import_components5.Button, 1856 { 1857 __next40pxDefaultSize: true, 1858 variant: "tertiary", 1859 onClick: onRequestClose, 1860 children: (0, import_i18n6.__)("Cancel") 1861 } 1862 ), 1863 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 1864 import_components5.Button, 1865 { 1866 __next40pxDefaultSize: true, 1867 variant: "primary", 1868 type: "submit", 1869 children: (0, import_i18n6.__)("Save") 1870 } 1871 ) 1872 ] }) 1873 ] }) }) 1874 } 1875 ); 1876 } 1877 1878 // packages/patterns/build-module/components/index.mjs 1879 var import_block_editor5 = __toESM(require_block_editor(), 1); 1880 1881 // packages/patterns/build-module/components/pattern-convert-button.mjs 1882 var import_blocks3 = __toESM(require_blocks(), 1); 1883 var import_block_editor3 = __toESM(require_block_editor(), 1); 1884 var import_element9 = __toESM(require_element(), 1); 1885 var import_components6 = __toESM(require_components(), 1); 1886 var import_data10 = __toESM(require_data(), 1); 1887 var import_core_data8 = __toESM(require_core_data(), 1); 1888 var import_i18n7 = __toESM(require_i18n(), 1); 1889 var import_notices5 = __toESM(require_notices(), 1); 1890 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); 1891 function PatternConvertButton({ 1892 clientIds, 1893 rootClientId, 1894 closeBlockSettingsMenu 1895 }) { 1896 const { createSuccessNotice } = (0, import_data10.useDispatch)(import_notices5.store); 1897 const { replaceBlocks, updateBlockAttributes } = (0, import_data10.useDispatch)(import_block_editor3.store); 1898 const { setEditingPattern: setEditingPattern2 } = unlock((0, import_data10.useDispatch)(store)); 1899 const [isModalOpen, setIsModalOpen] = (0, import_element9.useState)(false); 1900 const { getBlockAttributes } = (0, import_data10.useSelect)(import_block_editor3.store); 1901 const canConvert = (0, import_data10.useSelect)( 1902 (select) => { 1903 const { canUser } = select(import_core_data8.store); 1904 const { 1905 getBlocksByClientId: getBlocksByClientId2, 1906 canInsertBlockType, 1907 getBlockRootClientId 1908 } = select(import_block_editor3.store); 1909 const rootId = rootClientId || (clientIds.length > 0 ? getBlockRootClientId(clientIds[0]) : void 0); 1910 const blocks = getBlocksByClientId2(clientIds) ?? []; 1911 const hasReusableBlockSupport = (blockName) => { 1912 const blockType = (0, import_blocks3.getBlockType)(blockName); 1913 const hasParent = blockType && "parent" in blockType; 1914 return (0, import_blocks3.hasBlockSupport)(blockName, "reusable", !hasParent); 1915 }; 1916 const isSyncedPattern = blocks.length === 1 && blocks[0] && (0, import_blocks3.isReusableBlock)(blocks[0]) && !!select(import_core_data8.store).getEntityRecord( 1917 "postType", 1918 "wp_block", 1919 blocks[0].attributes.ref 1920 ); 1921 const isUnsyncedPattern = blocks.length === 1 && blocks?.[0]?.attributes?.metadata?.patternName; 1922 const _canConvert = ( 1923 // Hide when this is already a pattern. 1924 !isUnsyncedPattern && !isSyncedPattern && // Hide when patterns are disabled. 1925 canInsertBlockType("core/block", rootId) && blocks.every( 1926 (block) => ( 1927 // Guard against the case where a regular block has *just* been converted. 1928 !!block && // Hide on invalid blocks. 1929 block.isValid && // Hide when block doesn't support being made into a pattern. 1930 hasReusableBlockSupport(block.name) 1931 ) 1932 ) && // Hide when current doesn't have permission to do that. 1933 // Blocks refers to the wp_block post type, this checks the ability to create a post of that type. 1934 !!canUser("create", { 1935 kind: "postType", 1936 name: "wp_block" 1937 }) 1938 ); 1939 return _canConvert; 1940 }, 1941 [clientIds, rootClientId] 1942 ); 1943 const { getBlocksByClientId } = (0, import_data10.useSelect)(import_block_editor3.store); 1944 const getContent = (0, import_element9.useCallback)( 1945 () => (0, import_blocks3.serialize)(getBlocksByClientId(clientIds)), 1946 [getBlocksByClientId, clientIds] 1947 ); 1948 if (!canConvert) { 1949 return null; 1950 } 1951 const handleSuccess = ({ pattern }) => { 1952 if (pattern.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced) { 1953 if (clientIds?.length === 1) { 1954 const existingAttributes = getBlockAttributes(clientIds[0]); 1955 updateBlockAttributes(clientIds[0], { 1956 metadata: { 1957 ...existingAttributes?.metadata ? existingAttributes.metadata : {}, 1958 patternName: `core/block/$pattern.id}`, 1959 name: pattern.title.raw 1960 } 1961 }); 1962 } 1963 } else { 1964 const newBlock = (0, import_blocks3.createBlock)("core/block", { 1965 ref: pattern.id 1966 }); 1967 replaceBlocks(clientIds, newBlock); 1968 setEditingPattern2(newBlock.clientId, true); 1969 } 1970 createSuccessNotice( 1971 pattern.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced ? (0, import_i18n7.sprintf)( 1972 // translators: %s: the name the user has given to the pattern. 1973 (0, import_i18n7.__)("Unsynced pattern created: %s"), 1974 pattern.title.raw 1975 ) : (0, import_i18n7.sprintf)( 1976 // translators: %s: the name the user has given to the pattern. 1977 (0, import_i18n7.__)("Synced pattern created: %s"), 1978 pattern.title.raw 1979 ), 1980 { 1981 type: "snackbar", 1982 id: "convert-to-pattern-success" 1983 } 1984 ); 1985 setIsModalOpen(false); 1986 closeBlockSettingsMenu(); 1987 }; 1988 return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [ 1989 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( 1990 import_components6.MenuItem, 1991 { 1992 icon: symbol_default, 1993 onClick: () => setIsModalOpen(true), 1994 "aria-expanded": isModalOpen, 1995 "aria-haspopup": "dialog", 1996 children: (0, import_i18n7.__)("Create pattern") 1997 } 1998 ), 1999 isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( 2000 CreatePatternModal, 2001 { 2002 content: getContent, 2003 onSuccess: (pattern) => { 2004 handleSuccess(pattern); 2005 }, 2006 onError: () => { 2007 setIsModalOpen(false); 2008 }, 2009 onClose: () => { 2010 setIsModalOpen(false); 2011 } 2012 } 2013 ) 2014 ] }); 2015 } 2016 2017 // packages/patterns/build-module/components/patterns-manage-button.mjs 2018 var import_components7 = __toESM(require_components(), 1); 2019 var import_i18n8 = __toESM(require_i18n(), 1); 2020 var import_blocks4 = __toESM(require_blocks(), 1); 2021 var import_data11 = __toESM(require_data(), 1); 2022 var import_element10 = __toESM(require_element(), 1); 2023 var import_block_editor4 = __toESM(require_block_editor(), 1); 2024 var import_url = __toESM(require_url(), 1); 2025 var import_core_data9 = __toESM(require_core_data(), 1); 2026 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); 2027 function PatternsManageButton({ clientId, onClose }) { 2028 const [showConfirmDialog, setShowConfirmDialog] = (0, import_element10.useState)(false); 2029 const { 2030 attributes, 2031 canDetach, 2032 isVisible, 2033 managePatternsUrl, 2034 isSyncedPattern, 2035 isUnsyncedPattern, 2036 canEdit 2037 } = (0, import_data11.useSelect)( 2038 (select) => { 2039 const { canRemoveBlock, getBlock, canEditBlock } = select(import_block_editor4.store); 2040 const { canUser } = select(import_core_data9.store); 2041 const block = getBlock(clientId); 2042 const _isUnsyncedPattern = !!block?.attributes?.metadata?.patternName; 2043 const _isSyncedPattern = !!block && (0, import_blocks4.isReusableBlock)(block) && !!canUser("read", { 2044 kind: "postType", 2045 name: "wp_block", 2046 id: block.attributes.ref 2047 }); 2048 return { 2049 attributes: block.attributes, 2050 canEdit: canEditBlock(clientId), 2051 // For unsynced patterns, detaching is simply removing the `patternName` attribute. 2052 // For synced patterns, the `core:block` block is replaced with its inner blocks, 2053 // so checking whether `canRemoveBlock` is possible is required. 2054 canDetach: _isUnsyncedPattern || _isSyncedPattern && canRemoveBlock(clientId), 2055 isUnsyncedPattern: _isUnsyncedPattern, 2056 isSyncedPattern: _isSyncedPattern, 2057 isVisible: _isUnsyncedPattern || _isSyncedPattern, 2058 // The site editor and templates both check whether the user 2059 // has edit_theme_options capabilities. We can leverage that here 2060 // and omit the manage patterns link if the user can't access it. 2061 managePatternsUrl: canUser("create", { 2062 kind: "postType", 2063 name: "wp_template" 2064 }) ? (0, import_url.addQueryArgs)("site-editor.php", { 2065 p: "/pattern" 2066 }) : (0, import_url.addQueryArgs)("edit.php", { 2067 post_type: "wp_block" 2068 }) 2069 }; 2070 }, 2071 [clientId] 2072 ); 2073 const { updateBlockAttributes } = (0, import_data11.useDispatch)(import_block_editor4.store); 2074 const { convertSyncedPatternToStatic: convertSyncedPatternToStatic2 } = unlock( 2075 (0, import_data11.useDispatch)(store) 2076 ); 2077 if (!isVisible || !canEdit) { 2078 return null; 2079 } 2080 const handleDetach = () => { 2081 if (isSyncedPattern) { 2082 convertSyncedPatternToStatic2(clientId); 2083 } 2084 if (isUnsyncedPattern) { 2085 const { patternName, ...attributesWithoutPatternName } = attributes?.metadata ?? {}; 2086 updateBlockAttributes(clientId, { 2087 metadata: attributesWithoutPatternName 2088 }); 2089 } 2090 onClose?.(); 2091 setShowConfirmDialog(false); 2092 }; 2093 return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [ 2094 canDetach && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [ 2095 /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_components7.MenuItem, { onClick: () => setShowConfirmDialog(true), children: (0, import_i18n8.__)("Detach") }), 2096 /* @__PURE__ */ (0, import_jsx_runtime15.jsx)( 2097 import_components7.__experimentalConfirmDialog, 2098 { 2099 isOpen: showConfirmDialog, 2100 onConfirm: handleDetach, 2101 onCancel: () => setShowConfirmDialog(false), 2102 confirmButtonText: (0, import_i18n8.__)("Detach"), 2103 size: "medium", 2104 title: (0, import_i18n8.__)("Detach pattern?"), 2105 __experimentalHideHeader: false, 2106 children: isSyncedPattern ? (0, import_i18n8.__)( 2107 "The blocks will be separated from the original pattern and will be fully editable. Future changes to the pattern will not apply here." 2108 ) : (0, import_i18n8.__)( 2109 "Blocks will no longer be associated with this pattern and will be fully editable." 2110 ) 2111 } 2112 ) 2113 ] }), 2114 /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_components7.MenuItem, { href: managePatternsUrl, children: (0, import_i18n8.__)("Manage patterns") }) 2115 ] }); 2116 } 2117 var patterns_manage_button_default = PatternsManageButton; 2118 2119 // packages/patterns/build-module/components/index.mjs 2120 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); 2121 function PatternsMenuItems({ rootClientId }) { 2122 return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_block_editor5.BlockSettingsMenuControls, { children: ({ selectedClientIds, onClose }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [ 2123 /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( 2124 PatternConvertButton, 2125 { 2126 clientIds: selectedClientIds, 2127 rootClientId, 2128 closeBlockSettingsMenu: onClose 2129 } 2130 ), 2131 selectedClientIds.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( 2132 patterns_manage_button_default, 2133 { 2134 clientId: selectedClientIds[0], 2135 onClose 2136 } 2137 ) 2138 ] }) }); 2139 } 2140 2141 // packages/patterns/build-module/components/rename-pattern-category-modal.mjs 2142 var import_components8 = __toESM(require_components(), 1); 2143 var import_core_data10 = __toESM(require_core_data(), 1); 2144 var import_data12 = __toESM(require_data(), 1); 2145 var import_element11 = __toESM(require_element(), 1); 2146 var import_html_entities3 = __toESM(require_html_entities(), 1); 2147 var import_i18n9 = __toESM(require_i18n(), 1); 2148 var import_notices6 = __toESM(require_notices(), 1); 2149 var import_a11y = __toESM(require_a11y(), 1); 2150 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); 2151 function RenamePatternCategoryModal({ 2152 category, 2153 existingCategories, 2154 onClose, 2155 onError, 2156 onSuccess, 2157 ...props 2158 }) { 2159 const id = (0, import_element11.useId)(); 2160 const textControlRef = (0, import_element11.useRef)(); 2161 const [name, setName] = (0, import_element11.useState)((0, import_html_entities3.decodeEntities)(category.name)); 2162 const [isSaving, setIsSaving] = (0, import_element11.useState)(false); 2163 const [validationMessage, setValidationMessage] = (0, import_element11.useState)(false); 2164 const validationMessageId = validationMessage ? `patterns-rename-pattern-category-modal__validation-message-$id}` : void 0; 2165 const { saveEntityRecord, invalidateResolution } = (0, import_data12.useDispatch)(import_core_data10.store); 2166 const { createErrorNotice, createSuccessNotice } = (0, import_data12.useDispatch)(import_notices6.store); 2167 const onChange = (newName) => { 2168 if (validationMessage) { 2169 setValidationMessage(void 0); 2170 } 2171 setName(newName); 2172 }; 2173 const onSave = async (event) => { 2174 event.preventDefault(); 2175 if (isSaving) { 2176 return; 2177 } 2178 if (!name || name === category.name) { 2179 const message = (0, import_i18n9.__)("Please enter a new name for this category."); 2180 (0, import_a11y.speak)(message, "assertive"); 2181 setValidationMessage(message); 2182 textControlRef.current?.focus(); 2183 return; 2184 } 2185 if (existingCategories.patternCategories.find((existingCategory) => { 2186 return existingCategory.id !== category.id && existingCategory.label.toLowerCase() === name.toLowerCase(); 2187 })) { 2188 const message = (0, import_i18n9.__)( 2189 "This category already exists. Please use a different name." 2190 ); 2191 (0, import_a11y.speak)(message, "assertive"); 2192 setValidationMessage(message); 2193 textControlRef.current?.focus(); 2194 return; 2195 } 2196 try { 2197 setIsSaving(true); 2198 const savedRecord = await saveEntityRecord( 2199 "taxonomy", 2200 CATEGORY_SLUG, 2201 { 2202 id: category.id, 2203 slug: category.slug, 2204 name 2205 } 2206 ); 2207 invalidateResolution("getUserPatternCategories"); 2208 onSuccess?.(savedRecord); 2209 onClose(); 2210 createSuccessNotice((0, import_i18n9.__)("Pattern category renamed."), { 2211 type: "snackbar", 2212 id: "pattern-category-update" 2213 }); 2214 } catch (error) { 2215 onError?.(); 2216 createErrorNotice(error.message, { 2217 type: "snackbar", 2218 id: "pattern-category-update" 2219 }); 2220 } finally { 2221 setIsSaving(false); 2222 setName(""); 2223 } 2224 }; 2225 const onRequestClose = () => { 2226 onClose(); 2227 setName(""); 2228 }; 2229 return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( 2230 import_components8.Modal, 2231 { 2232 title: (0, import_i18n9.__)("Rename"), 2233 onRequestClose, 2234 ...props, 2235 children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("form", { onSubmit: onSave, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 2236 /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Stack, { direction: "column", gap: "sm", children: [ 2237 /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( 2238 import_components8.TextControl, 2239 { 2240 ref: textControlRef, 2241 label: (0, import_i18n9.__)("Name"), 2242 value: name, 2243 onChange, 2244 "aria-describedby": validationMessageId, 2245 required: true 2246 } 2247 ), 2248 validationMessage && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( 2249 "span", 2250 { 2251 className: "patterns-rename-pattern-category-modal__validation-message", 2252 id: validationMessageId, 2253 children: validationMessage 2254 } 2255 ) 2256 ] }), 2257 /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Stack, { gap: "sm", justify: "end", children: [ 2258 /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( 2259 import_components8.Button, 2260 { 2261 __next40pxDefaultSize: true, 2262 variant: "tertiary", 2263 onClick: onRequestClose, 2264 children: (0, import_i18n9.__)("Cancel") 2265 } 2266 ), 2267 /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( 2268 import_components8.Button, 2269 { 2270 __next40pxDefaultSize: true, 2271 variant: "primary", 2272 type: "submit", 2273 "aria-disabled": !name || name === category.name || isSaving, 2274 isBusy: isSaving, 2275 children: (0, import_i18n9.__)("Save") 2276 } 2277 ) 2278 ] }) 2279 ] }) }) 2280 } 2281 ); 2282 } 2283 2284 // packages/patterns/build-module/components/pattern-overrides-controls.mjs 2285 var import_element13 = __toESM(require_element(), 1); 2286 var import_block_editor6 = __toESM(require_block_editor(), 1); 2287 var import_components10 = __toESM(require_components(), 1); 2288 var import_i18n11 = __toESM(require_i18n(), 1); 2289 2290 // packages/patterns/build-module/components/allow-overrides-modal.mjs 2291 var import_components9 = __toESM(require_components(), 1); 2292 var import_i18n10 = __toESM(require_i18n(), 1); 2293 var import_element12 = __toESM(require_element(), 1); 2294 var import_a11y2 = __toESM(require_a11y(), 1); 2295 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); 2296 function AllowOverridesModal({ 2297 placeholder, 2298 initialName = "", 2299 onClose, 2300 onSave 2301 }) { 2302 const [editedBlockName, setEditedBlockName] = (0, import_element12.useState)(initialName); 2303 const descriptionId = (0, import_element12.useId)(); 2304 const isNameValid = !!editedBlockName.trim(); 2305 const handleSubmit = () => { 2306 if (editedBlockName !== initialName) { 2307 const message = (0, import_i18n10.sprintf)( 2308 /* translators: %s: new name/label for the block */ 2309 (0, import_i18n10.__)('Block name changed to: "%s".'), 2310 editedBlockName 2311 ); 2312 (0, import_a11y2.speak)(message, "assertive"); 2313 } 2314 onSave(editedBlockName); 2315 onClose(); 2316 }; 2317 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 2318 import_components9.Modal, 2319 { 2320 title: (0, import_i18n10.__)("Enable overrides"), 2321 onRequestClose: onClose, 2322 focusOnMount: "firstContentElement", 2323 aria: { describedby: descriptionId }, 2324 size: "small", 2325 children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 2326 "form", 2327 { 2328 onSubmit: (event) => { 2329 event.preventDefault(); 2330 if (!isNameValid) { 2331 return; 2332 } 2333 handleSubmit(); 2334 }, 2335 children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Stack, { direction: "column", gap: "xl", children: [ 2336 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { id: descriptionId, children: (0, import_i18n10.__)( 2337 "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." 2338 ) }), 2339 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 2340 import_components9.TextControl, 2341 { 2342 value: editedBlockName, 2343 label: (0, import_i18n10.__)("Name"), 2344 help: (0, import_i18n10.__)( 2345 'For example, if you are creating a recipe pattern, you use "Recipe Title", "Recipe Description", etc.' 2346 ), 2347 placeholder, 2348 onChange: setEditedBlockName 2349 } 2350 ), 2351 /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Stack, { gap: "sm", justify: "end", children: [ 2352 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 2353 import_components9.Button, 2354 { 2355 __next40pxDefaultSize: true, 2356 variant: "tertiary", 2357 onClick: onClose, 2358 children: (0, import_i18n10.__)("Cancel") 2359 } 2360 ), 2361 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 2362 import_components9.Button, 2363 { 2364 __next40pxDefaultSize: true, 2365 "aria-disabled": !isNameValid, 2366 variant: "primary", 2367 type: "submit", 2368 children: (0, import_i18n10.__)("Enable") 2369 } 2370 ) 2371 ] }) 2372 ] }) 2373 } 2374 ) 2375 } 2376 ); 2377 } 2378 function DisallowOverridesModal({ onClose, onSave }) { 2379 const descriptionId = (0, import_element12.useId)(); 2380 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 2381 import_components9.Modal, 2382 { 2383 title: (0, import_i18n10.__)("Disable overrides"), 2384 onRequestClose: onClose, 2385 aria: { describedby: descriptionId }, 2386 size: "small", 2387 children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 2388 "form", 2389 { 2390 onSubmit: (event) => { 2391 event.preventDefault(); 2392 onSave(); 2393 onClose(); 2394 }, 2395 children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Stack, { direction: "column", gap: "xl", children: [ 2396 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { id: descriptionId, children: (0, import_i18n10.__)( 2397 "Are you sure you want to disable overrides? Disabling overrides will revert all applied overrides for this block throughout instances of this pattern." 2398 ) }), 2399 /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Stack, { gap: "sm", justify: "end", children: [ 2400 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 2401 import_components9.Button, 2402 { 2403 __next40pxDefaultSize: true, 2404 variant: "tertiary", 2405 onClick: onClose, 2406 children: (0, import_i18n10.__)("Cancel") 2407 } 2408 ), 2409 /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 2410 import_components9.Button, 2411 { 2412 __next40pxDefaultSize: true, 2413 variant: "primary", 2414 type: "submit", 2415 children: (0, import_i18n10.__)("Disable") 2416 } 2417 ) 2418 ] }) 2419 ] }) 2420 } 2421 ) 2422 } 2423 ); 2424 } 2425 2426 // packages/patterns/build-module/components/pattern-overrides-controls.mjs 2427 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); 2428 function PatternOverridesControls({ 2429 attributes, 2430 setAttributes, 2431 name: blockName 2432 }) { 2433 const controlId = (0, import_element13.useId)(); 2434 const [showAllowOverridesModal, setShowAllowOverridesModal] = (0, import_element13.useState)(false); 2435 const [showDisallowOverridesModal, setShowDisallowOverridesModal] = (0, import_element13.useState)(false); 2436 const hasName = !!attributes.metadata?.name; 2437 const defaultBindings = attributes.metadata?.bindings?.__default; 2438 const hasOverrides = hasName && defaultBindings?.source === PATTERN_OVERRIDES_BINDING_SOURCE; 2439 const isConnectedToOtherSources = defaultBindings?.source && defaultBindings.source !== PATTERN_OVERRIDES_BINDING_SOURCE; 2440 const { updateBlockBindings } = (0, import_block_editor6.useBlockBindingsUtils)(); 2441 function updateBindings(isChecked, customName) { 2442 if (customName) { 2443 setAttributes({ 2444 metadata: { 2445 ...attributes.metadata, 2446 name: customName 2447 } 2448 }); 2449 } 2450 updateBlockBindings({ 2451 __default: isChecked ? { source: PATTERN_OVERRIDES_BINDING_SOURCE } : void 0 2452 }); 2453 } 2454 if (isConnectedToOtherSources) { 2455 return null; 2456 } 2457 const hasUnsupportedImageAttributes = blockName === "core/image" && !!attributes.href?.length; 2458 const helpText = !hasOverrides && hasUnsupportedImageAttributes ? (0, import_i18n11.__)( 2459 `Overrides currently don't support image links. Remove the link first before enabling overrides.` 2460 ) : (0, import_i18n11.__)( 2461 "Allow changes to this block throughout instances of this pattern." 2462 ); 2463 return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [ 2464 /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_block_editor6.InspectorControls, { group: "advanced", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 2465 import_components10.BaseControl, 2466 { 2467 id: controlId, 2468 label: (0, import_i18n11.__)("Overrides"), 2469 help: helpText, 2470 children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 2471 import_components10.Button, 2472 { 2473 __next40pxDefaultSize: true, 2474 className: "pattern-overrides-control__allow-overrides-button", 2475 variant: "secondary", 2476 "aria-haspopup": "dialog", 2477 onClick: () => { 2478 if (hasOverrides) { 2479 setShowDisallowOverridesModal(true); 2480 } else { 2481 setShowAllowOverridesModal(true); 2482 } 2483 }, 2484 disabled: !hasOverrides && hasUnsupportedImageAttributes, 2485 accessibleWhenDisabled: true, 2486 children: hasOverrides ? (0, import_i18n11.__)("Disable overrides") : (0, import_i18n11.__)("Enable overrides") 2487 } 2488 ) 2489 } 2490 ) }), 2491 showAllowOverridesModal && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 2492 AllowOverridesModal, 2493 { 2494 initialName: attributes.metadata?.name, 2495 onClose: () => setShowAllowOverridesModal(false), 2496 onSave: (newName) => { 2497 updateBindings(true, newName); 2498 } 2499 } 2500 ), 2501 showDisallowOverridesModal && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 2502 DisallowOverridesModal, 2503 { 2504 onClose: () => setShowDisallowOverridesModal(false), 2505 onSave: () => updateBindings(false) 2506 } 2507 ) 2508 ] }); 2509 } 2510 var pattern_overrides_controls_default = PatternOverridesControls; 2511 2512 // packages/patterns/build-module/components/reset-overrides-control.mjs 2513 var import_block_editor7 = __toESM(require_block_editor(), 1); 2514 var import_components11 = __toESM(require_components(), 1); 2515 var import_data13 = __toESM(require_data(), 1); 2516 var import_i18n12 = __toESM(require_i18n(), 1); 2517 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); 2518 var CONTENT = "content"; 2519 function ResetOverridesControl(props) { 2520 const name = props.attributes.metadata?.name; 2521 const registry = (0, import_data13.useRegistry)(); 2522 const isOverridden = (0, import_data13.useSelect)( 2523 (select) => { 2524 if (!name) { 2525 return; 2526 } 2527 const { getBlockAttributes, getBlockParentsByBlockName } = select(import_block_editor7.store); 2528 const [patternClientId] = getBlockParentsByBlockName( 2529 props.clientId, 2530 "core/block", 2531 true 2532 ); 2533 if (!patternClientId) { 2534 return; 2535 } 2536 const overrides = getBlockAttributes(patternClientId)[CONTENT]; 2537 if (!overrides) { 2538 return; 2539 } 2540 return overrides.hasOwnProperty(name); 2541 }, 2542 [props.clientId, name] 2543 ); 2544 function onClick() { 2545 const { getBlockAttributes, getBlockParentsByBlockName } = registry.select(import_block_editor7.store); 2546 const [patternClientId] = getBlockParentsByBlockName( 2547 props.clientId, 2548 "core/block", 2549 true 2550 ); 2551 if (!patternClientId) { 2552 return; 2553 } 2554 const overrides = getBlockAttributes(patternClientId)[CONTENT]; 2555 if (!overrides.hasOwnProperty(name)) { 2556 return; 2557 } 2558 const { updateBlockAttributes, __unstableMarkLastChangeAsPersistent } = registry.dispatch(import_block_editor7.store); 2559 __unstableMarkLastChangeAsPersistent(); 2560 let newOverrides = { ...overrides }; 2561 delete newOverrides[name]; 2562 if (!Object.keys(newOverrides).length) { 2563 newOverrides = void 0; 2564 } 2565 updateBlockAttributes(patternClientId, { 2566 [CONTENT]: newOverrides 2567 }); 2568 } 2569 return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_block_editor7.__unstableBlockToolbarLastItem, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_components11.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_components11.ToolbarButton, { onClick, disabled: !isOverridden, children: (0, import_i18n12.__)("Reset") }) }) }); 2570 } 2571 2572 // packages/patterns/build-module/private-apis.mjs 2573 var privateApis = {}; 2574 lock(privateApis, { 2575 OverridesPanel, 2576 CreatePatternModal, 2577 CreatePatternModalContents, 2578 DuplicatePatternModal, 2579 CreateTemplatePartModal, 2580 CreateTemplatePartModalContents, 2581 isOverridableBlock, 2582 useDuplicatePatternProps, 2583 RenamePatternModal, 2584 PatternsMenuItems, 2585 RenamePatternCategoryModal, 2586 PatternOverridesControls: pattern_overrides_controls_default, 2587 ResetOverridesControl, 2588 useAddPatternCategory, 2589 PATTERN_TYPES, 2590 PATTERN_DEFAULT_CATEGORY, 2591 PATTERN_USER_CATEGORY, 2592 EXCLUDED_PATTERN_SOURCES, 2593 PATTERN_SYNC_TYPES 2594 }); 2595 return __toCommonJS(index_exports); 2596 })(); 2597 (window.wp ||= {}).patterns = wp.patterns; 2598 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Wed Nov 4 08:20:38 2026 | Cross-referenced by PHPXref |