@burtson-labs/bandit-engine 2.0.149 → 2.0.150

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.
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  management_default
3
- } from "../chunk-JQSZNGII.mjs";
4
- import "../chunk-P5IJLX6I.mjs";
3
+ } from "../chunk-IJTDHBHP.mjs";
4
+ import "../chunk-7P7IS6UA.mjs";
5
5
  import "../chunk-F7JXIW6T.mjs";
6
6
  import "../chunk-K2JGFKEB.mjs";
7
- import "../chunk-K6IV4LYZ.mjs";
8
- import "../chunk-F735W34E.mjs";
7
+ import "../chunk-L37EUHMZ.mjs";
8
+ import "../chunk-FFVGZK5D.mjs";
9
9
  import "../chunk-NLBZZP3B.mjs";
10
10
  import "../chunk-EORIRPPX.mjs";
11
11
  import "../chunk-43MLINPL.mjs";
@@ -11603,6 +11603,40 @@ var import_rehype_sanitize2 = __toESM(require("rehype-sanitize"));
11603
11603
  init_debugLogger();
11604
11604
  var import_material8 = require("@mui/material");
11605
11605
 
11606
+ // src/utils/openFileLink.ts
11607
+ init_debugLogger();
11608
+ var FILE_EXT_RE = /\.(docx|pptx|xlsx|csv|json|md|txt|html|xml|ya?ml|pdf|zip)(?:[?#]|$)/i;
11609
+ var isStandalonePwa = () => typeof window !== "undefined" && (window.matchMedia?.("(display-mode: standalone)").matches || window.navigator.standalone === true);
11610
+ var isFileLink = (href) => Boolean(href && FILE_EXT_RE.test(href));
11611
+ var maybeHandleFileLinkClick = (event, href) => {
11612
+ if (!href || !isStandalonePwa() || !isFileLink(href)) return;
11613
+ event.preventDefault();
11614
+ void (async () => {
11615
+ try {
11616
+ const res = await fetch(href);
11617
+ if (!res.ok) throw new Error(`fetch ${res.status}`);
11618
+ const blob = await res.blob();
11619
+ const rawName = new URL(href, window.location.href).pathname.split("/").pop() || "download";
11620
+ const name = decodeURIComponent(rawName);
11621
+ const file = new File([blob], name, {
11622
+ type: blob.type || "application/octet-stream"
11623
+ });
11624
+ const nav = navigator;
11625
+ if (nav.canShare?.({ files: [file] }) && nav.share) {
11626
+ await nav.share({ files: [file], title: name });
11627
+ return;
11628
+ }
11629
+ window.location.href = URL.createObjectURL(blob);
11630
+ } catch (error) {
11631
+ debugLogger.warn("openFileLink: share flow failed, falling back", {
11632
+ error: error instanceof Error ? error.message : String(error)
11633
+ });
11634
+ if (error?.name === "AbortError") return;
11635
+ window.open(href, "_blank", "noopener");
11636
+ }
11637
+ })();
11638
+ };
11639
+
11606
11640
  // src/modals/chat-modal/ai-response-action-bar.tsx
11607
11641
  var import_react13 = require("react");
11608
11642
 
@@ -12972,6 +13006,7 @@ ${sourcesMarkdownList.join("\n")}`;
12972
13006
  },
12973
13007
  target: "_blank",
12974
13008
  rel: "noopener noreferrer",
13009
+ onClick: (e) => maybeHandleFileLinkClick(e, href),
12975
13010
  children
12976
13011
  }
12977
13012
  );