@aiquants/markdown-explorer 0.24.1 → 0.25.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +14 -5
  3. package/dist/{EditSurface-CFXG8Qok.js → EditSurface-Blymamic.js} +3 -3
  4. package/dist/{EditSurface-CiKQiYSD.cjs → EditSurface-Co4Rvfa1.cjs} +1 -1
  5. package/dist/{ExplorerSplit-DIkC3R7O.js → ExplorerSplit-BZ0PA3z3.js} +47 -47
  6. package/dist/{ExplorerSplit-BWMVatnB.cjs → ExplorerSplit-WApgYMPb.cjs} +1 -1
  7. package/dist/{MultiLayout-DXnuRzb4.js → MultiLayout-B5-1N3JD.js} +3 -3
  8. package/dist/{MultiLayout-q_Pvwykp.cjs → MultiLayout-dAW_JCzg.cjs} +1 -1
  9. package/dist/{NativeScrollBar-s_uSPPEd.js → NativeScrollBar-BraWuZvN.js} +1 -1
  10. package/dist/{NativeScrollBar-UYBG64v1.cjs → NativeScrollBar-ThVMbI0Y.cjs} +1 -1
  11. package/dist/{TreeLayout-Di0yv1E-.cjs → TreeLayout-C60lb9hP.cjs} +1 -1
  12. package/dist/{TreeLayout-BQ1lWVf3.js → TreeLayout-CChoxh9W.js} +3 -3
  13. package/dist/core/textEncoding.d.cts +1 -0
  14. package/dist/core/textEncoding.d.ts +1 -0
  15. package/dist/{index-ZdsIXJap.cjs → index-B6FkGD-p.cjs} +4 -4
  16. package/dist/{index-BhxsL0Sm.js → index-Bd6hgisa.js} +5 -5
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.js +3 -3
  19. package/dist/location-D3DgoELB.cjs +1 -0
  20. package/dist/{location-gXXmC7CQ.js → location-DIxIjqs7.js} +147 -140
  21. package/dist/{merge-CQAXBfvi.js → merge-CgSp-0Dd.js} +1 -1
  22. package/dist/{merge-DkmrVEIc.cjs → merge-DRWmjC24.cjs} +1 -1
  23. package/dist/server.cjs +1 -1
  24. package/dist/server.js +785 -725
  25. package/dist/{useSplitPersistence-Bmpb2prR.cjs → useSplitPersistence-D-T75Hlh.cjs} +1 -1
  26. package/dist/{useSplitPersistence-BPNjvuJi.js → useSplitPersistence-Df63lnQZ.js} +1 -1
  27. package/docs/behavior/security.md +5 -2
  28. package/docs/behavior/url-contract.md +3 -3
  29. package/package.json +1 -1
  30. package/dist/location-CasigkBk.cjs +0 -1
@@ -2,7 +2,7 @@ import { jsxs as H, jsx as s, Fragment as je } from "react/jsx-runtime";
2
2
  import * as y from "react";
3
3
  import { createContext as he, use as oe, useMemo as Y, useSyncExternalStore as re, useRef as B, useLayoutEffect as K, useCallback as q, useId as ke, useEffect as ee, Component as En, Suspense as xe, lazy as gt, useState as U, useEffectEvent as ae } from "react";
4
4
  import { useParams as br, useSearchParams as Er, matchPath as yr, useBlocker as Sr, useNavigate as kr, Link as xr, useHref as ze, useLocation as yn, useRevalidator as Tr } from "react-router";
5
- import { k as Rr, h as Sn, G as Cr, E as kn, a as xn, H as Or, I as Dt, J as Mr, K as be, e as ye, m as Lr, L as Ar, M as Nr, O as Dr, Q as Pt, R as Pr, T as It, U as Ir, w as $r, V as Fr } from "./location-gXXmC7CQ.js";
5
+ import { k as Rr, h as Sn, H as Cr, E as kn, a as xn, I as Or, J as Dt, K as Mr, L as be, e as ye, m as Lr, M as Ar, O as Nr, Q as Dr, R as Pt, T as Pr, U as It, V as Ir, w as $r, W as Fr } from "./location-DIxIjqs7.js";
6
6
  import { SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS as $t, SPREADSHEET_BLOCK_LABEL_CATALOGS as qe } from "@aiquants/markdown/code-blocks";
7
7
  import { H as ce, i as qr, I as wt, A as te, J as Xe, B as Je, z as _r, K as Br, f as Hr, L as jr, N as zr, O as Vr, P as Ur, Q as Ft, x as Zr, R as Gr, S as Wr, T as Kr, D as Yr, y as Xr, U as Jr, V as Qr, W as eo, w as qt } from "./dataRoute-BEvesOvN.js";
8
8
  import { HostedScrollArea as _t, SpreadsheetBlock as to, useMarkdownToolbarState as no, MarkdownViewer as Tn } from "@aiquants/markdown";
