PluginProbe
Elementor Website Builder – more than just a page builder / 3.28.0-dev2
Elementor Website Builder – more than just a page builder v3.28.0-dev2
4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 All 455 releases
← All changes | assets/js/packages/editor-controls/editor-controls.js +8 -36020 4.3.2 → 3.28.0-dev2 View file →
@@ -1,36022 +1,10 @@
1 -(function(react, _elementor_editor_props, _elementor_ui, _wordpress_i18n, _elementor_utils, _elementor_query, _elementor_http_client, _elementor_icons, _elementor_wp_media, _elementor_editor_ui, react_dom, _elementor_editor_responsive, _elementor_locations, _elementor_editor_elements, _elementor_editor_v1_adapters, _elementor_session, _elementor_editor_current_user, _elementor_env, _elementor_events, _elementor_schema) {
1 +/*! For license information please see editor-controls.js.LICENSE.txt */
2 +!function(){"use strict";var e={react:function(e){e.exports=window.React},"@elementor/editor-props":function(e){e.exports=window.elementorV2.editorProps},"@elementor/icons":function(e){e.exports=window.elementorV2.icons},"@elementor/session":function(e){e.exports=window.elementorV2.session},"@elementor/ui":function(e){e.exports=window.elementorV2.ui},"@elementor/utils":function(e){e.exports=window.elementorV2.utils},"@elementor/wp-media":function(e){e.exports=window.elementorV2.wpMedia},"@wordpress/i18n":function(e){e.exports=window.wp.i18n}},t={};function n(l){var r=t[l];if(void 0!==r)return r.exports;var a=t[l]={exports:{}};return e[l](a,a.exports,n),a.exports}n.d=function(e,t){for(var l in t)n.o(t,l)&&!n.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};!function(){n.r(l),n.d(l,{AutocompleteControl:function(){return O},BackgroundControl:function(){return He},BoxShadowRepeaterControl:function(){return ee},ColorControl:function(){return H},ControlActionsProvider:function(){return S},ControlLabel:function(){return C},ControlReplacementProvider:function(){return w},ControlToggleButtonGroup:function(){return ce},EqualUnequalSizesControl:function(){return de},FontFamilyControl:function(){return ye},GapControl:function(){return we},ImageControl:function(){return U},LinkControl:function(){return _e},LinkedDimensionsControl:function(){return ve},NumberControl:function(){return se},PropKeyProvider:function(){return b},PropProvider:function(){return E},SelectControl:function(){return B},SizeControl:function(){return X},StrokeControl:function(){return q},TextAreaControl:function(){return $},TextControl:function(){return M},ToggleControl:function(){return ue},UrlControl:function(){return he},createControlReplacement:function(){return T},useBoundProp:function(){return x},useControlActions:function(){return P},useSyncExternalState:function(){return N}});var e=n("react"),t=n("@elementor/editor-props"),r=n("@elementor/ui"),a=n("@wordpress/i18n"),o=n("@elementor/utils"),i=n("@elementor/icons"),c=n("@elementor/wp-media"),u=n("@elementor/session"),m=(0,o.createError)({code:"missing_prop_provider_prop_type",message:"Prop type is missing"}),s=(0,o.createError)({code:"unsupported_prop_provider_prop_type",message:"Parent prop type is not supported"}),p=(0,o.createError)({code:"hook_outside_provider",message:"Hook used outside of provider"}),d=(0,e.createContext)(null),E=({children:t,value:n,setValue:l,propType:r})=>e.createElement(d.Provider,{value:{value:n,propType:r,setValue:l}},t),v=()=>{const t=(0,e.useContext)(d);if(!t)throw new p({context:{hook:"usePropContext",provider:"PropProvider"}});return t},g=(0,e.createContext)(null),b=({children:t,bind:n})=>{const{propType:l}=v();if(!l)throw new m({context:{bind:n}});if("array"===l.kind)return e.createElement(y,{bind:n},t);if("object"===l.kind)return e.createElement(f,{bind:n},t);throw new s({context:{propType:l}})},f=({children:t,bind:n})=>{const l=v(),{path:r}=(0,e.useContext)(g)??{},a=l.value?.[n],o=l.propType.shape[n];return e.createElement(g.Provider,{value:{...l,value:a,setValue:(e,t,r)=>{const a={...l.value,[n]:e};return l?.setValue(a,t,{...r,bind:n})},bind:n,propType:o,path:[...r??[],n]}},t)},y=({children:t,bind:n})=>{const l=v(),{path:r}=(0,e.useContext)(g)??{},a=l.value?.[Number(n)],o=l.propType.item_prop_type;return e.createElement(g.Provider,{value:{...l,value:a,setValue:(e,t)=>{const r=[...l.value??[]];return r[Number(n)]=e,l?.setValue(r,t,{bind:n})},bind:n,propType:o,path:[...r??[],n]}},t)},h=()=>{const t=(0,e.useContext)(g);if(!t)throw new p({context:{hook:"usePropKeyContext",provider:"PropKeyProvider"}});return t};function x(e){const t=h();if(!e)return t;const n=_(t.propType,e.key),l=e.extract(t.value??n.default??null);return{...t,setValue:function(n,l,r){return null===n?t?.setValue(null,l,r):t?.setValue(e?.create(n,l),{},r)},value:l,propType:n}}var _=(e,t)=>{let n=e;if("union"===e.kind&&(n=e.prop_types[t]),!n)throw new m({context:{key:t}});return n},C=({children:t})=>e.createElement(r.Typography,{component:"label",variant:"caption",color:"text.secondary"},t),I=(0,e.createContext)(void 0),w=({component:t,condition:n,children:l})=>e.createElement(I.Provider,{value:{component:t,condition:n}},l),T=()=>{let e;return{replaceControl:function({component:t,condition:n}){e={component:t,condition:n}},getControlReplacement:function(){return e}}};function z(t,{supportsReplacements:n=!0}={}){return l=>{const a=(()=>{const{value:t}=x(),n=(0,e.useContext)(I);let l=!1;try{l=!!n?.condition({value:t})&&!!n.component}catch{}return l?n?.component:void 0})();return a&&n?e.createElement(r.ErrorBoundary,{fallback:null},e.createElement(a,{...l})):e.createElement(r.ErrorBoundary,{fallback:null},e.createElement(t,{...l}))}}Symbol("control");var k=(0,e.createContext)(null),S=({children:t,items:n})=>e.createElement(k.Provider,{value:{items:n}},t),P=()=>{const t=(0,e.useContext)(k);if(!t)throw new Error("useControlActions must be used within a ControlActionsProvider");return t},G=(0,r.styled)("span")`
3 + display: contents;
2 4
3 -//#region \0rolldown/runtime.js
4 - var __create = Object.create;
5 - var __defProp$2 = Object.defineProperty;
6 - var __name = (target, value) => __defProp$2(target, "name", {
7 - value,
8 - configurable: true
9 - });
10 - var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11 - var __getOwnPropNames = Object.getOwnPropertyNames;
12 - var __getProtoOf = Object.getPrototypeOf;
13 - var __hasOwnProp = Object.prototype.hasOwnProperty;
14 - var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
15 - var __exportAll = (all, no_symbols) => {
16 - let target = {};
17 - for (var name in all) {
18 - __defProp$2(target, name, {
19 - get: all[name],
20 - enumerable: true
21 - });
22 - }
23 - if (!no_symbols) {
24 - __defProp$2(target, Symbol.toStringTag, { value: "Module" });
25 - }
26 - return target;
27 - };
28 - var __copyProps = (to, from, except, desc) => {
29 - if (from && typeof from === "object" || typeof from === "function") {
30 - for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
31 - key = keys[i];
32 - if (!__hasOwnProp.call(to, key) && key !== except) {
33 - __defProp$2(to, key, {
34 - get: ((k) => from[k]).bind(null, key),
35 - enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
36 - });
37 - }
38 - }
39 - }
40 - return to;
41 - };
42 - var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp$2(target, "default", {
43 - value: mod,
44 - enumerable: true
45 - }) : target, mod));
46 -
47 -//#endregion
48 -let react$1 = __toESM(react, 1);
49 -react = __toESM(react);
50 -_elementor_icons = __toESM(_elementor_icons);
51 -let react_dom$1 = __toESM(react_dom, 1);
52 -react_dom = __toESM(react_dom);
53 -
54 -//#region packages/packages/libs/editor-controls/src/bound-prop-context/errors.ts
55 - var MissingPropTypeError = (0, _elementor_utils.createError)({
56 - code: "missing_prop_provider_prop_type",
57 - message: "Prop type is missing"
58 - });
59 - var UnsupportedParentError = (0, _elementor_utils.createError)({
60 - code: "unsupported_prop_provider_prop_type",
61 - message: "Parent prop type is not supported"
62 - });
63 - var HookOutsideProviderError = (0, _elementor_utils.createError)({
64 - code: "hook_outside_provider",
65 - message: "Hook used outside of provider"
66 - });
67 -
68 -//#endregion
69 -//#region packages/packages/libs/editor-controls/src/bound-prop-context/prop-context.tsx
70 - var PropContext = (0, react.createContext)(null);
71 - var PropProvider = ({ children, value, setValue, propType, placeholder, baseValue, isDisabled }) => {
72 - return /* @__PURE__ */ react.createElement(PropContext.Provider, { value: {
73 - value,
74 - propType,
75 - setValue,
76 - placeholder,
77 - baseValue,
78 - isDisabled
79 - } }, children);
80 - };
81 - var usePropContext = () => {
82 - const context = (0, react.useContext)(PropContext);
83 - if (!context) throw new HookOutsideProviderError({ context: {
84 - hook: "usePropContext",
85 - provider: "PropProvider"
86 - } });
87 - return context;
88 - };
89 -
90 -//#endregion
91 -//#region packages/packages/libs/editor-controls/src/bound-prop-context/prop-key-context.tsx
92 - var PropKeyContext = (0, react.createContext)(null);
93 - var PropKeyProvider = ({ children, bind }) => {
94 - const { propType } = usePropContext();
95 - if (!propType) throw new MissingPropTypeError({ context: { bind } });
96 - if (propType.kind === "array") return /* @__PURE__ */ react.createElement(ArrayPropKeyProvider, { bind }, children);
97 - if (propType.kind === "object") return /* @__PURE__ */ react.createElement(ObjectPropKeyProvider, { bind }, children);
98 - throw new UnsupportedParentError({ context: { propType } });
99 - };
100 - var ObjectPropKeyProvider = ({ children, bind }) => {
101 - const context = usePropContext();
102 - const { path } = (0, react.useContext)(PropKeyContext) ?? {};
103 - const setValue = (value2, options, meta) => {
104 - const newValue = {
105 - ...context.value ?? context.baseValue,
106 - [bind]: value2
107 - };
108 - return context?.setValue(newValue, options, {
109 - ...meta,
110 - bind
111 - });
112 - };
113 - const value = context.value?.[bind];
114 - const placeholder = context.placeholder?.[bind];
115 - const baseValue = context.baseValue?.[bind];
116 - const propType = context.propType.shape[bind];
117 - return /* @__PURE__ */ react.createElement(PropKeyContext.Provider, { value: {
118 - ...context,
119 - value,
120 - setValue,
121 - placeholder,
122 - baseValue,
123 - bind,
124 - propType,
125 - path: [...path ?? [], bind]
126 - } }, children);
127 - };
128 - var ArrayPropKeyProvider = ({ children, bind }) => {
129 - const context = usePropContext();
130 - const { path } = (0, react.useContext)(PropKeyContext) ?? {};
131 - const setValue = (value2, options) => {
132 - const newValue = [...context.value ?? context.baseValue ?? []];
133 - newValue[Number(bind)] = value2;
134 - return context?.setValue(newValue, options, { bind });
135 - };
136 - const value = context.value?.[Number(bind)];
137 - const placeholder = context.placeholder?.[Number(bind)];
138 - const baseValue = context.baseValue?.[Number(bind)];
139 - const propType = context.propType.item_prop_type;
140 - return /* @__PURE__ */ react.createElement(PropKeyContext.Provider, { value: {
141 - ...context,
142 - value,
143 - setValue,
144 - bind,
145 - propType,
146 - path: [...path ?? [], bind],
147 - placeholder: placeholder ?? void 0,
148 - baseValue: baseValue ?? void 0
149 - } }, children);
150 - };
151 - var usePropKeyContext = () => {
152 - const context = (0, react.useContext)(PropKeyContext);
153 - if (!context) throw new HookOutsideProviderError({ context: {
154 - hook: "usePropKeyContext",
155 - provider: "PropKeyProvider"
156 - } });
157 - return context;
158 - };
159 -
160 -//#endregion
161 -//#region packages/packages/libs/editor-controls/src/bound-prop-context/use-bound-prop.ts
162 - function useBoundProp(propTypeUtil) {
163 - const propKeyContext = usePropKeyContext();
164 - const { isValid, validate, restoreValue } = useValidation(propKeyContext.propType);
165 - const disabled = propKeyContext.isDisabled?.(propKeyContext.propType);
166 - const resetValue = () => {
167 - propKeyContext.setValue(propKeyContext.propType.initial_value ?? null);
168 - };
169 - if (!propTypeUtil) return {
170 - ...propKeyContext,
171 - disabled,
172 - resetValue
173 - };
174 - function setValue(value2, options, meta) {
175 - if (!validate(value2, meta?.validation)) return;
176 - if (value2 === null) return propKeyContext?.setValue(null, options, meta);
177 - return propKeyContext?.setValue(propTypeUtil?.create(value2, options), {}, meta);
178 - }
179 - const propType = resolveUnionPropType(propKeyContext.propType, propTypeUtil.key);
180 - const fallbackValue = propKeyContext.baseValue !== void 0 && propKeyContext.baseValue !== null ? null : propType.default;
181 - const value = propTypeUtil.extract(propKeyContext.value ?? fallbackValue ?? null);
182 - const baseValue = propTypeUtil.extract(propKeyContext.baseValue ?? null);
183 - const placeholder = propTypeUtil.extract(propKeyContext.placeholder ?? propKeyContext.baseValue ?? null);
184 - return {
185 - ...propKeyContext,
186 - propType,
187 - setValue,
188 - value: isValid ? value : null,
189 - restoreValue,
190 - placeholder,
191 - baseValue,
192 - disabled,
193 - resetValue
194 - };
5 + .MuiFloatingActionBar-popper:has( .MuiFloatingActionBar-actions:empty ) {
6 + display: none;
195 7 }
196 - var useValidation = (propType) => {
197 - const [isValid, setIsValid] = (0, react.useState)(true);
198 - const validate = (value, validation) => {
199 - let valid = true;
200 - if (propType.settings.required && value === null) valid = false;
201 - if (validation && !validation(value)) valid = false;
202 - setIsValid(valid);
203 - return valid;
204 - };
205 - const restoreValue = () => setIsValid(true);
206 - return {
207 - isValid,
208 - setIsValid,
209 - validate,
210 - restoreValue
211 - };
212 - };
213 - var resolveUnionPropType = (propType, key) => {
214 - let resolvedPropType = propType;
215 - if (propType.kind === "union") resolvedPropType = propType.prop_types[key];
216 - if (!resolvedPropType) throw new MissingPropTypeError({ context: { key } });
217 - return resolvedPropType;
218 - };
219 -
220 -//#endregion
221 -//#region packages/packages/libs/editor-controls/src/components/control-form-label.tsx
222 - var ControlFormLabel = (props) => {
223 - return /* @__PURE__ */ react.createElement(_elementor_ui.FormLabel, {
224 - size: "tiny",
225 - ...props
226 - });
227 - };
228 -
229 -//#endregion
230 -//#region packages/packages/libs/editor-controls/src/control-adornments/control-adornments-context.tsx
231 - var Context$1 = (0, react.createContext)(null);
232 - var ControlAdornmentsProvider = ({ children, items }) => /* @__PURE__ */ react.createElement(Context$1.Provider, { value: { items } }, children);
233 - var useControlAdornments = () => {
234 - return (0, react.useContext)(Context$1)?.items ?? [];
235 - };
236 -
237 -//#endregion
238 -//#region packages/packages/libs/editor-controls/src/control-adornments/control-adornments.tsx
239 - function ControlAdornments({ customContext }) {
240 - const items = useControlAdornments();
241 - if (items?.length === 0) return null;
242 - return /* @__PURE__ */ react.createElement(react.Fragment, null, items.map(({ Adornment, id }) => /* @__PURE__ */ react.createElement(Adornment, {
243 - key: id,
244 - customContext
245 - })));
246 - }
247 -
248 -//#endregion
249 -//#region packages/packages/libs/editor-controls/src/components/control-label.tsx
250 - var ControlLabel = ({ children, ...props }) => {
251 - return /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
252 - direction: "row",
253 - alignItems: "center",
254 - justifyItems: "start",
255 - gap: .25
256 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, { ...props }, children), /* @__PURE__ */ react.createElement(ControlAdornments, null));
257 - };
258 -
259 -//#endregion
260 -//#region packages/packages/libs/editor-controls/src/control-replacements.tsx
261 - var ControlReplacementContext = (0, react.createContext)([]);
262 - var ControlReplacementsProvider = ({ replacements, children }) => {
263 - return /* @__PURE__ */ react.createElement(ControlReplacementContext.Provider, { value: replacements }, children);
264 - };
265 - var useControlReplacement = (OriginalComponent) => {
266 - const { value, placeholder } = useBoundProp();
267 - const replacements = (0, react.useContext)(ControlReplacementContext);
268 - try {
269 - const replacement = replacements.find((r) => r.condition({
270 - value,
271 - placeholder
272 - }));
273 - return {
274 - ControlToRender: replacement?.component ?? OriginalComponent,
275 - OriginalControl: OriginalComponent,
276 - isReplaced: !!replacement
277 - };
278 - } catch {
279 - return {
280 - ControlToRender: OriginalComponent,
281 - OriginalControl: OriginalComponent
282 - };
283 - }
284 - };
285 - var createControlReplacementsRegistry = () => {
286 - const controlReplacements = [];
287 - function registerControlReplacement2(replacement) {
288 - controlReplacements.push(replacement);
289 - }
290 - function getControlReplacements2() {
291 - return controlReplacements;
292 - }
293 - return {
294 - registerControlReplacement: registerControlReplacement2,
295 - getControlReplacements: getControlReplacements2
296 - };
297 - };
298 - var { registerControlReplacement, getControlReplacements } = createControlReplacementsRegistry();
299 -
300 -//#endregion
301 -//#region packages/packages/libs/editor-controls/src/create-control.tsx
302 - function createControl(Control) {
303 - return (props) => {
304 - const { ControlToRender, OriginalControl, isReplaced } = useControlReplacement(Control);
305 - const controlProps = isReplaced ? {
306 - ...props,
307 - OriginalControl
308 - } : props;
309 - return /* @__PURE__ */ react.createElement(_elementor_ui.ErrorBoundary, { fallback: null }, /* @__PURE__ */ react.createElement(ControlToRender, { ...controlProps }));
310 - };
311 - }
312 -
313 -//#endregion
314 -//#region packages/packages/libs/editor-controls/src/api.ts
315 - var ELEMENTOR_SETTING_URL = "elementor/v1/settings";
316 - var apiClient = {
317 - getElementorSetting: (key) => (0, _elementor_http_client.httpService)().get(`${ELEMENTOR_SETTING_URL}/${key}`).then((res) => formatSettingResponse(res.data)),
318 - updateElementorSetting: (key, value) => (0, _elementor_http_client.httpService)().put(`${ELEMENTOR_SETTING_URL}/${key}`, { value })
319 - };
320 - var formatSettingResponse = (response) => response.data.value;
321 -
322 -//#endregion
323 -//#region packages/packages/libs/editor-controls/src/hooks/use-unfiltered-files-upload.ts
324 - var UNFILTERED_FILES_UPLOAD_KEY = "elementor_unfiltered_files_upload";
325 - var unfilteredFilesQueryKey = { queryKey: [UNFILTERED_FILES_UPLOAD_KEY] };
326 - var useUnfilteredFilesUpload = () => (0, _elementor_query.useQuery)({
327 - ...unfilteredFilesQueryKey,
328 - queryFn: () => apiClient.getElementorSetting(UNFILTERED_FILES_UPLOAD_KEY).then((res) => {
329 - return formatResponse(res);
330 - }),
331 - staleTime: Infinity
332 - });
333 - function useUpdateUnfilteredFilesUpload() {
334 - const queryClient = (0, _elementor_query.useQueryClient)();
335 - return (0, _elementor_query.useMutation)({
336 - mutationFn: ({ allowUnfilteredFilesUpload }) => apiClient.updateElementorSetting(UNFILTERED_FILES_UPLOAD_KEY, allowUnfilteredFilesUpload ? "1" : "0"),
337 - onSuccess: () => queryClient.invalidateQueries(unfilteredFilesQueryKey)
338 - });
339 - }
340 - var formatResponse = (response) => {
341 - return Boolean(response === "1");
342 - };
343 -
344 -//#endregion
345 -//#region packages/packages/libs/editor-controls/src/control-actions/control-actions-context.tsx
346 - var Context = (0, react.createContext)(null);
347 - var ControlActionsProvider = ({ children, items }) => /* @__PURE__ */ react.createElement(Context.Provider, { value: { items } }, children);
348 - var useControlActions = () => {
349 - const context = (0, react.useContext)(Context);
350 - if (!context) throw new Error("useControlActions must be used within a ControlActionsProvider");
351 - return context;
352 - };
353 -
354 -//#endregion
355 -//#region packages/packages/libs/editor-controls/src/control-actions/control-actions.tsx
356 - function ControlActions({ children }) {
357 - const { items } = useControlActions();
358 - const { disabled } = useBoundProp();
359 - if (items.length === 0 || disabled) return children;
360 - const menuItems = items.map(({ MenuItem, id }) => /* @__PURE__ */ react.createElement(MenuItem, { key: id }));
361 - return /* @__PURE__ */ react.createElement(_elementor_editor_ui.FloatingActionsBar, { actions: menuItems }, children);
362 - }
363 -
364 -//#endregion
365 -//#region packages/packages/libs/editor-controls/src/controls/image-media-control.tsx
366 - var ImageMediaControl = createControl(({ mediaTypes = ["image"] }) => {
367 - const { value, setValue, propType, placeholder } = useBoundProp(_elementor_editor_props.imageSrcPropTypeUtil);
368 - const { id, url } = value ?? {};
369 - const { data: attachment, isFetching } = (0, _elementor_wp_media.useWpMediaAttachment)(id?.value || null);
370 - const { data: placeholderAttachment } = (0, _elementor_wp_media.useWpMediaAttachment)(placeholder?.id?.value || null);
371 - const src = attachment?.url ?? url?.value ?? placeholderAttachment?.url ?? null;
372 - const defaultUrl = _elementor_editor_props.imageSrcPropTypeUtil.extract(propType.default ?? null)?.url?.value;
373 - const currentUrlForModal = url?.value && url.value !== defaultUrl ? url.value : void 0;
374 - const currentAltForModal = value?.alt?.value;
375 - const { open } = (0, _elementor_wp_media.useWpMediaFrame)({
376 - mediaTypes,
377 - multiple: false,
378 - selected: id?.value || null,
379 - allowUrlImport: true,
380 - onSelect: (selectedAttachment) => {
381 - setValue({
382 - id: {
383 - $$type: "image-attachment-id",
384 - value: selectedAttachment.id
385 - },
386 - url: null
387 - });
388 - },
389 - onSelectUrl: (selectedUrl, alt) => {
390 - setValue({
391 - id: null,
392 - url: _elementor_editor_props.urlPropTypeUtil.create(selectedUrl),
393 - alt: alt ? _elementor_editor_props.stringPropTypeUtil.create(alt) : null
394 - });
395 - }
396 - });
397 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.Card, { variant: "outlined" }, /* @__PURE__ */ react.createElement(_elementor_ui.CardMedia, {
398 - image: src,
399 - sx: { height: propType.meta.isDynamic ? 134 : 150 }
400 - }, isFetching ? /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
401 - justifyContent: "center",
402 - alignItems: "center",
403 - width: "100%",
404 - height: "100%"
405 - }, /* @__PURE__ */ react.createElement(_elementor_ui.CircularProgress, null)) : /* @__PURE__ */ react.createElement(react.Fragment, null)), /* @__PURE__ */ react.createElement(_elementor_ui.CardOverlay, null, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, { gap: 1 }, /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
406 - size: "tiny",
407 - color: "inherit",
408 - variant: "outlined",
409 - onClick: () => open({ mode: "browse" })
410 - }, (0, _wordpress_i18n.__)("Select image", "elementor")), /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
411 - size: "tiny",
412 - variant: "text",
413 - color: "inherit",
414 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.UploadIcon, null),
415 - onClick: () => open({ mode: "upload" })
416 - }, (0, _wordpress_i18n.__)("Upload", "elementor")), /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
417 - size: "tiny",
418 - variant: "text",
419 - color: "inherit",
420 - onClick: () => open({
421 - mode: "url",
422 - currentUrl: currentUrlForModal,
423 - currentAlt: currentAltForModal
424 - })
425 - }, (0, _wordpress_i18n.__)("Insert from URL", "elementor"))))));
426 - });
427 -
428 -//#endregion
429 -//#region packages/packages/libs/editor-controls/src/controls/select-control.tsx
430 - var DEFAULT_MENU_PROPS = { MenuListProps: { sx: { maxHeight: "160px" } } };
431 - var SelectControl = createControl(({ options = [], groups = [], onChange, MenuProps = DEFAULT_MENU_PROPS, ariaLabel }) => {
432 - const { value, setValue, disabled, placeholder } = useBoundProp(_elementor_editor_props.stringPropTypeUtil);
433 - const handleChange = (event) => {
434 - const newValue = event.target.value || null;
435 - onChange?.(newValue, value);
436 - setValue(newValue);
437 - };
438 - const flatOptions = flattenGroupedOptions(options, groups);
439 - const isDisabled = disabled || flatOptions.length === 0;
440 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.Select, {
441 - sx: { overflow: "hidden" },
442 - displayEmpty: true,
443 - size: "tiny",
444 - MenuProps,
445 - "aria-label": ariaLabel || placeholder,
446 - renderValue: (selectedValue) => getSelectRenderValue(flatOptions, placeholder, selectedValue),
447 - value: value ?? "",
448 - onChange: handleChange,
449 - disabled: isDisabled,
450 - fullWidth: true
451 - }, groups.length ? groups.flatMap((group) => renderGroup(group)) : options.map((option) => renderOption(option))));
452 - });
453 - var GROUPED_OPTION_INDENT = 3.5;
454 - function renderGroup(group) {
455 - return [/* @__PURE__ */ react.createElement(_elementor_ui.MenuSubheader, {
456 - key: `group-${group.label}`,
457 - sx: {
458 - fontWeight: 400,
459 - color: "text.tertiary"
460 - }
461 - }, group.label), ...group.options.map((option) => renderOption(option, true))];
462 - }
463 - function renderOption({ label, ...props }, isGrouped = false) {
464 - return /* @__PURE__ */ react.createElement(_elementor_editor_ui.MenuListItem, {
465 - key: props.value,
466 - ...props,
467 - value: props.value ?? "",
468 - sx: isGrouped ? { pl: GROUPED_OPTION_INDENT } : void 0
469 - }, label);
470 - }
471 - function flattenGroupedOptions(options, groups) {
472 - if (!groups.length) return options;
473 - return groups.flatMap((group) => group.options);
474 - }
475 - function getSelectRenderValue(options, placeholder, selectedValue) {
476 - const optionWithValue = (v) => options.find(({ value }) => value === v);
477 - if (!isUnsetSelectValue(selectedValue)) return optionWithValue(selectedValue)?.label ?? selectedValue;
478 - if (placeholder) {
479 - const text = optionWithValue(placeholder)?.label ?? placeholder;
480 - return /* @__PURE__ */ react.createElement(_elementor_ui.Typography, {
481 - component: "span",
482 - variant: "inherit",
483 - color: "text.tertiary"
484 - }, text);
485 - }
486 - return options.find(({ value }) => isUnsetSelectValue(value))?.label ?? "";
487 - }
488 - function isUnsetSelectValue(value) {
489 - return value === null || value === void 0 || value === "";
490 - }
491 -
492 -//#endregion
493 -//#region packages/packages/libs/editor-controls/src/controls/image-control.tsx
494 - var ImageControl = createControl(({ sizes, label = (0, _wordpress_i18n.__)("Image", "elementor") }) => {
495 - const propContext = useBoundProp(_elementor_editor_props.imagePropTypeUtil);
496 - return /* @__PURE__ */ react.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, { gap: 1.5 }, /* @__PURE__ */ react.createElement(ControlLabel, null, label), /* @__PURE__ */ react.createElement(ImageSrcControl, null), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
497 - container: true,
498 - gap: 1.5,
499 - alignItems: "center",
500 - flexWrap: "nowrap"
501 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
502 - item: true,
503 - xs: 6
504 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Resolution", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
505 - item: true,
506 - xs: 6,
507 - sx: { overflow: "hidden" }
508 - }, /* @__PURE__ */ react.createElement(ImageSizeControl, { sizes })))));
509 - });
510 - var ImageSrcControl = () => {
511 - const { data: allowSvgUpload } = useUnfilteredFilesUpload();
512 - const mediaTypes = allowSvgUpload ? ["image", "svg"] : ["image"];
513 - return /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "src" }, /* @__PURE__ */ react.createElement(ImageMediaControl, { mediaTypes }));
514 - };
515 - var ImageSizeControl = ({ sizes }) => {
516 - return /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ react.createElement(SelectControl, { options: sizes }));
517 - };
518 -
519 -//#endregion
520 -//#region packages/packages/libs/editor-controls/src/controls/text-control.tsx
521 - var TextControl = createControl(({ placeholder: propPlaceholder, error, inputValue, inputDisabled, helperText, sx, ariaLabel }) => {
522 - const { value, setValue, disabled, placeholder: boundPlaceholder } = useBoundProp(_elementor_editor_props.stringPropTypeUtil);
523 - const handleChange = (event) => setValue(event.target.value);
524 - const placeholder = propPlaceholder ?? boundPlaceholder ?? void 0;
525 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.TextField, {
526 - size: "tiny",
527 - fullWidth: true,
528 - disabled: inputDisabled ?? disabled,
529 - value: inputValue ?? value ?? "",
530 - onChange: handleChange,
531 - placeholder,
532 - error,
533 - helperText,
534 - sx,
535 - inputProps: { ...ariaLabel ? { "aria-label": ariaLabel } : {} }
536 - }));
537 - });
538 -
539 -//#endregion
540 -//#region packages/packages/libs/editor-controls/src/controls/text-area-control.tsx
541 - var TextAreaControl = createControl(({ placeholder: propPlaceholder, ariaLabel }) => {
542 - const { value, setValue, disabled, placeholder: boundPlaceholder } = useBoundProp(_elementor_editor_props.stringPropTypeUtil);
543 - const handleChange = (event) => {
544 - setValue(event.target.value);
545 - };
546 - const placeholder = propPlaceholder ?? boundPlaceholder ?? void 0;
547 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.TextField, {
548 - size: "tiny",
549 - multiline: true,
550 - fullWidth: true,
551 - minRows: 5,
552 - disabled,
553 - value: value ?? "",
554 - onChange: handleChange,
555 - placeholder,
556 - inputProps: { ...ariaLabel ? { "aria-label": ariaLabel } : {} }
557 - }));
558 - });
559 -
560 -//#endregion
561 -//#region node_modules/primereact/utils/utils.esm.js
562 - function _arrayWithHoles$5(r) {
563 - if (Array.isArray(r)) return r;
564 - }
565 - __name(_arrayWithHoles$5, "_arrayWithHoles");
566 - function _iterableToArrayLimit$5(r, l) {
567 - var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
568 - if (null != t) {
569 - var e;
570 - var n;
571 - var i;
572 - var u;
573 - var a = [];
574 - var f = !0;
575 - var o = !1;
576 - try {
577 - if (i = (t = t.call(r)).next, 0 === l) {
578 - if (Object(t) !== t) return;
579 - f = !1;
580 - } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
581 - } catch (r) {
582 - o = !0, n = r;
583 - } finally {
584 - try {
585 - if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
586 - } finally {
587 - if (o) throw n;
588 - }
589 - }
590 - return a;
591 - }
592 - }
593 - __name(_iterableToArrayLimit$5, "_iterableToArrayLimit");
594 - function _arrayLikeToArray$2$1(r, a) {
595 - (null == a || a > r.length) && (a = r.length);
596 - for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
597 - return n;
598 - }
599 - __name(_arrayLikeToArray$2$1, "_arrayLikeToArray$2");
600 - function _unsupportedIterableToArray$2$1(r, a) {
601 - if (r) {
602 - if ("string" == typeof r) return _arrayLikeToArray$2$1(r, a);
603 - var t = {}.toString.call(r).slice(8, -1);
604 - return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2$1(r, a) : void 0;
605 - }
606 - }
607 - __name(_unsupportedIterableToArray$2$1, "_unsupportedIterableToArray$2");
608 - function _nonIterableRest$5() {
609 - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
610 - }
611 - __name(_nonIterableRest$5, "_nonIterableRest");
612 - function _slicedToArray$5(r, e) {
613 - return _arrayWithHoles$5(r) || _iterableToArrayLimit$5(r, e) || _unsupportedIterableToArray$2$1(r, e) || _nonIterableRest$5();
614 - }
615 - __name(_slicedToArray$5, "_slicedToArray");
616 - function _typeof$6(o) {
617 - "@babel/helpers - typeof";
618 - return _typeof$6 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
619 - return typeof o;
620 - } : function(o) {
621 - return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
622 - }, _typeof$6(o);
623 - }
624 - __name(_typeof$6, "_typeof");
625 - function classNames() {
626 - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
627 - if (args) {
628 - var classes = [];
629 - for (var i = 0; i < args.length; i++) {
630 - var className = args[i];
631 - if (!className) continue;
632 - var type = _typeof$6(className);
633 - if (type === "string" || type === "number") classes.push(className);
634 - else if (type === "object") {
635 - var _classes = Array.isArray(className) ? className : Object.entries(className).map(function(_ref) {
636 - var _ref2 = _slicedToArray$5(_ref, 2);
637 - var key = _ref2[0];
638 - return _ref2[1] ? key : null;
639 - });
640 - classes = _classes.length ? classes.concat(_classes.filter(function(c) {
641 - return !!c;
642 - })) : classes;
643 - }
644 - }
645 - return classes.join(" ").trim();
646 - }
647 - }
648 - function _arrayWithoutHoles$5(r) {
649 - if (Array.isArray(r)) return _arrayLikeToArray$2$1(r);
650 - }
651 - __name(_arrayWithoutHoles$5, "_arrayWithoutHoles");
652 - function _iterableToArray$5(r) {
653 - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
654 - }
655 - __name(_iterableToArray$5, "_iterableToArray");
656 - function _nonIterableSpread$5() {
657 - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
658 - }
659 - __name(_nonIterableSpread$5, "_nonIterableSpread");
660 - function _toConsumableArray$5(r) {
661 - return _arrayWithoutHoles$5(r) || _iterableToArray$5(r) || _unsupportedIterableToArray$2$1(r) || _nonIterableSpread$5();
662 - }
663 - __name(_toConsumableArray$5, "_toConsumableArray");
664 - function _classCallCheck$1(a, n) {
665 - if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
666 - }
667 - __name(_classCallCheck$1, "_classCallCheck");
668 - function toPrimitive$6(t, r) {
669 - if ("object" != _typeof$6(t) || !t) return t;
670 - var e = t[Symbol.toPrimitive];
671 - if (void 0 !== e) {
672 - var i = e.call(t, r || "default");
673 - if ("object" != _typeof$6(i)) return i;
674 - throw new TypeError("@@toPrimitive must return a primitive value.");
675 - }
676 - return ("string" === r ? String : Number)(t);
677 - }
678 - __name(toPrimitive$6, "toPrimitive");
679 - function toPropertyKey$6(t) {
680 - var i = toPrimitive$6(t, "string");
681 - return "symbol" == _typeof$6(i) ? i : i + "";
682 - }
683 - __name(toPropertyKey$6, "toPropertyKey");
684 - function _defineProperties$1(e, r) {
685 - for (var t = 0; t < r.length; t++) {
686 - var o = r[t];
687 - o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey$6(o.key), o);
688 - }
689 - }
690 - __name(_defineProperties$1, "_defineProperties");
691 - function _createClass$1(e, r, t) {
692 - return r && _defineProperties$1(e.prototype, r), t && _defineProperties$1(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
693 - }
694 - __name(_createClass$1, "_createClass");
695 - function _defineProperty$6(e, r, t) {
696 - return (r = toPropertyKey$6(r)) in e ? Object.defineProperty(e, r, {
697 - value: t,
698 - enumerable: !0,
699 - configurable: !0,
700 - writable: !0
701 - }) : e[r] = t, e;
702 - }
703 - __name(_defineProperty$6, "_defineProperty");
704 - function _createForOfIteratorHelper$1(r, e) {
705 - var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
706 - if (!t) {
707 - if (Array.isArray(r) || (t = _unsupportedIterableToArray$1$1(r)) || e && r && "number" == typeof r.length) {
708 - t && (r = t);
709 - var _n = 0;
710 - var F = function F() {};
711 - return {
712 - s: F,
713 - n: function n() {
714 - return _n >= r.length ? { done: !0 } : {
715 - done: !1,
716 - value: r[_n++]
717 - };
718 - },
719 - e: function e(r) {
720 - throw r;
721 - },
722 - f: F
723 - };
724 - }
725 - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
726 - }
727 - var o;
728 - var a = !0;
729 - var u = !1;
730 - return {
731 - s: function s() {
732 - t = t.call(r);
733 - },
734 - n: function n() {
735 - var r = t.next();
736 - return a = r.done, r;
737 - },
738 - e: function e(r) {
739 - u = !0, o = r;
740 - },
741 - f: function f() {
742 - try {
743 - a || null == t["return"] || t["return"]();
744 - } finally {
745 - if (u) throw o;
746 - }
747 - }
748 - };
749 - }
750 - function _unsupportedIterableToArray$1$1(r, a) {
751 - if (r) {
752 - if ("string" == typeof r) return _arrayLikeToArray$1$1(r, a);
753 - var t = {}.toString.call(r).slice(8, -1);
754 - return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1$1(r, a) : void 0;
755 - }
756 - }
757 - __name(_unsupportedIterableToArray$1$1, "_unsupportedIterableToArray$1");
758 - function _arrayLikeToArray$1$1(r, a) {
759 - (null == a || a > r.length) && (a = r.length);
760 - for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
761 - return n;
762 - }
763 - __name(_arrayLikeToArray$1$1, "_arrayLikeToArray$1");
764 - var DomHandler = /*#__PURE__*/ function() {
765 - function DomHandler() {
766 - _classCallCheck$1(this, DomHandler);
767 - }
768 - return _createClass$1(DomHandler, null, [
769 - {
770 - key: "innerWidth",
771 - value: function innerWidth(el) {
772 - if (el) {
773 - var width = el.offsetWidth;
774 - var style = getComputedStyle(el);
775 - width = width + (parseFloat(style.paddingLeft) + parseFloat(style.paddingRight));
776 - return width;
777 - }
778 - return 0;
779 - }
780 - },
781 - {
782 - key: "width",
783 - value: function width(el) {
784 - if (el) {
785 - var _width = el.offsetWidth;
786 - var style = getComputedStyle(el);
787 - _width = _width - (parseFloat(style.paddingLeft) + parseFloat(style.paddingRight));
788 - return _width;
789 - }
790 - return 0;
791 - }
792 - },
793 - {
794 - key: "getBrowserLanguage",
795 - value: function getBrowserLanguage() {
796 - return navigator.userLanguage || navigator.languages && navigator.languages.length && navigator.languages[0] || navigator.language || navigator.browserLanguage || navigator.systemLanguage || "en";
797 - }
798 - },
799 - {
800 - key: "getWindowScrollTop",
801 - value: function getWindowScrollTop() {
802 - var doc = document.documentElement;
803 - return (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
804 - }
805 - },
806 - {
807 - key: "getWindowScrollLeft",
808 - value: function getWindowScrollLeft() {
809 - var doc = document.documentElement;
810 - return (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);
811 - }
812 - },
813 - {
814 - key: "getOuterWidth",
815 - value: function getOuterWidth(el, margin) {
816 - if (el) {
817 - var width = el.getBoundingClientRect().width || el.offsetWidth;
818 - if (margin) {
819 - var style = getComputedStyle(el);
820 - width = width + (parseFloat(style.marginLeft) + parseFloat(style.marginRight));
821 - }
822 - return width;
823 - }
824 - return 0;
825 - }
826 - },
827 - {
828 - key: "getOuterHeight",
829 - value: function getOuterHeight(el, margin) {
830 - if (el) {
831 - var height = el.getBoundingClientRect().height || el.offsetHeight;
832 - if (margin) {
833 - var style = getComputedStyle(el);
834 - height = height + (parseFloat(style.marginTop) + parseFloat(style.marginBottom));
835 - }
836 - return height;
837 - }
838 - return 0;
839 - }
840 - },
841 - {
842 - key: "getClientHeight",
843 - value: function getClientHeight(el, margin) {
844 - if (el) {
845 - var height = el.clientHeight;
846 - if (margin) {
847 - var style = getComputedStyle(el);
848 - height = height + (parseFloat(style.marginTop) + parseFloat(style.marginBottom));
849 - }
850 - return height;
851 - }
852 - return 0;
853 - }
854 - },
855 - {
856 - key: "getClientWidth",
857 - value: function getClientWidth(el, margin) {
858 - if (el) {
859 - var width = el.clientWidth;
860 - if (margin) {
861 - var style = getComputedStyle(el);
862 - width = width + (parseFloat(style.marginLeft) + parseFloat(style.marginRight));
863 - }
864 - return width;
865 - }
866 - return 0;
867 - }
868 - },
869 - {
870 - key: "getViewport",
871 - value: function getViewport() {
872 - var win = window;
873 - var d = document;
874 - var e = d.documentElement;
875 - var g = d.getElementsByTagName("body")[0];
876 - return {
877 - width: win.innerWidth || e.clientWidth || g.clientWidth,
878 - height: win.innerHeight || e.clientHeight || g.clientHeight
879 - };
880 - }
881 - },
882 - {
883 - key: "getOffset",
884 - value: function getOffset(el) {
885 - if (el) {
886 - var rect = el.getBoundingClientRect();
887 - return {
888 - top: rect.top + (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0),
889 - left: rect.left + (window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0)
890 - };
891 - }
892 - return {
893 - top: "auto",
894 - left: "auto"
895 - };
896 - }
897 - },
898 - {
899 - key: "index",
900 - value: function index(element) {
901 - if (element) {
902 - var children = element.parentNode.childNodes;
903 - var num = 0;
904 - for (var i = 0; i < children.length; i++) {
905 - if (children[i] === element) return num;
906 - if (children[i].nodeType === 1) num++;
907 - }
908 - }
909 - return -1;
910 - }
911 - },
912 - {
913 - key: "addMultipleClasses",
914 - value: function addMultipleClasses(element, className) {
915 - if (element && className) if (element.classList) {
916 - var styles = className.split(" ");
917 - for (var i = 0; i < styles.length; i++) element.classList.add(styles[i]);
918 - } else {
919 - var _styles = className.split(" ");
920 - for (var _i = 0; _i < _styles.length; _i++) element.className = element.className + (" " + _styles[_i]);
921 - }
922 - }
923 - },
924 - {
925 - key: "removeMultipleClasses",
926 - value: function removeMultipleClasses(element, className) {
927 - if (element && className) if (element.classList) {
928 - var styles = className.split(" ");
929 - for (var i = 0; i < styles.length; i++) element.classList.remove(styles[i]);
930 - } else {
931 - var _styles2 = className.split(" ");
932 - for (var _i2 = 0; _i2 < _styles2.length; _i2++) element.className = element.className.replace(new RegExp("(^|\\b)" + _styles2[_i2].split(" ").join("|") + "(\\b|$)", "gi"), " ");
933 - }
934 - }
935 - },
936 - {
937 - key: "addClass",
938 - value: function addClass(element, className) {
939 - if (element && className) if (element.classList) element.classList.add(className);
940 - else element.className = element.className + (" " + className);
941 - }
942 - },
943 - {
944 - key: "removeClass",
945 - value: function removeClass(element, className) {
946 - if (element && className) if (element.classList) element.classList.remove(className);
947 - else element.className = element.className.replace(new RegExp("(^|\\b)" + className.split(" ").join("|") + "(\\b|$)", "gi"), " ");
948 - }
949 - },
950 - {
951 - key: "hasClass",
952 - value: function hasClass(element, className) {
953 - if (element) {
954 - if (element.classList) return element.classList.contains(className);
955 - return new RegExp("(^| )" + className + "( |$)", "gi").test(element.className);
956 - }
957 - return false;
958 - }
959 - },
960 - {
961 - key: "addStyles",
962 - value: function addStyles(element) {
963 - var styles = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
964 - if (element) Object.entries(styles).forEach(function(_ref) {
965 - var _ref2 = _slicedToArray$5(_ref, 2);
966 - var key = _ref2[0];
967 - var value = _ref2[1];
968 - return element.style[key] = value;
969 - });
970 - }
971 - },
972 - {
973 - key: "find",
974 - value: function find(element, selector) {
975 - return element ? Array.from(element.querySelectorAll(selector)) : [];
976 - }
977 - },
978 - {
979 - key: "findSingle",
980 - value: function findSingle(element, selector) {
981 - if (element) return element.querySelector(selector);
982 - return null;
983 - }
984 - },
985 - {
986 - key: "setAttributes",
987 - value: function setAttributes(element) {
988 - var _this = this;
989 - var attributes = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
990 - if (element) {
991 - var _computedStyles = function computedStyles(rule, value) {
992 - var _element$$attrs;
993 - var _element$$attrs2;
994 - var styles = element !== null && element !== void 0 && (_element$$attrs = element.$attrs) !== null && _element$$attrs !== void 0 && _element$$attrs[rule] ? [element === null || element === void 0 || (_element$$attrs2 = element.$attrs) === null || _element$$attrs2 === void 0 ? void 0 : _element$$attrs2[rule]] : [];
995 - return [value].flat().reduce(function(cv, v) {
996 - if (v !== null && v !== void 0) {
997 - var type = _typeof$6(v);
998 - if (type === "string" || type === "number") cv.push(v);
999 - else if (type === "object") {
1000 - var _cv = Array.isArray(v) ? _computedStyles(rule, v) : Object.entries(v).map(function(_ref3) {
1001 - var _ref4 = _slicedToArray$5(_ref3, 2);
1002 - var _k = _ref4[0];
1003 - var _v = _ref4[1];
1004 - return rule === "style" && (!!_v || _v === 0) ? "".concat(_k.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), ":").concat(_v) : _v ? _k : void 0;
1005 - });
1006 - cv = _cv.length ? cv.concat(_cv.filter(function(c) {
1007 - return !!c;
1008 - })) : cv;
1009 - }
1010 - }
1011 - return cv;
1012 - }, styles);
1013 - };
1014 - Object.entries(attributes).forEach(function(_ref5) {
1015 - var _ref6 = _slicedToArray$5(_ref5, 2);
1016 - var key = _ref6[0];
1017 - var value = _ref6[1];
1018 - if (value !== void 0 && value !== null) {
1019 - var matchedEvent = key.match(/^on(.+)/);
1020 - if (matchedEvent) element.addEventListener(matchedEvent[1].toLowerCase(), value);
1021 - else if (key === "p-bind") _this.setAttributes(element, value);
1022 - else {
1023 - value = key === "class" ? _toConsumableArray$5(new Set(_computedStyles("class", value))).join(" ").trim() : key === "style" ? _computedStyles("style", value).join(";").trim() : value;
1024 - (element.$attrs = element.$attrs || {}) && (element.$attrs[key] = value);
1025 - element.setAttribute(key, value);
1026 - }
1027 - }
1028 - });
1029 - }
1030 - }
1031 - },
1032 - {
1033 - key: "getAttribute",
1034 - value: function getAttribute(element, name) {
1035 - if (element) {
1036 - var value = element.getAttribute(name);
1037 - if (!isNaN(value)) return +value;
1038 - if (value === "true" || value === "false") return value === "true";
1039 - return value;
1040 - }
1041 - }
1042 - },
1043 - {
1044 - key: "isAttributeEquals",
1045 - value: function isAttributeEquals(element, name, value) {
1046 - return element ? this.getAttribute(element, name) === value : false;
1047 - }
1048 - },
1049 - {
1050 - key: "isAttributeNotEquals",
1051 - value: function isAttributeNotEquals(element, name, value) {
1052 - return !this.isAttributeEquals(element, name, value);
1053 - }
1054 - },
1055 - {
1056 - key: "getHeight",
1057 - value: function getHeight(el) {
1058 - if (el) {
1059 - var height = el.offsetHeight;
1060 - var style = getComputedStyle(el);
1061 - height = height - (parseFloat(style.paddingTop) + parseFloat(style.paddingBottom) + parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth));
1062 - return height;
1063 - }
1064 - return 0;
1065 - }
1066 - },
1067 - {
1068 - key: "getWidth",
1069 - value: function getWidth(el) {
1070 - if (el) {
1071 - var width = el.offsetWidth;
1072 - var style = getComputedStyle(el);
1073 - width = width - (parseFloat(style.paddingLeft) + parseFloat(style.paddingRight) + parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth));
1074 - return width;
1075 - }
1076 - return 0;
1077 - }
1078 - },
1079 - {
1080 - key: "alignOverlay",
1081 - value: function alignOverlay(overlay, target, appendTo) {
1082 - var calculateMinWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true;
1083 - if (overlay && target) if (appendTo === "self") this.relativePosition(overlay, target);
1084 - else {
1085 - calculateMinWidth && (overlay.style.minWidth = DomHandler.getOuterWidth(target) + "px");
1086 - this.absolutePosition(overlay, target);
1087 - }
1088 - }
1089 - },
1090 - {
1091 - key: "absolutePosition",
1092 - value: function absolutePosition(element, target) {
1093 - var align = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "left";
1094 - if (element && target) {
1095 - var elementDimensions = element.offsetParent ? {
1096 - width: element.offsetWidth,
1097 - height: element.offsetHeight
1098 - } : this.getHiddenElementDimensions(element);
1099 - var elementOuterHeight = elementDimensions.height;
1100 - var elementOuterWidth = elementDimensions.width;
1101 - var targetOuterHeight = target.offsetHeight;
1102 - var targetOuterWidth = target.offsetWidth;
1103 - var targetOffset = target.getBoundingClientRect();
1104 - var windowScrollTop = this.getWindowScrollTop();
1105 - var windowScrollLeft = this.getWindowScrollLeft();
1106 - var viewport = this.getViewport();
1107 - var top;
1108 - var left;
1109 - if (targetOffset.top + targetOuterHeight + elementOuterHeight > viewport.height) {
1110 - top = targetOffset.top + windowScrollTop - elementOuterHeight;
1111 - if (top < 0) top = windowScrollTop;
1112 - element.style.transformOrigin = "bottom";
1113 - } else {
1114 - top = targetOuterHeight + targetOffset.top + windowScrollTop;
1115 - element.style.transformOrigin = "top";
1116 - }
1117 - var targetOffsetPx = targetOffset.left;
1118 - if (align === "left") if (targetOffsetPx + elementOuterWidth > viewport.width) left = Math.max(0, targetOffsetPx + windowScrollLeft + targetOuterWidth - elementOuterWidth);
1119 - else left = targetOffsetPx + windowScrollLeft;
1120 - else if (targetOffsetPx + targetOuterWidth - elementOuterWidth < 0) left = windowScrollLeft;
1121 - else left = targetOffsetPx + targetOuterWidth - elementOuterWidth + windowScrollLeft;
1122 - element.style.top = top + "px";
1123 - element.style.left = left + "px";
1124 - }
1125 - }
1126 - },
1127 - {
1128 - key: "relativePosition",
1129 - value: function relativePosition(element, target) {
1130 - if (element && target) {
1131 - var elementDimensions = element.offsetParent ? {
1132 - width: element.offsetWidth,
1133 - height: element.offsetHeight
1134 - } : this.getHiddenElementDimensions(element);
1135 - var targetHeight = target.offsetHeight;
1136 - var targetOffset = target.getBoundingClientRect();
1137 - var viewport = this.getViewport();
1138 - var top;
1139 - var left;
1140 - if (targetOffset.top + targetHeight + elementDimensions.height > viewport.height) {
1141 - top = -1 * elementDimensions.height;
1142 - if (targetOffset.top + top < 0) top = -1 * targetOffset.top;
1143 - element.style.transformOrigin = "bottom";
1144 - } else {
1145 - top = targetHeight;
1146 - element.style.transformOrigin = "top";
1147 - }
1148 - if (elementDimensions.width > viewport.width) left = targetOffset.left * -1;
1149 - else if (targetOffset.left + elementDimensions.width > viewport.width) left = (targetOffset.left + elementDimensions.width - viewport.width) * -1;
1150 - else left = 0;
1151 - element.style.top = top + "px";
1152 - element.style.left = left + "px";
1153 - }
1154 - }
1155 - },
1156 - {
1157 - key: "flipfitCollision",
1158 - value: function flipfitCollision(element, target) {
1159 - var _this2 = this;
1160 - var my = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "left top";
1161 - var at = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "left bottom";
1162 - var callback = arguments.length > 4 ? arguments[4] : void 0;
1163 - if (element && target) {
1164 - var targetOffset = target.getBoundingClientRect();
1165 - var viewport = this.getViewport();
1166 - var myArr = my.split(" ");
1167 - var atArr = at.split(" ");
1168 - var getPositionValue = function getPositionValue(arr, isOffset) {
1169 - return isOffset ? +arr.substring(arr.search(/(\+|-)/g)) || 0 : arr.substring(0, arr.search(/(\+|-)/g)) || arr;
1170 - };
1171 - var position = {
1172 - my: {
1173 - x: getPositionValue(myArr[0]),
1174 - y: getPositionValue(myArr[1] || myArr[0]),
1175 - offsetX: getPositionValue(myArr[0], true),
1176 - offsetY: getPositionValue(myArr[1] || myArr[0], true)
1177 - },
1178 - at: {
1179 - x: getPositionValue(atArr[0]),
1180 - y: getPositionValue(atArr[1] || atArr[0]),
1181 - offsetX: getPositionValue(atArr[0], true),
1182 - offsetY: getPositionValue(atArr[1] || atArr[0], true)
1183 - }
1184 - };
1185 - var myOffset = {
1186 - left: function left() {
1187 - return position.my.offsetX + position.at.offsetX + targetOffset.left + (position.my.x === "left" ? 0 : -1 * (position.my.x === "center" ? _this2.getOuterWidth(element) / 2 : _this2.getOuterWidth(element)));
1188 - },
1189 - top: function top() {
1190 - return position.my.offsetY + position.at.offsetY + targetOffset.top + (position.my.y === "top" ? 0 : -1 * (position.my.y === "center" ? _this2.getOuterHeight(element) / 2 : _this2.getOuterHeight(element)));
1191 - }
1192 - };
1193 - var alignWithAt = {
1194 - count: {
1195 - x: 0,
1196 - y: 0
1197 - },
1198 - left: function left() {
1199 - var left = myOffset.left();
1200 - var scrollLeft = DomHandler.getWindowScrollLeft();
1201 - element.style.left = left + scrollLeft + "px";
1202 - if (this.count.x === 2) {
1203 - element.style.left = scrollLeft + "px";
1204 - this.count.x = 0;
1205 - } else if (left < 0) {
1206 - this.count.x++;
1207 - position.my.x = "left";
1208 - position.at.x = "right";
1209 - position.my.offsetX *= -1;
1210 - position.at.offsetX *= -1;
1211 - this.right();
1212 - }
1213 - },
1214 - right: function right() {
1215 - var left = myOffset.left() + DomHandler.getOuterWidth(target);
1216 - var scrollLeft = DomHandler.getWindowScrollLeft();
1217 - element.style.left = left + scrollLeft + "px";
1218 - if (this.count.x === 2) {
1219 - element.style.left = viewport.width - DomHandler.getOuterWidth(element) + scrollLeft + "px";
1220 - this.count.x = 0;
1221 - } else if (left + DomHandler.getOuterWidth(element) > viewport.width) {
1222 - this.count.x++;
1223 - position.my.x = "right";
1224 - position.at.x = "left";
1225 - position.my.offsetX *= -1;
1226 - position.at.offsetX *= -1;
1227 - this.left();
1228 - }
1229 - },
1230 - top: function top() {
1231 - var top = myOffset.top();
1232 - var scrollTop = DomHandler.getWindowScrollTop();
1233 - element.style.top = top + scrollTop + "px";
1234 - if (this.count.y === 2) {
1235 - element.style.left = scrollTop + "px";
1236 - this.count.y = 0;
1237 - } else if (top < 0) {
1238 - this.count.y++;
1239 - position.my.y = "top";
1240 - position.at.y = "bottom";
1241 - position.my.offsetY *= -1;
1242 - position.at.offsetY *= -1;
1243 - this.bottom();
1244 - }
1245 - },
1246 - bottom: function bottom() {
1247 - var top = myOffset.top() + DomHandler.getOuterHeight(target);
1248 - var scrollTop = DomHandler.getWindowScrollTop();
1249 - element.style.top = top + scrollTop + "px";
1250 - if (this.count.y === 2) {
1251 - element.style.left = viewport.height - DomHandler.getOuterHeight(element) + scrollTop + "px";
1252 - this.count.y = 0;
1253 - } else if (top + DomHandler.getOuterHeight(target) > viewport.height) {
1254 - this.count.y++;
1255 - position.my.y = "bottom";
1256 - position.at.y = "top";
1257 - position.my.offsetY *= -1;
1258 - position.at.offsetY *= -1;
1259 - this.top();
1260 - }
1261 - },
1262 - center: function center(axis) {
1263 - if (axis === "y") {
1264 - var top = myOffset.top() + DomHandler.getOuterHeight(target) / 2;
1265 - element.style.top = top + DomHandler.getWindowScrollTop() + "px";
1266 - if (top < 0) this.bottom();
1267 - else if (top + DomHandler.getOuterHeight(target) > viewport.height) this.top();
1268 - } else {
1269 - var left = myOffset.left() + DomHandler.getOuterWidth(target) / 2;
1270 - element.style.left = left + DomHandler.getWindowScrollLeft() + "px";
1271 - if (left < 0) this.left();
1272 - else if (left + DomHandler.getOuterWidth(element) > viewport.width) this.right();
1273 - }
1274 - }
1275 - };
1276 - alignWithAt[position.at.x]("x");
1277 - alignWithAt[position.at.y]("y");
1278 - if (this.isFunction(callback)) callback(position);
1279 - }
1280 - }
1281 - },
1282 - {
1283 - key: "findCollisionPosition",
1284 - value: function findCollisionPosition(position) {
1285 - if (position) {
1286 - var isAxisY = position === "top" || position === "bottom";
1287 - var myXPosition = position === "left" ? "right" : "left";
1288 - var myYPosition = position === "top" ? "bottom" : "top";
1289 - if (isAxisY) return {
1290 - axis: "y",
1291 - my: "center ".concat(myYPosition),
1292 - at: "center ".concat(position)
1293 - };
1294 - return {
1295 - axis: "x",
1296 - my: "".concat(myXPosition, " center"),
1297 - at: "".concat(position, " center")
1298 - };
1299 - }
1300 - }
1301 - },
1302 - {
1303 - key: "getParents",
1304 - value: function getParents(element) {
1305 - var parents = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
1306 - return element.parentNode === null ? parents : this.getParents(element.parentNode, parents.concat([element.parentNode]));
1307 - }
1308 - },
1309 - {
1310 - key: "getScrollableParents",
1311 - value: function getScrollableParents(element) {
1312 - var _this3 = this;
1313 - var scrollableParents = [];
1314 - if (element) {
1315 - var parents = this.getParents(element);
1316 - var overflowRegex = /(auto|scroll)/;
1317 - /**
1318 - * Checks if an element has overflow scroll/auto in any direction
1319 - * @param {HTMLElement} node - Element to check
1320 - * @returns {boolean} True if element has overflow scroll/auto
1321 - */
1322 - var overflowCheck = function overflowCheck(node) {
1323 - var styleDeclaration = node ? getComputedStyle(node) : null;
1324 - return styleDeclaration && (overflowRegex.test(styleDeclaration.getPropertyValue("overflow")) || overflowRegex.test(styleDeclaration.getPropertyValue("overflow-x")) || overflowRegex.test(styleDeclaration.getPropertyValue("overflow-y")));
1325 - };
1326 - /**
1327 - * Adds a scrollable parent element to the collection
1328 - * @param {HTMLElement} node - Element to add
1329 - */
1330 - var addScrollableParent = function addScrollableParent(node) {
1331 - scrollableParents.push(node.nodeName === "BODY" || node.nodeName === "HTML" || _this3.isDocument(node) ? window : node);
1332 - };
1333 - var _iterator = _createForOfIteratorHelper$1(parents);
1334 - var _step;
1335 - try {
1336 - for (_iterator.s(); !(_step = _iterator.n()).done;) {
1337 - var _parent$dataset;
1338 - var parent = _step.value;
1339 - var scrollSelectors = parent.nodeType === 1 && ((_parent$dataset = parent.dataset) === null || _parent$dataset === void 0 ? void 0 : _parent$dataset.scrollselectors);
1340 - if (scrollSelectors) {
1341 - var _iterator2 = _createForOfIteratorHelper$1(scrollSelectors.split(","));
1342 - var _step2;
1343 - try {
1344 - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1345 - var selector = _step2.value;
1346 - var el = this.findSingle(parent, selector);
1347 - if (el && overflowCheck(el)) addScrollableParent(el);
1348 - }
1349 - } catch (err) {
1350 - _iterator2.e(err);
1351 - } finally {
1352 - _iterator2.f();
1353 - }
1354 - }
1355 - if (parent.nodeType === 1 && overflowCheck(parent)) addScrollableParent(parent);
1356 - }
1357 - } catch (err) {
1358 - _iterator.e(err);
1359 - } finally {
1360 - _iterator.f();
1361 - }
1362 - }
1363 - return scrollableParents;
1364 - }
1365 - },
1366 - {
1367 - key: "getHiddenElementOuterHeight",
1368 - value: function getHiddenElementOuterHeight(element) {
1369 - if (element) {
1370 - element.style.visibility = "hidden";
1371 - element.style.display = "block";
1372 - var elementHeight = element.offsetHeight;
1373 - element.style.display = "none";
1374 - element.style.visibility = "visible";
1375 - return elementHeight;
1376 - }
1377 - return 0;
1378 - }
1379 - },
1380 - {
1381 - key: "getHiddenElementOuterWidth",
1382 - value: function getHiddenElementOuterWidth(element) {
1383 - if (element) {
1384 - element.style.visibility = "hidden";
1385 - element.style.display = "block";
1386 - var elementWidth = element.offsetWidth;
1387 - element.style.display = "none";
1388 - element.style.visibility = "visible";
1389 - return elementWidth;
1390 - }
1391 - return 0;
1392 - }
1393 - },
1394 - {
1395 - key: "getHiddenElementDimensions",
1396 - value: function getHiddenElementDimensions(element) {
1397 - var dimensions = {};
1398 - if (element) {
1399 - element.style.visibility = "hidden";
1400 - element.style.display = "block";
1401 - dimensions.width = element.offsetWidth;
1402 - dimensions.height = element.offsetHeight;
1403 - element.style.display = "none";
1404 - element.style.visibility = "visible";
1405 - }
1406 - return dimensions;
1407 - }
1408 - },
1409 - {
1410 - key: "fadeIn",
1411 - value: function fadeIn(element, duration) {
1412 - if (element) {
1413 - element.style.opacity = 0;
1414 - var last = +/* @__PURE__ */ new Date();
1415 - var opacity = 0;
1416 - var _tick = function tick() {
1417 - opacity = +element.style.opacity + ((/* @__PURE__ */ new Date()).getTime() - last) / duration;
1418 - element.style.opacity = opacity;
1419 - last = +/* @__PURE__ */ new Date();
1420 - if (+opacity < 1) window.requestAnimationFrame && requestAnimationFrame(_tick) || setTimeout(_tick, 16);
1421 - };
1422 - _tick();
1423 - }
1424 - }
1425 - },
1426 - {
1427 - key: "fadeOut",
1428 - value: function fadeOut(element, duration) {
1429 - if (element) {
1430 - var opacity = 1;
1431 - var interval = 50;
1432 - var gap = interval / duration;
1433 - var fading = setInterval(function() {
1434 - opacity = opacity - gap;
1435 - if (opacity <= 0) {
1436 - opacity = 0;
1437 - clearInterval(fading);
1438 - }
1439 - element.style.opacity = opacity;
1440 - }, interval);
1441 - }
1442 - }
1443 - },
1444 - {
1445 - key: "getUserAgent",
1446 - value: function getUserAgent() {
1447 - return navigator.userAgent;
1448 - }
1449 - },
1450 - {
1451 - key: "isIOS",
1452 - value: function isIOS() {
1453 - return /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
1454 - }
1455 - },
1456 - {
1457 - key: "isAndroid",
1458 - value: function isAndroid() {
1459 - return /(android)/i.test(navigator.userAgent);
1460 - }
1461 - },
1462 - {
1463 - key: "isChrome",
1464 - value: function isChrome() {
1465 - return /(chrome)/i.test(navigator.userAgent);
1466 - }
1467 - },
1468 - {
1469 - key: "isClient",
1470 - value: function isClient() {
1471 - return !!(typeof window !== "undefined" && window.document && window.document.createElement);
1472 - }
1473 - },
1474 - {
1475 - key: "isTouchDevice",
1476 - value: function isTouchDevice() {
1477 - return "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
1478 - }
1479 - },
1480 - {
1481 - key: "isFunction",
1482 - value: function isFunction(obj) {
1483 - return !!(obj && obj.constructor && obj.call && obj.apply);
1484 - }
1485 - },
1486 - {
1487 - key: "appendChild",
1488 - value: function appendChild(element, target) {
1489 - if (this.isElement(target)) target.appendChild(element);
1490 - else if (target.el && target.el.nativeElement) target.el.nativeElement.appendChild(element);
1491 - else throw new Error("Cannot append " + target + " to " + element);
1492 - }
1493 - },
1494 - {
1495 - key: "removeChild",
1496 - value: function removeChild(element, target) {
1497 - if (this.isElement(target)) target.removeChild(element);
1498 - else if (target.el && target.el.nativeElement) target.el.nativeElement.removeChild(element);
1499 - else throw new Error("Cannot remove " + element + " from " + target);
1500 - }
1501 - },
1502 - {
1503 - key: "isElement",
1504 - value: function isElement(obj) {
1505 - return (typeof HTMLElement === "undefined" ? "undefined" : _typeof$6(HTMLElement)) === "object" ? obj instanceof HTMLElement : obj && _typeof$6(obj) === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string";
1506 - }
1507 - },
1508 - {
1509 - key: "isDocument",
1510 - value: function isDocument(obj) {
1511 - return (typeof Document === "undefined" ? "undefined" : _typeof$6(Document)) === "object" ? obj instanceof Document : obj && _typeof$6(obj) === "object" && obj !== null && obj.nodeType === 9;
1512 - }
1513 - },
1514 - {
1515 - key: "scrollInView",
1516 - value: function scrollInView(container, item) {
1517 - var borderTopValue = getComputedStyle(container).getPropertyValue("border-top-width");
1518 - var borderTop = borderTopValue ? parseFloat(borderTopValue) : 0;
1519 - var paddingTopValue = getComputedStyle(container).getPropertyValue("padding-top");
1520 - var paddingTop = paddingTopValue ? parseFloat(paddingTopValue) : 0;
1521 - var containerRect = container.getBoundingClientRect();
1522 - var offset = item.getBoundingClientRect().top + document.body.scrollTop - (containerRect.top + document.body.scrollTop) - borderTop - paddingTop;
1523 - var scroll = container.scrollTop;
1524 - var elementHeight = container.clientHeight;
1525 - var itemHeight = this.getOuterHeight(item);
1526 - if (offset < 0) container.scrollTop = scroll + offset;
1527 - else if (offset + itemHeight > elementHeight) container.scrollTop = scroll + offset - elementHeight + itemHeight;
1528 - }
1529 - },
1530 - {
1531 - key: "clearSelection",
1532 - value: function clearSelection() {
1533 - if (window.getSelection) {
1534 - if (window.getSelection().empty) window.getSelection().empty();
1535 - else if (window.getSelection().removeAllRanges && window.getSelection().rangeCount > 0 && window.getSelection().getRangeAt(0).getClientRects().length > 0) window.getSelection().removeAllRanges();
1536 - } else if (document.selection && document.selection.empty) try {
1537 - document.selection.empty();
1538 - } catch (error) {}
1539 - }
1540 - },
1541 - {
1542 - key: "calculateScrollbarWidth",
1543 - value: function calculateScrollbarWidth(el) {
1544 - if (el) {
1545 - var style = getComputedStyle(el);
1546 - return el.offsetWidth - el.clientWidth - parseFloat(style.borderLeftWidth) - parseFloat(style.borderRightWidth);
1547 - }
1548 - if (this.calculatedScrollbarWidth != null) return this.calculatedScrollbarWidth;
1549 - var scrollDiv = document.createElement("div");
1550 - scrollDiv.className = "p-scrollbar-measure";
1551 - document.body.appendChild(scrollDiv);
1552 - var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
1553 - document.body.removeChild(scrollDiv);
1554 - this.calculatedScrollbarWidth = scrollbarWidth;
1555 - return scrollbarWidth;
1556 - }
1557 - },
1558 - {
1559 - key: "calculateBodyScrollbarWidth",
1560 - value: function calculateBodyScrollbarWidth() {
1561 - return window.innerWidth - document.documentElement.offsetWidth;
1562 - }
1563 - },
1564 - {
1565 - key: "getBrowser",
1566 - value: function getBrowser() {
1567 - if (!this.browser) {
1568 - var matched = this.resolveUserAgent();
1569 - this.browser = {};
1570 - if (matched.browser) {
1571 - this.browser[matched.browser] = true;
1572 - this.browser.version = matched.version;
1573 - }
1574 - if (this.browser.chrome) this.browser.webkit = true;
1575 - else if (this.browser.webkit) this.browser.safari = true;
1576 - }
1577 - return this.browser;
1578 - }
1579 - },
1580 - {
1581 - key: "resolveUserAgent",
1582 - value: function resolveUserAgent() {
1583 - var ua = navigator.userAgent.toLowerCase();
1584 - var match = /(chrome)[ ]([\w.]+)/.exec(ua) || /(webkit)[ ]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ ]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || [];
1585 - return {
1586 - browser: match[1] || "",
1587 - version: match[2] || "0"
1588 - };
1589 - }
1590 - },
1591 - {
1592 - key: "blockBodyScroll",
1593 - value: function blockBodyScroll() {
1594 - var className = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "p-overflow-hidden";
1595 - !document.body.style.getPropertyValue("--scrollbar-width") && document.body.style.setProperty("--scrollbar-width", this.calculateBodyScrollbarWidth() + "px");
1596 - this.addClass(document.body, className);
1597 - }
1598 - },
1599 - {
1600 - key: "unblockBodyScroll",
1601 - value: function unblockBodyScroll() {
1602 - var className = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "p-overflow-hidden";
1603 - document.body.style.removeProperty("--scrollbar-width");
1604 - this.removeClass(document.body, className);
1605 - }
1606 - },
1607 - {
1608 - key: "isVisible",
1609 - value: function isVisible(element) {
1610 - return element && (element.clientHeight !== 0 || element.getClientRects().length !== 0 || getComputedStyle(element).display !== "none");
1611 - }
1612 - },
1613 - {
1614 - key: "isExist",
1615 - value: function isExist(element) {
1616 - return !!(element !== null && typeof element !== "undefined" && element.nodeName && element.parentNode);
1617 - }
1618 - },
1619 - {
1620 - key: "getFocusableElements",
1621 - value: function getFocusableElements(element) {
1622 - var selector = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
1623 - var focusableElements = DomHandler.find(element, "button:not([tabindex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])".concat(selector, ",\n [href][clientHeight][clientWidth]:not([tabindex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector, ",\n input:not([tabindex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector, ",\n select:not([tabindex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector, ",\n textarea:not([tabindex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector, ",\n [tabIndex]:not([tabIndex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector, ",\n [contenteditable]:not([tabIndex = \"-1\"]):not([disabled]):not([style*=\"display:none\"]):not([hidden])").concat(selector));
1624 - var visibleFocusableElements = [];
1625 - var _iterator3 = _createForOfIteratorHelper$1(focusableElements);
1626 - var _step3;
1627 - try {
1628 - for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1629 - var focusableElement = _step3.value;
1630 - if (getComputedStyle(focusableElement).display !== "none" && getComputedStyle(focusableElement).visibility !== "hidden") visibleFocusableElements.push(focusableElement);
1631 - }
1632 - } catch (err) {
1633 - _iterator3.e(err);
1634 - } finally {
1635 - _iterator3.f();
1636 - }
1637 - return visibleFocusableElements;
1638 - }
1639 - },
1640 - {
1641 - key: "getFirstFocusableElement",
1642 - value: function getFirstFocusableElement(element, selector) {
1643 - var focusableElements = DomHandler.getFocusableElements(element, selector);
1644 - return focusableElements.length > 0 ? focusableElements[0] : null;
1645 - }
1646 - },
1647 - {
1648 - key: "getLastFocusableElement",
1649 - value: function getLastFocusableElement(element, selector) {
1650 - var focusableElements = DomHandler.getFocusableElements(element, selector);
1651 - return focusableElements.length > 0 ? focusableElements[focusableElements.length - 1] : null;
1652 - }
1653 - },
1654 - {
1655 - key: "focus",
1656 - value: function focus(el, scrollTo) {
1657 - var preventScroll = scrollTo === void 0 ? true : !scrollTo;
1658 - el && document.activeElement !== el && el.focus({ preventScroll });
1659 - }
1660 - },
1661 - {
1662 - key: "focusFirstElement",
1663 - value: function focusFirstElement(el, scrollTo) {
1664 - if (!el) return;
1665 - var firstFocusableElement = DomHandler.getFirstFocusableElement(el);
1666 - firstFocusableElement && DomHandler.focus(firstFocusableElement, scrollTo);
1667 - return firstFocusableElement;
1668 - }
1669 - },
1670 - {
1671 - key: "getCursorOffset",
1672 - value: function getCursorOffset(el, prevText, nextText, currentText) {
1673 - if (el) {
1674 - var style = getComputedStyle(el);
1675 - var ghostDiv = document.createElement("div");
1676 - ghostDiv.style.position = "absolute";
1677 - ghostDiv.style.top = "0px";
1678 - ghostDiv.style.left = "0px";
1679 - ghostDiv.style.visibility = "hidden";
1680 - ghostDiv.style.pointerEvents = "none";
1681 - ghostDiv.style.overflow = style.overflow;
1682 - ghostDiv.style.width = style.width;
1683 - ghostDiv.style.height = style.height;
1684 - ghostDiv.style.padding = style.padding;
1685 - ghostDiv.style.border = style.border;
1686 - ghostDiv.style.overflowWrap = style.overflowWrap;
1687 - ghostDiv.style.whiteSpace = style.whiteSpace;
1688 - ghostDiv.style.lineHeight = style.lineHeight;
1689 - ghostDiv.innerHTML = prevText.replace(/\r\n|\r|\n/g, "<br />");
1690 - var ghostSpan = document.createElement("span");
1691 - ghostSpan.textContent = currentText;
1692 - ghostDiv.appendChild(ghostSpan);
1693 - var text = document.createTextNode(nextText);
1694 - ghostDiv.appendChild(text);
1695 - document.body.appendChild(ghostDiv);
1696 - var offsetLeft = ghostSpan.offsetLeft;
1697 - var offsetTop = ghostSpan.offsetTop;
1698 - var clientHeight = ghostSpan.clientHeight;
1699 - document.body.removeChild(ghostDiv);
1700 - return {
1701 - left: Math.abs(offsetLeft - el.scrollLeft),
1702 - top: Math.abs(offsetTop - el.scrollTop) + clientHeight
1703 - };
1704 - }
1705 - return {
1706 - top: "auto",
1707 - left: "auto"
1708 - };
1709 - }
1710 - },
1711 - {
1712 - key: "invokeElementMethod",
1713 - value: function invokeElementMethod(element, methodName, args) {
1714 - element[methodName].apply(element, args);
1715 - }
1716 - },
1717 - {
1718 - key: "isClickable",
1719 - value: function isClickable(element) {
1720 - var targetNode = element.nodeName;
1721 - var parentNode = element.parentElement && element.parentElement.nodeName;
1722 - return targetNode === "INPUT" || targetNode === "TEXTAREA" || targetNode === "BUTTON" || targetNode === "A" || parentNode === "INPUT" || parentNode === "TEXTAREA" || parentNode === "BUTTON" || parentNode === "A" || this.hasClass(element, "p-button") || this.hasClass(element.parentElement, "p-button") || this.hasClass(element.parentElement, "p-checkbox") || this.hasClass(element.parentElement, "p-radiobutton");
1723 - }
1724 - },
1725 - {
1726 - key: "applyStyle",
1727 - value: function applyStyle(element, style) {
1728 - if (typeof style === "string") element.style.cssText = style;
1729 - else for (var prop in style) element.style[prop] = style[prop];
1730 - }
1731 - },
1732 - {
1733 - key: "exportCSV",
1734 - value: function exportCSV(csv, filename) {
1735 - var blob = new Blob([csv], { type: "application/csv;charset=utf-8;" });
1736 - if (window.navigator.msSaveOrOpenBlob) navigator.msSaveOrOpenBlob(blob, filename + ".csv");
1737 - else if (!DomHandler.saveAs({
1738 - name: filename + ".csv",
1739 - src: URL.createObjectURL(blob)
1740 - })) {
1741 - csv = "data:text/csv;charset=utf-8," + csv;
1742 - window.open(encodeURI(csv));
1743 - }
1744 - }
1745 - },
1746 - {
1747 - key: "saveAs",
1748 - value: function saveAs(file) {
1749 - if (file) {
1750 - var link = document.createElement("a");
1751 - if (link.download !== void 0) {
1752 - var name = file.name;
1753 - var src = file.src;
1754 - link.setAttribute("href", src);
1755 - link.setAttribute("download", name);
1756 - link.style.display = "none";
1757 - document.body.appendChild(link);
1758 - link.click();
1759 - document.body.removeChild(link);
1760 - return true;
1761 - }
1762 - }
1763 - return false;
1764 - }
1765 - },
1766 - {
1767 - key: "createInlineStyle",
1768 - value: function createInlineStyle(nonce, styleContainer) {
1769 - var styleElement = document.createElement("style");
1770 - DomHandler.addNonce(styleElement, nonce);
1771 - if (!styleContainer) styleContainer = document.head;
1772 - styleContainer.appendChild(styleElement);
1773 - return styleElement;
1774 - }
1775 - },
1776 - {
1777 - key: "removeInlineStyle",
1778 - value: function removeInlineStyle(styleElement) {
1779 - if (this.isExist(styleElement)) {
1780 - try {
1781 - styleElement.parentNode.removeChild(styleElement);
1782 - } catch (error) {}
1783 - styleElement = null;
1784 - }
1785 - return styleElement;
1786 - }
1787 - },
1788 - {
1789 - key: "addNonce",
1790 - value: function addNonce(styleElement, nonce) {
1791 - try {
1792 - if (!nonce) nonce = {}.REACT_APP_CSS_NONCE;
1793 - } catch (error) {}
1794 - nonce && styleElement.setAttribute("nonce", nonce);
1795 - }
1796 - },
1797 - {
1798 - key: "getTargetElement",
1799 - value: function getTargetElement(target) {
1800 - if (!target) return null;
1801 - if (target === "document") return document;
1802 - else if (target === "window") return window;
1803 - else if (_typeof$6(target) === "object" && target.hasOwnProperty("current")) return this.isExist(target.current) ? target.current : null;
1804 - var element = function isFunction(obj) {
1805 - return !!(obj && obj.constructor && obj.call && obj.apply);
1806 - }(target) ? target() : target;
1807 - return this.isDocument(element) || this.isExist(element) ? element : null;
1808 - }
1809 - },
1810 - {
1811 - key: "getAttributeNames",
1812 - value: function getAttributeNames(node) {
1813 - var index;
1814 - var rv;
1815 - var attrs;
1816 - rv = [];
1817 - attrs = node.attributes;
1818 - for (index = 0; index < attrs.length; ++index) rv.push(attrs[index].nodeName);
1819 - rv.sort();
1820 - return rv;
1821 - }
1822 - },
1823 - {
1824 - key: "isEqualElement",
1825 - value: function isEqualElement(elm1, elm2) {
1826 - var attrs1;
1827 - var attrs2;
1828 - var name;
1829 - var node1;
1830 - var node2;
1831 - attrs1 = DomHandler.getAttributeNames(elm1);
1832 - attrs2 = DomHandler.getAttributeNames(elm2);
1833 - if (attrs1.join(",") !== attrs2.join(",")) return false;
1834 - for (var index = 0; index < attrs1.length; ++index) {
1835 - name = attrs1[index];
1836 - if (name === "style") {
1837 - var astyle = elm1.style;
1838 - var bstyle = elm2.style;
1839 - var rexDigitsOnly = /^\d+$/;
1840 - for (var _i3 = 0, _Object$keys = Object.keys(astyle); _i3 < _Object$keys.length; _i3++) {
1841 - var key = _Object$keys[_i3];
1842 - if (!rexDigitsOnly.test(key) && astyle[key] !== bstyle[key]) return false;
1843 - }
1844 - } else if (elm1.getAttribute(name) !== elm2.getAttribute(name)) return false;
1845 - }
1846 - for (node1 = elm1.firstChild, node2 = elm2.firstChild; node1 && node2; node1 = node1.nextSibling, node2 = node2.nextSibling) {
1847 - if (node1.nodeType !== node2.nodeType) return false;
1848 - if (node1.nodeType === 1) {
1849 - if (!DomHandler.isEqualElement(node1, node2)) return false;
1850 - } else if (node1.nodeValue !== node2.nodeValue) return false;
1851 - }
1852 - if (node1 || node2) return false;
1853 - return true;
1854 - }
1855 - },
1856 - {
1857 - key: "hasCSSAnimation",
1858 - value: function hasCSSAnimation(element) {
1859 - if (element) {
1860 - var style = getComputedStyle(element);
1861 - return parseFloat(style.getPropertyValue("animation-duration") || "0") > 0;
1862 - }
1863 - return false;
1864 - }
1865 - },
1866 - {
1867 - key: "hasCSSTransition",
1868 - value: function hasCSSTransition(element) {
1869 - if (element) {
1870 - var style = getComputedStyle(element);
1871 - return parseFloat(style.getPropertyValue("transition-duration") || "0") > 0;
1872 - }
1873 - return false;
1874 - }
1875 - }
1876 - ]);
1877 - }();
1878 - /**
1879 - * All data- properties like data-test-id
1880 - */
1881 - _defineProperty$6(DomHandler, "DATA_PROPS", ["data-"]);
1882 - /**
1883 - * All ARIA properties like aria-label and focus-target for https://www.npmjs.com/package/@q42/floating-focus-a11y
1884 - */
1885 - _defineProperty$6(DomHandler, "ARIA_PROPS", ["aria", "focus-target"]);
1886 - function EventBus$1() {
1887 - var allHandlers = /* @__PURE__ */ new Map();
1888 - return {
1889 - on: function on(type, handler) {
1890 - var handlers = allHandlers.get(type);
1891 - if (!handlers) handlers = [handler];
1892 - else handlers.push(handler);
1893 - allHandlers.set(type, handlers);
1894 - },
1895 - off: function off(type, handler) {
1896 - var handlers = allHandlers.get(type);
1897 - handlers && handlers.splice(handlers.indexOf(handler) >>> 0, 1);
1898 - },
1899 - emit: function emit(type, evt) {
1900 - var handlers = allHandlers.get(type);
1901 - handlers && handlers.slice().forEach(function(handler) {
1902 - return handler(evt);
1903 - });
1904 - }
1905 - };
1906 - }
1907 - __name(EventBus$1, "EventBus");
1908 - function _createForOfIteratorHelper(r, e) {
1909 - var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
1910 - if (!t) {
1911 - if (Array.isArray(r) || (t = _unsupportedIterableToArray$7(r)) || e && r && "number" == typeof r.length) {
1912 - t && (r = t);
1913 - var _n = 0;
1914 - var F = function F() {};
1915 - return {
1916 - s: F,
1917 - n: function n() {
1918 - return _n >= r.length ? { done: !0 } : {
1919 - done: !1,
1920 - value: r[_n++]
1921 - };
1922 - },
1923 - e: function e(r) {
1924 - throw r;
1925 - },
1926 - f: F
1927 - };
1928 - }
1929 - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1930 - }
1931 - var o;
1932 - var a = !0;
1933 - var u = !1;
1934 - return {
1935 - s: function s() {
1936 - t = t.call(r);
1937 - },
1938 - n: function n() {
1939 - var r = t.next();
1940 - return a = r.done, r;
1941 - },
1942 - e: function e(r) {
1943 - u = !0, o = r;
1944 - },
1945 - f: function f() {
1946 - try {
1947 - a || null == t["return"] || t["return"]();
1948 - } finally {
1949 - if (u) throw o;
1950 - }
1951 - }
1952 - };
1953 - }
1954 - function _unsupportedIterableToArray$7(r, a) {
1955 - if (r) {
1956 - if ("string" == typeof r) return _arrayLikeToArray$7(r, a);
1957 - var t = {}.toString.call(r).slice(8, -1);
1958 - return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$7(r, a) : void 0;
1959 - }
1960 - }
1961 - __name(_unsupportedIterableToArray$7, "_unsupportedIterableToArray");
1962 - function _arrayLikeToArray$7(r, a) {
1963 - (null == a || a > r.length) && (a = r.length);
1964 - for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
1965 - return n;
1966 - }
1967 - __name(_arrayLikeToArray$7, "_arrayLikeToArray");
1968 - var ObjectUtils = /*#__PURE__*/ function() {
1969 - function ObjectUtils() {
1970 - _classCallCheck$1(this, ObjectUtils);
1971 - }
1972 - return _createClass$1(ObjectUtils, null, [
1973 - {
1974 - key: "equals",
1975 - value: function equals(obj1, obj2, field) {
1976 - if (field && obj1 && _typeof$6(obj1) === "object" && obj2 && _typeof$6(obj2) === "object") return this.deepEquals(this.resolveFieldData(obj1, field), this.resolveFieldData(obj2, field));
1977 - return this.deepEquals(obj1, obj2);
1978 - }
1979 - },
1980 - {
1981 - key: "deepEquals",
1982 - value: function deepEquals(a, b) {
1983 - if (a === b) return true;
1984 - if (a && b && _typeof$6(a) === "object" && _typeof$6(b) === "object") {
1985 - var arrA = Array.isArray(a);
1986 - var arrB = Array.isArray(b);
1987 - var i;
1988 - var length;
1989 - var key;
1990 - if (arrA && arrB) {
1991 - length = a.length;
1992 - if (length !== b.length) return false;
1993 - for (i = length; i-- !== 0;) if (!this.deepEquals(a[i], b[i])) return false;
1994 - return true;
1995 - }
1996 - if (arrA !== arrB) return false;
1997 - var dateA = a instanceof Date;
1998 - var dateB = b instanceof Date;
1999 - if (dateA !== dateB) return false;
2000 - if (dateA && dateB) return a.getTime() === b.getTime();
2001 - var regexpA = a instanceof RegExp;
2002 - var regexpB = b instanceof RegExp;
2003 - if (regexpA !== regexpB) return false;
2004 - if (regexpA && regexpB) return a.toString() === b.toString();
2005 - var keys = Object.keys(a);
2006 - length = keys.length;
2007 - if (length !== Object.keys(b).length) return false;
2008 - for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
2009 - for (i = length; i-- !== 0;) {
2010 - key = keys[i];
2011 - if (!this.deepEquals(a[key], b[key])) return false;
2012 - }
2013 - return true;
2014 - }
2015 - return a !== a && b !== b;
2016 - }
2017 - },
2018 - {
2019 - key: "resolveFieldData",
2020 - value: function resolveFieldData(data, field) {
2021 - if (!data || !field) return null;
2022 - try {
2023 - var value = data[field];
2024 - if (this.isNotEmpty(value)) return value;
2025 - } catch (_unused) {}
2026 - if (Object.keys(data).length) {
2027 - if (this.isFunction(field)) return field(data);
2028 - else if (this.isNotEmpty(data[field])) return data[field];
2029 - else if (field.indexOf(".") === -1) return data[field];
2030 - var fields = field.split(".");
2031 - var _value = data;
2032 - for (var i = 0, len = fields.length; i < len; ++i) {
2033 - if (_value == null) return null;
2034 - _value = _value[fields[i]];
2035 - }
2036 - return _value;
2037 - }
2038 - return null;
2039 - }
2040 - },
2041 - {
2042 - key: "findDiffKeys",
2043 - value: function findDiffKeys(obj1, obj2) {
2044 - if (!obj1 || !obj2) return {};
2045 - return Object.keys(obj1).filter(function(key) {
2046 - return !obj2.hasOwnProperty(key);
2047 - }).reduce(function(result, current) {
2048 - result[current] = obj1[current];
2049 - return result;
2050 - }, {});
2051 - }
2052 - },
2053 - {
2054 - key: "reduceKeys",
2055 - value: function reduceKeys(obj, startsWiths) {
2056 - var result = {};
2057 - if (!obj || !startsWiths || startsWiths.length === 0) return result;
2058 - Object.keys(obj).filter(function(key) {
2059 - return startsWiths.some(function(value) {
2060 - return key.startsWith(value);
2061 - });
2062 - }).forEach(function(key) {
2063 - result[key] = obj[key];
2064 - delete obj[key];
2065 - });
2066 - return result;
2067 - }
2068 - },
2069 - {
2070 - key: "reorderArray",
2071 - value: function reorderArray(value, from, to) {
2072 - if (value && from !== to) {
2073 - if (to >= value.length) {
2074 - to = to % value.length;
2075 - from = from % value.length;
2076 - }
2077 - value.splice(to, 0, value.splice(from, 1)[0]);
2078 - }
2079 - }
2080 - },
2081 - {
2082 - key: "findIndexInList",
2083 - value: function findIndexInList(value, list, dataKey) {
2084 - var _this = this;
2085 - if (list) return dataKey ? list.findIndex(function(item) {
2086 - return _this.equals(item, value, dataKey);
2087 - }) : list.findIndex(function(item) {
2088 - return item === value;
2089 - });
2090 - return -1;
2091 - }
2092 - },
2093 - {
2094 - key: "getJSXElement",
2095 - value: function getJSXElement(obj) {
2096 - for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) params[_key - 1] = arguments[_key];
2097 - return this.isFunction(obj) ? obj.apply(void 0, params) : obj;
2098 - }
2099 - },
2100 - {
2101 - key: "getItemValue",
2102 - value: function getItemValue(obj) {
2103 - for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) params[_key2 - 1] = arguments[_key2];
2104 - return this.isFunction(obj) ? obj.apply(void 0, params) : obj;
2105 - }
2106 - },
2107 - {
2108 - key: "getProp",
2109 - value: function getProp(props) {
2110 - var prop = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
2111 - var defaultProps = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2112 - var value = props ? props[prop] : void 0;
2113 - return value === void 0 ? defaultProps[prop] : value;
2114 - }
2115 - },
2116 - {
2117 - key: "getPropCaseInsensitive",
2118 - value: function getPropCaseInsensitive(props, prop) {
2119 - var defaultProps = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2120 - var fkey = this.toFlatCase(prop);
2121 - for (var key in props) if (props.hasOwnProperty(key) && this.toFlatCase(key) === fkey) return props[key];
2122 - for (var _key3 in defaultProps) if (defaultProps.hasOwnProperty(_key3) && this.toFlatCase(_key3) === fkey) return defaultProps[_key3];
2123 - }
2124 - },
2125 - {
2126 - key: "getMergedProps",
2127 - value: function getMergedProps(props, defaultProps) {
2128 - return Object.assign({}, defaultProps, props);
2129 - }
2130 - },
2131 - {
2132 - key: "getDiffProps",
2133 - value: function getDiffProps(props, defaultProps) {
2134 - return this.findDiffKeys(props, defaultProps);
2135 - }
2136 - },
2137 - {
2138 - key: "getPropValue",
2139 - value: function getPropValue(obj) {
2140 - if (!this.isFunction(obj)) return obj;
2141 - for (var _len3 = arguments.length, params = new Array(_len3 > 1 ? _len3 - 1 : 0), _key4 = 1; _key4 < _len3; _key4++) params[_key4 - 1] = arguments[_key4];
2142 - if (params.length === 1) {
2143 - var param = params[0];
2144 - return obj(Array.isArray(param) ? param[0] : param);
2145 - }
2146 - return obj.apply(void 0, params);
2147 - }
2148 - },
2149 - {
2150 - key: "getComponentProp",
2151 - value: function getComponentProp(component) {
2152 - var prop = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
2153 - var defaultProps = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2154 - return this.isNotEmpty(component) ? this.getProp(component.props, prop, defaultProps) : void 0;
2155 - }
2156 - },
2157 - {
2158 - key: "getComponentProps",
2159 - value: function getComponentProps(component, defaultProps) {
2160 - return this.isNotEmpty(component) ? this.getMergedProps(component.props, defaultProps) : void 0;
2161 - }
2162 - },
2163 - {
2164 - key: "getComponentDiffProps",
2165 - value: function getComponentDiffProps(component, defaultProps) {
2166 - return this.isNotEmpty(component) ? this.getDiffProps(component.props, defaultProps) : void 0;
2167 - }
2168 - },
2169 - {
2170 - key: "isValidChild",
2171 - value: function isValidChild(child, type, validTypes) {
2172 - if (child) {
2173 - var _child$type;
2174 - var childType = this.getComponentProp(child, "__TYPE") || (child.type ? child.type.displayName : void 0);
2175 - if (!childType && child !== null && child !== void 0 && (_child$type = child.type) !== null && _child$type !== void 0 && (_child$type = _child$type._payload) !== null && _child$type !== void 0 && _child$type.value) childType = child.type._payload.value.find(function(v) {
2176 - return v === type;
2177 - });
2178 - return childType === type;
2179 - }
2180 - return false;
2181 - }
2182 - },
2183 - {
2184 - key: "getRefElement",
2185 - value: function getRefElement(ref) {
2186 - if (ref) return _typeof$6(ref) === "object" && ref.hasOwnProperty("current") ? ref.current : ref;
2187 - return null;
2188 - }
2189 - },
2190 - {
2191 - key: "combinedRefs",
2192 - value: function combinedRefs(innerRef, forwardRef) {
2193 - if (innerRef && forwardRef) if (typeof forwardRef === "function") forwardRef(innerRef.current);
2194 - else forwardRef.current = innerRef.current;
2195 - }
2196 - },
2197 - {
2198 - key: "removeAccents",
2199 - value: function removeAccents(str) {
2200 - if (str && str.search(/[\xC0-\xFF]/g) > -1) str = str.replace(/[\xC0-\xC5]/g, "A").replace(/[\xC6]/g, "AE").replace(/[\xC7]/g, "C").replace(/[\xC8-\xCB]/g, "E").replace(/[\xCC-\xCF]/g, "I").replace(/[\xD0]/g, "D").replace(/[\xD1]/g, "N").replace(/[\xD2-\xD6\xD8]/g, "O").replace(/[\xD9-\xDC]/g, "U").replace(/[\xDD]/g, "Y").replace(/[\xDE]/g, "P").replace(/[\xE0-\xE5]/g, "a").replace(/[\xE6]/g, "ae").replace(/[\xE7]/g, "c").replace(/[\xE8-\xEB]/g, "e").replace(/[\xEC-\xEF]/g, "i").replace(/[\xF1]/g, "n").replace(/[\xF2-\xF6\xF8]/g, "o").replace(/[\xF9-\xFC]/g, "u").replace(/[\xFE]/g, "p").replace(/[\xFD\xFF]/g, "y");
2201 - return str;
2202 - }
2203 - },
2204 - {
2205 - key: "toFlatCase",
2206 - value: function toFlatCase(str) {
2207 - return this.isNotEmpty(str) && this.isString(str) ? str.replace(/(-|_)/g, "").toLowerCase() : str;
2208 - }
2209 - },
2210 - {
2211 - key: "toCapitalCase",
2212 - value: function toCapitalCase(str) {
2213 - return this.isNotEmpty(str) && this.isString(str) ? str[0].toUpperCase() + str.slice(1) : str;
2214 - }
2215 - },
2216 - {
2217 - key: "trim",
2218 - value: function trim(value) {
2219 - return this.isNotEmpty(value) && this.isString(value) ? value.trim() : value;
2220 - }
2221 - },
2222 - {
2223 - key: "isEmpty",
2224 - value: function isEmpty(value) {
2225 - return value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0 || !(value instanceof Date) && _typeof$6(value) === "object" && Object.keys(value).length === 0;
2226 - }
2227 - },
2228 - {
2229 - key: "isNotEmpty",
2230 - value: function isNotEmpty(value) {
2231 - return !this.isEmpty(value);
2232 - }
2233 - },
2234 - {
2235 - key: "isFunction",
2236 - value: function isFunction(value) {
2237 - return !!(value && value.constructor && value.call && value.apply);
2238 - }
2239 - },
2240 - {
2241 - key: "isObject",
2242 - value: function isObject(value) {
2243 - return value !== null && value instanceof Object && value.constructor === Object;
2244 - }
2245 - },
2246 - {
2247 - key: "isDate",
2248 - value: function isDate(value) {
2249 - return value !== null && value instanceof Date && value.constructor === Date;
2250 - }
2251 - },
2252 - {
2253 - key: "isArray",
2254 - value: function isArray(value) {
2255 - return value !== null && Array.isArray(value);
2256 - }
2257 - },
2258 - {
2259 - key: "isString",
2260 - value: function isString(value) {
2261 - return value !== null && typeof value === "string";
2262 - }
2263 - },
2264 - {
2265 - key: "isPrintableCharacter",
2266 - value: function isPrintableCharacter() {
2267 - var _char = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
2268 - return this.isNotEmpty(_char) && _char.length === 1 && _char.match(/\S| /);
2269 - }
2270 - },
2271 - {
2272 - key: "isLetter",
2273 - value: function isLetter(_char2) {
2274 - return /^[a-zA-Z\u00C0-\u017F]$/.test(_char2);
2275 - }
2276 - },
2277 - {
2278 - key: "isScalar",
2279 - value: function isScalar(value) {
2280 - return value != null && (typeof value === "string" || typeof value === "number" || typeof value === "bigint" || typeof value === "boolean");
2281 - }
2282 - },
2283 - {
2284 - key: "findLast",
2285 - value: function findLast(arr, callback) {
2286 - var item;
2287 - if (this.isNotEmpty(arr)) try {
2288 - item = arr.findLast(callback);
2289 - } catch (_unused2) {
2290 - item = _toConsumableArray$5(arr).reverse().find(callback);
2291 - }
2292 - return item;
2293 - }
2294 - },
2295 - {
2296 - key: "findLastIndex",
2297 - value: function findLastIndex(arr, callback) {
2298 - var index = -1;
2299 - if (this.isNotEmpty(arr)) try {
2300 - index = arr.findLastIndex(callback);
2301 - } catch (_unused3) {
2302 - index = arr.lastIndexOf(_toConsumableArray$5(arr).reverse().find(callback));
2303 - }
2304 - return index;
2305 - }
2306 - },
2307 - {
2308 - key: "sort",
2309 - value: function sort(value1, value2) {
2310 - var order = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
2311 - var comparator = arguments.length > 3 ? arguments[3] : void 0;
2312 - var nullSortOrder = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 1;
2313 - var result = this.compare(value1, value2, comparator, order);
2314 - var finalSortOrder = order;
2315 - if (this.isEmpty(value1) || this.isEmpty(value2)) finalSortOrder = nullSortOrder === 1 ? order : nullSortOrder;
2316 - return finalSortOrder * result;
2317 - }
2318 - },
2319 - {
2320 - key: "compare",
2321 - value: function compare(value1, value2, comparator) {
2322 - var order = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1;
2323 - var result = -1;
2324 - var emptyValue1 = this.isEmpty(value1);
2325 - var emptyValue2 = this.isEmpty(value2);
2326 - if (emptyValue1 && emptyValue2) result = 0;
2327 - else if (emptyValue1) result = order;
2328 - else if (emptyValue2) result = -order;
2329 - else if (typeof value1 === "string" && typeof value2 === "string") result = comparator(value1, value2);
2330 - else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
2331 - return result;
2332 - }
2333 - },
2334 - {
2335 - key: "localeComparator",
2336 - value: function localeComparator(locale) {
2337 - return new Intl.Collator(locale, { numeric: true }).compare;
2338 - }
2339 - },
2340 - {
2341 - key: "findChildrenByKey",
2342 - value: function findChildrenByKey(data, key) {
2343 - var _iterator = _createForOfIteratorHelper(data);
2344 - var _step;
2345 - try {
2346 - for (_iterator.s(); !(_step = _iterator.n()).done;) {
2347 - var item = _step.value;
2348 - if (item.key === key) return item.children || [];
2349 - else if (item.children) {
2350 - var result = this.findChildrenByKey(item.children, key);
2351 - if (result.length > 0) return result;
2352 - }
2353 - }
2354 - } catch (err) {
2355 - _iterator.e(err);
2356 - } finally {
2357 - _iterator.f();
2358 - }
2359 - return [];
2360 - }
2361 - },
2362 - {
2363 - key: "mutateFieldData",
2364 - value: function mutateFieldData(data, field, value) {
2365 - if (_typeof$6(data) !== "object" || typeof field !== "string") return;
2366 - var fields = field.split(".");
2367 - var obj = data;
2368 - for (var i = 0, len = fields.length; i < len; ++i) {
2369 - if (i + 1 - len === 0) {
2370 - obj[fields[i]] = value;
2371 - break;
2372 - }
2373 - if (!obj[fields[i]]) obj[fields[i]] = {};
2374 - obj = obj[fields[i]];
2375 - }
2376 - }
2377 - },
2378 - {
2379 - key: "getNestedValue",
2380 - value: function getNestedValue(obj, path) {
2381 - return path.split(".").reduce(function(acc, part) {
2382 - return acc && acc[part] !== void 0 ? acc[part] : void 0;
2383 - }, obj);
2384 - }
2385 - },
2386 - {
2387 - key: "absoluteCompare",
2388 - value: function absoluteCompare(objA, objB) {
2389 - var maxDepth = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
2390 - var currentDepth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
2391 - if (!objA || !objB) return true;
2392 - if (currentDepth > maxDepth) return true;
2393 - if (_typeof$6(objA) !== _typeof$6(objB)) return false;
2394 - var aKeys = Object.keys(objA);
2395 - var bKeys = Object.keys(objB);
2396 - if (aKeys.length !== bKeys.length) return false;
2397 - for (var _i = 0, _aKeys = aKeys; _i < _aKeys.length; _i++) {
2398 - var key = _aKeys[_i];
2399 - var aValue = objA[key];
2400 - var bValue = objB[key];
2401 - var isObject = ObjectUtils.isObject(aValue) && ObjectUtils.isObject(bValue);
2402 - var isFunction = ObjectUtils.isFunction(aValue) && ObjectUtils.isFunction(bValue);
2403 - if ((isObject || isFunction) && !this.absoluteCompare(aValue, bValue, maxDepth, currentDepth + 1)) return false;
2404 - if (!isObject && aValue !== bValue) return false;
2405 - }
2406 - return true;
2407 - }
2408 - },
2409 - {
2410 - key: "selectiveCompare",
2411 - value: function selectiveCompare(a, b, keysToCompare) {
2412 - var maxDepth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1;
2413 - if (a === b) return true;
2414 - if (!a || !b || _typeof$6(a) !== "object" || _typeof$6(b) !== "object") return false;
2415 - if (!keysToCompare) return this.absoluteCompare(a, b, 1);
2416 - var _iterator2 = _createForOfIteratorHelper(keysToCompare);
2417 - var _step2;
2418 - try {
2419 - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
2420 - var key = _step2.value;
2421 - var aValue = this.getNestedValue(a, key);
2422 - var bValue = this.getNestedValue(b, key);
2423 - var isObject = _typeof$6(aValue) === "object" && aValue !== null && _typeof$6(bValue) === "object" && bValue !== null;
2424 - if (isObject && !this.absoluteCompare(aValue, bValue, maxDepth)) return false;
2425 - if (!isObject && aValue !== bValue) return false;
2426 - }
2427 - } catch (err) {
2428 - _iterator2.e(err);
2429 - } finally {
2430 - _iterator2.f();
2431 - }
2432 - return true;
2433 - }
2434 - }
2435 - ]);
2436 - }();
2437 - var lastId = 0;
2438 - function UniqueComponentId() {
2439 - var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "pr_id_";
2440 - lastId++;
2441 - return "".concat(prefix).concat(lastId);
2442 - }
2443 - function ownKeys$6(e, r) {
2444 - var t = Object.keys(e);
2445 - if (Object.getOwnPropertySymbols) {
2446 - var o = Object.getOwnPropertySymbols(e);
2447 - r && (o = o.filter(function(r) {
2448 - return Object.getOwnPropertyDescriptor(e, r).enumerable;
2449 - })), t.push.apply(t, o);
2450 - }
2451 - return t;
2452 - }
2453 - __name(ownKeys$6, "ownKeys");
2454 - function _objectSpread$6(e) {
2455 - for (var r = 1; r < arguments.length; r++) {
2456 - var t = null != arguments[r] ? arguments[r] : {};
2457 - r % 2 ? ownKeys$6(Object(t), !0).forEach(function(r) {
2458 - _defineProperty$6(e, r, t[r]);
2459 - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function(r) {
2460 - Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
2461 - });
2462 - }
2463 - return e;
2464 - }
2465 - __name(_objectSpread$6, "_objectSpread");
2466 - /**
2467 - * Merges properties together taking an Array of props and merging into one single set of
2468 - * properties. The options can contain a "classNameMergeFunction" which can be something
2469 - * like Tailwind Merge for properly merging Tailwind classes.
2470 - *
2471 - * @param {object[]} props the array of object properties to merge
2472 - * @param {*} options either empty or could contain a custom merge function like TailwindMerge
2473 - * @returns the single properties value after merging
2474 - */
2475 - function mergeProps(props) {
2476 - var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2477 - if (!props) return;
2478 - var isFunction = function isFunction(obj) {
2479 - return typeof obj === "function";
2480 - };
2481 - var classNameMergeFunction = options.classNameMergeFunction;
2482 - var hasMergeFunction = isFunction(classNameMergeFunction);
2483 - return props.reduce(function(merged, ps) {
2484 - if (!ps) return merged;
2485 - var _loop = function _loop() {
2486 - var value = ps[key];
2487 - if (key === "style") merged.style = _objectSpread$6(_objectSpread$6({}, merged.style), ps.style);
2488 - else if (key === "className") {
2489 - var newClassName = "";
2490 - if (hasMergeFunction) newClassName = classNameMergeFunction(merged.className, ps.className);
2491 - else newClassName = [merged.className, ps.className].join(" ").trim();
2492 - merged.className = newClassName || void 0;
2493 - } else if (isFunction(value)) {
2494 - var existingFn = merged[key];
2495 - merged[key] = existingFn ? function() {
2496 - existingFn.apply(void 0, arguments);
2497 - value.apply(void 0, arguments);
2498 - } : value;
2499 - } else merged[key] = value;
2500 - };
2501 - for (var key in ps) _loop();
2502 - return merged;
2503 - }, {});
2504 - }
2505 - function handler() {
2506 - var zIndexes = [];
2507 - var generateZIndex = function generateZIndex(key, autoZIndex) {
2508 - var baseZIndex = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 999;
2509 - var lastZIndex = getLastZIndex(key, autoZIndex, baseZIndex);
2510 - var newZIndex = lastZIndex.value + (lastZIndex.key === key ? 0 : baseZIndex) + 1;
2511 - zIndexes.push({
2512 - key,
2513 - value: newZIndex
2514 - });
2515 - return newZIndex;
2516 - };
2517 - var revertZIndex = function revertZIndex(zIndex) {
2518 - zIndexes = zIndexes.filter(function(obj) {
2519 - return obj.value !== zIndex;
2520 - });
2521 - };
2522 - var getCurrentZIndex = function getCurrentZIndex(key, autoZIndex) {
2523 - return getLastZIndex(key, autoZIndex).value;
2524 - };
2525 - var getLastZIndex = function getLastZIndex(key, autoZIndex) {
2526 - var baseZIndex = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
2527 - return _toConsumableArray$5(zIndexes).reverse().find(function(obj) {
2528 - return autoZIndex ? true : obj.key === key;
2529 - }) || {
2530 - key,
2531 - value: baseZIndex
2532 - };
2533 - };
2534 - return {
2535 - get: function getZIndex(el) {
2536 - return el ? parseInt(el.style.zIndex, 10) || 0 : 0;
2537 - },
2538 - set: function set(key, el, autoZIndex, baseZIndex) {
2539 - if (el) el.style.zIndex = String(generateZIndex(key, autoZIndex, baseZIndex));
2540 - },
2541 - clear: function clear(el) {
2542 - if (el) {
2543 - revertZIndex(ZIndexUtils.get(el));
2544 - el.style.zIndex = "";
2545 - }
2546 - },
2547 - getCurrent: function getCurrent(key, autoZIndex) {
2548 - return getCurrentZIndex(key, autoZIndex);
2549 - }
2550 - };
2551 - }
2552 - var ZIndexUtils = handler();
2553 -
2554 -//#endregion
2555 -//#region node_modules/primereact/api/api.esm.js
2556 - var FilterMatchMode = Object.freeze({
2557 - STARTS_WITH: "startsWith",
2558 - CONTAINS: "contains",
2559 - NOT_CONTAINS: "notContains",
2560 - ENDS_WITH: "endsWith",
2561 - EQUALS: "equals",
2562 - NOT_EQUALS: "notEquals",
2563 - IN: "in",
2564 - NOT_IN: "notIn",
2565 - LESS_THAN: "lt",
2566 - LESS_THAN_OR_EQUAL_TO: "lte",
2567 - GREATER_THAN: "gt",
2568 - GREATER_THAN_OR_EQUAL_TO: "gte",
2569 - BETWEEN: "between",
2570 - DATE_IS: "dateIs",
2571 - DATE_IS_NOT: "dateIsNot",
2572 - DATE_BEFORE: "dateBefore",
2573 - DATE_AFTER: "dateAfter",
2574 - CUSTOM: "custom"
2575 - });
2576 - var FilterOperator = Object.freeze({
2577 - AND: "and",
2578 - OR: "or"
2579 - });
2580 - function _typeof$5(o) {
2581 - "@babel/helpers - typeof";
2582 - return _typeof$5 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
2583 - return typeof o;
2584 - } : function(o) {
2585 - return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
2586 - }, _typeof$5(o);
2587 - }
2588 - __name(_typeof$5, "_typeof");
2589 - function toPrimitive$5(t, r) {
2590 - if ("object" != _typeof$5(t) || !t) return t;
2591 - var e = t[Symbol.toPrimitive];
2592 - if (void 0 !== e) {
2593 - var i = e.call(t, r || "default");
2594 - if ("object" != _typeof$5(i)) return i;
2595 - throw new TypeError("@@toPrimitive must return a primitive value.");
2596 - }
2597 - return ("string" === r ? String : Number)(t);
2598 - }
2599 - __name(toPrimitive$5, "toPrimitive");
2600 - function toPropertyKey$5(t) {
2601 - var i = toPrimitive$5(t, "string");
2602 - return "symbol" == _typeof$5(i) ? i : i + "";
2603 - }
2604 - __name(toPropertyKey$5, "toPropertyKey");
2605 - function _defineProperty$5(e, r, t) {
2606 - return (r = toPropertyKey$5(r)) in e ? Object.defineProperty(e, r, {
2607 - value: t,
2608 - enumerable: !0,
2609 - configurable: !0,
2610 - writable: !0
2611 - }) : e[r] = t, e;
2612 - }
2613 - __name(_defineProperty$5, "_defineProperty");
2614 - function _defineProperties(e, r) {
2615 - for (var t = 0; t < r.length; t++) {
2616 - var o = r[t];
2617 - o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey$5(o.key), o);
2618 - }
2619 - }
2620 - function _createClass(e, r, t) {
2621 - return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
2622 - }
2623 - function _classCallCheck(a, n) {
2624 - if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
2625 - }
2626 - /**
2627 - * @deprecated please use PrimeReactContext
2628 - */
2629 - var PrimeReact$1 = /*#__PURE__*/ _createClass(function PrimeReact() {
2630 - _classCallCheck(this, PrimeReact);
2631 - });
2632 - _defineProperty$5(PrimeReact$1, "ripple", false);
2633 - _defineProperty$5(PrimeReact$1, "inputStyle", "outlined");
2634 - _defineProperty$5(PrimeReact$1, "locale", "en");
2635 - _defineProperty$5(PrimeReact$1, "appendTo", null);
2636 - _defineProperty$5(PrimeReact$1, "cssTransition", true);
2637 - _defineProperty$5(PrimeReact$1, "autoZIndex", true);
2638 - _defineProperty$5(PrimeReact$1, "hideOverlaysOnDocumentScrolling", false);
2639 - _defineProperty$5(PrimeReact$1, "nonce", null);
2640 - _defineProperty$5(PrimeReact$1, "nullSortOrder", 1);
2641 - _defineProperty$5(PrimeReact$1, "zIndex", {
2642 - modal: 1100,
2643 - overlay: 1e3,
2644 - menu: 1e3,
2645 - tooltip: 1100,
2646 - toast: 1200
2647 - });
2648 - _defineProperty$5(PrimeReact$1, "pt", void 0);
2649 - _defineProperty$5(PrimeReact$1, "filterMatchModeOptions", {
2650 - text: [
2651 - FilterMatchMode.STARTS_WITH,
2652 - FilterMatchMode.CONTAINS,
2653 - FilterMatchMode.NOT_CONTAINS,
2654 - FilterMatchMode.ENDS_WITH,
2655 - FilterMatchMode.EQUALS,
2656 - FilterMatchMode.NOT_EQUALS
2657 - ],
2658 - numeric: [
2659 - FilterMatchMode.EQUALS,
2660 - FilterMatchMode.NOT_EQUALS,
2661 - FilterMatchMode.LESS_THAN,
2662 - FilterMatchMode.LESS_THAN_OR_EQUAL_TO,
2663 - FilterMatchMode.GREATER_THAN,
2664 - FilterMatchMode.GREATER_THAN_OR_EQUAL_TO
2665 - ],
2666 - date: [
2667 - FilterMatchMode.DATE_IS,
2668 - FilterMatchMode.DATE_IS_NOT,
2669 - FilterMatchMode.DATE_BEFORE,
2670 - FilterMatchMode.DATE_AFTER
2671 - ]
2672 - });
2673 - _defineProperty$5(PrimeReact$1, "changeTheme", function(currentTheme, newTheme, linkElementId, callback) {
2674 - var _linkElement$parentNo;
2675 - var linkElement = document.getElementById(linkElementId);
2676 - if (!linkElement) throw Error("Element with id ".concat(linkElementId, " not found."));
2677 - var newThemeUrl = linkElement.getAttribute("href").replace(currentTheme, newTheme);
2678 - var newLinkElement = document.createElement("link");
2679 - newLinkElement.setAttribute("rel", "stylesheet");
2680 - newLinkElement.setAttribute("id", linkElementId);
2681 - newLinkElement.setAttribute("href", newThemeUrl);
2682 - newLinkElement.addEventListener("load", function() {
2683 - if (callback) callback();
2684 - });
2685 - (_linkElement$parentNo = linkElement.parentNode) === null || _linkElement$parentNo === void 0 || _linkElement$parentNo.replaceChild(newLinkElement, linkElement);
2686 - });
2687 - var MessageSeverity = Object.freeze({
2688 - SUCCESS: "success",
2689 - INFO: "info",
2690 - WARN: "warn",
2691 - ERROR: "error",
2692 - SECONDARY: "secondary",
2693 - CONTRAST: "contrast"
2694 - });
2695 - var PrimeIcons = Object.freeze({
2696 - ADDRESS_BOOK: "pi pi-address-book",
2697 - ALIGN_CENTER: "pi pi-align-center",
2698 - ALIGN_JUSTIFY: "pi pi-align-justify",
2699 - ALIGN_LEFT: "pi pi-align-left",
2700 - ALIGN_RIGHT: "pi pi-align-right",
2701 - AMAZON: "pi pi-amazon",
2702 - ANDROID: "pi pi-android",
2703 - ANGLE_DOUBLE_DOWN: "pi pi-angle-double-down",
2704 - ANGLE_DOUBLE_LEFT: "pi pi-angle-double-left",
2705 - ANGLE_DOUBLE_RIGHT: "pi pi-angle-double-right",
2706 - ANGLE_DOUBLE_UP: "pi pi-angle-double-up",
2707 - ANGLE_DOWN: "pi pi-angle-down",
2708 - ANGLE_LEFT: "pi pi-angle-left",
2709 - ANGLE_RIGHT: "pi pi-angle-right",
2710 - ANGLE_UP: "pi pi-angle-up",
2711 - APPLE: "pi pi-apple",
2712 - ARROW_CIRCLE_DOWN: "pi pi-arrow-circle-down",
2713 - ARROW_CIRCLE_LEFT: "pi pi-arrow-circle-left",
2714 - ARROW_CIRCLE_RIGHT: "pi pi-arrow-circle-right",
2715 - ARROW_CIRCLE_UP: "pi pi-arrow-circle-up",
2716 - ARROW_DOWN_LEFT_AND_ARROW_UP_RIGHT_TO_CENTER: "pi pi-arrow-down-left-and-arrow-up-right-to-center",
2717 - ARROW_DOWN_LEFT: "pi pi-arrow-down-left",
2718 - ARROW_DOWN_RIGHT: "pi pi-arrow-down-right",
2719 - ARROW_DOWN: "pi pi-arrow-down",
2720 - ARROW_LEFT: "pi pi-arrow-left",
2721 - ARROW_RIGHT_ARROW_LEFT: "pi pi-arrow-right-arrow-left",
2722 - ARROW_RIGHT: "pi pi-arrow-right",
2723 - ARROW_UP_LEFT: "pi pi-arrow-up-left",
2724 - ARROW_UP_RIGHT_AND_ARROW_DOWN_LEFT_FROM_CENTER: "pi pi-arrow-up-right-and-arrow-down-left-from-center",
2725 - ARROW_UP_RIGHT: "pi pi-arrow-up-right",
2726 - ARROW_UP: "pi pi-arrow-up",
2727 - ARROWS_ALT: "pi pi-arrows-alt",
2728 - ARROWS_H: "pi pi-arrows-h",
2729 - ARROWS_V: "pi pi-arrows-v",
2730 - ASTERISK: "pi pi-asterisk",
2731 - AT: "pi pi-at",
2732 - BACKWARD: "pi pi-backward",
2733 - BAN: "pi pi-ban",
2734 - BARCODE: "pi pi-barcode",
2735 - BARS: "pi pi-bars",
2736 - BELL_SLASH: "pi pi-bell-slash",
2737 - BELL: "pi pi-bell",
2738 - BITCOIN: "pi pi-bitcoin",
2739 - BOLT: "pi pi-bolt",
2740 - BOOK: "pi pi-book",
2741 - BOOKMARK_FILL: "pi pi-bookmark-fill",
2742 - BOOKMARK: "pi pi-bookmark",
2743 - BOX: "pi pi-box",
2744 - BRIEFCASE: "pi pi-briefcase",
2745 - BUILDING_COLUMNS: "pi pi-building-columns",
2746 - BUILDING: "pi pi-building",
2747 - BULLSEYE: "pi pi-bullseye",
2748 - CALCULATOR: "pi pi-calculator",
2749 - CALENDAR_CLOCK: "pi pi-calendar-clock",
2750 - CALENDAR_MINUS: "pi pi-calendar-minus",
2751 - CALENDAR_PLUS: "pi pi-calendar-plus",
2752 - CALENDAR_TIMES: "pi pi-calendar-times",
2753 - CALENDAR: "pi pi-calendar",
2754 - CAMERA: "pi pi-camera",
2755 - CAR: "pi pi-car",
2756 - CARET_DOWN: "pi pi-caret-down",
2757 - CARET_LEFT: "pi pi-caret-left",
2758 - CARET_RIGHT: "pi pi-caret-right",
2759 - CARET_UP: "pi pi-caret-up",
2760 - CART_ARROW_DOWN: "pi pi-cart-arrow-down",
2761 - CART_MINUS: "pi pi-cart-minus",
2762 - CART_PLUS: "pi pi-cart-plus",
2763 - CHART_BAR: "pi pi-chart-bar",
2764 - CHART_LINE: "pi pi-chart-line",
2765 - CHART_PIE: "pi pi-chart-pie",
2766 - CHART_SCATTER: "pi pi-chart-scatter",
2767 - CHECK_CIRCLE: "pi pi-check-circle",
2768 - CHECK_SQUARE: "pi pi-check-square",
2769 - CHECK: "pi pi-check",
2770 - CHEVRON_CIRCLE_DOWN: "pi pi-chevron-circle-down",
2771 - CHEVRON_CIRCLE_LEFT: "pi pi-chevron-circle-left",
2772 - CHEVRON_CIRCLE_RIGHT: "pi pi-chevron-circle-right",
2773 - CHEVRON_CIRCLE_UP: "pi pi-chevron-circle-up",
2774 - CHEVRON_DOWN: "pi pi-chevron-down",
2775 - CHEVRON_LEFT: "pi pi-chevron-left",
2776 - CHEVRON_RIGHT: "pi pi-chevron-right",
2777 - CHEVRON_UP: "pi pi-chevron-up",
2778 - CIRCLE_FILL: "pi pi-circle-fill",
2779 - CIRCLE_OFF: "pi pi-circle-off",
2780 - CIRCLE_ON: "pi pi-circle-on",
2781 - CIRCLE: "pi pi-circle",
2782 - CLIPBOARD: "pi pi-clipboard",
2783 - CLOCK: "pi pi-clock",
2784 - CLONE: "pi pi-clone",
2785 - CLOUD_DOWNLOAD: "pi pi-cloud-download",
2786 - CLOUD_UPLOAD: "pi pi-cloud-upload",
2787 - CLOUD: "pi pi-cloud",
2788 - CODE: "pi pi-code",
2789 - COG: "pi pi-cog",
2790 - COMMENT: "pi pi-comment",
2791 - COMMENTS: "pi pi-comments",
2792 - COMPASS: "pi pi-compass",
2793 - COPY: "pi pi-copy",
2794 - CREDIT_CARD: "pi pi-credit-card",
2795 - CROWN: "pi pi-crown",
2796 - DATABASE: "pi pi-database",
2797 - DELETE_LEFT: "pi pi-delete-left",
2798 - DESKTOP: "pi pi-desktop",
2799 - DIRECTIONS_ALT: "pi pi-directions-alt",
2800 - DIRECTIONS: "pi pi-directions",
2801 - DISCORD: "pi pi-discord",
2802 - DOLLAR: "pi pi-dollar",
2803 - DOWNLOAD: "pi pi-download",
2804 - EJECT: "pi pi-eject",
2805 - ELLIPSIS_H: "pi pi-ellipsis-h",
2806 - ELLIPSIS_V: "pi pi-ellipsis-v",
2807 - ENVELOPE: "pi pi-envelope",
2808 - EQUALS: "pi pi-equals",
2809 - ERASER: "pi pi-eraser",
2810 - ETHEREUM: "pi pi-ethereum",
2811 - EURO: "pi pi-euro",
2812 - EXCLAMATION_CIRCLE: "pi pi-exclamation-circle",
2813 - EXCLAMATION_TRIANGLE: "pi pi-exclamation-triangle",
2814 - EXPAND: "pi pi-expand",
2815 - EXTERNAL_LINK: "pi pi-external-link",
2816 - EYE_SLASH: "pi pi-eye-slash",
2817 - EYE: "pi pi-eye",
2818 - FACE_SMILE: "pi pi-face-smile",
2819 - FACEBOOK: "pi pi-facebook",
2820 - FAST_BACKWARD: "pi pi-fast-backward",
2821 - FAST_FORWARD: "pi pi-fast-forward",
2822 - FILE_ARROW_UP: "pi pi-file-arrow-up",
2823 - FILE_CHECK: "pi pi-file-check",
2824 - FILE_EDIT: "pi pi-file-edit",
2825 - FILE_EXCEL: "pi pi-file-excel",
2826 - FILE_EXPORT: "pi pi-file-export",
2827 - FILE_IMPORT: "pi pi-file-import",
2828 - FILE_O: "pi pi-file-o",
2829 - FILE_PDF: "pi pi-file-pdf",
2830 - FILE_PLUS: "pi pi-file-plus",
2831 - FILE_WORD: "pi pi-file-word",
2832 - FILE: "pi pi-file",
2833 - FILTER_FILL: "pi pi-filter-fill",
2834 - FILTER_SLASH: "pi pi-filter-slash",
2835 - FILTER: "pi pi-filter",
2836 - FLAG_FILL: "pi pi-flag-fill",
2837 - FLAG: "pi pi-flag",
2838 - FOLDER_OPEN: "pi pi-folder-open",
2839 - FOLDER_PLUS: "pi pi-folder-plus",
2840 - FOLDER: "pi pi-folder",
2841 - FORWARD: "pi pi-forward",
2842 - GAUGE: "pi pi-gauge",
2843 - GIFT: "pi pi-gift",
2844 - GITHUB: "pi pi-github",
2845 - GLOBE: "pi pi-globe",
2846 - GOOGLE: "pi pi-google",
2847 - GRADUATION_CAP: "pi pi-graduation-cap",
2848 - HAMMER: "pi pi-hammer",
2849 - HASHTAG: "pi pi-hashtag",
2850 - HEADPHONES: "pi pi-headphones",
2851 - HEART_FILL: "pi pi-heart-fill",
2852 - HEART: "pi pi-heart",
2853 - HISTORY: "pi pi-history",
2854 - HOME: "pi pi-home",
2855 - HOURGLASS: "pi pi-hourglass",
2856 - ID_CARD: "pi pi-id-card",
2857 - IMAGE: "pi pi-image",
2858 - IMAGES: "pi pi-images",
2859 - INBOX: "pi pi-inbox",
2860 - INDIAN_RUPEE: "pi pi-indian-rupee",
2861 - INFO_CIRCLE: "pi pi-info-circle",
2862 - INFO: "pi pi-info",
2863 - INSTAGRAM: "pi pi-instagram",
2864 - KEY: "pi pi-key",
2865 - LANGUAGE: "pi pi-language",
2866 - LIGHTBULB: "pi pi-lightbulb",
2867 - LINK: "pi pi-link",
2868 - LINKEDIN: "pi pi-linkedin",
2869 - LIST_CHECK: "pi pi-list-check",
2870 - LIST: "pi pi-list",
2871 - LOCK_OPEN: "pi pi-lock-open",
2872 - LOCK: "pi pi-lock",
2873 - MAP_MARKER: "pi pi-map-marker",
2874 - MAP: "pi pi-map",
2875 - MARS: "pi pi-mars",
2876 - MEGAPHONE: "pi pi-megaphone",
2877 - MICROCHIP_AI: "pi pi-microchip-ai",
2878 - MICROCHIP: "pi pi-microchip",
2879 - MICROPHONE: "pi pi-microphone",
2880 - MICROSOFT: "pi pi-microsoft",
2881 - MINUS_CIRCLE: "pi pi-minus-circle",
2882 - MINUS: "pi pi-minus",
2883 - MOBILE: "pi pi-mobile",
2884 - MONEY_BILL: "pi pi-money-bill",
2885 - MOON: "pi pi-moon",
2886 - OBJECTS_COLUMN: "pi pi-objects-column",
2887 - PALETTE: "pi pi-palette",
2888 - PAPERCLIP: "pi pi-paperclip",
2889 - PAUSE_CIRCLE: "pi pi-pause-circle",
2890 - PAUSE: "pi pi-pause",
2891 - PAYPAL: "pi pi-paypal",
2892 - PEN_TO_SQUARE: "pi pi-pen-to-square",
2893 - PENCIL: "pi pi-pencil",
2894 - PERCENTAGE: "pi pi-percentage",
2895 - PHONE: "pi pi-phone",
2896 - PINTEREST: "pi pi-pinterest",
2897 - PLAY_CIRCLE: "pi pi-play-circle",
2898 - PLAY: "pi pi-play",
2899 - PLUS_CIRCLE: "pi pi-plus-circle",
2900 - PLUS: "pi pi-plus",
2901 - POUND: "pi pi-pound",
2902 - POWER_OFF: "pi pi-power-off",
2903 - PRIME: "pi pi-prime",
2904 - PRINT: "pi pi-print",
2905 - QRCODE: "pi pi-qrcode",
2906 - QUESTION_CIRCLE: "pi pi-question-circle",
2907 - QUESTION: "pi pi-question",
2908 - RECEIPT: "pi pi-receipt",
2909 - REDDIT: "pi pi-reddit",
2910 - REFRESH: "pi pi-refresh",
2911 - REPLAY: "pi pi-replay",
2912 - REPLY: "pi pi-reply",
2913 - SAVE: "pi pi-save",
2914 - SEARCH_MINUS: "pi pi-search-minus",
2915 - SEARCH_PLUS: "pi pi-search-plus",
2916 - SEARCH: "pi pi-search",
2917 - SEND: "pi pi-send",
2918 - SERVER: "pi pi-server",
2919 - SHARE_ALT: "pi pi-share-alt",
2920 - SHIELD: "pi pi-shield",
2921 - SHOP: "pi pi-shop",
2922 - SHOPPING_BAG: "pi pi-shopping-bag",
2923 - SHOPPING_CART: "pi pi-shopping-cart",
2924 - SIGN_IN: "pi pi-sign-in",
2925 - SIGN_OUT: "pi pi-sign-out",
2926 - SITEMAP: "pi pi-sitemap",
2927 - SLACK: "pi pi-slack",
2928 - SLIDERS_H: "pi pi-sliders-h",
2929 - SLIDERS_V: "pi pi-sliders-v",
2930 - SORT_ALPHA_DOWN_ALT: "pi pi-sort-alpha-down-alt",
2931 - SORT_ALPHA_DOWN: "pi pi-sort-alpha-down",
2932 - SORT_ALPHA_UP_ALT: "pi pi-sort-alpha-up-alt",
2933 - SORT_ALPHA_UP: "pi pi-sort-alpha-up",
2934 - SORT_ALT_SLASH: "pi pi-sort-alt-slash",
2935 - SORT_ALT: "pi pi-sort-alt",
2936 - SORT_AMOUNT_DOWN_ALT: "pi pi-sort-amount-down-alt",
2937 - SORT_AMOUNT_DOWN: "pi pi-sort-amount-down",
2938 - SORT_AMOUNT_UP_ALT: "pi pi-sort-amount-up-alt",
2939 - SORT_AMOUNT_UP: "pi pi-sort-amount-up",
2940 - SORT_DOWN_FILL: "pi pi-sort-down-fill",
2941 - SORT_DOWN: "pi pi-sort-down",
2942 - SORT_NUMERIC_DOWN_ALT: "pi pi-sort-numeric-down-alt",
2943 - SORT_NUMERIC_DOWN: "pi pi-sort-numeric-down",
2944 - SORT_NUMERIC_UP_ALT: "pi pi-sort-numeric-up-alt",
2945 - SORT_NUMERIC_UP: "pi pi-sort-numeric-up",
2946 - SORT_UP_FILL: "pi pi-sort-up-fill",
2947 - SORT_UP: "pi pi-sort-up",
2948 - SORT: "pi pi-sort",
2949 - SPARKLES: "pi pi-sparkles",
2950 - SPINNER_DOTTED: "pi pi-spinner-dotted",
2951 - SPINNER: "pi pi-spinner",
2952 - STAR_FILL: "pi pi-star-fill",
2953 - STAR_HALF_FILL: "pi pi-star-half-fill",
2954 - STAR_HALF: "pi pi-star-half",
2955 - STAR: "pi pi-star",
2956 - STEP_BACKWARD_ALT: "pi pi-step-backward-alt",
2957 - STEP_BACKWARD: "pi pi-step-backward",
2958 - STEP_FORWARD_ALT: "pi pi-step-forward-alt",
2959 - STEP_FORWARD: "pi pi-step-forward",
2960 - STOP_CIRCLE: "pi pi-stop-circle",
2961 - STOP: "pi pi-stop",
2962 - STOPWATCH: "pi pi-stopwatch",
2963 - SUN: "pi pi-sun",
2964 - SYNC: "pi pi-sync",
2965 - TABLE: "pi pi-table",
2966 - TABLET: "pi pi-tablet",
2967 - TAG: "pi pi-tag",
2968 - TAGS: "pi pi-tags",
2969 - TELEGRAM: "pi pi-telegram",
2970 - TH_LARGE: "pi pi-th-large",
2971 - THUMBS_DOWN_FILL: "pi pi-thumbs-down-fill",
2972 - THUMBS_DOWN: "pi pi-thumbs-down",
2973 - THUMBS_UP_FILL: "pi pi-thumbs-up-fill",
2974 - THUMBS_UP: "pi pi-thumbs-up",
2975 - THUMBTACK: "pi pi-thumbtack",
2976 - TICKET: "pi pi-ticket",
2977 - TIKTOK: "pi pi-tiktok",
2978 - TIMES_CIRCLE: "pi pi-times-circle",
2979 - TIMES: "pi pi-times",
2980 - TRASH: "pi pi-trash",
2981 - TROPHY: "pi pi-trophy",
2982 - TRUCK: "pi pi-truck",
2983 - TURKISH_LIRA: "pi pi-turkish-lira",
2984 - TWITCH: "pi pi-twitch",
2985 - TWITTER: "pi pi-twitter",
2986 - UNDO: "pi pi-undo",
2987 - UNLOCK: "pi pi-unlock",
2988 - UPLOAD: "pi pi-upload",
2989 - USER_EDIT: "pi pi-user-edit",
2990 - USER_MINUS: "pi pi-user-minus",
2991 - USER_PLUS: "pi pi-user-plus",
2992 - USER: "pi pi-user",
2993 - USERS: "pi pi-users",
2994 - VENUS: "pi pi-venus",
2995 - VERIFIED: "pi pi-verified",
2996 - VIDEO: "pi pi-video",
2997 - VIMEO: "pi pi-vimeo",
2998 - VOLUME_DOWN: "pi pi-volume-down",
2999 - VOLUME_OFF: "pi pi-volume-off",
3000 - VOLUME_UP: "pi pi-volume-up",
3001 - WALLET: "pi pi-wallet",
3002 - WAREHOUSE: "pi pi-warehouse",
3003 - WAVE_PULSE: "pi pi-wave-pulse",
3004 - WHATSAPP: "pi pi-whatsapp",
3005 - WIFI: "pi pi-wifi",
3006 - WINDOW_MAXIMIZE: "pi pi-window-maximize",
3007 - WINDOW_MINIMIZE: "pi pi-window-minimize",
3008 - WRENCH: "pi pi-wrench",
3009 - YOUTUBE: "pi pi-youtube"
3010 - });
3011 - var SortOrder = Object.freeze({
3012 - DESC: -1,
3013 - UNSORTED: 0,
3014 - ASC: 1
3015 - });
3016 - var PrimeReactContext = /*#__PURE__*/ react.default.createContext();
3017 - var PrimeReact = PrimeReact$1;
3018 -
3019 -//#endregion
3020 -//#region node_modules/primereact/hooks/hooks.esm.js
3021 - function _arrayWithHoles$4(r) {
3022 - if (Array.isArray(r)) return r;
3023 - }
3024 - __name(_arrayWithHoles$4, "_arrayWithHoles");
3025 - function _iterableToArrayLimit$4(r, l) {
3026 - var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
3027 - if (null != t) {
3028 - var e;
3029 - var n;
3030 - var i;
3031 - var u;
3032 - var a = [];
3033 - var f = !0;
3034 - var o = !1;
3035 - try {
3036 - if (i = (t = t.call(r)).next, 0 === l) {
3037 - if (Object(t) !== t) return;
3038 - f = !1;
3039 - } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
3040 - } catch (r) {
3041 - o = !0, n = r;
3042 - } finally {
3043 - try {
3044 - if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
3045 - } finally {
3046 - if (o) throw n;
3047 - }
3048 - }
3049 - return a;
3050 - }
3051 - }
3052 - __name(_iterableToArrayLimit$4, "_iterableToArrayLimit");
3053 - function _arrayLikeToArray$6(r, a) {
3054 - (null == a || a > r.length) && (a = r.length);
3055 - for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
3056 - return n;
3057 - }
3058 - __name(_arrayLikeToArray$6, "_arrayLikeToArray");
3059 - function _unsupportedIterableToArray$6(r, a) {
3060 - if (r) {
3061 - if ("string" == typeof r) return _arrayLikeToArray$6(r, a);
3062 - var t = {}.toString.call(r).slice(8, -1);
3063 - return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$6(r, a) : void 0;
3064 - }
3065 - }
3066 - __name(_unsupportedIterableToArray$6, "_unsupportedIterableToArray");
3067 - function _nonIterableRest$4() {
3068 - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3069 - }
3070 - __name(_nonIterableRest$4, "_nonIterableRest");
3071 - function _slicedToArray$4(r, e) {
3072 - return _arrayWithHoles$4(r) || _iterableToArrayLimit$4(r, e) || _unsupportedIterableToArray$6(r, e) || _nonIterableRest$4();
3073 - }
3074 - __name(_slicedToArray$4, "_slicedToArray");
3075 - var usePrevious = function usePrevious(newValue) {
3076 - var ref = react.useRef(null);
3077 - react.useEffect(function() {
3078 - ref.current = newValue;
3079 - return function() {
3080 - ref.current = null;
3081 - };
3082 - }, [newValue]);
3083 - return ref.current;
3084 - };
3085 - var useUnmountEffect = function useUnmountEffect(fn) {
3086 - return react.useEffect(function() {
3087 - return fn;
3088 - }, []);
3089 - };
3090 - var useEventListener = function useEventListener(_ref) {
3091 - var _ref$target = _ref.target;
3092 - var target = _ref$target === void 0 ? "document" : _ref$target;
3093 - var type = _ref.type;
3094 - var listener = _ref.listener;
3095 - var options = _ref.options;
3096 - var _ref$when = _ref.when;
3097 - var when = _ref$when === void 0 ? true : _ref$when;
3098 - var targetRef = react.useRef(null);
3099 - var listenerRef = react.useRef(null);
3100 - var prevListener = usePrevious(listener);
3101 - var prevOptions = usePrevious(options);
3102 - var bind = function bind() {
3103 - var bindOptions = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
3104 - var bindTarget = bindOptions.target;
3105 - if (ObjectUtils.isNotEmpty(bindTarget)) {
3106 - unbind();
3107 - (bindOptions.when || when) && (targetRef.current = DomHandler.getTargetElement(bindTarget));
3108 - }
3109 - if (!listenerRef.current && targetRef.current) {
3110 - listenerRef.current = function(event) {
3111 - return listener && listener(event);
3112 - };
3113 - targetRef.current.addEventListener(type, listenerRef.current, options);
3114 - }
3115 - };
3116 - var unbind = function unbind() {
3117 - if (listenerRef.current) {
3118 - targetRef.current.removeEventListener(type, listenerRef.current, options);
3119 - listenerRef.current = null;
3120 - }
3121 - };
3122 - var dispose = function dispose() {
3123 - unbind();
3124 - prevListener = null;
3125 - prevOptions = null;
3126 - };
3127 - var updateTarget = react.useCallback(function() {
3128 - if (when) targetRef.current = DomHandler.getTargetElement(target);
3129 - else {
3130 - unbind();
3131 - targetRef.current = null;
3132 - }
3133 - }, [target, when]);
3134 - react.useEffect(function() {
3135 - updateTarget();
3136 - }, [updateTarget]);
3137 - react.useEffect(function() {
3138 - var listenerChanged = "".concat(prevListener) !== "".concat(listener);
3139 - var optionsChanged = prevOptions !== options;
3140 - var listenerExists = listenerRef.current;
3141 - if (listenerExists && (listenerChanged || optionsChanged)) {
3142 - unbind();
3143 - when && bind();
3144 - } else if (!listenerExists) dispose();
3145 - }, [
3146 - listener,
3147 - options,
3148 - when
3149 - ]);
3150 - useUnmountEffect(function() {
3151 - dispose();
3152 - });
3153 - return [bind, unbind];
3154 - };
3155 - var groupToDisplayedElements = {};
3156 - var useDisplayOrder = function useDisplayOrder(group) {
3157 - var isVisible = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
3158 - var uid = _slicedToArray$4(react.useState(function() {
3159 - return UniqueComponentId();
3160 - }), 1)[0];
3161 - var _React$useState4 = _slicedToArray$4(react.useState(0), 2);
3162 - var displayOrder = _React$useState4[0];
3163 - var setDisplayOrder = _React$useState4[1];
3164 - react.useEffect(function() {
3165 - if (isVisible) {
3166 - if (!groupToDisplayedElements[group]) groupToDisplayedElements[group] = [];
3167 - var newDisplayOrder = groupToDisplayedElements[group].push(uid);
3168 - setDisplayOrder(newDisplayOrder);
3169 - return function() {
3170 - delete groupToDisplayedElements[group][newDisplayOrder - 1];
3171 - var lastIndex = groupToDisplayedElements[group].length - 1;
3172 - var lastOrder = ObjectUtils.findLastIndex(groupToDisplayedElements[group], function(el) {
3173 - return el !== void 0;
3174 - });
3175 - if (lastOrder !== lastIndex) groupToDisplayedElements[group].splice(lastOrder + 1);
3176 - setDisplayOrder(void 0);
3177 - };
3178 - }
3179 - }, [
3180 - group,
3181 - uid,
3182 - isVisible
3183 - ]);
3184 - return displayOrder;
3185 - };
3186 - function _arrayWithoutHoles$4(r) {
3187 - if (Array.isArray(r)) return _arrayLikeToArray$6(r);
3188 - }
3189 - __name(_arrayWithoutHoles$4, "_arrayWithoutHoles");
3190 - function _iterableToArray$4(r) {
3191 - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
3192 - }
3193 - __name(_iterableToArray$4, "_iterableToArray");
3194 - function _nonIterableSpread$4() {
3195 - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3196 - }
3197 - __name(_nonIterableSpread$4, "_nonIterableSpread");
3198 - function _toConsumableArray$4(r) {
3199 - return _arrayWithoutHoles$4(r) || _iterableToArray$4(r) || _unsupportedIterableToArray$6(r) || _nonIterableSpread$4();
3200 - }
3201 - __name(_toConsumableArray$4, "_toConsumableArray");
3202 - /**
3203 - * Priorities of different components (bigger number handled first)
3204 - */
3205 - var ESC_KEY_HANDLING_PRIORITIES = {
3206 - SIDEBAR: 100,
3207 - SLIDE_MENU: 200,
3208 - DIALOG: 300,
3209 - IMAGE: 400,
3210 - MENU: 500,
3211 - OVERLAY_PANEL: 600,
3212 - PASSWORD: 700,
3213 - CASCADE_SELECT: 800,
3214 - SPLIT_BUTTON: 900,
3215 - SPEED_DIAL: 1e3,
3216 - TOOLTIP: 1200
3217 - };
3218 - /**
3219 - * Object, that manages global escape key handling logic
3220 - */
3221 - var globalEscKeyHandlingLogic = {
3222 - /**
3223 - * Mapping from ESC_KEY_HANDLING_PRIORITY to array of related listeners, grouped by priority
3224 - * @example
3225 - * Map<{
3226 - * [ESC_KEY_HANDLING_PRIORITIES.SIDEBAR]: Map<{
3227 - * 1: () => {...},
3228 - * 2: () => {...}
3229 - * }>,
3230 - * [ESC_KEY_HANDLING_PRIORITIES.DIALOG]: Map<{
3231 - * 1: () => {...},
3232 - * 2: () => {...}
3233 - * }>
3234 - * }>;
3235 - */
3236 - escKeyListeners: /* @__PURE__ */ new Map(),
3237 - /**
3238 - * Keydown handler (attached to any keydown)
3239 - */
3240 - onGlobalKeyDown: function onGlobalKeyDown(event) {
3241 - if (event.code !== "Escape") return;
3242 - var escKeyListeners = globalEscKeyHandlingLogic.escKeyListeners;
3243 - var maxPrimaryPriority = Math.max.apply(Math, _toConsumableArray$4(escKeyListeners.keys()));
3244 - var theMostImportantEscHandlersSet = escKeyListeners.get(maxPrimaryPriority);
3245 - var maxSecondaryPriority = Math.max.apply(Math, _toConsumableArray$4(theMostImportantEscHandlersSet.keys()));
3246 - theMostImportantEscHandlersSet.get(maxSecondaryPriority)(event);
3247 - },
3248 - /**
3249 - * Attach global keydown listener if there are any "esc" key handlers assigned,
3250 - * otherwise detach.
3251 - */
3252 - refreshGlobalKeyDownListener: function refreshGlobalKeyDownListener() {
3253 - var document = DomHandler.getTargetElement("document");
3254 - if (this.escKeyListeners.size > 0) document.addEventListener("keydown", this.onGlobalKeyDown);
3255 - else document.removeEventListener("keydown", this.onGlobalKeyDown);
3256 - },
3257 - /**
3258 - * Add "Esc" key handler
3259 - */
3260 - addListener: function addListener(callback, _ref) {
3261 - var _this = this;
3262 - var _ref2 = _slicedToArray$4(_ref, 2);
3263 - var primaryPriority = _ref2[0];
3264 - var secondaryPriority = _ref2[1];
3265 - var escKeyListeners = this.escKeyListeners;
3266 - if (!escKeyListeners.has(primaryPriority)) escKeyListeners.set(primaryPriority, /* @__PURE__ */ new Map());
3267 - var primaryPriorityListeners = escKeyListeners.get(primaryPriority);
3268 - if (primaryPriorityListeners.has(secondaryPriority)) throw new Error("Unexpected: global esc key listener with priority [".concat(primaryPriority, ", ").concat(secondaryPriority, "] already exists."));
3269 - primaryPriorityListeners.set(secondaryPriority, callback);
3270 - this.refreshGlobalKeyDownListener();
3271 - return function() {
3272 - primaryPriorityListeners["delete"](secondaryPriority);
3273 - if (primaryPriorityListeners.size === 0) escKeyListeners["delete"](primaryPriority);
3274 - _this.refreshGlobalKeyDownListener();
3275 - };
3276 - }
3277 - };
3278 - var useGlobalOnEscapeKey = function useGlobalOnEscapeKey(_ref3) {
3279 - var callback = _ref3.callback;
3280 - var when = _ref3.when;
3281 - var priority = _ref3.priority;
3282 - (0, react.useEffect)(function() {
3283 - if (!when) return;
3284 - return globalEscKeyHandlingLogic.addListener(callback, priority);
3285 - }, [
3286 - callback,
3287 - when,
3288 - priority
3289 - ]);
3290 - };
3291 - /**
3292 - * Hook to merge properties including custom merge function for things like Tailwind merge.
3293 - */
3294 - var useMergeProps = function useMergeProps() {
3295 - var context = (0, react.useContext)(PrimeReactContext);
3296 - return function() {
3297 - for (var _len = arguments.length, props = new Array(_len), _key = 0; _key < _len; _key++) props[_key] = arguments[_key];
3298 - return mergeProps(props, context === null || context === void 0 ? void 0 : context.ptOptions);
3299 - };
3300 - };
3301 - /**
3302 - * Custom hook to run a mount effect only once.
3303 - * @param {*} fn the callback function
3304 - * @returns the hook
3305 - */
3306 - var useMountEffect = function useMountEffect(fn) {
3307 - var mounted = react.useRef(false);
3308 - return react.useEffect(function() {
3309 - if (!mounted.current) {
3310 - mounted.current = true;
3311 - return fn && fn();
3312 - }
3313 - }, []);
3314 - };
3315 - var useOverlayScrollListener = function useOverlayScrollListener(_ref) {
3316 - var target = _ref.target;
3317 - var listener = _ref.listener;
3318 - var options = _ref.options;
3319 - var _ref$when = _ref.when;
3320 - var when = _ref$when === void 0 ? true : _ref$when;
3321 - var context = react.useContext(PrimeReactContext);
3322 - var targetRef = react.useRef(null);
3323 - var listenerRef = react.useRef(null);
3324 - var scrollableParentsRef = react.useRef([]);
3325 - var prevListener = usePrevious(listener);
3326 - var prevOptions = usePrevious(options);
3327 - var bind = function bind() {
3328 - var bindOptions = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
3329 - if (ObjectUtils.isNotEmpty(bindOptions.target)) {
3330 - unbind();
3331 - (bindOptions.when || when) && (targetRef.current = DomHandler.getTargetElement(bindOptions.target));
3332 - }
3333 - if (!listenerRef.current && targetRef.current) {
3334 - var hideOnScroll = context ? context.hideOverlaysOnDocumentScrolling : PrimeReact.hideOverlaysOnDocumentScrolling;
3335 - var nodes = scrollableParentsRef.current = DomHandler.getScrollableParents(targetRef.current);
3336 - if (!nodes.some(function(node) {
3337 - return node === document.body || node === window;
3338 - })) nodes.push(hideOnScroll ? window : document.body);
3339 - listenerRef.current = function(event) {
3340 - return listener && listener(event);
3341 - };
3342 - nodes.forEach(function(node) {
3343 - return node.addEventListener("scroll", listenerRef.current, options);
3344 - });
3345 - }
3346 - };
3347 - var unbind = function unbind() {
3348 - if (listenerRef.current) {
3349 - scrollableParentsRef.current.forEach(function(node) {
3350 - return node.removeEventListener("scroll", listenerRef.current, options);
3351 - });
3352 - listenerRef.current = null;
3353 - }
3354 - };
3355 - var dispose = function dispose() {
3356 - unbind();
3357 - scrollableParentsRef.current = null;
3358 - prevListener = null;
3359 - prevOptions = null;
3360 - };
3361 - var updateTarget = react.useCallback(function() {
3362 - if (when) targetRef.current = DomHandler.getTargetElement(target);
3363 - else {
3364 - unbind();
3365 - targetRef.current = null;
3366 - }
3367 - }, [target, when]);
3368 - react.useEffect(function() {
3369 - updateTarget();
3370 - }, [updateTarget]);
3371 - react.useEffect(function() {
3372 - var listenerChanged = "".concat(prevListener) !== "".concat(listener);
3373 - var optionsChanged = prevOptions !== options;
3374 - var listenerExists = listenerRef.current;
3375 - if (listenerExists && (listenerChanged || optionsChanged)) {
3376 - unbind();
3377 - when && bind();
3378 - } else if (!listenerExists) dispose();
3379 - }, [
3380 - listener,
3381 - options,
3382 - when
3383 - ]);
3384 - useUnmountEffect(function() {
3385 - dispose();
3386 - });
3387 - return [bind, unbind];
3388 - };
3389 - var useResizeListener = function useResizeListener(_ref) {
3390 - var listener = _ref.listener;
3391 - var _ref$when = _ref.when;
3392 - return useEventListener({
3393 - target: "window",
3394 - type: "resize",
3395 - listener,
3396 - when: _ref$when === void 0 ? true : _ref$when
3397 - });
3398 - };
3399 - var useOverlayListener = function useOverlayListener(_ref) {
3400 - var target = _ref.target;
3401 - var overlay = _ref.overlay;
3402 - var _listener = _ref.listener;
3403 - var _ref$when = _ref.when;
3404 - var when = _ref$when === void 0 ? true : _ref$when;
3405 - var _ref$type = _ref.type;
3406 - var type = _ref$type === void 0 ? "click" : _ref$type;
3407 - var targetRef = react.useRef(null);
3408 - var overlayRef = react.useRef(null);
3409 - /**
3410 - * The parameters of the 'listener' method in the following event handlers;
3411 - * @param {Event} event A click event of the document.
3412 - * @param {string} options.type The custom type to detect event.
3413 - * @param {boolean} options.valid It is controlled by PrimeReact. It is determined whether it is valid or not according to some custom validation.
3414 - */
3415 - var _useEventListener2 = _slicedToArray$4(useEventListener({
3416 - target: "window",
3417 - type,
3418 - listener: function listener(event) {
3419 - _listener && _listener(event, {
3420 - type: "outside",
3421 - valid: event.which !== 3 && isOutsideClicked(event)
3422 - });
3423 - },
3424 - when
3425 - }), 2);
3426 - var bindDocumentClickListener = _useEventListener2[0];
3427 - var unbindDocumentClickListener = _useEventListener2[1];
3428 - var _useResizeListener2 = _slicedToArray$4(useResizeListener({
3429 - listener: function listener(event) {
3430 - _listener && _listener(event, {
3431 - type: "resize",
3432 - valid: !DomHandler.isTouchDevice()
3433 - });
3434 - },
3435 - when
3436 - }), 2);
3437 - var bindWindowResizeListener = _useResizeListener2[0];
3438 - var unbindWindowResizeListener = _useResizeListener2[1];
3439 - var _useEventListener4 = _slicedToArray$4(useEventListener({
3440 - target: "window",
3441 - type: "orientationchange",
3442 - listener: function listener(event) {
3443 - _listener && _listener(event, {
3444 - type: "orientationchange",
3445 - valid: true
3446 - });
3447 - },
3448 - when
3449 - }), 2);
3450 - var bindWindowOrientationChangeListener = _useEventListener4[0];
3451 - var unbindWindowOrientationChangeListener = _useEventListener4[1];
3452 - var _useOverlayScrollList2 = _slicedToArray$4(useOverlayScrollListener({
3453 - target,
3454 - listener: function listener(event) {
3455 - _listener && _listener(event, {
3456 - type: "scroll",
3457 - valid: true
3458 - });
3459 - },
3460 - when
3461 - }), 2);
3462 - var bindOverlayScrollListener = _useOverlayScrollList2[0];
3463 - var unbindOverlayScrollListener = _useOverlayScrollList2[1];
3464 - var isOutsideClicked = function isOutsideClicked(event) {
3465 - return targetRef.current && !(targetRef.current.isSameNode(event.target) || targetRef.current.contains(event.target) || overlayRef.current && overlayRef.current.contains(event.target));
3466 - };
3467 - var bind = function bind() {
3468 - bindDocumentClickListener();
3469 - bindWindowResizeListener();
3470 - bindWindowOrientationChangeListener();
3471 - bindOverlayScrollListener();
3472 - };
3473 - var unbind = function unbind() {
3474 - unbindDocumentClickListener();
3475 - unbindWindowResizeListener();
3476 - unbindWindowOrientationChangeListener();
3477 - unbindOverlayScrollListener();
3478 - };
3479 - react.useEffect(function() {
3480 - if (when) {
3481 - targetRef.current = DomHandler.getTargetElement(target);
3482 - overlayRef.current = DomHandler.getTargetElement(overlay);
3483 - } else {
3484 - unbind();
3485 - targetRef.current = overlayRef.current = null;
3486 - }
3487 - }, [
3488 - target,
3489 - overlay,
3490 - when
3491 - ]);
3492 - useUnmountEffect(function() {
3493 - unbind();
3494 - });
3495 - return [bind, unbind];
3496 - };
3497 - var _id = 0;
3498 - var useStyle = function useStyle(css) {
3499 - var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
3500 - var _useState2 = _slicedToArray$4((0, react.useState)(false), 2);
3501 - var isLoaded = _useState2[0];
3502 - var setIsLoaded = _useState2[1];
3503 - var styleRef = (0, react.useRef)(null);
3504 - var context = (0, react.useContext)(PrimeReactContext);
3505 - var defaultDocument = DomHandler.isClient() ? window.document : void 0;
3506 - var _options$document = options.document;
3507 - var document = _options$document === void 0 ? defaultDocument : _options$document;
3508 - var _options$manual = options.manual;
3509 - var manual = _options$manual === void 0 ? false : _options$manual;
3510 - var _options$name = options.name;
3511 - var name = _options$name === void 0 ? "style_".concat(++_id) : _options$name;
3512 - var _options$id = options.id;
3513 - var id = _options$id === void 0 ? void 0 : _options$id;
3514 - var _options$media = options.media;
3515 - var media = _options$media === void 0 ? void 0 : _options$media;
3516 - var getCurrentStyleRef = function getCurrentStyleRef(styleContainer) {
3517 - var existingStyle = styleContainer.querySelector("style[data-primereact-style-id=\"".concat(name, "\"]"));
3518 - if (existingStyle) return existingStyle;
3519 - if (id !== void 0) {
3520 - var existingElement = document.getElementById(id);
3521 - if (existingElement) return existingElement;
3522 - }
3523 - return document.createElement("style");
3524 - };
3525 - var update = function update(newCSS) {
3526 - isLoaded && css !== newCSS && (styleRef.current.textContent = newCSS);
3527 - };
3528 - var load = function load() {
3529 - if (!document || isLoaded) return;
3530 - var styleContainer = (context === null || context === void 0 ? void 0 : context.styleContainer) || document.head;
3531 - styleRef.current = getCurrentStyleRef(styleContainer);
3532 - if (!styleRef.current.isConnected) {
3533 - styleRef.current.type = "text/css";
3534 - if (id) styleRef.current.id = id;
3535 - if (media) styleRef.current.media = media;
3536 - DomHandler.addNonce(styleRef.current, context && context.nonce || PrimeReact.nonce);
3537 - styleContainer.appendChild(styleRef.current);
3538 - if (name) styleRef.current.setAttribute("data-primereact-style-id", name);
3539 - }
3540 - styleRef.current.textContent = css;
3541 - setIsLoaded(true);
3542 - };
3543 - var unload = function unload() {
3544 - if (!document || !styleRef.current) return;
3545 - DomHandler.removeInlineStyle(styleRef.current);
3546 - setIsLoaded(false);
3547 - };
3548 - (0, react.useEffect)(function() {
3549 - if (!manual) load();
3550 - }, [manual]);
3551 - return {
3552 - id,
3553 - name,
3554 - update,
3555 - unload,
3556 - load,
3557 - isLoaded
3558 - };
3559 - };
3560 - var useUpdateEffect = function useUpdateEffect(fn, deps) {
3561 - var mounted = react.useRef(false);
3562 - return react.useEffect(function() {
3563 - if (!mounted.current) {
3564 - mounted.current = true;
3565 - return;
3566 - }
3567 - return fn && fn();
3568 - }, deps);
3569 - };
3570 -
3571 -//#endregion
3572 -//#region node_modules/primereact/componentbase/componentbase.esm.js
3573 - function _arrayLikeToArray$5(r, a) {
3574 - (null == a || a > r.length) && (a = r.length);
3575 - for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
3576 - return n;
3577 - }
3578 - __name(_arrayLikeToArray$5, "_arrayLikeToArray");
3579 - function _arrayWithoutHoles$3(r) {
3580 - if (Array.isArray(r)) return _arrayLikeToArray$5(r);
3581 - }
3582 - __name(_arrayWithoutHoles$3, "_arrayWithoutHoles");
3583 - function _iterableToArray$3(r) {
3584 - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
3585 - }
3586 - __name(_iterableToArray$3, "_iterableToArray");
3587 - function _unsupportedIterableToArray$5(r, a) {
3588 - if (r) {
3589 - if ("string" == typeof r) return _arrayLikeToArray$5(r, a);
3590 - var t = {}.toString.call(r).slice(8, -1);
3591 - return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$5(r, a) : void 0;
3592 - }
3593 - }
3594 - __name(_unsupportedIterableToArray$5, "_unsupportedIterableToArray");
3595 - function _nonIterableSpread$3() {
3596 - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3597 - }
3598 - __name(_nonIterableSpread$3, "_nonIterableSpread");
3599 - function _toConsumableArray$3(r) {
3600 - return _arrayWithoutHoles$3(r) || _iterableToArray$3(r) || _unsupportedIterableToArray$5(r) || _nonIterableSpread$3();
3601 - }
3602 - __name(_toConsumableArray$3, "_toConsumableArray");
3603 - function _typeof$4(o) {
3604 - "@babel/helpers - typeof";
3605 - return _typeof$4 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
3606 - return typeof o;
3607 - } : function(o) {
3608 - return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
3609 - }, _typeof$4(o);
3610 - }
3611 - __name(_typeof$4, "_typeof");
3612 - function toPrimitive$4(t, r) {
3613 - if ("object" != _typeof$4(t) || !t) return t;
3614 - var e = t[Symbol.toPrimitive];
3615 - if (void 0 !== e) {
3616 - var i = e.call(t, r || "default");
3617 - if ("object" != _typeof$4(i)) return i;
3618 - throw new TypeError("@@toPrimitive must return a primitive value.");
3619 - }
3620 - return ("string" === r ? String : Number)(t);
3621 - }
3622 - __name(toPrimitive$4, "toPrimitive");
3623 - function toPropertyKey$4(t) {
3624 - var i = toPrimitive$4(t, "string");
3625 - return "symbol" == _typeof$4(i) ? i : i + "";
3626 - }
3627 - __name(toPropertyKey$4, "toPropertyKey");
3628 - function _defineProperty$4(e, r, t) {
3629 - return (r = toPropertyKey$4(r)) in e ? Object.defineProperty(e, r, {
3630 - value: t,
3631 - enumerable: !0,
3632 - configurable: !0,
3633 - writable: !0
3634 - }) : e[r] = t, e;
3635 - }
3636 - __name(_defineProperty$4, "_defineProperty");
3637 - function ownKeys$5(e, r) {
3638 - var t = Object.keys(e);
3639 - if (Object.getOwnPropertySymbols) {
3640 - var o = Object.getOwnPropertySymbols(e);
3641 - r && (o = o.filter(function(r) {
3642 - return Object.getOwnPropertyDescriptor(e, r).enumerable;
3643 - })), t.push.apply(t, o);
3644 - }
3645 - return t;
3646 - }
3647 - __name(ownKeys$5, "ownKeys");
3648 - function _objectSpread$5(e) {
3649 - for (var r = 1; r < arguments.length; r++) {
3650 - var t = null != arguments[r] ? arguments[r] : {};
3651 - r % 2 ? ownKeys$5(Object(t), !0).forEach(function(r) {
3652 - _defineProperty$4(e, r, t[r]);
3653 - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function(r) {
3654 - Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
3655 - });
3656 - }
3657 - return e;
3658 - }
3659 - __name(_objectSpread$5, "_objectSpread");
3660 - var baseStyle = "\n.p-hidden-accessible {\n border: 0;\n clip: rect(0 0 0 0);\n height: 1px;\n margin: -1px;\n opacity: 0;\n overflow: hidden;\n padding: 0;\n pointer-events: none;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n}\n\n.p-overflow-hidden {\n overflow: hidden;\n padding-right: var(--scrollbar-width);\n}\n";
3661 - var commonStyle = "\n@layer primereact {\n .p-component, .p-component * {\n box-sizing: border-box;\n }\n\n .p-hidden {\n display: none;\n }\n\n .p-hidden-space {\n visibility: hidden;\n }\n\n .p-reset {\n margin: 0;\n padding: 0;\n border: 0;\n outline: 0;\n text-decoration: none;\n font-size: 100%;\n list-style: none;\n }\n\n .p-disabled, .p-disabled * {\n cursor: default;\n pointer-events: none;\n user-select: none;\n }\n\n .p-component-overlay {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n }\n\n .p-unselectable-text {\n user-select: none;\n }\n\n .p-scrollbar-measure {\n width: 100px;\n height: 100px;\n overflow: scroll;\n position: absolute;\n top: -9999px;\n }\n\n @-webkit-keyframes p-fadein {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n }\n @keyframes p-fadein {\n 0% { opacity: 0; }\n 100% { opacity: 1; }\n }\n\n .p-link {\n text-align: left;\n background-color: transparent;\n margin: 0;\n padding: 0;\n border: none;\n cursor: pointer;\n user-select: none;\n }\n\n .p-link:disabled {\n cursor: default;\n }\n\n /* Non react overlay animations */\n .p-connected-overlay {\n opacity: 0;\n transform: scaleY(0.8);\n transition: transform .12s cubic-bezier(0, 0, 0.2, 1), opacity .12s cubic-bezier(0, 0, 0.2, 1);\n }\n\n .p-connected-overlay-visible {\n opacity: 1;\n transform: scaleY(1);\n }\n\n .p-connected-overlay-hidden {\n opacity: 0;\n transform: scaleY(1);\n transition: opacity .1s linear;\n }\n\n /* React based overlay animations */\n .p-connected-overlay-enter {\n opacity: 0;\n transform: scaleY(0.8);\n }\n\n .p-connected-overlay-enter-active {\n opacity: 1;\n transform: scaleY(1);\n transition: transform .12s cubic-bezier(0, 0, 0.2, 1), opacity .12s cubic-bezier(0, 0, 0.2, 1);\n }\n\n .p-connected-overlay-enter-done {\n transform: none;\n }\n\n .p-connected-overlay-exit {\n opacity: 1;\n }\n\n .p-connected-overlay-exit-active {\n opacity: 0;\n transition: opacity .1s linear;\n }\n\n /* Toggleable Content */\n .p-toggleable-content-enter {\n max-height: 0;\n }\n\n .p-toggleable-content-enter-active {\n overflow: hidden;\n max-height: 1000px;\n transition: max-height 1s ease-in-out;\n }\n\n .p-toggleable-content-enter-done {\n transform: none;\n }\n\n .p-toggleable-content-exit {\n max-height: 1000px;\n }\n\n .p-toggleable-content-exit-active {\n overflow: hidden;\n max-height: 0;\n transition: max-height 0.45s cubic-bezier(0, 1, 0, 1);\n }\n\n /* @todo Refactor */\n .p-menu .p-menuitem-link {\n cursor: pointer;\n display: flex;\n align-items: center;\n text-decoration: none;\n overflow: hidden;\n position: relative;\n }\n\n ".concat("\n.p-button {\n margin: 0;\n display: inline-flex;\n cursor: pointer;\n user-select: none;\n align-items: center;\n vertical-align: bottom;\n text-align: center;\n overflow: hidden;\n position: relative;\n}\n\n.p-button-label {\n flex: 1 1 auto;\n}\n\n.p-button-icon {\n pointer-events: none;\n}\n\n.p-button-icon-right {\n order: 1;\n}\n\n.p-button:disabled {\n cursor: default;\n}\n\n.p-button-icon-only {\n justify-content: center;\n}\n\n.p-button-icon-only .p-button-label {\n visibility: hidden;\n width: 0;\n flex: 0 0 auto;\n}\n\n.p-button-vertical {\n flex-direction: column;\n}\n\n.p-button-icon-bottom {\n order: 2;\n}\n\n.p-button-group .p-button {\n margin: 0;\n}\n\n.p-button-group .p-button:not(:last-child) {\n border-right: 0 none;\n}\n\n.p-button-group .p-button:not(:first-of-type):not(:last-of-type) {\n border-radius: 0;\n}\n\n.p-button-group .p-button:first-of-type {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n.p-button-group .p-button:last-of-type {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n\n.p-button-group .p-button:focus {\n position: relative;\n z-index: 1;\n}\n\n.p-button-group-single .p-button:first-of-type {\n border-top-right-radius: var(--border-radius) !important;\n border-bottom-right-radius: var(--border-radius) !important;\n}\n\n.p-button-group-single .p-button:last-of-type {\n border-top-left-radius: var(--border-radius) !important;\n border-bottom-left-radius: var(--border-radius) !important;\n}\n", "\n ").concat("\n.p-inputtext {\n margin: 0;\n}\n\n.p-fluid .p-inputtext {\n width: 100%;\n}\n\n/* InputGroup */\n.p-inputgroup {\n display: flex;\n align-items: stretch;\n width: 100%;\n}\n\n.p-inputgroup-addon {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.p-inputgroup .p-float-label {\n display: flex;\n align-items: stretch;\n width: 100%;\n}\n\n.p-inputgroup .p-inputtext,\n.p-fluid .p-inputgroup .p-inputtext,\n.p-inputgroup .p-inputwrapper,\n.p-fluid .p-inputgroup .p-input {\n flex: 1 1 auto;\n width: 1%;\n}\n\n/* Floating Label */\n.p-float-label {\n display: block;\n position: relative;\n}\n\n.p-float-label label {\n position: absolute;\n pointer-events: none;\n top: 50%;\n margin-top: -0.5rem;\n transition-property: all;\n transition-timing-function: ease;\n line-height: 1;\n}\n\n.p-float-label textarea ~ label,\n.p-float-label .p-mention ~ label {\n top: 1rem;\n}\n\n.p-float-label input:focus ~ label,\n.p-float-label input:-webkit-autofill ~ label,\n.p-float-label input.p-filled ~ label,\n.p-float-label textarea:focus ~ label,\n.p-float-label textarea.p-filled ~ label,\n.p-float-label .p-inputwrapper-focus ~ label,\n.p-float-label .p-inputwrapper-filled ~ label,\n.p-float-label .p-tooltip-target-wrapper ~ label {\n top: -0.75rem;\n font-size: 12px;\n}\n\n.p-float-label .p-placeholder,\n.p-float-label input::placeholder,\n.p-float-label .p-inputtext::placeholder {\n opacity: 0;\n transition-property: all;\n transition-timing-function: ease;\n}\n\n.p-float-label .p-focus .p-placeholder,\n.p-float-label input:focus::placeholder,\n.p-float-label .p-inputtext:focus::placeholder {\n opacity: 1;\n transition-property: all;\n transition-timing-function: ease;\n}\n\n.p-input-icon-left,\n.p-input-icon-right {\n position: relative;\n display: inline-block;\n}\n\n.p-input-icon-left > i,\n.p-input-icon-right > i,\n.p-input-icon-left > svg,\n.p-input-icon-right > svg,\n.p-input-icon-left > .p-input-prefix,\n.p-input-icon-right > .p-input-suffix {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n}\n\n.p-fluid .p-input-icon-left,\n.p-fluid .p-input-icon-right {\n display: block;\n width: 100%;\n}\n", "\n ").concat("\n.p-icon {\n display: inline-block;\n}\n\n.p-icon-spin {\n -webkit-animation: p-icon-spin 2s infinite linear;\n animation: p-icon-spin 2s infinite linear;\n}\n\nsvg.p-icon {\n pointer-events: auto;\n}\n\nsvg.p-icon g,\n.p-disabled svg.p-icon {\n pointer-events: none;\n}\n\n@-webkit-keyframes p-icon-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg);\n }\n}\n\n@keyframes p-icon-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(359deg);\n transform: rotate(359deg);\n }\n}\n", "\n}\n");
3662 - var ComponentBase = {
3663 - cProps: void 0,
3664 - cParams: void 0,
3665 - cName: void 0,
3666 - defaultProps: {
3667 - pt: void 0,
3668 - ptOptions: void 0,
3669 - unstyled: false
3670 - },
3671 - context: {},
3672 - globalCSS: void 0,
3673 - classes: {},
3674 - styles: "",
3675 - extend: function extend() {
3676 - var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
3677 - var css = props.css;
3678 - var defaultProps = _objectSpread$5(_objectSpread$5({}, props.defaultProps), ComponentBase.defaultProps);
3679 - var inlineStyles = {};
3680 - var getProps = function getProps(props) {
3681 - ComponentBase.context = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
3682 - ComponentBase.cProps = props;
3683 - return ObjectUtils.getMergedProps(props, defaultProps);
3684 - };
3685 - var getOtherProps = function getOtherProps(props) {
3686 - return ObjectUtils.getDiffProps(props, defaultProps);
3687 - };
3688 - var getPTValue = function getPTValue() {
3689 - var _ComponentBase$contex;
3690 - var obj = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
3691 - var key = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
3692 - var params = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
3693 - var searchInDefaultPT = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true;
3694 - if (obj.hasOwnProperty("pt") && obj.pt !== void 0) obj = obj.pt;
3695 - var originalkey = key;
3696 - var isNestedParam = /./g.test(originalkey) && !!params[originalkey.split(".")[0]];
3697 - var fkey = isNestedParam ? ObjectUtils.toFlatCase(originalkey.split(".")[1]) : ObjectUtils.toFlatCase(originalkey);
3698 - var componentName = params.hostName && ObjectUtils.toFlatCase(params.hostName) || params.props && params.props.__TYPE && ObjectUtils.toFlatCase(params.props.__TYPE) || "";
3699 - var isTransition = fkey === "transition";
3700 - var datasetPrefix = "data-pc-";
3701 - var _getHostInstance = function getHostInstance(params) {
3702 - return params !== null && params !== void 0 && params.props ? params.hostName ? params.props.__TYPE === params.hostName ? params.props : _getHostInstance(params.parent) : params.parent : void 0;
3703 - };
3704 - var getPropValue = function getPropValue(name) {
3705 - var _params$props;
3706 - var _getHostInstance2;
3707 - return ((_params$props = params.props) === null || _params$props === void 0 ? void 0 : _params$props[name]) || ((_getHostInstance2 = _getHostInstance(params)) === null || _getHostInstance2 === void 0 ? void 0 : _getHostInstance2[name]);
3708 - };
3709 - ComponentBase.cParams = params;
3710 - ComponentBase.cName = componentName;
3711 - var _ref = getPropValue("ptOptions") || ComponentBase.context.ptOptions || {};
3712 - var _ref$mergeSections = _ref.mergeSections;
3713 - var mergeSections = _ref$mergeSections === void 0 ? true : _ref$mergeSections;
3714 - var _ref$mergeProps = _ref.mergeProps;
3715 - var useMergeProps = _ref$mergeProps === void 0 ? false : _ref$mergeProps;
3716 - var getPTClassValue = function getPTClassValue() {
3717 - var value = _getOptionValue.apply(void 0, arguments);
3718 - if (Array.isArray(value)) return { className: classNames.apply(void 0, _toConsumableArray$3(value)) };
3719 - if (ObjectUtils.isString(value)) return { className: value };
3720 - if (value !== null && value !== void 0 && value.hasOwnProperty("className") && Array.isArray(value.className)) return { className: classNames.apply(void 0, _toConsumableArray$3(value.className)) };
3721 - return value;
3722 - };
3723 - var globalPT = searchInDefaultPT ? isNestedParam ? _useGlobalPT(getPTClassValue, originalkey, params) : _useDefaultPT(getPTClassValue, originalkey, params) : void 0;
3724 - var self = isNestedParam ? void 0 : _usePT(_getPT(obj, componentName), getPTClassValue, originalkey, params);
3725 - var datasetProps = !isTransition && _objectSpread$5(_objectSpread$5({}, fkey === "root" && _defineProperty$4({}, "".concat(datasetPrefix, "name"), params.props && params.props.__parentMetadata ? ObjectUtils.toFlatCase(params.props.__TYPE) : componentName)), {}, _defineProperty$4({}, "".concat(datasetPrefix, "section"), fkey));
3726 - return mergeSections || !mergeSections && self ? useMergeProps ? mergeProps([
3727 - globalPT,
3728 - self,
3729 - Object.keys(datasetProps).length ? datasetProps : {}
3730 - ], { classNameMergeFunction: (_ComponentBase$contex = ComponentBase.context.ptOptions) === null || _ComponentBase$contex === void 0 ? void 0 : _ComponentBase$contex.classNameMergeFunction }) : _objectSpread$5(_objectSpread$5(_objectSpread$5({}, globalPT), self), Object.keys(datasetProps).length ? datasetProps : {}) : _objectSpread$5(_objectSpread$5({}, self), Object.keys(datasetProps).length ? datasetProps : {});
3731 - };
3732 - return _objectSpread$5(_objectSpread$5({
3733 - getProps,
3734 - getOtherProps,
3735 - setMetaData: function setMetaData() {
3736 - var metadata = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
3737 - var props = metadata.props;
3738 - var state = metadata.state;
3739 - var ptm = function ptm() {
3740 - var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
3741 - var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
3742 - return getPTValue((props || {}).pt, key, _objectSpread$5(_objectSpread$5({}, metadata), params));
3743 - };
3744 - var ptmo = function ptmo() {
3745 - return getPTValue(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, false);
3746 - };
3747 - var isUnstyled = function isUnstyled() {
3748 - return ComponentBase.context.unstyled || PrimeReact.unstyled || props.unstyled;
3749 - };
3750 - return {
3751 - ptm,
3752 - ptmo,
3753 - sx: function sx() {
3754 - var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
3755 - var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
3756 - if (arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true) {
3757 - var _ComponentBase$contex2;
3758 - var self = _getOptionValue(css && css.inlineStyles, key, _objectSpread$5({
3759 - props,
3760 - state
3761 - }, params));
3762 - return mergeProps([_getOptionValue(inlineStyles, key, _objectSpread$5({
3763 - props,
3764 - state
3765 - }, params)), self], { classNameMergeFunction: (_ComponentBase$contex2 = ComponentBase.context.ptOptions) === null || _ComponentBase$contex2 === void 0 ? void 0 : _ComponentBase$contex2.classNameMergeFunction });
3766 - }
3767 - },
3768 - cx: function cx() {
3769 - var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
3770 - var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
3771 - return !isUnstyled() ? _getOptionValue(css && css.classes, key, _objectSpread$5({
3772 - props,
3773 - state
3774 - }, params)) : void 0;
3775 - },
3776 - isUnstyled
3777 - };
3778 - }
3779 - }, props), {}, { defaultProps });
3780 - }
3781 - };
3782 - var _getOptionValue = function getOptionValue(obj) {
3783 - var key = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
3784 - var params = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
3785 - var fKeys = String(ObjectUtils.toFlatCase(key)).split(".");
3786 - var fKey = fKeys.shift();
3787 - var matchedPTOption = ObjectUtils.isNotEmpty(obj) ? Object.keys(obj).find(function(k) {
3788 - return ObjectUtils.toFlatCase(k) === fKey;
3789 - }) : "";
3790 - return fKey ? ObjectUtils.isObject(obj) ? _getOptionValue(ObjectUtils.getItemValue(obj[matchedPTOption], params), fKeys.join("."), params) : void 0 : ObjectUtils.getItemValue(obj, params);
3791 - };
3792 - var _getPT = function _getPT(pt) {
3793 - var key = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
3794 - var callback = arguments.length > 2 ? arguments[2] : void 0;
3795 - var _usept = pt === null || pt === void 0 ? void 0 : pt._usept;
3796 - var getValue = function getValue(value) {
3797 - var _ref3;
3798 - var checkSameKey = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
3799 - var _value = callback ? callback(value) : value;
3800 - var _key = ObjectUtils.toFlatCase(key);
3801 - return (_ref3 = checkSameKey ? _key !== ComponentBase.cName ? _value === null || _value === void 0 ? void 0 : _value[_key] : void 0 : _value === null || _value === void 0 ? void 0 : _value[_key]) !== null && _ref3 !== void 0 ? _ref3 : _value;
3802 - };
3803 - return ObjectUtils.isNotEmpty(_usept) ? {
3804 - _usept,
3805 - originalValue: getValue(pt.originalValue),
3806 - value: getValue(pt.value)
3807 - } : getValue(pt, true);
3808 - };
3809 - var _usePT = function _usePT(pt, callback, key, params) {
3810 - var fn = function fn(value) {
3811 - return callback(value, key, params);
3812 - };
3813 - if (pt !== null && pt !== void 0 && pt.hasOwnProperty("_usept")) {
3814 - var _ref4 = pt._usept || ComponentBase.context.ptOptions || {};
3815 - var _ref4$mergeSections = _ref4.mergeSections;
3816 - var mergeSections = _ref4$mergeSections === void 0 ? true : _ref4$mergeSections;
3817 - var _ref4$mergeProps = _ref4.mergeProps;
3818 - var useMergeProps = _ref4$mergeProps === void 0 ? false : _ref4$mergeProps;
3819 - var classNameMergeFunction = _ref4.classNameMergeFunction;
3820 - var originalValue = fn(pt.originalValue);
3821 - var value = fn(pt.value);
3822 - if (originalValue === void 0 && value === void 0) return;
3823 - else if (ObjectUtils.isString(value)) return value;
3824 - else if (ObjectUtils.isString(originalValue)) return originalValue;
3825 - return mergeSections || !mergeSections && value ? useMergeProps ? mergeProps([originalValue, value], { classNameMergeFunction }) : _objectSpread$5(_objectSpread$5({}, originalValue), value) : value;
3826 - }
3827 - return fn(pt);
3828 - };
3829 - var getGlobalPT = function getGlobalPT() {
3830 - return _getPT(ComponentBase.context.pt || PrimeReact.pt, void 0, function(value) {
3831 - return ObjectUtils.getItemValue(value, ComponentBase.cParams);
3832 - });
3833 - };
3834 - var getDefaultPT = function getDefaultPT() {
3835 - return _getPT(ComponentBase.context.pt || PrimeReact.pt, void 0, function(value) {
3836 - return _getOptionValue(value, ComponentBase.cName, ComponentBase.cParams) || ObjectUtils.getItemValue(value, ComponentBase.cParams);
3837 - });
3838 - };
3839 - var _useGlobalPT = function _useGlobalPT(callback, key, params) {
3840 - return _usePT(getGlobalPT(), callback, key, params);
3841 - };
3842 - var _useDefaultPT = function _useDefaultPT(callback, key, params) {
3843 - return _usePT(getDefaultPT(), callback, key, params);
3844 - };
3845 - var useHandleStyle = function useHandleStyle(styles) {
3846 - var _isUnstyled = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : function() {};
3847 - var config = arguments.length > 2 ? arguments[2] : void 0;
3848 - var name = config.name;
3849 - var _config$styled = config.styled;
3850 - var styled = _config$styled === void 0 ? false : _config$styled;
3851 - var _config$hostName = config.hostName;
3852 - var hostName = _config$hostName === void 0 ? "" : _config$hostName;
3853 - var globalCSS = _useGlobalPT(_getOptionValue, "global.css", ComponentBase.cParams);
3854 - var componentName = ObjectUtils.toFlatCase(name);
3855 - var loadBaseStyle = useStyle(baseStyle, {
3856 - name: "base",
3857 - manual: true
3858 - }).load;
3859 - var loadCommonStyle = useStyle(commonStyle, {
3860 - name: "common",
3861 - manual: true
3862 - }).load;
3863 - var loadGlobalStyle = useStyle(globalCSS, {
3864 - name: "global",
3865 - manual: true
3866 - }).load;
3867 - var loadComponentStyle = useStyle(styles, {
3868 - name,
3869 - manual: true
3870 - }).load;
3871 - var hook = function hook(hookName) {
3872 - if (!hostName) {
3873 - var selfHook = _usePT(_getPT((ComponentBase.cProps || {}).pt, componentName), _getOptionValue, "hooks.".concat(hookName));
3874 - var defaultHook = _useDefaultPT(_getOptionValue, "hooks.".concat(hookName));
3875 - selfHook === null || selfHook === void 0 || selfHook();
3876 - defaultHook === null || defaultHook === void 0 || defaultHook();
3877 - }
3878 - };
3879 - hook("useMountEffect");
3880 - useMountEffect(function() {
3881 - loadBaseStyle();
3882 - loadGlobalStyle();
3883 - if (!_isUnstyled()) {
3884 - loadCommonStyle();
3885 - if (!styled) loadComponentStyle();
3886 - }
3887 - });
3888 - useUpdateEffect(function() {
3889 - hook("useUpdateEffect");
3890 - });
3891 - useUnmountEffect(function() {
3892 - hook("useUnmountEffect");
3893 - });
3894 - };
3895 -
3896 -//#endregion
3897 -//#region node_modules/@babel/runtime/helpers/esm/extends.js
3898 - function _extends$3() {
3899 - return _extends$3 = Object.assign ? Object.assign.bind() : function(n) {
3900 - for (var e = 1; e < arguments.length; e++) {
3901 - var t = arguments[e];
3902 - for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
3903 - }
3904 - return n;
3905 - }, _extends$3.apply(null, arguments);
3906 - }
3907 - __name(_extends$3, "_extends");
3908 -
3909 -//#endregion
3910 -//#region node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
3911 - function _objectWithoutPropertiesLoose(r, e) {
3912 - if (null == r) return {};
3913 - var t = {};
3914 - for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
3915 - if (-1 !== e.indexOf(n)) continue;
3916 - t[n] = r[n];
3917 - }
3918 - return t;
3919 - }
3920 -
3921 -//#endregion
3922 -//#region node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
3923 - function _setPrototypeOf(t, e) {
3924 - return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
3925 - return t.__proto__ = e, t;
3926 - }, _setPrototypeOf(t, e);
3927 - }
3928 -
3929 -//#endregion
3930 -//#region node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
3931 - function _inheritsLoose(t, o) {
3932 - t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
3933 - }
3934 -
3935 -//#endregion
3936 -//#region node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js
3937 -/** @license React v16.13.1
3938 - * react-is.development.js
3939 - *
3940 - * Copyright (c) Facebook, Inc. and its affiliates.
3941 - *
3942 - * This source code is licensed under the MIT license found in the
3943 - * LICENSE file in the root directory of this source tree.
3944 - */
3945 - var require_react_is_development = /* @__PURE__ */ __commonJSMin(((exports) => {
3946 - (function() {
3947 - "use strict";
3948 - var hasSymbol = typeof Symbol === "function" && Symbol.for;
3949 - var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103;
3950 - var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106;
3951 - var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107;
3952 - var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108;
3953 - var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114;
3954 - var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109;
3955 - var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110;
3956 - var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111;
3957 - var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111;
3958 - var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112;
3959 - var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113;
3960 - var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120;
3961 - var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115;
3962 - var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116;
3963 - var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121;
3964 - var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
3965 - var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
3966 - var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
3967 - function isValidElementType(type) {
3968 - return typeof type === "string" || typeof type === "function" || type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
3969 - }
3970 - function typeOf(object) {
3971 - if (typeof object === "object" && object !== null) {
3972 - var $$typeof = object.$$typeof;
3973 - switch ($$typeof) {
3974 - case REACT_ELEMENT_TYPE:
3975 - var type = object.type;
3976 - switch (type) {
3977 - case REACT_ASYNC_MODE_TYPE:
3978 - case REACT_CONCURRENT_MODE_TYPE:
3979 - case REACT_FRAGMENT_TYPE:
3980 - case REACT_PROFILER_TYPE:
3981 - case REACT_STRICT_MODE_TYPE:
3982 - case REACT_SUSPENSE_TYPE: return type;
3983 - default:
3984 - var $$typeofType = type && type.$$typeof;
3985 - switch ($$typeofType) {
3986 - case REACT_CONTEXT_TYPE:
3987 - case REACT_FORWARD_REF_TYPE:
3988 - case REACT_LAZY_TYPE:
3989 - case REACT_MEMO_TYPE:
3990 - case REACT_PROVIDER_TYPE: return $$typeofType;
3991 - default: return $$typeof;
3992 - }
3993 - }
3994 - case REACT_PORTAL_TYPE: return $$typeof;
3995 - }
3996 - }
3997 - }
3998 - var AsyncMode = REACT_ASYNC_MODE_TYPE;
3999 - var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
4000 - var ContextConsumer = REACT_CONTEXT_TYPE;
4001 - var ContextProvider = REACT_PROVIDER_TYPE;
4002 - var Element = REACT_ELEMENT_TYPE;
4003 - var ForwardRef = REACT_FORWARD_REF_TYPE;
4004 - var Fragment = REACT_FRAGMENT_TYPE;
4005 - var Lazy = REACT_LAZY_TYPE;
4006 - var Memo = REACT_MEMO_TYPE;
4007 - var Portal = REACT_PORTAL_TYPE;
4008 - var Profiler = REACT_PROFILER_TYPE;
4009 - var StrictMode = REACT_STRICT_MODE_TYPE;
4010 - var Suspense = REACT_SUSPENSE_TYPE;
4011 - var hasWarnedAboutDeprecatedIsAsyncMode = false;
4012 - function isAsyncMode(object) {
4013 - if (!hasWarnedAboutDeprecatedIsAsyncMode) {
4014 - hasWarnedAboutDeprecatedIsAsyncMode = true;
4015 - console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
4016 - }
4017 - return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
4018 - }
4019 - function isConcurrentMode(object) {
4020 - return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
4021 - }
4022 - function isContextConsumer(object) {
4023 - return typeOf(object) === REACT_CONTEXT_TYPE;
4024 - }
4025 - function isContextProvider(object) {
4026 - return typeOf(object) === REACT_PROVIDER_TYPE;
4027 - }
4028 - function isElement(object) {
4029 - return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
4030 - }
4031 - function isForwardRef(object) {
4032 - return typeOf(object) === REACT_FORWARD_REF_TYPE;
4033 - }
4034 - function isFragment(object) {
4035 - return typeOf(object) === REACT_FRAGMENT_TYPE;
4036 - }
4037 - function isLazy(object) {
4038 - return typeOf(object) === REACT_LAZY_TYPE;
4039 - }
4040 - function isMemo(object) {
4041 - return typeOf(object) === REACT_MEMO_TYPE;
4042 - }
4043 - function isPortal(object) {
4044 - return typeOf(object) === REACT_PORTAL_TYPE;
4045 - }
4046 - function isProfiler(object) {
4047 - return typeOf(object) === REACT_PROFILER_TYPE;
4048 - }
4049 - function isStrictMode(object) {
4050 - return typeOf(object) === REACT_STRICT_MODE_TYPE;
4051 - }
4052 - function isSuspense(object) {
4053 - return typeOf(object) === REACT_SUSPENSE_TYPE;
4054 - }
4055 - exports.AsyncMode = AsyncMode;
4056 - exports.ConcurrentMode = ConcurrentMode;
4057 - exports.ContextConsumer = ContextConsumer;
4058 - exports.ContextProvider = ContextProvider;
4059 - exports.Element = Element;
4060 - exports.ForwardRef = ForwardRef;
4061 - exports.Fragment = Fragment;
4062 - exports.Lazy = Lazy;
4063 - exports.Memo = Memo;
4064 - exports.Portal = Portal;
4065 - exports.Profiler = Profiler;
4066 - exports.StrictMode = StrictMode;
4067 - exports.Suspense = Suspense;
4068 - exports.isAsyncMode = isAsyncMode;
4069 - exports.isConcurrentMode = isConcurrentMode;
4070 - exports.isContextConsumer = isContextConsumer;
4071 - exports.isContextProvider = isContextProvider;
4072 - exports.isElement = isElement;
4073 - exports.isForwardRef = isForwardRef;
4074 - exports.isFragment = isFragment;
4075 - exports.isLazy = isLazy;
4076 - exports.isMemo = isMemo;
4077 - exports.isPortal = isPortal;
4078 - exports.isProfiler = isProfiler;
4079 - exports.isStrictMode = isStrictMode;
4080 - exports.isSuspense = isSuspense;
4081 - exports.isValidElementType = isValidElementType;
4082 - exports.typeOf = typeOf;
4083 - })();
4084 - }));
4085 -
4086 -//#endregion
4087 -//#region node_modules/prop-types/node_modules/react-is/index.js
4088 - var require_react_is = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4089 - module.exports = require_react_is_development();
4090 - }));
4091 -
4092 -//#endregion
4093 -//#region node_modules/object-assign/index.js
4094 -/*
4095 - object-assign
4096 - (c) Sindre Sorhus
4097 - @license MIT
4098 - */
4099 - var require_object_assign = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4100 - var getOwnPropertySymbols = Object.getOwnPropertySymbols;
4101 - var hasOwnProperty = Object.prototype.hasOwnProperty;
4102 - var propIsEnumerable = Object.prototype.propertyIsEnumerable;
4103 - function toObject(val) {
4104 - if (val === null || val === void 0) throw new TypeError("Object.assign cannot be called with null or undefined");
4105 - return Object(val);
4106 - }
4107 - function shouldUseNative() {
4108 - try {
4109 - if (!Object.assign) return false;
4110 - var test1 = /* @__PURE__ */ new String("abc");
4111 - test1[5] = "de";
4112 - if (Object.getOwnPropertyNames(test1)[0] === "5") return false;
4113 - var test2 = {};
4114 - for (var i = 0; i < 10; i++) test2["_" + String.fromCharCode(i)] = i;
4115 - if (Object.getOwnPropertyNames(test2).map(function(n) {
4116 - return test2[n];
4117 - }).join("") !== "0123456789") return false;
4118 - var test3 = {};
4119 - "abcdefghijklmnopqrst".split("").forEach(function(letter) {
4120 - test3[letter] = letter;
4121 - });
4122 - if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") return false;
4123 - return true;
4124 - } catch (err) {
4125 - return false;
4126 - }
4127 - }
4128 - module.exports = shouldUseNative() ? Object.assign : function(target, source) {
4129 - var from;
4130 - var to = toObject(target);
4131 - var symbols;
4132 - for (var s = 1; s < arguments.length; s++) {
4133 - from = Object(arguments[s]);
4134 - for (var key in from) if (hasOwnProperty.call(from, key)) to[key] = from[key];
4135 - if (getOwnPropertySymbols) {
4136 - symbols = getOwnPropertySymbols(from);
4137 - for (var i = 0; i < symbols.length; i++) if (propIsEnumerable.call(from, symbols[i])) to[symbols[i]] = from[symbols[i]];
4138 - }
4139 - }
4140 - return to;
4141 - };
4142 - }));
4143 -
4144 -//#endregion
4145 -//#region node_modules/prop-types/lib/ReactPropTypesSecret.js
4146 -/**
4147 - * Copyright (c) 2013-present, Facebook, Inc.
4148 - *
4149 - * This source code is licensed under the MIT license found in the
4150 - * LICENSE file in the root directory of this source tree.
4151 - */
4152 - var require_ReactPropTypesSecret = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4153 - var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
4154 - module.exports = ReactPropTypesSecret;
4155 - }));
4156 -
4157 -//#endregion
4158 -//#region node_modules/prop-types/lib/has.js
4159 - var require_has = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4160 - module.exports = Function.call.bind(Object.prototype.hasOwnProperty);
4161 - }));
4162 -
4163 -//#endregion
4164 -//#region node_modules/prop-types/checkPropTypes.js
4165 -/**
4166 - * Copyright (c) 2013-present, Facebook, Inc.
4167 - *
4168 - * This source code is licensed under the MIT license found in the
4169 - * LICENSE file in the root directory of this source tree.
4170 - */
4171 - var require_checkPropTypes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4172 - var printWarning = function() {};
4173 - var ReactPropTypesSecret = require_ReactPropTypesSecret();
4174 - var loggedTypeFailures = {};
4175 - var has = require_has();
4176 - printWarning = function(text) {
4177 - var message = "Warning: " + text;
4178 - if (typeof console !== "undefined") console.error(message);
4179 - try {
4180 - throw new Error(message);
4181 - } catch (x) {}
4182 - };
4183 - /**
4184 - * Assert that the values match with the type specs.
4185 - * Error messages are memorized and will only be shown once.
4186 - *
4187 - * @param {object} typeSpecs Map of name to a ReactPropType
4188 - * @param {object} values Runtime values that need to be type-checked
4189 - * @param {string} location e.g. "prop", "context", "child context"
4190 - * @param {string} componentName Name of the component for error messages.
4191 - * @param {?Function} getStack Returns the component stack.
4192 - * @private
4193 - */
4194 - function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
4195 - for (var typeSpecName in typeSpecs) if (has(typeSpecs, typeSpecName)) {
4196 - var error;
4197 - try {
4198 - if (typeof typeSpecs[typeSpecName] !== "function") {
4199 - var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
4200 - err.name = "Invariant Violation";
4201 - throw err;
4202 - }
4203 - error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
4204 - } catch (ex) {
4205 - error = ex;
4206 - }
4207 - if (error && !(error instanceof Error)) printWarning((componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).");
4208 - if (error instanceof Error && !(error.message in loggedTypeFailures)) {
4209 - loggedTypeFailures[error.message] = true;
4210 - var stack = getStack ? getStack() : "";
4211 - printWarning("Failed " + location + " type: " + error.message + (stack != null ? stack : ""));
4212 - }
4213 - }
4214 - }
4215 - /**
4216 - * Resets warning cache when testing.
4217 - *
4218 - * @private
4219 - */
4220 - checkPropTypes.resetWarningCache = function() {
4221 - loggedTypeFailures = {};
4222 - };
4223 - module.exports = checkPropTypes;
4224 - }));
4225 -
4226 -//#endregion
4227 -//#region node_modules/prop-types/factoryWithTypeCheckers.js
4228 -/**
4229 - * Copyright (c) 2013-present, Facebook, Inc.
4230 - *
4231 - * This source code is licensed under the MIT license found in the
4232 - * LICENSE file in the root directory of this source tree.
4233 - */
4234 - var require_factoryWithTypeCheckers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4235 - var ReactIs = require_react_is();
4236 - var assign = require_object_assign();
4237 - var ReactPropTypesSecret = require_ReactPropTypesSecret();
4238 - var has = require_has();
4239 - var checkPropTypes = require_checkPropTypes();
4240 - var printWarning = function() {};
4241 - printWarning = function(text) {
4242 - var message = "Warning: " + text;
4243 - if (typeof console !== "undefined") console.error(message);
4244 - try {
4245 - throw new Error(message);
4246 - } catch (x) {}
4247 - };
4248 - function emptyFunctionThatReturnsNull() {
4249 - return null;
4250 - }
4251 - module.exports = function(isValidElement, throwOnDirectAccess) {
4252 - var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
4253 - var FAUX_ITERATOR_SYMBOL = "@@iterator";
4254 - /**
4255 - * Returns the iterator method function contained on the iterable object.
4256 - *
4257 - * Be sure to invoke the function with the iterable as context:
4258 - *
4259 - * var iteratorFn = getIteratorFn(myIterable);
4260 - * if (iteratorFn) {
4261 - * var iterator = iteratorFn.call(myIterable);
4262 - * ...
4263 - * }
4264 - *
4265 - * @param {?object} maybeIterable
4266 - * @return {?function}
4267 - */
4268 - function getIteratorFn(maybeIterable) {
4269 - var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
4270 - if (typeof iteratorFn === "function") return iteratorFn;
4271 - }
4272 - /**
4273 - * Collection of methods that allow declaration and validation of props that are
4274 - * supplied to React components. Example usage:
4275 - *
4276 - * var Props = require('ReactPropTypes');
4277 - * var MyArticle = React.createClass({
4278 - * propTypes: {
4279 - * // An optional string prop named "description".
4280 - * description: Props.string,
4281 - *
4282 - * // A required enum prop named "category".
4283 - * category: Props.oneOf(['News','Photos']).isRequired,
4284 - *
4285 - * // A prop named "dialog" that requires an instance of Dialog.
4286 - * dialog: Props.instanceOf(Dialog).isRequired
4287 - * },
4288 - * render: function() { ... }
4289 - * });
4290 - *
4291 - * A more formal specification of how these methods are used:
4292 - *
4293 - * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
4294 - * decl := ReactPropTypes.{type}(.isRequired)?
4295 - *
4296 - * Each and every declaration produces a function with the same signature. This
4297 - * allows the creation of custom validation functions. For example:
4298 - *
4299 - * var MyLink = React.createClass({
4300 - * propTypes: {
4301 - * // An optional string or URI prop named "href".
4302 - * href: function(props, propName, componentName) {
4303 - * var propValue = props[propName];
4304 - * if (propValue != null && typeof propValue !== 'string' &&
4305 - * !(propValue instanceof URI)) {
4306 - * return new Error(
4307 - * 'Expected a string or an URI for ' + propName + ' in ' +
4308 - * componentName
4309 - * );
4310 - * }
4311 - * }
4312 - * },
4313 - * render: function() {...}
4314 - * });
4315 - *
4316 - * @internal
4317 - */
4318 - var ANONYMOUS = "<<anonymous>>";
4319 - var ReactPropTypes = {
4320 - array: createPrimitiveTypeChecker("array"),
4321 - bigint: createPrimitiveTypeChecker("bigint"),
4322 - bool: createPrimitiveTypeChecker("boolean"),
4323 - func: createPrimitiveTypeChecker("function"),
4324 - number: createPrimitiveTypeChecker("number"),
4325 - object: createPrimitiveTypeChecker("object"),
4326 - string: createPrimitiveTypeChecker("string"),
4327 - symbol: createPrimitiveTypeChecker("symbol"),
4328 - any: createAnyTypeChecker(),
4329 - arrayOf: createArrayOfTypeChecker,
4330 - element: createElementTypeChecker(),
4331 - elementType: createElementTypeTypeChecker(),
4332 - instanceOf: createInstanceTypeChecker,
4333 - node: createNodeChecker(),
4334 - objectOf: createObjectOfTypeChecker,
4335 - oneOf: createEnumTypeChecker,
4336 - oneOfType: createUnionTypeChecker,
4337 - shape: createShapeTypeChecker,
4338 - exact: createStrictShapeTypeChecker
4339 - };
4340 - /**
4341 - * inlined Object.is polyfill to avoid requiring consumers ship their own
4342 - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
4343 - */
4344 - function is(x, y) {
4345 - if (x === y) return x !== 0 || 1 / x === 1 / y;
4346 - else return x !== x && y !== y;
4347 - }
4348 - /**
4349 - * We use an Error-like object for backward compatibility as people may call
4350 - * PropTypes directly and inspect their output. However, we don't use real
4351 - * Errors anymore. We don't inspect their stack anyway, and creating them
4352 - * is prohibitively expensive if they are created too often, such as what
4353 - * happens in oneOfType() for any type before the one that matched.
4354 - */
4355 - function PropTypeError(message, data) {
4356 - this.message = message;
4357 - this.data = data && typeof data === "object" ? data : {};
4358 - this.stack = "";
4359 - }
4360 - PropTypeError.prototype = Error.prototype;
4361 - function createChainableTypeChecker(validate) {
4362 - var manualPropTypeCallCache = {};
4363 - var manualPropTypeWarningCount = 0;
4364 - function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
4365 - componentName = componentName || ANONYMOUS;
4366 - propFullName = propFullName || propName;
4367 - if (secret !== ReactPropTypesSecret) {
4368 - if (throwOnDirectAccess) {
4369 - var err = /* @__PURE__ */ new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");
4370 - err.name = "Invariant Violation";
4371 - throw err;
4372 - } else if (typeof console !== "undefined") {
4373 - var cacheKey = componentName + ":" + propName;
4374 - if (!manualPropTypeCallCache[cacheKey] && manualPropTypeWarningCount < 3) {
4375 - printWarning("You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.");
4376 - manualPropTypeCallCache[cacheKey] = true;
4377 - manualPropTypeWarningCount++;
4378 - }
4379 - }
4380 - }
4381 - if (props[propName] == null) {
4382 - if (isRequired) {
4383 - if (props[propName] === null) return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`."));
4384 - return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`."));
4385 - }
4386 - return null;
4387 - } else return validate(props, propName, componentName, location, propFullName);
4388 - }
4389 - var chainedCheckType = checkType.bind(null, false);
4390 - chainedCheckType.isRequired = checkType.bind(null, true);
4391 - return chainedCheckType;
4392 - }
4393 - function createPrimitiveTypeChecker(expectedType) {
4394 - function validate(props, propName, componentName, location, propFullName, secret) {
4395 - var propValue = props[propName];
4396 - if (getPropType(propValue) !== expectedType) {
4397 - var preciseType = getPreciseType(propValue);
4398 - return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."), { expectedType });
4399 - }
4400 - return null;
4401 - }
4402 - return createChainableTypeChecker(validate);
4403 - }
4404 - function createAnyTypeChecker() {
4405 - return createChainableTypeChecker(emptyFunctionThatReturnsNull);
4406 - }
4407 - function createArrayOfTypeChecker(typeChecker) {
4408 - function validate(props, propName, componentName, location, propFullName) {
4409 - if (typeof typeChecker !== "function") return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf.");
4410 - var propValue = props[propName];
4411 - if (!Array.isArray(propValue)) {
4412 - var propType = getPropType(propValue);
4413 - return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
4414 - }
4415 - for (var i = 0; i < propValue.length; i++) {
4416 - var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret);
4417 - if (error instanceof Error) return error;
4418 - }
4419 - return null;
4420 - }
4421 - return createChainableTypeChecker(validate);
4422 - }
4423 - function createElementTypeChecker() {
4424 - function validate(props, propName, componentName, location, propFullName) {
4425 - var propValue = props[propName];
4426 - if (!isValidElement(propValue)) {
4427 - var propType = getPropType(propValue);
4428 - return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
4429 - }
4430 - return null;
4431 - }
4432 - return createChainableTypeChecker(validate);
4433 - }
4434 - function createElementTypeTypeChecker() {
4435 - function validate(props, propName, componentName, location, propFullName) {
4436 - var propValue = props[propName];
4437 - if (!ReactIs.isValidElementType(propValue)) {
4438 - var propType = getPropType(propValue);
4439 - return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type."));
4440 - }
4441 - return null;
4442 - }
4443 - return createChainableTypeChecker(validate);
4444 - }
4445 - function createInstanceTypeChecker(expectedClass) {
4446 - function validate(props, propName, componentName, location, propFullName) {
4447 - if (!(props[propName] instanceof expectedClass)) {
4448 - var expectedClassName = expectedClass.name || ANONYMOUS;
4449 - var actualClassName = getClassName(props[propName]);
4450 - return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
4451 - }
4452 - return null;
4453 - }
4454 - return createChainableTypeChecker(validate);
4455 - }
4456 - function createEnumTypeChecker(expectedValues) {
4457 - if (!Array.isArray(expectedValues)) {
4458 - if (arguments.length > 1) printWarning("Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).");
4459 - else printWarning("Invalid argument supplied to oneOf, expected an array.");
4460 - return emptyFunctionThatReturnsNull;
4461 - }
4462 - function validate(props, propName, componentName, location, propFullName) {
4463 - var propValue = props[propName];
4464 - for (var i = 0; i < expectedValues.length; i++) if (is(propValue, expectedValues[i])) return null;
4465 - var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
4466 - if (getPreciseType(value) === "symbol") return String(value);
4467 - return value;
4468 - });
4469 - return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + "."));
4470 - }
4471 - return createChainableTypeChecker(validate);
4472 - }
4473 - function createObjectOfTypeChecker(typeChecker) {
4474 - function validate(props, propName, componentName, location, propFullName) {
4475 - if (typeof typeChecker !== "function") return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf.");
4476 - var propValue = props[propName];
4477 - var propType = getPropType(propValue);
4478 - if (propType !== "object") return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object."));
4479 - for (var key in propValue) if (has(propValue, key)) {
4480 - var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
4481 - if (error instanceof Error) return error;
4482 - }
4483 - return null;
4484 - }
4485 - return createChainableTypeChecker(validate);
4486 - }
4487 - function createUnionTypeChecker(arrayOfTypeCheckers) {
4488 - if (!Array.isArray(arrayOfTypeCheckers)) {
4489 - printWarning("Invalid argument supplied to oneOfType, expected an instance of array.");
4490 - return emptyFunctionThatReturnsNull;
4491 - }
4492 - for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
4493 - var checker = arrayOfTypeCheckers[i];
4494 - if (typeof checker !== "function") {
4495 - printWarning("Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i + ".");
4496 - return emptyFunctionThatReturnsNull;
4497 - }
4498 - }
4499 - function validate(props, propName, componentName, location, propFullName) {
4500 - var expectedTypes = [];
4501 - for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
4502 - var checker = arrayOfTypeCheckers[i];
4503 - var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
4504 - if (checkerResult == null) return null;
4505 - if (checkerResult.data && has(checkerResult.data, "expectedType")) expectedTypes.push(checkerResult.data.expectedType);
4506 - }
4507 - var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : "";
4508 - return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + "."));
4509 - }
4510 - return createChainableTypeChecker(validate);
4511 - }
4512 - function createNodeChecker() {
4513 - function validate(props, propName, componentName, location, propFullName) {
4514 - if (!isNode(props[propName])) return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode."));
4515 - return null;
4516 - }
4517 - return createChainableTypeChecker(validate);
4518 - }
4519 - function invalidValidatorError(componentName, location, propFullName, key, type) {
4520 - return new PropTypeError((componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`.");
4521 - }
4522 - function createShapeTypeChecker(shapeTypes) {
4523 - function validate(props, propName, componentName, location, propFullName) {
4524 - var propValue = props[propName];
4525 - var propType = getPropType(propValue);
4526 - if (propType !== "object") return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
4527 - for (var key in shapeTypes) {
4528 - var checker = shapeTypes[key];
4529 - if (typeof checker !== "function") return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
4530 - var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
4531 - if (error) return error;
4532 - }
4533 - return null;
4534 - }
4535 - return createChainableTypeChecker(validate);
4536 - }
4537 - function createStrictShapeTypeChecker(shapeTypes) {
4538 - function validate(props, propName, componentName, location, propFullName) {
4539 - var propValue = props[propName];
4540 - var propType = getPropType(propValue);
4541 - if (propType !== "object") return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
4542 - for (var key in assign({}, props[propName], shapeTypes)) {
4543 - var checker = shapeTypes[key];
4544 - if (has(shapeTypes, key) && typeof checker !== "function") return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
4545 - if (!checker) return new PropTypeError("Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " "));
4546 - var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
4547 - if (error) return error;
4548 - }
4549 - return null;
4550 - }
4551 - return createChainableTypeChecker(validate);
4552 - }
4553 - function isNode(propValue) {
4554 - switch (typeof propValue) {
4555 - case "number":
4556 - case "string":
4557 - case "undefined": return true;
4558 - case "boolean": return !propValue;
4559 - case "object":
4560 - if (Array.isArray(propValue)) return propValue.every(isNode);
4561 - if (propValue === null || isValidElement(propValue)) return true;
4562 - var iteratorFn = getIteratorFn(propValue);
4563 - if (iteratorFn) {
4564 - var iterator = iteratorFn.call(propValue);
4565 - var step;
4566 - if (iteratorFn !== propValue.entries) {
4567 - while (!(step = iterator.next()).done) if (!isNode(step.value)) return false;
4568 - } else while (!(step = iterator.next()).done) {
4569 - var entry = step.value;
4570 - if (entry) {
4571 - if (!isNode(entry[1])) return false;
4572 - }
4573 - }
4574 - } else return false;
4575 - return true;
4576 - default: return false;
4577 - }
4578 - }
4579 - function isSymbol(propType, propValue) {
4580 - if (propType === "symbol") return true;
4581 - if (!propValue) return false;
4582 - if (propValue["@@toStringTag"] === "Symbol") return true;
4583 - if (typeof Symbol === "function" && propValue instanceof Symbol) return true;
4584 - return false;
4585 - }
4586 - function getPropType(propValue) {
4587 - var propType = typeof propValue;
4588 - if (Array.isArray(propValue)) return "array";
4589 - if (propValue instanceof RegExp) return "object";
4590 - if (isSymbol(propType, propValue)) return "symbol";
4591 - return propType;
4592 - }
4593 - function getPreciseType(propValue) {
4594 - if (typeof propValue === "undefined" || propValue === null) return "" + propValue;
4595 - var propType = getPropType(propValue);
4596 - if (propType === "object") {
4597 - if (propValue instanceof Date) return "date";
4598 - else if (propValue instanceof RegExp) return "regexp";
4599 - }
4600 - return propType;
4601 - }
4602 - function getPostfixForTypeWarning(value) {
4603 - var type = getPreciseType(value);
4604 - switch (type) {
4605 - case "array":
4606 - case "object": return "an " + type;
4607 - case "boolean":
4608 - case "date":
4609 - case "regexp": return "a " + type;
4610 - default: return type;
4611 - }
4612 - }
4613 - function getClassName(propValue) {
4614 - if (!propValue.constructor || !propValue.constructor.name) return ANONYMOUS;
4615 - return propValue.constructor.name;
4616 - }
4617 - ReactPropTypes.checkPropTypes = checkPropTypes;
4618 - ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
4619 - ReactPropTypes.PropTypes = ReactPropTypes;
4620 - return ReactPropTypes;
4621 - };
4622 - }));
4623 -
4624 -//#endregion
4625 -//#region node_modules/prop-types/index.js
4626 - var require_prop_types = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4627 - var ReactIs = require_react_is();
4628 - var throwOnDirectAccess = true;
4629 - module.exports = require_factoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
4630 - }));
4631 -
4632 -//#endregion
4633 -//#region node_modules/dom-helpers/esm/hasClass.js
4634 -/**
4635 - * Checks if a given element has a CSS class.
4636 - *
4637 - * @param element the element
4638 - * @param className the CSS class name
4639 - */
4640 - function hasClass(element, className) {
4641 - if (element.classList) return !!className && element.classList.contains(className);
4642 - return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
4643 - }
4644 -
4645 -//#endregion
4646 -//#region node_modules/dom-helpers/esm/addClass.js
4647 -/**
4648 - * Adds a CSS class to a given element.
4649 - *
4650 - * @param element the element
4651 - * @param className the CSS class name
4652 - */
4653 - function addClass(element, className) {
4654 - if (element.classList) element.classList.add(className);
4655 - else if (!hasClass(element, className)) if (typeof element.className === "string") element.className = element.className + " " + className;
4656 - else element.setAttribute("class", (element.className && element.className.baseVal || "") + " " + className);
4657 - }
4658 -
4659 -//#endregion
4660 -//#region node_modules/dom-helpers/esm/removeClass.js
4661 - function replaceClassName(origClass, classToRemove) {
4662 - return origClass.replace(new RegExp("(^|\\s)" + classToRemove + "(?:\\s|$)", "g"), "$1").replace(/\s+/g, " ").replace(/^\s*|\s*$/g, "");
4663 - }
4664 - /**
4665 - * Removes a CSS class from a given element.
4666 - *
4667 - * @param element the element
4668 - * @param className the CSS class name
4669 - */
4670 - function removeClass$1(element, className) {
4671 - if (element.classList) element.classList.remove(className);
4672 - else if (typeof element.className === "string") element.className = replaceClassName(element.className, className);
4673 - else element.setAttribute("class", replaceClassName(element.className && element.className.baseVal || "", className));
4674 - }
4675 - __name(removeClass$1, "removeClass");
4676 -
4677 -//#endregion
4678 -//#region node_modules/react-transition-group/esm/config.js
4679 - var config_default = { disabled: false };
4680 -
4681 -//#endregion
4682 -//#region node_modules/react-transition-group/esm/utils/PropTypes.js
4683 - var import_prop_types = /* @__PURE__ */ __toESM(require_prop_types());
4684 - var timeoutsShape = import_prop_types.default.oneOfType([import_prop_types.default.number, import_prop_types.default.shape({
4685 - enter: import_prop_types.default.number,
4686 - exit: import_prop_types.default.number,
4687 - appear: import_prop_types.default.number
4688 - }).isRequired]);
4689 - var classNamesShape = import_prop_types.default.oneOfType([
4690 - import_prop_types.default.string,
4691 - import_prop_types.default.shape({
4692 - enter: import_prop_types.default.string,
4693 - exit: import_prop_types.default.string,
4694 - active: import_prop_types.default.string
4695 - }),
4696 - import_prop_types.default.shape({
4697 - enter: import_prop_types.default.string,
4698 - enterDone: import_prop_types.default.string,
4699 - enterActive: import_prop_types.default.string,
4700 - exit: import_prop_types.default.string,
4701 - exitDone: import_prop_types.default.string,
4702 - exitActive: import_prop_types.default.string
4703 - })
4704 - ]);
4705 -
4706 -//#endregion
4707 -//#region node_modules/react-transition-group/esm/TransitionGroupContext.js
4708 - var TransitionGroupContext_default = react.default.createContext(null);
4709 -
4710 -//#endregion
4711 -//#region node_modules/react-transition-group/esm/utils/reflow.js
4712 - var forceReflow = function forceReflow(node) {
4713 - return node.scrollTop;
4714 - };
4715 -
4716 -//#endregion
4717 -//#region node_modules/react-transition-group/esm/Transition.js
4718 - var UNMOUNTED = "unmounted";
4719 - var EXITED = "exited";
4720 - var ENTERING = "entering";
4721 - var ENTERED = "entered";
4722 - var EXITING = "exiting";
4723 - /**
4724 - * The Transition component lets you describe a transition from one component
4725 - * state to another _over time_ with a simple declarative API. Most commonly
4726 - * it's used to animate the mounting and unmounting of a component, but can also
4727 - * be used to describe in-place transition states as well.
4728 - *
4729 - * ---
4730 - *
4731 - * **Note**: `Transition` is a platform-agnostic base component. If you're using
4732 - * transitions in CSS, you'll probably want to use
4733 - * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition)
4734 - * instead. It inherits all the features of `Transition`, but contains
4735 - * additional features necessary to play nice with CSS transitions (hence the
4736 - * name of the component).
4737 - *
4738 - * ---
4739 - *
4740 - * By default the `Transition` component does not alter the behavior of the
4741 - * component it renders, it only tracks "enter" and "exit" states for the
4742 - * components. It's up to you to give meaning and effect to those states. For
4743 - * example we can add styles to a component when it enters or exits:
4744 - *
4745 - * ```jsx
4746 - * import { Transition } from 'react-transition-group';
4747 - *
4748 - * const duration = 300;
4749 - *
4750 - * const defaultStyle = {
4751 - * transition: `opacity ${duration}ms ease-in-out`,
4752 - * opacity: 0,
4753 - * }
4754 - *
4755 - * const transitionStyles = {
4756 - * entering: { opacity: 1 },
4757 - * entered: { opacity: 1 },
4758 - * exiting: { opacity: 0 },
4759 - * exited: { opacity: 0 },
4760 - * };
4761 - *
4762 - * const Fade = ({ in: inProp }) => (
4763 - * <Transition in={inProp} timeout={duration}>
4764 - * {state => (
4765 - * <div style={{
4766 - * ...defaultStyle,
4767 - * ...transitionStyles[state]
4768 - * }}>
4769 - * I'm a fade Transition!
4770 - * </div>
4771 - * )}
4772 - * </Transition>
4773 - * );
4774 - * ```
4775 - *
4776 - * There are 4 main states a Transition can be in:
4777 - * - `'entering'`
4778 - * - `'entered'`
4779 - * - `'exiting'`
4780 - * - `'exited'`
4781 - *
4782 - * Transition state is toggled via the `in` prop. When `true` the component
4783 - * begins the "Enter" stage. During this stage, the component will shift from
4784 - * its current transition state, to `'entering'` for the duration of the
4785 - * transition and then to the `'entered'` stage once it's complete. Let's take
4786 - * the following example (we'll use the
4787 - * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):
4788 - *
4789 - * ```jsx
4790 - * function App() {
4791 - * const [inProp, setInProp] = useState(false);
4792 - * return (
4793 - * <div>
4794 - * <Transition in={inProp} timeout={500}>
4795 - * {state => (
4796 - * // ...
4797 - * )}
4798 - * </Transition>
4799 - * <button onClick={() => setInProp(true)}>
4800 - * Click to Enter
4801 - * </button>
4802 - * </div>
4803 - * );
4804 - * }
4805 - * ```
4806 - *
4807 - * When the button is clicked the component will shift to the `'entering'` state
4808 - * and stay there for 500ms (the value of `timeout`) before it finally switches
4809 - * to `'entered'`.
4810 - *
4811 - * When `in` is `false` the same thing happens except the state moves from
4812 - * `'exiting'` to `'exited'`.
4813 - */
4814 - var Transition = /*#__PURE__*/ function(_React$Component) {
4815 - _inheritsLoose(Transition, _React$Component);
4816 - function Transition(props, context) {
4817 - var _this = _React$Component.call(this, props, context) || this;
4818 - var parentGroup = context;
4819 - var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
4820 - var initialStatus;
4821 - _this.appearStatus = null;
4822 - if (props.in) if (appear) {
4823 - initialStatus = EXITED;
4824 - _this.appearStatus = ENTERING;
4825 - } else initialStatus = ENTERED;
4826 - else if (props.unmountOnExit || props.mountOnEnter) initialStatus = UNMOUNTED;
4827 - else initialStatus = EXITED;
4828 - _this.state = { status: initialStatus };
4829 - _this.nextCallback = null;
4830 - return _this;
4831 - }
4832 - Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
4833 - if (_ref.in && prevState.status === "unmounted") return { status: EXITED };
4834 - return null;
4835 - };
4836 - var _proto = Transition.prototype;
4837 - _proto.componentDidMount = function componentDidMount() {
4838 - this.updateStatus(true, this.appearStatus);
4839 - };
4840 - _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
4841 - var nextStatus = null;
4842 - if (prevProps !== this.props) {
4843 - var status = this.state.status;
4844 - if (this.props.in) {
4845 - if (status !== "entering" && status !== "entered") nextStatus = ENTERING;
4846 - } else if (status === "entering" || status === "entered") nextStatus = EXITING;
4847 - }
4848 - this.updateStatus(false, nextStatus);
4849 - };
4850 - _proto.componentWillUnmount = function componentWillUnmount() {
4851 - this.cancelNextCallback();
4852 - };
4853 - _proto.getTimeouts = function getTimeouts() {
4854 - var timeout = this.props.timeout;
4855 - var exit = enter = appear = timeout;
4856 - var enter;
4857 - var appear;
4858 - if (timeout != null && typeof timeout !== "number") {
4859 - exit = timeout.exit;
4860 - enter = timeout.enter;
4861 - appear = timeout.appear !== void 0 ? timeout.appear : enter;
4862 - }
4863 - return {
4864 - exit,
4865 - enter,
4866 - appear
4867 - };
4868 - };
4869 - _proto.updateStatus = function updateStatus(mounting, nextStatus) {
4870 - if (mounting === void 0) mounting = false;
4871 - if (nextStatus !== null) {
4872 - this.cancelNextCallback();
4873 - if (nextStatus === "entering") {
4874 - if (this.props.unmountOnExit || this.props.mountOnEnter) {
4875 - var node = this.props.nodeRef ? this.props.nodeRef.current : react_dom.default.findDOMNode(this);
4876 - if (node) forceReflow(node);
4877 - }
4878 - this.performEnter(mounting);
4879 - } else this.performExit();
4880 - } else if (this.props.unmountOnExit && this.state.status === "exited") this.setState({ status: UNMOUNTED });
4881 - };
4882 - _proto.performEnter = function performEnter(mounting) {
4883 - var _this2 = this;
4884 - var enter = this.props.enter;
4885 - var appearing = this.context ? this.context.isMounting : mounting;
4886 - var _ref2 = this.props.nodeRef ? [appearing] : [react_dom.default.findDOMNode(this), appearing];
4887 - var maybeNode = _ref2[0];
4888 - var maybeAppearing = _ref2[1];
4889 - var timeouts = this.getTimeouts();
4890 - var enterTimeout = appearing ? timeouts.appear : timeouts.enter;
4891 - if (!mounting && !enter || config_default.disabled) {
4892 - this.safeSetState({ status: ENTERED }, function() {
4893 - _this2.props.onEntered(maybeNode);
4894 - });
4895 - return;
4896 - }
4897 - this.props.onEnter(maybeNode, maybeAppearing);
4898 - this.safeSetState({ status: ENTERING }, function() {
4899 - _this2.props.onEntering(maybeNode, maybeAppearing);
4900 - _this2.onTransitionEnd(enterTimeout, function() {
4901 - _this2.safeSetState({ status: ENTERED }, function() {
4902 - _this2.props.onEntered(maybeNode, maybeAppearing);
4903 - });
4904 - });
4905 - });
4906 - };
4907 - _proto.performExit = function performExit() {
4908 - var _this3 = this;
4909 - var exit = this.props.exit;
4910 - var timeouts = this.getTimeouts();
4911 - var maybeNode = this.props.nodeRef ? void 0 : react_dom.default.findDOMNode(this);
4912 - if (!exit || config_default.disabled) {
4913 - this.safeSetState({ status: EXITED }, function() {
4914 - _this3.props.onExited(maybeNode);
4915 - });
4916 - return;
4917 - }
4918 - this.props.onExit(maybeNode);
4919 - this.safeSetState({ status: EXITING }, function() {
4920 - _this3.props.onExiting(maybeNode);
4921 - _this3.onTransitionEnd(timeouts.exit, function() {
4922 - _this3.safeSetState({ status: EXITED }, function() {
4923 - _this3.props.onExited(maybeNode);
4924 - });
4925 - });
4926 - });
4927 - };
4928 - _proto.cancelNextCallback = function cancelNextCallback() {
4929 - if (this.nextCallback !== null) {
4930 - this.nextCallback.cancel();
4931 - this.nextCallback = null;
4932 - }
4933 - };
4934 - _proto.safeSetState = function safeSetState(nextState, callback) {
4935 - callback = this.setNextCallback(callback);
4936 - this.setState(nextState, callback);
4937 - };
4938 - _proto.setNextCallback = function setNextCallback(callback) {
4939 - var _this4 = this;
4940 - var active = true;
4941 - this.nextCallback = function(event) {
4942 - if (active) {
4943 - active = false;
4944 - _this4.nextCallback = null;
4945 - callback(event);
4946 - }
4947 - };
4948 - this.nextCallback.cancel = function() {
4949 - active = false;
4950 - };
4951 - return this.nextCallback;
4952 - };
4953 - _proto.onTransitionEnd = function onTransitionEnd(timeout, handler) {
4954 - this.setNextCallback(handler);
4955 - var node = this.props.nodeRef ? this.props.nodeRef.current : react_dom.default.findDOMNode(this);
4956 - var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
4957 - if (!node || doesNotHaveTimeoutOrListener) {
4958 - setTimeout(this.nextCallback, 0);
4959 - return;
4960 - }
4961 - if (this.props.addEndListener) {
4962 - var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback];
4963 - var maybeNode = _ref3[0];
4964 - var maybeNextCallback = _ref3[1];
4965 - this.props.addEndListener(maybeNode, maybeNextCallback);
4966 - }
4967 - if (timeout != null) setTimeout(this.nextCallback, timeout);
4968 - };
4969 - _proto.render = function render() {
4970 - var status = this.state.status;
4971 - if (status === "unmounted") return null;
4972 - var _this$props = this.props;
4973 - var children = _this$props.children;
4974 - _this$props.in;
4975 - _this$props.mountOnEnter;
4976 - _this$props.unmountOnExit;
4977 - _this$props.appear;
4978 - _this$props.enter;
4979 - _this$props.exit;
4980 - _this$props.timeout;
4981 - _this$props.addEndListener;
4982 - _this$props.onEnter;
4983 - _this$props.onEntering;
4984 - _this$props.onEntered;
4985 - _this$props.onExit;
4986 - _this$props.onExiting;
4987 - _this$props.onExited;
4988 - _this$props.nodeRef;
4989 - var childProps = _objectWithoutPropertiesLoose(_this$props, [
4990 - "children",
4991 - "in",
4992 - "mountOnEnter",
4993 - "unmountOnExit",
4994 - "appear",
4995 - "enter",
4996 - "exit",
4997 - "timeout",
4998 - "addEndListener",
4999 - "onEnter",
5000 - "onEntering",
5001 - "onEntered",
5002 - "onExit",
5003 - "onExiting",
5004 - "onExited",
5005 - "nodeRef"
5006 - ]);
5007 - return /*#__PURE__*/ react.default.createElement(TransitionGroupContext_default.Provider, { value: null }, typeof children === "function" ? children(status, childProps) : react.default.cloneElement(react.default.Children.only(children), childProps));
5008 - };
5009 - return Transition;
5010 - }(react.default.Component);
5011 - Transition.contextType = TransitionGroupContext_default;
5012 - Transition.propTypes = {
5013 - /**
5014 - * A React reference to DOM element that need to transition:
5015 - * https://stackoverflow.com/a/51127130/4671932
5016 - *
5017 - * - When `nodeRef` prop is used, `node` is not passed to callback functions
5018 - * (e.g. `onEnter`) because user already has direct access to the node.
5019 - * - When changing `key` prop of `Transition` in a `TransitionGroup` a new
5020 - * `nodeRef` need to be provided to `Transition` with changed `key` prop
5021 - * (see
5022 - * [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
5023 - */
5024 - nodeRef: import_prop_types.default.shape({ current: typeof Element === "undefined" ? import_prop_types.default.any : function(propValue, key, componentName, location, propFullName, secret) {
5025 - var value = propValue[key];
5026 - return import_prop_types.default.instanceOf(value && "ownerDocument" in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret);
5027 - } }),
5028 - /**
5029 - * A `function` child can be used instead of a React element. This function is
5030 - * called with the current transition status (`'entering'`, `'entered'`,
5031 - * `'exiting'`, `'exited'`), which can be used to apply context
5032 - * specific props to a component.
5033 - *
5034 - * ```jsx
5035 - * <Transition in={this.state.in} timeout={150}>
5036 - * {state => (
5037 - * <MyComponent className={`fade fade-${state}`} />
5038 - * )}
5039 - * </Transition>
5040 - * ```
5041 - */
5042 - children: import_prop_types.default.oneOfType([import_prop_types.default.func.isRequired, import_prop_types.default.element.isRequired]).isRequired,
5043 - /**
5044 - * Show the component; triggers the enter or exit states
5045 - */
5046 - in: import_prop_types.default.bool,
5047 - /**
5048 - * By default the child component is mounted immediately along with
5049 - * the parent `Transition` component. If you want to "lazy mount" the component on the
5050 - * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
5051 - * mounted, even on "exited", unless you also specify `unmountOnExit`.
5052 - */
5053 - mountOnEnter: import_prop_types.default.bool,
5054 - /**
5055 - * By default the child component stays mounted after it reaches the `'exited'` state.
5056 - * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
5057 - */
5058 - unmountOnExit: import_prop_types.default.bool,
5059 - /**
5060 - * By default the child component does not perform the enter transition when
5061 - * it first mounts, regardless of the value of `in`. If you want this
5062 - * behavior, set both `appear` and `in` to `true`.
5063 - *
5064 - * > **Note**: there are no special appear states like `appearing`/`appeared`, this prop
5065 - * > only adds an additional enter transition. However, in the
5066 - * > `<CSSTransition>` component that first enter transition does result in
5067 - * > additional `.appear-*` classes, that way you can choose to style it
5068 - * > differently.
5069 - */
5070 - appear: import_prop_types.default.bool,
5071 - /**
5072 - * Enable or disable enter transitions.
5073 - */
5074 - enter: import_prop_types.default.bool,
5075 - /**
5076 - * Enable or disable exit transitions.
5077 - */
5078 - exit: import_prop_types.default.bool,
5079 - /**
5080 - * The duration of the transition, in milliseconds.
5081 - * Required unless `addEndListener` is provided.
5082 - *
5083 - * You may specify a single timeout for all transitions:
5084 - *
5085 - * ```jsx
5086 - * timeout={500}
5087 - * ```
5088 - *
5089 - * or individually:
5090 - *
5091 - * ```jsx
5092 - * timeout={{
5093 - * appear: 500,
5094 - * enter: 300,
5095 - * exit: 500,
5096 - * }}
5097 - * ```
5098 - *
5099 - * - `appear` defaults to the value of `enter`
5100 - * - `enter` defaults to `0`
5101 - * - `exit` defaults to `0`
5102 - *
5103 - * @type {number | { enter?: number, exit?: number, appear?: number }}
5104 - */
5105 - timeout: function timeout(props) {
5106 - var pt = timeoutsShape;
5107 - if (!props.addEndListener) pt = pt.isRequired;
5108 - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key];
5109 - return pt.apply(void 0, [props].concat(args));
5110 - },
5111 - /**
5112 - * Add a custom transition end trigger. Called with the transitioning
5113 - * DOM node and a `done` callback. Allows for more fine grained transition end
5114 - * logic. Timeouts are still used as a fallback if provided.
5115 - *
5116 - * **Note**: when `nodeRef` prop is passed, `node` is not passed.
5117 - *
5118 - * ```jsx
5119 - * addEndListener={(node, done) => {
5120 - * // use the css transitionend event to mark the finish of a transition
5121 - * node.addEventListener('transitionend', done, false);
5122 - * }}
5123 - * ```
5124 - */
5125 - addEndListener: import_prop_types.default.func,
5126 - /**
5127 - * Callback fired before the "entering" status is applied. An extra parameter
5128 - * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
5129 - *
5130 - * **Note**: when `nodeRef` prop is passed, `node` is not passed.
5131 - *
5132 - * @type Function(node: HtmlElement, isAppearing: bool) -> void
5133 - */
5134 - onEnter: import_prop_types.default.func,
5135 - /**
5136 - * Callback fired after the "entering" status is applied. An extra parameter
5137 - * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
5138 - *
5139 - * **Note**: when `nodeRef` prop is passed, `node` is not passed.
5140 - *
5141 - * @type Function(node: HtmlElement, isAppearing: bool)
5142 - */
5143 - onEntering: import_prop_types.default.func,
5144 - /**
5145 - * Callback fired after the "entered" status is applied. An extra parameter
5146 - * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
5147 - *
5148 - * **Note**: when `nodeRef` prop is passed, `node` is not passed.
5149 - *
5150 - * @type Function(node: HtmlElement, isAppearing: bool) -> void
5151 - */
5152 - onEntered: import_prop_types.default.func,
5153 - /**
5154 - * Callback fired before the "exiting" status is applied.
5155 - *
5156 - * **Note**: when `nodeRef` prop is passed, `node` is not passed.
5157 - *
5158 - * @type Function(node: HtmlElement) -> void
5159 - */
5160 - onExit: import_prop_types.default.func,
5161 - /**
5162 - * Callback fired after the "exiting" status is applied.
5163 - *
5164 - * **Note**: when `nodeRef` prop is passed, `node` is not passed.
5165 - *
5166 - * @type Function(node: HtmlElement) -> void
5167 - */
5168 - onExiting: import_prop_types.default.func,
5169 - /**
5170 - * Callback fired after the "exited" status is applied.
5171 - *
5172 - * **Note**: when `nodeRef` prop is passed, `node` is not passed
5173 - *
5174 - * @type Function(node: HtmlElement) -> void
5175 - */
5176 - onExited: import_prop_types.default.func
5177 - };
5178 - function noop$1() {}
5179 - __name(noop$1, "noop");
5180 - Transition.defaultProps = {
5181 - in: false,
5182 - mountOnEnter: false,
5183 - unmountOnExit: false,
5184 - appear: false,
5185 - enter: true,
5186 - exit: true,
5187 - onEnter: noop$1,
5188 - onEntering: noop$1,
5189 - onEntered: noop$1,
5190 - onExit: noop$1,
5191 - onExiting: noop$1,
5192 - onExited: noop$1
5193 - };
5194 - Transition.UNMOUNTED = UNMOUNTED;
5195 - Transition.EXITED = EXITED;
5196 - Transition.ENTERING = ENTERING;
5197 - Transition.ENTERED = ENTERED;
5198 - Transition.EXITING = EXITING;
5199 -
5200 -//#endregion
5201 -//#region node_modules/react-transition-group/esm/CSSTransition.js
5202 - var _addClass = /* @__PURE__ */ __name(function addClass$1(node, classes) {
5203 - return node && classes && classes.split(" ").forEach(function(c) {
5204 - return addClass(node, c);
5205 - });
5206 - }, "addClass");
5207 - var removeClass = function removeClass(node, classes) {
5208 - return node && classes && classes.split(" ").forEach(function(c) {
5209 - return removeClass$1(node, c);
5210 - });
5211 - };
5212 - /**
5213 - * A transition component inspired by the excellent
5214 - * [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should
5215 - * use it if you're using CSS transitions or animations. It's built upon the
5216 - * [`Transition`](https://reactcommunity.org/react-transition-group/transition)
5217 - * component, so it inherits all of its props.
5218 - *
5219 - * `CSSTransition` applies a pair of class names during the `appear`, `enter`,
5220 - * and `exit` states of the transition. The first class is applied and then a
5221 - * second `*-active` class in order to activate the CSS transition. After the
5222 - * transition, matching `*-done` class names are applied to persist the
5223 - * transition state.
5224 - *
5225 - * ```jsx
5226 - * function App() {
5227 - * const [inProp, setInProp] = useState(false);
5228 - * return (
5229 - * <div>
5230 - * <CSSTransition in={inProp} timeout={200} classNames="my-node">
5231 - * <div>
5232 - * {"I'll receive my-node-* classes"}
5233 - * </div>
5234 - * </CSSTransition>
5235 - * <button type="button" onClick={() => setInProp(true)}>
5236 - * Click to Enter
5237 - * </button>
5238 - * </div>
5239 - * );
5240 - * }
5241 - * ```
5242 - *
5243 - * When the `in` prop is set to `true`, the child component will first receive
5244 - * the class `example-enter`, then the `example-enter-active` will be added in
5245 - * the next tick. `CSSTransition` [forces a
5246 - * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)
5247 - * between before adding the `example-enter-active`. This is an important trick
5248 - * because it allows us to transition between `example-enter` and
5249 - * `example-enter-active` even though they were added immediately one after
5250 - * another. Most notably, this is what makes it possible for us to animate
5251 - * _appearance_.
5252 - *
5253 - * ```css
5254 - * .my-node-enter {
5255 - * opacity: 0;
5256 - * }
5257 - * .my-node-enter-active {
5258 - * opacity: 1;
5259 - * transition: opacity 200ms;
5260 - * }
5261 - * .my-node-exit {
5262 - * opacity: 1;
5263 - * }
5264 - * .my-node-exit-active {
5265 - * opacity: 0;
5266 - * transition: opacity 200ms;
5267 - * }
5268 - * ```
5269 - *
5270 - * `*-active` classes represent which styles you want to animate **to**, so it's
5271 - * important to add `transition` declaration only to them, otherwise transitions
5272 - * might not behave as intended! This might not be obvious when the transitions
5273 - * are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in
5274 - * the example above (minus `transition`), but it becomes apparent in more
5275 - * complex transitions.
5276 - *
5277 - * **Note**: If you're using the
5278 - * [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear)
5279 - * prop, make sure to define styles for `.appear-*` classes as well.
5280 - */
5281 - var CSSTransition$1 = /*#__PURE__*/ function(_React$Component) {
5282 - _inheritsLoose(CSSTransition, _React$Component);
5283 - function CSSTransition() {
5284 - var _this;
5285 - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
5286 - _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
5287 - _this.appliedClasses = {
5288 - appear: {},
5289 - enter: {},
5290 - exit: {}
5291 - };
5292 - _this.onEnter = function(maybeNode, maybeAppearing) {
5293 - var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing);
5294 - var node = _this$resolveArgument[0];
5295 - var appearing = _this$resolveArgument[1];
5296 - _this.removeClasses(node, "exit");
5297 - _this.addClass(node, appearing ? "appear" : "enter", "base");
5298 - if (_this.props.onEnter) _this.props.onEnter(maybeNode, maybeAppearing);
5299 - };
5300 - _this.onEntering = function(maybeNode, maybeAppearing) {
5301 - var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing);
5302 - var node = _this$resolveArgument2[0];
5303 - var type = _this$resolveArgument2[1] ? "appear" : "enter";
5304 - _this.addClass(node, type, "active");
5305 - if (_this.props.onEntering) _this.props.onEntering(maybeNode, maybeAppearing);
5306 - };
5307 - _this.onEntered = function(maybeNode, maybeAppearing) {
5308 - var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing);
5309 - var node = _this$resolveArgument3[0];
5310 - var type = _this$resolveArgument3[1] ? "appear" : "enter";
5311 - _this.removeClasses(node, type);
5312 - _this.addClass(node, type, "done");
5313 - if (_this.props.onEntered) _this.props.onEntered(maybeNode, maybeAppearing);
5314 - };
5315 - _this.onExit = function(maybeNode) {
5316 - var node = _this.resolveArguments(maybeNode)[0];
5317 - _this.removeClasses(node, "appear");
5318 - _this.removeClasses(node, "enter");
5319 - _this.addClass(node, "exit", "base");
5320 - if (_this.props.onExit) _this.props.onExit(maybeNode);
5321 - };
5322 - _this.onExiting = function(maybeNode) {
5323 - var node = _this.resolveArguments(maybeNode)[0];
5324 - _this.addClass(node, "exit", "active");
5325 - if (_this.props.onExiting) _this.props.onExiting(maybeNode);
5326 - };
5327 - _this.onExited = function(maybeNode) {
5328 - var node = _this.resolveArguments(maybeNode)[0];
5329 - _this.removeClasses(node, "exit");
5330 - _this.addClass(node, "exit", "done");
5331 - if (_this.props.onExited) _this.props.onExited(maybeNode);
5332 - };
5333 - _this.resolveArguments = function(maybeNode, maybeAppearing) {
5334 - return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] : [maybeNode, maybeAppearing];
5335 - };
5336 - _this.getClassNames = function(type) {
5337 - var classNames = _this.props.classNames;
5338 - var isStringClassNames = typeof classNames === "string";
5339 - var prefix = isStringClassNames && classNames ? classNames + "-" : "";
5340 - var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type];
5341 - return {
5342 - baseClassName,
5343 - activeClassName: isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"],
5344 - doneClassName: isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"]
5345 - };
5346 - };
5347 - return _this;
5348 - }
5349 - var _proto = CSSTransition.prototype;
5350 - _proto.addClass = function addClass(node, type, phase) {
5351 - var className = this.getClassNames(type)[phase + "ClassName"];
5352 - var doneClassName = this.getClassNames("enter").doneClassName;
5353 - if (type === "appear" && phase === "done" && doneClassName) className += " " + doneClassName;
5354 - if (phase === "active") {
5355 - if (node) forceReflow(node);
5356 - }
5357 - if (className) {
5358 - this.appliedClasses[type][phase] = className;
5359 - _addClass(node, className);
5360 - }
5361 - };
5362 - _proto.removeClasses = function removeClasses(node, type) {
5363 - var _this$appliedClasses$ = this.appliedClasses[type];
5364 - var baseClassName = _this$appliedClasses$.base;
5365 - var activeClassName = _this$appliedClasses$.active;
5366 - var doneClassName = _this$appliedClasses$.done;
5367 - this.appliedClasses[type] = {};
5368 - if (baseClassName) removeClass(node, baseClassName);
5369 - if (activeClassName) removeClass(node, activeClassName);
5370 - if (doneClassName) removeClass(node, doneClassName);
5371 - };
5372 - _proto.render = function render() {
5373 - var _this$props = this.props;
5374 - _this$props.classNames;
5375 - var props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]);
5376 - return /*#__PURE__*/ react.default.createElement(Transition, _extends$3({}, props, {
5377 - onEnter: this.onEnter,
5378 - onEntered: this.onEntered,
5379 - onEntering: this.onEntering,
5380 - onExit: this.onExit,
5381 - onExiting: this.onExiting,
5382 - onExited: this.onExited
5383 - }));
5384 - };
5385 - return CSSTransition;
5386 - }(react.default.Component);
5387 - CSSTransition$1.defaultProps = { classNames: "" };
5388 - CSSTransition$1.propTypes = _extends$3({}, Transition.propTypes, {
5389 - /**
5390 - * The animation classNames applied to the component as it appears, enters,
5391 - * exits or has finished the transition. A single name can be provided, which
5392 - * will be suffixed for each stage, e.g. `classNames="fade"` applies:
5393 - *
5394 - * - `fade-appear`, `fade-appear-active`, `fade-appear-done`
5395 - * - `fade-enter`, `fade-enter-active`, `fade-enter-done`
5396 - * - `fade-exit`, `fade-exit-active`, `fade-exit-done`
5397 - *
5398 - * A few details to note about how these classes are applied:
5399 - *
5400 - * 1. They are _joined_ with the ones that are already defined on the child
5401 - * component, so if you want to add some base styles, you can use
5402 - * `className` without worrying that it will be overridden.
5403 - *
5404 - * 2. If the transition component mounts with `in={false}`, no classes are
5405 - * applied yet. You might be expecting `*-exit-done`, but if you think
5406 - * about it, a component cannot finish exiting if it hasn't entered yet.
5407 - *
5408 - * 2. `fade-appear-done` and `fade-enter-done` will _both_ be applied. This
5409 - * allows you to define different behavior for when appearing is done and
5410 - * when regular entering is done, using selectors like
5411 - * `.fade-enter-done:not(.fade-appear-done)`. For example, you could apply
5412 - * an epic entrance animation when element first appears in the DOM using
5413 - * [Animate.css](https://daneden.github.io/animate.css/). Otherwise you can
5414 - * simply use `fade-enter-done` for defining both cases.
5415 - *
5416 - * Each individual classNames can also be specified independently like:
5417 - *
5418 - * ```js
5419 - * classNames={{
5420 - * appear: 'my-appear',
5421 - * appearActive: 'my-active-appear',
5422 - * appearDone: 'my-done-appear',
5423 - * enter: 'my-enter',
5424 - * enterActive: 'my-active-enter',
5425 - * enterDone: 'my-done-enter',
5426 - * exit: 'my-exit',
5427 - * exitActive: 'my-active-exit',
5428 - * exitDone: 'my-done-exit',
5429 - * }}
5430 - * ```
5431 - *
5432 - * If you want to set these classes using CSS Modules:
5433 - *
5434 - * ```js
5435 - * import styles from './styles.css';
5436 - * ```
5437 - *
5438 - * you might want to use camelCase in your CSS file, that way could simply
5439 - * spread them instead of listing them one by one:
5440 - *
5441 - * ```js
5442 - * classNames={{ ...styles }}
5443 - * ```
5444 - *
5445 - * @type {string | {
5446 - * appear?: string,
5447 - * appearActive?: string,
5448 - * appearDone?: string,
5449 - * enter?: string,
5450 - * enterActive?: string,
5451 - * enterDone?: string,
5452 - * exit?: string,
5453 - * exitActive?: string,
5454 - * exitDone?: string,
5455 - * }}
5456 - */
5457 - classNames: classNamesShape,
5458 - /**
5459 - * A `<Transition>` callback fired immediately after the 'enter' or 'appear' class is
5460 - * applied.
5461 - *
5462 - * **Note**: when `nodeRef` prop is passed, `node` is not passed.
5463 - *
5464 - * @type Function(node: HtmlElement, isAppearing: bool)
5465 - */
5466 - onEnter: import_prop_types.default.func,
5467 - /**
5468 - * A `<Transition>` callback fired immediately after the 'enter-active' or
5469 - * 'appear-active' class is applied.
5470 - *
5471 - * **Note**: when `nodeRef` prop is passed, `node` is not passed.
5472 - *
5473 - * @type Function(node: HtmlElement, isAppearing: bool)
5474 - */
5475 - onEntering: import_prop_types.default.func,
5476 - /**
5477 - * A `<Transition>` callback fired immediately after the 'enter' or
5478 - * 'appear' classes are **removed** and the `done` class is added to the DOM node.
5479 - *
5480 - * **Note**: when `nodeRef` prop is passed, `node` is not passed.
5481 - *
5482 - * @type Function(node: HtmlElement, isAppearing: bool)
5483 - */
5484 - onEntered: import_prop_types.default.func,
5485 - /**
5486 - * A `<Transition>` callback fired immediately after the 'exit' class is
5487 - * applied.
5488 - *
5489 - * **Note**: when `nodeRef` prop is passed, `node` is not passed
5490 - *
5491 - * @type Function(node: HtmlElement)
5492 - */
5493 - onExit: import_prop_types.default.func,
5494 - /**
5495 - * A `<Transition>` callback fired immediately after the 'exit-active' is applied.
5496 - *
5497 - * **Note**: when `nodeRef` prop is passed, `node` is not passed
5498 - *
5499 - * @type Function(node: HtmlElement)
5500 - */
5501 - onExiting: import_prop_types.default.func,
5502 - /**
5503 - * A `<Transition>` callback fired immediately after the 'exit' classes
5504 - * are **removed** and the `exit-done` class is added to the DOM node.
5505 - *
5506 - * **Note**: when `nodeRef` prop is passed, `node` is not passed
5507 - *
5508 - * @type Function(node: HtmlElement)
5509 - */
5510 - onExited: import_prop_types.default.func
5511 - });
5512 -
5513 -//#endregion
5514 -//#region node_modules/primereact/csstransition/csstransition.esm.js
5515 - function _typeof$3(o) {
5516 - "@babel/helpers - typeof";
5517 - return _typeof$3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
5518 - return typeof o;
5519 - } : function(o) {
5520 - return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
5521 - }, _typeof$3(o);
5522 - }
5523 - __name(_typeof$3, "_typeof");
5524 - function toPrimitive$3(t, r) {
5525 - if ("object" != _typeof$3(t) || !t) return t;
5526 - var e = t[Symbol.toPrimitive];
5527 - if (void 0 !== e) {
5528 - var i = e.call(t, r || "default");
5529 - if ("object" != _typeof$3(i)) return i;
5530 - throw new TypeError("@@toPrimitive must return a primitive value.");
5531 - }
5532 - return ("string" === r ? String : Number)(t);
5533 - }
5534 - __name(toPrimitive$3, "toPrimitive");
5535 - function toPropertyKey$3(t) {
5536 - var i = toPrimitive$3(t, "string");
5537 - return "symbol" == _typeof$3(i) ? i : i + "";
5538 - }
5539 - __name(toPropertyKey$3, "toPropertyKey");
5540 - function _defineProperty$3(e, r, t) {
5541 - return (r = toPropertyKey$3(r)) in e ? Object.defineProperty(e, r, {
5542 - value: t,
5543 - enumerable: !0,
5544 - configurable: !0,
5545 - writable: !0
5546 - }) : e[r] = t, e;
5547 - }
5548 - __name(_defineProperty$3, "_defineProperty");
5549 - var CSSTransitionBase = {
5550 - defaultProps: {
5551 - __TYPE: "CSSTransition",
5552 - children: void 0
5553 - },
5554 - getProps: function getProps(props) {
5555 - return ObjectUtils.getMergedProps(props, CSSTransitionBase.defaultProps);
5556 - },
5557 - getOtherProps: function getOtherProps(props) {
5558 - return ObjectUtils.getDiffProps(props, CSSTransitionBase.defaultProps);
5559 - }
5560 - };
5561 - function ownKeys$4(e, r) {
5562 - var t = Object.keys(e);
5563 - if (Object.getOwnPropertySymbols) {
5564 - var o = Object.getOwnPropertySymbols(e);
5565 - r && (o = o.filter(function(r) {
5566 - return Object.getOwnPropertyDescriptor(e, r).enumerable;
5567 - })), t.push.apply(t, o);
5568 - }
5569 - return t;
5570 - }
5571 - __name(ownKeys$4, "ownKeys");
5572 - function _objectSpread$4(e) {
5573 - for (var r = 1; r < arguments.length; r++) {
5574 - var t = null != arguments[r] ? arguments[r] : {};
5575 - r % 2 ? ownKeys$4(Object(t), !0).forEach(function(r) {
5576 - _defineProperty$3(e, r, t[r]);
5577 - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function(r) {
5578 - Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
5579 - });
5580 - }
5581 - return e;
5582 - }
5583 - __name(_objectSpread$4, "_objectSpread");
5584 - var CSSTransition = /*#__PURE__*/ react.forwardRef(function(inProps, ref) {
5585 - var props = CSSTransitionBase.getProps(inProps);
5586 - var context = react.useContext(PrimeReactContext);
5587 - var disabled = props.disabled || props.options && props.options.disabled || context && !context.cssTransition || !PrimeReact.cssTransition;
5588 - var onEnter = function onEnter(node, isAppearing) {
5589 - props.onEnter && props.onEnter(node, isAppearing);
5590 - props.options && props.options.onEnter && props.options.onEnter(node, isAppearing);
5591 - };
5592 - var onEntering = function onEntering(node, isAppearing) {
5593 - props.onEntering && props.onEntering(node, isAppearing);
5594 - props.options && props.options.onEntering && props.options.onEntering(node, isAppearing);
5595 - };
5596 - var onEntered = function onEntered(node, isAppearing) {
5597 - props.onEntered && props.onEntered(node, isAppearing);
5598 - props.options && props.options.onEntered && props.options.onEntered(node, isAppearing);
5599 - };
5600 - var onExit = function onExit(node) {
5601 - props.onExit && props.onExit(node);
5602 - props.options && props.options.onExit && props.options.onExit(node);
5603 - };
5604 - var onExiting = function onExiting(node) {
5605 - props.onExiting && props.onExiting(node);
5606 - props.options && props.options.onExiting && props.options.onExiting(node);
5607 - };
5608 - var onExited = function onExited(node) {
5609 - props.onExited && props.onExited(node);
5610 - props.options && props.options.onExited && props.options.onExited(node);
5611 - };
5612 - useUpdateEffect(function() {
5613 - if (disabled) {
5614 - var node = ObjectUtils.getRefElement(props.nodeRef);
5615 - if (props["in"]) {
5616 - onEnter(node, true);
5617 - onEntering(node, true);
5618 - onEntered(node, true);
5619 - } else {
5620 - onExit(node);
5621 - onExiting(node);
5622 - onExited(node);
5623 - }
5624 - }
5625 - }, [props["in"]]);
5626 - if (disabled) return props["in"] ? props.children : null;
5627 - var immutableProps = {
5628 - nodeRef: props.nodeRef,
5629 - "in": props["in"],
5630 - appear: props.appear,
5631 - onEnter,
5632 - onEntering,
5633 - onEntered,
5634 - onExit,
5635 - onExiting,
5636 - onExited
5637 - };
5638 - var mergedProps = _objectSpread$4(_objectSpread$4(_objectSpread$4({}, {
5639 - classNames: props.classNames,
5640 - timeout: props.timeout,
5641 - unmountOnExit: props.unmountOnExit
5642 - }), props.options || {}), immutableProps);
5643 - return /*#__PURE__*/ react.createElement(CSSTransition$1, mergedProps, props.children);
5644 - });
5645 - CSSTransition.displayName = "CSSTransition";
5646 -
5647 -//#endregion
5648 -//#region node_modules/primereact/keyfilter/keyfilter.esm.js
5649 - function _arrayLikeToArray$4(r, a) {
5650 - (null == a || a > r.length) && (a = r.length);
5651 - for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
5652 - return n;
5653 - }
5654 - __name(_arrayLikeToArray$4, "_arrayLikeToArray");
5655 - function _arrayWithoutHoles$2(r) {
5656 - if (Array.isArray(r)) return _arrayLikeToArray$4(r);
5657 - }
5658 - __name(_arrayWithoutHoles$2, "_arrayWithoutHoles");
5659 - function _iterableToArray$2(r) {
5660 - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
5661 - }
5662 - __name(_iterableToArray$2, "_iterableToArray");
5663 - function _unsupportedIterableToArray$4(r, a) {
5664 - if (r) {
5665 - if ("string" == typeof r) return _arrayLikeToArray$4(r, a);
5666 - var t = {}.toString.call(r).slice(8, -1);
5667 - return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$4(r, a) : void 0;
5668 - }
5669 - }
5670 - __name(_unsupportedIterableToArray$4, "_unsupportedIterableToArray");
5671 - function _nonIterableSpread$2() {
5672 - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5673 - }
5674 - __name(_nonIterableSpread$2, "_nonIterableSpread");
5675 - function _toConsumableArray$2(r) {
5676 - return _arrayWithoutHoles$2(r) || _iterableToArray$2(r) || _unsupportedIterableToArray$4(r) || _nonIterableSpread$2();
5677 - }
5678 - __name(_toConsumableArray$2, "_toConsumableArray");
5679 - var KeyFilter = {
5680 - DEFAULT_MASKS: {
5681 - pint: /[\d]/,
5682 - "int": /[\d\-]/,
5683 - pnum: /[\d\.]/,
5684 - money: /[\d\.\s,]/,
5685 - num: /[\d\-\.]/,
5686 - hex: /[0-9a-f]/i,
5687 - email: /[a-z0-9_\.\-@]/i,
5688 - alpha: /[a-z_]/i,
5689 - alphanum: /[a-z0-9_]/i
5690 - },
5691 - getRegex: function getRegex(keyfilter) {
5692 - return KeyFilter.DEFAULT_MASKS[keyfilter] ? KeyFilter.DEFAULT_MASKS[keyfilter] : keyfilter;
5693 - },
5694 - onBeforeInput: function onBeforeInput(e, keyfilter, validateOnly) {
5695 - if (validateOnly || !DomHandler.isAndroid()) return;
5696 - this.validateKey(e, e.data, keyfilter);
5697 - },
5698 - onKeyPress: function onKeyPress(e, keyfilter, validateOnly) {
5699 - if (validateOnly || DomHandler.isAndroid()) return;
5700 - if (e.ctrlKey || e.altKey || e.metaKey) return;
5701 - this.validateKey(e, e.key, keyfilter);
5702 - },
5703 - onPaste: function onPaste(e, keyfilter, validateOnly) {
5704 - if (validateOnly) return;
5705 - var regex = this.getRegex(keyfilter);
5706 - _toConsumableArray$2(e.clipboardData.getData("text")).forEach(function(c) {
5707 - if (!regex.test(c)) {
5708 - e.preventDefault();
5709 - return false;
5710 - }
5711 - });
5712 - },
5713 - validateKey: function validateKey(e, key, keyfilter) {
5714 - if (key === null || key === void 0) return;
5715 - if (!(key.length <= 2)) return;
5716 - if (!this.getRegex(keyfilter).test(key)) e.preventDefault();
5717 - },
5718 - validate: function validate(e, keyfilter) {
5719 - var value = e.target.value;
5720 - var validatePattern = true;
5721 - var regex = this.getRegex(keyfilter);
5722 - if (value && !regex.test(value)) validatePattern = false;
5723 - return validatePattern;
5724 - }
5725 - };
5726 -
5727 -//#endregion
5728 -//#region node_modules/primereact/portal/portal.esm.js
5729 - function _arrayWithHoles$3(r) {
5730 - if (Array.isArray(r)) return r;
5731 - }
5732 - __name(_arrayWithHoles$3, "_arrayWithHoles");
5733 - function _iterableToArrayLimit$3(r, l) {
5734 - var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
5735 - if (null != t) {
5736 - var e;
5737 - var n;
5738 - var i;
5739 - var u;
5740 - var a = [];
5741 - var f = !0;
5742 - var o = !1;
5743 - try {
5744 - if (i = (t = t.call(r)).next, 0 === l) {
5745 - if (Object(t) !== t) return;
5746 - f = !1;
5747 - } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
5748 - } catch (r) {
5749 - o = !0, n = r;
5750 - } finally {
5751 - try {
5752 - if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
5753 - } finally {
5754 - if (o) throw n;
5755 - }
5756 - }
5757 - return a;
5758 - }
5759 - }
5760 - __name(_iterableToArrayLimit$3, "_iterableToArrayLimit");
5761 - function _arrayLikeToArray$3(r, a) {
5762 - (null == a || a > r.length) && (a = r.length);
5763 - for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
5764 - return n;
5765 - }
5766 - __name(_arrayLikeToArray$3, "_arrayLikeToArray");
5767 - function _unsupportedIterableToArray$3(r, a) {
5768 - if (r) {
5769 - if ("string" == typeof r) return _arrayLikeToArray$3(r, a);
5770 - var t = {}.toString.call(r).slice(8, -1);
5771 - return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$3(r, a) : void 0;
5772 - }
5773 - }
5774 - __name(_unsupportedIterableToArray$3, "_unsupportedIterableToArray");
5775 - function _nonIterableRest$3() {
5776 - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5777 - }
5778 - __name(_nonIterableRest$3, "_nonIterableRest");
5779 - function _slicedToArray$3(r, e) {
5780 - return _arrayWithHoles$3(r) || _iterableToArrayLimit$3(r, e) || _unsupportedIterableToArray$3(r, e) || _nonIterableRest$3();
5781 - }
5782 - __name(_slicedToArray$3, "_slicedToArray");
5783 - var PortalBase = {
5784 - defaultProps: {
5785 - __TYPE: "Portal",
5786 - element: null,
5787 - appendTo: null,
5788 - visible: false,
5789 - onMounted: null,
5790 - onUnmounted: null,
5791 - children: void 0
5792 - },
5793 - getProps: function getProps(props) {
5794 - return ObjectUtils.getMergedProps(props, PortalBase.defaultProps);
5795 - },
5796 - getOtherProps: function getOtherProps(props) {
5797 - return ObjectUtils.getDiffProps(props, PortalBase.defaultProps);
5798 - }
5799 - };
5800 - var Portal = /*#__PURE__*/ react.memo(function(inProps) {
5801 - var props = PortalBase.getProps(inProps);
5802 - var context = react.useContext(PrimeReactContext);
5803 - var _React$useState2 = _slicedToArray$3(react.useState(props.visible && DomHandler.isClient()), 2);
5804 - var mountedState = _React$useState2[0];
5805 - var setMountedState = _React$useState2[1];
5806 - useMountEffect(function() {
5807 - if (DomHandler.isClient() && !mountedState) {
5808 - setMountedState(true);
5809 - props.onMounted && props.onMounted();
5810 - }
5811 - });
5812 - useUpdateEffect(function() {
5813 - props.onMounted && props.onMounted();
5814 - }, [mountedState]);
5815 - useUnmountEffect(function() {
5816 - props.onUnmounted && props.onUnmounted();
5817 - });
5818 - var element = props.element || props.children;
5819 - if (element && mountedState) {
5820 - var appendTo = props.appendTo || context && context.appendTo || PrimeReact.appendTo;
5821 - if (ObjectUtils.isFunction(appendTo)) appendTo = appendTo();
5822 - if (!appendTo) appendTo = document.body;
5823 - return appendTo === "self" ? element : /*#__PURE__*/ react_dom.default.createPortal(element, appendTo);
5824 - }
5825 - return null;
5826 - });
5827 - Portal.displayName = "Portal";
5828 -
5829 -//#endregion
5830 -//#region node_modules/primereact/tooltip/tooltip.esm.js
5831 - function _extends$2() {
5832 - return _extends$2 = Object.assign ? Object.assign.bind() : function(n) {
5833 - for (var e = 1; e < arguments.length; e++) {
5834 - var t = arguments[e];
5835 - for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
5836 - }
5837 - return n;
5838 - }, _extends$2.apply(null, arguments);
5839 - }
5840 - __name(_extends$2, "_extends");
5841 - function _typeof$2(o) {
5842 - "@babel/helpers - typeof";
5843 - return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
5844 - return typeof o;
5845 - } : function(o) {
5846 - return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
5847 - }, _typeof$2(o);
5848 - }
5849 - __name(_typeof$2, "_typeof");
5850 - function toPrimitive$2(t, r) {
5851 - if ("object" != _typeof$2(t) || !t) return t;
5852 - var e = t[Symbol.toPrimitive];
5853 - if (void 0 !== e) {
5854 - var i = e.call(t, r || "default");
5855 - if ("object" != _typeof$2(i)) return i;
5856 - throw new TypeError("@@toPrimitive must return a primitive value.");
5857 - }
5858 - return ("string" === r ? String : Number)(t);
5859 - }
5860 - __name(toPrimitive$2, "toPrimitive");
5861 - function toPropertyKey$2(t) {
5862 - var i = toPrimitive$2(t, "string");
5863 - return "symbol" == _typeof$2(i) ? i : i + "";
5864 - }
5865 - __name(toPropertyKey$2, "toPropertyKey");
5866 - function _defineProperty$2(e, r, t) {
5867 - return (r = toPropertyKey$2(r)) in e ? Object.defineProperty(e, r, {
5868 - value: t,
5869 - enumerable: !0,
5870 - configurable: !0,
5871 - writable: !0
5872 - }) : e[r] = t, e;
5873 - }
5874 - __name(_defineProperty$2, "_defineProperty");
5875 - function _arrayLikeToArray$2(r, a) {
5876 - (null == a || a > r.length) && (a = r.length);
5877 - for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
5878 - return n;
5879 - }
5880 - __name(_arrayLikeToArray$2, "_arrayLikeToArray");
5881 - function _arrayWithoutHoles$1(r) {
5882 - if (Array.isArray(r)) return _arrayLikeToArray$2(r);
5883 - }
5884 - __name(_arrayWithoutHoles$1, "_arrayWithoutHoles");
5885 - function _iterableToArray$1(r) {
5886 - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
5887 - }
5888 - __name(_iterableToArray$1, "_iterableToArray");
5889 - function _unsupportedIterableToArray$2(r, a) {
5890 - if (r) {
5891 - if ("string" == typeof r) return _arrayLikeToArray$2(r, a);
5892 - var t = {}.toString.call(r).slice(8, -1);
5893 - return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0;
5894 - }
5895 - }
5896 - __name(_unsupportedIterableToArray$2, "_unsupportedIterableToArray");
5897 - function _nonIterableSpread$1() {
5898 - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5899 - }
5900 - __name(_nonIterableSpread$1, "_nonIterableSpread");
5901 - function _toConsumableArray$1(r) {
5902 - return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$2(r) || _nonIterableSpread$1();
5903 - }
5904 - __name(_toConsumableArray$1, "_toConsumableArray");
5905 - function _arrayWithHoles$2(r) {
5906 - if (Array.isArray(r)) return r;
5907 - }
5908 - __name(_arrayWithHoles$2, "_arrayWithHoles");
5909 - function _iterableToArrayLimit$2(r, l) {
5910 - var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
5911 - if (null != t) {
5912 - var e;
5913 - var n;
5914 - var i;
5915 - var u;
5916 - var a = [];
5917 - var f = !0;
5918 - var o = !1;
5919 - try {
5920 - if (i = (t = t.call(r)).next, 0 === l) {
5921 - if (Object(t) !== t) return;
5922 - f = !1;
5923 - } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
5924 - } catch (r) {
5925 - o = !0, n = r;
5926 - } finally {
5927 - try {
5928 - if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
5929 - } finally {
5930 - if (o) throw n;
5931 - }
5932 - }
5933 - return a;
5934 - }
5935 - }
5936 - __name(_iterableToArrayLimit$2, "_iterableToArrayLimit");
5937 - function _nonIterableRest$2() {
5938 - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5939 - }
5940 - __name(_nonIterableRest$2, "_nonIterableRest");
5941 - function _slicedToArray$2(r, e) {
5942 - return _arrayWithHoles$2(r) || _iterableToArrayLimit$2(r, e) || _unsupportedIterableToArray$2(r, e) || _nonIterableRest$2();
5943 - }
5944 - __name(_slicedToArray$2, "_slicedToArray");
5945 - var TooltipBase = ComponentBase.extend({
5946 - defaultProps: {
5947 - __TYPE: "Tooltip",
5948 - appendTo: null,
5949 - at: null,
5950 - autoHide: true,
5951 - autoZIndex: true,
5952 - baseZIndex: 0,
5953 - className: null,
5954 - closeOnEscape: false,
5955 - content: null,
5956 - disabled: false,
5957 - event: null,
5958 - hideDelay: 0,
5959 - hideEvent: "mouseleave",
5960 - id: null,
5961 - mouseTrack: false,
5962 - mouseTrackLeft: 5,
5963 - mouseTrackTop: 5,
5964 - my: null,
5965 - onBeforeHide: null,
5966 - onBeforeShow: null,
5967 - onHide: null,
5968 - onShow: null,
5969 - position: "right",
5970 - showDelay: 0,
5971 - showEvent: "mouseenter",
5972 - showOnDisabled: false,
5973 - style: null,
5974 - target: null,
5975 - updateDelay: 0,
5976 - children: void 0
5977 - },
5978 - css: {
5979 - classes: {
5980 - root: function root(_ref) {
5981 - var positionState = _ref.positionState;
5982 - var classNameState = _ref.classNameState;
5983 - return classNames("p-tooltip p-component", _defineProperty$2({}, "p-tooltip-".concat(positionState), true), classNameState);
5984 - },
5985 - arrow: "p-tooltip-arrow",
5986 - text: "p-tooltip-text"
5987 - },
5988 - styles: "\n@layer primereact {\n .p-tooltip {\n position: absolute;\n padding: .25em .5rem;\n /* #3687: Tooltip prevent scrollbar flickering */\n top: -9999px;\n left: -9999px;\n }\n \n .p-tooltip.p-tooltip-right,\n .p-tooltip.p-tooltip-left {\n padding: 0 .25rem;\n }\n \n .p-tooltip.p-tooltip-top,\n .p-tooltip.p-tooltip-bottom {\n padding:.25em 0;\n }\n \n .p-tooltip .p-tooltip-text {\n white-space: pre-line;\n word-break: break-word;\n }\n \n .p-tooltip-arrow {\n position: absolute;\n width: 0;\n height: 0;\n border-color: transparent;\n border-style: solid;\n }\n \n .p-tooltip-right .p-tooltip-arrow {\n top: 50%;\n left: 0;\n margin-top: -.25rem;\n border-width: .25em .25em .25em 0;\n }\n \n .p-tooltip-left .p-tooltip-arrow {\n top: 50%;\n right: 0;\n margin-top: -.25rem;\n border-width: .25em 0 .25em .25rem;\n }\n \n .p-tooltip.p-tooltip-top {\n padding: .25em 0;\n }\n \n .p-tooltip-top .p-tooltip-arrow {\n bottom: 0;\n left: 50%;\n margin-left: -.25rem;\n border-width: .25em .25em 0;\n }\n \n .p-tooltip-bottom .p-tooltip-arrow {\n top: 0;\n left: 50%;\n margin-left: -.25rem;\n border-width: 0 .25em .25rem;\n }\n\n .p-tooltip-target-wrapper {\n display: inline-flex;\n }\n}\n",
5989 - inlineStyles: { arrow: function arrow(_ref2) {
5990 - var context = _ref2.context;
5991 - return {
5992 - top: context.bottom ? "0" : context.right || context.left || !context.right && !context.left && !context.top && !context.bottom ? "50%" : null,
5993 - bottom: context.top ? "0" : null,
5994 - left: context.right || !context.right && !context.left && !context.top && !context.bottom ? "0" : context.top || context.bottom ? "50%" : null,
5995 - right: context.left ? "0" : null
5996 - };
5997 - } }
5998 - }
5999 - });
6000 - function ownKeys$3(e, r) {
6001 - var t = Object.keys(e);
6002 - if (Object.getOwnPropertySymbols) {
6003 - var o = Object.getOwnPropertySymbols(e);
6004 - r && (o = o.filter(function(r) {
6005 - return Object.getOwnPropertyDescriptor(e, r).enumerable;
6006 - })), t.push.apply(t, o);
6007 - }
6008 - return t;
6009 - }
6010 - __name(ownKeys$3, "ownKeys");
6011 - function _objectSpread$3(e) {
6012 - for (var r = 1; r < arguments.length; r++) {
6013 - var t = null != arguments[r] ? arguments[r] : {};
6014 - r % 2 ? ownKeys$3(Object(t), !0).forEach(function(r) {
6015 - _defineProperty$2(e, r, t[r]);
6016 - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function(r) {
6017 - Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
6018 - });
6019 - }
6020 - return e;
6021 - }
6022 - __name(_objectSpread$3, "_objectSpread");
6023 - var Tooltip$14 = /*#__PURE__*/ react.memo(/*#__PURE__*/ react.forwardRef(function(inProps, ref) {
6024 - var mergeProps = useMergeProps();
6025 - var context = react.useContext(PrimeReactContext);
6026 - var props = TooltipBase.getProps(inProps, context);
6027 - var _React$useState2 = _slicedToArray$2(react.useState(false), 2);
6028 - var visibleState = _React$useState2[0];
6029 - var setVisibleState = _React$useState2[1];
6030 - var _React$useState4 = _slicedToArray$2(react.useState(props.position || "right"), 2);
6031 - var positionState = _React$useState4[0];
6032 - var setPositionState = _React$useState4[1];
6033 - var _React$useState6 = _slicedToArray$2(react.useState(""), 2);
6034 - var classNameState = _React$useState6[0];
6035 - var setClassNameState = _React$useState6[1];
6036 - var _React$useState8 = _slicedToArray$2(react.useState(false), 2);
6037 - var multipleFocusEvents = _React$useState8[0];
6038 - var setMultipleFocusEvents = _React$useState8[1];
6039 - var isCloseOnEscape = visibleState && props.closeOnEscape;
6040 - var overlayDisplayOrder = useDisplayOrder("tooltip", isCloseOnEscape);
6041 - var metaData = {
6042 - props,
6043 - state: {
6044 - visible: visibleState,
6045 - position: positionState,
6046 - className: classNameState
6047 - },
6048 - context: {
6049 - right: positionState === "right",
6050 - left: positionState === "left",
6051 - top: positionState === "top",
6052 - bottom: positionState === "bottom"
6053 - }
6054 - };
6055 - var _TooltipBase$setMetaD = TooltipBase.setMetaData(metaData);
6056 - var ptm = _TooltipBase$setMetaD.ptm;
6057 - var cx = _TooltipBase$setMetaD.cx;
6058 - var sx = _TooltipBase$setMetaD.sx;
6059 - var isUnstyled = _TooltipBase$setMetaD.isUnstyled;
6060 - useHandleStyle(TooltipBase.css.styles, isUnstyled, { name: "tooltip" });
6061 - useGlobalOnEscapeKey({
6062 - callback: function callback() {
6063 - hide();
6064 - },
6065 - when: isCloseOnEscape,
6066 - priority: [ESC_KEY_HANDLING_PRIORITIES.TOOLTIP, overlayDisplayOrder]
6067 - });
6068 - var elementRef = react.useRef(null);
6069 - var textRef = react.useRef(null);
6070 - var currentTargetRef = react.useRef(null);
6071 - var containerSize = react.useRef(null);
6072 - var allowHide = react.useRef(true);
6073 - var timeouts = react.useRef({});
6074 - var currentMouseEvent = react.useRef(null);
6075 - var _useResizeListener2 = _slicedToArray$2(useResizeListener({ listener: function listener(event) {
6076 - !DomHandler.isTouchDevice() && hide(event);
6077 - } }), 2);
6078 - var bindWindowResizeListener = _useResizeListener2[0];
6079 - var unbindWindowResizeListener = _useResizeListener2[1];
6080 - var _useOverlayScrollList2 = _slicedToArray$2(useOverlayScrollListener({
6081 - target: currentTargetRef.current,
6082 - listener: function listener(event) {
6083 - hide(event);
6084 - },
6085 - when: visibleState
6086 - }), 2);
6087 - var bindOverlayScrollListener = _useOverlayScrollList2[0];
6088 - var unbindOverlayScrollListener = _useOverlayScrollList2[1];
6089 - var isTargetContentEmpty = function isTargetContentEmpty(target) {
6090 - return !(props.content || getTargetOption(target, "tooltip"));
6091 - };
6092 - var isContentEmpty = function isContentEmpty(target) {
6093 - return !(props.content || getTargetOption(target, "tooltip") || props.children);
6094 - };
6095 - var isMouseTrack = function isMouseTrack(target) {
6096 - return getTargetOption(target, "mousetrack") || props.mouseTrack;
6097 - };
6098 - var isDisabled = function isDisabled(target) {
6099 - return getTargetOption(target, "disabled") === "true" || hasTargetOption(target, "disabled") || props.disabled;
6100 - };
6101 - var isShowOnDisabled = function isShowOnDisabled(target) {
6102 - return getTargetOption(target, "showondisabled") || props.showOnDisabled;
6103 - };
6104 - var isAutoHide = function isAutoHide() {
6105 - return getTargetOption(currentTargetRef.current, "autohide") || props.autoHide;
6106 - };
6107 - var getTargetOption = function getTargetOption(target, option) {
6108 - return hasTargetOption(target, "data-pr-".concat(option)) ? target.getAttribute("data-pr-".concat(option)) : null;
6109 - };
6110 - var hasTargetOption = function hasTargetOption(target, option) {
6111 - return target && target.hasAttribute(option);
6112 - };
6113 - var getEvents = function getEvents(target) {
6114 - var showEvents = [getTargetOption(target, "showevent") || props.showEvent];
6115 - var hideEvents = [getTargetOption(target, "hideevent") || props.hideEvent];
6116 - if (isMouseTrack(target)) {
6117 - showEvents = ["mousemove"];
6118 - hideEvents = ["mouseleave"];
6119 - } else {
6120 - var event = getTargetOption(target, "event") || props.event;
6121 - if (event === "focus") {
6122 - showEvents = ["focus"];
6123 - hideEvents = ["blur"];
6124 - }
6125 - if (event === "both") {
6126 - showEvents = ["focus", "mouseenter"];
6127 - hideEvents = multipleFocusEvents ? ["blur"] : ["mouseleave", "blur"];
6128 - }
6129 - }
6130 - return {
6131 - showEvents,
6132 - hideEvents
6133 - };
6134 - };
6135 - var getPosition = function getPosition(target) {
6136 - return getTargetOption(target, "position") || positionState;
6137 - };
6138 - var getMouseTrackPosition = function getMouseTrackPosition(target) {
6139 - return {
6140 - top: getTargetOption(target, "mousetracktop") || props.mouseTrackTop,
6141 - left: getTargetOption(target, "mousetrackleft") || props.mouseTrackLeft
6142 - };
6143 - };
6144 - var updateText = function updateText(target, callback) {
6145 - if (textRef.current) {
6146 - var content = getTargetOption(target, "tooltip") || props.content;
6147 - if (content) {
6148 - textRef.current.innerHTML = "";
6149 - textRef.current.appendChild(document.createTextNode(content));
6150 - callback();
6151 - } else if (props.children) callback();
6152 - }
6153 - };
6154 - var updateTooltipState = function updateTooltipState(position) {
6155 - updateText(currentTargetRef.current, function() {
6156 - var _currentMouseEvent$cu = currentMouseEvent.current;
6157 - var x = _currentMouseEvent$cu.pageX;
6158 - var y = _currentMouseEvent$cu.pageY;
6159 - if (props.autoZIndex && !ZIndexUtils.get(elementRef.current)) ZIndexUtils.set("tooltip", elementRef.current, context && context.autoZIndex || PrimeReact.autoZIndex, props.baseZIndex || context && context.zIndex.tooltip || PrimeReact.zIndex.tooltip);
6160 - elementRef.current.style.left = "";
6161 - elementRef.current.style.top = "";
6162 - if (isAutoHide()) elementRef.current.style.pointerEvents = "none";
6163 - var mouseTrackCheck = isMouseTrack(currentTargetRef.current) || position === "mouse";
6164 - if (mouseTrackCheck && !containerSize.current || mouseTrackCheck) containerSize.current = {
6165 - width: DomHandler.getOuterWidth(elementRef.current),
6166 - height: DomHandler.getOuterHeight(elementRef.current)
6167 - };
6168 - align(currentTargetRef.current, {
6169 - x,
6170 - y
6171 - }, position);
6172 - });
6173 - };
6174 - var show = function show(e) {
6175 - if (e.type && e.type === "focus") setMultipleFocusEvents(true);
6176 - currentTargetRef.current = e.currentTarget;
6177 - var disabled = isDisabled(currentTargetRef.current);
6178 - if (isContentEmpty(isShowOnDisabled(currentTargetRef.current) && disabled ? currentTargetRef.current.firstChild : currentTargetRef.current) || disabled) return;
6179 - currentMouseEvent.current = e;
6180 - if (visibleState) applyDelay("updateDelay", updateTooltipState);
6181 - else if (sendCallback(props.onBeforeShow, {
6182 - originalEvent: e,
6183 - target: currentTargetRef.current
6184 - })) applyDelay("showDelay", function() {
6185 - setVisibleState(true);
6186 - sendCallback(props.onShow, {
6187 - originalEvent: e,
6188 - target: currentTargetRef.current
6189 - });
6190 - });
6191 - };
6192 - var hide = function hide(e) {
6193 - if (e && e.type === "blur") setMultipleFocusEvents(false);
6194 - clearTimeouts();
6195 - if (visibleState) {
6196 - if (sendCallback(props.onBeforeHide, {
6197 - originalEvent: e,
6198 - target: currentTargetRef.current
6199 - })) applyDelay("hideDelay", function() {
6200 - if (!isAutoHide() && allowHide.current === false) return;
6201 - ZIndexUtils.clear(elementRef.current);
6202 - DomHandler.removeClass(elementRef.current, "p-tooltip-active");
6203 - setVisibleState(false);
6204 - sendCallback(props.onHide, {
6205 - originalEvent: e,
6206 - target: currentTargetRef.current
6207 - });
6208 - });
6209 - } else if (!props.onBeforeHide && !getDelay("hideDelay")) setVisibleState(false);
6210 - };
6211 - var align = function align(target, coordinate, position) {
6212 - var left = 0;
6213 - var top = 0;
6214 - var currentPosition = position || positionState;
6215 - if ((isMouseTrack(target) || currentPosition == "mouse") && coordinate) {
6216 - var _containerSize = {
6217 - width: DomHandler.getOuterWidth(elementRef.current),
6218 - height: DomHandler.getOuterHeight(elementRef.current)
6219 - };
6220 - left = coordinate.x;
6221 - top = coordinate.y;
6222 - var _getMouseTrackPositio = getMouseTrackPosition(target);
6223 - var mouseTrackTop = _getMouseTrackPositio.top;
6224 - var mouseTrackLeft = _getMouseTrackPositio.left;
6225 - switch (currentPosition) {
6226 - case "left":
6227 - left = left - (_containerSize.width + mouseTrackLeft);
6228 - top = top - (_containerSize.height / 2 - mouseTrackTop);
6229 - break;
6230 - case "right":
6231 - case "mouse":
6232 - left = left + mouseTrackLeft;
6233 - top = top - (_containerSize.height / 2 - mouseTrackTop);
6234 - break;
6235 - case "top":
6236 - left = left - (_containerSize.width / 2 - mouseTrackLeft);
6237 - top = top - (_containerSize.height + mouseTrackTop);
6238 - break;
6239 - case "bottom":
6240 - left = left - (_containerSize.width / 2 - mouseTrackLeft);
6241 - top = top + mouseTrackTop;
6242 - break;
6243 - }
6244 - if (left <= 0 || containerSize.current.width > _containerSize.width) {
6245 - elementRef.current.style.left = "0px";
6246 - elementRef.current.style.right = window.innerWidth - _containerSize.width - left + "px";
6247 - } else {
6248 - elementRef.current.style.right = "";
6249 - elementRef.current.style.left = left + "px";
6250 - }
6251 - elementRef.current.style.top = top + "px";
6252 - DomHandler.addClass(elementRef.current, "p-tooltip-active");
6253 - } else {
6254 - var pos = DomHandler.findCollisionPosition(currentPosition);
6255 - var my = getTargetOption(target, "my") || props.my || pos.my;
6256 - var at = getTargetOption(target, "at") || props.at || pos.at;
6257 - elementRef.current.style.padding = "0px";
6258 - DomHandler.flipfitCollision(elementRef.current, target, my, at, function(calculatedPosition) {
6259 - var _calculatedPosition$a = calculatedPosition.at;
6260 - var atX = _calculatedPosition$a.x;
6261 - var atY = _calculatedPosition$a.y;
6262 - var myX = calculatedPosition.my.x;
6263 - var newPosition = props.at ? atX !== "center" && atX !== myX ? atX : atY : calculatedPosition.at["".concat(pos.axis)];
6264 - elementRef.current.style.padding = "";
6265 - setPositionState(newPosition);
6266 - updateContainerPosition(newPosition);
6267 - DomHandler.addClass(elementRef.current, "p-tooltip-active");
6268 - });
6269 - }
6270 - };
6271 - var updateContainerPosition = function updateContainerPosition(position) {
6272 - if (elementRef.current) {
6273 - var style = getComputedStyle(elementRef.current);
6274 - if (position === "left") elementRef.current.style.left = parseFloat(style.left) - parseFloat(style.paddingLeft) * 2 + "px";
6275 - else if (position === "top") elementRef.current.style.top = parseFloat(style.top) - parseFloat(style.paddingTop) * 2 + "px";
6276 - }
6277 - };
6278 - var _onMouseEnter = function onMouseEnter() {
6279 - if (!isAutoHide()) allowHide.current = false;
6280 - };
6281 - var _onMouseLeave = function onMouseLeave(e) {
6282 - if (!isAutoHide()) {
6283 - allowHide.current = true;
6284 - hide(e);
6285 - }
6286 - };
6287 - var bindTargetEvent = function bindTargetEvent(target) {
6288 - if (target) {
6289 - var _getEvents = getEvents(target);
6290 - var showEvents = _getEvents.showEvents;
6291 - var hideEvents = _getEvents.hideEvents;
6292 - var currentTarget = getTarget(target);
6293 - showEvents.forEach(function(event) {
6294 - return currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.addEventListener(event, show);
6295 - });
6296 - hideEvents.forEach(function(event) {
6297 - return currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.addEventListener(event, hide);
6298 - });
6299 - }
6300 - };
6301 - var unbindTargetEvent = function unbindTargetEvent(target) {
6302 - if (target) {
6303 - var _getEvents2 = getEvents(target);
6304 - var showEvents = _getEvents2.showEvents;
6305 - var hideEvents = _getEvents2.hideEvents;
6306 - var currentTarget = getTarget(target);
6307 - showEvents.forEach(function(event) {
6308 - return currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.removeEventListener(event, show);
6309 - });
6310 - hideEvents.forEach(function(event) {
6311 - return currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.removeEventListener(event, hide);
6312 - });
6313 - }
6314 - };
6315 - var getDelay = function getDelay(delayProp) {
6316 - return getTargetOption(currentTargetRef.current, delayProp.toLowerCase()) || props[delayProp];
6317 - };
6318 - var applyDelay = function applyDelay(delayProp, callback) {
6319 - clearTimeouts();
6320 - var delay = getDelay(delayProp);
6321 - delay ? timeouts.current["".concat(delayProp)] = setTimeout(function() {
6322 - return callback();
6323 - }, delay) : callback();
6324 - };
6325 - var sendCallback = function sendCallback(callback) {
6326 - if (callback) {
6327 - for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) params[_key - 1] = arguments[_key];
6328 - var result = callback.apply(void 0, params);
6329 - if (result === void 0) result = true;
6330 - return result;
6331 - }
6332 - return true;
6333 - };
6334 - var clearTimeouts = function clearTimeouts() {
6335 - Object.values(timeouts.current).forEach(function(t) {
6336 - return clearTimeout(t);
6337 - });
6338 - };
6339 - var getTarget = function getTarget(target) {
6340 - if (target) {
6341 - if (isShowOnDisabled(target)) {
6342 - if (!target.hasWrapper) {
6343 - var wrapper = document.createElement("div");
6344 - if (target.nodeName === "INPUT") DomHandler.addMultipleClasses(wrapper, "p-tooltip-target-wrapper p-inputwrapper");
6345 - else DomHandler.addClass(wrapper, "p-tooltip-target-wrapper");
6346 - target.parentNode.insertBefore(wrapper, target);
6347 - wrapper.appendChild(target);
6348 - target.hasWrapper = true;
6349 - return wrapper;
6350 - }
6351 - return target.parentElement;
6352 - } else if (target.hasWrapper) {
6353 - var _target$parentElement;
6354 - (_target$parentElement = target.parentElement).replaceWith.apply(_target$parentElement, _toConsumableArray$1(target.parentElement.childNodes));
6355 - delete target.hasWrapper;
6356 - }
6357 - return target;
6358 - }
6359 - return null;
6360 - };
6361 - var updateTargetEvents = function updateTargetEvents(target) {
6362 - unloadTargetEvents(target);
6363 - loadTargetEvents(target);
6364 - };
6365 - var loadTargetEvents = function loadTargetEvents(target) {
6366 - setTargetEventOperations(target || props.target, bindTargetEvent);
6367 - };
6368 - var unloadTargetEvents = function unloadTargetEvents(target) {
6369 - setTargetEventOperations(target || props.target, unbindTargetEvent);
6370 - };
6371 - var setTargetEventOperations = function setTargetEventOperations(target, operation) {
6372 - target = ObjectUtils.getRefElement(target);
6373 - if (target) if (DomHandler.isElement(target)) operation(target);
6374 - else {
6375 - var setEvent = function setEvent(target) {
6376 - DomHandler.find(document, target).forEach(function(el) {
6377 - operation(el);
6378 - });
6379 - };
6380 - if (target instanceof Array) target.forEach(function(t) {
6381 - setEvent(t);
6382 - });
6383 - else setEvent(target);
6384 - }
6385 - };
6386 - useMountEffect(function() {
6387 - if (visibleState && currentTargetRef.current && isDisabled(currentTargetRef.current)) hide();
6388 - });
6389 - useUpdateEffect(function() {
6390 - loadTargetEvents();
6391 - return function() {
6392 - unloadTargetEvents();
6393 - };
6394 - }, [
6395 - show,
6396 - hide,
6397 - props.target
6398 - ]);
6399 - useUpdateEffect(function() {
6400 - if (visibleState) {
6401 - var position = getPosition(currentTargetRef.current);
6402 - var classname = getTargetOption(currentTargetRef.current, "classname");
6403 - setPositionState(position);
6404 - setClassNameState(classname);
6405 - updateTooltipState(position);
6406 - bindWindowResizeListener();
6407 - bindOverlayScrollListener();
6408 - } else {
6409 - setPositionState(props.position || "right");
6410 - setClassNameState("");
6411 - currentTargetRef.current = null;
6412 - containerSize.current = null;
6413 - allowHide.current = true;
6414 - }
6415 - return function() {
6416 - unbindWindowResizeListener();
6417 - unbindOverlayScrollListener();
6418 - };
6419 - }, [visibleState]);
6420 - useUpdateEffect(function() {
6421 - var position = getPosition(currentTargetRef.current);
6422 - if (visibleState && position !== "mouse") applyDelay("updateDelay", function() {
6423 - updateText(currentTargetRef.current, function() {
6424 - align(currentTargetRef.current);
6425 - });
6426 - });
6427 - }, [props.content]);
6428 - useUnmountEffect(function() {
6429 - hide();
6430 - ZIndexUtils.clear(elementRef.current);
6431 - });
6432 - react.useImperativeHandle(ref, function() {
6433 - return {
6434 - props,
6435 - updateTargetEvents,
6436 - loadTargetEvents,
6437 - unloadTargetEvents,
6438 - show,
6439 - hide,
6440 - getElement: function getElement() {
6441 - return elementRef.current;
6442 - },
6443 - getTarget: function getTarget() {
6444 - return currentTargetRef.current;
6445 - }
6446 - };
6447 - });
6448 - var createElement = function createElement() {
6449 - var empty = isTargetContentEmpty(currentTargetRef.current);
6450 - var rootProps = mergeProps({
6451 - id: props.id,
6452 - className: classNames(props.className, cx("root", {
6453 - positionState,
6454 - classNameState
6455 - })),
6456 - style: props.style,
6457 - role: "tooltip",
6458 - "aria-hidden": visibleState,
6459 - onMouseEnter: function onMouseEnter(e) {
6460 - return _onMouseEnter();
6461 - },
6462 - onMouseLeave: function onMouseLeave(e) {
6463 - return _onMouseLeave(e);
6464 - }
6465 - }, TooltipBase.getOtherProps(props), ptm("root"));
6466 - var arrowProps = mergeProps({
6467 - className: cx("arrow"),
6468 - style: sx("arrow", _objectSpread$3({}, metaData))
6469 - }, ptm("arrow"));
6470 - var textProps = mergeProps({ className: cx("text") }, ptm("text"));
6471 - return /*#__PURE__*/ react.createElement("div", _extends$2({ ref: elementRef }, rootProps), /*#__PURE__*/ react.createElement("div", arrowProps), /*#__PURE__*/ react.createElement("div", _extends$2({ ref: textRef }, textProps), empty && props.children));
6472 - };
6473 - if (visibleState) {
6474 - var element = createElement();
6475 - return /*#__PURE__*/ react.createElement(Portal, {
6476 - element,
6477 - appendTo: props.appendTo,
6478 - visible: true
6479 - });
6480 - }
6481 - return null;
6482 - }));
6483 - Tooltip$14.displayName = "Tooltip";
6484 -
6485 -//#endregion
6486 -//#region node_modules/primereact/overlayservice/overlayservice.esm.js
6487 - var OverlayService = EventBus$1();
6488 -
6489 -//#endregion
6490 -//#region node_modules/primereact/ripple/ripple.esm.js
6491 - function _extends$1() {
6492 - return _extends$1 = Object.assign ? Object.assign.bind() : function(n) {
6493 - for (var e = 1; e < arguments.length; e++) {
6494 - var t = arguments[e];
6495 - for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
6496 - }
6497 - return n;
6498 - }, _extends$1.apply(null, arguments);
6499 - }
6500 - __name(_extends$1, "_extends");
6501 - function _typeof$1(o) {
6502 - "@babel/helpers - typeof";
6503 - return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
6504 - return typeof o;
6505 - } : function(o) {
6506 - return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
6507 - }, _typeof$1(o);
6508 - }
6509 - __name(_typeof$1, "_typeof");
6510 - function toPrimitive$1(t, r) {
6511 - if ("object" != _typeof$1(t) || !t) return t;
6512 - var e = t[Symbol.toPrimitive];
6513 - if (void 0 !== e) {
6514 - var i = e.call(t, r || "default");
6515 - if ("object" != _typeof$1(i)) return i;
6516 - throw new TypeError("@@toPrimitive must return a primitive value.");
6517 - }
6518 - return ("string" === r ? String : Number)(t);
6519 - }
6520 - __name(toPrimitive$1, "toPrimitive");
6521 - function toPropertyKey$1(t) {
6522 - var i = toPrimitive$1(t, "string");
6523 - return "symbol" == _typeof$1(i) ? i : i + "";
6524 - }
6525 - __name(toPropertyKey$1, "toPropertyKey");
6526 - function _defineProperty$1(e, r, t) {
6527 - return (r = toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
6528 - value: t,
6529 - enumerable: !0,
6530 - configurable: !0,
6531 - writable: !0
6532 - }) : e[r] = t, e;
6533 - }
6534 - __name(_defineProperty$1, "_defineProperty");
6535 - function _arrayWithHoles$1(r) {
6536 - if (Array.isArray(r)) return r;
6537 - }
6538 - __name(_arrayWithHoles$1, "_arrayWithHoles");
6539 - function _iterableToArrayLimit$1(r, l) {
6540 - var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
6541 - if (null != t) {
6542 - var e;
6543 - var n;
6544 - var i;
6545 - var u;
6546 - var a = [];
6547 - var f = !0;
6548 - var o = !1;
6549 - try {
6550 - if (i = (t = t.call(r)).next, 0 === l) {
6551 - if (Object(t) !== t) return;
6552 - f = !1;
6553 - } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
6554 - } catch (r) {
6555 - o = !0, n = r;
6556 - } finally {
6557 - try {
6558 - if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
6559 - } finally {
6560 - if (o) throw n;
6561 - }
6562 - }
6563 - return a;
6564 - }
6565 - }
6566 - __name(_iterableToArrayLimit$1, "_iterableToArrayLimit");
6567 - function _arrayLikeToArray$1(r, a) {
6568 - (null == a || a > r.length) && (a = r.length);
6569 - for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
6570 - return n;
6571 - }
6572 - __name(_arrayLikeToArray$1, "_arrayLikeToArray");
6573 - function _unsupportedIterableToArray$1(r, a) {
6574 - if (r) {
6575 - if ("string" == typeof r) return _arrayLikeToArray$1(r, a);
6576 - var t = {}.toString.call(r).slice(8, -1);
6577 - return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0;
6578 - }
6579 - }
6580 - __name(_unsupportedIterableToArray$1, "_unsupportedIterableToArray");
6581 - function _nonIterableRest$1() {
6582 - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6583 - }
6584 - __name(_nonIterableRest$1, "_nonIterableRest");
6585 - function _slicedToArray$1(r, e) {
6586 - return _arrayWithHoles$1(r) || _iterableToArrayLimit$1(r, e) || _unsupportedIterableToArray$1(r, e) || _nonIterableRest$1();
6587 - }
6588 - __name(_slicedToArray$1, "_slicedToArray");
6589 - var RippleBase = ComponentBase.extend({
6590 - defaultProps: {
6591 - __TYPE: "Ripple",
6592 - children: void 0
6593 - },
6594 - css: {
6595 - styles: "\n@layer primereact {\n .p-ripple {\n overflow: hidden;\n position: relative;\n }\n \n .p-ink {\n display: block;\n position: absolute;\n background: rgba(255, 255, 255, 0.5);\n border-radius: 100%;\n transform: scale(0);\n }\n \n .p-ink-active {\n animation: ripple 0.4s linear;\n }\n \n .p-ripple-disabled .p-ink {\n display: none;\n }\n}\n\n@keyframes ripple {\n 100% {\n opacity: 0;\n transform: scale(2.5);\n }\n}\n\n",
6596 - classes: { root: "p-ink" }
6597 - },
6598 - getProps: function getProps(props) {
6599 - return ObjectUtils.getMergedProps(props, RippleBase.defaultProps);
6600 - },
6601 - getOtherProps: function getOtherProps(props) {
6602 - return ObjectUtils.getDiffProps(props, RippleBase.defaultProps);
6603 - }
6604 - });
6605 - function ownKeys$2(e, r) {
6606 - var t = Object.keys(e);
6607 - if (Object.getOwnPropertySymbols) {
6608 - var o = Object.getOwnPropertySymbols(e);
6609 - r && (o = o.filter(function(r) {
6610 - return Object.getOwnPropertyDescriptor(e, r).enumerable;
6611 - })), t.push.apply(t, o);
6612 - }
6613 - return t;
6614 - }
6615 - __name(ownKeys$2, "ownKeys");
6616 - function _objectSpread$2(e) {
6617 - for (var r = 1; r < arguments.length; r++) {
6618 - var t = null != arguments[r] ? arguments[r] : {};
6619 - r % 2 ? ownKeys$2(Object(t), !0).forEach(function(r) {
6620 - _defineProperty$1(e, r, t[r]);
6621 - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function(r) {
6622 - Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
6623 - });
6624 - }
6625 - return e;
6626 - }
6627 - __name(_objectSpread$2, "_objectSpread");
6628 - var Ripple = /*#__PURE__*/ react.memo(/*#__PURE__*/ react.forwardRef(function(inProps, ref) {
6629 - var _React$useState2 = _slicedToArray$1(react.useState(false), 2);
6630 - var isMounted = _React$useState2[0];
6631 - var setMounted = _React$useState2[1];
6632 - var inkRef = react.useRef(null);
6633 - var targetRef = react.useRef(null);
6634 - var mergeProps = useMergeProps();
6635 - var context = react.useContext(PrimeReactContext);
6636 - var props = RippleBase.getProps(inProps, context);
6637 - var isRippleActive = context && context.ripple || PrimeReact.ripple;
6638 - var metaData = { props };
6639 - useStyle(RippleBase.css.styles, {
6640 - name: "ripple",
6641 - manual: !isRippleActive
6642 - });
6643 - var _RippleBase$setMetaDa = RippleBase.setMetaData(_objectSpread$2({}, metaData));
6644 - var ptm = _RippleBase$setMetaDa.ptm;
6645 - var cx = _RippleBase$setMetaDa.cx;
6646 - var getTarget = function getTarget() {
6647 - return inkRef.current && inkRef.current.parentElement;
6648 - };
6649 - var bindEvents = function bindEvents() {
6650 - if (targetRef.current) targetRef.current.addEventListener("pointerdown", onPointerDown);
6651 - };
6652 - var unbindEvents = function unbindEvents() {
6653 - if (targetRef.current) targetRef.current.removeEventListener("pointerdown", onPointerDown);
6654 - };
6655 - var onPointerDown = function onPointerDown(event) {
6656 - var offset = DomHandler.getOffset(targetRef.current);
6657 - activateRipple(event.pageX - offset.left + document.body.scrollTop - DomHandler.getWidth(inkRef.current) / 2, event.pageY - offset.top + document.body.scrollLeft - DomHandler.getHeight(inkRef.current) / 2);
6658 - };
6659 - var activateRipple = function activateRipple(offsetX, offsetY) {
6660 - if (!inkRef.current || getComputedStyle(inkRef.current, null).display === "none") return;
6661 - DomHandler.removeClass(inkRef.current, "p-ink-active");
6662 - setDimensions();
6663 - inkRef.current.style.top = offsetY + "px";
6664 - inkRef.current.style.left = offsetX + "px";
6665 - DomHandler.addClass(inkRef.current, "p-ink-active");
6666 - };
6667 - var onAnimationEnd = function onAnimationEnd(event) {
6668 - DomHandler.removeClass(event.currentTarget, "p-ink-active");
6669 - };
6670 - var setDimensions = function setDimensions() {
6671 - if (inkRef.current && !DomHandler.getHeight(inkRef.current) && !DomHandler.getWidth(inkRef.current)) {
6672 - var d = Math.max(DomHandler.getOuterWidth(targetRef.current), DomHandler.getOuterHeight(targetRef.current));
6673 - inkRef.current.style.height = d + "px";
6674 - inkRef.current.style.width = d + "px";
6675 - }
6676 - };
6677 - react.useImperativeHandle(ref, function() {
6678 - return {
6679 - props,
6680 - getInk: function getInk() {
6681 - return inkRef.current;
6682 - },
6683 - getTarget: function getTarget() {
6684 - return targetRef.current;
6685 - }
6686 - };
6687 - });
6688 - useMountEffect(function() {
6689 - setMounted(true);
6690 - });
6691 - useUpdateEffect(function() {
6692 - if (isMounted && inkRef.current) {
6693 - targetRef.current = getTarget();
6694 - setDimensions();
6695 - bindEvents();
6696 - }
6697 - }, [isMounted]);
6698 - useUpdateEffect(function() {
6699 - if (inkRef.current && !targetRef.current) {
6700 - targetRef.current = getTarget();
6701 - setDimensions();
6702 - bindEvents();
6703 - }
6704 - });
6705 - useUnmountEffect(function() {
6706 - if (inkRef.current) {
6707 - targetRef.current = null;
6708 - unbindEvents();
6709 - }
6710 - });
6711 - if (!isRippleActive) return null;
6712 - var rootProps = mergeProps({
6713 - "aria-hidden": true,
6714 - className: classNames(cx("root"))
6715 - }, RippleBase.getOtherProps(props), ptm("root"));
6716 - return /*#__PURE__*/ react.createElement("span", _extends$1({
6717 - role: "presentation",
6718 - ref: inkRef
6719 - }, rootProps, { onAnimationEnd }));
6720 - }));
6721 - Ripple.displayName = "Ripple";
6722 -
6723 -//#endregion
6724 -//#region node_modules/primereact/mention/mention.esm.js
6725 - function _extends() {
6726 - return _extends = Object.assign ? Object.assign.bind() : function(n) {
6727 - for (var e = 1; e < arguments.length; e++) {
6728 - var t = arguments[e];
6729 - for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
6730 - }
6731 - return n;
6732 - }, _extends.apply(null, arguments);
6733 - }
6734 - function _arrayLikeToArray(r, a) {
6735 - (null == a || a > r.length) && (a = r.length);
6736 - for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
6737 - return n;
6738 - }
6739 - function _arrayWithoutHoles(r) {
6740 - if (Array.isArray(r)) return _arrayLikeToArray(r);
6741 - }
6742 - function _iterableToArray(r) {
6743 - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
6744 - }
6745 - function _unsupportedIterableToArray(r, a) {
6746 - if (r) {
6747 - if ("string" == typeof r) return _arrayLikeToArray(r, a);
6748 - var t = {}.toString.call(r).slice(8, -1);
6749 - return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
6750 - }
6751 - }
6752 - function _nonIterableSpread() {
6753 - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6754 - }
6755 - function _toConsumableArray(r) {
6756 - return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
6757 - }
6758 - function _typeof(o) {
6759 - "@babel/helpers - typeof";
6760 - return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
6761 - return typeof o;
6762 - } : function(o) {
6763 - return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
6764 - }, _typeof(o);
6765 - }
6766 - function toPrimitive(t, r) {
6767 - if ("object" != _typeof(t) || !t) return t;
6768 - var e = t[Symbol.toPrimitive];
6769 - if (void 0 !== e) {
6770 - var i = e.call(t, r || "default");
6771 - if ("object" != _typeof(i)) return i;
6772 - throw new TypeError("@@toPrimitive must return a primitive value.");
6773 - }
6774 - return ("string" === r ? String : Number)(t);
6775 - }
6776 - function toPropertyKey(t) {
6777 - var i = toPrimitive(t, "string");
6778 - return "symbol" == _typeof(i) ? i : i + "";
6779 - }
6780 - function _defineProperty(e, r, t) {
6781 - return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
6782 - value: t,
6783 - enumerable: !0,
6784 - configurable: !0,
6785 - writable: !0
6786 - }) : e[r] = t, e;
6787 - }
6788 - function _arrayWithHoles(r) {
6789 - if (Array.isArray(r)) return r;
6790 - }
6791 - function _iterableToArrayLimit(r, l) {
6792 - var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
6793 - if (null != t) {
6794 - var e;
6795 - var n;
6796 - var i;
6797 - var u;
6798 - var a = [];
6799 - var f = !0;
6800 - var o = !1;
6801 - try {
6802 - if (i = (t = t.call(r)).next, 0 === l) {
6803 - if (Object(t) !== t) return;
6804 - f = !1;
6805 - } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
6806 - } catch (r) {
6807 - o = !0, n = r;
6808 - } finally {
6809 - try {
6810 - if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
6811 - } finally {
6812 - if (o) throw n;
6813 - }
6814 - }
6815 - return a;
6816 - }
6817 - }
6818 - function _nonIterableRest() {
6819 - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6820 - }
6821 - function _slicedToArray(r, e) {
6822 - return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
6823 - }
6824 - var InputTextareaBase = ComponentBase.extend({
6825 - defaultProps: {
6826 - __TYPE: "InputTextarea",
6827 - __parentMetadata: null,
6828 - autoResize: false,
6829 - invalid: false,
6830 - variant: null,
6831 - keyfilter: null,
6832 - onBlur: null,
6833 - onFocus: null,
6834 - onBeforeInput: null,
6835 - onInput: null,
6836 - onKeyDown: null,
6837 - onKeyUp: null,
6838 - onPaste: null,
6839 - tooltip: null,
6840 - tooltipOptions: null,
6841 - validateOnly: false,
6842 - children: void 0,
6843 - className: null
6844 - },
6845 - css: {
6846 - classes: { root: function root(_ref) {
6847 - var props = _ref.props;
6848 - var context = _ref.context;
6849 - var isFilled = _ref.isFilled;
6850 - return classNames("p-inputtextarea p-inputtext p-component", {
6851 - "p-disabled": props.disabled,
6852 - "p-filled": isFilled,
6853 - "p-inputtextarea-resizable": props.autoResize,
6854 - "p-invalid": props.invalid,
6855 - "p-variant-filled": props.variant ? props.variant === "filled" : context && context.inputStyle === "filled"
6856 - });
6857 - } },
6858 - styles: "\n@layer primereact {\n .p-inputtextarea-resizable {\n overflow: hidden;\n resize: none;\n }\n \n .p-fluid .p-inputtextarea {\n width: 100%;\n }\n}\n"
6859 - }
6860 - });
6861 - function ownKeys$1(e, r) {
6862 - var t = Object.keys(e);
6863 - if (Object.getOwnPropertySymbols) {
6864 - var o = Object.getOwnPropertySymbols(e);
6865 - r && (o = o.filter(function(r) {
6866 - return Object.getOwnPropertyDescriptor(e, r).enumerable;
6867 - })), t.push.apply(t, o);
6868 - }
6869 - return t;
6870 - }
6871 - function _objectSpread$1(e) {
6872 - for (var r = 1; r < arguments.length; r++) {
6873 - var t = null != arguments[r] ? arguments[r] : {};
6874 - r % 2 ? ownKeys$1(Object(t), !0).forEach(function(r) {
6875 - _defineProperty(e, r, t[r]);
6876 - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r) {
6877 - Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
6878 - });
6879 - }
6880 - return e;
6881 - }
6882 - var InputTextarea = /*#__PURE__*/ react.memo(/*#__PURE__*/ react.forwardRef(function(inProps, ref) {
6883 - var mergeProps = useMergeProps();
6884 - var context = react.useContext(PrimeReactContext);
6885 - var props = InputTextareaBase.getProps(inProps, context);
6886 - var elementRef = react.useRef(ref);
6887 - var cachedScrollHeight = react.useRef(0);
6888 - var _InputTextareaBase$se = InputTextareaBase.setMetaData(_objectSpread$1(_objectSpread$1({ props }, props.__parentMetadata), {}, { context: { disabled: props.disabled } }));
6889 - var ptm = _InputTextareaBase$se.ptm;
6890 - var cx = _InputTextareaBase$se.cx;
6891 - var isUnstyled = _InputTextareaBase$se.isUnstyled;
6892 - useHandleStyle(InputTextareaBase.css.styles, isUnstyled, { name: "inputtextarea" });
6893 - var onFocus = function onFocus(event) {
6894 - if (props.autoResize) resize();
6895 - props.onFocus && props.onFocus(event);
6896 - };
6897 - var onBlur = function onBlur(event) {
6898 - if (props.autoResize) resize();
6899 - props.onBlur && props.onBlur(event);
6900 - };
6901 - var onKeyUp = function onKeyUp(event) {
6902 - if (props.autoResize) resize();
6903 - props.onKeyUp && props.onKeyUp(event);
6904 - };
6905 - var onKeyDown = function onKeyDown(event) {
6906 - props.onKeyDown && props.onKeyDown(event);
6907 - if (props.keyfilter) KeyFilter.onKeyPress(event, props.keyfilter, props.validateOnly);
6908 - };
6909 - var onBeforeInput = function onBeforeInput(event) {
6910 - props.onBeforeInput && props.onBeforeInput(event);
6911 - if (props.keyfilter) KeyFilter.onBeforeInput(event, props.keyfilter, props.validateOnly);
6912 - };
6913 - var onPaste = function onPaste(event) {
6914 - props.onPaste && props.onPaste(event);
6915 - if (props.keyfilter) KeyFilter.onPaste(event, props.keyfilter, props.validateOnly);
6916 - };
6917 - var onInput = function onInput(event) {
6918 - var target = event.target;
6919 - if (props.autoResize) resize(ObjectUtils.isEmpty(target.value));
6920 - props.onInput && props.onInput(event);
6921 - ObjectUtils.isNotEmpty(target.value) ? DomHandler.addClass(target, "p-filled") : DomHandler.removeClass(target, "p-filled");
6922 - };
6923 - var resize = function resize(initial) {
6924 - var inputEl = elementRef.current;
6925 - if (inputEl && isVisible()) {
6926 - if (!cachedScrollHeight.current) {
6927 - cachedScrollHeight.current = inputEl.scrollHeight;
6928 - inputEl.style.overflow = "hidden";
6929 - }
6930 - if (cachedScrollHeight.current !== inputEl.scrollHeight || initial) {
6931 - inputEl.style.height = "";
6932 - inputEl.style.height = inputEl.scrollHeight + "px";
6933 - if (parseFloat(inputEl.style.height) >= parseFloat(inputEl.style.maxHeight)) {
6934 - inputEl.style.overflowY = "scroll";
6935 - inputEl.style.height = inputEl.style.maxHeight;
6936 - } else inputEl.style.overflow = "hidden";
6937 - cachedScrollHeight.current = inputEl.scrollHeight;
6938 - }
6939 - }
6940 - };
6941 - var isVisible = function isVisible() {
6942 - if (DomHandler.isVisible(elementRef.current)) {
6943 - var rect = elementRef.current.getBoundingClientRect();
6944 - return rect.width > 0 && rect.height > 0;
6945 - }
6946 - return false;
6947 - };
6948 - react.useEffect(function() {
6949 - ObjectUtils.combinedRefs(elementRef, ref);
6950 - }, [elementRef, ref]);
6951 - react.useEffect(function() {
6952 - if (props.autoResize) resize(true);
6953 - }, [props.autoResize, props.value]);
6954 - var isFilled = react.useMemo(function() {
6955 - return ObjectUtils.isNotEmpty(props.value) || ObjectUtils.isNotEmpty(props.defaultValue);
6956 - }, [props.value, props.defaultValue]);
6957 - var hasTooltip = ObjectUtils.isNotEmpty(props.tooltip);
6958 - var rootProps = mergeProps({
6959 - ref: elementRef,
6960 - className: classNames(props.className, cx("root", {
6961 - context,
6962 - isFilled
6963 - })),
6964 - onFocus,
6965 - onBlur,
6966 - onKeyUp,
6967 - onKeyDown,
6968 - onBeforeInput,
6969 - onInput,
6970 - onPaste
6971 - }, InputTextareaBase.getOtherProps(props), ptm("root"));
6972 - return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement("textarea", rootProps), hasTooltip && /*#__PURE__*/ react.createElement(Tooltip$14, _extends({
6973 - target: elementRef,
6974 - content: props.tooltip,
6975 - pt: ptm("tooltip")
6976 - }, props.tooltipOptions)));
6977 - }));
6978 - InputTextarea.displayName = "InputTextarea";
6979 - var MentionBase = ComponentBase.extend({
6980 - defaultProps: {
6981 - __TYPE: "Mention",
6982 - autoHighlight: true,
6983 - autoResize: false,
6984 - className: null,
6985 - delay: 0,
6986 - field: null,
6987 - footerTemplate: null,
6988 - headerTemplate: null,
6989 - id: null,
6990 - inputClassName: null,
6991 - inputId: null,
6992 - inputRef: null,
6993 - inputStyle: null,
6994 - itemTemplate: null,
6995 - onBlur: null,
6996 - onChange: null,
6997 - onFocus: null,
6998 - onHide: null,
6999 - onInput: null,
7000 - onSearch: null,
7001 - onSelect: null,
7002 - onShow: null,
7003 - panelClassName: null,
7004 - panelStyle: null,
7005 - scrollHeight: "200px",
7006 - style: null,
7007 - suggestions: null,
7008 - transitionOptions: null,
7009 - trigger: "@",
7010 - variant: null,
7011 - children: void 0
7012 - },
7013 - css: {
7014 - classes: {
7015 - item: function item(_ref) {
7016 - var isSelected = _ref.isSelected;
7017 - return classNames("p-mention-item", { "p-highlight": isSelected });
7018 - },
7019 - items: "p-mention-items",
7020 - panel: function panel(_ref2) {
7021 - var props = _ref2.props;
7022 - return classNames("p-mention-panel p-component", props.panelClassName);
7023 - },
7024 - input: function input(_ref3) {
7025 - var props = _ref3.props;
7026 - return classNames("p-mention-input", props.inputClassName);
7027 - },
7028 - root: function root(_ref4) {
7029 - _ref4.props;
7030 - var isFilled = _ref4.isFilled;
7031 - var focusedState = _ref4.focusedState;
7032 - return classNames("p-mention p-component p-inputwrapper", {
7033 - "p-inputwrapper-filled": isFilled,
7034 - "p-inputwrapper-focus": focusedState
7035 - });
7036 - },
7037 - transition: "p-connected-overlay"
7038 - },
7039 - styles: "\n@layer primereact {\n .p-mention {\n display: inline-flex;\n position: relative;\n }\n \n .p-autocomplete-loader {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n }\n \n .p-mention .p-mention-panel {\n min-width: 100%;\n }\n \n .p-mention-panel {\n position: absolute;\n top: 0;\n left: 0;\n overflow: auto;\n }\n \n .p-mention-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n }\n \n .p-mention-item {\n cursor: pointer;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n }\n \n .p-fluid .p-mention {\n display: flex;\n }\n}\n"
7040 - }
7041 - });
7042 - function ownKeys(e, r) {
7043 - var t = Object.keys(e);
7044 - if (Object.getOwnPropertySymbols) {
7045 - var o = Object.getOwnPropertySymbols(e);
7046 - r && (o = o.filter(function(r) {
7047 - return Object.getOwnPropertyDescriptor(e, r).enumerable;
7048 - })), t.push.apply(t, o);
7049 - }
7050 - return t;
7051 - }
7052 - function _objectSpread(e) {
7053 - for (var r = 1; r < arguments.length; r++) {
7054 - var t = null != arguments[r] ? arguments[r] : {};
7055 - r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
7056 - _defineProperty(e, r, t[r]);
7057 - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
7058 - Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
7059 - });
7060 - }
7061 - return e;
7062 - }
7063 - var Mention = /*#__PURE__*/ react.memo(/*#__PURE__*/ react.forwardRef(function(inProps, ref) {
7064 - var mergeProps = useMergeProps();
7065 - var context = react.useContext(PrimeReactContext);
7066 - var props = MentionBase.getProps(inProps, context);
7067 - var _React$useState2 = _slicedToArray(react.useState(false), 2);
7068 - var overlayVisibleState = _React$useState2[0];
7069 - var setOverlayVisibleState = _React$useState2[1];
7070 - var _React$useState4 = _slicedToArray(react.useState(false), 2);
7071 - var focusedState = _React$useState4[0];
7072 - var setFocusedState = _React$useState4[1];
7073 - var _React$useState6 = _slicedToArray(react.useState(false), 2);
7074 - var searchingState = _React$useState6[0];
7075 - var setSearchingState = _React$useState6[1];
7076 - var _React$useState8 = _slicedToArray(react.useState(null), 2);
7077 - var triggerState = _React$useState8[0];
7078 - var setTriggerState = _React$useState8[1];
7079 - var _React$useState10 = _slicedToArray(react.useState([]), 2);
7080 - var highlightState = _React$useState10[0];
7081 - var setHighlightState = _React$useState10[1];
7082 - var elementRef = react.useRef(null);
7083 - var overlayRef = react.useRef(null);
7084 - var inputRef = react.useRef(props.inputRef);
7085 - var listRef = react.useRef(null);
7086 - var timeout = react.useRef(null);
7087 - var metaData = {
7088 - props,
7089 - state: {
7090 - overlayVisible: overlayVisibleState,
7091 - focused: focusedState,
7092 - searching: searchingState,
7093 - trigger: triggerState
7094 - }
7095 - };
7096 - var _MentionBase$setMetaD = MentionBase.setMetaData(metaData);
7097 - var ptm = _MentionBase$setMetaD.ptm;
7098 - var cx = _MentionBase$setMetaD.cx;
7099 - _MentionBase$setMetaD.sx;
7100 - var isUnstyled = _MentionBase$setMetaD.isUnstyled;
7101 - useHandleStyle(MentionBase.css.styles, isUnstyled, { name: "mention" });
7102 - var getPTOptions = function getPTOptions(item, suggestion, options) {
7103 - return ptm(suggestion, {
7104 - context: { trigger: triggerState ? triggerState.key : "" },
7105 - state: _objectSpread({}, options)
7106 - });
7107 - };
7108 - var _useOverlayListener2 = _slicedToArray(useOverlayListener({
7109 - target: elementRef,
7110 - overlay: overlayRef,
7111 - listener: function listener(event, _ref) {
7112 - var valid = _ref.valid;
7113 - var type = _ref.type;
7114 - if (valid) {
7115 - if (context.hideOverlaysOnDocumentScrolling || type === "outside") hide();
7116 - else if (!DomHandler.isDocument(event.target)) alignOverlay();
7117 - }
7118 - },
7119 - when: overlayVisibleState
7120 - }), 2);
7121 - var bindOverlayListener = _useOverlayListener2[0];
7122 - var unbindOverlayListener = _useOverlayListener2[1];
7123 - var show = function show() {
7124 - setOverlayVisibleState(true);
7125 - };
7126 - var hide = function hide() {
7127 - setOverlayVisibleState(false);
7128 - setSearchingState(false);
7129 - setTriggerState(null);
7130 - };
7131 - var onOverlayEnter = function onOverlayEnter() {
7132 - ZIndexUtils.set("overlay", overlayRef.current, context && context.autoZIndex || PrimeReact.autoZIndex, context && context.zIndex.overlay || PrimeReact.zIndex.overlay);
7133 - DomHandler.addStyles(overlayRef.current, {
7134 - position: "absolute",
7135 - top: "0",
7136 - left: "0"
7137 - });
7138 - alignOverlay();
7139 - };
7140 - var onOverlayEntering = function onOverlayEntering() {
7141 - if (props.autoHighlight && props.suggestions && props.suggestions.length) setHighlightState(function(prevState) {
7142 - var newState = _toConsumableArray(prevState);
7143 - newState[0] = true;
7144 - return newState;
7145 - });
7146 - };
7147 - var onOverlayEntered = function onOverlayEntered() {
7148 - bindOverlayListener();
7149 - props.onShow && props.onShow();
7150 - };
7151 - var onOverlayExit = function onOverlayExit() {
7152 - unbindOverlayListener();
7153 - };
7154 - var onOverlayExited = function onOverlayExited() {
7155 - ZIndexUtils.clear(overlayRef.current);
7156 - props.onHide && props.onHide();
7157 - };
7158 - var alignOverlay = function alignOverlay() {
7159 - if (triggerState) {
7160 - var key = triggerState.key;
7161 - var index = triggerState.index;
7162 - var value = inputRef.current.value;
7163 - var position = DomHandler.getCursorOffset(inputRef.current, value.substring(0, index - 1), value.substring(index), key);
7164 - overlayRef.current.style.transformOrigin = "top";
7165 - overlayRef.current.style.left = "calc(".concat(position.left, "px + 1rem)");
7166 - overlayRef.current.style.top = "calc(".concat(position.top, "px + 1.2rem)");
7167 - }
7168 - };
7169 - var onPanelClick = function onPanelClick(event) {
7170 - OverlayService.emit("overlay-click", {
7171 - originalEvent: event,
7172 - target: elementRef.current
7173 - });
7174 - };
7175 - var getTrigger = function getTrigger(value, key, start) {
7176 - if (!triggerState) {
7177 - var triggerKey = Array.isArray(props.trigger) ? props.trigger.find(function(t) {
7178 - return t === key;
7179 - }) : props.trigger === key ? props.trigger : null;
7180 - if (triggerKey) return {
7181 - key: triggerKey,
7182 - index: start
7183 - };
7184 - var latestSpaceIndex = value.substring(0, start).lastIndexOf(" ");
7185 - var latestTrigger = getLatestTrigger(value, start);
7186 - if (latestTrigger.index > latestSpaceIndex) return latestTrigger;
7187 - }
7188 - return triggerState;
7189 - };
7190 - var getLatestTrigger = function getLatestTrigger(value, start) {
7191 - if (Array.isArray(props.trigger)) {
7192 - var latestTrigger = {};
7193 - props.trigger.forEach(function(t) {
7194 - var index = value.substring(0, start).lastIndexOf(t);
7195 - if (index !== -1 && (index > latestTrigger.index || !latestTrigger.index)) latestTrigger = {
7196 - key: t,
7197 - index: index !== -1 ? index + 1 : -1
7198 - };
7199 - });
7200 - return latestTrigger;
7201 - }
7202 - var index = value.substring(0, start).lastIndexOf(props.trigger);
7203 - return {
7204 - key: props.trigger,
7205 - index: index !== -1 ? index + 1 : -1
7206 - };
7207 - };
7208 - var onSearch = function onSearch(event) {
7209 - if (timeout.current) clearTimeout(timeout.current);
7210 - var _event$target = event.target;
7211 - var value = _event$target.value;
7212 - var selectionStart = _event$target.selectionStart;
7213 - var key = value.substring(selectionStart - 1, selectionStart);
7214 - if (key === " ") {
7215 - hide();
7216 - return;
7217 - }
7218 - var currentTrigger = getTrigger(value, key, selectionStart);
7219 - if (currentTrigger && currentTrigger.index > -1) {
7220 - var query = value.substring(currentTrigger.index, selectionStart);
7221 - timeout.current = setTimeout(function() {
7222 - search(event, query, currentTrigger);
7223 - }, props.delay);
7224 - }
7225 - };
7226 - var search = function search(event, query, trigger) {
7227 - if (props.onSearch) {
7228 - setSearchingState(true);
7229 - setTriggerState(trigger);
7230 - props.onSearch({
7231 - originalEvent: event,
7232 - trigger: trigger.key,
7233 - query
7234 - });
7235 - }
7236 - };
7237 - var selectItem = function selectItem(event, suggestion) {
7238 - var input = inputRef.current;
7239 - var value = input.value;
7240 - var selectionStart = input.selectionStart;
7241 - var spaceIndex = value.indexOf(" ", triggerState.index);
7242 - var currentText = value.substring(triggerState.index, spaceIndex > -1 ? spaceIndex : selectionStart);
7243 - var selectedText = formatValue(suggestion).replace(/\s+/g, "");
7244 - if (currentText.trim() !== selectedText) {
7245 - var prevText = value.substring(0, triggerState.index);
7246 - var nextText = value.substring(spaceIndex > -1 ? selectionStart : triggerState.index + currentText.length);
7247 - inputRef.current.value = nextText[0] === " " ? "".concat(prevText).concat(selectedText).concat(nextText) : "".concat(prevText).concat(selectedText, " ").concat(nextText);
7248 - event.target = inputRef.current;
7249 - props.onChange && props.onChange(event);
7250 - }
7251 - var cursorStart = triggerState.index + selectedText.length + 1;
7252 - inputRef.current.setSelectionRange(cursorStart, cursorStart);
7253 - hide();
7254 - props.onSelect && props.onSelect({
7255 - originalEvent: event,
7256 - suggestion
7257 - });
7258 - };
7259 - var formatValue = function formatValue(value) {
7260 - if (value) {
7261 - var field = Array.isArray(props.field) ? props.field[props.trigger.findIndex(function(f) {
7262 - return f === triggerState.key;
7263 - })] : props.field;
7264 - return field ? ObjectUtils.resolveFieldData(value, field) : value;
7265 - }
7266 - return "";
7267 - };
7268 - var onItemClick = function onItemClick(event, suggestion) {
7269 - DomHandler.focus(inputRef.current);
7270 - selectItem(event, suggestion);
7271 - };
7272 - var onFocus = function onFocus(event) {
7273 - setFocusedState(true);
7274 - props.onFocus && props.onFocus(event);
7275 - };
7276 - var onBlur = function onBlur(event) {
7277 - setFocusedState(false);
7278 - props.onBlur && props.onBlur(event);
7279 - };
7280 - var onInput = function onInput(event) {
7281 - props.onInput && props.onInput(event);
7282 - var isFilled = event.target.value.length > 0;
7283 - if (isUnstyled()) DomHandler.setAttributes(elementRef.current, { "data-p-inputwrapper-filled": isFilled });
7284 - else if (isFilled) DomHandler.addClass(elementRef.current, "p-inputwrapper-filled");
7285 - else DomHandler.removeClass(elementRef.current, "p-inputwrapper-filled");
7286 - };
7287 - var onKeyUp = function onKeyUp(event) {
7288 - if (event.which === 37 || event.which === 39) onSearch(event);
7289 - };
7290 - var onChange = function onChange(event) {
7291 - props.onChange && props.onChange(event);
7292 - onSearch(event);
7293 - };
7294 - var onKeyDown = function onKeyDown(event) {
7295 - if (overlayVisibleState) {
7296 - var highlightItem = DomHandler.findSingle(overlayRef.current, "li[data-p-highlight=\"true\"]");
7297 - switch (event.which) {
7298 - case 40:
7299 - if (highlightItem) {
7300 - var nextElement = highlightItem.nextElementSibling;
7301 - if (nextElement) {
7302 - var nextElementIndex = DomHandler.index(nextElement);
7303 - var highlightItemIndex = DomHandler.index(highlightItem);
7304 - setHighlightState(function(prevState) {
7305 - var newState = _toConsumableArray(prevState);
7306 - newState[nextElementIndex] = true;
7307 - newState[highlightItemIndex] = false;
7308 - return newState;
7309 - });
7310 - DomHandler.scrollInView(overlayRef.current, nextElement);
7311 - }
7312 - } else {
7313 - highlightItem = DomHandler.findSingle(overlayRef.current, "li");
7314 - if (highlightItem) {
7315 - var _highlightItemIndex = DomHandler.index(highlightItem);
7316 - setHighlightState(function(prevState) {
7317 - var newState = _toConsumableArray(prevState);
7318 - newState[_highlightItemIndex] = true;
7319 - return newState;
7320 - });
7321 - }
7322 - }
7323 - event.preventDefault();
7324 - break;
7325 - case 38:
7326 - if (highlightItem) {
7327 - var previousElement = highlightItem.previousElementSibling;
7328 - if (previousElement) {
7329 - var previousElementIndex = DomHandler.index(previousElement);
7330 - var _highlightItemIndex2 = DomHandler.index(highlightItem);
7331 - setHighlightState(function(prevState) {
7332 - var newState = _toConsumableArray(prevState);
7333 - newState[previousElementIndex] = true;
7334 - newState[_highlightItemIndex2] = false;
7335 - return newState;
7336 - });
7337 - DomHandler.scrollInView(overlayRef.current, previousElement);
7338 - }
7339 - }
7340 - event.preventDefault();
7341 - break;
7342 - case 8:
7343 - var _event$target2 = event.target;
7344 - var value = _event$target2.value;
7345 - var selectionStart = _event$target2.selectionStart;
7346 - if (value.substring(selectionStart - 1, selectionStart) === triggerState.key) hide();
7347 - break;
7348 - case 13:
7349 - if (highlightItem) selectItem(event, props.suggestions[DomHandler.index(highlightItem)]);
7350 - event.preventDefault();
7351 - break;
7352 - case 27:
7353 - hide();
7354 - event.preventDefault();
7355 - break;
7356 - }
7357 - }
7358 - };
7359 - var currentValue = inputRef.current && inputRef.current.value;
7360 - var isFilled = react.useMemo(function() {
7361 - return ObjectUtils.isNotEmpty(props.value) || ObjectUtils.isNotEmpty(props.defaultValue) || ObjectUtils.isNotEmpty(currentValue);
7362 - }, [
7363 - props.value,
7364 - props.defaultValue,
7365 - currentValue
7366 - ]);
7367 - react.useImperativeHandle(ref, function() {
7368 - return {
7369 - props,
7370 - show,
7371 - hide,
7372 - focus: function focus() {
7373 - return DomHandler.focus(inputRef.current);
7374 - },
7375 - getElement: function getElement() {
7376 - return elementRef.current;
7377 - },
7378 - getOverlay: function getOverlay() {
7379 - return overlayRef.current;
7380 - },
7381 - getInput: function getInput() {
7382 - return inputRef.current;
7383 - }
7384 - };
7385 - });
7386 - react.useEffect(function() {
7387 - ObjectUtils.combinedRefs(inputRef, props.inputRef);
7388 - }, [inputRef, props.inputRef]);
7389 - useUpdateEffect(function() {
7390 - var hasSuggestions = props.suggestions && props.suggestions.length;
7391 - if (hasSuggestions) setHighlightState(props.suggestions.map(function() {
7392 - return false;
7393 - }));
7394 - if (searchingState) {
7395 - hasSuggestions ? show() : hide();
7396 - overlayVisibleState && alignOverlay();
7397 - setSearchingState(false);
7398 - }
7399 - }, [props.suggestions]);
7400 - useUpdateEffect(function() {
7401 - var _isUnstyled = isUnstyled();
7402 - var isInputWrapperFilled = _isUnstyled ? DomHandler.isAttributeEquals(elementRef.current, "data-p-inputwrapper-filled", true) : DomHandler.hasClass(elementRef.current, "p-inputwrapper-filled");
7403 - if (!isFilled && isInputWrapperFilled) _isUnstyled ? DomHandler.setAttributes(elementRef.current, { "data-p-inputwrapper-filled": false }) : DomHandler.removeClass(elementRef.current, "p-inputwrapper-filled");
7404 - }, [isFilled]);
7405 - useUnmountEffect(function() {
7406 - ZIndexUtils.clear(overlayRef.current);
7407 - });
7408 - var createItem = function createItem(suggestion, index) {
7409 - var key = index + "_item";
7410 - var content = props.itemTemplate ? ObjectUtils.getJSXElement(props.itemTemplate, suggestion, {
7411 - trigger: triggerState ? triggerState.key : "",
7412 - index
7413 - }) : formatValue(suggestion);
7414 - var isSelected = highlightState[index];
7415 - var itemProps = mergeProps({
7416 - className: cx("item", { isSelected }),
7417 - onClick: function onClick(e) {
7418 - return onItemClick(e, suggestion);
7419 - },
7420 - "data-p-highlight": isSelected
7421 - }, getPTOptions(suggestion, "item", { selected: isSelected }));
7422 - return /*#__PURE__*/ react.createElement("li", _extends({}, itemProps, { key }), content, /*#__PURE__*/ react.createElement(Ripple, null));
7423 - };
7424 - var createList = function createList() {
7425 - var itemsProps = mergeProps({
7426 - ref: listRef,
7427 - className: cx("items")
7428 - }, ptm("items"));
7429 - if (props.suggestions) {
7430 - var items = props.suggestions.map(createItem);
7431 - return /*#__PURE__*/ react.createElement("ul", itemsProps, items);
7432 - }
7433 - return null;
7434 - };
7435 - var createPanel = function createPanel() {
7436 - var header = ObjectUtils.getJSXElement(props.headerTemplate, props);
7437 - var footer = ObjectUtils.getJSXElement(props.footerTemplate, props);
7438 - var list = createList();
7439 - var panelProps = mergeProps({
7440 - ref: overlayRef,
7441 - className: cx("panel"),
7442 - style: _objectSpread({ maxHeight: props.scrollHeight }, props.panelStyle),
7443 - onClick: onPanelClick
7444 - }, ptm("panel"));
7445 - var transitionProps = mergeProps({
7446 - classNames: cx("transition"),
7447 - "in": overlayVisibleState,
7448 - timeout: {
7449 - enter: 120,
7450 - exit: 100
7451 - },
7452 - options: props.transitionOptions,
7453 - unmountOnExit: true,
7454 - onEnter: onOverlayEnter,
7455 - onEntering: onOverlayEntering,
7456 - onEntered: onOverlayEntered,
7457 - onExit: onOverlayExit,
7458 - onExited: onOverlayExited
7459 - }, ptm("transition"));
7460 - var panel = /*#__PURE__*/ react.createElement(CSSTransition, _extends({ nodeRef: overlayRef }, transitionProps), /*#__PURE__*/ react.createElement("div", panelProps, header, list, footer));
7461 - return /*#__PURE__*/ react.createElement(Portal, {
7462 - element: panel,
7463 - appendTo: "self"
7464 - });
7465 - };
7466 - var inputProps = MentionBase.getOtherProps(props);
7467 - var panel = createPanel();
7468 - var inputMentionProps = mergeProps(_objectSpread(_objectSpread({
7469 - ref: inputRef,
7470 - id: props.inputId,
7471 - className: cx("input"),
7472 - style: props.inputStyle
7473 - }, inputProps), {}, {
7474 - unstyled: props.unstyled,
7475 - variant: props.variant,
7476 - autoResize: props.autoResize,
7477 - onFocus,
7478 - onBlur,
7479 - onKeyDown,
7480 - onInput,
7481 - onKeyUp,
7482 - onChange,
7483 - __parentMetadata: { parent: metaData }
7484 - }), ptm("input"));
7485 - var rootProps = mergeProps({
7486 - ref: elementRef,
7487 - id: props.id,
7488 - className: classNames(props.className, cx("root", {
7489 - focusedState,
7490 - isFilled
7491 - })),
7492 - style: props.style
7493 - }, MentionBase.getOtherProps(props), ptm("root"));
7494 - return /*#__PURE__*/ react.createElement("div", rootProps, /*#__PURE__*/ react.createElement(InputTextarea, inputMentionProps), panel);
7495 - }));
7496 - Mention.displayName = "Mention";
7497 -
7498 -//#endregion
7499 -//#region packages/packages/libs/editor-controls/src/controls/mention-text-area-control.tsx
7500 - var MentionWrapper = (0, _elementor_ui.styled)("div")(({ theme }) => ({
7501 - position: "relative",
7502 - "& .p-mention": {
7503 - width: "100%",
7504 - position: "relative"
7505 - },
7506 - "& textarea": {
7507 - width: "100%",
7508 - boxSizing: "border-box",
7509 - fontFamily: "inherit",
7510 - fontSize: theme.typography.pxToRem(12),
7511 - lineHeight: 1.4375,
7512 - padding: "4px 8px",
7513 - borderRadius: theme.shape.borderRadius,
7514 - border: `1px solid ${theme.palette.divider}`,
7515 - backgroundColor: "transparent",
7516 - color: "inherit",
7517 - resize: "vertical",
7518 - outline: "none",
7519 - transition: "border-color 150ms ease-in-out",
7520 - "&:hover": { borderColor: theme.palette.action.active },
7521 - "&:focus": {
7522 - borderColor: theme.palette.primary.main,
7523 - borderWidth: 2,
7524 - padding: "3px 7px"
7525 - },
7526 - "&:disabled": {
7527 - opacity: .38,
7528 - cursor: "default"
7529 - },
7530 - "&::placeholder": {
7531 - color: "inherit",
7532 - opacity: .5
7533 - }
7534 - },
7535 - "& .p-mention-panel": {
7536 - fontFamily: "inherit",
7537 - fontSize: theme.typography.pxToRem(12),
7538 - backgroundColor: theme.palette.background.paper,
7539 - border: `1px solid ${theme.palette.divider}`,
7540 - borderRadius: theme.shape.borderRadius,
7541 - boxShadow: theme.shadows[4],
7542 - maxHeight: "200px",
7543 - overflow: "auto",
7544 - zIndex: theme.zIndex.modal,
7545 - maxWidth: "100%",
7546 - right: 0,
7547 - left: "auto !important"
7548 - },
7549 - "& .p-mention-items": {
7550 - listStyle: "none",
7551 - margin: 0,
7552 - padding: "4px 0"
7553 - },
7554 - "& .p-mention-item": {
7555 - padding: "6px 12px",
7556 - cursor: "pointer",
7557 - color: theme.palette.text.primary,
7558 - "&:hover": { backgroundColor: theme.palette.action.hover },
7559 - "&.p-highlight": { backgroundColor: theme.palette.action.selected }
7560 - },
7561 - "&[data-single-line=\"true\"] textarea": { resize: "none" }
7562 - }));
7563 - function createMentionPattern(value, triggerPosition) {
7564 - const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
7565 - return new RegExp(`${"start" === triggerPosition ? "^" : ""}@${escaped}(?=\\s|$|[^a-zA-Z0-9_-])`, "g");
7566 - }
7567 - var MentionTextAreaControl = createControl(({ placeholder, ariaLabel, suggestions: allSuggestions, rows = 5, triggerPosition = "auto" }) => {
7568 - const { value, setValue, disabled } = useBoundProp(_elementor_editor_props.stringPropTypeUtil);
7569 - const [filteredSuggestions, setFilteredSuggestions] = (0, react.useState)([]);
7570 - const transformMentionsToShortcodes = (0, react.useCallback)((text) => {
7571 - let result = text;
7572 - for (const suggestion of allSuggestions) {
7573 - const pattern = createMentionPattern(suggestion.value, triggerPosition);
7574 - result = result.replace(pattern, `[${suggestion.value}]`);
7575 - }
7576 - return result;
7577 - }, [allSuggestions, triggerPosition]);
7578 - const handleChange = (0, react.useCallback)((e) => {
7579 - const rawValue = e.target.value;
7580 - const transformed = transformMentionsToShortcodes(rawValue);
7581 - setValue(transformed);
7582 - }, [setValue, transformMentionsToShortcodes]);
7583 - const handleSearch = (0, react.useCallback)((event) => {
7584 - if ("start" === triggerPosition) {
7585 - if (event.originalEvent.target.selectionStart - event.query.length - event.trigger.length !== 0) {
7586 - setFilteredSuggestions([]);
7587 - return;
7588 - }
7589 - }
7590 - const query = event.query.toLowerCase();
7591 - const filtered = allSuggestions.filter((item) => item.label.toLowerCase().includes(query) || item.value.toLowerCase().includes(query));
7592 - setFilteredSuggestions(filtered);
7593 - }, [allSuggestions, triggerPosition]);
7594 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(MentionWrapper, { "data-single-line": rows === 1 ? "true" : void 0 }, /* @__PURE__ */ react.createElement(Mention, {
7595 - value: value ?? "",
7596 - onChange: handleChange,
7597 - suggestions: filteredSuggestions,
7598 - onSearch: handleSearch,
7599 - field: "value",
7600 - trigger: "@",
7601 - rows,
7602 - disabled,
7603 - placeholder,
7604 - itemTemplate: SuggestionItem,
7605 - ...ariaLabel ? { "aria-label": ariaLabel } : {}
7606 - })));
7607 - });
7608 - var SuggestionItem = (suggestion) => /* @__PURE__ */ react.createElement("span", null, suggestion.label);
7609 -
7610 -//#endregion
7611 -//#region packages/packages/libs/editor-controls/src/hooks/use-typing-buffer.ts
7612 - function useTypingBuffer(options = {}) {
7613 - const { limit = 3, timeout = 600 } = options;
7614 - const inputBufferRef = (0, react.useRef)("");
7615 - const timeoutRef = (0, react.useRef)(null);
7616 - const appendKey = (key) => {
7617 - inputBufferRef.current = (inputBufferRef.current + key).slice(-limit);
7618 - if (timeoutRef.current) clearTimeout(timeoutRef.current);
7619 - timeoutRef.current = setTimeout(() => {
7620 - inputBufferRef.current = "";
7621 - timeoutRef.current = null;
7622 - }, timeout);
7623 - return inputBufferRef.current;
7624 - };
7625 - const startsWith = (haystack, needle) => {
7626 - if (3 < haystack.length && 2 > needle.length) return false;
7627 - return haystack.startsWith(needle);
7628 - };
7629 - (0, react.useEffect)(() => {
7630 - return () => {
7631 - inputBufferRef.current = "";
7632 - if (timeoutRef.current) {
7633 - clearTimeout(timeoutRef.current);
7634 - timeoutRef.current = null;
7635 - }
7636 - };
7637 - }, []);
7638 - return {
7639 - buffer: inputBufferRef.current,
7640 - appendKey,
7641 - startsWith
7642 - };
7643 - }
7644 -
7645 -//#endregion
7646 -//#region packages/packages/libs/editor-controls/src/utils/size-control.ts
7647 - var lengthUnits = [
7648 - "px",
7649 - "%",
7650 - "em",
7651 - "rem",
7652 - "vw",
7653 - "vh",
7654 - "ch"
7655 - ];
7656 - var angleUnits = [
7657 - "deg",
7658 - "rad",
7659 - "grad",
7660 - "turn"
7661 - ];
7662 - var timeUnits = ["s", "ms"];
7663 - var DEFAULT_SIZE$2 = NaN;
7664 - var extendedOptions = ["auto", "custom"];
7665 - function isUnitExtendedOption(unit) {
7666 - return extendedOptions.includes(unit);
7667 - }
7668 -
7669 -//#endregion
7670 -//#region packages/packages/libs/editor-controls/src/components/number-input.tsx
7671 - var RESTRICTED_INPUT_KEYS = [
7672 - "e",
7673 - "E",
7674 - "+"
7675 - ];
7676 - var NumberInput = (0, react.forwardRef)((props, ref) => {
7677 - const [key, setKey] = (0, react.useState)(0);
7678 - const handleKeyDown = (event) => {
7679 - blockRestrictedKeys(event, props.inputProps?.min);
7680 - props.onKeyDown?.(event);
7681 - };
7682 - const handleBlur = (event) => {
7683 - props.onBlur?.(event);
7684 - const { valid } = event.target.validity;
7685 - if (!valid) setKey((prev) => prev + 1);
7686 - };
7687 - return /* @__PURE__ */ react.createElement(_elementor_ui.TextField, {
7688 - ...props,
7689 - ref,
7690 - key,
7691 - onKeyDown: handleKeyDown,
7692 - onBlur: handleBlur
7693 - });
7694 - });
7695 - function blockRestrictedKeys(event, min) {
7696 - const restrictedInputKeys = [...RESTRICTED_INPUT_KEYS];
7697 - if (min >= 0) restrictedInputKeys.push("-");
7698 - if (restrictedInputKeys.includes(event.key)) event.preventDefault();
7699 - }
7700 -
7701 -//#endregion
7702 -//#region packages/packages/libs/editor-controls/src/components/size-control/text-field-inner-selection.tsx
7703 - var TextFieldInnerSelection = (0, react.forwardRef)(({ placeholder, type, value, onChange, onBlur, onKeyDown, onKeyUp, InputProps, inputProps, disabled, isPopoverOpen, id }, ref) => {
7704 - const { placeholder: boundPropPlaceholder } = useBoundProp(_elementor_editor_props.sizePropTypeUtil);
7705 - const getCursorStyle = () => ({ input: { cursor: InputProps.readOnly ? "default !important" : void 0 } });
7706 - return /* @__PURE__ */ react.createElement(NumberInput, {
7707 - ref,
7708 - sx: getCursorStyle(),
7709 - size: "tiny",
7710 - fullWidth: true,
7711 - type,
7712 - value,
7713 - onInput: onChange,
7714 - onKeyDown,
7715 - onKeyUp,
7716 - disabled,
7717 - onBlur,
7718 - focused: isPopoverOpen ? true : void 0,
7719 - placeholder: placeholder ?? (String(boundPropPlaceholder?.size ?? "") || void 0),
7720 - InputProps,
7721 - inputProps,
7722 - id
7723 - });
7724 - });
7725 - var SelectionEndAdornment = ({ options, alternativeOptionLabels = {}, onClick, value, menuItemsAttributes = {}, disabled }) => {
7726 - const popupState = (0, _elementor_ui.usePopupState)({
7727 - variant: "popover",
7728 - popupId: (0, react.useId)()
7729 - });
7730 - const handleMenuItemClick = (index) => {
7731 - onClick(options[index]);
7732 - popupState.close();
7733 - };
7734 - const { placeholder, showPrimaryColor } = useUnitPlaceholder(value);
7735 - const itemStyles = {
7736 - display: "flex",
7737 - flexDirection: "column",
7738 - justifyContent: "center"
7739 - };
7740 - return /* @__PURE__ */ react.createElement(_elementor_ui.InputAdornment, { position: "end" }, /* @__PURE__ */ react.createElement(StyledButton$2, {
7741 - isPrimaryColor: showPrimaryColor,
7742 - size: "small",
7743 - disabled,
7744 - ...(0, _elementor_ui.bindTrigger)(popupState)
7745 - }, placeholder ?? alternativeOptionLabels[value] ?? value), /* @__PURE__ */ react.createElement(_elementor_ui.Menu, {
7746 - MenuListProps: { dense: true },
7747 - ...(0, _elementor_ui.bindMenu)(popupState)
7748 - }, options.map((option, index) => /* @__PURE__ */ react.createElement(_elementor_editor_ui.MenuListItem, {
7749 - key: option,
7750 - onClick: () => handleMenuItemClick(index),
7751 - ...menuItemsAttributes?.[option],
7752 - primaryTypographyProps: {
7753 - variant: "caption",
7754 - sx: {
7755 - ...itemStyles,
7756 - lineHeight: "1"
7757 - }
7758 - },
7759 - menuItemTextProps: { sx: itemStyles }
7760 - }, alternativeOptionLabels[option] ?? option.toUpperCase()))));
7761 - };
7762 - function useUnitPlaceholder(value) {
7763 - const { value: externalValue, placeholder } = useBoundProp(_elementor_editor_props.sizePropTypeUtil);
7764 - const size = externalValue?.size;
7765 - const unit = externalValue?.unit;
7766 - const showPrimaryColor = value === "auto" || value === "custom" && Boolean(size) || Boolean(size);
7767 - if (!placeholder) return {
7768 - placeholder: null,
7769 - showPrimaryColor
7770 - };
7771 - return {
7772 - placeholder: !unit && value === "px" ? placeholder.unit : void 0,
7773 - showPrimaryColor
7774 - };
7775 - }
7776 - var StyledButton$2 = (0, _elementor_ui.styled)(_elementor_ui.Button, { shouldForwardProp: (prop) => prop !== "isPrimaryColor" })(({ isPrimaryColor, theme }) => ({
7777 - color: isPrimaryColor ? theme.palette.text.primary : theme.palette.text.tertiary,
7778 - font: "inherit",
7779 - minWidth: "initial",
7780 - textTransform: "uppercase"
7781 - }));
7782 -
7783 -//#endregion
7784 -//#region packages/packages/libs/editor-controls/src/components/size-control/size-input.tsx
7785 - var SizeInput$1 = /* @__PURE__ */ __name(({ units, handleUnitChange, handleSizeChange, placeholder, startIcon, onBlur, onFocus, onClick, size, unit, popupState, disabled, min, id, ariaLabel }) => {
7786 - const { appendKey, startsWith } = useTypingBuffer();
7787 - const inputType = isUnitExtendedOption(unit) ? "text" : "number";
7788 - const inputValue = !isUnitExtendedOption(unit) && Number.isNaN(size) ? "" : size ?? "";
7789 - const handleKeyDown = (event) => {
7790 - const { key, altKey, ctrlKey, metaKey } = event;
7791 - if (altKey || ctrlKey || metaKey) return;
7792 - if (isUnitExtendedOption(unit) && !isNaN(Number(key))) {
7793 - const defaultUnit = units?.[0];
7794 - if (defaultUnit) handleUnitChange(defaultUnit);
7795 - return;
7796 - }
7797 - if (!/^[a-zA-Z%]$/.test(key)) return;
7798 - event.preventDefault();
7799 - const newChar = key.toLowerCase();
7800 - const updatedBuffer = appendKey(newChar);
7801 - const matchedUnit = units.find((u) => startsWith(u, updatedBuffer));
7802 - if (matchedUnit) handleUnitChange(matchedUnit);
7803 - };
7804 - const popupAttributes = {
7805 - "aria-controls": popupState.isOpen ? popupState.popupId : void 0,
7806 - "aria-haspopup": true
7807 - };
7808 - const menuItemsAttributes = units.includes("custom") ? { custom: popupAttributes } : void 0;
7809 - const alternativeOptionLabels = { custom: /* @__PURE__ */ react.createElement(_elementor_icons.MathFunctionIcon, { fontSize: "tiny" }) };
7810 - const InputProps = {
7811 - ...popupAttributes,
7812 - readOnly: isUnitExtendedOption(unit),
7813 - autoComplete: "off",
7814 - onClick,
7815 - onFocus,
7816 - startAdornment: startIcon ? /* @__PURE__ */ react.createElement(_elementor_ui.InputAdornment, {
7817 - position: "start",
7818 - disabled
7819 - }, startIcon) : void 0,
7820 - endAdornment: /* @__PURE__ */ react.createElement(SelectionEndAdornment, {
7821 - disabled,
7822 - options: units,
7823 - onClick: handleUnitChange,
7824 - value: unit,
7825 - alternativeOptionLabels,
7826 - menuItemsAttributes
7827 - })
7828 - };
7829 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.Box, null, /* @__PURE__ */ react.createElement(TextFieldInnerSelection, {
7830 - disabled,
7831 - placeholder,
7832 - type: inputType,
7833 - value: inputValue,
7834 - onChange: handleSizeChange,
7835 - onKeyDown: handleKeyDown,
7836 - onBlur,
7837 - InputProps,
7838 - inputProps: {
7839 - min,
7840 - step: "any",
7841 - "aria-label": ariaLabel
7842 - },
7843 - isPopoverOpen: popupState.isOpen,
7844 - id
7845 - })));
7846 - }, "SizeInput");
7847 -
7848 -//#endregion
7849 -//#region packages/packages/libs/editor-controls/src/components/text-field-popover.tsx
7850 - var SIZE$11 = "tiny";
7851 - var TextFieldPopover$1 = /* @__PURE__ */ __name((props) => {
7852 - const { popupState, restoreValue, anchorRef, value, onChange } = props;
7853 - const inputRef = (0, react.useRef)(null);
7854 - (0, react.useEffect)(() => {
7855 - if (popupState.isOpen) requestAnimationFrame(() => {
7856 - if (inputRef.current) inputRef.current.focus();
7857 - });
7858 - }, [popupState.isOpen]);
7859 - const handleKeyPress = (event) => {
7860 - if (event.key.toLowerCase() === "enter") handleClose();
7861 - };
7862 - const handleClose = () => {
7863 - restoreValue();
7864 - popupState.close();
7865 - };
7866 - return /* @__PURE__ */ react.createElement(_elementor_ui.Popover, {
7867 - disablePortal: true,
7868 - slotProps: { paper: { sx: {
7869 - borderRadius: 2,
7870 - width: anchorRef.current?.offsetWidth + "px"
7871 - } } },
7872 - ...(0, _elementor_ui.bindPopover)(popupState),
7873 - anchorOrigin: {
7874 - vertical: "bottom",
7875 - horizontal: "center"
7876 - },
7877 - transformOrigin: {
7878 - vertical: "top",
7879 - horizontal: "center"
7880 - },
7881 - onClose: handleClose
7882 - }, /* @__PURE__ */ react.createElement(_elementor_editor_ui.PopoverHeader, {
7883 - title: (0, _wordpress_i18n.__)("CSS function", "elementor"),
7884 - onClose: handleClose,
7885 - icon: /* @__PURE__ */ react.createElement(_elementor_icons.MathFunctionIcon, { fontSize: SIZE$11 })
7886 - }), /* @__PURE__ */ react.createElement(_elementor_ui.TextField, {
7887 - value,
7888 - onChange,
7889 - onKeyPress: handleKeyPress,
7890 - size: "tiny",
7891 - type: "text",
7892 - fullWidth: true,
7893 - inputProps: { ref: inputRef },
7894 - sx: {
7895 - pt: 0,
7896 - pr: 1.5,
7897 - pb: 1.5,
7898 - pl: 1.5
7899 - }
7900 - }));
7901 - }, "TextFieldPopover");
7902 -
7903 -//#endregion
7904 -//#region packages/packages/libs/editor-controls/src/hooks/use-size-extended-options.ts
7905 - function useSizeExtendedOptions(options, disableCustom) {
7906 - return (0, react.useMemo)(() => {
7907 - const extendedOptions = [...options];
7908 - if (!disableCustom && !extendedOptions.includes("custom")) extendedOptions.push("custom");
7909 - else if (options.includes("custom")) extendedOptions.splice(extendedOptions.indexOf("custom"), 1);
7910 - return extendedOptions;
7911 - }, [options, disableCustom]);
7912 - }
7913 -
7914 -//#endregion
7915 -//#region packages/packages/libs/editor-controls/src/hooks/use-sync-external-state.tsx
7916 - var useSyncExternalState = ({ external, setExternal, persistWhen, fallback }) => {
7917 - function toExternal(internalValue) {
7918 - if (persistWhen(internalValue)) return internalValue;
7919 - return null;
7920 - }
7921 - function toInternal(externalValue, internalValue) {
7922 - if (!externalValue) return fallback(internalValue);
7923 - return externalValue;
7924 - }
7925 - const [internal, setInternal] = (0, react.useState)(toInternal(external, null));
7926 - (0, react.useEffect)(() => {
7927 - setInternal((prevInternal) => toInternal(external, prevInternal));
7928 - }, [external]);
7929 - const setInternalValue = (setter, options, meta) => {
7930 - const updated = (typeof setter === "function" ? setter : () => setter)(internal);
7931 - setInternal(updated);
7932 - setExternal(toExternal(updated), options, meta);
7933 - };
7934 - return [internal, setInternalValue];
7935 - };
7936 -
7937 -//#endregion
7938 -//#region packages/packages/libs/editor-controls/src/controls/size-control/utils/settings/get-prop-type-settings.ts
7939 - var getPropTypeSettings = (propType) => {
7940 - return propType.settings;
7941 - };
7942 -
7943 -//#endregion
7944 -//#region packages/packages/libs/editor-controls/src/controls/size-control.tsx
7945 - var defaultSelectedUnit = {
7946 - length: "px",
7947 - angle: "deg",
7948 - time: "ms"
7949 - };
7950 - var defaultUnits = {
7951 - length: [...lengthUnits],
7952 - angle: [...angleUnits],
7953 - time: [...timeUnits]
7954 - };
7955 - var SizeControl = createControl(({ variant = "length", defaultUnit, units, placeholder, startIcon, anchorRef, extendedOptions, disableCustom, min = 0, enablePropTypeUnits = false, id, ariaLabel }) => {
7956 - const { value: sizeValue, setValue: setSizeValue, disabled, restoreValue, placeholder: externalPlaceholder, propType } = useBoundProp(_elementor_editor_props.sizePropTypeUtil);
7957 - const actualDefaultUnit = defaultUnit ?? externalPlaceholder?.unit ?? defaultSelectedUnit[variant];
7958 - const activeBreakpoint = (0, _elementor_editor_responsive.useActiveBreakpoint)();
7959 - const actualUnits = resolveUnits(propType, enablePropTypeUnits, variant, units, useSizeExtendedOptions(extendedOptions || [], disableCustom ?? false));
7960 - const popupState = (0, _elementor_ui.usePopupState)({ variant: "popover" });
7961 - const [state, setState] = useSyncExternalState({
7962 - external: (0, react.useMemo)(() => createStateFromSizeProp(sizeValue, actualDefaultUnit), [sizeValue, actualDefaultUnit]),
7963 - setExternal: (newState, options, meta) => setSizeValue(extractValueFromState(newState), options, meta),
7964 - persistWhen: (newState) => !!extractValueFromState(newState),
7965 - fallback: (newState) => ({
7966 - unit: newState?.unit ?? actualDefaultUnit,
7967 - numeric: newState?.numeric ?? NaN,
7968 - custom: newState?.custom ?? ""
7969 - })
7970 - });
7971 - const { size: controlSize = DEFAULT_SIZE$2, unit: controlUnit = actualDefaultUnit } = extractValueFromState(state, true) || {};
7972 - const handleUnitChange = (newUnit) => {
7973 - if (newUnit === "custom") popupState.open(anchorRef?.current);
7974 - setState((prev) => ({
7975 - ...prev,
7976 - unit: newUnit
7977 - }));
7978 - };
7979 - const handleSizeChange = (event) => {
7980 - const size = event.target.value;
7981 - const isInputValid = event.target.validity.valid;
7982 - if (controlUnit === "auto") {
7983 - setState((prev) => ({
7984 - ...prev,
7985 - unit: controlUnit
7986 - }));
7987 - return;
7988 - }
7989 - setState((prev) => ({
7990 - ...prev,
7991 - [controlUnit === "custom" ? "custom" : "numeric"]: formatSize(size, controlUnit),
7992 - unit: controlUnit
7993 - }), void 0, { validation: () => isInputValid });
7994 - };
7995 - const onInputClick = (event) => {
7996 - if (event.target.closest("input") && "custom" === state.unit) popupState.open(anchorRef?.current);
7997 - };
7998 - const maybeClosePopup = (0, react.useCallback)(() => {
7999 - if (popupState && popupState.isOpen) popupState.close();
8000 - }, [popupState]);
8001 - (0, react.useEffect)(() => {
8002 - maybeClosePopup();
8003 - }, [activeBreakpoint]);
8004 - return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(SizeInput$1, {
8005 - disabled,
8006 - size: controlSize,
8007 - unit: controlUnit,
8008 - units: [...actualUnits],
8009 - placeholder,
8010 - startIcon,
8011 - handleSizeChange,
8012 - handleUnitChange,
8013 - onBlur: restoreValue,
8014 - onClick: onInputClick,
8015 - popupState,
8016 - min,
8017 - id,
8018 - ariaLabel
8019 - }), anchorRef?.current && popupState.isOpen && /* @__PURE__ */ react.createElement(TextFieldPopover$1, {
8020 - popupState,
8021 - anchorRef,
8022 - restoreValue,
8023 - value: controlSize,
8024 - onChange: handleSizeChange
8025 - }));
8026 - });
8027 - function resolveUnits(propType, enablePropTypeUnits, variant, externalUnits, actualExtendedOptions) {
8028 - const fallback = [...defaultUnits[variant]];
8029 - if (!enablePropTypeUnits) return [...externalUnits ?? fallback, ...actualExtendedOptions || []];
8030 - return getPropTypeSettings(propType)?.available_units ?? fallback;
8031 - }
8032 - function formatSize(size, unit) {
8033 - if (isUnitExtendedOption(unit)) return unit === "auto" ? "" : String(size ?? "");
8034 - return size || size === 0 ? Number(size) : NaN;
8035 - }
8036 - function createStateFromSizeProp(sizeValue, defaultUnit, defaultSize = "", customState = "") {
8037 - const unit = sizeValue?.unit ?? defaultUnit;
8038 - const size = sizeValue?.size ?? defaultSize;
8039 - return {
8040 - numeric: !isUnitExtendedOption(unit) && !isNaN(Number(size)) && (size || size === 0) ? Number(size) : DEFAULT_SIZE$2,
8041 - custom: unit === "custom" ? String(size) : customState,
8042 - unit
8043 - };
8044 - }
8045 - function extractValueFromState(state, allowEmpty = false) {
8046 - if (!state) return null;
8047 - if (!state?.unit) return {
8048 - size: DEFAULT_SIZE$2,
8049 - unit: "px"
8050 - };
8051 - const { unit } = state;
8052 - if (unit === "auto") return {
8053 - size: "",
8054 - unit
8055 - };
8056 - if (unit === "custom") return {
8057 - size: state.custom ?? "",
8058 - unit: "custom"
8059 - };
8060 - const numeric = state.numeric;
8061 - if (!allowEmpty && (numeric === void 0 || numeric === null || Number.isNaN(numeric))) return null;
8062 - return {
8063 - size: numeric,
8064 - unit
8065 - };
8066 - }
8067 -
8068 -//#endregion
8069 -//#region packages/packages/libs/editor-controls/src/components/section-content.tsx
8070 - var SectionContent = ({ gap = .5, sx, children }) => /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
8071 - gap,
8072 - sx: { ...sx }
8073 - }, children);
8074 -
8075 -//#endregion
8076 -//#region packages/packages/libs/editor-controls/src/controls/color-control.tsx
8077 - var ColorControl = createControl(({ propTypeUtil = _elementor_editor_props.colorPropTypeUtil, anchorEl, slotProps = {}, id, ...props }) => {
8078 - const { value, setValue, placeholder: boundPropPlaceholder, disabled } = useBoundProp(propTypeUtil);
8079 - const placeholder = props.placeholder ?? boundPropPlaceholder;
8080 - const handleChange = (selectedColor) => {
8081 - setValue(selectedColor || null);
8082 - };
8083 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.UnstableColorField, {
8084 - id,
8085 - size: "tiny",
8086 - fullWidth: true,
8087 - value: value ?? "",
8088 - placeholder: placeholder ?? "",
8089 - onChange: handleChange,
8090 - ...props,
8091 - disabled,
8092 - slotProps: {
8093 - ...slotProps,
8094 - colorPicker: {
8095 - anchorEl,
8096 - anchorOrigin: {
8097 - vertical: "top",
8098 - horizontal: "right"
8099 - },
8100 - transformOrigin: {
8101 - vertical: "top",
8102 - horizontal: -10
8103 - },
8104 - slotProps: {
8105 - colorIndicator: { value: value ?? placeholder ?? "" },
8106 - colorBox: { value: value ?? placeholder ?? "" }
8107 - }
8108 - }
8109 - }
8110 - }));
8111 - });
8112 -
8113 -//#endregion
8114 -//#region packages/packages/libs/editor-controls/src/controls/stroke-control.tsx
8115 - var units = [
8116 - "px",
8117 - "em",
8118 - "rem"
8119 - ];
8120 - var StrokeControl = createControl(() => {
8121 - const propContext = useBoundProp(_elementor_editor_props.strokePropTypeUtil);
8122 - const rowRef = (0, react.useRef)(null);
8123 - return /* @__PURE__ */ react.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ react.createElement(SectionContent, { gap: 2 }, /* @__PURE__ */ react.createElement(Control$3, {
8124 - bind: "width",
8125 - label: (0, _wordpress_i18n.__)("Stroke width", "elementor"),
8126 - ref: rowRef
8127 - }, /* @__PURE__ */ react.createElement(SizeControl, {
8128 - units,
8129 - anchorRef: rowRef
8130 - })), /* @__PURE__ */ react.createElement(Control$3, {
8131 - bind: "color",
8132 - label: (0, _wordpress_i18n.__)("Stroke color", "elementor")
8133 - }, /* @__PURE__ */ react.createElement(ColorControl, null))));
8134 - });
8135 - var Control$3 = (0, react.forwardRef)(({ bind, label, children }, ref) => /* @__PURE__ */ react.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
8136 - container: true,
8137 - gap: 2,
8138 - alignItems: "center",
8139 - flexWrap: "nowrap",
8140 - ref
8141 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
8142 - item: true,
8143 - xs: 6
8144 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, label)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
8145 - item: true,
8146 - xs: 6
8147 - }, children))));
8148 -
8149 -//#endregion
8150 -//#region packages/packages/libs/editor-controls/src/hooks/use-repeater-popover-dismiss.ts
8151 - var serializeBreakpoints = (breakpoints) => breakpoints.map((b) => [
8152 - b.id,
8153 - b.width ?? "",
8154 - b.type ?? ""
8155 - ].join(":")).join("|");
8156 - var usePopoverDismiss = ({ isOpen, onClose }) => {
8157 - const onCloseRef = (0, react.useRef)(onClose);
8158 - onCloseRef.current = onClose;
8159 - const activeBreakpoint = (0, _elementor_editor_responsive.useActiveBreakpoint)();
8160 - const breakpoints = (0, _elementor_editor_responsive.useBreakpoints)();
8161 - const breakpointsSignature = (0, react.useMemo)(() => serializeBreakpoints(breakpoints), [breakpoints]);
8162 - const prevActiveBreakpointRef = (0, react.useRef)(void 0);
8163 - const prevBreakpointsSignatureRef = (0, react.useRef)(null);
8164 - (0, react.useEffect)(() => {
8165 - if (!isOpen) {
8166 - prevActiveBreakpointRef.current = activeBreakpoint;
8167 - prevBreakpointsSignatureRef.current = breakpointsSignature;
8168 - return;
8169 - }
8170 - const previousBreakpoint = prevActiveBreakpointRef.current;
8171 - const previousSignature = prevBreakpointsSignatureRef.current;
8172 - if (previousBreakpoint !== void 0 && previousBreakpoint !== activeBreakpoint || previousSignature !== null && previousSignature !== breakpointsSignature) onCloseRef.current();
8173 - prevActiveBreakpointRef.current = activeBreakpoint;
8174 - prevBreakpointsSignatureRef.current = breakpointsSignature;
8175 - }, [
8176 - activeBreakpoint,
8177 - breakpointsSignature,
8178 - isOpen
8179 - ]);
8180 - (0, react.useEffect)(() => {
8181 - if (!isOpen) return;
8182 - const onKeyDown = (event) => {
8183 - if (event.key === "Escape" && !event.defaultPrevented) onCloseRef.current();
8184 - };
8185 - document.addEventListener("keydown", onKeyDown);
8186 - return () => {
8187 - document.removeEventListener("keydown", onKeyDown);
8188 - };
8189 - }, [isOpen]);
8190 - };
8191 -
8192 -//#endregion
8193 -//#region packages/packages/libs/editor-controls/src/services/event-bus.ts
8194 - var __defProp$1 = Object.defineProperty;
8195 - var __defNormalProp = (obj, key, value) => key in obj ? __defProp$1(obj, key, {
8196 - enumerable: true,
8197 - configurable: true,
8198 - writable: true,
8199 - value
8200 - }) : obj[key] = value;
8201 - var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8202 - var EventBus = class {
8203 - constructor() {
8204 - __publicField(this, "listeners", /* @__PURE__ */ new Map());
8205 - }
8206 - subscribe(eventName, callback) {
8207 - if (!this.listeners.has(eventName)) this.listeners.set(eventName, /* @__PURE__ */ new Set());
8208 - const eventListeners = this.listeners.get(eventName);
8209 - if (eventListeners) eventListeners.add(callback);
8210 - }
8211 - unsubscribe(eventName, callback) {
8212 - const eventListeners = this.listeners.get(eventName);
8213 - if (!eventListeners) return;
8214 - eventListeners.delete(callback);
8215 - if (eventListeners.size === 0) this.listeners.delete(eventName);
8216 - }
8217 - emit(eventName, data) {
8218 - const eventListeners = this.listeners.get(eventName);
8219 - if (eventListeners) eventListeners.forEach((callback) => callback(data));
8220 - }
8221 - clearAll() {
8222 - this.listeners.clear();
8223 - }
8224 - };
8225 - var eventBus = new EventBus();
8226 -
8227 -//#endregion
8228 -//#region packages/packages/libs/editor-controls/src/components/control-repeater/context/item-context.tsx
8229 - var ItemContext = (0, react.createContext)({
8230 - index: -1,
8231 - value: {}
8232 - });
8233 -
8234 -//#endregion
8235 -//#region packages/packages/libs/editor-controls/src/components/control-repeater/context/repeater-context.tsx
8236 - var RepeaterContext = (0, react.createContext)(null);
8237 - var EMPTY_OPEN_ITEM$1 = -1;
8238 - var useRepeaterContext = () => {
8239 - const context = (0, react.useContext)(RepeaterContext);
8240 - const itemContext = (0, react.useContext)(ItemContext);
8241 - if (!context) throw new Error("useRepeaterContext must be used within a RepeaterContextProvider");
8242 - return {
8243 - ...context,
8244 - ...itemContext
8245 - };
8246 - };
8247 - var RepeaterContextProvider = ({ children, initial, propTypeUtil, isItemDisabled = () => false }) => {
8248 - const { value: repeaterValues, setValue: setRepeaterValues } = useBoundProp(propTypeUtil);
8249 - const [items, setItems] = useSyncExternalState({
8250 - external: repeaterValues,
8251 - fallback: () => [],
8252 - setExternal: setRepeaterValues,
8253 - persistWhen: () => true
8254 - });
8255 - const [uniqueKeys, setUniqueKeys] = (0, react.useState)(() => {
8256 - return items?.map(() => generateUniqueKey()) ?? [];
8257 - });
8258 - (0, react.useEffect)(() => {
8259 - const nextLength = items?.length ?? 0;
8260 - setUniqueKeys((prev) => {
8261 - const prevLength = prev.length;
8262 - if (prevLength === nextLength) return prev;
8263 - if (prevLength > nextLength) return prev.slice(0, nextLength);
8264 - return [...prev, ...Array.from({ length: nextLength - prevLength }, generateUniqueKey)];
8265 - });
8266 - }, [items?.length]);
8267 - const itemsWithKeys = (0, react.useMemo)(() => uniqueKeys.map((key, index) => ({
8268 - key,
8269 - item: items[index]
8270 - })).filter(({ item }) => item !== void 0), [uniqueKeys, items]);
8271 - const handleSetItems = (newItemsWithKeys) => {
8272 - setItems(newItemsWithKeys.map(({ item }) => item));
8273 - };
8274 - const [openItemIndex, setOpenItemIndex] = (0, react.useState)(-1);
8275 - const [rowRef, setRowRef] = (0, react.useState)(null);
8276 - const isOpen = openItemIndex !== -1;
8277 - const popoverState = (0, _elementor_ui.usePopupState)({ variant: "popover" });
8278 - const addItem = (ev, config) => {
8279 - const item = config?.item ?? { ...initial };
8280 - const newIndex = config?.index ?? items.length;
8281 - const newKey = generateUniqueKey();
8282 - const newItems = [...items];
8283 - newItems.splice(newIndex, 0, item);
8284 - setItems(newItems);
8285 - setUniqueKeys([
8286 - ...uniqueKeys.slice(0, newIndex),
8287 - newKey,
8288 - ...uniqueKeys.slice(newIndex)
8289 - ]);
8290 - setOpenItemIndex(newIndex);
8291 - popoverState.open(rowRef ?? ev);
8292 - eventBus.emit(`${propTypeUtil.key}-item-added`, { itemValue: initial.value });
8293 - };
8294 - const removeItem = (index) => {
8295 - const itemToRemove = items[index];
8296 - setItems(items.filter((_, pos) => pos !== index));
8297 - setUniqueKeys(uniqueKeys.filter((_, pos) => pos !== index));
8298 - eventBus.emit(`${propTypeUtil.key}-item-removed`, { itemValue: itemToRemove?.value });
8299 - };
8300 - const updateItem = (updatedItem, index) => {
8301 - const newItems = [
8302 - ...items.slice(0, index),
8303 - updatedItem,
8304 - ...items.slice(index + 1)
8305 - ];
8306 - setItems(newItems);
8307 - };
8308 - const closePopover = () => {
8309 - if (!isOpen) return;
8310 - setOpenItemIndex(-1);
8311 - setRowRef(null);
8312 - popoverState.close();
8313 - };
8314 - usePopoverDismiss({
8315 - isOpen,
8316 - onClose: closePopover
8317 - });
8318 - return /* @__PURE__ */ react.createElement(RepeaterContext.Provider, { value: {
8319 - isOpen,
8320 - openItemIndex,
8321 - setOpenItemIndex,
8322 - items: itemsWithKeys ?? [],
8323 - setItems: handleSetItems,
8324 - popoverState,
8325 - initial,
8326 - updateItem,
8327 - addItem,
8328 - removeItem,
8329 - rowRef,
8330 - setRowRef,
8331 - isItemDisabled: (index) => isItemDisabled(itemsWithKeys[index].item)
8332 - } }, children);
8333 - };
8334 - var generateUniqueKey = () => {
8335 - return Date.now() + Math.floor(Math.random() * 1e6);
8336 - };
8337 -
8338 -//#endregion
8339 -//#region packages/packages/libs/editor-controls/src/components/control-repeater/actions/tooltip-add-item-action.tsx
8340 - var SIZE$10 = "tiny";
8341 - var TooltipAddItemAction = ({ disabled = false, enableTooltip = false, tooltipContent = null, newItemIndex, ariaLabel }) => {
8342 - const { addItem } = useRepeaterContext();
8343 - const onClick = (ev) => addItem(ev, { index: newItemIndex });
8344 - return /* @__PURE__ */ react.createElement(ConditionalToolTip, {
8345 - content: tooltipContent,
8346 - enable: enableTooltip
8347 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
8348 - component: "span",
8349 - sx: { cursor: disabled ? "not-allowed" : "pointer" }
8350 - }, /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, {
8351 - size: SIZE$10,
8352 - disabled,
8353 - onClick,
8354 - "aria-label": (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("Add %s item", "elementor"), ariaLabel?.toLowerCase())
8355 - }, /* @__PURE__ */ react.createElement(_elementor_icons.PlusIcon, { fontSize: SIZE$10 }))));
8356 - };
8357 - var ConditionalToolTip = ({ children, enable, content }) => enable && content ? /* @__PURE__ */ react.createElement(_elementor_ui.Infotip, {
8358 - placement: "right",
8359 - color: "secondary",
8360 - content
8361 - }, children) : children;
8362 -
8363 -//#endregion
8364 -//#region packages/packages/libs/editor-controls/src/components/repeater/sortable.tsx
8365 - var SortableProvider = (props) => {
8366 - return /* @__PURE__ */ react.createElement(_elementor_ui.List, { sx: {
8367 - p: 0,
8368 - my: -.5,
8369 - mx: 0
8370 - } }, /* @__PURE__ */ react.createElement(_elementor_ui.UnstableSortableProvider, {
8371 - restrictAxis: true,
8372 - disableDragOverlay: false,
8373 - variant: "static",
8374 - ...props
8375 - }));
8376 - };
8377 - var SortableItem = ({ id, children, disabled }) => {
8378 - return /* @__PURE__ */ react.createElement(_elementor_ui.UnstableSortableItem, {
8379 - id,
8380 - disabled,
8381 - render: ({ itemProps, triggerProps, itemStyle, triggerStyle, showDropIndication, dropIndicationStyle }) => {
8382 - return /* @__PURE__ */ react.createElement(StyledListItem, {
8383 - ...itemProps,
8384 - style: itemStyle,
8385 - tabIndex: -1
8386 - }, !disabled && /* @__PURE__ */ react.createElement(SortableTrigger, {
8387 - ...triggerProps,
8388 - style: triggerStyle
8389 - }), children, showDropIndication && /* @__PURE__ */ react.createElement(StyledDivider, { style: dropIndicationStyle }));
8390 - }
8391 - });
8392 - };
8393 - var StyledListItem = (0, _elementor_ui.styled)(_elementor_ui.ListItem)`
8394 - position: relative;
8395 - margin-inline: 0px;
8396 - padding-inline: 0px;
8397 - padding-block: ${({ theme }) => theme.spacing(.5)};
8398 -
8399 - & .class-item-sortable-trigger {
8400 - color: ${({ theme }) => theme.palette.action.active};
8401 - height: 100%;
8402 - display: flex;
8403 - align-items: center;
8404 - visibility: hidden;
8405 - position: absolute;
8406 - top: 50%;
8407 - padding-inline-end: ${({ theme }) => theme.spacing(.5)};
8408 - transform: translate( -75%, -50% );
8409 - }
8410 -
8411 - &[aria-describedby=''] > .MuiTag-root {
8412 - background-color: ${({ theme }) => theme.palette.background.paper};
8413 - box-shadow: ${({ theme }) => theme.shadows[3]};
8414 - }
8415 -
8416 - &:hover,
8417 - &:focus-within {
8418 - & .class-item-sortable-trigger {
8419 - visibility: visible;
8420 - }
8421 - }
8422 -`;
8423 - var SortableTrigger = (props) => /* @__PURE__ */ react.createElement("div", {
8424 - ...props,
8425 - role: "button",
8426 - className: "class-item-sortable-trigger",
8427 - tabIndex: 0,
8428 - "aria-label": (0, _wordpress_i18n.__)("Drag item", "elementor")
8429 - }, /* @__PURE__ */ react.createElement(_elementor_icons.GripVerticalIcon, { fontSize: "tiny" }));
8430 - var StyledDivider = (0, _elementor_ui.styled)(_elementor_ui.Divider)`
8431 - height: 0px;
8432 - border: none;
8433 - overflow: visible;
8434 -
8435 - &:after {
8436 - --height: 2px;
8437 - content: '';
8438 - display: block;
8439 - width: 100%;
8440 - height: var( --height );
8441 - margin-block: calc( -1 * var( --height ) / 2 );
8442 - border-radius: ${({ theme }) => theme.spacing(.5)};
8443 - background-color: ${({ theme }) => theme.palette.text.primary};
8444 - }
8445 -`;
8446 -
8447 -//#endregion
8448 -//#region packages/packages/libs/editor-controls/src/components/control-repeater/items/items-container.tsx
8449 - var ItemsContainer = ({ isSortable = true, children }) => {
8450 - const { items, setItems } = useRepeaterContext();
8451 - const keys = items.map(({ key }) => key);
8452 - if (!children) return null;
8453 - const onChangeOrder = (newKeys) => {
8454 - setItems(newKeys.map((key) => {
8455 - const index = items.findIndex((item) => item.key === key);
8456 - return items[index];
8457 - }));
8458 - };
8459 - return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(SortableProvider, {
8460 - value: keys,
8461 - onChange: onChangeOrder
8462 - }, keys.map((key, index) => {
8463 - const value = items[index].item;
8464 - return /* @__PURE__ */ react.createElement(SortableItem, {
8465 - id: key,
8466 - key: `sortable-${key}`,
8467 - disabled: !isSortable
8468 - }, /* @__PURE__ */ react.createElement(ItemContext.Provider, { value: {
8469 - index,
8470 - value
8471 - } }, children));
8472 - })));
8473 - };
8474 -
8475 -//#endregion
8476 -//#region packages/packages/libs/editor-controls/src/hooks/use-repeatable-control-context.ts
8477 - var RepeatableControlContext = (0, react.createContext)(void 0);
8478 - var useRepeatableControlContext = () => {
8479 - const context = (0, react.useContext)(RepeatableControlContext);
8480 - if (!context) throw new Error("useRepeatableControlContext must be used within RepeatableControl");
8481 - return context;
8482 - };
8483 -
8484 -//#endregion
8485 -//#region packages/packages/libs/editor-controls/src/components/repeater/repeater-tag.tsx
8486 - var RepeaterTag = (0, react.forwardRef)((props, ref) => {
8487 - return /* @__PURE__ */ react.createElement(_elementor_ui.UnstableTag, {
8488 - ref,
8489 - fullWidth: true,
8490 - showActionsOnHover: true,
8491 - variant: "outlined",
8492 - sx: { minHeight: (theme) => theme.spacing(3.5) },
8493 - ...props
8494 - });
8495 - });
8496 -
8497 -//#endregion
8498 -//#region packages/packages/libs/editor-controls/src/components/control-repeater/locations.ts
8499 - var { Slot: RepeaterItemIconSlot, inject: injectIntoRepeaterItemIcon } = (0, _elementor_locations.createReplaceableLocation)();
8500 - var { Slot: RepeaterItemLabelSlot, inject: injectIntoRepeaterItemLabel } = (0, _elementor_locations.createReplaceableLocation)();
8501 - var { Slot: RepeaterItemActionsSlot, inject: injectIntoRepeaterItemActions } = (0, _elementor_locations.createLocation)();
8502 -
8503 -//#endregion
8504 -//#region packages/packages/libs/editor-controls/src/components/control-repeater/items/item.tsx
8505 - var Item = ({ Label, Icon, actions }) => {
8506 - const { popoverState, setRowRef, openItemIndex, setOpenItemIndex, index = -1, value, isItemDisabled } = useRepeaterContext();
8507 - const disableOpen = !!(0, react.useContext)(RepeatableControlContext)?.props?.readOnly;
8508 - const triggerProps = (0, _elementor_ui.bindTrigger)(popoverState);
8509 - const onClick = (ev) => {
8510 - if (disableOpen || isItemDisabled(index)) return;
8511 - triggerProps.onClick(ev);
8512 - setOpenItemIndex(index);
8513 - };
8514 - const setRef = (ref) => {
8515 - if (!ref || openItemIndex !== index || ref === popoverState.anchorEl) return;
8516 - setRowRef(ref);
8517 - popoverState.setAnchorEl(ref);
8518 - };
8519 - return /* @__PURE__ */ react.createElement(RepeaterTag, {
8520 - ref: setRef,
8521 - label: /* @__PURE__ */ react.createElement(RepeaterItemLabelSlot, { value }, /* @__PURE__ */ react.createElement(Label, { value })),
8522 - "aria-label": (0, _wordpress_i18n.__)("Open item", "elementor"),
8523 - ...triggerProps,
8524 - onClick,
8525 - startIcon: /* @__PURE__ */ react.createElement(RepeaterItemIconSlot, { value }, /* @__PURE__ */ react.createElement(Icon, { value })),
8526 - sx: {
8527 - minHeight: (theme) => theme.spacing(3.5),
8528 - ...isItemDisabled(index) && { "[role=\"button\"]": { cursor: "not-allowed" } }
8529 - },
8530 - actions: /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(RepeaterItemActionsSlot, { index: index ?? -1 }), actions)
8531 - });
8532 - };
8533 -
8534 -//#endregion
8535 -//#region packages/packages/libs/editor-controls/src/components/control-repeater/control-repeater.tsx
8536 - var ControlRepeater = ({ children, initial, propTypeUtil, isItemDisabled }) => {
8537 - return /* @__PURE__ */ react.createElement(SectionContent, null, /* @__PURE__ */ react.createElement(RepeaterContextProvider, {
8538 - initial,
8539 - propTypeUtil,
8540 - isItemDisabled
8541 - }, children));
8542 - };
8543 -
8544 -//#endregion
8545 -//#region packages/packages/libs/editor-controls/src/components/control-repeater/actions/disable-item-action.tsx
8546 - var SIZE$9 = "tiny";
8547 - var DisableItemAction = () => {
8548 - const { items, updateItem, index = -1 } = useRepeaterContext();
8549 - if (index === -1) return null;
8550 - const propDisabled = items[index].item.disabled ?? false;
8551 - const toggleLabel = propDisabled ? (0, _wordpress_i18n.__)("Show", "elementor") : (0, _wordpress_i18n.__)("Hide", "elementor");
8552 - const onClick = () => {
8553 - const self = structuredClone(items[index].item);
8554 - self.disabled = !self.disabled;
8555 - if (!self.disabled) delete self.disabled;
8556 - updateItem(self, index);
8557 - };
8558 - return /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
8559 - title: toggleLabel,
8560 - placement: "top"
8561 - }, /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, {
8562 - size: SIZE$9,
8563 - onClick,
8564 - "aria-label": toggleLabel
8565 - }, propDisabled ? /* @__PURE__ */ react.createElement(_elementor_icons.EyeOffIcon, { fontSize: SIZE$9 }) : /* @__PURE__ */ react.createElement(_elementor_icons.EyeIcon, { fontSize: SIZE$9 })));
8566 - };
8567 -
8568 -//#endregion
8569 -//#region packages/packages/libs/editor-controls/src/components/control-repeater/actions/duplicate-item-action.tsx
8570 - var SIZE$8 = "tiny";
8571 - var DuplicateItemAction = () => {
8572 - const { items, addItem, index = -1, isItemDisabled } = useRepeaterContext();
8573 - if (index === -1) return null;
8574 - const duplicateLabel = (0, _wordpress_i18n.__)("Duplicate", "elementor");
8575 - const item = items[index]?.item;
8576 - const onClick = (ev) => {
8577 - const newItem = structuredClone(item);
8578 - addItem(ev, {
8579 - item: newItem,
8580 - index: index + 1
8581 - });
8582 - };
8583 - return /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
8584 - title: duplicateLabel,
8585 - placement: "top"
8586 - }, /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, {
8587 - size: SIZE$8,
8588 - onClick,
8589 - "aria-label": duplicateLabel,
8590 - disabled: isItemDisabled(index)
8591 - }, /* @__PURE__ */ react.createElement(_elementor_icons.CopyIcon, { fontSize: SIZE$8 })));
8592 - };
8593 -
8594 -//#endregion
8595 -//#region packages/packages/libs/editor-controls/src/components/control-repeater/actions/remove-item-action.tsx
8596 - var SIZE$7 = "tiny";
8597 - var RemoveItemAction = () => {
8598 - const { removeItem, index = -1 } = useRepeaterContext();
8599 - if (index === -1) return null;
8600 - const removeLabel = (0, _wordpress_i18n.__)("Remove", "elementor");
8601 - const onClick = () => removeItem(index);
8602 - return /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
8603 - title: removeLabel,
8604 - placement: "top"
8605 - }, /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, {
8606 - size: SIZE$7,
8607 - onClick,
8608 - "aria-label": removeLabel
8609 - }, /* @__PURE__ */ react.createElement(_elementor_icons.XIcon, { fontSize: SIZE$7 })));
8610 - };
8611 -
8612 -//#endregion
8613 -//#region packages/packages/libs/editor-controls/src/components/repeater/repeater-popover.tsx
8614 - var RepeaterPopover = ({ children, width, ...props }) => {
8615 - return /* @__PURE__ */ react.createElement(_elementor_ui.Popover, {
8616 - disablePortal: true,
8617 - disableEnforceFocus: true,
8618 - anchorOrigin: {
8619 - vertical: "bottom",
8620 - horizontal: "left"
8621 - },
8622 - slotProps: { paper: { sx: {
8623 - marginBlockStart: .5,
8624 - width,
8625 - overflow: "visible"
8626 - } } },
8627 - ...props
8628 - }, children);
8629 - };
8630 -
8631 -//#endregion
8632 -//#region packages/packages/libs/editor-controls/src/components/control-repeater/items/edit-item-popover.tsx
8633 - var EditItemPopover = ({ children }) => {
8634 - const { popoverState, openItemIndex, isOpen, rowRef, setOpenItemIndex, setRowRef } = useRepeaterContext();
8635 - if (!isOpen || !rowRef) return null;
8636 - const onClose = () => {
8637 - setRowRef(null);
8638 - popoverState.setAnchorEl(null);
8639 - setOpenItemIndex(-1);
8640 - };
8641 - return /* @__PURE__ */ react.createElement(RepeaterPopover, {
8642 - width: rowRef.offsetWidth,
8643 - ...(0, _elementor_ui.bindPopover)(popoverState),
8644 - onClose
8645 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: String(openItemIndex) }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, null, children)));
8646 - };
8647 -
8648 -//#endregion
8649 -//#region packages/packages/libs/editor-controls/src/components/popover-content.tsx
8650 - var PopoverContent = ({ gap = 1.5, children, ...props }) => /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
8651 - ...props,
8652 - gap
8653 - }, children);
8654 -
8655 -//#endregion
8656 -//#region packages/packages/libs/editor-controls/src/components/popover-grid-container.tsx
8657 - var PopoverGridContainer = (0, react.forwardRef)(({ gap = 1.5, alignItems = "center", flexWrap = "nowrap", children }, ref) => /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
8658 - container: true,
8659 - gap,
8660 - alignItems,
8661 - flexWrap,
8662 - ref
8663 - }, children));
8664 -
8665 -//#endregion
8666 -//#region packages/packages/libs/editor-controls/src/components/repeater/repeater-header.tsx
8667 - var RepeaterHeader = (0, react.forwardRef)(({ label, children, adornment: Adornment = ControlAdornments }, ref) => {
8668 - return /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
8669 - direction: "row",
8670 - alignItems: "center",
8671 - gap: 1,
8672 - sx: {
8673 - marginInlineEnd: -.75,
8674 - py: .25
8675 - },
8676 - ref
8677 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
8678 - display: "flex",
8679 - alignItems: "center",
8680 - gap: 1,
8681 - sx: { flexGrow: 1 }
8682 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Typography, {
8683 - component: "label",
8684 - variant: "caption",
8685 - color: "text.secondary",
8686 - sx: { lineHeight: 1 }
8687 - }, label), /* @__PURE__ */ react.createElement(Adornment, null)), children);
8688 - });
8689 -
8690 -//#endregion
8691 -//#region packages/packages/libs/editor-controls/src/controls/box-shadow-repeater-control.tsx
8692 - var BoxShadowRepeaterControl = createControl(() => {
8693 - const { propType, value, setValue, disabled } = useBoundProp(_elementor_editor_props.boxShadowPropTypeUtil);
8694 - return /* @__PURE__ */ react.createElement(PropProvider, {
8695 - propType,
8696 - value,
8697 - setValue,
8698 - isDisabled: () => disabled
8699 - }, /* @__PURE__ */ react.createElement(ControlRepeater, {
8700 - initial: initialShadow,
8701 - propTypeUtil: _elementor_editor_props.boxShadowPropTypeUtil
8702 - }, /* @__PURE__ */ react.createElement(RepeaterHeader, { label: (0, _wordpress_i18n.__)("Box shadow", "elementor") }, /* @__PURE__ */ react.createElement(TooltipAddItemAction, {
8703 - newItemIndex: 0,
8704 - disabled,
8705 - ariaLabel: "Box shadow"
8706 - })), /* @__PURE__ */ react.createElement(ItemsContainer, null, /* @__PURE__ */ react.createElement(Item, {
8707 - Icon: ItemIcon$2,
8708 - Label: ItemLabel$3,
8709 - actions: /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(DuplicateItemAction, null), /* @__PURE__ */ react.createElement(DisableItemAction, null), /* @__PURE__ */ react.createElement(RemoveItemAction, null))
8710 - })), /* @__PURE__ */ react.createElement(EditItemPopover, null, /* @__PURE__ */ react.createElement(Content$1, null))));
8711 - });
8712 - var StyledUnstableColorIndicator$2 = (0, _elementor_ui.styled)(_elementor_ui.UnstableColorIndicator)(({ theme }) => ({
8713 - height: "1rem",
8714 - width: "1rem",
8715 - borderRadius: `${theme.shape.borderRadius / 2}px`
8716 - }));
8717 - var ItemIcon$2 = /* @__PURE__ */ __name(({ value }) => /* @__PURE__ */ react.createElement(StyledUnstableColorIndicator$2, {
8718 - size: "inherit",
8719 - component: "span",
8720 - value: value.value.color?.value
8721 - }), "ItemIcon");
8722 - var Content$1 = /* @__PURE__ */ __name(() => {
8723 - const context = useBoundProp(_elementor_editor_props.shadowPropTypeUtil);
8724 - const rowRef = [(0, react.useRef)(null), (0, react.useRef)(null)];
8725 - const { rowRef: anchorEl } = useRepeaterContext();
8726 - return /* @__PURE__ */ react.createElement(PropProvider, { ...context }, /* @__PURE__ */ react.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ react.createElement(PopoverGridContainer, null, /* @__PURE__ */ react.createElement(Control$2, {
8727 - bind: "color",
8728 - label: (0, _wordpress_i18n.__)("Color", "elementor")
8729 - }, /* @__PURE__ */ react.createElement(ColorControl, { anchorEl })), /* @__PURE__ */ react.createElement(Control$2, {
8730 - bind: "position",
8731 - label: (0, _wordpress_i18n.__)("Position", "elementor"),
8732 - sx: { overflow: "hidden" }
8733 - }, /* @__PURE__ */ react.createElement(SelectControl, { options: [{
8734 - label: (0, _wordpress_i18n.__)("Inset", "elementor"),
8735 - value: "inset"
8736 - }, {
8737 - label: (0, _wordpress_i18n.__)("Outset", "elementor"),
8738 - value: null
8739 - }] }))), /* @__PURE__ */ react.createElement(PopoverGridContainer, { ref: rowRef[0] }, /* @__PURE__ */ react.createElement(Control$2, {
8740 - bind: "hOffset",
8741 - label: (0, _wordpress_i18n.__)("Horizontal", "elementor")
8742 - }, /* @__PURE__ */ react.createElement(SizeControl, {
8743 - anchorRef: rowRef[0],
8744 - min: -Number.MAX_SAFE_INTEGER
8745 - })), /* @__PURE__ */ react.createElement(Control$2, {
8746 - bind: "vOffset",
8747 - label: (0, _wordpress_i18n.__)("Vertical", "elementor")
8748 - }, /* @__PURE__ */ react.createElement(SizeControl, {
8749 - anchorRef: rowRef[0],
8750 - min: -Number.MAX_SAFE_INTEGER
8751 - }))), /* @__PURE__ */ react.createElement(PopoverGridContainer, { ref: rowRef[1] }, /* @__PURE__ */ react.createElement(Control$2, {
8752 - bind: "blur",
8753 - label: (0, _wordpress_i18n.__)("Blur", "elementor")
8754 - }, /* @__PURE__ */ react.createElement(SizeControl, { anchorRef: rowRef[1] })), /* @__PURE__ */ react.createElement(Control$2, {
8755 - bind: "spread",
8756 - label: (0, _wordpress_i18n.__)("Spread", "elementor")
8757 - }, /* @__PURE__ */ react.createElement(SizeControl, {
8758 - anchorRef: rowRef[1],
8759 - min: -Number.MAX_SAFE_INTEGER
8760 - })))));
8761 - }, "Content");
8762 - var Control$2 = /* @__PURE__ */ __name(({ label, bind, children, sx }) => /* @__PURE__ */ react.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
8763 - item: true,
8764 - xs: 6,
8765 - sx
8766 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
8767 - container: true,
8768 - gap: .75,
8769 - alignItems: "center"
8770 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
8771 - item: true,
8772 - xs: 12
8773 - }, /* @__PURE__ */ react.createElement(_elementor_ui.FormLabel, { size: "tiny" }, label)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
8774 - item: true,
8775 - xs: 12
8776 - }, children)))), "Control");
8777 - var ItemLabel$3 = /* @__PURE__ */ __name(({ value }) => {
8778 - const { position, hOffset, vOffset, blur, spread } = value.value;
8779 - const { size: blurSize = "", unit: blurUnit = "" } = blur?.value || {};
8780 - const { size: spreadSize = "", unit: spreadUnit = "" } = spread?.value || {};
8781 - const { size: hOffsetSize = "unset", unit: hOffsetUnit = "" } = hOffset?.value || {};
8782 - const { size: vOffsetSize = "unset", unit: vOffsetUnit = "" } = vOffset?.value || {};
8783 - const positionLabel = position?.value || "outset";
8784 - const sizes = [
8785 - [hOffsetSize, hOffsetUnit],
8786 - [vOffsetSize, vOffsetUnit],
8787 - [blurSize, blurUnit],
8788 - [spreadSize, spreadUnit]
8789 - ].map(([size, unit]) => {
8790 - if (unit !== "custom") return size + unit;
8791 - return !size ? "fx" : size;
8792 - }).join(" ");
8793 - return /* @__PURE__ */ react.createElement("span", { style: { textTransform: "capitalize" } }, positionLabel, ": ", sizes);
8794 - }, "ItemLabel");
8795 - var initialShadow = {
8796 - $$type: "shadow",
8797 - value: {
8798 - hOffset: {
8799 - $$type: "size",
8800 - value: {
8801 - unit: "px",
8802 - size: 0
8803 - }
8804 - },
8805 - vOffset: {
8806 - $$type: "size",
8807 - value: {
8808 - unit: "px",
8809 - size: 0
8810 - }
8811 - },
8812 - blur: {
8813 - $$type: "size",
8814 - value: {
8815 - unit: "px",
8816 - size: 10
8817 - }
8818 - },
8819 - spread: {
8820 - $$type: "size",
8821 - value: {
8822 - unit: "px",
8823 - size: 0
8824 - }
8825 - },
8826 - color: {
8827 - $$type: "color",
8828 - value: "rgba(0, 0, 0, 1)"
8829 - },
8830 - position: null
8831 - }
8832 - };
8833 -
8834 -//#endregion
8835 -//#region packages/packages/libs/editor-controls/src/controls/filter-control/configs.ts
8836 - var FILTERS_BY_GROUP = {
8837 - blur: { blur: {
8838 - name: (0, _wordpress_i18n.__)("Blur", "elementor"),
8839 - valueName: (0, _wordpress_i18n.__)("Radius", "elementor")
8840 - } },
8841 - intensity: {
8842 - brightness: { name: (0, _wordpress_i18n.__)("Brightness", "elementor") },
8843 - contrast: { name: (0, _wordpress_i18n.__)("Contrast", "elementor") },
8844 - saturate: { name: (0, _wordpress_i18n.__)("Saturate", "elementor") }
8845 - },
8846 - "hue-rotate": { "hue-rotate": {
8847 - name: (0, _wordpress_i18n.__)("Hue Rotate", "elementor"),
8848 - valueName: (0, _wordpress_i18n.__)("Angle", "elementor")
8849 - } },
8850 - "color-tone": {
8851 - grayscale: { name: (0, _wordpress_i18n.__)("Grayscale", "elementor") },
8852 - invert: { name: (0, _wordpress_i18n.__)("Invert", "elementor") },
8853 - sepia: { name: (0, _wordpress_i18n.__)("Sepia", "elementor") }
8854 - },
8855 - "drop-shadow": { "drop-shadow": {
8856 - name: (0, _wordpress_i18n.__)("Drop shadow", "elementor"),
8857 - valueName: (0, _wordpress_i18n.__)("Drop-shadow", "elementor")
8858 - } }
8859 - };
8860 -
8861 -//#endregion
8862 -//#region packages/packages/libs/editor-controls/src/controls/filter-control/utils.ts
8863 - var AMOUNT_VALUE_NAME = (0, _wordpress_i18n.__)("Amount", "elementor");
8864 - var DEFAULT_FACTORIES = { "drop-shadow": (propType) => buildDropShadowDefault(propType) };
8865 - function buildFilterConfig(cssFilterPropType) {
8866 - function createEntry(filterFunctionGroup, filterFunction, { name, valueName }) {
8867 - const propType = extractPropType(cssFilterPropType, filterFunctionGroup);
8868 - const defaultValue = createDefaultValue({
8869 - filterFunction,
8870 - filterFunctionGroup,
8871 - value: DEFAULT_FACTORIES[filterFunction]?.(propType) ?? buildSizeDefault(propType)
8872 - });
8873 - return [filterFunction, {
8874 - name,
8875 - valueName: valueName ?? AMOUNT_VALUE_NAME,
8876 - defaultValue,
8877 - filterFunctionGroup
8878 - }];
8879 - }
8880 - const entries = Object.entries(FILTERS_BY_GROUP).flatMap(([filterFunctionGroup, group]) => Object.entries(group).map(([filterFunction, meta]) => createEntry(filterFunctionGroup, filterFunction, meta)));
8881 - return Object.fromEntries(entries);
8882 - }
8883 - function createDefaultValue({ filterFunction, filterFunctionGroup, value }) {
8884 - return {
8885 - $$type: "css-filter-func",
8886 - value: {
8887 - func: {
8888 - $$type: "string",
8889 - value: filterFunction
8890 - },
8891 - args: {
8892 - $$type: filterFunctionGroup,
8893 - value
8894 - }
8895 - }
8896 - };
8897 - }
8898 - function buildSizeDefault(propType) {
8899 - return { size: (propType?.shape?.size)?.default };
8900 - }
8901 - function buildDropShadowDefault(propType) {
8902 - const dropShadowPropType = propType.shape;
8903 - return {
8904 - blur: dropShadowPropType?.blur?.default,
8905 - xAxis: dropShadowPropType?.xAxis?.default,
8906 - yAxis: dropShadowPropType?.yAxis?.default,
8907 - color: dropShadowPropType?.color?.default ?? (dropShadowPropType?.color).prop_types.color.default
8908 - };
8909 - }
8910 - function extractPropType(propType, filterFunctionGroup) {
8911 - return propType.shape?.args?.prop_types[filterFunctionGroup];
8912 - }
8913 -
8914 -//#endregion
8915 -//#region packages/packages/libs/editor-controls/src/controls/filter-control/context/filter-config-context.tsx
8916 - var FilterConfigContext = (0, react.createContext)(null);
8917 - function FilterConfigProvider({ children }) {
8918 - const propContext = useBoundProp(_elementor_editor_props.cssFilterFunctionPropUtil);
8919 - const contextValue = (0, react.useMemo)(() => {
8920 - const config = buildFilterConfig(propContext.propType.item_prop_type);
8921 - return {
8922 - config,
8923 - filterOptions: Object.entries(config).map(([key, conf]) => ({
8924 - value: key,
8925 - label: conf.name
8926 - })),
8927 - getFilterFunctionConfig: (filterFunction) => config[filterFunction],
8928 - getInitialValue: () => config.blur.defaultValue
8929 - };
8930 - }, [propContext.propType]);
8931 - return /* @__PURE__ */ react.createElement(FilterConfigContext.Provider, { value: contextValue }, children);
8932 - }
8933 - function useFilterConfig() {
8934 - const context = (0, react.useContext)(FilterConfigContext);
8935 - if (!context) throw new Error("useFilterConfig must be used within FilterConfigProvider");
8936 - return context;
8937 - }
8938 -
8939 -//#endregion
8940 -//#region packages/packages/libs/editor-controls/src/controls/filter-control/drop-shadow/drop-shadow-item-content.tsx
8941 - var items = [
8942 - {
8943 - bind: "xAxis",
8944 - label: (0, _wordpress_i18n.__)("X-axis", "elementor"),
8945 - rowIndex: 0
8946 - },
8947 - {
8948 - bind: "yAxis",
8949 - label: (0, _wordpress_i18n.__)("Y-axis", "elementor"),
8950 - rowIndex: 0
8951 - },
8952 - {
8953 - bind: "blur",
8954 - label: (0, _wordpress_i18n.__)("Blur", "elementor"),
8955 - rowIndex: 1
8956 - },
8957 - {
8958 - bind: "color",
8959 - label: (0, _wordpress_i18n.__)("Color", "elementor"),
8960 - rowIndex: 1
8961 - }
8962 - ];
8963 - var DropShadowItemContent = ({ anchorEl }) => {
8964 - const context = useBoundProp(_elementor_editor_props.dropShadowFilterPropTypeUtil);
8965 - const rowRefs = [(0, react.useRef)(null), (0, react.useRef)(null)];
8966 - return /* @__PURE__ */ react.createElement(PropProvider, { ...context }, items.map((item) => /* @__PURE__ */ react.createElement(PopoverGridContainer, {
8967 - key: item.bind,
8968 - ref: rowRefs[item.rowIndex] ?? null
8969 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: item.bind }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
8970 - item: true,
8971 - xs: 6
8972 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, item.label)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
8973 - item: true,
8974 - xs: 6
8975 - }, item.bind === "color" ? /* @__PURE__ */ react.createElement(ColorControl, { anchorEl }) : /* @__PURE__ */ react.createElement(SizeControl, {
8976 - anchorRef: rowRefs[item.rowIndex],
8977 - enablePropTypeUnits: true,
8978 - min: item.bind === "blur" ? 0 : -Number.MAX_SAFE_INTEGER,
8979 - defaultUnit: "px"
8980 - }))))));
8981 - };
8982 -
8983 -//#endregion
8984 -//#region packages/packages/libs/editor-controls/src/controls/filter-control/single-size/single-size-item-content.tsx
8985 - var propTypeMap = {
8986 - blur: _elementor_editor_props.blurFilterPropTypeUtil,
8987 - intensity: _elementor_editor_props.intensityFilterPropTypeUtil,
8988 - "hue-rotate": _elementor_editor_props.hueRotateFilterPropTypeUtil,
8989 - "color-tone": _elementor_editor_props.colorToneFilterPropTypeUtil
8990 - };
8991 - var SingleSizeItemContent = ({ filterFunc }) => {
8992 - const rowRef = (0, react.useRef)(null);
8993 - const { getFilterFunctionConfig } = useFilterConfig();
8994 - const { valueName, filterFunctionGroup } = getFilterFunctionConfig(filterFunc);
8995 - const context = useBoundProp(propTypeMap[filterFunctionGroup]);
8996 - return /* @__PURE__ */ react.createElement(PropProvider, { ...context }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: filterFunctionGroup }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ react.createElement(PopoverGridContainer, { ref: rowRef }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
8997 - item: true,
8998 - xs: 6
8999 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, valueName)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
9000 - item: true,
9001 - xs: 6
9002 - }, /* @__PURE__ */ react.createElement(SizeControl, {
9003 - anchorRef: rowRef,
9004 - enablePropTypeUnits: true
9005 - }))))));
9006 - };
9007 -
9008 -//#endregion
9009 -//#region packages/packages/libs/editor-controls/src/controls/filter-control/filter-content.tsx
9010 - var FilterContent = () => {
9011 - const propContext = useBoundProp(_elementor_editor_props.cssFilterFunctionPropUtil);
9012 - const { filterOptions, getFilterFunctionConfig } = useFilterConfig();
9013 - const handleValueChange = (value, _, meta) => {
9014 - let newValue = structuredClone(value);
9015 - const funcConfig = getFilterFunctionConfig(newValue?.func.value);
9016 - if (meta?.bind === "func") newValue = funcConfig.defaultValue.value;
9017 - if (!newValue.args) return;
9018 - propContext.setValue(newValue);
9019 - };
9020 - return /* @__PURE__ */ react.createElement(PropProvider, {
9021 - ...propContext,
9022 - setValue: handleValueChange
9023 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "css-filter-func" }, /* @__PURE__ */ react.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ react.createElement(PopoverGridContainer, null, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
9024 - item: true,
9025 - xs: 6
9026 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Filter", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
9027 - item: true,
9028 - xs: 6
9029 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "func" }, /* @__PURE__ */ react.createElement(SelectControl, { options: filterOptions })))), /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "args" }, /* @__PURE__ */ react.createElement(FilterValueContent, null)))));
9030 - };
9031 - var FilterValueContent = () => {
9032 - const { openItemIndex, items } = useRepeaterContext();
9033 - const filterFunc = items[openItemIndex].item.value.func.value;
9034 - if (filterFunc === "drop-shadow") return /* @__PURE__ */ react.createElement(DropShadowItemContent, null);
9035 - return /* @__PURE__ */ react.createElement(SingleSizeItemContent, { filterFunc });
9036 - };
9037 -
9038 -//#endregion
9039 -//#region packages/packages/libs/editor-controls/src/controls/filter-control/filter-icon.tsx
9040 - var FilterIcon = ({ value }) => {
9041 - if (value.value.func.value !== "drop-shadow") return null;
9042 - return /* @__PURE__ */ react.createElement(StyledUnstableColorIndicator$1, {
9043 - size: "inherit",
9044 - component: "span",
9045 - value: value.value.args.value?.color.value
9046 - });
9047 - };
9048 - var StyledUnstableColorIndicator$1 = (0, _elementor_ui.styled)(_elementor_ui.UnstableColorIndicator)(({ theme }) => ({ borderRadius: `${theme.shape.borderRadius / 2}px` }));
9049 -
9050 -//#endregion
9051 -//#region packages/packages/libs/editor-controls/src/controls/filter-control/drop-shadow/drop-shadow-item-label.tsx
9052 - var DropShadowItemLabel = ({ value }) => {
9053 - const values = value.value.args.value;
9054 - const labels = [
9055 - "xAxis",
9056 - "yAxis",
9057 - "blur"
9058 - ].map((key) => values[key]?.value?.unit !== "custom" ? `${values[key]?.value?.size ?? 0}${values[key]?.value?.unit ?? "px"}` : values[key]?.value?.size || "fx");
9059 - return /* @__PURE__ */ react.createElement(_elementor_ui.Box, { component: "span" }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
9060 - component: "span",
9061 - style: { textTransform: "capitalize" }
9062 - }, (0, _wordpress_i18n.__)("Drop shadow:", "elementor")), ` ${labels.join(" ")}`);
9063 - };
9064 -
9065 -//#endregion
9066 -//#region packages/packages/libs/editor-controls/src/controls/filter-control/single-size/single-size-item-label.tsx
9067 - var SingleSizeItemLabel = ({ value }) => {
9068 - const { func, args } = value.value;
9069 - const { getFilterFunctionConfig } = useFilterConfig();
9070 - const { defaultValue } = getFilterFunctionConfig(func.value ?? "");
9071 - const defaultUnit = defaultValue.value.args.value?.size?.value?.unit ?? lengthUnits[0];
9072 - const { unit, size } = args.value.size?.value ?? {
9073 - unit: defaultUnit,
9074 - size: 0
9075 - };
9076 - const label = /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
9077 - component: "span",
9078 - style: { textTransform: "capitalize" }
9079 - }, func.value ?? "", ":");
9080 - return /* @__PURE__ */ react.createElement(_elementor_ui.Box, { component: "span" }, label, " " + (unit !== "custom" ? `${size ?? 0}${unit ?? defaultUnit}` : size || "fx"));
9081 - };
9082 -
9083 -//#endregion
9084 -//#region packages/packages/libs/editor-controls/src/controls/filter-control/filter-label.tsx
9085 - var FilterLabel = ({ value }) => {
9086 - if (value.value.func.value === "drop-shadow") return /* @__PURE__ */ react.createElement(DropShadowItemLabel, { value });
9087 - return /* @__PURE__ */ react.createElement(SingleSizeItemLabel, { value });
9088 - };
9089 -
9090 -//#endregion
9091 -//#region packages/packages/libs/editor-controls/src/controls/filter-control/filter-repeater-control.tsx
9092 - var FILTER_CONFIG = {
9093 - filter: {
9094 - propTypeUtil: _elementor_editor_props.filterPropTypeUtil,
9095 - label: (0, _wordpress_i18n.__)("Filters", "elementor")
9096 - },
9097 - "backdrop-filter": {
9098 - propTypeUtil: _elementor_editor_props.backdropFilterPropTypeUtil,
9099 - label: (0, _wordpress_i18n.__)("Backdrop filters", "elementor")
9100 - }
9101 - };
9102 - var FilterRepeaterControl = createControl(({ filterPropName = "filter" }) => {
9103 - const { propTypeUtil, label } = ensureFilterConfig(filterPropName);
9104 - const { propType, value: filterValues, setValue } = useBoundProp(propTypeUtil);
9105 - return /* @__PURE__ */ react.createElement(FilterConfigProvider, null, /* @__PURE__ */ react.createElement(PropProvider, {
9106 - propType,
9107 - value: filterValues,
9108 - setValue
9109 - }, /* @__PURE__ */ react.createElement(Repeater$2, {
9110 - propTypeUtil,
9111 - label,
9112 - filterPropName
9113 - })));
9114 - });
9115 - var Repeater$2 = /* @__PURE__ */ __name(({ propTypeUtil, label, filterPropName }) => {
9116 - const { getInitialValue } = useFilterConfig();
9117 - return /* @__PURE__ */ react.createElement(ControlRepeater, {
9118 - initial: getInitialValue(),
9119 - propTypeUtil
9120 - }, /* @__PURE__ */ react.createElement(RepeaterHeader, { label }, /* @__PURE__ */ react.createElement(TooltipAddItemAction, {
9121 - newItemIndex: 0,
9122 - ariaLabel: filterPropName === "backdrop-filter" ? "backdrop filter" : "filter"
9123 - })), /* @__PURE__ */ react.createElement(ItemsContainer, null, /* @__PURE__ */ react.createElement(Item, {
9124 - Label: FilterLabel,
9125 - Icon: FilterIcon,
9126 - actions: /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(DuplicateItemAction, null), /* @__PURE__ */ react.createElement(DisableItemAction, null), /* @__PURE__ */ react.createElement(RemoveItemAction, null))
9127 - })), /* @__PURE__ */ react.createElement(EditItemPopover, null, /* @__PURE__ */ react.createElement(FilterContent, null)));
9128 - }, "Repeater");
9129 - function ensureFilterConfig(name) {
9130 - if (name && name in FILTER_CONFIG) return FILTER_CONFIG[name];
9131 - return FILTER_CONFIG.filter;
9132 - }
9133 -
9134 -//#endregion
9135 -//#region packages/packages/libs/editor-controls/src/controls/select-control-wrapper.tsx
9136 - var getOffCanvasElements = () => {
9137 - const extendedWindow = window;
9138 - const documentId = extendedWindow.elementor.config.document.id;
9139 - const offCanvasElements = extendedWindow.elementor.$previewContents[0].querySelectorAll(`[data-elementor-id="${documentId}"] .elementor-widget-off-canvas.elementor-element-edit-mode`);
9140 - return Array.from(offCanvasElements).map((offCanvasElement) => {
9141 - return {
9142 - label: offCanvasElement.querySelector(".e-off-canvas")?.getAttribute("aria-label") ?? "",
9143 - value: offCanvasElement.dataset.id
9144 - };
9145 - });
9146 - };
9147 - var getFormElements = () => {
9148 - const extendedWindow = window;
9149 - const documentId = extendedWindow.elementor.config.document.id;
9150 - const selectors = [
9151 - `[data-elementor-id="${documentId}"] input[id]:not([type="hidden"]):not([type="reset"]):not([type="button"])`,
9152 - `[data-elementor-id="${documentId}"] select[id]`,
9153 - `[data-elementor-id="${documentId}"] textarea[id]`
9154 - ];
9155 - const formElements = extendedWindow.elementor.$previewContents[0].querySelectorAll(selectors.join(", "));
9156 - return Array.from(formElements).map((formElement) => {
9157 - const tagName = formElement.tagName.toLowerCase();
9158 - return {
9159 - label: `${formElement.id} (${tagName === "input" ? formElement.getAttribute("type") : tagName})`,
9160 - value: formElement.id
9161 - };
9162 - });
9163 - };
9164 - var collectionMethods = {
9165 - "off-canvas": getOffCanvasElements,
9166 - "form-elements": getFormElements
9167 - };
9168 - var useDynamicOptions = (collectionId, initialOptions) => {
9169 - const [options, setOptions] = (0, react.useState)(initialOptions ?? []);
9170 - (0, react.useEffect)(() => {
9171 - if (!collectionId || !collectionMethods[collectionId]) {
9172 - setOptions(initialOptions ?? []);
9173 - return;
9174 - }
9175 - setOptions(collectionMethods[collectionId]());
9176 - }, [collectionId, initialOptions]);
9177 - return options;
9178 - };
9179 - var SelectControlWrapper = createControl(({ collectionId, options, ...props }) => {
9180 - const actualOptions = useDynamicOptions(collectionId, options);
9181 - return /* @__PURE__ */ react.createElement(SelectControl, {
9182 - options: actualOptions,
9183 - ...props
9184 - });
9185 - });
9186 -
9187 -//#endregion
9188 -//#region packages/packages/libs/editor-controls/src/components/chips-list.tsx
9189 - var CHIP_SIZE = "tiny";
9190 - function ChipsList({ getLabel, getTagProps, values }) {
9191 - return /* @__PURE__ */ react.createElement(react.Fragment, null, values.map((option, index) => {
9192 - const { key, ...tagProps } = getTagProps({ index });
9193 - return /* @__PURE__ */ react.createElement(_elementor_ui.Chip, {
9194 - key,
9195 - label: getLabel(option),
9196 - size: CHIP_SIZE,
9197 - ...tagProps
9198 - });
9199 - }));
9200 - }
9201 -
9202 -//#endregion
9203 -//#region packages/packages/libs/editor-controls/src/controls/chips-control.tsx
9204 - var SIZE$6 = "tiny";
9205 - var toChipsOption = (val, options) => options.find((opt) => opt.value === val) ?? {
9206 - label: val,
9207 - value: val
9208 - };
9209 - var ChipsControl = createControl(({ options, freeChips }) => {
9210 - const { value, setValue, disabled } = useBoundProp(_elementor_editor_props.stringArrayPropTypeUtil);
9211 - const selectedOptions = (value || []).map((item) => _elementor_editor_props.stringPropTypeUtil.extract(item)).filter((val) => val !== null).map((val) => toChipsOption(val, options));
9212 - const handleChange = (_, newValue) => {
9213 - setValue(newValue.map((option) => _elementor_editor_props.stringPropTypeUtil.create(typeof option === "string" ? option : option.value)));
9214 - };
9215 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.Autocomplete, {
9216 - fullWidth: true,
9217 - multiple: true,
9218 - freeSolo: freeChips,
9219 - size: SIZE$6,
9220 - disabled,
9221 - value: selectedOptions,
9222 - filterSelectedOptions: true,
9223 - onChange: handleChange,
9224 - options,
9225 - getOptionLabel: (option) => typeof option === "string" ? option : option.label,
9226 - isOptionEqualToValue: (option, val) => option.value === val.value,
9227 - renderInput: (params) => /* @__PURE__ */ react.createElement(_elementor_ui.TextField, { ...params }),
9228 - renderTags: (tagValues, getTagProps) => /* @__PURE__ */ react.createElement(ChipsList, {
9229 - getLabel: (option) => typeof option === "string" ? option : option.label,
9230 - getTagProps,
9231 - values: tagValues
9232 - })
9233 - }));
9234 - });
9235 -
9236 -//#endregion
9237 -//#region packages/packages/libs/editor-controls/src/components/conditional-tooltip.tsx
9238 - var ConditionalTooltip = ({ showTooltip, children, label }) => {
9239 - return showTooltip && label ? /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
9240 - title: label,
9241 - disableFocusListener: true,
9242 - placement: "top"
9243 - }, children) : children;
9244 - };
9245 -
9246 -//#endregion
9247 -//#region packages/packages/libs/editor-controls/src/components/control-toggle-button-group.tsx
9248 - var StyledToggleButtonGroup = (0, _elementor_ui.styled)(_elementor_ui.ToggleButtonGroup)`
9249 - ${({ justify }) => `justify-content: ${justify};`}
9250 - button:not( :last-of-type ) {
9251 - border-start-end-radius: 0;
9252 - border-end-end-radius: 0;
9253 - }
9254 - button:not( :first-of-type ) {
9255 - border-start-start-radius: 0;
9256 - border-end-start-radius: 0;
9257 - }
9258 - button:last-of-type {
9259 - border-start-end-radius: 8px;
9260 - border-end-end-radius: 8px;
9261 - }
9262 -`;
9263 - var StyledToggleButton = (0, _elementor_ui.styled)(_elementor_ui.ToggleButton, { shouldForwardProp: (prop) => prop !== "isPlaceholder" })`
9264 - ${({ theme, isPlaceholder }) => isPlaceholder && `
9265 - color: ${theme.palette.text.tertiary};
9266 - background-color: ${theme.palette.mode === "dark" ? "rgba(255,255,255,0.04)" : "rgba(0,0,0,0.02)"};
9267 -
9268 - &:hover {
9269 - background-color: ${theme.palette.mode === "dark" ? "rgba(255,255,255,0.08)" : "rgba(0,0,0,0.04)"};
9270 - }
9271 - `}
9272 -`;
9273 - var ToggleButtonGroupUi = react.forwardRef(({ justify = "end", size = "tiny", value, onChange, items, maxItems, exclusive = false, fullWidth = false, disabled, placeholder }, ref) => {
9274 - const shouldSliceItems = exclusive && maxItems !== void 0 && items.length > maxItems;
9275 - const menuItems = shouldSliceItems ? items.slice(maxItems - 1) : [];
9276 - const fixedItems = shouldSliceItems ? items.slice(0, maxItems - 1) : items;
9277 - const isRtl = "rtl" === (0, _elementor_ui.useTheme)().direction;
9278 - const handleChange = (_, newValue) => {
9279 - onChange(newValue);
9280 - };
9281 - const getGridTemplateColumns = (0, react.useMemo)(() => {
9282 - const isOffLimits = menuItems?.length;
9283 - const itemsCount = isOffLimits ? fixedItems.length + 1 : fixedItems.length;
9284 - const templateColumnsSuffix = isOffLimits ? "auto" : "";
9285 - if (fullWidth) return `repeat(${itemsCount}, 1fr) ${templateColumnsSuffix}`;
9286 - return `repeat(${itemsCount}, minmax(0, 25%)) ${templateColumnsSuffix}`;
9287 - }, [
9288 - menuItems?.length,
9289 - fixedItems.length,
9290 - fullWidth
9291 - ]);
9292 - const shouldShowExclusivePlaceholder = exclusive && (value === null || value === void 0 || value === "");
9293 - const nonExclusiveSelectedValues = !exclusive && Array.isArray(value) ? value.map((v) => typeof v === "string" ? v : "").join(" ").trim().split(/\s+/).filter(Boolean) : [];
9294 - const shouldShowNonExclusivePlaceholder = !exclusive && nonExclusiveSelectedValues.length === 0;
9295 - const getPlaceholderArray = (placeholderValue) => {
9296 - if (Array.isArray(placeholderValue)) return placeholderValue.flatMap((p) => {
9297 - if (typeof p === "string") return p.trim().split(/\s+/).filter(Boolean);
9298 - return [];
9299 - });
9300 - if (typeof placeholderValue === "string") return placeholderValue.trim().split(/\s+/).filter(Boolean);
9301 - return [];
9302 - };
9303 - const placeholderArray = getPlaceholderArray(placeholder);
9304 - return /* @__PURE__ */ react.createElement(StyledToggleButtonGroup, {
9305 - ref,
9306 - justify,
9307 - value,
9308 - onChange: handleChange,
9309 - exclusive,
9310 - disabled,
9311 - sx: {
9312 - direction: isRtl ? "rtl /* @noflip */" : "ltr /* @noflip */",
9313 - display: "grid",
9314 - gridTemplateColumns: getGridTemplateColumns,
9315 - width: `100%`
9316 - }
9317 - }, fixedItems.map(({ label, value: buttonValue, renderContent: Content, showTooltip, disabled: optionDisabled = false }) => {
9318 - const isPlaceholder = placeholderArray.length > 0 && placeholderArray.includes(buttonValue) && (shouldShowExclusivePlaceholder || shouldShowNonExclusivePlaceholder);
9319 - return /* @__PURE__ */ react.createElement(ConditionalTooltip, {
9320 - key: buttonValue,
9321 - label,
9322 - showTooltip: showTooltip || false
9323 - }, /* @__PURE__ */ react.createElement(StyledToggleButton, {
9324 - value: buttonValue,
9325 - "aria-label": label,
9326 - size,
9327 - fullWidth,
9328 - isPlaceholder,
9329 - disabled: optionDisabled
9330 - }, /* @__PURE__ */ react.createElement(Content, { size })));
9331 - }), menuItems.length && exclusive && /* @__PURE__ */ react.createElement(SplitButtonGroup, {
9332 - size,
9333 - value: value || null,
9334 - onChange,
9335 - items: menuItems,
9336 - fullWidth
9337 - }));
9338 - });
9339 - var ControlToggleButtonGroup = (props) => {
9340 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(ToggleButtonGroupUi, { ...props }));
9341 - };
9342 - var SplitButtonGroup = ({ size = "tiny", onChange, items, fullWidth, value }) => {
9343 - const previewButton = usePreviewButton(items, value);
9344 - const [isMenuOpen, setIsMenuOpen] = (0, react.useState)(false);
9345 - const menuButtonRef = (0, react.useRef)(null);
9346 - const onMenuToggle = (ev) => {
9347 - setIsMenuOpen((prev) => !prev);
9348 - ev.preventDefault();
9349 - };
9350 - const onMenuItemClick = (newValue) => {
9351 - setIsMenuOpen(false);
9352 - onToggleItem(newValue);
9353 - };
9354 - const onToggleItem = (newValue) => {
9355 - onChange(newValue === value ? null : newValue);
9356 - };
9357 - return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(_elementor_ui.ToggleButton, {
9358 - value: previewButton.value,
9359 - "aria-label": previewButton.label,
9360 - size,
9361 - fullWidth,
9362 - onClick: (ev) => {
9363 - ev.preventDefault();
9364 - onMenuItemClick(previewButton.value);
9365 - }
9366 - }, previewButton.renderContent({ size })), /* @__PURE__ */ react.createElement(_elementor_ui.ToggleButton, {
9367 - size,
9368 - "aria-expanded": isMenuOpen ? "true" : void 0,
9369 - "aria-haspopup": "menu",
9370 - "aria-pressed": void 0,
9371 - onClick: onMenuToggle,
9372 - ref: menuButtonRef,
9373 - value: "__chevron-icon-button__"
9374 - }, /* @__PURE__ */ react.createElement(_elementor_icons.ChevronDownIcon, { fontSize: size })), /* @__PURE__ */ react.createElement(_elementor_ui.Menu, {
9375 - open: isMenuOpen,
9376 - onClose: () => setIsMenuOpen(false),
9377 - anchorEl: menuButtonRef.current,
9378 - anchorOrigin: {
9379 - vertical: "bottom",
9380 - horizontal: "right"
9381 - },
9382 - transformOrigin: {
9383 - vertical: "top",
9384 - horizontal: "right"
9385 - },
9386 - sx: { mt: .5 }
9387 - }, items.filter((item) => item.value !== previewButton.value).map(({ label, value: buttonValue }) => /* @__PURE__ */ react.createElement(_elementor_ui.MenuItem, {
9388 - key: buttonValue,
9389 - selected: buttonValue === value,
9390 - onClick: () => onMenuItemClick(buttonValue)
9391 - }, /* @__PURE__ */ react.createElement(_elementor_ui.ListItemText, null, /* @__PURE__ */ react.createElement(_elementor_ui.Typography, { sx: { fontSize: "14px" } }, label))))));
9392 - };
9393 - var usePreviewButton = (items, value) => {
9394 - const [previewButton, setPreviewButton] = (0, react.useState)(items.find((item) => item.value === value) ?? items[0]);
9395 - (0, react.useEffect)(() => {
9396 - const selectedButton = items.find((item) => item.value === value);
9397 - if (selectedButton) setPreviewButton(selectedButton);
9398 - }, [items, value]);
9399 - return previewButton;
9400 - };
9401 -
9402 -//#endregion
9403 -//#region packages/packages/libs/editor-controls/src/utils/convert-toggle-options-to-atomic.tsx
9404 - var convertToggleOptionsToAtomic = (options) => {
9405 - return options.map((option) => {
9406 - const IconComponent = _elementor_icons[option.icon];
9407 - return {
9408 - value: option.value,
9409 - label: option.label,
9410 - renderContent: ({ size }) => {
9411 - if (IconComponent) return /* @__PURE__ */ react.createElement(IconComponent, { fontSize: size });
9412 - return option.label;
9413 - },
9414 - showTooltip: option.showTooltip,
9415 - exclusive: option.exclusive
9416 - };
9417 - });
9418 - };
9419 -
9420 -//#endregion
9421 -//#region packages/packages/libs/editor-controls/src/controls/toggle-control.tsx
9422 - var ToggleControl = createControl(({ options, fullWidth = false, size = "tiny", exclusive = true, maxItems, convertOptions = false, allowEmpty = false }) => {
9423 - const { value, setValue, placeholder, disabled } = useBoundProp(_elementor_editor_props.stringPropTypeUtil);
9424 - const processedOptions = convertOptions ? convertToggleOptionsToAtomic(options) : options;
9425 - const exclusiveValues = processedOptions.filter((option) => option.exclusive).map((option) => option.value);
9426 - const handleNonExclusiveToggle = (selectedValues) => {
9427 - const newSelectedValue = selectedValues[selectedValues.length - 1];
9428 - const updatedValues = exclusiveValues.includes(newSelectedValue) ? [newSelectedValue] : selectedValues?.filter((val) => !exclusiveValues.includes(val));
9429 - setValue(updatedValues?.join(" ") || null);
9430 - };
9431 - const toggleButtonGroupProps = {
9432 - items: processedOptions,
9433 - maxItems,
9434 - fullWidth,
9435 - size,
9436 - placeholder
9437 - };
9438 - const handleExclusiveToggle = (selectedValue) => {
9439 - if (allowEmpty && !selectedValue) {
9440 - setValue("");
9441 - return;
9442 - }
9443 - setValue(selectedValue);
9444 - };
9445 - return exclusive ? /* @__PURE__ */ react.createElement(ControlToggleButtonGroup, {
9446 - ...toggleButtonGroupProps,
9447 - value: allowEmpty ? value || null : value ?? null,
9448 - onChange: handleExclusiveToggle,
9449 - disabled,
9450 - exclusive: true
9451 - }) : /* @__PURE__ */ react.createElement(ControlToggleButtonGroup, {
9452 - ...toggleButtonGroupProps,
9453 - value: value?.split(" ") ?? [],
9454 - onChange: handleNonExclusiveToggle,
9455 - disabled,
9456 - exclusive: false
9457 - });
9458 - });
9459 -
9460 -//#endregion
9461 -//#region packages/packages/libs/editor-controls/src/controls/number-control.tsx
9462 - var isEmptyOrNaN = (value) => value === null || value === void 0 || value === "" || Number.isNaN(Number(value));
9463 - var renderSuffix = (propType) => {
9464 - if (propType.meta?.suffix) return /* @__PURE__ */ react.createElement(_elementor_ui.InputAdornment, { position: "end" }, /* @__PURE__ */ react.createElement(_elementor_ui.Typography, {
9465 - variant: "caption",
9466 - color: "text.secondary"
9467 - }, propType.meta.suffix));
9468 - return /* @__PURE__ */ react.createElement(react.Fragment, null);
9469 - };
9470 - var NumberControl = createControl(({ placeholder: labelPlaceholder, max = Number.MAX_SAFE_INTEGER, min = -Number.MAX_SAFE_INTEGER, step = 1, shouldForceInt = false, startIcon, disabled: inputDisabled }) => {
9471 - const { value, setValue, placeholder, disabled, restoreValue, propType } = useBoundProp(_elementor_editor_props.numberPropTypeUtil);
9472 - const handleChange = (event) => {
9473 - const { value: eventValue, validity: { valid: isInputValid } } = event.target;
9474 - let updatedValue;
9475 - if (isEmptyOrNaN(eventValue)) updatedValue = null;
9476 - else {
9477 - const formattedValue = shouldForceInt ? +parseInt(eventValue) : Number(eventValue);
9478 - updatedValue = Math.min(Math.max(formattedValue, min ?? Number.MIN_SAFE_INTEGER), max ?? Number.MAX_SAFE_INTEGER);
9479 - }
9480 - setValue(updatedValue, void 0, { validation: () => isInputValid });
9481 - };
9482 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(NumberInput, {
9483 - size: "tiny",
9484 - type: "number",
9485 - fullWidth: true,
9486 - disabled: inputDisabled ?? disabled,
9487 - value: isEmptyOrNaN(value) ? "" : value,
9488 - onInput: handleChange,
9489 - onBlur: restoreValue,
9490 - placeholder: labelPlaceholder ?? (isEmptyOrNaN(placeholder) ? "" : String(placeholder)),
9491 - inputProps: {
9492 - step,
9493 - min
9494 - },
9495 - InputProps: {
9496 - startAdornment: startIcon ? /* @__PURE__ */ react.createElement(_elementor_ui.InputAdornment, {
9497 - position: "start",
9498 - disabled: inputDisabled ?? disabled
9499 - }, startIcon) : void 0,
9500 - endAdornment: renderSuffix(propType)
9501 - }
9502 - }));
9503 - });
9504 -
9505 -//#endregion
9506 -//#region packages/packages/libs/editor-controls/src/controls/equal-unequal-sizes-control.tsx
9507 - function EqualUnequalSizesControl({ label, icon, tooltipLabel, items, multiSizePropTypeUtil }) {
9508 - const popupState = (0, _elementor_ui.usePopupState)({
9509 - variant: "popover",
9510 - popupId: (0, react.useId)()
9511 - });
9512 - const rowRefs = [(0, react.useRef)(null), (0, react.useRef)(null)];
9513 - const { propType: multiSizePropType, disabled: multiSizeDisabled } = useBoundProp(multiSizePropTypeUtil);
9514 - const { value: masterValue, setValue: setMasterValue, placeholder: masterPlaceholder } = useBoundProp();
9515 - const getMultiSizeValues = (sourceValue) => {
9516 - if (multiSizePropTypeUtil.isValid(sourceValue)) return sourceValue.value;
9517 - const propValue = {};
9518 - items.forEach((item) => {
9519 - propValue[item.bind] = sourceValue;
9520 - });
9521 - return multiSizePropTypeUtil.create(propValue)?.value;
9522 - };
9523 - const isShowingGeneralIndicator = !popupState.isOpen;
9524 - const derivedValue = getMultiSizeValues(masterValue);
9525 - const derivedPlaceholder = getMultiSizeValues(masterPlaceholder);
9526 - const isEqualValues = (values) => {
9527 - if (!values) return true;
9528 - const multiSizeValue = multiSizePropTypeUtil.create(values);
9529 - const propValue = {};
9530 - items.forEach((item) => {
9531 - propValue[item.bind] = multiSizeValue?.value?.[item.bind] ?? null;
9532 - });
9533 - const allValues = Object.values(propValue).map((value) => JSON.stringify(value));
9534 - return allValues.every((value) => value === allValues[0]);
9535 - };
9536 - const isMixedPlaceholder = !masterValue && !isEqualValues(derivedPlaceholder);
9537 - const isMixed = isMixedPlaceholder || !isEqualValues(derivedValue);
9538 - const applyMultiSizeValue = (newValue) => {
9539 - if (!isEqualValues(newValue)) {
9540 - setMasterValue(multiSizePropTypeUtil.create(newValue));
9541 - return;
9542 - }
9543 - setMasterValue(Object.values(newValue)?.pop() ?? null);
9544 - };
9545 - return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
9546 - container: true,
9547 - gap: 2,
9548 - alignItems: "center",
9549 - flexWrap: "nowrap",
9550 - ref: rowRefs[0]
9551 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
9552 - item: true,
9553 - xs: 6
9554 - }, !isShowingGeneralIndicator ? /* @__PURE__ */ react.createElement(ControlFormLabel, null, label) : /* @__PURE__ */ react.createElement(ControlLabel, null, label)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
9555 - item: true,
9556 - xs: 6
9557 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
9558 - direction: "row",
9559 - alignItems: "center",
9560 - gap: 1
9561 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, { flexGrow: 1 }, /* @__PURE__ */ react.createElement(SizeControl, {
9562 - placeholder: isMixed ? (0, _wordpress_i18n.__)("Mixed", "elementor") : void 0,
9563 - enablePropTypeUnits: !isMixed || !isMixedPlaceholder,
9564 - anchorRef: rowRefs[0]
9565 - })), /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
9566 - title: tooltipLabel,
9567 - placement: "top"
9568 - }, /* @__PURE__ */ react.createElement(StyledToggleButton, {
9569 - size: "tiny",
9570 - value: "check",
9571 - sx: { marginLeft: "auto" },
9572 - ...(0, _elementor_ui.bindToggle)(popupState),
9573 - selected: popupState.isOpen,
9574 - isPlaceholder: isMixedPlaceholder,
9575 - "aria-label": tooltipLabel
9576 - }, icon))))), /* @__PURE__ */ react.createElement(_elementor_ui.Popover, {
9577 - disablePortal: true,
9578 - disableScrollLock: true,
9579 - anchorOrigin: {
9580 - vertical: "bottom",
9581 - horizontal: "right"
9582 - },
9583 - transformOrigin: {
9584 - vertical: "top",
9585 - horizontal: "right"
9586 - },
9587 - ...(0, _elementor_ui.bindPopover)(popupState),
9588 - slotProps: { paper: { sx: {
9589 - mt: .5,
9590 - width: rowRefs[0].current?.getBoundingClientRect().width
9591 - } } }
9592 - }, /* @__PURE__ */ react.createElement(PropProvider, {
9593 - propType: multiSizePropType,
9594 - value: derivedValue,
9595 - placeholder: derivedPlaceholder,
9596 - setValue: applyMultiSizeValue,
9597 - isDisabled: () => multiSizeDisabled
9598 - }, /* @__PURE__ */ react.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ react.createElement(PopoverGridContainer, { ref: rowRefs[1] }, /* @__PURE__ */ react.createElement(MultiSizeValueControl, {
9599 - item: items[0],
9600 - rowRef: rowRefs[1]
9601 - }), /* @__PURE__ */ react.createElement(MultiSizeValueControl, {
9602 - item: items[1],
9603 - rowRef: rowRefs[1]
9604 - })), /* @__PURE__ */ react.createElement(PopoverGridContainer, { ref: rowRefs[2] }, /* @__PURE__ */ react.createElement(MultiSizeValueControl, {
9605 - item: items[2],
9606 - rowRef: rowRefs[2]
9607 - }), /* @__PURE__ */ react.createElement(MultiSizeValueControl, {
9608 - item: items[3],
9609 - rowRef: rowRefs[2]
9610 - }))))));
9611 - }
9612 - var MultiSizeValueControl = ({ item, rowRef }) => {
9613 - const { bind, label, icon, ariaLabel } = item;
9614 - return /* @__PURE__ */ react.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
9615 - item: true,
9616 - xs: 6
9617 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
9618 - container: true,
9619 - gap: .75,
9620 - alignItems: "center"
9621 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
9622 - item: true,
9623 - xs: 12
9624 - }, /* @__PURE__ */ react.createElement(ControlLabel, null, label)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
9625 - item: true,
9626 - xs: 12
9627 - }, /* @__PURE__ */ react.createElement(SizeControl, {
9628 - startIcon: icon,
9629 - ariaLabel,
9630 - anchorRef: rowRef
9631 - })))));
9632 - };
9633 -
9634 -//#endregion
9635 -//#region packages/packages/libs/editor-controls/src/controls/size-control/sync/get-units.ts
9636 - var getLengthUnits = () => {
9637 - return window.elementor?.config?.size_units?.length ?? [];
9638 - };
9639 - var getAngleUnits = () => {
9640 - return window.elementor?.config?.size_units?.angle ?? [];
9641 - };
9642 - var getTimeUnits = () => {
9643 - return window.elementor?.config?.size_units?.time ?? [];
9644 - };
9645 - var getExtendedUnits = () => {
9646 - return window.elementor?.config?.size_units?.extended_units ?? [];
9647 - };
9648 -
9649 -//#endregion
9650 -//#region packages/packages/libs/editor-controls/src/controls/size-control/utils/is-extended-unit.ts
9651 - var isExtendedUnit = (unit) => {
9652 - return getExtendedUnits().includes(unit);
9653 - };
9654 -
9655 -//#endregion
9656 -//#region packages/packages/libs/editor-controls/src/controls/size-control/hooks/use-size-unit-keyboard.tsx
9657 - var UNIT_KEY_PATTERN = /^[a-zA-Z%]$/;
9658 - var useSizeUnitKeyboard = ({ unit, units, onUnitChange }) => {
9659 - const { appendKey, startsWith } = useTypingBuffer();
9660 - const onUnitKeyDown = (event) => {
9661 - if (units.length === 0) return;
9662 - const { key, altKey, ctrlKey, metaKey } = event;
9663 - if (altKey || ctrlKey || metaKey) return;
9664 - if (isExtendedUnit(unit) && isNumericValue(key)) {
9665 - const [defaultUnit] = units;
9666 - if (defaultUnit) onUnitChange(defaultUnit);
9667 - return;
9668 - }
9669 - if (!UNIT_KEY_PATTERN.test(key)) return;
9670 - event.preventDefault();
9671 - const updatedBuffer = appendKey(key.toLowerCase());
9672 - const matchedUnit = units.find((u) => startsWith(u, updatedBuffer));
9673 - if (matchedUnit) onUnitChange(matchedUnit);
9674 - };
9675 - return { onUnitKeyDown };
9676 - };
9677 - var isNumericValue = (value) => {
9678 - if (typeof value === "number") return !isNaN(value);
9679 - if (typeof value === "string") return value.trim() !== "" && !isNaN(Number(value));
9680 - return false;
9681 - };
9682 -
9683 -//#endregion
9684 -//#region packages/packages/libs/editor-controls/src/controls/size-control/utils/resolve-size-value.ts
9685 - var DEFAULT_SIZE$1 = "";
9686 - var EXTENDED_UNITS = {
9687 - auto: "auto",
9688 - custom: "custom"
9689 - };
9690 - var resolveSizeValue = (value, context) => {
9691 - if (!value) return value;
9692 - const { units, defaultUnit } = context;
9693 - const unit = resolveFallbackUnit(value.unit, units, defaultUnit);
9694 - if (unit === EXTENDED_UNITS.auto) return {
9695 - size: DEFAULT_SIZE$1,
9696 - unit
9697 - };
9698 - if (unit === EXTENDED_UNITS.custom) return {
9699 - size: String(value.size ?? DEFAULT_SIZE$1),
9700 - unit
9701 - };
9702 - return {
9703 - size: sanitizeSize(value.size) ?? DEFAULT_SIZE$1,
9704 - unit
9705 - };
9706 - };
9707 - var resolveSizeOnUnitChange = (size, unit) => {
9708 - return isExtendedUnit(unit) ? DEFAULT_SIZE$1 : size;
9709 - };
9710 - var createDefaultSizeValue = (units, defaultUnit) => {
9711 - let [unit] = units;
9712 - if (defaultUnit !== void 0) unit = resolveFallbackUnit(defaultUnit, units);
9713 - return {
9714 - size: DEFAULT_SIZE$1,
9715 - unit
9716 - };
9717 - };
9718 - var resolveFallbackUnit = (unit, units, defaultUnit) => {
9719 - if (units.includes(unit)) return unit;
9720 - if (defaultUnit && units.includes(defaultUnit)) return defaultUnit;
9721 - return units[0] ?? "";
9722 - };
9723 - var sanitizeSize = (size) => {
9724 - if (typeof size === "number" && isNaN(size)) return DEFAULT_SIZE$1;
9725 - return size;
9726 - };
9727 -
9728 -//#endregion
9729 -//#region packages/packages/libs/editor-controls/src/controls/size-control/hooks/use-unit-sync.ts
9730 - var useUnitSync = ({ sizeValue, setUnit, persistWhen }) => {
9731 - const [state, setState] = (0, react.useState)(sizeValue.unit);
9732 - (0, react.useEffect)(() => {
9733 - if (sizeValue.unit !== state) setState(sizeValue.unit);
9734 - }, [sizeValue.unit, sizeValue.size]);
9735 - const setInternalValue = (newUnit) => {
9736 - setState(newUnit);
9737 - if (isExtendedUnit(newUnit) || persistWhen()) setUnit(newUnit);
9738 - };
9739 - return [state, setInternalValue];
9740 - };
9741 -
9742 -//#endregion
9743 -//#region packages/packages/libs/editor-controls/src/controls/size-control/hooks/use-size-value.ts
9744 - var useSizeValue$1 = /* @__PURE__ */ __name(({ value, setValue, units, defaultUnit }) => {
9745 - const resolvedValue = (0, react.useMemo)(() => resolveSizeValue(value, {
9746 - units,
9747 - defaultUnit
9748 - }), [
9749 - value?.size,
9750 - value?.unit,
9751 - defaultUnit
9752 - ]);
9753 - const [sizeValue, setSizeValue] = useSyncExternalState({
9754 - external: resolvedValue,
9755 - setExternal: (newState, options, meta) => {
9756 - if (newState !== null) setValue(newState, options, meta);
9757 - },
9758 - persistWhen: (next) => hasChanged(next, resolvedValue),
9759 - fallback: () => createDefaultSizeValue(units, defaultUnit)
9760 - });
9761 - const [unit, setUnit] = useUnitSync({
9762 - sizeValue,
9763 - setUnit: (newUnit) => {
9764 - setSizeValue({
9765 - unit: newUnit,
9766 - size: resolveSizeOnUnitChange(sizeValue.size, newUnit)
9767 - });
9768 - },
9769 - persistWhen: () => {
9770 - return Boolean(sizeValue.size) || sizeValue.size !== "" || isExtendedUnit(sizeValue.unit);
9771 - }
9772 - });
9773 - const setSize = (newSize, isInputValid = true) => {
9774 - if (isExtendedUnit(unit)) return;
9775 - const trimmed = newSize.trim();
9776 - const parsed = Number(trimmed);
9777 - setSizeValue({
9778 - unit,
9779 - size: trimmed && !isNaN(parsed) ? parsed : ""
9780 - }, void 0, { validation: () => isInputValid });
9781 - };
9782 - return {
9783 - size: sizeValue.size,
9784 - setSize,
9785 - unit,
9786 - setUnit
9787 - };
9788 - }, "useSizeValue");
9789 - var hasChanged = (next, current) => {
9790 - return next?.size !== current?.size || next?.unit !== current?.unit;
9791 - };
9792 -
9793 -//#endregion
9794 -//#region packages/packages/libs/editor-controls/src/controls/size-control/ui/size-input.tsx
9795 - var SizeInput = (0, react.forwardRef)(({ id, type, value, onBlur, onKeyUp, focused, disabled, onChange, onKeyDown, InputProps, inputProps, placeholder }, ref) => {
9796 - return /* @__PURE__ */ react.createElement(NumberInput, {
9797 - id,
9798 - ref,
9799 - size: "tiny",
9800 - fullWidth: true,
9801 - type,
9802 - value,
9803 - placeholder,
9804 - onKeyUp,
9805 - focused,
9806 - disabled,
9807 - onKeyDown,
9808 - onInput: onChange,
9809 - onBlur,
9810 - InputProps,
9811 - inputProps,
9812 - sx: getCursorStyle$1(InputProps?.readOnly ?? false)
9813 - });
9814 - });
9815 - var getCursorStyle$1 = /* @__PURE__ */ __name((readOnly) => ({ input: { cursor: readOnly ? "default !important" : void 0 } }), "getCursorStyle");
9816 -
9817 -//#endregion
9818 -//#region packages/packages/libs/editor-controls/src/controls/size-control/ui/unit-selector.tsx
9819 - var menuItemContentStyles$1 = {
9820 - display: "flex",
9821 - flexDirection: "column",
9822 - justifyContent: "center"
9823 - };
9824 - var UnitSelector = ({ value, isUnitHighlighted, onSelect, options, disabled, menuItemsAttributes = {}, optionLabelOverrides = {} }) => {
9825 - const popupState = (0, _elementor_ui.usePopupState)({
9826 - variant: "popover",
9827 - popupId: (0, react.useId)()
9828 - });
9829 - const handleMenuItemClick = (option) => {
9830 - onSelect(option);
9831 - popupState.close();
9832 - };
9833 - return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(StyledButton$1, {
9834 - isHighlighted: isUnitHighlighted,
9835 - disabled,
9836 - size: "small",
9837 - ...(0, _elementor_ui.bindTrigger)(popupState)
9838 - }, optionLabelOverrides[value] ?? value), /* @__PURE__ */ react.createElement(_elementor_ui.Menu, {
9839 - MenuListProps: { dense: true },
9840 - ...(0, _elementor_ui.bindMenu)(popupState)
9841 - }, options.map((option) => /* @__PURE__ */ react.createElement(_elementor_editor_ui.MenuListItem, {
9842 - key: option,
9843 - onClick: () => handleMenuItemClick(option),
9844 - ...menuItemsAttributes?.[option],
9845 - primaryTypographyProps: {
9846 - variant: "caption",
9847 - sx: {
9848 - ...menuItemContentStyles$1,
9849 - lineHeight: "1"
9850 - }
9851 - },
9852 - menuItemTextProps: { sx: menuItemContentStyles$1 }
9853 - }, optionLabelOverrides[option] ?? option.toUpperCase()))));
9854 - };
9855 - var StyledButton$1 = (0, _elementor_ui.styled)(_elementor_ui.Button, { shouldForwardProp: (prop) => prop !== "isHighlighted" })(({ isHighlighted, theme }) => ({
9856 - color: isHighlighted ? theme.palette.text.primary : theme.palette.text.tertiary,
9857 - font: "inherit",
9858 - minWidth: "initial",
9859 - textTransform: "uppercase"
9860 - }));
9861 -
9862 -//#endregion
9863 -//#region packages/packages/libs/editor-controls/src/controls/size-control/size-field.tsx
9864 - var UNIT_DISPLAY_LABELS_OVERRIDES = { custom: /* @__PURE__ */ react.createElement(_elementor_icons.MathFunctionIcon, { fontSize: "tiny" }) };
9865 - var SizeField = ({ value, focused, disabled, InputProps, defaultUnit, placeholder, onUnitChange, startIcon, ariaLabel, onKeyDown, setValue, onBlur, units, min, unitSelectorProps }) => {
9866 - const { size, unit, setSize, setUnit } = useSizeValue$1({
9867 - value,
9868 - setValue,
9869 - units,
9870 - defaultUnit
9871 - });
9872 - const handleUnitChange = (newUnit) => {
9873 - setUnit(newUnit);
9874 - onUnitChange?.(newUnit);
9875 - };
9876 - const { onUnitKeyDown } = useSizeUnitKeyboard({
9877 - unit,
9878 - onUnitChange: handleUnitChange,
9879 - units
9880 - });
9881 - const handleKeyDown = (event) => {
9882 - onUnitKeyDown(event);
9883 - onKeyDown?.(event);
9884 - };
9885 - const handleChange = (event) => {
9886 - const newSize = event.target.value;
9887 - const isInputValid = event.target.validity.valid;
9888 - setSize(newSize, isInputValid);
9889 - };
9890 - const inputType = isExtendedUnit(unit) ? "text" : "number";
9891 - return /* @__PURE__ */ react.createElement(SizeInput, {
9892 - disabled,
9893 - focused,
9894 - type: inputType,
9895 - value: size,
9896 - placeholder,
9897 - onBlur,
9898 - onKeyDown: handleKeyDown,
9899 - onChange: handleChange,
9900 - InputProps: {
9901 - ...InputProps,
9902 - autoComplete: "off",
9903 - readOnly: isExtendedUnit(unit),
9904 - startAdornment: startIcon && /* @__PURE__ */ react.createElement(_elementor_ui.InputAdornment, {
9905 - position: "start",
9906 - disabled
9907 - }, startIcon),
9908 - endAdornment: /* @__PURE__ */ react.createElement(_elementor_ui.InputAdornment, { position: "end" }, /* @__PURE__ */ react.createElement(UnitSelector, {
9909 - options: units,
9910 - value: unit,
9911 - onSelect: handleUnitChange,
9912 - isUnitHighlighted: shouldHighlightUnit({
9913 - size,
9914 - unit
9915 - }),
9916 - ...unitSelectorProps,
9917 - optionLabelOverrides: UNIT_DISPLAY_LABELS_OVERRIDES
9918 - }))
9919 - },
9920 - inputProps: {
9921 - min,
9922 - step: "any",
9923 - "aria-label": ariaLabel
9924 - }
9925 - });
9926 - };
9927 - var shouldHighlightUnit = (value) => {
9928 - if (!value) return false;
9929 - if (value.unit === EXTENDED_UNITS.auto) return true;
9930 - return Boolean(value.size) || value.size === 0;
9931 - };
9932 -
9933 -//#endregion
9934 -//#region packages/packages/libs/editor-controls/src/controls/size-control/ui/text-field-popover.tsx
9935 - var SIZE$5 = "tiny";
9936 - var TextFieldPopover = ({ popupState, anchorRef, value, onChange, onClose }) => {
9937 - const inputRef = (0, react.useRef)(null);
9938 - (0, react.useEffect)(() => {
9939 - if (popupState.isOpen) requestAnimationFrame(() => {
9940 - if (inputRef.current) inputRef.current.focus();
9941 - });
9942 - }, [popupState.isOpen]);
9943 - const handleKeyDown = (event) => {
9944 - if (event.key.toLowerCase() === "enter") handleClose();
9945 - };
9946 - const handleClose = () => {
9947 - onClose?.();
9948 - popupState.close();
9949 - };
9950 - return /* @__PURE__ */ react.createElement(_elementor_ui.Popover, {
9951 - disablePortal: true,
9952 - slotProps: { paper: { sx: {
9953 - borderRadius: 2,
9954 - width: anchorRef.current?.offsetWidth + "px"
9955 - } } },
9956 - ...(0, _elementor_ui.bindPopover)(popupState),
9957 - anchorOrigin: {
9958 - vertical: "bottom",
9959 - horizontal: "center"
9960 - },
9961 - transformOrigin: {
9962 - vertical: "top",
9963 - horizontal: "center"
9964 - },
9965 - onClose: handleClose
9966 - }, /* @__PURE__ */ react.createElement(_elementor_editor_ui.PopoverHeader, {
9967 - title: (0, _wordpress_i18n.__)("CSS function", "elementor"),
9968 - onClose: handleClose,
9969 - icon: /* @__PURE__ */ react.createElement(_elementor_icons.MathFunctionIcon, { fontSize: SIZE$5 })
9970 - }), /* @__PURE__ */ react.createElement(_elementor_ui.TextField, {
9971 - value,
9972 - onChange,
9973 - onKeyDown: handleKeyDown,
9974 - size: "tiny",
9975 - type: "text",
9976 - fullWidth: true,
9977 - inputProps: { ref: inputRef },
9978 - sx: {
9979 - pt: 0,
9980 - pr: 1.5,
9981 - pb: 1.5,
9982 - pl: 1.5
9983 - }
9984 - }));
9985 - };
9986 -
9987 -//#endregion
9988 -//#region packages/packages/libs/editor-controls/src/controls/size-control/size-component.tsx
9989 - var SizeComponent = ({ anchorRef, SizeFieldWrapper = react.Fragment, ...sizeFieldProps }) => {
9990 - const popupState = (0, _elementor_ui.usePopupState)({ variant: "popover" });
9991 - const activeBreakpoint = (0, _elementor_editor_responsive.useActiveBreakpoint)();
9992 - const isCustomUnit = sizeFieldProps?.value?.unit === EXTENDED_UNITS.custom;
9993 - const hasCustomUnitOption = sizeFieldProps.units.includes(EXTENDED_UNITS.custom);
9994 - (0, react.useEffect)(() => {
9995 - if (popupState && popupState.isOpen) popupState.close();
9996 - }, [activeBreakpoint]);
9997 - const handleCustomSizeChange = (event) => {
9998 - sizeFieldProps.setValue({
9999 - size: event.target.value,
10000 - unit: EXTENDED_UNITS.custom
10001 - });
10002 - };
10003 - const handleSizeFieldClick = (event) => {
10004 - if (event.target.closest("input") && isCustomUnit) popupState.open(anchorRef?.current);
10005 - };
10006 - const handleUnitChange = (unit) => {
10007 - if (unit === EXTENDED_UNITS.custom && anchorRef?.current) popupState.open(anchorRef.current);
10008 - };
10009 - const popupAttributes = {
10010 - "aria-controls": popupState.isOpen ? popupState.popupId : void 0,
10011 - "aria-haspopup": true
10012 - };
10013 - return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(SizeFieldWrapper, null, /* @__PURE__ */ react.createElement(_elementor_ui.Box, null, /* @__PURE__ */ react.createElement(SizeField, {
10014 - focused: popupState.isOpen ? true : void 0,
10015 - onUnitChange: handleUnitChange,
10016 - InputProps: {
10017 - ...popupAttributes,
10018 - onClick: handleSizeFieldClick
10019 - },
10020 - unitSelectorProps: { menuItemsAttributes: hasCustomUnitOption ? { custom: popupAttributes } : void 0 },
10021 - ...sizeFieldProps
10022 - }))), popupState.isOpen && anchorRef?.current && /* @__PURE__ */ react.createElement(TextFieldPopover, {
10023 - popupState,
10024 - anchorRef,
10025 - value: String(sizeFieldProps?.value?.size ?? ""),
10026 - onChange: handleCustomSizeChange,
10027 - onClose: () => {}
10028 - }));
10029 - };
10030 -
10031 -//#endregion
10032 -//#region packages/packages/libs/editor-controls/src/controls/size-control/utils/resolve-bound-prop-value.ts
10033 - var resolveBoundPropValue = (value, boundPropPlaceholder, propPlaceholder) => {
10034 - return {
10035 - sizeValue: pickFirstValid([
10036 - {
10037 - candidate: value,
10038 - resolve: (v) => v
10039 - },
10040 - {
10041 - candidate: propPlaceholder,
10042 - resolve: toUnitPlaceholder
10043 - },
10044 - {
10045 - candidate: boundPropPlaceholder,
10046 - resolve: toUnitPlaceholder
10047 - }
10048 - ]),
10049 - placeholder: Boolean(value) ? void 0 : resolvePlaceholder(propPlaceholder ?? boundPropPlaceholder)
10050 - };
10051 - };
10052 - var toUnitPlaceholder = (v) => ({
10053 - ...v,
10054 - size: ""
10055 - });
10056 - var pickFirstValid = (candidates) => {
10057 - const found = candidates.find(({ candidate }) => validateSizeValue(candidate));
10058 - return found ? found.resolve(found.candidate) : null;
10059 - };
10060 - var validateSizeValue = (value) => {
10061 - if (!value || typeof value !== "object") return false;
10062 - const sizePropValue = _elementor_editor_props.sizePropTypeUtil.create(value);
10063 - return _elementor_editor_props.sizePropTypeUtil.isValid(sizePropValue);
10064 - };
10065 - var resolvePlaceholder = (placeholder) => {
10066 - if (typeof placeholder === "string") return placeholder;
10067 - const size = placeholder?.size;
10068 - if (size === void 0) return;
10069 - return typeof size === "number" ? size.toString() : size;
10070 - };
10071 -
10072 -//#endregion
10073 -//#region packages/packages/libs/editor-controls/src/controls/size-control/utils/settings/get-default-unit.ts
10074 - var getDefaultUnit = (propType) => {
10075 - return getPropTypeSettings(propType)?.default_unit;
10076 - };
10077 -
10078 -//#endregion
10079 -//#region packages/packages/libs/editor-controls/src/controls/size-control/utils/settings/get-size-units.ts
10080 - var getVariantUnits = (variant) => {
10081 - return {
10082 - length: getLengthUnits,
10083 - angle: getAngleUnits,
10084 - time: getTimeUnits
10085 - }[variant]();
10086 - };
10087 - var getSettingsUnits = (propType) => {
10088 - return getPropTypeSettings(propType)?.available_units;
10089 - };
10090 - var getSizeUnits = (propType, variant) => {
10091 - return getSettingsUnits(propType) ?? getVariantUnits(variant);
10092 - };
10093 -
10094 -//#endregion
10095 -//#region packages/packages/libs/editor-controls/src/controls/size-control/utils/should-nullify-value.ts
10096 - var conditions = [
10097 - (value) => Boolean(value),
10098 - (value) => value?.size === null || value?.size === void 0 || value?.size === "",
10099 - (value) => value?.unit !== EXTENDED_UNITS.auto,
10100 - (value) => value?.unit !== EXTENDED_UNITS.custom
10101 - ];
10102 - var shouldNullifyValue = (value) => {
10103 - return conditions.every((condition) => condition(value));
10104 - };
10105 -
10106 -//#endregion
10107 -//#region packages/packages/libs/editor-controls/src/controls/size-control/unstable-size-control.tsx
10108 - var UnstableSizeControl = createControl(({ variant = "length", placeholder: propPlaceholder, anchorRef, startIcon, ariaLabel, min }) => {
10109 - const { value, setValue, propType, placeholder: boundPropPlaceholder, restoreValue } = useBoundProp(_elementor_editor_props.sizePropTypeUtil);
10110 - const lastNonAutoValue = (0, react.useRef)(null);
10111 - const { sizeValue, placeholder } = resolveBoundPropValue(value ?? lastNonAutoValue.current, boundPropPlaceholder, propPlaceholder);
10112 - const units = getSizeUnits(propType, variant);
10113 - const defaultUnit = getDefaultUnit(propType);
10114 - const handleBlur = () => {
10115 - const isRequired = propType.settings.required;
10116 - if (shouldNullifyValue(value) && !isRequired) setValue(null);
10117 - if (isRequired) restoreValue();
10118 - };
10119 - const handleChange = (newValue, options, meta) => {
10120 - if (isTransitioningFromExtendedUnit(newValue, value)) {
10121 - lastNonAutoValue.current = newValue;
10122 - setValue(null);
10123 - return;
10124 - }
10125 - setValue(newValue, options, {
10126 - ...meta,
10127 - validation: () => {
10128 - if (propType.settings.required) return newValue.size !== "";
10129 - return meta?.validation ? meta.validation(newValue) : true;
10130 - }
10131 - });
10132 - };
10133 - return /* @__PURE__ */ react.createElement(SizeComponent, {
10134 - units,
10135 - value: sizeValue,
10136 - anchorRef,
10137 - placeholder,
10138 - defaultUnit,
10139 - onBlur: handleBlur,
10140 - setValue: handleChange,
10141 - SizeFieldWrapper: ControlActions,
10142 - startIcon,
10143 - ariaLabel,
10144 - min
10145 - });
10146 - });
10147 - var isTransitioningFromExtendedUnit = (nextValue, previousValue) => {
10148 - return !isExtendedUnit(nextValue.unit) && isExtendedUnit(previousValue?.unit) && nextValue.size === "";
10149 - };
10150 -
10151 -//#endregion
10152 -//#region packages/packages/libs/editor-controls/src/controls/linked-dimensions-control.tsx
10153 - var LinkedDimensionsControl = ({ label, isSiteRtl = false, min }) => {
10154 - const gridRowRefs = [(0, react.useRef)(null), (0, react.useRef)(null)];
10155 - const { disabled: sizeDisabled } = useBoundProp(_elementor_editor_props.sizePropTypeUtil);
10156 - const { value: dimensionsValue, setValue: setDimensionsValue, propType, placeholder: dimensionsPlaceholder, disabled: dimensionsDisabled } = useBoundProp(_elementor_editor_props.dimensionsPropTypeUtil);
10157 - const { value: masterValue, placeholder: masterPlaceholder, setValue: setMasterValue } = useBoundProp();
10158 - const inferIsLinked = () => {
10159 - if (_elementor_editor_props.dimensionsPropTypeUtil.isValid(masterValue)) return false;
10160 - if (!masterValue && _elementor_editor_props.dimensionsPropTypeUtil.isValid(masterPlaceholder)) return false;
10161 - return true;
10162 - };
10163 - const [isLinked, setIsLinked] = (0, react.useState)(() => inferIsLinked());
10164 - (0, react.useLayoutEffect)(() => {
10165 - setIsLinked(inferIsLinked);
10166 - }, [(0, _elementor_editor_responsive.useActiveBreakpoint)(), _elementor_editor_props.dimensionsPropTypeUtil.isValid(masterValue ?? masterPlaceholder)]);
10167 - const onLinkToggle = () => {
10168 - setIsLinked((prev) => !prev);
10169 - if (!_elementor_editor_props.dimensionsPropTypeUtil.isValid(masterValue)) {
10170 - const value = masterValue ? masterValue : null;
10171 - if (!value) {
10172 - setMasterValue(null);
10173 - return;
10174 - }
10175 - setMasterValue(_elementor_editor_props.dimensionsPropTypeUtil.create({
10176 - "block-start": value,
10177 - "block-end": value,
10178 - "inline-start": value,
10179 - "inline-end": value
10180 - }));
10181 - return;
10182 - }
10183 - const sizeValue = getFirstDefined(dimensionsValue) ?? null;
10184 - if (!sizeValue) {
10185 - setMasterValue(null);
10186 - return;
10187 - }
10188 - setMasterValue(sizeValue);
10189 - };
10190 - const tooltipLabel = label.toLowerCase();
10191 - const LinkedIcon = isLinked ? _elementor_icons.LinkIcon : _elementor_icons.DetachIcon;
10192 - const linkedLabel = (0, _wordpress_i18n.__)("Link %s", "elementor").replace("%s", tooltipLabel);
10193 - const unlinkedLabel = (0, _wordpress_i18n.__)("Unlink %s", "elementor").replace("%s", tooltipLabel);
10194 - const disabled = sizeDisabled || dimensionsDisabled;
10195 - const propProviderProps = {
10196 - propType,
10197 - value: dimensionsValue,
10198 - placeholder: dimensionsPlaceholder ?? (!isLinked ? {
10199 - "block-start": masterPlaceholder,
10200 - "block-end": masterPlaceholder,
10201 - "inline-start": masterPlaceholder,
10202 - "inline-end": masterPlaceholder
10203 - } : null),
10204 - setValue: (dimensions) => {
10205 - const filtered = Object.entries(dimensions).filter(([, value]) => Boolean(value));
10206 - setDimensionsValue(filtered.length === 0 ? null : Object.fromEntries(filtered));
10207 - },
10208 - isDisabled: () => dimensionsDisabled
10209 - };
10210 - const hasPlaceholders = !masterValue && (dimensionsPlaceholder || masterPlaceholder);
10211 - const getEffectivePlaceholder = (bind) => {
10212 - if (isLinked) {
10213 - const linkedPlaceholder = getFirstDefined(dimensionsPlaceholder);
10214 - return _elementor_editor_props.sizePropTypeUtil.extract(linkedPlaceholder);
10215 - }
10216 - return _elementor_editor_props.sizePropTypeUtil.extract(dimensionsPlaceholder?.[bind]);
10217 - };
10218 - return /* @__PURE__ */ react.createElement(PropProvider, { ...propProviderProps }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
10219 - direction: "row",
10220 - gap: 2,
10221 - flexWrap: "nowrap"
10222 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, label), /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
10223 - title: isLinked ? unlinkedLabel : linkedLabel,
10224 - placement: "top"
10225 - }, /* @__PURE__ */ react.createElement(StyledToggleButton, {
10226 - "aria-label": isLinked ? unlinkedLabel : linkedLabel,
10227 - size: "tiny",
10228 - value: "check",
10229 - selected: isLinked,
10230 - sx: { marginLeft: "auto" },
10231 - onChange: onLinkToggle,
10232 - disabled,
10233 - isPlaceholder: hasPlaceholders
10234 - }, /* @__PURE__ */ react.createElement(LinkedIcon, { fontSize: "tiny" })))), getCssDimensionProps(label, isSiteRtl).map((row, index) => /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
10235 - direction: "row",
10236 - gap: 2,
10237 - flexWrap: "nowrap",
10238 - key: index,
10239 - ref: gridRowRefs[index]
10240 - }, row.map(({ icon, ...props }) => /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
10241 - container: true,
10242 - gap: .75,
10243 - alignItems: "center",
10244 - key: props.bind
10245 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
10246 - item: true,
10247 - xs: 12
10248 - }, /* @__PURE__ */ react.createElement(Label$1, { ...props })), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
10249 - item: true,
10250 - xs: 12
10251 - }, /* @__PURE__ */ react.createElement(Control$1, {
10252 - bind: props.bind,
10253 - ariaLabel: props.ariaLabel,
10254 - startIcon: icon,
10255 - isLinked,
10256 - placeholder: getEffectivePlaceholder(props.bind) ?? void 0,
10257 - anchorRef: gridRowRefs[index],
10258 - min
10259 - })))))));
10260 - };
10261 - var Control$1 = /* @__PURE__ */ __name(({ bind, ariaLabel, startIcon, isLinked, placeholder, anchorRef, min }) => {
10262 - if (isLinked) return /* @__PURE__ */ react.createElement(UnstableSizeControl, {
10263 - ariaLabel,
10264 - startIcon,
10265 - anchorRef,
10266 - placeholder,
10267 - min
10268 - });
10269 - return /* @__PURE__ */ react.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ react.createElement(UnstableSizeControl, {
10270 - ariaLabel,
10271 - startIcon,
10272 - anchorRef,
10273 - min,
10274 - placeholder
10275 - }));
10276 - }, "Control");
10277 - var Label$1 = /* @__PURE__ */ __name(({ label, bind }) => {
10278 - return /* @__PURE__ */ react.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ react.createElement(ControlLabel, null, label));
10279 - }, "Label");
10280 - var getFirstDefined = (dimensions) => {
10281 - return dimensions?.["block-start"] ?? dimensions?.["inline-end"] ?? dimensions?.["block-end"] ?? dimensions?.["inline-start"];
10282 - };
10283 - function getCssDimensionProps(label, isSiteRtl) {
10284 - return [[{
10285 - bind: "block-start",
10286 - label: (0, _wordpress_i18n.__)("Top", "elementor"),
10287 - ariaLabel: (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("%s top", "elementor"), label),
10288 - icon: /* @__PURE__ */ react.createElement(_elementor_icons.SideTopIcon, { fontSize: "tiny" })
10289 - }, {
10290 - bind: "inline-end",
10291 - label: isSiteRtl ? (0, _wordpress_i18n.__)("Left", "elementor") : (0, _wordpress_i18n.__)("Right", "elementor"),
10292 - ariaLabel: isSiteRtl ? (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("%s left", "elementor"), label) : (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("%s right", "elementor"), label),
10293 - icon: isSiteRtl ? /* @__PURE__ */ react.createElement(_elementor_icons.SideLeftIcon, { fontSize: "tiny" }) : /* @__PURE__ */ react.createElement(_elementor_icons.SideRightIcon, { fontSize: "tiny" })
10294 - }], [{
10295 - bind: "block-end",
10296 - label: (0, _wordpress_i18n.__)("Bottom", "elementor"),
10297 - ariaLabel: (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("%s bottom", "elementor"), label),
10298 - icon: /* @__PURE__ */ react.createElement(_elementor_icons.SideBottomIcon, { fontSize: "tiny" })
10299 - }, {
10300 - bind: "inline-start",
10301 - label: isSiteRtl ? (0, _wordpress_i18n.__)("Right", "elementor") : (0, _wordpress_i18n.__)("Left", "elementor"),
10302 - ariaLabel: isSiteRtl ? (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("%s right", "elementor"), label) : (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("%s left", "elementor"), label),
10303 - icon: isSiteRtl ? /* @__PURE__ */ react.createElement(_elementor_icons.SideRightIcon, { fontSize: "tiny" }) : /* @__PURE__ */ react.createElement(_elementor_icons.SideLeftIcon, { fontSize: "tiny" })
10304 - }]];
10305 - }
10306 -
10307 -//#endregion
10308 -//#region packages/packages/libs/editor-controls/src/hooks/use-filtered-items-list.ts
10309 - var useFilteredItemsList = (itemsList, searchValue, disabledItems) => {
10310 - return itemsList.reduce((acc, category) => {
10311 - const filteredItems = category.items.filter((item) => item.toLowerCase().includes(searchValue.toLowerCase()));
10312 - if (filteredItems.length) {
10313 - acc.push({
10314 - type: "category",
10315 - value: category.label
10316 - });
10317 - filteredItems.forEach((item) => {
10318 - acc.push({
10319 - type: "item",
10320 - value: item,
10321 - disabled: disabledItems?.includes(item) ?? false
10322 - });
10323 - });
10324 - }
10325 - return acc;
10326 - }, []);
10327 - };
10328 -
10329 -//#endregion
10330 -//#region packages/packages/libs/editor-controls/src/components/item-selector.tsx
10331 - var ItemSelector = ({ itemsList, selectedItem, onItemChange, onClose, sectionWidth, title, itemStyle = () => ({}), onDebounce = () => {}, icon, disabledItems, id = "item-selector", footer, categoryItemContentTemplate }) => {
10332 - const [searchValue, setSearchValue] = (0, react.useState)("");
10333 - const filteredItemsList = useFilteredItemsList(itemsList, searchValue, disabledItems);
10334 - const IconComponent = icon;
10335 - const handleSearch = (value) => {
10336 - setSearchValue(value);
10337 - };
10338 - const handleClose = () => {
10339 - setSearchValue("");
10340 - onClose();
10341 - };
10342 - return /* @__PURE__ */ react.createElement(_elementor_editor_ui.PopoverBody, {
10343 - width: sectionWidth,
10344 - id
10345 - }, /* @__PURE__ */ react.createElement(_elementor_editor_ui.PopoverHeader, {
10346 - title,
10347 - onClose: handleClose,
10348 - icon: /* @__PURE__ */ react.createElement(IconComponent, { fontSize: "tiny" })
10349 - }), /* @__PURE__ */ react.createElement(_elementor_editor_ui.SearchField, {
10350 - value: searchValue,
10351 - onSearch: handleSearch,
10352 - placeholder: (0, _wordpress_i18n.__)("Search", "elementor"),
10353 - id: id + "-search"
10354 - }), /* @__PURE__ */ react.createElement(_elementor_ui.Divider, null), /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: {
10355 - flex: 1,
10356 - overflow: "auto",
10357 - minHeight: 0
10358 - } }, filteredItemsList.length > 0 ? /* @__PURE__ */ react.createElement(ItemList, {
10359 - itemListItems: filteredItemsList,
10360 - setSelectedItem: onItemChange,
10361 - handleClose,
10362 - selectedItem,
10363 - itemStyle,
10364 - onDebounce,
10365 - categoryItemContentTemplate
10366 - }) : /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
10367 - alignItems: "center",
10368 - justifyContent: "center",
10369 - height: "100%",
10370 - p: 2.5,
10371 - gap: 1.5,
10372 - overflow: "hidden"
10373 - }, /* @__PURE__ */ react.createElement(IconComponent, { fontSize: "large" }), /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: {
10374 - maxWidth: 160,
10375 - overflow: "hidden"
10376 - } }, /* @__PURE__ */ react.createElement(_elementor_ui.Typography, {
10377 - align: "center",
10378 - variant: "subtitle2",
10379 - color: "text.secondary"
10380 - }, (0, _wordpress_i18n.__)("Sorry, nothing matched", "elementor")), /* @__PURE__ */ react.createElement(_elementor_ui.Typography, {
10381 - variant: "subtitle2",
10382 - color: "text.secondary",
10383 - sx: {
10384 - display: "flex",
10385 - width: "100%",
10386 - justifyContent: "center"
10387 - }
10388 - }, /* @__PURE__ */ react.createElement("span", null, "“"), /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
10389 - component: "span",
10390 - sx: {
10391 - maxWidth: "80%",
10392 - overflow: "hidden",
10393 - textOverflow: "ellipsis"
10394 - }
10395 - }, searchValue), /* @__PURE__ */ react.createElement("span", null, "”."))), /* @__PURE__ */ react.createElement(_elementor_ui.Typography, {
10396 - align: "center",
10397 - variant: "caption",
10398 - color: "text.secondary",
10399 - sx: {
10400 - display: "flex",
10401 - flexDirection: "column"
10402 - }
10403 - }, (0, _wordpress_i18n.__)("Try something else.", "elementor"), /* @__PURE__ */ react.createElement(_elementor_ui.Link, {
10404 - color: "secondary",
10405 - variant: "caption",
10406 - component: "button",
10407 - onClick: () => setSearchValue("")
10408 - }, (0, _wordpress_i18n.__)("Clear & try again", "elementor"))))), footer);
10409 - };
10410 - var ItemList = ({ itemListItems, setSelectedItem, handleClose, selectedItem, itemStyle = () => ({}), onDebounce = () => {}, categoryItemContentTemplate }) => {
10411 - const selectedItemFound = itemListItems.find((item) => item.value === selectedItem);
10412 - const debouncedVirtualizeChange = useDebounce((visibleItems) => {
10413 - visibleItems.forEach((item) => {
10414 - if (item && item.type === "item") onDebounce(item.value);
10415 - });
10416 - }, 100);
10417 - const memoizedItemStyle = (0, react.useCallback)((item) => itemStyle(item), [itemStyle]);
10418 - return /* @__PURE__ */ react.createElement(_elementor_editor_ui.PopoverMenuList, {
10419 - items: itemListItems,
10420 - selectedValue: selectedItemFound?.value,
10421 - onChange: debouncedVirtualizeChange,
10422 - onSelect: setSelectedItem,
10423 - onClose: handleClose,
10424 - itemStyle: memoizedItemStyle,
10425 - "data-testid": "item-list",
10426 - categoryItemContentTemplate
10427 - });
10428 - };
10429 - var useDebounce = (fn, delay) => {
10430 - const [debouncedFn] = (0, react.useState)(() => (0, _elementor_utils.debounce)(fn, delay));
10431 - (0, react.useEffect)(() => () => debouncedFn.cancel(), [debouncedFn]);
10432 - return debouncedFn;
10433 - };
10434 -
10435 -//#endregion
10436 -//#region packages/packages/libs/editor-controls/src/controls/font-family-control/enqueue-font.tsx
10437 - var enqueueFont = (fontFamily, context = "editor") => {
10438 - return window.elementor?.helpers?.enqueueFont?.(fontFamily, context) ?? null;
10439 - };
10440 -
10441 -//#endregion
10442 -//#region packages/packages/libs/editor-controls/src/controls/font-family-control/font-family-control.tsx
10443 - var FontFamilyControl = createControl(({ fontFamilies, sectionWidth, ariaLabel }) => {
10444 - const { value: fontFamily, setValue: setFontFamily, disabled, placeholder } = useBoundProp(_elementor_editor_props.fontFamilyPropTypeUtil);
10445 - const popoverState = (0, _elementor_ui.usePopupState)({ variant: "popover" });
10446 - const isShowingPlaceholder = !fontFamily && placeholder;
10447 - const mapFontSubs = (0, react.useMemo)(() => {
10448 - return fontFamilies.map(({ label, fonts }) => ({
10449 - label,
10450 - items: fonts
10451 - }));
10452 - }, [fontFamilies]);
10453 - return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.UnstableTag, {
10454 - id: "font-family-control",
10455 - variant: "outlined",
10456 - label: fontFamily || placeholder,
10457 - endIcon: /* @__PURE__ */ react.createElement(_elementor_icons.ChevronDownIcon, { fontSize: "tiny" }),
10458 - ...(0, _elementor_ui.bindTrigger)(popoverState),
10459 - fullWidth: true,
10460 - disabled,
10461 - "aria-label": ariaLabel,
10462 - sx: isShowingPlaceholder ? {
10463 - "& .MuiTag-label": { color: (theme) => theme.palette.text.tertiary },
10464 - textTransform: "capitalize"
10465 - } : void 0
10466 - })), /* @__PURE__ */ react.createElement(_elementor_ui.Popover, {
10467 - disablePortal: true,
10468 - disableScrollLock: true,
10469 - anchorOrigin: {
10470 - vertical: "bottom",
10471 - horizontal: "right"
10472 - },
10473 - transformOrigin: {
10474 - vertical: "top",
10475 - horizontal: "right"
10476 - },
10477 - sx: { my: 1.5 },
10478 - ...(0, _elementor_ui.bindPopover)(popoverState)
10479 - }, /* @__PURE__ */ react.createElement(ItemSelector, {
10480 - id: "font-family-selector",
10481 - itemsList: mapFontSubs,
10482 - selectedItem: fontFamily,
10483 - onItemChange: setFontFamily,
10484 - onClose: popoverState.close,
10485 - sectionWidth,
10486 - title: (0, _wordpress_i18n.__)("Font family", "elementor"),
10487 - itemStyle: (item) => ({ fontFamily: item.value }),
10488 - onDebounce: enqueueFont,
10489 - icon: _elementor_icons.TextIcon
10490 - })));
10491 - });
10492 -
10493 -//#endregion
10494 -//#region packages/packages/libs/editor-controls/src/controls/url-control.tsx
10495 - var UrlControl = createControl(({ placeholder: propPlaceholder, ariaLabel }) => {
10496 - const { value, setValue, disabled, placeholder: boundPlaceholder } = useBoundProp(_elementor_editor_props.urlPropTypeUtil);
10497 - const handleChange = (event) => setValue(event.target.value);
10498 - const placeholder = propPlaceholder ?? boundPlaceholder ?? void 0;
10499 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.TextField, {
10500 - size: "tiny",
10501 - fullWidth: true,
10502 - value: value ?? "",
10503 - disabled,
10504 - onChange: handleChange,
10505 - placeholder,
10506 - inputProps: { ...ariaLabel ? { "aria-label": ariaLabel } : {} }
10507 - }));
10508 - });
10509 -
10510 -//#endregion
10511 -//#region packages/packages/libs/editor-controls/src/components/restricted-link-infotip.tsx
10512 - var learnMoreButton = {
10513 - label: (0, _wordpress_i18n.__)("Learn More", "elementor"),
10514 - href: "https://go.elementor.com/element-link-inside-link-infotip"
10515 - };
10516 - var INFOTIP_CONTENT = {
10517 - descendant: (0, _wordpress_i18n.__)("To add a link or action to this element, first remove the link or action from the elements inside of it.", "elementor"),
10518 - ancestor: (0, _wordpress_i18n.__)("To add a link or action to this container, first remove the link or action from its parent container.", "elementor")
10519 - };
10520 - function isTargetInCurrentDocument(elementId) {
10521 - if (!elementId) return false;
10522 - const el = (0, _elementor_editor_elements.getContainer)(elementId)?.view?.el;
10523 - if (!el) return false;
10524 - const targetDocId = el.closest("[data-elementor-id]")?.getAttribute("data-elementor-id");
10525 - const currentDocId = String((0, _elementor_editor_elements.getCurrentDocumentId)() ?? "");
10526 - return !!(targetDocId && currentDocId && targetDocId === currentDocId);
10527 - }
10528 - var RestrictedLinkInfotip = ({ linkInLinkRestriction, isVisible, children }) => {
10529 - const { shouldRestrict, reason, elementId } = linkInLinkRestriction;
10530 - const showTakeMeThereCta = !!(elementId && isTargetInCurrentDocument(elementId));
10531 - const handleTakeMeClick = () => {
10532 - if (elementId) (0, _elementor_editor_elements.selectElement)(elementId);
10533 - };
10534 - const content = /* @__PURE__ */ react.createElement(_elementor_ui.Alert, {
10535 - color: "secondary",
10536 - icon: /* @__PURE__ */ react.createElement(_elementor_icons.InfoCircleFilledIcon, null),
10537 - size: "small",
10538 - action: showTakeMeThereCta ? /* @__PURE__ */ react.createElement(_elementor_ui.AlertAction, {
10539 - sx: { width: "fit-content" },
10540 - variant: "contained",
10541 - color: "secondary",
10542 - onClick: handleTakeMeClick
10543 - }, (0, _wordpress_i18n.__)("Take me there", "elementor")) : void 0
10544 - }, /* @__PURE__ */ react.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("Nested links", "elementor")), /* @__PURE__ */ react.createElement(_elementor_ui.Box, { component: "span" }, INFOTIP_CONTENT[reason ?? "descendant"], " ", /* @__PURE__ */ react.createElement(_elementor_ui.Link, {
10545 - href: learnMoreButton.href,
10546 - target: "_blank",
10547 - color: "info.main"
10548 - }, learnMoreButton.label)));
10549 - return shouldRestrict && isVisible ? /* @__PURE__ */ react.createElement(_elementor_ui.Infotip, {
10550 - placement: "right",
10551 - content,
10552 - color: "secondary",
10553 - slotProps: { popper: { sx: { width: 300 } } }
10554 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, null, children)) : /* @__PURE__ */ react.createElement(react.Fragment, null, children);
10555 - };
10556 -
10557 -//#endregion
10558 -//#region packages/packages/libs/editor-controls/src/components/autocomplete.tsx
10559 - var Autocomplete$2 = (0, react.forwardRef)((props, ref) => {
10560 - const { options, onOptionChange, onTextChange, allowCustomValues = false, placeholder = "", minInputLength = 2, value = "", startAdornment, disablePortal = true, inputProps, ...restProps } = props;
10561 - const optionKeys = factoryFilter(value, options, minInputLength).map(({ id }) => id);
10562 - const allowClear = !!value;
10563 - const isOptionEqualToValue = allowCustomValues || !!value?.toString()?.length ? void 0 : () => true;
10564 - const isValueFromOptions = typeof value === "number" && !!findMatchingOption(options, value);
10565 - const shouldOpen = (value?.toString()?.length ?? 0) >= minInputLength && (allowCustomValues ? optionKeys.length > 0 : true);
10566 - return /* @__PURE__ */ react.createElement(_elementor_ui.Autocomplete, {
10567 - ...restProps,
10568 - ref,
10569 - forcePopupIcon: false,
10570 - disablePortal,
10571 - disableClearable: true,
10572 - freeSolo: allowCustomValues,
10573 - openOnFocus: false,
10574 - open: shouldOpen,
10575 - value: value?.toString() || "",
10576 - size: "tiny",
10577 - onChange: (_, newValue) => onOptionChange(Number(newValue)),
10578 - readOnly: isValueFromOptions,
10579 - options: optionKeys,
10580 - getOptionKey: (optionId) => findMatchingOption(options, optionId)?.id || optionId,
10581 - getOptionLabel: (optionId) => findMatchingOption(options, optionId)?.label || optionId.toString(),
10582 - groupBy: isCategorizedOptionPool(options) ? (optionId) => findMatchingOption(options, optionId)?.groupLabel || optionId : void 0,
10583 - isOptionEqualToValue,
10584 - filterOptions: () => optionKeys,
10585 - renderOption: (optionProps, optionId) => /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
10586 - component: "li",
10587 - ...optionProps,
10588 - key: optionProps.id
10589 - }, findMatchingOption(options, optionId)?.label ?? optionId),
10590 - renderInput: (params) => /* @__PURE__ */ react.createElement(TextInput, {
10591 - params,
10592 - handleChange: (newValue) => onTextChange?.(newValue),
10593 - allowClear,
10594 - placeholder,
10595 - hasSelectedValue: isValueFromOptions,
10596 - startAdornment,
10597 - extraInputProps: inputProps
10598 - })
10599 - });
10600 - });
10601 - var TextInput = ({ params, allowClear, placeholder, handleChange, hasSelectedValue, startAdornment, extraInputProps }) => {
10602 - const onChange = (event) => {
10603 - handleChange(event.target.value);
10604 - };
10605 - return /* @__PURE__ */ react.createElement(_elementor_ui.TextField, {
10606 - ...params,
10607 - placeholder,
10608 - onChange,
10609 - inputProps: {
10610 - ...params.inputProps ?? {},
10611 - ...extraInputProps ?? {}
10612 - },
10613 - sx: { "& .MuiInputBase-input": { cursor: hasSelectedValue ? "default" : void 0 } },
10614 - InputProps: {
10615 - ...params.InputProps,
10616 - startAdornment: startAdornment || params.InputProps.startAdornment,
10617 - endAdornment: /* @__PURE__ */ react.createElement(ClearButton, {
10618 - params,
10619 - allowClear,
10620 - handleChange
10621 - })
10622 - }
10623 - });
10624 - };
10625 - var ClearButton = ({ allowClear, handleChange, params }) => /* @__PURE__ */ react.createElement(_elementor_ui.InputAdornment, { position: "end" }, allowClear && /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, {
10626 - size: params.size,
10627 - onClick: () => handleChange(null),
10628 - sx: { cursor: "pointer" }
10629 - }, /* @__PURE__ */ react.createElement(_elementor_icons.XIcon, { fontSize: params.size })));
10630 - function findMatchingOption(options, optionId = null) {
10631 - const formattedOption = (optionId || "").toString();
10632 - return options.find(({ id }) => formattedOption === id.toString());
10633 - }
10634 - function isCategorizedOptionPool(options) {
10635 - if (options.length <= 1) return false;
10636 - return new Set(options.map((option) => option.groupLabel)).size > 1;
10637 - }
10638 - function factoryFilter(newValue, options, minInputLength) {
10639 - if (null === newValue) return options;
10640 - const formattedValue = String(newValue || "")?.toLowerCase();
10641 - if (formattedValue.length < minInputLength) return new Array(0);
10642 - return options.filter((option) => String(option.id).toLowerCase().includes(formattedValue) || option.label.toLowerCase().includes(formattedValue));
10643 - }
10644 -
10645 -//#endregion
10646 -//#region packages/packages/libs/editor-controls/src/hooks/use-query-autocomplete.ts
10647 - function useQueryAutocomplete({ url, params = {}, minInputLength = 2, initialQueryValue = null, excludeIds }) {
10648 - const excludeIdSet = (0, react.useMemo)(() => new Set((excludeIds ?? []).map(String)), [excludeIds]);
10649 - const [options, setOptions] = (0, react.useState)(generateFirstLoadedOption(initialQueryValue));
10650 - const debounceFetch = (0, react.useMemo)(() => (0, _elementor_utils.debounce)((queryParams) => fetchOptions(url, queryParams).then((newOptions) => {
10651 - setOptions(formatOptions(filterExcludedOptions(newOptions, excludeIdSet)));
10652 - }), 400), [url, excludeIdSet]);
10653 - (0, react.useEffect)(() => {
10654 - if (minInputLength === 0 && url) fetchOptions(url, {
10655 - ...params,
10656 - term: ""
10657 - }).then((newOptions) => {
10658 - setOptions(formatOptions(filterExcludedOptions(newOptions, excludeIdSet)));
10659 - });
10660 - }, [
10661 - url,
10662 - minInputLength,
10663 - excludeIdSet,
10664 - params
10665 - ]);
10666 - const updateOptions = (term) => {
10667 - const termStr = term ?? "";
10668 - if (!url || termStr.length < minInputLength) return;
10669 - debounceFetch({
10670 - ...params,
10671 - term: termStr
10672 - });
10673 - };
10674 - return {
10675 - options,
10676 - updateOptions
10677 - };
10678 - }
10679 - async function fetchOptions(ajaxUrl, params) {
10680 - if (!params || !ajaxUrl) return [];
10681 - try {
10682 - const { data: response } = await (0, _elementor_http_client.httpService)().get(ajaxUrl, { params });
10683 - return response.data.value;
10684 - } catch {
10685 - return [];
10686 - }
10687 - }
10688 - function formatOptions(options) {
10689 - const compareKey = isCategorizedOptionPool(options) ? "groupLabel" : "label";
10690 - return options.sort((a, b) => a[compareKey] && b[compareKey] ? a[compareKey].localeCompare(b[compareKey]) : 0);
10691 - }
10692 - function filterExcludedOptions(options, excludeIdSet) {
10693 - if (excludeIdSet.size === 0) return options;
10694 - return options.filter((option) => !excludeIdSet.has(String(option.id)));
10695 - }
10696 - function extractFlatOptionFromQueryValue(queryValue) {
10697 - const id = _elementor_editor_props.numberPropTypeUtil.extract(queryValue?.id);
10698 - const label = _elementor_editor_props.stringPropTypeUtil.extract(queryValue?.label);
10699 - if (id === null) return null;
10700 - return {
10701 - id: String(id),
10702 - label: label || String(id)
10703 - };
10704 - }
10705 - function generateFirstLoadedOption(queryValue) {
10706 - const option = extractFlatOptionFromQueryValue(queryValue);
10707 - return option ? [option] : [];
10708 - }
10709 -
10710 -//#endregion
10711 -//#region packages/packages/libs/editor-controls/src/controls/query-control.tsx
10712 - var QueryControl = createControl((props) => {
10713 - const { value: queryValue, setValue: setQueryValue } = useBoundProp(_elementor_editor_props.queryPropTypeUtil);
10714 - const { value: urlValue, setValue: setUrlValue, placeholder: urlPlaceholder } = useBoundProp(_elementor_editor_props.urlPropTypeUtil);
10715 - const { allowCustomValues = true, queryOptions: { url, params = {} }, placeholder = (0, _wordpress_i18n.__)("Search", "elementor"), minInputLength = 2, onSetValue, ariaLabel } = props || {};
10716 - const { options, updateOptions } = useQueryAutocomplete({
10717 - url,
10718 - params,
10719 - minInputLength,
10720 - initialQueryValue: queryValue
10721 - });
10722 - const onOptionChange = (newValue) => {
10723 - if (newValue === null) {
10724 - setQueryValue(null);
10725 - onSetValue?.(null);
10726 - return;
10727 - }
10728 - const newQueryValue = {
10729 - id: _elementor_editor_props.numberPropTypeUtil.create(newValue),
10730 - label: _elementor_editor_props.stringPropTypeUtil.create(findMatchingOption(options, newValue)?.label || null)
10731 - };
10732 - setQueryValue(newQueryValue);
10733 - onSetValue?.(_elementor_editor_props.queryPropTypeUtil.create(newQueryValue));
10734 - };
10735 - const onTextChange = (newValue) => {
10736 - const trimmedValue = newValue?.trim() || "";
10737 - if (!trimmedValue) {
10738 - setUrlValue(null);
10739 - onSetValue?.(null);
10740 - return;
10741 - }
10742 - setUrlValue(trimmedValue);
10743 - onSetValue?.(_elementor_editor_props.urlPropTypeUtil.create(trimmedValue));
10744 - updateOptions(newValue);
10745 - };
10746 - const displayValue = queryValue?.id?.value ?? urlValue;
10747 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(Autocomplete$2, {
10748 - options,
10749 - allowCustomValues,
10750 - placeholder: urlPlaceholder ?? placeholder,
10751 - startAdornment: /* @__PURE__ */ react.createElement(_elementor_icons.SearchIcon, { fontSize: "tiny" }),
10752 - value: displayValue,
10753 - onOptionChange,
10754 - onTextChange,
10755 - minInputLength,
10756 - disablePortal: false,
10757 - inputProps: { ...ariaLabel ? { "aria-label": ariaLabel } : {} }
10758 - }));
10759 - });
10760 -
10761 -//#endregion
10762 -//#region packages/packages/libs/editor-controls/src/controls/switch-control.tsx
10763 - var SwitchControl = createControl(() => {
10764 - const { value, setValue, disabled, placeholder } = useBoundProp(_elementor_editor_props.booleanPropTypeUtil);
10765 - const handleChange = (event) => {
10766 - setValue(event.target.checked);
10767 - };
10768 - return /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: {
10769 - display: "flex",
10770 - justifyContent: "flex-end"
10771 - } }, /* @__PURE__ */ react.createElement(_elementor_ui.Switch, {
10772 - checked: !!(value || placeholder),
10773 - onChange: handleChange,
10774 - size: "small",
10775 - disabled,
10776 - inputProps: { ...disabled ? { style: { opacity: 0 } } : {} }
10777 - }));
10778 - });
10779 -
10780 -//#endregion
10781 -//#region packages/packages/libs/editor-controls/src/controls/link-control.tsx
10782 - var SIZE$4 = "tiny";
10783 - var LinkControl = createControl((props) => {
10784 - const { value, path, setValue, ...propContext } = useBoundProp(_elementor_editor_props.linkPropTypeUtil);
10785 - const linkPlaceholder = propContext.placeholder;
10786 - const [linkSessionValue, setLinkSessionValue] = (0, _elementor_session.useSessionStorage)(path.join("/"));
10787 - const [isActive, setIsActive] = (0, react.useState)(!!value || !!linkPlaceholder);
10788 - const { allowCustomValues = true, queryOptions, placeholder, minInputLength = 2, context: { elementId }, label = (0, _wordpress_i18n.__)("Link", "elementor"), ariaLabel } = props || {};
10789 - const [linkInLinkRestriction, setLinkInLinkRestriction] = (0, react.useState)((0, _elementor_editor_elements.getLinkInLinkRestriction)(elementId, value ?? linkPlaceholder));
10790 - const shouldDisableAddingLink = !isActive && linkInLinkRestriction.shouldRestrict;
10791 - const debouncedCheckRestriction = (0, _elementor_utils.useDebouncedCallback)(() => {
10792 - const newRestriction = (0, _elementor_editor_elements.getLinkInLinkRestriction)(elementId, value ?? linkPlaceholder);
10793 - if (newRestriction.shouldRestrict && isActive && !linkPlaceholder) {
10794 - setIsActive(false);
10795 - if (value !== null) setValue(null);
10796 - }
10797 - setLinkInLinkRestriction((prev) => isSameRestriction(prev, newRestriction) ? prev : newRestriction);
10798 - }, 300);
10799 - (0, _elementor_editor_v1_adapters.__privateUseListenTo)((0, _elementor_editor_v1_adapters.commandEndEvent)("document/elements/set-settings"), () => {
10800 - debouncedCheckRestriction();
10801 - }, [debouncedCheckRestriction]);
10802 - (0, react.useEffect)(() => {
10803 - debouncedCheckRestriction();
10804 - const handleInlineLinkChanged = () => {
10805 - debouncedCheckRestriction();
10806 - };
10807 - window.addEventListener("elementor:inline-link-changed", handleInlineLinkChanged);
10808 - return () => {
10809 - window.removeEventListener("elementor:inline-link-changed", handleInlineLinkChanged);
10810 - };
10811 - }, [elementId, debouncedCheckRestriction]);
10812 - const onEnabledChange = () => {
10813 - setLinkInLinkRestriction((0, _elementor_editor_elements.getLinkInLinkRestriction)(elementId, value ?? linkPlaceholder));
10814 - if (linkInLinkRestriction.shouldRestrict && !isActive) return;
10815 - const newState = !isActive;
10816 - setIsActive(newState);
10817 - if (!newState && value !== null) setValue(null);
10818 - if (newState && linkSessionValue?.value) setValue(linkSessionValue.value);
10819 - setLinkSessionValue({
10820 - value: linkSessionValue?.value,
10821 - meta: { isEnabled: newState }
10822 - });
10823 - };
10824 - const onSaveValueToSession = (newValue) => {
10825 - const valueToSave = newValue ? {
10826 - ...value,
10827 - destination: newValue
10828 - } : null;
10829 - setLinkSessionValue({
10830 - ...linkSessionValue,
10831 - value: valueToSave
10832 - });
10833 - };
10834 - return /* @__PURE__ */ react.createElement(PropProvider, {
10835 - ...propContext,
10836 - value,
10837 - setValue
10838 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, { gap: 1.5 }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
10839 - direction: "row",
10840 - sx: {
10841 - justifyContent: "space-between",
10842 - alignItems: "center",
10843 - marginInlineEnd: -.75
10844 - }
10845 - }, /* @__PURE__ */ react.createElement(ControlLabel, null, label), /* @__PURE__ */ react.createElement(RestrictedLinkInfotip, {
10846 - isVisible: !isActive,
10847 - linkInLinkRestriction
10848 - }, /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, {
10849 - size: SIZE$4,
10850 - onClick: onEnabledChange,
10851 - "aria-label": (0, _wordpress_i18n.__)("Toggle link", "elementor"),
10852 - disabled: shouldDisableAddingLink
10853 - }, isActive ? /* @__PURE__ */ react.createElement(_elementor_icons.MinusIcon, { fontSize: SIZE$4 }) : /* @__PURE__ */ react.createElement(_elementor_icons.PlusIcon, { fontSize: SIZE$4 })))), /* @__PURE__ */ react.createElement(_elementor_ui.Collapse, {
10854 - in: isActive,
10855 - timeout: "auto",
10856 - unmountOnExit: true
10857 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, { gap: 1.5 }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "destination" }, /* @__PURE__ */ react.createElement(QueryControl, {
10858 - queryOptions,
10859 - allowCustomValues,
10860 - minInputLength,
10861 - placeholder,
10862 - onSetValue: onSaveValueToSession,
10863 - ariaLabel: ariaLabel || label
10864 - })), /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "isTargetBlank" }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
10865 - container: true,
10866 - alignItems: "center",
10867 - flexWrap: "nowrap",
10868 - justifyContent: "space-between"
10869 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { item: true }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Open in a new tab", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
10870 - item: true,
10871 - sx: { marginInlineEnd: -1 }
10872 - }, /* @__PURE__ */ react.createElement(SwitchControl, null))))))));
10873 - });
10874 - function isSameRestriction(a, b) {
10875 - return a.shouldRestrict === b.shouldRestrict && a.reason === b.reason && a.elementId === b.elementId;
10876 - }
10877 -
10878 -//#endregion
10879 -//#region packages/packages/libs/editor-controls/src/components/conditional-control-infotip.tsx
10880 - var DEFAULT_COLOR = "secondary";
10881 - var ConditionalControlInfotip = react.forwardRef(({ children, title, description, alertProps, infotipProps, ...props }, ref) => {
10882 - const isUiRtl = "rtl" === (0, _elementor_ui.useTheme)().direction;
10883 - const isEnabled = props.isEnabled && (title || description);
10884 - return /* @__PURE__ */ react.createElement(_elementor_ui.Box, { ref }, isEnabled ? /* @__PURE__ */ react.createElement(_elementor_ui.DirectionProvider, { rtl: isUiRtl }, /* @__PURE__ */ react.createElement(_elementor_ui.Infotip, {
10885 - placement: "right",
10886 - color: DEFAULT_COLOR,
10887 - slotProps: { popper: { modifiers: [{
10888 - name: "offset",
10889 - options: { offset: [0, 10] }
10890 - }] } },
10891 - ...infotipProps,
10892 - content: /* @__PURE__ */ react.createElement(_elementor_editor_ui.InfoAlert, {
10893 - color: DEFAULT_COLOR,
10894 - sx: {
10895 - width: 300,
10896 - px: 1.5,
10897 - py: 2
10898 - },
10899 - ...alertProps
10900 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: {
10901 - flexDirection: "column",
10902 - display: "flex",
10903 - gap: .5
10904 - } }, /* @__PURE__ */ react.createElement(_elementor_ui.AlertTitle, null, title), /* @__PURE__ */ react.createElement(_elementor_ui.Box, null, description)))
10905 - }, children)) : children);
10906 - });
10907 -
10908 -//#endregion
10909 -//#region packages/packages/libs/editor-controls/src/controls/html-tag-control.tsx
10910 - var StyledSelect = (0, _elementor_ui.styled)(_elementor_ui.Select)(() => ({ ".MuiSelect-select.Mui-disabled": { cursor: "not-allowed" } }));
10911 - var HtmlTagControl = createControl((props) => {
10912 - const { options, onChange, fallbackLabels = {}, context: { elementId } } = props;
10913 - const { value, setValue, disabled, placeholder } = useBoundProp(_elementor_editor_props.stringPropTypeUtil);
10914 - const handleChange = (event) => {
10915 - const newValue = event.target.value || null;
10916 - onChange?.(newValue, value);
10917 - setValue(newValue);
10918 - };
10919 - const elementLabel = (0, _elementor_editor_elements.getElementLabel)(elementId) ?? "element";
10920 - const infoTipProps = {
10921 - title: (0, _wordpress_i18n.__)("HTML Tag", "elementor"),
10922 - description: (0, _wordpress_i18n.__)(`The tag is locked to 'a' tag because this %s has a link. To pick a different tag, remove the link first.`, "elementor").replace("%s", elementLabel),
10923 - isEnabled: !!disabled
10924 - };
10925 - const renderValue = (selectedValue) => {
10926 - if (selectedValue) return findOptionByValue(selectedValue)?.label || fallbackLabels[selectedValue] || selectedValue;
10927 - if (!placeholder) return "";
10928 - const displayText = findOptionByValue(placeholder)?.label || placeholder;
10929 - return /* @__PURE__ */ react.createElement(_elementor_ui.Typography, {
10930 - component: "span",
10931 - variant: "caption",
10932 - color: "text.tertiary"
10933 - }, displayText);
10934 - };
10935 - const findOptionByValue = (searchValue) => options.find((opt) => opt.value === searchValue);
10936 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(ConditionalControlInfotip, { ...infoTipProps }, /* @__PURE__ */ react.createElement(StyledSelect, {
10937 - sx: {
10938 - overflow: "hidden",
10939 - cursor: disabled ? "not-allowed" : void 0
10940 - },
10941 - displayEmpty: true,
10942 - size: "tiny",
10943 - renderValue,
10944 - value: value ?? "",
10945 - onChange: handleChange,
10946 - disabled,
10947 - fullWidth: true
10948 - }, options.map(({ label, ...itemProps }) => /* @__PURE__ */ react.createElement(_elementor_editor_ui.MenuListItem, {
10949 - key: itemProps.value,
10950 - ...itemProps,
10951 - value: itemProps.value ?? ""
10952 - }, label)))));
10953 - });
10954 -
10955 -//#endregion
10956 -//#region packages/packages/libs/editor-controls/src/controls/query-chips-control.tsx
10957 - var queryArrayPropTypeUtil = (0, _elementor_editor_props.createArrayPropUtils)(_elementor_editor_props.queryPropTypeUtil.key, _elementor_editor_props.queryPropTypeUtil.schema);
10958 - var SIZE$3 = "tiny";
10959 - var QueryChipsControl = createControl((props) => {
10960 - const { queryOptions, placeholder, minInputLength = 2 } = props;
10961 - const { value, setValue, disabled } = useBoundProp(queryArrayPropTypeUtil);
10962 - const selectedChips = (0, react.useMemo)(() => extractChips(value), [value]);
10963 - const excludeIds = (0, react.useMemo)(() => selectedChips.map((chip) => Number(chip.id)).filter((id) => Number.isFinite(id)), [selectedChips]);
10964 - const { options, updateOptions } = useQueryAutocomplete({
10965 - url: queryOptions.url,
10966 - params: queryOptions.params,
10967 - minInputLength,
10968 - excludeIds
10969 - });
10970 - const handleChange = (_, newValue) => {
10971 - setValue(newValue.map((option) => _elementor_editor_props.queryPropTypeUtil.create({
10972 - id: _elementor_editor_props.numberPropTypeUtil.create(Number(option.id)),
10973 - label: _elementor_editor_props.stringPropTypeUtil.create(option.label)
10974 - })));
10975 - };
10976 - const handleInputChange = (_, term) => {
10977 - updateOptions(term || null);
10978 - };
10979 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.Autocomplete, {
10980 - multiple: true,
10981 - fullWidth: true,
10982 - disableClearable: true,
10983 - forcePopupIcon: false,
10984 - disabled,
10985 - size: SIZE$3,
10986 - value: selectedChips,
10987 - options,
10988 - onChange: handleChange,
10989 - onInputChange: handleInputChange,
10990 - getOptionLabel: (option) => option.label,
10991 - isOptionEqualToValue: (option, val) => option.id === val.id,
10992 - filterOptions: (opts) => opts,
10993 - renderTags: (tagValues, getTagProps) => /* @__PURE__ */ react.createElement(ChipsList, {
10994 - getLabel: (option) => option.label,
10995 - getTagProps,
10996 - values: tagValues
10997 - }),
10998 - renderInput: (params) => /* @__PURE__ */ react.createElement(_elementor_ui.TextField, {
10999 - ...params,
11000 - placeholder: placeholder ?? (0, _wordpress_i18n.__)("Search", "elementor")
11001 - })
11002 - }));
11003 - });
11004 - function extractChips(value) {
11005 - if (!value) return [];
11006 - return value.map((item) => extractFlatOptionFromQueryValue(item?.value)).filter((chip) => chip !== null);
11007 - }
11008 -
11009 -//#endregion
11010 -//#region packages/packages/libs/editor-controls/src/controls/query-filter-repeater-control.tsx
11011 - var QueryFilterRepeaterControl = createControl(({ allowedKeys, keyConfig, label = (0, _wordpress_i18n.__)("Filter", "elementor"), chipsPlaceholder }) => {
11012 - const { propType, value, setValue } = useBoundProp(_elementor_editor_props.queryFilterArrayPropTypeUtil);
11013 - const { settings } = (0, _elementor_editor_elements.useSelectedElementSettings)();
11014 - const visibleKeys = (0, react.useMemo)(() => allowedKeys.filter((key) => isKeyVisible(keyConfig[key]?.visibleWhen, settings)), [
11015 - allowedKeys,
11016 - keyConfig,
11017 - settings
11018 - ]);
11019 - const usedKeys = (0, react.useMemo)(() => getUsedKeys(value ?? []), [value]);
11020 - const nextAvailableKey = (0, react.useMemo)(() => visibleKeys.find((key) => !usedKeys.has(key)) ?? null, [visibleKeys, usedKeys]);
11021 - const getKeySelectOptions = (0, react.useMemo)(() => (currentKey) => visibleKeys.map((itemKey) => ({
11022 - value: itemKey,
11023 - label: keyConfig[itemKey]?.label ?? itemKey,
11024 - disabled: itemKey !== currentKey && usedKeys.has(itemKey)
11025 - })), [
11026 - visibleKeys,
11027 - keyConfig,
11028 - usedKeys
11029 - ]);
11030 - const initialFallback = (0, react.useMemo)(() => createItemForKey(visibleKeys[0] ?? ""), [visibleKeys]);
11031 - return /* @__PURE__ */ react.createElement(PropProvider, {
11032 - propType,
11033 - value,
11034 - setValue
11035 - }, /* @__PURE__ */ react.createElement(ControlRepeater, {
11036 - initial: initialFallback,
11037 - propTypeUtil: _elementor_editor_props.queryFilterArrayPropTypeUtil
11038 - }, /* @__PURE__ */ react.createElement(RepeaterHeader, { label }, /* @__PURE__ */ react.createElement(AddFilterItemAction, {
11039 - nextAvailableKey,
11040 - ariaLabel: label
11041 - })), /* @__PURE__ */ react.createElement(ItemsContainer, { isSortable: false }, /* @__PURE__ */ react.createElement(Item, {
11042 - Icon: EmptyIcon,
11043 - actions: /* @__PURE__ */ react.createElement(RemoveItemAction, null),
11044 - Label: ({ value: itemValue }) => /* @__PURE__ */ react.createElement(ItemLabel$2, {
11045 - value: itemValue,
11046 - keyConfig
11047 - })
11048 - })), /* @__PURE__ */ react.createElement(EditItemPopover, null, /* @__PURE__ */ react.createElement(ItemContent$1, {
11049 - keyConfig,
11050 - getKeySelectOptions,
11051 - chipsPlaceholder
11052 - }))));
11053 - });
11054 - var AddFilterItemAction = ({ nextAvailableKey, ariaLabel }) => {
11055 - const { addItem } = useRepeaterContext();
11056 - const disabled = nextAvailableKey === null;
11057 - const onClick = (ev) => {
11058 - if (!nextAvailableKey) return;
11059 - addItem(ev, {
11060 - item: createItemForKey(nextAvailableKey),
11061 - index: 0
11062 - });
11063 - };
11064 - return /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
11065 - component: "span",
11066 - sx: { cursor: disabled ? "not-allowed" : "pointer" }
11067 - }, /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, {
11068 - size: "tiny",
11069 - disabled,
11070 - onClick,
11071 - "aria-label": (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("Add %s item", "elementor"), ariaLabel.toLowerCase())
11072 - }, /* @__PURE__ */ react.createElement(_elementor_icons.PlusIcon, { fontSize: "tiny" })));
11073 - };
11074 - var EmptyIcon = () => null;
11075 - var ItemLabel$2 = /* @__PURE__ */ __name(({ value, keyConfig }) => {
11076 - const itemKey = _elementor_editor_props.stringPropTypeUtil.extract(value?.value?.key);
11077 - const label = itemKey && keyConfig[itemKey]?.label || (0, _wordpress_i18n.__)("Item", "elementor");
11078 - const chipLabels = extractChipLabels(value?.value?.values);
11079 - const taxonomyLabels = extractTaxonomyLabels(value?.value?.taxonomies, itemKey ? keyConfig[itemKey] : void 0);
11080 - const allLabels = [...chipLabels, ...taxonomyLabels];
11081 - const suffix = allLabels.length > 0 ? `: ${allLabels.join(", ")}` : "";
11082 - return /* @__PURE__ */ react.createElement(_elementor_ui.Box, { component: "span" }, label, suffix);
11083 - }, "ItemLabel");
11084 - function extractChipLabels(chipsProp) {
11085 - return (chipsProp?.value ?? []).map((chip) => _elementor_editor_props.stringPropTypeUtil.extract(chip?.value?.label)).filter((label) => !!label);
11086 - }
11087 - var ItemContent$1 = /* @__PURE__ */ __name(({ keyConfig, getKeySelectOptions, chipsPlaceholder }) => {
11088 - const propContext = useBoundProp(_elementor_editor_props.queryFilterPropTypeUtil);
11089 - const snapshotsByKeyRef = (0, react.useRef)({});
11090 - const handleValueChange = (nextValue, options, meta) => {
11091 - if (meta?.bind !== "key") {
11092 - propContext.setValue(nextValue, options, meta);
11093 - return;
11094 - }
11095 - const previousKey = _elementor_editor_props.stringPropTypeUtil.extract(propContext.value?.key);
11096 - const newKey = _elementor_editor_props.stringPropTypeUtil.extract(nextValue?.key);
11097 - if (previousKey) snapshotsByKeyRef.current[previousKey] = {
11098 - values: propContext.value?.values ?? null,
11099 - taxonomies: propContext.value?.taxonomies ?? null
11100 - };
11101 - const restored = newKey ? snapshotsByKeyRef.current[newKey] : void 0;
11102 - propContext.setValue({
11103 - ...nextValue,
11104 - values: restored?.values ?? null,
11105 - taxonomies: restored?.taxonomies ?? null
11106 - }, options, meta);
11107 - };
11108 - const currentKey = _elementor_editor_props.stringPropTypeUtil.extract(propContext.value?.key);
11109 - const currentKeyConfig = currentKey ? keyConfig[currentKey] : void 0;
11110 - const valueType = currentKeyConfig?.valueType ?? "chips";
11111 - const keySelectOptions = (0, react.useMemo)(() => getKeySelectOptions(currentKey), [getKeySelectOptions, currentKey]);
11112 - return /* @__PURE__ */ react.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ react.createElement(PropProvider, {
11113 - ...propContext,
11114 - setValue: handleValueChange
11115 - }, /* @__PURE__ */ react.createElement(PopoverGridContainer, { flexWrap: "wrap" }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11116 - item: true,
11117 - xs: 12
11118 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Type", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11119 - item: true,
11120 - xs: 12
11121 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "key" }, /* @__PURE__ */ react.createElement(SelectControl, { options: keySelectOptions })))), valueType === "taxonomies" && currentKeyConfig?.staticOptions && /* @__PURE__ */ react.createElement(PopoverGridContainer, { flexWrap: "wrap" }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11122 - item: true,
11123 - xs: 12
11124 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, currentKeyConfig.label)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11125 - item: true,
11126 - xs: 12
11127 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "taxonomies" }, /* @__PURE__ */ react.createElement(ChipsControl, { options: currentKeyConfig.staticOptions })))), valueType !== "taxonomies" && currentKeyConfig?.queryEndpoint && /* @__PURE__ */ react.createElement(PopoverGridContainer, { flexWrap: "wrap" }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11128 - item: true,
11129 - xs: 12
11130 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, currentKeyConfig.label)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11131 - item: true,
11132 - xs: 12
11133 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "values" }, /* @__PURE__ */ react.createElement(QueryChipsControl, {
11134 - queryOptions: {
11135 - url: currentKeyConfig.queryEndpoint.url,
11136 - params: currentKeyConfig.queryEndpoint.params ?? {}
11137 - },
11138 - placeholder: currentKeyConfig.chipsPlaceholder ?? chipsPlaceholder
11139 - }))))));
11140 - }, "ItemContent");
11141 - function isKeyVisible(rule, settings) {
11142 - if (!rule) return true;
11143 - if (!settings) return false;
11144 - const extracted = _elementor_editor_props.stringPropTypeUtil.extract((0, _elementor_editor_props.extractValue)(rule.path, settings));
11145 - return extracted !== null && rule.in.includes(extracted);
11146 - }
11147 - function extractTaxonomyLabels(taxonomiesProp, config) {
11148 - const slugs = (_elementor_editor_props.stringArrayPropTypeUtil.extract(taxonomiesProp) ?? []).map((item) => _elementor_editor_props.stringPropTypeUtil.extract(item)).filter((slug) => !!slug);
11149 - if (!slugs.length) return [];
11150 - const options = config?.staticOptions ?? [];
11151 - return slugs.map((slug) => options.find((opt) => opt.value === slug)?.label ?? slug);
11152 - }
11153 - function createItemForKey(key) {
11154 - return _elementor_editor_props.queryFilterPropTypeUtil.create({
11155 - key: _elementor_editor_props.stringPropTypeUtil.create(key),
11156 - values: null,
11157 - taxonomies: null
11158 - });
11159 - }
11160 - function getUsedKeys(items) {
11161 - const keys = items.map((item) => _elementor_editor_props.stringPropTypeUtil.extract(item?.value?.key)).filter((key) => !!key);
11162 - return new Set(keys);
11163 - }
11164 -
11165 -//#endregion
11166 -//#region packages/packages/libs/editor-controls/src/controls/gap-control.tsx
11167 - var GapControl = ({ label }) => {
11168 - const stackRef = (0, react.useRef)(null);
11169 - const { disabled: sizeDisabled } = useBoundProp(_elementor_editor_props.sizePropTypeUtil);
11170 - const { value: directionValue, setValue: setDirectionValue, propType, placeholder: directionPlaceholder, disabled: directionDisabled } = useBoundProp(_elementor_editor_props.layoutDirectionPropTypeUtil);
11171 - const { value: masterValue, setValue: setMasterValue, placeholder: masterPlaceholder } = useBoundProp();
11172 - const inferIsLinked = () => {
11173 - if (_elementor_editor_props.layoutDirectionPropTypeUtil.isValid(masterValue)) return false;
11174 - if (!masterValue && _elementor_editor_props.layoutDirectionPropTypeUtil.isValid(masterPlaceholder)) return false;
11175 - return true;
11176 - };
11177 - const [isLinked, setIsLinked] = (0, react.useState)(() => inferIsLinked());
11178 - const isCurrentlyDirection = _elementor_editor_props.layoutDirectionPropTypeUtil.isValid(masterValue ?? masterPlaceholder);
11179 - (0, react.useLayoutEffect)(() => {
11180 - setIsLinked(inferIsLinked());
11181 - }, [(0, _elementor_editor_responsive.useActiveBreakpoint)(), isCurrentlyDirection]);
11182 - const onLinkToggle = () => {
11183 - setIsLinked((prev) => !prev);
11184 - if (!_elementor_editor_props.layoutDirectionPropTypeUtil.isValid(masterValue)) {
11185 - const currentValue2 = masterValue ? masterValue : null;
11186 - if (!currentValue2) {
11187 - setMasterValue(null);
11188 - return;
11189 - }
11190 - setMasterValue(_elementor_editor_props.layoutDirectionPropTypeUtil.create({
11191 - row: currentValue2,
11192 - column: currentValue2
11193 - }));
11194 - return;
11195 - }
11196 - const currentValue = directionValue?.column ?? directionValue?.row ?? null;
11197 - setMasterValue(currentValue);
11198 - };
11199 - const tooltipLabel = label.toLowerCase();
11200 - const LinkedIcon = isLinked ? _elementor_icons.LinkIcon : _elementor_icons.DetachIcon;
11201 - const linkedLabel = (0, _wordpress_i18n.__)("Link %s", "elementor").replace("%s", tooltipLabel);
11202 - const unlinkedLabel = (0, _wordpress_i18n.__)("Unlink %s", "elementor").replace("%s", tooltipLabel);
11203 - const disabled = sizeDisabled || directionDisabled;
11204 - const propProviderProps = {
11205 - propType,
11206 - value: directionValue ?? (!isLinked ? {
11207 - row: directionPlaceholder?.row,
11208 - column: directionPlaceholder?.column
11209 - } : null),
11210 - setValue: (directions) => {
11211 - const filtered = Object.entries(directions).filter(([, value]) => Boolean(value));
11212 - setDirectionValue(filtered.length === 0 ? null : Object.fromEntries(filtered));
11213 - },
11214 - placeholder: directionPlaceholder
11215 - };
11216 - const hasPlaceholders = !masterValue && (directionPlaceholder || masterPlaceholder);
11217 - const getEffectivePlaceholder = (bind) => {
11218 - if (isLinked) {
11219 - const linkedPlaceholder = directionPlaceholder?.column ?? directionPlaceholder?.row;
11220 - return _elementor_editor_props.sizePropTypeUtil.extract(linkedPlaceholder);
11221 - }
11222 - return _elementor_editor_props.sizePropTypeUtil.extract(directionPlaceholder?.[bind]);
11223 - };
11224 - return /* @__PURE__ */ react.createElement(PropProvider, { ...propProviderProps }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
11225 - direction: "row",
11226 - gap: 2,
11227 - flexWrap: "nowrap"
11228 - }, /* @__PURE__ */ react.createElement(ControlLabel, null, label), /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
11229 - title: isLinked ? unlinkedLabel : linkedLabel,
11230 - placement: "top"
11231 - }, /* @__PURE__ */ react.createElement(StyledToggleButton, {
11232 - "aria-label": isLinked ? unlinkedLabel : linkedLabel,
11233 - size: "tiny",
11234 - value: "check",
11235 - selected: isLinked,
11236 - sx: { marginLeft: "auto" },
11237 - onChange: onLinkToggle,
11238 - disabled,
11239 - isPlaceholder: hasPlaceholders
11240 - }, /* @__PURE__ */ react.createElement(LinkedIcon, { fontSize: "tiny" })))), /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
11241 - direction: "row",
11242 - gap: 2,
11243 - flexWrap: "nowrap",
11244 - ref: stackRef
11245 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11246 - container: true,
11247 - gap: .75,
11248 - alignItems: "center"
11249 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11250 - item: true,
11251 - xs: 12
11252 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Column", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11253 - item: true,
11254 - xs: 12
11255 - }, /* @__PURE__ */ react.createElement(Control, {
11256 - bind: "column",
11257 - ariaLabel: (0, _wordpress_i18n.__)("Column gap", "elementor"),
11258 - isLinked,
11259 - anchorRef: stackRef,
11260 - placeholder: getEffectivePlaceholder("column") ?? void 0
11261 - }))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11262 - container: true,
11263 - gap: .75,
11264 - alignItems: "center"
11265 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11266 - item: true,
11267 - xs: 12
11268 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Row", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11269 - item: true,
11270 - xs: 12
11271 - }, /* @__PURE__ */ react.createElement(Control, {
11272 - bind: "row",
11273 - ariaLabel: (0, _wordpress_i18n.__)("Row gap", "elementor"),
11274 - isLinked,
11275 - anchorRef: stackRef,
11276 - placeholder: getEffectivePlaceholder("row") ?? void 0
11277 - })))));
11278 - };
11279 - var Control = ({ bind, ariaLabel, isLinked, anchorRef, placeholder }) => {
11280 - if (isLinked) return /* @__PURE__ */ react.createElement(UnstableSizeControl, {
11281 - anchorRef,
11282 - placeholder,
11283 - ariaLabel
11284 - });
11285 - return /* @__PURE__ */ react.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ react.createElement(UnstableSizeControl, {
11286 - anchorRef,
11287 - placeholder,
11288 - ariaLabel
11289 - }));
11290 - };
11291 -
11292 -//#endregion
11293 -//#region packages/packages/libs/editor-controls/src/controls/aspect-ratio-control.tsx
11294 - var RATIO_OPTIONS = [
11295 - {
11296 - label: (0, _wordpress_i18n.__)("Auto", "elementor"),
11297 - value: "auto"
11298 - },
11299 - {
11300 - label: "1/1",
11301 - value: "1/1"
11302 - },
11303 - {
11304 - label: "4/3",
11305 - value: "4/3"
11306 - },
11307 - {
11308 - label: "3/4",
11309 - value: "3/4"
11310 - },
11311 - {
11312 - label: "16/9",
11313 - value: "16/9"
11314 - },
11315 - {
11316 - label: "9/16",
11317 - value: "9/16"
11318 - },
11319 - {
11320 - label: "3/2",
11321 - value: "3/2"
11322 - },
11323 - {
11324 - label: "2/3",
11325 - value: "2/3"
11326 - }
11327 - ];
11328 - var CUSTOM_RATIO = "custom";
11329 - var AspectRatioControl = createControl(({ label }) => {
11330 - const { value: currentPropValue, setValue: setAspectRatioValue, disabled, placeholder: externalPlaceholder } = useBoundProp(_elementor_editor_props.stringPropTypeUtil);
11331 - const aspectRatioValue = currentPropValue ?? externalPlaceholder;
11332 - const isCustomSelected = aspectRatioValue && !RATIO_OPTIONS.some((option) => option.value === aspectRatioValue);
11333 - const [initialWidth, initialHeight] = isCustomSelected ? aspectRatioValue.split("/") : ["", ""];
11334 - const [isCustom, setIsCustom] = (0, react.useState)(isCustomSelected);
11335 - const [customWidth, setCustomWidth] = (0, react.useState)(initialWidth);
11336 - const [customHeight, setCustomHeight] = (0, react.useState)(initialHeight);
11337 - const [selectedValue, setSelectedValue] = (0, react.useState)(isCustomSelected ? CUSTOM_RATIO : aspectRatioValue || "");
11338 - (0, react.useEffect)(() => {
11339 - if (aspectRatioValue && !RATIO_OPTIONS.some((option) => option.value === aspectRatioValue)) {
11340 - const [width, height] = aspectRatioValue.split("/");
11341 - setCustomWidth(width.trim() || "");
11342 - setCustomHeight(height.trim() || "");
11343 - setSelectedValue(CUSTOM_RATIO);
11344 - setIsCustom(true);
11345 - } else {
11346 - setSelectedValue(aspectRatioValue || "");
11347 - setIsCustom(false);
11348 - setCustomWidth("");
11349 - setCustomHeight("");
11350 - }
11351 - }, [aspectRatioValue]);
11352 - const handleSelectChange = (event) => {
11353 - const newValue = event.target.value;
11354 - const isCustomRatio = newValue === CUSTOM_RATIO;
11355 - setIsCustom(isCustomRatio);
11356 - setSelectedValue(newValue);
11357 - if (isCustomRatio) return;
11358 - setAspectRatioValue(newValue);
11359 - };
11360 - const handleCustomWidthChange = (event) => {
11361 - const newWidth = event.target.value;
11362 - setCustomWidth(newWidth);
11363 - if (newWidth && customHeight) setAspectRatioValue(`${newWidth}/${customHeight}`);
11364 - };
11365 - const handleCustomHeightChange = (event) => {
11366 - const newHeight = event.target.value;
11367 - setCustomHeight(newHeight);
11368 - if (customWidth && newHeight) setAspectRatioValue(`${customWidth}/${newHeight}`);
11369 - };
11370 - const lookup = currentPropValue ?? externalPlaceholder;
11371 - const selectedOption = RATIO_OPTIONS.find((option) => option.value === lookup);
11372 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
11373 - direction: "column",
11374 - gap: 2
11375 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11376 - container: true,
11377 - gap: 2,
11378 - alignItems: "center",
11379 - flexWrap: "nowrap"
11380 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11381 - item: true,
11382 - xs: 6
11383 - }, /* @__PURE__ */ react.createElement(ControlLabel, null, label)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11384 - item: true,
11385 - xs: 6
11386 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Select, {
11387 - size: "tiny",
11388 - displayEmpty: true,
11389 - sx: { overflow: "hidden" },
11390 - disabled,
11391 - value: selectedValue,
11392 - onChange: handleSelectChange,
11393 - renderValue: isCustomSelected ? void 0 : () => selectedOption?.label,
11394 - fullWidth: true
11395 - }, [...RATIO_OPTIONS, {
11396 - label: (0, _wordpress_i18n.__)("Custom", "elementor"),
11397 - value: CUSTOM_RATIO
11398 - }].map(({ label: optionLabel, ...props }) => /* @__PURE__ */ react.createElement(_elementor_editor_ui.MenuListItem, {
11399 - key: props.value,
11400 - ...props,
11401 - value: props.value ?? ""
11402 - }, optionLabel))))), isCustom && /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11403 - container: true,
11404 - gap: 2,
11405 - alignItems: "center",
11406 - flexWrap: "nowrap"
11407 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11408 - item: true,
11409 - xs: 6
11410 - }, /* @__PURE__ */ react.createElement(_elementor_ui.TextField, {
11411 - size: "tiny",
11412 - type: "number",
11413 - fullWidth: true,
11414 - disabled,
11415 - value: customWidth,
11416 - onChange: handleCustomWidthChange,
11417 - InputProps: { startAdornment: /* @__PURE__ */ react.createElement(_elementor_icons.ArrowsMoveHorizontalIcon, { fontSize: "tiny" }) }
11418 - })), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11419 - item: true,
11420 - xs: 6
11421 - }, /* @__PURE__ */ react.createElement(_elementor_ui.TextField, {
11422 - size: "tiny",
11423 - type: "number",
11424 - fullWidth: true,
11425 - disabled,
11426 - value: customHeight,
11427 - onChange: handleCustomHeightChange,
11428 - InputProps: { startAdornment: /* @__PURE__ */ react.createElement(_elementor_icons.ArrowsMoveVerticalIcon, { fontSize: "tiny" }) }
11429 - })))));
11430 - });
11431 -
11432 -//#endregion
11433 -//#region packages/packages/libs/editor-controls/src/components/enable-unfiltered-modal.tsx
11434 - var ADMIN_TITLE_TEXT = (0, _wordpress_i18n.__)("Enable Unfiltered Uploads", "elementor");
11435 - var ADMIN_CONTENT_TEXT = (0, _wordpress_i18n.__)("Before you enable unfiltered files upload, note that such files include a security risk. Elementor does run a process to remove possible malicious code, but there is still risk involved when using such files.", "elementor");
11436 - var ADMIN_FAILED_CONTENT_TEXT_PT1 = (0, _wordpress_i18n.__)("Failed to enable unfiltered files upload.", "elementor");
11437 - var ADMIN_FAILED_CONTENT_TEXT_PT2 = (0, _wordpress_i18n.__)("You can try again, if the problem persists, please contact support.", "elementor");
11438 - var WAIT_FOR_CLOSE_TIMEOUT_MS = 300;
11439 - var EnableUnfilteredModal = (props) => {
11440 - const { mutateAsync, isPending } = useUpdateUnfilteredFilesUpload();
11441 - const [isError, setIsError] = (0, react.useState)(false);
11442 - const onClose = (enabled) => {
11443 - props.onClose(enabled);
11444 - setTimeout(() => setIsError(false), WAIT_FOR_CLOSE_TIMEOUT_MS);
11445 - };
11446 - const handleEnable = async () => {
11447 - try {
11448 - if ((await mutateAsync({ allowUnfilteredFilesUpload: true }))?.data?.success === false) setIsError(true);
11449 - else props.onClose(true);
11450 - } catch {
11451 - setIsError(true);
11452 - }
11453 - };
11454 - const dialogProps = {
11455 - ...props,
11456 - isPending,
11457 - handleEnable,
11458 - isError,
11459 - onClose
11460 - };
11461 - return /* @__PURE__ */ react.createElement(AdminDialog, { ...dialogProps });
11462 - };
11463 - var AdminDialog = ({ open, onClose, handleEnable, isPending, isError }) => /* @__PURE__ */ react.createElement(_elementor_ui.Dialog, {
11464 - open,
11465 - maxWidth: "sm",
11466 - onClose: () => onClose(false)
11467 - }, /* @__PURE__ */ react.createElement(_elementor_ui.DialogHeader, { logo: false }, /* @__PURE__ */ react.createElement(_elementor_ui.DialogTitle, null, ADMIN_TITLE_TEXT)), /* @__PURE__ */ react.createElement(_elementor_ui.Divider, null), /* @__PURE__ */ react.createElement(_elementor_ui.DialogContent, null, /* @__PURE__ */ react.createElement(_elementor_ui.DialogContentText, null, isError ? /* @__PURE__ */ react.createElement(react.Fragment, null, ADMIN_FAILED_CONTENT_TEXT_PT1, " ", /* @__PURE__ */ react.createElement("br", null), " ", ADMIN_FAILED_CONTENT_TEXT_PT2) : ADMIN_CONTENT_TEXT)), /* @__PURE__ */ react.createElement(_elementor_ui.DialogActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
11468 - size: "medium",
11469 - color: "secondary",
11470 - onClick: () => onClose(false)
11471 - }, (0, _wordpress_i18n.__)("Cancel", "elementor")), /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
11472 - size: "medium",
11473 - onClick: () => handleEnable(),
11474 - variant: "contained",
11475 - color: "primary",
11476 - disabled: isPending
11477 - }, isPending ? /* @__PURE__ */ react.createElement(_elementor_ui.CircularProgress, { size: 24 }) : (0, _wordpress_i18n.__)("Enable", "elementor"))));
11478 -
11479 -//#endregion
11480 -//#region packages/packages/libs/editor-controls/src/controls/open-icon-library.ts
11481 - var SVG_ICON_LIBRARY = "svg";
11482 - function isSvgLibrarySelection(icon) {
11483 - return icon.library === "svg" && typeof icon.value === "object" && icon.value !== null;
11484 - }
11485 - function openIconLibrary({ selected, onSelect } = {}) {
11486 - const iconManager = window.elementor?.iconManager;
11487 - if (!iconManager) return;
11488 - iconManager.loadIconLibraries();
11489 - iconManager.show({ view: createIconManagerControlView(selected, onSelect) });
11490 - }
11491 - function enqueueIconFonts(library) {
11492 - window.elementor?.helpers?.enqueueIconFonts?.(library);
11493 - }
11494 - function createIconManagerControlView(selected, onSelect) {
11495 - return {
11496 - model: { get: () => false },
11497 - getControlValue: () => selected ?? {
11498 - value: "",
11499 - library: ""
11500 - },
11501 - setValue: (icon) => {
11502 - onSelect?.(icon);
11503 - },
11504 - applySavedValue: () => void 0
11505 - };
11506 - }
11507 - function createIconPropValue(icon, library) {
11508 - return {
11509 - value: _elementor_editor_props.stringPropTypeUtil.create(icon),
11510 - library: _elementor_editor_props.stringPropTypeUtil.create(library)
11511 - };
11512 - }
11513 -
11514 -//#endregion
11515 -//#region packages/packages/libs/editor-controls/src/controls/svg-media-control.tsx
11516 - var TILE_SIZE = 8;
11517 - var TILE_WHITE = "transparent";
11518 - var TILE_BLACK = "#c1c1c1";
11519 - var ICON_PREVIEW_FONT_SIZE = 50;
11520 - var TILES_GRADIENT_FORMULA = `linear-gradient(45deg, ${TILE_BLACK} 25%, ${TILE_WHITE} 0, ${TILE_WHITE} 75%, ${TILE_BLACK} 0, ${TILE_BLACK})`;
11521 - var StyledCard = (0, _elementor_ui.styled)(_elementor_ui.Card)`
11522 - background-color: white;
11523 - background-image: ${TILES_GRADIENT_FORMULA}, ${TILES_GRADIENT_FORMULA};
11524 - background-size: ${TILE_SIZE}px ${TILE_SIZE}px;
11525 - background-position:
11526 - 0 0,
11527 - ${TILE_SIZE / 2}px ${TILE_SIZE / 2}px;
11528 - border: none;
11529 -`;
11530 - var StyledCardMediaContainer = (0, _elementor_ui.styled)(_elementor_ui.Stack)`
11531 - position: relative;
11532 - height: 140px;
11533 - object-fit: contain;
11534 - padding: 5px;
11535 - justify-content: center;
11536 - align-items: center;
11537 - background-color: rgba( 255, 255, 255, 0.37 );
11538 -`;
11539 - var MODE_BROWSE = { mode: "browse" };
11540 - var MODE_UPLOAD = { mode: "upload" };
11541 - var SvgMediaControl = createControl(({ showIconLibrary = false }) => {
11542 - const { value: svgValue, setValue: setSvgValue } = useBoundProp(_elementor_editor_props.svgSrcPropTypeUtil);
11543 - const { value: iconValue, setValue: setIconValue } = useBoundProp(_elementor_editor_props.iconPropTypeUtil);
11544 - const id = svgValue?.id;
11545 - const url = svgValue?.url;
11546 - const { data: attachment, isFetching } = (0, _elementor_wp_media.useWpMediaAttachment)(id?.value || null);
11547 - const src = attachment?.url ?? url?.value ?? null;
11548 - const { data: allowSvgUpload } = useUnfilteredFilesUpload();
11549 - const [unfilteredModalOpenState, setUnfilteredModalOpenState] = (0, react.useState)(false);
11550 - const { isAdmin } = (0, _elementor_editor_current_user.useCurrentUserCapabilities)();
11551 - const selectedIconClass = showIconLibrary && typeof iconValue?.value?.value === "string" ? iconValue.value.value : null;
11552 - const selectedIconLibrary = showIconLibrary && typeof iconValue?.library?.value === "string" ? iconValue.library.value : null;
11553 - const { open } = (0, _elementor_wp_media.useWpMediaFrame)({
11554 - mediaTypes: ["svg"],
11555 - multiple: false,
11556 - selected: id?.value || null,
11557 - onSelect: (selectedAttachment) => {
11558 - setSvgValue({
11559 - id: {
11560 - $$type: "image-attachment-id",
11561 - value: selectedAttachment.id
11562 - },
11563 - url: _elementor_editor_props.urlPropTypeUtil.create(selectedAttachment.url)
11564 - });
11565 - }
11566 - });
11567 - const onCloseUnfilteredModal = (enabled) => {
11568 - setUnfilteredModalOpenState(false);
11569 - if (enabled) open(MODE_UPLOAD);
11570 - };
11571 - const handleClick = (openOptions) => {
11572 - if (!allowSvgUpload && openOptions === MODE_UPLOAD) setUnfilteredModalOpenState(true);
11573 - else open(openOptions);
11574 - };
11575 - const handleIconLibrarySelect = (icon) => {
11576 - if (!showIconLibrary) return;
11577 - if (isSvgLibrarySelection(icon)) {
11578 - setSvgValue({
11579 - id: icon.value.id ? {
11580 - $$type: "image-attachment-id",
11581 - value: icon.value.id
11582 - } : null,
11583 - url: icon.value.url ? _elementor_editor_props.urlPropTypeUtil.create(icon.value.url) : null
11584 - });
11585 - return;
11586 - }
11587 - if (typeof icon.value === "string") setIconValue(createIconPropValue(icon.value, icon.library));
11588 - };
11589 - const infotipProps = {
11590 - title: (0, _wordpress_i18n.__)("Sorry, you can't upload that file yet.", "elementor"),
11591 - description: /* @__PURE__ */ react.createElement(react.Fragment, null, (0, _wordpress_i18n.__)("To upload them anyway, ask the site administrator to enable unfiltered", "elementor"), /* @__PURE__ */ react.createElement("br", null), (0, _wordpress_i18n.__)("file uploads.", "elementor")),
11592 - isEnabled: !isAdmin
11593 - };
11594 - return /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
11595 - gap: 1,
11596 - "aria-label": "SVG Control"
11597 - }, /* @__PURE__ */ react.createElement(EnableUnfilteredModal, {
11598 - open: unfilteredModalOpenState,
11599 - onClose: onCloseUnfilteredModal
11600 - }), /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(StyledCard, { variant: "outlined" }, /* @__PURE__ */ react.createElement(StyledCardMediaContainer, null, /* @__PURE__ */ react.createElement(SvgMediaPreview, {
11601 - isFetching,
11602 - src,
11603 - iconClassName: selectedIconClass,
11604 - iconLibrary: selectedIconLibrary
11605 - })), /* @__PURE__ */ react.createElement(_elementor_ui.CardOverlay, { sx: { "&:hover": { backgroundColor: "rgba( 0, 0, 0, 0.75 )" } } }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, { gap: 1 }, /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
11606 - size: "tiny",
11607 - color: "inherit",
11608 - variant: "outlined",
11609 - onClick: () => handleClick(MODE_BROWSE),
11610 - "aria-label": "Select SVG"
11611 - }, (0, _wordpress_i18n.__)("Select SVG", "elementor")), showIconLibrary ? /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
11612 - size: "tiny",
11613 - variant: "text",
11614 - color: "inherit",
11615 - onClick: () => openIconLibrary({
11616 - selected: selectedIconClass && selectedIconLibrary ? {
11617 - value: selectedIconClass,
11618 - library: selectedIconLibrary
11619 - } : void 0,
11620 - onSelect: handleIconLibrarySelect
11621 - }),
11622 - "aria-label": (0, _wordpress_i18n.__)("Icon library", "elementor")
11623 - }, (0, _wordpress_i18n.__)("Icon library", "elementor")) : null, /* @__PURE__ */ react.createElement(ConditionalControlInfotip, { ...infotipProps }, /* @__PURE__ */ react.createElement("span", null, /* @__PURE__ */ react.createElement(_elementor_ui.ThemeProvider, { colorScheme: isAdmin ? "light" : "dark" }, /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
11624 - size: "tiny",
11625 - variant: "text",
11626 - color: "inherit",
11627 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.UploadIcon, null),
11628 - disabled: !isAdmin,
11629 - onClick: () => isAdmin && handleClick(MODE_UPLOAD),
11630 - "aria-label": "Upload SVG"
11631 - }, (0, _wordpress_i18n.__)("Upload", "elementor"))))))))));
11632 - });
11633 - function SvgMediaPreview({ isFetching, src, iconClassName, iconLibrary }) {
11634 - (0, react.useEffect)(() => {
11635 - if (iconLibrary) enqueueIconFonts(iconLibrary);
11636 - }, [iconLibrary]);
11637 - if (isFetching) return /* @__PURE__ */ react.createElement(_elementor_ui.CircularProgress, { role: "progressbar" });
11638 - if (iconClassName) return /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
11639 - component: "i",
11640 - className: iconClassName,
11641 - "aria-label": (0, _wordpress_i18n.__)("Preview icon", "elementor"),
11642 - sx: { fontSize: ICON_PREVIEW_FONT_SIZE }
11643 - });
11644 - return /* @__PURE__ */ react.createElement(_elementor_ui.CardMedia, {
11645 - component: "img",
11646 - image: src,
11647 - alt: (0, _wordpress_i18n.__)("Preview SVG", "elementor"),
11648 - sx: {
11649 - maxHeight: "140px",
11650 - width: `${ICON_PREVIEW_FONT_SIZE}px`
11651 - }
11652 - });
11653 - }
11654 -
11655 -//#endregion
11656 -//#region packages/packages/libs/editor-controls/src/controls/video-media-control.tsx
11657 - var PLACEHOLDER_IMAGE = window.elementorCommon?.config?.urls?.assets + "/shapes/play-triangle.svg";
11658 - var VideoMediaControl = createControl(() => {
11659 - const { value, setValue, propType } = useBoundProp(_elementor_editor_props.videoSrcPropTypeUtil);
11660 - const { id, url } = value ?? {};
11661 - const { data: attachment, isFetching } = (0, _elementor_wp_media.useWpMediaAttachment)(id?.value || null);
11662 - const videoUrl = attachment?.url ?? url?.value ?? null;
11663 - const defaultUrl = _elementor_editor_props.videoSrcPropTypeUtil.extract(propType.default ?? null)?.url?.value;
11664 - const currentUrlForModal = url?.value && url.value !== defaultUrl ? url.value : void 0;
11665 - const { open } = (0, _elementor_wp_media.useWpMediaFrame)({
11666 - mediaTypes: ["video"],
11667 - multiple: false,
11668 - selected: id?.value || null,
11669 - allowUrlImport: true,
11670 - onSelect: (selectedAttachment) => {
11671 - setValue({
11672 - id: {
11673 - $$type: "video-attachment-id",
11674 - value: selectedAttachment.id
11675 - },
11676 - url: null
11677 - });
11678 - },
11679 - onSelectUrl: (selectedUrl) => {
11680 - setValue({
11681 - id: null,
11682 - url: _elementor_editor_props.urlPropTypeUtil.create(selectedUrl)
11683 - });
11684 - }
11685 - });
11686 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.Card, { variant: "outlined" }, /* @__PURE__ */ react.createElement(_elementor_ui.CardMedia, { sx: {
11687 - height: 140,
11688 - backgroundColor: "white",
11689 - backgroundSize: "8px 8px",
11690 - backgroundPosition: "0 0, 4px 4px",
11691 - backgroundRepeat: "repeat",
11692 - backgroundImage: `${TILES_GRADIENT_FORMULA}, ${TILES_GRADIENT_FORMULA}`,
11693 - display: "flex",
11694 - justifyContent: "center",
11695 - alignItems: "center"
11696 - } }, /* @__PURE__ */ react.createElement(VideoPreview, {
11697 - isFetching,
11698 - videoUrl
11699 - })), /* @__PURE__ */ react.createElement(_elementor_ui.CardOverlay, null, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, { gap: 1 }, /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
11700 - size: "tiny",
11701 - color: "inherit",
11702 - variant: "outlined",
11703 - onClick: () => open({ mode: "browse" })
11704 - }, (0, _wordpress_i18n.__)("Select video", "elementor")), /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
11705 - size: "tiny",
11706 - variant: "text",
11707 - color: "inherit",
11708 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.UploadIcon, null),
11709 - onClick: () => open({ mode: "upload" })
11710 - }, (0, _wordpress_i18n.__)("Upload", "elementor")), /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
11711 - size: "tiny",
11712 - variant: "text",
11713 - color: "inherit",
11714 - onClick: () => open({
11715 - mode: "url",
11716 - currentUrl: currentUrlForModal
11717 - })
11718 - }, (0, _wordpress_i18n.__)("Insert from URL", "elementor"))))));
11719 - });
11720 - var VideoPreview = ({ isFetching = false, videoUrl }) => {
11721 - if (isFetching) return /* @__PURE__ */ react.createElement(_elementor_ui.CircularProgress, null);
11722 - if (videoUrl) return /* @__PURE__ */ react.createElement("video", {
11723 - "aria-label": (0, _wordpress_i18n.__)("Video preview", "elementor"),
11724 - src: videoUrl,
11725 - muted: true,
11726 - preload: "metadata",
11727 - style: {
11728 - width: "100%",
11729 - height: "100%",
11730 - objectFit: "cover",
11731 - pointerEvents: "none"
11732 - }
11733 - });
11734 - return /* @__PURE__ */ react.createElement("img", {
11735 - src: PLACEHOLDER_IMAGE,
11736 - alt: "No video selected"
11737 - });
11738 - };
11739 -
11740 -//#endregion
11741 -//#region packages/packages/libs/editor-controls/src/env.ts
11742 - var { env } = (0, _elementor_env.parseEnv)("@elementor/editor-controls");
11743 -
11744 -//#endregion
11745 -//#region packages/packages/libs/editor-controls/src/controls/background-control/background-gradient-color-control.tsx
11746 - var BackgroundGradientColorControl = createControl(() => {
11747 - const { value, setValue } = useBoundProp(_elementor_editor_props.backgroundGradientOverlayPropTypeUtil);
11748 - const handleChange = (newValue) => {
11749 - const transformedValue = createTransformableValue(newValue);
11750 - if (transformedValue.positions) transformedValue.positions = _elementor_editor_props.stringPropTypeUtil.create(newValue.positions.join(" "));
11751 - setValue(transformedValue);
11752 - };
11753 - const createTransformableValue = (newValue) => ({
11754 - ...newValue,
11755 - type: _elementor_editor_props.stringPropTypeUtil.create(newValue.type),
11756 - angle: _elementor_editor_props.numberPropTypeUtil.create(newValue.angle),
11757 - stops: _elementor_editor_props.gradientColorStopPropTypeUtil.create(newValue.stops.map(({ color, offset }) => _elementor_editor_props.colorStopPropTypeUtil.create({
11758 - color: _elementor_editor_props.colorPropTypeUtil.create(color),
11759 - offset: _elementor_editor_props.numberPropTypeUtil.create(offset)
11760 - })))
11761 - });
11762 - const normalizeValue = () => {
11763 - if (!value) return;
11764 - const { type, angle, stops, positions } = value;
11765 - return {
11766 - type: type.value,
11767 - angle: angle?.value || 0,
11768 - stops: stops.value.map(({ value: { color, offset } }, index, arr) => ({
11769 - color: color.value,
11770 - offset: offset?.value ?? (arr.length > 1 ? index / (arr.length - 1) * 100 : 0)
11771 - })),
11772 - positions: positions?.value.split(" ")
11773 - };
11774 - };
11775 - return /* @__PURE__ */ react.createElement(_elementor_ui.UnstableGradientBox, {
11776 - sx: {
11777 - width: "auto",
11778 - padding: 1.5
11779 - },
11780 - value: normalizeValue(),
11781 - onChange: handleChange
11782 - });
11783 - });
11784 - var initialBackgroundGradientOverlay = _elementor_editor_props.backgroundGradientOverlayPropTypeUtil.create({
11785 - type: _elementor_editor_props.stringPropTypeUtil.create("linear"),
11786 - angle: _elementor_editor_props.numberPropTypeUtil.create(180),
11787 - stops: _elementor_editor_props.gradientColorStopPropTypeUtil.create([_elementor_editor_props.colorStopPropTypeUtil.create({
11788 - color: _elementor_editor_props.colorPropTypeUtil.create("rgb(0,0,0)"),
11789 - offset: _elementor_editor_props.numberPropTypeUtil.create(0)
11790 - }), _elementor_editor_props.colorStopPropTypeUtil.create({
11791 - color: _elementor_editor_props.colorPropTypeUtil.create("rgb(255,255,255)"),
11792 - offset: _elementor_editor_props.numberPropTypeUtil.create(100)
11793 - })])
11794 - });
11795 -
11796 -//#endregion
11797 -//#region packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-attachment.tsx
11798 - var attachmentControlOptions = [{
11799 - value: "fixed",
11800 - label: (0, _wordpress_i18n.__)("Fixed", "elementor"),
11801 - renderContent: ({ size }) => /* @__PURE__ */ react.createElement(_elementor_icons.PinIcon, { fontSize: size }),
11802 - showTooltip: true
11803 - }, {
11804 - value: "scroll",
11805 - label: (0, _wordpress_i18n.__)("Scroll", "elementor"),
11806 - renderContent: ({ size }) => /* @__PURE__ */ react.createElement(_elementor_icons.PinnedOffIcon, { fontSize: size }),
11807 - showTooltip: true
11808 - }];
11809 - var BackgroundImageOverlayAttachment = () => {
11810 - return /* @__PURE__ */ react.createElement(PopoverGridContainer, null, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11811 - item: true,
11812 - xs: 6
11813 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Attachment", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11814 - item: true,
11815 - xs: 6,
11816 - sx: {
11817 - display: "flex",
11818 - justifyContent: "flex-end",
11819 - overflow: "hidden"
11820 - }
11821 - }, /* @__PURE__ */ react.createElement(ToggleControl, { options: attachmentControlOptions })));
11822 - };
11823 -
11824 -//#endregion
11825 -//#region packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx
11826 - var backgroundPositionOptions = [
11827 - {
11828 - label: (0, _wordpress_i18n.__)("Center center", "elementor"),
11829 - value: "center center"
11830 - },
11831 - {
11832 - label: (0, _wordpress_i18n.__)("Center left", "elementor"),
11833 - value: "center left"
11834 - },
11835 - {
11836 - label: (0, _wordpress_i18n.__)("Center right", "elementor"),
11837 - value: "center right"
11838 - },
11839 - {
11840 - label: (0, _wordpress_i18n.__)("Top center", "elementor"),
11841 - value: "top center"
11842 - },
11843 - {
11844 - label: (0, _wordpress_i18n.__)("Top left", "elementor"),
11845 - value: "top left"
11846 - },
11847 - {
11848 - label: (0, _wordpress_i18n.__)("Top right", "elementor"),
11849 - value: "top right"
11850 - },
11851 - {
11852 - label: (0, _wordpress_i18n.__)("Bottom center", "elementor"),
11853 - value: "bottom center"
11854 - },
11855 - {
11856 - label: (0, _wordpress_i18n.__)("Bottom left", "elementor"),
11857 - value: "bottom left"
11858 - },
11859 - {
11860 - label: (0, _wordpress_i18n.__)("Bottom right", "elementor"),
11861 - value: "bottom right"
11862 - },
11863 - {
11864 - label: (0, _wordpress_i18n.__)("Custom", "elementor"),
11865 - value: "custom"
11866 - }
11867 - ];
11868 - var BackgroundImageOverlayPosition = () => {
11869 - const backgroundImageOffsetContext = useBoundProp(_elementor_editor_props.backgroundImagePositionOffsetPropTypeUtil);
11870 - const stringPropContext = useBoundProp(_elementor_editor_props.stringPropTypeUtil);
11871 - const isCustom = !!backgroundImageOffsetContext.value;
11872 - const rowRef = (0, react.useRef)(null);
11873 - const handlePositionChange = (event) => {
11874 - const value = event.target.value || null;
11875 - if (value === "custom") backgroundImageOffsetContext.setValue({
11876 - x: null,
11877 - y: null
11878 - });
11879 - else stringPropContext.setValue(value);
11880 - };
11881 - return /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11882 - container: true,
11883 - spacing: 1.5
11884 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11885 - item: true,
11886 - xs: 12
11887 - }, /* @__PURE__ */ react.createElement(PopoverGridContainer, null, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11888 - item: true,
11889 - xs: 6
11890 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Position", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11891 - item: true,
11892 - xs: 6,
11893 - sx: {
11894 - display: "flex",
11895 - justifyContent: "flex-end",
11896 - overflow: "hidden"
11897 - }
11898 - }, /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.Select, {
11899 - fullWidth: true,
11900 - size: "tiny",
11901 - onChange: handlePositionChange,
11902 - disabled: stringPropContext.disabled,
11903 - value: (backgroundImageOffsetContext.value ? "custom" : stringPropContext.value) ?? ""
11904 - }, backgroundPositionOptions.map(({ label, value }) => /* @__PURE__ */ react.createElement(_elementor_editor_ui.MenuListItem, {
11905 - key: value,
11906 - value: value ?? ""
11907 - }, label))))))), isCustom ? /* @__PURE__ */ react.createElement(PropProvider, { ...backgroundImageOffsetContext }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11908 - item: true,
11909 - xs: 12
11910 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11911 - container: true,
11912 - spacing: 1.5,
11913 - ref: rowRef
11914 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11915 - item: true,
11916 - xs: 6
11917 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "x" }, /* @__PURE__ */ react.createElement(SizeControl, {
11918 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.LetterXIcon, { fontSize: "tiny" }),
11919 - anchorRef: rowRef,
11920 - min: -Number.MAX_SAFE_INTEGER
11921 - }))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11922 - item: true,
11923 - xs: 6
11924 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "y" }, /* @__PURE__ */ react.createElement(SizeControl, {
11925 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.LetterYIcon, { fontSize: "tiny" }),
11926 - anchorRef: rowRef,
11927 - min: -Number.MAX_SAFE_INTEGER
11928 - })))))) : null);
11929 - };
11930 -
11931 -//#endregion
11932 -//#region packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-repeat.tsx
11933 - var repeatControlOptions = [
11934 - {
11935 - value: "repeat",
11936 - label: (0, _wordpress_i18n.__)("Repeat", "elementor"),
11937 - renderContent: ({ size }) => /* @__PURE__ */ react.createElement(_elementor_icons.GridDotsIcon, { fontSize: size }),
11938 - showTooltip: true
11939 - },
11940 - {
11941 - value: "repeat-x",
11942 - label: (0, _wordpress_i18n.__)("Repeat-x", "elementor"),
11943 - renderContent: ({ size }) => /* @__PURE__ */ react.createElement(_elementor_icons.DotsHorizontalIcon, { fontSize: size }),
11944 - showTooltip: true
11945 - },
11946 - {
11947 - value: "repeat-y",
11948 - label: (0, _wordpress_i18n.__)("Repeat-y", "elementor"),
11949 - renderContent: ({ size }) => /* @__PURE__ */ react.createElement(_elementor_icons.DotsVerticalIcon, { fontSize: size }),
11950 - showTooltip: true
11951 - },
11952 - {
11953 - value: "no-repeat",
11954 - label: (0, _wordpress_i18n.__)("No-repeat", "elementor"),
11955 - renderContent: ({ size }) => /* @__PURE__ */ react.createElement(_elementor_icons.XIcon, { fontSize: size }),
11956 - showTooltip: true
11957 - }
11958 - ];
11959 - var BackgroundImageOverlayRepeat = () => {
11960 - return /* @__PURE__ */ react.createElement(PopoverGridContainer, null, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11961 - item: true,
11962 - xs: 6
11963 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Repeat", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
11964 - item: true,
11965 - xs: 6,
11966 - sx: {
11967 - display: "flex",
11968 - justifyContent: "flex-end"
11969 - }
11970 - }, /* @__PURE__ */ react.createElement(ToggleControl, { options: repeatControlOptions })));
11971 - };
11972 -
11973 -//#endregion
11974 -//#region packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx
11975 - var sizeControlOptions = [
11976 - {
11977 - value: "auto",
11978 - label: (0, _wordpress_i18n.__)("Auto", "elementor"),
11979 - renderContent: ({ size }) => /* @__PURE__ */ react.createElement(_elementor_icons.LetterAIcon, { fontSize: size }),
11980 - showTooltip: true
11981 - },
11982 - {
11983 - value: "cover",
11984 - label: (0, _wordpress_i18n.__)("Cover", "elementor"),
11985 - renderContent: ({ size }) => /* @__PURE__ */ react.createElement(_elementor_icons.ArrowsMaximizeIcon, { fontSize: size }),
11986 - showTooltip: true
11987 - },
11988 - {
11989 - value: "contain",
11990 - label: (0, _wordpress_i18n.__)("Contain", "elementor"),
11991 - renderContent: ({ size }) => /* @__PURE__ */ react.createElement(_elementor_icons.ArrowBarBothIcon, { fontSize: size }),
11992 - showTooltip: true
11993 - },
11994 - {
11995 - value: "custom",
11996 - label: (0, _wordpress_i18n.__)("Custom", "elementor"),
11997 - renderContent: ({ size }) => /* @__PURE__ */ react.createElement(_elementor_icons.PencilIcon, { fontSize: size }),
11998 - showTooltip: true
11999 - }
12000 - ];
12001 - var BackgroundImageOverlaySize = () => {
12002 - const backgroundImageScaleContext = useBoundProp(_elementor_editor_props.backgroundImageSizeScalePropTypeUtil);
12003 - const stringPropContext = useBoundProp(_elementor_editor_props.stringPropTypeUtil);
12004 - const isCustom = !!backgroundImageScaleContext.value;
12005 - const rowRef = (0, react.useRef)(null);
12006 - const handleSizeChange = (size) => {
12007 - if (size === "custom") backgroundImageScaleContext.setValue({
12008 - width: null,
12009 - height: null
12010 - });
12011 - else stringPropContext.setValue(size);
12012 - };
12013 - return /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12014 - container: true,
12015 - spacing: 1.5
12016 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12017 - item: true,
12018 - xs: 12
12019 - }, /* @__PURE__ */ react.createElement(PopoverGridContainer, null, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12020 - item: true,
12021 - xs: 6
12022 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Size", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12023 - item: true,
12024 - xs: 6,
12025 - sx: {
12026 - display: "flex",
12027 - justifyContent: "flex-end"
12028 - }
12029 - }, /* @__PURE__ */ react.createElement(ControlToggleButtonGroup, {
12030 - exclusive: true,
12031 - items: sizeControlOptions,
12032 - onChange: handleSizeChange,
12033 - disabled: stringPropContext.disabled,
12034 - value: backgroundImageScaleContext.value ? "custom" : stringPropContext.value
12035 - })))), isCustom ? /* @__PURE__ */ react.createElement(PropProvider, { ...backgroundImageScaleContext }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12036 - item: true,
12037 - xs: 12,
12038 - ref: rowRef
12039 - }, /* @__PURE__ */ react.createElement(PopoverGridContainer, null, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12040 - item: true,
12041 - xs: 6
12042 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "width" }, /* @__PURE__ */ react.createElement(SizeControl, {
12043 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.ArrowsMoveHorizontalIcon, { fontSize: "tiny" }),
12044 - extendedOptions: ["auto"],
12045 - anchorRef: rowRef
12046 - }))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12047 - item: true,
12048 - xs: 6
12049 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "height" }, /* @__PURE__ */ react.createElement(SizeControl, {
12050 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.ArrowsMoveVerticalIcon, { fontSize: "tiny" }),
12051 - extendedOptions: ["auto"],
12052 - anchorRef: rowRef
12053 - })))))) : null);
12054 - };
12055 -
12056 -//#endregion
12057 -//#region packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/use-background-tabs-history.ts
12058 - var useBackgroundTabsHistory = ({ color: initialBackgroundColorOverlay, image: initialBackgroundImageOverlay, gradient: initialBackgroundGradientOverlay }) => {
12059 - const { value: imageValue, setValue: setImageValue } = useBoundProp(_elementor_editor_props.backgroundImageOverlayPropTypeUtil);
12060 - const { value: colorValue, setValue: setColorValue } = useBoundProp(_elementor_editor_props.backgroundColorOverlayPropTypeUtil);
12061 - const { value: gradientValue, setValue: setGradientValue } = useBoundProp(_elementor_editor_props.backgroundGradientOverlayPropTypeUtil);
12062 - const getCurrentOverlayType = () => {
12063 - if (colorValue) return "color";
12064 - if (gradientValue) return "gradient";
12065 - return "image";
12066 - };
12067 - const { getTabsProps, getTabProps, getTabPanelProps } = (0, _elementor_ui.useTabs)(getCurrentOverlayType());
12068 - const valuesHistory = (0, react.useRef)({
12069 - image: initialBackgroundImageOverlay,
12070 - color: initialBackgroundColorOverlay,
12071 - gradient: initialBackgroundGradientOverlay
12072 - });
12073 - const saveToHistory = (key, value) => {
12074 - if (value) valuesHistory.current[key] = value;
12075 - };
12076 - const onTabChange = (e, tabName) => {
12077 - switch (tabName) {
12078 - case "image":
12079 - setImageValue(valuesHistory.current.image);
12080 - saveToHistory("color", colorValue);
12081 - saveToHistory("gradient", gradientValue);
12082 - break;
12083 - case "gradient":
12084 - setGradientValue(valuesHistory.current.gradient);
12085 - saveToHistory("color", colorValue);
12086 - saveToHistory("image", imageValue);
12087 - break;
12088 - case "color":
12089 - setColorValue(valuesHistory.current.color);
12090 - saveToHistory("image", imageValue);
12091 - saveToHistory("gradient", gradientValue);
12092 - }
12093 - return getTabsProps().onChange(e, tabName);
12094 - };
12095 - return {
12096 - getTabProps,
12097 - getTabPanelProps,
12098 - getTabsProps: () => ({
12099 - ...getTabsProps(),
12100 - onChange: onTabChange
12101 - })
12102 - };
12103 - };
12104 -
12105 -//#endregion
12106 -//#region packages/packages/libs/editor-controls/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx
12107 - var DEFAULT_BACKGROUND_COLOR_OVERLAY_COLOR = "#00000033";
12108 - var initialBackgroundColorOverlay = _elementor_editor_props.backgroundColorOverlayPropTypeUtil.create({ color: _elementor_editor_props.colorPropTypeUtil.create(DEFAULT_BACKGROUND_COLOR_OVERLAY_COLOR) });
12109 - var getInitialBackgroundOverlay = () => ({
12110 - $$type: "background-image-overlay",
12111 - value: { image: {
12112 - $$type: "image",
12113 - value: {
12114 - src: {
12115 - $$type: "image-src",
12116 - value: {
12117 - url: {
12118 - $$type: "url",
12119 - value: env.background_placeholder_image
12120 - },
12121 - id: null
12122 - }
12123 - },
12124 - size: {
12125 - $$type: "string",
12126 - value: "large"
12127 - }
12128 - }
12129 - } }
12130 - });
12131 - var backgroundResolutionOptions = [
12132 - {
12133 - label: (0, _wordpress_i18n.__)("Thumbnail - 150 x 150", "elementor"),
12134 - value: "thumbnail"
12135 - },
12136 - {
12137 - label: (0, _wordpress_i18n.__)("Medium - 300 x 300", "elementor"),
12138 - value: "medium"
12139 - },
12140 - {
12141 - label: (0, _wordpress_i18n.__)("Large 1024 x 1024", "elementor"),
12142 - value: "large"
12143 - },
12144 - {
12145 - label: (0, _wordpress_i18n.__)("Full", "elementor"),
12146 - value: "full"
12147 - }
12148 - ];
12149 - var BackgroundOverlayRepeaterControl = createControl(() => {
12150 - const { propType, value: overlayValues, setValue } = useBoundProp(_elementor_editor_props.backgroundOverlayPropTypeUtil);
12151 - return /* @__PURE__ */ react.createElement(PropProvider, {
12152 - propType,
12153 - value: overlayValues,
12154 - setValue
12155 - }, /* @__PURE__ */ react.createElement(ControlRepeater, {
12156 - initial: getInitialBackgroundOverlay(),
12157 - propTypeUtil: _elementor_editor_props.backgroundOverlayPropTypeUtil
12158 - }, /* @__PURE__ */ react.createElement(RepeaterHeader, { label: (0, _wordpress_i18n.__)("Overlay", "elementor") }, /* @__PURE__ */ react.createElement(TooltipAddItemAction, { newItemIndex: 0 })), /* @__PURE__ */ react.createElement(ItemsContainer, null, /* @__PURE__ */ react.createElement(Item, {
12159 - Icon: ItemIcon$1,
12160 - Label: ItemLabel$1,
12161 - actions: /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(DuplicateItemAction, null), /* @__PURE__ */ react.createElement(DisableItemAction, null), /* @__PURE__ */ react.createElement(RemoveItemAction, null))
12162 - })), /* @__PURE__ */ react.createElement(EditItemPopover, null, /* @__PURE__ */ react.createElement(ItemContent, null))));
12163 - });
12164 - var ItemContent = () => {
12165 - const { getTabsProps, getTabProps, getTabPanelProps } = useBackgroundTabsHistory({
12166 - image: getInitialBackgroundOverlay().value,
12167 - color: initialBackgroundColorOverlay.value,
12168 - gradient: initialBackgroundGradientOverlay.value
12169 - });
12170 - const { rowRef } = useRepeaterContext();
12171 - return /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: { width: "100%" } }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: {
12172 - borderBottom: 1,
12173 - borderColor: "divider"
12174 - } }, /* @__PURE__ */ react.createElement(_elementor_ui.Tabs, {
12175 - size: "small",
12176 - variant: "fullWidth",
12177 - ...getTabsProps(),
12178 - "aria-label": (0, _wordpress_i18n.__)("Background Overlay", "elementor")
12179 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Tab, {
12180 - label: (0, _wordpress_i18n.__)("Image", "elementor"),
12181 - ...getTabProps("image")
12182 - }), /* @__PURE__ */ react.createElement(_elementor_ui.Tab, {
12183 - label: (0, _wordpress_i18n.__)("Gradient", "elementor"),
12184 - ...getTabProps("gradient")
12185 - }), /* @__PURE__ */ react.createElement(_elementor_ui.Tab, {
12186 - label: (0, _wordpress_i18n.__)("Color", "elementor"),
12187 - ...getTabProps("color")
12188 - }))), /* @__PURE__ */ react.createElement(_elementor_ui.TabPanel, {
12189 - sx: { p: 1.5 },
12190 - ...getTabPanelProps("image")
12191 - }, /* @__PURE__ */ react.createElement(PopoverContent, null, /* @__PURE__ */ react.createElement(ImageOverlayContent, null))), /* @__PURE__ */ react.createElement(_elementor_ui.TabPanel, {
12192 - sx: { p: 1.5 },
12193 - ...getTabPanelProps("gradient")
12194 - }, /* @__PURE__ */ react.createElement(BackgroundGradientColorControl, null)), /* @__PURE__ */ react.createElement(_elementor_ui.TabPanel, {
12195 - sx: { p: 1.5 },
12196 - ...getTabPanelProps("color")
12197 - }, /* @__PURE__ */ react.createElement(PopoverContent, null, /* @__PURE__ */ react.createElement(ColorOverlayContent, { anchorEl: rowRef }))));
12198 - };
12199 - var ItemIcon$1 = /* @__PURE__ */ __name(({ value }) => {
12200 - switch (value.$$type) {
12201 - case "background-image-overlay": return /* @__PURE__ */ react.createElement(ItemIconImage, { value });
12202 - case "background-color-overlay": return /* @__PURE__ */ react.createElement(ItemIconColor, { value });
12203 - case "background-gradient-overlay": return /* @__PURE__ */ react.createElement(ItemIconGradient, { value });
12204 - default: return null;
12205 - }
12206 - }, "ItemIcon");
12207 - var extractColorFrom = (prop) => {
12208 - if (prop?.value?.color?.value) return prop.value.color.value;
12209 - return "";
12210 - };
12211 - var ItemIconColor = ({ value: prop }) => {
12212 - const color = extractColorFrom(prop);
12213 - return /* @__PURE__ */ react.createElement(StyledUnstableColorIndicator, {
12214 - size: "inherit",
12215 - component: "span",
12216 - value: color
12217 - });
12218 - };
12219 - var ItemIconImage = ({ value }) => {
12220 - const { imageUrl } = useImage(value);
12221 - return /* @__PURE__ */ react.createElement(_elementor_ui.CardMedia, {
12222 - image: imageUrl,
12223 - sx: (theme) => ({
12224 - height: "1rem",
12225 - width: "1rem",
12226 - borderRadius: `${theme.shape.borderRadius / 2}px`,
12227 - outline: `1px solid ${theme.palette.action.disabled}`
12228 - })
12229 - });
12230 - };
12231 - var ItemIconGradient = ({ value }) => {
12232 - const gradient = getGradientValue(value);
12233 - return /* @__PURE__ */ react.createElement(StyledUnstableColorIndicator, {
12234 - size: "inherit",
12235 - component: "span",
12236 - value: gradient
12237 - });
12238 - };
12239 - var ItemLabel$1 = /* @__PURE__ */ __name(({ value }) => {
12240 - switch (value.$$type) {
12241 - case "background-image-overlay": return /* @__PURE__ */ react.createElement(ItemLabelImage, { value });
12242 - case "background-color-overlay": return /* @__PURE__ */ react.createElement(ItemLabelColor, { value });
12243 - case "background-gradient-overlay": return /* @__PURE__ */ react.createElement(ItemLabelGradient, { value });
12244 - default: return null;
12245 - }
12246 - }, "ItemLabel");
12247 - var ItemLabelColor = ({ value: prop }) => {
12248 - const color = extractColorFrom(prop);
12249 - return /* @__PURE__ */ react.createElement("span", null, color);
12250 - };
12251 - var ItemLabelImage = ({ value }) => {
12252 - const { imageTitle } = useImage(value);
12253 - return /* @__PURE__ */ react.createElement("span", null, imageTitle);
12254 - };
12255 - var ItemLabelGradient = ({ value }) => {
12256 - if (value.value.type.value === "linear") return /* @__PURE__ */ react.createElement("span", null, (0, _wordpress_i18n.__)("Linear Gradient", "elementor"));
12257 - return /* @__PURE__ */ react.createElement("span", null, (0, _wordpress_i18n.__)("Radial Gradient", "elementor"));
12258 - };
12259 - var ColorOverlayContent = ({ anchorEl }) => {
12260 - const propContext = useBoundProp(_elementor_editor_props.backgroundColorOverlayPropTypeUtil);
12261 - return /* @__PURE__ */ react.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "color" }, /* @__PURE__ */ react.createElement(ColorControl, { anchorEl })));
12262 - };
12263 - var ImageOverlayContent = () => {
12264 - const propContext = useBoundProp(_elementor_editor_props.backgroundImageOverlayPropTypeUtil);
12265 - return /* @__PURE__ */ react.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "image" }, /* @__PURE__ */ react.createElement(ImageControl, { sizes: backgroundResolutionOptions })), /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "position" }, /* @__PURE__ */ react.createElement(BackgroundImageOverlayPosition, null)), /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "repeat" }, /* @__PURE__ */ react.createElement(BackgroundImageOverlayRepeat, null)), /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ react.createElement(BackgroundImageOverlaySize, null)), /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "attachment" }, /* @__PURE__ */ react.createElement(BackgroundImageOverlayAttachment, null)));
12266 - };
12267 - var StyledUnstableColorIndicator = (0, _elementor_ui.styled)(_elementor_ui.UnstableColorIndicator)(({ theme }) => ({
12268 - height: "1rem",
12269 - width: "1rem",
12270 - borderRadius: `${theme.shape.borderRadius / 2}px`
12271 - }));
12272 - var useImage = (image) => {
12273 - let imageTitle;
12274 - let imageUrl = null;
12275 - const imageSrc = image?.value.image.value?.src.value;
12276 - const { data: attachment } = (0, _elementor_wp_media.useWpMediaAttachment)(imageSrc.id?.value || null);
12277 - if (imageSrc.id) {
12278 - const imageFileTypeExtension = getFileExtensionFromFilename(attachment?.filename);
12279 - imageTitle = `${attachment?.title}${imageFileTypeExtension}` || null;
12280 - imageUrl = attachment?.url || null;
12281 - } else if (imageSrc.url) {
12282 - imageUrl = imageSrc.url.value;
12283 - imageTitle = imageUrl?.substring(imageUrl.lastIndexOf("/") + 1) || null;
12284 - }
12285 - return {
12286 - imageTitle,
12287 - imageUrl
12288 - };
12289 - };
12290 - var getFileExtensionFromFilename = (filename) => {
12291 - if (!filename) return "";
12292 - return `.${filename.substring(filename.lastIndexOf(".") + 1)}`;
12293 - };
12294 - var getGradientValue = (value) => {
12295 - const gradient = value.value;
12296 - const stops = gradient.stops.value?.map(({ value: { color, offset } }) => offset ? `${color.value} ${offset.value ?? 0}%` : `${color.value}`)?.join(",");
12297 - if (gradient.type.value === "linear") return `linear-gradient(${gradient.angle.value}deg, ${stops})`;
12298 - return `radial-gradient(circle at ${gradient.positions.value}, ${stops})`;
12299 - };
12300 -
12301 -//#endregion
12302 -//#region packages/packages/libs/editor-controls/src/controls/background-control/background-control.tsx
12303 - var clipOptions = [
12304 - {
12305 - label: (0, _wordpress_i18n.__)("Full element", "elementor"),
12306 - value: "border-box"
12307 - },
12308 - {
12309 - label: (0, _wordpress_i18n.__)("Padding edges", "elementor"),
12310 - value: "padding-box"
12311 - },
12312 - {
12313 - label: (0, _wordpress_i18n.__)("Content edges", "elementor"),
12314 - value: "content-box"
12315 - },
12316 - {
12317 - label: (0, _wordpress_i18n.__)("Text", "elementor"),
12318 - value: "text"
12319 - }
12320 - ];
12321 - var colorLabel = (0, _wordpress_i18n.__)("Color", "elementor");
12322 - var clipLabel = (0, _wordpress_i18n.__)("Clipping", "elementor");
12323 - var BackgroundControl = createControl(() => {
12324 - const propContext = useBoundProp(_elementor_editor_props.backgroundPropTypeUtil);
12325 - return /* @__PURE__ */ react.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "background-overlay" }, /* @__PURE__ */ react.createElement(BackgroundOverlayRepeaterControl, null)), /* @__PURE__ */ react.createElement(BackgroundColorField, null), /* @__PURE__ */ react.createElement(BackgroundClipField, null));
12326 - });
12327 - var BackgroundColorField = () => {
12328 - return /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "color" }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12329 - container: true,
12330 - gap: 2,
12331 - alignItems: "center",
12332 - flexWrap: "nowrap"
12333 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12334 - item: true,
12335 - xs: 6
12336 - }, /* @__PURE__ */ react.createElement(ControlLabel, null, colorLabel)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12337 - item: true,
12338 - xs: 6
12339 - }, /* @__PURE__ */ react.createElement(ColorControl, null))));
12340 - };
12341 - var BackgroundClipField = () => {
12342 - return /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "clip" }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12343 - container: true,
12344 - gap: 2,
12345 - alignItems: "center",
12346 - flexWrap: "nowrap"
12347 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12348 - item: true,
12349 - xs: 6
12350 - }, /* @__PURE__ */ react.createElement(ControlLabel, null, clipLabel)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12351 - item: true,
12352 - xs: 6
12353 - }, /* @__PURE__ */ react.createElement(SelectControl, { options: clipOptions }))));
12354 - };
12355 -
12356 -//#endregion
12357 -//#region packages/packages/libs/editor-controls/src/controls/repeatable-control.tsx
12358 - var PLACEHOLDER_REGEX = /\$\{([^}]+)\}/g;
12359 - var RepeatableControl = createControl(({ repeaterLabel, childControlConfig, showDuplicate, showToggle, initialValues, patternLabel, placeholder, propKey, isSortable, addItemTooltipProps }) => {
12360 - const { propTypeUtil: childPropTypeUtil, isItemDisabled } = childControlConfig;
12361 - if (!childPropTypeUtil) return null;
12362 - const childArrayPropTypeUtil = (0, react.useMemo)(() => (0, _elementor_editor_props.createArrayPropUtils)(childPropTypeUtil.key, childPropTypeUtil.schema, propKey), [
12363 - childPropTypeUtil.key,
12364 - childPropTypeUtil.schema,
12365 - propKey
12366 - ]);
12367 - const contextValue = (0, react.useMemo)(() => ({
12368 - ...childControlConfig,
12369 - placeholder: placeholder || "",
12370 - patternLabel: patternLabel || ""
12371 - }), [
12372 - childControlConfig,
12373 - placeholder,
12374 - patternLabel
12375 - ]);
12376 - const { propType, value, setValue } = useBoundProp(childArrayPropTypeUtil);
12377 - const newItemIndex = addItemTooltipProps?.newItemIndex === null ? void 0 : 0;
12378 - return /* @__PURE__ */ react.createElement(PropProvider, {
12379 - propType,
12380 - value,
12381 - setValue
12382 - }, /* @__PURE__ */ react.createElement(RepeatableControlContext.Provider, { value: contextValue }, /* @__PURE__ */ react.createElement(ControlRepeater, {
12383 - initial: childPropTypeUtil.create(initialValues || null),
12384 - propTypeUtil: childArrayPropTypeUtil,
12385 - isItemDisabled
12386 - }, /* @__PURE__ */ react.createElement(RepeaterHeader, { label: repeaterLabel }, /* @__PURE__ */ react.createElement(TooltipAddItemAction, {
12387 - ...addItemTooltipProps,
12388 - newItemIndex,
12389 - ariaLabel: repeaterLabel
12390 - })), /* @__PURE__ */ react.createElement(ItemsContainer, { isSortable }, /* @__PURE__ */ react.createElement(Item, {
12391 - Icon: ItemIcon,
12392 - Label: ItemLabel,
12393 - actions: /* @__PURE__ */ react.createElement(react.Fragment, null, showDuplicate && /* @__PURE__ */ react.createElement(DuplicateItemAction, null), showToggle && /* @__PURE__ */ react.createElement(DisableItemAction, null), /* @__PURE__ */ react.createElement(RemoveItemAction, null))
12394 - })), /* @__PURE__ */ react.createElement(EditItemPopover, null, /* @__PURE__ */ react.createElement(Content, null)))));
12395 - });
12396 - var ItemIcon = () => /* @__PURE__ */ react.createElement(react.Fragment, null);
12397 - var Content = () => {
12398 - const { component: ChildControl, props = {} } = useRepeatableControlContext();
12399 - return /* @__PURE__ */ react.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ react.createElement(PopoverGridContainer, null, /* @__PURE__ */ react.createElement(ChildControl, { ...props })));
12400 - };
12401 - var interpolate = (template, data) => {
12402 - if (!data) return template;
12403 - return template.replace(PLACEHOLDER_REGEX, (_, path) => {
12404 - const value = getNestedValue(data, path);
12405 - if (typeof value === "object" && value !== null && !Array.isArray(value)) {
12406 - if ("name" in value && value.name) return value.name;
12407 - return JSON.stringify(value);
12408 - }
12409 - if (Array.isArray(value)) return value.join(", ");
12410 - return String(value ?? "");
12411 - });
12412 - };
12413 - var getNestedValue = (obj, path) => {
12414 - let parentObj = {};
12415 - const pathKeys = path.split(".");
12416 - const key = pathKeys.slice(-1)[0];
12417 - let value = pathKeys.reduce((current, currentKey, currentIndex) => {
12418 - if (currentIndex === pathKeys.length - 2) parentObj = current;
12419 - if (current && typeof current === "object") return current[currentKey];
12420 - return {};
12421 - }, obj);
12422 - value = !!value ? value : "";
12423 - const propType = parentObj?.$$type;
12424 - const propValue = parentObj?.value;
12425 - if (!(key === "unit" && propType === "size" && propValue?.unit === "custom")) return value;
12426 - return propValue?.size ? "" : "fx";
12427 - };
12428 - var isEmptyValue = (val) => {
12429 - if (typeof val === "string") return val.trim() === "";
12430 - if (Number.isNaN(val)) return true;
12431 - if (Array.isArray(val)) return val.length === 0;
12432 - if (typeof val === "object" && val !== null) return Object.keys(val).length === 0;
12433 - return false;
12434 - };
12435 - var shouldShowPlaceholder = (pattern, data) => {
12436 - const values = getAllProperties(pattern).map((path) => getNestedValue(data, path));
12437 - if (values.length === 0) return false;
12438 - if (values.some((value) => value === null || value === void 0)) return true;
12439 - if (values.every(isEmptyValue)) return true;
12440 - return false;
12441 - };
12442 - var getTextColor = (isReadOnly, showPlaceholder) => {
12443 - if (isReadOnly) return "text.disabled";
12444 - return showPlaceholder ? "text.tertiary" : "text.primary";
12445 - };
12446 - var ItemLabel = ({ value }) => {
12447 - const { placeholder, patternLabel, props: childProps } = useRepeatableControlContext();
12448 - const showPlaceholder = shouldShowPlaceholder(patternLabel, value);
12449 - const label = showPlaceholder ? placeholder : interpolate(patternLabel, value);
12450 - const isReadOnly = !!childProps?.readOnly;
12451 - const color = getTextColor(isReadOnly, showPlaceholder);
12452 - return /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
12453 - component: "span",
12454 - color
12455 - }, label);
12456 - };
12457 - var getAllProperties = (pattern) => {
12458 - return pattern.match(PLACEHOLDER_REGEX)?.map((match) => match.slice(2, -1)) || [];
12459 - };
12460 -
12461 -//#endregion
12462 -//#region packages/packages/libs/editor-controls/src/utils/escape-html-attr.ts
12463 - var escapeHtmlAttr = (value) => {
12464 - const specialChars = {
12465 - "&": "&amp;",
12466 - "<": "&lt;",
12467 - ">": "&gt;",
12468 - "'": "&#39;",
12469 - "\"": "&quot;"
12470 - };
12471 - return value.replace(/[&<>'"]/g, (char) => specialChars[char] || char);
12472 - };
12473 -
12474 -//#endregion
12475 -//#region packages/packages/libs/editor-controls/src/controls/key-value-control.tsx
12476 - var getInitialFieldValue = (fieldValue) => {
12477 - const transformableValue = fieldValue;
12478 - if (!fieldValue || typeof fieldValue !== "object" || transformableValue.$$type === "dynamic") return "";
12479 - return transformableValue.value || "";
12480 - };
12481 - var KeyValueControl = createControl((props = {}) => {
12482 - const { value, setValue, ...propContext } = useBoundProp(_elementor_editor_props.keyValuePropTypeUtil);
12483 - const [keyError, setKeyError] = (0, react.useState)("");
12484 - const [valueError, setValueError] = (0, react.useState)("");
12485 - const [sessionState, setSessionState] = (0, react.useState)({
12486 - key: getInitialFieldValue(value?.key),
12487 - value: getInitialFieldValue(value?.value)
12488 - });
12489 - const keyLabel = props.keyName || (0, _wordpress_i18n.__)("Key", "elementor");
12490 - const valueLabel = props.valueName || (0, _wordpress_i18n.__)("Value", "elementor");
12491 - const { keyHelper, valueHelper } = props.getHelperText?.(sessionState.key, sessionState.value) || {
12492 - keyHelper: void 0,
12493 - valueHelper: void 0
12494 - };
12495 - const [keyRegex, valueRegex, errMsg] = (0, react.useMemo)(() => [
12496 - props.regexKey ? new RegExp(props.regexKey) : void 0,
12497 - props.regexValue ? new RegExp(props.regexValue) : void 0,
12498 - props.validationErrorMessage || (0, _wordpress_i18n.__)("Invalid Format", "elementor")
12499 - ], [
12500 - props.regexKey,
12501 - props.regexValue,
12502 - props.validationErrorMessage
12503 - ]);
12504 - const validate = (newValue, fieldType) => {
12505 - if (fieldType === "key" && keyRegex) {
12506 - const isValid = keyRegex.test(newValue);
12507 - setKeyError(isValid ? "" : errMsg);
12508 - return isValid;
12509 - } else if (fieldType === "value" && valueRegex) {
12510 - const isValid = valueRegex.test(newValue);
12511 - setValueError(isValid ? "" : errMsg);
12512 - return isValid;
12513 - }
12514 - return true;
12515 - };
12516 - const handleChange = (newValue, options, meta) => {
12517 - const fieldType = meta?.bind;
12518 - if (!fieldType) return;
12519 - const newChangedValue = newValue[fieldType];
12520 - if ((0, _elementor_editor_props.isTransformable)(newChangedValue) && newChangedValue.$$type === "dynamic") {
12521 - setValue({
12522 - ...value,
12523 - [fieldType]: newChangedValue
12524 - });
12525 - return;
12526 - }
12527 - const extractedValue = _elementor_editor_props.stringPropTypeUtil.extract(newChangedValue);
12528 - setSessionState((prev) => ({
12529 - ...prev,
12530 - [fieldType]: extractedValue
12531 - }));
12532 - if (extractedValue && validate(extractedValue, fieldType)) setValue({
12533 - ...value,
12534 - [fieldType]: newChangedValue
12535 - });
12536 - else setValue({
12537 - ...value,
12538 - [fieldType]: {
12539 - value: "",
12540 - $$type: "string"
12541 - }
12542 - });
12543 - };
12544 - return /* @__PURE__ */ react.createElement(PropProvider, {
12545 - ...propContext,
12546 - value,
12547 - setValue: handleChange
12548 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12549 - container: true,
12550 - gap: 1.5
12551 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12552 - item: true,
12553 - xs: 12,
12554 - display: "flex",
12555 - flexDirection: "column"
12556 - }, /* @__PURE__ */ react.createElement(_elementor_ui.FormLabel, {
12557 - size: "tiny",
12558 - sx: { pb: 1 }
12559 - }, keyLabel), /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "key" }, /* @__PURE__ */ react.createElement(TextControl, {
12560 - inputValue: props.escapeHtml ? escapeHtmlAttr(sessionState.key) : sessionState.key,
12561 - error: !!keyError,
12562 - helperText: keyHelper
12563 - })), !!keyError && /* @__PURE__ */ react.createElement(_elementor_ui.FormHelperText, { error: true }, keyError)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12564 - item: true,
12565 - xs: 12,
12566 - display: "flex",
12567 - flexDirection: "column"
12568 - }, /* @__PURE__ */ react.createElement(_elementor_ui.FormLabel, {
12569 - size: "tiny",
12570 - sx: { pb: 1 }
12571 - }, valueLabel), /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "value" }, /* @__PURE__ */ react.createElement(TextControl, {
12572 - inputValue: props.escapeHtml ? escapeHtmlAttr(sessionState.value) : sessionState.value,
12573 - error: !!valueError,
12574 - inputDisabled: !!keyError,
12575 - helperText: valueHelper
12576 - })), !!valueError && /* @__PURE__ */ react.createElement(_elementor_ui.FormHelperText, { error: true }, valueError))));
12577 - });
12578 -
12579 -//#endregion
12580 -//#region packages/packages/libs/editor-controls/src/controls/position-control.tsx
12581 - var positionOptions = [
12582 - {
12583 - label: (0, _wordpress_i18n.__)("Center center", "elementor"),
12584 - value: "center center"
12585 - },
12586 - {
12587 - label: (0, _wordpress_i18n.__)("Center left", "elementor"),
12588 - value: "center left"
12589 - },
12590 - {
12591 - label: (0, _wordpress_i18n.__)("Center right", "elementor"),
12592 - value: "center right"
12593 - },
12594 - {
12595 - label: (0, _wordpress_i18n.__)("Top center", "elementor"),
12596 - value: "top center"
12597 - },
12598 - {
12599 - label: (0, _wordpress_i18n.__)("Top left", "elementor"),
12600 - value: "top left"
12601 - },
12602 - {
12603 - label: (0, _wordpress_i18n.__)("Top right", "elementor"),
12604 - value: "top right"
12605 - },
12606 - {
12607 - label: (0, _wordpress_i18n.__)("Bottom center", "elementor"),
12608 - value: "bottom center"
12609 - },
12610 - {
12611 - label: (0, _wordpress_i18n.__)("Bottom left", "elementor"),
12612 - value: "bottom left"
12613 - },
12614 - {
12615 - label: (0, _wordpress_i18n.__)("Bottom right", "elementor"),
12616 - value: "bottom right"
12617 - },
12618 - {
12619 - label: (0, _wordpress_i18n.__)("Custom", "elementor"),
12620 - value: "custom"
12621 - }
12622 - ];
12623 - var PositionControl = () => {
12624 - const positionContext = useBoundProp(_elementor_editor_props.positionPropTypeUtil);
12625 - const stringPropContext = useBoundProp(_elementor_editor_props.stringPropTypeUtil);
12626 - const isCustom = !!positionContext.value;
12627 - const placeholder = positionContext.placeholder ? "custom" : stringPropContext.placeholder ?? null;
12628 - const handlePositionChange = (event) => {
12629 - const value = event.target.value || null;
12630 - if (value === "custom") positionContext.setValue({
12631 - x: null,
12632 - y: null
12633 - });
12634 - else stringPropContext.setValue(value);
12635 - };
12636 - return /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12637 - container: true,
12638 - spacing: 1.5
12639 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12640 - item: true,
12641 - xs: 12
12642 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12643 - container: true,
12644 - gap: 2,
12645 - alignItems: "center",
12646 - flexWrap: "nowrap"
12647 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12648 - item: true,
12649 - xs: 6
12650 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Object position", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12651 - item: true,
12652 - xs: 6,
12653 - sx: { overflow: "hidden" }
12654 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Select, {
12655 - size: "tiny",
12656 - displayEmpty: true,
12657 - disabled: stringPropContext.disabled,
12658 - value: (positionContext.value ? "custom" : stringPropContext.value) ?? "",
12659 - onChange: handlePositionChange,
12660 - renderValue: (selectedValue) => getSelectRenderValue(positionOptions, placeholder, selectedValue),
12661 - fullWidth: true
12662 - }, positionOptions.map(({ label, value }) => /* @__PURE__ */ react.createElement(_elementor_editor_ui.MenuListItem, {
12663 - key: value,
12664 - value: value ?? ""
12665 - }, label)))))), isCustom && /* @__PURE__ */ react.createElement(PropProvider, { ...positionContext }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12666 - item: true,
12667 - xs: 12
12668 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12669 - container: true,
12670 - spacing: 1.5
12671 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12672 - item: true,
12673 - xs: 6
12674 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "x" }, /* @__PURE__ */ react.createElement(SizeControl, {
12675 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.LetterXIcon, { fontSize: "tiny" }),
12676 - min: -Number.MAX_SAFE_INTEGER
12677 - }))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12678 - item: true,
12679 - xs: 6
12680 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "y" }, /* @__PURE__ */ react.createElement(SizeControl, {
12681 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.LetterYIcon, { fontSize: "tiny" }),
12682 - min: -Number.MAX_SAFE_INTEGER
12683 - })))))));
12684 - };
12685 -
12686 -//#endregion
12687 -//#region packages/packages/libs/editor-controls/src/controls/transform-control/initial-values.ts
12688 - var TransformFunctionKeys = {
12689 - move: "transform-move",
12690 - scale: "transform-scale",
12691 - rotate: "transform-rotate",
12692 - skew: "transform-skew"
12693 - };
12694 - var defaultValues = {
12695 - move: {
12696 - size: 0,
12697 - unit: "px"
12698 - },
12699 - scale: 1,
12700 - rotate: {
12701 - size: 0,
12702 - unit: "deg"
12703 - },
12704 - skew: {
12705 - size: 0,
12706 - unit: "deg"
12707 - }
12708 - };
12709 - var initialTransformValue = {
12710 - $$type: TransformFunctionKeys.move,
12711 - value: {
12712 - x: {
12713 - $$type: "size",
12714 - value: {
12715 - size: defaultValues.move.size,
12716 - unit: defaultValues.move.unit
12717 - }
12718 - },
12719 - y: {
12720 - $$type: "size",
12721 - value: {
12722 - size: defaultValues.move.size,
12723 - unit: defaultValues.move.unit
12724 - }
12725 - },
12726 - z: {
12727 - $$type: "size",
12728 - value: {
12729 - size: defaultValues.move.size,
12730 - unit: defaultValues.move.unit
12731 - }
12732 - }
12733 - }
12734 - };
12735 - var initialScaleValue = _elementor_editor_props.scaleTransformPropTypeUtil.create({
12736 - x: _elementor_editor_props.numberPropTypeUtil.create(defaultValues.scale),
12737 - y: _elementor_editor_props.numberPropTypeUtil.create(defaultValues.scale),
12738 - z: _elementor_editor_props.numberPropTypeUtil.create(defaultValues.scale)
12739 - });
12740 - var initialRotateValue = _elementor_editor_props.rotateTransformPropTypeUtil.create({
12741 - x: {
12742 - $$type: "size",
12743 - value: {
12744 - size: defaultValues.rotate.size,
12745 - unit: defaultValues.rotate.unit
12746 - }
12747 - },
12748 - y: {
12749 - $$type: "size",
12750 - value: {
12751 - size: defaultValues.rotate.size,
12752 - unit: defaultValues.rotate.unit
12753 - }
12754 - },
12755 - z: {
12756 - $$type: "size",
12757 - value: {
12758 - size: defaultValues.rotate.size,
12759 - unit: defaultValues.rotate.unit
12760 - }
12761 - }
12762 - });
12763 - var initialSkewValue = _elementor_editor_props.skewTransformPropTypeUtil.create({
12764 - x: {
12765 - $$type: "size",
12766 - value: {
12767 - size: defaultValues.skew.size,
12768 - unit: defaultValues.skew.unit
12769 - }
12770 - },
12771 - y: {
12772 - $$type: "size",
12773 - value: {
12774 - size: defaultValues.skew.size,
12775 - unit: defaultValues.skew.unit
12776 - }
12777 - }
12778 - });
12779 -
12780 -//#endregion
12781 -//#region packages/packages/libs/editor-controls/src/controls/transform-control/functions/axis-row.tsx
12782 - var AxisRow = ({ label, bind, startIcon, anchorRef, units, variant = "angle" }) => {
12783 - const safeId = label.replace(/\s+/g, "-").toLowerCase();
12784 - return /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12785 - item: true,
12786 - xs: 12
12787 - }, /* @__PURE__ */ react.createElement(PopoverGridContainer, { ref: anchorRef }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12788 - item: true,
12789 - xs: 6
12790 - }, /* @__PURE__ */ react.createElement(ControlLabel, { htmlFor: safeId }, label)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12791 - item: true,
12792 - xs: 6
12793 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ react.createElement(SizeControl, {
12794 - anchorRef,
12795 - startIcon,
12796 - units,
12797 - variant,
12798 - min: -Number.MAX_SAFE_INTEGER,
12799 - id: safeId
12800 - })))));
12801 - };
12802 -
12803 -//#endregion
12804 -//#region packages/packages/libs/editor-controls/src/controls/transform-control/functions/move.tsx
12805 - var moveAxisControls = [
12806 - {
12807 - label: (0, _wordpress_i18n.__)("Move X", "elementor"),
12808 - bind: "x",
12809 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.ArrowRightIcon, { fontSize: "tiny" }),
12810 - units: [
12811 - "px",
12812 - "%",
12813 - "em",
12814 - "rem",
12815 - "vw"
12816 - ]
12817 - },
12818 - {
12819 - label: (0, _wordpress_i18n.__)("Move Y", "elementor"),
12820 - bind: "y",
12821 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.ArrowDownSmallIcon, { fontSize: "tiny" }),
12822 - units: [
12823 - "px",
12824 - "%",
12825 - "em",
12826 - "rem",
12827 - "vh"
12828 - ]
12829 - },
12830 - {
12831 - label: (0, _wordpress_i18n.__)("Move Z", "elementor"),
12832 - bind: "z",
12833 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.ArrowDownLeftIcon, { fontSize: "tiny" }),
12834 - units: [
12835 - "px",
12836 - "%",
12837 - "em",
12838 - "rem",
12839 - "vw",
12840 - "vh"
12841 - ]
12842 - }
12843 - ];
12844 - var Move = () => {
12845 - const context = useBoundProp(_elementor_editor_props.moveTransformPropTypeUtil);
12846 - const rowRefs = [
12847 - (0, react.useRef)(null),
12848 - (0, react.useRef)(null),
12849 - (0, react.useRef)(null)
12850 - ];
12851 - return /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12852 - container: true,
12853 - spacing: 1.5
12854 - }, /* @__PURE__ */ react.createElement(PropProvider, { ...context }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: TransformFunctionKeys.move }, moveAxisControls.map((control, index) => /* @__PURE__ */ react.createElement(AxisRow, {
12855 - key: control.bind,
12856 - ...control,
12857 - anchorRef: rowRefs[index],
12858 - units: control.units,
12859 - variant: "length"
12860 - })))));
12861 - };
12862 -
12863 -//#endregion
12864 -//#region packages/packages/libs/editor-controls/src/controls/transform-control/functions/rotate.tsx
12865 - var rotateAxisControls = [
12866 - {
12867 - label: (0, _wordpress_i18n.__)("Rotate X", "elementor"),
12868 - bind: "x",
12869 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.Arrow360Icon, { fontSize: "tiny" })
12870 - },
12871 - {
12872 - label: (0, _wordpress_i18n.__)("Rotate Y", "elementor"),
12873 - bind: "y",
12874 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.Arrow360Icon, {
12875 - fontSize: "tiny",
12876 - style: { transform: "scaleX(-1) rotate(-90deg)" }
12877 - })
12878 - },
12879 - {
12880 - label: (0, _wordpress_i18n.__)("Rotate Z", "elementor"),
12881 - bind: "z",
12882 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.RotateClockwiseIcon, { fontSize: "tiny" })
12883 - }
12884 - ];
12885 - var rotateUnits = [
12886 - "deg",
12887 - "rad",
12888 - "grad",
12889 - "turn"
12890 - ];
12891 - var Rotate = () => {
12892 - const context = useBoundProp(_elementor_editor_props.rotateTransformPropTypeUtil);
12893 - const rowRefs = [
12894 - (0, react.useRef)(null),
12895 - (0, react.useRef)(null),
12896 - (0, react.useRef)(null)
12897 - ];
12898 - return /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12899 - container: true,
12900 - spacing: 1.5
12901 - }, /* @__PURE__ */ react.createElement(PropProvider, { ...context }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: TransformFunctionKeys.rotate }, rotateAxisControls.map((control, index) => /* @__PURE__ */ react.createElement(AxisRow, {
12902 - key: control.bind,
12903 - ...control,
12904 - anchorRef: rowRefs[index],
12905 - units: rotateUnits
12906 - })))));
12907 - };
12908 -
12909 -//#endregion
12910 -//#region packages/packages/libs/editor-controls/src/controls/transform-control/functions/scale-axis-row.tsx
12911 - var ScaleAxisRow = ({ label, bind, startIcon, anchorRef }) => {
12912 - return /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12913 - item: true,
12914 - xs: 12
12915 - }, /* @__PURE__ */ react.createElement(PopoverGridContainer, { ref: anchorRef }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12916 - item: true,
12917 - xs: 6
12918 - }, /* @__PURE__ */ react.createElement(ControlLabel, null, label)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12919 - item: true,
12920 - xs: 6
12921 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ react.createElement(NumberControl, {
12922 - step: .1,
12923 - placeholder: "1",
12924 - startIcon
12925 - })))));
12926 - };
12927 -
12928 -//#endregion
12929 -//#region packages/packages/libs/editor-controls/src/controls/transform-control/functions/scale.tsx
12930 - var scaleAxisControls = [
12931 - {
12932 - label: (0, _wordpress_i18n.__)("Scale X", "elementor"),
12933 - bind: "x",
12934 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.ArrowRightIcon, { fontSize: "tiny" })
12935 - },
12936 - {
12937 - label: (0, _wordpress_i18n.__)("Scale Y", "elementor"),
12938 - bind: "y",
12939 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.ArrowDownSmallIcon, { fontSize: "tiny" })
12940 - },
12941 - {
12942 - label: (0, _wordpress_i18n.__)("Scale Z", "elementor"),
12943 - bind: "z",
12944 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.ArrowDownLeftIcon, { fontSize: "tiny" })
12945 - }
12946 - ];
12947 - var Scale = () => {
12948 - const context = useBoundProp(_elementor_editor_props.scaleTransformPropTypeUtil);
12949 - const rowRefs = [
12950 - (0, react.useRef)(null),
12951 - (0, react.useRef)(null),
12952 - (0, react.useRef)(null)
12953 - ];
12954 - return /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12955 - container: true,
12956 - spacing: 1.5
12957 - }, /* @__PURE__ */ react.createElement(PropProvider, { ...context }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: TransformFunctionKeys.scale }, scaleAxisControls.map((control, index) => /* @__PURE__ */ react.createElement(ScaleAxisRow, {
12958 - key: control.bind,
12959 - ...control,
12960 - anchorRef: rowRefs[index]
12961 - })))));
12962 - };
12963 -
12964 -//#endregion
12965 -//#region packages/packages/libs/editor-controls/src/controls/transform-control/functions/skew.tsx
12966 - var skewAxisControls = [{
12967 - label: (0, _wordpress_i18n.__)("Skew X", "elementor"),
12968 - bind: "x",
12969 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.ArrowRightIcon, { fontSize: "tiny" })
12970 - }, {
12971 - label: (0, _wordpress_i18n.__)("Skew Y", "elementor"),
12972 - bind: "y",
12973 - startIcon: /* @__PURE__ */ react.createElement(_elementor_icons.ArrowLeftIcon, {
12974 - fontSize: "tiny",
12975 - style: { transform: "scaleX(-1) rotate(-90deg)" }
12976 - })
12977 - }];
12978 - var skewUnits = [
12979 - "deg",
12980 - "rad",
12981 - "grad",
12982 - "turn"
12983 - ];
12984 - var Skew = () => {
12985 - const context = useBoundProp(_elementor_editor_props.skewTransformPropTypeUtil);
12986 - const rowRefs = [
12987 - (0, react.useRef)(null),
12988 - (0, react.useRef)(null),
12989 - (0, react.useRef)(null)
12990 - ];
12991 - return /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
12992 - container: true,
12993 - spacing: 1.5
12994 - }, /* @__PURE__ */ react.createElement(PropProvider, { ...context }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: TransformFunctionKeys.skew }, skewAxisControls.map((control, index) => /* @__PURE__ */ react.createElement(AxisRow, {
12995 - key: control.bind,
12996 - ...control,
12997 - anchorRef: rowRefs[index],
12998 - units: skewUnits
12999 - })))));
13000 - };
13001 -
13002 -//#endregion
13003 -//#region packages/packages/libs/editor-controls/src/controls/transform-control/use-transform-tabs-history.tsx
13004 - var useTransformTabsHistory = ({ move: initialMove, scale: initialScale, rotate: initialRotate, skew: initialSkew }) => {
13005 - const { value: moveValue, setValue: setMoveValue } = useBoundProp(_elementor_editor_props.moveTransformPropTypeUtil);
13006 - const { value: scaleValue, setValue: setScaleValue } = useBoundProp(_elementor_editor_props.scaleTransformPropTypeUtil);
13007 - const { value: rotateValue, setValue: setRotateValue } = useBoundProp(_elementor_editor_props.rotateTransformPropTypeUtil);
13008 - const { value: skewValue, setValue: setSkewValue } = useBoundProp(_elementor_editor_props.skewTransformPropTypeUtil);
13009 - const { openItemIndex, items } = useRepeaterContext();
13010 - const getCurrentTransformType = () => {
13011 - switch (true) {
13012 - case !!scaleValue: return TransformFunctionKeys.scale;
13013 - case !!rotateValue: return TransformFunctionKeys.rotate;
13014 - case !!skewValue: return TransformFunctionKeys.skew;
13015 - default: return TransformFunctionKeys.move;
13016 - }
13017 - };
13018 - const { getTabsProps, getTabProps, getTabPanelProps } = (0, _elementor_ui.useTabs)(getCurrentTransformType());
13019 - const valuesHistory = (0, react.useRef)({
13020 - move: initialMove,
13021 - scale: initialScale,
13022 - rotate: initialRotate,
13023 - skew: initialSkew
13024 - });
13025 - const saveToHistory = (key, value) => {
13026 - if (value) valuesHistory.current[key] = value;
13027 - };
13028 - const onTabChange = (e, tabName) => {
13029 - switch (tabName) {
13030 - case TransformFunctionKeys.move:
13031 - setMoveValue(valuesHistory.current.move);
13032 - saveToHistory("scale", scaleValue);
13033 - saveToHistory("rotate", rotateValue);
13034 - saveToHistory("skew", skewValue);
13035 - break;
13036 - case TransformFunctionKeys.scale:
13037 - setScaleValue(valuesHistory.current.scale);
13038 - saveToHistory("move", moveValue);
13039 - saveToHistory("rotate", rotateValue);
13040 - saveToHistory("skew", skewValue);
13041 - break;
13042 - case TransformFunctionKeys.rotate:
13043 - setRotateValue(valuesHistory.current.rotate);
13044 - saveToHistory("move", moveValue);
13045 - saveToHistory("scale", scaleValue);
13046 - saveToHistory("skew", skewValue);
13047 - break;
13048 - case TransformFunctionKeys.skew:
13049 - setSkewValue(valuesHistory.current.skew);
13050 - saveToHistory("move", moveValue);
13051 - saveToHistory("scale", scaleValue);
13052 - saveToHistory("rotate", rotateValue);
13053 - break;
13054 - }
13055 - return getTabsProps().onChange(e, tabName);
13056 - };
13057 - const isTabDisabled = (tabKey) => {
13058 - return !!items.find(({ item: { $$type: key } }, pos) => tabKey === key && pos !== openItemIndex);
13059 - };
13060 - return {
13061 - getTabProps: (value) => ({
13062 - ...getTabProps(value),
13063 - disabled: isTabDisabled(value)
13064 - }),
13065 - getTabPanelProps,
13066 - getTabsProps: () => ({
13067 - ...getTabsProps(),
13068 - onChange: onTabChange
13069 - })
13070 - };
13071 - };
13072 -
13073 -//#endregion
13074 -//#region packages/packages/libs/editor-controls/src/controls/transform-control/transform-content.tsx
13075 - var TransformContent = () => {
13076 - const { getTabsProps, getTabProps, getTabPanelProps } = useTransformTabsHistory({
13077 - move: initialTransformValue.value,
13078 - scale: initialScaleValue.value,
13079 - rotate: initialRotateValue.value,
13080 - skew: initialSkewValue.value
13081 - });
13082 - return /* @__PURE__ */ react.createElement(PopoverContent, null, /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: { width: "100%" } }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: {
13083 - borderBottom: 1,
13084 - borderColor: "divider"
13085 - } }, /* @__PURE__ */ react.createElement(_elementor_ui.Tabs, {
13086 - size: "small",
13087 - variant: "fullWidth",
13088 - sx: { "& .MuiTab-root": { minWidth: "62px" } },
13089 - ...getTabsProps(),
13090 - "aria-label": (0, _wordpress_i18n.__)("Transform", "elementor")
13091 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Tab, {
13092 - label: (0, _wordpress_i18n.__)("Move", "elementor"),
13093 - ...getTabProps(TransformFunctionKeys.move)
13094 - }), /* @__PURE__ */ react.createElement(_elementor_ui.Tab, {
13095 - label: (0, _wordpress_i18n.__)("Scale", "elementor"),
13096 - ...getTabProps(TransformFunctionKeys.scale)
13097 - }), /* @__PURE__ */ react.createElement(_elementor_ui.Tab, {
13098 - label: (0, _wordpress_i18n.__)("Rotate", "elementor"),
13099 - ...getTabProps(TransformFunctionKeys.rotate)
13100 - }), /* @__PURE__ */ react.createElement(_elementor_ui.Tab, {
13101 - label: (0, _wordpress_i18n.__)("Skew", "elementor"),
13102 - ...getTabProps(TransformFunctionKeys.skew)
13103 - }))), /* @__PURE__ */ react.createElement(_elementor_ui.TabPanel, {
13104 - sx: { p: 1.5 },
13105 - ...getTabPanelProps(TransformFunctionKeys.move)
13106 - }, /* @__PURE__ */ react.createElement(Move, null)), /* @__PURE__ */ react.createElement(_elementor_ui.TabPanel, {
13107 - sx: { p: 1.5 },
13108 - ...getTabPanelProps(TransformFunctionKeys.scale)
13109 - }, /* @__PURE__ */ react.createElement(Scale, null)), /* @__PURE__ */ react.createElement(_elementor_ui.TabPanel, {
13110 - sx: { p: 1.5 },
13111 - ...getTabPanelProps(TransformFunctionKeys.rotate)
13112 - }, /* @__PURE__ */ react.createElement(Rotate, null)), /* @__PURE__ */ react.createElement(_elementor_ui.TabPanel, {
13113 - sx: { p: 1.5 },
13114 - ...getTabPanelProps(TransformFunctionKeys.skew)
13115 - }, /* @__PURE__ */ react.createElement(Skew, null))));
13116 - };
13117 -
13118 -//#endregion
13119 -//#region packages/packages/libs/editor-controls/src/controls/transform-control/transform-icon.tsx
13120 - var TransformIcon = ({ value }) => {
13121 - switch (value.$$type) {
13122 - case TransformFunctionKeys.move: return /* @__PURE__ */ react.createElement(_elementor_icons.ArrowsMaximizeIcon, { fontSize: "tiny" });
13123 - case TransformFunctionKeys.scale: return /* @__PURE__ */ react.createElement(_elementor_icons.ArrowAutofitHeightIcon, { fontSize: "tiny" });
13124 - case TransformFunctionKeys.rotate: return /* @__PURE__ */ react.createElement(_elementor_icons.RotateClockwise2Icon, { fontSize: "tiny" });
13125 - case TransformFunctionKeys.skew: return /* @__PURE__ */ react.createElement(_elementor_icons.SkewXIcon, { fontSize: "tiny" });
13126 - default: return null;
13127 - }
13128 - };
13129 -
13130 -//#endregion
13131 -//#region packages/packages/libs/editor-controls/src/controls/transform-control/transform-label.tsx
13132 - var orderedAxis = [
13133 - "x",
13134 - "y",
13135 - "z"
13136 - ];
13137 - var formatLabel = (value, functionType) => {
13138 - return orderedAxis.map((axisKey) => {
13139 - const axis = value[axisKey];
13140 - if (functionType === "scale") return axis?.value || defaultValues[functionType];
13141 - const defaults = defaultValues[functionType];
13142 - const size = axis?.value?.size ?? defaults.size;
13143 - const unit = axis?.value?.unit ?? defaults.unit;
13144 - return unit === "custom" ? size || "fx" : `${size}${unit}`;
13145 - }).join(", ");
13146 - };
13147 - var TransformLabel = (props) => {
13148 - const { $$type, value } = props.value;
13149 - switch ($$type) {
13150 - case TransformFunctionKeys.move: return /* @__PURE__ */ react.createElement(Label, {
13151 - label: (0, _wordpress_i18n.__)("Move", "elementor"),
13152 - value: formatLabel(value, "move")
13153 - });
13154 - case TransformFunctionKeys.scale: return /* @__PURE__ */ react.createElement(Label, {
13155 - label: (0, _wordpress_i18n.__)("Scale", "elementor"),
13156 - value: formatLabel(value, "scale")
13157 - });
13158 - case TransformFunctionKeys.rotate: return /* @__PURE__ */ react.createElement(Label, {
13159 - label: (0, _wordpress_i18n.__)("Rotate", "elementor"),
13160 - value: formatLabel(value, "rotate")
13161 - });
13162 - case TransformFunctionKeys.skew: return /* @__PURE__ */ react.createElement(Label, {
13163 - label: (0, _wordpress_i18n.__)("Skew", "elementor"),
13164 - value: formatLabel(value, "skew")
13165 - });
13166 - default: return "";
13167 - }
13168 - };
13169 - var Label = ({ label, value }) => {
13170 - return /* @__PURE__ */ react.createElement(_elementor_ui.Box, { component: "span" }, label, ": ", value);
13171 - };
13172 -
13173 -//#endregion
13174 -//#region packages/packages/libs/editor-controls/src/controls/transform-control/transform-base-controls/children-perspective-control.tsx
13175 - var ORIGIN_UNITS = [
13176 - "px",
13177 - "%",
13178 - "em",
13179 - "rem"
13180 - ];
13181 - var PERSPECTIVE_CONTROL_FIELD = {
13182 - label: (0, _wordpress_i18n.__)("Perspective", "elementor"),
13183 - bind: "perspective",
13184 - units: [
13185 - "px",
13186 - "em",
13187 - "rem",
13188 - "vw",
13189 - "vh"
13190 - ]
13191 - };
13192 - var CHILDREN_PERSPECTIVE_FIELDS = [{
13193 - label: (0, _wordpress_i18n.__)("Origin X", "elementor"),
13194 - bind: "x",
13195 - units: ORIGIN_UNITS
13196 - }, {
13197 - label: (0, _wordpress_i18n.__)("Origin Y", "elementor"),
13198 - bind: "y",
13199 - units: ORIGIN_UNITS
13200 - }];
13201 - var ChildrenPerspectiveControl = () => {
13202 - return /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
13203 - direction: "column",
13204 - spacing: 1.5
13205 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Children perspective", "elementor")), /* @__PURE__ */ react.createElement(PerspectiveControl, null), /* @__PURE__ */ react.createElement(PerspectiveOriginControl, null));
13206 - };
13207 - var PerspectiveControl = () => /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "perspective" }, /* @__PURE__ */ react.createElement(ControlFields$1, {
13208 - control: PERSPECTIVE_CONTROL_FIELD,
13209 - key: PERSPECTIVE_CONTROL_FIELD.bind
13210 - }));
13211 - var PerspectiveOriginControl = () => /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "perspective-origin" }, /* @__PURE__ */ react.createElement(PerspectiveOriginControlProvider, null));
13212 - var PerspectiveOriginControlProvider = () => {
13213 - const context = useBoundProp(_elementor_editor_props.perspectiveOriginPropTypeUtil);
13214 - return /* @__PURE__ */ react.createElement(PropProvider, { ...context }, CHILDREN_PERSPECTIVE_FIELDS.map((control) => /* @__PURE__ */ react.createElement(PropKeyProvider, {
13215 - bind: control.bind,
13216 - key: control.bind
13217 - }, /* @__PURE__ */ react.createElement(ControlFields$1, { control }))));
13218 - };
13219 - var ControlFields$1 = /* @__PURE__ */ __name(({ control }) => {
13220 - const rowRef = (0, react.useRef)(null);
13221 - return /* @__PURE__ */ react.createElement(PopoverGridContainer, { ref: rowRef }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
13222 - item: true,
13223 - xs: 6
13224 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, control.label)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
13225 - item: true,
13226 - xs: 6
13227 - }, /* @__PURE__ */ react.createElement(SizeControl, {
13228 - variant: "length",
13229 - units: control.units,
13230 - anchorRef: rowRef,
13231 - disableCustom: true
13232 - })));
13233 - }, "ControlFields");
13234 -
13235 -//#endregion
13236 -//#region packages/packages/libs/editor-controls/src/controls/transform-control/transform-base-controls/transform-origin-control.tsx
13237 - var TRANSFORM_ORIGIN_UNITS = [
13238 - "px",
13239 - "%",
13240 - "em",
13241 - "rem"
13242 - ];
13243 - var TRANSFORM_ORIGIN_UNITS_Z_AXIS = TRANSFORM_ORIGIN_UNITS.filter((unit) => unit !== "%");
13244 - var TRANSFORM_ORIGIN_FIELDS = [
13245 - {
13246 - label: (0, _wordpress_i18n.__)("Origin X", "elementor"),
13247 - bind: "x",
13248 - units: TRANSFORM_ORIGIN_UNITS
13249 - },
13250 - {
13251 - label: (0, _wordpress_i18n.__)("Origin Y", "elementor"),
13252 - bind: "y",
13253 - units: TRANSFORM_ORIGIN_UNITS
13254 - },
13255 - {
13256 - label: (0, _wordpress_i18n.__)("Origin Z", "elementor"),
13257 - bind: "z",
13258 - units: TRANSFORM_ORIGIN_UNITS_Z_AXIS
13259 - }
13260 - ];
13261 - var TransformOriginControl = () => {
13262 - return /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
13263 - direction: "column",
13264 - spacing: 1.5
13265 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Transform", "elementor")), TRANSFORM_ORIGIN_FIELDS.map((control) => /* @__PURE__ */ react.createElement(ControlFields, {
13266 - control,
13267 - key: control.bind
13268 - })));
13269 - };
13270 - var ControlFields = ({ control }) => {
13271 - const context = useBoundProp(_elementor_editor_props.transformOriginPropTypeUtil);
13272 - const rowRef = (0, react.useRef)(null);
13273 - return /* @__PURE__ */ react.createElement(PropProvider, { ...context }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: control.bind }, /* @__PURE__ */ react.createElement(PopoverGridContainer, { ref: rowRef }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
13274 - item: true,
13275 - xs: 6
13276 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, control.label)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
13277 - item: true,
13278 - xs: 6
13279 - }, /* @__PURE__ */ react.createElement(SizeControl, {
13280 - variant: "length",
13281 - units: control.units,
13282 - anchorRef: rowRef
13283 - })))));
13284 - };
13285 -
13286 -//#endregion
13287 -//#region packages/packages/libs/editor-controls/src/controls/transform-control/transform-settings-control.tsx
13288 - var SIZE$2 = "tiny";
13289 - var TransformSettingsControl = ({ popupState, anchorRef, showChildrenPerspective }) => {
13290 - const popupProps = (0, _elementor_ui.bindPopover)({
13291 - ...popupState,
13292 - anchorEl: anchorRef.current ?? void 0
13293 - });
13294 - return /* @__PURE__ */ react.createElement(_elementor_ui.Popover, {
13295 - disablePortal: true,
13296 - anchorOrigin: {
13297 - vertical: "bottom",
13298 - horizontal: "left"
13299 - },
13300 - slotProps: { paper: { sx: {
13301 - width: (anchorRef.current?.offsetWidth || 0) - 6 + "px",
13302 - mt: .5
13303 - } } },
13304 - ...popupProps
13305 - }, /* @__PURE__ */ react.createElement(_elementor_editor_ui.PopoverHeader, {
13306 - title: (0, _wordpress_i18n.__)("Transform settings", "elementor"),
13307 - onClose: popupState.close,
13308 - icon: /* @__PURE__ */ react.createElement(_elementor_icons.AdjustmentsIcon, { fontSize: SIZE$2 })
13309 - }), /* @__PURE__ */ react.createElement(_elementor_ui.Divider, null), /* @__PURE__ */ react.createElement(PopoverContent, { sx: {
13310 - px: 2,
13311 - py: 1.5
13312 - } }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "transform-origin" }, /* @__PURE__ */ react.createElement(TransformOriginControl, null)), showChildrenPerspective && /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: { my: .5 } }, /* @__PURE__ */ react.createElement(_elementor_ui.Divider, null)), /* @__PURE__ */ react.createElement(ChildrenPerspectiveControl, null))));
13313 - };
13314 -
13315 -//#endregion
13316 -//#region packages/packages/libs/editor-controls/src/controls/transform-control/transform-repeater-control.tsx
13317 - var SIZE$1 = "tiny";
13318 - var TransformRepeaterControl = createControl(({ showChildrenPerspective }) => {
13319 - const context = useBoundProp(_elementor_editor_props.transformPropTypeUtil);
13320 - const headerRef = (0, react.useRef)(null);
13321 - const popupState = (0, _elementor_ui.usePopupState)({ variant: "popover" });
13322 - return /* @__PURE__ */ react.createElement(PropProvider, { ...context }, /* @__PURE__ */ react.createElement(TransformSettingsControl, {
13323 - popupState,
13324 - anchorRef: headerRef,
13325 - showChildrenPerspective
13326 - }), /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "transform-functions" }, /* @__PURE__ */ react.createElement(Repeater$1, {
13327 - headerRef,
13328 - propType: context.propType,
13329 - popupState
13330 - })));
13331 - });
13332 - var ToolTip = /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
13333 - component: "span",
13334 - "aria-label": void 0,
13335 - sx: {
13336 - display: "flex",
13337 - gap: .5,
13338 - p: 2,
13339 - width: 320,
13340 - borderRadius: 1
13341 - }
13342 - }, /* @__PURE__ */ react.createElement(_elementor_icons.InfoCircleFilledIcon, { sx: { color: "secondary.main" } }), /* @__PURE__ */ react.createElement(_elementor_ui.Typography, {
13343 - variant: "body2",
13344 - color: "text.secondary",
13345 - fontSize: "14px"
13346 - }, (0, _wordpress_i18n.__)("You can use each kind of transform only once per element.", "elementor")));
13347 - var Repeater$1 = /* @__PURE__ */ __name(({ headerRef, propType, popupState }) => {
13348 - const transformFunctionsContext = useBoundProp(_elementor_editor_props.transformFunctionsPropTypeUtil);
13349 - const availableValues = [
13350 - initialTransformValue,
13351 - initialScaleValue,
13352 - initialRotateValue,
13353 - initialSkewValue
13354 - ];
13355 - const { value: transformValues, bind } = transformFunctionsContext;
13356 - const getInitialValue = () => {
13357 - return availableValues.find((value) => !transformValues?.some((item) => item.$$type === value.$$type));
13358 - };
13359 - const shouldDisableAddItem = !getInitialValue();
13360 - return /* @__PURE__ */ react.createElement(PropProvider, { ...transformFunctionsContext }, /* @__PURE__ */ react.createElement(ControlRepeater, {
13361 - initial: getInitialValue() ?? initialTransformValue,
13362 - propTypeUtil: _elementor_editor_props.transformFunctionsPropTypeUtil
13363 - }, /* @__PURE__ */ react.createElement(RepeaterHeader, {
13364 - label: (0, _wordpress_i18n.__)("Transform", "elementor"),
13365 - adornment: () => /* @__PURE__ */ react.createElement(ControlAdornments, { customContext: {
13366 - path: ["transform"],
13367 - propType
13368 - } }),
13369 - ref: headerRef
13370 - }, /* @__PURE__ */ react.createElement(TransformBasePopoverTrigger, {
13371 - popupState,
13372 - repeaterBindKey: bind
13373 - }), /* @__PURE__ */ react.createElement(TooltipAddItemAction, {
13374 - disabled: shouldDisableAddItem,
13375 - tooltipContent: ToolTip,
13376 - enableTooltip: shouldDisableAddItem,
13377 - ariaLabel: "transform"
13378 - })), /* @__PURE__ */ react.createElement(ItemsContainer, null, /* @__PURE__ */ react.createElement(Item, {
13379 - Icon: TransformIcon,
13380 - Label: TransformLabel,
13381 - actions: /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(DisableItemAction, null), /* @__PURE__ */ react.createElement(RemoveItemAction, null))
13382 - })), /* @__PURE__ */ react.createElement(EditItemPopover, null, /* @__PURE__ */ react.createElement(TransformContent, null))));
13383 - }, "Repeater");
13384 - var TransformBasePopoverTrigger = ({ popupState, repeaterBindKey }) => {
13385 - const { bind } = useBoundProp();
13386 - const titleLabel = (0, _wordpress_i18n.__)("Transform settings", "elementor");
13387 - return bind !== repeaterBindKey ? null : /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
13388 - title: titleLabel,
13389 - placement: "top"
13390 - }, /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, {
13391 - size: SIZE$1,
13392 - "aria-label": titleLabel,
13393 - ...(0, _elementor_ui.bindTrigger)(popupState)
13394 - }, /* @__PURE__ */ react.createElement(_elementor_icons.AdjustmentsIcon, { fontSize: SIZE$1 })));
13395 - };
13396 -
13397 -//#endregion
13398 -//#region packages/packages/libs/editor-controls/src/controls/selection-size-control.tsx
13399 - var SelectionSizeControl = createControl(({ selectionLabel, sizeLabel, selectionConfig, sizeConfigMap }) => {
13400 - const { value, setValue, propType } = useBoundProp(_elementor_editor_props.selectionSizePropTypeUtil);
13401 - const rowRef = (0, react.useRef)(null);
13402 - const sizeFieldId = sizeLabel.replace(/\s+/g, "-").toLowerCase();
13403 - const currentSizeConfig = (0, react.useMemo)(() => {
13404 - switch (value.selection.$$type) {
13405 - case "key-value": return sizeConfigMap[value?.selection?.value.value.value || ""];
13406 - case "string": return sizeConfigMap[value?.selection?.value || ""];
13407 - default: return null;
13408 - }
13409 - }, [value, sizeConfigMap]);
13410 - const SelectionComponent = selectionConfig.component;
13411 - return /* @__PURE__ */ react.createElement(PropProvider, {
13412 - value,
13413 - setValue,
13414 - propType
13415 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
13416 - container: true,
13417 - spacing: 1.5,
13418 - ref: rowRef
13419 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
13420 - item: true,
13421 - xs: 6,
13422 - sx: {
13423 - display: "flex",
13424 - alignItems: "center"
13425 - }
13426 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, selectionLabel)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
13427 - item: true,
13428 - xs: 6
13429 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "selection" }, /* @__PURE__ */ react.createElement(SelectionComponent, { ...selectionConfig.props }))), currentSizeConfig && /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
13430 - item: true,
13431 - xs: 6,
13432 - sx: {
13433 - display: "flex",
13434 - alignItems: "center"
13435 - }
13436 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, { htmlFor: sizeFieldId }, sizeLabel)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
13437 - item: true,
13438 - xs: 6
13439 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ react.createElement(SizeControl, {
13440 - anchorRef: rowRef,
13441 - variant: currentSizeConfig.variant,
13442 - units: currentSizeConfig.units,
13443 - defaultUnit: currentSizeConfig.defaultUnit,
13444 - id: sizeFieldId
13445 - }))))));
13446 - });
13447 -
13448 -//#endregion
13449 -//#region packages/packages/libs/editor-controls/src/controls/transition-control/data.ts
13450 - var initialTransitionValue = {
13451 - selection: {
13452 - $$type: "key-value",
13453 - value: {
13454 - key: {
13455 - value: (0, _wordpress_i18n.__)("All properties", "elementor"),
13456 - $$type: "string"
13457 - },
13458 - value: {
13459 - value: "all",
13460 - $$type: "string"
13461 - }
13462 - }
13463 - },
13464 - size: {
13465 - $$type: "size",
13466 - value: {
13467 - size: 200,
13468 - unit: "ms"
13469 - }
13470 - }
13471 - };
13472 - var MIN_PRO_VERSION = "3.35";
13473 - var getIsSiteRtl = () => {
13474 - return !!window.elementorFrontend?.config?.is_rtl;
13475 - };
13476 - var shouldShowAllTransitionProperties = () => {
13477 - if (!(0, _elementor_utils.hasProInstalled)()) return true;
13478 - const proVersion = window.elementorPro?.config?.version;
13479 - if (!proVersion) return false;
13480 - return (0, _elementor_utils.isVersionGreaterOrEqual)(proVersion, MIN_PRO_VERSION);
13481 - };
13482 - var createTransitionPropertiesList = () => {
13483 - const isSiteRtl = getIsSiteRtl();
13484 - const baseProperties = [
13485 - {
13486 - label: (0, _wordpress_i18n.__)("Default", "elementor"),
13487 - type: "category",
13488 - properties: [{
13489 - label: (0, _wordpress_i18n.__)("All properties", "elementor"),
13490 - value: "all"
13491 - }]
13492 - },
13493 - {
13494 - label: (0, _wordpress_i18n.__)("Margin", "elementor"),
13495 - type: "category",
13496 - properties: [
13497 - {
13498 - label: (0, _wordpress_i18n.__)("Margin (all)", "elementor"),
13499 - value: "margin",
13500 - isDisabled: true
13501 - },
13502 - {
13503 - label: (0, _wordpress_i18n.__)("Margin bottom", "elementor"),
13504 - value: "margin-block-end",
13505 - isDisabled: true
13506 - },
13507 - {
13508 - label: isSiteRtl ? (0, _wordpress_i18n.__)("Margin right", "elementor") : (0, _wordpress_i18n.__)("Margin left", "elementor"),
13509 - value: "margin-inline-start",
13510 - isDisabled: true
13511 - },
13512 - {
13513 - label: isSiteRtl ? (0, _wordpress_i18n.__)("Margin left", "elementor") : (0, _wordpress_i18n.__)("Margin right", "elementor"),
13514 - value: "margin-inline-end",
13515 - isDisabled: true
13516 - },
13517 - {
13518 - label: (0, _wordpress_i18n.__)("Margin top", "elementor"),
13519 - value: "margin-block-start",
13520 - isDisabled: true
13521 - }
13522 - ]
13523 - },
13524 - {
13525 - label: (0, _wordpress_i18n.__)("Padding", "elementor"),
13526 - type: "category",
13527 - properties: [
13528 - {
13529 - label: (0, _wordpress_i18n.__)("Padding (all)", "elementor"),
13530 - value: "padding",
13531 - isDisabled: true
13532 - },
13533 - {
13534 - label: (0, _wordpress_i18n.__)("Padding bottom", "elementor"),
13535 - value: "padding-block-end",
13536 - isDisabled: true
13537 - },
13538 - {
13539 - label: isSiteRtl ? (0, _wordpress_i18n.__)("Padding right", "elementor") : (0, _wordpress_i18n.__)("Padding left", "elementor"),
13540 - value: "padding-inline-start",
13541 - isDisabled: true
13542 - },
13543 - {
13544 - label: isSiteRtl ? (0, _wordpress_i18n.__)("Padding left", "elementor") : (0, _wordpress_i18n.__)("Padding right", "elementor"),
13545 - value: "padding-inline-end",
13546 - isDisabled: true
13547 - },
13548 - {
13549 - label: (0, _wordpress_i18n.__)("Padding top", "elementor"),
13550 - value: "padding-block-start",
13551 - isDisabled: true
13552 - }
13553 - ]
13554 - },
13555 - {
13556 - label: (0, _wordpress_i18n.__)("Flex", "elementor"),
13557 - type: "category",
13558 - properties: [
13559 - {
13560 - label: (0, _wordpress_i18n.__)("Flex (all)", "elementor"),
13561 - value: "flex",
13562 - isDisabled: true
13563 - },
13564 - {
13565 - label: (0, _wordpress_i18n.__)("Flex grow", "elementor"),
13566 - value: "flex-grow",
13567 - isDisabled: true
13568 - },
13569 - {
13570 - label: (0, _wordpress_i18n.__)("Flex shrink", "elementor"),
13571 - value: "flex-shrink",
13572 - isDisabled: true
13573 - },
13574 - {
13575 - label: (0, _wordpress_i18n.__)("Flex basis", "elementor"),
13576 - value: "flex-basis",
13577 - isDisabled: true
13578 - }
13579 - ]
13580 - },
13581 - {
13582 - label: (0, _wordpress_i18n.__)("Size", "elementor"),
13583 - type: "category",
13584 - properties: [
13585 - {
13586 - label: (0, _wordpress_i18n.__)("Width", "elementor"),
13587 - value: "width",
13588 - isDisabled: true
13589 - },
13590 - {
13591 - label: (0, _wordpress_i18n.__)("Height", "elementor"),
13592 - value: "height",
13593 - isDisabled: true
13594 - },
13595 - {
13596 - label: (0, _wordpress_i18n.__)("Max height", "elementor"),
13597 - value: "max-height",
13598 - isDisabled: true
13599 - },
13600 - {
13601 - label: (0, _wordpress_i18n.__)("Max width", "elementor"),
13602 - value: "max-width",
13603 - isDisabled: true
13604 - },
13605 - {
13606 - label: (0, _wordpress_i18n.__)("Min height", "elementor"),
13607 - value: "min-height",
13608 - isDisabled: true
13609 - },
13610 - {
13611 - label: (0, _wordpress_i18n.__)("Min width", "elementor"),
13612 - value: "min-width",
13613 - isDisabled: true
13614 - }
13615 - ]
13616 - },
13617 - {
13618 - label: (0, _wordpress_i18n.__)("Position", "elementor"),
13619 - type: "category",
13620 - properties: [
13621 - {
13622 - label: (0, _wordpress_i18n.__)("Top", "elementor"),
13623 - value: "inset-block-start",
13624 - isDisabled: true
13625 - },
13626 - {
13627 - label: isSiteRtl ? (0, _wordpress_i18n.__)("Right", "elementor") : (0, _wordpress_i18n.__)("Left", "elementor"),
13628 - value: "inset-inline-start",
13629 - isDisabled: true
13630 - },
13631 - {
13632 - label: isSiteRtl ? (0, _wordpress_i18n.__)("Left", "elementor") : (0, _wordpress_i18n.__)("Right", "elementor"),
13633 - value: "inset-inline-end",
13634 - isDisabled: true
13635 - },
13636 - {
13637 - label: (0, _wordpress_i18n.__)("Bottom", "elementor"),
13638 - value: "inset-block-end",
13639 - isDisabled: true
13640 - },
13641 - {
13642 - label: (0, _wordpress_i18n.__)("Z-index", "elementor"),
13643 - value: "z-index",
13644 - isDisabled: true
13645 - }
13646 - ]
13647 - },
13648 - {
13649 - label: (0, _wordpress_i18n.__)("Typography", "elementor"),
13650 - type: "category",
13651 - properties: [
13652 - {
13653 - label: (0, _wordpress_i18n.__)("Font color", "elementor"),
13654 - value: "color",
13655 - isDisabled: true
13656 - },
13657 - {
13658 - label: (0, _wordpress_i18n.__)("Font size", "elementor"),
13659 - value: "font-size",
13660 - isDisabled: true
13661 - },
13662 - {
13663 - label: (0, _wordpress_i18n.__)("Line height", "elementor"),
13664 - value: "line-height",
13665 - isDisabled: true
13666 - },
13667 - {
13668 - label: (0, _wordpress_i18n.__)("Letter spacing", "elementor"),
13669 - value: "letter-spacing",
13670 - isDisabled: true
13671 - },
13672 - {
13673 - label: (0, _wordpress_i18n.__)("Word spacing", "elementor"),
13674 - value: "word-spacing",
13675 - isDisabled: true
13676 - },
13677 - {
13678 - label: (0, _wordpress_i18n.__)("Font variations", "elementor"),
13679 - value: "font-variation-settings",
13680 - isDisabled: true
13681 - },
13682 - {
13683 - label: (0, _wordpress_i18n.__)("Text stroke color", "elementor"),
13684 - value: "-webkit-text-stroke-color",
13685 - isDisabled: true
13686 - }
13687 - ]
13688 - },
13689 - {
13690 - label: (0, _wordpress_i18n.__)("Background", "elementor"),
13691 - type: "category",
13692 - properties: [
13693 - {
13694 - label: (0, _wordpress_i18n.__)("Background color", "elementor"),
13695 - value: "background-color",
13696 - isDisabled: true
13697 - },
13698 - {
13699 - label: (0, _wordpress_i18n.__)("Background position", "elementor"),
13700 - value: "background-position",
13701 - isDisabled: true
13702 - },
13703 - {
13704 - label: (0, _wordpress_i18n.__)("Box shadow", "elementor"),
13705 - value: "box-shadow",
13706 - isDisabled: true
13707 - }
13708 - ]
13709 - },
13710 - {
13711 - label: (0, _wordpress_i18n.__)("Border", "elementor"),
13712 - type: "category",
13713 - properties: [
13714 - {
13715 - label: (0, _wordpress_i18n.__)("Border (all)", "elementor"),
13716 - value: "border",
13717 - isDisabled: true
13718 - },
13719 - {
13720 - label: (0, _wordpress_i18n.__)("Border radius", "elementor"),
13721 - value: "border-radius",
13722 - isDisabled: true
13723 - },
13724 - {
13725 - label: (0, _wordpress_i18n.__)("Border color", "elementor"),
13726 - value: "border-color",
13727 - isDisabled: true
13728 - },
13729 - {
13730 - label: (0, _wordpress_i18n.__)("Border width", "elementor"),
13731 - value: "border-width",
13732 - isDisabled: true
13733 - }
13734 - ]
13735 - },
13736 - {
13737 - label: (0, _wordpress_i18n.__)("Effects", "elementor"),
13738 - type: "category",
13739 - properties: [
13740 - {
13741 - label: (0, _wordpress_i18n.__)("Opacity", "elementor"),
13742 - value: "opacity",
13743 - isDisabled: true
13744 - },
13745 - {
13746 - label: (0, _wordpress_i18n.__)("Transform (all)", "elementor"),
13747 - value: "transform",
13748 - isDisabled: true
13749 - },
13750 - {
13751 - label: (0, _wordpress_i18n.__)("Filter (all)", "elementor"),
13752 - value: "filter",
13753 - isDisabled: true
13754 - }
13755 - ]
13756 - }
13757 - ];
13758 - return shouldShowAllTransitionProperties() ? baseProperties : [baseProperties[0]];
13759 - };
13760 - var transitionProperties = createTransitionPropertiesList();
13761 - var transitionsItemsList = transitionProperties.map((category) => ({
13762 - label: category.label,
13763 - items: category.properties.map((property) => property.label)
13764 - }));
13765 -
13766 -//#endregion
13767 -//#region packages/packages/libs/editor-controls/src/controls/transition-control/trainsition-events.ts
13768 - var transitionRepeaterMixpanelEvent = {
13769 - eventName: "click_added_transition",
13770 - location: "V4 Style Tab",
13771 - secondaryLocation: "Transition control",
13772 - trigger: "click"
13773 - };
13774 - function subscribeToTransitionEvent() {
13775 - eventBus.subscribe("transition-item-added", (data) => {
13776 - const value = data?.itemValue?.selection?.value?.value?.value;
13777 - const widgetType = (0, _elementor_editor_elements.getSelectedElements)()[0]?.type ?? null;
13778 - (0, _elementor_events.trackEvent)({
13779 - transition_type: value ?? "unknown",
13780 - ...transitionRepeaterMixpanelEvent,
13781 - widget_type: widgetType
13782 - });
13783 - });
13784 - }
13785 -
13786 -//#endregion
13787 -//#region packages/packages/libs/editor-controls/src/utils/tracking.ts
13788 - var getBaseEventProperties = (data, config) => ({
13789 - window_name: config?.appTypes?.editor ?? "editor",
13790 - interaction_type: config?.triggers?.click ?? "Click",
13791 - target_name: data.target_name,
13792 - target_location: data.target_location ?? "widget_panel",
13793 - location_l1: data.location_l1 ?? (0, _elementor_editor_elements.getSelectedElements)()[0]?.type ?? "",
13794 - ...data.location_l2 && { location_l2: data.location_l2 }
13795 - });
13796 - var dispatchPromotionEvent = (data, resolveOptions) => {
13797 - const { dispatchEvent, config } = (0, _elementor_events.getMixpanel)();
13798 - const { eventName, interactionResult, interactionDescription } = resolveOptions(config);
13799 - if (!eventName) return;
13800 - dispatchEvent?.(eventName, {
13801 - ...getBaseEventProperties(data, config),
13802 - interaction_result: interactionResult,
13803 - interaction_description: interactionDescription
13804 - });
13805 - };
13806 - var trackViewPromotion = (data) => {
13807 - dispatchPromotionEvent(data, (config) => ({
13808 - eventName: config?.names?.promotions?.viewPromotion,
13809 - interactionResult: config?.interactionResults?.promotionViewed ?? "promotion_viewed",
13810 - interactionDescription: "user_viewed_promotion"
13811 - }));
13812 - };
13813 - var trackUpgradePromotionClick = (data) => {
13814 - dispatchPromotionEvent(data, (config) => ({
13815 - eventName: config?.names?.promotions?.upgradePromotionClick,
13816 - interactionResult: config?.interactionResults?.upgradeNow ?? "upgrade_now",
13817 - interactionDescription: "user_clicked_upgrade_now"
13818 - }));
13819 - };
13820 -
13821 -//#endregion
13822 -//#region packages/packages/libs/editor-controls/src/controls/transition-control/transition-selector.tsx
13823 - var toTransitionSelectorValue = (label) => {
13824 - for (const category of transitionProperties) {
13825 - const property = category.properties.find((prop) => prop.label === label);
13826 - if (property) return {
13827 - key: {
13828 - value: property.label,
13829 - $$type: "string"
13830 - },
13831 - value: {
13832 - value: property.value,
13833 - $$type: "string"
13834 - }
13835 - };
13836 - }
13837 - return null;
13838 - };
13839 - function getTransitionPropertyByValue(item) {
13840 - if (!item?.value) return null;
13841 - for (const category of transitionProperties) for (const property of category.properties) if (property.value === item.value) return property;
13842 - return null;
13843 - }
13844 - var includeCurrentValueInOptions = (value, disabledItems) => {
13845 - return disabledItems.filter((item) => {
13846 - return item !== value.key.value;
13847 - });
13848 - };
13849 - var PRO_UPGRADE_URL = "https://go.elementor.com/go-pro-transitions-modal/";
13850 - var TransitionSelector = ({ recentlyUsedList = [], disabledItems = [], showPromotion = false }) => {
13851 - const { value, setValue } = useBoundProp(_elementor_editor_props.keyValuePropTypeUtil);
13852 - const { key: { value: transitionLabel } } = value;
13853 - const defaultRef = (0, react.useRef)(null);
13854 - const popoverState = (0, _elementor_ui.usePopupState)({ variant: "popover" });
13855 - const disabledCategories = (0, react.useMemo)(() => {
13856 - return new Set(transitionProperties.filter((cat) => cat.properties.some((prop) => prop.isDisabled)).map((cat) => cat.label));
13857 - }, []);
13858 - const getItemList = () => {
13859 - const recentItems = recentlyUsedList.map((item) => getTransitionPropertyByValue({
13860 - value: item,
13861 - $$type: "string"
13862 - })?.label).filter((item) => !!item);
13863 - const filteredItems = transitionsItemsList.map((category) => {
13864 - return {
13865 - ...category,
13866 - items: category.items.filter((item) => !recentItems.includes(item))
13867 - };
13868 - });
13869 - if (recentItems.length === 0) return filteredItems;
13870 - const [first, ...rest] = filteredItems;
13871 - return [
13872 - first,
13873 - {
13874 - label: (0, _wordpress_i18n.__)("Recently Used", "elementor"),
13875 - items: recentItems
13876 - },
13877 - ...rest
13878 - ];
13879 - };
13880 - const handleTransitionPropertyChange = (newLabel) => {
13881 - const newValue = toTransitionSelectorValue(newLabel);
13882 - if (!newValue) return;
13883 - setValue(newValue);
13884 - popoverState.close();
13885 - };
13886 - const getAnchorPosition = () => {
13887 - if (!defaultRef.current) return;
13888 - const rect = defaultRef.current.getBoundingClientRect();
13889 - return {
13890 - top: rect.top,
13891 - left: rect.right + 36
13892 - };
13893 - };
13894 - return /* @__PURE__ */ react.createElement(_elementor_ui.Box, { ref: defaultRef }, /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.UnstableTag, {
13895 - variant: "outlined",
13896 - label: transitionLabel,
13897 - endIcon: /* @__PURE__ */ react.createElement(_elementor_icons.ChevronDownIcon, { fontSize: "tiny" }),
13898 - ...(0, _elementor_ui.bindTrigger)(popoverState),
13899 - fullWidth: true
13900 - })), /* @__PURE__ */ react.createElement(_elementor_ui.Popover, {
13901 - disablePortal: true,
13902 - disableScrollLock: true,
13903 - ...(0, _elementor_ui.bindPopover)(popoverState),
13904 - anchorReference: "anchorPosition",
13905 - anchorPosition: getAnchorPosition(),
13906 - anchorOrigin: {
13907 - vertical: "top",
13908 - horizontal: "right"
13909 - },
13910 - transformOrigin: {
13911 - vertical: "top",
13912 - horizontal: "left"
13913 - }
13914 - }, /* @__PURE__ */ react.createElement(ItemSelector, {
13915 - itemsList: getItemList(),
13916 - selectedItem: transitionLabel,
13917 - onItemChange: handleTransitionPropertyChange,
13918 - onClose: popoverState.close,
13919 - sectionWidth: 268,
13920 - title: (0, _wordpress_i18n.__)("Transition Property", "elementor"),
13921 - icon: _elementor_icons.VariationsIcon,
13922 - disabledItems: includeCurrentValueInOptions(value, disabledItems),
13923 - categoryItemContentTemplate: (item) => /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: {
13924 - display: "flex",
13925 - alignItems: "center",
13926 - justifyContent: "space-between",
13927 - width: "100%"
13928 - } }, /* @__PURE__ */ react.createElement("span", null, item.value), showPromotion && disabledCategories.has(item.value) && /* @__PURE__ */ react.createElement(_elementor_editor_ui.PromotionChip, null)),
13929 - footer: showPromotion ? /* @__PURE__ */ react.createElement(_elementor_editor_ui.PromotionAlert, {
13930 - message: (0, _wordpress_i18n.__)("Upgrade to customize transition properties and control effects.", "elementor"),
13931 - upgradeUrl: PRO_UPGRADE_URL,
13932 - onCtaClick: () => trackUpgradePromotionClick({
13933 - target_name: "transition_property",
13934 - location_l2: "style"
13935 - })
13936 - }) : null
13937 - })));
13938 - };
13939 -
13940 -//#endregion
13941 -//#region packages/packages/libs/editor-controls/src/controls/transition-control/transition-repeater-control.tsx
13942 - var DURATION_CONFIG = {
13943 - variant: "time",
13944 - units: ["s", "ms"],
13945 - defaultUnit: "ms"
13946 - };
13947 - var childArrayPropTypeUtil = (0, _elementor_editor_props.createArrayPropUtils)(_elementor_editor_props.selectionSizePropTypeUtil.key, _elementor_editor_props.selectionSizePropTypeUtil.schema, "transition");
13948 - subscribeToTransitionEvent();
13949 - var areAllPropertiesUsed = (value = []) => {
13950 - return value?.length ? transitionProperties.every((category) => {
13951 - return category.properties.every((property) => {
13952 - return property.isDisabled || !!value?.find((item) => {
13953 - return item.value?.selection?.value?.value?.value === property.value;
13954 - });
13955 - });
13956 - }) : false;
13957 - };
13958 - var getSelectionSizeProps = (recentlyUsedList, disabledItems, showPromotion) => {
13959 - return {
13960 - selectionLabel: (0, _wordpress_i18n.__)("Type", "elementor"),
13961 - sizeLabel: (0, _wordpress_i18n.__)("Duration", "elementor"),
13962 - selectionConfig: {
13963 - component: TransitionSelector,
13964 - props: {
13965 - recentlyUsedList,
13966 - disabledItems,
13967 - showPromotion
13968 - }
13969 - },
13970 - sizeConfigMap: { ...transitionProperties.reduce((acc, category) => {
13971 - category.properties.forEach((property) => {
13972 - acc[property.value] = DURATION_CONFIG;
13973 - });
13974 - return acc;
13975 - }, {}) }
13976 - };
13977 - };
13978 - var isItemDisabled = (item) => {
13979 - const property = getTransitionPropertyByValue(item.value.selection.value?.value);
13980 - return !property ? false : !!property.isDisabled;
13981 - };
13982 - var getChildControlConfig = (recentlyUsedList, disabledItems, showPromotion) => {
13983 - return {
13984 - propTypeUtil: _elementor_editor_props.selectionSizePropTypeUtil,
13985 - component: SelectionSizeControl,
13986 - props: getSelectionSizeProps(recentlyUsedList, disabledItems, showPromotion),
13987 - isItemDisabled
13988 - };
13989 - };
13990 - var isPropertyUsed = (value, property) => {
13991 - return (value ?? []).some((item) => {
13992 - return item?.value?.selection?.value?.value?.value === property.value;
13993 - });
13994 - };
13995 - var getDisabledItemLabels = (values = []) => {
13996 - const selectedLabels = (values || []).map((item) => item.value?.selection?.value?.key?.value);
13997 - const proDisabledLabels = [];
13998 - transitionProperties.forEach((category) => {
13999 - const disabledProperties = category.properties.filter((property) => property.isDisabled && !selectedLabels.includes(property.label)).map((property) => property.label);
14000 - proDisabledLabels.push(...disabledProperties);
14001 - });
14002 - return {
14003 - allDisabled: [...selectedLabels, ...proDisabledLabels],
14004 - proDisabled: proDisabledLabels
14005 - };
14006 - };
14007 - var getInitialValue = (values = []) => {
14008 - if (!values?.length) return initialTransitionValue;
14009 - for (const category of transitionProperties) for (const property of category.properties) {
14010 - if (isPropertyUsed(values, property)) continue;
14011 - return {
14012 - ...initialTransitionValue,
14013 - selection: {
14014 - $$type: "key-value",
14015 - value: {
14016 - key: {
14017 - value: property.label,
14018 - $$type: "string"
14019 - },
14020 - value: {
14021 - value: property.value,
14022 - $$type: "string"
14023 - }
14024 - }
14025 - }
14026 - };
14027 - }
14028 - return initialTransitionValue;
14029 - };
14030 - var disableAddItemTooltipContent = /* @__PURE__ */ react.createElement(_elementor_ui.Alert, {
14031 - sx: {
14032 - width: 280,
14033 - gap: .5
14034 - },
14035 - color: "secondary",
14036 - icon: /* @__PURE__ */ react.createElement(_elementor_icons.InfoCircleFilledIcon, null)
14037 - }, /* @__PURE__ */ react.createElement(_elementor_ui.AlertTitle, null, (0, _wordpress_i18n.__)("Transitions", "elementor")), /* @__PURE__ */ react.createElement(_elementor_ui.Box, { component: "span" }, /* @__PURE__ */ react.createElement(_elementor_ui.Typography, { variant: "body2" }, (0, _wordpress_i18n.__)("Switch to 'Normal' state to add a transition.", "elementor"))));
14038 - var TransitionRepeaterControl = createControl(({ recentlyUsedListGetter, currentStyleState }) => {
14039 - const currentStyleIsNormal = currentStyleState === null;
14040 - const [recentlyUsedList, setRecentlyUsedList] = (0, react.useState)([]);
14041 - const proInstalled = (0, _elementor_utils.hasProInstalled)();
14042 - const { value, setValue } = useBoundProp(childArrayPropTypeUtil);
14043 - const { allDisabled: disabledItems, proDisabled: proDisabledItems } = (0, react.useMemo)(() => getDisabledItemLabels(value), [value]);
14044 - const allowedTransitionSet = (0, react.useMemo)(() => {
14045 - const set = /* @__PURE__ */ new Set();
14046 - transitionProperties.forEach((category) => {
14047 - category.properties.forEach((prop) => {
14048 - if (!prop.isDisabled || proInstalled) set.add(prop.value);
14049 - });
14050 - });
14051 - return set;
14052 - }, [proInstalled]);
14053 - (0, react.useEffect)(() => {
14054 - if (!value || value.length === 0) return;
14055 - const sanitized = value.filter((item) => {
14056 - const selectionValue = item?.value?.selection?.value?.value?.value ?? "";
14057 - return allowedTransitionSet.has(selectionValue);
14058 - });
14059 - if (sanitized.length !== value.length) setValue(sanitized);
14060 - }, [allowedTransitionSet]);
14061 - (0, react.useEffect)(() => {
14062 - recentlyUsedListGetter().then(setRecentlyUsedList);
14063 - }, [recentlyUsedListGetter]);
14064 - const allPropertiesUsed = (0, react.useMemo)(() => areAllPropertiesUsed(value), [value]);
14065 - const isAddItemDisabled = !currentStyleIsNormal || allPropertiesUsed;
14066 - return /* @__PURE__ */ react.createElement(RepeatableControl, {
14067 - label: (0, _wordpress_i18n.__)("Transitions", "elementor"),
14068 - repeaterLabel: (0, _wordpress_i18n.__)("Transitions", "elementor"),
14069 - patternLabel: "${value.selection.value.key.value}: ${value.size.value.size}${value.size.value.unit}",
14070 - placeholder: (0, _wordpress_i18n.__)("Empty Transition", "elementor"),
14071 - showDuplicate: false,
14072 - showToggle: true,
14073 - initialValues: getInitialValue(value),
14074 - childControlConfig: getChildControlConfig(recentlyUsedList, disabledItems, proDisabledItems.length > 0),
14075 - propKey: "transition",
14076 - addItemTooltipProps: {
14077 - disabled: isAddItemDisabled,
14078 - enableTooltip: !currentStyleIsNormal,
14079 - tooltipContent: disableAddItemTooltipContent
14080 - }
14081 - });
14082 - });
14083 -
14084 -//#endregion
14085 -//#region node_modules/dayjs/dayjs.min.js
14086 - var require_dayjs_min = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14087 - (function(t, e) {
14088 - "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
14089 - })(exports, (function() {
14090 - "use strict";
14091 - var t = 1e3;
14092 - var e = 6e4;
14093 - var n = 36e5;
14094 - var r = "millisecond";
14095 - var i = "second";
14096 - var s = "minute";
14097 - var u = "hour";
14098 - var a = "day";
14099 - var o = "week";
14100 - var c = "month";
14101 - var f = "quarter";
14102 - var h = "year";
14103 - var d = "date";
14104 - var l = "Invalid Date";
14105 - var $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
14106 - var y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
14107 - var M = {
14108 - name: "en",
14109 - weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
14110 - months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
14111 - ordinal: function(t) {
14112 - var e = [
14113 - "th",
14114 - "st",
14115 - "nd",
14116 - "rd"
14117 - ];
14118 - var n = t % 100;
14119 - return "[" + t + (e[(n - 20) % 10] || e[n] || e[0]) + "]";
14120 - }
14121 - };
14122 - var m = function(t, e, n) {
14123 - var r = String(t);
14124 - return !r || r.length >= e ? t : "" + Array(e + 1 - r.length).join(n) + t;
14125 - };
14126 - var v = {
14127 - s: m,
14128 - z: function(t) {
14129 - var e = -t.utcOffset();
14130 - var n = Math.abs(e);
14131 - var r = Math.floor(n / 60);
14132 - var i = n % 60;
14133 - return (e <= 0 ? "+" : "-") + m(r, 2, "0") + ":" + m(i, 2, "0");
14134 - },
14135 - m: function t(e, n) {
14136 - if (e.date() < n.date()) return -t(n, e);
14137 - var r = 12 * (n.year() - e.year()) + (n.month() - e.month());
14138 - var i = e.clone().add(r, c);
14139 - var s = n - i < 0;
14140 - var u = e.clone().add(r + (s ? -1 : 1), c);
14141 - return +(-(r + (n - i) / (s ? i - u : u - i)) || 0);
14142 - },
14143 - a: function(t) {
14144 - return t < 0 ? Math.ceil(t) || 0 : Math.floor(t);
14145 - },
14146 - p: function(t) {
14147 - return {
14148 - M: c,
14149 - y: h,
14150 - w: o,
14151 - d: a,
14152 - D: d,
14153 - h: u,
14154 - m: s,
14155 - s: i,
14156 - ms: r,
14157 - Q: f
14158 - }[t] || String(t || "").toLowerCase().replace(/s$/, "");
14159 - },
14160 - u: function(t) {
14161 - return void 0 === t;
14162 - }
14163 - };
14164 - var g = "en";
14165 - var D = {};
14166 - D[g] = M;
14167 - var p = "$isDayjsObject";
14168 - var S = function(t) {
14169 - return t instanceof _ || !(!t || !t[p]);
14170 - };
14171 - var w = function t(e, n, r) {
14172 - var i;
14173 - if (!e) return g;
14174 - if ("string" == typeof e) {
14175 - var s = e.toLowerCase();
14176 - D[s] && (i = s), n && (D[s] = n, i = s);
14177 - var u = e.split("-");
14178 - if (!i && u.length > 1) return t(u[0]);
14179 - } else {
14180 - var a = e.name;
14181 - D[a] = e, i = a;
14182 - }
14183 - return !r && i && (g = i), i || !r && g;
14184 - };
14185 - var O = function(t, e) {
14186 - if (S(t)) return t.clone();
14187 - var n = "object" == typeof e ? e : {};
14188 - return n.date = t, n.args = arguments, new _(n);
14189 - };
14190 - var b = v;
14191 - b.l = w, b.i = S, b.w = function(t, e) {
14192 - return O(t, {
14193 - locale: e.$L,
14194 - utc: e.$u,
14195 - x: e.$x,
14196 - $offset: e.$offset
14197 - });
14198 - };
14199 - var _ = function() {
14200 - function M(t) {
14201 - this.$L = w(t.locale, null, !0), this.parse(t), this.$x = this.$x || t.x || {}, this[p] = !0;
14202 - }
14203 - var m = M.prototype;
14204 - return m.parse = function(t) {
14205 - this.$d = function(t) {
14206 - var e = t.date;
14207 - var n = t.utc;
14208 - if (null === e) return /* @__PURE__ */ new Date(NaN);
14209 - if (b.u(e)) return /* @__PURE__ */ new Date();
14210 - if (e instanceof Date) return new Date(e);
14211 - if ("string" == typeof e && !/Z$/i.test(e)) {
14212 - var r = e.match($);
14213 - if (r) {
14214 - var i = r[2] - 1 || 0;
14215 - var s = (r[7] || "0").substring(0, 3);
14216 - return n ? new Date(Date.UTC(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s)) : new Date(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s);
14217 - }
14218 - }
14219 - return new Date(e);
14220 - }(t), this.init();
14221 - }, m.init = function() {
14222 - var t = this.$d;
14223 - this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds();
14224 - }, m.$utils = function() {
14225 - return b;
14226 - }, m.isValid = function() {
14227 - return !(this.$d.toString() === l);
14228 - }, m.isSame = function(t, e) {
14229 - var n = O(t);
14230 - return this.startOf(e) <= n && n <= this.endOf(e);
14231 - }, m.isAfter = function(t, e) {
14232 - return O(t) < this.startOf(e);
14233 - }, m.isBefore = function(t, e) {
14234 - return this.endOf(e) < O(t);
14235 - }, m.$g = function(t, e, n) {
14236 - return b.u(t) ? this[e] : this.set(n, t);
14237 - }, m.unix = function() {
14238 - return Math.floor(this.valueOf() / 1e3);
14239 - }, m.valueOf = function() {
14240 - return this.$d.getTime();
14241 - }, m.startOf = function(t, e) {
14242 - var n = this;
14243 - var r = !!b.u(e) || e;
14244 - var f = b.p(t);
14245 - var l = function(t, e) {
14246 - var i = b.w(n.$u ? Date.UTC(n.$y, e, t) : new Date(n.$y, e, t), n);
14247 - return r ? i : i.endOf(a);
14248 - };
14249 - var $ = function(t, e) {
14250 - return b.w(n.toDate()[t].apply(n.toDate("s"), (r ? [
14251 - 0,
14252 - 0,
14253 - 0,
14254 - 0
14255 - ] : [
14256 - 23,
14257 - 59,
14258 - 59,
14259 - 999
14260 - ]).slice(e)), n);
14261 - };
14262 - var y = this.$W;
14263 - var M = this.$M;
14264 - var m = this.$D;
14265 - var v = "set" + (this.$u ? "UTC" : "");
14266 - switch (f) {
14267 - case h: return r ? l(1, 0) : l(31, 11);
14268 - case c: return r ? l(1, M) : l(0, M + 1);
14269 - case o:
14270 - var g = this.$locale().weekStart || 0;
14271 - var D = (y < g ? y + 7 : y) - g;
14272 - return l(r ? m - D : m + (6 - D), M);
14273 - case a:
14274 - case d: return $(v + "Hours", 0);
14275 - case u: return $(v + "Minutes", 1);
14276 - case s: return $(v + "Seconds", 2);
14277 - case i: return $(v + "Milliseconds", 3);
14278 - default: return this.clone();
14279 - }
14280 - }, m.endOf = function(t) {
14281 - return this.startOf(t, !1);
14282 - }, m.$set = function(t, e) {
14283 - var n;
14284 - var o = b.p(t);
14285 - var f = "set" + (this.$u ? "UTC" : "");
14286 - var l = (n = {}, n[a] = f + "Date", n[d] = f + "Date", n[c] = f + "Month", n[h] = f + "FullYear", n[u] = f + "Hours", n[s] = f + "Minutes", n[i] = f + "Seconds", n[r] = f + "Milliseconds", n)[o];
14287 - var $ = o === a ? this.$D + (e - this.$W) : e;
14288 - if (o === c || o === h) {
14289 - var y = this.clone().set(d, 1);
14290 - y.$d[l]($), y.init(), this.$d = y.set(d, Math.min(this.$D, y.daysInMonth())).$d;
14291 - } else l && this.$d[l]($);
14292 - return this.init(), this;
14293 - }, m.set = function(t, e) {
14294 - return this.clone().$set(t, e);
14295 - }, m.get = function(t) {
14296 - return this[b.p(t)]();
14297 - }, m.add = function(r, f) {
14298 - var d;
14299 - var l = this;
14300 - r = Number(r);
14301 - var $ = b.p(f);
14302 - var y = function(t) {
14303 - var e = O(l);
14304 - return b.w(e.date(e.date() + Math.round(t * r)), l);
14305 - };
14306 - if ($ === c) return this.set(c, this.$M + r);
14307 - if ($ === h) return this.set(h, this.$y + r);
14308 - if ($ === a) return y(1);
14309 - if ($ === o) return y(7);
14310 - var M = (d = {}, d[s] = e, d[u] = n, d[i] = t, d)[$] || 1;
14311 - var m = this.$d.getTime() + r * M;
14312 - return b.w(m, this);
14313 - }, m.subtract = function(t, e) {
14314 - return this.add(-1 * t, e);
14315 - }, m.format = function(t) {
14316 - var e = this;
14317 - var n = this.$locale();
14318 - if (!this.isValid()) return n.invalidDate || l;
14319 - var r = t || "YYYY-MM-DDTHH:mm:ssZ";
14320 - var i = b.z(this);
14321 - var s = this.$H;
14322 - var u = this.$m;
14323 - var a = this.$M;
14324 - var o = n.weekdays;
14325 - var c = n.months;
14326 - var f = n.meridiem;
14327 - var h = function(t, n, i, s) {
14328 - return t && (t[n] || t(e, r)) || i[n].slice(0, s);
14329 - };
14330 - var d = function(t) {
14331 - return b.s(s % 12 || 12, t, "0");
14332 - };
14333 - var $ = f || function(t, e, n) {
14334 - var r = t < 12 ? "AM" : "PM";
14335 - return n ? r.toLowerCase() : r;
14336 - };
14337 - return r.replace(y, (function(t, r) {
14338 - return r || function(t) {
14339 - switch (t) {
14340 - case "YY": return String(e.$y).slice(-2);
14341 - case "YYYY": return b.s(e.$y, 4, "0");
14342 - case "M": return a + 1;
14343 - case "MM": return b.s(a + 1, 2, "0");
14344 - case "MMM": return h(n.monthsShort, a, c, 3);
14345 - case "MMMM": return h(c, a);
14346 - case "D": return e.$D;
14347 - case "DD": return b.s(e.$D, 2, "0");
14348 - case "d": return String(e.$W);
14349 - case "dd": return h(n.weekdaysMin, e.$W, o, 2);
14350 - case "ddd": return h(n.weekdaysShort, e.$W, o, 3);
14351 - case "dddd": return o[e.$W];
14352 - case "H": return String(s);
14353 - case "HH": return b.s(s, 2, "0");
14354 - case "h": return d(1);
14355 - case "hh": return d(2);
14356 - case "a": return $(s, u, !0);
14357 - case "A": return $(s, u, !1);
14358 - case "m": return String(u);
14359 - case "mm": return b.s(u, 2, "0");
14360 - case "s": return String(e.$s);
14361 - case "ss": return b.s(e.$s, 2, "0");
14362 - case "SSS": return b.s(e.$ms, 3, "0");
14363 - case "Z": return i;
14364 - }
14365 - return null;
14366 - }(t) || i.replace(":", "");
14367 - }));
14368 - }, m.utcOffset = function() {
14369 - return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
14370 - }, m.diff = function(r, d, l) {
14371 - var $;
14372 - var y = this;
14373 - var M = b.p(d);
14374 - var m = O(r);
14375 - var v = (m.utcOffset() - this.utcOffset()) * e;
14376 - var g = this - m;
14377 - var D = function() {
14378 - return b.m(y, m);
14379 - };
14380 - switch (M) {
14381 - case h:
14382 - $ = D() / 12;
14383 - break;
14384 - case c:
14385 - $ = D();
14386 - break;
14387 - case f:
14388 - $ = D() / 3;
14389 - break;
14390 - case o:
14391 - $ = (g - v) / 6048e5;
14392 - break;
14393 - case a:
14394 - $ = (g - v) / 864e5;
14395 - break;
14396 - case u:
14397 - $ = g / n;
14398 - break;
14399 - case s:
14400 - $ = g / e;
14401 - break;
14402 - case i:
14403 - $ = g / t;
14404 - break;
14405 - default: $ = g;
14406 - }
14407 - return l ? $ : b.a($);
14408 - }, m.daysInMonth = function() {
14409 - return this.endOf(c).$D;
14410 - }, m.$locale = function() {
14411 - return D[this.$L];
14412 - }, m.locale = function(t, e) {
14413 - if (!t) return this.$L;
14414 - var n = this.clone();
14415 - var r = w(t, e, !0);
14416 - return r && (n.$L = r), n;
14417 - }, m.clone = function() {
14418 - return b.w(this.$d, this);
14419 - }, m.toDate = function() {
14420 - return new Date(this.valueOf());
14421 - }, m.toJSON = function() {
14422 - return this.isValid() ? this.toISOString() : null;
14423 - }, m.toISOString = function() {
14424 - return this.$d.toISOString();
14425 - }, m.toString = function() {
14426 - return this.$d.toUTCString();
14427 - }, M;
14428 - }();
14429 - var k = _.prototype;
14430 - return O.prototype = k, [
14431 - ["$ms", r],
14432 - ["$s", i],
14433 - ["$m", s],
14434 - ["$H", u],
14435 - ["$W", a],
14436 - ["$M", c],
14437 - ["$y", h],
14438 - ["$D", d]
14439 - ].forEach((function(t) {
14440 - k[t[1]] = function(e) {
14441 - return this.$g(e, t[0], t[1]);
14442 - };
14443 - })), O.extend = function(t, e) {
14444 - return t.$i || (t(e, _, O), t.$i = !0), O;
14445 - }, O.locale = w, O.isDayjs = S, O.unix = function(t) {
14446 - return O(1e3 * t);
14447 - }, O.en = D[g], O.Ls = D, O.p = {}, O;
14448 - }));
14449 - }));
14450 -
14451 -//#endregion
14452 -//#region packages/packages/libs/editor-controls/src/controls/date-time-control.tsx
14453 - var import_dayjs_min = /* @__PURE__ */ __toESM(require_dayjs_min());
14454 - var DATE_FORMAT$1 = "YYYY-MM-DD";
14455 - var TIME_FORMAT$1 = "HH:mm";
14456 - var DateTimeControl = createControl(({ inputDisabled }) => {
14457 - const { value, setValue, ...propContext } = useBoundProp(_elementor_editor_props.DateTimePropTypeUtil);
14458 - const handleChange = (newValue, meta) => {
14459 - const field = meta.bind;
14460 - const fieldValue = newValue[field];
14461 - if ((0, _elementor_editor_props.isTransformable)(fieldValue)) return setValue({
14462 - ...value,
14463 - [field]: fieldValue
14464 - });
14465 - let formattedValue = "";
14466 - if (fieldValue) {
14467 - const dayjsValue = fieldValue;
14468 - formattedValue = field === "date" ? dayjsValue.format(DATE_FORMAT$1) : dayjsValue.format(TIME_FORMAT$1);
14469 - }
14470 - setValue({
14471 - ...value,
14472 - [field]: {
14473 - $$type: "string",
14474 - value: formattedValue
14475 - }
14476 - });
14477 - };
14478 - const parseDateValue = (dateStr) => {
14479 - if (!dateStr) return null;
14480 - const d = import_dayjs_min.default(dateStr);
14481 - return d && typeof d.isValid === "function" && d.isValid() ? d : null;
14482 - };
14483 - const parseTimeValue = (timeStr) => {
14484 - if (!timeStr) return null;
14485 - const [hours, minutes] = timeStr.split(":");
14486 - const h = Number.parseInt(hours ?? "", 10);
14487 - const m = Number.parseInt(minutes ?? "", 10);
14488 - if (Number.isNaN(h) || Number.isNaN(m)) return null;
14489 - return import_dayjs_min.default().hour(h).minute(m).second(0).millisecond(0);
14490 - };
14491 - return /* @__PURE__ */ react.createElement(PropProvider, {
14492 - ...propContext,
14493 - value,
14494 - setValue
14495 - }, /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.LocalizationProvider, null, /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
14496 - display: "flex",
14497 - gap: 1,
14498 - alignItems: "center"
14499 - }, /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "date" }, /* @__PURE__ */ react.createElement(_elementor_ui.DatePicker, {
14500 - value: parseDateValue(_elementor_editor_props.stringPropTypeUtil.extract(value?.date)),
14501 - onChange: (v) => handleChange({ date: v }, { bind: "date" }),
14502 - disabled: inputDisabled,
14503 - slotProps: {
14504 - textField: { size: "tiny" },
14505 - openPickerButton: { size: "tiny" },
14506 - openPickerIcon: { fontSize: "tiny" }
14507 - }
14508 - })), /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "time" }, /* @__PURE__ */ react.createElement(_elementor_ui.TimePicker, {
14509 - value: parseTimeValue(_elementor_editor_props.stringPropTypeUtil.extract(value?.time)),
14510 - onChange: (v) => handleChange({ time: v }, { bind: "time" }),
14511 - disabled: inputDisabled,
14512 - slotProps: {
14513 - textField: { size: "tiny" },
14514 - openPickerButton: { size: "tiny" },
14515 - openPickerIcon: { fontSize: "tiny" }
14516 - }
14517 - }))))));
14518 - });
14519 -
14520 -//#endregion
14521 -//#region packages/packages/libs/editor-controls/src/utils/date-time.ts
14522 - var DATE_FORMAT = "YYYY-MM-DD";
14523 - var TIME_FORMAT = "HH:mm";
14524 - function isValidDayjs(value) {
14525 - return !!value && typeof value.isValid === "function" && value.isValid();
14526 - }
14527 - function parseDateString(raw) {
14528 - if (!raw) return null;
14529 - const parsed = import_dayjs_min.default(raw);
14530 - return isValidDayjs(parsed) ? parsed : null;
14531 - }
14532 - function parseTimeString(raw) {
14533 - if (!raw) return null;
14534 - const [hours, minutes, seconds] = raw.split(":");
14535 - const h = Number.parseInt(hours ?? "", 10);
14536 - const m = Number.parseInt(minutes ?? "", 10);
14537 - const s = Number.parseInt(seconds ?? "0", 10);
14538 - if (Number.isNaN(h) || Number.isNaN(m)) return null;
14539 - return import_dayjs_min.default().hour(h).minute(m).second(Number.isNaN(s) ? 0 : s).millisecond(0);
14540 - }
14541 -
14542 -//#endregion
14543 -//#region packages/packages/libs/editor-controls/src/controls/date-string-control.tsx
14544 - var DateStringControl = createControl(({ inputDisabled, ariaLabel, error, coerceInvalidToNull = false }) => {
14545 - const { value, setValue, disabled } = useBoundProp(_elementor_editor_props.dateStringPropTypeUtil);
14546 - const isDisabled = inputDisabled ?? disabled;
14547 - const slotProps = {
14548 - textField: {
14549 - size: "tiny",
14550 - fullWidth: true,
14551 - error,
14552 - inputProps: ariaLabel ? { "aria-label": ariaLabel } : void 0
14553 - },
14554 - openPickerButton: { size: "tiny" },
14555 - openPickerIcon: { fontSize: "tiny" }
14556 - };
14557 - const handleChange = (newValue, format) => {
14558 - if (!newValue) {
14559 - setValue(null);
14560 - return;
14561 - }
14562 - if (coerceInvalidToNull && !isValidDayjs(newValue)) {
14563 - setValue(null);
14564 - return;
14565 - }
14566 - setValue(newValue.format(format));
14567 - };
14568 - return /* @__PURE__ */ react.createElement(_elementor_ui.LocalizationProvider, null, /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.DatePicker, {
14569 - value: parseDateString(value ?? ""),
14570 - onChange: (newValue) => handleChange(newValue, DATE_FORMAT),
14571 - disabled: isDisabled,
14572 - slotProps
14573 - })));
14574 - });
14575 -
14576 -//#endregion
14577 -//#region packages/packages/libs/editor-controls/src/controls/date-range-control.tsx
14578 - var RANGE_LABELS$1 = {
14579 - min: (0, _wordpress_i18n.__)("Min date", "elementor"),
14580 - max: (0, _wordpress_i18n.__)("Max date", "elementor")
14581 - };
14582 - var isMaxBeforeMin = (minIso, maxIso) => {
14583 - if (!minIso || !maxIso) return false;
14584 - return maxIso < minIso;
14585 - };
14586 - var RANGE_ERROR_MESSAGE = (0, _wordpress_i18n.__)("Max date must be on or after Min date", "elementor");
14587 - var DateRangeControl = createControl(() => {
14588 - const { value, setValue, ...propContext } = useBoundProp(_elementor_editor_props.dateRangePropTypeUtil);
14589 - const minString = _elementor_editor_props.dateStringPropTypeUtil.extract(value?.min);
14590 - const maxString = _elementor_editor_props.dateStringPropTypeUtil.extract(value?.max);
14591 - const hasInvalidRange = isMaxBeforeMin(minString, maxString);
14592 - return /* @__PURE__ */ react.createElement(PropProvider, {
14593 - ...propContext,
14594 - value,
14595 - setValue
14596 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, { gap: .75 }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
14597 - direction: "row",
14598 - gap: 2,
14599 - flexWrap: "nowrap"
14600 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
14601 - container: true,
14602 - gap: .75,
14603 - alignItems: "center"
14604 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
14605 - item: true,
14606 - xs: 12
14607 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, RANGE_LABELS$1.min)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
14608 - item: true,
14609 - xs: 12
14610 - }, /* @__PURE__ */ react.createElement(BoundDateStringControl, {
14611 - bind: "min",
14612 - ariaLabel: RANGE_LABELS$1.min,
14613 - error: hasInvalidRange
14614 - }))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
14615 - container: true,
14616 - gap: .75,
14617 - alignItems: "center"
14618 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
14619 - item: true,
14620 - xs: 12
14621 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, RANGE_LABELS$1.max)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
14622 - item: true,
14623 - xs: 12
14624 - }, /* @__PURE__ */ react.createElement(BoundDateStringControl, {
14625 - bind: "max",
14626 - ariaLabel: RANGE_LABELS$1.max,
14627 - error: hasInvalidRange
14628 - })))), hasInvalidRange && /* @__PURE__ */ react.createElement(_elementor_ui.FormHelperText, { error: true }, RANGE_ERROR_MESSAGE)));
14629 - });
14630 - var BoundDateStringControl = ({ bind, ariaLabel, error }) => {
14631 - return /* @__PURE__ */ react.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ react.createElement(DateStringControl, {
14632 - ariaLabel,
14633 - error,
14634 - coerceInvalidToNull: true
14635 - }));
14636 - };
14637 -
14638 -//#endregion
14639 -//#region packages/packages/libs/editor-controls/src/controls/time-string-control.tsx
14640 - var TimeStringControl = createControl(({ inputDisabled, ariaLabel, error, coerceInvalidToNull = false }) => {
14641 - const { value, setValue, disabled } = useBoundProp(_elementor_editor_props.timeStringPropTypeUtil);
14642 - const isDisabled = inputDisabled ?? disabled;
14643 - const slotProps = {
14644 - textField: {
14645 - size: "tiny",
14646 - fullWidth: true,
14647 - error,
14648 - inputProps: ariaLabel ? { "aria-label": ariaLabel } : void 0
14649 - },
14650 - openPickerButton: { size: "tiny" },
14651 - openPickerIcon: { fontSize: "tiny" }
14652 - };
14653 - const handleChange = (newValue, format) => {
14654 - if (!newValue) {
14655 - setValue(null);
14656 - return;
14657 - }
14658 - if (coerceInvalidToNull && !isValidDayjs(newValue)) {
14659 - setValue(null);
14660 - return;
14661 - }
14662 - setValue(newValue.format(format));
14663 - };
14664 - return /* @__PURE__ */ react.createElement(_elementor_ui.LocalizationProvider, null, /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.TimePicker, {
14665 - value: parseTimeString(value ?? ""),
14666 - onChange: (newValue) => handleChange(newValue, TIME_FORMAT),
14667 - disabled: isDisabled,
14668 - slotProps
14669 - })));
14670 - });
14671 -
14672 -//#endregion
14673 -//#region packages/packages/libs/editor-controls/src/controls/time-range-control.tsx
14674 - var RANGE_LABELS = {
14675 - min: (0, _wordpress_i18n.__)("Start time", "elementor"),
14676 - max: (0, _wordpress_i18n.__)("End time", "elementor")
14677 - };
14678 - var TimeRangeControl = createControl(() => {
14679 - const { value, setValue, ...propContext } = useBoundProp(_elementor_editor_props.timeRangePropTypeUtil);
14680 - return /* @__PURE__ */ react.createElement(PropProvider, {
14681 - ...propContext,
14682 - value,
14683 - setValue
14684 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
14685 - direction: "row",
14686 - gap: 2,
14687 - flexWrap: "nowrap"
14688 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
14689 - container: true,
14690 - gap: .75,
14691 - alignItems: "center"
14692 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
14693 - item: true,
14694 - xs: 12
14695 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, RANGE_LABELS.min)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
14696 - item: true,
14697 - xs: 12
14698 - }, /* @__PURE__ */ react.createElement(BoundTimeStringControl, {
14699 - bind: "min",
14700 - ariaLabel: RANGE_LABELS.min
14701 - }))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
14702 - container: true,
14703 - gap: .75,
14704 - alignItems: "center"
14705 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
14706 - item: true,
14707 - xs: 12
14708 - }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, RANGE_LABELS.max)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
14709 - item: true,
14710 - xs: 12
14711 - }, /* @__PURE__ */ react.createElement(BoundTimeStringControl, {
14712 - bind: "max",
14713 - ariaLabel: RANGE_LABELS.max
14714 - })))));
14715 - });
14716 - var BoundTimeStringControl = ({ bind, ariaLabel }) => {
14717 - return /* @__PURE__ */ react.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ react.createElement(TimeStringControl, {
14718 - ariaLabel,
14719 - coerceInvalidToNull: true
14720 - }));
14721 - };
14722 -
14723 -//#endregion
14724 -//#region node_modules/orderedmap/dist/index.js
14725 - function OrderedMap(content) {
14726 - this.content = content;
14727 - }
14728 - OrderedMap.prototype = {
14729 - constructor: OrderedMap,
14730 - find: function(key) {
14731 - for (var i = 0; i < this.content.length; i += 2) if (this.content[i] === key) return i;
14732 - return -1;
14733 - },
14734 - get: function(key) {
14735 - var found = this.find(key);
14736 - return found == -1 ? void 0 : this.content[found + 1];
14737 - },
14738 - update: function(key, value, newKey) {
14739 - var self = newKey && newKey != key ? this.remove(newKey) : this;
14740 - var found = self.find(key);
14741 - var content = self.content.slice();
14742 - if (found == -1) content.push(newKey || key, value);
14743 - else {
14744 - content[found + 1] = value;
14745 - if (newKey) content[found] = newKey;
14746 - }
14747 - return new OrderedMap(content);
14748 - },
14749 - remove: function(key) {
14750 - var found = this.find(key);
14751 - if (found == -1) return this;
14752 - var content = this.content.slice();
14753 - content.splice(found, 2);
14754 - return new OrderedMap(content);
14755 - },
14756 - addToStart: function(key, value) {
14757 - return new OrderedMap([key, value].concat(this.remove(key).content));
14758 - },
14759 - addToEnd: function(key, value) {
14760 - var content = this.remove(key).content.slice();
14761 - content.push(key, value);
14762 - return new OrderedMap(content);
14763 - },
14764 - addBefore: function(place, key, value) {
14765 - var without = this.remove(key);
14766 - var content = without.content.slice();
14767 - var found = without.find(place);
14768 - content.splice(found == -1 ? content.length : found, 0, key, value);
14769 - return new OrderedMap(content);
14770 - },
14771 - forEach: function(f) {
14772 - for (var i = 0; i < this.content.length; i += 2) f(this.content[i], this.content[i + 1]);
14773 - },
14774 - prepend: function(map) {
14775 - map = OrderedMap.from(map);
14776 - if (!map.size) return this;
14777 - return new OrderedMap(map.content.concat(this.subtract(map).content));
14778 - },
14779 - append: function(map) {
14780 - map = OrderedMap.from(map);
14781 - if (!map.size) return this;
14782 - return new OrderedMap(this.subtract(map).content.concat(map.content));
14783 - },
14784 - subtract: function(map) {
14785 - var result = this;
14786 - map = OrderedMap.from(map);
14787 - for (var i = 0; i < map.content.length; i += 2) result = result.remove(map.content[i]);
14788 - return result;
14789 - },
14790 - toObject: function() {
14791 - var result = {};
14792 - this.forEach(function(key, value) {
14793 - result[key] = value;
14794 - });
14795 - return result;
14796 - },
14797 - get size() {
14798 - return this.content.length >> 1;
14799 - }
14800 - };
14801 - OrderedMap.from = function(value) {
14802 - if (value instanceof OrderedMap) return value;
14803 - var content = [];
14804 - if (value) for (var prop in value) content.push(prop, value[prop]);
14805 - return new OrderedMap(content);
14806 - };
14807 -
14808 -//#endregion
14809 -//#region node_modules/prosemirror-model/dist/index.js
14810 - function findDiffStart(a, b, pos) {
14811 - for (let i = 0;; i++) {
14812 - if (i == a.childCount || i == b.childCount) return a.childCount == b.childCount ? null : pos;
14813 - let childA = a.child(i);
14814 - let childB = b.child(i);
14815 - if (childA == childB) {
14816 - pos += childA.nodeSize;
14817 - continue;
14818 - }
14819 - if (!childA.sameMarkup(childB)) return pos;
14820 - if (childA.isText && childA.text != childB.text) {
14821 - for (let j = 0; childA.text[j] == childB.text[j]; j++) pos++;
14822 - return pos;
14823 - }
14824 - if (childA.content.size || childB.content.size) {
14825 - let inner = findDiffStart(childA.content, childB.content, pos + 1);
14826 - if (inner != null) return inner;
14827 - }
14828 - pos += childA.nodeSize;
14829 - }
14830 - }
14831 - function findDiffEnd(a, b, posA, posB) {
14832 - for (let iA = a.childCount, iB = b.childCount;;) {
14833 - if (iA == 0 || iB == 0) return iA == iB ? null : {
14834 - a: posA,
14835 - b: posB
14836 - };
14837 - let childA = a.child(--iA);
14838 - let childB = b.child(--iB);
14839 - let size = childA.nodeSize;
14840 - if (childA == childB) {
14841 - posA -= size;
14842 - posB -= size;
14843 - continue;
14844 - }
14845 - if (!childA.sameMarkup(childB)) return {
14846 - a: posA,
14847 - b: posB
14848 - };
14849 - if (childA.isText && childA.text != childB.text) {
14850 - let same = 0;
14851 - let minSize = Math.min(childA.text.length, childB.text.length);
14852 - while (same < minSize && childA.text[childA.text.length - same - 1] == childB.text[childB.text.length - same - 1]) {
14853 - same++;
14854 - posA--;
14855 - posB--;
14856 - }
14857 - return {
14858 - a: posA,
14859 - b: posB
14860 - };
14861 - }
14862 - if (childA.content.size || childB.content.size) {
14863 - let inner = findDiffEnd(childA.content, childB.content, posA - 1, posB - 1);
14864 - if (inner) return inner;
14865 - }
14866 - posA -= size;
14867 - posB -= size;
14868 - }
14869 - }
14870 - /**
14871 - A fragment represents a node's collection of child nodes.
14872 -
14873 - Like nodes, fragments are persistent data structures, and you
14874 - should not mutate them or their content. Rather, you create new
14875 - instances whenever needed. The API tries to make this easy.
14876 - */
14877 - var Fragment$1 = class Fragment$1 {
14878 - static {
14879 - __name(this, "Fragment");
14880 - }
14881 - /**
14882 - @internal
14883 - */
14884 - constructor(content, size) {
14885 - this.content = content;
14886 - this.size = size || 0;
14887 - if (size == null) for (let i = 0; i < content.length; i++) this.size += content[i].nodeSize;
14888 - }
14889 - /**
14890 - Invoke a callback for all descendant nodes between the given two
14891 - positions (relative to start of this fragment). Doesn't descend
14892 - into a node when the callback returns `false`.
14893 - */
14894 - nodesBetween(from, to, f, nodeStart = 0, parent) {
14895 - for (let i = 0, pos = 0; pos < to; i++) {
14896 - let child = this.content[i];
14897 - let end = pos + child.nodeSize;
14898 - if (end > from && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {
14899 - let start = pos + 1;
14900 - child.nodesBetween(Math.max(0, from - start), Math.min(child.content.size, to - start), f, nodeStart + start);
14901 - }
14902 - pos = end;
14903 - }
14904 - }
14905 - /**
14906 - Call the given callback for every descendant node. `pos` will be
14907 - relative to the start of the fragment. The callback may return
14908 - `false` to prevent traversal of a given node's children.
14909 - */
14910 - descendants(f) {
14911 - this.nodesBetween(0, this.size, f);
14912 - }
14913 - /**
14914 - Extract the text between `from` and `to`. See the same method on
14915 - [`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).
14916 - */
14917 - textBetween(from, to, blockSeparator, leafText) {
14918 - let text = "";
14919 - let first = true;
14920 - this.nodesBetween(from, to, (node, pos) => {
14921 - let nodeText = node.isText ? node.text.slice(Math.max(from, pos) - pos, to - pos) : !node.isLeaf ? "" : leafText ? typeof leafText === "function" ? leafText(node) : leafText : node.type.spec.leafText ? node.type.spec.leafText(node) : "";
14922 - if (node.isBlock && (node.isLeaf && nodeText || node.isTextblock) && blockSeparator) if (first) first = false;
14923 - else text += blockSeparator;
14924 - text += nodeText;
14925 - }, 0);
14926 - return text;
14927 - }
14928 - /**
14929 - Create a new fragment containing the combined content of this
14930 - fragment and the other.
14931 - */
14932 - append(other) {
14933 - if (!other.size) return this;
14934 - if (!this.size) return other;
14935 - let last = this.lastChild;
14936 - let first = other.firstChild;
14937 - let content = this.content.slice();
14938 - let i = 0;
14939 - if (last.isText && last.sameMarkup(first)) {
14940 - content[content.length - 1] = last.withText(last.text + first.text);
14941 - i = 1;
14942 - }
14943 - for (; i < other.content.length; i++) content.push(other.content[i]);
14944 - return new Fragment$1(content, this.size + other.size);
14945 - }
14946 - /**
14947 - Cut out the sub-fragment between the two given positions.
14948 - */
14949 - cut(from, to = this.size) {
14950 - if (from == 0 && to == this.size) return this;
14951 - let result = [];
14952 - let size = 0;
14953 - if (to > from) for (let i = 0, pos = 0; pos < to; i++) {
14954 - let child = this.content[i];
14955 - let end = pos + child.nodeSize;
14956 - if (end > from) {
14957 - if (pos < from || end > to) if (child.isText) child = child.cut(Math.max(0, from - pos), Math.min(child.text.length, to - pos));
14958 - else child = child.cut(Math.max(0, from - pos - 1), Math.min(child.content.size, to - pos - 1));
14959 - result.push(child);
14960 - size += child.nodeSize;
14961 - }
14962 - pos = end;
14963 - }
14964 - return new Fragment$1(result, size);
14965 - }
14966 - /**
14967 - @internal
14968 - */
14969 - cutByIndex(from, to) {
14970 - if (from == to) return Fragment$1.empty;
14971 - if (from == 0 && to == this.content.length) return this;
14972 - return new Fragment$1(this.content.slice(from, to));
14973 - }
14974 - /**
14975 - Create a new fragment in which the node at the given index is
14976 - replaced by the given node.
14977 - */
14978 - replaceChild(index, node) {
14979 - let current = this.content[index];
14980 - if (current == node) return this;
14981 - let copy = this.content.slice();
14982 - let size = this.size + node.nodeSize - current.nodeSize;
14983 - copy[index] = node;
14984 - return new Fragment$1(copy, size);
14985 - }
14986 - /**
14987 - Create a new fragment by prepending the given node to this
14988 - fragment.
14989 - */
14990 - addToStart(node) {
14991 - return new Fragment$1([node].concat(this.content), this.size + node.nodeSize);
14992 - }
14993 - /**
14994 - Create a new fragment by appending the given node to this
14995 - fragment.
14996 - */
14997 - addToEnd(node) {
14998 - return new Fragment$1(this.content.concat(node), this.size + node.nodeSize);
14999 - }
15000 - /**
15001 - Compare this fragment to another one.
15002 - */
15003 - eq(other) {
15004 - if (this.content.length != other.content.length) return false;
15005 - for (let i = 0; i < this.content.length; i++) if (!this.content[i].eq(other.content[i])) return false;
15006 - return true;
15007 - }
15008 - /**
15009 - The first child of the fragment, or `null` if it is empty.
15010 - */
15011 - get firstChild() {
15012 - return this.content.length ? this.content[0] : null;
15013 - }
15014 - /**
15015 - The last child of the fragment, or `null` if it is empty.
15016 - */
15017 - get lastChild() {
15018 - return this.content.length ? this.content[this.content.length - 1] : null;
15019 - }
15020 - /**
15021 - The number of child nodes in this fragment.
15022 - */
15023 - get childCount() {
15024 - return this.content.length;
15025 - }
15026 - /**
15027 - Get the child node at the given index. Raise an error when the
15028 - index is out of range.
15029 - */
15030 - child(index) {
15031 - let found = this.content[index];
15032 - if (!found) throw new RangeError("Index " + index + " out of range for " + this);
15033 - return found;
15034 - }
15035 - /**
15036 - Get the child node at the given index, if it exists.
15037 - */
15038 - maybeChild(index) {
15039 - return this.content[index] || null;
15040 - }
15041 - /**
15042 - Call `f` for every child node, passing the node, its offset
15043 - into this parent node, and its index.
15044 - */
15045 - forEach(f) {
15046 - for (let i = 0, p = 0; i < this.content.length; i++) {
15047 - let child = this.content[i];
15048 - f(child, p, i);
15049 - p += child.nodeSize;
15050 - }
15051 - }
15052 - /**
15053 - Find the first position at which this fragment and another
15054 - fragment differ, or `null` if they are the same.
15055 - */
15056 - findDiffStart(other, pos = 0) {
15057 - return findDiffStart(this, other, pos);
15058 - }
15059 - /**
15060 - Find the first position, searching from the end, at which this
15061 - fragment and the given fragment differ, or `null` if they are
15062 - the same. Since this position will not be the same in both
15063 - nodes, an object with two separate positions is returned.
15064 - */
15065 - findDiffEnd(other, pos = this.size, otherPos = other.size) {
15066 - return findDiffEnd(this, other, pos, otherPos);
15067 - }
15068 - /**
15069 - Find the index and inner offset corresponding to a given relative
15070 - position in this fragment. The result object will be reused
15071 - (overwritten) the next time the function is called. @internal
15072 - */
15073 - findIndex(pos) {
15074 - if (pos == 0) return retIndex(0, pos);
15075 - if (pos == this.size) return retIndex(this.content.length, pos);
15076 - if (pos > this.size || pos < 0) throw new RangeError(`Position ${pos} outside of fragment (${this})`);
15077 - for (let i = 0, curPos = 0;; i++) {
15078 - let cur = this.child(i);
15079 - let end = curPos + cur.nodeSize;
15080 - if (end >= pos) {
15081 - if (end == pos) return retIndex(i + 1, end);
15082 - return retIndex(i, curPos);
15083 - }
15084 - curPos = end;
15085 - }
15086 - }
15087 - /**
15088 - Return a debugging string that describes this fragment.
15089 - */
15090 - toString() {
15091 - return "<" + this.toStringInner() + ">";
15092 - }
15093 - /**
15094 - @internal
15095 - */
15096 - toStringInner() {
15097 - return this.content.join(", ");
15098 - }
15099 - /**
15100 - Create a JSON-serializeable representation of this fragment.
15101 - */
15102 - toJSON() {
15103 - return this.content.length ? this.content.map((n) => n.toJSON()) : null;
15104 - }
15105 - /**
15106 - Deserialize a fragment from its JSON representation.
15107 - */
15108 - static fromJSON(schema, value) {
15109 - if (!value) return Fragment$1.empty;
15110 - if (!Array.isArray(value)) throw new RangeError("Invalid input for Fragment.fromJSON");
15111 - return new Fragment$1(value.map(schema.nodeFromJSON));
15112 - }
15113 - /**
15114 - Build a fragment from an array of nodes. Ensures that adjacent
15115 - text nodes with the same marks are joined together.
15116 - */
15117 - static fromArray(array) {
15118 - if (!array.length) return Fragment$1.empty;
15119 - let joined;
15120 - let size = 0;
15121 - for (let i = 0; i < array.length; i++) {
15122 - let node = array[i];
15123 - size += node.nodeSize;
15124 - if (i && node.isText && array[i - 1].sameMarkup(node)) {
15125 - if (!joined) joined = array.slice(0, i);
15126 - joined[joined.length - 1] = node.withText(joined[joined.length - 1].text + node.text);
15127 - } else if (joined) joined.push(node);
15128 - }
15129 - return new Fragment$1(joined || array, size);
15130 - }
15131 - /**
15132 - Create a fragment from something that can be interpreted as a
15133 - set of nodes. For `null`, it returns the empty fragment. For a
15134 - fragment, the fragment itself. For a node or array of nodes, a
15135 - fragment containing those nodes.
15136 - */
15137 - static from(nodes) {
15138 - if (!nodes) return Fragment$1.empty;
15139 - if (nodes instanceof Fragment$1) return nodes;
15140 - if (Array.isArray(nodes)) return this.fromArray(nodes);
15141 - if (nodes.attrs) return new Fragment$1([nodes], nodes.nodeSize);
15142 - throw new RangeError("Can not convert " + nodes + " to a Fragment" + (nodes.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
15143 - }
15144 - };
15145 - /**
15146 - An empty fragment. Intended to be reused whenever a node doesn't
15147 - contain anything (rather than allocating a new empty fragment for
15148 - each leaf node).
15149 - */
15150 - Fragment$1.empty = new Fragment$1([], 0);
15151 - var found = {
15152 - index: 0,
15153 - offset: 0
15154 - };
15155 - function retIndex(index, offset) {
15156 - found.index = index;
15157 - found.offset = offset;
15158 - return found;
15159 - }
15160 - function compareDeep(a, b) {
15161 - if (a === b) return true;
15162 - if (!(a && typeof a == "object") || !(b && typeof b == "object")) return false;
15163 - let array = Array.isArray(a);
15164 - if (Array.isArray(b) != array) return false;
15165 - if (array) {
15166 - if (a.length != b.length) return false;
15167 - for (let i = 0; i < a.length; i++) if (!compareDeep(a[i], b[i])) return false;
15168 - } else {
15169 - for (let p in a) if (!(p in b) || !compareDeep(a[p], b[p])) return false;
15170 - for (let p in b) if (!(p in a)) return false;
15171 - }
15172 - return true;
15173 - }
15174 - /**
15175 - A mark is a piece of information that can be attached to a node,
15176 - such as it being emphasized, in code font, or a link. It has a
15177 - type and optionally a set of attributes that provide further
15178 - information (such as the target of the link). Marks are created
15179 - through a `Schema`, which controls which types exist and which
15180 - attributes they have.
15181 - */
15182 - var Mark$1 = class Mark$1 {
15183 - static {
15184 - __name(this, "Mark");
15185 - }
15186 - /**
15187 - @internal
15188 - */
15189 - constructor(type, attrs) {
15190 - this.type = type;
15191 - this.attrs = attrs;
15192 - }
15193 - /**
15194 - Given a set of marks, create a new set which contains this one as
15195 - well, in the right position. If this mark is already in the set,
15196 - the set itself is returned. If any marks that are set to be
15197 - [exclusive](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) with this mark are present,
15198 - those are replaced by this one.
15199 - */
15200 - addToSet(set) {
15201 - let copy;
15202 - let placed = false;
15203 - for (let i = 0; i < set.length; i++) {
15204 - let other = set[i];
15205 - if (this.eq(other)) return set;
15206 - if (this.type.excludes(other.type)) {
15207 - if (!copy) copy = set.slice(0, i);
15208 - } else if (other.type.excludes(this.type)) return set;
15209 - else {
15210 - if (!placed && other.type.rank > this.type.rank) {
15211 - if (!copy) copy = set.slice(0, i);
15212 - copy.push(this);
15213 - placed = true;
15214 - }
15215 - if (copy) copy.push(other);
15216 - }
15217 - }
15218 - if (!copy) copy = set.slice();
15219 - if (!placed) copy.push(this);
15220 - return copy;
15221 - }
15222 - /**
15223 - Remove this mark from the given set, returning a new set. If this
15224 - mark is not in the set, the set itself is returned.
15225 - */
15226 - removeFromSet(set) {
15227 - for (let i = 0; i < set.length; i++) if (this.eq(set[i])) return set.slice(0, i).concat(set.slice(i + 1));
15228 - return set;
15229 - }
15230 - /**
15231 - Test whether this mark is in the given set of marks.
15232 - */
15233 - isInSet(set) {
15234 - for (let i = 0; i < set.length; i++) if (this.eq(set[i])) return true;
15235 - return false;
15236 - }
15237 - /**
15238 - Test whether this mark has the same type and attributes as
15239 - another mark.
15240 - */
15241 - eq(other) {
15242 - return this == other || this.type == other.type && compareDeep(this.attrs, other.attrs);
15243 - }
15244 - /**
15245 - Convert this mark to a JSON-serializeable representation.
15246 - */
15247 - toJSON() {
15248 - let obj = { type: this.type.name };
15249 - for (let _ in this.attrs) {
15250 - obj.attrs = this.attrs;
15251 - break;
15252 - }
15253 - return obj;
15254 - }
15255 - /**
15256 - Deserialize a mark from JSON.
15257 - */
15258 - static fromJSON(schema, json) {
15259 - if (!json) throw new RangeError("Invalid input for Mark.fromJSON");
15260 - let type = schema.marks[json.type];
15261 - if (!type) throw new RangeError(`There is no mark type ${json.type} in this schema`);
15262 - let mark = type.create(json.attrs);
15263 - type.checkAttrs(mark.attrs);
15264 - return mark;
15265 - }
15266 - /**
15267 - Test whether two sets of marks are identical.
15268 - */
15269 - static sameSet(a, b) {
15270 - if (a == b) return true;
15271 - if (a.length != b.length) return false;
15272 - for (let i = 0; i < a.length; i++) if (!a[i].eq(b[i])) return false;
15273 - return true;
15274 - }
15275 - /**
15276 - Create a properly sorted mark set from null, a single mark, or an
15277 - unsorted array of marks.
15278 - */
15279 - static setFrom(marks) {
15280 - if (!marks || Array.isArray(marks) && marks.length == 0) return Mark$1.none;
15281 - if (marks instanceof Mark$1) return [marks];
15282 - let copy = marks.slice();
15283 - copy.sort((a, b) => a.type.rank - b.type.rank);
15284 - return copy;
15285 - }
15286 - };
15287 - /**
15288 - The empty set of marks.
15289 - */
15290 - Mark$1.none = [];
15291 - /**
15292 - Error type raised by [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) when
15293 - given an invalid replacement.
15294 - */
15295 - var ReplaceError = class extends Error {};
15296 - /**
15297 - A slice represents a piece cut out of a larger document. It
15298 - stores not only a fragment, but also the depth up to which nodes on
15299 - both side are ‘open’ (cut through).
15300 - */
15301 - var Slice = class Slice {
15302 - /**
15303 - Create a slice. When specifying a non-zero open depth, you must
15304 - make sure that there are nodes of at least that depth at the
15305 - appropriate side of the fragment—i.e. if the fragment is an
15306 - empty paragraph node, `openStart` and `openEnd` can't be greater
15307 - than 1.
15308 -
15309 - It is not necessary for the content of open nodes to conform to
15310 - the schema's content constraints, though it should be a valid
15311 - start/end/middle for such a node, depending on which sides are
15312 - open.
15313 - */
15314 - constructor(content, openStart, openEnd) {
15315 - this.content = content;
15316 - this.openStart = openStart;
15317 - this.openEnd = openEnd;
15318 - }
15319 - /**
15320 - The size this slice would add when inserted into a document.
15321 - */
15322 - get size() {
15323 - return this.content.size - this.openStart - this.openEnd;
15324 - }
15325 - /**
15326 - @internal
15327 - */
15328 - insertAt(pos, fragment) {
15329 - let content = insertInto(this.content, pos + this.openStart, fragment);
15330 - return content && new Slice(content, this.openStart, this.openEnd);
15331 - }
15332 - /**
15333 - @internal
15334 - */
15335 - removeBetween(from, to) {
15336 - return new Slice(removeRange(this.content, from + this.openStart, to + this.openStart), this.openStart, this.openEnd);
15337 - }
15338 - /**
15339 - Tests whether this slice is equal to another slice.
15340 - */
15341 - eq(other) {
15342 - return this.content.eq(other.content) && this.openStart == other.openStart && this.openEnd == other.openEnd;
15343 - }
15344 - /**
15345 - @internal
15346 - */
15347 - toString() {
15348 - return this.content + "(" + this.openStart + "," + this.openEnd + ")";
15349 - }
15350 - /**
15351 - Convert a slice to a JSON-serializable representation.
15352 - */
15353 - toJSON() {
15354 - if (!this.content.size) return null;
15355 - let json = { content: this.content.toJSON() };
15356 - if (this.openStart > 0) json.openStart = this.openStart;
15357 - if (this.openEnd > 0) json.openEnd = this.openEnd;
15358 - return json;
15359 - }
15360 - /**
15361 - Deserialize a slice from its JSON representation.
15362 - */
15363 - static fromJSON(schema, json) {
15364 - if (!json) return Slice.empty;
15365 - let openStart = json.openStart || 0;
15366 - let openEnd = json.openEnd || 0;
15367 - if (typeof openStart != "number" || typeof openEnd != "number") throw new RangeError("Invalid input for Slice.fromJSON");
15368 - return new Slice(Fragment$1.fromJSON(schema, json.content), openStart, openEnd);
15369 - }
15370 - /**
15371 - Create a slice from a fragment by taking the maximum possible
15372 - open value on both side of the fragment.
15373 - */
15374 - static maxOpen(fragment, openIsolating = true) {
15375 - let openStart = 0;
15376 - let openEnd = 0;
15377 - for (let n = fragment.firstChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.firstChild) openStart++;
15378 - for (let n = fragment.lastChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.lastChild) openEnd++;
15379 - return new Slice(fragment, openStart, openEnd);
15380 - }
15381 - };
15382 - /**
15383 - The empty slice.
15384 - */
15385 - Slice.empty = new Slice(Fragment$1.empty, 0, 0);
15386 - function removeRange(content, from, to) {
15387 - let { index, offset } = content.findIndex(from), child = content.maybeChild(index);
15388 - let { index: indexTo, offset: offsetTo } = content.findIndex(to);
15389 - if (offset == from || child.isText) {
15390 - if (offsetTo != to && !content.child(indexTo).isText) throw new RangeError("Removing non-flat range");
15391 - return content.cut(0, from).append(content.cut(to));
15392 - }
15393 - if (index != indexTo) throw new RangeError("Removing non-flat range");
15394 - return content.replaceChild(index, child.copy(removeRange(child.content, from - offset - 1, to - offset - 1)));
15395 - }
15396 - function insertInto(content, dist, insert, parent) {
15397 - let { index, offset } = content.findIndex(dist), child = content.maybeChild(index);
15398 - if (offset == dist || child.isText) {
15399 - if (parent && !parent.canReplace(index, index, insert)) return null;
15400 - return content.cut(0, dist).append(insert).append(content.cut(dist));
15401 - }
15402 - let inner = insertInto(child.content, dist - offset - 1, insert, child);
15403 - return inner && content.replaceChild(index, child.copy(inner));
15404 - }
15405 - function replace($from, $to, slice) {
15406 - if (slice.openStart > $from.depth) throw new ReplaceError("Inserted content deeper than insertion position");
15407 - if ($from.depth - slice.openStart != $to.depth - slice.openEnd) throw new ReplaceError("Inconsistent open depths");
15408 - return replaceOuter($from, $to, slice, 0);
15409 - }
15410 - function replaceOuter($from, $to, slice, depth) {
15411 - let index = $from.index(depth);
15412 - let node = $from.node(depth);
15413 - if (index == $to.index(depth) && depth < $from.depth - slice.openStart) {
15414 - let inner = replaceOuter($from, $to, slice, depth + 1);
15415 - return node.copy(node.content.replaceChild(index, inner));
15416 - } else if (!slice.content.size) return close(node, replaceTwoWay($from, $to, depth));
15417 - else if (!slice.openStart && !slice.openEnd && $from.depth == depth && $to.depth == depth) {
15418 - let parent = $from.parent;
15419 - let content = parent.content;
15420 - return close(parent, content.cut(0, $from.parentOffset).append(slice.content).append(content.cut($to.parentOffset)));
15421 - } else {
15422 - let { start, end } = prepareSliceForReplace(slice, $from);
15423 - return close(node, replaceThreeWay($from, start, end, $to, depth));
15424 - }
15425 - }
15426 - function checkJoin(main, sub) {
15427 - if (!sub.type.compatibleContent(main.type)) throw new ReplaceError("Cannot join " + sub.type.name + " onto " + main.type.name);
15428 - }
15429 - function joinable$1($before, $after, depth) {
15430 - let node = $before.node(depth);
15431 - checkJoin(node, $after.node(depth));
15432 - return node;
15433 - }
15434 - __name(joinable$1, "joinable");
15435 - function addNode(child, target) {
15436 - let last = target.length - 1;
15437 - if (last >= 0 && child.isText && child.sameMarkup(target[last])) target[last] = child.withText(target[last].text + child.text);
15438 - else target.push(child);
15439 - }
15440 - function addRange($start, $end, depth, target) {
15441 - let node = ($end || $start).node(depth);
15442 - let startIndex = 0;
15443 - let endIndex = $end ? $end.index(depth) : node.childCount;
15444 - if ($start) {
15445 - startIndex = $start.index(depth);
15446 - if ($start.depth > depth) startIndex++;
15447 - else if ($start.textOffset) {
15448 - addNode($start.nodeAfter, target);
15449 - startIndex++;
15450 - }
15451 - }
15452 - for (let i = startIndex; i < endIndex; i++) addNode(node.child(i), target);
15453 - if ($end && $end.depth == depth && $end.textOffset) addNode($end.nodeBefore, target);
15454 - }
15455 - function close(node, content) {
15456 - node.type.checkContent(content);
15457 - return node.copy(content);
15458 - }
15459 - function replaceThreeWay($from, $start, $end, $to, depth) {
15460 - let openStart = $from.depth > depth && joinable$1($from, $start, depth + 1);
15461 - let openEnd = $to.depth > depth && joinable$1($end, $to, depth + 1);
15462 - let content = [];
15463 - addRange(null, $from, depth, content);
15464 - if (openStart && openEnd && $start.index(depth) == $end.index(depth)) {
15465 - checkJoin(openStart, openEnd);
15466 - addNode(close(openStart, replaceThreeWay($from, $start, $end, $to, depth + 1)), content);
15467 - } else {
15468 - if (openStart) addNode(close(openStart, replaceTwoWay($from, $start, depth + 1)), content);
15469 - addRange($start, $end, depth, content);
15470 - if (openEnd) addNode(close(openEnd, replaceTwoWay($end, $to, depth + 1)), content);
15471 - }
15472 - addRange($to, null, depth, content);
15473 - return new Fragment$1(content);
15474 - }
15475 - function replaceTwoWay($from, $to, depth) {
15476 - let content = [];
15477 - addRange(null, $from, depth, content);
15478 - if ($from.depth > depth) addNode(close(joinable$1($from, $to, depth + 1), replaceTwoWay($from, $to, depth + 1)), content);
15479 - addRange($to, null, depth, content);
15480 - return new Fragment$1(content);
15481 - }
15482 - function prepareSliceForReplace(slice, $along) {
15483 - let extra = $along.depth - slice.openStart;
15484 - let node = $along.node(extra).copy(slice.content);
15485 - for (let i = extra - 1; i >= 0; i--) node = $along.node(i).copy(Fragment$1.from(node));
15486 - return {
15487 - start: node.resolveNoCache(slice.openStart + extra),
15488 - end: node.resolveNoCache(node.content.size - slice.openEnd - extra)
15489 - };
15490 - }
15491 - /**
15492 - You can [_resolve_](https://prosemirror.net/docs/ref/#model.Node.resolve) a position to get more
15493 - information about it. Objects of this class represent such a
15494 - resolved position, providing various pieces of context
15495 - information, and some helper methods.
15496 -
15497 - Throughout this interface, methods that take an optional `depth`
15498 - parameter will interpret undefined as `this.depth` and negative
15499 - numbers as `this.depth + value`.
15500 - */
15501 - var ResolvedPos = class ResolvedPos {
15502 - /**
15503 - @internal
15504 - */
15505 - constructor(pos, path, parentOffset) {
15506 - this.pos = pos;
15507 - this.path = path;
15508 - this.parentOffset = parentOffset;
15509 - this.depth = path.length / 3 - 1;
15510 - }
15511 - /**
15512 - @internal
15513 - */
15514 - resolveDepth(val) {
15515 - if (val == null) return this.depth;
15516 - if (val < 0) return this.depth + val;
15517 - return val;
15518 - }
15519 - /**
15520 - The parent node that the position points into. Note that even if
15521 - a position points into a text node, that node is not considered
15522 - the parent—text nodes are ‘flat’ in this model, and have no content.
15523 - */
15524 - get parent() {
15525 - return this.node(this.depth);
15526 - }
15527 - /**
15528 - The root node in which the position was resolved.
15529 - */
15530 - get doc() {
15531 - return this.node(0);
15532 - }
15533 - /**
15534 - The ancestor node at the given level. `p.node(p.depth)` is the
15535 - same as `p.parent`.
15536 - */
15537 - node(depth) {
15538 - return this.path[this.resolveDepth(depth) * 3];
15539 - }
15540 - /**
15541 - The index into the ancestor at the given level. If this points
15542 - at the 3rd node in the 2nd paragraph on the top level, for
15543 - example, `p.index(0)` is 1 and `p.index(1)` is 2.
15544 - */
15545 - index(depth) {
15546 - return this.path[this.resolveDepth(depth) * 3 + 1];
15547 - }
15548 - /**
15549 - The index pointing after this position into the ancestor at the
15550 - given level.
15551 - */
15552 - indexAfter(depth) {
15553 - depth = this.resolveDepth(depth);
15554 - return this.index(depth) + (depth == this.depth && !this.textOffset ? 0 : 1);
15555 - }
15556 - /**
15557 - The (absolute) position at the start of the node at the given
15558 - level.
15559 - */
15560 - start(depth) {
15561 - depth = this.resolveDepth(depth);
15562 - return depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;
15563 - }
15564 - /**
15565 - The (absolute) position at the end of the node at the given
15566 - level.
15567 - */
15568 - end(depth) {
15569 - depth = this.resolveDepth(depth);
15570 - return this.start(depth) + this.node(depth).content.size;
15571 - }
15572 - /**
15573 - The (absolute) position directly before the wrapping node at the
15574 - given level, or, when `depth` is `this.depth + 1`, the original
15575 - position.
15576 - */
15577 - before(depth) {
15578 - depth = this.resolveDepth(depth);
15579 - if (!depth) throw new RangeError("There is no position before the top-level node");
15580 - return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1];
15581 - }
15582 - /**
15583 - The (absolute) position directly after the wrapping node at the
15584 - given level, or the original position when `depth` is `this.depth + 1`.
15585 - */
15586 - after(depth) {
15587 - depth = this.resolveDepth(depth);
15588 - if (!depth) throw new RangeError("There is no position after the top-level node");
15589 - return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1] + this.path[depth * 3].nodeSize;
15590 - }
15591 - /**
15592 - When this position points into a text node, this returns the
15593 - distance between the position and the start of the text node.
15594 - Will be zero for positions that point between nodes.
15595 - */
15596 - get textOffset() {
15597 - return this.pos - this.path[this.path.length - 1];
15598 - }
15599 - /**
15600 - Get the node directly after the position, if any. If the position
15601 - points into a text node, only the part of that node after the
15602 - position is returned.
15603 - */
15604 - get nodeAfter() {
15605 - let parent = this.parent;
15606 - let index = this.index(this.depth);
15607 - if (index == parent.childCount) return null;
15608 - let dOff = this.pos - this.path[this.path.length - 1];
15609 - let child = parent.child(index);
15610 - return dOff ? parent.child(index).cut(dOff) : child;
15611 - }
15612 - /**
15613 - Get the node directly before the position, if any. If the
15614 - position points into a text node, only the part of that node
15615 - before the position is returned.
15616 - */
15617 - get nodeBefore() {
15618 - let index = this.index(this.depth);
15619 - let dOff = this.pos - this.path[this.path.length - 1];
15620 - if (dOff) return this.parent.child(index).cut(0, dOff);
15621 - return index == 0 ? null : this.parent.child(index - 1);
15622 - }
15623 - /**
15624 - Get the position at the given index in the parent node at the
15625 - given depth (which defaults to `this.depth`).
15626 - */
15627 - posAtIndex(index, depth) {
15628 - depth = this.resolveDepth(depth);
15629 - let node = this.path[depth * 3];
15630 - let pos = depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;
15631 - for (let i = 0; i < index; i++) pos += node.child(i).nodeSize;
15632 - return pos;
15633 - }
15634 - /**
15635 - Get the marks at this position, factoring in the surrounding
15636 - marks' [`inclusive`](https://prosemirror.net/docs/ref/#model.MarkSpec.inclusive) property. If the
15637 - position is at the start of a non-empty node, the marks of the
15638 - node after it (if any) are returned.
15639 - */
15640 - marks() {
15641 - let parent = this.parent;
15642 - let index = this.index();
15643 - if (parent.content.size == 0) return Mark$1.none;
15644 - if (this.textOffset) return parent.child(index).marks;
15645 - let main = parent.maybeChild(index - 1);
15646 - let other = parent.maybeChild(index);
15647 - if (!main) {
15648 - let tmp = main;
15649 - main = other;
15650 - other = tmp;
15651 - }
15652 - let marks = main.marks;
15653 - for (var i = 0; i < marks.length; i++) if (marks[i].type.spec.inclusive === false && (!other || !marks[i].isInSet(other.marks))) marks = marks[i--].removeFromSet(marks);
15654 - return marks;
15655 - }
15656 - /**
15657 - Get the marks after the current position, if any, except those
15658 - that are non-inclusive and not present at position `$end`. This
15659 - is mostly useful for getting the set of marks to preserve after a
15660 - deletion. Will return `null` if this position is at the end of
15661 - its parent node or its parent node isn't a textblock (in which
15662 - case no marks should be preserved).
15663 - */
15664 - marksAcross($end) {
15665 - let after = this.parent.maybeChild(this.index());
15666 - if (!after || !after.isInline) return null;
15667 - let marks = after.marks;
15668 - let next = $end.parent.maybeChild($end.index());
15669 - for (var i = 0; i < marks.length; i++) if (marks[i].type.spec.inclusive === false && (!next || !marks[i].isInSet(next.marks))) marks = marks[i--].removeFromSet(marks);
15670 - return marks;
15671 - }
15672 - /**
15673 - The depth up to which this position and the given (non-resolved)
15674 - position share the same parent nodes.
15675 - */
15676 - sharedDepth(pos) {
15677 - for (let depth = this.depth; depth > 0; depth--) if (this.start(depth) <= pos && this.end(depth) >= pos) return depth;
15678 - return 0;
15679 - }
15680 - /**
15681 - Returns a range based on the place where this position and the
15682 - given position diverge around block content. If both point into
15683 - the same textblock, for example, a range around that textblock
15684 - will be returned. If they point into different blocks, the range
15685 - around those blocks in their shared ancestor is returned. You can
15686 - pass in an optional predicate that will be called with a parent
15687 - node to see if a range into that parent is acceptable.
15688 - */
15689 - blockRange(other = this, pred) {
15690 - if (other.pos < this.pos) return other.blockRange(this);
15691 - for (let d = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d >= 0; d--) if (other.pos <= this.end(d) && (!pred || pred(this.node(d)))) return new NodeRange(this, other, d);
15692 - return null;
15693 - }
15694 - /**
15695 - Query whether the given position shares the same parent node.
15696 - */
15697 - sameParent(other) {
15698 - return this.pos - this.parentOffset == other.pos - other.parentOffset;
15699 - }
15700 - /**
15701 - Return the greater of this and the given position.
15702 - */
15703 - max(other) {
15704 - return other.pos > this.pos ? other : this;
15705 - }
15706 - /**
15707 - Return the smaller of this and the given position.
15708 - */
15709 - min(other) {
15710 - return other.pos < this.pos ? other : this;
15711 - }
15712 - /**
15713 - @internal
15714 - */
15715 - toString() {
15716 - let str = "";
15717 - for (let i = 1; i <= this.depth; i++) str += (str ? "/" : "") + this.node(i).type.name + "_" + this.index(i - 1);
15718 - return str + ":" + this.parentOffset;
15719 - }
15720 - /**
15721 - @internal
15722 - */
15723 - static resolve(doc, pos) {
15724 - if (!(pos >= 0 && pos <= doc.content.size)) throw new RangeError("Position " + pos + " out of range");
15725 - let path = [];
15726 - let start = 0;
15727 - let parentOffset = pos;
15728 - for (let node = doc;;) {
15729 - let { index, offset } = node.content.findIndex(parentOffset);
15730 - let rem = parentOffset - offset;
15731 - path.push(node, index, start + offset);
15732 - if (!rem) break;
15733 - node = node.child(index);
15734 - if (node.isText) break;
15735 - parentOffset = rem - 1;
15736 - start += offset + 1;
15737 - }
15738 - return new ResolvedPos(pos, path, parentOffset);
15739 - }
15740 - /**
15741 - @internal
15742 - */
15743 - static resolveCached(doc, pos) {
15744 - let cache = resolveCache.get(doc);
15745 - if (cache) for (let i = 0; i < cache.elts.length; i++) {
15746 - let elt = cache.elts[i];
15747 - if (elt.pos == pos) return elt;
15748 - }
15749 - else resolveCache.set(doc, cache = new ResolveCache());
15750 - let result = cache.elts[cache.i] = ResolvedPos.resolve(doc, pos);
15751 - cache.i = (cache.i + 1) % resolveCacheSize;
15752 - return result;
15753 - }
15754 - };
15755 - var ResolveCache = class {
15756 - constructor() {
15757 - this.elts = [];
15758 - this.i = 0;
15759 - }
15760 - };
15761 - var resolveCacheSize = 12;
15762 - var resolveCache = /* @__PURE__ */ new WeakMap();
15763 - /**
15764 - Represents a flat range of content, i.e. one that starts and
15765 - ends in the same node.
15766 - */
15767 - var NodeRange = class {
15768 - /**
15769 - Construct a node range. `$from` and `$to` should point into the
15770 - same node until at least the given `depth`, since a node range
15771 - denotes an adjacent set of nodes in a single parent node.
15772 - */
15773 - constructor($from, $to, depth) {
15774 - this.$from = $from;
15775 - this.$to = $to;
15776 - this.depth = depth;
15777 - }
15778 - /**
15779 - The position at the start of the range.
15780 - */
15781 - get start() {
15782 - return this.$from.before(this.depth + 1);
15783 - }
15784 - /**
15785 - The position at the end of the range.
15786 - */
15787 - get end() {
15788 - return this.$to.after(this.depth + 1);
15789 - }
15790 - /**
15791 - The parent node that the range points into.
15792 - */
15793 - get parent() {
15794 - return this.$from.node(this.depth);
15795 - }
15796 - /**
15797 - The start index of the range in the parent node.
15798 - */
15799 - get startIndex() {
15800 - return this.$from.index(this.depth);
15801 - }
15802 - /**
15803 - The end index of the range in the parent node.
15804 - */
15805 - get endIndex() {
15806 - return this.$to.indexAfter(this.depth);
15807 - }
15808 - };
15809 - var emptyAttrs = Object.create(null);
15810 - /**
15811 - This class represents a node in the tree that makes up a
15812 - ProseMirror document. So a document is an instance of `Node`, with
15813 - children that are also instances of `Node`.
15814 -
15815 - Nodes are persistent data structures. Instead of changing them, you
15816 - create new ones with the content you want. Old ones keep pointing
15817 - at the old document shape. This is made cheaper by sharing
15818 - structure between the old and new data as much as possible, which a
15819 - tree shape like this (without back pointers) makes easy.
15820 -
15821 - **Do not** directly mutate the properties of a `Node` object. See
15822 - [the guide](https://prosemirror.net/docs/guide/#doc) for more information.
15823 - */
15824 - var Node = class Node {
15825 - /**
15826 - @internal
15827 - */
15828 - constructor(type, attrs, content, marks = Mark$1.none) {
15829 - this.type = type;
15830 - this.attrs = attrs;
15831 - this.marks = marks;
15832 - this.content = content || Fragment$1.empty;
15833 - }
15834 - /**
15835 - The array of this node's child nodes.
15836 - */
15837 - get children() {
15838 - return this.content.content;
15839 - }
15840 - /**
15841 - The size of this node, as defined by the integer-based [indexing
15842 - scheme](https://prosemirror.net/docs/guide/#doc.indexing). For text nodes, this is the
15843 - amount of characters. For other leaf nodes, it is one. For
15844 - non-leaf nodes, it is the size of the content plus two (the
15845 - start and end token).
15846 - */
15847 - get nodeSize() {
15848 - return this.isLeaf ? 1 : 2 + this.content.size;
15849 - }
15850 - /**
15851 - The number of children that the node has.
15852 - */
15853 - get childCount() {
15854 - return this.content.childCount;
15855 - }
15856 - /**
15857 - Get the child node at the given index. Raises an error when the
15858 - index is out of range.
15859 - */
15860 - child(index) {
15861 - return this.content.child(index);
15862 - }
15863 - /**
15864 - Get the child node at the given index, if it exists.
15865 - */
15866 - maybeChild(index) {
15867 - return this.content.maybeChild(index);
15868 - }
15869 - /**
15870 - Call `f` for every child node, passing the node, its offset
15871 - into this parent node, and its index.
15872 - */
15873 - forEach(f) {
15874 - this.content.forEach(f);
15875 - }
15876 - /**
15877 - Invoke a callback for all descendant nodes recursively between
15878 - the given two positions that are relative to start of this
15879 - node's content. The callback is invoked with the node, its
15880 - position relative to the original node (method receiver),
15881 - its parent node, and its child index. When the callback returns
15882 - false for a given node, that node's children will not be
15883 - recursed over. The last parameter can be used to specify a
15884 - starting position to count from.
15885 - */
15886 - nodesBetween(from, to, f, startPos = 0) {
15887 - this.content.nodesBetween(from, to, f, startPos, this);
15888 - }
15889 - /**
15890 - Call the given callback for every descendant node. Doesn't
15891 - descend into a node when the callback returns `false`.
15892 - */
15893 - descendants(f) {
15894 - this.nodesBetween(0, this.content.size, f);
15895 - }
15896 - /**
15897 - Concatenates all the text nodes found in this fragment and its
15898 - children.
15899 - */
15900 - get textContent() {
15901 - return this.isLeaf && this.type.spec.leafText ? this.type.spec.leafText(this) : this.textBetween(0, this.content.size, "");
15902 - }
15903 - /**
15904 - Get all text between positions `from` and `to`. When
15905 - `blockSeparator` is given, it will be inserted to separate text
15906 - from different block nodes. If `leafText` is given, it'll be
15907 - inserted for every non-text leaf node encountered, otherwise
15908 - [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec.leafText) will be used.
15909 - */
15910 - textBetween(from, to, blockSeparator, leafText) {
15911 - return this.content.textBetween(from, to, blockSeparator, leafText);
15912 - }
15913 - /**
15914 - Returns this node's first child, or `null` if there are no
15915 - children.
15916 - */
15917 - get firstChild() {
15918 - return this.content.firstChild;
15919 - }
15920 - /**
15921 - Returns this node's last child, or `null` if there are no
15922 - children.
15923 - */
15924 - get lastChild() {
15925 - return this.content.lastChild;
15926 - }
15927 - /**
15928 - Test whether two nodes represent the same piece of document.
15929 - */
15930 - eq(other) {
15931 - return this == other || this.sameMarkup(other) && this.content.eq(other.content);
15932 - }
15933 - /**
15934 - Compare the markup (type, attributes, and marks) of this node to
15935 - those of another. Returns `true` if both have the same markup.
15936 - */
15937 - sameMarkup(other) {
15938 - return this.hasMarkup(other.type, other.attrs, other.marks);
15939 - }
15940 - /**
15941 - Check whether this node's markup correspond to the given type,
15942 - attributes, and marks.
15943 - */
15944 - hasMarkup(type, attrs, marks) {
15945 - return this.type == type && compareDeep(this.attrs, attrs || type.defaultAttrs || emptyAttrs) && Mark$1.sameSet(this.marks, marks || Mark$1.none);
15946 - }
15947 - /**
15948 - Create a new node with the same markup as this node, containing
15949 - the given content (or empty, if no content is given).
15950 - */
15951 - copy(content = null) {
15952 - if (content == this.content) return this;
15953 - return new Node(this.type, this.attrs, content, this.marks);
15954 - }
15955 - /**
15956 - Create a copy of this node, with the given set of marks instead
15957 - of the node's own marks.
15958 - */
15959 - mark(marks) {
15960 - return marks == this.marks ? this : new Node(this.type, this.attrs, this.content, marks);
15961 - }
15962 - /**
15963 - Create a copy of this node with only the content between the
15964 - given positions. If `to` is not given, it defaults to the end of
15965 - the node.
15966 - */
15967 - cut(from, to = this.content.size) {
15968 - if (from == 0 && to == this.content.size) return this;
15969 - return this.copy(this.content.cut(from, to));
15970 - }
15971 - /**
15972 - Cut out the part of the document between the given positions, and
15973 - return it as a `Slice` object.
15974 - */
15975 - slice(from, to = this.content.size, includeParents = false) {
15976 - if (from == to) return Slice.empty;
15977 - let $from = this.resolve(from);
15978 - let $to = this.resolve(to);
15979 - let depth = includeParents ? 0 : $from.sharedDepth(to);
15980 - let start = $from.start(depth);
15981 - let content = $from.node(depth).content.cut($from.pos - start, $to.pos - start);
15982 - return new Slice(content, $from.depth - depth, $to.depth - depth);
15983 - }
15984 - /**
15985 - Replace the part of the document between the given positions with
15986 - the given slice. The slice must 'fit', meaning its open sides
15987 - must be able to connect to the surrounding content, and its
15988 - content nodes must be valid children for the node they are placed
15989 - into. If any of this is violated, an error of type
15990 - [`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.
15991 - */
15992 - replace(from, to, slice) {
15993 - return replace(this.resolve(from), this.resolve(to), slice);
15994 - }
15995 - /**
15996 - Find the node directly after the given position.
15997 - */
15998 - nodeAt(pos) {
15999 - for (let node = this;;) {
16000 - let { index, offset } = node.content.findIndex(pos);
16001 - node = node.maybeChild(index);
16002 - if (!node) return null;
16003 - if (offset == pos || node.isText) return node;
16004 - pos -= offset + 1;
16005 - }
16006 - }
16007 - /**
16008 - Find the (direct) child node after the given offset, if any,
16009 - and return it along with its index and offset relative to this
16010 - node.
16011 - */
16012 - childAfter(pos) {
16013 - let { index, offset } = this.content.findIndex(pos);
16014 - return {
16015 - node: this.content.maybeChild(index),
16016 - index,
16017 - offset
16018 - };
16019 - }
16020 - /**
16021 - Find the (direct) child node before the given offset, if any,
16022 - and return it along with its index and offset relative to this
16023 - node.
16024 - */
16025 - childBefore(pos) {
16026 - if (pos == 0) return {
16027 - node: null,
16028 - index: 0,
16029 - offset: 0
16030 - };
16031 - let { index, offset } = this.content.findIndex(pos);
16032 - if (offset < pos) return {
16033 - node: this.content.child(index),
16034 - index,
16035 - offset
16036 - };
16037 - let node = this.content.child(index - 1);
16038 - return {
16039 - node,
16040 - index: index - 1,
16041 - offset: offset - node.nodeSize
16042 - };
16043 - }
16044 - /**
16045 - Resolve the given position in the document, returning an
16046 - [object](https://prosemirror.net/docs/ref/#model.ResolvedPos) with information about its context.
16047 - */
16048 - resolve(pos) {
16049 - return ResolvedPos.resolveCached(this, pos);
16050 - }
16051 - /**
16052 - @internal
16053 - */
16054 - resolveNoCache(pos) {
16055 - return ResolvedPos.resolve(this, pos);
16056 - }
16057 - /**
16058 - Test whether a given mark or mark type occurs in this document
16059 - between the two given positions.
16060 - */
16061 - rangeHasMark(from, to, type) {
16062 - let found = false;
16063 - if (to > from) this.nodesBetween(from, to, (node) => {
16064 - if (type.isInSet(node.marks)) found = true;
16065 - return !found;
16066 - });
16067 - return found;
16068 - }
16069 - /**
16070 - True when this is a block (non-inline node)
16071 - */
16072 - get isBlock() {
16073 - return this.type.isBlock;
16074 - }
16075 - /**
16076 - True when this is a textblock node, a block node with inline
16077 - content.
16078 - */
16079 - get isTextblock() {
16080 - return this.type.isTextblock;
16081 - }
16082 - /**
16083 - True when this node allows inline content.
16084 - */
16085 - get inlineContent() {
16086 - return this.type.inlineContent;
16087 - }
16088 - /**
16089 - True when this is an inline node (a text node or a node that can
16090 - appear among text).
16091 - */
16092 - get isInline() {
16093 - return this.type.isInline;
16094 - }
16095 - /**
16096 - True when this is a text node.
16097 - */
16098 - get isText() {
16099 - return this.type.isText;
16100 - }
16101 - /**
16102 - True when this is a leaf node.
16103 - */
16104 - get isLeaf() {
16105 - return this.type.isLeaf;
16106 - }
16107 - /**
16108 - True when this is an atom, i.e. when it does not have directly
16109 - editable content. This is usually the same as `isLeaf`, but can
16110 - be configured with the [`atom` property](https://prosemirror.net/docs/ref/#model.NodeSpec.atom)
16111 - on a node's spec (typically used when the node is displayed as
16112 - an uneditable [node view](https://prosemirror.net/docs/ref/#view.NodeView)).
16113 - */
16114 - get isAtom() {
16115 - return this.type.isAtom;
16116 - }
16117 - /**
16118 - Return a string representation of this node for debugging
16119 - purposes.
16120 - */
16121 - toString() {
16122 - if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);
16123 - let name = this.type.name;
16124 - if (this.content.size) name += "(" + this.content.toStringInner() + ")";
16125 - return wrapMarks(this.marks, name);
16126 - }
16127 - /**
16128 - Get the content match in this node at the given index.
16129 - */
16130 - contentMatchAt(index) {
16131 - let match = this.type.contentMatch.matchFragment(this.content, 0, index);
16132 - if (!match) throw new Error("Called contentMatchAt on a node with invalid content");
16133 - return match;
16134 - }
16135 - /**
16136 - Test whether replacing the range between `from` and `to` (by
16137 - child index) with the given replacement fragment (which defaults
16138 - to the empty fragment) would leave the node's content valid. You
16139 - can optionally pass `start` and `end` indices into the
16140 - replacement fragment.
16141 - */
16142 - canReplace(from, to, replacement = Fragment$1.empty, start = 0, end = replacement.childCount) {
16143 - let one = this.contentMatchAt(from).matchFragment(replacement, start, end);
16144 - let two = one && one.matchFragment(this.content, to);
16145 - if (!two || !two.validEnd) return false;
16146 - for (let i = start; i < end; i++) if (!this.type.allowsMarks(replacement.child(i).marks)) return false;
16147 - return true;
16148 - }
16149 - /**
16150 - Test whether replacing the range `from` to `to` (by index) with
16151 - a node of the given type would leave the node's content valid.
16152 - */
16153 - canReplaceWith(from, to, type, marks) {
16154 - if (marks && !this.type.allowsMarks(marks)) return false;
16155 - let start = this.contentMatchAt(from).matchType(type);
16156 - let end = start && start.matchFragment(this.content, to);
16157 - return end ? end.validEnd : false;
16158 - }
16159 - /**
16160 - Test whether the given node's content could be appended to this
16161 - node. If that node is empty, this will only return true if there
16162 - is at least one node type that can appear in both nodes (to avoid
16163 - merging completely incompatible nodes).
16164 - */
16165 - canAppend(other) {
16166 - if (other.content.size) return this.canReplace(this.childCount, this.childCount, other.content);
16167 - else return this.type.compatibleContent(other.type);
16168 - }
16169 - /**
16170 - Check whether this node and its descendants conform to the
16171 - schema, and raise an exception when they do not.
16172 - */
16173 - check() {
16174 - this.type.checkContent(this.content);
16175 - this.type.checkAttrs(this.attrs);
16176 - let copy = Mark$1.none;
16177 - for (let i = 0; i < this.marks.length; i++) {
16178 - let mark = this.marks[i];
16179 - mark.type.checkAttrs(mark.attrs);
16180 - copy = mark.addToSet(copy);
16181 - }
16182 - if (!Mark$1.sameSet(copy, this.marks)) throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((m) => m.type.name)}`);
16183 - this.content.forEach((node) => node.check());
16184 - }
16185 - /**
16186 - Return a JSON-serializeable representation of this node.
16187 - */
16188 - toJSON() {
16189 - let obj = { type: this.type.name };
16190 - for (let _ in this.attrs) {
16191 - obj.attrs = this.attrs;
16192 - break;
16193 - }
16194 - if (this.content.size) obj.content = this.content.toJSON();
16195 - if (this.marks.length) obj.marks = this.marks.map((n) => n.toJSON());
16196 - return obj;
16197 - }
16198 - /**
16199 - Deserialize a node from its JSON representation.
16200 - */
16201 - static fromJSON(schema, json) {
16202 - if (!json) throw new RangeError("Invalid input for Node.fromJSON");
16203 - let marks = void 0;
16204 - if (json.marks) {
16205 - if (!Array.isArray(json.marks)) throw new RangeError("Invalid mark data for Node.fromJSON");
16206 - marks = json.marks.map(schema.markFromJSON);
16207 - }
16208 - if (json.type == "text") {
16209 - if (typeof json.text != "string") throw new RangeError("Invalid text node in JSON");
16210 - return schema.text(json.text, marks);
16211 - }
16212 - let content = Fragment$1.fromJSON(schema, json.content);
16213 - let node = schema.nodeType(json.type).create(json.attrs, content, marks);
16214 - node.type.checkAttrs(node.attrs);
16215 - return node;
16216 - }
16217 - };
16218 - Node.prototype.text = void 0;
16219 - var TextNode = class TextNode extends Node {
16220 - /**
16221 - @internal
16222 - */
16223 - constructor(type, attrs, content, marks) {
16224 - super(type, attrs, null, marks);
16225 - if (!content) throw new RangeError("Empty text nodes are not allowed");
16226 - this.text = content;
16227 - }
16228 - toString() {
16229 - if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);
16230 - return wrapMarks(this.marks, JSON.stringify(this.text));
16231 - }
16232 - get textContent() {
16233 - return this.text;
16234 - }
16235 - textBetween(from, to) {
16236 - return this.text.slice(from, to);
16237 - }
16238 - get nodeSize() {
16239 - return this.text.length;
16240 - }
16241 - mark(marks) {
16242 - return marks == this.marks ? this : new TextNode(this.type, this.attrs, this.text, marks);
16243 - }
16244 - withText(text) {
16245 - if (text == this.text) return this;
16246 - return new TextNode(this.type, this.attrs, text, this.marks);
16247 - }
16248 - cut(from = 0, to = this.text.length) {
16249 - if (from == 0 && to == this.text.length) return this;
16250 - return this.withText(this.text.slice(from, to));
16251 - }
16252 - eq(other) {
16253 - return this.sameMarkup(other) && this.text == other.text;
16254 - }
16255 - toJSON() {
16256 - let base = super.toJSON();
16257 - base.text = this.text;
16258 - return base;
16259 - }
16260 - };
16261 - function wrapMarks(marks, str) {
16262 - for (let i = marks.length - 1; i >= 0; i--) str = marks[i].type.name + "(" + str + ")";
16263 - return str;
16264 - }
16265 - /**
16266 - Instances of this class represent a match state of a node type's
16267 - [content expression](https://prosemirror.net/docs/ref/#model.NodeSpec.content), and can be used to
16268 - find out whether further content matches here, and whether a given
16269 - position is a valid end of the node.
16270 - */
16271 - var ContentMatch = class ContentMatch {
16272 - /**
16273 - @internal
16274 - */
16275 - constructor(validEnd) {
16276 - this.validEnd = validEnd;
16277 - /**
16278 - @internal
16279 - */
16280 - this.next = [];
16281 - /**
16282 - @internal
16283 - */
16284 - this.wrapCache = [];
16285 - }
16286 - /**
16287 - @internal
16288 - */
16289 - static parse(string, nodeTypes) {
16290 - let stream = new TokenStream(string, nodeTypes);
16291 - if (stream.next == null) return ContentMatch.empty;
16292 - let expr = parseExpr(stream);
16293 - if (stream.next) stream.err("Unexpected trailing text");
16294 - let match = dfa(nfa(expr));
16295 - checkForDeadEnds(match, stream);
16296 - return match;
16297 - }
16298 - /**
16299 - Match a node type, returning a match after that node if
16300 - successful.
16301 - */
16302 - matchType(type) {
16303 - for (let i = 0; i < this.next.length; i++) if (this.next[i].type == type) return this.next[i].next;
16304 - return null;
16305 - }
16306 - /**
16307 - Try to match a fragment. Returns the resulting match when
16308 - successful.
16309 - */
16310 - matchFragment(frag, start = 0, end = frag.childCount) {
16311 - let cur = this;
16312 - for (let i = start; cur && i < end; i++) cur = cur.matchType(frag.child(i).type);
16313 - return cur;
16314 - }
16315 - /**
16316 - @internal
16317 - */
16318 - get inlineContent() {
16319 - return this.next.length != 0 && this.next[0].type.isInline;
16320 - }
16321 - /**
16322 - Get the first matching node type at this match position that can
16323 - be generated.
16324 - */
16325 - get defaultType() {
16326 - for (let i = 0; i < this.next.length; i++) {
16327 - let { type } = this.next[i];
16328 - if (!(type.isText || type.hasRequiredAttrs())) return type;
16329 - }
16330 - return null;
16331 - }
16332 - /**
16333 - @internal
16334 - */
16335 - compatible(other) {
16336 - for (let i = 0; i < this.next.length; i++) for (let j = 0; j < other.next.length; j++) if (this.next[i].type == other.next[j].type) return true;
16337 - return false;
16338 - }
16339 - /**
16340 - Try to match the given fragment, and if that fails, see if it can
16341 - be made to match by inserting nodes in front of it. When
16342 - successful, return a fragment of inserted nodes (which may be
16343 - empty if nothing had to be inserted). When `toEnd` is true, only
16344 - return a fragment if the resulting match goes to the end of the
16345 - content expression.
16346 - */
16347 - fillBefore(after, toEnd = false, startIndex = 0) {
16348 - let seen = [this];
16349 - function search(match, types) {
16350 - let finished = match.matchFragment(after, startIndex);
16351 - if (finished && (!toEnd || finished.validEnd)) return Fragment$1.from(types.map((tp) => tp.createAndFill()));
16352 - for (let i = 0; i < match.next.length; i++) {
16353 - let { type, next } = match.next[i];
16354 - if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) {
16355 - seen.push(next);
16356 - let found = search(next, types.concat(type));
16357 - if (found) return found;
16358 - }
16359 - }
16360 - return null;
16361 - }
16362 - return search(this, []);
16363 - }
16364 - /**
16365 - Find a set of wrapping node types that would allow a node of the
16366 - given type to appear at this position. The result may be empty
16367 - (when it fits directly) and will be null when no such wrapping
16368 - exists.
16369 - */
16370 - findWrapping(target) {
16371 - for (let i = 0; i < this.wrapCache.length; i += 2) if (this.wrapCache[i] == target) return this.wrapCache[i + 1];
16372 - let computed = this.computeWrapping(target);
16373 - this.wrapCache.push(target, computed);
16374 - return computed;
16375 - }
16376 - /**
16377 - @internal
16378 - */
16379 - computeWrapping(target) {
16380 - let seen = Object.create(null);
16381 - let active = [{
16382 - match: this,
16383 - type: null,
16384 - via: null
16385 - }];
16386 - while (active.length) {
16387 - let current = active.shift();
16388 - let match = current.match;
16389 - if (match.matchType(target)) {
16390 - let result = [];
16391 - for (let obj = current; obj.type; obj = obj.via) result.push(obj.type);
16392 - return result.reverse();
16393 - }
16394 - for (let i = 0; i < match.next.length; i++) {
16395 - let { type, next } = match.next[i];
16396 - if (!type.isLeaf && !type.hasRequiredAttrs() && !(type.name in seen) && (!current.type || next.validEnd)) {
16397 - active.push({
16398 - match: type.contentMatch,
16399 - type,
16400 - via: current
16401 - });
16402 - seen[type.name] = true;
16403 - }
16404 - }
16405 - }
16406 - return null;
16407 - }
16408 - /**
16409 - The number of outgoing edges this node has in the finite
16410 - automaton that describes the content expression.
16411 - */
16412 - get edgeCount() {
16413 - return this.next.length;
16414 - }
16415 - /**
16416 - Get the _n_​th outgoing edge from this node in the finite
16417 - automaton that describes the content expression.
16418 - */
16419 - edge(n) {
16420 - if (n >= this.next.length) throw new RangeError(`There's no ${n}th edge in this content match`);
16421 - return this.next[n];
16422 - }
16423 - /**
16424 - @internal
16425 - */
16426 - toString() {
16427 - let seen = [];
16428 - function scan(m) {
16429 - seen.push(m);
16430 - for (let i = 0; i < m.next.length; i++) if (seen.indexOf(m.next[i].next) == -1) scan(m.next[i].next);
16431 - }
16432 - scan(this);
16433 - return seen.map((m, i) => {
16434 - let out = i + (m.validEnd ? "*" : " ") + " ";
16435 - for (let i = 0; i < m.next.length; i++) out += (i ? ", " : "") + m.next[i].type.name + "->" + seen.indexOf(m.next[i].next);
16436 - return out;
16437 - }).join("\n");
16438 - }
16439 - };
16440 - /**
16441 - @internal
16442 - */
16443 - ContentMatch.empty = new ContentMatch(true);
16444 - var TokenStream = class {
16445 - constructor(string, nodeTypes) {
16446 - this.string = string;
16447 - this.nodeTypes = nodeTypes;
16448 - this.inline = null;
16449 - this.pos = 0;
16450 - this.tokens = string.split(/\s*(?=\b|\W|$)/);
16451 - if (this.tokens[this.tokens.length - 1] == "") this.tokens.pop();
16452 - if (this.tokens[0] == "") this.tokens.shift();
16453 - }
16454 - get next() {
16455 - return this.tokens[this.pos];
16456 - }
16457 - eat(tok) {
16458 - return this.next == tok && (this.pos++ || true);
16459 - }
16460 - err(str) {
16461 - throw new SyntaxError(str + " (in content expression '" + this.string + "')");
16462 - }
16463 - };
16464 - function parseExpr(stream) {
16465 - let exprs = [];
16466 - do
16467 - exprs.push(parseExprSeq(stream));
16468 - while (stream.eat("|"));
16469 - return exprs.length == 1 ? exprs[0] : {
16470 - type: "choice",
16471 - exprs
16472 - };
16473 - }
16474 - function parseExprSeq(stream) {
16475 - let exprs = [];
16476 - do
16477 - exprs.push(parseExprSubscript(stream));
16478 - while (stream.next && stream.next != ")" && stream.next != "|");
16479 - return exprs.length == 1 ? exprs[0] : {
16480 - type: "seq",
16481 - exprs
16482 - };
16483 - }
16484 - function parseExprSubscript(stream) {
16485 - let expr = parseExprAtom(stream);
16486 - for (;;) if (stream.eat("+")) expr = {
16487 - type: "plus",
16488 - expr
16489 - };
16490 - else if (stream.eat("*")) expr = {
16491 - type: "star",
16492 - expr
16493 - };
16494 - else if (stream.eat("?")) expr = {
16495 - type: "opt",
16496 - expr
16497 - };
16498 - else if (stream.eat("{")) expr = parseExprRange(stream, expr);
16499 - else break;
16500 - return expr;
16501 - }
16502 - function parseNum(stream) {
16503 - if (/\D/.test(stream.next)) stream.err("Expected number, got '" + stream.next + "'");
16504 - let result = Number(stream.next);
16505 - stream.pos++;
16506 - return result;
16507 - }
16508 - function parseExprRange(stream, expr) {
16509 - let min = parseNum(stream);
16510 - let max = min;
16511 - if (stream.eat(",")) if (stream.next != "}") max = parseNum(stream);
16512 - else max = -1;
16513 - if (!stream.eat("}")) stream.err("Unclosed braced range");
16514 - return {
16515 - type: "range",
16516 - min,
16517 - max,
16518 - expr
16519 - };
16520 - }
16521 - function resolveName(stream, name) {
16522 - let types = stream.nodeTypes;
16523 - let type = types[name];
16524 - if (type) return [type];
16525 - let result = [];
16526 - for (let typeName in types) {
16527 - let type = types[typeName];
16528 - if (type.isInGroup(name)) result.push(type);
16529 - }
16530 - if (result.length == 0) stream.err("No node type or group '" + name + "' found");
16531 - return result;
16532 - }
16533 - function parseExprAtom(stream) {
16534 - if (stream.eat("(")) {
16535 - let expr = parseExpr(stream);
16536 - if (!stream.eat(")")) stream.err("Missing closing paren");
16537 - return expr;
16538 - } else if (!/\W/.test(stream.next)) {
16539 - let exprs = resolveName(stream, stream.next).map((type) => {
16540 - if (stream.inline == null) stream.inline = type.isInline;
16541 - else if (stream.inline != type.isInline) stream.err("Mixing inline and block content");
16542 - return {
16543 - type: "name",
16544 - value: type
16545 - };
16546 - });
16547 - stream.pos++;
16548 - return exprs.length == 1 ? exprs[0] : {
16549 - type: "choice",
16550 - exprs
16551 - };
16552 - } else stream.err("Unexpected token '" + stream.next + "'");
16553 - }
16554 - function nfa(expr) {
16555 - let nfa = [[]];
16556 - connect(compile(expr, 0), node());
16557 - return nfa;
16558 - function node() {
16559 - return nfa.push([]) - 1;
16560 - }
16561 - function edge(from, to, term) {
16562 - let edge = {
16563 - term,
16564 - to
16565 - };
16566 - nfa[from].push(edge);
16567 - return edge;
16568 - }
16569 - function connect(edges, to) {
16570 - edges.forEach((edge) => edge.to = to);
16571 - }
16572 - function compile(expr, from) {
16573 - if (expr.type == "choice") return expr.exprs.reduce((out, expr) => out.concat(compile(expr, from)), []);
16574 - else if (expr.type == "seq") for (let i = 0;; i++) {
16575 - let next = compile(expr.exprs[i], from);
16576 - if (i == expr.exprs.length - 1) return next;
16577 - connect(next, from = node());
16578 - }
16579 - else if (expr.type == "star") {
16580 - let loop = node();
16581 - edge(from, loop);
16582 - connect(compile(expr.expr, loop), loop);
16583 - return [edge(loop)];
16584 - } else if (expr.type == "plus") {
16585 - let loop = node();
16586 - connect(compile(expr.expr, from), loop);
16587 - connect(compile(expr.expr, loop), loop);
16588 - return [edge(loop)];
16589 - } else if (expr.type == "opt") return [edge(from)].concat(compile(expr.expr, from));
16590 - else if (expr.type == "range") {
16591 - let cur = from;
16592 - for (let i = 0; i < expr.min; i++) {
16593 - let next = node();
16594 - connect(compile(expr.expr, cur), next);
16595 - cur = next;
16596 - }
16597 - if (expr.max == -1) connect(compile(expr.expr, cur), cur);
16598 - else for (let i = expr.min; i < expr.max; i++) {
16599 - let next = node();
16600 - edge(cur, next);
16601 - connect(compile(expr.expr, cur), next);
16602 - cur = next;
16603 - }
16604 - return [edge(cur)];
16605 - } else if (expr.type == "name") return [edge(from, void 0, expr.value)];
16606 - else throw new Error("Unknown expr type");
16607 - }
16608 - }
16609 - function cmp(a, b) {
16610 - return b - a;
16611 - }
16612 - function nullFrom(nfa, node) {
16613 - let result = [];
16614 - scan(node);
16615 - return result.sort(cmp);
16616 - function scan(node) {
16617 - let edges = nfa[node];
16618 - if (edges.length == 1 && !edges[0].term) return scan(edges[0].to);
16619 - result.push(node);
16620 - for (let i = 0; i < edges.length; i++) {
16621 - let { term, to } = edges[i];
16622 - if (!term && result.indexOf(to) == -1) scan(to);
16623 - }
16624 - }
16625 - }
16626 - function dfa(nfa) {
16627 - let labeled = Object.create(null);
16628 - return explore(nullFrom(nfa, 0));
16629 - function explore(states) {
16630 - let out = [];
16631 - states.forEach((node) => {
16632 - nfa[node].forEach(({ term, to }) => {
16633 - if (!term) return;
16634 - let set;
16635 - for (let i = 0; i < out.length; i++) if (out[i][0] == term) set = out[i][1];
16636 - nullFrom(nfa, to).forEach((node) => {
16637 - if (!set) out.push([term, set = []]);
16638 - if (set.indexOf(node) == -1) set.push(node);
16639 - });
16640 - });
16641 - });
16642 - let state = labeled[states.join(",")] = new ContentMatch(states.indexOf(nfa.length - 1) > -1);
16643 - for (let i = 0; i < out.length; i++) {
16644 - let states = out[i][1].sort(cmp);
16645 - state.next.push({
16646 - type: out[i][0],
16647 - next: labeled[states.join(",")] || explore(states)
16648 - });
16649 - }
16650 - return state;
16651 - }
16652 - }
16653 - function checkForDeadEnds(match, stream) {
16654 - for (let i = 0, work = [match]; i < work.length; i++) {
16655 - let state = work[i];
16656 - let dead = !state.validEnd;
16657 - let nodes = [];
16658 - for (let j = 0; j < state.next.length; j++) {
16659 - let { type, next } = state.next[j];
16660 - nodes.push(type.name);
16661 - if (dead && !(type.isText || type.hasRequiredAttrs())) dead = false;
16662 - if (work.indexOf(next) == -1) work.push(next);
16663 - }
16664 - if (dead) stream.err("Only non-generatable nodes (" + nodes.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
16665 - }
16666 - }
16667 - function defaultAttrs(attrs) {
16668 - let defaults = Object.create(null);
16669 - for (let attrName in attrs) {
16670 - let attr = attrs[attrName];
16671 - if (!attr.hasDefault) return null;
16672 - defaults[attrName] = attr.default;
16673 - }
16674 - return defaults;
16675 - }
16676 - function computeAttrs(attrs, value) {
16677 - let built = Object.create(null);
16678 - for (let name in attrs) {
16679 - let given = value && value[name];
16680 - if (given === void 0) {
16681 - let attr = attrs[name];
16682 - if (attr.hasDefault) given = attr.default;
16683 - else throw new RangeError("No value supplied for attribute " + name);
16684 - }
16685 - built[name] = given;
16686 - }
16687 - return built;
16688 - }
16689 - function checkAttrs(attrs, values, type, name) {
16690 - for (let name in values) if (!(name in attrs)) throw new RangeError(`Unsupported attribute ${name} for ${type} of type ${name}`);
16691 - for (let name in attrs) {
16692 - let attr = attrs[name];
16693 - if (attr.validate) attr.validate(values[name]);
16694 - }
16695 - }
16696 - function initAttrs(typeName, attrs) {
16697 - let result = Object.create(null);
16698 - if (attrs) for (let name in attrs) result[name] = new Attribute(typeName, name, attrs[name]);
16699 - return result;
16700 - }
16701 - /**
16702 - Node types are objects allocated once per `Schema` and used to
16703 - [tag](https://prosemirror.net/docs/ref/#model.Node.type) `Node` instances. They contain information
16704 - about the node type, such as its name and what kind of node it
16705 - represents.
16706 - */
16707 - var NodeType$1 = class NodeType$1 {
16708 - static {
16709 - __name(this, "NodeType");
16710 - }
16711 - /**
16712 - @internal
16713 - */
16714 - constructor(name, schema, spec) {
16715 - this.name = name;
16716 - this.schema = schema;
16717 - this.spec = spec;
16718 - /**
16719 - The set of marks allowed in this node. `null` means all marks
16720 - are allowed.
16721 - */
16722 - this.markSet = null;
16723 - this.groups = spec.group ? spec.group.split(" ") : [];
16724 - this.attrs = initAttrs(name, spec.attrs);
16725 - this.defaultAttrs = defaultAttrs(this.attrs);
16726 - this.contentMatch = null;
16727 - this.inlineContent = null;
16728 - this.isBlock = !(spec.inline || name == "text");
16729 - this.isText = name == "text";
16730 - }
16731 - /**
16732 - True if this is an inline type.
16733 - */
16734 - get isInline() {
16735 - return !this.isBlock;
16736 - }
16737 - /**
16738 - True if this is a textblock type, a block that contains inline
16739 - content.
16740 - */
16741 - get isTextblock() {
16742 - return this.isBlock && this.inlineContent;
16743 - }
16744 - /**
16745 - True for node types that allow no content.
16746 - */
16747 - get isLeaf() {
16748 - return this.contentMatch == ContentMatch.empty;
16749 - }
16750 - /**
16751 - True when this node is an atom, i.e. when it does not have
16752 - directly editable content.
16753 - */
16754 - get isAtom() {
16755 - return this.isLeaf || !!this.spec.atom;
16756 - }
16757 - /**
16758 - Return true when this node type is part of the given
16759 - [group](https://prosemirror.net/docs/ref/#model.NodeSpec.group).
16760 - */
16761 - isInGroup(group) {
16762 - return this.groups.indexOf(group) > -1;
16763 - }
16764 - /**
16765 - The node type's [whitespace](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) option.
16766 - */
16767 - get whitespace() {
16768 - return this.spec.whitespace || (this.spec.code ? "pre" : "normal");
16769 - }
16770 - /**
16771 - Tells you whether this node type has any required attributes.
16772 - */
16773 - hasRequiredAttrs() {
16774 - for (let n in this.attrs) if (this.attrs[n].isRequired) return true;
16775 - return false;
16776 - }
16777 - /**
16778 - Indicates whether this node allows some of the same content as
16779 - the given node type.
16780 - */
16781 - compatibleContent(other) {
16782 - return this == other || this.contentMatch.compatible(other.contentMatch);
16783 - }
16784 - /**
16785 - @internal
16786 - */
16787 - computeAttrs(attrs) {
16788 - if (!attrs && this.defaultAttrs) return this.defaultAttrs;
16789 - else return computeAttrs(this.attrs, attrs);
16790 - }
16791 - /**
16792 - Create a `Node` of this type. The given attributes are
16793 - checked and defaulted (you can pass `null` to use the type's
16794 - defaults entirely, if no required attributes exist). `content`
16795 - may be a `Fragment`, a node, an array of nodes, or
16796 - `null`. Similarly `marks` may be `null` to default to the empty
16797 - set of marks.
16798 - */
16799 - create(attrs = null, content, marks) {
16800 - if (this.isText) throw new Error("NodeType.create can't construct text nodes");
16801 - return new Node(this, this.computeAttrs(attrs), Fragment$1.from(content), Mark$1.setFrom(marks));
16802 - }
16803 - /**
16804 - Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
16805 - against the node type's content restrictions, and throw an error
16806 - if it doesn't match.
16807 - */
16808 - createChecked(attrs = null, content, marks) {
16809 - content = Fragment$1.from(content);
16810 - this.checkContent(content);
16811 - return new Node(this, this.computeAttrs(attrs), content, Mark$1.setFrom(marks));
16812 - }
16813 - /**
16814 - Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is
16815 - necessary to add nodes to the start or end of the given fragment
16816 - to make it fit the node. If no fitting wrapping can be found,
16817 - return null. Note that, due to the fact that required nodes can
16818 - always be created, this will always succeed if you pass null or
16819 - `Fragment.empty` as content.
16820 - */
16821 - createAndFill(attrs = null, content, marks) {
16822 - attrs = this.computeAttrs(attrs);
16823 - content = Fragment$1.from(content);
16824 - if (content.size) {
16825 - let before = this.contentMatch.fillBefore(content);
16826 - if (!before) return null;
16827 - content = before.append(content);
16828 - }
16829 - let matched = this.contentMatch.matchFragment(content);
16830 - let after = matched && matched.fillBefore(Fragment$1.empty, true);
16831 - if (!after) return null;
16832 - return new Node(this, attrs, content.append(after), Mark$1.setFrom(marks));
16833 - }
16834 - /**
16835 - Returns true if the given fragment is valid content for this node
16836 - type.
16837 - */
16838 - validContent(content) {
16839 - let result = this.contentMatch.matchFragment(content);
16840 - if (!result || !result.validEnd) return false;
16841 - for (let i = 0; i < content.childCount; i++) if (!this.allowsMarks(content.child(i).marks)) return false;
16842 - return true;
16843 - }
16844 - /**
16845 - Throws a RangeError if the given fragment is not valid content for this
16846 - node type.
16847 - @internal
16848 - */
16849 - checkContent(content) {
16850 - if (!this.validContent(content)) throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
16851 - }
16852 - /**
16853 - @internal
16854 - */
16855 - checkAttrs(attrs) {
16856 - checkAttrs(this.attrs, attrs, "node", this.name);
16857 - }
16858 - /**
16859 - Check whether the given mark type is allowed in this node.
16860 - */
16861 - allowsMarkType(markType) {
16862 - return this.markSet == null || this.markSet.indexOf(markType) > -1;
16863 - }
16864 - /**
16865 - Test whether the given set of marks are allowed in this node.
16866 - */
16867 - allowsMarks(marks) {
16868 - if (this.markSet == null) return true;
16869 - for (let i = 0; i < marks.length; i++) if (!this.allowsMarkType(marks[i].type)) return false;
16870 - return true;
16871 - }
16872 - /**
16873 - Removes the marks that are not allowed in this node from the given set.
16874 - */
16875 - allowedMarks(marks) {
16876 - if (this.markSet == null) return marks;
16877 - let copy;
16878 - for (let i = 0; i < marks.length; i++) if (!this.allowsMarkType(marks[i].type)) {
16879 - if (!copy) copy = marks.slice(0, i);
16880 - } else if (copy) copy.push(marks[i]);
16881 - return !copy ? marks : copy.length ? copy : Mark$1.none;
16882 - }
16883 - /**
16884 - @internal
16885 - */
16886 - static compile(nodes, schema) {
16887 - let result = Object.create(null);
16888 - nodes.forEach((name, spec) => result[name] = new NodeType$1(name, schema, spec));
16889 - let topType = schema.spec.topNode || "doc";
16890 - if (!result[topType]) throw new RangeError("Schema is missing its top node type ('" + topType + "')");
16891 - if (!result.text) throw new RangeError("Every schema needs a 'text' type");
16892 - for (let _ in result.text.attrs) throw new RangeError("The text node type should not have attributes");
16893 - return result;
16894 - }
16895 - };
16896 - function validateType(typeName, attrName, type) {
16897 - let types = type.split("|");
16898 - return (value) => {
16899 - let name = value === null ? "null" : typeof value;
16900 - if (types.indexOf(name) < 0) throw new RangeError(`Expected value of type ${types} for attribute ${attrName} on type ${typeName}, got ${name}`);
16901 - };
16902 - }
16903 - var Attribute = class {
16904 - constructor(typeName, attrName, options) {
16905 - this.hasDefault = Object.prototype.hasOwnProperty.call(options, "default");
16906 - this.default = options.default;
16907 - this.validate = typeof options.validate == "string" ? validateType(typeName, attrName, options.validate) : options.validate;
16908 - }
16909 - get isRequired() {
16910 - return !this.hasDefault;
16911 - }
16912 - };
16913 - /**
16914 - Like nodes, marks (which are associated with nodes to signify
16915 - things like emphasis or being part of a link) are
16916 - [tagged](https://prosemirror.net/docs/ref/#model.Mark.type) with type objects, which are
16917 - instantiated once per `Schema`.
16918 - */
16919 - var MarkType = class MarkType {
16920 - /**
16921 - @internal
16922 - */
16923 - constructor(name, rank, schema, spec) {
16924 - this.name = name;
16925 - this.rank = rank;
16926 - this.schema = schema;
16927 - this.spec = spec;
16928 - this.attrs = initAttrs(name, spec.attrs);
16929 - this.excluded = null;
16930 - let defaults = defaultAttrs(this.attrs);
16931 - this.instance = defaults ? new Mark$1(this, defaults) : null;
16932 - }
16933 - /**
16934 - Create a mark of this type. `attrs` may be `null` or an object
16935 - containing only some of the mark's attributes. The others, if
16936 - they have defaults, will be added.
16937 - */
16938 - create(attrs = null) {
16939 - if (!attrs && this.instance) return this.instance;
16940 - return new Mark$1(this, computeAttrs(this.attrs, attrs));
16941 - }
16942 - /**
16943 - @internal
16944 - */
16945 - static compile(marks, schema) {
16946 - let result = Object.create(null);
16947 - let rank = 0;
16948 - marks.forEach((name, spec) => result[name] = new MarkType(name, rank++, schema, spec));
16949 - return result;
16950 - }
16951 - /**
16952 - When there is a mark of this type in the given set, a new set
16953 - without it is returned. Otherwise, the input set is returned.
16954 - */
16955 - removeFromSet(set) {
16956 - for (var i = 0; i < set.length; i++) if (set[i].type == this) {
16957 - set = set.slice(0, i).concat(set.slice(i + 1));
16958 - i--;
16959 - }
16960 - return set;
16961 - }
16962 - /**
16963 - Tests whether there is a mark of this type in the given set.
16964 - */
16965 - isInSet(set) {
16966 - for (let i = 0; i < set.length; i++) if (set[i].type == this) return set[i];
16967 - }
16968 - /**
16969 - @internal
16970 - */
16971 - checkAttrs(attrs) {
16972 - checkAttrs(this.attrs, attrs, "mark", this.name);
16973 - }
16974 - /**
16975 - Queries whether a given mark type is
16976 - [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
16977 - */
16978 - excludes(other) {
16979 - return this.excluded.indexOf(other) > -1;
16980 - }
16981 - };
16982 - /**
16983 - A document schema. Holds [node](https://prosemirror.net/docs/ref/#model.NodeType) and [mark
16984 - type](https://prosemirror.net/docs/ref/#model.MarkType) objects for the nodes and marks that may
16985 - occur in conforming documents, and provides functionality for
16986 - creating and deserializing such documents.
16987 -
16988 - When given, the type parameters provide the names of the nodes and
16989 - marks in this schema.
16990 - */
16991 - var Schema = class {
16992 - /**
16993 - Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
16994 - */
16995 - constructor(spec) {
16996 - /**
16997 - The [linebreak
16998 - replacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement) node defined
16999 - in this schema, if any.
17000 - */
17001 - this.linebreakReplacement = null;
17002 - /**
17003 - An object for storing whatever values modules may want to
17004 - compute and cache per schema. (If you want to store something
17005 - in it, try to use property names unlikely to clash.)
17006 - */
17007 - this.cached = Object.create(null);
17008 - let instanceSpec = this.spec = {};
17009 - for (let prop in spec) instanceSpec[prop] = spec[prop];
17010 - instanceSpec.nodes = OrderedMap.from(spec.nodes), instanceSpec.marks = OrderedMap.from(spec.marks || {}), this.nodes = NodeType$1.compile(this.spec.nodes, this);
17011 - this.marks = MarkType.compile(this.spec.marks, this);
17012 - let contentExprCache = Object.create(null);
17013 - for (let prop in this.nodes) {
17014 - if (prop in this.marks) throw new RangeError(prop + " can not be both a node and a mark");
17015 - let type = this.nodes[prop];
17016 - let contentExpr = type.spec.content || "";
17017 - let markExpr = type.spec.marks;
17018 - type.contentMatch = contentExprCache[contentExpr] || (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));
17019 - type.inlineContent = type.contentMatch.inlineContent;
17020 - if (type.spec.linebreakReplacement) {
17021 - if (this.linebreakReplacement) throw new RangeError("Multiple linebreak nodes defined");
17022 - if (!type.isInline || !type.isLeaf) throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
17023 - this.linebreakReplacement = type;
17024 - }
17025 - type.markSet = markExpr == "_" ? null : markExpr ? gatherMarks(this, markExpr.split(" ")) : markExpr == "" || !type.inlineContent ? [] : null;
17026 - }
17027 - for (let prop in this.marks) {
17028 - let type = this.marks[prop];
17029 - let excl = type.spec.excludes;
17030 - type.excluded = excl == null ? [type] : excl == "" ? [] : gatherMarks(this, excl.split(" "));
17031 - }
17032 - this.nodeFromJSON = (json) => Node.fromJSON(this, json);
17033 - this.markFromJSON = (json) => Mark$1.fromJSON(this, json);
17034 - this.topNodeType = this.nodes[this.spec.topNode || "doc"];
17035 - this.cached.wrappings = Object.create(null);
17036 - }
17037 - /**
17038 - Create a node in this schema. The `type` may be a string or a
17039 - `NodeType` instance. Attributes will be extended with defaults,
17040 - `content` may be a `Fragment`, `null`, a `Node`, or an array of
17041 - nodes.
17042 - */
17043 - node(type, attrs = null, content, marks) {
17044 - if (typeof type == "string") type = this.nodeType(type);
17045 - else if (!(type instanceof NodeType$1)) throw new RangeError("Invalid node type: " + type);
17046 - else if (type.schema != this) throw new RangeError("Node type from different schema used (" + type.name + ")");
17047 - return type.createChecked(attrs, content, marks);
17048 - }
17049 - /**
17050 - Create a text node in the schema. Empty text nodes are not
17051 - allowed.
17052 - */
17053 - text(text, marks) {
17054 - let type = this.nodes.text;
17055 - return new TextNode(type, type.defaultAttrs, text, Mark$1.setFrom(marks));
17056 - }
17057 - /**
17058 - Create a mark with the given type and attributes.
17059 - */
17060 - mark(type, attrs) {
17061 - if (typeof type == "string") type = this.marks[type];
17062 - return type.create(attrs);
17063 - }
17064 - /**
17065 - @internal
17066 - */
17067 - nodeType(name) {
17068 - let found = this.nodes[name];
17069 - if (!found) throw new RangeError("Unknown node type: " + name);
17070 - return found;
17071 - }
17072 - };
17073 - function gatherMarks(schema, marks) {
17074 - let found = [];
17075 - for (let i = 0; i < marks.length; i++) {
17076 - let name = marks[i];
17077 - let mark = schema.marks[name];
17078 - let ok = mark;
17079 - if (mark) found.push(mark);
17080 - else for (let prop in schema.marks) {
17081 - let mark = schema.marks[prop];
17082 - if (name == "_" || mark.spec.group && mark.spec.group.split(" ").indexOf(name) > -1) found.push(ok = mark);
17083 - }
17084 - if (!ok) throw new SyntaxError("Unknown mark type: '" + marks[i] + "'");
17085 - }
17086 - return found;
17087 - }
17088 - function isTagRule(rule) {
17089 - return rule.tag != null;
17090 - }
17091 - function isStyleRule(rule) {
17092 - return rule.style != null;
17093 - }
17094 - /**
17095 - A DOM parser represents a strategy for parsing DOM content into a
17096 - ProseMirror document conforming to a given schema. Its behavior is
17097 - defined by an array of [rules](https://prosemirror.net/docs/ref/#model.ParseRule).
17098 - */
17099 - var DOMParser$1 = class DOMParser$1 {
17100 - static {
17101 - __name(this, "DOMParser");
17102 - }
17103 - /**
17104 - Create a parser that targets the given schema, using the given
17105 - parsing rules.
17106 - */
17107 - constructor(schema, rules) {
17108 - this.schema = schema;
17109 - this.rules = rules;
17110 - /**
17111 - @internal
17112 - */
17113 - this.tags = [];
17114 - /**
17115 - @internal
17116 - */
17117 - this.styles = [];
17118 - let matchedStyles = this.matchedStyles = [];
17119 - rules.forEach((rule) => {
17120 - if (isTagRule(rule)) this.tags.push(rule);
17121 - else if (isStyleRule(rule)) {
17122 - let prop = /[^=]*/.exec(rule.style)[0];
17123 - if (matchedStyles.indexOf(prop) < 0) matchedStyles.push(prop);
17124 - this.styles.push(rule);
17125 - }
17126 - });
17127 - this.normalizeLists = !this.tags.some((r) => {
17128 - if (!/^(ul|ol)\b/.test(r.tag) || !r.node) return false;
17129 - let node = schema.nodes[r.node];
17130 - return node.contentMatch.matchType(node);
17131 - });
17132 - }
17133 - /**
17134 - Parse a document from the content of a DOM node.
17135 - */
17136 - parse(dom, options = {}) {
17137 - let context = new ParseContext(this, options, false);
17138 - context.addAll(dom, Mark$1.none, options.from, options.to);
17139 - return context.finish();
17140 - }
17141 - /**
17142 - Parses the content of the given DOM node, like
17143 - [`parse`](https://prosemirror.net/docs/ref/#model.DOMParser.parse), and takes the same set of
17144 - options. But unlike that method, which produces a whole node,
17145 - this one returns a slice that is open at the sides, meaning that
17146 - the schema constraints aren't applied to the start of nodes to
17147 - the left of the input and the end of nodes at the end.
17148 - */
17149 - parseSlice(dom, options = {}) {
17150 - let context = new ParseContext(this, options, true);
17151 - context.addAll(dom, Mark$1.none, options.from, options.to);
17152 - return Slice.maxOpen(context.finish());
17153 - }
17154 - /**
17155 - @internal
17156 - */
17157 - matchTag(dom, context, after) {
17158 - for (let i = after ? this.tags.indexOf(after) + 1 : 0; i < this.tags.length; i++) {
17159 - let rule = this.tags[i];
17160 - if (matches(dom, rule.tag) && (rule.namespace === void 0 || dom.namespaceURI == rule.namespace) && (!rule.context || context.matchesContext(rule.context))) {
17161 - if (rule.getAttrs) {
17162 - let result = rule.getAttrs(dom);
17163 - if (result === false) continue;
17164 - rule.attrs = result || void 0;
17165 - }
17166 - return rule;
17167 - }
17168 - }
17169 - }
17170 - /**
17171 - @internal
17172 - */
17173 - matchStyle(prop, value, context, after) {
17174 - for (let i = after ? this.styles.indexOf(after) + 1 : 0; i < this.styles.length; i++) {
17175 - let rule = this.styles[i];
17176 - let style = rule.style;
17177 - if (style.indexOf(prop) != 0 || rule.context && !context.matchesContext(rule.context) || style.length > prop.length && (style.charCodeAt(prop.length) != 61 || style.slice(prop.length + 1) != value)) continue;
17178 - if (rule.getAttrs) {
17179 - let result = rule.getAttrs(value);
17180 - if (result === false) continue;
17181 - rule.attrs = result || void 0;
17182 - }
17183 - return rule;
17184 - }
17185 - }
17186 - /**
17187 - @internal
17188 - */
17189 - static schemaRules(schema) {
17190 - let result = [];
17191 - function insert(rule) {
17192 - let priority = rule.priority == null ? 50 : rule.priority;
17193 - let i = 0;
17194 - for (; i < result.length; i++) {
17195 - let next = result[i];
17196 - if ((next.priority == null ? 50 : next.priority) < priority) break;
17197 - }
17198 - result.splice(i, 0, rule);
17199 - }
17200 - for (let name in schema.marks) {
17201 - let rules = schema.marks[name].spec.parseDOM;
17202 - if (rules) rules.forEach((rule) => {
17203 - insert(rule = copy(rule));
17204 - if (!(rule.mark || rule.ignore || rule.clearMark)) rule.mark = name;
17205 - });
17206 - }
17207 - for (let name in schema.nodes) {
17208 - let rules = schema.nodes[name].spec.parseDOM;
17209 - if (rules) rules.forEach((rule) => {
17210 - insert(rule = copy(rule));
17211 - if (!(rule.node || rule.ignore || rule.mark)) rule.node = name;
17212 - });
17213 - }
17214 - return result;
17215 - }
17216 - /**
17217 - Construct a DOM parser using the parsing rules listed in a
17218 - schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by
17219 - [priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
17220 - */
17221 - static fromSchema(schema) {
17222 - return schema.cached.domParser || (schema.cached.domParser = new DOMParser$1(schema, DOMParser$1.schemaRules(schema)));
17223 - }
17224 - };
17225 - var blockTags = {
17226 - address: true,
17227 - article: true,
17228 - aside: true,
17229 - blockquote: true,
17230 - canvas: true,
17231 - dd: true,
17232 - div: true,
17233 - dl: true,
17234 - fieldset: true,
17235 - figcaption: true,
17236 - figure: true,
17237 - footer: true,
17238 - form: true,
17239 - h1: true,
17240 - h2: true,
17241 - h3: true,
17242 - h4: true,
17243 - h5: true,
17244 - h6: true,
17245 - header: true,
17246 - hgroup: true,
17247 - hr: true,
17248 - li: true,
17249 - noscript: true,
17250 - ol: true,
17251 - output: true,
17252 - p: true,
17253 - pre: true,
17254 - section: true,
17255 - table: true,
17256 - tfoot: true,
17257 - ul: true
17258 - };
17259 - var ignoreTags = {
17260 - head: true,
17261 - noscript: true,
17262 - object: true,
17263 - script: true,
17264 - style: true,
17265 - title: true
17266 - };
17267 - var listTags = {
17268 - ol: true,
17269 - ul: true
17270 - };
17271 - var OPT_PRESERVE_WS = 1;
17272 - var OPT_PRESERVE_WS_FULL = 2;
17273 - var OPT_OPEN_LEFT = 4;
17274 - function wsOptionsFor(type, preserveWhitespace, base) {
17275 - if (preserveWhitespace != null) return (preserveWhitespace ? OPT_PRESERVE_WS : 0) | (preserveWhitespace === "full" ? OPT_PRESERVE_WS_FULL : 0);
17276 - return type && type.whitespace == "pre" ? 3 : base & -5;
17277 - }
17278 - var NodeContext = class {
17279 - constructor(type, attrs, marks, solid, match, options) {
17280 - this.type = type;
17281 - this.attrs = attrs;
17282 - this.marks = marks;
17283 - this.solid = solid;
17284 - this.options = options;
17285 - this.content = [];
17286 - this.activeMarks = Mark$1.none;
17287 - this.match = match || (options & OPT_OPEN_LEFT ? null : type.contentMatch);
17288 - }
17289 - findWrapping(node) {
17290 - if (!this.match) {
17291 - if (!this.type) return [];
17292 - let fill = this.type.contentMatch.fillBefore(Fragment$1.from(node));
17293 - if (fill) this.match = this.type.contentMatch.matchFragment(fill);
17294 - else {
17295 - let start = this.type.contentMatch;
17296 - let wrap;
17297 - if (wrap = start.findWrapping(node.type)) {
17298 - this.match = start;
17299 - return wrap;
17300 - } else return null;
17301 - }
17302 - }
17303 - return this.match.findWrapping(node.type);
17304 - }
17305 - finish(openEnd) {
17306 - if (!(this.options & OPT_PRESERVE_WS)) {
17307 - let last = this.content[this.content.length - 1];
17308 - let m;
17309 - if (last && last.isText && (m = /[ \t\r\n\u000c]+$/.exec(last.text))) {
17310 - let text = last;
17311 - if (last.text.length == m[0].length) this.content.pop();
17312 - else this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m[0].length));
17313 - }
17314 - }
17315 - let content = Fragment$1.from(this.content);
17316 - if (!openEnd && this.match) content = content.append(this.match.fillBefore(Fragment$1.empty, true));
17317 - return this.type ? this.type.create(this.attrs, content, this.marks) : content;
17318 - }
17319 - inlineContext(node) {
17320 - if (this.type) return this.type.inlineContent;
17321 - if (this.content.length) return this.content[0].isInline;
17322 - return node.parentNode && !blockTags.hasOwnProperty(node.parentNode.nodeName.toLowerCase());
17323 - }
17324 - };
17325 - var ParseContext = class {
17326 - constructor(parser, options, isOpen) {
17327 - this.parser = parser;
17328 - this.options = options;
17329 - this.isOpen = isOpen;
17330 - this.open = 0;
17331 - this.localPreserveWS = false;
17332 - let topNode = options.topNode;
17333 - let topContext;
17334 - let topOptions = wsOptionsFor(null, options.preserveWhitespace, 0) | (isOpen ? OPT_OPEN_LEFT : 0);
17335 - if (topNode) topContext = new NodeContext(topNode.type, topNode.attrs, Mark$1.none, true, options.topMatch || topNode.type.contentMatch, topOptions);
17336 - else if (isOpen) topContext = new NodeContext(null, null, Mark$1.none, true, null, topOptions);
17337 - else topContext = new NodeContext(parser.schema.topNodeType, null, Mark$1.none, true, null, topOptions);
17338 - this.nodes = [topContext];
17339 - this.find = options.findPositions;
17340 - this.needsBlock = false;
17341 - }
17342 - get top() {
17343 - return this.nodes[this.open];
17344 - }
17345 - addDOM(dom, marks) {
17346 - if (dom.nodeType == 3) this.addTextNode(dom, marks);
17347 - else if (dom.nodeType == 1) this.addElement(dom, marks);
17348 - }
17349 - addTextNode(dom, marks) {
17350 - let value = dom.nodeValue;
17351 - let top = this.top;
17352 - let preserveWS = top.options & OPT_PRESERVE_WS_FULL ? "full" : this.localPreserveWS || (top.options & OPT_PRESERVE_WS) > 0;
17353 - let { schema } = this.parser;
17354 - if (preserveWS === "full" || top.inlineContext(dom) || /[^ \t\r\n\u000c]/.test(value)) {
17355 - if (!preserveWS) {
17356 - value = value.replace(/[ \t\r\n\u000c]+/g, " ");
17357 - if (/^[ \t\r\n\u000c]/.test(value) && this.open == this.nodes.length - 1) {
17358 - let nodeBefore = top.content[top.content.length - 1];
17359 - let domNodeBefore = dom.previousSibling;
17360 - if (!nodeBefore || domNodeBefore && domNodeBefore.nodeName == "BR" || nodeBefore.isText && /[ \t\r\n\u000c]$/.test(nodeBefore.text)) value = value.slice(1);
17361 - }
17362 - } else if (preserveWS === "full") value = value.replace(/\r\n?/g, "\n");
17363 - else if (schema.linebreakReplacement && /[\r\n]/.test(value) && this.top.findWrapping(schema.linebreakReplacement.create())) {
17364 - let lines = value.split(/\r?\n|\r/);
17365 - for (let i = 0; i < lines.length; i++) {
17366 - if (i) this.insertNode(schema.linebreakReplacement.create(), marks, true);
17367 - if (lines[i]) this.insertNode(schema.text(lines[i]), marks, !/\S/.test(lines[i]));
17368 - }
17369 - value = "";
17370 - } else value = value.replace(/\r?\n|\r/g, " ");
17371 - if (value) this.insertNode(schema.text(value), marks, !/\S/.test(value));
17372 - this.findInText(dom);
17373 - } else this.findInside(dom);
17374 - }
17375 - addElement(dom, marks, matchAfter) {
17376 - let outerWS = this.localPreserveWS;
17377 - let top = this.top;
17378 - if (dom.tagName == "PRE" || /pre/.test(dom.style && dom.style.whiteSpace)) this.localPreserveWS = true;
17379 - let name = dom.nodeName.toLowerCase();
17380 - let ruleID;
17381 - if (listTags.hasOwnProperty(name) && this.parser.normalizeLists) normalizeList(dom);
17382 - let rule = this.options.ruleFromNode && this.options.ruleFromNode(dom) || (ruleID = this.parser.matchTag(dom, this, matchAfter));
17383 - out: if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) {
17384 - this.findInside(dom);
17385 - this.ignoreFallback(dom, marks);
17386 - } else if (!rule || rule.skip || rule.closeParent) {
17387 - if (rule && rule.closeParent) this.open = Math.max(0, this.open - 1);
17388 - else if (rule && rule.skip.nodeType) dom = rule.skip;
17389 - let sync;
17390 - let oldNeedsBlock = this.needsBlock;
17391 - if (blockTags.hasOwnProperty(name)) {
17392 - if (top.content.length && top.content[0].isInline && this.open) {
17393 - this.open--;
17394 - top = this.top;
17395 - }
17396 - sync = true;
17397 - if (!top.type) this.needsBlock = true;
17398 - } else if (!dom.firstChild) {
17399 - this.leafFallback(dom, marks);
17400 - break out;
17401 - }
17402 - let innerMarks = rule && rule.skip ? marks : this.readStyles(dom, marks);
17403 - if (innerMarks) this.addAll(dom, innerMarks);
17404 - if (sync) this.sync(top);
17405 - this.needsBlock = oldNeedsBlock;
17406 - } else {
17407 - let innerMarks = this.readStyles(dom, marks);
17408 - if (innerMarks) this.addElementByRule(dom, rule, innerMarks, rule.consuming === false ? ruleID : void 0);
17409 - }
17410 - this.localPreserveWS = outerWS;
17411 - }
17412 - leafFallback(dom, marks) {
17413 - if (dom.nodeName == "BR" && this.top.type && this.top.type.inlineContent) this.addTextNode(dom.ownerDocument.createTextNode("\n"), marks);
17414 - }
17415 - ignoreFallback(dom, marks) {
17416 - if (dom.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent)) this.findPlace(this.parser.schema.text("-"), marks, true);
17417 - }
17418 - readStyles(dom, marks) {
17419 - let styles = dom.style;
17420 - if (styles && styles.length) for (let i = 0; i < this.parser.matchedStyles.length; i++) {
17421 - let name = this.parser.matchedStyles[i];
17422 - let value = styles.getPropertyValue(name);
17423 - if (value) for (let after = void 0;;) {
17424 - let rule = this.parser.matchStyle(name, value, this, after);
17425 - if (!rule) break;
17426 - if (rule.ignore) return null;
17427 - if (rule.clearMark) marks = marks.filter((m) => !rule.clearMark(m));
17428 - else marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));
17429 - if (rule.consuming === false) after = rule;
17430 - else break;
17431 - }
17432 - }
17433 - return marks;
17434 - }
17435 - addElementByRule(dom, rule, marks, continueAfter) {
17436 - let sync;
17437 - let nodeType;
17438 - if (rule.node) {
17439 - nodeType = this.parser.schema.nodes[rule.node];
17440 - if (!nodeType.isLeaf) {
17441 - let inner = this.enter(nodeType, rule.attrs || null, marks, rule.preserveWhitespace);
17442 - if (inner) {
17443 - sync = true;
17444 - marks = inner;
17445 - }
17446 - } else if (!this.insertNode(nodeType.create(rule.attrs), marks, dom.nodeName == "BR")) this.leafFallback(dom, marks);
17447 - } else {
17448 - let markType = this.parser.schema.marks[rule.mark];
17449 - marks = marks.concat(markType.create(rule.attrs));
17450 - }
17451 - let startIn = this.top;
17452 - if (nodeType && nodeType.isLeaf) this.findInside(dom);
17453 - else if (continueAfter) this.addElement(dom, marks, continueAfter);
17454 - else if (rule.getContent) {
17455 - this.findInside(dom);
17456 - rule.getContent(dom, this.parser.schema).forEach((node) => this.insertNode(node, marks, false));
17457 - } else {
17458 - let contentDOM = dom;
17459 - if (typeof rule.contentElement == "string") contentDOM = dom.querySelector(rule.contentElement);
17460 - else if (typeof rule.contentElement == "function") contentDOM = rule.contentElement(dom);
17461 - else if (rule.contentElement) contentDOM = rule.contentElement;
17462 - this.findAround(dom, contentDOM, true);
17463 - this.addAll(contentDOM, marks);
17464 - this.findAround(dom, contentDOM, false);
17465 - }
17466 - if (sync && this.sync(startIn)) this.open--;
17467 - }
17468 - addAll(parent, marks, startIndex, endIndex) {
17469 - let index = startIndex || 0;
17470 - for (let dom = startIndex ? parent.childNodes[startIndex] : parent.firstChild, end = endIndex == null ? null : parent.childNodes[endIndex]; dom != end; dom = dom.nextSibling, ++index) {
17471 - this.findAtPoint(parent, index);
17472 - this.addDOM(dom, marks);
17473 - }
17474 - this.findAtPoint(parent, index);
17475 - }
17476 - findPlace(node, marks, cautious) {
17477 - let route;
17478 - let sync;
17479 - for (let depth = this.open, penalty = 0; depth >= 0; depth--) {
17480 - let cx = this.nodes[depth];
17481 - let found = cx.findWrapping(node);
17482 - if (found && (!route || route.length > found.length + penalty)) {
17483 - route = found;
17484 - sync = cx;
17485 - if (!found.length) break;
17486 - }
17487 - if (cx.solid) {
17488 - if (cautious) break;
17489 - penalty += 2;
17490 - }
17491 - }
17492 - if (!route) return null;
17493 - this.sync(sync);
17494 - for (let i = 0; i < route.length; i++) marks = this.enterInner(route[i], null, marks, false);
17495 - return marks;
17496 - }
17497 - insertNode(node, marks, cautious) {
17498 - if (node.isInline && this.needsBlock && !this.top.type) {
17499 - let block = this.textblockFromContext();
17500 - if (block) marks = this.enterInner(block, null, marks);
17501 - }
17502 - let innerMarks = this.findPlace(node, marks, cautious);
17503 - if (innerMarks) {
17504 - this.closeExtra();
17505 - let top = this.top;
17506 - if (top.match) top.match = top.match.matchType(node.type);
17507 - let nodeMarks = Mark$1.none;
17508 - for (let m of innerMarks.concat(node.marks)) if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, node.type)) nodeMarks = m.addToSet(nodeMarks);
17509 - top.content.push(node.mark(nodeMarks));
17510 - return true;
17511 - }
17512 - return false;
17513 - }
17514 - enter(type, attrs, marks, preserveWS) {
17515 - let innerMarks = this.findPlace(type.create(attrs), marks, false);
17516 - if (innerMarks) innerMarks = this.enterInner(type, attrs, marks, true, preserveWS);
17517 - return innerMarks;
17518 - }
17519 - enterInner(type, attrs, marks, solid = false, preserveWS) {
17520 - this.closeExtra();
17521 - let top = this.top;
17522 - top.match = top.match && top.match.matchType(type);
17523 - let options = wsOptionsFor(type, preserveWS, top.options);
17524 - if (top.options & OPT_OPEN_LEFT && top.content.length == 0) options |= OPT_OPEN_LEFT;
17525 - let applyMarks = Mark$1.none;
17526 - marks = marks.filter((m) => {
17527 - if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, type)) {
17528 - applyMarks = m.addToSet(applyMarks);
17529 - return false;
17530 - }
17531 - return true;
17532 - });
17533 - this.nodes.push(new NodeContext(type, attrs, applyMarks, solid, null, options));
17534 - this.open++;
17535 - return marks;
17536 - }
17537 - closeExtra(openEnd = false) {
17538 - let i = this.nodes.length - 1;
17539 - if (i > this.open) {
17540 - for (; i > this.open; i--) this.nodes[i - 1].content.push(this.nodes[i].finish(openEnd));
17541 - this.nodes.length = this.open + 1;
17542 - }
17543 - }
17544 - finish() {
17545 - this.open = 0;
17546 - this.closeExtra(this.isOpen);
17547 - return this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));
17548 - }
17549 - sync(to) {
17550 - for (let i = this.open; i >= 0; i--) if (this.nodes[i] == to) {
17551 - this.open = i;
17552 - return true;
17553 - } else if (this.localPreserveWS) this.nodes[i].options |= OPT_PRESERVE_WS;
17554 - return false;
17555 - }
17556 - get currentPos() {
17557 - this.closeExtra();
17558 - let pos = 0;
17559 - for (let i = this.open; i >= 0; i--) {
17560 - let content = this.nodes[i].content;
17561 - for (let j = content.length - 1; j >= 0; j--) pos += content[j].nodeSize;
17562 - if (i) pos++;
17563 - }
17564 - return pos;
17565 - }
17566 - findAtPoint(parent, offset) {
17567 - if (this.find) {
17568 - for (let i = 0; i < this.find.length; i++) if (this.find[i].node == parent && this.find[i].offset == offset) this.find[i].pos = this.currentPos;
17569 - }
17570 - }
17571 - findInside(parent) {
17572 - if (this.find) {
17573 - for (let i = 0; i < this.find.length; i++) if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node)) this.find[i].pos = this.currentPos;
17574 - }
17575 - }
17576 - findAround(parent, content, before) {
17577 - if (parent != content && this.find) {
17578 - for (let i = 0; i < this.find.length; i++) if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node)) {
17579 - if (content.compareDocumentPosition(this.find[i].node) & (before ? 2 : 4)) this.find[i].pos = this.currentPos;
17580 - }
17581 - }
17582 - }
17583 - findInText(textNode) {
17584 - if (this.find) {
17585 - for (let i = 0; i < this.find.length; i++) if (this.find[i].node == textNode) this.find[i].pos = this.currentPos - (textNode.nodeValue.length - this.find[i].offset);
17586 - }
17587 - }
17588 - matchesContext(context) {
17589 - if (context.indexOf("|") > -1) return context.split(/\s*\|\s*/).some(this.matchesContext, this);
17590 - let parts = context.split("/");
17591 - let option = this.options.context;
17592 - let useRoot = !this.isOpen && (!option || option.parent.type == this.nodes[0].type);
17593 - let minDepth = -(option ? option.depth + 1 : 0) + (useRoot ? 0 : 1);
17594 - let match = (i, depth) => {
17595 - for (; i >= 0; i--) {
17596 - let part = parts[i];
17597 - if (part == "") {
17598 - if (i == parts.length - 1 || i == 0) continue;
17599 - for (; depth >= minDepth; depth--) if (match(i - 1, depth)) return true;
17600 - return false;
17601 - } else {
17602 - let next = depth > 0 || depth == 0 && useRoot ? this.nodes[depth].type : option && depth >= minDepth ? option.node(depth - minDepth).type : null;
17603 - if (!next || next.name != part && !next.isInGroup(part)) return false;
17604 - depth--;
17605 - }
17606 - }
17607 - return true;
17608 - };
17609 - return match(parts.length - 1, this.open);
17610 - }
17611 - textblockFromContext() {
17612 - let $context = this.options.context;
17613 - if ($context) for (let d = $context.depth; d >= 0; d--) {
17614 - let deflt = $context.node(d).contentMatchAt($context.indexAfter(d)).defaultType;
17615 - if (deflt && deflt.isTextblock && deflt.defaultAttrs) return deflt;
17616 - }
17617 - for (let name in this.parser.schema.nodes) {
17618 - let type = this.parser.schema.nodes[name];
17619 - if (type.isTextblock && type.defaultAttrs) return type;
17620 - }
17621 - }
17622 - };
17623 - function normalizeList(dom) {
17624 - for (let child = dom.firstChild, prevItem = null; child; child = child.nextSibling) {
17625 - let name = child.nodeType == 1 ? child.nodeName.toLowerCase() : null;
17626 - if (name && listTags.hasOwnProperty(name) && prevItem) {
17627 - prevItem.appendChild(child);
17628 - child = prevItem;
17629 - } else if (name == "li") prevItem = child;
17630 - else if (name) prevItem = null;
17631 - }
17632 - }
17633 - function matches(dom, selector) {
17634 - return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector);
17635 - }
17636 - function copy(obj) {
17637 - let copy = {};
17638 - for (let prop in obj) copy[prop] = obj[prop];
17639 - return copy;
17640 - }
17641 - function markMayApply(markType, nodeType) {
17642 - let nodes = nodeType.schema.nodes;
17643 - for (let name in nodes) {
17644 - let parent = nodes[name];
17645 - if (!parent.allowsMarkType(markType)) continue;
17646 - let seen = [];
17647 - let scan = (match) => {
17648 - seen.push(match);
17649 - for (let i = 0; i < match.edgeCount; i++) {
17650 - let { type, next } = match.edge(i);
17651 - if (type == nodeType) return true;
17652 - if (seen.indexOf(next) < 0 && scan(next)) return true;
17653 - }
17654 - };
17655 - if (scan(parent.contentMatch)) return true;
17656 - }
17657 - }
17658 - /**
17659 - A DOM serializer knows how to convert ProseMirror nodes and
17660 - marks of various types to DOM nodes.
17661 - */
17662 - var DOMSerializer = class DOMSerializer {
17663 - /**
17664 - Create a serializer. `nodes` should map node names to functions
17665 - that take a node and return a description of the corresponding
17666 - DOM. `marks` does the same for mark names, but also gets an
17667 - argument that tells it whether the mark's content is block or
17668 - inline content (for typical use, it'll always be inline). A mark
17669 - serializer may be `null` to indicate that marks of that type
17670 - should not be serialized.
17671 - */
17672 - constructor(nodes, marks) {
17673 - this.nodes = nodes;
17674 - this.marks = marks;
17675 - }
17676 - /**
17677 - Serialize the content of this fragment to a DOM fragment. When
17678 - not in the browser, the `document` option, containing a DOM
17679 - document, should be passed so that the serializer can create
17680 - nodes.
17681 - */
17682 - serializeFragment(fragment, options = {}, target) {
17683 - if (!target) target = doc$1(options).createDocumentFragment();
17684 - let top = target;
17685 - let active = [];
17686 - fragment.forEach((node) => {
17687 - if (active.length || node.marks.length) {
17688 - let keep = 0;
17689 - let rendered = 0;
17690 - while (keep < active.length && rendered < node.marks.length) {
17691 - let next = node.marks[rendered];
17692 - if (!this.marks[next.type.name]) {
17693 - rendered++;
17694 - continue;
17695 - }
17696 - if (!next.eq(active[keep][0]) || next.type.spec.spanning === false) break;
17697 - keep++;
17698 - rendered++;
17699 - }
17700 - while (keep < active.length) top = active.pop()[1];
17701 - while (rendered < node.marks.length) {
17702 - let add = node.marks[rendered++];
17703 - let markDOM = this.serializeMark(add, node.isInline, options);
17704 - if (markDOM) {
17705 - active.push([add, top]);
17706 - top.appendChild(markDOM.dom);
17707 - top = markDOM.contentDOM || markDOM.dom;
17708 - }
17709 - }
17710 - }
17711 - top.appendChild(this.serializeNodeInner(node, options));
17712 - });
17713 - return target;
17714 - }
17715 - /**
17716 - @internal
17717 - */
17718 - serializeNodeInner(node, options) {
17719 - let { dom, contentDOM } = renderSpec(doc$1(options), this.nodes[node.type.name](node), null, node.attrs);
17720 - if (contentDOM) {
17721 - if (node.isLeaf) throw new RangeError("Content hole not allowed in a leaf node spec");
17722 - this.serializeFragment(node.content, options, contentDOM);
17723 - }
17724 - return dom;
17725 - }
17726 - /**
17727 - Serialize this node to a DOM node. This can be useful when you
17728 - need to serialize a part of a document, as opposed to the whole
17729 - document. To serialize a whole document, use
17730 - [`serializeFragment`](https://prosemirror.net/docs/ref/#model.DOMSerializer.serializeFragment) on
17731 - its [content](https://prosemirror.net/docs/ref/#model.Node.content).
17732 - */
17733 - serializeNode(node, options = {}) {
17734 - let dom = this.serializeNodeInner(node, options);
17735 - for (let i = node.marks.length - 1; i >= 0; i--) {
17736 - let wrap = this.serializeMark(node.marks[i], node.isInline, options);
17737 - if (wrap) {
17738 - (wrap.contentDOM || wrap.dom).appendChild(dom);
17739 - dom = wrap.dom;
17740 - }
17741 - }
17742 - return dom;
17743 - }
17744 - /**
17745 - @internal
17746 - */
17747 - serializeMark(mark, inline, options = {}) {
17748 - let toDOM = this.marks[mark.type.name];
17749 - return toDOM && renderSpec(doc$1(options), toDOM(mark, inline), null, mark.attrs);
17750 - }
17751 - static renderSpec(doc, structure, xmlNS = null, blockArraysIn) {
17752 - return renderSpec(doc, structure, xmlNS, blockArraysIn);
17753 - }
17754 - /**
17755 - Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
17756 - properties in a schema's node and mark specs.
17757 - */
17758 - static fromSchema(schema) {
17759 - return schema.cached.domSerializer || (schema.cached.domSerializer = new DOMSerializer(this.nodesFromSchema(schema), this.marksFromSchema(schema)));
17760 - }
17761 - /**
17762 - Gather the serializers in a schema's node specs into an object.
17763 - This can be useful as a base to build a custom serializer from.
17764 - */
17765 - static nodesFromSchema(schema) {
17766 - let result = gatherToDOM(schema.nodes);
17767 - if (!result.text) result.text = (node) => node.text;
17768 - return result;
17769 - }
17770 - /**
17771 - Gather the serializers in a schema's mark specs into an object.
17772 - */
17773 - static marksFromSchema(schema) {
17774 - return gatherToDOM(schema.marks);
17775 - }
17776 - };
17777 - function gatherToDOM(obj) {
17778 - let result = {};
17779 - for (let name in obj) {
17780 - let toDOM = obj[name].spec.toDOM;
17781 - if (toDOM) result[name] = toDOM;
17782 - }
17783 - return result;
17784 - }
17785 - function doc$1(options) {
17786 - return options.document || window.document;
17787 - }
17788 - __name(doc$1, "doc");
17789 - var suspiciousAttributeCache = /* @__PURE__ */ new WeakMap();
17790 - function suspiciousAttributes(attrs) {
17791 - let value = suspiciousAttributeCache.get(attrs);
17792 - if (value === void 0) suspiciousAttributeCache.set(attrs, value = suspiciousAttributesInner(attrs));
17793 - return value;
17794 - }
17795 - function suspiciousAttributesInner(attrs) {
17796 - let result = null;
17797 - function scan(value) {
17798 - if (value && typeof value == "object") if (Array.isArray(value)) if (typeof value[0] == "string") {
17799 - if (!result) result = [];
17800 - result.push(value);
17801 - } else for (let i = 0; i < value.length; i++) scan(value[i]);
17802 - else for (let prop in value) scan(value[prop]);
17803 - }
17804 - scan(attrs);
17805 - return result;
17806 - }
17807 - function renderSpec(doc, structure, xmlNS, blockArraysIn) {
17808 - if (typeof structure == "string") return { dom: doc.createTextNode(structure) };
17809 - if (structure.nodeType != null) return { dom: structure };
17810 - if (structure.dom && structure.dom.nodeType != null) return structure;
17811 - let tagName = structure[0];
17812 - let suspicious;
17813 - if (typeof tagName != "string") throw new RangeError("Invalid array passed to renderSpec");
17814 - if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) && suspicious.indexOf(structure) > -1) throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
17815 - let space = tagName.indexOf(" ");
17816 - if (space > 0) {
17817 - xmlNS = tagName.slice(0, space);
17818 - tagName = tagName.slice(space + 1);
17819 - }
17820 - let contentDOM;
17821 - let dom = xmlNS ? doc.createElementNS(xmlNS, tagName) : doc.createElement(tagName);
17822 - let attrs = structure[1];
17823 - let start = 1;
17824 - if (attrs && typeof attrs == "object" && attrs.nodeType == null && !Array.isArray(attrs)) {
17825 - start = 2;
17826 - for (let name in attrs) if (attrs[name] != null) {
17827 - let space = name.indexOf(" ");
17828 - if (space > 0) dom.setAttributeNS(name.slice(0, space), name.slice(space + 1), attrs[name]);
17829 - else if (name == "style" && dom.style) dom.style.cssText = attrs[name];
17830 - else dom.setAttribute(name, attrs[name]);
17831 - }
17832 - }
17833 - for (let i = start; i < structure.length; i++) {
17834 - let child = structure[i];
17835 - if (child === 0) {
17836 - if (i < structure.length - 1 || i > start) throw new RangeError("Content hole must be the only child of its parent node");
17837 - return {
17838 - dom,
17839 - contentDOM: dom
17840 - };
17841 - } else {
17842 - let { dom: inner, contentDOM: innerContent } = renderSpec(doc, child, xmlNS, blockArraysIn);
17843 - dom.appendChild(inner);
17844 - if (innerContent) {
17845 - if (contentDOM) throw new RangeError("Multiple content holes");
17846 - contentDOM = innerContent;
17847 - }
17848 - }
17849 - }
17850 - return {
17851 - dom,
17852 - contentDOM
17853 - };
17854 - }
17855 -
17856 -//#endregion
17857 -//#region node_modules/prosemirror-transform/dist/index.js
17858 - var lower16 = 65535;
17859 - var factor16 = Math.pow(2, 16);
17860 - function makeRecover(index, offset) {
17861 - return index + offset * factor16;
17862 - }
17863 - function recoverIndex(value) {
17864 - return value & lower16;
17865 - }
17866 - function recoverOffset(value) {
17867 - return (value - (value & lower16)) / factor16;
17868 - }
17869 - var DEL_BEFORE = 1;
17870 - var DEL_AFTER = 2;
17871 - var DEL_ACROSS = 4;
17872 - var DEL_SIDE = 8;
17873 - /**
17874 - An object representing a mapped position with extra
17875 - information.
17876 - */
17877 - var MapResult = class {
17878 - /**
17879 - @internal
17880 - */
17881 - constructor(pos, delInfo, recover) {
17882 - this.pos = pos;
17883 - this.delInfo = delInfo;
17884 - this.recover = recover;
17885 - }
17886 - /**
17887 - Tells you whether the position was deleted, that is, whether the
17888 - step removed the token on the side queried (via the `assoc`)
17889 - argument from the document.
17890 - */
17891 - get deleted() {
17892 - return (this.delInfo & DEL_SIDE) > 0;
17893 - }
17894 - /**
17895 - Tells you whether the token before the mapped position was deleted.
17896 - */
17897 - get deletedBefore() {
17898 - return (this.delInfo & 5) > 0;
17899 - }
17900 - /**
17901 - True when the token after the mapped position was deleted.
17902 - */
17903 - get deletedAfter() {
17904 - return (this.delInfo & 6) > 0;
17905 - }
17906 - /**
17907 - Tells whether any of the steps mapped through deletes across the
17908 - position (including both the token before and after the
17909 - position).
17910 - */
17911 - get deletedAcross() {
17912 - return (this.delInfo & DEL_ACROSS) > 0;
17913 - }
17914 - };
17915 - /**
17916 - A map describing the deletions and insertions made by a step, which
17917 - can be used to find the correspondence between positions in the
17918 - pre-step version of a document and the same position in the
17919 - post-step version.
17920 - */
17921 - var StepMap = class StepMap {
17922 - /**
17923 - Create a position map. The modifications to the document are
17924 - represented as an array of numbers, in which each group of three
17925 - represents a modified chunk as `[start, oldSize, newSize]`.
17926 - */
17927 - constructor(ranges, inverted = false) {
17928 - this.ranges = ranges;
17929 - this.inverted = inverted;
17930 - if (!ranges.length && StepMap.empty) return StepMap.empty;
17931 - }
17932 - /**
17933 - @internal
17934 - */
17935 - recover(value) {
17936 - let diff = 0;
17937 - let index = recoverIndex(value);
17938 - if (!this.inverted) for (let i = 0; i < index; i++) diff += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
17939 - return this.ranges[index * 3] + diff + recoverOffset(value);
17940 - }
17941 - mapResult(pos, assoc = 1) {
17942 - return this._map(pos, assoc, false);
17943 - }
17944 - map(pos, assoc = 1) {
17945 - return this._map(pos, assoc, true);
17946 - }
17947 - /**
17948 - @internal
17949 - */
17950 - _map(pos, assoc, simple) {
17951 - let diff = 0;
17952 - let oldIndex = this.inverted ? 2 : 1;
17953 - let newIndex = this.inverted ? 1 : 2;
17954 - for (let i = 0; i < this.ranges.length; i += 3) {
17955 - let start = this.ranges[i] - (this.inverted ? diff : 0);
17956 - if (start > pos) break;
17957 - let oldSize = this.ranges[i + oldIndex];
17958 - let newSize = this.ranges[i + newIndex];
17959 - let end = start + oldSize;
17960 - if (pos <= end) {
17961 - let side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc;
17962 - let result = start + diff + (side < 0 ? 0 : newSize);
17963 - if (simple) return result;
17964 - let recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i / 3, pos - start);
17965 - let del = pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;
17966 - if (assoc < 0 ? pos != start : pos != end) del |= DEL_SIDE;
17967 - return new MapResult(result, del, recover);
17968 - }
17969 - diff += newSize - oldSize;
17970 - }
17971 - return simple ? pos + diff : new MapResult(pos + diff, 0, null);
17972 - }
17973 - /**
17974 - @internal
17975 - */
17976 - touches(pos, recover) {
17977 - let diff = 0;
17978 - let index = recoverIndex(recover);
17979 - let oldIndex = this.inverted ? 2 : 1;
17980 - let newIndex = this.inverted ? 1 : 2;
17981 - for (let i = 0; i < this.ranges.length; i += 3) {
17982 - let start = this.ranges[i] - (this.inverted ? diff : 0);
17983 - if (start > pos) break;
17984 - let oldSize = this.ranges[i + oldIndex];
17985 - if (pos <= start + oldSize && i == index * 3) return true;
17986 - diff += this.ranges[i + newIndex] - oldSize;
17987 - }
17988 - return false;
17989 - }
17990 - /**
17991 - Calls the given function on each of the changed ranges included in
17992 - this map.
17993 - */
17994 - forEach(f) {
17995 - let oldIndex = this.inverted ? 2 : 1;
17996 - let newIndex = this.inverted ? 1 : 2;
17997 - for (let i = 0, diff = 0; i < this.ranges.length; i += 3) {
17998 - let start = this.ranges[i];
17999 - let oldStart = start - (this.inverted ? diff : 0);
18000 - let newStart = start + (this.inverted ? 0 : diff);
18001 - let oldSize = this.ranges[i + oldIndex];
18002 - let newSize = this.ranges[i + newIndex];
18003 - f(oldStart, oldStart + oldSize, newStart, newStart + newSize);
18004 - diff += newSize - oldSize;
18005 - }
18006 - }
18007 - /**
18008 - Create an inverted version of this map. The result can be used to
18009 - map positions in the post-step document to the pre-step document.
18010 - */
18011 - invert() {
18012 - return new StepMap(this.ranges, !this.inverted);
18013 - }
18014 - /**
18015 - @internal
18016 - */
18017 - toString() {
18018 - return (this.inverted ? "-" : "") + JSON.stringify(this.ranges);
18019 - }
18020 - /**
18021 - Create a map that moves all positions by offset `n` (which may be
18022 - negative). This can be useful when applying steps meant for a
18023 - sub-document to a larger document, or vice-versa.
18024 - */
18025 - static offset(n) {
18026 - return n == 0 ? StepMap.empty : new StepMap(n < 0 ? [
18027 - 0,
18028 - -n,
18029 - 0
18030 - ] : [
18031 - 0,
18032 - 0,
18033 - n
18034 - ]);
18035 - }
18036 - };
18037 - /**
18038 - A StepMap that contains no changed ranges.
18039 - */
18040 - StepMap.empty = new StepMap([]);
18041 - /**
18042 - A mapping represents a pipeline of zero or more [step
18043 - maps](https://prosemirror.net/docs/ref/#transform.StepMap). It has special provisions for losslessly
18044 - handling mapping positions through a series of steps in which some
18045 - steps are inverted versions of earlier steps. (This comes up when
18046 - ‘[rebasing](https://prosemirror.net/docs/guide/#transform.rebasing)’ steps for
18047 - collaboration or history management.)
18048 - */
18049 - var Mapping = class Mapping {
18050 - /**
18051 - Create a new mapping with the given position maps.
18052 - */
18053 - constructor(maps, mirror, from = 0, to = maps ? maps.length : 0) {
18054 - this.mirror = mirror;
18055 - this.from = from;
18056 - this.to = to;
18057 - this._maps = maps || [];
18058 - this.ownData = !(maps || mirror);
18059 - }
18060 - /**
18061 - The step maps in this mapping.
18062 - */
18063 - get maps() {
18064 - return this._maps;
18065 - }
18066 - /**
18067 - Create a mapping that maps only through a part of this one.
18068 - */
18069 - slice(from = 0, to = this.maps.length) {
18070 - return new Mapping(this._maps, this.mirror, from, to);
18071 - }
18072 - /**
18073 - Add a step map to the end of this mapping. If `mirrors` is
18074 - given, it should be the index of the step map that is the mirror
18075 - image of this one.
18076 - */
18077 - appendMap(map, mirrors) {
18078 - if (!this.ownData) {
18079 - this._maps = this._maps.slice();
18080 - this.mirror = this.mirror && this.mirror.slice();
18081 - this.ownData = true;
18082 - }
18083 - this.to = this._maps.push(map);
18084 - if (mirrors != null) this.setMirror(this._maps.length - 1, mirrors);
18085 - }
18086 - /**
18087 - Add all the step maps in a given mapping to this one (preserving
18088 - mirroring information).
18089 - */
18090 - appendMapping(mapping) {
18091 - for (let i = 0, startSize = this._maps.length; i < mapping._maps.length; i++) {
18092 - let mirr = mapping.getMirror(i);
18093 - this.appendMap(mapping._maps[i], mirr != null && mirr < i ? startSize + mirr : void 0);
18094 - }
18095 - }
18096 - /**
18097 - Finds the offset of the step map that mirrors the map at the
18098 - given offset, in this mapping (as per the second argument to
18099 - `appendMap`).
18100 - */
18101 - getMirror(n) {
18102 - if (this.mirror) {
18103 - for (let i = 0; i < this.mirror.length; i++) if (this.mirror[i] == n) return this.mirror[i + (i % 2 ? -1 : 1)];
18104 - }
18105 - }
18106 - /**
18107 - @internal
18108 - */
18109 - setMirror(n, m) {
18110 - if (!this.mirror) this.mirror = [];
18111 - this.mirror.push(n, m);
18112 - }
18113 - /**
18114 - Append the inverse of the given mapping to this one.
18115 - */
18116 - appendMappingInverted(mapping) {
18117 - for (let i = mapping.maps.length - 1, totalSize = this._maps.length + mapping._maps.length; i >= 0; i--) {
18118 - let mirr = mapping.getMirror(i);
18119 - this.appendMap(mapping._maps[i].invert(), mirr != null && mirr > i ? totalSize - mirr - 1 : void 0);
18120 - }
18121 - }
18122 - /**
18123 - Create an inverted version of this mapping.
18124 - */
18125 - invert() {
18126 - let inverse = new Mapping();
18127 - inverse.appendMappingInverted(this);
18128 - return inverse;
18129 - }
18130 - /**
18131 - Map a position through this mapping.
18132 - */
18133 - map(pos, assoc = 1) {
18134 - if (this.mirror) return this._map(pos, assoc, true);
18135 - for (let i = this.from; i < this.to; i++) pos = this._maps[i].map(pos, assoc);
18136 - return pos;
18137 - }
18138 - /**
18139 - Map a position through this mapping, returning a mapping
18140 - result.
18141 - */
18142 - mapResult(pos, assoc = 1) {
18143 - return this._map(pos, assoc, false);
18144 - }
18145 - /**
18146 - @internal
18147 - */
18148 - _map(pos, assoc, simple) {
18149 - let delInfo = 0;
18150 - for (let i = this.from; i < this.to; i++) {
18151 - let result = this._maps[i].mapResult(pos, assoc);
18152 - if (result.recover != null) {
18153 - let corr = this.getMirror(i);
18154 - if (corr != null && corr > i && corr < this.to) {
18155 - i = corr;
18156 - pos = this._maps[corr].recover(result.recover);
18157 - continue;
18158 - }
18159 - }
18160 - delInfo |= result.delInfo;
18161 - pos = result.pos;
18162 - }
18163 - return simple ? pos : new MapResult(pos, delInfo, null);
18164 - }
18165 - };
18166 - var stepsByID = Object.create(null);
18167 - /**
18168 - A step object represents an atomic change. It generally applies
18169 - only to the document it was created for, since the positions
18170 - stored in it will only make sense for that document.
18171 -
18172 - New steps are defined by creating classes that extend `Step`,
18173 - overriding the `apply`, `invert`, `map`, `getMap` and `fromJSON`
18174 - methods, and registering your class with a unique
18175 - JSON-serialization identifier using
18176 - [`Step.jsonID`](https://prosemirror.net/docs/ref/#transform.Step^jsonID).
18177 - */
18178 - var Step = class {
18179 - /**
18180 - Get the step map that represents the changes made by this step,
18181 - and which can be used to transform between positions in the old
18182 - and the new document.
18183 - */
18184 - getMap() {
18185 - return StepMap.empty;
18186 - }
18187 - /**
18188 - Try to merge this step with another one, to be applied directly
18189 - after it. Returns the merged step when possible, null if the
18190 - steps can't be merged.
18191 - */
18192 - merge(other) {
18193 - return null;
18194 - }
18195 - /**
18196 - Deserialize a step from its JSON representation. Will call
18197 - through to the step class' own implementation of this method.
18198 - */
18199 - static fromJSON(schema, json) {
18200 - if (!json || !json.stepType) throw new RangeError("Invalid input for Step.fromJSON");
18201 - let type = stepsByID[json.stepType];
18202 - if (!type) throw new RangeError(`No step type ${json.stepType} defined`);
18203 - return type.fromJSON(schema, json);
18204 - }
18205 - /**
18206 - To be able to serialize steps to JSON, each step needs a string
18207 - ID to attach to its JSON representation. Use this method to
18208 - register an ID for your step classes. Try to pick something
18209 - that's unlikely to clash with steps from other modules.
18210 - */
18211 - static jsonID(id, stepClass) {
18212 - if (id in stepsByID) throw new RangeError("Duplicate use of step JSON ID " + id);
18213 - stepsByID[id] = stepClass;
18214 - stepClass.prototype.jsonID = id;
18215 - return stepClass;
18216 - }
18217 - };
18218 - /**
18219 - The result of [applying](https://prosemirror.net/docs/ref/#transform.Step.apply) a step. Contains either a
18220 - new document or a failure value.
18221 - */
18222 - var StepResult = class StepResult {
18223 - /**
18224 - @internal
18225 - */
18226 - constructor(doc, failed) {
18227 - this.doc = doc;
18228 - this.failed = failed;
18229 - }
18230 - /**
18231 - Create a successful step result.
18232 - */
18233 - static ok(doc) {
18234 - return new StepResult(doc, null);
18235 - }
18236 - /**
18237 - Create a failed step result.
18238 - */
18239 - static fail(message) {
18240 - return new StepResult(null, message);
18241 - }
18242 - /**
18243 - Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given
18244 - arguments. Create a successful result if it succeeds, and a
18245 - failed one if it throws a `ReplaceError`.
18246 - */
18247 - static fromReplace(doc, from, to, slice) {
18248 - try {
18249 - return StepResult.ok(doc.replace(from, to, slice));
18250 - } catch (e) {
18251 - if (e instanceof ReplaceError) return StepResult.fail(e.message);
18252 - throw e;
18253 - }
18254 - }
18255 - };
18256 - function mapFragment(fragment, f, parent) {
18257 - let mapped = [];
18258 - for (let i = 0; i < fragment.childCount; i++) {
18259 - let child = fragment.child(i);
18260 - if (child.content.size) child = child.copy(mapFragment(child.content, f, child));
18261 - if (child.isInline) child = f(child, parent, i);
18262 - mapped.push(child);
18263 - }
18264 - return Fragment$1.fromArray(mapped);
18265 - }
18266 - /**
18267 - Add a mark to all inline content between two positions.
18268 - */
18269 - var AddMarkStep = class AddMarkStep extends Step {
18270 - /**
18271 - Create a mark step.
18272 - */
18273 - constructor(from, to, mark) {
18274 - super();
18275 - this.from = from;
18276 - this.to = to;
18277 - this.mark = mark;
18278 - }
18279 - apply(doc) {
18280 - let oldSlice = doc.slice(this.from, this.to);
18281 - let $from = doc.resolve(this.from);
18282 - let parent = $from.node($from.sharedDepth(this.to));
18283 - let slice = new Slice(mapFragment(oldSlice.content, (node, parent) => {
18284 - if (!node.isAtom || !parent.type.allowsMarkType(this.mark.type)) return node;
18285 - return node.mark(this.mark.addToSet(node.marks));
18286 - }, parent), oldSlice.openStart, oldSlice.openEnd);
18287 - return StepResult.fromReplace(doc, this.from, this.to, slice);
18288 - }
18289 - invert() {
18290 - return new RemoveMarkStep(this.from, this.to, this.mark);
18291 - }
18292 - map(mapping) {
18293 - let from = mapping.mapResult(this.from, 1);
18294 - let to = mapping.mapResult(this.to, -1);
18295 - if (from.deleted && to.deleted || from.pos >= to.pos) return null;
18296 - return new AddMarkStep(from.pos, to.pos, this.mark);
18297 - }
18298 - merge(other) {
18299 - if (other instanceof AddMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) return new AddMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
18300 - return null;
18301 - }
18302 - toJSON() {
18303 - return {
18304 - stepType: "addMark",
18305 - mark: this.mark.toJSON(),
18306 - from: this.from,
18307 - to: this.to
18308 - };
18309 - }
18310 - /**
18311 - @internal
18312 - */
18313 - static fromJSON(schema, json) {
18314 - if (typeof json.from != "number" || typeof json.to != "number") throw new RangeError("Invalid input for AddMarkStep.fromJSON");
18315 - return new AddMarkStep(json.from, json.to, schema.markFromJSON(json.mark));
18316 - }
18317 - };
18318 - Step.jsonID("addMark", AddMarkStep);
18319 - /**
18320 - Remove a mark from all inline content between two positions.
18321 - */
18322 - var RemoveMarkStep = class RemoveMarkStep extends Step {
18323 - /**
18324 - Create a mark-removing step.
18325 - */
18326 - constructor(from, to, mark) {
18327 - super();
18328 - this.from = from;
18329 - this.to = to;
18330 - this.mark = mark;
18331 - }
18332 - apply(doc) {
18333 - let oldSlice = doc.slice(this.from, this.to);
18334 - let slice = new Slice(mapFragment(oldSlice.content, (node) => {
18335 - return node.mark(this.mark.removeFromSet(node.marks));
18336 - }, doc), oldSlice.openStart, oldSlice.openEnd);
18337 - return StepResult.fromReplace(doc, this.from, this.to, slice);
18338 - }
18339 - invert() {
18340 - return new AddMarkStep(this.from, this.to, this.mark);
18341 - }
18342 - map(mapping) {
18343 - let from = mapping.mapResult(this.from, 1);
18344 - let to = mapping.mapResult(this.to, -1);
18345 - if (from.deleted && to.deleted || from.pos >= to.pos) return null;
18346 - return new RemoveMarkStep(from.pos, to.pos, this.mark);
18347 - }
18348 - merge(other) {
18349 - if (other instanceof RemoveMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) return new RemoveMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
18350 - return null;
18351 - }
18352 - toJSON() {
18353 - return {
18354 - stepType: "removeMark",
18355 - mark: this.mark.toJSON(),
18356 - from: this.from,
18357 - to: this.to
18358 - };
18359 - }
18360 - /**
18361 - @internal
18362 - */
18363 - static fromJSON(schema, json) {
18364 - if (typeof json.from != "number" || typeof json.to != "number") throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
18365 - return new RemoveMarkStep(json.from, json.to, schema.markFromJSON(json.mark));
18366 - }
18367 - };
18368 - Step.jsonID("removeMark", RemoveMarkStep);
18369 - /**
18370 - Add a mark to a specific node.
18371 - */
18372 - var AddNodeMarkStep = class AddNodeMarkStep extends Step {
18373 - /**
18374 - Create a node mark step.
18375 - */
18376 - constructor(pos, mark) {
18377 - super();
18378 - this.pos = pos;
18379 - this.mark = mark;
18380 - }
18381 - apply(doc) {
18382 - let node = doc.nodeAt(this.pos);
18383 - if (!node) return StepResult.fail("No node at mark step's position");
18384 - let updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));
18385 - return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment$1.from(updated), 0, node.isLeaf ? 0 : 1));
18386 - }
18387 - invert(doc) {
18388 - let node = doc.nodeAt(this.pos);
18389 - if (node) {
18390 - let newSet = this.mark.addToSet(node.marks);
18391 - if (newSet.length == node.marks.length) {
18392 - for (let i = 0; i < node.marks.length; i++) if (!node.marks[i].isInSet(newSet)) return new AddNodeMarkStep(this.pos, node.marks[i]);
18393 - return new AddNodeMarkStep(this.pos, this.mark);
18394 - }
18395 - }
18396 - return new RemoveNodeMarkStep(this.pos, this.mark);
18397 - }
18398 - map(mapping) {
18399 - let pos = mapping.mapResult(this.pos, 1);
18400 - return pos.deletedAfter ? null : new AddNodeMarkStep(pos.pos, this.mark);
18401 - }
18402 - toJSON() {
18403 - return {
18404 - stepType: "addNodeMark",
18405 - pos: this.pos,
18406 - mark: this.mark.toJSON()
18407 - };
18408 - }
18409 - /**
18410 - @internal
18411 - */
18412 - static fromJSON(schema, json) {
18413 - if (typeof json.pos != "number") throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
18414 - return new AddNodeMarkStep(json.pos, schema.markFromJSON(json.mark));
18415 - }
18416 - };
18417 - Step.jsonID("addNodeMark", AddNodeMarkStep);
18418 - /**
18419 - Remove a mark from a specific node.
18420 - */
18421 - var RemoveNodeMarkStep = class RemoveNodeMarkStep extends Step {
18422 - /**
18423 - Create a mark-removing step.
18424 - */
18425 - constructor(pos, mark) {
18426 - super();
18427 - this.pos = pos;
18428 - this.mark = mark;
18429 - }
18430 - apply(doc) {
18431 - let node = doc.nodeAt(this.pos);
18432 - if (!node) return StepResult.fail("No node at mark step's position");
18433 - let updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));
18434 - return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment$1.from(updated), 0, node.isLeaf ? 0 : 1));
18435 - }
18436 - invert(doc) {
18437 - let node = doc.nodeAt(this.pos);
18438 - if (!node || !this.mark.isInSet(node.marks)) return this;
18439 - return new AddNodeMarkStep(this.pos, this.mark);
18440 - }
18441 - map(mapping) {
18442 - let pos = mapping.mapResult(this.pos, 1);
18443 - return pos.deletedAfter ? null : new RemoveNodeMarkStep(pos.pos, this.mark);
18444 - }
18445 - toJSON() {
18446 - return {
18447 - stepType: "removeNodeMark",
18448 - pos: this.pos,
18449 - mark: this.mark.toJSON()
18450 - };
18451 - }
18452 - /**
18453 - @internal
18454 - */
18455 - static fromJSON(schema, json) {
18456 - if (typeof json.pos != "number") throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
18457 - return new RemoveNodeMarkStep(json.pos, schema.markFromJSON(json.mark));
18458 - }
18459 - };
18460 - Step.jsonID("removeNodeMark", RemoveNodeMarkStep);
18461 - /**
18462 - Replace a part of the document with a slice of new content.
18463 - */
18464 - var ReplaceStep = class ReplaceStep extends Step {
18465 - /**
18466 - The given `slice` should fit the 'gap' between `from` and
18467 - `to`—the depths must line up, and the surrounding nodes must be
18468 - able to be joined with the open sides of the slice. When
18469 - `structure` is true, the step will fail if the content between
18470 - from and to is not just a sequence of closing and then opening
18471 - tokens (this is to guard against rebased replace steps
18472 - overwriting something they weren't supposed to).
18473 - */
18474 - constructor(from, to, slice, structure = false) {
18475 - super();
18476 - this.from = from;
18477 - this.to = to;
18478 - this.slice = slice;
18479 - this.structure = structure;
18480 - }
18481 - apply(doc) {
18482 - if (this.structure && contentBetween(doc, this.from, this.to)) return StepResult.fail("Structure replace would overwrite content");
18483 - return StepResult.fromReplace(doc, this.from, this.to, this.slice);
18484 - }
18485 - getMap() {
18486 - return new StepMap([
18487 - this.from,
18488 - this.to - this.from,
18489 - this.slice.size
18490 - ]);
18491 - }
18492 - invert(doc) {
18493 - return new ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to));
18494 - }
18495 - map(mapping) {
18496 - let from = mapping.mapResult(this.from, 1);
18497 - let to = mapping.mapResult(this.to, -1);
18498 - if (from.deletedAcross && to.deletedAcross) return null;
18499 - return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice, this.structure);
18500 - }
18501 - merge(other) {
18502 - if (!(other instanceof ReplaceStep) || other.structure || this.structure) return null;
18503 - if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {
18504 - let slice = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);
18505 - return new ReplaceStep(this.from, this.to + (other.to - other.from), slice, this.structure);
18506 - } else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {
18507 - let slice = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);
18508 - return new ReplaceStep(other.from, this.to, slice, this.structure);
18509 - } else return null;
18510 - }
18511 - toJSON() {
18512 - let json = {
18513 - stepType: "replace",
18514 - from: this.from,
18515 - to: this.to
18516 - };
18517 - if (this.slice.size) json.slice = this.slice.toJSON();
18518 - if (this.structure) json.structure = true;
18519 - return json;
18520 - }
18521 - /**
18522 - @internal
18523 - */
18524 - static fromJSON(schema, json) {
18525 - if (typeof json.from != "number" || typeof json.to != "number") throw new RangeError("Invalid input for ReplaceStep.fromJSON");
18526 - return new ReplaceStep(json.from, json.to, Slice.fromJSON(schema, json.slice), !!json.structure);
18527 - }
18528 - };
18529 - Step.jsonID("replace", ReplaceStep);
18530 - /**
18531 - Replace a part of the document with a slice of content, but
18532 - preserve a range of the replaced content by moving it into the
18533 - slice.
18534 - */
18535 - var ReplaceAroundStep = class ReplaceAroundStep extends Step {
18536 - /**
18537 - Create a replace-around step with the given range and gap.
18538 - `insert` should be the point in the slice into which the content
18539 - of the gap should be moved. `structure` has the same meaning as
18540 - it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.
18541 - */
18542 - constructor(from, to, gapFrom, gapTo, slice, insert, structure = false) {
18543 - super();
18544 - this.from = from;
18545 - this.to = to;
18546 - this.gapFrom = gapFrom;
18547 - this.gapTo = gapTo;
18548 - this.slice = slice;
18549 - this.insert = insert;
18550 - this.structure = structure;
18551 - }
18552 - apply(doc) {
18553 - if (this.structure && (contentBetween(doc, this.from, this.gapFrom) || contentBetween(doc, this.gapTo, this.to))) return StepResult.fail("Structure gap-replace would overwrite content");
18554 - let gap = doc.slice(this.gapFrom, this.gapTo);
18555 - if (gap.openStart || gap.openEnd) return StepResult.fail("Gap is not a flat range");
18556 - let inserted = this.slice.insertAt(this.insert, gap.content);
18557 - if (!inserted) return StepResult.fail("Content does not fit in gap");
18558 - return StepResult.fromReplace(doc, this.from, this.to, inserted);
18559 - }
18560 - getMap() {
18561 - return new StepMap([
18562 - this.from,
18563 - this.gapFrom - this.from,
18564 - this.insert,
18565 - this.gapTo,
18566 - this.to - this.gapTo,
18567 - this.slice.size - this.insert
18568 - ]);
18569 - }
18570 - invert(doc) {
18571 - let gap = this.gapTo - this.gapFrom;
18572 - return new ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
18573 - }
18574 - map(mapping) {
18575 - let from = mapping.mapResult(this.from, 1);
18576 - let to = mapping.mapResult(this.to, -1);
18577 - let gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);
18578 - let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);
18579 - if (from.deletedAcross && to.deletedAcross || gapFrom < from.pos || gapTo > to.pos) return null;
18580 - return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
18581 - }
18582 - toJSON() {
18583 - let json = {
18584 - stepType: "replaceAround",
18585 - from: this.from,
18586 - to: this.to,
18587 - gapFrom: this.gapFrom,
18588 - gapTo: this.gapTo,
18589 - insert: this.insert
18590 - };
18591 - if (this.slice.size) json.slice = this.slice.toJSON();
18592 - if (this.structure) json.structure = true;
18593 - return json;
18594 - }
18595 - /**
18596 - @internal
18597 - */
18598 - static fromJSON(schema, json) {
18599 - if (typeof json.from != "number" || typeof json.to != "number" || typeof json.gapFrom != "number" || typeof json.gapTo != "number" || typeof json.insert != "number") throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
18600 - return new ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo, Slice.fromJSON(schema, json.slice), json.insert, !!json.structure);
18601 - }
18602 - };
18603 - Step.jsonID("replaceAround", ReplaceAroundStep);
18604 - function contentBetween(doc, from, to) {
18605 - let $from = doc.resolve(from);
18606 - let dist = to - from;
18607 - let depth = $from.depth;
18608 - while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {
18609 - depth--;
18610 - dist--;
18611 - }
18612 - if (dist > 0) {
18613 - let next = $from.node(depth).maybeChild($from.indexAfter(depth));
18614 - while (dist > 0) {
18615 - if (!next || next.isLeaf) return true;
18616 - next = next.firstChild;
18617 - dist--;
18618 - }
18619 - }
18620 - return false;
18621 - }
18622 - function addMark(tr, from, to, mark) {
18623 - let removed = [];
18624 - let added = [];
18625 - let removing;
18626 - let adding;
18627 - tr.doc.nodesBetween(from, to, (node, pos, parent) => {
18628 - if (!node.isInline) return;
18629 - let marks = node.marks;
18630 - if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {
18631 - let start = Math.max(pos, from);
18632 - let end = Math.min(pos + node.nodeSize, to);
18633 - let newSet = mark.addToSet(marks);
18634 - for (let i = 0; i < marks.length; i++) if (!marks[i].isInSet(newSet)) if (removing && removing.to == start && removing.mark.eq(marks[i])) removing.to = end;
18635 - else removed.push(removing = new RemoveMarkStep(start, end, marks[i]));
18636 - if (adding && adding.to == start) adding.to = end;
18637 - else added.push(adding = new AddMarkStep(start, end, mark));
18638 - }
18639 - });
18640 - removed.forEach((s) => tr.step(s));
18641 - added.forEach((s) => tr.step(s));
18642 - }
18643 - function removeMark(tr, from, to, mark) {
18644 - let matched = [];
18645 - let step = 0;
18646 - tr.doc.nodesBetween(from, to, (node, pos) => {
18647 - if (!node.isInline) return;
18648 - step++;
18649 - let toRemove = null;
18650 - if (mark instanceof MarkType) {
18651 - let set = node.marks;
18652 - let found;
18653 - while (found = mark.isInSet(set)) {
18654 - (toRemove || (toRemove = [])).push(found);
18655 - set = found.removeFromSet(set);
18656 - }
18657 - } else if (mark) {
18658 - if (mark.isInSet(node.marks)) toRemove = [mark];
18659 - } else toRemove = node.marks;
18660 - if (toRemove && toRemove.length) {
18661 - let end = Math.min(pos + node.nodeSize, to);
18662 - for (let i = 0; i < toRemove.length; i++) {
18663 - let style = toRemove[i];
18664 - let found;
18665 - for (let j = 0; j < matched.length; j++) {
18666 - let m = matched[j];
18667 - if (m.step == step - 1 && style.eq(matched[j].style)) found = m;
18668 - }
18669 - if (found) {
18670 - found.to = end;
18671 - found.step = step;
18672 - } else matched.push({
18673 - style,
18674 - from: Math.max(pos, from),
18675 - to: end,
18676 - step
18677 - });
18678 - }
18679 - }
18680 - });
18681 - matched.forEach((m) => tr.step(new RemoveMarkStep(m.from, m.to, m.style)));
18682 - }
18683 - function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {
18684 - let node = tr.doc.nodeAt(pos);
18685 - let replSteps = [];
18686 - let cur = pos + 1;
18687 - for (let i = 0; i < node.childCount; i++) {
18688 - let child = node.child(i);
18689 - let end = cur + child.nodeSize;
18690 - let allowed = match.matchType(child.type);
18691 - if (!allowed) replSteps.push(new ReplaceStep(cur, end, Slice.empty));
18692 - else {
18693 - match = allowed;
18694 - for (let j = 0; j < child.marks.length; j++) if (!parentType.allowsMarkType(child.marks[j].type)) tr.step(new RemoveMarkStep(cur, end, child.marks[j]));
18695 - if (clearNewlines && child.isText && parentType.whitespace != "pre") {
18696 - let m;
18697 - let newline = /\r?\n|\r/g;
18698 - let slice;
18699 - while (m = newline.exec(child.text)) {
18700 - if (!slice) slice = new Slice(Fragment$1.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
18701 - replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice));
18702 - }
18703 - }
18704 - }
18705 - cur = end;
18706 - }
18707 - if (!match.validEnd) {
18708 - let fill = match.fillBefore(Fragment$1.empty, true);
18709 - tr.replace(cur, cur, new Slice(fill, 0, 0));
18710 - }
18711 - for (let i = replSteps.length - 1; i >= 0; i--) tr.step(replSteps[i]);
18712 - }
18713 - function canCut(node, start, end) {
18714 - return (start == 0 || node.canReplace(start, node.childCount)) && (end == node.childCount || node.canReplace(0, end));
18715 - }
18716 - /**
18717 - Try to find a target depth to which the content in the given range
18718 - can be lifted. Will not go across
18719 - [isolating](https://prosemirror.net/docs/ref/#model.NodeSpec.isolating) parent nodes.
18720 - */
18721 - function liftTarget(range) {
18722 - let content = range.parent.content.cutByIndex(range.startIndex, range.endIndex);
18723 - for (let depth = range.depth, contentBefore = 0, contentAfter = 0;; --depth) {
18724 - let node = range.$from.node(depth);
18725 - let index = range.$from.index(depth) + contentBefore;
18726 - let endIndex = range.$to.indexAfter(depth) - contentAfter;
18727 - if (depth < range.depth && node.canReplace(index, endIndex, content)) return depth;
18728 - if (depth == 0 || node.type.spec.isolating || !canCut(node, index, endIndex)) break;
18729 - if (index) contentBefore = 1;
18730 - if (endIndex < node.childCount) contentAfter = 1;
18731 - }
18732 - return null;
18733 - }
18734 - function lift$2(tr, range, target) {
18735 - let { $from, $to, depth } = range;
18736 - let gapStart = $from.before(depth + 1);
18737 - let gapEnd = $to.after(depth + 1);
18738 - let start = gapStart;
18739 - let end = gapEnd;
18740 - let before = Fragment$1.empty;
18741 - let openStart = 0;
18742 - for (let d = depth, splitting = false; d > target; d--) if (splitting || $from.index(d) > 0) {
18743 - splitting = true;
18744 - before = Fragment$1.from($from.node(d).copy(before));
18745 - openStart++;
18746 - } else start--;
18747 - let after = Fragment$1.empty;
18748 - let openEnd = 0;
18749 - for (let d = depth, splitting = false; d > target; d--) if (splitting || $to.after(d + 1) < $to.end(d)) {
18750 - splitting = true;
18751 - after = Fragment$1.from($to.node(d).copy(after));
18752 - openEnd++;
18753 - } else end++;
18754 - tr.step(new ReplaceAroundStep(start, end, gapStart, gapEnd, new Slice(before.append(after), openStart, openEnd), before.size - openStart, true));
18755 - }
18756 - __name(lift$2, "lift");
18757 - /**
18758 - Try to find a valid way to wrap the content in the given range in a
18759 - node of the given type. May introduce extra nodes around and inside
18760 - the wrapper node, if necessary. Returns null if no valid wrapping
18761 - could be found. When `innerRange` is given, that range's content is
18762 - used as the content to fit into the wrapping, instead of the
18763 - content of `range`.
18764 - */
18765 - function findWrapping(range, nodeType, attrs = null, innerRange = range) {
18766 - let around = findWrappingOutside(range, nodeType);
18767 - let inner = around && findWrappingInside(innerRange, nodeType);
18768 - if (!inner) return null;
18769 - return around.map(withAttrs).concat({
18770 - type: nodeType,
18771 - attrs
18772 - }).concat(inner.map(withAttrs));
18773 - }
18774 - function withAttrs(type) {
18775 - return {
18776 - type,
18777 - attrs: null
18778 - };
18779 - }
18780 - function findWrappingOutside(range, type) {
18781 - let { parent, startIndex, endIndex } = range;
18782 - let around = parent.contentMatchAt(startIndex).findWrapping(type);
18783 - if (!around) return null;
18784 - let outer = around.length ? around[0] : type;
18785 - return parent.canReplaceWith(startIndex, endIndex, outer) ? around : null;
18786 - }
18787 - function findWrappingInside(range, type) {
18788 - let { parent, startIndex, endIndex } = range;
18789 - let inner = parent.child(startIndex);
18790 - let inside = type.contentMatch.findWrapping(inner.type);
18791 - if (!inside) return null;
18792 - let innerMatch = (inside.length ? inside[inside.length - 1] : type).contentMatch;
18793 - for (let i = startIndex; innerMatch && i < endIndex; i++) innerMatch = innerMatch.matchType(parent.child(i).type);
18794 - if (!innerMatch || !innerMatch.validEnd) return null;
18795 - return inside;
18796 - }
18797 - function wrap(tr, range, wrappers) {
18798 - let content = Fragment$1.empty;
18799 - for (let i = wrappers.length - 1; i >= 0; i--) {
18800 - if (content.size) {
18801 - let match = wrappers[i].type.contentMatch.matchFragment(content);
18802 - if (!match || !match.validEnd) throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
18803 - }
18804 - content = Fragment$1.from(wrappers[i].type.create(wrappers[i].attrs, content));
18805 - }
18806 - let start = range.start;
18807 - let end = range.end;
18808 - tr.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true));
18809 - }
18810 - function setBlockType$1(tr, from, to, type, attrs) {
18811 - if (!type.isTextblock) throw new RangeError("Type given to setBlockType should be a textblock");
18812 - let mapFrom = tr.steps.length;
18813 - tr.doc.nodesBetween(from, to, (node, pos) => {
18814 - let attrsHere = typeof attrs == "function" ? attrs(node) : attrs;
18815 - if (node.isTextblock && !node.hasMarkup(type, attrsHere) && canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) {
18816 - let convertNewlines = null;
18817 - if (type.schema.linebreakReplacement) {
18818 - let pre = type.whitespace == "pre";
18819 - let supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement);
18820 - if (pre && !supportLinebreak) convertNewlines = false;
18821 - else if (!pre && supportLinebreak) convertNewlines = true;
18822 - }
18823 - if (convertNewlines === false) replaceLinebreaks(tr, node, pos, mapFrom);
18824 - clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, void 0, convertNewlines === null);
18825 - let mapping = tr.mapping.slice(mapFrom);
18826 - let startM = mapping.map(pos, 1);
18827 - let endM = mapping.map(pos + node.nodeSize, 1);
18828 - tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment$1.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));
18829 - if (convertNewlines === true) replaceNewlines(tr, node, pos, mapFrom);
18830 - return false;
18831 - }
18832 - });
18833 - }
18834 - __name(setBlockType$1, "setBlockType");
18835 - function replaceNewlines(tr, node, pos, mapFrom) {
18836 - node.forEach((child, offset) => {
18837 - if (child.isText) {
18838 - let m;
18839 - let newline = /\r?\n|\r/g;
18840 - while (m = newline.exec(child.text)) {
18841 - let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);
18842 - tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());
18843 - }
18844 - }
18845 - });
18846 - }
18847 - function replaceLinebreaks(tr, node, pos, mapFrom) {
18848 - node.forEach((child, offset) => {
18849 - if (child.type == child.type.schema.linebreakReplacement) {
18850 - let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset);
18851 - tr.replaceWith(start, start + 1, node.type.schema.text("\n"));
18852 - }
18853 - });
18854 - }
18855 - function canChangeType(doc, pos, type) {
18856 - let $pos = doc.resolve(pos);
18857 - let index = $pos.index();
18858 - return $pos.parent.canReplaceWith(index, index + 1, type);
18859 - }
18860 - /**
18861 - Change the type, attributes, and/or marks of the node at `pos`.
18862 - When `type` isn't given, the existing node type is preserved,
18863 - */
18864 - function setNodeMarkup(tr, pos, type, attrs, marks) {
18865 - let node = tr.doc.nodeAt(pos);
18866 - if (!node) throw new RangeError("No node at given position");
18867 - if (!type) type = node.type;
18868 - let newNode = type.create(attrs, null, marks || node.marks);
18869 - if (node.isLeaf) return tr.replaceWith(pos, pos + node.nodeSize, newNode);
18870 - if (!type.validContent(node.content)) throw new RangeError("Invalid content for node type " + type.name);
18871 - tr.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new Slice(Fragment$1.from(newNode), 0, 0), 1, true));
18872 - }
18873 - /**
18874 - Check whether splitting at the given position is allowed.
18875 - */
18876 - function canSplit(doc, pos, depth = 1, typesAfter) {
18877 - let $pos = doc.resolve(pos);
18878 - let base = $pos.depth - depth;
18879 - let innerType = typesAfter && typesAfter[typesAfter.length - 1] || $pos.parent;
18880 - if (base < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount))) return false;
18881 - for (let d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {
18882 - let node = $pos.node(d);
18883 - let index = $pos.index(d);
18884 - if (node.type.spec.isolating) return false;
18885 - let rest = node.content.cutByIndex(index, node.childCount);
18886 - let overrideChild = typesAfter && typesAfter[i + 1];
18887 - if (overrideChild) rest = rest.replaceChild(0, overrideChild.type.create(overrideChild.attrs));
18888 - let after = typesAfter && typesAfter[i] || node;
18889 - if (!node.canReplace(index + 1, node.childCount) || !after.type.validContent(rest)) return false;
18890 - }
18891 - let index = $pos.indexAfter(base);
18892 - let baseType = typesAfter && typesAfter[0];
18893 - return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type);
18894 - }
18895 - function split(tr, pos, depth = 1, typesAfter) {
18896 - let $pos = tr.doc.resolve(pos);
18897 - let before = Fragment$1.empty;
18898 - let after = Fragment$1.empty;
18899 - for (let d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {
18900 - before = Fragment$1.from($pos.node(d).copy(before));
18901 - let typeAfter = typesAfter && typesAfter[i];
18902 - after = Fragment$1.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));
18903 - }
18904 - tr.step(new ReplaceStep(pos, pos, new Slice(before.append(after), depth, depth), true));
18905 - }
18906 - /**
18907 - Test whether the blocks before and after a given position can be
18908 - joined.
18909 - */
18910 - function canJoin(doc, pos) {
18911 - let $pos = doc.resolve(pos);
18912 - let index = $pos.index();
18913 - return joinable($pos.nodeBefore, $pos.nodeAfter) && $pos.parent.canReplace(index, index + 1);
18914 - }
18915 - function canAppendWithSubstitutedLinebreaks(a, b) {
18916 - if (!b.content.size) a.type.compatibleContent(b.type);
18917 - let match = a.contentMatchAt(a.childCount);
18918 - let { linebreakReplacement } = a.type.schema;
18919 - for (let i = 0; i < b.childCount; i++) {
18920 - let child = b.child(i);
18921 - let type = child.type == linebreakReplacement ? a.type.schema.nodes.text : child.type;
18922 - match = match.matchType(type);
18923 - if (!match) return false;
18924 - if (!a.type.allowsMarks(child.marks)) return false;
18925 - }
18926 - return match.validEnd;
18927 - }
18928 - function joinable(a, b) {
18929 - return !!(a && b && !a.isLeaf && canAppendWithSubstitutedLinebreaks(a, b));
18930 - }
18931 - /**
18932 - Find an ancestor of the given position that can be joined to the
18933 - block before (or after if `dir` is positive). Returns the joinable
18934 - point, if any.
18935 - */
18936 - function joinPoint(doc, pos, dir = -1) {
18937 - let $pos = doc.resolve(pos);
18938 - for (let d = $pos.depth;; d--) {
18939 - let before;
18940 - let after;
18941 - let index = $pos.index(d);
18942 - if (d == $pos.depth) {
18943 - before = $pos.nodeBefore;
18944 - after = $pos.nodeAfter;
18945 - } else if (dir > 0) {
18946 - before = $pos.node(d + 1);
18947 - index++;
18948 - after = $pos.node(d).maybeChild(index);
18949 - } else {
18950 - before = $pos.node(d).maybeChild(index - 1);
18951 - after = $pos.node(d + 1);
18952 - }
18953 - if (before && !before.isTextblock && joinable(before, after) && $pos.node(d).canReplace(index, index + 1)) return pos;
18954 - if (d == 0) break;
18955 - pos = dir < 0 ? $pos.before(d) : $pos.after(d);
18956 - }
18957 - }
18958 - function join(tr, pos, depth) {
18959 - let convertNewlines = null;
18960 - let { linebreakReplacement } = tr.doc.type.schema;
18961 - let $before = tr.doc.resolve(pos - depth);
18962 - let beforeType = $before.node().type;
18963 - if (linebreakReplacement && beforeType.inlineContent) {
18964 - let pre = beforeType.whitespace == "pre";
18965 - let supportLinebreak = !!beforeType.contentMatch.matchType(linebreakReplacement);
18966 - if (pre && !supportLinebreak) convertNewlines = false;
18967 - else if (!pre && supportLinebreak) convertNewlines = true;
18968 - }
18969 - let mapFrom = tr.steps.length;
18970 - if (convertNewlines === false) {
18971 - let $after = tr.doc.resolve(pos + depth);
18972 - replaceLinebreaks(tr, $after.node(), $after.before(), mapFrom);
18973 - }
18974 - if (beforeType.inlineContent) clearIncompatible(tr, pos + depth - 1, beforeType, $before.node().contentMatchAt($before.index()), convertNewlines == null);
18975 - let mapping = tr.mapping.slice(mapFrom);
18976 - let start = mapping.map(pos - depth);
18977 - tr.step(new ReplaceStep(start, mapping.map(pos + depth, -1), Slice.empty, true));
18978 - if (convertNewlines === true) {
18979 - let $full = tr.doc.resolve(start);
18980 - replaceNewlines(tr, $full.node(), $full.before(), tr.steps.length);
18981 - }
18982 - return tr;
18983 - }
18984 - /**
18985 - Try to find a point where a node of the given type can be inserted
18986 - near `pos`, by searching up the node hierarchy when `pos` itself
18987 - isn't a valid place but is at the start or end of a node. Return
18988 - null if no position was found.
18989 - */
18990 - function insertPoint(doc, pos, nodeType) {
18991 - let $pos = doc.resolve(pos);
18992 - if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType)) return pos;
18993 - if ($pos.parentOffset == 0) for (let d = $pos.depth - 1; d >= 0; d--) {
18994 - let index = $pos.index(d);
18995 - if ($pos.node(d).canReplaceWith(index, index, nodeType)) return $pos.before(d + 1);
18996 - if (index > 0) return null;
18997 - }
18998 - if ($pos.parentOffset == $pos.parent.content.size) for (let d = $pos.depth - 1; d >= 0; d--) {
18999 - let index = $pos.indexAfter(d);
19000 - if ($pos.node(d).canReplaceWith(index, index, nodeType)) return $pos.after(d + 1);
19001 - if (index < $pos.node(d).childCount) return null;
19002 - }
19003 - return null;
19004 - }
19005 - /**
19006 - Finds a position at or around the given position where the given
19007 - slice can be inserted. Will look at parent nodes' nearest boundary
19008 - and try there, even if the original position wasn't directly at the
19009 - start or end of that node. Returns null when no position was found.
19010 - */
19011 - function dropPoint(doc, pos, slice) {
19012 - let $pos = doc.resolve(pos);
19013 - if (!slice.content.size) return pos;
19014 - let content = slice.content;
19015 - for (let i = 0; i < slice.openStart; i++) content = content.firstChild.content;
19016 - for (let pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) for (let d = $pos.depth; d >= 0; d--) {
19017 - let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;
19018 - let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);
19019 - let parent = $pos.node(d);
19020 - let fits = false;
19021 - if (pass == 1) fits = parent.canReplace(insertPos, insertPos, content);
19022 - else {
19023 - let wrapping = parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);
19024 - fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);
19025 - }
19026 - if (fits) return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1);
19027 - }
19028 - return null;
19029 - }
19030 - /**
19031 - ‘Fit’ a slice into a given position in the document, producing a
19032 - [step](https://prosemirror.net/docs/ref/#transform.Step) that inserts it. Will return null if
19033 - there's no meaningful way to insert the slice here, or inserting it
19034 - would be a no-op (an empty slice over an empty range).
19035 - */
19036 - function replaceStep(doc, from, to = from, slice = Slice.empty) {
19037 - if (from == to && !slice.size) return null;
19038 - let $from = doc.resolve(from);
19039 - let $to = doc.resolve(to);
19040 - if (fitsTrivially($from, $to, slice)) return new ReplaceStep(from, to, slice);
19041 - return new Fitter($from, $to, slice).fit();
19042 - }
19043 - function fitsTrivially($from, $to, slice) {
19044 - return !slice.openStart && !slice.openEnd && $from.start() == $to.start() && $from.parent.canReplace($from.index(), $to.index(), slice.content);
19045 - }
19046 - var Fitter = class {
19047 - constructor($from, $to, unplaced) {
19048 - this.$from = $from;
19049 - this.$to = $to;
19050 - this.unplaced = unplaced;
19051 - this.frontier = [];
19052 - this.placed = Fragment$1.empty;
19053 - for (let i = 0; i <= $from.depth; i++) {
19054 - let node = $from.node(i);
19055 - this.frontier.push({
19056 - type: node.type,
19057 - match: node.contentMatchAt($from.indexAfter(i))
19058 - });
19059 - }
19060 - for (let i = $from.depth; i > 0; i--) this.placed = Fragment$1.from($from.node(i).copy(this.placed));
19061 - }
19062 - get depth() {
19063 - return this.frontier.length - 1;
19064 - }
19065 - fit() {
19066 - while (this.unplaced.size) {
19067 - let fit = this.findFittable();
19068 - if (fit) this.placeNodes(fit);
19069 - else this.openMore() || this.dropNode();
19070 - }
19071 - let moveInline = this.mustMoveInline();
19072 - let placedSize = this.placed.size - this.depth - this.$from.depth;
19073 - let $from = this.$from;
19074 - let $to = this.close(moveInline < 0 ? this.$to : $from.doc.resolve(moveInline));
19075 - if (!$to) return null;
19076 - let content = this.placed;
19077 - let openStart = $from.depth;
19078 - let openEnd = $to.depth;
19079 - while (openStart && openEnd && content.childCount == 1) {
19080 - content = content.firstChild.content;
19081 - openStart--;
19082 - openEnd--;
19083 - }
19084 - let slice = new Slice(content, openStart, openEnd);
19085 - if (moveInline > -1) return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice, placedSize);
19086 - if (slice.size || $from.pos != this.$to.pos) return new ReplaceStep($from.pos, $to.pos, slice);
19087 - return null;
19088 - }
19089 - findFittable() {
19090 - let startDepth = this.unplaced.openStart;
19091 - for (let cur = this.unplaced.content, d = 0, openEnd = this.unplaced.openEnd; d < startDepth; d++) {
19092 - let node = cur.firstChild;
19093 - if (cur.childCount > 1) openEnd = 0;
19094 - if (node.type.spec.isolating && openEnd <= d) {
19095 - startDepth = d;
19096 - break;
19097 - }
19098 - cur = node.content;
19099 - }
19100 - for (let pass = 1; pass <= 2; pass++) for (let sliceDepth = pass == 1 ? startDepth : this.unplaced.openStart; sliceDepth >= 0; sliceDepth--) {
19101 - let fragment;
19102 - let parent = null;
19103 - if (sliceDepth) {
19104 - parent = contentAt(this.unplaced.content, sliceDepth - 1).firstChild;
19105 - fragment = parent.content;
19106 - } else fragment = this.unplaced.content;
19107 - let first = fragment.firstChild;
19108 - for (let frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {
19109 - let { type, match } = this.frontier[frontierDepth], wrap, inject = null;
19110 - if (pass == 1 && (first ? match.matchType(first.type) || (inject = match.fillBefore(Fragment$1.from(first), false)) : parent && type.compatibleContent(parent.type))) return {
19111 - sliceDepth,
19112 - frontierDepth,
19113 - parent,
19114 - inject
19115 - };
19116 - else if (pass == 2 && first && (wrap = match.findWrapping(first.type))) return {
19117 - sliceDepth,
19118 - frontierDepth,
19119 - parent,
19120 - wrap
19121 - };
19122 - if (parent && match.matchType(parent.type)) break;
19123 - }
19124 - }
19125 - }
19126 - openMore() {
19127 - let { content, openStart, openEnd } = this.unplaced;
19128 - let inner = contentAt(content, openStart);
19129 - if (!inner.childCount || inner.firstChild.isLeaf) return false;
19130 - this.unplaced = new Slice(content, openStart + 1, Math.max(openEnd, inner.size + openStart >= content.size - openEnd ? openStart + 1 : 0));
19131 - return true;
19132 - }
19133 - dropNode() {
19134 - let { content, openStart, openEnd } = this.unplaced;
19135 - let inner = contentAt(content, openStart);
19136 - if (inner.childCount <= 1 && openStart > 0) {
19137 - let openAtEnd = content.size - openStart <= openStart + inner.size;
19138 - this.unplaced = new Slice(dropFromFragment(content, openStart - 1, 1), openStart - 1, openAtEnd ? openStart - 1 : openEnd);
19139 - } else this.unplaced = new Slice(dropFromFragment(content, openStart, 1), openStart, openEnd);
19140 - }
19141 - placeNodes({ sliceDepth, frontierDepth, parent, inject, wrap }) {
19142 - while (this.depth > frontierDepth) this.closeFrontierNode();
19143 - if (wrap) for (let i = 0; i < wrap.length; i++) this.openFrontierNode(wrap[i]);
19144 - let slice = this.unplaced;
19145 - let fragment = parent ? parent.content : slice.content;
19146 - let openStart = slice.openStart - sliceDepth;
19147 - let taken = 0;
19148 - let add = [];
19149 - let { match, type } = this.frontier[frontierDepth];
19150 - if (inject) {
19151 - for (let i = 0; i < inject.childCount; i++) add.push(inject.child(i));
19152 - match = match.matchFragment(inject);
19153 - }
19154 - let openEndCount = fragment.size + sliceDepth - (slice.content.size - slice.openEnd);
19155 - while (taken < fragment.childCount) {
19156 - let next = fragment.child(taken);
19157 - let matches = match.matchType(next.type);
19158 - if (!matches) break;
19159 - taken++;
19160 - if (taken > 1 || openStart == 0 || next.content.size) {
19161 - match = matches;
19162 - add.push(closeNodeStart(next.mark(type.allowedMarks(next.marks)), taken == 1 ? openStart : 0, taken == fragment.childCount ? openEndCount : -1));
19163 - }
19164 - }
19165 - let toEnd = taken == fragment.childCount;
19166 - if (!toEnd) openEndCount = -1;
19167 - this.placed = addToFragment(this.placed, frontierDepth, Fragment$1.from(add));
19168 - this.frontier[frontierDepth].match = match;
19169 - if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1) this.closeFrontierNode();
19170 - for (let i = 0, cur = fragment; i < openEndCount; i++) {
19171 - let node = cur.lastChild;
19172 - this.frontier.push({
19173 - type: node.type,
19174 - match: node.contentMatchAt(node.childCount)
19175 - });
19176 - cur = node.content;
19177 - }
19178 - this.unplaced = !toEnd ? new Slice(dropFromFragment(slice.content, sliceDepth, taken), slice.openStart, slice.openEnd) : sliceDepth == 0 ? Slice.empty : new Slice(dropFromFragment(slice.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1);
19179 - }
19180 - mustMoveInline() {
19181 - if (!this.$to.parent.isTextblock) return -1;
19182 - let top = this.frontier[this.depth];
19183 - let level;
19184 - if (!top.type.isTextblock || !contentAfterFits(this.$to, this.$to.depth, top.type, top.match, false) || this.$to.depth == this.depth && (level = this.findCloseLevel(this.$to)) && level.depth == this.depth) return -1;
19185 - let { depth } = this.$to, after = this.$to.after(depth);
19186 - while (depth > 1 && after == this.$to.end(--depth)) ++after;
19187 - return after;
19188 - }
19189 - findCloseLevel($to) {
19190 - scan: for (let i = Math.min(this.depth, $to.depth); i >= 0; i--) {
19191 - let { match, type } = this.frontier[i];
19192 - let dropInner = i < $to.depth && $to.end(i + 1) == $to.pos + ($to.depth - (i + 1));
19193 - let fit = contentAfterFits($to, i, type, match, dropInner);
19194 - if (!fit) continue;
19195 - for (let d = i - 1; d >= 0; d--) {
19196 - let { match, type } = this.frontier[d];
19197 - let matches = contentAfterFits($to, d, type, match, true);
19198 - if (!matches || matches.childCount) continue scan;
19199 - }
19200 - return {
19201 - depth: i,
19202 - fit,
19203 - move: dropInner ? $to.doc.resolve($to.after(i + 1)) : $to
19204 - };
19205 - }
19206 - }
19207 - close($to) {
19208 - let close = this.findCloseLevel($to);
19209 - if (!close) return null;
19210 - while (this.depth > close.depth) this.closeFrontierNode();
19211 - if (close.fit.childCount) this.placed = addToFragment(this.placed, close.depth, close.fit);
19212 - $to = close.move;
19213 - for (let d = close.depth + 1; d <= $to.depth; d++) {
19214 - let node = $to.node(d);
19215 - let add = node.type.contentMatch.fillBefore(node.content, true, $to.index(d));
19216 - this.openFrontierNode(node.type, node.attrs, add);
19217 - }
19218 - return $to;
19219 - }
19220 - openFrontierNode(type, attrs = null, content) {
19221 - let top = this.frontier[this.depth];
19222 - top.match = top.match.matchType(type);
19223 - this.placed = addToFragment(this.placed, this.depth, Fragment$1.from(type.create(attrs, content)));
19224 - this.frontier.push({
19225 - type,
19226 - match: type.contentMatch
19227 - });
19228 - }
19229 - closeFrontierNode() {
19230 - let add = this.frontier.pop().match.fillBefore(Fragment$1.empty, true);
19231 - if (add.childCount) this.placed = addToFragment(this.placed, this.frontier.length, add);
19232 - }
19233 - };
19234 - function dropFromFragment(fragment, depth, count) {
19235 - if (depth == 0) return fragment.cutByIndex(count, fragment.childCount);
19236 - return fragment.replaceChild(0, fragment.firstChild.copy(dropFromFragment(fragment.firstChild.content, depth - 1, count)));
19237 - }
19238 - function addToFragment(fragment, depth, content) {
19239 - if (depth == 0) return fragment.append(content);
19240 - return fragment.replaceChild(fragment.childCount - 1, fragment.lastChild.copy(addToFragment(fragment.lastChild.content, depth - 1, content)));
19241 - }
19242 - function contentAt(fragment, depth) {
19243 - for (let i = 0; i < depth; i++) fragment = fragment.firstChild.content;
19244 - return fragment;
19245 - }
19246 - function closeNodeStart(node, openStart, openEnd) {
19247 - if (openStart <= 0) return node;
19248 - let frag = node.content;
19249 - if (openStart > 1) frag = frag.replaceChild(0, closeNodeStart(frag.firstChild, openStart - 1, frag.childCount == 1 ? openEnd - 1 : 0));
19250 - if (openStart > 0) {
19251 - frag = node.type.contentMatch.fillBefore(frag).append(frag);
19252 - if (openEnd <= 0) frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(Fragment$1.empty, true));
19253 - }
19254 - return node.copy(frag);
19255 - }
19256 - function contentAfterFits($to, depth, type, match, open) {
19257 - let node = $to.node(depth);
19258 - let index = open ? $to.indexAfter(depth) : $to.index(depth);
19259 - if (index == node.childCount && !type.compatibleContent(node.type)) return null;
19260 - let fit = match.fillBefore(node.content, true, index);
19261 - return fit && !invalidMarks(type, node.content, index) ? fit : null;
19262 - }
19263 - function invalidMarks(type, fragment, start) {
19264 - for (let i = start; i < fragment.childCount; i++) if (!type.allowsMarks(fragment.child(i).marks)) return true;
19265 - return false;
19266 - }
19267 - function definesContent(type) {
19268 - return type.spec.defining || type.spec.definingForContent;
19269 - }
19270 - function replaceRange(tr, from, to, slice) {
19271 - if (!slice.size) return tr.deleteRange(from, to);
19272 - let $from = tr.doc.resolve(from);
19273 - let $to = tr.doc.resolve(to);
19274 - if (fitsTrivially($from, $to, slice)) return tr.step(new ReplaceStep(from, to, slice));
19275 - let targetDepths = coveredDepths($from, $to);
19276 - if (targetDepths[targetDepths.length - 1] == 0) targetDepths.pop();
19277 - let preferredTarget = -($from.depth + 1);
19278 - targetDepths.unshift(preferredTarget);
19279 - for (let d = $from.depth, pos = $from.pos - 1; d > 0; d--, pos--) {
19280 - let spec = $from.node(d).type.spec;
19281 - if (spec.defining || spec.definingAsContext || spec.isolating) break;
19282 - if (targetDepths.indexOf(d) > -1) preferredTarget = d;
19283 - else if ($from.before(d) == pos) targetDepths.splice(1, 0, -d);
19284 - }
19285 - let preferredTargetIndex = targetDepths.indexOf(preferredTarget);
19286 - let leftNodes = [];
19287 - let preferredDepth = slice.openStart;
19288 - for (let content = slice.content, i = 0;; i++) {
19289 - let node = content.firstChild;
19290 - leftNodes.push(node);
19291 - if (i == slice.openStart) break;
19292 - content = node.content;
19293 - }
19294 - for (let d = preferredDepth - 1; d >= 0; d--) {
19295 - let leftNode = leftNodes[d];
19296 - let def = definesContent(leftNode.type);
19297 - if (def && !leftNode.sameMarkup($from.node(Math.abs(preferredTarget) - 1))) preferredDepth = d;
19298 - else if (def || !leftNode.type.isTextblock) break;
19299 - }
19300 - for (let j = slice.openStart; j >= 0; j--) {
19301 - let openDepth = (j + preferredDepth + 1) % (slice.openStart + 1);
19302 - let insert = leftNodes[openDepth];
19303 - if (!insert) continue;
19304 - for (let i = 0; i < targetDepths.length; i++) {
19305 - let targetDepth = targetDepths[(i + preferredTargetIndex) % targetDepths.length];
19306 - let expand = true;
19307 - if (targetDepth < 0) {
19308 - expand = false;
19309 - targetDepth = -targetDepth;
19310 - }
19311 - let parent = $from.node(targetDepth - 1);
19312 - let index = $from.index(targetDepth - 1);
19313 - if (parent.canReplaceWith(index, index, insert.type, insert.marks)) return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new Slice(closeFragment(slice.content, 0, slice.openStart, openDepth), openDepth, slice.openEnd));
19314 - }
19315 - }
19316 - let startSteps = tr.steps.length;
19317 - for (let i = targetDepths.length - 1; i >= 0; i--) {
19318 - tr.replace(from, to, slice);
19319 - if (tr.steps.length > startSteps) break;
19320 - let depth = targetDepths[i];
19321 - if (depth < 0) continue;
19322 - from = $from.before(depth);
19323 - to = $to.after(depth);
19324 - }
19325 - }
19326 - function closeFragment(fragment, depth, oldOpen, newOpen, parent) {
19327 - if (depth < oldOpen) {
19328 - let first = fragment.firstChild;
19329 - fragment = fragment.replaceChild(0, first.copy(closeFragment(first.content, depth + 1, oldOpen, newOpen, first)));
19330 - }
19331 - if (depth > newOpen) {
19332 - let match = parent.contentMatchAt(0);
19333 - let start = match.fillBefore(fragment).append(fragment);
19334 - fragment = start.append(match.matchFragment(start).fillBefore(Fragment$1.empty, true));
19335 - }
19336 - return fragment;
19337 - }
19338 - function replaceRangeWith(tr, from, to, node) {
19339 - if (!node.isInline && from == to && tr.doc.resolve(from).parent.content.size) {
19340 - let point = insertPoint(tr.doc, from, node.type);
19341 - if (point != null) from = to = point;
19342 - }
19343 - tr.replaceRange(from, to, new Slice(Fragment$1.from(node), 0, 0));
19344 - }
19345 - function deleteRange$1(tr, from, to) {
19346 - let $from = tr.doc.resolve(from);
19347 - let $to = tr.doc.resolve(to);
19348 - let covered = coveredDepths($from, $to);
19349 - for (let i = 0; i < covered.length; i++) {
19350 - let depth = covered[i];
19351 - let last = i == covered.length - 1;
19352 - if (last && depth == 0 || $from.node(depth).type.contentMatch.validEnd) return tr.delete($from.start(depth), $to.end(depth));
19353 - if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1)))) return tr.delete($from.before(depth), $to.after(depth));
19354 - }
19355 - for (let d = 1; d <= $from.depth && d <= $to.depth; d++) if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d && $from.start(d - 1) == $to.start(d - 1) && $from.node(d - 1).canReplace($from.index(d - 1), $to.index(d - 1))) return tr.delete($from.before(d), to);
19356 - tr.delete(from, to);
19357 - }
19358 - __name(deleteRange$1, "deleteRange");
19359 - function coveredDepths($from, $to) {
19360 - let result = [];
19361 - let minDepth = Math.min($from.depth, $to.depth);
19362 - for (let d = minDepth; d >= 0; d--) {
19363 - let start = $from.start(d);
19364 - if (start < $from.pos - ($from.depth - d) || $to.end(d) > $to.pos + ($to.depth - d) || $from.node(d).type.spec.isolating || $to.node(d).type.spec.isolating) break;
19365 - if (start == $to.start(d) || d == $from.depth && d == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent && d && $to.start(d - 1) == start - 1) result.push(d);
19366 - }
19367 - return result;
19368 - }
19369 - /**
19370 - Update an attribute in a specific node.
19371 - */
19372 - var AttrStep = class AttrStep extends Step {
19373 - /**
19374 - Construct an attribute step.
19375 - */
19376 - constructor(pos, attr, value) {
19377 - super();
19378 - this.pos = pos;
19379 - this.attr = attr;
19380 - this.value = value;
19381 - }
19382 - apply(doc) {
19383 - let node = doc.nodeAt(this.pos);
19384 - if (!node) return StepResult.fail("No node at attribute step's position");
19385 - let attrs = Object.create(null);
19386 - for (let name in node.attrs) attrs[name] = node.attrs[name];
19387 - attrs[this.attr] = this.value;
19388 - let updated = node.type.create(attrs, null, node.marks);
19389 - return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment$1.from(updated), 0, node.isLeaf ? 0 : 1));
19390 - }
19391 - getMap() {
19392 - return StepMap.empty;
19393 - }
19394 - invert(doc) {
19395 - return new AttrStep(this.pos, this.attr, doc.nodeAt(this.pos).attrs[this.attr]);
19396 - }
19397 - map(mapping) {
19398 - let pos = mapping.mapResult(this.pos, 1);
19399 - return pos.deletedAfter ? null : new AttrStep(pos.pos, this.attr, this.value);
19400 - }
19401 - toJSON() {
19402 - return {
19403 - stepType: "attr",
19404 - pos: this.pos,
19405 - attr: this.attr,
19406 - value: this.value
19407 - };
19408 - }
19409 - static fromJSON(schema, json) {
19410 - if (typeof json.pos != "number" || typeof json.attr != "string") throw new RangeError("Invalid input for AttrStep.fromJSON");
19411 - return new AttrStep(json.pos, json.attr, json.value);
19412 - }
19413 - };
19414 - Step.jsonID("attr", AttrStep);
19415 - /**
19416 - Update an attribute in the doc node.
19417 - */
19418 - var DocAttrStep = class DocAttrStep extends Step {
19419 - /**
19420 - Construct an attribute step.
19421 - */
19422 - constructor(attr, value) {
19423 - super();
19424 - this.attr = attr;
19425 - this.value = value;
19426 - }
19427 - apply(doc) {
19428 - let attrs = Object.create(null);
19429 - for (let name in doc.attrs) attrs[name] = doc.attrs[name];
19430 - attrs[this.attr] = this.value;
19431 - let updated = doc.type.create(attrs, doc.content, doc.marks);
19432 - return StepResult.ok(updated);
19433 - }
19434 - getMap() {
19435 - return StepMap.empty;
19436 - }
19437 - invert(doc) {
19438 - return new DocAttrStep(this.attr, doc.attrs[this.attr]);
19439 - }
19440 - map(mapping) {
19441 - return this;
19442 - }
19443 - toJSON() {
19444 - return {
19445 - stepType: "docAttr",
19446 - attr: this.attr,
19447 - value: this.value
19448 - };
19449 - }
19450 - static fromJSON(schema, json) {
19451 - if (typeof json.attr != "string") throw new RangeError("Invalid input for DocAttrStep.fromJSON");
19452 - return new DocAttrStep(json.attr, json.value);
19453 - }
19454 - };
19455 - Step.jsonID("docAttr", DocAttrStep);
19456 - /**
19457 - @internal
19458 - */
19459 - var TransformError = class extends Error {};
19460 - TransformError = function TransformError(message) {
19461 - let err = Error.call(this, message);
19462 - err.__proto__ = TransformError.prototype;
19463 - return err;
19464 - };
19465 - TransformError.prototype = Object.create(Error.prototype);
19466 - TransformError.prototype.constructor = TransformError;
19467 - TransformError.prototype.name = "TransformError";
19468 - /**
19469 - Abstraction to build up and track an array of
19470 - [steps](https://prosemirror.net/docs/ref/#transform.Step) representing a document transformation.
19471 -
19472 - Most transforming methods return the `Transform` object itself, so
19473 - that they can be chained.
19474 - */
19475 - var Transform = class {
19476 - /**
19477 - Create a transform that starts with the given document.
19478 - */
19479 - constructor(doc) {
19480 - this.doc = doc;
19481 - /**
19482 - The steps in this transform.
19483 - */
19484 - this.steps = [];
19485 - /**
19486 - The documents before each of the steps.
19487 - */
19488 - this.docs = [];
19489 - /**
19490 - A mapping with the maps for each of the steps in this transform.
19491 - */
19492 - this.mapping = new Mapping();
19493 - }
19494 - /**
19495 - The starting document.
19496 - */
19497 - get before() {
19498 - return this.docs.length ? this.docs[0] : this.doc;
19499 - }
19500 - /**
19501 - Apply a new step in this transform, saving the result. Throws an
19502 - error when the step fails.
19503 - */
19504 - step(step) {
19505 - let result = this.maybeStep(step);
19506 - if (result.failed) throw new TransformError(result.failed);
19507 - return this;
19508 - }
19509 - /**
19510 - Try to apply a step in this transformation, ignoring it if it
19511 - fails. Returns the step result.
19512 - */
19513 - maybeStep(step) {
19514 - let result = step.apply(this.doc);
19515 - if (!result.failed) this.addStep(step, result.doc);
19516 - return result;
19517 - }
19518 - /**
19519 - True when the document has been changed (when there are any
19520 - steps).
19521 - */
19522 - get docChanged() {
19523 - return this.steps.length > 0;
19524 - }
19525 - /**
19526 - Return a single range, in post-transform document positions,
19527 - that covers all content changed by this transform. Returns null
19528 - if no replacements are made. Note that this will ignore changes
19529 - that add/remove marks without replacing the underlying content.
19530 - */
19531 - changedRange() {
19532 - let from = 1e9;
19533 - let to = -1e9;
19534 - for (let i = 0; i < this.mapping.maps.length; i++) {
19535 - let map = this.mapping.maps[i];
19536 - if (i) {
19537 - from = map.map(from, 1);
19538 - to = map.map(to, -1);
19539 - }
19540 - map.forEach((_f, _t, fromB, toB) => {
19541 - from = Math.min(from, fromB);
19542 - to = Math.max(to, toB);
19543 - });
19544 - }
19545 - return from == 1e9 ? null : {
19546 - from,
19547 - to
19548 - };
19549 - }
19550 - /**
19551 - @internal
19552 - */
19553 - addStep(step, doc) {
19554 - this.docs.push(this.doc);
19555 - this.steps.push(step);
19556 - this.mapping.appendMap(step.getMap());
19557 - this.doc = doc;
19558 - }
19559 - /**
19560 - Replace the part of the document between `from` and `to` with the
19561 - given `slice`.
19562 - */
19563 - replace(from, to = from, slice = Slice.empty) {
19564 - let step = replaceStep(this.doc, from, to, slice);
19565 - if (step) this.step(step);
19566 - return this;
19567 - }
19568 - /**
19569 - Replace the given range with the given content, which may be a
19570 - fragment, node, or array of nodes.
19571 - */
19572 - replaceWith(from, to, content) {
19573 - return this.replace(from, to, new Slice(Fragment$1.from(content), 0, 0));
19574 - }
19575 - /**
19576 - Delete the content between the given positions.
19577 - */
19578 - delete(from, to) {
19579 - return this.replace(from, to, Slice.empty);
19580 - }
19581 - /**
19582 - Insert the given content at the given position.
19583 - */
19584 - insert(pos, content) {
19585 - return this.replaceWith(pos, pos, content);
19586 - }
19587 - /**
19588 - Replace a range of the document with a given slice, using
19589 - `from`, `to`, and the slice's
19590 - [`openStart`](https://prosemirror.net/docs/ref/#model.Slice.openStart) property as hints, rather
19591 - than fixed start and end points. This method may grow the
19592 - replaced area or close open nodes in the slice in order to get a
19593 - fit that is more in line with WYSIWYG expectations, by dropping
19594 - fully covered parent nodes of the replaced region when they are
19595 - marked [non-defining as
19596 - context](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext), or including an
19597 - open parent node from the slice that _is_ marked as [defining
19598 - its content](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent).
19599 -
19600 - This is the method, for example, to handle paste. The similar
19601 - [`replace`](https://prosemirror.net/docs/ref/#transform.Transform.replace) method is a more
19602 - primitive tool which will _not_ move the start and end of its given
19603 - range, and is useful in situations where you need more precise
19604 - control over what happens.
19605 - */
19606 - replaceRange(from, to, slice) {
19607 - replaceRange(this, from, to, slice);
19608 - return this;
19609 - }
19610 - /**
19611 - Replace the given range with a node, but use `from` and `to` as
19612 - hints, rather than precise positions. When from and to are the same
19613 - and are at the start or end of a parent node in which the given
19614 - node doesn't fit, this method may _move_ them out towards a parent
19615 - that does allow the given node to be placed. When the given range
19616 - completely covers a parent node, this method may completely replace
19617 - that parent node.
19618 - */
19619 - replaceRangeWith(from, to, node) {
19620 - replaceRangeWith(this, from, to, node);
19621 - return this;
19622 - }
19623 - /**
19624 - Delete the given range, expanding it to cover fully covered
19625 - parent nodes until a valid replace is found.
19626 - */
19627 - deleteRange(from, to) {
19628 - deleteRange$1(this, from, to);
19629 - return this;
19630 - }
19631 - /**
19632 - Split the content in the given range off from its parent, if there
19633 - is sibling content before or after it, and move it up the tree to
19634 - the depth specified by `target`. You'll probably want to use
19635 - [`liftTarget`](https://prosemirror.net/docs/ref/#transform.liftTarget) to compute `target`, to make
19636 - sure the lift is valid.
19637 - */
19638 - lift(range, target) {
19639 - lift$2(this, range, target);
19640 - return this;
19641 - }
19642 - /**
19643 - Join the blocks around the given position. If depth is 2, their
19644 - last and first siblings are also joined, and so on.
19645 - */
19646 - join(pos, depth = 1) {
19647 - join(this, pos, depth);
19648 - return this;
19649 - }
19650 - /**
19651 - Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers.
19652 - The wrappers are assumed to be valid in this position, and should
19653 - probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).
19654 - */
19655 - wrap(range, wrappers) {
19656 - wrap(this, range, wrappers);
19657 - return this;
19658 - }
19659 - /**
19660 - Set the type of all textblocks (partly) between `from` and `to` to
19661 - the given node type with the given attributes.
19662 - */
19663 - setBlockType(from, to = from, type, attrs = null) {
19664 - setBlockType$1(this, from, to, type, attrs);
19665 - return this;
19666 - }
19667 - /**
19668 - Change the type, attributes, and/or marks of the node at `pos`.
19669 - When `type` isn't given, the existing node type is preserved,
19670 - */
19671 - setNodeMarkup(pos, type, attrs = null, marks) {
19672 - setNodeMarkup(this, pos, type, attrs, marks);
19673 - return this;
19674 - }
19675 - /**
19676 - Set a single attribute on a given node to a new value.
19677 - The `pos` addresses the document content. Use `setDocAttribute`
19678 - to set attributes on the document itself.
19679 - */
19680 - setNodeAttribute(pos, attr, value) {
19681 - this.step(new AttrStep(pos, attr, value));
19682 - return this;
19683 - }
19684 - /**
19685 - Set a single attribute on the document to a new value.
19686 - */
19687 - setDocAttribute(attr, value) {
19688 - this.step(new DocAttrStep(attr, value));
19689 - return this;
19690 - }
19691 - /**
19692 - Add a mark to the node at position `pos`.
19693 - */
19694 - addNodeMark(pos, mark) {
19695 - this.step(new AddNodeMarkStep(pos, mark));
19696 - return this;
19697 - }
19698 - /**
19699 - Remove a mark (or all marks of the given type) from the node at
19700 - position `pos`.
19701 - */
19702 - removeNodeMark(pos, mark) {
19703 - let node = this.doc.nodeAt(pos);
19704 - if (!node) throw new RangeError("No node at position " + pos);
19705 - if (mark instanceof Mark$1) {
19706 - if (mark.isInSet(node.marks)) this.step(new RemoveNodeMarkStep(pos, mark));
19707 - } else {
19708 - let set = node.marks;
19709 - let found;
19710 - let steps = [];
19711 - while (found = mark.isInSet(set)) {
19712 - steps.push(new RemoveNodeMarkStep(pos, found));
19713 - set = found.removeFromSet(set);
19714 - }
19715 - for (let i = steps.length - 1; i >= 0; i--) this.step(steps[i]);
19716 - }
19717 - return this;
19718 - }
19719 - /**
19720 - Split the node at the given position, and optionally, if `depth` is
19721 - greater than one, any number of nodes above that. By default, the
19722 - parts split off will inherit the node type of the original node.
19723 - This can be changed by passing an array of types and attributes to
19724 - use after the split (with the outermost nodes coming first).
19725 - */
19726 - split(pos, depth = 1, typesAfter) {
19727 - split(this, pos, depth, typesAfter);
19728 - return this;
19729 - }
19730 - /**
19731 - Add the given mark to the inline content between `from` and `to`.
19732 - */
19733 - addMark(from, to, mark) {
19734 - addMark(this, from, to, mark);
19735 - return this;
19736 - }
19737 - /**
19738 - Remove marks from inline nodes between `from` and `to`. When
19739 - `mark` is a single mark, remove precisely that mark. When it is
19740 - a mark type, remove all marks of that type. When it is null,
19741 - remove all marks of any type.
19742 - */
19743 - removeMark(from, to, mark) {
19744 - removeMark(this, from, to, mark);
19745 - return this;
19746 - }
19747 - /**
19748 - Removes all marks and nodes from the content of the node at
19749 - `pos` that don't match the given new parent node type. Accepts
19750 - an optional starting [content match](https://prosemirror.net/docs/ref/#model.ContentMatch) as
19751 - third argument.
19752 - */
19753 - clearIncompatible(pos, parentType, match) {
19754 - clearIncompatible(this, pos, parentType, match);
19755 - return this;
19756 - }
19757 - };
19758 -
19759 -//#endregion
19760 -//#region node_modules/prosemirror-state/dist/index.js
19761 - var classesById = Object.create(null);
19762 - /**
19763 - Superclass for editor selections. Every selection type should
19764 - extend this. Should not be instantiated directly.
19765 - */
19766 - var Selection = class {
19767 - /**
19768 - Initialize a selection with the head and anchor and ranges. If no
19769 - ranges are given, constructs a single range across `$anchor` and
19770 - `$head`.
19771 - */
19772 - constructor($anchor, $head, ranges) {
19773 - this.$anchor = $anchor;
19774 - this.$head = $head;
19775 - this.ranges = ranges || [new SelectionRange($anchor.min($head), $anchor.max($head))];
19776 - }
19777 - /**
19778 - The selection's anchor, as an unresolved position.
19779 - */
19780 - get anchor() {
19781 - return this.$anchor.pos;
19782 - }
19783 - /**
19784 - The selection's head.
19785 - */
19786 - get head() {
19787 - return this.$head.pos;
19788 - }
19789 - /**
19790 - The lower bound of the selection's main range.
19791 - */
19792 - get from() {
19793 - return this.$from.pos;
19794 - }
19795 - /**
19796 - The upper bound of the selection's main range.
19797 - */
19798 - get to() {
19799 - return this.$to.pos;
19800 - }
19801 - /**
19802 - The resolved lower bound of the selection's main range.
19803 - */
19804 - get $from() {
19805 - return this.ranges[0].$from;
19806 - }
19807 - /**
19808 - The resolved upper bound of the selection's main range.
19809 - */
19810 - get $to() {
19811 - return this.ranges[0].$to;
19812 - }
19813 - /**
19814 - Indicates whether the selection contains any content.
19815 - */
19816 - get empty() {
19817 - let ranges = this.ranges;
19818 - for (let i = 0; i < ranges.length; i++) if (ranges[i].$from.pos != ranges[i].$to.pos) return false;
19819 - return true;
19820 - }
19821 - /**
19822 - Get the content of this selection as a slice.
19823 - */
19824 - content() {
19825 - return this.$from.doc.slice(this.from, this.to, true);
19826 - }
19827 - /**
19828 - Replace the selection with a slice or, if no slice is given,
19829 - delete the selection. Will append to the given transaction.
19830 - */
19831 - replace(tr, content = Slice.empty) {
19832 - let lastNode = content.content.lastChild;
19833 - let lastParent = null;
19834 - for (let i = 0; i < content.openEnd; i++) {
19835 - lastParent = lastNode;
19836 - lastNode = lastNode.lastChild;
19837 - }
19838 - let mapFrom = tr.steps.length;
19839 - let ranges = this.ranges;
19840 - for (let i = 0; i < ranges.length; i++) {
19841 - let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
19842 - tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i ? Slice.empty : content);
19843 - if (i == 0) selectionToInsertionEnd$1(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1);
19844 - }
19845 - }
19846 - /**
19847 - Replace the selection with the given node, appending the changes
19848 - to the given transaction.
19849 - */
19850 - replaceWith(tr, node) {
19851 - let mapFrom = tr.steps.length;
19852 - let ranges = this.ranges;
19853 - for (let i = 0; i < ranges.length; i++) {
19854 - let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
19855 - let from = mapping.map($from.pos);
19856 - let to = mapping.map($to.pos);
19857 - if (i) tr.deleteRange(from, to);
19858 - else {
19859 - tr.replaceRangeWith(from, to, node);
19860 - selectionToInsertionEnd$1(tr, mapFrom, node.isInline ? -1 : 1);
19861 - }
19862 - }
19863 - }
19864 - /**
19865 - Find a valid cursor or leaf node selection starting at the given
19866 - position and searching back if `dir` is negative, and forward if
19867 - positive. When `textOnly` is true, only consider cursor
19868 - selections. Will return null when no valid selection position is
19869 - found.
19870 - */
19871 - static findFrom($pos, dir, textOnly = false) {
19872 - let inner = $pos.parent.inlineContent ? new TextSelection($pos) : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);
19873 - if (inner) return inner;
19874 - for (let depth = $pos.depth - 1; depth >= 0; depth--) {
19875 - let found = dir < 0 ? findSelectionIn($pos.node(0), $pos.node(depth), $pos.before(depth + 1), $pos.index(depth), dir, textOnly) : findSelectionIn($pos.node(0), $pos.node(depth), $pos.after(depth + 1), $pos.index(depth) + 1, dir, textOnly);
19876 - if (found) return found;
19877 - }
19878 - return null;
19879 - }
19880 - /**
19881 - Find a valid cursor or leaf node selection near the given
19882 - position. Searches forward first by default, but if `bias` is
19883 - negative, it will search backwards first.
19884 - */
19885 - static near($pos, bias = 1) {
19886 - return this.findFrom($pos, bias) || this.findFrom($pos, -bias) || new AllSelection($pos.node(0));
19887 - }
19888 - /**
19889 - Find the cursor or leaf node selection closest to the start of
19890 - the given document. Will return an
19891 - [`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position
19892 - exists.
19893 - */
19894 - static atStart(doc) {
19895 - return findSelectionIn(doc, doc, 0, 0, 1) || new AllSelection(doc);
19896 - }
19897 - /**
19898 - Find the cursor or leaf node selection closest to the end of the
19899 - given document.
19900 - */
19901 - static atEnd(doc) {
19902 - return findSelectionIn(doc, doc, doc.content.size, doc.childCount, -1) || new AllSelection(doc);
19903 - }
19904 - /**
19905 - Deserialize the JSON representation of a selection. Must be
19906 - implemented for custom classes (as a static class method).
19907 - */
19908 - static fromJSON(doc, json) {
19909 - if (!json || !json.type) throw new RangeError("Invalid input for Selection.fromJSON");
19910 - let cls = classesById[json.type];
19911 - if (!cls) throw new RangeError(`No selection type ${json.type} defined`);
19912 - return cls.fromJSON(doc, json);
19913 - }
19914 - /**
19915 - To be able to deserialize selections from JSON, custom selection
19916 - classes must register themselves with an ID string, so that they
19917 - can be disambiguated. Try to pick something that's unlikely to
19918 - clash with classes from other modules.
19919 - */
19920 - static jsonID(id, selectionClass) {
19921 - if (id in classesById) throw new RangeError("Duplicate use of selection JSON ID " + id);
19922 - classesById[id] = selectionClass;
19923 - selectionClass.prototype.jsonID = id;
19924 - return selectionClass;
19925 - }
19926 - /**
19927 - Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,
19928 - which is a value that can be mapped without having access to a
19929 - current document, and later resolved to a real selection for a
19930 - given document again. (This is used mostly by the history to
19931 - track and restore old selections.) The default implementation of
19932 - this method just converts the selection to a text selection and
19933 - returns the bookmark for that.
19934 - */
19935 - getBookmark() {
19936 - return TextSelection.between(this.$anchor, this.$head).getBookmark();
19937 - }
19938 - };
19939 - Selection.prototype.visible = true;
19940 - /**
19941 - Represents a selected range in a document.
19942 - */
19943 - var SelectionRange = class {
19944 - /**
19945 - Create a range.
19946 - */
19947 - constructor($from, $to) {
19948 - this.$from = $from;
19949 - this.$to = $to;
19950 - }
19951 - };
19952 - var warnedAboutTextSelection = false;
19953 - function checkTextSelection($pos) {
19954 - if (!warnedAboutTextSelection && !$pos.parent.inlineContent) {
19955 - warnedAboutTextSelection = true;
19956 - console["warn"]("TextSelection endpoint not pointing into a node with inline content (" + $pos.parent.type.name + ")");
19957 - }
19958 - }
19959 - /**
19960 - A text selection represents a classical editor selection, with a
19961 - head (the moving side) and anchor (immobile side), both of which
19962 - point into textblock nodes. It can be empty (a regular cursor
19963 - position).
19964 - */
19965 - var TextSelection = class TextSelection extends Selection {
19966 - /**
19967 - Construct a text selection between the given points.
19968 - */
19969 - constructor($anchor, $head = $anchor) {
19970 - checkTextSelection($anchor);
19971 - checkTextSelection($head);
19972 - super($anchor, $head);
19973 - }
19974 - /**
19975 - Returns a resolved position if this is a cursor selection (an
19976 - empty text selection), and null otherwise.
19977 - */
19978 - get $cursor() {
19979 - return this.$anchor.pos == this.$head.pos ? this.$head : null;
19980 - }
19981 - map(doc, mapping) {
19982 - let $head = doc.resolve(mapping.map(this.head));
19983 - if (!$head.parent.inlineContent) return Selection.near($head);
19984 - let $anchor = doc.resolve(mapping.map(this.anchor));
19985 - return new TextSelection($anchor.parent.inlineContent ? $anchor : $head, $head);
19986 - }
19987 - replace(tr, content = Slice.empty) {
19988 - super.replace(tr, content);
19989 - if (content == Slice.empty) {
19990 - let marks = this.$from.marksAcross(this.$to);
19991 - if (marks) tr.ensureMarks(marks);
19992 - }
19993 - }
19994 - eq(other) {
19995 - return other instanceof TextSelection && other.anchor == this.anchor && other.head == this.head;
19996 - }
19997 - getBookmark() {
19998 - return new TextBookmark(this.anchor, this.head);
19999 - }
20000 - toJSON() {
20001 - return {
20002 - type: "text",
20003 - anchor: this.anchor,
20004 - head: this.head
20005 - };
20006 - }
20007 - /**
20008 - @internal
20009 - */
20010 - static fromJSON(doc, json) {
20011 - if (typeof json.anchor != "number" || typeof json.head != "number") throw new RangeError("Invalid input for TextSelection.fromJSON");
20012 - return new TextSelection(doc.resolve(json.anchor), doc.resolve(json.head));
20013 - }
20014 - /**
20015 - Create a text selection from non-resolved positions.
20016 - */
20017 - static create(doc, anchor, head = anchor) {
20018 - let $anchor = doc.resolve(anchor);
20019 - return new this($anchor, head == anchor ? $anchor : doc.resolve(head));
20020 - }
20021 - /**
20022 - Return a text selection that spans the given positions or, if
20023 - they aren't text positions, find a text selection near them.
20024 - `bias` determines whether the method searches forward (default)
20025 - or backwards (negative number) first. Will fall back to calling
20026 - [`Selection.near`](https://prosemirror.net/docs/ref/#state.Selection^near) when the document
20027 - doesn't contain a valid text position.
20028 - */
20029 - static between($anchor, $head, bias) {
20030 - let dPos = $anchor.pos - $head.pos;
20031 - if (!bias || dPos) bias = dPos >= 0 ? 1 : -1;
20032 - if (!$head.parent.inlineContent) {
20033 - let found = Selection.findFrom($head, bias, true) || Selection.findFrom($head, -bias, true);
20034 - if (found) $head = found.$head;
20035 - else return Selection.near($head, bias);
20036 - }
20037 - if (!$anchor.parent.inlineContent) if (dPos == 0) $anchor = $head;
20038 - else {
20039 - $anchor = (Selection.findFrom($anchor, -bias, true) || Selection.findFrom($anchor, bias, true)).$anchor;
20040 - if ($anchor.pos < $head.pos != dPos < 0) $anchor = $head;
20041 - }
20042 - return new TextSelection($anchor, $head);
20043 - }
20044 - };
20045 - Selection.jsonID("text", TextSelection);
20046 - var TextBookmark = class TextBookmark {
20047 - constructor(anchor, head) {
20048 - this.anchor = anchor;
20049 - this.head = head;
20050 - }
20051 - map(mapping) {
20052 - return new TextBookmark(mapping.map(this.anchor), mapping.map(this.head));
20053 - }
20054 - resolve(doc) {
20055 - return TextSelection.between(doc.resolve(this.anchor), doc.resolve(this.head));
20056 - }
20057 - };
20058 - /**
20059 - A node selection is a selection that points at a single node. All
20060 - nodes marked [selectable](https://prosemirror.net/docs/ref/#model.NodeSpec.selectable) can be the
20061 - target of a node selection. In such a selection, `from` and `to`
20062 - point directly before and after the selected node, `anchor` equals
20063 - `from`, and `head` equals `to`..
20064 - */
20065 - var NodeSelection = class NodeSelection extends Selection {
20066 - /**
20067 - Create a node selection. Does not verify the validity of its
20068 - argument.
20069 - */
20070 - constructor($pos) {
20071 - let node = $pos.nodeAfter;
20072 - let $end = $pos.node(0).resolve($pos.pos + node.nodeSize);
20073 - super($pos, $end);
20074 - this.node = node;
20075 - }
20076 - map(doc, mapping) {
20077 - let { deleted, pos } = mapping.mapResult(this.anchor);
20078 - let $pos = doc.resolve(pos);
20079 - if (deleted) return Selection.near($pos);
20080 - return new NodeSelection($pos);
20081 - }
20082 - content() {
20083 - return new Slice(Fragment$1.from(this.node), 0, 0);
20084 - }
20085 - eq(other) {
20086 - return other instanceof NodeSelection && other.anchor == this.anchor;
20087 - }
20088 - toJSON() {
20089 - return {
20090 - type: "node",
20091 - anchor: this.anchor
20092 - };
20093 - }
20094 - getBookmark() {
20095 - return new NodeBookmark(this.anchor);
20096 - }
20097 - /**
20098 - @internal
20099 - */
20100 - static fromJSON(doc, json) {
20101 - if (typeof json.anchor != "number") throw new RangeError("Invalid input for NodeSelection.fromJSON");
20102 - return new NodeSelection(doc.resolve(json.anchor));
20103 - }
20104 - /**
20105 - Create a node selection from non-resolved positions.
20106 - */
20107 - static create(doc, from) {
20108 - return new NodeSelection(doc.resolve(from));
20109 - }
20110 - /**
20111 - Determines whether the given node may be selected as a node
20112 - selection.
20113 - */
20114 - static isSelectable(node) {
20115 - return !node.isText && node.type.spec.selectable !== false;
20116 - }
20117 - };
20118 - NodeSelection.prototype.visible = false;
20119 - Selection.jsonID("node", NodeSelection);
20120 - var NodeBookmark = class NodeBookmark {
20121 - constructor(anchor) {
20122 - this.anchor = anchor;
20123 - }
20124 - map(mapping) {
20125 - let { deleted, pos } = mapping.mapResult(this.anchor);
20126 - return deleted ? new TextBookmark(pos, pos) : new NodeBookmark(pos);
20127 - }
20128 - resolve(doc) {
20129 - let $pos = doc.resolve(this.anchor);
20130 - let node = $pos.nodeAfter;
20131 - if (node && NodeSelection.isSelectable(node)) return new NodeSelection($pos);
20132 - return Selection.near($pos);
20133 - }
20134 - };
20135 - /**
20136 - A selection type that represents selecting the whole document
20137 - (which can not necessarily be expressed with a text selection, when
20138 - there are for example leaf block nodes at the start or end of the
20139 - document).
20140 - */
20141 - var AllSelection = class AllSelection extends Selection {
20142 - /**
20143 - Create an all-selection over the given document.
20144 - */
20145 - constructor(doc) {
20146 - super(doc.resolve(0), doc.resolve(doc.content.size));
20147 - }
20148 - replace(tr, content = Slice.empty) {
20149 - if (content == Slice.empty) {
20150 - tr.delete(0, tr.doc.content.size);
20151 - let sel = Selection.atStart(tr.doc);
20152 - if (!sel.eq(tr.selection)) tr.setSelection(sel);
20153 - } else super.replace(tr, content);
20154 - }
20155 - toJSON() {
20156 - return { type: "all" };
20157 - }
20158 - /**
20159 - @internal
20160 - */
20161 - static fromJSON(doc) {
20162 - return new AllSelection(doc);
20163 - }
20164 - map(doc) {
20165 - return new AllSelection(doc);
20166 - }
20167 - eq(other) {
20168 - return other instanceof AllSelection;
20169 - }
20170 - getBookmark() {
20171 - return AllBookmark;
20172 - }
20173 - };
20174 - Selection.jsonID("all", AllSelection);
20175 - var AllBookmark = {
20176 - map() {
20177 - return this;
20178 - },
20179 - resolve(doc) {
20180 - return new AllSelection(doc);
20181 - }
20182 - };
20183 - function findSelectionIn(doc, node, pos, index, dir, text = false) {
20184 - if (node.inlineContent) return TextSelection.create(doc, pos);
20185 - for (let i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {
20186 - let child = node.child(i);
20187 - if (!child.isAtom) {
20188 - let inner = findSelectionIn(doc, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text);
20189 - if (inner) return inner;
20190 - } else if (!text && NodeSelection.isSelectable(child)) return NodeSelection.create(doc, pos - (dir < 0 ? child.nodeSize : 0));
20191 - pos += child.nodeSize * dir;
20192 - }
20193 - return null;
20194 - }
20195 - function selectionToInsertionEnd$1(tr, startLen, bias) {
20196 - let last = tr.steps.length - 1;
20197 - if (last < startLen) return;
20198 - let step = tr.steps[last];
20199 - if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) return;
20200 - let map = tr.mapping.maps[last];
20201 - let end;
20202 - map.forEach((_from, _to, _newFrom, newTo) => {
20203 - if (end == null) end = newTo;
20204 - });
20205 - tr.setSelection(Selection.near(tr.doc.resolve(end), bias));
20206 - }
20207 - __name(selectionToInsertionEnd$1, "selectionToInsertionEnd");
20208 - var UPDATED_SEL = 1;
20209 - var UPDATED_MARKS = 2;
20210 - var UPDATED_SCROLL = 4;
20211 - /**
20212 - An editor state transaction, which can be applied to a state to
20213 - create an updated state. Use
20214 - [`EditorState.tr`](https://prosemirror.net/docs/ref/#state.EditorState.tr) to create an instance.
20215 -
20216 - Transactions track changes to the document (they are a subclass of
20217 - [`Transform`](https://prosemirror.net/docs/ref/#transform.Transform)), but also other state changes,
20218 - like selection updates and adjustments of the set of [stored
20219 - marks](https://prosemirror.net/docs/ref/#state.EditorState.storedMarks). In addition, you can store
20220 - metadata properties in a transaction, which are extra pieces of
20221 - information that client code or plugins can use to describe what a
20222 - transaction represents, so that they can update their [own
20223 - state](https://prosemirror.net/docs/ref/#state.StateField) accordingly.
20224 -
20225 - The [editor view](https://prosemirror.net/docs/ref/#view.EditorView) uses a few metadata
20226 - properties: it will attach a property `"pointer"` with the value
20227 - `true` to selection transactions directly caused by mouse or touch
20228 - input, a `"composition"` property holding an ID identifying the
20229 - composition that caused it to transactions caused by composed DOM
20230 - input, and a `"uiEvent"` property of that may be `"paste"`,
20231 - `"cut"`, or `"drop"`.
20232 - */
20233 - var Transaction = class extends Transform {
20234 - /**
20235 - @internal
20236 - */
20237 - constructor(state) {
20238 - super(state.doc);
20239 - this.curSelectionFor = 0;
20240 - this.updated = 0;
20241 - this.meta = Object.create(null);
20242 - this.time = Date.now();
20243 - this.curSelection = state.selection;
20244 - this.storedMarks = state.storedMarks;
20245 - }
20246 - /**
20247 - The transaction's current selection. This defaults to the editor
20248 - selection [mapped](https://prosemirror.net/docs/ref/#state.Selection.map) through the steps in the
20249 - transaction, but can be overwritten with
20250 - [`setSelection`](https://prosemirror.net/docs/ref/#state.Transaction.setSelection).
20251 - */
20252 - get selection() {
20253 - if (this.curSelectionFor < this.steps.length) {
20254 - this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor));
20255 - this.curSelectionFor = this.steps.length;
20256 - }
20257 - return this.curSelection;
20258 - }
20259 - /**
20260 - Update the transaction's current selection. Will determine the
20261 - selection that the editor gets when the transaction is applied.
20262 - */
20263 - setSelection(selection) {
20264 - if (selection.$from.doc != this.doc) throw new RangeError("Selection passed to setSelection must point at the current document");
20265 - this.curSelection = selection;
20266 - this.curSelectionFor = this.steps.length;
20267 - this.updated = (this.updated | UPDATED_SEL) & -3;
20268 - this.storedMarks = null;
20269 - return this;
20270 - }
20271 - /**
20272 - Whether the selection was explicitly updated by this transaction.
20273 - */
20274 - get selectionSet() {
20275 - return (this.updated & UPDATED_SEL) > 0;
20276 - }
20277 - /**
20278 - Set the current stored marks.
20279 - */
20280 - setStoredMarks(marks) {
20281 - this.storedMarks = marks;
20282 - this.updated |= UPDATED_MARKS;
20283 - return this;
20284 - }
20285 - /**
20286 - Make sure the current stored marks or, if that is null, the marks
20287 - at the selection, match the given set of marks. Does nothing if
20288 - this is already the case.
20289 - */
20290 - ensureMarks(marks) {
20291 - if (!Mark$1.sameSet(this.storedMarks || this.selection.$from.marks(), marks)) this.setStoredMarks(marks);
20292 - return this;
20293 - }
20294 - /**
20295 - Add a mark to the set of stored marks.
20296 - */
20297 - addStoredMark(mark) {
20298 - return this.ensureMarks(mark.addToSet(this.storedMarks || this.selection.$head.marks()));
20299 - }
20300 - /**
20301 - Remove a mark or mark type from the set of stored marks.
20302 - */
20303 - removeStoredMark(mark) {
20304 - return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks()));
20305 - }
20306 - /**
20307 - Whether the stored marks were explicitly set for this transaction.
20308 - */
20309 - get storedMarksSet() {
20310 - return (this.updated & UPDATED_MARKS) > 0;
20311 - }
20312 - /**
20313 - @internal
20314 - */
20315 - addStep(step, doc) {
20316 - super.addStep(step, doc);
20317 - this.updated = this.updated & -3;
20318 - this.storedMarks = null;
20319 - }
20320 - /**
20321 - Update the timestamp for the transaction.
20322 - */
20323 - setTime(time) {
20324 - this.time = time;
20325 - return this;
20326 - }
20327 - /**
20328 - Replace the current selection with the given slice.
20329 - */
20330 - replaceSelection(slice) {
20331 - this.selection.replace(this, slice);
20332 - return this;
20333 - }
20334 - /**
20335 - Replace the selection with the given node. When `inheritMarks` is
20336 - true and the content is inline, it inherits the marks from the
20337 - place where it is inserted.
20338 - */
20339 - replaceSelectionWith(node, inheritMarks = true) {
20340 - let selection = this.selection;
20341 - if (inheritMarks) node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : selection.$from.marksAcross(selection.$to) || Mark$1.none));
20342 - selection.replaceWith(this, node);
20343 - return this;
20344 - }
20345 - /**
20346 - Delete the selection.
20347 - */
20348 - deleteSelection() {
20349 - this.selection.replace(this);
20350 - return this;
20351 - }
20352 - /**
20353 - Replace the given range, or the selection if no range is given,
20354 - with a text node containing the given string.
20355 - */
20356 - insertText(text, from, to) {
20357 - let schema = this.doc.type.schema;
20358 - if (from == null) {
20359 - if (!text) return this.deleteSelection();
20360 - return this.replaceSelectionWith(schema.text(text), true);
20361 - } else {
20362 - if (to == null) to = from;
20363 - if (!text) return this.deleteRange(from, to);
20364 - let marks = this.storedMarks;
20365 - if (!marks) {
20366 - let $from = this.doc.resolve(from);
20367 - marks = to == from ? $from.marks() : $from.marksAcross(this.doc.resolve(to));
20368 - }
20369 - this.replaceRangeWith(from, to, schema.text(text, marks));
20370 - if (!this.selection.empty && this.selection.to == from + text.length) this.setSelection(Selection.near(this.selection.$to));
20371 - return this;
20372 - }
20373 - }
20374 - /**
20375 - Store a metadata property in this transaction, keyed either by
20376 - name or by plugin.
20377 - */
20378 - setMeta(key, value) {
20379 - this.meta[typeof key == "string" ? key : key.key] = value;
20380 - return this;
20381 - }
20382 - /**
20383 - Retrieve a metadata property for a given name or plugin.
20384 - */
20385 - getMeta(key) {
20386 - return this.meta[typeof key == "string" ? key : key.key];
20387 - }
20388 - /**
20389 - Returns true if this transaction doesn't contain any metadata,
20390 - and can thus safely be extended.
20391 - */
20392 - get isGeneric() {
20393 - for (let _ in this.meta) return false;
20394 - return true;
20395 - }
20396 - /**
20397 - Indicate that the editor should scroll the selection into view
20398 - when updated to the state produced by this transaction.
20399 - */
20400 - scrollIntoView() {
20401 - this.updated |= UPDATED_SCROLL;
20402 - return this;
20403 - }
20404 - /**
20405 - True when this transaction has had `scrollIntoView` called on it.
20406 - */
20407 - get scrolledIntoView() {
20408 - return (this.updated & UPDATED_SCROLL) > 0;
20409 - }
20410 - };
20411 - function bind(f, self) {
20412 - return !self || !f ? f : f.bind(self);
20413 - }
20414 - var FieldDesc = class {
20415 - constructor(name, desc, self) {
20416 - this.name = name;
20417 - this.init = bind(desc.init, self);
20418 - this.apply = bind(desc.apply, self);
20419 - }
20420 - };
20421 - var baseFields = [
20422 - new FieldDesc("doc", {
20423 - init(config) {
20424 - return config.doc || config.schema.topNodeType.createAndFill();
20425 - },
20426 - apply(tr) {
20427 - return tr.doc;
20428 - }
20429 - }),
20430 - new FieldDesc("selection", {
20431 - init(config, instance) {
20432 - return config.selection || Selection.atStart(instance.doc);
20433 - },
20434 - apply(tr) {
20435 - return tr.selection;
20436 - }
20437 - }),
20438 - new FieldDesc("storedMarks", {
20439 - init(config) {
20440 - return config.storedMarks || null;
20441 - },
20442 - apply(tr, _marks, _old, state) {
20443 - return state.selection.$cursor ? tr.storedMarks : null;
20444 - }
20445 - }),
20446 - new FieldDesc("scrollToSelection", {
20447 - init() {
20448 - return 0;
20449 - },
20450 - apply(tr, prev) {
20451 - return tr.scrolledIntoView ? prev + 1 : prev;
20452 - }
20453 - })
20454 - ];
20455 - var Configuration = class {
20456 - constructor(schema, plugins) {
20457 - this.schema = schema;
20458 - this.plugins = [];
20459 - this.pluginsByKey = Object.create(null);
20460 - this.fields = baseFields.slice();
20461 - if (plugins) plugins.forEach((plugin) => {
20462 - if (this.pluginsByKey[plugin.key]) throw new RangeError("Adding different instances of a keyed plugin (" + plugin.key + ")");
20463 - this.plugins.push(plugin);
20464 - this.pluginsByKey[plugin.key] = plugin;
20465 - if (plugin.spec.state) this.fields.push(new FieldDesc(plugin.key, plugin.spec.state, plugin));
20466 - });
20467 - }
20468 - };
20469 - /**
20470 - The state of a ProseMirror editor is represented by an object of
20471 - this type. A state is a persistent data structure—it isn't
20472 - updated, but rather a new state value is computed from an old one
20473 - using the [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) method.
20474 -
20475 - A state holds a number of built-in fields, and plugins can
20476 - [define](https://prosemirror.net/docs/ref/#state.PluginSpec.state) additional fields.
20477 - */
20478 - var EditorState = class EditorState {
20479 - /**
20480 - @internal
20481 - */
20482 - constructor(config) {
20483 - this.config = config;
20484 - }
20485 - /**
20486 - The schema of the state's document.
20487 - */
20488 - get schema() {
20489 - return this.config.schema;
20490 - }
20491 - /**
20492 - The plugins that are active in this state.
20493 - */
20494 - get plugins() {
20495 - return this.config.plugins;
20496 - }
20497 - /**
20498 - Apply the given transaction to produce a new state.
20499 - */
20500 - apply(tr) {
20501 - return this.applyTransaction(tr).state;
20502 - }
20503 - /**
20504 - @internal
20505 - */
20506 - filterTransaction(tr, ignore = -1) {
20507 - for (let i = 0; i < this.config.plugins.length; i++) if (i != ignore) {
20508 - let plugin = this.config.plugins[i];
20509 - if (plugin.spec.filterTransaction && !plugin.spec.filterTransaction.call(plugin, tr, this)) return false;
20510 - }
20511 - return true;
20512 - }
20513 - /**
20514 - Verbose variant of [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) that
20515 - returns the precise transactions that were applied (which might
20516 - be influenced by the [transaction
20517 - hooks](https://prosemirror.net/docs/ref/#state.PluginSpec.filterTransaction) of
20518 - plugins) along with the new state.
20519 - */
20520 - applyTransaction(rootTr) {
20521 - if (!this.filterTransaction(rootTr)) return {
20522 - state: this,
20523 - transactions: []
20524 - };
20525 - let trs = [rootTr];
20526 - let newState = this.applyInner(rootTr);
20527 - let seen = null;
20528 - for (;;) {
20529 - let haveNew = false;
20530 - for (let i = 0; i < this.config.plugins.length; i++) {
20531 - let plugin = this.config.plugins[i];
20532 - if (plugin.spec.appendTransaction) {
20533 - let n = seen ? seen[i].n : 0;
20534 - let oldState = seen ? seen[i].state : this;
20535 - let tr = n < trs.length && plugin.spec.appendTransaction.call(plugin, n ? trs.slice(n) : trs, oldState, newState);
20536 - if (tr && newState.filterTransaction(tr, i)) {
20537 - tr.setMeta("appendedTransaction", rootTr);
20538 - if (!seen) {
20539 - seen = [];
20540 - for (let j = 0; j < this.config.plugins.length; j++) seen.push(j < i ? {
20541 - state: newState,
20542 - n: trs.length
20543 - } : {
20544 - state: this,
20545 - n: 0
20546 - });
20547 - }
20548 - trs.push(tr);
20549 - newState = newState.applyInner(tr);
20550 - haveNew = true;
20551 - }
20552 - if (seen) seen[i] = {
20553 - state: newState,
20554 - n: trs.length
20555 - };
20556 - }
20557 - }
20558 - if (!haveNew) return {
20559 - state: newState,
20560 - transactions: trs
20561 - };
20562 - }
20563 - }
20564 - /**
20565 - @internal
20566 - */
20567 - applyInner(tr) {
20568 - if (!tr.before.eq(this.doc)) throw new RangeError("Applying a mismatched transaction");
20569 - let newInstance = new EditorState(this.config);
20570 - let fields = this.config.fields;
20571 - for (let i = 0; i < fields.length; i++) {
20572 - let field = fields[i];
20573 - newInstance[field.name] = field.apply(tr, this[field.name], this, newInstance);
20574 - }
20575 - return newInstance;
20576 - }
20577 - /**
20578 - Accessor that constructs and returns a new [transaction](https://prosemirror.net/docs/ref/#state.Transaction) from this state.
20579 - */
20580 - get tr() {
20581 - return new Transaction(this);
20582 - }
20583 - /**
20584 - Create a new state.
20585 - */
20586 - static create(config) {
20587 - let $config = new Configuration(config.doc ? config.doc.type.schema : config.schema, config.plugins);
20588 - let instance = new EditorState($config);
20589 - for (let i = 0; i < $config.fields.length; i++) instance[$config.fields[i].name] = $config.fields[i].init(config, instance);
20590 - return instance;
20591 - }
20592 - /**
20593 - Create a new state based on this one, but with an adjusted set
20594 - of active plugins. State fields that exist in both sets of
20595 - plugins are kept unchanged. Those that no longer exist are
20596 - dropped, and those that are new are initialized using their
20597 - [`init`](https://prosemirror.net/docs/ref/#state.StateField.init) method, passing in the new
20598 - configuration object..
20599 - */
20600 - reconfigure(config) {
20601 - let $config = new Configuration(this.schema, config.plugins);
20602 - let fields = $config.fields;
20603 - let instance = new EditorState($config);
20604 - for (let i = 0; i < fields.length; i++) {
20605 - let name = fields[i].name;
20606 - instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(config, instance);
20607 - }
20608 - return instance;
20609 - }
20610 - /**
20611 - Serialize this state to JSON. If you want to serialize the state
20612 - of plugins, pass an object mapping property names to use in the
20613 - resulting JSON object to plugin objects. The argument may also be
20614 - a string or number, in which case it is ignored, to support the
20615 - way `JSON.stringify` calls `toString` methods.
20616 - */
20617 - toJSON(pluginFields) {
20618 - let result = {
20619 - doc: this.doc.toJSON(),
20620 - selection: this.selection.toJSON()
20621 - };
20622 - if (this.storedMarks) result.storedMarks = this.storedMarks.map((m) => m.toJSON());
20623 - if (pluginFields && typeof pluginFields == "object") for (let prop in pluginFields) {
20624 - if (prop == "doc" || prop == "selection") throw new RangeError("The JSON fields `doc` and `selection` are reserved");
20625 - let plugin = pluginFields[prop];
20626 - let state = plugin.spec.state;
20627 - if (state && state.toJSON) result[prop] = state.toJSON.call(plugin, this[plugin.key]);
20628 - }
20629 - return result;
20630 - }
20631 - /**
20632 - Deserialize a JSON representation of a state. `config` should
20633 - have at least a `schema` field, and should contain array of
20634 - plugins to initialize the state with. `pluginFields` can be used
20635 - to deserialize the state of plugins, by associating plugin
20636 - instances with the property names they use in the JSON object.
20637 - */
20638 - static fromJSON(config, json, pluginFields) {
20639 - if (!json) throw new RangeError("Invalid input for EditorState.fromJSON");
20640 - if (!config.schema) throw new RangeError("Required config field 'schema' missing");
20641 - let $config = new Configuration(config.schema, config.plugins);
20642 - let instance = new EditorState($config);
20643 - $config.fields.forEach((field) => {
20644 - if (field.name == "doc") instance.doc = Node.fromJSON(config.schema, json.doc);
20645 - else if (field.name == "selection") instance.selection = Selection.fromJSON(instance.doc, json.selection);
20646 - else if (field.name == "storedMarks") {
20647 - if (json.storedMarks) instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON);
20648 - } else {
20649 - if (pluginFields) for (let prop in pluginFields) {
20650 - let plugin = pluginFields[prop];
20651 - let state = plugin.spec.state;
20652 - if (plugin.key == field.name && state && state.fromJSON && Object.prototype.hasOwnProperty.call(json, prop)) {
20653 - instance[field.name] = state.fromJSON.call(plugin, config, json[prop], instance);
20654 - return;
20655 - }
20656 - }
20657 - instance[field.name] = field.init(config, instance);
20658 - }
20659 - });
20660 - return instance;
20661 - }
20662 - };
20663 - function bindProps(obj, self, target) {
20664 - for (let prop in obj) {
20665 - let val = obj[prop];
20666 - if (val instanceof Function) val = val.bind(self);
20667 - else if (prop == "handleDOMEvents") val = bindProps(val, self, {});
20668 - target[prop] = val;
20669 - }
20670 - return target;
20671 - }
20672 - /**
20673 - Plugins bundle functionality that can be added to an editor.
20674 - They are part of the [editor state](https://prosemirror.net/docs/ref/#state.EditorState) and
20675 - may influence that state and the view that contains it.
20676 - */
20677 - var Plugin = class {
20678 - /**
20679 - Create a plugin.
20680 - */
20681 - constructor(spec) {
20682 - this.spec = spec;
20683 - /**
20684 - The [props](https://prosemirror.net/docs/ref/#view.EditorProps) exported by this plugin.
20685 - */
20686 - this.props = {};
20687 - if (spec.props) bindProps(spec.props, this, this.props);
20688 - this.key = spec.key ? spec.key.key : createKey("plugin");
20689 - }
20690 - /**
20691 - Extract the plugin's state field from an editor state.
20692 - */
20693 - getState(state) {
20694 - return state[this.key];
20695 - }
20696 - };
20697 - var keys$1 = Object.create(null);
20698 - function createKey(name) {
20699 - if (name in keys$1) return name + "$" + ++keys$1[name];
20700 - keys$1[name] = 0;
20701 - return name + "$";
20702 - }
20703 - /**
20704 - A key is used to [tag](https://prosemirror.net/docs/ref/#state.PluginSpec.key) plugins in a way
20705 - that makes it possible to find them, given an editor state.
20706 - Assigning a key does mean only one plugin of that type can be
20707 - active in a state.
20708 - */
20709 - var PluginKey = class {
20710 - /**
20711 - Create a plugin key.
20712 - */
20713 - constructor(name = "key") {
20714 - this.key = createKey(name);
20715 - }
20716 - /**
20717 - Get the active plugin with this key, if any, from an editor
20718 - state.
20719 - */
20720 - get(state) {
20721 - return state.config.pluginsByKey[this.key];
20722 - }
20723 - /**
20724 - Get the plugin's state from an editor state.
20725 - */
20726 - getState(state) {
20727 - return state[this.key];
20728 - }
20729 - };
20730 -
20731 -//#endregion
20732 -//#region node_modules/prosemirror-commands/dist/index.js
20733 -/**
20734 - Delete the selection, if there is one.
20735 - */
20736 - var deleteSelection$1 = /* @__PURE__ */ __name((state, dispatch) => {
20737 - if (state.selection.empty) return false;
20738 - if (dispatch) dispatch(state.tr.deleteSelection().scrollIntoView());
20739 - return true;
20740 - }, "deleteSelection");
20741 - function atBlockStart(state, view) {
20742 - let { $cursor } = state.selection;
20743 - if (!$cursor || (view ? !view.endOfTextblock("backward", state) : $cursor.parentOffset > 0)) return null;
20744 - return $cursor;
20745 - }
20746 - /**
20747 - If the selection is empty and at the start of a textblock, try to
20748 - reduce the distance between that block and the one before it—if
20749 - there's a block directly before it that can be joined, join them.
20750 - If not, try to move the selected block closer to the next one in
20751 - the document structure by lifting it out of its parent or moving it
20752 - into a parent of the previous block. Will use the view for accurate
20753 - (bidi-aware) start-of-textblock detection if given.
20754 - */
20755 - var joinBackward$1 = /* @__PURE__ */ __name((state, dispatch, view) => {
20756 - let $cursor = atBlockStart(state, view);
20757 - if (!$cursor) return false;
20758 - let $cut = findCutBefore($cursor);
20759 - if (!$cut) {
20760 - let range = $cursor.blockRange();
20761 - let target = range && liftTarget(range);
20762 - if (target == null) return false;
20763 - if (dispatch) dispatch(state.tr.lift(range, target).scrollIntoView());
20764 - return true;
20765 - }
20766 - let before = $cut.nodeBefore;
20767 - if (deleteBarrier(state, $cut, dispatch, -1)) return true;
20768 - if ($cursor.parent.content.size == 0 && (textblockAt(before, "end") || NodeSelection.isSelectable(before))) for (let depth = $cursor.depth;; depth--) {
20769 - let delStep = replaceStep(state.doc, $cursor.before(depth), $cursor.after(depth), Slice.empty);
20770 - if (delStep && delStep.slice.size < delStep.to - delStep.from) {
20771 - if (dispatch) {
20772 - let tr = state.tr.step(delStep);
20773 - tr.setSelection(textblockAt(before, "end") ? Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos, -1)), -1) : NodeSelection.create(tr.doc, $cut.pos - before.nodeSize));
20774 - dispatch(tr.scrollIntoView());
20775 - }
20776 - return true;
20777 - }
20778 - if (depth == 1 || $cursor.node(depth - 1).childCount > 1) break;
20779 - }
20780 - if (before.isAtom && $cut.depth == $cursor.depth - 1) {
20781 - if (dispatch) dispatch(state.tr.delete($cut.pos - before.nodeSize, $cut.pos).scrollIntoView());
20782 - return true;
20783 - }
20784 - return false;
20785 - }, "joinBackward");
20786 - /**
20787 - A more limited form of [`joinBackward`](https://prosemirror.net/docs/ref/#commands.joinBackward)
20788 - that only tries to join the current textblock to the one before
20789 - it, if the cursor is at the start of a textblock.
20790 - */
20791 - var joinTextblockBackward$1 = /* @__PURE__ */ __name((state, dispatch, view) => {
20792 - let $cursor = atBlockStart(state, view);
20793 - if (!$cursor) return false;
20794 - let $cut = findCutBefore($cursor);
20795 - return $cut ? joinTextblocksAround(state, $cut, dispatch) : false;
20796 - }, "joinTextblockBackward");
20797 - /**
20798 - A more limited form of [`joinForward`](https://prosemirror.net/docs/ref/#commands.joinForward)
20799 - that only tries to join the current textblock to the one after
20800 - it, if the cursor is at the end of a textblock.
20801 - */
20802 - var joinTextblockForward$1 = /* @__PURE__ */ __name((state, dispatch, view) => {
20803 - let $cursor = atBlockEnd(state, view);
20804 - if (!$cursor) return false;
20805 - let $cut = findCutAfter($cursor);
20806 - return $cut ? joinTextblocksAround(state, $cut, dispatch) : false;
20807 - }, "joinTextblockForward");
20808 - function joinTextblocksAround(state, $cut, dispatch) {
20809 - let beforeText = $cut.nodeBefore;
20810 - let beforePos = $cut.pos - 1;
20811 - for (; !beforeText.isTextblock; beforePos--) {
20812 - if (beforeText.type.spec.isolating) return false;
20813 - let child = beforeText.lastChild;
20814 - if (!child) return false;
20815 - beforeText = child;
20816 - }
20817 - let afterText = $cut.nodeAfter;
20818 - let afterPos = $cut.pos + 1;
20819 - for (; !afterText.isTextblock; afterPos++) {
20820 - if (afterText.type.spec.isolating) return false;
20821 - let child = afterText.firstChild;
20822 - if (!child) return false;
20823 - afterText = child;
20824 - }
20825 - let step = replaceStep(state.doc, beforePos, afterPos, Slice.empty);
20826 - if (!step || step.from != beforePos || step instanceof ReplaceStep && step.slice.size >= afterPos - beforePos) return false;
20827 - if (dispatch) {
20828 - let tr = state.tr.step(step);
20829 - tr.setSelection(TextSelection.create(tr.doc, beforePos));
20830 - dispatch(tr.scrollIntoView());
20831 - }
20832 - return true;
20833 - }
20834 - function textblockAt(node, side, only = false) {
20835 - for (let scan = node; scan; scan = side == "start" ? scan.firstChild : scan.lastChild) {
20836 - if (scan.isTextblock) return true;
20837 - if (only && scan.childCount != 1) return false;
20838 - }
20839 - return false;
20840 - }
20841 - /**
20842 - When the selection is empty and at the start of a textblock, select
20843 - the node before that textblock, if possible. This is intended to be
20844 - bound to keys like backspace, after
20845 - [`joinBackward`](https://prosemirror.net/docs/ref/#commands.joinBackward) or other deleting
20846 - commands, as a fall-back behavior when the schema doesn't allow
20847 - deletion at the selected point.
20848 - */
20849 - var selectNodeBackward$1 = /* @__PURE__ */ __name((state, dispatch, view) => {
20850 - let { $head, empty } = state.selection, $cut = $head;
20851 - if (!empty) return false;
20852 - if ($head.parent.isTextblock) {
20853 - if (view ? !view.endOfTextblock("backward", state) : $head.parentOffset > 0) return false;
20854 - $cut = findCutBefore($head);
20855 - }
20856 - let node = $cut && $cut.nodeBefore;
20857 - if (!node || !NodeSelection.isSelectable(node)) return false;
20858 - if (dispatch) dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $cut.pos - node.nodeSize)).scrollIntoView());
20859 - return true;
20860 - }, "selectNodeBackward");
20861 - function findCutBefore($pos) {
20862 - if (!$pos.parent.type.spec.isolating) for (let i = $pos.depth - 1; i >= 0; i--) {
20863 - if ($pos.index(i) > 0) return $pos.doc.resolve($pos.before(i + 1));
20864 - if ($pos.node(i).type.spec.isolating) break;
20865 - }
20866 - return null;
20867 - }
20868 - function atBlockEnd(state, view) {
20869 - let { $cursor } = state.selection;
20870 - if (!$cursor || (view ? !view.endOfTextblock("forward", state) : $cursor.parentOffset < $cursor.parent.content.size)) return null;
20871 - return $cursor;
20872 - }
20873 - /**
20874 - If the selection is empty and the cursor is at the end of a
20875 - textblock, try to reduce or remove the boundary between that block
20876 - and the one after it, either by joining them or by moving the other
20877 - block closer to this one in the tree structure. Will use the view
20878 - for accurate start-of-textblock detection if given.
20879 - */
20880 - var joinForward$1 = /* @__PURE__ */ __name((state, dispatch, view) => {
20881 - let $cursor = atBlockEnd(state, view);
20882 - if (!$cursor) return false;
20883 - let $cut = findCutAfter($cursor);
20884 - if (!$cut) return false;
20885 - let after = $cut.nodeAfter;
20886 - if (deleteBarrier(state, $cut, dispatch, 1)) return true;
20887 - if ($cursor.parent.content.size == 0 && (textblockAt(after, "start") || NodeSelection.isSelectable(after))) {
20888 - let delStep = replaceStep(state.doc, $cursor.before(), $cursor.after(), Slice.empty);
20889 - if (delStep && delStep.slice.size < delStep.to - delStep.from) {
20890 - if (dispatch) {
20891 - let tr = state.tr.step(delStep);
20892 - tr.setSelection(textblockAt(after, "start") ? Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos)), 1) : NodeSelection.create(tr.doc, tr.mapping.map($cut.pos)));
20893 - dispatch(tr.scrollIntoView());
20894 - }
20895 - return true;
20896 - }
20897 - }
20898 - if (after.isAtom && $cut.depth == $cursor.depth - 1) {
20899 - if (dispatch) dispatch(state.tr.delete($cut.pos, $cut.pos + after.nodeSize).scrollIntoView());
20900 - return true;
20901 - }
20902 - return false;
20903 - }, "joinForward");
20904 - /**
20905 - When the selection is empty and at the end of a textblock, select
20906 - the node coming after that textblock, if possible. This is intended
20907 - to be bound to keys like delete, after
20908 - [`joinForward`](https://prosemirror.net/docs/ref/#commands.joinForward) and similar deleting
20909 - commands, to provide a fall-back behavior when the schema doesn't
20910 - allow deletion at the selected point.
20911 - */
20912 - var selectNodeForward$1 = /* @__PURE__ */ __name((state, dispatch, view) => {
20913 - let { $head, empty } = state.selection, $cut = $head;
20914 - if (!empty) return false;
20915 - if ($head.parent.isTextblock) {
20916 - if (view ? !view.endOfTextblock("forward", state) : $head.parentOffset < $head.parent.content.size) return false;
20917 - $cut = findCutAfter($head);
20918 - }
20919 - let node = $cut && $cut.nodeAfter;
20920 - if (!node || !NodeSelection.isSelectable(node)) return false;
20921 - if (dispatch) dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $cut.pos)).scrollIntoView());
20922 - return true;
20923 - }, "selectNodeForward");
20924 - function findCutAfter($pos) {
20925 - if (!$pos.parent.type.spec.isolating) for (let i = $pos.depth - 1; i >= 0; i--) {
20926 - let parent = $pos.node(i);
20927 - if ($pos.index(i) + 1 < parent.childCount) return $pos.doc.resolve($pos.after(i + 1));
20928 - if (parent.type.spec.isolating) break;
20929 - }
20930 - return null;
20931 - }
20932 - /**
20933 - Join the selected block or, if there is a text selection, the
20934 - closest ancestor block of the selection that can be joined, with
20935 - the sibling above it.
20936 - */
20937 - var joinUp$1 = /* @__PURE__ */ __name((state, dispatch) => {
20938 - let sel = state.selection;
20939 - let nodeSel = sel instanceof NodeSelection;
20940 - let point;
20941 - if (nodeSel) {
20942 - if (sel.node.isTextblock || !canJoin(state.doc, sel.from)) return false;
20943 - point = sel.from;
20944 - } else {
20945 - point = joinPoint(state.doc, sel.from, -1);
20946 - if (point == null) return false;
20947 - }
20948 - if (dispatch) {
20949 - let tr = state.tr.join(point);
20950 - if (nodeSel) tr.setSelection(NodeSelection.create(tr.doc, point - state.doc.resolve(point).nodeBefore.nodeSize));
20951 - dispatch(tr.scrollIntoView());
20952 - }
20953 - return true;
20954 - }, "joinUp");
20955 - /**
20956 - Join the selected block, or the closest ancestor of the selection
20957 - that can be joined, with the sibling after it.
20958 - */
20959 - var joinDown$1 = /* @__PURE__ */ __name((state, dispatch) => {
20960 - let sel = state.selection;
20961 - let point;
20962 - if (sel instanceof NodeSelection) {
20963 - if (sel.node.isTextblock || !canJoin(state.doc, sel.to)) return false;
20964 - point = sel.to;
20965 - } else {
20966 - point = joinPoint(state.doc, sel.to, 1);
20967 - if (point == null) return false;
20968 - }
20969 - if (dispatch) dispatch(state.tr.join(point).scrollIntoView());
20970 - return true;
20971 - }, "joinDown");
20972 - /**
20973 - Lift the selected block, or the closest ancestor block of the
20974 - selection that can be lifted, out of its parent node.
20975 - */
20976 - var lift$1 = /* @__PURE__ */ __name((state, dispatch) => {
20977 - let { $from, $to } = state.selection;
20978 - let range = $from.blockRange($to);
20979 - let target = range && liftTarget(range);
20980 - if (target == null) return false;
20981 - if (dispatch) dispatch(state.tr.lift(range, target).scrollIntoView());
20982 - return true;
20983 - }, "lift");
20984 - /**
20985 - If the selection is in a node whose type has a truthy
20986 - [`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) property in its spec, replace the
20987 - selection with a newline character.
20988 - */
20989 - var newlineInCode$1 = /* @__PURE__ */ __name((state, dispatch) => {
20990 - let { $head, $anchor } = state.selection;
20991 - if (!$head.parent.type.spec.code || !$head.sameParent($anchor)) return false;
20992 - if (dispatch) dispatch(state.tr.insertText("\n").scrollIntoView());
20993 - return true;
20994 - }, "newlineInCode");
20995 - function defaultBlockAt$1(match) {
20996 - for (let i = 0; i < match.edgeCount; i++) {
20997 - let { type } = match.edge(i);
20998 - if (type.isTextblock && !type.hasRequiredAttrs()) return type;
20999 - }
21000 - return null;
21001 - }
21002 - __name(defaultBlockAt$1, "defaultBlockAt");
21003 - /**
21004 - When the selection is in a node with a truthy
21005 - [`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) property in its spec, create a
21006 - default block after the code block, and move the cursor there.
21007 - */
21008 - var exitCode$1 = /* @__PURE__ */ __name((state, dispatch) => {
21009 - let { $head, $anchor } = state.selection;
21010 - if (!$head.parent.type.spec.code || !$head.sameParent($anchor)) return false;
21011 - let above = $head.node(-1);
21012 - let after = $head.indexAfter(-1);
21013 - let type = defaultBlockAt$1(above.contentMatchAt(after));
21014 - if (!type || !above.canReplaceWith(after, after, type)) return false;
21015 - if (dispatch) {
21016 - let pos = $head.after();
21017 - let tr = state.tr.replaceWith(pos, pos, type.createAndFill());
21018 - tr.setSelection(Selection.near(tr.doc.resolve(pos), 1));
21019 - dispatch(tr.scrollIntoView());
21020 - }
21021 - return true;
21022 - }, "exitCode");
21023 - /**
21024 - If a block node is selected, create an empty paragraph before (if
21025 - it is its parent's first child) or after it.
21026 - */
21027 - var createParagraphNear$1 = /* @__PURE__ */ __name((state, dispatch) => {
21028 - let sel = state.selection, { $from, $to } = sel;
21029 - if (sel instanceof AllSelection || $from.parent.inlineContent || $to.parent.inlineContent) return false;
21030 - let type = defaultBlockAt$1($to.parent.contentMatchAt($to.indexAfter()));
21031 - if (!type || !type.isTextblock) return false;
21032 - if (dispatch) {
21033 - let side = (!$from.parentOffset && $to.index() < $to.parent.childCount ? $from : $to).pos;
21034 - let tr = state.tr.insert(side, type.createAndFill());
21035 - tr.setSelection(TextSelection.create(tr.doc, side + 1));
21036 - dispatch(tr.scrollIntoView());
21037 - }
21038 - return true;
21039 - }, "createParagraphNear");
21040 - /**
21041 - If the cursor is in an empty textblock that can be lifted, lift the
21042 - block.
21043 - */
21044 - var liftEmptyBlock$1 = /* @__PURE__ */ __name((state, dispatch) => {
21045 - let { $cursor } = state.selection;
21046 - if (!$cursor || $cursor.parent.content.size) return false;
21047 - if ($cursor.depth > 1 && $cursor.after() != $cursor.end(-1)) {
21048 - let before = $cursor.before();
21049 - if (canSplit(state.doc, before)) {
21050 - if (dispatch) dispatch(state.tr.split(before).scrollIntoView());
21051 - return true;
21052 - }
21053 - }
21054 - let range = $cursor.blockRange();
21055 - let target = range && liftTarget(range);
21056 - if (target == null) return false;
21057 - if (dispatch) dispatch(state.tr.lift(range, target).scrollIntoView());
21058 - return true;
21059 - }, "liftEmptyBlock");
21060 - /**
21061 - Create a variant of [`splitBlock`](https://prosemirror.net/docs/ref/#commands.splitBlock) that uses
21062 - a custom function to determine the type of the newly split off block.
21063 - */
21064 - function splitBlockAs(splitNode) {
21065 - return (state, dispatch) => {
21066 - let { $from, $to } = state.selection;
21067 - if (state.selection instanceof NodeSelection && state.selection.node.isBlock) {
21068 - if (!$from.parentOffset || !canSplit(state.doc, $from.pos)) return false;
21069 - if (dispatch) dispatch(state.tr.split($from.pos).scrollIntoView());
21070 - return true;
21071 - }
21072 - if (!$from.depth) return false;
21073 - let types = [];
21074 - let splitDepth;
21075 - let deflt;
21076 - let atEnd = false;
21077 - let atStart = false;
21078 - for (let d = $from.depth;; d--) if ($from.node(d).isBlock) {
21079 - atEnd = $from.end(d) == $from.pos + ($from.depth - d);
21080 - atStart = $from.start(d) == $from.pos - ($from.depth - d);
21081 - deflt = defaultBlockAt$1($from.node(d - 1).contentMatchAt($from.indexAfter(d - 1)));
21082 - let splitType = splitNode && splitNode($to.parent, atEnd, $from);
21083 - types.unshift(splitType || (atEnd && deflt ? { type: deflt } : null));
21084 - splitDepth = d;
21085 - break;
21086 - } else {
21087 - if (d == 1) return false;
21088 - types.unshift(null);
21089 - }
21090 - let tr = state.tr;
21091 - if (state.selection instanceof TextSelection || state.selection instanceof AllSelection) tr.deleteSelection();
21092 - let splitPos = tr.mapping.map($from.pos);
21093 - let can = canSplit(tr.doc, splitPos, types.length, types);
21094 - if (!can) {
21095 - types[0] = deflt ? { type: deflt } : null;
21096 - can = canSplit(tr.doc, splitPos, types.length, types);
21097 - }
21098 - if (!can) return false;
21099 - tr.split(splitPos, types.length, types);
21100 - if (!atEnd && atStart && $from.node(splitDepth).type != deflt) {
21101 - let first = tr.mapping.map($from.before(splitDepth));
21102 - let $first = tr.doc.resolve(first);
21103 - if (deflt && $from.node(splitDepth - 1).canReplaceWith($first.index(), $first.index() + 1, deflt)) tr.setNodeMarkup(tr.mapping.map($from.before(splitDepth)), deflt);
21104 - }
21105 - if (dispatch) dispatch(tr.scrollIntoView());
21106 - return true;
21107 - };
21108 - }
21109 - /**
21110 - Split the parent block of the selection. If the selection is a text
21111 - selection, also delete its content.
21112 - */
21113 - var splitBlock$1 = splitBlockAs();
21114 - /**
21115 - Move the selection to the node wrapping the current selection, if
21116 - any. (Will not select the document node.)
21117 - */
21118 - var selectParentNode$1 = /* @__PURE__ */ __name((state, dispatch) => {
21119 - let { $from, to } = state.selection, pos;
21120 - let same = $from.sharedDepth(to);
21121 - if (same == 0) return false;
21122 - pos = $from.before(same);
21123 - if (dispatch) dispatch(state.tr.setSelection(NodeSelection.create(state.doc, pos)));
21124 - return true;
21125 - }, "selectParentNode");
21126 - /**
21127 - Select the whole document.
21128 - */
21129 - var selectAll$1 = /* @__PURE__ */ __name((state, dispatch) => {
21130 - if (dispatch) dispatch(state.tr.setSelection(new AllSelection(state.doc)));
21131 - return true;
21132 - }, "selectAll");
21133 - function joinMaybeClear(state, $pos, dispatch) {
21134 - let before = $pos.nodeBefore;
21135 - let after = $pos.nodeAfter;
21136 - let index = $pos.index();
21137 - if (!before || !after || !before.type.compatibleContent(after.type)) return false;
21138 - if (!before.content.size && $pos.parent.canReplace(index - 1, index)) {
21139 - if (dispatch) dispatch(state.tr.delete($pos.pos - before.nodeSize, $pos.pos).scrollIntoView());
21140 - return true;
21141 - }
21142 - if (!$pos.parent.canReplace(index, index + 1) || !(after.isTextblock || canJoin(state.doc, $pos.pos))) return false;
21143 - if (dispatch) dispatch(state.tr.join($pos.pos).scrollIntoView());
21144 - return true;
21145 - }
21146 - function deleteBarrier(state, $cut, dispatch, dir) {
21147 - let before = $cut.nodeBefore;
21148 - let after = $cut.nodeAfter;
21149 - let conn;
21150 - let match;
21151 - let isolated = before.type.spec.isolating || after.type.spec.isolating;
21152 - if (!isolated && joinMaybeClear(state, $cut, dispatch)) return true;
21153 - let canDelAfter = !isolated && $cut.parent.canReplace($cut.index(), $cut.index() + 1);
21154 - if (canDelAfter && (conn = (match = before.contentMatchAt(before.childCount)).findWrapping(after.type)) && match.matchType(conn[0] || after.type).validEnd) {
21155 - if (dispatch) {
21156 - let end = $cut.pos + after.nodeSize;
21157 - let wrap = Fragment$1.empty;
21158 - for (let i = conn.length - 1; i >= 0; i--) wrap = Fragment$1.from(conn[i].create(null, wrap));
21159 - wrap = Fragment$1.from(before.copy(wrap));
21160 - let tr = state.tr.step(new ReplaceAroundStep($cut.pos - 1, end, $cut.pos, end, new Slice(wrap, 1, 0), conn.length, true));
21161 - let $joinAt = tr.doc.resolve(end + 2 * conn.length);
21162 - if ($joinAt.nodeAfter && $joinAt.nodeAfter.type == before.type && canJoin(tr.doc, $joinAt.pos)) tr.join($joinAt.pos);
21163 - dispatch(tr.scrollIntoView());
21164 - }
21165 - return true;
21166 - }
21167 - let selAfter = after.type.spec.isolating || dir > 0 && isolated ? null : Selection.findFrom($cut, 1);
21168 - let range = selAfter && selAfter.$from.blockRange(selAfter.$to);
21169 - let target = range && liftTarget(range);
21170 - if (target != null && target >= $cut.depth) {
21171 - if (dispatch) dispatch(state.tr.lift(range, target).scrollIntoView());
21172 - return true;
21173 - }
21174 - if (canDelAfter && textblockAt(after, "start", true) && textblockAt(before, "end")) {
21175 - let at = before;
21176 - let wrap = [];
21177 - for (;;) {
21178 - wrap.push(at);
21179 - if (at.isTextblock) break;
21180 - at = at.lastChild;
21181 - }
21182 - let afterText = after;
21183 - let afterDepth = 1;
21184 - for (; !afterText.isTextblock; afterText = afterText.firstChild) afterDepth++;
21185 - if (at.canReplace(at.childCount, at.childCount, afterText.content)) {
21186 - if (dispatch) {
21187 - let end = Fragment$1.empty;
21188 - for (let i = wrap.length - 1; i >= 0; i--) end = Fragment$1.from(wrap[i].copy(end));
21189 - dispatch(state.tr.step(new ReplaceAroundStep($cut.pos - wrap.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new Slice(end, wrap.length, 0), 0, true)).scrollIntoView());
21190 - }
21191 - return true;
21192 - }
21193 - }
21194 - return false;
21195 - }
21196 - function selectTextblockSide(side) {
21197 - return function(state, dispatch) {
21198 - let sel = state.selection;
21199 - let $pos = side < 0 ? sel.$from : sel.$to;
21200 - let depth = $pos.depth;
21201 - while ($pos.node(depth).isInline) {
21202 - if (!depth) return false;
21203 - depth--;
21204 - }
21205 - if (!$pos.node(depth).isTextblock) return false;
21206 - if (dispatch) dispatch(state.tr.setSelection(TextSelection.create(state.doc, side < 0 ? $pos.start(depth) : $pos.end(depth))));
21207 - return true;
21208 - };
21209 - }
21210 - /**
21211 - Moves the cursor to the start of current text block.
21212 - */
21213 - var selectTextblockStart$1 = selectTextblockSide(-1);
21214 - /**
21215 - Moves the cursor to the end of current text block.
21216 - */
21217 - var selectTextblockEnd$1 = selectTextblockSide(1);
21218 - /**
21219 - Wrap the selection in a node of the given type with the given
21220 - attributes.
21221 - */
21222 - function wrapIn$1(nodeType, attrs = null) {
21223 - return function(state, dispatch) {
21224 - let { $from, $to } = state.selection;
21225 - let range = $from.blockRange($to);
21226 - let wrapping = range && findWrapping(range, nodeType, attrs);
21227 - if (!wrapping) return false;
21228 - if (dispatch) dispatch(state.tr.wrap(range, wrapping).scrollIntoView());
21229 - return true;
21230 - };
21231 - }
21232 - __name(wrapIn$1, "wrapIn");
21233 - /**
21234 - Returns a command that tries to set the selected textblocks to the
21235 - given node type with the given attributes.
21236 - */
21237 - function setBlockType(nodeType, attrs = null) {
21238 - return function(state, dispatch) {
21239 - let applicable = false;
21240 - for (let i = 0; i < state.selection.ranges.length && !applicable; i++) {
21241 - let { $from: { pos: from }, $to: { pos: to } } = state.selection.ranges[i];
21242 - state.doc.nodesBetween(from, to, (node, pos) => {
21243 - if (applicable) return false;
21244 - if (!node.isTextblock || node.hasMarkup(nodeType, attrs)) return;
21245 - if (node.type == nodeType) applicable = true;
21246 - else {
21247 - let $pos = state.doc.resolve(pos);
21248 - let index = $pos.index();
21249 - applicable = $pos.parent.canReplaceWith(index, index + 1, nodeType);
21250 - }
21251 - });
21252 - }
21253 - if (!applicable) return false;
21254 - if (dispatch) {
21255 - let tr = state.tr;
21256 - for (let i = 0; i < state.selection.ranges.length; i++) {
21257 - let { $from: { pos: from }, $to: { pos: to } } = state.selection.ranges[i];
21258 - tr.setBlockType(from, to, nodeType, attrs);
21259 - }
21260 - dispatch(tr.scrollIntoView());
21261 - }
21262 - return true;
21263 - };
21264 - }
21265 - /**
21266 - Combine a number of command functions into a single function (which
21267 - calls them one by one until one returns true).
21268 - */
21269 - function chainCommands(...commands) {
21270 - return function(state, dispatch, view) {
21271 - for (let i = 0; i < commands.length; i++) if (commands[i](state, dispatch, view)) return true;
21272 - return false;
21273 - };
21274 - }
21275 - var backspace = chainCommands(deleteSelection$1, joinBackward$1, selectNodeBackward$1);
21276 - var del = chainCommands(deleteSelection$1, joinForward$1, selectNodeForward$1);
21277 - /**
21278 - A basic keymap containing bindings not specific to any schema.
21279 - Binds the following keys (when multiple commands are listed, they
21280 - are chained with [`chainCommands`](https://prosemirror.net/docs/ref/#commands.chainCommands)):
21281 -
21282 - * **Enter** to `newlineInCode`, `createParagraphNear`, `liftEmptyBlock`, `splitBlock`
21283 - * **Mod-Enter** to `exitCode`
21284 - * **Backspace** and **Mod-Backspace** to `deleteSelection`, `joinBackward`, `selectNodeBackward`
21285 - * **Delete** and **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`
21286 - * **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`
21287 - * **Mod-a** to `selectAll`
21288 - */
21289 - var pcBaseKeymap = {
21290 - "Enter": chainCommands(newlineInCode$1, createParagraphNear$1, liftEmptyBlock$1, splitBlock$1),
21291 - "Mod-Enter": exitCode$1,
21292 - "Backspace": backspace,
21293 - "Mod-Backspace": backspace,
21294 - "Shift-Backspace": backspace,
21295 - "Delete": del,
21296 - "Mod-Delete": del,
21297 - "Mod-a": selectAll$1
21298 - };
21299 - /**
21300 - A copy of `pcBaseKeymap` that also binds **Ctrl-h** like Backspace,
21301 - **Ctrl-d** like Delete, **Alt-Backspace** like Ctrl-Backspace, and
21302 - **Ctrl-Alt-Backspace**, **Alt-Delete**, and **Alt-d** like
21303 - Ctrl-Delete.
21304 - */
21305 - var macBaseKeymap = {
21306 - "Ctrl-h": pcBaseKeymap["Backspace"],
21307 - "Alt-Backspace": pcBaseKeymap["Mod-Backspace"],
21308 - "Ctrl-d": pcBaseKeymap["Delete"],
21309 - "Ctrl-Alt-Backspace": pcBaseKeymap["Mod-Delete"],
21310 - "Alt-Delete": pcBaseKeymap["Mod-Delete"],
21311 - "Alt-d": pcBaseKeymap["Mod-Delete"],
21312 - "Ctrl-a": selectTextblockStart$1,
21313 - "Ctrl-e": selectTextblockEnd$1
21314 - };
21315 - for (let key in pcBaseKeymap) macBaseKeymap[key] = pcBaseKeymap[key];
21316 - /**
21317 - Depending on the detected platform, this will hold
21318 - [`pcBasekeymap`](https://prosemirror.net/docs/ref/#commands.pcBaseKeymap) or
21319 - [`macBaseKeymap`](https://prosemirror.net/docs/ref/#commands.macBaseKeymap).
21320 - */
21321 - var baseKeymap = (typeof navigator != "undefined" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os != "undefined" && os.platform ? os.platform() == "darwin" : false) ? macBaseKeymap : pcBaseKeymap;
21322 -
21323 -//#endregion
21324 -//#region node_modules/prosemirror-schema-list/dist/index.js
21325 -/**
21326 - Returns a command function that wraps the selection in a list with
21327 - the given type an attributes. If `dispatch` is null, only return a
21328 - value to indicate whether this is possible, but don't actually
21329 - perform the change.
21330 - */
21331 - function wrapInList$1(listType, attrs = null) {
21332 - return function(state, dispatch) {
21333 - let { $from, $to } = state.selection;
21334 - let range = $from.blockRange($to);
21335 - if (!range) return false;
21336 - let tr = dispatch ? state.tr : null;
21337 - if (!wrapRangeInList(tr, range, listType, attrs)) return false;
21338 - if (dispatch) dispatch(tr.scrollIntoView());
21339 - return true;
21340 - };
21341 - }
21342 - __name(wrapInList$1, "wrapInList");
21343 - /**
21344 - Try to wrap the given node range in a list of the given type.
21345 - Return `true` when this is possible, `false` otherwise. When `tr`
21346 - is non-null, the wrapping is added to that transaction. When it is
21347 - `null`, the function only queries whether the wrapping is
21348 - possible.
21349 - */
21350 - function wrapRangeInList(tr, range, listType, attrs = null) {
21351 - let doJoin = false;
21352 - let outerRange = range;
21353 - let doc = range.$from.doc;
21354 - if (range.depth >= 2 && range.$from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex == 0) {
21355 - if (range.$from.index(range.depth - 1) == 0) return false;
21356 - let $insert = doc.resolve(range.start - 2);
21357 - outerRange = new NodeRange($insert, $insert, range.depth);
21358 - if (range.endIndex < range.parent.childCount) range = new NodeRange(range.$from, doc.resolve(range.$to.end(range.depth)), range.depth);
21359 - doJoin = true;
21360 - }
21361 - let wrap = findWrapping(outerRange, listType, attrs, range);
21362 - if (!wrap) return false;
21363 - if (tr) doWrapInList(tr, range, wrap, doJoin, listType);
21364 - return true;
21365 - }
21366 - function doWrapInList(tr, range, wrappers, joinBefore, listType) {
21367 - let content = Fragment$1.empty;
21368 - for (let i = wrappers.length - 1; i >= 0; i--) content = Fragment$1.from(wrappers[i].type.create(wrappers[i].attrs, content));
21369 - tr.step(new ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new Slice(content, 0, 0), wrappers.length, true));
21370 - let found = 0;
21371 - for (let i = 0; i < wrappers.length; i++) if (wrappers[i].type == listType) found = i + 1;
21372 - let splitDepth = wrappers.length - found;
21373 - let splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0);
21374 - let parent = range.parent;
21375 - for (let i = range.startIndex, e = range.endIndex, first = true; i < e; i++, first = false) {
21376 - if (!first && canSplit(tr.doc, splitPos, splitDepth)) {
21377 - tr.split(splitPos, splitDepth);
21378 - splitPos += 2 * splitDepth;
21379 - }
21380 - splitPos += parent.child(i).nodeSize;
21381 - }
21382 - return tr;
21383 - }
21384 - /**
21385 - Create a command to lift the list item around the selection up into
21386 - a wrapping list.
21387 - */
21388 - function liftListItem$1(itemType) {
21389 - return function(state, dispatch) {
21390 - let { $from, $to } = state.selection;
21391 - let range = $from.blockRange($to, (node) => node.childCount > 0 && node.firstChild.type == itemType);
21392 - if (!range) return false;
21393 - if (!dispatch) return true;
21394 - if ($from.node(range.depth - 1).type == itemType) return liftToOuterList(state, dispatch, itemType, range);
21395 - else return liftOutOfList(state, dispatch, range);
21396 - };
21397 - }
21398 - __name(liftListItem$1, "liftListItem");
21399 - function liftToOuterList(state, dispatch, itemType, range) {
21400 - let tr = state.tr;
21401 - let end = range.end;
21402 - let endOfList = range.$to.end(range.depth);
21403 - if (end < endOfList) {
21404 - tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment$1.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));
21405 - range = new NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);
21406 - }
21407 - const target = liftTarget(range);
21408 - if (target == null) return false;
21409 - tr.lift(range, target);
21410 - let $after = tr.doc.resolve(tr.mapping.map(end, -1) - 1);
21411 - if (canJoin(tr.doc, $after.pos) && $after.nodeBefore.type == $after.nodeAfter.type) tr.join($after.pos);
21412 - dispatch(tr.scrollIntoView());
21413 - return true;
21414 - }
21415 - function liftOutOfList(state, dispatch, range) {
21416 - let tr = state.tr;
21417 - let list = range.parent;
21418 - for (let pos = range.end, i = range.endIndex - 1, e = range.startIndex; i > e; i--) {
21419 - pos -= list.child(i).nodeSize;
21420 - tr.delete(pos - 1, pos + 1);
21421 - }
21422 - let $start = tr.doc.resolve(range.start);
21423 - let item = $start.nodeAfter;
21424 - if (tr.mapping.map(range.end) != range.start + $start.nodeAfter.nodeSize) return false;
21425 - let atStart = range.startIndex == 0;
21426 - let atEnd = range.endIndex == list.childCount;
21427 - let parent = $start.node(-1);
21428 - let indexBefore = $start.index(-1);
21429 - if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment$1.empty : Fragment$1.from(list)))) return false;
21430 - let start = $start.pos;
21431 - let end = start + item.nodeSize;
21432 - tr.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ? Fragment$1.empty : Fragment$1.from(list.copy(Fragment$1.empty))).append(atEnd ? Fragment$1.empty : Fragment$1.from(list.copy(Fragment$1.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
21433 - dispatch(tr.scrollIntoView());
21434 - return true;
21435 - }
21436 - /**
21437 - Create a command to sink the list item around the selection down
21438 - into an inner list.
21439 - */
21440 - function sinkListItem$1(itemType) {
21441 - return function(state, dispatch) {
21442 - let { $from, $to } = state.selection;
21443 - let range = $from.blockRange($to, (node) => node.childCount > 0 && node.firstChild.type == itemType);
21444 - if (!range) return false;
21445 - let startIndex = range.startIndex;
21446 - if (startIndex == 0) return false;
21447 - let parent = range.parent;
21448 - let nodeBefore = parent.child(startIndex - 1);
21449 - if (nodeBefore.type != itemType) return false;
21450 - if (dispatch) {
21451 - let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;
21452 - let inner = Fragment$1.from(nestedBefore ? itemType.create() : null);
21453 - let slice = new Slice(Fragment$1.from(itemType.create(null, Fragment$1.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);
21454 - let before = range.start;
21455 - let after = range.end;
21456 - dispatch(state.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice, 1, true)).scrollIntoView());
21457 - }
21458 - return true;
21459 - };
21460 - }
21461 - __name(sinkListItem$1, "sinkListItem");
21462 -
21463 -//#endregion
21464 -//#region node_modules/prosemirror-view/dist/index.js
21465 - var domIndex = function(node) {
21466 - for (var index = 0;; index++) {
21467 - node = node.previousSibling;
21468 - if (!node) return index;
21469 - }
21470 - };
21471 - var parentNode = function(node) {
21472 - let parent = node.assignedSlot || node.parentNode;
21473 - return parent && parent.nodeType == 11 ? parent.host : parent;
21474 - };
21475 - var reusedRange = null;
21476 - var textRange = function(node, from, to) {
21477 - let range = reusedRange || (reusedRange = document.createRange());
21478 - range.setEnd(node, to == null ? node.nodeValue.length : to);
21479 - range.setStart(node, from || 0);
21480 - return range;
21481 - };
21482 - var clearReusedRange = function() {
21483 - reusedRange = null;
21484 - };
21485 - var isEquivalentPosition = function(node, off, targetNode, targetOff) {
21486 - return targetNode && (scanFor(node, off, targetNode, targetOff, -1) || scanFor(node, off, targetNode, targetOff, 1));
21487 - };
21488 - var atomElements = /^(img|br|input|textarea|hr)$/i;
21489 - function scanFor(node, off, targetNode, targetOff, dir) {
21490 - var _a;
21491 - for (;;) {
21492 - if (node == targetNode && off == targetOff) return true;
21493 - if (off == (dir < 0 ? 0 : nodeSize(node))) {
21494 - let parent = node.parentNode;
21495 - if (!parent || parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName) || node.contentEditable == "false") return false;
21496 - off = domIndex(node) + (dir < 0 ? 0 : 1);
21497 - node = parent;
21498 - } else if (node.nodeType == 1) {
21499 - let child = node.childNodes[off + (dir < 0 ? -1 : 0)];
21500 - if (child.nodeType == 1 && child.contentEditable == "false") if ((_a = child.pmViewDesc) === null || _a === void 0 ? void 0 : _a.ignoreForSelection) off += dir;
21501 - else return false;
21502 - else {
21503 - node = child;
21504 - off = dir < 0 ? nodeSize(node) : 0;
21505 - }
21506 - } else return false;
21507 - }
21508 - }
21509 - function nodeSize(node) {
21510 - return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
21511 - }
21512 - function textNodeBefore$1(node, offset) {
21513 - for (;;) {
21514 - if (node.nodeType == 3 && offset) return node;
21515 - if (node.nodeType == 1 && offset > 0) {
21516 - if (node.contentEditable == "false") return null;
21517 - node = node.childNodes[offset - 1];
21518 - offset = nodeSize(node);
21519 - } else if (node.parentNode && !hasBlockDesc(node)) {
21520 - offset = domIndex(node);
21521 - node = node.parentNode;
21522 - } else return null;
21523 - }
21524 - }
21525 - function textNodeAfter$1(node, offset) {
21526 - for (;;) {
21527 - if (node.nodeType == 3 && offset < node.nodeValue.length) return node;
21528 - if (node.nodeType == 1 && offset < node.childNodes.length) {
21529 - if (node.contentEditable == "false") return null;
21530 - node = node.childNodes[offset];
21531 - offset = 0;
21532 - } else if (node.parentNode && !hasBlockDesc(node)) {
21533 - offset = domIndex(node) + 1;
21534 - node = node.parentNode;
21535 - } else return null;
21536 - }
21537 - }
21538 - function isOnEdge(node, offset, parent) {
21539 - for (let atStart = offset == 0, atEnd = offset == nodeSize(node); atStart || atEnd;) {
21540 - if (node == parent) return true;
21541 - let index = domIndex(node);
21542 - node = node.parentNode;
21543 - if (!node) return false;
21544 - atStart = atStart && index == 0;
21545 - atEnd = atEnd && index == nodeSize(node);
21546 - }
21547 - }
21548 - function hasBlockDesc(dom) {
21549 - let desc;
21550 - for (let cur = dom; cur; cur = cur.parentNode) if (desc = cur.pmViewDesc) break;
21551 - return desc && desc.node && desc.node.isBlock && (desc.dom == dom || desc.contentDOM == dom);
21552 - }
21553 - var selectionCollapsed = function(domSel) {
21554 - return domSel.focusNode && isEquivalentPosition(domSel.focusNode, domSel.focusOffset, domSel.anchorNode, domSel.anchorOffset);
21555 - };
21556 - function keyEvent(keyCode, key) {
21557 - let event = document.createEvent("Event");
21558 - event.initEvent("keydown", true, true);
21559 - event.keyCode = keyCode;
21560 - event.key = event.code = key;
21561 - return event;
21562 - }
21563 - function deepActiveElement(doc) {
21564 - let elt = doc.activeElement;
21565 - while (elt && elt.shadowRoot) elt = elt.shadowRoot.activeElement;
21566 - return elt;
21567 - }
21568 - function caretFromPoint(doc, x, y) {
21569 - if (doc.caretPositionFromPoint) try {
21570 - let pos = doc.caretPositionFromPoint(x, y);
21571 - if (pos) return {
21572 - node: pos.offsetNode,
21573 - offset: Math.min(nodeSize(pos.offsetNode), pos.offset)
21574 - };
21575 - } catch (_) {}
21576 - if (doc.caretRangeFromPoint) {
21577 - let range = doc.caretRangeFromPoint(x, y);
21578 - if (range) return {
21579 - node: range.startContainer,
21580 - offset: Math.min(nodeSize(range.startContainer), range.startOffset)
21581 - };
21582 - }
21583 - }
21584 - var nav = typeof navigator != "undefined" ? navigator : null;
21585 - var doc = typeof document != "undefined" ? document : null;
21586 - var agent = nav && nav.userAgent || "";
21587 - var ie_edge = /Edge\/(\d+)/.exec(agent);
21588 - var ie_upto10 = /MSIE \d/.exec(agent);
21589 - var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent);
21590 - var ie$1 = !!(ie_upto10 || ie_11up || ie_edge);
21591 - var ie_version = ie_upto10 ? document.documentMode : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0;
21592 - var gecko = !ie$1 && /gecko\/(\d+)/i.test(agent);
21593 - gecko && +(/Firefox\/(\d+)/.exec(agent) || [0, 0])[1];
21594 - var _chrome = !ie$1 && /Chrome\/(\d+)/.exec(agent);
21595 - var chrome = !!_chrome;
21596 - var chrome_version = _chrome ? +_chrome[1] : 0;
21597 - var safari = !ie$1 && !!nav && /Apple Computer/.test(nav.vendor);
21598 - var ios = safari && (/Mobile\/\w+/.test(agent) || !!nav && nav.maxTouchPoints > 2);
21599 - var mac$2 = ios || (nav ? /Mac/.test(nav.platform) : false);
21600 - var windows$1 = nav ? /Win/.test(nav.platform) : false;
21601 - var android = /Android \d/.test(agent);
21602 - var webkit = !!doc && "webkitFontSmoothing" in doc.documentElement.style;
21603 - var webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
21604 - function windowRect(doc) {
21605 - let vp = doc.defaultView && doc.defaultView.visualViewport;
21606 - if (vp) return {
21607 - left: 0,
21608 - right: vp.width,
21609 - top: 0,
21610 - bottom: vp.height
21611 - };
21612 - return {
21613 - left: 0,
21614 - right: doc.documentElement.clientWidth,
21615 - top: 0,
21616 - bottom: doc.documentElement.clientHeight
21617 - };
21618 - }
21619 - function getSide(value, side) {
21620 - return typeof value == "number" ? value : value[side];
21621 - }
21622 - function clientRect(node) {
21623 - let rect = node.getBoundingClientRect();
21624 - let scaleX = rect.width / node.offsetWidth || 1;
21625 - let scaleY = rect.height / node.offsetHeight || 1;
21626 - return {
21627 - left: rect.left,
21628 - right: rect.left + node.clientWidth * scaleX,
21629 - top: rect.top,
21630 - bottom: rect.top + node.clientHeight * scaleY
21631 - };
21632 - }
21633 - function scrollRectIntoView(view, rect, startDOM) {
21634 - let scrollThreshold = view.someProp("scrollThreshold") || 0;
21635 - let scrollMargin = view.someProp("scrollMargin") || 5;
21636 - let doc = view.dom.ownerDocument;
21637 - for (let parent = startDOM || view.dom;;) {
21638 - if (!parent) break;
21639 - if (parent.nodeType != 1) {
21640 - parent = parentNode(parent);
21641 - continue;
21642 - }
21643 - let elt = parent;
21644 - let atTop = elt == doc.body;
21645 - let bounding = atTop ? windowRect(doc) : clientRect(elt);
21646 - let moveX = 0;
21647 - let moveY = 0;
21648 - if (rect.top < bounding.top + getSide(scrollThreshold, "top")) moveY = -(bounding.top - rect.top + getSide(scrollMargin, "top"));
21649 - else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, "bottom")) moveY = rect.bottom - rect.top > bounding.bottom - bounding.top ? rect.top + getSide(scrollMargin, "top") - bounding.top : rect.bottom - bounding.bottom + getSide(scrollMargin, "bottom");
21650 - if (rect.left < bounding.left + getSide(scrollThreshold, "left")) moveX = -(bounding.left - rect.left + getSide(scrollMargin, "left"));
21651 - else if (rect.right > bounding.right - getSide(scrollThreshold, "right")) moveX = rect.right - bounding.right + getSide(scrollMargin, "right");
21652 - if (moveX || moveY) if (atTop) doc.defaultView.scrollBy(moveX, moveY);
21653 - else {
21654 - let startX = elt.scrollLeft;
21655 - let startY = elt.scrollTop;
21656 - if (moveY) elt.scrollTop += moveY;
21657 - if (moveX) elt.scrollLeft += moveX;
21658 - let dX = elt.scrollLeft - startX;
21659 - let dY = elt.scrollTop - startY;
21660 - rect = {
21661 - left: rect.left - dX,
21662 - top: rect.top - dY,
21663 - right: rect.right - dX,
21664 - bottom: rect.bottom - dY
21665 - };
21666 - }
21667 - let pos = atTop ? "fixed" : getComputedStyle(parent).position;
21668 - if (/^(fixed|sticky)$/.test(pos)) break;
21669 - parent = pos == "absolute" ? parent.offsetParent : parentNode(parent);
21670 - }
21671 - }
21672 - function storeScrollPos(view) {
21673 - let rect = view.dom.getBoundingClientRect();
21674 - let startY = Math.max(0, rect.top);
21675 - let refDOM;
21676 - let refTop;
21677 - for (let x = (rect.left + rect.right) / 2, y = startY + 1; y < Math.min(innerHeight, rect.bottom); y += 5) {
21678 - let dom = view.root.elementFromPoint(x, y);
21679 - if (!dom || dom == view.dom || !view.dom.contains(dom)) continue;
21680 - let localRect = dom.getBoundingClientRect();
21681 - if (localRect.top >= startY - 20) {
21682 - refDOM = dom;
21683 - refTop = localRect.top;
21684 - break;
21685 - }
21686 - }
21687 - return {
21688 - refDOM,
21689 - refTop,
21690 - stack: scrollStack(view.dom)
21691 - };
21692 - }
21693 - function scrollStack(dom) {
21694 - let stack = [];
21695 - let doc = dom.ownerDocument;
21696 - for (let cur = dom; cur; cur = parentNode(cur)) {
21697 - stack.push({
21698 - dom: cur,
21699 - top: cur.scrollTop,
21700 - left: cur.scrollLeft
21701 - });
21702 - if (dom == doc) break;
21703 - }
21704 - return stack;
21705 - }
21706 - function resetScrollPos({ refDOM, refTop, stack }) {
21707 - let newRefTop = refDOM ? refDOM.getBoundingClientRect().top : 0;
21708 - restoreScrollStack(stack, newRefTop == 0 ? 0 : newRefTop - refTop);
21709 - }
21710 - function restoreScrollStack(stack, dTop) {
21711 - for (let i = 0; i < stack.length; i++) {
21712 - let { dom, top, left } = stack[i];
21713 - if (dom.scrollTop != top + dTop) dom.scrollTop = top + dTop;
21714 - if (dom.scrollLeft != left) dom.scrollLeft = left;
21715 - }
21716 - }
21717 - var preventScrollSupported = null;
21718 - function focusPreventScroll(dom) {
21719 - if (dom.setActive) return dom.setActive();
21720 - if (preventScrollSupported) return dom.focus(preventScrollSupported);
21721 - let stored = scrollStack(dom);
21722 - dom.focus(preventScrollSupported == null ? { get preventScroll() {
21723 - preventScrollSupported = { preventScroll: true };
21724 - return true;
21725 - } } : void 0);
21726 - if (!preventScrollSupported) {
21727 - preventScrollSupported = false;
21728 - restoreScrollStack(stored, 0);
21729 - }
21730 - }
21731 - function findOffsetInNode(node, coords) {
21732 - let closest;
21733 - let dxClosest = 2e8;
21734 - let coordsClosest;
21735 - let offset = 0;
21736 - let rowBot = coords.top;
21737 - let rowTop = coords.top;
21738 - let firstBelow;
21739 - let coordsBelow;
21740 - for (let child = node.firstChild, childIndex = 0; child; child = child.nextSibling, childIndex++) {
21741 - let rects;
21742 - if (child.nodeType == 1) rects = child.getClientRects();
21743 - else if (child.nodeType == 3) rects = textRange(child).getClientRects();
21744 - else continue;
21745 - for (let i = 0; i < rects.length; i++) {
21746 - let rect = rects[i];
21747 - if (rect.top <= rowBot && rect.bottom >= rowTop) {
21748 - rowBot = Math.max(rect.bottom, rowBot);
21749 - rowTop = Math.min(rect.top, rowTop);
21750 - let dx = rect.left > coords.left ? rect.left - coords.left : rect.right < coords.left ? coords.left - rect.right : 0;
21751 - if (dx < dxClosest) {
21752 - closest = child;
21753 - dxClosest = dx;
21754 - coordsClosest = dx && closest.nodeType == 3 ? {
21755 - left: rect.right < coords.left ? rect.right : rect.left,
21756 - top: coords.top
21757 - } : coords;
21758 - if (child.nodeType == 1 && dx) offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0);
21759 - continue;
21760 - }
21761 - } else if (rect.top > coords.top && !firstBelow && rect.left <= coords.left && rect.right >= coords.left) {
21762 - firstBelow = child;
21763 - coordsBelow = {
21764 - left: Math.max(rect.left, Math.min(rect.right, coords.left)),
21765 - top: rect.top
21766 - };
21767 - }
21768 - if (!closest && (coords.left >= rect.right && coords.top >= rect.top || coords.left >= rect.left && coords.top >= rect.bottom)) offset = childIndex + 1;
21769 - }
21770 - }
21771 - if (!closest && firstBelow) {
21772 - closest = firstBelow;
21773 - coordsClosest = coordsBelow;
21774 - dxClosest = 0;
21775 - }
21776 - if (closest && closest.nodeType == 3) return findOffsetInText(closest, coordsClosest);
21777 - if (!closest || dxClosest && closest.nodeType == 1) return {
21778 - node,
21779 - offset
21780 - };
21781 - return findOffsetInNode(closest, coordsClosest);
21782 - }
21783 - function findOffsetInText(node, coords) {
21784 - let len = node.nodeValue.length;
21785 - let range = document.createRange();
21786 - let result;
21787 - for (let i = 0; i < len; i++) {
21788 - range.setEnd(node, i + 1);
21789 - range.setStart(node, i);
21790 - let rect = singleRect(range, 1);
21791 - if (rect.top == rect.bottom) continue;
21792 - if (inRect(coords, rect)) {
21793 - result = {
21794 - node,
21795 - offset: i + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0)
21796 - };
21797 - break;
21798 - }
21799 - }
21800 - range.detach();
21801 - return result || {
21802 - node,
21803 - offset: 0
21804 - };
21805 - }
21806 - function inRect(coords, rect) {
21807 - return coords.left >= rect.left - 1 && coords.left <= rect.right + 1 && coords.top >= rect.top - 1 && coords.top <= rect.bottom + 1;
21808 - }
21809 - function targetKludge(dom, coords) {
21810 - let parent = dom.parentNode;
21811 - if (parent && /^li$/i.test(parent.nodeName) && coords.left < dom.getBoundingClientRect().left) return parent;
21812 - return dom;
21813 - }
21814 - function posFromElement(view, elt, coords) {
21815 - let { node, offset } = findOffsetInNode(elt, coords), bias = -1;
21816 - if (node.nodeType == 1 && !node.firstChild) {
21817 - let rect = node.getBoundingClientRect();
21818 - bias = rect.left != rect.right && coords.left > (rect.left + rect.right) / 2 ? 1 : -1;
21819 - }
21820 - return view.docView.posFromDOM(node, offset, bias);
21821 - }
21822 - function posFromCaret(view, node, offset, coords) {
21823 - let outsideBlock = -1;
21824 - for (let cur = node, sawBlock = false;;) {
21825 - if (cur == view.dom) break;
21826 - let desc = view.docView.nearestDesc(cur, true);
21827 - let rect;
21828 - if (!desc) return null;
21829 - if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM) && ((rect = desc.dom.getBoundingClientRect()).width || rect.height)) {
21830 - if (desc.node.isBlock && desc.parent && !/^T(R|BODY|HEAD|FOOT)$/.test(desc.dom.nodeName)) {
21831 - if (!sawBlock && rect.left > coords.left || rect.top > coords.top) outsideBlock = desc.posBefore;
21832 - else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top) outsideBlock = desc.posAfter;
21833 - sawBlock = true;
21834 - }
21835 - if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) return (desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2 : coords.left < (rect.left + rect.right) / 2) ? desc.posBefore : desc.posAfter;
21836 - }
21837 - cur = desc.dom.parentNode;
21838 - }
21839 - return outsideBlock > -1 ? outsideBlock : view.docView.posFromDOM(node, offset, -1);
21840 - }
21841 - function elementFromPoint(element, coords, box) {
21842 - let len = element.childNodes.length;
21843 - if (len && box.top < box.bottom) for (let startI = Math.max(0, Math.min(len - 1, Math.floor(len * (coords.top - box.top) / (box.bottom - box.top)) - 2)), i = startI;;) {
21844 - let child = element.childNodes[i];
21845 - if (child.nodeType == 1) {
21846 - let rects = child.getClientRects();
21847 - for (let j = 0; j < rects.length; j++) {
21848 - let rect = rects[j];
21849 - if (inRect(coords, rect)) return elementFromPoint(child, coords, rect);
21850 - }
21851 - }
21852 - if ((i = (i + 1) % len) == startI) break;
21853 - }
21854 - return element;
21855 - }
21856 - function posAtCoords(view, coords) {
21857 - let doc = view.dom.ownerDocument;
21858 - let node;
21859 - let offset = 0;
21860 - let caret = caretFromPoint(doc, coords.left, coords.top);
21861 - if (caret) ({node, offset} = caret);
21862 - let elt = (view.root.elementFromPoint ? view.root : doc).elementFromPoint(coords.left, coords.top);
21863 - let pos;
21864 - if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) {
21865 - let box = view.dom.getBoundingClientRect();
21866 - if (!inRect(coords, box)) return null;
21867 - elt = elementFromPoint(view.dom, coords, box);
21868 - if (!elt) return null;
21869 - }
21870 - if (safari) {
21871 - for (let p = elt; node && p; p = parentNode(p)) if (p.draggable) node = void 0;
21872 - }
21873 - elt = targetKludge(elt, coords);
21874 - if (node) {
21875 - if (gecko && node.nodeType == 1) {
21876 - offset = Math.min(offset, node.childNodes.length);
21877 - if (offset < node.childNodes.length) {
21878 - let next = node.childNodes[offset];
21879 - let box;
21880 - if (next.nodeName == "IMG" && (box = next.getBoundingClientRect()).right <= coords.left && box.bottom > coords.top) offset++;
21881 - }
21882 - }
21883 - let prev;
21884 - if (webkit && offset && node.nodeType == 1 && (prev = node.childNodes[offset - 1]).nodeType == 1 && prev.contentEditable == "false" && prev.getBoundingClientRect().top >= coords.top) offset--;
21885 - if (node == view.dom && offset == node.childNodes.length - 1 && node.lastChild.nodeType == 1 && coords.top > node.lastChild.getBoundingClientRect().bottom) pos = view.state.doc.content.size;
21886 - else if (offset == 0 || node.nodeType != 1 || node.childNodes[offset - 1].nodeName != "BR") pos = posFromCaret(view, node, offset, coords);
21887 - }
21888 - if (pos == null) pos = posFromElement(view, elt, coords);
21889 - let desc = view.docView.nearestDesc(elt, true);
21890 - return {
21891 - pos,
21892 - inside: desc ? desc.posAtStart - desc.border : -1
21893 - };
21894 - }
21895 - function nonZero(rect) {
21896 - return rect.top < rect.bottom || rect.left < rect.right;
21897 - }
21898 - function singleRect(target, bias) {
21899 - let rects = target.getClientRects();
21900 - if (rects.length) {
21901 - let first = rects[bias < 0 ? 0 : rects.length - 1];
21902 - if (nonZero(first)) return first;
21903 - }
21904 - return Array.prototype.find.call(rects, nonZero) || target.getBoundingClientRect();
21905 - }
21906 - var BIDI = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
21907 - function coordsAtPos(view, pos, side) {
21908 - let { node, offset, atom } = view.docView.domFromPos(pos, side < 0 ? -1 : 1);
21909 - let supportEmptyRange = webkit || gecko;
21910 - if (node.nodeType == 3) if (supportEmptyRange && (BIDI.test(node.nodeValue) || (side < 0 ? !offset : offset == node.nodeValue.length))) {
21911 - let rect = singleRect(textRange(node, offset, offset), side);
21912 - if (gecko && offset && /\s/.test(node.nodeValue[offset - 1]) && offset < node.nodeValue.length) {
21913 - let rectBefore = singleRect(textRange(node, offset - 1, offset - 1), -1);
21914 - if (rectBefore.top == rect.top) {
21915 - let rectAfter = singleRect(textRange(node, offset, offset + 1), -1);
21916 - if (rectAfter.top != rect.top) return flattenV(rectAfter, rectAfter.left < rectBefore.left);
21917 - }
21918 - }
21919 - return rect;
21920 - } else {
21921 - let from = offset;
21922 - let to = offset;
21923 - let takeSide = side < 0 ? 1 : -1;
21924 - if (side < 0 && !offset) {
21925 - to++;
21926 - takeSide = -1;
21927 - } else if (side >= 0 && offset == node.nodeValue.length) {
21928 - from--;
21929 - takeSide = 1;
21930 - } else if (side < 0) from--;
21931 - else to++;
21932 - return flattenV(singleRect(textRange(node, from, to), takeSide), takeSide < 0);
21933 - }
21934 - if (!view.state.doc.resolve(pos - (atom || 0)).parent.inlineContent) {
21935 - if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {
21936 - let before = node.childNodes[offset - 1];
21937 - if (before.nodeType == 1) return flattenH(before.getBoundingClientRect(), false);
21938 - }
21939 - if (atom == null && offset < nodeSize(node)) {
21940 - let after = node.childNodes[offset];
21941 - if (after.nodeType == 1) return flattenH(after.getBoundingClientRect(), true);
21942 - }
21943 - return flattenH(node.getBoundingClientRect(), side >= 0);
21944 - }
21945 - if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {
21946 - let before = node.childNodes[offset - 1];
21947 - let target = before.nodeType == 3 ? textRange(before, nodeSize(before) - (supportEmptyRange ? 0 : 1)) : before.nodeType == 1 && (before.nodeName != "BR" || !before.nextSibling) ? before : null;
21948 - if (target) return flattenV(singleRect(target, 1), false);
21949 - }
21950 - if (atom == null && offset < nodeSize(node)) {
21951 - let after = node.childNodes[offset];
21952 - while (after.pmViewDesc && after.pmViewDesc.ignoreForCoords) after = after.nextSibling;
21953 - let target = !after ? null : after.nodeType == 3 ? textRange(after, 0, supportEmptyRange ? 0 : 1) : after.nodeType == 1 ? after : null;
21954 - if (target) return flattenV(singleRect(target, -1), true);
21955 - }
21956 - return flattenV(singleRect(node.nodeType == 3 ? textRange(node) : node, -side), side >= 0);
21957 - }
21958 - function flattenV(rect, left) {
21959 - if (rect.width == 0) return rect;
21960 - let x = left ? rect.left : rect.right;
21961 - return {
21962 - top: rect.top,
21963 - bottom: rect.bottom,
21964 - left: x,
21965 - right: x
21966 - };
21967 - }
21968 - function flattenH(rect, top) {
21969 - if (rect.height == 0) return rect;
21970 - let y = top ? rect.top : rect.bottom;
21971 - return {
21972 - top: y,
21973 - bottom: y,
21974 - left: rect.left,
21975 - right: rect.right
21976 - };
21977 - }
21978 - function withFlushedState(view, state, f) {
21979 - let viewState = view.state;
21980 - let active = view.root.activeElement;
21981 - if (viewState != state) view.updateState(state);
21982 - if (active != view.dom) view.focus();
21983 - try {
21984 - return f();
21985 - } finally {
21986 - if (viewState != state) view.updateState(viewState);
21987 - if (active != view.dom && active) active.focus();
21988 - }
21989 - }
21990 - function endOfTextblockVertical(view, state, dir) {
21991 - let sel = state.selection;
21992 - let $pos = dir == "up" ? sel.$from : sel.$to;
21993 - return withFlushedState(view, state, () => {
21994 - let { node: dom } = view.docView.domFromPos($pos.pos, dir == "up" ? -1 : 1);
21995 - for (;;) {
21996 - let nearest = view.docView.nearestDesc(dom, true);
21997 - if (!nearest) break;
21998 - if (nearest.node.isBlock) {
21999 - dom = nearest.contentDOM || nearest.dom;
22000 - break;
22001 - }
22002 - dom = nearest.dom.parentNode;
22003 - }
22004 - let coords = coordsAtPos(view, $pos.pos, 1);
22005 - for (let child = dom.firstChild; child; child = child.nextSibling) {
22006 - let boxes;
22007 - if (child.nodeType == 1) boxes = child.getClientRects();
22008 - else if (child.nodeType == 3) boxes = textRange(child, 0, child.nodeValue.length).getClientRects();
22009 - else continue;
22010 - for (let i = 0; i < boxes.length; i++) {
22011 - let box = boxes[i];
22012 - if (box.bottom > box.top + 1 && (dir == "up" ? coords.top - box.top > (box.bottom - coords.top) * 2 : box.bottom - coords.bottom > (coords.bottom - box.top) * 2)) return false;
22013 - }
22014 - }
22015 - return true;
22016 - });
22017 - }
22018 - var maybeRTL = /[\u0590-\u08ac]/;
22019 - function endOfTextblockHorizontal(view, state, dir) {
22020 - let { $head } = state.selection;
22021 - if (!$head.parent.isTextblock) return false;
22022 - let offset = $head.parentOffset;
22023 - let atStart = !offset;
22024 - let atEnd = offset == $head.parent.content.size;
22025 - let sel = view.domSelection();
22026 - if (!sel) return $head.pos == $head.start() || $head.pos == $head.end();
22027 - if (!maybeRTL.test($head.parent.textContent) || !sel.modify) return dir == "left" || dir == "backward" ? atStart : atEnd;
22028 - return withFlushedState(view, state, () => {
22029 - let { focusNode: oldNode, focusOffset: oldOff, anchorNode, anchorOffset } = view.domSelectionRange();
22030 - let oldBidiLevel = sel.caretBidiLevel;
22031 - sel.modify("move", dir, "character");
22032 - let parentDOM = $head.depth ? view.docView.domAfterPos($head.before()) : view.dom;
22033 - let { focusNode: newNode, focusOffset: newOff } = view.domSelectionRange();
22034 - let result = newNode && !parentDOM.contains(newNode.nodeType == 1 ? newNode : newNode.parentNode) || oldNode == newNode && oldOff == newOff;
22035 - try {
22036 - sel.collapse(anchorNode, anchorOffset);
22037 - if (oldNode && (oldNode != anchorNode || oldOff != anchorOffset) && sel.extend) sel.extend(oldNode, oldOff);
22038 - } catch (_) {}
22039 - if (oldBidiLevel != null) sel.caretBidiLevel = oldBidiLevel;
22040 - return result;
22041 - });
22042 - }
22043 - var cachedState = null;
22044 - var cachedDir = null;
22045 - var cachedResult = false;
22046 - function endOfTextblock(view, state, dir) {
22047 - if (cachedState == state && cachedDir == dir) return cachedResult;
22048 - cachedState = state;
22049 - cachedDir = dir;
22050 - return cachedResult = dir == "up" || dir == "down" ? endOfTextblockVertical(view, state, dir) : endOfTextblockHorizontal(view, state, dir);
22051 - }
22052 - var NOT_DIRTY = 0;
22053 - var CHILD_DIRTY = 1;
22054 - var CONTENT_DIRTY = 2;
22055 - var NODE_DIRTY = 3;
22056 - var ViewDesc = class {
22057 - constructor(parent, children, dom, contentDOM) {
22058 - this.parent = parent;
22059 - this.children = children;
22060 - this.dom = dom;
22061 - this.contentDOM = contentDOM;
22062 - this.dirty = NOT_DIRTY;
22063 - dom.pmViewDesc = this;
22064 - }
22065 - matchesWidget(widget) {
22066 - return false;
22067 - }
22068 - matchesMark(mark) {
22069 - return false;
22070 - }
22071 - matchesNode(node, outerDeco, innerDeco) {
22072 - return false;
22073 - }
22074 - matchesHack(nodeName) {
22075 - return false;
22076 - }
22077 - parseRule() {
22078 - return null;
22079 - }
22080 - stopEvent(event) {
22081 - return false;
22082 - }
22083 - get size() {
22084 - let size = 0;
22085 - for (let i = 0; i < this.children.length; i++) size += this.children[i].size;
22086 - return size;
22087 - }
22088 - get border() {
22089 - return 0;
22090 - }
22091 - destroy() {
22092 - this.parent = void 0;
22093 - if (this.dom.pmViewDesc == this) this.dom.pmViewDesc = void 0;
22094 - for (let i = 0; i < this.children.length; i++) this.children[i].destroy();
22095 - }
22096 - posBeforeChild(child) {
22097 - for (let i = 0, pos = this.posAtStart;; i++) {
22098 - let cur = this.children[i];
22099 - if (cur == child) return pos;
22100 - pos += cur.size;
22101 - }
22102 - }
22103 - get posBefore() {
22104 - return this.parent.posBeforeChild(this);
22105 - }
22106 - get posAtStart() {
22107 - return this.parent ? this.parent.posBeforeChild(this) + this.border : 0;
22108 - }
22109 - get posAfter() {
22110 - return this.posBefore + this.size;
22111 - }
22112 - get posAtEnd() {
22113 - return this.posAtStart + this.size - 2 * this.border;
22114 - }
22115 - localPosFromDOM(dom, offset, bias) {
22116 - if (this.contentDOM && this.contentDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode)) if (bias < 0) {
22117 - let domBefore;
22118 - let desc;
22119 - if (dom == this.contentDOM) domBefore = dom.childNodes[offset - 1];
22120 - else {
22121 - while (dom.parentNode != this.contentDOM) dom = dom.parentNode;
22122 - domBefore = dom.previousSibling;
22123 - }
22124 - while (domBefore && !((desc = domBefore.pmViewDesc) && desc.parent == this)) domBefore = domBefore.previousSibling;
22125 - return domBefore ? this.posBeforeChild(desc) + desc.size : this.posAtStart;
22126 - } else {
22127 - let domAfter;
22128 - let desc;
22129 - if (dom == this.contentDOM) domAfter = dom.childNodes[offset];
22130 - else {
22131 - while (dom.parentNode != this.contentDOM) dom = dom.parentNode;
22132 - domAfter = dom.nextSibling;
22133 - }
22134 - while (domAfter && !((desc = domAfter.pmViewDesc) && desc.parent == this)) domAfter = domAfter.nextSibling;
22135 - return domAfter ? this.posBeforeChild(desc) : this.posAtEnd;
22136 - }
22137 - let atEnd;
22138 - if (dom == this.dom && this.contentDOM) atEnd = offset > domIndex(this.contentDOM);
22139 - else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) atEnd = dom.compareDocumentPosition(this.contentDOM) & 2;
22140 - else if (this.dom.firstChild) {
22141 - if (offset == 0) for (let search = dom;; search = search.parentNode) {
22142 - if (search == this.dom) {
22143 - atEnd = false;
22144 - break;
22145 - }
22146 - if (search.previousSibling) break;
22147 - }
22148 - if (atEnd == null && offset == dom.childNodes.length) for (let search = dom;; search = search.parentNode) {
22149 - if (search == this.dom) {
22150 - atEnd = true;
22151 - break;
22152 - }
22153 - if (search.nextSibling) break;
22154 - }
22155 - }
22156 - return (atEnd == null ? bias > 0 : atEnd) ? this.posAtEnd : this.posAtStart;
22157 - }
22158 - nearestDesc(dom, onlyNodes = false) {
22159 - for (let first = true, cur = dom; cur; cur = cur.parentNode) {
22160 - let desc = this.getDesc(cur);
22161 - let nodeDOM;
22162 - if (desc && (!onlyNodes || desc.node)) if (first && (nodeDOM = desc.nodeDOM) && !(nodeDOM.nodeType == 1 ? nodeDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode) : nodeDOM == dom)) first = false;
22163 - else return desc;
22164 - }
22165 - }
22166 - getDesc(dom) {
22167 - let desc = dom.pmViewDesc;
22168 - for (let cur = desc; cur; cur = cur.parent) if (cur == this) return desc;
22169 - }
22170 - posFromDOM(dom, offset, bias) {
22171 - for (let scan = dom; scan; scan = scan.parentNode) {
22172 - let desc = this.getDesc(scan);
22173 - if (desc) return desc.localPosFromDOM(dom, offset, bias);
22174 - }
22175 - return -1;
22176 - }
22177 - descAt(pos) {
22178 - for (let i = 0, offset = 0; i < this.children.length; i++) {
22179 - let child = this.children[i];
22180 - let end = offset + child.size;
22181 - if (offset == pos && end != offset) {
22182 - while (!child.border && child.children.length) for (let i = 0; i < child.children.length; i++) {
22183 - let inner = child.children[i];
22184 - if (inner.size) {
22185 - child = inner;
22186 - break;
22187 - }
22188 - }
22189 - return child;
22190 - }
22191 - if (pos < end) return child.descAt(pos - offset - child.border);
22192 - offset = end;
22193 - }
22194 - }
22195 - domFromPos(pos, side) {
22196 - if (!this.contentDOM) return {
22197 - node: this.dom,
22198 - offset: 0,
22199 - atom: pos + 1
22200 - };
22201 - let i = 0;
22202 - let offset = 0;
22203 - for (let curPos = 0; i < this.children.length; i++) {
22204 - let child = this.children[i];
22205 - let end = curPos + child.size;
22206 - if (end > pos || child instanceof TrailingHackViewDesc) {
22207 - offset = pos - curPos;
22208 - break;
22209 - }
22210 - curPos = end;
22211 - }
22212 - if (offset) return this.children[i].domFromPos(offset - this.children[i].border, side);
22213 - for (let prev; i && !(prev = this.children[i - 1]).size && prev instanceof WidgetViewDesc && prev.side >= 0; i--);
22214 - if (side <= 0) {
22215 - let prev;
22216 - let enter = true;
22217 - for (;; i--, enter = false) {
22218 - prev = i ? this.children[i - 1] : null;
22219 - if (!prev || prev.dom.parentNode == this.contentDOM) break;
22220 - }
22221 - if (prev && side && enter && !prev.border && !prev.domAtom) return prev.domFromPos(prev.size, side);
22222 - return {
22223 - node: this.contentDOM,
22224 - offset: prev ? domIndex(prev.dom) + 1 : 0
22225 - };
22226 - } else {
22227 - let next;
22228 - let enter = true;
22229 - for (;; i++, enter = false) {
22230 - next = i < this.children.length ? this.children[i] : null;
22231 - if (!next || next.dom.parentNode == this.contentDOM) break;
22232 - }
22233 - if (next && enter && !next.border && !next.domAtom) return next.domFromPos(0, side);
22234 - return {
22235 - node: this.contentDOM,
22236 - offset: next ? domIndex(next.dom) : this.contentDOM.childNodes.length
22237 - };
22238 - }
22239 - }
22240 - parseRange(from, to, base = 0) {
22241 - if (this.children.length == 0) return {
22242 - node: this.contentDOM,
22243 - from,
22244 - to,
22245 - fromOffset: 0,
22246 - toOffset: this.contentDOM.childNodes.length
22247 - };
22248 - let fromOffset = -1;
22249 - let toOffset = -1;
22250 - for (let offset = base, i = 0;; i++) {
22251 - let child = this.children[i];
22252 - let end = offset + child.size;
22253 - if (fromOffset == -1 && from <= end) {
22254 - let childBase = offset + child.border;
22255 - if (from >= childBase && to <= end - child.border && child.node && child.contentDOM && this.contentDOM.contains(child.contentDOM)) return child.parseRange(from, to, childBase);
22256 - from = offset;
22257 - for (let j = i; j > 0; j--) {
22258 - let prev = this.children[j - 1];
22259 - if (prev.size && prev.dom.parentNode == this.contentDOM && !prev.emptyChildAt(1)) {
22260 - fromOffset = domIndex(prev.dom) + 1;
22261 - break;
22262 - }
22263 - from -= prev.size;
22264 - }
22265 - if (fromOffset == -1) fromOffset = 0;
22266 - }
22267 - if (fromOffset > -1 && (end > to || i == this.children.length - 1)) {
22268 - to = end;
22269 - for (let j = i + 1; j < this.children.length; j++) {
22270 - let next = this.children[j];
22271 - if (next.size && next.dom.parentNode == this.contentDOM && !next.emptyChildAt(-1)) {
22272 - toOffset = domIndex(next.dom);
22273 - break;
22274 - }
22275 - to += next.size;
22276 - }
22277 - if (toOffset == -1) toOffset = this.contentDOM.childNodes.length;
22278 - break;
22279 - }
22280 - offset = end;
22281 - }
22282 - return {
22283 - node: this.contentDOM,
22284 - from,
22285 - to,
22286 - fromOffset,
22287 - toOffset
22288 - };
22289 - }
22290 - emptyChildAt(side) {
22291 - if (this.border || !this.contentDOM || !this.children.length) return false;
22292 - let child = this.children[side < 0 ? 0 : this.children.length - 1];
22293 - return child.size == 0 || child.emptyChildAt(side);
22294 - }
22295 - domAfterPos(pos) {
22296 - let { node, offset } = this.domFromPos(pos, 0);
22297 - if (node.nodeType != 1 || offset == node.childNodes.length) throw new RangeError("No node after pos " + pos);
22298 - return node.childNodes[offset];
22299 - }
22300 - setSelection(anchor, head, view, force = false) {
22301 - let from = Math.min(anchor, head);
22302 - let to = Math.max(anchor, head);
22303 - for (let i = 0, offset = 0; i < this.children.length; i++) {
22304 - let child = this.children[i];
22305 - let end = offset + child.size;
22306 - if (from > offset && to < end) return child.setSelection(anchor - offset - child.border, head - offset - child.border, view, force);
22307 - offset = end;
22308 - }
22309 - let anchorDOM = this.domFromPos(anchor, anchor ? -1 : 1);
22310 - let headDOM = head == anchor ? anchorDOM : this.domFromPos(head, head ? -1 : 1);
22311 - let domSel = view.root.getSelection();
22312 - let selRange = view.domSelectionRange();
22313 - let brKludge = false;
22314 - if ((gecko || safari) && anchor == head) {
22315 - let { node, offset } = anchorDOM;
22316 - if (node.nodeType == 3) {
22317 - brKludge = !!(offset && node.nodeValue[offset - 1] == "\n");
22318 - if (brKludge && offset == node.nodeValue.length) for (let scan = node, after; scan; scan = scan.parentNode) {
22319 - if (after = scan.nextSibling) {
22320 - if (after.nodeName == "BR") anchorDOM = headDOM = {
22321 - node: after.parentNode,
22322 - offset: domIndex(after) + 1
22323 - };
22324 - break;
22325 - }
22326 - let desc = scan.pmViewDesc;
22327 - if (desc && desc.node && desc.node.isBlock) break;
22328 - }
22329 - } else {
22330 - let prev = node.childNodes[offset - 1];
22331 - brKludge = prev && (prev.nodeName == "BR" || prev.contentEditable == "false");
22332 - }
22333 - }
22334 - if (gecko && selRange.focusNode && selRange.focusNode != headDOM.node && selRange.focusNode.nodeType == 1) {
22335 - let after = selRange.focusNode.childNodes[selRange.focusOffset];
22336 - if (after && after.contentEditable == "false") force = true;
22337 - }
22338 - if (!(force || brKludge && safari) && isEquivalentPosition(anchorDOM.node, anchorDOM.offset, selRange.anchorNode, selRange.anchorOffset) && isEquivalentPosition(headDOM.node, headDOM.offset, selRange.focusNode, selRange.focusOffset)) return;
22339 - let domSelExtended = false;
22340 - if ((domSel.extend || anchor == head) && !(brKludge && gecko)) {
22341 - domSel.collapse(anchorDOM.node, anchorDOM.offset);
22342 - try {
22343 - if (anchor != head) domSel.extend(headDOM.node, headDOM.offset);
22344 - domSelExtended = true;
22345 - } catch (_) {}
22346 - }
22347 - if (!domSelExtended) {
22348 - if (anchor > head) {
22349 - let tmp = anchorDOM;
22350 - anchorDOM = headDOM;
22351 - headDOM = tmp;
22352 - }
22353 - let range = document.createRange();
22354 - range.setEnd(headDOM.node, headDOM.offset);
22355 - range.setStart(anchorDOM.node, anchorDOM.offset);
22356 - domSel.removeAllRanges();
22357 - domSel.addRange(range);
22358 - }
22359 - }
22360 - ignoreMutation(mutation) {
22361 - return !this.contentDOM && mutation.type != "selection";
22362 - }
22363 - get contentLost() {
22364 - return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM);
22365 - }
22366 - markDirty(from, to) {
22367 - for (let offset = 0, i = 0; i < this.children.length; i++) {
22368 - let child = this.children[i];
22369 - let end = offset + child.size;
22370 - if (offset == end ? from <= end && to >= offset : from < end && to > offset) {
22371 - let startInside = offset + child.border;
22372 - let endInside = end - child.border;
22373 - if (from >= startInside && to <= endInside) {
22374 - this.dirty = from == offset || to == end ? CONTENT_DIRTY : CHILD_DIRTY;
22375 - if (from == startInside && to == endInside && (child.contentLost || child.dom.parentNode != this.contentDOM)) child.dirty = NODE_DIRTY;
22376 - else child.markDirty(from - startInside, to - startInside);
22377 - return;
22378 - } else child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM && !child.children.length ? CONTENT_DIRTY : NODE_DIRTY;
22379 - }
22380 - offset = end;
22381 - }
22382 - this.dirty = CONTENT_DIRTY;
22383 - }
22384 - markParentsDirty() {
22385 - let level = 1;
22386 - for (let node = this.parent; node; node = node.parent, level++) {
22387 - let dirty = level == 1 ? CONTENT_DIRTY : CHILD_DIRTY;
22388 - if (node.dirty < dirty) node.dirty = dirty;
22389 - }
22390 - }
22391 - get domAtom() {
22392 - return false;
22393 - }
22394 - get ignoreForCoords() {
22395 - return false;
22396 - }
22397 - get ignoreForSelection() {
22398 - return false;
22399 - }
22400 - isText(text) {
22401 - return false;
22402 - }
22403 - };
22404 - var WidgetViewDesc = class extends ViewDesc {
22405 - constructor(parent, widget, view, pos) {
22406 - let self;
22407 - let dom = widget.type.toDOM;
22408 - if (typeof dom == "function") dom = dom(view, () => {
22409 - if (!self) return pos;
22410 - if (self.parent) return self.parent.posBeforeChild(self);
22411 - });
22412 - if (!widget.type.spec.raw) {
22413 - if (dom.nodeType != 1) {
22414 - let wrap = document.createElement("span");
22415 - wrap.appendChild(dom);
22416 - dom = wrap;
22417 - }
22418 - dom.contentEditable = "false";
22419 - dom.classList.add("ProseMirror-widget");
22420 - }
22421 - super(parent, [], dom, null);
22422 - this.widget = widget;
22423 - this.widget = widget;
22424 - self = this;
22425 - }
22426 - matchesWidget(widget) {
22427 - return this.dirty == NOT_DIRTY && widget.type.eq(this.widget.type);
22428 - }
22429 - parseRule() {
22430 - return { ignore: true };
22431 - }
22432 - stopEvent(event) {
22433 - let stop = this.widget.spec.stopEvent;
22434 - return stop ? stop(event) : false;
22435 - }
22436 - ignoreMutation(mutation) {
22437 - return mutation.type != "selection" || this.widget.spec.ignoreSelection;
22438 - }
22439 - destroy() {
22440 - this.widget.type.destroy(this.dom);
22441 - super.destroy();
22442 - }
22443 - get domAtom() {
22444 - return true;
22445 - }
22446 - get ignoreForSelection() {
22447 - return !!this.widget.type.spec.relaxedSide;
22448 - }
22449 - get side() {
22450 - return this.widget.type.side;
22451 - }
22452 - };
22453 - var CompositionViewDesc = class extends ViewDesc {
22454 - constructor(parent, dom, textDOM, text) {
22455 - super(parent, [], dom, null);
22456 - this.textDOM = textDOM;
22457 - this.text = text;
22458 - }
22459 - get size() {
22460 - return this.text.length;
22461 - }
22462 - localPosFromDOM(dom, offset) {
22463 - if (dom != this.textDOM) return this.posAtStart + (offset ? this.size : 0);
22464 - return this.posAtStart + offset;
22465 - }
22466 - domFromPos(pos) {
22467 - return {
22468 - node: this.textDOM,
22469 - offset: pos
22470 - };
22471 - }
22472 - ignoreMutation(mut) {
22473 - return mut.type === "characterData" && mut.target.nodeValue == mut.oldValue;
22474 - }
22475 - };
22476 - var MarkViewDesc = class MarkViewDesc extends ViewDesc {
22477 - constructor(parent, mark, dom, contentDOM, spec) {
22478 - super(parent, [], dom, contentDOM);
22479 - this.mark = mark;
22480 - this.spec = spec;
22481 - }
22482 - static create(parent, mark, inline, view) {
22483 - let custom = view.nodeViews[mark.type.name];
22484 - let spec = custom && custom(mark, view, inline);
22485 - if (!spec || !spec.dom) spec = DOMSerializer.renderSpec(document, mark.type.spec.toDOM(mark, inline), null, mark.attrs);
22486 - return new MarkViewDesc(parent, mark, spec.dom, spec.contentDOM || spec.dom, spec);
22487 - }
22488 - parseRule() {
22489 - if (this.dirty & NODE_DIRTY || this.mark.type.spec.reparseInView) return null;
22490 - return {
22491 - mark: this.mark.type.name,
22492 - attrs: this.mark.attrs,
22493 - contentElement: this.contentDOM
22494 - };
22495 - }
22496 - matchesMark(mark) {
22497 - return this.dirty != NODE_DIRTY && this.mark.eq(mark);
22498 - }
22499 - markDirty(from, to) {
22500 - super.markDirty(from, to);
22501 - if (this.dirty != NOT_DIRTY) {
22502 - let parent = this.parent;
22503 - while (!parent.node) parent = parent.parent;
22504 - if (parent.dirty < this.dirty) parent.dirty = this.dirty;
22505 - this.dirty = NOT_DIRTY;
22506 - }
22507 - }
22508 - slice(from, to, view) {
22509 - let copy = MarkViewDesc.create(this.parent, this.mark, true, view);
22510 - let nodes = this.children;
22511 - let size = this.size;
22512 - if (to < size) nodes = replaceNodes(nodes, to, size, view);
22513 - if (from > 0) nodes = replaceNodes(nodes, 0, from, view);
22514 - for (let i = 0; i < nodes.length; i++) nodes[i].parent = copy;
22515 - copy.children = nodes;
22516 - return copy;
22517 - }
22518 - ignoreMutation(mutation) {
22519 - return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation);
22520 - }
22521 - destroy() {
22522 - if (this.spec.destroy) this.spec.destroy();
22523 - super.destroy();
22524 - }
22525 - };
22526 - var NodeViewDesc = class NodeViewDesc extends ViewDesc {
22527 - constructor(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos) {
22528 - super(parent, [], dom, contentDOM);
22529 - this.node = node;
22530 - this.outerDeco = outerDeco;
22531 - this.innerDeco = innerDeco;
22532 - this.nodeDOM = nodeDOM;
22533 - }
22534 - static create(parent, node, outerDeco, innerDeco, view, pos) {
22535 - let custom = view.nodeViews[node.type.name];
22536 - let descObj;
22537 - let spec = custom && custom(node, view, () => {
22538 - if (!descObj) return pos;
22539 - if (descObj.parent) return descObj.parent.posBeforeChild(descObj);
22540 - }, outerDeco, innerDeco);
22541 - let dom = spec && spec.dom;
22542 - let contentDOM = spec && spec.contentDOM;
22543 - if (node.isText) {
22544 - if (!dom) dom = document.createTextNode(node.text);
22545 - else if (dom.nodeType != 3) throw new RangeError("Text must be rendered as a DOM text node");
22546 - } else if (!dom) {
22547 - let spec = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node), null, node.attrs);
22548 - ({dom, contentDOM} = spec);
22549 - }
22550 - if (!contentDOM && !node.isText && dom.nodeName != "BR") {
22551 - if (!dom.hasAttribute("contenteditable")) dom.contentEditable = "false";
22552 - if (node.type.spec.draggable) dom.draggable = true;
22553 - }
22554 - let nodeDOM = dom;
22555 - dom = applyOuterDeco(dom, outerDeco, node);
22556 - if (spec) return descObj = new CustomNodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, spec, view, pos + 1);
22557 - else if (node.isText) return new TextViewDesc(parent, node, outerDeco, innerDeco, dom, nodeDOM, view);
22558 - else return new NodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, view, pos + 1);
22559 - }
22560 - parseRule() {
22561 - if (this.node.type.spec.reparseInView) return null;
22562 - let rule = {
22563 - node: this.node.type.name,
22564 - attrs: this.node.attrs
22565 - };
22566 - if (this.node.type.whitespace == "pre") rule.preserveWhitespace = "full";
22567 - if (!this.contentDOM) rule.getContent = () => this.node.content;
22568 - else if (!this.contentLost) rule.contentElement = this.contentDOM;
22569 - else {
22570 - for (let i = this.children.length - 1; i >= 0; i--) {
22571 - let child = this.children[i];
22572 - if (this.dom.contains(child.dom.parentNode)) {
22573 - rule.contentElement = child.dom.parentNode;
22574 - break;
22575 - }
22576 - }
22577 - if (!rule.contentElement) rule.getContent = () => Fragment$1.empty;
22578 - }
22579 - return rule;
22580 - }
22581 - matchesNode(node, outerDeco, innerDeco) {
22582 - return this.dirty == NOT_DIRTY && node.eq(this.node) && sameOuterDeco(outerDeco, this.outerDeco) && innerDeco.eq(this.innerDeco);
22583 - }
22584 - get size() {
22585 - return this.node.nodeSize;
22586 - }
22587 - get border() {
22588 - return this.node.isLeaf ? 0 : 1;
22589 - }
22590 - updateChildren(view, pos) {
22591 - let inline = this.node.inlineContent;
22592 - let off = pos;
22593 - let composition = view.composing ? this.localCompositionInfo(view, pos) : null;
22594 - let localComposition = composition && composition.pos > -1 ? composition : null;
22595 - let compositionInChild = composition && composition.pos < 0;
22596 - let updater = new ViewTreeUpdater(this, localComposition && localComposition.node, view);
22597 - iterDeco(this.node, this.innerDeco, (widget, i, insideNode) => {
22598 - if (widget.spec.marks) updater.syncToMarks(widget.spec.marks, inline, view, i);
22599 - else if (widget.type.side >= 0 && !insideNode) updater.syncToMarks(i == this.node.childCount ? Mark$1.none : this.node.child(i).marks, inline, view, i);
22600 - updater.placeWidget(widget, view, off);
22601 - }, (child, outerDeco, innerDeco, i) => {
22602 - updater.syncToMarks(child.marks, inline, view, i);
22603 - let compIndex;
22604 - if (updater.findNodeMatch(child, outerDeco, innerDeco, i));
22605 - else if (compositionInChild && view.state.selection.from > off && view.state.selection.to < off + child.nodeSize && (compIndex = updater.findIndexWithChild(composition.node)) > -1 && updater.updateNodeAt(child, outerDeco, innerDeco, compIndex, view));
22606 - else if (updater.updateNextNode(child, outerDeco, innerDeco, view, i, off));
22607 - else updater.addNode(child, outerDeco, innerDeco, view, off);
22608 - off += child.nodeSize;
22609 - });
22610 - updater.syncToMarks([], inline, view, 0);
22611 - if (this.node.isTextblock) updater.addTextblockHacks();
22612 - updater.destroyRest();
22613 - if (updater.changed || this.dirty == CONTENT_DIRTY) {
22614 - if (localComposition) this.protectLocalComposition(view, localComposition);
22615 - renderDescs(this.contentDOM, this.children, view);
22616 - if (ios) iosHacks(this.dom);
22617 - }
22618 - }
22619 - localCompositionInfo(view, pos) {
22620 - let { from, to } = view.state.selection;
22621 - if (!(view.state.selection instanceof TextSelection) || from < pos || to > pos + this.node.content.size) return null;
22622 - let textNode = view.input.compositionNode;
22623 - if (!textNode || !this.dom.contains(textNode.parentNode)) return null;
22624 - if (this.node.inlineContent) {
22625 - let text = textNode.nodeValue;
22626 - let textPos = findTextInFragment(this.node.content, text, from - pos, to - pos);
22627 - return textPos < 0 ? null : {
22628 - node: textNode,
22629 - pos: textPos,
22630 - text
22631 - };
22632 - } else return {
22633 - node: textNode,
22634 - pos: -1,
22635 - text: ""
22636 - };
22637 - }
22638 - protectLocalComposition(view, { node, pos, text }) {
22639 - if (this.getDesc(node)) return;
22640 - let topNode = node;
22641 - for (;; topNode = topNode.parentNode) {
22642 - if (topNode.parentNode == this.contentDOM) break;
22643 - while (topNode.previousSibling) topNode.parentNode.removeChild(topNode.previousSibling);
22644 - while (topNode.nextSibling) topNode.parentNode.removeChild(topNode.nextSibling);
22645 - if (topNode.pmViewDesc) topNode.pmViewDesc = void 0;
22646 - }
22647 - let desc = new CompositionViewDesc(this, topNode, node, text);
22648 - view.input.compositionNodes.push(desc);
22649 - this.children = replaceNodes(this.children, pos, pos + text.length, view, desc);
22650 - }
22651 - update(node, outerDeco, innerDeco, view) {
22652 - if (this.dirty == NODE_DIRTY || !node.sameMarkup(this.node)) return false;
22653 - this.updateInner(node, outerDeco, innerDeco, view);
22654 - return true;
22655 - }
22656 - updateInner(node, outerDeco, innerDeco, view) {
22657 - this.updateOuterDeco(outerDeco);
22658 - this.node = node;
22659 - this.innerDeco = innerDeco;
22660 - if (this.contentDOM) this.updateChildren(view, this.posAtStart);
22661 - this.dirty = NOT_DIRTY;
22662 - }
22663 - updateOuterDeco(outerDeco) {
22664 - if (sameOuterDeco(outerDeco, this.outerDeco)) return;
22665 - let needsWrap = this.nodeDOM.nodeType != 1;
22666 - let oldDOM = this.dom;
22667 - this.dom = patchOuterDeco(this.dom, this.nodeDOM, computeOuterDeco(this.outerDeco, this.node, needsWrap), computeOuterDeco(outerDeco, this.node, needsWrap));
22668 - if (this.dom != oldDOM) {
22669 - oldDOM.pmViewDesc = void 0;
22670 - this.dom.pmViewDesc = this;
22671 - }
22672 - this.outerDeco = outerDeco;
22673 - }
22674 - selectNode() {
22675 - if (this.nodeDOM.nodeType == 1) {
22676 - this.nodeDOM.classList.add("ProseMirror-selectednode");
22677 - if (this.contentDOM || !this.node.type.spec.draggable) this.nodeDOM.draggable = true;
22678 - }
22679 - }
22680 - deselectNode() {
22681 - if (this.nodeDOM.nodeType == 1) {
22682 - this.nodeDOM.classList.remove("ProseMirror-selectednode");
22683 - if (this.contentDOM || !this.node.type.spec.draggable) this.nodeDOM.removeAttribute("draggable");
22684 - }
22685 - }
22686 - get domAtom() {
22687 - return this.node.isAtom;
22688 - }
22689 - };
22690 - function docViewDesc(doc, outerDeco, innerDeco, dom, view) {
22691 - applyOuterDeco(dom, outerDeco, doc);
22692 - let docView = new NodeViewDesc(void 0, doc, outerDeco, innerDeco, dom, dom, dom, view, 0);
22693 - if (docView.contentDOM) docView.updateChildren(view, 0);
22694 - return docView;
22695 - }
22696 - var TextViewDesc = class TextViewDesc extends NodeViewDesc {
22697 - constructor(parent, node, outerDeco, innerDeco, dom, nodeDOM, view) {
22698 - super(parent, node, outerDeco, innerDeco, dom, null, nodeDOM, view, 0);
22699 - }
22700 - parseRule() {
22701 - let skip = this.nodeDOM.parentNode;
22702 - while (skip && skip != this.dom && !skip.pmIsDeco) skip = skip.parentNode;
22703 - return { skip: skip || true };
22704 - }
22705 - update(node, outerDeco, innerDeco, view) {
22706 - if (this.dirty == NODE_DIRTY || this.dirty != NOT_DIRTY && !this.inParent() || !node.sameMarkup(this.node)) return false;
22707 - this.updateOuterDeco(outerDeco);
22708 - if ((this.dirty != NOT_DIRTY || node.text != this.node.text) && node.text != this.nodeDOM.nodeValue) {
22709 - this.nodeDOM.nodeValue = node.text;
22710 - if (view.trackWrites == this.nodeDOM) view.trackWrites = null;
22711 - }
22712 - this.node = node;
22713 - this.dirty = NOT_DIRTY;
22714 - return true;
22715 - }
22716 - inParent() {
22717 - let parentDOM = this.parent.contentDOM;
22718 - for (let n = this.nodeDOM; n; n = n.parentNode) if (n == parentDOM) return true;
22719 - return false;
22720 - }
22721 - domFromPos(pos) {
22722 - return {
22723 - node: this.nodeDOM,
22724 - offset: pos
22725 - };
22726 - }
22727 - localPosFromDOM(dom, offset, bias) {
22728 - if (dom == this.nodeDOM) return this.posAtStart + Math.min(offset, this.node.text.length);
22729 - return super.localPosFromDOM(dom, offset, bias);
22730 - }
22731 - ignoreMutation(mutation) {
22732 - return mutation.type != "characterData" && mutation.type != "selection";
22733 - }
22734 - slice(from, to, view) {
22735 - let node = this.node.cut(from, to);
22736 - let dom = document.createTextNode(node.text);
22737 - return new TextViewDesc(this.parent, node, this.outerDeco, this.innerDeco, dom, dom, view);
22738 - }
22739 - markDirty(from, to) {
22740 - super.markDirty(from, to);
22741 - if (this.dom != this.nodeDOM && (from == 0 || to == this.nodeDOM.nodeValue.length)) this.dirty = NODE_DIRTY;
22742 - }
22743 - get domAtom() {
22744 - return false;
22745 - }
22746 - isText(text) {
22747 - return this.node.text == text;
22748 - }
22749 - };
22750 - var TrailingHackViewDesc = class extends ViewDesc {
22751 - parseRule() {
22752 - return { ignore: true };
22753 - }
22754 - matchesHack(nodeName) {
22755 - return this.dirty == NOT_DIRTY && this.dom.nodeName == nodeName;
22756 - }
22757 - get domAtom() {
22758 - return true;
22759 - }
22760 - get ignoreForCoords() {
22761 - return this.dom.nodeName == "IMG";
22762 - }
22763 - };
22764 - var CustomNodeViewDesc = class extends NodeViewDesc {
22765 - constructor(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, spec, view, pos) {
22766 - super(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos);
22767 - this.spec = spec;
22768 - }
22769 - update(node, outerDeco, innerDeco, view) {
22770 - if (this.dirty == NODE_DIRTY) return false;
22771 - if (this.spec.update && (this.node.type == node.type || this.spec.multiType)) {
22772 - let result = this.spec.update(node, outerDeco, innerDeco);
22773 - if (result) this.updateInner(node, outerDeco, innerDeco, view);
22774 - return result;
22775 - } else if (!this.contentDOM && !node.isLeaf) return false;
22776 - else return super.update(node, outerDeco, innerDeco, view);
22777 - }
22778 - selectNode() {
22779 - this.spec.selectNode ? this.spec.selectNode() : super.selectNode();
22780 - }
22781 - deselectNode() {
22782 - this.spec.deselectNode ? this.spec.deselectNode() : super.deselectNode();
22783 - }
22784 - setSelection(anchor, head, view, force) {
22785 - this.spec.setSelection ? this.spec.setSelection(anchor, head, view.root) : super.setSelection(anchor, head, view, force);
22786 - }
22787 - destroy() {
22788 - if (this.spec.destroy) this.spec.destroy();
22789 - super.destroy();
22790 - }
22791 - stopEvent(event) {
22792 - return this.spec.stopEvent ? this.spec.stopEvent(event) : false;
22793 - }
22794 - ignoreMutation(mutation) {
22795 - return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation);
22796 - }
22797 - };
22798 - function renderDescs(parentDOM, descs, view) {
22799 - let dom = parentDOM.firstChild;
22800 - let written = false;
22801 - for (let i = 0; i < descs.length; i++) {
22802 - let desc = descs[i];
22803 - let childDOM = desc.dom;
22804 - if (childDOM.parentNode == parentDOM) {
22805 - while (childDOM != dom) {
22806 - dom = rm(dom);
22807 - written = true;
22808 - }
22809 - dom = dom.nextSibling;
22810 - } else {
22811 - written = true;
22812 - parentDOM.insertBefore(childDOM, dom);
22813 - }
22814 - if (desc instanceof MarkViewDesc) {
22815 - let pos = dom ? dom.previousSibling : parentDOM.lastChild;
22816 - renderDescs(desc.contentDOM, desc.children, view);
22817 - dom = pos ? pos.nextSibling : parentDOM.firstChild;
22818 - }
22819 - }
22820 - while (dom) {
22821 - dom = rm(dom);
22822 - written = true;
22823 - }
22824 - if (written && view.trackWrites == parentDOM) view.trackWrites = null;
22825 - }
22826 - var OuterDecoLevel = function(nodeName) {
22827 - if (nodeName) this.nodeName = nodeName;
22828 - };
22829 - OuterDecoLevel.prototype = Object.create(null);
22830 - var noDeco = [new OuterDecoLevel()];
22831 - function computeOuterDeco(outerDeco, node, needsWrap) {
22832 - if (outerDeco.length == 0) return noDeco;
22833 - let top = needsWrap ? noDeco[0] : new OuterDecoLevel();
22834 - let result = [top];
22835 - for (let i = 0; i < outerDeco.length; i++) {
22836 - let attrs = outerDeco[i].type.attrs;
22837 - if (!attrs) continue;
22838 - if (attrs.nodeName) result.push(top = new OuterDecoLevel(attrs.nodeName));
22839 - for (let name in attrs) {
22840 - let val = attrs[name];
22841 - if (val == null) continue;
22842 - if (needsWrap && result.length == 1) result.push(top = new OuterDecoLevel(node.isInline ? "span" : "div"));
22843 - if (name == "class") top.class = (top.class ? top.class + " " : "") + val;
22844 - else if (name == "style") top.style = (top.style ? top.style + ";" : "") + val;
22845 - else if (name != "nodeName") top[name] = val;
22846 - }
22847 - }
22848 - return result;
22849 - }
22850 - function patchOuterDeco(outerDOM, nodeDOM, prevComputed, curComputed) {
22851 - if (prevComputed == noDeco && curComputed == noDeco) return nodeDOM;
22852 - let curDOM = nodeDOM;
22853 - for (let i = 0; i < curComputed.length; i++) {
22854 - let deco = curComputed[i];
22855 - let prev = prevComputed[i];
22856 - if (i) {
22857 - let parent;
22858 - if (prev && prev.nodeName == deco.nodeName && curDOM != outerDOM && (parent = curDOM.parentNode) && parent.nodeName.toLowerCase() == deco.nodeName) curDOM = parent;
22859 - else {
22860 - parent = document.createElement(deco.nodeName);
22861 - parent.pmIsDeco = true;
22862 - parent.appendChild(curDOM);
22863 - prev = noDeco[0];
22864 - curDOM = parent;
22865 - }
22866 - }
22867 - patchAttributes(curDOM, prev || noDeco[0], deco);
22868 - }
22869 - return curDOM;
22870 - }
22871 - function patchAttributes(dom, prev, cur) {
22872 - for (let name in prev) if (name != "class" && name != "style" && name != "nodeName" && !(name in cur)) dom.removeAttribute(name);
22873 - for (let name in cur) if (name != "class" && name != "style" && name != "nodeName" && cur[name] != prev[name]) dom.setAttribute(name, cur[name]);
22874 - if (prev.class != cur.class) {
22875 - let prevList = prev.class ? prev.class.split(" ").filter(Boolean) : [];
22876 - let curList = cur.class ? cur.class.split(" ").filter(Boolean) : [];
22877 - for (let i = 0; i < prevList.length; i++) if (curList.indexOf(prevList[i]) == -1) dom.classList.remove(prevList[i]);
22878 - for (let i = 0; i < curList.length; i++) if (prevList.indexOf(curList[i]) == -1) dom.classList.add(curList[i]);
22879 - if (dom.classList.length == 0) dom.removeAttribute("class");
22880 - }
22881 - if (prev.style != cur.style) {
22882 - if (prev.style) {
22883 - let prop = /\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;
22884 - let m;
22885 - while (m = prop.exec(prev.style)) dom.style.removeProperty(m[1]);
22886 - }
22887 - if (cur.style) dom.style.cssText += cur.style;
22888 - }
22889 - }
22890 - function applyOuterDeco(dom, deco, node) {
22891 - return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, dom.nodeType != 1));
22892 - }
22893 - function sameOuterDeco(a, b) {
22894 - if (a.length != b.length) return false;
22895 - for (let i = 0; i < a.length; i++) if (!a[i].type.eq(b[i].type)) return false;
22896 - return true;
22897 - }
22898 - function rm(dom) {
22899 - let next = dom.nextSibling;
22900 - dom.parentNode.removeChild(dom);
22901 - return next;
22902 - }
22903 - var ViewTreeUpdater = class {
22904 - constructor(top, lock, view) {
22905 - this.lock = lock;
22906 - this.view = view;
22907 - this.index = 0;
22908 - this.stack = [];
22909 - this.changed = false;
22910 - this.top = top;
22911 - this.preMatch = preMatch(top.node.content, top);
22912 - }
22913 - destroyBetween(start, end) {
22914 - if (start == end) return;
22915 - for (let i = start; i < end; i++) this.top.children[i].destroy();
22916 - this.top.children.splice(start, end - start);
22917 - this.changed = true;
22918 - }
22919 - destroyRest() {
22920 - this.destroyBetween(this.index, this.top.children.length);
22921 - }
22922 - syncToMarks(marks, inline, view, parentIndex) {
22923 - let keep = 0;
22924 - let depth = this.stack.length >> 1;
22925 - let maxKeep = Math.min(depth, marks.length);
22926 - while (keep < maxKeep && (keep == depth - 1 ? this.top : this.stack[keep + 1 << 1]).matchesMark(marks[keep]) && marks[keep].type.spec.spanning !== false) keep++;
22927 - while (keep < depth) {
22928 - this.destroyRest();
22929 - this.top.dirty = NOT_DIRTY;
22930 - this.index = this.stack.pop();
22931 - this.top = this.stack.pop();
22932 - depth--;
22933 - }
22934 - while (depth < marks.length) {
22935 - this.stack.push(this.top, this.index + 1);
22936 - let found = -1;
22937 - let scanTo = this.top.children.length;
22938 - if (parentIndex < this.preMatch.index) scanTo = Math.min(this.index + 3, scanTo);
22939 - for (let i = this.index; i < scanTo; i++) {
22940 - let next = this.top.children[i];
22941 - if (next.matchesMark(marks[depth]) && !this.isLocked(next.dom)) {
22942 - found = i;
22943 - break;
22944 - }
22945 - }
22946 - if (found > -1) {
22947 - if (found > this.index) {
22948 - this.changed = true;
22949 - this.destroyBetween(this.index, found);
22950 - }
22951 - this.top = this.top.children[this.index];
22952 - } else {
22953 - let markDesc = MarkViewDesc.create(this.top, marks[depth], inline, view);
22954 - this.top.children.splice(this.index, 0, markDesc);
22955 - this.top = markDesc;
22956 - this.changed = true;
22957 - }
22958 - this.index = 0;
22959 - depth++;
22960 - }
22961 - }
22962 - findNodeMatch(node, outerDeco, innerDeco, index) {
22963 - let found = -1;
22964 - let targetDesc;
22965 - if (index >= this.preMatch.index && (targetDesc = this.preMatch.matches[index - this.preMatch.index]).parent == this.top && targetDesc.matchesNode(node, outerDeco, innerDeco)) found = this.top.children.indexOf(targetDesc, this.index);
22966 - else for (let i = this.index, e = Math.min(this.top.children.length, i + 5); i < e; i++) {
22967 - let child = this.top.children[i];
22968 - if (child.matchesNode(node, outerDeco, innerDeco) && !this.preMatch.matched.has(child)) {
22969 - found = i;
22970 - break;
22971 - }
22972 - }
22973 - if (found < 0) return false;
22974 - this.destroyBetween(this.index, found);
22975 - this.index++;
22976 - return true;
22977 - }
22978 - updateNodeAt(node, outerDeco, innerDeco, index, view) {
22979 - let child = this.top.children[index];
22980 - if (child.dirty == NODE_DIRTY && child.dom == child.contentDOM) child.dirty = CONTENT_DIRTY;
22981 - if (!child.update(node, outerDeco, innerDeco, view)) return false;
22982 - this.destroyBetween(this.index, index);
22983 - this.index++;
22984 - return true;
22985 - }
22986 - findIndexWithChild(domNode) {
22987 - for (;;) {
22988 - let parent = domNode.parentNode;
22989 - if (!parent) return -1;
22990 - if (parent == this.top.contentDOM) {
22991 - let desc = domNode.pmViewDesc;
22992 - if (desc) {
22993 - for (let i = this.index; i < this.top.children.length; i++) if (this.top.children[i] == desc) return i;
22994 - }
22995 - return -1;
22996 - }
22997 - domNode = parent;
22998 - }
22999 - }
23000 - updateNextNode(node, outerDeco, innerDeco, view, index, pos) {
23001 - for (let i = this.index; i < this.top.children.length; i++) {
23002 - let next = this.top.children[i];
23003 - if (next instanceof NodeViewDesc) {
23004 - let preMatch = this.preMatch.matched.get(next);
23005 - if (preMatch != null && preMatch != index) return false;
23006 - let nextDOM = next.dom;
23007 - let updated;
23008 - let locked = this.isLocked(nextDOM) && !(node.isText && next.node && next.node.isText && next.nodeDOM.nodeValue == node.text && next.dirty != NODE_DIRTY && sameOuterDeco(outerDeco, next.outerDeco));
23009 - if (!locked && next.update(node, outerDeco, innerDeco, view)) {
23010 - this.destroyBetween(this.index, i);
23011 - if (next.dom != nextDOM) this.changed = true;
23012 - this.index++;
23013 - return true;
23014 - } else if (!locked && (updated = this.recreateWrapper(next, node, outerDeco, innerDeco, view, pos))) {
23015 - this.destroyBetween(this.index, i);
23016 - this.top.children[this.index] = updated;
23017 - if (updated.contentDOM) {
23018 - updated.dirty = CONTENT_DIRTY;
23019 - updated.updateChildren(view, pos + 1);
23020 - updated.dirty = NOT_DIRTY;
23021 - }
23022 - this.changed = true;
23023 - this.index++;
23024 - return true;
23025 - }
23026 - break;
23027 - }
23028 - }
23029 - return false;
23030 - }
23031 - recreateWrapper(next, node, outerDeco, innerDeco, view, pos) {
23032 - if (next.dirty || node.isAtom || !next.children.length || !next.node.content.eq(node.content) || !sameOuterDeco(outerDeco, next.outerDeco) || !innerDeco.eq(next.innerDeco)) return null;
23033 - let wrapper = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos);
23034 - if (wrapper.contentDOM) {
23035 - wrapper.children = next.children;
23036 - next.children = [];
23037 - for (let ch of wrapper.children) ch.parent = wrapper;
23038 - }
23039 - next.destroy();
23040 - return wrapper;
23041 - }
23042 - addNode(node, outerDeco, innerDeco, view, pos) {
23043 - let desc = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos);
23044 - if (desc.contentDOM) desc.updateChildren(view, pos + 1);
23045 - this.top.children.splice(this.index++, 0, desc);
23046 - this.changed = true;
23047 - }
23048 - placeWidget(widget, view, pos) {
23049 - let next = this.index < this.top.children.length ? this.top.children[this.index] : null;
23050 - if (next && next.matchesWidget(widget) && (widget == next.widget || !next.widget.type.toDOM.parentNode)) this.index++;
23051 - else {
23052 - let desc = new WidgetViewDesc(this.top, widget, view, pos);
23053 - this.top.children.splice(this.index++, 0, desc);
23054 - this.changed = true;
23055 - }
23056 - }
23057 - addTextblockHacks() {
23058 - let lastChild = this.top.children[this.index - 1];
23059 - let parent = this.top;
23060 - while (lastChild instanceof MarkViewDesc) {
23061 - parent = lastChild;
23062 - lastChild = parent.children[parent.children.length - 1];
23063 - }
23064 - if (!lastChild || !(lastChild instanceof TextViewDesc) || /\n$/.test(lastChild.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(lastChild.node.text)) {
23065 - if ((safari || chrome) && lastChild && lastChild.dom.contentEditable == "false") this.addHackNode("IMG", parent);
23066 - this.addHackNode("BR", this.top);
23067 - }
23068 - }
23069 - addHackNode(nodeName, parent) {
23070 - if (parent == this.top && this.index < parent.children.length && parent.children[this.index].matchesHack(nodeName)) this.index++;
23071 - else {
23072 - let dom = document.createElement(nodeName);
23073 - if (nodeName == "IMG") {
23074 - dom.className = "ProseMirror-separator";
23075 - dom.alt = "";
23076 - }
23077 - if (nodeName == "BR") dom.className = "ProseMirror-trailingBreak";
23078 - let hack = new TrailingHackViewDesc(this.top, [], dom, null);
23079 - if (parent != this.top) parent.children.push(hack);
23080 - else parent.children.splice(this.index++, 0, hack);
23081 - this.changed = true;
23082 - }
23083 - }
23084 - isLocked(node) {
23085 - return this.lock && (node == this.lock || node.nodeType == 1 && node.contains(this.lock.parentNode));
23086 - }
23087 - };
23088 - function preMatch(frag, parentDesc) {
23089 - let curDesc = parentDesc;
23090 - let descI = curDesc.children.length;
23091 - let fI = frag.childCount;
23092 - let matched = /* @__PURE__ */ new Map();
23093 - let matches = [];
23094 - outer: while (fI > 0) {
23095 - let desc;
23096 - for (;;) if (descI) {
23097 - let next = curDesc.children[descI - 1];
23098 - if (next instanceof MarkViewDesc) {
23099 - curDesc = next;
23100 - descI = next.children.length;
23101 - } else {
23102 - desc = next;
23103 - descI--;
23104 - break;
23105 - }
23106 - } else if (curDesc == parentDesc) break outer;
23107 - else {
23108 - descI = curDesc.parent.children.indexOf(curDesc);
23109 - curDesc = curDesc.parent;
23110 - }
23111 - let node = desc.node;
23112 - if (!node) continue;
23113 - if (node != frag.child(fI - 1)) break;
23114 - --fI;
23115 - matched.set(desc, fI);
23116 - matches.push(desc);
23117 - }
23118 - return {
23119 - index: fI,
23120 - matched,
23121 - matches: matches.reverse()
23122 - };
23123 - }
23124 - function compareSide(a, b) {
23125 - return a.type.side - b.type.side;
23126 - }
23127 - function iterDeco(parent, deco, onWidget, onNode) {
23128 - let locals = deco.locals(parent);
23129 - let offset = 0;
23130 - if (locals.length == 0) {
23131 - for (let i = 0; i < parent.childCount; i++) {
23132 - let child = parent.child(i);
23133 - onNode(child, locals, deco.forChild(offset, child), i);
23134 - offset += child.nodeSize;
23135 - }
23136 - return;
23137 - }
23138 - let decoIndex = 0;
23139 - let active = [];
23140 - let restNode = null;
23141 - for (let parentIndex = 0;;) {
23142 - let widget;
23143 - let widgets;
23144 - while (decoIndex < locals.length && locals[decoIndex].to == offset) {
23145 - let next = locals[decoIndex++];
23146 - if (next.widget) if (!widget) widget = next;
23147 - else (widgets || (widgets = [widget])).push(next);
23148 - }
23149 - if (widget) if (widgets) {
23150 - widgets.sort(compareSide);
23151 - for (let i = 0; i < widgets.length; i++) onWidget(widgets[i], parentIndex, !!restNode);
23152 - } else onWidget(widget, parentIndex, !!restNode);
23153 - let child;
23154 - let index;
23155 - if (restNode) {
23156 - index = -1;
23157 - child = restNode;
23158 - restNode = null;
23159 - } else if (parentIndex < parent.childCount) {
23160 - index = parentIndex;
23161 - child = parent.child(parentIndex++);
23162 - } else break;
23163 - for (let i = 0; i < active.length; i++) if (active[i].to <= offset) active.splice(i--, 1);
23164 - while (decoIndex < locals.length && locals[decoIndex].from <= offset && locals[decoIndex].to > offset) active.push(locals[decoIndex++]);
23165 - let end = offset + child.nodeSize;
23166 - if (child.isText) {
23167 - let cutAt = end;
23168 - if (decoIndex < locals.length && locals[decoIndex].from < cutAt) cutAt = locals[decoIndex].from;
23169 - for (let i = 0; i < active.length; i++) if (active[i].to < cutAt) cutAt = active[i].to;
23170 - if (cutAt < end) {
23171 - restNode = child.cut(cutAt - offset);
23172 - child = child.cut(0, cutAt - offset);
23173 - end = cutAt;
23174 - index = -1;
23175 - }
23176 - } else while (decoIndex < locals.length && locals[decoIndex].to < end) decoIndex++;
23177 - let outerDeco = child.isInline && !child.isLeaf ? active.filter((d) => !d.inline) : active.slice();
23178 - onNode(child, outerDeco, deco.forChild(offset, child), index);
23179 - offset = end;
23180 - }
23181 - }
23182 - function iosHacks(dom) {
23183 - if (dom.nodeName == "UL" || dom.nodeName == "OL") {
23184 - let oldCSS = dom.style.cssText;
23185 - dom.style.cssText = oldCSS + "; list-style: square !important";
23186 - window.getComputedStyle(dom).listStyle;
23187 - dom.style.cssText = oldCSS;
23188 - }
23189 - }
23190 - function findTextInFragment(frag, text, from, to) {
23191 - for (let i = 0, pos = 0; i < frag.childCount && pos <= to;) {
23192 - let child = frag.child(i++);
23193 - let childStart = pos;
23194 - pos += child.nodeSize;
23195 - if (!child.isText) continue;
23196 - let str = child.text;
23197 - while (i < frag.childCount) {
23198 - let next = frag.child(i++);
23199 - pos += next.nodeSize;
23200 - if (!next.isText) break;
23201 - str += next.text;
23202 - }
23203 - if (pos >= from) {
23204 - if (pos >= to && str.slice(to - text.length - childStart, to - childStart) == text) return to - text.length;
23205 - let found = childStart < to ? str.lastIndexOf(text, to - childStart - 1) : -1;
23206 - if (found >= 0 && found + text.length + childStart >= from) return childStart + found;
23207 - if (from == to && str.length >= to + text.length - childStart && str.slice(to - childStart, to - childStart + text.length) == text) return to;
23208 - }
23209 - }
23210 - return -1;
23211 - }
23212 - function replaceNodes(nodes, from, to, view, replacement) {
23213 - let result = [];
23214 - for (let i = 0, off = 0; i < nodes.length; i++) {
23215 - let child = nodes[i];
23216 - let start = off;
23217 - let end = off += child.size;
23218 - if (start >= to || end <= from) result.push(child);
23219 - else {
23220 - if (start < from) result.push(child.slice(0, from - start, view));
23221 - if (replacement) {
23222 - result.push(replacement);
23223 - replacement = void 0;
23224 - }
23225 - if (end > to) result.push(child.slice(to - start, child.size, view));
23226 - }
23227 - }
23228 - return result;
23229 - }
23230 - function selectionFromDOM(view, origin = null) {
23231 - let domSel = view.domSelectionRange();
23232 - let doc = view.state.doc;
23233 - if (!domSel.focusNode) return null;
23234 - let nearestDesc = view.docView.nearestDesc(domSel.focusNode);
23235 - let inWidget = nearestDesc && nearestDesc.size == 0;
23236 - let head = view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset, 1);
23237 - if (head < 0) return null;
23238 - let $head = doc.resolve(head);
23239 - let anchor;
23240 - let selection;
23241 - if (selectionCollapsed(domSel)) {
23242 - anchor = head;
23243 - while (nearestDesc && !nearestDesc.node) nearestDesc = nearestDesc.parent;
23244 - let nearestDescNode = nearestDesc.node;
23245 - if (nearestDesc && nearestDescNode.isAtom && NodeSelection.isSelectable(nearestDescNode) && nearestDesc.parent && !(nearestDescNode.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) {
23246 - let pos = nearestDesc.posBefore;
23247 - selection = new NodeSelection(head == pos ? $head : doc.resolve(pos));
23248 - }
23249 - } else {
23250 - if (domSel instanceof view.dom.ownerDocument.defaultView.Selection && domSel.rangeCount > 1) {
23251 - let min = head;
23252 - let max = head;
23253 - for (let i = 0; i < domSel.rangeCount; i++) {
23254 - let range = domSel.getRangeAt(i);
23255 - min = Math.min(min, view.docView.posFromDOM(range.startContainer, range.startOffset, 1));
23256 - max = Math.max(max, view.docView.posFromDOM(range.endContainer, range.endOffset, -1));
23257 - }
23258 - if (min < 0) return null;
23259 - [anchor, head] = max == view.state.selection.anchor ? [max, min] : [min, max];
23260 - $head = doc.resolve(head);
23261 - } else anchor = view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset, 1);
23262 - if (anchor < 0) return null;
23263 - }
23264 - let $anchor = doc.resolve(anchor);
23265 - if (!selection) {
23266 - let bias = origin == "pointer" || view.state.selection.head < $head.pos && !inWidget ? 1 : -1;
23267 - selection = selectionBetween(view, $anchor, $head, bias);
23268 - }
23269 - return selection;
23270 - }
23271 - function editorOwnsSelection(view) {
23272 - return view.editable ? view.hasFocus() : hasSelection(view) && document.activeElement && document.activeElement.contains(view.dom);
23273 - }
23274 - function selectionToDOM(view, force = false) {
23275 - let sel = view.state.selection;
23276 - syncNodeSelection(view, sel);
23277 - if (!editorOwnsSelection(view)) return;
23278 - if (!force && view.input.mouseDown && view.input.mouseDown.allowDefault && chrome) {
23279 - let domSel = view.domSelectionRange();
23280 - let curSel = view.domObserver.currentSelection;
23281 - if (domSel.anchorNode && curSel.anchorNode && isEquivalentPosition(domSel.anchorNode, domSel.anchorOffset, curSel.anchorNode, curSel.anchorOffset)) {
23282 - view.input.mouseDown.delayedSelectionSync = true;
23283 - view.domObserver.setCurSelection();
23284 - return;
23285 - }
23286 - }
23287 - view.domObserver.disconnectSelection();
23288 - if (view.cursorWrapper) selectCursorWrapper(view);
23289 - else {
23290 - let { anchor, head } = sel, resetEditableFrom, resetEditableTo;
23291 - if (brokenSelectBetweenUneditable && !(sel instanceof TextSelection)) {
23292 - if (!sel.$from.parent.inlineContent) resetEditableFrom = temporarilyEditableNear(view, sel.from);
23293 - if (!sel.empty && !sel.$from.parent.inlineContent) resetEditableTo = temporarilyEditableNear(view, sel.to);
23294 - }
23295 - view.docView.setSelection(anchor, head, view, force);
23296 - if (brokenSelectBetweenUneditable) {
23297 - if (resetEditableFrom) resetEditable(resetEditableFrom);
23298 - if (resetEditableTo) resetEditable(resetEditableTo);
23299 - }
23300 - if (sel.visible) view.dom.classList.remove("ProseMirror-hideselection");
23301 - else {
23302 - view.dom.classList.add("ProseMirror-hideselection");
23303 - if ("onselectionchange" in document) removeClassOnSelectionChange(view);
23304 - }
23305 - }
23306 - view.domObserver.setCurSelection();
23307 - view.domObserver.connectSelection();
23308 - }
23309 - var brokenSelectBetweenUneditable = safari || chrome && chrome_version < 63;
23310 - function temporarilyEditableNear(view, pos) {
23311 - let { node, offset } = view.docView.domFromPos(pos, 0);
23312 - let after = offset < node.childNodes.length ? node.childNodes[offset] : null;
23313 - let before = offset ? node.childNodes[offset - 1] : null;
23314 - if (safari && after && after.contentEditable == "false") return setEditable(after);
23315 - if ((!after || after.contentEditable == "false") && (!before || before.contentEditable == "false")) {
23316 - if (after) return setEditable(after);
23317 - else if (before) return setEditable(before);
23318 - }
23319 - }
23320 - function setEditable(element) {
23321 - element.contentEditable = "true";
23322 - if (safari && element.draggable) {
23323 - element.draggable = false;
23324 - element.wasDraggable = true;
23325 - }
23326 - return element;
23327 - }
23328 - function resetEditable(element) {
23329 - element.contentEditable = "false";
23330 - if (element.wasDraggable) {
23331 - element.draggable = true;
23332 - element.wasDraggable = null;
23333 - }
23334 - }
23335 - function removeClassOnSelectionChange(view) {
23336 - let doc = view.dom.ownerDocument;
23337 - doc.removeEventListener("selectionchange", view.input.hideSelectionGuard);
23338 - let domSel = view.domSelectionRange();
23339 - let node = domSel.anchorNode;
23340 - let offset = domSel.anchorOffset;
23341 - doc.addEventListener("selectionchange", view.input.hideSelectionGuard = () => {
23342 - if (domSel.anchorNode != node || domSel.anchorOffset != offset) {
23343 - doc.removeEventListener("selectionchange", view.input.hideSelectionGuard);
23344 - setTimeout(() => {
23345 - if (!editorOwnsSelection(view) || view.state.selection.visible) view.dom.classList.remove("ProseMirror-hideselection");
23346 - }, 20);
23347 - }
23348 - });
23349 - }
23350 - function selectCursorWrapper(view) {
23351 - let domSel = view.domSelection();
23352 - if (!domSel) return;
23353 - let node = view.cursorWrapper.dom;
23354 - let img = node.nodeName == "IMG";
23355 - if (img) domSel.collapse(node.parentNode, domIndex(node) + 1);
23356 - else domSel.collapse(node, 0);
23357 - if (!img && !view.state.selection.visible && ie$1 && ie_version <= 11) {
23358 - node.disabled = true;
23359 - node.disabled = false;
23360 - }
23361 - }
23362 - function syncNodeSelection(view, sel) {
23363 - if (sel instanceof NodeSelection) {
23364 - let desc = view.docView.descAt(sel.from);
23365 - if (desc != view.lastSelectedViewDesc) {
23366 - clearNodeSelection(view);
23367 - if (desc) desc.selectNode();
23368 - view.lastSelectedViewDesc = desc;
23369 - }
23370 - } else clearNodeSelection(view);
23371 - }
23372 - function clearNodeSelection(view) {
23373 - if (view.lastSelectedViewDesc) {
23374 - if (view.lastSelectedViewDesc.parent) view.lastSelectedViewDesc.deselectNode();
23375 - view.lastSelectedViewDesc = void 0;
23376 - }
23377 - }
23378 - function selectionBetween(view, $anchor, $head, bias) {
23379 - return view.someProp("createSelectionBetween", (f) => f(view, $anchor, $head)) || TextSelection.between($anchor, $head, bias);
23380 - }
23381 - function hasFocusAndSelection(view) {
23382 - if (view.editable && !view.hasFocus()) return false;
23383 - return hasSelection(view);
23384 - }
23385 - function hasSelection(view) {
23386 - let sel = view.domSelectionRange();
23387 - if (!sel.anchorNode) return false;
23388 - try {
23389 - return view.dom.contains(sel.anchorNode.nodeType == 3 ? sel.anchorNode.parentNode : sel.anchorNode) && (view.editable || view.dom.contains(sel.focusNode.nodeType == 3 ? sel.focusNode.parentNode : sel.focusNode));
23390 - } catch (_) {
23391 - return false;
23392 - }
23393 - }
23394 - function anchorInRightPlace(view) {
23395 - let anchorDOM = view.docView.domFromPos(view.state.selection.anchor, 0);
23396 - let domSel = view.domSelectionRange();
23397 - return isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset);
23398 - }
23399 - function moveSelectionBlock(state, dir) {
23400 - let { $anchor, $head } = state.selection;
23401 - let $side = dir > 0 ? $anchor.max($head) : $anchor.min($head);
23402 - let $start = !$side.parent.inlineContent ? $side : $side.depth ? state.doc.resolve(dir > 0 ? $side.after() : $side.before()) : null;
23403 - return $start && Selection.findFrom($start, dir);
23404 - }
23405 - function apply(view, sel) {
23406 - view.dispatch(view.state.tr.setSelection(sel).scrollIntoView());
23407 - return true;
23408 - }
23409 - function selectHorizontally(view, dir, mods) {
23410 - let sel = view.state.selection;
23411 - if (sel instanceof TextSelection) {
23412 - if (mods.indexOf("s") > -1) {
23413 - let { $head } = sel, node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter;
23414 - if (!node || node.isText || !node.isLeaf) return false;
23415 - let $newHead = view.state.doc.resolve($head.pos + node.nodeSize * (dir < 0 ? -1 : 1));
23416 - return apply(view, new TextSelection(sel.$anchor, $newHead));
23417 - } else if (!sel.empty) return false;
23418 - else if (view.endOfTextblock(dir > 0 ? "forward" : "backward")) {
23419 - let next = moveSelectionBlock(view.state, dir);
23420 - if (next && next instanceof NodeSelection) return apply(view, next);
23421 - return false;
23422 - } else if (!(mac$2 && mods.indexOf("m") > -1)) {
23423 - let $head = sel.$head;
23424 - let node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter;
23425 - let desc;
23426 - if (!node || node.isText) return false;
23427 - let nodePos = dir < 0 ? $head.pos - node.nodeSize : $head.pos;
23428 - if (!(node.isAtom || (desc = view.docView.descAt(nodePos)) && !desc.contentDOM)) return false;
23429 - if (NodeSelection.isSelectable(node)) return apply(view, new NodeSelection(dir < 0 ? view.state.doc.resolve($head.pos - node.nodeSize) : $head));
23430 - else if (webkit) return apply(view, new TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node.nodeSize)));
23431 - else return false;
23432 - }
23433 - } else if (sel instanceof NodeSelection && sel.node.isInline) return apply(view, new TextSelection(dir > 0 ? sel.$to : sel.$from));
23434 - else {
23435 - let next = moveSelectionBlock(view.state, dir);
23436 - if (next) return apply(view, next);
23437 - return false;
23438 - }
23439 - }
23440 - function nodeLen(node) {
23441 - return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;
23442 - }
23443 - function isIgnorable(dom, dir) {
23444 - let desc = dom.pmViewDesc;
23445 - return desc && desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != "BR");
23446 - }
23447 - function skipIgnoredNodes(view, dir) {
23448 - return dir < 0 ? skipIgnoredNodesBefore(view) : skipIgnoredNodesAfter(view);
23449 - }
23450 - function skipIgnoredNodesBefore(view) {
23451 - let sel = view.domSelectionRange();
23452 - let node = sel.focusNode;
23453 - let offset = sel.focusOffset;
23454 - if (!node) return;
23455 - let moveNode;
23456 - let moveOffset;
23457 - let force = false;
23458 - if (gecko && node.nodeType == 1 && offset < nodeLen(node) && isIgnorable(node.childNodes[offset], -1)) force = true;
23459 - for (;;) if (offset > 0) if (node.nodeType != 1) break;
23460 - else {
23461 - let before = node.childNodes[offset - 1];
23462 - if (isIgnorable(before, -1)) {
23463 - moveNode = node;
23464 - moveOffset = --offset;
23465 - } else if (before.nodeType == 3) {
23466 - node = before;
23467 - offset = node.nodeValue.length;
23468 - } else break;
23469 - }
23470 - else if (isBlockNode(node)) break;
23471 - else {
23472 - let prev = node.previousSibling;
23473 - while (prev && isIgnorable(prev, -1)) {
23474 - moveNode = node.parentNode;
23475 - moveOffset = domIndex(prev);
23476 - prev = prev.previousSibling;
23477 - }
23478 - if (!prev) {
23479 - node = node.parentNode;
23480 - if (node == view.dom) break;
23481 - offset = 0;
23482 - } else {
23483 - node = prev;
23484 - offset = nodeLen(node);
23485 - }
23486 - }
23487 - if (force) setSelFocus(view, node, offset);
23488 - else if (moveNode) setSelFocus(view, moveNode, moveOffset);
23489 - }
23490 - function skipIgnoredNodesAfter(view) {
23491 - let sel = view.domSelectionRange();
23492 - let node = sel.focusNode;
23493 - let offset = sel.focusOffset;
23494 - if (!node) return;
23495 - let len = nodeLen(node);
23496 - let moveNode;
23497 - let moveOffset;
23498 - for (;;) if (offset < len) {
23499 - if (node.nodeType != 1) break;
23500 - let after = node.childNodes[offset];
23501 - if (isIgnorable(after, 1)) {
23502 - moveNode = node;
23503 - moveOffset = ++offset;
23504 - } else break;
23505 - } else if (isBlockNode(node)) break;
23506 - else {
23507 - let next = node.nextSibling;
23508 - while (next && isIgnorable(next, 1)) {
23509 - moveNode = next.parentNode;
23510 - moveOffset = domIndex(next) + 1;
23511 - next = next.nextSibling;
23512 - }
23513 - if (!next) {
23514 - node = node.parentNode;
23515 - if (node == view.dom) break;
23516 - offset = len = 0;
23517 - } else {
23518 - node = next;
23519 - offset = 0;
23520 - len = nodeLen(node);
23521 - }
23522 - }
23523 - if (moveNode) setSelFocus(view, moveNode, moveOffset);
23524 - }
23525 - function isBlockNode(dom) {
23526 - let desc = dom.pmViewDesc;
23527 - return desc && desc.node && desc.node.isBlock;
23528 - }
23529 - function textNodeAfter(node, offset) {
23530 - while (node && offset == node.childNodes.length && !hasBlockDesc(node)) {
23531 - offset = domIndex(node) + 1;
23532 - node = node.parentNode;
23533 - }
23534 - while (node && offset < node.childNodes.length) {
23535 - let next = node.childNodes[offset];
23536 - if (next.nodeType == 3) return next;
23537 - if (next.nodeType == 1 && next.contentEditable == "false") break;
23538 - node = next;
23539 - offset = 0;
23540 - }
23541 - }
23542 - function textNodeBefore(node, offset) {
23543 - while (node && !offset && !hasBlockDesc(node)) {
23544 - offset = domIndex(node);
23545 - node = node.parentNode;
23546 - }
23547 - while (node && offset) {
23548 - let next = node.childNodes[offset - 1];
23549 - if (next.nodeType == 3) return next;
23550 - if (next.nodeType == 1 && next.contentEditable == "false") break;
23551 - node = next;
23552 - offset = node.childNodes.length;
23553 - }
23554 - }
23555 - function setSelFocus(view, node, offset) {
23556 - if (node.nodeType != 3) {
23557 - let before;
23558 - let after;
23559 - if (after = textNodeAfter(node, offset)) {
23560 - node = after;
23561 - offset = 0;
23562 - } else if (before = textNodeBefore(node, offset)) {
23563 - node = before;
23564 - offset = before.nodeValue.length;
23565 - }
23566 - }
23567 - let sel = view.domSelection();
23568 - if (!sel) return;
23569 - if (selectionCollapsed(sel)) {
23570 - let range = document.createRange();
23571 - range.setEnd(node, offset);
23572 - range.setStart(node, offset);
23573 - sel.removeAllRanges();
23574 - sel.addRange(range);
23575 - } else if (sel.extend) sel.extend(node, offset);
23576 - view.domObserver.setCurSelection();
23577 - let { state } = view;
23578 - setTimeout(() => {
23579 - if (view.state == state) selectionToDOM(view);
23580 - }, 50);
23581 - }
23582 - function findDirection(view, pos) {
23583 - let $pos = view.state.doc.resolve(pos);
23584 - if (!(chrome || windows$1) && $pos.parent.inlineContent) {
23585 - let coords = view.coordsAtPos(pos);
23586 - if (pos > $pos.start()) {
23587 - let before = view.coordsAtPos(pos - 1);
23588 - let mid = (before.top + before.bottom) / 2;
23589 - if (mid > coords.top && mid < coords.bottom && Math.abs(before.left - coords.left) > 1) return before.left < coords.left ? "ltr" : "rtl";
23590 - }
23591 - if (pos < $pos.end()) {
23592 - let after = view.coordsAtPos(pos + 1);
23593 - let mid = (after.top + after.bottom) / 2;
23594 - if (mid > coords.top && mid < coords.bottom && Math.abs(after.left - coords.left) > 1) return after.left > coords.left ? "ltr" : "rtl";
23595 - }
23596 - }
23597 - return getComputedStyle(view.dom).direction == "rtl" ? "rtl" : "ltr";
23598 - }
23599 - function selectVertically(view, dir, mods) {
23600 - let sel = view.state.selection;
23601 - if (sel instanceof TextSelection && !sel.empty || mods.indexOf("s") > -1) return false;
23602 - if (mac$2 && mods.indexOf("m") > -1) return false;
23603 - let { $from, $to } = sel;
23604 - if (!$from.parent.inlineContent || view.endOfTextblock(dir < 0 ? "up" : "down")) {
23605 - let next = moveSelectionBlock(view.state, dir);
23606 - if (next && next instanceof NodeSelection) return apply(view, next);
23607 - }
23608 - if (!$from.parent.inlineContent) {
23609 - let side = dir < 0 ? $from : $to;
23610 - let beyond = sel instanceof AllSelection ? Selection.near(side, dir) : Selection.findFrom(side, dir);
23611 - return beyond ? apply(view, beyond) : false;
23612 - }
23613 - return false;
23614 - }
23615 - function stopNativeHorizontalDelete(view, dir) {
23616 - if (!(view.state.selection instanceof TextSelection)) return true;
23617 - let { $head, $anchor, empty } = view.state.selection;
23618 - if (!$head.sameParent($anchor)) return true;
23619 - if (!empty) return false;
23620 - if (view.endOfTextblock(dir > 0 ? "forward" : "backward")) return true;
23621 - let nextNode = !$head.textOffset && (dir < 0 ? $head.nodeBefore : $head.nodeAfter);
23622 - if (nextNode && !nextNode.isText) {
23623 - let tr = view.state.tr;
23624 - if (dir < 0) tr.delete($head.pos - nextNode.nodeSize, $head.pos);
23625 - else tr.delete($head.pos, $head.pos + nextNode.nodeSize);
23626 - view.dispatch(tr);
23627 - return true;
23628 - }
23629 - return false;
23630 - }
23631 - function switchEditable(view, node, state) {
23632 - view.domObserver.stop();
23633 - node.contentEditable = state;
23634 - view.domObserver.start();
23635 - }
23636 - function safariDownArrowBug(view) {
23637 - if (!safari || view.state.selection.$head.parentOffset > 0) return false;
23638 - let { focusNode, focusOffset } = view.domSelectionRange();
23639 - if (focusNode && focusNode.nodeType == 1 && focusOffset == 0 && focusNode.firstChild && focusNode.firstChild.contentEditable == "false") {
23640 - let child = focusNode.firstChild;
23641 - switchEditable(view, child, "true");
23642 - setTimeout(() => switchEditable(view, child, "false"), 20);
23643 - }
23644 - return false;
23645 - }
23646 - function getMods(event) {
23647 - let result = "";
23648 - if (event.ctrlKey) result += "c";
23649 - if (event.metaKey) result += "m";
23650 - if (event.altKey) result += "a";
23651 - if (event.shiftKey) result += "s";
23652 - return result;
23653 - }
23654 - function captureKeyDown(view, event) {
23655 - let code = event.keyCode;
23656 - let mods = getMods(event);
23657 - if (code == 8 || mac$2 && code == 72 && mods == "c") return stopNativeHorizontalDelete(view, -1) || skipIgnoredNodes(view, -1);
23658 - else if (code == 46 && !event.shiftKey || mac$2 && code == 68 && mods == "c") return stopNativeHorizontalDelete(view, 1) || skipIgnoredNodes(view, 1);
23659 - else if (code == 13 || code == 27) return true;
23660 - else if (code == 37 || mac$2 && code == 66 && mods == "c") {
23661 - let dir = code == 37 ? findDirection(view, view.state.selection.from) == "ltr" ? -1 : 1 : -1;
23662 - return selectHorizontally(view, dir, mods) || skipIgnoredNodes(view, dir);
23663 - } else if (code == 39 || mac$2 && code == 70 && mods == "c") {
23664 - let dir = code == 39 ? findDirection(view, view.state.selection.from) == "ltr" ? 1 : -1 : 1;
23665 - return selectHorizontally(view, dir, mods) || skipIgnoredNodes(view, dir);
23666 - } else if (code == 38 || mac$2 && code == 80 && mods == "c") return selectVertically(view, -1, mods) || skipIgnoredNodes(view, -1);
23667 - else if (code == 40 || mac$2 && code == 78 && mods == "c") return safariDownArrowBug(view) || selectVertically(view, 1, mods) || skipIgnoredNodes(view, 1);
23668 - else if (mods == (mac$2 ? "m" : "c") && (code == 66 || code == 73 || code == 89 || code == 90)) return true;
23669 - return false;
23670 - }
23671 - function serializeForClipboard(view, slice) {
23672 - view.someProp("transformCopied", (f) => {
23673 - slice = f(slice, view);
23674 - });
23675 - let context = [], { content, openStart, openEnd } = slice;
23676 - while (openStart > 1 && openEnd > 1 && content.childCount == 1 && content.firstChild.childCount == 1) {
23677 - openStart--;
23678 - openEnd--;
23679 - let node = content.firstChild;
23680 - context.push(node.type.name, node.attrs != node.type.defaultAttrs ? node.attrs : null);
23681 - content = node.content;
23682 - }
23683 - let serializer = view.someProp("clipboardSerializer") || DOMSerializer.fromSchema(view.state.schema);
23684 - let doc = detachedDoc();
23685 - let wrap = doc.createElement("div");
23686 - wrap.appendChild(serializer.serializeFragment(content, { document: doc }));
23687 - let firstChild = wrap.firstChild;
23688 - let needsWrap;
23689 - let wrappers = 0;
23690 - while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {
23691 - for (let i = needsWrap.length - 1; i >= 0; i--) {
23692 - let wrapper = doc.createElement(needsWrap[i]);
23693 - while (wrap.firstChild) wrapper.appendChild(wrap.firstChild);
23694 - wrap.appendChild(wrapper);
23695 - wrappers++;
23696 - }
23697 - firstChild = wrap.firstChild;
23698 - }
23699 - if (firstChild && firstChild.nodeType == 1) firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
23700 - return {
23701 - dom: wrap,
23702 - text: view.someProp("clipboardTextSerializer", (f) => f(slice, view)) || slice.content.textBetween(0, slice.content.size, "\n\n"),
23703 - slice
23704 - };
23705 - }
23706 - function parseFromClipboard(view, text, html, plainText, $context) {
23707 - let inCode = $context.parent.type.spec.code;
23708 - let dom;
23709 - let slice;
23710 - if (!html && !text) return null;
23711 - let asText = !!text && (plainText || inCode || !html);
23712 - if (asText) {
23713 - view.someProp("transformPastedText", (f) => {
23714 - text = f(text, inCode || plainText, view);
23715 - });
23716 - if (inCode) {
23717 - slice = new Slice(Fragment$1.from(view.state.schema.text(text.replace(/\r\n?/g, "\n"))), 0, 0);
23718 - view.someProp("transformPasted", (f) => {
23719 - slice = f(slice, view, true);
23720 - });
23721 - return slice;
23722 - }
23723 - let parsed = view.someProp("clipboardTextParser", (f) => f(text, $context, plainText, view));
23724 - if (parsed) slice = parsed;
23725 - else {
23726 - let marks = $context.marks();
23727 - let { schema } = view.state, serializer = DOMSerializer.fromSchema(schema);
23728 - dom = document.createElement("div");
23729 - text.split(/(?:\r\n?|\n)+/).forEach((block) => {
23730 - let p = dom.appendChild(document.createElement("p"));
23731 - if (block) p.appendChild(serializer.serializeNode(schema.text(block, marks)));
23732 - });
23733 - }
23734 - } else {
23735 - view.someProp("transformPastedHTML", (f) => {
23736 - html = f(html, view);
23737 - });
23738 - dom = readHTML(html);
23739 - if (webkit) restoreReplacedSpaces(dom);
23740 - }
23741 - let contextNode = dom && dom.querySelector("[data-pm-slice]");
23742 - let sliceData = contextNode && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(contextNode.getAttribute("data-pm-slice") || "");
23743 - if (sliceData && sliceData[3]) for (let i = +sliceData[3]; i > 0; i--) {
23744 - let child = dom.firstChild;
23745 - while (child && child.nodeType != 1) child = child.nextSibling;
23746 - if (!child) break;
23747 - dom = child;
23748 - }
23749 - if (!slice) slice = (view.someProp("clipboardParser") || view.someProp("domParser") || DOMParser$1.fromSchema(view.state.schema)).parseSlice(dom, {
23750 - preserveWhitespace: !!(asText || sliceData),
23751 - context: $context,
23752 - ruleFromNode(dom) {
23753 - if (dom.nodeName == "BR" && !dom.nextSibling && dom.parentNode && !inlineParents.test(dom.parentNode.nodeName)) return { ignore: true };
23754 - return null;
23755 - }
23756 - });
23757 - if (sliceData) slice = addContext(closeSlice(slice, +sliceData[1], +sliceData[2]), sliceData[4]);
23758 - else {
23759 - slice = Slice.maxOpen(normalizeSiblings(slice.content, $context), true);
23760 - if (slice.openStart || slice.openEnd) {
23761 - let openStart = 0;
23762 - let openEnd = 0;
23763 - for (let node = slice.content.firstChild; openStart < slice.openStart && !node.type.spec.isolating; openStart++, node = node.firstChild);
23764 - for (let node = slice.content.lastChild; openEnd < slice.openEnd && !node.type.spec.isolating; openEnd++, node = node.lastChild);
23765 - slice = closeSlice(slice, openStart, openEnd);
23766 - }
23767 - }
23768 - view.someProp("transformPasted", (f) => {
23769 - slice = f(slice, view, asText);
23770 - });
23771 - return slice;
23772 - }
23773 - var inlineParents = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;
23774 - function normalizeSiblings(fragment, $context) {
23775 - if (fragment.childCount < 2) return fragment;
23776 - for (let d = $context.depth; d >= 0; d--) {
23777 - let match = $context.node(d).contentMatchAt($context.index(d));
23778 - let lastWrap;
23779 - let result = [];
23780 - fragment.forEach((node) => {
23781 - if (!result) return;
23782 - let wrap = match.findWrapping(node.type);
23783 - let inLast;
23784 - if (!wrap) return result = null;
23785 - if (inLast = result.length && lastWrap.length && addToSibling(wrap, lastWrap, node, result[result.length - 1], 0)) result[result.length - 1] = inLast;
23786 - else {
23787 - if (result.length) result[result.length - 1] = closeRight(result[result.length - 1], lastWrap.length);
23788 - let wrapped = withWrappers(node, wrap);
23789 - result.push(wrapped);
23790 - match = match.matchType(wrapped.type);
23791 - lastWrap = wrap;
23792 - }
23793 - });
23794 - if (result) return Fragment$1.from(result);
23795 - }
23796 - return fragment;
23797 - }
23798 - function withWrappers(node, wrap, from = 0) {
23799 - for (let i = wrap.length - 1; i >= from; i--) node = wrap[i].create(null, Fragment$1.from(node));
23800 - return node;
23801 - }
23802 - function addToSibling(wrap, lastWrap, node, sibling, depth) {
23803 - if (depth < wrap.length && depth < lastWrap.length && wrap[depth] == lastWrap[depth]) {
23804 - let inner = addToSibling(wrap, lastWrap, node, sibling.lastChild, depth + 1);
23805 - if (inner) return sibling.copy(sibling.content.replaceChild(sibling.childCount - 1, inner));
23806 - if (sibling.contentMatchAt(sibling.childCount).matchType(depth == wrap.length - 1 ? node.type : wrap[depth + 1])) return sibling.copy(sibling.content.append(Fragment$1.from(withWrappers(node, wrap, depth + 1))));
23807 - }
23808 - }
23809 - function closeRight(node, depth) {
23810 - if (depth == 0) return node;
23811 - let fragment = node.content.replaceChild(node.childCount - 1, closeRight(node.lastChild, depth - 1));
23812 - let fill = node.contentMatchAt(node.childCount).fillBefore(Fragment$1.empty, true);
23813 - return node.copy(fragment.append(fill));
23814 - }
23815 - function closeRange(fragment, side, from, to, depth, openEnd) {
23816 - let node = side < 0 ? fragment.firstChild : fragment.lastChild;
23817 - let inner = node.content;
23818 - if (fragment.childCount > 1) openEnd = 0;
23819 - if (depth < to - 1) inner = closeRange(inner, side, from, to, depth + 1, openEnd);
23820 - if (depth >= from) inner = side < 0 ? node.contentMatchAt(0).fillBefore(inner, openEnd <= depth).append(inner) : inner.append(node.contentMatchAt(node.childCount).fillBefore(Fragment$1.empty, true));
23821 - return fragment.replaceChild(side < 0 ? 0 : fragment.childCount - 1, node.copy(inner));
23822 - }
23823 - function closeSlice(slice, openStart, openEnd) {
23824 - if (openStart < slice.openStart) slice = new Slice(closeRange(slice.content, -1, openStart, slice.openStart, 0, slice.openEnd), openStart, slice.openEnd);
23825 - if (openEnd < slice.openEnd) slice = new Slice(closeRange(slice.content, 1, openEnd, slice.openEnd, 0, 0), slice.openStart, openEnd);
23826 - return slice;
23827 - }
23828 - var wrapMap = {
23829 - thead: ["table"],
23830 - tbody: ["table"],
23831 - tfoot: ["table"],
23832 - caption: ["table"],
23833 - colgroup: ["table"],
23834 - col: ["table", "colgroup"],
23835 - tr: ["table", "tbody"],
23836 - td: [
23837 - "table",
23838 - "tbody",
23839 - "tr"
23840 - ],
23841 - th: [
23842 - "table",
23843 - "tbody",
23844 - "tr"
23845 - ]
23846 - };
23847 - var _detachedDoc = null;
23848 - function detachedDoc() {
23849 - return _detachedDoc || (_detachedDoc = document.implementation.createHTMLDocument("title"));
23850 - }
23851 - var _policy = null;
23852 - function maybeWrapTrusted(html) {
23853 - let trustedTypes = window.trustedTypes;
23854 - if (!trustedTypes) return html;
23855 - if (!_policy) _policy = trustedTypes.defaultPolicy || trustedTypes.createPolicy("ProseMirrorClipboard", { createHTML: (s) => s });
23856 - return _policy.createHTML(html);
23857 - }
23858 - function readHTML(html) {
23859 - let metas = /^(\s*<meta [^>]*>)*/.exec(html);
23860 - if (metas) html = html.slice(metas[0].length);
23861 - let elt = detachedDoc().createElement("div");
23862 - let firstTag = /<([a-z][^>\s]+)/i.exec(html);
23863 - let wrap;
23864 - if (wrap = firstTag && wrapMap[firstTag[1].toLowerCase()]) html = wrap.map((n) => "<" + n + ">").join("") + html + wrap.map((n) => "</" + n + ">").reverse().join("");
23865 - elt.innerHTML = maybeWrapTrusted(html);
23866 - if (wrap) for (let i = 0; i < wrap.length; i++) elt = elt.querySelector(wrap[i]) || elt;
23867 - return elt;
23868 - }
23869 - function restoreReplacedSpaces(dom) {
23870 - let nodes = dom.querySelectorAll(chrome ? "span:not([class]):not([style])" : "span.Apple-converted-space");
23871 - for (let i = 0; i < nodes.length; i++) {
23872 - let node = nodes[i];
23873 - if (node.childNodes.length == 1 && node.textContent == "\xA0" && node.parentNode) node.parentNode.replaceChild(dom.ownerDocument.createTextNode(" "), node);
23874 - }
23875 - }
23876 - function addContext(slice, context) {
23877 - if (!slice.size) return slice;
23878 - let schema = slice.content.firstChild.type.schema;
23879 - let array;
23880 - try {
23881 - array = JSON.parse(context);
23882 - } catch (e) {
23883 - return slice;
23884 - }
23885 - let { content, openStart, openEnd } = slice;
23886 - for (let i = array.length - 2; i >= 0; i -= 2) {
23887 - let type = schema.nodes[array[i]];
23888 - if (!type || type.hasRequiredAttrs()) break;
23889 - content = Fragment$1.from(type.create(array[i + 1], content));
23890 - openStart++;
23891 - openEnd++;
23892 - }
23893 - return new Slice(content, openStart, openEnd);
23894 - }
23895 - var handlers = {};
23896 - var editHandlers = {};
23897 - var passiveHandlers = {
23898 - touchstart: true,
23899 - touchmove: true
23900 - };
23901 - var InputState = class {
23902 - constructor() {
23903 - this.shiftKey = false;
23904 - this.mouseDown = null;
23905 - this.lastKeyCode = null;
23906 - this.lastKeyCodeTime = 0;
23907 - this.lastClick = {
23908 - time: 0,
23909 - x: 0,
23910 - y: 0,
23911 - type: "",
23912 - button: 0
23913 - };
23914 - this.lastSelectionOrigin = null;
23915 - this.lastSelectionTime = 0;
23916 - this.lastIOSEnter = 0;
23917 - this.lastIOSEnterFallbackTimeout = -1;
23918 - this.lastFocus = 0;
23919 - this.lastTouch = 0;
23920 - this.lastChromeDelete = 0;
23921 - this.composing = false;
23922 - this.compositionNode = null;
23923 - this.composingTimeout = -1;
23924 - this.compositionNodes = [];
23925 - this.compositionEndedAt = -2e8;
23926 - this.compositionID = 1;
23927 - this.badSafariComposition = false;
23928 - this.compositionPendingChanges = 0;
23929 - this.domChangeCount = 0;
23930 - this.eventHandlers = Object.create(null);
23931 - this.hideSelectionGuard = null;
23932 - }
23933 - };
23934 - function initInput(view) {
23935 - for (let event in handlers) {
23936 - let handler = handlers[event];
23937 - view.dom.addEventListener(event, view.input.eventHandlers[event] = (event) => {
23938 - if (eventBelongsToView(view, event) && !runCustomHandler(view, event) && (view.editable || !(event.type in editHandlers))) handler(view, event);
23939 - }, passiveHandlers[event] ? { passive: true } : void 0);
23940 - }
23941 - if (safari) view.dom.addEventListener("input", () => null);
23942 - ensureListeners(view);
23943 - }
23944 - function setSelectionOrigin(view, origin) {
23945 - view.input.lastSelectionOrigin = origin;
23946 - view.input.lastSelectionTime = Date.now();
23947 - }
23948 - function destroyInput(view) {
23949 - view.domObserver.stop();
23950 - for (let type in view.input.eventHandlers) view.dom.removeEventListener(type, view.input.eventHandlers[type]);
23951 - clearTimeout(view.input.composingTimeout);
23952 - clearTimeout(view.input.lastIOSEnterFallbackTimeout);
23953 - }
23954 - function ensureListeners(view) {
23955 - view.someProp("handleDOMEvents", (currentHandlers) => {
23956 - for (let type in currentHandlers) if (!view.input.eventHandlers[type]) view.dom.addEventListener(type, view.input.eventHandlers[type] = (event) => runCustomHandler(view, event));
23957 - });
23958 - }
23959 - function runCustomHandler(view, event) {
23960 - return view.someProp("handleDOMEvents", (handlers) => {
23961 - let handler = handlers[event.type];
23962 - return handler ? handler(view, event) || event.defaultPrevented : false;
23963 - });
23964 - }
23965 - function eventBelongsToView(view, event) {
23966 - if (!event.bubbles) return true;
23967 - if (event.defaultPrevented) return false;
23968 - for (let node = event.target; node != view.dom; node = node.parentNode) if (!node || node.nodeType == 11 || node.pmViewDesc && node.pmViewDesc.stopEvent(event)) return false;
23969 - return true;
23970 - }
23971 - function dispatchEvent(view, event) {
23972 - if (!runCustomHandler(view, event) && handlers[event.type] && (view.editable || !(event.type in editHandlers))) handlers[event.type](view, event);
23973 - }
23974 - editHandlers.keydown = (view, _event) => {
23975 - let event = _event;
23976 - view.input.shiftKey = event.keyCode == 16 || event.shiftKey;
23977 - if (inOrNearComposition(view, event)) return;
23978 - view.input.lastKeyCode = event.keyCode;
23979 - view.input.lastKeyCodeTime = Date.now();
23980 - if (android && chrome && event.keyCode == 13) return;
23981 - if (event.keyCode != 229) view.domObserver.forceFlush();
23982 - if (ios && event.keyCode == 13 && !event.ctrlKey && !event.altKey && !event.metaKey) {
23983 - let now = Date.now();
23984 - view.input.lastIOSEnter = now;
23985 - view.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
23986 - if (view.input.lastIOSEnter == now) {
23987 - view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")));
23988 - view.input.lastIOSEnter = 0;
23989 - }
23990 - }, 200);
23991 - } else if (view.someProp("handleKeyDown", (f) => f(view, event)) || captureKeyDown(view, event)) event.preventDefault();
23992 - else setSelectionOrigin(view, "key");
23993 - };
23994 - editHandlers.keyup = (view, event) => {
23995 - if (event.keyCode == 16) view.input.shiftKey = false;
23996 - };
23997 - editHandlers.keypress = (view, _event) => {
23998 - let event = _event;
23999 - if (inOrNearComposition(view, event) || !event.charCode || event.ctrlKey && !event.altKey || mac$2 && event.metaKey) return;
24000 - if (view.someProp("handleKeyPress", (f) => f(view, event))) {
24001 - event.preventDefault();
24002 - return;
24003 - }
24004 - let sel = view.state.selection;
24005 - if (!(sel instanceof TextSelection) || !sel.$from.sameParent(sel.$to)) {
24006 - let text = String.fromCharCode(event.charCode);
24007 - let deflt = () => view.state.tr.insertText(text).scrollIntoView();
24008 - if (!/[\r\n]/.test(text) && !view.someProp("handleTextInput", (f) => f(view, sel.$from.pos, sel.$to.pos, text, deflt))) view.dispatch(deflt());
24009 - event.preventDefault();
24010 - }
24011 - };
24012 - function eventCoords(event) {
24013 - return {
24014 - left: event.clientX,
24015 - top: event.clientY
24016 - };
24017 - }
24018 - function isNear(event, click) {
24019 - let dx = click.x - event.clientX;
24020 - let dy = click.y - event.clientY;
24021 - return dx * dx + dy * dy < 100;
24022 - }
24023 - function runHandlerOnContext(view, propName, pos, inside, event) {
24024 - if (inside == -1) return false;
24025 - let $pos = view.state.doc.resolve(inside);
24026 - for (let i = $pos.depth + 1; i > 0; i--) if (view.someProp(propName, (f) => i > $pos.depth ? f(view, pos, $pos.nodeAfter, $pos.before(i), event, true) : f(view, pos, $pos.node(i), $pos.before(i), event, false))) return true;
24027 - return false;
24028 - }
24029 - function updateSelection(view, selection, origin) {
24030 - if (!view.focused) view.focus();
24031 - if (view.state.selection.eq(selection)) return;
24032 - let tr = view.state.tr.setSelection(selection);
24033 - if (origin == "pointer") tr.setMeta("pointer", true);
24034 - view.dispatch(tr);
24035 - }
24036 - function selectClickedLeaf(view, inside) {
24037 - if (inside == -1) return false;
24038 - let $pos = view.state.doc.resolve(inside);
24039 - let node = $pos.nodeAfter;
24040 - if (node && node.isAtom && NodeSelection.isSelectable(node)) {
24041 - updateSelection(view, new NodeSelection($pos), "pointer");
24042 - return true;
24043 - }
24044 - return false;
24045 - }
24046 - function selectClickedNode(view, inside) {
24047 - if (inside == -1) return false;
24048 - let sel = view.state.selection;
24049 - let selectedNode;
24050 - let selectAt;
24051 - if (sel instanceof NodeSelection) selectedNode = sel.node;
24052 - let $pos = view.state.doc.resolve(inside);
24053 - for (let i = $pos.depth + 1; i > 0; i--) {
24054 - let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);
24055 - if (NodeSelection.isSelectable(node)) {
24056 - if (selectedNode && sel.$from.depth > 0 && i >= sel.$from.depth && $pos.before(sel.$from.depth + 1) == sel.$from.pos) selectAt = $pos.before(sel.$from.depth);
24057 - else selectAt = $pos.before(i);
24058 - break;
24059 - }
24060 - }
24061 - if (selectAt != null) {
24062 - updateSelection(view, NodeSelection.create(view.state.doc, selectAt), "pointer");
24063 - return true;
24064 - } else return false;
24065 - }
24066 - function handleSingleClick(view, pos, inside, event, selectNode) {
24067 - return runHandlerOnContext(view, "handleClickOn", pos, inside, event) || view.someProp("handleClick", (f) => f(view, pos, event)) || (selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside));
24068 - }
24069 - function handleDoubleClick(view, pos, inside, event) {
24070 - return runHandlerOnContext(view, "handleDoubleClickOn", pos, inside, event) || view.someProp("handleDoubleClick", (f) => f(view, pos, event));
24071 - }
24072 - function handleTripleClick(view, pos, inside, event) {
24073 - return runHandlerOnContext(view, "handleTripleClickOn", pos, inside, event) || view.someProp("handleTripleClick", (f) => f(view, pos, event)) || defaultTripleClick(view, inside, event);
24074 - }
24075 - function defaultTripleClick(view, inside, event) {
24076 - if (event.button != 0) return false;
24077 - let doc = view.state.doc;
24078 - if (inside == -1) {
24079 - if (doc.inlineContent) {
24080 - updateSelection(view, TextSelection.create(doc, 0, doc.content.size), "pointer");
24081 - return true;
24082 - }
24083 - return false;
24084 - }
24085 - let $pos = doc.resolve(inside);
24086 - for (let i = $pos.depth + 1; i > 0; i--) {
24087 - let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);
24088 - let nodePos = $pos.before(i);
24089 - if (node.inlineContent) updateSelection(view, TextSelection.create(doc, nodePos + 1, nodePos + 1 + node.content.size), "pointer");
24090 - else if (NodeSelection.isSelectable(node)) updateSelection(view, NodeSelection.create(doc, nodePos), "pointer");
24091 - else continue;
24092 - return true;
24093 - }
24094 - }
24095 - function forceDOMFlush(view) {
24096 - return endComposition(view);
24097 - }
24098 - var selectNodeModifier = mac$2 ? "metaKey" : "ctrlKey";
24099 - handlers.mousedown = (view, _event) => {
24100 - let event = _event;
24101 - view.input.shiftKey = event.shiftKey;
24102 - let flushed = forceDOMFlush(view);
24103 - let now = Date.now();
24104 - let type = "singleClick";
24105 - if (now - view.input.lastClick.time < 500 && isNear(event, view.input.lastClick) && !event[selectNodeModifier] && view.input.lastClick.button == event.button) {
24106 - if (view.input.lastClick.type == "singleClick") type = "doubleClick";
24107 - else if (view.input.lastClick.type == "doubleClick") type = "tripleClick";
24108 - }
24109 - view.input.lastClick = {
24110 - time: now,
24111 - x: event.clientX,
24112 - y: event.clientY,
24113 - type,
24114 - button: event.button
24115 - };
24116 - let pos = view.posAtCoords(eventCoords(event));
24117 - if (!pos) return;
24118 - if (type == "singleClick") {
24119 - if (view.input.mouseDown) view.input.mouseDown.done();
24120 - view.input.mouseDown = new MouseDown(view, pos, event, !!flushed);
24121 - } else if ((type == "doubleClick" ? handleDoubleClick : handleTripleClick)(view, pos.pos, pos.inside, event)) event.preventDefault();
24122 - else setSelectionOrigin(view, "pointer");
24123 - };
24124 - var MouseDown = class {
24125 - constructor(view, pos, event, flushed) {
24126 - this.view = view;
24127 - this.pos = pos;
24128 - this.event = event;
24129 - this.flushed = flushed;
24130 - this.delayedSelectionSync = false;
24131 - this.mightDrag = null;
24132 - this.startDoc = view.state.doc;
24133 - this.selectNode = !!event[selectNodeModifier];
24134 - this.allowDefault = event.shiftKey;
24135 - let targetNode;
24136 - let targetPos;
24137 - if (pos.inside > -1) {
24138 - targetNode = view.state.doc.nodeAt(pos.inside);
24139 - targetPos = pos.inside;
24140 - } else {
24141 - let $pos = view.state.doc.resolve(pos.pos);
24142 - targetNode = $pos.parent;
24143 - targetPos = $pos.depth ? $pos.before() : 0;
24144 - }
24145 - const target = flushed ? null : event.target;
24146 - const targetDesc = target ? view.docView.nearestDesc(target, true) : null;
24147 - this.target = targetDesc && targetDesc.nodeDOM.nodeType == 1 ? targetDesc.nodeDOM : null;
24148 - let { selection } = view.state;
24149 - if (event.button == 0 && targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos) this.mightDrag = {
24150 - node: targetNode,
24151 - pos: targetPos,
24152 - addAttr: !!(this.target && !this.target.draggable),
24153 - setUneditable: !!(this.target && gecko && !this.target.hasAttribute("contentEditable"))
24154 - };
24155 - if (this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable)) {
24156 - this.view.domObserver.stop();
24157 - if (this.mightDrag.addAttr) this.target.draggable = true;
24158 - if (this.mightDrag.setUneditable) setTimeout(() => {
24159 - if (this.view.input.mouseDown == this) this.target.setAttribute("contentEditable", "false");
24160 - }, 20);
24161 - this.view.domObserver.start();
24162 - }
24163 - view.root.addEventListener("mouseup", this.up = this.up.bind(this));
24164 - view.root.addEventListener("mousemove", this.move = this.move.bind(this));
24165 - setSelectionOrigin(view, "pointer");
24166 - }
24167 - done() {
24168 - this.view.root.removeEventListener("mouseup", this.up);
24169 - this.view.root.removeEventListener("mousemove", this.move);
24170 - if (this.mightDrag && this.target) {
24171 - this.view.domObserver.stop();
24172 - if (this.mightDrag.addAttr) this.target.removeAttribute("draggable");
24173 - if (this.mightDrag.setUneditable) this.target.removeAttribute("contentEditable");
24174 - this.view.domObserver.start();
24175 - }
24176 - if (this.delayedSelectionSync) setTimeout(() => selectionToDOM(this.view));
24177 - this.view.input.mouseDown = null;
24178 - }
24179 - up(event) {
24180 - this.done();
24181 - if (!this.view.dom.contains(event.target)) return;
24182 - let pos = this.pos;
24183 - if (this.view.state.doc != this.startDoc) pos = this.view.posAtCoords(eventCoords(event));
24184 - this.updateAllowDefault(event);
24185 - if (this.allowDefault || !pos) setSelectionOrigin(this.view, "pointer");
24186 - else if (handleSingleClick(this.view, pos.pos, pos.inside, event, this.selectNode)) event.preventDefault();
24187 - else if (event.button == 0 && (this.flushed || safari && this.mightDrag && !this.mightDrag.node.isAtom || chrome && !this.view.state.selection.visible && Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2)) {
24188 - updateSelection(this.view, Selection.near(this.view.state.doc.resolve(pos.pos)), "pointer");
24189 - event.preventDefault();
24190 - } else setSelectionOrigin(this.view, "pointer");
24191 - }
24192 - move(event) {
24193 - this.updateAllowDefault(event);
24194 - setSelectionOrigin(this.view, "pointer");
24195 - if (event.buttons == 0) this.done();
24196 - }
24197 - updateAllowDefault(event) {
24198 - if (!this.allowDefault && (Math.abs(this.event.x - event.clientX) > 4 || Math.abs(this.event.y - event.clientY) > 4)) this.allowDefault = true;
24199 - }
24200 - };
24201 - handlers.touchstart = (view) => {
24202 - view.input.lastTouch = Date.now();
24203 - forceDOMFlush(view);
24204 - setSelectionOrigin(view, "pointer");
24205 - };
24206 - handlers.touchmove = (view) => {
24207 - view.input.lastTouch = Date.now();
24208 - setSelectionOrigin(view, "pointer");
24209 - };
24210 - handlers.contextmenu = (view) => forceDOMFlush(view);
24211 - function inOrNearComposition(view, event) {
24212 - if (view.composing) return true;
24213 - if (safari && Math.abs(event.timeStamp - view.input.compositionEndedAt) < 500) {
24214 - view.input.compositionEndedAt = -2e8;
24215 - return true;
24216 - }
24217 - return false;
24218 - }
24219 - var timeoutComposition = android ? 5e3 : -1;
24220 - editHandlers.compositionstart = editHandlers.compositionupdate = (view) => {
24221 - if (!view.composing) {
24222 - view.domObserver.flush();
24223 - let { state } = view, $pos = state.selection.$to;
24224 - if (state.selection instanceof TextSelection && (state.storedMarks || !$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some((m) => m.type.spec.inclusive === false) || chrome && windows$1 && selectionBeforeUneditable(view))) {
24225 - view.markCursor = view.state.storedMarks || $pos.marks();
24226 - endComposition(view, true);
24227 - view.markCursor = null;
24228 - } else {
24229 - endComposition(view, !state.selection.empty);
24230 - if (gecko && state.selection.empty && $pos.parentOffset && !$pos.textOffset && $pos.nodeBefore.marks.length) {
24231 - let sel = view.domSelectionRange();
24232 - for (let node = sel.focusNode, offset = sel.focusOffset; node && node.nodeType == 1 && offset != 0;) {
24233 - let before = offset < 0 ? node.lastChild : node.childNodes[offset - 1];
24234 - if (!before) break;
24235 - if (before.nodeType == 3) {
24236 - let sel = view.domSelection();
24237 - if (sel) sel.collapse(before, before.nodeValue.length);
24238 - break;
24239 - } else {
24240 - node = before;
24241 - offset = -1;
24242 - }
24243 - }
24244 - }
24245 - }
24246 - view.input.composing = true;
24247 - }
24248 - scheduleComposeEnd(view, timeoutComposition);
24249 - };
24250 - function selectionBeforeUneditable(view) {
24251 - let { focusNode, focusOffset } = view.domSelectionRange();
24252 - if (!focusNode || focusNode.nodeType != 1 || focusOffset >= focusNode.childNodes.length) return false;
24253 - let next = focusNode.childNodes[focusOffset];
24254 - return next.nodeType == 1 && next.contentEditable == "false";
24255 - }
24256 - editHandlers.compositionend = (view, event) => {
24257 - if (view.composing) {
24258 - view.input.composing = false;
24259 - view.input.compositionEndedAt = event.timeStamp;
24260 - view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;
24261 - view.input.compositionNode = null;
24262 - if (view.input.badSafariComposition) view.domObserver.forceFlush();
24263 - else if (view.input.compositionPendingChanges) Promise.resolve().then(() => view.domObserver.flush());
24264 - view.input.compositionID++;
24265 - scheduleComposeEnd(view, 20);
24266 - }
24267 - };
24268 - function scheduleComposeEnd(view, delay) {
24269 - clearTimeout(view.input.composingTimeout);
24270 - if (delay > -1) view.input.composingTimeout = setTimeout(() => endComposition(view), delay);
24271 - }
24272 - function clearComposition(view) {
24273 - if (view.composing) {
24274 - view.input.composing = false;
24275 - view.input.compositionEndedAt = timestampFromCustomEvent();
24276 - }
24277 - while (view.input.compositionNodes.length > 0) view.input.compositionNodes.pop().markParentsDirty();
24278 - }
24279 - function findCompositionNode(view) {
24280 - let sel = view.domSelectionRange();
24281 - if (!sel.focusNode) return null;
24282 - let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);
24283 - let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);
24284 - if (textBefore && textAfter && textBefore != textAfter) {
24285 - let descAfter = textAfter.pmViewDesc;
24286 - let lastChanged = view.domObserver.lastChangedTextNode;
24287 - if (textBefore == lastChanged || textAfter == lastChanged) return lastChanged;
24288 - if (!descAfter || !descAfter.isText(textAfter.nodeValue)) return textAfter;
24289 - else if (view.input.compositionNode == textAfter) {
24290 - let descBefore = textBefore.pmViewDesc;
24291 - if (!(!descBefore || !descBefore.isText(textBefore.nodeValue))) return textAfter;
24292 - }
24293 - }
24294 - return textBefore || textAfter;
24295 - }
24296 - function timestampFromCustomEvent() {
24297 - let event = document.createEvent("Event");
24298 - event.initEvent("event", true, true);
24299 - return event.timeStamp;
24300 - }
24301 - /**
24302 - @internal
24303 - */
24304 - function endComposition(view, restarting = false) {
24305 - if (android && view.domObserver.flushingSoon >= 0) return;
24306 - view.domObserver.forceFlush();
24307 - clearComposition(view);
24308 - if (restarting || view.docView && view.docView.dirty) {
24309 - let sel = selectionFromDOM(view);
24310 - let cur = view.state.selection;
24311 - if (sel && !sel.eq(cur)) view.dispatch(view.state.tr.setSelection(sel));
24312 - else if ((view.markCursor || restarting) && !cur.$from.node(cur.$from.sharedDepth(cur.to)).inlineContent) view.dispatch(view.state.tr.deleteSelection());
24313 - else view.updateState(view.state);
24314 - return true;
24315 - }
24316 - return false;
24317 - }
24318 - function captureCopy(view, dom) {
24319 - if (!view.dom.parentNode) return;
24320 - let wrap = view.dom.parentNode.appendChild(document.createElement("div"));
24321 - wrap.appendChild(dom);
24322 - wrap.style.cssText = "position: fixed; left: -10000px; top: 10px";
24323 - let sel = getSelection();
24324 - let range = document.createRange();
24325 - range.selectNodeContents(dom);
24326 - view.dom.blur();
24327 - sel.removeAllRanges();
24328 - sel.addRange(range);
24329 - setTimeout(() => {
24330 - if (wrap.parentNode) wrap.parentNode.removeChild(wrap);
24331 - view.focus();
24332 - }, 50);
24333 - }
24334 - var brokenClipboardAPI = ie$1 && ie_version < 15 || ios && webkit_version < 604;
24335 - handlers.copy = editHandlers.cut = (view, _event) => {
24336 - let event = _event;
24337 - let sel = view.state.selection;
24338 - let cut = event.type == "cut";
24339 - if (sel.empty) return;
24340 - let data = brokenClipboardAPI ? null : event.clipboardData;
24341 - let { dom, text } = serializeForClipboard(view, sel.content());
24342 - if (data) {
24343 - event.preventDefault();
24344 - data.clearData();
24345 - data.setData("text/html", dom.innerHTML);
24346 - data.setData("text/plain", text);
24347 - } else captureCopy(view, dom);
24348 - if (cut) view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
24349 - };
24350 - function sliceSingleNode(slice) {
24351 - return slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1 ? slice.content.firstChild : null;
24352 - }
24353 - function capturePaste(view, event) {
24354 - if (!view.dom.parentNode) return;
24355 - let plainText = view.input.shiftKey || view.state.selection.$from.parent.type.spec.code;
24356 - let target = view.dom.parentNode.appendChild(document.createElement(plainText ? "textarea" : "div"));
24357 - if (!plainText) target.contentEditable = "true";
24358 - target.style.cssText = "position: fixed; left: -10000px; top: 10px";
24359 - target.focus();
24360 - let plain = view.input.shiftKey && view.input.lastKeyCode != 45;
24361 - setTimeout(() => {
24362 - view.focus();
24363 - if (target.parentNode) target.parentNode.removeChild(target);
24364 - if (plainText) doPaste(view, target.value, null, plain, event);
24365 - else doPaste(view, target.textContent, target.innerHTML, plain, event);
24366 - }, 50);
24367 - }
24368 - function doPaste(view, text, html, preferPlain, event) {
24369 - let slice = parseFromClipboard(view, text, html, preferPlain, view.state.selection.$from);
24370 - if (view.someProp("handlePaste", (f) => f(view, event, slice || Slice.empty))) return true;
24371 - if (!slice) return false;
24372 - let singleNode = sliceSingleNode(slice);
24373 - let tr = singleNode ? view.state.tr.replaceSelectionWith(singleNode, preferPlain) : view.state.tr.replaceSelection(slice);
24374 - view.dispatch(tr.scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste"));
24375 - return true;
24376 - }
24377 - function getText$1(clipboardData) {
24378 - let text = clipboardData.getData("text/plain") || clipboardData.getData("Text");
24379 - if (text) return text;
24380 - let uris = clipboardData.getData("text/uri-list");
24381 - return uris ? uris.replace(/\r?\n/g, " ") : "";
24382 - }
24383 - __name(getText$1, "getText");
24384 - editHandlers.paste = (view, _event) => {
24385 - let event = _event;
24386 - if (view.composing && !android) return;
24387 - let data = brokenClipboardAPI ? null : event.clipboardData;
24388 - let plain = view.input.shiftKey && view.input.lastKeyCode != 45;
24389 - if (data && doPaste(view, getText$1(data), data.getData("text/html"), plain, event)) event.preventDefault();
24390 - else capturePaste(view, event);
24391 - };
24392 - var Dragging = class {
24393 - constructor(slice, move, node) {
24394 - this.slice = slice;
24395 - this.move = move;
24396 - this.node = node;
24397 - }
24398 - };
24399 - var dragCopyModifier = mac$2 ? "altKey" : "ctrlKey";
24400 - function dragMoves(view, event) {
24401 - let moves = view.someProp("dragCopies", (test) => !test(event));
24402 - return moves != null ? moves : !event[dragCopyModifier];
24403 - }
24404 - handlers.dragstart = (view, _event) => {
24405 - let event = _event;
24406 - let mouseDown = view.input.mouseDown;
24407 - if (mouseDown) mouseDown.done();
24408 - if (!event.dataTransfer) return;
24409 - let sel = view.state.selection;
24410 - let pos = sel.empty ? null : view.posAtCoords(eventCoords(event));
24411 - let node;
24412 - if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof NodeSelection ? sel.to - 1 : sel.to));
24413 - else if (mouseDown && mouseDown.mightDrag) node = NodeSelection.create(view.state.doc, mouseDown.mightDrag.pos);
24414 - else if (event.target && event.target.nodeType == 1) {
24415 - let desc = view.docView.nearestDesc(event.target, true);
24416 - if (desc && desc.node.type.spec.draggable && desc != view.docView) node = NodeSelection.create(view.state.doc, desc.posBefore);
24417 - }
24418 - let { dom, text, slice } = serializeForClipboard(view, (node || view.state.selection).content());
24419 - if (!event.dataTransfer.files.length || !chrome || chrome_version > 120) event.dataTransfer.clearData();
24420 - event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
24421 - event.dataTransfer.effectAllowed = "copyMove";
24422 - if (!brokenClipboardAPI) event.dataTransfer.setData("text/plain", text);
24423 - view.dragging = new Dragging(slice, dragMoves(view, event), node);
24424 - };
24425 - handlers.dragend = (view) => {
24426 - let dragging = view.dragging;
24427 - window.setTimeout(() => {
24428 - if (view.dragging == dragging) view.dragging = null;
24429 - }, 50);
24430 - };
24431 - editHandlers.dragover = editHandlers.dragenter = (_, e) => e.preventDefault();
24432 - editHandlers.drop = (view, event) => {
24433 - try {
24434 - handleDrop(view, event, view.dragging);
24435 - } finally {
24436 - view.dragging = null;
24437 - }
24438 - };
24439 - function handleDrop(view, event, dragging) {
24440 - if (!event.dataTransfer) return;
24441 - let eventPos = view.posAtCoords(eventCoords(event));
24442 - if (!eventPos) return;
24443 - let $mouse = view.state.doc.resolve(eventPos.pos);
24444 - let slice = dragging && dragging.slice;
24445 - if (slice) view.someProp("transformPasted", (f) => {
24446 - slice = f(slice, view, false);
24447 - });
24448 - else slice = parseFromClipboard(view, getText$1(event.dataTransfer), brokenClipboardAPI ? null : event.dataTransfer.getData("text/html"), false, $mouse);
24449 - let move = !!(dragging && dragMoves(view, event));
24450 - if (view.someProp("handleDrop", (f) => f(view, event, slice || Slice.empty, move))) {
24451 - event.preventDefault();
24452 - return;
24453 - }
24454 - if (!slice) return;
24455 - event.preventDefault();
24456 - let insertPos = slice ? dropPoint(view.state.doc, $mouse.pos, slice) : $mouse.pos;
24457 - if (insertPos == null) insertPos = $mouse.pos;
24458 - let tr = view.state.tr;
24459 - if (move) {
24460 - let { node } = dragging;
24461 - if (node) node.replace(tr);
24462 - else tr.deleteSelection();
24463 - }
24464 - let pos = tr.mapping.map(insertPos);
24465 - let isNode = slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1;
24466 - let beforeInsert = tr.doc;
24467 - if (isNode) tr.replaceRangeWith(pos, pos, slice.content.firstChild);
24468 - else tr.replaceRange(pos, pos, slice);
24469 - if (tr.doc.eq(beforeInsert)) return;
24470 - let $pos = tr.doc.resolve(pos);
24471 - if (isNode && NodeSelection.isSelectable(slice.content.firstChild) && $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice.content.firstChild)) tr.setSelection(new NodeSelection($pos));
24472 - else {
24473 - let end = tr.mapping.map(insertPos);
24474 - tr.mapping.maps[tr.mapping.maps.length - 1].forEach((_from, _to, _newFrom, newTo) => end = newTo);
24475 - tr.setSelection(selectionBetween(view, $pos, tr.doc.resolve(end)));
24476 - }
24477 - view.focus();
24478 - view.dispatch(tr.setMeta("uiEvent", "drop"));
24479 - }
24480 - handlers.focus = (view) => {
24481 - view.input.lastFocus = Date.now();
24482 - if (!view.focused) {
24483 - view.domObserver.stop();
24484 - view.dom.classList.add("ProseMirror-focused");
24485 - view.domObserver.start();
24486 - view.focused = true;
24487 - setTimeout(() => {
24488 - if (view.docView && view.hasFocus() && !view.domObserver.currentSelection.eq(view.domSelectionRange())) selectionToDOM(view);
24489 - }, 20);
24490 - }
24491 - };
24492 - handlers.blur = (view, _event) => {
24493 - let event = _event;
24494 - if (view.focused) {
24495 - view.domObserver.stop();
24496 - view.dom.classList.remove("ProseMirror-focused");
24497 - view.domObserver.start();
24498 - if (event.relatedTarget && view.dom.contains(event.relatedTarget)) view.domObserver.currentSelection.clear();
24499 - view.focused = false;
24500 - }
24501 - };
24502 - handlers.beforeinput = (view, _event) => {
24503 - if (chrome && android && _event.inputType == "deleteContentBackward") {
24504 - view.domObserver.flushSoon();
24505 - let { domChangeCount } = view.input;
24506 - setTimeout(() => {
24507 - if (view.input.domChangeCount != domChangeCount) return;
24508 - view.dom.blur();
24509 - view.focus();
24510 - if (view.someProp("handleKeyDown", (f) => f(view, keyEvent(8, "Backspace")))) return;
24511 - let { $cursor } = view.state.selection;
24512 - if ($cursor && $cursor.pos > 0) view.dispatch(view.state.tr.delete($cursor.pos - 1, $cursor.pos).scrollIntoView());
24513 - }, 50);
24514 - }
24515 - };
24516 - for (let prop in editHandlers) handlers[prop] = editHandlers[prop];
24517 - function compareObjs(a, b) {
24518 - if (a == b) return true;
24519 - for (let p in a) if (a[p] !== b[p]) return false;
24520 - for (let p in b) if (!(p in a)) return false;
24521 - return true;
24522 - }
24523 - var WidgetType = class WidgetType {
24524 - constructor(toDOM, spec) {
24525 - this.toDOM = toDOM;
24526 - this.spec = spec || noSpec;
24527 - this.side = this.spec.side || 0;
24528 - }
24529 - map(mapping, span, offset, oldOffset) {
24530 - let { pos, deleted } = mapping.mapResult(span.from + oldOffset, this.side < 0 ? -1 : 1);
24531 - return deleted ? null : new Decoration(pos - offset, pos - offset, this);
24532 - }
24533 - valid() {
24534 - return true;
24535 - }
24536 - eq(other) {
24537 - return this == other || other instanceof WidgetType && (this.spec.key && this.spec.key == other.spec.key || this.toDOM == other.toDOM && compareObjs(this.spec, other.spec));
24538 - }
24539 - destroy(node) {
24540 - if (this.spec.destroy) this.spec.destroy(node);
24541 - }
24542 - };
24543 - var InlineType = class InlineType {
24544 - constructor(attrs, spec) {
24545 - this.attrs = attrs;
24546 - this.spec = spec || noSpec;
24547 - }
24548 - map(mapping, span, offset, oldOffset) {
24549 - let from = mapping.map(span.from + oldOffset, this.spec.inclusiveStart ? -1 : 1) - offset;
24550 - let to = mapping.map(span.to + oldOffset, this.spec.inclusiveEnd ? 1 : -1) - offset;
24551 - return from >= to ? null : new Decoration(from, to, this);
24552 - }
24553 - valid(_, span) {
24554 - return span.from < span.to;
24555 - }
24556 - eq(other) {
24557 - return this == other || other instanceof InlineType && compareObjs(this.attrs, other.attrs) && compareObjs(this.spec, other.spec);
24558 - }
24559 - static is(span) {
24560 - return span.type instanceof InlineType;
24561 - }
24562 - destroy() {}
24563 - };
24564 - var NodeType = class NodeType {
24565 - constructor(attrs, spec) {
24566 - this.attrs = attrs;
24567 - this.spec = spec || noSpec;
24568 - }
24569 - map(mapping, span, offset, oldOffset) {
24570 - let from = mapping.mapResult(span.from + oldOffset, 1);
24571 - if (from.deleted) return null;
24572 - let to = mapping.mapResult(span.to + oldOffset, -1);
24573 - if (to.deleted || to.pos <= from.pos) return null;
24574 - return new Decoration(from.pos - offset, to.pos - offset, this);
24575 - }
24576 - valid(node, span) {
24577 - let { index, offset } = node.content.findIndex(span.from), child;
24578 - return offset == span.from && !(child = node.child(index)).isText && offset + child.nodeSize == span.to;
24579 - }
24580 - eq(other) {
24581 - return this == other || other instanceof NodeType && compareObjs(this.attrs, other.attrs) && compareObjs(this.spec, other.spec);
24582 - }
24583 - destroy() {}
24584 - };
24585 - /**
24586 - Decoration objects can be provided to the view through the
24587 - [`decorations` prop](https://prosemirror.net/docs/ref/#view.EditorProps.decorations). They come in
24588 - several variants—see the static members of this class for details.
24589 - */
24590 - var Decoration = class Decoration {
24591 - /**
24592 - @internal
24593 - */
24594 - constructor(from, to, type) {
24595 - this.from = from;
24596 - this.to = to;
24597 - this.type = type;
24598 - }
24599 - /**
24600 - @internal
24601 - */
24602 - copy(from, to) {
24603 - return new Decoration(from, to, this.type);
24604 - }
24605 - /**
24606 - @internal
24607 - */
24608 - eq(other, offset = 0) {
24609 - return this.type.eq(other.type) && this.from + offset == other.from && this.to + offset == other.to;
24610 - }
24611 - /**
24612 - @internal
24613 - */
24614 - map(mapping, offset, oldOffset) {
24615 - return this.type.map(mapping, this, offset, oldOffset);
24616 - }
24617 - /**
24618 - Creates a widget decoration, which is a DOM node that's shown in
24619 - the document at the given position. It is recommended that you
24620 - delay rendering the widget by passing a function that will be
24621 - called when the widget is actually drawn in a view, but you can
24622 - also directly pass a DOM node. `getPos` can be used to find the
24623 - widget's current document position.
24624 - */
24625 - static widget(pos, toDOM, spec) {
24626 - return new Decoration(pos, pos, new WidgetType(toDOM, spec));
24627 - }
24628 - /**
24629 - Creates an inline decoration, which adds the given attributes to
24630 - each inline node between `from` and `to`.
24631 - */
24632 - static inline(from, to, attrs, spec) {
24633 - return new Decoration(from, to, new InlineType(attrs, spec));
24634 - }
24635 - /**
24636 - Creates a node decoration. `from` and `to` should point precisely
24637 - before and after a node in the document. That node, and only that
24638 - node, will receive the given attributes.
24639 - */
24640 - static node(from, to, attrs, spec) {
24641 - return new Decoration(from, to, new NodeType(attrs, spec));
24642 - }
24643 - /**
24644 - The spec provided when creating this decoration. Can be useful
24645 - if you've stored extra information in that object.
24646 - */
24647 - get spec() {
24648 - return this.type.spec;
24649 - }
24650 - /**
24651 - @internal
24652 - */
24653 - get inline() {
24654 - return this.type instanceof InlineType;
24655 - }
24656 - /**
24657 - @internal
24658 - */
24659 - get widget() {
24660 - return this.type instanceof WidgetType;
24661 - }
24662 - };
24663 - var none = [];
24664 - var noSpec = {};
24665 - /**
24666 - A collection of [decorations](https://prosemirror.net/docs/ref/#view.Decoration), organized in such
24667 - a way that the drawing algorithm can efficiently use and compare
24668 - them. This is a persistent data structure—it is not modified,
24669 - updates create a new value.
24670 - */
24671 - var DecorationSet = class DecorationSet {
24672 - /**
24673 - @internal
24674 - */
24675 - constructor(local, children) {
24676 - this.local = local.length ? local : none;
24677 - this.children = children.length ? children : none;
24678 - }
24679 - /**
24680 - Create a set of decorations, using the structure of the given
24681 - document. This will consume (modify) the `decorations` array, so
24682 - you must make a copy if you want need to preserve that.
24683 - */
24684 - static create(doc, decorations) {
24685 - return decorations.length ? buildTree(decorations, doc, 0, noSpec) : empty;
24686 - }
24687 - /**
24688 - Find all decorations in this set which touch the given range
24689 - (including decorations that start or end directly at the
24690 - boundaries) and match the given predicate on their spec. When
24691 - `start` and `end` are omitted, all decorations in the set are
24692 - considered. When `predicate` isn't given, all decorations are
24693 - assumed to match.
24694 - */
24695 - find(start, end, predicate) {
24696 - let result = [];
24697 - this.findInner(start == null ? 0 : start, end == null ? 1e9 : end, result, 0, predicate);
24698 - return result;
24699 - }
24700 - findInner(start, end, result, offset, predicate) {
24701 - for (let i = 0; i < this.local.length; i++) {
24702 - let span = this.local[i];
24703 - if (span.from <= end && span.to >= start && (!predicate || predicate(span.spec))) result.push(span.copy(span.from + offset, span.to + offset));
24704 - }
24705 - for (let i = 0; i < this.children.length; i += 3) if (this.children[i] < end && this.children[i + 1] > start) {
24706 - let childOff = this.children[i] + 1;
24707 - this.children[i + 2].findInner(start - childOff, end - childOff, result, offset + childOff, predicate);
24708 - }
24709 - }
24710 - /**
24711 - Map the set of decorations in response to a change in the
24712 - document.
24713 - */
24714 - map(mapping, doc, options) {
24715 - if (this == empty || mapping.maps.length == 0) return this;
24716 - return this.mapInner(mapping, doc, 0, 0, options || noSpec);
24717 - }
24718 - /**
24719 - @internal
24720 - */
24721 - mapInner(mapping, node, offset, oldOffset, options) {
24722 - let newLocal;
24723 - for (let i = 0; i < this.local.length; i++) {
24724 - let mapped = this.local[i].map(mapping, offset, oldOffset);
24725 - if (mapped && mapped.type.valid(node, mapped)) (newLocal || (newLocal = [])).push(mapped);
24726 - else if (options.onRemove) options.onRemove(this.local[i].spec);
24727 - }
24728 - if (this.children.length) return mapChildren(this.children, newLocal || [], mapping, node, offset, oldOffset, options);
24729 - else return newLocal ? new DecorationSet(newLocal.sort(byPos), none) : empty;
24730 - }
24731 - /**
24732 - Add the given array of decorations to the ones in the set,
24733 - producing a new set. Consumes the `decorations` array. Needs
24734 - access to the current document to create the appropriate tree
24735 - structure.
24736 - */
24737 - add(doc, decorations) {
24738 - if (!decorations.length) return this;
24739 - if (this == empty) return DecorationSet.create(doc, decorations);
24740 - return this.addInner(doc, decorations, 0);
24741 - }
24742 - addInner(doc, decorations, offset) {
24743 - let children;
24744 - let childIndex = 0;
24745 - doc.forEach((childNode, childOffset) => {
24746 - let baseOffset = childOffset + offset;
24747 - let found;
24748 - if (!(found = takeSpansForNode(decorations, childNode, baseOffset))) return;
24749 - if (!children) children = this.children.slice();
24750 - while (childIndex < children.length && children[childIndex] < childOffset) childIndex += 3;
24751 - if (children[childIndex] == childOffset) children[childIndex + 2] = children[childIndex + 2].addInner(childNode, found, baseOffset + 1);
24752 - else children.splice(childIndex, 0, childOffset, childOffset + childNode.nodeSize, buildTree(found, childNode, baseOffset + 1, noSpec));
24753 - childIndex += 3;
24754 - });
24755 - let local = moveSpans(childIndex ? withoutNulls(decorations) : decorations, -offset);
24756 - for (let i = 0; i < local.length; i++) if (!local[i].type.valid(doc, local[i])) local.splice(i--, 1);
24757 - return new DecorationSet(local.length ? this.local.concat(local).sort(byPos) : this.local, children || this.children);
24758 - }
24759 - /**
24760 - Create a new set that contains the decorations in this set, minus
24761 - the ones in the given array.
24762 - */
24763 - remove(decorations) {
24764 - if (decorations.length == 0 || this == empty) return this;
24765 - return this.removeInner(decorations, 0);
24766 - }
24767 - removeInner(decorations, offset) {
24768 - let children = this.children;
24769 - let local = this.local;
24770 - for (let i = 0; i < children.length; i += 3) {
24771 - let found;
24772 - let from = children[i] + offset;
24773 - let to = children[i + 1] + offset;
24774 - for (let j = 0, span; j < decorations.length; j++) if (span = decorations[j]) {
24775 - if (span.from > from && span.to < to) {
24776 - decorations[j] = null;
24777 - (found || (found = [])).push(span);
24778 - }
24779 - }
24780 - if (!found) continue;
24781 - if (children == this.children) children = this.children.slice();
24782 - let removed = children[i + 2].removeInner(found, from + 1);
24783 - if (removed != empty) children[i + 2] = removed;
24784 - else {
24785 - children.splice(i, 3);
24786 - i -= 3;
24787 - }
24788 - }
24789 - if (local.length) {
24790 - for (let i = 0, span; i < decorations.length; i++) if (span = decorations[i]) {
24791 - for (let j = 0; j < local.length; j++) if (local[j].eq(span, offset)) {
24792 - if (local == this.local) local = this.local.slice();
24793 - local.splice(j--, 1);
24794 - }
24795 - }
24796 - }
24797 - if (children == this.children && local == this.local) return this;
24798 - return local.length || children.length ? new DecorationSet(local, children) : empty;
24799 - }
24800 - forChild(offset, node) {
24801 - if (this == empty) return this;
24802 - if (node.isLeaf) return DecorationSet.empty;
24803 - let child;
24804 - let local;
24805 - for (let i = 0; i < this.children.length; i += 3) if (this.children[i] >= offset) {
24806 - if (this.children[i] == offset) child = this.children[i + 2];
24807 - break;
24808 - }
24809 - let start = offset + 1;
24810 - let end = start + node.content.size;
24811 - for (let i = 0; i < this.local.length; i++) {
24812 - let dec = this.local[i];
24813 - if (dec.from < end && dec.to > start && dec.type instanceof InlineType) {
24814 - let from = Math.max(start, dec.from) - start;
24815 - let to = Math.min(end, dec.to) - start;
24816 - if (from < to) (local || (local = [])).push(dec.copy(from, to));
24817 - }
24818 - }
24819 - if (local) {
24820 - let localSet = new DecorationSet(local.sort(byPos), none);
24821 - return child ? new DecorationGroup([localSet, child]) : localSet;
24822 - }
24823 - return child || empty;
24824 - }
24825 - /**
24826 - @internal
24827 - */
24828 - eq(other) {
24829 - if (this == other) return true;
24830 - if (!(other instanceof DecorationSet) || this.local.length != other.local.length || this.children.length != other.children.length) return false;
24831 - for (let i = 0; i < this.local.length; i++) if (!this.local[i].eq(other.local[i])) return false;
24832 - for (let i = 0; i < this.children.length; i += 3) if (this.children[i] != other.children[i] || this.children[i + 1] != other.children[i + 1] || !this.children[i + 2].eq(other.children[i + 2])) return false;
24833 - return true;
24834 - }
24835 - /**
24836 - @internal
24837 - */
24838 - locals(node) {
24839 - return removeOverlap(this.localsInner(node));
24840 - }
24841 - /**
24842 - @internal
24843 - */
24844 - localsInner(node) {
24845 - if (this == empty) return none;
24846 - if (node.inlineContent || !this.local.some(InlineType.is)) return this.local;
24847 - let result = [];
24848 - for (let i = 0; i < this.local.length; i++) if (!(this.local[i].type instanceof InlineType)) result.push(this.local[i]);
24849 - return result;
24850 - }
24851 - forEachSet(f) {
24852 - f(this);
24853 - }
24854 - };
24855 - /**
24856 - The empty set of decorations.
24857 - */
24858 - DecorationSet.empty = new DecorationSet([], []);
24859 - /**
24860 - @internal
24861 - */
24862 - DecorationSet.removeOverlap = removeOverlap;
24863 - var empty = DecorationSet.empty;
24864 - var DecorationGroup = class DecorationGroup {
24865 - constructor(members) {
24866 - this.members = members;
24867 - }
24868 - map(mapping, doc) {
24869 - const mappedDecos = this.members.map((member) => member.map(mapping, doc, noSpec));
24870 - return DecorationGroup.from(mappedDecos);
24871 - }
24872 - forChild(offset, child) {
24873 - if (child.isLeaf) return DecorationSet.empty;
24874 - let found = [];
24875 - for (let i = 0; i < this.members.length; i++) {
24876 - let result = this.members[i].forChild(offset, child);
24877 - if (result == empty) continue;
24878 - if (result instanceof DecorationGroup) found = found.concat(result.members);
24879 - else found.push(result);
24880 - }
24881 - return DecorationGroup.from(found);
24882 - }
24883 - eq(other) {
24884 - if (!(other instanceof DecorationGroup) || other.members.length != this.members.length) return false;
24885 - for (let i = 0; i < this.members.length; i++) if (!this.members[i].eq(other.members[i])) return false;
24886 - return true;
24887 - }
24888 - locals(node) {
24889 - let result;
24890 - let sorted = true;
24891 - for (let i = 0; i < this.members.length; i++) {
24892 - let locals = this.members[i].localsInner(node);
24893 - if (!locals.length) continue;
24894 - if (!result) result = locals;
24895 - else {
24896 - if (sorted) {
24897 - result = result.slice();
24898 - sorted = false;
24899 - }
24900 - for (let j = 0; j < locals.length; j++) result.push(locals[j]);
24901 - }
24902 - }
24903 - return result ? removeOverlap(sorted ? result : result.sort(byPos)) : none;
24904 - }
24905 - static from(members) {
24906 - switch (members.length) {
24907 - case 0: return empty;
24908 - case 1: return members[0];
24909 - default: return new DecorationGroup(members.every((m) => m instanceof DecorationSet) ? members : members.reduce((r, m) => r.concat(m instanceof DecorationSet ? m : m.members), []));
24910 - }
24911 - }
24912 - forEachSet(f) {
24913 - for (let i = 0; i < this.members.length; i++) this.members[i].forEachSet(f);
24914 - }
24915 - };
24916 - function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, options) {
24917 - let children = oldChildren.slice();
24918 - for (let i = 0, baseOffset = oldOffset; i < mapping.maps.length; i++) {
24919 - let moved = 0;
24920 - mapping.maps[i].forEach((oldStart, oldEnd, newStart, newEnd) => {
24921 - let dSize = newEnd - newStart - (oldEnd - oldStart);
24922 - for (let i = 0; i < children.length; i += 3) {
24923 - let end = children[i + 1];
24924 - if (end < 0 || oldStart > end + baseOffset - moved) continue;
24925 - let start = children[i] + baseOffset - moved;
24926 - if (oldEnd >= start) children[i + 1] = oldStart <= start ? -2 : -1;
24927 - else if (oldStart >= baseOffset && dSize) {
24928 - children[i] += dSize;
24929 - children[i + 1] += dSize;
24930 - }
24931 - }
24932 - moved += dSize;
24933 - });
24934 - baseOffset = mapping.maps[i].map(baseOffset, -1);
24935 - }
24936 - let mustRebuild = false;
24937 - for (let i = 0; i < children.length; i += 3) if (children[i + 1] < 0) {
24938 - if (children[i + 1] == -2) {
24939 - mustRebuild = true;
24940 - children[i + 1] = -1;
24941 - continue;
24942 - }
24943 - let from = mapping.map(oldChildren[i] + oldOffset);
24944 - let fromLocal = from - offset;
24945 - if (fromLocal < 0 || fromLocal >= node.content.size) {
24946 - mustRebuild = true;
24947 - continue;
24948 - }
24949 - let toLocal = mapping.map(oldChildren[i + 1] + oldOffset, -1) - offset;
24950 - let { index, offset: childOffset } = node.content.findIndex(fromLocal);
24951 - let childNode = node.maybeChild(index);
24952 - if (childNode && childOffset == fromLocal && childOffset + childNode.nodeSize == toLocal) {
24953 - let mapped = children[i + 2].mapInner(mapping, childNode, from + 1, oldChildren[i] + oldOffset + 1, options);
24954 - if (mapped != empty) {
24955 - children[i] = fromLocal;
24956 - children[i + 1] = toLocal;
24957 - children[i + 2] = mapped;
24958 - } else {
24959 - children[i + 1] = -2;
24960 - mustRebuild = true;
24961 - }
24962 - } else mustRebuild = true;
24963 - }
24964 - if (mustRebuild) {
24965 - let built = buildTree(mapAndGatherRemainingDecorations(children, oldChildren, newLocal, mapping, offset, oldOffset, options), node, 0, options);
24966 - newLocal = built.local;
24967 - for (let i = 0; i < children.length; i += 3) if (children[i + 1] < 0) {
24968 - children.splice(i, 3);
24969 - i -= 3;
24970 - }
24971 - for (let i = 0, j = 0; i < built.children.length; i += 3) {
24972 - let from = built.children[i];
24973 - while (j < children.length && children[j] < from) j += 3;
24974 - children.splice(j, 0, built.children[i], built.children[i + 1], built.children[i + 2]);
24975 - }
24976 - }
24977 - return new DecorationSet(newLocal.sort(byPos), children);
24978 - }
24979 - function moveSpans(spans, offset) {
24980 - if (!offset || !spans.length) return spans;
24981 - let result = [];
24982 - for (let i = 0; i < spans.length; i++) {
24983 - let span = spans[i];
24984 - result.push(new Decoration(span.from + offset, span.to + offset, span.type));
24985 - }
24986 - return result;
24987 - }
24988 - function mapAndGatherRemainingDecorations(children, oldChildren, decorations, mapping, offset, oldOffset, options) {
24989 - function gather(set, oldOffset) {
24990 - for (let i = 0; i < set.local.length; i++) {
24991 - let mapped = set.local[i].map(mapping, offset, oldOffset);
24992 - if (mapped) decorations.push(mapped);
24993 - else if (options.onRemove) options.onRemove(set.local[i].spec);
24994 - }
24995 - for (let i = 0; i < set.children.length; i += 3) gather(set.children[i + 2], set.children[i] + oldOffset + 1);
24996 - }
24997 - for (let i = 0; i < children.length; i += 3) if (children[i + 1] == -1) gather(children[i + 2], oldChildren[i] + oldOffset + 1);
24998 - return decorations;
24999 - }
25000 - function takeSpansForNode(spans, node, offset) {
25001 - if (node.isLeaf) return null;
25002 - let end = offset + node.nodeSize;
25003 - let found = null;
25004 - for (let i = 0, span; i < spans.length; i++) if ((span = spans[i]) && span.from > offset && span.to < end) {
25005 - (found || (found = [])).push(span);
25006 - spans[i] = null;
25007 - }
25008 - return found;
25009 - }
25010 - function withoutNulls(array) {
25011 - let result = [];
25012 - for (let i = 0; i < array.length; i++) if (array[i] != null) result.push(array[i]);
25013 - return result;
25014 - }
25015 - function buildTree(spans, node, offset, options) {
25016 - let children = [];
25017 - let hasNulls = false;
25018 - node.forEach((childNode, localStart) => {
25019 - let found = takeSpansForNode(spans, childNode, localStart + offset);
25020 - if (found) {
25021 - hasNulls = true;
25022 - let subtree = buildTree(found, childNode, offset + localStart + 1, options);
25023 - if (subtree != empty) children.push(localStart, localStart + childNode.nodeSize, subtree);
25024 - }
25025 - });
25026 - let locals = moveSpans(hasNulls ? withoutNulls(spans) : spans, -offset).sort(byPos);
25027 - for (let i = 0; i < locals.length; i++) if (!locals[i].type.valid(node, locals[i])) {
25028 - if (options.onRemove) options.onRemove(locals[i].spec);
25029 - locals.splice(i--, 1);
25030 - }
25031 - return locals.length || children.length ? new DecorationSet(locals, children) : empty;
25032 - }
25033 - function byPos(a, b) {
25034 - return a.from - b.from || a.to - b.to;
25035 - }
25036 - function removeOverlap(spans) {
25037 - let working = spans;
25038 - for (let i = 0; i < working.length - 1; i++) {
25039 - let span = working[i];
25040 - if (span.from != span.to) for (let j = i + 1; j < working.length; j++) {
25041 - let next = working[j];
25042 - if (next.from == span.from) {
25043 - if (next.to != span.to) {
25044 - if (working == spans) working = spans.slice();
25045 - working[j] = next.copy(next.from, span.to);
25046 - insertAhead(working, j + 1, next.copy(span.to, next.to));
25047 - }
25048 - continue;
25049 - } else {
25050 - if (next.from < span.to) {
25051 - if (working == spans) working = spans.slice();
25052 - working[i] = span.copy(span.from, next.from);
25053 - insertAhead(working, j, span.copy(next.from, span.to));
25054 - }
25055 - break;
25056 - }
25057 - }
25058 - }
25059 - return working;
25060 - }
25061 - function insertAhead(array, i, deco) {
25062 - while (i < array.length && byPos(deco, array[i]) > 0) i++;
25063 - array.splice(i, 0, deco);
25064 - }
25065 - function viewDecorations(view) {
25066 - let found = [];
25067 - view.someProp("decorations", (f) => {
25068 - let result = f(view.state);
25069 - if (result && result != empty) found.push(result);
25070 - });
25071 - if (view.cursorWrapper) found.push(DecorationSet.create(view.state.doc, [view.cursorWrapper.deco]));
25072 - return DecorationGroup.from(found);
25073 - }
25074 - var observeOptions = {
25075 - childList: true,
25076 - characterData: true,
25077 - characterDataOldValue: true,
25078 - attributes: true,
25079 - attributeOldValue: true,
25080 - subtree: true
25081 - };
25082 - var useCharData = ie$1 && ie_version <= 11;
25083 - var SelectionState = class {
25084 - constructor() {
25085 - this.anchorNode = null;
25086 - this.anchorOffset = 0;
25087 - this.focusNode = null;
25088 - this.focusOffset = 0;
25089 - }
25090 - set(sel) {
25091 - this.anchorNode = sel.anchorNode;
25092 - this.anchorOffset = sel.anchorOffset;
25093 - this.focusNode = sel.focusNode;
25094 - this.focusOffset = sel.focusOffset;
25095 - }
25096 - clear() {
25097 - this.anchorNode = this.focusNode = null;
25098 - }
25099 - eq(sel) {
25100 - return sel.anchorNode == this.anchorNode && sel.anchorOffset == this.anchorOffset && sel.focusNode == this.focusNode && sel.focusOffset == this.focusOffset;
25101 - }
25102 - };
25103 - var DOMObserver = class {
25104 - constructor(view, handleDOMChange) {
25105 - this.view = view;
25106 - this.handleDOMChange = handleDOMChange;
25107 - this.queue = [];
25108 - this.flushingSoon = -1;
25109 - this.observer = null;
25110 - this.currentSelection = new SelectionState();
25111 - this.onCharData = null;
25112 - this.suppressingSelectionUpdates = false;
25113 - this.lastChangedTextNode = null;
25114 - this.observer = window.MutationObserver && new window.MutationObserver((mutations) => {
25115 - for (let i = 0; i < mutations.length; i++) this.queue.push(mutations[i]);
25116 - if (ie$1 && ie_version <= 11 && mutations.some((m) => m.type == "childList" && m.removedNodes.length || m.type == "characterData" && m.oldValue.length > m.target.nodeValue.length)) this.flushSoon();
25117 - else if (safari && view.composing && mutations.some((m) => m.type == "childList" && m.target.nodeName == "TR")) {
25118 - view.input.badSafariComposition = true;
25119 - this.flushSoon();
25120 - } else this.flush();
25121 - });
25122 - if (useCharData) this.onCharData = (e) => {
25123 - this.queue.push({
25124 - target: e.target,
25125 - type: "characterData",
25126 - oldValue: e.prevValue
25127 - });
25128 - this.flushSoon();
25129 - };
25130 - this.onSelectionChange = this.onSelectionChange.bind(this);
25131 - }
25132 - flushSoon() {
25133 - if (this.flushingSoon < 0) this.flushingSoon = window.setTimeout(() => {
25134 - this.flushingSoon = -1;
25135 - this.flush();
25136 - }, 20);
25137 - }
25138 - forceFlush() {
25139 - if (this.flushingSoon > -1) {
25140 - window.clearTimeout(this.flushingSoon);
25141 - this.flushingSoon = -1;
25142 - this.flush();
25143 - }
25144 - }
25145 - start() {
25146 - if (this.observer) {
25147 - this.observer.takeRecords();
25148 - this.observer.observe(this.view.dom, observeOptions);
25149 - }
25150 - if (this.onCharData) this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData);
25151 - this.connectSelection();
25152 - }
25153 - stop() {
25154 - if (this.observer) {
25155 - let take = this.observer.takeRecords();
25156 - if (take.length) {
25157 - for (let i = 0; i < take.length; i++) this.queue.push(take[i]);
25158 - window.setTimeout(() => this.flush(), 20);
25159 - }
25160 - this.observer.disconnect();
25161 - }
25162 - if (this.onCharData) this.view.dom.removeEventListener("DOMCharacterDataModified", this.onCharData);
25163 - this.disconnectSelection();
25164 - }
25165 - connectSelection() {
25166 - this.view.dom.ownerDocument.addEventListener("selectionchange", this.onSelectionChange);
25167 - }
25168 - disconnectSelection() {
25169 - this.view.dom.ownerDocument.removeEventListener("selectionchange", this.onSelectionChange);
25170 - }
25171 - suppressSelectionUpdates() {
25172 - this.suppressingSelectionUpdates = true;
25173 - setTimeout(() => this.suppressingSelectionUpdates = false, 50);
25174 - }
25175 - onSelectionChange() {
25176 - if (!hasFocusAndSelection(this.view)) return;
25177 - if (this.suppressingSelectionUpdates) return selectionToDOM(this.view);
25178 - if (ie$1 && ie_version <= 11 && !this.view.state.selection.empty) {
25179 - let sel = this.view.domSelectionRange();
25180 - if (sel.focusNode && isEquivalentPosition(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset)) return this.flushSoon();
25181 - }
25182 - this.flush();
25183 - }
25184 - setCurSelection() {
25185 - this.currentSelection.set(this.view.domSelectionRange());
25186 - }
25187 - ignoreSelectionChange(sel) {
25188 - if (!sel.focusNode) return true;
25189 - let ancestors = /* @__PURE__ */ new Set();
25190 - let container;
25191 - for (let scan = sel.focusNode; scan; scan = parentNode(scan)) ancestors.add(scan);
25192 - for (let scan = sel.anchorNode; scan; scan = parentNode(scan)) if (ancestors.has(scan)) {
25193 - container = scan;
25194 - break;
25195 - }
25196 - let desc = container && this.view.docView.nearestDesc(container);
25197 - if (desc && desc.ignoreMutation({
25198 - type: "selection",
25199 - target: container.nodeType == 3 ? container.parentNode : container
25200 - })) {
25201 - this.setCurSelection();
25202 - return true;
25203 - }
25204 - }
25205 - pendingRecords() {
25206 - if (this.observer) for (let mut of this.observer.takeRecords()) this.queue.push(mut);
25207 - return this.queue;
25208 - }
25209 - flush() {
25210 - let { view } = this;
25211 - if (!view.docView || this.flushingSoon > -1) return;
25212 - let mutations = this.pendingRecords();
25213 - if (mutations.length) this.queue = [];
25214 - let sel = view.domSelectionRange();
25215 - let newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(view) && !this.ignoreSelectionChange(sel);
25216 - let from = -1;
25217 - let to = -1;
25218 - let typeOver = false;
25219 - let added = [];
25220 - if (view.editable) for (let i = 0; i < mutations.length; i++) {
25221 - let result = this.registerMutation(mutations[i], added);
25222 - if (result) {
25223 - from = from < 0 ? result.from : Math.min(result.from, from);
25224 - to = to < 0 ? result.to : Math.max(result.to, to);
25225 - if (result.typeOver) typeOver = true;
25226 - }
25227 - }
25228 - if (added.some((n) => n.nodeName == "BR") && (view.input.lastKeyCode == 8 || view.input.lastKeyCode == 46)) {
25229 - for (let node of added) if (node.nodeName == "BR" && node.parentNode) {
25230 - let after = node.nextSibling;
25231 - if (after && after.nodeType == 1 && after.contentEditable == "false") node.parentNode.removeChild(node);
25232 - }
25233 - } else if (gecko && added.length) {
25234 - let brs = added.filter((n) => n.nodeName == "BR");
25235 - if (brs.length == 2) {
25236 - let [a, b] = brs;
25237 - if (a.parentNode && a.parentNode.parentNode == b.parentNode) b.remove();
25238 - else a.remove();
25239 - } else {
25240 - let { focusNode } = this.currentSelection;
25241 - for (let br of brs) {
25242 - let parent = br.parentNode;
25243 - if (parent && parent.nodeName == "LI" && (!focusNode || blockParent(view, focusNode) != parent)) br.remove();
25244 - }
25245 - }
25246 - }
25247 - let readSel = null;
25248 - if (from < 0 && newSel && view.input.lastFocus > Date.now() - 200 && Math.max(view.input.lastTouch, view.input.lastClick.time) < Date.now() - 300 && selectionCollapsed(sel) && (readSel = selectionFromDOM(view)) && readSel.eq(Selection.near(view.state.doc.resolve(0), 1))) {
25249 - view.input.lastFocus = 0;
25250 - selectionToDOM(view);
25251 - this.currentSelection.set(sel);
25252 - view.scrollToSelection();
25253 - } else if (from > -1 || newSel) {
25254 - if (from > -1) {
25255 - view.docView.markDirty(from, to);
25256 - checkCSS(view);
25257 - }
25258 - if (view.input.badSafariComposition) {
25259 - view.input.badSafariComposition = false;
25260 - fixUpBadSafariComposition(view, added);
25261 - }
25262 - this.handleDOMChange(from, to, typeOver, added);
25263 - if (view.docView && view.docView.dirty) view.updateState(view.state);
25264 - else if (!this.currentSelection.eq(sel)) selectionToDOM(view);
25265 - this.currentSelection.set(sel);
25266 - }
25267 - }
25268 - registerMutation(mut, added) {
25269 - if (added.indexOf(mut.target) > -1) return null;
25270 - let desc = this.view.docView.nearestDesc(mut.target);
25271 - if (mut.type == "attributes" && (desc == this.view.docView || mut.attributeName == "contenteditable" || mut.attributeName == "style" && !mut.oldValue && !mut.target.getAttribute("style"))) return null;
25272 - if (!desc || desc.ignoreMutation(mut)) return null;
25273 - if (mut.type == "childList") {
25274 - for (let i = 0; i < mut.addedNodes.length; i++) {
25275 - let node = mut.addedNodes[i];
25276 - added.push(node);
25277 - if (node.nodeType == 3) this.lastChangedTextNode = node;
25278 - }
25279 - if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target)) return {
25280 - from: desc.posBefore,
25281 - to: desc.posAfter
25282 - };
25283 - let prev = mut.previousSibling;
25284 - let next = mut.nextSibling;
25285 - if (ie$1 && ie_version <= 11 && mut.addedNodes.length) for (let i = 0; i < mut.addedNodes.length; i++) {
25286 - let { previousSibling, nextSibling } = mut.addedNodes[i];
25287 - if (!previousSibling || Array.prototype.indexOf.call(mut.addedNodes, previousSibling) < 0) prev = previousSibling;
25288 - if (!nextSibling || Array.prototype.indexOf.call(mut.addedNodes, nextSibling) < 0) next = nextSibling;
25289 - }
25290 - let fromOffset = prev && prev.parentNode == mut.target ? domIndex(prev) + 1 : 0;
25291 - let from = desc.localPosFromDOM(mut.target, fromOffset, -1);
25292 - let toOffset = next && next.parentNode == mut.target ? domIndex(next) : mut.target.childNodes.length;
25293 - return {
25294 - from,
25295 - to: desc.localPosFromDOM(mut.target, toOffset, 1)
25296 - };
25297 - } else if (mut.type == "attributes") return {
25298 - from: desc.posAtStart - desc.border,
25299 - to: desc.posAtEnd + desc.border
25300 - };
25301 - else {
25302 - this.lastChangedTextNode = mut.target;
25303 - return {
25304 - from: desc.posAtStart,
25305 - to: desc.posAtEnd,
25306 - typeOver: mut.target.nodeValue == mut.oldValue
25307 - };
25308 - }
25309 - }
25310 - };
25311 - var cssChecked = /* @__PURE__ */ new WeakMap();
25312 - var cssCheckWarned = false;
25313 - function checkCSS(view) {
25314 - if (cssChecked.has(view)) return;
25315 - cssChecked.set(view, null);
25316 - if ([
25317 - "normal",
25318 - "nowrap",
25319 - "pre-line"
25320 - ].indexOf(getComputedStyle(view.dom).whiteSpace) !== -1) {
25321 - view.requiresGeckoHackNode = gecko;
25322 - if (cssCheckWarned) return;
25323 - console["warn"]("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.");
25324 - cssCheckWarned = true;
25325 - }
25326 - }
25327 - function rangeToSelectionRange(view, range) {
25328 - let anchorNode = range.startContainer;
25329 - let anchorOffset = range.startOffset;
25330 - let focusNode = range.endContainer;
25331 - let focusOffset = range.endOffset;
25332 - let currentAnchor = view.domAtPos(view.state.selection.anchor);
25333 - if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset)) [anchorNode, anchorOffset, focusNode, focusOffset] = [
25334 - focusNode,
25335 - focusOffset,
25336 - anchorNode,
25337 - anchorOffset
25338 - ];
25339 - return {
25340 - anchorNode,
25341 - anchorOffset,
25342 - focusNode,
25343 - focusOffset
25344 - };
25345 - }
25346 - function safariShadowSelectionRange(view, selection) {
25347 - if (selection.getComposedRanges) {
25348 - let range = selection.getComposedRanges(view.root)[0];
25349 - if (range) return rangeToSelectionRange(view, range);
25350 - }
25351 - let found;
25352 - function read(event) {
25353 - event.preventDefault();
25354 - event.stopImmediatePropagation();
25355 - found = event.getTargetRanges()[0];
25356 - }
25357 - view.dom.addEventListener("beforeinput", read, true);
25358 - document.execCommand("indent");
25359 - view.dom.removeEventListener("beforeinput", read, true);
25360 - return found ? rangeToSelectionRange(view, found) : null;
25361 - }
25362 - function blockParent(view, node) {
25363 - for (let p = node.parentNode; p && p != view.dom; p = p.parentNode) {
25364 - let desc = view.docView.nearestDesc(p, true);
25365 - if (desc && desc.node.isBlock) return p;
25366 - }
25367 - return null;
25368 - }
25369 - function fixUpBadSafariComposition(view, addedNodes) {
25370 - var _a;
25371 - let { focusNode, focusOffset } = view.domSelectionRange();
25372 - for (let node of addedNodes) if (((_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.nodeName) == "TR") {
25373 - let nextCell = node.nextSibling;
25374 - while (nextCell && nextCell.nodeName != "TD" && nextCell.nodeName != "TH") nextCell = nextCell.nextSibling;
25375 - if (nextCell) {
25376 - let parent = nextCell;
25377 - for (;;) {
25378 - let first = parent.firstChild;
25379 - if (!first || first.nodeType != 1 || first.contentEditable == "false" || /^(BR|IMG)$/.test(first.nodeName)) break;
25380 - parent = first;
25381 - }
25382 - parent.insertBefore(node, parent.firstChild);
25383 - if (focusNode == node) view.domSelection().collapse(node, focusOffset);
25384 - } else node.parentNode.removeChild(node);
25385 - }
25386 - }
25387 - function parseBetween(view, from_, to_) {
25388 - let { node: parent, fromOffset, toOffset, from, to } = view.docView.parseRange(from_, to_);
25389 - let domSel = view.domSelectionRange();
25390 - let find;
25391 - let anchor = domSel.anchorNode;
25392 - if (anchor && view.dom.contains(anchor.nodeType == 1 ? anchor : anchor.parentNode)) {
25393 - find = [{
25394 - node: anchor,
25395 - offset: domSel.anchorOffset
25396 - }];
25397 - if (!selectionCollapsed(domSel)) find.push({
25398 - node: domSel.focusNode,
25399 - offset: domSel.focusOffset
25400 - });
25401 - }
25402 - if (chrome && view.input.lastKeyCode === 8) for (let off = toOffset; off > fromOffset; off--) {
25403 - let node = parent.childNodes[off - 1];
25404 - let desc = node.pmViewDesc;
25405 - if (node.nodeName == "BR" && !desc) {
25406 - toOffset = off;
25407 - break;
25408 - }
25409 - if (!desc || desc.size) break;
25410 - }
25411 - let startDoc = view.state.doc;
25412 - let parser = view.someProp("domParser") || DOMParser$1.fromSchema(view.state.schema);
25413 - let $from = startDoc.resolve(from);
25414 - let sel = null;
25415 - let doc = parser.parse(parent, {
25416 - topNode: $from.parent,
25417 - topMatch: $from.parent.contentMatchAt($from.index()),
25418 - topOpen: true,
25419 - from: fromOffset,
25420 - to: toOffset,
25421 - preserveWhitespace: $from.parent.type.whitespace == "pre" ? "full" : true,
25422 - findPositions: find,
25423 - ruleFromNode,
25424 - context: $from
25425 - });
25426 - if (find && find[0].pos != null) {
25427 - let anchor = find[0].pos;
25428 - let head = find[1] && find[1].pos;
25429 - if (head == null) head = anchor;
25430 - sel = {
25431 - anchor: anchor + from,
25432 - head: head + from
25433 - };
25434 - }
25435 - return {
25436 - doc,
25437 - sel,
25438 - from,
25439 - to
25440 - };
25441 - }
25442 - function ruleFromNode(dom) {
25443 - let desc = dom.pmViewDesc;
25444 - if (desc) return desc.parseRule();
25445 - else if (dom.nodeName == "BR" && dom.parentNode) {
25446 - if (safari && /^(ul|ol)$/i.test(dom.parentNode.nodeName)) {
25447 - let skip = document.createElement("div");
25448 - skip.appendChild(document.createElement("li"));
25449 - return { skip };
25450 - } else if (dom.parentNode.lastChild == dom || safari && /^(tr|table)$/i.test(dom.parentNode.nodeName)) return { ignore: true };
25451 - } else if (dom.nodeName == "IMG" && dom.getAttribute("mark-placeholder")) return { ignore: true };
25452 - return null;
25453 - }
25454 - var isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
25455 - function readDOMChange(view, from, to, typeOver, addedNodes) {
25456 - let compositionID = view.input.compositionPendingChanges || (view.composing ? view.input.compositionID : 0);
25457 - view.input.compositionPendingChanges = 0;
25458 - if (from < 0) {
25459 - let origin = view.input.lastSelectionTime > Date.now() - 50 ? view.input.lastSelectionOrigin : null;
25460 - let newSel = selectionFromDOM(view, origin);
25461 - if (newSel && !view.state.selection.eq(newSel)) {
25462 - if (chrome && android && view.input.lastKeyCode === 13 && Date.now() - 100 < view.input.lastKeyCodeTime && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) return;
25463 - let tr = view.state.tr.setSelection(newSel);
25464 - if (origin == "pointer") tr.setMeta("pointer", true);
25465 - else if (origin == "key") tr.scrollIntoView();
25466 - if (compositionID) tr.setMeta("composition", compositionID);
25467 - view.dispatch(tr);
25468 - }
25469 - return;
25470 - }
25471 - let $before = view.state.doc.resolve(from);
25472 - let shared = $before.sharedDepth(to);
25473 - from = $before.before(shared + 1);
25474 - to = view.state.doc.resolve(to).after(shared + 1);
25475 - let sel = view.state.selection;
25476 - let parse = parseBetween(view, from, to);
25477 - let doc = view.state.doc;
25478 - let compare = doc.slice(parse.from, parse.to);
25479 - let preferredPos;
25480 - let preferredSide;
25481 - if (view.input.lastKeyCode === 8 && Date.now() - 100 < view.input.lastKeyCodeTime) {
25482 - preferredPos = view.state.selection.to;
25483 - preferredSide = "end";
25484 - } else {
25485 - preferredPos = view.state.selection.from;
25486 - preferredSide = "start";
25487 - }
25488 - view.input.lastKeyCode = null;
25489 - let change = findDiff(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide);
25490 - if (change) view.input.domChangeCount++;
25491 - if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) && addedNodes.some((n) => n.nodeType == 1 && !isInline.test(n.nodeName)) && (!change || change.endA >= change.endB) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
25492 - view.input.lastIOSEnter = 0;
25493 - return;
25494 - }
25495 - if (!change) if (typeOver && sel instanceof TextSelection && !sel.empty && sel.$head.sameParent(sel.$anchor) && !view.composing && !(parse.sel && parse.sel.anchor != parse.sel.head)) change = {
25496 - start: sel.from,
25497 - endA: sel.to,
25498 - endB: sel.to
25499 - };
25500 - else {
25501 - if (parse.sel) {
25502 - let sel = resolveSelection(view, view.state.doc, parse.sel);
25503 - if (sel && !sel.eq(view.state.selection)) {
25504 - let tr = view.state.tr.setSelection(sel);
25505 - if (compositionID) tr.setMeta("composition", compositionID);
25506 - view.dispatch(tr);
25507 - }
25508 - }
25509 - return;
25510 - }
25511 - if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection) {
25512 - if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 && view.state.selection.from >= parse.from) change.start = view.state.selection.from;
25513 - else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2 && view.state.selection.to <= parse.to) {
25514 - change.endB += view.state.selection.to - change.endA;
25515 - change.endA = view.state.selection.to;
25516 - }
25517 - }
25518 - if (ie$1 && ie_version <= 11 && change.endB == change.start + 1 && change.endA == change.start && change.start > parse.from && parse.doc.textBetween(change.start - parse.from - 1, change.start - parse.from + 1) == " \xA0") {
25519 - change.start--;
25520 - change.endA--;
25521 - change.endB--;
25522 - }
25523 - let $from = parse.doc.resolveNoCache(change.start - parse.from);
25524 - let $to = parse.doc.resolveNoCache(change.endB - parse.from);
25525 - let $fromA = doc.resolve(change.start);
25526 - let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;
25527 - if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some((n) => n.nodeName == "DIV" || n.nodeName == "P")) || !inlineChange && $from.pos < parse.doc.content.size && (!$from.sameParent($to) || !$from.parent.inlineContent) && $from.pos < $to.pos && !/\S/.test(parse.doc.textBetween($from.pos, $to.pos, "", ""))) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter")))) {
25528 - view.input.lastIOSEnter = 0;
25529 - return;
25530 - }
25531 - if (view.state.selection.anchor > change.start && looksLikeBackspace(doc, change.start, change.endA, $from, $to) && view.someProp("handleKeyDown", (f) => f(view, keyEvent(8, "Backspace")))) {
25532 - if (android && chrome) view.domObserver.suppressSelectionUpdates();
25533 - return;
25534 - }
25535 - if (chrome && change.endB == change.start) view.input.lastChromeDelete = Date.now();
25536 - if (android && !inlineChange && $from.start() != $to.start() && $to.parentOffset == 0 && $from.depth == $to.depth && parse.sel && parse.sel.anchor == parse.sel.head && parse.sel.head == change.endA) {
25537 - change.endB -= 2;
25538 - $to = parse.doc.resolveNoCache(change.endB - parse.from);
25539 - setTimeout(() => {
25540 - view.someProp("handleKeyDown", function(f) {
25541 - return f(view, keyEvent(13, "Enter"));
25542 - });
25543 - }, 20);
25544 - }
25545 - let chFrom = change.start;
25546 - let chTo = change.endA;
25547 - let mkTr = (base) => {
25548 - let tr = base || view.state.tr.replace(chFrom, chTo, parse.doc.slice(change.start - parse.from, change.endB - parse.from));
25549 - if (parse.sel) {
25550 - let sel = resolveSelection(view, tr.doc, parse.sel);
25551 - if (sel && !(chrome && view.composing && sel.empty && (change.start != change.endB || view.input.lastChromeDelete < Date.now() - 100) && (sel.head == chFrom || sel.head == tr.mapping.map(chTo) - 1) || ie$1 && sel.empty && sel.head == chFrom)) tr.setSelection(sel);
25552 - }
25553 - if (compositionID) tr.setMeta("composition", compositionID);
25554 - return tr.scrollIntoView();
25555 - };
25556 - let markChange;
25557 - if (inlineChange) if ($from.pos == $to.pos) {
25558 - if (ie$1 && ie_version <= 11 && $from.parentOffset == 0) {
25559 - view.domObserver.suppressSelectionUpdates();
25560 - setTimeout(() => selectionToDOM(view), 20);
25561 - }
25562 - let tr = mkTr(view.state.tr.delete(chFrom, chTo));
25563 - let marks = doc.resolve(change.start).marksAcross(doc.resolve(change.endA));
25564 - if (marks) tr.ensureMarks(marks);
25565 - view.dispatch(tr);
25566 - } else if (change.endA == change.endB && (markChange = isMarkChange($from.parent.content.cut($from.parentOffset, $to.parentOffset), $fromA.parent.content.cut($fromA.parentOffset, change.endA - $fromA.start())))) {
25567 - let tr = mkTr(view.state.tr);
25568 - if (markChange.type == "add") tr.addMark(chFrom, chTo, markChange.mark);
25569 - else tr.removeMark(chFrom, chTo, markChange.mark);
25570 - view.dispatch(tr);
25571 - } else if ($from.parent.child($from.index()).isText && $from.index() == $to.index() - ($to.textOffset ? 0 : 1)) {
25572 - let text = $from.parent.textBetween($from.parentOffset, $to.parentOffset);
25573 - let deflt = () => mkTr(view.state.tr.insertText(text, chFrom, chTo));
25574 - if (!view.someProp("handleTextInput", (f) => f(view, chFrom, chTo, text, deflt))) view.dispatch(deflt());
25575 - } else view.dispatch(mkTr());
25576 - else view.dispatch(mkTr());
25577 - }
25578 - function resolveSelection(view, doc, parsedSel) {
25579 - if (Math.max(parsedSel.anchor, parsedSel.head) > doc.content.size) return null;
25580 - return selectionBetween(view, doc.resolve(parsedSel.anchor), doc.resolve(parsedSel.head));
25581 - }
25582 - function isMarkChange(cur, prev) {
25583 - let curMarks = cur.firstChild.marks;
25584 - let prevMarks = prev.firstChild.marks;
25585 - let added = curMarks;
25586 - let removed = prevMarks;
25587 - let type;
25588 - let mark;
25589 - let update;
25590 - for (let i = 0; i < prevMarks.length; i++) added = prevMarks[i].removeFromSet(added);
25591 - for (let i = 0; i < curMarks.length; i++) removed = curMarks[i].removeFromSet(removed);
25592 - if (added.length == 1 && removed.length == 0) {
25593 - mark = added[0];
25594 - type = "add";
25595 - update = (node) => node.mark(mark.addToSet(node.marks));
25596 - } else if (added.length == 0 && removed.length == 1) {
25597 - mark = removed[0];
25598 - type = "remove";
25599 - update = (node) => node.mark(mark.removeFromSet(node.marks));
25600 - } else return null;
25601 - let updated = [];
25602 - for (let i = 0; i < prev.childCount; i++) updated.push(update(prev.child(i)));
25603 - if (Fragment$1.from(updated).eq(cur)) return {
25604 - mark,
25605 - type
25606 - };
25607 - }
25608 - function looksLikeBackspace(old, start, end, $newStart, $newEnd) {
25609 - if (end - start <= $newEnd.pos - $newStart.pos || skipClosingAndOpening($newStart, true, false) < $newEnd.pos) return false;
25610 - let $start = old.resolve(start);
25611 - if (!$newStart.parent.isTextblock) {
25612 - let after = $start.nodeAfter;
25613 - return after != null && end == start + after.nodeSize;
25614 - }
25615 - if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock) return false;
25616 - let $next = old.resolve(skipClosingAndOpening($start, true, true));
25617 - if (!$next.parent.isTextblock || $next.pos > end || skipClosingAndOpening($next, true, false) < end) return false;
25618 - return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content);
25619 - }
25620 - function skipClosingAndOpening($pos, fromEnd, mayOpen) {
25621 - let depth = $pos.depth;
25622 - let end = fromEnd ? $pos.end() : $pos.pos;
25623 - while (depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount)) {
25624 - depth--;
25625 - end++;
25626 - fromEnd = false;
25627 - }
25628 - if (mayOpen) {
25629 - let next = $pos.node(depth).maybeChild($pos.indexAfter(depth));
25630 - while (next && !next.isLeaf) {
25631 - next = next.firstChild;
25632 - end++;
25633 - }
25634 - }
25635 - return end;
25636 - }
25637 - function findDiff(a, b, pos, preferredPos, preferredSide) {
25638 - let start = a.findDiffStart(b, pos);
25639 - if (start == null) return null;
25640 - let { a: endA, b: endB } = a.findDiffEnd(b, pos + a.size, pos + b.size);
25641 - if (preferredSide == "end") {
25642 - let adjust = Math.max(0, start - Math.min(endA, endB));
25643 - preferredPos -= endA + adjust - start;
25644 - }
25645 - if (endA < start && a.size < b.size) {
25646 - let move = preferredPos <= start && preferredPos >= endA ? start - preferredPos : 0;
25647 - start -= move;
25648 - if (start && start < b.size && isSurrogatePair(b.textBetween(start - 1, start + 1))) start += move ? 1 : -1;
25649 - endB = start + (endB - endA);
25650 - endA = start;
25651 - } else if (endB < start) {
25652 - let move = preferredPos <= start && preferredPos >= endB ? start - preferredPos : 0;
25653 - start -= move;
25654 - if (start && start < a.size && isSurrogatePair(a.textBetween(start - 1, start + 1))) start += move ? 1 : -1;
25655 - endA = start + (endA - endB);
25656 - endB = start;
25657 - }
25658 - return {
25659 - start,
25660 - endA,
25661 - endB
25662 - };
25663 - }
25664 - function isSurrogatePair(str) {
25665 - if (str.length != 2) return false;
25666 - let a = str.charCodeAt(0);
25667 - let b = str.charCodeAt(1);
25668 - return a >= 56320 && a <= 57343 && b >= 55296 && b <= 56319;
25669 - }
25670 - /**
25671 - An editor view manages the DOM structure that represents an
25672 - editable document. Its state and behavior are determined by its
25673 - [props](https://prosemirror.net/docs/ref/#view.DirectEditorProps).
25674 - */
25675 - var EditorView = class {
25676 - /**
25677 - Create a view. `place` may be a DOM node that the editor should
25678 - be appended to, a function that will place it into the document,
25679 - or an object whose `mount` property holds the node to use as the
25680 - document container. If it is `null`, the editor will not be
25681 - added to the document.
25682 - */
25683 - constructor(place, props) {
25684 - this._root = null;
25685 - /**
25686 - @internal
25687 - */
25688 - this.focused = false;
25689 - /**
25690 - Kludge used to work around a Chrome bug @internal
25691 - */
25692 - this.trackWrites = null;
25693 - this.mounted = false;
25694 - /**
25695 - @internal
25696 - */
25697 - this.markCursor = null;
25698 - /**
25699 - @internal
25700 - */
25701 - this.cursorWrapper = null;
25702 - /**
25703 - @internal
25704 - */
25705 - this.lastSelectedViewDesc = void 0;
25706 - /**
25707 - @internal
25708 - */
25709 - this.input = new InputState();
25710 - this.prevDirectPlugins = [];
25711 - this.pluginViews = [];
25712 - /**
25713 - Holds `true` when a hack node is needed in Firefox to prevent the
25714 - [space is eaten issue](https://github.com/ProseMirror/prosemirror/issues/651)
25715 - @internal
25716 - */
25717 - this.requiresGeckoHackNode = false;
25718 - /**
25719 - When editor content is being dragged, this object contains
25720 - information about the dragged slice and whether it is being
25721 - copied or moved. At any other time, it is null.
25722 - */
25723 - this.dragging = null;
25724 - this._props = props;
25725 - this.state = props.state;
25726 - this.directPlugins = props.plugins || [];
25727 - this.directPlugins.forEach(checkStateComponent);
25728 - this.dispatch = this.dispatch.bind(this);
25729 - this.dom = place && place.mount || document.createElement("div");
25730 - if (place) {
25731 - if (place.appendChild) place.appendChild(this.dom);
25732 - else if (typeof place == "function") place(this.dom);
25733 - else if (place.mount) this.mounted = true;
25734 - }
25735 - this.editable = getEditable(this);
25736 - updateCursorWrapper(this);
25737 - this.nodeViews = buildNodeViews(this);
25738 - this.docView = docViewDesc(this.state.doc, computeDocDeco(this), viewDecorations(this), this.dom, this);
25739 - this.domObserver = new DOMObserver(this, (from, to, typeOver, added) => readDOMChange(this, from, to, typeOver, added));
25740 - this.domObserver.start();
25741 - initInput(this);
25742 - this.updatePluginViews();
25743 - }
25744 - /**
25745 - Holds `true` when a
25746 - [composition](https://w3c.github.io/uievents/#events-compositionevents)
25747 - is active.
25748 - */
25749 - get composing() {
25750 - return this.input.composing;
25751 - }
25752 - /**
25753 - The view's current [props](https://prosemirror.net/docs/ref/#view.EditorProps).
25754 - */
25755 - get props() {
25756 - if (this._props.state != this.state) {
25757 - let prev = this._props;
25758 - this._props = {};
25759 - for (let name in prev) this._props[name] = prev[name];
25760 - this._props.state = this.state;
25761 - }
25762 - return this._props;
25763 - }
25764 - /**
25765 - Update the view's props. Will immediately cause an update to
25766 - the DOM.
25767 - */
25768 - update(props) {
25769 - if (props.handleDOMEvents != this._props.handleDOMEvents) ensureListeners(this);
25770 - let prevProps = this._props;
25771 - this._props = props;
25772 - if (props.plugins) {
25773 - props.plugins.forEach(checkStateComponent);
25774 - this.directPlugins = props.plugins;
25775 - }
25776 - this.updateStateInner(props.state, prevProps);
25777 - }
25778 - /**
25779 - Update the view by updating existing props object with the object
25780 - given as argument. Equivalent to `view.update(Object.assign({},
25781 - view.props, props))`.
25782 - */
25783 - setProps(props) {
25784 - let updated = {};
25785 - for (let name in this._props) updated[name] = this._props[name];
25786 - updated.state = this.state;
25787 - for (let name in props) updated[name] = props[name];
25788 - this.update(updated);
25789 - }
25790 - /**
25791 - Update the editor's `state` prop, without touching any of the
25792 - other props.
25793 - */
25794 - updateState(state) {
25795 - this.updateStateInner(state, this._props);
25796 - }
25797 - updateStateInner(state, prevProps) {
25798 - var _a;
25799 - let prev = this.state;
25800 - let redraw = false;
25801 - let updateSel = false;
25802 - if (state.storedMarks && this.composing) {
25803 - clearComposition(this);
25804 - updateSel = true;
25805 - }
25806 - this.state = state;
25807 - let pluginsChanged = prev.plugins != state.plugins || this._props.plugins != prevProps.plugins;
25808 - if (pluginsChanged || this._props.plugins != prevProps.plugins || this._props.nodeViews != prevProps.nodeViews) {
25809 - let nodeViews = buildNodeViews(this);
25810 - if (changedNodeViews(nodeViews, this.nodeViews)) {
25811 - this.nodeViews = nodeViews;
25812 - redraw = true;
25813 - }
25814 - }
25815 - if (pluginsChanged || prevProps.handleDOMEvents != this._props.handleDOMEvents) ensureListeners(this);
25816 - this.editable = getEditable(this);
25817 - updateCursorWrapper(this);
25818 - let innerDeco = viewDecorations(this);
25819 - let outerDeco = computeDocDeco(this);
25820 - let scroll = prev.plugins != state.plugins && !prev.doc.eq(state.doc) ? "reset" : state.scrollToSelection > prev.scrollToSelection ? "to selection" : "preserve";
25821 - let updateDoc = redraw || !this.docView.matchesNode(state.doc, outerDeco, innerDeco);
25822 - if (updateDoc || !state.selection.eq(prev.selection)) updateSel = true;
25823 - let oldScrollPos = scroll == "preserve" && updateSel && this.dom.style.overflowAnchor == null && storeScrollPos(this);
25824 - if (updateSel) {
25825 - this.domObserver.stop();
25826 - let forceSelUpdate = updateDoc && (ie$1 || chrome) && !this.composing && !prev.selection.empty && !state.selection.empty && selectionContextChanged(prev.selection, state.selection);
25827 - if (updateDoc) {
25828 - let chromeKludge = chrome ? this.trackWrites = this.domSelectionRange().focusNode : null;
25829 - if (this.composing) this.input.compositionNode = findCompositionNode(this);
25830 - if (redraw || !this.docView.update(state.doc, outerDeco, innerDeco, this)) {
25831 - this.docView.updateOuterDeco(outerDeco);
25832 - this.docView.destroy();
25833 - this.docView = docViewDesc(state.doc, outerDeco, innerDeco, this.dom, this);
25834 - }
25835 - if (chromeKludge && (!this.trackWrites || !this.dom.contains(this.trackWrites))) forceSelUpdate = true;
25836 - }
25837 - if (forceSelUpdate || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && anchorInRightPlace(this))) selectionToDOM(this, forceSelUpdate);
25838 - else {
25839 - syncNodeSelection(this, state.selection);
25840 - this.domObserver.setCurSelection();
25841 - }
25842 - this.domObserver.start();
25843 - }
25844 - this.updatePluginViews(prev);
25845 - if (((_a = this.dragging) === null || _a === void 0 ? void 0 : _a.node) && !prev.doc.eq(state.doc)) this.updateDraggedNode(this.dragging, prev);
25846 - if (scroll == "reset") this.dom.scrollTop = 0;
25847 - else if (scroll == "to selection") this.scrollToSelection();
25848 - else if (oldScrollPos) resetScrollPos(oldScrollPos);
25849 - }
25850 - /**
25851 - @internal
25852 - */
25853 - scrollToSelection() {
25854 - let startDOM = this.domSelectionRange().focusNode;
25855 - if (!startDOM || !this.dom.contains(startDOM.nodeType == 1 ? startDOM : startDOM.parentNode));
25856 - else if (this.someProp("handleScrollToSelection", (f) => f(this)));
25857 - else if (this.state.selection instanceof NodeSelection) {
25858 - let target = this.docView.domAfterPos(this.state.selection.from);
25859 - if (target.nodeType == 1) scrollRectIntoView(this, target.getBoundingClientRect(), startDOM);
25860 - } else scrollRectIntoView(this, this.coordsAtPos(this.state.selection.head, 1), startDOM);
25861 - }
25862 - destroyPluginViews() {
25863 - let view;
25864 - while (view = this.pluginViews.pop()) if (view.destroy) view.destroy();
25865 - }
25866 - updatePluginViews(prevState) {
25867 - if (!prevState || prevState.plugins != this.state.plugins || this.directPlugins != this.prevDirectPlugins) {
25868 - this.prevDirectPlugins = this.directPlugins;
25869 - this.destroyPluginViews();
25870 - for (let i = 0; i < this.directPlugins.length; i++) {
25871 - let plugin = this.directPlugins[i];
25872 - if (plugin.spec.view) this.pluginViews.push(plugin.spec.view(this));
25873 - }
25874 - for (let i = 0; i < this.state.plugins.length; i++) {
25875 - let plugin = this.state.plugins[i];
25876 - if (plugin.spec.view) this.pluginViews.push(plugin.spec.view(this));
25877 - }
25878 - } else for (let i = 0; i < this.pluginViews.length; i++) {
25879 - let pluginView = this.pluginViews[i];
25880 - if (pluginView.update) pluginView.update(this, prevState);
25881 - }
25882 - }
25883 - updateDraggedNode(dragging, prev) {
25884 - let sel = dragging.node;
25885 - let found = -1;
25886 - if (this.state.doc.nodeAt(sel.from) == sel.node) found = sel.from;
25887 - else {
25888 - let movedPos = sel.from + (this.state.doc.content.size - prev.doc.content.size);
25889 - if ((movedPos > 0 && this.state.doc.nodeAt(movedPos)) == sel.node) found = movedPos;
25890 - }
25891 - this.dragging = new Dragging(dragging.slice, dragging.move, found < 0 ? void 0 : NodeSelection.create(this.state.doc, found));
25892 - }
25893 - someProp(propName, f) {
25894 - let prop = this._props && this._props[propName];
25895 - let value;
25896 - if (prop != null && (value = f ? f(prop) : prop)) return value;
25897 - for (let i = 0; i < this.directPlugins.length; i++) {
25898 - let prop = this.directPlugins[i].props[propName];
25899 - if (prop != null && (value = f ? f(prop) : prop)) return value;
25900 - }
25901 - let plugins = this.state.plugins;
25902 - if (plugins) for (let i = 0; i < plugins.length; i++) {
25903 - let prop = plugins[i].props[propName];
25904 - if (prop != null && (value = f ? f(prop) : prop)) return value;
25905 - }
25906 - }
25907 - /**
25908 - Query whether the view has focus.
25909 - */
25910 - hasFocus() {
25911 - if (ie$1) {
25912 - let node = this.root.activeElement;
25913 - if (node == this.dom) return true;
25914 - if (!node || !this.dom.contains(node)) return false;
25915 - while (node && this.dom != node && this.dom.contains(node)) {
25916 - if (node.contentEditable == "false") return false;
25917 - node = node.parentElement;
25918 - }
25919 - return true;
25920 - }
25921 - return this.root.activeElement == this.dom;
25922 - }
25923 - /**
25924 - Focus the editor.
25925 - */
25926 - focus() {
25927 - this.domObserver.stop();
25928 - if (this.editable) focusPreventScroll(this.dom);
25929 - selectionToDOM(this);
25930 - this.domObserver.start();
25931 - }
25932 - /**
25933 - Get the document root in which the editor exists. This will
25934 - usually be the top-level `document`, but might be a [shadow
25935 - DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Shadow_DOM)
25936 - root if the editor is inside one.
25937 - */
25938 - get root() {
25939 - let cached = this._root;
25940 - if (cached == null) {
25941 - for (let search = this.dom.parentNode; search; search = search.parentNode) if (search.nodeType == 9 || search.nodeType == 11 && search.host) {
25942 - if (!search.getSelection) Object.getPrototypeOf(search).getSelection = () => search.ownerDocument.getSelection();
25943 - return this._root = search;
25944 - }
25945 - }
25946 - return cached || document;
25947 - }
25948 - /**
25949 - When an existing editor view is moved to a new document or
25950 - shadow tree, call this to make it recompute its root.
25951 - */
25952 - updateRoot() {
25953 - this._root = null;
25954 - }
25955 - /**
25956 - Given a pair of viewport coordinates, return the document
25957 - position that corresponds to them. May return null if the given
25958 - coordinates aren't inside of the editor. When an object is
25959 - returned, its `pos` property is the position nearest to the
25960 - coordinates, and its `inside` property holds the position of the
25961 - inner node that the position falls inside of, or -1 if it is at
25962 - the top level, not in any node.
25963 - */
25964 - posAtCoords(coords) {
25965 - return posAtCoords(this, coords);
25966 - }
25967 - /**
25968 - Returns the viewport rectangle at a given document position.
25969 - `left` and `right` will be the same number, as this returns a
25970 - flat cursor-ish rectangle. If the position is between two things
25971 - that aren't directly adjacent, `side` determines which element
25972 - is used. When < 0, the element before the position is used,
25973 - otherwise the element after.
25974 - */
25975 - coordsAtPos(pos, side = 1) {
25976 - return coordsAtPos(this, pos, side);
25977 - }
25978 - /**
25979 - Find the DOM position that corresponds to the given document
25980 - position. When `side` is negative, find the position as close as
25981 - possible to the content before the position. When positive,
25982 - prefer positions close to the content after the position. When
25983 - zero, prefer as shallow a position as possible.
25984 -
25985 - Note that you should **not** mutate the editor's internal DOM,
25986 - only inspect it (and even that is usually not necessary).
25987 - */
25988 - domAtPos(pos, side = 0) {
25989 - return this.docView.domFromPos(pos, side);
25990 - }
25991 - /**
25992 - Find the DOM node that represents the document node after the
25993 - given position. May return `null` when the position doesn't point
25994 - in front of a node or if the node is inside an opaque node view.
25995 -
25996 - This is intended to be able to call things like
25997 - `getBoundingClientRect` on that DOM node. Do **not** mutate the
25998 - editor DOM directly, or add styling this way, since that will be
25999 - immediately overriden by the editor as it redraws the node.
26000 - */
26001 - nodeDOM(pos) {
26002 - let desc = this.docView.descAt(pos);
26003 - return desc ? desc.nodeDOM : null;
26004 - }
26005 - /**
26006 - Find the document position that corresponds to a given DOM
26007 - position. (Whenever possible, it is preferable to inspect the
26008 - document structure directly, rather than poking around in the
26009 - DOM, but sometimes—for example when interpreting an event
26010 - target—you don't have a choice.)
26011 -
26012 - The `bias` parameter can be used to influence which side of a DOM
26013 - node to use when the position is inside a leaf node.
26014 - */
26015 - posAtDOM(node, offset, bias = -1) {
26016 - let pos = this.docView.posFromDOM(node, offset, bias);
26017 - if (pos == null) throw new RangeError("DOM position not inside the editor");
26018 - return pos;
26019 - }
26020 - /**
26021 - Find out whether the selection is at the end of a textblock when
26022 - moving in a given direction. When, for example, given `"left"`,
26023 - it will return true if moving left from the current cursor
26024 - position would leave that position's parent textblock. Will apply
26025 - to the view's current state by default, but it is possible to
26026 - pass a different state.
26027 - */
26028 - endOfTextblock(dir, state) {
26029 - return endOfTextblock(this, state || this.state, dir);
26030 - }
26031 - /**
26032 - Run the editor's paste logic with the given HTML string. The
26033 - `event`, if given, will be passed to the
26034 - [`handlePaste`](https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste) hook.
26035 - */
26036 - pasteHTML(html, event) {
26037 - return doPaste(this, "", html, false, event || new ClipboardEvent("paste"));
26038 - }
26039 - /**
26040 - Run the editor's paste logic with the given plain-text input.
26041 - */
26042 - pasteText(text, event) {
26043 - return doPaste(this, text, null, true, event || new ClipboardEvent("paste"));
26044 - }
26045 - /**
26046 - Serialize the given slice as it would be if it was copied from
26047 - this editor. Returns a DOM element that contains a
26048 - representation of the slice as its children, a textual
26049 - representation, and the transformed slice (which can be
26050 - different from the given input due to hooks like
26051 - [`transformCopied`](https://prosemirror.net/docs/ref/#view.EditorProps.transformCopied)).
26052 - */
26053 - serializeForClipboard(slice) {
26054 - return serializeForClipboard(this, slice);
26055 - }
26056 - /**
26057 - Removes the editor from the DOM and destroys all [node
26058 - views](https://prosemirror.net/docs/ref/#view.NodeView).
26059 - */
26060 - destroy() {
26061 - if (!this.docView) return;
26062 - destroyInput(this);
26063 - this.destroyPluginViews();
26064 - if (this.mounted) {
26065 - this.docView.update(this.state.doc, [], viewDecorations(this), this);
26066 - this.dom.textContent = "";
26067 - } else if (this.dom.parentNode) this.dom.parentNode.removeChild(this.dom);
26068 - this.docView.destroy();
26069 - this.docView = null;
26070 - clearReusedRange();
26071 - }
26072 - /**
26073 - This is true when the view has been
26074 - [destroyed](https://prosemirror.net/docs/ref/#view.EditorView.destroy) (and thus should not be
26075 - used anymore).
26076 - */
26077 - get isDestroyed() {
26078 - return this.docView == null;
26079 - }
26080 - /**
26081 - Used for testing.
26082 - */
26083 - dispatchEvent(event) {
26084 - return dispatchEvent(this, event);
26085 - }
26086 - /**
26087 - @internal
26088 - */
26089 - domSelectionRange() {
26090 - let sel = this.domSelection();
26091 - if (!sel) return {
26092 - focusNode: null,
26093 - focusOffset: 0,
26094 - anchorNode: null,
26095 - anchorOffset: 0
26096 - };
26097 - return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;
26098 - }
26099 - /**
26100 - @internal
26101 - */
26102 - domSelection() {
26103 - return this.root.getSelection();
26104 - }
26105 - };
26106 - EditorView.prototype.dispatch = function(tr) {
26107 - let dispatchTransaction = this._props.dispatchTransaction;
26108 - if (dispatchTransaction) dispatchTransaction.call(this, tr);
26109 - else this.updateState(this.state.apply(tr));
26110 - };
26111 - function computeDocDeco(view) {
26112 - let attrs = Object.create(null);
26113 - attrs.class = "ProseMirror";
26114 - attrs.contenteditable = String(view.editable);
26115 - view.someProp("attributes", (value) => {
26116 - if (typeof value == "function") value = value(view.state);
26117 - if (value) {
26118 - for (let attr in value) if (attr == "class") attrs.class += " " + value[attr];
26119 - else if (attr == "style") attrs.style = (attrs.style ? attrs.style + ";" : "") + value[attr];
26120 - else if (!attrs[attr] && attr != "contenteditable" && attr != "nodeName") attrs[attr] = String(value[attr]);
26121 - }
26122 - });
26123 - if (!attrs.translate) attrs.translate = "no";
26124 - return [Decoration.node(0, view.state.doc.content.size, attrs)];
26125 - }
26126 - function updateCursorWrapper(view) {
26127 - if (view.markCursor) {
26128 - let dom = document.createElement("img");
26129 - dom.className = "ProseMirror-separator";
26130 - dom.setAttribute("mark-placeholder", "true");
26131 - dom.setAttribute("alt", "");
26132 - view.cursorWrapper = {
26133 - dom,
26134 - deco: Decoration.widget(view.state.selection.from, dom, {
26135 - raw: true,
26136 - marks: view.markCursor
26137 - })
26138 - };
26139 - } else view.cursorWrapper = null;
26140 - }
26141 - function getEditable(view) {
26142 - return !view.someProp("editable", (value) => value(view.state) === false);
26143 - }
26144 - function selectionContextChanged(sel1, sel2) {
26145 - let depth = Math.min(sel1.$anchor.sharedDepth(sel1.head), sel2.$anchor.sharedDepth(sel2.head));
26146 - return sel1.$anchor.start(depth) != sel2.$anchor.start(depth);
26147 - }
26148 - function buildNodeViews(view) {
26149 - let result = Object.create(null);
26150 - function add(obj) {
26151 - for (let prop in obj) if (!Object.prototype.hasOwnProperty.call(result, prop)) result[prop] = obj[prop];
26152 - }
26153 - view.someProp("nodeViews", add);
26154 - view.someProp("markViews", add);
26155 - return result;
26156 - }
26157 - function changedNodeViews(a, b) {
26158 - let nA = 0;
26159 - let nB = 0;
26160 - for (let prop in a) {
26161 - if (a[prop] != b[prop]) return true;
26162 - nA++;
26163 - }
26164 - for (let _ in b) nB++;
26165 - return nA != nB;
26166 - }
26167 - function checkStateComponent(plugin) {
26168 - if (plugin.spec.state || plugin.spec.filterTransaction || plugin.spec.appendTransaction) throw new RangeError("Plugins passed directly to the view must not have a state component");
26169 - }
26170 -
26171 -//#endregion
26172 -//#region node_modules/w3c-keyname/index.js
26173 - var base = {
26174 - 8: "Backspace",
26175 - 9: "Tab",
26176 - 10: "Enter",
26177 - 12: "NumLock",
26178 - 13: "Enter",
26179 - 16: "Shift",
26180 - 17: "Control",
26181 - 18: "Alt",
26182 - 20: "CapsLock",
26183 - 27: "Escape",
26184 - 32: " ",
26185 - 33: "PageUp",
26186 - 34: "PageDown",
26187 - 35: "End",
26188 - 36: "Home",
26189 - 37: "ArrowLeft",
26190 - 38: "ArrowUp",
26191 - 39: "ArrowRight",
26192 - 40: "ArrowDown",
26193 - 44: "PrintScreen",
26194 - 45: "Insert",
26195 - 46: "Delete",
26196 - 59: ";",
26197 - 61: "=",
26198 - 91: "Meta",
26199 - 92: "Meta",
26200 - 106: "*",
26201 - 107: "+",
26202 - 108: ",",
26203 - 109: "-",
26204 - 110: ".",
26205 - 111: "/",
26206 - 144: "NumLock",
26207 - 145: "ScrollLock",
26208 - 160: "Shift",
26209 - 161: "Shift",
26210 - 162: "Control",
26211 - 163: "Control",
26212 - 164: "Alt",
26213 - 165: "Alt",
26214 - 173: "-",
26215 - 186: ";",
26216 - 187: "=",
26217 - 188: ",",
26218 - 189: "-",
26219 - 190: ".",
26220 - 191: "/",
26221 - 192: "`",
26222 - 219: "[",
26223 - 220: "\\",
26224 - 221: "]",
26225 - 222: "'"
26226 - };
26227 - var shift = {
26228 - 48: ")",
26229 - 49: "!",
26230 - 50: "@",
26231 - 51: "#",
26232 - 52: "$",
26233 - 53: "%",
26234 - 54: "^",
26235 - 55: "&",
26236 - 56: "*",
26237 - 57: "(",
26238 - 59: ":",
26239 - 61: "+",
26240 - 173: "_",
26241 - 186: ":",
26242 - 187: "+",
26243 - 188: "<",
26244 - 189: "_",
26245 - 190: ">",
26246 - 191: "?",
26247 - 192: "~",
26248 - 219: "{",
26249 - 220: "|",
26250 - 221: "}",
26251 - 222: "\""
26252 - };
26253 - var mac$1 = typeof navigator != "undefined" && /Mac/.test(navigator.platform);
26254 - var ie = typeof navigator != "undefined" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
26255 - for (var i = 0; i < 10; i++) base[48 + i] = base[96 + i] = String(i);
26256 - for (var i = 1; i <= 24; i++) base[i + 111] = "F" + i;
26257 - for (var i = 65; i <= 90; i++) {
26258 - base[i] = String.fromCharCode(i + 32);
26259 - shift[i] = String.fromCharCode(i);
26260 - }
26261 - for (var code in base) if (!shift.hasOwnProperty(code)) shift[code] = base[code];
26262 - function keyName(event) {
26263 - var name = !(mac$1 && event.metaKey && event.shiftKey && !event.ctrlKey && !event.altKey || ie && event.shiftKey && event.key && event.key.length == 1 || event.key == "Unidentified") && event.key || (event.shiftKey ? shift : base)[event.keyCode] || event.key || "Unidentified";
26264 - if (name == "Esc") name = "Escape";
26265 - if (name == "Del") name = "Delete";
26266 - if (name == "Left") name = "ArrowLeft";
26267 - if (name == "Up") name = "ArrowUp";
26268 - if (name == "Right") name = "ArrowRight";
26269 - if (name == "Down") name = "ArrowDown";
26270 - return name;
26271 - }
26272 -
26273 -//#endregion
26274 -//#region node_modules/prosemirror-keymap/dist/index.js
26275 - var mac = typeof navigator != "undefined" && /Mac|iP(hone|[oa]d)/.test(navigator.platform);
26276 - var windows = typeof navigator != "undefined" && /Win/.test(navigator.platform);
26277 - function normalizeKeyName$1(name) {
26278 - let parts = name.split(/-(?!$)/);
26279 - let result = parts[parts.length - 1];
26280 - if (result == "Space") result = " ";
26281 - let alt;
26282 - let ctrl;
26283 - let shift;
26284 - let meta;
26285 - for (let i = 0; i < parts.length - 1; i++) {
26286 - let mod = parts[i];
26287 - if (/^(cmd|meta|m)$/i.test(mod)) meta = true;
26288 - else if (/^a(lt)?$/i.test(mod)) alt = true;
26289 - else if (/^(c|ctrl|control)$/i.test(mod)) ctrl = true;
26290 - else if (/^s(hift)?$/i.test(mod)) shift = true;
26291 - else if (/^mod$/i.test(mod)) if (mac) meta = true;
26292 - else ctrl = true;
26293 - else throw new Error("Unrecognized modifier name: " + mod);
26294 - }
26295 - if (alt) result = "Alt-" + result;
26296 - if (ctrl) result = "Ctrl-" + result;
26297 - if (meta) result = "Meta-" + result;
26298 - if (shift) result = "Shift-" + result;
26299 - return result;
26300 - }
26301 - __name(normalizeKeyName$1, "normalizeKeyName");
26302 - function normalize(map) {
26303 - let copy = Object.create(null);
26304 - for (let prop in map) copy[normalizeKeyName$1(prop)] = map[prop];
26305 - return copy;
26306 - }
26307 - function modifiers(name, event, shift = true) {
26308 - if (event.altKey) name = "Alt-" + name;
26309 - if (event.ctrlKey) name = "Ctrl-" + name;
26310 - if (event.metaKey) name = "Meta-" + name;
26311 - if (shift && event.shiftKey) name = "Shift-" + name;
26312 - return name;
26313 - }
26314 - /**
26315 - Create a keymap plugin for the given set of bindings.
26316 -
26317 - Bindings should map key names to [command](https://prosemirror.net/docs/ref/#commands)-style
26318 - functions, which will be called with `(EditorState, dispatch,
26319 - EditorView)` arguments, and should return true when they've handled
26320 - the key. Note that the view argument isn't part of the command
26321 - protocol, but can be used as an escape hatch if a binding needs to
26322 - directly interact with the UI.
26323 -
26324 - Key names may be strings like `"Shift-Ctrl-Enter"`—a key
26325 - identifier prefixed with zero or more modifiers. Key identifiers
26326 - are based on the strings that can appear in
26327 - [`KeyEvent.key`](https:developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).
26328 - Use lowercase letters to refer to letter keys (or uppercase letters
26329 - if you want shift to be held). You may use `"Space"` as an alias
26330 - for the `" "` name.
26331 -
26332 - Modifiers can be given in any order. `Shift-` (or `s-`), `Alt-` (or
26333 - `a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or
26334 - `Meta-`) are recognized. For characters that are created by holding
26335 - shift, the `Shift-` prefix is implied, and should not be added
26336 - explicitly.
26337 -
26338 - You can use `Mod-` as a shorthand for `Cmd-` on Mac and `Ctrl-` on
26339 - other platforms.
26340 -
26341 - You can add multiple keymap plugins to an editor. The order in
26342 - which they appear determines their precedence (the ones early in
26343 - the array get to dispatch first).
26344 - */
26345 - function keymap(bindings) {
26346 - return new Plugin({ props: { handleKeyDown: keydownHandler(bindings) } });
26347 - }
26348 - /**
26349 - Given a set of bindings (using the same format as
26350 - [`keymap`](https://prosemirror.net/docs/ref/#keymap.keymap)), return a [keydown
26351 - handler](https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown) that handles them.
26352 - */
26353 - function keydownHandler(bindings) {
26354 - let map = normalize(bindings);
26355 - return function(view, event) {
26356 - let name = keyName(event);
26357 - let baseName;
26358 - let direct = map[modifiers(name, event)];
26359 - if (direct && direct(view.state, view.dispatch, view)) return true;
26360 - if (name.length == 1 && name != " ") {
26361 - if (event.shiftKey) {
26362 - let noShift = map[modifiers(name, event, false)];
26363 - if (noShift && noShift(view.state, view.dispatch, view)) return true;
26364 - }
26365 - if ((event.altKey || event.metaKey || event.ctrlKey) && !(windows && event.ctrlKey && event.altKey) && (baseName = base[event.keyCode]) && baseName != name) {
26366 - let fromCode = map[modifiers(baseName, event)];
26367 - if (fromCode && fromCode(view.state, view.dispatch, view)) return true;
26368 - }
26369 - }
26370 - return false;
26371 - };
26372 - }
26373 -
26374 -//#endregion
26375 -//#region node_modules/@tiptap/core/dist/index.js
26376 - var __defProp = Object.defineProperty;
26377 - var __export = (target, all) => {
26378 - for (var name in all) __defProp(target, name, {
26379 - get: all[name],
26380 - enumerable: true
26381 - });
26382 - };
26383 - function createChainableState(config) {
26384 - const { state, transaction } = config;
26385 - let { selection } = transaction;
26386 - let { doc } = transaction;
26387 - let { storedMarks } = transaction;
26388 - return {
26389 - ...state,
26390 - apply: state.apply.bind(state),
26391 - applyTransaction: state.applyTransaction.bind(state),
26392 - plugins: state.plugins,
26393 - schema: state.schema,
26394 - reconfigure: state.reconfigure.bind(state),
26395 - toJSON: state.toJSON.bind(state),
26396 - get storedMarks() {
26397 - return storedMarks;
26398 - },
26399 - get selection() {
26400 - return selection;
26401 - },
26402 - get doc() {
26403 - return doc;
26404 - },
26405 - get tr() {
26406 - selection = transaction.selection;
26407 - doc = transaction.doc;
26408 - storedMarks = transaction.storedMarks;
26409 - return transaction;
26410 - }
26411 - };
26412 - }
26413 - var CommandManager = class {
26414 - constructor(props) {
26415 - this.editor = props.editor;
26416 - this.rawCommands = this.editor.extensionManager.commands;
26417 - this.customState = props.state;
26418 - }
26419 - get hasCustomState() {
26420 - return !!this.customState;
26421 - }
26422 - get state() {
26423 - return this.customState || this.editor.state;
26424 - }
26425 - get commands() {
26426 - const { rawCommands, editor, state } = this;
26427 - const { view } = editor;
26428 - const { tr } = state;
26429 - const props = this.buildProps(tr);
26430 - return Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
26431 - const method = (...args) => {
26432 - const callback = command2(...args)(props);
26433 - if (!tr.getMeta("preventDispatch") && !this.hasCustomState) view.dispatch(tr);
26434 - return callback;
26435 - };
26436 - return [name, method];
26437 - }));
26438 - }
26439 - get chain() {
26440 - return () => this.createChain();
26441 - }
26442 - get can() {
26443 - return () => this.createCan();
26444 - }
26445 - createChain(startTr, shouldDispatch = true) {
26446 - const { rawCommands, editor, state } = this;
26447 - const { view } = editor;
26448 - const callbacks = [];
26449 - const hasStartTransaction = !!startTr;
26450 - const tr = startTr || state.tr;
26451 - const run3 = () => {
26452 - if (!hasStartTransaction && shouldDispatch && !tr.getMeta("preventDispatch") && !this.hasCustomState) view.dispatch(tr);
26453 - return callbacks.every((callback) => callback === true);
26454 - };
26455 - const chain = {
26456 - ...Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
26457 - const chainedCommand = (...args) => {
26458 - const props = this.buildProps(tr, shouldDispatch);
26459 - const callback = command2(...args)(props);
26460 - callbacks.push(callback);
26461 - return chain;
26462 - };
26463 - return [name, chainedCommand];
26464 - })),
26465 - run: run3
26466 - };
26467 - return chain;
26468 - }
26469 - createCan(startTr) {
26470 - const { rawCommands, state } = this;
26471 - const dispatch = false;
26472 - const tr = startTr || state.tr;
26473 - const props = this.buildProps(tr, dispatch);
26474 - return {
26475 - ...Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
26476 - return [name, (...args) => command2(...args)({
26477 - ...props,
26478 - dispatch: void 0
26479 - })];
26480 - })),
26481 - chain: () => this.createChain(tr, dispatch)
26482 - };
26483 - }
26484 - buildProps(tr, shouldDispatch = true) {
26485 - const { rawCommands, editor, state } = this;
26486 - const { view } = editor;
26487 - const props = {
26488 - tr,
26489 - editor,
26490 - view,
26491 - state: createChainableState({
26492 - state,
26493 - transaction: tr
26494 - }),
26495 - dispatch: shouldDispatch ? () => void 0 : void 0,
26496 - chain: () => this.createChain(tr, shouldDispatch),
26497 - can: () => this.createCan(tr),
26498 - get commands() {
26499 - return Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
26500 - return [name, (...args) => command2(...args)(props)];
26501 - }));
26502 - }
26503 - };
26504 - return props;
26505 - }
26506 - };
26507 - var commands_exports = {};
26508 - __export(commands_exports, {
26509 - blur: () => blur,
26510 - clearContent: () => clearContent,
26511 - clearNodes: () => clearNodes,
26512 - command: () => command,
26513 - createParagraphNear: () => createParagraphNear,
26514 - cut: () => cut,
26515 - deleteCurrentNode: () => deleteCurrentNode,
26516 - deleteNode: () => deleteNode,
26517 - deleteRange: () => deleteRange,
26518 - deleteSelection: () => deleteSelection,
26519 - enter: () => enter,
26520 - exitCode: () => exitCode,
26521 - extendMarkRange: () => extendMarkRange,
26522 - first: () => first,
26523 - focus: () => focus,
26524 - forEach: () => forEach,
26525 - insertContent: () => insertContent,
26526 - insertContentAt: () => insertContentAt,
26527 - joinBackward: () => joinBackward,
26528 - joinDown: () => joinDown,
26529 - joinForward: () => joinForward,
26530 - joinItemBackward: () => joinItemBackward,
26531 - joinItemForward: () => joinItemForward,
26532 - joinTextblockBackward: () => joinTextblockBackward,
26533 - joinTextblockForward: () => joinTextblockForward,
26534 - joinUp: () => joinUp,
26535 - keyboardShortcut: () => keyboardShortcut,
26536 - lift: () => lift,
26537 - liftEmptyBlock: () => liftEmptyBlock,
26538 - liftListItem: () => liftListItem,
26539 - newlineInCode: () => newlineInCode,
26540 - resetAttributes: () => resetAttributes,
26541 - scrollIntoView: () => scrollIntoView,
26542 - selectAll: () => selectAll,
26543 - selectNodeBackward: () => selectNodeBackward,
26544 - selectNodeForward: () => selectNodeForward,
26545 - selectParentNode: () => selectParentNode,
26546 - selectTextblockEnd: () => selectTextblockEnd,
26547 - selectTextblockStart: () => selectTextblockStart,
26548 - setContent: () => setContent,
26549 - setMark: () => setMark,
26550 - setMeta: () => setMeta,
26551 - setNode: () => setNode,
26552 - setNodeSelection: () => setNodeSelection,
26553 - setTextDirection: () => setTextDirection,
26554 - setTextSelection: () => setTextSelection,
26555 - sinkListItem: () => sinkListItem,
26556 - splitBlock: () => splitBlock,
26557 - splitListItem: () => splitListItem,
26558 - toggleList: () => toggleList,
26559 - toggleMark: () => toggleMark,
26560 - toggleNode: () => toggleNode,
26561 - toggleWrap: () => toggleWrap,
26562 - undoInputRule: () => undoInputRule,
26563 - unsetAllMarks: () => unsetAllMarks,
26564 - unsetMark: () => unsetMark,
26565 - unsetTextDirection: () => unsetTextDirection,
26566 - updateAttributes: () => updateAttributes,
26567 - wrapIn: () => wrapIn,
26568 - wrapInList: () => wrapInList
26569 - });
26570 - var blur = () => ({ editor, view }) => {
26571 - requestAnimationFrame(() => {
26572 - var _a;
26573 - if (!editor.isDestroyed) {
26574 - view.dom.blur();
26575 - (_a = window == null ? void 0 : window.getSelection()) == null || _a.removeAllRanges();
26576 - }
26577 - });
26578 - return true;
26579 - };
26580 - var clearContent = (emitUpdate = true) => ({ commands }) => {
26581 - return commands.setContent("", { emitUpdate });
26582 - };
26583 - var clearNodes = () => ({ state, tr, dispatch }) => {
26584 - const { selection } = tr;
26585 - const { ranges } = selection;
26586 - if (!dispatch) return true;
26587 - ranges.forEach(({ $from, $to }) => {
26588 - state.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {
26589 - if (node.type.isText) return;
26590 - const { doc, mapping } = tr;
26591 - const $mappedFrom = doc.resolve(mapping.map(pos));
26592 - const $mappedTo = doc.resolve(mapping.map(pos + node.nodeSize));
26593 - const nodeRange = $mappedFrom.blockRange($mappedTo);
26594 - if (!nodeRange) return;
26595 - const targetLiftDepth = liftTarget(nodeRange);
26596 - if (node.type.isTextblock) {
26597 - const { defaultType } = $mappedFrom.parent.contentMatchAt($mappedFrom.index());
26598 - tr.setNodeMarkup(nodeRange.start, defaultType);
26599 - }
26600 - if (targetLiftDepth || targetLiftDepth === 0) tr.lift(nodeRange, targetLiftDepth);
26601 - });
26602 - });
26603 - return true;
26604 - };
26605 - var command = (fn) => (props) => {
26606 - return fn(props);
26607 - };
26608 - var createParagraphNear = () => ({ state, dispatch }) => {
26609 - return createParagraphNear$1(state, dispatch);
26610 - };
26611 - var cut = (originRange, targetPos) => ({ editor, tr }) => {
26612 - const { state } = editor;
26613 - const contentSlice = state.doc.slice(originRange.from, originRange.to);
26614 - tr.deleteRange(originRange.from, originRange.to);
26615 - const newPos = tr.mapping.map(targetPos);
26616 - tr.insert(newPos, contentSlice.content);
26617 - tr.setSelection(new TextSelection(tr.doc.resolve(Math.max(newPos - 1, 0))));
26618 - return true;
26619 - };
26620 - var deleteCurrentNode = () => ({ tr, dispatch }) => {
26621 - const { selection } = tr;
26622 - const currentNode = selection.$anchor.node();
26623 - if (currentNode.content.size > 0) return false;
26624 - const $pos = tr.selection.$anchor;
26625 - for (let depth = $pos.depth; depth > 0; depth -= 1) if ($pos.node(depth).type === currentNode.type) {
26626 - if (dispatch) {
26627 - const from = $pos.before(depth);
26628 - const to = $pos.after(depth);
26629 - tr.delete(from, to).scrollIntoView();
26630 - }
26631 - return true;
26632 - }
26633 - return false;
26634 - };
26635 - function getNodeType(nameOrType, schema) {
26636 - if (typeof nameOrType === "string") {
26637 - if (!schema.nodes[nameOrType]) throw Error(`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`);
26638 - return schema.nodes[nameOrType];
26639 - }
26640 - return nameOrType;
26641 - }
26642 - var deleteNode = (typeOrName) => ({ tr, state, dispatch }) => {
26643 - const type = getNodeType(typeOrName, state.schema);
26644 - const $pos = tr.selection.$anchor;
26645 - for (let depth = $pos.depth; depth > 0; depth -= 1) if ($pos.node(depth).type === type) {
26646 - if (dispatch) {
26647 - const from = $pos.before(depth);
26648 - const to = $pos.after(depth);
26649 - tr.delete(from, to).scrollIntoView();
26650 - }
26651 - return true;
26652 - }
26653 - return false;
26654 - };
26655 - var deleteRange = (range) => ({ tr, dispatch }) => {
26656 - const { from, to } = range;
26657 - if (dispatch) tr.delete(from, to);
26658 - return true;
26659 - };
26660 - var deleteSelection = () => ({ state, dispatch }) => {
26661 - return deleteSelection$1(state, dispatch);
26662 - };
26663 - var enter = () => ({ commands }) => {
26664 - return commands.keyboardShortcut("Enter");
26665 - };
26666 - var exitCode = () => ({ state, dispatch }) => {
26667 - return exitCode$1(state, dispatch);
26668 - };
26669 - function isRegExp(value) {
26670 - return Object.prototype.toString.call(value) === "[object RegExp]";
26671 - }
26672 - function objectIncludes(object1, object2, options = { strict: true }) {
26673 - const keys = Object.keys(object2);
26674 - if (!keys.length) return true;
26675 - return keys.every((key) => {
26676 - if (options.strict) return object2[key] === object1[key];
26677 - if (isRegExp(object2[key])) return object2[key].test(object1[key]);
26678 - return object2[key] === object1[key];
26679 - });
26680 - }
26681 - function findMarkInSet(marks, type, attributes = {}) {
26682 - return marks.find((item) => {
26683 - return item.type === type && objectIncludes(Object.fromEntries(Object.keys(attributes).map((k) => [k, item.attrs[k]])), attributes);
26684 - });
26685 - }
26686 - function isMarkInSet(marks, type, attributes = {}) {
26687 - return !!findMarkInSet(marks, type, attributes);
26688 - }
26689 - function getMarkRange($pos, type, attributes) {
26690 - var _a;
26691 - if (!$pos || !type) return;
26692 - let start = $pos.parent.childAfter($pos.parentOffset);
26693 - if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) start = $pos.parent.childBefore($pos.parentOffset);
26694 - if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) return;
26695 - attributes = attributes || ((_a = start.node.marks[0]) == null ? void 0 : _a.attrs);
26696 - if (!findMarkInSet([...start.node.marks], type, attributes)) return;
26697 - let startIndex = start.index;
26698 - let startPos = $pos.start() + start.offset;
26699 - let endIndex = startIndex + 1;
26700 - let endPos = startPos + start.node.nodeSize;
26701 - while (startIndex > 0 && isMarkInSet([...$pos.parent.child(startIndex - 1).marks], type, attributes)) {
26702 - startIndex -= 1;
26703 - startPos -= $pos.parent.child(startIndex).nodeSize;
26704 - }
26705 - while (endIndex < $pos.parent.childCount && isMarkInSet([...$pos.parent.child(endIndex).marks], type, attributes)) {
26706 - endPos += $pos.parent.child(endIndex).nodeSize;
26707 - endIndex += 1;
26708 - }
26709 - return {
26710 - from: startPos,
26711 - to: endPos
26712 - };
26713 - }
26714 - function getMarkType(nameOrType, schema) {
26715 - if (typeof nameOrType === "string") {
26716 - if (!schema.marks[nameOrType]) throw Error(`There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`);
26717 - return schema.marks[nameOrType];
26718 - }
26719 - return nameOrType;
26720 - }
26721 - var extendMarkRange = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
26722 - const type = getMarkType(typeOrName, state.schema);
26723 - const { doc, selection } = tr;
26724 - const { $from, from, to } = selection;
26725 - if (dispatch) {
26726 - const range = getMarkRange($from, type, attributes);
26727 - if (range && range.from <= from && range.to >= to) {
26728 - const newSelection = TextSelection.create(doc, range.from, range.to);
26729 - tr.setSelection(newSelection);
26730 - }
26731 - }
26732 - return true;
26733 - };
26734 - var first = (commands) => (props) => {
26735 - const items = typeof commands === "function" ? commands(props) : commands;
26736 - for (let i = 0; i < items.length; i += 1) if (items[i](props)) return true;
26737 - return false;
26738 - };
26739 - function isTextSelection(value) {
26740 - return value instanceof TextSelection;
26741 - }
26742 - function minMax(value = 0, min = 0, max = 0) {
26743 - return Math.min(Math.max(value, min), max);
26744 - }
26745 - function resolveFocusPosition(doc, position = null) {
26746 - if (!position) return null;
26747 - const selectionAtStart = Selection.atStart(doc);
26748 - const selectionAtEnd = Selection.atEnd(doc);
26749 - if (position === "start" || position === true) return selectionAtStart;
26750 - if (position === "end") return selectionAtEnd;
26751 - const minPos = selectionAtStart.from;
26752 - const maxPos = selectionAtEnd.to;
26753 - if (position === "all") return TextSelection.create(doc, minMax(0, minPos, maxPos), minMax(doc.content.size, minPos, maxPos));
26754 - return TextSelection.create(doc, minMax(position, minPos, maxPos), minMax(position, minPos, maxPos));
26755 - }
26756 - function isAndroid() {
26757 - return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
26758 - }
26759 - function isiOS() {
26760 - return [
26761 - "iPad Simulator",
26762 - "iPhone Simulator",
26763 - "iPod Simulator",
26764 - "iPad",
26765 - "iPhone",
26766 - "iPod"
26767 - ].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
26768 - }
26769 - function isSafari() {
26770 - return typeof navigator !== "undefined" ? /^((?!chrome|android).)*safari/i.test(navigator.userAgent) : false;
26771 - }
26772 - var focus = (position = null, options = {}) => ({ editor, view, tr, dispatch }) => {
26773 - options = {
26774 - scrollIntoView: true,
26775 - ...options
26776 - };
26777 - const delayedFocus = () => {
26778 - if (isiOS() || isAndroid()) view.dom.focus();
26779 - if (isSafari() && !isiOS() && !isAndroid()) view.dom.focus({ preventScroll: true });
26780 - requestAnimationFrame(() => {
26781 - if (!editor.isDestroyed) {
26782 - view.focus();
26783 - if (options == null ? void 0 : options.scrollIntoView) editor.commands.scrollIntoView();
26784 - }
26785 - });
26786 - };
26787 - try {
26788 - if (view.hasFocus() && position === null || position === false) return true;
26789 - } catch {
26790 - return false;
26791 - }
26792 - if (dispatch && position === null && !isTextSelection(editor.state.selection)) {
26793 - delayedFocus();
26794 - return true;
26795 - }
26796 - const selection = resolveFocusPosition(tr.doc, position) || editor.state.selection;
26797 - const isSameSelection = editor.state.selection.eq(selection);
26798 - if (dispatch) {
26799 - if (!isSameSelection) tr.setSelection(selection);
26800 - if (isSameSelection && tr.storedMarks) tr.setStoredMarks(tr.storedMarks);
26801 - delayedFocus();
26802 - }
26803 - return true;
26804 - };
26805 - var forEach = (items, fn) => (props) => {
26806 - return items.every((item, index) => fn(item, {
26807 - ...props,
26808 - index
26809 - }));
26810 - };
26811 - var insertContent = (value, options) => ({ tr, commands }) => {
26812 - return commands.insertContentAt({
26813 - from: tr.selection.from,
26814 - to: tr.selection.to
26815 - }, value, options);
26816 - };
26817 - var removeWhitespaces = (node) => {
26818 - const children = node.childNodes;
26819 - for (let i = children.length - 1; i >= 0; i -= 1) {
26820 - const child = children[i];
26821 - if (child.nodeType === 3 && child.nodeValue && /^(\n\s\s|\n)$/.test(child.nodeValue)) node.removeChild(child);
26822 - else if (child.nodeType === 1) removeWhitespaces(child);
26823 - }
26824 - return node;
26825 - };
26826 - function elementFromString(value) {
26827 - if (typeof window === "undefined") throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");
26828 - const wrappedValue = `<body>${value}</body>`;
26829 - const html = new window.DOMParser().parseFromString(wrappedValue, "text/html").body;
26830 - return removeWhitespaces(html);
26831 - }
26832 - function createNodeFromContent(content, schema, options) {
26833 - if (content instanceof Node || content instanceof Fragment$1) return content;
26834 - options = {
26835 - slice: true,
26836 - parseOptions: {},
26837 - ...options
26838 - };
26839 - const isJSONContent = typeof content === "object" && content !== null;
26840 - const isTextContent = typeof content === "string";
26841 - if (isJSONContent) try {
26842 - if (Array.isArray(content) && content.length > 0) return Fragment$1.fromArray(content.map((item) => schema.nodeFromJSON(item)));
26843 - const node = schema.nodeFromJSON(content);
26844 - if (options.errorOnInvalidContent) node.check();
26845 - return node;
26846 - } catch (error) {
26847 - if (options.errorOnInvalidContent) throw new Error("[tiptap error]: Invalid JSON content", { cause: error });
26848 - console.warn("[tiptap warn]: Invalid content.", "Passed value:", content, "Error:", error);
26849 - return createNodeFromContent("", schema, options);
26850 - }
26851 - if (isTextContent) {
26852 - if (options.errorOnInvalidContent) {
26853 - let hasInvalidContent = false;
26854 - let invalidContent = "";
26855 - const contentCheckSchema = new Schema({
26856 - topNode: schema.spec.topNode,
26857 - marks: schema.spec.marks,
26858 - nodes: schema.spec.nodes.append({ __tiptap__private__unknown__catch__all__node: {
26859 - content: "inline*",
26860 - group: "block",
26861 - parseDOM: [{
26862 - tag: "*",
26863 - getAttrs: (e) => {
26864 - hasInvalidContent = true;
26865 - invalidContent = typeof e === "string" ? e : e.outerHTML;
26866 - return null;
26867 - }
26868 - }]
26869 - } })
26870 - });
26871 - if (options.slice) DOMParser$1.fromSchema(contentCheckSchema).parseSlice(elementFromString(content), options.parseOptions);
26872 - else DOMParser$1.fromSchema(contentCheckSchema).parse(elementFromString(content), options.parseOptions);
26873 - if (options.errorOnInvalidContent && hasInvalidContent) throw new Error("[tiptap error]: Invalid HTML content", { cause: /* @__PURE__ */ new Error(`Invalid element found: ${invalidContent}`) });
26874 - }
26875 - const parser = DOMParser$1.fromSchema(schema);
26876 - if (options.slice) return parser.parseSlice(elementFromString(content), options.parseOptions).content;
26877 - return parser.parse(elementFromString(content), options.parseOptions);
26878 - }
26879 - return createNodeFromContent("", schema, options);
26880 - }
26881 - function selectionToInsertionEnd(tr, startLen, bias) {
26882 - const last = tr.steps.length - 1;
26883 - if (last < startLen) return;
26884 - const step = tr.steps[last];
26885 - if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) return;
26886 - const map = tr.mapping.maps[last];
26887 - let end = 0;
26888 - map.forEach((_from, _to, _newFrom, newTo) => {
26889 - if (end === 0) end = newTo;
26890 - });
26891 - tr.setSelection(Selection.near(tr.doc.resolve(end), bias));
26892 - }
26893 - var isFragment = (nodeOrFragment) => {
26894 - return !("type" in nodeOrFragment);
26895 - };
26896 - var insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {
26897 - var _a;
26898 - if (dispatch) {
26899 - options = {
26900 - parseOptions: editor.options.parseOptions,
26901 - updateSelection: true,
26902 - applyInputRules: false,
26903 - applyPasteRules: false,
26904 - ...options
26905 - };
26906 - let content;
26907 - const emitContentError = (error) => {
26908 - editor.emit("contentError", {
26909 - editor,
26910 - error,
26911 - disableCollaboration: () => {
26912 - if ("collaboration" in editor.storage && typeof editor.storage.collaboration === "object" && editor.storage.collaboration) editor.storage.collaboration.isDisabled = true;
26913 - }
26914 - });
26915 - };
26916 - const parseOptions = {
26917 - preserveWhitespace: "full",
26918 - ...options.parseOptions
26919 - };
26920 - if (!options.errorOnInvalidContent && !editor.options.enableContentCheck && editor.options.emitContentError) try {
26921 - createNodeFromContent(value, editor.schema, {
26922 - parseOptions,
26923 - errorOnInvalidContent: true
26924 - });
26925 - } catch (e) {
26926 - emitContentError(e);
26927 - }
26928 - try {
26929 - content = createNodeFromContent(value, editor.schema, {
26930 - parseOptions,
26931 - errorOnInvalidContent: (_a = options.errorOnInvalidContent) != null ? _a : editor.options.enableContentCheck
26932 - });
26933 - } catch (e) {
26934 - emitContentError(e);
26935 - return false;
26936 - }
26937 - let { from, to } = typeof position === "number" ? {
26938 - from: position,
26939 - to: position
26940 - } : {
26941 - from: position.from,
26942 - to: position.to
26943 - };
26944 - let isOnlyTextContent = true;
26945 - let isOnlyBlockContent = true;
26946 - (isFragment(content) ? content : [content]).forEach((node) => {
26947 - node.check();
26948 - isOnlyTextContent = isOnlyTextContent ? node.isText && node.marks.length === 0 : false;
26949 - isOnlyBlockContent = isOnlyBlockContent ? node.isBlock : false;
26950 - });
26951 - if (from === to && isOnlyBlockContent) {
26952 - const { parent } = tr.doc.resolve(from);
26953 - if (parent.isTextblock && !parent.type.spec.code && !parent.childCount) {
26954 - from -= 1;
26955 - to += 1;
26956 - }
26957 - }
26958 - let newContent;
26959 - if (isOnlyTextContent) {
26960 - if (Array.isArray(value)) newContent = value.map((v) => v.text || "").join("");
26961 - else if (value instanceof Fragment$1) {
26962 - let text = "";
26963 - value.forEach((node) => {
26964 - if (node.text) text += node.text;
26965 - });
26966 - newContent = text;
26967 - } else if (typeof value === "object" && !!value && !!value.text) newContent = value.text;
26968 - else newContent = value;
26969 - tr.insertText(newContent, from, to);
26970 - } else {
26971 - newContent = content;
26972 - const $from = tr.doc.resolve(from);
26973 - const $fromNode = $from.node();
26974 - const fromSelectionAtStart = $from.parentOffset === 0;
26975 - const isTextSelection2 = $fromNode.isText || $fromNode.isTextblock;
26976 - const hasContent = $fromNode.content.size > 0;
26977 - if (fromSelectionAtStart && isTextSelection2 && hasContent) from = Math.max(0, from - 1);
26978 - tr.replaceWith(from, to, newContent);
26979 - }
26980 - if (options.updateSelection) selectionToInsertionEnd(tr, tr.steps.length - 1, -1);
26981 - if (options.applyInputRules) tr.setMeta("applyInputRules", {
26982 - from,
26983 - text: newContent
26984 - });
26985 - if (options.applyPasteRules) tr.setMeta("applyPasteRules", {
26986 - from,
26987 - text: newContent
26988 - });
26989 - }
26990 - return true;
26991 - };
26992 - var joinUp = () => ({ state, dispatch }) => {
26993 - return joinUp$1(state, dispatch);
26994 - };
26995 - var joinDown = () => ({ state, dispatch }) => {
26996 - return joinDown$1(state, dispatch);
26997 - };
26998 - var joinBackward = () => ({ state, dispatch }) => {
26999 - return joinBackward$1(state, dispatch);
27000 - };
27001 - var joinForward = () => ({ state, dispatch }) => {
27002 - return joinForward$1(state, dispatch);
27003 - };
27004 - var joinItemBackward = () => ({ state, dispatch, tr }) => {
27005 - try {
27006 - const point = joinPoint(state.doc, state.selection.$from.pos, -1);
27007 - if (point === null || point === void 0) return false;
27008 - tr.join(point, 2);
27009 - if (dispatch) dispatch(tr);
27010 - return true;
27011 - } catch {
27012 - return false;
27013 - }
27014 - };
27015 - var joinItemForward = () => ({ state, dispatch, tr }) => {
27016 - try {
27017 - const point = joinPoint(state.doc, state.selection.$from.pos, 1);
27018 - if (point === null || point === void 0) return false;
27019 - tr.join(point, 2);
27020 - if (dispatch) dispatch(tr);
27021 - return true;
27022 - } catch {
27023 - return false;
27024 - }
27025 - };
27026 - var joinTextblockBackward = () => ({ state, dispatch }) => {
27027 - return joinTextblockBackward$1(state, dispatch);
27028 - };
27029 - var joinTextblockForward = () => ({ state, dispatch }) => {
27030 - return joinTextblockForward$1(state, dispatch);
27031 - };
27032 - function isMacOS() {
27033 - return typeof navigator !== "undefined" ? /Mac/.test(navigator.platform) : false;
27034 - }
27035 - function normalizeKeyName(name) {
27036 - const parts = name.split(/-(?!$)/);
27037 - let result = parts[parts.length - 1];
27038 - if (result === "Space") result = " ";
27039 - let alt;
27040 - let ctrl;
27041 - let shift;
27042 - let meta;
27043 - for (let i = 0; i < parts.length - 1; i += 1) {
27044 - const mod = parts[i];
27045 - if (/^(cmd|meta|m)$/i.test(mod)) meta = true;
27046 - else if (/^a(lt)?$/i.test(mod)) alt = true;
27047 - else if (/^(c|ctrl|control)$/i.test(mod)) ctrl = true;
27048 - else if (/^s(hift)?$/i.test(mod)) shift = true;
27049 - else if (/^mod$/i.test(mod)) if (isiOS() || isMacOS()) meta = true;
27050 - else ctrl = true;
27051 - else throw new Error(`Unrecognized modifier name: ${mod}`);
27052 - }
27053 - if (alt) result = `Alt-${result}`;
27054 - if (ctrl) result = `Ctrl-${result}`;
27055 - if (meta) result = `Meta-${result}`;
27056 - if (shift) result = `Shift-${result}`;
27057 - return result;
27058 - }
27059 - var keyboardShortcut = (name) => ({ editor, view, tr, dispatch }) => {
27060 - const keys = normalizeKeyName(name).split(/-(?!$)/);
27061 - const key = keys.find((item) => ![
27062 - "Alt",
27063 - "Ctrl",
27064 - "Meta",
27065 - "Shift"
27066 - ].includes(item));
27067 - const event = new KeyboardEvent("keydown", {
27068 - key: key === "Space" ? " " : key,
27069 - altKey: keys.includes("Alt"),
27070 - ctrlKey: keys.includes("Ctrl"),
27071 - metaKey: keys.includes("Meta"),
27072 - shiftKey: keys.includes("Shift"),
27073 - bubbles: true,
27074 - cancelable: true
27075 - });
27076 - editor.captureTransaction(() => {
27077 - view.someProp("handleKeyDown", (f) => f(view, event));
27078 - })?.steps.forEach((step) => {
27079 - const newStep = step.map(tr.mapping);
27080 - if (newStep && dispatch) tr.maybeStep(newStep);
27081 - });
27082 - return true;
27083 - };
27084 - function isNodeActive(state, typeOrName, attributes = {}) {
27085 - const { from, to, empty } = state.selection;
27086 - const type = typeOrName ? getNodeType(typeOrName, state.schema) : null;
27087 - const nodeRanges = [];
27088 - state.doc.nodesBetween(from, to, (node, pos) => {
27089 - if (node.isText) return;
27090 - const relativeFrom = Math.max(from, pos);
27091 - const relativeTo = Math.min(to, pos + node.nodeSize);
27092 - nodeRanges.push({
27093 - node,
27094 - from: relativeFrom,
27095 - to: relativeTo
27096 - });
27097 - });
27098 - const selectionRange = to - from;
27099 - const matchedNodeRanges = nodeRanges.filter((nodeRange) => {
27100 - if (!type) return true;
27101 - return type.name === nodeRange.node.type.name;
27102 - }).filter((nodeRange) => objectIncludes(nodeRange.node.attrs, attributes, { strict: false }));
27103 - if (empty) return !!matchedNodeRanges.length;
27104 - return matchedNodeRanges.reduce((sum, nodeRange) => sum + nodeRange.to - nodeRange.from, 0) >= selectionRange;
27105 - }
27106 - var lift = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
27107 - if (!isNodeActive(state, getNodeType(typeOrName, state.schema), attributes)) return false;
27108 - return lift$1(state, dispatch);
27109 - };
27110 - var liftEmptyBlock = () => ({ state, dispatch }) => {
27111 - return liftEmptyBlock$1(state, dispatch);
27112 - };
27113 - var liftListItem = (typeOrName) => ({ state, dispatch }) => {
27114 - return liftListItem$1(getNodeType(typeOrName, state.schema))(state, dispatch);
27115 - };
27116 - var newlineInCode = () => ({ state, dispatch }) => {
27117 - return newlineInCode$1(state, dispatch);
27118 - };
27119 - function getSchemaTypeNameByName(name, schema) {
27120 - if (schema.nodes[name]) return "node";
27121 - if (schema.marks[name]) return "mark";
27122 - return null;
27123 - }
27124 - function deleteProps(obj, propOrProps) {
27125 - const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
27126 - return Object.keys(obj).reduce((newObj, prop) => {
27127 - if (!props.includes(prop)) newObj[prop] = obj[prop];
27128 - return newObj;
27129 - }, {});
27130 - }
27131 - var resetAttributes = (typeOrName, attributes) => ({ tr, state, dispatch }) => {
27132 - let nodeType = null;
27133 - let markType = null;
27134 - const schemaType = getSchemaTypeNameByName(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
27135 - if (!schemaType) return false;
27136 - if (schemaType === "node") nodeType = getNodeType(typeOrName, state.schema);
27137 - if (schemaType === "mark") markType = getMarkType(typeOrName, state.schema);
27138 - let canReset = false;
27139 - tr.selection.ranges.forEach((range) => {
27140 - state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {
27141 - if (nodeType && nodeType === node.type) {
27142 - canReset = true;
27143 - if (dispatch) tr.setNodeMarkup(pos, void 0, deleteProps(node.attrs, attributes));
27144 - }
27145 - if (markType && node.marks.length) node.marks.forEach((mark) => {
27146 - if (markType === mark.type) {
27147 - canReset = true;
27148 - if (dispatch) tr.addMark(pos, pos + node.nodeSize, markType.create(deleteProps(mark.attrs, attributes)));
27149 - }
27150 - });
27151 - });
27152 - });
27153 - return canReset;
27154 - };
27155 - var scrollIntoView = () => ({ tr, dispatch }) => {
27156 - if (dispatch) tr.scrollIntoView();
27157 - return true;
27158 - };
27159 - var selectAll = () => ({ tr, dispatch }) => {
27160 - if (dispatch) {
27161 - const selection = new AllSelection(tr.doc);
27162 - tr.setSelection(selection);
27163 - }
27164 - return true;
27165 - };
27166 - var selectNodeBackward = () => ({ state, dispatch }) => {
27167 - return selectNodeBackward$1(state, dispatch);
27168 - };
27169 - var selectNodeForward = () => ({ state, dispatch }) => {
27170 - return selectNodeForward$1(state, dispatch);
27171 - };
27172 - var selectParentNode = () => ({ state, dispatch }) => {
27173 - return selectParentNode$1(state, dispatch);
27174 - };
27175 - var selectTextblockEnd = () => ({ state, dispatch }) => {
27176 - return selectTextblockEnd$1(state, dispatch);
27177 - };
27178 - var selectTextblockStart = () => ({ state, dispatch }) => {
27179 - return selectTextblockStart$1(state, dispatch);
27180 - };
27181 - function createDocument(content, schema, parseOptions = {}, options = {}) {
27182 - return createNodeFromContent(content, schema, {
27183 - slice: false,
27184 - parseOptions,
27185 - errorOnInvalidContent: options.errorOnInvalidContent
27186 - });
27187 - }
27188 - var setContent = (content, { errorOnInvalidContent, emitUpdate = true, parseOptions = {} } = {}) => ({ editor, tr, dispatch, commands }) => {
27189 - const { doc } = tr;
27190 - if (parseOptions.preserveWhitespace !== "full") {
27191 - const document2 = createDocument(content, editor.schema, parseOptions, { errorOnInvalidContent: errorOnInvalidContent != null ? errorOnInvalidContent : editor.options.enableContentCheck });
27192 - if (dispatch) tr.replaceWith(0, doc.content.size, document2).setMeta("preventUpdate", !emitUpdate);
27193 - return true;
27194 - }
27195 - if (dispatch) tr.setMeta("preventUpdate", !emitUpdate);
27196 - return commands.insertContentAt({
27197 - from: 0,
27198 - to: doc.content.size
27199 - }, content, {
27200 - parseOptions,
27201 - errorOnInvalidContent: errorOnInvalidContent != null ? errorOnInvalidContent : editor.options.enableContentCheck
27202 - });
27203 - };
27204 - function getMarkAttributes(state, typeOrName) {
27205 - const type = getMarkType(typeOrName, state.schema);
27206 - const { from, to, empty } = state.selection;
27207 - const marks = [];
27208 - if (empty) {
27209 - if (state.storedMarks) marks.push(...state.storedMarks);
27210 - marks.push(...state.selection.$head.marks());
27211 - } else state.doc.nodesBetween(from, to, (node) => {
27212 - marks.push(...node.marks);
27213 - });
27214 - const mark = marks.find((markItem) => markItem.type.name === type.name);
27215 - if (!mark) return {};
27216 - return { ...mark.attrs };
27217 - }
27218 - function combineTransactionSteps(oldDoc, transactions) {
27219 - const transform = new Transform(oldDoc);
27220 - transactions.forEach((transaction) => {
27221 - transaction.steps.forEach((step) => {
27222 - transform.step(step);
27223 - });
27224 - });
27225 - return transform;
27226 - }
27227 - function defaultBlockAt(match) {
27228 - for (let i = 0; i < match.edgeCount; i += 1) {
27229 - const { type } = match.edge(i);
27230 - if (type.isTextblock && !type.hasRequiredAttrs()) return type;
27231 - }
27232 - return null;
27233 - }
27234 - function findChildrenInRange(node, range, predicate) {
27235 - const nodesWithPos = [];
27236 - node.nodesBetween(range.from, range.to, (child, pos) => {
27237 - if (predicate(child)) nodesWithPos.push({
27238 - node: child,
27239 - pos
27240 - });
27241 - });
27242 - return nodesWithPos;
27243 - }
27244 - function findParentNodeClosestToPos($pos, predicate) {
27245 - for (let i = $pos.depth; i > 0; i -= 1) {
27246 - const node = $pos.node(i);
27247 - if (predicate(node)) return {
27248 - pos: i > 0 ? $pos.before(i) : 0,
27249 - start: $pos.start(i),
27250 - depth: i,
27251 - node
27252 - };
27253 - }
27254 - }
27255 - function findParentNode(predicate) {
27256 - return (selection) => findParentNodeClosestToPos(selection.$from, predicate);
27257 - }
27258 - function getExtensionField(extension, field, context) {
27259 - if (extension.config[field] === void 0 && extension.parent) return getExtensionField(extension.parent, field, context);
27260 - if (typeof extension.config[field] === "function") return extension.config[field].bind({
27261 - ...context,
27262 - parent: extension.parent ? getExtensionField(extension.parent, field, context) : null
27263 - });
27264 - return extension.config[field];
27265 - }
27266 - function flattenExtensions(extensions) {
27267 - return extensions.map((extension) => {
27268 - const addExtensions = getExtensionField(extension, "addExtensions", {
27269 - name: extension.name,
27270 - options: extension.options,
27271 - storage: extension.storage
27272 - });
27273 - if (addExtensions) return [extension, ...flattenExtensions(addExtensions())];
27274 - return extension;
27275 - }).flat(10);
27276 - }
27277 - function getHTMLFromFragment(fragment, schema) {
27278 - const documentFragment = DOMSerializer.fromSchema(schema).serializeFragment(fragment);
27279 - const container = document.implementation.createHTMLDocument().createElement("div");
27280 - container.appendChild(documentFragment);
27281 - return container.innerHTML;
27282 - }
27283 - function isFunction(value) {
27284 - return typeof value === "function";
27285 - }
27286 - function callOrReturn(value, context = void 0, ...props) {
27287 - if (isFunction(value)) {
27288 - if (context) return value.bind(context)(...props);
27289 - return value(...props);
27290 - }
27291 - return value;
27292 - }
27293 - function isEmptyObject(value = {}) {
27294 - return Object.keys(value).length === 0 && value.constructor === Object;
27295 - }
27296 - function splitExtensions(extensions) {
27297 - return {
27298 - baseExtensions: extensions.filter((extension) => extension.type === "extension"),
27299 - nodeExtensions: extensions.filter((extension) => extension.type === "node"),
27300 - markExtensions: extensions.filter((extension) => extension.type === "mark")
27301 - };
27302 - }
27303 - function getAttributesFromExtensions(extensions) {
27304 - const extensionAttributes = [];
27305 - const { nodeExtensions, markExtensions } = splitExtensions(extensions);
27306 - const nodeAndMarkExtensions = [...nodeExtensions, ...markExtensions];
27307 - const defaultAttribute = {
27308 - default: null,
27309 - validate: void 0,
27310 - rendered: true,
27311 - renderHTML: null,
27312 - parseHTML: null,
27313 - keepOnSplit: true,
27314 - isRequired: false
27315 - };
27316 - const nodeExtensionTypes = nodeExtensions.filter((ext) => ext.name !== "text").map((ext) => ext.name);
27317 - const markExtensionTypes = markExtensions.map((ext) => ext.name);
27318 - const allExtensionTypes = [...nodeExtensionTypes, ...markExtensionTypes];
27319 - extensions.forEach((extension) => {
27320 - const addGlobalAttributes = getExtensionField(extension, "addGlobalAttributes", {
27321 - name: extension.name,
27322 - options: extension.options,
27323 - storage: extension.storage,
27324 - extensions: nodeAndMarkExtensions
27325 - });
27326 - if (!addGlobalAttributes) return;
27327 - addGlobalAttributes().forEach((globalAttribute) => {
27328 - let resolvedTypes;
27329 - if (Array.isArray(globalAttribute.types)) resolvedTypes = globalAttribute.types;
27330 - else if (globalAttribute.types === "*") resolvedTypes = allExtensionTypes;
27331 - else if (globalAttribute.types === "nodes") resolvedTypes = nodeExtensionTypes;
27332 - else if (globalAttribute.types === "marks") resolvedTypes = markExtensionTypes;
27333 - else resolvedTypes = [];
27334 - resolvedTypes.forEach((type) => {
27335 - Object.entries(globalAttribute.attributes).forEach(([name, attribute]) => {
27336 - extensionAttributes.push({
27337 - type,
27338 - name,
27339 - attribute: {
27340 - ...defaultAttribute,
27341 - ...attribute
27342 - }
27343 - });
27344 - });
27345 - });
27346 - });
27347 - });
27348 - nodeAndMarkExtensions.forEach((extension) => {
27349 - const addAttributes = getExtensionField(extension, "addAttributes", {
27350 - name: extension.name,
27351 - options: extension.options,
27352 - storage: extension.storage
27353 - });
27354 - if (!addAttributes) return;
27355 - const attributes = addAttributes();
27356 - Object.entries(attributes).forEach(([name, attribute]) => {
27357 - const mergedAttr = {
27358 - ...defaultAttribute,
27359 - ...attribute
27360 - };
27361 - if (typeof (mergedAttr == null ? void 0 : mergedAttr.default) === "function") mergedAttr.default = mergedAttr.default();
27362 - if ((mergedAttr == null ? void 0 : mergedAttr.isRequired) && (mergedAttr == null ? void 0 : mergedAttr.default) === void 0) delete mergedAttr.default;
27363 - extensionAttributes.push({
27364 - type: extension.name,
27365 - name,
27366 - attribute: mergedAttr
27367 - });
27368 - });
27369 - });
27370 - return extensionAttributes;
27371 - }
27372 - function mergeAttributes(...objects) {
27373 - return objects.filter((item) => !!item).reduce((items, item) => {
27374 - const mergedAttributes = { ...items };
27375 - Object.entries(item).forEach(([key, value]) => {
27376 - if (!mergedAttributes[key]) {
27377 - mergedAttributes[key] = value;
27378 - return;
27379 - }
27380 - if (key === "class") {
27381 - const valueClasses = value ? String(value).split(" ") : [];
27382 - const existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(" ") : [];
27383 - const insertClasses = valueClasses.filter((valueClass) => !existingClasses.includes(valueClass));
27384 - mergedAttributes[key] = [...existingClasses, ...insertClasses].join(" ");
27385 - } else if (key === "style") {
27386 - const newStyles = value ? value.split(";").map((style2) => style2.trim()).filter(Boolean) : [];
27387 - const existingStyles = mergedAttributes[key] ? mergedAttributes[key].split(";").map((style2) => style2.trim()).filter(Boolean) : [];
27388 - const styleMap = /* @__PURE__ */ new Map();
27389 - existingStyles.forEach((style2) => {
27390 - const [property, val] = style2.split(":").map((part) => part.trim());
27391 - styleMap.set(property, val);
27392 - });
27393 - newStyles.forEach((style2) => {
27394 - const [property, val] = style2.split(":").map((part) => part.trim());
27395 - styleMap.set(property, val);
27396 - });
27397 - mergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join("; ");
27398 - } else mergedAttributes[key] = value;
27399 - });
27400 - return mergedAttributes;
27401 - }, {});
27402 - }
27403 - function getRenderedAttributes(nodeOrMark, extensionAttributes) {
27404 - return extensionAttributes.filter((attribute) => attribute.type === nodeOrMark.type.name).filter((item) => item.attribute.rendered).map((item) => {
27405 - if (!item.attribute.renderHTML) return { [item.name]: nodeOrMark.attrs[item.name] };
27406 - return item.attribute.renderHTML(nodeOrMark.attrs) || {};
27407 - }).reduce((attributes, attribute) => mergeAttributes(attributes, attribute), {});
27408 - }
27409 - function fromString(value) {
27410 - if (typeof value !== "string") return value;
27411 - if (value.match(/^[+-]?(?:\d*\.)?\d+$/)) return Number(value);
27412 - if (value === "true") return true;
27413 - if (value === "false") return false;
27414 - return value;
27415 - }
27416 - function injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {
27417 - if ("style" in parseRule) return parseRule;
27418 - return {
27419 - ...parseRule,
27420 - getAttrs: (node) => {
27421 - const oldAttributes = parseRule.getAttrs ? parseRule.getAttrs(node) : parseRule.attrs;
27422 - if (oldAttributes === false) return false;
27423 - const newAttributes = extensionAttributes.reduce((items, item) => {
27424 - const value = item.attribute.parseHTML ? item.attribute.parseHTML(node) : fromString(node.getAttribute(item.name));
27425 - if (value === null || value === void 0) return items;
27426 - return {
27427 - ...items,
27428 - [item.name]: value
27429 - };
27430 - }, {});
27431 - return {
27432 - ...oldAttributes,
27433 - ...newAttributes
27434 - };
27435 - }
27436 - };
27437 - }
27438 - function cleanUpSchemaItem(data) {
27439 - return Object.fromEntries(Object.entries(data).filter(([key, value]) => {
27440 - if (key === "attrs" && isEmptyObject(value)) return false;
27441 - return value !== null && value !== void 0;
27442 - }));
27443 - }
27444 - function buildAttributeSpec(extensionAttribute) {
27445 - var _a;
27446 - var _b;
27447 - const spec = {};
27448 - if (!((_a = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _a.isRequired) && "default" in ((extensionAttribute == null ? void 0 : extensionAttribute.attribute) || {})) spec.default = extensionAttribute.attribute.default;
27449 - if (((_b = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _b.validate) !== void 0) spec.validate = extensionAttribute.attribute.validate;
27450 - return [extensionAttribute.name, spec];
27451 - }
27452 - function getSchemaByResolvedExtensions(extensions, editor) {
27453 - var _a;
27454 - const allAttributes = getAttributesFromExtensions(extensions);
27455 - const { nodeExtensions, markExtensions } = splitExtensions(extensions);
27456 - return new Schema({
27457 - topNode: (_a = nodeExtensions.find((extension) => getExtensionField(extension, "topNode"))) == null ? void 0 : _a.name,
27458 - nodes: Object.fromEntries(nodeExtensions.map((extension) => {
27459 - const extensionAttributes = allAttributes.filter((attribute) => attribute.type === extension.name);
27460 - const context = {
27461 - name: extension.name,
27462 - options: extension.options,
27463 - storage: extension.storage,
27464 - editor
27465 - };
27466 - const schema = cleanUpSchemaItem({
27467 - ...extensions.reduce((fields, e) => {
27468 - const extendNodeSchema = getExtensionField(e, "extendNodeSchema", context);
27469 - return {
27470 - ...fields,
27471 - ...extendNodeSchema ? extendNodeSchema(extension) : {}
27472 - };
27473 - }, {}),
27474 - content: callOrReturn(getExtensionField(extension, "content", context)),
27475 - marks: callOrReturn(getExtensionField(extension, "marks", context)),
27476 - group: callOrReturn(getExtensionField(extension, "group", context)),
27477 - inline: callOrReturn(getExtensionField(extension, "inline", context)),
27478 - atom: callOrReturn(getExtensionField(extension, "atom", context)),
27479 - selectable: callOrReturn(getExtensionField(extension, "selectable", context)),
27480 - draggable: callOrReturn(getExtensionField(extension, "draggable", context)),
27481 - code: callOrReturn(getExtensionField(extension, "code", context)),
27482 - whitespace: callOrReturn(getExtensionField(extension, "whitespace", context)),
27483 - linebreakReplacement: callOrReturn(getExtensionField(extension, "linebreakReplacement", context)),
27484 - defining: callOrReturn(getExtensionField(extension, "defining", context)),
27485 - isolating: callOrReturn(getExtensionField(extension, "isolating", context)),
27486 - attrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))
27487 - });
27488 - const parseHTML = callOrReturn(getExtensionField(extension, "parseHTML", context));
27489 - if (parseHTML) schema.parseDOM = parseHTML.map((parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes));
27490 - const renderHTML = getExtensionField(extension, "renderHTML", context);
27491 - if (renderHTML) schema.toDOM = (node) => renderHTML({
27492 - node,
27493 - HTMLAttributes: getRenderedAttributes(node, extensionAttributes)
27494 - });
27495 - const renderText = getExtensionField(extension, "renderText", context);
27496 - if (renderText) schema.toText = renderText;
27497 - return [extension.name, schema];
27498 - })),
27499 - marks: Object.fromEntries(markExtensions.map((extension) => {
27500 - const extensionAttributes = allAttributes.filter((attribute) => attribute.type === extension.name);
27501 - const context = {
27502 - name: extension.name,
27503 - options: extension.options,
27504 - storage: extension.storage,
27505 - editor
27506 - };
27507 - const schema = cleanUpSchemaItem({
27508 - ...extensions.reduce((fields, e) => {
27509 - const extendMarkSchema = getExtensionField(e, "extendMarkSchema", context);
27510 - return {
27511 - ...fields,
27512 - ...extendMarkSchema ? extendMarkSchema(extension) : {}
27513 - };
27514 - }, {}),
27515 - inclusive: callOrReturn(getExtensionField(extension, "inclusive", context)),
27516 - excludes: callOrReturn(getExtensionField(extension, "excludes", context)),
27517 - group: callOrReturn(getExtensionField(extension, "group", context)),
27518 - spanning: callOrReturn(getExtensionField(extension, "spanning", context)),
27519 - code: callOrReturn(getExtensionField(extension, "code", context)),
27520 - attrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))
27521 - });
27522 - const parseHTML = callOrReturn(getExtensionField(extension, "parseHTML", context));
27523 - if (parseHTML) schema.parseDOM = parseHTML.map((parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes));
27524 - const renderHTML = getExtensionField(extension, "renderHTML", context);
27525 - if (renderHTML) schema.toDOM = (mark) => renderHTML({
27526 - mark,
27527 - HTMLAttributes: getRenderedAttributes(mark, extensionAttributes)
27528 - });
27529 - return [extension.name, schema];
27530 - }))
27531 - });
27532 - }
27533 - function findDuplicates(items) {
27534 - const filtered = items.filter((el, index) => items.indexOf(el) !== index);
27535 - return Array.from(new Set(filtered));
27536 - }
27537 - function sortExtensions(extensions) {
27538 - const defaultPriority = 100;
27539 - return extensions.sort((a, b) => {
27540 - const priorityA = getExtensionField(a, "priority") || defaultPriority;
27541 - const priorityB = getExtensionField(b, "priority") || defaultPriority;
27542 - if (priorityA > priorityB) return -1;
27543 - if (priorityA < priorityB) return 1;
27544 - return 0;
27545 - });
27546 - }
27547 - function resolveExtensions(extensions) {
27548 - const resolvedExtensions = sortExtensions(flattenExtensions(extensions));
27549 - const duplicatedNames = findDuplicates(resolvedExtensions.map((extension) => extension.name));
27550 - if (duplicatedNames.length) console.warn(`[tiptap warn]: Duplicate extension names found: [${duplicatedNames.map((item) => `'${item}'`).join(", ")}]. This can lead to issues.`);
27551 - return resolvedExtensions;
27552 - }
27553 - function getTextBetween(startNode, range, options) {
27554 - const { from, to } = range;
27555 - const { blockSeparator = "\n\n", textSerializers = {} } = options || {};
27556 - let text = "";
27557 - startNode.nodesBetween(from, to, (node, pos, parent, index) => {
27558 - var _a;
27559 - if (node.isBlock && pos > from) text += blockSeparator;
27560 - const textSerializer = textSerializers == null ? void 0 : textSerializers[node.type.name];
27561 - if (textSerializer) {
27562 - if (parent) text += textSerializer({
27563 - node,
27564 - pos,
27565 - parent,
27566 - index,
27567 - range
27568 - });
27569 - return false;
27570 - }
27571 - if (node.isText) text += (_a = node == null ? void 0 : node.text) == null ? void 0 : _a.slice(Math.max(from, pos) - pos, to - pos);
27572 - });
27573 - return text;
27574 - }
27575 - function getText(node, options) {
27576 - return getTextBetween(node, {
27577 - from: 0,
27578 - to: node.content.size
27579 - }, options);
27580 - }
27581 - function getTextSerializersFromSchema(schema) {
27582 - return Object.fromEntries(Object.entries(schema.nodes).filter(([, node]) => node.spec.toText).map(([name, node]) => [name, node.spec.toText]));
27583 - }
27584 - function getNodeAttributes(state, typeOrName) {
27585 - const type = getNodeType(typeOrName, state.schema);
27586 - const { from, to } = state.selection;
27587 - const nodes = [];
27588 - state.doc.nodesBetween(from, to, (node2) => {
27589 - nodes.push(node2);
27590 - });
27591 - const node = nodes.reverse().find((nodeItem) => nodeItem.type.name === type.name);
27592 - if (!node) return {};
27593 - return { ...node.attrs };
27594 - }
27595 - function getAttributes(state, typeOrName) {
27596 - const schemaType = getSchemaTypeNameByName(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
27597 - if (schemaType === "node") return getNodeAttributes(state, typeOrName);
27598 - if (schemaType === "mark") return getMarkAttributes(state, typeOrName);
27599 - return {};
27600 - }
27601 - function removeDuplicates(array, by = JSON.stringify) {
27602 - const seen = {};
27603 - return array.filter((item) => {
27604 - const key = by(item);
27605 - return Object.prototype.hasOwnProperty.call(seen, key) ? false : seen[key] = true;
27606 - });
27607 - }
27608 - function simplifyChangedRanges(changes) {
27609 - const uniqueChanges = removeDuplicates(changes);
27610 - return uniqueChanges.length === 1 ? uniqueChanges : uniqueChanges.filter((change, index) => {
27611 - return !uniqueChanges.filter((_, i) => i !== index).some((otherChange) => {
27612 - return change.oldRange.from >= otherChange.oldRange.from && change.oldRange.to <= otherChange.oldRange.to && change.newRange.from >= otherChange.newRange.from && change.newRange.to <= otherChange.newRange.to;
27613 - });
27614 - });
27615 - }
27616 - function getChangedRanges(transform) {
27617 - const { mapping, steps } = transform;
27618 - const changes = [];
27619 - mapping.maps.forEach((stepMap, index) => {
27620 - const ranges = [];
27621 - if (!stepMap.ranges.length) {
27622 - const { from, to } = steps[index];
27623 - if (from === void 0 || to === void 0) return;
27624 - ranges.push({
27625 - from,
27626 - to
27627 - });
27628 - } else stepMap.forEach((from, to) => {
27629 - ranges.push({
27630 - from,
27631 - to
27632 - });
27633 - });
27634 - ranges.forEach(({ from, to }) => {
27635 - const newStart = mapping.slice(index).map(from, -1);
27636 - const newEnd = mapping.slice(index).map(to);
27637 - const oldStart = mapping.invert().map(newStart, -1);
27638 - const oldEnd = mapping.invert().map(newEnd);
27639 - changes.push({
27640 - oldRange: {
27641 - from: oldStart,
27642 - to: oldEnd
27643 - },
27644 - newRange: {
27645 - from: newStart,
27646 - to: newEnd
27647 - }
27648 - });
27649 - });
27650 - });
27651 - return simplifyChangedRanges(changes);
27652 - }
27653 - function getMarksBetween(from, to, doc) {
27654 - const marks = [];
27655 - if (from === to) doc.resolve(from).marks().forEach((mark) => {
27656 - const range = getMarkRange(doc.resolve(from), mark.type);
27657 - if (!range) return;
27658 - marks.push({
27659 - mark,
27660 - ...range
27661 - });
27662 - });
27663 - else doc.nodesBetween(from, to, (node, pos) => {
27664 - if (!node || (node == null ? void 0 : node.nodeSize) === void 0) return;
27665 - marks.push(...node.marks.map((mark) => ({
27666 - from: pos,
27667 - to: pos + node.nodeSize,
27668 - mark
27669 - })));
27670 - });
27671 - return marks;
27672 - }
27673 - function getSchemaTypeByName(name, schema) {
27674 - return schema.nodes[name] || schema.marks[name] || null;
27675 - }
27676 - function getSplittedAttributes(extensionAttributes, typeName, attributes) {
27677 - return Object.fromEntries(Object.entries(attributes).filter(([name]) => {
27678 - const extensionAttribute = extensionAttributes.find((item) => {
27679 - return item.type === typeName && item.name === name;
27680 - });
27681 - if (!extensionAttribute) return false;
27682 - return extensionAttribute.attribute.keepOnSplit;
27683 - }));
27684 - }
27685 - var getTextContentFromNodes = ($from, maxMatch = 500) => {
27686 - let textBefore = "";
27687 - const sliceEndPos = $from.parentOffset;
27688 - $from.parent.nodesBetween(Math.max(0, sliceEndPos - maxMatch), sliceEndPos, (node, pos, parent, index) => {
27689 - var _a;
27690 - var _b;
27691 - const chunk = ((_b = (_a = node.type.spec).toText) == null ? void 0 : _b.call(_a, {
27692 - node,
27693 - pos,
27694 - parent,
27695 - index
27696 - })) || node.textContent || "%leaf%";
27697 - textBefore += node.isAtom && !node.isText ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos));
27698 - });
27699 - return textBefore;
27700 - };
27701 - function isMarkActive(state, typeOrName, attributes = {}) {
27702 - const { empty, ranges } = state.selection;
27703 - const type = typeOrName ? getMarkType(typeOrName, state.schema) : null;
27704 - if (empty) return !!(state.storedMarks || state.selection.$from.marks()).filter((mark) => {
27705 - if (!type) return true;
27706 - return type.name === mark.type.name;
27707 - }).find((mark) => objectIncludes(mark.attrs, attributes, { strict: false }));
27708 - let selectionRange = 0;
27709 - const markRanges = [];
27710 - ranges.forEach(({ $from, $to }) => {
27711 - const from = $from.pos;
27712 - const to = $to.pos;
27713 - state.doc.nodesBetween(from, to, (node, pos) => {
27714 - if (type && node.inlineContent && !node.type.allowsMarkType(type)) return false;
27715 - if (!node.isText && !node.marks.length) return;
27716 - const relativeFrom = Math.max(from, pos);
27717 - const relativeTo = Math.min(to, pos + node.nodeSize);
27718 - const range2 = relativeTo - relativeFrom;
27719 - selectionRange += range2;
27720 - markRanges.push(...node.marks.map((mark) => ({
27721 - mark,
27722 - from: relativeFrom,
27723 - to: relativeTo
27724 - })));
27725 - });
27726 - });
27727 - if (selectionRange === 0) return false;
27728 - const matchedRange = markRanges.filter((markRange) => {
27729 - if (!type) return true;
27730 - return type.name === markRange.mark.type.name;
27731 - }).filter((markRange) => objectIncludes(markRange.mark.attrs, attributes, { strict: false })).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);
27732 - const excludedRange = markRanges.filter((markRange) => {
27733 - if (!type) return true;
27734 - return markRange.mark.type !== type && markRange.mark.type.excludes(type);
27735 - }).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);
27736 - return (matchedRange > 0 ? matchedRange + excludedRange : matchedRange) >= selectionRange;
27737 - }
27738 - function isActive(state, name, attributes = {}) {
27739 - if (!name) return isNodeActive(state, null, attributes) || isMarkActive(state, null, attributes);
27740 - const schemaType = getSchemaTypeNameByName(name, state.schema);
27741 - if (schemaType === "node") return isNodeActive(state, name, attributes);
27742 - if (schemaType === "mark") return isMarkActive(state, name, attributes);
27743 - return false;
27744 - }
27745 - function isExtensionRulesEnabled(extension, enabled) {
27746 - if (Array.isArray(enabled)) return enabled.some((enabledExtension) => {
27747 - return (typeof enabledExtension === "string" ? enabledExtension : enabledExtension.name) === extension.name;
27748 - });
27749 - return enabled;
27750 - }
27751 - function isList(name, extensions) {
27752 - const { nodeExtensions } = splitExtensions(extensions);
27753 - const extension = nodeExtensions.find((item) => item.name === name);
27754 - if (!extension) return false;
27755 - const group = callOrReturn(getExtensionField(extension, "group", {
27756 - name: extension.name,
27757 - options: extension.options,
27758 - storage: extension.storage
27759 - }));
27760 - if (typeof group !== "string") return false;
27761 - return group.split(" ").includes("list");
27762 - }
27763 - function isNodeEmpty(node, { checkChildren = true, ignoreWhitespace = false } = {}) {
27764 - var _a;
27765 - if (ignoreWhitespace) {
27766 - if (node.type.name === "hardBreak") return true;
27767 - if (node.isText) return /^\s*$/m.test((_a = node.text) != null ? _a : "");
27768 - }
27769 - if (node.isText) return !node.text;
27770 - if (node.isAtom || node.isLeaf) return false;
27771 - if (node.content.childCount === 0) return true;
27772 - if (checkChildren) {
27773 - let isContentEmpty = true;
27774 - node.content.forEach((childNode) => {
27775 - if (isContentEmpty === false) return;
27776 - if (!isNodeEmpty(childNode, {
27777 - ignoreWhitespace,
27778 - checkChildren
27779 - })) isContentEmpty = false;
27780 - });
27781 - return isContentEmpty;
27782 - }
27783 - return false;
27784 - }
27785 - var MappablePosition = class _MappablePosition {
27786 - constructor(position) {
27787 - this.position = position;
27788 - }
27789 - /**
27790 - * Creates a MappablePosition from a JSON object.
27791 - */
27792 - static fromJSON(json) {
27793 - return new _MappablePosition(json.position);
27794 - }
27795 - /**
27796 - * Converts the MappablePosition to a JSON object.
27797 - */
27798 - toJSON() {
27799 - return { position: this.position };
27800 - }
27801 - };
27802 - function getUpdatedPosition(position, transaction) {
27803 - const mapResult = transaction.mapping.mapResult(position.position);
27804 - return {
27805 - position: new MappablePosition(mapResult.pos),
27806 - mapResult
27807 - };
27808 - }
27809 - function createMappablePosition(position) {
27810 - return new MappablePosition(position);
27811 - }
27812 - function canSetMark(state, tr, newMarkType) {
27813 - var _a;
27814 - const { selection } = tr;
27815 - let cursor = null;
27816 - if (isTextSelection(selection)) cursor = selection.$cursor;
27817 - if (cursor) {
27818 - const currentMarks = (_a = state.storedMarks) != null ? _a : cursor.marks();
27819 - return cursor.parent.type.allowsMarkType(newMarkType) && (!!newMarkType.isInSet(currentMarks) || !currentMarks.some((mark) => mark.type.excludes(newMarkType)));
27820 - }
27821 - const { ranges } = selection;
27822 - return ranges.some(({ $from, $to }) => {
27823 - let someNodeSupportsMark = $from.depth === 0 ? state.doc.inlineContent && state.doc.type.allowsMarkType(newMarkType) : false;
27824 - state.doc.nodesBetween($from.pos, $to.pos, (node, _pos, parent) => {
27825 - if (someNodeSupportsMark) return false;
27826 - if (node.isInline) {
27827 - const parentAllowsMarkType = !parent || parent.type.allowsMarkType(newMarkType);
27828 - const currentMarksAllowMarkType = !!newMarkType.isInSet(node.marks) || !node.marks.some((otherMark) => otherMark.type.excludes(newMarkType));
27829 - someNodeSupportsMark = parentAllowsMarkType && currentMarksAllowMarkType;
27830 - }
27831 - return !someNodeSupportsMark;
27832 - });
27833 - return someNodeSupportsMark;
27834 - });
27835 - }
27836 - var setMark = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
27837 - const { selection } = tr;
27838 - const { empty, ranges } = selection;
27839 - const type = getMarkType(typeOrName, state.schema);
27840 - if (dispatch) if (empty) {
27841 - const oldAttributes = getMarkAttributes(state, type);
27842 - tr.addStoredMark(type.create({
27843 - ...oldAttributes,
27844 - ...attributes
27845 - }));
27846 - } else ranges.forEach((range) => {
27847 - const from = range.$from.pos;
27848 - const to = range.$to.pos;
27849 - state.doc.nodesBetween(from, to, (node, pos) => {
27850 - const trimmedFrom = Math.max(pos, from);
27851 - const trimmedTo = Math.min(pos + node.nodeSize, to);
27852 - if (node.marks.find((mark) => mark.type === type)) node.marks.forEach((mark) => {
27853 - if (type === mark.type) tr.addMark(trimmedFrom, trimmedTo, type.create({
27854 - ...mark.attrs,
27855 - ...attributes
27856 - }));
27857 - });
27858 - else tr.addMark(trimmedFrom, trimmedTo, type.create(attributes));
27859 - });
27860 - });
27861 - return canSetMark(state, tr, type);
27862 - };
27863 - var setMeta = (key, value) => ({ tr }) => {
27864 - tr.setMeta(key, value);
27865 - return true;
27866 - };
27867 - var setNode = (typeOrName, attributes = {}) => ({ state, dispatch, chain }) => {
27868 - const type = getNodeType(typeOrName, state.schema);
27869 - let attributesToCopy;
27870 - if (state.selection.$anchor.sameParent(state.selection.$head)) attributesToCopy = state.selection.$anchor.parent.attrs;
27871 - if (!type.isTextblock) {
27872 - console.warn("[tiptap warn]: Currently \"setNode()\" only supports text block nodes.");
27873 - return false;
27874 - }
27875 - return chain().command(({ commands }) => {
27876 - if (setBlockType(type, {
27877 - ...attributesToCopy,
27878 - ...attributes
27879 - })(state)) return true;
27880 - return commands.clearNodes();
27881 - }).command(({ state: updatedState }) => {
27882 - return setBlockType(type, {
27883 - ...attributesToCopy,
27884 - ...attributes
27885 - })(updatedState, dispatch);
27886 - }).run();
27887 - };
27888 - var setNodeSelection = (position) => ({ tr, dispatch }) => {
27889 - if (dispatch) {
27890 - const { doc } = tr;
27891 - const from = minMax(position, 0, doc.content.size);
27892 - const selection = NodeSelection.create(doc, from);
27893 - tr.setSelection(selection);
27894 - }
27895 - return true;
27896 - };
27897 - var setTextDirection = (direction, position) => ({ tr, state, dispatch }) => {
27898 - const { selection } = state;
27899 - let from;
27900 - let to;
27901 - if (typeof position === "number") {
27902 - from = position;
27903 - to = position;
27904 - } else if (position && "from" in position && "to" in position) {
27905 - from = position.from;
27906 - to = position.to;
27907 - } else {
27908 - from = selection.from;
27909 - to = selection.to;
27910 - }
27911 - if (dispatch) tr.doc.nodesBetween(from, to, (node, pos) => {
27912 - if (node.isText) return;
27913 - tr.setNodeMarkup(pos, void 0, {
27914 - ...node.attrs,
27915 - dir: direction
27916 - });
27917 - });
27918 - return true;
27919 - };
27920 - var setTextSelection = (position) => ({ tr, dispatch }) => {
27921 - if (dispatch) {
27922 - const { doc } = tr;
27923 - const { from, to } = typeof position === "number" ? {
27924 - from: position,
27925 - to: position
27926 - } : position;
27927 - const minPos = TextSelection.atStart(doc).from;
27928 - const maxPos = TextSelection.atEnd(doc).to;
27929 - const resolvedFrom = minMax(from, minPos, maxPos);
27930 - const resolvedEnd = minMax(to, minPos, maxPos);
27931 - const selection = TextSelection.create(doc, resolvedFrom, resolvedEnd);
27932 - tr.setSelection(selection);
27933 - }
27934 - return true;
27935 - };
27936 - var sinkListItem = (typeOrName) => ({ state, dispatch }) => {
27937 - return sinkListItem$1(getNodeType(typeOrName, state.schema))(state, dispatch);
27938 - };
27939 - function ensureMarks(state, splittableMarks) {
27940 - const marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();
27941 - if (marks) {
27942 - const filteredMarks = marks.filter((mark) => splittableMarks == null ? void 0 : splittableMarks.includes(mark.type.name));
27943 - state.tr.ensureMarks(filteredMarks);
27944 - }
27945 - }
27946 - var splitBlock = ({ keepMarks = true } = {}) => ({ tr, state, dispatch, editor }) => {
27947 - const { selection, doc } = tr;
27948 - const { $from, $to } = selection;
27949 - const extensionAttributes = editor.extensionManager.attributes;
27950 - const newAttributes = getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs);
27951 - if (selection instanceof NodeSelection && selection.node.isBlock) {
27952 - if (!$from.parentOffset || !canSplit(doc, $from.pos)) return false;
27953 - if (dispatch) {
27954 - if (keepMarks) ensureMarks(state, editor.extensionManager.splittableMarks);
27955 - tr.split($from.pos).scrollIntoView();
27956 - }
27957 - return true;
27958 - }
27959 - if (!$from.parent.isBlock) return false;
27960 - const atEnd = $to.parentOffset === $to.parent.content.size;
27961 - const deflt = $from.depth === 0 ? void 0 : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));
27962 - let types = atEnd && deflt ? [{
27963 - type: deflt,
27964 - attrs: newAttributes
27965 - }] : void 0;
27966 - let can = canSplit(tr.doc, tr.mapping.map($from.pos), 1, types);
27967 - if (!types && !can && canSplit(tr.doc, tr.mapping.map($from.pos), 1, deflt ? [{ type: deflt }] : void 0)) {
27968 - can = true;
27969 - types = deflt ? [{
27970 - type: deflt,
27971 - attrs: newAttributes
27972 - }] : void 0;
27973 - }
27974 - if (dispatch) {
27975 - if (can) {
27976 - if (selection instanceof TextSelection) tr.deleteSelection();
27977 - tr.split(tr.mapping.map($from.pos), 1, types);
27978 - if (deflt && !atEnd && !$from.parentOffset && $from.parent.type !== deflt) {
27979 - const first2 = tr.mapping.map($from.before());
27980 - const $first = tr.doc.resolve(first2);
27981 - if ($from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt)) tr.setNodeMarkup(tr.mapping.map($from.before()), deflt);
27982 - }
27983 - }
27984 - if (keepMarks) ensureMarks(state, editor.extensionManager.splittableMarks);
27985 - tr.scrollIntoView();
27986 - }
27987 - return can;
27988 - };
27989 - var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch, editor }) => {
27990 - var _a;
27991 - const type = getNodeType(typeOrName, state.schema);
27992 - const { $from, $to } = state.selection;
27993 - const node = state.selection.node;
27994 - if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) return false;
27995 - const grandParent = $from.node(-1);
27996 - if (grandParent.type !== type) return false;
27997 - const extensionAttributes = editor.extensionManager.attributes;
27998 - if ($from.parent.content.size === 0 && $from.node(-1).childCount === $from.indexAfter(-1)) {
27999 - if ($from.depth === 2 || $from.node(-3).type !== type || $from.index(-2) !== $from.node(-2).childCount - 1) return false;
28000 - if (dispatch) {
28001 - let wrap = Fragment$1.empty;
28002 - const depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;
28003 - for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) wrap = Fragment$1.from($from.node(d).copy(wrap));
28004 - const depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;
28005 - const newNextTypeAttributes2 = {
28006 - ...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
28007 - ...overrideAttrs
28008 - };
28009 - const nextType2 = ((_a = type.contentMatch.defaultType) == null ? void 0 : _a.createAndFill(newNextTypeAttributes2)) || void 0;
28010 - wrap = wrap.append(Fragment$1.from(type.createAndFill(null, nextType2) || void 0));
28011 - const start = $from.before($from.depth - (depthBefore - 1));
28012 - tr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));
28013 - let sel = -1;
28014 - tr.doc.nodesBetween(start, tr.doc.content.size, (n, pos) => {
28015 - if (sel > -1) return false;
28016 - if (n.isTextblock && n.content.size === 0) sel = pos + 1;
28017 - });
28018 - if (sel > -1) tr.setSelection(TextSelection.near(tr.doc.resolve(sel)));
28019 - tr.scrollIntoView();
28020 - }
28021 - return true;
28022 - }
28023 - const nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : null;
28024 - const newTypeAttributes = {
28025 - ...getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs),
28026 - ...overrideAttrs
28027 - };
28028 - const newNextTypeAttributes = {
28029 - ...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
28030 - ...overrideAttrs
28031 - };
28032 - tr.delete($from.pos, $to.pos);
28033 - const types = nextType ? [{
28034 - type,
28035 - attrs: newTypeAttributes
28036 - }, {
28037 - type: nextType,
28038 - attrs: newNextTypeAttributes
28039 - }] : [{
28040 - type,
28041 - attrs: newTypeAttributes
28042 - }];
28043 - if (!canSplit(tr.doc, $from.pos, 2)) return false;
28044 - if (dispatch) {
28045 - const { selection, storedMarks } = state;
28046 - const { splittableMarks } = editor.extensionManager;
28047 - const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
28048 - tr.split($from.pos, 2, types).scrollIntoView();
28049 - if (!marks || !dispatch) return true;
28050 - const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
28051 - tr.ensureMarks(filteredMarks);
28052 - }
28053 - return true;
28054 - };
28055 - var joinListBackwards = (tr, listType) => {
28056 - const list = findParentNode((node) => node.type === listType)(tr.selection);
28057 - if (!list) return true;
28058 - const before = tr.doc.resolve(Math.max(0, list.pos - 1)).before(list.depth);
28059 - if (before === void 0) return true;
28060 - const nodeBefore = tr.doc.nodeAt(before);
28061 - if (!(list.node.type === (nodeBefore == null ? void 0 : nodeBefore.type) && canJoin(tr.doc, list.pos))) return true;
28062 - tr.join(list.pos);
28063 - return true;
28064 - };
28065 - var joinListForwards = (tr, listType) => {
28066 - const list = findParentNode((node) => node.type === listType)(tr.selection);
28067 - if (!list) return true;
28068 - const after = tr.doc.resolve(list.start).after(list.depth);
28069 - if (after === void 0) return true;
28070 - const nodeAfter = tr.doc.nodeAt(after);
28071 - if (!(list.node.type === (nodeAfter == null ? void 0 : nodeAfter.type) && canJoin(tr.doc, after))) return true;
28072 - tr.join(after);
28073 - return true;
28074 - };
28075 - var toggleList = (listTypeOrName, itemTypeOrName, keepMarks, attributes = {}) => ({ editor, tr, state, dispatch, chain, commands, can }) => {
28076 - const { extensions, splittableMarks } = editor.extensionManager;
28077 - const listType = getNodeType(listTypeOrName, state.schema);
28078 - const itemType = getNodeType(itemTypeOrName, state.schema);
28079 - const { selection, storedMarks } = state;
28080 - const { $from, $to } = selection;
28081 - const range = $from.blockRange($to);
28082 - const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
28083 - if (!range) return false;
28084 - const parentList = findParentNode((node) => isList(node.type.name, extensions))(selection);
28085 - if (range.depth >= 1 && parentList && range.depth - parentList.depth <= 1) {
28086 - if (parentList.node.type === listType) return commands.liftListItem(itemType);
28087 - if (isList(parentList.node.type.name, extensions) && listType.validContent(parentList.node.content) && dispatch) return chain().command(() => {
28088 - tr.setNodeMarkup(parentList.pos, listType);
28089 - return true;
28090 - }).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
28091 - }
28092 - if (!keepMarks || !marks || !dispatch) return chain().command(() => {
28093 - if (can().wrapInList(listType, attributes)) return true;
28094 - return commands.clearNodes();
28095 - }).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
28096 - return chain().command(() => {
28097 - const canWrapInList = can().wrapInList(listType, attributes);
28098 - const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
28099 - tr.ensureMarks(filteredMarks);
28100 - if (canWrapInList) return true;
28101 - return commands.clearNodes();
28102 - }).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();
28103 - };
28104 - var toggleMark = (typeOrName, attributes = {}, options = {}) => ({ state, commands }) => {
28105 - const { extendEmptyMarkRange = false } = options;
28106 - const type = getMarkType(typeOrName, state.schema);
28107 - if (isMarkActive(state, type, attributes)) return commands.unsetMark(type, { extendEmptyMarkRange });
28108 - return commands.setMark(type, attributes);
28109 - };
28110 - var toggleNode = (typeOrName, toggleTypeOrName, attributes = {}) => ({ state, commands }) => {
28111 - const type = getNodeType(typeOrName, state.schema);
28112 - const toggleType = getNodeType(toggleTypeOrName, state.schema);
28113 - const isActive2 = isNodeActive(state, type, attributes);
28114 - let attributesToCopy;
28115 - if (state.selection.$anchor.sameParent(state.selection.$head)) attributesToCopy = state.selection.$anchor.parent.attrs;
28116 - if (isActive2) return commands.setNode(toggleType, attributesToCopy);
28117 - return commands.setNode(type, {
28118 - ...attributesToCopy,
28119 - ...attributes
28120 - });
28121 - };
28122 - var toggleWrap = (typeOrName, attributes = {}) => ({ state, commands }) => {
28123 - const type = getNodeType(typeOrName, state.schema);
28124 - if (isNodeActive(state, type, attributes)) return commands.lift(type);
28125 - return commands.wrapIn(type, attributes);
28126 - };
28127 - var undoInputRule = () => ({ state, dispatch }) => {
28128 - const plugins = state.plugins;
28129 - for (let i = 0; i < plugins.length; i += 1) {
28130 - const plugin = plugins[i];
28131 - let undoable;
28132 - if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {
28133 - if (dispatch) {
28134 - const tr = state.tr;
28135 - const toUndo = undoable.transform;
28136 - for (let j = toUndo.steps.length - 1; j >= 0; j -= 1) tr.step(toUndo.steps[j].invert(toUndo.docs[j]));
28137 - if (undoable.text) {
28138 - const marks = tr.doc.resolve(undoable.from).marks();
28139 - tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));
28140 - } else tr.delete(undoable.from, undoable.to);
28141 - }
28142 - return true;
28143 - }
28144 - }
28145 - return false;
28146 - };
28147 - var unsetAllMarks = () => ({ tr, dispatch }) => {
28148 - const { selection } = tr;
28149 - const { empty, ranges } = selection;
28150 - if (empty) return true;
28151 - if (dispatch) ranges.forEach((range) => {
28152 - tr.removeMark(range.$from.pos, range.$to.pos);
28153 - });
28154 - return true;
28155 - };
28156 - var unsetMark = (typeOrName, options = {}) => ({ tr, state, dispatch }) => {
28157 - var _a;
28158 - const { extendEmptyMarkRange = false } = options;
28159 - const { selection } = tr;
28160 - const type = getMarkType(typeOrName, state.schema);
28161 - const { $from, empty, ranges } = selection;
28162 - if (!dispatch) return true;
28163 - if (empty && extendEmptyMarkRange) {
28164 - let { from, to } = selection;
28165 - const range = getMarkRange($from, type, (_a = $from.marks().find((mark) => mark.type === type)) == null ? void 0 : _a.attrs);
28166 - if (range) {
28167 - from = range.from;
28168 - to = range.to;
28169 - }
28170 - tr.removeMark(from, to, type);
28171 - } else ranges.forEach((range) => {
28172 - tr.removeMark(range.$from.pos, range.$to.pos, type);
28173 - });
28174 - tr.removeStoredMark(type);
28175 - return true;
28176 - };
28177 - var unsetTextDirection = (position) => ({ tr, state, dispatch }) => {
28178 - const { selection } = state;
28179 - let from;
28180 - let to;
28181 - if (typeof position === "number") {
28182 - from = position;
28183 - to = position;
28184 - } else if (position && "from" in position && "to" in position) {
28185 - from = position.from;
28186 - to = position.to;
28187 - } else {
28188 - from = selection.from;
28189 - to = selection.to;
28190 - }
28191 - if (dispatch) tr.doc.nodesBetween(from, to, (node, pos) => {
28192 - if (node.isText) return;
28193 - const newAttrs = { ...node.attrs };
28194 - delete newAttrs.dir;
28195 - tr.setNodeMarkup(pos, void 0, newAttrs);
28196 - });
28197 - return true;
28198 - };
28199 - var updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
28200 - let nodeType = null;
28201 - let markType = null;
28202 - const schemaType = getSchemaTypeNameByName(typeof typeOrName === "string" ? typeOrName : typeOrName.name, state.schema);
28203 - if (!schemaType) return false;
28204 - if (schemaType === "node") nodeType = getNodeType(typeOrName, state.schema);
28205 - if (schemaType === "mark") markType = getMarkType(typeOrName, state.schema);
28206 - let canUpdate = false;
28207 - tr.selection.ranges.forEach((range) => {
28208 - const from = range.$from.pos;
28209 - const to = range.$to.pos;
28210 - let lastPos;
28211 - let lastNode;
28212 - let trimmedFrom;
28213 - let trimmedTo;
28214 - if (tr.selection.empty) state.doc.nodesBetween(from, to, (node, pos) => {
28215 - if (nodeType && nodeType === node.type) {
28216 - canUpdate = true;
28217 - trimmedFrom = Math.max(pos, from);
28218 - trimmedTo = Math.min(pos + node.nodeSize, to);
28219 - lastPos = pos;
28220 - lastNode = node;
28221 - }
28222 - });
28223 - else state.doc.nodesBetween(from, to, (node, pos) => {
28224 - if (pos < from && nodeType && nodeType === node.type) {
28225 - canUpdate = true;
28226 - trimmedFrom = Math.max(pos, from);
28227 - trimmedTo = Math.min(pos + node.nodeSize, to);
28228 - lastPos = pos;
28229 - lastNode = node;
28230 - }
28231 - if (pos >= from && pos <= to) {
28232 - if (nodeType && nodeType === node.type) {
28233 - canUpdate = true;
28234 - if (dispatch) tr.setNodeMarkup(pos, void 0, {
28235 - ...node.attrs,
28236 - ...attributes
28237 - });
28238 - }
28239 - if (markType && node.marks.length) node.marks.forEach((mark) => {
28240 - if (markType === mark.type) {
28241 - canUpdate = true;
28242 - if (dispatch) {
28243 - const trimmedFrom2 = Math.max(pos, from);
28244 - const trimmedTo2 = Math.min(pos + node.nodeSize, to);
28245 - tr.addMark(trimmedFrom2, trimmedTo2, markType.create({
28246 - ...mark.attrs,
28247 - ...attributes
28248 - }));
28249 - }
28250 - }
28251 - });
28252 - }
28253 - });
28254 - if (lastNode) {
28255 - if (lastPos !== void 0 && dispatch) tr.setNodeMarkup(lastPos, void 0, {
28256 - ...lastNode.attrs,
28257 - ...attributes
28258 - });
28259 - if (markType && lastNode.marks.length) lastNode.marks.forEach((mark) => {
28260 - if (markType === mark.type && dispatch) tr.addMark(trimmedFrom, trimmedTo, markType.create({
28261 - ...mark.attrs,
28262 - ...attributes
28263 - }));
28264 - });
28265 - }
28266 - });
28267 - return canUpdate;
28268 - };
28269 - var wrapIn = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
28270 - return wrapIn$1(getNodeType(typeOrName, state.schema), attributes)(state, dispatch);
28271 - };
28272 - var wrapInList = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
28273 - return wrapInList$1(getNodeType(typeOrName, state.schema), attributes)(state, dispatch);
28274 - };
28275 - var EventEmitter = class {
28276 - constructor() {
28277 - this.callbacks = {};
28278 - }
28279 - on(event, fn) {
28280 - if (!this.callbacks[event]) this.callbacks[event] = [];
28281 - this.callbacks[event].push(fn);
28282 - return this;
28283 - }
28284 - emit(event, ...args) {
28285 - const callbacks = this.callbacks[event];
28286 - if (callbacks) callbacks.forEach((callback) => callback.apply(this, args));
28287 - return this;
28288 - }
28289 - off(event, fn) {
28290 - const callbacks = this.callbacks[event];
28291 - if (callbacks) if (fn) this.callbacks[event] = callbacks.filter((callback) => callback !== fn);
28292 - else delete this.callbacks[event];
28293 - return this;
28294 - }
28295 - once(event, fn) {
28296 - const onceFn = (...args) => {
28297 - this.off(event, onceFn);
28298 - fn.apply(this, args);
28299 - };
28300 - return this.on(event, onceFn);
28301 - }
28302 - removeAllListeners() {
28303 - this.callbacks = {};
28304 - }
28305 - };
28306 - var InputRule = class {
28307 - constructor(config) {
28308 - var _a;
28309 - this.find = config.find;
28310 - this.handler = config.handler;
28311 - this.undoable = (_a = config.undoable) != null ? _a : true;
28312 - }
28313 - };
28314 - var inputRuleMatcherHandler = (text, find) => {
28315 - if (isRegExp(find)) return find.exec(text);
28316 - const inputRuleMatch = find(text);
28317 - if (!inputRuleMatch) return null;
28318 - const result = [inputRuleMatch.text];
28319 - result.index = inputRuleMatch.index;
28320 - result.input = text;
28321 - result.data = inputRuleMatch.data;
28322 - if (inputRuleMatch.replaceWith) {
28323 - if (!inputRuleMatch.text.includes(inputRuleMatch.replaceWith)) console.warn("[tiptap warn]: \"inputRuleMatch.replaceWith\" must be part of \"inputRuleMatch.text\".");
28324 - result.push(inputRuleMatch.replaceWith);
28325 - }
28326 - return result;
28327 - };
28328 - function run$2(config) {
28329 - var _a;
28330 - const { editor, from, to, text, rules, plugin } = config;
28331 - const { view } = editor;
28332 - if (view.composing) return false;
28333 - const $from = view.state.doc.resolve(from);
28334 - if ($from.parent.type.spec.code || !!((_a = $from.nodeBefore || $from.nodeAfter) == null ? void 0 : _a.marks.find((mark) => mark.type.spec.code))) return false;
28335 - let matched = false;
28336 - const textBefore = getTextContentFromNodes($from) + text;
28337 - rules.forEach((rule) => {
28338 - if (matched) return;
28339 - const match = inputRuleMatcherHandler(textBefore, rule.find);
28340 - if (!match) return;
28341 - const tr = view.state.tr;
28342 - const state = createChainableState({
28343 - state: view.state,
28344 - transaction: tr
28345 - });
28346 - const range = {
28347 - from: from - (match[0].length - text.length),
28348 - to
28349 - };
28350 - const { commands, chain, can } = new CommandManager({
28351 - editor,
28352 - state
28353 - });
28354 - if (rule.handler({
28355 - state,
28356 - range,
28357 - match,
28358 - commands,
28359 - chain,
28360 - can
28361 - }) === null || !tr.steps.length) return;
28362 - if (rule.undoable) tr.setMeta(plugin, {
28363 - transform: tr,
28364 - from,
28365 - to,
28366 - text
28367 - });
28368 - view.dispatch(tr);
28369 - matched = true;
28370 - });
28371 - return matched;
28372 - }
28373 - __name(run$2, "run");
28374 - function inputRulesPlugin(props) {
28375 - const { editor, rules } = props;
28376 - const plugin = new Plugin({
28377 - state: {
28378 - init() {
28379 - return null;
28380 - },
28381 - apply(tr, prev, state) {
28382 - const stored = tr.getMeta(plugin);
28383 - if (stored) return stored;
28384 - const simulatedInputMeta = tr.getMeta("applyInputRules");
28385 - if (!!simulatedInputMeta) setTimeout(() => {
28386 - let { text } = simulatedInputMeta;
28387 - if (typeof text === "string") text = text;
28388 - else text = getHTMLFromFragment(Fragment$1.from(text), state.schema);
28389 - const { from } = simulatedInputMeta;
28390 - const to = from + text.length;
28391 - run$2({
28392 - editor,
28393 - from,
28394 - to,
28395 - text,
28396 - rules,
28397 - plugin
28398 - });
28399 - });
28400 - return tr.selectionSet || tr.docChanged ? null : prev;
28401 - }
28402 - },
28403 - props: {
28404 - handleTextInput(view, from, to, text) {
28405 - return run$2({
28406 - editor,
28407 - from,
28408 - to,
28409 - text,
28410 - rules,
28411 - plugin
28412 - });
28413 - },
28414 - handleDOMEvents: { compositionend: (view) => {
28415 - setTimeout(() => {
28416 - const { $cursor } = view.state.selection;
28417 - if ($cursor) run$2({
28418 - editor,
28419 - from: $cursor.pos,
28420 - to: $cursor.pos,
28421 - text: "",
28422 - rules,
28423 - plugin
28424 - });
28425 - });
28426 - return false;
28427 - } },
28428 - handleKeyDown(view, event) {
28429 - if (event.key !== "Enter") return false;
28430 - const { $cursor } = view.state.selection;
28431 - if ($cursor) return run$2({
28432 - editor,
28433 - from: $cursor.pos,
28434 - to: $cursor.pos,
28435 - text: "\n",
28436 - rules,
28437 - plugin
28438 - });
28439 - return false;
28440 - }
28441 - },
28442 - isInputRules: true
28443 - });
28444 - return plugin;
28445 - }
28446 - function getType(value) {
28447 - return Object.prototype.toString.call(value).slice(8, -1);
28448 - }
28449 - function isPlainObject(value) {
28450 - if (getType(value) !== "Object") return false;
28451 - return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;
28452 - }
28453 - function mergeDeep(target, source) {
28454 - const output = { ...target };
28455 - if (isPlainObject(target) && isPlainObject(source)) Object.keys(source).forEach((key) => {
28456 - if (isPlainObject(source[key]) && isPlainObject(target[key])) output[key] = mergeDeep(target[key], source[key]);
28457 - else output[key] = source[key];
28458 - });
28459 - return output;
28460 - }
28461 - var Extendable = class {
28462 - constructor(config = {}) {
28463 - this.type = "extendable";
28464 - this.parent = null;
28465 - this.child = null;
28466 - this.name = "";
28467 - this.config = { name: this.name };
28468 - this.config = {
28469 - ...this.config,
28470 - ...config
28471 - };
28472 - this.name = this.config.name;
28473 - }
28474 - get options() {
28475 - return { ...callOrReturn(getExtensionField(this, "addOptions", { name: this.name })) || {} };
28476 - }
28477 - get storage() {
28478 - return { ...callOrReturn(getExtensionField(this, "addStorage", {
28479 - name: this.name,
28480 - options: this.options
28481 - })) || {} };
28482 - }
28483 - configure(options = {}) {
28484 - const extension = this.extend({
28485 - ...this.config,
28486 - addOptions: () => {
28487 - return mergeDeep(this.options, options);
28488 - }
28489 - });
28490 - extension.name = this.name;
28491 - extension.parent = this.parent;
28492 - return extension;
28493 - }
28494 - extend(extendedConfig = {}) {
28495 - const extension = new this.constructor({
28496 - ...this.config,
28497 - ...extendedConfig
28498 - });
28499 - extension.parent = this;
28500 - this.child = extension;
28501 - extension.name = "name" in extendedConfig ? extendedConfig.name : extension.parent.name;
28502 - return extension;
28503 - }
28504 - };
28505 - var Mark = class _Mark extends Extendable {
28506 - constructor() {
28507 - super(...arguments);
28508 - this.type = "mark";
28509 - }
28510 - /**
28511 - * Create a new Mark instance
28512 - * @param config - Mark configuration object or a function that returns a configuration object
28513 - */
28514 - static create(config = {}) {
28515 - const resolvedConfig = typeof config === "function" ? config() : config;
28516 - return new _Mark(resolvedConfig);
28517 - }
28518 - static handleExit({ editor, mark }) {
28519 - const { tr } = editor.state;
28520 - const currentPos = editor.state.selection.$from;
28521 - if (currentPos.pos === currentPos.end()) {
28522 - const currentMarks = currentPos.marks();
28523 - if (!!!currentMarks.find((m) => (m == null ? void 0 : m.type.name) === mark.name)) return false;
28524 - const removeMark = currentMarks.find((m) => (m == null ? void 0 : m.type.name) === mark.name);
28525 - if (removeMark) tr.removeStoredMark(removeMark);
28526 - tr.insertText(" ", currentPos.pos);
28527 - editor.view.dispatch(tr);
28528 - return true;
28529 - }
28530 - return false;
28531 - }
28532 - configure(options) {
28533 - return super.configure(options);
28534 - }
28535 - extend(extendedConfig) {
28536 - const resolvedConfig = typeof extendedConfig === "function" ? extendedConfig() : extendedConfig;
28537 - return super.extend(resolvedConfig);
28538 - }
28539 - };
28540 - function isNumber(value) {
28541 - return typeof value === "number";
28542 - }
28543 - var PasteRule = class {
28544 - constructor(config) {
28545 - this.find = config.find;
28546 - this.handler = config.handler;
28547 - }
28548 - };
28549 - var pasteRuleMatcherHandler = (text, find, event) => {
28550 - if (isRegExp(find)) return [...text.matchAll(find)];
28551 - const matches = find(text, event);
28552 - if (!matches) return [];
28553 - return matches.map((pasteRuleMatch) => {
28554 - const result = [pasteRuleMatch.text];
28555 - result.index = pasteRuleMatch.index;
28556 - result.input = text;
28557 - result.data = pasteRuleMatch.data;
28558 - if (pasteRuleMatch.replaceWith) {
28559 - if (!pasteRuleMatch.text.includes(pasteRuleMatch.replaceWith)) console.warn("[tiptap warn]: \"pasteRuleMatch.replaceWith\" must be part of \"pasteRuleMatch.text\".");
28560 - result.push(pasteRuleMatch.replaceWith);
28561 - }
28562 - return result;
28563 - });
28564 - };
28565 - function run2(config) {
28566 - const { editor, state, from, to, rule, pasteEvent, dropEvent } = config;
28567 - const { commands, chain, can } = new CommandManager({
28568 - editor,
28569 - state
28570 - });
28571 - const handlers = [];
28572 - state.doc.nodesBetween(from, to, (node, pos) => {
28573 - var _a;
28574 - var _b;
28575 - var _c;
28576 - var _d;
28577 - var _e;
28578 - if (((_b = (_a = node.type) == null ? void 0 : _a.spec) == null ? void 0 : _b.code) || !(node.isText || node.isTextblock || node.isInline)) return;
28579 - const contentSize = (_e = (_d = (_c = node.content) == null ? void 0 : _c.size) != null ? _d : node.nodeSize) != null ? _e : 0;
28580 - const resolvedFrom = Math.max(from, pos);
28581 - const resolvedTo = Math.min(to, pos + contentSize);
28582 - if (resolvedFrom >= resolvedTo) return;
28583 - pasteRuleMatcherHandler(node.isText ? node.text || "" : node.textBetween(resolvedFrom - pos, resolvedTo - pos, void 0, ""), rule.find, pasteEvent).forEach((match) => {
28584 - if (match.index === void 0) return;
28585 - const start = resolvedFrom + match.index + 1;
28586 - const end = start + match[0].length;
28587 - const range = {
28588 - from: state.tr.mapping.map(start),
28589 - to: state.tr.mapping.map(end)
28590 - };
28591 - const handler = rule.handler({
28592 - state,
28593 - range,
28594 - match,
28595 - commands,
28596 - chain,
28597 - can,
28598 - pasteEvent,
28599 - dropEvent
28600 - });
28601 - handlers.push(handler);
28602 - });
28603 - });
28604 - return handlers.every((handler) => handler !== null);
28605 - }
28606 - var tiptapDragFromOtherEditor = null;
28607 - var createClipboardPasteEvent = (text) => {
28608 - var _a;
28609 - const event = new ClipboardEvent("paste", { clipboardData: new DataTransfer() });
28610 - (_a = event.clipboardData) == null || _a.setData("text/html", text);
28611 - return event;
28612 - };
28613 - function pasteRulesPlugin(props) {
28614 - const { editor, rules } = props;
28615 - let dragSourceElement = null;
28616 - let isPastedFromProseMirror = false;
28617 - let isDroppedFromProseMirror = false;
28618 - let pasteEvent = typeof ClipboardEvent !== "undefined" ? new ClipboardEvent("paste") : null;
28619 - let dropEvent;
28620 - try {
28621 - dropEvent = typeof DragEvent !== "undefined" ? new DragEvent("drop") : null;
28622 - } catch {
28623 - dropEvent = null;
28624 - }
28625 - const processEvent = ({ state, from, to, rule, pasteEvt }) => {
28626 - const tr = state.tr;
28627 - const chainableState = createChainableState({
28628 - state,
28629 - transaction: tr
28630 - });
28631 - if (!run2({
28632 - editor,
28633 - state: chainableState,
28634 - from: Math.max(from - 1, 0),
28635 - to: to.b - 1,
28636 - rule,
28637 - pasteEvent: pasteEvt,
28638 - dropEvent
28639 - }) || !tr.steps.length) return;
28640 - try {
28641 - dropEvent = typeof DragEvent !== "undefined" ? new DragEvent("drop") : null;
28642 - } catch {
28643 - dropEvent = null;
28644 - }
28645 - pasteEvent = typeof ClipboardEvent !== "undefined" ? new ClipboardEvent("paste") : null;
28646 - return tr;
28647 - };
28648 - return rules.map((rule) => {
28649 - return new Plugin({
28650 - view(view) {
28651 - const handleDragstart = (event) => {
28652 - var _a;
28653 - dragSourceElement = ((_a = view.dom.parentElement) == null ? void 0 : _a.contains(event.target)) ? view.dom.parentElement : null;
28654 - if (dragSourceElement) tiptapDragFromOtherEditor = editor;
28655 - };
28656 - const handleDragend = () => {
28657 - if (tiptapDragFromOtherEditor) tiptapDragFromOtherEditor = null;
28658 - };
28659 - window.addEventListener("dragstart", handleDragstart);
28660 - window.addEventListener("dragend", handleDragend);
28661 - return { destroy() {
28662 - window.removeEventListener("dragstart", handleDragstart);
28663 - window.removeEventListener("dragend", handleDragend);
28664 - } };
28665 - },
28666 - props: { handleDOMEvents: {
28667 - drop: (view, event) => {
28668 - isDroppedFromProseMirror = dragSourceElement === view.dom.parentElement;
28669 - dropEvent = event;
28670 - if (!isDroppedFromProseMirror) {
28671 - const dragFromOtherEditor = tiptapDragFromOtherEditor;
28672 - if (dragFromOtherEditor == null ? void 0 : dragFromOtherEditor.isEditable) setTimeout(() => {
28673 - const selection = dragFromOtherEditor.state.selection;
28674 - if (selection) dragFromOtherEditor.commands.deleteRange({
28675 - from: selection.from,
28676 - to: selection.to
28677 - });
28678 - }, 10);
28679 - }
28680 - return false;
28681 - },
28682 - paste: (_view, event) => {
28683 - var _a;
28684 - const html = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/html");
28685 - pasteEvent = event;
28686 - isPastedFromProseMirror = !!(html == null ? void 0 : html.includes("data-pm-slice"));
28687 - return false;
28688 - }
28689 - } },
28690 - appendTransaction: (transactions, oldState, state) => {
28691 - const transaction = transactions[0];
28692 - const isPaste = transaction.getMeta("uiEvent") === "paste" && !isPastedFromProseMirror;
28693 - const isDrop = transaction.getMeta("uiEvent") === "drop" && !isDroppedFromProseMirror;
28694 - const simulatedPasteMeta = transaction.getMeta("applyPasteRules");
28695 - const isSimulatedPaste = !!simulatedPasteMeta;
28696 - if (!isPaste && !isDrop && !isSimulatedPaste) return;
28697 - if (isSimulatedPaste) {
28698 - let { text } = simulatedPasteMeta;
28699 - if (typeof text === "string") text = text;
28700 - else text = getHTMLFromFragment(Fragment$1.from(text), state.schema);
28701 - const { from: from2 } = simulatedPasteMeta;
28702 - const to2 = from2 + text.length;
28703 - const pasteEvt = createClipboardPasteEvent(text);
28704 - return processEvent({
28705 - rule,
28706 - state,
28707 - from: from2,
28708 - to: { b: to2 },
28709 - pasteEvt
28710 - });
28711 - }
28712 - const from = oldState.doc.content.findDiffStart(state.doc.content);
28713 - const to = oldState.doc.content.findDiffEnd(state.doc.content);
28714 - if (!isNumber(from) || !to || from === to.b) return;
28715 - return processEvent({
28716 - rule,
28717 - state,
28718 - from,
28719 - to,
28720 - pasteEvt: pasteEvent
28721 - });
28722 - }
28723 - });
28724 - });
28725 - }
28726 - var ExtensionManager = class {
28727 - constructor(extensions, editor) {
28728 - this.splittableMarks = [];
28729 - this.editor = editor;
28730 - this.baseExtensions = extensions;
28731 - this.extensions = resolveExtensions(extensions);
28732 - this.schema = getSchemaByResolvedExtensions(this.extensions, editor);
28733 - this.setupExtensions();
28734 - }
28735 - /**
28736 - * Get all commands from the extensions.
28737 - * @returns An object with all commands where the key is the command name and the value is the command function
28738 - */
28739 - get commands() {
28740 - return this.extensions.reduce((commands, extension) => {
28741 - const addCommands = getExtensionField(extension, "addCommands", {
28742 - name: extension.name,
28743 - options: extension.options,
28744 - storage: this.editor.extensionStorage[extension.name],
28745 - editor: this.editor,
28746 - type: getSchemaTypeByName(extension.name, this.schema)
28747 - });
28748 - if (!addCommands) return commands;
28749 - return {
28750 - ...commands,
28751 - ...addCommands()
28752 - };
28753 - }, {});
28754 - }
28755 - /**
28756 - * Get all registered Prosemirror plugins from the extensions.
28757 - * @returns An array of Prosemirror plugins
28758 - */
28759 - get plugins() {
28760 - const { editor } = this;
28761 - return sortExtensions([...this.extensions].reverse()).flatMap((extension) => {
28762 - const context = {
28763 - name: extension.name,
28764 - options: extension.options,
28765 - storage: this.editor.extensionStorage[extension.name],
28766 - editor,
28767 - type: getSchemaTypeByName(extension.name, this.schema)
28768 - };
28769 - const plugins = [];
28770 - const addKeyboardShortcuts = getExtensionField(extension, "addKeyboardShortcuts", context);
28771 - let defaultBindings = {};
28772 - if (extension.type === "mark" && getExtensionField(extension, "exitable", context)) defaultBindings.ArrowRight = () => Mark.handleExit({
28773 - editor,
28774 - mark: extension
28775 - });
28776 - if (addKeyboardShortcuts) {
28777 - const bindings = Object.fromEntries(Object.entries(addKeyboardShortcuts()).map(([shortcut, method]) => {
28778 - return [shortcut, () => method({ editor })];
28779 - }));
28780 - defaultBindings = {
28781 - ...defaultBindings,
28782 - ...bindings
28783 - };
28784 - }
28785 - const keyMapPlugin = keymap(defaultBindings);
28786 - plugins.push(keyMapPlugin);
28787 - const addInputRules = getExtensionField(extension, "addInputRules", context);
28788 - if (isExtensionRulesEnabled(extension, editor.options.enableInputRules) && addInputRules) {
28789 - const rules = addInputRules();
28790 - if (rules && rules.length) {
28791 - const inputResult = inputRulesPlugin({
28792 - editor,
28793 - rules
28794 - });
28795 - const inputPlugins = Array.isArray(inputResult) ? inputResult : [inputResult];
28796 - plugins.push(...inputPlugins);
28797 - }
28798 - }
28799 - const addPasteRules = getExtensionField(extension, "addPasteRules", context);
28800 - if (isExtensionRulesEnabled(extension, editor.options.enablePasteRules) && addPasteRules) {
28801 - const rules = addPasteRules();
28802 - if (rules && rules.length) {
28803 - const pasteRules = pasteRulesPlugin({
28804 - editor,
28805 - rules
28806 - });
28807 - plugins.push(...pasteRules);
28808 - }
28809 - }
28810 - const addProseMirrorPlugins = getExtensionField(extension, "addProseMirrorPlugins", context);
28811 - if (addProseMirrorPlugins) {
28812 - const proseMirrorPlugins = addProseMirrorPlugins();
28813 - plugins.push(...proseMirrorPlugins);
28814 - }
28815 - return plugins;
28816 - });
28817 - }
28818 - /**
28819 - * Get all attributes from the extensions.
28820 - * @returns An array of attributes
28821 - */
28822 - get attributes() {
28823 - return getAttributesFromExtensions(this.extensions);
28824 - }
28825 - /**
28826 - * Get all node views from the extensions.
28827 - * @returns An object with all node views where the key is the node name and the value is the node view function
28828 - */
28829 - get nodeViews() {
28830 - const { editor } = this;
28831 - const { nodeExtensions } = splitExtensions(this.extensions);
28832 - return Object.fromEntries(nodeExtensions.filter((extension) => !!getExtensionField(extension, "addNodeView")).map((extension) => {
28833 - const extensionAttributes = this.attributes.filter((attribute) => attribute.type === extension.name);
28834 - const addNodeView = getExtensionField(extension, "addNodeView", {
28835 - name: extension.name,
28836 - options: extension.options,
28837 - storage: this.editor.extensionStorage[extension.name],
28838 - editor,
28839 - type: getNodeType(extension.name, this.schema)
28840 - });
28841 - if (!addNodeView) return [];
28842 - const nodeViewResult = addNodeView();
28843 - if (!nodeViewResult) return [];
28844 - const nodeview = (node, view, getPos, decorations, innerDecorations) => {
28845 - const HTMLAttributes = getRenderedAttributes(node, extensionAttributes);
28846 - return nodeViewResult({
28847 - node,
28848 - view,
28849 - getPos,
28850 - decorations,
28851 - innerDecorations,
28852 - editor,
28853 - extension,
28854 - HTMLAttributes
28855 - });
28856 - };
28857 - return [extension.name, nodeview];
28858 - }));
28859 - }
28860 - /**
28861 - * Get the composed dispatchTransaction function from all extensions.
28862 - * @param baseDispatch The base dispatch function (e.g. from the editor or user props)
28863 - * @returns A composed dispatch function
28864 - */
28865 - dispatchTransaction(baseDispatch) {
28866 - const { editor } = this;
28867 - return sortExtensions([...this.extensions].reverse()).reduceRight((next, extension) => {
28868 - const context = {
28869 - name: extension.name,
28870 - options: extension.options,
28871 - storage: this.editor.extensionStorage[extension.name],
28872 - editor,
28873 - type: getSchemaTypeByName(extension.name, this.schema)
28874 - };
28875 - const dispatchTransaction = getExtensionField(extension, "dispatchTransaction", context);
28876 - if (!dispatchTransaction) return next;
28877 - return (transaction) => {
28878 - dispatchTransaction.call(context, {
28879 - transaction,
28880 - next
28881 - });
28882 - };
28883 - }, baseDispatch);
28884 - }
28885 - /**
28886 - * Get the composed transformPastedHTML function from all extensions.
28887 - * @param baseTransform The base transform function (e.g. from the editor props)
28888 - * @returns A composed transform function that chains all extension transforms
28889 - */
28890 - transformPastedHTML(baseTransform) {
28891 - const { editor } = this;
28892 - return sortExtensions([...this.extensions]).reduce((transform, extension) => {
28893 - const context = {
28894 - name: extension.name,
28895 - options: extension.options,
28896 - storage: this.editor.extensionStorage[extension.name],
28897 - editor,
28898 - type: getSchemaTypeByName(extension.name, this.schema)
28899 - };
28900 - const extensionTransform = getExtensionField(extension, "transformPastedHTML", context);
28901 - if (!extensionTransform) return transform;
28902 - return (html, view) => {
28903 - const transformedHtml = transform(html, view);
28904 - return extensionTransform.call(context, transformedHtml);
28905 - };
28906 - }, baseTransform || ((html) => html));
28907 - }
28908 - get markViews() {
28909 - const { editor } = this;
28910 - const { markExtensions } = splitExtensions(this.extensions);
28911 - return Object.fromEntries(markExtensions.filter((extension) => !!getExtensionField(extension, "addMarkView")).map((extension) => {
28912 - const extensionAttributes = this.attributes.filter((attribute) => attribute.type === extension.name);
28913 - const addMarkView = getExtensionField(extension, "addMarkView", {
28914 - name: extension.name,
28915 - options: extension.options,
28916 - storage: this.editor.extensionStorage[extension.name],
28917 - editor,
28918 - type: getMarkType(extension.name, this.schema)
28919 - });
28920 - if (!addMarkView) return [];
28921 - const markView = (mark, view, inline) => {
28922 - const HTMLAttributes = getRenderedAttributes(mark, extensionAttributes);
28923 - return addMarkView()({
28924 - mark,
28925 - view,
28926 - inline,
28927 - editor,
28928 - extension,
28929 - HTMLAttributes,
28930 - updateAttributes: (attrs) => {
28931 - updateMarkViewAttributes(mark, editor, attrs);
28932 - }
28933 - });
28934 - };
28935 - return [extension.name, markView];
28936 - }));
28937 - }
28938 - /**
28939 - * Go through all extensions, create extension storages & setup marks
28940 - * & bind editor event listener.
28941 - */
28942 - setupExtensions() {
28943 - const extensions = this.extensions;
28944 - this.editor.extensionStorage = Object.fromEntries(extensions.map((extension) => [extension.name, extension.storage]));
28945 - extensions.forEach((extension) => {
28946 - var _a;
28947 - const context = {
28948 - name: extension.name,
28949 - options: extension.options,
28950 - storage: this.editor.extensionStorage[extension.name],
28951 - editor: this.editor,
28952 - type: getSchemaTypeByName(extension.name, this.schema)
28953 - };
28954 - if (extension.type === "mark") {
28955 - if ((_a = callOrReturn(getExtensionField(extension, "keepOnSplit", context))) != null ? _a : true) this.splittableMarks.push(extension.name);
28956 - }
28957 - const onBeforeCreate = getExtensionField(extension, "onBeforeCreate", context);
28958 - const onCreate = getExtensionField(extension, "onCreate", context);
28959 - const onUpdate = getExtensionField(extension, "onUpdate", context);
28960 - const onSelectionUpdate = getExtensionField(extension, "onSelectionUpdate", context);
28961 - const onTransaction = getExtensionField(extension, "onTransaction", context);
28962 - const onFocus = getExtensionField(extension, "onFocus", context);
28963 - const onBlur = getExtensionField(extension, "onBlur", context);
28964 - const onDestroy = getExtensionField(extension, "onDestroy", context);
28965 - if (onBeforeCreate) this.editor.on("beforeCreate", onBeforeCreate);
28966 - if (onCreate) this.editor.on("create", onCreate);
28967 - if (onUpdate) this.editor.on("update", onUpdate);
28968 - if (onSelectionUpdate) this.editor.on("selectionUpdate", onSelectionUpdate);
28969 - if (onTransaction) this.editor.on("transaction", onTransaction);
28970 - if (onFocus) this.editor.on("focus", onFocus);
28971 - if (onBlur) this.editor.on("blur", onBlur);
28972 - if (onDestroy) this.editor.on("destroy", onDestroy);
28973 - });
28974 - }
28975 - };
28976 - ExtensionManager.resolve = resolveExtensions;
28977 - ExtensionManager.sort = sortExtensions;
28978 - ExtensionManager.flatten = flattenExtensions;
28979 - var extensions_exports = {};
28980 - __export(extensions_exports, {
28981 - ClipboardTextSerializer: () => ClipboardTextSerializer,
28982 - Commands: () => Commands,
28983 - Delete: () => Delete,
28984 - Drop: () => Drop,
28985 - Editable: () => Editable,
28986 - FocusEvents: () => FocusEvents,
28987 - Keymap: () => Keymap,
28988 - Paste: () => Paste,
28989 - Tabindex: () => Tabindex,
28990 - TextDirection: () => TextDirection,
28991 - focusEventsPluginKey: () => focusEventsPluginKey
28992 - });
28993 - var Extension = class _Extension extends Extendable {
28994 - constructor() {
28995 - super(...arguments);
28996 - this.type = "extension";
28997 - }
28998 - /**
28999 - * Create a new Extension instance
29000 - * @param config - Extension configuration object or a function that returns a configuration object
29001 - */
29002 - static create(config = {}) {
29003 - const resolvedConfig = typeof config === "function" ? config() : config;
29004 - return new _Extension(resolvedConfig);
29005 - }
29006 - configure(options) {
29007 - return super.configure(options);
29008 - }
29009 - extend(extendedConfig) {
29010 - const resolvedConfig = typeof extendedConfig === "function" ? extendedConfig() : extendedConfig;
29011 - return super.extend(resolvedConfig);
29012 - }
29013 - };
29014 - var ClipboardTextSerializer = Extension.create({
29015 - name: "clipboardTextSerializer",
29016 - addOptions() {
29017 - return { blockSeparator: void 0 };
29018 - },
29019 - addProseMirrorPlugins() {
29020 - return [new Plugin({
29021 - key: new PluginKey("clipboardTextSerializer"),
29022 - props: { clipboardTextSerializer: () => {
29023 - const { editor } = this;
29024 - const { state, schema } = editor;
29025 - const { doc, selection } = state;
29026 - const { ranges } = selection;
29027 - const from = Math.min(...ranges.map((range2) => range2.$from.pos));
29028 - const to = Math.max(...ranges.map((range2) => range2.$to.pos));
29029 - const textSerializers = getTextSerializersFromSchema(schema);
29030 - return getTextBetween(doc, {
29031 - from,
29032 - to
29033 - }, {
29034 - ...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
29035 - textSerializers
29036 - });
29037 - } }
29038 - })];
29039 - }
29040 - });
29041 - var Commands = Extension.create({
29042 - name: "commands",
29043 - addCommands() {
29044 - return { ...commands_exports };
29045 - }
29046 - });
29047 - var Delete = Extension.create({
29048 - name: "delete",
29049 - onUpdate({ transaction, appendedTransactions }) {
29050 - var _a;
29051 - var _b;
29052 - var _c;
29053 - const callback = () => {
29054 - var _a2;
29055 - var _b2;
29056 - var _c2;
29057 - var _d;
29058 - if ((_d = (_c2 = (_b2 = (_a2 = this.editor.options.coreExtensionOptions) == null ? void 0 : _a2.delete) == null ? void 0 : _b2.filterTransaction) == null ? void 0 : _c2.call(_b2, transaction)) != null ? _d : transaction.getMeta("y-sync$")) return;
29059 - const nextTransaction = combineTransactionSteps(transaction.before, [transaction, ...appendedTransactions]);
29060 - getChangedRanges(nextTransaction).forEach((change) => {
29061 - if (nextTransaction.mapping.mapResult(change.oldRange.from).deletedAfter && nextTransaction.mapping.mapResult(change.oldRange.to).deletedBefore) nextTransaction.before.nodesBetween(change.oldRange.from, change.oldRange.to, (node, from) => {
29062 - const to = from + node.nodeSize - 2;
29063 - const isFullyWithinRange = change.oldRange.from <= from && to <= change.oldRange.to;
29064 - this.editor.emit("delete", {
29065 - type: "node",
29066 - node,
29067 - from,
29068 - to,
29069 - newFrom: nextTransaction.mapping.map(from),
29070 - newTo: nextTransaction.mapping.map(to),
29071 - deletedRange: change.oldRange,
29072 - newRange: change.newRange,
29073 - partial: !isFullyWithinRange,
29074 - editor: this.editor,
29075 - transaction,
29076 - combinedTransform: nextTransaction
29077 - });
29078 - });
29079 - });
29080 - const mapping = nextTransaction.mapping;
29081 - nextTransaction.steps.forEach((step, index) => {
29082 - var _a3;
29083 - var _b3;
29084 - if (step instanceof RemoveMarkStep) {
29085 - const newStart = mapping.slice(index).map(step.from, -1);
29086 - const newEnd = mapping.slice(index).map(step.to);
29087 - const oldStart = mapping.invert().map(newStart, -1);
29088 - const oldEnd = mapping.invert().map(newEnd);
29089 - const foundBeforeMark = (_a3 = nextTransaction.doc.nodeAt(newStart - 1)) == null ? void 0 : _a3.marks.some((mark) => mark.eq(step.mark));
29090 - const foundAfterMark = (_b3 = nextTransaction.doc.nodeAt(newEnd)) == null ? void 0 : _b3.marks.some((mark) => mark.eq(step.mark));
29091 - this.editor.emit("delete", {
29092 - type: "mark",
29093 - mark: step.mark,
29094 - from: step.from,
29095 - to: step.to,
29096 - deletedRange: {
29097 - from: oldStart,
29098 - to: oldEnd
29099 - },
29100 - newRange: {
29101 - from: newStart,
29102 - to: newEnd
29103 - },
29104 - partial: Boolean(foundAfterMark || foundBeforeMark),
29105 - editor: this.editor,
29106 - transaction,
29107 - combinedTransform: nextTransaction
29108 - });
29109 - }
29110 - });
29111 - };
29112 - if ((_c = (_b = (_a = this.editor.options.coreExtensionOptions) == null ? void 0 : _a.delete) == null ? void 0 : _b.async) != null ? _c : true) setTimeout(callback, 0);
29113 - else callback();
29114 - }
29115 - });
29116 - var Drop = Extension.create({
29117 - name: "drop",
29118 - addProseMirrorPlugins() {
29119 - return [new Plugin({
29120 - key: new PluginKey("tiptapDrop"),
29121 - props: { handleDrop: (_, e, slice, moved) => {
29122 - this.editor.emit("drop", {
29123 - editor: this.editor,
29124 - event: e,
29125 - slice,
29126 - moved
29127 - });
29128 - } }
29129 - })];
29130 - }
29131 - });
29132 - var Editable = Extension.create({
29133 - name: "editable",
29134 - addProseMirrorPlugins() {
29135 - return [new Plugin({
29136 - key: new PluginKey("editable"),
29137 - props: { editable: () => this.editor.options.editable }
29138 - })];
29139 - }
29140 - });
29141 - var focusEventsPluginKey = new PluginKey("focusEvents");
29142 - var FocusEvents = Extension.create({
29143 - name: "focusEvents",
29144 - addProseMirrorPlugins() {
29145 - const { editor } = this;
29146 - return [new Plugin({
29147 - key: focusEventsPluginKey,
29148 - props: { handleDOMEvents: {
29149 - focus: (view, event) => {
29150 - editor.isFocused = true;
29151 - const transaction = editor.state.tr.setMeta("focus", { event }).setMeta("addToHistory", false);
29152 - view.dispatch(transaction);
29153 - return false;
29154 - },
29155 - blur: (view, event) => {
29156 - editor.isFocused = false;
29157 - const transaction = editor.state.tr.setMeta("blur", { event }).setMeta("addToHistory", false);
29158 - view.dispatch(transaction);
29159 - return false;
29160 - }
29161 - } }
29162 - })];
29163 - }
29164 - });
29165 - var Keymap = Extension.create({
29166 - name: "keymap",
29167 - addKeyboardShortcuts() {
29168 - const handleBackspace = () => this.editor.commands.first(({ commands }) => [
29169 - () => commands.undoInputRule(),
29170 - () => commands.command(({ tr }) => {
29171 - const { selection, doc } = tr;
29172 - const { empty, $anchor } = selection;
29173 - const { pos, parent } = $anchor;
29174 - const $parentPos = $anchor.parent.isTextblock && pos > 0 ? tr.doc.resolve(pos - 1) : $anchor;
29175 - const parentIsIsolating = $parentPos.parent.type.spec.isolating;
29176 - const parentPos = $anchor.pos - $anchor.parentOffset;
29177 - const isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : Selection.atStart(doc).from === pos;
29178 - if (!empty || !parent.type.isTextblock || parent.textContent.length || !isAtStart || isAtStart && $anchor.parent.type.name === "paragraph") return false;
29179 - return commands.clearNodes();
29180 - }),
29181 - () => commands.deleteSelection(),
29182 - () => commands.joinBackward(),
29183 - () => commands.selectNodeBackward()
29184 - ]);
29185 - const handleDelete = () => this.editor.commands.first(({ commands }) => [
29186 - () => commands.deleteSelection(),
29187 - () => commands.deleteCurrentNode(),
29188 - () => commands.joinForward(),
29189 - () => commands.selectNodeForward()
29190 - ]);
29191 - const handleEnter = () => this.editor.commands.first(({ commands }) => [
29192 - () => commands.newlineInCode(),
29193 - () => commands.createParagraphNear(),
29194 - () => commands.liftEmptyBlock(),
29195 - () => commands.splitBlock()
29196 - ]);
29197 - const baseKeymap = {
29198 - Enter: handleEnter,
29199 - "Mod-Enter": () => this.editor.commands.exitCode(),
29200 - Backspace: handleBackspace,
29201 - "Mod-Backspace": handleBackspace,
29202 - "Shift-Backspace": handleBackspace,
29203 - Delete: handleDelete,
29204 - "Mod-Delete": handleDelete,
29205 - "Mod-a": () => this.editor.commands.selectAll()
29206 - };
29207 - const pcKeymap = { ...baseKeymap };
29208 - const macKeymap = {
29209 - ...baseKeymap,
29210 - "Ctrl-h": handleBackspace,
29211 - "Alt-Backspace": handleBackspace,
29212 - "Ctrl-d": handleDelete,
29213 - "Ctrl-Alt-Backspace": handleDelete,
29214 - "Alt-Delete": handleDelete,
29215 - "Alt-d": handleDelete,
29216 - "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
29217 - "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
29218 - };
29219 - if (isiOS() || isMacOS()) return macKeymap;
29220 - return pcKeymap;
29221 - },
29222 - addProseMirrorPlugins() {
29223 - return [new Plugin({
29224 - key: new PluginKey("clearDocument"),
29225 - appendTransaction: (transactions, oldState, newState) => {
29226 - if (transactions.some((tr2) => tr2.getMeta("composition"))) return;
29227 - const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);
29228 - const ignoreTr = transactions.some((transaction) => transaction.getMeta("preventClearDocument"));
29229 - if (!docChanges || ignoreTr) return;
29230 - const { empty, from, to } = oldState.selection;
29231 - const allFrom = Selection.atStart(oldState.doc).from;
29232 - const allEnd = Selection.atEnd(oldState.doc).to;
29233 - if (empty || !(from === allFrom && to === allEnd)) return;
29234 - if (!isNodeEmpty(newState.doc)) return;
29235 - const tr = newState.tr;
29236 - const state = createChainableState({
29237 - state: newState,
29238 - transaction: tr
29239 - });
29240 - const { commands } = new CommandManager({
29241 - editor: this.editor,
29242 - state
29243 - });
29244 - commands.clearNodes();
29245 - if (!tr.steps.length) return;
29246 - return tr;
29247 - }
29248 - })];
29249 - }
29250 - });
29251 - var Paste = Extension.create({
29252 - name: "paste",
29253 - addProseMirrorPlugins() {
29254 - return [new Plugin({
29255 - key: new PluginKey("tiptapPaste"),
29256 - props: { handlePaste: (_view, e, slice) => {
29257 - this.editor.emit("paste", {
29258 - editor: this.editor,
29259 - event: e,
29260 - slice
29261 - });
29262 - } }
29263 - })];
29264 - }
29265 - });
29266 - var Tabindex = Extension.create({
29267 - name: "tabindex",
29268 - addProseMirrorPlugins() {
29269 - return [new Plugin({
29270 - key: new PluginKey("tabindex"),
29271 - props: { attributes: () => this.editor.isEditable ? { tabindex: "0" } : {} }
29272 - })];
29273 - }
29274 - });
29275 - var TextDirection = Extension.create({
29276 - name: "textDirection",
29277 - addOptions() {
29278 - return { direction: void 0 };
29279 - },
29280 - addGlobalAttributes() {
29281 - if (!this.options.direction) return [];
29282 - const { nodeExtensions } = splitExtensions(this.extensions);
29283 - return [{
29284 - types: nodeExtensions.filter((extension) => extension.name !== "text").map((extension) => extension.name),
29285 - attributes: { dir: {
29286 - default: this.options.direction,
29287 - parseHTML: (element) => {
29288 - const dir = element.getAttribute("dir");
29289 - if (dir && (dir === "ltr" || dir === "rtl" || dir === "auto")) return dir;
29290 - return this.options.direction;
29291 - },
29292 - renderHTML: (attributes) => {
29293 - if (!attributes.dir) return {};
29294 - return { dir: attributes.dir };
29295 - }
29296 - } }
29297 - }];
29298 - },
29299 - addProseMirrorPlugins() {
29300 - return [new Plugin({
29301 - key: new PluginKey("textDirection"),
29302 - props: { attributes: () => {
29303 - const direction = this.options.direction;
29304 - if (!direction) return {};
29305 - return { dir: direction };
29306 - } }
29307 - })];
29308 - }
29309 - });
29310 - var NodePos = class _NodePos {
29311 - constructor(pos, editor, isBlock = false, node = null) {
29312 - this.currentNode = null;
29313 - this.actualDepth = null;
29314 - this.isBlock = isBlock;
29315 - this.resolvedPos = pos;
29316 - this.editor = editor;
29317 - this.currentNode = node;
29318 - }
29319 - get name() {
29320 - return this.node.type.name;
29321 - }
29322 - get node() {
29323 - return this.currentNode || this.resolvedPos.node();
29324 - }
29325 - get element() {
29326 - return this.editor.view.domAtPos(this.pos).node;
29327 - }
29328 - get depth() {
29329 - var _a;
29330 - return (_a = this.actualDepth) != null ? _a : this.resolvedPos.depth;
29331 - }
29332 - get pos() {
29333 - return this.resolvedPos.pos;
29334 - }
29335 - get content() {
29336 - return this.node.content;
29337 - }
29338 - set content(content) {
29339 - let from = this.from;
29340 - let to = this.to;
29341 - if (this.isBlock) {
29342 - if (this.content.size === 0) {
29343 - console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);
29344 - return;
29345 - }
29346 - from = this.from + 1;
29347 - to = this.to - 1;
29348 - }
29349 - this.editor.commands.insertContentAt({
29350 - from,
29351 - to
29352 - }, content);
29353 - }
29354 - get attributes() {
29355 - return this.node.attrs;
29356 - }
29357 - get textContent() {
29358 - return this.node.textContent;
29359 - }
29360 - get size() {
29361 - return this.node.nodeSize;
29362 - }
29363 - get from() {
29364 - if (this.isBlock) return this.pos;
29365 - return this.resolvedPos.start(this.resolvedPos.depth);
29366 - }
29367 - get range() {
29368 - return {
29369 - from: this.from,
29370 - to: this.to
29371 - };
29372 - }
29373 - get to() {
29374 - if (this.isBlock) return this.pos + this.size;
29375 - return this.resolvedPos.end(this.resolvedPos.depth) + (this.node.isText ? 0 : 1);
29376 - }
29377 - get parent() {
29378 - if (this.depth === 0) return null;
29379 - const parentPos = this.resolvedPos.start(this.resolvedPos.depth - 1);
29380 - const $pos = this.resolvedPos.doc.resolve(parentPos);
29381 - return new _NodePos($pos, this.editor);
29382 - }
29383 - get before() {
29384 - let $pos = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));
29385 - if ($pos.depth !== this.depth) $pos = this.resolvedPos.doc.resolve(this.from - 3);
29386 - return new _NodePos($pos, this.editor);
29387 - }
29388 - get after() {
29389 - let $pos = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));
29390 - if ($pos.depth !== this.depth) $pos = this.resolvedPos.doc.resolve(this.to + 3);
29391 - return new _NodePos($pos, this.editor);
29392 - }
29393 - get children() {
29394 - const children = [];
29395 - this.node.content.forEach((node, offset) => {
29396 - const isBlock = node.isBlock && !node.isTextblock;
29397 - const isNonTextAtom = node.isAtom && !node.isText;
29398 - const isInline = node.isInline;
29399 - const targetPos = this.pos + offset + (isNonTextAtom ? 0 : 1);
29400 - if (targetPos < 0 || targetPos > this.resolvedPos.doc.nodeSize - 2) return;
29401 - const $pos = this.resolvedPos.doc.resolve(targetPos);
29402 - if (!isBlock && !isInline && $pos.depth <= this.depth) return;
29403 - const childNodePos = new _NodePos($pos, this.editor, isBlock, isBlock || isInline ? node : null);
29404 - if (isBlock) childNodePos.actualDepth = this.depth + 1;
29405 - children.push(childNodePos);
29406 - });
29407 - return children;
29408 - }
29409 - get firstChild() {
29410 - return this.children[0] || null;
29411 - }
29412 - get lastChild() {
29413 - const children = this.children;
29414 - return children[children.length - 1] || null;
29415 - }
29416 - closest(selector, attributes = {}) {
29417 - let node = null;
29418 - let currentNode = this.parent;
29419 - while (currentNode && !node) {
29420 - if (currentNode.node.type.name === selector) if (Object.keys(attributes).length > 0) {
29421 - const nodeAttributes = currentNode.node.attrs;
29422 - const attrKeys = Object.keys(attributes);
29423 - for (let index = 0; index < attrKeys.length; index += 1) {
29424 - const key = attrKeys[index];
29425 - if (nodeAttributes[key] !== attributes[key]) break;
29426 - }
29427 - } else node = currentNode;
29428 - currentNode = currentNode.parent;
29429 - }
29430 - return node;
29431 - }
29432 - querySelector(selector, attributes = {}) {
29433 - return this.querySelectorAll(selector, attributes, true)[0] || null;
29434 - }
29435 - querySelectorAll(selector, attributes = {}, firstItemOnly = false) {
29436 - let nodes = [];
29437 - if (!this.children || this.children.length === 0) return nodes;
29438 - const attrKeys = Object.keys(attributes);
29439 - this.children.forEach((childPos) => {
29440 - if (firstItemOnly && nodes.length > 0) return;
29441 - if (childPos.node.type.name === selector) {
29442 - if (attrKeys.every((key) => attributes[key] === childPos.node.attrs[key])) nodes.push(childPos);
29443 - }
29444 - if (firstItemOnly && nodes.length > 0) return;
29445 - nodes = nodes.concat(childPos.querySelectorAll(selector, attributes, firstItemOnly));
29446 - });
29447 - return nodes;
29448 - }
29449 - setAttribute(attributes) {
29450 - const { tr } = this.editor.state;
29451 - tr.setNodeMarkup(this.from, void 0, {
29452 - ...this.node.attrs,
29453 - ...attributes
29454 - });
29455 - this.editor.view.dispatch(tr);
29456 - }
29457 - };
29458 - var style = `.ProseMirror {
29459 - position: relative;
29460 -}
29461 -
29462 -.ProseMirror {
29463 - word-wrap: break-word;
29464 - white-space: pre-wrap;
29465 - white-space: break-spaces;
29466 - -webkit-font-variant-ligatures: none;
29467 - font-variant-ligatures: none;
29468 - font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
29469 -}
29470 -
29471 -.ProseMirror [contenteditable="false"] {
29472 - white-space: normal;
29473 -}
29474 -
29475 -.ProseMirror [contenteditable="false"] [contenteditable="true"] {
29476 - white-space: pre-wrap;
29477 -}
29478 -
29479 -.ProseMirror pre {
29480 - white-space: pre-wrap;
29481 -}
29482 -
29483 -img.ProseMirror-separator {
29484 - display: inline !important;
29485 - border: none !important;
29486 - margin: 0 !important;
29487 - width: 0 !important;
29488 - height: 0 !important;
29489 -}
29490 -
29491 -.ProseMirror-gapcursor {
29492 - display: none;
29493 - pointer-events: none;
29494 - position: absolute;
29495 - margin: 0;
29496 -}
29497 -
29498 -.ProseMirror-gapcursor:after {
29499 - content: "";
29500 - display: block;
29501 - position: absolute;
29502 - top: -2px;
29503 - width: 20px;
29504 - border-top: 1px solid black;
29505 - animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
29506 -}
29507 -
29508 -@keyframes ProseMirror-cursor-blink {
29509 - to {
29510 - visibility: hidden;
29511 - }
29512 -}
29513 -
29514 -.ProseMirror-hideselection *::selection {
29515 - background: transparent;
29516 -}
29517 -
29518 -.ProseMirror-hideselection *::-moz-selection {
29519 - background: transparent;
29520 -}
29521 -
29522 -.ProseMirror-hideselection * {
29523 - caret-color: transparent;
29524 -}
29525 -
29526 -.ProseMirror-focused .ProseMirror-gapcursor {
29527 - display: block;
29528 -}`;
29529 - function createStyleTag(style2, nonce, suffix) {
29530 - const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : ""}]`);
29531 - if (tiptapStyleTag !== null) return tiptapStyleTag;
29532 - const styleNode = document.createElement("style");
29533 - if (nonce) styleNode.setAttribute("nonce", nonce);
29534 - styleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : ""}`, "");
29535 - styleNode.innerHTML = style2;
29536 - document.getElementsByTagName("head")[0].appendChild(styleNode);
29537 - return styleNode;
29538 - }
29539 - var Editor = class extends EventEmitter {
29540 - constructor(options = {}) {
29541 - super();
29542 - this.css = null;
29543 - this.className = "tiptap";
29544 - this.editorView = null;
29545 - this.isFocused = false;
29546 - /**
29547 - * The editor is considered initialized after the `create` event has been emitted.
29548 - */
29549 - this.isInitialized = false;
29550 - this.extensionStorage = {};
29551 - /**
29552 - * A unique ID for this editor instance.
29553 - */
29554 - this.instanceId = Math.random().toString(36).slice(2, 9);
29555 - this.options = {
29556 - element: typeof document !== "undefined" ? document.createElement("div") : null,
29557 - content: "",
29558 - injectCSS: true,
29559 - injectNonce: void 0,
29560 - extensions: [],
29561 - autofocus: false,
29562 - editable: true,
29563 - textDirection: void 0,
29564 - editorProps: {},
29565 - parseOptions: {},
29566 - coreExtensionOptions: {},
29567 - enableInputRules: true,
29568 - enablePasteRules: true,
29569 - enableCoreExtensions: true,
29570 - enableContentCheck: false,
29571 - emitContentError: false,
29572 - onBeforeCreate: () => null,
29573 - onCreate: () => null,
29574 - onMount: () => null,
29575 - onUnmount: () => null,
29576 - onUpdate: () => null,
29577 - onSelectionUpdate: () => null,
29578 - onTransaction: () => null,
29579 - onFocus: () => null,
29580 - onBlur: () => null,
29581 - onDestroy: () => null,
29582 - onContentError: ({ error }) => {
29583 - throw error;
29584 - },
29585 - onPaste: () => null,
29586 - onDrop: () => null,
29587 - onDelete: () => null,
29588 - enableExtensionDispatchTransaction: true
29589 - };
29590 - this.isCapturingTransaction = false;
29591 - this.capturedTransaction = null;
29592 - /**
29593 - * Returns a set of utilities for working with positions and ranges.
29594 - */
29595 - this.utils = {
29596 - getUpdatedPosition,
29597 - createMappablePosition
29598 - };
29599 - this.setOptions(options);
29600 - this.createExtensionManager();
29601 - this.createCommandManager();
29602 - this.createSchema();
29603 - this.on("beforeCreate", this.options.onBeforeCreate);
29604 - this.emit("beforeCreate", { editor: this });
29605 - this.on("mount", this.options.onMount);
29606 - this.on("unmount", this.options.onUnmount);
29607 - this.on("contentError", this.options.onContentError);
29608 - this.on("create", this.options.onCreate);
29609 - this.on("update", this.options.onUpdate);
29610 - this.on("selectionUpdate", this.options.onSelectionUpdate);
29611 - this.on("transaction", this.options.onTransaction);
29612 - this.on("focus", this.options.onFocus);
29613 - this.on("blur", this.options.onBlur);
29614 - this.on("destroy", this.options.onDestroy);
29615 - this.on("drop", ({ event, slice, moved }) => this.options.onDrop(event, slice, moved));
29616 - this.on("paste", ({ event, slice }) => this.options.onPaste(event, slice));
29617 - this.on("delete", this.options.onDelete);
29618 - const initialDoc = this.createDoc();
29619 - const selection = resolveFocusPosition(initialDoc, this.options.autofocus);
29620 - this.editorState = EditorState.create({
29621 - doc: initialDoc,
29622 - schema: this.schema,
29623 - selection: selection || void 0
29624 - });
29625 - if (this.options.element) this.mount(this.options.element);
29626 - }
29627 - /**
29628 - * Attach the editor to the DOM, creating a new editor view.
29629 - */
29630 - mount(el) {
29631 - if (typeof document === "undefined") throw new Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);
29632 - this.createView(el);
29633 - this.emit("mount", { editor: this });
29634 - if (this.css && !document.head.contains(this.css)) document.head.appendChild(this.css);
29635 - window.setTimeout(() => {
29636 - if (this.isDestroyed) return;
29637 - if (this.options.autofocus !== false && this.options.autofocus !== null) this.commands.focus(this.options.autofocus);
29638 - this.emit("create", { editor: this });
29639 - this.isInitialized = true;
29640 - }, 0);
29641 - }
29642 - /**
29643 - * Remove the editor from the DOM, but still allow remounting at a different point in time
29644 - */
29645 - unmount() {
29646 - if (this.editorView) {
29647 - const dom = this.editorView.dom;
29648 - if (dom == null ? void 0 : dom.editor) delete dom.editor;
29649 - this.editorView.destroy();
29650 - }
29651 - this.editorView = null;
29652 - this.isInitialized = false;
29653 - if (this.css && !document.querySelectorAll(`.${this.className}`).length) try {
29654 - if (typeof this.css.remove === "function") this.css.remove();
29655 - else if (this.css.parentNode) this.css.parentNode.removeChild(this.css);
29656 - } catch (error) {
29657 - console.warn("Failed to remove CSS element:", error);
29658 - }
29659 - this.css = null;
29660 - this.emit("unmount", { editor: this });
29661 - }
29662 - /**
29663 - * Returns the editor storage.
29664 - */
29665 - get storage() {
29666 - return this.extensionStorage;
29667 - }
29668 - /**
29669 - * An object of all registered commands.
29670 - */
29671 - get commands() {
29672 - return this.commandManager.commands;
29673 - }
29674 - /**
29675 - * Create a command chain to call multiple commands at once.
29676 - */
29677 - chain() {
29678 - return this.commandManager.chain();
29679 - }
29680 - /**
29681 - * Check if a command or a command chain can be executed. Without executing it.
29682 - */
29683 - can() {
29684 - return this.commandManager.can();
29685 - }
29686 - /**
29687 - * Inject CSS styles.
29688 - */
29689 - injectCSS() {
29690 - if (this.options.injectCSS && typeof document !== "undefined") this.css = createStyleTag(style, this.options.injectNonce);
29691 - }
29692 - /**
29693 - * Update editor options.
29694 - *
29695 - * @param options A list of options
29696 - */
29697 - setOptions(options = {}) {
29698 - this.options = {
29699 - ...this.options,
29700 - ...options
29701 - };
29702 - if (!this.editorView || !this.state || this.isDestroyed) return;
29703 - if (this.options.editorProps) this.view.setProps(this.options.editorProps);
29704 - this.view.updateState(this.state);
29705 - }
29706 - /**
29707 - * Update editable state of the editor.
29708 - */
29709 - setEditable(editable, emitUpdate = true) {
29710 - this.setOptions({ editable });
29711 - if (emitUpdate) this.emit("update", {
29712 - editor: this,
29713 - transaction: this.state.tr,
29714 - appendedTransactions: []
29715 - });
29716 - }
29717 - /**
29718 - * Returns whether the editor is editable.
29719 - */
29720 - get isEditable() {
29721 - return this.options.editable && this.view && this.view.editable;
29722 - }
29723 - /**
29724 - * Returns the editor view.
29725 - */
29726 - get view() {
29727 - if (this.editorView) return this.editorView;
29728 - return new Proxy({
29729 - state: this.editorState,
29730 - updateState: (state) => {
29731 - this.editorState = state;
29732 - },
29733 - dispatch: (tr) => {
29734 - this.dispatchTransaction(tr);
29735 - },
29736 - composing: false,
29737 - dragging: null,
29738 - editable: true,
29739 - isDestroyed: false
29740 - }, { get: (obj, key) => {
29741 - if (this.editorView) return this.editorView[key];
29742 - if (key === "state") return this.editorState;
29743 - if (key in obj) return Reflect.get(obj, key);
29744 - throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${key}']. The editor may not be mounted yet.`);
29745 - } });
29746 - }
29747 - /**
29748 - * Returns the editor state.
29749 - */
29750 - get state() {
29751 - if (this.editorView) this.editorState = this.view.state;
29752 - return this.editorState;
29753 - }
29754 - /**
29755 - * Register a ProseMirror plugin.
29756 - *
29757 - * @param plugin A ProseMirror plugin
29758 - * @param handlePlugins Control how to merge the plugin into the existing plugins.
29759 - * @returns The new editor state
29760 - */
29761 - registerPlugin(plugin, handlePlugins) {
29762 - const plugins = isFunction(handlePlugins) ? handlePlugins(plugin, [...this.state.plugins]) : [...this.state.plugins, plugin];
29763 - const state = this.state.reconfigure({ plugins });
29764 - this.view.updateState(state);
29765 - return state;
29766 - }
29767 - /**
29768 - * Unregister a ProseMirror plugin.
29769 - *
29770 - * @param nameOrPluginKeyToRemove The plugins name
29771 - * @returns The new editor state or undefined if the editor is destroyed
29772 - */
29773 - unregisterPlugin(nameOrPluginKeyToRemove) {
29774 - if (this.isDestroyed) return;
29775 - const prevPlugins = this.state.plugins;
29776 - let plugins = prevPlugins;
29777 - [].concat(nameOrPluginKeyToRemove).forEach((nameOrPluginKey) => {
29778 - const name = typeof nameOrPluginKey === "string" ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
29779 - plugins = plugins.filter((plugin) => !plugin.key.startsWith(name));
29780 - });
29781 - if (prevPlugins.length === plugins.length) return;
29782 - const state = this.state.reconfigure({ plugins });
29783 - this.view.updateState(state);
29784 - return state;
29785 - }
29786 - /**
29787 - * Creates an extension manager.
29788 - */
29789 - createExtensionManager() {
29790 - var _a;
29791 - var _b;
29792 - const allExtensions = [...this.options.enableCoreExtensions ? [
29793 - Editable,
29794 - ClipboardTextSerializer.configure({ blockSeparator: (_b = (_a = this.options.coreExtensionOptions) == null ? void 0 : _a.clipboardTextSerializer) == null ? void 0 : _b.blockSeparator }),
29795 - Commands,
29796 - FocusEvents,
29797 - Keymap,
29798 - Tabindex,
29799 - Drop,
29800 - Paste,
29801 - Delete,
29802 - TextDirection.configure({ direction: this.options.textDirection })
29803 - ].filter((ext) => {
29804 - if (typeof this.options.enableCoreExtensions === "object") return this.options.enableCoreExtensions[ext.name] !== false;
29805 - return true;
29806 - }) : [], ...this.options.extensions].filter((extension) => {
29807 - return [
29808 - "extension",
29809 - "node",
29810 - "mark"
29811 - ].includes(extension == null ? void 0 : extension.type);
29812 - });
29813 - this.extensionManager = new ExtensionManager(allExtensions, this);
29814 - }
29815 - /**
29816 - * Creates an command manager.
29817 - */
29818 - createCommandManager() {
29819 - this.commandManager = new CommandManager({ editor: this });
29820 - }
29821 - /**
29822 - * Creates a ProseMirror schema.
29823 - */
29824 - createSchema() {
29825 - this.schema = this.extensionManager.schema;
29826 - }
29827 - /**
29828 - * Creates the initial document.
29829 - */
29830 - createDoc() {
29831 - let doc;
29832 - try {
29833 - doc = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
29834 - } catch (e) {
29835 - if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) throw e;
29836 - this.emit("contentError", {
29837 - editor: this,
29838 - error: e,
29839 - disableCollaboration: () => {
29840 - if ("collaboration" in this.storage && typeof this.storage.collaboration === "object" && this.storage.collaboration) this.storage.collaboration.isDisabled = true;
29841 - this.options.extensions = this.options.extensions.filter((extension) => extension.name !== "collaboration");
29842 - this.createExtensionManager();
29843 - }
29844 - });
29845 - doc = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: false });
29846 - }
29847 - return doc;
29848 - }
29849 - /**
29850 - * Creates a ProseMirror view.
29851 - */
29852 - createView(element) {
29853 - const { editorProps, enableExtensionDispatchTransaction } = this.options;
29854 - const baseDispatch = editorProps.dispatchTransaction || this.dispatchTransaction.bind(this);
29855 - const dispatch = enableExtensionDispatchTransaction ? this.extensionManager.dispatchTransaction(baseDispatch) : baseDispatch;
29856 - const baseTransformPastedHTML = editorProps.transformPastedHTML;
29857 - const transformPastedHTML = this.extensionManager.transformPastedHTML(baseTransformPastedHTML);
29858 - this.editorView = new EditorView(element, {
29859 - ...editorProps,
29860 - attributes: {
29861 - role: "textbox",
29862 - ...editorProps == null ? void 0 : editorProps.attributes
29863 - },
29864 - dispatchTransaction: dispatch,
29865 - transformPastedHTML,
29866 - state: this.editorState,
29867 - markViews: this.extensionManager.markViews,
29868 - nodeViews: this.extensionManager.nodeViews
29869 - });
29870 - const newState = this.state.reconfigure({ plugins: this.extensionManager.plugins });
29871 - this.view.updateState(newState);
29872 - this.prependClass();
29873 - this.injectCSS();
29874 - const dom = this.view.dom;
29875 - dom.editor = this;
29876 - }
29877 - /**
29878 - * Creates all node and mark views.
29879 - */
29880 - createNodeViews() {
29881 - if (this.view.isDestroyed) return;
29882 - this.view.setProps({
29883 - markViews: this.extensionManager.markViews,
29884 - nodeViews: this.extensionManager.nodeViews
29885 - });
29886 - }
29887 - /**
29888 - * Prepend class name to element.
29889 - */
29890 - prependClass() {
29891 - this.view.dom.className = `${this.className} ${this.view.dom.className}`;
29892 - }
29893 - captureTransaction(fn) {
29894 - this.isCapturingTransaction = true;
29895 - fn();
29896 - this.isCapturingTransaction = false;
29897 - const tr = this.capturedTransaction;
29898 - this.capturedTransaction = null;
29899 - return tr;
29900 - }
29901 - /**
29902 - * The callback over which to send transactions (state updates) produced by the view.
29903 - *
29904 - * @param transaction An editor state transaction
29905 - */
29906 - dispatchTransaction(transaction) {
29907 - if (this.view.isDestroyed) return;
29908 - if (this.isCapturingTransaction) {
29909 - if (!this.capturedTransaction) {
29910 - this.capturedTransaction = transaction;
29911 - return;
29912 - }
29913 - transaction.steps.forEach((step) => {
29914 - var _a;
29915 - return (_a = this.capturedTransaction) == null ? void 0 : _a.step(step);
29916 - });
29917 - return;
29918 - }
29919 - const { state, transactions } = this.state.applyTransaction(transaction);
29920 - const selectionHasChanged = !this.state.selection.eq(state.selection);
29921 - const rootTrWasApplied = transactions.includes(transaction);
29922 - const prevState = this.state;
29923 - this.emit("beforeTransaction", {
29924 - editor: this,
29925 - transaction,
29926 - nextState: state
29927 - });
29928 - if (!rootTrWasApplied) return;
29929 - this.view.updateState(state);
29930 - this.emit("transaction", {
29931 - editor: this,
29932 - transaction,
29933 - appendedTransactions: transactions.slice(1)
29934 - });
29935 - if (selectionHasChanged) this.emit("selectionUpdate", {
29936 - editor: this,
29937 - transaction
29938 - });
29939 - const mostRecentFocusTr = transactions.findLast((tr) => tr.getMeta("focus") || tr.getMeta("blur"));
29940 - const focus2 = mostRecentFocusTr == null ? void 0 : mostRecentFocusTr.getMeta("focus");
29941 - const blur2 = mostRecentFocusTr == null ? void 0 : mostRecentFocusTr.getMeta("blur");
29942 - if (focus2) this.emit("focus", {
29943 - editor: this,
29944 - event: focus2.event,
29945 - transaction: mostRecentFocusTr
29946 - });
29947 - if (blur2) this.emit("blur", {
29948 - editor: this,
29949 - event: blur2.event,
29950 - transaction: mostRecentFocusTr
29951 - });
29952 - if (transaction.getMeta("preventUpdate") || !transactions.some((tr) => tr.docChanged) || prevState.doc.eq(state.doc)) return;
29953 - this.emit("update", {
29954 - editor: this,
29955 - transaction,
29956 - appendedTransactions: transactions.slice(1)
29957 - });
29958 - }
29959 - /**
29960 - * Get attributes of the currently selected node or mark.
29961 - */
29962 - getAttributes(nameOrType) {
29963 - return getAttributes(this.state, nameOrType);
29964 - }
29965 - isActive(nameOrAttributes, attributesOrUndefined) {
29966 - const name = typeof nameOrAttributes === "string" ? nameOrAttributes : null;
29967 - const attributes = typeof nameOrAttributes === "string" ? attributesOrUndefined : nameOrAttributes;
29968 - return isActive(this.state, name, attributes);
29969 - }
29970 - /**
29971 - * Get the document as JSON.
29972 - */
29973 - getJSON() {
29974 - return this.state.doc.toJSON();
29975 - }
29976 - /**
29977 - * Get the document as HTML.
29978 - */
29979 - getHTML() {
29980 - return getHTMLFromFragment(this.state.doc.content, this.schema);
29981 - }
29982 - /**
29983 - * Get the document as text.
29984 - */
29985 - getText(options) {
29986 - const { blockSeparator = "\n\n", textSerializers = {} } = options || {};
29987 - return getText(this.state.doc, {
29988 - blockSeparator,
29989 - textSerializers: {
29990 - ...getTextSerializersFromSchema(this.schema),
29991 - ...textSerializers
29992 - }
29993 - });
29994 - }
29995 - /**
29996 - * Check if there is no content.
29997 - */
29998 - get isEmpty() {
29999 - return isNodeEmpty(this.state.doc);
30000 - }
30001 - /**
30002 - * Destroy the editor.
30003 - */
30004 - destroy() {
30005 - this.emit("destroy");
30006 - this.unmount();
30007 - this.removeAllListeners();
30008 - }
30009 - /**
30010 - * Check if the editor is already destroyed.
30011 - */
30012 - get isDestroyed() {
30013 - var _a;
30014 - var _b;
30015 - return (_b = (_a = this.editorView) == null ? void 0 : _a.isDestroyed) != null ? _b : true;
30016 - }
30017 - $node(selector, attributes) {
30018 - var _a;
30019 - return ((_a = this.$doc) == null ? void 0 : _a.querySelector(selector, attributes)) || null;
30020 - }
30021 - $nodes(selector, attributes) {
30022 - var _a;
30023 - return ((_a = this.$doc) == null ? void 0 : _a.querySelectorAll(selector, attributes)) || null;
30024 - }
30025 - $pos(pos) {
30026 - return new NodePos(this.state.doc.resolve(pos), this);
30027 - }
30028 - get $doc() {
30029 - return this.$pos(0);
30030 - }
30031 - };
30032 - function markInputRule(config) {
30033 - return new InputRule({
30034 - find: config.find,
30035 - handler: ({ state, range, match }) => {
30036 - const attributes = callOrReturn(config.getAttributes, void 0, match);
30037 - if (attributes === false || attributes === null) return null;
30038 - const { tr } = state;
30039 - const captureGroup = match[match.length - 1];
30040 - const fullMatch = match[0];
30041 - if (captureGroup) {
30042 - const startSpaces = fullMatch.search(/\S/);
30043 - const textStart = range.from + fullMatch.indexOf(captureGroup);
30044 - const textEnd = textStart + captureGroup.length;
30045 - if (getMarksBetween(range.from, range.to, state.doc).filter((item) => {
30046 - return item.mark.type.excluded.find((type) => type === config.type && type !== item.mark.type);
30047 - }).filter((item) => item.to > textStart).length) return null;
30048 - if (textEnd < range.to) tr.delete(textEnd, range.to);
30049 - if (textStart > range.from) tr.delete(range.from + startSpaces, textStart);
30050 - const markEnd = range.from + startSpaces + captureGroup.length;
30051 - tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));
30052 - tr.removeStoredMark(config.type);
30053 - }
30054 - },
30055 - undoable: config.undoable
30056 - });
30057 - }
30058 - function textblockTypeInputRule(config) {
30059 - return new InputRule({
30060 - find: config.find,
30061 - handler: ({ state, range, match }) => {
30062 - const $start = state.doc.resolve(range.from);
30063 - const attributes = callOrReturn(config.getAttributes, void 0, match) || {};
30064 - if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), config.type)) return null;
30065 - state.tr.delete(range.from, range.to).setBlockType(range.from, range.from, config.type, attributes);
30066 - },
30067 - undoable: config.undoable
30068 - });
30069 - }
30070 - var markdown_exports = {};
30071 - __export(markdown_exports, {
30072 - createAtomBlockMarkdownSpec: () => createAtomBlockMarkdownSpec,
30073 - createBlockMarkdownSpec: () => createBlockMarkdownSpec,
30074 - createInlineMarkdownSpec: () => createInlineMarkdownSpec,
30075 - parseAttributes: () => parseAttributes,
30076 - parseIndentedBlocks: () => parseIndentedBlocks,
30077 - renderNestedMarkdownContent: () => renderNestedMarkdownContent,
30078 - serializeAttributes: () => serializeAttributes
30079 - });
30080 - function parseAttributes(attrString) {
30081 - if (!(attrString == null ? void 0 : attrString.trim())) return {};
30082 - const attributes = {};
30083 - const quotedStrings = [];
30084 - const tempString = attrString.replace(/["']([^"']*)["']/g, (match) => {
30085 - quotedStrings.push(match);
30086 - return `__QUOTED_${quotedStrings.length - 1}__`;
30087 - });
30088 - const classMatches = tempString.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);
30089 - if (classMatches) attributes.class = classMatches.map((match) => match.trim().slice(1)).join(" ");
30090 - const idMatch = tempString.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);
30091 - if (idMatch) attributes.id = idMatch[1];
30092 - Array.from(tempString.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([, key, quotedRef]) => {
30093 - var _a;
30094 - const quotedIndex = parseInt(((_a = quotedRef.match(/__QUOTED_(\d+)__/)) == null ? void 0 : _a[1]) || "0", 10);
30095 - const quotedValue = quotedStrings[quotedIndex];
30096 - if (quotedValue) attributes[key] = quotedValue.slice(1, -1);
30097 - });
30098 - const cleanString = tempString.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g, "").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g, "").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g, "").trim();
30099 - if (cleanString) cleanString.split(/\s+/).filter(Boolean).forEach((attr) => {
30100 - if (attr.match(/^[a-zA-Z][\w-]*$/)) attributes[attr] = true;
30101 - });
30102 - return attributes;
30103 - }
30104 - function serializeAttributes(attributes) {
30105 - if (!attributes || Object.keys(attributes).length === 0) return "";
30106 - const parts = [];
30107 - if (attributes.class) String(attributes.class).split(/\s+/).filter(Boolean).forEach((cls) => parts.push(`.${cls}`));
30108 - if (attributes.id) parts.push(`#${attributes.id}`);
30109 - Object.entries(attributes).forEach(([key, value]) => {
30110 - if (key === "class" || key === "id") return;
30111 - if (value === true) parts.push(key);
30112 - else if (value !== false && value != null) parts.push(`${key}="${String(value)}"`);
30113 - });
30114 - return parts.join(" ");
30115 - }
30116 - function createAtomBlockMarkdownSpec(options) {
30117 - const { nodeName, name: markdownName, parseAttributes: parseAttributes2 = parseAttributes, serializeAttributes: serializeAttributes2 = serializeAttributes, defaultAttributes = {}, requiredAttributes = [], allowedAttributes } = options;
30118 - const blockName = markdownName || nodeName;
30119 - const filterAttributes = (attrs) => {
30120 - if (!allowedAttributes) return attrs;
30121 - const filtered = {};
30122 - allowedAttributes.forEach((key) => {
30123 - if (key in attrs) filtered[key] = attrs[key];
30124 - });
30125 - return filtered;
30126 - };
30127 - return {
30128 - parseMarkdown: (token, h2) => {
30129 - const attrs = {
30130 - ...defaultAttributes,
30131 - ...token.attributes
30132 - };
30133 - return h2.createNode(nodeName, attrs, []);
30134 - },
30135 - markdownTokenizer: {
30136 - name: nodeName,
30137 - level: "block",
30138 - start(src) {
30139 - var _a;
30140 - const regex = new RegExp(`^:::${blockName}(?:\\s|$)`, "m");
30141 - const index = (_a = src.match(regex)) == null ? void 0 : _a.index;
30142 - return index !== void 0 ? index : -1;
30143 - },
30144 - tokenize(src, _tokens, _lexer) {
30145 - const regex = new RegExp(`^:::${blockName}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`);
30146 - const match = src.match(regex);
30147 - if (!match) return;
30148 - const attrString = match[1] || "";
30149 - const attributes = parseAttributes2(attrString);
30150 - if (requiredAttributes.find((required) => !(required in attributes))) return;
30151 - return {
30152 - type: nodeName,
30153 - raw: match[0],
30154 - attributes
30155 - };
30156 - }
30157 - },
30158 - renderMarkdown: (node) => {
30159 - const filteredAttrs = filterAttributes(node.attrs || {});
30160 - const attrs = serializeAttributes2(filteredAttrs);
30161 - const attrString = attrs ? ` {${attrs}}` : "";
30162 - return `:::${blockName}${attrString} :::`;
30163 - }
30164 - };
30165 - }
30166 - function createBlockMarkdownSpec(options) {
30167 - const { nodeName, name: markdownName, getContent, parseAttributes: parseAttributes2 = parseAttributes, serializeAttributes: serializeAttributes2 = serializeAttributes, defaultAttributes = {}, content = "block", allowedAttributes } = options;
30168 - const blockName = markdownName || nodeName;
30169 - const filterAttributes = (attrs) => {
30170 - if (!allowedAttributes) return attrs;
30171 - const filtered = {};
30172 - allowedAttributes.forEach((key) => {
30173 - if (key in attrs) filtered[key] = attrs[key];
30174 - });
30175 - return filtered;
30176 - };
30177 - return {
30178 - parseMarkdown: (token, h2) => {
30179 - let nodeContent;
30180 - if (getContent) {
30181 - const contentResult = getContent(token);
30182 - nodeContent = typeof contentResult === "string" ? [{
30183 - type: "text",
30184 - text: contentResult
30185 - }] : contentResult;
30186 - } else if (content === "block") nodeContent = h2.parseChildren(token.tokens || []);
30187 - else nodeContent = h2.parseInline(token.tokens || []);
30188 - const attrs = {
30189 - ...defaultAttributes,
30190 - ...token.attributes
30191 - };
30192 - return h2.createNode(nodeName, attrs, nodeContent);
30193 - },
30194 - markdownTokenizer: {
30195 - name: nodeName,
30196 - level: "block",
30197 - start(src) {
30198 - var _a;
30199 - const regex = new RegExp(`^:::${blockName}`, "m");
30200 - const index = (_a = src.match(regex)) == null ? void 0 : _a.index;
30201 - return index !== void 0 ? index : -1;
30202 - },
30203 - tokenize(src, _tokens, lexer) {
30204 - var _a;
30205 - const openingRegex = new RegExp(`^:::${blockName}(?:\\s+\\{([^}]*)\\})?\\s*\\n`);
30206 - const openingMatch = src.match(openingRegex);
30207 - if (!openingMatch) return;
30208 - const [openingTag, attrString = ""] = openingMatch;
30209 - const attributes = parseAttributes2(attrString);
30210 - let level = 1;
30211 - const position = openingTag.length;
30212 - let matchedContent = "";
30213 - const blockPattern = /^:::([\w-]*)(\s.*)?/gm;
30214 - const remaining = src.slice(position);
30215 - blockPattern.lastIndex = 0;
30216 - for (;;) {
30217 - const match = blockPattern.exec(remaining);
30218 - if (match === null) break;
30219 - const matchPos = match.index;
30220 - const blockType = match[1];
30221 - if ((_a = match[2]) == null ? void 0 : _a.endsWith(":::")) continue;
30222 - if (blockType) level += 1;
30223 - else {
30224 - level -= 1;
30225 - if (level === 0) {
30226 - const rawContent = remaining.slice(0, matchPos);
30227 - matchedContent = rawContent.trim();
30228 - const fullMatch = src.slice(0, position + matchPos + match[0].length);
30229 - let contentTokens = [];
30230 - if (matchedContent) if (content === "block") {
30231 - contentTokens = lexer.blockTokens(rawContent);
30232 - contentTokens.forEach((token) => {
30233 - if (token.text && (!token.tokens || token.tokens.length === 0)) token.tokens = lexer.inlineTokens(token.text);
30234 - });
30235 - while (contentTokens.length > 0) {
30236 - const lastToken = contentTokens[contentTokens.length - 1];
30237 - if (lastToken.type === "paragraph" && (!lastToken.text || lastToken.text.trim() === "")) contentTokens.pop();
30238 - else break;
30239 - }
30240 - } else contentTokens = lexer.inlineTokens(matchedContent);
30241 - return {
30242 - type: nodeName,
30243 - raw: fullMatch,
30244 - attributes,
30245 - content: matchedContent,
30246 - tokens: contentTokens
30247 - };
30248 - }
30249 - }
30250 - }
30251 - }
30252 - },
30253 - renderMarkdown: (node, h2) => {
30254 - const filteredAttrs = filterAttributes(node.attrs || {});
30255 - const attrs = serializeAttributes2(filteredAttrs);
30256 - const attrString = attrs ? ` {${attrs}}` : "";
30257 - const renderedContent = h2.renderChildren(node.content || [], "\n\n");
30258 - return `:::${blockName}${attrString}
30259 -
30260 -${renderedContent}
30261 -
30262 -:::`;
30263 - }
30264 - };
30265 - }
30266 - function parseShortcodeAttributes(attrString) {
30267 - if (!attrString.trim()) return {};
30268 - const attributes = {};
30269 - const regex = /(\w+)=(?:"([^"]*)"|'([^']*)')/g;
30270 - let match = regex.exec(attrString);
30271 - while (match !== null) {
30272 - const [, key, doubleQuoted, singleQuoted] = match;
30273 - attributes[key] = doubleQuoted || singleQuoted;
30274 - match = regex.exec(attrString);
30275 - }
30276 - return attributes;
30277 - }
30278 - function serializeShortcodeAttributes(attrs) {
30279 - return Object.entries(attrs).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => `${key}="${value}"`).join(" ");
30280 - }
30281 - function createInlineMarkdownSpec(options) {
30282 - const { nodeName, name: shortcodeName, getContent, parseAttributes: parseAttributes2 = parseShortcodeAttributes, serializeAttributes: serializeAttributes2 = serializeShortcodeAttributes, defaultAttributes = {}, selfClosing = false, allowedAttributes } = options;
30283 - const shortcode = shortcodeName || nodeName;
30284 - const filterAttributes = (attrs) => {
30285 - if (!allowedAttributes) return attrs;
30286 - const filtered = {};
30287 - allowedAttributes.forEach((attr) => {
30288 - const attrName = typeof attr === "string" ? attr : attr.name;
30289 - const skipIfDefault = typeof attr === "string" ? void 0 : attr.skipIfDefault;
30290 - if (attrName in attrs) {
30291 - const value = attrs[attrName];
30292 - if (skipIfDefault !== void 0 && value === skipIfDefault) return;
30293 - filtered[attrName] = value;
30294 - }
30295 - });
30296 - return filtered;
30297 - };
30298 - const escapedShortcode = shortcode.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
30299 - return {
30300 - parseMarkdown: (token, h2) => {
30301 - const attrs = {
30302 - ...defaultAttributes,
30303 - ...token.attributes
30304 - };
30305 - if (selfClosing) return h2.createNode(nodeName, attrs);
30306 - const content = getContent ? getContent(token) : token.content || "";
30307 - if (content) return h2.createNode(nodeName, attrs, [h2.createTextNode(content)]);
30308 - return h2.createNode(nodeName, attrs, []);
30309 - },
30310 - markdownTokenizer: {
30311 - name: nodeName,
30312 - level: "inline",
30313 - start(src) {
30314 - const startPattern = selfClosing ? new RegExp(`\\[${escapedShortcode}\\s*[^\\]]*\\]`) : new RegExp(`\\[${escapedShortcode}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${escapedShortcode}\\]`);
30315 - const match = src.match(startPattern);
30316 - const index = match == null ? void 0 : match.index;
30317 - return index !== void 0 ? index : -1;
30318 - },
30319 - tokenize(src, _tokens, _lexer) {
30320 - const tokenPattern = selfClosing ? new RegExp(`^\\[${escapedShortcode}\\s*([^\\]]*)\\]`) : new RegExp(`^\\[${escapedShortcode}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${escapedShortcode}\\]`);
30321 - const match = src.match(tokenPattern);
30322 - if (!match) return;
30323 - let content = "";
30324 - let attrString = "";
30325 - if (selfClosing) {
30326 - const [, attrs] = match;
30327 - attrString = attrs;
30328 - } else {
30329 - const [, attrs, contentMatch] = match;
30330 - attrString = attrs;
30331 - content = contentMatch || "";
30332 - }
30333 - const attributes = parseAttributes2(attrString.trim());
30334 - return {
30335 - type: nodeName,
30336 - raw: match[0],
30337 - content: content.trim(),
30338 - attributes
30339 - };
30340 - }
30341 - },
30342 - renderMarkdown: (node) => {
30343 - let content = "";
30344 - if (getContent) content = getContent(node);
30345 - else if (node.content && node.content.length > 0) content = node.content.filter((child) => child.type === "text").map((child) => child.text).join("");
30346 - const filteredAttrs = filterAttributes(node.attrs || {});
30347 - const attrs = serializeAttributes2(filteredAttrs);
30348 - const attrString = attrs ? ` ${attrs}` : "";
30349 - if (selfClosing) return `[${shortcode}${attrString}]`;
30350 - return `[${shortcode}${attrString}]${content}[/${shortcode}]`;
30351 - }
30352 - };
30353 - }
30354 - function parseIndentedBlocks(src, config, lexer) {
30355 - var _a;
30356 - var _b;
30357 - var _c;
30358 - var _d;
30359 - const lines = src.split("\n");
30360 - const items = [];
30361 - let totalRaw = "";
30362 - let i = 0;
30363 - const baseIndentSize = config.baseIndentSize || 2;
30364 - while (i < lines.length) {
30365 - const currentLine = lines[i];
30366 - const itemMatch = currentLine.match(config.itemPattern);
30367 - if (!itemMatch) if (items.length > 0) break;
30368 - else if (currentLine.trim() === "") {
30369 - i += 1;
30370 - totalRaw = `${totalRaw}${currentLine}
30371 -`;
30372 - continue;
30373 - } else return;
30374 - const itemData = config.extractItemData(itemMatch);
30375 - const { indentLevel, mainContent } = itemData;
30376 - totalRaw = `${totalRaw}${currentLine}
30377 -`;
30378 - const itemContent = [mainContent];
30379 - i += 1;
30380 - while (i < lines.length) {
30381 - const nextLine = lines[i];
30382 - if (nextLine.trim() === "") {
30383 - const nextNonEmptyIndex = lines.slice(i + 1).findIndex((l) => l.trim() !== "");
30384 - if (nextNonEmptyIndex === -1) break;
30385 - if ((((_b = (_a = lines[i + 1 + nextNonEmptyIndex].match(/^(\s*)/)) == null ? void 0 : _a[1]) == null ? void 0 : _b.length) || 0) > indentLevel) {
30386 - itemContent.push(nextLine);
30387 - totalRaw = `${totalRaw}${nextLine}
30388 -`;
30389 - i += 1;
30390 - continue;
30391 - } else break;
30392 - }
30393 - if ((((_d = (_c = nextLine.match(/^(\s*)/)) == null ? void 0 : _c[1]) == null ? void 0 : _d.length) || 0) > indentLevel) {
30394 - itemContent.push(nextLine);
30395 - totalRaw = `${totalRaw}${nextLine}
30396 -`;
30397 - i += 1;
30398 - } else break;
30399 - }
30400 - let nestedTokens;
30401 - const nestedContent = itemContent.slice(1);
30402 - if (nestedContent.length > 0) {
30403 - const dedentedNested = nestedContent.map((nestedLine) => nestedLine.slice(indentLevel + baseIndentSize)).join("\n");
30404 - if (dedentedNested.trim()) if (config.customNestedParser) nestedTokens = config.customNestedParser(dedentedNested);
30405 - else nestedTokens = lexer.blockTokens(dedentedNested);
30406 - }
30407 - const token = config.createToken(itemData, nestedTokens);
30408 - items.push(token);
30409 - }
30410 - if (items.length === 0) return;
30411 - return {
30412 - items,
30413 - raw: totalRaw
30414 - };
30415 - }
30416 - function renderNestedMarkdownContent(node, h2, prefixOrGenerator, ctx) {
30417 - if (!node || !Array.isArray(node.content)) return "";
30418 - const prefix = typeof prefixOrGenerator === "function" ? prefixOrGenerator(ctx) : prefixOrGenerator;
30419 - const [content, ...children] = node.content;
30420 - const output = [`${prefix}${h2.renderChildren([content])}`];
30421 - if (children && children.length > 0) children.forEach((child) => {
30422 - const childContent = h2.renderChildren([child]);
30423 - if (childContent) {
30424 - const indentedChild = childContent.split("\n").map((line) => line ? h2.indent(line) : "").join("\n");
30425 - output.push(indentedChild);
30426 - }
30427 - });
30428 - return output.join("\n");
30429 - }
30430 - function updateMarkViewAttributes(checkMark, editor, attrs = {}) {
30431 - const { state } = editor;
30432 - const { doc, tr } = state;
30433 - const thisMark = checkMark;
30434 - doc.descendants((node, pos) => {
30435 - const from = tr.mapping.map(pos);
30436 - const to = tr.mapping.map(pos) + node.nodeSize;
30437 - let foundMark = null;
30438 - node.marks.forEach((mark) => {
30439 - if (mark !== thisMark) return false;
30440 - foundMark = mark;
30441 - });
30442 - if (!foundMark) return;
30443 - let needsUpdate = false;
30444 - Object.keys(attrs).forEach((k) => {
30445 - if (attrs[k] !== foundMark.attrs[k]) needsUpdate = true;
30446 - });
30447 - if (needsUpdate) {
30448 - const updatedMark = checkMark.type.create({
30449 - ...checkMark.attrs,
30450 - ...attrs
30451 - });
30452 - tr.removeMark(from, to, checkMark.type);
30453 - tr.addMark(from, to, updatedMark);
30454 - }
30455 - });
30456 - if (tr.docChanged) editor.view.dispatch(tr);
30457 - }
30458 - var Node3 = class _Node extends Extendable {
30459 - constructor() {
30460 - super(...arguments);
30461 - this.type = "node";
30462 - }
30463 - /**
30464 - * Create a new Node instance
30465 - * @param config - Node configuration object or a function that returns a configuration object
30466 - */
30467 - static create(config = {}) {
30468 - const resolvedConfig = typeof config === "function" ? config() : config;
30469 - return new _Node(resolvedConfig);
30470 - }
30471 - configure(options) {
30472 - return super.configure(options);
30473 - }
30474 - extend(extendedConfig) {
30475 - const resolvedConfig = typeof extendedConfig === "function" ? extendedConfig() : extendedConfig;
30476 - return super.extend(resolvedConfig);
30477 - }
30478 - };
30479 - function markPasteRule(config) {
30480 - return new PasteRule({
30481 - find: config.find,
30482 - handler: ({ state, range, match, pasteEvent }) => {
30483 - const attributes = callOrReturn(config.getAttributes, void 0, match, pasteEvent);
30484 - if (attributes === false || attributes === null) return null;
30485 - const { tr } = state;
30486 - const captureGroup = match[match.length - 1];
30487 - const fullMatch = match[0];
30488 - let markEnd = range.to;
30489 - if (captureGroup) {
30490 - const startSpaces = fullMatch.search(/\S/);
30491 - const textStart = range.from + fullMatch.indexOf(captureGroup);
30492 - const textEnd = textStart + captureGroup.length;
30493 - if (getMarksBetween(range.from, range.to, state.doc).filter((item) => {
30494 - return item.mark.type.excluded.find((type) => type === config.type && type !== item.mark.type);
30495 - }).filter((item) => item.to > textStart).length) return null;
30496 - if (textEnd < range.to) tr.delete(textEnd, range.to);
30497 - if (textStart > range.from) tr.delete(range.from + startSpaces, textStart);
30498 - markEnd = range.from + startSpaces + captureGroup.length;
30499 - tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));
30500 - tr.removeStoredMark(config.type);
30501 - }
30502 - }
30503 - });
30504 - }
30505 -
30506 -//#endregion
30507 -//#region node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js
30508 - var h = (tag, attributes) => {
30509 - if (tag === "slot") return 0;
30510 - if (tag instanceof Function) return tag(attributes);
30511 - const { children, ...rest } = attributes != null ? attributes : {};
30512 - if (tag === "svg") throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");
30513 - return [
30514 - tag,
30515 - rest,
30516 - children
30517 - ];
30518 - };
30519 -
30520 -//#endregion
30521 -//#region node_modules/@tiptap/extension-bold/dist/index.js
30522 - var starInputRegex$1 = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/;
30523 - var starPasteRegex$1 = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g;
30524 - var underscoreInputRegex$1 = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/;
30525 - var underscorePasteRegex$1 = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g;
30526 - var Bold = Mark.create({
30527 - name: "bold",
30528 - addOptions() {
30529 - return { HTMLAttributes: {} };
30530 - },
30531 - parseHTML() {
30532 - return [
30533 - { tag: "strong" },
30534 - {
30535 - tag: "b",
30536 - getAttrs: (node) => node.style.fontWeight !== "normal" && null
30537 - },
30538 - {
30539 - style: "font-weight=400",
30540 - clearMark: (mark) => mark.type.name === this.name
30541 - },
30542 - {
30543 - style: "font-weight",
30544 - getAttrs: (value) => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null
30545 - }
30546 - ];
30547 - },
30548 - renderHTML({ HTMLAttributes }) {
30549 - return /* @__PURE__ */ h("strong", {
30550 - ...mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
30551 - children: /* @__PURE__ */ h("slot", {})
30552 - });
30553 - },
30554 - markdownTokenName: "strong",
30555 - parseMarkdown: (token, helpers) => {
30556 - return helpers.applyMark("bold", helpers.parseInline(token.tokens || []));
30557 - },
30558 - renderMarkdown: (node, h) => {
30559 - return `**${h.renderChildren(node)}**`;
30560 - },
30561 - addCommands() {
30562 - return {
30563 - setBold: () => ({ commands }) => {
30564 - return commands.setMark(this.name);
30565 - },
30566 - toggleBold: () => ({ commands }) => {
30567 - return commands.toggleMark(this.name);
30568 - },
30569 - unsetBold: () => ({ commands }) => {
30570 - return commands.unsetMark(this.name);
30571 - }
30572 - };
30573 - },
30574 - addKeyboardShortcuts() {
30575 - return {
30576 - "Mod-b": () => this.editor.commands.toggleBold(),
30577 - "Mod-B": () => this.editor.commands.toggleBold()
30578 - };
30579 - },
30580 - addInputRules() {
30581 - return [markInputRule({
30582 - find: starInputRegex$1,
30583 - type: this.type
30584 - }), markInputRule({
30585 - find: underscoreInputRegex$1,
30586 - type: this.type
30587 - })];
30588 - },
30589 - addPasteRules() {
30590 - return [markPasteRule({
30591 - find: starPasteRegex$1,
30592 - type: this.type
30593 - }), markPasteRule({
30594 - find: underscorePasteRegex$1,
30595 - type: this.type
30596 - })];
30597 - }
30598 - });
30599 - var index_default$11 = Bold;
30600 -
30601 -//#endregion
30602 -//#region node_modules/@tiptap/extension-document/dist/index.js
30603 - var Document$1 = Node3.create({
30604 - name: "doc",
30605 - topNode: true,
30606 - content: "block+",
30607 - renderMarkdown: (node, h) => {
30608 - if (!node.content) return "";
30609 - return h.renderChildren(node.content, "\n\n");
30610 - }
30611 - });
30612 - var index_default$10 = Document$1;
30613 -
30614 -//#endregion
30615 -//#region node_modules/@tiptap/extension-hard-break/dist/index.js
30616 - var HardBreak = Node3.create({
30617 - name: "hardBreak",
30618 - markdownTokenName: "br",
30619 - addOptions() {
30620 - return {
30621 - keepMarks: true,
30622 - HTMLAttributes: {}
30623 - };
30624 - },
30625 - inline: true,
30626 - group: "inline",
30627 - selectable: false,
30628 - linebreakReplacement: true,
30629 - parseHTML() {
30630 - return [{ tag: "br" }];
30631 - },
30632 - renderHTML({ HTMLAttributes }) {
30633 - return ["br", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
30634 - },
30635 - renderText() {
30636 - return "\n";
30637 - },
30638 - renderMarkdown: () => `
30639 -`,
30640 - parseMarkdown: () => {
30641 - return { type: "hardBreak" };
30642 - },
30643 - addCommands() {
30644 - return { setHardBreak: () => ({ commands, chain, state, editor }) => {
30645 - return commands.first([() => commands.exitCode(), () => commands.command(() => {
30646 - const { selection, storedMarks } = state;
30647 - if (selection.$from.parent.type.spec.isolating) return false;
30648 - const { keepMarks } = this.options;
30649 - const { splittableMarks } = editor.extensionManager;
30650 - const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();
30651 - return chain().insertContent({ type: this.name }).command(({ tr, dispatch }) => {
30652 - if (dispatch && marks && keepMarks) {
30653 - const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
30654 - tr.ensureMarks(filteredMarks);
30655 - }
30656 - return true;
30657 - }).run();
30658 - })]);
30659 - } };
30660 - },
30661 - addKeyboardShortcuts() {
30662 - return {
30663 - "Mod-Enter": () => this.editor.commands.setHardBreak(),
30664 - "Shift-Enter": () => this.editor.commands.setHardBreak()
30665 - };
30666 - }
30667 - });
30668 - var index_default$9 = HardBreak;
30669 -
30670 -//#endregion
30671 -//#region node_modules/@tiptap/extension-heading/dist/index.js
30672 - var Heading = Node3.create({
30673 - name: "heading",
30674 - addOptions() {
30675 - return {
30676 - levels: [
30677 - 1,
30678 - 2,
30679 - 3,
30680 - 4,
30681 - 5,
30682 - 6
30683 - ],
30684 - HTMLAttributes: {}
30685 - };
30686 - },
30687 - content: "inline*",
30688 - group: "block",
30689 - defining: true,
30690 - addAttributes() {
30691 - return { level: {
30692 - default: 1,
30693 - rendered: false
30694 - } };
30695 - },
30696 - parseHTML() {
30697 - return this.options.levels.map((level) => ({
30698 - tag: `h${level}`,
30699 - attrs: { level }
30700 - }));
30701 - },
30702 - renderHTML({ node, HTMLAttributes }) {
30703 - return [
30704 - `h${this.options.levels.includes(node.attrs.level) ? node.attrs.level : this.options.levels[0]}`,
30705 - mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
30706 - 0
30707 - ];
30708 - },
30709 - parseMarkdown: (token, helpers) => {
30710 - return helpers.createNode("heading", { level: token.depth || 1 }, helpers.parseInline(token.tokens || []));
30711 - },
30712 - renderMarkdown: (node, h) => {
30713 - var _a;
30714 - const level = ((_a = node.attrs) == null ? void 0 : _a.level) ? parseInt(node.attrs.level, 10) : 1;
30715 - const headingChars = "#".repeat(level);
30716 - if (!node.content) return "";
30717 - return `${headingChars} ${h.renderChildren(node.content)}`;
30718 - },
30719 - addCommands() {
30720 - return {
30721 - setHeading: (attributes) => ({ commands }) => {
30722 - if (!this.options.levels.includes(attributes.level)) return false;
30723 - return commands.setNode(this.name, attributes);
30724 - },
30725 - toggleHeading: (attributes) => ({ commands }) => {
30726 - if (!this.options.levels.includes(attributes.level)) return false;
30727 - return commands.toggleNode(this.name, "paragraph", attributes);
30728 - }
30729 - };
30730 - },
30731 - addKeyboardShortcuts() {
30732 - return this.options.levels.reduce((items, level) => ({
30733 - ...items,
30734 - [`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({ level })
30735 - }), {});
30736 - },
30737 - addInputRules() {
30738 - return this.options.levels.map((level) => {
30739 - return textblockTypeInputRule({
30740 - find: new RegExp(`^(#{${Math.min(...this.options.levels)},${level}})\\s$`),
30741 - type: this.type,
30742 - getAttributes: { level }
30743 - });
30744 - });
30745 - }
30746 - });
30747 - var index_default$8 = Heading;
30748 -
30749 -//#endregion
30750 -//#region node_modules/@tiptap/extension-italic/dist/index.js
30751 - var starInputRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/;
30752 - var starPasteRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g;
30753 - var underscoreInputRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/;
30754 - var underscorePasteRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g;
30755 - var Italic = Mark.create({
30756 - name: "italic",
30757 - addOptions() {
30758 - return { HTMLAttributes: {} };
30759 - },
30760 - parseHTML() {
30761 - return [
30762 - { tag: "em" },
30763 - {
30764 - tag: "i",
30765 - getAttrs: (node) => node.style.fontStyle !== "normal" && null
30766 - },
30767 - {
30768 - style: "font-style=normal",
30769 - clearMark: (mark) => mark.type.name === this.name
30770 - },
30771 - { style: "font-style=italic" }
30772 - ];
30773 - },
30774 - renderHTML({ HTMLAttributes }) {
30775 - return [
30776 - "em",
30777 - mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
30778 - 0
30779 - ];
30780 - },
30781 - addCommands() {
30782 - return {
30783 - setItalic: () => ({ commands }) => {
30784 - return commands.setMark(this.name);
30785 - },
30786 - toggleItalic: () => ({ commands }) => {
30787 - return commands.toggleMark(this.name);
30788 - },
30789 - unsetItalic: () => ({ commands }) => {
30790 - return commands.unsetMark(this.name);
30791 - }
30792 - };
30793 - },
30794 - markdownTokenName: "em",
30795 - parseMarkdown: (token, helpers) => {
30796 - return helpers.applyMark("italic", helpers.parseInline(token.tokens || []));
30797 - },
30798 - renderMarkdown: (node, h) => {
30799 - return `*${h.renderChildren(node)}*`;
30800 - },
30801 - addKeyboardShortcuts() {
30802 - return {
30803 - "Mod-i": () => this.editor.commands.toggleItalic(),
30804 - "Mod-I": () => this.editor.commands.toggleItalic()
30805 - };
30806 - },
30807 - addInputRules() {
30808 - return [markInputRule({
30809 - find: starInputRegex,
30810 - type: this.type
30811 - }), markInputRule({
30812 - find: underscoreInputRegex,
30813 - type: this.type
30814 - })];
30815 - },
30816 - addPasteRules() {
30817 - return [markPasteRule({
30818 - find: starPasteRegex,
30819 - type: this.type
30820 - }), markPasteRule({
30821 - find: underscorePasteRegex,
30822 - type: this.type
30823 - })];
30824 - }
30825 - });
30826 - var index_default$7 = Italic;
30827 -
30828 -//#endregion
30829 -//#region node_modules/linkifyjs/dist/linkify.mjs
30830 - var encodedTlds = "aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2";
30831 - var encodedUtlds = "ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2";
30832 - /**
30833 - * Finite State Machine generation utilities
30834 - */
30835 - /**
30836 - * @template T
30837 - * @typedef {{ [group: string]: T[] }} Collections
30838 - */
30839 - /**
30840 - * @typedef {{ [group: string]: true }} Flags
30841 - */
30842 - var numeric = "numeric";
30843 - var ascii = "ascii";
30844 - var alpha = "alpha";
30845 - var asciinumeric = "asciinumeric";
30846 - var alphanumeric = "alphanumeric";
30847 - var domain = "domain";
30848 - var emoji = "emoji";
30849 - var scheme = "scheme";
30850 - var slashscheme = "slashscheme";
30851 - var whitespace = "whitespace";
30852 - /**
30853 - * @template T
30854 - * @param {string} name
30855 - * @param {Collections<T>} groups to register in
30856 - * @returns {T[]} Current list of tokens in the given collection
30857 - */
30858 - function registerGroup(name, groups) {
30859 - if (!(name in groups)) groups[name] = [];
30860 - return groups[name];
30861 - }
30862 - /**
30863 - * @template T
30864 - * @param {T} t token to add
30865 - * @param {Collections<T>} groups
30866 - * @param {Flags} flags
30867 - */
30868 - function addToGroups(t, flags, groups) {
30869 - if (flags[numeric]) {
30870 - flags[asciinumeric] = true;
30871 - flags[alphanumeric] = true;
30872 - }
30873 - if (flags[ascii]) {
30874 - flags[asciinumeric] = true;
30875 - flags[alpha] = true;
30876 - }
30877 - if (flags[asciinumeric]) flags[alphanumeric] = true;
30878 - if (flags[alpha]) flags[alphanumeric] = true;
30879 - if (flags[alphanumeric]) flags[domain] = true;
30880 - if (flags[emoji]) flags[domain] = true;
30881 - for (const k in flags) {
30882 - const group = registerGroup(k, groups);
30883 - if (group.indexOf(t) < 0) group.push(t);
30884 - }
30885 - }
30886 - /**
30887 - * @template T
30888 - * @param {T} t token to check
30889 - * @param {Collections<T>} groups
30890 - * @returns {Flags} group flags that contain this token
30891 - */
30892 - function flagsForToken(t, groups) {
30893 - const result = {};
30894 - for (const c in groups) if (groups[c].indexOf(t) >= 0) result[c] = true;
30895 - return result;
30896 - }
30897 - /**
30898 - * @template T
30899 - * @typedef {null | T } Transition
30900 - */
30901 - /**
30902 - * Define a basic state machine state. j is the list of character transitions,
30903 - * jr is the list of regex-match transitions, jd is the default state to
30904 - * transition to t is the accepting token type, if any. If this is the terminal
30905 - * state, then it does not emit a token.
30906 - *
30907 - * The template type T represents the type of the token this state accepts. This
30908 - * should be a string (such as of the token exports in `text.js`) or a
30909 - * MultiToken subclass (from `multi.js`)
30910 - *
30911 - * @template T
30912 - * @param {T} [token] Token that this state emits
30913 - */
30914 - function State(token = null) {
30915 - /** @type {{ [input: string]: State<T> }} j */
30916 - this.j = {};
30917 - /** @type {[RegExp, State<T>][]} jr */
30918 - this.jr = [];
30919 - /** @type {?State<T>} jd */
30920 - this.jd = null;
30921 - /** @type {?T} t */
30922 - this.t = token;
30923 - }
30924 - /**
30925 - * Scanner token groups
30926 - * @type Collections<string>
30927 - */
30928 - State.groups = {};
30929 - State.prototype = {
30930 - accepts() {
30931 - return !!this.t;
30932 - },
30933 - /**
30934 - * Follow an existing transition from the given input to the next state.
30935 - * Does not mutate.
30936 - * @param {string} input character or token type to transition on
30937 - * @returns {?State<T>} the next state, if any
30938 - */
30939 - go(input) {
30940 - const state = this;
30941 - const nextState = state.j[input];
30942 - if (nextState) return nextState;
30943 - for (let i = 0; i < state.jr.length; i++) {
30944 - const regex = state.jr[i][0];
30945 - const nextState = state.jr[i][1];
30946 - if (nextState && regex.test(input)) return nextState;
30947 - }
30948 - return state.jd;
30949 - },
30950 - /**
30951 - * Whether the state has a transition for the given input. Set the second
30952 - * argument to true to only look for an exact match (and not a default or
30953 - * regular-expression-based transition)
30954 - * @param {string} input
30955 - * @param {boolean} exactOnly
30956 - */
30957 - has(input, exactOnly = false) {
30958 - return exactOnly ? input in this.j : !!this.go(input);
30959 - },
30960 - /**
30961 - * Short for "transition all"; create a transition from the array of items
30962 - * in the given list to the same final resulting state.
30963 - * @param {string | string[]} inputs Group of inputs to transition on
30964 - * @param {Transition<T> | State<T>} [next] Transition options
30965 - * @param {Flags} [flags] Collections flags to add token to
30966 - * @param {Collections<T>} [groups] Master list of token groups
30967 - */
30968 - ta(inputs, next, flags, groups) {
30969 - for (let i = 0; i < inputs.length; i++) this.tt(inputs[i], next, flags, groups);
30970 - },
30971 - /**
30972 - * Short for "take regexp transition"; defines a transition for this state
30973 - * when it encounters a token which matches the given regular expression
30974 - * @param {RegExp} regexp Regular expression transition (populate first)
30975 - * @param {T | State<T>} [next] Transition options
30976 - * @param {Flags} [flags] Collections flags to add token to
30977 - * @param {Collections<T>} [groups] Master list of token groups
30978 - * @returns {State<T>} taken after the given input
30979 - */
30980 - tr(regexp, next, flags, groups) {
30981 - groups = groups || State.groups;
30982 - let nextState;
30983 - if (next && next.j) nextState = next;
30984 - else {
30985 - nextState = new State(next);
30986 - if (flags && groups) addToGroups(next, flags, groups);
30987 - }
30988 - this.jr.push([regexp, nextState]);
30989 - return nextState;
30990 - },
30991 - /**
30992 - * Short for "take transitions", will take as many sequential transitions as
30993 - * the length of the given input and returns the
30994 - * resulting final state.
30995 - * @param {string | string[]} input
30996 - * @param {T | State<T>} [next] Transition options
30997 - * @param {Flags} [flags] Collections flags to add token to
30998 - * @param {Collections<T>} [groups] Master list of token groups
30999 - * @returns {State<T>} taken after the given input
31000 - */
31001 - ts(input, next, flags, groups) {
31002 - let state = this;
31003 - const len = input.length;
31004 - if (!len) return state;
31005 - for (let i = 0; i < len - 1; i++) state = state.tt(input[i]);
31006 - return state.tt(input[len - 1], next, flags, groups);
31007 - },
31008 - /**
31009 - * Short for "take transition", this is a method for building/working with
31010 - * state machines.
31011 - *
31012 - * If a state already exists for the given input, returns it.
31013 - *
31014 - * If a token is specified, that state will emit that token when reached by
31015 - * the linkify engine.
31016 - *
31017 - * If no state exists, it will be initialized with some default transitions
31018 - * that resemble existing default transitions.
31019 - *
31020 - * If a state is given for the second argument, that state will be
31021 - * transitioned to on the given input regardless of what that input
31022 - * previously did.
31023 - *
31024 - * Specify a token group flags to define groups that this token belongs to.
31025 - * The token will be added to corresponding entires in the given groups
31026 - * object.
31027 - *
31028 - * @param {string} input character, token type to transition on
31029 - * @param {T | State<T>} [next] Transition options
31030 - * @param {Flags} [flags] Collections flags to add token to
31031 - * @param {Collections<T>} [groups] Master list of groups
31032 - * @returns {State<T>} taken after the given input
31033 - */
31034 - tt(input, next, flags, groups) {
31035 - groups = groups || State.groups;
31036 - const state = this;
31037 - if (next && next.j) {
31038 - state.j[input] = next;
31039 - return next;
31040 - }
31041 - const t = next;
31042 - let nextState;
31043 - let templateState = state.go(input);
31044 - if (templateState) {
31045 - nextState = new State();
31046 - Object.assign(nextState.j, templateState.j);
31047 - nextState.jr.push.apply(nextState.jr, templateState.jr);
31048 - nextState.jd = templateState.jd;
31049 - nextState.t = templateState.t;
31050 - } else nextState = new State();
31051 - if (t) {
31052 - if (groups) {
31053 - if (nextState.t && typeof nextState.t === "string") addToGroups(t, Object.assign(flagsForToken(nextState.t, groups), flags), groups);
31054 - else if (flags) addToGroups(t, flags, groups);
31055 - }
31056 - nextState.t = t;
31057 - }
31058 - state.j[input] = nextState;
31059 - return nextState;
31060 - }
31061 - };
31062 - /**
31063 - * @template T
31064 - * @param {State<T>} state
31065 - * @param {string | string[]} input
31066 - * @param {Flags} [flags]
31067 - * @param {Collections<T>} [groups]
31068 - */
31069 - var ta = (state, input, next, flags, groups) => state.ta(input, next, flags, groups);
31070 - /**
31071 - * @template T
31072 - * @param {State<T>} state
31073 - * @param {RegExp} regexp
31074 - * @param {T | State<T>} [next]
31075 - * @param {Flags} [flags]
31076 - * @param {Collections<T>} [groups]
31077 - */
31078 - var tr = (state, regexp, next, flags, groups) => state.tr(regexp, next, flags, groups);
31079 - /**
31080 - * @template T
31081 - * @param {State<T>} state
31082 - * @param {string | string[]} input
31083 - * @param {T | State<T>} [next]
31084 - * @param {Flags} [flags]
31085 - * @param {Collections<T>} [groups]
31086 - */
31087 - var ts = (state, input, next, flags, groups) => state.ts(input, next, flags, groups);
31088 - /**
31089 - * @template T
31090 - * @param {State<T>} state
31091 - * @param {string} input
31092 - * @param {T | State<T>} [next]
31093 - * @param {Collections<T>} [groups]
31094 - * @param {Flags} [flags]
31095 - */
31096 - var tt = (state, input, next, flags, groups) => state.tt(input, next, flags, groups);
31097 - /******************************************************************************
31098 - Text Tokens
31099 - Identifiers for token outputs from the regexp scanner
31100 - ******************************************************************************/
31101 - var WORD = "WORD";
31102 - var UWORD = "UWORD";
31103 - var ASCIINUMERICAL = "ASCIINUMERICAL";
31104 - var ALPHANUMERICAL = "ALPHANUMERICAL";
31105 - var LOCALHOST = "LOCALHOST";
31106 - var TLD = "TLD";
31107 - var UTLD = "UTLD";
31108 - var SCHEME = "SCHEME";
31109 - var SLASH_SCHEME = "SLASH_SCHEME";
31110 - var NUM = "NUM";
31111 - var WS = "WS";
31112 - var NL = "NL";
31113 - var OPENBRACE = "OPENBRACE";
31114 - var CLOSEBRACE = "CLOSEBRACE";
31115 - var OPENBRACKET = "OPENBRACKET";
31116 - var CLOSEBRACKET = "CLOSEBRACKET";
31117 - var OPENPAREN = "OPENPAREN";
31118 - var CLOSEPAREN = "CLOSEPAREN";
31119 - var OPENANGLEBRACKET = "OPENANGLEBRACKET";
31120 - var CLOSEANGLEBRACKET = "CLOSEANGLEBRACKET";
31121 - var FULLWIDTHLEFTPAREN = "FULLWIDTHLEFTPAREN";
31122 - var FULLWIDTHRIGHTPAREN = "FULLWIDTHRIGHTPAREN";
31123 - var LEFTCORNERBRACKET = "LEFTCORNERBRACKET";
31124 - var RIGHTCORNERBRACKET = "RIGHTCORNERBRACKET";
31125 - var LEFTWHITECORNERBRACKET = "LEFTWHITECORNERBRACKET";
31126 - var RIGHTWHITECORNERBRACKET = "RIGHTWHITECORNERBRACKET";
31127 - var FULLWIDTHLESSTHAN = "FULLWIDTHLESSTHAN";
31128 - var FULLWIDTHGREATERTHAN = "FULLWIDTHGREATERTHAN";
31129 - var AMPERSAND = "AMPERSAND";
31130 - var APOSTROPHE = "APOSTROPHE";
31131 - var ASTERISK = "ASTERISK";
31132 - var AT = "AT";
31133 - var BACKSLASH = "BACKSLASH";
31134 - var BACKTICK = "BACKTICK";
31135 - var CARET = "CARET";
31136 - var COLON = "COLON";
31137 - var COMMA = "COMMA";
31138 - var DOLLAR = "DOLLAR";
31139 - var DOT = "DOT";
31140 - var EQUALS = "EQUALS";
31141 - var EXCLAMATION = "EXCLAMATION";
31142 - var HYPHEN = "HYPHEN";
31143 - var PERCENT = "PERCENT";
31144 - var PIPE = "PIPE";
31145 - var PLUS = "PLUS";
31146 - var POUND = "POUND";
31147 - var QUERY = "QUERY";
31148 - var QUOTE = "QUOTE";
31149 - var FULLWIDTHMIDDLEDOT = "FULLWIDTHMIDDLEDOT";
31150 - var SEMI = "SEMI";
31151 - var SLASH = "SLASH";
31152 - var TILDE = "TILDE";
31153 - var UNDERSCORE = "UNDERSCORE";
31154 - var EMOJI$1 = "EMOJI";
31155 - var SYM = "SYM";
31156 - var tk = /*#__PURE__*/ Object.freeze({
31157 - __proto__: null,
31158 - ALPHANUMERICAL,
31159 - AMPERSAND,
31160 - APOSTROPHE,
31161 - ASCIINUMERICAL,
31162 - ASTERISK,
31163 - AT,
31164 - BACKSLASH,
31165 - BACKTICK,
31166 - CARET,
31167 - CLOSEANGLEBRACKET,
31168 - CLOSEBRACE,
31169 - CLOSEBRACKET,
31170 - CLOSEPAREN,
31171 - COLON,
31172 - COMMA,
31173 - DOLLAR,
31174 - DOT,
31175 - EMOJI: EMOJI$1,
31176 - EQUALS,
31177 - EXCLAMATION,
31178 - FULLWIDTHGREATERTHAN,
31179 - FULLWIDTHLEFTPAREN,
31180 - FULLWIDTHLESSTHAN,
31181 - FULLWIDTHMIDDLEDOT,
31182 - FULLWIDTHRIGHTPAREN,
31183 - HYPHEN,
31184 - LEFTCORNERBRACKET,
31185 - LEFTWHITECORNERBRACKET,
31186 - LOCALHOST,
31187 - NL,
31188 - NUM,
31189 - OPENANGLEBRACKET,
31190 - OPENBRACE,
31191 - OPENBRACKET,
31192 - OPENPAREN,
31193 - PERCENT,
31194 - PIPE,
31195 - PLUS,
31196 - POUND,
31197 - QUERY,
31198 - QUOTE,
31199 - RIGHTCORNERBRACKET,
31200 - RIGHTWHITECORNERBRACKET,
31201 - SCHEME,
31202 - SEMI,
31203 - SLASH,
31204 - SLASH_SCHEME,
31205 - SYM,
31206 - TILDE,
31207 - TLD,
31208 - UNDERSCORE,
31209 - UTLD,
31210 - UWORD,
31211 - WORD,
31212 - WS
31213 - });
31214 - var ASCII_LETTER = /[a-z]/;
31215 - var LETTER = /\p{L}/u;
31216 - var EMOJI = /\p{Emoji}/u;
31217 - var DIGIT = /\d/;
31218 - var SPACE = /\s/;
31219 - /**
31220 - The scanner provides an interface that takes a string of text as input, and
31221 - outputs an array of tokens instances that can be used for easy URL parsing.
31222 - */
31223 - var CR = "\r";
31224 - var LF = "\n";
31225 - var EMOJI_VARIATION = "️";
31226 - var EMOJI_JOINER = "‍";
31227 - var OBJECT_REPLACEMENT = "";
31228 - var tlds = null;
31229 - var utlds = null;
31230 - /**
31231 - * Scanner output token:
31232 - * - `t` is the token name (e.g., 'NUM', 'EMOJI', 'TLD')
31233 - * - `v` is the value of the token (e.g., '123', '❤️', 'com')
31234 - * - `s` is the start index of the token in the original string
31235 - * - `e` is the end index of the token in the original string
31236 - * @typedef {{t: string, v: string, s: number, e: number}} Token
31237 - */
31238 - /**
31239 - * @template T
31240 - * @typedef {{ [collection: string]: T[] }} Collections
31241 - */
31242 - /**
31243 - * Initialize the scanner character-based state machine for the given start
31244 - * state
31245 - * @param {[string, boolean][]} customSchemes List of custom schemes, where each
31246 - * item is a length-2 tuple with the first element set to the string scheme, and
31247 - * the second element set to `true` if the `://` after the scheme is optional
31248 - */
31249 - function init$2(customSchemes = []) {
31250 - /** @type Collections<string> */
31251 - const groups = {};
31252 - State.groups = groups;
31253 - /** @type State<string> */
31254 - const Start = new State();
31255 - if (tlds == null) tlds = decodeTlds(encodedTlds);
31256 - if (utlds == null) utlds = decodeTlds(encodedUtlds);
31257 - tt(Start, "'", APOSTROPHE);
31258 - tt(Start, "{", OPENBRACE);
31259 - tt(Start, "}", CLOSEBRACE);
31260 - tt(Start, "[", OPENBRACKET);
31261 - tt(Start, "]", CLOSEBRACKET);
31262 - tt(Start, "(", OPENPAREN);
31263 - tt(Start, ")", CLOSEPAREN);
31264 - tt(Start, "<", OPENANGLEBRACKET);
31265 - tt(Start, ">", CLOSEANGLEBRACKET);
31266 - tt(Start, "(", FULLWIDTHLEFTPAREN);
31267 - tt(Start, ")", FULLWIDTHRIGHTPAREN);
31268 - tt(Start, "「", LEFTCORNERBRACKET);
31269 - tt(Start, "」", RIGHTCORNERBRACKET);
31270 - tt(Start, "『", LEFTWHITECORNERBRACKET);
31271 - tt(Start, "』", RIGHTWHITECORNERBRACKET);
31272 - tt(Start, "<", FULLWIDTHLESSTHAN);
31273 - tt(Start, ">", FULLWIDTHGREATERTHAN);
31274 - tt(Start, "&", AMPERSAND);
31275 - tt(Start, "*", ASTERISK);
31276 - tt(Start, "@", AT);
31277 - tt(Start, "`", BACKTICK);
31278 - tt(Start, "^", CARET);
31279 - tt(Start, ":", COLON);
31280 - tt(Start, ",", COMMA);
31281 - tt(Start, "$", DOLLAR);
31282 - tt(Start, ".", DOT);
31283 - tt(Start, "=", EQUALS);
31284 - tt(Start, "!", EXCLAMATION);
31285 - tt(Start, "-", HYPHEN);
31286 - tt(Start, "%", PERCENT);
31287 - tt(Start, "|", PIPE);
31288 - tt(Start, "+", PLUS);
31289 - tt(Start, "#", POUND);
31290 - tt(Start, "?", QUERY);
31291 - tt(Start, "\"", QUOTE);
31292 - tt(Start, "/", SLASH);
31293 - tt(Start, ";", SEMI);
31294 - tt(Start, "~", TILDE);
31295 - tt(Start, "_", UNDERSCORE);
31296 - tt(Start, "\\", BACKSLASH);
31297 - tt(Start, "・", FULLWIDTHMIDDLEDOT);
31298 - const Num = tr(Start, DIGIT, NUM, { [numeric]: true });
31299 - tr(Num, DIGIT, Num);
31300 - const Asciinumeric = tr(Num, ASCII_LETTER, ASCIINUMERICAL, { [asciinumeric]: true });
31301 - const Alphanumeric = tr(Num, LETTER, ALPHANUMERICAL, { [alphanumeric]: true });
31302 - const Word = tr(Start, ASCII_LETTER, WORD, { [ascii]: true });
31303 - tr(Word, DIGIT, Asciinumeric);
31304 - tr(Word, ASCII_LETTER, Word);
31305 - tr(Asciinumeric, DIGIT, Asciinumeric);
31306 - tr(Asciinumeric, ASCII_LETTER, Asciinumeric);
31307 - const UWord = tr(Start, LETTER, UWORD, { [alpha]: true });
31308 - tr(UWord, ASCII_LETTER);
31309 - tr(UWord, DIGIT, Alphanumeric);
31310 - tr(UWord, LETTER, UWord);
31311 - tr(Alphanumeric, DIGIT, Alphanumeric);
31312 - tr(Alphanumeric, ASCII_LETTER);
31313 - tr(Alphanumeric, LETTER, Alphanumeric);
31314 - const Nl = tt(Start, LF, NL, { [whitespace]: true });
31315 - const Cr = tt(Start, CR, WS, { [whitespace]: true });
31316 - const Ws = tr(Start, SPACE, WS, { [whitespace]: true });
31317 - tt(Start, OBJECT_REPLACEMENT, Ws);
31318 - tt(Cr, LF, Nl);
31319 - tt(Cr, OBJECT_REPLACEMENT, Ws);
31320 - tr(Cr, SPACE, Ws);
31321 - tt(Ws, CR);
31322 - tt(Ws, LF);
31323 - tr(Ws, SPACE, Ws);
31324 - tt(Ws, OBJECT_REPLACEMENT, Ws);
31325 - const Emoji = tr(Start, EMOJI, EMOJI$1, { [emoji]: true });
31326 - tt(Emoji, "#");
31327 - tr(Emoji, EMOJI, Emoji);
31328 - tt(Emoji, EMOJI_VARIATION, Emoji);
31329 - const EmojiJoiner = tt(Emoji, EMOJI_JOINER);
31330 - tt(EmojiJoiner, "#");
31331 - tr(EmojiJoiner, EMOJI, Emoji);
31332 - const wordjr = [[ASCII_LETTER, Word], [DIGIT, Asciinumeric]];
31333 - const uwordjr = [
31334 - [ASCII_LETTER, null],
31335 - [LETTER, UWord],
31336 - [DIGIT, Alphanumeric]
31337 - ];
31338 - for (let i = 0; i < tlds.length; i++) fastts(Start, tlds[i], TLD, WORD, wordjr);
31339 - for (let i = 0; i < utlds.length; i++) fastts(Start, utlds[i], UTLD, UWORD, uwordjr);
31340 - addToGroups(TLD, {
31341 - tld: true,
31342 - ascii: true
31343 - }, groups);
31344 - addToGroups(UTLD, {
31345 - utld: true,
31346 - alpha: true
31347 - }, groups);
31348 - fastts(Start, "file", SCHEME, WORD, wordjr);
31349 - fastts(Start, "mailto", SCHEME, WORD, wordjr);
31350 - fastts(Start, "http", SLASH_SCHEME, WORD, wordjr);
31351 - fastts(Start, "https", SLASH_SCHEME, WORD, wordjr);
31352 - fastts(Start, "ftp", SLASH_SCHEME, WORD, wordjr);
31353 - fastts(Start, "ftps", SLASH_SCHEME, WORD, wordjr);
31354 - addToGroups(SCHEME, {
31355 - scheme: true,
31356 - ascii: true
31357 - }, groups);
31358 - addToGroups(SLASH_SCHEME, {
31359 - slashscheme: true,
31360 - ascii: true
31361 - }, groups);
31362 - customSchemes = customSchemes.sort((a, b) => a[0] > b[0] ? 1 : -1);
31363 - for (let i = 0; i < customSchemes.length; i++) {
31364 - const sch = customSchemes[i][0];
31365 - const flags = customSchemes[i][1] ? { [scheme]: true } : { [slashscheme]: true };
31366 - if (sch.indexOf("-") >= 0) flags[domain] = true;
31367 - else if (!ASCII_LETTER.test(sch)) flags[numeric] = true;
31368 - else if (DIGIT.test(sch)) flags[asciinumeric] = true;
31369 - else flags[ascii] = true;
31370 - ts(Start, sch, sch, flags);
31371 - }
31372 - ts(Start, "localhost", LOCALHOST, { ascii: true });
31373 - Start.jd = new State(SYM);
31374 - return {
31375 - start: Start,
31376 - tokens: Object.assign({ groups }, tk)
31377 - };
31378 - }
31379 - /**
31380 - Given a string, returns an array of TOKEN instances representing the
31381 - composition of that string.
31382 -
31383 - @method run
31384 - @param {State<string>} start scanner starting state
31385 - @param {string} str input string to scan
31386 - @return {Token[]} list of tokens, each with a type and value
31387 - */
31388 - function run$1(start, str) {
31389 - const iterable = stringToArray(str.replace(/[A-Z]/g, (c) => c.toLowerCase()));
31390 - const charCount = iterable.length;
31391 - const tokens = [];
31392 - let cursor = 0;
31393 - let charCursor = 0;
31394 - while (charCursor < charCount) {
31395 - let state = start;
31396 - let nextState = null;
31397 - let tokenLength = 0;
31398 - let latestAccepting = null;
31399 - let sinceAccepts = -1;
31400 - let charsSinceAccepts = -1;
31401 - while (charCursor < charCount && (nextState = state.go(iterable[charCursor]))) {
31402 - state = nextState;
31403 - if (state.accepts()) {
31404 - sinceAccepts = 0;
31405 - charsSinceAccepts = 0;
31406 - latestAccepting = state;
31407 - } else if (sinceAccepts >= 0) {
31408 - sinceAccepts += iterable[charCursor].length;
31409 - charsSinceAccepts++;
31410 - }
31411 - tokenLength += iterable[charCursor].length;
31412 - cursor += iterable[charCursor].length;
31413 - charCursor++;
31414 - }
31415 - cursor -= sinceAccepts;
31416 - charCursor -= charsSinceAccepts;
31417 - tokenLength -= sinceAccepts;
31418 - tokens.push({
31419 - t: latestAccepting.t,
31420 - v: str.slice(cursor - tokenLength, cursor),
31421 - s: cursor - tokenLength,
31422 - e: cursor
31423 - });
31424 - }
31425 - return tokens;
31426 - }
31427 - /**
31428 - * Convert a String to an Array of characters, taking into account that some
31429 - * characters like emojis take up two string indexes.
31430 - *
31431 - * Adapted from core-js (MIT license)
31432 - * https://github.com/zloirock/core-js/blob/2d69cf5f99ab3ea3463c395df81e5a15b68f49d9/packages/core-js/internals/string-multibyte.js
31433 - *
31434 - * @function stringToArray
31435 - * @param {string} str
31436 - * @returns {string[]}
31437 - */
31438 - function stringToArray(str) {
31439 - const result = [];
31440 - const len = str.length;
31441 - let index = 0;
31442 - while (index < len) {
31443 - let first = str.charCodeAt(index);
31444 - let second;
31445 - let char = first < 55296 || first > 56319 || index + 1 === len || (second = str.charCodeAt(index + 1)) < 56320 || second > 57343 ? str[index] : str.slice(index, index + 2);
31446 - result.push(char);
31447 - index += char.length;
31448 - }
31449 - return result;
31450 - }
31451 - /**
31452 - * Fast version of ts function for when transition defaults are well known
31453 - * @param {State<string>} state
31454 - * @param {string} input
31455 - * @param {string} t
31456 - * @param {string} defaultt
31457 - * @param {[RegExp, State<string>][]} jr
31458 - * @returns {State<string>}
31459 - */
31460 - function fastts(state, input, t, defaultt, jr) {
31461 - let next;
31462 - const len = input.length;
31463 - for (let i = 0; i < len - 1; i++) {
31464 - const char = input[i];
31465 - if (state.j[char]) next = state.j[char];
31466 - else {
31467 - next = new State(defaultt);
31468 - next.jr = jr.slice();
31469 - state.j[char] = next;
31470 - }
31471 - state = next;
31472 - }
31473 - next = new State(t);
31474 - next.jr = jr.slice();
31475 - state.j[input[len - 1]] = next;
31476 - return next;
31477 - }
31478 - /**
31479 - * Converts a string of Top-Level Domain names encoded in update-tlds.js back
31480 - * into a list of strings.
31481 - * @param {str} encoded encoded TLDs string
31482 - * @returns {str[]} original TLDs list
31483 - */
31484 - function decodeTlds(encoded) {
31485 - const words = [];
31486 - const stack = [];
31487 - let i = 0;
31488 - let digits = "0123456789";
31489 - while (i < encoded.length) {
31490 - let popDigitCount = 0;
31491 - while (digits.indexOf(encoded[i + popDigitCount]) >= 0) popDigitCount++;
31492 - if (popDigitCount > 0) {
31493 - words.push(stack.join(""));
31494 - for (let popCount = parseInt(encoded.substring(i, i + popDigitCount), 10); popCount > 0; popCount--) stack.pop();
31495 - i += popDigitCount;
31496 - } else {
31497 - stack.push(encoded[i]);
31498 - i++;
31499 - }
31500 - }
31501 - return words;
31502 - }
31503 - /**
31504 - * An object where each key is a valid DOM Event Name such as `click` or `focus`
31505 - * and each value is an event handler function.
31506 - *
31507 - * https://developer.mozilla.org/en-US/docs/Web/API/Element#events
31508 - * @typedef {?{ [event: string]: Function }} EventListeners
31509 - */
31510 - /**
31511 - * All formatted properties required to render a link, including `tagName`,
31512 - * `attributes`, `content` and `eventListeners`.
31513 - * @typedef {{ tagName: any, attributes: {[attr: string]: any}, content: string,
31514 - * eventListeners: EventListeners }} IntermediateRepresentation
31515 - */
31516 - /**
31517 - * Specify either an object described by the template type `O` or a function.
31518 - *
31519 - * The function takes a string value (usually the link's href attribute), the
31520 - * link type (`'url'`, `'hashtag`', etc.) and an internal token representation
31521 - * of the link. It should return an object of the template type `O`
31522 - * @template O
31523 - * @typedef {O | ((value: string, type: string, token: MultiToken) => O)} OptObj
31524 - */
31525 - /**
31526 - * Specify either a function described by template type `F` or an object.
31527 - *
31528 - * Each key in the object should be a link type (`'url'`, `'hashtag`', etc.). Each
31529 - * value should be a function with template type `F` that is called when the
31530 - * corresponding link type is encountered.
31531 - * @template F
31532 - * @typedef {F | { [type: string]: F}} OptFn
31533 - */
31534 - /**
31535 - * Specify either a value with template type `V`, a function that returns `V` or
31536 - * an object where each value resolves to `V`.
31537 - *
31538 - * The function takes a string value (usually the link's href attribute), the
31539 - * link type (`'url'`, `'hashtag`', etc.) and an internal token representation
31540 - * of the link. It should return an object of the template type `V`
31541 - *
31542 - * For the object, each key should be a link type (`'url'`, `'hashtag`', etc.).
31543 - * Each value should either have type `V` or a function that returns V. This
31544 - * function similarly takes a string value and a token.
31545 - *
31546 - * Example valid types for `Opt<string>`:
31547 - *
31548 - * ```js
31549 - * 'hello'
31550 - * (value, type, token) => 'world'
31551 - * { url: 'hello', email: (value, token) => 'world'}
31552 - * ```
31553 - * @template V
31554 - * @typedef {V | ((value: string, type: string, token: MultiToken) => V) | { [type: string]: V | ((value: string, token: MultiToken) => V) }} Opt
31555 - */
31556 - /**
31557 - * See available options: https://linkify.js.org/docs/options.html
31558 - * @typedef {{
31559 - * defaultProtocol?: string,
31560 - * events?: OptObj<EventListeners>,
31561 - * format?: Opt<string>,
31562 - * formatHref?: Opt<string>,
31563 - * nl2br?: boolean,
31564 - * tagName?: Opt<any>,
31565 - * target?: Opt<string>,
31566 - * rel?: Opt<string>,
31567 - * validate?: Opt<boolean>,
31568 - * truncate?: Opt<number>,
31569 - * className?: Opt<string>,
31570 - * attributes?: OptObj<({ [attr: string]: any })>,
31571 - * ignoreTags?: string[],
31572 - * render?: OptFn<((ir: IntermediateRepresentation) => any)>
31573 - * }} Opts
31574 - */
31575 - /**
31576 - * @type Required<Opts>
31577 - */
31578 - var defaults = {
31579 - defaultProtocol: "http",
31580 - events: null,
31581 - format: noop,
31582 - formatHref: noop,
31583 - nl2br: false,
31584 - tagName: "a",
31585 - target: null,
31586 - rel: null,
31587 - validate: true,
31588 - truncate: Infinity,
31589 - className: null,
31590 - attributes: null,
31591 - ignoreTags: [],
31592 - render: null
31593 - };
31594 - /**
31595 - * Utility class for linkify interfaces to apply specified
31596 - * {@link Opts formatting and rendering options}.
31597 - *
31598 - * @param {Opts | Options} [opts] Option value overrides.
31599 - * @param {(ir: IntermediateRepresentation) => any} [defaultRender] (For
31600 - * internal use) default render function that determines how to generate an
31601 - * HTML element based on a link token's derived tagName, attributes and HTML.
31602 - * Similar to render option
31603 - */
31604 - function Options(opts, defaultRender = null) {
31605 - let o = Object.assign({}, defaults);
31606 - if (opts) o = Object.assign(o, opts instanceof Options ? opts.o : opts);
31607 - const ignoredTags = o.ignoreTags;
31608 - const uppercaseIgnoredTags = [];
31609 - for (let i = 0; i < ignoredTags.length; i++) uppercaseIgnoredTags.push(ignoredTags[i].toUpperCase());
31610 - /** @protected */
31611 - this.o = o;
31612 - if (defaultRender) this.defaultRender = defaultRender;
31613 - this.ignoreTags = uppercaseIgnoredTags;
31614 - }
31615 - Options.prototype = {
31616 - o: defaults,
31617 - /**
31618 - * @type string[]
31619 - */
31620 - ignoreTags: [],
31621 - /**
31622 - * @param {IntermediateRepresentation} ir
31623 - * @returns {any}
31624 - */
31625 - defaultRender(ir) {
31626 - return ir;
31627 - },
31628 - /**
31629 - * Returns true or false based on whether a token should be displayed as a
31630 - * link based on the user options.
31631 - * @param {MultiToken} token
31632 - * @returns {boolean}
31633 - */
31634 - check(token) {
31635 - return this.get("validate", token.toString(), token);
31636 - },
31637 - /**
31638 - * Resolve an option's value based on the value of the option and the given
31639 - * params. If operator and token are specified and the target option is
31640 - * callable, automatically calls the function with the given argument.
31641 - * @template {keyof Opts} K
31642 - * @param {K} key Name of option to use
31643 - * @param {string} [operator] will be passed to the target option if it's a
31644 - * function. If not specified, RAW function value gets returned
31645 - * @param {MultiToken} [token] The token from linkify.tokenize
31646 - * @returns {Opts[K] | any}
31647 - */
31648 - get(key, operator, token) {
31649 - const isCallable = operator != null;
31650 - let option = this.o[key];
31651 - if (!option) return option;
31652 - if (typeof option === "object") {
31653 - option = token.t in option ? option[token.t] : defaults[key];
31654 - if (typeof option === "function" && isCallable) option = option(operator, token);
31655 - } else if (typeof option === "function" && isCallable) option = option(operator, token.t, token);
31656 - return option;
31657 - },
31658 - /**
31659 - * @template {keyof Opts} L
31660 - * @param {L} key Name of options object to use
31661 - * @param {string} [operator]
31662 - * @param {MultiToken} [token]
31663 - * @returns {Opts[L] | any}
31664 - */
31665 - getObj(key, operator, token) {
31666 - let obj = this.o[key];
31667 - if (typeof obj === "function" && operator != null) obj = obj(operator, token.t, token);
31668 - return obj;
31669 - },
31670 - /**
31671 - * Convert the given token to a rendered element that may be added to the
31672 - * calling-interface's DOM
31673 - * @param {MultiToken} token Token to render to an HTML element
31674 - * @returns {any} Render result; e.g., HTML string, DOM element, React
31675 - * Component, etc.
31676 - */
31677 - render(token) {
31678 - const ir = token.render(this);
31679 - return (this.get("render", null, token) || this.defaultRender)(ir, token.t, token);
31680 - }
31681 - };
31682 - function noop(val) {
31683 - return val;
31684 - }
31685 - /******************************************************************************
31686 - Multi-Tokens
31687 - Tokens composed of arrays of TextTokens
31688 - ******************************************************************************/
31689 - /**
31690 - * @param {string} value
31691 - * @param {Token[]} tokens
31692 - */
31693 - function MultiToken(value, tokens) {
31694 - this.t = "token";
31695 - this.v = value;
31696 - this.tk = tokens;
31697 - }
31698 - /**
31699 - * Abstract class used for manufacturing tokens of text tokens. That is rather
31700 - * than the value for a token being a small string of text, it's value an array
31701 - * of text tokens.
31702 - *
31703 - * Used for grouping together URLs, emails, hashtags, and other potential
31704 - * creations.
31705 - * @class MultiToken
31706 - * @property {string} t
31707 - * @property {string} v
31708 - * @property {Token[]} tk
31709 - * @abstract
31710 - */
31711 - MultiToken.prototype = {
31712 - isLink: false,
31713 - /**
31714 - * Return the string this token represents.
31715 - * @return {string}
31716 - */
31717 - toString() {
31718 - return this.v;
31719 - },
31720 - /**
31721 - * What should the value for this token be in the `href` HTML attribute?
31722 - * Returns the `.toString` value by default.
31723 - * @param {string} [scheme]
31724 - * @return {string}
31725 - */
31726 - toHref(scheme) {
31727 - return this.toString();
31728 - },
31729 - /**
31730 - * @param {Options} options Formatting options
31731 - * @returns {string}
31732 - */
31733 - toFormattedString(options) {
31734 - const val = this.toString();
31735 - const truncate = options.get("truncate", val, this);
31736 - const formatted = options.get("format", val, this);
31737 - return truncate && formatted.length > truncate ? formatted.substring(0, truncate) + "…" : formatted;
31738 - },
31739 - /**
31740 - *
31741 - * @param {Options} options
31742 - * @returns {string}
31743 - */
31744 - toFormattedHref(options) {
31745 - return options.get("formatHref", this.toHref(options.get("defaultProtocol")), this);
31746 - },
31747 - /**
31748 - * The start index of this token in the original input string
31749 - * @returns {number}
31750 - */
31751 - startIndex() {
31752 - return this.tk[0].s;
31753 - },
31754 - /**
31755 - * The end index of this token in the original input string (up to this
31756 - * index but not including it)
31757 - * @returns {number}
31758 - */
31759 - endIndex() {
31760 - return this.tk[this.tk.length - 1].e;
31761 - },
31762 - /**
31763 - Returns an object of relevant values for this token, which includes keys
31764 - * type - Kind of token ('url', 'email', etc.)
31765 - * value - Original text
31766 - * href - The value that should be added to the anchor tag's href
31767 - attribute
31768 - @method toObject
31769 - @param {string} [protocol] `'http'` by default
31770 - */
31771 - toObject(protocol = defaults.defaultProtocol) {
31772 - return {
31773 - type: this.t,
31774 - value: this.toString(),
31775 - isLink: this.isLink,
31776 - href: this.toHref(protocol),
31777 - start: this.startIndex(),
31778 - end: this.endIndex()
31779 - };
31780 - },
31781 - /**
31782 - *
31783 - * @param {Options} options Formatting option
31784 - */
31785 - toFormattedObject(options) {
31786 - return {
31787 - type: this.t,
31788 - value: this.toFormattedString(options),
31789 - isLink: this.isLink,
31790 - href: this.toFormattedHref(options),
31791 - start: this.startIndex(),
31792 - end: this.endIndex()
31793 - };
31794 - },
31795 - /**
31796 - * Whether this token should be rendered as a link according to the given options
31797 - * @param {Options} options
31798 - * @returns {boolean}
31799 - */
31800 - validate(options) {
31801 - return options.get("validate", this.toString(), this);
31802 - },
31803 - /**
31804 - * Return an object that represents how this link should be rendered.
31805 - * @param {Options} options Formattinng options
31806 - */
31807 - render(options) {
31808 - const token = this;
31809 - const href = this.toHref(options.get("defaultProtocol"));
31810 - const formattedHref = options.get("formatHref", href, this);
31811 - const tagName = options.get("tagName", href, token);
31812 - const content = this.toFormattedString(options);
31813 - const attributes = {};
31814 - const className = options.get("className", href, token);
31815 - const target = options.get("target", href, token);
31816 - const rel = options.get("rel", href, token);
31817 - const attrs = options.getObj("attributes", href, token);
31818 - const eventListeners = options.getObj("events", href, token);
31819 - attributes.href = formattedHref;
31820 - if (className) attributes.class = className;
31821 - if (target) attributes.target = target;
31822 - if (rel) attributes.rel = rel;
31823 - if (attrs) Object.assign(attributes, attrs);
31824 - return {
31825 - tagName,
31826 - attributes,
31827 - content,
31828 - eventListeners
31829 - };
31830 - }
31831 - };
31832 - /**
31833 - * Create a new token that can be emitted by the parser state machine
31834 - * @param {string} type readable type of the token
31835 - * @param {object} props properties to assign or override, including isLink = true or false
31836 - * @returns {new (value: string, tokens: Token[]) => MultiToken} new token class
31837 - */
31838 - function createTokenClass(type, props) {
31839 - class Token extends MultiToken {
31840 - constructor(value, tokens) {
31841 - super(value, tokens);
31842 - this.t = type;
31843 - }
31844 - }
31845 - for (const p in props) Token.prototype[p] = props[p];
31846 - Token.t = type;
31847 - return Token;
31848 - }
31849 - /**
31850 - Represents a list of tokens making up a valid email address
31851 - */
31852 - var Email = createTokenClass("email", {
31853 - isLink: true,
31854 - toHref() {
31855 - return "mailto:" + this.toString();
31856 - }
31857 - });
31858 - /**
31859 - Represents some plain text
31860 - */
31861 - var Text$1 = createTokenClass("text");
31862 - /**
31863 - Multi-linebreak token - represents a line break
31864 - @class Nl
31865 - */
31866 - var Nl = createTokenClass("nl");
31867 - /**
31868 - Represents a list of text tokens making up a valid URL
31869 - @class Url
31870 - */
31871 - var Url = createTokenClass("url", {
31872 - isLink: true,
31873 - /**
31874 - Lowercases relevant parts of the domain and adds the protocol if
31875 - required. Note that this will not escape unsafe HTML characters in the
31876 - URL.
31877 - @param {string} [scheme] default scheme (e.g., 'https')
31878 - @return {string} the full href
31879 - */
31880 - toHref(scheme = defaults.defaultProtocol) {
31881 - return this.hasProtocol() ? this.v : `${scheme}://${this.v}`;
31882 - },
31883 - /**
31884 - * Check whether this URL token has a protocol
31885 - * @return {boolean}
31886 - */
31887 - hasProtocol() {
31888 - const tokens = this.tk;
31889 - return tokens.length >= 2 && tokens[0].t !== LOCALHOST && tokens[1].t === COLON;
31890 - }
31891 - });
31892 - /**
31893 - Not exactly parser, more like the second-stage scanner (although we can
31894 - theoretically hotswap the code here with a real parser in the future... but
31895 - for a little URL-finding utility abstract syntax trees may be a little
31896 - overkill).
31897 -
31898 - URL format: http://en.wikipedia.org/wiki/URI_scheme
31899 - Email format: http://en.wikipedia.org/wiki/EmailAddress (links to RFC in
31900 - reference)
31901 -
31902 - @module linkify
31903 - @submodule parser
31904 - @main run
31905 - */
31906 - var makeState = (arg) => new State(arg);
31907 - /**
31908 - * Generate the parser multi token-based state machine
31909 - * @param {{ groups: Collections<string> }} tokens
31910 - */
31911 - function init$1({ groups }) {
31912 - const qsAccepting = groups.domain.concat([
31913 - AMPERSAND,
31914 - ASTERISK,
31915 - AT,
31916 - BACKSLASH,
31917 - BACKTICK,
31918 - CARET,
31919 - DOLLAR,
31920 - EQUALS,
31921 - HYPHEN,
31922 - NUM,
31923 - PERCENT,
31924 - PIPE,
31925 - PLUS,
31926 - POUND,
31927 - SLASH,
31928 - SYM,
31929 - TILDE,
31930 - UNDERSCORE
31931 - ]);
31932 - const qsNonAccepting = [
31933 - APOSTROPHE,
31934 - COLON,
31935 - COMMA,
31936 - DOT,
31937 - EXCLAMATION,
31938 - PERCENT,
31939 - QUERY,
31940 - QUOTE,
31941 - SEMI,
31942 - OPENANGLEBRACKET,
31943 - CLOSEANGLEBRACKET,
31944 - OPENBRACE,
31945 - CLOSEBRACE,
31946 - CLOSEBRACKET,
31947 - OPENBRACKET,
31948 - OPENPAREN,
31949 - CLOSEPAREN,
31950 - FULLWIDTHLEFTPAREN,
31951 - FULLWIDTHRIGHTPAREN,
31952 - LEFTCORNERBRACKET,
31953 - RIGHTCORNERBRACKET,
31954 - LEFTWHITECORNERBRACKET,
31955 - RIGHTWHITECORNERBRACKET,
31956 - FULLWIDTHLESSTHAN,
31957 - FULLWIDTHGREATERTHAN
31958 - ];
31959 - const localpartAccepting = [
31960 - AMPERSAND,
31961 - APOSTROPHE,
31962 - ASTERISK,
31963 - BACKSLASH,
31964 - BACKTICK,
31965 - CARET,
31966 - DOLLAR,
31967 - EQUALS,
31968 - HYPHEN,
31969 - OPENBRACE,
31970 - CLOSEBRACE,
31971 - PERCENT,
31972 - PIPE,
31973 - PLUS,
31974 - POUND,
31975 - QUERY,
31976 - SLASH,
31977 - SYM,
31978 - TILDE,
31979 - UNDERSCORE
31980 - ];
31981 - /**
31982 - * @type State<Token>
31983 - */
31984 - const Start = makeState();
31985 - const Localpart = tt(Start, TILDE);
31986 - ta(Localpart, localpartAccepting, Localpart);
31987 - ta(Localpart, groups.domain, Localpart);
31988 - const Domain = makeState();
31989 - const Scheme = makeState();
31990 - const SlashScheme = makeState();
31991 - ta(Start, groups.domain, Domain);
31992 - ta(Start, groups.scheme, Scheme);
31993 - ta(Start, groups.slashscheme, SlashScheme);
31994 - ta(Domain, localpartAccepting, Localpart);
31995 - ta(Domain, groups.domain, Domain);
31996 - const LocalpartAt = tt(Domain, AT);
31997 - tt(Localpart, AT, LocalpartAt);
31998 - tt(Scheme, AT, LocalpartAt);
31999 - tt(SlashScheme, AT, LocalpartAt);
32000 - const LocalpartDot = tt(Localpart, DOT);
32001 - ta(LocalpartDot, localpartAccepting, Localpart);
32002 - ta(LocalpartDot, groups.domain, Localpart);
32003 - const EmailDomain = makeState();
32004 - ta(LocalpartAt, groups.domain, EmailDomain);
32005 - ta(EmailDomain, groups.domain, EmailDomain);
32006 - const EmailDomainDot = tt(EmailDomain, DOT);
32007 - ta(EmailDomainDot, groups.domain, EmailDomain);
32008 - const Email$1 = makeState(Email);
32009 - ta(EmailDomainDot, groups.tld, Email$1);
32010 - ta(EmailDomainDot, groups.utld, Email$1);
32011 - tt(LocalpartAt, LOCALHOST, Email$1);
32012 - const EmailDomainHyphen = tt(EmailDomain, HYPHEN);
32013 - tt(EmailDomainHyphen, HYPHEN, EmailDomainHyphen);
32014 - ta(EmailDomainHyphen, groups.domain, EmailDomain);
32015 - ta(Email$1, groups.domain, EmailDomain);
32016 - tt(Email$1, DOT, EmailDomainDot);
32017 - tt(Email$1, HYPHEN, EmailDomainHyphen);
32018 - const EmailColon = tt(Email$1, COLON);
32019 - ta(EmailColon, groups.numeric, Email);
32020 - const DomainHyphen = tt(Domain, HYPHEN);
32021 - const DomainDot = tt(Domain, DOT);
32022 - tt(DomainHyphen, HYPHEN, DomainHyphen);
32023 - ta(DomainHyphen, groups.domain, Domain);
32024 - ta(DomainDot, localpartAccepting, Localpart);
32025 - ta(DomainDot, groups.domain, Domain);
32026 - const DomainDotTld = makeState(Url);
32027 - ta(DomainDot, groups.tld, DomainDotTld);
32028 - ta(DomainDot, groups.utld, DomainDotTld);
32029 - ta(DomainDotTld, groups.domain, Domain);
32030 - ta(DomainDotTld, localpartAccepting, Localpart);
32031 - tt(DomainDotTld, DOT, DomainDot);
32032 - tt(DomainDotTld, HYPHEN, DomainHyphen);
32033 - tt(DomainDotTld, AT, LocalpartAt);
32034 - const DomainDotTldColon = tt(DomainDotTld, COLON);
32035 - const DomainDotTldColonPort = makeState(Url);
32036 - ta(DomainDotTldColon, groups.numeric, DomainDotTldColonPort);
32037 - const Url$1 = makeState(Url);
32038 - const UrlNonaccept = makeState();
32039 - ta(Url$1, qsAccepting, Url$1);
32040 - ta(Url$1, qsNonAccepting, UrlNonaccept);
32041 - ta(UrlNonaccept, qsAccepting, Url$1);
32042 - ta(UrlNonaccept, qsNonAccepting, UrlNonaccept);
32043 - tt(DomainDotTld, SLASH, Url$1);
32044 - tt(DomainDotTldColonPort, SLASH, Url$1);
32045 - const SchemeColon = tt(Scheme, COLON);
32046 - const SlashSchemeColon = tt(SlashScheme, COLON);
32047 - const SlashSchemeColonSlash = tt(SlashSchemeColon, SLASH);
32048 - const UriPrefix = tt(SlashSchemeColonSlash, SLASH);
32049 - ta(Scheme, groups.domain, Domain);
32050 - tt(Scheme, DOT, DomainDot);
32051 - tt(Scheme, HYPHEN, DomainHyphen);
32052 - ta(SlashScheme, groups.domain, Domain);
32053 - tt(SlashScheme, DOT, DomainDot);
32054 - tt(SlashScheme, HYPHEN, DomainHyphen);
32055 - ta(SchemeColon, groups.domain, Url$1);
32056 - tt(SchemeColon, SLASH, Url$1);
32057 - tt(SchemeColon, QUERY, Url$1);
32058 - ta(UriPrefix, groups.domain, Url$1);
32059 - ta(UriPrefix, qsAccepting, Url$1);
32060 - tt(UriPrefix, SLASH, Url$1);
32061 - const bracketPairs = [
32062 - [OPENBRACE, CLOSEBRACE],
32063 - [OPENBRACKET, CLOSEBRACKET],
32064 - [OPENPAREN, CLOSEPAREN],
32065 - [OPENANGLEBRACKET, CLOSEANGLEBRACKET],
32066 - [FULLWIDTHLEFTPAREN, FULLWIDTHRIGHTPAREN],
32067 - [LEFTCORNERBRACKET, RIGHTCORNERBRACKET],
32068 - [LEFTWHITECORNERBRACKET, RIGHTWHITECORNERBRACKET],
32069 - [FULLWIDTHLESSTHAN, FULLWIDTHGREATERTHAN]
32070 - ];
32071 - for (let i = 0; i < bracketPairs.length; i++) {
32072 - const [OPEN, CLOSE] = bracketPairs[i];
32073 - const UrlOpen = tt(Url$1, OPEN);
32074 - tt(UrlNonaccept, OPEN, UrlOpen);
32075 - tt(UrlOpen, CLOSE, Url$1);
32076 - const UrlOpenQ = makeState(Url);
32077 - ta(UrlOpen, qsAccepting, UrlOpenQ);
32078 - const UrlOpenSyms = makeState();
32079 - ta(UrlOpen, qsNonAccepting);
32080 - ta(UrlOpenQ, qsAccepting, UrlOpenQ);
32081 - ta(UrlOpenQ, qsNonAccepting, UrlOpenSyms);
32082 - ta(UrlOpenSyms, qsAccepting, UrlOpenQ);
32083 - ta(UrlOpenSyms, qsNonAccepting, UrlOpenSyms);
32084 - tt(UrlOpenQ, CLOSE, Url$1);
32085 - tt(UrlOpenSyms, CLOSE, Url$1);
32086 - }
32087 - tt(Start, LOCALHOST, DomainDotTld);
32088 - tt(Start, NL, Nl);
32089 - return {
32090 - start: Start,
32091 - tokens: tk
32092 - };
32093 - }
32094 - /**
32095 - * Run the parser state machine on a list of scanned string-based tokens to
32096 - * create a list of multi tokens, each of which represents a URL, email address,
32097 - * plain text, etc.
32098 - *
32099 - * @param {State<MultiToken>} start parser start state
32100 - * @param {string} input the original input used to generate the given tokens
32101 - * @param {Token[]} tokens list of scanned tokens
32102 - * @returns {MultiToken[]}
32103 - */
32104 - function run(start, input, tokens) {
32105 - let len = tokens.length;
32106 - let cursor = 0;
32107 - let multis = [];
32108 - let textTokens = [];
32109 - while (cursor < len) {
32110 - let state = start;
32111 - let secondState = null;
32112 - let nextState = null;
32113 - let multiLength = 0;
32114 - let latestAccepting = null;
32115 - let sinceAccepts = -1;
32116 - while (cursor < len && !(secondState = state.go(tokens[cursor].t))) textTokens.push(tokens[cursor++]);
32117 - while (cursor < len && (nextState = secondState || state.go(tokens[cursor].t))) {
32118 - secondState = null;
32119 - state = nextState;
32120 - if (state.accepts()) {
32121 - sinceAccepts = 0;
32122 - latestAccepting = state;
32123 - } else if (sinceAccepts >= 0) sinceAccepts++;
32124 - cursor++;
32125 - multiLength++;
32126 - }
32127 - if (sinceAccepts < 0) {
32128 - cursor -= multiLength;
32129 - if (cursor < len) {
32130 - textTokens.push(tokens[cursor]);
32131 - cursor++;
32132 - }
32133 - } else {
32134 - if (textTokens.length > 0) {
32135 - multis.push(initMultiToken(Text$1, input, textTokens));
32136 - textTokens = [];
32137 - }
32138 - cursor -= sinceAccepts;
32139 - multiLength -= sinceAccepts;
32140 - const Multi = latestAccepting.t;
32141 - const subtokens = tokens.slice(cursor - multiLength, cursor);
32142 - multis.push(initMultiToken(Multi, input, subtokens));
32143 - }
32144 - }
32145 - if (textTokens.length > 0) multis.push(initMultiToken(Text$1, input, textTokens));
32146 - return multis;
32147 - }
32148 - /**
32149 - * Utility function for instantiating a new multitoken with all the relevant
32150 - * fields during parsing.
32151 - * @param {new (value: string, tokens: Token[]) => MultiToken} Multi class to instantiate
32152 - * @param {string} input original input string
32153 - * @param {Token[]} tokens consecutive tokens scanned from input string
32154 - * @returns {MultiToken}
32155 - */
32156 - function initMultiToken(Multi, input, tokens) {
32157 - const startIdx = tokens[0].s;
32158 - const endIdx = tokens[tokens.length - 1].e;
32159 - return new Multi(input.slice(startIdx, endIdx), tokens);
32160 - }
32161 - var warn = typeof console !== "undefined" && console && console.warn || (() => {});
32162 - var warnAdvice = "until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.";
32163 - var INIT = {
32164 - scanner: null,
32165 - parser: null,
32166 - tokenQueue: [],
32167 - pluginQueue: [],
32168 - customSchemes: [],
32169 - initialized: false
32170 - };
32171 - /**
32172 - * @typedef {{
32173 - * start: State<string>,
32174 - * tokens: { groups: Collections<string> } & typeof tk
32175 - * }} ScannerInit
32176 - */
32177 - /**
32178 - * @typedef {{
32179 - * start: State<MultiToken>,
32180 - * tokens: typeof multi
32181 - * }} ParserInit
32182 - */
32183 - /**
32184 - * @typedef {(arg: { scanner: ScannerInit }) => void} TokenPlugin
32185 - */
32186 - /**
32187 - * @typedef {(arg: { scanner: ScannerInit, parser: ParserInit }) => void} Plugin
32188 - */
32189 - /**
32190 - * De-register all plugins and reset the internal state-machine. Used for
32191 - * testing; not required in practice.
32192 - * @private
32193 - */
32194 - function reset() {
32195 - State.groups = {};
32196 - INIT.scanner = null;
32197 - INIT.parser = null;
32198 - INIT.tokenQueue = [];
32199 - INIT.pluginQueue = [];
32200 - INIT.customSchemes = [];
32201 - INIT.initialized = false;
32202 - return INIT;
32203 - }
32204 - /**
32205 - * Detect URLs with the following additional protocol. Anything with format
32206 - * "protocol://..." will be considered a link. If `optionalSlashSlash` is set to
32207 - * `true`, anything with format "protocol:..." will be considered a link.
32208 - * @param {string} scheme
32209 - * @param {boolean} [optionalSlashSlash]
32210 - */
32211 - function registerCustomProtocol(scheme, optionalSlashSlash = false) {
32212 - if (INIT.initialized) warn(`linkifyjs: already initialized - will not register custom scheme "${scheme}" ${warnAdvice}`);
32213 - if (!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(scheme)) throw new Error(`linkifyjs: incorrect scheme format.
32214 -1. Must only contain digits, lowercase ASCII letters or "-"
32215 -2. Cannot start or end with "-"
32216 -3. "-" cannot repeat`);
32217 - INIT.customSchemes.push([scheme, optionalSlashSlash]);
32218 - }
32219 - /**
32220 - * Initialize the linkify state machine. Called automatically the first time
32221 - * linkify is called on a string, but may be called manually as well.
32222 - */
32223 - function init() {
32224 - INIT.scanner = init$2(INIT.customSchemes);
32225 - for (let i = 0; i < INIT.tokenQueue.length; i++) INIT.tokenQueue[i][1]({ scanner: INIT.scanner });
32226 - INIT.parser = init$1(INIT.scanner.tokens);
32227 - for (let i = 0; i < INIT.pluginQueue.length; i++) INIT.pluginQueue[i][1]({
32228 - scanner: INIT.scanner,
32229 - parser: INIT.parser
32230 - });
32231 - INIT.initialized = true;
32232 - return INIT;
32233 - }
32234 - /**
32235 - * Parse a string into tokens that represent linkable and non-linkable sub-components
32236 - * @param {string} str
32237 - * @return {MultiToken[]} tokens
32238 - */
32239 - function tokenize(str) {
32240 - if (!INIT.initialized) init();
32241 - return run(INIT.parser.start, str, run$1(INIT.scanner.start, str));
32242 - }
32243 - tokenize.scan = run$1;
32244 - /**
32245 - * Find a list of linkable items in the given string.
32246 - * @param {string} str string to find links in
32247 - * @param {string | Opts} [type] either formatting options or specific type of
32248 - * links to find, e.g., 'url' or 'email'
32249 - * @param {Opts} [opts] formatting options for final output. Cannot be specified
32250 - * if opts already provided in `type` argument
32251 - */
32252 - function find(str, type = null, opts = null) {
32253 - if (type && typeof type === "object") {
32254 - if (opts) throw Error(`linkifyjs: Invalid link type ${type}; must be a string`);
32255 - opts = type;
32256 - type = null;
32257 - }
32258 - const options = new Options(opts);
32259 - const tokens = tokenize(str);
32260 - const filtered = [];
32261 - for (let i = 0; i < tokens.length; i++) {
32262 - const token = tokens[i];
32263 - if (token.isLink && (!type || token.t === type) && options.check(token)) filtered.push(token.toFormattedObject(options));
32264 - }
32265 - return filtered;
32266 - }
32267 -
32268 -//#endregion
32269 -//#region node_modules/@tiptap/extension-link/dist/index.js
32270 - var UNICODE_WHITESPACE_PATTERN = "[\0- \xA0 ᠎ -\u2029  ]";
32271 - var UNICODE_WHITESPACE_REGEX = new RegExp(UNICODE_WHITESPACE_PATTERN);
32272 - var UNICODE_WHITESPACE_REGEX_END = new RegExp(`${UNICODE_WHITESPACE_PATTERN}$`);
32273 - var UNICODE_WHITESPACE_REGEX_GLOBAL = new RegExp(UNICODE_WHITESPACE_PATTERN, "g");
32274 - function isValidLinkStructure(tokens) {
32275 - if (tokens.length === 1) return tokens[0].isLink;
32276 - if (tokens.length === 3 && tokens[1].isLink) return ["()", "[]"].includes(tokens[0].value + tokens[2].value);
32277 - return false;
32278 - }
32279 - function autolink(options) {
32280 - return new Plugin({
32281 - key: new PluginKey("autolink"),
32282 - appendTransaction: (transactions, oldState, newState) => {
32283 - const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);
32284 - const preventAutolink = transactions.some((transaction) => transaction.getMeta("preventAutolink"));
32285 - if (!docChanges || preventAutolink) return;
32286 - const { tr } = newState;
32287 - getChangedRanges(combineTransactionSteps(oldState.doc, [...transactions])).forEach(({ newRange }) => {
32288 - const nodesInChangedRanges = findChildrenInRange(newState.doc, newRange, (node) => node.isTextblock);
32289 - let textBlock;
32290 - let textBeforeWhitespace;
32291 - if (nodesInChangedRanges.length > 1) {
32292 - textBlock = nodesInChangedRanges[0];
32293 - textBeforeWhitespace = newState.doc.textBetween(textBlock.pos, textBlock.pos + textBlock.node.nodeSize, void 0, " ");
32294 - } else if (nodesInChangedRanges.length) {
32295 - const endText = newState.doc.textBetween(newRange.from, newRange.to, " ", " ");
32296 - if (!UNICODE_WHITESPACE_REGEX_END.test(endText)) return;
32297 - textBlock = nodesInChangedRanges[0];
32298 - textBeforeWhitespace = newState.doc.textBetween(textBlock.pos, newRange.to, void 0, " ");
32299 - }
32300 - if (textBlock && textBeforeWhitespace) {
32301 - const wordsBeforeWhitespace = textBeforeWhitespace.split(UNICODE_WHITESPACE_REGEX).filter(Boolean);
32302 - if (wordsBeforeWhitespace.length <= 0) return false;
32303 - const lastWordBeforeSpace = wordsBeforeWhitespace[wordsBeforeWhitespace.length - 1];
32304 - const lastWordAndBlockOffset = textBlock.pos + textBeforeWhitespace.lastIndexOf(lastWordBeforeSpace);
32305 - if (!lastWordBeforeSpace) return false;
32306 - const linksBeforeSpace = tokenize(lastWordBeforeSpace).map((t) => t.toObject(options.defaultProtocol));
32307 - if (!isValidLinkStructure(linksBeforeSpace)) return false;
32308 - linksBeforeSpace.filter((link) => link.isLink).map((link) => ({
32309 - ...link,
32310 - from: lastWordAndBlockOffset + link.start + 1,
32311 - to: lastWordAndBlockOffset + link.end + 1
32312 - })).filter((link) => {
32313 - if (!newState.schema.marks.code) return true;
32314 - return !newState.doc.rangeHasMark(link.from, link.to, newState.schema.marks.code);
32315 - }).filter((link) => options.validate(link.value)).filter((link) => options.shouldAutoLink(link.value)).forEach((link) => {
32316 - if (getMarksBetween(link.from, link.to, newState.doc).some((item) => item.mark.type === options.type)) return;
32317 - tr.addMark(link.from, link.to, options.type.create({ href: link.href }));
32318 - });
32319 - }
32320 - });
32321 - if (!tr.steps.length) return;
32322 - return tr;
32323 - }
32324 - });
32325 - }
32326 - function clickHandler(options) {
32327 - return new Plugin({
32328 - key: new PluginKey("handleClickLink"),
32329 - props: { handleClick: (view, pos, event) => {
32330 - var _a;
32331 - var _b;
32332 - if (event.button !== 0) return false;
32333 - if (!view.editable) return false;
32334 - let link = null;
32335 - if (event.target instanceof HTMLAnchorElement) link = event.target;
32336 - else {
32337 - const target = event.target;
32338 - if (!target) return false;
32339 - const root = options.editor.view.dom;
32340 - link = target.closest("a");
32341 - if (link && !root.contains(link)) link = null;
32342 - }
32343 - if (!link) return false;
32344 - let handled = false;
32345 - if (options.enableClickSelection) handled = options.editor.commands.extendMarkRange(options.type.name);
32346 - if (options.openOnClick) {
32347 - const attrs = getAttributes(view.state, options.type.name);
32348 - const href = (_a = link.href) != null ? _a : attrs.href;
32349 - const target = (_b = link.target) != null ? _b : attrs.target;
32350 - if (href) {
32351 - window.open(href, target);
32352 - handled = true;
32353 - }
32354 - }
32355 - return handled;
32356 - } }
32357 - });
32358 - }
32359 - function pasteHandler(options) {
32360 - return new Plugin({
32361 - key: new PluginKey("handlePasteLink"),
32362 - props: { handlePaste: (view, _event, slice) => {
32363 - const { shouldAutoLink } = options;
32364 - const { state } = view;
32365 - const { selection } = state;
32366 - const { empty } = selection;
32367 - if (empty) return false;
32368 - let textContent = "";
32369 - slice.content.forEach((node) => {
32370 - textContent += node.textContent;
32371 - });
32372 - const link = find(textContent, { defaultProtocol: options.defaultProtocol }).find((item) => item.isLink && item.value === textContent);
32373 - if (!textContent || !link || shouldAutoLink !== void 0 && !shouldAutoLink(link.value)) return false;
32374 - return options.editor.commands.setMark(options.type, { href: link.href });
32375 - } }
32376 - });
32377 - }
32378 - function isAllowedUri(uri, protocols) {
32379 - const allowedProtocols = [
32380 - "http",
32381 - "https",
32382 - "ftp",
32383 - "ftps",
32384 - "mailto",
32385 - "tel",
32386 - "callto",
32387 - "sms",
32388 - "cid",
32389 - "xmpp"
32390 - ];
32391 - if (protocols) protocols.forEach((protocol) => {
32392 - const nextProtocol = typeof protocol === "string" ? protocol : protocol.scheme;
32393 - if (nextProtocol) allowedProtocols.push(nextProtocol);
32394 - });
32395 - return !uri || uri.replace(UNICODE_WHITESPACE_REGEX_GLOBAL, "").match(new RegExp(`^(?:(?:${allowedProtocols.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`, "i"));
32396 - }
32397 - var Link = Mark.create({
32398 - name: "link",
32399 - priority: 1e3,
32400 - keepOnSplit: false,
32401 - exitable: true,
32402 - onCreate() {
32403 - if (this.options.validate && !this.options.shouldAutoLink) {
32404 - this.options.shouldAutoLink = this.options.validate;
32405 - console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.");
32406 - }
32407 - this.options.protocols.forEach((protocol) => {
32408 - if (typeof protocol === "string") {
32409 - registerCustomProtocol(protocol);
32410 - return;
32411 - }
32412 - registerCustomProtocol(protocol.scheme, protocol.optionalSlashes);
32413 - });
32414 - },
32415 - onDestroy() {
32416 - reset();
32417 - },
32418 - inclusive() {
32419 - return this.options.autolink;
32420 - },
32421 - addOptions() {
32422 - return {
32423 - openOnClick: true,
32424 - enableClickSelection: false,
32425 - linkOnPaste: true,
32426 - autolink: true,
32427 - protocols: [],
32428 - defaultProtocol: "http",
32429 - HTMLAttributes: {
32430 - target: "_blank",
32431 - rel: "noopener noreferrer nofollow",
32432 - class: null
32433 - },
32434 - isAllowedUri: (url, ctx) => !!isAllowedUri(url, ctx.protocols),
32435 - validate: (url) => !!url,
32436 - shouldAutoLink: (url) => {
32437 - const hasProtocol = /^[a-z][a-z0-9+.-]*:\/\//i.test(url);
32438 - const hasMaybeProtocol = /^[a-z][a-z0-9+.-]*:/i.test(url);
32439 - if (hasProtocol || hasMaybeProtocol && !url.includes("@")) return true;
32440 - const hostname = (url.includes("@") ? url.split("@").pop() : url).split(/[/?#:]/)[0];
32441 - if (/^\d{1,3}(\.\d{1,3}){3}$/.test(hostname)) return false;
32442 - if (!/\./.test(hostname)) return false;
32443 - return true;
32444 - }
32445 - };
32446 - },
32447 - addAttributes() {
32448 - return {
32449 - href: {
32450 - default: null,
32451 - parseHTML(element) {
32452 - return element.getAttribute("href");
32453 - }
32454 - },
32455 - target: { default: this.options.HTMLAttributes.target },
32456 - rel: { default: this.options.HTMLAttributes.rel },
32457 - class: { default: this.options.HTMLAttributes.class },
32458 - title: { default: null }
32459 - };
32460 - },
32461 - parseHTML() {
32462 - return [{
32463 - tag: "a[href]",
32464 - getAttrs: (dom) => {
32465 - const href = dom.getAttribute("href");
32466 - if (!href || !this.options.isAllowedUri(href, {
32467 - defaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),
32468 - protocols: this.options.protocols,
32469 - defaultProtocol: this.options.defaultProtocol
32470 - })) return false;
32471 - return null;
32472 - }
32473 - }];
32474 - },
32475 - renderHTML({ HTMLAttributes }) {
32476 - if (!this.options.isAllowedUri(HTMLAttributes.href, {
32477 - defaultValidate: (href) => !!isAllowedUri(href, this.options.protocols),
32478 - protocols: this.options.protocols,
32479 - defaultProtocol: this.options.defaultProtocol
32480 - })) return [
32481 - "a",
32482 - mergeAttributes(this.options.HTMLAttributes, {
32483 - ...HTMLAttributes,
32484 - href: ""
32485 - }),
32486 - 0
32487 - ];
32488 - return [
32489 - "a",
32490 - mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
32491 - 0
32492 - ];
32493 - },
32494 - markdownTokenName: "link",
32495 - parseMarkdown: (token, helpers) => {
32496 - return helpers.applyMark("link", helpers.parseInline(token.tokens || []), {
32497 - href: token.href,
32498 - title: token.title || null
32499 - });
32500 - },
32501 - renderMarkdown: (node, h) => {
32502 - var _a;
32503 - var _b;
32504 - var _c;
32505 - var _d;
32506 - const href = (_b = (_a = node.attrs) == null ? void 0 : _a.href) != null ? _b : "";
32507 - const title = (_d = (_c = node.attrs) == null ? void 0 : _c.title) != null ? _d : "";
32508 - const text = h.renderChildren(node);
32509 - return title ? `[${text}](${href} "${title}")` : `[${text}](${href})`;
32510 - },
32511 - addCommands() {
32512 - return {
32513 - setLink: (attributes) => ({ chain }) => {
32514 - const { href } = attributes;
32515 - if (!this.options.isAllowedUri(href, {
32516 - defaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),
32517 - protocols: this.options.protocols,
32518 - defaultProtocol: this.options.defaultProtocol
32519 - })) return false;
32520 - return chain().setMark(this.name, attributes).setMeta("preventAutolink", true).run();
32521 - },
32522 - toggleLink: (attributes) => ({ chain }) => {
32523 - const { href } = attributes || {};
32524 - if (href && !this.options.isAllowedUri(href, {
32525 - defaultValidate: (url) => !!isAllowedUri(url, this.options.protocols),
32526 - protocols: this.options.protocols,
32527 - defaultProtocol: this.options.defaultProtocol
32528 - })) return false;
32529 - return chain().toggleMark(this.name, attributes, { extendEmptyMarkRange: true }).setMeta("preventAutolink", true).run();
32530 - },
32531 - unsetLink: () => ({ chain }) => {
32532 - return chain().unsetMark(this.name, { extendEmptyMarkRange: true }).setMeta("preventAutolink", true).run();
32533 - }
32534 - };
32535 - },
32536 - addPasteRules() {
32537 - return [markPasteRule({
32538 - find: (text) => {
32539 - const foundLinks = [];
32540 - if (text) {
32541 - const { protocols, defaultProtocol } = this.options;
32542 - const links = find(text).filter((item) => item.isLink && this.options.isAllowedUri(item.value, {
32543 - defaultValidate: (href) => !!isAllowedUri(href, protocols),
32544 - protocols,
32545 - defaultProtocol
32546 - }));
32547 - if (links.length) links.forEach((link) => {
32548 - if (!this.options.shouldAutoLink(link.value)) return;
32549 - foundLinks.push({
32550 - text: link.value,
32551 - data: { href: link.href },
32552 - index: link.start
32553 - });
32554 - });
32555 - }
32556 - return foundLinks;
32557 - },
32558 - type: this.type,
32559 - getAttributes: (match) => {
32560 - var _a;
32561 - return { href: (_a = match.data) == null ? void 0 : _a.href };
32562 - }
32563 - })];
32564 - },
32565 - addProseMirrorPlugins() {
32566 - const plugins = [];
32567 - const { protocols, defaultProtocol } = this.options;
32568 - if (this.options.autolink) plugins.push(autolink({
32569 - type: this.type,
32570 - defaultProtocol: this.options.defaultProtocol,
32571 - validate: (url) => this.options.isAllowedUri(url, {
32572 - defaultValidate: (href) => !!isAllowedUri(href, protocols),
32573 - protocols,
32574 - defaultProtocol
32575 - }),
32576 - shouldAutoLink: this.options.shouldAutoLink
32577 - }));
32578 - plugins.push(clickHandler({
32579 - type: this.type,
32580 - editor: this.editor,
32581 - openOnClick: this.options.openOnClick === "whenNotEditable" ? true : this.options.openOnClick,
32582 - enableClickSelection: this.options.enableClickSelection
32583 - }));
32584 - if (this.options.linkOnPaste) plugins.push(pasteHandler({
32585 - editor: this.editor,
32586 - defaultProtocol: this.options.defaultProtocol,
32587 - type: this.type,
32588 - shouldAutoLink: this.options.shouldAutoLink
32589 - }));
32590 - return plugins;
32591 - }
32592 - });
32593 - var index_default$6 = Link;
32594 -
32595 -//#endregion
32596 -//#region node_modules/@tiptap/extension-paragraph/dist/index.js
32597 - var EMPTY_PARAGRAPH_MARKDOWN = "&nbsp;";
32598 - var NBSP_CHAR = "\xA0";
32599 - var Paragraph = Node3.create({
32600 - name: "paragraph",
32601 - priority: 1e3,
32602 - addOptions() {
32603 - return { HTMLAttributes: {} };
32604 - },
32605 - group: "block",
32606 - content: "inline*",
32607 - parseHTML() {
32608 - return [{ tag: "p" }];
32609 - },
32610 - renderHTML({ HTMLAttributes }) {
32611 - return [
32612 - "p",
32613 - mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
32614 - 0
32615 - ];
32616 - },
32617 - parseMarkdown: (token, helpers) => {
32618 - const tokens = token.tokens || [];
32619 - if (tokens.length === 1 && tokens[0].type === "image") return helpers.parseChildren([tokens[0]]);
32620 - const content = helpers.parseInline(tokens);
32621 - if (content.length === 1 && content[0].type === "text" && (content[0].text === EMPTY_PARAGRAPH_MARKDOWN || content[0].text === NBSP_CHAR)) return helpers.createNode("paragraph", void 0, []);
32622 - return helpers.createNode("paragraph", void 0, content);
32623 - },
32624 - renderMarkdown: (node, h) => {
32625 - if (!node) return "";
32626 - const content = Array.isArray(node.content) ? node.content : [];
32627 - if (content.length === 0) return EMPTY_PARAGRAPH_MARKDOWN;
32628 - return h.renderChildren(content);
32629 - },
32630 - addCommands() {
32631 - return { setParagraph: () => ({ commands }) => {
32632 - return commands.setNode(this.name);
32633 - } };
32634 - },
32635 - addKeyboardShortcuts() {
32636 - return { "Mod-Alt-0": () => this.editor.commands.setParagraph() };
32637 - }
32638 - });
32639 - var index_default$5 = Paragraph;
32640 -
32641 -//#endregion
32642 -//#region node_modules/@tiptap/extension-strike/dist/index.js
32643 - var inputRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/;
32644 - var pasteRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g;
32645 - var Strike = Mark.create({
32646 - name: "strike",
32647 - addOptions() {
32648 - return { HTMLAttributes: {} };
32649 - },
32650 - parseHTML() {
32651 - return [
32652 - { tag: "s" },
32653 - { tag: "del" },
32654 - { tag: "strike" },
32655 - {
32656 - style: "text-decoration",
32657 - consuming: false,
32658 - getAttrs: (style) => style.includes("line-through") ? {} : false
32659 - }
32660 - ];
32661 - },
32662 - renderHTML({ HTMLAttributes }) {
32663 - return [
32664 - "s",
32665 - mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
32666 - 0
32667 - ];
32668 - },
32669 - markdownTokenName: "del",
32670 - parseMarkdown: (token, helpers) => {
32671 - return helpers.applyMark("strike", helpers.parseInline(token.tokens || []));
32672 - },
32673 - renderMarkdown: (node, h) => {
32674 - return `~~${h.renderChildren(node)}~~`;
32675 - },
32676 - addCommands() {
32677 - return {
32678 - setStrike: () => ({ commands }) => {
32679 - return commands.setMark(this.name);
32680 - },
32681 - toggleStrike: () => ({ commands }) => {
32682 - return commands.toggleMark(this.name);
32683 - },
32684 - unsetStrike: () => ({ commands }) => {
32685 - return commands.unsetMark(this.name);
32686 - }
32687 - };
32688 - },
32689 - addKeyboardShortcuts() {
32690 - return { "Mod-Shift-s": () => this.editor.commands.toggleStrike() };
32691 - },
32692 - addInputRules() {
32693 - return [markInputRule({
32694 - find: inputRegex,
32695 - type: this.type
32696 - })];
32697 - },
32698 - addPasteRules() {
32699 - return [markPasteRule({
32700 - find: pasteRegex,
32701 - type: this.type
32702 - })];
32703 - }
32704 - });
32705 - var index_default$4 = Strike;
32706 -
32707 -//#endregion
32708 -//#region node_modules/@tiptap/extension-subscript/dist/index.js
32709 - var Subscript = Mark.create({
32710 - name: "subscript",
32711 - addOptions() {
32712 - return { HTMLAttributes: {} };
32713 - },
32714 - parseHTML() {
32715 - return [{ tag: "sub" }, {
32716 - style: "vertical-align",
32717 - getAttrs(value) {
32718 - if (value !== "sub") return false;
32719 - return null;
32720 - }
32721 - }];
32722 - },
32723 - renderHTML({ HTMLAttributes }) {
32724 - return [
32725 - "sub",
32726 - mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
32727 - 0
32728 - ];
32729 - },
32730 - addCommands() {
32731 - return {
32732 - setSubscript: () => ({ commands }) => {
32733 - return commands.setMark(this.name);
32734 - },
32735 - toggleSubscript: () => ({ commands }) => {
32736 - return commands.toggleMark(this.name);
32737 - },
32738 - unsetSubscript: () => ({ commands }) => {
32739 - return commands.unsetMark(this.name);
32740 - }
32741 - };
32742 - },
32743 - addKeyboardShortcuts() {
32744 - return { "Mod-,": () => this.editor.commands.toggleSubscript() };
32745 - }
32746 - });
32747 - var index_default$3 = Subscript;
32748 -
32749 -//#endregion
32750 -//#region node_modules/@tiptap/extension-superscript/dist/index.js
32751 - var Superscript = Mark.create({
32752 - name: "superscript",
32753 - addOptions() {
32754 - return { HTMLAttributes: {} };
32755 - },
32756 - parseHTML() {
32757 - return [{ tag: "sup" }, {
32758 - style: "vertical-align",
32759 - getAttrs(value) {
32760 - if (value !== "super") return false;
32761 - return null;
32762 - }
32763 - }];
32764 - },
32765 - renderHTML({ HTMLAttributes }) {
32766 - return [
32767 - "sup",
32768 - mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
32769 - 0
32770 - ];
32771 - },
32772 - addCommands() {
32773 - return {
32774 - setSuperscript: () => ({ commands }) => {
32775 - return commands.setMark(this.name);
32776 - },
32777 - toggleSuperscript: () => ({ commands }) => {
32778 - return commands.toggleMark(this.name);
32779 - },
32780 - unsetSuperscript: () => ({ commands }) => {
32781 - return commands.unsetMark(this.name);
32782 - }
32783 - };
32784 - },
32785 - addKeyboardShortcuts() {
32786 - return { "Mod-.": () => this.editor.commands.toggleSuperscript() };
32787 - }
32788 - });
32789 - var index_default$2 = Superscript;
32790 -
32791 -//#endregion
32792 -//#region node_modules/@tiptap/extension-text/dist/index.js
32793 - var Text = Node3.create({
32794 - name: "text",
32795 - group: "inline",
32796 - parseMarkdown: (token) => {
32797 - return {
32798 - type: "text",
32799 - text: token.text || ""
32800 - };
32801 - },
32802 - renderMarkdown: (node) => node.text || ""
32803 - });
32804 - var index_default$1 = Text;
32805 -
32806 -//#endregion
32807 -//#region node_modules/@tiptap/extension-underline/dist/index.js
32808 - var Underline = Mark.create({
32809 - name: "underline",
32810 - addOptions() {
32811 - return { HTMLAttributes: {} };
32812 - },
32813 - parseHTML() {
32814 - return [{ tag: "u" }, {
32815 - style: "text-decoration",
32816 - consuming: false,
32817 - getAttrs: (style) => style.includes("underline") ? {} : false
32818 - }];
32819 - },
32820 - renderHTML({ HTMLAttributes }) {
32821 - return [
32822 - "u",
32823 - mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
32824 - 0
32825 - ];
32826 - },
32827 - parseMarkdown(token, helpers) {
32828 - return helpers.applyMark(this.name || "underline", helpers.parseInline(token.tokens || []));
32829 - },
32830 - renderMarkdown(node, helpers) {
32831 - return `++${helpers.renderChildren(node)}++`;
32832 - },
32833 - markdownTokenizer: {
32834 - name: "underline",
32835 - level: "inline",
32836 - start(src) {
32837 - return src.indexOf("++");
32838 - },
32839 - tokenize(src, _tokens, lexer) {
32840 - const match = /^(\+\+)([\s\S]+?)(\+\+)/.exec(src);
32841 - if (!match) return;
32842 - const innerContent = match[2].trim();
32843 - return {
32844 - type: "underline",
32845 - raw: match[0],
32846 - text: innerContent,
32847 - tokens: lexer.inlineTokens(innerContent)
32848 - };
32849 - }
32850 - },
32851 - addCommands() {
32852 - return {
32853 - setUnderline: () => ({ commands }) => {
32854 - return commands.setMark(this.name);
32855 - },
32856 - toggleUnderline: () => ({ commands }) => {
32857 - return commands.toggleMark(this.name);
32858 - },
32859 - unsetUnderline: () => ({ commands }) => {
32860 - return commands.unsetMark(this.name);
32861 - }
32862 - };
32863 - },
32864 - addKeyboardShortcuts() {
32865 - return {
32866 - "Mod-u": () => this.editor.commands.toggleUnderline(),
32867 - "Mod-U": () => this.editor.commands.toggleUnderline()
32868 - };
32869 - }
32870 - });
32871 - var index_default = Underline;
32872 -
32873 -//#endregion
32874 -//#region node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
32875 -/**
32876 - * @license React
32877 - * use-sync-external-store-shim.development.js
32878 - *
32879 - * Copyright (c) Meta Platforms, Inc. and affiliates.
32880 - *
32881 - * This source code is licensed under the MIT license found in the
32882 - * LICENSE file in the root directory of this source tree.
32883 - */
32884 - var require_use_sync_external_store_shim_development = /* @__PURE__ */ __commonJSMin(((exports) => {
32885 - (function() {
32886 - function is(x, y) {
32887 - return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
32888 - }
32889 - function useSyncExternalStore$2(subscribe, getSnapshot) {
32890 - didWarnOld18Alpha || void 0 === React.startTransition || (didWarnOld18Alpha = !0, console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
32891 - var value = getSnapshot();
32892 - if (!didWarnUncachedGetSnapshot) {
32893 - var cachedValue = getSnapshot();
32894 - objectIs(value, cachedValue) || (console.error("The result of getSnapshot should be cached to avoid an infinite loop"), didWarnUncachedGetSnapshot = !0);
32895 - }
32896 - cachedValue = useState({ inst: {
32897 - value,
32898 - getSnapshot
32899 - } });
32900 - var inst = cachedValue[0].inst;
32901 - var forceUpdate = cachedValue[1];
32902 - useLayoutEffect(function() {
32903 - inst.value = value;
32904 - inst.getSnapshot = getSnapshot;
32905 - checkIfSnapshotChanged(inst) && forceUpdate({ inst });
32906 - }, [
32907 - subscribe,
32908 - value,
32909 - getSnapshot
32910 - ]);
32911 - useEffect(function() {
32912 - checkIfSnapshotChanged(inst) && forceUpdate({ inst });
32913 - return subscribe(function() {
32914 - checkIfSnapshotChanged(inst) && forceUpdate({ inst });
32915 - });
32916 - }, [subscribe]);
32917 - useDebugValue(value);
32918 - return value;
32919 - }
32920 - function checkIfSnapshotChanged(inst) {
32921 - var latestGetSnapshot = inst.getSnapshot;
32922 - inst = inst.value;
32923 - try {
32924 - var nextValue = latestGetSnapshot();
32925 - return !objectIs(inst, nextValue);
32926 - } catch (error) {
32927 - return !0;
32928 - }
32929 - }
32930 - function useSyncExternalStore$1(subscribe, getSnapshot) {
32931 - return getSnapshot();
32932 - }
32933 - "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
32934 - var React = (globalThis.React);
32935 - var objectIs = "function" === typeof Object.is ? Object.is : is;
32936 - var useState = React.useState;
32937 - var useEffect = React.useEffect;
32938 - var useLayoutEffect = React.useLayoutEffect;
32939 - var useDebugValue = React.useDebugValue;
32940 - var didWarnOld18Alpha = !1;
32941 - var didWarnUncachedGetSnapshot = !1;
32942 - var shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
32943 - exports.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
32944 - "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
32945 - })();
32946 - }));
32947 -
32948 -//#endregion
32949 -//#region node_modules/use-sync-external-store/shim/index.js
32950 - var require_shim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
32951 - module.exports = require_use_sync_external_store_shim_development();
32952 - }));
32953 -
32954 -//#endregion
32955 -//#region node_modules/react/cjs/react-jsx-runtime.development.js
32956 -/**
32957 - * @license React
32958 - * react-jsx-runtime.development.js
32959 - *
32960 - * Copyright (c) Facebook, Inc. and its affiliates.
32961 - *
32962 - * This source code is licensed under the MIT license found in the
32963 - * LICENSE file in the root directory of this source tree.
32964 - */
32965 - var require_react_jsx_runtime_development = /* @__PURE__ */ __commonJSMin(((exports) => {
32966 - (function() {
32967 - "use strict";
32968 - var React = (globalThis.React);
32969 - var REACT_ELEMENT_TYPE = Symbol.for("react.element");
32970 - var REACT_PORTAL_TYPE = Symbol.for("react.portal");
32971 - var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
32972 - var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
32973 - var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
32974 - var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
32975 - var REACT_CONTEXT_TYPE = Symbol.for("react.context");
32976 - var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
32977 - var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
32978 - var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
32979 - var REACT_MEMO_TYPE = Symbol.for("react.memo");
32980 - var REACT_LAZY_TYPE = Symbol.for("react.lazy");
32981 - var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
32982 - var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
32983 - var FAUX_ITERATOR_SYMBOL = "@@iterator";
32984 - function getIteratorFn(maybeIterable) {
32985 - if (maybeIterable === null || typeof maybeIterable !== "object") return null;
32986 - var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
32987 - if (typeof maybeIterator === "function") return maybeIterator;
32988 - return null;
32989 - }
32990 - var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
32991 - function error(format) {
32992 - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2];
32993 - printWarning("error", format, args);
32994 - }
32995 - function printWarning(level, format, args) {
32996 - var stack = ReactSharedInternals.ReactDebugCurrentFrame.getStackAddendum();
32997 - if (stack !== "") {
32998 - format += "%s";
32999 - args = args.concat([stack]);
33000 - }
33001 - var argsWithFormat = args.map(function(item) {
33002 - return String(item);
33003 - });
33004 - argsWithFormat.unshift("Warning: " + format);
33005 - Function.prototype.apply.call(console[level], console, argsWithFormat);
33006 - }
33007 - var enableScopeAPI = false;
33008 - var enableCacheElement = false;
33009 - var enableTransitionTracing = false;
33010 - var enableLegacyHidden = false;
33011 - var enableDebugTracing = false;
33012 - var REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
33013 - function isValidElementType(type) {
33014 - if (typeof type === "string" || typeof type === "function") return true;
33015 - if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) return true;
33016 - if (typeof type === "object" && type !== null) {
33017 - if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) return true;
33018 - }
33019 - return false;
33020 - }
33021 - function getWrappedName(outerType, innerType, wrapperName) {
33022 - var displayName = outerType.displayName;
33023 - if (displayName) return displayName;
33024 - var functionName = innerType.displayName || innerType.name || "";
33025 - return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
33026 - }
33027 - function getContextName(type) {
33028 - return type.displayName || "Context";
33029 - }
33030 - function getComponentNameFromType(type) {
33031 - if (type == null) return null;
33032 - if (typeof type.tag === "number") error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
33033 - if (typeof type === "function") return type.displayName || type.name || null;
33034 - if (typeof type === "string") return type;
33035 - switch (type) {
33036 - case REACT_FRAGMENT_TYPE: return "Fragment";
33037 - case REACT_PORTAL_TYPE: return "Portal";
33038 - case REACT_PROFILER_TYPE: return "Profiler";
33039 - case REACT_STRICT_MODE_TYPE: return "StrictMode";
33040 - case REACT_SUSPENSE_TYPE: return "Suspense";
33041 - case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList";
33042 - }
33043 - if (typeof type === "object") switch (type.$$typeof) {
33044 - case REACT_CONTEXT_TYPE: return getContextName(type) + ".Consumer";
33045 - case REACT_PROVIDER_TYPE: return getContextName(type._context) + ".Provider";
33046 - case REACT_FORWARD_REF_TYPE: return getWrappedName(type, type.render, "ForwardRef");
33047 - case REACT_MEMO_TYPE:
33048 - var outerName = type.displayName || null;
33049 - if (outerName !== null) return outerName;
33050 - return getComponentNameFromType(type.type) || "Memo";
33051 - case REACT_LAZY_TYPE:
33052 - var lazyComponent = type;
33053 - var payload = lazyComponent._payload;
33054 - var init = lazyComponent._init;
33055 - try {
33056 - return getComponentNameFromType(init(payload));
33057 - } catch (x) {
33058 - return null;
33059 - }
33060 - }
33061 - return null;
33062 - }
33063 - var assign = Object.assign;
33064 - var disabledDepth = 0;
33065 - var prevLog;
33066 - var prevInfo;
33067 - var prevWarn;
33068 - var prevError;
33069 - var prevGroup;
33070 - var prevGroupCollapsed;
33071 - var prevGroupEnd;
33072 - function disabledLog() {}
33073 - disabledLog.__reactDisabledLog = true;
33074 - function disableLogs() {
33075 - if (disabledDepth === 0) {
33076 - prevLog = console.log;
33077 - prevInfo = console.info;
33078 - prevWarn = console.warn;
33079 - prevError = console.error;
33080 - prevGroup = console.group;
33081 - prevGroupCollapsed = console.groupCollapsed;
33082 - prevGroupEnd = console.groupEnd;
33083 - var props = {
33084 - configurable: true,
33085 - enumerable: true,
33086 - value: disabledLog,
33087 - writable: true
33088 - };
33089 - Object.defineProperties(console, {
33090 - info: props,
33091 - log: props,
33092 - warn: props,
33093 - error: props,
33094 - group: props,
33095 - groupCollapsed: props,
33096 - groupEnd: props
33097 - });
33098 - }
33099 - disabledDepth++;
33100 - }
33101 - function reenableLogs() {
33102 - disabledDepth--;
33103 - if (disabledDepth === 0) {
33104 - var props = {
33105 - configurable: true,
33106 - enumerable: true,
33107 - writable: true
33108 - };
33109 - Object.defineProperties(console, {
33110 - log: assign({}, props, { value: prevLog }),
33111 - info: assign({}, props, { value: prevInfo }),
33112 - warn: assign({}, props, { value: prevWarn }),
33113 - error: assign({}, props, { value: prevError }),
33114 - group: assign({}, props, { value: prevGroup }),
33115 - groupCollapsed: assign({}, props, { value: prevGroupCollapsed }),
33116 - groupEnd: assign({}, props, { value: prevGroupEnd })
33117 - });
33118 - }
33119 - if (disabledDepth < 0) error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
33120 - }
33121 - var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
33122 - var prefix;
33123 - function describeBuiltInComponentFrame(name, source, ownerFn) {
33124 - if (prefix === void 0) try {
33125 - throw Error();
33126 - } catch (x) {
33127 - var match = x.stack.trim().match(/\n( *(at )?)/);
33128 - prefix = match && match[1] || "";
33129 - }
33130 - return "\n" + prefix + name;
33131 - }
33132 - var reentry = false;
33133 - var componentFrameCache = new (typeof WeakMap === "function" ? WeakMap : Map)();
33134 - function describeNativeComponentFrame(fn, construct) {
33135 - if (!fn || reentry) return "";
33136 - var frame = componentFrameCache.get(fn);
33137 - if (frame !== void 0) return frame;
33138 - var control;
33139 - reentry = true;
33140 - var previousPrepareStackTrace = Error.prepareStackTrace;
33141 - Error.prepareStackTrace = void 0;
33142 - var previousDispatcher = ReactCurrentDispatcher.current;
33143 - ReactCurrentDispatcher.current = null;
33144 - disableLogs();
33145 - try {
33146 - if (construct) {
33147 - var Fake = function() {
33148 - throw Error();
33149 - };
33150 - Object.defineProperty(Fake.prototype, "props", { set: function() {
33151 - throw Error();
33152 - } });
33153 - if (typeof Reflect === "object" && Reflect.construct) {
33154 - try {
33155 - Reflect.construct(Fake, []);
33156 - } catch (x) {
33157 - control = x;
33158 - }
33159 - Reflect.construct(fn, [], Fake);
33160 - } else {
33161 - try {
33162 - Fake.call();
33163 - } catch (x) {
33164 - control = x;
33165 - }
33166 - fn.call(Fake.prototype);
33167 - }
33168 - } else {
33169 - try {
33170 - throw Error();
33171 - } catch (x) {
33172 - control = x;
33173 - }
33174 - fn();
33175 - }
33176 - } catch (sample) {
33177 - if (sample && control && typeof sample.stack === "string") {
33178 - var sampleLines = sample.stack.split("\n");
33179 - var controlLines = control.stack.split("\n");
33180 - var s = sampleLines.length - 1;
33181 - var c = controlLines.length - 1;
33182 - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) c--;
33183 - for (; s >= 1 && c >= 0; s--, c--) if (sampleLines[s] !== controlLines[c]) {
33184 - if (s !== 1 || c !== 1) do {
33185 - s--;
33186 - c--;
33187 - if (c < 0 || sampleLines[s] !== controlLines[c]) {
33188 - var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
33189 - if (fn.displayName && _frame.includes("<anonymous>")) _frame = _frame.replace("<anonymous>", fn.displayName);
33190 - if (typeof fn === "function") componentFrameCache.set(fn, _frame);
33191 - return _frame;
33192 - }
33193 - } while (s >= 1 && c >= 0);
33194 - break;
33195 - }
33196 - }
33197 - } finally {
33198 - reentry = false;
33199 - ReactCurrentDispatcher.current = previousDispatcher;
33200 - reenableLogs();
33201 - Error.prepareStackTrace = previousPrepareStackTrace;
33202 - }
33203 - var name = fn ? fn.displayName || fn.name : "";
33204 - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
33205 - if (typeof fn === "function") componentFrameCache.set(fn, syntheticFrame);
33206 - return syntheticFrame;
33207 - }
33208 - function describeFunctionComponentFrame(fn, source, ownerFn) {
33209 - return describeNativeComponentFrame(fn, false);
33210 - }
33211 - function shouldConstruct(Component) {
33212 - var prototype = Component.prototype;
33213 - return !!(prototype && prototype.isReactComponent);
33214 - }
33215 - function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
33216 - if (type == null) return "";
33217 - if (typeof type === "function") return describeNativeComponentFrame(type, shouldConstruct(type));
33218 - if (typeof type === "string") return describeBuiltInComponentFrame(type);
33219 - switch (type) {
33220 - case REACT_SUSPENSE_TYPE: return describeBuiltInComponentFrame("Suspense");
33221 - case REACT_SUSPENSE_LIST_TYPE: return describeBuiltInComponentFrame("SuspenseList");
33222 - }
33223 - if (typeof type === "object") switch (type.$$typeof) {
33224 - case REACT_FORWARD_REF_TYPE: return describeFunctionComponentFrame(type.render);
33225 - case REACT_MEMO_TYPE: return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
33226 - case REACT_LAZY_TYPE:
33227 - var lazyComponent = type;
33228 - var payload = lazyComponent._payload;
33229 - var init = lazyComponent._init;
33230 - try {
33231 - return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
33232 - } catch (x) {}
33233 - }
33234 - return "";
33235 - }
33236 - var hasOwnProperty = Object.prototype.hasOwnProperty;
33237 - var loggedTypeFailures = {};
33238 - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
33239 - function setCurrentlyValidatingElement(element) {
33240 - if (element) {
33241 - var owner = element._owner;
33242 - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
33243 - ReactDebugCurrentFrame.setExtraStackFrame(stack);
33244 - } else ReactDebugCurrentFrame.setExtraStackFrame(null);
33245 - }
33246 - function checkPropTypes(typeSpecs, values, location, componentName, element) {
33247 - var has = Function.call.bind(hasOwnProperty);
33248 - for (var typeSpecName in typeSpecs) if (has(typeSpecs, typeSpecName)) {
33249 - var error$1 = void 0;
33250 - try {
33251 - if (typeof typeSpecs[typeSpecName] !== "function") {
33252 - var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
33253 - err.name = "Invariant Violation";
33254 - throw err;
33255 - }
33256 - error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
33257 - } catch (ex) {
33258 - error$1 = ex;
33259 - }
33260 - if (error$1 && !(error$1 instanceof Error)) {
33261 - setCurrentlyValidatingElement(element);
33262 - error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
33263 - setCurrentlyValidatingElement(null);
33264 - }
33265 - if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
33266 - loggedTypeFailures[error$1.message] = true;
33267 - setCurrentlyValidatingElement(element);
33268 - error("Failed %s type: %s", location, error$1.message);
33269 - setCurrentlyValidatingElement(null);
33270 - }
33271 - }
33272 - }
33273 - var isArrayImpl = Array.isArray;
33274 - function isArray(a) {
33275 - return isArrayImpl(a);
33276 - }
33277 - function typeName(value) {
33278 - return typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
33279 - }
33280 - function willCoercionThrow(value) {
33281 - try {
33282 - testStringCoercion(value);
33283 - return false;
33284 - } catch (e) {
33285 - return true;
33286 - }
33287 - }
33288 - function testStringCoercion(value) {
33289 - return "" + value;
33290 - }
33291 - function checkKeyStringCoercion(value) {
33292 - if (willCoercionThrow(value)) {
33293 - error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
33294 - return testStringCoercion(value);
33295 - }
33296 - }
33297 - var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
33298 - var RESERVED_PROPS = {
33299 - key: true,
33300 - ref: true,
33301 - __self: true,
33302 - __source: true
33303 - };
33304 - var specialPropKeyWarningShown;
33305 - var specialPropRefWarningShown;
33306 - var didWarnAboutStringRefs = {};
33307 - function hasValidRef(config) {
33308 - if (hasOwnProperty.call(config, "ref")) {
33309 - var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
33310 - if (getter && getter.isReactWarning) return false;
33311 - }
33312 - return config.ref !== void 0;
33313 - }
33314 - function hasValidKey(config) {
33315 - if (hasOwnProperty.call(config, "key")) {
33316 - var getter = Object.getOwnPropertyDescriptor(config, "key").get;
33317 - if (getter && getter.isReactWarning) return false;
33318 - }
33319 - return config.key !== void 0;
33320 - }
33321 - function warnIfStringRefCannotBeAutoConverted(config, self) {
33322 - if (typeof config.ref === "string" && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
33323 - var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
33324 - if (!didWarnAboutStringRefs[componentName]) {
33325 - error("Component \"%s\" contains the string ref \"%s\". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref", getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
33326 - didWarnAboutStringRefs[componentName] = true;
33327 - }
33328 - }
33329 - }
33330 - function defineKeyPropWarningGetter(props, displayName) {
33331 - var warnAboutAccessingKey = function() {
33332 - if (!specialPropKeyWarningShown) {
33333 - specialPropKeyWarningShown = true;
33334 - error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
33335 - }
33336 - };
33337 - warnAboutAccessingKey.isReactWarning = true;
33338 - Object.defineProperty(props, "key", {
33339 - get: warnAboutAccessingKey,
33340 - configurable: true
33341 - });
33342 - }
33343 - function defineRefPropWarningGetter(props, displayName) {
33344 - var warnAboutAccessingRef = function() {
33345 - if (!specialPropRefWarningShown) {
33346 - specialPropRefWarningShown = true;
33347 - error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
33348 - }
33349 - };
33350 - warnAboutAccessingRef.isReactWarning = true;
33351 - Object.defineProperty(props, "ref", {
33352 - get: warnAboutAccessingRef,
33353 - configurable: true
33354 - });
33355 - }
33356 - /**
33357 - * Factory method to create a new React element. This no longer adheres to
33358 - * the class pattern, so do not use new to call it. Also, instanceof check
33359 - * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
33360 - * if something is a React Element.
33361 - *
33362 - * @param {*} type
33363 - * @param {*} props
33364 - * @param {*} key
33365 - * @param {string|object} ref
33366 - * @param {*} owner
33367 - * @param {*} self A *temporary* helper to detect places where `this` is
33368 - * different from the `owner` when React.createElement is called, so that we
33369 - * can warn. We want to get rid of owner and replace string `ref`s with arrow
33370 - * functions, and as long as `this` and owner are the same, there will be no
33371 - * change in behavior.
33372 - * @param {*} source An annotation object (added by a transpiler or otherwise)
33373 - * indicating filename, line number, and/or other information.
33374 - * @internal
33375 - */
33376 - var ReactElement = function(type, key, ref, self, source, owner, props) {
33377 - var element = {
33378 - $$typeof: REACT_ELEMENT_TYPE,
33379 - type,
33380 - key,
33381 - ref,
33382 - props,
33383 - _owner: owner
33384 - };
33385 - element._store = {};
33386 - Object.defineProperty(element._store, "validated", {
33387 - configurable: false,
33388 - enumerable: false,
33389 - writable: true,
33390 - value: false
33391 - });
33392 - Object.defineProperty(element, "_self", {
33393 - configurable: false,
33394 - enumerable: false,
33395 - writable: false,
33396 - value: self
33397 - });
33398 - Object.defineProperty(element, "_source", {
33399 - configurable: false,
33400 - enumerable: false,
33401 - writable: false,
33402 - value: source
33403 - });
33404 - if (Object.freeze) {
33405 - Object.freeze(element.props);
33406 - Object.freeze(element);
33407 - }
33408 - return element;
33409 - };
33410 - /**
33411 - * https://github.com/reactjs/rfcs/pull/107
33412 - * @param {*} type
33413 - * @param {object} props
33414 - * @param {string} key
33415 - */
33416 - function jsxDEV(type, config, maybeKey, source, self) {
33417 - var propName;
33418 - var props = {};
33419 - var key = null;
33420 - var ref = null;
33421 - if (maybeKey !== void 0) {
33422 - checkKeyStringCoercion(maybeKey);
33423 - key = "" + maybeKey;
33424 - }
33425 - if (hasValidKey(config)) {
33426 - checkKeyStringCoercion(config.key);
33427 - key = "" + config.key;
33428 - }
33429 - if (hasValidRef(config)) {
33430 - ref = config.ref;
33431 - warnIfStringRefCannotBeAutoConverted(config, self);
33432 - }
33433 - for (propName in config) if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) props[propName] = config[propName];
33434 - if (type && type.defaultProps) {
33435 - var defaultProps = type.defaultProps;
33436 - for (propName in defaultProps) if (props[propName] === void 0) props[propName] = defaultProps[propName];
33437 - }
33438 - if (key || ref) {
33439 - var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
33440 - if (key) defineKeyPropWarningGetter(props, displayName);
33441 - if (ref) defineRefPropWarningGetter(props, displayName);
33442 - }
33443 - return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
33444 - }
33445 - var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
33446 - var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
33447 - function setCurrentlyValidatingElement$1(element) {
33448 - if (element) {
33449 - var owner = element._owner;
33450 - var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
33451 - ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
33452 - } else ReactDebugCurrentFrame$1.setExtraStackFrame(null);
33453 - }
33454 - var propTypesMisspellWarningShown = false;
33455 - /**
33456 - * Verifies the object is a ReactElement.
33457 - * See https://reactjs.org/docs/react-api.html#isvalidelement
33458 - * @param {?object} object
33459 - * @return {boolean} True if `object` is a ReactElement.
33460 - * @final
33461 - */
33462 - function isValidElement(object) {
33463 - return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
33464 - }
33465 - function getDeclarationErrorAddendum() {
33466 - if (ReactCurrentOwner$1.current) {
33467 - var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
33468 - if (name) return "\n\nCheck the render method of `" + name + "`.";
33469 - }
33470 - return "";
33471 - }
33472 - function getSourceInfoErrorAddendum(source) {
33473 - if (source !== void 0) {
33474 - var fileName = source.fileName.replace(/^.*[\\\/]/, "");
33475 - var lineNumber = source.lineNumber;
33476 - return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
33477 - }
33478 - return "";
33479 - }
33480 - /**
33481 - * Warn if there's no key explicitly set on dynamic arrays of children or
33482 - * object keys are not valid. This allows us to keep track of children between
33483 - * updates.
33484 - */
33485 - var ownerHasKeyUseWarning = {};
33486 - function getCurrentComponentErrorInfo(parentType) {
33487 - var info = getDeclarationErrorAddendum();
33488 - if (!info) {
33489 - var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
33490 - if (parentName) info = "\n\nCheck the top-level render call using <" + parentName + ">.";
33491 - }
33492 - return info;
33493 - }
33494 - /**
33495 - * Warn if the element doesn't have an explicit key assigned to it.
33496 - * This element is in an array. The array could grow and shrink or be
33497 - * reordered. All children that haven't already been validated are required to
33498 - * have a "key" property assigned to it. Error statuses are cached so a warning
33499 - * will only be shown once.
33500 - *
33501 - * @internal
33502 - * @param {ReactElement} element Element that requires a key.
33503 - * @param {*} parentType element's parent's type.
33504 - */
33505 - function validateExplicitKey(element, parentType) {
33506 - if (!element._store || element._store.validated || element.key != null) return;
33507 - element._store.validated = true;
33508 - var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
33509 - if (ownerHasKeyUseWarning[currentComponentErrorInfo]) return;
33510 - ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
33511 - var childOwner = "";
33512 - if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
33513 - setCurrentlyValidatingElement$1(element);
33514 - error("Each child in a list should have a unique \"key\" prop.%s%s See https://reactjs.org/link/warning-keys for more information.", currentComponentErrorInfo, childOwner);
33515 - setCurrentlyValidatingElement$1(null);
33516 - }
33517 - /**
33518 - * Ensure that every element either is passed in a static location, in an
33519 - * array with an explicit keys property defined, or in an object literal
33520 - * with valid key property.
33521 - *
33522 - * @internal
33523 - * @param {ReactNode} node Statically passed child of any type.
33524 - * @param {*} parentType node's parent's type.
33525 - */
33526 - function validateChildKeys(node, parentType) {
33527 - if (typeof node !== "object") return;
33528 - if (isArray(node)) for (var i = 0; i < node.length; i++) {
33529 - var child = node[i];
33530 - if (isValidElement(child)) validateExplicitKey(child, parentType);
33531 - }
33532 - else if (isValidElement(node)) {
33533 - if (node._store) node._store.validated = true;
33534 - } else if (node) {
33535 - var iteratorFn = getIteratorFn(node);
33536 - if (typeof iteratorFn === "function") {
33537 - if (iteratorFn !== node.entries) {
33538 - var iterator = iteratorFn.call(node);
33539 - var step;
33540 - while (!(step = iterator.next()).done) if (isValidElement(step.value)) validateExplicitKey(step.value, parentType);
33541 - }
33542 - }
33543 - }
33544 - }
33545 - /**
33546 - * Given an element, validate that its props follow the propTypes definition,
33547 - * provided by the type.
33548 - *
33549 - * @param {ReactElement} element
33550 - */
33551 - function validatePropTypes(element) {
33552 - var type = element.type;
33553 - if (type === null || type === void 0 || typeof type === "string") return;
33554 - var propTypes;
33555 - if (typeof type === "function") propTypes = type.propTypes;
33556 - else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_MEMO_TYPE)) propTypes = type.propTypes;
33557 - else return;
33558 - if (propTypes) {
33559 - var name = getComponentNameFromType(type);
33560 - checkPropTypes(propTypes, element.props, "prop", name, element);
33561 - } else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
33562 - propTypesMisspellWarningShown = true;
33563 - error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", getComponentNameFromType(type) || "Unknown");
33564 - }
33565 - if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
33566 - }
33567 - /**
33568 - * Given a fragment, validate that it can only be provided with fragment props
33569 - * @param {ReactElement} fragment
33570 - */
33571 - function validateFragmentProps(fragment) {
33572 - var keys = Object.keys(fragment.props);
33573 - for (var i = 0; i < keys.length; i++) {
33574 - var key = keys[i];
33575 - if (key !== "children" && key !== "key") {
33576 - setCurrentlyValidatingElement$1(fragment);
33577 - error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
33578 - setCurrentlyValidatingElement$1(null);
33579 - break;
33580 - }
33581 - }
33582 - if (fragment.ref !== null) {
33583 - setCurrentlyValidatingElement$1(fragment);
33584 - error("Invalid attribute `ref` supplied to `React.Fragment`.");
33585 - setCurrentlyValidatingElement$1(null);
33586 - }
33587 - }
33588 - var didWarnAboutKeySpread = {};
33589 - function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
33590 - var validType = isValidElementType(type);
33591 - if (!validType) {
33592 - var info = "";
33593 - if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
33594 - var sourceInfo = getSourceInfoErrorAddendum(source);
33595 - if (sourceInfo) info += sourceInfo;
33596 - else info += getDeclarationErrorAddendum();
33597 - var typeString;
33598 - if (type === null) typeString = "null";
33599 - else if (isArray(type)) typeString = "array";
33600 - else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
33601 - typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
33602 - info = " Did you accidentally export a JSX literal instead of a component?";
33603 - } else typeString = typeof type;
33604 - error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
33605 - }
33606 - var element = jsxDEV(type, props, key, source, self);
33607 - if (element == null) return element;
33608 - if (validType) {
33609 - var children = props.children;
33610 - if (children !== void 0) if (isStaticChildren) if (isArray(children)) {
33611 - for (var i = 0; i < children.length; i++) validateChildKeys(children[i], type);
33612 - if (Object.freeze) Object.freeze(children);
33613 - } else error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
33614 - else validateChildKeys(children, type);
33615 - }
33616 - if (hasOwnProperty.call(props, "key")) {
33617 - var componentName = getComponentNameFromType(type);
33618 - var keys = Object.keys(props).filter(function(k) {
33619 - return k !== "key";
33620 - });
33621 - var beforeExample = keys.length > 0 ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
33622 - if (!didWarnAboutKeySpread[componentName + beforeExample]) {
33623 - error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", beforeExample, componentName, keys.length > 0 ? "{" + keys.join(": ..., ") + ": ...}" : "{}", componentName);
33624 - didWarnAboutKeySpread[componentName + beforeExample] = true;
33625 - }
33626 - }
33627 - if (type === REACT_FRAGMENT_TYPE) validateFragmentProps(element);
33628 - else validatePropTypes(element);
33629 - return element;
33630 - }
33631 - function jsxWithValidationStatic(type, props, key) {
33632 - return jsxWithValidation(type, props, key, true);
33633 - }
33634 - function jsxWithValidationDynamic(type, props, key) {
33635 - return jsxWithValidation(type, props, key, false);
33636 - }
33637 - var jsx = jsxWithValidationDynamic;
33638 - var jsxs = jsxWithValidationStatic;
33639 - exports.Fragment = REACT_FRAGMENT_TYPE;
33640 - exports.jsx = jsx;
33641 - exports.jsxs = jsxs;
33642 - })();
33643 - }));
33644 -
33645 -//#endregion
33646 -//#region node_modules/react/jsx-runtime.js
33647 - var require_jsx_runtime = /* @__PURE__ */ __commonJSMin(((exports, module) => {
33648 - module.exports = require_react_jsx_runtime_development();
33649 - }));
33650 -
33651 -//#endregion
33652 -//#region node_modules/fast-equals/dist/es/index.mjs
33653 -var import_shim = require_shim();
33654 -var import_jsx_runtime = require_jsx_runtime();
33655 - var { getOwnPropertyNames, getOwnPropertySymbols } = Object;
33656 - var { hasOwnProperty } = Object.prototype;
33657 - /**
33658 - * Combine two comparators into a single comparators.
33659 - */
33660 - function combineComparators(comparatorA, comparatorB) {
33661 - return function isEqual(a, b, state) {
33662 - return comparatorA(a, b, state) && comparatorB(a, b, state);
33663 - };
33664 - }
33665 - /**
33666 - * Wrap the provided `areItemsEqual` method to manage the circular state, allowing
33667 - * for circular references to be safely included in the comparison without creating
33668 - * stack overflows.
33669 - */
33670 - function createIsCircular(areItemsEqual) {
33671 - return function isCircular(a, b, state) {
33672 - if (!a || !b || typeof a !== "object" || typeof b !== "object") return areItemsEqual(a, b, state);
33673 - const { cache } = state;
33674 - const cachedA = cache.get(a);
33675 - const cachedB = cache.get(b);
33676 - if (cachedA && cachedB) return cachedA === b && cachedB === a;
33677 - cache.set(a, b);
33678 - cache.set(b, a);
33679 - const result = areItemsEqual(a, b, state);
33680 - cache.delete(a);
33681 - cache.delete(b);
33682 - return result;
33683 - };
33684 - }
33685 - /**
33686 - * Get the `@@toStringTag` of the value, if it exists.
33687 - */
33688 - function getShortTag(value) {
33689 - return value != null ? value[Symbol.toStringTag] : void 0;
33690 - }
33691 - /**
33692 - * Get the properties to strictly examine, which include both own properties that are
33693 - * not enumerable and symbol properties.
33694 - */
33695 - function getStrictProperties(object) {
33696 - return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
33697 - }
33698 - /**
33699 - * Whether the object contains the property passed as an own property.
33700 - */
33701 - var hasOwn = Object.hasOwn || ((object, property) => hasOwnProperty.call(object, property));
33702 - /**
33703 - * Whether the values passed are strictly equal or both NaN.
33704 - */
33705 - function sameValueZeroEqual(a, b) {
33706 - return a === b || !a && !b && a !== a && b !== b;
33707 - }
33708 - var PREACT_VNODE = "__v";
33709 - var PREACT_OWNER = "__o";
33710 - var REACT_OWNER = "_owner";
33711 - var { getOwnPropertyDescriptor, keys } = Object;
33712 - /**
33713 - * Whether the array buffers are equal in value.
33714 - */
33715 - function areArrayBuffersEqual(a, b) {
33716 - return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a), new Uint8Array(b));
33717 - }
33718 - /**
33719 - * Whether the arrays are equal in value.
33720 - */
33721 - function areArraysEqual(a, b, state) {
33722 - let index = a.length;
33723 - if (b.length !== index) return false;
33724 - while (index-- > 0) if (!state.equals(a[index], b[index], index, index, a, b, state)) return false;
33725 - return true;
33726 - }
33727 - /**
33728 - * Whether the dataviews are equal in value.
33729 - */
33730 - function areDataViewsEqual(a, b) {
33731 - return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength));
33732 - }
33733 - /**
33734 - * Whether the dates passed are equal in value.
33735 - */
33736 - function areDatesEqual(a, b) {
33737 - return sameValueZeroEqual(a.getTime(), b.getTime());
33738 - }
33739 - /**
33740 - * Whether the errors passed are equal in value.
33741 - */
33742 - function areErrorsEqual(a, b) {
33743 - return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
33744 - }
33745 - /**
33746 - * Whether the functions passed are equal in value.
33747 - */
33748 - function areFunctionsEqual(a, b) {
33749 - return a === b;
33750 - }
33751 - /**
33752 - * Whether the `Map`s are equal in value.
33753 - */
33754 - function areMapsEqual(a, b, state) {
33755 - const size = a.size;
33756 - if (size !== b.size) return false;
33757 - if (!size) return true;
33758 - const matchedIndices = new Array(size);
33759 - const aIterable = a.entries();
33760 - let aResult;
33761 - let bResult;
33762 - let index = 0;
33763 - while (aResult = aIterable.next()) {
33764 - if (aResult.done) break;
33765 - const bIterable = b.entries();
33766 - let hasMatch = false;
33767 - let matchIndex = 0;
33768 - while (bResult = bIterable.next()) {
33769 - if (bResult.done) break;
33770 - if (matchedIndices[matchIndex]) {
33771 - matchIndex++;
33772 - continue;
33773 - }
33774 - const aEntry = aResult.value;
33775 - const bEntry = bResult.value;
33776 - if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state) && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
33777 - hasMatch = matchedIndices[matchIndex] = true;
33778 - break;
33779 - }
33780 - matchIndex++;
33781 - }
33782 - if (!hasMatch) return false;
33783 - index++;
33784 - }
33785 - return true;
33786 - }
33787 - /**
33788 - * Whether the numbers are equal in value.
33789 - */
33790 - var areNumbersEqual = sameValueZeroEqual;
33791 - /**
33792 - * Whether the objects are equal in value.
33793 - */
33794 - function areObjectsEqual(a, b, state) {
33795 - const properties = keys(a);
33796 - let index = properties.length;
33797 - if (keys(b).length !== index) return false;
33798 - while (index-- > 0) if (!isPropertyEqual(a, b, state, properties[index])) return false;
33799 - return true;
33800 - }
33801 - /**
33802 - * Whether the objects are equal in value with strict property checking.
33803 - */
33804 - function areObjectsEqualStrict(a, b, state) {
33805 - const properties = getStrictProperties(a);
33806 - let index = properties.length;
33807 - if (getStrictProperties(b).length !== index) return false;
33808 - let property;
33809 - let descriptorA;
33810 - let descriptorB;
33811 - while (index-- > 0) {
33812 - property = properties[index];
33813 - if (!isPropertyEqual(a, b, state, property)) return false;
33814 - descriptorA = getOwnPropertyDescriptor(a, property);
33815 - descriptorB = getOwnPropertyDescriptor(b, property);
33816 - if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) return false;
33817 - }
33818 - return true;
33819 - }
33820 - /**
33821 - * Whether the primitive wrappers passed are equal in value.
33822 - */
33823 - function arePrimitiveWrappersEqual(a, b) {
33824 - return sameValueZeroEqual(a.valueOf(), b.valueOf());
33825 - }
33826 - /**
33827 - * Whether the regexps passed are equal in value.
33828 - */
33829 - function areRegExpsEqual(a, b) {
33830 - return a.source === b.source && a.flags === b.flags;
33831 - }
33832 - /**
33833 - * Whether the `Set`s are equal in value.
33834 - */
33835 - function areSetsEqual(a, b, state) {
33836 - const size = a.size;
33837 - if (size !== b.size) return false;
33838 - if (!size) return true;
33839 - const matchedIndices = new Array(size);
33840 - const aIterable = a.values();
33841 - let aResult;
33842 - let bResult;
33843 - while (aResult = aIterable.next()) {
33844 - if (aResult.done) break;
33845 - const bIterable = b.values();
33846 - let hasMatch = false;
33847 - let matchIndex = 0;
33848 - while (bResult = bIterable.next()) {
33849 - if (bResult.done) break;
33850 - if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
33851 - hasMatch = matchedIndices[matchIndex] = true;
33852 - break;
33853 - }
33854 - matchIndex++;
33855 - }
33856 - if (!hasMatch) return false;
33857 - }
33858 - return true;
33859 - }
33860 - /**
33861 - * Whether the TypedArray instances are equal in value.
33862 - */
33863 - function areTypedArraysEqual(a, b) {
33864 - let index = a.byteLength;
33865 - if (b.byteLength !== index || a.byteOffset !== b.byteOffset) return false;
33866 - while (index-- > 0) if (a[index] !== b[index]) return false;
33867 - return true;
33868 - }
33869 - /**
33870 - * Whether the URL instances are equal in value.
33871 - */
33872 - function areUrlsEqual(a, b) {
33873 - return a.hostname === b.hostname && a.pathname === b.pathname && a.protocol === b.protocol && a.port === b.port && a.hash === b.hash && a.username === b.username && a.password === b.password;
33874 - }
33875 - function isPropertyEqual(a, b, state, property) {
33876 - if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) return true;
33877 - return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
33878 - }
33879 - var ARRAY_BUFFER_TAG = "[object ArrayBuffer]";
33880 - var ARGUMENTS_TAG = "[object Arguments]";
33881 - var BOOLEAN_TAG = "[object Boolean]";
33882 - var DATA_VIEW_TAG = "[object DataView]";
33883 - var DATE_TAG = "[object Date]";
33884 - var ERROR_TAG = "[object Error]";
33885 - var MAP_TAG = "[object Map]";
33886 - var NUMBER_TAG = "[object Number]";
33887 - var OBJECT_TAG = "[object Object]";
33888 - var REG_EXP_TAG = "[object RegExp]";
33889 - var SET_TAG = "[object Set]";
33890 - var STRING_TAG = "[object String]";
33891 - var TYPED_ARRAY_TAGS = {
33892 - "[object Int8Array]": true,
33893 - "[object Uint8Array]": true,
33894 - "[object Uint8ClampedArray]": true,
33895 - "[object Int16Array]": true,
33896 - "[object Uint16Array]": true,
33897 - "[object Int32Array]": true,
33898 - "[object Uint32Array]": true,
33899 - "[object Float16Array]": true,
33900 - "[object Float32Array]": true,
33901 - "[object Float64Array]": true,
33902 - "[object BigInt64Array]": true,
33903 - "[object BigUint64Array]": true
33904 - };
33905 - var URL_TAG = "[object URL]";
33906 - var toString = Object.prototype.toString;
33907 - /**
33908 - * Create a comparator method based on the type-specific equality comparators passed.
33909 - */
33910 - function createEqualityComparator({ areArrayBuffersEqual, areArraysEqual, areDataViewsEqual, areDatesEqual, areErrorsEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, areTypedArraysEqual, areUrlsEqual, unknownTagComparators }) {
33911 - /**
33912 - * compare the value of the two objects and return true if they are equivalent in values
33913 - */
33914 - return function comparator(a, b, state) {
33915 - if (a === b) return true;
33916 - if (a == null || b == null) return false;
33917 - const type = typeof a;
33918 - if (type !== typeof b) return false;
33919 - if (type !== "object") {
33920 - if (type === "number") return areNumbersEqual(a, b, state);
33921 - if (type === "function") return areFunctionsEqual(a, b, state);
33922 - return false;
33923 - }
33924 - const constructor = a.constructor;
33925 - if (constructor !== b.constructor) return false;
33926 - if (constructor === Object) return areObjectsEqual(a, b, state);
33927 - if (Array.isArray(a)) return areArraysEqual(a, b, state);
33928 - if (constructor === Date) return areDatesEqual(a, b, state);
33929 - if (constructor === RegExp) return areRegExpsEqual(a, b, state);
33930 - if (constructor === Map) return areMapsEqual(a, b, state);
33931 - if (constructor === Set) return areSetsEqual(a, b, state);
33932 - const tag = toString.call(a);
33933 - if (tag === DATE_TAG) return areDatesEqual(a, b, state);
33934 - if (tag === REG_EXP_TAG) return areRegExpsEqual(a, b, state);
33935 - if (tag === MAP_TAG) return areMapsEqual(a, b, state);
33936 - if (tag === SET_TAG) return areSetsEqual(a, b, state);
33937 - if (tag === OBJECT_TAG) return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual(a, b, state);
33938 - if (tag === URL_TAG) return areUrlsEqual(a, b, state);
33939 - if (tag === ERROR_TAG) return areErrorsEqual(a, b, state);
33940 - if (tag === ARGUMENTS_TAG) return areObjectsEqual(a, b, state);
33941 - if (TYPED_ARRAY_TAGS[tag]) return areTypedArraysEqual(a, b, state);
33942 - if (tag === ARRAY_BUFFER_TAG) return areArrayBuffersEqual(a, b, state);
33943 - if (tag === DATA_VIEW_TAG) return areDataViewsEqual(a, b, state);
33944 - if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) return arePrimitiveWrappersEqual(a, b, state);
33945 - if (unknownTagComparators) {
33946 - let unknownTagComparator = unknownTagComparators[tag];
33947 - if (!unknownTagComparator) {
33948 - const shortTag = getShortTag(a);
33949 - if (shortTag) unknownTagComparator = unknownTagComparators[shortTag];
33950 - }
33951 - if (unknownTagComparator) return unknownTagComparator(a, b, state);
33952 - }
33953 - return false;
33954 - };
33955 - }
33956 - /**
33957 - * Create the configuration object used for building comparators.
33958 - */
33959 - function createEqualityComparatorConfig({ circular, createCustomConfig, strict }) {
33960 - let config = {
33961 - areArrayBuffersEqual,
33962 - areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
33963 - areDataViewsEqual,
33964 - areDatesEqual,
33965 - areErrorsEqual,
33966 - areFunctionsEqual,
33967 - areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
33968 - areNumbersEqual,
33969 - areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
33970 - arePrimitiveWrappersEqual,
33971 - areRegExpsEqual,
33972 - areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
33973 - areTypedArraysEqual: strict ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict) : areTypedArraysEqual,
33974 - areUrlsEqual,
33975 - unknownTagComparators: void 0
33976 - };
33977 - if (createCustomConfig) config = Object.assign({}, config, createCustomConfig(config));
33978 - if (circular) {
33979 - const areArraysEqual = createIsCircular(config.areArraysEqual);
33980 - const areMapsEqual = createIsCircular(config.areMapsEqual);
33981 - const areObjectsEqual = createIsCircular(config.areObjectsEqual);
33982 - const areSetsEqual = createIsCircular(config.areSetsEqual);
33983 - config = Object.assign({}, config, {
33984 - areArraysEqual,
33985 - areMapsEqual,
33986 - areObjectsEqual,
33987 - areSetsEqual
33988 - });
33989 - }
33990 - return config;
33991 - }
33992 - /**
33993 - * Default equality comparator pass-through, used as the standard `isEqual` creator for
33994 - * use inside the built comparator.
33995 - */
33996 - function createInternalEqualityComparator(compare) {
33997 - return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
33998 - return compare(a, b, state);
33999 - };
34000 - }
34001 - /**
34002 - * Create the `isEqual` function used by the consuming application.
34003 - */
34004 - function createIsEqual({ circular, comparator, createState, equals, strict }) {
34005 - if (createState) return function isEqual(a, b) {
34006 - const { cache = circular ? /* @__PURE__ */ new WeakMap() : void 0, meta } = createState();
34007 - return comparator(a, b, {
34008 - cache,
34009 - equals,
34010 - meta,
34011 - strict
34012 - });
34013 - };
34014 - if (circular) return function isEqual(a, b) {
34015 - return comparator(a, b, {
34016 - cache: /* @__PURE__ */ new WeakMap(),
34017 - equals,
34018 - meta: void 0,
34019 - strict
34020 - });
34021 - };
34022 - const state = {
34023 - cache: void 0,
34024 - equals,
34025 - meta: void 0,
34026 - strict
34027 - };
34028 - return function isEqual(a, b) {
34029 - return comparator(a, b, state);
34030 - };
34031 - }
34032 - /**
34033 - * Whether the items passed are deeply-equal in value.
34034 - */
34035 - var deepEqual = createCustomEqual();
34036 - /**
34037 - * Whether the items passed are deeply-equal in value based on strict comparison.
34038 - */
34039 - var strictDeepEqual = createCustomEqual({ strict: true });
34040 - /**
34041 - * Whether the items passed are deeply-equal in value, including circular references.
34042 - */
34043 - var circularDeepEqual = createCustomEqual({ circular: true });
34044 - /**
34045 - * Whether the items passed are deeply-equal in value, including circular references,
34046 - * based on strict comparison.
34047 - */
34048 - var strictCircularDeepEqual = createCustomEqual({
34049 - circular: true,
34050 - strict: true
34051 - });
34052 - /**
34053 - * Whether the items passed are shallowly-equal in value.
34054 - */
34055 - var shallowEqual = createCustomEqual({ createInternalComparator: () => sameValueZeroEqual });
34056 - /**
34057 - * Whether the items passed are shallowly-equal in value based on strict comparison
34058 - */
34059 - var strictShallowEqual = createCustomEqual({
34060 - strict: true,
34061 - createInternalComparator: () => sameValueZeroEqual
34062 - });
34063 - /**
34064 - * Whether the items passed are shallowly-equal in value, including circular references.
34065 - */
34066 - var circularShallowEqual = createCustomEqual({
34067 - circular: true,
34068 - createInternalComparator: () => sameValueZeroEqual
34069 - });
34070 - /**
34071 - * Whether the items passed are shallowly-equal in value, including circular references,
34072 - * based on strict comparison.
34073 - */
34074 - var strictCircularShallowEqual = createCustomEqual({
34075 - circular: true,
34076 - createInternalComparator: () => sameValueZeroEqual,
34077 - strict: true
34078 - });
34079 - /**
34080 - * Create a custom equality comparison method.
34081 - *
34082 - * This can be done to create very targeted comparisons in extreme hot-path scenarios
34083 - * where the standard methods are not performant enough, but can also be used to provide
34084 - * support for legacy environments that do not support expected features like
34085 - * `RegExp.prototype.flags` out of the box.
34086 - */
34087 - function createCustomEqual(options = {}) {
34088 - const { circular = false, createInternalComparator: createCustomInternalComparator, createState, strict = false } = options;
34089 - const comparator = createEqualityComparator(createEqualityComparatorConfig(options));
34090 - return createIsEqual({
34091 - circular,
34092 - comparator,
34093 - createState,
34094 - equals: createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator),
34095 - strict
34096 - });
34097 - }
34098 -
34099 -//#endregion
34100 -//#region node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
34101 -/**
34102 - * @license React
34103 - * use-sync-external-store-shim/with-selector.development.js
34104 - *
34105 - * Copyright (c) Meta Platforms, Inc. and affiliates.
34106 - *
34107 - * This source code is licensed under the MIT license found in the
34108 - * LICENSE file in the root directory of this source tree.
34109 - */
34110 - var require_with_selector_development = /* @__PURE__ */ __commonJSMin(((exports) => {
34111 - (function() {
34112 - function is(x, y) {
34113 - return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
34114 - }
34115 - "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
34116 - var React = (globalThis.React);
34117 - var shim = require_shim();
34118 - var objectIs = "function" === typeof Object.is ? Object.is : is;
34119 - var useSyncExternalStore = shim.useSyncExternalStore;
34120 - var useRef = React.useRef;
34121 - var useEffect = React.useEffect;
34122 - var useMemo = React.useMemo;
34123 - var useDebugValue = React.useDebugValue;
34124 - exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
34125 - var instRef = useRef(null);
34126 - if (null === instRef.current) {
34127 - var inst = {
34128 - hasValue: !1,
34129 - value: null
34130 - };
34131 - instRef.current = inst;
34132 - } else inst = instRef.current;
34133 - instRef = useMemo(function() {
34134 - function memoizedSelector(nextSnapshot) {
34135 - if (!hasMemo) {
34136 - hasMemo = !0;
34137 - memoizedSnapshot = nextSnapshot;
34138 - nextSnapshot = selector(nextSnapshot);
34139 - if (void 0 !== isEqual && inst.hasValue) {
34140 - var currentSelection = inst.value;
34141 - if (isEqual(currentSelection, nextSnapshot)) return memoizedSelection = currentSelection;
34142 - }
34143 - return memoizedSelection = nextSnapshot;
34144 - }
34145 - currentSelection = memoizedSelection;
34146 - if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
34147 - var nextSelection = selector(nextSnapshot);
34148 - if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) return memoizedSnapshot = nextSnapshot, currentSelection;
34149 - memoizedSnapshot = nextSnapshot;
34150 - return memoizedSelection = nextSelection;
34151 - }
34152 - var hasMemo = !1;
34153 - var memoizedSnapshot;
34154 - var memoizedSelection;
34155 - var maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
34156 - return [function() {
34157 - return memoizedSelector(getSnapshot());
34158 - }, null === maybeGetServerSnapshot ? void 0 : function() {
34159 - return memoizedSelector(maybeGetServerSnapshot());
34160 - }];
34161 - }, [
34162 - getSnapshot,
34163 - getServerSnapshot,
34164 - selector,
34165 - isEqual
34166 - ]);
34167 - var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
34168 - useEffect(function() {
34169 - inst.hasValue = !0;
34170 - inst.value = value;
34171 - }, [value]);
34172 - useDebugValue(value);
34173 - return value;
34174 - };
34175 - "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
34176 - })();
34177 - }));
34178 -
34179 -//#endregion
34180 -//#region node_modules/use-sync-external-store/shim/with-selector.js
34181 - var require_with_selector = /* @__PURE__ */ __commonJSMin(((exports, module) => {
34182 - module.exports = require_with_selector_development();
34183 - }));
34184 -
34185 -//#endregion
34186 -//#region node_modules/@tiptap/react/dist/index.js
34187 - var import_with_selector = require_with_selector();
34188 - var mergeRefs = (...refs) => {
34189 - return (node) => {
34190 - refs.forEach((ref) => {
34191 - if (typeof ref === "function") ref(node);
34192 - else if (ref) ref.current = node;
34193 - });
34194 - };
34195 - };
34196 - var Portals = ({ contentComponent }) => {
34197 - const renderers = (0, import_shim.useSyncExternalStore)(contentComponent.subscribe, contentComponent.getSnapshot, contentComponent.getServerSnapshot);
34198 - return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: Object.values(renderers) });
34199 - };
34200 - function getInstance() {
34201 - const subscribers = /* @__PURE__ */ new Set();
34202 - let renderers = {};
34203 - return {
34204 - /**
34205 - * Subscribe to the editor instance's changes.
34206 - */
34207 - subscribe(callback) {
34208 - subscribers.add(callback);
34209 - return () => {
34210 - subscribers.delete(callback);
34211 - };
34212 - },
34213 - getSnapshot() {
34214 - return renderers;
34215 - },
34216 - getServerSnapshot() {
34217 - return renderers;
34218 - },
34219 - /**
34220 - * Adds a new NodeView Renderer to the editor.
34221 - */
34222 - setRenderer(id, renderer) {
34223 - renderers = {
34224 - ...renderers,
34225 - [id]: react_dom$1.default.createPortal(renderer.reactElement, renderer.element, id)
34226 - };
34227 - subscribers.forEach((subscriber) => subscriber());
34228 - },
34229 - /**
34230 - * Removes a NodeView Renderer from the editor.
34231 - */
34232 - removeRenderer(id) {
34233 - const nextRenderers = { ...renderers };
34234 - delete nextRenderers[id];
34235 - renderers = nextRenderers;
34236 - subscribers.forEach((subscriber) => subscriber());
34237 - }
34238 - };
34239 - }
34240 - var PureEditorContent = class extends react$1.default.Component {
34241 - constructor(props) {
34242 - var _a;
34243 - super(props);
34244 - this.editorContentRef = react$1.default.createRef();
34245 - this.initialized = false;
34246 - this.state = { hasContentComponentInitialized: Boolean((_a = props.editor) == null ? void 0 : _a.contentComponent) };
34247 - }
34248 - componentDidMount() {
34249 - this.init();
34250 - }
34251 - componentDidUpdate() {
34252 - this.init();
34253 - }
34254 - init() {
34255 - var _a;
34256 - const editor = this.props.editor;
34257 - if (editor && !editor.isDestroyed && ((_a = editor.view.dom) == null ? void 0 : _a.parentNode)) {
34258 - if (editor.contentComponent) return;
34259 - const element = this.editorContentRef.current;
34260 - element.append(...editor.view.dom.parentNode.childNodes);
34261 - editor.setOptions({ element });
34262 - editor.contentComponent = getInstance();
34263 - if (!this.state.hasContentComponentInitialized) this.unsubscribeToContentComponent = editor.contentComponent.subscribe(() => {
34264 - this.setState((prevState) => {
34265 - if (!prevState.hasContentComponentInitialized) return { hasContentComponentInitialized: true };
34266 - return prevState;
34267 - });
34268 - if (this.unsubscribeToContentComponent) this.unsubscribeToContentComponent();
34269 - });
34270 - editor.createNodeViews();
34271 - this.initialized = true;
34272 - }
34273 - }
34274 - componentWillUnmount() {
34275 - var _a;
34276 - const editor = this.props.editor;
34277 - if (!editor) return;
34278 - this.initialized = false;
34279 - if (!editor.isDestroyed) editor.view.setProps({ nodeViews: {} });
34280 - if (this.unsubscribeToContentComponent) this.unsubscribeToContentComponent();
34281 - editor.contentComponent = null;
34282 - try {
34283 - if (!((_a = editor.view.dom) == null ? void 0 : _a.parentNode)) return;
34284 - const newElement = document.createElement("div");
34285 - newElement.append(...editor.view.dom.parentNode.childNodes);
34286 - editor.setOptions({ element: newElement });
34287 - } catch {}
34288 - }
34289 - render() {
34290 - const { editor, innerRef, ...rest } = this.props;
34291 - return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
34292 - ref: mergeRefs(innerRef, this.editorContentRef),
34293 - ...rest
34294 - }), (editor == null ? void 0 : editor.contentComponent) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Portals, { contentComponent: editor.contentComponent })] });
34295 - }
34296 - };
34297 - var EditorContentWithKey = (0, react$1.forwardRef)((props, ref) => {
34298 - const key = react$1.default.useMemo(() => {
34299 - return Math.floor(Math.random() * 4294967295).toString();
34300 - }, [props.editor]);
34301 - return react$1.default.createElement(PureEditorContent, {
34302 - key,
34303 - innerRef: ref,
34304 - ...props
34305 - });
34306 - });
34307 - var EditorContent = react$1.default.memo(EditorContentWithKey);
34308 - var useIsomorphicLayoutEffect = typeof window !== "undefined" ? react$1.useLayoutEffect : react$1.useEffect;
34309 - var EditorStateManager = class {
34310 - constructor(initialEditor) {
34311 - this.transactionNumber = 0;
34312 - this.lastTransactionNumber = 0;
34313 - this.subscribers = /* @__PURE__ */ new Set();
34314 - this.editor = initialEditor;
34315 - this.lastSnapshot = {
34316 - editor: initialEditor,
34317 - transactionNumber: 0
34318 - };
34319 - this.getSnapshot = this.getSnapshot.bind(this);
34320 - this.getServerSnapshot = this.getServerSnapshot.bind(this);
34321 - this.watch = this.watch.bind(this);
34322 - this.subscribe = this.subscribe.bind(this);
34323 - }
34324 - /**
34325 - * Get the current editor instance.
34326 - */
34327 - getSnapshot() {
34328 - if (this.transactionNumber === this.lastTransactionNumber) return this.lastSnapshot;
34329 - this.lastTransactionNumber = this.transactionNumber;
34330 - this.lastSnapshot = {
34331 - editor: this.editor,
34332 - transactionNumber: this.transactionNumber
34333 - };
34334 - return this.lastSnapshot;
34335 - }
34336 - /**
34337 - * Always disable the editor on the server-side.
34338 - */
34339 - getServerSnapshot() {
34340 - return {
34341 - editor: null,
34342 - transactionNumber: 0
34343 - };
34344 - }
34345 - /**
34346 - * Subscribe to the editor instance's changes.
34347 - */
34348 - subscribe(callback) {
34349 - this.subscribers.add(callback);
34350 - return () => {
34351 - this.subscribers.delete(callback);
34352 - };
34353 - }
34354 - /**
34355 - * Watch the editor instance for changes.
34356 - */
34357 - watch(nextEditor) {
34358 - this.editor = nextEditor;
34359 - if (this.editor) {
34360 - const fn = () => {
34361 - this.transactionNumber += 1;
34362 - this.subscribers.forEach((callback) => callback());
34363 - };
34364 - const currentEditor = this.editor;
34365 - currentEditor.on("transaction", fn);
34366 - return () => {
34367 - currentEditor.off("transaction", fn);
34368 - };
34369 - }
34370 - }
34371 - };
34372 - function useEditorState(options) {
34373 - var _a;
34374 - const [editorStateManager] = (0, react$1.useState)(() => new EditorStateManager(options.editor));
34375 - const selectedState = (0, import_with_selector.useSyncExternalStoreWithSelector)(editorStateManager.subscribe, editorStateManager.getSnapshot, editorStateManager.getServerSnapshot, options.selector, (_a = options.equalityFn) != null ? _a : deepEqual);
34376 - useIsomorphicLayoutEffect(() => {
34377 - return editorStateManager.watch(options.editor);
34378 - }, [options.editor, editorStateManager]);
34379 - (0, react$1.useDebugValue)(selectedState);
34380 - return selectedState;
34381 - }
34382 - var isDev = true;
34383 - var isSSR = typeof window === "undefined";
34384 - var isNext = isSSR || Boolean(typeof window !== "undefined" && window.next);
34385 - var EditorInstanceManager = class _EditorInstanceManager {
34386 - constructor(options) {
34387 - /**
34388 - * The current editor instance.
34389 - */
34390 - this.editor = null;
34391 - /**
34392 - * The subscriptions to notify when the editor instance
34393 - * has been created or destroyed.
34394 - */
34395 - this.subscriptions = /* @__PURE__ */ new Set();
34396 - /**
34397 - * Whether the editor has been mounted.
34398 - */
34399 - this.isComponentMounted = false;
34400 - /**
34401 - * The most recent dependencies array.
34402 - */
34403 - this.previousDeps = null;
34404 - /**
34405 - * The unique instance ID. This is used to identify the editor instance. And will be re-generated for each new instance.
34406 - */
34407 - this.instanceId = "";
34408 - this.options = options;
34409 - this.subscriptions = /* @__PURE__ */ new Set();
34410 - this.setEditor(this.getInitialEditor());
34411 - this.scheduleDestroy();
34412 - this.getEditor = this.getEditor.bind(this);
34413 - this.getServerSnapshot = this.getServerSnapshot.bind(this);
34414 - this.subscribe = this.subscribe.bind(this);
34415 - this.refreshEditorInstance = this.refreshEditorInstance.bind(this);
34416 - this.scheduleDestroy = this.scheduleDestroy.bind(this);
34417 - this.onRender = this.onRender.bind(this);
34418 - this.createEditor = this.createEditor.bind(this);
34419 - }
34420 - setEditor(editor) {
34421 - this.editor = editor;
34422 - this.instanceId = Math.random().toString(36).slice(2, 9);
34423 - this.subscriptions.forEach((cb) => cb());
34424 - }
34425 - getInitialEditor() {
34426 - if (this.options.current.immediatelyRender === void 0) {
34427 - if (isSSR || isNext) {
34428 - if (isDev) throw new Error("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.");
34429 - return null;
34430 - }
34431 - return this.createEditor();
34432 - }
34433 - if (this.options.current.immediatelyRender && isSSR && isDev) throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");
34434 - if (this.options.current.immediatelyRender) return this.createEditor();
34435 - return null;
34436 - }
34437 - /**
34438 - * Create a new editor instance. And attach event listeners.
34439 - */
34440 - createEditor() {
34441 - return new Editor({
34442 - ...this.options.current,
34443 - onBeforeCreate: (...args) => {
34444 - var _a;
34445 - var _b;
34446 - return (_b = (_a = this.options.current).onBeforeCreate) == null ? void 0 : _b.call(_a, ...args);
34447 - },
34448 - onBlur: (...args) => {
34449 - var _a;
34450 - var _b;
34451 - return (_b = (_a = this.options.current).onBlur) == null ? void 0 : _b.call(_a, ...args);
34452 - },
34453 - onCreate: (...args) => {
34454 - var _a;
34455 - var _b;
34456 - return (_b = (_a = this.options.current).onCreate) == null ? void 0 : _b.call(_a, ...args);
34457 - },
34458 - onDestroy: (...args) => {
34459 - var _a;
34460 - var _b;
34461 - return (_b = (_a = this.options.current).onDestroy) == null ? void 0 : _b.call(_a, ...args);
34462 - },
34463 - onFocus: (...args) => {
34464 - var _a;
34465 - var _b;
34466 - return (_b = (_a = this.options.current).onFocus) == null ? void 0 : _b.call(_a, ...args);
34467 - },
34468 - onSelectionUpdate: (...args) => {
34469 - var _a;
34470 - var _b;
34471 - return (_b = (_a = this.options.current).onSelectionUpdate) == null ? void 0 : _b.call(_a, ...args);
34472 - },
34473 - onTransaction: (...args) => {
34474 - var _a;
34475 - var _b;
34476 - return (_b = (_a = this.options.current).onTransaction) == null ? void 0 : _b.call(_a, ...args);
34477 - },
34478 - onUpdate: (...args) => {
34479 - var _a;
34480 - var _b;
34481 - return (_b = (_a = this.options.current).onUpdate) == null ? void 0 : _b.call(_a, ...args);
34482 - },
34483 - onContentError: (...args) => {
34484 - var _a;
34485 - var _b;
34486 - return (_b = (_a = this.options.current).onContentError) == null ? void 0 : _b.call(_a, ...args);
34487 - },
34488 - onDrop: (...args) => {
34489 - var _a;
34490 - var _b;
34491 - return (_b = (_a = this.options.current).onDrop) == null ? void 0 : _b.call(_a, ...args);
34492 - },
34493 - onPaste: (...args) => {
34494 - var _a;
34495 - var _b;
34496 - return (_b = (_a = this.options.current).onPaste) == null ? void 0 : _b.call(_a, ...args);
34497 - },
34498 - onDelete: (...args) => {
34499 - var _a;
34500 - var _b;
34501 - return (_b = (_a = this.options.current).onDelete) == null ? void 0 : _b.call(_a, ...args);
34502 - }
34503 - });
34504 - }
34505 - /**
34506 - * Get the current editor instance.
34507 - */
34508 - getEditor() {
34509 - return this.editor;
34510 - }
34511 - /**
34512 - * Always disable the editor on the server-side.
34513 - */
34514 - getServerSnapshot() {
34515 - return null;
34516 - }
34517 - /**
34518 - * Subscribe to the editor instance's changes.
34519 - */
34520 - subscribe(onStoreChange) {
34521 - this.subscriptions.add(onStoreChange);
34522 - return () => {
34523 - this.subscriptions.delete(onStoreChange);
34524 - };
34525 - }
34526 - static compareOptions(a, b) {
34527 - return Object.keys(a).every((key) => {
34528 - if ([
34529 - "onCreate",
34530 - "onBeforeCreate",
34531 - "onDestroy",
34532 - "onUpdate",
34533 - "onTransaction",
34534 - "onFocus",
34535 - "onBlur",
34536 - "onSelectionUpdate",
34537 - "onContentError",
34538 - "onDrop",
34539 - "onPaste"
34540 - ].includes(key)) return true;
34541 - if (key === "extensions" && a.extensions && b.extensions) {
34542 - if (a.extensions.length !== b.extensions.length) return false;
34543 - return a.extensions.every((extension, index) => {
34544 - var _a;
34545 - if (extension !== ((_a = b.extensions) == null ? void 0 : _a[index])) return false;
34546 - return true;
34547 - });
34548 - }
34549 - if (a[key] !== b[key]) return false;
34550 - return true;
34551 - });
34552 - }
34553 - /**
34554 - * On each render, we will create, update, or destroy the editor instance.
34555 - * @param deps The dependencies to watch for changes
34556 - * @returns A cleanup function
34557 - */
34558 - onRender(deps) {
34559 - return () => {
34560 - this.isComponentMounted = true;
34561 - clearTimeout(this.scheduledDestructionTimeout);
34562 - if (this.editor && !this.editor.isDestroyed && deps.length === 0) {
34563 - if (!_EditorInstanceManager.compareOptions(this.options.current, this.editor.options)) this.editor.setOptions({
34564 - ...this.options.current,
34565 - editable: this.editor.isEditable
34566 - });
34567 - } else this.refreshEditorInstance(deps);
34568 - return () => {
34569 - this.isComponentMounted = false;
34570 - this.scheduleDestroy();
34571 - };
34572 - };
34573 - }
34574 - /**
34575 - * Recreate the editor instance if the dependencies have changed.
34576 - */
34577 - refreshEditorInstance(deps) {
34578 - if (this.editor && !this.editor.isDestroyed) {
34579 - if (this.previousDeps === null) {
34580 - this.previousDeps = deps;
34581 - return;
34582 - }
34583 - if (this.previousDeps.length === deps.length && this.previousDeps.every((dep, index) => dep === deps[index])) return;
34584 - }
34585 - if (this.editor && !this.editor.isDestroyed) this.editor.destroy();
34586 - this.setEditor(this.createEditor());
34587 - this.previousDeps = deps;
34588 - }
34589 - /**
34590 - * Schedule the destruction of the editor instance.
34591 - * This will only destroy the editor if it was not mounted on the next tick.
34592 - * This is to avoid destroying the editor instance when it's actually still mounted.
34593 - */
34594 - scheduleDestroy() {
34595 - const currentInstanceId = this.instanceId;
34596 - const currentEditor = this.editor;
34597 - this.scheduledDestructionTimeout = setTimeout(() => {
34598 - if (this.isComponentMounted && this.instanceId === currentInstanceId) {
34599 - if (currentEditor) currentEditor.setOptions(this.options.current);
34600 - return;
34601 - }
34602 - if (currentEditor && !currentEditor.isDestroyed) {
34603 - currentEditor.destroy();
34604 - if (this.instanceId === currentInstanceId) this.setEditor(null);
34605 - }
34606 - }, 1);
34607 - }
34608 - };
34609 - function useEditor(options = {}, deps = []) {
34610 - const mostRecentOptions = (0, react$1.useRef)(options);
34611 - mostRecentOptions.current = options;
34612 - const [instanceManager] = (0, react$1.useState)(() => new EditorInstanceManager(mostRecentOptions));
34613 - const editor = (0, import_shim.useSyncExternalStore)(instanceManager.subscribe, instanceManager.getEditor, instanceManager.getServerSnapshot);
34614 - (0, react$1.useDebugValue)(editor);
34615 - (0, react$1.useEffect)(instanceManager.onRender(deps));
34616 - useEditorState({
34617 - editor,
34618 - selector: ({ transactionNumber }) => {
34619 - if (options.shouldRerenderOnTransaction === false || options.shouldRerenderOnTransaction === void 0) return null;
34620 - if (options.immediatelyRender && transactionNumber === 0) return 0;
34621 - return transactionNumber + 1;
34622 - }
34623 - });
34624 - return editor;
34625 - }
34626 - var EditorContext = (0, react$1.createContext)({ editor: null });
34627 - var EditorConsumer = EditorContext.Consumer;
34628 - var ReactNodeViewContext = (0, react$1.createContext)({
34629 - onDragStart: () => {},
34630 - nodeViewContentChildren: void 0,
34631 - nodeViewContentRef: () => {}
34632 - });
34633 - var useReactNodeView = () => (0, react$1.useContext)(ReactNodeViewContext);
34634 - var NodeViewWrapper = react$1.default.forwardRef((props, ref) => {
34635 - const { onDragStart } = useReactNodeView();
34636 - return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(props.as || "div", {
34637 - ...props,
34638 - ref,
34639 - "data-node-view-wrapper": "",
34640 - onDragStart,
34641 - style: {
34642 - whiteSpace: "normal",
34643 - ...props.style
34644 - }
34645 - });
34646 - });
34647 - var ReactMarkViewContext = react$1.default.createContext({ markViewContentRef: () => {} });
34648 - var TiptapContext = (0, react$1.createContext)({ get editor() {
34649 - throw new Error("useTiptap must be used within a <Tiptap> provider");
34650 - } });
34651 - TiptapContext.displayName = "TiptapContext";
34652 - var useTiptap = () => (0, react$1.useContext)(TiptapContext);
34653 - function TiptapWrapper({ editor, instance, children }) {
34654 - const resolvedEditor = editor != null ? editor : instance;
34655 - if (!resolvedEditor) throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");
34656 - const tiptapContextValue = (0, react$1.useMemo)(() => ({ editor: resolvedEditor }), [resolvedEditor]);
34657 - const legacyContextValue = (0, react$1.useMemo)(() => ({ editor: resolvedEditor }), [resolvedEditor]);
34658 - return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditorContext.Provider, {
34659 - value: legacyContextValue,
34660 - children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TiptapContext.Provider, {
34661 - value: tiptapContextValue,
34662 - children
34663 - })
34664 - });
34665 - }
34666 - TiptapWrapper.displayName = "Tiptap";
34667 - function TiptapContent({ ...rest }) {
34668 - const { editor } = useTiptap();
34669 - return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditorContent, {
34670 - editor,
34671 - ...rest
34672 - });
34673 - }
34674 - TiptapContent.displayName = "Tiptap.Content";
34675 - var Tiptap = Object.assign(TiptapWrapper, {
34676 - /**
34677 - * The Tiptap Content component that renders the EditorContent with the editor instance from the context.
34678 - * @see TiptapContent
34679 - */
34680 -Content: TiptapContent });
34681 -
34682 -//#endregion
34683 -//#region packages/packages/libs/editor-controls/src/utils/inline-editing.ts
34684 - function isEmpty(value = "") {
34685 - if (!value) return true;
34686 - const pseudoElement = document.createElement("div");
34687 - pseudoElement.innerHTML = value;
34688 - return !pseudoElement.textContent?.length;
34689 - }
34690 - function htmlToPlainText(html) {
34691 - if (!html) return "";
34692 - const normalizedHtml = html.replace(/<br\s*\/?>/gi, "\n").replace(/<\/p>\s*<p[^>]*>/gi, "\n");
34693 - return new DOMParser().parseFromString(normalizedHtml, "text/html").body.textContent ?? "";
34694 - }
34695 - function extractInlineHtmlContent(propValue) {
34696 - if (_elementor_editor_props.escapedHtmlPropTypeUtil.isValid(propValue)) return _elementor_editor_props.escapedHtmlPropTypeUtil.extract(propValue) ?? "";
34697 - const htmlV3 = _elementor_editor_props.htmlV3PropTypeUtil.extract(propValue);
34698 - return _elementor_editor_props.stringPropTypeUtil.extract(htmlV3?.content ?? null) ?? "";
34699 - }
34700 -
34701 -//#endregion
34702 -//#region packages/packages/libs/editor-controls/src/components/inline-editor.tsx
34703 - var ITALIC_KEYBOARD_SHORTCUT = "i";
34704 - var BOLD_KEYBOARD_SHORTCUT = "b";
34705 - var UNDERLINE_KEYBOARD_SHORTCUT = "u";
34706 - var InlineEditor = react.forwardRef((props, ref) => {
34707 - const { value, setValue, placeholder = null, editorProps = {}, elementClasses = "", autofocus = false, sx = {}, onBlur = void 0, expectedTag = null, onEditorCreate, onEditorDestroy, wrapperClassName, onSelectionEnd, mountElement = null } = props;
34708 - const containerRef = (0, react.useRef)(null);
34709 - const onBlurRef = (0, react.useRef)(onBlur);
34710 - onBlurRef.current = onBlur;
34711 - const documentContentSettings = !!expectedTag ? "block+" : "inline*";
34712 - const onUpdate = ({ editor: updatedEditor }) => {
34713 - const newValue = updatedEditor.getHTML();
34714 - setValue(isEmpty(newValue) ? null : newValue);
34715 - };
34716 - const onKeyDown = (_, event) => {
34717 - if (event.key === "Escape") onBlurRef.current?.();
34718 - if (!event.metaKey && !event.ctrlKey || event.altKey) return;
34719 - if ([
34720 - ITALIC_KEYBOARD_SHORTCUT,
34721 - BOLD_KEYBOARD_SHORTCUT,
34722 - UNDERLINE_KEYBOARD_SHORTCUT
34723 - ].includes(event.key)) event.stopPropagation();
34724 - };
34725 - const editedElementAttributes = (HTMLAttributes) => ({
34726 - ...HTMLAttributes,
34727 - class: elementClasses
34728 - });
34729 - const editor = useEditor({
34730 - ...mountElement ? { element: mountElement } : {},
34731 - extensions: [
34732 - index_default$10.extend({ content: documentContentSettings }),
34733 - index_default$5.extend({ renderHTML({ HTMLAttributes }) {
34734 - return [
34735 - expectedTag ?? "p",
34736 - editedElementAttributes(HTMLAttributes),
34737 - 0
34738 - ];
34739 - } }),
34740 - index_default$8.extend({ renderHTML({ node, HTMLAttributes }) {
34741 - if (expectedTag) return [
34742 - expectedTag,
34743 - editedElementAttributes(HTMLAttributes),
34744 - 0
34745 - ];
34746 - return [
34747 - `h${this.options.levels.includes(node.attrs.level) ? node.attrs.level : this.options.levels[0]}`,
34748 - editedElementAttributes(HTMLAttributes),
34749 - 0
34750 - ];
34751 - } }).configure({ levels: [
34752 - 1,
34753 - 2,
34754 - 3,
34755 - 4,
34756 - 5,
34757 - 6
34758 - ] }),
34759 - index_default$6.configure({ openOnClick: false }),
34760 - index_default$1,
34761 - index_default$11,
34762 - index_default$7,
34763 - index_default$4,
34764 - index_default$2,
34765 - index_default$3,
34766 - index_default,
34767 - index_default$9.extend({ addKeyboardShortcuts() {
34768 - return { Enter: () => this.editor.commands.setHardBreak() };
34769 - } })
34770 - ],
34771 - content: value,
34772 - onUpdate,
34773 - autofocus,
34774 - editorProps: {
34775 - ...editorProps,
34776 - handleDOMEvents: { keydown: onKeyDown },
34777 - attributes: {
34778 - ...editorProps.attributes ?? {},
34779 - role: "textbox",
34780 - ...placeholder ? { "data-placeholder": htmlToPlainText(placeholder) } : {},
34781 - ...value === null || value === "" ? { class: "is-empty" } : {}
34782 - }
34783 - },
34784 - onCreate: onEditorCreate ? ({ editor: mountedEditor }) => onEditorCreate(mountedEditor) : void 0,
34785 - onDestroy: onEditorDestroy ? () => onEditorDestroy() : void 0,
34786 - onBlur: mountElement ? void 0 : () => onBlurRef.current?.(),
34787 - onSelectionUpdate: onSelectionEnd ? ({ editor: updatedEditor }) => onSelectionEnd(updatedEditor.view) : void 0
34788 - });
34789 - useOnUpdate(() => {
34790 - if (!editor) return;
34791 - if (editor.getHTML() !== value) editor.commands.setContent(value, { emitUpdate: false });
34792 - }, [editor, value]);
34793 - if (mountElement) return null;
34794 - return /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
34795 - ref: containerRef,
34796 - sx,
34797 - className: wrapperClassName
34798 - }, /* @__PURE__ */ react.createElement(EditorContent, {
34799 - ref,
34800 - editor
34801 - }));
34802 - });
34803 - var useOnUpdate = (callback, dependencies) => {
34804 - const hasMounted = (0, react.useRef)(false);
34805 - (0, react.useEffect)(() => {
34806 - if (hasMounted.current) callback();
34807 - else hasMounted.current = true;
34808 - }, dependencies);
34809 - };
34810 -
34811 -//#endregion
34812 -//#region packages/packages/libs/editor-controls/src/components/url-popover.tsx
34813 - var UrlPopover = ({ popupState, restoreValue, anchorRef, value, onChange, openInNewTab, onToggleNewTab }) => {
34814 - const inputRef = (0, react.useRef)(null);
34815 - (0, react.useEffect)(() => {
34816 - if (popupState.isOpen) requestAnimationFrame(() => inputRef.current?.focus());
34817 - }, [popupState.isOpen]);
34818 - const handleClose = () => {
34819 - restoreValue();
34820 - popupState.close();
34821 - };
34822 - return /* @__PURE__ */ react.createElement(_elementor_ui.Popover, {
34823 - slotProps: { paper: { sx: {
34824 - borderRadius: "16px",
34825 - width: anchorRef.current?.offsetWidth + "px",
34826 - marginTop: -1
34827 - } } },
34828 - ...(0, _elementor_ui.bindPopover)(popupState),
34829 - anchorOrigin: {
34830 - vertical: "top",
34831 - horizontal: "left"
34832 - },
34833 - transformOrigin: {
34834 - vertical: "top",
34835 - horizontal: "left"
34836 - },
34837 - onClose: handleClose
34838 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
34839 - direction: "row",
34840 - alignItems: "center",
34841 - gap: 1,
34842 - sx: { p: 1.5 }
34843 - }, /* @__PURE__ */ react.createElement(_elementor_ui.TextField, {
34844 - value,
34845 - onChange,
34846 - size: "tiny",
34847 - fullWidth: true,
34848 - placeholder: (0, _wordpress_i18n.__)("Type a URL", "elementor"),
34849 - inputProps: { ref: inputRef },
34850 - color: "secondary",
34851 - InputProps: { sx: { borderRadius: "8px" } },
34852 - onKeyUp: (event) => event.key === "Enter" && handleClose()
34853 - }), /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, { title: (0, _wordpress_i18n.__)("Open in a new tab", "elementor") }, /* @__PURE__ */ react.createElement(_elementor_ui.ToggleButton, {
34854 - size: "tiny",
34855 - value: "newTab",
34856 - selected: openInNewTab,
34857 - onClick: onToggleNewTab,
34858 - "aria-label": (0, _wordpress_i18n.__)("Open in a new tab", "elementor"),
34859 - sx: { borderRadius: "8px" }
34860 - }, /* @__PURE__ */ react.createElement(_elementor_icons.ExternalLinkIcon, { fontSize: "tiny" })))));
34861 - };
34862 -
34863 -//#endregion
34864 -//#region packages/packages/libs/editor-controls/src/components/inline-editor-toolbar.tsx
34865 - var InlineEditorToolbar = ({ editor, elementId, sx = {}, inControlPanel = false }) => {
34866 - const [urlValue, setUrlValue] = (0, react.useState)("");
34867 - const [openInNewTab, setOpenInNewTab] = (0, react.useState)(false);
34868 - const toolbarRef = (0, react.useRef)(null);
34869 - const linkPopupState = (0, _elementor_ui.usePopupState)({ variant: "popover" });
34870 - const isElementClickable = elementId ? checkIfElementIsClickable(elementId) : false;
34871 - const editorState = useEditorState({
34872 - editor,
34873 - selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
34874 - });
34875 - const formatButtonsList = (0, react.useMemo)(() => {
34876 - const buttons = Object.values(formatButtons);
34877 - if (isElementClickable) return buttons.filter((button) => button.action !== "link");
34878 - return buttons;
34879 - }, [isElementClickable]);
34880 - const handleLinkClick = () => {
34881 - const linkAttrs = editor.getAttributes("link");
34882 - setUrlValue(linkAttrs.href || "");
34883 - setOpenInNewTab(linkAttrs.target === "_blank");
34884 - linkPopupState.open(toolbarRef.current);
34885 - };
34886 - const handleUrlChange = (event) => {
34887 - setUrlValue(event.target.value);
34888 - };
34889 - const handleToggleNewTab = () => {
34890 - setOpenInNewTab(!openInNewTab);
34891 - };
34892 - const handleUrlSubmit = () => {
34893 - if (urlValue) editor.chain().focus().setLink({
34894 - href: urlValue,
34895 - target: openInNewTab ? "_blank" : "_self"
34896 - }).run();
34897 - else editor.chain().focus().unsetLink().run();
34898 - if (elementId) window.dispatchEvent(new CustomEvent("elementor:inline-link-changed", { detail: { elementId } }));
34899 - linkPopupState.close();
34900 - };
34901 - (0, react.useEffect)(() => {
34902 - if (!inControlPanel) editor?.commands?.focus();
34903 - }, [editor, inControlPanel]);
34904 - return /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
34905 - ref: toolbarRef,
34906 - sx: {
34907 - display: "inline-flex",
34908 - gap: .5,
34909 - padding: .5,
34910 - borderRadius: "8px",
34911 - backgroundColor: "background.paper",
34912 - boxShadow: "0 2px 8px rgba(0, 0, 0, 0.2)",
34913 - alignItems: "center",
34914 - visibility: linkPopupState.isOpen ? "hidden" : "visible",
34915 - pointerEvents: linkPopupState.isOpen ? "none" : "all",
34916 - ...sx,
34917 - ...inControlPanel && {
34918 - width: "100%",
34919 - justifyContent: "center",
34920 - flexDirection: "row",
34921 - backgroundColor: "transparent",
34922 - boxShadow: "none",
34923 - borderWidth: "0",
34924 - borderBottom: "1px solid",
34925 - borderBottomColor: (theme) => theme.palette.text.secondary,
34926 - borderRadius: "0",
34927 - position: "absolute",
34928 - top: "0",
34929 - left: "0",
34930 - "&, & .MuiIconButton-root, & .MuiToggleButton-root": { color: (theme) => theme.palette.text.primary }
34931 - }
34932 - }
34933 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
34934 - title: clearButton.label,
34935 - placement: "top",
34936 - sx: { borderRadius: "8px" }
34937 - }, /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, {
34938 - "aria-label": clearButton.label,
34939 - onClick: () => clearButton.method(editor),
34940 - size: "tiny"
34941 - }, clearButton.icon)), /* @__PURE__ */ react.createElement(_elementor_ui.ToggleButtonGroup, {
34942 - value: editorState,
34943 - size: "tiny",
34944 - sx: {
34945 - display: "flex",
34946 - gap: .5,
34947 - border: "none",
34948 - [`& .${_elementor_ui.toggleButtonGroupClasses.firstButton}, & .${_elementor_ui.toggleButtonGroupClasses.middleButton}, & .${_elementor_ui.toggleButtonGroupClasses.lastButton}`]: {
34949 - borderRadius: "8px",
34950 - border: "none",
34951 - marginLeft: 0,
34952 - "&.Mui-selected": { marginLeft: 0 },
34953 - "& + &.Mui-selected": { marginLeft: 0 }
34954 - },
34955 - ...inControlPanel && {
34956 - justifyContent: "space-between",
34957 - width: "100%",
34958 - "& svg": {
34959 - width: "0.7rem",
34960 - height: "0.7rem"
34961 - }
34962 - }
34963 - }
34964 - }, formatButtonsList.map((button) => /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
34965 - title: button.label,
34966 - key: button.action,
34967 - placement: "top"
34968 - }, /* @__PURE__ */ react.createElement(_elementor_ui.ToggleButton, {
34969 - value: button.action,
34970 - "aria-label": button.label,
34971 - size: "tiny",
34972 - onClick: () => {
34973 - if (button.action === "link") handleLinkClick();
34974 - else button.method?.(editor);
34975 - editor?.commands?.focus();
34976 - }
34977 - }, button.icon)))), /* @__PURE__ */ react.createElement(UrlPopover, {
34978 - popupState: linkPopupState,
34979 - anchorRef: toolbarRef,
34980 - restoreValue: handleUrlSubmit,
34981 - value: urlValue,
34982 - onChange: handleUrlChange,
34983 - openInNewTab,
34984 - onToggleNewTab: handleToggleNewTab
34985 - }));
34986 - };
34987 - var checkIfElementIsClickable = (elementId) => {
34988 - const isButton = (0, _elementor_editor_elements.getContainer)(elementId)?.model.get("widgetType") === "e-button";
34989 - const hasLink = !!(0, _elementor_editor_elements.getElementSetting)(elementId, "link")?.value?.destination;
34990 - return isButton || hasLink;
34991 - };
34992 - var { clear: clearButton, ...formatButtons } = {
34993 - clear: {
34994 - label: (0, _wordpress_i18n.__)("Clear", "elementor"),
34995 - icon: /* @__PURE__ */ react.createElement(_elementor_icons.MinusIcon, { fontSize: "tiny" }),
34996 - action: "clear",
34997 - method: (editor) => {
34998 - editor.chain().focus().clearNodes().unsetAllMarks().run();
34999 - }
35000 - },
35001 - bold: {
35002 - label: (0, _wordpress_i18n.__)("Bold", "elementor"),
35003 - icon: /* @__PURE__ */ react.createElement(_elementor_icons.BoldIcon, { fontSize: "tiny" }),
35004 - action: "bold",
35005 - method: (editor) => {
35006 - editor.chain().focus().toggleBold().run();
35007 - }
35008 - },
35009 - italic: {
35010 - label: (0, _wordpress_i18n.__)("Italic", "elementor"),
35011 - icon: /* @__PURE__ */ react.createElement(_elementor_icons.ItalicIcon, { fontSize: "tiny" }),
35012 - action: "italic",
35013 - method: (editor) => {
35014 - editor.chain().focus().toggleItalic().run();
35015 - }
35016 - },
35017 - underline: {
35018 - label: (0, _wordpress_i18n.__)("Underline", "elementor"),
35019 - icon: /* @__PURE__ */ react.createElement(_elementor_icons.UnderlineIcon, { fontSize: "tiny" }),
35020 - action: "underline",
35021 - method: (editor) => {
35022 - editor.chain().focus().toggleUnderline().run();
35023 - }
35024 - },
35025 - strike: {
35026 - label: (0, _wordpress_i18n.__)("Strikethrough", "elementor"),
35027 - icon: /* @__PURE__ */ react.createElement(_elementor_icons.StrikethroughIcon, { fontSize: "tiny" }),
35028 - action: "strike",
35029 - method: (editor) => {
35030 - editor.chain().focus().toggleStrike().run();
35031 - }
35032 - },
35033 - superscript: {
35034 - label: (0, _wordpress_i18n.__)("Superscript", "elementor"),
35035 - icon: /* @__PURE__ */ react.createElement(_elementor_icons.SuperscriptIcon, { fontSize: "tiny" }),
35036 - action: "superscript",
35037 - method: (editor) => {
35038 - editor.chain().focus().toggleSuperscript().run();
35039 - }
35040 - },
35041 - subscript: {
35042 - label: (0, _wordpress_i18n.__)("Subscript", "elementor"),
35043 - icon: /* @__PURE__ */ react.createElement(_elementor_icons.SubscriptIcon, { fontSize: "tiny" }),
35044 - action: "subscript",
35045 - method: (editor) => {
35046 - editor.chain().focus().toggleSubscript().run();
35047 - }
35048 - },
35049 - link: {
35050 - label: (0, _wordpress_i18n.__)("Link", "elementor"),
35051 - icon: /* @__PURE__ */ react.createElement(_elementor_icons.LinkIcon, { fontSize: "tiny" }),
35052 - action: "link",
35053 - method: null
35054 - }
35055 - };
35056 - var possibleFormats = Object.keys(formatButtons);
35057 -
35058 -//#endregion
35059 -//#region packages/packages/libs/editor-controls/src/controls/inline-editing-control.tsx
35060 - var InlineEditingControl = createControl(({ sx, attributes, props, context: { elementId } }) => {
35061 - const { setValue, placeholder, value } = useBoundProp(_elementor_editor_props.escapedHtmlPropTypeUtil);
35062 - const { value: rawValue } = usePropKeyContext();
35063 - const content = value ?? extractInlineHtmlContent(rawValue);
35064 - const [editor, setEditor] = (0, react.useState)(null);
35065 - const handleChange = (0, react.useCallback)((newValue) => {
35066 - setValue(newValue ?? "");
35067 - }, [setValue]);
35068 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: { position: "relative" } }, editor && editor.isEditable && /* @__PURE__ */ react.createElement(InlineEditorToolbar, {
35069 - editor,
35070 - elementId,
35071 - sx: (theme) => ({
35072 - boxShadow: "none",
35073 - border: "1px solid",
35074 - borderColor: theme.palette.text.secondary,
35075 - mb: .5
35076 - }),
35077 - inControlPanel: true
35078 - }), /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
35079 - sx: (theme) => ({
35080 - p: .8,
35081 - border: "1px solid",
35082 - borderColor: theme.palette.text.secondary,
35083 - borderRadius: "8px",
35084 - transition: "border-color .2s ease, box-shadow .2s ease",
35085 - "&:hover": { borderColor: theme.palette.text.primary },
35086 - "&:focus-within": {
35087 - borderColor: theme.palette.text.primary,
35088 - boxShadow: `0 0 0 1px ${theme.palette.text.primary}`
35089 - },
35090 - "& .ProseMirror:focus": { outline: "none" },
35091 - "& .ProseMirror": {
35092 - minHeight: "100px",
35093 - fontSize: "12px",
35094 - "& a": { color: "inherit" },
35095 - "& .elementor-inline-editor-reset": {
35096 - margin: 0,
35097 - padding: 0
35098 - },
35099 - "&.is-empty::before": {
35100 - content: "attr(data-placeholder)",
35101 - color: "text.tertiary",
35102 - pointerEvents: "none",
35103 - position: "absolute",
35104 - opacity: .6
35105 - }
35106 - },
35107 - ".strip-styles *": { all: "unset" },
35108 - ...sx
35109 - }),
35110 - ...attributes,
35111 - ...props
35112 - }, /* @__PURE__ */ react.createElement(InlineEditor, {
35113 - value: content,
35114 - setValue: handleChange,
35115 - placeholder: placeholder ?? null,
35116 - onEditorCreate: setEditor,
35117 - onEditorDestroy: () => setEditor(null),
35118 - sx: { paddingBlockStart: 5 }
35119 - }))));
35120 - });
35121 -
35122 -//#endregion
35123 -//#region packages/packages/libs/editor-controls/src/hooks/use-form-field-suggestions.ts
35124 - var FORM_FIELD_WIDGET_TYPES = [
35125 - "e-form-input",
35126 - "e-form-textarea",
35127 - "e-form-checkbox",
35128 - "e-form-radio-button",
35129 - "e-form-select",
35130 - "e-form-date-picker",
35131 - "e-form-time-picker"
35132 - ];
35133 - var FORM_ELEMENT_TYPE = "e-form";
35134 - var CSS_ID_PROP_KEY = "_cssid";
35135 - function isFormFieldWidgetType(widgetType) {
35136 - return FORM_FIELD_WIDGET_TYPES.includes(widgetType);
35137 - }
35138 - function extractStringPropValue(value) {
35139 - return _elementor_editor_props.stringPropTypeUtil.extract(value);
35140 - }
35141 - function getSettingWithDefault(child, widgetType, key) {
35142 - const fromGet = child.settings.get(key);
35143 - if (fromGet !== null && fromGet !== void 0) return fromGet;
35144 - return ((0, _elementor_editor_elements.getWidgetsCache)()?.[widgetType]?.atomic_props_schema)?.[key]?.default ?? null;
35145 - }
35146 - function getFieldCssId(child, widgetType) {
35147 - return extractStringPropValue(getSettingWithDefault(child, widgetType, CSS_ID_PROP_KEY));
35148 - }
35149 - function getFormContainer(elementId) {
35150 - let container = (0, _elementor_editor_elements.getContainer)(elementId);
35151 - while (container) {
35152 - if (container.model.get("elType") === FORM_ELEMENT_TYPE) return container;
35153 - container = container.parent ?? null;
35154 - }
35155 - return null;
35156 - }
35157 - function useFormFieldSuggestions(options) {
35158 - return (0, _elementor_editor_v1_adapters.__privateUseListenTo)([
35159 - (0, _elementor_editor_v1_adapters.v1ReadyEvent)(),
35160 - (0, _elementor_editor_v1_adapters.commandEndEvent)("document/elements/create"),
35161 - (0, _elementor_editor_v1_adapters.commandEndEvent)("document/elements/delete"),
35162 - (0, _elementor_editor_v1_adapters.commandEndEvent)("document/elements/set-settings")
35163 - ], () => {
35164 - const selectedElement = (0, _elementor_editor_elements.getSelectedElements)()[0];
35165 - if (!selectedElement) return [];
35166 - const formContainer = getFormContainer(selectedElement.id);
35167 - if (!formContainer?.children) return [];
35168 - const suggestions = [];
35169 - const seenCssIds = /* @__PURE__ */ new Set();
35170 - formContainer.children.forEachRecursive?.((child) => {
35171 - const widgetType = child.model.get("widgetType");
35172 - if (!widgetType || !isFormFieldWidgetType(widgetType)) return;
35173 - if (options?.inputType) {
35174 - if (extractStringPropValue(getSettingWithDefault(child, widgetType, "type")) !== options.inputType) return;
35175 - }
35176 - const cssId = getFieldCssId(child, widgetType);
35177 - if (!cssId || seenCssIds.has(cssId)) return;
35178 - seenCssIds.add(cssId);
35179 - suggestions.push({
35180 - label: cssId,
35181 - value: cssId
35182 - });
35183 - });
35184 - return suggestions;
35185 - }, []);
35186 - }
35187 -
35188 -//#endregion
35189 -//#region packages/packages/libs/editor-controls/src/controls/email-form-action-control/utils.ts
35190 - var MIN_PRO_VERSION_FOR_MENTIONS = "4.1.0";
35191 - var CHIP_TRIGGER_KEYS = /* @__PURE__ */ new Set([" ", ","]);
35192 - function isValidEmail(email) {
35193 - return _elementor_schema.z.string().email().safeParse(email).success;
35194 - }
35195 - var FORM_FIELD_SHORTCODE_PATTERN = /^\[[^[\]]+]$/;
35196 - function isFormFieldShortcode(value) {
35197 - return FORM_FIELD_SHORTCODE_PATTERN.test(value);
35198 - }
35199 - var shouldShowMentionsInfo = () => {
35200 - if (!(0, _elementor_utils.hasProInstalled)()) return true;
35201 - const proVersion = window.elementorPro?.config?.version;
35202 - if (!proVersion) return false;
35203 - return (0, _elementor_utils.isVersionGreaterOrEqual)(proVersion, MIN_PRO_VERSION_FOR_MENTIONS);
35204 - };
35205 -
35206 -//#endregion
35207 -//#region packages/packages/libs/editor-controls/src/controls/email-form-action-control/email-chips-field.tsx
35208 - var isValidRecipient = (address) => isValidEmail(address) || isFormFieldShortcode(address);
35209 - function resolveMention(raw, suggestions) {
35210 - if (!raw.startsWith("@")) return raw;
35211 - const match = suggestions.find((suggestion) => createMentionPattern(suggestion.value, "start").test(raw));
35212 - return match ? `[${match.value}]` : raw;
35213 - }
35214 - var EmailChipsControl = createControl(({ placeholder, suggestions = [] }) => {
35215 - const { value, setValue, disabled } = useBoundProp(_elementor_editor_props.stringArrayPropTypeUtil);
35216 - const [inputValue, setInputValue] = (0, react.useState)("");
35217 - const items = value || [];
35218 - const selectedValues = items.map((item) => _elementor_editor_props.stringPropTypeUtil.extract(item)).filter((val) => val !== null);
35219 - const suggestionOptions = (0, react.useMemo)(() => suggestions.map((suggestion) => `[${suggestion.value}]`), [suggestions]);
35220 - const tryAddChip = (raw) => {
35221 - const address = resolveMention(raw.trim(), suggestions);
35222 - if (!address || selectedValues.includes(address) || !isValidRecipient(address)) return;
35223 - setValue([...items, _elementor_editor_props.stringPropTypeUtil.create(address)]);
35224 - setInputValue("");
35225 - };
35226 - const handleChange = (_, newValue) => {
35227 - const updated = [];
35228 - for (const entry of newValue) {
35229 - const address = resolveMention(entry.trim(), suggestions);
35230 - if (!address || !isValidRecipient(address)) continue;
35231 - updated.push(_elementor_editor_props.stringPropTypeUtil.create(address));
35232 - }
35233 - setValue(updated);
35234 - setInputValue("");
35235 - };
35236 - const handleBlur = (event) => {
35237 - const target = event.target;
35238 - tryAddChip(target.value);
35239 - setInputValue("");
35240 - };
35241 - const handleKeyDown = (event) => {
35242 - if (CHIP_TRIGGER_KEYS.has(event.key) && inputValue.trim()) {
35243 - event.preventDefault();
35244 - tryAddChip(inputValue);
35245 - }
35246 - };
35247 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.Autocomplete, {
35248 - fullWidth: true,
35249 - multiple: true,
35250 - freeSolo: true,
35251 - size: "tiny",
35252 - disabled,
35253 - inputValue,
35254 - onInputChange: (_, val, reason) => {
35255 - if (reason !== "reset") setInputValue(val);
35256 - },
35257 - value: selectedValues,
35258 - onChange: handleChange,
35259 - options: suggestionOptions,
35260 - filterOptions: (options, state) => {
35261 - const query = state.inputValue.trim().replace(/^@/, "").toLowerCase();
35262 - return query ? options.filter((option) => option.toLowerCase().includes(query)) : options;
35263 - },
35264 - filterSelectedOptions: true,
35265 - onBlur: handleBlur,
35266 - getOptionLabel: (option) => option,
35267 - isOptionEqualToValue: (option, val) => option === val,
35268 - renderInput: (params) => /* @__PURE__ */ react.createElement(_elementor_ui.TextField, {
35269 - ...params,
35270 - placeholder,
35271 - onKeyDown: handleKeyDown
35272 - }),
35273 - renderTags: (tagValues, getTagProps) => /* @__PURE__ */ react.createElement(ChipsList, {
35274 - getLabel: (option) => option,
35275 - getTagProps,
35276 - values: tagValues
35277 - })
35278 - }));
35279 - });
35280 - var EmailChipsField = ({ fieldLabel, placeholder, suggestions }) => /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
35281 - container: true,
35282 - direction: "column",
35283 - gap: .5
35284 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { item: true }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, fieldLabel)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { item: true }, /* @__PURE__ */ react.createElement(EmailChipsControl, {
35285 - placeholder,
35286 - suggestions
35287 - })));
35288 -
35289 -//#endregion
35290 -//#region packages/packages/libs/editor-controls/src/controls/email-form-action-control/email-field.tsx
35291 - var EmailField = ({ bind, label, placeholder }) => /* @__PURE__ */ react.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
35292 - container: true,
35293 - direction: "column",
35294 - gap: .5
35295 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { item: true }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, label)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { item: true }, /* @__PURE__ */ react.createElement(TextControl, { placeholder }))));
35296 -
35297 -//#endregion
35298 -//#region packages/packages/libs/editor-controls/src/controls/email-form-action-control/fields.tsx
35299 - var SendToField = ({ placeholder }) => {
35300 - const suggestions = useFormFieldSuggestions({ inputType: "email" });
35301 - return /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "to" }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, { gap: .5 }, /* @__PURE__ */ react.createElement(EmailChipsField, {
35302 - fieldLabel: (0, _wordpress_i18n.__)("Send to", "elementor"),
35303 - placeholder,
35304 - suggestions
35305 - }), shouldShowMentionsInfo() && /* @__PURE__ */ react.createElement(_elementor_editor_ui.InfoAlert, null, (0, _wordpress_i18n.__)("Type @ or an email field name to insert its submitted value.", "elementor"))));
35306 - };
35307 - var SubjectField = () => /* @__PURE__ */ react.createElement(EmailField, {
35308 - bind: "subject",
35309 - label: (0, _wordpress_i18n.__)("Email subject", "elementor"),
35310 - placeholder: (0, _wordpress_i18n.__)("New form submission", "elementor")
35311 - });
35312 - var MessageField = () => {
35313 - const suggestions = useFormFieldSuggestions();
35314 - return /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "message" }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
35315 - container: true,
35316 - direction: "column",
35317 - gap: .5
35318 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { item: true }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Message", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { item: true }, /* @__PURE__ */ react.createElement(MentionTextAreaControl, { suggestions })), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { item: true }, /* @__PURE__ */ react.createElement(_elementor_editor_ui.InfoAlert, null, shouldShowMentionsInfo() ? (0, _wordpress_i18n.__)("[all-fields] shortcode sends all fields. Type @ to insert specific fields and customize your message.", "elementor") : (0, _wordpress_i18n.__)("[all-fields] shortcode sends all fields.", "elementor")))));
35319 - };
35320 - var FromEmailField = () => /* @__PURE__ */ react.createElement(EmailField, {
35321 - bind: "from",
35322 - label: (0, _wordpress_i18n.__)("From email", "elementor"),
35323 - placeholder: (0, _wordpress_i18n.__)("What email should appear as the sender?", "elementor")
35324 - });
35325 - var FromNameField = () => /* @__PURE__ */ react.createElement(EmailField, {
35326 - bind: "from-name",
35327 - label: (0, _wordpress_i18n.__)("From name", "elementor"),
35328 - placeholder: (0, _wordpress_i18n.__)("What name should appear as the sender?", "elementor")
35329 - });
35330 - var ReplyToField = () => {
35331 - const emailSuggestions = useFormFieldSuggestions({ inputType: "email" });
35332 - return /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "reply-to" }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
35333 - container: true,
35334 - direction: "column",
35335 - gap: .5
35336 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { item: true }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Reply-to", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { item: true }, /* @__PURE__ */ react.createElement(MentionTextAreaControl, {
35337 - suggestions: emailSuggestions,
35338 - rows: 1,
35339 - triggerPosition: "start",
35340 - placeholder: (0, _wordpress_i18n.__)("You can type @ to insert an email field", "elementor")
35341 - }))));
35342 - };
35343 - var CcField = () => {
35344 - const suggestions = useFormFieldSuggestions({ inputType: "email" });
35345 - return /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "cc" }, /* @__PURE__ */ react.createElement(EmailChipsField, {
35346 - fieldLabel: (0, _wordpress_i18n.__)("Cc", "elementor"),
35347 - suggestions
35348 - }));
35349 - };
35350 - var BccField = () => {
35351 - const suggestions = useFormFieldSuggestions({ inputType: "email" });
35352 - return /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "bcc" }, /* @__PURE__ */ react.createElement(EmailChipsField, {
35353 - fieldLabel: (0, _wordpress_i18n.__)("Bcc", "elementor"),
35354 - suggestions
35355 - }));
35356 - };
35357 - var MetaDataField = () => /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "meta-data" }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, { gap: .5 }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Metadata", "elementor")), /* @__PURE__ */ react.createElement(ChipsControl, { options: [
35358 - {
35359 - label: (0, _wordpress_i18n.__)("Date", "elementor"),
35360 - value: "date"
35361 - },
35362 - {
35363 - label: (0, _wordpress_i18n.__)("Time", "elementor"),
35364 - value: "time"
35365 - },
35366 - {
35367 - label: (0, _wordpress_i18n.__)("Page URL", "elementor"),
35368 - value: "page-url"
35369 - },
35370 - {
35371 - label: (0, _wordpress_i18n.__)("User agent", "elementor"),
35372 - value: "user-agent"
35373 - },
35374 - {
35375 - label: (0, _wordpress_i18n.__)("Credit", "elementor"),
35376 - value: "credit"
35377 - }
35378 - ] })));
35379 - var SendAsField = () => /* @__PURE__ */ react.createElement(PropKeyProvider, { bind: "send-as" }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
35380 - container: true,
35381 - direction: "column",
35382 - gap: .5
35383 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { item: true }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, (0, _wordpress_i18n.__)("Send as", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { item: true }, /* @__PURE__ */ react.createElement(SelectControl, { options: [{
35384 - label: (0, _wordpress_i18n.__)("HTML", "elementor"),
35385 - value: "html"
35386 - }, {
35387 - label: (0, _wordpress_i18n.__)("Plain Text", "elementor"),
35388 - value: "plain"
35389 - }] }))));
35390 -
35391 -//#endregion
35392 -//#region packages/packages/libs/editor-controls/src/controls/email-form-action-control/index.tsx
35393 - var EmailFormActionControl = createControl(({ toPlaceholder, label }) => {
35394 - const { value, setValue, ...propContext } = useBoundProp(_elementor_editor_props.emailsPropTypeUtil);
35395 - return /* @__PURE__ */ react.createElement(PropProvider, {
35396 - ...propContext,
35397 - value,
35398 - setValue
35399 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, { gap: 2 }, /* @__PURE__ */ react.createElement(ControlLabel, null, label ? label + " " + (0, _wordpress_i18n.__)("settings", "elementor") : (0, _wordpress_i18n.__)("Email settings", "elementor")), /* @__PURE__ */ react.createElement(SendToField, { placeholder: toPlaceholder }), /* @__PURE__ */ react.createElement(SubjectField, null), /* @__PURE__ */ react.createElement(MessageField, null), /* @__PURE__ */ react.createElement(FromEmailField, null), /* @__PURE__ */ react.createElement(AdvancedSettings, null)));
35400 - });
35401 - var AdvancedSettings = () => /* @__PURE__ */ react.createElement(_elementor_editor_ui.CollapsibleContent, { defaultOpen: false }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: { pt: 2 } }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, { gap: 2 }, /* @__PURE__ */ react.createElement(FromNameField, null), /* @__PURE__ */ react.createElement(ReplyToField, null), /* @__PURE__ */ react.createElement(CcField, null), /* @__PURE__ */ react.createElement(BccField, null), /* @__PURE__ */ react.createElement(_elementor_ui.Divider, null), /* @__PURE__ */ react.createElement(MetaDataField, null), /* @__PURE__ */ react.createElement(SendAsField, null))));
35402 -
35403 -//#endregion
35404 -//#region packages/packages/libs/editor-controls/src/controls/attachment-type-control.tsx
35405 - var AttachmentTypeControl = createControl(({ label, options }) => {
35406 - return /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
35407 - container: true,
35408 - direction: "column",
35409 - gap: 1
35410 - }, label && /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { item: true }, /* @__PURE__ */ react.createElement(ControlFormLabel, null, label)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { item: true }, /* @__PURE__ */ react.createElement(SelectControl, { options })), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, { item: true }, /* @__PURE__ */ react.createElement(_elementor_editor_ui.InfoAlert, null, (0, _wordpress_i18n.__)("Linked uploads are saved to the server. Direct attachments will not appear under Submissions.", "elementor"))));
35411 - });
35412 -
35413 -//#endregion
35414 -//#region packages/packages/libs/editor-controls/src/controls/grid-span-control.tsx
35415 - var GridSpanControl = createControl(({ placeholder: propPlaceholder, error, inputValue, inputDisabled, helperText, sx, ariaLabel }) => {
35416 - const { value, setValue, disabled, placeholder: boundPlaceholder } = useBoundProp(_elementor_editor_props.spanPropTypeUtil);
35417 - const handleChange = (event) => {
35418 - const next = event.target.value;
35419 - setValue(next === "" ? null : next);
35420 - };
35421 - const placeholder = propPlaceholder ?? boundPlaceholder ?? `e.g: 'span 2' or '1 / 3'`;
35422 - return /* @__PURE__ */ react.createElement(ControlActions, null, /* @__PURE__ */ react.createElement(_elementor_ui.TextField, {
35423 - size: "tiny",
35424 - fullWidth: true,
35425 - disabled: inputDisabled ?? disabled,
35426 - value: inputValue ?? value ?? "",
35427 - onChange: handleChange,
35428 - placeholder,
35429 - error,
35430 - helperText,
35431 - sx,
35432 - inputProps: { ...ariaLabel ? { "aria-label": ariaLabel } : {} }
35433 - }));
35434 - });
35435 -
35436 -//#endregion
35437 -//#region packages/packages/libs/editor-controls/src/components/promotions/promotion-trigger.tsx
35438 - function getV4Promotion(key) {
35439 - return window.elementor?.config?.v4Promotions?.[key];
35440 - }
35441 - var PromotionTrigger = (0, react.forwardRef)(({ promotionKey, children, trackingData }, ref) => {
35442 - const [isOpen, setIsOpen] = (0, react.useState)(false);
35443 - const promotion = getV4Promotion(promotionKey);
35444 - const toggle = (0, react.useCallback)(() => {
35445 - setIsOpen((prev) => {
35446 - if (!prev) trackViewPromotion(trackingData);
35447 - return !prev;
35448 - });
35449 - }, [trackingData]);
35450 - (0, react.useImperativeHandle)(ref, () => ({ toggle }), [toggle]);
35451 - return /* @__PURE__ */ react.createElement(react.Fragment, null, promotion && /* @__PURE__ */ react.createElement(_elementor_editor_ui.PromotionInfotip, {
35452 - title: promotion.title,
35453 - content: promotion.content,
35454 - assetUrl: promotion.image,
35455 - ctaUrl: promotion.ctaUrl,
35456 - open: isOpen,
35457 - onClose: (e) => {
35458 - e.stopPropagation();
35459 - setIsOpen(false);
35460 - },
35461 - onCtaClick: () => trackUpgradePromotionClick(trackingData)
35462 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
35463 - onClick: (e) => {
35464 - e.stopPropagation();
35465 - toggle();
35466 - },
35467 - sx: {
35468 - cursor: "pointer",
35469 - display: "inline-flex"
35470 - }
35471 - }, children ?? /* @__PURE__ */ react.createElement(_elementor_editor_ui.PromotionChip, null))));
35472 - });
35473 -
35474 -//#endregion
35475 -//#region packages/packages/libs/editor-controls/src/components/promotions/display-conditions-control.tsx
35476 - var ARIA_LABEL$1 = (0, _wordpress_i18n.__)("Display Conditions", "elementor");
35477 - var TRACKING_DATA$1 = {
35478 - target_name: "display_conditions",
35479 - location_l2: "general"
35480 - };
35481 - var DisplayConditionsControl = createControl(() => {
35482 - const triggerRef = (0, react.useRef)(null);
35483 - return /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
35484 - direction: "row",
35485 - spacing: 2,
35486 - sx: {
35487 - justifyContent: "flex-end",
35488 - alignItems: "center"
35489 - }
35490 - }, /* @__PURE__ */ react.createElement(PromotionTrigger, {
35491 - ref: triggerRef,
35492 - promotionKey: "displayConditions",
35493 - trackingData: TRACKING_DATA$1
35494 - }), /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
35495 - title: ARIA_LABEL$1,
35496 - placement: "top"
35497 - }, /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, {
35498 - size: "tiny",
35499 - "aria-label": ARIA_LABEL$1,
35500 - "data-behavior": "display-conditions",
35501 - onClick: () => triggerRef.current?.toggle(),
35502 - sx: {
35503 - border: "1px solid",
35504 - borderColor: "divider",
35505 - borderRadius: 1
35506 - }
35507 - }, /* @__PURE__ */ react.createElement(_elementor_icons.SitemapIcon, {
35508 - fontSize: "tiny",
35509 - color: "disabled"
35510 - }))));
35511 - });
35512 -
35513 -//#endregion
35514 -//#region packages/packages/libs/editor-controls/src/components/promotions/attributes-control.tsx
35515 - var ARIA_LABEL = (0, _wordpress_i18n.__)("Attributes", "elementor");
35516 - var TRACKING_DATA = {
35517 - target_name: "attributes",
35518 - location_l2: "general"
35519 - };
35520 - var AttributesControl = createControl(() => {
35521 - const triggerRef = (0, react.useRef)(null);
35522 - return /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
35523 - direction: "row",
35524 - spacing: 2,
35525 - sx: {
35526 - justifyContent: "flex-end",
35527 - alignItems: "center"
35528 - }
35529 - }, /* @__PURE__ */ react.createElement(PromotionTrigger, {
35530 - ref: triggerRef,
35531 - promotionKey: "attributes",
35532 - trackingData: TRACKING_DATA
35533 - }), /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
35534 - title: ARIA_LABEL,
35535 - placement: "top"
35536 - }, /* @__PURE__ */ react.createElement(_elementor_icons.PlusIcon, {
35537 - "aria-label": ARIA_LABEL,
35538 - fontSize: "tiny",
35539 - color: "disabled",
35540 - onClick: () => triggerRef.current?.toggle(),
35541 - sx: { cursor: "pointer" }
35542 - })));
35543 - });
35544 -
35545 -//#endregion
35546 -//#region packages/packages/libs/editor-controls/src/components/icon-buttons/clear-icon-button.tsx
35547 - var CustomIconButton = (0, _elementor_ui.styled)(_elementor_ui.IconButton)(({ theme }) => ({
35548 - width: theme.spacing(2.5),
35549 - height: theme.spacing(2.5)
35550 - }));
35551 - var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
35552 - title: tooltipText,
35553 - placement: "top",
35554 - disableInteractive: true
35555 - }, /* @__PURE__ */ react.createElement(CustomIconButton, {
35556 - "aria-label": tooltipText,
35557 - size,
35558 - onClick,
35559 - disabled
35560 - }, /* @__PURE__ */ react.createElement(_elementor_icons.BrushBigIcon, { fontSize: size })));
35561 -
35562 -//#endregion
35563 -//#region packages/packages/libs/editor-controls/src/components/repeater/repeater.tsx
35564 - var SIZE = "tiny";
35565 - var EMPTY_OPEN_ITEM = -1;
35566 - var Repeater = ({ label, itemSettings, disabled = false, openOnAdd = false, values: items = [], setValues: setItems, showDuplicate = true, showToggle = true, showRemove = true, disableAddItemButton = false, addButtonInfotipContent, openItem: initialOpenItem = EMPTY_OPEN_ITEM, isSortable = true, adornment = ControlAdornments }) => {
35567 - const [openItem, setOpenItem] = (0, react.useState)(initialOpenItem);
35568 - const uniqueKeys = items.map((item, index) => isSortable && "getId" in itemSettings ? itemSettings.getId({
35569 - item,
35570 - index
35571 - }) : String(index));
35572 - const addRepeaterItem = () => {
35573 - const newItem = structuredClone(itemSettings.initialValues);
35574 - const newIndex = items.length;
35575 - setItems([...items, newItem], {}, { action: {
35576 - type: "add",
35577 - payload: [{
35578 - index: newIndex,
35579 - item: newItem
35580 - }]
35581 - } });
35582 - if (openOnAdd) setOpenItem(newIndex);
35583 - };
35584 - const duplicateRepeaterItem = (index) => {
35585 - const newItem = structuredClone(items[index]);
35586 - const atPosition = 1 + index;
35587 - setItems([
35588 - ...items.slice(0, atPosition),
35589 - newItem,
35590 - ...items.slice(atPosition)
35591 - ], {}, { action: {
35592 - type: "duplicate",
35593 - payload: [{
35594 - index,
35595 - item: newItem
35596 - }]
35597 - } });
35598 - };
35599 - const removeRepeaterItem = (index) => {
35600 - const removedItem = items[index];
35601 - setItems(items.filter((_, pos) => {
35602 - return pos !== index;
35603 - }), {}, { action: {
35604 - type: "remove",
35605 - payload: [{
35606 - index,
35607 - item: removedItem
35608 - }]
35609 - } });
35610 - };
35611 - const toggleDisableRepeaterItem = (index) => {
35612 - setItems(items.map((value, pos) => {
35613 - if (pos === index) {
35614 - const { disabled: propDisabled, ...rest } = value;
35615 - return {
35616 - ...rest,
35617 - ...propDisabled ? {} : { disabled: true }
35618 - };
35619 - }
35620 - return value;
35621 - }), {}, { action: { type: "toggle-disable" } });
35622 - };
35623 - const onChangeOrder = (reorderedKeys, meta) => {
35624 - setItems(reorderedKeys.map((id) => {
35625 - return items[uniqueKeys.indexOf(id)];
35626 - }), {}, { action: {
35627 - type: "reorder",
35628 - payload: { ...meta }
35629 - } });
35630 - };
35631 - const isButtonDisabled = disabled || disableAddItemButton;
35632 - const shouldShowInfotip = isButtonDisabled && addButtonInfotipContent;
35633 - const addButton = /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, {
35634 - size: SIZE,
35635 - sx: { ml: "auto" },
35636 - disabled: isButtonDisabled,
35637 - onClick: addRepeaterItem,
35638 - "aria-label": (0, _wordpress_i18n.__)("Add item", "elementor")
35639 - }, /* @__PURE__ */ react.createElement(_elementor_icons.PlusIcon, { fontSize: SIZE }));
35640 - return /* @__PURE__ */ react.createElement(SectionContent, { gap: 2 }, /* @__PURE__ */ react.createElement(RepeaterHeader, {
35641 - label,
35642 - adornment
35643 - }, shouldShowInfotip ? /* @__PURE__ */ react.createElement(_elementor_ui.Infotip, {
35644 - placement: "right",
35645 - content: addButtonInfotipContent,
35646 - color: "secondary",
35647 - slotProps: { popper: { sx: { width: 300 } } }
35648 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: { ...isButtonDisabled ? { cursor: "not-allowed" } : {} } }, addButton)) : addButton), 0 < uniqueKeys.length && /* @__PURE__ */ react.createElement(SortableProvider, {
35649 - value: uniqueKeys,
35650 - onChange: onChangeOrder
35651 - }, uniqueKeys.map((key) => {
35652 - const index = uniqueKeys.indexOf(key);
35653 - const value = items[index];
35654 - if (!value) return null;
35655 - return /* @__PURE__ */ react.createElement(SortableItem, {
35656 - id: key,
35657 - key: `sortable-${key}`,
35658 - disabled: !isSortable
35659 - }, /* @__PURE__ */ react.createElement(RepeaterItem, {
35660 - disabled,
35661 - propDisabled: value?.disabled,
35662 - label: /* @__PURE__ */ react.createElement(RepeaterItemLabelSlot, { value }, /* @__PURE__ */ react.createElement(itemSettings.Label, {
35663 - value,
35664 - index
35665 - })),
35666 - startIcon: /* @__PURE__ */ react.createElement(RepeaterItemIconSlot, { value }, /* @__PURE__ */ react.createElement(itemSettings.Icon, { value })),
35667 - removeItem: () => removeRepeaterItem(index),
35668 - duplicateItem: () => duplicateRepeaterItem(index),
35669 - toggleDisableItem: () => toggleDisableRepeaterItem(index),
35670 - openOnMount: openOnAdd && openItem === index,
35671 - onOpen: () => setOpenItem(EMPTY_OPEN_ITEM),
35672 - onPopoverOpen: itemSettings.onPopoverOpen,
35673 - onPopoverClose: itemSettings.onPopoverClose,
35674 - showDuplicate,
35675 - showToggle,
35676 - showRemove,
35677 - actions: itemSettings.actions,
35678 - value
35679 - }, (props) => /* @__PURE__ */ react.createElement(itemSettings.Content, {
35680 - ...props,
35681 - value,
35682 - bind: String(index),
35683 - index
35684 - })));
35685 - })));
35686 - };
35687 - var RepeaterItem = ({ label, propDisabled, startIcon, children, removeItem, duplicateItem, toggleDisableItem, openOnMount, onOpen, onPopoverOpen, onPopoverClose, showDuplicate, showToggle, showRemove, disabled, actions, value }) => {
35688 - const { popoverState, popoverProps, ref, setRef } = usePopover(openOnMount, () => {
35689 - onOpen();
35690 - onPopoverOpen?.(value);
35691 - }, onPopoverClose ? () => onPopoverClose(value) : void 0);
35692 - const triggerProps = (0, _elementor_ui.bindTrigger)(popoverState);
35693 - usePopoverDismiss({
35694 - isOpen: popoverState.isOpen,
35695 - onClose: popoverProps.onClose
35696 - });
35697 - const duplicateLabel = (0, _wordpress_i18n.__)("Duplicate", "elementor");
35698 - const toggleLabel = propDisabled ? (0, _wordpress_i18n.__)("Show", "elementor") : (0, _wordpress_i18n.__)("Hide", "elementor");
35699 - const removeLabel = (0, _wordpress_i18n.__)("Remove", "elementor");
35700 - return /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: { display: "contents" } }, /* @__PURE__ */ react.createElement(RepeaterTag, {
35701 - disabled,
35702 - label,
35703 - ref: setRef,
35704 - "aria-label": (0, _wordpress_i18n.__)("Open item", "elementor"),
35705 - ...triggerProps,
35706 - onClick: (e) => {
35707 - triggerProps.onClick(e);
35708 - if (!popoverState.isOpen) onPopoverOpen?.(value);
35709 - },
35710 - startIcon,
35711 - actions: /* @__PURE__ */ react.createElement(react.Fragment, null, showDuplicate && /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
35712 - title: duplicateLabel,
35713 - placement: "top"
35714 - }, /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, {
35715 - size: SIZE,
35716 - onClick: duplicateItem,
35717 - "aria-label": duplicateLabel
35718 - }, /* @__PURE__ */ react.createElement(_elementor_icons.CopyIcon, { fontSize: SIZE }))), showToggle && /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
35719 - title: toggleLabel,
35720 - placement: "top"
35721 - }, /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, {
35722 - size: SIZE,
35723 - onClick: toggleDisableItem,
35724 - "aria-label": toggleLabel
35725 - }, propDisabled ? /* @__PURE__ */ react.createElement(_elementor_icons.EyeOffIcon, { fontSize: SIZE }) : /* @__PURE__ */ react.createElement(_elementor_icons.EyeIcon, { fontSize: SIZE }))), actions?.(value), showRemove && /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
35726 - title: removeLabel,
35727 - placement: "top"
35728 - }, /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, {
35729 - size: SIZE,
35730 - onClick: removeItem,
35731 - "aria-label": removeLabel
35732 - }, /* @__PURE__ */ react.createElement(_elementor_icons.XIcon, { fontSize: SIZE }))))
35733 - }), /* @__PURE__ */ react.createElement(RepeaterPopover, {
35734 - width: ref?.getBoundingClientRect().width,
35735 - ...popoverProps,
35736 - anchorEl: ref
35737 - }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, null, children({ anchorEl: ref }))));
35738 - };
35739 - var usePopover = (openOnMount, onOpen, onPopoverClose) => {
35740 - const [ref, setRef] = (0, react.useState)(null);
35741 - const popoverState = (0, _elementor_ui.usePopupState)({ variant: "popover" });
35742 - const popoverProps = (0, _elementor_ui.bindPopover)(popoverState);
35743 - (0, react.useEffect)(() => {
35744 - if (openOnMount && ref) {
35745 - popoverState.open(ref);
35746 - onOpen?.();
35747 - }
35748 - }, [ref]);
35749 - const onClose = () => {
35750 - popoverProps.onClose?.();
35751 - onPopoverClose?.();
35752 - };
35753 - return {
35754 - popoverState,
35755 - ref,
35756 - setRef,
35757 - popoverProps: {
35758 - ...popoverProps,
35759 - onClose
35760 - }
35761 - };
35762 - };
35763 -
35764 -//#endregion
35765 -//#region packages/packages/libs/editor-controls/src/hooks/use-size-value.ts
35766 - var DEFAULT_UNIT = "px";
35767 - var DEFAULT_SIZE = "";
35768 - var useSizeValue = (externalValue, onChange, defaultUnit) => {
35769 - const [sizeValue, setSizeValue] = useSyncExternalState({
35770 - external: externalValue,
35771 - setExternal: (newState) => {
35772 - if (newState !== null) onChange(newState);
35773 - },
35774 - persistWhen: (newState) => differsFromExternal(newState, externalValue),
35775 - fallback: () => ({
35776 - size: DEFAULT_SIZE,
35777 - unit: defaultUnit ?? DEFAULT_UNIT
35778 - })
35779 - });
35780 - const setSize = (value) => {
35781 - const newState = {
35782 - ...sizeValue,
35783 - size: value.trim() === "" ? null : Number(value)
35784 - };
35785 - setSizeValue(newState);
35786 - };
35787 - const setUnit = (unit) => {
35788 - const newState = {
35789 - ...sizeValue,
35790 - unit
35791 - };
35792 - setSizeValue(newState);
35793 - };
35794 - return {
35795 - size: sizeValue.size,
35796 - unit: sizeValue.unit,
35797 - setSize,
35798 - setUnit
35799 - };
35800 - };
35801 - var differsFromExternal = (newState, externalState) => {
35802 - return newState?.size !== externalState?.size || newState?.unit !== externalState?.unit;
35803 - };
35804 -
35805 -//#endregion
35806 -//#region packages/packages/libs/editor-controls/src/components/size/unit-select.tsx
35807 - var menuItemContentStyles = {
35808 - display: "flex",
35809 - flexDirection: "column",
35810 - justifyContent: "center"
35811 - };
35812 - var UnitSelect = ({ value, showPrimaryColor, onClick, options }) => {
35813 - const popupState = (0, _elementor_ui.usePopupState)({
35814 - variant: "popover",
35815 - popupId: (0, react.useId)()
35816 - });
35817 - const handleMenuItemClick = (index) => {
35818 - onClick(options[index]);
35819 - popupState.close();
35820 - };
35821 - return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(StyledButton, {
35822 - isPrimaryColor: showPrimaryColor,
35823 - size: "small",
35824 - ...(0, _elementor_ui.bindTrigger)(popupState)
35825 - }, value), /* @__PURE__ */ react.createElement(_elementor_ui.Menu, {
35826 - MenuListProps: { dense: true },
35827 - ...(0, _elementor_ui.bindMenu)(popupState)
35828 - }, options.map((option, index) => /* @__PURE__ */ react.createElement(_elementor_editor_ui.MenuListItem, {
35829 - key: option,
35830 - onClick: () => handleMenuItemClick(index),
35831 - primaryTypographyProps: {
35832 - variant: "caption",
35833 - sx: {
35834 - ...menuItemContentStyles,
35835 - lineHeight: "1"
35836 - }
35837 - },
35838 - menuItemTextProps: { sx: menuItemContentStyles }
35839 - }, option.toUpperCase()))));
35840 - };
35841 - var StyledButton = (0, _elementor_ui.styled)(_elementor_ui.Button, { shouldForwardProp: (prop) => prop !== "isPrimaryColor" })(({ isPrimaryColor, theme }) => ({
35842 - color: isPrimaryColor ? theme.palette.text.primary : theme.palette.text.tertiary,
35843 - font: "inherit",
35844 - minWidth: "initial",
35845 - textTransform: "uppercase"
35846 - }));
35847 -
35848 -//#endregion
35849 -//#region packages/packages/libs/editor-controls/src/components/size/unstable-size-input.tsx
35850 - var UnstableSizeInput = (0, react.forwardRef)(({ type, value, onChange, onKeyDown, onKeyUp, InputProps, onBlur, focused, disabled }, ref) => {
35851 - return /* @__PURE__ */ react.createElement(NumberInput, {
35852 - ref,
35853 - size: "tiny",
35854 - fullWidth: true,
35855 - type,
35856 - value,
35857 - onKeyUp,
35858 - focused,
35859 - disabled,
35860 - onKeyDown,
35861 - onInput: onChange,
35862 - onBlur,
35863 - InputProps,
35864 - sx: getCursorStyle(InputProps?.readOnly ?? false)
35865 - });
35866 - });
35867 - var getCursorStyle = (readOnly) => ({ input: { cursor: readOnly ? "default !important" : void 0 } });
35868 -
35869 -//#endregion
35870 -//#region packages/packages/libs/editor-controls/src/components/size/unstable-size-field.tsx
35871 - var UnstableSizeField = ({ value, InputProps, onChange, onBlur, units, defaultUnit, startIcon }) => {
35872 - const { size, unit, setSize, setUnit } = useSizeValue(value, onChange, defaultUnit);
35873 - const shouldHighlightUnit = () => {
35874 - return hasValue(size);
35875 - };
35876 - return /* @__PURE__ */ react.createElement(UnstableSizeInput, {
35877 - type: "number",
35878 - value: size ?? "",
35879 - onBlur,
35880 - onChange: (event) => setSize(event.target.value),
35881 - InputProps: {
35882 - ...InputProps,
35883 - startAdornment: startIcon && /* @__PURE__ */ react.createElement(_elementor_ui.InputAdornment, { position: "start" }, startIcon),
35884 - endAdornment: /* @__PURE__ */ react.createElement(_elementor_ui.InputAdornment, { position: "end" }, /* @__PURE__ */ react.createElement(UnitSelect, {
35885 - options: units,
35886 - value: unit,
35887 - onClick: setUnit,
35888 - showPrimaryColor: shouldHighlightUnit()
35889 - }))
35890 - }
35891 - });
35892 - };
35893 - var hasValue = (value) => {
35894 - return value !== null && value !== "";
35895 - };
35896 -
35897 -//#endregion
35898 -//#region packages/packages/libs/editor-controls/src/hooks/use-font-families.ts
35899 - var getFontControlConfig = () => {
35900 - const { controls } = (0, _elementor_editor_v1_adapters.getElementorConfig)();
35901 - return controls?.font ?? {};
35902 - };
35903 - var useFontFamilies = () => {
35904 - const { groups, options } = getFontControlConfig();
35905 - return (0, react.useMemo)(() => {
35906 - if (!groups || !options) return [];
35907 - const groupKeys = Object.keys(groups);
35908 - const groupIndexMap = new Map(groupKeys.map((key, index) => [key, index]));
35909 - return Object.entries(options).reduce((acc, [font, category]) => {
35910 - const groupIndex = groupIndexMap.get(category);
35911 - if (groupIndex === void 0) return acc;
35912 - if (!acc[groupIndex]) acc[groupIndex] = {
35913 - label: groups[category],
35914 - fonts: []
35915 - };
35916 - acc[groupIndex].fonts.push(font);
35917 - return acc;
35918 - }, []).filter(Boolean);
35919 - }, [groups, options]);
35920 - };
35921 -
35922 -//#endregion
35923 -//#region packages/packages/libs/editor-controls/src/index.ts
35924 - var src_exports = /* @__PURE__ */ __exportAll({
35925 - AspectRatioControl: () => AspectRatioControl,
35926 - AttachmentTypeControl: () => AttachmentTypeControl,
35927 - AttributesControl: () => AttributesControl,
35928 - BackgroundControl: () => BackgroundControl,
35929 - BoxShadowRepeaterControl: () => BoxShadowRepeaterControl,
35930 - ChipsControl: () => ChipsControl,
35931 - ClearIconButton: () => ClearIconButton,
35932 - ColorControl: () => ColorControl,
35933 - ControlActions: () => ControlActions,
35934 - ControlActionsProvider: () => ControlActionsProvider,
35935 - ControlAdornments: () => ControlAdornments,
35936 - ControlAdornmentsProvider: () => ControlAdornmentsProvider,
35937 - ControlFormLabel: () => ControlFormLabel,
35938 - ControlReplacementsProvider: () => ControlReplacementsProvider,
35939 - ControlToggleButtonGroup: () => ControlToggleButtonGroup,
35940 - DateRangeControl: () => DateRangeControl,
35941 - DateTimeControl: () => DateTimeControl,
35942 - DisplayConditionsControl: () => DisplayConditionsControl,
35943 - EmailFormActionControl: () => EmailFormActionControl,
35944 - EqualUnequalSizesControl: () => EqualUnequalSizesControl,
35945 - FilterRepeaterControl: () => FilterRepeaterControl,
35946 - FontFamilyControl: () => FontFamilyControl,
35947 - GapControl: () => GapControl,
35948 - GridSpanControl: () => GridSpanControl,
35949 - HtmlTagControl: () => HtmlTagControl,
35950 - ImageControl: () => ImageControl,
35951 - InlineEditingControl: () => InlineEditingControl,
35952 - InlineEditor: () => InlineEditor,
35953 - InlineEditorToolbar: () => InlineEditorToolbar,
35954 - ItemSelector: () => ItemSelector,
35955 - KeyValueControl: () => KeyValueControl,
35956 - LinkControl: () => LinkControl,
35957 - LinkedDimensionsControl: () => LinkedDimensionsControl,
35958 - MentionTextAreaControl: () => MentionTextAreaControl,
35959 - NumberControl: () => NumberControl,
35960 - NumberInput: () => NumberInput,
35961 - PopoverContent: () => PopoverContent,
35962 - PopoverGridContainer: () => PopoverGridContainer,
35963 - PositionControl: () => PositionControl,
35964 - PromotionTrigger: () => PromotionTrigger,
35965 - PropKeyProvider: () => PropKeyProvider,
35966 - PropProvider: () => PropProvider,
35967 - QueryChipsControl: () => QueryChipsControl,
35968 - QueryControl: () => QueryControl,
35969 - QueryFilterRepeaterControl: () => QueryFilterRepeaterControl,
35970 - RepeatableControl: () => RepeatableControl,
35971 - Repeater: () => Repeater,
35972 - SelectControl: () => SelectControl,
35973 - SelectControlWrapper: () => SelectControlWrapper,
35974 - SizeComponent: () => SizeComponent,
35975 - SizeControl: () => SizeControl,
35976 - StrokeControl: () => StrokeControl,
35977 - StyledToggleButton: () => StyledToggleButton,
35978 - StyledToggleButtonGroup: () => StyledToggleButtonGroup,
35979 - SvgMediaControl: () => SvgMediaControl,
35980 - SwitchControl: () => SwitchControl,
35981 - TextAreaControl: () => TextAreaControl,
35982 - TextControl: () => TextControl,
35983 - TimeRangeControl: () => TimeRangeControl,
35984 - TimeStringControl: () => TimeStringControl,
35985 - ToggleButtonGroupUi: () => ToggleButtonGroupUi,
35986 - ToggleControl: () => ToggleControl,
35987 - TransformRepeaterControl: () => TransformRepeaterControl,
35988 - TransformSettingsControl: () => TransformSettingsControl,
35989 - TransitionRepeaterControl: () => TransitionRepeaterControl,
35990 - UnstableSizeControl: () => UnstableSizeControl,
35991 - UnstableSizeField: () => UnstableSizeField,
35992 - UrlControl: () => UrlControl,
35993 - VideoMediaControl: () => VideoMediaControl,
35994 - createControl: () => createControl,
35995 - createControlReplacementsRegistry: () => createControlReplacementsRegistry,
35996 - enqueueFont: () => enqueueFont,
35997 - getControlReplacements: () => getControlReplacements,
35998 - injectIntoRepeaterItemActions: () => injectIntoRepeaterItemActions,
35999 - injectIntoRepeaterItemIcon: () => injectIntoRepeaterItemIcon,
36000 - injectIntoRepeaterItemLabel: () => injectIntoRepeaterItemLabel,
36001 - isUnitExtendedOption: () => isUnitExtendedOption,
36002 - registerControlReplacement: () => registerControlReplacement,
36003 - trackUpgradePromotionClick: () => trackUpgradePromotionClick,
36004 - trackViewPromotion: () => trackViewPromotion,
36005 - transitionProperties: () => transitionProperties,
36006 - transitionsItemsList: () => transitionsItemsList,
36007 - useBoundProp: () => useBoundProp,
36008 - useControlActions: () => useControlActions,
36009 - useControlReplacement: () => useControlReplacement,
36010 - useFontFamilies: () => useFontFamilies,
36011 - useSyncExternalState: () => useSyncExternalState,
36012 - useTypingBuffer: () => useTypingBuffer
36013 - });
36014 -
36015 -//#endregion
36016 -//#region \0elementor-package-library-entry
36017 - (window.elementorV2 = window.elementorV2 || {}).editorControls = src_exports;
36018 -
36019 -//#endregion
36020 -})(React, elementorV2.editorProps, elementorV2.ui, wp.i18n, elementorV2.utils, elementorV2.query, elementorV2.httpClient, elementorV2.icons, elementorV2.wpMedia, elementorV2.editorUi, ReactDOM, elementorV2.editorResponsive, elementorV2.locations, elementorV2.editorElements, elementorV2.editorV1Adapters, elementorV2.session, elementorV2.editorCurrentUser, elementorV2.env, elementorV2.events, elementorV2.schema);
36021 -window.elementorV2.editorControls?.init?.();
36022 -//# sourceMappingURL=editor-controls.js.map
8 +`;function V({children:t}){const{items:n}=P();if(0===n.length)return t;const l=n.map((({MenuItem:t,id:n})=>e.createElement(t,{key:n})));return e.createElement(G,null,e.createElement(r.UnstableFloatingActionBar,{actions:l},t))}var L=z((n=>{const{value:l,setValue:o}=x(t.imageSrcPropTypeUtil),{id:u,url:m}=l??{},{data:s,isFetching:p}=(0,c.useWpMediaAttachment)(u?.value||null),d=s?.url??m?.value??null,{open:E}=(0,c.useWpMediaFrame)({types:["image","image/svg+xml"],allowedExtensions:n.allowedExtensions,multiple:!1,selected:u?.value||null,onSelect:e=>{o({id:{$$type:"image-attachment-id",value:e.id},url:null})}});return e.createElement(V,null,e.createElement(r.Card,{variant:"outlined"},e.createElement(r.CardMedia,{image:d,sx:{height:150}},p?e.createElement(r.Stack,{justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},e.createElement(r.CircularProgress,null)):e.createElement(e.Fragment,null)),e.createElement(r.CardOverlay,null,e.createElement(r.Stack,{gap:1},e.createElement(r.Button,{size:"tiny",color:"inherit",variant:"outlined",onClick:()=>E({mode:"browse"})},(0,a.__)("Select Image","elementor")),e.createElement(r.Button,{size:"tiny",variant:"text",color:"inherit",startIcon:e.createElement(i.UploadIcon,null),onClick:()=>E({mode:"upload"})},(0,a.__)("Upload Image","elementor"))))))})),B=z((({options:n,onChange:l})=>{const{value:a,setValue:o}=x(t.stringPropTypeUtil);return e.createElement(V,null,e.createElement(r.Select,{displayEmpty:!0,size:"tiny",value:a??"",onChange:e=>{const t=e.target.value||null;l?.(t,a),o(t)},fullWidth:!0},n.map((({label:t,...n})=>e.createElement(r.MenuItem,{key:n.value,...n,value:n.value??""},t)))))})),U=z((n=>{const l=x(t.imagePropTypeUtil);return e.createElement(E,{...l},e.createElement(r.Stack,{gap:1.5},e.createElement(b,{bind:"src"},e.createElement(L,null)),e.createElement(b,{bind:"size"},e.createElement(r.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap"},e.createElement(r.Grid,{item:!0,xs:6},e.createElement(C,null," ",(0,a.__)("Image Resolution","elementor"))),e.createElement(r.Grid,{item:!0,xs:6},e.createElement(B,{options:n.sizes}))))))})),O=z((({options:n,placeholder:l="",allowCustomValues:a=!1,propType:o=t.stringPropTypeUtil,minInputLength:i=2})=>{const{value:c="",setValue:u}=x(o),m=!(!c||!n[c]&&!Object.values(n).find((({label:e})=>e===c))),s=!!c,p=Object.keys(n),d=e=>{u(e)},E=(e,{inputValue:t})=>{const l=t?.toLowerCase()||"";return l.length<i?[]:p.filter((e=>-1!==e.toLowerCase().indexOf(l)||-1!==n[e].label.toLowerCase().indexOf(l)))},v=()=>a||!!E(0,{inputValue:c}).length;return e.createElement(V,null,e.createElement(r.Autocomplete,{forcePopupIcon:!1,disableClearable:!0,freeSolo:v(),value:c||"",size:"tiny",onChange:(e,t)=>{u(t)},readOnly:m,options:p,getOptionKey:e=>e,getOptionLabel:e=>n[e]?.label??e,groupBy:F(n)?e=>n[e]?.groupLabel:void 0,isOptionEqualToValue:v()?void 0:()=>!0,filterOptions:E,renderOption:(t,l)=>e.createElement(r.Box,{component:"li",...t,key:t.id},n[l]?.label??l),renderInput:t=>e.createElement(W,{params:t,handleChange:d,allowClear:s,placeholder:l,hasSelectedValue:m})}))})),W=({params:t,allowClear:n,placeholder:l,handleChange:a,hasSelectedValue:o})=>e.createElement(r.TextField,{...t,placeholder:l,onChange:e=>{a(e.target.value)},sx:{"& .MuiInputBase-input":{cursor:o?"default":void 0}},InputProps:{...t.InputProps,endAdornment:e.createElement(A,{params:t,allowClear:n,handleChange:a})}}),A=({allowClear:t,handleChange:n,params:l})=>e.createElement(r.InputAdornment,{position:"end"},t&&e.createElement(r.IconButton,{size:l.size,onClick:()=>n(null),sx:{cursor:"pointer"}},e.createElement(i.XIcon,{fontSize:l.size})));function F(e){return Object.values(e).every((e=>"groupLabel"in e))}var M=z((({placeholder:n})=>{const{value:l,setValue:a}=x(t.stringPropTypeUtil);return e.createElement(V,null,e.createElement(r.TextField,{size:"tiny",fullWidth:!0,value:l??"",onChange:e=>a(e.target.value),placeholder:n}))})),$=z((({placeholder:n})=>{const{value:l,setValue:a}=x(t.stringPropTypeUtil);return e.createElement(V,null,e.createElement(r.TextField,{size:"tiny",multiline:!0,fullWidth:!0,rows:5,value:l??"",onChange:e=>{a(e.target.value)},placeholder:n}))})),R=(0,e.forwardRef)((({placeholder:t,type:n,value:l,onChange:a,endAdornment:o,startAdornment:i},c)=>e.createElement(r.TextField,{size:"tiny",fullWidth:!0,type:n,value:l,onChange:a,placeholder:t,InputProps:{endAdornment:o,startAdornment:i},ref:c}))),j=({options:t,onClick:n,value:l})=>{const a=(0,r.usePopupState)({variant:"popover",popupId:(0,e.useId)()});return e.createElement(r.InputAdornment,{position:"end"},e.createElement(r.Button,{size:"small",color:"inherit",sx:{font:"inherit",minWidth:"initial"},...(0,r.bindTrigger)(a)},l.toUpperCase()),e.createElement(r.Menu,{MenuListProps:{dense:!0},...(0,r.bindMenu)(a)},t.map(((l,o)=>e.createElement(r.MenuItem,{key:l,onClick:()=>(e=>{n(t[e]),a.close()})(o)},l.toUpperCase())))))},N=({external:t,setExternal:n,persistWhen:l,fallback:r})=>{function a(e,t){return e||r(t)}const[o,i]=(0,e.useState)(a(t,null));return(0,e.useEffect)((()=>{i((e=>a(t,e)))}),[t]),[o,e=>{const t=("function"==typeof e?e:()=>e)(o);var r;i(t),n(l(r=t)?r:null)}]},D=["px","%","em","rem","vw","vh"],X=z((({units:n=D,placeholder:l,startIcon:a})=>{const{value:o,setValue:i}=x(t.sizePropTypeUtil),[c,u]=N({external:o,setExternal:i,persistWhen:e=>!!e?.size||0===e?.size,fallback:e=>({unit:e?.unit||"px",size:NaN})});return e.createElement(V,null,e.createElement(R,{endAdornment:e.createElement(j,{options:n,onClick:e=>{u((t=>({size:t?.size??NaN,unit:e})))},value:c?.unit??"px"}),placeholder:l,startAdornment:a??e.createElement(r.InputAdornment,{position:"start"},a),type:"number",value:Number.isNaN(c?.size)?"":c?.size,onChange:e=>{const{value:t}=e.target;u((e=>({...e,size:t||"0"===t?parseFloat(t):NaN})))}}))})),H=z((({propTypeUtil:n=t.colorPropTypeUtil,...l})=>{const{value:a,setValue:o}=x(n);return e.createElement(V,null,e.createElement(r.UnstableColorField,{size:"tiny",...l,value:a??"",onChange:e=>{o(e)},fullWidth:!0}))})),K=["px","em","rem"],q=z((()=>{const n=x(t.strokePropTypeUtil);return e.createElement(E,{...n},e.createElement(r.Stack,{gap:1.5},e.createElement(Y,{bind:"width",label:(0,a.__)("Stroke Width","elementor")},e.createElement(X,{units:K})),e.createElement(Y,{bind:"color",label:(0,a.__)("Stroke Color","elementor")},e.createElement(H,null))))})),Y=({bind:t,label:n,children:l})=>e.createElement(b,{bind:t},e.createElement(r.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap"},e.createElement(r.Grid,{item:!0,xs:6},e.createElement(C,null,n)),e.createElement(r.Grid,{item:!0,xs:6},l))),J="tiny",Q=({label:t,itemSettings:n,values:l=[],setValues:o})=>e.createElement(r.Stack,null,e.createElement(r.Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{pb:1}},e.createElement(r.Typography,{component:"label",variant:"caption",color:"text.secondary"},t),e.createElement(r.IconButton,{size:J,onClick:()=>{const e=structuredClone(n.initialValues);o([...l,e])},"aria-label":(0,a.__)("Add item","elementor")},e.createElement(i.PlusIcon,{fontSize:J}))),e.createElement(r.Stack,{gap:1},l.map(((t,r)=>e.createElement(Z,{key:r,bind:String(r),disabled:t.disabled,label:e.createElement(n.Label,{value:t}),startIcon:e.createElement(n.Icon,{value:t}),removeItem:()=>(e=>{o(l.filter(((t,n)=>n!==e)))})(r),duplicateItem:()=>(e=>{o([...l.slice(0,e),structuredClone(l[e]),...l.slice(e)])})(r),toggleDisableItem:()=>(e=>{o(l.map(((t,n)=>{if(n===e){const{disabled:e,...n}=t;return{...n,...e?{}:{disabled:!0}}}return t})))})(r)},(l=>e.createElement(n.Content,{...l,value:t,bind:String(r)}))))))),Z=({label:t,bind:n,disabled:l,startIcon:o,children:c,removeItem:u,duplicateItem:m,toggleDisableItem:s})=>{const p=`repeater-popup-${n}`,d=(0,e.useRef)(null),[E,v]=(0,e.useState)(null),g=(0,r.usePopupState)({popupId:p,variant:"popover"}),b=(0,r.bindPopover)(g);return e.createElement(e.Fragment,null,e.createElement(r.UnstableTag,{label:t,showActionsOnHover:!0,ref:d,variant:"outlined","aria-label":(0,a.__)("Open item","elementor"),...(0,r.bindTrigger)(g),startIcon:o,actions:e.createElement(e.Fragment,null,e.createElement(r.IconButton,{size:J,onClick:m,"aria-label":(0,a.__)("Duplicate item","elementor")},e.createElement(i.CopyIcon,{fontSize:J})),e.createElement(r.IconButton,{size:J,onClick:s,"aria-label":l?(0,a.__)("Enable item","elementor"):(0,a.__)("Disable item","elementor")},l?e.createElement(i.EyeOffIcon,{fontSize:J}):e.createElement(i.EyeIcon,{fontSize:J})),e.createElement(r.IconButton,{size:J,onClick:u,"aria-label":(0,a.__)("Remove item","elementor")},e.createElement(i.XIcon,{fontSize:J})))}),e.createElement(r.Popover,{disablePortal:!0,slotProps:{paper:{ref:v,sx:{mt:.5,p:1,pt:1,width:d.current?.getBoundingClientRect().width}}},anchorOrigin:{vertical:"bottom",horizontal:"left"},...b},e.createElement(r.Box,{p:.5},c({anchorEl:E}))))},ee=z((()=>{const{propType:n,value:l,setValue:r}=x(t.boxShadowPropTypeUtil);return e.createElement(E,{propType:n,value:l,setValue:r},e.createElement(Q,{values:l??[],setValues:r,label:(0,a.__)("Box shadow","elementor"),itemSettings:{Icon:te,Label:ae,Content:ne,initialValues:oe}}))})),te=({value:t})=>e.createElement(r.UnstableColorIndicator,{size:"inherit",component:"span",value:t.value.color.value}),ne=({anchorEl:t,bind:n})=>e.createElement(b,{bind:n},e.createElement(le,{anchorEl:t})),le=({anchorEl:n})=>{const{propType:l,value:o,setValue:i}=x(t.shadowPropTypeUtil);return e.createElement(E,{propType:l,value:o,setValue:i},e.createElement(r.Stack,{gap:1.5},e.createElement(r.Grid,{container:!0,gap:2,flexWrap:"nowrap"},e.createElement(re,{bind:"color",label:(0,a.__)("Color","elementor")},e.createElement(H,{slotProps:{colorPicker:{anchorEl:n,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:-10}}}})),e.createElement(re,{bind:"position",label:(0,a.__)("Position","elementor")},e.createElement(B,{options:[{label:(0,a.__)("Inset","elementor"),value:"inset"},{label:(0,a.__)("Outset","elementor"),value:null}]}))),e.createElement(r.Grid,{container:!0,gap:2,flexWrap:"nowrap"},e.createElement(re,{bind:"hOffset",label:(0,a.__)("Horizontal","elementor")},e.createElement(X,null)),e.createElement(re,{bind:"vOffset",label:(0,a.__)("Vertical","elementor")},e.createElement(X,null))),e.createElement(r.Grid,{container:!0,gap:2,flexWrap:"nowrap"},e.createElement(re,{bind:"blur",label:(0,a.__)("Blur","elementor")},e.createElement(X,null)),e.createElement(re,{bind:"spread",label:(0,a.__)("Spread","elementor")},e.createElement(X,null)))))},re=({label:t,bind:n,children:l})=>e.createElement(b,{bind:n},e.createElement(r.Grid,{item:!0,xs:6},e.createElement(r.Grid,{container:!0,gap:1,alignItems:"center"},e.createElement(r.Grid,{item:!0,xs:12},e.createElement(r.Typography,{component:"label",variant:"caption",color:"text.secondary"},t)),e.createElement(r.Grid,{item:!0,xs:12},l)))),ae=({value:t})=>{const{position:n,hOffset:l,vOffset:r,blur:a,spread:o}=t.value,{size:i="",unit:c=""}=a?.value||{},{size:u="",unit:m=""}=o?.value||{},{size:s="unset",unit:p=""}=l?.value||{},{size:d="unset",unit:E=""}=r?.value||{},v=n?.value||"outset",g=[s+p,d+E,i+c,u+m].join(" ");return e.createElement("span",{style:{textTransform:"capitalize"}},v,": ",g)},oe={$$type:"shadow",value:{hOffset:{$$type:"size",value:{unit:"px",size:0}},vOffset:{$$type:"size",value:{unit:"px",size:0}},blur:{$$type:"size",value:{unit:"px",size:10}},spread:{$$type:"size",value:{unit:"px",size:0}},color:{$$type:"color",value:"rgba(0, 0, 0, 1)"},position:null}},ie=(0,r.styled)(r.ToggleButtonGroup)`
9 + ${({justify:e})=>`justify-content: ${e};`}
10 +`,ce=({justify:t="end",size:n="tiny",value:l,onChange:a,items:o,exclusive:i=!1,fullWidth:c=!1})=>{const u="rtl"===(0,r.useTheme)().direction;return e.createElement(ie,{justify:t,value:l,onChange:(e,t)=>{a(t)},exclusive:i,sx:{direction:u?"rtl /* @noflip */":"ltr /* @noflip */"}},o.map((({label:t,value:l,renderContent:a,showTooltip:o})=>o?e.createElement(r.Tooltip,{key:l,title:t,disableFocusListener:!0,placement:"top"},e.createElement(r.ToggleButton,{value:l,"aria-label":t,size:n,fullWidth:c},e.createElement(a,{size:n}))):e.createElement(r.ToggleButton,{key:l,value:l,"aria-label":t,size:n,fullWidth:c},e.createElement(a,{size:n})))))},ue=z((({options:n,fullWidth:l=!1,size:r="tiny"})=>{const{value:a,setValue:o}=x(t.stringPropTypeUtil);return e.createElement(ce,{items:n,value:a??null,onChange:e=>{o(e)},exclusive:!0,fullWidth:l,size:r})})),me=e=>null==e||""===e||Number.isNaN(Number(e)),se=z((({placeholder:n,max:l=Number.MAX_VALUE,min:a=-Number.MAX_VALUE,step:o=1,shouldForceInt:i=!1})=>{const{value:c,setValue:u}=x(t.numberPropTypeUtil);return e.createElement(V,null,e.createElement(r.TextField,{size:"tiny",type:"number",fullWidth:!0,value:me(c)?"":c,onChange:e=>{const t=e.target.value;if(me(t))return void u(null);const n=i?+parseInt(t):Number(t);u(Math.min(Math.max(n,a),l))},placeholder:n,inputProps:{step:o}}))})),pe=(e,t)=>{const n=Object.values(e);if(n.length!==t.length)return!1;const[l,...r]=n;return r.every((e=>e?.value?.size===l?.value?.size&&e?.value?.unit===l?.value?.unit))};function de({label:n,icon:l,items:o,multiSizePropTypeUtil:i}){const c=(0,e.useId)(),u=(0,e.useRef)(null),m=(0,r.usePopupState)({variant:"popover",popupId:c}),{propType:s,value:p,setValue:d}=x(i),{value:v,setValue:g}=x(t.sizePropTypeUtil),b=()=>v?o.reduce(((e,{bind:n})=>({...e,[n]:t.sizePropTypeUtil.create(v)})),{}):null,f=!!p;return e.createElement(e.Fragment,null,e.createElement(r.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap",ref:u},e.createElement(r.Grid,{item:!0,xs:6},e.createElement(C,null,n)),e.createElement(r.Grid,{item:!0,xs:6},e.createElement(r.Stack,{direction:"row",alignItems:"center",gap:1},e.createElement(X,{placeholder:f?(0,a.__)("Mixed","elementor"):void 0}),e.createElement(r.ToggleButton,{size:"tiny",value:"check",sx:{marginLeft:"auto"},...(0,r.bindToggle)(m),selected:m.isOpen},l)))),e.createElement(r.Popover,{disablePortal:!0,disableScrollLock:!0,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},...(0,r.bindPopover)(m),slotProps:{paper:{sx:{mt:.5,p:2,pt:1,width:u.current?.getBoundingClientRect().width}}}},e.createElement(E,{propType:s,value:p||(b()??null),setValue:e=>{const t={...p??b(),...e};if(pe(t,o))return g(Object.values(t)[0]?.value);d(t)}},e.createElement(r.Stack,{gap:1.5},e.createElement(r.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap"},e.createElement(Ee,{item:o[0]}),e.createElement(Ee,{item:o[1]})),e.createElement(r.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap"},e.createElement(Ee,{item:o[3]}),e.createElement(Ee,{item:o[2]}))))))}var Ee=({item:t})=>e.createElement(b,{bind:t.bind},e.createElement(r.Grid,{item:!0,xs:6},e.createElement(r.Grid,{container:!0,gap:1,alignItems:"center"},e.createElement(r.Grid,{item:!0,xs:12},e.createElement(C,null,t.label)),e.createElement(r.Grid,{item:!0,xs:12},e.createElement(X,{startIcon:t.icon}))))),ve=z((({label:n})=>{const{value:l,setValue:o,propType:c}=x(t.dimensionsPropTypeUtil),{value:u,setValue:m}=x(t.sizePropTypeUtil),s=!l&&!u||!!u,p=s?i.LinkIcon:i.DetachIcon;return e.createElement(E,{propType:c,value:l,setValue:o},e.createElement(r.Stack,{direction:"row",gap:2,flexWrap:"nowrap"},e.createElement(C,null,n),e.createElement(r.ToggleButton,{"aria-label":(0,a.__)("Link Inputs","elementor"),size:"tiny",value:"check",selected:s,sx:{marginLeft:"auto"},onChange:()=>{if(!s)return void m(l?.top?.value);const e=u?t.sizePropTypeUtil.create(u):null;o({top:e,right:e,bottom:e,left:e})}},e.createElement(p,{fontSize:"tiny"}))),e.createElement(r.Stack,{direction:"row",gap:2,flexWrap:"nowrap"},e.createElement(r.Grid,{container:!0,gap:1,alignItems:"center"},e.createElement(r.Grid,{item:!0,xs:12},e.createElement(C,null,(0,a.__)("Top","elementor"))),e.createElement(r.Grid,{item:!0,xs:12},e.createElement(ge,{bind:"top",startIcon:e.createElement(i.SideTopIcon,{fontSize:"tiny"}),isLinked:s}))),e.createElement(r.Grid,{container:!0,gap:1,alignItems:"center"},e.createElement(r.Grid,{item:!0,xs:12},e.createElement(C,null,(0,a.__)("Right","elementor"))),e.createElement(r.Grid,{item:!0,xs:12},e.createElement(ge,{bind:"right",startIcon:e.createElement(i.SideRightIcon,{fontSize:"tiny"}),isLinked:s})))),e.createElement(r.Stack,{direction:"row",gap:2,flexWrap:"nowrap"},e.createElement(r.Grid,{container:!0,gap:1,alignItems:"center"},e.createElement(r.Grid,{item:!0,xs:12},e.createElement(C,null,(0,a.__)("Bottom","elementor"))),e.createElement(r.Grid,{item:!0,xs:12},e.createElement(ge,{bind:"bottom",startIcon:e.createElement(i.SideBottomIcon,{fontSize:"tiny"}),isLinked:s}))),e.createElement(r.Grid,{container:!0,gap:1,alignItems:"center"},e.createElement(r.Grid,{item:!0,xs:12},e.createElement(C,null,(0,a.__)("Left","elementor"))),e.createElement(r.Grid,{item:!0,xs:12},e.createElement(ge,{bind:"left",startIcon:e.createElement(i.SideLeftIcon,{fontSize:"tiny"}),isLinked:s})))))})),ge=({bind:t,startIcon:n,isLinked:l})=>l?e.createElement(X,{startIcon:n}):e.createElement(b,{bind:t},e.createElement(X,{startIcon:n})),be={system:(0,a.__)("System","elementor"),googlefonts:(0,a.__)("Google Fonts","elementor"),customfonts:(0,a.__)("Custom Fonts","elementor")},fe="tiny",ye=z((({fontFamilies:n})=>{const[l,o]=(0,e.useState)(""),{value:c,setValue:u}=x(t.stringPropTypeUtil),m=(0,e.useId)(),s=(0,r.usePopupState)({variant:"popover",popupId:m}),p=((e,t)=>[...Object.entries(e).reduce(((e,[n,l])=>{if(!n.toLowerCase().includes(t.trim().toLowerCase()))return e;const r=be[l];if(r){const t=e.get(r);t?t.push(n):e.set(r,[n])}return e}),new Map)])(n,l);if(!p)return null;const d=()=>{o(""),s.close()};return e.createElement(e.Fragment,null,e.createElement(r.UnstableTag,{variant:"outlined",label:c,endIcon:e.createElement(i.ChevronDownIcon,{fontSize:"tiny"}),...(0,r.bindTrigger)(s),fullWidth:!0}),e.createElement(r.Popover,{disablePortal:!0,disableScrollLock:!0,anchorOrigin:{vertical:"bottom",horizontal:"left"},...(0,r.bindPopover)(s),onClose:d},e.createElement(r.Stack,null,e.createElement(r.Stack,{direction:"row",alignItems:"center",pl:1.5,pr:.5,py:1.5},e.createElement(i.EditIcon,{fontSize:fe,sx:{mr:.5}}),e.createElement(r.Typography,{variant:"subtitle2"},(0,a.__)("Font Family","elementor")),e.createElement(r.IconButton,{size:fe,sx:{ml:"auto"},onClick:d},e.createElement(i.XIcon,{fontSize:fe}))),e.createElement(r.Box,{px:1.5,pb:1},e.createElement(r.TextField,{fullWidth:!0,size:fe,value:l,placeholder:(0,a.__)("Search","elementor"),onChange:e=>{o(e.target.value)},InputProps:{startAdornment:e.createElement(r.InputAdornment,{position:"start"},e.createElement(i.SearchIcon,{fontSize:fe}))}})),e.createElement(r.Divider,null),e.createElement(r.Box,{sx:{overflowY:"auto",height:260,width:220}},p.length>0?e.createElement(r.MenuList,{role:"listbox",tabIndex:0},p.map((([t,n],l)=>e.createElement(e.Fragment,{key:l},e.createElement(r.ListSubheader,{sx:{typography:"caption",color:"text.tertiary"}},t),n.map((t=>{const n=t===c;return e.createElement(r.MenuItem,{key:t,selected:n,autoFocus:n,onClick:()=>{u(t),d()},sx:{typography:"caption"},style:{fontFamily:t}},t)})))))):e.createElement(r.Stack,{alignItems:"center",p:2.5,gap:1.5},e.createElement(i.PhotoIcon,{fontSize:"large"}),e.createElement(r.Typography,{align:"center",variant:"caption",color:"text.secondary"},(0,a.__)("Sorry, nothing matched","elementor"),e.createElement("br",null),"“",l,"”."),e.createElement(r.Typography,{align:"center",variant:"caption",color:"text.secondary"},e.createElement(r.Link,{color:"secondary",variant:"caption",component:"button",onClick:()=>o("")},(0,a.__)("Clear the filters","elementor"))," ",(0,a.__)("and try again.","elementor")))))))})),he=z((({placeholder:n})=>{const{value:l,setValue:a}=x(t.urlPropTypeUtil);return e.createElement(V,null,e.createElement(r.TextField,{size:"tiny",fullWidth:!0,value:l??"",onChange:e=>a(e.target.value),placeholder:n}))})),xe="tiny",_e=z((n=>{const{value:l,path:o,setValue:i,...c}=x(t.linkPropTypeUtil),[m,s]=(0,u.useSessionStorage)(o.join("/")),{allowCustomValues:p=!1,options:d={},placeholder:v}=n||{};return e.createElement(E,{...c,value:l,setValue:i},e.createElement(r.Stack,{gap:1.5},e.createElement(r.Divider,null),e.createElement(r.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center"}},e.createElement(C,null,(0,a.__)("Link","elementor")),e.createElement(Ce,{enabled:m?.meta?.isEnabled??!1,onIconClick:()=>{const{meta:e}=m??{},{isEnabled:t}=e??{};t&&l?i(null):m?.value&&i(m?.value??null),s({value:l,meta:{isEnabled:!t}})},label:(0,a.__)("Toggle Link","elementor")})),e.createElement(r.Collapse,{in:m?.meta?.isEnabled,timeout:"auto",unmountOnExit:!0},e.createElement(r.Stack,{gap:1.5},e.createElement(b,{bind:"href"},e.createElement(O,{allowCustomValues:!Object.keys(d).length||p,options:d,propType:t.urlPropTypeUtil,placeholder:v})),e.createElement(b,{bind:"isTargetBlank"},e.createElement(Ie,null))))))})),Ce=({enabled:t,onIconClick:n,label:l})=>e.createElement(r.IconButton,{size:xe,onClick:n,"aria-label":l},t?e.createElement(i.MinusIcon,{fontSize:xe}):e.createElement(i.PlusIcon,{fontSize:xe})),Ie=()=>{const{value:n=!1,setValue:l}=x(t.booleanPropTypeUtil);return e.createElement(r.Grid,{container:!0,alignItems:"center",flexWrap:"nowrap",justifyContent:"space-between"},e.createElement(r.Grid,{item:!0},e.createElement(C,null,(0,a.__)("Open in new tab","elementor"))),e.createElement(r.Grid,{item:!0},e.createElement(r.Switch,{checked:n,onChange:()=>{l(!n)}})))},we=z((({label:n})=>{const{value:l,setValue:o,propType:c}=x(t.layoutDirectionPropTypeUtil),{value:u,setValue:m}=x(t.sizePropTypeUtil),s=!l&&!u||!!u,p=s?i.LinkIcon:i.DetachIcon;return e.createElement(E,{propType:c,value:l,setValue:o},e.createElement(r.Stack,{direction:"row",gap:2,flexWrap:"nowrap"},e.createElement(C,null,n),e.createElement(r.ToggleButton,{"aria-label":(0,a.__)("Link Inputs","elementor"),size:"tiny",value:"check",selected:s,sx:{marginLeft:"auto"},onChange:()=>{if(!s)return void m(l?.column.value);const e=u?t.sizePropTypeUtil.create(u):null;o({row:e,column:e})}},e.createElement(p,{fontSize:"tiny"}))),e.createElement(r.Stack,{direction:"row",gap:2,flexWrap:"nowrap"},e.createElement(r.Grid,{container:!0,gap:1,alignItems:"center"},e.createElement(r.Grid,{item:!0,xs:12},e.createElement(C,null,(0,a.__)("Column","elementor"))),e.createElement(r.Grid,{item:!0,xs:12},e.createElement(Te,{bind:"column",isLinked:s}))),e.createElement(r.Grid,{container:!0,gap:1,alignItems:"center"},e.createElement(r.Grid,{item:!0,xs:12},e.createElement(C,null,(0,a.__)("Row","elementor"))),e.createElement(r.Grid,{item:!0,xs:12},e.createElement(Te,{bind:"row",isLinked:s})))))})),Te=({bind:t,isLinked:n})=>n?e.createElement(X,null):e.createElement(b,{bind:t},e.createElement(X,null)),ze=[{value:"fixed",label:(0,a.__)("Fixed","elementor"),renderContent:({size:t})=>e.createElement(i.PinIcon,{fontSize:t}),showTooltip:!0},{value:"scroll",label:(0,a.__)("Scroll","elementor"),renderContent:({size:t})=>e.createElement(i.PinnedOffIcon,{fontSize:t}),showTooltip:!0}],ke=()=>e.createElement(r.Grid,{container:!0,gap:8,alignItems:"center",flexWrap:"nowrap"},e.createElement(r.Grid,{item:!0,xs:2},e.createElement(C,null,(0,a.__)("Attachment","elementor"))),e.createElement(r.Grid,{item:!0,justifyContent:"flex-end",xs:8,sx:{display:"flex"}},e.createElement(ue,{options:ze}))),Se=[{label:(0,a.__)("Center Center","elementor"),value:"center center"},{label:(0,a.__)("Center Left","elementor"),value:"center left"},{label:(0,a.__)("Center Right","elementor"),value:"center right"},{label:(0,a.__)("Top Center","elementor"),value:"top center"},{label:(0,a.__)("Top Left","elementor"),value:"top left"},{label:(0,a.__)("Top Right","elementor"),value:"top right"},{label:(0,a.__)("Bottom Center","elementor"),value:"bottom center"},{label:(0,a.__)("Bottom Left","elementor"),value:"bottom left"},{label:(0,a.__)("Bottom Right","elementor"),value:"bottom right"}],Pe=()=>e.createElement(r.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap"},e.createElement(r.Grid,{item:!0,xs:6},e.createElement(C,null,(0,a.__)("Position","elementor"))),e.createElement(r.Grid,{item:!0,xs:6},e.createElement(B,{options:Se}))),Ge=[{value:"repeat",label:(0,a.__)("Repeat","elementor"),renderContent:({size:t})=>e.createElement(i.GridDotsIcon,{fontSize:t}),showTooltip:!0},{value:"repeat-x",label:(0,a.__)("Repeat-x","elementor"),renderContent:({size:t})=>e.createElement(i.DotsHorizontalIcon,{fontSize:t}),showTooltip:!0},{value:"repeat-y",label:(0,a.__)("Repeat-y","elementor"),renderContent:({size:t})=>e.createElement(i.DotsVerticalIcon,{fontSize:t}),showTooltip:!0},{value:"no-repeat",label:(0,a.__)("No-Repeat","elementor"),renderContent:({size:t})=>e.createElement(i.XIcon,{fontSize:t}),showTooltip:!0}],Ve=()=>e.createElement(r.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap"},e.createElement(r.Grid,{item:!0,xs:6},e.createElement(C,null,(0,a.__)("Repeat","elementor"))),e.createElement(r.Grid,{item:!0,xs:6},e.createElement(ue,{options:Ge}))),Le=[{label:(0,a.__)("Thumbnail - 150 x 150","elementor"),value:"thumbnail"},{label:(0,a.__)("Medium - 300 x 300","elementor"),value:"medium"},{label:(0,a.__)("Medium Large - 768 x 768"),value:"medium_large"},{label:(0,a.__)("Large 1024 x 1024","elementor"),value:"large"},{label:(0,a.__)("Full","elementor"),value:"full"}],Be=()=>e.createElement(r.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap"},e.createElement(r.Grid,{item:!0,xs:6},e.createElement(C,null,(0,a.__)("Resolution","elementor"))),e.createElement(r.Grid,{item:!0,xs:6},e.createElement(B,{options:Le}))),Ue=[{value:"auto",label:(0,a.__)("Auto","elementor"),renderContent:()=>"Auto",showTooltip:!0},{value:"cover",label:(0,a.__)("Cover","elementor"),renderContent:({size:t})=>e.createElement(i.ArrowsMaximizeIcon,{fontSize:t}),showTooltip:!0},{value:"contain",label:(0,a.__)("Contain","elementor"),renderContent:({size:t})=>e.createElement(i.ArrowBarBothIcon,{fontSize:t}),showTooltip:!0}],Oe=()=>e.createElement(r.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap"},e.createElement(r.Grid,{item:!0,xs:6},e.createElement(C,null,(0,a.__)("Size","elementor"))),e.createElement(r.Grid,{item:!0,xs:6,sx:{display:"flex",justifyContent:"flex-end"}},e.createElement(ue,{options:Ue}))),We={$$type:"background-image-overlay",value:{"image-src":{$$type:"image-src",value:{id:{$$type:"image-attachment-id",value:1}}}}},Ae=z((()=>{const{propType:n,value:l,setValue:r}=x(t.backgroundOverlayPropTypeUtil);return e.createElement(E,{propType:n,value:l,setValue:r},e.createElement(Q,{values:l??[],setValues:r,label:(0,a.__)("Overlay","elementor"),itemSettings:{Icon:Fe,Label:Re,Content:Me,initialValues:We}}))})),Fe=({value:t})=>e.createElement(r.UnstableColorIndicator,{size:"inherit",component:"span",value:t.value}),Me=({bind:t,value:n})=>e.createElement(b,{bind:t},e.createElement($e,{value:n})),$e=({value:n})=>{const l=Xe(n.$$type),{getTabsProps:o,getTabProps:i,getTabPanelProps:c}=(0,r.useTabs)(l);return e.createElement(r.Box,{sx:{width:"100%"}},e.createElement(r.Box,{sx:{borderBottom:1,borderColor:"divider"}},e.createElement(r.Tabs,{...o(),"aria-label":(0,a.__)("Background Overlay","elementor")},e.createElement(r.Tab,{label:(0,a.__)("Image","elementor"),...i("image")}),e.createElement(r.Tab,{label:(0,a.__)("Color","elementor"),...i("color")}))),e.createElement(r.TabPanel,{...c("image")},e.createElement(r.Stack,{gap:1.5},e.createElement(De,null))),e.createElement(r.TabPanel,{...c("color")},e.createElement(r.Grid,{container:!0,spacing:1,alignItems:"center"},e.createElement(r.Grid,{item:!0,xs:12},e.createElement(H,{propTypeUtil:t.backgroundColorOverlayPropTypeUtil})))))},Re=({value:t})=>{const n=t.$$type;return"background-color-overlay"===n?e.createElement(je,{value:t}):"background-image-overlay"===n?e.createElement(Ne,{value:t}):void 0},je=({value:t})=>e.createElement("span",null,t.value),Ne=({value:t})=>{const{data:n}=(0,c.useWpMediaAttachment)(t?.value["image-src"]?.value.id.value||null),l=n?.title||null;return e.createElement("span",null,l)},De=()=>{const n=x(t.backgroundImageOverlayPropTypeUtil);return e.createElement(E,{...n},e.createElement(b,{bind:"image-src"},e.createElement(r.Grid,{container:!0,spacing:1,alignItems:"center"},e.createElement(r.Grid,{item:!0,xs:12},e.createElement(L,null)))),e.createElement(b,{bind:"resolution"},e.createElement(Be,null)),e.createElement(b,{bind:"position"},e.createElement(Pe,null)),e.createElement(b,{bind:"repeat"},e.createElement(Ve,null)),e.createElement(b,{bind:"size"},e.createElement(Oe,null)),e.createElement(b,{bind:"attachment"},e.createElement(ke,null)))},Xe=e=>{if("background-color-overlay"===e)return"color";if("background-image-overlay"===e)return"image";throw new Error(`Invalid overlay type: ${e}`)},He=z((()=>{const n=x(t.backgroundPropTypeUtil);return e.createElement(E,{...n},e.createElement(r.Stack,{gap:1.5},e.createElement(b,{bind:"background-overlay"},e.createElement(Ae,null)),e.createElement(b,{bind:"color"},e.createElement(r.Grid,{container:!0,gap:2,alignItems:"center",flexWrap:"nowrap"},e.createElement(r.Grid,{item:!0,xs:6},e.createElement(C,null,(0,a.__)("Color","elementor"))),e.createElement(r.Grid,{item:!0,xs:6},e.createElement(H,null))))))}))}(),(window.elementorV2=window.elementorV2||{}).editorControls=l}();