@workflow/web 4.1.6 → 4.1.7

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.
@@ -14,7 +14,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
14
14
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
15
15
  var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
16
16
  var _a2, _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, canAdoptWithSpace_fn, canAdopt_fn, canAdoptType_fn, adoptWithSpace_fn, adopt_fn, canUsurpType_fn, canUsurp_fn, usurp_fn, flatten_fn, partsToRegExp_fn, parseGlob_fn, _Minimatch_instances, matchGlobstar_fn, matchGlobStarBodySections_fn, matchOne_fn, _reader;
17
- import { a as requireReact, S as ServerRouter, c as createReadableStreamFromReadable, r as reactExports, g as getDefaultExportFromCjs, R as React, b as ReactExports, w as withComponentProps, d as withErrorBoundaryProps, M as Meta, L as Links, e as ScrollRestoration, f as Scripts, O as Outlet, u as useNavigate, h as useSearchParams, i as Link$1, j as useRouteError, k as isRouteErrorResponse, l as useLocation, m as useParams } from "./app-DZ5lj7U4.js";
17
+ import { a as requireReact, S as ServerRouter, c as createReadableStreamFromReadable, r as reactExports, g as getDefaultExportFromCjs, R as React, b as ReactExports, w as withComponentProps, d as withErrorBoundaryProps, M as Meta, L as Links, e as ScrollRestoration, f as Scripts, O as Outlet, u as useNavigate, h as useSearchParams, i as Link$1, j as useRouteError, k as isRouteErrorResponse, l as useLocation, m as useParams } from "./app-CthB1gsr.js";
18
18
  import require$$0$4, { PassThrough } from "node:stream";
19
19
  import require$$0 from "util";
20
20
  import require$$1 from "crypto";
