Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../js/dist
File: compose.js
if (callbackRefElement.current) {
[5000] Fix | Delete
element = callbackRefElement.current;
[5001] Fix | Delete
} else if (refOrElement) {
[5002] Fix | Delete
if (refOrElement instanceof HTMLElement) {
[5003] Fix | Delete
element = refOrElement;
[5004] Fix | Delete
} else {
[5005] Fix | Delete
element = refOrElement.current;
[5006] Fix | Delete
}
[5007] Fix | Delete
}
[5008] Fix | Delete
if (lastReportRef.current && lastReportRef.current.element === element && lastReportRef.current.reporter === callSubscriber) {
[5009] Fix | Delete
return;
[5010] Fix | Delete
}
[5011] Fix | Delete
if (cleanupRef.current) {
[5012] Fix | Delete
cleanupRef.current();
[5013] Fix | Delete
// Making sure the cleanup is not called accidentally multiple times.
[5014] Fix | Delete
cleanupRef.current = null;
[5015] Fix | Delete
}
[5016] Fix | Delete
lastReportRef.current = {
[5017] Fix | Delete
reporter: callSubscriber,
[5018] Fix | Delete
element
[5019] Fix | Delete
};
[5020] Fix | Delete
[5021] Fix | Delete
// Only calling the subscriber, if there's an actual element to report.
[5022] Fix | Delete
if (element) {
[5023] Fix | Delete
cleanupRef.current = subscriber(element);
[5024] Fix | Delete
}
[5025] Fix | Delete
}, [refOrElement, subscriber]);
[5026] Fix | Delete
[5027] Fix | Delete
// On each render, we check whether a ref changed, or if we got a new raw
[5028] Fix | Delete
// element.
[5029] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[5030] Fix | Delete
// With this we're *technically* supporting cases where ref objects' current value changes, but only if there's a
[5031] Fix | Delete
// render accompanying that change as well.
[5032] Fix | Delete
// To guarantee we always have the right element, one must use the ref callback provided instead, but we support
[5033] Fix | Delete
// RefObjects to make the hook API more convenient in certain cases.
[5034] Fix | Delete
callSubscriber();
[5035] Fix | Delete
}, [callSubscriber]);
[5036] Fix | Delete
return (0,external_wp_element_namespaceObject.useCallback)(element => {
[5037] Fix | Delete
callbackRefElement.current = element;
[5038] Fix | Delete
callSubscriber();
[5039] Fix | Delete
}, [callSubscriber]);
[5040] Fix | Delete
}
[5041] Fix | Delete
[5042] Fix | Delete
// Declaring my own type here instead of using the one provided by TS (available since 4.2.2), because this way I'm not
[5043] Fix | Delete
// forcing consumers to use a specific TS version.
[5044] Fix | Delete
[5045] Fix | Delete
// We're only using the first element of the size sequences, until future versions of the spec solidify on how
[5046] Fix | Delete
// exactly it'll be used for fragments in multi-column scenarios:
[5047] Fix | Delete
// From the spec:
[5048] Fix | Delete
// > The box size properties are exposed as FrozenArray in order to support elements that have multiple fragments,
[5049] Fix | Delete
// > which occur in multi-column scenarios. However the current definitions of content rect and border box do not
[5050] Fix | Delete
// > mention how those boxes are affected by multi-column layout. In this spec, there will only be a single
[5051] Fix | Delete
// > ResizeObserverSize returned in the FrozenArray, which will correspond to the dimensions of the first column.
[5052] Fix | Delete
// > A future version of this spec will extend the returned FrozenArray to contain the per-fragment size information.
[5053] Fix | Delete
// (https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface)
[5054] Fix | Delete
//
[5055] Fix | Delete
// Also, testing these new box options revealed that in both Chrome and FF everything is returned in the callback,
[5056] Fix | Delete
// regardless of the "box" option.
[5057] Fix | Delete
// The spec states the following on this:
[5058] Fix | Delete
// > This does not have any impact on which box dimensions are returned to the defined callback when the event
[5059] Fix | Delete
// > is fired, it solely defines which box the author wishes to observe layout changes on.
[5060] Fix | Delete
// (https://drafts.csswg.org/resize-observer/#resize-observer-interface)
[5061] Fix | Delete
// I'm not exactly clear on what this means, especially when you consider a later section stating the following:
[5062] Fix | Delete
// > This section is non-normative. An author may desire to observe more than one CSS box.
[5063] Fix | Delete
// > In this case, author will need to use multiple ResizeObservers.
[5064] Fix | Delete
// (https://drafts.csswg.org/resize-observer/#resize-observer-interface)
[5065] Fix | Delete
// Which is clearly not how current browser implementations behave, and seems to contradict the previous quote.
[5066] Fix | Delete
// For this reason I decided to only return the requested size,
[5067] Fix | Delete
// even though it seems we have access to results for all box types.
[5068] Fix | Delete
// This also means that we get to keep the current api, being able to return a simple { width, height } pair,
[5069] Fix | Delete
// regardless of box option.
[5070] Fix | Delete
const extractSize = (entry, boxProp, sizeType) => {
[5071] Fix | Delete
if (!entry[boxProp]) {
[5072] Fix | Delete
if (boxProp === 'contentBoxSize') {
[5073] Fix | Delete
// The dimensions in `contentBoxSize` and `contentRect` are equivalent according to the spec.
[5074] Fix | Delete
// See the 6th step in the description for the RO algorithm:
[5075] Fix | Delete
// https://drafts.csswg.org/resize-observer/#create-and-populate-resizeobserverentry-h
[5076] Fix | Delete
// > Set this.contentRect to logical this.contentBoxSize given target and observedBox of "content-box".
[5077] Fix | Delete
// In real browser implementations of course these objects differ, but the width/height values should be equivalent.
[5078] Fix | Delete
return entry.contentRect[sizeType === 'inlineSize' ? 'width' : 'height'];
[5079] Fix | Delete
}
[5080] Fix | Delete
return undefined;
[5081] Fix | Delete
}
[5082] Fix | Delete
[5083] Fix | Delete
// A couple bytes smaller than calling Array.isArray() and just as effective here.
[5084] Fix | Delete
return entry[boxProp][0] ? entry[boxProp][0][sizeType] :
[5085] Fix | Delete
// TS complains about this, because the RO entry type follows the spec and does not reflect Firefox's current
[5086] Fix | Delete
// behaviour of returning objects instead of arrays for `borderBoxSize` and `contentBoxSize`.
[5087] Fix | Delete
// @ts-ignore
[5088] Fix | Delete
entry[boxProp][sizeType];
[5089] Fix | Delete
};
[5090] Fix | Delete
function useResizeObserver(opts = {}) {
[5091] Fix | Delete
// Saving the callback as a ref. With this, I don't need to put onResize in the
[5092] Fix | Delete
// effect dep array, and just passing in an anonymous function without memoising
[5093] Fix | Delete
// will not reinstantiate the hook's ResizeObserver.
[5094] Fix | Delete
const onResize = opts.onResize;
[5095] Fix | Delete
const onResizeRef = (0,external_wp_element_namespaceObject.useRef)(undefined);
[5096] Fix | Delete
onResizeRef.current = onResize;
[5097] Fix | Delete
const round = opts.round || Math.round;
[5098] Fix | Delete
[5099] Fix | Delete
// Using a single instance throughout the hook's lifetime
[5100] Fix | Delete
const resizeObserverRef = (0,external_wp_element_namespaceObject.useRef)();
[5101] Fix | Delete
const [size, setSize] = (0,external_wp_element_namespaceObject.useState)({
[5102] Fix | Delete
width: undefined,
[5103] Fix | Delete
height: undefined
[5104] Fix | Delete
});
[5105] Fix | Delete
[5106] Fix | Delete
// In certain edge cases the RO might want to report a size change just after
[5107] Fix | Delete
// the component unmounted.
[5108] Fix | Delete
const didUnmount = (0,external_wp_element_namespaceObject.useRef)(false);
[5109] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[5110] Fix | Delete
didUnmount.current = false;
[5111] Fix | Delete
return () => {
[5112] Fix | Delete
didUnmount.current = true;
[5113] Fix | Delete
};
[5114] Fix | Delete
}, []);
[5115] Fix | Delete
[5116] Fix | Delete
// Using a ref to track the previous width / height to avoid unnecessary renders.
[5117] Fix | Delete
const previous = (0,external_wp_element_namespaceObject.useRef)({
[5118] Fix | Delete
width: undefined,
[5119] Fix | Delete
height: undefined
[5120] Fix | Delete
});
[5121] Fix | Delete
[5122] Fix | Delete
// This block is kinda like a useEffect, only it's called whenever a new
[5123] Fix | Delete
// element could be resolved based on the ref option. It also has a cleanup
[5124] Fix | Delete
// function.
[5125] Fix | Delete
const refCallback = useResolvedElement((0,external_wp_element_namespaceObject.useCallback)(element => {
[5126] Fix | Delete
// We only use a single Resize Observer instance, and we're instantiating it on demand, only once there's something to observe.
[5127] Fix | Delete
// This instance is also recreated when the `box` option changes, so that a new observation is fired if there was a previously observed element with a different box option.
[5128] Fix | Delete
if (!resizeObserverRef.current || resizeObserverRef.current.box !== opts.box || resizeObserverRef.current.round !== round) {
[5129] Fix | Delete
resizeObserverRef.current = {
[5130] Fix | Delete
box: opts.box,
[5131] Fix | Delete
round,
[5132] Fix | Delete
instance: new ResizeObserver(entries => {
[5133] Fix | Delete
const entry = entries[0];
[5134] Fix | Delete
let boxProp = 'borderBoxSize';
[5135] Fix | Delete
if (opts.box === 'border-box') {
[5136] Fix | Delete
boxProp = 'borderBoxSize';
[5137] Fix | Delete
} else {
[5138] Fix | Delete
boxProp = opts.box === 'device-pixel-content-box' ? 'devicePixelContentBoxSize' : 'contentBoxSize';
[5139] Fix | Delete
}
[5140] Fix | Delete
const reportedWidth = extractSize(entry, boxProp, 'inlineSize');
[5141] Fix | Delete
const reportedHeight = extractSize(entry, boxProp, 'blockSize');
[5142] Fix | Delete
const newWidth = reportedWidth ? round(reportedWidth) : undefined;
[5143] Fix | Delete
const newHeight = reportedHeight ? round(reportedHeight) : undefined;
[5144] Fix | Delete
if (previous.current.width !== newWidth || previous.current.height !== newHeight) {
[5145] Fix | Delete
const newSize = {
[5146] Fix | Delete
width: newWidth,
[5147] Fix | Delete
height: newHeight
[5148] Fix | Delete
};
[5149] Fix | Delete
previous.current.width = newWidth;
[5150] Fix | Delete
previous.current.height = newHeight;
[5151] Fix | Delete
if (onResizeRef.current) {
[5152] Fix | Delete
onResizeRef.current(newSize);
[5153] Fix | Delete
} else if (!didUnmount.current) {
[5154] Fix | Delete
setSize(newSize);
[5155] Fix | Delete
}
[5156] Fix | Delete
}
[5157] Fix | Delete
})
[5158] Fix | Delete
};
[5159] Fix | Delete
}
[5160] Fix | Delete
resizeObserverRef.current.instance.observe(element, {
[5161] Fix | Delete
box: opts.box
[5162] Fix | Delete
});
[5163] Fix | Delete
return () => {
[5164] Fix | Delete
if (resizeObserverRef.current) {
[5165] Fix | Delete
resizeObserverRef.current.instance.unobserve(element);
[5166] Fix | Delete
}
[5167] Fix | Delete
};
[5168] Fix | Delete
}, [opts.box, round]), opts.ref);
[5169] Fix | Delete
return (0,external_wp_element_namespaceObject.useMemo)(() => ({
[5170] Fix | Delete
ref: refCallback,
[5171] Fix | Delete
width: size.width,
[5172] Fix | Delete
height: size.height
[5173] Fix | Delete
}), [refCallback, size ? size.width : null, size ? size.height : null]);
[5174] Fix | Delete
}
[5175] Fix | Delete
[5176] Fix | Delete
/**
[5177] Fix | Delete
* Hook which allows to listen the resize event of any target element when it changes sizes.
[5178] Fix | Delete
* _Note: `useResizeObserver` will report `null` until after first render.
[5179] Fix | Delete
*
[5180] Fix | Delete
* @example
[5181] Fix | Delete
*
[5182] Fix | Delete
* ```js
[5183] Fix | Delete
* const App = () => {
[5184] Fix | Delete
* const [ resizeListener, sizes ] = useResizeObserver();
[5185] Fix | Delete
*
[5186] Fix | Delete
* return (
[5187] Fix | Delete
* <div>
[5188] Fix | Delete
* { resizeListener }
[5189] Fix | Delete
* Your content here
[5190] Fix | Delete
* </div>
[5191] Fix | Delete
* );
[5192] Fix | Delete
* };
[5193] Fix | Delete
* ```
[5194] Fix | Delete
*/
[5195] Fix | Delete
function useResizeAware() {
[5196] Fix | Delete
const {
[5197] Fix | Delete
ref,
[5198] Fix | Delete
width,
[5199] Fix | Delete
height
[5200] Fix | Delete
} = useResizeObserver();
[5201] Fix | Delete
const sizes = (0,external_wp_element_namespaceObject.useMemo)(() => {
[5202] Fix | Delete
return {
[5203] Fix | Delete
width: width !== null && width !== void 0 ? width : null,
[5204] Fix | Delete
height: height !== null && height !== void 0 ? height : null
[5205] Fix | Delete
};
[5206] Fix | Delete
}, [width, height]);
[5207] Fix | Delete
const resizeListener = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[5208] Fix | Delete
style: {
[5209] Fix | Delete
position: 'absolute',
[5210] Fix | Delete
top: 0,
[5211] Fix | Delete
left: 0,
[5212] Fix | Delete
right: 0,
[5213] Fix | Delete
bottom: 0,
[5214] Fix | Delete
pointerEvents: 'none',
[5215] Fix | Delete
opacity: 0,
[5216] Fix | Delete
overflow: 'hidden',
[5217] Fix | Delete
zIndex: -1
[5218] Fix | Delete
},
[5219] Fix | Delete
"aria-hidden": "true",
[5220] Fix | Delete
ref: ref
[5221] Fix | Delete
});
[5222] Fix | Delete
return [resizeListener, sizes];
[5223] Fix | Delete
}
[5224] Fix | Delete
[5225] Fix | Delete
;// CONCATENATED MODULE: external ["wp","priorityQueue"]
[5226] Fix | Delete
const external_wp_priorityQueue_namespaceObject = window["wp"]["priorityQueue"];
[5227] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-async-list/index.js
[5228] Fix | Delete
/**
[5229] Fix | Delete
* WordPress dependencies
[5230] Fix | Delete
*/
[5231] Fix | Delete
[5232] Fix | Delete
[5233] Fix | Delete
/**
[5234] Fix | Delete
* Returns the first items from list that are present on state.
[5235] Fix | Delete
*
[5236] Fix | Delete
* @param list New array.
[5237] Fix | Delete
* @param state Current state.
[5238] Fix | Delete
* @return First items present iin state.
[5239] Fix | Delete
*/
[5240] Fix | Delete
function getFirstItemsPresentInState(list, state) {
[5241] Fix | Delete
const firstItems = [];
[5242] Fix | Delete
for (let i = 0; i < list.length; i++) {
[5243] Fix | Delete
const item = list[i];
[5244] Fix | Delete
if (!state.includes(item)) {
[5245] Fix | Delete
break;
[5246] Fix | Delete
}
[5247] Fix | Delete
firstItems.push(item);
[5248] Fix | Delete
}
[5249] Fix | Delete
return firstItems;
[5250] Fix | Delete
}
[5251] Fix | Delete
[5252] Fix | Delete
/**
[5253] Fix | Delete
* React hook returns an array which items get asynchronously appended from a source array.
[5254] Fix | Delete
* This behavior is useful if we want to render a list of items asynchronously for performance reasons.
[5255] Fix | Delete
*
[5256] Fix | Delete
* @param list Source array.
[5257] Fix | Delete
* @param config Configuration object.
[5258] Fix | Delete
*
[5259] Fix | Delete
* @return Async array.
[5260] Fix | Delete
*/
[5261] Fix | Delete
function useAsyncList(list, config = {
[5262] Fix | Delete
step: 1
[5263] Fix | Delete
}) {
[5264] Fix | Delete
const {
[5265] Fix | Delete
step = 1
[5266] Fix | Delete
} = config;
[5267] Fix | Delete
const [current, setCurrent] = (0,external_wp_element_namespaceObject.useState)([]);
[5268] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[5269] Fix | Delete
// On reset, we keep the first items that were previously rendered.
[5270] Fix | Delete
let firstItems = getFirstItemsPresentInState(list, current);
[5271] Fix | Delete
if (firstItems.length < step) {
[5272] Fix | Delete
firstItems = firstItems.concat(list.slice(firstItems.length, step));
[5273] Fix | Delete
}
[5274] Fix | Delete
setCurrent(firstItems);
[5275] Fix | Delete
const asyncQueue = (0,external_wp_priorityQueue_namespaceObject.createQueue)();
[5276] Fix | Delete
for (let i = firstItems.length; i < list.length; i += step) {
[5277] Fix | Delete
asyncQueue.add({}, () => {
[5278] Fix | Delete
(0,external_wp_element_namespaceObject.flushSync)(() => {
[5279] Fix | Delete
setCurrent(state => [...state, ...list.slice(i, i + step)]);
[5280] Fix | Delete
});
[5281] Fix | Delete
});
[5282] Fix | Delete
}
[5283] Fix | Delete
return () => asyncQueue.reset();
[5284] Fix | Delete
}, [list]);
[5285] Fix | Delete
return current;
[5286] Fix | Delete
}
[5287] Fix | Delete
/* harmony default export */ const use_async_list = (useAsyncList);
[5288] Fix | Delete
[5289] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-warn-on-change/index.js
[5290] Fix | Delete
/**
[5291] Fix | Delete
* Internal dependencies
[5292] Fix | Delete
*/
[5293] Fix | Delete
[5294] Fix | Delete
[5295] Fix | Delete
// Disable reason: Object and object are distinctly different types in TypeScript and we mean the lowercase object in thise case
[5296] Fix | Delete
// but eslint wants to force us to use `Object`. See https://stackoverflow.com/questions/49464634/difference-between-object-and-object-in-typescript
[5297] Fix | Delete
/* eslint-disable jsdoc/check-types */
[5298] Fix | Delete
/**
[5299] Fix | Delete
* Hook that performs a shallow comparison between the preview value of an object
[5300] Fix | Delete
* and the new one, if there's a difference, it prints it to the console.
[5301] Fix | Delete
* this is useful in performance related work, to check why a component re-renders.
[5302] Fix | Delete
*
[5303] Fix | Delete
* @example
[5304] Fix | Delete
*
[5305] Fix | Delete
* ```jsx
[5306] Fix | Delete
* function MyComponent(props) {
[5307] Fix | Delete
* useWarnOnChange(props);
[5308] Fix | Delete
*
[5309] Fix | Delete
* return "Something";
[5310] Fix | Delete
* }
[5311] Fix | Delete
* ```
[5312] Fix | Delete
*
[5313] Fix | Delete
* @param {object} object Object which changes to compare.
[5314] Fix | Delete
* @param {string} prefix Just a prefix to show when console logging.
[5315] Fix | Delete
*/
[5316] Fix | Delete
function useWarnOnChange(object, prefix = 'Change detection') {
[5317] Fix | Delete
const previousValues = usePrevious(object);
[5318] Fix | Delete
Object.entries(previousValues !== null && previousValues !== void 0 ? previousValues : []).forEach(([key, value]) => {
[5319] Fix | Delete
if (value !== object[( /** @type {keyof typeof object} */key)]) {
[5320] Fix | Delete
// eslint-disable-next-line no-console
[5321] Fix | Delete
console.warn(`${prefix}: ${key} key changed:`, value, object[( /** @type {keyof typeof object} */key)]
[5322] Fix | Delete
/* eslint-enable jsdoc/check-types */);
[5323] Fix | Delete
}
[5324] Fix | Delete
});
[5325] Fix | Delete
}
[5326] Fix | Delete
/* harmony default export */ const use_warn_on_change = (useWarnOnChange);
[5327] Fix | Delete
[5328] Fix | Delete
;// CONCATENATED MODULE: external "React"
[5329] Fix | Delete
const external_React_namespaceObject = window["React"];
[5330] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/use-memo-one/dist/use-memo-one.esm.js
[5331] Fix | Delete
[5332] Fix | Delete
[5333] Fix | Delete
function areInputsEqual(newInputs, lastInputs) {
[5334] Fix | Delete
if (newInputs.length !== lastInputs.length) {
[5335] Fix | Delete
return false;
[5336] Fix | Delete
}
[5337] Fix | Delete
[5338] Fix | Delete
for (var i = 0; i < newInputs.length; i++) {
[5339] Fix | Delete
if (newInputs[i] !== lastInputs[i]) {
[5340] Fix | Delete
return false;
[5341] Fix | Delete
}
[5342] Fix | Delete
}
[5343] Fix | Delete
[5344] Fix | Delete
return true;
[5345] Fix | Delete
}
[5346] Fix | Delete
[5347] Fix | Delete
function useMemoOne(getResult, inputs) {
[5348] Fix | Delete
var initial = (0,external_React_namespaceObject.useState)(function () {
[5349] Fix | Delete
return {
[5350] Fix | Delete
inputs: inputs,
[5351] Fix | Delete
result: getResult()
[5352] Fix | Delete
};
[5353] Fix | Delete
})[0];
[5354] Fix | Delete
var isFirstRun = (0,external_React_namespaceObject.useRef)(true);
[5355] Fix | Delete
var committed = (0,external_React_namespaceObject.useRef)(initial);
[5356] Fix | Delete
var useCache = isFirstRun.current || Boolean(inputs && committed.current.inputs && areInputsEqual(inputs, committed.current.inputs));
[5357] Fix | Delete
var cache = useCache ? committed.current : {
[5358] Fix | Delete
inputs: inputs,
[5359] Fix | Delete
result: getResult()
[5360] Fix | Delete
};
[5361] Fix | Delete
(0,external_React_namespaceObject.useEffect)(function () {
[5362] Fix | Delete
isFirstRun.current = false;
[5363] Fix | Delete
committed.current = cache;
[5364] Fix | Delete
}, [cache]);
[5365] Fix | Delete
return cache.result;
[5366] Fix | Delete
}
[5367] Fix | Delete
function useCallbackOne(callback, inputs) {
[5368] Fix | Delete
return useMemoOne(function () {
[5369] Fix | Delete
return callback;
[5370] Fix | Delete
}, inputs);
[5371] Fix | Delete
}
[5372] Fix | Delete
var useMemo = (/* unused pure expression or super */ null && (useMemoOne));
[5373] Fix | Delete
var useCallback = (/* unused pure expression or super */ null && (useCallbackOne));
[5374] Fix | Delete
[5375] Fix | Delete
[5376] Fix | Delete
[5377] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-debounce/index.js
[5378] Fix | Delete
/**
[5379] Fix | Delete
* External dependencies
[5380] Fix | Delete
*/
[5381] Fix | Delete
[5382] Fix | Delete
[5383] Fix | Delete
/**
[5384] Fix | Delete
* WordPress dependencies
[5385] Fix | Delete
*/
[5386] Fix | Delete
[5387] Fix | Delete
[5388] Fix | Delete
/**
[5389] Fix | Delete
* Internal dependencies
[5390] Fix | Delete
*/
[5391] Fix | Delete
[5392] Fix | Delete
[5393] Fix | Delete
/**
[5394] Fix | Delete
* Debounces a function similar to Lodash's `debounce`. A new debounced function will
[5395] Fix | Delete
* be returned and any scheduled calls cancelled if any of the arguments change,
[5396] Fix | Delete
* including the function to debounce, so please wrap functions created on
[5397] Fix | Delete
* render in components in `useCallback`.
[5398] Fix | Delete
*
[5399] Fix | Delete
* @see https://lodash.com/docs/4#debounce
[5400] Fix | Delete
*
[5401] Fix | Delete
* @template {(...args: any[]) => void} TFunc
[5402] Fix | Delete
*
[5403] Fix | Delete
* @param {TFunc} fn The function to debounce.
[5404] Fix | Delete
* @param {number} [wait] The number of milliseconds to delay.
[5405] Fix | Delete
* @param {import('../../utils/debounce').DebounceOptions} [options] The options object.
[5406] Fix | Delete
* @return {import('../../utils/debounce').DebouncedFunc<TFunc>} Debounced function.
[5407] Fix | Delete
*/
[5408] Fix | Delete
function useDebounce(fn, wait, options) {
[5409] Fix | Delete
const debounced = useMemoOne(() => debounce(fn, wait !== null && wait !== void 0 ? wait : 0, options), [fn, wait, options]);
[5410] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => () => debounced.cancel(), [debounced]);
[5411] Fix | Delete
return debounced;
[5412] Fix | Delete
}
[5413] Fix | Delete
[5414] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-debounced-input/index.js
[5415] Fix | Delete
/**
[5416] Fix | Delete
* WordPress dependencies
[5417] Fix | Delete
*/
[5418] Fix | Delete
[5419] Fix | Delete
[5420] Fix | Delete
/**
[5421] Fix | Delete
* Internal dependencies
[5422] Fix | Delete
*/
[5423] Fix | Delete
[5424] Fix | Delete
[5425] Fix | Delete
/**
[5426] Fix | Delete
* Helper hook for input fields that need to debounce the value before using it.
[5427] Fix | Delete
*
[5428] Fix | Delete
* @param defaultValue The default value to use.
[5429] Fix | Delete
* @return The input value, the setter and the debounced input value.
[5430] Fix | Delete
*/
[5431] Fix | Delete
function useDebouncedInput(defaultValue = '') {
[5432] Fix | Delete
const [input, setInput] = (0,external_wp_element_namespaceObject.useState)(defaultValue);
[5433] Fix | Delete
const [debouncedInput, setDebouncedState] = (0,external_wp_element_namespaceObject.useState)(defaultValue);
[5434] Fix | Delete
const setDebouncedInput = useDebounce(setDebouncedState, 250);
[5435] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[5436] Fix | Delete
setDebouncedInput(input);
[5437] Fix | Delete
}, [input, setDebouncedInput]);
[5438] Fix | Delete
return [input, setInput, debouncedInput];
[5439] Fix | Delete
}
[5440] Fix | Delete
[5441] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-throttle/index.js
[5442] Fix | Delete
/**
[5443] Fix | Delete
* External dependencies
[5444] Fix | Delete
*/
[5445] Fix | Delete
[5446] Fix | Delete
[5447] Fix | Delete
/**
[5448] Fix | Delete
* WordPress dependencies
[5449] Fix | Delete
*/
[5450] Fix | Delete
[5451] Fix | Delete
[5452] Fix | Delete
/**
[5453] Fix | Delete
* Internal dependencies
[5454] Fix | Delete
*/
[5455] Fix | Delete
[5456] Fix | Delete
[5457] Fix | Delete
/**
[5458] Fix | Delete
* Throttles a function similar to Lodash's `throttle`. A new throttled function will
[5459] Fix | Delete
* be returned and any scheduled calls cancelled if any of the arguments change,
[5460] Fix | Delete
* including the function to throttle, so please wrap functions created on
[5461] Fix | Delete
* render in components in `useCallback`.
[5462] Fix | Delete
*
[5463] Fix | Delete
* @see https://lodash.com/docs/4#throttle
[5464] Fix | Delete
*
[5465] Fix | Delete
* @template {(...args: any[]) => void} TFunc
[5466] Fix | Delete
*
[5467] Fix | Delete
* @param {TFunc} fn The function to throttle.
[5468] Fix | Delete
* @param {number} [wait] The number of milliseconds to throttle invocations to.
[5469] Fix | Delete
* @param {import('../../utils/throttle').ThrottleOptions} [options] The options object. See linked documentation for details.
[5470] Fix | Delete
* @return {import('../../utils/debounce').DebouncedFunc<TFunc>} Throttled function.
[5471] Fix | Delete
*/
[5472] Fix | Delete
function useThrottle(fn, wait, options) {
[5473] Fix | Delete
const throttled = useMemoOne(() => throttle(fn, wait !== null && wait !== void 0 ? wait : 0, options), [fn, wait, options]);
[5474] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => () => throttled.cancel(), [throttled]);
[5475] Fix | Delete
return throttled;
[5476] Fix | Delete
}
[5477] Fix | Delete
[5478] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-drop-zone/index.js
[5479] Fix | Delete
/**
[5480] Fix | Delete
* WordPress dependencies
[5481] Fix | Delete
*/
[5482] Fix | Delete
[5483] Fix | Delete
[5484] Fix | Delete
/**
[5485] Fix | Delete
* Internal dependencies
[5486] Fix | Delete
*/
[5487] Fix | Delete
[5488] Fix | Delete
[5489] Fix | Delete
/* eslint-disable jsdoc/valid-types */
[5490] Fix | Delete
/**
[5491] Fix | Delete
* @template T
[5492] Fix | Delete
* @param {T} value
[5493] Fix | Delete
* @return {import('react').MutableRefObject<T|null>} A ref with the value.
[5494] Fix | Delete
*/
[5495] Fix | Delete
function useFreshRef(value) {
[5496] Fix | Delete
/* eslint-enable jsdoc/valid-types */
[5497] Fix | Delete
/* eslint-disable jsdoc/no-undefined-types */
[5498] Fix | Delete
/** @type {import('react').MutableRefObject<T>} */
[5499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function