@magmonium/one 0.4.30 → 0.4.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/button_groups/nav_user_actions.json +1 -0
- package/assets/button_groups/notification_filter.json +2 -13
- package/assets/buttons/nav_user_edit_profile.json +5 -0
- package/assets/docs/en/app-release.md +0 -11
- package/assets/i18n/af.json +10 -2
- package/assets/i18n/am.json +10 -1
- package/assets/i18n/ar.json +10 -2
- package/assets/i18n/as.json +11 -2
- package/assets/i18n/az.json +11 -2
- package/assets/i18n/ba.json +8 -0
- package/assets/i18n/be.json +11 -2
- package/assets/i18n/bg.json +11 -2
- package/assets/i18n/bn.json +11 -2
- package/assets/i18n/br.json +7 -0
- package/assets/i18n/bs.json +10 -2
- package/assets/i18n/ca.json +10 -2
- package/assets/i18n/ceb.json +9 -2
- package/assets/i18n/cnr.json +8 -0
- package/assets/i18n/co.json +7 -1
- package/assets/i18n/cs.json +9 -2
- package/assets/i18n/cy.json +11 -2
- package/assets/i18n/da.json +7 -1
- package/assets/i18n/de.json +8 -2
- package/assets/i18n/doi.json +9 -0
- package/assets/i18n/el.json +10 -2
- package/assets/i18n/en.json +21 -4
- package/assets/i18n/eo.json +9 -2
- package/assets/i18n/es.json +9 -2
- package/assets/i18n/et.json +8 -2
- package/assets/i18n/eu.json +9 -2
- package/assets/i18n/fa.json +10 -2
- package/assets/i18n/fi.json +9 -2
- package/assets/i18n/fr.json +9 -2
- package/assets/i18n/fy.json +6 -2
- package/assets/i18n/ga.json +10 -2
- package/assets/i18n/gd.json +9 -2
- package/assets/i18n/gl.json +8 -1
- package/assets/i18n/gu.json +11 -2
- package/assets/i18n/ha.json +7 -1
- package/assets/i18n/haw.json +8 -2
- package/assets/i18n/he.json +8 -0
- package/assets/i18n/hi.json +10 -2
- package/assets/i18n/hmn.json +6 -2
- package/assets/i18n/hr.json +10 -2
- package/assets/i18n/hu.json +10 -2
- package/assets/i18n/hy.json +11 -2
- package/assets/i18n/id.json +10 -2
- package/assets/i18n/ig.json +8 -1
- package/assets/i18n/ilo.json +6 -0
- package/assets/i18n/is.json +10 -2
- package/assets/i18n/it.json +9 -2
- package/assets/i18n/iw.json +9 -1
- package/assets/i18n/ja.json +8 -1
- package/assets/i18n/jw.json +8 -2
- package/assets/i18n/ka.json +10 -2
- package/assets/i18n/kk.json +10 -2
- package/assets/i18n/km.json +10 -2
- package/assets/i18n/kn.json +11 -2
- package/assets/i18n/ko.json +8 -1
- package/assets/i18n/kok.json +9 -0
- package/assets/i18n/ku.json +10 -2
- package/assets/i18n/ky.json +9 -1
- package/assets/i18n/la.json +6 -1
- package/assets/i18n/lb.json +6 -2
- package/assets/i18n/lo.json +10 -2
- package/assets/i18n/lt.json +10 -2
- package/assets/i18n/lv.json +10 -2
- package/assets/i18n/mai.json +9 -0
- package/assets/i18n/mg.json +8 -2
- package/assets/i18n/mi.json +8 -2
- package/assets/i18n/mk.json +10 -2
- package/assets/i18n/ml.json +11 -2
- package/assets/i18n/mn.json +10 -2
- package/assets/i18n/mr.json +11 -2
- package/assets/i18n/ms.json +9 -2
- package/assets/i18n/mt.json +9 -2
- package/assets/i18n/my.json +10 -2
- package/assets/i18n/ne.json +10 -2
- package/assets/i18n/nl.json +6 -2
- package/assets/i18n/no.json +8 -2
- package/assets/i18n/ny.json +9 -2
- package/assets/i18n/or.json +10 -1
- package/assets/i18n/pa.json +11 -2
- package/assets/i18n/pl.json +8 -2
- package/assets/i18n/ps.json +8 -1
- package/assets/i18n/pt.json +9 -2
- package/assets/i18n/ro.json +9 -2
- package/assets/i18n/ru.json +9 -2
- package/assets/i18n/sa.json +9 -0
- package/assets/i18n/sat.json +9 -0
- package/assets/i18n/sd.json +11 -2
- package/assets/i18n/si.json +10 -2
- package/assets/i18n/sk.json +6 -1
- package/assets/i18n/sl.json +10 -2
- package/assets/i18n/sm.json +7 -1
- package/assets/i18n/sn.json +6 -2
- package/assets/i18n/so.json +8 -1
- package/assets/i18n/sq.json +10 -2
- package/assets/i18n/sr.json +10 -2
- package/assets/i18n/st.json +8 -2
- package/assets/i18n/su.json +8 -2
- package/assets/i18n/sv.json +8 -2
- package/assets/i18n/sw.json +10 -2
- package/assets/i18n/ta.json +11 -2
- package/assets/i18n/te.json +11 -2
- package/assets/i18n/tg.json +11 -2
- package/assets/i18n/th.json +10 -1
- package/assets/i18n/tl.json +8 -2
- package/assets/i18n/tr.json +10 -2
- package/assets/i18n/uk.json +11 -2
- package/assets/i18n/ur.json +11 -2
- package/assets/i18n/uz.json +10 -2
- package/assets/i18n/vi.json +10 -1
- package/assets/i18n/xh.json +11 -2
- package/assets/i18n/yi.json +10 -1
- package/assets/i18n/yo.json +9 -1
- package/assets/i18n/zh.json +9 -1
- package/assets/i18n/zu.json +11 -2
- package/assets/index.json +1 -1
- package/fesm2022/magmonium-one-attribute-value-DMI0yJpL.mjs +255 -0
- package/fesm2022/magmonium-one-attribute-value-DMI0yJpL.mjs.map +1 -0
- package/fesm2022/magmonium-one-base-checkbox-C9dvZ2IH.mjs +77 -0
- package/fesm2022/magmonium-one-base-checkbox-C9dvZ2IH.mjs.map +1 -0
- package/fesm2022/magmonium-one-base-dropdown-U-cWl3p9.mjs +604 -0
- package/fesm2022/magmonium-one-base-dropdown-U-cWl3p9.mjs.map +1 -0
- package/fesm2022/magmonium-one-base-input-CLBOTOUs.mjs +183 -0
- package/fesm2022/magmonium-one-base-input-CLBOTOUs.mjs.map +1 -0
- package/fesm2022/magmonium-one-base-text-Zb0oLNRX.mjs +94 -0
- package/fesm2022/magmonium-one-base-text-Zb0oLNRX.mjs.map +1 -0
- package/fesm2022/magmonium-one-button-Bwzaxxn3.mjs +1281 -0
- package/fesm2022/magmonium-one-button-Bwzaxxn3.mjs.map +1 -0
- package/fesm2022/magmonium-one-checkbox-CPQ9m291.mjs +365 -0
- package/fesm2022/magmonium-one-checkbox-CPQ9m291.mjs.map +1 -0
- package/fesm2022/magmonium-one-color-utl-CAbZLKB5.mjs +449 -0
- package/fesm2022/magmonium-one-color-utl-CAbZLKB5.mjs.map +1 -0
- package/fesm2022/magmonium-one-directives-BVKX77zM.mjs +1285 -0
- package/fesm2022/magmonium-one-directives-BVKX77zM.mjs.map +1 -0
- package/fesm2022/magmonium-one-file.service-Bo06pU3_.mjs +65 -0
- package/fesm2022/magmonium-one-file.service-Bo06pU3_.mjs.map +1 -0
- package/fesm2022/magmonium-one-group-D4yYrVP3.mjs +428 -0
- package/fesm2022/magmonium-one-group-D4yYrVP3.mjs.map +1 -0
- package/fesm2022/magmonium-one-header-DmN8M1a3.mjs +380 -0
- package/fesm2022/magmonium-one-header-DmN8M1a3.mjs.map +1 -0
- package/fesm2022/magmonium-one-icon-Ep14YeRY.mjs +833 -0
- package/fesm2022/magmonium-one-icon-Ep14YeRY.mjs.map +1 -0
- package/fesm2022/magmonium-one-image-editor-BX4eNd4u.mjs +438 -0
- package/fesm2022/magmonium-one-image-editor-BX4eNd4u.mjs.map +1 -0
- package/fesm2022/magmonium-one-image-frame-BTSaUSAi.mjs +116 -0
- package/fesm2022/magmonium-one-image-frame-BTSaUSAi.mjs.map +1 -0
- package/fesm2022/magmonium-one-input-DqHPorA1.mjs +39 -0
- package/fesm2022/magmonium-one-input-DqHPorA1.mjs.map +1 -0
- package/fesm2022/magmonium-one-label-D2gjTbKX.mjs +574 -0
- package/fesm2022/magmonium-one-label-D2gjTbKX.mjs.map +1 -0
- package/fesm2022/magmonium-one-m-ref-Bq0gQbKE.mjs +147 -0
- package/fesm2022/magmonium-one-m-ref-Bq0gQbKE.mjs.map +1 -0
- package/fesm2022/magmonium-one-menu-BM9f2knw.mjs +887 -0
- package/fesm2022/magmonium-one-menu-BM9f2knw.mjs.map +1 -0
- package/fesm2022/magmonium-one-multi-range-a3ZVTy7i.mjs +458 -0
- package/fesm2022/magmonium-one-multi-range-a3ZVTy7i.mjs.map +1 -0
- package/fesm2022/magmonium-one-options-asset-CDEXIif6.mjs +97 -0
- package/fesm2022/magmonium-one-options-asset-CDEXIif6.mjs.map +1 -0
- package/fesm2022/magmonium-one-otp-DO4oTeSK.mjs +261 -0
- package/fesm2022/magmonium-one-otp-DO4oTeSK.mjs.map +1 -0
- package/fesm2022/magmonium-one-password-D3oTo41c.mjs +217 -0
- package/fesm2022/magmonium-one-password-D3oTo41c.mjs.map +1 -0
- package/fesm2022/magmonium-one-radio-CkaWESS3.mjs +111 -0
- package/fesm2022/magmonium-one-radio-CkaWESS3.mjs.map +1 -0
- package/fesm2022/magmonium-one-range-D_WEKrli.mjs +216 -0
- package/fesm2022/magmonium-one-range-D_WEKrli.mjs.map +1 -0
- package/fesm2022/magmonium-one-rolldown-runtime-DpJrqANO.mjs +11 -0
- package/fesm2022/magmonium-one-selector-BowevmOd.mjs +1065 -0
- package/fesm2022/magmonium-one-selector-BowevmOd.mjs.map +1 -0
- package/fesm2022/magmonium-one-size-converter-BfT0Aw0g.mjs +1060 -0
- package/fesm2022/magmonium-one-size-converter-BfT0Aw0g.mjs.map +1 -0
- package/fesm2022/magmonium-one-text-B4xKn-EQ.mjs +406 -0
- package/fesm2022/magmonium-one-text-B4xKn-EQ.mjs.map +1 -0
- package/fesm2022/magmonium-one-text-output-CfVeqYM7.mjs +296 -0
- package/fesm2022/magmonium-one-text-output-CfVeqYM7.mjs.map +1 -0
- package/fesm2022/magmonium-one-theme-Xgsx8bJs.mjs +1 -0
- package/fesm2022/magmonium-one-toggle-D2XEbN-b.mjs +231 -0
- package/fesm2022/magmonium-one-toggle-D2XEbN-b.mjs.map +1 -0
- package/fesm2022/magmonium-one.mjs +49250 -2
- package/fesm2022/magmonium-one.mjs.map +1 -1
- package/package.json +8 -8
- package/types/magmonium-one.d.ts +13909 -9533
- package/assets/menu/user_header.json +0 -27
- package/fesm2022/magmonium-one-image-editor-QPOy7XQt.mjs +0 -290
- package/fesm2022/magmonium-one-image-editor-QPOy7XQt.mjs.map +0 -1
- package/fesm2022/magmonium-one-magmonium-one-BTi-rHpF.mjs +0 -41583
- package/fesm2022/magmonium-one-magmonium-one-BTi-rHpF.mjs.map +0 -1
- package/fesm2022/magmonium-one-otp-BcNCgGpz.mjs +0 -201
- package/fesm2022/magmonium-one-otp-BcNCgGpz.mjs.map +0 -1
- package/fesm2022/magmonium-one-password-BDcSzmV_.mjs +0 -105
- package/fesm2022/magmonium-one-password-BDcSzmV_.mjs.map +0 -1
- package/fesm2022/magmonium-one-toggle-bLWTwEHE.mjs +0 -62
- package/fesm2022/magmonium-one-toggle-bLWTwEHE.mjs.map +0 -1
|
@@ -0,0 +1,1060 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { DestroyRef, Injectable, InjectionToken, Pipe, computed, inject, linkedSignal, signal } from "@angular/core";
|
|
3
|
+
import { HttpClient, HttpParams } from "@angular/common/http";
|
|
4
|
+
import { catchError, finalize, firstValueFrom, forkJoin, map, of, shareReplay, tap, throwError } from "rxjs";
|
|
5
|
+
import { rxResource, toObservable } from "@angular/core/rxjs-interop";
|
|
6
|
+
import { patchState, signalStore, withHooks, withMethods, withState } from "@ngrx/signals";
|
|
7
|
+
var Size;
|
|
8
|
+
(function(Size) {
|
|
9
|
+
Size["SMALL"] = "sm";
|
|
10
|
+
Size["MEDIUM"] = "md";
|
|
11
|
+
Size["LARGE"] = "lg";
|
|
12
|
+
})(Size || (Size = {}));
|
|
13
|
+
const DEFAULT_SIZE = Size.MEDIUM;
|
|
14
|
+
var Assets;
|
|
15
|
+
(function(Assets) {
|
|
16
|
+
Assets["JSON"] = "json";
|
|
17
|
+
Assets["SVG"] = "svg";
|
|
18
|
+
Assets["PNG"] = "png";
|
|
19
|
+
Assets["CSS"] = "css";
|
|
20
|
+
Assets["MD"] = "md";
|
|
21
|
+
})(Assets || (Assets = {}));
|
|
22
|
+
const LAYOUT_ASSET_FOLDER = {
|
|
23
|
+
section: "sections",
|
|
24
|
+
row: "rows",
|
|
25
|
+
col: "cols",
|
|
26
|
+
flex: "flex_containers",
|
|
27
|
+
flex_item: "flex_items",
|
|
28
|
+
section_button_group: "section_button_groups",
|
|
29
|
+
section_hero: "section_heroes",
|
|
30
|
+
section_carousel: "section_carousels",
|
|
31
|
+
text_output: "text_outputs",
|
|
32
|
+
list: "lists",
|
|
33
|
+
section_table: "section_tables"
|
|
34
|
+
};
|
|
35
|
+
const FORM_ASSET_FOLDER = {
|
|
36
|
+
form: "forms",
|
|
37
|
+
field: "fields",
|
|
38
|
+
options: "options",
|
|
39
|
+
patterns: "patterns"
|
|
40
|
+
};
|
|
41
|
+
var AppRelationType;
|
|
42
|
+
(function(AppRelationType) {
|
|
43
|
+
AppRelationType[AppRelationType["OWNER"] = 1] = "OWNER";
|
|
44
|
+
AppRelationType[AppRelationType["COLLABORATOR"] = 2] = "COLLABORATOR";
|
|
45
|
+
AppRelationType[AppRelationType["USER"] = 3] = "USER";
|
|
46
|
+
AppRelationType[AppRelationType["COLLABORATE_REQUESTED"] = 4] = "COLLABORATE_REQUESTED";
|
|
47
|
+
AppRelationType[AppRelationType["INSTALL_REQUESTED"] = 5] = "INSTALL_REQUESTED";
|
|
48
|
+
AppRelationType[AppRelationType["INSTALL_REJECTED"] = 6] = "INSTALL_REJECTED";
|
|
49
|
+
AppRelationType[AppRelationType["COLLABORATE_REJECTED"] = 7] = "COLLABORATE_REJECTED";
|
|
50
|
+
})(AppRelationType || (AppRelationType = {}));
|
|
51
|
+
var AppAvailability;
|
|
52
|
+
(function(AppAvailability) {
|
|
53
|
+
AppAvailability[AppAvailability["EVERYONE"] = 1] = "EVERYONE";
|
|
54
|
+
AppAvailability[AppAvailability["TEAM_ONLY"] = 2] = "TEAM_ONLY";
|
|
55
|
+
AppAvailability[AppAvailability["ONLY_ME"] = 3] = "ONLY_ME";
|
|
56
|
+
AppAvailability[AppAvailability["OPEN"] = 4] = "OPEN";
|
|
57
|
+
})(AppAvailability || (AppAvailability = {}));
|
|
58
|
+
const LOGIN_COMPONENT = new InjectionToken("LOGIN_COMPONENT");
|
|
59
|
+
const LOGIN_STORE = new InjectionToken("LOGIN_STORE");
|
|
60
|
+
const WC_BUNDLE = new InjectionToken("WC_BUNDLE");
|
|
61
|
+
const ASSET_BASE_URL = new InjectionToken("ASSET_BASE_URL");
|
|
62
|
+
const ONE_ASSET_BASE_URL = new InjectionToken("ONE_ASSET_BASE_URL");
|
|
63
|
+
const SEARCH_QUERY = new InjectionToken("SEARCH_QUERY");
|
|
64
|
+
const SEARCH_RESULTS_EVENT = "__mag_search_results__";
|
|
65
|
+
const WC_SEARCH_GROUPS = new InjectionToken("WC_SEARCH_GROUPS");
|
|
66
|
+
const NAV_STORE_REF = new InjectionToken("NAV_STORE_REF");
|
|
67
|
+
const MODAL_STORE_REF = new InjectionToken("MODAL_STORE_REF");
|
|
68
|
+
const USER_STORE_REF = new InjectionToken("USER_STORE_REF");
|
|
69
|
+
const APP_CONTEXT_REF = new InjectionToken("APP_CONTEXT_REF");
|
|
70
|
+
const APP_LINK = new InjectionToken("APP_LINK", {
|
|
71
|
+
providedIn: "root",
|
|
72
|
+
factory: () => signal(void 0)
|
|
73
|
+
});
|
|
74
|
+
const LOADING_ACTIONS_REF = new InjectionToken("LOADING_ACTIONS_REF");
|
|
75
|
+
const IS_SIDE_PANEL = new InjectionToken("IS_SIDE_PANEL");
|
|
76
|
+
const ICON_SOURCE = new InjectionToken("ICON_SOURCE");
|
|
77
|
+
const TRANSLATION_SOURCE = new InjectionToken("TRANSLATION_SOURCE");
|
|
78
|
+
const OPTIONS_SOURCE = new InjectionToken("OPTIONS_SOURCE");
|
|
79
|
+
const COMPONENT_INPUT_REGISTRY = new InjectionToken("COMPONENT_INPUT_REGISTRY");
|
|
80
|
+
const FOLDER_PICK_LISTENER = new InjectionToken("FOLDER_PICK_LISTENER");
|
|
81
|
+
const IS_DESIGN_MODE = new InjectionToken("IS_DESIGN_MODE");
|
|
82
|
+
function isWebComponent(config) {
|
|
83
|
+
if (!config || typeof config !== "object") return false;
|
|
84
|
+
return "selector" in config;
|
|
85
|
+
}
|
|
86
|
+
const PREVIEW_PATH_RE = /\/pwa\/(draft|beta|published)(?:\/|$)/;
|
|
87
|
+
const PREVIEW_TIERS = /* @__PURE__ */ new Set([
|
|
88
|
+
"draft",
|
|
89
|
+
"beta",
|
|
90
|
+
"published"
|
|
91
|
+
]);
|
|
92
|
+
function getTierFromSearch(search) {
|
|
93
|
+
const tier = new URLSearchParams(search).get("tier");
|
|
94
|
+
return tier && PREVIEW_TIERS.has(tier) ? tier : null;
|
|
95
|
+
}
|
|
96
|
+
function isTierPreview(pathname, search) {
|
|
97
|
+
if (pathname !== void 0 && PREVIEW_PATH_RE.test(pathname)) return true;
|
|
98
|
+
if (search !== void 0 && !!getTierFromSearch(search)) return true;
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
function getTierFromPreviewPath(pathname, search) {
|
|
102
|
+
return PREVIEW_PATH_RE.exec(pathname)?.[1] ?? (search ? getTierFromSearch(search) : null);
|
|
103
|
+
}
|
|
104
|
+
const isLocalhost = typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname === "0.0.0.0");
|
|
105
|
+
function isUrlLocalhost(url) {
|
|
106
|
+
try {
|
|
107
|
+
const host = new URL(url).hostname;
|
|
108
|
+
return host === "localhost" || host === "127.0.0.1" || host === "0.0.0.0";
|
|
109
|
+
} catch {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const tierWindow = () => typeof window !== "undefined" ? window : void 0;
|
|
114
|
+
function setWcTier(remoteId, tier) {
|
|
115
|
+
const win = tierWindow();
|
|
116
|
+
if (!win) return;
|
|
117
|
+
const tiers = { ...win.__MAGMONIUM_WC_TIERS__ ?? {} };
|
|
118
|
+
if (tier) tiers[remoteId] = tier;
|
|
119
|
+
else delete tiers[remoteId];
|
|
120
|
+
win.__MAGMONIUM_WC_TIERS__ = tiers;
|
|
121
|
+
}
|
|
122
|
+
function setWcLocalPort(remoteId, port) {
|
|
123
|
+
const win = tierWindow();
|
|
124
|
+
if (!win) return;
|
|
125
|
+
const ports = { ...win.__MAGMONIUM_WC_LOCAL_PORTS__ ?? {} };
|
|
126
|
+
if (port) ports[remoteId] = port;
|
|
127
|
+
else delete ports[remoteId];
|
|
128
|
+
win.__MAGMONIUM_WC_LOCAL_PORTS__ = ports;
|
|
129
|
+
}
|
|
130
|
+
function wcLocalBaseOf(remoteId) {
|
|
131
|
+
const win = tierWindow();
|
|
132
|
+
if (win?.__MAGMONIUM_WC_TIERS__?.[remoteId] !== "local") return void 0;
|
|
133
|
+
const port = win.__MAGMONIUM_WC_LOCAL_PORTS__?.[remoteId];
|
|
134
|
+
return port && Number.isInteger(port) && port > 0 && port < 65536 ? `http://localhost:${port}/assets` : void 0;
|
|
135
|
+
}
|
|
136
|
+
function wcTierOf(remoteId) {
|
|
137
|
+
return tierWindow()?.__MAGMONIUM_WC_TIERS__?.[remoteId];
|
|
138
|
+
}
|
|
139
|
+
function definedWcTierOf(selector) {
|
|
140
|
+
return tierWindow()?.__MAGMONIUM_WC_DEFINED_TIERS__?.[selector];
|
|
141
|
+
}
|
|
142
|
+
function definedWcBundleOf(selector) {
|
|
143
|
+
return tierWindow()?.__MAGMONIUM_WC_DEFINED_BUNDLES__?.[selector];
|
|
144
|
+
}
|
|
145
|
+
function recordDefinedWcTier(selector, tier, bundle) {
|
|
146
|
+
const win = tierWindow();
|
|
147
|
+
if (!win) return;
|
|
148
|
+
win.__MAGMONIUM_WC_DEFINED_TIERS__ = {
|
|
149
|
+
...win.__MAGMONIUM_WC_DEFINED_TIERS__ ?? {},
|
|
150
|
+
[selector]: tier
|
|
151
|
+
};
|
|
152
|
+
if (bundle) win.__MAGMONIUM_WC_DEFINED_BUNDLES__ = {
|
|
153
|
+
...win.__MAGMONIUM_WC_DEFINED_BUNDLES__ ?? {},
|
|
154
|
+
[selector]: bundle
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function buildWcBaseUrl(apiUrl, remoteId) {
|
|
158
|
+
const local = wcLocalBaseOf(remoteId);
|
|
159
|
+
if (local) return local;
|
|
160
|
+
if (tierWindow()?.__MAGMONIUM_STANDALONE__) return "/assets";
|
|
161
|
+
if (isLocalhost) return `/local-dist/m-${remoteId}-wc`;
|
|
162
|
+
return `${apiUrl}/store/v1/wc/${remoteId}${wcTierOf(remoteId) === "beta" ? "/beta" : ""}`;
|
|
163
|
+
}
|
|
164
|
+
const ACCESS_DOMAINS = /* @__PURE__ */ new Set([
|
|
165
|
+
"auth",
|
|
166
|
+
"user",
|
|
167
|
+
"admin"
|
|
168
|
+
]);
|
|
169
|
+
var HttpService = class HttpService {
|
|
170
|
+
http = inject(HttpClient);
|
|
171
|
+
url = "http://localhost:8000";
|
|
172
|
+
authUrl = "http://localhost:8000";
|
|
173
|
+
assetUrl = inject(ASSET_BASE_URL, { optional: true }) ?? "./assets";
|
|
174
|
+
oneAssetUrl = inject(ONE_ASSET_BASE_URL, { optional: true }) ?? "./assets";
|
|
175
|
+
publicUrl = "./";
|
|
176
|
+
get(domain, path, version, params) {
|
|
177
|
+
return this.http.get(this.createUrl(domain, path, version), { params: this.toParams(params) });
|
|
178
|
+
}
|
|
179
|
+
put(domain, path, data, version, params) {
|
|
180
|
+
return this.http.put(this.createUrl(domain, path, version), data, { params: this.toParams(params) });
|
|
181
|
+
}
|
|
182
|
+
post(domain, path, data, version, params) {
|
|
183
|
+
return this.http.post(this.createUrl(domain, path, version), data, { params: this.toParams(params) });
|
|
184
|
+
}
|
|
185
|
+
patch(domain, path, data, version, params) {
|
|
186
|
+
return this.http.patch(this.createUrl(domain, path, version), data, { params: this.toParams(params) });
|
|
187
|
+
}
|
|
188
|
+
patchEvents(domain, path, data, version) {
|
|
189
|
+
return this.http.patch(this.createUrl(domain, path, version), data, {
|
|
190
|
+
observe: "events",
|
|
191
|
+
responseType: "text",
|
|
192
|
+
reportProgress: true
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
postEvents(domain, path, data, version) {
|
|
196
|
+
return this.http.post(this.createUrl(domain, path, version), data, {
|
|
197
|
+
observe: "events",
|
|
198
|
+
responseType: "text",
|
|
199
|
+
reportProgress: true
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
delete(domain, path, version, params) {
|
|
203
|
+
return this.http.delete(this.createUrl(domain, path, version), { params: this.toParams(params) });
|
|
204
|
+
}
|
|
205
|
+
deleteWithBody(domain, path, body, version, params) {
|
|
206
|
+
return this.http.delete(this.createUrl(domain, path, version), {
|
|
207
|
+
body,
|
|
208
|
+
params: this.toParams(params)
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
setUrl(url) {
|
|
212
|
+
this.url = url;
|
|
213
|
+
}
|
|
214
|
+
getUrl() {
|
|
215
|
+
return this.url;
|
|
216
|
+
}
|
|
217
|
+
setAuthUrl(url) {
|
|
218
|
+
this.authUrl = url;
|
|
219
|
+
}
|
|
220
|
+
getAuthUrl() {
|
|
221
|
+
return this.authUrl;
|
|
222
|
+
}
|
|
223
|
+
buildUrl(domain, path, version) {
|
|
224
|
+
return this.createUrl(domain, path, version);
|
|
225
|
+
}
|
|
226
|
+
setAssetUrl(url) {
|
|
227
|
+
this.assetUrl = url;
|
|
228
|
+
}
|
|
229
|
+
setOneAssetUrl(url) {
|
|
230
|
+
this.oneAssetUrl = url;
|
|
231
|
+
}
|
|
232
|
+
setPublicUrl(url) {
|
|
233
|
+
this.publicUrl = url;
|
|
234
|
+
}
|
|
235
|
+
blob(url) {
|
|
236
|
+
return this.http.get(url, { responseType: "blob" });
|
|
237
|
+
}
|
|
238
|
+
text(url) {
|
|
239
|
+
return this.http.get(url, { responseType: "text" });
|
|
240
|
+
}
|
|
241
|
+
wc(link, filePath) {
|
|
242
|
+
const local = wcLocalBaseOf(link);
|
|
243
|
+
if (local) return this.http.get(`${local}/${filePath.join("/")}`);
|
|
244
|
+
if (isLocalhost) return this.http.get(`/local-dist/m-${link}-wc/${filePath.join("/")}`);
|
|
245
|
+
const tier = wcTierOf(link);
|
|
246
|
+
return this.get("store", [
|
|
247
|
+
"wc",
|
|
248
|
+
link,
|
|
249
|
+
...tier === "beta" ? [tier] : [],
|
|
250
|
+
...filePath
|
|
251
|
+
]);
|
|
252
|
+
}
|
|
253
|
+
buildWcUrl(link) {
|
|
254
|
+
return buildWcBaseUrl(this.url, link);
|
|
255
|
+
}
|
|
256
|
+
buildWcAssetBaseUrl(link) {
|
|
257
|
+
return this.buildWcUrl(link);
|
|
258
|
+
}
|
|
259
|
+
buildWcAssetUrl(link, path) {
|
|
260
|
+
const normalized = path.startsWith("assets/") ? path.slice(7) : path;
|
|
261
|
+
return this.join(this.buildWcAssetBaseUrl(link), normalized);
|
|
262
|
+
}
|
|
263
|
+
getAssetUrl(path, isPublic = false) {
|
|
264
|
+
if (!path) return "";
|
|
265
|
+
if (path.startsWith("http") || path.startsWith("data:") || path.startsWith("blob:")) return path;
|
|
266
|
+
const base = isPublic ? this.assetUrl : this.url;
|
|
267
|
+
return this.join(base, path);
|
|
268
|
+
}
|
|
269
|
+
getPublicUrl(path) {
|
|
270
|
+
if (!path) return "";
|
|
271
|
+
if (path.startsWith("http")) return path;
|
|
272
|
+
return this.join(this.publicUrl, path);
|
|
273
|
+
}
|
|
274
|
+
async loadWorker(url) {
|
|
275
|
+
if (url.startsWith("http") && !url.startsWith(window.location.origin)) try {
|
|
276
|
+
const script = await firstValueFrom(this.http.get(url, { responseType: "text" }));
|
|
277
|
+
const blob = new Blob([script], { type: "application/javascript" });
|
|
278
|
+
return new Worker(URL.createObjectURL(blob));
|
|
279
|
+
} catch (error) {
|
|
280
|
+
console.warn(`Failed to fetch worker cross-origin, falling back to importScripts shim:`, error);
|
|
281
|
+
const shim = new Blob([`importScripts("${url}")`], { type: "application/javascript" });
|
|
282
|
+
return new Worker(URL.createObjectURL(shim));
|
|
283
|
+
}
|
|
284
|
+
return new Worker(url);
|
|
285
|
+
}
|
|
286
|
+
join(base, path) {
|
|
287
|
+
return `${base.endsWith("/") ? base.slice(0, -1) : base}/${path.startsWith("/") ? path.slice(1) : path}`;
|
|
288
|
+
}
|
|
289
|
+
asset(tree, type, options, baseUrl) {
|
|
290
|
+
const resolvedBase = baseUrl ?? (tree[0] === "one" ? this.oneAssetUrl : this.assetUrl);
|
|
291
|
+
const url = this.join(resolvedBase, `${tree.join("/")}.${type}`);
|
|
292
|
+
const requestOptions = {
|
|
293
|
+
...options,
|
|
294
|
+
responseType: this.fromAssetToResponseType(type)
|
|
295
|
+
};
|
|
296
|
+
return this.http.get(url, requestOptions);
|
|
297
|
+
}
|
|
298
|
+
createUrl(domain, path, version) {
|
|
299
|
+
return `${ACCESS_DOMAINS.has(domain) ? this.authUrl : this.url}/${domain}/${version ?? "v1"}/${path.join("/")}`;
|
|
300
|
+
}
|
|
301
|
+
toParams(params) {
|
|
302
|
+
if (!params) return void 0;
|
|
303
|
+
let built = new HttpParams();
|
|
304
|
+
for (const [key, value] of Object.entries(params)) {
|
|
305
|
+
if (value === void 0 || value === null) continue;
|
|
306
|
+
if (Array.isArray(value)) for (const item of value) built = built.append(key, String(item));
|
|
307
|
+
else built = built.set(key, String(value));
|
|
308
|
+
}
|
|
309
|
+
return built.keys().length ? built : void 0;
|
|
310
|
+
}
|
|
311
|
+
fromAssetToResponseType = (assets) => {
|
|
312
|
+
let responseType = "json";
|
|
313
|
+
switch (assets) {
|
|
314
|
+
case Assets.SVG:
|
|
315
|
+
case Assets.CSS:
|
|
316
|
+
case Assets.MD:
|
|
317
|
+
responseType = "text";
|
|
318
|
+
break;
|
|
319
|
+
case Assets.PNG:
|
|
320
|
+
responseType = "blob";
|
|
321
|
+
break;
|
|
322
|
+
case Assets.JSON:
|
|
323
|
+
default: responseType = "json";
|
|
324
|
+
}
|
|
325
|
+
return responseType;
|
|
326
|
+
};
|
|
327
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
328
|
+
minVersion: "12.0.0",
|
|
329
|
+
version: "22.2.1",
|
|
330
|
+
ngImport: i0,
|
|
331
|
+
type: HttpService,
|
|
332
|
+
deps: [],
|
|
333
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
334
|
+
});
|
|
335
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
336
|
+
minVersion: "12.0.0",
|
|
337
|
+
version: "22.2.1",
|
|
338
|
+
ngImport: i0,
|
|
339
|
+
type: HttpService,
|
|
340
|
+
providedIn: "root"
|
|
341
|
+
});
|
|
342
|
+
};
|
|
343
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
344
|
+
minVersion: "12.0.0",
|
|
345
|
+
version: "22.2.1",
|
|
346
|
+
ngImport: i0,
|
|
347
|
+
type: HttpService,
|
|
348
|
+
decorators: [{
|
|
349
|
+
type: Injectable,
|
|
350
|
+
args: [{ providedIn: "root" }]
|
|
351
|
+
}]
|
|
352
|
+
});
|
|
353
|
+
function isJson(data) {
|
|
354
|
+
if (typeof data === "string") try {
|
|
355
|
+
JSON.parse(data);
|
|
356
|
+
} catch {
|
|
357
|
+
return false;
|
|
358
|
+
}
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
var StorageService = class StorageService {
|
|
362
|
+
setHeld(key, value, shelf = "local") {
|
|
363
|
+
const shelfStore = this.shelf(shelf);
|
|
364
|
+
if (value === void 0) {
|
|
365
|
+
shelfStore.removeItem(key);
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
shelfStore.setItem(key, JSON.stringify(value));
|
|
369
|
+
}
|
|
370
|
+
getHeld(key, shelf = "local") {
|
|
371
|
+
const raw = this.shelf(shelf).getItem(key);
|
|
372
|
+
if (raw === null) return void 0;
|
|
373
|
+
try {
|
|
374
|
+
return JSON.parse(raw);
|
|
375
|
+
} catch {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
shelf(shelf) {
|
|
380
|
+
return shelf === "session" ? sessionStorage : localStorage;
|
|
381
|
+
}
|
|
382
|
+
setSession(key, value) {
|
|
383
|
+
if (value) {
|
|
384
|
+
if (isJson(value)) sessionStorage.setItem(key, JSON.stringify(value));
|
|
385
|
+
else sessionStorage.setItem(key, String(value));
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
getSession(key) {
|
|
389
|
+
const data = sessionStorage.getItem(key);
|
|
390
|
+
if (data && isJson(data)) return JSON.parse(data);
|
|
391
|
+
else return data;
|
|
392
|
+
}
|
|
393
|
+
deleteSession(key) {
|
|
394
|
+
sessionStorage.removeItem(key);
|
|
395
|
+
}
|
|
396
|
+
setLocal(key, value) {
|
|
397
|
+
if (isJson(value)) localStorage.setItem(key, JSON.stringify(value));
|
|
398
|
+
else localStorage.setItem(key, String(value));
|
|
399
|
+
}
|
|
400
|
+
getLocal(key) {
|
|
401
|
+
const data = localStorage.getItem(key);
|
|
402
|
+
if (data && isJson(data)) return JSON.parse(data);
|
|
403
|
+
else return data;
|
|
404
|
+
}
|
|
405
|
+
deleteLocal(key) {
|
|
406
|
+
localStorage.removeItem(key);
|
|
407
|
+
}
|
|
408
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
409
|
+
minVersion: "12.0.0",
|
|
410
|
+
version: "22.2.1",
|
|
411
|
+
ngImport: i0,
|
|
412
|
+
type: StorageService,
|
|
413
|
+
deps: [],
|
|
414
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
415
|
+
});
|
|
416
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
417
|
+
minVersion: "12.0.0",
|
|
418
|
+
version: "22.2.1",
|
|
419
|
+
ngImport: i0,
|
|
420
|
+
type: StorageService,
|
|
421
|
+
providedIn: "root"
|
|
422
|
+
});
|
|
423
|
+
};
|
|
424
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
425
|
+
minVersion: "12.0.0",
|
|
426
|
+
version: "22.2.1",
|
|
427
|
+
ngImport: i0,
|
|
428
|
+
type: StorageService,
|
|
429
|
+
decorators: [{
|
|
430
|
+
type: Injectable,
|
|
431
|
+
args: [{ providedIn: "root" }]
|
|
432
|
+
}]
|
|
433
|
+
});
|
|
434
|
+
var SharedStoreRegistry = class {
|
|
435
|
+
static setNavStore(store) {
|
|
436
|
+
this.check();
|
|
437
|
+
if (!window.sharedStores.navStore) window.sharedStores.navStore = store;
|
|
438
|
+
}
|
|
439
|
+
static getNavStore() {
|
|
440
|
+
return window.sharedStores?.navStore;
|
|
441
|
+
}
|
|
442
|
+
static setLoginStore(store) {
|
|
443
|
+
this.check();
|
|
444
|
+
if (!window.sharedStores.loginStore) window.sharedStores.loginStore = store;
|
|
445
|
+
}
|
|
446
|
+
static getLoginStore() {
|
|
447
|
+
return window.sharedStores?.loginStore;
|
|
448
|
+
}
|
|
449
|
+
static setNotificationStore(store) {
|
|
450
|
+
this.check();
|
|
451
|
+
if (!window.sharedStores.notificationStore) window.sharedStores.notificationStore = store;
|
|
452
|
+
}
|
|
453
|
+
static getNotificationStore() {
|
|
454
|
+
return window.sharedStores?.notificationStore;
|
|
455
|
+
}
|
|
456
|
+
static setHostInjector(injector) {
|
|
457
|
+
this.check();
|
|
458
|
+
window.sharedStores.hostInjector = injector;
|
|
459
|
+
}
|
|
460
|
+
static getHostInjector() {
|
|
461
|
+
return window.sharedStores?.hostInjector;
|
|
462
|
+
}
|
|
463
|
+
static getThemeStore() {
|
|
464
|
+
return window.sharedStores?.themeStore;
|
|
465
|
+
}
|
|
466
|
+
static getTranslateService() {
|
|
467
|
+
return window.sharedStores?.translateService;
|
|
468
|
+
}
|
|
469
|
+
static setThemeStore(store) {
|
|
470
|
+
this.check();
|
|
471
|
+
window.sharedStores.themeStore = store;
|
|
472
|
+
}
|
|
473
|
+
static setTranslateService(service) {
|
|
474
|
+
this.check();
|
|
475
|
+
if (!window.sharedStores.translateService) window.sharedStores.translateService = service;
|
|
476
|
+
}
|
|
477
|
+
static setLoadingActions(actions) {
|
|
478
|
+
this.check();
|
|
479
|
+
if (!window.sharedStores.loadingActions) window.sharedStores.loadingActions = actions;
|
|
480
|
+
}
|
|
481
|
+
static getLoadingActions() {
|
|
482
|
+
return window.sharedStores?.loadingActions;
|
|
483
|
+
}
|
|
484
|
+
static setSocketUrl(url) {
|
|
485
|
+
this.check();
|
|
486
|
+
if (!window.sharedStores.socketUrl) window.sharedStores.socketUrl = url;
|
|
487
|
+
}
|
|
488
|
+
static isHostSocketActive() {
|
|
489
|
+
return !!window.sharedStores?.socketUrl;
|
|
490
|
+
}
|
|
491
|
+
static check() {
|
|
492
|
+
if (!window.sharedStores) window.sharedStores = {};
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
const STORAGE_KEY = "mag_assets";
|
|
496
|
+
const inferAssetType = (folder) => folder === "icons" ? Assets.SVG : Assets.JSON;
|
|
497
|
+
const AssetStore = signalStore({ providedIn: "root" }, withState({
|
|
498
|
+
map: {},
|
|
499
|
+
isCachingDisabled: false,
|
|
500
|
+
appLink: void 0,
|
|
501
|
+
hostBase: void 0
|
|
502
|
+
}), withMethods((store, http = inject(HttpService), storage = inject(StorageService)) => {
|
|
503
|
+
const pending = /* @__PURE__ */ new Map();
|
|
504
|
+
const buildKey = (ns, type, name) => `${ns}:${type}:${name}`;
|
|
505
|
+
const getCached = (ns, type, name) => store.map()[ns]?.[type]?.[name];
|
|
506
|
+
const setCached = (ns, type, name, value) => {
|
|
507
|
+
if (store.map()[ns]?.[type]?.[name] === value) return;
|
|
508
|
+
const updated = {
|
|
509
|
+
...store.map(),
|
|
510
|
+
[ns]: {
|
|
511
|
+
...store.map()[ns],
|
|
512
|
+
[type]: {
|
|
513
|
+
...store.map()[ns]?.[type],
|
|
514
|
+
[name]: value
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
patchState(store, { map: updated });
|
|
519
|
+
if (store.isCachingDisabled()) return;
|
|
520
|
+
try {
|
|
521
|
+
storage.setSession(STORAGE_KEY, updated);
|
|
522
|
+
} catch {}
|
|
523
|
+
};
|
|
524
|
+
return {
|
|
525
|
+
setAppLink: (appLink) => patchState(store, { appLink }),
|
|
526
|
+
setHostBase: (hostBase) => patchState(store, { hostBase }),
|
|
527
|
+
setCachingDisabled: (isDisabled) => patchState(store, { isCachingDisabled: isDisabled }),
|
|
528
|
+
resolve(type, name, isOne = false, remoteBaseUrl) {
|
|
529
|
+
const ns = isOne ? "one" : remoteBaseUrl ? `remote:${remoteBaseUrl}` : store.appLink() ?? "host";
|
|
530
|
+
const cached = getCached(ns, type, name);
|
|
531
|
+
if (cached !== void 0) return of(cached);
|
|
532
|
+
const key = buildKey(ns, type, name);
|
|
533
|
+
const existingPending = pending.get(key);
|
|
534
|
+
if (existingPending) return existingPending;
|
|
535
|
+
const assetType = inferAssetType(type);
|
|
536
|
+
const fetchFromHost = () => {
|
|
537
|
+
const hostNs = store.appLink() ?? "host";
|
|
538
|
+
const isEmbeddedInHost = !!SharedStoreRegistry.getHostInjector();
|
|
539
|
+
const baseUrl = remoteBaseUrl ?? (isEmbeddedInHost && store.appLink() ? http.buildWcAssetBaseUrl(store.appLink()) : void 0);
|
|
540
|
+
return http.asset([type, name], assetType, void 0, baseUrl).pipe(tap((value) => setCached(hostNs, type, name, value)));
|
|
541
|
+
};
|
|
542
|
+
let request$;
|
|
543
|
+
if (isOne) {
|
|
544
|
+
const oneTree = [
|
|
545
|
+
"one",
|
|
546
|
+
type,
|
|
547
|
+
name
|
|
548
|
+
];
|
|
549
|
+
request$ = http.asset(oneTree, assetType).pipe(tap((value) => setCached("one", type, name, value))).pipe(catchError((error) => {
|
|
550
|
+
if (!remoteBaseUrl) return fetchFromHost();
|
|
551
|
+
throw error;
|
|
552
|
+
}), catchError(() => {
|
|
553
|
+
if (remoteBaseUrl) {
|
|
554
|
+
const remoteNs = `remote:${remoteBaseUrl}`;
|
|
555
|
+
if (!store.isCachingDisabled()) {
|
|
556
|
+
const cached = getCached(remoteNs, type, name);
|
|
557
|
+
if (cached !== void 0) return of(cached);
|
|
558
|
+
}
|
|
559
|
+
return http.asset([type, name], assetType, void 0, remoteBaseUrl).pipe(tap((value) => setCached(remoteNs, type, name, value)));
|
|
560
|
+
}
|
|
561
|
+
return throwError(() => /* @__PURE__ */ new Error(`Asset not found: ${type}/${name}`));
|
|
562
|
+
}), shareReplay(1), finalize(() => pending.delete(key)));
|
|
563
|
+
} else request$ = fetchFromHost().pipe(shareReplay(1), finalize(() => pending.delete(key)));
|
|
564
|
+
pending.set(key, request$);
|
|
565
|
+
return request$;
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
}), withHooks({ onInit(store, storage = inject(StorageService)) {
|
|
569
|
+
const isLocal = typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname === "0.0.0.0");
|
|
570
|
+
patchState(store, { isCachingDisabled: isLocal });
|
|
571
|
+
if (!isLocal) {
|
|
572
|
+
const saved = storage.getSession(STORAGE_KEY);
|
|
573
|
+
if (saved) patchState(store, { map: saved });
|
|
574
|
+
}
|
|
575
|
+
} }));
|
|
576
|
+
const escapeHtml = (text) => text.replace(/&(?!#?\w+;)/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
577
|
+
const HEADING_RE = /^(#{1,6})\s+(.*)$/;
|
|
578
|
+
const QUOTE_RE = /^>\s?(.*)$/;
|
|
579
|
+
const LIST_RE = /^[ \t]*-[ \t]+(.*)$/;
|
|
580
|
+
const CONTINUATION_RE = /^[ \t]+(\S.*)$/;
|
|
581
|
+
const LINK_RE = /\[([^\]]*)\]\(([^)\s]+)\)/g;
|
|
582
|
+
const UNDERSCORE_BOLD_RE = /(?<!\w)__(.+?)__(?!\w)/g;
|
|
583
|
+
const UNDERSCORE_ITALIC_RE = /(?<!\w)_(.+?)_(?!\w)/g;
|
|
584
|
+
const TOKEN_RE = /\u0000(\d+)\u0000/g;
|
|
585
|
+
const CONTROL_RE = /[\u0000-\u001f\u007f]/g;
|
|
586
|
+
const SCHEME_RE = /^[a-z][a-z0-9+.-]*:/i;
|
|
587
|
+
const ALLOWED_SCHEME_RE = /^(?:https?|mailto|tel):/i;
|
|
588
|
+
const EXTERNAL_RE = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
589
|
+
const sanitizeUrl = (raw) => {
|
|
590
|
+
const url = raw.replace(CONTROL_RE, "").trim();
|
|
591
|
+
if (!url) return null;
|
|
592
|
+
if (SCHEME_RE.test(url) && !ALLOWED_SCHEME_RE.test(url)) return null;
|
|
593
|
+
return url.replace(/"/g, "%22");
|
|
594
|
+
};
|
|
595
|
+
const renderInline = (text, links) => {
|
|
596
|
+
let html = text.replace(LINK_RE, (match, label, url) => {
|
|
597
|
+
const href = sanitizeUrl(url);
|
|
598
|
+
if (!href) return match;
|
|
599
|
+
const rel = EXTERNAL_RE.test(href) ? " target=\"_blank\" rel=\"noopener noreferrer\"" : "";
|
|
600
|
+
links.push(`<a href="${href}"${rel}>${renderInline(label, links) || href}</a>`);
|
|
601
|
+
return `\u0000${links.length - 1}\u0000`;
|
|
602
|
+
});
|
|
603
|
+
html = html.replace(/\*\*(.+?)\*\*/g, (_, inner) => `<strong>${renderInline(inner, links)}</strong>`);
|
|
604
|
+
html = html.replace(UNDERSCORE_BOLD_RE, (_, inner) => `<strong>${renderInline(inner, links)}</strong>`);
|
|
605
|
+
html = html.replace(/~~(.+?)~~/g, (_, inner) => `<s>${renderInline(inner, links)}</s>`);
|
|
606
|
+
html = html.replace(/\*(.+?)\*/g, (_, inner) => `<em>${renderInline(inner, links)}</em>`);
|
|
607
|
+
html = html.replace(UNDERSCORE_ITALIC_RE, (_, inner) => `<em>${renderInline(inner, links)}</em>`);
|
|
608
|
+
return html;
|
|
609
|
+
};
|
|
610
|
+
const parseInline = (text) => {
|
|
611
|
+
const links = [];
|
|
612
|
+
return renderInline(text, links).replace(TOKEN_RE, (_, index) => links[Number(index)]);
|
|
613
|
+
};
|
|
614
|
+
function miniMarkToHtml(source) {
|
|
615
|
+
if (!source) return "";
|
|
616
|
+
const blocks = [];
|
|
617
|
+
let bufferType = null;
|
|
618
|
+
let buffer = [];
|
|
619
|
+
const renderGroup = (group) => group.map(parseInline).join("<br>");
|
|
620
|
+
const flush = () => {
|
|
621
|
+
if (bufferType && buffer.length) {
|
|
622
|
+
if (bufferType === "ul") blocks.push(`<ul>${buffer.map((group) => `<li>${renderGroup(group)}</li>`).join("")}</ul>`);
|
|
623
|
+
else {
|
|
624
|
+
const joined = buffer.map(renderGroup).join("<br>");
|
|
625
|
+
blocks.push(bufferType === "p" ? `<p>${joined}</p>` : `<blockquote>${joined}</blockquote>`);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
bufferType = null;
|
|
629
|
+
buffer = [];
|
|
630
|
+
};
|
|
631
|
+
for (const rawLine of source.replace(/\r\n?/g, "\n").split("\n")) {
|
|
632
|
+
if (!rawLine.trim()) {
|
|
633
|
+
flush();
|
|
634
|
+
continue;
|
|
635
|
+
}
|
|
636
|
+
const heading = HEADING_RE.exec(rawLine);
|
|
637
|
+
if (heading) {
|
|
638
|
+
flush();
|
|
639
|
+
const level = heading[1].length;
|
|
640
|
+
blocks.push(`<h${level}>${parseInline(escapeHtml(heading[2]))}</h${level}>`);
|
|
641
|
+
continue;
|
|
642
|
+
}
|
|
643
|
+
const quote = QUOTE_RE.exec(rawLine);
|
|
644
|
+
if (quote) {
|
|
645
|
+
if (bufferType !== "blockquote") flush();
|
|
646
|
+
bufferType = "blockquote";
|
|
647
|
+
buffer.push([escapeHtml(quote[1])]);
|
|
648
|
+
continue;
|
|
649
|
+
}
|
|
650
|
+
const item = LIST_RE.exec(rawLine);
|
|
651
|
+
if (item) {
|
|
652
|
+
if (bufferType !== "ul") flush();
|
|
653
|
+
bufferType = "ul";
|
|
654
|
+
buffer.push([escapeHtml(item[1])]);
|
|
655
|
+
continue;
|
|
656
|
+
}
|
|
657
|
+
const continuation = bufferType === "ul" && buffer.length ? CONTINUATION_RE.exec(rawLine) : null;
|
|
658
|
+
if (continuation) {
|
|
659
|
+
buffer[buffer.length - 1].push(escapeHtml(continuation[1]));
|
|
660
|
+
continue;
|
|
661
|
+
}
|
|
662
|
+
if (bufferType !== "p") flush();
|
|
663
|
+
bufferType = "p";
|
|
664
|
+
buffer.push([escapeHtml(rawLine)]);
|
|
665
|
+
}
|
|
666
|
+
flush();
|
|
667
|
+
return blocks.join("");
|
|
668
|
+
}
|
|
669
|
+
const COUNTRY = /^[A-Z]{2}$/;
|
|
670
|
+
const parseTag = (tag) => {
|
|
671
|
+
const [language, region] = (tag ?? "").split("-");
|
|
672
|
+
const country = region?.toUpperCase();
|
|
673
|
+
return {
|
|
674
|
+
language: language ? language.toLowerCase() : void 0,
|
|
675
|
+
country: country && COUNTRY.test(country) ? country : null
|
|
676
|
+
};
|
|
677
|
+
};
|
|
678
|
+
const browserLocale = (nav = typeof navigator === "undefined" ? void 0 : navigator) => {
|
|
679
|
+
const primary = parseTag(nav?.language);
|
|
680
|
+
if (primary.country) return primary;
|
|
681
|
+
const country = (nav?.languages ?? []).map(parseTag).find((locale) => locale.country)?.country ?? null;
|
|
682
|
+
return {
|
|
683
|
+
language: primary.language,
|
|
684
|
+
country
|
|
685
|
+
};
|
|
686
|
+
};
|
|
687
|
+
var BrowserLocaleService = class BrowserLocaleService {
|
|
688
|
+
current = signal(browserLocale(), ...ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []);
|
|
689
|
+
locale = this.current.asReadonly();
|
|
690
|
+
constructor() {
|
|
691
|
+
if (typeof window === "undefined") return;
|
|
692
|
+
const handler = () => this.current.set(browserLocale());
|
|
693
|
+
window.addEventListener("languagechange", handler);
|
|
694
|
+
inject(DestroyRef).onDestroy(() => window.removeEventListener("languagechange", handler));
|
|
695
|
+
}
|
|
696
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
697
|
+
minVersion: "12.0.0",
|
|
698
|
+
version: "22.2.1",
|
|
699
|
+
ngImport: i0,
|
|
700
|
+
type: BrowserLocaleService,
|
|
701
|
+
deps: [],
|
|
702
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
703
|
+
});
|
|
704
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
705
|
+
minVersion: "12.0.0",
|
|
706
|
+
version: "22.2.1",
|
|
707
|
+
ngImport: i0,
|
|
708
|
+
type: BrowserLocaleService,
|
|
709
|
+
providedIn: "root"
|
|
710
|
+
});
|
|
711
|
+
};
|
|
712
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
713
|
+
minVersion: "12.0.0",
|
|
714
|
+
version: "22.2.1",
|
|
715
|
+
ngImport: i0,
|
|
716
|
+
type: BrowserLocaleService,
|
|
717
|
+
decorators: [{
|
|
718
|
+
type: Injectable,
|
|
719
|
+
args: [{ providedIn: "root" }]
|
|
720
|
+
}],
|
|
721
|
+
ctorParameters: () => []
|
|
722
|
+
});
|
|
723
|
+
const FALLBACK_LANG = "en";
|
|
724
|
+
var TranslateService = class TranslateService {
|
|
725
|
+
browserLocale = inject(BrowserLocaleService).locale;
|
|
726
|
+
picked = false;
|
|
727
|
+
lang = linkedSignal({
|
|
728
|
+
...ngDevMode ? { debugName: "lang" } : /* istanbul ignore next */ {},
|
|
729
|
+
source: () => this.browserLocale().language,
|
|
730
|
+
computation: (language, previous) => this.picked && previous ? previous.value : language ?? "en"
|
|
731
|
+
});
|
|
732
|
+
path = signal(["i18n"], {
|
|
733
|
+
...ngDevMode ? { debugName: "path" } : /* istanbul ignore next */ {},
|
|
734
|
+
equal: (a, b) => {
|
|
735
|
+
if (a === b) return true;
|
|
736
|
+
if (!a || !b || a.length !== b.length) return false;
|
|
737
|
+
return a.every((v, i) => v === b[i]);
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
country = computed(() => this.browserLocale().country, ...ngDevMode ? [{ debugName: "country" }] : /* istanbul ignore next */ []);
|
|
741
|
+
remoteAppId = signal(void 0, ...ngDevMode ? [{ debugName: "remoteAppId" }] : /* istanbul ignore next */ []);
|
|
742
|
+
remoteFallbackLang = signal(void 0, ...ngDevMode ? [{ debugName: "remoteFallbackLang" }] : /* istanbul ignore next */ []);
|
|
743
|
+
httpService = inject(HttpService);
|
|
744
|
+
assetStore = inject(AssetStore);
|
|
745
|
+
mountedApps = signal({}, ...ngDevMode ? [{ debugName: "mountedApps" }] : /* istanbul ignore next */ []);
|
|
746
|
+
mountRemoteApp = (link) => this.mountedApps.update((apps) => ({
|
|
747
|
+
...apps,
|
|
748
|
+
[link]: (apps[link] ?? 0) + 1
|
|
749
|
+
}));
|
|
750
|
+
unmountRemoteApp = (link) => this.mountedApps.update(({ [link]: count = 0, ...rest }) => count > 1 ? {
|
|
751
|
+
...rest,
|
|
752
|
+
[link]: count - 1
|
|
753
|
+
} : rest);
|
|
754
|
+
remoteAppIds = computed(() => [.../* @__PURE__ */ new Set([...this.remoteAppId() ? [this.remoteAppId()] : [], ...Object.keys(this.mountedApps())])], {
|
|
755
|
+
...ngDevMode ? { debugName: "remoteAppIds" } : /* istanbul ignore next */ {},
|
|
756
|
+
equal: (a, b) => a.length === b.length && a.every((v, i) => v === b[i])
|
|
757
|
+
});
|
|
758
|
+
remoteTranslation = rxResource({
|
|
759
|
+
params: () => ({
|
|
760
|
+
lang: this.lang(),
|
|
761
|
+
appIds: this.remoteAppIds(),
|
|
762
|
+
fallback: this.remoteFallbackLang()
|
|
763
|
+
}),
|
|
764
|
+
stream: ({ params: { lang, appIds, fallback } }) => {
|
|
765
|
+
if (!appIds.length) return of({});
|
|
766
|
+
const bundle = (appId, name) => this.httpService.asset(["i18n", name], Assets.JSON, void 0, this.httpService.buildWcAssetBaseUrl(appId));
|
|
767
|
+
return forkJoin(appIds.map((appId) => bundle(appId, lang).pipe(catchError(() => fallback && fallback !== lang ? bundle(appId, fallback).pipe(catchError(() => of({}))) : of({}))))).pipe(map((bundles) => Object.assign({}, ...bundles)));
|
|
768
|
+
}
|
|
769
|
+
});
|
|
770
|
+
langs = rxResource({
|
|
771
|
+
params: this.path,
|
|
772
|
+
stream: ({ params }) => this.assetStore.resolve((params ?? ["i18n"]).join("/"), "lang", true).pipe(catchError(() => of({ langs: {} })))
|
|
773
|
+
});
|
|
774
|
+
allLangs = computed(() => this.langs.value()?.langs ?? {}, ...ngDevMode ? [{ debugName: "allLangs" }] : /* istanbul ignore next */ []);
|
|
775
|
+
countryLangSource = rxResource({
|
|
776
|
+
params: () => ({
|
|
777
|
+
country: this.country(),
|
|
778
|
+
path: this.path()
|
|
779
|
+
}),
|
|
780
|
+
stream: ({ params: { country, path } }) => country ? this.assetStore.resolve((path ?? []).join("/"), `country-${country}`, true).pipe(catchError(() => [])) : of([])
|
|
781
|
+
});
|
|
782
|
+
countryLangs = computed(() => {
|
|
783
|
+
const countryLangs = {};
|
|
784
|
+
for (const [key, value] of Object.entries(this.allLangs())) if (this.countryLangSource.value()?.includes(key)) countryLangs[key] = value;
|
|
785
|
+
return countryLangs;
|
|
786
|
+
}, ...ngDevMode ? [{ debugName: "countryLangs" }] : /* istanbul ignore next */ []);
|
|
787
|
+
translation = rxResource({
|
|
788
|
+
params: () => ({
|
|
789
|
+
lang: this.lang(),
|
|
790
|
+
path: this.path(),
|
|
791
|
+
remote: this.remoteTranslation.value()
|
|
792
|
+
}),
|
|
793
|
+
stream: ({ params: { path, lang, remote } }) => forkJoin([lang === FALLBACK_LANG ? of([{}, {}]) : this.fetchTranslations([...path ?? [], FALLBACK_LANG]), this.fetchTranslations([...path ?? [], lang])]).pipe(map((results) => {
|
|
794
|
+
const [[enOne = {}, enProject = {}], [one = {}, project = {}]] = results;
|
|
795
|
+
return {
|
|
796
|
+
...enOne,
|
|
797
|
+
...enProject,
|
|
798
|
+
...one,
|
|
799
|
+
...project,
|
|
800
|
+
...remote
|
|
801
|
+
};
|
|
802
|
+
}))
|
|
803
|
+
});
|
|
804
|
+
translations$ = toObservable(this.translation.value);
|
|
805
|
+
translationSource = inject(TRANSLATION_SOURCE, { optional: true });
|
|
806
|
+
mergedTranslations = computed(() => ({
|
|
807
|
+
...this.translation.value() ?? {},
|
|
808
|
+
...this.translationSource?.() ?? {}
|
|
809
|
+
}), ...ngDevMode ? [{ debugName: "mergedTranslations" }] : /* istanbul ignore next */ []);
|
|
810
|
+
libraryTranslation = rxResource({
|
|
811
|
+
params: () => ({
|
|
812
|
+
lang: this.lang(),
|
|
813
|
+
path: this.path()
|
|
814
|
+
}),
|
|
815
|
+
stream: ({ params: { lang, path } }) => this.assetStore.resolve((path ?? []).join("/"), lang, true).pipe(catchError(() => of({})))
|
|
816
|
+
});
|
|
817
|
+
libraryKeys = computed(() => new Set(Object.keys(this.libraryTranslation.value() ?? {})), ...ngDevMode ? [{ debugName: "libraryKeys" }] : /* istanbul ignore next */ []);
|
|
818
|
+
links = rxResource({
|
|
819
|
+
params: this.path,
|
|
820
|
+
stream: ({ params }) => this.fetchTranslations([...params, "links"]).pipe(map((result) => {
|
|
821
|
+
const [one = {}, project = {}] = result;
|
|
822
|
+
return {
|
|
823
|
+
...one?.["links"],
|
|
824
|
+
...project?.["links"]
|
|
825
|
+
};
|
|
826
|
+
}))
|
|
827
|
+
});
|
|
828
|
+
setLang(lang) {
|
|
829
|
+
this.picked = true;
|
|
830
|
+
if (lang !== this.lang()) this.lang.set(lang);
|
|
831
|
+
}
|
|
832
|
+
translate = (value, config) => {
|
|
833
|
+
if (value == null) return "";
|
|
834
|
+
if (typeof value === "number") return value.toString();
|
|
835
|
+
if (typeof value === "boolean") value = String(value);
|
|
836
|
+
else if (typeof value !== "string") return "";
|
|
837
|
+
const { key, params } = this.parseTranslationKey(value);
|
|
838
|
+
const translations = this.mergedTranslations();
|
|
839
|
+
const result = key.split(".").reduce((obj, keyPart) => typeof obj === "object" && obj !== null ? obj?.[keyPart] ?? "" : obj, translations);
|
|
840
|
+
const mergedParams = {
|
|
841
|
+
...params,
|
|
842
|
+
...config ?? {}
|
|
843
|
+
};
|
|
844
|
+
if (typeof result === "string" && result) {
|
|
845
|
+
const textWithParams = this.replacePlaceholders(result, mergedParams);
|
|
846
|
+
return this.addLink(textWithParams, config);
|
|
847
|
+
}
|
|
848
|
+
const directTranslation = this.replacePlaceholders(key, mergedParams);
|
|
849
|
+
return this.addLink(directTranslation, config);
|
|
850
|
+
};
|
|
851
|
+
translateToHtml = (value, config) => {
|
|
852
|
+
const translatedText = this.translate(value, config);
|
|
853
|
+
return translatedText ? miniMarkToHtml(translatedText) : "";
|
|
854
|
+
};
|
|
855
|
+
init(path = ["i18n"]) {
|
|
856
|
+
this.path.set(path);
|
|
857
|
+
}
|
|
858
|
+
parseTranslationKey(value) {
|
|
859
|
+
if (!value.includes("?")) return {
|
|
860
|
+
key: value,
|
|
861
|
+
params: {}
|
|
862
|
+
};
|
|
863
|
+
const [key, queryString] = value.split("?");
|
|
864
|
+
const params = {};
|
|
865
|
+
new URLSearchParams(queryString).forEach((val, paramKey) => {
|
|
866
|
+
params[paramKey] = val;
|
|
867
|
+
});
|
|
868
|
+
return {
|
|
869
|
+
key,
|
|
870
|
+
params
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
replacePlaceholders(text, params) {
|
|
874
|
+
return text.replace(/<(\$?)(\w+)>/g, (match, dollar, placeholder) => {
|
|
875
|
+
const value = params[placeholder];
|
|
876
|
+
if (!Object.prototype.hasOwnProperty.call(params, placeholder)) return match;
|
|
877
|
+
const resolved = dollar ? this.translateParameterValue(value) : value;
|
|
878
|
+
return this.escapeParam(resolved);
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
escapeParam(text) {
|
|
882
|
+
return this.escapeHtml(text).replace(/\*/g, "*").replace(/_/g, "_").replace(/~/g, "~").replace(/\[/g, "[").replace(/\]/g, "]");
|
|
883
|
+
}
|
|
884
|
+
translateParameterValue(value) {
|
|
885
|
+
if (!value) return value;
|
|
886
|
+
const translations = this.mergedTranslations();
|
|
887
|
+
const result = value.split(".").reduce((obj, keyPart) => typeof obj === "object" && obj !== null ? obj?.[keyPart] : obj, translations);
|
|
888
|
+
return typeof result === "string" && result ? result : value;
|
|
889
|
+
}
|
|
890
|
+
fetchTranslations(path) {
|
|
891
|
+
const type = path.slice(0, -1).join("/");
|
|
892
|
+
const name = path[path.length - 1];
|
|
893
|
+
return forkJoin([this.assetStore.resolve(type, name, true).pipe(catchError(() => of({}))), this.assetStore.resolve(type, name).pipe(catchError(() => of({})))]).pipe(catchError(() => of([{}, {}])));
|
|
894
|
+
}
|
|
895
|
+
formatDate(date) {
|
|
896
|
+
return `${this.translate(`day.${date.getDay()}`)} ${date.getDate()} ${this.translate(`month.${date.getMonth()}`)},${date.getFullYear()}`;
|
|
897
|
+
}
|
|
898
|
+
toReadableTime(date) {
|
|
899
|
+
return this.formatDate(new Date(date));
|
|
900
|
+
}
|
|
901
|
+
getLink(key) {
|
|
902
|
+
return this.links.value()?.[key] ?? "";
|
|
903
|
+
}
|
|
904
|
+
applyRule(text, type) {
|
|
905
|
+
return type === "date" ? this.toReadableTime(text) : text;
|
|
906
|
+
}
|
|
907
|
+
processLinkContent(content, config) {
|
|
908
|
+
if (content.includes("~")) {
|
|
909
|
+
const [text, linkKey] = content.split("~");
|
|
910
|
+
const displayText = text.startsWith("$") && config[text] ? this.translate(config[text]) : text;
|
|
911
|
+
const link = this.getLink(linkKey) ?? config[linkKey];
|
|
912
|
+
const sanitizedLink = link ? this.sanitizeUrl(link) : null;
|
|
913
|
+
return sanitizedLink ? `<a href="${sanitizedLink}">${this.escapeHtml(displayText)}</a>` : this.escapeHtml(displayText);
|
|
914
|
+
}
|
|
915
|
+
if (content.includes("%")) {
|
|
916
|
+
const [key, type] = content.split("%");
|
|
917
|
+
return this.escapeHtml(this.applyRule(config[key], type));
|
|
918
|
+
}
|
|
919
|
+
if (content.includes("@")) {
|
|
920
|
+
const [text, alt] = content.split("@");
|
|
921
|
+
const displayText = text.startsWith("$") && config[text] ? this.translate(config[text]) : text;
|
|
922
|
+
return `<a alt="${this.escapeHtml(alt)}">${this.escapeHtml(displayText)}</a>`;
|
|
923
|
+
}
|
|
924
|
+
if (content.startsWith("$")) {
|
|
925
|
+
const param = config[content] ?? config[content.substring(1)];
|
|
926
|
+
if (param === void 0) return `<${content}>`;
|
|
927
|
+
return this.escapeHtml(this.translate(param));
|
|
928
|
+
}
|
|
929
|
+
return `<${content}>`;
|
|
930
|
+
}
|
|
931
|
+
addLink = (text, config = {}) => {
|
|
932
|
+
return text.replace(/<.+?>/g, (elem) => this.processLinkContent(elem.slice(1, -1), config));
|
|
933
|
+
};
|
|
934
|
+
toSafeHtml = (text) => miniMarkToHtml(text);
|
|
935
|
+
escapeHtml(text) {
|
|
936
|
+
const div = document.createElement("div");
|
|
937
|
+
div.textContent = text;
|
|
938
|
+
return div.innerHTML;
|
|
939
|
+
}
|
|
940
|
+
sanitizeUrl(url) {
|
|
941
|
+
const trimmedUrl = url.trim().toLowerCase();
|
|
942
|
+
if ([
|
|
943
|
+
"javascript:",
|
|
944
|
+
"data:",
|
|
945
|
+
"vbscript:",
|
|
946
|
+
"file:"
|
|
947
|
+
].some((protocol) => trimmedUrl.startsWith(protocol))) return "#";
|
|
948
|
+
if (trimmedUrl.startsWith("http:/") || trimmedUrl.startsWith("https:/") || trimmedUrl.startsWith("mailto:") || trimmedUrl.startsWith("/") || trimmedUrl.startsWith("#") || trimmedUrl.startsWith(".")) return url;
|
|
949
|
+
if (!trimmedUrl.includes(":")) return url;
|
|
950
|
+
return "#";
|
|
951
|
+
}
|
|
952
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
953
|
+
minVersion: "12.0.0",
|
|
954
|
+
version: "22.2.1",
|
|
955
|
+
ngImport: i0,
|
|
956
|
+
type: TranslateService,
|
|
957
|
+
deps: [],
|
|
958
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
959
|
+
});
|
|
960
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
961
|
+
minVersion: "12.0.0",
|
|
962
|
+
version: "22.2.1",
|
|
963
|
+
ngImport: i0,
|
|
964
|
+
type: TranslateService,
|
|
965
|
+
providedIn: "root"
|
|
966
|
+
});
|
|
967
|
+
};
|
|
968
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
969
|
+
minVersion: "12.0.0",
|
|
970
|
+
version: "22.2.1",
|
|
971
|
+
ngImport: i0,
|
|
972
|
+
type: TranslateService,
|
|
973
|
+
decorators: [{
|
|
974
|
+
type: Injectable,
|
|
975
|
+
args: [{ providedIn: "root" }]
|
|
976
|
+
}]
|
|
977
|
+
});
|
|
978
|
+
var TranslatePipe = class TranslatePipe {
|
|
979
|
+
translateService = inject(TranslateService);
|
|
980
|
+
transform(value, config) {
|
|
981
|
+
if (value == null || value === "") return "";
|
|
982
|
+
return this.translateService.translate(value, config);
|
|
983
|
+
}
|
|
984
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
985
|
+
minVersion: "12.0.0",
|
|
986
|
+
version: "22.2.1",
|
|
987
|
+
ngImport: i0,
|
|
988
|
+
type: TranslatePipe,
|
|
989
|
+
deps: [],
|
|
990
|
+
target: i0.ɵɵFactoryTarget.Pipe
|
|
991
|
+
});
|
|
992
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({
|
|
993
|
+
minVersion: "14.0.0",
|
|
994
|
+
version: "22.2.1",
|
|
995
|
+
ngImport: i0,
|
|
996
|
+
type: TranslatePipe,
|
|
997
|
+
isStandalone: true,
|
|
998
|
+
name: "translate",
|
|
999
|
+
pure: false
|
|
1000
|
+
});
|
|
1001
|
+
};
|
|
1002
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1003
|
+
minVersion: "12.0.0",
|
|
1004
|
+
version: "22.2.1",
|
|
1005
|
+
ngImport: i0,
|
|
1006
|
+
type: TranslatePipe,
|
|
1007
|
+
decorators: [{
|
|
1008
|
+
type: Pipe,
|
|
1009
|
+
args: [{
|
|
1010
|
+
name: "translate",
|
|
1011
|
+
pure: false
|
|
1012
|
+
}]
|
|
1013
|
+
}]
|
|
1014
|
+
});
|
|
1015
|
+
const SIZE_LENGTH = {
|
|
1016
|
+
[Size.SMALL]: "0.75rem",
|
|
1017
|
+
[Size.MEDIUM]: "1rem",
|
|
1018
|
+
[Size.LARGE]: "1.5rem"
|
|
1019
|
+
};
|
|
1020
|
+
function resolveSize(size) {
|
|
1021
|
+
return SIZE_LENGTH[isSize(size) ? size : DEFAULT_SIZE];
|
|
1022
|
+
}
|
|
1023
|
+
function isSize(value) {
|
|
1024
|
+
return value === Size.SMALL || value === Size.MEDIUM || value === Size.LARGE;
|
|
1025
|
+
}
|
|
1026
|
+
function coerceSize(...candidates) {
|
|
1027
|
+
for (const candidate of candidates) if (isSize(candidate)) return candidate;
|
|
1028
|
+
return DEFAULT_SIZE;
|
|
1029
|
+
}
|
|
1030
|
+
function toLength(value, isNone) {
|
|
1031
|
+
if (value === void 0 || value === null || value === "") return isNone ? "none" : "0";
|
|
1032
|
+
return typeof value === "number" ? `${value}em` : value;
|
|
1033
|
+
}
|
|
1034
|
+
function resolveIconSize(override, contextSize) {
|
|
1035
|
+
if (override === void 0 || override === null || override === "") return `calc(${resolveSize(contextSize)} * 1.1)`;
|
|
1036
|
+
if (typeof override === "number") return `${override}em`;
|
|
1037
|
+
const trimmed = override.trim();
|
|
1038
|
+
if (trimmed === "") return `calc(${resolveSize(contextSize)} * 1.1)`;
|
|
1039
|
+
if (/^\d+(\.\d+)?$/.test(trimmed)) return `${trimmed}em`;
|
|
1040
|
+
return trimmed;
|
|
1041
|
+
}
|
|
1042
|
+
function toCssLength(value) {
|
|
1043
|
+
if (value === void 0 || value === null) return void 0;
|
|
1044
|
+
if (typeof value === "number") return `${value}px`;
|
|
1045
|
+
const trimmed = value.trim();
|
|
1046
|
+
if (trimmed === "") return void 0;
|
|
1047
|
+
return /^\d+(\.\d+)?$/.test(trimmed) ? `${trimmed}px` : trimmed;
|
|
1048
|
+
}
|
|
1049
|
+
const toSpacingValue = (value) => {
|
|
1050
|
+
if (typeof value !== "string") return value;
|
|
1051
|
+
const trimmed = value.trim();
|
|
1052
|
+
if (trimmed === "" || Number.isNaN(Number(trimmed))) return value;
|
|
1053
|
+
return Number(trimmed);
|
|
1054
|
+
};
|
|
1055
|
+
function resolveSpacing(value) {
|
|
1056
|
+
return value === void 0 || value === null || value === "" ? void 0 : toLength(toSpacingValue(value));
|
|
1057
|
+
}
|
|
1058
|
+
export { WC_BUNDLE as $, isUrlLocalhost as A, IS_DESIGN_MODE as B, setWcLocalPort as C, getTierFromPreviewPath as D, wcTierOf as E, AppAvailability as F, MODAL_STORE_REF as G, LOADING_ACTIONS_REF as H, AppRelationType as I, OPTIONS_SOURCE as J, NAV_STORE_REF as K, COMPONENT_INPUT_REGISTRY as L, APP_CONTEXT_REF as M, APP_LINK as N, isLocalhost as O, ASSET_BASE_URL as P, USER_STORE_REF as Q, FOLDER_PICK_LISTENER as R, recordDefinedWcTier as S, wcLocalBaseOf as T, LOGIN_COMPONENT as U, IS_SIDE_PANEL as V, LOGIN_STORE as W, SEARCH_RESULTS_EVENT as X, SEARCH_QUERY as Y, TRANSLATION_SOURCE as Z, ACCESS_DOMAINS as _, resolveSpacing as a, Size as at, definedWcBundleOf as b, TranslatePipe as c, browserLocale as d, WC_SEARCH_GROUPS as et, miniMarkToHtml as f, isJson as g, StorageService as h, resolveSize as i, DEFAULT_SIZE as it, isWebComponent as j, isTierPreview as k, TranslateService as l, SharedStoreRegistry as m, isSize as n, LAYOUT_ASSET_FOLDER as nt, toCssLength as o, AssetStore as p, ONE_ASSET_BASE_URL as q, resolveIconSize as r, Assets as rt, toLength as s, coerceSize as t, FORM_ASSET_FOLDER as tt, BrowserLocaleService as u, HttpService as v, setWcTier as w, definedWcTierOf as x, buildWcBaseUrl as y, ICON_SOURCE as z };
|
|
1059
|
+
|
|
1060
|
+
//# sourceMappingURL=magmonium-one-size-converter-BfT0Aw0g.mjs.map
|