@@ -48814,7 +48814,7 @@ const WorkflowRunBaseSchema = object$1({
48814
48814
  // Optional in database for backwards compatibility, defaults to 1 (legacy) when reading
48815
48815
  specVersion: number$3().optional(),
48816
48816
  executionContext: record(string$3(), any()).optional(),
48817
- input: SerializedDataSchema,
48817
+ input: SerializedDataSchema.optional(),
48818
48818
  output: SerializedDataSchema.optional(),
48819
48819
  error: StructuredErrorSchema.optional(),
48820
48820
  expiredAt: date$2().optional(),
@@ -48897,7 +48897,7 @@ const StepSchema = object$1({
48897
48897
  */
48898
48898
  stepName: string$3(),
48899
48899
  status: StepStatusSchema,
48900
- input: SerializedDataSchema,
48900
+ input: SerializedDataSchema.optional(),
48901
48901
  output: SerializedDataSchema.optional(),
48902
48902
  /**
48903
48903
  * The error from a step_retrying or step_failed event.
@@ -49314,6 +49314,33 @@ function hasEncryptedFields(resource) {
49314
49314
  }
49315
49315
  return false;
49316
49316
  }
49317
+ const WORKFLOW_ULID_BODY = "[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}";
49318
+ const STEP_ID_PATTERN = new RegExp(`^step_(${WORKFLOW_ULID_BODY})$`, "i");
49319
+ const WAIT_ID_PATTERN = new RegExp(`^wait_(${WORKFLOW_ULID_BODY})$`, "i");
49320
+ const HOOK_ID_PATTERN = new RegExp(`^hook_(${WORKFLOW_ULID_BODY})$`, "i");
49321
+ const EVENT_ID_PATTERN = new RegExp(`^evnt_(${WORKFLOW_ULID_BODY})$`, "i");
49322
+ const WORKFLOW_ID_PREFIX_PATTERN = /^(step_|wait_|hook_|evnt_|wrun_)/i;
49323
+ function matchPrefixedId(pattern2, prefix, kind, query) {
49324
+ const match2 = query.match(pattern2);
49325
+ if (!match2) {
49326
+ return null;
49327
+ }
49328
+ return { kind, id: `${prefix}_${match2[1].toUpperCase()}` };
49329
+ }
49330
+ function parseExactWorkflowSearchId(query) {
49331
+ const trimmed = query.trim();
49332
+ if (!trimmed) {
49333
+ return null;
49334
+ }
49335
+ return matchPrefixedId(STEP_ID_PATTERN, "step", "step", trimmed) ?? matchPrefixedId(WAIT_ID_PATTERN, "wait", "wait", trimmed) ?? matchPrefixedId(HOOK_ID_PATTERN, "hook", "hook", trimmed) ?? matchPrefixedId(EVENT_ID_PATTERN, "evnt", "event", trimmed);
49336
+ }
49337
+ function looksLikeWorkflowIdSearchInput(query) {
49338
+ const trimmed = query.trim();
49339
+ if (!WORKFLOW_ID_PREFIX_PATTERN.test(trimmed)) {
49340
+ return false;
49341
+ }
49342
+ return /\d/.test(trimmed);
49343
+ }
49317
49344
  const KEYFRAMES = `@keyframes wf-spinner-fade{0%{opacity:1}100%{opacity:.15}}`;
49318
49345
  function Spinner({ size: size2 = 14, color: color5 }) {
49319
49346
  const config2 = size2 <= 12 ? {
@@ -49372,6 +49399,1095 @@ const STYLES$2 = `.wf-decrypt-btn{appearance:none;-webkit-appearance:none;border
49372
49399
  function DecryptButton({ decrypted = false, loading = false, onClick }) {
49373
49400
  return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("style", { dangerouslySetInnerHTML: { __html: STYLES$2 } }), jsxRuntimeExports.jsxs("button", { type: "button", onClick: decrypted ? void 0 : onClick, disabled: decrypted || loading, className: `wf-decrypt-btn ${decrypted ? "wf-decrypt-done" : "wf-decrypt-idle"}`, children: [loading ? jsxRuntimeExports.jsx(Spinner, { size: 14 }) : decrypted ? jsxRuntimeExports.jsxs("svg", { width: 14, height: 14, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [jsxRuntimeExports.jsx("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }), jsxRuntimeExports.jsx("path", { d: "M7 11V7a5 5 0 0 1 9.9-1" })] }) : jsxRuntimeExports.jsxs("svg", { width: 14, height: 14, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [jsxRuntimeExports.jsx("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }), jsxRuntimeExports.jsx("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })] }), loading ? "Decrypting…" : decrypted ? "Decrypted" : "Decrypt"] })] });
49374
49401
  }
49402
+ function __insertCSS(code2) {
49403
+ if (typeof document == "undefined") return;
49404
+ let head = document.head || document.getElementsByTagName("head")[0];
49405
+ let style2 = document.createElement("style");
49406
+ style2.type = "text/css";
49407
+ head.appendChild(style2);
49408
+ style2.styleSheet ? style2.styleSheet.cssText = code2 : style2.appendChild(document.createTextNode(code2));
49409
+ }
49410
+ const getAsset = (type) => {
49411
+ switch (type) {
49412
+ case "success":
49413
+ return SuccessIcon;
49414
+ case "info":
49415
+ return InfoIcon;
49416
+ case "warning":
49417
+ return WarningIcon;
49418
+ case "error":
49419
+ return ErrorIcon;
49420
+ default:
49421
+ return null;
49422
+ }
49423
+ };
49424
+ const bars = Array(12).fill(0);
49425
+ const Loader = ({ visible, className }) => {
49426
+ return /* @__PURE__ */ ReactExports.createElement("div", {
49427
+ className: [
49428
+ "sonner-loading-wrapper",
49429
+ className
49430
+ ].filter(Boolean).join(" "),
49431
+ "data-visible": visible
49432
+ }, /* @__PURE__ */ ReactExports.createElement("div", {
49433
+ className: "sonner-spinner"
49434
+ }, bars.map((_2, i) => /* @__PURE__ */ ReactExports.createElement("div", {
49435
+ className: "sonner-loading-bar",
49436
+ key: `spinner-bar-${i}`
49437
+ }))));
49438
+ };
49439
+ const SuccessIcon = /* @__PURE__ */ ReactExports.createElement("svg", {
49440
+ xmlns: "http://www.w3.org/2000/svg",
49441
+ viewBox: "0 0 20 20",
49442
+ fill: "currentColor",
49443
+ height: "20",
49444
+ width: "20"
49445
+ }, /* @__PURE__ */ ReactExports.createElement("path", {
49446
+ fillRule: "evenodd",
49447
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
49448
+ clipRule: "evenodd"
49449
+ }));
49450
+ const WarningIcon = /* @__PURE__ */ ReactExports.createElement("svg", {
49451
+ xmlns: "http://www.w3.org/2000/svg",
49452
+ viewBox: "0 0 24 24",
49453
+ fill: "currentColor",
49454
+ height: "20",
49455
+ width: "20"
49456
+ }, /* @__PURE__ */ ReactExports.createElement("path", {
49457
+ fillRule: "evenodd",
49458
+ d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
49459
+ clipRule: "evenodd"
49460
+ }));
49461
+ const InfoIcon = /* @__PURE__ */ ReactExports.createElement("svg", {
49462
+ xmlns: "http://www.w3.org/2000/svg",
49463
+ viewBox: "0 0 20 20",
49464
+ fill: "currentColor",
49465
+ height: "20",
49466
+ width: "20"
49467
+ }, /* @__PURE__ */ ReactExports.createElement("path", {
49468
+ fillRule: "evenodd",
49469
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
49470
+ clipRule: "evenodd"
49471
+ }));
49472
+ const ErrorIcon = /* @__PURE__ */ ReactExports.createElement("svg", {
49473
+ xmlns: "http://www.w3.org/2000/svg",
49474
+ viewBox: "0 0 20 20",
49475
+ fill: "currentColor",
49476
+ height: "20",
49477
+ width: "20"
49478
+ }, /* @__PURE__ */ ReactExports.createElement("path", {
49479
+ fillRule: "evenodd",
49480
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
49481
+ clipRule: "evenodd"
49482
+ }));
49483
+ const CloseIcon = /* @__PURE__ */ ReactExports.createElement("svg", {
49484
+ xmlns: "http://www.w3.org/2000/svg",
49485
+ width: "12",
49486
+ height: "12",
49487
+ viewBox: "0 0 24 24",
49488
+ fill: "none",
49489
+ stroke: "currentColor",
49490
+ strokeWidth: "1.5",
49491
+ strokeLinecap: "round",
49492
+ strokeLinejoin: "round"
49493
+ }, /* @__PURE__ */ ReactExports.createElement("line", {
49494
+ x1: "18",
49495
+ y1: "6",
49496
+ x2: "6",
49497
+ y2: "18"
49498
+ }), /* @__PURE__ */ ReactExports.createElement("line", {
49499
+ x1: "6",
49500
+ y1: "6",
49501
+ x2: "18",
49502
+ y2: "18"
49503
+ }));
49504
+ const useIsDocumentHidden = () => {
49505
+ const [isDocumentHidden, setIsDocumentHidden] = ReactExports.useState(document.hidden);
49506
+ ReactExports.useEffect(() => {
49507
+ const callback = () => {
49508
+ setIsDocumentHidden(document.hidden);
49509
+ };
49510
+ document.addEventListener("visibilitychange", callback);
49511
+ return () => window.removeEventListener("visibilitychange", callback);
49512
+ }, []);
49513
+ return isDocumentHidden;
49514
+ };
49515
+ let toastsCounter = 1;
49516
+ class Observer {
49517
+ constructor() {
49518
+ this.subscribe = (subscriber) => {
49519
+ this.subscribers.push(subscriber);
49520
+ return () => {
49521
+ const index2 = this.subscribers.indexOf(subscriber);
49522
+ this.subscribers.splice(index2, 1);
49523
+ };
49524
+ };
49525
+ this.publish = (data) => {
49526
+ this.subscribers.forEach((subscriber) => subscriber(data));
49527
+ };
49528
+ this.addToast = (data) => {
49529
+ this.publish(data);
49530
+ this.toasts = [
49531
+ ...this.toasts,
49532
+ data
49533
+ ];
49534
+ };
49535
+ this.create = (data) => {
49536
+ var _data_id;
49537
+ const { message: message2, ...rest } = data;
49538
+ const id2 = typeof (data == null ? void 0 : data.id) === "number" || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;
49539
+ const alreadyExists = this.toasts.find((toast2) => {
49540
+ return toast2.id === id2;
49541
+ });
49542
+ const dismissible = data.dismissible === void 0 ? true : data.dismissible;
49543
+ if (this.dismissedToasts.has(id2)) {
49544
+ this.dismissedToasts.delete(id2);
49545
+ }
49546
+ if (alreadyExists) {
49547
+ this.toasts = this.toasts.map((toast2) => {
49548
+ if (toast2.id === id2) {
49549
+ this.publish({
49550
+ ...toast2,
49551
+ ...data,
49552
+ id: id2,
49553
+ title: message2
49554
+ });
49555
+ return {
49556
+ ...toast2,
49557
+ ...data,
49558
+ id: id2,
49559
+ dismissible,
49560
+ title: message2
49561
+ };
49562
+ }
49563
+ return toast2;
49564
+ });
49565
+ } else {
49566
+ this.addToast({
49567
+ title: message2,
49568
+ ...rest,
49569
+ dismissible,
49570
+ id: id2
49571
+ });
49572
+ }
49573
+ return id2;
49574
+ };
49575
+ this.dismiss = (id2) => {
49576
+ if (id2) {
49577
+ this.dismissedToasts.add(id2);
49578
+ requestAnimationFrame(() => this.subscribers.forEach((subscriber) => subscriber({
49579
+ id: id2,
49580
+ dismiss: true
49581
+ })));
49582
+ } else {
49583
+ this.toasts.forEach((toast2) => {
49584
+ this.subscribers.forEach((subscriber) => subscriber({
49585
+ id: toast2.id,
49586
+ dismiss: true
49587
+ }));
49588
+ });
49589
+ }
49590
+ return id2;
49591
+ };
49592
+ this.message = (message2, data) => {
49593
+ return this.create({
49594
+ ...data,
49595
+ message: message2
49596
+ });
49597
+ };
49598
+ this.error = (message2, data) => {
49599
+ return this.create({
49600
+ ...data,
49601
+ message: message2,
49602
+ type: "error"
49603
+ });
49604
+ };
49605
+ this.success = (message2, data) => {
49606
+ return this.create({
49607
+ ...data,
49608
+ type: "success",
49609
+ message: message2
49610
+ });
49611
+ };
49612
+ this.info = (message2, data) => {
49613
+ return this.create({
49614
+ ...data,
49615
+ type: "info",
49616
+ message: message2
49617
+ });
49618
+ };
49619
+ this.warning = (message2, data) => {
49620
+ return this.create({
49621
+ ...data,
49622
+ type: "warning",
49623
+ message: message2
49624
+ });
49625
+ };
49626
+ this.loading = (message2, data) => {
49627
+ return this.create({
49628
+ ...data,
49629
+ type: "loading",
49630
+ message: message2
49631
+ });
49632
+ };
49633
+ this.promise = (promise2, data) => {
49634
+ if (!data) {
49635
+ return;
49636
+ }
49637
+ let id2 = void 0;
49638
+ if (data.loading !== void 0) {
49639
+ id2 = this.create({
49640
+ ...data,
49641
+ promise: promise2,
49642
+ type: "loading",
49643
+ message: data.loading,
49644
+ description: typeof data.description !== "function" ? data.description : void 0
49645
+ });
49646
+ }
49647
+ const p2 = Promise.resolve(promise2 instanceof Function ? promise2() : promise2);
49648
+ let shouldDismiss = id2 !== void 0;
49649
+ let result;
49650
+ const originalPromise = p2.then(async (response2) => {
49651
+ result = [
49652
+ "resolve",
49653
+ response2
49654
+ ];
49655
+ const isReactElementResponse = ReactExports.isValidElement(response2);
49656
+ if (isReactElementResponse) {
49657
+ shouldDismiss = false;
49658
+ this.create({
49659
+ id: id2,
49660
+ type: "default",
49661
+ message: response2
49662
+ });
49663
+ } else if (isHttpResponse(response2) && !response2.ok) {
49664
+ shouldDismiss = false;
49665
+ const promiseData = typeof data.error === "function" ? await data.error(`HTTP error! status: ${response2.status}`) : data.error;
49666
+ const description = typeof data.description === "function" ? await data.description(`HTTP error! status: ${response2.status}`) : data.description;
49667
+ const isExtendedResult = typeof promiseData === "object" && !ReactExports.isValidElement(promiseData);
49668
+ const toastSettings = isExtendedResult ? promiseData : {
49669
+ message: promiseData
49670
+ };
49671
+ this.create({
49672
+ id: id2,
49673
+ type: "error",
49674
+ description,
49675
+ ...toastSettings
49676
+ });
49677
+ } else if (response2 instanceof Error) {
49678
+ shouldDismiss = false;
49679
+ const promiseData = typeof data.error === "function" ? await data.error(response2) : data.error;
49680
+ const description = typeof data.description === "function" ? await data.description(response2) : data.description;
49681
+ const isExtendedResult = typeof promiseData === "object" && !ReactExports.isValidElement(promiseData);
49682
+ const toastSettings = isExtendedResult ? promiseData : {
49683
+ message: promiseData
49684
+ };
49685
+ this.create({
49686
+ id: id2,
49687
+ type: "error",
49688
+ description,
49689
+ ...toastSettings
49690
+ });
49691
+ } else if (data.success !== void 0) {
49692
+ shouldDismiss = false;
49693
+ const promiseData = typeof data.success === "function" ? await data.success(response2) : data.success;
49694
+ const description = typeof data.description === "function" ? await data.description(response2) : data.description;
49695
+ const isExtendedResult = typeof promiseData === "object" && !ReactExports.isValidElement(promiseData);
49696
+ const toastSettings = isExtendedResult ? promiseData : {
49697
+ message: promiseData
49698
+ };
49699
+ this.create({
49700
+ id: id2,
49701
+ type: "success",
49702
+ description,
49703
+ ...toastSettings
49704
+ });
49705
+ }
49706
+ }).catch(async (error2) => {
49707
+ result = [
49708
+ "reject",
49709
+ error2
49710
+ ];
49711
+ if (data.error !== void 0) {
49712
+ shouldDismiss = false;
49713
+ const promiseData = typeof data.error === "function" ? await data.error(error2) : data.error;
49714
+ const description = typeof data.description === "function" ? await data.description(error2) : data.description;
49715
+ const isExtendedResult = typeof promiseData === "object" && !ReactExports.isValidElement(promiseData);
49716
+ const toastSettings = isExtendedResult ? promiseData : {
49717
+ message: promiseData
49718
+ };
49719
+ this.create({
49720
+ id: id2,
49721
+ type: "error",
49722
+ description,
49723
+ ...toastSettings
49724
+ });
49725
+ }
49726
+ }).finally(() => {
49727
+ if (shouldDismiss) {
49728
+ this.dismiss(id2);
49729
+ id2 = void 0;
49730
+ }
49731
+ data.finally == null ? void 0 : data.finally.call(data);
49732
+ });
49733
+ const unwrap = () => new Promise((resolve2, reject) => originalPromise.then(() => result[0] === "reject" ? reject(result[1]) : resolve2(result[1])).catch(reject));
49734
+ if (typeof id2 !== "string" && typeof id2 !== "number") {
49735
+ return {
49736
+ unwrap
49737
+ };
49738
+ } else {
49739
+ return Object.assign(id2, {
49740
+ unwrap
49741
+ });
49742
+ }
49743
+ };
49744
+ this.custom = (jsx, data) => {
49745
+ const id2 = (data == null ? void 0 : data.id) || toastsCounter++;
49746
+ this.create({
49747
+ jsx: jsx(id2),
49748
+ id: id2,
49749
+ ...data
49750
+ });
49751
+ return id2;
49752
+ };
49753
+ this.getActiveToasts = () => {
49754
+ return this.toasts.filter((toast2) => !this.dismissedToasts.has(toast2.id));
49755
+ };
49756
+ this.subscribers = [];
49757
+ this.toasts = [];
49758
+ this.dismissedToasts = /* @__PURE__ */ new Set();
49759
+ }
49760
+ }
49761
+ const ToastState = new Observer();
49762
+ const toastFunction = (message2, data) => {
49763
+ const id2 = (data == null ? void 0 : data.id) || toastsCounter++;
49764
+ ToastState.addToast({
49765
+ title: message2,
49766
+ ...data,
49767
+ id: id2
49768
+ });
49769
+ return id2;
49770
+ };
49771
+ const isHttpResponse = (data) => {
49772
+ return data && typeof data === "object" && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "number";
49773
+ };
49774
+ const basicToast = toastFunction;
49775
+ const getHistory = () => ToastState.toasts;
49776
+ const getToasts = () => ToastState.getActiveToasts();
49777
+ const toast = Object.assign(basicToast, {
49778
+ success: ToastState.success,
49779
+ info: ToastState.info,
49780
+ warning: ToastState.warning,
49781
+ error: ToastState.error,
49782
+ custom: ToastState.custom,
49783
+ message: ToastState.message,
49784
+ promise: ToastState.promise,
49785
+ dismiss: ToastState.dismiss,
49786
+ loading: ToastState.loading
49787
+ }, {
49788
+ getHistory,
49789
+ getToasts
49790
+ });
49791
+ __insertCSS("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
49792
+ function isAction(action2) {
49793
+ return action2.label !== void 0;
49794
+ }
49795
+ const VISIBLE_TOASTS_AMOUNT = 3;
49796
+ const VIEWPORT_OFFSET = "24px";
49797
+ const MOBILE_VIEWPORT_OFFSET = "16px";
49798
+ const TOAST_LIFETIME = 4e3;
49799
+ const TOAST_WIDTH = 356;
49800
+ const GAP = 14;
49801
+ const SWIPE_THRESHOLD = 45;
49802
+ const TIME_BEFORE_UNMOUNT = 200;
49803
+ function cn$3(...classes) {
49804
+ return classes.filter(Boolean).join(" ");
49805
+ }
49806
+ function getDefaultSwipeDirections(position2) {
49807
+ const [y2, x2] = position2.split("-");
49808
+ const directions = [];
49809
+ if (y2) {
49810
+ directions.push(y2);
49811
+ }
49812
+ if (x2) {
49813
+ directions.push(x2);
49814
+ }
49815
+ return directions;
49816
+ }
49817
+ const Toast = (props) => {
49818
+ var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8;
49819
+ const { invert: ToasterInvert, toast: toast2, unstyled, interacting, setHeights, visibleToasts, heights, index: index2, toasts, expanded: expanded2, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style: style2, cancelButtonStyle, actionButtonStyle, className = "", descriptionClassName = "", duration: durationFromToaster, position: position2, gap, expandByDefault, classNames, icons, closeButtonAriaLabel = "Close toast" } = props;
49820
+ const [swipeDirection, setSwipeDirection] = ReactExports.useState(null);
49821
+ const [swipeOutDirection, setSwipeOutDirection] = ReactExports.useState(null);
49822
+ const [mounted, setMounted] = ReactExports.useState(false);
49823
+ const [removed, setRemoved] = ReactExports.useState(false);
49824
+ const [swiping, setSwiping] = ReactExports.useState(false);
49825
+ const [swipeOut, setSwipeOut] = ReactExports.useState(false);
49826
+ const [isSwiped, setIsSwiped] = ReactExports.useState(false);
49827
+ const [offsetBeforeRemove, setOffsetBeforeRemove] = ReactExports.useState(0);
49828
+ const [initialHeight, setInitialHeight] = ReactExports.useState(0);
49829
+ const remainingTime = ReactExports.useRef(toast2.duration || durationFromToaster || TOAST_LIFETIME);
49830
+ const dragStartTime = ReactExports.useRef(null);
49831
+ const toastRef = ReactExports.useRef(null);
49832
+ const isFront = index2 === 0;
49833
+ const isVisible = index2 + 1 <= visibleToasts;
49834
+ const toastType = toast2.type;
49835
+ const dismissible = toast2.dismissible !== false;
49836
+ const toastClassname = toast2.className || "";
49837
+ const toastDescriptionClassname = toast2.descriptionClassName || "";
49838
+ const heightIndex = ReactExports.useMemo(() => heights.findIndex((height) => height.toastId === toast2.id) || 0, [
49839
+ heights,
49840
+ toast2.id
49841
+ ]);
49842
+ const closeButton = ReactExports.useMemo(() => {
49843
+ var _toast_closeButton;
49844
+ return (_toast_closeButton = toast2.closeButton) != null ? _toast_closeButton : closeButtonFromToaster;
49845
+ }, [
49846
+ toast2.closeButton,
49847
+ closeButtonFromToaster
49848
+ ]);
49849
+ const duration2 = ReactExports.useMemo(() => toast2.duration || durationFromToaster || TOAST_LIFETIME, [
49850
+ toast2.duration,
49851
+ durationFromToaster
49852
+ ]);
49853
+ const closeTimerStartTimeRef = ReactExports.useRef(0);
49854
+ const offset2 = ReactExports.useRef(0);
49855
+ const lastCloseTimerStartTimeRef = ReactExports.useRef(0);
49856
+ const pointerStartRef = ReactExports.useRef(null);
49857
+ const [y2, x2] = position2.split("-");
49858
+ const toastsHeightBefore = ReactExports.useMemo(() => {
49859
+ return heights.reduce((prev, curr, reducerIndex) => {
49860
+ if (reducerIndex >= heightIndex) {
49861
+ return prev;
49862
+ }
49863
+ return prev + curr.height;
49864
+ }, 0);
49865
+ }, [
49866
+ heights,
49867
+ heightIndex
49868
+ ]);
49869
+ const isDocumentHidden = useIsDocumentHidden();
49870
+ const invert = toast2.invert || ToasterInvert;
49871
+ const disabled = toastType === "loading";
49872
+ offset2.current = ReactExports.useMemo(() => heightIndex * gap + toastsHeightBefore, [
49873
+ heightIndex,
49874
+ toastsHeightBefore
49875
+ ]);
49876
+ ReactExports.useEffect(() => {
49877
+ remainingTime.current = duration2;
49878
+ }, [
49879
+ duration2
49880
+ ]);
49881
+ ReactExports.useEffect(() => {
49882
+ setMounted(true);
49883
+ }, []);
49884
+ ReactExports.useEffect(() => {
49885
+ const toastNode = toastRef.current;
49886
+ if (toastNode) {
49887
+ const height = toastNode.getBoundingClientRect().height;
49888
+ setInitialHeight(height);
49889
+ setHeights((h2) => [
49890
+ {
49891
+ toastId: toast2.id,
49892
+ height,
49893
+ position: toast2.position
49894
+ },
49895
+ ...h2
49896
+ ]);
49897
+ return () => setHeights((h2) => h2.filter((height2) => height2.toastId !== toast2.id));
49898
+ }
49899
+ }, [
49900
+ setHeights,
49901
+ toast2.id
49902
+ ]);
49903
+ ReactExports.useLayoutEffect(() => {
49904
+ if (!mounted) return;
49905
+ const toastNode = toastRef.current;
49906
+ const originalHeight = toastNode.style.height;
49907
+ toastNode.style.height = "auto";
49908
+ const newHeight = toastNode.getBoundingClientRect().height;
49909
+ toastNode.style.height = originalHeight;
49910
+ setInitialHeight(newHeight);
49911
+ setHeights((heights2) => {
49912
+ const alreadyExists = heights2.find((height) => height.toastId === toast2.id);
49913
+ if (!alreadyExists) {
49914
+ return [
49915
+ {
49916
+ toastId: toast2.id,
49917
+ height: newHeight,
49918
+ position: toast2.position
49919
+ },
49920
+ ...heights2
49921
+ ];
49922
+ } else {
49923
+ return heights2.map((height) => height.toastId === toast2.id ? {
49924
+ ...height,
49925
+ height: newHeight
49926
+ } : height);
49927
+ }
49928
+ });
49929
+ }, [
49930
+ mounted,
49931
+ toast2.title,
49932
+ toast2.description,
49933
+ setHeights,
49934
+ toast2.id,
49935
+ toast2.jsx,
49936
+ toast2.action,
49937
+ toast2.cancel
49938
+ ]);
49939
+ const deleteToast = ReactExports.useCallback(() => {
49940
+ setRemoved(true);
49941
+ setOffsetBeforeRemove(offset2.current);
49942
+ setHeights((h2) => h2.filter((height) => height.toastId !== toast2.id));
49943
+ setTimeout(() => {
49944
+ removeToast(toast2);
49945
+ }, TIME_BEFORE_UNMOUNT);
49946
+ }, [
49947
+ toast2,
49948
+ removeToast,
49949
+ setHeights,
49950
+ offset2
49951
+ ]);
49952
+ ReactExports.useEffect(() => {
49953
+ if (toast2.promise && toastType === "loading" || toast2.duration === Infinity || toast2.type === "loading") return;
49954
+ let timeoutId;
49955
+ const pauseTimer = () => {
49956
+ if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) {
49957
+ const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - closeTimerStartTimeRef.current;
49958
+ remainingTime.current = remainingTime.current - elapsedTime;
49959
+ }
49960
+ lastCloseTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
49961
+ };
49962
+ const startTimer = () => {
49963
+ if (remainingTime.current === Infinity) return;
49964
+ closeTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
49965
+ timeoutId = setTimeout(() => {
49966
+ toast2.onAutoClose == null ? void 0 : toast2.onAutoClose.call(toast2, toast2);
49967
+ deleteToast();
49968
+ }, remainingTime.current);
49969
+ };
49970
+ if (expanded2 || interacting || isDocumentHidden) {
49971
+ pauseTimer();
49972
+ } else {
49973
+ startTimer();
49974
+ }
49975
+ return () => clearTimeout(timeoutId);
49976
+ }, [
49977
+ expanded2,
49978
+ interacting,
49979
+ toast2,
49980
+ toastType,
49981
+ isDocumentHidden,
49982
+ deleteToast
49983
+ ]);
49984
+ ReactExports.useEffect(() => {
49985
+ if (toast2.delete) {
49986
+ deleteToast();
49987
+ toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
49988
+ }
49989
+ }, [
49990
+ deleteToast,
49991
+ toast2.delete
49992
+ ]);
49993
+ function getLoadingIcon() {
49994
+ var _toast_classNames9;
49995
+ if (icons == null ? void 0 : icons.loading) {
49996
+ var _toast_classNames12;
49997
+ return /* @__PURE__ */ ReactExports.createElement("div", {
49998
+ className: cn$3(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames12 = toast2.classNames) == null ? void 0 : _toast_classNames12.loader, "sonner-loader"),
49999
+ "data-visible": toastType === "loading"
50000
+ }, icons.loading);
50001
+ }
50002
+ return /* @__PURE__ */ ReactExports.createElement(Loader, {
50003
+ className: cn$3(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames9 = toast2.classNames) == null ? void 0 : _toast_classNames9.loader),
50004
+ visible: toastType === "loading"
50005
+ });
50006
+ }
50007
+ const icon = toast2.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType);
50008
+ var _toast_richColors, _icons_close;
50009
+ return /* @__PURE__ */ ReactExports.createElement("li", {
50010
+ tabIndex: 0,
50011
+ ref: toastRef,
50012
+ className: cn$3(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast2 == null ? void 0 : (_toast_classNames = toast2.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames.default, classNames == null ? void 0 : classNames[toastType], toast2 == null ? void 0 : (_toast_classNames1 = toast2.classNames) == null ? void 0 : _toast_classNames1[toastType]),
50013
+ "data-sonner-toast": "",
50014
+ "data-rich-colors": (_toast_richColors = toast2.richColors) != null ? _toast_richColors : defaultRichColors,
50015
+ "data-styled": !Boolean(toast2.jsx || toast2.unstyled || unstyled),
50016
+ "data-mounted": mounted,
50017
+ "data-promise": Boolean(toast2.promise),
50018
+ "data-swiped": isSwiped,
50019
+ "data-removed": removed,
50020
+ "data-visible": isVisible,
50021
+ "data-y-position": y2,
50022
+ "data-x-position": x2,
50023
+ "data-index": index2,
50024
+ "data-front": isFront,
50025
+ "data-swiping": swiping,
50026
+ "data-dismissible": dismissible,
50027
+ "data-type": toastType,
50028
+ "data-invert": invert,
50029
+ "data-swipe-out": swipeOut,
50030
+ "data-swipe-direction": swipeOutDirection,
50031
+ "data-expanded": Boolean(expanded2 || expandByDefault && mounted),
50032
+ "data-testid": toast2.testId,
50033
+ style: {
50034
+ "--index": index2,
50035
+ "--toasts-before": index2,
50036
+ "--z-index": toasts.length - index2,
50037
+ "--offset": `${removed ? offsetBeforeRemove : offset2.current}px`,
50038
+ "--initial-height": expandByDefault ? "auto" : `${initialHeight}px`,
50039
+ ...style2,
50040
+ ...toast2.style
50041
+ },
50042
+ onDragEnd: () => {
50043
+ setSwiping(false);
50044
+ setSwipeDirection(null);
50045
+ pointerStartRef.current = null;
50046
+ },
50047
+ onPointerDown: (event) => {
50048
+ if (event.button === 2) return;
50049
+ if (disabled || !dismissible) return;
50050
+ dragStartTime.current = /* @__PURE__ */ new Date();
50051
+ setOffsetBeforeRemove(offset2.current);
50052
+ event.target.setPointerCapture(event.pointerId);
50053
+ if (event.target.tagName === "BUTTON") return;
50054
+ setSwiping(true);
50055
+ pointerStartRef.current = {
50056
+ x: event.clientX,
50057
+ y: event.clientY
50058
+ };
50059
+ },
50060
+ onPointerUp: () => {
50061
+ var _toastRef_current, _toastRef_current1, _dragStartTime_current;
50062
+ if (swipeOut || !dismissible) return;
50063
+ pointerStartRef.current = null;
50064
+ const swipeAmountX = Number(((_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0);
50065
+ const swipeAmountY = Number(((_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0);
50066
+ const timeTaken = (/* @__PURE__ */ new Date()).getTime() - ((_dragStartTime_current = dragStartTime.current) == null ? void 0 : _dragStartTime_current.getTime());
50067
+ const swipeAmount = swipeDirection === "x" ? swipeAmountX : swipeAmountY;
50068
+ const velocity = Math.abs(swipeAmount) / timeTaken;
50069
+ if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) {
50070
+ setOffsetBeforeRemove(offset2.current);
50071
+ toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
50072
+ if (swipeDirection === "x") {
50073
+ setSwipeOutDirection(swipeAmountX > 0 ? "right" : "left");
50074
+ } else {
50075
+ setSwipeOutDirection(swipeAmountY > 0 ? "down" : "up");
50076
+ }
50077
+ deleteToast();
50078
+ setSwipeOut(true);
50079
+ return;
50080
+ } else {
50081
+ var _toastRef_current2, _toastRef_current3;
50082
+ (_toastRef_current2 = toastRef.current) == null ? void 0 : _toastRef_current2.style.setProperty("--swipe-amount-x", `0px`);
50083
+ (_toastRef_current3 = toastRef.current) == null ? void 0 : _toastRef_current3.style.setProperty("--swipe-amount-y", `0px`);
50084
+ }
50085
+ setIsSwiped(false);
50086
+ setSwiping(false);
50087
+ setSwipeDirection(null);
50088
+ },
50089
+ onPointerMove: (event) => {
50090
+ var _window_getSelection, _toastRef_current, _toastRef_current1;
50091
+ if (!pointerStartRef.current || !dismissible) return;
50092
+ const isHighlighted = ((_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString().length) > 0;
50093
+ if (isHighlighted) return;
50094
+ const yDelta = event.clientY - pointerStartRef.current.y;
50095
+ const xDelta = event.clientX - pointerStartRef.current.x;
50096
+ var _props_swipeDirections;
50097
+ const swipeDirections = (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position2);
50098
+ if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) {
50099
+ setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? "x" : "y");
50100
+ }
50101
+ let swipeAmount = {
50102
+ x: 0,
50103
+ y: 0
50104
+ };
50105
+ const getDampening = (delta) => {
50106
+ const factor = Math.abs(delta) / 20;
50107
+ return 1 / (1.5 + factor);
50108
+ };
50109
+ if (swipeDirection === "y") {
50110
+ if (swipeDirections.includes("top") || swipeDirections.includes("bottom")) {
50111
+ if (swipeDirections.includes("top") && yDelta < 0 || swipeDirections.includes("bottom") && yDelta > 0) {
50112
+ swipeAmount.y = yDelta;
50113
+ } else {
50114
+ const dampenedDelta = yDelta * getDampening(yDelta);
50115
+ swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta;
50116
+ }
50117
+ }
50118
+ } else if (swipeDirection === "x") {
50119
+ if (swipeDirections.includes("left") || swipeDirections.includes("right")) {
50120
+ if (swipeDirections.includes("left") && xDelta < 0 || swipeDirections.includes("right") && xDelta > 0) {
50121
+ swipeAmount.x = xDelta;
50122
+ } else {
50123
+ const dampenedDelta = xDelta * getDampening(xDelta);
50124
+ swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta;
50125
+ }
50126
+ }
50127
+ }
50128
+ if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) {
50129
+ setIsSwiped(true);
50130
+ }
50131
+ (_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty("--swipe-amount-x", `${swipeAmount.x}px`);
50132
+ (_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty("--swipe-amount-y", `${swipeAmount.y}px`);
50133
+ }
50134
+ }, closeButton && !toast2.jsx && toastType !== "loading" ? /* @__PURE__ */ ReactExports.createElement("button", {
50135
+ "aria-label": closeButtonAriaLabel,
50136
+ "data-disabled": disabled,
50137
+ "data-close-button": true,
50138
+ onClick: disabled || !dismissible ? () => {
50139
+ } : () => {
50140
+ deleteToast();
50141
+ toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
50142
+ },
50143
+ className: cn$3(classNames == null ? void 0 : classNames.closeButton, toast2 == null ? void 0 : (_toast_classNames2 = toast2.classNames) == null ? void 0 : _toast_classNames2.closeButton)
50144
+ }, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast2.icon || toast2.promise) && toast2.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast2.icon) ? /* @__PURE__ */ ReactExports.createElement("div", {
50145
+ "data-icon": "",
50146
+ className: cn$3(classNames == null ? void 0 : classNames.icon, toast2 == null ? void 0 : (_toast_classNames3 = toast2.classNames) == null ? void 0 : _toast_classNames3.icon)
50147
+ }, toast2.promise || toast2.type === "loading" && !toast2.icon ? toast2.icon || getLoadingIcon() : null, toast2.type !== "loading" ? icon : null) : null, /* @__PURE__ */ ReactExports.createElement("div", {
50148
+ "data-content": "",
50149
+ className: cn$3(classNames == null ? void 0 : classNames.content, toast2 == null ? void 0 : (_toast_classNames4 = toast2.classNames) == null ? void 0 : _toast_classNames4.content)
50150
+ }, /* @__PURE__ */ ReactExports.createElement("div", {
50151
+ "data-title": "",
50152
+ className: cn$3(classNames == null ? void 0 : classNames.title, toast2 == null ? void 0 : (_toast_classNames5 = toast2.classNames) == null ? void 0 : _toast_classNames5.title)
50153
+ }, toast2.jsx ? toast2.jsx : typeof toast2.title === "function" ? toast2.title() : toast2.title), toast2.description ? /* @__PURE__ */ ReactExports.createElement("div", {
50154
+ "data-description": "",
50155
+ className: cn$3(descriptionClassName, toastDescriptionClassname, classNames == null ? void 0 : classNames.description, toast2 == null ? void 0 : (_toast_classNames6 = toast2.classNames) == null ? void 0 : _toast_classNames6.description)
50156
+ }, typeof toast2.description === "function" ? toast2.description() : toast2.description) : null), /* @__PURE__ */ ReactExports.isValidElement(toast2.cancel) ? toast2.cancel : toast2.cancel && isAction(toast2.cancel) ? /* @__PURE__ */ ReactExports.createElement("button", {
50157
+ "data-button": true,
50158
+ "data-cancel": true,
50159
+ style: toast2.cancelButtonStyle || cancelButtonStyle,
50160
+ onClick: (event) => {
50161
+ if (!isAction(toast2.cancel)) return;
50162
+ if (!dismissible) return;
50163
+ toast2.cancel.onClick == null ? void 0 : toast2.cancel.onClick.call(toast2.cancel, event);
50164
+ deleteToast();
50165
+ },
50166
+ className: cn$3(classNames == null ? void 0 : classNames.cancelButton, toast2 == null ? void 0 : (_toast_classNames7 = toast2.classNames) == null ? void 0 : _toast_classNames7.cancelButton)
50167
+ }, toast2.cancel.label) : null, /* @__PURE__ */ ReactExports.isValidElement(toast2.action) ? toast2.action : toast2.action && isAction(toast2.action) ? /* @__PURE__ */ ReactExports.createElement("button", {
50168
+ "data-button": true,
50169
+ "data-action": true,
50170
+ style: toast2.actionButtonStyle || actionButtonStyle,
50171
+ onClick: (event) => {
50172
+ if (!isAction(toast2.action)) return;
50173
+ toast2.action.onClick == null ? void 0 : toast2.action.onClick.call(toast2.action, event);
50174
+ if (event.defaultPrevented) return;
50175
+ deleteToast();
50176
+ },
50177
+ className: cn$3(classNames == null ? void 0 : classNames.actionButton, toast2 == null ? void 0 : (_toast_classNames8 = toast2.classNames) == null ? void 0 : _toast_classNames8.actionButton)
50178
+ }, toast2.action.label) : null);
50179
+ };
50180
+ function getDocumentDirection() {
50181
+ if (typeof window === "undefined") return "ltr";
50182
+ if (typeof document === "undefined") return "ltr";
50183
+ const dirAttribute = document.documentElement.getAttribute("dir");
50184
+ if (dirAttribute === "auto" || !dirAttribute) {
50185
+ return window.getComputedStyle(document.documentElement).direction;
50186
+ }
50187
+ return dirAttribute;
50188
+ }
50189
+ function assignOffset(defaultOffset, mobileOffset) {
50190
+ const styles2 = {};
50191
+ [
50192
+ defaultOffset,
50193
+ mobileOffset
50194
+ ].forEach((offset2, index2) => {
50195
+ const isMobile = index2 === 1;
50196
+ const prefix = isMobile ? "--mobile-offset" : "--offset";
50197
+ const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET;
50198
+ function assignAll(offset3) {
50199
+ [
50200
+ "top",
50201
+ "right",
50202
+ "bottom",
50203
+ "left"
50204
+ ].forEach((key) => {
50205
+ styles2[`${prefix}-${key}`] = typeof offset3 === "number" ? `${offset3}px` : offset3;
50206
+ });
50207
+ }
50208
+ if (typeof offset2 === "number" || typeof offset2 === "string") {
50209
+ assignAll(offset2);
50210
+ } else if (typeof offset2 === "object") {
50211
+ [
50212
+ "top",
50213
+ "right",
50214
+ "bottom",
50215
+ "left"
50216
+ ].forEach((key) => {
50217
+ if (offset2[key] === void 0) {
50218
+ styles2[`${prefix}-${key}`] = defaultValue;
50219
+ } else {
50220
+ styles2[`${prefix}-${key}`] = typeof offset2[key] === "number" ? `${offset2[key]}px` : offset2[key];
50221
+ }
50222
+ });
50223
+ } else {
50224
+ assignAll(defaultValue);
50225
+ }
50226
+ });
50227
+ return styles2;
50228
+ }
50229
+ const Toaster$1 = /* @__PURE__ */ ReactExports.forwardRef(function Toaster(props, ref) {
50230
+ const { id: id2, invert, position: position2 = "bottom-right", hotkey = [
50231
+ "altKey",
50232
+ "KeyT"
50233
+ ], expand: expand2, closeButton, className, offset: offset2, mobileOffset, theme: theme3 = "light", richColors, duration: duration2, style: style2, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = "Notifications" } = props;
50234
+ const [toasts, setToasts] = ReactExports.useState([]);
50235
+ const filteredToasts = ReactExports.useMemo(() => {
50236
+ if (id2) {
50237
+ return toasts.filter((toast2) => toast2.toasterId === id2);
50238
+ }
50239
+ return toasts.filter((toast2) => !toast2.toasterId);
50240
+ }, [
50241
+ toasts,
50242
+ id2
50243
+ ]);
50244
+ const possiblePositions = ReactExports.useMemo(() => {
50245
+ return Array.from(new Set([
50246
+ position2
50247
+ ].concat(filteredToasts.filter((toast2) => toast2.position).map((toast2) => toast2.position))));
50248
+ }, [
50249
+ filteredToasts,
50250
+ position2
50251
+ ]);
50252
+ const [heights, setHeights] = ReactExports.useState([]);
50253
+ const [expanded2, setExpanded] = ReactExports.useState(false);
50254
+ const [interacting, setInteracting] = ReactExports.useState(false);
50255
+ const [actualTheme, setActualTheme] = ReactExports.useState(theme3 !== "system" ? theme3 : typeof window !== "undefined" ? window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : "light");
50256
+ const listRef = ReactExports.useRef(null);
50257
+ const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
50258
+ const lastFocusedElementRef = ReactExports.useRef(null);
50259
+ const isFocusWithinRef = ReactExports.useRef(false);
50260
+ const removeToast = ReactExports.useCallback((toastToRemove) => {
50261
+ setToasts((toasts2) => {
50262
+ var _toasts_find;
50263
+ if (!((_toasts_find = toasts2.find((toast2) => toast2.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) {
50264
+ ToastState.dismiss(toastToRemove.id);
50265
+ }
50266
+ return toasts2.filter(({ id: id3 }) => id3 !== toastToRemove.id);
50267
+ });
50268
+ }, []);
50269
+ ReactExports.useEffect(() => {
50270
+ return ToastState.subscribe((toast2) => {
50271
+ if (toast2.dismiss) {
50272
+ requestAnimationFrame(() => {
50273
+ setToasts((toasts2) => toasts2.map((t) => t.id === toast2.id ? {
50274
+ ...t,
50275
+ delete: true
50276
+ } : t));
50277
+ });
50278
+ return;
50279
+ }
50280
+ setTimeout(() => {
50281
+ ReactDOM.flushSync(() => {
50282
+ setToasts((toasts2) => {
50283
+ const indexOfExistingToast = toasts2.findIndex((t) => t.id === toast2.id);
50284
+ if (indexOfExistingToast !== -1) {
50285
+ return [
50286
+ ...toasts2.slice(0, indexOfExistingToast),
50287
+ {
50288
+ ...toasts2[indexOfExistingToast],
50289
+ ...toast2
50290
+ },
50291
+ ...toasts2.slice(indexOfExistingToast + 1)
50292
+ ];
50293
+ }
50294
+ return [
50295
+ toast2,
50296
+ ...toasts2
50297
+ ];
50298
+ });
50299
+ });
50300
+ });
50301
+ });
50302
+ }, [
50303
+ toasts
50304
+ ]);
50305
+ ReactExports.useEffect(() => {
50306
+ if (theme3 !== "system") {
50307
+ setActualTheme(theme3);
50308
+ return;
50309
+ }
50310
+ if (theme3 === "system") {
50311
+ if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
50312
+ setActualTheme("dark");
50313
+ } else {
50314
+ setActualTheme("light");
50315
+ }
50316
+ }
50317
+ if (typeof window === "undefined") return;
50318
+ const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
50319
+ try {
50320
+ darkMediaQuery.addEventListener("change", ({ matches }) => {
50321
+ if (matches) {
50322
+ setActualTheme("dark");
50323
+ } else {
50324
+ setActualTheme("light");
50325
+ }
50326
+ });
50327
+ } catch (error2) {
50328
+ darkMediaQuery.addListener(({ matches }) => {
50329
+ try {
50330
+ if (matches) {
50331
+ setActualTheme("dark");
50332
+ } else {
50333
+ setActualTheme("light");
50334
+ }
50335
+ } catch (e) {
50336
+ console.error(e);
50337
+ }
50338
+ });
50339
+ }
50340
+ }, [
50341
+ theme3
50342
+ ]);
50343
+ ReactExports.useEffect(() => {
50344
+ if (toasts.length <= 1) {
50345
+ setExpanded(false);
50346
+ }
50347
+ }, [
50348
+ toasts
50349
+ ]);
50350
+ ReactExports.useEffect(() => {
50351
+ const handleKeyDown = (event) => {
50352
+ var _listRef_current;
50353
+ const isHotkeyPressed = hotkey.every((key) => event[key] || event.code === key);
50354
+ if (isHotkeyPressed) {
50355
+ var _listRef_current1;
50356
+ setExpanded(true);
50357
+ (_listRef_current1 = listRef.current) == null ? void 0 : _listRef_current1.focus();
50358
+ }
50359
+ if (event.code === "Escape" && (document.activeElement === listRef.current || ((_listRef_current = listRef.current) == null ? void 0 : _listRef_current.contains(document.activeElement)))) {
50360
+ setExpanded(false);
50361
+ }
50362
+ };
50363
+ document.addEventListener("keydown", handleKeyDown);
50364
+ return () => document.removeEventListener("keydown", handleKeyDown);
50365
+ }, [
50366
+ hotkey
50367
+ ]);
50368
+ ReactExports.useEffect(() => {
50369
+ if (listRef.current) {
50370
+ return () => {
50371
+ if (lastFocusedElementRef.current) {
50372
+ lastFocusedElementRef.current.focus({
50373
+ preventScroll: true
50374
+ });
50375
+ lastFocusedElementRef.current = null;
50376
+ isFocusWithinRef.current = false;
50377
+ }
50378
+ };
50379
+ }
50380
+ }, [
50381
+ listRef.current
50382
+ ]);
50383
+ return (
50384
+ // Remove item from normal navigation flow, only available via hotkey
50385
+ /* @__PURE__ */ ReactExports.createElement("section", {
50386
+ ref,
50387
+ "aria-label": `${containerAriaLabel} ${hotkeyLabel}`,
50388
+ tabIndex: -1,
50389
+ "aria-live": "polite",
50390
+ "aria-relevant": "additions text",
50391
+ "aria-atomic": "false",
50392
+ suppressHydrationWarning: true
50393
+ }, possiblePositions.map((position3, index2) => {
50394
+ var _heights_;
50395
+ const [y2, x2] = position3.split("-");
50396
+ if (!filteredToasts.length) return null;
50397
+ return /* @__PURE__ */ ReactExports.createElement("ol", {
50398
+ key: position3,
50399
+ dir: dir === "auto" ? getDocumentDirection() : dir,
50400
+ tabIndex: -1,
50401
+ ref: listRef,
50402
+ className,
50403
+ "data-sonner-toaster": true,
50404
+ "data-sonner-theme": actualTheme,
50405
+ "data-y-position": y2,
50406
+ "data-x-position": x2,
50407
+ style: {
50408
+ "--front-toast-height": `${((_heights_ = heights[0]) == null ? void 0 : _heights_.height) || 0}px`,
50409
+ "--width": `${TOAST_WIDTH}px`,
50410
+ "--gap": `${gap}px`,
50411
+ ...style2,
50412
+ ...assignOffset(offset2, mobileOffset)
50413
+ },
50414
+ onBlur: (event) => {
50415
+ if (isFocusWithinRef.current && !event.currentTarget.contains(event.relatedTarget)) {
50416
+ isFocusWithinRef.current = false;
50417
+ if (lastFocusedElementRef.current) {
50418
+ lastFocusedElementRef.current.focus({
50419
+ preventScroll: true
50420
+ });
50421
+ lastFocusedElementRef.current = null;
50422
+ }
50423
+ }
50424
+ },
50425
+ onFocus: (event) => {
50426
+ const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false";
50427
+ if (isNotDismissible) return;
50428
+ if (!isFocusWithinRef.current) {
50429
+ isFocusWithinRef.current = true;
50430
+ lastFocusedElementRef.current = event.relatedTarget;
50431
+ }
50432
+ },
50433
+ onMouseEnter: () => setExpanded(true),
50434
+ onMouseMove: () => setExpanded(true),
50435
+ onMouseLeave: () => {
50436
+ if (!interacting) {
50437
+ setExpanded(false);
50438
+ }
50439
+ },
50440
+ onDragEnd: () => setExpanded(false),
50441
+ onPointerDown: (event) => {
50442
+ const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false";
50443
+ if (isNotDismissible) return;
50444
+ setInteracting(true);
50445
+ },
50446
+ onPointerUp: () => setInteracting(false)
50447
+ }, filteredToasts.filter((toast2) => !toast2.position && index2 === 0 || toast2.position === position3).map((toast2, index3) => {
50448
+ var _toastOptions_duration, _toastOptions_closeButton;
50449
+ return /* @__PURE__ */ ReactExports.createElement(Toast, {
50450
+ key: toast2.id,
50451
+ icons,
50452
+ index: index3,
50453
+ toast: toast2,
50454
+ defaultRichColors: richColors,
50455
+ duration: (_toastOptions_duration = toastOptions == null ? void 0 : toastOptions.duration) != null ? _toastOptions_duration : duration2,
50456
+ className: toastOptions == null ? void 0 : toastOptions.className,
50457
+ descriptionClassName: toastOptions == null ? void 0 : toastOptions.descriptionClassName,
50458
+ invert,
50459
+ visibleToasts,
50460
+ closeButton: (_toastOptions_closeButton = toastOptions == null ? void 0 : toastOptions.closeButton) != null ? _toastOptions_closeButton : closeButton,
50461
+ interacting,
50462
+ position: position3,
50463
+ style: toastOptions == null ? void 0 : toastOptions.style,
50464
+ unstyled: toastOptions == null ? void 0 : toastOptions.unstyled,
50465
+ classNames: toastOptions == null ? void 0 : toastOptions.classNames,
50466
+ cancelButtonStyle: toastOptions == null ? void 0 : toastOptions.cancelButtonStyle,
50467
+ actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,
50468
+ closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,
50469
+ removeToast,
50470
+ toasts: filteredToasts.filter((t) => t.position == toast2.position),
50471
+ heights: heights.filter((h2) => h2.position == toast2.position),
50472
+ setHeights,
50473
+ expandByDefault: expand2,
50474
+ gap,
50475
+ expanded: expanded2,
50476
+ swipeDirections: props.swipeDirections
50477
+ });
50478
+ }));
50479
+ }))
50480
+ );
50481
+ });
50482
+ const defaultAdapter = {
50483
+ success: (msg, opts) => toast.success(msg, opts),
50484
+ error: (msg, opts) => toast.error(msg, opts),
50485
+ info: (msg, opts) => toast.info(msg, opts)
50486
+ };
50487
+ const ToastContext = reactExports.createContext(defaultAdapter);
50488
+ function useToast() {
50489
+ return reactExports.useContext(ToastContext);
50490
+ }
49375
50491
  var __create = Object.create;
49376
50492
  var __defProp2 = Object.defineProperty;
49377
50493
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -49989,1528 +51105,439 @@ var ObjectValue = ({ object: object2, styles: styles2 }) => {
49989
51105
  if (Array.isArray(object2)) {
49990
51106
  return /* @__PURE__ */ ReactExports.createElement("span", null, `Array(${object2.length})`);
49991
51107
  }
49992
- if (!object2.constructor) {
49993
- return /* @__PURE__ */ ReactExports.createElement("span", null, "Object");
49994
- }
49995
- if (typeof object2.constructor.isBuffer === "function" && object2.constructor.isBuffer(object2)) {
49996
- return /* @__PURE__ */ ReactExports.createElement("span", null, `Buffer[${object2.length}]`);
49997
- }
49998
- return /* @__PURE__ */ ReactExports.createElement("span", null, object2.constructor.name);
49999
- case "function":
50000
- return /* @__PURE__ */ ReactExports.createElement("span", null, /* @__PURE__ */ ReactExports.createElement("span", { style: mkStyle("objectValueFunctionPrefix") }, "ƒ "), /* @__PURE__ */ ReactExports.createElement("span", { style: mkStyle("objectValueFunctionName") }, object2.name, "()"));
50001
- case "symbol":
50002
- return /* @__PURE__ */ ReactExports.createElement("span", { style: mkStyle("objectValueSymbol") }, object2.toString());
50003
- default:
50004
- return /* @__PURE__ */ ReactExports.createElement("span", null);
50005
- }
50006
- };
50007
- var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
50008
- var propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
50009
- function getPropertyValue(object2, propertyName) {
50010
- const propertyDescriptor = Object.getOwnPropertyDescriptor(object2, propertyName);
50011
- if (propertyDescriptor.get) {
50012
- try {
50013
- return propertyDescriptor.get();
50014
- } catch {
50015
- return propertyDescriptor.get;
50016
- }
50017
- }
50018
- return object2[propertyName];
50019
- }
50020
- function intersperse(arr, sep2) {
50021
- if (arr.length === 0) {
50022
- return [];
50023
- }
50024
- return arr.slice(1).reduce((xs, x2) => xs.concat([sep2, x2]), [arr[0]]);
50025
- }
50026
- var ObjectPreview = ({ data }) => {
50027
- const styles2 = useStyles("ObjectPreview");
50028
- const object2 = data;
50029
- if (typeof object2 !== "object" || object2 === null || object2 instanceof Date || object2 instanceof RegExp) {
50030
- return /* @__PURE__ */ ReactExports.createElement(ObjectValue, { object: object2 });
50031
- }
50032
- if (Array.isArray(object2)) {
50033
- const maxProperties = styles2.arrayMaxProperties;
50034
- const previewArray = object2.slice(0, maxProperties).map((element2, index2) => /* @__PURE__ */ ReactExports.createElement(ObjectValue, { key: index2, object: element2 }));
50035
- if (object2.length > maxProperties) {
50036
- previewArray.push(/* @__PURE__ */ ReactExports.createElement("span", { key: "ellipsis" }, "…"));
50037
- }
50038
- const arrayLength = object2.length;
50039
- return /* @__PURE__ */ ReactExports.createElement(ReactExports.Fragment, null, /* @__PURE__ */ ReactExports.createElement("span", { style: styles2.objectDescription }, arrayLength === 0 ? `` : `(${arrayLength}) `), /* @__PURE__ */ ReactExports.createElement("span", { style: styles2.preview }, "[", intersperse(previewArray, ", "), "]"));
50040
- } else {
50041
- const maxProperties = styles2.objectMaxProperties;
50042
- const propertyNodes = [];
50043
- for (const propertyName in object2) {
50044
- if (hasOwnProperty$1.call(object2, propertyName)) {
50045
- let ellipsis;
50046
- if (propertyNodes.length === maxProperties - 1 && Object.keys(object2).length > maxProperties) {
50047
- ellipsis = /* @__PURE__ */ ReactExports.createElement("span", { key: "ellipsis" }, "…");
50048
- }
50049
- const propertyValue2 = getPropertyValue(object2, propertyName);
50050
- propertyNodes.push(
50051
- /* @__PURE__ */ ReactExports.createElement("span", { key: propertyName }, /* @__PURE__ */ ReactExports.createElement(ObjectName, { name: propertyName || `""` }), ": ", /* @__PURE__ */ ReactExports.createElement(ObjectValue, { object: propertyValue2 }), ellipsis)
50052
- );
50053
- if (ellipsis) break;
50054
- }
50055
- }
50056
- const objectConstructorName = object2.constructor ? object2.constructor.name : "Object";
50057
- return /* @__PURE__ */ ReactExports.createElement(ReactExports.Fragment, null, /* @__PURE__ */ ReactExports.createElement("span", { style: styles2.objectDescription }, objectConstructorName === "Object" ? "" : `${objectConstructorName} `), /* @__PURE__ */ ReactExports.createElement("span", { style: styles2.preview }, "{", intersperse(propertyNodes, ", "), "}"));
50058
- }
50059
- };
50060
- var ObjectRootLabel = ({ name: name2, data }) => {
50061
- if (typeof name2 === "string") {
50062
- return /* @__PURE__ */ ReactExports.createElement("span", null, /* @__PURE__ */ ReactExports.createElement(ObjectName, { name: name2 }), /* @__PURE__ */ ReactExports.createElement("span", null, ": "), /* @__PURE__ */ ReactExports.createElement(ObjectPreview, { data }));
50063
- } else {
50064
- return /* @__PURE__ */ ReactExports.createElement(ObjectPreview, { data });
50065
- }
50066
- };
50067
- var ObjectLabel = ({ name: name2, data, isNonenumerable = false }) => {
50068
- const object2 = data;
50069
- return /* @__PURE__ */ ReactExports.createElement("span", null, typeof name2 === "string" ? /* @__PURE__ */ ReactExports.createElement(ObjectName, { name: name2, dimmed: isNonenumerable }) : /* @__PURE__ */ ReactExports.createElement(ObjectPreview, { data: name2 }), /* @__PURE__ */ ReactExports.createElement("span", null, ": "), /* @__PURE__ */ ReactExports.createElement(ObjectValue, { object: object2 }));
50070
- };
50071
- var createIterator = (showNonenumerable, sortObjectKeys) => {
50072
- const objectIterator = function* (data) {
50073
- const shouldIterate = typeof data === "object" && data !== null || typeof data === "function";
50074
- if (!shouldIterate) return;
50075
- const dataIsArray = Array.isArray(data);
50076
- if (!dataIsArray && data[Symbol.iterator]) {
50077
- let i = 0;
50078
- for (const entry2 of data) {
50079
- if (Array.isArray(entry2) && entry2.length === 2) {
50080
- const [k2, v2] = entry2;
50081
- yield {
50082
- name: k2,
50083
- data: v2
50084
- };
50085
- } else {
50086
- yield {
50087
- name: i.toString(),
50088
- data: entry2
50089
- };
50090
- }
50091
- i++;
50092
- }
50093
- } else {
50094
- const keys2 = Object.getOwnPropertyNames(data);
50095
- if (sortObjectKeys === true && !dataIsArray) {
50096
- keys2.sort();
50097
- } else if (typeof sortObjectKeys === "function") {
50098
- keys2.sort(sortObjectKeys);
50099
- }
50100
- for (const propertyName of keys2) {
50101
- if (propertyIsEnumerable.call(data, propertyName)) {
50102
- const propertyValue2 = getPropertyValue(data, propertyName);
50103
- yield {
50104
- name: propertyName || `""`,
50105
- data: propertyValue2
50106
- };
50107
- } else if (showNonenumerable) {
50108
- let propertyValue2;
50109
- try {
50110
- propertyValue2 = getPropertyValue(data, propertyName);
50111
- } catch (e) {
50112
- }
50113
- if (propertyValue2 !== void 0) {
50114
- yield {
50115
- name: propertyName,
50116
- data: propertyValue2,
50117
- isNonenumerable: true
50118
- };
50119
- }
50120
- }
50121
- }
50122
- if (showNonenumerable && data !== Object.prototype) {
50123
- yield {
50124
- name: "__proto__",
50125
- data: Object.getPrototypeOf(data),
50126
- isNonenumerable: true
50127
- };
50128
- }
50129
- }
50130
- };
50131
- return objectIterator;
50132
- };
50133
- var defaultNodeRenderer = ({ depth, name: name2, data, isNonenumerable }) => depth === 0 ? /* @__PURE__ */ ReactExports.createElement(ObjectRootLabel, { name: name2, data }) : /* @__PURE__ */ ReactExports.createElement(ObjectLabel, { name: name2, data, isNonenumerable });
50134
- var ObjectInspector = ({ showNonenumerable = false, sortObjectKeys, nodeRenderer, ...treeViewProps }) => {
50135
- const dataIterator = createIterator(showNonenumerable, sortObjectKeys);
50136
- const renderer = nodeRenderer ? nodeRenderer : defaultNodeRenderer;
50137
- return /* @__PURE__ */ ReactExports.createElement(TreeView, { nodeRenderer: renderer, dataIterator, ...treeViewProps });
50138
- };
50139
- var themedObjectInspector = themeAcceptor(ObjectInspector);
50140
- __toESM(require_is_dom());
50141
- const useDarkMode = () => {
50142
- const [isDark, setIsDark] = reactExports.useState(() => {
50143
- if (typeof document === "undefined")
50144
- return false;
50145
- return document.documentElement.classList.contains("dark");
50146
- });
50147
- reactExports.useEffect(() => {
50148
- if (typeof document === "undefined")
50149
- return;
50150
- const observer = new MutationObserver(() => {
50151
- setIsDark(document.documentElement.classList.contains("dark"));
50152
- });
50153
- observer.observe(document.documentElement, {
50154
- attributes: true,
50155
- attributeFilter: ["class"]
50156
- });
50157
- return () => observer.disconnect();
50158
- }, []);
50159
- return isDark;
50160
- };
50161
- const inspectorThemeExtendedLight = {
50162
- OBJECT_VALUE_DATE_COLOR: "#a21caf"
50163
- // fuchsia-700
50164
- };
50165
- const inspectorThemeExtendedDark = {
50166
- OBJECT_VALUE_DATE_COLOR: "#e879f9"
50167
- // fuchsia-400
50168
- };
50169
- const shared = {
50170
- BASE_FONT_SIZE: "11px",
50171
- BASE_LINE_HEIGHT: 1.4,
50172
- BASE_BACKGROUND_COLOR: "transparent",
50173
- OBJECT_PREVIEW_ARRAY_MAX_PROPERTIES: 10,
50174
- OBJECT_PREVIEW_OBJECT_MAX_PROPERTIES: 5,
50175
- HTML_TAGNAME_TEXT_TRANSFORM: "lowercase",
50176
- ARROW_MARGIN_RIGHT: 3,
50177
- ARROW_FONT_SIZE: 12,
50178
- TREENODE_FONT_FAMILY: "var(--font-mono)",
50179
- TREENODE_FONT_SIZE: "11px",
50180
- TREENODE_LINE_HEIGHT: 1.4,
50181
- TREENODE_PADDING_LEFT: 12,
50182
- TABLE_DATA_BACKGROUND_IMAGE: "none",
50183
- TABLE_DATA_BACKGROUND_SIZE: "0"
50184
- };
50185
- const inspectorThemeLight = {
50186
- ...shared,
50187
- // Base text
50188
- BASE_COLOR: "var(--ds-gray-1000)",
50189
- // Property names — unstyled, same as base foreground (Node: no style)
50190
- OBJECT_NAME_COLOR: "var(--ds-gray-900)",
50191
- // Strings & symbols — green (Node: 'green')
50192
- OBJECT_VALUE_STRING_COLOR: "#16a34a",
50193
- // green-600
50194
- OBJECT_VALUE_SYMBOL_COLOR: "#16a34a",
50195
- // Numbers & booleans — yellow/amber (Node: 'yellow')
50196
- OBJECT_VALUE_NUMBER_COLOR: "#b45309",
50197
- // amber-700 (readable on white)
50198
- OBJECT_VALUE_BOOLEAN_COLOR: "#b45309",
50199
- // null — bold foreground (Node: 'bold')
50200
- OBJECT_VALUE_NULL_COLOR: "var(--ds-gray-900)",
50201
- // undefined — grey (Node: 'grey')
50202
- OBJECT_VALUE_UNDEFINED_COLOR: "var(--ds-gray-500)",
50203
- // RegExp — red (Node regexp base uses green/red/yellow palette)
50204
- OBJECT_VALUE_REGEXP_COLOR: "#dc2626",
50205
- // red-600
50206
- // Functions — cyan (Node: 'special' → 'cyan')
50207
- OBJECT_VALUE_FUNCTION_PREFIX_COLOR: "#0891b2",
50208
- // cyan-600
50209
- // HTML (less relevant for data inspection, but reasonable defaults)
50210
- HTML_TAG_COLOR: "var(--ds-gray-500)",
50211
- HTML_TAGNAME_COLOR: "#0891b2",
50212
- HTML_ATTRIBUTE_NAME_COLOR: "#b45309",
50213
- HTML_ATTRIBUTE_VALUE_COLOR: "#16a34a",
50214
- HTML_COMMENT_COLOR: "var(--ds-gray-400)",
50215
- HTML_DOCTYPE_COLOR: "var(--ds-gray-400)",
50216
- // Structural
50217
- ARROW_COLOR: "var(--ds-gray-500)",
50218
- TABLE_BORDER_COLOR: "var(--ds-gray-300)",
50219
- TABLE_TH_BACKGROUND_COLOR: "var(--ds-gray-100)",
50220
- TABLE_TH_HOVER_COLOR: "var(--ds-gray-200)",
50221
- TABLE_SORT_ICON_COLOR: "var(--ds-gray-500)"
50222
- };
50223
- const inspectorThemeDark = {
50224
- ...shared,
50225
- // Base text
50226
- BASE_COLOR: "var(--ds-gray-1000)",
50227
- // Property names — white/light foreground (Node: unstyled = white in dark terminal)
50228
- OBJECT_NAME_COLOR: "var(--ds-gray-900)",
50229
- // Strings & symbols — green (Node: 'green')
50230
- OBJECT_VALUE_STRING_COLOR: "#4ade80",
50231
- // green-400
50232
- OBJECT_VALUE_SYMBOL_COLOR: "#4ade80",
50233
- // Numbers & booleans — yellow (Node: 'yellow')
50234
- OBJECT_VALUE_NUMBER_COLOR: "#facc15",
50235
- // yellow-400
50236
- OBJECT_VALUE_BOOLEAN_COLOR: "#facc15",
50237
- // null — bold foreground / white (Node: 'bold')
50238
- OBJECT_VALUE_NULL_COLOR: "var(--ds-gray-1000)",
50239
- // undefined — grey (Node: 'grey')
50240
- OBJECT_VALUE_UNDEFINED_COLOR: "var(--ds-gray-500)",
50241
- // RegExp — red (Node regexp palette)
50242
- OBJECT_VALUE_REGEXP_COLOR: "#f87171",
50243
- // red-400
50244
- // Functions — cyan (Node: 'special' → 'cyan')
50245
- OBJECT_VALUE_FUNCTION_PREFIX_COLOR: "#22d3ee",
50246
- // cyan-400
50247
- // HTML
50248
- HTML_TAG_COLOR: "var(--ds-gray-500)",
50249
- HTML_TAGNAME_COLOR: "#22d3ee",
50250
- HTML_ATTRIBUTE_NAME_COLOR: "#facc15",
50251
- HTML_ATTRIBUTE_VALUE_COLOR: "#4ade80",
50252
- HTML_COMMENT_COLOR: "var(--ds-gray-500)",
50253
- HTML_DOCTYPE_COLOR: "var(--ds-gray-500)",
50254
- // Structural
50255
- ARROW_COLOR: "var(--ds-gray-500)",
50256
- TABLE_BORDER_COLOR: "var(--ds-gray-300)",
50257
- TABLE_TH_BACKGROUND_COLOR: "var(--ds-gray-100)",
50258
- TABLE_TH_HOVER_COLOR: "var(--ds-gray-200)",
50259
- TABLE_SORT_ICON_COLOR: "var(--ds-gray-500)"
50260
- };
50261
- const STREAM_REF_TYPE = "__workflow_stream_ref__";
50262
- const CLASS_INSTANCE_REF_TYPE = "__workflow_class_instance_ref__";
50263
- function isStreamRef(value) {
50264
- return value !== null && typeof value === "object" && "__type" in value && value.__type === STREAM_REF_TYPE;
50265
- }
50266
- function isClassInstanceRef(value) {
50267
- return value !== null && typeof value === "object" && "__type" in value && value.__type === CLASS_INSTANCE_REF_TYPE;
50268
- }
50269
- const StreamClickContext = reactExports.createContext(void 0);
50270
- const DecryptClickContext = reactExports.createContext(void 0);
50271
- function EncryptedInlineLabel() {
50272
- const ctx = reactExports.useContext(DecryptClickContext);
50273
- if (ctx) {
50274
- return jsxRuntimeExports.jsxs("button", { type: "button", className: "inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] cursor-pointer", style: {
50275
- backgroundColor: "var(--ds-gray-100)",
50276
- color: "var(--ds-gray-700)",
50277
- border: "1px solid var(--ds-gray-400)",
50278
- fontStyle: "italic",
50279
- opacity: ctx.isDecrypting ? 0.6 : 1
50280
- }, disabled: ctx.isDecrypting, onClick: (e) => {
50281
- e.stopPropagation();
50282
- ctx.onDecrypt();
50283
- }, title: "Click to decrypt", children: [ctx.isDecrypting ? jsxRuntimeExports.jsx(Spinner, { size: 12 }) : jsxRuntimeExports.jsx(Lock, { className: "h-3 w-3", style: { display: "inline", flexShrink: 0 } }), jsxRuntimeExports.jsx("span", { children: ctx.isDecrypting ? "Decrypting…" : "Decrypt" })] });
50284
- }
50285
- return jsxRuntimeExports.jsxs("span", { style: { color: "var(--ds-gray-600)", fontStyle: "italic" }, children: [jsxRuntimeExports.jsx(Lock, { className: "h-3 w-3", style: {
50286
- display: "inline",
50287
- verticalAlign: "middle",
50288
- marginRight: "3px",
50289
- marginTop: "-1px"
50290
- } }), "Encrypted"] });
50291
- }
50292
- function StreamRefInline({ streamRef }) {
50293
- const onStreamClick = reactExports.useContext(StreamClickContext);
50294
- return jsxRuntimeExports.jsxs("button", { type: "button", className: "inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-mono cursor-pointer", style: {
50295
- backgroundColor: "var(--ds-blue-100)",
50296
- color: "var(--ds-blue-800)",
50297
- border: "1px solid var(--ds-blue-300)"
50298
- }, onClick: () => onStreamClick == null ? void 0 : onStreamClick(streamRef.streamId), title: `View stream: ${streamRef.streamId}`, children: [jsxRuntimeExports.jsx("span", { children: "📡" }), jsxRuntimeExports.jsx("span", { children: streamRef.streamId })] });
50299
- }
50300
- const ExtendedThemeContext = reactExports.createContext(inspectorThemeExtendedLight);
50301
- function NodeRenderer$1({ depth, name: name2, data, isNonenumerable }) {
50302
- var _a3;
50303
- const extendedTheme = reactExports.useContext(ExtendedThemeContext);
50304
- if (data !== null && typeof data === "object" && ((_a3 = data.constructor) == null ? void 0 : _a3.name) === ENCRYPTED_DISPLAY_NAME) {
50305
- const label = jsxRuntimeExports.jsx(EncryptedInlineLabel, {});
50306
- if (depth === 0) {
50307
- return label;
50308
- }
50309
- return jsxRuntimeExports.jsxs("span", { children: [name2 != null && jsxRuntimeExports.jsx(ObjectName, { name: name2 }), name2 != null && jsxRuntimeExports.jsx("span", { children: ": " }), label] });
50310
- }
50311
- if (isStreamRef(data)) {
50312
- return jsxRuntimeExports.jsxs("span", { children: [name2 != null && jsxRuntimeExports.jsx(ObjectName, { name: name2 }), name2 != null && jsxRuntimeExports.jsx("span", { children: ": " }), jsxRuntimeExports.jsx(StreamRefInline, { streamRef: data })] });
50313
- }
50314
- if (isClassInstanceRef(data)) {
50315
- if (depth === 0) {
50316
- return jsxRuntimeExports.jsx(ObjectRootLabel, { name: data.className, data: data.data });
50317
- }
50318
- return jsxRuntimeExports.jsxs("span", { children: [name2 != null && jsxRuntimeExports.jsx(ObjectName, { name: name2 }), name2 != null && jsxRuntimeExports.jsx("span", { children: ": " }), jsxRuntimeExports.jsxs("span", { style: { fontStyle: "italic" }, children: [data.className, " "] }), jsxRuntimeExports.jsx(ObjectValue, { object: data.data })] });
50319
- }
50320
- if (data instanceof Date) {
50321
- const dateStr = data.toISOString();
50322
- if (depth === 0) {
50323
- return jsxRuntimeExports.jsx("span", { style: { color: extendedTheme.OBJECT_VALUE_DATE_COLOR }, children: dateStr });
50324
- }
50325
- return jsxRuntimeExports.jsxs("span", { children: [name2 != null && jsxRuntimeExports.jsx(ObjectName, { name: name2 }), name2 != null && jsxRuntimeExports.jsx("span", { children: ": " }), jsxRuntimeExports.jsx("span", { style: { color: extendedTheme.OBJECT_VALUE_DATE_COLOR }, children: dateStr })] });
50326
- }
50327
- if (depth === 0) {
50328
- return jsxRuntimeExports.jsx(ObjectRootLabel, { name: name2, data });
50329
- }
50330
- return jsxRuntimeExports.jsx(ObjectLabel, { name: name2, data, isNonenumerable });
50331
- }
50332
- function DataInspector({ data, expandLevel = 2, name: name2, onStreamClick, onDecrypt, isDecrypting = false }) {
50333
- const stableData = useStableInspectorData(data);
50334
- const [initialExpandLevel, setInitialExpandLevel] = reactExports.useState(expandLevel);
50335
- const isDark = useDarkMode();
50336
- const extendedTheme = isDark ? inspectorThemeExtendedDark : inspectorThemeExtendedLight;
50337
- reactExports.useEffect(() => {
50338
- setInitialExpandLevel(0);
50339
- }, []);
50340
- const content2 = jsxRuntimeExports.jsx(ExtendedThemeContext.Provider, { value: extendedTheme, children: jsxRuntimeExports.jsx(themedObjectInspector, {
50341
- data: stableData,
50342
- name: name2,
50343
- // @ts-expect-error react-inspector accepts theme objects at runtime despite
50344
- // types declaring string only — see https://github.com/storybookjs/react-inspector/blob/main/README.md#theme
50345
- theme: isDark ? inspectorThemeDark : inspectorThemeLight,
50346
- expandLevel: initialExpandLevel,
50347
- nodeRenderer: NodeRenderer$1
50348
- }) });
50349
- let wrapped = content2;
50350
- if (onStreamClick) {
50351
- wrapped = jsxRuntimeExports.jsx(StreamClickContext.Provider, { value: onStreamClick, children: wrapped });
50352
- }
50353
- if (onDecrypt) {
50354
- wrapped = jsxRuntimeExports.jsx(DecryptClickContext.Provider, { value: { onDecrypt, isDecrypting }, children: wrapped });
50355
- }
50356
- return wrapped;
50357
- }
50358
- function useStableInspectorData(next2) {
50359
- const previousRef = reactExports.useRef(next2);
50360
- if (!isDeepEqual(previousRef.current, next2)) {
50361
- previousRef.current = next2;
50362
- }
50363
- return previousRef.current;
50364
- }
50365
- function isObjectLike(value) {
50366
- return typeof value === "object" && value !== null;
50367
- }
50368
- function isDeepEqual(a2, b2, seen = /* @__PURE__ */ new WeakMap()) {
50369
- if (Object.is(a2, b2))
50370
- return true;
50371
- if (a2 instanceof Date && b2 instanceof Date) {
50372
- return a2.getTime() === b2.getTime();
50373
- }
50374
- if (a2 instanceof RegExp && b2 instanceof RegExp) {
50375
- return a2.source === b2.source && a2.flags === b2.flags;
50376
- }
50377
- if (a2 instanceof Map && b2 instanceof Map) {
50378
- if (a2.size !== b2.size)
50379
- return false;
50380
- for (const [key, value] of a2.entries()) {
50381
- if (!b2.has(key) || !isDeepEqual(value, b2.get(key), seen))
50382
- return false;
50383
- }
50384
- return true;
50385
- }
50386
- if (a2 instanceof Set && b2 instanceof Set) {
50387
- if (a2.size !== b2.size)
50388
- return false;
50389
- for (const value of a2.values()) {
50390
- if (!b2.has(value))
50391
- return false;
50392
- }
50393
- return true;
50394
- }
50395
- if (!isObjectLike(a2) || !isObjectLike(b2)) {
50396
- return false;
50397
- }
50398
- if (seen.get(a2) === b2)
50399
- return true;
50400
- seen.set(a2, b2);
50401
- const aIsArray = Array.isArray(a2);
50402
- const bIsArray = Array.isArray(b2);
50403
- if (aIsArray !== bIsArray)
50404
- return false;
50405
- if (aIsArray && bIsArray) {
50406
- if (a2.length !== b2.length)
50407
- return false;
50408
- for (let i = 0; i < a2.length; i += 1) {
50409
- if (!isDeepEqual(a2[i], b2[i], seen))
50410
- return false;
50411
- }
50412
- return true;
50413
- }
50414
- const aKeys = Object.keys(a2);
50415
- const bKeys = Object.keys(b2);
50416
- if (aKeys.length !== bKeys.length)
50417
- return false;
50418
- for (const key of aKeys) {
50419
- if (!Object.hasOwn(b2, key))
50420
- return false;
50421
- if (!isDeepEqual(a2[key], b2[key], seen))
50422
- return false;
50423
- }
50424
- return true;
50425
- }
50426
- function __insertCSS(code2) {
50427
- if (typeof document == "undefined") return;
50428
- let head = document.head || document.getElementsByTagName("head")[0];
50429
- let style2 = document.createElement("style");
50430
- style2.type = "text/css";
50431
- head.appendChild(style2);
50432
- style2.styleSheet ? style2.styleSheet.cssText = code2 : style2.appendChild(document.createTextNode(code2));
50433
- }
50434
- const getAsset = (type) => {
50435
- switch (type) {
50436
- case "success":
50437
- return SuccessIcon;
50438
- case "info":
50439
- return InfoIcon;
50440
- case "warning":
50441
- return WarningIcon;
50442
- case "error":
50443
- return ErrorIcon;
50444
- default:
50445
- return null;
50446
- }
50447
- };
50448
- const bars = Array(12).fill(0);
50449
- const Loader = ({ visible, className }) => {
50450
- return /* @__PURE__ */ ReactExports.createElement("div", {
50451
- className: [
50452
- "sonner-loading-wrapper",
50453
- className
50454
- ].filter(Boolean).join(" "),
50455
- "data-visible": visible
50456
- }, /* @__PURE__ */ ReactExports.createElement("div", {
50457
- className: "sonner-spinner"
50458
- }, bars.map((_2, i) => /* @__PURE__ */ ReactExports.createElement("div", {
50459
- className: "sonner-loading-bar",
50460
- key: `spinner-bar-${i}`
50461
- }))));
50462
- };
50463
- const SuccessIcon = /* @__PURE__ */ ReactExports.createElement("svg", {
50464
- xmlns: "http://www.w3.org/2000/svg",
50465
- viewBox: "0 0 20 20",
50466
- fill: "currentColor",
50467
- height: "20",
50468
- width: "20"
50469
- }, /* @__PURE__ */ ReactExports.createElement("path", {
50470
- fillRule: "evenodd",
50471
- d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
50472
- clipRule: "evenodd"
50473
- }));
50474
- const WarningIcon = /* @__PURE__ */ ReactExports.createElement("svg", {
50475
- xmlns: "http://www.w3.org/2000/svg",
50476
- viewBox: "0 0 24 24",
50477
- fill: "currentColor",
50478
- height: "20",
50479
- width: "20"
50480
- }, /* @__PURE__ */ ReactExports.createElement("path", {
50481
- fillRule: "evenodd",
50482
- d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
50483
- clipRule: "evenodd"
50484
- }));
50485
- const InfoIcon = /* @__PURE__ */ ReactExports.createElement("svg", {
50486
- xmlns: "http://www.w3.org/2000/svg",
50487
- viewBox: "0 0 20 20",
50488
- fill: "currentColor",
50489
- height: "20",
50490
- width: "20"
50491
- }, /* @__PURE__ */ ReactExports.createElement("path", {
50492
- fillRule: "evenodd",
50493
- d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
50494
- clipRule: "evenodd"
50495
- }));
50496
- const ErrorIcon = /* @__PURE__ */ ReactExports.createElement("svg", {
50497
- xmlns: "http://www.w3.org/2000/svg",
50498
- viewBox: "0 0 20 20",
50499
- fill: "currentColor",
50500
- height: "20",
50501
- width: "20"
50502
- }, /* @__PURE__ */ ReactExports.createElement("path", {
50503
- fillRule: "evenodd",
50504
- d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
50505
- clipRule: "evenodd"
50506
- }));
50507
- const CloseIcon = /* @__PURE__ */ ReactExports.createElement("svg", {
50508
- xmlns: "http://www.w3.org/2000/svg",
50509
- width: "12",
50510
- height: "12",
50511
- viewBox: "0 0 24 24",
50512
- fill: "none",
50513
- stroke: "currentColor",
50514
- strokeWidth: "1.5",
50515
- strokeLinecap: "round",
50516
- strokeLinejoin: "round"
50517
- }, /* @__PURE__ */ ReactExports.createElement("line", {
50518
- x1: "18",
50519
- y1: "6",
50520
- x2: "6",
50521
- y2: "18"
50522
- }), /* @__PURE__ */ ReactExports.createElement("line", {
50523
- x1: "6",
50524
- y1: "6",
50525
- x2: "18",
50526
- y2: "18"
50527
- }));
50528
- const useIsDocumentHidden = () => {
50529
- const [isDocumentHidden, setIsDocumentHidden] = ReactExports.useState(document.hidden);
50530
- ReactExports.useEffect(() => {
50531
- const callback = () => {
50532
- setIsDocumentHidden(document.hidden);
50533
- };
50534
- document.addEventListener("visibilitychange", callback);
50535
- return () => window.removeEventListener("visibilitychange", callback);
50536
- }, []);
50537
- return isDocumentHidden;
50538
- };
50539
- let toastsCounter = 1;
50540
- class Observer {
50541
- constructor() {
50542
- this.subscribe = (subscriber) => {
50543
- this.subscribers.push(subscriber);
50544
- return () => {
50545
- const index2 = this.subscribers.indexOf(subscriber);
50546
- this.subscribers.splice(index2, 1);
50547
- };
50548
- };
50549
- this.publish = (data) => {
50550
- this.subscribers.forEach((subscriber) => subscriber(data));
50551
- };
50552
- this.addToast = (data) => {
50553
- this.publish(data);
50554
- this.toasts = [
50555
- ...this.toasts,
50556
- data
50557
- ];
50558
- };
50559
- this.create = (data) => {
50560
- var _data_id;
50561
- const { message: message2, ...rest } = data;
50562
- const id2 = typeof (data == null ? void 0 : data.id) === "number" || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;
50563
- const alreadyExists = this.toasts.find((toast2) => {
50564
- return toast2.id === id2;
50565
- });
50566
- const dismissible = data.dismissible === void 0 ? true : data.dismissible;
50567
- if (this.dismissedToasts.has(id2)) {
50568
- this.dismissedToasts.delete(id2);
50569
- }
50570
- if (alreadyExists) {
50571
- this.toasts = this.toasts.map((toast2) => {
50572
- if (toast2.id === id2) {
50573
- this.publish({
50574
- ...toast2,
50575
- ...data,
50576
- id: id2,
50577
- title: message2
50578
- });
50579
- return {
50580
- ...toast2,
50581
- ...data,
50582
- id: id2,
50583
- dismissible,
50584
- title: message2
50585
- };
50586
- }
50587
- return toast2;
50588
- });
50589
- } else {
50590
- this.addToast({
50591
- title: message2,
50592
- ...rest,
50593
- dismissible,
50594
- id: id2
50595
- });
50596
- }
50597
- return id2;
50598
- };
50599
- this.dismiss = (id2) => {
50600
- if (id2) {
50601
- this.dismissedToasts.add(id2);
50602
- requestAnimationFrame(() => this.subscribers.forEach((subscriber) => subscriber({
50603
- id: id2,
50604
- dismiss: true
50605
- })));
50606
- } else {
50607
- this.toasts.forEach((toast2) => {
50608
- this.subscribers.forEach((subscriber) => subscriber({
50609
- id: toast2.id,
50610
- dismiss: true
50611
- }));
50612
- });
50613
- }
50614
- return id2;
50615
- };
50616
- this.message = (message2, data) => {
50617
- return this.create({
50618
- ...data,
50619
- message: message2
50620
- });
50621
- };
50622
- this.error = (message2, data) => {
50623
- return this.create({
50624
- ...data,
50625
- message: message2,
50626
- type: "error"
50627
- });
50628
- };
50629
- this.success = (message2, data) => {
50630
- return this.create({
50631
- ...data,
50632
- type: "success",
50633
- message: message2
50634
- });
50635
- };
50636
- this.info = (message2, data) => {
50637
- return this.create({
50638
- ...data,
50639
- type: "info",
50640
- message: message2
50641
- });
50642
- };
50643
- this.warning = (message2, data) => {
50644
- return this.create({
50645
- ...data,
50646
- type: "warning",
50647
- message: message2
50648
- });
50649
- };
50650
- this.loading = (message2, data) => {
50651
- return this.create({
50652
- ...data,
50653
- type: "loading",
50654
- message: message2
50655
- });
50656
- };
50657
- this.promise = (promise2, data) => {
50658
- if (!data) {
50659
- return;
50660
- }
50661
- let id2 = void 0;
50662
- if (data.loading !== void 0) {
50663
- id2 = this.create({
50664
- ...data,
50665
- promise: promise2,
50666
- type: "loading",
50667
- message: data.loading,
50668
- description: typeof data.description !== "function" ? data.description : void 0
50669
- });
50670
- }
50671
- const p2 = Promise.resolve(promise2 instanceof Function ? promise2() : promise2);
50672
- let shouldDismiss = id2 !== void 0;
50673
- let result;
50674
- const originalPromise = p2.then(async (response2) => {
50675
- result = [
50676
- "resolve",
50677
- response2
50678
- ];
50679
- const isReactElementResponse = ReactExports.isValidElement(response2);
50680
- if (isReactElementResponse) {
50681
- shouldDismiss = false;
50682
- this.create({
50683
- id: id2,
50684
- type: "default",
50685
- message: response2
50686
- });
50687
- } else if (isHttpResponse(response2) && !response2.ok) {
50688
- shouldDismiss = false;
50689
- const promiseData = typeof data.error === "function" ? await data.error(`HTTP error! status: ${response2.status}`) : data.error;
50690
- const description = typeof data.description === "function" ? await data.description(`HTTP error! status: ${response2.status}`) : data.description;
50691
- const isExtendedResult = typeof promiseData === "object" && !ReactExports.isValidElement(promiseData);
50692
- const toastSettings = isExtendedResult ? promiseData : {
50693
- message: promiseData
50694
- };
50695
- this.create({
50696
- id: id2,
50697
- type: "error",
50698
- description,
50699
- ...toastSettings
50700
- });
50701
- } else if (response2 instanceof Error) {
50702
- shouldDismiss = false;
50703
- const promiseData = typeof data.error === "function" ? await data.error(response2) : data.error;
50704
- const description = typeof data.description === "function" ? await data.description(response2) : data.description;
50705
- const isExtendedResult = typeof promiseData === "object" && !ReactExports.isValidElement(promiseData);
50706
- const toastSettings = isExtendedResult ? promiseData : {
50707
- message: promiseData
50708
- };
50709
- this.create({
50710
- id: id2,
50711
- type: "error",
50712
- description,
50713
- ...toastSettings
50714
- });
50715
- } else if (data.success !== void 0) {
50716
- shouldDismiss = false;
50717
- const promiseData = typeof data.success === "function" ? await data.success(response2) : data.success;
50718
- const description = typeof data.description === "function" ? await data.description(response2) : data.description;
50719
- const isExtendedResult = typeof promiseData === "object" && !ReactExports.isValidElement(promiseData);
50720
- const toastSettings = isExtendedResult ? promiseData : {
50721
- message: promiseData
50722
- };
50723
- this.create({
50724
- id: id2,
50725
- type: "success",
50726
- description,
50727
- ...toastSettings
50728
- });
50729
- }
50730
- }).catch(async (error2) => {
50731
- result = [
50732
- "reject",
50733
- error2
50734
- ];
50735
- if (data.error !== void 0) {
50736
- shouldDismiss = false;
50737
- const promiseData = typeof data.error === "function" ? await data.error(error2) : data.error;
50738
- const description = typeof data.description === "function" ? await data.description(error2) : data.description;
50739
- const isExtendedResult = typeof promiseData === "object" && !ReactExports.isValidElement(promiseData);
50740
- const toastSettings = isExtendedResult ? promiseData : {
50741
- message: promiseData
50742
- };
50743
- this.create({
50744
- id: id2,
50745
- type: "error",
50746
- description,
50747
- ...toastSettings
50748
- });
50749
- }
50750
- }).finally(() => {
50751
- if (shouldDismiss) {
50752
- this.dismiss(id2);
50753
- id2 = void 0;
50754
- }
50755
- data.finally == null ? void 0 : data.finally.call(data);
50756
- });
50757
- const unwrap = () => new Promise((resolve2, reject) => originalPromise.then(() => result[0] === "reject" ? reject(result[1]) : resolve2(result[1])).catch(reject));
50758
- if (typeof id2 !== "string" && typeof id2 !== "number") {
50759
- return {
50760
- unwrap
50761
- };
50762
- } else {
50763
- return Object.assign(id2, {
50764
- unwrap
50765
- });
50766
- }
50767
- };
50768
- this.custom = (jsx, data) => {
50769
- const id2 = (data == null ? void 0 : data.id) || toastsCounter++;
50770
- this.create({
50771
- jsx: jsx(id2),
50772
- id: id2,
50773
- ...data
50774
- });
50775
- return id2;
50776
- };
50777
- this.getActiveToasts = () => {
50778
- return this.toasts.filter((toast2) => !this.dismissedToasts.has(toast2.id));
50779
- };
50780
- this.subscribers = [];
50781
- this.toasts = [];
50782
- this.dismissedToasts = /* @__PURE__ */ new Set();
50783
- }
50784
- }
50785
- const ToastState = new Observer();
50786
- const toastFunction = (message2, data) => {
50787
- const id2 = (data == null ? void 0 : data.id) || toastsCounter++;
50788
- ToastState.addToast({
50789
- title: message2,
50790
- ...data,
50791
- id: id2
50792
- });
50793
- return id2;
50794
- };
50795
- const isHttpResponse = (data) => {
50796
- return data && typeof data === "object" && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "number";
50797
- };
50798
- const basicToast = toastFunction;
50799
- const getHistory = () => ToastState.toasts;
50800
- const getToasts = () => ToastState.getActiveToasts();
50801
- const toast = Object.assign(basicToast, {
50802
- success: ToastState.success,
50803
- info: ToastState.info,
50804
- warning: ToastState.warning,
50805
- error: ToastState.error,
50806
- custom: ToastState.custom,
50807
- message: ToastState.message,
50808
- promise: ToastState.promise,
50809
- dismiss: ToastState.dismiss,
50810
- loading: ToastState.loading
50811
- }, {
50812
- getHistory,
50813
- getToasts
50814
- });
50815
- __insertCSS("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
50816
- function isAction(action2) {
50817
- return action2.label !== void 0;
50818
- }
50819
- const VISIBLE_TOASTS_AMOUNT = 3;
50820
- const VIEWPORT_OFFSET = "24px";
50821
- const MOBILE_VIEWPORT_OFFSET = "16px";
50822
- const TOAST_LIFETIME = 4e3;
50823
- const TOAST_WIDTH = 356;
50824
- const GAP = 14;
50825
- const SWIPE_THRESHOLD = 45;
50826
- const TIME_BEFORE_UNMOUNT = 200;
50827
- function cn$3(...classes) {
50828
- return classes.filter(Boolean).join(" ");
50829
- }
50830
- function getDefaultSwipeDirections(position2) {
50831
- const [y2, x2] = position2.split("-");
50832
- const directions = [];
50833
- if (y2) {
50834
- directions.push(y2);
50835
- }
50836
- if (x2) {
50837
- directions.push(x2);
50838
- }
50839
- return directions;
50840
- }
50841
- const Toast = (props) => {
50842
- var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8;
50843
- const { invert: ToasterInvert, toast: toast2, unstyled, interacting, setHeights, visibleToasts, heights, index: index2, toasts, expanded: expanded2, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style: style2, cancelButtonStyle, actionButtonStyle, className = "", descriptionClassName = "", duration: durationFromToaster, position: position2, gap, expandByDefault, classNames, icons, closeButtonAriaLabel = "Close toast" } = props;
50844
- const [swipeDirection, setSwipeDirection] = ReactExports.useState(null);
50845
- const [swipeOutDirection, setSwipeOutDirection] = ReactExports.useState(null);
50846
- const [mounted, setMounted] = ReactExports.useState(false);
50847
- const [removed, setRemoved] = ReactExports.useState(false);
50848
- const [swiping, setSwiping] = ReactExports.useState(false);
50849
- const [swipeOut, setSwipeOut] = ReactExports.useState(false);
50850
- const [isSwiped, setIsSwiped] = ReactExports.useState(false);
50851
- const [offsetBeforeRemove, setOffsetBeforeRemove] = ReactExports.useState(0);
50852
- const [initialHeight, setInitialHeight] = ReactExports.useState(0);
50853
- const remainingTime = ReactExports.useRef(toast2.duration || durationFromToaster || TOAST_LIFETIME);
50854
- const dragStartTime = ReactExports.useRef(null);
50855
- const toastRef = ReactExports.useRef(null);
50856
- const isFront = index2 === 0;
50857
- const isVisible = index2 + 1 <= visibleToasts;
50858
- const toastType = toast2.type;
50859
- const dismissible = toast2.dismissible !== false;
50860
- const toastClassname = toast2.className || "";
50861
- const toastDescriptionClassname = toast2.descriptionClassName || "";
50862
- const heightIndex = ReactExports.useMemo(() => heights.findIndex((height) => height.toastId === toast2.id) || 0, [
50863
- heights,
50864
- toast2.id
50865
- ]);
50866
- const closeButton = ReactExports.useMemo(() => {
50867
- var _toast_closeButton;
50868
- return (_toast_closeButton = toast2.closeButton) != null ? _toast_closeButton : closeButtonFromToaster;
50869
- }, [
50870
- toast2.closeButton,
50871
- closeButtonFromToaster
50872
- ]);
50873
- const duration2 = ReactExports.useMemo(() => toast2.duration || durationFromToaster || TOAST_LIFETIME, [
50874
- toast2.duration,
50875
- durationFromToaster
50876
- ]);
50877
- const closeTimerStartTimeRef = ReactExports.useRef(0);
50878
- const offset2 = ReactExports.useRef(0);
50879
- const lastCloseTimerStartTimeRef = ReactExports.useRef(0);
50880
- const pointerStartRef = ReactExports.useRef(null);
50881
- const [y2, x2] = position2.split("-");
50882
- const toastsHeightBefore = ReactExports.useMemo(() => {
50883
- return heights.reduce((prev, curr, reducerIndex) => {
50884
- if (reducerIndex >= heightIndex) {
50885
- return prev;
50886
- }
50887
- return prev + curr.height;
50888
- }, 0);
50889
- }, [
50890
- heights,
50891
- heightIndex
50892
- ]);
50893
- const isDocumentHidden = useIsDocumentHidden();
50894
- const invert = toast2.invert || ToasterInvert;
50895
- const disabled = toastType === "loading";
50896
- offset2.current = ReactExports.useMemo(() => heightIndex * gap + toastsHeightBefore, [
50897
- heightIndex,
50898
- toastsHeightBefore
50899
- ]);
50900
- ReactExports.useEffect(() => {
50901
- remainingTime.current = duration2;
50902
- }, [
50903
- duration2
50904
- ]);
50905
- ReactExports.useEffect(() => {
50906
- setMounted(true);
50907
- }, []);
50908
- ReactExports.useEffect(() => {
50909
- const toastNode = toastRef.current;
50910
- if (toastNode) {
50911
- const height = toastNode.getBoundingClientRect().height;
50912
- setInitialHeight(height);
50913
- setHeights((h2) => [
50914
- {
50915
- toastId: toast2.id,
50916
- height,
50917
- position: toast2.position
50918
- },
50919
- ...h2
50920
- ]);
50921
- return () => setHeights((h2) => h2.filter((height2) => height2.toastId !== toast2.id));
50922
- }
50923
- }, [
50924
- setHeights,
50925
- toast2.id
50926
- ]);
50927
- ReactExports.useLayoutEffect(() => {
50928
- if (!mounted) return;
50929
- const toastNode = toastRef.current;
50930
- const originalHeight = toastNode.style.height;
50931
- toastNode.style.height = "auto";
50932
- const newHeight = toastNode.getBoundingClientRect().height;
50933
- toastNode.style.height = originalHeight;
50934
- setInitialHeight(newHeight);
50935
- setHeights((heights2) => {
50936
- const alreadyExists = heights2.find((height) => height.toastId === toast2.id);
50937
- if (!alreadyExists) {
50938
- return [
50939
- {
50940
- toastId: toast2.id,
50941
- height: newHeight,
50942
- position: toast2.position
50943
- },
50944
- ...heights2
50945
- ];
50946
- } else {
50947
- return heights2.map((height) => height.toastId === toast2.id ? {
50948
- ...height,
50949
- height: newHeight
50950
- } : height);
50951
- }
50952
- });
50953
- }, [
50954
- mounted,
50955
- toast2.title,
50956
- toast2.description,
50957
- setHeights,
50958
- toast2.id,
50959
- toast2.jsx,
50960
- toast2.action,
50961
- toast2.cancel
50962
- ]);
50963
- const deleteToast = ReactExports.useCallback(() => {
50964
- setRemoved(true);
50965
- setOffsetBeforeRemove(offset2.current);
50966
- setHeights((h2) => h2.filter((height) => height.toastId !== toast2.id));
50967
- setTimeout(() => {
50968
- removeToast(toast2);
50969
- }, TIME_BEFORE_UNMOUNT);
50970
- }, [
50971
- toast2,
50972
- removeToast,
50973
- setHeights,
50974
- offset2
50975
- ]);
50976
- ReactExports.useEffect(() => {
50977
- if (toast2.promise && toastType === "loading" || toast2.duration === Infinity || toast2.type === "loading") return;
50978
- let timeoutId;
50979
- const pauseTimer = () => {
50980
- if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) {
50981
- const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - closeTimerStartTimeRef.current;
50982
- remainingTime.current = remainingTime.current - elapsedTime;
50983
- }
50984
- lastCloseTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
50985
- };
50986
- const startTimer = () => {
50987
- if (remainingTime.current === Infinity) return;
50988
- closeTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
50989
- timeoutId = setTimeout(() => {
50990
- toast2.onAutoClose == null ? void 0 : toast2.onAutoClose.call(toast2, toast2);
50991
- deleteToast();
50992
- }, remainingTime.current);
50993
- };
50994
- if (expanded2 || interacting || isDocumentHidden) {
50995
- pauseTimer();
50996
- } else {
50997
- startTimer();
51108
+ if (!object2.constructor) {
51109
+ return /* @__PURE__ */ ReactExports.createElement("span", null, "Object");
51110
+ }
51111
+ if (typeof object2.constructor.isBuffer === "function" && object2.constructor.isBuffer(object2)) {
51112
+ return /* @__PURE__ */ ReactExports.createElement("span", null, `Buffer[${object2.length}]`);
51113
+ }
51114
+ return /* @__PURE__ */ ReactExports.createElement("span", null, object2.constructor.name);
51115
+ case "function":
51116
+ return /* @__PURE__ */ ReactExports.createElement("span", null, /* @__PURE__ */ ReactExports.createElement("span", { style: mkStyle("objectValueFunctionPrefix") }, "ƒ "), /* @__PURE__ */ ReactExports.createElement("span", { style: mkStyle("objectValueFunctionName") }, object2.name, "()"));
51117
+ case "symbol":
51118
+ return /* @__PURE__ */ ReactExports.createElement("span", { style: mkStyle("objectValueSymbol") }, object2.toString());
51119
+ default:
51120
+ return /* @__PURE__ */ ReactExports.createElement("span", null);
51121
+ }
51122
+ };
51123
+ var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
51124
+ var propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
51125
+ function getPropertyValue(object2, propertyName) {
51126
+ const propertyDescriptor = Object.getOwnPropertyDescriptor(object2, propertyName);
51127
+ if (propertyDescriptor.get) {
51128
+ try {
51129
+ return propertyDescriptor.get();
51130
+ } catch {
51131
+ return propertyDescriptor.get;
50998
51132
  }
50999
- return () => clearTimeout(timeoutId);
51000
- }, [
51001
- expanded2,
51002
- interacting,
51003
- toast2,
51004
- toastType,
51005
- isDocumentHidden,
51006
- deleteToast
51007
- ]);
51008
- ReactExports.useEffect(() => {
51009
- if (toast2.delete) {
51010
- deleteToast();
51011
- toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
51133
+ }
51134
+ return object2[propertyName];
51135
+ }
51136
+ function intersperse(arr, sep2) {
51137
+ if (arr.length === 0) {
51138
+ return [];
51139
+ }
51140
+ return arr.slice(1).reduce((xs, x2) => xs.concat([sep2, x2]), [arr[0]]);
51141
+ }
51142
+ var ObjectPreview = ({ data }) => {
51143
+ const styles2 = useStyles("ObjectPreview");
51144
+ const object2 = data;
51145
+ if (typeof object2 !== "object" || object2 === null || object2 instanceof Date || object2 instanceof RegExp) {
51146
+ return /* @__PURE__ */ ReactExports.createElement(ObjectValue, { object: object2 });
51147
+ }
51148
+ if (Array.isArray(object2)) {
51149
+ const maxProperties = styles2.arrayMaxProperties;
51150
+ const previewArray = object2.slice(0, maxProperties).map((element2, index2) => /* @__PURE__ */ ReactExports.createElement(ObjectValue, { key: index2, object: element2 }));
51151
+ if (object2.length > maxProperties) {
51152
+ previewArray.push(/* @__PURE__ */ ReactExports.createElement("span", { key: "ellipsis" }, "…"));
51012
51153
  }
51013
- }, [
51014
- deleteToast,
51015
- toast2.delete
51016
- ]);
51017
- function getLoadingIcon() {
51018
- var _toast_classNames9;
51019
- if (icons == null ? void 0 : icons.loading) {
51020
- var _toast_classNames12;
51021
- return /* @__PURE__ */ ReactExports.createElement("div", {
51022
- className: cn$3(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames12 = toast2.classNames) == null ? void 0 : _toast_classNames12.loader, "sonner-loader"),
51023
- "data-visible": toastType === "loading"
51024
- }, icons.loading);
51154
+ const arrayLength = object2.length;
51155
+ return /* @__PURE__ */ ReactExports.createElement(ReactExports.Fragment, null, /* @__PURE__ */ ReactExports.createElement("span", { style: styles2.objectDescription }, arrayLength === 0 ? `` : `(${arrayLength}) `), /* @__PURE__ */ ReactExports.createElement("span", { style: styles2.preview }, "[", intersperse(previewArray, ", "), "]"));
51156
+ } else {
51157
+ const maxProperties = styles2.objectMaxProperties;
51158
+ const propertyNodes = [];
51159
+ for (const propertyName in object2) {
51160
+ if (hasOwnProperty$1.call(object2, propertyName)) {
51161
+ let ellipsis;
51162
+ if (propertyNodes.length === maxProperties - 1 && Object.keys(object2).length > maxProperties) {
51163
+ ellipsis = /* @__PURE__ */ ReactExports.createElement("span", { key: "ellipsis" }, "");
51164
+ }
51165
+ const propertyValue2 = getPropertyValue(object2, propertyName);
51166
+ propertyNodes.push(
51167
+ /* @__PURE__ */ ReactExports.createElement("span", { key: propertyName }, /* @__PURE__ */ ReactExports.createElement(ObjectName, { name: propertyName || `""` }), ": ", /* @__PURE__ */ ReactExports.createElement(ObjectValue, { object: propertyValue2 }), ellipsis)
51168
+ );
51169
+ if (ellipsis) break;
51170
+ }
51025
51171
  }
51026
- return /* @__PURE__ */ ReactExports.createElement(Loader, {
51027
- className: cn$3(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames9 = toast2.classNames) == null ? void 0 : _toast_classNames9.loader),
51028
- visible: toastType === "loading"
51029
- });
51172
+ const objectConstructorName = object2.constructor ? object2.constructor.name : "Object";
51173
+ return /* @__PURE__ */ ReactExports.createElement(ReactExports.Fragment, null, /* @__PURE__ */ ReactExports.createElement("span", { style: styles2.objectDescription }, objectConstructorName === "Object" ? "" : `${objectConstructorName} `), /* @__PURE__ */ ReactExports.createElement("span", { style: styles2.preview }, "{", intersperse(propertyNodes, ", "), "}"));
51030
51174
  }
51031
- const icon = toast2.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType);
51032
- var _toast_richColors, _icons_close;
51033
- return /* @__PURE__ */ ReactExports.createElement("li", {
51034
- tabIndex: 0,
51035
- ref: toastRef,
51036
- className: cn$3(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast2 == null ? void 0 : (_toast_classNames = toast2.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames.default, classNames == null ? void 0 : classNames[toastType], toast2 == null ? void 0 : (_toast_classNames1 = toast2.classNames) == null ? void 0 : _toast_classNames1[toastType]),
51037
- "data-sonner-toast": "",
51038
- "data-rich-colors": (_toast_richColors = toast2.richColors) != null ? _toast_richColors : defaultRichColors,
51039
- "data-styled": !Boolean(toast2.jsx || toast2.unstyled || unstyled),
51040
- "data-mounted": mounted,
51041
- "data-promise": Boolean(toast2.promise),
51042
- "data-swiped": isSwiped,
51043
- "data-removed": removed,
51044
- "data-visible": isVisible,
51045
- "data-y-position": y2,
51046
- "data-x-position": x2,
51047
- "data-index": index2,
51048
- "data-front": isFront,
51049
- "data-swiping": swiping,
51050
- "data-dismissible": dismissible,
51051
- "data-type": toastType,
51052
- "data-invert": invert,
51053
- "data-swipe-out": swipeOut,
51054
- "data-swipe-direction": swipeOutDirection,
51055
- "data-expanded": Boolean(expanded2 || expandByDefault && mounted),
51056
- "data-testid": toast2.testId,
51057
- style: {
51058
- "--index": index2,
51059
- "--toasts-before": index2,
51060
- "--z-index": toasts.length - index2,
51061
- "--offset": `${removed ? offsetBeforeRemove : offset2.current}px`,
51062
- "--initial-height": expandByDefault ? "auto" : `${initialHeight}px`,
51063
- ...style2,
51064
- ...toast2.style
51065
- },
51066
- onDragEnd: () => {
51067
- setSwiping(false);
51068
- setSwipeDirection(null);
51069
- pointerStartRef.current = null;
51070
- },
51071
- onPointerDown: (event) => {
51072
- if (event.button === 2) return;
51073
- if (disabled || !dismissible) return;
51074
- dragStartTime.current = /* @__PURE__ */ new Date();
51075
- setOffsetBeforeRemove(offset2.current);
51076
- event.target.setPointerCapture(event.pointerId);
51077
- if (event.target.tagName === "BUTTON") return;
51078
- setSwiping(true);
51079
- pointerStartRef.current = {
51080
- x: event.clientX,
51081
- y: event.clientY
51082
- };
51083
- },
51084
- onPointerUp: () => {
51085
- var _toastRef_current, _toastRef_current1, _dragStartTime_current;
51086
- if (swipeOut || !dismissible) return;
51087
- pointerStartRef.current = null;
51088
- const swipeAmountX = Number(((_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0);
51089
- const swipeAmountY = Number(((_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0);
51090
- const timeTaken = (/* @__PURE__ */ new Date()).getTime() - ((_dragStartTime_current = dragStartTime.current) == null ? void 0 : _dragStartTime_current.getTime());
51091
- const swipeAmount = swipeDirection === "x" ? swipeAmountX : swipeAmountY;
51092
- const velocity = Math.abs(swipeAmount) / timeTaken;
51093
- if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) {
51094
- setOffsetBeforeRemove(offset2.current);
51095
- toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
51096
- if (swipeDirection === "x") {
51097
- setSwipeOutDirection(swipeAmountX > 0 ? "right" : "left");
51175
+ };
51176
+ var ObjectRootLabel = ({ name: name2, data }) => {
51177
+ if (typeof name2 === "string") {
51178
+ return /* @__PURE__ */ ReactExports.createElement("span", null, /* @__PURE__ */ ReactExports.createElement(ObjectName, { name: name2 }), /* @__PURE__ */ ReactExports.createElement("span", null, ": "), /* @__PURE__ */ ReactExports.createElement(ObjectPreview, { data }));
51179
+ } else {
51180
+ return /* @__PURE__ */ ReactExports.createElement(ObjectPreview, { data });
51181
+ }
51182
+ };
51183
+ var ObjectLabel = ({ name: name2, data, isNonenumerable = false }) => {
51184
+ const object2 = data;
51185
+ return /* @__PURE__ */ ReactExports.createElement("span", null, typeof name2 === "string" ? /* @__PURE__ */ ReactExports.createElement(ObjectName, { name: name2, dimmed: isNonenumerable }) : /* @__PURE__ */ ReactExports.createElement(ObjectPreview, { data: name2 }), /* @__PURE__ */ ReactExports.createElement("span", null, ": "), /* @__PURE__ */ ReactExports.createElement(ObjectValue, { object: object2 }));
51186
+ };
51187
+ var createIterator = (showNonenumerable, sortObjectKeys) => {
51188
+ const objectIterator = function* (data) {
51189
+ const shouldIterate = typeof data === "object" && data !== null || typeof data === "function";
51190
+ if (!shouldIterate) return;
51191
+ const dataIsArray = Array.isArray(data);
51192
+ if (!dataIsArray && data[Symbol.iterator]) {
51193
+ let i = 0;
51194
+ for (const entry2 of data) {
51195
+ if (Array.isArray(entry2) && entry2.length === 2) {
51196
+ const [k2, v2] = entry2;
51197
+ yield {
51198
+ name: k2,
51199
+ data: v2
51200
+ };
51098
51201
  } else {
51099
- setSwipeOutDirection(swipeAmountY > 0 ? "down" : "up");
51202
+ yield {
51203
+ name: i.toString(),
51204
+ data: entry2
51205
+ };
51100
51206
  }
51101
- deleteToast();
51102
- setSwipeOut(true);
51103
- return;
51104
- } else {
51105
- var _toastRef_current2, _toastRef_current3;
51106
- (_toastRef_current2 = toastRef.current) == null ? void 0 : _toastRef_current2.style.setProperty("--swipe-amount-x", `0px`);
51107
- (_toastRef_current3 = toastRef.current) == null ? void 0 : _toastRef_current3.style.setProperty("--swipe-amount-y", `0px`);
51207
+ i++;
51108
51208
  }
51109
- setIsSwiped(false);
51110
- setSwiping(false);
51111
- setSwipeDirection(null);
51112
- },
51113
- onPointerMove: (event) => {
51114
- var _window_getSelection, _toastRef_current, _toastRef_current1;
51115
- if (!pointerStartRef.current || !dismissible) return;
51116
- const isHighlighted = ((_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString().length) > 0;
51117
- if (isHighlighted) return;
51118
- const yDelta = event.clientY - pointerStartRef.current.y;
51119
- const xDelta = event.clientX - pointerStartRef.current.x;
51120
- var _props_swipeDirections;
51121
- const swipeDirections = (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position2);
51122
- if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) {
51123
- setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? "x" : "y");
51209
+ } else {
51210
+ const keys2 = Object.getOwnPropertyNames(data);
51211
+ if (sortObjectKeys === true && !dataIsArray) {
51212
+ keys2.sort();
51213
+ } else if (typeof sortObjectKeys === "function") {
51214
+ keys2.sort(sortObjectKeys);
51124
51215
  }
51125
- let swipeAmount = {
51126
- x: 0,
51127
- y: 0
51128
- };
51129
- const getDampening = (delta) => {
51130
- const factor = Math.abs(delta) / 20;
51131
- return 1 / (1.5 + factor);
51132
- };
51133
- if (swipeDirection === "y") {
51134
- if (swipeDirections.includes("top") || swipeDirections.includes("bottom")) {
51135
- if (swipeDirections.includes("top") && yDelta < 0 || swipeDirections.includes("bottom") && yDelta > 0) {
51136
- swipeAmount.y = yDelta;
51137
- } else {
51138
- const dampenedDelta = yDelta * getDampening(yDelta);
51139
- swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta;
51216
+ for (const propertyName of keys2) {
51217
+ if (propertyIsEnumerable.call(data, propertyName)) {
51218
+ const propertyValue2 = getPropertyValue(data, propertyName);
51219
+ yield {
51220
+ name: propertyName || `""`,
51221
+ data: propertyValue2
51222
+ };
51223
+ } else if (showNonenumerable) {
51224
+ let propertyValue2;
51225
+ try {
51226
+ propertyValue2 = getPropertyValue(data, propertyName);
51227
+ } catch (e) {
51140
51228
  }
51141
- }
51142
- } else if (swipeDirection === "x") {
51143
- if (swipeDirections.includes("left") || swipeDirections.includes("right")) {
51144
- if (swipeDirections.includes("left") && xDelta < 0 || swipeDirections.includes("right") && xDelta > 0) {
51145
- swipeAmount.x = xDelta;
51146
- } else {
51147
- const dampenedDelta = xDelta * getDampening(xDelta);
51148
- swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta;
51229
+ if (propertyValue2 !== void 0) {
51230
+ yield {
51231
+ name: propertyName,
51232
+ data: propertyValue2,
51233
+ isNonenumerable: true
51234
+ };
51149
51235
  }
51150
51236
  }
51151
51237
  }
51152
- if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) {
51153
- setIsSwiped(true);
51238
+ if (showNonenumerable && data !== Object.prototype) {
51239
+ yield {
51240
+ name: "__proto__",
51241
+ data: Object.getPrototypeOf(data),
51242
+ isNonenumerable: true
51243
+ };
51154
51244
  }
51155
- (_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty("--swipe-amount-x", `${swipeAmount.x}px`);
51156
- (_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty("--swipe-amount-y", `${swipeAmount.y}px`);
51157
51245
  }
51158
- }, closeButton && !toast2.jsx && toastType !== "loading" ? /* @__PURE__ */ ReactExports.createElement("button", {
51159
- "aria-label": closeButtonAriaLabel,
51160
- "data-disabled": disabled,
51161
- "data-close-button": true,
51162
- onClick: disabled || !dismissible ? () => {
51163
- } : () => {
51164
- deleteToast();
51165
- toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
51166
- },
51167
- className: cn$3(classNames == null ? void 0 : classNames.closeButton, toast2 == null ? void 0 : (_toast_classNames2 = toast2.classNames) == null ? void 0 : _toast_classNames2.closeButton)
51168
- }, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast2.icon || toast2.promise) && toast2.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast2.icon) ? /* @__PURE__ */ ReactExports.createElement("div", {
51169
- "data-icon": "",
51170
- className: cn$3(classNames == null ? void 0 : classNames.icon, toast2 == null ? void 0 : (_toast_classNames3 = toast2.classNames) == null ? void 0 : _toast_classNames3.icon)
51171
- }, toast2.promise || toast2.type === "loading" && !toast2.icon ? toast2.icon || getLoadingIcon() : null, toast2.type !== "loading" ? icon : null) : null, /* @__PURE__ */ ReactExports.createElement("div", {
51172
- "data-content": "",
51173
- className: cn$3(classNames == null ? void 0 : classNames.content, toast2 == null ? void 0 : (_toast_classNames4 = toast2.classNames) == null ? void 0 : _toast_classNames4.content)
51174
- }, /* @__PURE__ */ ReactExports.createElement("div", {
51175
- "data-title": "",
51176
- className: cn$3(classNames == null ? void 0 : classNames.title, toast2 == null ? void 0 : (_toast_classNames5 = toast2.classNames) == null ? void 0 : _toast_classNames5.title)
51177
- }, toast2.jsx ? toast2.jsx : typeof toast2.title === "function" ? toast2.title() : toast2.title), toast2.description ? /* @__PURE__ */ ReactExports.createElement("div", {
51178
- "data-description": "",
51179
- className: cn$3(descriptionClassName, toastDescriptionClassname, classNames == null ? void 0 : classNames.description, toast2 == null ? void 0 : (_toast_classNames6 = toast2.classNames) == null ? void 0 : _toast_classNames6.description)
51180
- }, typeof toast2.description === "function" ? toast2.description() : toast2.description) : null), /* @__PURE__ */ ReactExports.isValidElement(toast2.cancel) ? toast2.cancel : toast2.cancel && isAction(toast2.cancel) ? /* @__PURE__ */ ReactExports.createElement("button", {
51181
- "data-button": true,
51182
- "data-cancel": true,
51183
- style: toast2.cancelButtonStyle || cancelButtonStyle,
51184
- onClick: (event) => {
51185
- if (!isAction(toast2.cancel)) return;
51186
- if (!dismissible) return;
51187
- toast2.cancel.onClick == null ? void 0 : toast2.cancel.onClick.call(toast2.cancel, event);
51188
- deleteToast();
51189
- },
51190
- className: cn$3(classNames == null ? void 0 : classNames.cancelButton, toast2 == null ? void 0 : (_toast_classNames7 = toast2.classNames) == null ? void 0 : _toast_classNames7.cancelButton)
51191
- }, toast2.cancel.label) : null, /* @__PURE__ */ ReactExports.isValidElement(toast2.action) ? toast2.action : toast2.action && isAction(toast2.action) ? /* @__PURE__ */ ReactExports.createElement("button", {
51192
- "data-button": true,
51193
- "data-action": true,
51194
- style: toast2.actionButtonStyle || actionButtonStyle,
51195
- onClick: (event) => {
51196
- if (!isAction(toast2.action)) return;
51197
- toast2.action.onClick == null ? void 0 : toast2.action.onClick.call(toast2.action, event);
51198
- if (event.defaultPrevented) return;
51199
- deleteToast();
51200
- },
51201
- className: cn$3(classNames == null ? void 0 : classNames.actionButton, toast2 == null ? void 0 : (_toast_classNames8 = toast2.classNames) == null ? void 0 : _toast_classNames8.actionButton)
51202
- }, toast2.action.label) : null);
51246
+ };
51247
+ return objectIterator;
51203
51248
  };
51204
- function getDocumentDirection() {
51205
- if (typeof window === "undefined") return "ltr";
51206
- if (typeof document === "undefined") return "ltr";
51207
- const dirAttribute = document.documentElement.getAttribute("dir");
51208
- if (dirAttribute === "auto" || !dirAttribute) {
51209
- return window.getComputedStyle(document.documentElement).direction;
51249
+ var defaultNodeRenderer = ({ depth, name: name2, data, isNonenumerable }) => depth === 0 ? /* @__PURE__ */ ReactExports.createElement(ObjectRootLabel, { name: name2, data }) : /* @__PURE__ */ ReactExports.createElement(ObjectLabel, { name: name2, data, isNonenumerable });
51250
+ var ObjectInspector = ({ showNonenumerable = false, sortObjectKeys, nodeRenderer, ...treeViewProps }) => {
51251
+ const dataIterator = createIterator(showNonenumerable, sortObjectKeys);
51252
+ const renderer = nodeRenderer ? nodeRenderer : defaultNodeRenderer;
51253
+ return /* @__PURE__ */ ReactExports.createElement(TreeView, { nodeRenderer: renderer, dataIterator, ...treeViewProps });
51254
+ };
51255
+ var themedObjectInspector = themeAcceptor(ObjectInspector);
51256
+ __toESM(require_is_dom());
51257
+ const useDarkMode = () => {
51258
+ const [isDark, setIsDark] = reactExports.useState(() => {
51259
+ if (typeof document === "undefined")
51260
+ return false;
51261
+ return document.documentElement.classList.contains("dark");
51262
+ });
51263
+ reactExports.useEffect(() => {
51264
+ if (typeof document === "undefined")
51265
+ return;
51266
+ const observer = new MutationObserver(() => {
51267
+ setIsDark(document.documentElement.classList.contains("dark"));
51268
+ });
51269
+ observer.observe(document.documentElement, {
51270
+ attributes: true,
51271
+ attributeFilter: ["class"]
51272
+ });
51273
+ return () => observer.disconnect();
51274
+ }, []);
51275
+ return isDark;
51276
+ };
51277
+ const inspectorThemeExtendedLight = {
51278
+ OBJECT_VALUE_DATE_COLOR: "#a21caf"
51279
+ // fuchsia-700
51280
+ };
51281
+ const inspectorThemeExtendedDark = {
51282
+ OBJECT_VALUE_DATE_COLOR: "#e879f9"
51283
+ // fuchsia-400
51284
+ };
51285
+ const shared = {
51286
+ BASE_FONT_SIZE: "11px",
51287
+ BASE_LINE_HEIGHT: 1.4,
51288
+ BASE_BACKGROUND_COLOR: "transparent",
51289
+ OBJECT_PREVIEW_ARRAY_MAX_PROPERTIES: 10,
51290
+ OBJECT_PREVIEW_OBJECT_MAX_PROPERTIES: 5,
51291
+ HTML_TAGNAME_TEXT_TRANSFORM: "lowercase",
51292
+ ARROW_MARGIN_RIGHT: 3,
51293
+ ARROW_FONT_SIZE: 12,
51294
+ TREENODE_FONT_FAMILY: "var(--font-mono)",
51295
+ TREENODE_FONT_SIZE: "11px",
51296
+ TREENODE_LINE_HEIGHT: 1.4,
51297
+ TREENODE_PADDING_LEFT: 12,
51298
+ TABLE_DATA_BACKGROUND_IMAGE: "none",
51299
+ TABLE_DATA_BACKGROUND_SIZE: "0"
51300
+ };
51301
+ const inspectorThemeLight = {
51302
+ ...shared,
51303
+ // Base text
51304
+ BASE_COLOR: "var(--ds-gray-1000)",
51305
+ // Property names — unstyled, same as base foreground (Node: no style)
51306
+ OBJECT_NAME_COLOR: "var(--ds-gray-900)",
51307
+ // Strings & symbols — green (Node: 'green')
51308
+ OBJECT_VALUE_STRING_COLOR: "#16a34a",
51309
+ // green-600
51310
+ OBJECT_VALUE_SYMBOL_COLOR: "#16a34a",
51311
+ // Numbers & booleans — yellow/amber (Node: 'yellow')
51312
+ OBJECT_VALUE_NUMBER_COLOR: "#b45309",
51313
+ // amber-700 (readable on white)
51314
+ OBJECT_VALUE_BOOLEAN_COLOR: "#b45309",
51315
+ // null — bold foreground (Node: 'bold')
51316
+ OBJECT_VALUE_NULL_COLOR: "var(--ds-gray-900)",
51317
+ // undefined — grey (Node: 'grey')
51318
+ OBJECT_VALUE_UNDEFINED_COLOR: "var(--ds-gray-500)",
51319
+ // RegExp — red (Node regexp base uses green/red/yellow palette)
51320
+ OBJECT_VALUE_REGEXP_COLOR: "#dc2626",
51321
+ // red-600
51322
+ // Functions — cyan (Node: 'special' → 'cyan')
51323
+ OBJECT_VALUE_FUNCTION_PREFIX_COLOR: "#0891b2",
51324
+ // cyan-600
51325
+ // HTML (less relevant for data inspection, but reasonable defaults)
51326
+ HTML_TAG_COLOR: "var(--ds-gray-500)",
51327
+ HTML_TAGNAME_COLOR: "#0891b2",
51328
+ HTML_ATTRIBUTE_NAME_COLOR: "#b45309",
51329
+ HTML_ATTRIBUTE_VALUE_COLOR: "#16a34a",
51330
+ HTML_COMMENT_COLOR: "var(--ds-gray-400)",
51331
+ HTML_DOCTYPE_COLOR: "var(--ds-gray-400)",
51332
+ // Structural
51333
+ ARROW_COLOR: "var(--ds-gray-500)",
51334
+ TABLE_BORDER_COLOR: "var(--ds-gray-300)",
51335
+ TABLE_TH_BACKGROUND_COLOR: "var(--ds-gray-100)",
51336
+ TABLE_TH_HOVER_COLOR: "var(--ds-gray-200)",
51337
+ TABLE_SORT_ICON_COLOR: "var(--ds-gray-500)"
51338
+ };
51339
+ const inspectorThemeDark = {
51340
+ ...shared,
51341
+ // Base text
51342
+ BASE_COLOR: "var(--ds-gray-1000)",
51343
+ // Property names — white/light foreground (Node: unstyled = white in dark terminal)
51344
+ OBJECT_NAME_COLOR: "var(--ds-gray-900)",
51345
+ // Strings & symbols — green (Node: 'green')
51346
+ OBJECT_VALUE_STRING_COLOR: "#4ade80",
51347
+ // green-400
51348
+ OBJECT_VALUE_SYMBOL_COLOR: "#4ade80",
51349
+ // Numbers & booleans — yellow (Node: 'yellow')
51350
+ OBJECT_VALUE_NUMBER_COLOR: "#facc15",
51351
+ // yellow-400
51352
+ OBJECT_VALUE_BOOLEAN_COLOR: "#facc15",
51353
+ // null — bold foreground / white (Node: 'bold')
51354
+ OBJECT_VALUE_NULL_COLOR: "var(--ds-gray-1000)",
51355
+ // undefined — grey (Node: 'grey')
51356
+ OBJECT_VALUE_UNDEFINED_COLOR: "var(--ds-gray-500)",
51357
+ // RegExp — red (Node regexp palette)
51358
+ OBJECT_VALUE_REGEXP_COLOR: "#f87171",
51359
+ // red-400
51360
+ // Functions — cyan (Node: 'special' → 'cyan')
51361
+ OBJECT_VALUE_FUNCTION_PREFIX_COLOR: "#22d3ee",
51362
+ // cyan-400
51363
+ // HTML
51364
+ HTML_TAG_COLOR: "var(--ds-gray-500)",
51365
+ HTML_TAGNAME_COLOR: "#22d3ee",
51366
+ HTML_ATTRIBUTE_NAME_COLOR: "#facc15",
51367
+ HTML_ATTRIBUTE_VALUE_COLOR: "#4ade80",
51368
+ HTML_COMMENT_COLOR: "var(--ds-gray-500)",
51369
+ HTML_DOCTYPE_COLOR: "var(--ds-gray-500)",
51370
+ // Structural
51371
+ ARROW_COLOR: "var(--ds-gray-500)",
51372
+ TABLE_BORDER_COLOR: "var(--ds-gray-300)",
51373
+ TABLE_TH_BACKGROUND_COLOR: "var(--ds-gray-100)",
51374
+ TABLE_TH_HOVER_COLOR: "var(--ds-gray-200)",
51375
+ TABLE_SORT_ICON_COLOR: "var(--ds-gray-500)"
51376
+ };
51377
+ const STREAM_REF_TYPE = "__workflow_stream_ref__";
51378
+ const CLASS_INSTANCE_REF_TYPE = "__workflow_class_instance_ref__";
51379
+ function isStreamRef(value) {
51380
+ return value !== null && typeof value === "object" && "__type" in value && value.__type === STREAM_REF_TYPE;
51381
+ }
51382
+ function isClassInstanceRef(value) {
51383
+ return value !== null && typeof value === "object" && "__type" in value && value.__type === CLASS_INSTANCE_REF_TYPE;
51384
+ }
51385
+ const StreamClickContext = reactExports.createContext(void 0);
51386
+ const DecryptClickContext = reactExports.createContext(void 0);
51387
+ function EncryptedInlineLabel() {
51388
+ const ctx = reactExports.useContext(DecryptClickContext);
51389
+ if (ctx) {
51390
+ return jsxRuntimeExports.jsxs("button", { type: "button", className: "inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] cursor-pointer", style: {
51391
+ backgroundColor: "var(--ds-gray-100)",
51392
+ color: "var(--ds-gray-700)",
51393
+ border: "1px solid var(--ds-gray-400)",
51394
+ fontStyle: "italic",
51395
+ opacity: ctx.isDecrypting ? 0.6 : 1
51396
+ }, disabled: ctx.isDecrypting, onClick: (e) => {
51397
+ e.stopPropagation();
51398
+ ctx.onDecrypt();
51399
+ }, title: "Click to decrypt", children: [ctx.isDecrypting ? jsxRuntimeExports.jsx(Spinner, { size: 12 }) : jsxRuntimeExports.jsx(Lock, { className: "h-3 w-3", style: { display: "inline", flexShrink: 0 } }), jsxRuntimeExports.jsx("span", { children: ctx.isDecrypting ? "Decrypting…" : "Decrypt" })] });
51210
51400
  }
51211
- return dirAttribute;
51401
+ return jsxRuntimeExports.jsxs("span", { style: { color: "var(--ds-gray-600)", fontStyle: "italic" }, children: [jsxRuntimeExports.jsx(Lock, { className: "h-3 w-3", style: {
51402
+ display: "inline",
51403
+ verticalAlign: "middle",
51404
+ marginRight: "3px",
51405
+ marginTop: "-1px"
51406
+ } }), "Encrypted"] });
51212
51407
  }
51213
- function assignOffset(defaultOffset, mobileOffset) {
51214
- const styles2 = {};
51215
- [
51216
- defaultOffset,
51217
- mobileOffset
51218
- ].forEach((offset2, index2) => {
51219
- const isMobile = index2 === 1;
51220
- const prefix = isMobile ? "--mobile-offset" : "--offset";
51221
- const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET;
51222
- function assignAll(offset3) {
51223
- [
51224
- "top",
51225
- "right",
51226
- "bottom",
51227
- "left"
51228
- ].forEach((key) => {
51229
- styles2[`${prefix}-${key}`] = typeof offset3 === "number" ? `${offset3}px` : offset3;
51230
- });
51231
- }
51232
- if (typeof offset2 === "number" || typeof offset2 === "string") {
51233
- assignAll(offset2);
51234
- } else if (typeof offset2 === "object") {
51235
- [
51236
- "top",
51237
- "right",
51238
- "bottom",
51239
- "left"
51240
- ].forEach((key) => {
51241
- if (offset2[key] === void 0) {
51242
- styles2[`${prefix}-${key}`] = defaultValue;
51243
- } else {
51244
- styles2[`${prefix}-${key}`] = typeof offset2[key] === "number" ? `${offset2[key]}px` : offset2[key];
51245
- }
51246
- });
51247
- } else {
51248
- assignAll(defaultValue);
51249
- }
51250
- });
51251
- return styles2;
51408
+ function StreamRefInline({ streamRef }) {
51409
+ const onStreamClick = reactExports.useContext(StreamClickContext);
51410
+ return jsxRuntimeExports.jsxs("button", { type: "button", className: "inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-mono cursor-pointer", style: {
51411
+ backgroundColor: "var(--ds-blue-100)",
51412
+ color: "var(--ds-blue-800)",
51413
+ border: "1px solid var(--ds-blue-300)"
51414
+ }, onClick: () => onStreamClick == null ? void 0 : onStreamClick(streamRef.streamId), title: `View stream: ${streamRef.streamId}`, children: [jsxRuntimeExports.jsx("span", { children: "📡" }), jsxRuntimeExports.jsx("span", { children: streamRef.streamId })] });
51252
51415
  }
51253
- const Toaster$1 = /* @__PURE__ */ ReactExports.forwardRef(function Toaster(props, ref) {
51254
- const { id: id2, invert, position: position2 = "bottom-right", hotkey = [
51255
- "altKey",
51256
- "KeyT"
51257
- ], expand: expand2, closeButton, className, offset: offset2, mobileOffset, theme: theme3 = "light", richColors, duration: duration2, style: style2, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = "Notifications" } = props;
51258
- const [toasts, setToasts] = ReactExports.useState([]);
51259
- const filteredToasts = ReactExports.useMemo(() => {
51260
- if (id2) {
51261
- return toasts.filter((toast2) => toast2.toasterId === id2);
51416
+ const ExtendedThemeContext = reactExports.createContext(inspectorThemeExtendedLight);
51417
+ function NodeRenderer$1({ depth, name: name2, data, isNonenumerable }) {
51418
+ var _a3;
51419
+ const extendedTheme = reactExports.useContext(ExtendedThemeContext);
51420
+ if (data !== null && typeof data === "object" && ((_a3 = data.constructor) == null ? void 0 : _a3.name) === ENCRYPTED_DISPLAY_NAME) {
51421
+ const label = jsxRuntimeExports.jsx(EncryptedInlineLabel, {});
51422
+ if (depth === 0) {
51423
+ return label;
51262
51424
  }
51263
- return toasts.filter((toast2) => !toast2.toasterId);
51264
- }, [
51265
- toasts,
51266
- id2
51267
- ]);
51268
- const possiblePositions = ReactExports.useMemo(() => {
51269
- return Array.from(new Set([
51270
- position2
51271
- ].concat(filteredToasts.filter((toast2) => toast2.position).map((toast2) => toast2.position))));
51272
- }, [
51273
- filteredToasts,
51274
- position2
51275
- ]);
51276
- const [heights, setHeights] = ReactExports.useState([]);
51277
- const [expanded2, setExpanded] = ReactExports.useState(false);
51278
- const [interacting, setInteracting] = ReactExports.useState(false);
51279
- const [actualTheme, setActualTheme] = ReactExports.useState(theme3 !== "system" ? theme3 : typeof window !== "undefined" ? window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : "light");
51280
- const listRef = ReactExports.useRef(null);
51281
- const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
51282
- const lastFocusedElementRef = ReactExports.useRef(null);
51283
- const isFocusWithinRef = ReactExports.useRef(false);
51284
- const removeToast = ReactExports.useCallback((toastToRemove) => {
51285
- setToasts((toasts2) => {
51286
- var _toasts_find;
51287
- if (!((_toasts_find = toasts2.find((toast2) => toast2.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) {
51288
- ToastState.dismiss(toastToRemove.id);
51289
- }
51290
- return toasts2.filter(({ id: id3 }) => id3 !== toastToRemove.id);
51291
- });
51292
- }, []);
51293
- ReactExports.useEffect(() => {
51294
- return ToastState.subscribe((toast2) => {
51295
- if (toast2.dismiss) {
51296
- requestAnimationFrame(() => {
51297
- setToasts((toasts2) => toasts2.map((t) => t.id === toast2.id ? {
51298
- ...t,
51299
- delete: true
51300
- } : t));
51301
- });
51302
- return;
51303
- }
51304
- setTimeout(() => {
51305
- ReactDOM.flushSync(() => {
51306
- setToasts((toasts2) => {
51307
- const indexOfExistingToast = toasts2.findIndex((t) => t.id === toast2.id);
51308
- if (indexOfExistingToast !== -1) {
51309
- return [
51310
- ...toasts2.slice(0, indexOfExistingToast),
51311
- {
51312
- ...toasts2[indexOfExistingToast],
51313
- ...toast2
51314
- },
51315
- ...toasts2.slice(indexOfExistingToast + 1)
51316
- ];
51317
- }
51318
- return [
51319
- toast2,
51320
- ...toasts2
51321
- ];
51322
- });
51323
- });
51324
- });
51325
- });
51326
- }, [
51327
- toasts
51328
- ]);
51329
- ReactExports.useEffect(() => {
51330
- if (theme3 !== "system") {
51331
- setActualTheme(theme3);
51332
- return;
51425
+ return jsxRuntimeExports.jsxs("span", { children: [name2 != null && jsxRuntimeExports.jsx(ObjectName, { name: name2 }), name2 != null && jsxRuntimeExports.jsx("span", { children: ": " }), label] });
51426
+ }
51427
+ if (isStreamRef(data)) {
51428
+ return jsxRuntimeExports.jsxs("span", { children: [name2 != null && jsxRuntimeExports.jsx(ObjectName, { name: name2 }), name2 != null && jsxRuntimeExports.jsx("span", { children: ": " }), jsxRuntimeExports.jsx(StreamRefInline, { streamRef: data })] });
51429
+ }
51430
+ if (isClassInstanceRef(data)) {
51431
+ if (depth === 0) {
51432
+ return jsxRuntimeExports.jsx(ObjectRootLabel, { name: data.className, data: data.data });
51333
51433
  }
51334
- if (theme3 === "system") {
51335
- if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
51336
- setActualTheme("dark");
51337
- } else {
51338
- setActualTheme("light");
51339
- }
51434
+ return jsxRuntimeExports.jsxs("span", { children: [name2 != null && jsxRuntimeExports.jsx(ObjectName, { name: name2 }), name2 != null && jsxRuntimeExports.jsx("span", { children: ": " }), jsxRuntimeExports.jsxs("span", { style: { fontStyle: "italic" }, children: [data.className, " "] }), jsxRuntimeExports.jsx(ObjectValue, { object: data.data })] });
51435
+ }
51436
+ if (data instanceof Date) {
51437
+ const dateStr = data.toISOString();
51438
+ if (depth === 0) {
51439
+ return jsxRuntimeExports.jsx("span", { style: { color: extendedTheme.OBJECT_VALUE_DATE_COLOR }, children: dateStr });
51340
51440
  }
51341
- if (typeof window === "undefined") return;
51342
- const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
51343
- try {
51344
- darkMediaQuery.addEventListener("change", ({ matches }) => {
51345
- if (matches) {
51346
- setActualTheme("dark");
51347
- } else {
51348
- setActualTheme("light");
51349
- }
51350
- });
51351
- } catch (error2) {
51352
- darkMediaQuery.addListener(({ matches }) => {
51353
- try {
51354
- if (matches) {
51355
- setActualTheme("dark");
51356
- } else {
51357
- setActualTheme("light");
51358
- }
51359
- } catch (e) {
51360
- console.error(e);
51361
- }
51362
- });
51441
+ return jsxRuntimeExports.jsxs("span", { children: [name2 != null && jsxRuntimeExports.jsx(ObjectName, { name: name2 }), name2 != null && jsxRuntimeExports.jsx("span", { children: ": " }), jsxRuntimeExports.jsx("span", { style: { color: extendedTheme.OBJECT_VALUE_DATE_COLOR }, children: dateStr })] });
51442
+ }
51443
+ if (depth === 0) {
51444
+ return jsxRuntimeExports.jsx(ObjectRootLabel, { name: name2, data });
51445
+ }
51446
+ return jsxRuntimeExports.jsx(ObjectLabel, { name: name2, data, isNonenumerable });
51447
+ }
51448
+ function DataInspector({ data, expandLevel = 2, name: name2, onStreamClick, onDecrypt, isDecrypting = false }) {
51449
+ const stableData = useStableInspectorData(data);
51450
+ const [initialExpandLevel, setInitialExpandLevel] = reactExports.useState(expandLevel);
51451
+ const isDark = useDarkMode();
51452
+ const extendedTheme = isDark ? inspectorThemeExtendedDark : inspectorThemeExtendedLight;
51453
+ reactExports.useEffect(() => {
51454
+ setInitialExpandLevel(0);
51455
+ }, []);
51456
+ const content2 = jsxRuntimeExports.jsx(ExtendedThemeContext.Provider, { value: extendedTheme, children: jsxRuntimeExports.jsx(themedObjectInspector, {
51457
+ data: stableData,
51458
+ name: name2,
51459
+ // @ts-expect-error react-inspector accepts theme objects at runtime despite
51460
+ // types declaring string only — see https://github.com/storybookjs/react-inspector/blob/main/README.md#theme
51461
+ theme: isDark ? inspectorThemeDark : inspectorThemeLight,
51462
+ expandLevel: initialExpandLevel,
51463
+ nodeRenderer: NodeRenderer$1
51464
+ }) });
51465
+ let wrapped = content2;
51466
+ if (onStreamClick) {
51467
+ wrapped = jsxRuntimeExports.jsx(StreamClickContext.Provider, { value: onStreamClick, children: wrapped });
51468
+ }
51469
+ if (onDecrypt) {
51470
+ wrapped = jsxRuntimeExports.jsx(DecryptClickContext.Provider, { value: { onDecrypt, isDecrypting }, children: wrapped });
51471
+ }
51472
+ return wrapped;
51473
+ }
51474
+ function useStableInspectorData(next2) {
51475
+ const previousRef = reactExports.useRef(next2);
51476
+ if (!isDeepEqual(previousRef.current, next2)) {
51477
+ previousRef.current = next2;
51478
+ }
51479
+ return previousRef.current;
51480
+ }
51481
+ function isObjectLike(value) {
51482
+ return typeof value === "object" && value !== null;
51483
+ }
51484
+ function isDeepEqual(a2, b2, seen = /* @__PURE__ */ new WeakMap()) {
51485
+ if (Object.is(a2, b2))
51486
+ return true;
51487
+ if (a2 instanceof Date && b2 instanceof Date) {
51488
+ return a2.getTime() === b2.getTime();
51489
+ }
51490
+ if (a2 instanceof RegExp && b2 instanceof RegExp) {
51491
+ return a2.source === b2.source && a2.flags === b2.flags;
51492
+ }
51493
+ if (a2 instanceof Map && b2 instanceof Map) {
51494
+ if (a2.size !== b2.size)
51495
+ return false;
51496
+ for (const [key, value] of a2.entries()) {
51497
+ if (!b2.has(key) || !isDeepEqual(value, b2.get(key), seen))
51498
+ return false;
51363
51499
  }
51364
- }, [
51365
- theme3
51366
- ]);
51367
- ReactExports.useEffect(() => {
51368
- if (toasts.length <= 1) {
51369
- setExpanded(false);
51500
+ return true;
51501
+ }
51502
+ if (a2 instanceof Set && b2 instanceof Set) {
51503
+ if (a2.size !== b2.size)
51504
+ return false;
51505
+ for (const value of a2.values()) {
51506
+ if (!b2.has(value))
51507
+ return false;
51370
51508
  }
51371
- }, [
51372
- toasts
51373
- ]);
51374
- ReactExports.useEffect(() => {
51375
- const handleKeyDown = (event) => {
51376
- var _listRef_current;
51377
- const isHotkeyPressed = hotkey.every((key) => event[key] || event.code === key);
51378
- if (isHotkeyPressed) {
51379
- var _listRef_current1;
51380
- setExpanded(true);
51381
- (_listRef_current1 = listRef.current) == null ? void 0 : _listRef_current1.focus();
51382
- }
51383
- if (event.code === "Escape" && (document.activeElement === listRef.current || ((_listRef_current = listRef.current) == null ? void 0 : _listRef_current.contains(document.activeElement)))) {
51384
- setExpanded(false);
51385
- }
51386
- };
51387
- document.addEventListener("keydown", handleKeyDown);
51388
- return () => document.removeEventListener("keydown", handleKeyDown);
51389
- }, [
51390
- hotkey
51391
- ]);
51392
- ReactExports.useEffect(() => {
51393
- if (listRef.current) {
51394
- return () => {
51395
- if (lastFocusedElementRef.current) {
51396
- lastFocusedElementRef.current.focus({
51397
- preventScroll: true
51398
- });
51399
- lastFocusedElementRef.current = null;
51400
- isFocusWithinRef.current = false;
51401
- }
51402
- };
51509
+ return true;
51510
+ }
51511
+ if (!isObjectLike(a2) || !isObjectLike(b2)) {
51512
+ return false;
51513
+ }
51514
+ if (seen.get(a2) === b2)
51515
+ return true;
51516
+ seen.set(a2, b2);
51517
+ const aIsArray = Array.isArray(a2);
51518
+ const bIsArray = Array.isArray(b2);
51519
+ if (aIsArray !== bIsArray)
51520
+ return false;
51521
+ if (aIsArray && bIsArray) {
51522
+ if (a2.length !== b2.length)
51523
+ return false;
51524
+ for (let i = 0; i < a2.length; i += 1) {
51525
+ if (!isDeepEqual(a2[i], b2[i], seen))
51526
+ return false;
51403
51527
  }
51404
- }, [
51405
- listRef.current
51406
- ]);
51407
- return (
51408
- // Remove item from normal navigation flow, only available via hotkey
51409
- /* @__PURE__ */ ReactExports.createElement("section", {
51410
- ref,
51411
- "aria-label": `${containerAriaLabel} ${hotkeyLabel}`,
51412
- tabIndex: -1,
51413
- "aria-live": "polite",
51414
- "aria-relevant": "additions text",
51415
- "aria-atomic": "false",
51416
- suppressHydrationWarning: true
51417
- }, possiblePositions.map((position3, index2) => {
51418
- var _heights_;
51419
- const [y2, x2] = position3.split("-");
51420
- if (!filteredToasts.length) return null;
51421
- return /* @__PURE__ */ ReactExports.createElement("ol", {
51422
- key: position3,
51423
- dir: dir === "auto" ? getDocumentDirection() : dir,
51424
- tabIndex: -1,
51425
- ref: listRef,
51426
- className,
51427
- "data-sonner-toaster": true,
51428
- "data-sonner-theme": actualTheme,
51429
- "data-y-position": y2,
51430
- "data-x-position": x2,
51431
- style: {
51432
- "--front-toast-height": `${((_heights_ = heights[0]) == null ? void 0 : _heights_.height) || 0}px`,
51433
- "--width": `${TOAST_WIDTH}px`,
51434
- "--gap": `${gap}px`,
51435
- ...style2,
51436
- ...assignOffset(offset2, mobileOffset)
51437
- },
51438
- onBlur: (event) => {
51439
- if (isFocusWithinRef.current && !event.currentTarget.contains(event.relatedTarget)) {
51440
- isFocusWithinRef.current = false;
51441
- if (lastFocusedElementRef.current) {
51442
- lastFocusedElementRef.current.focus({
51443
- preventScroll: true
51444
- });
51445
- lastFocusedElementRef.current = null;
51446
- }
51447
- }
51448
- },
51449
- onFocus: (event) => {
51450
- const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false";
51451
- if (isNotDismissible) return;
51452
- if (!isFocusWithinRef.current) {
51453
- isFocusWithinRef.current = true;
51454
- lastFocusedElementRef.current = event.relatedTarget;
51455
- }
51456
- },
51457
- onMouseEnter: () => setExpanded(true),
51458
- onMouseMove: () => setExpanded(true),
51459
- onMouseLeave: () => {
51460
- if (!interacting) {
51461
- setExpanded(false);
51462
- }
51463
- },
51464
- onDragEnd: () => setExpanded(false),
51465
- onPointerDown: (event) => {
51466
- const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false";
51467
- if (isNotDismissible) return;
51468
- setInteracting(true);
51469
- },
51470
- onPointerUp: () => setInteracting(false)
51471
- }, filteredToasts.filter((toast2) => !toast2.position && index2 === 0 || toast2.position === position3).map((toast2, index3) => {
51472
- var _toastOptions_duration, _toastOptions_closeButton;
51473
- return /* @__PURE__ */ ReactExports.createElement(Toast, {
51474
- key: toast2.id,
51475
- icons,
51476
- index: index3,
51477
- toast: toast2,
51478
- defaultRichColors: richColors,
51479
- duration: (_toastOptions_duration = toastOptions == null ? void 0 : toastOptions.duration) != null ? _toastOptions_duration : duration2,
51480
- className: toastOptions == null ? void 0 : toastOptions.className,
51481
- descriptionClassName: toastOptions == null ? void 0 : toastOptions.descriptionClassName,
51482
- invert,
51483
- visibleToasts,
51484
- closeButton: (_toastOptions_closeButton = toastOptions == null ? void 0 : toastOptions.closeButton) != null ? _toastOptions_closeButton : closeButton,
51485
- interacting,
51486
- position: position3,
51487
- style: toastOptions == null ? void 0 : toastOptions.style,
51488
- unstyled: toastOptions == null ? void 0 : toastOptions.unstyled,
51489
- classNames: toastOptions == null ? void 0 : toastOptions.classNames,
51490
- cancelButtonStyle: toastOptions == null ? void 0 : toastOptions.cancelButtonStyle,
51491
- actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,
51492
- closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,
51493
- removeToast,
51494
- toasts: filteredToasts.filter((t) => t.position == toast2.position),
51495
- heights: heights.filter((h2) => h2.position == toast2.position),
51496
- setHeights,
51497
- expandByDefault: expand2,
51498
- gap,
51499
- expanded: expanded2,
51500
- swipeDirections: props.swipeDirections
51501
- });
51502
- }));
51503
- }))
51504
- );
51505
- });
51506
- const defaultAdapter = {
51507
- success: (msg, opts) => toast.success(msg, opts),
51508
- error: (msg, opts) => toast.error(msg, opts),
51509
- info: (msg, opts) => toast.info(msg, opts)
51510
- };
51511
- const ToastContext = reactExports.createContext(defaultAdapter);
51512
- function useToast() {
51513
- return reactExports.useContext(ToastContext);
51528
+ return true;
51529
+ }
51530
+ const aKeys = Object.keys(a2);
51531
+ const bKeys = Object.keys(b2);
51532
+ if (aKeys.length !== bKeys.length)
51533
+ return false;
51534
+ for (const key of aKeys) {
51535
+ if (!Object.hasOwn(b2, key))
51536
+ return false;
51537
+ if (!isDeepEqual(a2[key], b2[key], seen))
51538
+ return false;
51539
+ }
51540
+ return true;
51514
51541
  }
51515
51542
  function isStructuredErrorWithStack(value) {
51516
51543
  return value != null && typeof value === "object" && "stack" in value && typeof value.stack === "string";
@@ -52068,7 +52095,7 @@ function RowsSkeleton() {
52068
52095
  marginLeft: i % 4 === 0 ? 5 : 6
52069
52096
  } })] }), jsxRuntimeExports.jsx("div", { className: "w-5 flex-shrink-0 flex items-center justify-center", children: jsxRuntimeExports.jsx(Skeleton$2, { className: "w-5 h-5", style: { borderRadius: 4 } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: "70%" } }) }), jsxRuntimeExports.jsxs("div", { className: "min-w-0 px-4 flex items-center gap-1.5", style: { flex: "2 1 0%" }, children: [jsxRuntimeExports.jsx(Skeleton$2, { className: "flex-shrink-0", style: { width: 6, height: 6, borderRadius: "50%" } }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: "60%" } })] }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: "50%" } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: "75%" } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: "75%" } }) })] }, i)) });
52070
52097
  }
52071
- function EventRow({ event, index: index2, isFirst, isLast, isExpanded, onToggleExpand, activeGroupKey, selectedGroupKey, selectedGroupRange, correlationNameMap, workflowName, durationMap, onSelectGroup, onHoverGroup, onLoadEventData, cachedEventData, onCacheEventData, encryptionKey, onEncryptedDataDetected }) {
52098
+ function EventRow({ event, index: index2, isFirst, isLast, isExpanded, onToggleExpand, activeGroupKey, selectedGroupKey, selectedGroupRange, correlationNameMap, workflowName, durationMap, onSelectGroup, onHoverGroup, onLoadEventData, cachedEventData, onCacheEventData, encryptionKey, onEncryptedDataDetected, suppressGroupDimming = false }) {
52072
52099
  const [isLoading, setIsLoading] = reactExports.useState(false);
52073
52100
  const [loadedEventData, setLoadedEventData] = reactExports.useState(cachedEventData);
52074
52101
  const [loadError, setLoadError] = reactExports.useState(null);
@@ -52088,7 +52115,7 @@ function EventRow({ event, index: index2, isFirst, isLast, isExpanded, onToggleE
52088
52115
  const durationInfo = durationKey ? durationMap.get(durationKey) : void 0;
52089
52116
  const hasActive = activeGroupKey !== void 0;
52090
52117
  const isRelated = rowGroupKey !== void 0 && rowGroupKey === activeGroupKey;
52091
- const isDimmed = hasActive && !isRelated;
52118
+ const isDimmed = hasActive && !isRelated && !suppressGroupDimming;
52092
52119
  const isPulsing = hasActive && isRelated;
52093
52120
  const showBranch = hasActive && isRelated && !isRun;
52094
52121
  const showLaneLine = selectedGroupRange !== null && index2 >= selectedGroupRange.first && index2 <= selectedGroupRange.last;
@@ -52213,7 +52240,8 @@ function EventRow({ event, index: index2, isFirst, isLast, isExpanded, onToggleE
52213
52240
  color: "var(--ds-red-900)"
52214
52241
  }, children: loadError }) : isLoading || loadedEventData === null && !hasAttemptedLoad && event.correlationId ? jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 p-3", children: [jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: "75%" } }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: "50%" } }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: "60%" } })] }) : jsxRuntimeExports.jsx("div", { className: "p-2 text-xs", style: { color: "var(--ds-gray-900)" }, children: "No data" })] })] })] });
52215
52242
  }
52216
- function EventListView({ events: events2, run, onLoadEventData, hasMoreEvents = false, isLoadingMoreEvents = false, onLoadMoreEvents, encryptionKey, isLoading = false, sortOrder: sortOrderProp, onSortOrderChange, onDecrypt, isDecrypting = false, hasEncryptedData: hasEncryptedDataProp = false }) {
52243
+ function EventListView({ events: events2, run, onLoadEventData, hasMoreEvents = false, isLoadingMoreEvents = false, onLoadMoreEvents, encryptionKey, isLoading = false, sortOrder: sortOrderProp, onSortOrderChange, onDecrypt, isDecrypting = false, hasEncryptedData: hasEncryptedDataProp = false, onExactIdSearch }) {
52244
+ const toast2 = useToast();
52217
52245
  const [internalSortOrder, setInternalSortOrder] = reactExports.useState("asc");
52218
52246
  const effectiveSortOrder = sortOrderProp ?? internalSortOrder;
52219
52247
  const handleSortOrderChange = reactExports.useCallback((order2) => {
@@ -52223,28 +52251,40 @@ function EventListView({ events: events2, run, onLoadEventData, hasMoreEvents =
52223
52251
  setInternalSortOrder(order2);
52224
52252
  }
52225
52253
  }, [onSortOrderChange]);
52254
+ const [searchQuery, setSearchQuery] = reactExports.useState("");
52255
+ const [searchResults, setSearchResults] = reactExports.useState(null);
52256
+ const [searchResultsTruncated, setSearchResultsTruncated] = reactExports.useState(false);
52257
+ const [searchError, setSearchError] = reactExports.useState(null);
52258
+ const [searchLoading, setSearchLoading] = reactExports.useState(false);
52259
+ const [searchNotFound, setSearchNotFound] = reactExports.useState(false);
52260
+ const searchRequestRef = reactExports.useRef(0);
52261
+ const virtuosoRef = reactExports.useRef(null);
52262
+ const parsedSearchId = reactExports.useMemo(() => parseExactWorkflowSearchId(searchQuery), [searchQuery]);
52263
+ const isExactSearchActive = searchResults !== null;
52226
52264
  const sortedEvents2 = reactExports.useMemo(() => {
52227
- if (!events2 || events2.length === 0)
52265
+ const sourceEvents = isExactSearchActive ? searchResults : events2 ?? [];
52266
+ if (sourceEvents.length === 0)
52228
52267
  return [];
52229
52268
  const dir = effectiveSortOrder === "desc" ? -1 : 1;
52230
- return [...events2].sort((a2, b2) => dir * (new Date(a2.createdAt).getTime() - new Date(b2.createdAt).getTime()));
52231
- }, [events2, effectiveSortOrder]);
52269
+ return [...sourceEvents].sort((a2, b2) => dir * (new Date(a2.createdAt).getTime() - new Date(b2.createdAt).getTime()));
52270
+ }, [events2, effectiveSortOrder, isExactSearchActive, searchResults]);
52232
52271
  const hasEncryptedInlineData = reactExports.useMemo(() => {
52233
- if (!events2)
52272
+ const sourceEvents = isExactSearchActive ? searchResults : events2;
52273
+ if (!sourceEvents)
52234
52274
  return false;
52235
- for (const event of events2) {
52275
+ for (const event of sourceEvents) {
52236
52276
  const ed = event.eventData;
52237
52277
  if (hasEncryptedValues(ed))
52238
52278
  return true;
52239
52279
  }
52240
52280
  return false;
52241
- }, [events2]);
52281
+ }, [events2, isExactSearchActive, searchResults]);
52242
52282
  const [foundEncryptedInLazyData, setFoundEncryptedInLazyData] = reactExports.useState(false);
52243
52283
  const handleEncryptedDataDetected = reactExports.useCallback(() => {
52244
52284
  setFoundEncryptedInLazyData(true);
52245
52285
  }, []);
52246
52286
  const hasEncryptedData = hasEncryptedDataProp || hasEncryptedInlineData || foundEncryptedInLazyData;
52247
- const { correlationNameMap, workflowName } = reactExports.useMemo(() => buildNameMaps(events2 ?? null, run ?? null), [events2, run]);
52287
+ const { correlationNameMap, workflowName } = reactExports.useMemo(() => buildNameMaps(isExactSearchActive ? searchResults : events2 ?? null, run ?? null), [events2, isExactSearchActive, run, searchResults]);
52248
52288
  const durationMap = reactExports.useMemo(() => buildDurationMap(sortedEvents2), [sortedEvents2]);
52249
52289
  const [selectedGroupKey, setSelectedGroupKey] = reactExports.useState(void 0);
52250
52290
  const [hoveredGroupKey, setHoveredGroupKey] = reactExports.useState(void 0);
@@ -52312,58 +52352,100 @@ function EventListView({ events: events2, run, onLoadEventData, hasMoreEvents =
52312
52352
  }
52313
52353
  return first >= 0 ? { first, last } : null;
52314
52354
  }, [activeGroupKey, sortedEvents2]);
52315
- const [searchQuery, setSearchQuery] = reactExports.useState("");
52316
- const virtuosoRef = reactExports.useRef(null);
52317
- const searchIndex = reactExports.useMemo(() => {
52318
- const entries = [];
52319
- for (let i = 0; i < sortedEvents2.length; i++) {
52320
- const ev = sortedEvents2[i];
52321
- const isRun = isRunLevel(ev.eventType);
52322
- const name2 = isRun ? workflowName ?? "" : ev.correlationId ? correlationNameMap.get(ev.correlationId) ?? "" : "";
52323
- entries.push({
52324
- fields: [
52325
- ev.eventId,
52326
- ev.correlationId ?? "",
52327
- ev.eventType,
52328
- formatEventType(ev.eventType),
52329
- name2
52330
- ].map((f2) => f2.toLowerCase()),
52331
- groupKey: ev.correlationId ?? (isRun ? "__run__" : void 0),
52332
- eventId: ev.eventId,
52333
- index: i
52334
- });
52335
- }
52336
- return entries;
52337
- }, [sortedEvents2, correlationNameMap, workflowName]);
52338
52355
  reactExports.useEffect(() => {
52339
- var _a3;
52340
- const q2 = searchQuery.trim().toLowerCase();
52341
- if (!q2) {
52356
+ const trimmed = searchQuery.trim();
52357
+ if (!trimmed) {
52358
+ searchRequestRef.current += 1;
52359
+ setSearchResults(null);
52360
+ setSearchResultsTruncated(false);
52361
+ setSearchError(null);
52362
+ setSearchLoading(false);
52363
+ setSearchNotFound(false);
52342
52364
  setSelectedGroupKey(void 0);
52343
52365
  return;
52344
52366
  }
52345
- let bestMatch = null;
52346
- let bestScore = 0;
52347
- for (const entry2 of searchIndex) {
52348
- for (const field of entry2.fields) {
52349
- if (field && field.includes(q2)) {
52350
- const score = q2.length / field.length;
52351
- if (score > bestScore) {
52352
- bestScore = score;
52353
- bestMatch = entry2;
52367
+ const parsed = parseExactWorkflowSearchId(trimmed);
52368
+ if (!parsed || !onExactIdSearch) {
52369
+ setSearchResults(null);
52370
+ setSearchLoading(false);
52371
+ setSearchNotFound(false);
52372
+ return;
52373
+ }
52374
+ const requestId = ++searchRequestRef.current;
52375
+ setSearchLoading(true);
52376
+ setSearchNotFound(false);
52377
+ setSearchError(null);
52378
+ const abortController = new AbortController();
52379
+ const timer2 = setTimeout(() => {
52380
+ void (async () => {
52381
+ var _a3;
52382
+ try {
52383
+ const results = await onExactIdSearch(parsed.id, parsed.kind, abortController.signal);
52384
+ if (abortController.signal.aborted || searchRequestRef.current !== requestId) {
52385
+ return;
52386
+ }
52387
+ if (results.status === "error") {
52388
+ setSearchResults([]);
52389
+ setSearchResultsTruncated(false);
52390
+ setSearchNotFound(false);
52391
+ setSearchError(results.message);
52392
+ setSelectedGroupKey(void 0);
52393
+ return;
52394
+ }
52395
+ if (results.status === "not_found" || results.status === "ok" && results.events.length === 0) {
52396
+ setSearchResults([]);
52397
+ setSearchResultsTruncated(false);
52398
+ setSearchNotFound(true);
52399
+ setSearchError(null);
52400
+ setSelectedGroupKey(void 0);
52401
+ return;
52402
+ }
52403
+ setSearchResults(results.events);
52404
+ setSearchResultsTruncated(Boolean(results.truncated));
52405
+ setSearchNotFound(false);
52406
+ setSearchError(null);
52407
+ setSelectedGroupKey(parsed.kind === "event" ? (() => {
52408
+ const first = results.events[0];
52409
+ if (!first)
52410
+ return void 0;
52411
+ return isRunLevel(first.eventType) ? "__run__" : first.correlationId ?? void 0;
52412
+ })() : parsed.id);
52413
+ (_a3 = virtuosoRef.current) == null ? void 0 : _a3.scrollToIndex({
52414
+ index: 0,
52415
+ align: "start",
52416
+ behavior: "smooth"
52417
+ });
52418
+ } catch {
52419
+ if (abortController.signal.aborted || searchRequestRef.current !== requestId) {
52420
+ return;
52421
+ }
52422
+ setSearchResults([]);
52423
+ setSearchResultsTruncated(false);
52424
+ setSearchNotFound(false);
52425
+ setSearchError("Failed to search events. Try again.");
52426
+ setSelectedGroupKey(void 0);
52427
+ } finally {
52428
+ if (searchRequestRef.current === requestId && !abortController.signal.aborted) {
52429
+ setSearchLoading(false);
52354
52430
  }
52355
52431
  }
52356
- }
52432
+ })();
52433
+ }, 300);
52434
+ return () => {
52435
+ clearTimeout(timer2);
52436
+ abortController.abort();
52437
+ };
52438
+ }, [searchQuery, onExactIdSearch]);
52439
+ const handleSearchKeyDown = reactExports.useCallback((event) => {
52440
+ if (event.key !== "Enter") {
52441
+ return;
52357
52442
  }
52358
- if (bestMatch) {
52359
- setSelectedGroupKey(bestMatch.groupKey);
52360
- (_a3 = virtuosoRef.current) == null ? void 0 : _a3.scrollToIndex({
52361
- index: bestMatch.index,
52362
- align: "center",
52363
- behavior: "smooth"
52364
- });
52443
+ const trimmed = searchQuery.trim();
52444
+ if (!trimmed || parseExactWorkflowSearchId(trimmed) || !onExactIdSearch || !looksLikeWorkflowIdSearchInput(trimmed)) {
52445
+ return;
52365
52446
  }
52366
- }, [searchQuery, searchIndex]);
52447
+ toast2.info("Enter a full step ID, wait ID, hook ID, or event ID");
52448
+ }, [searchQuery, onExactIdSearch, toast2]);
52367
52449
  const hasHadEventsRef = reactExports.useRef(false);
52368
52450
  if (sortedEvents2.length > 0) {
52369
52451
  hasHadEventsRef.current = true;
@@ -52373,9 +52455,6 @@ function EventListView({ events: events2, run, onLoadEventData, hasMoreEvents =
52373
52455
  if (isInitialLoad) {
52374
52456
  return jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col overflow-hidden", children: [jsxRuntimeExports.jsx("div", { style: { padding: 6 }, children: jsxRuntimeExports.jsx(Skeleton$2, { style: { height: 40, borderRadius: 6 } }) }), jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0 h-10 border-b flex-shrink-0", style: { borderColor: "var(--ds-gray-alpha-200)" }, children: [jsxRuntimeExports.jsx("div", { className: "flex-shrink-0", style: { width: GUTTER_WIDTH } }), jsxRuntimeExports.jsx("div", { className: "w-5 flex-shrink-0" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: 40 } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: 72 } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: 44 } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: 92 } }) }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: 60 } }) })] }), jsxRuntimeExports.jsx(RowsSkeleton, {})] });
52375
52457
  }
