solid-panes 5.1.0-2 → 5.1.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/README.md +6 -0
- package/dist/RDFXMLPane.d.ts.map +1 -1
- package/dist/RDFXMLPane2.cjs.js +1 -1
- package/dist/RDFXMLPane2.cjs.js.map +1 -1
- package/dist/RDFXMLPane2.esm.js +3 -3
- package/dist/RDFXMLPane2.esm.js.map +1 -1
- package/dist/components/editor-card/EditorCard.cjs.js +2 -2
- package/dist/components/editor-card/EditorCard.cjs.js.map +1 -1
- package/dist/components/editor-card/EditorCard.d.ts +2 -0
- package/dist/components/editor-card/EditorCard.d.ts.map +1 -1
- package/dist/components/editor-card/EditorCard.esm.js +68 -43
- package/dist/components/editor-card/EditorCard.esm.js.map +1 -1
- package/dist/components/editor-card/EditorCard.styles.cjs.js.map +1 -1
- package/dist/components/editor-card/EditorCard.styles.esm.js.map +1 -1
- package/dist/components/header/Header.cjs.js.map +1 -1
- package/dist/components/header/Header.esm.js.map +1 -1
- package/dist/components/header/Header.styles.cjs.js.map +1 -1
- package/dist/components/header/Header.styles.esm.js.map +1 -1
- package/dist/components/navbar/Navbar.cjs.js.map +1 -1
- package/dist/components/navbar/Navbar.esm.js.map +1 -1
- package/dist/components/navbar/Navbar.styles.cjs.js.map +1 -1
- package/dist/components/navbar/Navbar.styles.esm.js.map +1 -1
- package/dist/components/profile-heading/ProfileHeading.cjs.js +6 -6
- package/dist/components/profile-heading/ProfileHeading.cjs.js.map +1 -1
- package/dist/components/profile-heading/ProfileHeading.d.ts +4 -0
- package/dist/components/profile-heading/ProfileHeading.d.ts.map +1 -1
- package/dist/components/profile-heading/ProfileHeading.esm.js +123 -107
- package/dist/components/profile-heading/ProfileHeading.esm.js.map +1 -1
- package/dist/components/profile-heading/ProfileHeading.styles.cjs.js +1 -1
- package/dist/components/profile-heading/ProfileHeading.styles.cjs.js.map +1 -1
- package/dist/components/profile-heading/ProfileHeading.styles.esm.js +1 -1
- package/dist/components/profile-heading/ProfileHeading.styles.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.cjs.js +19 -19
- package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.esm.js +86 -86
- package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/heading/dateHelpers.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/heading/dateHelpers.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/heading/imageHelpers.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/heading/imagePreview.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/heading/mutations.cjs.js +1 -1
- package/dist/components/profile-heading/editor/sections/heading/mutations.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/heading/mutations.esm.js +61 -61
- package/dist/components/profile-heading/editor/sections/shared/contactTypeUtils.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/contactTypeUtils.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/idNodeFactory.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/phoneCountries.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/phoneCountries.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/rdfMutationHelpers.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/rdfMutationHelpers.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/rowState.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/rowState.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/sections/shared/sanitizeUtils.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/textUtils.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/textUtils.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/texts/dialogTexts.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/texts/dialogTexts.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/texts/messageTexts.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/texts/messageTexts.esm.js.map +1 -1
- package/dist/components/profile-heading/editor/ui/dialog2.cjs.js +1 -1
- package/dist/components/profile-heading/editor/ui/dialog2.cjs.js.map +1 -1
- package/dist/components/profile-heading/editor/ui/dialog2.esm.js +1 -1
- package/dist/components/profile-heading/editor/ui/dialog2.esm.js.map +1 -1
- package/dist/components/profile-heading/friendActions.cjs.js +1 -1
- package/dist/components/profile-heading/friendActions.cjs.js.map +1 -1
- package/dist/components/profile-heading/friendActions.esm.js +5 -5
- package/dist/components/profile-heading/profileHeadingData.cjs.js.map +1 -1
- package/dist/components/resource-action-dialog/ResourceActionDialog.cjs.js +33 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.cjs.js.map +1 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.d.ts +16 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.d.ts.map +1 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.esm.js +309 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.esm.js.map +1 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.styles.cjs.js +2 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.styles.cjs.js.map +1 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.styles.esm.js +6 -0
- package/dist/components/resource-action-dialog/ResourceActionDialog.styles.esm.js.map +1 -0
- package/dist/dataContentPane.d.ts.map +1 -1
- package/dist/dataContentPane2.cjs.js +1 -1
- package/dist/dataContentPane2.cjs.js.map +1 -1
- package/dist/dataContentPane2.esm.js +90 -78
- package/dist/dataContentPane2.esm.js.map +1 -1
- package/dist/humanReadablePane.d.ts +1 -0
- package/dist/humanReadablePane.d.ts.map +1 -1
- package/dist/humanReadablePane2.cjs.js +147 -15
- package/dist/humanReadablePane2.cjs.js.map +1 -1
- package/dist/humanReadablePane2.esm.js +281 -114
- package/dist/humanReadablePane2.esm.js.map +1 -1
- package/dist/imagePane.d.ts.map +1 -1
- package/dist/imagePane2.cjs.js +1 -1
- package/dist/imagePane2.cjs.js.map +1 -1
- package/dist/imagePane2.esm.js +9 -7
- package/dist/imagePane2.esm.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +16 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/internal/internalPane.d.ts.map +1 -1
- package/dist/internal/internalPane2.cjs.js +1 -1
- package/dist/internal/internalPane2.cjs.js.map +1 -1
- package/dist/internal/internalPane2.esm.js +55 -60
- package/dist/internal/internalPane2.esm.js.map +1 -1
- package/dist/mainPage/header.cjs.js +1 -1
- package/dist/mainPage/header.esm.js +2 -2
- package/dist/mainPage/index.cjs.js +1 -1
- package/dist/mainPage/index.cjs.js.map +1 -1
- package/dist/mainPage/index.d.ts.map +1 -1
- package/dist/mainPage/index.esm.js +44 -24
- package/dist/mainPage/index.esm.js.map +1 -1
- package/dist/mainPage/navbar.cjs.js +1 -1
- package/dist/mainPage/navbar.cjs.js.map +1 -1
- package/dist/mainPage/navbar.esm.js +15 -15
- package/dist/mainPage/navigation.cjs.js +1 -1
- package/dist/mainPage/navigation.cjs.js.map +1 -1
- package/dist/mainPage/navigation.esm.js +4 -4
- package/dist/mainPage/profileHeading.d.ts +2 -1
- package/dist/mainPage/profileHeading.d.ts.map +1 -1
- package/dist/mainPage/profileHeading2.cjs.js +1 -1
- package/dist/mainPage/profileHeading2.cjs.js.map +1 -1
- package/dist/mainPage/profileHeading2.esm.js +76 -76
- package/dist/mainPage/profileHeading2.esm.js.map +1 -1
- package/dist/n3Pane.d.ts.map +1 -1
- package/dist/n3Pane2.cjs.js +1 -1
- package/dist/n3Pane2.cjs.js.map +1 -1
- package/dist/n3Pane2.esm.js +1 -1
- package/dist/n3Pane2.esm.js.map +1 -1
- package/dist/navigation/browserEvents.cjs.js +1 -1
- package/dist/navigation/browserEvents.cjs.js.map +1 -1
- package/dist/navigation/browserEvents.d.ts.map +1 -1
- package/dist/navigation/browserEvents.esm.js +17 -17
- package/dist/navigation/browserEvents.esm.js.map +1 -1
- package/dist/navigation/chrome.cjs.js +1 -1
- package/dist/navigation/chrome.cjs.js.map +1 -1
- package/dist/navigation/chrome.d.ts +20 -2
- package/dist/navigation/chrome.d.ts.map +1 -1
- package/dist/navigation/chrome.esm.js +14 -8
- package/dist/navigation/chrome.esm.js.map +1 -1
- package/dist/navigation/controller.cjs.js +1 -1
- package/dist/navigation/controller.cjs.js.map +1 -1
- package/dist/navigation/controller.d.ts +3 -0
- package/dist/navigation/controller.d.ts.map +1 -1
- package/dist/navigation/controller.esm.js +50 -29
- package/dist/navigation/controller.esm.js.map +1 -1
- package/dist/navigation/options.cjs.js +1 -1
- package/dist/navigation/options.cjs.js.map +1 -1
- package/dist/navigation/options.d.ts +12 -0
- package/dist/navigation/options.d.ts.map +1 -1
- package/dist/navigation/options.esm.js +4 -1
- package/dist/navigation/options.esm.js.map +1 -1
- package/dist/navigation/podContext.cjs.js +1 -1
- package/dist/navigation/podContext.cjs.js.map +1 -1
- package/dist/navigation/podContext.d.ts.map +1 -1
- package/dist/navigation/podContext.esm.js +17 -17
- package/dist/navigation/podContext.esm.js.map +1 -1
- package/dist/navigation/state.cjs.js +1 -1
- package/dist/navigation/state.cjs.js.map +1 -1
- package/dist/navigation/state.d.ts +4 -0
- package/dist/navigation/state.d.ts.map +1 -1
- package/dist/navigation/state.esm.js +18 -5
- package/dist/navigation/state.esm.js.map +1 -1
- package/dist/outline/fileExplorerHelpers.cjs.js +1 -1
- package/dist/outline/fileExplorerHelpers.cjs.js.map +1 -1
- package/dist/outline/fileExplorerHelpers.d.ts +2 -5
- package/dist/outline/fileExplorerHelpers.d.ts.map +1 -1
- package/dist/outline/fileExplorerHelpers.esm.js +11 -13
- package/dist/outline/fileExplorerHelpers.esm.js.map +1 -1
- package/dist/outline/manager2.cjs.js +1 -1
- package/dist/outline/manager2.cjs.js.map +1 -1
- package/dist/outline/manager2.esm.js +355 -296
- package/dist/outline/manager2.esm.js.map +1 -1
- package/dist/registerPanes.cjs.js +1 -1
- package/dist/registerPanes.cjs.js.map +1 -1
- package/dist/registerPanes.esm.js +1 -1
- package/dist/registerPanes.esm.js.map +1 -1
- package/dist/slideshow/slideshowPane.cjs.js +1 -1
- package/dist/slideshow/slideshowPane.cjs.js.map +1 -1
- package/dist/slideshow/slideshowPane.esm.js +30 -30
- package/dist/slideshow/slideshowPane.esm.js.map +1 -1
- package/dist/social/socialPane2.cjs.js +1 -1
- package/dist/social/socialPane2.esm.js +1 -1
- package/dist/social/socialSections.cjs.js +1 -1
- package/dist/social/socialSections.esm.js +1 -1
- package/dist/utils/paneUtils.cjs.js +1 -1
- package/dist/utils/paneUtils.cjs.js.map +1 -1
- package/dist/utils/paneUtils.esm.js +15 -15
- package/dist/versionInfo.cjs.js +1 -1
- package/dist/versionInfo.cjs.js.map +1 -1
- package/dist/versionInfo.esm.js +9 -9
- package/dist/versionInfo.esm.js.map +1 -1
- package/package.json +11 -12
|
@@ -1,22 +1,34 @@
|
|
|
1
|
-
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.human-readable-pane{box-sizing:border-box;flex-direction:column;width:100%;min-width:0;max-width:100%;margin:0;padding:0 40px;display:flex;overflow:
|
|
1
|
+
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.human-readable-pane{box-sizing:border-box;flex-direction:column;flex:auto;width:100%;min-width:0;max-width:100%;height:100%;min-height:0;margin:0;padding:0 40px;display:flex;overflow:auto}.human-readable-pane__container{box-sizing:border-box;flex-direction:column;flex:auto;width:100%;min-width:0;max-width:100%;min-height:0;margin:0;padding:0;display:flex;overflow-x:hidden}.human-readable-pane__frame{border:1px solid var(--solid-ui-color-slate-200,#e2e8f0);height:var(--human-readable-pane-height,480px);box-sizing:border-box;resize:both;width:100%;min-width:0;max-width:100%;padding:1rem;display:block;overflow:auto}.human-readable-pane__frame--markdown,.human-readable-pane__frame--plain-text{resize:none;flex:auto;height:auto;min-height:100%;max-height:100%}.human-readable-pane__frame--iframe{box-sizing:border-box;background:var(--color-background,white);width:100%;max-width:100%;min-height:0;padding:0;display:block;overflow:hidden}.human-readable-pane--iframe,solid-ui-file-explorer-provider>.paneDiv.human-readable-pane--iframe{flex:1;height:100%;min-height:0;display:flex;overflow:visible}.human-readable-pane__container--iframe{flex-direction:column;flex:auto;min-height:0;display:flex}.human-readable-pane__container--iframe>.human-readable-pane__frame--iframe{resize:none;flex:auto;height:480px;min-height:288px}.human-readable-pane__frame--markdown,.human-readable-pane__frame--plain-text{max-height:none;overflow:visible}.human-readable-pane__frame--markdown{overflow-wrap:anywhere;word-break:break-word}.human-readable-pane__frame--plain-text{white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;margin:0;font-family:monospace}.human-readable-pane__frame--markdown>*{box-sizing:border-box;max-width:100%}.human-readable-pane__frame--markdown img,.human-readable-pane__frame--markdown video,.human-readable-pane__frame--markdown canvas,.human-readable-pane__frame--markdown iframe{max-width:100%;height:auto}.human-readable-pane__frame--markdown pre,.human-readable-pane__frame--markdown code{overflow-wrap:anywhere;word-break:break-word;max-width:100%}.human-readable-pane__frame--markdown pre{white-space:pre-wrap}.human-readable-pane__frame--markdown table{box-sizing:border-box;width:100%;max-width:100%;display:block;overflow-x:auto}.human-readable-pane__frame--markdown th,.human-readable-pane__frame--markdown td{white-space:normal;overflow-wrap:anywhere;word-break:break-word}.human-readable-pane[data-layout=mobile] .human-readable-pane__frame{resize:none;min-width:0;padding:.75rem}.human-readable-pane[data-layout=mobile] .human-readable-pane__frame--markdown,.human-readable-pane[data-layout=mobile] .human-readable-pane__frame--plain-text{min-height:100%;max-height:none}.human-readable-pane[data-layout=mobile]{padding:0}.human-readable-pane[data-layout=mobile] .human-readable-pane__frame--markdown,.human-readable-pane[data-layout=mobile] .human-readable-pane__frame--plain-text{overflow-wrap:anywhere;word-break:break-word}.human-readable-pane[data-layout=mobile] .human-readable-pane__frame--iframe{flex:none;width:100%;max-width:100%;height:100vh;min-height:100vh}@media (width<=576px){.human-readable-pane{padding:0}.human-readable-pane__frame{resize:none;min-width:0;padding:.75rem}.human-readable-pane__frame--markdown,.human-readable-pane__frame--plain-text{overflow-wrap:anywhere;word-break:break-word}.human-readable-pane__frame--iframe{flex:none;width:100%;max-width:100%;height:100vh;min-height:100vh}}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
|
|
2
2
|
import { icons as e, ns as t } from "solid-ui";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import i from "
|
|
3
|
+
import { authn as n } from "solid-logic";
|
|
4
|
+
import { Util as r } from "rdflib";
|
|
5
|
+
import { marked as i } from "marked";
|
|
6
|
+
import a from "dompurify";
|
|
6
7
|
// src/humanReadablePane.ts
|
|
7
|
-
|
|
8
|
+
function o() {
|
|
9
|
+
try {
|
|
10
|
+
return n.currentUser()?.value ?? null;
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
var s = (e) => {
|
|
8
16
|
if (!e) return !1;
|
|
9
17
|
let t = e.split("?")[0].split("#")[0];
|
|
10
18
|
return /\.(md|markdown|mdown|mkd|mkdn)$/i.test(t);
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
}, c = (e) => {
|
|
20
|
+
if (!e) return !1;
|
|
21
|
+
let t = e.split("?")[0].split("#")[0];
|
|
22
|
+
return /\.json$/i.test(t);
|
|
23
|
+
}, l = /* @__PURE__ */ new Map();
|
|
24
|
+
function u(e, t, n) {
|
|
25
|
+
e.className = "", e.classList.add("human-readable-pane__frame"), e.classList.add(`human-readable-pane__frame--${t}`), n !== void 0 && e.style.setProperty("--human-readable-pane-height", `${n * 16}px`);
|
|
14
26
|
}
|
|
15
|
-
var
|
|
16
|
-
function
|
|
27
|
+
var d = "solidos-human-readable-preview", f = "allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-modals", p = (e) => e.includes("<script src=\"https://dokie.li/scripts/dokieli.js\">") || e.includes("dokieli.css");
|
|
28
|
+
function m(e) {
|
|
17
29
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
18
30
|
}
|
|
19
|
-
function
|
|
31
|
+
function h(e, t) {
|
|
20
32
|
let n = e.match(/<base(\s[^>]*)?>/i);
|
|
21
33
|
if (n && n.index !== void 0) {
|
|
22
34
|
let r = n[0].match(/\bhref\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i), i = r?.[1] ?? r?.[2] ?? r?.[3];
|
|
@@ -27,17 +39,21 @@ function f(e, t) {
|
|
|
27
39
|
} catch {
|
|
28
40
|
return e;
|
|
29
41
|
}
|
|
30
|
-
let o = n[0].replace(r[0], `href="${
|
|
42
|
+
let o = n[0].replace(r[0], `href="${m(a)}"`);
|
|
31
43
|
return e.slice(0, n.index) + o + e.slice(n.index + n[0].length);
|
|
32
44
|
}
|
|
33
|
-
let r = `<base href="${
|
|
45
|
+
let r = `<base href="${m(t)}">`, i = e.match(/<head(\s[^>]*)?>/i);
|
|
34
46
|
if (i && i.index !== void 0) {
|
|
35
47
|
let t = i.index + i[0].length;
|
|
36
48
|
return e.slice(0, t) + r + e.slice(t);
|
|
37
49
|
}
|
|
38
50
|
return r + e;
|
|
39
51
|
}
|
|
40
|
-
function
|
|
52
|
+
function g(e) {
|
|
53
|
+
let t = "<script>\n(() => {\n const style = document.createElement('style')\n style.textContent = 'html, body { height: auto !important; min-height: 0 !important; max-height: none !important; overflow: visible !important; }'\n document.head?.appendChild(style)\n const reportHeight = () => {\n const elements = Array.from(document.querySelectorAll('*'))\n const height = Math.max(\n document.documentElement.scrollHeight,\n document.body ? document.body.scrollHeight : 0,\n ...elements.map(element => Math.max(\n element.scrollHeight,\n Math.ceil(element.getBoundingClientRect().bottom + window.scrollY)\n ))\n )\n window.parent.postMessage({ type: 'solidos-preview-size', height }, '*')\n }\n window.addEventListener('load', reportHeight)\n new ResizeObserver(reportHeight).observe(document.documentElement)\n document.addEventListener('DOMContentLoaded', () => {\n if (document.body) new ResizeObserver(reportHeight).observe(document.body)\n new MutationObserver(reportHeight).observe(document.body || document.documentElement, {\n childList: true,\n subtree: true,\n attributes: true\n })\n reportHeight()\n })\n window.setInterval(reportHeight, 500)\n reportHeight()\n})()\n<\/script>", n = e.replace(/<\/body\s*>/i, `${t}$&`);
|
|
54
|
+
return n === e ? `${e}${t}` : n;
|
|
55
|
+
}
|
|
56
|
+
function _(e) {
|
|
41
57
|
let t = e.split("/").pop() || e;
|
|
42
58
|
try {
|
|
43
59
|
return decodeURIComponent(t);
|
|
@@ -45,32 +61,67 @@ function p(e) {
|
|
|
45
61
|
return t;
|
|
46
62
|
}
|
|
47
63
|
}
|
|
48
|
-
function
|
|
49
|
-
let n =
|
|
64
|
+
function v(e, t) {
|
|
65
|
+
let n = _(t);
|
|
50
66
|
try {
|
|
51
67
|
return new DOMParser().parseFromString(e, "text/html").querySelector("title")?.textContent?.trim() || n;
|
|
52
68
|
} catch {
|
|
53
69
|
return n;
|
|
54
70
|
}
|
|
55
71
|
}
|
|
56
|
-
var
|
|
57
|
-
"GET",
|
|
72
|
+
var y = "solidos-preview-request", b = "solidos-preview-response", x = "data-solidos-preview-bridge", S = /* @__PURE__ */ new Set(["GET", "HEAD"]), C = /* @__PURE__ */ new Set([
|
|
58
73
|
"PUT",
|
|
59
74
|
"PATCH",
|
|
60
75
|
"DELETE"
|
|
61
76
|
]);
|
|
62
|
-
function
|
|
77
|
+
function w(e) {
|
|
78
|
+
if (typeof e != "string" || !e.includes(y)) return e;
|
|
79
|
+
let t = new DOMParser().parseFromString(e, "text/html"), n = !1;
|
|
80
|
+
for (let e of t.querySelectorAll("script")) {
|
|
81
|
+
let t = e.textContent || "";
|
|
82
|
+
(e.hasAttribute(x) || t.includes(y) && t.includes(b) && t.includes("const pending = new Map()")) && (e.remove(), n = !0);
|
|
83
|
+
}
|
|
84
|
+
if (!n) return e;
|
|
85
|
+
let r = e.match(/<!doctype[^>]*>/i)?.[0];
|
|
86
|
+
return `${r ? `${r}\n` : ""}${t.documentElement.outerHTML}`;
|
|
87
|
+
}
|
|
88
|
+
function T(e) {
|
|
63
89
|
return e === "about:srcdoc" || /^file:\/\/srcdoc\/?(?:[?#].*)?$/i.test(e);
|
|
64
90
|
}
|
|
65
|
-
function
|
|
91
|
+
function E(e, t) {
|
|
66
92
|
let n = new URL(e, t).href;
|
|
67
|
-
return
|
|
93
|
+
return T(n) ? t : n;
|
|
94
|
+
}
|
|
95
|
+
function D(e) {
|
|
96
|
+
if (e) try {
|
|
97
|
+
let t = new URL(e);
|
|
98
|
+
return t.hash = "", t.href;
|
|
99
|
+
} catch {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function O(e, t, n, r = null) {
|
|
104
|
+
let i, a;
|
|
105
|
+
try {
|
|
106
|
+
i = new URL(E(e, n)), a = new URL(n);
|
|
107
|
+
} catch {
|
|
108
|
+
return !1;
|
|
109
|
+
}
|
|
110
|
+
if (i.origin !== a.origin) return !1;
|
|
111
|
+
let o = t.toUpperCase(), s = new URL(i.href);
|
|
112
|
+
s.hash = "";
|
|
113
|
+
let c = new URL(a.href);
|
|
114
|
+
c.hash = "";
|
|
115
|
+
let l = s.href === c.href, u = i.href === a.href, d = i.pathname === "/profile/card" || s.href === D(r);
|
|
116
|
+
return S.has(o) && (l || d) || u && C.has(o);
|
|
68
117
|
}
|
|
69
|
-
function
|
|
70
|
-
let
|
|
118
|
+
function k(e, t, n, r = null) {
|
|
119
|
+
let i = `<script ${x}="true">
|
|
71
120
|
(() => {
|
|
72
121
|
const documentUri = ${JSON.stringify(t)}
|
|
122
|
+
const documentOrigin = new URL(documentUri).origin
|
|
73
123
|
const nonce = ${JSON.stringify(n)}
|
|
124
|
+
const viewerWebId = ${JSON.stringify(r)}
|
|
74
125
|
const pending = new Map()
|
|
75
126
|
let requestId = 0
|
|
76
127
|
try {
|
|
@@ -126,19 +177,19 @@ function b(e, t, n) {
|
|
|
126
177
|
})
|
|
127
178
|
return operation
|
|
128
179
|
}
|
|
129
|
-
|
|
130
|
-
get: key => run(store.get(key)),
|
|
131
|
-
getAll: () => run(Array.from(store.values())),
|
|
132
|
-
getAllKeys: () => run(Array.from(store.keys())),
|
|
133
|
-
count: () => run(store.size),
|
|
134
|
-
openKeyCursor () {
|
|
180
|
+
const openCursor = (withValue) => {
|
|
135
181
|
const keys = Array.from(store.keys())
|
|
136
182
|
const operation = request(null)
|
|
137
183
|
pending++
|
|
138
184
|
let index = 0
|
|
139
185
|
const emit = () => {
|
|
140
186
|
operation.result = index < keys.length
|
|
141
|
-
? {
|
|
187
|
+
? {
|
|
188
|
+
key: keys[index],
|
|
189
|
+
primaryKey: keys[index],
|
|
190
|
+
value: withValue ? store.get(keys[index]) : undefined,
|
|
191
|
+
continue: () => { index++; queueMicrotask(emit) }
|
|
192
|
+
}
|
|
142
193
|
: null
|
|
143
194
|
operation.onsuccess?.({ target: operation })
|
|
144
195
|
if (!operation.result) {
|
|
@@ -151,7 +202,15 @@ function b(e, t, n) {
|
|
|
151
202
|
}
|
|
152
203
|
queueMicrotask(emit)
|
|
153
204
|
return operation
|
|
154
|
-
}
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
transaction,
|
|
208
|
+
get: key => run(store.get(key)),
|
|
209
|
+
getAll: () => run(Array.from(store.values())),
|
|
210
|
+
getAllKeys: () => run(Array.from(store.keys())),
|
|
211
|
+
count: () => run(store.size),
|
|
212
|
+
openCursor: () => openCursor(true),
|
|
213
|
+
openKeyCursor: () => openCursor(false),
|
|
155
214
|
put: (value, key) => run(undefined, () => store.set(key, value)),
|
|
156
215
|
add: (value, key) => run(undefined, () => store.set(key, value)),
|
|
157
216
|
delete: key => run(undefined, () => store.delete(key)),
|
|
@@ -179,6 +238,27 @@ function b(e, t, n) {
|
|
|
179
238
|
}
|
|
180
239
|
Object.defineProperty(window, 'indexedDB', { configurable: true, value: isolatedIndexedDB })
|
|
181
240
|
}
|
|
241
|
+
const createMemoryStorage = () => {
|
|
242
|
+
const values = new Map()
|
|
243
|
+
return {
|
|
244
|
+
get length () { return values.size },
|
|
245
|
+
key: index => Array.from(values.keys())[index] ?? null,
|
|
246
|
+
getItem: key => values.get(String(key)) ?? null,
|
|
247
|
+
setItem: (key, value) => values.set(String(key), String(value)),
|
|
248
|
+
removeItem: key => values.delete(String(key)),
|
|
249
|
+
clear: () => values.clear()
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
for (const storageName of ['localStorage', 'sessionStorage']) {
|
|
253
|
+
try {
|
|
254
|
+
window[storageName].getItem('__solidos_probe__')
|
|
255
|
+
} catch {
|
|
256
|
+
Object.defineProperty(window, storageName, {
|
|
257
|
+
configurable: true,
|
|
258
|
+
value: createMemoryStorage()
|
|
259
|
+
})
|
|
260
|
+
}
|
|
261
|
+
}
|
|
182
262
|
const nativeFetch = window.fetch.bind(window)
|
|
183
263
|
|
|
184
264
|
function isSrcdocUrl (url) {
|
|
@@ -197,7 +277,7 @@ function b(e, t, n) {
|
|
|
197
277
|
return new Promise((resolve, reject) => {
|
|
198
278
|
pending.set(id, { resolve, reject })
|
|
199
279
|
window.parent.postMessage({
|
|
200
|
-
type: ${JSON.stringify(
|
|
280
|
+
type: ${JSON.stringify(y)},
|
|
201
281
|
nonce,
|
|
202
282
|
id,
|
|
203
283
|
url,
|
|
@@ -210,7 +290,7 @@ function b(e, t, n) {
|
|
|
210
290
|
|
|
211
291
|
window.addEventListener('message', event => {
|
|
212
292
|
const message = event.data
|
|
213
|
-
if (!message || message.type !== ${JSON.stringify(
|
|
293
|
+
if (!message || message.type !== ${JSON.stringify(b)} || message.nonce !== nonce) return
|
|
214
294
|
const entry = pending.get(message.id)
|
|
215
295
|
if (!entry) return
|
|
216
296
|
pending.delete(message.id)
|
|
@@ -225,11 +305,38 @@ function b(e, t, n) {
|
|
|
225
305
|
}))
|
|
226
306
|
})
|
|
227
307
|
|
|
308
|
+
const reportHeight = () => {
|
|
309
|
+
const elements = Array.from(document.querySelectorAll('*'))
|
|
310
|
+
const height = Math.max(
|
|
311
|
+
document.documentElement.scrollHeight,
|
|
312
|
+
document.body ? document.body.scrollHeight : 0,
|
|
313
|
+
...elements.map(element => Math.max(
|
|
314
|
+
element.scrollHeight,
|
|
315
|
+
Math.ceil(element.getBoundingClientRect().bottom + window.scrollY)
|
|
316
|
+
))
|
|
317
|
+
)
|
|
318
|
+
window.parent.postMessage({ type: 'solidos-preview-size', height }, '*')
|
|
319
|
+
}
|
|
320
|
+
window.addEventListener('load', reportHeight)
|
|
321
|
+
new ResizeObserver(reportHeight).observe(document.documentElement)
|
|
322
|
+
if (document.body) new ResizeObserver(reportHeight).observe(document.body)
|
|
323
|
+
new MutationObserver(reportHeight).observe(document.body || document.documentElement, {
|
|
324
|
+
childList: true,
|
|
325
|
+
subtree: true,
|
|
326
|
+
attributes: true
|
|
327
|
+
})
|
|
328
|
+
window.setInterval(reportHeight, 500)
|
|
329
|
+
reportHeight()
|
|
330
|
+
|
|
228
331
|
window.fetch = async (input, init = {}) => {
|
|
229
332
|
const request = input instanceof Request ? input : null
|
|
230
333
|
const url = documentRequestUrl(request ? request.url : input)
|
|
231
334
|
const method = (init.method || (request && request.method) || 'GET').toUpperCase()
|
|
232
|
-
|
|
335
|
+
const sameOrigin = new URL(url).origin === documentOrigin
|
|
336
|
+
const allowed = sameOrigin &&
|
|
337
|
+
(${JSON.stringify(Array.from(S))}.includes(method) ||
|
|
338
|
+
(url === documentUri && ${JSON.stringify(Array.from(C))}.includes(method)))
|
|
339
|
+
if (!allowed) {
|
|
233
340
|
return nativeFetch(input, init)
|
|
234
341
|
}
|
|
235
342
|
const headers = new Headers(request ? request.headers : undefined)
|
|
@@ -273,8 +380,10 @@ function b(e, t, n) {
|
|
|
273
380
|
const resolvedUrl = documentRequestUrl(url)
|
|
274
381
|
this._method = String(method || 'GET').toUpperCase()
|
|
275
382
|
this._url = resolvedUrl
|
|
276
|
-
|
|
277
|
-
|
|
383
|
+
const sameOrigin = new URL(resolvedUrl).origin === documentOrigin
|
|
384
|
+
this._intercepted = sameOrigin &&
|
|
385
|
+
(${JSON.stringify(Array.from(S))}.includes(this._method) ||
|
|
386
|
+
(resolvedUrl === documentUri && ${JSON.stringify(Array.from(C))}.includes(this._method)))
|
|
278
387
|
if (!this._intercepted) {
|
|
279
388
|
this._native.open(method, url, async, user, password)
|
|
280
389
|
for (const type of ['abort', 'error', 'load', 'loadend', 'progress', 'readystatechange', 'timeout']) {
|
|
@@ -341,30 +450,71 @@ function b(e, t, n) {
|
|
|
341
450
|
: ''
|
|
342
451
|
}
|
|
343
452
|
}
|
|
453
|
+
|
|
454
|
+
// Dokieli's own OIDC session cannot be restored in an opaque-origin
|
|
455
|
+
// sandbox, so it would always show "Sign in". Give it the SolidOS viewer
|
|
456
|
+
// through the same session shape Dokieli uses for its WebExtension mode;
|
|
457
|
+
// requests still go through the restricted bridge above.
|
|
458
|
+
const bridgedSession = viewerWebId
|
|
459
|
+
? {
|
|
460
|
+
isActive: true,
|
|
461
|
+
webId: viewerWebId,
|
|
462
|
+
authFetch: (input, init) => window.fetch(input, init),
|
|
463
|
+
handleRedirectFromLogin: async () => {},
|
|
464
|
+
restore: async () => {},
|
|
465
|
+
login: async () => {},
|
|
466
|
+
logout: async () => {
|
|
467
|
+
bridgedSession.isActive = false
|
|
468
|
+
bridgedSession.webId = undefined
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
: null
|
|
472
|
+
let dokieliHooksInstalled = false
|
|
473
|
+
const installDokieliHooks = () => {
|
|
474
|
+
const config = window.DO && window.DO.C
|
|
475
|
+
if (!config || dokieliHooksInstalled) return
|
|
476
|
+
dokieliHooksInstalled = true
|
|
477
|
+
if (bridgedSession) config.Session = bridgedSession
|
|
478
|
+
// Dokieli skips requests for file: URLs, which is how srcdoc reports
|
|
479
|
+
// its location, so keep its document URL pointing at the resource.
|
|
480
|
+
let documentUrl = config.DocumentURL
|
|
481
|
+
Object.defineProperty(config, 'DocumentURL', {
|
|
482
|
+
configurable: true,
|
|
483
|
+
enumerable: true,
|
|
484
|
+
get: () => documentUrl,
|
|
485
|
+
set: value => {
|
|
486
|
+
documentUrl = typeof value === 'string' && isSrcdocUrl(value) ? documentUri : value
|
|
487
|
+
}
|
|
488
|
+
})
|
|
489
|
+
config.DocumentURL = documentUrl
|
|
490
|
+
}
|
|
491
|
+
// Registered before dokieli.js runs, so this precedes Dokieli's init.
|
|
492
|
+
document.addEventListener('DOMContentLoaded', installDokieliHooks)
|
|
493
|
+
window.addEventListener('load', installDokieliHooks)
|
|
344
494
|
})()
|
|
345
495
|
<\/script>`;
|
|
346
|
-
return
|
|
496
|
+
return h(w(e) ?? e, t).replace(/<head(\s[^>]*)?>/i, (e) => `${e}${i}`);
|
|
347
497
|
}
|
|
348
|
-
function
|
|
349
|
-
let
|
|
350
|
-
if (!
|
|
351
|
-
let
|
|
352
|
-
|
|
353
|
-
let
|
|
354
|
-
|
|
498
|
+
function A(e, t, n, r, i = null) {
|
|
499
|
+
let a = e.ownerDocument.defaultView;
|
|
500
|
+
if (!a) return;
|
|
501
|
+
let o = /* @__PURE__ */ new Uint32Array(4);
|
|
502
|
+
a.crypto.getRandomValues(o);
|
|
503
|
+
let s = Array.from(o, (e) => e.toString(16)).join("-"), c = new URL(t).href;
|
|
504
|
+
a.addEventListener("message", (t) => {
|
|
355
505
|
let n = t.data;
|
|
356
|
-
if (t.source !== e.contentWindow || !n || n.type !==
|
|
357
|
-
let
|
|
506
|
+
if (t.source !== e.contentWindow || !n || n.type !== y || n.nonce !== s) return;
|
|
507
|
+
let a = (t) => {
|
|
358
508
|
e.contentWindow?.postMessage(t, "*");
|
|
359
509
|
};
|
|
360
|
-
r(
|
|
510
|
+
O(n.url, n.method, c, i) ? r(E(n.url, c), {
|
|
361
511
|
method: n.method,
|
|
362
512
|
headers: n.headers,
|
|
363
|
-
body: n.method
|
|
513
|
+
body: S.has(n.method) ? void 0 : w(n.body)
|
|
364
514
|
}).then(async (e) => {
|
|
365
|
-
|
|
366
|
-
type:
|
|
367
|
-
nonce:
|
|
515
|
+
a({
|
|
516
|
+
type: b,
|
|
517
|
+
nonce: s,
|
|
368
518
|
id: n.id,
|
|
369
519
|
ok: e.ok,
|
|
370
520
|
status: e.status,
|
|
@@ -372,9 +522,9 @@ function x(e, t, n, r) {
|
|
|
372
522
|
body: await e.text()
|
|
373
523
|
});
|
|
374
524
|
}).catch((e) => {
|
|
375
|
-
|
|
376
|
-
type:
|
|
377
|
-
nonce:
|
|
525
|
+
a({
|
|
526
|
+
type: b,
|
|
527
|
+
nonce: s,
|
|
378
528
|
id: n.id,
|
|
379
529
|
ok: !1,
|
|
380
530
|
status: 0,
|
|
@@ -382,139 +532,156 @@ function x(e, t, n, r) {
|
|
|
382
532
|
body: "",
|
|
383
533
|
error: e instanceof Error ? e.message : String(e)
|
|
384
534
|
});
|
|
535
|
+
}) : a({
|
|
536
|
+
type: b,
|
|
537
|
+
nonce: s,
|
|
538
|
+
id: n.id,
|
|
539
|
+
ok: !1,
|
|
540
|
+
status: 403,
|
|
541
|
+
headers: [],
|
|
542
|
+
body: "",
|
|
543
|
+
error: "Request not permitted by the SolidOS preview"
|
|
385
544
|
});
|
|
386
|
-
}), e.setAttribute("sandbox",
|
|
545
|
+
}), e.setAttribute("sandbox", f), e.srcdoc = k(n, c, s, i);
|
|
546
|
+
}
|
|
547
|
+
function j(e, t) {
|
|
548
|
+
let n = (t) => {
|
|
549
|
+
let n = t.data;
|
|
550
|
+
t.source === e.contentWindow && n?.type === "solidos-preview-size" && typeof n.height == "number" && Number.isFinite(n.height) && (e.style.height = `${Math.max(1, Math.ceil(n.height))}px`, e.style.flexShrink = "0");
|
|
551
|
+
};
|
|
552
|
+
return t.addEventListener("message", n), () => t.removeEventListener("message", n);
|
|
387
553
|
}
|
|
388
|
-
var
|
|
554
|
+
var M = {
|
|
389
555
|
icon: function(t, n) {
|
|
390
|
-
if (t &&
|
|
556
|
+
if (t && s(t.uri)) return e.iconBase + "markdown.svg";
|
|
391
557
|
if (t) {
|
|
392
|
-
let r = n.session.store, i =
|
|
558
|
+
let r = n.session.store, i = l.get(t.uri);
|
|
393
559
|
if (i === "dokieli") return e.iconBase + "dokieli-logo.png";
|
|
394
560
|
if (i === "html") return e.originalIconBase + "tango/22-text-x-generic.png";
|
|
395
561
|
let a = r.fetcher.getHeader(t.doc(), "content");
|
|
396
562
|
if (a && a.length > 0) {
|
|
397
563
|
let n = a[0], r = n.includes("<script src=\"https://dokie.li/scripts/dokieli.js\">") || n.includes("dokieli.css");
|
|
398
|
-
return
|
|
564
|
+
return l.set(t.uri, r ? "dokieli" : "html"), r ? e.iconBase + "dokieli-logo.png" : e.originalIconBase + "tango/22-text-x-generic.png";
|
|
399
565
|
}
|
|
400
|
-
let
|
|
401
|
-
if ((
|
|
566
|
+
let o = r.fetcher.getHeader(t.doc(), "content-type");
|
|
567
|
+
if ((o ? o[0].split(";", 1)[0].trim() : null) === "text/html") return r.fetcher._fetch(t.uri).then((e) => e.text()).then((n) => {
|
|
402
568
|
let r = n.includes("<script src=\"https://dokie.li/scripts/dokieli.js\">") || n.includes("dokieli.css");
|
|
403
|
-
return
|
|
404
|
-
}).catch(() => (
|
|
569
|
+
return l.set(t.uri, r ? "dokieli" : "html"), r ? e.iconBase + "dokieli-logo.png" : e.originalIconBase + "tango/22-text-x-generic.png";
|
|
570
|
+
}).catch(() => (l.set(t.uri, "html"), e.originalIconBase + "tango/22-text-x-generic.png"));
|
|
405
571
|
}
|
|
406
572
|
return e.originalIconBase + "tango/22-text-x-generic.png";
|
|
407
573
|
},
|
|
408
574
|
name: "humanReadable",
|
|
409
|
-
label: function(e,
|
|
410
|
-
let i =
|
|
575
|
+
label: function(e, n) {
|
|
576
|
+
let i = n.session.store, a = [
|
|
411
577
|
"text/plain",
|
|
412
578
|
"text/html",
|
|
413
579
|
"text/markdown",
|
|
580
|
+
"application/json",
|
|
414
581
|
"application/xhtml+xml",
|
|
415
582
|
"application/pdf",
|
|
416
583
|
"video/mp4"
|
|
417
|
-
],
|
|
584
|
+
], o = function(e, t, n) {
|
|
418
585
|
let r = e.fetcher.getHeader(t, "content-type");
|
|
419
586
|
if (r) {
|
|
420
587
|
for (let e = 0; e < r.length; e++) for (let t = 0; t < n.length; t++) if (r[e].indexOf(n[t]) >= 0) return !0;
|
|
421
588
|
}
|
|
422
589
|
return !1;
|
|
423
|
-
},
|
|
590
|
+
}, c = function(e, t, n) {
|
|
424
591
|
let i = e.findTypeURIs(t);
|
|
425
|
-
for (let e = 0; e <
|
|
592
|
+
for (let e = 0; e < n.length; e++) if (r.mediaTypeClass(n[e]).uri in i) return !0;
|
|
426
593
|
return !1;
|
|
427
594
|
};
|
|
428
595
|
if (!e.uri) return null;
|
|
429
596
|
if (i.findTypeURIs(e)[t.link("WebPage").uri]) return "Webpage";
|
|
430
|
-
if (
|
|
431
|
-
if (
|
|
597
|
+
if (s(e.uri)) return "View";
|
|
598
|
+
if (o(i, e, a) || c(i, e, a)) {
|
|
432
599
|
let t = i.fetcher.getHeader(e.doc(), "content-type");
|
|
433
|
-
return (t ? t[0].split(";", 1)[0].trim() : null) === "text/html" && !
|
|
600
|
+
return (t ? t[0].split(";", 1)[0].trim() : null) === "text/html" && !l.has(e.uri) && i.fetcher._fetch(e.uri).then((e) => e.text()).then((t) => {
|
|
434
601
|
let n = t.includes("<script src=\"https://dokie.li/scripts/dokieli.js\">") || t.includes("dokieli.css");
|
|
435
|
-
|
|
602
|
+
l.set(e.uri, n ? "dokieli" : "html");
|
|
436
603
|
}).catch(() => {
|
|
437
|
-
|
|
604
|
+
l.set(e.uri, "html");
|
|
438
605
|
}), "View";
|
|
439
606
|
}
|
|
440
607
|
return null;
|
|
441
608
|
},
|
|
442
609
|
render: function(e, t) {
|
|
443
|
-
let n = t.dom,
|
|
444
|
-
function
|
|
610
|
+
let n = t.dom, r = n.createElement("div"), y = t.session.store;
|
|
611
|
+
function b(e) {
|
|
445
612
|
let n = t.environment ?? {};
|
|
446
613
|
e.dataset.layout = n.layout ?? "desktop";
|
|
447
614
|
}
|
|
448
|
-
let
|
|
449
|
-
|
|
450
|
-
let
|
|
451
|
-
|
|
452
|
-
let n = e.responseText ?? "",
|
|
453
|
-
t.innerHTML =
|
|
615
|
+
let x = y.fetcher.getHeader(e.doc(), "content-type"), S = x ? x[0].split(";", 1)[0].trim() : null, C = S === "text/markdown" || s(e.uri), w = S === "text/plain" || S === "application/json" || !S && c(e.uri);
|
|
616
|
+
S || console.log("humanReadablePane: unknown content-type?"), r.classList.add("human-readable-pane"), b(r);
|
|
617
|
+
let T = function(t) {
|
|
618
|
+
y.fetcher.webOperation("GET", e.uri).then((e) => {
|
|
619
|
+
let n = e.responseText ?? "", r = Math.min(30, n.split(/\n/).length + 5), o = i.parse(n, { async: !1 });
|
|
620
|
+
t.innerHTML = a.sanitize(o), u(t, "markdown", r);
|
|
454
621
|
}).catch((e) => {
|
|
455
622
|
console.error("Error fetching markdown content:", e), t.innerHTML = "<p>Error loading content</p>";
|
|
456
623
|
});
|
|
457
|
-
},
|
|
458
|
-
|
|
624
|
+
}, E = function(t) {
|
|
625
|
+
y.fetcher.webOperation("GET", e.uri).then((e) => {
|
|
459
626
|
let n = e.responseText ?? "", r = Math.min(30, n.split(/\n/).length + 5);
|
|
460
|
-
t.textContent = n,
|
|
627
|
+
t.textContent = n, u(t, "plain-text", r);
|
|
461
628
|
}).catch((e) => {
|
|
462
629
|
console.error("Error fetching plain text content:", e), t.textContent = "Error loading content";
|
|
463
630
|
});
|
|
464
631
|
};
|
|
465
|
-
if (
|
|
632
|
+
if (C) {
|
|
466
633
|
let e = n.createElement("div");
|
|
467
|
-
|
|
634
|
+
T(e);
|
|
468
635
|
let t = n.createElement("div");
|
|
469
|
-
t.classList.add("human-readable-pane__container"), t.appendChild(e),
|
|
470
|
-
} else if (
|
|
636
|
+
t.classList.add("human-readable-pane__container"), t.appendChild(e), r.appendChild(t);
|
|
637
|
+
} else if (w) {
|
|
471
638
|
let e = n.createElement("pre");
|
|
472
|
-
|
|
639
|
+
E(e);
|
|
473
640
|
let t = n.createElement("div");
|
|
474
|
-
t.classList.add("human-readable-pane__container"), t.appendChild(e),
|
|
641
|
+
t.classList.add("human-readable-pane__container"), t.appendChild(e), r.appendChild(t);
|
|
475
642
|
} else {
|
|
476
643
|
let t = n.createElement("iframe");
|
|
477
|
-
t.name =
|
|
478
|
-
let
|
|
479
|
-
let t = e.some((e) => Array.from(e.addedNodes).some((e) => e ===
|
|
480
|
-
|
|
644
|
+
t.name = d, t.title = _(e.uri), u(t, "iframe");
|
|
645
|
+
let i = n.defaultView, a = i ? j(t, i) : () => {}, s = S === "text/html" || S === "application/xhtml+xml", c = null, b = !1, x = !1, C = typeof MutationObserver > "u" ? null : new MutationObserver((e) => {
|
|
646
|
+
let t = e.some((e) => Array.from(e.addedNodes).some((e) => e === r || e.nodeType === Node.ELEMENT_NODE && e.contains(r)));
|
|
647
|
+
r.isConnected ? x = !0 : (x || t) && (b = !0, c &&= (URL.revokeObjectURL(c), null), a(), C?.disconnect());
|
|
481
648
|
});
|
|
482
|
-
|
|
649
|
+
C?.observe(n, {
|
|
483
650
|
childList: !0,
|
|
484
651
|
subtree: !0
|
|
485
652
|
});
|
|
486
|
-
let
|
|
487
|
-
t.removeAttribute("src"), t.setAttribute("sandbox", ""), t.srcdoc = `<p style="font-family: sans-serif">${
|
|
653
|
+
let w = (e) => {
|
|
654
|
+
t.removeAttribute("src"), t.setAttribute("sandbox", ""), t.srcdoc = `<p style="font-family: sans-serif">${m(e)}</p>`;
|
|
488
655
|
};
|
|
489
|
-
|
|
656
|
+
s ? y.fetcher.webOperation("GET", e.uri).then((n) => {
|
|
490
657
|
let r = n.responseText ?? "";
|
|
491
|
-
t.title =
|
|
492
|
-
let i =
|
|
493
|
-
|
|
658
|
+
t.title = v(r, e.uri);
|
|
659
|
+
let i = p(r);
|
|
660
|
+
l.set(e.uri, i ? "dokieli" : "html"), i ? A(t, e.uri, r, (e, t) => y.fetcher._fetch(e, t), o()) : (t.setAttribute("sandbox", f), t.srcdoc = g(h(r, e.uri)));
|
|
494
661
|
}).catch((e) => {
|
|
495
|
-
console.error("Error fetching HTML content:", e),
|
|
496
|
-
}) :
|
|
662
|
+
console.error("Error fetching HTML content:", e), w("Error loading content");
|
|
663
|
+
}) : y.fetcher._fetch(e.uri).then(async (n) => {
|
|
497
664
|
if (!n.ok) throw Error(`HTTP ${n.status}`);
|
|
498
665
|
let r = n.headers.get("content-type")?.split(";", 1)[0].trim().toLowerCase();
|
|
499
666
|
if (r === "text/html" || r === "application/xhtml+xml") {
|
|
500
667
|
let r = await n.text();
|
|
501
|
-
t.title =
|
|
502
|
-
let i =
|
|
503
|
-
|
|
668
|
+
t.title = v(r, e.uri);
|
|
669
|
+
let i = p(r);
|
|
670
|
+
l.set(e.uri, i ? "dokieli" : "html"), i ? A(t, e.uri, r, (e, t) => y.fetcher._fetch(e, t), o()) : (t.setAttribute("sandbox", f), t.srcdoc = g(h(r, e.uri)));
|
|
504
671
|
return;
|
|
505
672
|
}
|
|
506
|
-
t.setAttribute("sandbox",
|
|
507
|
-
let
|
|
508
|
-
|
|
673
|
+
r !== "application/pdf" && t.setAttribute("sandbox", f);
|
|
674
|
+
let i = URL.createObjectURL(await n.blob());
|
|
675
|
+
b ? URL.revokeObjectURL(i) : (c = i, t.src = i);
|
|
509
676
|
}).catch((e) => {
|
|
510
|
-
console.error("Error fetching content:", e),
|
|
677
|
+
console.error("Error fetching content:", e), w("Error loading content");
|
|
511
678
|
});
|
|
512
|
-
let
|
|
513
|
-
|
|
679
|
+
let T = n.createElement("div");
|
|
680
|
+
T.classList.add("human-readable-pane__container"), T.classList.add("human-readable-pane__container--iframe"), T.appendChild(t), r.appendChild(T), r.classList.add("human-readable-pane--iframe");
|
|
514
681
|
}
|
|
515
|
-
return
|
|
682
|
+
return r;
|
|
516
683
|
}
|
|
517
684
|
};
|
|
518
|
-
export {
|
|
685
|
+
export { d as HUMAN_READABLE_PREVIEW_FRAME_NAME, M as default, O as isAllowedPreviewRequest, E as previewRequestUrl, h as withBaseHref };
|
|
519
686
|
|
|
520
687
|
//# sourceMappingURL=humanReadablePane2.esm.js.map
|