intlayer-editor 8.4.8 → 8.4.9
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/client/dist/assets/{CodeBlockShiki-CBpFC0wa.js → CodeBlockShiki-67WBbfIc.js} +1 -1
- package/client/dist/assets/{index-3RB3SZoe.js → index-Bp3XDFNZ.js} +105 -55
- package/client/dist/assets/{markdown-BRt2VivO.js → markdown-B_VAQu_B.js} +6 -2
- package/client/dist/assets/{markdown-CKVmpT1j.js → markdown-CTJeKACB.js} +2 -2
- package/client/dist/index.html +2 -2
- package/package.json +12 -12
- package/server/dist/controllers/dictionary.controller.cjs +5 -1
- package/server/dist/controllers/dictionary.controller.cjs.map +1 -1
- package/server/dist/controllers/dictionary.controller.mjs +5 -1
- package/server/dist/controllers/dictionary.controller.mjs.map +1 -1
|
@@ -3,7 +3,7 @@ import { a as __toESM } from "./chunk-C0u3WHrm.js";
|
|
|
3
3
|
import { t as require_react } from "./react-BI_C_976.js";
|
|
4
4
|
import { t as require_jsx_runtime } from "./jsx-runtime-BkWmzJHO.js";
|
|
5
5
|
import { t as __vitePreload } from "./preload-helper-B4JcPOPd.js";
|
|
6
|
-
import { t as CodeDefault } from "./index-
|
|
6
|
+
import { t as CodeDefault } from "./index-Bp3XDFNZ.js";
|
|
7
7
|
//#region ../@intlayer/design-system/dist/esm/components/IDE/CodeBlockShiki.mjs
|
|
8
8
|
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
9
9
|
var import_jsx_runtime = require_jsx_runtime();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/markdown-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/markdown-B_VAQu_B.js","assets/chunk-C0u3WHrm.js","assets/markdown-CTJeKACB.js","assets/html-CC2iD1GB.js","assets/react-BI_C_976.js","assets/CodeBlockShiki-67WBbfIc.js","assets/preload-helper-B4JcPOPd.js","assets/jsx-runtime-BkWmzJHO.js","assets/dist-B9LA40uC.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import { a as __toESM, i as __toCommonJS, n as __esmMin, r as __exportAll, t as __commonJSMin } from "./chunk-C0u3WHrm.js";
|
|
3
3
|
import { t as require_react } from "./react-BI_C_976.js";
|
|
4
4
|
import { t as require_jsx_runtime } from "./jsx-runtime-BkWmzJHO.js";
|
|
5
5
|
import { t as __vitePreload } from "./preload-helper-B4JcPOPd.js";
|
|
6
|
-
import { n as compile } from "./markdown-
|
|
6
|
+
import { n as compile } from "./markdown-B_VAQu_B.js";
|
|
7
7
|
//#region \0vite/modulepreload-polyfill.js
|
|
8
8
|
(function polyfill() {
|
|
9
9
|
const relList = document.createElement("link").relList;
|
|
@@ -9570,7 +9570,7 @@ var configuration_default = {
|
|
|
9570
9570
|
},
|
|
9571
9571
|
metadata: {
|
|
9572
9572
|
"name": "Intlayer",
|
|
9573
|
-
"version": "8.4.
|
|
9573
|
+
"version": "8.4.9",
|
|
9574
9574
|
"doc": "https://intlayer.org/docs"
|
|
9575
9575
|
}
|
|
9576
9576
|
};
|
|
@@ -10275,10 +10275,10 @@ var splitInsertionTemplate = (template, values = {}) => {
|
|
|
10275
10275
|
//#endregion
|
|
10276
10276
|
//#region ../react-intlayer/dist/esm/plugins.mjs
|
|
10277
10277
|
var _getMarkdownMetadata = null;
|
|
10278
|
-
__vitePreload(() => import("./markdown-
|
|
10278
|
+
__vitePreload(() => import("./markdown-B_VAQu_B.js").then((n) => n.t).then((m) => {
|
|
10279
10279
|
_getMarkdownMetadata = m.getMarkdownMetadata;
|
|
10280
10280
|
}), __vite__mapDeps([0,1]));
|
|
10281
|
-
var LazyMarkdownRendererPlugin = (0, import_react.lazy)(() => __vitePreload(() => import("./markdown-
|
|
10281
|
+
var LazyMarkdownRendererPlugin = (0, import_react.lazy)(() => __vitePreload(() => import("./markdown-CTJeKACB.js").then((m) => ({ default: m.MarkdownRendererPlugin })), __vite__mapDeps([2,1,0])));
|
|
10282
10282
|
var LazyHTMLRendererPlugin = (0, import_react.lazy)(() => __vitePreload(() => import("./html-CC2iD1GB.js").then((m) => ({ default: m.HTMLRendererPlugin })), __vite__mapDeps([3,1,4])));
|
|
10283
10283
|
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
10284
10284
|
var intlayerNodePlugins = {
|
|
@@ -28355,7 +28355,7 @@ var CodeDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
28355
28355
|
}, `line-${index}-${line.slice(0, 10)}`)) : children })
|
|
28356
28356
|
})
|
|
28357
28357
|
});
|
|
28358
|
-
var CodeBlockShiki = (0, import_react.lazy)(() => __vitePreload(() => import("./CodeBlockShiki-
|
|
28358
|
+
var CodeBlockShiki = (0, import_react.lazy)(() => __vitePreload(() => import("./CodeBlockShiki-67WBbfIc.js").then((mod) => ({ default: mod.CodeBlockShiki })), __vite__mapDeps([5,1,6,7,4])));
|
|
28359
28359
|
var CodeBlock = ({ className, onChange, isEditable, children, lang, isDarkMode, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
28360
28360
|
className: cn$2("flex w-full min-w-0 max-w-full overflow-x-auto", className),
|
|
28361
28361
|
...props,
|
|
@@ -42679,6 +42679,9 @@ var Modal = ({ children, isOpen, container, onClose, hasCloseButton = false, tit
|
|
|
42679
42679
|
};
|
|
42680
42680
|
//#endregion
|
|
42681
42681
|
//#region ../@intlayer/design-system/dist/esm/components/Table/Table.mjs
|
|
42682
|
+
var CHAR_WIDTH_REM = .55;
|
|
42683
|
+
var MIN_WIDTH_REM = 5;
|
|
42684
|
+
var MAX_WIDTH_REM = 30;
|
|
42682
42685
|
/**
|
|
42683
42686
|
* Table component that provides an enhanced table experience with modal expansion and collapsible content
|
|
42684
42687
|
*
|
|
@@ -42818,8 +42821,39 @@ var Modal = ({ children, isOpen, container, onClose, hasCloseButton = false, tit
|
|
|
42818
42821
|
*/
|
|
42819
42822
|
var Table = ({ className, isRollable = false, displayModal, ...props }) => {
|
|
42820
42823
|
const [isModalOpen, setIsModalOpen] = (0, import_react.useState)(false);
|
|
42824
|
+
const tableRef = (0, import_react.useRef)(null);
|
|
42825
|
+
const modalTableRef = (0, import_react.useRef)(null);
|
|
42826
|
+
(0, import_react.useEffect)(() => {
|
|
42827
|
+
if (!tableRef.current) return;
|
|
42828
|
+
const colLengths = [];
|
|
42829
|
+
Array.from(tableRef.current.querySelectorAll("tr")).forEach((row) => {
|
|
42830
|
+
Array.from(row.children).forEach((cell, index) => {
|
|
42831
|
+
const len = cell.textContent?.trim().length ?? 0;
|
|
42832
|
+
if (colLengths[index] === void 0 || len > colLengths[index]) colLengths[index] = len;
|
|
42833
|
+
});
|
|
42834
|
+
});
|
|
42835
|
+
const applyToTable = (table) => {
|
|
42836
|
+
const rows = Array.from(table.querySelectorAll("tr"));
|
|
42837
|
+
if (rows.length === 0) return;
|
|
42838
|
+
const applyColStyle = (el, index) => {
|
|
42839
|
+
const minRem = Math.min(MAX_WIDTH_REM, Math.max(MIN_WIDTH_REM, (colLengths[index] ?? 0) * CHAR_WIDTH_REM));
|
|
42840
|
+
el.style.minWidth = `${minRem}rem`;
|
|
42841
|
+
el.style.maxWidth = `${MAX_WIDTH_REM}rem`;
|
|
42842
|
+
};
|
|
42843
|
+
table.querySelectorAll("th").forEach((th, index) => {
|
|
42844
|
+
applyColStyle(th, index);
|
|
42845
|
+
});
|
|
42846
|
+
rows.forEach((row) => {
|
|
42847
|
+
row.querySelectorAll("td").forEach((td, index) => {
|
|
42848
|
+
applyColStyle(td, index);
|
|
42849
|
+
});
|
|
42850
|
+
});
|
|
42851
|
+
};
|
|
42852
|
+
applyToTable(tableRef.current);
|
|
42853
|
+
if (modalTableRef.current) applyToTable(modalTableRef.current);
|
|
42854
|
+
}, [props.children, isModalOpen]);
|
|
42821
42855
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
42822
|
-
className: "relative",
|
|
42856
|
+
className: "relative overflow-hidden rounded-2xl bg-background pr-4 [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-3xl",
|
|
42823
42857
|
children: [
|
|
42824
42858
|
displayModal && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
42825
42859
|
className: "sticky top-48 z-10",
|
|
@@ -42840,7 +42874,8 @@ var Table = ({ className, isRollable = false, displayModal, ...props }) => {
|
|
|
42840
42874
|
isRollable,
|
|
42841
42875
|
className: "max-w-full overflow-x-auto",
|
|
42842
42876
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("table", {
|
|
42843
|
-
|
|
42877
|
+
ref: tableRef,
|
|
42878
|
+
className: cn$2("w-full table-auto text-left", className),
|
|
42844
42879
|
...props
|
|
42845
42880
|
})
|
|
42846
42881
|
}),
|
|
@@ -42849,9 +42884,11 @@ var Table = ({ className, isRollable = false, displayModal, ...props }) => {
|
|
|
42849
42884
|
onClose: () => setIsModalOpen(false),
|
|
42850
42885
|
size: ModalSize.XL,
|
|
42851
42886
|
hasCloseButton: true,
|
|
42887
|
+
isScrollable: true,
|
|
42852
42888
|
children: isModalOpen ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
42853
42889
|
className: "grid",
|
|
42854
42890
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("table", {
|
|
42891
|
+
ref: modalTableRef,
|
|
42855
42892
|
className: cn$2("min-w-full max-w-full table-auto text-left", className),
|
|
42856
42893
|
...props
|
|
42857
42894
|
})
|
|
@@ -42949,7 +42986,11 @@ var createLinkRenderer = (locale) => {
|
|
|
42949
42986
|
});
|
|
42950
42987
|
};
|
|
42951
42988
|
var PreRenderer = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children });
|
|
42952
|
-
var TableRenderer = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table, {
|
|
42989
|
+
var TableRenderer = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table, {
|
|
42990
|
+
isRollable: true,
|
|
42991
|
+
displayModal: true,
|
|
42992
|
+
...props
|
|
42993
|
+
});
|
|
42953
42994
|
var ThRenderer = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
42954
42995
|
className: cn$2("border-neutral border-b bg-neutral/10 p-4", className),
|
|
42955
42996
|
...props
|
|
@@ -43459,7 +43500,7 @@ var ContentEditorInput$1 = ({ children, onContentChange, disabled, validate, add
|
|
|
43459
43500
|
}, String(children));
|
|
43460
43501
|
};
|
|
43461
43502
|
//#endregion
|
|
43462
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
43503
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/subscribable.js
|
|
43463
43504
|
var Subscribable = class {
|
|
43464
43505
|
constructor() {
|
|
43465
43506
|
this.listeners = /* @__PURE__ */ new Set();
|
|
@@ -43480,7 +43521,7 @@ var Subscribable = class {
|
|
|
43480
43521
|
onUnsubscribe() {}
|
|
43481
43522
|
};
|
|
43482
43523
|
//#endregion
|
|
43483
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
43524
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/focusManager.js
|
|
43484
43525
|
var FocusManager = class extends Subscribable {
|
|
43485
43526
|
#focused;
|
|
43486
43527
|
#cleanup;
|
|
@@ -43533,7 +43574,7 @@ var FocusManager = class extends Subscribable {
|
|
|
43533
43574
|
};
|
|
43534
43575
|
var focusManager = new FocusManager();
|
|
43535
43576
|
//#endregion
|
|
43536
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
43577
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/timeoutManager.js
|
|
43537
43578
|
var defaultTimeoutProvider = {
|
|
43538
43579
|
setTimeout: (callback, delay) => setTimeout(callback, delay),
|
|
43539
43580
|
clearTimeout: (timeoutId) => clearTimeout(timeoutId),
|
|
@@ -43564,7 +43605,7 @@ function systemSetTimeoutZero(callback) {
|
|
|
43564
43605
|
setTimeout(callback, 0);
|
|
43565
43606
|
}
|
|
43566
43607
|
//#endregion
|
|
43567
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
43608
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/utils.js
|
|
43568
43609
|
var isServer$1 = typeof window === "undefined" || "Deno" in globalThis;
|
|
43569
43610
|
function noop() {}
|
|
43570
43611
|
function functionalUpdate(updater, input) {
|
|
@@ -43722,7 +43763,7 @@ function addConsumeAwareSignal(object, getSignal, onCancelled) {
|
|
|
43722
43763
|
return object;
|
|
43723
43764
|
}
|
|
43724
43765
|
//#endregion
|
|
43725
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
43766
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/environmentManager.js
|
|
43726
43767
|
var environmentManager = /* @__PURE__ */ (() => {
|
|
43727
43768
|
let isServerFn = () => isServer$1;
|
|
43728
43769
|
return {
|
|
@@ -43735,7 +43776,7 @@ var environmentManager = /* @__PURE__ */ (() => {
|
|
|
43735
43776
|
};
|
|
43736
43777
|
})();
|
|
43737
43778
|
//#endregion
|
|
43738
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
43779
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/thenable.js
|
|
43739
43780
|
function pendingThenable() {
|
|
43740
43781
|
let resolve;
|
|
43741
43782
|
let reject;
|
|
@@ -43767,7 +43808,7 @@ function pendingThenable() {
|
|
|
43767
43808
|
return thenable;
|
|
43768
43809
|
}
|
|
43769
43810
|
//#endregion
|
|
43770
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
43811
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/notifyManager.js
|
|
43771
43812
|
var defaultScheduler = systemSetTimeoutZero;
|
|
43772
43813
|
function createNotifyManager() {
|
|
43773
43814
|
let queue = [];
|
|
@@ -43829,7 +43870,7 @@ function createNotifyManager() {
|
|
|
43829
43870
|
}
|
|
43830
43871
|
var notifyManager = createNotifyManager();
|
|
43831
43872
|
//#endregion
|
|
43832
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
43873
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/onlineManager.js
|
|
43833
43874
|
var OnlineManager = class extends Subscribable {
|
|
43834
43875
|
#online = true;
|
|
43835
43876
|
#cleanup;
|
|
@@ -43877,7 +43918,7 @@ var OnlineManager = class extends Subscribable {
|
|
|
43877
43918
|
};
|
|
43878
43919
|
var onlineManager = new OnlineManager();
|
|
43879
43920
|
//#endregion
|
|
43880
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
43921
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/retryer.js
|
|
43881
43922
|
function defaultRetryDelay(failureCount) {
|
|
43882
43923
|
return Math.min(1e3 * 2 ** failureCount, 3e4);
|
|
43883
43924
|
}
|
|
@@ -43983,7 +44024,7 @@ function createRetryer(config) {
|
|
|
43983
44024
|
};
|
|
43984
44025
|
}
|
|
43985
44026
|
//#endregion
|
|
43986
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
44027
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/removable.js
|
|
43987
44028
|
var Removable = class {
|
|
43988
44029
|
#gcTimeout;
|
|
43989
44030
|
destroy() {
|
|
@@ -44006,7 +44047,7 @@ var Removable = class {
|
|
|
44006
44047
|
}
|
|
44007
44048
|
};
|
|
44008
44049
|
//#endregion
|
|
44009
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
44050
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/query.js
|
|
44010
44051
|
var Query = class extends Removable {
|
|
44011
44052
|
#initialState;
|
|
44012
44053
|
#revertState;
|
|
@@ -44374,7 +44415,7 @@ function getDefaultState$1(options) {
|
|
|
44374
44415
|
};
|
|
44375
44416
|
}
|
|
44376
44417
|
//#endregion
|
|
44377
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
44418
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/queryObserver.js
|
|
44378
44419
|
var QueryObserver = class extends Subscribable {
|
|
44379
44420
|
constructor(client, options) {
|
|
44380
44421
|
super();
|
|
@@ -44717,7 +44758,7 @@ function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
|
|
|
44717
44758
|
return false;
|
|
44718
44759
|
}
|
|
44719
44760
|
//#endregion
|
|
44720
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
44761
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js
|
|
44721
44762
|
function infiniteQueryBehavior(pages) {
|
|
44722
44763
|
return { onFetch: (context, query) => {
|
|
44723
44764
|
const options = context.options;
|
|
@@ -44795,7 +44836,7 @@ function getPreviousPageParam(options, { pages, pageParams }) {
|
|
|
44795
44836
|
return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;
|
|
44796
44837
|
}
|
|
44797
44838
|
//#endregion
|
|
44798
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
44839
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/mutation.js
|
|
44799
44840
|
var Mutation = class extends Removable {
|
|
44800
44841
|
#client;
|
|
44801
44842
|
#observers;
|
|
@@ -45009,7 +45050,7 @@ function getDefaultState() {
|
|
|
45009
45050
|
};
|
|
45010
45051
|
}
|
|
45011
45052
|
//#endregion
|
|
45012
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
45053
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/mutationCache.js
|
|
45013
45054
|
var MutationCache = class extends Subscribable {
|
|
45014
45055
|
constructor(config = {}) {
|
|
45015
45056
|
super();
|
|
@@ -45116,7 +45157,7 @@ function scopeFor(mutation) {
|
|
|
45116
45157
|
return mutation.options.scope?.id;
|
|
45117
45158
|
}
|
|
45118
45159
|
//#endregion
|
|
45119
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
45160
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/mutationObserver.js
|
|
45120
45161
|
var MutationObserver$1 = class extends Subscribable {
|
|
45121
45162
|
#client;
|
|
45122
45163
|
#currentResult = void 0;
|
|
@@ -45220,7 +45261,7 @@ var MutationObserver$1 = class extends Subscribable {
|
|
|
45220
45261
|
}
|
|
45221
45262
|
};
|
|
45222
45263
|
//#endregion
|
|
45223
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
45264
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/queryCache.js
|
|
45224
45265
|
var QueryCache = class extends Subscribable {
|
|
45225
45266
|
constructor(config = {}) {
|
|
45226
45267
|
super();
|
|
@@ -45312,7 +45353,7 @@ var QueryCache = class extends Subscribable {
|
|
|
45312
45353
|
}
|
|
45313
45354
|
};
|
|
45314
45355
|
//#endregion
|
|
45315
|
-
//#region ../../node_modules/.bun/@tanstack+query-core@5.
|
|
45356
|
+
//#region ../../node_modules/.bun/@tanstack+query-core@5.94.5/node_modules/@tanstack/query-core/build/modern/queryClient.js
|
|
45316
45357
|
var QueryClient = class {
|
|
45317
45358
|
#queryCache;
|
|
45318
45359
|
#mutationCache;
|
|
@@ -45553,7 +45594,7 @@ var QueryClient = class {
|
|
|
45553
45594
|
}
|
|
45554
45595
|
};
|
|
45555
45596
|
//#endregion
|
|
45556
|
-
//#region ../../node_modules/.bun/@tanstack+react-query@5.
|
|
45597
|
+
//#region ../../node_modules/.bun/@tanstack+react-query@5.94.5+b1ab299f0a400331/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
|
|
45557
45598
|
var QueryClientContext = import_react.createContext(void 0);
|
|
45558
45599
|
var useQueryClient = (queryClient) => {
|
|
45559
45600
|
const client = import_react.useContext(QueryClientContext);
|
|
@@ -45574,12 +45615,12 @@ var QueryClientProvider = ({ client, children }) => {
|
|
|
45574
45615
|
});
|
|
45575
45616
|
};
|
|
45576
45617
|
//#endregion
|
|
45577
|
-
//#region ../../node_modules/.bun/@tanstack+react-query@5.
|
|
45618
|
+
//#region ../../node_modules/.bun/@tanstack+react-query@5.94.5+b1ab299f0a400331/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
|
|
45578
45619
|
var IsRestoringContext = import_react.createContext(false);
|
|
45579
45620
|
var useIsRestoring = () => import_react.useContext(IsRestoringContext);
|
|
45580
45621
|
IsRestoringContext.Provider;
|
|
45581
45622
|
//#endregion
|
|
45582
|
-
//#region ../../node_modules/.bun/@tanstack+react-query@5.
|
|
45623
|
+
//#region ../../node_modules/.bun/@tanstack+react-query@5.94.5+b1ab299f0a400331/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js
|
|
45583
45624
|
function createValue() {
|
|
45584
45625
|
let isReset = false;
|
|
45585
45626
|
return {
|
|
@@ -45597,7 +45638,7 @@ function createValue() {
|
|
|
45597
45638
|
var QueryErrorResetBoundaryContext = import_react.createContext(createValue());
|
|
45598
45639
|
var useQueryErrorResetBoundary = () => import_react.useContext(QueryErrorResetBoundaryContext);
|
|
45599
45640
|
//#endregion
|
|
45600
|
-
//#region ../../node_modules/.bun/@tanstack+react-query@5.
|
|
45641
|
+
//#region ../../node_modules/.bun/@tanstack+react-query@5.94.5+b1ab299f0a400331/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js
|
|
45601
45642
|
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
|
|
45602
45643
|
const throwOnError = query?.state.error && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;
|
|
45603
45644
|
if (options.suspense || options.experimental_prefetchInRender || throwOnError) {
|
|
@@ -45613,7 +45654,7 @@ var getHasError = ({ result, errorResetBoundary, throwOnError, query, suspense }
|
|
|
45613
45654
|
return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));
|
|
45614
45655
|
};
|
|
45615
45656
|
//#endregion
|
|
45616
|
-
//#region ../../node_modules/.bun/@tanstack+react-query@5.
|
|
45657
|
+
//#region ../../node_modules/.bun/@tanstack+react-query@5.94.5+b1ab299f0a400331/node_modules/@tanstack/react-query/build/modern/suspense.js
|
|
45617
45658
|
var ensureSuspenseTimers = (defaultedOptions) => {
|
|
45618
45659
|
if (defaultedOptions.suspense) {
|
|
45619
45660
|
const MIN_SUSPENSE_TIME_MS = 1e3;
|
|
@@ -45629,7 +45670,7 @@ var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observ
|
|
|
45629
45670
|
errorResetBoundary.clearReset();
|
|
45630
45671
|
});
|
|
45631
45672
|
//#endregion
|
|
45632
|
-
//#region ../../node_modules/.bun/@tanstack+react-query@5.
|
|
45673
|
+
//#region ../../node_modules/.bun/@tanstack+react-query@5.94.5+b1ab299f0a400331/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
|
|
45633
45674
|
function useBaseQuery(options, Observer, queryClient) {
|
|
45634
45675
|
const isRestoring = useIsRestoring();
|
|
45635
45676
|
const errorResetBoundary = useQueryErrorResetBoundary();
|
|
@@ -45668,12 +45709,12 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
|
45668
45709
|
return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
|
|
45669
45710
|
}
|
|
45670
45711
|
//#endregion
|
|
45671
|
-
//#region ../../node_modules/.bun/@tanstack+react-query@5.
|
|
45712
|
+
//#region ../../node_modules/.bun/@tanstack+react-query@5.94.5+b1ab299f0a400331/node_modules/@tanstack/react-query/build/modern/useQuery.js
|
|
45672
45713
|
function useQuery(options, queryClient) {
|
|
45673
45714
|
return useBaseQuery(options, QueryObserver, queryClient);
|
|
45674
45715
|
}
|
|
45675
45716
|
//#endregion
|
|
45676
|
-
//#region ../../node_modules/.bun/@tanstack+react-query@5.
|
|
45717
|
+
//#region ../../node_modules/.bun/@tanstack+react-query@5.94.5+b1ab299f0a400331/node_modules/@tanstack/react-query/build/modern/useMutation.js
|
|
45677
45718
|
function useMutation(options, queryClient) {
|
|
45678
45719
|
const client = useQueryClient(queryClient);
|
|
45679
45720
|
const [observer] = import_react.useState(() => new MutationObserver$1(client, options));
|
|
@@ -45909,7 +45950,8 @@ var getAiAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
45909
45950
|
let errorMessage = "An error occurred";
|
|
45910
45951
|
try {
|
|
45911
45952
|
const errorData = await response.json();
|
|
45912
|
-
|
|
45953
|
+
const errorObj = errorData.error ?? errorData;
|
|
45954
|
+
errorMessage = JSON.stringify(errorObj) ?? "An error occurred";
|
|
45913
45955
|
} catch {
|
|
45914
45956
|
try {
|
|
45915
45957
|
const errorText = await response.text();
|
|
@@ -46929,7 +46971,7 @@ function defineErrorCodes(codes) {
|
|
|
46929
46971
|
}]));
|
|
46930
46972
|
}
|
|
46931
46973
|
//#endregion
|
|
46932
|
-
//#region ../../node_modules/.bun/@better-auth+passkey@1.5.5+
|
|
46974
|
+
//#region ../../node_modules/.bun/@better-auth+passkey@1.5.5+37b7da4f5d8c97e5/node_modules/@better-auth/passkey/dist/error-codes-Dvu2mv33.mjs
|
|
46933
46975
|
var PASSKEY_ERROR_CODES = defineErrorCodes({
|
|
46934
46976
|
CHALLENGE_NOT_FOUND: "Challenge not found",
|
|
46935
46977
|
YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: "You are not allowed to register this passkey",
|
|
@@ -47391,7 +47433,7 @@ async function startAuthentication(options) {
|
|
|
47391
47433
|
};
|
|
47392
47434
|
}
|
|
47393
47435
|
//#endregion
|
|
47394
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
47436
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+9a36d44d146cc694/node_modules/better-auth/dist/client/broadcast-channel.mjs
|
|
47395
47437
|
var kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
|
|
47396
47438
|
var now$1 = () => Math.floor(Date.now() / 1e3);
|
|
47397
47439
|
var WindowBroadcastChannel = class {
|
|
@@ -47434,7 +47476,7 @@ function getGlobalBroadcastChannel(name = "better-auth.message") {
|
|
|
47434
47476
|
return globalThis[kBroadcastChannel];
|
|
47435
47477
|
}
|
|
47436
47478
|
//#endregion
|
|
47437
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
47479
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+9a36d44d146cc694/node_modules/better-auth/dist/client/focus-manager.mjs
|
|
47438
47480
|
var kFocusManager = Symbol.for("better-auth:focus-manager");
|
|
47439
47481
|
var WindowFocusManager = class {
|
|
47440
47482
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -47463,7 +47505,7 @@ function getGlobalFocusManager() {
|
|
|
47463
47505
|
return globalThis[kFocusManager];
|
|
47464
47506
|
}
|
|
47465
47507
|
//#endregion
|
|
47466
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
47508
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+9a36d44d146cc694/node_modules/better-auth/dist/client/online-manager.mjs
|
|
47467
47509
|
var kOnlineManager = Symbol.for("better-auth:online-manager");
|
|
47468
47510
|
var WindowOnlineManager = class {
|
|
47469
47511
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -47495,7 +47537,7 @@ function getGlobalOnlineManager() {
|
|
|
47495
47537
|
return globalThis[kOnlineManager];
|
|
47496
47538
|
}
|
|
47497
47539
|
//#endregion
|
|
47498
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
47540
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+9a36d44d146cc694/node_modules/better-auth/dist/client/parser.mjs
|
|
47499
47541
|
var PROTO_POLLUTION_PATTERNS = {
|
|
47500
47542
|
proto: /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,
|
|
47501
47543
|
constructor: /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,
|
|
@@ -47677,7 +47719,7 @@ var onMount = ($store, initialize) => {
|
|
|
47677
47719
|
});
|
|
47678
47720
|
};
|
|
47679
47721
|
//#endregion
|
|
47680
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
47722
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+9a36d44d146cc694/node_modules/better-auth/dist/client/query.mjs
|
|
47681
47723
|
var isServer = () => typeof window === "undefined";
|
|
47682
47724
|
var useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
47683
47725
|
const value = /* @__PURE__ */ atom({
|
|
@@ -47771,7 +47813,7 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
|
47771
47813
|
return value;
|
|
47772
47814
|
};
|
|
47773
47815
|
//#endregion
|
|
47774
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
47816
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+9a36d44d146cc694/node_modules/better-auth/dist/client/session-refresh.mjs
|
|
47775
47817
|
var now = () => Math.floor(Date.now() / 1e3);
|
|
47776
47818
|
/**
|
|
47777
47819
|
* Rate limit: don't refetch on focus if a session request was made within this many seconds
|
|
@@ -47970,7 +48012,7 @@ var BetterAuthError = class extends Error {
|
|
|
47970
48012
|
}
|
|
47971
48013
|
};
|
|
47972
48014
|
//#endregion
|
|
47973
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
48015
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+9a36d44d146cc694/node_modules/better-auth/dist/utils/url.mjs
|
|
47974
48016
|
function checkHasPath(url) {
|
|
47975
48017
|
try {
|
|
47976
48018
|
return (new URL(url).pathname.replace(/\/+$/, "") || "/") !== "/";
|
|
@@ -48042,7 +48084,7 @@ function getOrigin(url) {
|
|
|
48042
48084
|
}
|
|
48043
48085
|
}
|
|
48044
48086
|
//#endregion
|
|
48045
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
48087
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+9a36d44d146cc694/node_modules/better-auth/dist/client/fetch-plugins.mjs
|
|
48046
48088
|
var redirectPlugin = {
|
|
48047
48089
|
id: "redirect",
|
|
48048
48090
|
name: "Redirect",
|
|
@@ -48057,7 +48099,7 @@ var redirectPlugin = {
|
|
|
48057
48099
|
} }
|
|
48058
48100
|
};
|
|
48059
48101
|
//#endregion
|
|
48060
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
48102
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+9a36d44d146cc694/node_modules/better-auth/dist/client/session-atom.mjs
|
|
48061
48103
|
function getSessionAtom($fetch, options) {
|
|
48062
48104
|
const $signal = /* @__PURE__ */ atom(false);
|
|
48063
48105
|
const session = useAuthQuery($signal, "/get-session", $fetch, { method: "GET" });
|
|
@@ -48516,7 +48558,7 @@ var betterFetch = async (url, options) => {
|
|
|
48516
48558
|
};
|
|
48517
48559
|
};
|
|
48518
48560
|
//#endregion
|
|
48519
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
48561
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+9a36d44d146cc694/node_modules/better-auth/dist/client/config.mjs
|
|
48520
48562
|
var resolvePublicAuthUrl = (basePath) => {
|
|
48521
48563
|
if (typeof process === "undefined") return void 0;
|
|
48522
48564
|
const path = basePath ?? "/api/auth";
|
|
@@ -48614,12 +48656,12 @@ var getClientConfig = (options, loadEnv) => {
|
|
|
48614
48656
|
};
|
|
48615
48657
|
};
|
|
48616
48658
|
//#endregion
|
|
48617
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
48659
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+9a36d44d146cc694/node_modules/better-auth/dist/utils/is-atom.mjs
|
|
48618
48660
|
function isAtom(value) {
|
|
48619
48661
|
return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
|
|
48620
48662
|
}
|
|
48621
48663
|
//#endregion
|
|
48622
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
48664
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+9a36d44d146cc694/node_modules/better-auth/dist/client/proxy.mjs
|
|
48623
48665
|
function getMethod(path, knownPathMethods, args) {
|
|
48624
48666
|
const method = knownPathMethods[path];
|
|
48625
48667
|
const { fetchOptions, query: _query, ...body } = args || {};
|
|
@@ -48699,7 +48741,7 @@ function capitalizeFirstLetter(str) {
|
|
|
48699
48741
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
48700
48742
|
}
|
|
48701
48743
|
//#endregion
|
|
48702
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
48744
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+9a36d44d146cc694/node_modules/better-auth/dist/client/vanilla.mjs
|
|
48703
48745
|
function createAuthClient(options) {
|
|
48704
48746
|
const { pluginPathMethods, pluginsActions, pluginsAtoms, $fetch, atomListeners, $store } = getClientConfig(options);
|
|
48705
48747
|
const resolvedHooks = {};
|
|
@@ -48712,7 +48754,7 @@ function createAuthClient(options) {
|
|
|
48712
48754
|
}, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
|
|
48713
48755
|
}
|
|
48714
48756
|
//#endregion
|
|
48715
|
-
//#region ../../node_modules/.bun/@better-auth+passkey@1.5.5+
|
|
48757
|
+
//#region ../../node_modules/.bun/@better-auth+passkey@1.5.5+37b7da4f5d8c97e5/node_modules/@better-auth/passkey/dist/client.mjs
|
|
48716
48758
|
var getPasskeyActions = ($fetch, { $listPasskeys, $store }) => {
|
|
48717
48759
|
const signInPasskey = async (opts, options) => {
|
|
48718
48760
|
const response = await $fetch("/passkey/generate-authenticate-options", {
|
|
@@ -48854,7 +48896,7 @@ var passkeyClient = () => {
|
|
|
48854
48896
|
};
|
|
48855
48897
|
};
|
|
48856
48898
|
//#endregion
|
|
48857
|
-
//#region ../../node_modules/.bun/@better-auth+sso@1.5.5+
|
|
48899
|
+
//#region ../../node_modules/.bun/@better-auth+sso@1.5.5+8b7d47ef5b07754f/node_modules/@better-auth/sso/dist/client.mjs
|
|
48858
48900
|
var ssoClient = (options) => {
|
|
48859
48901
|
return {
|
|
48860
48902
|
id: "sso-client",
|
|
@@ -48866,7 +48908,7 @@ var ssoClient = (options) => {
|
|
|
48866
48908
|
};
|
|
48867
48909
|
};
|
|
48868
48910
|
//#endregion
|
|
48869
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
48911
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+9a36d44d146cc694/node_modules/better-auth/dist/plugins/magic-link/client.mjs
|
|
48870
48912
|
var magicLinkClient = () => {
|
|
48871
48913
|
return {
|
|
48872
48914
|
id: "magic-link",
|
|
@@ -48874,7 +48916,7 @@ var magicLinkClient = () => {
|
|
|
48874
48916
|
};
|
|
48875
48917
|
};
|
|
48876
48918
|
//#endregion
|
|
48877
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
48919
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+9a36d44d146cc694/node_modules/better-auth/dist/plugins/two-factor/error-code.mjs
|
|
48878
48920
|
var TWO_FACTOR_ERROR_CODES = defineErrorCodes({
|
|
48879
48921
|
OTP_NOT_ENABLED: "OTP not enabled",
|
|
48880
48922
|
OTP_HAS_EXPIRED: "OTP has expired",
|
|
@@ -48887,7 +48929,7 @@ var TWO_FACTOR_ERROR_CODES = defineErrorCodes({
|
|
|
48887
48929
|
INVALID_TWO_FACTOR_COOKIE: "Invalid two factor cookie"
|
|
48888
48930
|
});
|
|
48889
48931
|
//#endregion
|
|
48890
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
48932
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+9a36d44d146cc694/node_modules/better-auth/dist/plugins/two-factor/client.mjs
|
|
48891
48933
|
var twoFactorClient = (options) => {
|
|
48892
48934
|
return {
|
|
48893
48935
|
id: "two-factor",
|
|
@@ -58446,10 +58488,18 @@ var useToastEvents = () => {
|
|
|
58446
58488
|
[(() => {
|
|
58447
58489
|
try {
|
|
58448
58490
|
if (typeof error === "string") return JSON.parse(error);
|
|
58491
|
+
if (error instanceof Error) return JSON.parse(error.message);
|
|
58449
58492
|
} catch (_) {}
|
|
58450
58493
|
return error;
|
|
58451
58494
|
})()].flat().forEach((err) => {
|
|
58452
58495
|
const apiError = err?.error ?? err;
|
|
58496
|
+
if (apiError?.code === "RATE_LIMIT_EXCEEDED_UNAUTHENTICATED") {
|
|
58497
|
+
toast({
|
|
58498
|
+
title: apiError.message,
|
|
58499
|
+
variant: "error"
|
|
58500
|
+
});
|
|
58501
|
+
return;
|
|
58502
|
+
}
|
|
58453
58503
|
toast({
|
|
58454
58504
|
title: formatErrorCode(apiError?.title ?? err?.title ?? "Error"),
|
|
58455
58505
|
description: apiError?.message ?? err?.message ?? String(apiError ?? "An error occurred"),
|
|
@@ -1636,7 +1636,7 @@ var createRules = (createElement, ctx, options, footnotes, refs, attrStringToMap
|
|
|
1636
1636
|
},
|
|
1637
1637
|
_render(node, output, state = {}) {
|
|
1638
1638
|
const table = node;
|
|
1639
|
-
const getStyle = (i) => table.align[i] ? { textAlign: table.align[i] } : {};
|
|
1639
|
+
const getStyle = (i) => table.align[i] && table.align[i] !== "left" ? { textAlign: table.align[i] } : {};
|
|
1640
1640
|
return createElement("table", { key: state.key }, createElement("thead", null, createElement("tr", null, ...table.header.map((c, i) => createElement("th", {
|
|
1641
1641
|
key: i,
|
|
1642
1642
|
style: getStyle(i)
|
|
@@ -1665,7 +1665,11 @@ var createRules = (createElement, ctx, options, footnotes, refs, attrStringToMap
|
|
|
1665
1665
|
_order: Priority.MIN,
|
|
1666
1666
|
_parse(capture) {
|
|
1667
1667
|
const text = capture[0];
|
|
1668
|
-
return { text: text.indexOf("&") === -1 ? text : text.replace(HTML_CHAR_CODE_R, (f, i) =>
|
|
1668
|
+
return { text: text.indexOf("&") === -1 ? text : text.replace(HTML_CHAR_CODE_R, (f, i) => {
|
|
1669
|
+
if (i.startsWith("#x")) return String.fromCharCode(parseInt(i.slice(2), 16));
|
|
1670
|
+
if (i.startsWith("#")) return String.fromCharCode(parseInt(i.slice(1), 10));
|
|
1671
|
+
return namedCodesToUnicode[i] || f;
|
|
1672
|
+
}) };
|
|
1669
1673
|
},
|
|
1670
1674
|
_render(node) {
|
|
1671
1675
|
return node.text;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./chunk-C0u3WHrm.js";
|
|
2
|
-
import "./markdown-
|
|
3
|
-
import { r as useMarkdownContext } from "./index-
|
|
2
|
+
import "./markdown-B_VAQu_B.js";
|
|
3
|
+
import { r as useMarkdownContext } from "./index-Bp3XDFNZ.js";
|
|
4
4
|
//#region ../react-intlayer/dist/esm/markdown/MarkdownRendererPlugin.mjs
|
|
5
5
|
var MarkdownRendererPlugin = (props) => {
|
|
6
6
|
const { children, options, components } = props;
|
package/client/dist/index.html
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Intlayer Editor</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-Bp3XDFNZ.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/chunk-C0u3WHrm.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-B4JcPOPd.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-BkWmzJHO.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/react-BI_C_976.js">
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/markdown-
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/markdown-B_VAQu_B.js">
|
|
14
14
|
<link rel="stylesheet" crossorigin href="/assets/index-SO-phafd.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intlayer-editor",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Integrate the Intlayer visual editor into your Intlayer projects, enabling CMS-like content management with multilingual support.",
|
|
6
6
|
"keywords": [
|
|
@@ -93,19 +93,19 @@
|
|
|
93
93
|
"@fastify/formbody": "8.0.2",
|
|
94
94
|
"@fastify/helmet": "13.0.2",
|
|
95
95
|
"@fastify/static": "9.0.0",
|
|
96
|
-
"@intlayer/chokidar": "8.4.
|
|
97
|
-
"@intlayer/config": "8.4.
|
|
98
|
-
"@intlayer/unmerged-dictionaries-entry": "8.4.
|
|
96
|
+
"@intlayer/chokidar": "8.4.9",
|
|
97
|
+
"@intlayer/config": "8.4.9",
|
|
98
|
+
"@intlayer/unmerged-dictionaries-entry": "8.4.9",
|
|
99
99
|
"fastify": "5.8.2",
|
|
100
|
-
"fastify-intlayer": "8.4.
|
|
100
|
+
"fastify-intlayer": "8.4.9",
|
|
101
101
|
"mime": "4.1.0"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
|
-
"@intlayer/design-system": "8.4.
|
|
105
|
-
"@intlayer/editor-react": "8.4.
|
|
106
|
-
"@intlayer/types": "8.4.
|
|
104
|
+
"@intlayer/design-system": "8.4.9",
|
|
105
|
+
"@intlayer/editor-react": "8.4.9",
|
|
106
|
+
"@intlayer/types": "8.4.9",
|
|
107
107
|
"@tailwindcss/vite": "4.2.2",
|
|
108
|
-
"@tanstack/react-query": "5.
|
|
108
|
+
"@tanstack/react-query": "5.94.5",
|
|
109
109
|
"@types/node": "25.5.0",
|
|
110
110
|
"@types/react": "19.2.14",
|
|
111
111
|
"@types/react-dom": "19.2.3",
|
|
@@ -117,18 +117,18 @@
|
|
|
117
117
|
"framer-motion": "12.38.0",
|
|
118
118
|
"fuse.js": "7.1.0",
|
|
119
119
|
"globals": "17.4.0",
|
|
120
|
-
"intlayer": "8.4.
|
|
120
|
+
"intlayer": "8.4.9",
|
|
121
121
|
"lucide-react": "0.577.0",
|
|
122
122
|
"react": "19.2.4",
|
|
123
123
|
"react-dom": "19.2.4",
|
|
124
|
-
"react-intlayer": "8.4.
|
|
124
|
+
"react-intlayer": "8.4.9",
|
|
125
125
|
"react-router-dom": "7.13.1",
|
|
126
126
|
"tailwind-merge": "3.5.0",
|
|
127
127
|
"tailwindcss": "4.2.2",
|
|
128
128
|
"tsdown": "0.21.4",
|
|
129
129
|
"typescript": "5.9.3",
|
|
130
130
|
"vite": "8.0.1",
|
|
131
|
-
"vite-intlayer": "8.4.
|
|
131
|
+
"vite-intlayer": "8.4.9",
|
|
132
132
|
"vitest": "4.1.0"
|
|
133
133
|
},
|
|
134
134
|
"engines": {
|
|
@@ -3,8 +3,10 @@ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
|
3
3
|
const require_utils_responseData = require('../utils/responseData.cjs');
|
|
4
4
|
let _intlayer_config_node = require("@intlayer/config/node");
|
|
5
5
|
let _intlayer_chokidar_build = require("@intlayer/chokidar/build");
|
|
6
|
+
let _intlayer_config_utils = require("@intlayer/config/utils");
|
|
6
7
|
let _intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
|
|
7
8
|
let fastify_intlayer = require("fastify-intlayer");
|
|
9
|
+
let path = require("path");
|
|
8
10
|
|
|
9
11
|
//#region src/controllers/dictionary.controller.ts
|
|
10
12
|
/**
|
|
@@ -36,7 +38,9 @@ const getDictionaries = async (_req, res) => {
|
|
|
36
38
|
const writeContentDeclaration = async (req, res) => {
|
|
37
39
|
try {
|
|
38
40
|
const dictionaryData = req.body.dictionary;
|
|
39
|
-
const
|
|
41
|
+
const config = (0, _intlayer_config_node.getConfiguration)();
|
|
42
|
+
const result = await (0, _intlayer_chokidar_build.writeContentDeclaration)(dictionaryData, config);
|
|
43
|
+
(0, _intlayer_config_utils.clearModuleCache)((0, path.join)(config.system.mainDir, `unmerged_dictionaries.cjs`));
|
|
40
44
|
let description = "";
|
|
41
45
|
switch (result.status) {
|
|
42
46
|
case "created":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.controller.cjs","names":["formatResponse"],"sources":["../../src/controllers/dictionary.controller.ts"],"sourcesContent":["import {\n type DictionaryStatus,\n writeContentDeclaration as writeContentDeclarationEditor,\n} from '@intlayer/chokidar/build';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport {\n getUnmergedDictionaries,\n type UnmergedDictionaries,\n} from '@intlayer/unmerged-dictionaries-entry';\nimport { formatResponse, type ResponseData } from '@utils/responseData';\nimport type { FastifyReply, FastifyRequest } from 'fastify';\nimport { t } from 'fastify-intlayer';\n\nexport type GetEditorDictionariesResult = ResponseData<UnmergedDictionaries>;\n\n/**\n * Get the Intlayer configuration\n */\nexport const getDictionaries = async (\n _req: FastifyRequest,\n res: FastifyReply\n): Promise<void> => {\n try {\n const formattedResponse = formatResponse<UnmergedDictionaries>({\n data: getUnmergedDictionaries(),\n });\n\n return res.send(formattedResponse);\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n const formattedErrorResponse = formatResponse<UnmergedDictionaries>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n return res.send(formattedErrorResponse);\n }\n};\n\nexport type WriteContentDeclarationBody = { dictionary: Dictionary };\ntype WriteContentDeclarationResultData = {\n status: DictionaryStatus;\n path: string;\n};\nexport type WriteContentDeclarationResult =\n ResponseData<WriteContentDeclarationResultData>;\n\n/**\n * Adds a new dictionary to the database.\n */\nexport const writeContentDeclaration = async (\n req: FastifyRequest<{ Body: WriteContentDeclarationBody }>,\n res: FastifyReply\n): Promise<void> => {\n try {\n const dictionaryData = req.body.dictionary;\n\n const config = getConfiguration();\n\n const result = await writeContentDeclarationEditor(dictionaryData, config);\n\n let description = '';\n\n switch (result.status) {\n case 'created': {\n description = t({\n en: 'Content declaration created successfully',\n fr: 'Déclaration de contenu créée avec succès',\n es: 'Declaración de contenido creada con éxito',\n });\n break;\n }\n\n case 'updated': {\n description = t({\n en: 'Content declaration updated successfully',\n fr: 'Déclaration de contenu mise à jour avec succès',\n es: 'Declaración de contenido actualizada con éxito',\n });\n break;\n }\n case 'reimported in JSON': {\n description = t({\n en: 'Content declaration reimported in JSON successfully',\n fr: 'Déclaration de contenu réimportée en JSON avec succès',\n es: 'Declaración de contenido reimportada en JSON con éxito',\n });\n break;\n }\n case 'new content file': {\n description = t({\n en: 'Content declaration new content file successfully',\n fr: 'Déclaration de contenu réimportée dans un nouveau emplacement avec succès',\n es: 'Declaración de contenido reimportada en un nuevo lugar con éxito',\n });\n break;\n }\n default: {\n description = t({\n en: 'Content declaration written successfully',\n fr: 'Déclaration de contenu écrite avec succès',\n es: 'Declaración de contenido escrita con éxito',\n });\n break;\n }\n }\n\n const formattedResponse = formatResponse<WriteContentDeclarationResultData>(\n {\n data: result,\n message: t({\n en: 'Content declaration written',\n fr: 'Déclaration de contenu écrite',\n es: 'Declaración de contenido escrita',\n }),\n description,\n }\n );\n\n return res.send(formattedResponse);\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n console.error(errorMessage);\n\n const formattedErrorResponse =\n formatResponse<WriteContentDeclarationResultData>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n return res.send(formattedErrorResponse);\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dictionary.controller.cjs","names":["formatResponse"],"sources":["../../src/controllers/dictionary.controller.ts"],"sourcesContent":["import {\n type DictionaryStatus,\n writeContentDeclaration as writeContentDeclarationEditor,\n} from '@intlayer/chokidar/build';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { clearModuleCache } from '@intlayer/config/utils';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport {\n getUnmergedDictionaries,\n type UnmergedDictionaries,\n} from '@intlayer/unmerged-dictionaries-entry';\nimport { formatResponse, type ResponseData } from '@utils/responseData';\nimport type { FastifyReply, FastifyRequest } from 'fastify';\nimport { t } from 'fastify-intlayer';\nimport { join } from 'path';\n\nexport type GetEditorDictionariesResult = ResponseData<UnmergedDictionaries>;\n\n/**\n * Get the Intlayer configuration\n */\nexport const getDictionaries = async (\n _req: FastifyRequest,\n res: FastifyReply\n): Promise<void> => {\n try {\n const formattedResponse = formatResponse<UnmergedDictionaries>({\n data: getUnmergedDictionaries(),\n });\n\n return res.send(formattedResponse);\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n const formattedErrorResponse = formatResponse<UnmergedDictionaries>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n return res.send(formattedErrorResponse);\n }\n};\n\nexport type WriteContentDeclarationBody = { dictionary: Dictionary };\ntype WriteContentDeclarationResultData = {\n status: DictionaryStatus;\n path: string;\n};\nexport type WriteContentDeclarationResult =\n ResponseData<WriteContentDeclarationResultData>;\n\n/**\n * Adds a new dictionary to the database.\n */\nexport const writeContentDeclaration = async (\n req: FastifyRequest<{ Body: WriteContentDeclarationBody }>,\n res: FastifyReply\n): Promise<void> => {\n try {\n const dictionaryData = req.body.dictionary;\n\n const config = getConfiguration();\n\n const result = await writeContentDeclarationEditor(dictionaryData, config);\n\n // Clear cache to hot reload the dictionaries\n const dictionariesPath = join(\n config.system.mainDir,\n `unmerged_dictionaries.cjs`\n );\n clearModuleCache(dictionariesPath);\n\n let description = '';\n\n switch (result.status) {\n case 'created': {\n description = t({\n en: 'Content declaration created successfully',\n fr: 'Déclaration de contenu créée avec succès',\n es: 'Declaración de contenido creada con éxito',\n });\n break;\n }\n\n case 'updated': {\n description = t({\n en: 'Content declaration updated successfully',\n fr: 'Déclaration de contenu mise à jour avec succès',\n es: 'Declaración de contenido actualizada con éxito',\n });\n break;\n }\n case 'reimported in JSON': {\n description = t({\n en: 'Content declaration reimported in JSON successfully',\n fr: 'Déclaration de contenu réimportée en JSON avec succès',\n es: 'Declaración de contenido reimportada en JSON con éxito',\n });\n break;\n }\n case 'new content file': {\n description = t({\n en: 'Content declaration new content file successfully',\n fr: 'Déclaration de contenu réimportée dans un nouveau emplacement avec succès',\n es: 'Declaración de contenido reimportada en un nuevo lugar con éxito',\n });\n break;\n }\n default: {\n description = t({\n en: 'Content declaration written successfully',\n fr: 'Déclaration de contenu écrite avec succès',\n es: 'Declaración de contenido escrita con éxito',\n });\n break;\n }\n }\n\n const formattedResponse = formatResponse<WriteContentDeclarationResultData>(\n {\n data: result,\n message: t({\n en: 'Content declaration written',\n fr: 'Déclaration de contenu écrite',\n es: 'Declaración de contenido escrita',\n }),\n description,\n }\n );\n\n return res.send(formattedResponse);\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n console.error(errorMessage);\n\n const formattedErrorResponse =\n formatResponse<WriteContentDeclarationResultData>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n return res.send(formattedErrorResponse);\n }\n};\n"],"mappings":";;;;;;;;;;;;;;AAqBA,MAAa,kBAAkB,OAC7B,MACA,QACkB;AAClB,KAAI;EACF,MAAM,oBAAoBA,0CAAqC,EAC7D,0EAA+B,EAChC,CAAC;AAEF,SAAO,IAAI,KAAK,kBAAkB;UAC3B,KAAK;EACZ,MAAM,eAAgB,OAAiD;GACrE,SAAS;GACT,QAAQ;GACT;EAED,MAAM,yBAAyBA,0CAAqC;GAClE,OAAO;IACL,SAAS,aAAa,WAAW;IACjC,MAAM;IACN,OAAO;IACR;GACD,QAAQ,aAAa,UAAU;GAChC,CAAC;AAEF,SAAO,IAAI,KAAK,uBAAuB;;;;;;AAe3C,MAAa,0BAA0B,OACrC,KACA,QACkB;AAClB,KAAI;EACF,MAAM,iBAAiB,IAAI,KAAK;EAEhC,MAAM,sDAA2B;EAEjC,MAAM,SAAS,4DAAoC,gBAAgB,OAAO;AAO1E,8DAHE,OAAO,OAAO,SACd,4BACD,CACiC;EAElC,IAAI,cAAc;AAElB,UAAQ,OAAO,QAAf;GACE,KAAK;AACH,0CAAgB;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAGF,KAAK;AACH,0CAAgB;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF,KAAK;AACH,0CAAgB;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF,KAAK;AACH,0CAAgB;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF;AACE,0CAAgB;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;;EAIJ,MAAM,oBAAoBA,0CACxB;GACE,MAAM;GACN,iCAAW;IACT,IAAI;IACJ,IAAI;IACJ,IAAI;IACL,CAAC;GACF;GACD,CACF;AAED,SAAO,IAAI,KAAK,kBAAkB;UAC3B,KAAK;EACZ,MAAM,eAAgB,OAAiD;GACrE,SAAS;GACT,QAAQ;GACT;AAED,UAAQ,MAAM,aAAa;EAE3B,MAAM,yBACJA,0CAAkD;GAChD,OAAO;IACL,SAAS,aAAa,WAAW;IACjC,MAAM;IACN,OAAO;IACR;GACD,QAAQ,aAAa,UAAU;GAChC,CAAC;AAEJ,SAAO,IAAI,KAAK,uBAAuB"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { formatResponse } from "../utils/responseData.mjs";
|
|
2
2
|
import { getConfiguration } from "@intlayer/config/node";
|
|
3
3
|
import { writeContentDeclaration as writeContentDeclaration$1 } from "@intlayer/chokidar/build";
|
|
4
|
+
import { clearModuleCache } from "@intlayer/config/utils";
|
|
4
5
|
import { getUnmergedDictionaries } from "@intlayer/unmerged-dictionaries-entry";
|
|
5
6
|
import { t } from "fastify-intlayer";
|
|
7
|
+
import { join } from "path";
|
|
6
8
|
|
|
7
9
|
//#region src/controllers/dictionary.controller.ts
|
|
8
10
|
/**
|
|
@@ -34,7 +36,9 @@ const getDictionaries = async (_req, res) => {
|
|
|
34
36
|
const writeContentDeclaration = async (req, res) => {
|
|
35
37
|
try {
|
|
36
38
|
const dictionaryData = req.body.dictionary;
|
|
37
|
-
const
|
|
39
|
+
const config = getConfiguration();
|
|
40
|
+
const result = await writeContentDeclaration$1(dictionaryData, config);
|
|
41
|
+
clearModuleCache(join(config.system.mainDir, `unmerged_dictionaries.cjs`));
|
|
38
42
|
let description = "";
|
|
39
43
|
switch (result.status) {
|
|
40
44
|
case "created":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.controller.mjs","names":["writeContentDeclarationEditor"],"sources":["../../src/controllers/dictionary.controller.ts"],"sourcesContent":["import {\n type DictionaryStatus,\n writeContentDeclaration as writeContentDeclarationEditor,\n} from '@intlayer/chokidar/build';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport {\n getUnmergedDictionaries,\n type UnmergedDictionaries,\n} from '@intlayer/unmerged-dictionaries-entry';\nimport { formatResponse, type ResponseData } from '@utils/responseData';\nimport type { FastifyReply, FastifyRequest } from 'fastify';\nimport { t } from 'fastify-intlayer';\n\nexport type GetEditorDictionariesResult = ResponseData<UnmergedDictionaries>;\n\n/**\n * Get the Intlayer configuration\n */\nexport const getDictionaries = async (\n _req: FastifyRequest,\n res: FastifyReply\n): Promise<void> => {\n try {\n const formattedResponse = formatResponse<UnmergedDictionaries>({\n data: getUnmergedDictionaries(),\n });\n\n return res.send(formattedResponse);\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n const formattedErrorResponse = formatResponse<UnmergedDictionaries>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n return res.send(formattedErrorResponse);\n }\n};\n\nexport type WriteContentDeclarationBody = { dictionary: Dictionary };\ntype WriteContentDeclarationResultData = {\n status: DictionaryStatus;\n path: string;\n};\nexport type WriteContentDeclarationResult =\n ResponseData<WriteContentDeclarationResultData>;\n\n/**\n * Adds a new dictionary to the database.\n */\nexport const writeContentDeclaration = async (\n req: FastifyRequest<{ Body: WriteContentDeclarationBody }>,\n res: FastifyReply\n): Promise<void> => {\n try {\n const dictionaryData = req.body.dictionary;\n\n const config = getConfiguration();\n\n const result = await writeContentDeclarationEditor(dictionaryData, config);\n\n let description = '';\n\n switch (result.status) {\n case 'created': {\n description = t({\n en: 'Content declaration created successfully',\n fr: 'Déclaration de contenu créée avec succès',\n es: 'Declaración de contenido creada con éxito',\n });\n break;\n }\n\n case 'updated': {\n description = t({\n en: 'Content declaration updated successfully',\n fr: 'Déclaration de contenu mise à jour avec succès',\n es: 'Declaración de contenido actualizada con éxito',\n });\n break;\n }\n case 'reimported in JSON': {\n description = t({\n en: 'Content declaration reimported in JSON successfully',\n fr: 'Déclaration de contenu réimportée en JSON avec succès',\n es: 'Declaración de contenido reimportada en JSON con éxito',\n });\n break;\n }\n case 'new content file': {\n description = t({\n en: 'Content declaration new content file successfully',\n fr: 'Déclaration de contenu réimportée dans un nouveau emplacement avec succès',\n es: 'Declaración de contenido reimportada en un nuevo lugar con éxito',\n });\n break;\n }\n default: {\n description = t({\n en: 'Content declaration written successfully',\n fr: 'Déclaration de contenu écrite avec succès',\n es: 'Declaración de contenido escrita con éxito',\n });\n break;\n }\n }\n\n const formattedResponse = formatResponse<WriteContentDeclarationResultData>(\n {\n data: result,\n message: t({\n en: 'Content declaration written',\n fr: 'Déclaration de contenu écrite',\n es: 'Declaración de contenido escrita',\n }),\n description,\n }\n );\n\n return res.send(formattedResponse);\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n console.error(errorMessage);\n\n const formattedErrorResponse =\n formatResponse<WriteContentDeclarationResultData>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n return res.send(formattedErrorResponse);\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dictionary.controller.mjs","names":["writeContentDeclarationEditor"],"sources":["../../src/controllers/dictionary.controller.ts"],"sourcesContent":["import {\n type DictionaryStatus,\n writeContentDeclaration as writeContentDeclarationEditor,\n} from '@intlayer/chokidar/build';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { clearModuleCache } from '@intlayer/config/utils';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport {\n getUnmergedDictionaries,\n type UnmergedDictionaries,\n} from '@intlayer/unmerged-dictionaries-entry';\nimport { formatResponse, type ResponseData } from '@utils/responseData';\nimport type { FastifyReply, FastifyRequest } from 'fastify';\nimport { t } from 'fastify-intlayer';\nimport { join } from 'path';\n\nexport type GetEditorDictionariesResult = ResponseData<UnmergedDictionaries>;\n\n/**\n * Get the Intlayer configuration\n */\nexport const getDictionaries = async (\n _req: FastifyRequest,\n res: FastifyReply\n): Promise<void> => {\n try {\n const formattedResponse = formatResponse<UnmergedDictionaries>({\n data: getUnmergedDictionaries(),\n });\n\n return res.send(formattedResponse);\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n const formattedErrorResponse = formatResponse<UnmergedDictionaries>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n return res.send(formattedErrorResponse);\n }\n};\n\nexport type WriteContentDeclarationBody = { dictionary: Dictionary };\ntype WriteContentDeclarationResultData = {\n status: DictionaryStatus;\n path: string;\n};\nexport type WriteContentDeclarationResult =\n ResponseData<WriteContentDeclarationResultData>;\n\n/**\n * Adds a new dictionary to the database.\n */\nexport const writeContentDeclaration = async (\n req: FastifyRequest<{ Body: WriteContentDeclarationBody }>,\n res: FastifyReply\n): Promise<void> => {\n try {\n const dictionaryData = req.body.dictionary;\n\n const config = getConfiguration();\n\n const result = await writeContentDeclarationEditor(dictionaryData, config);\n\n // Clear cache to hot reload the dictionaries\n const dictionariesPath = join(\n config.system.mainDir,\n `unmerged_dictionaries.cjs`\n );\n clearModuleCache(dictionariesPath);\n\n let description = '';\n\n switch (result.status) {\n case 'created': {\n description = t({\n en: 'Content declaration created successfully',\n fr: 'Déclaration de contenu créée avec succès',\n es: 'Declaración de contenido creada con éxito',\n });\n break;\n }\n\n case 'updated': {\n description = t({\n en: 'Content declaration updated successfully',\n fr: 'Déclaration de contenu mise à jour avec succès',\n es: 'Declaración de contenido actualizada con éxito',\n });\n break;\n }\n case 'reimported in JSON': {\n description = t({\n en: 'Content declaration reimported in JSON successfully',\n fr: 'Déclaration de contenu réimportée en JSON avec succès',\n es: 'Declaración de contenido reimportada en JSON con éxito',\n });\n break;\n }\n case 'new content file': {\n description = t({\n en: 'Content declaration new content file successfully',\n fr: 'Déclaration de contenu réimportée dans un nouveau emplacement avec succès',\n es: 'Declaración de contenido reimportada en un nuevo lugar con éxito',\n });\n break;\n }\n default: {\n description = t({\n en: 'Content declaration written successfully',\n fr: 'Déclaration de contenu écrite avec succès',\n es: 'Declaración de contenido escrita con éxito',\n });\n break;\n }\n }\n\n const formattedResponse = formatResponse<WriteContentDeclarationResultData>(\n {\n data: result,\n message: t({\n en: 'Content declaration written',\n fr: 'Déclaration de contenu écrite',\n es: 'Declaración de contenido escrita',\n }),\n description,\n }\n );\n\n return res.send(formattedResponse);\n } catch (err) {\n const errorMessage = (err as { message?: string; status?: number }) ?? {\n message: 'Internal Server Error',\n status: 500,\n };\n\n console.error(errorMessage);\n\n const formattedErrorResponse =\n formatResponse<WriteContentDeclarationResultData>({\n error: {\n message: errorMessage.message ?? 'Internal Server Error',\n code: 'INTERNAL_SERVER_ERROR',\n title: 'Internal Server Error',\n },\n status: errorMessage.status ?? 500,\n });\n\n return res.send(formattedErrorResponse);\n }\n};\n"],"mappings":";;;;;;;;;;;;AAqBA,MAAa,kBAAkB,OAC7B,MACA,QACkB;AAClB,KAAI;EACF,MAAM,oBAAoB,eAAqC,EAC7D,MAAM,yBAAyB,EAChC,CAAC;AAEF,SAAO,IAAI,KAAK,kBAAkB;UAC3B,KAAK;EACZ,MAAM,eAAgB,OAAiD;GACrE,SAAS;GACT,QAAQ;GACT;EAED,MAAM,yBAAyB,eAAqC;GAClE,OAAO;IACL,SAAS,aAAa,WAAW;IACjC,MAAM;IACN,OAAO;IACR;GACD,QAAQ,aAAa,UAAU;GAChC,CAAC;AAEF,SAAO,IAAI,KAAK,uBAAuB;;;;;;AAe3C,MAAa,0BAA0B,OACrC,KACA,QACkB;AAClB,KAAI;EACF,MAAM,iBAAiB,IAAI,KAAK;EAEhC,MAAM,SAAS,kBAAkB;EAEjC,MAAM,SAAS,MAAMA,0BAA8B,gBAAgB,OAAO;AAO1E,mBAJyB,KACvB,OAAO,OAAO,SACd,4BACD,CACiC;EAElC,IAAI,cAAc;AAElB,UAAQ,OAAO,QAAf;GACE,KAAK;AACH,kBAAc,EAAE;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAGF,KAAK;AACH,kBAAc,EAAE;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF,KAAK;AACH,kBAAc,EAAE;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF,KAAK;AACH,kBAAc,EAAE;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;GAEF;AACE,kBAAc,EAAE;KACd,IAAI;KACJ,IAAI;KACJ,IAAI;KACL,CAAC;AACF;;EAIJ,MAAM,oBAAoB,eACxB;GACE,MAAM;GACN,SAAS,EAAE;IACT,IAAI;IACJ,IAAI;IACJ,IAAI;IACL,CAAC;GACF;GACD,CACF;AAED,SAAO,IAAI,KAAK,kBAAkB;UAC3B,KAAK;EACZ,MAAM,eAAgB,OAAiD;GACrE,SAAS;GACT,QAAQ;GACT;AAED,UAAQ,MAAM,aAAa;EAE3B,MAAM,yBACJ,eAAkD;GAChD,OAAO;IACL,SAAS,aAAa,WAAW;IACjC,MAAM;IACN,OAAO;IACR;GACD,QAAQ,aAAa,UAAU;GAChC,CAAC;AAEJ,SAAO,IAAI,KAAK,uBAAuB"}
|