52376
- if (!isLoading && (!events2 || events2.length === 0)) {
52377
- return jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full text-sm", style: { color: "var(--ds-gray-700)" }, children: "No events found" });
52378
- }
52379
52458
  return jsxRuntimeExports.jsx(DecryptClickContext.Provider, { value: onDecrypt ? { onDecrypt, isDecrypting } : void 0, children: jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col overflow-hidden", children: [jsxRuntimeExports.jsx("style", { children: `@keyframes workflow-dot-pulse{0%{transform:scale(1);opacity:.7}70%,100%{transform:scale(2.2);opacity:0}}` }), jsxRuntimeExports.jsxs("div", { style: {
52380
52459
  padding: 6,
52381
52460
  backgroundColor: "var(--ds-background-100)",
@@ -52399,7 +52478,7 @@ function EventListView({ events: events2, run, onLoadEventData, hasMoreEvents =
52399
52478
  justifyContent: "center",
52400
52479
  color: "var(--ds-gray-800)",
52401
52480
  flexShrink: 0
52402
- }, children: jsxRuntimeExports.jsxs("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", focusable: "false", children: [jsxRuntimeExports.jsx("circle", { cx: "7", cy: "7", r: "4.5", stroke: "currentColor", strokeWidth: "1.5" }), jsxRuntimeExports.jsx("path", { d: "M11.5 11.5L14 14", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })] }) }), jsxRuntimeExports.jsx("input", { type: "search", placeholder: "Search by name, event type, or ID…", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), style: {
52481
+ }, children: jsxRuntimeExports.jsxs("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", focusable: "false", children: [jsxRuntimeExports.jsx("circle", { cx: "7", cy: "7", r: "4.5", stroke: "currentColor", strokeWidth: "1.5" }), jsxRuntimeExports.jsx("path", { d: "M11.5 11.5L14 14", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })] }) }), jsxRuntimeExports.jsx("input", { type: "search", placeholder: "Search by step ID, wait ID, hook ID, or event ID…", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), onKeyDown: handleSearchKeyDown, disabled: !onExactIdSearch, title: onExactIdSearch ? void 0 : "Exact ID search is unavailable in this view.", style: {
52403
52482
  marginLeft: -16,
52404
52483
  paddingInline: 12,
52405
52484
  fontFamily: "inherit",
@@ -52408,24 +52487,26 @@ function EventListView({ events: events2, run, onLoadEventData, hasMoreEvents =
52408
52487
  border: "none",
52409
52488
  outline: "none",
52410
52489
  height: 40,
52411
- width: "100%"
52490
+ width: "100%",
52491
+ opacity: onExactIdSearch ? 1 : 0.5,
52492
+ cursor: onExactIdSearch ? "text" : "not-allowed"
52412
52493
  } })] }), jsxRuntimeExports.jsx(MenuDropdown, { options: SORT_OPTIONS, value: effectiveSortOrder, onChange: handleSortOrderChange }), (hasEncryptedData || encryptionKey) && onDecrypt && jsxRuntimeExports.jsx(DecryptButton, { decrypted: !!encryptionKey, loading: isDecrypting, onClick: onDecrypt })] }), jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0 text-[13px] font-medium h-10 border-b flex-shrink-0", style: {
