@athenaintel/react 0.10.34 → 0.10.36
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 +27 -0
- package/dist/assets/AssetPanel.d.ts +6 -0
- package/dist/assets/AthenaAssetEmbed.d.ts +17 -0
- package/dist/assets/AthenaLayout.d.ts +13 -0
- package/dist/assets/asset-embed-messages.d.ts +31 -0
- package/dist/assets/asset-panel-store.d.ts +65 -0
- package/dist/assets/asset-panel-url.d.ts +17 -0
- package/dist/assets/use-asset-embed.d.ts +50 -0
- package/dist/auth/AthenaAuthContext.d.ts +26 -0
- package/dist/auth/AthenaAuthProvider.d.ts +43 -0
- package/dist/auth/AthenaSSOProvider.d.ts +91 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/types.d.ts +66 -0
- package/dist/chat/AthenaChat.d.ts +64 -0
- package/dist/chat/ComposerEditorContext.d.ts +30 -0
- package/dist/chat/athena-citation-links.d.ts +18 -0
- package/dist/chat/super-grouping/CollapsibleGroup.d.ts +15 -0
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +35 -0
- package/dist/chat/super-grouping/grouping-function.d.ts +19 -0
- package/dist/chat/super-grouping/tool-status-labels.d.ts +1 -0
- package/dist/chat/super-grouping/toolkit-map.d.ts +9 -0
- package/dist/chat/tiptap-composer.d.ts +7 -0
- package/dist/chat/tiptap-text.d.ts +4 -0
- package/dist/chat/tooltip-icon-button.d.ts +7 -0
- package/dist/composer/AttachmentContext.d.ts +27 -0
- package/dist/composer/ComposerAttachmentPreview.d.ts +9 -0
- package/dist/composer/ComposerDropZone.d.ts +13 -0
- package/dist/composer/ComposerQuotePreview.d.ts +12 -0
- package/dist/composer/FileUploadButton.d.ts +15 -0
- package/dist/composer/QuoteContext.d.ts +33 -0
- package/dist/composer/build-composed-message.d.ts +15 -0
- package/dist/composer/clipboard.d.ts +6 -0
- package/dist/composer/index.d.ts +18 -0
- package/dist/composer/useAppendToComposer.d.ts +14 -0
- package/dist/composer/useComposerAttachment.d.ts +14 -0
- package/dist/composer/useFileUpload.d.ts +35 -0
- package/dist/composer/useSendMessage.d.ts +21 -0
- package/dist/index.cjs +1595 -1432
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +81 -1545
- package/dist/index.js +1596 -1433
- package/dist/index.js.map +1 -1
- package/dist/lib/athena-urls.d.ts +32 -0
- package/dist/lib/posthog/capture-gate.d.ts +72 -0
- package/dist/lib/posthog/wrap-posthog-client.d.ts +11 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/mentions/composer-keybinds.d.ts +5 -0
- package/dist/mentions/mention-extension.d.ts +6 -0
- package/dist/mentions/mention-icons.d.ts +4 -0
- package/dist/mentions/mention-node-view.d.ts +2 -0
- package/dist/mentions/mention-suggestion-list.d.ts +14 -0
- package/dist/mentions/mention-suggestion-popup.d.ts +15 -0
- package/dist/mentions/mention-suggestions-extension.d.ts +11 -0
- package/dist/mentions/mention-types.d.ts +21 -0
- package/dist/mentions/mention-utils.d.ts +23 -0
- package/dist/mentions/scope-registry.d.ts +21 -0
- package/dist/mentions/types.d.ts +39 -0
- package/dist/mentions/use-mention-suggestions.d.ts +28 -0
- package/dist/provider/AthenaContext.d.ts +11 -0
- package/dist/provider/AthenaProvider.d.ts +86 -0
- package/dist/provider/PostHogProvider.d.ts +14 -0
- package/dist/provider/citation-links.d.ts +61 -0
- package/dist/provider/config.d.ts +20 -0
- package/dist/provider/types.d.ts +4 -0
- package/dist/runtime/auth.d.ts +45 -0
- package/dist/runtime/converter.d.ts +5 -0
- package/dist/runtime/external-message-converter.d.ts +21 -0
- package/dist/runtime/schemas.d.ts +24 -0
- package/dist/runtime/useAthenaRuntime.d.ts +47 -0
- package/dist/theme/index.d.ts +215 -0
- package/dist/threads/ThreadList.d.ts +4 -0
- package/dist/threads/adapter.d.ts +42 -0
- package/dist/threads/api.d.ts +49 -0
- package/dist/threads/index.d.ts +5 -0
- package/dist/threads/title.d.ts +4 -0
- package/dist/threads/useActiveThreadStateHydration.d.ts +14 -0
- package/dist/threads/useAthenaThreadManager.d.ts +25 -0
- package/dist/threads/useThreadTitlePolling.d.ts +14 -0
- package/dist/toolkits/index.d.ts +89 -0
- package/dist/tools/NestedPtcMessages.d.ts +14 -0
- package/dist/tools/append-document-tool-ui.d.ts +2 -0
- package/dist/tools/asset-utils.d.ts +6 -0
- package/dist/tools/auto-open-tools.d.ts +8 -0
- package/dist/tools/read-asset-tool-ui.d.ts +2 -0
- package/dist/tools/tool-fallback.d.ts +34 -0
- package/dist/tools/tool-uis.d.ts +62 -0
- package/dist/ui/button.d.ts +10 -0
- package/dist/ui/collapsible.d.ts +5 -0
- package/dist/ui/tooltip.d.ts +7 -0
- package/package.json +9 -10
- package/dist/auth.d.ts +0 -240
package/dist/index.cjs
CHANGED
|
@@ -99,11 +99,52 @@ const deriveWorkspaceAppUrl = ({
|
|
|
99
99
|
return null;
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
|
+
const deriveWorkspaceApiUrl = (backendUrl) => {
|
|
103
|
+
var _a2;
|
|
104
|
+
try {
|
|
105
|
+
const parsedUrl = new URL(backendUrl);
|
|
106
|
+
const match2 = parsedUrl.hostname.match(
|
|
107
|
+
/^(?<prefix>.+)--8000\.(?<domain>app\.athenaintel\.com|staging-app\.athenaintel\.com)$/
|
|
108
|
+
);
|
|
109
|
+
if (!((_a2 = match2 == null ? void 0 : match2.groups) == null ? void 0 : _a2.prefix) || !match2.groups.domain) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
return `${parsedUrl.protocol}//${match2.groups.prefix}--8787.${match2.groups.domain}/api/chat`;
|
|
113
|
+
} catch {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
102
117
|
function getAthenaEnvironmentUrls({
|
|
103
118
|
environment = DEFAULT_ATHENA_ENVIRONMENT
|
|
104
119
|
} = {}) {
|
|
105
120
|
return ATHENA_ENVIRONMENT_URLS[environment];
|
|
106
121
|
}
|
|
122
|
+
function deriveAthenaApiUrl({
|
|
123
|
+
backendUrl
|
|
124
|
+
}) {
|
|
125
|
+
if (!backendUrl) return null;
|
|
126
|
+
const workspaceApiUrl = deriveWorkspaceApiUrl(backendUrl);
|
|
127
|
+
if (workspaceApiUrl) return workspaceApiUrl;
|
|
128
|
+
try {
|
|
129
|
+
const parsedUrl = new URL(backendUrl);
|
|
130
|
+
if (parsedUrl.hostname === "api.athenaintel.com") {
|
|
131
|
+
return ATHENA_ENVIRONMENT_URLS.production.apiUrl;
|
|
132
|
+
}
|
|
133
|
+
if (parsedUrl.hostname === "staging-api.athenaintel.com") {
|
|
134
|
+
return ATHENA_ENVIRONMENT_URLS.staging.apiUrl;
|
|
135
|
+
}
|
|
136
|
+
if (parsedUrl.hostname === "localhost" || parsedUrl.hostname === "127.0.0.1") {
|
|
137
|
+
parsedUrl.port = "8787";
|
|
138
|
+
parsedUrl.pathname = "/api/chat";
|
|
139
|
+
parsedUrl.search = "";
|
|
140
|
+
parsedUrl.hash = "";
|
|
141
|
+
return parsedUrl.toString();
|
|
142
|
+
}
|
|
143
|
+
} catch {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
107
148
|
function deriveAthenaAppUrl({
|
|
108
149
|
apiUrl,
|
|
109
150
|
backendUrl
|
|
@@ -367,501 +408,6 @@ function useParentBridge({
|
|
|
367
408
|
function useParentAuth() {
|
|
368
409
|
return useParentBridge().token;
|
|
369
410
|
}
|
|
370
|
-
function getDefaultExportFromCjs$1(x) {
|
|
371
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
372
|
-
}
|
|
373
|
-
var secureJsonParse = { exports: {} };
|
|
374
|
-
var hasRequiredSecureJsonParse;
|
|
375
|
-
function requireSecureJsonParse() {
|
|
376
|
-
if (hasRequiredSecureJsonParse) return secureJsonParse.exports;
|
|
377
|
-
hasRequiredSecureJsonParse = 1;
|
|
378
|
-
const hasBuffer = typeof Buffer !== "undefined";
|
|
379
|
-
const suspectProtoRx = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/;
|
|
380
|
-
const suspectConstructorRx = /"(?: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*:/;
|
|
381
|
-
function _parse2(text2, reviver, options) {
|
|
382
|
-
if (options == null) {
|
|
383
|
-
if (reviver !== null && typeof reviver === "object") {
|
|
384
|
-
options = reviver;
|
|
385
|
-
reviver = void 0;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
if (hasBuffer && Buffer.isBuffer(text2)) {
|
|
389
|
-
text2 = text2.toString();
|
|
390
|
-
}
|
|
391
|
-
if (text2 && text2.charCodeAt(0) === 65279) {
|
|
392
|
-
text2 = text2.slice(1);
|
|
393
|
-
}
|
|
394
|
-
const obj = JSON.parse(text2, reviver);
|
|
395
|
-
if (obj === null || typeof obj !== "object") {
|
|
396
|
-
return obj;
|
|
397
|
-
}
|
|
398
|
-
const protoAction = options && options.protoAction || "error";
|
|
399
|
-
const constructorAction = options && options.constructorAction || "error";
|
|
400
|
-
if (protoAction === "ignore" && constructorAction === "ignore") {
|
|
401
|
-
return obj;
|
|
402
|
-
}
|
|
403
|
-
if (protoAction !== "ignore" && constructorAction !== "ignore") {
|
|
404
|
-
if (suspectProtoRx.test(text2) === false && suspectConstructorRx.test(text2) === false) {
|
|
405
|
-
return obj;
|
|
406
|
-
}
|
|
407
|
-
} else if (protoAction !== "ignore" && constructorAction === "ignore") {
|
|
408
|
-
if (suspectProtoRx.test(text2) === false) {
|
|
409
|
-
return obj;
|
|
410
|
-
}
|
|
411
|
-
} else {
|
|
412
|
-
if (suspectConstructorRx.test(text2) === false) {
|
|
413
|
-
return obj;
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
return filter(obj, { protoAction, constructorAction, safe: options && options.safe });
|
|
417
|
-
}
|
|
418
|
-
function filter(obj, { protoAction = "error", constructorAction = "error", safe } = {}) {
|
|
419
|
-
let next = [obj];
|
|
420
|
-
while (next.length) {
|
|
421
|
-
const nodes = next;
|
|
422
|
-
next = [];
|
|
423
|
-
for (const node of nodes) {
|
|
424
|
-
if (protoAction !== "ignore" && Object.prototype.hasOwnProperty.call(node, "__proto__")) {
|
|
425
|
-
if (safe === true) {
|
|
426
|
-
return null;
|
|
427
|
-
} else if (protoAction === "error") {
|
|
428
|
-
throw new SyntaxError("Object contains forbidden prototype property");
|
|
429
|
-
}
|
|
430
|
-
delete node.__proto__;
|
|
431
|
-
}
|
|
432
|
-
if (constructorAction !== "ignore" && Object.prototype.hasOwnProperty.call(node, "constructor") && node.constructor !== null && typeof node.constructor === "object" && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
|
433
|
-
if (safe === true) {
|
|
434
|
-
return null;
|
|
435
|
-
} else if (constructorAction === "error") {
|
|
436
|
-
throw new SyntaxError("Object contains forbidden prototype property");
|
|
437
|
-
}
|
|
438
|
-
delete node.constructor;
|
|
439
|
-
}
|
|
440
|
-
for (const key in node) {
|
|
441
|
-
const value = node[key];
|
|
442
|
-
if (value && typeof value === "object") {
|
|
443
|
-
next.push(value);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
return obj;
|
|
449
|
-
}
|
|
450
|
-
function parse2(text2, reviver, options) {
|
|
451
|
-
const { stackTraceLimit } = Error;
|
|
452
|
-
Error.stackTraceLimit = 0;
|
|
453
|
-
try {
|
|
454
|
-
return _parse2(text2, reviver, options);
|
|
455
|
-
} finally {
|
|
456
|
-
Error.stackTraceLimit = stackTraceLimit;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
function safeParse2(text2, reviver) {
|
|
460
|
-
const { stackTraceLimit } = Error;
|
|
461
|
-
Error.stackTraceLimit = 0;
|
|
462
|
-
try {
|
|
463
|
-
return _parse2(text2, reviver, { safe: true });
|
|
464
|
-
} catch {
|
|
465
|
-
return void 0;
|
|
466
|
-
} finally {
|
|
467
|
-
Error.stackTraceLimit = stackTraceLimit;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
secureJsonParse.exports = parse2;
|
|
471
|
-
secureJsonParse.exports.default = parse2;
|
|
472
|
-
secureJsonParse.exports.parse = parse2;
|
|
473
|
-
secureJsonParse.exports.safeParse = safeParse2;
|
|
474
|
-
secureJsonParse.exports.scan = filter;
|
|
475
|
-
return secureJsonParse.exports;
|
|
476
|
-
}
|
|
477
|
-
var secureJsonParseExports = requireSecureJsonParse();
|
|
478
|
-
const sjson = /* @__PURE__ */ getDefaultExportFromCjs$1(secureJsonParseExports);
|
|
479
|
-
function fixJson(input) {
|
|
480
|
-
const stack = ["ROOT"];
|
|
481
|
-
let lastValidIndex = -1;
|
|
482
|
-
let literalStart = null;
|
|
483
|
-
const path = [];
|
|
484
|
-
let currentKey;
|
|
485
|
-
function pushCurrentKeyToPath() {
|
|
486
|
-
if (currentKey !== void 0) {
|
|
487
|
-
path.push(JSON.parse(`"${currentKey}"`));
|
|
488
|
-
currentKey = void 0;
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
function processValueStart(char, i, swapState) {
|
|
492
|
-
switch (char) {
|
|
493
|
-
case '"': {
|
|
494
|
-
lastValidIndex = i;
|
|
495
|
-
stack.pop();
|
|
496
|
-
stack.push(swapState);
|
|
497
|
-
stack.push("INSIDE_STRING");
|
|
498
|
-
pushCurrentKeyToPath();
|
|
499
|
-
break;
|
|
500
|
-
}
|
|
501
|
-
case "f":
|
|
502
|
-
case "t":
|
|
503
|
-
case "n": {
|
|
504
|
-
lastValidIndex = i;
|
|
505
|
-
literalStart = i;
|
|
506
|
-
stack.pop();
|
|
507
|
-
stack.push(swapState);
|
|
508
|
-
stack.push("INSIDE_LITERAL");
|
|
509
|
-
break;
|
|
510
|
-
}
|
|
511
|
-
case "-": {
|
|
512
|
-
stack.pop();
|
|
513
|
-
stack.push(swapState);
|
|
514
|
-
stack.push("INSIDE_NUMBER");
|
|
515
|
-
pushCurrentKeyToPath();
|
|
516
|
-
break;
|
|
517
|
-
}
|
|
518
|
-
case "0":
|
|
519
|
-
case "1":
|
|
520
|
-
case "2":
|
|
521
|
-
case "3":
|
|
522
|
-
case "4":
|
|
523
|
-
case "5":
|
|
524
|
-
case "6":
|
|
525
|
-
case "7":
|
|
526
|
-
case "8":
|
|
527
|
-
case "9": {
|
|
528
|
-
lastValidIndex = i;
|
|
529
|
-
stack.pop();
|
|
530
|
-
stack.push(swapState);
|
|
531
|
-
stack.push("INSIDE_NUMBER");
|
|
532
|
-
pushCurrentKeyToPath();
|
|
533
|
-
break;
|
|
534
|
-
}
|
|
535
|
-
case "{": {
|
|
536
|
-
lastValidIndex = i;
|
|
537
|
-
stack.pop();
|
|
538
|
-
stack.push(swapState);
|
|
539
|
-
stack.push("INSIDE_OBJECT_START");
|
|
540
|
-
pushCurrentKeyToPath();
|
|
541
|
-
break;
|
|
542
|
-
}
|
|
543
|
-
case "[": {
|
|
544
|
-
lastValidIndex = i;
|
|
545
|
-
stack.pop();
|
|
546
|
-
stack.push(swapState);
|
|
547
|
-
stack.push("INSIDE_ARRAY_START");
|
|
548
|
-
pushCurrentKeyToPath();
|
|
549
|
-
break;
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
function processAfterObjectValue(char, i) {
|
|
554
|
-
switch (char) {
|
|
555
|
-
case ",": {
|
|
556
|
-
stack.pop();
|
|
557
|
-
stack.push("INSIDE_OBJECT_AFTER_COMMA");
|
|
558
|
-
break;
|
|
559
|
-
}
|
|
560
|
-
case "}": {
|
|
561
|
-
lastValidIndex = i;
|
|
562
|
-
stack.pop();
|
|
563
|
-
currentKey = path.pop();
|
|
564
|
-
break;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
function processAfterArrayValue(char, i) {
|
|
569
|
-
switch (char) {
|
|
570
|
-
case ",": {
|
|
571
|
-
stack.pop();
|
|
572
|
-
stack.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
573
|
-
currentKey = (Number(currentKey) + 1).toString();
|
|
574
|
-
break;
|
|
575
|
-
}
|
|
576
|
-
case "]": {
|
|
577
|
-
lastValidIndex = i;
|
|
578
|
-
stack.pop();
|
|
579
|
-
currentKey = path.pop();
|
|
580
|
-
break;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
for (let i = 0; i < input.length; i++) {
|
|
585
|
-
const char = input[i];
|
|
586
|
-
const currentState = stack[stack.length - 1];
|
|
587
|
-
switch (currentState) {
|
|
588
|
-
case "ROOT":
|
|
589
|
-
processValueStart(char, i, "FINISH");
|
|
590
|
-
break;
|
|
591
|
-
case "INSIDE_OBJECT_START": {
|
|
592
|
-
switch (char) {
|
|
593
|
-
case '"': {
|
|
594
|
-
stack.pop();
|
|
595
|
-
stack.push("INSIDE_OBJECT_KEY");
|
|
596
|
-
currentKey = "";
|
|
597
|
-
break;
|
|
598
|
-
}
|
|
599
|
-
case "}": {
|
|
600
|
-
lastValidIndex = i;
|
|
601
|
-
stack.pop();
|
|
602
|
-
currentKey = path.pop();
|
|
603
|
-
break;
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
break;
|
|
607
|
-
}
|
|
608
|
-
case "INSIDE_OBJECT_AFTER_COMMA": {
|
|
609
|
-
switch (char) {
|
|
610
|
-
case '"': {
|
|
611
|
-
stack.pop();
|
|
612
|
-
stack.push("INSIDE_OBJECT_KEY");
|
|
613
|
-
currentKey = "";
|
|
614
|
-
break;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
break;
|
|
618
|
-
}
|
|
619
|
-
case "INSIDE_OBJECT_KEY": {
|
|
620
|
-
switch (char) {
|
|
621
|
-
case '"': {
|
|
622
|
-
stack.pop();
|
|
623
|
-
stack.push("INSIDE_OBJECT_AFTER_KEY");
|
|
624
|
-
break;
|
|
625
|
-
}
|
|
626
|
-
case "\\": {
|
|
627
|
-
stack.push("INSIDE_STRING_ESCAPE");
|
|
628
|
-
currentKey += char;
|
|
629
|
-
break;
|
|
630
|
-
}
|
|
631
|
-
default: {
|
|
632
|
-
currentKey += char;
|
|
633
|
-
break;
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
break;
|
|
637
|
-
}
|
|
638
|
-
case "INSIDE_OBJECT_AFTER_KEY": {
|
|
639
|
-
switch (char) {
|
|
640
|
-
case ":": {
|
|
641
|
-
stack.pop();
|
|
642
|
-
stack.push("INSIDE_OBJECT_BEFORE_VALUE");
|
|
643
|
-
break;
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
break;
|
|
647
|
-
}
|
|
648
|
-
case "INSIDE_OBJECT_BEFORE_VALUE": {
|
|
649
|
-
processValueStart(char, i, "INSIDE_OBJECT_AFTER_VALUE");
|
|
650
|
-
break;
|
|
651
|
-
}
|
|
652
|
-
case "INSIDE_OBJECT_AFTER_VALUE": {
|
|
653
|
-
processAfterObjectValue(char, i);
|
|
654
|
-
break;
|
|
655
|
-
}
|
|
656
|
-
case "INSIDE_STRING": {
|
|
657
|
-
switch (char) {
|
|
658
|
-
case '"': {
|
|
659
|
-
stack.pop();
|
|
660
|
-
lastValidIndex = i;
|
|
661
|
-
currentKey = path.pop();
|
|
662
|
-
break;
|
|
663
|
-
}
|
|
664
|
-
case "\\": {
|
|
665
|
-
stack.push("INSIDE_STRING_ESCAPE");
|
|
666
|
-
break;
|
|
667
|
-
}
|
|
668
|
-
default: {
|
|
669
|
-
lastValidIndex = i;
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
break;
|
|
673
|
-
}
|
|
674
|
-
case "INSIDE_ARRAY_START": {
|
|
675
|
-
switch (char) {
|
|
676
|
-
case "]": {
|
|
677
|
-
lastValidIndex = i;
|
|
678
|
-
stack.pop();
|
|
679
|
-
currentKey = path.pop();
|
|
680
|
-
break;
|
|
681
|
-
}
|
|
682
|
-
default: {
|
|
683
|
-
lastValidIndex = i;
|
|
684
|
-
currentKey = "0";
|
|
685
|
-
processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
|
|
686
|
-
break;
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
break;
|
|
690
|
-
}
|
|
691
|
-
case "INSIDE_ARRAY_AFTER_VALUE": {
|
|
692
|
-
switch (char) {
|
|
693
|
-
case ",": {
|
|
694
|
-
stack.pop();
|
|
695
|
-
stack.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
696
|
-
currentKey = (Number(currentKey) + 1).toString();
|
|
697
|
-
break;
|
|
698
|
-
}
|
|
699
|
-
case "]": {
|
|
700
|
-
lastValidIndex = i;
|
|
701
|
-
stack.pop();
|
|
702
|
-
currentKey = path.pop();
|
|
703
|
-
break;
|
|
704
|
-
}
|
|
705
|
-
default: {
|
|
706
|
-
lastValidIndex = i;
|
|
707
|
-
break;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
break;
|
|
711
|
-
}
|
|
712
|
-
case "INSIDE_ARRAY_AFTER_COMMA": {
|
|
713
|
-
processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
|
|
714
|
-
break;
|
|
715
|
-
}
|
|
716
|
-
case "INSIDE_STRING_ESCAPE": {
|
|
717
|
-
stack.pop();
|
|
718
|
-
if (stack[stack.length - 1] === "INSIDE_STRING") {
|
|
719
|
-
lastValidIndex = i;
|
|
720
|
-
} else if (stack[stack.length - 1] === "INSIDE_OBJECT_KEY") {
|
|
721
|
-
currentKey += char;
|
|
722
|
-
}
|
|
723
|
-
break;
|
|
724
|
-
}
|
|
725
|
-
case "INSIDE_NUMBER": {
|
|
726
|
-
switch (char) {
|
|
727
|
-
case "0":
|
|
728
|
-
case "1":
|
|
729
|
-
case "2":
|
|
730
|
-
case "3":
|
|
731
|
-
case "4":
|
|
732
|
-
case "5":
|
|
733
|
-
case "6":
|
|
734
|
-
case "7":
|
|
735
|
-
case "8":
|
|
736
|
-
case "9": {
|
|
737
|
-
lastValidIndex = i;
|
|
738
|
-
break;
|
|
739
|
-
}
|
|
740
|
-
case "e":
|
|
741
|
-
case "E":
|
|
742
|
-
case "-":
|
|
743
|
-
case ".": {
|
|
744
|
-
break;
|
|
745
|
-
}
|
|
746
|
-
case ",": {
|
|
747
|
-
stack.pop();
|
|
748
|
-
currentKey = path.pop();
|
|
749
|
-
if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
|
|
750
|
-
processAfterArrayValue(char, i);
|
|
751
|
-
}
|
|
752
|
-
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
|
|
753
|
-
processAfterObjectValue(char, i);
|
|
754
|
-
}
|
|
755
|
-
break;
|
|
756
|
-
}
|
|
757
|
-
case "}": {
|
|
758
|
-
stack.pop();
|
|
759
|
-
currentKey = path.pop();
|
|
760
|
-
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
|
|
761
|
-
processAfterObjectValue(char, i);
|
|
762
|
-
}
|
|
763
|
-
break;
|
|
764
|
-
}
|
|
765
|
-
case "]": {
|
|
766
|
-
stack.pop();
|
|
767
|
-
currentKey = path.pop();
|
|
768
|
-
if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
|
|
769
|
-
processAfterArrayValue(char, i);
|
|
770
|
-
}
|
|
771
|
-
break;
|
|
772
|
-
}
|
|
773
|
-
default: {
|
|
774
|
-
stack.pop();
|
|
775
|
-
currentKey = path.pop();
|
|
776
|
-
break;
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
break;
|
|
780
|
-
}
|
|
781
|
-
case "INSIDE_LITERAL": {
|
|
782
|
-
const partialLiteral = input.substring(literalStart, i + 1);
|
|
783
|
-
if (!"false".startsWith(partialLiteral) && !"true".startsWith(partialLiteral) && !"null".startsWith(partialLiteral)) {
|
|
784
|
-
stack.pop();
|
|
785
|
-
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
|
|
786
|
-
processAfterObjectValue(char, i);
|
|
787
|
-
} else if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
|
|
788
|
-
processAfterArrayValue(char, i);
|
|
789
|
-
}
|
|
790
|
-
} else {
|
|
791
|
-
lastValidIndex = i;
|
|
792
|
-
}
|
|
793
|
-
break;
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
let result = input.slice(0, lastValidIndex + 1);
|
|
798
|
-
for (let i = stack.length - 1; i >= 0; i--) {
|
|
799
|
-
const state = stack[i];
|
|
800
|
-
switch (state) {
|
|
801
|
-
case "INSIDE_STRING": {
|
|
802
|
-
result += '"';
|
|
803
|
-
break;
|
|
804
|
-
}
|
|
805
|
-
case "INSIDE_OBJECT_KEY":
|
|
806
|
-
case "INSIDE_OBJECT_AFTER_KEY":
|
|
807
|
-
case "INSIDE_OBJECT_AFTER_COMMA":
|
|
808
|
-
case "INSIDE_OBJECT_START":
|
|
809
|
-
case "INSIDE_OBJECT_BEFORE_VALUE":
|
|
810
|
-
case "INSIDE_OBJECT_AFTER_VALUE": {
|
|
811
|
-
result += "}";
|
|
812
|
-
break;
|
|
813
|
-
}
|
|
814
|
-
case "INSIDE_ARRAY_START":
|
|
815
|
-
case "INSIDE_ARRAY_AFTER_COMMA":
|
|
816
|
-
case "INSIDE_ARRAY_AFTER_VALUE": {
|
|
817
|
-
result += "]";
|
|
818
|
-
break;
|
|
819
|
-
}
|
|
820
|
-
case "INSIDE_LITERAL": {
|
|
821
|
-
const partialLiteral = input.substring(literalStart, input.length);
|
|
822
|
-
if ("true".startsWith(partialLiteral)) {
|
|
823
|
-
result += "true".slice(partialLiteral.length);
|
|
824
|
-
} else if ("false".startsWith(partialLiteral)) {
|
|
825
|
-
result += "false".slice(partialLiteral.length);
|
|
826
|
-
} else if ("null".startsWith(partialLiteral)) {
|
|
827
|
-
result += "null".slice(partialLiteral.length);
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
return [result, path];
|
|
833
|
-
}
|
|
834
|
-
const PARTIAL_JSON_OBJECT_META_SYMBOL = Symbol("aui.parse-partial-json-object.meta");
|
|
835
|
-
const parsePartialJsonObject = (json) => {
|
|
836
|
-
if (json.length === 0)
|
|
837
|
-
return {
|
|
838
|
-
[PARTIAL_JSON_OBJECT_META_SYMBOL]: { state: "partial", partialPath: [] }
|
|
839
|
-
};
|
|
840
|
-
try {
|
|
841
|
-
const res = sjson.parse(json);
|
|
842
|
-
if (typeof res !== "object" || res === null)
|
|
843
|
-
throw new Error("argsText is expected to be an object");
|
|
844
|
-
res[PARTIAL_JSON_OBJECT_META_SYMBOL] = {
|
|
845
|
-
state: "complete",
|
|
846
|
-
partialPath: []
|
|
847
|
-
};
|
|
848
|
-
return res;
|
|
849
|
-
} catch {
|
|
850
|
-
try {
|
|
851
|
-
const [fixedJson, partialPath] = fixJson(json);
|
|
852
|
-
const res = sjson.parse(fixedJson);
|
|
853
|
-
if (typeof res !== "object" || res === null)
|
|
854
|
-
throw new Error("argsText is expected to be an object");
|
|
855
|
-
res[PARTIAL_JSON_OBJECT_META_SYMBOL] = {
|
|
856
|
-
state: "partial",
|
|
857
|
-
partialPath
|
|
858
|
-
};
|
|
859
|
-
return res;
|
|
860
|
-
} catch {
|
|
861
|
-
return void 0;
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
};
|
|
865
411
|
const promiseWithResolvers = () => {
|
|
866
412
|
let resolve;
|
|
867
413
|
let reject;
|
|
@@ -869,9 +415,12 @@ const promiseWithResolvers = () => {
|
|
|
869
415
|
resolve = res;
|
|
870
416
|
reject = rej;
|
|
871
417
|
});
|
|
872
|
-
if (!resolve || !reject)
|
|
873
|
-
|
|
874
|
-
|
|
418
|
+
if (!resolve || !reject) throw new Error("Failed to create promise");
|
|
419
|
+
return {
|
|
420
|
+
promise,
|
|
421
|
+
resolve,
|
|
422
|
+
reject
|
|
423
|
+
};
|
|
875
424
|
};
|
|
876
425
|
const createMergeStream = () => {
|
|
877
426
|
const list2 = [];
|
|
@@ -879,77 +428,66 @@ const createMergeStream = () => {
|
|
|
879
428
|
let controller;
|
|
880
429
|
let currentPull;
|
|
881
430
|
const handlePull = (item) => {
|
|
882
|
-
if (!item.promise) {
|
|
883
|
-
item.promise =
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
currentPull = void 0;
|
|
895
|
-
}).catch((e) => {
|
|
896
|
-
console.error(e);
|
|
897
|
-
list2.forEach((item2) => {
|
|
898
|
-
item2.reader.cancel();
|
|
899
|
-
});
|
|
900
|
-
list2.length = 0;
|
|
901
|
-
controller.error(e);
|
|
902
|
-
currentPull == null ? void 0 : currentPull.reject(e);
|
|
903
|
-
currentPull = void 0;
|
|
904
|
-
});
|
|
905
|
-
}
|
|
906
|
-
};
|
|
907
|
-
const readable = new ReadableStream({
|
|
908
|
-
start(c) {
|
|
909
|
-
controller = c;
|
|
910
|
-
},
|
|
911
|
-
pull() {
|
|
912
|
-
currentPull = promiseWithResolvers();
|
|
913
|
-
list2.forEach((item) => {
|
|
914
|
-
handlePull(item);
|
|
915
|
-
});
|
|
916
|
-
return currentPull.promise;
|
|
917
|
-
},
|
|
918
|
-
cancel() {
|
|
919
|
-
list2.forEach((item) => {
|
|
920
|
-
item.reader.cancel();
|
|
431
|
+
if (!item.promise) item.promise = item.reader.read().then(({ done, value }) => {
|
|
432
|
+
item.promise = void 0;
|
|
433
|
+
if (done) {
|
|
434
|
+
list2.splice(list2.indexOf(item), 1);
|
|
435
|
+
if (sealed && list2.length === 0) controller.close();
|
|
436
|
+
} else controller.enqueue(value);
|
|
437
|
+
currentPull == null ? void 0 : currentPull.resolve();
|
|
438
|
+
currentPull = void 0;
|
|
439
|
+
}).catch((e) => {
|
|
440
|
+
console.error(e);
|
|
441
|
+
list2.forEach((item2) => {
|
|
442
|
+
item2.reader.cancel();
|
|
921
443
|
});
|
|
922
444
|
list2.length = 0;
|
|
923
|
-
|
|
924
|
-
|
|
445
|
+
controller.error(e);
|
|
446
|
+
currentPull == null ? void 0 : currentPull.reject(e);
|
|
447
|
+
currentPull = void 0;
|
|
448
|
+
});
|
|
449
|
+
};
|
|
925
450
|
return {
|
|
926
|
-
readable
|
|
451
|
+
readable: new ReadableStream({
|
|
452
|
+
start(c) {
|
|
453
|
+
controller = c;
|
|
454
|
+
},
|
|
455
|
+
pull() {
|
|
456
|
+
currentPull = promiseWithResolvers();
|
|
457
|
+
list2.forEach((item) => {
|
|
458
|
+
handlePull(item);
|
|
459
|
+
});
|
|
460
|
+
return currentPull.promise;
|
|
461
|
+
},
|
|
462
|
+
cancel() {
|
|
463
|
+
list2.forEach((item) => {
|
|
464
|
+
item.reader.cancel();
|
|
465
|
+
});
|
|
466
|
+
list2.length = 0;
|
|
467
|
+
}
|
|
468
|
+
}),
|
|
927
469
|
isSealed() {
|
|
928
470
|
return sealed;
|
|
929
471
|
},
|
|
930
472
|
seal() {
|
|
931
473
|
sealed = true;
|
|
932
|
-
if (list2.length === 0)
|
|
933
|
-
controller.close();
|
|
474
|
+
if (list2.length === 0) controller.close();
|
|
934
475
|
},
|
|
935
476
|
addStream(stream) {
|
|
936
|
-
if (sealed)
|
|
937
|
-
throw new Error("Cannot add streams after the run callback has settled.");
|
|
477
|
+
if (sealed) throw new Error("Cannot add streams after the run callback has settled.");
|
|
938
478
|
const item = { reader: stream.getReader() };
|
|
939
479
|
list2.push(item);
|
|
940
480
|
handlePull(item);
|
|
941
481
|
},
|
|
942
482
|
enqueue(chunk) {
|
|
943
|
-
this.addStream(new ReadableStream({
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
}
|
|
948
|
-
}));
|
|
483
|
+
this.addStream(new ReadableStream({ start(c) {
|
|
484
|
+
c.enqueue(chunk);
|
|
485
|
+
c.close();
|
|
486
|
+
} }));
|
|
949
487
|
}
|
|
950
488
|
};
|
|
951
489
|
};
|
|
952
|
-
|
|
490
|
+
var TextStreamControllerImpl = class {
|
|
953
491
|
constructor(controller) {
|
|
954
492
|
__publicField(this, "_controller");
|
|
955
493
|
__publicField(this, "_isClosed", false);
|
|
@@ -968,8 +506,7 @@ class TextStreamControllerImpl {
|
|
|
968
506
|
return this;
|
|
969
507
|
}
|
|
970
508
|
close() {
|
|
971
|
-
if (this._isClosed)
|
|
972
|
-
return;
|
|
509
|
+
if (this._isClosed) return;
|
|
973
510
|
this._isClosed = true;
|
|
974
511
|
this._controller.enqueue({
|
|
975
512
|
type: "part-finish",
|
|
@@ -977,7 +514,7 @@ class TextStreamControllerImpl {
|
|
|
977
514
|
});
|
|
978
515
|
this._controller.close();
|
|
979
516
|
}
|
|
980
|
-
}
|
|
517
|
+
};
|
|
981
518
|
const createTextStream = (readable) => {
|
|
982
519
|
return new ReadableStream({
|
|
983
520
|
start(c) {
|
|
@@ -996,51 +533,42 @@ const createTextStream = (readable) => {
|
|
|
996
533
|
};
|
|
997
534
|
const createTextStreamController = () => {
|
|
998
535
|
let controller;
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
}
|
|
1003
|
-
});
|
|
1004
|
-
return [stream, controller];
|
|
536
|
+
return [createTextStream({ start(c) {
|
|
537
|
+
controller = c;
|
|
538
|
+
} }), controller];
|
|
1005
539
|
};
|
|
1006
|
-
|
|
540
|
+
var ToolCallStreamControllerImpl = class {
|
|
1007
541
|
constructor(_controller) {
|
|
1008
542
|
__publicField(this, "_controller");
|
|
1009
543
|
__publicField(this, "_isClosed", false);
|
|
1010
544
|
__publicField(this, "_mergeTask");
|
|
1011
545
|
__publicField(this, "_argsTextController");
|
|
1012
546
|
this._controller = _controller;
|
|
1013
|
-
const stream = createTextStream({
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
}
|
|
1017
|
-
});
|
|
547
|
+
const stream = createTextStream({ start: (c) => {
|
|
548
|
+
this._argsTextController = c;
|
|
549
|
+
} });
|
|
1018
550
|
let hasArgsText = false;
|
|
1019
|
-
this._mergeTask = stream.pipeTo(new WritableStream({
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
break;
|
|
1039
|
-
default:
|
|
1040
|
-
throw new Error(`Unexpected chunk type: ${chunk.type}`);
|
|
1041
|
-
}
|
|
551
|
+
this._mergeTask = stream.pipeTo(new WritableStream({ write: (chunk) => {
|
|
552
|
+
switch (chunk.type) {
|
|
553
|
+
case "text-delta":
|
|
554
|
+
hasArgsText = true;
|
|
555
|
+
this._controller.enqueue(chunk);
|
|
556
|
+
break;
|
|
557
|
+
case "part-finish":
|
|
558
|
+
if (!hasArgsText) this._controller.enqueue({
|
|
559
|
+
type: "text-delta",
|
|
560
|
+
textDelta: "{}",
|
|
561
|
+
path: []
|
|
562
|
+
});
|
|
563
|
+
this._controller.enqueue({
|
|
564
|
+
type: "tool-call-args-text-finish",
|
|
565
|
+
path: []
|
|
566
|
+
});
|
|
567
|
+
break;
|
|
568
|
+
default:
|
|
569
|
+
throw new Error(`Unexpected chunk type: ${chunk.type}`);
|
|
1042
570
|
}
|
|
1043
|
-
}));
|
|
571
|
+
} }));
|
|
1044
572
|
}
|
|
1045
573
|
get argsText() {
|
|
1046
574
|
return this._argsTextController;
|
|
@@ -1059,8 +587,7 @@ class ToolCallStreamControllerImpl {
|
|
|
1059
587
|
});
|
|
1060
588
|
}
|
|
1061
589
|
async close() {
|
|
1062
|
-
if (this._isClosed)
|
|
1063
|
-
return;
|
|
590
|
+
if (this._isClosed) return;
|
|
1064
591
|
this._isClosed = true;
|
|
1065
592
|
this._argsTextController.close();
|
|
1066
593
|
await this._mergeTask;
|
|
@@ -1070,7 +597,7 @@ class ToolCallStreamControllerImpl {
|
|
|
1070
597
|
});
|
|
1071
598
|
this._controller.close();
|
|
1072
599
|
}
|
|
1073
|
-
}
|
|
600
|
+
};
|
|
1074
601
|
const createToolCallStream = (readable) => {
|
|
1075
602
|
return new ReadableStream({
|
|
1076
603
|
start(c) {
|
|
@@ -1089,85 +616,72 @@ const createToolCallStream = (readable) => {
|
|
|
1089
616
|
};
|
|
1090
617
|
const createToolCallStreamController = () => {
|
|
1091
618
|
let controller;
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
}
|
|
1096
|
-
});
|
|
1097
|
-
return [stream, controller];
|
|
619
|
+
return [createToolCallStream({ start(c) {
|
|
620
|
+
controller = c;
|
|
621
|
+
} }), controller];
|
|
1098
622
|
};
|
|
1099
|
-
|
|
623
|
+
var Counter = class {
|
|
1100
624
|
constructor() {
|
|
1101
625
|
__publicField(this, "value", -1);
|
|
1102
626
|
}
|
|
1103
627
|
up() {
|
|
1104
628
|
return ++this.value;
|
|
1105
629
|
}
|
|
1106
|
-
}
|
|
1107
|
-
|
|
630
|
+
};
|
|
631
|
+
var PathAppendEncoder = class extends TransformStream {
|
|
1108
632
|
constructor(idx) {
|
|
1109
|
-
super({
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
}
|
|
1116
|
-
});
|
|
633
|
+
super({ transform(chunk, controller) {
|
|
634
|
+
controller.enqueue({
|
|
635
|
+
...chunk,
|
|
636
|
+
path: [idx, ...chunk.path]
|
|
637
|
+
});
|
|
638
|
+
} });
|
|
1117
639
|
}
|
|
1118
|
-
}
|
|
1119
|
-
class
|
|
640
|
+
};
|
|
641
|
+
(class extends TransformStream {
|
|
1120
642
|
constructor(idx) {
|
|
1121
|
-
super({
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
});
|
|
1130
|
-
}
|
|
1131
|
-
});
|
|
643
|
+
super({ transform(chunk, controller) {
|
|
644
|
+
const { path: [idx2, ...path] } = chunk;
|
|
645
|
+
if (idx !== idx2) throw new Error(`Path mismatch: expected ${idx}, got ${idx2}`);
|
|
646
|
+
controller.enqueue({
|
|
647
|
+
...chunk,
|
|
648
|
+
path
|
|
649
|
+
});
|
|
650
|
+
} });
|
|
1132
651
|
}
|
|
1133
|
-
}
|
|
1134
|
-
|
|
652
|
+
});
|
|
653
|
+
var PathMergeEncoder = class extends TransformStream {
|
|
1135
654
|
constructor(counter) {
|
|
1136
655
|
const innerCounter = new Counter();
|
|
1137
656
|
const mapping = /* @__PURE__ */ new Map();
|
|
1138
|
-
super({
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
if (idx === void 0) {
|
|
1145
|
-
controller.enqueue(chunk);
|
|
1146
|
-
return;
|
|
1147
|
-
}
|
|
1148
|
-
const mappedIdx = mapping.get(idx);
|
|
1149
|
-
if (mappedIdx === void 0)
|
|
1150
|
-
throw new Error("Path not found");
|
|
1151
|
-
controller.enqueue({
|
|
1152
|
-
...chunk,
|
|
1153
|
-
path: [mappedIdx, ...path]
|
|
1154
|
-
});
|
|
657
|
+
super({ transform(chunk, controller) {
|
|
658
|
+
if (chunk.type === "part-start" && chunk.path.length === 0) mapping.set(innerCounter.up(), counter.up());
|
|
659
|
+
const [idx, ...path] = chunk.path;
|
|
660
|
+
if (idx === void 0) {
|
|
661
|
+
controller.enqueue(chunk);
|
|
662
|
+
return;
|
|
1155
663
|
}
|
|
1156
|
-
|
|
664
|
+
const mappedIdx = mapping.get(idx);
|
|
665
|
+
if (mappedIdx === void 0) throw new Error("Path not found");
|
|
666
|
+
controller.enqueue({
|
|
667
|
+
...chunk,
|
|
668
|
+
path: [mappedIdx, ...path]
|
|
669
|
+
});
|
|
670
|
+
} });
|
|
1157
671
|
}
|
|
1158
|
-
}
|
|
672
|
+
};
|
|
1159
673
|
let customAlphabet = (alphabet, defaultSize = 21) => {
|
|
1160
674
|
return (size2 = defaultSize) => {
|
|
1161
675
|
let id = "";
|
|
1162
676
|
let i = size2 | 0;
|
|
1163
|
-
while (i--) {
|
|
677
|
+
while (i-- > 0) {
|
|
1164
678
|
id += alphabet[Math.random() * alphabet.length | 0];
|
|
1165
679
|
}
|
|
1166
680
|
return id;
|
|
1167
681
|
};
|
|
1168
682
|
};
|
|
1169
683
|
const generateId = customAlphabet("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 7);
|
|
1170
|
-
|
|
684
|
+
var AssistantStreamControllerImpl = class AssistantStreamControllerImpl2 {
|
|
1171
685
|
constructor(state) {
|
|
1172
686
|
__publicField(this, "_state");
|
|
1173
687
|
__publicField(this, "_parentId");
|
|
@@ -1202,32 +716,30 @@ class AssistantStreamControllerImpl {
|
|
|
1202
716
|
}
|
|
1203
717
|
appendText(textDelta) {
|
|
1204
718
|
var _a2;
|
|
1205
|
-
if (((_a2 = this._state.append) == null ? void 0 : _a2.kind) !== "text") {
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
}
|
|
719
|
+
if (((_a2 = this._state.append) == null ? void 0 : _a2.kind) !== "text" || this._state.append.parentId !== this._parentId) this._state.append = {
|
|
720
|
+
kind: "text",
|
|
721
|
+
parentId: this._parentId,
|
|
722
|
+
controller: this.addTextPart()
|
|
723
|
+
};
|
|
1211
724
|
this._state.append.controller.append(textDelta);
|
|
1212
725
|
}
|
|
1213
726
|
appendReasoning(textDelta) {
|
|
1214
727
|
var _a2;
|
|
1215
|
-
if (((_a2 = this._state.append) == null ? void 0 : _a2.kind) !== "reasoning") {
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
}
|
|
728
|
+
if (((_a2 = this._state.append) == null ? void 0 : _a2.kind) !== "reasoning" || this._state.append.parentId !== this._parentId) this._state.append = {
|
|
729
|
+
kind: "reasoning",
|
|
730
|
+
parentId: this._parentId,
|
|
731
|
+
controller: this.addReasoningPart()
|
|
732
|
+
};
|
|
1221
733
|
this._state.append.controller.append(textDelta);
|
|
1222
734
|
}
|
|
1223
735
|
addTextPart() {
|
|
1224
736
|
const [stream, controller] = createTextStreamController();
|
|
1225
|
-
this._addPart({ type: "text" }, stream);
|
|
737
|
+
this._addPart(this._withParentIdOption({ type: "text" }), stream);
|
|
1226
738
|
return controller;
|
|
1227
739
|
}
|
|
1228
740
|
addReasoningPart() {
|
|
1229
741
|
const [stream, controller] = createTextStreamController();
|
|
1230
|
-
this._addPart({ type: "reasoning" }, stream);
|
|
742
|
+
this._addPart(this._withParentIdOption({ type: "reasoning" }), stream);
|
|
1231
743
|
return controller;
|
|
1232
744
|
}
|
|
1233
745
|
addToolCallPart(options) {
|
|
@@ -1249,23 +761,24 @@ class AssistantStreamControllerImpl {
|
|
|
1249
761
|
controller.argsText.append(JSON.stringify(opt.args));
|
|
1250
762
|
controller.argsText.close();
|
|
1251
763
|
}
|
|
1252
|
-
if (opt.response !== void 0)
|
|
1253
|
-
controller.setResponse(opt.response);
|
|
1254
|
-
}
|
|
764
|
+
if (opt.response !== void 0) controller.setResponse(opt.response);
|
|
1255
765
|
return controller;
|
|
1256
766
|
}
|
|
1257
767
|
_finishedPartStream() {
|
|
1258
|
-
return new ReadableStream({
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
}
|
|
1263
|
-
|
|
768
|
+
return new ReadableStream({ start(controller) {
|
|
769
|
+
controller.enqueue({
|
|
770
|
+
type: "part-finish",
|
|
771
|
+
path: []
|
|
772
|
+
});
|
|
773
|
+
controller.close();
|
|
774
|
+
} });
|
|
1264
775
|
}
|
|
1265
776
|
_withParentIdOption(options) {
|
|
1266
|
-
if (!this._parentId)
|
|
1267
|
-
|
|
1268
|
-
|
|
777
|
+
if (!this._parentId) return options;
|
|
778
|
+
return {
|
|
779
|
+
...options,
|
|
780
|
+
parentId: this._parentId
|
|
781
|
+
};
|
|
1269
782
|
}
|
|
1270
783
|
appendSource(options) {
|
|
1271
784
|
this._addPart(this._withParentIdOption(options), this._finishedPartStream());
|
|
@@ -1278,12 +791,10 @@ class AssistantStreamControllerImpl {
|
|
|
1278
791
|
}
|
|
1279
792
|
enqueue(chunk) {
|
|
1280
793
|
this._state.merger.enqueue(chunk);
|
|
1281
|
-
if (chunk.type === "part-start" && chunk.path.length === 0)
|
|
1282
|
-
this._state.contentCounter.up();
|
|
1283
|
-
}
|
|
794
|
+
if (chunk.type === "part-start" && chunk.path.length === 0) this._state.contentCounter.up();
|
|
1284
795
|
}
|
|
1285
796
|
withParentId(parentId) {
|
|
1286
|
-
const controller = new
|
|
797
|
+
const controller = new AssistantStreamControllerImpl2(this._state);
|
|
1287
798
|
controller._parentId = parentId;
|
|
1288
799
|
return controller;
|
|
1289
800
|
}
|
|
@@ -1293,30 +804,449 @@ class AssistantStreamControllerImpl {
|
|
|
1293
804
|
this._state.merger.seal();
|
|
1294
805
|
(_d = (_c = this._state).closeSubscriber) == null ? void 0 : _d.call(_c);
|
|
1295
806
|
}
|
|
1296
|
-
}
|
|
807
|
+
};
|
|
1297
808
|
function createAssistantStream(callback) {
|
|
1298
809
|
const controller = new AssistantStreamControllerImpl();
|
|
1299
810
|
const runTask = async () => {
|
|
1300
811
|
try {
|
|
1301
812
|
await callback(controller);
|
|
1302
813
|
} catch (e) {
|
|
1303
|
-
if (!controller.__internal_isClosed) {
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
});
|
|
1309
|
-
}
|
|
814
|
+
if (!controller.__internal_isClosed) controller.enqueue({
|
|
815
|
+
type: "error",
|
|
816
|
+
path: [],
|
|
817
|
+
error: String(e)
|
|
818
|
+
});
|
|
1310
819
|
throw e;
|
|
1311
820
|
} finally {
|
|
1312
|
-
if (!controller.__internal_isClosed)
|
|
1313
|
-
controller.close();
|
|
1314
|
-
}
|
|
821
|
+
if (!controller.__internal_isClosed) controller.close();
|
|
1315
822
|
}
|
|
1316
823
|
};
|
|
1317
824
|
runTask();
|
|
1318
825
|
return controller.__internal_getReadable();
|
|
1319
826
|
}
|
|
827
|
+
function fixJson(input) {
|
|
828
|
+
const stack = ["ROOT"];
|
|
829
|
+
let lastValidIndex = -1;
|
|
830
|
+
let literalStart = null;
|
|
831
|
+
const path = [];
|
|
832
|
+
let currentKey;
|
|
833
|
+
function pushCurrentKeyToPath() {
|
|
834
|
+
if (currentKey !== void 0) {
|
|
835
|
+
path.push(JSON.parse(`"${currentKey}"`));
|
|
836
|
+
currentKey = void 0;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
function processValueStart(char, i, swapState) {
|
|
840
|
+
switch (char) {
|
|
841
|
+
case '"':
|
|
842
|
+
lastValidIndex = i;
|
|
843
|
+
stack.pop();
|
|
844
|
+
stack.push(swapState);
|
|
845
|
+
stack.push("INSIDE_STRING");
|
|
846
|
+
pushCurrentKeyToPath();
|
|
847
|
+
break;
|
|
848
|
+
case "f":
|
|
849
|
+
case "t":
|
|
850
|
+
case "n":
|
|
851
|
+
lastValidIndex = i;
|
|
852
|
+
literalStart = i;
|
|
853
|
+
stack.pop();
|
|
854
|
+
stack.push(swapState);
|
|
855
|
+
stack.push("INSIDE_LITERAL");
|
|
856
|
+
break;
|
|
857
|
+
case "-":
|
|
858
|
+
stack.pop();
|
|
859
|
+
stack.push(swapState);
|
|
860
|
+
stack.push("INSIDE_NUMBER");
|
|
861
|
+
pushCurrentKeyToPath();
|
|
862
|
+
break;
|
|
863
|
+
case "0":
|
|
864
|
+
case "1":
|
|
865
|
+
case "2":
|
|
866
|
+
case "3":
|
|
867
|
+
case "4":
|
|
868
|
+
case "5":
|
|
869
|
+
case "6":
|
|
870
|
+
case "7":
|
|
871
|
+
case "8":
|
|
872
|
+
case "9":
|
|
873
|
+
lastValidIndex = i;
|
|
874
|
+
stack.pop();
|
|
875
|
+
stack.push(swapState);
|
|
876
|
+
stack.push("INSIDE_NUMBER");
|
|
877
|
+
pushCurrentKeyToPath();
|
|
878
|
+
break;
|
|
879
|
+
case "{":
|
|
880
|
+
lastValidIndex = i;
|
|
881
|
+
stack.pop();
|
|
882
|
+
stack.push(swapState);
|
|
883
|
+
stack.push("INSIDE_OBJECT_START");
|
|
884
|
+
pushCurrentKeyToPath();
|
|
885
|
+
break;
|
|
886
|
+
case "[":
|
|
887
|
+
lastValidIndex = i;
|
|
888
|
+
stack.pop();
|
|
889
|
+
stack.push(swapState);
|
|
890
|
+
stack.push("INSIDE_ARRAY_START");
|
|
891
|
+
pushCurrentKeyToPath();
|
|
892
|
+
break;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
function processAfterObjectValue(char, i) {
|
|
896
|
+
switch (char) {
|
|
897
|
+
case ",":
|
|
898
|
+
stack.pop();
|
|
899
|
+
stack.push("INSIDE_OBJECT_AFTER_COMMA");
|
|
900
|
+
break;
|
|
901
|
+
case "}":
|
|
902
|
+
lastValidIndex = i;
|
|
903
|
+
stack.pop();
|
|
904
|
+
currentKey = path.pop();
|
|
905
|
+
break;
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
function processAfterArrayValue(char, i) {
|
|
909
|
+
switch (char) {
|
|
910
|
+
case ",":
|
|
911
|
+
stack.pop();
|
|
912
|
+
stack.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
913
|
+
currentKey = (Number(currentKey) + 1).toString();
|
|
914
|
+
break;
|
|
915
|
+
case "]":
|
|
916
|
+
lastValidIndex = i;
|
|
917
|
+
stack.pop();
|
|
918
|
+
currentKey = path.pop();
|
|
919
|
+
break;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
for (let i = 0; i < input.length; i++) {
|
|
923
|
+
const char = input[i];
|
|
924
|
+
switch (stack[stack.length - 1]) {
|
|
925
|
+
case "ROOT":
|
|
926
|
+
processValueStart(char, i, "FINISH");
|
|
927
|
+
break;
|
|
928
|
+
case "INSIDE_OBJECT_START":
|
|
929
|
+
switch (char) {
|
|
930
|
+
case '"':
|
|
931
|
+
stack.pop();
|
|
932
|
+
stack.push("INSIDE_OBJECT_KEY");
|
|
933
|
+
currentKey = "";
|
|
934
|
+
break;
|
|
935
|
+
case "}":
|
|
936
|
+
lastValidIndex = i;
|
|
937
|
+
stack.pop();
|
|
938
|
+
currentKey = path.pop();
|
|
939
|
+
break;
|
|
940
|
+
}
|
|
941
|
+
break;
|
|
942
|
+
case "INSIDE_OBJECT_AFTER_COMMA":
|
|
943
|
+
switch (char) {
|
|
944
|
+
case '"':
|
|
945
|
+
stack.pop();
|
|
946
|
+
stack.push("INSIDE_OBJECT_KEY");
|
|
947
|
+
currentKey = "";
|
|
948
|
+
break;
|
|
949
|
+
}
|
|
950
|
+
break;
|
|
951
|
+
case "INSIDE_OBJECT_KEY":
|
|
952
|
+
switch (char) {
|
|
953
|
+
case '"':
|
|
954
|
+
stack.pop();
|
|
955
|
+
stack.push("INSIDE_OBJECT_AFTER_KEY");
|
|
956
|
+
break;
|
|
957
|
+
case "\\":
|
|
958
|
+
stack.push("INSIDE_STRING_ESCAPE");
|
|
959
|
+
currentKey += char;
|
|
960
|
+
break;
|
|
961
|
+
default:
|
|
962
|
+
currentKey += char;
|
|
963
|
+
break;
|
|
964
|
+
}
|
|
965
|
+
break;
|
|
966
|
+
case "INSIDE_OBJECT_AFTER_KEY":
|
|
967
|
+
switch (char) {
|
|
968
|
+
case ":":
|
|
969
|
+
stack.pop();
|
|
970
|
+
stack.push("INSIDE_OBJECT_BEFORE_VALUE");
|
|
971
|
+
break;
|
|
972
|
+
}
|
|
973
|
+
break;
|
|
974
|
+
case "INSIDE_OBJECT_BEFORE_VALUE":
|
|
975
|
+
processValueStart(char, i, "INSIDE_OBJECT_AFTER_VALUE");
|
|
976
|
+
break;
|
|
977
|
+
case "INSIDE_OBJECT_AFTER_VALUE":
|
|
978
|
+
processAfterObjectValue(char, i);
|
|
979
|
+
break;
|
|
980
|
+
case "INSIDE_STRING":
|
|
981
|
+
switch (char) {
|
|
982
|
+
case '"':
|
|
983
|
+
stack.pop();
|
|
984
|
+
lastValidIndex = i;
|
|
985
|
+
currentKey = path.pop();
|
|
986
|
+
break;
|
|
987
|
+
case "\\":
|
|
988
|
+
stack.push("INSIDE_STRING_ESCAPE");
|
|
989
|
+
break;
|
|
990
|
+
default:
|
|
991
|
+
lastValidIndex = i;
|
|
992
|
+
}
|
|
993
|
+
break;
|
|
994
|
+
case "INSIDE_ARRAY_START":
|
|
995
|
+
switch (char) {
|
|
996
|
+
case "]":
|
|
997
|
+
lastValidIndex = i;
|
|
998
|
+
stack.pop();
|
|
999
|
+
currentKey = path.pop();
|
|
1000
|
+
break;
|
|
1001
|
+
default:
|
|
1002
|
+
lastValidIndex = i;
|
|
1003
|
+
currentKey = "0";
|
|
1004
|
+
processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
|
|
1005
|
+
break;
|
|
1006
|
+
}
|
|
1007
|
+
break;
|
|
1008
|
+
case "INSIDE_ARRAY_AFTER_VALUE":
|
|
1009
|
+
switch (char) {
|
|
1010
|
+
case ",":
|
|
1011
|
+
stack.pop();
|
|
1012
|
+
stack.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
1013
|
+
currentKey = (Number(currentKey) + 1).toString();
|
|
1014
|
+
break;
|
|
1015
|
+
case "]":
|
|
1016
|
+
lastValidIndex = i;
|
|
1017
|
+
stack.pop();
|
|
1018
|
+
currentKey = path.pop();
|
|
1019
|
+
break;
|
|
1020
|
+
default:
|
|
1021
|
+
lastValidIndex = i;
|
|
1022
|
+
break;
|
|
1023
|
+
}
|
|
1024
|
+
break;
|
|
1025
|
+
case "INSIDE_ARRAY_AFTER_COMMA":
|
|
1026
|
+
processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
|
|
1027
|
+
break;
|
|
1028
|
+
case "INSIDE_STRING_ESCAPE":
|
|
1029
|
+
stack.pop();
|
|
1030
|
+
if (stack[stack.length - 1] === "INSIDE_STRING") lastValidIndex = i;
|
|
1031
|
+
else if (stack[stack.length - 1] === "INSIDE_OBJECT_KEY") currentKey += char;
|
|
1032
|
+
break;
|
|
1033
|
+
case "INSIDE_NUMBER":
|
|
1034
|
+
switch (char) {
|
|
1035
|
+
case "0":
|
|
1036
|
+
case "1":
|
|
1037
|
+
case "2":
|
|
1038
|
+
case "3":
|
|
1039
|
+
case "4":
|
|
1040
|
+
case "5":
|
|
1041
|
+
case "6":
|
|
1042
|
+
case "7":
|
|
1043
|
+
case "8":
|
|
1044
|
+
case "9":
|
|
1045
|
+
lastValidIndex = i;
|
|
1046
|
+
break;
|
|
1047
|
+
case "e":
|
|
1048
|
+
case "E":
|
|
1049
|
+
case "-":
|
|
1050
|
+
case ".":
|
|
1051
|
+
break;
|
|
1052
|
+
case ",":
|
|
1053
|
+
stack.pop();
|
|
1054
|
+
currentKey = path.pop();
|
|
1055
|
+
if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") processAfterArrayValue(char, i);
|
|
1056
|
+
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") processAfterObjectValue(char, i);
|
|
1057
|
+
break;
|
|
1058
|
+
case "}":
|
|
1059
|
+
stack.pop();
|
|
1060
|
+
currentKey = path.pop();
|
|
1061
|
+
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") processAfterObjectValue(char, i);
|
|
1062
|
+
break;
|
|
1063
|
+
case "]":
|
|
1064
|
+
stack.pop();
|
|
1065
|
+
currentKey = path.pop();
|
|
1066
|
+
if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") processAfterArrayValue(char, i);
|
|
1067
|
+
break;
|
|
1068
|
+
default:
|
|
1069
|
+
stack.pop();
|
|
1070
|
+
currentKey = path.pop();
|
|
1071
|
+
break;
|
|
1072
|
+
}
|
|
1073
|
+
break;
|
|
1074
|
+
case "INSIDE_LITERAL": {
|
|
1075
|
+
const partialLiteral = input.substring(literalStart, i + 1);
|
|
1076
|
+
if (!"false".startsWith(partialLiteral) && !"true".startsWith(partialLiteral) && !"null".startsWith(partialLiteral)) {
|
|
1077
|
+
stack.pop();
|
|
1078
|
+
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") processAfterObjectValue(char, i);
|
|
1079
|
+
else if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") processAfterArrayValue(char, i);
|
|
1080
|
+
} else lastValidIndex = i;
|
|
1081
|
+
break;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
let result = input.slice(0, lastValidIndex + 1);
|
|
1086
|
+
for (let i = stack.length - 1; i >= 0; i--) switch (stack[i]) {
|
|
1087
|
+
case "INSIDE_STRING":
|
|
1088
|
+
result += '"';
|
|
1089
|
+
break;
|
|
1090
|
+
case "INSIDE_OBJECT_KEY":
|
|
1091
|
+
case "INSIDE_OBJECT_AFTER_KEY":
|
|
1092
|
+
case "INSIDE_OBJECT_AFTER_COMMA":
|
|
1093
|
+
case "INSIDE_OBJECT_START":
|
|
1094
|
+
case "INSIDE_OBJECT_BEFORE_VALUE":
|
|
1095
|
+
case "INSIDE_OBJECT_AFTER_VALUE":
|
|
1096
|
+
result += "}";
|
|
1097
|
+
break;
|
|
1098
|
+
case "INSIDE_ARRAY_START":
|
|
1099
|
+
case "INSIDE_ARRAY_AFTER_COMMA":
|
|
1100
|
+
case "INSIDE_ARRAY_AFTER_VALUE":
|
|
1101
|
+
result += "]";
|
|
1102
|
+
break;
|
|
1103
|
+
case "INSIDE_LITERAL": {
|
|
1104
|
+
const partialLiteral = input.substring(literalStart, input.length);
|
|
1105
|
+
if ("true".startsWith(partialLiteral)) result += "true".slice(partialLiteral.length);
|
|
1106
|
+
else if ("false".startsWith(partialLiteral)) result += "false".slice(partialLiteral.length);
|
|
1107
|
+
else if ("null".startsWith(partialLiteral)) result += "null".slice(partialLiteral.length);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
return [result, path];
|
|
1111
|
+
}
|
|
1112
|
+
function getDefaultExportFromCjs$1(x) {
|
|
1113
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
1114
|
+
}
|
|
1115
|
+
var secureJsonParse = { exports: {} };
|
|
1116
|
+
var hasRequiredSecureJsonParse;
|
|
1117
|
+
function requireSecureJsonParse() {
|
|
1118
|
+
if (hasRequiredSecureJsonParse) return secureJsonParse.exports;
|
|
1119
|
+
hasRequiredSecureJsonParse = 1;
|
|
1120
|
+
const hasBuffer = typeof Buffer !== "undefined";
|
|
1121
|
+
const suspectProtoRx = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/;
|
|
1122
|
+
const suspectConstructorRx = /"(?: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*:/;
|
|
1123
|
+
function _parse2(text2, reviver, options) {
|
|
1124
|
+
if (options == null) {
|
|
1125
|
+
if (reviver !== null && typeof reviver === "object") {
|
|
1126
|
+
options = reviver;
|
|
1127
|
+
reviver = void 0;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
if (hasBuffer && Buffer.isBuffer(text2)) {
|
|
1131
|
+
text2 = text2.toString();
|
|
1132
|
+
}
|
|
1133
|
+
if (text2 && text2.charCodeAt(0) === 65279) {
|
|
1134
|
+
text2 = text2.slice(1);
|
|
1135
|
+
}
|
|
1136
|
+
const obj = JSON.parse(text2, reviver);
|
|
1137
|
+
if (obj === null || typeof obj !== "object") {
|
|
1138
|
+
return obj;
|
|
1139
|
+
}
|
|
1140
|
+
const protoAction = options && options.protoAction || "error";
|
|
1141
|
+
const constructorAction = options && options.constructorAction || "error";
|
|
1142
|
+
if (protoAction === "ignore" && constructorAction === "ignore") {
|
|
1143
|
+
return obj;
|
|
1144
|
+
}
|
|
1145
|
+
if (protoAction !== "ignore" && constructorAction !== "ignore") {
|
|
1146
|
+
if (suspectProtoRx.test(text2) === false && suspectConstructorRx.test(text2) === false) {
|
|
1147
|
+
return obj;
|
|
1148
|
+
}
|
|
1149
|
+
} else if (protoAction !== "ignore" && constructorAction === "ignore") {
|
|
1150
|
+
if (suspectProtoRx.test(text2) === false) {
|
|
1151
|
+
return obj;
|
|
1152
|
+
}
|
|
1153
|
+
} else {
|
|
1154
|
+
if (suspectConstructorRx.test(text2) === false) {
|
|
1155
|
+
return obj;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
return filter(obj, { protoAction, constructorAction, safe: options && options.safe });
|
|
1159
|
+
}
|
|
1160
|
+
function filter(obj, { protoAction = "error", constructorAction = "error", safe } = {}) {
|
|
1161
|
+
let next = [obj];
|
|
1162
|
+
while (next.length) {
|
|
1163
|
+
const nodes = next;
|
|
1164
|
+
next = [];
|
|
1165
|
+
for (const node of nodes) {
|
|
1166
|
+
if (protoAction !== "ignore" && Object.prototype.hasOwnProperty.call(node, "__proto__")) {
|
|
1167
|
+
if (safe === true) {
|
|
1168
|
+
return null;
|
|
1169
|
+
} else if (protoAction === "error") {
|
|
1170
|
+
throw new SyntaxError("Object contains forbidden prototype property");
|
|
1171
|
+
}
|
|
1172
|
+
delete node.__proto__;
|
|
1173
|
+
}
|
|
1174
|
+
if (constructorAction !== "ignore" && Object.prototype.hasOwnProperty.call(node, "constructor") && node.constructor !== null && typeof node.constructor === "object" && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
|
1175
|
+
if (safe === true) {
|
|
1176
|
+
return null;
|
|
1177
|
+
} else if (constructorAction === "error") {
|
|
1178
|
+
throw new SyntaxError("Object contains forbidden prototype property");
|
|
1179
|
+
}
|
|
1180
|
+
delete node.constructor;
|
|
1181
|
+
}
|
|
1182
|
+
for (const key in node) {
|
|
1183
|
+
const value = node[key];
|
|
1184
|
+
if (value && typeof value === "object") {
|
|
1185
|
+
next.push(value);
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
return obj;
|
|
1191
|
+
}
|
|
1192
|
+
function parse2(text2, reviver, options) {
|
|
1193
|
+
const { stackTraceLimit } = Error;
|
|
1194
|
+
Error.stackTraceLimit = 0;
|
|
1195
|
+
try {
|
|
1196
|
+
return _parse2(text2, reviver, options);
|
|
1197
|
+
} finally {
|
|
1198
|
+
Error.stackTraceLimit = stackTraceLimit;
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
function safeParse2(text2, reviver) {
|
|
1202
|
+
const { stackTraceLimit } = Error;
|
|
1203
|
+
Error.stackTraceLimit = 0;
|
|
1204
|
+
try {
|
|
1205
|
+
return _parse2(text2, reviver, { safe: true });
|
|
1206
|
+
} catch {
|
|
1207
|
+
return void 0;
|
|
1208
|
+
} finally {
|
|
1209
|
+
Error.stackTraceLimit = stackTraceLimit;
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
secureJsonParse.exports = parse2;
|
|
1213
|
+
secureJsonParse.exports.default = parse2;
|
|
1214
|
+
secureJsonParse.exports.parse = parse2;
|
|
1215
|
+
secureJsonParse.exports.safeParse = safeParse2;
|
|
1216
|
+
secureJsonParse.exports.scan = filter;
|
|
1217
|
+
return secureJsonParse.exports;
|
|
1218
|
+
}
|
|
1219
|
+
var secureJsonParseExports = requireSecureJsonParse();
|
|
1220
|
+
const sjson = /* @__PURE__ */ getDefaultExportFromCjs$1(secureJsonParseExports);
|
|
1221
|
+
const PARTIAL_JSON_OBJECT_META_SYMBOL = Symbol("aui.parse-partial-json-object.meta");
|
|
1222
|
+
const parsePartialJsonObject = (json) => {
|
|
1223
|
+
if (json.length === 0) return { [PARTIAL_JSON_OBJECT_META_SYMBOL]: {
|
|
1224
|
+
state: "partial",
|
|
1225
|
+
partialPath: []
|
|
1226
|
+
} };
|
|
1227
|
+
try {
|
|
1228
|
+
const res = sjson.parse(json);
|
|
1229
|
+
if (typeof res !== "object" || res === null) throw new Error("argsText is expected to be an object");
|
|
1230
|
+
res[PARTIAL_JSON_OBJECT_META_SYMBOL] = {
|
|
1231
|
+
state: "complete",
|
|
1232
|
+
partialPath: []
|
|
1233
|
+
};
|
|
1234
|
+
return res;
|
|
1235
|
+
} catch {
|
|
1236
|
+
try {
|
|
1237
|
+
const [fixedJson, partialPath] = fixJson(json);
|
|
1238
|
+
const res = sjson.parse(fixedJson);
|
|
1239
|
+
if (typeof res !== "object" || res === null) throw new Error("argsText is expected to be an object");
|
|
1240
|
+
res[PARTIAL_JSON_OBJECT_META_SYMBOL] = {
|
|
1241
|
+
state: "partial",
|
|
1242
|
+
partialPath
|
|
1243
|
+
};
|
|
1244
|
+
return res;
|
|
1245
|
+
} catch {
|
|
1246
|
+
return;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
};
|
|
1320
1250
|
const isArray = Array.isArray;
|
|
1321
1251
|
const resolveClassValue = (value) => {
|
|
1322
1252
|
if (!value) return "";
|
|
@@ -9065,7 +8995,7 @@ const parseLangGraphState = (state) => {
|
|
|
9065
8995
|
}
|
|
9066
8996
|
return result;
|
|
9067
8997
|
};
|
|
9068
|
-
const {
|
|
8998
|
+
const { getAutoStatus } = react$1.INTERNAL;
|
|
9069
8999
|
const joinExternalMessages = (messages) => {
|
|
9070
9000
|
var _a2;
|
|
9071
9001
|
const assistantMessage = {
|
|
@@ -9269,7 +9199,7 @@ const convertExternalMessages = (messages, callback, isRunning, metadata) => {
|
|
|
9269
9199
|
const joined = joinExternalMessages(message.outputs);
|
|
9270
9200
|
const hasPendingToolCalls = typeof joined.content === "object" && joined.content.some((c) => c.type === "tool-call" && c.result === void 0);
|
|
9271
9201
|
const autoStatus = getAutoStatus(isLast, isRunning, hasPendingToolCalls, hasPendingToolCalls);
|
|
9272
|
-
const newMessage = fromThreadMessageLike(joined, idx.toString(), autoStatus);
|
|
9202
|
+
const newMessage = react$1.fromThreadMessageLike(joined, idx.toString(), autoStatus);
|
|
9273
9203
|
react$1.bindExternalStoreMessage(newMessage, message.inputs);
|
|
9274
9204
|
return newMessage;
|
|
9275
9205
|
});
|
|
@@ -9320,20 +9250,16 @@ const contentToParts = (content) => {
|
|
|
9320
9250
|
return [{ type: "text", text: part.text }];
|
|
9321
9251
|
case "text_delta":
|
|
9322
9252
|
return [{ type: "text", text: part.text }];
|
|
9323
|
-
case "image_url":
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
|
|
9327
|
-
return [{
|
|
9328
|
-
type: "image",
|
|
9329
|
-
image: part.image_url.url
|
|
9330
|
-
}];
|
|
9253
|
+
case "image_url": {
|
|
9254
|
+
const imageUrl = typeof part.image_url === "string" ? part.image_url : part.image_url.url;
|
|
9255
|
+
return imageUrl ? [{ type: "image", image: imageUrl }] : [];
|
|
9256
|
+
}
|
|
9331
9257
|
case "thinking":
|
|
9332
9258
|
return [{ type: "reasoning", text: part.thinking }];
|
|
9333
9259
|
case "reasoning":
|
|
9334
9260
|
return [{
|
|
9335
9261
|
type: "reasoning",
|
|
9336
|
-
text: part.summary.map((s) => s.text).join("\n\n\n")
|
|
9262
|
+
text: (part.summary ?? []).map((s) => s.text ?? "").join("\n\n\n")
|
|
9337
9263
|
}];
|
|
9338
9264
|
case "tool_use":
|
|
9339
9265
|
return [];
|
|
@@ -9810,6 +9736,8 @@ const useAthenaRuntime = (config2) => {
|
|
|
9810
9736
|
backendUrl = DEFAULT_BACKEND_URL,
|
|
9811
9737
|
apiKey,
|
|
9812
9738
|
token,
|
|
9739
|
+
getToken,
|
|
9740
|
+
onUnauthorized,
|
|
9813
9741
|
model = DEFAULT_MODEL,
|
|
9814
9742
|
agent: agent2 = DEFAULT_AGENT,
|
|
9815
9743
|
tools = [],
|
|
@@ -9841,6 +9769,10 @@ const useAthenaRuntime = (config2) => {
|
|
|
9841
9769
|
const converter = React.useMemo(() => createConverter(optimisticMessageCache), [optimisticMessageCache]);
|
|
9842
9770
|
const tokenRef = React.useRef(token);
|
|
9843
9771
|
tokenRef.current = token;
|
|
9772
|
+
const getTokenRef = React.useRef(getToken);
|
|
9773
|
+
getTokenRef.current = getToken;
|
|
9774
|
+
const onUnauthorizedRef = React.useRef(onUnauthorized);
|
|
9775
|
+
onUnauthorizedRef.current = onUnauthorized;
|
|
9844
9776
|
const apiKeyRef = React.useRef(apiKey);
|
|
9845
9777
|
apiKeyRef.current = apiKey;
|
|
9846
9778
|
const channelRef = React.useRef(channel);
|
|
@@ -9879,9 +9811,10 @@ const useAthenaRuntime = (config2) => {
|
|
|
9879
9811
|
resumeApi: resolvedResumeApiUrl,
|
|
9880
9812
|
headers: async () => {
|
|
9881
9813
|
const currentThreadId = threadIdRef.current;
|
|
9814
|
+
const currentToken = getTokenRef.current ? await getTokenRef.current() ?? tokenRef.current : tokenRef.current;
|
|
9882
9815
|
return {
|
|
9883
9816
|
// Prefer parent-injected PropelAuth token over hardcoded API key
|
|
9884
|
-
...
|
|
9817
|
+
...currentToken ? { Authorization: `Bearer ${currentToken}` } : apiKeyRef.current ? { "X-API-KEY": apiKeyRef.current } : {},
|
|
9885
9818
|
"Accept-Encoding": "identity",
|
|
9886
9819
|
Accept: "text/event-stream",
|
|
9887
9820
|
...currentThreadId ? { "X-Thread-Id": currentThreadId } : {}
|
|
@@ -9898,9 +9831,17 @@ const useAthenaRuntime = (config2) => {
|
|
|
9898
9831
|
}
|
|
9899
9832
|
},
|
|
9900
9833
|
onError: (error2, { commands: commands2, updateState }) => {
|
|
9834
|
+
var _a2;
|
|
9901
9835
|
const pendingCommands = commandsToMessages(commands2);
|
|
9902
9836
|
const isInvalidStringLength = error2 instanceof RangeError && /Invalid string length/i.test(error2.message);
|
|
9903
9837
|
const userErrorMessage = isInvalidStringLength ? "The response was too large to process. Try reducing the amount of content in a single request or starting a new chat." : error2.message;
|
|
9838
|
+
if (/\b401\b|unauthori[sz]ed/i.test(error2.message)) {
|
|
9839
|
+
try {
|
|
9840
|
+
void Promise.resolve((_a2 = onUnauthorizedRef.current) == null ? void 0 : _a2.call(onUnauthorizedRef)).catch(() => {
|
|
9841
|
+
});
|
|
9842
|
+
} catch {
|
|
9843
|
+
}
|
|
9844
|
+
}
|
|
9904
9845
|
updateState((state) => {
|
|
9905
9846
|
const messages = [...state.messages, ...pendingCommands];
|
|
9906
9847
|
const lastAiIdx = messages.findLastIndex((m) => m.type === "ai");
|
|
@@ -10013,7 +9954,8 @@ const useAthenaRuntime = (config2) => {
|
|
|
10013
9954
|
hasResumedRef.current = true;
|
|
10014
9955
|
(async () => {
|
|
10015
9956
|
var _a2, _b;
|
|
10016
|
-
const
|
|
9957
|
+
const currentToken = getTokenRef.current ? await getTokenRef.current() ?? tokenRef.current : tokenRef.current;
|
|
9958
|
+
const auth = { apiKey: apiKeyRef.current, token: currentToken };
|
|
10017
9959
|
console.log("[AthenaSDK] Loading existing thread state:", {
|
|
10018
9960
|
threadId,
|
|
10019
9961
|
backendUrl
|
|
@@ -10068,7 +10010,7 @@ const useAthenaRuntime = (config2) => {
|
|
|
10068
10010
|
}, [isExistingThread, runtime, threadId, backendUrl, resolvedStatusApiUrl]);
|
|
10069
10011
|
return runtime;
|
|
10070
10012
|
};
|
|
10071
|
-
function setRef(ref, value) {
|
|
10013
|
+
function setRef$1(ref, value) {
|
|
10072
10014
|
if (typeof ref === "function") {
|
|
10073
10015
|
return ref(value);
|
|
10074
10016
|
} else if (ref !== null && ref !== void 0) {
|
|
@@ -10079,7 +10021,7 @@ function composeRefs(...refs) {
|
|
|
10079
10021
|
return (node) => {
|
|
10080
10022
|
let hasCleanup = false;
|
|
10081
10023
|
const cleanups = refs.map((ref) => {
|
|
10082
|
-
const cleanup = setRef(ref, node);
|
|
10024
|
+
const cleanup = setRef$1(ref, node);
|
|
10083
10025
|
if (!hasCleanup && typeof cleanup == "function") {
|
|
10084
10026
|
hasCleanup = true;
|
|
10085
10027
|
}
|
|
@@ -10092,7 +10034,7 @@ function composeRefs(...refs) {
|
|
|
10092
10034
|
if (typeof cleanup == "function") {
|
|
10093
10035
|
cleanup();
|
|
10094
10036
|
} else {
|
|
10095
|
-
setRef(refs[i], null);
|
|
10037
|
+
setRef$1(refs[i], null);
|
|
10096
10038
|
}
|
|
10097
10039
|
}
|
|
10098
10040
|
};
|
|
@@ -10104,60 +10046,77 @@ function useComposedRefs(...refs) {
|
|
|
10104
10046
|
}
|
|
10105
10047
|
// @__NO_SIDE_EFFECTS__
|
|
10106
10048
|
function createSlot(ownerName) {
|
|
10107
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
10108
10049
|
const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
|
|
10050
|
+
let { children, ...slotProps } = props;
|
|
10051
|
+
let slottableElement = null;
|
|
10052
|
+
let hasSlottable = false;
|
|
10053
|
+
const newChildren = [];
|
|
10054
|
+
if (isLazyComponent(children) && typeof use === "function") {
|
|
10055
|
+
children = use(children._payload);
|
|
10056
|
+
}
|
|
10057
|
+
React__namespace.Children.forEach(children, (maybeSlottable) => {
|
|
10058
|
+
var _a2;
|
|
10059
|
+
if (isSlottable(maybeSlottable)) {
|
|
10060
|
+
hasSlottable = true;
|
|
10061
|
+
const slottable = maybeSlottable;
|
|
10062
|
+
let child = "child" in slottable.props ? slottable.props.child : slottable.props.children;
|
|
10063
|
+
if (isLazyComponent(child) && typeof use === "function") {
|
|
10064
|
+
child = use(child._payload);
|
|
10065
|
+
}
|
|
10066
|
+
slottableElement = getSlottableElementFromSlottable(slottable, child);
|
|
10067
|
+
newChildren.push((_a2 = slottableElement == null ? void 0 : slottableElement.props) == null ? void 0 : _a2.children);
|
|
10068
|
+
} else {
|
|
10069
|
+
newChildren.push(maybeSlottable);
|
|
10070
|
+
}
|
|
10071
|
+
});
|
|
10072
|
+
if (slottableElement) {
|
|
10073
|
+
slottableElement = React__namespace.cloneElement(slottableElement, void 0, newChildren);
|
|
10074
|
+
} else if (
|
|
10075
|
+
// A `Slottable` was found but it didn't resolve to a single element (e.g.
|
|
10076
|
+
// it wrapped multiple elements, text, or a render-prop `child` that
|
|
10077
|
+
// wasn't an element). Don't fall back to treating the `Slottable` wrapper
|
|
10078
|
+
// itself as the slot target — throw a descriptive error below instead.
|
|
10079
|
+
!hasSlottable && React__namespace.Children.count(children) === 1 && React__namespace.isValidElement(children)
|
|
10080
|
+
) {
|
|
10081
|
+
slottableElement = children;
|
|
10082
|
+
}
|
|
10083
|
+
const slottableElementRef = slottableElement ? getElementRef$1(slottableElement) : void 0;
|
|
10084
|
+
const composedRef = useComposedRefs(forwardedRef, slottableElementRef);
|
|
10085
|
+
if (!slottableElement) {
|
|
10086
|
+
if (children || children === 0) {
|
|
10087
|
+
throw new Error(
|
|
10088
|
+
hasSlottable ? createSlottableError(ownerName) : createSlotError(ownerName)
|
|
10089
|
+
);
|
|
10090
|
+
}
|
|
10091
|
+
return children;
|
|
10092
|
+
}
|
|
10093
|
+
const mergedProps = mergeProps(slotProps, slottableElement.props ?? {});
|
|
10094
|
+
if (slottableElement.type !== React__namespace.Fragment) {
|
|
10095
|
+
mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;
|
|
10123
10096
|
}
|
|
10124
|
-
return
|
|
10097
|
+
return React__namespace.cloneElement(slottableElement, mergedProps);
|
|
10125
10098
|
});
|
|
10126
10099
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
10127
10100
|
return Slot2;
|
|
10128
10101
|
}
|
|
10129
10102
|
var Slot = /* @__PURE__ */ createSlot("Slot");
|
|
10130
|
-
|
|
10131
|
-
function createSlotClone(ownerName) {
|
|
10132
|
-
const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
|
|
10133
|
-
const { children, ...slotProps } = props;
|
|
10134
|
-
if (React__namespace.isValidElement(children)) {
|
|
10135
|
-
const childrenRef = getElementRef$1(children);
|
|
10136
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
10137
|
-
if (children.type !== React__namespace.Fragment) {
|
|
10138
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
10139
|
-
}
|
|
10140
|
-
return React__namespace.cloneElement(children, props2);
|
|
10141
|
-
}
|
|
10142
|
-
return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
|
|
10143
|
-
});
|
|
10144
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
10145
|
-
return SlotClone;
|
|
10146
|
-
}
|
|
10147
|
-
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
10103
|
+
var SLOTTABLE_IDENTIFIER = Symbol.for("radix.slottable");
|
|
10148
10104
|
// @__NO_SIDE_EFFECTS__
|
|
10149
10105
|
function createSlottable(ownerName) {
|
|
10150
|
-
const Slottable2 = (
|
|
10151
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
10152
|
-
};
|
|
10106
|
+
const Slottable2 = (props) => "child" in props ? props.children(props.child) : props.children;
|
|
10153
10107
|
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
10154
10108
|
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
10155
10109
|
return Slottable2;
|
|
10156
10110
|
}
|
|
10157
10111
|
var Slottable$1 = /* @__PURE__ */ createSlottable("Slottable");
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10112
|
+
var getSlottableElementFromSlottable = (slottable, child) => {
|
|
10113
|
+
if ("child" in slottable.props) {
|
|
10114
|
+
const child2 = slottable.props.child;
|
|
10115
|
+
if (!React__namespace.isValidElement(child2)) return null;
|
|
10116
|
+
return React__namespace.cloneElement(child2, void 0, slottable.props.children(child2.props.children));
|
|
10117
|
+
}
|
|
10118
|
+
return React__namespace.isValidElement(child) ? child : null;
|
|
10119
|
+
};
|
|
10161
10120
|
function mergeProps(slotProps, childProps) {
|
|
10162
10121
|
const overrideProps = { ...childProps };
|
|
10163
10122
|
for (const propName in childProps) {
|
|
@@ -10196,7 +10155,24 @@ function getElementRef$1(element) {
|
|
|
10196
10155
|
}
|
|
10197
10156
|
return element.props.ref || element.ref;
|
|
10198
10157
|
}
|
|
10199
|
-
|
|
10158
|
+
function isSlottable(child) {
|
|
10159
|
+
return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
10160
|
+
}
|
|
10161
|
+
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
10162
|
+
function isLazyComponent(element) {
|
|
10163
|
+
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
10164
|
+
}
|
|
10165
|
+
function isPromiseLike(value) {
|
|
10166
|
+
return typeof value === "object" && value !== null && "then" in value;
|
|
10167
|
+
}
|
|
10168
|
+
var createSlotError = (ownerName) => {
|
|
10169
|
+
return `${ownerName} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`;
|
|
10170
|
+
};
|
|
10171
|
+
var createSlottableError = (ownerName) => {
|
|
10172
|
+
return `${ownerName} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`;
|
|
10173
|
+
};
|
|
10174
|
+
var use = React__namespace[" use ".trim().toString()];
|
|
10175
|
+
var NODES = [
|
|
10200
10176
|
"a",
|
|
10201
10177
|
"button",
|
|
10202
10178
|
"div",
|
|
@@ -10215,7 +10191,7 @@ var NODES$6 = [
|
|
|
10215
10191
|
"svg",
|
|
10216
10192
|
"ul"
|
|
10217
10193
|
];
|
|
10218
|
-
var Primitive
|
|
10194
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
10219
10195
|
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
10220
10196
|
const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
10221
10197
|
const { asChild, ...primitiveProps } = props;
|
|
@@ -10228,6 +10204,9 @@ var Primitive$6 = NODES$6.reduce((primitive, node) => {
|
|
|
10228
10204
|
Node4.displayName = `Primitive.${node}`;
|
|
10229
10205
|
return { ...primitive, [node]: Node4 };
|
|
10230
10206
|
}, {});
|
|
10207
|
+
function dispatchDiscreteCustomEvent(target, event) {
|
|
10208
|
+
if (target) ReactDOM__namespace.flushSync(() => target.dispatchEvent(event));
|
|
10209
|
+
}
|
|
10231
10210
|
var VISUALLY_HIDDEN_STYLES = Object.freeze({
|
|
10232
10211
|
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
10233
10212
|
position: "absolute",
|
|
@@ -10245,7 +10224,7 @@ var NAME$1 = "VisuallyHidden";
|
|
|
10245
10224
|
var VisuallyHidden = React__namespace.forwardRef(
|
|
10246
10225
|
(props, forwardedRef) => {
|
|
10247
10226
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10248
|
-
Primitive
|
|
10227
|
+
Primitive.span,
|
|
10249
10228
|
{
|
|
10250
10229
|
...props,
|
|
10251
10230
|
ref: forwardedRef,
|
|
@@ -10256,6 +10235,66 @@ var VisuallyHidden = React__namespace.forwardRef(
|
|
|
10256
10235
|
);
|
|
10257
10236
|
VisuallyHidden.displayName = NAME$1;
|
|
10258
10237
|
var Root$2 = VisuallyHidden;
|
|
10238
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
10239
|
+
let defaultContexts = [];
|
|
10240
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
10241
|
+
const BaseContext = React__namespace.createContext(defaultContext);
|
|
10242
|
+
BaseContext.displayName = rootComponentName + "Context";
|
|
10243
|
+
const index2 = defaultContexts.length;
|
|
10244
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
10245
|
+
const Provider2 = (props) => {
|
|
10246
|
+
var _a2;
|
|
10247
|
+
const { scope, children, ...context } = props;
|
|
10248
|
+
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
|
|
10249
|
+
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
10250
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
10251
|
+
};
|
|
10252
|
+
Provider2.displayName = rootComponentName + "Provider";
|
|
10253
|
+
function useContext2(consumerName, scope) {
|
|
10254
|
+
var _a2;
|
|
10255
|
+
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
|
|
10256
|
+
const context = React__namespace.useContext(Context);
|
|
10257
|
+
if (context) return context;
|
|
10258
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
10259
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
10260
|
+
}
|
|
10261
|
+
return [Provider2, useContext2];
|
|
10262
|
+
}
|
|
10263
|
+
const createScope = () => {
|
|
10264
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
10265
|
+
return React__namespace.createContext(defaultContext);
|
|
10266
|
+
});
|
|
10267
|
+
return function useScope(scope) {
|
|
10268
|
+
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
10269
|
+
return React__namespace.useMemo(
|
|
10270
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
10271
|
+
[scope, contexts]
|
|
10272
|
+
);
|
|
10273
|
+
};
|
|
10274
|
+
};
|
|
10275
|
+
createScope.scopeName = scopeName;
|
|
10276
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
10277
|
+
}
|
|
10278
|
+
function composeContextScopes(...scopes) {
|
|
10279
|
+
const baseScope = scopes[0];
|
|
10280
|
+
if (scopes.length === 1) return baseScope;
|
|
10281
|
+
const createScope = () => {
|
|
10282
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
10283
|
+
useScope: createScope2(),
|
|
10284
|
+
scopeName: createScope2.scopeName
|
|
10285
|
+
}));
|
|
10286
|
+
return function useComposedScopes(overrideScopes) {
|
|
10287
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
10288
|
+
const scopeProps = useScope(overrideScopes);
|
|
10289
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
10290
|
+
return { ...nextScopes2, ...currentScope };
|
|
10291
|
+
}, {});
|
|
10292
|
+
return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
10293
|
+
};
|
|
10294
|
+
};
|
|
10295
|
+
createScope.scopeName = baseScope.scopeName;
|
|
10296
|
+
return createScope;
|
|
10297
|
+
}
|
|
10259
10298
|
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
10260
10299
|
return function handleEvent(event) {
|
|
10261
10300
|
originalEventHandler == null ? void 0 : originalEventHandler(event);
|
|
@@ -10332,97 +10371,6 @@ function useUncontrolledState({
|
|
|
10332
10371
|
function isFunction$2(value) {
|
|
10333
10372
|
return typeof value === "function";
|
|
10334
10373
|
}
|
|
10335
|
-
function createContextScope$2(scopeName, createContextScopeDeps = []) {
|
|
10336
|
-
let defaultContexts = [];
|
|
10337
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
10338
|
-
const BaseContext = React__namespace.createContext(defaultContext);
|
|
10339
|
-
const index2 = defaultContexts.length;
|
|
10340
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
10341
|
-
const Provider2 = (props) => {
|
|
10342
|
-
var _a2;
|
|
10343
|
-
const { scope, children, ...context } = props;
|
|
10344
|
-
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
|
|
10345
|
-
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
10346
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
10347
|
-
};
|
|
10348
|
-
Provider2.displayName = rootComponentName + "Provider";
|
|
10349
|
-
function useContext2(consumerName, scope) {
|
|
10350
|
-
var _a2;
|
|
10351
|
-
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
|
|
10352
|
-
const context = React__namespace.useContext(Context);
|
|
10353
|
-
if (context) return context;
|
|
10354
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
10355
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
10356
|
-
}
|
|
10357
|
-
return [Provider2, useContext2];
|
|
10358
|
-
}
|
|
10359
|
-
const createScope = () => {
|
|
10360
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
10361
|
-
return React__namespace.createContext(defaultContext);
|
|
10362
|
-
});
|
|
10363
|
-
return function useScope(scope) {
|
|
10364
|
-
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
10365
|
-
return React__namespace.useMemo(
|
|
10366
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
10367
|
-
[scope, contexts]
|
|
10368
|
-
);
|
|
10369
|
-
};
|
|
10370
|
-
};
|
|
10371
|
-
createScope.scopeName = scopeName;
|
|
10372
|
-
return [createContext3, composeContextScopes$2(createScope, ...createContextScopeDeps)];
|
|
10373
|
-
}
|
|
10374
|
-
function composeContextScopes$2(...scopes) {
|
|
10375
|
-
const baseScope = scopes[0];
|
|
10376
|
-
if (scopes.length === 1) return baseScope;
|
|
10377
|
-
const createScope = () => {
|
|
10378
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
10379
|
-
useScope: createScope2(),
|
|
10380
|
-
scopeName: createScope2.scopeName
|
|
10381
|
-
}));
|
|
10382
|
-
return function useComposedScopes(overrideScopes) {
|
|
10383
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
10384
|
-
const scopeProps = useScope(overrideScopes);
|
|
10385
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
10386
|
-
return { ...nextScopes2, ...currentScope };
|
|
10387
|
-
}, {});
|
|
10388
|
-
return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
10389
|
-
};
|
|
10390
|
-
};
|
|
10391
|
-
createScope.scopeName = baseScope.scopeName;
|
|
10392
|
-
return createScope;
|
|
10393
|
-
}
|
|
10394
|
-
var NODES$5 = [
|
|
10395
|
-
"a",
|
|
10396
|
-
"button",
|
|
10397
|
-
"div",
|
|
10398
|
-
"form",
|
|
10399
|
-
"h2",
|
|
10400
|
-
"h3",
|
|
10401
|
-
"img",
|
|
10402
|
-
"input",
|
|
10403
|
-
"label",
|
|
10404
|
-
"li",
|
|
10405
|
-
"nav",
|
|
10406
|
-
"ol",
|
|
10407
|
-
"p",
|
|
10408
|
-
"select",
|
|
10409
|
-
"span",
|
|
10410
|
-
"svg",
|
|
10411
|
-
"ul"
|
|
10412
|
-
];
|
|
10413
|
-
var Primitive$5 = NODES$5.reduce((primitive, node) => {
|
|
10414
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
10415
|
-
const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
10416
|
-
const { asChild, ...primitiveProps } = props;
|
|
10417
|
-
const Comp = asChild ? Slot2 : node;
|
|
10418
|
-
if (typeof window !== "undefined") {
|
|
10419
|
-
window[Symbol.for("radix-ui")] = true;
|
|
10420
|
-
}
|
|
10421
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
10422
|
-
});
|
|
10423
|
-
Node4.displayName = `Primitive.${node}`;
|
|
10424
|
-
return { ...primitive, [node]: Node4 };
|
|
10425
|
-
}, {});
|
|
10426
10374
|
function useStateMachine(initialState, machine) {
|
|
10427
10375
|
return React__namespace.useReducer((state, event) => {
|
|
10428
10376
|
const nextState = machine[state][event];
|
|
@@ -10433,7 +10381,7 @@ var Presence = (props) => {
|
|
|
10433
10381
|
const { present, children } = props;
|
|
10434
10382
|
const presence = usePresence(present);
|
|
10435
10383
|
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React__namespace.Children.only(children);
|
|
10436
|
-
const ref =
|
|
10384
|
+
const ref = useStableComposedRefs(presence.ref, getElementRef(child));
|
|
10437
10385
|
const forceMount = typeof children === "function";
|
|
10438
10386
|
return forceMount || presence.isPresent ? React__namespace.cloneElement(child, { ref }) : null;
|
|
10439
10387
|
};
|
|
@@ -10529,6 +10477,40 @@ function usePresence(present) {
|
|
|
10529
10477
|
}, [])
|
|
10530
10478
|
};
|
|
10531
10479
|
}
|
|
10480
|
+
function setRef(ref, value) {
|
|
10481
|
+
if (typeof ref === "function") {
|
|
10482
|
+
return ref(value);
|
|
10483
|
+
} else if (ref !== null && ref !== void 0) {
|
|
10484
|
+
ref.current = value;
|
|
10485
|
+
}
|
|
10486
|
+
}
|
|
10487
|
+
function useStableComposedRefs(...refs) {
|
|
10488
|
+
const refsRef = React__namespace.useRef(refs);
|
|
10489
|
+
refsRef.current = refs;
|
|
10490
|
+
return React__namespace.useCallback((node) => {
|
|
10491
|
+
const currentRefs = refsRef.current;
|
|
10492
|
+
let hasCleanup = false;
|
|
10493
|
+
const cleanups = currentRefs.map((ref) => {
|
|
10494
|
+
const cleanup = setRef(ref, node);
|
|
10495
|
+
if (!hasCleanup && typeof cleanup === "function") {
|
|
10496
|
+
hasCleanup = true;
|
|
10497
|
+
}
|
|
10498
|
+
return cleanup;
|
|
10499
|
+
});
|
|
10500
|
+
if (hasCleanup) {
|
|
10501
|
+
return () => {
|
|
10502
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
10503
|
+
const cleanup = cleanups[i];
|
|
10504
|
+
if (typeof cleanup === "function") {
|
|
10505
|
+
cleanup();
|
|
10506
|
+
} else {
|
|
10507
|
+
setRef(currentRefs[i], null);
|
|
10508
|
+
}
|
|
10509
|
+
}
|
|
10510
|
+
};
|
|
10511
|
+
}
|
|
10512
|
+
}, []);
|
|
10513
|
+
}
|
|
10532
10514
|
function getAnimationName(styles) {
|
|
10533
10515
|
return (styles == null ? void 0 : styles.animationName) || "none";
|
|
10534
10516
|
}
|
|
@@ -10556,7 +10538,7 @@ function useId$1(deterministicId) {
|
|
|
10556
10538
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
10557
10539
|
}
|
|
10558
10540
|
var COLLAPSIBLE_NAME = "Collapsible";
|
|
10559
|
-
var [createCollapsibleContext] = createContextScope
|
|
10541
|
+
var [createCollapsibleContext] = createContextScope(COLLAPSIBLE_NAME);
|
|
10560
10542
|
var [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);
|
|
10561
10543
|
var Collapsible$1 = React__namespace.forwardRef(
|
|
10562
10544
|
(props, forwardedRef) => {
|
|
@@ -10583,7 +10565,7 @@ var Collapsible$1 = React__namespace.forwardRef(
|
|
|
10583
10565
|
open,
|
|
10584
10566
|
onOpenToggle: React__namespace.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
10585
10567
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10586
|
-
Primitive
|
|
10568
|
+
Primitive.div,
|
|
10587
10569
|
{
|
|
10588
10570
|
"data-state": getState(open),
|
|
10589
10571
|
"data-disabled": disabled ? "" : void 0,
|
|
@@ -10602,10 +10584,10 @@ var CollapsibleTrigger$1 = React__namespace.forwardRef(
|
|
|
10602
10584
|
const { __scopeCollapsible, ...triggerProps } = props;
|
|
10603
10585
|
const context = useCollapsibleContext(TRIGGER_NAME$1, __scopeCollapsible);
|
|
10604
10586
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10605
|
-
Primitive
|
|
10587
|
+
Primitive.button,
|
|
10606
10588
|
{
|
|
10607
10589
|
type: "button",
|
|
10608
|
-
"aria-controls": context.contentId,
|
|
10590
|
+
"aria-controls": context.open ? context.contentId : void 0,
|
|
10609
10591
|
"aria-expanded": context.open || false,
|
|
10610
10592
|
"data-state": getState(context.open),
|
|
10611
10593
|
"data-disabled": context.disabled ? "" : void 0,
|
|
@@ -10664,7 +10646,7 @@ var CollapsibleContentImpl = React__namespace.forwardRef((props, forwardedRef) =
|
|
|
10664
10646
|
}
|
|
10665
10647
|
}, [context.open, present]);
|
|
10666
10648
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10667
|
-
Primitive
|
|
10649
|
+
Primitive.div,
|
|
10668
10650
|
{
|
|
10669
10651
|
"data-state": getState(context.open),
|
|
10670
10652
|
"data-disabled": context.disabled ? "" : void 0,
|
|
@@ -10685,50 +10667,15 @@ function getState(open) {
|
|
|
10685
10667
|
return open ? "open" : "closed";
|
|
10686
10668
|
}
|
|
10687
10669
|
var Root$1 = Collapsible$1;
|
|
10688
|
-
var NODES$4 = [
|
|
10689
|
-
"a",
|
|
10690
|
-
"button",
|
|
10691
|
-
"div",
|
|
10692
|
-
"form",
|
|
10693
|
-
"h2",
|
|
10694
|
-
"h3",
|
|
10695
|
-
"img",
|
|
10696
|
-
"input",
|
|
10697
|
-
"label",
|
|
10698
|
-
"li",
|
|
10699
|
-
"nav",
|
|
10700
|
-
"ol",
|
|
10701
|
-
"p",
|
|
10702
|
-
"select",
|
|
10703
|
-
"span",
|
|
10704
|
-
"svg",
|
|
10705
|
-
"ul"
|
|
10706
|
-
];
|
|
10707
|
-
var Primitive$4 = NODES$4.reduce((primitive, node) => {
|
|
10708
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
10709
|
-
const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
10710
|
-
const { asChild, ...primitiveProps } = props;
|
|
10711
|
-
const Comp = asChild ? Slot2 : node;
|
|
10712
|
-
if (typeof window !== "undefined") {
|
|
10713
|
-
window[Symbol.for("radix-ui")] = true;
|
|
10714
|
-
}
|
|
10715
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
10716
|
-
});
|
|
10717
|
-
Node4.displayName = `Primitive.${node}`;
|
|
10718
|
-
return { ...primitive, [node]: Node4 };
|
|
10719
|
-
}, {});
|
|
10720
|
-
function dispatchDiscreteCustomEvent(target, event) {
|
|
10721
|
-
if (target) ReactDOM__namespace.flushSync(() => target.dispatchEvent(event));
|
|
10722
|
-
}
|
|
10723
10670
|
function useCallbackRef(callback) {
|
|
10724
10671
|
const callbackRef = React__namespace.useRef(callback);
|
|
10725
10672
|
React__namespace.useEffect(() => {
|
|
10726
10673
|
callbackRef.current = callback;
|
|
10727
10674
|
});
|
|
10728
|
-
return React__namespace.useMemo(() => (...args) => {
|
|
10675
|
+
return React__namespace.useMemo(() => ((...args) => {
|
|
10729
10676
|
var _a2;
|
|
10730
10677
|
return (_a2 = callbackRef.current) == null ? void 0 : _a2.call(callbackRef, ...args);
|
|
10731
|
-
}, []);
|
|
10678
|
+
}), []);
|
|
10732
10679
|
}
|
|
10733
10680
|
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
10734
10681
|
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
|
|
@@ -10750,12 +10697,19 @@ var originalBodyPointerEvents;
|
|
|
10750
10697
|
var DismissableLayerContext = React__namespace.createContext({
|
|
10751
10698
|
layers: /* @__PURE__ */ new Set(),
|
|
10752
10699
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
10753
|
-
branches: /* @__PURE__ */ new Set()
|
|
10700
|
+
branches: /* @__PURE__ */ new Set(),
|
|
10701
|
+
// Outside elements that belong to a layer's own dismiss affordance (eg, a
|
|
10702
|
+
// dialog overlay). Pressing them should dismiss the layer regardless of
|
|
10703
|
+
// whether or not they stop propagation.
|
|
10704
|
+
//
|
|
10705
|
+
// See https://github.com/radix-ui/primitives/issues/3346
|
|
10706
|
+
dismissableSurfaces: /* @__PURE__ */ new Set()
|
|
10754
10707
|
});
|
|
10755
10708
|
var DismissableLayer = React__namespace.forwardRef(
|
|
10756
10709
|
(props, forwardedRef) => {
|
|
10757
10710
|
const {
|
|
10758
10711
|
disableOutsidePointerEvents = false,
|
|
10712
|
+
deferPointerDownOutside = false,
|
|
10759
10713
|
onEscapeKeyDown,
|
|
10760
10714
|
onPointerDownOutside,
|
|
10761
10715
|
onFocusOutside,
|
|
@@ -10774,15 +10728,32 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
10774
10728
|
const index2 = node ? layers.indexOf(node) : -1;
|
|
10775
10729
|
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
10776
10730
|
const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
10777
|
-
const
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10731
|
+
const isDeferredPointerDownOutsideRef = React__namespace.useRef(false);
|
|
10732
|
+
const pointerDownOutside = usePointerDownOutside(
|
|
10733
|
+
(event) => {
|
|
10734
|
+
const target = event.target;
|
|
10735
|
+
if (!(target instanceof Node)) {
|
|
10736
|
+
return;
|
|
10737
|
+
}
|
|
10738
|
+
const isPointerDownOnBranch = [...context.branches].some(
|
|
10739
|
+
(branch) => branch.contains(target)
|
|
10740
|
+
);
|
|
10741
|
+
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
10742
|
+
onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
|
|
10743
|
+
onInteractOutside == null ? void 0 : onInteractOutside(event);
|
|
10744
|
+
if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
|
|
10745
|
+
},
|
|
10746
|
+
{
|
|
10747
|
+
ownerDocument,
|
|
10748
|
+
deferPointerDownOutside,
|
|
10749
|
+
isDeferredPointerDownOutsideRef,
|
|
10750
|
+
dismissableSurfaces: context.dismissableSurfaces
|
|
10751
|
+
}
|
|
10752
|
+
);
|
|
10785
10753
|
const focusOutside = useFocusOutside((event) => {
|
|
10754
|
+
if (deferPointerDownOutside && isDeferredPointerDownOutsideRef.current) {
|
|
10755
|
+
return;
|
|
10756
|
+
}
|
|
10786
10757
|
const target = event.target;
|
|
10787
10758
|
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
10788
10759
|
if (isFocusInBranch) return;
|
|
@@ -10811,8 +10782,11 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
10811
10782
|
context.layers.add(node);
|
|
10812
10783
|
dispatchUpdate();
|
|
10813
10784
|
return () => {
|
|
10814
|
-
if (disableOutsidePointerEvents
|
|
10815
|
-
|
|
10785
|
+
if (disableOutsidePointerEvents) {
|
|
10786
|
+
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
10787
|
+
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
10788
|
+
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
10789
|
+
}
|
|
10816
10790
|
}
|
|
10817
10791
|
};
|
|
10818
10792
|
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
@@ -10830,7 +10804,7 @@ var DismissableLayer = React__namespace.forwardRef(
|
|
|
10830
10804
|
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
10831
10805
|
}, []);
|
|
10832
10806
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10833
|
-
Primitive
|
|
10807
|
+
Primitive.div,
|
|
10834
10808
|
{
|
|
10835
10809
|
...layerProps,
|
|
10836
10810
|
ref: composedRefs,
|
|
@@ -10863,38 +10837,97 @@ var DismissableLayerBranch = React__namespace.forwardRef((props, forwardedRef) =
|
|
|
10863
10837
|
};
|
|
10864
10838
|
}
|
|
10865
10839
|
}, [context.branches]);
|
|
10866
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Primitive
|
|
10840
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
10867
10841
|
});
|
|
10868
10842
|
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
10869
|
-
function usePointerDownOutside(onPointerDownOutside,
|
|
10843
|
+
function usePointerDownOutside(onPointerDownOutside, args) {
|
|
10844
|
+
const {
|
|
10845
|
+
ownerDocument = globalThis == null ? void 0 : globalThis.document,
|
|
10846
|
+
deferPointerDownOutside = false,
|
|
10847
|
+
isDeferredPointerDownOutsideRef,
|
|
10848
|
+
dismissableSurfaces
|
|
10849
|
+
} = args;
|
|
10870
10850
|
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
10871
10851
|
const isPointerInsideReactTreeRef = React__namespace.useRef(false);
|
|
10852
|
+
const isPointerDownOutsideRef = React__namespace.useRef(false);
|
|
10853
|
+
const interceptedOutsideInteractionEventsRef = React__namespace.useRef(/* @__PURE__ */ new Map());
|
|
10872
10854
|
const handleClickRef = React__namespace.useRef(() => {
|
|
10873
10855
|
});
|
|
10874
10856
|
React__namespace.useEffect(() => {
|
|
10857
|
+
function resetOutsideInteraction() {
|
|
10858
|
+
isPointerDownOutsideRef.current = false;
|
|
10859
|
+
isDeferredPointerDownOutsideRef.current = false;
|
|
10860
|
+
interceptedOutsideInteractionEventsRef.current.clear();
|
|
10861
|
+
}
|
|
10862
|
+
function isOutsideInteractionIntercepted() {
|
|
10863
|
+
return Array.from(interceptedOutsideInteractionEventsRef.current.values()).some(Boolean);
|
|
10864
|
+
}
|
|
10865
|
+
function handleInteractionCapture(event) {
|
|
10866
|
+
if (!isPointerDownOutsideRef.current) {
|
|
10867
|
+
return;
|
|
10868
|
+
}
|
|
10869
|
+
const target = event.target;
|
|
10870
|
+
const isDismissableSurface = target instanceof Node && [...dismissableSurfaces].some((surface) => surface.contains(target));
|
|
10871
|
+
if (!isDismissableSurface) {
|
|
10872
|
+
interceptedOutsideInteractionEventsRef.current.set(event.type, true);
|
|
10873
|
+
}
|
|
10874
|
+
if (event.type === "click") {
|
|
10875
|
+
window.setTimeout(() => {
|
|
10876
|
+
if (isPointerDownOutsideRef.current) {
|
|
10877
|
+
handleClickRef.current();
|
|
10878
|
+
}
|
|
10879
|
+
}, 0);
|
|
10880
|
+
}
|
|
10881
|
+
}
|
|
10882
|
+
function handleInteractionBubble(event) {
|
|
10883
|
+
if (isPointerDownOutsideRef.current) {
|
|
10884
|
+
interceptedOutsideInteractionEventsRef.current.set(event.type, false);
|
|
10885
|
+
}
|
|
10886
|
+
}
|
|
10875
10887
|
const handlePointerDown = (event) => {
|
|
10876
10888
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
10877
10889
|
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10890
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
10891
|
+
const wasOutsideInteractionIntercepted = isOutsideInteractionIntercepted();
|
|
10892
|
+
resetOutsideInteraction();
|
|
10893
|
+
if (!wasOutsideInteractionIntercepted) {
|
|
10894
|
+
handleAndDispatchCustomEvent(
|
|
10895
|
+
POINTER_DOWN_OUTSIDE,
|
|
10896
|
+
handlePointerDownOutside,
|
|
10897
|
+
eventDetail,
|
|
10898
|
+
{ discrete: true }
|
|
10899
|
+
);
|
|
10900
|
+
}
|
|
10884
10901
|
};
|
|
10885
10902
|
const eventDetail = { originalEvent: event };
|
|
10886
|
-
|
|
10903
|
+
isPointerDownOutsideRef.current = true;
|
|
10904
|
+
isDeferredPointerDownOutsideRef.current = deferPointerDownOutside && event.button === 0;
|
|
10905
|
+
interceptedOutsideInteractionEventsRef.current.clear();
|
|
10906
|
+
if (!deferPointerDownOutside || event.button !== 0) {
|
|
10907
|
+
handleAndDispatchPointerDownOutsideEvent2();
|
|
10908
|
+
} else {
|
|
10887
10909
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
10888
10910
|
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
10889
10911
|
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
10890
|
-
} else {
|
|
10891
|
-
handleAndDispatchPointerDownOutsideEvent2();
|
|
10892
10912
|
}
|
|
10893
10913
|
} else {
|
|
10894
10914
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
10915
|
+
resetOutsideInteraction();
|
|
10895
10916
|
}
|
|
10896
10917
|
isPointerInsideReactTreeRef.current = false;
|
|
10897
10918
|
};
|
|
10919
|
+
const outsideInteractionEvents = [
|
|
10920
|
+
"pointerup",
|
|
10921
|
+
"mousedown",
|
|
10922
|
+
"mouseup",
|
|
10923
|
+
"touchstart",
|
|
10924
|
+
"touchend",
|
|
10925
|
+
"click"
|
|
10926
|
+
];
|
|
10927
|
+
for (const eventName of outsideInteractionEvents) {
|
|
10928
|
+
ownerDocument.addEventListener(eventName, handleInteractionCapture, true);
|
|
10929
|
+
ownerDocument.addEventListener(eventName, handleInteractionBubble);
|
|
10930
|
+
}
|
|
10898
10931
|
const timerId = window.setTimeout(() => {
|
|
10899
10932
|
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
10900
10933
|
}, 0);
|
|
@@ -10902,8 +10935,18 @@ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis
|
|
|
10902
10935
|
window.clearTimeout(timerId);
|
|
10903
10936
|
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
10904
10937
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
10938
|
+
for (const eventName of outsideInteractionEvents) {
|
|
10939
|
+
ownerDocument.removeEventListener(eventName, handleInteractionCapture, true);
|
|
10940
|
+
ownerDocument.removeEventListener(eventName, handleInteractionBubble);
|
|
10941
|
+
}
|
|
10905
10942
|
};
|
|
10906
|
-
}, [
|
|
10943
|
+
}, [
|
|
10944
|
+
ownerDocument,
|
|
10945
|
+
handlePointerDownOutside,
|
|
10946
|
+
deferPointerDownOutside,
|
|
10947
|
+
isDeferredPointerDownOutsideRef,
|
|
10948
|
+
dismissableSurfaces
|
|
10949
|
+
]);
|
|
10907
10950
|
return {
|
|
10908
10951
|
// ensures we check React component tree (not just DOM tree)
|
|
10909
10952
|
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
@@ -10943,38 +10986,6 @@ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
|
10943
10986
|
target.dispatchEvent(event);
|
|
10944
10987
|
}
|
|
10945
10988
|
}
|
|
10946
|
-
var NODES$3 = [
|
|
10947
|
-
"a",
|
|
10948
|
-
"button",
|
|
10949
|
-
"div",
|
|
10950
|
-
"form",
|
|
10951
|
-
"h2",
|
|
10952
|
-
"h3",
|
|
10953
|
-
"img",
|
|
10954
|
-
"input",
|
|
10955
|
-
"label",
|
|
10956
|
-
"li",
|
|
10957
|
-
"nav",
|
|
10958
|
-
"ol",
|
|
10959
|
-
"p",
|
|
10960
|
-
"select",
|
|
10961
|
-
"span",
|
|
10962
|
-
"svg",
|
|
10963
|
-
"ul"
|
|
10964
|
-
];
|
|
10965
|
-
var Primitive$3 = NODES$3.reduce((primitive, node) => {
|
|
10966
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
10967
|
-
const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
10968
|
-
const { asChild, ...primitiveProps } = props;
|
|
10969
|
-
const Comp = asChild ? Slot2 : node;
|
|
10970
|
-
if (typeof window !== "undefined") {
|
|
10971
|
-
window[Symbol.for("radix-ui")] = true;
|
|
10972
|
-
}
|
|
10973
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
10974
|
-
});
|
|
10975
|
-
Node4.displayName = `Primitive.${node}`;
|
|
10976
|
-
return { ...primitive, [node]: Node4 };
|
|
10977
|
-
}, {});
|
|
10978
10989
|
var PORTAL_NAME$1 = "Portal";
|
|
10979
10990
|
var Portal$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
10980
10991
|
var _a2;
|
|
@@ -10982,152 +10993,9 @@ var Portal$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
|
10982
10993
|
const [mounted, setMounted] = React__namespace.useState(false);
|
|
10983
10994
|
useLayoutEffect2(() => setMounted(true), []);
|
|
10984
10995
|
const container = containerProp || mounted && ((_a2 = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a2.body);
|
|
10985
|
-
return container ?
|
|
10996
|
+
return container ? ReactDOM__namespace.createPortal(/* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
10986
10997
|
});
|
|
10987
10998
|
Portal$1.displayName = PORTAL_NAME$1;
|
|
10988
|
-
var shim$1 = { exports: {} };
|
|
10989
|
-
var useSyncExternalStoreShim_production = {};
|
|
10990
|
-
/**
|
|
10991
|
-
* @license React
|
|
10992
|
-
* use-sync-external-store-shim.production.js
|
|
10993
|
-
*
|
|
10994
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
10995
|
-
*
|
|
10996
|
-
* This source code is licensed under the MIT license found in the
|
|
10997
|
-
* LICENSE file in the root directory of this source tree.
|
|
10998
|
-
*/
|
|
10999
|
-
var hasRequiredUseSyncExternalStoreShim_production;
|
|
11000
|
-
function requireUseSyncExternalStoreShim_production() {
|
|
11001
|
-
if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
|
|
11002
|
-
hasRequiredUseSyncExternalStoreShim_production = 1;
|
|
11003
|
-
var React$1 = React;
|
|
11004
|
-
function is(x, y) {
|
|
11005
|
-
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
11006
|
-
}
|
|
11007
|
-
var objectIs = "function" === typeof Object.is ? Object.is : is, useState = React$1.useState, useEffect = React$1.useEffect, useLayoutEffect = React$1.useLayoutEffect, useDebugValue = React$1.useDebugValue;
|
|
11008
|
-
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
11009
|
-
var value = getSnapshot(), _useState = useState({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
11010
|
-
useLayoutEffect(
|
|
11011
|
-
function() {
|
|
11012
|
-
inst.value = value;
|
|
11013
|
-
inst.getSnapshot = getSnapshot;
|
|
11014
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
11015
|
-
},
|
|
11016
|
-
[subscribe, value, getSnapshot]
|
|
11017
|
-
);
|
|
11018
|
-
useEffect(
|
|
11019
|
-
function() {
|
|
11020
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
11021
|
-
return subscribe(function() {
|
|
11022
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
11023
|
-
});
|
|
11024
|
-
},
|
|
11025
|
-
[subscribe]
|
|
11026
|
-
);
|
|
11027
|
-
useDebugValue(value);
|
|
11028
|
-
return value;
|
|
11029
|
-
}
|
|
11030
|
-
function checkIfSnapshotChanged(inst) {
|
|
11031
|
-
var latestGetSnapshot = inst.getSnapshot;
|
|
11032
|
-
inst = inst.value;
|
|
11033
|
-
try {
|
|
11034
|
-
var nextValue = latestGetSnapshot();
|
|
11035
|
-
return !objectIs(inst, nextValue);
|
|
11036
|
-
} catch (error2) {
|
|
11037
|
-
return true;
|
|
11038
|
-
}
|
|
11039
|
-
}
|
|
11040
|
-
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
11041
|
-
return getSnapshot();
|
|
11042
|
-
}
|
|
11043
|
-
var shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
11044
|
-
useSyncExternalStoreShim_production.useSyncExternalStore = void 0 !== React$1.useSyncExternalStore ? React$1.useSyncExternalStore : shim2;
|
|
11045
|
-
return useSyncExternalStoreShim_production;
|
|
11046
|
-
}
|
|
11047
|
-
var useSyncExternalStoreShim_development$1 = {};
|
|
11048
|
-
/**
|
|
11049
|
-
* @license React
|
|
11050
|
-
* use-sync-external-store-shim.development.js
|
|
11051
|
-
*
|
|
11052
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
11053
|
-
*
|
|
11054
|
-
* This source code is licensed under the MIT license found in the
|
|
11055
|
-
* LICENSE file in the root directory of this source tree.
|
|
11056
|
-
*/
|
|
11057
|
-
var hasRequiredUseSyncExternalStoreShim_development$1;
|
|
11058
|
-
function requireUseSyncExternalStoreShim_development$1() {
|
|
11059
|
-
if (hasRequiredUseSyncExternalStoreShim_development$1) return useSyncExternalStoreShim_development$1;
|
|
11060
|
-
hasRequiredUseSyncExternalStoreShim_development$1 = 1;
|
|
11061
|
-
"production" !== process.env.NODE_ENV && (function() {
|
|
11062
|
-
function is(x, y) {
|
|
11063
|
-
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
11064
|
-
}
|
|
11065
|
-
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
11066
|
-
didWarnOld18Alpha || void 0 === React$1.startTransition || (didWarnOld18Alpha = true, console.error(
|
|
11067
|
-
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
11068
|
-
));
|
|
11069
|
-
var value = getSnapshot();
|
|
11070
|
-
if (!didWarnUncachedGetSnapshot) {
|
|
11071
|
-
var cachedValue = getSnapshot();
|
|
11072
|
-
objectIs(value, cachedValue) || (console.error(
|
|
11073
|
-
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
11074
|
-
), didWarnUncachedGetSnapshot = true);
|
|
11075
|
-
}
|
|
11076
|
-
cachedValue = useState({
|
|
11077
|
-
inst: { value, getSnapshot }
|
|
11078
|
-
});
|
|
11079
|
-
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
11080
|
-
useLayoutEffect(
|
|
11081
|
-
function() {
|
|
11082
|
-
inst.value = value;
|
|
11083
|
-
inst.getSnapshot = getSnapshot;
|
|
11084
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
11085
|
-
},
|
|
11086
|
-
[subscribe, value, getSnapshot]
|
|
11087
|
-
);
|
|
11088
|
-
useEffect(
|
|
11089
|
-
function() {
|
|
11090
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
11091
|
-
return subscribe(function() {
|
|
11092
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
11093
|
-
});
|
|
11094
|
-
},
|
|
11095
|
-
[subscribe]
|
|
11096
|
-
);
|
|
11097
|
-
useDebugValue(value);
|
|
11098
|
-
return value;
|
|
11099
|
-
}
|
|
11100
|
-
function checkIfSnapshotChanged(inst) {
|
|
11101
|
-
var latestGetSnapshot = inst.getSnapshot;
|
|
11102
|
-
inst = inst.value;
|
|
11103
|
-
try {
|
|
11104
|
-
var nextValue = latestGetSnapshot();
|
|
11105
|
-
return !objectIs(inst, nextValue);
|
|
11106
|
-
} catch (error2) {
|
|
11107
|
-
return true;
|
|
11108
|
-
}
|
|
11109
|
-
}
|
|
11110
|
-
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
11111
|
-
return getSnapshot();
|
|
11112
|
-
}
|
|
11113
|
-
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
11114
|
-
var React$1 = React, objectIs = "function" === typeof Object.is ? Object.is : is, useState = React$1.useState, useEffect = React$1.useEffect, useLayoutEffect = React$1.useLayoutEffect, useDebugValue = React$1.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
11115
|
-
useSyncExternalStoreShim_development$1.useSyncExternalStore = void 0 !== React$1.useSyncExternalStore ? React$1.useSyncExternalStore : shim2;
|
|
11116
|
-
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
11117
|
-
})();
|
|
11118
|
-
return useSyncExternalStoreShim_development$1;
|
|
11119
|
-
}
|
|
11120
|
-
var hasRequiredShim;
|
|
11121
|
-
function requireShim() {
|
|
11122
|
-
if (hasRequiredShim) return shim$1.exports;
|
|
11123
|
-
hasRequiredShim = 1;
|
|
11124
|
-
if (process.env.NODE_ENV === "production") {
|
|
11125
|
-
shim$1.exports = requireUseSyncExternalStoreShim_production();
|
|
11126
|
-
} else {
|
|
11127
|
-
shim$1.exports = requireUseSyncExternalStoreShim_development$1();
|
|
11128
|
-
}
|
|
11129
|
-
return shim$1.exports;
|
|
11130
|
-
}
|
|
11131
10999
|
function useSize(element) {
|
|
11132
11000
|
const [size2, setSize] = React__namespace.useState(void 0);
|
|
11133
11001
|
useLayoutEffect2(() => {
|
|
@@ -13077,43 +12945,11 @@ const arrow$2 = (options, deps) => {
|
|
|
13077
12945
|
options: [options, deps]
|
|
13078
12946
|
};
|
|
13079
12947
|
};
|
|
13080
|
-
var NODES$2 = [
|
|
13081
|
-
"a",
|
|
13082
|
-
"button",
|
|
13083
|
-
"div",
|
|
13084
|
-
"form",
|
|
13085
|
-
"h2",
|
|
13086
|
-
"h3",
|
|
13087
|
-
"img",
|
|
13088
|
-
"input",
|
|
13089
|
-
"label",
|
|
13090
|
-
"li",
|
|
13091
|
-
"nav",
|
|
13092
|
-
"ol",
|
|
13093
|
-
"p",
|
|
13094
|
-
"select",
|
|
13095
|
-
"span",
|
|
13096
|
-
"svg",
|
|
13097
|
-
"ul"
|
|
13098
|
-
];
|
|
13099
|
-
var Primitive$2 = NODES$2.reduce((primitive, node) => {
|
|
13100
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
13101
|
-
const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
13102
|
-
const { asChild, ...primitiveProps } = props;
|
|
13103
|
-
const Comp = asChild ? Slot2 : node;
|
|
13104
|
-
if (typeof window !== "undefined") {
|
|
13105
|
-
window[Symbol.for("radix-ui")] = true;
|
|
13106
|
-
}
|
|
13107
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
13108
|
-
});
|
|
13109
|
-
Node4.displayName = `Primitive.${node}`;
|
|
13110
|
-
return { ...primitive, [node]: Node4 };
|
|
13111
|
-
}, {});
|
|
13112
12948
|
var NAME = "Arrow";
|
|
13113
12949
|
var Arrow$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
13114
12950
|
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
13115
12951
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13116
|
-
Primitive
|
|
12952
|
+
Primitive.svg,
|
|
13117
12953
|
{
|
|
13118
12954
|
...arrowProps,
|
|
13119
12955
|
ref: forwardedRef,
|
|
@@ -13127,104 +12963,24 @@ var Arrow$1 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
|
13127
12963
|
});
|
|
13128
12964
|
Arrow$1.displayName = NAME;
|
|
13129
12965
|
var Root = Arrow$1;
|
|
13130
|
-
function createContextScope$1(scopeName, createContextScopeDeps = []) {
|
|
13131
|
-
let defaultContexts = [];
|
|
13132
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
13133
|
-
const BaseContext = React__namespace.createContext(defaultContext);
|
|
13134
|
-
const index2 = defaultContexts.length;
|
|
13135
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
13136
|
-
const Provider2 = (props) => {
|
|
13137
|
-
var _a2;
|
|
13138
|
-
const { scope, children, ...context } = props;
|
|
13139
|
-
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
|
|
13140
|
-
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
13141
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
13142
|
-
};
|
|
13143
|
-
Provider2.displayName = rootComponentName + "Provider";
|
|
13144
|
-
function useContext2(consumerName, scope) {
|
|
13145
|
-
var _a2;
|
|
13146
|
-
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
|
|
13147
|
-
const context = React__namespace.useContext(Context);
|
|
13148
|
-
if (context) return context;
|
|
13149
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
13150
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
13151
|
-
}
|
|
13152
|
-
return [Provider2, useContext2];
|
|
13153
|
-
}
|
|
13154
|
-
const createScope = () => {
|
|
13155
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
13156
|
-
return React__namespace.createContext(defaultContext);
|
|
13157
|
-
});
|
|
13158
|
-
return function useScope(scope) {
|
|
13159
|
-
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
13160
|
-
return React__namespace.useMemo(
|
|
13161
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
13162
|
-
[scope, contexts]
|
|
13163
|
-
);
|
|
13164
|
-
};
|
|
13165
|
-
};
|
|
13166
|
-
createScope.scopeName = scopeName;
|
|
13167
|
-
return [createContext3, composeContextScopes$1(createScope, ...createContextScopeDeps)];
|
|
13168
|
-
}
|
|
13169
|
-
function composeContextScopes$1(...scopes) {
|
|
13170
|
-
const baseScope = scopes[0];
|
|
13171
|
-
if (scopes.length === 1) return baseScope;
|
|
13172
|
-
const createScope = () => {
|
|
13173
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
13174
|
-
useScope: createScope2(),
|
|
13175
|
-
scopeName: createScope2.scopeName
|
|
13176
|
-
}));
|
|
13177
|
-
return function useComposedScopes(overrideScopes) {
|
|
13178
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
13179
|
-
const scopeProps = useScope(overrideScopes);
|
|
13180
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
13181
|
-
return { ...nextScopes2, ...currentScope };
|
|
13182
|
-
}, {});
|
|
13183
|
-
return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
13184
|
-
};
|
|
13185
|
-
};
|
|
13186
|
-
createScope.scopeName = baseScope.scopeName;
|
|
13187
|
-
return createScope;
|
|
13188
|
-
}
|
|
13189
|
-
var NODES$1 = [
|
|
13190
|
-
"a",
|
|
13191
|
-
"button",
|
|
13192
|
-
"div",
|
|
13193
|
-
"form",
|
|
13194
|
-
"h2",
|
|
13195
|
-
"h3",
|
|
13196
|
-
"img",
|
|
13197
|
-
"input",
|
|
13198
|
-
"label",
|
|
13199
|
-
"li",
|
|
13200
|
-
"nav",
|
|
13201
|
-
"ol",
|
|
13202
|
-
"p",
|
|
13203
|
-
"select",
|
|
13204
|
-
"span",
|
|
13205
|
-
"svg",
|
|
13206
|
-
"ul"
|
|
13207
|
-
];
|
|
13208
|
-
var Primitive$1 = NODES$1.reduce((primitive, node) => {
|
|
13209
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
13210
|
-
const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
13211
|
-
const { asChild, ...primitiveProps } = props;
|
|
13212
|
-
const Comp = asChild ? Slot2 : node;
|
|
13213
|
-
if (typeof window !== "undefined") {
|
|
13214
|
-
window[Symbol.for("radix-ui")] = true;
|
|
13215
|
-
}
|
|
13216
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
13217
|
-
});
|
|
13218
|
-
Node4.displayName = `Primitive.${node}`;
|
|
13219
|
-
return { ...primitive, [node]: Node4 };
|
|
13220
|
-
}, {});
|
|
13221
12966
|
var POPPER_NAME = "Popper";
|
|
13222
|
-
var [createPopperContext, createPopperScope] = createContextScope
|
|
12967
|
+
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
13223
12968
|
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
13224
12969
|
var Popper = (props) => {
|
|
13225
12970
|
const { __scopePopper, children } = props;
|
|
13226
12971
|
const [anchor, setAnchor] = React__namespace.useState(null);
|
|
13227
|
-
|
|
12972
|
+
const [placementState, setPlacementState] = React__namespace.useState(void 0);
|
|
12973
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12974
|
+
PopperProvider,
|
|
12975
|
+
{
|
|
12976
|
+
scope: __scopePopper,
|
|
12977
|
+
anchor,
|
|
12978
|
+
onAnchorChange: setAnchor,
|
|
12979
|
+
placementState,
|
|
12980
|
+
setPlacementState,
|
|
12981
|
+
children
|
|
12982
|
+
}
|
|
12983
|
+
);
|
|
13228
12984
|
};
|
|
13229
12985
|
Popper.displayName = POPPER_NAME;
|
|
13230
12986
|
var ANCHOR_NAME = "PopperAnchor";
|
|
@@ -13233,16 +12989,40 @@ var PopperAnchor = React__namespace.forwardRef(
|
|
|
13233
12989
|
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
13234
12990
|
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
13235
12991
|
const ref = React__namespace.useRef(null);
|
|
13236
|
-
const
|
|
12992
|
+
const onAnchorChange = context.onAnchorChange;
|
|
12993
|
+
const callbackRef = React__namespace.useCallback(
|
|
12994
|
+
(node) => {
|
|
12995
|
+
ref.current = node;
|
|
12996
|
+
if (node) {
|
|
12997
|
+
onAnchorChange(node);
|
|
12998
|
+
}
|
|
12999
|
+
},
|
|
13000
|
+
[onAnchorChange]
|
|
13001
|
+
);
|
|
13002
|
+
const composedRefs = useComposedRefs(forwardedRef, callbackRef);
|
|
13237
13003
|
const anchorRef = React__namespace.useRef(null);
|
|
13238
13004
|
React__namespace.useEffect(() => {
|
|
13005
|
+
if (!virtualRef) {
|
|
13006
|
+
return;
|
|
13007
|
+
}
|
|
13239
13008
|
const previousAnchor = anchorRef.current;
|
|
13240
|
-
anchorRef.current =
|
|
13009
|
+
anchorRef.current = virtualRef.current;
|
|
13241
13010
|
if (previousAnchor !== anchorRef.current) {
|
|
13242
|
-
|
|
13011
|
+
onAnchorChange(anchorRef.current);
|
|
13243
13012
|
}
|
|
13244
13013
|
});
|
|
13245
|
-
|
|
13014
|
+
const sideAndAlign = context.placementState && getSideAndAlignFromPlacement(context.placementState);
|
|
13015
|
+
const placedSide = sideAndAlign == null ? void 0 : sideAndAlign[0];
|
|
13016
|
+
const placedAlign = sideAndAlign == null ? void 0 : sideAndAlign[1];
|
|
13017
|
+
return virtualRef ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
13018
|
+
Primitive.div,
|
|
13019
|
+
{
|
|
13020
|
+
"data-radix-popper-side": placedSide,
|
|
13021
|
+
"data-radix-popper-align": placedAlign,
|
|
13022
|
+
...anchorProps,
|
|
13023
|
+
ref: composedRefs
|
|
13024
|
+
}
|
|
13025
|
+
);
|
|
13246
13026
|
}
|
|
13247
13027
|
);
|
|
13248
13028
|
PopperAnchor.displayName = ANCHOR_NAME;
|
|
@@ -13319,9 +13099,27 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
13319
13099
|
}),
|
|
13320
13100
|
arrow2 && arrow$2({ element: arrow2, padding: arrowPadding }),
|
|
13321
13101
|
transformOrigin({ arrowWidth, arrowHeight }),
|
|
13322
|
-
hideWhenDetached && hide({
|
|
13102
|
+
hideWhenDetached && hide({
|
|
13103
|
+
strategy: "referenceHidden",
|
|
13104
|
+
...detectOverflowOptions,
|
|
13105
|
+
// `hide` detects whether the anchor (reference) is clipped, so when
|
|
13106
|
+
// no explicit `collisionBoundary` is set we fall back to Floating
|
|
13107
|
+
// UI's default clipping ancestors (e.g. a scrollable menu). This
|
|
13108
|
+
// lets an occluded submenu hide once its anchor scrolls out of view
|
|
13109
|
+
// (#3237). The collision/size middlewares deliberately keep the
|
|
13110
|
+
// viewport-based default to avoid clamping content rendered inside
|
|
13111
|
+
// transformed or overflow-clipping portal containers.
|
|
13112
|
+
boundary: hasExplicitBoundaries ? detectOverflowOptions.boundary : void 0
|
|
13113
|
+
})
|
|
13323
13114
|
]
|
|
13324
13115
|
});
|
|
13116
|
+
const setPlacementState = context.setPlacementState;
|
|
13117
|
+
useLayoutEffect2(() => {
|
|
13118
|
+
setPlacementState(placement);
|
|
13119
|
+
return () => {
|
|
13120
|
+
setPlacementState(void 0);
|
|
13121
|
+
};
|
|
13122
|
+
}, [placement, setPlacementState]);
|
|
13325
13123
|
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
13326
13124
|
const handlePlaced = useCallbackRef(onPlaced);
|
|
13327
13125
|
useLayoutEffect2(() => {
|
|
@@ -13347,7 +13145,7 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
13347
13145
|
// keep off the page when measuring
|
|
13348
13146
|
minWidth: "max-content",
|
|
13349
13147
|
zIndex: contentZIndex,
|
|
13350
|
-
|
|
13148
|
+
"--radix-popper-transform-origin": [
|
|
13351
13149
|
(_d = middlewareData.transformOrigin) == null ? void 0 : _d.x,
|
|
13352
13150
|
(_e = middlewareData.transformOrigin) == null ? void 0 : _e.y
|
|
13353
13151
|
].join(" "),
|
|
@@ -13365,12 +13163,13 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
13365
13163
|
{
|
|
13366
13164
|
scope: __scopePopper,
|
|
13367
13165
|
placedSide,
|
|
13166
|
+
placedAlign,
|
|
13368
13167
|
onArrowChange: setArrow,
|
|
13369
13168
|
arrowX,
|
|
13370
13169
|
arrowY,
|
|
13371
13170
|
shouldHideArrow: cannotCenterArrow,
|
|
13372
13171
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13373
|
-
Primitive
|
|
13172
|
+
Primitive.div,
|
|
13374
13173
|
{
|
|
13375
13174
|
"data-side": placedSide,
|
|
13376
13175
|
"data-align": placedAlign,
|
|
@@ -13489,97 +13288,6 @@ var Root2 = Popper;
|
|
|
13489
13288
|
var Anchor = PopperAnchor;
|
|
13490
13289
|
var Content = PopperContent;
|
|
13491
13290
|
var Arrow = PopperArrow;
|
|
13492
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
13493
|
-
let defaultContexts = [];
|
|
13494
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
13495
|
-
const BaseContext = React__namespace.createContext(defaultContext);
|
|
13496
|
-
const index2 = defaultContexts.length;
|
|
13497
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
13498
|
-
const Provider2 = (props) => {
|
|
13499
|
-
var _a2;
|
|
13500
|
-
const { scope, children, ...context } = props;
|
|
13501
|
-
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
|
|
13502
|
-
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
13503
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
13504
|
-
};
|
|
13505
|
-
Provider2.displayName = rootComponentName + "Provider";
|
|
13506
|
-
function useContext2(consumerName, scope) {
|
|
13507
|
-
var _a2;
|
|
13508
|
-
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
|
|
13509
|
-
const context = React__namespace.useContext(Context);
|
|
13510
|
-
if (context) return context;
|
|
13511
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
13512
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
13513
|
-
}
|
|
13514
|
-
return [Provider2, useContext2];
|
|
13515
|
-
}
|
|
13516
|
-
const createScope = () => {
|
|
13517
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
13518
|
-
return React__namespace.createContext(defaultContext);
|
|
13519
|
-
});
|
|
13520
|
-
return function useScope(scope) {
|
|
13521
|
-
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
13522
|
-
return React__namespace.useMemo(
|
|
13523
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
13524
|
-
[scope, contexts]
|
|
13525
|
-
);
|
|
13526
|
-
};
|
|
13527
|
-
};
|
|
13528
|
-
createScope.scopeName = scopeName;
|
|
13529
|
-
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
13530
|
-
}
|
|
13531
|
-
function composeContextScopes(...scopes) {
|
|
13532
|
-
const baseScope = scopes[0];
|
|
13533
|
-
if (scopes.length === 1) return baseScope;
|
|
13534
|
-
const createScope = () => {
|
|
13535
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
13536
|
-
useScope: createScope2(),
|
|
13537
|
-
scopeName: createScope2.scopeName
|
|
13538
|
-
}));
|
|
13539
|
-
return function useComposedScopes(overrideScopes) {
|
|
13540
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
13541
|
-
const scopeProps = useScope(overrideScopes);
|
|
13542
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
13543
|
-
return { ...nextScopes2, ...currentScope };
|
|
13544
|
-
}, {});
|
|
13545
|
-
return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
13546
|
-
};
|
|
13547
|
-
};
|
|
13548
|
-
createScope.scopeName = baseScope.scopeName;
|
|
13549
|
-
return createScope;
|
|
13550
|
-
}
|
|
13551
|
-
var NODES = [
|
|
13552
|
-
"a",
|
|
13553
|
-
"button",
|
|
13554
|
-
"div",
|
|
13555
|
-
"form",
|
|
13556
|
-
"h2",
|
|
13557
|
-
"h3",
|
|
13558
|
-
"img",
|
|
13559
|
-
"input",
|
|
13560
|
-
"label",
|
|
13561
|
-
"li",
|
|
13562
|
-
"nav",
|
|
13563
|
-
"ol",
|
|
13564
|
-
"p",
|
|
13565
|
-
"select",
|
|
13566
|
-
"span",
|
|
13567
|
-
"svg",
|
|
13568
|
-
"ul"
|
|
13569
|
-
];
|
|
13570
|
-
var Primitive = NODES.reduce((primitive, node) => {
|
|
13571
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
13572
|
-
const Node4 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
13573
|
-
const { asChild, ...primitiveProps } = props;
|
|
13574
|
-
const Comp = asChild ? Slot2 : node;
|
|
13575
|
-
if (typeof window !== "undefined") {
|
|
13576
|
-
window[Symbol.for("radix-ui")] = true;
|
|
13577
|
-
}
|
|
13578
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
13579
|
-
});
|
|
13580
|
-
Node4.displayName = `Primitive.${node}`;
|
|
13581
|
-
return { ...primitive, [node]: Node4 };
|
|
13582
|
-
}, {});
|
|
13583
13291
|
var [createTooltipContext] = createContextScope("Tooltip", [
|
|
13584
13292
|
createPopperScope
|
|
13585
13293
|
]);
|
|
@@ -13610,10 +13318,12 @@ var TooltipProvider$1 = (props) => {
|
|
|
13610
13318
|
isOpenDelayedRef,
|
|
13611
13319
|
delayDuration,
|
|
13612
13320
|
onOpen: React__namespace.useCallback(() => {
|
|
13321
|
+
if (skipDelayDuration <= 0) return;
|
|
13613
13322
|
window.clearTimeout(skipDelayTimerRef.current);
|
|
13614
13323
|
isOpenDelayedRef.current = false;
|
|
13615
|
-
}, []),
|
|
13324
|
+
}, [skipDelayDuration]),
|
|
13616
13325
|
onClose: React__namespace.useCallback(() => {
|
|
13326
|
+
if (skipDelayDuration <= 0) return;
|
|
13617
13327
|
window.clearTimeout(skipDelayTimerRef.current);
|
|
13618
13328
|
skipDelayTimerRef.current = window.setTimeout(
|
|
13619
13329
|
() => isOpenDelayedRef.current = true,
|
|
@@ -13875,8 +13585,9 @@ var TooltipContentImpl = React__namespace.forwardRef(
|
|
|
13875
13585
|
React__namespace.useEffect(() => {
|
|
13876
13586
|
if (context.trigger) {
|
|
13877
13587
|
const handleScroll = (event) => {
|
|
13878
|
-
|
|
13879
|
-
|
|
13588
|
+
if (event.target instanceof Node && event.target.contains(context.trigger)) {
|
|
13589
|
+
onClose();
|
|
13590
|
+
}
|
|
13880
13591
|
};
|
|
13881
13592
|
window.addEventListener("scroll", handleScroll, { capture: true });
|
|
13882
13593
|
return () => window.removeEventListener("scroll", handleScroll, { capture: true });
|
|
@@ -32387,7 +32098,7 @@ function nodePasteRule(config2) {
|
|
|
32387
32098
|
function getDefaultExportFromCjs(x) {
|
|
32388
32099
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
32389
32100
|
}
|
|
32390
|
-
var shim = { exports: {} };
|
|
32101
|
+
var shim$1 = { exports: {} };
|
|
32391
32102
|
var useSyncExternalStoreShim_production_min = {};
|
|
32392
32103
|
/**
|
|
32393
32104
|
* @license React
|
|
@@ -32440,7 +32151,7 @@ function requireUseSyncExternalStoreShim_production_min() {
|
|
|
32440
32151
|
useSyncExternalStoreShim_production_min.useSyncExternalStore = void 0 !== e.useSyncExternalStore ? e.useSyncExternalStore : u;
|
|
32441
32152
|
return useSyncExternalStoreShim_production_min;
|
|
32442
32153
|
}
|
|
32443
|
-
var useSyncExternalStoreShim_development = {};
|
|
32154
|
+
var useSyncExternalStoreShim_development$1 = {};
|
|
32444
32155
|
/**
|
|
32445
32156
|
* @license React
|
|
32446
32157
|
* use-sync-external-store-shim.development.js
|
|
@@ -32450,10 +32161,10 @@ var useSyncExternalStoreShim_development = {};
|
|
|
32450
32161
|
* This source code is licensed under the MIT license found in the
|
|
32451
32162
|
* LICENSE file in the root directory of this source tree.
|
|
32452
32163
|
*/
|
|
32453
|
-
var hasRequiredUseSyncExternalStoreShim_development;
|
|
32454
|
-
function requireUseSyncExternalStoreShim_development() {
|
|
32455
|
-
if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
|
|
32456
|
-
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
32164
|
+
var hasRequiredUseSyncExternalStoreShim_development$1;
|
|
32165
|
+
function requireUseSyncExternalStoreShim_development$1() {
|
|
32166
|
+
if (hasRequiredUseSyncExternalStoreShim_development$1) return useSyncExternalStoreShim_development$1;
|
|
32167
|
+
hasRequiredUseSyncExternalStoreShim_development$1 = 1;
|
|
32457
32168
|
if (process.env.NODE_ENV !== "production") {
|
|
32458
32169
|
(function() {
|
|
32459
32170
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
|
@@ -32562,20 +32273,20 @@ function requireUseSyncExternalStoreShim_development() {
|
|
|
32562
32273
|
var isServerEnvironment = !canUseDOM;
|
|
32563
32274
|
var shim2 = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
|
|
32564
32275
|
var useSyncExternalStore$2 = React$1.useSyncExternalStore !== void 0 ? React$1.useSyncExternalStore : shim2;
|
|
32565
|
-
useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
|
|
32276
|
+
useSyncExternalStoreShim_development$1.useSyncExternalStore = useSyncExternalStore$2;
|
|
32566
32277
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
|
|
32567
32278
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
32568
32279
|
}
|
|
32569
32280
|
})();
|
|
32570
32281
|
}
|
|
32571
|
-
return useSyncExternalStoreShim_development;
|
|
32282
|
+
return useSyncExternalStoreShim_development$1;
|
|
32572
32283
|
}
|
|
32573
32284
|
if (process.env.NODE_ENV === "production") {
|
|
32574
|
-
shim.exports = requireUseSyncExternalStoreShim_production_min();
|
|
32285
|
+
shim$1.exports = requireUseSyncExternalStoreShim_production_min();
|
|
32575
32286
|
} else {
|
|
32576
|
-
shim.exports = requireUseSyncExternalStoreShim_development();
|
|
32287
|
+
shim$1.exports = requireUseSyncExternalStoreShim_development$1();
|
|
32577
32288
|
}
|
|
32578
|
-
var shimExports = shim.exports;
|
|
32289
|
+
var shimExports = shim$1.exports;
|
|
32579
32290
|
const mergeRefs = (...refs) => {
|
|
32580
32291
|
return (node) => {
|
|
32581
32292
|
refs.forEach((ref) => {
|
|
@@ -39912,6 +39623,9 @@ getDecoder(xmlDecodeTree);
|
|
|
39912
39623
|
function decodeHTML(str, mode = DecodingMode.Legacy) {
|
|
39913
39624
|
return htmlDecoder(str, mode);
|
|
39914
39625
|
}
|
|
39626
|
+
function decodeHTMLStrict(str) {
|
|
39627
|
+
return htmlDecoder(str, DecodingMode.Strict);
|
|
39628
|
+
}
|
|
39915
39629
|
function _class$1(obj) {
|
|
39916
39630
|
return Object.prototype.toString.call(obj);
|
|
39917
39631
|
}
|
|
@@ -40068,6 +39782,9 @@ function isWhiteSpace(code2) {
|
|
|
40068
39782
|
function isPunctChar(ch) {
|
|
40069
39783
|
return P.test(ch) || regex.test(ch);
|
|
40070
39784
|
}
|
|
39785
|
+
function isPunctCharCode(code2) {
|
|
39786
|
+
return isPunctChar(fromCodePoint(code2));
|
|
39787
|
+
}
|
|
40071
39788
|
function isMdAsciiPunct(ch) {
|
|
40072
39789
|
switch (ch) {
|
|
40073
39790
|
case 33:
|
|
@@ -40114,10 +39831,29 @@ function normalizeReference(str) {
|
|
|
40114
39831
|
}
|
|
40115
39832
|
return str.toLowerCase().toUpperCase();
|
|
40116
39833
|
}
|
|
39834
|
+
function isAsciiTrimmable(c) {
|
|
39835
|
+
return c === 32 || c === 9 || c === 10 || c === 13;
|
|
39836
|
+
}
|
|
39837
|
+
function asciiTrim(str) {
|
|
39838
|
+
let start = 0;
|
|
39839
|
+
for (; start < str.length; start++) {
|
|
39840
|
+
if (!isAsciiTrimmable(str.charCodeAt(start))) {
|
|
39841
|
+
break;
|
|
39842
|
+
}
|
|
39843
|
+
}
|
|
39844
|
+
let end = str.length - 1;
|
|
39845
|
+
for (; end >= start; end--) {
|
|
39846
|
+
if (!isAsciiTrimmable(str.charCodeAt(end))) {
|
|
39847
|
+
break;
|
|
39848
|
+
}
|
|
39849
|
+
}
|
|
39850
|
+
return str.slice(start, end + 1);
|
|
39851
|
+
}
|
|
40117
39852
|
const lib = { mdurl, ucmicro };
|
|
40118
39853
|
const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
40119
39854
|
__proto__: null,
|
|
40120
39855
|
arrayReplaceAt,
|
|
39856
|
+
asciiTrim,
|
|
40121
39857
|
assign: assign$1,
|
|
40122
39858
|
escapeHtml: escapeHtml$1,
|
|
40123
39859
|
escapeRE: escapeRE$1,
|
|
@@ -40125,6 +39861,7 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
40125
39861
|
has,
|
|
40126
39862
|
isMdAsciiPunct,
|
|
40127
39863
|
isPunctChar,
|
|
39864
|
+
isPunctCharCode,
|
|
40128
39865
|
isSpace,
|
|
40129
39866
|
isString: isString$1,
|
|
40130
39867
|
isValidEntityCode,
|
|
@@ -40852,12 +40589,27 @@ function replace(state) {
|
|
|
40852
40589
|
const QUOTE_TEST_RE = /['"]/;
|
|
40853
40590
|
const QUOTE_RE = /['"]/g;
|
|
40854
40591
|
const APOSTROPHE = "’";
|
|
40855
|
-
function
|
|
40856
|
-
|
|
40592
|
+
function addReplacement(replacements, tokenIdx, pos, ch) {
|
|
40593
|
+
if (!replacements[tokenIdx]) {
|
|
40594
|
+
replacements[tokenIdx] = [];
|
|
40595
|
+
}
|
|
40596
|
+
replacements[tokenIdx].push({ pos, ch });
|
|
40597
|
+
}
|
|
40598
|
+
function applyReplacements(str, replacements) {
|
|
40599
|
+
let result = "";
|
|
40600
|
+
let lastPos = 0;
|
|
40601
|
+
replacements.sort((a, b) => a.pos - b.pos);
|
|
40602
|
+
for (let i = 0; i < replacements.length; i++) {
|
|
40603
|
+
const replacement = replacements[i];
|
|
40604
|
+
result += str.slice(lastPos, replacement.pos) + replacement.ch;
|
|
40605
|
+
lastPos = replacement.pos + 1;
|
|
40606
|
+
}
|
|
40607
|
+
return result + str.slice(lastPos);
|
|
40857
40608
|
}
|
|
40858
40609
|
function process_inlines(tokens, state) {
|
|
40859
40610
|
let j;
|
|
40860
40611
|
const stack = [];
|
|
40612
|
+
const replacements = {};
|
|
40861
40613
|
for (let i = 0; i < tokens.length; i++) {
|
|
40862
40614
|
const token = tokens[i];
|
|
40863
40615
|
const thisLevel = tokens[i].level;
|
|
@@ -40870,9 +40622,9 @@ function process_inlines(tokens, state) {
|
|
|
40870
40622
|
if (token.type !== "text") {
|
|
40871
40623
|
continue;
|
|
40872
40624
|
}
|
|
40873
|
-
|
|
40625
|
+
const text2 = token.content;
|
|
40874
40626
|
let pos = 0;
|
|
40875
|
-
|
|
40627
|
+
const max2 = text2.length;
|
|
40876
40628
|
OUTER:
|
|
40877
40629
|
while (pos < max2) {
|
|
40878
40630
|
QUOTE_RE.lastIndex = pos;
|
|
@@ -40906,8 +40658,8 @@ function process_inlines(tokens, state) {
|
|
|
40906
40658
|
break;
|
|
40907
40659
|
}
|
|
40908
40660
|
}
|
|
40909
|
-
const isLastPunctChar = isMdAsciiPunct(lastChar) ||
|
|
40910
|
-
const isNextPunctChar = isMdAsciiPunct(nextChar) ||
|
|
40661
|
+
const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctCharCode(lastChar);
|
|
40662
|
+
const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctCharCode(nextChar);
|
|
40911
40663
|
const isLastWhiteSpace = isWhiteSpace(lastChar);
|
|
40912
40664
|
const isNextWhiteSpace = isWhiteSpace(nextChar);
|
|
40913
40665
|
if (isNextWhiteSpace) {
|
|
@@ -40935,7 +40687,7 @@ function process_inlines(tokens, state) {
|
|
|
40935
40687
|
}
|
|
40936
40688
|
if (!canOpen && !canClose) {
|
|
40937
40689
|
if (isSingle) {
|
|
40938
|
-
|
|
40690
|
+
addReplacement(replacements, i, t.index, APOSTROPHE);
|
|
40939
40691
|
}
|
|
40940
40692
|
continue;
|
|
40941
40693
|
}
|
|
@@ -40956,18 +40708,8 @@ function process_inlines(tokens, state) {
|
|
|
40956
40708
|
openQuote = state.md.options.quotes[0];
|
|
40957
40709
|
closeQuote = state.md.options.quotes[1];
|
|
40958
40710
|
}
|
|
40959
|
-
|
|
40960
|
-
|
|
40961
|
-
tokens[item.token].content,
|
|
40962
|
-
item.pos,
|
|
40963
|
-
openQuote
|
|
40964
|
-
);
|
|
40965
|
-
pos += closeQuote.length - 1;
|
|
40966
|
-
if (item.token === i) {
|
|
40967
|
-
pos += openQuote.length - 1;
|
|
40968
|
-
}
|
|
40969
|
-
text2 = token.content;
|
|
40970
|
-
max2 = text2.length;
|
|
40711
|
+
addReplacement(replacements, i, t.index, closeQuote);
|
|
40712
|
+
addReplacement(replacements, item.token, item.pos, openQuote);
|
|
40971
40713
|
stack.length = j;
|
|
40972
40714
|
continue OUTER;
|
|
40973
40715
|
}
|
|
@@ -40981,10 +40723,13 @@ function process_inlines(tokens, state) {
|
|
|
40981
40723
|
level: thisLevel
|
|
40982
40724
|
});
|
|
40983
40725
|
} else if (canClose && isSingle) {
|
|
40984
|
-
|
|
40726
|
+
addReplacement(replacements, i, t.index, APOSTROPHE);
|
|
40985
40727
|
}
|
|
40986
40728
|
}
|
|
40987
40729
|
}
|
|
40730
|
+
Object.keys(replacements).forEach(function(tokenIdx) {
|
|
40731
|
+
tokens[tokenIdx].content = applyReplacements(tokens[tokenIdx].content, replacements[tokenIdx]);
|
|
40732
|
+
});
|
|
40988
40733
|
}
|
|
40989
40734
|
function smartquotes(state) {
|
|
40990
40735
|
if (!state.md.options.typographer) {
|
|
@@ -42145,10 +41890,13 @@ function html_block(state, startLine, endLine, silent) {
|
|
|
42145
41890
|
return HTML_SEQUENCES[i][2];
|
|
42146
41891
|
}
|
|
42147
41892
|
let nextLine = startLine + 1;
|
|
41893
|
+
const endsOnBlankLine = HTML_SEQUENCES[i][1].test("");
|
|
42148
41894
|
if (!HTML_SEQUENCES[i][1].test(lineText)) {
|
|
42149
41895
|
for (; nextLine < endLine; nextLine++) {
|
|
42150
41896
|
if (state.sCount[nextLine] < state.blkIndent) {
|
|
42151
|
-
|
|
41897
|
+
if (endsOnBlankLine || !state.isEmpty(nextLine)) {
|
|
41898
|
+
break;
|
|
41899
|
+
}
|
|
42152
41900
|
}
|
|
42153
41901
|
pos = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
42154
41902
|
max2 = state.eMarks[nextLine];
|
|
@@ -42199,7 +41947,7 @@ function heading(state, startLine, endLine, silent) {
|
|
|
42199
41947
|
token_o.markup = "########".slice(0, level);
|
|
42200
41948
|
token_o.map = [startLine, state.line];
|
|
42201
41949
|
const token_i = state.push("inline", "", 0);
|
|
42202
|
-
token_i.content = state.src.slice(pos, max2)
|
|
41950
|
+
token_i.content = asciiTrim(state.src.slice(pos, max2));
|
|
42203
41951
|
token_i.map = [startLine, state.line];
|
|
42204
41952
|
token_i.children = [];
|
|
42205
41953
|
const token_c = state.push("heading_close", "h" + String(level), -1);
|
|
@@ -42250,9 +41998,10 @@ function lheading(state, startLine, endLine) {
|
|
|
42250
41998
|
}
|
|
42251
41999
|
}
|
|
42252
42000
|
if (!level) {
|
|
42001
|
+
state.parentType = oldParentType;
|
|
42253
42002
|
return false;
|
|
42254
42003
|
}
|
|
42255
|
-
const content = state.getLines(startLine, nextLine, state.blkIndent, false)
|
|
42004
|
+
const content = asciiTrim(state.getLines(startLine, nextLine, state.blkIndent, false));
|
|
42256
42005
|
state.line = nextLine + 1;
|
|
42257
42006
|
const token_o = state.push("heading_open", "h" + String(level), 1);
|
|
42258
42007
|
token_o.markup = String.fromCharCode(marker);
|
|
@@ -42289,7 +42038,7 @@ function paragraph(state, startLine, endLine) {
|
|
|
42289
42038
|
break;
|
|
42290
42039
|
}
|
|
42291
42040
|
}
|
|
42292
|
-
const content = state.getLines(startLine, nextLine, state.blkIndent, false)
|
|
42041
|
+
const content = asciiTrim(state.getLines(startLine, nextLine, state.blkIndent, false));
|
|
42293
42042
|
state.line = nextLine;
|
|
42294
42043
|
const token_o = state.push("paragraph_open", "p", 1);
|
|
42295
42044
|
token_o.map = [startLine, state.line];
|
|
@@ -42423,15 +42172,37 @@ StateInline.prototype.push = function(type, tag, nesting) {
|
|
|
42423
42172
|
StateInline.prototype.scanDelims = function(start, canSplitWord) {
|
|
42424
42173
|
const max2 = this.posMax;
|
|
42425
42174
|
const marker = this.src.charCodeAt(start);
|
|
42426
|
-
|
|
42175
|
+
let lastChar;
|
|
42176
|
+
if (start === 0) {
|
|
42177
|
+
lastChar = 32;
|
|
42178
|
+
} else if (start === 1) {
|
|
42179
|
+
lastChar = this.src.charCodeAt(0);
|
|
42180
|
+
if ((lastChar & 63488) === 55296) {
|
|
42181
|
+
lastChar = 65533;
|
|
42182
|
+
}
|
|
42183
|
+
} else {
|
|
42184
|
+
lastChar = this.src.charCodeAt(start - 1);
|
|
42185
|
+
if ((lastChar & 64512) === 56320) {
|
|
42186
|
+
const highSurr = this.src.charCodeAt(start - 2);
|
|
42187
|
+
lastChar = (highSurr & 64512) === 55296 ? 65536 + (highSurr - 55296 << 10) + (lastChar - 56320) : 65533;
|
|
42188
|
+
} else if ((lastChar & 64512) === 55296) {
|
|
42189
|
+
lastChar = 65533;
|
|
42190
|
+
}
|
|
42191
|
+
}
|
|
42427
42192
|
let pos = start;
|
|
42428
42193
|
while (pos < max2 && this.src.charCodeAt(pos) === marker) {
|
|
42429
42194
|
pos++;
|
|
42430
42195
|
}
|
|
42431
42196
|
const count2 = pos - start;
|
|
42432
|
-
|
|
42433
|
-
|
|
42434
|
-
|
|
42197
|
+
let nextChar = pos < max2 ? this.src.charCodeAt(pos) : 32;
|
|
42198
|
+
if ((nextChar & 64512) === 55296) {
|
|
42199
|
+
const lowSurr = this.src.charCodeAt(pos + 1);
|
|
42200
|
+
nextChar = (lowSurr & 64512) === 56320 ? 65536 + (nextChar - 55296 << 10) + (lowSurr - 56320) : 65533;
|
|
42201
|
+
} else if ((nextChar & 64512) === 56320) {
|
|
42202
|
+
nextChar = 65533;
|
|
42203
|
+
}
|
|
42204
|
+
const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctCharCode(lastChar);
|
|
42205
|
+
const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctCharCode(nextChar);
|
|
42435
42206
|
const isLastWhiteSpace = isWhiteSpace(lastChar);
|
|
42436
42207
|
const isNextWhiteSpace = isWhiteSpace(nextChar);
|
|
42437
42208
|
const left_flanking = !isNextWhiteSpace && (!isNextPunctChar || isLastWhiteSpace || isLastPunctChar);
|
|
@@ -42582,6 +42353,16 @@ function escape(state, silent) {
|
|
|
42582
42353
|
state.pos = pos;
|
|
42583
42354
|
return true;
|
|
42584
42355
|
}
|
|
42356
|
+
if (ch1 === 32) {
|
|
42357
|
+
if (!silent) {
|
|
42358
|
+
const token = state.push("text_special", "", 0);
|
|
42359
|
+
token.content = "\\";
|
|
42360
|
+
token.markup = "\\";
|
|
42361
|
+
token.info = "escape";
|
|
42362
|
+
}
|
|
42363
|
+
state.pos = pos;
|
|
42364
|
+
return true;
|
|
42365
|
+
}
|
|
42585
42366
|
let escapedStr = state.src[pos];
|
|
42586
42367
|
if (ch1 >= 55296 && ch1 <= 56319 && pos + 1 < max2) {
|
|
42587
42368
|
const ch2 = state.src.charCodeAt(pos + 1);
|
|
@@ -43159,7 +42940,7 @@ function entity(state, silent) {
|
|
|
43159
42940
|
} else {
|
|
43160
42941
|
const match2 = state.src.slice(pos).match(NAMED_RE);
|
|
43161
42942
|
if (match2) {
|
|
43162
|
-
const decoded =
|
|
42943
|
+
const decoded = decodeHTMLStrict(match2[0]);
|
|
43163
42944
|
if (decoded !== match2[0]) {
|
|
43164
42945
|
if (!silent) {
|
|
43165
42946
|
const token = state.push("text_special", "", 0);
|
|
@@ -43501,10 +43282,6 @@ const defaultSchemas = {
|
|
|
43501
43282
|
};
|
|
43502
43283
|
const tlds_2ch_src_re = "a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]";
|
|
43503
43284
|
const tlds_default = "biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");
|
|
43504
|
-
function resetScanCache(self) {
|
|
43505
|
-
self.__index__ = -1;
|
|
43506
|
-
self.__text_cache__ = "";
|
|
43507
|
-
}
|
|
43508
43285
|
function createValidator(re) {
|
|
43509
43286
|
return function(text2, pos) {
|
|
43510
43287
|
const tail = text2.slice(pos);
|
|
@@ -43532,8 +43309,11 @@ function compile(self) {
|
|
|
43532
43309
|
return tpl.replace("%TLDS%", re.src_tlds);
|
|
43533
43310
|
}
|
|
43534
43311
|
re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), "i");
|
|
43312
|
+
re.email_fuzzy_global = RegExp(untpl(re.tpl_email_fuzzy), "ig");
|
|
43535
43313
|
re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), "i");
|
|
43314
|
+
re.link_fuzzy_global = RegExp(untpl(re.tpl_link_fuzzy), "ig");
|
|
43536
43315
|
re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), "i");
|
|
43316
|
+
re.link_no_ip_fuzzy_global = RegExp(untpl(re.tpl_link_no_ip_fuzzy), "ig");
|
|
43537
43317
|
re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), "i");
|
|
43538
43318
|
const aliases = [];
|
|
43539
43319
|
self.__compiled__ = {};
|
|
@@ -43588,23 +43368,15 @@ function compile(self) {
|
|
|
43588
43368
|
"(" + self.re.schema_test.source + ")|(" + self.re.host_fuzzy_test.source + ")|@",
|
|
43589
43369
|
"i"
|
|
43590
43370
|
);
|
|
43591
|
-
|
|
43592
|
-
|
|
43593
|
-
|
|
43594
|
-
|
|
43595
|
-
|
|
43596
|
-
|
|
43597
|
-
this.
|
|
43598
|
-
this.
|
|
43599
|
-
this.
|
|
43600
|
-
this.raw = text2;
|
|
43601
|
-
this.text = text2;
|
|
43602
|
-
this.url = text2;
|
|
43603
|
-
}
|
|
43604
|
-
function createMatch(self, shift2) {
|
|
43605
|
-
const match2 = new Match(self, shift2);
|
|
43606
|
-
self.__compiled__[match2.schema].normalize(match2, self);
|
|
43607
|
-
return match2;
|
|
43371
|
+
}
|
|
43372
|
+
function Match(text2, schema2, index2, lastIndex) {
|
|
43373
|
+
const raw = text2.slice(index2, lastIndex);
|
|
43374
|
+
this.schema = schema2.toLowerCase();
|
|
43375
|
+
this.index = index2;
|
|
43376
|
+
this.lastIndex = lastIndex;
|
|
43377
|
+
this.raw = raw;
|
|
43378
|
+
this.text = raw;
|
|
43379
|
+
this.url = raw;
|
|
43608
43380
|
}
|
|
43609
43381
|
function LinkifyIt(schemas, options) {
|
|
43610
43382
|
if (!(this instanceof LinkifyIt)) {
|
|
@@ -43617,10 +43389,6 @@ function LinkifyIt(schemas, options) {
|
|
|
43617
43389
|
}
|
|
43618
43390
|
}
|
|
43619
43391
|
this.__opts__ = assign({}, defaultOptions, options);
|
|
43620
|
-
this.__index__ = -1;
|
|
43621
|
-
this.__last_index__ = -1;
|
|
43622
|
-
this.__schema__ = "";
|
|
43623
|
-
this.__text_cache__ = "";
|
|
43624
43392
|
this.__schemas__ = assign({}, defaultSchemas, schemas);
|
|
43625
43393
|
this.__compiled__ = {};
|
|
43626
43394
|
this.__tlds__ = tlds_default;
|
|
@@ -43638,55 +43406,34 @@ LinkifyIt.prototype.set = function set(options) {
|
|
|
43638
43406
|
return this;
|
|
43639
43407
|
};
|
|
43640
43408
|
LinkifyIt.prototype.test = function test(text2) {
|
|
43641
|
-
this.__text_cache__ = text2;
|
|
43642
|
-
this.__index__ = -1;
|
|
43643
43409
|
if (!text2.length) {
|
|
43644
43410
|
return false;
|
|
43645
43411
|
}
|
|
43646
|
-
let m,
|
|
43412
|
+
let m, re;
|
|
43647
43413
|
if (this.re.schema_test.test(text2)) {
|
|
43648
43414
|
re = this.re.schema_search;
|
|
43649
43415
|
re.lastIndex = 0;
|
|
43650
43416
|
while ((m = re.exec(text2)) !== null) {
|
|
43651
|
-
|
|
43652
|
-
|
|
43653
|
-
this.__schema__ = m[2];
|
|
43654
|
-
this.__index__ = m.index + m[1].length;
|
|
43655
|
-
this.__last_index__ = m.index + m[0].length + len;
|
|
43656
|
-
break;
|
|
43417
|
+
if (this.testSchemaAt(text2, m[2], re.lastIndex)) {
|
|
43418
|
+
return true;
|
|
43657
43419
|
}
|
|
43658
43420
|
}
|
|
43659
43421
|
}
|
|
43660
43422
|
if (this.__opts__.fuzzyLink && this.__compiled__["http:"]) {
|
|
43661
|
-
|
|
43662
|
-
|
|
43663
|
-
|
|
43664
|
-
if ((ml = text2.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {
|
|
43665
|
-
shift2 = ml.index + ml[1].length;
|
|
43666
|
-
if (this.__index__ < 0 || shift2 < this.__index__) {
|
|
43667
|
-
this.__schema__ = "";
|
|
43668
|
-
this.__index__ = shift2;
|
|
43669
|
-
this.__last_index__ = ml.index + ml[0].length;
|
|
43670
|
-
}
|
|
43671
|
-
}
|
|
43423
|
+
if (text2.search(this.re.host_fuzzy_test) >= 0) {
|
|
43424
|
+
if (text2.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy) !== null) {
|
|
43425
|
+
return true;
|
|
43672
43426
|
}
|
|
43673
43427
|
}
|
|
43674
43428
|
}
|
|
43675
43429
|
if (this.__opts__.fuzzyEmail && this.__compiled__["mailto:"]) {
|
|
43676
|
-
|
|
43677
|
-
|
|
43678
|
-
|
|
43679
|
-
shift2 = me.index + me[1].length;
|
|
43680
|
-
next = me.index + me[0].length;
|
|
43681
|
-
if (this.__index__ < 0 || shift2 < this.__index__ || shift2 === this.__index__ && next > this.__last_index__) {
|
|
43682
|
-
this.__schema__ = "mailto:";
|
|
43683
|
-
this.__index__ = shift2;
|
|
43684
|
-
this.__last_index__ = next;
|
|
43685
|
-
}
|
|
43430
|
+
if (text2.indexOf("@") >= 0) {
|
|
43431
|
+
if (text2.match(this.re.email_fuzzy) !== null) {
|
|
43432
|
+
return true;
|
|
43686
43433
|
}
|
|
43687
43434
|
}
|
|
43688
43435
|
}
|
|
43689
|
-
return
|
|
43436
|
+
return false;
|
|
43690
43437
|
};
|
|
43691
43438
|
LinkifyIt.prototype.pretest = function pretest(text2) {
|
|
43692
43439
|
return this.re.pretest.test(text2);
|
|
@@ -43699,16 +43446,87 @@ LinkifyIt.prototype.testSchemaAt = function testSchemaAt(text2, schema2, pos) {
|
|
|
43699
43446
|
};
|
|
43700
43447
|
LinkifyIt.prototype.match = function match(text2) {
|
|
43701
43448
|
const result = [];
|
|
43702
|
-
|
|
43703
|
-
|
|
43704
|
-
|
|
43705
|
-
|
|
43449
|
+
const type_schemed = [];
|
|
43450
|
+
const type_fuzzy_link = [];
|
|
43451
|
+
const type_fuzzy_email = [];
|
|
43452
|
+
let m, len, re;
|
|
43453
|
+
function choose(a, b) {
|
|
43454
|
+
if (!a) {
|
|
43455
|
+
return b;
|
|
43456
|
+
}
|
|
43457
|
+
if (!b) {
|
|
43458
|
+
return a;
|
|
43459
|
+
}
|
|
43460
|
+
if (a.index !== b.index) {
|
|
43461
|
+
return a.index < b.index ? a : b;
|
|
43462
|
+
}
|
|
43463
|
+
return a.lastIndex >= b.lastIndex ? a : b;
|
|
43706
43464
|
}
|
|
43707
|
-
|
|
43708
|
-
|
|
43709
|
-
|
|
43710
|
-
|
|
43711
|
-
|
|
43465
|
+
if (!text2.length) {
|
|
43466
|
+
return null;
|
|
43467
|
+
}
|
|
43468
|
+
if (this.re.schema_test.test(text2)) {
|
|
43469
|
+
re = this.re.schema_search;
|
|
43470
|
+
re.lastIndex = 0;
|
|
43471
|
+
while ((m = re.exec(text2)) !== null) {
|
|
43472
|
+
len = this.testSchemaAt(text2, m[2], re.lastIndex);
|
|
43473
|
+
if (len) {
|
|
43474
|
+
type_schemed.push({
|
|
43475
|
+
schema: m[2],
|
|
43476
|
+
index: m.index + m[1].length,
|
|
43477
|
+
lastIndex: m.index + m[0].length + len
|
|
43478
|
+
});
|
|
43479
|
+
}
|
|
43480
|
+
}
|
|
43481
|
+
}
|
|
43482
|
+
if (this.__opts__.fuzzyLink && this.__compiled__["http:"]) {
|
|
43483
|
+
re = this.__opts__.fuzzyIP ? this.re.link_fuzzy_global : this.re.link_no_ip_fuzzy_global;
|
|
43484
|
+
re.lastIndex = 0;
|
|
43485
|
+
while ((m = re.exec(text2)) !== null) {
|
|
43486
|
+
type_fuzzy_link.push({
|
|
43487
|
+
schema: "",
|
|
43488
|
+
index: m.index + m[1].length,
|
|
43489
|
+
lastIndex: m.index + m[0].length
|
|
43490
|
+
});
|
|
43491
|
+
}
|
|
43492
|
+
}
|
|
43493
|
+
if (this.__opts__.fuzzyEmail && this.__compiled__["mailto:"]) {
|
|
43494
|
+
re = this.re.email_fuzzy_global;
|
|
43495
|
+
re.lastIndex = 0;
|
|
43496
|
+
while ((m = re.exec(text2)) !== null) {
|
|
43497
|
+
type_fuzzy_email.push({
|
|
43498
|
+
schema: "mailto:",
|
|
43499
|
+
index: m.index + m[1].length,
|
|
43500
|
+
lastIndex: m.index + m[0].length
|
|
43501
|
+
});
|
|
43502
|
+
}
|
|
43503
|
+
}
|
|
43504
|
+
const indexes = [0, 0, 0];
|
|
43505
|
+
let lastIndex = 0;
|
|
43506
|
+
for (; ; ) {
|
|
43507
|
+
const candidates = [
|
|
43508
|
+
type_schemed[indexes[0]],
|
|
43509
|
+
type_fuzzy_email[indexes[1]],
|
|
43510
|
+
type_fuzzy_link[indexes[2]]
|
|
43511
|
+
];
|
|
43512
|
+
const candidate = choose(choose(candidates[0], candidates[1]), candidates[2]);
|
|
43513
|
+
if (!candidate) {
|
|
43514
|
+
break;
|
|
43515
|
+
}
|
|
43516
|
+
if (candidate === candidates[0]) {
|
|
43517
|
+
indexes[0]++;
|
|
43518
|
+
} else if (candidate === candidates[1]) {
|
|
43519
|
+
indexes[1]++;
|
|
43520
|
+
} else {
|
|
43521
|
+
indexes[2]++;
|
|
43522
|
+
}
|
|
43523
|
+
if (candidate.index < lastIndex) {
|
|
43524
|
+
continue;
|
|
43525
|
+
}
|
|
43526
|
+
const match2 = new Match(text2, candidate.schema, candidate.index, candidate.lastIndex);
|
|
43527
|
+
this.__compiled__[match2.schema].normalize(match2, this);
|
|
43528
|
+
result.push(match2);
|
|
43529
|
+
lastIndex = candidate.lastIndex;
|
|
43712
43530
|
}
|
|
43713
43531
|
if (result.length) {
|
|
43714
43532
|
return result;
|
|
@@ -43716,17 +43534,14 @@ LinkifyIt.prototype.match = function match(text2) {
|
|
|
43716
43534
|
return null;
|
|
43717
43535
|
};
|
|
43718
43536
|
LinkifyIt.prototype.matchAtStart = function matchAtStart(text2) {
|
|
43719
|
-
this.__text_cache__ = text2;
|
|
43720
|
-
this.__index__ = -1;
|
|
43721
43537
|
if (!text2.length) return null;
|
|
43722
43538
|
const m = this.re.schema_at_start.exec(text2);
|
|
43723
43539
|
if (!m) return null;
|
|
43724
43540
|
const len = this.testSchemaAt(text2, m[2], m[0].length);
|
|
43725
43541
|
if (!len) return null;
|
|
43726
|
-
|
|
43727
|
-
this.
|
|
43728
|
-
|
|
43729
|
-
return createMatch(this, 0);
|
|
43542
|
+
const match2 = new Match(text2, m[2], m.index + m[1].length, m.index + m[0].length + len);
|
|
43543
|
+
this.__compiled__[match2.schema].normalize(match2, this);
|
|
43544
|
+
return match2;
|
|
43730
43545
|
};
|
|
43731
43546
|
LinkifyIt.prototype.tlds = function tlds2(list2, keepOld) {
|
|
43732
43547
|
list2 = Array.isArray(list2) ? list2 : [list2];
|
|
@@ -47703,7 +47518,7 @@ const ASSET_TYPE_ALIASES = {
|
|
|
47703
47518
|
presentation: "presentation",
|
|
47704
47519
|
sheet: "spreadsheet",
|
|
47705
47520
|
spreadsheet: "spreadsheet",
|
|
47706
|
-
|
|
47521
|
+
word_document: "document"
|
|
47707
47522
|
};
|
|
47708
47523
|
const isAthenaSpacesPath = (url) => url.pathname.replace(/\/+$/, "") === "/dashboard/spaces";
|
|
47709
47524
|
const normalizeAssetType = (value) => {
|
|
@@ -49599,6 +49414,149 @@ class Store {
|
|
|
49599
49414
|
}
|
|
49600
49415
|
var withSelector = { exports: {} };
|
|
49601
49416
|
var withSelector_production = {};
|
|
49417
|
+
var shim = { exports: {} };
|
|
49418
|
+
var useSyncExternalStoreShim_production = {};
|
|
49419
|
+
/**
|
|
49420
|
+
* @license React
|
|
49421
|
+
* use-sync-external-store-shim.production.js
|
|
49422
|
+
*
|
|
49423
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
49424
|
+
*
|
|
49425
|
+
* This source code is licensed under the MIT license found in the
|
|
49426
|
+
* LICENSE file in the root directory of this source tree.
|
|
49427
|
+
*/
|
|
49428
|
+
var hasRequiredUseSyncExternalStoreShim_production;
|
|
49429
|
+
function requireUseSyncExternalStoreShim_production() {
|
|
49430
|
+
if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
|
|
49431
|
+
hasRequiredUseSyncExternalStoreShim_production = 1;
|
|
49432
|
+
var React$1 = React;
|
|
49433
|
+
function is(x, y) {
|
|
49434
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
49435
|
+
}
|
|
49436
|
+
var objectIs = "function" === typeof Object.is ? Object.is : is, useState = React$1.useState, useEffect = React$1.useEffect, useLayoutEffect = React$1.useLayoutEffect, useDebugValue = React$1.useDebugValue;
|
|
49437
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
49438
|
+
var value = getSnapshot(), _useState = useState({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
49439
|
+
useLayoutEffect(
|
|
49440
|
+
function() {
|
|
49441
|
+
inst.value = value;
|
|
49442
|
+
inst.getSnapshot = getSnapshot;
|
|
49443
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
49444
|
+
},
|
|
49445
|
+
[subscribe, value, getSnapshot]
|
|
49446
|
+
);
|
|
49447
|
+
useEffect(
|
|
49448
|
+
function() {
|
|
49449
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
49450
|
+
return subscribe(function() {
|
|
49451
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
49452
|
+
});
|
|
49453
|
+
},
|
|
49454
|
+
[subscribe]
|
|
49455
|
+
);
|
|
49456
|
+
useDebugValue(value);
|
|
49457
|
+
return value;
|
|
49458
|
+
}
|
|
49459
|
+
function checkIfSnapshotChanged(inst) {
|
|
49460
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
49461
|
+
inst = inst.value;
|
|
49462
|
+
try {
|
|
49463
|
+
var nextValue = latestGetSnapshot();
|
|
49464
|
+
return !objectIs(inst, nextValue);
|
|
49465
|
+
} catch (error2) {
|
|
49466
|
+
return true;
|
|
49467
|
+
}
|
|
49468
|
+
}
|
|
49469
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
49470
|
+
return getSnapshot();
|
|
49471
|
+
}
|
|
49472
|
+
var shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
49473
|
+
useSyncExternalStoreShim_production.useSyncExternalStore = void 0 !== React$1.useSyncExternalStore ? React$1.useSyncExternalStore : shim2;
|
|
49474
|
+
return useSyncExternalStoreShim_production;
|
|
49475
|
+
}
|
|
49476
|
+
var useSyncExternalStoreShim_development = {};
|
|
49477
|
+
/**
|
|
49478
|
+
* @license React
|
|
49479
|
+
* use-sync-external-store-shim.development.js
|
|
49480
|
+
*
|
|
49481
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
49482
|
+
*
|
|
49483
|
+
* This source code is licensed under the MIT license found in the
|
|
49484
|
+
* LICENSE file in the root directory of this source tree.
|
|
49485
|
+
*/
|
|
49486
|
+
var hasRequiredUseSyncExternalStoreShim_development;
|
|
49487
|
+
function requireUseSyncExternalStoreShim_development() {
|
|
49488
|
+
if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
|
|
49489
|
+
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
49490
|
+
"production" !== process.env.NODE_ENV && (function() {
|
|
49491
|
+
function is(x, y) {
|
|
49492
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
49493
|
+
}
|
|
49494
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
49495
|
+
didWarnOld18Alpha || void 0 === React$1.startTransition || (didWarnOld18Alpha = true, console.error(
|
|
49496
|
+
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
49497
|
+
));
|
|
49498
|
+
var value = getSnapshot();
|
|
49499
|
+
if (!didWarnUncachedGetSnapshot) {
|
|
49500
|
+
var cachedValue = getSnapshot();
|
|
49501
|
+
objectIs(value, cachedValue) || (console.error(
|
|
49502
|
+
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
49503
|
+
), didWarnUncachedGetSnapshot = true);
|
|
49504
|
+
}
|
|
49505
|
+
cachedValue = useState({
|
|
49506
|
+
inst: { value, getSnapshot }
|
|
49507
|
+
});
|
|
49508
|
+
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
49509
|
+
useLayoutEffect(
|
|
49510
|
+
function() {
|
|
49511
|
+
inst.value = value;
|
|
49512
|
+
inst.getSnapshot = getSnapshot;
|
|
49513
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
49514
|
+
},
|
|
49515
|
+
[subscribe, value, getSnapshot]
|
|
49516
|
+
);
|
|
49517
|
+
useEffect(
|
|
49518
|
+
function() {
|
|
49519
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
49520
|
+
return subscribe(function() {
|
|
49521
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
49522
|
+
});
|
|
49523
|
+
},
|
|
49524
|
+
[subscribe]
|
|
49525
|
+
);
|
|
49526
|
+
useDebugValue(value);
|
|
49527
|
+
return value;
|
|
49528
|
+
}
|
|
49529
|
+
function checkIfSnapshotChanged(inst) {
|
|
49530
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
49531
|
+
inst = inst.value;
|
|
49532
|
+
try {
|
|
49533
|
+
var nextValue = latestGetSnapshot();
|
|
49534
|
+
return !objectIs(inst, nextValue);
|
|
49535
|
+
} catch (error2) {
|
|
49536
|
+
return true;
|
|
49537
|
+
}
|
|
49538
|
+
}
|
|
49539
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
49540
|
+
return getSnapshot();
|
|
49541
|
+
}
|
|
49542
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
49543
|
+
var React$1 = React, objectIs = "function" === typeof Object.is ? Object.is : is, useState = React$1.useState, useEffect = React$1.useEffect, useLayoutEffect = React$1.useLayoutEffect, useDebugValue = React$1.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
49544
|
+
useSyncExternalStoreShim_development.useSyncExternalStore = void 0 !== React$1.useSyncExternalStore ? React$1.useSyncExternalStore : shim2;
|
|
49545
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
49546
|
+
})();
|
|
49547
|
+
return useSyncExternalStoreShim_development;
|
|
49548
|
+
}
|
|
49549
|
+
var hasRequiredShim;
|
|
49550
|
+
function requireShim() {
|
|
49551
|
+
if (hasRequiredShim) return shim.exports;
|
|
49552
|
+
hasRequiredShim = 1;
|
|
49553
|
+
if (process.env.NODE_ENV === "production") {
|
|
49554
|
+
shim.exports = requireUseSyncExternalStoreShim_production();
|
|
49555
|
+
} else {
|
|
49556
|
+
shim.exports = requireUseSyncExternalStoreShim_development();
|
|
49557
|
+
}
|
|
49558
|
+
return shim.exports;
|
|
49559
|
+
}
|
|
49602
49560
|
/**
|
|
49603
49561
|
* @license React
|
|
49604
49562
|
* use-sync-external-store-shim/with-selector.production.js
|
|
@@ -56293,6 +56251,35 @@ const AthenaUserMessage = ({
|
|
|
56293
56251
|
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aui-user-message-content wrap-break-word rounded-2xl bg-muted px-4 py-2.5 text-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(react$1.MessagePrimitive.Parts, { components: { Text: TextComponent } }) })
|
|
56294
56252
|
}
|
|
56295
56253
|
);
|
|
56254
|
+
const ATHENA_ASSET_EMBED_READY_MESSAGE = "athena:asset-embed-ready";
|
|
56255
|
+
const ATHENA_ASSET_EMBED_CONFIG_MESSAGE = "athena:asset-embed-config";
|
|
56256
|
+
const ATHENA_ASSET_CITATION_CLICK_MESSAGE = "athena:asset-citation-click";
|
|
56257
|
+
function resolveAthenaAssetCitationBehavior({
|
|
56258
|
+
citationBehavior,
|
|
56259
|
+
hasCitationClickHandler
|
|
56260
|
+
}) {
|
|
56261
|
+
if (citationBehavior === "host" && !hasCitationClickHandler) return "browser";
|
|
56262
|
+
return citationBehavior ?? (hasCitationClickHandler ? "host" : "browser");
|
|
56263
|
+
}
|
|
56264
|
+
function isAthenaAssetEmbedReadyEvent(value) {
|
|
56265
|
+
return typeof value === "object" && value !== null && "type" in value && value.type === ATHENA_ASSET_EMBED_READY_MESSAGE && "version" in value && value.version === 1;
|
|
56266
|
+
}
|
|
56267
|
+
function isAthenaAssetCitationClickEvent(value) {
|
|
56268
|
+
return typeof value === "object" && value !== null && "type" in value && value.type === ATHENA_ASSET_CITATION_CLICK_MESSAGE && "version" in value && value.version === 1 && "reference" in value && typeof value.reference === "object" && value.reference !== null && "id" in value.reference && typeof value.reference.id === "string";
|
|
56269
|
+
}
|
|
56270
|
+
function buildAssetEmbedRequestBody({
|
|
56271
|
+
assetId,
|
|
56272
|
+
readOnly,
|
|
56273
|
+
expiresInSeconds,
|
|
56274
|
+
displayMode
|
|
56275
|
+
}) {
|
|
56276
|
+
return {
|
|
56277
|
+
asset_id: assetId,
|
|
56278
|
+
read_only: readOnly,
|
|
56279
|
+
expires_in_seconds: expiresInSeconds,
|
|
56280
|
+
display_mode: displayMode
|
|
56281
|
+
};
|
|
56282
|
+
}
|
|
56296
56283
|
const embedCache = /* @__PURE__ */ new Map();
|
|
56297
56284
|
const ATHENA_APP_HOSTNAMES = /* @__PURE__ */ new Set(["app.athenaintel.com", "staging-app.athenaintel.com"]);
|
|
56298
56285
|
const ATHENA_PREVIEW_HOSTNAME_SUFFIX = ".previews.athenaintel.com";
|
|
@@ -56376,7 +56363,11 @@ function resolveAssetEmbedUrl({
|
|
|
56376
56363
|
if (!resolvedEmbedUrl.pathname.startsWith("/embed/")) {
|
|
56377
56364
|
return embedUrl;
|
|
56378
56365
|
}
|
|
56379
|
-
const embedAppUrl = resolveEmbedAppUrl({
|
|
56366
|
+
const embedAppUrl = resolveEmbedAppUrl({
|
|
56367
|
+
appUrl,
|
|
56368
|
+
backendUrl,
|
|
56369
|
+
currentOrigin
|
|
56370
|
+
});
|
|
56380
56371
|
if (!embedAppUrl) {
|
|
56381
56372
|
return embedUrl;
|
|
56382
56373
|
}
|
|
@@ -56388,12 +56379,48 @@ function resolveAssetEmbedUrl({
|
|
|
56388
56379
|
return embedUrl;
|
|
56389
56380
|
}
|
|
56390
56381
|
}
|
|
56382
|
+
function buildSdkAssetEmbedUrl(embedUrl) {
|
|
56383
|
+
try {
|
|
56384
|
+
const url = new URL(embedUrl);
|
|
56385
|
+
url.searchParams.set("athena_sdk_bridge", "1");
|
|
56386
|
+
return url.toString();
|
|
56387
|
+
} catch {
|
|
56388
|
+
return embedUrl;
|
|
56389
|
+
}
|
|
56390
|
+
}
|
|
56391
|
+
const getJwtPayload = (token) => {
|
|
56392
|
+
try {
|
|
56393
|
+
const payloadSegment = token.split(".")[1];
|
|
56394
|
+
if (!payloadSegment || typeof atob !== "function") return null;
|
|
56395
|
+
const normalized = payloadSegment.replace(/-/g, "+").replace(/_/g, "/");
|
|
56396
|
+
const payload = JSON.parse(
|
|
56397
|
+
atob(normalized.padEnd(normalized.length + (4 - normalized.length % 4) % 4, "="))
|
|
56398
|
+
);
|
|
56399
|
+
return payload && typeof payload === "object" ? payload : null;
|
|
56400
|
+
} catch {
|
|
56401
|
+
return null;
|
|
56402
|
+
}
|
|
56403
|
+
};
|
|
56404
|
+
function getAssetEmbedAuthContext({ token, apiKey }) {
|
|
56405
|
+
if (!token) return apiKey ? `api-key:${apiKey}` : "anonymous";
|
|
56406
|
+
const payload = getJwtPayload(token);
|
|
56407
|
+
const userId = (payload == null ? void 0 : payload.user_id) ?? (payload == null ? void 0 : payload.sub);
|
|
56408
|
+
if (typeof userId !== "string" || !userId) return `opaque-token:${token}`;
|
|
56409
|
+
return `jwt:${JSON.stringify({
|
|
56410
|
+
issuer: (payload == null ? void 0 : payload.iss) ?? null,
|
|
56411
|
+
userId,
|
|
56412
|
+
activeOrgId: (payload == null ? void 0 : payload.active_org_id) ?? (payload == null ? void 0 : payload.org_id) ?? null,
|
|
56413
|
+
workspaceId: (payload == null ? void 0 : payload.workspace_id) ?? null,
|
|
56414
|
+
orgMemberships: (payload == null ? void 0 : payload.org_id_to_org_member_info) ?? null
|
|
56415
|
+
})}`;
|
|
56416
|
+
}
|
|
56391
56417
|
function useAssetEmbed(assetId, options = {
|
|
56392
56418
|
backendUrl: ""
|
|
56393
56419
|
}) {
|
|
56394
56420
|
const {
|
|
56395
56421
|
readOnly = false,
|
|
56396
56422
|
expiresInSeconds = 60 * 60 * 24 * 30,
|
|
56423
|
+
displayMode = "minimal",
|
|
56397
56424
|
backendUrl,
|
|
56398
56425
|
appUrl,
|
|
56399
56426
|
apiKey,
|
|
@@ -56405,7 +56432,7 @@ function useAssetEmbed(assetId, options = {
|
|
|
56405
56432
|
const abortRef = React.useRef(null);
|
|
56406
56433
|
const tokenRef = React.useRef(token);
|
|
56407
56434
|
tokenRef.current = token;
|
|
56408
|
-
const
|
|
56435
|
+
const authContext = getAssetEmbedAuthContext({ token, apiKey });
|
|
56409
56436
|
React.useEffect(() => {
|
|
56410
56437
|
var _a2;
|
|
56411
56438
|
if (!assetId || !backendUrl) {
|
|
@@ -56414,8 +56441,7 @@ function useAssetEmbed(assetId, options = {
|
|
|
56414
56441
|
setError(null);
|
|
56415
56442
|
return;
|
|
56416
56443
|
}
|
|
56417
|
-
const
|
|
56418
|
-
const cacheKey = `${assetId}:${readOnly}:${authContext}:${backendUrl}:${appUrl ?? ""}`;
|
|
56444
|
+
const cacheKey = `${assetId}:${readOnly}:${displayMode}:${authContext}:${backendUrl}:${appUrl ?? ""}`;
|
|
56419
56445
|
const cached2 = embedCache.get(cacheKey);
|
|
56420
56446
|
if (cached2 && cached2.expiresAt > Date.now() / 1e3) {
|
|
56421
56447
|
setEmbedUrl(cached2.url);
|
|
@@ -56430,21 +56456,26 @@ function useAssetEmbed(assetId, options = {
|
|
|
56430
56456
|
abortRef.current = controller;
|
|
56431
56457
|
setIsLoading(true);
|
|
56432
56458
|
setError(null);
|
|
56433
|
-
const headers = {
|
|
56459
|
+
const headers = {
|
|
56460
|
+
"Content-Type": "application/json"
|
|
56461
|
+
};
|
|
56434
56462
|
const currentToken = tokenRef.current;
|
|
56435
56463
|
if (currentToken) {
|
|
56436
|
-
headers
|
|
56464
|
+
headers.Authorization = `Bearer ${currentToken}`;
|
|
56437
56465
|
} else if (apiKey) {
|
|
56438
56466
|
headers["X-API-KEY"] = apiKey;
|
|
56439
56467
|
}
|
|
56440
56468
|
fetch(endpoint, {
|
|
56441
56469
|
method: "POST",
|
|
56442
56470
|
headers,
|
|
56443
|
-
body: JSON.stringify(
|
|
56444
|
-
|
|
56445
|
-
|
|
56446
|
-
|
|
56447
|
-
|
|
56471
|
+
body: JSON.stringify(
|
|
56472
|
+
buildAssetEmbedRequestBody({
|
|
56473
|
+
assetId,
|
|
56474
|
+
readOnly,
|
|
56475
|
+
expiresInSeconds,
|
|
56476
|
+
displayMode
|
|
56477
|
+
})
|
|
56478
|
+
),
|
|
56448
56479
|
signal: controller.signal
|
|
56449
56480
|
}).then(async (res) => {
|
|
56450
56481
|
if (!res.ok) {
|
|
@@ -56458,7 +56489,10 @@ function useAssetEmbed(assetId, options = {
|
|
|
56458
56489
|
appUrl,
|
|
56459
56490
|
backendUrl
|
|
56460
56491
|
});
|
|
56461
|
-
embedCache.set(cacheKey, {
|
|
56492
|
+
embedCache.set(cacheKey, {
|
|
56493
|
+
url: resolvedEmbedUrl,
|
|
56494
|
+
expiresAt: data.expires_at
|
|
56495
|
+
});
|
|
56462
56496
|
setEmbedUrl(resolvedEmbedUrl);
|
|
56463
56497
|
setIsLoading(false);
|
|
56464
56498
|
}).catch((err) => {
|
|
@@ -56467,9 +56501,134 @@ function useAssetEmbed(assetId, options = {
|
|
|
56467
56501
|
setIsLoading(false);
|
|
56468
56502
|
});
|
|
56469
56503
|
return () => controller.abort();
|
|
56470
|
-
}, [assetId, readOnly, expiresInSeconds, backendUrl, appUrl,
|
|
56504
|
+
}, [assetId, readOnly, expiresInSeconds, displayMode, backendUrl, appUrl, authContext, apiKey]);
|
|
56471
56505
|
return { embedUrl, isLoading, error: error2 };
|
|
56472
56506
|
}
|
|
56507
|
+
const DEFAULT_STYLE = {
|
|
56508
|
+
width: "100%",
|
|
56509
|
+
height: "100%",
|
|
56510
|
+
border: 0
|
|
56511
|
+
};
|
|
56512
|
+
const AUTH_SYNC_INTERVAL_MS = 6e4;
|
|
56513
|
+
const AthenaAssetEmbed = ({
|
|
56514
|
+
assetId,
|
|
56515
|
+
displayMode = "full",
|
|
56516
|
+
readOnly = true,
|
|
56517
|
+
expiresInSeconds,
|
|
56518
|
+
citationBehavior,
|
|
56519
|
+
onCitationClick,
|
|
56520
|
+
onLoad,
|
|
56521
|
+
onError,
|
|
56522
|
+
loadingFallback,
|
|
56523
|
+
errorFallback,
|
|
56524
|
+
className,
|
|
56525
|
+
style: style2,
|
|
56526
|
+
title,
|
|
56527
|
+
allow = "fullscreen",
|
|
56528
|
+
...iframeProps
|
|
56529
|
+
}) => {
|
|
56530
|
+
const iframeRef = React.useRef(null);
|
|
56531
|
+
const athenaConfig = useAthenaConfig();
|
|
56532
|
+
const { backendUrl, appUrl, apiKey } = athenaConfig;
|
|
56533
|
+
const { embedUrl, isLoading, error: error2 } = useAssetEmbed(assetId, {
|
|
56534
|
+
backendUrl,
|
|
56535
|
+
appUrl,
|
|
56536
|
+
apiKey,
|
|
56537
|
+
token: athenaConfig.token,
|
|
56538
|
+
readOnly,
|
|
56539
|
+
expiresInSeconds,
|
|
56540
|
+
displayMode
|
|
56541
|
+
});
|
|
56542
|
+
const targetOrigin = React.useMemo(() => {
|
|
56543
|
+
if (!embedUrl) return null;
|
|
56544
|
+
try {
|
|
56545
|
+
return new URL(embedUrl, window.location.href).origin;
|
|
56546
|
+
} catch {
|
|
56547
|
+
return null;
|
|
56548
|
+
}
|
|
56549
|
+
}, [embedUrl]);
|
|
56550
|
+
const iframeSrc = React.useMemo(() => embedUrl ? buildSdkAssetEmbedUrl(embedUrl) : null, [embedUrl]);
|
|
56551
|
+
const effectiveCitationBehavior = resolveAthenaAssetCitationBehavior({
|
|
56552
|
+
citationBehavior,
|
|
56553
|
+
hasCitationClickHandler: !!onCitationClick
|
|
56554
|
+
});
|
|
56555
|
+
const sendConfig = React.useCallback(() => {
|
|
56556
|
+
var _a2, _b;
|
|
56557
|
+
if (!targetOrigin) return;
|
|
56558
|
+
(_b = (_a2 = iframeRef.current) == null ? void 0 : _a2.contentWindow) == null ? void 0 : _b.postMessage(
|
|
56559
|
+
{
|
|
56560
|
+
type: ATHENA_ASSET_EMBED_CONFIG_MESSAGE,
|
|
56561
|
+
version: 1,
|
|
56562
|
+
...athenaConfig.token ? { token: athenaConfig.token } : {},
|
|
56563
|
+
citationBehavior: effectiveCitationBehavior
|
|
56564
|
+
},
|
|
56565
|
+
targetOrigin
|
|
56566
|
+
);
|
|
56567
|
+
}, [athenaConfig, effectiveCitationBehavior, targetOrigin]);
|
|
56568
|
+
React.useEffect(() => {
|
|
56569
|
+
if (!embedUrl || !targetOrigin) return;
|
|
56570
|
+
const handleMessage = (event) => {
|
|
56571
|
+
var _a2;
|
|
56572
|
+
if (event.origin !== targetOrigin || event.source !== ((_a2 = iframeRef.current) == null ? void 0 : _a2.contentWindow)) return;
|
|
56573
|
+
if (isAthenaAssetEmbedReadyEvent(event.data)) {
|
|
56574
|
+
sendConfig();
|
|
56575
|
+
return;
|
|
56576
|
+
}
|
|
56577
|
+
if (isAthenaAssetCitationClickEvent(event.data)) {
|
|
56578
|
+
onCitationClick == null ? void 0 : onCitationClick(event.data);
|
|
56579
|
+
}
|
|
56580
|
+
};
|
|
56581
|
+
window.addEventListener("message", handleMessage);
|
|
56582
|
+
return () => window.removeEventListener("message", handleMessage);
|
|
56583
|
+
}, [embedUrl, onCitationClick, sendConfig, targetOrigin]);
|
|
56584
|
+
React.useEffect(() => {
|
|
56585
|
+
if (!embedUrl) return;
|
|
56586
|
+
sendConfig();
|
|
56587
|
+
const interval = window.setInterval(sendConfig, AUTH_SYNC_INTERVAL_MS);
|
|
56588
|
+
return () => window.clearInterval(interval);
|
|
56589
|
+
}, [embedUrl, sendConfig]);
|
|
56590
|
+
React.useEffect(() => {
|
|
56591
|
+
if (error2) onError == null ? void 0 : onError(new Error(error2));
|
|
56592
|
+
}, [error2, onError]);
|
|
56593
|
+
if (isLoading) {
|
|
56594
|
+
return loadingFallback ?? /* @__PURE__ */ jsxRuntime.jsxs("output", { className: "flex h-full w-full items-center justify-center", children: [
|
|
56595
|
+
/* @__PURE__ */ jsxRuntime.jsx(LoaderCircle, { className: "size-6 animate-spin text-muted-foreground" }),
|
|
56596
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Loading asset" })
|
|
56597
|
+
] });
|
|
56598
|
+
}
|
|
56599
|
+
if (error2) {
|
|
56600
|
+
const embedError = new Error(error2);
|
|
56601
|
+
if (typeof errorFallback === "function") return errorFallback(embedError);
|
|
56602
|
+
return errorFallback ?? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
56603
|
+
"div",
|
|
56604
|
+
{
|
|
56605
|
+
className: "flex h-full w-full items-center justify-center gap-2 p-4 text-sm text-muted-foreground",
|
|
56606
|
+
role: "alert",
|
|
56607
|
+
children: [
|
|
56608
|
+
/* @__PURE__ */ jsxRuntime.jsx(CircleAlert, { className: "size-4 text-destructive" }),
|
|
56609
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: error2 })
|
|
56610
|
+
]
|
|
56611
|
+
}
|
|
56612
|
+
);
|
|
56613
|
+
}
|
|
56614
|
+
if (!embedUrl) return null;
|
|
56615
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
56616
|
+
"iframe",
|
|
56617
|
+
{
|
|
56618
|
+
...iframeProps,
|
|
56619
|
+
ref: iframeRef,
|
|
56620
|
+
src: iframeSrc ?? void 0,
|
|
56621
|
+
title: title ?? `Athena asset ${assetId}`,
|
|
56622
|
+
allow,
|
|
56623
|
+
className: cn("block h-full w-full", className),
|
|
56624
|
+
style: { ...DEFAULT_STYLE, ...style2 },
|
|
56625
|
+
onLoad: () => {
|
|
56626
|
+
sendConfig();
|
|
56627
|
+
onLoad == null ? void 0 : onLoad();
|
|
56628
|
+
}
|
|
56629
|
+
}
|
|
56630
|
+
);
|
|
56631
|
+
};
|
|
56473
56632
|
const ABSOLUTE_URL_PATTERN = /^[a-zA-Z][a-zA-Z\d+\-.]*:/;
|
|
56474
56633
|
function buildAssetIframeSrc({
|
|
56475
56634
|
embedUrl,
|
|
@@ -56897,6 +57056,7 @@ function useComposerAttachment() {
|
|
|
56897
57056
|
}
|
|
56898
57057
|
exports.AppendDocumentToolUI = AppendDocumentToolUI;
|
|
56899
57058
|
exports.AssetPanel = AssetPanel;
|
|
57059
|
+
exports.AthenaAssetEmbed = AthenaAssetEmbed;
|
|
56900
57060
|
exports.AthenaAssistantActionBar = AthenaAssistantActionBar;
|
|
56901
57061
|
exports.AthenaAssistantMessage = AthenaAssistantMessage;
|
|
56902
57062
|
exports.AthenaChat = AthenaChat;
|
|
@@ -56964,7 +57124,10 @@ exports.clearAutoOpenedAssets = clearAutoOpenedAssets;
|
|
|
56964
57124
|
exports.cn = cn;
|
|
56965
57125
|
exports.convertLangChainToThreadMessages = convertLangChainToThreadMessages;
|
|
56966
57126
|
exports.createAssetToolUI = createAssetToolUI;
|
|
57127
|
+
exports.createAthenaSpacesUrl = createAthenaSpacesUrl;
|
|
56967
57128
|
exports.createThread = createThread;
|
|
57129
|
+
exports.deriveAthenaApiUrl = deriveAthenaApiUrl;
|
|
57130
|
+
exports.deriveAthenaAppUrl = deriveAthenaAppUrl;
|
|
56968
57131
|
exports.formatToolName = formatToolName;
|
|
56969
57132
|
exports.getAssetInfo = getAssetInfo;
|
|
56970
57133
|
exports.getPostHogInstance = getPostHogInstance;
|