PageSourceSearch

https://www.archivioflamigni.org/wp-includes/js/dist/notices.js?ver=218d0173a31ae7269246

js archivioflamigni.org collected 2026-10-02 19:45:57 UTC 10,356 bytes, 301 lines download raw bytes

1"use strict";
2var wp;
3(wp ||= {}).notices = (() => {
4  var __create = Object.create;
5  var __defProp = Object.defineProperty;
6  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7  var __getOwnPropNames = Object.getOwnPropertyNames;
8  var __getProtoOf = Object.getPrototypeOf;
9  var __hasOwnProp = Object.prototype.hasOwnProperty;
10  var __commonJS = (cb, mod) => function __require() {
11    return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12  };
13  var __export = (target, all) => {
14    for (var name in all)
15      __defProp(target, name, { get: all[name], enumerable: true });
16  };
17  var __copyProps = (to, from, except, desc) => {
18    if (from && typeof from === "object" || typeof from === "function") {
19      for (let key of __getOwnPropNames(from))
20        if (!__hasOwnProp.call(to, key) && key !== except)
21          __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22    }
23    return to;
24  };
25  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26    // If the importer is in node compatibility mode or this is not an ESM
27    // file that has been converted to a CommonJS file using a Babel-
28    // compatible transform (i.e. "__esModule" has not been set), then set
29    // "default" to the CommonJS "module.exports" for node compatibility.
30    isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31    mod
32  ));
33  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
35  // package-external:@wordpress/data
36  var require_data = __commonJS({
37    "package-external:@wordpress/data"(exports, module) {
38      module.exports = window.wp.data;
39    }
40  });
41
42  // package-external:@wordpress/components
43  var require_components = __commonJS({
44    "package-external:@wordpress/components"(exports, module) {
45      module.exports = window.wp.components;
46    }
47  });
48
49  // vendor-external:react/jsx-runtime
50  var require_jsx_runtime = __commonJS({
51    "vendor-external:react/jsx-runtime"(exports, module) {
52      module.exports = window.ReactJSXRuntime;
53    }
54  });
55
56  
56// packages/notices/build-module/index.mjs
57  var index_exports = {};
58  __export(index_exports, {
59    InlineNotices: () => InlineNotices,
60    SnackbarNotices: () => SnackbarNotices,
61    store: () => store
62  });
63
64  
64// packages/notices/build-module/store/index.mjs
65  var import_data = __toESM(require_data(), 1);
66
67  
67// packages/notices/build-module/store/utils/on-sub-key.mjs
68  var onSubKey = (actionProperty) => (reducer) => (state = {}, action) => {
69    const key = action[actionProperty];
70    if (key === void 0) {
71      return state;
72    }
73    const nextKeyState = reducer(state[key], action);
74    if (nextKeyState === state[key]) {
75      return state;
76    }
77    return {
78      ...state,
79      [key]: nextKeyState
80    };
81  };
82  var on_sub_key_default = onSubKey;
83
84  
84// packages/notices/build-module/store/reducer.mjs
85  var notices = on_sub_key_default("context")((state = [], action) => {
86    switch (action.type) {
87      case "CREATE_NOTICE":
88        return [
89          ...state.filter(({ id }) => id !== action.notice.id),
90          action.notice
91        ];
92      case "REMOVE_NOTICE":
93        return state.filter(({ id }) => id !== action.id);
94      case "REMOVE_NOTICES":
95        return state.filter(({ id }) => !action.ids.includes(id));
96      case "REMOVE_ALL_NOTICES":
97        return state.filter(({ type }) => type !== action.noticeType);
98      default:
99        return state;
100    }
101  });
102  var reducer_default = notices;
103
104  
104// packages/notices/build-module/store/actions.mjs
105  var actions_exports = {};
106  __export(actions_exports, {
107    createErrorNotice: () => createErrorNotice,
108    createInfoNotice: () => createInfoNotice,
109    createNotice: () => createNotice,
110    createSuccessNotice: () => createSuccessNotice,
111    createWarningNotice: () => createWarningNotice,
112    removeAllNotices: () => removeAllNotices,
113    removeNotice: () => removeNotice,
114    removeNotices: () => removeNotices
115  });
116
117  
117// packages/notices/build-module/store/constants.mjs
118  var DEFAULT_CONTEXT = "global";
119  var DEFAULT_STATUS = "info";
120
121  
121// packages/notices/build-module/store/actions.mjs
122  var uniqueId = 0;
123  function createNotice(status = DEFAULT_STATUS, content, options = {}) {
124    const {
125      speak = true,
126      isDismissible = true,
127      context = DEFAULT_CONTEXT,
128      id = `${context}${++uniqueId}`,
129      actions = [],
130      type = "default",
131      __unstableHTML,
132      icon = null,
133      explicitDismiss = false,
134      onDismiss
135    } = options;
136    content = String(content);
137    return {
138      type: "CREATE_NOTICE",
139      context,
140      notice: {
141        id,
142        status,
143        content,
144        spokenMessage: speak ? content : null,
145        __unstableHTML,
146        isDismissible,
147        actions,
148        type,
149        icon,
150        explicitDismiss,
151        onDismiss
152      }
153    };
154  }
155  function createSuccessNotice(content, options) {
156    return createNotice("success", content, options);
157  }
158  function createInfoNotice(content, options) {
159    return createNotice("info", content, options);
160  }
161  function createErrorNotice(content, options) {
162    return createNotice("error", content, options);
163  }
164  function createWarningNotice(content, options) {
165    return createNotice("warning", content, options);
166  }
167  function removeNotice(id, context = DEFAULT_CONTEXT) {
168    return {
169      type: "REMOVE_NOTICE",
170      id,
171      context
172    };
173  }
174  function removeAllNotices(noticeType = "default", context = DEFAULT_CONTEXT) {
175    return {
176      type: "REMOVE_ALL_NOTICES",
177      noticeType,
178      context
179    };
180  }
181  function removeNotices(ids, context = DEFAULT_CONTEXT) {
182    return {
183      type: "REMOVE_NOTICES",
184      ids,
185      context
186    };
187  }
188
189  
189// packages/notices/build-module/store/selectors.mjs
190  var selectors_exports = {};
191  __export(selectors_exports, {
192    getNotices: () => getNotices
193  });
194  var DEFAULT_NOTICES = [];
195  function getNotices(state, context = DEFAULT_CONTEXT) {
196    return state[context] || DEFAULT_NOTICES;
197  }
198
199  
199// packages/notices/build-module/store/index.mjs
200  var store = (0, import_data.createReduxStore)("core/notices", {
201    reducer: reducer_default,
202    actions: actions_exports,
203    selectors: selectors_exports
204  });
205  (0, import_data.register)(store);
206
207  
vendor: 578 bytes, lines 207-223
207// node_modules/clsx/dist/clsx.mjs
208  function r(e) {
209    var t, f, n = "";
210    if ("string" == typeof e || "number" == typeof e) n += e;
211    else if ("object" == typeof e) if (Array.isArray(e)) {
212      var o = e.length;
213      for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
214    } else for (f in e) e[f] && (n && (n += " "), n += f);
215    return n;
216  }
217  function clsx() {
218    for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
219    return n;
220  }
221  var clsx_default = clsx;
222
223  
223// packages/notices/build-module/components/inline-notices/index.mjs
224  var import_components = __toESM(require_components(), 1);
225  var import_data2 = __toESM(require_data(), 1);
226  var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
227  if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='51ef33823e']")) {
228    const style = document.createElement("style");
229    style.setAttribute("data-wp-hash", "51ef33823e");
230    style.appendChild(document.createTextNode(".components-notices__dismissible,.components-notices__pinned{color:#1e1e1e}.components-notices__dismissible .components-notice,.components-notices__pinned .components-notice{border-bottom:1px solid #0003;box-sizing:border-box;min-height:64px;padding:0 12px}.components-notices__dismissible .components-notice .components-notice__dismiss,.components-notices__pinned .components-notice .components-notice__dismiss{margin-top:12px}"));
231    document.head.appendChild(style);
232  }
233  function InlineNotices({
234    children,
235    pinnedNoticesClassName,
236    dismissibleNoticesClassName,
237    context
238  }) {
239    const notices2 = (0, import_data2.useSelect)(
240      (select) => select(store).getNotices(context),
241      [context]
242    );
243    const { removeNotice: removeNotice2 } = (0, import_data2.useDispatch)(store);
244    const dismissibleNotices = notices2.filter(
245      ({ isDismissible, type }) => isDismissible && type === "default"
246    );
247    const nonDismissibleNotices = notices2.filter(
248      ({ isDismissible, type }) => !isDismissible && type === "default"
249    );
250    return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
251      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
252        import_components.NoticeList,
253        {
254          notices: nonDismissibleNotices,
255          className: clsx_default(
256            "components-notices__pinned",
257            pinnedNoticesClassName
258          )
259        }
260      ),
261      /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
262        import_components.NoticeList,
263        {
264          notices: dismissibleNotices,
265          className: clsx_default(
266            "components-notices__dismissible",
267            dismissibleNoticesClassName
268          ),
269          onRemove: (id) => removeNotice2(id, context),
270          children
271        }
272      )
273    ] });
274  }
275
276  
276// packages/notices/build-module/components/snackbar-notices/index.mjs
277  var import_components2 = __toESM(require_components(), 1);
278  var import_data3 = __toESM(require_data(), 1);
279  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
280  var MAX_VISIBLE_NOTICES = -3;
281  function SnackbarNotices({
282    className,
283    context
284  }) {
285    const notices2 = (0, import_data3.useSelect)(
286      (select) => select(store).getNotices(context),
287      [context]
288    );
289    const { removeNotice: removeNotice2 } = (0, import_data3.useDispatch)(store);
290    const snackbarNotices = notices2.filter(({ type }) => type === "snackbar").slice(MAX_VISIBLE_NOTICES);
291    return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
292      import_components2.SnackbarList,
293      {
294        notices: snackbarNotices,
295        className: clsx_default("components-notices__snackbar", className),
296        onRemove: (id) => removeNotice2(id, context)
297      }
298    );
299  }
300  return __toCommonJS(index_exports);
301})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.