@@ -797,7 +797,7 @@ const jt = Object.freeze(["en", "ja"]), fo = "en", vt = (e) => `viewerSpreadshee
797
797
  _(d, m, { kind: "failed", failure: C.failure });
798
798
  return;
799
799
  }
800
- const { mergeDraft: P } = await import("./merge-CQAXBfvi.js");
800
+ const { mergeDraft: P } = await import("./merge-CgSp-0Dd.js");
801
801
  if (!x(d, m) || I.aborted) return;
802
802
  const j = f.get(d);
803
803
  j?.flush();
@@ -1119,7 +1119,7 @@ function Yo({
1119
1119
  }
1120
1120
  const Xo = /* @__PURE__ */ y.forwardRef(Yo);
1121
1121
  let tt = null;
1122
- const Hn = () => (tt ??= import("./EditSurface-CFXG8Qok.js").catch((e) => {
1122
+ const Hn = () => (tt ??= import("./EditSurface-Blymamic.js").catch((e) => {
1123
1123
  throw tt = null, e;
1124
1124
  }), tt), Jo = () => {
1125
1125
  Hn().catch(() => {
@@ -1296,7 +1296,7 @@ const Et = `[${Rn}]`, ti = "[data-aqmd-content]", ni = 'a[href], button, input,
1296
1296
  }),
1297
1297
  [c, f]
1298
1298
  );
1299
- }, wi = gt(() => import("./NativeScrollBar-s_uSPPEd.js").then((e) => ({ default: e.NativeScrollBar })));
1299
+ }, wi = gt(() => import("./NativeScrollBar-BraWuZvN.js").then((e) => ({ default: e.NativeScrollBar })));
1300
1300
  class vi extends En {
1301
1301
  state = { failed: !1 };
1302
1302
  static getDerivedStateFromError() {
@@ -3866,7 +3866,7 @@ const Rs = () => {
3866
3866
  });
3867
3867
  return c.observe(a, { childList: !0, subtree: !0 }), () => c.disconnect();
3868
3868
  }, [t, e]);
3869
- }, Is = gt(() => import("./TreeLayout-BQ1lWVf3.js").then((e) => ({ default: e.TreeLayout }))), $s = gt(() => import("./MultiLayout-DXnuRzb4.js").then((e) => ({ default: e.MultiLayout }))), Fs = 64, qs = {
3869
+ }, Is = gt(() => import("./TreeLayout-CChoxh9W.js").then((e) => ({ default: e.TreeLayout }))), $s = gt(() => import("./MultiLayout-B5-1N3JD.js").then((e) => ({ default: e.MultiLayout }))), Fs = 64, qs = {
3870
3870
  request: (e) => {
3871
3871
  requestAnimationFrame(e);
3872
3872
  }
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("./index-ZdsIXJap.cjs"),e=require("./storage-DM0EvkVf.cjs"),E=require("./location-CasigkBk.cjs"),_=require("./dataRoute-Cv7fgCW7.cjs");exports.DEFAULT_MARKDOWN_EXPLORER_LOCALE=L.DEFAULT_MARKDOWN_EXPLORER_LOCALE;exports.EXPLORER_THEMES=L.EXPLORER_THEMES;exports.MARKDOWN_EXPLORER_LABEL_CATALOGS=L.MARKDOWN_EXPLORER_LABEL_CATALOGS;exports.MARKDOWN_EXPLORER_LABEL_KEYS=L.MARKDOWN_EXPLORER_LABEL_KEYS;exports.MARKDOWN_EXPLORER_LABEL_TEMPLATES=L.MARKDOWN_EXPLORER_LABEL_TEMPLATES;exports.MARKDOWN_EXPLORER_LOCALES=L.MARKDOWN_EXPLORER_LOCALES;exports.MarkdownExplorer=L.MarkdownExplorer;exports.resolveMarkdownExplorerLabels=L.resolveMarkdownExplorerLabels;exports.shouldRevalidateExplorer=L.shouldRevalidateExplorer;exports.clearExplorerStorage=e.clearExplorerStorage;exports.COLUMN_MIN_MEASURE=E.COLUMN_MIN_MEASURE;exports.DEFAULT_TREE_SETTINGS=E.DEFAULT_TREE_SETTINGS;exports.DEFAULT_VIEW_SLUGS=E.DEFAULT_VIEW_SLUGS;exports.EXPAND_ALL_DEPTH_LIMITS=E.EXPAND_ALL_DEPTH_LIMITS;exports.EXPAND_ALL_FOLDER_LIMITS=E.EXPAND_ALL_FOLDER_LIMITS;exports.EXPLORER_DEFAULT_PERCENT=E.EXPLORER_DEFAULT_PERCENT;exports.EXPLORER_MAX_PERCENT=E.EXPLORER_MAX_PERCENT;exports.EXPLORER_MIN_REM=E.EXPLORER_MIN_REM;exports.EXPLORER_MULTI_DEFAULT_PERCENT=E.EXPLORER_MULTI_DEFAULT_PERCENT;exports.GOLDEN_RATIO=E.GOLDEN_RATIO;exports.MULTI_VIEW_COLUMN_LIMITS=E.MULTI_VIEW_COLUMN_LIMITS;exports.MULTI_VIEW_PANEL_LIMITS=E.MULTI_VIEW_PANEL_LIMITS;exports.REVEAL_DOCUMENT_DEPTH_LIMITS=E.REVEAL_DOCUMENT_DEPTH_LIMITS;exports.SPREADSHEET_BYTE_LIMITS=E.SPREADSHEET_BYTE_LIMITS;exports.defineExplorerConfig=E.defineExplorerConfig;exports.explorerHref=E.explorerHref;exports.isExplorerSourceId=E.isExplorerSourceId;exports.resolveExplorerLocation=E.resolveExplorerLocation;exports.withExplorerSources=E.withExplorerSources;exports.DEFAULT_DENIED_PATH_SEGMENTS=_.DEFAULT_DENIED_PATH_SEGMENTS;exports.EXPLORER_EDIT_TOKEN_MAX_LENGTH=_.EXPLORER_EDIT_TOKEN_MAX_LENGTH;exports.EXPLORER_FAILURE_REASONS=_.EXPLORER_FAILURE_REASONS;exports.EXPLORER_MAX_HEADINGS=_.EXPLORER_MAX_HEADINGS;exports.MAX_DOCUMENT_PATH_LENGTH=_.MAX_DOCUMENT_PATH_LENGTH;exports.failureDocument=_.failureDocument;exports.failureOf=_.failureOf;exports.isAcceptableDocumentPath=_.isAcceptableDocumentPath;exports.isDeniedPath=_.isDeniedPath;exports.isExplorerChildrenResult=_.isExplorerChildrenResult;exports.isExplorerFailureCode=_.isExplorerFailureCode;exports.isExplorerFailureReason=_.isExplorerFailureReason;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("./index-B6FkGD-p.cjs"),e=require("./storage-DM0EvkVf.cjs"),E=require("./location-D3DgoELB.cjs"),_=require("./dataRoute-Cv7fgCW7.cjs");exports.DEFAULT_MARKDOWN_EXPLORER_LOCALE=L.DEFAULT_MARKDOWN_EXPLORER_LOCALE;exports.EXPLORER_THEMES=L.EXPLORER_THEMES;exports.MARKDOWN_EXPLORER_LABEL_CATALOGS=L.MARKDOWN_EXPLORER_LABEL_CATALOGS;exports.MARKDOWN_EXPLORER_LABEL_KEYS=L.MARKDOWN_EXPLORER_LABEL_KEYS;exports.MARKDOWN_EXPLORER_LABEL_TEMPLATES=L.MARKDOWN_EXPLORER_LABEL_TEMPLATES;exports.MARKDOWN_EXPLORER_LOCALES=L.MARKDOWN_EXPLORER_LOCALES;exports.MarkdownExplorer=L.MarkdownExplorer;exports.resolveMarkdownExplorerLabels=L.resolveMarkdownExplorerLabels;exports.shouldRevalidateExplorer=L.shouldRevalidateExplorer;exports.clearExplorerStorage=e.clearExplorerStorage;exports.COLUMN_MIN_MEASURE=E.COLUMN_MIN_MEASURE;exports.DEFAULT_TREE_SETTINGS=E.DEFAULT_TREE_SETTINGS;exports.DEFAULT_VIEW_SLUGS=E.DEFAULT_VIEW_SLUGS;exports.EXPAND_ALL_DEPTH_LIMITS=E.EXPAND_ALL_DEPTH_LIMITS;exports.EXPAND_ALL_FOLDER_LIMITS=E.EXPAND_ALL_FOLDER_LIMITS;exports.EXPLORER_DEFAULT_PERCENT=E.EXPLORER_DEFAULT_PERCENT;exports.EXPLORER_MAX_PERCENT=E.EXPLORER_MAX_PERCENT;exports.EXPLORER_MIN_REM=E.EXPLORER_MIN_REM;exports.EXPLORER_MULTI_DEFAULT_PERCENT=E.EXPLORER_MULTI_DEFAULT_PERCENT;exports.GOLDEN_RATIO=E.GOLDEN_RATIO;exports.MULTI_VIEW_COLUMN_LIMITS=E.MULTI_VIEW_COLUMN_LIMITS;exports.MULTI_VIEW_PANEL_LIMITS=E.MULTI_VIEW_PANEL_LIMITS;exports.REVEAL_DOCUMENT_DEPTH_LIMITS=E.REVEAL_DOCUMENT_DEPTH_LIMITS;exports.SPREADSHEET_BYTE_LIMITS=E.SPREADSHEET_BYTE_LIMITS;exports.defineExplorerConfig=E.defineExplorerConfig;exports.explorerHref=E.explorerHref;exports.isExplorerSourceId=E.isExplorerSourceId;exports.resolveExplorerLocation=E.resolveExplorerLocation;exports.withExplorerSources=E.withExplorerSources;exports.DEFAULT_DENIED_PATH_SEGMENTS=_.DEFAULT_DENIED_PATH_SEGMENTS;exports.EXPLORER_EDIT_TOKEN_MAX_LENGTH=_.EXPLORER_EDIT_TOKEN_MAX_LENGTH;exports.EXPLORER_FAILURE_REASONS=_.EXPLORER_FAILURE_REASONS;exports.EXPLORER_MAX_HEADINGS=_.EXPLORER_MAX_HEADINGS;exports.MAX_DOCUMENT_PATH_LENGTH=_.MAX_DOCUMENT_PATH_LENGTH;exports.failureDocument=_.failureDocument;exports.failureOf=_.failureOf;exports.isAcceptableDocumentPath=_.isAcceptableDocumentPath;exports.isDeniedPath=_.isDeniedPath;exports.isExplorerChildrenResult=_.isExplorerChildrenResult;exports.isExplorerFailureCode=_.isExplorerFailureCode;exports.isExplorerFailureReason=_.isExplorerFailureReason;
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { X as _, Y as L, Z as s, _ as e, $ as r, a0 as R, a1 as A, a2 as T, a3 as o } from "./index-BhxsL0Sm.js";
1
+ import { X as _, Y as L, Z as s, _ as e, $ as r, a0 as R, a1 as A, a2 as T, a3 as o } from "./index-Bd6hgisa.js";
2
2
  import { c as O } from "./storage-CmGHg7OA.js";
3
- import { W as D, X as I, Y as N, Z as S, _ as l, A as X, z as i, $ as p, B as x, K as U, a0 as t, a1 as C, a2 as f, a3 as F, a4 as c, e as n, i as u, h as H, w as d } from "./location-gXXmC7CQ.js";
3
+ import { X as P, Y as I, Z as N, _ as S, $ as l, B as X, A as i, a0 as p, D as x, L as U, a1 as t, a2 as C, a3 as f, a4 as F, a5 as c, e as n, i as u, h as H, w as d } from "./location-DIxIjqs7.js";
4
4
  import { F as W, X as K, Y as h, E as m, M as B, B as Y, f as w, i as V, G as b, P as v, c as g, b as k } from "./dataRoute-BEvesOvN.js";
5
5
  export {
6
- D as COLUMN_MIN_MEASURE,
6
+ P as COLUMN_MIN_MEASURE,
7
7
  W as DEFAULT_DENIED_PATH_SEGMENTS,
8
8
  _ as DEFAULT_MARKDOWN_EXPLORER_LOCALE,
9
9
  I as DEFAULT_TREE_SETTINGS,
@@ -0,0 +1 @@
1
+ "use strict";const I=require("@aiquants/markdown/embeds"),k=require("@aiquants/markdown/viewer-settings"),N=require("./dataRoute-Cv7fgCW7.cjs"),y=e=>{if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},De=Object.freeze(["UTF-8","IBM866","ISO-8859-2","ISO-8859-3","ISO-8859-4","ISO-8859-5","ISO-8859-6","ISO-8859-7","ISO-8859-8","ISO-8859-8-I","ISO-8859-10","ISO-8859-13","ISO-8859-14","ISO-8859-15","ISO-8859-16","KOI8-R","KOI8-U","macintosh","windows-874","windows-1250","windows-1251","windows-1252","windows-1253","windows-1254","windows-1255","windows-1256","windows-1257","windows-1258","x-mac-cyrillic","GBK","gb18030","Big5","EUC-JP","ISO-2022-JP","Shift_JIS","EUC-KR","replacement","UTF-16BE","UTF-16LE","x-user-defined"]),ve=new Map(De.map(e=>[e.toLowerCase(),e])),$="UTF-8",ne=Object.freeze([Object.freeze({bytes:Object.freeze([239,187,191]),encoding:$}),Object.freeze({bytes:Object.freeze([255,254]),encoding:"UTF-16LE"}),Object.freeze({bytes:Object.freeze([254,255]),encoding:"UTF-16BE"})]),je=new Map([[$,"is read before any legacy encoding"],["UTF-16LE","is read only by its byte order mark"],["UTF-16BE","is read only by its byte order mark"],["ISO-2022-JP","writes only bytes below 0x80, which UTF-8 always reads first, so it would never be used"],["x-user-defined","is no text encoding (it maps bytes to private-use characters)"]]),Y=e=>{let t;try{t=new TextDecoder(e).encoding}catch(o){throw o instanceof RangeError?new RangeError(`[markdown-explorer] legacyTextEncoding ${JSON.stringify(e)} is no encoding label TextDecoder knows (for example "Shift_JIS" or "windows-1252")`):o}const n=ze(t),r=je.get(n);if(r!==void 0)throw new RangeError(`[markdown-explorer] legacyTextEncoding ${JSON.stringify(e)} names ${n}, which cannot be the legacy encoding: it ${r}`);return n},ze=e=>{const t=ve.get(e);if(t===void 0)throw new RangeError(`[markdown-explorer] TextDecoder answered ${JSON.stringify(e)}, which is no encoding of the WHATWG Encoding Standard`);return t},D=(e,t,n)=>{const r=n===null?null:Y(n),o=ne.find(({bytes:s})=>s.every((a,l)=>e[l]===a));if(o!==void 0)return{body:e.subarray(o.bytes.length),encodings:[o.encoding]};const i=t||e.length===0?void 0:ne.find(({bytes:s})=>e.length<s.length&&e.every((a,l)=>s[l]===a));return i!==void 0?{body:e.subarray(e.length),encodings:[i.encoding]}:{body:e,encodings:r===null?[$]:[$,r]}},Fe=(e,t,n)=>D(e,t,n).encodings,Ue=(e,t,n)=>{try{return new TextDecoder(e,{fatal:!0,ignoreBOM:!0}).decode(t,{stream:!n})}catch(r){if(r instanceof TypeError)return null;throw r}},Ve=(e,t,n)=>{const r=Z(D(e,t,n),t);return r===null?null:r.text},Z=({body:e,encodings:t},n)=>{for(const r of t){const o=Ue(r,e,n);if(o!==null)return{encoding:r,text:o}}return null},Ge=(e,t,n)=>{const r=D(e,t,n),o=Z(r,t);return o===null?r.encodings[0]:o.encoding},Xe=(e,t,n)=>{const r=D(e,t,n),o=Z(r,t);return o!==null?o.text:new TextDecoder(r.encodings[0],{ignoreBOM:!0}).decode(r.body,{stream:!t})},A=new Intl.Collator("en",{numeric:!0,sensitivity:"variant"}),Je=/^readme(?:\.|$)/iu,re=/^readme(?:\.[^.]*)?$/iu,oe=Object.freeze(["md","markdown","mdx","txt",""]),Be=e=>Je.test(e),J=e=>e.type==="file"&&Be(e.name),ie=e=>{const t=e.lastIndexOf("."),n=oe.indexOf(t<0?"":e.slice(t+1).toLowerCase());return n<0?oe.length:n},We=(e,t)=>{const n=+!re.test(e.name)-+!re.test(t.name);if(n!==0)return n;const r=ie(e.name)-ie(t.name);if(r!==0)return r;const o=A.compare(e.name,t.name);return o!==0?o:A.compare(e.path,t.path)},He=e=>{let t=null;for(const n of e)J(n)&&(t===null||We(n,t)<0)&&(t=n);return t===null?null:t.path},B=Object.freeze({sortMode:"native",folderPlacement:"mixed",readmePlacement:"mixed",selectionMode:"single",doubleClickAction:"recursive",expandIconSize:8,alwaysExpanded:!1,revealDocument:!1,removeRootIndent:!1,lines:!0,expandIcons:!0,directoryIcons:!0,fileIcons:!0}),Ke=[!0,!1],qe=(e,t)=>t?e.settingOn:e.settingOff,p=(e,t)=>({key:e,labelKey:t,values:Ke,formatValue:qe,requiresItemSelection:!1}),Ye=Object.freeze({native:e=>e.sortNative,asc:e=>e.sortAscending,desc:e=>e.sortDescending,oldest:e=>e.sortOldest,newest:e=>e.sortNewest}),T=Object.freeze([{key:"sortMode",labelKey:"settingSortMode",values:["native","asc","desc","oldest","newest"],formatValue:(e,t)=>Ye[t](e),requiresItemSelection:!1},{key:"folderPlacement",labelKey:"settingFolderPlacement",values:["mixed","first","last"],formatValue:(e,t)=>t==="mixed"?e.folderPlacementMixed:t==="first"?e.folderPlacementFirst:e.folderPlacementLast,requiresItemSelection:!1},{key:"readmePlacement",labelKey:"settingReadmePlacement",values:["mixed","first","last"],formatValue:(e,t)=>t==="mixed"?e.readmePlacementMixed:t==="first"?e.readmePlacementFirst:e.readmePlacementLast,requiresItemSelection:!1},{key:"selectionMode",labelKey:"settingSelectionMode",values:["single","multiple","none"],formatValue:(e,t)=>t==="single"?e.selectionSingle:t==="multiple"?e.selectionMultiple:e.selectionNone,requiresItemSelection:!0},{key:"doubleClickAction",labelKey:"settingDoubleClick",values:["recursive","toggle"],formatValue:(e,t)=>t==="recursive"?e.doubleClickRecursive:e.doubleClickToggle,requiresItemSelection:!1},{key:"expandIconSize",labelKey:"settingExpandIconSize",values:[8,13,5],formatValue:(e,t)=>e.expandIconSizeValue(t),requiresItemSelection:!1},p("alwaysExpanded","settingAlwaysExpanded"),p("revealDocument","settingRevealDocument"),p("removeRootIndent","settingRemoveRootIndent"),p("lines","settingTreeLines"),p("expandIcons","settingExpandIcons"),p("directoryIcons","settingDirectoryIcons"),p("fileIcons","settingFileIcons")]),Ze=e=>e?T:T.filter(t=>!t.requiresItemSelection),ue=e=>{const t=T.find(n=>n.key===e);if(t===void 0)throw new RangeError(`[markdown-explorer] no tree setting descriptor for ${e}`);return t},Qe=(e,t)=>{const n=ue(t).values,r=n[(n.indexOf(e[t])+1)%n.length];return{...e,[t]:r}},et=(e,t,n)=>ue(n).formatValue(e,t[n]),ge=2,W=Object.freeze({}),Q=(e,t)=>Object.freeze(Object.fromEntries(T.filter(n=>t(n,e[n.key])).map(n=>[n.key,e[n.key]]))),se="directoriesFirst",tt=e=>{if(!Object.hasOwn(e,se))return e;const{[se]:t,...n}=e;return Object.hasOwn(n,"folderPlacement")||typeof t!="boolean"?n:{...n,folderPlacement:t?"first":"mixed"}},nt=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return W;const t=e;return t.version!==ge||t.settings===null||typeof t.settings!="object"||Array.isArray(t.settings)?W:Q(tt(t.settings),(n,r)=>n.values.includes(r))},rt=(e,t)=>{const n=Q(t,(r,o)=>o!==void 0&&o!==e[r.key]);return Object.keys(n).length===0?e:Object.freeze({...e,...n})},ot=(e,t,n,r)=>Q({...e,[t]:n},(o,i)=>i!==void 0&&!(o.key===t&&i===r[t])),it=e=>JSON.stringify({version:ge,settings:e}),st=(e,t,n)=>e===void 0||t===void 0?e===t?0:e===void 0?1:-1:n*(e-t),at=e=>{const{sortMode:t,folderPlacement:n,readmePlacement:r}=e;if(t==="native"&&n==="mixed"&&r==="mixed")return;const o=(i,s)=>{const a=A.compare(i.name,s.name);return a!==0?a:A.compare(i.path,s.path)};return(i,s)=>{if(n!=="mixed"&&i.type!==s.type)return i.type==="directory"==(n==="first")?-1:1;if(r!=="mixed"){const l=J(i);if(l!==J(s))return l===(r==="first")?-1:1}if(t==="native")return 0;if(t==="asc")return o(i,s);if(t==="desc")return-o(i,s);const a=st(i.modifiedAt,s.modifiedAt,t==="oldest"?1:-1);return a!==0?a:o(i,s)}},u=(1+Math.sqrt(5))/2,ct=100/u**3,lt=100/u**4,ee=100/u**2,Ee=13,dt=16,mt=Object.freeze({gripThickness:5,gripLength:34,barThickness:2,barLength:21}),ft=Object.freeze([89,144,233,377]),we=44,ut=we,gt=24,Et=1/u,wt=1/u**3,ht="40ch",pt=e=>{if(!Number.isFinite(e)||e<=0)throw new RangeError(`[markdown-explorer] rootFontPixels must be a finite number > 0; got ${String(e)}`)},he=e=>(pt(e),Ee*e),St=e=>he(e)*u**2,xt=233,Ot=50,pe=100/u**3,yt=100-pe,Tt=ft[0],w=(e,t)=>{if(!Number.isFinite(t)||t<0)throw new RangeError(`[markdown-explorer] ${e} must be a finite number >= 0; got ${String(t)}`)},bt=({trackInlineSize:e,gap:t,minColumnInlineSize:n,logicalColumns:r})=>{if(w("trackInlineSize",e),w("gap",t),!Number.isFinite(n)||n<=0)throw new RangeError(`[markdown-explorer] minColumnInlineSize must be a finite number > 0; got ${String(n)}`);if(!Number.isInteger(r)||r<1)throw new RangeError(`[markdown-explorer] logicalColumns must be a positive integer; got ${String(r)}`);const o=Math.floor((e+t)/(n+t));return Math.min(r,Math.max(1,o))},_t=(e,t)=>{const{trackInlineSize:n,gap:r,minColumnInlineSize:o,logicalColumns:i}=t;if(!([n,r,o].every(Number.isFinite)&&n>0&&r>=0&&o>0))return e;const a=bt(t);if(e===null||a===e)return a;const l=Math.min(i,Math.max(1,e));if(a>l){const v=(l+1)*o+l*r+r/u;return n>=v?a:l}return n>=l*o+(l-1)*r?l:a},Rt=(e,t)=>{if(!(Number.isInteger(e)&&Number.isInteger(t))||t<1||t>e)throw new RangeError(`[markdown-explorer] visible columns must be an integer in 1..${String(e)}; got ${String(t)}`);return Array.from({length:t},(n,r)=>[Math.floor(r*e/t),Math.floor((r+1)*e/t)])},It=(e,t,n)=>{if(w("surfaceInlineSize",e),w("handlePixels",n),!Number.isFinite(t)||t<=0)throw new RangeError(`[markdown-explorer] measure must be a finite number > 0; got ${String(t)}`);return e>=2*t+n?"beside":"stacked"},X=(e,t,n)=>Math.max(t,Math.min(e,n)),ae=(e,t,n,r)=>{const o=(X(e,0,n)+X(t,0,n))/2;return X(o-r/2,0,n-r)},kt=(e,t,n)=>{for(const[r,o]of Object.entries(e))if(!Number.isFinite(o))throw new RangeError(`[markdown-explorer] anchor.${r} must be a finite number; got ${String(o)}`);return w("marginBox.width",t.width),w("marginBox.height",t.height),w("viewport.width",n.width),w("viewport.height",n.height),{left:ae(e.left,e.right,n.width,t.width),top:ae(e.top,e.bottom,n.height,t.height)}},Nt=31536e3,At=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/u,Pt=e=>{if(typeof e!="string"||!At.test(e))throw new RangeError(`[markdown-explorer] settingsCookie must be a cookie-name token; got ${JSON.stringify(e)}`)},ce=e=>typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=ee,Lt=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))return{};const n=e,{treeExplorer:r,multiExplorer:o,style:i,align:s}=n;return{...ce(r)?{treeExplorer:r}:{},...ce(o)?{multiExplorer:o}:{},...typeof i=="string"&&t.includes(i)?{style:i}:{},...typeof s=="string"&&k.CONTENT_ALIGNS.includes(s)?{align:s}:{}}},$t=(e,t)=>{if(e!==null)for(const n of e.split(";")){const r=n.indexOf("=");if(!(r<0)&&n.slice(0,r).trim()===t)return n.slice(r+1).trim()}},Ct=(e,t)=>{if(e===void 0||e==="")return{};try{return Lt(JSON.parse(decodeURIComponent(e)),t)}catch{return{}}},C=100,Mt=Math.floor(ee*C)/C,Dt=e=>{const t=n=>Math.min(Mt,Math.max(1,Math.round(n*C))/C);return encodeURIComponent(JSON.stringify({...e.treeExplorer===void 0?{}:{treeExplorer:t(e.treeExplorer)},...e.multiExplorer===void 0?{}:{multiExplorer:t(e.multiExplorer)},...e.style===void 0?{}:{style:e.style},...e.align===void 0?{}:{align:e.align}}))},vt=(e,t,n)=>`${e}=${Dt(t)}; Path=/; Max-Age=${String(Nt)}; SameSite=Lax${n?"; Secure":""}`,H=Object.freeze({tree:"tree",multi:"multi",single:"single"}),Se=Object.freeze({default:12,min:1,max:64}),xe=Object.freeze({default:4,min:1,max:6}),Oe=Object.freeze({default:500,min:1,max:1e4}),ye=Object.freeze({default:16,min:1,max:64}),Te=Object.freeze({default:16,min:1,max:64}),be=Object.freeze({default:2*1024*1024,min:1,max:256*1024*1024}),jt=/^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+$/u,zt=/^[A-Za-z0-9][A-Za-z0-9_-]*$/u,Ft=/^[a-z0-9][a-z0-9-]*$/u,Ut=/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/u,le=(e,t)=>{if(typeof t!="string")throw new TypeError(`[markdown-explorer] ${e} must be a string; got ${typeof t}`);if(!jt.test(t)||t.split("/").some(n=>n==="."||n===".."))throw new RangeError(`[markdown-explorer] ${e} must start with "/", have no trailing "/", and use only letters, digits and "._~-" in each segment; got ${JSON.stringify(t)}`)},m=e=>typeof e=="string"?JSON.stringify(e):typeof e=="bigint"?`${String(e)}n`:Object.is(e,-0)?"-0":typeof e=="function"?"a function":Array.isArray(e)?"an array":e!==null&&typeof e=="object"?y(e)?"a plain object":`a non-plain object (${Object.prototype.toString.call(e)})`:String(e),de=Object.freeze(Object.keys({basePath:!0,dataPath:!0,settingsCookie:!0,views:!0,multiView:!0,expandAll:!0,revealDocument:!0,documentStyles:!0,iframeHosts:!0,embeds:!0,defaultTreeSettings:!0,legacyTextEncoding:!0,spreadsheets:!0})),S=(e,t,n)=>{if(t===void 0)return[];if(!y(t))throw new TypeError(`[markdown-explorer] ${e} must be a plain object; got ${m(t)}`);const r=Object.entries(t);for(const[o]of r)if(!n.includes(o))throw new RangeError(`[markdown-explorer] ${e}.${o} is not an option; expected ${n.join(", ")}`);return r.filter(([,o])=>o!==void 0)},Vt=e=>{const t={...H};for(const[n,r]of S("views",e,Object.keys(H)))t[n]=r;for(const[n,r]of Object.entries(t))if(typeof r!="string"||!zt.test(r))throw new RangeError(`[markdown-explorer] views.${n} must start with a letter or digit and use only letters, digits, "_" and "-"; got ${JSON.stringify(r)}`);return Object.freeze(t)},O=(e,t,n)=>{if(t===void 0)return n.default;if(typeof t!="number"||!Number.isInteger(t)||t<n.min||t>n.max)throw new RangeError(`[markdown-explorer] ${e} must be an integer in ${String(n.min)}..${String(n.max)}; got ${m(t)}`);return t},Gt=(e,t)=>{const n=new Map(S("embeds",e,["providers","linkCards","linkCardSize"]));if(n.size===0)return I.NO_EMBEDS;const r=n.has("providers")?n.get("providers"):[];if(!Array.isArray(r))throw new RangeError(`[markdown-explorer] embeds.providers must be an array of provider ids; got ${m(r)}`);for(const a of r)if(!I.isEmbedProviderId(a))throw new RangeError(`[markdown-explorer] embeds.providers must hold only ${I.EMBED_PROVIDER_IDS.join(", ")}; got ${m(a)}`);const o=n.has("linkCards")?n.get("linkCards"):!1;if(typeof o!="boolean")throw new RangeError(`[markdown-explorer] embeds.linkCards must be a boolean; got ${m(o)}`);const i={providers:Object.freeze([...new Set(r)]),linkCardEndpoint:o?N.explorerLinkCardEndpoint(t):null};if(!n.has("linkCardSize"))return Object.freeze(i);const s=n.get("linkCardSize");if(!I.isLinkCardSize(s))throw new RangeError(`[markdown-explorer] embeds.linkCardSize must be one of ${I.LINK_CARD_SIZES.join(", ")}; got ${m(s)}`);if(!o)throw new RangeError(`[markdown-explorer] embeds.linkCardSize needs embeds.linkCards: true; got linkCardSize ${m(s)} with linkCards ${m(o)}`);return Object.freeze({...i,linkCardSize:s})},Xt=e=>{if(e===void 0)return null;if(typeof e!="string")throw new TypeError(`[markdown-explorer] legacyTextEncoding must be a string; got ${m(e)}`);return Y(e)},Jt=e=>{const t=new Map(S("defaultTreeSettings",e,T.map(r=>r.key)));if(t.size===0)return B;const n={...B};for(const r of T){if(!t.has(r.key))continue;const o=t.get(r.key),i=r.values;if(!i.includes(o))throw new RangeError(`[markdown-explorer] defaultTreeSettings.${r.key} must be one of ${i.map(m).join(", ")}; got ${m(o)}`);n[r.key]=o}return Object.freeze(n)},_e=e=>{if(e===null||typeof e!="object")throw new TypeError("[markdown-explorer] the explorer configuration must be an object");for(const c of Object.keys(e))if(!de.includes(c))throw new RangeError(`[markdown-explorer] ${c} is not an option of the explorer configuration; expected ${de.join(", ")}`);le("basePath",e.basePath),le("dataPath",e.dataPath);const t=Vt(e.views);if(new Set([t.tree,t.multi,t.single]).size!==3)throw new RangeError(`[markdown-explorer] the view slugs must differ; got ${JSON.stringify(t)}`);if(e.dataPath===e.basePath)throw new RangeError("[markdown-explorer] dataPath must differ from basePath");if(e.dataPath.startsWith(`${e.basePath}/`)){const c=e.dataPath.slice(e.basePath.length+1).split("/")[0];if(c===t.tree||c===t.multi||c===t.single)throw new RangeError(`[markdown-explorer] dataPath must not start with a view slug under basePath; got ${JSON.stringify(e.dataPath)}`)}Pt(e.settingsCookie);const n=e.iframeHosts??[];if(!Array.isArray(n)||n.some(c=>typeof c!="string"||!Ut.test(c)))throw new RangeError(`[markdown-explorer] iframeHosts must be lowercase host names without scheme, port or path; got ${JSON.stringify(n)}`);const r=Object.fromEntries(S("multiView",e.multiView,["maxPanels","columns"])),o=Object.fromEntries(S("expandAll",e.expandAll,["maxFolders","maxDepth"])),i=Object.fromEntries(S("revealDocument",e.revealDocument,["maxDepth"])),s=Object.fromEntries(S("spreadsheets",e.spreadsheets,["maxBytes"])),a=e.documentStyles??k.DEFAULT_MARKDOWN_STYLES;if(!Array.isArray(a)||a.length===0)throw new RangeError("[markdown-explorer] documentStyles must be a non-empty array");const l=new Set;for(const c of a){if(c===null||typeof c!="object"||typeof c.name!="string"||c.name.trim()===""||typeof c.className!="string")throw new RangeError("[markdown-explorer] each document style needs a non-blank name and a className string");if(l.has(c.name))throw new RangeError(`[markdown-explorer] document style names must be unique; ${JSON.stringify(c.name)} repeats`);l.add(c.name)}return Object.freeze({basePath:e.basePath,dataPath:e.dataPath,settingsCookie:e.settingsCookie,views:t,multiView:Object.freeze({maxPanels:O("multiView.maxPanels",r.maxPanels,Se),columns:O("multiView.columns",r.columns,xe)}),expandAll:Object.freeze({maxFolders:O("expandAll.maxFolders",o.maxFolders,Oe),maxDepth:O("expandAll.maxDepth",o.maxDepth,ye)}),revealDocument:Object.freeze({maxDepth:O("revealDocument.maxDepth",i.maxDepth,Te)}),documentStyles:Object.freeze(a.map(c=>Object.freeze({name:c.name,className:c.className}))),iframeHosts:Object.freeze([...new Set(n)]),embeds:Gt(e.embeds,e.dataPath),defaultTreeSettings:Jt(e.defaultTreeSettings),legacyTextEncoding:Xt(e.legacyTextEncoding),spreadsheets:Object.freeze({maxBytes:O("spreadsheets.maxBytes",s.maxBytes,be)})})},Bt=e=>{const t=e.embeds;if(!y(t))throw new TypeError(`[markdown-explorer] config.embeds must be the embeds defineExplorerConfig resolved; got ${m(t)}`);if(Object.hasOwn(t,"linkCards"))throw new RangeError(`[markdown-explorer] config.embeds.linkCards is an option of defineExplorerConfig, not a key of the embeds it resolves; pass the option to defineExplorerConfig (got linkCards ${m(t.linkCards)})`);const n=e.legacyTextEncoding;if(n!==null&&typeof n!="string")throw new TypeError(`[markdown-explorer] config.legacyTextEncoding must be the encoding defineExplorerConfig resolved, or null; got ${m(n)}`);const{linkCardEndpoint:r,...o}=t,i=_e({...e,embeds:{...o,linkCards:r!==null},legacyTextEncoding:n===null?void 0:n});if(i.embeds.linkCardEndpoint!==r)throw new RangeError(`[markdown-explorer] config.embeds.linkCardEndpoint must be ${m(i.embeds.linkCardEndpoint)} (the data route's link-card path) or null; got ${m(r)}`);if(i.legacyTextEncoding!==n)throw new RangeError(`[markdown-explorer] config.legacyTextEncoding must be ${m(i.legacyTextEncoding)} (the written name of the encoding it names); got ${m(n)}`);const s=e;for(const[a,l]of Object.entries(i)){const c=K(s[a],l,a);if(c!==null)throw c.kind==="extra"?new RangeError(`[markdown-explorer] config.${c.path} is not a key of what defineExplorerConfig resolves; got ${m(c.given)} there`):new RangeError(`[markdown-explorer] config.${c.path} must be what defineExplorerConfig resolves; got ${m(c.given)} where it resolves ${m(c.resolved)}`)}return i},K=(e,t,n)=>{if(Object.is(e,t))return null;if(Array.isArray(t)){if(!Array.isArray(e))return{kind:"value",path:n,given:e,resolved:t};if(e.length!==t.length)return{kind:"value",path:`${n}.length`,given:e.length,resolved:t.length};for(const[o,i]of t.entries()){const s=K(e[o],i,`${n}[${String(o)}]`);if(s!==null)return s}return null}if(!(y(t)&&y(e)))return{kind:"value",path:n,given:e,resolved:t};for(const o of Object.keys(t)){const i=K(Object.hasOwn(e,o)?e[o]:void 0,t[o],`${n}.${o}`);if(i!==null)return i}const r=Object.keys(e).find(o=>!Object.hasOwn(t,o));return r===void 0?null:{kind:"extra",path:`${n}.${r}`,given:e[r]}},Re=e=>typeof e=="string"&&Ft.test(e),Wt=(e,t)=>{if(e===null||typeof e!="object")throw new TypeError(`[markdown-explorer] withExplorerSources needs the configuration of defineExplorerConfig; got ${m(e)}`);if(!Array.isArray(t)||t.length===0)throw new RangeError(`[markdown-explorer] sourceIds must be a non-empty array; got ${m(t)}`);for(const n of t)if(!Re(n))throw new RangeError(`[markdown-explorer] each source id must use lowercase letters, digits and "-" and start with a letter or digit; got ${m(n)}`);if(new Set(t).size!==t.length)throw new RangeError(`[markdown-explorer] source ids must be unique; got ${JSON.stringify(t)}`);return Object.freeze({...e,sourceIds:Object.freeze([...t])})},Ht=e=>e.documentStyles.map(t=>t.name),d=Object.freeze({source:"source",doc:"doc",maximized:"maximized",style:"style",align:"align",showToc:"showToc",showStyle:"showStyle",showAlign:"showAlign",padding:"padding",width:"width",maxWidth:"maxWidth",markup:"markup"}),Ie="true",M="/",me=".data",ke=256,Ne=/^\d+(?:\.\d+)?$/u,q=/^\d+(?:\.\d+)?(?:px|rem|em|ch|vw|%)$/u,Ae=Object.freeze(["showToc","showStyle","showAlign"]),fe=e=>{const t=encodeURIComponent(e.replaceAll("%","%25"));return t.endsWith(me)?`${t.slice(0,-me.length)}%2Edata`:t},Kt=e=>e.replaceAll("%25","%"),Pe=e=>{const{sourceIds:t}=e;if(t===void 0)throw new TypeError("[markdown-explorer] the configuration has no source ids; join the server's sources with withExplorerSources(config, sourceIds)");return t},qt=(e,t,n)=>{const r=n.getAll(d.source);if(r.length===0)return t;const[o]=r;return r.length>1||o===void 0||o===t||!e.includes(o)?null:o},Yt=(e,t)=>{const n=t.get(d.style),r=t.get(d.align);return{...n!==null&&e.documentStyles.some(o=>o.name===n)?{style:n}:{},...r!==null&&k.CONTENT_ALIGNS.includes(r)?{align:r}:{}}},Le=e=>Number.isFinite(e)&&e>=0&&e<=ke&&Ne.test(String(e)),Zt=e=>{const t=e.get(d.padding),n=t!==null&&Ne.test(t)?Number(t):Number.NaN,r=e.get(d.width),o=e.get(d.maxWidth);return{...e.get(d.showToc)==="false"?{showToc:!1}:{},...e.get(d.showStyle)==="false"?{showStyle:!1}:{},...e.get(d.showAlign)==="false"?{showAlign:!1}:{},...Le(n)?{padding:n}:{},...r!==null&&q.test(r)?{width:r}:{},...o!==null&&q.test(o)?{maxWidth:o}:{}}},$e=(e,t)=>[...new Set(t.filter(N.isAcceptableDocumentPath))].slice(0,e.multiView.maxPanels),Qt=(e,t,n,r)=>{for(const i of t)te(i);if(new Set(t).size!==t.length)throw new RangeError(`[markdown-explorer] multi-view documents must each appear once; got ${String(t.length)} with repeats`);if(t.length>e.multiView.maxPanels)throw new RangeError(`[markdown-explorer] the multi view opens at most ${String(e.multiView.maxPanels)} documents; got ${String(t.length)}`);if(n!==null&&!t.includes(n))throw new RangeError(`[markdown-explorer] the maximized document must be one of the open documents; got ${JSON.stringify(n.slice(0,80))}`);if(new Set(r).size!==r.length)throw new RangeError(`[markdown-explorer] the documents shown as written must each appear once; got ${String(r.length)} with repeats`);const o=r.find(i=>!t.includes(i));if(o!==void 0)throw new RangeError(`[markdown-explorer] a document shown as written must be one of the open documents; got ${JSON.stringify(o.slice(0,80))}`)},te=e=>{if(!N.isAcceptableDocumentPath(e))throw new RangeError(`[markdown-explorer] not an acceptable document path: ${JSON.stringify(String(e).slice(0,80))}`);return e},en=e=>{if(te(e).endsWith(M))throw new RangeError(`[markdown-explorer] a document path ending in a slash has no URL (its segment would name a folder): ${JSON.stringify(e.slice(0,80))}`);return e},tn=(e,t)=>{if(t.style!==void 0&&!e.documentStyles.some(n=>n.name===t.style))throw new RangeError(`[markdown-explorer] overrides.style must name a configured document style (${e.documentStyles.map(n=>JSON.stringify(n.name)).join(", ")}); got ${JSON.stringify(t.style)}`);if(t.align!==void 0&&!k.CONTENT_ALIGNS.includes(t.align))throw new RangeError(`[markdown-explorer] overrides.align must be one of ${k.CONTENT_ALIGNS.join(", ")}; got ${JSON.stringify(t.align)}`)},nn=e=>{for(const t of Ae)if(e[t]!==void 0&&typeof e[t]!="boolean")throw new RangeError(`[markdown-explorer] embed.${t} must be a boolean; got ${JSON.stringify(e[t])}`);if(e.padding!==void 0&&!Le(e.padding))throw new RangeError(`[markdown-explorer] embed.padding must be 0..${String(ke)} px in plain decimal digits; got ${String(e.padding)}`);for(const t of["width","maxWidth"]){const n=e[t];if(n!==void 0&&!q.test(n))throw new RangeError(`[markdown-explorer] embed.${t} must be a CSS length in px, rem, em, ch, vw or %; got ${JSON.stringify(n)}`)}},Ce=(e,t)=>{const n=new URLSearchParams;let r=`${e.basePath}/${e.views[t.view]}`;if(t.view==="multi"){const i=t.docs??[],s=t.maximized??null,a=t.markup??[];Qt(e,i,s,a);for(const l of i)n.append(d.doc,l);s!==null&&n.set(d.maximized,s);for(const l of i)a.includes(l)&&n.append(d.markup,l)}else{const i=t.doc??null,s=t.view==="tree"?t.folder??null:null;if(i!==null&&s!==null)throw new RangeError("[markdown-explorer] a tree view shows a document or a folder, not both");i!==null&&(r+=`/${fe(en(i))}`),s!==null&&(r+=`/${fe(`${te(s)}${M}`)}`)}if(t.source!==void 0){const i=Pe(e);if(!i.includes(t.source))throw new RangeError(`[markdown-explorer] unknown source ${JSON.stringify(t.source)}; expected one of ${i.join(", ")}`);t.source!==i[0]&&n.set(d.source,t.source)}if(t.view!=="multi"&&t.overrides!==void 0&&(tn(e,t.overrides),t.overrides.style!==void 0&&n.set(d.style,t.overrides.style),t.overrides.align!==void 0&&n.set(d.align,t.overrides.align)),t.view!=="multi"&&t.markup===!0){if(!(t.doc!==void 0&&t.doc!==null||t.view==="tree"&&t.folder!==void 0&&t.folder!==null))throw new RangeError("[markdown-explorer] a tree view without a document or a folder has nothing to show as written");n.set(d.markup,Ie)}if(t.view==="single"&&t.embed!==void 0){const{embed:i}=t;nn(i);for(const s of Ae)i[s]===!1&&n.set(d[s],"false");i.padding!==void 0&&n.set(d.padding,String(i.padding)),i.width!==void 0&&n.set(d.width,i.width),i.maxWidth!==void 0&&n.set(d.maxWidth,i.maxWidth)}const o=n.toString();return o===""?r:`${r}?${o}`},rn=(e,t)=>Object.keys(e.views).find(n=>e.views[n]===t),on=(e,t,n)=>{const r=Pe(e),[o]=r;if(o===void 0)throw new RangeError("[markdown-explorer] the configuration has no source");const i=qt(r,o,n),s=i===null?o:i,a=f=>({kind:"redirect",href:Ce(e,f),location:f}),l=()=>a({view:"tree",source:s,doc:null,folder:null,overrides:{},markup:!1});if(t===void 0||t==="")return l();const c=t.indexOf("/"),v=c<0?t:t.slice(0,c),j=c<0?null:t.slice(c+1),h=rn(e,v);if(h===void 0)return l();if(h==="multi"){const f=n.getAll(d.doc),x=$e(e,f),z=n.getAll(d.maximized),[F]=z,U=z.length===1&&F!==void 0&&x.includes(F)?F:null,V=n.getAll(d.markup),L=x.filter(R=>V.includes(R)),Me=L.length===V.length&&L.every((R,G)=>R===V[G]);return j===null&&i!==null&&x.length===f.length&&x.every((R,G)=>R===f[G])&&(z.length===0||U!==null)&&Me?{kind:"location",location:{view:"multi",source:s,docs:x,maximized:U,markup:L}}:a({view:"multi",source:s,docs:x,maximized:U,markup:L})}const P=j===null?null:Kt(j),g=P?.endsWith(M)===!0?P.slice(0,-M.length):null,E=P!==null&&g===null?P:null;if(E!==null&&!N.isAcceptableDocumentPath(E)||g!==null&&!N.isAcceptableDocumentPath(g))return l();const b=Yt(e,n),_=(E!==null||g!==null)&&n.get(d.markup)===Ie;if(h==="single"){if(g!==null)return a({view:"tree",source:s,doc:null,folder:g,overrides:b,markup:_});if(E===null)return l();const f=Zt(n);return i===null?a({view:h,source:s,doc:E,overrides:b,embed:f,markup:_}):{kind:"location",location:{view:h,source:s,doc:E,overrides:b,embed:f,markup:_}}}return i===null?a({view:h,source:s,doc:E,folder:g,overrides:b,markup:_}):{kind:"location",location:{view:h,source:s,doc:E,folder:g,overrides:b,markup:_}}};exports.ASSUMED_ROOT_FONT_PIXELS=dt;exports.COARSE_TARGET_PIXELS=ut;exports.COLUMN_MIN_MEASURE=ht;exports.CONTROL_BLOCK_PIXELS=we;exports.DEFAULT_TREE_SETTINGS=B;exports.DEFAULT_VIEW_SLUGS=H;exports.EDIT_SPLIT_DEFAULT_PERCENT=Ot;exports.EDIT_SPLIT_MAX_PERCENT=yt;exports.EDIT_SPLIT_MIN_PERCENT=pe;exports.EXPAND_ALL_DEPTH_LIMITS=ye;exports.EXPAND_ALL_FOLDER_LIMITS=Oe;exports.EXPLORER_DEFAULT_PERCENT=ct;exports.EXPLORER_MAX_PERCENT=ee;exports.EXPLORER_MIN_REM=Ee;exports.EXPLORER_MULTI_DEFAULT_PERCENT=lt;exports.FINE_TARGET_PIXELS=gt;exports.GOLDEN_RATIO=u;exports.MULTI_VIEW_COLUMN_LIMITS=xe;exports.MULTI_VIEW_PANEL_LIMITS=Se;exports.NAME_COLLATOR=A;exports.NO_TREE_SETTING_CHANGES=W;exports.PANEL_MAX_BLOCK_RATIO=Et;exports.PANEL_MIN_BLOCK_RATIO=wt;exports.PREFETCH_DWELL_MS=Tt;exports.REVEAL_DOCUMENT_DEPTH_LIMITS=Te;exports.SPLIT_HANDLE_PIXELS=mt;exports.SPLIT_PERSIST_DELAY_MS=xt;exports.SPREADSHEET_BYTE_LIMITS=be;exports.advanceTreeSetting=Qe;exports.applyTreeSettingChanges=rt;exports.canonicalMultiDocuments=$e;exports.centeredDialogPosition=kt;exports.columnGroups=Rt;exports.createEntryComparator=at;exports.decodeText=Ve;exports.decodeTextLeniently=Xe;exports.defineExplorerConfig=_e;exports.documentStyleNames=Ht;exports.editSplitOrientation=It;exports.explorerHref=Ce;exports.explorerMinPixels=he;exports.explorerSheetBelowPixels=St;exports.folderReadmeOf=He;exports.formatTreeSettingValue=et;exports.isExplorerSourceId=Re;exports.isPlainObject=y;exports.legacyTextEncodingOf=Y;exports.parseViewSettings=Ct;exports.readCookieValue=$t;exports.readTreeSettingChanges=nt;exports.recordTreeSettingChange=ot;exports.replanVisibleColumns=_t;exports.resolveExplorerLocation=on;exports.revalidateExplorerConfig=Bt;exports.serializeTreeSettingChanges=it;exports.textEncodingOf=Ge;exports.textEncodingsOf=Fe;exports.viewSettingsCookieString=vt;exports.visibleTreeSettingDescriptors=Ze;exports.withExplorerSources=Wt;