) & MemizeMemoizedFunction} Memoized function.
*/
function memize(fn, options) {
var size = 0;
/** @type {?MemizeCacheNode|undefined} */
var head;
/** @type {?MemizeCacheNode|undefined} */
var tail;
options = options || {};
function memoized(/* ...args */) {
var node = head,
len = arguments.length,
args,
i;
searchCache: while (node) {
// Perform a shallow equality test to confirm that whether the node
// under test is a candidate for the arguments passed. Two arrays
// are shallowly equal if their length matches and each entry is
// strictly equal between the two sets. Avoid abstracting to a
// function which could incur an arguments leaking deoptimization.
// Check whether node arguments match arguments length
if (node.args.length !== arguments.length) {
node = node.next;
continue;
}
// Check whether node arguments match arguments values
for (i = 0; i < len; i++) {
if (node.args[i] !== arguments[i]) {
node = node.next;
continue searchCache;
}
}
// At this point we can assume we've found a match
// Surface matched node to head if not already
if (node !== head) {
// As tail, shift to previous. Must only shift if not also
// head, since if both head and tail, there is no previous.
if (node === tail) {
tail = node.prev;
}
// Adjust siblings to point to each other. If node was tail,
// this also handles new tail's empty `next` assignment.
/** @type {MemizeCacheNode} */ (node.prev).next = node.next;
if (node.next) {
node.next.prev = node.prev;
}
node.next = head;
node.prev = null;
/** @type {MemizeCacheNode} */ (head).prev = node;
head = node;
}
// Return immediately
return node.val;
}
// No cached value found. Continue to insertion phase:
// Create a copy of arguments (avoid leaking deoptimization)
args = new Array(len);
for (i = 0; i < len; i++) {
args[i] = arguments[i];
}
node = {
args: args,
// Generate the result from original function
val: fn.apply(null, args),
};
// Don't need to check whether node is already head, since it would
// have been returned above already if it was
// Shift existing head down list
if (head) {
head.prev = node;
node.next = head;
} else {
// If no head, follows that there's no tail (at initial or reset)
tail = node;
}
// Trim tail if we're reached max size and are pending cache insertion
if (size === /** @type {MemizeOptions} */ (options).maxSize) {
tail = /** @type {MemizeCacheNode} */ (tail).prev;
/** @type {MemizeCacheNode} */ (tail).next = null;
} else {
size++;
}
head = node;
return node.val;
}
memoized.clear = function () {
head = null;
tail = null;
size = 0;
};
// Ignore reason: There's not a clear solution to create an intersection of
// the function with additional properties, where the goal is to retain the
// function signature of the incoming argument and add control properties
// on the return value.
// @ts-ignore
return memoized;
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/memoize.js
/**
* External dependencies
*/
// re-export due to restrictive esModuleInterop setting
/* harmony default export */ const memoize = (memize);
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/constants.js
let Status = /*#__PURE__*/function (Status) {
Status["Idle"] = "IDLE";
Status["Resolving"] = "RESOLVING";
Status["Error"] = "ERROR";
Status["Success"] = "SUCCESS";
return Status;
}({});
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-query-select.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const META_SELECTORS = ['getIsResolving', 'hasStartedResolution', 'hasFinishedResolution', 'isResolving', 'getCachedResolvers'];
/**
* Like useSelect, but the selectors return objects containing
* both the original data AND the resolution info.
*
* @since 6.1.0 Introduced in WordPress core.
* @private
*
* @param {Function} mapQuerySelect see useSelect
* @param {Array} deps see useSelect
*
* @example
* ```js
* import { useQuerySelect } from '@wordpress/data';
* import { store as coreDataStore } from '@wordpress/core-data';
*
* function PageTitleDisplay( { id } ) {
* const { data: page, isResolving } = useQuerySelect( ( query ) => {
* return query( coreDataStore ).getEntityRecord( 'postType', 'page', id )
* }, [ id ] );
*
* if ( isResolving ) {
* return 'Loading...';
* }
*
* return page.title;
* }
*
* // Rendered in the application:
* //
* ```
*
* In the above example, when `PageTitleDisplay` is rendered into an
* application, the page and the resolution details will be retrieved from
* the store state using the `mapSelect` callback on `useQuerySelect`.
*
* If the id prop changes then any page in the state for that id is
* retrieved. If the id prop doesn't change and other props are passed in
* that do change, the title will not change because the dependency is just
* the id.
* @see useSelect
*
* @return {QuerySelectResponse} Queried data.
*/
function useQuerySelect(mapQuerySelect, deps) {
return (0,external_wp_data_namespaceObject.useSelect)((select, registry) => {
const resolve = store => enrichSelectors(select(store));
return mapQuerySelect(resolve, registry);
}, deps);
}
/**
* Transform simple selectors into ones that return an object with the
* original return value AND the resolution info.
*
* @param {Object} selectors Selectors to enrich
* @return {EnrichedSelectors} Enriched selectors
*/
const enrichSelectors = memoize(selectors => {
const resolvers = {};
for (const selectorName in selectors) {
if (META_SELECTORS.includes(selectorName)) {
continue;
}
Object.defineProperty(resolvers, selectorName, {
get: () => (...args) => {
const data = selectors[selectorName](...args);
const resolutionStatus = selectors.getResolutionState(selectorName, args)?.status;
let status;
switch (resolutionStatus) {
case 'resolving':
status = Status.Resolving;
break;
case 'finished':
status = Status.Success;
break;
case 'error':
status = Status.Error;
break;
case undefined:
status = Status.Idle;
break;
}
return {
data,
status,
isResolving: status === Status.Resolving,
hasStarted: status !== Status.Idle,
hasResolved: status === Status.Success || status === Status.Error
};
}
});
}
return resolvers;
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-record.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const use_entity_record_EMPTY_OBJECT = {};
/**
* Resolves the specified entity record.
*
* @since 6.1.0 Introduced in WordPress core.
*
* @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.
* @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.
* @param recordId ID of the requested entity record.
* @param options Optional hook options.
* @example
* ```js
* import { useEntityRecord } from '@wordpress/core-data';
*
* function PageTitleDisplay( { id } ) {
* const { record, isResolving } = useEntityRecord( 'postType', 'page', id );
*
* if ( isResolving ) {
* return 'Loading...';
* }
*
* return record.title;
* }
*
* // Rendered in the application:
* //
* ```
*
* In the above example, when `PageTitleDisplay` is rendered into an
* application, the page and the resolution details will be retrieved from
* the store state using `getEntityRecord()`, or resolved if missing.
*
* @example
* ```js
* import { useCallback } from 'react';
* import { useDispatch } from '@wordpress/data';
* import { __ } from '@wordpress/i18n';
* import { TextControl } from '@wordpress/components';
* import { store as noticeStore } from '@wordpress/notices';
* import { useEntityRecord } from '@wordpress/core-data';
*
* function PageRenameForm( { id } ) {
* const page = useEntityRecord( 'postType', 'page', id );
* const { createSuccessNotice, createErrorNotice } =
* useDispatch( noticeStore );
*
* const setTitle = useCallback( ( title ) => {
* page.edit( { title } );
* }, [ page.edit ] );
*
* if ( page.isResolving ) {
* return 'Loading...';
* }
*
* async function onRename( event ) {
* event.preventDefault();
* try {
* await page.save();
* createSuccessNotice( __( 'Page renamed.' ), {
* type: 'snackbar',
* } );
* } catch ( error ) {
* createErrorNotice( error.message, { type: 'snackbar' } );
* }
* }
*
* return (
*
* );
* }
*
* // Rendered in the application:
* //
* ```
*
* In the above example, updating and saving the page title is handled
* via the `edit()` and `save()` mutation helpers provided by
* `useEntityRecord()`;
*
* @return Entity record data.
* @template RecordType
*/
function useEntityRecord(kind, name, recordId, options = {
enabled: true
}) {
const {
editEntityRecord,
saveEditedEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
const mutations = (0,external_wp_element_namespaceObject.useMemo)(() => ({
edit: (record, editOptions = {}) => editEntityRecord(kind, name, recordId, record, editOptions),
save: (saveOptions = {}) => saveEditedEntityRecord(kind, name, recordId, {
throwOnError: true,
...saveOptions
})
}), [editEntityRecord, kind, name, recordId, saveEditedEntityRecord]);
const {
editedRecord,
hasEdits,
edits
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!options.enabled) {
return {
editedRecord: use_entity_record_EMPTY_OBJECT,
hasEdits: false,
edits: use_entity_record_EMPTY_OBJECT
};
}
return {
editedRecord: select(store).getEditedEntityRecord(kind, name, recordId),
hasEdits: select(store).hasEditsForEntityRecord(kind, name, recordId),
edits: select(store).getEntityRecordNonTransientEdits(kind, name, recordId)
};
}, [kind, name, recordId, options.enabled]);
const {
data: record,
...querySelectRest
} = useQuerySelect(query => {
if (!options.enabled) {
return {
data: null
};
}
return query(store).getEntityRecord(kind, name, recordId);
}, [kind, name, recordId, options.enabled]);
return {
record,
editedRecord,
hasEdits,
edits,
...querySelectRest,
...mutations
};
}
function __experimentalUseEntityRecord(kind, name, recordId, options) {
external_wp_deprecated_default()(`wp.data.__experimentalUseEntityRecord`, {
alternative: 'wp.data.useEntityRecord',
since: '6.1'
});
return useEntityRecord(kind, name, recordId, options);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-records.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const EMPTY_ARRAY = [];
/**
* Resolves the specified entity records.
*
* @since 6.1.0 Introduced in WordPress core.
*
* @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.
* @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.
* @param queryArgs Optional HTTP query description for how to fetch the data, passed to the requested API endpoint.
* @param options Optional hook options.
* @example
* ```js
* import { useEntityRecords } from '@wordpress/core-data';
*
* function PageTitlesList() {
* const { records, isResolving } = useEntityRecords( 'postType', 'page' );
*
* if ( isResolving ) {
* return 'Loading...';
* }
*
* return (
*
* {records.map(( page ) => (
* - { page.title }
* ))}
*
* );
* }
*
* // Rendered in the application:
* //
* ```
*
* In the above example, when `PageTitlesList` is rendered into an
* application, the list of records and the resolution details will be retrieved from
* the store state using `getEntityRecords()`, or resolved if missing.
*
* @return Entity records data.
* @template RecordType
*/
function useEntityRecords(kind, name, queryArgs = {}, options = {
enabled: true
}) {
// Serialize queryArgs to a string that can be safely used as a React dep.
// We can't just pass queryArgs as one of the deps, because if it is passed
// as an object literal, then it will be a different object on each call even
// if the values remain the same.
const queryAsString = (0,external_wp_url_namespaceObject.addQueryArgs)('', queryArgs);
const {
data: records,
...rest
} = useQuerySelect(query => {
if (!options.enabled) {
return {
// Avoiding returning a new reference on every execution.
data: EMPTY_ARRAY
};
}
return query(store).getEntityRecords(kind, name, queryArgs);
}, [kind, name, queryAsString, options.enabled]);
const {
totalItems,
totalPages
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!options.enabled) {
return {
totalItems: null,
totalPages: null
};
}
return {
totalItems: select(store).getEntityRecordsTotalItems(kind, name, queryArgs),
totalPages: select(store).getEntityRecordsTotalPages(kind, name, queryArgs)
};
}, [kind, name, queryAsString, options.enabled]);
return {
records,
totalItems,
totalPages,
...rest
};
}
function __experimentalUseEntityRecords(kind, name, queryArgs, options) {
external_wp_deprecated_default()(`wp.data.__experimentalUseEntityRecords`, {
alternative: 'wp.data.useEntityRecords',
since: '6.1'
});
return useEntityRecords(kind, name, queryArgs, options);
}
function useEntityRecordsWithPermissions(kind, name, queryArgs = {}, options = {
enabled: true
}) {
const entityConfig = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getEntityConfig(kind, name), [kind, name]);
const {
records: data,
...ret
} = useEntityRecords(kind, name, queryArgs, options);
const ids = (0,external_wp_element_namespaceObject.useMemo)(() => {
var _data$map;
return (_data$map = data?.map(
// @ts-ignore
record => {
var _entityConfig$key;
return record[(_entityConfig$key = entityConfig?.key) !== null && _entityConfig$key !== void 0 ? _entityConfig$key : 'id'];
})) !== null && _data$map !== void 0 ? _data$map : [];
}, [data, entityConfig?.key]);
const permissions = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEntityRecordsPermissions
} = unlock(select(store));
return getEntityRecordsPermissions(kind, name, ids);
}, [ids, kind, name]);
const dataWithPermissions = (0,external_wp_element_namespaceObject.useMemo)(() => {
var _data$map2;
return (_data$map2 = data?.map((record, index) => ({
// @ts-ignore
...record,
permissions: permissions[index]
}))) !== null && _data$map2 !== void 0 ? _data$map2 : [];
}, [data, permissions]);
return {
records: dataWithPermissions,
...ret
};
}
;// CONCATENATED MODULE: external ["wp","warning"]
const external_wp_warning_namespaceObject = window["wp"]["warning"];
var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject);
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-resource-permissions.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Is the data resolved by now?
*/
/**
* Resolves resource permissions.
*
* @since 6.1.0 Introduced in WordPress core.
*
* @param resource Entity resource to check. Accepts entity object `{ kind: 'root', name: 'media', id: 1 }`
* or REST base as a string - `media`.
* @param id Optional ID of the resource to check, e.g. 10. Note: This argument is discouraged
* when using an entity object as a resource to check permissions and will be ignored.
*
* @example
* ```js
* import { useResourcePermissions } from '@wordpress/core-data';
*
* function PagesList() {
* const { canCreate, isResolving } = useResourcePermissions( { kind: 'postType', name: 'page' } );
*
* if ( isResolving ) {
* return 'Loading ...';
* }
*
* return (
*
* {canCreate ? () : false}
* // ...
*
* );
* }
*
* // Rendered in the application:
* //
* ```
*
* @example
* ```js
* import { useResourcePermissions } from '@wordpress/core-data';
*
* function Page({ pageId }) {
* const {
* canCreate,
* canUpdate,
* canDelete,
* isResolving
* } = useResourcePermissions( { kind: 'postType', name: 'page', id: pageId } );
*
* if ( isResolving ) {
* return 'Loading ...';
* }
*
* return (
*
* {canCreate ? () : false}
* {canUpdate ? () : false}
* {canDelete ? () : false}
* // ...
*
* );
* }
*
* // Rendered in the application:
* //
* ```
*
* In the above example, when `PagesList` is rendered into an
* application, the appropriate permissions and the resolution details will be retrieved from
* the store state using `canUser()`, or resolved if missing.
*
* @return Entity records data.
* @template IdType
*/
function useResourcePermissions(resource, id) {
// Serialize `resource` to a string that can be safely used as a React dep.
// We can't just pass `resource` as one of the deps, because if it is passed
// as an object literal, then it will be a different object on each call even
// if the values remain the same.
const isEntity = typeof resource === 'object';
const resourceAsString = isEntity ? JSON.stringify(resource) : resource;
if (isEntity && typeof id !== 'undefined') {
true ? external_wp_warning_default()(`When 'resource' is an entity object, passing 'id' as a separate argument isn't supported.`) : 0;
}
return useQuerySelect(resolve => {
const hasId = isEntity ? !!resource.id : !!id;
const {
canUser
} = resolve(store);
const create = canUser('create', isEntity ? {
kind: resource.kind,
name: resource.name
} : resource);
if (!hasId) {
const read = canUser('read', resource);
const isResolving = create.isResolving || read.isResolving;
const hasResolved = create.hasResolved && read.hasResolved;
let status = Status.Idle;
if (isResolving) {
status = Status.Resolving;
} else if (hasResolved) {
status = Status.Success;
}
return {
status,
isResolving,
hasResolved,
canCreate: create.hasResolved && create.data,
canRead: read.hasResolved && read.data
};
}
const read = canUser('read', resource, id);
const update = canUser('update', resource, id);
const _delete = canUser('delete', resource, id);
const isResolving = read.isResolving || create.isResolving || update.isResolving || _delete.isResolving;
const hasResolved = read.hasResolved && create.hasResolved && update.hasResolved && _delete.hasResolved;
let status = Status.Idle;
if (isResolving) {
status = Status.Resolving;
} else if (hasResolved) {
status = Status.Success;
}
return {
status,
isResolving,
hasResolved,
canRead: hasResolved && read.data,
canCreate: hasResolved && create.data,
canUpdate: hasResolved && update.data,
canDelete: hasResolved && _delete.data
};
}, [resourceAsString, id]);
}
/* harmony default export */ const use_resource_permissions = (useResourcePermissions);
function __experimentalUseResourcePermissions(resource, id) {
external_wp_deprecated_default()(`wp.data.__experimentalUseResourcePermissions`, {
alternative: 'wp.data.useResourcePermissions',
since: '6.1'
});
return useResourcePermissions(resource, id);
}
;// CONCATENATED MODULE: external ["wp","blocks"]
const external_wp_blocks_namespaceObject = window["wp"]["blocks"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-id.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Hook that returns the ID for the nearest
* provided entity of the specified type.
*
* @param {string} kind The entity kind.
* @param {string} name The entity name.
*/
function useEntityId(kind, name) {
const context = (0,external_wp_element_namespaceObject.useContext)(EntityContext);
return context?.[kind]?.[name];
}
;// CONCATENATED MODULE: external ["wp","blockEditor"]
const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/footnotes/get-rich-text-values-cached.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// TODO: The following line should have been:
//
// const unlockedApis = unlock( blockEditorPrivateApis );
//
// But there are hidden circular dependencies in RNMobile code, specifically in
// certain native components in the `components` package that depend on
// `block-editor`. What follows is a workaround that defers the `unlock` call
// to prevent native code from failing.
//
// Fix once https://github.com/WordPress/gutenberg/issues/52692 is closed.
let unlockedApis;
const cache = new WeakMap();
function getRichTextValuesCached(block) {
if (!unlockedApis) {
unlockedApis = unlock(external_wp_blockEditor_namespaceObject.privateApis);
}
if (!cache.has(block)) {
const values = unlockedApis.getRichTextValues([block]);
cache.set(block, values);
}
return cache.get(block);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/footnotes/get-footnotes-order.js
/**
* Internal dependencies
*/
const get_footnotes_order_cache = new WeakMap();
function getBlockFootnotesOrder(block) {
if (!get_footnotes_order_cache.has(block)) {
const order = [];
for (const value of getRichTextValuesCached(block)) {
if (!value) {
continue;
}
// replacements is a sparse array, use forEach to skip empty slots.
value.replacements.forEach(({
type,
attributes
}) => {
if (type === 'core/footnote') {
order.push(attributes['data-fn']);
}
});
}
get_footnotes_order_cache.set(block, order);
}
return get_footnotes_order_cache.get(block);
}
function getFootnotesOrder(blocks) {
// We can only separate getting order from blocks at the root level. For
// deeper inner blocks, this will not work since it's possible to have both
// inner blocks and block attributes, so order needs to be computed from the
// Edit functions as a whole.
return blocks.flatMap(getBlockFootnotesOrder);
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/footnotes/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
let oldFootnotes = {};
function updateFootnotesFromMeta(blocks, meta) {
const output = {
blocks
};
if (!meta) {
return output;
}
// If meta.footnotes is empty, it means the meta is not registered.
if (meta.footnotes === undefined) {
return output;
}
const newOrder = getFootnotesOrder(blocks);
const footnotes = meta.footnotes ? JSON.parse(meta.footnotes) : [];
const currentOrder = footnotes.map(fn => fn.id);
if (currentOrder.join('') === newOrder.join('')) {
return output;
}
const newFootnotes = newOrder.map(fnId => footnotes.find(fn => fn.id === fnId) || oldFootnotes[fnId] || {
id: fnId,
content: ''
});
function updateAttributes(attributes) {
// Only attempt to update attributes, if attributes is an object.
if (!attributes || Array.isArray(attributes) || typeof attributes !== 'object') {
return attributes;
}
attributes = {
...attributes
};
for (const key in attributes) {
const value = attributes[key];
if (Array.isArray(value)) {
attributes[key] = value.map(updateAttributes);
continue;
}
// To do, remove support for string values?
if (typeof value !== 'string' && !(value instanceof external_wp_richText_namespaceObject.RichTextData)) {
continue;
}
const richTextValue = typeof value === 'string' ? external_wp_richText_namespaceObject.RichTextData.fromHTMLString(value) : new external_wp_richText_namespaceObject.RichTextData(value);
let hasFootnotes = false;
richTextValue.replacements.forEach(replacement => {
if (replacement.type === 'core/footnote') {
const id = replacement.attributes['data-fn'];
const index = newOrder.indexOf(id);
// The innerHTML contains the count wrapped in a link.
const countValue = (0,external_wp_richText_namespaceObject.create)({
html: replacement.innerHTML
});
countValue.text = String(index + 1);
countValue.formats = Array.from({
length: countValue.text.length
}, () => countValue.formats[0]);
countValue.replacements = Array.from({
length: countValue.text.length
}, () => countValue.replacements[0]);
replacement.innerHTML = (0,external_wp_richText_namespaceObject.toHTMLString)({
value: countValue
});
hasFootnotes = true;
}
});
if (hasFootnotes) {
attributes[key] = typeof value === 'string' ? richTextValue.toHTMLString() : richTextValue;
}
}
return attributes;
}
function updateBlocksAttributes(__blocks) {
return __blocks.map(block => {
return {
...block,
attributes: updateAttributes(block.attributes),
innerBlocks: updateBlocksAttributes(block.innerBlocks)
};
});
}
// We need to go through all block attributes deeply and update the
// footnote anchor numbering (textContent) to match the new order.
const newBlocks = updateBlocksAttributes(blocks);
oldFootnotes = {
...oldFootnotes,
...footnotes.reduce((acc, fn) => {
if (!newOrder.includes(fn.id)) {
acc[fn.id] = fn;
}
return acc;
}, {})
};
return {
meta: {
...meta,
footnotes: JSON.stringify(newFootnotes)
},
blocks: newBlocks
};
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-block-editor.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const use_entity_block_editor_EMPTY_ARRAY = [];
const parsedBlocksCache = new WeakMap();
/**
* Hook that returns block content getters and setters for
* the nearest provided entity of the specified type.
*
* The return value has the shape `[ blocks, onInput, onChange ]`.
* `onInput` is for block changes that don't create undo levels
* or dirty the post, non-persistent changes, and `onChange` is for
* persistent changes. They map directly to the props of a
* `BlockEditorProvider` and are intended to be used with it,
* or similar components or hooks.
*
* @param {string} kind The entity kind.
* @param {string} name The entity name.
* @param {Object} options
* @param {string} [options.id] An entity ID to use instead of the context-provided one.
*
* @return {[unknown[], Function, Function]} The block array and setters.
*/
function useEntityBlockEditor(kind, name, {
id: _id
} = {}) {
const providerId = useEntityId(kind, name);
const id = _id !== null && _id !== void 0 ? _id : providerId;
const {
getEntityRecord,
getEntityRecordEdits
} = (0,external_wp_data_namespaceObject.useSelect)(STORE_NAME);
const {
content,
editedBlocks,
meta
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
if (!id) {
return {};
}
const {
getEditedEntityRecord
} = select(STORE_NAME);
const editedRecord = getEditedEntityRecord(kind, name, id);
return {
editedBlocks: editedRecord.blocks,
content: editedRecord.content,
meta: editedRecord.meta
};
}, [kind, name, id]);
const {
__unstableCreateUndoLevel,
editEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(STORE_NAME);
const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!id) {
return undefined;
}
if (editedBlocks) {
return editedBlocks;
}
if (!content || typeof content !== 'string') {
return use_entity_block_editor_EMPTY_ARRAY;
}
// If there's an edit, cache the parsed blocks by the edit.
// If not, cache by the original enity record.
const edits = getEntityRecordEdits(kind, name, id);
const isUnedited = !edits || !Object.keys(edits).length;
const cackeKey = isUnedited ? getEntityRecord(kind, name, id) : edits;
let _blocks = parsedBlocksCache.get(cackeKey);
if (!_blocks) {
_blocks = (0,external_wp_blocks_namespaceObject.parse)(content);
parsedBlocksCache.set(cackeKey, _blocks);
}
return _blocks;
}, [kind, name, id, editedBlocks, content, getEntityRecord, getEntityRecordEdits]);
const updateFootnotes = (0,external_wp_element_namespaceObject.useCallback)(_blocks => updateFootnotesFromMeta(_blocks, meta), [meta]);
const onChange = (0,external_wp_element_namespaceObject.useCallback)((newBlocks, options) => {
const noChange = blocks === newBlocks;
if (noChange) {
return __unstableCreateUndoLevel(kind, name, id);
}
const {
selection,
...rest
} = options;
// We create a new function here on every persistent edit
// to make sure the edit makes the post dirty and creates
// a new undo level.
const edits = {
selection,
content: ({
blocks: blocksForSerialization = []
}) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization),
...updateFootnotes(newBlocks)
};
editEntityRecord(kind, name, id, edits, {
isCached: false,
...rest
});
}, [kind, name, id, blocks, updateFootnotes, __unstableCreateUndoLevel, editEntityRecord]);
const onInput = (0,external_wp_element_namespaceObject.useCallback)((newBlocks, options) => {
const {
selection,
...rest
} = options;
const footnotesChanges = updateFootnotes(newBlocks);
const edits = {
selection,
...footnotesChanges
};
editEntityRecord(kind, name, id, edits, {
isCached: true,
...rest
});
}, [kind, name, id, updateFootnotes, editEntityRecord]);
return [blocks, onInput, onChange];
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-prop.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Hook that returns the value and a setter for the
* specified property of the nearest provided
* entity of the specified type.
*
* @param {string} kind The entity kind.
* @param {string} name The entity name.
* @param {string} prop The property name.
* @param {number|string} [_id] An entity ID to use instead of the context-provided one.
*
* @return {[*, Function, *]} An array where the first item is the
* property value, the second is the
* setter and the third is the full value
* object from REST API containing more
* information like `raw`, `rendered` and
* `protected` props.
*/
function useEntityProp(kind, name, prop, _id) {
const providerId = useEntityId(kind, name);
const id = _id !== null && _id !== void 0 ? _id : providerId;
const {
value,
fullValue
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEntityRecord,
getEditedEntityRecord
} = select(STORE_NAME);
const record = getEntityRecord(kind, name, id); // Trigger resolver.
const editedRecord = getEditedEntityRecord(kind, name, id);
return record && editedRecord ? {
value: editedRecord[prop],
fullValue: record[prop]
} : {};
}, [kind, name, id, prop]);
const {
editEntityRecord
} = (0,external_wp_data_namespaceObject.useDispatch)(STORE_NAME);
const setValue = (0,external_wp_element_namespaceObject.useCallback)(newValue => {
editEntityRecord(kind, name, id, {
[prop]: newValue
});
}, [editEntityRecord, kind, name, id, prop]);
return [value, setValue, fullValue];
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/index.js
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/private-apis.js
/**
* Internal dependencies
*/
const privateApis = {};
lock(privateApis, {
useEntityRecordsWithPermissions: useEntityRecordsWithPermissions
});
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// The entity selectors/resolvers and actions are shortcuts to their generic equivalents
// (getEntityRecord, getEntityRecords, updateEntityRecord, updateEntityRecords)
// Instead of getEntityRecord, the consumer could use more user-friendly named selector: getPostType, getTaxonomy...
// The "kind" and the "name" of the entity are combined to generate these shortcuts.
const build_module_entitiesConfig = [...rootEntitiesConfig, ...additionalEntityConfigLoaders.filter(config => !!config.name)];
const entitySelectors = build_module_entitiesConfig.reduce((result, entity) => {
const {
kind,
name,
plural
} = entity;
result[getMethodName(kind, name)] = (state, key, query) => getEntityRecord(state, kind, name, key, query);
if (plural) {
result[getMethodName(kind, plural, 'get')] = (state, query) => getEntityRecords(state, kind, name, query);
}
return result;
}, {});
const entityResolvers = build_module_entitiesConfig.reduce((result, entity) => {
const {
kind,
name,
plural
} = entity;
result[getMethodName(kind, name)] = (key, query) => resolvers_getEntityRecord(kind, name, key, query);
if (plural) {
const pluralMethodName = getMethodName(kind, plural, 'get');
result[pluralMethodName] = (...args) => resolvers_getEntityRecords(kind, name, ...args);
result[pluralMethodName].shouldInvalidate = action => resolvers_getEntityRecords.shouldInvalidate(action, kind, name);
}
return result;
}, {});
const entityActions = build_module_entitiesConfig.reduce((result, entity) => {
const {
kind,
name
} = entity;
result[getMethodName(kind, name, 'save')] = (record, options) => saveEntityRecord(kind, name, record, options);
result[getMethodName(kind, name, 'delete')] = (key, query, options) => deleteEntityRecord(kind, name, key, query, options);
return result;
}, {});
const storeConfig = () => ({
reducer: build_module_reducer,
actions: {
...build_module_actions_namespaceObject,
...entityActions,
...createLocksActions()
},
selectors: {
...build_module_selectors_namespaceObject,
...entitySelectors
},
resolvers: {
...resolvers_namespaceObject,
...entityResolvers
}
});
/**
* Store definition for the code data namespace.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
*/
const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig());
unlock(store).registerPrivateSelectors(private_selectors_namespaceObject);
unlock(store).registerPrivateActions(private_actions_namespaceObject);
(0,external_wp_data_namespaceObject.register)(store); // Register store after unlocking private selectors to allow resolvers to use them.
})();
(window.wp = window.wp || {}).coreData = __webpack_exports__;
/******/ })()
; var/softaculous/sitepad/editor/site-inc/js/dist/core-data.js 0000644 00000307103 14756456301 0020130 0 ustar 00 this["wp"] = this["wp"] || {}; this["wp"]["coreData"] =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 310);
/******/ })
/************************************************************************/
/******/ ({
/***/ 120:
/***/ (function(module, exports) {
module.exports = function(originalModule) {
if (!originalModule.webpackPolyfill) {
var module = Object.create(originalModule);
// module.parent = undefined by default
if (!module.children) module.children = [];
Object.defineProperty(module, "loaded", {
enumerable: true,
get: function() {
return module.l;
}
});
Object.defineProperty(module, "id", {
enumerable: true,
get: function() {
return module.i;
}
});
Object.defineProperty(module, "exports", {
enumerable: true
});
module.webpackPolyfill = 1;
}
return module;
};
/***/ }),
/***/ 15:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
/***/ }),
/***/ 19:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}
return arr2;
}
}
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
var iterableToArray = __webpack_require__(33);
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; });
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread();
}
/***/ }),
/***/ 2:
/***/ (function(module, exports) {
(function() { module.exports = this["lodash"]; }());
/***/ }),
/***/ 24:
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["url"]; }());
/***/ }),
/***/ 25:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
var arrayWithHoles = __webpack_require__(35);
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
function _iterableToArrayLimit(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
var nonIterableRest = __webpack_require__(36);
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; });
function _slicedToArray(arr, i) {
return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(nonIterableRest["a" /* default */])();
}
/***/ }),
/***/ 30:
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["apiFetch"]; }());
/***/ }),
/***/ 31:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var LEAF_KEY, hasWeakMap;
/**
* Arbitrary value used as key for referencing cache object in WeakMap tree.
*
* @type {Object}
*/
LEAF_KEY = {};
/**
* Whether environment supports WeakMap.
*
* @type {boolean}
*/
hasWeakMap = typeof WeakMap !== 'undefined';
/**
* Returns the first argument as the sole entry in an array.
*
* @param {*} value Value to return.
*
* @return {Array} Value returned as entry in array.
*/
function arrayOf( value ) {
return [ value ];
}
/**
* Returns true if the value passed is object-like, or false otherwise. A value
* is object-like if it can support property assignment, e.g. object or array.
*
* @param {*} value Value to test.
*
* @return {boolean} Whether value is object-like.
*/
function isObjectLike( value ) {
return !! value && 'object' === typeof value;
}
/**
* Creates and returns a new cache object.
*
* @return {Object} Cache object.
*/
function createCache() {
var cache = {
clear: function() {
cache.head = null;
},
};
return cache;
}
/**
* Returns true if entries within the two arrays are strictly equal by
* reference from a starting index.
*
* @param {Array} a First array.
* @param {Array} b Second array.
* @param {number} fromIndex Index from which to start comparison.
*
* @return {boolean} Whether arrays are shallowly equal.
*/
function isShallowEqual( a, b, fromIndex ) {
var i;
if ( a.length !== b.length ) {
return false;
}
for ( i = fromIndex; i < a.length; i++ ) {
if ( a[ i ] !== b[ i ] ) {
return false;
}
}
return true;
}
/**
* Returns a memoized selector function. The getDependants function argument is
* called before the memoized selector and is expected to return an immutable
* reference or array of references on which the selector depends for computing
* its own return value. The memoize cache is preserved only as long as those
* dependant references remain the same. If getDependants returns a different
* reference(s), the cache is cleared and the selector value regenerated.
*
* @param {Function} selector Selector function.
* @param {Function} getDependants Dependant getter returning an immutable
* reference or array of reference used in
* cache bust consideration.
*
* @return {Function} Memoized selector.
*/
/* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) {
var rootCache, getCache;
// Use object source as dependant if getter not provided
if ( ! getDependants ) {
getDependants = arrayOf;
}
/**
* Returns the root cache. If WeakMap is supported, this is assigned to the
* root WeakMap cache set, otherwise it is a shared instance of the default
* cache object.
*
* @return {(WeakMap|Object)} Root cache object.
*/
function getRootCache() {
return rootCache;
}
/**
* Returns the cache for a given dependants array. When possible, a WeakMap
* will be used to create a unique cache for each set of dependants. This
* is feasible due to the nature of WeakMap in allowing garbage collection
* to occur on entries where the key object is no longer referenced. Since
* WeakMap requires the key to be an object, this is only possible when the
* dependant is object-like. The root cache is created as a hierarchy where
* each top-level key is the first entry in a dependants set, the value a
* WeakMap where each key is the next dependant, and so on. This continues
* so long as the dependants are object-like. If no dependants are object-
* like, then the cache is shared across all invocations.
*
* @see isObjectLike
*
* @param {Array} dependants Selector dependants.
*
* @return {Object} Cache object.
*/
function getWeakMapCache( dependants ) {
var caches = rootCache,
isUniqueByDependants = true,
i, dependant, map, cache;
for ( i = 0; i < dependants.length; i++ ) {
dependant = dependants[ i ];
// Can only compose WeakMap from object-like key.
if ( ! isObjectLike( dependant ) ) {
isUniqueByDependants = false;
break;
}
// Does current segment of cache already have a WeakMap?
if ( caches.has( dependant ) ) {
// Traverse into nested WeakMap.
caches = caches.get( dependant );
} else {
// Create, set, and traverse into a new one.
map = new WeakMap();
caches.set( dependant, map );
caches = map;
}
}
// We use an arbitrary (but consistent) object as key for the last item
// in the WeakMap to serve as our running cache.
if ( ! caches.has( LEAF_KEY ) ) {
cache = createCache();
cache.isUniqueByDependants = isUniqueByDependants;
caches.set( LEAF_KEY, cache );
}
return caches.get( LEAF_KEY );
}
// Assign cache handler by availability of WeakMap
getCache = hasWeakMap ? getWeakMapCache : getRootCache;
/**
* Resets root memoization cache.
*/
function clear() {
rootCache = hasWeakMap ? new WeakMap() : createCache();
}
// eslint-disable-next-line jsdoc/check-param-names
/**
* The augmented selector call, considering first whether dependants have
* changed before passing it to underlying memoize function.
*
* @param {Object} source Source object for derivation.
* @param {...*} extraArgs Additional arguments to pass to selector.
*
* @return {*} Selector result.
*/
function callSelector( /* source, ...extraArgs */ ) {
var len = arguments.length,
cache, node, i, args, dependants;
// Create copy of arguments (avoid leaking deoptimization).
args = new Array( len );
for ( i = 0; i < len; i++ ) {
args[ i ] = arguments[ i ];
}
dependants = getDependants.apply( null, args );
cache = getCache( dependants );
// If not guaranteed uniqueness by dependants (primitive type or lack
// of WeakMap support), shallow compare against last dependants and, if
// references have changed, destroy cache to recalculate result.
if ( ! cache.isUniqueByDependants ) {
if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
cache.clear();
}
cache.lastDependants = dependants;
}
node = cache.head;
while ( node ) {
// Check whether node arguments match arguments
if ( ! isShallowEqual( node.args, args, 1 ) ) {
node = node.next;
continue;
}
// At this point we can assume we've found a match
// Surface matched node to head if not already
if ( node !== cache.head ) {
// Adjust siblings to point to each other.
node.prev.next = node.next;
if ( node.next ) {
node.next.prev = node.prev;
}
node.next = cache.head;
node.prev = null;
cache.head.prev = node;
cache.head = node;
}
// Return immediately
return node.val;
}
// No cached value found. Continue to insertion phase:
node = {
// Generate the result from original function
val: selector.apply( null, args ),
};
// Avoid including the source object in the cache.
args[ 0 ] = null;
node.args = args;
// Don't need to check whether node is already head, since it would
// have been returned above already if it was
// Shift existing head down list
if ( cache.head ) {
cache.head.prev = node;
node.next = cache.head;
}
cache.head = node;
return node.val;
}
callSelector.getDependants = getDependants;
callSelector.clear = clear;
clear();
return callSelector;
});
/***/ }),
/***/ 310:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
var build_module_actions_namespaceObject = {};
__webpack_require__.r(build_module_actions_namespaceObject);
__webpack_require__.d(build_module_actions_namespaceObject, "receiveUserQuery", function() { return receiveUserQuery; });
__webpack_require__.d(build_module_actions_namespaceObject, "addEntities", function() { return addEntities; });
__webpack_require__.d(build_module_actions_namespaceObject, "receiveEntityRecords", function() { return receiveEntityRecords; });
__webpack_require__.d(build_module_actions_namespaceObject, "receiveThemeSupports", function() { return receiveThemeSupports; });
__webpack_require__.d(build_module_actions_namespaceObject, "receiveEmbedPreview", function() { return receiveEmbedPreview; });
__webpack_require__.d(build_module_actions_namespaceObject, "saveEntityRecord", function() { return saveEntityRecord; });
__webpack_require__.d(build_module_actions_namespaceObject, "receiveUploadPermissions", function() { return receiveUploadPermissions; });
var build_module_selectors_namespaceObject = {};
__webpack_require__.r(build_module_selectors_namespaceObject);
__webpack_require__.d(build_module_selectors_namespaceObject, "isRequestingEmbedPreview", function() { return isRequestingEmbedPreview; });
__webpack_require__.d(build_module_selectors_namespaceObject, "getAuthors", function() { return getAuthors; });
__webpack_require__.d(build_module_selectors_namespaceObject, "getUserQueryResults", function() { return getUserQueryResults; });
__webpack_require__.d(build_module_selectors_namespaceObject, "getEntitiesByKind", function() { return getEntitiesByKind; });
__webpack_require__.d(build_module_selectors_namespaceObject, "getEntity", function() { return getEntity; });
__webpack_require__.d(build_module_selectors_namespaceObject, "getEntityRecord", function() { return getEntityRecord; });
__webpack_require__.d(build_module_selectors_namespaceObject, "getEntityRecords", function() { return getEntityRecords; });
__webpack_require__.d(build_module_selectors_namespaceObject, "getThemeSupports", function() { return getThemeSupports; });
__webpack_require__.d(build_module_selectors_namespaceObject, "getEmbedPreview", function() { return getEmbedPreview; });
__webpack_require__.d(build_module_selectors_namespaceObject, "isPreviewEmbedFallback", function() { return isPreviewEmbedFallback; });
__webpack_require__.d(build_module_selectors_namespaceObject, "hasUploadPermissions", function() { return selectors_hasUploadPermissions; });
var resolvers_namespaceObject = {};
__webpack_require__.r(resolvers_namespaceObject);
__webpack_require__.d(resolvers_namespaceObject, "getAuthors", function() { return resolvers_getAuthors; });
__webpack_require__.d(resolvers_namespaceObject, "getEntityRecord", function() { return resolvers_getEntityRecord; });
__webpack_require__.d(resolvers_namespaceObject, "getEntityRecords", function() { return resolvers_getEntityRecords; });
__webpack_require__.d(resolvers_namespaceObject, "getThemeSupports", function() { return resolvers_getThemeSupports; });
__webpack_require__.d(resolvers_namespaceObject, "getEmbedPreview", function() { return resolvers_getEmbedPreview; });
__webpack_require__.d(resolvers_namespaceObject, "hasUploadPermissions", function() { return resolvers_hasUploadPermissions; });
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js
var objectSpread = __webpack_require__(8);
// EXTERNAL MODULE: external {"this":["wp","data"]}
var external_this_wp_data_ = __webpack_require__(5);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
var slicedToArray = __webpack_require__(25);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
var toConsumableArray = __webpack_require__(19);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
var defineProperty = __webpack_require__(15);
// EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__(2);
// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/if-matching-action.js
/**
* A higher-order reducer creator which invokes the original reducer only if
* the dispatching action matches the given predicate, **OR** if state is
* initializing (undefined).
*
* @param {Function} isMatch Function predicate for allowing reducer call.
*
* @return {Function} Higher-order reducer.
*/
var ifMatchingAction = function ifMatchingAction(isMatch) {
return function (reducer) {
return function (state, action) {
if (state === undefined || isMatch(action)) {
return reducer(state, action);
}
return state;
};
};
};
/* harmony default export */ var if_matching_action = (ifMatchingAction);
// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/on-sub-key.js
/**
* Higher-order reducer creator which creates a combined reducer object, keyed
* by a property on the action object.
*
* @param {string} actionProperty Action property by which to key object.
*
* @return {Function} Higher-order reducer.
*/
var on_sub_key_onSubKey = function onSubKey(actionProperty) {
return function (reducer) {
return function () {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var action = arguments.length > 1 ? arguments[1] : undefined;
// Retrieve subkey from action. Do not track if undefined; useful for cases
// where reducer is scoped by action shape.
var key = action[actionProperty];
if (key === undefined) {
return state;
} // Avoid updating state if unchanged. Note that this also accounts for a
// reducer which returns undefined on a key which is not yet tracked.
var nextKeyState = reducer(state[key], action);
if (nextKeyState === state[key]) {
return state;
}
return Object(objectSpread["a" /* default */])({}, state, Object(defineProperty["a" /* default */])({}, key, nextKeyState));
};
};
};
/* harmony default export */ var on_sub_key = (on_sub_key_onSubKey);
// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/replace-action.js
/**
* Higher-order reducer creator which substitutes the action object before
* passing to the original reducer.
*
* @param {Function} replacer Function mapping original action to replacement.
*
* @return {Function} Higher-order reducer.
*/
var replaceAction = function replaceAction(replacer) {
return function (reducer) {
return function (state, action) {
return reducer(state, replacer(action));
};
};
};
/* harmony default export */ var replace_action = (replaceAction);
// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/with-weak-map-cache.js
/**
* External dependencies
*/
/**
* Given a function, returns an enhanced function which caches the result and
* tracks in WeakMap. The result is only cached if the original function is
* passed a valid object-like argument (requirement for WeakMap key).
*
* @param {Function} fn Original function.
*
* @return {Function} Enhanced caching function.
*/
function withWeakMapCache(fn) {
var cache = new WeakMap();
return function (key) {
var value;
if (cache.has(key)) {
value = cache.get(key);
} else {
value = fn(key); // Can reach here if key is not valid for WeakMap, since `has`
// will return false for invalid key. Since `set` will throw,
// ensure that key is valid before setting into cache.
if (Object(external_lodash_["isObjectLike"])(key)) {
cache.set(key, value);
}
}
return value;
};
}
/* harmony default export */ var with_weak_map_cache = (withWeakMapCache);
// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/index.js
// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/queried-data/actions.js
/**
* External dependencies
*/
/**
* Returns an action object used in signalling that items have been received.
*
* @param {Array} items Items received.
*
* @return {Object} Action object.
*/
function receiveItems(items) {
return {
type: 'RECEIVE_ITEMS',
items: Object(external_lodash_["castArray"])(items)
};
}
/**
* Returns an action object used in signalling that queried data has been
* received.
*
* @param {Array} items Queried items received.
* @param {?Object} query Optional query object.
*
* @return {Object} Action object.
*/
function receiveQueriedItems(items) {
var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return Object(objectSpread["a" /* default */])({}, receiveItems(items), {
query: query
});
}
// EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
var rememo = __webpack_require__(31);
// EXTERNAL MODULE: ./node_modules/equivalent-key-map/equivalent-key-map.js
var equivalent_key_map = __webpack_require__(66);
var equivalent_key_map_default = /*#__PURE__*/__webpack_require__.n(equivalent_key_map);
// EXTERNAL MODULE: external {"this":["wp","url"]}
var external_this_wp_url_ = __webpack_require__(24);
// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/queried-data/get-query-parts.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* An object of properties describing a specific query.
*
* @typedef {WPQueriedDataQueryParts}
*
* @property {number} page The query page (1-based index, default 1).
* @property {number} perPage Items per page for query (default 10).
* @property {string} stableKey An encoded stable string of all non-pagination
* query parameters.
*/
/**
* Given a query object, returns an object of parts, including pagination
* details (`page` and `perPage`, or default values). All other properties are
* encoded into a stable (idempotent) `stableKey` value.
*
* @param {Object} query Optional query object.
*
* @return {WPQueriedDataQueryParts} Query parts.
*/
function getQueryParts(query) {
/**
* @type {WPQueriedDataQueryParts}
*/
var parts = {
stableKey: '',
page: 1,
perPage: 10
}; // Ensure stable key by sorting keys. Also more efficient for iterating.
var keys = Object.keys(query).sort();
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var value = query[key];
switch (key) {
case 'page':
parts[key] = Number(value);
break;
case 'per_page':
parts.perPage = Number(value);
break;
default:
// While it could be any deterministic string, for simplicity's
// sake mimic querystring encoding for stable key.
//
// TODO: For consistency with PHP implementation, addQueryArgs
// should accept a key value pair, which may optimize its
// implementation for our use here, vs. iterating an object
// with only a single key.
parts.stableKey += (parts.stableKey ? '&' : '') + Object(external_this_wp_url_["addQueryArgs"])('', Object(defineProperty["a" /* default */])({}, key, value)).slice(1);
}
}
return parts;
}
/* harmony default export */ var get_query_parts = (with_weak_map_cache(getQueryParts));
// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/queried-data/selectors.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
/**
* Cache of state keys to EquivalentKeyMap where the inner map tracks queries
* to their resulting items set. WeakMap allows garbage collection on expired
* state references.
*
* @type {WeakMap