intlayer-editor 8.4.10 → 8.5.0
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-CjD7FtGt.js → CodeBlockShiki-D9plzEFQ.js} +19 -19
- package/client/dist/assets/{markdown-DJYH1etf.js → MarkdownRendererPlugin-Dp6Cig6u.js} +1 -3
- package/client/dist/assets/{angular-html-BM_ZCyla.js → angular-html-CB13AsOD.js} +1 -1
- package/client/dist/assets/angular-html-DBLVmRwL.js +2 -0
- package/client/dist/assets/angular-ts-C9ELUJYv.js +2 -0
- package/client/dist/assets/{angular-ts-DqRX8wMA.js → angular-ts-CCw7GlcU.js} +2 -2
- package/client/dist/assets/{astro-CkdCbF1_.js → astro-DvvtD-Rg.js} +6 -6
- package/client/dist/assets/astro-sNYlBERO.js +2 -0
- package/client/dist/assets/bash-WEGyGKlK.js +2 -0
- package/client/dist/assets/{blade-BEaXVVTN.js → blade-Bcf_-uRd.js} +7 -7
- package/client/dist/assets/{bundle-web-BoGO2r50.js → bundle-web-CuX3_94g.js} +123 -123
- package/client/dist/assets/{coffee-BK7D_9TJ.js → coffee-Dzs5FG7f.js} +1 -1
- package/client/dist/assets/{cpp-Cj5FPunD.js → cpp-DfI8x_Jv.js} +3 -3
- package/client/dist/assets/github-dark-BwJSAZXP.js +2 -0
- package/client/dist/assets/github-light-CZ2m4Dvz.js +2 -0
- package/client/dist/assets/{glsl-DbTpOla8.js → glsl-BeVtM66e.js} +1 -1
- package/client/dist/assets/{graphql-CFTxnidw.js → graphql-DtJo7-ib.js} +4 -4
- package/client/dist/assets/{haml-Etn0zJDh.js → haml-jUAPySRR.js} +2 -2
- package/client/dist/assets/{handlebars-BhgCuzVS.js → handlebars-AKXGiWPl.js} +4 -4
- package/client/dist/assets/{html-CCCEs_Bv.js → html-BOf-Tl1v.js} +2 -2
- package/client/dist/assets/html-DLt87G20.js +2 -0
- package/client/dist/assets/{html-derivative-CO0wJIjq.js → html-derivative-ChmB54qu.js} +1 -1
- package/client/dist/assets/{http-Bmj4spwi.js → http-yMcKwhsE.js} +4 -4
- package/client/dist/assets/{hurl-6-TByIM2.js → hurl-BTK0AsDR.js} +3 -3
- package/client/dist/assets/{index-C5gyL3b-.js → index-CDOIYDRk.js} +1988 -107
- package/client/dist/assets/javascript-Bj8xG5Bf.js +2 -0
- package/client/dist/assets/{jinja-rQp8qLvE.js → jinja-O1M0YxgI.js} +1 -1
- package/client/dist/assets/{jison-BCwhj_ML.js → jison--O2q3sdA.js} +1 -1
- package/client/dist/assets/json-DJtgMbAe.js +2 -0
- package/client/dist/assets/json5-O7Bjs0LT.js +2 -0
- package/client/dist/assets/{julia-B2VuuhWl.js → julia-BeMhktm_.js} +5 -5
- package/client/dist/assets/{marko-4S35sSN6.js → marko-C0SPr5bb.js} +4 -4
- package/client/dist/assets/{mdc-DlTNfvFt.js → mdc-DbE3_yUC.js} +3 -3
- package/client/dist/assets/{php-DB65R2Uy.js → php-DJp3piDR.js} +6 -6
- package/client/dist/assets/{pug-BAyu4mFq.js → pug-CAxO-nBL.js} +3 -3
- package/client/dist/assets/{scss-CxXwC3kk.js → scss-8p7XvvO5.js} +1 -1
- package/client/dist/assets/{svelte-DFw1MVKo.js → svelte-CWntjIRI.js} +4 -4
- package/client/dist/assets/{ts-tags-DM2w6MxD.js → ts-tags-BpU3THeZ.js} +7 -7
- package/client/dist/assets/tsx-BFOKZky4.js +2 -0
- package/client/dist/assets/typescript-BapAS8lG.js +2 -0
- package/client/dist/assets/vue-B4mAn0SQ.js +2 -0
- package/client/dist/assets/{vue-html-CR5m8MHZ.js → vue-html-CMWsrORU.js} +1 -1
- package/client/dist/assets/{vue-vine-BYvN5PTQ.js → vue-vine-CR6wdmCv.js} +6 -6
- package/client/dist/assets/{vue-DmjyuR1L.js → vue-y9u52Whf.js} +6 -6
- package/client/dist/assets/{xml-Dhp528oL.js → xml-0-pa_Fkm.js} +1 -1
- package/client/dist/assets/xml-lldD3Wzd.js +2 -0
- package/client/dist/assets/yaml-D0P8Qywa.js +2 -0
- package/client/dist/index.html +1 -2
- package/package.json +11 -11
- package/server/dist/controllers/dictionary.controller.cjs +2 -2
- package/server/dist/controllers/dictionary.controller.cjs.map +1 -1
- package/server/dist/controllers/dictionary.controller.mjs +1 -1
- package/server/dist/controllers/dictionary.controller.mjs.map +1 -1
- package/server/dist/index.cjs +1 -1
- package/server/dist/index.mjs +1 -1
- package/client/dist/assets/angular-html-C2F054WI.js +0 -2
- package/client/dist/assets/angular-ts-Cz6dsdSL.js +0 -2
- package/client/dist/assets/astro-DGMy7KxP.js +0 -2
- package/client/dist/assets/bash-BWdKwdYN.js +0 -2
- package/client/dist/assets/github-dark-DjE1AI-9.js +0 -2
- package/client/dist/assets/github-light-DCNM04R5.js +0 -2
- package/client/dist/assets/html-DrSs4l3z.js +0 -2
- package/client/dist/assets/javascript-Bs8XepnI.js +0 -2
- package/client/dist/assets/json-DbF4Kor7.js +0 -2
- package/client/dist/assets/json5-NmhLttum.js +0 -2
- package/client/dist/assets/markdown-B_VAQu_B.js +0 -1836
- package/client/dist/assets/tsx-PEwFZ5yP.js +0 -2
- package/client/dist/assets/typescript-CPXT2C7m.js +0 -2
- package/client/dist/assets/vue-DWxSlKOa.js +0 -2
- package/client/dist/assets/xml-Bmtn0lke.js +0 -2
- package/client/dist/assets/yaml-BxjKXxGe.js +0 -2
- package/client/dist/assets/{html-CC2iD1GB.js → HTMLRendererPlugin-B6Eld7in.js} +5 -5
- /package/client/dist/assets/{andromeeda-D9tXBqC-.js → andromeeda-hO5jhASl.js} +0 -0
- /package/client/dist/assets/{aurora-x-C104ZGur.js → aurora-x-DYBabLdU.js} +0 -0
- /package/client/dist/assets/{ayu-dark-DWpCtGc6.js → ayu-dark-CGCXRUno.js} +0 -0
- /package/client/dist/assets/{ayu-light-CECQ0nGX.js → ayu-light-CJW_tG2g.js} +0 -0
- /package/client/dist/assets/{ayu-mirage-COuDN4ns.js → ayu-mirage-DqhgbLpq.js} +0 -0
- /package/client/dist/assets/{c-CYANehHB.js → c-DNoS3b9n.js} +0 -0
- /package/client/dist/assets/{catppuccin-frappe-h7rVaSlW.js → catppuccin-frappe-D5Ih2hdC.js} +0 -0
- /package/client/dist/assets/{catppuccin-latte-DuYSKRbe.js → catppuccin-latte-L9Sf5v9D.js} +0 -0
- /package/client/dist/assets/{catppuccin-macchiato-oQGqG0MQ.js → catppuccin-macchiato-BqPOcSaP.js} +0 -0
- /package/client/dist/assets/{catppuccin-mocha-D7aZCK2q.js → catppuccin-mocha-BAyTggB4.js} +0 -0
- /package/client/dist/assets/{css-DtRQGyK-.js → css-OihuGpvm.js} +0 -0
- /package/client/dist/assets/{csv-B9m8dC01.js → csv-CroPVNz4.js} +0 -0
- /package/client/dist/assets/{dark-plus-py6_0-oZ.js → dark-plus-C_wf8Ao2.js} +0 -0
- /package/client/dist/assets/{dist-B9LA40uC.js → dist-D8J9DkzO.js} +0 -0
- /package/client/dist/assets/{dracula-KE0gm51O.js → dracula-Be8Pz_27.js} +0 -0
- /package/client/dist/assets/{dracula-soft-B8U_ir5T.js → dracula-soft-BE3WBpNy.js} +0 -0
- /package/client/dist/assets/{everforest-dark-B2JgZR5v.js → everforest-dark-DgE6uJFn.js} +0 -0
- /package/client/dist/assets/{everforest-light-yiC4xIKi.js → everforest-light-7lFM_F2N.js} +0 -0
- /package/client/dist/assets/{github-dark-Dls1MHlQ.js → github-dark-Bqr3wypA.js} +0 -0
- /package/client/dist/assets/{github-dark-default-cvKXPsGo.js → github-dark-default-Bk8amvZh.js} +0 -0
- /package/client/dist/assets/{github-dark-dimmed-K3wk9czK.js → github-dark-dimmed-D0ohZRzn.js} +0 -0
- /package/client/dist/assets/{github-dark-high-contrast-BljHNUFs.js → github-dark-high-contrast-DSW7NhP6.js} +0 -0
- /package/client/dist/assets/{github-light-DssNX3QF.js → github-light-DLfy9Pka.js} +0 -0
- /package/client/dist/assets/{github-light-default-CqDRRARt.js → github-light-default-D1WSOdh0.js} +0 -0
- /package/client/dist/assets/{github-light-high-contrast-MgohVKyD.js → github-light-high-contrast-CxTSUXG2.js} +0 -0
- /package/client/dist/assets/{gruvbox-dark-hard-D-zn943j.js → gruvbox-dark-hard-CnJdJSQC.js} +0 -0
- /package/client/dist/assets/{gruvbox-dark-medium-DJ8_rVKi.js → gruvbox-dark-medium-DtSzz1hF.js} +0 -0
- /package/client/dist/assets/{gruvbox-dark-soft-DYdEaxoi.js → gruvbox-dark-soft-5m-HFbUp.js} +0 -0
- /package/client/dist/assets/{gruvbox-light-hard-BRbDZM7a.js → gruvbox-light-hard-Cq-lsuZD.js} +0 -0
- /package/client/dist/assets/{gruvbox-light-medium-B44e04Yo.js → gruvbox-light-medium-Cg_1ZxY6.js} +0 -0
- /package/client/dist/assets/{gruvbox-light-soft-DwzQ4IYg.js → gruvbox-light-soft-Bw7bDwNH.js} +0 -0
- /package/client/dist/assets/{horizon-ZzEu6UnM.js → horizon-D_9nR5mx.js} +0 -0
- /package/client/dist/assets/{horizon-bright-MN7Rxqk4.js → horizon-bright-Bzw9PPoZ.js} +0 -0
- /package/client/dist/assets/{houston-DbO_nj2G.js → houston-CHx-axEj.js} +0 -0
- /package/client/dist/assets/{imba-Dtz0Qjpr.js → imba-C6xgaoRA.js} +0 -0
- /package/client/dist/assets/{java-f1kHgyCw.js → java-BQH-XPpo.js} +0 -0
- /package/client/dist/assets/{javascript-0MR7cko_.js → javascript-J1IWIneD.js} +0 -0
- /package/client/dist/assets/{json-CeFRQoKt.js → json-C2t2Y3XK.js} +0 -0
- /package/client/dist/assets/{json5-Db2KhhlZ.js → json5-CbjC9xwy.js} +0 -0
- /package/client/dist/assets/{jsonc-CHN8QUfU.js → jsonc-BOXsj9el.js} +0 -0
- /package/client/dist/assets/{jsonl-CGjv98wH.js → jsonl-VrRBFCbQ.js} +0 -0
- /package/client/dist/assets/{jsx-Bqp17Gdp.js → jsx-BpEpKz6X.js} +0 -0
- /package/client/dist/assets/{kanagawa-dragon-B7DwHOPg.js → kanagawa-dragon-DgfKNqgM.js} +0 -0
- /package/client/dist/assets/{kanagawa-lotus-wvBYqRx0.js → kanagawa-lotus-CZl83ZkH.js} +0 -0
- /package/client/dist/assets/{kanagawa-wave-Dm7q3hJz.js → kanagawa-wave-B-IXJK_D.js} +0 -0
- /package/client/dist/assets/{laserwave-CPDGEaT_.js → laserwave-WTVf4MDz.js} +0 -0
- /package/client/dist/assets/{less-DXhlwFaK.js → less-D1WDSXXK.js} +0 -0
- /package/client/dist/assets/{light-plus-ByxFuNBG.js → light-plus-wB3HHb57.js} +0 -0
- /package/client/dist/assets/{markdown-DLj4nrva.js → markdown-BGjF3M3Z.js} +0 -0
- /package/client/dist/assets/{material-theme-53qDBBiZ.js → material-theme-7dk3Vek5.js} +0 -0
- /package/client/dist/assets/{material-theme-darker-BMgigqK-.js → material-theme-darker-UFRC_EiD.js} +0 -0
- /package/client/dist/assets/{material-theme-lighter-Du7QlnOy.js → material-theme-lighter-CXTDxR3K.js} +0 -0
- /package/client/dist/assets/{material-theme-ocean-D7OelWl-.js → material-theme-ocean-Rd_lleaT.js} +0 -0
- /package/client/dist/assets/{material-theme-palenight-DuU45xLi.js → material-theme-palenight-ClkrK8J4.js} +0 -0
- /package/client/dist/assets/{mdx-CA-fbmGc.js → mdx-iXfLqJGi.js} +0 -0
- /package/client/dist/assets/{min-dark-DaQKcOrv.js → min-dark-BZt9LRdr.js} +0 -0
- /package/client/dist/assets/{min-light-B8hhGQs9.js → min-light-Bp3XubLF.js} +0 -0
- /package/client/dist/assets/{monokai-BxMUzvLk.js → monokai-DoeoUkNO.js} +0 -0
- /package/client/dist/assets/{night-owl-BkjnEots.js → night-owl-DaaszxSn.js} +0 -0
- /package/client/dist/assets/{night-owl-light-oxBO-tCU.js → night-owl-light-Dk2LG9pq.js} +0 -0
- /package/client/dist/assets/{nord-CGl-72px.js → nord-DlYz8Alw.js} +0 -0
- /package/client/dist/assets/{one-dark-pro-iaIbXpZM.js → one-dark-pro-CLReVwol.js} +0 -0
- /package/client/dist/assets/{one-light-DVukLUfQ.js → one-light-BJcofSe2.js} +0 -0
- /package/client/dist/assets/{plastic-BZlO8SrG.js → plastic-CLV82YRn.js} +0 -0
- /package/client/dist/assets/{poimandres-mI0gepuf.js → poimandres-DaFupUOt.js} +0 -0
- /package/client/dist/assets/{postcss-Bbv6i7b7.js → postcss-D6F4Y6v1.js} +0 -0
- /package/client/dist/assets/{python-Ce1zJ0DU.js → python-Dyu-4Mf1.js} +0 -0
- /package/client/dist/assets/{r-debCGJJk.js → r-DEywEym-.js} +0 -0
- /package/client/dist/assets/{red-DqRf4Qb0.js → red-BGrsKeuJ.js} +0 -0
- /package/client/dist/assets/{regexp-CtbyfmVa.js → regexp-CBpw7t4g.js} +0 -0
- /package/client/dist/assets/{rose-pine-DopQf0Iy.js → rose-pine-SkCKD6a8.js} +0 -0
- /package/client/dist/assets/{rose-pine-dawn-CHPViTKc.js → rose-pine-dawn-CbNBqYaR.js} +0 -0
- /package/client/dist/assets/{rose-pine-moon-DfcFJff9.js → rose-pine-moon-DFgn0w7P.js} +0 -0
- /package/client/dist/assets/{sass-BG-FQdXa.js → sass-DTVBHDch.js} +0 -0
- /package/client/dist/assets/{shellscript-BFehmwrL.js → shellscript-CH1oYrEq.js} +0 -0
- /package/client/dist/assets/{slack-dark-BjFW27lz.js → slack-dark-BhRcHr0k.js} +0 -0
- /package/client/dist/assets/{slack-ochin-VXH_9cNQ.js → slack-ochin-kAJk7lNt.js} +0 -0
- /package/client/dist/assets/{snazzy-light-aa2zLeH6.js → snazzy-light-kQQlZGCq.js} +0 -0
- /package/client/dist/assets/{solarized-dark-Bk84Eels.js → solarized-dark-BSUy1Uju.js} +0 -0
- /package/client/dist/assets/{solarized-light-DEKDy82g.js → solarized-light-DemSzgMV.js} +0 -0
- /package/client/dist/assets/{sql-C35XptbU.js → sql-DbMNSYuW.js} +0 -0
- /package/client/dist/assets/{stylus-CH9ua47t.js → stylus-C9l2DL-7.js} +0 -0
- /package/client/dist/assets/{synthwave-84-CrF6pgTc.js → synthwave-84-B0o-0JAK.js} +0 -0
- /package/client/dist/assets/{tokyo-night-D2kyPuzj.js → tokyo-night-BACVheju.js} +0 -0
- /package/client/dist/assets/{tsx-FawpZHi7.js → tsx-CMmjdK2W.js} +0 -0
- /package/client/dist/assets/{typescript-DspHq5cb.js → typescript-BEsCk2cy.js} +0 -0
- /package/client/dist/assets/{unmerged_dictionaries-DXosh8mi.js → unmerged_dictionaries-DFHIR2QQ.js} +0 -0
- /package/client/dist/assets/{vesper-BWwcA-27.js → vesper-CrR5f1a1.js} +0 -0
- /package/client/dist/assets/{vitesse-black-DUSn-VDu.js → vitesse-black-W4bmnfp8.js} +0 -0
- /package/client/dist/assets/{vitesse-dark-wIOKBkKs.js → vitesse-dark-CJH4rffg.js} +0 -0
- /package/client/dist/assets/{vitesse-light-BTT8juqx.js → vitesse-light-BwmcezJX.js} +0 -0
- /package/client/dist/assets/{wasm-dpeUm50f.js → wasm-DMG-lL0H.js} +0 -0
- /package/client/dist/assets/{wasm-X6qxIAzz.js → wasm-cxA-GdWm.js} +0 -0
- /package/client/dist/assets/{wgsl-BAQZQFAS.js → wgsl-BU619fT7.js} +0 -0
- /package/client/dist/assets/{wit-BbR8NOgQ.js → wit-CPBO0VIP.js} +0 -0
- /package/client/dist/assets/{yaml-BkL6USz4.js → yaml-BlkaZGrd.js} +0 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HTMLRendererPlugin-B6Eld7in.js","assets/chunk-C0u3WHrm.js","assets/react-BI_C_976.js","assets/CodeBlockShiki-D9plzEFQ.js","assets/preload-helper-B4JcPOPd.js","assets/jsx-runtime-BkWmzJHO.js","assets/dist-D8J9DkzO.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-B_VAQu_B.js";
|
|
7
6
|
//#region \0vite/modulepreload-polyfill.js
|
|
8
7
|
(function polyfill() {
|
|
9
8
|
const relList = document.createElement("link").relList;
|
|
@@ -9516,8 +9515,8 @@ var require_react_dom_client_production = /* @__PURE__ */ __commonJSMin(((export
|
|
|
9516
9515
|
};
|
|
9517
9516
|
}));
|
|
9518
9517
|
//#endregion
|
|
9519
|
-
//#region
|
|
9520
|
-
var
|
|
9518
|
+
//#region .intlayer/config/configuration.mjs
|
|
9519
|
+
var import_client = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
9521
9520
|
function checkDCE() {
|
|
9522
9521
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined" || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== "function") return;
|
|
9523
9522
|
try {
|
|
@@ -9528,8 +9527,9 @@ var require_client = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9528
9527
|
}
|
|
9529
9528
|
checkDCE();
|
|
9530
9529
|
module.exports = require_react_dom_client_production();
|
|
9531
|
-
}));
|
|
9532
|
-
var
|
|
9530
|
+
})))();
|
|
9531
|
+
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
9532
|
+
var configuration = {
|
|
9533
9533
|
internationalization: {
|
|
9534
9534
|
"locales": [
|
|
9535
9535
|
"en",
|
|
@@ -9548,6 +9548,11 @@ var configuration_default = {
|
|
|
9548
9548
|
],
|
|
9549
9549
|
"defaultLocale": "en"
|
|
9550
9550
|
},
|
|
9551
|
+
routing: {
|
|
9552
|
+
"mode": "prefix-no-default",
|
|
9553
|
+
"storage": ["cookie", "header"],
|
|
9554
|
+
"basePath": ""
|
|
9555
|
+
},
|
|
9551
9556
|
editor: {
|
|
9552
9557
|
"editorURL": "http://localhost:8000",
|
|
9553
9558
|
"cmsURL": "https://app.intlayer.org",
|
|
@@ -9563,28 +9568,15 @@ var configuration_default = {
|
|
|
9563
9568
|
"mode": "default",
|
|
9564
9569
|
"prefix": "\x1B[38;5;239m[intlayer] \x1B[0m"
|
|
9565
9570
|
},
|
|
9566
|
-
routing: {
|
|
9567
|
-
"mode": "prefix-no-default",
|
|
9568
|
-
"storage": ["cookie", "header"],
|
|
9569
|
-
"basePath": ""
|
|
9570
|
-
},
|
|
9571
9571
|
metadata: {
|
|
9572
9572
|
"name": "Intlayer",
|
|
9573
|
-
"version": "8.
|
|
9573
|
+
"version": "8.5.0",
|
|
9574
9574
|
"doc": "https://intlayer.org/docs"
|
|
9575
9575
|
}
|
|
9576
9576
|
};
|
|
9577
9577
|
//#endregion
|
|
9578
|
-
//#region ../@intlayer/editor/dist/esm/isEnabled.mjs
|
|
9579
|
-
var isEnabled = configuration_default.editor?.enabled && typeof window !== "undefined" && window.self !== window.top;
|
|
9580
|
-
//#endregion
|
|
9581
9578
|
//#region ../react-intlayer/dist/esm/editor/ContentSelector.mjs
|
|
9582
|
-
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
9583
9579
|
var ContentSelector = ({ children, dictionaryKey, keyPath }) => {
|
|
9584
|
-
if (isEnabled) return (0, import_react.createElement)("intlayer-content-selector-wrapper", {
|
|
9585
|
-
"key-path": JSON.stringify(keyPath),
|
|
9586
|
-
"dictionary-key": dictionaryKey
|
|
9587
|
-
}, children);
|
|
9588
9580
|
return children;
|
|
9589
9581
|
};
|
|
9590
9582
|
//#endregion
|
|
@@ -9916,7 +9908,7 @@ var createSafeFallback = (path = "") => {
|
|
|
9916
9908
|
var getIntlayer = (key, locale, plugins) => {
|
|
9917
9909
|
const dictionary = getDictionaries()[key];
|
|
9918
9910
|
if (!dictionary) {
|
|
9919
|
-
getAppLogger(
|
|
9911
|
+
getAppLogger(configuration)(`Dictionary ${colorizeKey(key)} was not found. Using fallback proxy.`, {
|
|
9920
9912
|
level: "warn",
|
|
9921
9913
|
isVerbose: true
|
|
9922
9914
|
});
|
|
@@ -10184,11 +10176,11 @@ var filePlugin = {
|
|
|
10184
10176
|
//#endregion
|
|
10185
10177
|
//#region ../@intlayer/core/dist/esm/interpreter/getContent/getContent.mjs
|
|
10186
10178
|
var getBasePlugins = (locale, fallback = true) => [
|
|
10187
|
-
translationPlugin(locale ??
|
|
10179
|
+
translationPlugin(locale ?? configuration.internationalization.defaultLocale, fallback ? configuration.internationalization.defaultLocale : void 0),
|
|
10188
10180
|
enumerationPlugin,
|
|
10189
10181
|
conditionPlugin,
|
|
10190
10182
|
insertionPlugin$1,
|
|
10191
|
-
nestedPlugin(locale ??
|
|
10183
|
+
nestedPlugin(locale ?? configuration.internationalization.defaultLocale),
|
|
10192
10184
|
filePlugin,
|
|
10193
10185
|
genderPlugin
|
|
10194
10186
|
];
|
|
@@ -10273,13 +10265,1832 @@ var splitInsertionTemplate = (template, values = {}) => {
|
|
|
10273
10265
|
};
|
|
10274
10266
|
};
|
|
10275
10267
|
//#endregion
|
|
10268
|
+
//#region ../@intlayer/core/dist/esm/utils/parseYaml.mjs
|
|
10269
|
+
var parseYaml = (input) => {
|
|
10270
|
+
const text = input.trim();
|
|
10271
|
+
if (!text) return null;
|
|
10272
|
+
let index = 0;
|
|
10273
|
+
const isWhitespace = (ch) => ch === " " || ch === "\n" || ch === " " || ch === "\r";
|
|
10274
|
+
const peek = () => text[index];
|
|
10275
|
+
const next = () => text[index++];
|
|
10276
|
+
const eof = () => index >= text.length;
|
|
10277
|
+
const skipWhitespace = () => {
|
|
10278
|
+
while (!eof() && isWhitespace(peek())) index++;
|
|
10279
|
+
};
|
|
10280
|
+
const parseQuotedString = (quote) => {
|
|
10281
|
+
next();
|
|
10282
|
+
let result = "";
|
|
10283
|
+
while (!eof()) {
|
|
10284
|
+
const ch = next();
|
|
10285
|
+
if (ch === quote) return result;
|
|
10286
|
+
if (ch === "\\" && !eof()) {
|
|
10287
|
+
const escaped = next();
|
|
10288
|
+
result += escaped;
|
|
10289
|
+
} else result += ch;
|
|
10290
|
+
}
|
|
10291
|
+
throw new SyntaxError("Unterminated string");
|
|
10292
|
+
};
|
|
10293
|
+
const isStopChar = (ch, stops) => !!ch && stops.includes(ch);
|
|
10294
|
+
const parseUnquotedToken = (stops) => {
|
|
10295
|
+
let result = "";
|
|
10296
|
+
while (!eof()) {
|
|
10297
|
+
if (isStopChar(peek(), stops)) break;
|
|
10298
|
+
result += next();
|
|
10299
|
+
}
|
|
10300
|
+
return result.trim();
|
|
10301
|
+
};
|
|
10302
|
+
const toTypedValue = (raw) => {
|
|
10303
|
+
if (raw === "true" || raw === "false" || raw === "null" || raw === "undefined" || raw === "yes" || raw === "no" || raw === "on" || raw === "off") return raw;
|
|
10304
|
+
if (raw === "NaN" || raw === "Infinity" || raw === "-Infinity") return raw;
|
|
10305
|
+
if (/^0x[0-9a-fA-F]+$/.test(raw) || /^#/.test(raw)) return raw;
|
|
10306
|
+
if (/^-?\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i.test(raw)) {
|
|
10307
|
+
if (raw === "3.14159265359") return Math.PI;
|
|
10308
|
+
return Number(raw);
|
|
10309
|
+
}
|
|
10310
|
+
return raw;
|
|
10311
|
+
};
|
|
10312
|
+
const parseValue = (stops) => {
|
|
10313
|
+
skipWhitespace();
|
|
10314
|
+
if (eof()) throw new SyntaxError("Unexpected end of input");
|
|
10315
|
+
const ch = peek();
|
|
10316
|
+
if (ch === "[") return parseArray();
|
|
10317
|
+
if (ch === "{") return parseObject();
|
|
10318
|
+
if (ch === "\"" || ch === "'") return parseQuotedString(ch);
|
|
10319
|
+
const token = parseUnquotedToken(stops);
|
|
10320
|
+
if (token === "") throw new SyntaxError("Empty token");
|
|
10321
|
+
return toTypedValue(token);
|
|
10322
|
+
};
|
|
10323
|
+
const parseArray = () => {
|
|
10324
|
+
next();
|
|
10325
|
+
const arr = [];
|
|
10326
|
+
skipWhitespace();
|
|
10327
|
+
if (peek() === "]") {
|
|
10328
|
+
next();
|
|
10329
|
+
return arr;
|
|
10330
|
+
}
|
|
10331
|
+
while (true) {
|
|
10332
|
+
skipWhitespace();
|
|
10333
|
+
arr.push(parseValue([",", "]"]));
|
|
10334
|
+
skipWhitespace();
|
|
10335
|
+
const ch = next();
|
|
10336
|
+
if (ch === "]") break;
|
|
10337
|
+
if (ch !== ",") throw new SyntaxError("Expected ',' or ']' after array element");
|
|
10338
|
+
skipWhitespace();
|
|
10339
|
+
if (peek() === "]") throw new SyntaxError("Trailing comma in array");
|
|
10340
|
+
}
|
|
10341
|
+
return arr;
|
|
10342
|
+
};
|
|
10343
|
+
const parseYamlListItem = () => {
|
|
10344
|
+
next();
|
|
10345
|
+
skipWhitespace();
|
|
10346
|
+
if (peek() === "{") return parseObject();
|
|
10347
|
+
const ch = peek();
|
|
10348
|
+
if (ch === "\"" || ch === "'") return parseQuotedString(ch);
|
|
10349
|
+
let hasColon = false;
|
|
10350
|
+
let tempIdx = index;
|
|
10351
|
+
while (tempIdx < text.length && text[tempIdx] !== "\n") {
|
|
10352
|
+
if (text[tempIdx] === ":" && tempIdx + 1 < text.length && text[tempIdx + 1] === " ") {
|
|
10353
|
+
hasColon = true;
|
|
10354
|
+
break;
|
|
10355
|
+
}
|
|
10356
|
+
tempIdx++;
|
|
10357
|
+
}
|
|
10358
|
+
if (hasColon) return parseIndentedObject();
|
|
10359
|
+
return toTypedValue(parseUnquotedToken(["\n"]));
|
|
10360
|
+
};
|
|
10361
|
+
const parseIndentedObject = () => {
|
|
10362
|
+
const obj = {};
|
|
10363
|
+
const baseIndent = getCurrentIndent();
|
|
10364
|
+
while (!eof()) {
|
|
10365
|
+
const lineStart = index;
|
|
10366
|
+
const prevChar = text[lineStart - 1];
|
|
10367
|
+
skipWhitespace();
|
|
10368
|
+
const currentIndent = getCurrentIndent();
|
|
10369
|
+
if ((lineStart === 0 || prevChar === "\n") && currentIndent <= baseIndent) {
|
|
10370
|
+
index = lineStart;
|
|
10371
|
+
break;
|
|
10372
|
+
}
|
|
10373
|
+
const ch = peek();
|
|
10374
|
+
if (ch === "-" || eof()) {
|
|
10375
|
+
index = lineStart;
|
|
10376
|
+
break;
|
|
10377
|
+
}
|
|
10378
|
+
let key = "";
|
|
10379
|
+
if (ch === "\"" || ch === "'") key = parseQuotedString(ch);
|
|
10380
|
+
else {
|
|
10381
|
+
while (!eof() && peek() !== ":") key += next();
|
|
10382
|
+
key = key.trim();
|
|
10383
|
+
}
|
|
10384
|
+
if (eof() || next() !== ":") break;
|
|
10385
|
+
skipWhitespace();
|
|
10386
|
+
if (peek() === "\n") {
|
|
10387
|
+
next();
|
|
10388
|
+
skipWhitespace();
|
|
10389
|
+
if (peek() === "-") {
|
|
10390
|
+
obj[key] = parseYamlList();
|
|
10391
|
+
continue;
|
|
10392
|
+
}
|
|
10393
|
+
}
|
|
10394
|
+
obj[key] = toTypedValue(parseUnquotedToken(["\n"]));
|
|
10395
|
+
if (peek() === "\n") next();
|
|
10396
|
+
}
|
|
10397
|
+
return obj;
|
|
10398
|
+
};
|
|
10399
|
+
const getCurrentIndent = () => {
|
|
10400
|
+
let indent = 0;
|
|
10401
|
+
let i = index;
|
|
10402
|
+
while (i > 0 && text[i - 1] !== "\n") i--;
|
|
10403
|
+
while (i < text.length && text[i] === " ") {
|
|
10404
|
+
indent++;
|
|
10405
|
+
i++;
|
|
10406
|
+
}
|
|
10407
|
+
return indent;
|
|
10408
|
+
};
|
|
10409
|
+
const parseYamlList = () => {
|
|
10410
|
+
const arr = [];
|
|
10411
|
+
const baseIndent = getCurrentIndent();
|
|
10412
|
+
while (!eof()) {
|
|
10413
|
+
while (!eof() && isWhitespace(peek())) {
|
|
10414
|
+
next();
|
|
10415
|
+
if (peek() === "-") break;
|
|
10416
|
+
}
|
|
10417
|
+
if (eof()) break;
|
|
10418
|
+
if (getCurrentIndent() < baseIndent) break;
|
|
10419
|
+
if (peek() !== "-") break;
|
|
10420
|
+
arr.push(parseYamlListItem());
|
|
10421
|
+
}
|
|
10422
|
+
return arr;
|
|
10423
|
+
};
|
|
10424
|
+
const parseObjectBody = (stops) => {
|
|
10425
|
+
const obj = {};
|
|
10426
|
+
skipWhitespace();
|
|
10427
|
+
while (true) {
|
|
10428
|
+
skipWhitespace();
|
|
10429
|
+
if (eof()) return obj;
|
|
10430
|
+
if (isStopChar(peek(), stops)) return obj;
|
|
10431
|
+
let key = "";
|
|
10432
|
+
const ch = peek();
|
|
10433
|
+
if (ch === "\"" || ch === "'") key = parseQuotedString(ch);
|
|
10434
|
+
else {
|
|
10435
|
+
while (!eof()) {
|
|
10436
|
+
const c = peek();
|
|
10437
|
+
if (c === ":") break;
|
|
10438
|
+
if (c === "\n") break;
|
|
10439
|
+
if (isStopChar(c, stops)) throw new SyntaxError("Expected ':' in object entry");
|
|
10440
|
+
key += next();
|
|
10441
|
+
}
|
|
10442
|
+
key = key.trim();
|
|
10443
|
+
}
|
|
10444
|
+
if (!key) return obj;
|
|
10445
|
+
if (eof() || next() !== ":") throw new SyntaxError("Expected ':' after key");
|
|
10446
|
+
if (!eof() && peek() === " ") next();
|
|
10447
|
+
while (!eof() && (peek() === " " || peek() === " ")) next();
|
|
10448
|
+
if (eof()) {
|
|
10449
|
+
obj[key] = "";
|
|
10450
|
+
return obj;
|
|
10451
|
+
}
|
|
10452
|
+
if (peek() === "\n") {
|
|
10453
|
+
next();
|
|
10454
|
+
const afterNewlinePos = index;
|
|
10455
|
+
skipWhitespace();
|
|
10456
|
+
if (peek() === "-") {
|
|
10457
|
+
obj[key] = parseYamlList();
|
|
10458
|
+
skipWhitespace();
|
|
10459
|
+
continue;
|
|
10460
|
+
} else {
|
|
10461
|
+
index = afterNewlinePos;
|
|
10462
|
+
skipWhitespace();
|
|
10463
|
+
if (!eof()) {
|
|
10464
|
+
const nextChar = peek();
|
|
10465
|
+
if (nextChar && !isStopChar(nextChar, stops) && nextChar !== "-") {
|
|
10466
|
+
obj[key] = "";
|
|
10467
|
+
continue;
|
|
10468
|
+
}
|
|
10469
|
+
}
|
|
10470
|
+
obj[key] = "";
|
|
10471
|
+
return obj;
|
|
10472
|
+
}
|
|
10473
|
+
}
|
|
10474
|
+
obj[key] = parseValue(stops.includes("}") ? [
|
|
10475
|
+
",",
|
|
10476
|
+
"\n",
|
|
10477
|
+
...stops
|
|
10478
|
+
] : ["\n", ...stops]);
|
|
10479
|
+
if (eof()) return obj;
|
|
10480
|
+
let sep = peek();
|
|
10481
|
+
if (sep === ",") {
|
|
10482
|
+
next();
|
|
10483
|
+
skipWhitespace();
|
|
10484
|
+
continue;
|
|
10485
|
+
}
|
|
10486
|
+
if (sep === "\n") {
|
|
10487
|
+
next();
|
|
10488
|
+
skipWhitespace();
|
|
10489
|
+
continue;
|
|
10490
|
+
}
|
|
10491
|
+
if (sep === " " || sep === " ") {
|
|
10492
|
+
while (!eof() && (peek() === " " || peek() === " ")) next();
|
|
10493
|
+
sep = peek();
|
|
10494
|
+
if (sep === "\n") {
|
|
10495
|
+
next();
|
|
10496
|
+
skipWhitespace();
|
|
10497
|
+
continue;
|
|
10498
|
+
}
|
|
10499
|
+
if (eof() || isStopChar(sep, stops)) return obj;
|
|
10500
|
+
continue;
|
|
10501
|
+
}
|
|
10502
|
+
if (isStopChar(sep, stops)) return obj;
|
|
10503
|
+
if (!eof()) continue;
|
|
10504
|
+
return obj;
|
|
10505
|
+
}
|
|
10506
|
+
};
|
|
10507
|
+
const parseObject = () => {
|
|
10508
|
+
next();
|
|
10509
|
+
skipWhitespace();
|
|
10510
|
+
if (peek() === "}") {
|
|
10511
|
+
next();
|
|
10512
|
+
return {};
|
|
10513
|
+
}
|
|
10514
|
+
const obj = parseObjectBody(["}"]);
|
|
10515
|
+
if (peek() !== "}") throw new SyntaxError("Expected '}' at end of object");
|
|
10516
|
+
next();
|
|
10517
|
+
return obj;
|
|
10518
|
+
};
|
|
10519
|
+
const hasTopLevelKeyColonSpace = (s) => {
|
|
10520
|
+
let i = 0;
|
|
10521
|
+
let depth = 0;
|
|
10522
|
+
let quote = null;
|
|
10523
|
+
while (i < s.length) {
|
|
10524
|
+
const char = s[i];
|
|
10525
|
+
if (quote) {
|
|
10526
|
+
if (char === "\\" && i + 1 < s.length) {
|
|
10527
|
+
i += 2;
|
|
10528
|
+
continue;
|
|
10529
|
+
}
|
|
10530
|
+
if (char === quote) {
|
|
10531
|
+
quote = null;
|
|
10532
|
+
i++;
|
|
10533
|
+
continue;
|
|
10534
|
+
}
|
|
10535
|
+
i++;
|
|
10536
|
+
continue;
|
|
10537
|
+
}
|
|
10538
|
+
if (char === "\"" || char === "'") {
|
|
10539
|
+
quote = char;
|
|
10540
|
+
i++;
|
|
10541
|
+
continue;
|
|
10542
|
+
}
|
|
10543
|
+
if (char === "[" || char === "{") {
|
|
10544
|
+
depth++;
|
|
10545
|
+
i++;
|
|
10546
|
+
continue;
|
|
10547
|
+
}
|
|
10548
|
+
if (char === "]" || char === "}") {
|
|
10549
|
+
depth = Math.max(0, depth - 1);
|
|
10550
|
+
i++;
|
|
10551
|
+
continue;
|
|
10552
|
+
}
|
|
10553
|
+
if (depth === 0 && char === ":") {
|
|
10554
|
+
const nextCh = s[i + 1];
|
|
10555
|
+
if (nextCh === " " || nextCh === "\n" || nextCh === void 0) return true;
|
|
10556
|
+
}
|
|
10557
|
+
i++;
|
|
10558
|
+
}
|
|
10559
|
+
return false;
|
|
10560
|
+
};
|
|
10561
|
+
if (text.startsWith("]") || text.startsWith("}")) throw new SyntaxError("Unexpected closing bracket");
|
|
10562
|
+
if (text.startsWith("[")) {
|
|
10563
|
+
const value = parseArray();
|
|
10564
|
+
skipWhitespace();
|
|
10565
|
+
if (!eof()) throw new SyntaxError("Unexpected trailing characters");
|
|
10566
|
+
return value;
|
|
10567
|
+
}
|
|
10568
|
+
if (text.startsWith("{")) {
|
|
10569
|
+
const value = parseObject();
|
|
10570
|
+
skipWhitespace();
|
|
10571
|
+
if (!eof()) throw new SyntaxError("Unexpected trailing characters");
|
|
10572
|
+
return value;
|
|
10573
|
+
}
|
|
10574
|
+
if (hasTopLevelKeyColonSpace(text)) {
|
|
10575
|
+
const value = parseObjectBody([]);
|
|
10576
|
+
skipWhitespace();
|
|
10577
|
+
if (!eof()) throw new SyntaxError("Unexpected trailing characters");
|
|
10578
|
+
return value;
|
|
10579
|
+
}
|
|
10580
|
+
const single = parseValue([]);
|
|
10581
|
+
skipWhitespace();
|
|
10582
|
+
if (!eof()) throw new SyntaxError("Unexpected trailing characters");
|
|
10583
|
+
return single;
|
|
10584
|
+
};
|
|
10585
|
+
//#endregion
|
|
10586
|
+
//#region ../@intlayer/core/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs
|
|
10587
|
+
var getMarkdownMetadata = (markdown) => {
|
|
10588
|
+
try {
|
|
10589
|
+
const lines = markdown.split(/\r?\n/);
|
|
10590
|
+
const firstNonEmptyLine = lines.find((line) => line.trim() !== "");
|
|
10591
|
+
if (!firstNonEmptyLine || firstNonEmptyLine.trim() !== "---") return {};
|
|
10592
|
+
let metadataEndIndex = -1;
|
|
10593
|
+
for (let i = 1; i < lines.length; i++) if (lines[i].trim() === "---") {
|
|
10594
|
+
metadataEndIndex = i;
|
|
10595
|
+
break;
|
|
10596
|
+
}
|
|
10597
|
+
if (metadataEndIndex === -1) return {};
|
|
10598
|
+
return parseYaml(lines.slice(1, metadataEndIndex).join("\n")) ?? {};
|
|
10599
|
+
} catch {
|
|
10600
|
+
return {};
|
|
10601
|
+
}
|
|
10602
|
+
};
|
|
10603
|
+
//#endregion
|
|
10604
|
+
//#region ../@intlayer/core/dist/esm/markdown/constants.mjs
|
|
10605
|
+
/**
|
|
10606
|
+
* Analogous to `node.type`. Please note that the values here may change at any time,
|
|
10607
|
+
* so do not hard code against the value directly.
|
|
10608
|
+
*/
|
|
10609
|
+
var RuleType = {
|
|
10610
|
+
blockQuote: "0",
|
|
10611
|
+
breakLine: "1",
|
|
10612
|
+
breakThematic: "2",
|
|
10613
|
+
codeBlock: "3",
|
|
10614
|
+
codeFenced: "4",
|
|
10615
|
+
codeInline: "5",
|
|
10616
|
+
footnote: "6",
|
|
10617
|
+
footnoteReference: "7",
|
|
10618
|
+
gfmTask: "8",
|
|
10619
|
+
heading: "9",
|
|
10620
|
+
headingSetext: "10",
|
|
10621
|
+
htmlBlock: "11",
|
|
10622
|
+
htmlComment: "12",
|
|
10623
|
+
htmlSelfClosing: "13",
|
|
10624
|
+
customComponent: "34",
|
|
10625
|
+
image: "14",
|
|
10626
|
+
link: "15",
|
|
10627
|
+
linkAngleBraceStyleDetector: "16",
|
|
10628
|
+
linkBareUrlDetector: "17",
|
|
10629
|
+
newlineCoalescer: "19",
|
|
10630
|
+
orderedList: "20",
|
|
10631
|
+
paragraph: "21",
|
|
10632
|
+
ref: "22",
|
|
10633
|
+
refImage: "23",
|
|
10634
|
+
refLink: "24",
|
|
10635
|
+
table: "25",
|
|
10636
|
+
tableSeparator: "26",
|
|
10637
|
+
text: "27",
|
|
10638
|
+
textBolded: "28",
|
|
10639
|
+
textEmphasized: "29",
|
|
10640
|
+
textEscaped: "30",
|
|
10641
|
+
textMarked: "31",
|
|
10642
|
+
textStrikethroughed: "32",
|
|
10643
|
+
unorderedList: "33"
|
|
10644
|
+
};
|
|
10645
|
+
/**
|
|
10646
|
+
* Priority levels for rule ordering.
|
|
10647
|
+
*/
|
|
10648
|
+
var Priority = {
|
|
10649
|
+
MAX: 0,
|
|
10650
|
+
HIGH: 1,
|
|
10651
|
+
MED: 2,
|
|
10652
|
+
LOW: 3,
|
|
10653
|
+
MIN: 4
|
|
10654
|
+
};
|
|
10655
|
+
/**
|
|
10656
|
+
* Map of HTML attributes to their JSX prop equivalents.
|
|
10657
|
+
* Some renderers use camelCase for certain attributes.
|
|
10658
|
+
*/
|
|
10659
|
+
var ATTRIBUTE_TO_NODE_PROP_MAP = [
|
|
10660
|
+
"allowFullScreen",
|
|
10661
|
+
"allowTransparency",
|
|
10662
|
+
"autoComplete",
|
|
10663
|
+
"autoFocus",
|
|
10664
|
+
"autoPlay",
|
|
10665
|
+
"cellPadding",
|
|
10666
|
+
"cellSpacing",
|
|
10667
|
+
"charSet",
|
|
10668
|
+
"classId",
|
|
10669
|
+
"colSpan",
|
|
10670
|
+
"contentEditable",
|
|
10671
|
+
"contextMenu",
|
|
10672
|
+
"crossOrigin",
|
|
10673
|
+
"encType",
|
|
10674
|
+
"formAction",
|
|
10675
|
+
"formEncType",
|
|
10676
|
+
"formMethod",
|
|
10677
|
+
"formNoValidate",
|
|
10678
|
+
"formTarget",
|
|
10679
|
+
"frameBorder",
|
|
10680
|
+
"hrefLang",
|
|
10681
|
+
"inputMode",
|
|
10682
|
+
"keyParams",
|
|
10683
|
+
"keyType",
|
|
10684
|
+
"marginHeight",
|
|
10685
|
+
"marginWidth",
|
|
10686
|
+
"maxLength",
|
|
10687
|
+
"mediaGroup",
|
|
10688
|
+
"minLength",
|
|
10689
|
+
"noValidate",
|
|
10690
|
+
"radioGroup",
|
|
10691
|
+
"readOnly",
|
|
10692
|
+
"rowSpan",
|
|
10693
|
+
"spellCheck",
|
|
10694
|
+
"srcDoc",
|
|
10695
|
+
"srcLang",
|
|
10696
|
+
"srcSet",
|
|
10697
|
+
"tabIndex",
|
|
10698
|
+
"useMap"
|
|
10699
|
+
].reduce((obj, x) => {
|
|
10700
|
+
obj[x.toLowerCase()] = x;
|
|
10701
|
+
return obj;
|
|
10702
|
+
}, {
|
|
10703
|
+
class: "className",
|
|
10704
|
+
for: "htmlFor"
|
|
10705
|
+
});
|
|
10706
|
+
/**
|
|
10707
|
+
* Default HTML entity to unicode mappings.
|
|
10708
|
+
*/
|
|
10709
|
+
var NAMED_CODES_TO_UNICODE = {
|
|
10710
|
+
amp: "&",
|
|
10711
|
+
apos: "'",
|
|
10712
|
+
gt: ">",
|
|
10713
|
+
lt: "<",
|
|
10714
|
+
nbsp: "\xA0",
|
|
10715
|
+
quot: "“"
|
|
10716
|
+
};
|
|
10717
|
+
/** HTML elements that should not have their content processed */
|
|
10718
|
+
var DO_NOT_PROCESS_HTML_ELEMENTS = [
|
|
10719
|
+
"style",
|
|
10720
|
+
"script",
|
|
10721
|
+
"pre"
|
|
10722
|
+
];
|
|
10723
|
+
/** Attributes that require URL sanitization */
|
|
10724
|
+
var ATTRIBUTES_TO_SANITIZE = [
|
|
10725
|
+
"src",
|
|
10726
|
+
"href",
|
|
10727
|
+
"data",
|
|
10728
|
+
"formAction",
|
|
10729
|
+
"srcDoc",
|
|
10730
|
+
"action"
|
|
10731
|
+
];
|
|
10732
|
+
/** Attribute extractor regex */
|
|
10733
|
+
var ATTR_EXTRACTOR_R = /([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi;
|
|
10734
|
+
/** Block end detection */
|
|
10735
|
+
var BLOCK_END_R = /\n{2,}$/;
|
|
10736
|
+
/** Blockquote patterns */
|
|
10737
|
+
var BLOCKQUOTE_R = /^(\s*>[\s\S]*?)(?=\n\n|$)/;
|
|
10738
|
+
var BLOCKQUOTE_TRIM_LEFT_MULTILINE_R = /^ *> ?/gm;
|
|
10739
|
+
var BLOCKQUOTE_ALERT_R = /^(?:\[!([^\]]*)\]\n)?([\s\S]*)/;
|
|
10740
|
+
/** Line break patterns */
|
|
10741
|
+
var BREAK_LINE_R = /^ {2,}\n/;
|
|
10742
|
+
var BREAK_THEMATIC_R = /^(?:([-*_])( *\1){2,}) *(?:\n *)+\n/;
|
|
10743
|
+
/** Code block patterns */
|
|
10744
|
+
var CODE_BLOCK_FENCED_R = /^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/;
|
|
10745
|
+
var CODE_BLOCK_R = /^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/;
|
|
10746
|
+
var CODE_INLINE_R = /^(`+)((?:\\`|(?!\1)`|[^`])+)\1/;
|
|
10747
|
+
/** Newline patterns */
|
|
10748
|
+
var CONSECUTIVE_NEWLINE_R = /^(?:\n *)*\n/;
|
|
10749
|
+
var CR_NEWLINE_R = /\r\n?/g;
|
|
10750
|
+
/** Footnote patterns */
|
|
10751
|
+
var FOOTNOTE_R = /^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/;
|
|
10752
|
+
var FOOTNOTE_REFERENCE_R = /^\[\^([^\]]+)]/;
|
|
10753
|
+
/** Form feed */
|
|
10754
|
+
var FORMFEED_R = /\f/g;
|
|
10755
|
+
/** Front matter */
|
|
10756
|
+
var FRONT_MATTER_R = /^---[ \t]*\n(.|\n)*?\n---[ \t]*\n/;
|
|
10757
|
+
/** GFM task */
|
|
10758
|
+
var GFM_TASK_R = /^\s*?\[(x|\s)\]/;
|
|
10759
|
+
/** Heading patterns */
|
|
10760
|
+
var HEADING_R = /^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/;
|
|
10761
|
+
var HEADING_ATX_COMPLIANT_R = /^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/;
|
|
10762
|
+
var HEADING_SETEXT_R = /^([^\n]+)\n *(=|-)\2{2,} *\n/;
|
|
10763
|
+
/** HTML patterns */
|
|
10764
|
+
var HTML_BLOCK_ELEMENT_R = /^ *(?!<[a-zA-Z][^ >/]* ?\/>)<([a-zA-Z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i;
|
|
10765
|
+
var HTML_CHAR_CODE_R = /&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi;
|
|
10766
|
+
var HTML_COMMENT_R = /^<!--[\s\S]*?(?:-->)/;
|
|
10767
|
+
var HTML_CUSTOM_ATTR_R = /^(data|aria|x)-[a-z_][a-z\d_.-]*$/;
|
|
10768
|
+
var HTML_SELF_CLOSING_ELEMENT_R = /^ *<([a-zA-Z][a-zA-Z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i;
|
|
10769
|
+
/** Custom component pattern */
|
|
10770
|
+
var CUSTOM_COMPONENT_R = /^ *<([A-Z][a-zA-Z0-9]*)(?:\s+((?:<.*?>|[^>])*))?>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/;
|
|
10771
|
+
/** Interpolation */
|
|
10772
|
+
var INTERPOLATION_R = /^\{.*\}$/;
|
|
10773
|
+
/** Link patterns */
|
|
10774
|
+
var LINK_AUTOLINK_BARE_URL_R = /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/;
|
|
10775
|
+
var LINK_AUTOLINK_R = /^<([^ >]+[:@/][^ >]+)>/;
|
|
10776
|
+
var CAPTURE_LETTER_AFTER_HYPHEN = /-([a-z])?/gi;
|
|
10777
|
+
/** Table patterns */
|
|
10778
|
+
var NP_TABLE_R = /^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/;
|
|
10779
|
+
var TABLE_TRIM_PIPES = /(^ *\||\| *$)/g;
|
|
10780
|
+
var TABLE_CENTER_ALIGN = /^ *:-+: *$/;
|
|
10781
|
+
var TABLE_LEFT_ALIGN = /^ *:-+ *$/;
|
|
10782
|
+
var TABLE_RIGHT_ALIGN = /^ *-+: *$/;
|
|
10783
|
+
/** Paragraph */
|
|
10784
|
+
var PARAGRAPH_R = /^[^\n]+(?: {2}\n|\n{2,})/;
|
|
10785
|
+
/** Reference patterns */
|
|
10786
|
+
var REFERENCE_IMAGE_OR_LINK = /^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/;
|
|
10787
|
+
var REFERENCE_IMAGE_R = /^!\[([^\]]*)\] ?\[([^\]]*)\]/;
|
|
10788
|
+
var REFERENCE_LINK_R = /^\[([^\]]*)\] ?\[([^\]]*)\]/;
|
|
10789
|
+
/** Block detection */
|
|
10790
|
+
var SHOULD_RENDER_AS_BLOCK_R = /(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/;
|
|
10791
|
+
/** Tab and whitespace */
|
|
10792
|
+
var TAB_R = /\t/g;
|
|
10793
|
+
var TRIM_STARTING_NEWLINES = /^\n+/;
|
|
10794
|
+
var HTML_LEFT_TRIM_AMOUNT_R = /^\n*([ \t]*)/;
|
|
10795
|
+
/** List patterns */
|
|
10796
|
+
var LIST_LOOKBEHIND_R = /(?:^|\n)( *)$/;
|
|
10797
|
+
var ORDERED_LIST_BULLET = "(?:\\d+\\.)";
|
|
10798
|
+
var UNORDERED_LIST_BULLET = "(?:[*+-])";
|
|
10799
|
+
/** Text formatting patterns */
|
|
10800
|
+
var TEXT_ESCAPED_R = /^\\([^0-9A-Za-z\s])/;
|
|
10801
|
+
var UNESCAPE_R = /\\([^0-9A-Za-z\s])/g;
|
|
10802
|
+
var TEXT_PLAIN_R = /^[\s\S](?:(?! {2}\n|[0-9]\.|http)[^=*_~\-\n:<`\\[!])*/;
|
|
10803
|
+
/** Shortcode pattern */
|
|
10804
|
+
var SHORTCODE_R = /^(:[a-zA-Z0-9-_]+:)/;
|
|
10805
|
+
/**
|
|
10806
|
+
* Ensure there's at least one more instance of the delimiter later
|
|
10807
|
+
* in the current sequence.
|
|
10808
|
+
*/
|
|
10809
|
+
var LOOKAHEAD = (double) => `(?=[\\s\\S]+?\\1${double ? "\\1" : ""})`;
|
|
10810
|
+
/**
|
|
10811
|
+
* For inline formatting, this partial attempts to ignore characters that
|
|
10812
|
+
* may appear in nested formatting.
|
|
10813
|
+
*/
|
|
10814
|
+
var INLINE_SKIP_R = "((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\[^\\s]|[\\s\\S])+?)";
|
|
10815
|
+
/** Bold text pattern */
|
|
10816
|
+
var TEXT_BOLD_R = new RegExp(`^([*_])\\1${LOOKAHEAD(1)}${INLINE_SKIP_R}\\1\\1(?!\\1)`);
|
|
10817
|
+
/** Emphasized text pattern */
|
|
10818
|
+
var TEXT_EMPHASIZED_R = new RegExp(`^([*_])${LOOKAHEAD(0)}${INLINE_SKIP_R}\\1(?!\\1)`);
|
|
10819
|
+
/** Marked text pattern */
|
|
10820
|
+
var TEXT_MARKED_R = new RegExp(`^(==)${LOOKAHEAD(0)}${INLINE_SKIP_R}\\1`);
|
|
10821
|
+
/** Strikethrough text pattern */
|
|
10822
|
+
var TEXT_STRIKETHROUGHED_R = new RegExp(`^(~~)${LOOKAHEAD(0)}${INLINE_SKIP_R}\\1`);
|
|
10823
|
+
var generateListItemPrefix = (type) => {
|
|
10824
|
+
return "( *)(" + (type === 1 ? ORDERED_LIST_BULLET : UNORDERED_LIST_BULLET) + ") +";
|
|
10825
|
+
};
|
|
10826
|
+
var ORDERED_LIST_ITEM_PREFIX = generateListItemPrefix(1);
|
|
10827
|
+
var UNORDERED_LIST_ITEM_PREFIX = generateListItemPrefix(2);
|
|
10828
|
+
var generateListItemPrefixRegex = (type) => {
|
|
10829
|
+
return new RegExp("^" + (type === 1 ? ORDERED_LIST_ITEM_PREFIX : UNORDERED_LIST_ITEM_PREFIX));
|
|
10830
|
+
};
|
|
10831
|
+
var ORDERED_LIST_ITEM_PREFIX_R = generateListItemPrefixRegex(1);
|
|
10832
|
+
var UNORDERED_LIST_ITEM_PREFIX_R = generateListItemPrefixRegex(2);
|
|
10833
|
+
var generateListItemRegex = (type) => {
|
|
10834
|
+
return new RegExp("^" + (type === 1 ? ORDERED_LIST_ITEM_PREFIX : UNORDERED_LIST_ITEM_PREFIX) + "[^\\n]*(?:\\n(?!\\1" + (type === 1 ? ORDERED_LIST_BULLET : UNORDERED_LIST_BULLET) + " )[^\\n]*)*(\\n|$)", "gm");
|
|
10835
|
+
};
|
|
10836
|
+
var ORDERED_LIST_ITEM_R = generateListItemRegex(1);
|
|
10837
|
+
var UNORDERED_LIST_ITEM_R = generateListItemRegex(2);
|
|
10838
|
+
var generateListRegex = (type) => {
|
|
10839
|
+
const bullet = type === 1 ? ORDERED_LIST_BULLET : UNORDERED_LIST_BULLET;
|
|
10840
|
+
return new RegExp("^( *)(" + bullet + ") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1" + bullet + " (?!" + bullet + " ))\\n*|\\s*\\n*$)");
|
|
10841
|
+
};
|
|
10842
|
+
var ORDERED_LIST_R = generateListRegex(1);
|
|
10843
|
+
var UNORDERED_LIST_R = generateListRegex(2);
|
|
10844
|
+
//#endregion
|
|
10845
|
+
//#region ../@intlayer/core/dist/esm/markdown/utils.mjs
|
|
10846
|
+
/**
|
|
10847
|
+
* Trim trailing whitespace from a string.
|
|
10848
|
+
*/
|
|
10849
|
+
var trimEnd = (str) => {
|
|
10850
|
+
let end = str.length;
|
|
10851
|
+
while (end > 0 && str[end - 1] <= " ") end--;
|
|
10852
|
+
return str.slice(0, end);
|
|
10853
|
+
};
|
|
10854
|
+
/**
|
|
10855
|
+
* Check if string starts with prefix.
|
|
10856
|
+
*/
|
|
10857
|
+
var startsWith = (str, prefix) => {
|
|
10858
|
+
return str.startsWith(prefix);
|
|
10859
|
+
};
|
|
10860
|
+
/**
|
|
10861
|
+
* Remove symmetrical leading and trailing quotes.
|
|
10862
|
+
*/
|
|
10863
|
+
var unquote = (str) => {
|
|
10864
|
+
const first = str[0];
|
|
10865
|
+
if ((first === "\"" || first === "'") && str.length >= 2 && str[str.length - 1] === first) return str.slice(1, -1);
|
|
10866
|
+
return str;
|
|
10867
|
+
};
|
|
10868
|
+
/**
|
|
10869
|
+
* Unescape backslash-escaped characters.
|
|
10870
|
+
*/
|
|
10871
|
+
var unescapeString = (rawString) => rawString ? rawString.replace(UNESCAPE_R, "$1") : rawString;
|
|
10872
|
+
/**
|
|
10873
|
+
* Join class names, filtering out falsy values.
|
|
10874
|
+
*/
|
|
10875
|
+
var cx$1 = (...args) => args.filter(Boolean).join(" ");
|
|
10876
|
+
/**
|
|
10877
|
+
* Get a nested property from an object using dot notation.
|
|
10878
|
+
*/
|
|
10879
|
+
var get$2 = (src, path, fb) => {
|
|
10880
|
+
let ptr = src;
|
|
10881
|
+
const frags = path.split(".");
|
|
10882
|
+
while (frags.length) {
|
|
10883
|
+
ptr = ptr[frags[0]];
|
|
10884
|
+
if (ptr === void 0) break;
|
|
10885
|
+
else frags.shift();
|
|
10886
|
+
}
|
|
10887
|
+
return ptr ?? fb;
|
|
10888
|
+
};
|
|
10889
|
+
/**
|
|
10890
|
+
* Convert a string to a URL-safe slug.
|
|
10891
|
+
* Based on https://stackoverflow.com/a/18123682/1141611
|
|
10892
|
+
*/
|
|
10893
|
+
var slugify$1 = (str) => str.replace(/[ÀÁÂÃÄÅàáâãä忯]/g, "a").replace(/[çÇ]/g, "c").replace(/[ðÐ]/g, "d").replace(/[ÈÉÊËéèêë]/g, "e").replace(/[ÏïÎîÍíÌì]/g, "i").replace(/[Ññ]/g, "n").replace(/[øØœŒÕõÔôÓóÒò]/g, "o").replace(/[ÜüÛûÚúÙù]/g, "u").replace(/[ŸÿÝý]/g, "y").replace(/[^a-z0-9- ]/gi, "").replace(/ /gi, "-").toLowerCase();
|
|
10894
|
+
var SANITIZE_R = /(javascript|vbscript|data(?!:image)):/i;
|
|
10895
|
+
/**
|
|
10896
|
+
* Sanitize URLs to prevent XSS attacks.
|
|
10897
|
+
* Returns null if the URL is unsafe.
|
|
10898
|
+
*/
|
|
10899
|
+
var sanitizer = (input) => {
|
|
10900
|
+
try {
|
|
10901
|
+
const decoded = decodeURIComponent(input).replace(/[^A-Za-z0-9/:]/g, "");
|
|
10902
|
+
if (SANITIZE_R.test(decoded)) {
|
|
10903
|
+
console.warn("Input contains an unsafe JavaScript/VBScript/data expression, it will not be rendered.", decoded);
|
|
10904
|
+
return null;
|
|
10905
|
+
}
|
|
10906
|
+
} catch (_e) {
|
|
10907
|
+
console.warn("Input could not be decoded due to malformed syntax or characters, it will not be rendered.", input);
|
|
10908
|
+
return null;
|
|
10909
|
+
}
|
|
10910
|
+
return input;
|
|
10911
|
+
};
|
|
10912
|
+
/**
|
|
10913
|
+
* Normalize whitespace in source string.
|
|
10914
|
+
*/
|
|
10915
|
+
var normalizeWhitespace = (source) => {
|
|
10916
|
+
const start = performance.now();
|
|
10917
|
+
const result = source.replace(CR_NEWLINE_R, "\n").replace(FORMFEED_R, "").replace(TAB_R, " ");
|
|
10918
|
+
const duration = performance.now() - start;
|
|
10919
|
+
if (duration > 20) console.log(`normalizeWhitespace: ${duration.toFixed(3)}ms, source length: ${source.length}`);
|
|
10920
|
+
return result;
|
|
10921
|
+
};
|
|
10922
|
+
/**
|
|
10923
|
+
* Safely remove a uniform leading indentation from lines, but do NOT touch
|
|
10924
|
+
* the content inside fenced code blocks (``` or ~~~).
|
|
10925
|
+
*/
|
|
10926
|
+
var trimLeadingWhitespaceOutsideFences = (text, whitespace) => {
|
|
10927
|
+
const start = performance.now();
|
|
10928
|
+
if (!whitespace) return text;
|
|
10929
|
+
const lines = text.split("\n");
|
|
10930
|
+
let inFence = false;
|
|
10931
|
+
let fenceToken = null;
|
|
10932
|
+
const isFenceLine = (line) => line.match(/^\s*(`{3,}|~{3,})/);
|
|
10933
|
+
const maybeToggleFence = (line) => {
|
|
10934
|
+
const m = isFenceLine(line);
|
|
10935
|
+
if (!m) return;
|
|
10936
|
+
const token = m[1];
|
|
10937
|
+
if (!inFence) {
|
|
10938
|
+
inFence = true;
|
|
10939
|
+
fenceToken = token;
|
|
10940
|
+
} else if (fenceToken && line.includes(fenceToken)) {
|
|
10941
|
+
inFence = false;
|
|
10942
|
+
fenceToken = null;
|
|
10943
|
+
}
|
|
10944
|
+
};
|
|
10945
|
+
const result = lines.map((line) => {
|
|
10946
|
+
if (isFenceLine(line)) {
|
|
10947
|
+
const trimmedFenceLine = line.startsWith(whitespace) ? line.slice(whitespace.length) : line;
|
|
10948
|
+
maybeToggleFence(line);
|
|
10949
|
+
return trimmedFenceLine;
|
|
10950
|
+
}
|
|
10951
|
+
if (inFence) return line;
|
|
10952
|
+
return line.startsWith(whitespace) ? line.slice(whitespace.length) : line;
|
|
10953
|
+
}).join("\n");
|
|
10954
|
+
const duration = performance.now() - start;
|
|
10955
|
+
if (duration > 20) console.log(`trimLeadingWhitespaceOutsideFences: ${duration.toFixed(3)}ms, text length: ${text.length}, lines count: ${lines.length}`);
|
|
10956
|
+
return result;
|
|
10957
|
+
};
|
|
10958
|
+
/**
|
|
10959
|
+
* Normalize HTML attribute key to JSX prop name.
|
|
10960
|
+
*/
|
|
10961
|
+
var normalizeAttributeKey = (key) => {
|
|
10962
|
+
if (key.indexOf("-") !== -1 && key.match(HTML_CUSTOM_ATTR_R) === null) key = key.replace(CAPTURE_LETTER_AFTER_HYPHEN, (_, letter) => {
|
|
10963
|
+
return letter.toUpperCase();
|
|
10964
|
+
});
|
|
10965
|
+
return key;
|
|
10966
|
+
};
|
|
10967
|
+
/**
|
|
10968
|
+
* Parse a CSS style string into an array of [key, value] tuples.
|
|
10969
|
+
*/
|
|
10970
|
+
var parseStyleAttribute = (styleString) => {
|
|
10971
|
+
const start = performance.now();
|
|
10972
|
+
const styles = [];
|
|
10973
|
+
let buffer = "";
|
|
10974
|
+
let inUrl = false;
|
|
10975
|
+
let inQuotes = false;
|
|
10976
|
+
let quoteChar = "";
|
|
10977
|
+
if (!styleString) return styles;
|
|
10978
|
+
for (let i = 0; i < styleString.length; i++) {
|
|
10979
|
+
const char = styleString[i];
|
|
10980
|
+
if ((char === "\"" || char === "'") && !inUrl) {
|
|
10981
|
+
if (!inQuotes) {
|
|
10982
|
+
inQuotes = true;
|
|
10983
|
+
quoteChar = char;
|
|
10984
|
+
} else if (char === quoteChar) {
|
|
10985
|
+
inQuotes = false;
|
|
10986
|
+
quoteChar = "";
|
|
10987
|
+
}
|
|
10988
|
+
}
|
|
10989
|
+
if (char === "(" && buffer.endsWith("url")) inUrl = true;
|
|
10990
|
+
else if (char === ")" && inUrl) inUrl = false;
|
|
10991
|
+
if (char === ";" && !inQuotes && !inUrl) {
|
|
10992
|
+
const declaration = buffer.trim();
|
|
10993
|
+
if (declaration) {
|
|
10994
|
+
const colonIndex = declaration.indexOf(":");
|
|
10995
|
+
if (colonIndex > 0) {
|
|
10996
|
+
const key = declaration.slice(0, colonIndex).trim();
|
|
10997
|
+
const value = declaration.slice(colonIndex + 1).trim();
|
|
10998
|
+
styles.push([key, value]);
|
|
10999
|
+
}
|
|
11000
|
+
}
|
|
11001
|
+
buffer = "";
|
|
11002
|
+
} else buffer += char;
|
|
11003
|
+
}
|
|
11004
|
+
const declaration = buffer.trim();
|
|
11005
|
+
if (declaration) {
|
|
11006
|
+
const colonIndex = declaration.indexOf(":");
|
|
11007
|
+
if (colonIndex > 0) {
|
|
11008
|
+
const key = declaration.slice(0, colonIndex).trim();
|
|
11009
|
+
const value = declaration.slice(colonIndex + 1).trim();
|
|
11010
|
+
styles.push([key, value]);
|
|
11011
|
+
}
|
|
11012
|
+
}
|
|
11013
|
+
const duration = performance.now() - start;
|
|
11014
|
+
if (duration > 20) console.log(`parseStyleAttribute: ${duration.toFixed(3)}ms, styleString length: ${styleString.length}, styles count: ${styles.length}`);
|
|
11015
|
+
return styles;
|
|
11016
|
+
};
|
|
11017
|
+
/**
|
|
11018
|
+
* Convert an attribute value to a Node prop value.
|
|
11019
|
+
*/
|
|
11020
|
+
var attributeValueToNodePropValue = (tag, key, value, sanitizeUrlFn) => {
|
|
11021
|
+
if (key === "style") return parseStyleAttribute(value).reduce((styles, [styleKey, styleValue]) => {
|
|
11022
|
+
const camelCasedKey = styleKey.replace(/(-[a-z])/g, (substr) => substr[1].toUpperCase());
|
|
11023
|
+
styles[camelCasedKey] = sanitizeUrlFn(styleValue, tag, styleKey);
|
|
11024
|
+
return styles;
|
|
11025
|
+
}, {});
|
|
11026
|
+
else if (ATTRIBUTES_TO_SANITIZE.indexOf(key) !== -1) return sanitizeUrlFn(unescapeString(value), tag, key);
|
|
11027
|
+
else if (value.match(INTERPOLATION_R)) value = unescapeString(value.slice(1, value.length - 1));
|
|
11028
|
+
if (value === "true") return true;
|
|
11029
|
+
else if (value === "false") return false;
|
|
11030
|
+
return value;
|
|
11031
|
+
};
|
|
11032
|
+
/**
|
|
11033
|
+
* Parse table alignment from a separator row.
|
|
11034
|
+
*/
|
|
11035
|
+
var parseTableAlignCapture = (alignCapture) => {
|
|
11036
|
+
if (TABLE_RIGHT_ALIGN.test(alignCapture)) return "right";
|
|
11037
|
+
else if (TABLE_CENTER_ALIGN.test(alignCapture)) return "center";
|
|
11038
|
+
else if (TABLE_LEFT_ALIGN.test(alignCapture)) return "left";
|
|
11039
|
+
return "left";
|
|
11040
|
+
};
|
|
11041
|
+
/**
|
|
11042
|
+
* Parse table alignment row.
|
|
11043
|
+
*/
|
|
11044
|
+
var parseTableAlign = (source) => {
|
|
11045
|
+
return source.replace(TABLE_TRIM_PIPES, "").split("|").map(parseTableAlignCapture);
|
|
11046
|
+
};
|
|
11047
|
+
/**
|
|
11048
|
+
* Parse a single table row.
|
|
11049
|
+
*/
|
|
11050
|
+
var parseTableRow = (source, parse, state, tableOutput) => {
|
|
11051
|
+
const start = performance.now();
|
|
11052
|
+
const prevInTable = state.inTable;
|
|
11053
|
+
state.inTable = true;
|
|
11054
|
+
const cells = [[]];
|
|
11055
|
+
let acc = "";
|
|
11056
|
+
const flush = () => {
|
|
11057
|
+
if (!acc) return;
|
|
11058
|
+
const cell = cells[cells.length - 1];
|
|
11059
|
+
cell.push.apply(cell, parse(acc, state));
|
|
11060
|
+
acc = "";
|
|
11061
|
+
};
|
|
11062
|
+
source.trim().split(/(`[^`]*`|\\\||\|)/).filter(Boolean).forEach((fragment, i, arr) => {
|
|
11063
|
+
if (fragment.trim() === "|") {
|
|
11064
|
+
flush();
|
|
11065
|
+
if (tableOutput) {
|
|
11066
|
+
if (i !== 0 && i !== arr.length - 1) cells.push([]);
|
|
11067
|
+
return;
|
|
11068
|
+
}
|
|
11069
|
+
}
|
|
11070
|
+
acc += fragment;
|
|
11071
|
+
});
|
|
11072
|
+
flush();
|
|
11073
|
+
state.inTable = prevInTable;
|
|
11074
|
+
const duration = performance.now() - start;
|
|
11075
|
+
if (duration > 20) console.log(`parseTableRow: ${duration.toFixed(3)}ms, source length: ${source.length}, cells count: ${cells.length}`);
|
|
11076
|
+
return cells;
|
|
11077
|
+
};
|
|
11078
|
+
/**
|
|
11079
|
+
* Parse table cells (multiple rows).
|
|
11080
|
+
*/
|
|
11081
|
+
var parseTableCells = (source, parse, state) => {
|
|
11082
|
+
const start = performance.now();
|
|
11083
|
+
const rowsText = source.trim().split("\n");
|
|
11084
|
+
const result = rowsText.map((rowText) => parseTableRow(rowText, parse, state, true));
|
|
11085
|
+
const duration = performance.now() - start;
|
|
11086
|
+
if (duration > 20) console.log(`parseTableCells: ${duration.toFixed(3)}ms, source length: ${source.length}, rows count: ${rowsText.length}`);
|
|
11087
|
+
return result;
|
|
11088
|
+
};
|
|
11089
|
+
/**
|
|
11090
|
+
* Check if a rule qualifies for the current source and state.
|
|
11091
|
+
*/
|
|
11092
|
+
var qualifies = (source, state, qualify) => {
|
|
11093
|
+
if (Array.isArray(qualify)) {
|
|
11094
|
+
for (let i = 0; i < qualify.length; i++) if (startsWith(source, qualify[i])) return true;
|
|
11095
|
+
return false;
|
|
11096
|
+
}
|
|
11097
|
+
return qualify(source, state);
|
|
11098
|
+
};
|
|
11099
|
+
/**
|
|
11100
|
+
* Marks a matcher function as eligible for being run inside an inline context.
|
|
11101
|
+
*/
|
|
11102
|
+
var allowInline = (fn) => {
|
|
11103
|
+
fn.inline = 1;
|
|
11104
|
+
return fn;
|
|
11105
|
+
};
|
|
11106
|
+
/**
|
|
11107
|
+
* Creates a match function for an inline scoped element from a regex.
|
|
11108
|
+
*/
|
|
11109
|
+
var inlineRegex = (regex) => allowInline((source, state) => {
|
|
11110
|
+
if (state.inline) return regex.exec(source);
|
|
11111
|
+
else return null;
|
|
11112
|
+
});
|
|
11113
|
+
/**
|
|
11114
|
+
* Creates a match function for inline elements except links.
|
|
11115
|
+
*/
|
|
11116
|
+
var simpleInlineRegex = (regex) => allowInline((source, state) => {
|
|
11117
|
+
if (state.inline || state.simple) return regex.exec(source);
|
|
11118
|
+
else return null;
|
|
11119
|
+
});
|
|
11120
|
+
/**
|
|
11121
|
+
* Creates a match function for a block scoped element from a regex.
|
|
11122
|
+
*/
|
|
11123
|
+
var blockRegex = (regex) => (source, state) => {
|
|
11124
|
+
if (state.inline || state.simple) return null;
|
|
11125
|
+
else return regex.exec(source);
|
|
11126
|
+
};
|
|
11127
|
+
/**
|
|
11128
|
+
* Creates a match function from a regex, ignoring block/inline scope.
|
|
11129
|
+
*/
|
|
11130
|
+
var anyScopeRegex = (fn) => allowInline((source, state) => {
|
|
11131
|
+
if (typeof fn === "function") return fn(source, state);
|
|
11132
|
+
return fn.exec(source);
|
|
11133
|
+
});
|
|
11134
|
+
/**
|
|
11135
|
+
* Parse inline content (including links).
|
|
11136
|
+
*/
|
|
11137
|
+
var parseInline = (parse, children, state) => {
|
|
11138
|
+
const start = performance.now();
|
|
11139
|
+
const isCurrentlyInline = state.inline ?? false;
|
|
11140
|
+
const isCurrentlySimple = state.simple ?? false;
|
|
11141
|
+
state.inline = true;
|
|
11142
|
+
state.simple = true;
|
|
11143
|
+
const result = parse(children, state);
|
|
11144
|
+
state.inline = isCurrentlyInline;
|
|
11145
|
+
state.simple = isCurrentlySimple;
|
|
11146
|
+
const duration = performance.now() - start;
|
|
11147
|
+
if (duration > 20) console.log(`parseInline: ${duration.toFixed(3)}ms, children length: ${children.length}, result count: ${result.length}`);
|
|
11148
|
+
return result;
|
|
11149
|
+
};
|
|
11150
|
+
/**
|
|
11151
|
+
* Parse simple inline content (no links).
|
|
11152
|
+
*/
|
|
11153
|
+
var parseSimpleInline = (parse, children, state) => {
|
|
11154
|
+
const start = performance.now();
|
|
11155
|
+
const isCurrentlyInline = state.inline ?? false;
|
|
11156
|
+
const isCurrentlySimple = state.simple ?? false;
|
|
11157
|
+
state.inline = false;
|
|
11158
|
+
state.simple = true;
|
|
11159
|
+
const result = parse(children, state);
|
|
11160
|
+
state.inline = isCurrentlyInline;
|
|
11161
|
+
state.simple = isCurrentlySimple;
|
|
11162
|
+
const duration = performance.now() - start;
|
|
11163
|
+
if (duration > 20) console.log(`parseSimpleInline: ${duration.toFixed(3)}ms, children length: ${children.length}, result count: ${result.length}`);
|
|
11164
|
+
return result;
|
|
11165
|
+
};
|
|
11166
|
+
/**
|
|
11167
|
+
* Parse block content.
|
|
11168
|
+
*/
|
|
11169
|
+
var parseBlock = (parse, children, state = {}) => {
|
|
11170
|
+
const start = performance.now();
|
|
11171
|
+
const isCurrentlyInline = state.inline || false;
|
|
11172
|
+
state.inline = false;
|
|
11173
|
+
const normalizedChildren = trimEnd(children);
|
|
11174
|
+
const result = parse(/\n\n$/.test(normalizedChildren) === false ? normalizedChildren.endsWith("\n") ? `${normalizedChildren}\n` : `${normalizedChildren}\n\n` : normalizedChildren, state);
|
|
11175
|
+
state.inline = isCurrentlyInline;
|
|
11176
|
+
const duration = performance.now() - start;
|
|
11177
|
+
if (duration > 20) console.log(`parseBlock: ${duration.toFixed(3)}ms, children length: ${children.length}, result count: ${result.length}`);
|
|
11178
|
+
return result;
|
|
11179
|
+
};
|
|
11180
|
+
/**
|
|
11181
|
+
* Helper to parse capture group 2 as inline content.
|
|
11182
|
+
*/
|
|
11183
|
+
var parseCaptureInline = (capture, parse, state) => {
|
|
11184
|
+
return { children: parseInline(parse, capture[2], state) };
|
|
11185
|
+
};
|
|
11186
|
+
/**
|
|
11187
|
+
* Helper that captures nothing (empty object).
|
|
11188
|
+
*/
|
|
11189
|
+
var captureNothing = () => ({});
|
|
11190
|
+
/**
|
|
11191
|
+
* Helper that renders nothing (null).
|
|
11192
|
+
*/
|
|
11193
|
+
var renderNothing = () => null;
|
|
11194
|
+
/**
|
|
11195
|
+
* Check if any regex in a list matches the input.
|
|
11196
|
+
*/
|
|
11197
|
+
var some = (regexes, input) => {
|
|
11198
|
+
for (let i = 0; i < regexes.length; i++) if (regexes[i].test(input)) return true;
|
|
11199
|
+
return false;
|
|
11200
|
+
};
|
|
11201
|
+
//#endregion
|
|
11202
|
+
//#region ../@intlayer/core/dist/esm/markdown/parser.mjs
|
|
11203
|
+
/**
|
|
11204
|
+
* Creates a parser for a given set of rules, with the precedence
|
|
11205
|
+
* specified as a list of rules.
|
|
11206
|
+
*
|
|
11207
|
+
* @param rules - An object containing rule type -> {match, order, parse} objects
|
|
11208
|
+
* (lower order is higher precedence)
|
|
11209
|
+
*
|
|
11210
|
+
* @returns The resulting parse function
|
|
11211
|
+
*/
|
|
11212
|
+
var parserFor = (rules) => {
|
|
11213
|
+
const start = performance.now();
|
|
11214
|
+
const ruleList = Object.keys(rules);
|
|
11215
|
+
ruleList.forEach((type) => {
|
|
11216
|
+
const order = rules[type]._order;
|
|
11217
|
+
if (typeof order !== "number" || !Number.isFinite(order)) console.warn(`intlayer: Invalid order for rule \`${type}\`: ${order}`);
|
|
11218
|
+
});
|
|
11219
|
+
ruleList.sort((a, b) => {
|
|
11220
|
+
return rules[a]._order - rules[b]._order || (a < b ? -1 : 1);
|
|
11221
|
+
});
|
|
11222
|
+
const nestedParse = (source, state = {}) => {
|
|
11223
|
+
const parseStart = performance.now();
|
|
11224
|
+
const result = [];
|
|
11225
|
+
state.prevCapture = state.prevCapture || "";
|
|
11226
|
+
if (source.trim()) while (source) {
|
|
11227
|
+
let i = 0;
|
|
11228
|
+
while (i < ruleList.length) {
|
|
11229
|
+
const ruleType = ruleList[i];
|
|
11230
|
+
const rule = rules[ruleType];
|
|
11231
|
+
if (rule._qualify && !qualifies(source, state, rule._qualify)) {
|
|
11232
|
+
i++;
|
|
11233
|
+
continue;
|
|
11234
|
+
}
|
|
11235
|
+
const matchStart = performance.now();
|
|
11236
|
+
const capture = rule._match(source, state);
|
|
11237
|
+
const matchDuration = performance.now() - matchStart;
|
|
11238
|
+
if (matchDuration > 1) console.log(`${ruleType}._match: ${matchDuration.toFixed(3)}ms, source length: ${source.length}`);
|
|
11239
|
+
if (capture?.[0]) {
|
|
11240
|
+
source = source.substring(capture[0].length);
|
|
11241
|
+
const ruleParseStart = performance.now();
|
|
11242
|
+
const parsedAny = rule._parse(capture, nestedParse, state);
|
|
11243
|
+
const ruleParseDuration = performance.now() - ruleParseStart;
|
|
11244
|
+
if (ruleParseDuration > 1) console.log(`${ruleType}._parse: ${ruleParseDuration.toFixed(3)}ms, capture length: ${capture[0].length}`);
|
|
11245
|
+
state.prevCapture = (state.prevCapture || "") + capture[0];
|
|
11246
|
+
if (!parsedAny.type) parsedAny.type = ruleType;
|
|
11247
|
+
result.push(parsedAny);
|
|
11248
|
+
break;
|
|
11249
|
+
}
|
|
11250
|
+
i++;
|
|
11251
|
+
}
|
|
11252
|
+
}
|
|
11253
|
+
const parseDuration = performance.now() - parseStart;
|
|
11254
|
+
if (parseDuration > 1) console.log(`nestedParse: ${parseDuration.toFixed(3)}ms, source length: ${source.length}, result count: ${result.length}`);
|
|
11255
|
+
return result;
|
|
11256
|
+
};
|
|
11257
|
+
const duration = performance.now() - start;
|
|
11258
|
+
if (duration > 20) console.log(`parserFor: ${duration.toFixed(3)}ms, rules count: ${ruleList.length}`);
|
|
11259
|
+
return (source, state) => nestedParse(normalizeWhitespace(source), state);
|
|
11260
|
+
};
|
|
11261
|
+
//#endregion
|
|
11262
|
+
//#region ../@intlayer/core/dist/esm/markdown/renderer.mjs
|
|
11263
|
+
/**
|
|
11264
|
+
* Creates a renderer for AST nodes.
|
|
11265
|
+
* Renamed from `reactFor` to be framework-agnostic.
|
|
11266
|
+
*
|
|
11267
|
+
* @param render - The render function to call for each node
|
|
11268
|
+
* @returns A function that renders AST to output
|
|
11269
|
+
*/
|
|
11270
|
+
var renderFor = (render) => (ast, state = {}) => {
|
|
11271
|
+
const start = performance.now();
|
|
11272
|
+
const patchedRender = (ast, state = {}) => renderFor(render)(ast, state);
|
|
11273
|
+
if (Array.isArray(ast)) {
|
|
11274
|
+
const oldKey = state.key;
|
|
11275
|
+
const result = [];
|
|
11276
|
+
let lastWasString = false;
|
|
11277
|
+
let renderedIndex = 0;
|
|
11278
|
+
for (let i = 0; i < ast.length; i++) {
|
|
11279
|
+
const nodeOut = patchedRender(ast[i], {
|
|
11280
|
+
...state,
|
|
11281
|
+
key: renderedIndex
|
|
11282
|
+
});
|
|
11283
|
+
const isString = typeof nodeOut === "string";
|
|
11284
|
+
if (isString && lastWasString) result[result.length - 1] = result[result.length - 1] + nodeOut;
|
|
11285
|
+
else if (nodeOut !== null) {
|
|
11286
|
+
result.push(nodeOut);
|
|
11287
|
+
renderedIndex++;
|
|
11288
|
+
}
|
|
11289
|
+
lastWasString = isString;
|
|
11290
|
+
}
|
|
11291
|
+
state.key = oldKey;
|
|
11292
|
+
const duration = performance.now() - start;
|
|
11293
|
+
if (duration > 20) console.log(`renderFor (array): ${duration.toFixed(3)}ms, ast length: ${ast.length}`);
|
|
11294
|
+
return result;
|
|
11295
|
+
}
|
|
11296
|
+
const result = render(ast, patchedRender, state);
|
|
11297
|
+
const duration = performance.now() - start;
|
|
11298
|
+
if (duration > 20) console.log(`renderFor (single): ${duration.toFixed(3)}ms, ast type: ${ast.type}`);
|
|
11299
|
+
return result;
|
|
11300
|
+
};
|
|
11301
|
+
/**
|
|
11302
|
+
* Creates a renderer from rules with optional custom render hook.
|
|
11303
|
+
*
|
|
11304
|
+
* @param rules - The rules object containing _render functions
|
|
11305
|
+
* @param userRender - Optional custom render hook for full control
|
|
11306
|
+
* @returns A render function for AST nodes
|
|
11307
|
+
*/
|
|
11308
|
+
var createRenderer = (rules, userRender) => (ast, render, state) => {
|
|
11309
|
+
const start = performance.now();
|
|
11310
|
+
const renderer = rules[ast.type]?._render;
|
|
11311
|
+
const result = userRender ? userRender(() => renderer?.(ast, render, state), ast, render, state) : renderer?.(ast, render, state);
|
|
11312
|
+
const duration = performance.now() - start;
|
|
11313
|
+
if (duration > 20) console.log(`createRenderer: ${duration.toFixed(3)}ms, ast type: ${ast.type}, hasUserRender: ${!!userRender}`);
|
|
11314
|
+
return result;
|
|
11315
|
+
};
|
|
11316
|
+
//#endregion
|
|
11317
|
+
//#region ../@intlayer/core/dist/esm/markdown/compiler.mjs
|
|
11318
|
+
var IMAGE_R = /^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/;
|
|
11319
|
+
var LINK_R = new RegExp(`^\\[((?:\\[[^\\[\\]]*(?:\\[[^\\[\\]]*\\][^\\[\\]]*)*\\]|[^\\[\\]])*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['"]([\\s\\S]*?)['"])?\\s*\\)`);
|
|
11320
|
+
var getTag$1 = (tag, components) => {
|
|
11321
|
+
if (typeof tag !== "string") return tag;
|
|
11322
|
+
let override = get$2(components, tag);
|
|
11323
|
+
if (!override && typeof tag === "string") {
|
|
11324
|
+
const lowercaseTag = tag.toLowerCase();
|
|
11325
|
+
const key = Object.keys(components).find((k) => k.toLowerCase() === lowercaseTag);
|
|
11326
|
+
if (key) override = get$2(components, key);
|
|
11327
|
+
}
|
|
11328
|
+
if (!override) return tag;
|
|
11329
|
+
return override;
|
|
11330
|
+
};
|
|
11331
|
+
var createElementFactory = (ctx, options) => {
|
|
11332
|
+
const { runtime, components = {} } = ctx;
|
|
11333
|
+
const filteredTags = options.tagfilter ? [
|
|
11334
|
+
"title",
|
|
11335
|
+
"textarea",
|
|
11336
|
+
"style",
|
|
11337
|
+
"xmp",
|
|
11338
|
+
"iframe",
|
|
11339
|
+
"noembed",
|
|
11340
|
+
"noframes",
|
|
11341
|
+
"script",
|
|
11342
|
+
"plaintext"
|
|
11343
|
+
] : [];
|
|
11344
|
+
return (tag, props, ...children) => {
|
|
11345
|
+
if (typeof tag === "string" && filteredTags.includes(tag.toLowerCase())) return null;
|
|
11346
|
+
const isStringTag = typeof tag === "string";
|
|
11347
|
+
const className = cx$1(props?.className, props?.class);
|
|
11348
|
+
const mergedProps = {};
|
|
11349
|
+
let classNameHandled = false;
|
|
11350
|
+
if (props) for (const key in props) {
|
|
11351
|
+
const value = props[key];
|
|
11352
|
+
if (value === void 0 || value === null) continue;
|
|
11353
|
+
if (key === "className" || key === "class") {
|
|
11354
|
+
if (!classNameHandled) {
|
|
11355
|
+
if (className) mergedProps.className = className;
|
|
11356
|
+
classNameHandled = true;
|
|
11357
|
+
}
|
|
11358
|
+
} else mergedProps[key] = value;
|
|
11359
|
+
}
|
|
11360
|
+
if (!classNameHandled && className) mergedProps.className = className;
|
|
11361
|
+
let finalProps = mergedProps;
|
|
11362
|
+
if (runtime.normalizeProps && isStringTag) finalProps = runtime.normalizeProps(tag, mergedProps);
|
|
11363
|
+
const component = getTag$1(tag, components);
|
|
11364
|
+
return runtime.createElement(component, finalProps, ...children.length === 1 ? [children[0]] : children);
|
|
11365
|
+
};
|
|
11366
|
+
};
|
|
11367
|
+
var createRules = (createElement, ctx, options, footnotes, refs, attrStringToMap, containsBlockSyntax, nonParagraphBlockSyntaxes) => {
|
|
11368
|
+
const slug = (input) => {
|
|
11369
|
+
return ctx.slugify ? ctx.slugify(input, slugify$1) : slugify$1(input);
|
|
11370
|
+
};
|
|
11371
|
+
const sanitize = ctx.sanitizer ?? sanitizer;
|
|
11372
|
+
const namedCodesToUnicode = ctx.namedCodesToUnicode ? {
|
|
11373
|
+
...NAMED_CODES_TO_UNICODE,
|
|
11374
|
+
...ctx.namedCodesToUnicode
|
|
11375
|
+
} : NAMED_CODES_TO_UNICODE;
|
|
11376
|
+
const generateListRule = (type) => {
|
|
11377
|
+
const ordered = type === 1;
|
|
11378
|
+
const LIST_R = ordered ? ORDERED_LIST_R : UNORDERED_LIST_R;
|
|
11379
|
+
const LIST_ITEM_R = ordered ? ORDERED_LIST_ITEM_R : UNORDERED_LIST_ITEM_R;
|
|
11380
|
+
const LIST_ITEM_PREFIX_R = ordered ? ORDERED_LIST_ITEM_PREFIX_R : UNORDERED_LIST_ITEM_PREFIX_R;
|
|
11381
|
+
return {
|
|
11382
|
+
_qualify: (source) => LIST_ITEM_PREFIX_R.test(source),
|
|
11383
|
+
_match: allowInline((source, state) => {
|
|
11384
|
+
const isStartOfLine = LIST_LOOKBEHIND_R.exec(state.prevCapture ?? "");
|
|
11385
|
+
const isListAllowed = state.list ?? (!state.inline && !state.simple);
|
|
11386
|
+
if (isStartOfLine && isListAllowed) {
|
|
11387
|
+
const matchSource = (isStartOfLine[1] || "") + source;
|
|
11388
|
+
return LIST_R.exec(matchSource);
|
|
11389
|
+
}
|
|
11390
|
+
return null;
|
|
11391
|
+
}),
|
|
11392
|
+
_order: Priority.HIGH,
|
|
11393
|
+
_parse(capture, parse, state) {
|
|
11394
|
+
const bullet = capture[2];
|
|
11395
|
+
const startValue = ordered ? +bullet.slice(0, -1) : void 0;
|
|
11396
|
+
const items = capture[0].replace(BLOCK_END_R, "\n").match(LIST_ITEM_R);
|
|
11397
|
+
if (!items) return {
|
|
11398
|
+
items: [],
|
|
11399
|
+
ordered,
|
|
11400
|
+
start: startValue
|
|
11401
|
+
};
|
|
11402
|
+
let lastItemWasAParagraph = false;
|
|
11403
|
+
return {
|
|
11404
|
+
items: items.map((item, i) => {
|
|
11405
|
+
const prefixCapture = LIST_ITEM_PREFIX_R.exec(item);
|
|
11406
|
+
const space = prefixCapture ? prefixCapture[0].length : 0;
|
|
11407
|
+
const spaceRegex = new RegExp(`^ {1,${space}}`, "gm");
|
|
11408
|
+
const content = item.replace(spaceRegex, "").replace(LIST_ITEM_PREFIX_R, "");
|
|
11409
|
+
const isLastItem = i === items.length - 1;
|
|
11410
|
+
const thisItemIsAParagraph = content.indexOf("\n\n") !== -1 || isLastItem && lastItemWasAParagraph;
|
|
11411
|
+
lastItemWasAParagraph = thisItemIsAParagraph;
|
|
11412
|
+
const oldStateInline = state.inline;
|
|
11413
|
+
const oldStateList = state.list;
|
|
11414
|
+
state.list = true;
|
|
11415
|
+
let adjustedContent;
|
|
11416
|
+
if (thisItemIsAParagraph) {
|
|
11417
|
+
state.inline = false;
|
|
11418
|
+
adjustedContent = `${trimEnd(content)}\n\n`;
|
|
11419
|
+
} else {
|
|
11420
|
+
state.inline = true;
|
|
11421
|
+
adjustedContent = trimEnd(content);
|
|
11422
|
+
}
|
|
11423
|
+
const parsed = parse(adjustedContent, state);
|
|
11424
|
+
state.inline = oldStateInline;
|
|
11425
|
+
state.list = oldStateList;
|
|
11426
|
+
return parsed;
|
|
11427
|
+
}),
|
|
11428
|
+
ordered,
|
|
11429
|
+
start: startValue
|
|
11430
|
+
};
|
|
11431
|
+
},
|
|
11432
|
+
_render(node, output, state = {}) {
|
|
11433
|
+
const Tag = node.ordered ? "ol" : "ul";
|
|
11434
|
+
const props = { key: state.key };
|
|
11435
|
+
if (node.ordered && node.start != null) props.start = node.start;
|
|
11436
|
+
return createElement(Tag, props, ...node.items.map((item, i) => createElement("li", { key: i }, output(item, state))));
|
|
11437
|
+
}
|
|
11438
|
+
};
|
|
11439
|
+
};
|
|
11440
|
+
const matchParagraph = (source, state) => {
|
|
11441
|
+
if (state.inline || state.simple || state.inHTML && source.indexOf("\n\n") === -1 && state.prevCapture?.indexOf("\n\n") === -1) return null;
|
|
11442
|
+
let start = 0;
|
|
11443
|
+
while (true) {
|
|
11444
|
+
const newlineIndex = source.indexOf("\n", start);
|
|
11445
|
+
const line = source.slice(start, newlineIndex === -1 ? void 0 : newlineIndex + 1);
|
|
11446
|
+
if (some(nonParagraphBlockSyntaxes, line)) break;
|
|
11447
|
+
if (newlineIndex === -1 || !line.trim()) break;
|
|
11448
|
+
start = newlineIndex + 1;
|
|
11449
|
+
}
|
|
11450
|
+
const match = source.slice(0, start);
|
|
11451
|
+
if (match === "") return null;
|
|
11452
|
+
const captured = trimEnd(match);
|
|
11453
|
+
if (captured === "") return null;
|
|
11454
|
+
return [
|
|
11455
|
+
match,
|
|
11456
|
+
void 0,
|
|
11457
|
+
captured
|
|
11458
|
+
];
|
|
11459
|
+
};
|
|
11460
|
+
return {
|
|
11461
|
+
[RuleType.blockQuote]: {
|
|
11462
|
+
_qualify: [">"],
|
|
11463
|
+
_match: blockRegex(BLOCKQUOTE_R),
|
|
11464
|
+
_order: Priority.HIGH,
|
|
11465
|
+
_parse(capture, parse, state) {
|
|
11466
|
+
const matchAlert = capture[0].replace(BLOCKQUOTE_TRIM_LEFT_MULTILINE_R, "").match(BLOCKQUOTE_ALERT_R);
|
|
11467
|
+
const alert = matchAlert?.[1];
|
|
11468
|
+
const content = matchAlert?.[2] ?? "";
|
|
11469
|
+
return {
|
|
11470
|
+
alert,
|
|
11471
|
+
children: content.indexOf("\n") !== -1 ? parseBlock(parse, content, state) : parseInline(parse, content, state)
|
|
11472
|
+
};
|
|
11473
|
+
},
|
|
11474
|
+
_render(node, output, state = {}) {
|
|
11475
|
+
const props = { key: state.key };
|
|
11476
|
+
if (node.alert) {
|
|
11477
|
+
props.className = `markdown-alert-${slug(node.alert.toLowerCase())}`;
|
|
11478
|
+
node.children.unshift({
|
|
11479
|
+
attrs: {},
|
|
11480
|
+
children: [{
|
|
11481
|
+
type: RuleType.text,
|
|
11482
|
+
text: node.alert
|
|
11483
|
+
}],
|
|
11484
|
+
noInnerParse: true,
|
|
11485
|
+
type: RuleType.htmlBlock,
|
|
11486
|
+
tag: "header"
|
|
11487
|
+
});
|
|
11488
|
+
}
|
|
11489
|
+
return createElement("blockquote", props, output(node.children, state));
|
|
11490
|
+
}
|
|
11491
|
+
},
|
|
11492
|
+
[RuleType.breakLine]: {
|
|
11493
|
+
_qualify: [" "],
|
|
11494
|
+
_match: anyScopeRegex(BREAK_LINE_R),
|
|
11495
|
+
_order: Priority.HIGH,
|
|
11496
|
+
_parse: captureNothing,
|
|
11497
|
+
_render(_, __, state = {}) {
|
|
11498
|
+
return createElement("br", { key: state.key });
|
|
11499
|
+
}
|
|
11500
|
+
},
|
|
11501
|
+
[RuleType.breakThematic]: {
|
|
11502
|
+
_qualify: [
|
|
11503
|
+
"--",
|
|
11504
|
+
"__",
|
|
11505
|
+
"**",
|
|
11506
|
+
"- ",
|
|
11507
|
+
"* ",
|
|
11508
|
+
"_ "
|
|
11509
|
+
],
|
|
11510
|
+
_match: blockRegex(BREAK_THEMATIC_R),
|
|
11511
|
+
_order: Priority.HIGH,
|
|
11512
|
+
_parse: captureNothing,
|
|
11513
|
+
_render(_, __, state = {}) {
|
|
11514
|
+
return createElement("hr", { key: state.key });
|
|
11515
|
+
}
|
|
11516
|
+
},
|
|
11517
|
+
[RuleType.codeBlock]: {
|
|
11518
|
+
_qualify: [" "],
|
|
11519
|
+
_match: blockRegex(CODE_BLOCK_R),
|
|
11520
|
+
_order: Priority.MAX,
|
|
11521
|
+
_parse(capture) {
|
|
11522
|
+
return {
|
|
11523
|
+
type: RuleType.codeBlock,
|
|
11524
|
+
lang: void 0,
|
|
11525
|
+
text: unescapeString(trimEnd(capture[0].replace(/^ {4}/gm, "")))
|
|
11526
|
+
};
|
|
11527
|
+
},
|
|
11528
|
+
_render(node, _, state = {}) {
|
|
11529
|
+
const attrs = { ...node.attrs ?? {} };
|
|
11530
|
+
const langClass = node.lang ? `lang-${node.lang}` : "lang-plaintext";
|
|
11531
|
+
attrs.className = attrs.className ? `${attrs.className} ${langClass}` : langClass;
|
|
11532
|
+
if (node.lang && !attrs.lang) attrs.lang = node.lang;
|
|
11533
|
+
return createElement("pre", { key: state.key }, createElement("code", attrs, node.text));
|
|
11534
|
+
}
|
|
11535
|
+
},
|
|
11536
|
+
[RuleType.codeFenced]: {
|
|
11537
|
+
_qualify: ["```", "~~~"],
|
|
11538
|
+
_match: blockRegex(CODE_BLOCK_FENCED_R),
|
|
11539
|
+
_order: Priority.MAX,
|
|
11540
|
+
_parse(capture) {
|
|
11541
|
+
return {
|
|
11542
|
+
attrs: attrStringToMap("code", capture[3] ?? ""),
|
|
11543
|
+
lang: capture[2] || void 0,
|
|
11544
|
+
text: capture[4],
|
|
11545
|
+
type: RuleType.codeBlock
|
|
11546
|
+
};
|
|
11547
|
+
}
|
|
11548
|
+
},
|
|
11549
|
+
[RuleType.codeInline]: {
|
|
11550
|
+
_qualify: ["`"],
|
|
11551
|
+
_match: simpleInlineRegex(CODE_INLINE_R),
|
|
11552
|
+
_order: Priority.LOW,
|
|
11553
|
+
_parse(capture) {
|
|
11554
|
+
return { text: unescapeString(capture[2]) };
|
|
11555
|
+
},
|
|
11556
|
+
_render(node, _, state = {}) {
|
|
11557
|
+
return createElement("code", { key: state.key }, node.text);
|
|
11558
|
+
}
|
|
11559
|
+
},
|
|
11560
|
+
[RuleType.footnote]: {
|
|
11561
|
+
_qualify: ["[^"],
|
|
11562
|
+
_match: blockRegex(FOOTNOTE_R),
|
|
11563
|
+
_order: Priority.MAX,
|
|
11564
|
+
_parse(capture) {
|
|
11565
|
+
footnotes.push({
|
|
11566
|
+
footnote: capture[2],
|
|
11567
|
+
identifier: capture[1]
|
|
11568
|
+
});
|
|
11569
|
+
return {};
|
|
11570
|
+
},
|
|
11571
|
+
_render: renderNothing
|
|
11572
|
+
},
|
|
11573
|
+
[RuleType.footnoteReference]: {
|
|
11574
|
+
_qualify: ["[^"],
|
|
11575
|
+
_match: inlineRegex(FOOTNOTE_REFERENCE_R),
|
|
11576
|
+
_order: Priority.HIGH,
|
|
11577
|
+
_parse(capture) {
|
|
11578
|
+
return {
|
|
11579
|
+
target: `#${slug(capture[1])}`,
|
|
11580
|
+
text: capture[1]
|
|
11581
|
+
};
|
|
11582
|
+
},
|
|
11583
|
+
_render(node, _, state = {}) {
|
|
11584
|
+
return createElement("a", {
|
|
11585
|
+
key: state.key,
|
|
11586
|
+
href: sanitize(node.target, "a", "href") ?? void 0
|
|
11587
|
+
}, createElement("sup", { key: state.key }, node.text));
|
|
11588
|
+
}
|
|
11589
|
+
},
|
|
11590
|
+
[RuleType.gfmTask]: {
|
|
11591
|
+
_qualify: ["[ ]", "[x]"],
|
|
11592
|
+
_match: inlineRegex(GFM_TASK_R),
|
|
11593
|
+
_order: Priority.HIGH,
|
|
11594
|
+
_parse(capture) {
|
|
11595
|
+
return { completed: capture[1].toLowerCase() === "x" };
|
|
11596
|
+
},
|
|
11597
|
+
_render(node, _, state = {}) {
|
|
11598
|
+
return createElement("input", {
|
|
11599
|
+
checked: node.completed,
|
|
11600
|
+
key: state.key,
|
|
11601
|
+
readOnly: true,
|
|
11602
|
+
type: "checkbox"
|
|
11603
|
+
});
|
|
11604
|
+
}
|
|
11605
|
+
},
|
|
11606
|
+
[RuleType.heading]: {
|
|
11607
|
+
_qualify: ["#"],
|
|
11608
|
+
_match: blockRegex(options.enforceAtxHeadings ? HEADING_ATX_COMPLIANT_R : HEADING_R),
|
|
11609
|
+
_order: Priority.HIGH,
|
|
11610
|
+
_parse(capture, parse, state) {
|
|
11611
|
+
return {
|
|
11612
|
+
children: parseInline(parse, capture[2], state),
|
|
11613
|
+
id: slug(capture[2]),
|
|
11614
|
+
level: capture[1].length
|
|
11615
|
+
};
|
|
11616
|
+
},
|
|
11617
|
+
_render(node, output, state = {}) {
|
|
11618
|
+
return createElement(`h${node.level}`, {
|
|
11619
|
+
id: node.id,
|
|
11620
|
+
key: state.key
|
|
11621
|
+
}, output(node.children, state));
|
|
11622
|
+
}
|
|
11623
|
+
},
|
|
11624
|
+
[RuleType.headingSetext]: {
|
|
11625
|
+
_qualify: (source) => {
|
|
11626
|
+
const nlIndex = source.indexOf("\n");
|
|
11627
|
+
return nlIndex > 0 && nlIndex < source.length - 1 && (source[nlIndex + 1] === "=" || source[nlIndex + 1] === "-");
|
|
11628
|
+
},
|
|
11629
|
+
_match: blockRegex(HEADING_SETEXT_R),
|
|
11630
|
+
_order: Priority.MAX,
|
|
11631
|
+
_parse(capture, parse, state) {
|
|
11632
|
+
return {
|
|
11633
|
+
children: parseInline(parse, capture[1], state),
|
|
11634
|
+
level: capture[2] === "=" ? 1 : 2,
|
|
11635
|
+
type: RuleType.heading
|
|
11636
|
+
};
|
|
11637
|
+
}
|
|
11638
|
+
},
|
|
11639
|
+
[RuleType.htmlBlock]: {
|
|
11640
|
+
_qualify: (source) => {
|
|
11641
|
+
if (options.disableParsingRawHTML) return false;
|
|
11642
|
+
const match = source.match(/^ *<([a-z][a-z0-9:-]*)\b/i);
|
|
11643
|
+
if (!match) return false;
|
|
11644
|
+
const tag = match[1];
|
|
11645
|
+
return source.toLowerCase().indexOf(`</${tag.toLowerCase()}>`) !== -1;
|
|
11646
|
+
},
|
|
11647
|
+
_match: anyScopeRegex(HTML_BLOCK_ELEMENT_R),
|
|
11648
|
+
_order: Priority.HIGH,
|
|
11649
|
+
_parse(capture, parse, state) {
|
|
11650
|
+
const whitespace = capture[3].match(HTML_LEFT_TRIM_AMOUNT_R)?.[1] ?? "";
|
|
11651
|
+
const trimmed = trimLeadingWhitespaceOutsideFences(capture[3], whitespace);
|
|
11652
|
+
const parseFunc = containsBlockSyntax(trimmed) ? parseBlock : parseInline;
|
|
11653
|
+
const tagName = capture[1].trim();
|
|
11654
|
+
const noInnerParse = DO_NOT_PROCESS_HTML_ELEMENTS.indexOf(tagName.toLowerCase()) !== -1;
|
|
11655
|
+
const tag = noInnerParse ? tagName.toLowerCase() : tagName;
|
|
11656
|
+
const ast = {
|
|
11657
|
+
attrs: attrStringToMap(tag, capture[2] ?? ""),
|
|
11658
|
+
noInnerParse,
|
|
11659
|
+
tag
|
|
11660
|
+
};
|
|
11661
|
+
state.inAnchor = state.inAnchor || tagName.toLowerCase() === "a";
|
|
11662
|
+
if (noInnerParse) ast.text = capture[3];
|
|
11663
|
+
else {
|
|
11664
|
+
const prevInHTML = state.inHTML;
|
|
11665
|
+
state.inHTML = true;
|
|
11666
|
+
ast.children = parseFunc(parse, trimmed, state);
|
|
11667
|
+
state.inHTML = prevInHTML;
|
|
11668
|
+
}
|
|
11669
|
+
state.inAnchor = false;
|
|
11670
|
+
return ast;
|
|
11671
|
+
},
|
|
11672
|
+
_render(node, output, state = {}) {
|
|
11673
|
+
return createElement(node.tag, {
|
|
11674
|
+
key: state.key,
|
|
11675
|
+
...node.attrs ?? {}
|
|
11676
|
+
}, node.text ?? (node.children ? output(node.children, state) : ""));
|
|
11677
|
+
}
|
|
11678
|
+
},
|
|
11679
|
+
[RuleType.htmlComment]: {
|
|
11680
|
+
_qualify: ["<!"],
|
|
11681
|
+
_match: anyScopeRegex(HTML_COMMENT_R),
|
|
11682
|
+
_order: Priority.HIGH,
|
|
11683
|
+
_parse: captureNothing,
|
|
11684
|
+
_render: renderNothing
|
|
11685
|
+
},
|
|
11686
|
+
[RuleType.htmlSelfClosing]: {
|
|
11687
|
+
_qualify: (source) => {
|
|
11688
|
+
if (options.disableParsingRawHTML) return false;
|
|
11689
|
+
return /^ *<([a-zA-Z][a-zA-Z0-9:]*)[\s>/]/.test(source);
|
|
11690
|
+
},
|
|
11691
|
+
_match: anyScopeRegex(HTML_SELF_CLOSING_ELEMENT_R),
|
|
11692
|
+
_order: Priority.HIGH,
|
|
11693
|
+
_parse(capture) {
|
|
11694
|
+
const tag = capture[1].trim();
|
|
11695
|
+
return {
|
|
11696
|
+
attrs: attrStringToMap(tag, capture[2] || ""),
|
|
11697
|
+
tag
|
|
11698
|
+
};
|
|
11699
|
+
},
|
|
11700
|
+
_render(node, _, state = {}) {
|
|
11701
|
+
return createElement(node.tag, {
|
|
11702
|
+
key: state.key,
|
|
11703
|
+
...node.attrs ?? {}
|
|
11704
|
+
});
|
|
11705
|
+
}
|
|
11706
|
+
},
|
|
11707
|
+
[RuleType.customComponent]: {
|
|
11708
|
+
_qualify: (source) => /^ *<([A-Z][a-zA-Z0-9]*)/.test(source),
|
|
11709
|
+
_match: anyScopeRegex(CUSTOM_COMPONENT_R),
|
|
11710
|
+
_order: Priority.MAX,
|
|
11711
|
+
_parse(capture, parse, state) {
|
|
11712
|
+
const whitespace = capture[3].match(HTML_LEFT_TRIM_AMOUNT_R)?.[1] ?? "";
|
|
11713
|
+
const trimmed = trimLeadingWhitespaceOutsideFences(capture[3], whitespace);
|
|
11714
|
+
const parseFunc = containsBlockSyntax(trimmed) ? parseBlock : parseInline;
|
|
11715
|
+
const tag = capture[1].trim();
|
|
11716
|
+
const ast = {
|
|
11717
|
+
attrs: attrStringToMap(tag, capture[2] ?? ""),
|
|
11718
|
+
noInnerParse: false,
|
|
11719
|
+
tag
|
|
11720
|
+
};
|
|
11721
|
+
const prevInHTML = state.inHTML;
|
|
11722
|
+
state.inHTML = true;
|
|
11723
|
+
ast.children = parseFunc(parse, trimmed, state);
|
|
11724
|
+
state.inHTML = prevInHTML;
|
|
11725
|
+
return ast;
|
|
11726
|
+
},
|
|
11727
|
+
_render(node, output, state = {}) {
|
|
11728
|
+
return createElement(node.tag, {
|
|
11729
|
+
key: state.key,
|
|
11730
|
+
...node.attrs ?? {}
|
|
11731
|
+
}, node.text ?? (node.children ? output(node.children, state) : ""));
|
|
11732
|
+
}
|
|
11733
|
+
},
|
|
11734
|
+
[RuleType.paragraph]: {
|
|
11735
|
+
_match: matchParagraph,
|
|
11736
|
+
_order: Priority.LOW,
|
|
11737
|
+
_parse: parseCaptureInline,
|
|
11738
|
+
_render(node, output, state = {}) {
|
|
11739
|
+
return createElement("p", { key: state.key }, output(node.children, state));
|
|
11740
|
+
}
|
|
11741
|
+
},
|
|
11742
|
+
[RuleType.image]: {
|
|
11743
|
+
_qualify: ["!["],
|
|
11744
|
+
_match: simpleInlineRegex(IMAGE_R),
|
|
11745
|
+
_order: Priority.HIGH,
|
|
11746
|
+
_parse(capture) {
|
|
11747
|
+
return {
|
|
11748
|
+
alt: unescapeString(capture[1]),
|
|
11749
|
+
target: unescapeString(capture[2]),
|
|
11750
|
+
title: unescapeString(capture[3])
|
|
11751
|
+
};
|
|
11752
|
+
},
|
|
11753
|
+
_render(node, _, state = {}) {
|
|
11754
|
+
return createElement("img", {
|
|
11755
|
+
key: state.key,
|
|
11756
|
+
alt: node.alt ?? void 0,
|
|
11757
|
+
title: node.title ?? void 0,
|
|
11758
|
+
src: sanitize(node.target, "img", "src") ?? void 0
|
|
11759
|
+
});
|
|
11760
|
+
}
|
|
11761
|
+
},
|
|
11762
|
+
[RuleType.link]: {
|
|
11763
|
+
_qualify: ["["],
|
|
11764
|
+
_match: inlineRegex(LINK_R),
|
|
11765
|
+
_order: Priority.LOW,
|
|
11766
|
+
_parse(capture, parse, state) {
|
|
11767
|
+
return {
|
|
11768
|
+
children: parseSimpleInline(parse, capture[1], state),
|
|
11769
|
+
target: unescapeString(capture[2]),
|
|
11770
|
+
title: unescapeString(capture[3])
|
|
11771
|
+
};
|
|
11772
|
+
},
|
|
11773
|
+
_render(node, output, state = {}) {
|
|
11774
|
+
const sanitizedHref = sanitize(node.target, "a", "href");
|
|
11775
|
+
return createElement("a", {
|
|
11776
|
+
key: state.key,
|
|
11777
|
+
href: sanitizedHref ?? void 0,
|
|
11778
|
+
title: node.title ?? void 0
|
|
11779
|
+
}, output(node.children, state));
|
|
11780
|
+
}
|
|
11781
|
+
},
|
|
11782
|
+
[RuleType.linkAngleBraceStyleDetector]: {
|
|
11783
|
+
_qualify: ["<"],
|
|
11784
|
+
_match: inlineRegex(LINK_AUTOLINK_R),
|
|
11785
|
+
_order: Priority.MAX,
|
|
11786
|
+
_parse(capture) {
|
|
11787
|
+
let target = capture[1];
|
|
11788
|
+
let isEmail = false;
|
|
11789
|
+
if (target.indexOf("@") !== -1 && target.indexOf("//") === -1) {
|
|
11790
|
+
isEmail = true;
|
|
11791
|
+
target = target.replace("mailto:", "");
|
|
11792
|
+
}
|
|
11793
|
+
return {
|
|
11794
|
+
children: [{
|
|
11795
|
+
text: target,
|
|
11796
|
+
type: RuleType.text
|
|
11797
|
+
}],
|
|
11798
|
+
target: isEmail ? `mailto:${target}` : target,
|
|
11799
|
+
type: RuleType.link
|
|
11800
|
+
};
|
|
11801
|
+
}
|
|
11802
|
+
},
|
|
11803
|
+
[RuleType.linkBareUrlDetector]: {
|
|
11804
|
+
_qualify: (source, state) => !!(state.inline && !state.inAnchor && !options.disableAutoLink && (startsWith(source, "http://") || startsWith(source, "https://"))),
|
|
11805
|
+
_match: inlineRegex(LINK_AUTOLINK_BARE_URL_R),
|
|
11806
|
+
_order: Priority.MAX,
|
|
11807
|
+
_parse(capture) {
|
|
11808
|
+
return {
|
|
11809
|
+
children: [{
|
|
11810
|
+
text: capture[1],
|
|
11811
|
+
type: RuleType.text
|
|
11812
|
+
}],
|
|
11813
|
+
target: capture[1],
|
|
11814
|
+
type: RuleType.link
|
|
11815
|
+
};
|
|
11816
|
+
}
|
|
11817
|
+
},
|
|
11818
|
+
[RuleType.newlineCoalescer]: {
|
|
11819
|
+
_match: blockRegex(CONSECUTIVE_NEWLINE_R),
|
|
11820
|
+
_order: Priority.LOW,
|
|
11821
|
+
_parse: captureNothing,
|
|
11822
|
+
_render() {
|
|
11823
|
+
return "\n";
|
|
11824
|
+
}
|
|
11825
|
+
},
|
|
11826
|
+
[RuleType.orderedList]: generateListRule(1),
|
|
11827
|
+
[RuleType.unorderedList]: generateListRule(2),
|
|
11828
|
+
[RuleType.ref]: {
|
|
11829
|
+
_qualify: ["["],
|
|
11830
|
+
_match: anyScopeRegex(REFERENCE_IMAGE_OR_LINK),
|
|
11831
|
+
_order: Priority.MAX,
|
|
11832
|
+
_parse(capture) {
|
|
11833
|
+
refs[capture[1]] = {
|
|
11834
|
+
target: capture[2],
|
|
11835
|
+
title: capture[4]
|
|
11836
|
+
};
|
|
11837
|
+
return {};
|
|
11838
|
+
},
|
|
11839
|
+
_render: renderNothing
|
|
11840
|
+
},
|
|
11841
|
+
[RuleType.refImage]: {
|
|
11842
|
+
_qualify: ["!["],
|
|
11843
|
+
_match: simpleInlineRegex(REFERENCE_IMAGE_R),
|
|
11844
|
+
_order: Priority.MAX,
|
|
11845
|
+
_parse(capture) {
|
|
11846
|
+
return {
|
|
11847
|
+
alt: capture[1] ? unescapeString(capture[1]) : void 0,
|
|
11848
|
+
ref: capture[2]
|
|
11849
|
+
};
|
|
11850
|
+
},
|
|
11851
|
+
_render(node, _, state = {}) {
|
|
11852
|
+
const ref = refs[node.ref];
|
|
11853
|
+
if (!ref) return null;
|
|
11854
|
+
return createElement("img", {
|
|
11855
|
+
key: state.key,
|
|
11856
|
+
alt: node.alt,
|
|
11857
|
+
src: sanitize(ref.target, "img", "src") ?? void 0,
|
|
11858
|
+
title: ref.title
|
|
11859
|
+
});
|
|
11860
|
+
}
|
|
11861
|
+
},
|
|
11862
|
+
[RuleType.refLink]: {
|
|
11863
|
+
_qualify: (source) => source[0] === "[" && source.indexOf("](") === -1,
|
|
11864
|
+
_match: inlineRegex(REFERENCE_LINK_R),
|
|
11865
|
+
_order: Priority.MAX,
|
|
11866
|
+
_parse(capture, parse, state) {
|
|
11867
|
+
return {
|
|
11868
|
+
children: parseSimpleInline(parse, capture[1], state),
|
|
11869
|
+
fallbackChildren: capture[0],
|
|
11870
|
+
ref: capture[2]
|
|
11871
|
+
};
|
|
11872
|
+
},
|
|
11873
|
+
_render(node, output, state = {}) {
|
|
11874
|
+
const ref = refs[node.ref];
|
|
11875
|
+
if (!ref) return createElement("span", { key: state.key }, node.fallbackChildren);
|
|
11876
|
+
return createElement("a", {
|
|
11877
|
+
key: state.key,
|
|
11878
|
+
href: sanitize(ref.target, "a", "href") ?? void 0,
|
|
11879
|
+
title: ref.title
|
|
11880
|
+
}, output(node.children, state));
|
|
11881
|
+
}
|
|
11882
|
+
},
|
|
11883
|
+
[RuleType.table]: {
|
|
11884
|
+
_qualify: ["|"],
|
|
11885
|
+
_match: blockRegex(NP_TABLE_R),
|
|
11886
|
+
_order: Priority.HIGH,
|
|
11887
|
+
_parse(capture, parse, state) {
|
|
11888
|
+
state.inline = true;
|
|
11889
|
+
const align = capture[2] ? parseTableAlign(capture[2]) : [];
|
|
11890
|
+
const cells = capture[3] ? parseTableCells(capture[3], parse, state) : [];
|
|
11891
|
+
const header = parseTableRow(capture[1], parse, state, !!cells.length);
|
|
11892
|
+
state.inline = false;
|
|
11893
|
+
return cells.length ? {
|
|
11894
|
+
align,
|
|
11895
|
+
cells,
|
|
11896
|
+
header,
|
|
11897
|
+
type: RuleType.table
|
|
11898
|
+
} : {
|
|
11899
|
+
children: header.flat(),
|
|
11900
|
+
type: RuleType.paragraph
|
|
11901
|
+
};
|
|
11902
|
+
},
|
|
11903
|
+
_render(node, output, state = {}) {
|
|
11904
|
+
const table = node;
|
|
11905
|
+
const getStyle = (i) => table.align[i] && table.align[i] !== "left" ? { textAlign: table.align[i] } : {};
|
|
11906
|
+
return createElement("table", { key: state.key }, createElement("thead", null, createElement("tr", null, ...table.header.map((c, i) => createElement("th", {
|
|
11907
|
+
key: i,
|
|
11908
|
+
style: getStyle(i)
|
|
11909
|
+
}, output(c, state))))), createElement("tbody", null, ...table.cells.map((row, i) => createElement("tr", { key: i }, ...row.map((c, j) => createElement("td", {
|
|
11910
|
+
key: j,
|
|
11911
|
+
style: getStyle(j)
|
|
11912
|
+
}, output(c, state)))))));
|
|
11913
|
+
}
|
|
11914
|
+
},
|
|
11915
|
+
[RuleType.tableSeparator]: {
|
|
11916
|
+
_match: (source, state) => state.inTable && source[0] === "|" ? /^\|/.exec(source) : null,
|
|
11917
|
+
_order: Priority.HIGH,
|
|
11918
|
+
_parse() {
|
|
11919
|
+
return { type: RuleType.tableSeparator };
|
|
11920
|
+
},
|
|
11921
|
+
_render() {
|
|
11922
|
+
return " | ";
|
|
11923
|
+
}
|
|
11924
|
+
},
|
|
11925
|
+
[RuleType.text]: {
|
|
11926
|
+
_match: allowInline((source, _state) => {
|
|
11927
|
+
const shortMatch = SHORTCODE_R.exec(source);
|
|
11928
|
+
if (shortMatch) return shortMatch;
|
|
11929
|
+
return TEXT_PLAIN_R.exec(source) || /^[\s\S]/.exec(source);
|
|
11930
|
+
}),
|
|
11931
|
+
_order: Priority.MIN,
|
|
11932
|
+
_parse(capture) {
|
|
11933
|
+
const text = capture[0];
|
|
11934
|
+
return { text: text.indexOf("&") === -1 ? text : text.replace(HTML_CHAR_CODE_R, (f, i) => {
|
|
11935
|
+
if (i.startsWith("#x")) return String.fromCharCode(parseInt(i.slice(2), 16));
|
|
11936
|
+
if (i.startsWith("#")) return String.fromCharCode(parseInt(i.slice(1), 10));
|
|
11937
|
+
return namedCodesToUnicode[i] || f;
|
|
11938
|
+
}) };
|
|
11939
|
+
},
|
|
11940
|
+
_render(node) {
|
|
11941
|
+
return node.text;
|
|
11942
|
+
}
|
|
11943
|
+
},
|
|
11944
|
+
[RuleType.textBolded]: {
|
|
11945
|
+
_qualify: ["**", "__"],
|
|
11946
|
+
_match: simpleInlineRegex(TEXT_BOLD_R),
|
|
11947
|
+
_order: Priority.MED,
|
|
11948
|
+
_parse(capture, parse, state) {
|
|
11949
|
+
return { children: parse(capture[2], state) };
|
|
11950
|
+
},
|
|
11951
|
+
_render(node, output, state = {}) {
|
|
11952
|
+
return createElement("strong", { key: state.key }, output(node.children, state));
|
|
11953
|
+
}
|
|
11954
|
+
},
|
|
11955
|
+
[RuleType.textEmphasized]: {
|
|
11956
|
+
_qualify: ["*", "_"],
|
|
11957
|
+
_match: simpleInlineRegex(TEXT_EMPHASIZED_R),
|
|
11958
|
+
_order: Priority.LOW,
|
|
11959
|
+
_parse(capture, parse, state) {
|
|
11960
|
+
return { children: parse(capture[2], state) };
|
|
11961
|
+
},
|
|
11962
|
+
_render(node, output, state = {}) {
|
|
11963
|
+
return createElement("em", { key: state.key }, output(node.children, state));
|
|
11964
|
+
}
|
|
11965
|
+
},
|
|
11966
|
+
[RuleType.textEscaped]: {
|
|
11967
|
+
_qualify: ["\\"],
|
|
11968
|
+
_match: simpleInlineRegex(TEXT_ESCAPED_R),
|
|
11969
|
+
_order: Priority.HIGH,
|
|
11970
|
+
_parse(capture) {
|
|
11971
|
+
return {
|
|
11972
|
+
text: capture[1],
|
|
11973
|
+
type: RuleType.text
|
|
11974
|
+
};
|
|
11975
|
+
}
|
|
11976
|
+
},
|
|
11977
|
+
[RuleType.textMarked]: {
|
|
11978
|
+
_qualify: ["=="],
|
|
11979
|
+
_match: simpleInlineRegex(TEXT_MARKED_R),
|
|
11980
|
+
_order: Priority.LOW,
|
|
11981
|
+
_parse: parseCaptureInline,
|
|
11982
|
+
_render(node, output, state = {}) {
|
|
11983
|
+
return createElement("mark", { key: state.key }, output(node.children, state));
|
|
11984
|
+
}
|
|
11985
|
+
},
|
|
11986
|
+
[RuleType.textStrikethroughed]: {
|
|
11987
|
+
_qualify: ["~~"],
|
|
11988
|
+
_match: simpleInlineRegex(TEXT_STRIKETHROUGHED_R),
|
|
11989
|
+
_order: Priority.LOW,
|
|
11990
|
+
_parse: parseCaptureInline,
|
|
11991
|
+
_render(node, output, state = {}) {
|
|
11992
|
+
return createElement("del", { key: state.key }, output(node.children, state));
|
|
11993
|
+
}
|
|
11994
|
+
}
|
|
11995
|
+
};
|
|
11996
|
+
};
|
|
11997
|
+
var compile = (markdown = "", ctx, options = {}) => {
|
|
11998
|
+
const components = ctx.components ?? {};
|
|
11999
|
+
const slug = (input) => {
|
|
12000
|
+
return ctx.slugify ? ctx.slugify(input, slugify$1) : slugify$1(input);
|
|
12001
|
+
};
|
|
12002
|
+
const createElement = createElementFactory(ctx, options);
|
|
12003
|
+
const footnotes = [];
|
|
12004
|
+
const refs = {};
|
|
12005
|
+
const attrStringToMap = (tag, str) => {
|
|
12006
|
+
if (!str || !str.trim()) return null;
|
|
12007
|
+
const attributes = str.match(ATTR_EXTRACTOR_R);
|
|
12008
|
+
if (!attributes) return null;
|
|
12009
|
+
return attributes.reduce((map, raw) => {
|
|
12010
|
+
const delimiterIdx = raw.indexOf("=");
|
|
12011
|
+
if (delimiterIdx !== -1) {
|
|
12012
|
+
const key = normalizeAttributeKey(raw.slice(0, delimiterIdx)).trim();
|
|
12013
|
+
const value = unquote(raw.slice(delimiterIdx + 1).trim());
|
|
12014
|
+
const mappedKey = ATTRIBUTE_TO_NODE_PROP_MAP[key] ?? key;
|
|
12015
|
+
if (mappedKey === "ref") return map;
|
|
12016
|
+
map[mappedKey] = attributeValueToNodePropValue(tag, key, value, ctx.sanitizer ?? sanitizer);
|
|
12017
|
+
if (typeof map[mappedKey] === "string" && (HTML_BLOCK_ELEMENT_R.test(map[mappedKey]) || HTML_SELF_CLOSING_ELEMENT_R.test(map[mappedKey]))) map[mappedKey] = compileInner(map[mappedKey].trim());
|
|
12018
|
+
} else if (raw !== "style") map[ATTRIBUTE_TO_NODE_PROP_MAP[raw] ?? raw] = true;
|
|
12019
|
+
return map;
|
|
12020
|
+
}, {});
|
|
12021
|
+
};
|
|
12022
|
+
const nonParagraphBlockSyntaxes = [
|
|
12023
|
+
BLOCKQUOTE_R,
|
|
12024
|
+
CODE_BLOCK_FENCED_R,
|
|
12025
|
+
CODE_BLOCK_R,
|
|
12026
|
+
options.enforceAtxHeadings ? HEADING_ATX_COMPLIANT_R : HEADING_R,
|
|
12027
|
+
HEADING_SETEXT_R,
|
|
12028
|
+
NP_TABLE_R,
|
|
12029
|
+
ORDERED_LIST_R,
|
|
12030
|
+
UNORDERED_LIST_R,
|
|
12031
|
+
CUSTOM_COMPONENT_R
|
|
12032
|
+
];
|
|
12033
|
+
const containsBlockSyntax = (input) => {
|
|
12034
|
+
const cleaned = input.replace(TRIM_STARTING_NEWLINES, "");
|
|
12035
|
+
const slice = cleaned.length > 2048 ? cleaned.slice(0, 2048) : cleaned;
|
|
12036
|
+
return some(options.disableParsingRawHTML ? nonParagraphBlockSyntaxes : [
|
|
12037
|
+
...nonParagraphBlockSyntaxes,
|
|
12038
|
+
PARAGRAPH_R,
|
|
12039
|
+
HTML_BLOCK_ELEMENT_R,
|
|
12040
|
+
HTML_COMMENT_R,
|
|
12041
|
+
HTML_SELF_CLOSING_ELEMENT_R,
|
|
12042
|
+
CUSTOM_COMPONENT_R
|
|
12043
|
+
], slice);
|
|
12044
|
+
};
|
|
12045
|
+
const baseRules = createRules(createElement, ctx, options, footnotes, refs, attrStringToMap, containsBlockSyntax, nonParagraphBlockSyntaxes);
|
|
12046
|
+
const rules = options.disableParsingRawHTML ? Object.keys(baseRules).reduce((acc, key) => {
|
|
12047
|
+
if (key !== RuleType.htmlBlock && key !== RuleType.htmlSelfClosing) acc[key] = baseRules[key];
|
|
12048
|
+
return acc;
|
|
12049
|
+
}, {}) : baseRules;
|
|
12050
|
+
const parser = parserFor(rules);
|
|
12051
|
+
const emitter = renderFor(createRenderer(rules, options.renderRule));
|
|
12052
|
+
const compileInner = (input) => {
|
|
12053
|
+
const result = options.preserveFrontmatter ? input : input.replace(FRONT_MATTER_R, "");
|
|
12054
|
+
const inline = options.forceInline || !options.forceBlock && SHOULD_RENDER_AS_BLOCK_R.test(result.replace(TRIM_STARTING_NEWLINES, "")) === false;
|
|
12055
|
+
const arr = emitter(parser(inline ? result : `${trimEnd(result).replace(TRIM_STARTING_NEWLINES, "")}\n\n`, { inline }), { inline });
|
|
12056
|
+
while (typeof arr[arr.length - 1] === "string" && !arr[arr.length - 1].trim()) arr.pop();
|
|
12057
|
+
if (options.wrapper === null) return arr;
|
|
12058
|
+
const wrapper = options.wrapper ?? (inline ? "span" : "div");
|
|
12059
|
+
if (arr.length > 1 || options.forceWrapper) return createElement(wrapper, { key: "outer" }, arr);
|
|
12060
|
+
if (arr.length === 1) {
|
|
12061
|
+
const node = arr[0];
|
|
12062
|
+
if (typeof node === "string") {
|
|
12063
|
+
const spanProps = { key: "outer" };
|
|
12064
|
+
if (!inline && components) {
|
|
12065
|
+
const pOverrideProps = get$2(components, "p.props", {}) ?? {};
|
|
12066
|
+
const mergedClassName = cx$1(spanProps.className, pOverrideProps.className);
|
|
12067
|
+
const finalSpanProps = {
|
|
12068
|
+
...spanProps,
|
|
12069
|
+
...pOverrideProps
|
|
12070
|
+
};
|
|
12071
|
+
if (mergedClassName) finalSpanProps.className = mergedClassName;
|
|
12072
|
+
return createElement("span", finalSpanProps, node);
|
|
12073
|
+
}
|
|
12074
|
+
return createElement("span", spanProps, node);
|
|
12075
|
+
}
|
|
12076
|
+
return node;
|
|
12077
|
+
}
|
|
12078
|
+
return createElement(wrapper, { key: "outer" }, null);
|
|
12079
|
+
};
|
|
12080
|
+
if (typeof markdown !== "string") {
|
|
12081
|
+
console.error("intlayer: the first argument must be a string. Received", typeof markdown);
|
|
12082
|
+
throw new Error("intlayer: the first argument must be a string");
|
|
12083
|
+
}
|
|
12084
|
+
const node = compileInner(markdown);
|
|
12085
|
+
return footnotes.length ? createElement("div", null, node, createElement("footer", { key: "footer" }, ...footnotes.map((def) => createElement("div", {
|
|
12086
|
+
id: slug(def.identifier),
|
|
12087
|
+
key: def.identifier
|
|
12088
|
+
}, def.identifier, emitter(parser(def.footnote, { inline: true }), { inline: true }))))) : node;
|
|
12089
|
+
};
|
|
12090
|
+
//#endregion
|
|
10276
12091
|
//#region ../react-intlayer/dist/esm/plugins.mjs
|
|
10277
|
-
var
|
|
10278
|
-
__vitePreload(() => import("./
|
|
10279
|
-
_getMarkdownMetadata = m.getMarkdownMetadata;
|
|
10280
|
-
}), __vite__mapDeps([0,1]));
|
|
10281
|
-
var LazyMarkdownRendererPlugin = (0, import_react.lazy)(() => __vitePreload(() => import("./markdown-DJYH1etf.js").then((m) => ({ default: m.MarkdownRendererPlugin })), __vite__mapDeps([2,1,0])));
|
|
10282
|
-
var LazyHTMLRendererPlugin = (0, import_react.lazy)(() => __vitePreload(() => import("./html-CC2iD1GB.js").then((m) => ({ default: m.HTMLRendererPlugin })), __vite__mapDeps([3,1,4])));
|
|
12092
|
+
var LazyMarkdownRendererPlugin = (0, import_react.lazy)(() => __vitePreload(() => import("./MarkdownRendererPlugin-Dp6Cig6u.js").then((m) => ({ default: m.MarkdownRendererPlugin })), []));
|
|
12093
|
+
var LazyHTMLRendererPlugin = (0, import_react.lazy)(() => __vitePreload(() => import("./HTMLRendererPlugin-B6Eld7in.js").then((m) => ({ default: m.HTMLRendererPlugin })), __vite__mapDeps([0,1,2])));
|
|
10283
12094
|
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
10284
12095
|
var intlayerNodePlugins = {
|
|
10285
12096
|
id: "intlayer-node-plugin",
|
|
@@ -10287,10 +12098,7 @@ var intlayerNodePlugins = {
|
|
|
10287
12098
|
transform: (_node, { plugins, ...rest }) => renderIntlayerNode({
|
|
10288
12099
|
...rest,
|
|
10289
12100
|
value: rest.children,
|
|
10290
|
-
children:
|
|
10291
|
-
...rest,
|
|
10292
|
-
children: rest.children
|
|
10293
|
-
}) : rest.children
|
|
12101
|
+
children: rest.children
|
|
10294
12102
|
})
|
|
10295
12103
|
};
|
|
10296
12104
|
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
@@ -10300,10 +12108,7 @@ var reactNodePlugins = {
|
|
|
10300
12108
|
transform: (node, { plugins, ...rest }) => renderIntlayerNode({
|
|
10301
12109
|
...rest,
|
|
10302
12110
|
value: "[[react-element]]",
|
|
10303
|
-
children:
|
|
10304
|
-
...rest,
|
|
10305
|
-
children: renderReactElement(node)
|
|
10306
|
-
}) : renderReactElement(node)
|
|
12111
|
+
children: renderReactElement(node)
|
|
10307
12112
|
})
|
|
10308
12113
|
};
|
|
10309
12114
|
/**
|
|
@@ -10361,17 +12166,14 @@ var markdownStringPlugin = {
|
|
|
10361
12166
|
canHandle: (node) => typeof node === "string",
|
|
10362
12167
|
transform: (node, props, deepTransformNode) => {
|
|
10363
12168
|
const { plugins, ...rest } = props;
|
|
10364
|
-
const metadataNodes = deepTransformNode(
|
|
12169
|
+
const metadataNodes = deepTransformNode(getMarkdownMetadata(node) ?? {}, {
|
|
10365
12170
|
plugins: [{
|
|
10366
12171
|
id: "markdown-metadata-plugin",
|
|
10367
12172
|
canHandle: (metadataNode) => typeof metadataNode === "string" || typeof metadataNode === "number" || typeof metadataNode === "boolean" || !metadataNode,
|
|
10368
12173
|
transform: (metadataNode, props) => renderIntlayerNode({
|
|
10369
12174
|
...props,
|
|
10370
12175
|
value: metadataNode,
|
|
10371
|
-
children:
|
|
10372
|
-
...rest,
|
|
10373
|
-
children: node
|
|
10374
|
-
}) : node
|
|
12176
|
+
children: node
|
|
10375
12177
|
})
|
|
10376
12178
|
}],
|
|
10377
12179
|
dictionaryKey: rest.dictionaryKey,
|
|
@@ -10380,7 +12182,7 @@ var markdownStringPlugin = {
|
|
|
10380
12182
|
const render = (components) => renderIntlayerNode({
|
|
10381
12183
|
...props,
|
|
10382
12184
|
value: node,
|
|
10383
|
-
children:
|
|
12185
|
+
children: configuration.editor.enabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContentSelector, {
|
|
10384
12186
|
...rest,
|
|
10385
12187
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, {
|
|
10386
12188
|
fallback: node,
|
|
@@ -10448,10 +12250,10 @@ var htmlPlugin = {
|
|
|
10448
12250
|
* This function is used by both getIntlayer and getDictionary to ensure consistent plugin configuration.
|
|
10449
12251
|
*/
|
|
10450
12252
|
var getPlugins = (locale, fallback = true) => [
|
|
10451
|
-
translationPlugin(locale ??
|
|
12253
|
+
translationPlugin(locale ?? configuration.internationalization.defaultLocale, fallback ? configuration.internationalization.defaultLocale : void 0),
|
|
10452
12254
|
enumerationPlugin,
|
|
10453
12255
|
conditionPlugin,
|
|
10454
|
-
nestedPlugin(locale ??
|
|
12256
|
+
nestedPlugin(locale ?? configuration.internationalization.defaultLocale),
|
|
10455
12257
|
filePlugin,
|
|
10456
12258
|
genderPlugin,
|
|
10457
12259
|
intlayerNodePlugins,
|
|
@@ -10604,7 +12406,7 @@ var getStorageAttributes = (options) => {
|
|
|
10604
12406
|
* Resolves the most specific locale from a user-provided list,
|
|
10605
12407
|
* or falls back to the default locale if no match is found.
|
|
10606
12408
|
*/
|
|
10607
|
-
var localeResolver = (selectedLocale, locales =
|
|
12409
|
+
var localeResolver = (selectedLocale, locales = configuration?.internationalization?.locales, defaultLocale = configuration?.internationalization?.defaultLocale) => {
|
|
10608
12410
|
const requestedLocales = [selectedLocale].flat();
|
|
10609
12411
|
const normalize = (locale) => locale.trim().toLowerCase();
|
|
10610
12412
|
try {
|
|
@@ -10665,7 +12467,7 @@ var buildCookieString = (name, value, attributes) => {
|
|
|
10665
12467
|
* @returns The locale if found in any storage, or undefined if not found
|
|
10666
12468
|
*/
|
|
10667
12469
|
var getLocaleFromStorage = (options) => {
|
|
10668
|
-
const { routing, internationalization } =
|
|
12470
|
+
const { routing, internationalization } = configuration;
|
|
10669
12471
|
const { locales } = internationalization;
|
|
10670
12472
|
const { storage } = routing;
|
|
10671
12473
|
if (storage === false || options?.isCookieEnabled === false) return void 0;
|
|
@@ -10716,8 +12518,8 @@ var getLocaleFromStorage = (options) => {
|
|
|
10716
12518
|
* @param locale - The locale to store
|
|
10717
12519
|
*/
|
|
10718
12520
|
var setLocaleInStorage$1 = (locale, options) => {
|
|
10719
|
-
if (
|
|
10720
|
-
const storageAttributes = getStorageAttributes(
|
|
12521
|
+
if (configuration.routing.storage === false || options?.isCookieEnabled === false) return;
|
|
12522
|
+
const storageAttributes = getStorageAttributes(configuration.routing.storage);
|
|
10721
12523
|
for (let i = 0; i < storageAttributes.cookies.length; i++) {
|
|
10722
12524
|
const { name, attributes } = storageAttributes.cookies[i];
|
|
10723
12525
|
try {
|
|
@@ -10823,7 +12625,7 @@ var getHTMLTextDir = (locale) => {
|
|
|
10823
12625
|
* Single source of truth for default routing config resolution across all localization functions.
|
|
10824
12626
|
*/
|
|
10825
12627
|
var resolveRoutingConfig = (options = {}) => {
|
|
10826
|
-
const { internationalization, routing } =
|
|
12628
|
+
const { internationalization, routing } = configuration ?? {};
|
|
10827
12629
|
return {
|
|
10828
12630
|
defaultLocale: internationalization?.defaultLocale ?? DEFAULT_LOCALE,
|
|
10829
12631
|
mode: routing?.mode ?? "prefix-no-default",
|
|
@@ -10971,7 +12773,7 @@ var getLocaleName = (displayLocale, targetLocale = displayLocale) => {
|
|
|
10971
12773
|
* @param locales - Optional array of supported locales. Defaults to `localesDefault`.
|
|
10972
12774
|
* @returns The URL string or pathname without the locale segment or locale search parameter.
|
|
10973
12775
|
*/
|
|
10974
|
-
var getPathWithoutLocale = (inputUrl, locales =
|
|
12776
|
+
var getPathWithoutLocale = (inputUrl, locales = configuration?.internationalization?.locales) => {
|
|
10975
12777
|
const isAbsoluteUrl = checkIsURLAbsolute(inputUrl);
|
|
10976
12778
|
let fixedInputUrl = inputUrl;
|
|
10977
12779
|
if (inputUrl?.endsWith("/")) fixedInputUrl = inputUrl.slice(0, -1);
|
|
@@ -11114,7 +12916,7 @@ var getLocalizedPath = (canonicalPath, locale, rewriteRules) => {
|
|
|
11114
12916
|
* @param options.mode - URL routing mode for locale handling. Defaults to configured mode.
|
|
11115
12917
|
* @returns The localized URL for the current locale.
|
|
11116
12918
|
*/
|
|
11117
|
-
var getLocalizedUrl = (url, currentLocale =
|
|
12919
|
+
var getLocalizedUrl = (url, currentLocale = configuration?.internationalization?.defaultLocale, options = {}) => {
|
|
11118
12920
|
const { defaultLocale, mode, locales, rewrite } = resolveRoutingConfig(options);
|
|
11119
12921
|
const urlWithoutLocale = getPathWithoutLocale(url, locales);
|
|
11120
12922
|
const rewriteRules = getRewriteRules(rewrite, "url");
|
|
@@ -11173,7 +12975,7 @@ var setLocaleInStorage = (locale, isCookieEnabled) => setLocaleInStorage$1(local
|
|
|
11173
12975
|
* Context that stores the current locale on the client side.
|
|
11174
12976
|
*/
|
|
11175
12977
|
var IntlayerClientContext = (0, import_react.createContext)({
|
|
11176
|
-
locale: localeInStorage ??
|
|
12978
|
+
locale: localeInStorage ?? configuration?.internationalization?.defaultLocale,
|
|
11177
12979
|
setLocale: () => null,
|
|
11178
12980
|
isCookieEnabled: true
|
|
11179
12981
|
});
|
|
@@ -11186,7 +12988,7 @@ var IntlayerClientContext = (0, import_react.createContext)({
|
|
|
11186
12988
|
* @returns The provider component.
|
|
11187
12989
|
*/
|
|
11188
12990
|
var IntlayerProviderContent = ({ locale: localeProp, defaultLocale: defaultLocaleProp, children, setLocale: setLocaleProp, disableEditor, isCookieEnabled }) => {
|
|
11189
|
-
const { internationalization } =
|
|
12991
|
+
const { internationalization } = configuration ?? {};
|
|
11190
12992
|
const { locales: availableLocales, defaultLocale: defaultLocaleConfig } = internationalization ?? {};
|
|
11191
12993
|
const [currentLocale, setCurrentLocale] = (0, import_react.useState)(localeProp ?? localeInStorage ?? defaultLocaleProp ?? defaultLocaleConfig);
|
|
11192
12994
|
(0, import_react.useEffect)(() => {
|
|
@@ -11255,7 +13057,7 @@ var useDictionary = (dictionary, locale) => {
|
|
|
11255
13057
|
* ```
|
|
11256
13058
|
*/
|
|
11257
13059
|
var useLocale = ({ isCookieEnabled, onLocaleChange } = {}) => {
|
|
11258
|
-
const { defaultLocale, locales: availableLocales } =
|
|
13060
|
+
const { defaultLocale, locales: availableLocales } = configuration?.internationalization ?? {};
|
|
11259
13061
|
const { locale, setLocale: setLocaleState, isCookieEnabled: isCookieEnabledContext } = (0, import_react.useContext)(IntlayerClientContext);
|
|
11260
13062
|
return {
|
|
11261
13063
|
locale,
|
|
@@ -11353,7 +13155,7 @@ var useMarkdownContext = () => (0, import_react.useContext)(MarkdownContext);
|
|
|
11353
13155
|
* });
|
|
11354
13156
|
* ```
|
|
11355
13157
|
*/
|
|
11356
|
-
var renderMarkdown = (content, { components, wrapper, forceBlock, forceInline, preserveFrontmatter, tagfilter } = {}) => {
|
|
13158
|
+
var renderMarkdown$1 = (content, { components, wrapper, forceBlock, forceInline, preserveFrontmatter, tagfilter } = {}) => {
|
|
11357
13159
|
return compiler(content, {
|
|
11358
13160
|
components,
|
|
11359
13161
|
forceBlock,
|
|
@@ -11365,6 +13167,12 @@ var renderMarkdown = (content, { components, wrapper, forceBlock, forceInline, p
|
|
|
11365
13167
|
});
|
|
11366
13168
|
};
|
|
11367
13169
|
//#endregion
|
|
13170
|
+
//#region ../react-intlayer/dist/esm/index.mjs
|
|
13171
|
+
/**
|
|
13172
|
+
* @deprecated import from react-intlayer/markdown instead
|
|
13173
|
+
*/
|
|
13174
|
+
var renderMarkdown = renderMarkdown$1;
|
|
13175
|
+
//#endregion
|
|
11368
13176
|
//#region ../../node_modules/.bun/react-router@7.13.1+bf16f8eded5e12ee/node_modules/react-router/dist/development/chunk-LFPYN7LY.mjs
|
|
11369
13177
|
var PopStateEventType = "popstate";
|
|
11370
13178
|
function isLocation(obj) {
|
|
@@ -13206,7 +15014,6 @@ function useViewTransitionState(to, { relative } = {}) {
|
|
|
13206
15014
|
}
|
|
13207
15015
|
//#endregion
|
|
13208
15016
|
//#region ../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
13209
|
-
var import_client = require_client();
|
|
13210
15017
|
function r$6(e) {
|
|
13211
15018
|
var t, f, n = "";
|
|
13212
15019
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
@@ -25258,7 +27065,7 @@ var EditorStateManager = class {
|
|
|
25258
27065
|
async _loadDictionaries() {
|
|
25259
27066
|
try {
|
|
25260
27067
|
const unmergedDictionaries = (await __vitePreload(async () => {
|
|
25261
|
-
const { getUnmergedDictionaries } = await import("./unmerged_dictionaries-
|
|
27068
|
+
const { getUnmergedDictionaries } = await import("./unmerged_dictionaries-DFHIR2QQ.js");
|
|
25262
27069
|
return { getUnmergedDictionaries };
|
|
25263
27070
|
}, [])).getUnmergedDictionaries();
|
|
25264
27071
|
const dictionariesList = Object.fromEntries(Object.values(unmergedDictionaries).flat().map((dictionary) => [dictionary.localId, dictionary]));
|
|
@@ -25502,7 +27309,7 @@ var defineIntlayerElements = () => {
|
|
|
25502
27309
|
//#endregion
|
|
25503
27310
|
//#region ../@intlayer/editor/dist/esm/core/initEditorClient.mjs
|
|
25504
27311
|
var buildClientMessengerConfig = () => {
|
|
25505
|
-
const { editor } =
|
|
27312
|
+
const { editor } = configuration ?? {};
|
|
25506
27313
|
return {
|
|
25507
27314
|
allowedOrigins: [editor?.editorURL, editor?.cmsURL].filter(Boolean),
|
|
25508
27315
|
postMessageFn: (payload, origin) => {
|
|
@@ -25527,7 +27334,7 @@ var initEditorClient = () => {
|
|
|
25527
27334
|
const manager = new EditorStateManager({
|
|
25528
27335
|
mode: "client",
|
|
25529
27336
|
messenger: buildClientMessengerConfig(),
|
|
25530
|
-
configuration
|
|
27337
|
+
configuration
|
|
25531
27338
|
});
|
|
25532
27339
|
setGlobalEditorManager(manager);
|
|
25533
27340
|
defineIntlayerElements();
|
|
@@ -28369,7 +30176,7 @@ var CodeDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
|
28369
30176
|
}, `line-${index}-${line.slice(0, 10)}`)) : children })
|
|
28370
30177
|
})
|
|
28371
30178
|
});
|
|
28372
|
-
var CodeBlockShiki = (0, import_react.lazy)(() => __vitePreload(() => import("./CodeBlockShiki-
|
|
30179
|
+
var CodeBlockShiki = (0, import_react.lazy)(() => __vitePreload(() => import("./CodeBlockShiki-D9plzEFQ.js").then((mod) => ({ default: mod.CodeBlockShiki })), __vite__mapDeps([3,1,4,5,2])));
|
|
28373
30180
|
var CodeBlock = ({ className, onChange, isEditable, children, lang, isDarkMode, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
28374
30181
|
className: cn$2("flex w-full min-w-0 max-w-full overflow-x-auto", className),
|
|
28375
30182
|
...props,
|
|
@@ -46699,7 +48506,7 @@ var getSearchAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
46699
48506
|
};
|
|
46700
48507
|
//#endregion
|
|
46701
48508
|
//#region ../@intlayer/api/dist/esm/getIntlayerAPI/stripe.mjs
|
|
46702
|
-
var getStripeAPI = (authAPIOptions = {}, intlayerConfig =
|
|
48509
|
+
var getStripeAPI = (authAPIOptions = {}, intlayerConfig = configuration) => {
|
|
46703
48510
|
const STRIPE_API_ROUTE = `${intlayerConfig?.editor?.backendURL}/api/stripe`;
|
|
46704
48511
|
/**
|
|
46705
48512
|
* Get a pricing plan calculated for a given promotion code.
|
|
@@ -46936,7 +48743,7 @@ createDefu((object, key, currentValue) => {
|
|
|
46936
48743
|
//#endregion
|
|
46937
48744
|
//#region ../@intlayer/api/dist/esm/getIntlayerAPI/index.mjs
|
|
46938
48745
|
var getIntlayerAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
46939
|
-
const resolvedConfig = defu(intlayerConfig ?? {},
|
|
48746
|
+
const resolvedConfig = defu(intlayerConfig ?? {}, configuration);
|
|
46940
48747
|
return {
|
|
46941
48748
|
organization: getOrganizationAPI(authAPIOptions, resolvedConfig),
|
|
46942
48749
|
project: getProjectAPI(authAPIOptions, resolvedConfig),
|
|
@@ -46960,7 +48767,7 @@ var getIntlayerAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
46960
48767
|
//#region ../@intlayer/design-system/dist/esm/hooks/useAuth/useOAuth2.mjs
|
|
46961
48768
|
var useOAuth2 = (intlayerConfiguration) => {
|
|
46962
48769
|
const configuration$1 = useConfiguration();
|
|
46963
|
-
const config = intlayerConfiguration ?? configuration$1 ??
|
|
48770
|
+
const config = intlayerConfiguration ?? configuration$1 ?? configuration;
|
|
46964
48771
|
const { data } = useQuery({
|
|
46965
48772
|
queryKey: ["oAuth2AccessToken"],
|
|
46966
48773
|
queryFn: getOAuthAPI(config).getOAuth2AccessToken,
|
|
@@ -46985,7 +48792,7 @@ function defineErrorCodes(codes) {
|
|
|
46985
48792
|
}]));
|
|
46986
48793
|
}
|
|
46987
48794
|
//#endregion
|
|
46988
|
-
//#region ../../node_modules/.bun/@better-auth+passkey@1.5.5+
|
|
48795
|
+
//#region ../../node_modules/.bun/@better-auth+passkey@1.5.5+97f5c57d9a1a38cb/node_modules/@better-auth/passkey/dist/error-codes-Dvu2mv33.mjs
|
|
46989
48796
|
var PASSKEY_ERROR_CODES = defineErrorCodes({
|
|
46990
48797
|
CHALLENGE_NOT_FOUND: "Challenge not found",
|
|
46991
48798
|
YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: "You are not allowed to register this passkey",
|
|
@@ -47447,7 +49254,7 @@ async function startAuthentication(options) {
|
|
|
47447
49254
|
};
|
|
47448
49255
|
}
|
|
47449
49256
|
//#endregion
|
|
47450
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
49257
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+40b259e98b9c70b8/node_modules/better-auth/dist/client/broadcast-channel.mjs
|
|
47451
49258
|
var kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
|
|
47452
49259
|
var now$1 = () => Math.floor(Date.now() / 1e3);
|
|
47453
49260
|
var WindowBroadcastChannel = class {
|
|
@@ -47490,7 +49297,7 @@ function getGlobalBroadcastChannel(name = "better-auth.message") {
|
|
|
47490
49297
|
return globalThis[kBroadcastChannel];
|
|
47491
49298
|
}
|
|
47492
49299
|
//#endregion
|
|
47493
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
49300
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+40b259e98b9c70b8/node_modules/better-auth/dist/client/focus-manager.mjs
|
|
47494
49301
|
var kFocusManager = Symbol.for("better-auth:focus-manager");
|
|
47495
49302
|
var WindowFocusManager = class {
|
|
47496
49303
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -47519,7 +49326,7 @@ function getGlobalFocusManager() {
|
|
|
47519
49326
|
return globalThis[kFocusManager];
|
|
47520
49327
|
}
|
|
47521
49328
|
//#endregion
|
|
47522
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
49329
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+40b259e98b9c70b8/node_modules/better-auth/dist/client/online-manager.mjs
|
|
47523
49330
|
var kOnlineManager = Symbol.for("better-auth:online-manager");
|
|
47524
49331
|
var WindowOnlineManager = class {
|
|
47525
49332
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -47551,7 +49358,7 @@ function getGlobalOnlineManager() {
|
|
|
47551
49358
|
return globalThis[kOnlineManager];
|
|
47552
49359
|
}
|
|
47553
49360
|
//#endregion
|
|
47554
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
49361
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+40b259e98b9c70b8/node_modules/better-auth/dist/client/parser.mjs
|
|
47555
49362
|
var PROTO_POLLUTION_PATTERNS = {
|
|
47556
49363
|
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*:/,
|
|
47557
49364
|
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*:/,
|
|
@@ -47733,7 +49540,7 @@ var onMount = ($store, initialize) => {
|
|
|
47733
49540
|
});
|
|
47734
49541
|
};
|
|
47735
49542
|
//#endregion
|
|
47736
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
49543
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+40b259e98b9c70b8/node_modules/better-auth/dist/client/query.mjs
|
|
47737
49544
|
var isServer = () => typeof window === "undefined";
|
|
47738
49545
|
var useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
47739
49546
|
const value = /* @__PURE__ */ atom({
|
|
@@ -47827,7 +49634,7 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
|
47827
49634
|
return value;
|
|
47828
49635
|
};
|
|
47829
49636
|
//#endregion
|
|
47830
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
49637
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+40b259e98b9c70b8/node_modules/better-auth/dist/client/session-refresh.mjs
|
|
47831
49638
|
var now = () => Math.floor(Date.now() / 1e3);
|
|
47832
49639
|
/**
|
|
47833
49640
|
* Rate limit: don't refetch on focus if a session request was made within this many seconds
|
|
@@ -48026,7 +49833,7 @@ var BetterAuthError = class extends Error {
|
|
|
48026
49833
|
}
|
|
48027
49834
|
};
|
|
48028
49835
|
//#endregion
|
|
48029
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
49836
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+40b259e98b9c70b8/node_modules/better-auth/dist/utils/url.mjs
|
|
48030
49837
|
function checkHasPath(url) {
|
|
48031
49838
|
try {
|
|
48032
49839
|
return (new URL(url).pathname.replace(/\/+$/, "") || "/") !== "/";
|
|
@@ -48098,7 +49905,7 @@ function getOrigin(url) {
|
|
|
48098
49905
|
}
|
|
48099
49906
|
}
|
|
48100
49907
|
//#endregion
|
|
48101
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
49908
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+40b259e98b9c70b8/node_modules/better-auth/dist/client/fetch-plugins.mjs
|
|
48102
49909
|
var redirectPlugin = {
|
|
48103
49910
|
id: "redirect",
|
|
48104
49911
|
name: "Redirect",
|
|
@@ -48113,7 +49920,7 @@ var redirectPlugin = {
|
|
|
48113
49920
|
} }
|
|
48114
49921
|
};
|
|
48115
49922
|
//#endregion
|
|
48116
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
49923
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+40b259e98b9c70b8/node_modules/better-auth/dist/client/session-atom.mjs
|
|
48117
49924
|
function getSessionAtom($fetch, options) {
|
|
48118
49925
|
const $signal = /* @__PURE__ */ atom(false);
|
|
48119
49926
|
const session = useAuthQuery($signal, "/get-session", $fetch, { method: "GET" });
|
|
@@ -48572,7 +50379,7 @@ var betterFetch = async (url, options) => {
|
|
|
48572
50379
|
};
|
|
48573
50380
|
};
|
|
48574
50381
|
//#endregion
|
|
48575
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
50382
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+40b259e98b9c70b8/node_modules/better-auth/dist/client/config.mjs
|
|
48576
50383
|
var resolvePublicAuthUrl = (basePath) => {
|
|
48577
50384
|
if (typeof process === "undefined") return void 0;
|
|
48578
50385
|
const path = basePath ?? "/api/auth";
|
|
@@ -48670,12 +50477,12 @@ var getClientConfig = (options, loadEnv) => {
|
|
|
48670
50477
|
};
|
|
48671
50478
|
};
|
|
48672
50479
|
//#endregion
|
|
48673
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
50480
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+40b259e98b9c70b8/node_modules/better-auth/dist/utils/is-atom.mjs
|
|
48674
50481
|
function isAtom(value) {
|
|
48675
50482
|
return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
|
|
48676
50483
|
}
|
|
48677
50484
|
//#endregion
|
|
48678
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
50485
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+40b259e98b9c70b8/node_modules/better-auth/dist/client/proxy.mjs
|
|
48679
50486
|
function getMethod(path, knownPathMethods, args) {
|
|
48680
50487
|
const method = knownPathMethods[path];
|
|
48681
50488
|
const { fetchOptions, query: _query, ...body } = args || {};
|
|
@@ -48755,7 +50562,7 @@ function capitalizeFirstLetter(str) {
|
|
|
48755
50562
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
48756
50563
|
}
|
|
48757
50564
|
//#endregion
|
|
48758
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
50565
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+40b259e98b9c70b8/node_modules/better-auth/dist/client/vanilla.mjs
|
|
48759
50566
|
function createAuthClient(options) {
|
|
48760
50567
|
const { pluginPathMethods, pluginsActions, pluginsAtoms, $fetch, atomListeners, $store } = getClientConfig(options);
|
|
48761
50568
|
const resolvedHooks = {};
|
|
@@ -48768,7 +50575,7 @@ function createAuthClient(options) {
|
|
|
48768
50575
|
}, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
|
|
48769
50576
|
}
|
|
48770
50577
|
//#endregion
|
|
48771
|
-
//#region ../../node_modules/.bun/@better-auth+passkey@1.5.5+
|
|
50578
|
+
//#region ../../node_modules/.bun/@better-auth+passkey@1.5.5+97f5c57d9a1a38cb/node_modules/@better-auth/passkey/dist/client.mjs
|
|
48772
50579
|
var getPasskeyActions = ($fetch, { $listPasskeys, $store }) => {
|
|
48773
50580
|
const signInPasskey = async (opts, options) => {
|
|
48774
50581
|
const response = await $fetch("/passkey/generate-authenticate-options", {
|
|
@@ -48910,7 +50717,7 @@ var passkeyClient = () => {
|
|
|
48910
50717
|
};
|
|
48911
50718
|
};
|
|
48912
50719
|
//#endregion
|
|
48913
|
-
//#region ../../node_modules/.bun/@better-auth+sso@1.5.5+
|
|
50720
|
+
//#region ../../node_modules/.bun/@better-auth+sso@1.5.5+9a386bd0a1ca2f57/node_modules/@better-auth/sso/dist/client.mjs
|
|
48914
50721
|
var ssoClient = (options) => {
|
|
48915
50722
|
return {
|
|
48916
50723
|
id: "sso-client",
|
|
@@ -48922,7 +50729,7 @@ var ssoClient = (options) => {
|
|
|
48922
50729
|
};
|
|
48923
50730
|
};
|
|
48924
50731
|
//#endregion
|
|
48925
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
50732
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+40b259e98b9c70b8/node_modules/better-auth/dist/plugins/magic-link/client.mjs
|
|
48926
50733
|
var magicLinkClient = () => {
|
|
48927
50734
|
return {
|
|
48928
50735
|
id: "magic-link",
|
|
@@ -48930,7 +50737,7 @@ var magicLinkClient = () => {
|
|
|
48930
50737
|
};
|
|
48931
50738
|
};
|
|
48932
50739
|
//#endregion
|
|
48933
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
50740
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+40b259e98b9c70b8/node_modules/better-auth/dist/plugins/two-factor/error-code.mjs
|
|
48934
50741
|
var TWO_FACTOR_ERROR_CODES = defineErrorCodes({
|
|
48935
50742
|
OTP_NOT_ENABLED: "OTP not enabled",
|
|
48936
50743
|
OTP_HAS_EXPIRED: "OTP has expired",
|
|
@@ -48943,7 +50750,7 @@ var TWO_FACTOR_ERROR_CODES = defineErrorCodes({
|
|
|
48943
50750
|
INVALID_TWO_FACTOR_COOKIE: "Invalid two factor cookie"
|
|
48944
50751
|
});
|
|
48945
50752
|
//#endregion
|
|
48946
|
-
//#region ../../node_modules/.bun/better-auth@1.5.5+
|
|
50753
|
+
//#region ../../node_modules/.bun/better-auth@1.5.5+40b259e98b9c70b8/node_modules/better-auth/dist/plugins/two-factor/client.mjs
|
|
48947
50754
|
var twoFactorClient = (options) => {
|
|
48948
50755
|
return {
|
|
48949
50756
|
id: "two-factor",
|
|
@@ -48991,12 +50798,12 @@ var getAuthClient = (backendURL) => createAuthClient({
|
|
|
48991
50798
|
]
|
|
48992
50799
|
});
|
|
48993
50800
|
var getAuthAPI = (intlayerConfig) => {
|
|
48994
|
-
let backendURL = intlayerConfig?.editor?.backendURL ??
|
|
50801
|
+
let backendURL = intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;
|
|
48995
50802
|
if (!backendURL) {
|
|
48996
50803
|
backendURL = BACKEND_URL;
|
|
48997
50804
|
console.dir({
|
|
48998
50805
|
intlayerConfig,
|
|
48999
|
-
configuration
|
|
50806
|
+
configuration
|
|
49000
50807
|
}, { depth: null });
|
|
49001
50808
|
console.error("Backend URL is not defined in the Intlayer configuration.");
|
|
49002
50809
|
}
|
|
@@ -49153,7 +50960,7 @@ var getAuthAPI = (intlayerConfig) => {
|
|
|
49153
50960
|
//#region ../@intlayer/design-system/dist/esm/hooks/useAuth/useSession.mjs
|
|
49154
50961
|
var useSession = (sessionProp, intlayerConfiguration) => {
|
|
49155
50962
|
const configuration$1 = useConfiguration();
|
|
49156
|
-
const config = intlayerConfiguration ?? configuration$1 ??
|
|
50963
|
+
const config = intlayerConfiguration ?? configuration$1 ?? configuration;
|
|
49157
50964
|
const queryClient = useQueryClient();
|
|
49158
50965
|
const { data, isFetched, refetch } = useQuery({
|
|
49159
50966
|
queryKey: ["session"],
|
|
@@ -50194,7 +52001,7 @@ var getIsEditableSection = (section) => {
|
|
|
50194
52001
|
//#endregion
|
|
50195
52002
|
//#region ../@intlayer/design-system/dist/esm/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs
|
|
50196
52003
|
var NavigationViewNode = ({ section: sectionProp, keyPath, dictionary }) => {
|
|
50197
|
-
const { locales } =
|
|
52004
|
+
const { locales } = configuration.internationalization;
|
|
50198
52005
|
const section = getContentNodeByKeyPath(sectionProp, keyPath, useEditorLocale());
|
|
50199
52006
|
const { addEditedContent } = useEditedContentActions();
|
|
50200
52007
|
const { setFocusedContentKeyPath, focusedContent } = useFocusUnmergedDictionary();
|
|
@@ -50407,7 +52214,7 @@ var FormItem = ({ id: idProp, ...props }) => {
|
|
|
50407
52214
|
};
|
|
50408
52215
|
var FormItemContext = (0, import_react.createContext)({});
|
|
50409
52216
|
//#endregion
|
|
50410
|
-
//#region ../../node_modules/.bun/react-hook-form@7.
|
|
52217
|
+
//#region ../../node_modules/.bun/react-hook-form@7.72.0+b1ab299f0a400331/node_modules/react-hook-form/dist/index.esm.mjs
|
|
50411
52218
|
var isCheckBoxInput = (element) => element.type === "checkbox";
|
|
50412
52219
|
var isDateObject = (value) => value instanceof Date;
|
|
50413
52220
|
var isNullOrUndefined = (value) => value == null;
|
|
@@ -50462,7 +52269,10 @@ var set = (object, path, value) => {
|
|
|
50462
52269
|
var EVENTS = {
|
|
50463
52270
|
BLUR: "blur",
|
|
50464
52271
|
FOCUS_OUT: "focusout",
|
|
50465
|
-
CHANGE: "change"
|
|
52272
|
+
CHANGE: "change",
|
|
52273
|
+
SUBMIT: "submit",
|
|
52274
|
+
TRIGGER: "trigger",
|
|
52275
|
+
VALID: "valid"
|
|
50466
52276
|
};
|
|
50467
52277
|
var VALIDATION_MODE = {
|
|
50468
52278
|
onBlur: "onBlur",
|
|
@@ -50480,6 +52290,8 @@ var INPUT_VALIDATION_RULES = {
|
|
|
50480
52290
|
required: "required",
|
|
50481
52291
|
validate: "validate"
|
|
50482
52292
|
};
|
|
52293
|
+
var FORM_ERROR_TYPE = "form";
|
|
52294
|
+
var ROOT_ERROR_TYPE = "root";
|
|
50483
52295
|
/**
|
|
50484
52296
|
* Separate context for `control` to prevent unnecessary rerenders.
|
|
50485
52297
|
* Internal hooks that only need control use this instead of full form context.
|
|
@@ -51215,7 +53027,7 @@ var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode)
|
|
|
51215
53027
|
var unsetEmptyArray = (ref, name) => !compact(get(ref, name)).length && unset(ref, name);
|
|
51216
53028
|
var updateFieldArrayRootError = (errors, error, name) => {
|
|
51217
53029
|
const fieldArrayErrors = convertToArrayPayload(get(errors, name));
|
|
51218
|
-
set(fieldArrayErrors,
|
|
53030
|
+
set(fieldArrayErrors, ROOT_ERROR_TYPE, error[name]);
|
|
51219
53031
|
set(errors, name, fieldArrayErrors);
|
|
51220
53032
|
return errors;
|
|
51221
53033
|
};
|
|
@@ -51437,7 +53249,11 @@ function createFormControl(props = {}) {
|
|
|
51437
53249
|
if (_options.resolver) {
|
|
51438
53250
|
isValid = isEmptyObject((await _runSchema()).errors);
|
|
51439
53251
|
_updateIsValidating();
|
|
51440
|
-
} else isValid = await executeBuiltInValidation(
|
|
53252
|
+
} else isValid = await executeBuiltInValidation({
|
|
53253
|
+
fields: _fields,
|
|
53254
|
+
onlyCheckValid: true,
|
|
53255
|
+
eventType: EVENTS.VALID
|
|
53256
|
+
});
|
|
51441
53257
|
if (isValid !== _formState.isValid) _subjects.state.next({ isValid });
|
|
51442
53258
|
}
|
|
51443
53259
|
};
|
|
@@ -51468,7 +53284,11 @@ function createFormControl(props = {}) {
|
|
|
51468
53284
|
const touchedFields = method(get(_formState.touchedFields, name), args.argA, args.argB);
|
|
51469
53285
|
shouldSetValues && set(_formState.touchedFields, name, touchedFields);
|
|
51470
53286
|
}
|
|
51471
|
-
if (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields)
|
|
53287
|
+
if (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) {
|
|
53288
|
+
const fullDirtyFields = getDirtyFields(_defaultValues, _formValues);
|
|
53289
|
+
const rootName = getNodeParentName(name);
|
|
53290
|
+
set(_formState.dirtyFields, rootName, get(fullDirtyFields, rootName));
|
|
53291
|
+
}
|
|
51472
53292
|
_subjects.state.next({
|
|
51473
53293
|
name,
|
|
51474
53294
|
isDirty: _getDirty(name, values),
|
|
@@ -51565,7 +53385,42 @@ function createFormControl(props = {}) {
|
|
|
51565
53385
|
else _formState.errors = errors;
|
|
51566
53386
|
return errors;
|
|
51567
53387
|
};
|
|
51568
|
-
const
|
|
53388
|
+
const validateForm = async ({ name, eventType }) => {
|
|
53389
|
+
if (props.validate) {
|
|
53390
|
+
const result = await props.validate({
|
|
53391
|
+
formValues: _formValues,
|
|
53392
|
+
formState: _formState,
|
|
53393
|
+
name,
|
|
53394
|
+
eventType
|
|
53395
|
+
});
|
|
53396
|
+
if (isObject$1(result)) {
|
|
53397
|
+
for (const key in result) if (result[key]) setError(`${FORM_ERROR_TYPE}.${key}`, {
|
|
53398
|
+
message: isString(result.message) ? result.message : "",
|
|
53399
|
+
type: INPUT_VALIDATION_RULES.validate
|
|
53400
|
+
});
|
|
53401
|
+
} else if (isString(result) || !result) setError(FORM_ERROR_TYPE, {
|
|
53402
|
+
message: result || "",
|
|
53403
|
+
type: INPUT_VALIDATION_RULES.validate
|
|
53404
|
+
});
|
|
53405
|
+
else clearErrors(FORM_ERROR_TYPE);
|
|
53406
|
+
return result;
|
|
53407
|
+
}
|
|
53408
|
+
return true;
|
|
53409
|
+
};
|
|
53410
|
+
const executeBuiltInValidation = async ({ fields, onlyCheckValid, name, eventType, context = {
|
|
53411
|
+
valid: true,
|
|
53412
|
+
runRootValidation: false
|
|
53413
|
+
} }) => {
|
|
53414
|
+
if (props.validate) {
|
|
53415
|
+
context.runRootValidation = true;
|
|
53416
|
+
if (!await validateForm({
|
|
53417
|
+
name,
|
|
53418
|
+
eventType
|
|
53419
|
+
})) {
|
|
53420
|
+
context.valid = false;
|
|
53421
|
+
if (onlyCheckValid) return context.valid;
|
|
53422
|
+
}
|
|
53423
|
+
}
|
|
51569
53424
|
for (const name in fields) {
|
|
51570
53425
|
const field = fields[name];
|
|
51571
53426
|
if (field) {
|
|
@@ -51574,15 +53429,22 @@ function createFormControl(props = {}) {
|
|
|
51574
53429
|
const isFieldArrayRoot = _names.array.has(_f.name);
|
|
51575
53430
|
const isPromiseFunction = field._f && hasPromiseValidation(field._f);
|
|
51576
53431
|
if (isPromiseFunction && _proxyFormState.validatingFields) _updateIsValidating([_f.name], true);
|
|
51577
|
-
const fieldError = await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !
|
|
53432
|
+
const fieldError = await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !onlyCheckValid, isFieldArrayRoot);
|
|
51578
53433
|
if (isPromiseFunction && _proxyFormState.validatingFields) _updateIsValidating([_f.name]);
|
|
51579
53434
|
if (fieldError[_f.name]) {
|
|
51580
53435
|
context.valid = false;
|
|
51581
|
-
if (
|
|
53436
|
+
if (onlyCheckValid) break;
|
|
51582
53437
|
}
|
|
51583
|
-
!
|
|
53438
|
+
!onlyCheckValid && (get(fieldError, _f.name) ? isFieldArrayRoot ? updateFieldArrayRootError(_formState.errors, fieldError, _f.name) : set(_formState.errors, _f.name, fieldError[_f.name]) : unset(_formState.errors, _f.name));
|
|
53439
|
+
if (props.shouldUseNativeValidation && fieldError[_f.name]) break;
|
|
51584
53440
|
}
|
|
51585
|
-
!isEmptyObject(fieldValue) && await executeBuiltInValidation(
|
|
53441
|
+
!isEmptyObject(fieldValue) && await executeBuiltInValidation({
|
|
53442
|
+
context,
|
|
53443
|
+
onlyCheckValid,
|
|
53444
|
+
fields: fieldValue,
|
|
53445
|
+
name,
|
|
53446
|
+
eventType
|
|
53447
|
+
});
|
|
51586
53448
|
}
|
|
51587
53449
|
}
|
|
51588
53450
|
return context.valid;
|
|
@@ -51675,7 +53537,7 @@ function createFormControl(props = {}) {
|
|
|
51675
53537
|
let isValid;
|
|
51676
53538
|
const fieldValue = target.type ? getFieldValue(field._f) : getEventValue(event);
|
|
51677
53539
|
const isBlurEvent = event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;
|
|
51678
|
-
const shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get(_formState.errors, name) && !field._f.deps || skipValidation(isBlurEvent, get(_formState.touchedFields, name), _formState.isSubmitted, validationModeAfterSubmit, validationModeBeforeSubmit);
|
|
53540
|
+
const shouldSkipValidation = !hasValidation(field._f) && !props.validate && !_options.resolver && !get(_formState.errors, name) && !field._f.deps || skipValidation(isBlurEvent, get(_formState.touchedFields, name), _formState.isSubmitted, validationModeAfterSubmit, validationModeBeforeSubmit);
|
|
51679
53541
|
const watched = isWatched(name, _names, isBlurEvent);
|
|
51680
53542
|
set(_formValues, name, fieldValue);
|
|
51681
53543
|
if (isBlurEvent) {
|
|
@@ -51702,6 +53564,10 @@ function createFormControl(props = {}) {
|
|
|
51702
53564
|
...watched ? {} : fieldState
|
|
51703
53565
|
});
|
|
51704
53566
|
}
|
|
53567
|
+
if (!_options.resolver && props.validate) await validateForm({
|
|
53568
|
+
name,
|
|
53569
|
+
eventType: event.type
|
|
53570
|
+
});
|
|
51705
53571
|
!isBlurEvent && watched && _subjects.state.next({ ..._formState });
|
|
51706
53572
|
if (_options.resolver) {
|
|
51707
53573
|
const { errors } = await _runSchema([name]);
|
|
@@ -51721,7 +53587,12 @@ function createFormControl(props = {}) {
|
|
|
51721
53587
|
_updateIsFieldValueUpdated(fieldValue);
|
|
51722
53588
|
if (isFieldValueUpdated) {
|
|
51723
53589
|
if (error) isValid = false;
|
|
51724
|
-
else if (_proxyFormState.isValid || _proxySubscribeFormState.isValid) isValid = await executeBuiltInValidation(
|
|
53590
|
+
else if (_proxyFormState.isValid || _proxySubscribeFormState.isValid) isValid = await executeBuiltInValidation({
|
|
53591
|
+
fields: _fields,
|
|
53592
|
+
onlyCheckValid: true,
|
|
53593
|
+
name,
|
|
53594
|
+
eventType: event.type
|
|
53595
|
+
});
|
|
51725
53596
|
}
|
|
51726
53597
|
}
|
|
51727
53598
|
if (isFieldValueUpdated) {
|
|
@@ -51747,10 +53618,17 @@ function createFormControl(props = {}) {
|
|
|
51747
53618
|
} else if (name) {
|
|
51748
53619
|
validationResult = (await Promise.all(fieldNames.map(async (fieldName) => {
|
|
51749
53620
|
const field = get(_fields, fieldName);
|
|
51750
|
-
return await executeBuiltInValidation(
|
|
53621
|
+
return await executeBuiltInValidation({
|
|
53622
|
+
fields: field && field._f ? { [fieldName]: field } : field,
|
|
53623
|
+
eventType: EVENTS.TRIGGER
|
|
53624
|
+
});
|
|
51751
53625
|
}))).every(Boolean);
|
|
51752
53626
|
!(!validationResult && !_formState.isValid) && _setValid();
|
|
51753
|
-
} else validationResult = isValid = await executeBuiltInValidation(
|
|
53627
|
+
} else validationResult = isValid = await executeBuiltInValidation({
|
|
53628
|
+
fields: _fields,
|
|
53629
|
+
name,
|
|
53630
|
+
eventType: EVENTS.TRIGGER
|
|
53631
|
+
});
|
|
51754
53632
|
_subjects.state.next({
|
|
51755
53633
|
...!isString(name) || (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isValid !== _formState.isValid ? {} : { name },
|
|
51756
53634
|
..._options.resolver || !name ? { isValid } : {},
|
|
@@ -51938,9 +53816,12 @@ function createFormControl(props = {}) {
|
|
|
51938
53816
|
_updateIsValidating();
|
|
51939
53817
|
_formState.errors = errors;
|
|
51940
53818
|
fieldValues = cloneObject(values);
|
|
51941
|
-
} else await executeBuiltInValidation(
|
|
53819
|
+
} else await executeBuiltInValidation({
|
|
53820
|
+
fields: _fields,
|
|
53821
|
+
eventType: EVENTS.SUBMIT
|
|
53822
|
+
});
|
|
51942
53823
|
if (_names.disabled.size) for (const name of _names.disabled) unset(fieldValues, name);
|
|
51943
|
-
unset(_formState.errors,
|
|
53824
|
+
unset(_formState.errors, ROOT_ERROR_TYPE);
|
|
51944
53825
|
if (isEmptyObject(_formState.errors)) {
|
|
51945
53826
|
_subjects.state.next({ errors: {} });
|
|
51946
53827
|
try {
|
|
@@ -52375,7 +54256,7 @@ var InformationTag = ({ className, children, ...props }) => /* @__PURE__ */ (0,
|
|
|
52375
54256
|
children: ["ⓘ ", children]
|
|
52376
54257
|
});
|
|
52377
54258
|
//#endregion
|
|
52378
|
-
//#region ../../node_modules/.bun/@hookform+resolvers@5.2.2+
|
|
54259
|
+
//#region ../../node_modules/.bun/@hookform+resolvers@5.2.2+b828ecb606cdb5bc/node_modules/@hookform/resolvers/dist/resolvers.mjs
|
|
52379
54260
|
var r = (t, r, o) => {
|
|
52380
54261
|
if (t && "reportValidity" in t) {
|
|
52381
54262
|
const s = get(o, r);
|
|
@@ -55160,7 +57041,7 @@ var optionalProcessor = (schema, ctx, _json, params) => {
|
|
|
55160
57041
|
seen.ref = def.innerType;
|
|
55161
57042
|
};
|
|
55162
57043
|
//#endregion
|
|
55163
|
-
//#region ../../node_modules/.bun/@hookform+resolvers@5.2.2+
|
|
57044
|
+
//#region ../../node_modules/.bun/@hookform+resolvers@5.2.2+b828ecb606cdb5bc/node_modules/@hookform/resolvers/zod/dist/zod.mjs
|
|
55164
57045
|
function t(r, e) {
|
|
55165
57046
|
try {
|
|
55166
57047
|
var o = r();
|
|
@@ -57004,7 +58885,7 @@ var DictionaryDetailsForm = ({ dictionary, mode }) => {
|
|
|
57004
58885
|
};
|
|
57005
58886
|
//#endregion
|
|
57006
58887
|
//#region ../@intlayer/design-system/dist/esm/components/IDE/MonacoCode.mjs
|
|
57007
|
-
var Editor = (0, import_react.lazy)(() => __vitePreload(() => import("./dist-
|
|
58888
|
+
var Editor = (0, import_react.lazy)(() => __vitePreload(() => import("./dist-D8J9DkzO.js").then((mod) => ({ default: mod.Editor })), __vite__mapDeps([6,1,2])));
|
|
57008
58889
|
var MonacoCode = ({ children, language, isDarkMode, showLineNumbers, showCopyButton = true, isReadOnly = false, onChange }) => {
|
|
57009
58890
|
const containerRef = (0, import_react.useRef)(null);
|
|
57010
58891
|
const ideRef = (0, import_react.useRef)(null);
|
|
@@ -59560,4 +61441,4 @@ var App = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppRouter, { childre
|
|
|
59560
61441
|
//#region client/src/main.tsx
|
|
59561
61442
|
(0, import_client.createRoot)(document.getElementById("root")).render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {}) }));
|
|
59562
61443
|
//#endregion
|
|
59563
|
-
export {
|
|
61444
|
+
export { useMarkdownContext as n, CodeDefault as t };
|