52413
52494
  borderColor: "var(--ds-gray-alpha-200)",
52414
52495
  color: "var(--ds-gray-900)",
52415
52496
  backgroundColor: "var(--ds-background-100)"
52416
- }, children: [jsxRuntimeExports.jsx("div", { className: "flex-shrink-0", style: { width: GUTTER_WIDTH } }), jsxRuntimeExports.jsx("div", { className: "w-5 flex-shrink-0" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: "Time" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: "Event Type" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: "Name" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: "Correlation ID" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: "Event ID" })] }), isRefetching ? jsxRuntimeExports.jsx(RowsSkeleton, {}) : jsxRuntimeExports.jsx(Yr, { ref: virtuosoRef, totalCount: sortedEvents2.length, overscan: 20, defaultItemHeight: 40, endReached: () => {
52417
- if (!hasMoreEvents || isLoadingMoreEvents) {
52497
+ }, children: [jsxRuntimeExports.jsx("div", { className: "flex-shrink-0", style: { width: GUTTER_WIDTH } }), jsxRuntimeExports.jsx("div", { className: "w-5 flex-shrink-0" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: "Time" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: "Event Type" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "2 1 0%" }, children: "Name" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: "Correlation ID" }), jsxRuntimeExports.jsx("div", { className: "min-w-0 px-4", style: { flex: "3 1 0%" }, children: "Event ID" })] }), isRefetching || searchLoading ? jsxRuntimeExports.jsx(RowsSkeleton, {}) : sortedEvents2.length === 0 ? jsxRuntimeExports.jsx("div", { className: "flex flex-1 items-center justify-center px-6 text-center text-sm", style: { color: "var(--ds-gray-700)" }, children: searchNotFound && searchQuery.trim() ? `No events found for ${searchQuery.trim()}` : searchError ? searchError : parsedSearchId && searchQuery.trim() && !onExactIdSearch ? "Exact ID search is unavailable in this view." : "No events found" }) : jsxRuntimeExports.jsx(Yr, { ref: virtuosoRef, totalCount: sortedEvents2.length, overscan: 20, defaultItemHeight: 40, endReached: () => {
52498
+ if (isExactSearchActive || !hasMoreEvents || isLoadingMoreEvents) {
52418
52499
  return;
52419
52500
  }
52420
52501
  void (onLoadMoreEvents == null ? void 0 : onLoadMoreEvents());
52421
52502
  }, itemContent: (index2) => {
52422
52503
  const ev = sortedEvents2[index2];
52423
- return jsxRuntimeExports.jsx(EventRow, { event: ev, index: index2, isFirst: index2 === 0, isLast: index2 === sortedEvents2.length - 1, isExpanded: expandedEventIds.has(ev.eventId), onToggleExpand: toggleEventExpanded, activeGroupKey, selectedGroupKey, selectedGroupRange, correlationNameMap, workflowName, durationMap, onSelectGroup, onHoverGroup, onLoadEventData, cachedEventData: eventDataCacheRef.current.get(ev.eventId) ?? null, onCacheEventData: cacheEventData, encryptionKey, onEncryptedDataDetected: handleEncryptedDataDetected });
52504
+ return jsxRuntimeExports.jsx(EventRow, { event: ev, index: index2, isFirst: index2 === 0, isLast: index2 === sortedEvents2.length - 1, isExpanded: expandedEventIds.has(ev.eventId), onToggleExpand: toggleEventExpanded, activeGroupKey, selectedGroupKey, selectedGroupRange, correlationNameMap, workflowName, durationMap, onSelectGroup, onHoverGroup, onLoadEventData, cachedEventData: eventDataCacheRef.current.get(ev.eventId) ?? null, onCacheEventData: cacheEventData, encryptionKey, onEncryptedDataDetected: handleEncryptedDataDetected, suppressGroupDimming: isExactSearchActive });
52424
52505
  }, style: { flex: 1, minHeight: 0 } }), jsxRuntimeExports.jsxs("div", { className: "relative flex-shrink-0 flex items-center h-10 border-t px-4 text-xs", style: {
52425
52506
  borderColor: "var(--ds-gray-alpha-200)",
52426
52507
  color: "var(--ds-gray-900)",
52427
52508
  backgroundColor: "var(--ds-background-100)"
52428
- }, children: [jsxRuntimeExports.jsxs("span", { children: [sortedEvents2.length, " event", sortedEvents2.length !== 1 ? "s" : "", " loaded"] }), hasMoreEvents && jsxRuntimeExports.jsx("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: jsxRuntimeExports.jsx("div", { className: "pointer-events-auto", children: jsxRuntimeExports.jsx(LoadMoreButton, { loading: isLoadingMoreEvents, onClick: () => void (onLoadMoreEvents == null ? void 0 : onLoadMoreEvents()) }) }) })] })] }) });
52509
+ }, children: [jsxRuntimeExports.jsx("span", { children: isExactSearchActive ? searchError ? searchError : searchNotFound ? `No events found for ${searchQuery.trim()}` : `${sortedEvents2.length} event${sortedEvents2.length !== 1 ? "s" : ""} for ${searchQuery.trim()}${searchResultsTruncated ? " (results may be truncated)" : ""}` : `${sortedEvents2.length} event${sortedEvents2.length !== 1 ? "s" : ""} loaded` }), !isExactSearchActive && hasMoreEvents && jsxRuntimeExports.jsx("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: jsxRuntimeExports.jsx("div", { className: "pointer-events-auto", children: jsxRuntimeExports.jsx(LoadMoreButton, { loading: isLoadingMoreEvents, onClick: () => void (onLoadMoreEvents == null ? void 0 : onLoadMoreEvents()) }) }) })] })] }) });
52429
52510
  }
52430
52511
  function ResolveHookModal({ isOpen, onClose, onSubmit, isSubmitting = false }) {
52431
52512
  var _a3;
@@ -79302,7 +79383,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
79302
79383
  var et = ({ className: e, language: t, style: o, isIncomplete: n, ...s2 }) => jsxRuntimeExports.jsx("div", { className: f("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2", e), "data-incomplete": n || void 0, "data-language": t, "data-streamdown": "code-block", style: { contentVisibility: "auto", containIntrinsicSize: "auto 200px", ...o }, ...s2 });
79303
79384
  var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
79304
79385
  var ot = ({ language: e }) => jsxRuntimeExports.jsx("div", { className: "flex h-8 items-center text-muted-foreground text-xs", "data-language": e, "data-streamdown": "code-block-header", children: jsxRuntimeExports.jsx("span", { className: "ml-1 font-mono lowercase", children: e }) });
79305
- var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-ByO-v0q1.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
79386
+ var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-Bid3dXog.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
79306
79387
  let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
79307
79388
  `).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
79308
79389
  return jsxRuntimeExports.jsx(Se.Provider, { value: { code: e }, children: jsxRuntimeExports.jsxs(et, { isIncomplete: s2, language: t, children: [jsxRuntimeExports.jsx(ot, { language: t }), n ? jsxRuntimeExports.jsx("div", { className: "pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end", children: jsxRuntimeExports.jsx("div", { className: "pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur", "data-streamdown": "code-block-actions", children: n }) }) : null, jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: jsxRuntimeExports.jsx(Qe, { className: o, language: t, result: c, ...r2 }), children: jsxRuntimeExports.jsx(dn, { className: o, code: i, language: t, raw: c, ...r2 }) })] }) });
@@ -79624,7 +79705,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
79624
79705
  }, []), jsxRuntimeExports.jsxs("div", { className: "relative", ref: i, children: [jsxRuntimeExports.jsx("button", { className: f("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50", t), disabled: c, onClick: () => r2(!s2), title: "Download table", type: "button", children: e != null ? e : jsxRuntimeExports.jsx(Z, { size: 14 }) }), s2 ? jsxRuntimeExports.jsxs("div", { className: "absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg", children: [jsxRuntimeExports.jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("csv"), title: "Download table as CSV", type: "button", children: "CSV" }), jsxRuntimeExports.jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("markdown"), title: "Download table as Markdown", type: "button", children: "Markdown" })] }) : null] });
79625
79706
  };
79626
79707
  var Vt = ({ children: e, className: t, showControls: o, ...n }) => jsxRuntimeExports.jsxs("div", { className: "my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2", "data-streamdown": "table-wrapper", children: [o ? jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end gap-1", children: [jsxRuntimeExports.jsx(Ht, {}), jsxRuntimeExports.jsx(Dt, {})] }) : null, jsxRuntimeExports.jsx("div", { className: "border-collapse overflow-x-auto overscroll-y-auto rounded-md border border-border bg-background", children: jsxRuntimeExports.jsx("table", { className: f("w-full divide-y divide-border", t), "data-streamdown": "table", ...n, children: e }) })] });
79627
- var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-CJpvg6rz.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
79708
+ var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-Dx3Er0ad.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
79628
79709
  function ke(e, t) {
79629
79710
  if (!(e != null && e.position || t != null && t.position)) return true;
79630
79711
  if (!(e != null && e.position && (t != null && t.position))) return false;
@@ -87789,6 +87870,13 @@ async function fetchEvents$1(worldEnv, runId, params) {
87789
87870
  async function fetchEvent$1(worldEnv, runId, eventId, resolveData = "all") {
87790
87871
  return rpc("fetchEvent", { worldEnv, runId, eventId, resolveData });
87791
87872
  }
87873
+ async function fetchEventsByCorrelationId$1(worldEnv, correlationId, params) {
87874
+ return rpc("fetchEventsByCorrelationId", {
87875
+ worldEnv,
87876
+ correlationId,
87877
+ params
87878
+ });
87879
+ }
87792
87880
  async function fetchHooks$1(worldEnv, params) {
87793
87881
  return rpc("fetchHooks", { worldEnv, params });
87794
87882
  }
@@ -89414,7 +89502,7 @@ createLogger("webhook");
89414
89502
  createLogger("events");
89415
89503
  createLogger("adapter");
89416
89504
  const MAX_QUEUE_DELIVERIES = 48;
89417
- const version$1 = "4.2.5";
89505
+ const version$1 = "4.2.6";
89418
89506
  const execFileAsync = promisify(execFile);
89419
89507
  function parsePort$1(value, radix = 10) {
89420
89508
  const port = parseInt(value, radix);
@@ -89849,6 +89937,16 @@ async function readBuffer(filePath) {
89849
89937
  const content2 = await promises.readFile(filePath);
89850
89938
  return content2;
89851
89939
  }
89940
+ async function readFirstByte(filePath) {
89941
+ const file2 = await promises.open(filePath, "r");
89942
+ try {
89943
+ const byte = Buffer.allocUnsafe(1);
89944
+ const { bytesRead } = await file2.read(byte, 0, 1, 0);
89945
+ return bytesRead === 0 ? void 0 : byte[0];
89946
+ } finally {
89947
+ await file2.close();
89948
+ }
89949
+ }
89852
89950
  async function deleteJSON(filePath) {
89853
89951
  try {
89854
89952
  await promises.unlink(filePath);
@@ -115534,40 +115632,50 @@ const monotonicUlid = monotonicFactory(() => Math.random());
115534
115632
  const RunStreamsSchema = object$1({
115535
115633
  streams: array$1(string$3())
115536
115634
  });
115635
+ const EOF_MARKER = 1;
115636
+ function isEofByte(byte) {
115637
+ return byte === EOF_MARKER;
115638
+ }
115537
115639
  function serializeChunk(chunk) {
115538
- const eofByte = Buffer.from([chunk.eof ? 1 : 0]);
115640
+ const eofByte = Buffer.from([chunk.eof ? EOF_MARKER : 0]);
115539
115641
  return Buffer.concat([eofByte, chunk.chunk]);
115540
115642
  }
115541
115643
  function isEofChunk(serialized) {
115542
- return serialized[0] === 1;
115644
+ return isEofByte(serialized[0]);
115543
115645
  }
115544
115646
  function deserializeChunk(serialized) {
115545
- const eof = serialized[0] === 1;
115647
+ const eof = isEofChunk(serialized);
115546
115648
  const chunk = Buffer.from(serialized.subarray(1));
115547
115649
  return { eof, chunk };
115548
115650
  }
115651
+ async function listChunkEntries(chunksDir) {
115652
+ try {
115653
+ return await fs$1.readdir(chunksDir);
115654
+ } catch (error2) {
115655
+ if (error2.code === "ENOENT")
115656
+ return [];
115657
+ throw error2;
115658
+ }
115659
+ }
115660
+ function addChunkFilesByExtension(extMap, entries, sourceExtension, fileExtension = sourceExtension, include = () => true) {
115661
+ for (const entry2 of entries) {
115662
+ if (!entry2.endsWith(sourceExtension))
115663
+ continue;
115664
+ const file2 = entry2.slice(0, -sourceExtension.length);
115665
+ if (include(file2))
115666
+ extMap.set(file2, fileExtension);
115667
+ }
115668
+ }
115549
115669
  async function listChunkFilesForStream(chunksDir, name2, tag) {
115550
115670
  assertSafeEntityId("streamName", name2);
115551
- const listPromises = [
115552
- listFilesByExtension(chunksDir, ".bin"),
115553
- listFilesByExtension(chunksDir, ".json")
115554
- ];
115555
- if (tag) {
115556
- listPromises.push(listFilesByExtension(chunksDir, `.${tag}.bin`));
115557
- }
115558
- const [binFiles, jsonFiles, ...taggedResults] = await Promise.all(listPromises);
115559
- const taggedBinFiles = taggedResults[0] ?? [];
115671
+ const entries = await listChunkEntries(chunksDir);
115560
115672
  const extMap = /* @__PURE__ */ new Map();
115561
- for (const f2 of jsonFiles)
115562
- extMap.set(f2, ".json");
115563
- const tagSfx = tag ? `.${tag}` : "";
115564
- for (const f2 of binFiles) {
115565
- if (tag && f2.endsWith(tagSfx))
115566
- continue;
115567
- extMap.set(f2, ".bin");
115673
+ addChunkFilesByExtension(extMap, entries, ".json");
115674
+ addChunkFilesByExtension(extMap, entries, ".bin", ".bin", tag ? (file2) => !file2.endsWith(`.${tag}`) : void 0);
115675
+ if (tag) {
115676
+ const taggedExtension = `.${tag}.bin`;
115677
+ addChunkFilesByExtension(extMap, entries, taggedExtension);
115568
115678
  }
115569
- for (const f2 of taggedBinFiles)
115570
- extMap.set(f2, `.${tag}.bin`);
115571
115679
  const files = [...extMap.keys()].filter((file2) => file2.startsWith(`${name2}-`)).sort();
115572
115680
  return { files, extMap };
115573
115681
  }
@@ -115681,7 +115789,7 @@ function createStreamer$1(basedir, tag) {
115681
115789
  const ext2 = fileExtMap.get(file2) ?? ".bin";
115682
115790
  const filePath = path$3.join(chunksDir, `${file2}${ext2}`);
115683
115791
  if (dataIndex < startIndex) {
115684
- if (isEofChunk(await readBuffer(filePath))) {
115792
+ if (isEofByte(await readFirstByte(filePath))) {
115685
115793
  streamDone = true;
115686
115794
  break;
115687
115795
  }
@@ -115689,7 +115797,7 @@ function createStreamer$1(basedir, tag) {
115689
115797
  continue;
115690
115798
  }
115691
115799
  if (resultChunks.length >= limit) {
115692
- if (isEofChunk(await readBuffer(filePath))) {
115800
+ if (isEofByte(await readFirstByte(filePath))) {
115693
115801
  streamDone = true;
115694
115802
  } else {
115695
115803
  dataIndex++;
@@ -115724,7 +115832,7 @@ function createStreamer$1(basedir, tag) {
115724
115832
  let dataCount = 0;
115725
115833
  for (const file2 of chunkFiles) {
115726
115834
  const ext2 = fileExtMap.get(file2) ?? ".bin";
115727
- if (isEofChunk(await readBuffer(path$3.join(chunksDir, `${file2}${ext2}`)))) {
115835
+ if (isEofByte(await readFirstByte(path$3.join(chunksDir, `${file2}${ext2}`)))) {
115728
115836
  streamDone = true;
115729
115837
  break;
115730
115838
  }
@@ -115785,8 +115893,7 @@ function createStreamer$1(basedir, tag) {
115785
115893
  if (typeof startIndex === "number" && startIndex < 0 && chunkFiles.length > 0) {
115786
115894
  const lastFile = chunkFiles[chunkFiles.length - 1];
115787
115895
  const lastExt = fileExtMap.get(lastFile) ?? ".bin";
115788
- const lastChunk = deserializeChunk(await readBuffer(path$3.join(chunksDir, `${lastFile}${lastExt}`)));
115789
- if ((lastChunk == null ? void 0 : lastChunk.eof) === true) {
115896
+ if (isEofByte(await readFirstByte(path$3.join(chunksDir, `${lastFile}${lastExt}`)))) {
115790
115897
  dataChunkCount--;
115791
115898
  }
115792
115899
  }
@@ -115932,7 +116039,7 @@ function createLocalWorld(args) {
115932
116039
  const basedir = mergedConfig.dataDir;
115933
116040
  const hooksDir = path$3.join(basedir, "hooks");
115934
116041
  const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
115935
- const { HookSchema: HookSchema2 } = await import("./index-6XpyP-Zw.js");
116042
+ const { HookSchema: HookSchema2 } = await import("./index-DSI4dt08.js");
115936
116043
  await Promise.all(taggedHookFiles.map(async (hookFile) => {
115937
116044
  const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
115938
116045
  if (hook == null ? void 0 : hook.token) {
@@ -116084,8 +116191,8 @@ function requireGetVercelOidcToken() {
116084
116191
  }
116085
116192
  try {
116086
116193
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
116087
- await import("./token-util-Cv4v93wd.js").then((n) => n.t),
116088
- await import("./token-DLJYtB0F.js").then((n) => n.t)
116194
+ await import("./token-util-B88n4Kn9.js").then((n) => n.t),
116195
+ await import("./token-bXRgYyTK.js").then((n) => n.t)
116089
116196
  ]);
116090
116197
  if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
116091
116198
  await refreshToken(options);
@@ -121256,7 +121363,7 @@ var QueueClient = class {
121256
121363
  setApi(this, new ApiClient({ ...options, region }));
121257
121364
  }
121258
121365
  };
121259
- const version = "4.2.0";
121366
+ const version = "4.3.0";
121260
121367
  const HTTP_DEBUG_ENABLED = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
121261
121368
  function httpLog(method, endpoint, status, ms2) {
121262
121369
  if (HTTP_DEBUG_ENABLED) {
@@ -122477,6 +122584,16 @@ async function fetchStreamMutation(url2, init2, operation) {
122477
122584
  throw err;
122478
122585
  }
122479
122586
  }
122587
+ function createStreamRequestError(operation, url2, response2, text2) {
122588
+ const context = [`PUT ${url2.origin}${url2.pathname}`];
122589
+ for (const header of ["x-vercel-id", "x-vercel-error"]) {
122590
+ const value = response2.headers.get(header);
122591
+ if (value) {
122592
+ context.push(`${header}=${value}`);
122593
+ }
122594
+ }
122595
+ return new Error(`Stream ${operation} failed: HTTP ${response2.status} (${context.join("; ")}): ${text2}`);
122596
+ }
122480
122597
  function encodeMultiChunks(chunks) {
122481
122598
  const encoder = new TextEncoder();
122482
122599
  const binaryChunks = [];
@@ -122515,14 +122632,15 @@ function createStreamer(config2) {
122515
122632
  async writeToStream(name2, runId, chunk) {
122516
122633
  const resolvedRunId = await runId;
122517
122634
  const httpConfig = await getHttpConfig(config2);
122518
- const response2 = await fetchStreamMutation(getStreamUrl(name2, resolvedRunId, httpConfig), {
122635
+ const url2 = getStreamUrl(name2, resolvedRunId, httpConfig);
122636
+ const response2 = await fetchStreamMutation(url2, {
122519
122637
  method: "PUT",
122520
122638
  body: chunk,
122521
122639
  headers: httpConfig.headers
122522
122640
  }, "write");
122523
122641
  const text2 = await response2.text();
122524
122642
  if (!response2.ok) {
122525
- throw new Error(`Stream write failed: HTTP ${response2.status}: ${text2}`);
122643
+ throw createStreamRequestError("write", url2, response2, text2);
122526
122644
  }
122527
122645
  },
122528
122646
  async writeToStreamMulti(name2, runId, chunks) {
@@ -122534,14 +122652,15 @@ function createStreamer(config2) {
122534
122652
  for (let i = 0; i < chunks.length; i += MAX_CHUNKS_PER_REQUEST) {
122535
122653
  const batch = chunks.slice(i, i + MAX_CHUNKS_PER_REQUEST);
122536
122654
  const body2 = encodeMultiChunks(batch);
122537
- const response2 = await fetchStreamMutation(getStreamUrl(name2, resolvedRunId, httpConfig), {
122655
+ const url2 = getStreamUrl(name2, resolvedRunId, httpConfig);
122656
+ const response2 = await fetchStreamMutation(url2, {
122538
122657
  method: "PUT",
122539
122658
  body: body2,
122540
122659
  headers: httpConfig.headers
122541
122660
  }, "write");
122542
122661
  const text2 = await response2.text();
122543
122662
  if (!response2.ok) {
122544
- throw new Error(`Stream write failed: HTTP ${response2.status}: ${text2}`);
122663
+ throw createStreamRequestError("write", url2, response2, text2);
122545
122664
  }
122546
122665
  }
122547
122666
  },
@@ -122549,13 +122668,14 @@ function createStreamer(config2) {
122549
122668
  const resolvedRunId = await runId;
122550
122669
  const httpConfig = await getHttpConfig(config2);
122551
122670
  httpConfig.headers.set("X-Stream-Done", "true");
122552
- const response2 = await fetchStreamMutation(getStreamUrl(name2, resolvedRunId, httpConfig), {
122671
+ const url2 = getStreamUrl(name2, resolvedRunId, httpConfig);
122672
+ const response2 = await fetchStreamMutation(url2, {
122553
122673
  method: "PUT",
122554
122674
  headers: httpConfig.headers
122555
122675
  }, "close");
122556
122676
  const text2 = await response2.text();
122557
122677
  if (!response2.ok) {
122558
- throw new Error(`Stream close failed: HTTP ${response2.status}: ${text2}`);
122678
+ throw createStreamRequestError("close", url2, response2, text2);
122559
122679
  }
122560
122680
  },
122561
122681
  async readFromStream(name2, startIndex) {
@@ -123997,12 +124117,15 @@ function getSerializationClass(classId, global2) {
123997
124117
  }
123998
124118
  const LOCK_POLL_INTERVAL_MS = 100;
123999
124119
  function createFlushableState() {
124000
- return {
124120
+ const state = {
124001
124121
  ...withResolvers$1(),
124002
124122
  pendingOps: 0,
124003
124123
  doneResolved: false,
124004
124124
  streamEnded: false
124005
124125
  };
124126
+ state.promise.catch(() => {
124127
+ });
124128
+ return state;
124006
124129
  }
124007
124130
  function isWritableUnlockedNotClosed(writable) {
124008
124131
  if (writable.locked)
@@ -129476,6 +129599,31 @@ async function fetchEvent(worldEnv, runId, eventId, resolveData = "all") {
129476
129599
  });
129477
129600
  }
129478
129601
  }
129602
+ async function fetchEventsByCorrelationId(worldEnv, correlationId, params) {
129603
+ const { cursor, sortOrder = "asc", limit = 100, withData = false } = params;
129604
+ try {
129605
+ const world = await getWorldFromEnv(worldEnv);
129606
+ const result = await world.events.listByCorrelationId({
129607
+ correlationId,
129608
+ pagination: { cursor, limit, sortOrder },
129609
+ resolveData: withData ? "all" : "none"
129610
+ });
129611
+ return createResponse({
129612
+ data: result.data,
129613
+ cursor: result.cursor ?? void 0,
129614
+ hasMore: result.hasMore
129615
+ });
129616
+ } catch (error2) {
129617
+ return createServerActionError(
129618
+ error2,
129619
+ "world.events.listByCorrelationId",
129620
+ {
129621
+ correlationId,
129622
+ ...params
129623
+ }
129624
+ );
129625
+ }
129626
+ }
129479
129627
  async function fetchHooks(worldEnv, params) {
129480
129628
  const { runId, cursor, sortOrder = "desc", limit = 10 } = params;
129481
129629
  try {
@@ -151397,6 +151545,7 @@ function useStreamReader(env2, streamId, runId, encryptionKey, runStatus) {
151397
151545
  }
151398
151546
  const INITIAL_PAGE_SIZE = 100;
151399
151547
  const LOAD_MORE_PAGE_SIZE = 100;
151548
+ const MAX_CORRELATION_SEARCH_PAGES = 30;
151400
151549
  function useEventsListData(env2, runId, options = {}) {
151401
151550
  const { sortOrder = "asc", encryptionKey, enabled = true } = options;
151402
151551
  const [events2, setEvents] = reactExports.useState([]);
@@ -151408,6 +151557,16 @@ function useEventsListData(env2, runId, options = {}) {
151408
151557
  const isFetchingRef = reactExports.useRef(false);
151409
151558
  const encryptionKeyRef = reactExports.useRef(encryptionKey);
151410
151559
  encryptionKeyRef.current = encryptionKey;
151560
+ const hydrateEvents = reactExports.useCallback(async (rawEvents) => {
151561
+ const hydrated = rawEvents.map(hydrateResourceIO);
151562
+ const key = encryptionKeyRef.current;
151563
+ if (key) {
151564
+ return Promise.all(
151565
+ hydrated.map((ev) => hydrateResourceIOWithKey(ev, key))
151566
+ );
151567
+ }
151568
+ return hydrated;
151569
+ }, []);
151411
151570
  const fetchInitial = reactExports.useCallback(async () => {
151412
151571
  if (isFetchingRef.current) return;
151413
151572
  isFetchingRef.current = true;
@@ -151427,16 +151586,7 @@ function useEventsListData(env2, runId, options = {}) {
151427
151586
  if (fetchError) {
151428
151587
  setError(fetchError);
151429
151588
  } else {
151430
- const hydrated = result.data.map(hydrateResourceIO);
151431
- const key = encryptionKeyRef.current;
151432
- if (key) {
151433
- const decrypted = await Promise.all(
151434
- hydrated.map((ev) => hydrateResourceIOWithKey(ev, key))
151435
- );
151436
- setEvents(decrypted);
151437
- } else {
151438
- setEvents(hydrated);
151439
- }
151589
+ setEvents(await hydrateEvents(result.data));
151440
151590
  setCursor(result.hasMore ? result.cursor : void 0);
151441
151591
  setHasMore(Boolean(result.hasMore));
151442
151592
  }
@@ -151446,7 +151596,7 @@ function useEventsListData(env2, runId, options = {}) {
151446
151596
  setLoading(false);
151447
151597
  isFetchingRef.current = false;
151448
151598
  }
151449
- }, [env2, runId, sortOrder]);
151599
+ }, [env2, runId, sortOrder, hydrateEvents]);
151450
151600
  reactExports.useEffect(() => {
151451
151601
  if (enabled) fetchInitial();
151452
151602
  }, [fetchInitial, enabled]);
@@ -151477,16 +151627,8 @@ function useEventsListData(env2, runId, options = {}) {
151477
151627
  setError(fetchError);
151478
151628
  } else {
151479
151629
  if (result.data.length > 0) {
151480
- const hydrated = result.data.map(hydrateResourceIO);
151481
- const key = encryptionKeyRef.current;
151482
- if (key) {
151483
- const decrypted = await Promise.all(
151484
- hydrated.map((ev) => hydrateResourceIOWithKey(ev, key))
151485
- );
151486
- setEvents((prev) => [...prev, ...decrypted]);
151487
- } else {
151488
- setEvents((prev) => [...prev, ...hydrated]);
151489
- }
151630
+ const hydrated = await hydrateEvents(result.data);
151631
+ setEvents((prev) => [...prev, ...hydrated]);
151490
151632
  }
151491
151633
  setCursor(result.hasMore ? result.cursor : void 0);
151492
151634
  setHasMore(Boolean(result.hasMore));
@@ -151496,14 +151638,65 @@ function useEventsListData(env2, runId, options = {}) {
151496
151638
  } finally {
151497
151639
  setLoadingMore(false);
151498
151640
  }
151499
- }, [env2, runId, sortOrder, cursor, loadingMore]);
151641
+ }, [env2, runId, sortOrder, cursor, loadingMore, hydrateEvents]);
151642
+ const searchByExactId = reactExports.useCallback(
151643
+ async (id2, kind, signal) => {
151644
+ if (signal == null ? void 0 : signal.aborted) {
151645
+ throw new DOMException("Aborted", "AbortError");
151646
+ }
151647
+ if (kind === "event") {
151648
+ const { error: fetchError, result } = await unwrapServerActionResult(
151649
+ fetchEvent$1(env2, runId, id2, "none")
151650
+ );
151651
+ if (fetchError || (signal == null ? void 0 : signal.aborted)) {
151652
+ return fetchError ? { status: "error", message: fetchError.message } : (() => {
151653
+ throw new DOMException("Aborted", "AbortError");
151654
+ })();
151655
+ }
151656
+ const [event] = await hydrateEvents([result]);
151657
+ return (event == null ? void 0 : event.runId) === runId ? { status: "ok", events: [event] } : { status: "not_found" };
151658
+ }
151659
+ const matched = [];
151660
+ let nextCursor;
151661
+ let pagesFetched = 0;
151662
+ let truncated = false;
151663
+ do {
151664
+ if (signal == null ? void 0 : signal.aborted) {
151665
+ throw new DOMException("Aborted", "AbortError");
151666
+ }
151667
+ const { error: fetchError, result } = await unwrapServerActionResult(
151668
+ fetchEventsByCorrelationId$1(env2, id2, {
151669
+ cursor: nextCursor,
151670
+ sortOrder,
151671
+ limit: 100,
151672
+ withData: false
151673
+ })
151674
+ );
151675
+ if (fetchError) {
151676
+ return { status: "error", message: fetchError.message };
151677
+ }
151678
+ if (signal == null ? void 0 : signal.aborted) {
151679
+ throw new DOMException("Aborted", "AbortError");
151680
+ }
151681
+ pagesFetched += 1;
151682
+ const hydrated = await hydrateEvents(result.data);
151683
+ matched.push(...hydrated.filter((event) => event.runId === runId));
151684
+ const hitPageCap = pagesFetched >= MAX_CORRELATION_SEARCH_PAGES;
151685
+ truncated = truncated || hitPageCap && Boolean(result.hasMore && result.cursor);
151686
+ nextCursor = !hitPageCap && result.hasMore && result.cursor ? result.cursor : void 0;
151687
+ } while (nextCursor);
151688
+ return matched.length > 0 ? { status: "ok", events: matched, truncated: truncated || void 0 } : { status: "not_found" };
151689
+ },
151690
+ [env2, runId, sortOrder, hydrateEvents]
151691
+ );
151500
151692
  return {
151501
151693
  events: events2,
151502
151694
  loading,
151503
151695
  error: error2,
151504
151696
  hasMore,
151505
151697
  loadingMore,
151506
- loadMore
151698
+ loadMore,
151699
+ searchByExactId
151507
151700
  };
151508
151701
  }
151509
151702
  function LiveStatus({ hasError, errorMessage }) {
@@ -151651,7 +151844,8 @@ function RunDetailView({
151651
151844
  loading: eventsListLoading,
151652
151845
  hasMore: hasMoreEventsTab,
151653
151846
  loadingMore: loadingMoreEventsTab,
151654
- loadMore: loadMoreEventsTab
151847
+ loadMore: loadMoreEventsTab,
151848
+ searchByExactId
151655
151849
  } = useEventsListData(env2, runId, {
151656
151850
  sortOrder: eventsSortOrder,
151657
151851
  encryptionKey: encryptionKey ?? void 0,
@@ -151932,7 +152126,8 @@ function RunDetailView({
151932
152126
  onSortOrderChange: setEventsSortOrder,
151933
152127
  onDecrypt: handleDecrypt,
151934
152128
  isDecrypting,
151935
- hasEncryptedData
152129
+ hasEncryptedData,
152130
+ onExactIdSearch: searchByExactId
151936
152131
  }
151937
152132
  ) }) }) }),
151938
152133
  /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "streams", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary$1, { title: "Failed to load stream data", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex gap-4", children: [
@@ -152079,6 +152274,7 @@ const handlers = {
152079
152274
  fetchStep: (p2) => fetchStep(p2.worldEnv ?? {}, p2.runId, p2.stepId, p2.resolveData),
152080
152275
  fetchEvents: (p2) => fetchEvents(p2.worldEnv ?? {}, p2.runId, p2.params ?? {}),
152081
152276
  fetchEvent: (p2) => fetchEvent(p2.worldEnv ?? {}, p2.runId, p2.eventId, p2.resolveData),
152277
+ fetchEventsByCorrelationId: (p2) => fetchEventsByCorrelationId(p2.worldEnv ?? {}, p2.correlationId, p2.params ?? {}),
152082
152278
  fetchHooks: (p2) => fetchHooks(p2.worldEnv ?? {}, p2.params ?? {}),
152083
152279
  fetchHook: (p2) => fetchHook(p2.worldEnv ?? {}, p2.hookId, p2.resolveData),
152084
152280
  cancelRun: (p2) => cancelRun$1(p2.worldEnv ?? {}, p2.runId),
@@ -152226,7 +152422,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
152226
152422
  __proto__: null,
152227
152423
  loader
152228
152424
  }, Symbol.toStringTag, { value: "Module" }));
152229
- const serverManifest = { "entry": { "module": "/assets/entry.client-BWsSsWQm.js", "imports": ["/assets/index-DQa-BExo.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": true, "module": "/assets/root-Cr0bUIN7.js", "imports": ["/assets/index-DQa-BExo.js", "/assets/mermaid-3ZIDBTTL-BE1h5qUK.js"], "css": ["/assets/root-aMfmV5uh.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/home": { "id": "routes/home", "parentId": "root", "path": void 0, "index": true, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/home-CI2sZzZZ.js", "imports": ["/assets/index-DQa-BExo.js", "/assets/workflow-graph-viewer-fudq4EvS.js", "/assets/mermaid-3ZIDBTTL-BE1h5qUK.js"], "css": ["/assets/workflow-graph-viewer-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/run-detail": { "id": "routes/run-detail", "parentId": "root", "path": "run/:runId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/run-detail-gIcQ-2KJ.js", "imports": ["/assets/index-DQa-BExo.js", "/assets/workflow-graph-viewer-fudq4EvS.js", "/assets/mermaid-3ZIDBTTL-BE1h5qUK.js", "/assets/encryption-80GMP4r0.js"], "css": ["/assets/workflow-graph-viewer-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.rpc": { "id": "routes/api.rpc", "parentId": "root", "path": "api/rpc", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.rpc-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.stream.$streamId": { "id": "routes/api.stream.$streamId", "parentId": "root", "path": "api/stream/:streamId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.stream._streamId-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 } }, "url": "/assets/manifest-c3c3f64e.js", "version": "c3c3f64e", "sri": void 0 };
152425
+ const serverManifest = { "entry": { "module": "/assets/entry.client-BWsSsWQm.js", "imports": ["/assets/index-DQa-BExo.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": true, "module": "/assets/root-BzOKTpCh.js", "imports": ["/assets/index-DQa-BExo.js", "/assets/mermaid-3ZIDBTTL-Cr7OQX4b.js"], "css": ["/assets/root-aMfmV5uh.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/home": { "id": "routes/home", "parentId": "root", "path": void 0, "index": true, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/home-B9GhesEF.js", "imports": ["/assets/index-DQa-BExo.js", "/assets/workflow-graph-viewer-P4oMQJaV.js", "/assets/mermaid-3ZIDBTTL-Cr7OQX4b.js"], "css": ["/assets/workflow-graph-viewer-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/run-detail": { "id": "routes/run-detail", "parentId": "root", "path": "run/:runId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/run-detail-CRqjlzw9.js", "imports": ["/assets/index-DQa-BExo.js", "/assets/workflow-graph-viewer-P4oMQJaV.js", "/assets/mermaid-3ZIDBTTL-Cr7OQX4b.js", "/assets/encryption-80GMP4r0.js"], "css": ["/assets/workflow-graph-viewer-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.rpc": { "id": "routes/api.rpc", "parentId": "root", "path": "api/rpc", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.rpc-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.stream.$streamId": { "id": "routes/api.stream.$streamId", "parentId": "root", "path": "api/stream/:streamId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.stream._streamId-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 } }, "url": "/assets/manifest-830d5c7d.js", "version": "830d5c7d", "sri": void 0 };
152230
152426
  const assetsBuildDirectory = "build/client";
152231
152427
  const basename = "/";
152232
152428
  const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };