[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> patterns.js (source)

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


Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref