@feathery/react 2.54.1 → 2.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/assistant/AssistantChat.d.ts.map +1 -1
- package/cjs/assistant/AttachmentParts.d.ts +28 -0
- package/cjs/assistant/AttachmentParts.d.ts.map +1 -0
- package/cjs/assistant/ToolStatus.d.ts +3 -1
- package/cjs/assistant/ToolStatus.d.ts.map +1 -1
- package/cjs/assistant/attachmentIcon.d.ts +11 -0
- package/cjs/assistant/attachmentIcon.d.ts.map +1 -0
- package/cjs/assistant/attachments.d.ts +39 -0
- package/cjs/assistant/attachments.d.ts.map +1 -0
- package/cjs/assistant/icons.d.ts +2 -0
- package/cjs/assistant/icons.d.ts.map +1 -1
- package/cjs/assistant/useChatAttachments.d.ts +23 -0
- package/cjs/assistant/useChatAttachments.d.ts.map +1 -0
- package/cjs/{fthry_AssistantChat.DC9xTDBq.js → fthry_AssistantChat.Cwyk3iiA.js} +956 -79
- package/cjs/{fthry_FormControl.Bdf7uZbI.js → fthry_FormControl.DQFuYIrs.js} +1 -1
- package/cjs/{fthry_InlineTooltip.2VyC_zlO.js → fthry_InlineTooltip.C-3eLvAv.js} +1 -1
- package/cjs/{fthry_PaymentMethodField.DX_e5Cso.js → fthry_PaymentMethodField.Cs9nBB47.js} +3 -3
- package/cjs/{fthry_Placeholder.ChSA2IUD.js → fthry_Placeholder.CUmM_ix-.js} +1 -1
- package/cjs/{fthry_ShowEyeIcon.BygC4iZn.js → fthry_ShowEyeIcon.D6Lwhfy_.js} +1 -1
- package/cjs/{fthry_TabsElement.CtLQwrj7.js → fthry_TabsElement.CgL3YMbf.js} +1 -1
- package/cjs/{fthry_auto-track.CsRLwF_7.js → fthry_auto-track.DhDJ7Six.js} +2 -2
- package/cjs/{fthry_highlighted-body-TPN3WLV5.9jZwkvuV.js → fthry_highlighted-body-TPN3WLV5.BzjtpXVW.js} +3 -3
- package/cjs/{fthry_index.BIIaLCnQ.js → fthry_index.BBtmp2lX.js} +2 -2
- package/cjs/{fthry_index.ChNOkT2I.js → fthry_index.BF-anQOj.js} +29 -29
- package/cjs/{fthry_index.CzDrCb8q.js → fthry_index.BLh4y2dS.js} +1 -1
- package/cjs/{fthry_index.DHfH5dUT.js → fthry_index.Bgz8QD73.js} +1 -1
- package/cjs/{fthry_index.BCsydmxn.js → fthry_index.BiQgM_mp.js} +5 -5
- package/cjs/{fthry_index.BQ1PDK75.js → fthry_index.BiYemmOs.js} +7 -7
- package/cjs/{fthry_index.DzwK56rK.js → fthry_index.BkUZn1Wx.js} +2 -2
- package/cjs/{fthry_index.DAMJSPDY.js → fthry_index.C0qSps2I.js} +4 -4
- package/cjs/{fthry_index.-t8SJQod.js → fthry_index.C9hwfIUQ.js} +5 -5
- package/cjs/{fthry_index.CQjWjwkb.js → fthry_index.CD8G4Ned.js} +2 -2
- package/cjs/{fthry_index.DDFvIZR1.js → fthry_index.CGx_UCOl.js} +10 -10
- package/cjs/{fthry_index.CvWhzgMd.js → fthry_index.COUHEKea.js} +1 -1
- package/cjs/{fthry_index.CA0CmgZ4.js → fthry_index.CPrsbFNe.js} +1 -1
- package/cjs/{fthry_index.DmrFRKyN.js → fthry_index.CPx7ld_r.js} +1 -1
- package/cjs/{fthry_index.BSW1HMfh.js → fthry_index.CbTgNihl.js} +2 -2
- package/cjs/{fthry_index.D-RpAapg.js → fthry_index.CizURN5l.js} +5 -5
- package/cjs/{fthry_index.vE97mYTi.js → fthry_index.Cl8PTNLj.js} +5 -5
- package/cjs/{fthry_index.DYDegaGW.js → fthry_index.CusanmZ4.js} +1 -1
- package/cjs/{fthry_index.DUgslBs4.js → fthry_index.D--5x2--.js} +1 -1
- package/cjs/{fthry_index.BIMFZ8jD.js → fthry_index.D-JzzjZq.js} +1 -1
- package/cjs/{fthry_index.Bd4Ki2jq.js → fthry_index.D01OXK-l.js} +2 -2
- package/cjs/{fthry_index.CFV4pCZG.js → fthry_index.DPvMA8nx.js} +1 -1
- package/cjs/{fthry_index.g_KiTGIC.js → fthry_index.DYt_hVte.js} +4 -4
- package/cjs/{fthry_index.C9_33yc4.js → fthry_index.DZ7mRbvH.js} +4 -4
- package/cjs/{fthry_index.rLo-GP4e.js → fthry_index.DcLxtTSW.js} +2 -2
- package/cjs/{fthry_index.DVYmg2dL.js → fthry_index.DjoQ9rvl.js} +1 -1
- package/cjs/{fthry_index.DEwX9wLw.js → fthry_index.DxAMmenQ.js} +3 -3
- package/cjs/{fthry_index.Czq6v8vF.js → fthry_index.ZlEa6xRd.js} +2 -2
- package/cjs/{fthry_index.D2b6CFHh.js → fthry_index.fHBYZguT.js} +3 -3
- package/cjs/{fthry_index.DLcJ6-kL.js → fthry_index.hoemhTIo.js} +4 -4
- package/cjs/{fthry_index.CqeDMnGC.js → fthry_index.mHIYCN--.js} +3 -3
- package/cjs/{fthry_index.umd.oim0GOsP.js → fthry_index.umd.DcnVOTNd.js} +1 -1
- package/cjs/{fthry_index.NRIwQAZb.js → fthry_index.y6sfh246.js} +1 -1
- package/cjs/{fthry_input.CaVTEiAk.js → fthry_input.D_ZZBUiA.js} +1 -1
- package/cjs/{fthry_logging.BOawaGT3.js → fthry_logging.DnMqEtZk.js} +1 -1
- package/cjs/{fthry_mermaid-O7DHMXV3.BUbH9Bc_.js → fthry_mermaid-O7DHMXV3.D2BXxJ0r.js} +3 -3
- package/cjs/{fthry_script.CIquRYMv.js → fthry_script.CiEL5EkQ.js} +1 -1
- package/cjs/{fthry_styles.wtdZ0TVk.js → fthry_styles.BQvJdT7h.js} +1 -1
- package/cjs/{fthry_useElementSize.CoMSw1CX.js → fthry_useElementSize.DuwzR_F7.js} +1 -1
- package/cjs/{fthry_useSalesforceSync.DLst19Gd.js → fthry_useSalesforceSync.B6nQeLV2.js} +1 -1
- package/cjs/{fthry_webfontloader.Cc0PNQPM.js → fthry_webfontloader.DKvYHlYz.js} +1 -1
- package/cjs/index.js +1 -1
- package/cjs/thumbnail-renderer.js +1 -1
- package/dist/assistant/AssistantChat.d.ts.map +1 -1
- package/dist/assistant/AttachmentParts.d.ts +28 -0
- package/dist/assistant/AttachmentParts.d.ts.map +1 -0
- package/dist/assistant/ToolStatus.d.ts +3 -1
- package/dist/assistant/ToolStatus.d.ts.map +1 -1
- package/dist/assistant/attachmentIcon.d.ts +11 -0
- package/dist/assistant/attachmentIcon.d.ts.map +1 -0
- package/dist/assistant/attachments.d.ts +39 -0
- package/dist/assistant/attachments.d.ts.map +1 -0
- package/dist/assistant/icons.d.ts +2 -0
- package/dist/assistant/icons.d.ts.map +1 -1
- package/dist/assistant/useChatAttachments.d.ts +23 -0
- package/dist/assistant/useChatAttachments.d.ts.map +1 -0
- package/dist/{fthry_AssistantChat.CPE5WlOV.js → fthry_AssistantChat.Be6Mlyxj.js} +956 -79
- package/dist/{fthry_FormControl.C_9IBGCz.js → fthry_FormControl.CCkAPkgv.js} +1 -1
- package/dist/{fthry_InlineTooltip.X4qb_h52.js → fthry_InlineTooltip.DZD_oDzB.js} +1 -1
- package/dist/{fthry_PaymentMethodField.Co9wIIWl.js → fthry_PaymentMethodField.CtsyjvwX.js} +3 -3
- package/dist/{fthry_Placeholder.tXEd80yu.js → fthry_Placeholder.DuqjLBhG.js} +1 -1
- package/dist/{fthry_ShowEyeIcon.BL4SODVQ.js → fthry_ShowEyeIcon.Dl2TsElo.js} +1 -1
- package/dist/{fthry_TabsElement.CefoTVIr.js → fthry_TabsElement.CYi3mzi8.js} +1 -1
- package/dist/{fthry_auto-track.K-xWX3KP.js → fthry_auto-track.IfDBqGyL.js} +2 -2
- package/dist/{fthry_highlighted-body-TPN3WLV5.CqH7kZh1.js → fthry_highlighted-body-TPN3WLV5.HLcU1iPh.js} +3 -3
- package/dist/{fthry_index.8G4DCva4.js → fthry_index.4qpRAeb_.js} +1 -1
- package/dist/{fthry_index.DVKk9DNh.js → fthry_index.9S43igFs.js} +1 -1
- package/dist/{fthry_index.QmJ7llJy.js → fthry_index.B5JfgN_s.js} +1 -1
- package/dist/{fthry_index.D2uuo-Hp.js → fthry_index.B8hwXw5R.js} +7 -7
- package/dist/{fthry_index.CIUN5omC.js → fthry_index.BEMCjmqu.js} +29 -29
- package/dist/{fthry_index.eUA7gKd_.js → fthry_index.BN-dojiL.js} +2 -2
- package/dist/{fthry_index.CYa-BeVL.js → fthry_index.BOvYhhGJ.js} +4 -4
- package/dist/{fthry_index.Dt6tQ9YA.js → fthry_index.BP1lC3Ex.js} +1 -1
- package/dist/{fthry_index.B5gAQiuF.js → fthry_index.BbE2kPjj.js} +3 -3
- package/dist/{fthry_index.DXLRXJ4G.js → fthry_index.BvcpsGy9.js} +1 -1
- package/dist/{fthry_index.BRN8lHtb.js → fthry_index.C09MbTMD.js} +2 -2
- package/dist/{fthry_index.CGYJ3nnH.js → fthry_index.C0NfUYmR.js} +2 -2
- package/dist/{fthry_index.CC3ua88H.js → fthry_index.C2LGfmCQ.js} +2 -2
- package/dist/{fthry_index.B80HhVUt.js → fthry_index.C3o7HpC2.js} +4 -4
- package/dist/{fthry_index.CC8Uh5gL.js → fthry_index.C5AkH2wz.js} +1 -1
- package/dist/{fthry_index.-NrRAjJG.js → fthry_index.C5qllWuc.js} +1 -1
- package/dist/{fthry_index.D6GyUvFt.js → fthry_index.CK3aIPly.js} +5 -5
- package/dist/{fthry_index.vvzR2QO1.js → fthry_index.CaMfiw6o.js} +3 -3
- package/dist/{fthry_index.BS4E7I-K.js → fthry_index.CfnDnR43.js} +1 -1
- package/dist/{fthry_index.AnuSOreY.js → fthry_index.CtdDjHjk.js} +3 -3
- package/dist/{fthry_index.8HF4sRHu.js → fthry_index.D7q1aD6-.js} +4 -4
- package/dist/{fthry_index.zsPt4ANk.js → fthry_index.DDTSEIcr.js} +4 -4
- package/dist/{fthry_index.DfnBmlMN.js → fthry_index.DM3jqh2p.js} +10 -10
- package/dist/{fthry_index.CXo7Ei4g.js → fthry_index.DMH1cJrX.js} +2 -2
- package/dist/{fthry_index.B_lMLNyy.js → fthry_index.DP8hzsWg.js} +1 -1
- package/dist/{fthry_index.J4ksi0Sm.js → fthry_index.DYf0nmmc.js} +1 -1
- package/dist/{fthry_index.GTJWvsNs.js → fthry_index.Dk6aTBdA.js} +1 -1
- package/dist/{fthry_index.DsfyJrK_.js → fthry_index.DvUMGcjt.js} +2 -2
- package/dist/{fthry_index.B4fdBk_2.js → fthry_index.IYd_eVta.js} +5 -5
- package/dist/{fthry_index.DMwfwUer.js → fthry_index.Ob5rm80I.js} +5 -5
- package/dist/{fthry_index.C4ZsKex6.js → fthry_index.T0q4NPjx.js} +4 -4
- package/dist/{fthry_index.DqUkarFt.js → fthry_index.okrffQYp.js} +2 -2
- package/dist/{fthry_index.umd.DHsdRPRZ.js → fthry_index.umd.DNLZlzl6.js} +1 -1
- package/dist/{fthry_input.Ci7lyHy3.js → fthry_input.DBmpsGLP.js} +1 -1
- package/dist/{fthry_logging.DQALXb9A.js → fthry_logging.DXY4LvSS.js} +1 -1
- package/dist/fthry_mermaid-O7DHMXV3.C56szY3n.js +8 -0
- package/dist/{fthry_script.BDiZrpF8.js → fthry_script.C894YzAl.js} +1 -1
- package/dist/{fthry_styles.fEY_n086.js → fthry_styles.Ds16q-VH.js} +1 -1
- package/dist/{fthry_useElementSize.CEbFfmei.js → fthry_useElementSize.DAdDGR_p.js} +1 -1
- package/dist/{fthry_useSalesforceSync.BfAudVDV.js → fthry_useSalesforceSync.BGUfOU7k.js} +1 -1
- package/dist/{fthry_webfontloader.CCmkUKka.js → fthry_webfontloader.j-I3KznG.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/thumbnail-renderer.js +1 -1
- package/package.json +1 -1
- package/umd/AssistantChat.31154097f6b644e3a50b.js +1 -0
- package/umd/index.js +1 -1
- package/dist/fthry_mermaid-O7DHMXV3.D6DhpWPU.js +0 -8
- package/umd/AssistantChat.e42d65ae6bc7cfc4b909.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { b as jsxs, _ as __assign, j as jsx, d as iosScrollOnFocus, r as resetStyles } from './fthry_index.
|
|
1
|
+
import { b as jsxs, _ as __assign, j as jsx, d as iosScrollOnFocus, r as resetStyles } from './fthry_index.BEMCjmqu.js';
|
|
2
2
|
import { useRef, useMemo, useEffect } from 'react';
|
|
3
|
-
import { F as FormControl } from './fthry_FormControl.
|
|
4
|
-
import { applyCheckableInputStyles, composeCheckableInputStyle, applyHeightWidthMarginByFontSize } from './fthry_index.
|
|
5
|
-
import { I as InlineTooltip } from './fthry_InlineTooltip.
|
|
6
|
-
import { u as useSalesforceSync } from './fthry_useSalesforceSync.
|
|
3
|
+
import { F as FormControl } from './fthry_FormControl.CCkAPkgv.js';
|
|
4
|
+
import { applyCheckableInputStyles, composeCheckableInputStyle, applyHeightWidthMarginByFontSize } from './fthry_index.C5AkH2wz.js';
|
|
5
|
+
import { I as InlineTooltip } from './fthry_InlineTooltip.DZD_oDzB.js';
|
|
6
|
+
import { u as useSalesforceSync } from './fthry_useSalesforceSync.BGUfOU7k.js';
|
|
7
7
|
import 'react/jsx-runtime';
|
|
8
8
|
import 'jszip';
|
|
9
9
|
import 'react-dom';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { j as jsx, o as Global, l as css, m as __makeTemplateObject, _ as __assign, e as __read, z as isMobile, w as featheryWindow, B as featheryDoc, u as useBorder, b as jsxs$1, h as hoverStylesGuard, r as resetStyles, q as __rest, aT as formatDateString } from './fthry_index.
|
|
1
|
+
import { j as jsx, o as Global, l as css, m as __makeTemplateObject, _ as __assign, e as __read, z as isMobile, w as featheryWindow, B as featheryDoc, u as useBorder, b as jsxs$1, h as hoverStylesGuard, r as resetStyles, q as __rest, aT as formatDateString } from './fthry_index.BEMCjmqu.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { useMemo, useLayoutEffect, cloneElement, createRef, Component, useRef, useCallback, useEffect, createElement, memo, useState } from 'react';
|
|
4
|
-
import { P as Placeholder } from './fthry_Placeholder.
|
|
5
|
-
import { I as InlineTooltip } from './fthry_InlineTooltip.
|
|
4
|
+
import { P as Placeholder } from './fthry_Placeholder.DuqjLBhG.js';
|
|
5
|
+
import { I as InlineTooltip } from './fthry_InlineTooltip.DZD_oDzB.js';
|
|
6
6
|
import { c as clsx } from './fthry_clsx.ChV9xqsO.js';
|
|
7
7
|
import { jsxs, jsx as jsx$1 } from 'react/jsx-runtime';
|
|
8
8
|
import * as ReactDOM from 'react-dom';
|
|
9
9
|
import ReactDOM__default from 'react-dom';
|
|
10
|
-
import { a as IMask, I as IMaskInput } from './fthry_input.
|
|
10
|
+
import { a as IMask, I as IMaskInput } from './fthry_input.DBmpsGLP.js';
|
|
11
11
|
import 'jszip';
|
|
12
|
-
import './fthry_index.
|
|
12
|
+
import './fthry_index.DP8hzsWg.js';
|
|
13
13
|
|
|
14
14
|
var PORTAL_CONTAINER_CLASS = '.react-datepicker__portal';
|
|
15
15
|
var DATEPICKER_PADDING_TOP_VALUE = '--datepicker-pad-top';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { q as __rest, e as __read, k as countryData, Y as phoneLib, Z as authState, $ as firebaseSMSCountries, b as jsxs, j as jsx, _ as __assign, y as Fragment, K as DROPDOWN_Z_INDEX, u as useBorder, a0 as phoneLibPromise, h as hoverStylesGuard, O as Overlay, X as isNum, d as iosScrollOnFocus, r as resetStyles } from './fthry_index.
|
|
1
|
+
import { q as __rest, e as __read, k as countryData, Y as phoneLib, Z as authState, $ as firebaseSMSCountries, b as jsxs, j as jsx, _ as __assign, y as Fragment, K as DROPDOWN_Z_INDEX, u as useBorder, a0 as phoneLibPromise, h as hoverStylesGuard, O as Overlay, X as isNum, d as iosScrollOnFocus, r as resetStyles } from './fthry_index.BEMCjmqu.js';
|
|
2
2
|
import { forwardRef, useRef, useState, useEffect, useMemo, memo } from 'react';
|
|
3
|
-
import { P as Placeholder } from './fthry_Placeholder.
|
|
4
|
-
import { I as InlineTooltip } from './fthry_InlineTooltip.
|
|
5
|
-
import { u as useElementSize } from './fthry_useElementSize.
|
|
3
|
+
import { P as Placeholder } from './fthry_Placeholder.DuqjLBhG.js';
|
|
4
|
+
import { I as InlineTooltip } from './fthry_InlineTooltip.DZD_oDzB.js';
|
|
5
|
+
import { u as useElementSize } from './fthry_useElementSize.DAdDGR_p.js';
|
|
6
6
|
import 'react/jsx-runtime';
|
|
7
7
|
import 'jszip';
|
|
8
8
|
import 'react-dom';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as __awaiter, t as __generator } from './fthry_index.
|
|
1
|
+
import { s as __awaiter, t as __generator } from './fthry_index.BEMCjmqu.js';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'jszip';
|
|
@@ -11,7 +11,7 @@ function loadLegacyVideoPlugins(analytics) {
|
|
|
11
11
|
switch (_a.label) {
|
|
12
12
|
case 0: return [4 /*yield*/, import(
|
|
13
13
|
// @ts-expect-error
|
|
14
|
-
'./fthry_index.umd.
|
|
14
|
+
'./fthry_index.umd.DNLZlzl6.js').then(function (n) { return n.i; })
|
|
15
15
|
// This is super gross, but we need to support the `window.analytics.plugins` namespace
|
|
16
16
|
// that is linked in the segment docs in order to be backwards compatible with ajs-classic
|
|
17
17
|
// @ts-expect-error
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { u as Mermaid } from './fthry_AssistantChat.Be6Mlyxj.js';
|
|
2
|
+
import './fthry_index.BEMCjmqu.js';
|
|
3
|
+
import 'react/jsx-runtime';
|
|
4
|
+
import 'react';
|
|
5
|
+
import 'jszip';
|
|
6
|
+
import 'react-dom';
|
|
7
|
+
import './fthry_clsx.ChV9xqsO.js';
|
|
8
|
+
import './fthry_index.DYf0nmmc.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useState, useMemo } from 'react';
|
|
3
|
-
import { x as getDefaultExportFromCjs, b as jsxs, y as Fragment, j as jsx, o as Global, l as css, m as __makeTemplateObject } from './fthry_index.
|
|
3
|
+
import { x as getDefaultExportFromCjs, b as jsxs, y as Fragment, j as jsx, o as Global, l as css, m as __makeTemplateObject } from './fthry_index.BEMCjmqu.js';
|
|
4
4
|
import { flushSync } from 'react-dom';
|
|
5
5
|
|
|
6
6
|
function canUseDom() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as __read, s as __awaiter, t as __generator, v as FeatheryClient } from './fthry_index.
|
|
1
|
+
import { e as __read, s as __awaiter, t as __generator, v as FeatheryClient } from './fthry_index.BEMCjmqu.js';
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
3
|
|
|
4
4
|
function useSalesforceSync(salesforceSync, editMode) {
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a5 as AuthContext, a6 as getFieldValues, a7 as setFieldValues, a8 as updateTheme, a9 as updateUserId, aa as init, ab as Elements, ac as ReactForm, B as featheryDoc, ad as v4, _ as __assign, j as jsx, ae as LoginForm, af as JSForm, ag as getFormContext } from './fthry_index.
|
|
2
|
-
export { ai as AssistantChat, aj as StyledContainer, ah as resolveLabelStyle } from './fthry_index.
|
|
1
|
+
import { a5 as AuthContext, a6 as getFieldValues, a7 as setFieldValues, a8 as updateTheme, a9 as updateUserId, aa as init, ab as Elements, ac as ReactForm, B as featheryDoc, ad as v4, _ as __assign, j as jsx, ae as LoginForm, af as JSForm, ag as getFormContext } from './fthry_index.BEMCjmqu.js';
|
|
2
|
+
export { ai as AssistantChat, aj as StyledContainer, ah as resolveLabelStyle } from './fthry_index.BEMCjmqu.js';
|
|
3
3
|
import { createRoot } from 'react-dom/client';
|
|
4
4
|
import { useContext } from 'react';
|
|
5
5
|
import 'react/jsx-runtime';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as __assign, D as DEFAULT_MOBILE_BREAKPOINT, g as getVisiblePositions, c as calculateStepCSS, a as calculateGlobalCSS, j as jsx, G as Grid, F as FeatheryCacheProvider, f as fieldValues } from './fthry_index.
|
|
1
|
+
import { _ as __assign, D as DEFAULT_MOBILE_BREAKPOINT, g as getVisiblePositions, c as calculateStepCSS, a as calculateGlobalCSS, j as jsx, G as Grid, F as FeatheryCacheProvider, f as fieldValues } from './fthry_index.BEMCjmqu.js';
|
|
2
2
|
import { useRef, useMemo } from 'react';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import 'jszip';
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunkFeathery=this.webpackChunkFeathery||[]).push([[917],{85103:(e,t,n)=>{n.r(t),n.d(t,{default:()=>In});var r=n(35944),o=n(67294),i=n(91247),a=n(74790),l=n(74438),u=function(){return u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},u.apply(this,arguments)},c=function(e){return(0,r.tZ)("svg",u({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})}))},s=function(e){return(0,r.tZ)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"m6 9 6 6 6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},d=function(e){return(0,r.BX)("svg",u({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"m22 2-7 20-4-9-9-4 20-7z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m22 2-11 11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},p=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",style:{borderRadius:"50%"},viewBox:"0 0 50 50"},e,{children:[(0,r.tZ)("circle",{cx:25,cy:25,r:22.5,style:{fill:"none",stroke:"#f5cbcb",strokeWidth:3,opacity:1}}),(0,r.tZ)("circle",{cx:25,cy:25,r:22.5,style:{fill:"none",stroke:"#e2626e",strokeWidth:3,opacity:1,strokeLinecap:"round",transformOrigin:"50% 50%",transform:"rotate3d(0,0,1,0deg)",animation:"2156ms ease-in-out 0s infinite normal none running feathery-spinner-arc,1829ms linear 0s infinite normal none running feathery-spinner-rotate"}})]}))},f=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M18 6 6 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m6 6 12 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},h=function(e){return(0,r.tZ)("svg",u({width:"14",height:"14",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("polyline",{points:"20 6 9 17 4 12",stroke:"#10b981",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},v=function(e){return(0,r.tZ)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"m6 9 6 6 6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},y=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("rect",{x:"12",y:"12",width:"7",height:"7",rx:"1",stroke:"currentColor",strokeWidth:"2"})]}))},g=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("path",{d:"M9 3v18",stroke:"currentColor",strokeWidth:"2"})]}))},b=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("path",{d:"M15 3v18",stroke:"currentColor",strokeWidth:"2"})]}))},m=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M4 9V5a1 1 0 0 1 1-1h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M20 9V5a1 1 0 0 0-1-1h-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M4 15v4a1 1 0 0 0 1 1h4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M20 15v4a1 1 0 0 1-1 1h-4",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},x=function(e){return(0,r.tZ)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}))},w=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"m11 17-5-5 5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m18 17-5-5 5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},k=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"m6 17 5-5-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"m13 17 5-5-5-5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},S=function(e){return(0,r.BX)("svg",u({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},C=function(e){return(0,r.BX)("svg",u({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("rect",{x:"9",y:"3",width:"6",height:"12",rx:"3",stroke:"currentColor",strokeWidth:"2"}),(0,r.tZ)("path",{d:"M5 11a7 7 0 0 0 14 0",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,r.tZ)("path",{d:"M12 18v3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}))},A=function(e){return(0,r.BX)("svg",u({width:"18",height:"18",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M4 12v0",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,r.tZ)("path",{d:"M8 9v6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,r.tZ)("path",{d:"M12 5v14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,r.tZ)("path",{d:"M16 9v6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),(0,r.tZ)("path",{d:"M20 11v2",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}))},T=function(e){return(0,r.tZ)("svg",u({width:"18",height:"18",viewBox:"0 0 24 24",fill:"none"},e,{children:(0,r.tZ)("path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},I=function(e){return(0,r.BX)("svg",u({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none"},e,{children:[(0,r.tZ)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M14 2v6h6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}))},_=n(39479),Z=function(){return Z=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Z.apply(this,arguments)},R=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},j=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},E=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},O=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},L=1568,B=new Set(["image/png","image/jpeg","image/gif","image/webp"]),M=new Set(["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/rtf","text/rtf","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel.sheet.macroEnabled.12","application/vnd.ms-excel","text/csv"]),W=new Set(O(O([],E(B),!1),E(M),!1)),D=["image/png","image/jpeg","image/gif","image/webp","application/pdf",".pdf","application/msword",".doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document",".docx","application/rtf","text/rtf",".rtf","application/vnd.ms-powerpoint",".ppt","application/vnd.openxmlformats-officedocument.presentationml.presentation",".pptx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".xlsx","application/vnd.ms-excel.sheet.macroEnabled.12",".xlsm","application/vnd.ms-excel",".xls","text/csv",".csv"].join(","),F=function(e){return B.has(e)},P=function(e){return"ready"===e||"failed"===e||"skipped"===e},K=function(e){return new URL("/agent/attachment/",e).href},U=new WeakMap;function z(e,t,n,r,o){return R(this,void 0,void 0,(function(){var i,a,l,u,c;return j(this,(function(s){switch(s.label){case 0:return(i=new FormData).append("file",e),[4,fetch(K(t),{method:"POST",headers:Z(Z({},n()),{"X-Session-ID":r}),body:i,signal:o})];case 1:if((a=s.sent()).ok)return[3,6];l="Upload failed (".concat(a.status,")"),s.label=2;case 2:return s.trys.push([2,4,,5]),[4,a.json()];case 3:return(null==(u=s.sent())?void 0:u.error)&&(l=u.error),[3,5];case 4:return s.sent(),[3,5];case 5:throw(c=new Error(l)).status=a.status,c;case 6:return[2,a.json()]}}))}))}var X=function(e,t){return new Promise((function(n,r){if(t.aborted)r(new DOMException("Aborted","AbortError"));else{var o=function(){clearTimeout(i),r(new DOMException("Aborted","AbortError"))},i=setTimeout((function(){t.removeEventListener("abort",o),n()}),e);t.addEventListener("abort",o,{once:!0})}}))};function N(e,t,n,r,o){return R(this,void 0,void 0,(function(){var i,a,l,u,c;return j(this,(function(s){switch(s.label){case 0:i=encodeURIComponent(e),a=Date.now()+39e4,s.label=1;case 1:l=null,s.label=2;case 2:return s.trys.push([2,4,,5]),[4,fetch("".concat(K(t)).concat(i,"/url/"),{method:"GET",headers:Z(Z({},n()),{"X-Session-ID":r}),signal:o})];case 3:return l=s.sent(),[3,5];case 4:if(u=s.sent(),o.aborted)throw u;return[3,5];case 5:return(null==l?void 0:l.ok)?[4,l.json()]:[3,7];case 6:return c=s.sent(),P(c.processingStatus)?[2,c]:[3,8];case 7:if(l&&[401,403,404].includes(l.status))throw new Error("Attachment status check failed (".concat(l.status,")"));s.label=8;case 8:if(Date.now()>=a)throw new Error("Embedding timed out after ".concat(Math.round(390),"s"));return[4,X(2e3,o)];case 9:return s.sent(),[3,1];case 10:return[2]}}))}))}function V(e){var t,n,r;return Z({type:"file",mediaType:null!==(t=e.uploadedMediaType)&&void 0!==t?t:e.file.type,filename:null!==(n=e.uploadedFilename)&&void 0!==n?n:e.file.name,url:null!==(r=e.uploadedUrl)&&void 0!==r?r:e.previewUrl},e.id?{providerMetadata:{feathery:{attachmentId:e.id}}}:{})}var q="#6b7280",H="#f9fafb",G="#f3f4f6",Y="#e5e7eb",J="#9ca3af",$="#6b7280",Q="#1f2937",ee="#ef4444",te=function(e,t){var n=parseInt(e.replace("#",""),16),r=Math.min(255,Math.max(0,(n>>16)+Math.round(2.55*t))),o=Math.min(255,Math.max(0,(n>>8&255)+Math.round(2.55*t))),i=Math.min(255,Math.max(0,(255&n)+Math.round(2.55*t)));return"#".concat((r<<16|o<<8|i).toString(16).padStart(6,"0"))},ne=function(){return ne=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ne.apply(this,arguments)};function re(e){var t=e.label,n=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["label"]);return(0,r.BX)("svg",ne({viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},n,{children:[(0,r.tZ)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("path",{d:"M14 2v6h6",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.tZ)("text",ne({x:12,y:18,textAnchor:"middle",fontSize:6,fontWeight:700,fontFamily:"ui-sans-serif, system-ui, -apple-system, sans-serif",letterSpacing:-.2,fill:"currentColor",stroke:"none"},{children:t}))]}))}var oe=function(e){return(0,r.tZ)(re,ne({label:"PDF"},e))},ie=function(e){return(0,r.tZ)(re,ne({label:"DOC"},e))},ae=function(e){return(0,r.tZ)(re,ne({label:"XLS"},e))},le=function(e){return(0,r.tZ)(re,ne({label:"PPT"},e))},ue=function(e){return(0,r.tZ)(re,ne({label:"CSV"},e))},ce=function(){return ce=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ce.apply(this,arguments)},se=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},de="5.4.296",pe="https://cdn.jsdelivr.net/npm/pdfjs-dist@".concat(de,"/build/pdf.min.mjs"),fe="https://cdn.jsdelivr.net/npm/pdfjs-dist@".concat(de,"/build/pdf.worker.min.mjs"),he=new Function("url","return import(url)"),ve=null,ye=function(e){var t=e.mediaType,n=e.filename,o=e.size,i=void 0===o?24:o,a=function(e){var t,n,r,o,i=null!==(t=e.type)&&void 0!==t?t:"",a=null!==(o=null===(r=null===(n=e.name)||void 0===n?void 0:n.split(".").pop())||void 0===r?void 0:r.toLowerCase())&&void 0!==o?o:"";return"application/pdf"===i||"pdf"===a?{Icon:oe,color:"#fb7185"}:"application/msword"===i||"application/vnd.openxmlformats-officedocument.wordprocessingml.document"===i||"application/rtf"===i||"text/rtf"===i||"doc"===a||"docx"===a||"rtf"===a?{Icon:ie,color:"#38bdf8"}:"application/vnd.ms-excel"===i||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"===i||"application/vnd.ms-excel.sheet.macroEnabled.12"===i||"xls"===a||"xlsx"===a||"xlsm"===a?{Icon:ae,color:"#34d399"}:"application/vnd.ms-powerpoint"===i||"application/vnd.openxmlformats-officedocument.presentationml.presentation"===i||"ppt"===a||"pptx"===a?{Icon:le,color:"#fb923c"}:"text/csv"===i||"csv"===a?{Icon:ue,color:"#2dd4bf"}:null}({type:t,name:n});if(!a)return(0,r.tZ)(I,{css:{width:i,height:i,color:J}});var l=a.Icon,u=a.color;return(0,r.tZ)(l,{css:{width:i,height:i,color:u,flexShrink:0}})},ge=(0,o.memo)((function(e){var t=this,n=e.url,i=e.width,a=void 0===i?140:i,l=e.glyph,u=(0,o.useRef)(null),c=se((0,o.useState)("loading"),2),s=c[0],d=c[1];(0,o.useEffect)((function(){var e,r,o,i,l=!1;return e=t,r=void 0,i=function(){var e,t,r,o,i,c;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(s){switch(s.label){case 0:return[4,(ve||(ve=he(pe).then((function(e){return e.GlobalWorkerOptions.workerSrc=fe,e})).catch((function(e){return console.warn("[feathery] pdf.js failed to load from CDN",e),ve=null,null}))),ve)];case 1:if(e=s.sent(),l)return[2];if(!e)return d("error"),[2];s.label=2;case 2:return s.trys.push([2,6,,7]),[4,e.getDocument({url:n}).promise];case 3:return[4,s.sent().getPage(1)];case 4:return t=s.sent(),r=t.getViewport({scale:1}),o=t.getViewport({scale:a/r.width}),!(i=u.current)||l?[2]:(i.width=o.width,i.height=o.height,[4,t.render({canvasContext:i.getContext("2d"),viewport:o}).promise]);case 5:return s.sent(),l||d("ready"),[3,7];case 6:return c=s.sent(),console.warn("[feathery] PDF preview failed to load",{url:n,err:c}),l||d("error"),[3,7];case 7:return[2]}}))},new((o=void 0)||(o=Promise))((function(t,n){function a(e){try{u(i.next(e))}catch(e){n(e)}}function l(e){try{u(i.throw(e))}catch(e){n(e)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(e){e(n)}))).then(a,l)}u((i=i.apply(e,r||[])).next())})),function(){l=!0}}),[n,a]);var p=Math.round(.8*a),f="ready"===s;return(0,r.BX)("div",ce({css:ce({width:"".concat(a,"px"),height:"".concat(p,"px"),overflow:"hidden",borderRadius:"8px",border:"1px solid ".concat(Y),backgroundColor:f?"white":G},f?{}:{display:"flex",alignItems:"center",justifyContent:"center",color:J})},{children:[!f&&(void 0===l?(0,r.tZ)(I,{}):l),(0,r.tZ)("canvas",{ref:u,css:{display:f?"block":"none",maxWidth:"100%"}})]}))})),be=function(e){var t,n,o=e.attachment,i=e.onRemove,a=null!==(t=o.uploadedMediaType)&&void 0!==t?t:o.file.type,l=null!==(n=o.uploadedFilename)&&void 0!==n?n:o.file.name,u="failed"===o.processingStatus;return(0,r.BX)("div",ce({css:{position:"relative",display:"flex",alignItems:"center",gap:"6px",padding:"4px 6px",border:"1px solid ".concat(u?"#fca5a5":Y),borderRadius:"8px",backgroundColor:"white",maxWidth:"160px",flexShrink:0}},{children:[F(a)?(0,r.tZ)("img",{src:o.previewUrl,alt:l,css:{width:"28px",height:"28px",objectFit:"cover",borderRadius:"4px",flexShrink:0}}):(0,r.tZ)(ye,{mediaType:a,filename:l,size:24}),(0,r.BX)("div",ce({css:{minWidth:0}},{children:[(0,r.tZ)("div",ce({css:{fontSize:"11px",color:Q,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:l})),u&&(0,r.tZ)("div",ce({css:{fontSize:"10px",color:"#dc2626"}},{children:"Index failed"}))]})),(0,r.tZ)("button",ce({type:"button",onClick:i,"aria-label":"Remove attachment",css:{position:"absolute",top:"-6px",right:"-6px",width:"16px",height:"16px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"1px solid ".concat(Y),backgroundColor:"white",color:Q,cursor:"pointer",padding:0,"& svg":{width:"10px",height:"10px"}}},{children:(0,r.tZ)(f,{})}))]}))},me=function(e){var t=e.mediaType,n=e.filename,i=e.url,a=e.onOpen,l=e.inFlight,u=void 0!==l&&l,c=se((0,o.useState)(!1),2),s=c[0],d=c[1],f=F(t)?s?(0,r.tZ)("div",ce({css:{width:"140px",height:"112px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px",border:"1px solid ".concat(Y),backgroundColor:G,color:J}},{children:(0,r.tZ)(I,{})})):(0,r.tZ)("img",{src:i,alt:null!=n?n:"attachment",onError:function(){return d(!0)},css:{maxWidth:"140px",maxHeight:"112px",borderRadius:"8px",objectFit:"cover",display:"block"}}):(0,r.tZ)(ge,{url:i,width:140,glyph:u?null:(0,r.tZ)(ye,{mediaType:t,filename:n,size:28})});return(0,r.BX)("div",ce({onClick:u?void 0:a,title:n,css:{position:"relative",cursor:u?"default":"pointer"}},{children:[(0,r.tZ)("div",ce({css:{opacity:u?.6:1}},{children:f})),u&&(0,r.tZ)("div",ce({css:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"}},{children:(0,r.tZ)(p,{})}))]}))},xe=function(e){var t,n,i=e.preview,a=e.onClose;return(0,o.useEffect)((function(){var e=function(e){"Escape"===e.key&&a()};return(0,_.me)().addEventListener("keydown",e),function(){return(0,_.me)().removeEventListener("keydown",e)}}),[a]),(0,r.BX)("div",ce({onClick:a,css:{position:"fixed",inset:0,zIndex:1002,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.6)"}},{children:["application/pdf"===i.mediaType?(0,r.tZ)("iframe",{src:i.url,title:null!==(t=i.filename)&&void 0!==t?t:"PDF preview",onClick:function(e){return e.stopPropagation()},css:{height:"85vh",width:"85vw",maxWidth:"1000px",borderRadius:"8px",border:"none",backgroundColor:"white"}}):(0,r.tZ)("img",{src:i.url,alt:null!==(n=i.filename)&&void 0!==n?n:"Image preview",onClick:function(e){return e.stopPropagation()},onError:a,css:{maxHeight:"85vh",maxWidth:"85vw",borderRadius:"8px",objectFit:"contain"}}),i.filename&&(0,r.tZ)("span",ce({css:{marginTop:"12px",maxWidth:"85vw",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:"9999px",backgroundColor:"white",padding:"4px 12px",fontSize:"13px",color:Q}},{children:i.filename}))]}))},we=function(){return we=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},we.apply(this,arguments)},ke=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},Se=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},Ce=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},Ae=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))};var Te=function(){function e(e){void 0===e&&(e={}),this.building=[],this.queue=[],this.playIndex=0,this.ended=!1,this.playing=!1,this.audio=null,this.objectUrl=null,this.rafId=null,this.opts=e}return Object.defineProperty(e.prototype,"isPlaying",{get:function(){return this.playing},enumerable:!1,configurable:!0}),e.prototype.pushChunk=function(e){this.building.push(function(e){for(var t=(0,_.Kv)().atob(e),n=new Uint8Array(t.length),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}(e))},e.prototype.pushSegment=function(e){this.queue.push({text:e,bytes:this.building}),this.building=[],this.playing=!0,this.playNext()},e.prototype.end=function(){this.ended=!0,this.playNext()},e.prototype.skip=function(){this.teardown()},e.prototype.playNext=function(){var e,t,n,r,o=this;if(!this.audio){var i=this.queue[this.playIndex];if(i){if(0===i.bytes.length)return null===(r=(n=this.opts).onSegmentEnd)||void 0===r||r.call(n,i.text),this.playIndex+=1,void this.playNext();var a=URL.createObjectURL(new Blob(i.bytes,{type:"audio/mpeg"})),l=new Audio(a);this.audio=l,this.objectUrl=a,l.onplaying=function(){var e,t;o.audio===l&&(null===(t=(e=o.opts).onSegmentStart)||void 0===t||t.call(e,i.text),o.startReveal(l,i.text))},l.onended=function(){return o.finishClip(l,i.text)},l.onerror=function(){return o.finishClip(l,i.text)},l.play().catch((function(){return o.finishClip(l,i.text)}))}else this.ended&&this.playing&&(this.playing=!1,null===(t=(e=this.opts).onIdle)||void 0===t||t.call(e))}},e.prototype.startReveal=function(e,t){var n=this,r=(0,_.Kv)(),o=function(){var i,a;if(n.audio===e){var l=e.duration,u=l&&isFinite(l)&&l>0?Math.min(1,e.currentTime/l*1.5):0;null===(a=(i=n.opts).onSegmentProgress)||void 0===a||a.call(i,t,u),n.rafId=r.requestAnimationFrame(o)}else n.rafId=null};this.rafId=r.requestAnimationFrame(o)},e.prototype.stopReveal=function(){null!==this.rafId&&((0,_.Kv)().cancelAnimationFrame(this.rafId),this.rafId=null)},e.prototype.finishClip=function(e,t){var n,r;this.audio===e&&(this.stopReveal(),null===(r=(n=this.opts).onSegmentEnd)||void 0===r||r.call(n,t),e.pause(),e.src="",this.audio=null,this.objectUrl&&(URL.revokeObjectURL(this.objectUrl),this.objectUrl=null),this.playIndex+=1,this.playNext())},e.prototype.teardown=function(){var e,t;this.stopReveal(),this.audio&&(this.audio.pause(),this.audio.src="",this.audio=null),this.objectUrl&&(URL.revokeObjectURL(this.objectUrl),this.objectUrl=null),this.building=[],this.queue=[],this.playIndex=0,this.ended=!1,this.playing=!1,null===(t=(e=this.opts).onIdle)||void 0===t||t.call(e)},e}(),Ie=function(){function e(e){this.vad=null,this.paused=!1,this.opts=e}return e.prototype.start=function(){return e=this,t=void 0,o=function(){var e,t,r,o,i=this;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(a){switch(a.label){case 0:return a.trys.push([0,4,,5]),[4,Promise.all([n.e(762),n.e(129)]).then(n.bind(n,39762))];case 1:return e=a.sent(),t=e.MicVAD,r=e.utils,[4,n.e(968).then(n.bind(n,66968))];case 2:return a.sent().log.debug=function(){},o=this,[4,t.new({baseAssetPath:"https://cdn.jsdelivr.net/npm/@ricky0123/vad-web@0.0.30/dist/",onnxWASMBasePath:"https://cdn.jsdelivr.net/npm/onnxruntime-web@1.27.0/dist/",getStream:function(){return(0,_.Kv)().navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})},onSpeechStart:function(){i.paused||i.opts.onSpeechStart()},onSpeechEnd:function(e){if(!(i.paused||e.length<6400)){var t=new Blob([r.encodeWAV(e)],{type:"audio/wav"});i.opts.onUtterance(t)}}})];case 3:return o.vad=a.sent(),this.vad.start(),[2,!0];case 4:return a.sent(),this.vad=null,[2,!1];case 5:return[2]}}))},new((r=void 0)||(r=Promise))((function(n,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function l(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,l)}u((o=o.apply(e,t||[])).next())}));var e,t,r,o},e.prototype.pause=function(){var e;this.paused=!0,null===(e=this.vad)||void 0===e||e.pause()},e.prototype.resume=function(){var e;this.paused=!1,null===(e=this.vad)||void 0===e||e.start()},e.prototype.destroy=function(){var e;null===(e=this.vad)||void 0===e||e.destroy(),this.vad=null},e}();function _e(){var e;try{var t=null===(e=(0,_.Kv)().navigator)||void 0===e?void 0:e.mediaDevices;return!!t&&"function"==typeof t.getUserMedia}catch(e){return!1}}var Ze=function(){return Ze=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ze.apply(this,arguments)},Re=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},je=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},Ee=function(e){return e.replace(/\s/g,"").length},Oe=function(){return Oe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Oe.apply(this,arguments)},Le=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},Be=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},Me={searchWeb:{running:"Searching the web...",done:"Searched the web"},scrapeUrl:{running:"Reading web page...",done:"Read the web page"},searchDocuments:{running:"Searching documents...",done:"Searched the documents"},setFieldValue:{running:"Updating form fields...",done:"Updated form fields"},clickElement:{running:"Running form action...",done:"Ran the form action"},navigateToStep:{running:"Moving to another page...",done:"Moved to another page"},addTableRow:{running:"Adding a row...",done:"Added a row"},deleteTableRow:{running:"Deleting a row...",done:"Deleted a row"},setTableCellValue:{running:"Updating table cells...",done:"Updated table cells"},triggerTableAction:{running:"Running table action...",done:"Ran the table action"},queryAttachmentSemantic:{running:"Reading attachments...",done:"Read the attachments"},getPanelSnapshot:{running:"Reading the form...",done:"Reviewed the form"},getExtractionSnapshot:{running:"Reading extraction setup...",done:"Reviewed the extraction setup"},getExtractionResults:{running:"Reading extraction results...",done:"Reviewed the extraction results"},getLogicRules:{running:"Reading form logic...",done:"Reviewed form logic"},getHubSchema:{running:"Reading record setup...",done:"Reviewed the record setup"},queryHub:{running:"Searching records on file...",done:"Searched the records on file"},querySubmissions:{running:"Searching submissions...",done:"Searched submissions"}},We=function(e){try{var t=new URL(e);return t.hostname+("/"!==t.pathname?t.pathname:"")}catch(t){return e}},De=function(e){if(!e||"object"!=typeof e)return[];var t=e,n=[],r=function(e){return e.map((function(e){return"object"==typeof e&&null!==e&&e.url||""})).filter(Boolean)};return Array.isArray(t.web)&&n.push.apply(n,Be([],Le(r(t.web)),!1)),Array.isArray(t.news)&&n.push.apply(n,Be([],Le(r(t.news)),!1)),Array.isArray(t.images)&&n.push.apply(n,Be([],Le(r(t.images)),!1)),"string"==typeof t.url&&t.url&&n.push(t.url),n.length>0?Array.from(new Set(n)):Array.isArray(e)?Array.from(new Set(r(e))):[]},Fe=function(e){return"input-streaming"===e||"input-available"===e},Pe=function(e){return"output-error"===e.state||"object"==typeof e.output&&null!==e.output&&!1===e.output.ok},Ke=function(e){var t,n=e.row,o=e.linkColor,i=e.indent,a=void 0===i?24:i,l=null===(t=n.input)||void 0===t?void 0:t.query,u=De(n.output);return l||u.length>0?(0,r.BX)("div",Oe({css:{display:"flex",flexDirection:"column",gap:"4px",paddingLeft:"".concat(a,"px"),marginTop:"2px",marginBottom:"4px"}},{children:[l&&(0,r.BX)("div",Oe({css:{color:J,fontSize:"12px",fontStyle:"italic"}},{children:['"',l.length>80?l.substring(0,80)+"...":l,'"']})),u.map((function(e,t){return(0,r.BX)("a",Oe({href:e,target:"_blank",rel:"noopener noreferrer",css:{fontSize:"12px",color:o,textDecoration:"none",display:"flex",alignItems:"center",gap:"4px",minWidth:0,":hover":{textDecoration:"underline"}}},{children:[(0,r.tZ)(S,{css:{flexShrink:0}}),(0,r.tZ)("span",Oe({css:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:We(e)}))]}),t)}))]})):null},Ue=function(e){var t;return!!(null===(t=e.input)||void 0===t?void 0:t.query)||De(e.output).length>0},ze=function(e){var t,n,r=Me[e.toolName]||{running:"Working...",done:"Done"};return Fe(e.state)?r.running:Pe(e)?null!==(t=r.done)&&void 0!==t?t:"Failed":null!==(n=r.done)&&void 0!==n?n:r.running},Xe={backgroundImage:"linear-gradient(90deg, ".concat($," 25%, #d1d5db 50%, ").concat($," 75%)"),backgroundSize:"220% 100%",backgroundClip:"text",WebkitBackgroundClip:"text",color:"transparent",animation:"feathery-tool-shimmer 1.6s linear infinite","@keyframes feathery-tool-shimmer":{from:{backgroundPosition:"160% 0"},to:{backgroundPosition:"-60% 0"}}},Ne=function(e){var t=e.rows,n=e.followedByText,i=e.turnFinished,a=e.audioPending,l=void 0!==a&&a,u=e.linkColor,c=void 0===u?q:u,d=e.isFirstChunk,p=void 0!==d&&d,h=t.some((function(e){return Fe(e.state)})),v=!h&&!l&&(n||i),y=!(!h&&!l&&n),g=Le((0,o.useState)(null),2),b=g[0],m=g[1],x=null!=b?b:y,w=function(){return m(!x)},k=Oe({display:"flex",flexDirection:"column",gap:"2px",fontSize:"13px",minWidth:0,paddingLeft:"".concat(14,"px")},p?{}:{animation:"feathery-chunk-fade-in 220ms ease-out both","@keyframes feathery-chunk-fade-in":{from:{opacity:0,transform:"translateY(4px)"},to:{opacity:1,transform:"translateY(0)"}}}),S=t.filter((function(e){return e.toolName in Me}));if(v&&1===S.length){var C=S[0],A=Pe(C),T=Ue(C);return(0,r.BX)("div",Oe({css:k},{children:[(0,r.BX)("button",Oe({type:"button",onClick:T?w:void 0,css:{display:"inline-flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"4px 0",cursor:T?"pointer":"default",color:$,textAlign:"left",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[A&&(0,r.tZ)(f,{css:{width:"12px",height:"12px",color:ee}}),(0,r.tZ)("span",{children:ze(C)}),T&&(0,r.tZ)(s,{css:{width:"12px",height:"12px",color:J,transform:x?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),T&&x&&(0,r.tZ)(Ke,{row:C,linkColor:c,indent:6})]}))}var I=v?"Finished working":"Working on it...",_=S.length>0;return(0,r.BX)("div",Oe({css:k},{children:[(0,r.BX)("button",Oe({type:"button",onClick:_?w:void 0,css:{display:"inline-flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"4px 0",cursor:_?"pointer":"default",color:$,textAlign:"left",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[(0,r.tZ)("span",Oe({css:v?void 0:Xe},{children:I})),_&&(0,r.tZ)(s,{css:{width:"12px",height:"12px",color:J,transform:x?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),_&&x&&(0,r.tZ)("div",Oe({css:{display:"flex",flexDirection:"column",gap:"2px",marginLeft:"5px",paddingLeft:"13px",borderLeft:"2px solid ".concat(Y)}},{children:S.map((function(e){return(0,r.tZ)(Ve,{row:e,linkColor:c},e.key)}))}))]}))},Ve=function(e){var t=e.row,n=e.linkColor,i=Ue(t),a=Fe(t.state),l=Pe(t),u=Le((0,o.useState)(null),2),c=u[0],d=u[1],v=null!=c?c:a,y=i?"button":"div";return(0,r.BX)("div",Oe({css:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[(0,r.BX)(y,Oe({type:i?"button":void 0,onClick:i?function(){return d(!v)}:void 0,css:{display:"inline-flex",alignItems:"center",gap:"6px",color:l?ee:$,background:"none",border:"none",padding:"2px 0",textAlign:"left",cursor:i?"pointer":"default",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[a?(0,r.tZ)(p,{css:{width:"12px",height:"12px"}}):l?(0,r.tZ)(f,{css:{width:"12px",height:"12px"}}):(0,r.tZ)(h,{css:{width:"12px",height:"12px"}}),(0,r.tZ)("span",Oe({css:a?Xe:void 0},{children:ze(t)})),i&&(0,r.tZ)(s,{css:{width:"10px",height:"10px",color:J,transform:v?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),i&&v&&(0,r.tZ)(Ke,{row:t,linkColor:n})]}))},qe=function(e){var t=e.label,n=void 0===t?"Working on it...":t;return(0,r.tZ)("div",Oe({css:{display:"flex",flexDirection:"column",gap:"2px",fontSize:"13px",minWidth:0,paddingLeft:"14px",animation:"feathery-chunk-fade-in 220ms ease-out both","@keyframes feathery-chunk-fade-in":{from:{opacity:0,transform:"translateY(4px)"},to:{opacity:1,transform:"translateY(0)"}}}},{children:(0,r.tZ)("div",Oe({css:{padding:"4px 0",color:$,fontSize:"13px",alignSelf:"flex-start"}},{children:(0,r.tZ)("span",Oe({css:Xe},{children:n}))}))}))},He=n(70917),Ge=n(14123),Ye=function(){return Ye=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ye.apply(this,arguments)},Je=(0,He.iv)({color:"#2563eb",fontWeight:400,textDecoration:"underline",textUnderlineOffset:"0.12em",textDecorationSkipInk:"auto",overflowWrap:"break-word","&:visited":{color:"#6d28d9"},"&:hover":{color:"#1d4ed8"}}),$e=(0,He.iv)('\n & p,\n & [data-streamdown="ordered-list"],\n & [data-streamdown="unordered-list"],\n & [data-streamdown="blockquote"],\n & [data-streamdown="code-block"],\n & [data-streamdown^="heading-"],\n & [data-streamdown="horizontal-rule"] {\n margin-top: 0 !important;\n margin-bottom: 0.6em !important;\n }\n & > *:last-child,\n & p:last-child,\n & [data-streamdown="ordered-list"]:last-child,\n & [data-streamdown="unordered-list"]:last-child,\n & [data-streamdown="blockquote"]:last-child,\n & [data-streamdown="code-block"]:last-child,\n & [data-streamdown^="heading-"]:last-child {\n margin-bottom: 0 !important;\n }\n\n & [data-streamdown="strong"],\n & strong,\n & b {\n font-weight: 600 !important;\n }\n & em,\n & i {\n font-style: italic !important;\n }\n\n & [data-streamdown="heading-1"] {\n font-size: 1.25em !important;\n font-weight: 600 !important;\n }\n & [data-streamdown="heading-2"] {\n font-size: 1.15em !important;\n font-weight: 600 !important;\n }\n & [data-streamdown="heading-3"] {\n font-size: 1.05em !important;\n font-weight: 600 !important;\n }\n & [data-streamdown="heading-4"],\n & [data-streamdown="heading-5"],\n & [data-streamdown="heading-6"] {\n font-size: 1em !important;\n font-weight: 600 !important;\n }\n\n & [data-streamdown="ordered-list"],\n & [data-streamdown="unordered-list"] {\n padding-left: 1.25em !important;\n }\n & [data-streamdown="ordered-list"] {\n list-style: decimal !important;\n }\n & [data-streamdown="unordered-list"] {\n list-style: disc !important;\n }\n & [data-streamdown="list-item"] {\n margin-bottom: 0.2em !important;\n }\n & [data-streamdown="list-item"]:last-child {\n margin-bottom: 0 !important;\n }\n\n & [data-streamdown="inline-code"] {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;\n font-size: 0.9em !important;\n padding: 0.1em 0.3em !important;\n border-radius: 4px !important;\n background-color: rgba(0, 0, 0, 0.06) !important;\n }\n & [data-streamdown="code-block"] {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;\n font-size: 0.9em !important;\n padding: 0.5em 0.75em !important;\n border-radius: 6px !important;\n background-color: rgba(0, 0, 0, 0.06) !important;\n overflow-x: auto !important;\n }\n\n & [data-streamdown="blockquote"] {\n padding-left: 0.75em !important;\n border-left: 3px solid rgba(0, 0, 0, 0.15) !important;\n color: rgba(0, 0, 0, 0.75) !important;\n }\n\n & [data-streamdown="horizontal-rule"] {\n border: 0 !important;\n border-top: 1px solid rgba(0, 0, 0, 0.12) !important;\n margin: 0.6em 0 !important;\n }\n'),Qe={a:function(e){var t=e.href,n=e.children;return(0,r.tZ)("a",Ye({href:t,target:"_blank",rel:"noopener noreferrer",css:Je},{children:n}))}},et=(0,o.memo)((function(e){var t=e.text,n=e.isStreaming,o=void 0!==n&&n;return(0,r.tZ)("div",Ye({css:$e},{children:(0,r.tZ)(Ge.qI,Ye({components:Qe,isAnimating:o,parseIncompleteMarkdown:o},{children:t}))}))}));et.displayName="MarkdownText";const tt=et;var nt=function(){return nt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},nt.apply(this,arguments)},rt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},ot=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},it=function(e){return new URL("/agent/threads/",e).href},at=function(e,t){return rt(void 0,void 0,void 0,(function(){var n;return ot(this,(function(r){switch(r.label){case 0:return[4,fetch(it(e),{headers:t()})];case 1:return(n=r.sent()).ok?[2,n.json()]:[2,null]}}))}))},lt=function(e,t,n){return rt(void 0,void 0,void 0,(function(){var r;return ot(this,(function(o){switch(o.label){case 0:return[4,fetch("".concat(it(e)).concat(n,"/"),{headers:t()})];case 1:return(r=o.sent()).ok?[2,r.json()]:[2,null]}}))}))},ut=function(e,t,n){return rt(void 0,void 0,void 0,(function(){return ot(this,(function(r){switch(r.label){case 0:return[4,fetch("".concat(it(e)).concat(n,"/"),{method:"DELETE",headers:t()})];case 1:return r.sent(),[2]}}))}))},ct=n(95710),st=n(14428),dt=n(54665),pt=n(93861),ft=n(18837),ht=n(7193),vt=n(67948),yt=n(85340),gt=n(19455),bt=n(77925),mt=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},xt=function(e){var t,n;return null!==(t=e.latestStepName)&&void 0!==t?t:null===(n=e.currentStep)||void 0===n?void 0:n.key},wt=function(e){var t,n,r,o,i={},a=null!==(r=null==e?void 0:e.inlineErrors)&&void 0!==r?r:{};try{for(var l=mt(Object.keys(a)),u=l.next();!u.done;u=l.next()){var c=u.value,s=null===(o=a[c])||void 0===o?void 0:o.message;"string"==typeof s&&s.length>0&&(i[c]=s)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return i},kt=function(e,t){var n,r;if(!Array.isArray(e)||!Array.isArray(t)||0===t.length)return[];var o=[];try{for(var i=mt(e),a=i.next();!a.done;a=i.next()){var l=a.value,u=Array.isArray(null==l?void 0:l.position)?l.position:[];if(!(u.length>=t.length)){for(var c=!0,s=0;s<u.length;s++)if(u[s]!==t[s]){c=!1;break}c&&o.push(l)}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return o.sort((function(e,t){return t.position.length-e.position.length})),o};function St(e,t,n,r){if(!t)return"number"==typeof e?{errorType:"repeated_index_unexpected",error:"'".concat(r,"' is not in a repeated container; do not pass repeatIndex.")}:null;if("number"!=typeof e){var o=0===n?"(none yet - add a row first)":"0..".concat(n-1);return{errorType:"repeated_index_missing",error:"'".concat(r,"' is in a repeated container; pass repeatIndex ").concat(o,".")}}return e<0||e>=n?{errorType:"repeated_index_out_of_range",error:"repeatIndex ".concat(e," is out of range for '").concat(r,"' (rowCount ").concat(n,").")}:null}var Ct=function(e,t){var n,r,o,i,a;if(!e)return{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."};var l=st.Z[e];if(!l||!l.currentStep||!l.assistantClient)return{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."};if("string"!=typeof t||0===t.length)return{ok:!1,errorType:"shape_mismatch",error:"tableId is required."};var u=(null!==(n=l.currentStep.tables)&&void 0!==n?n:[]).find((function(e){return(null==e?void 0:e.id)===t}));if(!u)return{ok:!1,errorType:"not_on_step",error:"Table '".concat(t,"' is not on the current step.")};var c=null===(r=l.visiblePositions)||void 0===r?void 0:r[null!==(o=(0,ft.gh)(u))&&void 0!==o?o:"root"];if(Array.isArray(c)&&!c.some(Boolean))return{ok:!1,errorType:"hidden",error:"Table '".concat(t,"' is on the current step but is hidden right now.")};var s=Array.isArray(null===(i=null==u?void 0:u.properties)||void 0===i?void 0:i.columns)?u.properties.columns:[],d=null!==(a=l.fields)&&void 0!==a?a:{},p=s.reduce((function(e,t){var n,r=(null==t?void 0:t.field_key)?null===(n=d[t.field_key])||void 0===n?void 0:n.value:void 0;return Array.isArray(r)?Math.max(e,r.length):e}),0);return{ok:!0,found:{state:l,table:u,columns:s,rowCount:p}}},At=function(e,t){var n,r=null!==(n=null==e?void 0:e.properties)&&void 0!==n?n:{},o=!(!r.enable_editing||r.transpose&&t>0),i=o&&!!r.add_delete_rows;return{canEditCells:o,canAddRows:i,canDeleteRows:i}},Tt=function(){return Tt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Tt.apply(this,arguments)},It=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},_t=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},Zt=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Rt=function(e){var t=e.text;if("string"==typeof t&&t.trim())return t;var n=e.text_formatted,r=Array.isArray(n)?n:null==n?void 0:n.ops;return Array.isArray(r)?r.map((function(e){return"string"==typeof(null==e?void 0:e.insert)?e.insert:""})).join("").trim():""},jt=function(e,t){if(!e)return"";try{return(0,dt.xf)(e,t)}catch(t){return e}},Et=function(e){return t=void 0,n=void 0,o=function(){var t,n;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(r){switch(r.label){case 0:return e?(t=null===(n=st.Z[e])||void 0===n?void 0:n.client)?[4,(0,ct.Zz)(t)]:[3,2]:[2];case 1:r.sent(),r.label=2;case 2:return[2]}}))},new((r=void 0)||(r=Promise))((function(e,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function l(e){try{u(o.throw(e))}catch(e){i(e)}}function u(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,l)}u((o=o.apply(t,n||[])).next())}));var t,n,r,o},Ot=function(e,t){var n,r,o=(null===(n=t.position)||void 0===n?void 0:n.join(","))||"root",i=(null!==(r=e.visiblePositions)&&void 0!==r?r:{})[o];return!Array.isArray(i)||i.some(Boolean)},Lt=function(e){var t,n,r=null==e?void 0:e.currentStep;if(!r)return[];var o=[],i=new Set,a=(0,ct._5)();return(null!==(t=r.progress_bars)&&void 0!==t?t:[]).forEach((function(t){var n,l,u,c,s;if((null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.stepper)&&Ot(e,t)){var d=(null===(l=t.properties)||void 0===l?void 0:l.link_id)||t.id;if(!i.has(d)){i.add(d);var p=!!(null===(u=t.properties)||void 0===u?void 0:u.navigate_to_all_steps),f=(null!==(s=null===(c=t.properties)||void 0===c?void 0:c.entries)&&void 0!==s?s:[]).filter((function(e){return(0,bt.V)(e)})).map((function(e,t){var n,o=null==e?void 0:e.step_key,i=String(null!==(n=null==e?void 0:e.label)&&void 0!==n?n:""),l=t+1;if(!o)return{label:i,position:l,reachable:!1};var u=o===r.key;return Tt(Tt({stepKey:o,label:i,position:l},u?{active:!0}:{}),{reachable:(0,bt.D)(u,p,a.has(o))})}));f.length>0&&o.push({surface:"stepper",id:d,submitsCurrentStep:!1,steps:f})}}})),(null!==(n=r.tabs)&&void 0!==n?n:[]).forEach((function(t){var n,a,l,u;if(Ot(e,t)){var c=(null===(n=t.properties)||void 0===n?void 0:n.link_id)||t.id;if(!i.has(c)){i.add(c);var s=(null!==(l=null===(a=t.properties)||void 0===a?void 0:a.entries)&&void 0!==l?l:[]).map((function(e,t){var n,o=null==e?void 0:e.step_key,i=String(null!==(n=null==e?void 0:e.label)&&void 0!==n?n:""),a=t+1;if(!o)return{label:i,position:a,reachable:!1};var l=o===r.key;return Tt(Tt({stepKey:o,label:i,position:a},l?{active:!0}:{}),{reachable:!l})}));s.length>0&&o.push({surface:"tab",id:c,submitsCurrentStep:!!(null===(u=t.properties)||void 0===u?void 0:u.submit),steps:s})}}})),o},Bt=new Set(["submit","load"]),Mt=function(e,t,n,r){return(null!=e?e:[]).some((function(e){if((null==e?void 0:e.trigger_event)!==t)return!1;if(!1===e.enabled||!1===e.valid)return!1;var o=e.steps,i=e.elements;return!(Array.isArray(o)&&o.length>0&&!o.includes(n))&&(!!Bt.has(t)||Array.isArray(i)&&i.includes(r))}))},Wt=n(99234),Dt=n(81075),Ft=function(){return Ft=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ft.apply(this,arguments)},Pt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},Kt=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},Ut=new Set(["file_upload","signature"]),zt=new Set(["text_field","text_area","email","phone_number","url","password","ssn","ein","gmap_line_1","gmap_line_2","gmap_city","gmap_state","gmap_country","gmap_zip"]),Xt=new Set(["integer_field","slider","rating"]),Nt=new Set(["dropdown","radio"]),Vt=new Set(["dropdown_multi","multiselect","checkbox_group","button_group"]);function qt(e,t){var n,r=null!==(n=e.metadata)&&void 0!==n?n:{},o=Array.isArray(r.repeat_options)?r.repeat_options:null;if("number"==typeof t&&o&&Array.isArray(o[t]))return o[t].map((function(e){var t,n,r,o,i;return{value:String(null!==(n=null!==(t=null==e?void 0:e.value)&&void 0!==t?t:e)&&void 0!==n?n:""),label:String(null!==(i=null!==(o=null!==(r=null==e?void 0:e.label)&&void 0!==r?r:null==e?void 0:e.value)&&void 0!==o?o:e)&&void 0!==i?i:"")}}));var i=Array.isArray(r.options)?r.options:null;if(!i)return[];var a=Array.isArray(r.labels)?r.labels:[];return i.map((function(e,t){var n,r;return{value:String(null!=e?e:""),label:String(null!==(r=null!==(n=a[t])&&void 0!==n?n:e)&&void 0!==r?r:"")}}))}function Ht(e,t,n,r){return Pt(this,void 0,void 0,(function(){var o,i,a;return Kt(this,(function(l){switch(l.label){case 0:return(o="number"==typeof e?String(Math.trunc(e)):"string"==typeof e?e:"").replace(/\D/g,"")?(Wt.BZ||(0,Wt.bq)(),[4,Wt.hV]):[2,e];case 1:return l.sent(),Wt.BZ?(i=function(e,t,n){var r,o,i,a=null===(o=null===(r=e.fields)||void 0===r?void 0:r[t])||void 0===o?void 0:o.value;if(a&&"string"==typeof a&&Wt.BZ)try{var l=Wt.BZ.parsePhoneNumber("+".concat(a));if(null==l?void 0:l.country)return l.country}catch(e){}var u=null===(i=n.metadata)||void 0===i?void 0:i.default_country;return u&&"auto"!==u?u:"US"}(n,r,t),(null==(a=function(){try{return Wt.BZ.parsePhoneNumber(o,i)}catch(e){return}}())?void 0:a.isValid())?[2,a.number.replace(/^\+/,"")]:[2,e]):[2,e]}}))}))}function Gt(e,t){var n,r;return Pt(this,void 0,void 0,(function(){var o,i,a,l,u,c,s=this;return Kt(this,(function(d){switch(d.label){case 0:return o=e?st.Z[e]:void 0,i=null==o?void 0:o.assistantClient,o&&i?(a=new Set(t.map((function(e){return"string"==typeof(null==e?void 0:e.fieldKey)?e.fieldKey:""})).filter(Boolean)),l=new Map((null!==(r=null===(n=o.currentStep)||void 0===n?void 0:n.servar_fields)&&void 0!==r?r:[]).filter((function(e){var t;return a.has(null===(t=null==e?void 0:e.servar)||void 0===t?void 0:t.key)})).map((function(e){var t,n,r=e.servar.key,i=null===(n=null===(t=o.fields)||void 0===t?void 0:t[r])||void 0===n?void 0:n.value;return[r,null==i?null:JSON.parse(JSON.stringify(i))]}))),[4,Promise.all(t.map((function(e){return Pt(s,void 0,void 0,(function(){var t,n,r,i,a,l;return Kt(this,(function(u){switch(u.label){case 0:return t="string"==typeof(null==e?void 0:e.fieldKey)?e.fieldKey:"",n=Number.isInteger(null==e?void 0:e.repeatIndex)?e.repeatIndex:void 0,t?(r=function(e,t,n,r){var o,i,a,l,u,c,s,d,p=null==e?void 0:e.currentStep,f=null!==(o=null==p?void 0:p.servar_fields)&&void 0!==o?o:[],h=f.find((function(e){var n;return(null===(n=null==e?void 0:e.servar)||void 0===n?void 0:n.key)===t}));if(!h){var v=f.map((function(e){var t;return null===(t=null==e?void 0:e.servar)||void 0===t?void 0:t.key})).filter(Boolean).join(", ")||"(none)";return{ok:!1,errorType:"not_on_step",error:"Field '".concat(t,"' is not on the current step. Available field keys here: ").concat(v,".")}}var y=null!==(i=h.servar)&&void 0!==i?i:{},g=y.type,b=null!==(a=e.visiblePositions)&&void 0!==a?a:{},m=b[null!==(l=(0,ft.gh)(h))&&void 0!==l?l:"root"];if(Array.isArray(m)&&!m.some(Boolean))return{ok:!1,errorType:"hidden",error:"Field '".concat(t,"' is on the current step but is hidden right now.")};var x=!(!(null===(u=e.formSettings)||void 0===u?void 0:u.readOnly)&&"readOnly"!==ct.Hi.collaboratorReview);if((null===(c=h.properties)||void 0===c?void 0:c.disabled)||x)return{ok:!1,errorType:"disabled",error:"Field '".concat(t,"' is disabled and cannot be written.")};if(Ut.has(g))return{ok:!1,errorType:"unwriteable_type",error:"Field '".concat(t,"' (").concat(g,") cannot be filled by the assistant; the user has to provide this themselves.")};var w=y.repeated?(0,pt.o$)(p,h):void 0,k=St(r,!!w,w?(null!==(d=b[null!==(s=(0,ft.gh)(w))&&void 0!==s?s:"root"])&&void 0!==d?d:[]).length:0,t);if(k)return Ft({ok:!1},k);if("number"==typeof r&&Array.isArray(m)&&!m[r])return{ok:!1,errorType:"hidden",error:"Row ".concat(r," of field '").concat(t,"' is hidden right now.")};var S=n;"phone_number"===g&&"number"==typeof S&&Number.isFinite(S)&&(S=String(Math.trunc(S)));var C=function(e,t,n){var r,o=e.type,i=e.key,a=null!==(r=e.metadata)&&void 0!==r?r:{},l="number"==typeof e.min_length?e.min_length:void 0,u="number"==typeof e.max_length?e.max_length:void 0;if("checkbox"===o)return"boolean"==typeof t?null:"Field '".concat(i,"' (checkbox) expects a boolean.");if(Xt.has(o))return"number"==typeof t&&Number.isFinite(t)?"number"==typeof l&&t<l?"Value below minimum (".concat(l,")."):"number"==typeof u&&t>u?"Value above maximum (".concat(u,")."):null:"Field '".concat(i,"' (").concat(o,") expects a number.");if("date_selector"===o)return"string"!=typeof t?"Field '".concat(i,"' (date_selector) expects a string."):/^\d{4}-\d{2}-\d{2}$/.test(t)?null:"Field '".concat(i,"' expects ISO date 'YYYY-MM-DD'.");if(Nt.has(o)){if("string"!=typeof t)return"Field '".concat(i,"' (").concat(o,") expects a single option value (string).");var c=qt(e,n).map((function(e){return e.value}));return c.length>0&&!c.includes(t)?"Value not in allowed options. Allowed: ".concat(c.join(", "),"."):null}if(Vt.has(o)){if(!Array.isArray(t)||!t.every((function(e){return"string"==typeof e})))return"Field '".concat(i,"' (").concat(o,") expects an array of option-value strings.");if("button_group"===o&&!a.multiple&&t.length>1)return"Field '".concat(i,"' (button_group) is single-select; pass at most one option.");var s=new Set(qt(e,n).map((function(e){return e.value})));if(s.size>0){var d=t.filter((function(e){return!s.has(e)}));if(d.length>0)return"Values not in allowed options: ".concat(d.join(", "),".")}return null}return zt.has(o)?"string"!=typeof t?"Field '".concat(i,"' (").concat(o,") expects a string."):"number"==typeof l&&t.length<l?"Value shorter than minimum length (".concat(l,")."):"number"==typeof u&&t.length>u?"Value exceeds maximum length (".concat(u,")."):null:null}(y,S,r);return C?{ok:!1,errorType:"shape_mismatch",error:C}:{ok:!0,field:h,servar:y,value:S}}(o,t,e.value,n)).ok?(i=r.field,a=r.servar,l=r.value,"gmap_state"!==a.type?[3,1]:(l=function(e,t){var n,r;if("string"!=typeof e||!e)return e;var o=!!(null===(n=t.metadata)||void 0===n?void 0:n.store_abbreviation),i=null===(r=t.metadata)||void 0===r?void 0:r.default_country,a=(i&&"auto"!==i?i:"us").toLowerCase(),l=Dt.P3[a];if(!l||0===l.length)return e;var u=e.toLowerCase(),c=l.find((function(e){return e.code.toLowerCase()===u||e.name.toLowerCase()===u}));return c?o?c.code:c.name:e}(l,a),[3,3])):[2,{fieldKey:t,repeatIndex:n,ok:!1,errorType:r.errorType,error:r.error}]:[2,{fieldKey:t,repeatIndex:n,ok:!1,errorType:"shape_mismatch",error:"fieldKey is required."}];case 1:return"phone_number"!==a.type?[3,3]:[4,Ht(l,a,o,t)];case 2:l=u.sent(),u.label=3;case 3:return[2,{fieldKey:t,repeatIndex:n,field:i,normalized:l}]}}))}))})))]):[2,{results:t.map((function(e){var t="string"==typeof(null==e?void 0:e.fieldKey)?e.fieldKey:"",n=Number.isInteger(null==e?void 0:e.repeatIndex)?e.repeatIndex:void 0;return t?{fieldKey:t,repeatIndex:n,ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}:{fieldKey:t,repeatIndex:n,ok:!1,errorType:"shape_mismatch",error:"fieldKey is required."}}))}];case 1:return u=d.sent(),c=u.map((function(e){var t,n;if("ok"in e)return e;var r="number"==typeof e.repeatIndex?Ft(Ft({},e.field),{repeat:e.repeatIndex}):e.field;try{i.changeValue(e.normalized,r,null!==(t=e.repeatIndex)&&void 0!==t?t:null)}catch(t){return{fieldKey:e.fieldKey,repeatIndex:e.repeatIndex,ok:!1,errorType:"dispatch_failed",error:t instanceof Error?t.message:String(t)}}var o=l.get(e.fieldKey),a=void 0!==e.repeatIndex?Array.isArray(o)&&null!==(n=o[e.repeatIndex])&&void 0!==n?n:null:null!=o?o:null;return{fieldKey:e.fieldKey,repeatIndex:e.repeatIndex,ok:!0,value:e.normalized,priorValue:a}})),[2,{results:c}]}}))}))}var Yt=function(){return Yt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Yt.apply(this,arguments)},Jt=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},$t=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};function Qt(e,t,n){var r,o,i,a,l,u,c,s,d,p,f,h;return d=this,p=void 0,h=function(){var d,p,f,h,v,y,g,b,m,x,w,k,S,C,A,T,I,_,Z,R,j,E,O,L,B,M,W,D,F,P,K,U;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(z){switch(z.label){case 0:if(d=Number.isInteger(n)?n:null,!e)return[2,{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}];if(!(p=st.Z[e])||!p.currentStep||!p.assistantClient)return[2,{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}];if("string"!=typeof t||0===t.length)return[2,{ok:!1,errorType:"shape_mismatch",error:"elementId is required."}];if(f=function(e,t){var n,r,o,i=null==e?void 0:e.currentStep;if(!i)return null;var a=[[i.buttons,"button"],[i.texts,"text"],[i.subgrids,"container"]];try{for(var l=Jt(a),u=l.next();!u.done;u=l.next()){var c=$t(u.value,2),s=c[0],d=c[1],p=(null!=s?s:[]).find((function(e){return(null==e?void 0:e.id)===t}));if(p){var f=null===(o=null==p?void 0:p.properties)||void 0===o?void 0:o.actions;return{element:p,elementType:d,actions:Array.isArray(f)?f:[],position:Array.isArray(p.position)?p.position:[]}}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return null}(p,t),!f)return[2,{ok:!1,errorType:"not_on_step",error:"Element '".concat(t,"' is not on the current step.")}];if(h=null!==(r=p.visiblePositions)&&void 0!==r?r:{},v=h[null!==(o=(0,ft.gh)(f.element))&&void 0!==o?o:"root"],Array.isArray(v)&&!v.some(Boolean))return[2,{ok:!1,errorType:"hidden",error:"Element '".concat(t,"' is on the current step but is hidden right now.")}];if("button"===f.elementType&&(y=!(!(null===(i=p.formSettings)||void 0===i?void 0:i.readOnly)&&"readOnly"!==ct.Hi.collaboratorReview),(0,vt.A)(f.element,p.currentStep,h,y)))return[2,{ok:!1,errorType:"disabled",error:"Button '".concat(t,"' is disabled and cannot be clicked.")}];if(g=f.element.repeated?f.element:(0,pt.o$)(p.currentStep,f.element),b=g?(null!==(l=h[null!==(a=(0,ft.gh)(g))&&void 0!==a?a:"root"])&&void 0!==l?l:[]).length:0,m=St(d,!!g,b,t))return[2,Yt({ok:!1},m)];if("number"==typeof d&&Array.isArray(v)&&!v[d])return[2,{ok:!1,errorType:"hidden",error:"Row ".concat(d," of element '").concat(t,"' is hidden right now.")}];x=p.assistantClient,w=null!==(u=xt(p))&&void 0!==u?u:"",k=wt(p),S="number"==typeof d?Yt(Yt({},f.element),{repeat:d}):f.element,z.label=1;case 1:return z.trys.push([1,13,,14]),"button"!==f.elementType?[3,3]:[4,x.click(S)];case 2:return z.sent(),[3,12];case 3:return C=kt(p.currentStep.subgrids,f.position),[4,x.runActions({actions:f.actions,element:S,elementType:f.elementType})];case 4:z.sent(),z.label=5;case 5:z.trys.push([5,10,11,12]),A=Jt(C),T=A.next(),z.label=6;case 6:return T.done?[3,9]:(I=T.value,_=null===(c=null==I?void 0:I.properties)||void 0===c?void 0:c.actions,Z="number"==typeof d&&!!g&&I.position.length>=g.position.length,[4,x.runActions({actions:Array.isArray(_)?_:[],element:Z?Yt(Yt({},I),{repeat:d}):I,elementType:"container"})]);case 7:z.sent(),z.label=8;case 8:return T=A.next(),[3,6];case 9:return[3,12];case 10:return R=z.sent(),F={error:R},[3,12];case 11:try{T&&!T.done&&(P=A.return)&&P.call(A)}finally{if(F)throw F.error}return[7];case 12:return[3,14];case 13:return[2,{ok:!1,errorType:"dispatch_failed",error:(j=z.sent())instanceof Error?j.message:String(j)}];case 14:E=null!==(s=xt(p))&&void 0!==s?s:w,O=wt(p),L={};try{for(B=Jt(Object.keys(O)),M=B.next();!M.done;M=B.next())W=M.value,O[W]!==k[W]&&(L[W]=O[W])}catch(e){K={error:e}}finally{try{M&&!M.done&&(U=B.return)&&U.call(B)}finally{if(K)throw K.error}}return D="button"===f.elementType?L[t]:void 0,delete L[t],[2,Yt(Yt({ok:!0,navigated:E!==w?{fromStepKey:w,toStepKey:E}:null},D?{buttonError:D}:{}),Object.keys(L).length>0?{fieldErrors:L}:{})]}}))},new((f=void 0)||(f=Promise))((function(e,t){function n(e){try{o(h.next(e))}catch(e){t(e)}}function r(e){try{o(h.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof f?o:new f((function(e){e(o)}))).then(n,r)}o((h=h.apply(d,p||[])).next())}))}var en=function(){return en=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},en.apply(this,arguments)};function tn(e,t){var n,r,o,i,a,l,u;return i=this,a=void 0,u=function(){var i,a,l,u,c,s,d,p,f,h,v,y,g,b;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(m){switch(m.label){case 0:if(!e)return[2,{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}];if(!(i=st.Z[e])||!i.currentStep||!i.assistantClient)return[2,{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}];if(0===t.length)return[2,{ok:!1,errorType:"shape_mismatch",error:"stepKey is required."}];if(a=function(e){var t,n,r=null==e?void 0:e.currentStep;if(!r)return[];var o=[],i=new Set,a=(0,ct._5)();return(null!==(t=r.progress_bars)&&void 0!==t?t:[]).forEach((function(t){var n,l,u,c;if((null===(n=null==t?void 0:t.properties)||void 0===n?void 0:n.stepper)&&Ot(e,t)){var s=!!(null===(l=t.properties)||void 0===l?void 0:l.navigate_to_all_steps);(null!==(c=null===(u=t.properties)||void 0===u?void 0:u.entries)&&void 0!==c?c:[]).forEach((function(e){var n=null==e?void 0:e.step_key;if(n&&!i.has(n)&&(0,bt.V)(e)){var l=n===r.key;(0,bt.D)(l,s,a.has(n))&&(i.add(n),o.push({stepKey:n,element:t,elementType:"progress_bar"}))}}))}})),(null!==(n=r.tabs)&&void 0!==n?n:[]).forEach((function(t){var n,a;Ot(e,t)&&(null!==(a=null===(n=t.properties)||void 0===n?void 0:n.entries)&&void 0!==a?a:[]).forEach((function(e){var n=null==e?void 0:e.step_key;n&&n!==r.key&&!i.has(n)&&(i.add(n),o.push({stepKey:n,element:t,elementType:"tab"}))}))})),o}(i).find((function(e){return e.stepKey===t})),!a)return[2,{ok:!1,errorType:"step_not_allowed",error:"Step '".concat(t,"' is not reachable through a navigation surface right now.")}];l=i.assistantClient,u=null!==(n=xt(i))&&void 0!==n?n:"",c=wt(i),m.label=1;case 1:return m.trys.push([1,3,,4]),[4,l.runActions(en({actions:[{type:yt.Eb,next_step_key:t}],element:a.element,elementType:a.elementType},"tab"===a.elementType?{submit:!!(null===(r=a.element.properties)||void 0===r?void 0:r.submit)}:{}))];case 2:return m.sent(),[3,4];case 3:return[2,{ok:!1,errorType:"dispatch_failed",error:(s=m.sent())instanceof Error?s.message:String(s)}];case 4:d=null!==(o=xt(i))&&void 0!==o?o:u,p=wt(i),f={};try{for(h=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(Object.keys(p)),v=h.next();!v.done;v=h.next())y=v.value,p[y]!==c[y]&&(f[y]=p[y])}catch(e){g={error:e}}finally{try{v&&!v.done&&(b=h.return)&&b.call(h)}finally{if(g)throw g.error}}return[2,en({ok:!0,navigated:d!==u?{fromStepKey:u,toStepKey:d}:null},Object.keys(f).length>0?{fieldErrors:f}:{})]}}))},new((l=void 0)||(l=Promise))((function(e,t){function n(e){try{o(u.next(e))}catch(e){t(e)}}function r(e){try{o(u.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof l?o:new l((function(e){e(o)}))).then(n,r)}o((u=u.apply(i,a||[])).next())}))}var nn=function(){return nn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},nn.apply(this,arguments)};function rn(e,t,n,r){var o,i,a,l,u,c,s;return l=this,u=void 0,s=function(){var l,u,c,s,d,p,f,h,v,y,g,b,m,x,w,k,S,C;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(A){switch(A.label){case 0:if(!(l=Ct(e,t)).ok)return[2,l];if(u=l.found,c=u.state,s=u.table,d=u.rowCount,p="string"==typeof r&&r.length>0,void 0!==r&&!p)return[2,{ok:!1,errorType:"shape_mismatch",error:"actionLabel must be a non-empty string when provided."}];if(!Number.isInteger(n)||n<0)return[2,{ok:!1,errorType:"shape_mismatch",error:"rowIndex must be a non-negative integer."}];if(p){if(!(Array.isArray(null===(o=null==s?void 0:s.properties)||void 0===o?void 0:o.actions)?s.properties.actions:[]).some((function(e){return(null==e?void 0:e.label)===r})))return[2,{ok:!1,errorType:"unknown_action",error:"Table '".concat(t,"' has no action labeled '").concat(r,"'.")}]}else if(At(s,d).canEditCells)return[2,{ok:!1,errorType:"not_allowed",error:"Table '".concat(t,"' is editable, so bare row clicks are not wired; use a named action.")}];if(n>=d)return[2,{ok:!1,errorType:"row_out_of_range",error:"Row ".concat(n," is out of range (table has ").concat(d," row").concat(1===d?"":"s",").")}];f=function(e,t){var n,r,o,i,a={};try{for(var l=mt(e.columns),u=l.next();!u.done;u=l.next()){var c=u.value;if(null==c?void 0:c.field_key){var s=null===(i=null===(o=e.state.fields)||void 0===o?void 0:o[c.field_key])||void 0===i?void 0:i.value,d=Array.isArray(s)?s[t]:s;a[c.name]=d}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return a}(l.found,n),h=null!==(i=xt(c))&&void 0!==i?i:"",v=wt(c),A.label=1;case 1:return A.trys.push([1,3,,4]),[4,c.assistantClient.runTableAction({table:s,payload:p?{action:r,rowIndex:n,rowData:f}:{rowIndex:n,rowData:f}})];case 2:return A.sent(),[3,4];case 3:return[2,{ok:!1,errorType:"dispatch_failed",error:(y=A.sent())instanceof Error?y.message:String(y)}];case 4:g=null!==(a=xt(c))&&void 0!==a?a:h,b=wt(c),m={};try{for(x=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(Object.keys(b)),w=x.next();!w.done;w=x.next())k=w.value,b[k]!==v[k]&&(m[k]=b[k])}catch(e){S={error:e}}finally{try{w&&!w.done&&(C=x.return)&&C.call(x)}finally{if(S)throw S.error}}return[2,nn({ok:!0,navigated:g!==h?{fromStepKey:h,toStepKey:g}:null},Object.keys(m).length>0?{fieldErrors:m}:{})]}}))},new((c=void 0)||(c=Promise))((function(e,t){function n(e){try{o(s.next(e))}catch(e){t(e)}}function r(e){try{o(s.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):(o=t.value,o instanceof c?o:new c((function(e){e(o)}))).then(n,r)}o((s=s.apply(l,u||[])).next())}))}var on=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},an=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},ln=function(e,t){return!Number.isInteger(e)||e<0?{ok:!1,errorType:"shape_mismatch",error:"rowIndex must be a non-negative integer."}:e>=t?{ok:!1,errorType:"row_out_of_range",error:"Row ".concat(e," is out of range (table has ").concat(t," row").concat(1===t?"":"s",").")}:null},un={add:"adding rows",del:"deleting rows",edit:"cell editing"},cn=function(e,t,n,r){var o=At(e,r);return"add"===n&&o.canAddRows||"del"===n&&o.canDeleteRows||"edit"===n&&o.canEditCells?null:{ok:!1,errorType:"not_allowed",error:"Table '".concat(t,"' does not allow ").concat(un[n],".")}};function sn(e,t){return on(this,void 0,void 0,(function(){var n,r,o,i,a,l;return an(this,(function(u){if(!(n=Ct(e,t)).ok)return[2,n];if(r=n.found,o=r.state,i=r.table,a=r.rowCount,l=cn(i,t,"add",a))return[2,l];try{if(!o.assistantClient.addTableRow(t))return[2,{ok:!1,errorType:"not_mounted",error:"Table '".concat(t,"' is not mounted yet.")}]}catch(e){return[2,{ok:!1,errorType:"dispatch_failed",error:e instanceof Error?e.message:String(e)}]}return[2,{ok:!0}]}))}))}function dn(e,t,n){return on(this,void 0,void 0,(function(){var r,o,i,a,l,u,c;return an(this,(function(s){if(!(r=Ct(e,t)).ok)return[2,r];if(o=r.found,i=o.state,a=o.table,l=o.rowCount,u=cn(a,t,"del",l))return[2,u];if(c=ln(n,l))return[2,c];try{if(!i.assistantClient.deleteTableRow(t,n))return[2,{ok:!1,errorType:"not_mounted",error:"Table '".concat(t,"' is not mounted yet.")}]}catch(e){return[2,{ok:!1,errorType:"dispatch_failed",error:e instanceof Error?e.message:String(e)}]}return[2,{ok:!0}]}))}))}function pn(e,t,n){var r;return on(this,void 0,void 0,(function(){var o,i,a,l,u,c,s,d,p,f,h,v,y,g,b,m,x;return an(this,(function(w){if(o=(Array.isArray(n)?n:[]).map((function(e){return{rowIndex:"number"==typeof(null==e?void 0:e.rowIndex)?e.rowIndex:NaN,fieldKey:"string"==typeof(null==e?void 0:e.fieldKey)?e.fieldKey:"",value:null==e?void 0:e.value}})),i=function(e,t){return{results:o.map((function(n){return{rowIndex:n.rowIndex,fieldKey:n.fieldKey,ok:!1,errorType:e,error:t}}))}},!(a=Ct(e,t)).ok)return[2,i(a.errorType,a.error)];if(l=a.found,u=l.state,c=l.table,s=l.columns,d=l.rowCount,p=cn(c,t,"edit",d))return[2,i(p.errorType,p.error)];f=new Map(o.filter((function(e){return e.fieldKey})).map((function(e){var t,n,r=null===(n=null===(t=u.fields)||void 0===t?void 0:t[e.fieldKey])||void 0===n?void 0:n.value,o=Array.isArray(r)?r[e.rowIndex]:void 0;return["".concat(e.fieldKey,":").concat(e.rowIndex),null==o?null:JSON.parse(JSON.stringify(o))]}))),h=[],v=function(e){var n=e.rowIndex,o=e.fieldKey,i=e.value;if(!o)return h.push({rowIndex:n,fieldKey:o,ok:!1,errorType:"shape_mismatch",error:"fieldKey is required."}),"continue";if(!s.some((function(e){return(null==e?void 0:e.field_key)===o})))return h.push({rowIndex:n,fieldKey:o,ok:!1,errorType:"unknown_field",error:"Table '".concat(t,"' has no column with fieldKey '").concat(o,"'.")}),"continue";var a=ln(n,d);if(a)return h.push({rowIndex:n,fieldKey:o,ok:!1,errorType:a.errorType,error:a.error}),"continue";var l=null==i?"":String(i);try{if(!u.assistantClient.editTableCell(t,n,o,l))return h.push({rowIndex:n,fieldKey:o,ok:!1,errorType:"not_mounted",error:"Table '".concat(t,"' is not mounted yet.")}),"continue"}catch(e){return h.push({rowIndex:n,fieldKey:o,ok:!1,errorType:"dispatch_failed",error:e instanceof Error?e.message:String(e)}),"continue"}h.push({rowIndex:n,fieldKey:o,ok:!0,value:l,priorValue:null!==(r=f.get("".concat(o,":").concat(n)))&&void 0!==r?r:null})};try{for(y=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(o),g=y.next();!g.done;g=y.next())b=g.value,v(b)}catch(e){m={error:e}}finally{try{g&&!g.done&&(x=y.return)&&x.call(y)}finally{if(m)throw m.error}}return[2,{results:h}]}))}))}var fn=function(){return fn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},fn.apply(this,arguments)},hn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function l(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))},vn=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},yn=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a},gn=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))},bn="feathery.assistant.mode",mn="current",xn=function(){try{var e=(0,_.Kv)().localStorage.getItem(bn);return"current"===(t=e)||"sidebar-left"===t||"sidebar-right"===t||"fullscreen"===t?e:mn}catch(e){return mn}var t},wn="feathery.assistant.sidebarWidth",kn=400,Sn=function(e){var t=Math.max(280,function(){try{return Math.min(800,Math.floor(.6*(0,_.Kv)().innerWidth))}catch(e){return 800}}());return e<280?280:e>t?t:e},Cn=function(){try{var e=(0,_.Kv)().localStorage.getItem(wn),t=e?parseInt(e,10):NaN;return Number.isFinite(t)&&t>0?Sn(t):kn}catch(e){return kn}},An=function(e){try{(0,_.Kv)().localStorage.setItem(wn,String(e))}catch(e){}},Tn=["current","sidebar-left","sidebar-right","fullscreen"];const In=function(e){var t,n,u,s=e.instanceId,p=e.getTargets,h=e.getJwt,S=e.baseUrl,I=e.bottom,Z=void 0===I?20:I,E=e.color,O=e.voiceEnabled,B=void 0!==O&&O,M=e.workflowActions,K=void 0===M?[]:M,X=e.allowedModes,$=void 0===X?Tn:X,ee=e.onLayoutChange,ne=(0,o.useMemo)((function(){if(h)return function(){return{Authorization:"Bearer ".concat(h())}};var e=(0,ct.JQ)().sdkKey;return function(){var t={Authorization:"Token ".concat(e)},n=(0,_.ej)("feathery_session_token");return n&&(t["X-Feathery-Session"]=n),t}}),[h]),re=yn((0,o.useState)(!1),2),oe=re[0],ie=re[1],ae=yn((0,o.useState)(xn),2),le=ae[0],ue=ae[1],ce=(0,o.useCallback)((function(e){ue(e),function(e){try{(0,_.Kv)().localStorage.setItem(bn,e)}catch(e){}}(e)}),[]),se=yn((0,o.useState)(Cn),2),de=se[0],pe=se[1],fe=yn((0,o.useState)(!1),2),he=fe[0],ve=fe[1];(0,o.useEffect)((function(){var e=function(){pe((function(e){var t=Sn(e);return t!==e&&An(t),t}))};return(0,_.Kv)().addEventListener("resize",e),function(){return(0,_.Kv)().removeEventListener("resize",e)}}),[]);var ye=(0,o.useCallback)((function(e){return function(t){if(0===t.button){t.preventDefault(),ve(!0);var n=(0,_.me)().body;n.style.cursor="col-resize",n.style.userSelect="none";var r=de,o=function(t){var n="right"===e?(0,_.Kv)().innerWidth-t.clientX:t.clientX;r=Sn(n),pe(r)},i=function(){(0,_.Kv)().removeEventListener("pointermove",o),(0,_.Kv)().removeEventListener("pointerup",i),(0,_.Kv)().removeEventListener("pointercancel",i),ve(!1),n.style.cursor="",n.style.userSelect="",An(r)};(0,_.Kv)().addEventListener("pointermove",o),(0,_.Kv)().addEventListener("pointerup",i),(0,_.Kv)().addEventListener("pointercancel",i)}}}),[de]),ge=(0,o.useCallback)((function(){pe(kn),An(kn)}),[]),Oe=yn((0,o.useState)(""),2),Le=Oe[0],Be=Oe[1],Me=yn((0,o.useState)([]),2),We=Me[0],De=Me[1],Fe=yn((0,o.useState)(null),2),Pe=Fe[0],Ke=Fe[1],Ue=yn((0,o.useState)(!1),2),ze=Ue[0],Xe=Ue[1],Ve=yn((0,o.useState)(!1),2),He=Ve[0],Ge=Ve[1],Ye=yn((0,o.useState)(null),2),Je=Ye[0],$e=Ye[1],Qe=(0,o.useRef)(null),et=(0,o.useRef)(!0),dt=(0,o.useRef)(!1),bt=(0,o.useRef)(null),mt=(0,o.useRef)(null),xt=(0,o.useCallback)((function(){var e=Qe.current;if(e){var t=e.scrollHeight-e.scrollTop-e.clientHeight;et.current=t<60}}),[]),wt=(0,o.useCallback)((function(){var e=Qe.current;e&&et.current&&(e.scrollTop=e.scrollHeight)}),[]),St=(0,o.useMemo)((function(){return{primary:e=E||q,hover:te(e,-15),disabled:te(e,30),light:(t=e,90,n=parseInt(t.replace("#",""),16),r=n>>16&255,o=n>>8&255,i=255&n,.9,a=Math.round(r+.9*(255-r)),l=Math.round(o+.9*(255-o)),u=Math.round(i+.9*(255-i)),"#".concat((a<<16|l<<8|u).toString(16).padStart(6,"0")))};var e,t,n,r,o,i,a,l,u}),[E]),Ct=function(e,t,n){void 0===t&&(t=[]);var r=null!=e?e:(0,i.Z)(),o=e,u=!!n,c=function(e){if(!u&&e){u=!0;var t=o||null,n={},r=p();if(r.length>0&&(n.targets=r),s){var i=function(e){var t,n;return null===(n=null===(t=st.Z[e])||void 0===t?void 0:t.currentStep)||void 0===n?void 0:n.key}(s);i&&(n.current_step=i)}(function(e,t,n,r,o){return rt(void 0,void 0,void 0,(function(){var i,a,l;return ot(this,(function(u){switch(u.label){case 0:return[4,fetch("".concat(it(e),"title/"),{method:"POST",headers:nt(nt({},t()),{"Content-Type":"application/json"}),body:JSON.stringify(nt({message:r,thread_id:null!=n?n:void 0},null!=o?o:{}))})];case 1:return(i=u.sent()).ok?[4,i.json()]:[2,null];case 2:return a=u.sent(),[2,null!==(l=a.title)&&void 0!==l?l:null]}}))}))})(S,ne,t,e,n).then((function(e){e&&De((function(n){return n.map((function(n){return n.id===t||n.chat===f?fn(fn({},n),{title:e}):n}))}))}))}},d=new l.PD({api:S,headers:ne,body:function(){return fn(fn({},function(){var e={},t=p();if(t.length>0&&(e.targets=t),s){var n=function(e){var t,n,r,o,i,a,l,u,c,s,d,p,f,h,v,y,g,b,m=st.Z[e];if(!m||!m.currentStep)return null;var x=m.currentStep,w=null!==(i=m.visiblePositions)&&void 0!==i?i:{},k=null!==(a=m.fields)&&void 0!==a?a:{},S=null!==(l=m.inlineErrors)&&void 0!==l?l:{},C=m.logicRules,A=!(!(null===(u=m.formSettings)||void 0===u?void 0:u.readOnly)&&"readOnly"!==ct.Hi.collaboratorReview),T=(null!==(c=x.subgrids)&&void 0!==c?c:[]).filter((function(e){var t,n,r=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.actions;return!!(Array.isArray(r)&&r.length>0)||Mt(C,"action",x.id,null!==(n=e.id)&&void 0!==n?n:"")})),I=function(e){return kt(T,Array.isArray(null==e?void 0:e.position)?e.position:[]).map((function(e){var t;return null!==(t=e.id)&&void 0!==t?t:""}))},_={};(0,pt.bW)(x).forEach((function(e){var t=null==e?void 0:e.id;if(t){var n=w[(0,ft.gh)(e)];Array.isArray(n)&&(_[t]=n.length)}}));var Z=(null!==(s=x.servar_fields)&&void 0!==s?s:[]).map((function(e){var t,n,r,o,i,a,l,u,c,s,d,p=(null===(t=e.position)||void 0===t?void 0:t.join(","))||"root",f=w[p],h=!Array.isArray(f)||f.some(Boolean),v=k[e.servar.key],y=null!==(n=e.properties)&&void 0!==n?n:{},g="string"==typeof y.placeholder&&y.placeholder.trim()?jt(y.placeholder):void 0,b="string"==typeof y.tooltipText&&y.tooltipText.trim()?jt(y.tooltipText):void 0,m=null===(r=S[e.servar.key])||void 0===r?void 0:r.message,T=null!==(o=e.servar)&&void 0!==o?o:{},Z=null!==(i=T.metadata)&&void 0!==i?i:{},R=!!T.repeated,j=R?(0,pt.o$)(x,e):void 0,E=null!==(a=null==j?void 0:j.id)&&void 0!==a?a:"",O=Array.isArray(Z.options)?Z.options:null,L=Array.isArray(Z.labels)?Z.labels:[],B=O?O.map((function(e,t){var n,r;return{value:String(null!=e?e:""),label:String(null!==(r=null!==(n=L[t])&&void 0!==n?n:e)&&void 0!==r?r:"")}})):void 0,M=Array.isArray(Z.repeat_options)?Z.repeat_options.map((function(e){return Array.isArray(e)?e.map((function(e){var t,n,r,o,i;return{value:String(null!==(n=null!==(t=null==e?void 0:e.value)&&void 0!==t?t:e)&&void 0!==n?n:""),label:String(null!==(i=null!==(o=null!==(r=null==e?void 0:e.label)&&void 0!==r?r:null==e?void 0:e.value)&&void 0!==o?o:e)&&void 0!==i?i:"")}})):null})):void 0,W=null!==(u=null!==(l=_[E])&&void 0!==l?l:null==M?void 0:M.length)&&void 0!==u?u:0,D=M?Array.from({length:W},(function(e,t){return Array.isArray(M[t])?M[t]:null})):void 0,F=Array.isArray(Z.questions)?Z.questions:null,P=F?F.map((function(e){var t,n;return{id:String(null!==(t=null==e?void 0:e.id)&&void 0!==t?t:""),label:String(null!==(n=null==e?void 0:e.label)&&void 0!==n?n:"")}})).filter((function(e){return e.id||e.label})):void 0,K=_t(_t([],It(Array.isArray(Z.file_types)?Z.file_types:[]),!1),It(Array.isArray(Z.custom_file_types)?Z.custom_file_types.map((function(e){return".".concat(e)})):[]),!1),U=Z.min_val_label||Z.max_val_label?Tt(Tt({},Z.min_val_label?{min:String(Z.min_val_label)}:{}),Z.max_val_label?{max:String(Z.max_val_label)}:{}):void 0,z=!(!y.disabled&&!A),X=Mt(C,"change",x.id,null!==(c=T.id)&&void 0!==c?c:""),N=I(e),V=null!==(s=null==v?void 0:v.value)&&void 0!==s?s:null,q=R?null!==(d=_[E])&&void 0!==d?d:Array.isArray(V)?V.length:0:void 0;if("number"==typeof q&&q>0){var H=Array.isArray(V)?V:[];H.length<q&&(V=_t(_t([],It(H),!1),It(Array(q-H.length).fill((0,ht.oe)(e))),!1))}return Tt(Tt(Tt(Tt(Tt(Tt(Tt(Tt(Tt(Tt(Tt(Tt(Tt(Tt(Tt(Tt(Tt(Tt({key:T.key,type:T.type,value:V,visible:h,disabled:z,required:!!T.required},"number"==typeof q?{rowCount:q}:{}),(null==j?void 0:j.id)?{repeatContainerId:j.id}:{}),X?{hasLogicRules:!0}:{}),N.length>0?{clickableAncestorIds:N}:{}),g?{placeholder:g}:{}),b?{tooltip:b}:{}),m?{error:m}:{}),B?{options:B}:{}),D?{rowOptions:D}:{}),P?{questions:P}:{}),"number"==typeof T.min_length?{minLength:T.min_length}:{}),"number"==typeof T.max_length?{maxLength:T.max_length}:{}),T.format?{format:String(T.format)}:{}),K.length>0?{fileTypes:K}:{}),Z.multiple?{multipleFiles:!0}:{}),"button_group"===T.type?{multiple:!!Z.multiple}:{}),U?{sliderLabels:U}:{}),"number"==typeof Z.step_size?{stepSize:Z.step_size}:{})})),R=new Set;try{for(var j=Zt(Object.keys(null!==(d=m.steps)&&void 0!==d?d:{})),E=j.next();!E.done;E=j.next()){var O=E.value,L=m.steps[O];(null!==(p=null==L?void 0:L.servar_fields)&&void 0!==p?p:[]).forEach((function(e){var t;(null===(t=null==e?void 0:e.servar)||void 0===t?void 0:t.key)&&R.add(e.servar.key)}))}}catch(e){t={error:e}}finally{try{E&&!E.done&&(n=j.return)&&n.call(j)}finally{if(t)throw t.error}}var B=function(e){return!(null==e||"string"==typeof e&&""===e||Array.isArray(e)&&0===e.length)},M={},W={};try{for(var D=Zt(Object.keys(k)),F=D.next();!F.done;F=D.next()){var P=F.value,K=null!==(h=null===(f=k[P])||void 0===f?void 0:f.value)&&void 0!==h?h:null;R.has(P)?M[P]=K:B(K)&&(W[P]=K)}}catch(e){r={error:e}}finally{try{F&&!F.done&&(o=D.return)&&o.call(D)}finally{if(r)throw r.error}}var U=[],z=function(e){return Ot(m,e)};T.forEach((function(e){var t,n,r,o=e.properties.actions,i=Mt(C,"action",x.id,null!==(t=e.id)&&void 0!==t?t:""),a=I(e),l=e.repeated?e.id:null===(n=(0,pt.o$)(x,e))||void 0===n?void 0:n.id;U.push(Tt(Tt(Tt({type:"container",id:null!==(r=e.id)&&void 0!==r?r:"",visible:z(e),actions:o},i?{hasLogicRules:!0}:{}),a.length>0?{clickableAncestorIds:a}:{}),l?{repeatContainerId:l}:{}))})),(null!==(v=x.texts)&&void 0!==v?v:[]).forEach((function(e){var t,n,r,o,i=Rt(null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{});if(i){var a=jt(i),l=null!==(n=null==e?void 0:e.properties)&&void 0!==n?n:{},u=Array.isArray(l.actions)?l.actions:[],c=Mt(C,"action",x.id,null!==(r=e.id)&&void 0!==r?r:""),s=I(e),d=null===(o=(0,pt.o$)(x,e))||void 0===o?void 0:o.id;U.push(Tt(Tt(Tt(Tt(Tt(Tt({type:"text",text:a,visible:z(e)},e.id?{id:e.id}:{}),i!==a?{templateText:i}:{}),u.length>0?{actions:u}:{}),c?{hasLogicRules:!0}:{}),s.length>0?{clickableAncestorIds:s}:{}),d?{repeatContainerId:d}:{}))}})),(null!==(y=x.buttons)&&void 0!==y?y:[]).forEach((function(e){var t,n,r,o,i,a,l,u=Rt(null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{}),c=null!==(n=null==e?void 0:e.properties)&&void 0!==n?n:{},s=Array.isArray(c.actions)?c.actions:[],d=Mt(C,"action",x.id,null!==(r=e.id)&&void 0!==r?r:"")||!!c.submit&&(Mt(C,"submit",x.id,"")||Mt(C,"form_complete",x.id,""));if(u||0!==s.length||c.submit||d){var p,f=null===(o=(0,pt.o$)(x,e))||void 0===o?void 0:o.id,h=s.map((function(e){return null==e?void 0:e.type}));h.includes(yt.Md)?p=(0,gt.aL)(x,null!==(i=m.backNavMap)&&void 0!==i?i:{})||void 0:h.includes(yt.Eb)?p=(0,gt.h6)(null!==(a=x.next_conditions)&&void 0!==a?a:[],{elementType:"button",elementIDs:[e.id]})||void 0:c.submit&&(p=null),U.push(Tt(Tt(Tt({type:"button",id:null!==(l=e.id)&&void 0!==l?l:"",text:jt(u),visible:z(e),disabled:(0,vt.A)(e,x,w,A),submit:!!c.submit,actions:s},void 0!==p?{navigatesTo:p}:{}),d?{hasLogicRules:!0}:{}),f?{repeatContainerId:f}:{}))}})),(null!==(g=x.images)&&void 0!==g?g:[]).forEach((function(e){var t,n=null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{},r="string"==typeof n.alt_text&&n.alt_text||"string"==typeof n.caption&&n.caption||"";if(r){var o=I(e);U.push(Tt({type:"image",text:jt(r),visible:z(e)},o.length>0?{clickableAncestorIds:o}:{}))}}));var X=[];return(null!==(b=x.tables)&&void 0!==b?b:[]).forEach((function(e){var t,n,r,o,i,a=null!==(n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.columns)&&void 0!==n?n:[];if(0!==a.length){var l=a.reduce((function(e,t){var n,r=t.field_key?null===(n=k[t.field_key])||void 0===n?void 0:n.value:void 0;return Array.isArray(r)?Math.max(e,r.length):e}),0),u=Array.from({length:l},(function(e,t){return a.map((function(e){var n,r,o=e.field_key?null===(n=k[e.field_key])||void 0===n?void 0:n.value:null;return Array.isArray(o)?null!==(r=o[t])&&void 0!==r?r:null:null!=o?o:null}))})),c=(Array.isArray(null===(r=null==e?void 0:e.properties)||void 0===r?void 0:r.actions)?e.properties.actions:[]).map((function(e){return{label:"string"==typeof(null==e?void 0:e.label)?e.label:""}})).filter((function(e){return e.label.trim().length>0})),s=At(e,l),d=s.canEditCells,p=s.canAddRows,f=s.canDeleteRows,h=Mt(C,"action",x.id,null!==(o=e.id)&&void 0!==o?o:"");X.push(Tt(Tt(Tt(Tt(Tt(Tt({id:null!==(i=e.id)&&void 0!==i?i:"",columns:a.map((function(e){var t,n,r;return{name:null!==(n=null!==(t=e.name)&&void 0!==t?t:e.field_key)&&void 0!==n?n:"",fieldKey:null!==(r=e.field_key)&&void 0!==r?r:""}})),rows:u},c.length>0?{actions:c}:{}),p?{canAddRows:!0}:{}),f?{canDeleteRows:!0}:{}),d?{canEditCells:!0}:{}),h?{hasLogicRules:!0}:{}),{visible:z(e)}))}})),{currentStep:{id:x.id,key:x.key},previousStepName:m.previousStepName||void 0,activeStepKey:x.key,navigationSurfaces:Lt(m),currentStepFields:Z,currentStepElements:U,currentStepTables:X,values:M,hiddenFieldValues:W}}(s);n&&(e.panel_runtime=n)}return e}()),{thread_id:o||r})},fetch:function(e,t){return hn(void 0,void 0,void 0,(function(){var n,r,i,a,l,u,s,d;return vn(this,(function(p){switch(p.label){case 0:return dt.current?((r=new FormData).append("payload","string"==typeof(null==t?void 0:t.body)?t.body:JSON.stringify(null!==(l=null==t?void 0:t.body)&&void 0!==l?l:{})),(i=bt.current)&&(r.append("audio",i,"speech.wav"),bt.current=null),[4,fetch("".concat(S,"voice/turn/"),{method:"POST",headers:ne(),body:r,signal:null==t?void 0:t.signal})]):[3,2];case 1:return n=p.sent(),[3,4];case 2:return[4,fetch(e,t)];case 3:n=p.sent(),p.label=4;case 4:return(a=n.headers.get("X-Thread-Id"))&&!o&&(o=a,De((function(e){return e.map((function(e){return e.chat===f?fn(fn({},e),{id:a,isTemporary:!1}):e}))})),Ke(a),lt(S,ne,a).then((function(e){e&&De((function(t){return t.map((function(t){return t.id===a?fn(fn({},e),{chat:f,title:t.title||e.title}):t}))}))}))),c(null===(d=null===(s=null===(u=f.messages.find((function(e){return"user"===e.role})))||void 0===u?void 0:u.parts)||void 0===s?void 0:s[0])||void 0===d?void 0:d.text),[2,n]}}))}))}}),f=new a.en({transport:d,messages:t,sendAutomaticallyWhen:l.Qk,onData:function(e){var t,n;"data-transcript"===(null==e?void 0:e.type)&&c(null===(t=e.data)||void 0===t?void 0:t.text),null===(n=mt.current)||void 0===n||n.call(mt,e)},onToolCall:function(e){var t=e.toolCall;return hn(void 0,void 0,void 0,(function(){var e,n,r,o,i,a,l,u,c,d,p,h,v,y,g,b,m,x,w,k,S,C;return vn(this,(function(A){switch(A.label){case 0:return t.dynamic?[2]:"setFieldValue"!==t.toolName?[3,2]:(e=null!==(b=t.input)&&void 0!==b?b:{},n=Array.isArray(e.fields)?e.fields:[],[4,Gt(s,n)]);case 1:return g=A.sent(),f.addToolOutput({tool:"setFieldValue",toolCallId:t.toolCallId,output:g}),[3,14];case 2:return"clickElement"!==t.toolName?[3,4]:(r=null!==(m=t.input)&&void 0!==m?m:{},o="string"==typeof r.elementId?r.elementId:"",[4,Qt(s,o,r.repeatIndex)]);case 3:return g=A.sent(),f.addToolOutput({tool:"clickElement",toolCallId:t.toolCallId,output:g}),[3,14];case 4:return"navigateToStep"!==t.toolName?[3,6]:(i=null!==(x=t.input)&&void 0!==x?x:{},a="string"==typeof i.stepKey?i.stepKey:"",[4,tn(s,a)]);case 5:return g=A.sent(),f.addToolOutput({tool:"navigateToStep",toolCallId:t.toolCallId,output:g}),[3,14];case 6:return"triggerTableAction"!==t.toolName?[3,8]:(l=null!==(w=t.input)&&void 0!==w?w:{},v="string"==typeof l.tableId?l.tableId:"",p="number"==typeof l.rowIndex?l.rowIndex:NaN,u="string"==typeof l.actionLabel?l.actionLabel:void 0,[4,rn(s,v,p,u)]);case 7:return g=A.sent(),f.addToolOutput({tool:"triggerTableAction",toolCallId:t.toolCallId,output:g}),[3,14];case 8:return"addTableRow"!==t.toolName?[3,10]:(c=null!==(k=t.input)&&void 0!==k?k:{},v="string"==typeof c.tableId?c.tableId:"",[4,sn(s,v)]);case 9:return g=A.sent(),f.addToolOutput({tool:"addTableRow",toolCallId:t.toolCallId,output:g}),[3,14];case 10:return"deleteTableRow"!==t.toolName?[3,12]:(d=null!==(S=t.input)&&void 0!==S?S:{},v="string"==typeof d.tableId?d.tableId:"",p="number"==typeof d.rowIndex?d.rowIndex:NaN,[4,dn(s,v,p)]);case 11:return g=A.sent(),f.addToolOutput({tool:"deleteTableRow",toolCallId:t.toolCallId,output:g}),[3,14];case 12:return"setTableCellValue"!==t.toolName?[3,14]:(h=null!==(C=t.input)&&void 0!==C?C:{},v="string"==typeof h.tableId?h.tableId:"",y=Array.isArray(h.cells)?h.cells:[],[4,pn(s,v,y)]);case 13:g=A.sent(),f.addToolOutput({tool:"setTableCellValue",toolCallId:t.toolCallId,output:g}),A.label=14;case 14:return[2]}}))}))},onFinish:function(e){var t=e.isAbort,n=e.isError;t||n||!o||De((function(e){var t=e.find((function(e){return e.id===o}));return t?gn([fn(fn({},t),{updated_at:(new Date).toISOString()})],yn(e.filter((function(e){return e.id!==o}))),!1):e}))}});return function(e,t){U.set(e,t)}(f,r),f},Bt=(0,o.useMemo)((function(){return Ct(null)}),[ne,p,h]),Wt=We.find((function(e){return e.id===Pe})),Dt=null!==(u=null==Wt?void 0:Wt.chat)&&void 0!==u?u:Bt,Ft=(0,a.RJ)({chat:Dt}),Pt=Ft.messages,Kt=Ft.sendMessage,Ut=Ft.setMessages,zt=Ft.status,Xt=Ft.error,Nt=function(e){var t=this,n=e.activeChat,r=e.baseUrl,i=e.headers,a=Ce((0,o.useState)([]),2),l=a[0],u=a[1],c=Ce((0,o.useState)(null),2),s=c[0],d=c[1],p=Ce((0,o.useState)(!1),2),f=p[0],h=p[1],v=(0,o.useRef)(l);v.current=l;var y=(0,o.useRef)(new Map),g=(0,o.useRef)(null);(0,o.useEffect)((function(){var e=y.current;return function(){e.forEach((function(e){return e.abort()})),e.clear(),v.current.forEach((function(e){return URL.revokeObjectURL(e.previewUrl)})),u([]),d(null)}}),[n]);var b=(0,o.useCallback)((function(e,o){return ke(t,void 0,void 0,(function(){var t,a,l,c,s,p,f,h;return Se(this,(function(v){switch(v.label){case 0:if(g=n,!(t=U.get(g)))return[2];a=new AbortController,y.current.set(e,a),l=function(t){return u((function(n){return n.map((function(n){return n.previewUrl===e?we(we({},n),t):n}))}))},v.label=1;case 1:return v.trys.push([1,4,5,6]),[4,z(o,r,i,t,a.signal)];case 2:return c=v.sent(),a.signal.aborted?[2]:(l({id:c.id,uploadedUrl:c.url,uploadedFilename:c.filename,uploadedMediaType:c.mediaType,processingStatus:c.processingStatus}),P(c.processingStatus)?[2]:[4,N(c.id,r,i,t,a.signal)]);case 3:return s=v.sent(),a.signal.aborted?[2]:(l({uploadedUrl:null!==(h=s.url)&&void 0!==h?h:c.url,uploadedFilename:s.filename,uploadedMediaType:s.mediaType,processingStatus:s.processingStatus}),[3,6]);case 4:return p=v.sent(),a.signal.aborted?[2]:(f=p instanceof Error?p.message:"Failed to upload attachment.",403===p.status?(u((function(t){return t.filter((function(t){return t.previewUrl!==e}))})),URL.revokeObjectURL(e),d(f)):l({processingStatus:"failed",uploadError:f}),[3,6]);case 5:return y.current.delete(e),[7];case 6:return[2]}var g}))}))}),[n,r,i]),m=(0,o.useCallback)((function(e){return ke(t,void 0,void 0,(function(){var t,n,r,o;return Se(this,(function(i){switch(i.label){case 0:return d(null),(t=e.filter((function(e){return W.has(e.type)&&e.size<=26214400}))).length<e.length&&d("Only images, PDFs, Word documents, Excel spreadsheets, and Powerpoints up to 25MB are supported."),t.length?[4,Promise.all(t.map((function(e){return F(e.type)?function(e){return R(this,void 0,void 0,(function(){var t,n,r,o,i,a,l;return j(this,(function(u){switch(u.label){case 0:return u.trys.push([0,3,,4]),[4,createImageBitmap(e)];case 1:return t=u.sent(),n=t.width,r=t.height,n<=L&&r<=L&&"image/jpeg"===e.type?(t.close(),[2,e]):(o=Math.min(L/n,L/r,1),(i=(0,_.me)().createElement("canvas")).width=Math.round(n*o),i.height=Math.round(r*o),(a=i.getContext("2d"))?(a.drawImage(t,0,0,i.width,i.height),t.close(),[4,new Promise((function(e){return i.toBlob(e,"image/jpeg",.85)}))]):[2,e]);case 2:return(l=u.sent())?[2,new File([l],e.name.replace(/\.\w+$/,".jpg"),{type:"image/jpeg"})]:[2,e];case 3:return u.sent(),[2,e];case 4:return[2]}}))}))}(e):e})))]:[2];case 1:return n=i.sent(),r=Math.max(0,5-v.current.length),n.length>r&&d("You can attach up to ".concat(5," files.")),0===r||(o=n.slice(0,r).map((function(e){return{file:e,previewUrl:URL.createObjectURL(e),processingStatus:"uploading"}})),u((function(e){return Ae(Ae([],Ce(e),!1),Ce(o),!1)})),o.forEach((function(e){b(e.previewUrl,e.file)}))),[2]}}))}))}),[b]),x=(0,o.useCallback)((function(e){var t=y.current.get(e);t&&(t.abort(),y.current.delete(e)),URL.revokeObjectURL(e),u((function(t){return t.filter((function(t){return t.previewUrl!==e}))}))}),[]),w=(0,o.useCallback)((function(e){var t=v.current;if(!e)return u([]),d(null),t;var n=t.filter((function(t){return e.includes(t.previewUrl)}));return u(t.filter((function(t){return!e.includes(t.previewUrl)}))),n}),[]),k=(0,o.useCallback)((function(e){var t=Array.from(e.clipboardData.items).filter((function(e){return"file"===e.kind&&W.has(e.type)})).map((function(e){return e.getAsFile()})).filter(Boolean);t.length&&m(t)}),[m]),S=(0,o.useCallback)((function(e){e.dataTransfer.types.includes("Files")&&(e.preventDefault(),h(!0))}),[]),C=(0,o.useCallback)((function(){return h(!1)}),[]),A=(0,o.useCallback)((function(e){e.preventDefault(),h(!1),e.dataTransfer.files.length>0&&m(Array.from(e.dataTransfer.files))}),[m]),T=l.some((function(e){return!P(e.processingStatus)}));return{attachments:l,attachmentError:s,attachmentsInFlight:T,isDragging:f,fileInputRef:g,addFiles:m,removeFile:x,takeAttachments:w,handlePaste:k,handleDragOver:S,handleDragLeave:C,handleDrop:A}}({activeChat:Dt,baseUrl:S,headers:ne}),Vt=Nt.attachments,qt=Nt.attachmentError,Ht=Nt.attachmentsInFlight,Yt=Nt.isDragging,Jt=Nt.fileInputRef,$t=Nt.addFiles,en=Nt.removeFile,nn=Nt.takeAttachments,on=Nt.handlePaste,an=Nt.handleDragOver,ln=Nt.handleDragLeave,un=Nt.handleDrop,cn=yn((0,o.useState)(null),2),mn=cn[0],wn=cn[1],In=yn((0,o.useState)(null),2),_n=In[0],Zn=In[1];(0,o.useEffect)((function(){return Zn(null)}),[Dt]);var Rn=_n?Vt.filter((function(e){return!_n.previewUrls.includes(e.previewUrl)})):Vt,jn=Rn.length>0||!!qt,En=(0,o.useMemo)((function(){var e,t,n,r,o=[];try{for(var i=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(Pt),a=i.next();!a.done;a=i.next()){var l=a.value,u=o[o.length-1];u&&"assistant"===u.role&&"assistant"===l.role?o[o.length-1]=fn(fn({},u),{parts:gn(gn([],yn(null!==(n=u.parts)&&void 0!==n?n:[]),!1),yn(null!==(r=l.parts)&&void 0!==r?r:[]),!1)}):o.push(l)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return o}),[Pt]);(0,o.useEffect)((function(){wt()}),[En,wt]),(0,o.useEffect)((function(){if("ready"===zt){var e=(0,_.Kv)().requestAnimationFrame(wt);return function(){return(0,_.Kv)().cancelAnimationFrame(e)}}}),[zt,wt]);var On=(0,o.useCallback)((function(){return hn(void 0,void 0,void 0,(function(){var e;return vn(this,(function(t){switch(t.label){case 0:return[4,at(S,ne)];case 1:return(e=t.sent())?(De((function(t){return gn(gn([],yn(e.map((function(e){var n;return fn(fn({},e),{chat:null===(n=t.find((function(t){return t.id===e.id})))||void 0===n?void 0:n.chat})}))),!1),yn(t.filter((function(t){return!e.find((function(e){return e.id===t.id}))}))),!1)})),[2]):[2]}}))}))}),[ne,S]);(0,o.useEffect)((function(){oe&&On()}),[oe,On]);var Ln=function(){if(!_n){zn(),et.current=!0;var e=(0,i.Z)(),t=(new Date).toISOString(),n=Ct(null);De((function(r){return gn([{id:e,title:"",created_at:t,updated_at:t,isTemporary:!0,chat:n}],yn(r.filter((function(e){return!e.isTemporary||e.title}))),!1)})),Ke(e)}},Bn=(0,o.useCallback)((function(){et.current=!0;var e=(new Date).toISOString();if(Pe)Wt&&!Wt.title&&De((function(t){return gn([fn(fn({},Wt),{title:"New Chat",updated_at:e})],yn(t.filter((function(e){return e.id!==Pe}))),!1)}));else{var t=(0,i.Z)();De((function(n){return gn([{id:t,title:"New Chat",created_at:e,updated_at:e,isTemporary:!0,chat:Dt}],yn(n),!1)})),Ke(t)}}),[Pe,Wt,Dt]),Mn=function(e){var t=this,n=e.status,r=e.sendMessage,a=e.setMessages,l=e.ensureThread,u=e.voiceActiveRef,c=e.pendingAudioRef,s=e.voiceDataRef,d=Re((0,o.useState)("idle"),2),p=d[0],f=d[1],h=Re((0,o.useState)(_e),1)[0],v=Re((0,o.useState)(0),2),y=v[0],g=v[1],b=Re((0,o.useState)(!1),2),m=b[0],x=b[1],w=(0,o.useRef)("idle"),k=(0,o.useRef)(n),S=(0,o.useRef)(null),C=(0,o.useRef)(null),A=(0,o.useRef)(0),T=(0,o.useRef)(!1),I=(0,o.useCallback)((function(e){w.current=e,f(e)}),[]),_=(0,o.useCallback)((function(){var e,t;u.current&&("ready"!==k.current&&"error"!==k.current||(null===(e=C.current)||void 0===e?void 0:e.isPlaying)||"transcribing"!==w.current&&"thinking"!==w.current&&"speaking"!==w.current||(null===(t=S.current)||void 0===t||t.resume(),I("listening")))}),[u,I]),Z=(0,o.useCallback)((function(e){var t,n;"recording"!==w.current&&"listening"!==w.current||(c.current=e,null===(t=S.current)||void 0===t||t.pause(),null===(n=C.current)||void 0===n||n.skip(),A.current=0,T.current=!1,g(0),I("transcribing"),l(),r({text:""}))}),[c,l,r,I]),R=(0,o.useRef)(Z);R.current=Z;var j=(0,o.useCallback)((function(){return e=t,n=void 0,o=function(){var e,t;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,(function(n){switch(n.label){case 0:return"idle"!==w.current&&"error"!==w.current?[2]:(e=new Te({onSegmentStart:function(){u.current&&I("speaking")},onSegmentProgress:function(e,t){return g(A.current+Math.floor(Ee(e)*t))},onSegmentEnd:function(e){A.current+=Ee(e),g(A.current)},onIdle:function(){x(!1),_()}}),t=new Ie({onSpeechStart:function(){"listening"===w.current&&I("recording")},onUtterance:function(e){return R.current(e)}}),C.current=e,S.current=t,u.current=!0,I("loading"),[4,t.start()]);case 1:return n.sent()?I("listening"):(u.current=!1,I("error")),[2]}}))},new((r=void 0)||(r=Promise))((function(t,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function l(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,l)}u((o=o.apply(e,n||[])).next())}));var e,n,r,o}),[u,_,I]),E=(0,o.useCallback)((function(){var e,t;null===(e=S.current)||void 0===e||e.destroy(),S.current=null,null===(t=C.current)||void 0===t||t.skip(),C.current=null,c.current=null,u.current=!1,I("idle")}),[u,c,I]),O=(0,o.useCallback)((function(){var e;"speaking"===w.current&&(T.current=!0,null===(e=C.current)||void 0===e||e.skip(),g(Number.MAX_SAFE_INTEGER))}),[]);return(0,o.useEffect)((function(){return s.current=function(e){var t,n,r,o,l,c,s;if(u.current)if("data-audio"===e.type)(null===(t=e.data)||void 0===t?void 0:t.done)?null===(n=C.current)||void 0===n||n.end():(null===(r=e.data)||void 0===r?void 0:r.chunk)&&!T.current&&(null===(o=C.current)||void 0===o||o.pushChunk(e.data.chunk));else if("data-segment"===e.type&&(null===(l=e.data)||void 0===l?void 0:l.text)){if(T.current)return;x(!0),null===(c=C.current)||void 0===c||c.pushSegment(e.data.text)}else if("data-transcript"===e.type&&(null===(s=e.data)||void 0===s?void 0:s.text)){var d=e.data.text;"transcribing"===w.current&&I("thinking"),a((function(e){for(var t=e.length-1;t>=0;t--)if("user"===e[t].role){var n=je([],Re(e),!1);return n[t]=Ze(Ze({},e[t]),{parts:[{type:"text",text:d}]}),n}return je(je([],Re(e),!1),[{id:(0,i.Z)(),role:"user",parts:[{type:"text",text:d}]}],!1)}))}},function(){s.current=null}}),[s,u,a,I]),(0,o.useEffect)((function(){k.current=n,"ready"!==n&&"error"!==n||!u.current||a((function(e){var t,n=e[e.length-1],r="user"===(null==n?void 0:n.role)&&!(null!==(t=n.parts)&&void 0!==t?t:[]).some((function(e){var t;return"text"===e.type&&(null!==(t=e.text)&&void 0!==t?t:"").trim()}));return r?e.slice(0,-1):e})),_()}),[n,_,u,a]),(0,o.useEffect)((function(){return function(){return E()}}),[E]),{voiceState:p,voiceActive:"idle"!==p&&"error"!==p,micAvailable:h,spokenChars:y,audioDraining:m,startVoice:j,stopVoice:E,skipSpeaking:O}}({status:zt,sendMessage:function(e){return hn(void 0,void 0,void 0,(function(){return vn(this,(function(t){switch(t.label){case 0:return[4,Et(s)];case 1:return t.sent(),[2,Kt(e)]}}))}))},setMessages:Ut,ensureThread:Bn,voiceActiveRef:dt,pendingAudioRef:bt,voiceDataRef:mt}),Wn=Mn.voiceState,Dn=Mn.voiceActive,Fn=Mn.micAvailable,Pn=Mn.spokenChars,Kn=Mn.audioDraining,Un=Mn.startVoice,zn=Mn.stopVoice,Xn=Mn.skipSpeaking;(0,o.useEffect)((function(){wt()}),[Pn,Kn,wt]);var Nn=function(){return hn(void 0,void 0,void 0,(function(){var e,t,n,r,o;return vn(this,(function(a){switch(a.label){case 0:return"ready"!==zt||_n?[2]:(e=!!Le.trim())||0!==Vt.length?(Bn(),Ht?(t=(0,i.Z)(),n=[],e&&n.push({type:"text",text:Le}),Vt.forEach((function(e){return n.push(V(e))})),Ut(gn(gn([],yn(Pt),!1),[{id:t,role:"user",parts:n}],!1)),Zn({tempId:t,text:Le,previewUrls:Vt.map((function(e){return e.previewUrl}))}),Be(""),[2]):[4,Et(s)]):[2];case 1:return a.sent(),r=nn(),o=r.filter((function(e){return e.id})).map(V),Kt(fn({text:Le},o.length>0?{files:o}:{})),Be(""),r.forEach((function(e){return URL.revokeObjectURL(e.previewUrl)})),[2]}}))}))},Vn=(0,o.useRef)(!1);(0,o.useEffect)((function(){if(_n&&!Vn.current&&!Vt.filter((function(e){return _n.previewUrls.includes(e.previewUrl)})).some((function(e){return!P(e.processingStatus)}))){Vn.current=!0;var e=_n.tempId,t=_n.text,n=_n.previewUrls,r=nn(n),o=r.filter((function(e){return e.id})).map(V);if(!t.trim()&&0===o.length)return Ut((function(t){return t.filter((function(t){return t.id!==e}))})),r.forEach((function(e){return URL.revokeObjectURL(e.previewUrl)})),Vn.current=!1,void Zn(null);hn(void 0,void 0,void 0,(function(){var n;return vn(this,(function(i){switch(i.label){case 0:return[4,Et(s)];case 1:return i.sent(),n=Kt(fn(fn({text:t},o.length>0?{files:o}:{}),{messageId:e})),Vn.current=!1,Zn(null),[4,n.catch((function(){}))];case 2:return i.sent(),r.forEach((function(e){return URL.revokeObjectURL(e.previewUrl)})),[2]}}))}))}}),[_n,Vt]);var qn=We.filter((function(e){return e.title})),Hn="submitted"===zt||"streaming"===zt,Gn={padding:"10px",backgroundColor:St.primary,color:"white",border:"none",borderRadius:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s",":hover:not(:disabled)":{backgroundColor:St.hover},":disabled":{backgroundColor:St.disabled,cursor:"not-allowed"}},Yn="sidebar-left"===le?"left":"sidebar-right"===le?"right":null,Jn=oe&&Yn?de:0,$n=(0,o.useRef)(ee);$n.current=ee,(0,o.useEffect)((function(){var e;null===(e=$n.current)||void 0===e||e.call($n,{mode:le,isOpen:oe,side:Yn,width:Jn,isResizing:he})}),[le,oe,Yn,Jn,he]);var Qn="sidebar-left"===le?w:"sidebar-right"===le?k:"fullscreen"===le?f:x,er="sidebar-left"===le?g:"sidebar-right"===le?b:"fullscreen"===le?m:y,tr="sidebar-left"===le,nr=tr?{left:"20px"}:{right:"20px"},rr=tr?20:Z;if(!oe)return(0,r.tZ)("button",fn({type:"button",onClick:function(){return ie(!0)},css:fn(fn({position:"fixed",bottom:"".concat(rr,"px")},nr),{width:"".concat(56,"px"),height:"".concat(56,"px"),borderRadius:"50%",backgroundColor:St.primary,color:"white",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",transition:"transform 0.2s, box-shadow 0.2s, background-color 0.2s",zIndex:1e3,":hover":{backgroundColor:St.hover,transform:"scale(1.05)",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"}})},{children:(0,r.tZ)(c,{})}));var or="sidebar-left"===le?{top:0,left:0,width:"".concat(de,"px"),height:"100vh",borderRadius:0,boxShadow:"4px 0 24px rgba(0, 0, 0, 0.12)"}:"sidebar-right"===le?{top:0,right:0,width:"".concat(de,"px"),height:"100vh",borderRadius:0,boxShadow:"-4px 0 24px rgba(0, 0, 0, 0.12)"}:"fullscreen"===le?{inset:0,borderRadius:0,boxShadow:"none",border:"none"}:{bottom:"".concat(Z,"px"),right:"20px",width:"".concat(380,"px"),height:"".concat(500,"px"),borderRadius:"12px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.12)",border:"1px solid ".concat(Y)};return(0,r.BX)("div",fn({css:fn({position:"fixed",backgroundColor:"white",display:"flex",flexDirection:"column",overflow:"hidden",zIndex:1e3},or)},{children:[Yn&&(0,r.tZ)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize assistant panel",title:"Drag to resize, double-click to reset",onPointerDown:ye(Yn),onDoubleClick:ge,css:(t={position:"absolute",top:0},t["right"===Yn?"left":"right"]=0,t.width="6px",t.height="100%",t.cursor="col-resize",t.zIndex=2,t.touchAction="none",t.userSelect="none",t["::after"]=(n={content:'""',position:"absolute",top:0},n["right"===Yn?"left":"right"]="2px",n.width="2px",n.height="100%",n.backgroundColor="transparent",n.transition="background-color 120ms ease",n),t[":hover::after"]={backgroundColor:"rgba(0, 0, 0, 0.15)"},t)}),(0,r.BX)("div",fn({css:fn({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"2px",padding:"12px 16px",backgroundColor:St.primary,color:"white",position:"relative"},Yn?{minHeight:"var(--main-nav-height, 55px)",boxSizing:"border-box"}:{})},{children:[(0,r.BX)("div",fn({css:{display:"flex",alignItems:"center",gap:"8px",minWidth:0,flex:1,overflow:"hidden"}},{children:[(0,r.tZ)(c,{}),(0,r.BX)("button",fn({type:"button",onClick:function(){return Xe((function(e){return!e}))},css:{background:"none",border:"none",color:"white",cursor:"pointer",fontWeight:600,fontSize:"14px",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",gap:"4px",minWidth:0,maxWidth:"100%",":hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}},{children:[(0,r.tZ)("span",fn({css:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0}},{children:(null==Wt?void 0:Wt.title)||"AI Assistant"})),(0,r.tZ)("span",fn({css:{display:"flex",opacity:.8,flexShrink:0}},{children:(0,r.tZ)(v,{})}))]}))]})),(0,r.BX)("div",fn({css:{display:"flex",alignItems:"center",gap:"2px",position:"relative",flexShrink:0}},{children:[(0,r.tZ)("button",fn({type:"button",onClick:function(){return Ge((function(e){return!e}))},css:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",":hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}},{children:(0,r.tZ)(er,{})})),(0,r.tZ)("button",fn({type:"button",onClick:function(){zn(),ie(!1)},css:{background:"none",border:"none",color:"white",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",":hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}},{children:(0,r.tZ)(Qn,{})})),He&&(0,r.BX)(r.HY,{children:[(0,r.tZ)("div",{css:{position:"fixed",inset:0,zIndex:1e3},onClick:function(){return Ge(!1)}}),(0,r.tZ)("div",fn({css:{position:"absolute",top:"100%",right:0,marginTop:"4px",minWidth:"180px",backgroundColor:"white",border:"1px solid ".concat(Y),borderRadius:"8px",boxShadow:"0 8px 16px rgba(0,0,0,0.12)",zIndex:1001,overflow:"hidden"}},{children:[{value:"current",label:"Floating",Icon:y},{value:"sidebar-left",label:"Sidebar left",Icon:g},{value:"sidebar-right",label:"Sidebar right",Icon:b},{value:"fullscreen",label:"Fullscreen",Icon:m}].filter((function(e){var t=e.value;return $.includes(t)})).map((function(e){var t=e.value,n=e.label,o=e.Icon;return(0,r.BX)("button",fn({type:"button",onClick:function(){ce(t),Ge(!1)},css:{width:"100%",padding:"10px 14px",background:t===le?St.light:"white",border:"none",cursor:"pointer",fontSize:"13px",color:Q,textAlign:"left",display:"flex",alignItems:"center",gap:"10px",":hover":{backgroundColor:H}}},{children:[(0,r.tZ)("span",fn({css:{display:"flex",color:J,flexShrink:0}},{children:(0,r.tZ)(o,{})})),(0,r.tZ)("span",{children:n})]}),t)}))}))]})]})),ze&&(0,r.BX)(r.HY,{children:[(0,r.tZ)("div",{css:{position:"fixed",inset:0,zIndex:1e3},onClick:function(){return Xe(!1)}}),(0,r.BX)("div",fn({css:{position:"absolute",top:"100%",left:0,width:"100%",backgroundColor:"white",border:"1px solid ".concat(Y),borderTop:"none",borderRadius:"0 0 8px 8px",boxShadow:"0 8px 16px rgba(0,0,0,0.12)",zIndex:1001,maxHeight:"240px",overflowY:"scroll"}},{children:[(0,r.tZ)("button",fn({type:"button",onClick:function(){Ln(),Xe(!1)},css:{width:"100%",padding:"10px 14px",background:"none",border:"none",borderBottom:"1px solid ".concat(G),cursor:"pointer",fontSize:"13px",fontWeight:600,color:St.primary,textAlign:"left",":hover":{backgroundColor:H}}},{children:"+ New Chat"})),0===qn.length&&(0,r.tZ)("div",fn({css:{padding:"12px 14px",fontSize:"13px",color:J}},{children:"No chats yet"})),qn.map((function(e){return(0,r.BX)("div",fn({onClick:function(){return t=e.id,hn(void 0,void 0,void 0,(function(){var e,n,r,o;return vn(this,(function(i){switch(i.label){case 0:return _n?[2]:(zn(),et.current=!0,(null===(r=We.find((function(e){return e.id===t})))||void 0===r?void 0:r.chat)?(Ke(t),Xe(!1),[2]):[4,lt(S,ne,t)]);case 1:return(e=i.sent())?(n=Ct(t,null!==(o=e.messages)&&void 0!==o?o:[],e.title),De((function(r){return r.map((function(r){return r.id===t?fn(fn({},e),{chat:n}):r}))})),Ke(t),Xe(!1),[2]):[2]}}))}));var t},css:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px",cursor:"pointer",backgroundColor:e.id===Pe?St.light:"white",":hover":{backgroundColor:H}}},{children:[(0,r.BX)("div",fn({css:{flex:1,minWidth:0}},{children:[(0,r.tZ)("div",fn({css:{fontSize:"13px",fontWeight:500,color:Q,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:e.title||"Untitled conversation"})),(0,r.tZ)("div",fn({css:{fontSize:"11px",color:J,marginTop:"2px"}},{children:new Date(e.updated_at).toLocaleDateString()}))]})),(0,r.tZ)("button",fn({type:"button",onClick:function(t){return function(e,t){return hn(void 0,void 0,void 0,(function(){var n;return vn(this,(function(r){switch(r.label){case 0:return t.stopPropagation(),(null==(n=We.find((function(t){return t.id===e})))?void 0:n.isTemporary)?[3,2]:[4,ut(S,ne,e)];case 1:r.sent(),r.label=2;case 2:return De((function(t){return t.filter((function(t){return t.id!==e}))})),Pe===e&&Ln(),[2]}}))}))}(e.id,t)},css:{background:"none",border:"none",cursor:"pointer",color:J,fontSize:"16px",padding:"2px 6px",marginLeft:"8px",borderRadius:"4px",lineHeight:1,":hover":{color:"#dc2626",backgroundColor:"#fef2f2"}}},{children:"×"}))]}),e.id)}))]}))]})]})),(0,r.BX)("div",fn({ref:Qe,onScroll:xt,css:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"12px"}},{children:[0===En.length&&(0,r.tZ)("div",fn({css:{textAlign:"center",color:J,fontSize:"14px",marginTop:"40px"}},{children:"How can I help?"})),En.map((function(e,t){var n,i,a,l,u,c,s,d,p,f;return"user"===e.role?(null!==(n=e.parts)&&void 0!==n?n:[]).some((function(e){var t;return"text"===e.type&&(null!==(t=e.text)&&void 0!==t?t:"").trim()||"file"===e.type}))?(0,r.BX)("div",fn({css:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:"6px"}},{children:[(0,r.tZ)("div",fn({css:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:"6px"}},{children:(null!==(i=e.parts)&&void 0!==i?i:[]).filter((function(e){return"file"===e.type})).map((function(t,n){var o;return(0,r.tZ)(me,{mediaType:null!==(o=t.mediaType)&&void 0!==o?o:"",filename:t.filename,url:t.url,inFlight:(null==_n?void 0:_n.tempId)===e.id,onOpen:function(){var e;return wn({url:t.url,mediaType:null!==(e=t.mediaType)&&void 0!==e?e:"",filename:t.filename})}},"file-".concat(n))}))})),(null!==(a=e.parts)&&void 0!==a?a:[]).some((function(e){var t;return"text"===e.type&&(null!==(t=e.text)&&void 0!==t?t:"").trim()}))&&(0,r.tZ)("div",fn({css:{maxWidth:"80%",padding:"10px 14px",borderRadius:"12px",fontSize:"14px",lineHeight:"1.5",backgroundColor:St.primary,color:"white",overflowWrap:"anywhere",wordBreak:"break-word"}},{children:e.parts.filter((function(e){return!e.hidden})).map((function(e,t){return"text"===e.type?(0,r.tZ)("span",{children:e.text},t):null}))}))]}),e.id):null:(0,r.tZ)(o.Fragment,{children:(l=t===En.length-1,u=function(e){var t=[];return e.forEach((function(e,n){if("text"===e.type&&e.text.trim()){var r=t[t.length-1];r&&"text"===r.kind?r.text="".concat(r.text,"\n\n").concat(e.text):t.push({kind:"text",key:"text-".concat(n),text:e.text})}else{var o=function(e){if("text"===(null==e?void 0:e.type))return{kind:"text"};var t="string"==typeof(null==e?void 0:e.type)&&e.type.startsWith("tool-"),n="dynamic-tool"===(null==e?void 0:e.type);return t||n?{kind:"tool",toolName:t?e.type.replace("tool-",""):e.toolName||"unknown"}:null}(e);if(o&&"tool"===o.kind&&o.toolName){var i={key:"tool-".concat(n),toolName:o.toolName,state:e.state,input:e.input,output:e.output},a=t[t.length-1];a&&"tools"===a.kind?a.rows.push(i):t.push({kind:"tools",key:"tools-".concat(n),rows:[i]})}}})),t}(e.parts),c=e.parts[e.parts.length-1],s=!l||"ready"===zt&&"text"===(null==c?void 0:c.type),d=dt.current&&l&&(Hn||Kn),p=d?Pn:1/0,f=!1,u.map((function(e,t){if(f)return null;if("text"===e.kind){for(var n=0;n<e.text.length&&(p>0||/\s/.test(e.text[n]));)/\s/.test(e.text[n])||(p-=1),n+=1;return n<e.text.length&&(f=!0),n<=0?null:(0,r.tZ)("div",fn({css:{display:"flex",justifyContent:"flex-start"}},{children:(0,r.tZ)("div",fn({css:{maxWidth:"80%",padding:"10px 14px",borderRadius:"12px",fontSize:"14px",lineHeight:"1.5",backgroundColor:St.light,color:Q,overflowWrap:"anywhere",wordBreak:"break-word"}},{children:(0,r.tZ)(tt,{text:e.text.slice(0,n),isStreaming:Hn&&l&&t===u.length-1})}))}),e.key)}var o=u.slice(t+1).some((function(e){return"text"===e.kind})),i=d&&o&&p<=0;return(0,r.tZ)("div",fn({css:{display:"flex",justifyContent:"flex-start",maxWidth:"80%",minWidth:0}},{children:(0,r.tZ)(Ne,{rows:e.rows,turnFinished:s,followedByText:o,audioPending:i,linkColor:St.primary,isFirstChunk:0===t})}),e.key)})))},e.id)})),function(){var e;if(!Hn)return null;var t=En[En.length-1];if(!t)return null;var n=t.parts||[],o=function(e){var t;if("text"===(null==e?void 0:e.type))return(null!==(t=e.text)&&void 0!==t?t:"").trim().length>0;var n="string"==typeof(null==e?void 0:e.type)?e.type:"";return n.startsWith("tool-")||"dynamic-tool"===n},i=n.some(o);if("user"===t.role){if(!i)return null}else{var a=dt.current&&Pn<=0&&"text"===(null===(e=n.find(o))||void 0===e?void 0:e.type);if(i&&!a)return null}return(0,r.tZ)(qe,{})}(),_n&&(0,r.tZ)(qe,{label:"Uploading..."}),Xt&&(0,r.tZ)("div",fn({css:{padding:"10px 14px",borderRadius:"8px",backgroundColor:"#fef2f2",color:"#dc2626",fontSize:"14px"}},{children:"Something went wrong. Please try again."}))]})),K.length>0&&(0,r.BX)("div",fn({css:{position:"relative",zIndex:1,borderTop:"1px solid ".concat(Y),backgroundColor:H,padding:"8px 16px",display:"flex",gap:"6px",overflowX:"auto"}},{children:[K.map((function(e,t){return(0,r.tZ)("button",fn({type:"button",disabled:Hn,onClick:function(){return function(e){return hn(void 0,void 0,void 0,(function(){return vn(this,(function(t){switch(t.label){case 0:return"ready"!==zt?[2]:(Bn(),[4,Et(s)]);case 1:return t.sent(),Kt({parts:[{type:"text",text:e.name},{type:"text",text:e.instructions,hidden:!0,interpolate:!0}]}),[2]}}))}))}(e)},onMouseEnter:function(t){if(e.description){var n=t.currentTarget.getBoundingClientRect();$e({text:e.description,x:n.left+n.width/2,y:n.top})}},onMouseLeave:function(){return $e(null)},css:{flexShrink:0,padding:"4px 10px",fontSize:"12px",border:"1px solid ".concat(St.primary),borderRadius:"12px",backgroundColor:"white",color:St.primary,cursor:"pointer",whiteSpace:"nowrap",":disabled":{opacity:.5,cursor:"not-allowed"},":hover:not(:disabled)":{backgroundColor:St.light},transition:"background-color 0.15s, color 0.15s"}},{children:e.name}),t)})),Je&&(0,r.tZ)("div",fn({css:{position:"fixed",top:Je.y-34,left:Je.x,transform:"translateX(-50%)",backgroundColor:"rgba(0,0,0,0.9)",color:"white",fontSize:"12px",padding:"4px 8px",borderRadius:"4px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:1e4}},{children:Je.text}))]})),jn&&(0,r.BX)("div",fn({css:{display:"flex",flexWrap:"wrap",gap:"8px",padding:"10px 16px 0",borderTop:"1px solid ".concat(Y),backgroundColor:H}},{children:[qt&&(0,r.tZ)("div",fn({css:{fontSize:"12px",color:"#dc2626",width:"100%"}},{children:qt})),Rn.map((function(e){return(0,r.tZ)(be,{attachment:e,onRemove:function(){return en(e.previewUrl)}},e.previewUrl)}))]})),(0,r.BX)("div",fn({onDragOver:an,onDragLeave:ln,onDrop:un,css:fn({display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",borderTop:jn?"none":"1px solid ".concat(Y),backgroundColor:H},Yt?{outline:"2px dashed ".concat(St.primary),outlineOffset:"-4px"}:{})},{children:[!Dn&&(0,r.BX)(r.HY,{children:[(0,r.tZ)("input",{ref:Jt,type:"file",multiple:!0,accept:D,onChange:function(e){var t,n=Array.from(null!==(t=e.target.files)&&void 0!==t?t:[]);n.length&&$t(n),e.target.value=""},css:{display:"none"}}),(0,r.tZ)("button",fn({type:"button",onClick:function(){var e;return null===(e=Jt.current)||void 0===e?void 0:e.click()},disabled:Hn,"aria-label":"Attach files",css:{padding:"10px",backgroundColor:"transparent",color:Q,border:"1px solid ".concat(Y),borderRadius:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s",":hover:not(:disabled)":{backgroundColor:G},":disabled":{cursor:"not-allowed",color:J}}},{children:(0,r.tZ)(T,{})}))]}),Dn?(0,r.BX)("button",fn({type:"button",onClick:"speaking"===Wn?Xn:void 0,css:{flex:1,display:"flex",alignItems:"center",gap:"8px",padding:"10px 14px",border:"1px solid ".concat(Y),borderRadius:"8px",backgroundColor:"white",fontSize:"14px",color:Q,cursor:"speaking"===Wn?"pointer":"default"}},{children:[(0,r.tZ)(A,{css:{color:St.primary}}),"loading"===Wn?"Loading…":"transcribing"===Wn?"Transcribing…":"thinking"===Wn?"Thinking…":"speaking"===Wn?"Tap to skip":"Listening…"]})):(0,r.tZ)("input",{type:"text",value:Le,onChange:function(e){return Be(e.target.value)},onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),e.stopPropagation(),Nn())},onPaste:on,placeholder:"Type a message...",css:{flex:1,padding:"10px 14px",border:"1px solid ".concat(Y),borderRadius:"8px",fontSize:"14px",outline:"none",transition:"border-color 0.2s",":focus":{borderColor:St.primary}}}),Dn?(0,r.tZ)("button",fn({type:"button",onClick:zn,"aria-label":"Exit voice mode",css:Gn},{children:(0,r.tZ)(f,{})})):!B||Le.trim()||Vt.length>0?(0,r.tZ)("button",fn({type:"button",onClick:Nn,disabled:Hn||!!_n||!Le.trim()&&0===Vt.length,css:Gn},{children:(0,r.tZ)(d,{})})):(0,r.tZ)("button",fn({type:"button",onClick:Un,disabled:Hn||!Fn,"aria-label":"Start voice mode",title:Fn?void 0:"Microphone unavailable",css:Gn},{children:(0,r.tZ)(C,{})}))]})),mn&&(0,r.tZ)(xe,{preview:mn,onClose:function(){return wn(null)}})]}))}}}]);
|