@feathery/react 2.50.1 → 2.51.1

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.
Files changed (145) hide show
  1. package/cjs/Form/index.d.ts.map +1 -1
  2. package/cjs/assistant/AssistantChat.d.ts +2 -1
  3. package/cjs/assistant/AssistantChat.d.ts.map +1 -1
  4. package/cjs/assistant/ToolStatus.d.ts +2 -1
  5. package/cjs/assistant/ToolStatus.d.ts.map +1 -1
  6. package/cjs/assistant/icons.d.ts +2 -0
  7. package/cjs/assistant/icons.d.ts.map +1 -1
  8. package/cjs/assistant/voice/audioPlayer.d.ts +30 -0
  9. package/cjs/assistant/voice/audioPlayer.d.ts.map +1 -0
  10. package/cjs/assistant/voice/useAssistantVoice.d.ts +34 -0
  11. package/cjs/assistant/voice/useAssistantVoice.d.ts.map +1 -0
  12. package/cjs/assistant/voice/voiceMic.d.ts +17 -0
  13. package/cjs/assistant/voice/voiceMic.d.ts.map +1 -0
  14. package/cjs/{fthry_AssistantChat.Bv_PnXs-.js → fthry_AssistantChat.B45jvKBe.js} +662 -153
  15. package/cjs/{fthry_FormControl.BAksZlDz.js → fthry_FormControl.EOj0LE3M.js} +1 -1
  16. package/cjs/{fthry_InlineTooltip.DplyptTz.js → fthry_InlineTooltip.BhdsWEoD.js} +1 -1
  17. package/cjs/{fthry_PaymentMethodField.DpnN0V1H.js → fthry_PaymentMethodField.DYVjg4Fj.js} +3 -3
  18. package/cjs/{fthry_Placeholder.5Mvr4ask.js → fthry_Placeholder.CcwNoUeW.js} +1 -1
  19. package/cjs/{fthry_ShowEyeIcon.5HKujzSD.js → fthry_ShowEyeIcon.DuZqZCnN.js} +1 -1
  20. package/cjs/{fthry_TabsElement.CxiHTqRU.js → fthry_TabsElement.COJxjNgU.js} +1 -1
  21. package/cjs/{fthry_auto-track.DV30-QdL.js → fthry_auto-track.B15NDwyR.js} +2 -2
  22. package/cjs/{fthry_highlighted-body-TPN3WLV5.CtyrCPuE.js → fthry_highlighted-body-TPN3WLV5.DVEo7HUb.js} +3 -3
  23. package/cjs/{fthry_index.D0tdVxWg.js → fthry_index.2QppVzJs.js} +7 -7
  24. package/cjs/fthry_index.5X9_5jk4.js +4107 -0
  25. package/cjs/{fthry_index.DXBYYUOP.js → fthry_index.5xuF2U9h.js} +1 -1
  26. package/cjs/{fthry_index.lC_5XhON.js → fthry_index.B4C3wGGx.js} +35 -33
  27. package/cjs/{fthry_index.0UtK4ObD.js → fthry_index.B7S5dgOG.js} +2 -2
  28. package/cjs/{fthry_index.DmtMegnj.js → fthry_index.BBp1wUpf.js} +4 -4
  29. package/cjs/{fthry_index.9V9ezpt1.js → fthry_index.BU6ItWDI.js} +4 -4
  30. package/cjs/{fthry_index.CG2qDLCN.js → fthry_index.BkdG1KiI.js} +3 -3
  31. package/cjs/{fthry_index.B-vFxNO_.js → fthry_index.BoejAzGy.js} +5 -5
  32. package/cjs/{fthry_index.DBDbbLL1.js → fthry_index.CDnYVEIO.js} +2 -2
  33. package/cjs/{fthry_index.B2kwLyNr.js → fthry_index.CEqgOh3U.js} +1 -1
  34. package/cjs/{fthry_index.DO90MI7L.js → fthry_index.CJ3Hch09.js} +1 -1
  35. package/cjs/{fthry_index.DFZUCN27.js → fthry_index.CacFIYgr.js} +1 -1
  36. package/cjs/{fthry_index.GZc-hNji.js → fthry_index.Cmuje9sY.js} +4 -4
  37. package/cjs/{fthry_index.C5BkZnrm.js → fthry_index.CqhOLSKT.js} +5 -5
  38. package/cjs/{fthry_index.BQKxTWNQ.js → fthry_index.CvfYbjM3.js} +2 -2
  39. package/cjs/{fthry_index.Bp0-0Hpt.js → fthry_index.CyHvGApA.js} +4 -4
  40. package/cjs/{fthry_index.D698F2zZ.js → fthry_index.D0m2Paql.js} +5 -5
  41. package/cjs/{fthry_index.CB082HFt.js → fthry_index.DJW8jwjF.js} +5 -5
  42. package/cjs/{fthry_index.DSxhyu57.js → fthry_index.DNDEeQCP.js} +1 -1
  43. package/cjs/{fthry_index.BUVzO2k5.js → fthry_index.DOmwK88R.js} +1 -1
  44. package/cjs/{fthry_index.CXiwWMaB.js → fthry_index.DPeoLKPF.js} +1 -1
  45. package/cjs/{fthry_index.DNf7jYzX.js → fthry_index.DaU9mnVx.js} +3 -3
  46. package/cjs/{fthry_index.B9iGCw8F.js → fthry_index.DjKpsFXX.js} +2 -2
  47. package/cjs/{fthry_index.BPYIEjMq.js → fthry_index.DzwfTsQg.js} +10 -10
  48. package/cjs/{fthry_index.CVkyw_dk.js → fthry_index.HB6IRHEd.js} +2 -2
  49. package/cjs/{fthry_index.Byf43ZJS.js → fthry_index.RBFHmwlK.js} +3 -3
  50. package/cjs/{fthry_index.Cbfqikpc.js → fthry_index.Z-VNWfPY.js} +2 -2
  51. package/cjs/{fthry_index.Dx62aGHl.js → fthry_index.isQxfXbE.js} +1 -1
  52. package/cjs/{fthry_index.C_0LGAaW.js → fthry_index.j-6Dmxvi.js} +1 -1
  53. package/cjs/{fthry_index.CXpQuMt1.js → fthry_index.l-vIwCek.js} +1 -1
  54. package/cjs/{fthry_index.OHud4Plq.js → fthry_index.sb9ekedx.js} +2 -2
  55. package/cjs/{fthry_index.umd.DCBQBTfy.js → fthry_index.umd.BsAzT2x5.js} +1 -1
  56. package/cjs/{fthry_input.3B0IH5fK.js → fthry_input.BN_eHBxf.js} +1 -1
  57. package/cjs/fthry_logging.B-EvoWue.js +24 -0
  58. package/cjs/fthry_logging.DwsvHsLI.js +29 -0
  59. package/cjs/{fthry_mermaid-O7DHMXV3.BwkCSjZC.js → fthry_mermaid-O7DHMXV3.Dk3DbMjU.js} +3 -3
  60. package/cjs/{fthry_script.Dfvbhz8G.js → fthry_script.CMlEfgqJ.js} +1 -1
  61. package/cjs/{fthry_styles.BecNWwfa.js → fthry_styles.CDAJkFkv.js} +1 -1
  62. package/cjs/{fthry_useElementSize.D9fwVm32.js → fthry_useElementSize.CdR9C9j1.js} +1 -1
  63. package/cjs/{fthry_useSalesforceSync.B8WpZf2e.js → fthry_useSalesforceSync.BbSpWhT1.js} +1 -1
  64. package/cjs/{fthry_webfontloader.maDTrAYi.js → fthry_webfontloader.CRX0Ppbc.js} +1 -1
  65. package/cjs/index.js +1 -1
  66. package/cjs/thumbnail-renderer.js +1 -1
  67. package/cjs/utils/formHelperFunctions.d.ts +1 -0
  68. package/cjs/utils/formHelperFunctions.d.ts.map +1 -1
  69. package/dist/Form/index.d.ts.map +1 -1
  70. package/dist/assistant/AssistantChat.d.ts +2 -1
  71. package/dist/assistant/AssistantChat.d.ts.map +1 -1
  72. package/dist/assistant/ToolStatus.d.ts +2 -1
  73. package/dist/assistant/ToolStatus.d.ts.map +1 -1
  74. package/dist/assistant/icons.d.ts +2 -0
  75. package/dist/assistant/icons.d.ts.map +1 -1
  76. package/dist/assistant/voice/audioPlayer.d.ts +30 -0
  77. package/dist/assistant/voice/audioPlayer.d.ts.map +1 -0
  78. package/dist/assistant/voice/useAssistantVoice.d.ts +34 -0
  79. package/dist/assistant/voice/useAssistantVoice.d.ts.map +1 -0
  80. package/dist/assistant/voice/voiceMic.d.ts +17 -0
  81. package/dist/assistant/voice/voiceMic.d.ts.map +1 -0
  82. package/dist/{fthry_AssistantChat.BWUYjfwA.js → fthry_AssistantChat.DT_xLu9j.js} +662 -153
  83. package/dist/{fthry_FormControl.gQmC3Q_5.js → fthry_FormControl.CjDYAhmh.js} +1 -1
  84. package/dist/{fthry_InlineTooltip.M1XQiZpn.js → fthry_InlineTooltip.BXJBh9xO.js} +1 -1
  85. package/dist/{fthry_PaymentMethodField.DEs0It74.js → fthry_PaymentMethodField.Bmc0ADLl.js} +3 -3
  86. package/dist/{fthry_Placeholder.B8e4W9VJ.js → fthry_Placeholder.D2CT1bF2.js} +1 -1
  87. package/dist/{fthry_ShowEyeIcon.DdLap_w9.js → fthry_ShowEyeIcon.2gnnZQwI.js} +1 -1
  88. package/dist/{fthry_TabsElement.DpJTusbm.js → fthry_TabsElement.CmDA3WMs.js} +1 -1
  89. package/dist/{fthry_auto-track.HTzxPnUa.js → fthry_auto-track.C318Fmfp.js} +2 -2
  90. package/dist/{fthry_highlighted-body-TPN3WLV5.kj3f_DpN.js → fthry_highlighted-body-TPN3WLV5.DvjFQ-wQ.js} +3 -3
  91. package/dist/{fthry_index.CIqCJp4_.js → fthry_index.BAS9Rj3B.js} +4 -4
  92. package/dist/{fthry_index.CVJtI2Xl.js → fthry_index.BBVonB9-.js} +1 -1
  93. package/dist/{fthry_index.CkW0oER4.js → fthry_index.BGwZT3G8.js} +5 -5
  94. package/dist/{fthry_index.DfrV6A68.js → fthry_index.BIOOaSUh.js} +4 -4
  95. package/dist/{fthry_index.DzM7hukc.js → fthry_index.BMLNnooL.js} +2 -2
  96. package/dist/{fthry_index.BBhLiIOO.js → fthry_index.BdT62ac-.js} +4 -4
  97. package/dist/{fthry_index.BDiGpbY8.js → fthry_index.Bh5Hgqlr.js} +2 -2
  98. package/dist/{fthry_index.DXY-WeCY.js → fthry_index.BiAwHsSn.js} +4 -4
  99. package/dist/{fthry_index.D4NYHwF9.js → fthry_index.BmPja_lN.js} +7 -7
  100. package/dist/{fthry_index.Dt6zQK3e.js → fthry_index.BxsXFBiA.js} +4 -4
  101. package/dist/{fthry_index.CyvJ8-bB.js → fthry_index.CHcVd9z4.js} +2 -2
  102. package/dist/{fthry_index.ptJrcCPy.js → fthry_index.CI4tFg9l.js} +36 -34
  103. package/dist/{fthry_index.C4_1X7GA.js → fthry_index.CREmWhTB.js} +5 -5
  104. package/dist/{fthry_index.DTmSNKnS.js → fthry_index.CSdrmFzH.js} +5 -5
  105. package/dist/{fthry_index.r1TNpIHy.js → fthry_index.CUyyWToU.js} +1 -1
  106. package/dist/{fthry_index.D0Cgvg7i.js → fthry_index.ClcVCvSd.js} +3 -3
  107. package/dist/{fthry_index.Bo8U-enX.js → fthry_index.CmEl9AjF.js} +1 -1
  108. package/dist/{fthry_index.CNFIYUXl.js → fthry_index.CxZihOJg.js} +2 -2
  109. package/dist/{fthry_index.CWe8WGnw.js → fthry_index.D0VQUqXz.js} +1 -1
  110. package/dist/{fthry_index.D1WDrqdZ.js → fthry_index.D2U9Y4Jc.js} +1 -1
  111. package/dist/fthry_index.D7coWJsd.js +4105 -0
  112. package/dist/{fthry_index.Dav1_JFe.js → fthry_index.DGl27K_w.js} +1 -1
  113. package/dist/{fthry_index.D7yot10w.js → fthry_index.DlEhwT48.js} +1 -1
  114. package/dist/{fthry_index.Bx652TAg.js → fthry_index.Dmsa_IWB.js} +1 -1
  115. package/dist/{fthry_index.C0iUe75-.js → fthry_index.Dvdg0UC6.js} +1 -1
  116. package/dist/{fthry_index.DIAR7NXW.js → fthry_index.DxoyRmcK.js} +2 -2
  117. package/dist/{fthry_index.BNN_GnRE.js → fthry_index.SqN7TeCH.js} +2 -2
  118. package/dist/{fthry_index.B8mrrhCT.js → fthry_index.Vno16k5B.js} +3 -3
  119. package/dist/{fthry_index.znErF4eB.js → fthry_index.ZMPDKzng.js} +2 -2
  120. package/dist/{fthry_index.CQOB3Ugj.js → fthry_index.cZ4fV2Jh.js} +3 -3
  121. package/dist/{fthry_index.Bq05T75f.js → fthry_index.eGwSNYvd.js} +1 -1
  122. package/dist/{fthry_index.DpXk-u8o.js → fthry_index.fOZIYWtf.js} +10 -10
  123. package/dist/{fthry_index.umd.C9mURNOx.js → fthry_index.umd.xldORs1x.js} +1 -1
  124. package/dist/{fthry_input.C-ByVjA4.js → fthry_input.6Rwsft76.js} +1 -1
  125. package/dist/fthry_logging.B1LWsZ3K.js +22 -0
  126. package/dist/fthry_logging.DWvo9mx5.js +27 -0
  127. package/dist/fthry_mermaid-O7DHMXV3.CpHtnz5w.js +8 -0
  128. package/dist/{fthry_script.DvAaqiBk.js → fthry_script.DNhdCztr.js} +1 -1
  129. package/dist/{fthry_styles.DwzdoBlX.js → fthry_styles.DPXDsQxq.js} +1 -1
  130. package/dist/{fthry_useElementSize.9DmbhgBu.js → fthry_useElementSize.orrnTjTM.js} +1 -1
  131. package/dist/{fthry_useSalesforceSync.qRdq0wu3.js → fthry_useSalesforceSync.C66IFKe6.js} +1 -1
  132. package/dist/{fthry_webfontloader.B5npG4_8.js → fthry_webfontloader.BZYYUrT8.js} +1 -1
  133. package/dist/index.js +2 -2
  134. package/dist/thumbnail-renderer.js +1 -1
  135. package/dist/utils/formHelperFunctions.d.ts +1 -0
  136. package/dist/utils/formHelperFunctions.d.ts.map +1 -1
  137. package/package.json +2 -1
  138. package/umd/129.ec2bd9be8700ef0450ee.js +1 -0
  139. package/umd/762.4a580055e4cb2c97c28f.js +2 -0
  140. package/umd/762.4a580055e4cb2c97c28f.js.LICENSE.txt +56 -0
  141. package/umd/968.2ad2025393b417351f94.js +1 -0
  142. package/umd/AssistantChat.f4f1a5ab9a911c339fd1.js +1 -0
  143. package/umd/index.js +1 -1
  144. package/dist/fthry_mermaid-O7DHMXV3.BLTan-1s.js +0 -8
  145. package/umd/AssistantChat.4c90e588cefb3c7dcc90.js +0 -1
@@ -1,8 +0,0 @@
1
- export { u as Mermaid } from './fthry_AssistantChat.BWUYjfwA.js';
2
- import './fthry_index.ptJrcCPy.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.r1TNpIHy.js';
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunkFeathery=this.webpackChunkFeathery||[]).push([[917],{63450:(e,t,n)=>{n.r(t),n.d(t,{default:()=>yt});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)},d=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"})}))},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)("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"})]}))},f=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"}})]}))},p=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"})]}))},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)("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"})]}))},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)("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"})]}))},A="#6b7280",_="#f9fafb",C="#e5e7eb",I="#9ca3af",T="#6b7280",Z="#1f2937",R="#ef4444",L=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"))},j=function(){return j=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},j.apply(this,arguments)},B=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))},E={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"},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"},getPanelSnapshot:{running:"Reading the form...",done:"Reviewed the form"},getFuserSnapshot:{running:"Looking up your submission...",done:"Reviewed the submission"},getExtractionSnapshot:{running:"Reading extraction setup...",done:"Reviewed the extraction setup"},getExtractionResults:{running:"Reading extraction results...",done:"Reviewed the extraction results"},listFormExtractions:{running:"Looking up extractions...",done:"Reviewed available extractions"},getLogicRules:{running:"Reading form logic...",done:"Reviewed form logic"},listFormHubs:{running:"Looking up records on file...",done:"Reviewed available records"},getHubSchema:{running:"Reading record setup...",done:"Reviewed the record setup"},queryHub:{running:"Searching records on file...",done:"Searched the records on file"}},z=function(e){try{var t=new URL(e);return t.hostname+("/"!==t.pathname?t.pathname:"")}catch(t){return e}},W=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,O([],B(r(t.web)),!1)),Array.isArray(t.news)&&n.push.apply(n,O([],B(r(t.news)),!1)),Array.isArray(t.images)&&n.push.apply(n,O([],B(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))):[]},K=function(e){return"input-streaming"===e||"input-available"===e},M=function(e){return"output-error"===e.state||"object"==typeof e.output&&null!==e.output&&!1===e.output.ok},F=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=W(n.output);return l||u.length>0?(0,r.BX)("div",j({css:{display:"flex",flexDirection:"column",gap:"4px",paddingLeft:"".concat(a,"px"),marginTop:"2px",marginBottom:"4px"}},{children:[l&&(0,r.BX)("div",j({css:{color:I,fontSize:"12px",fontStyle:"italic"}},{children:['"',l.length>80?l.substring(0,80)+"...":l,'"']})),u.map((function(e,t){return(0,r.BX)("a",j({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",j({css:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:z(e)}))]}),t)}))]})):null},N=function(e){var t;return!!(null===(t=e.input)||void 0===t?void 0:t.query)||W(e.output).length>0},X=function(e){var t,n,r=E[e.toolName]||{running:"Working...",done:"Done"};return K(e.state)?r.running:M(e)?null!==(t=r.done)&&void 0!==t?t:"Failed":null!==(n=r.done)&&void 0!==n?n:r.running},D={backgroundImage:"linear-gradient(90deg, ".concat(T," 25%, #d1d5db 50%, ").concat(T," 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"}}},P=function(e){var t=e.rows,n=e.followedByText,i=e.turnFinished,a=e.linkColor,l=void 0===a?A:a,u=e.isFirstChunk,d=void 0!==u&&u,c=t.some((function(e){return K(e.state)})),f=!c&&(n||i),h=!(!c&&n),v=B((0,o.useState)(null),2),y=v[0],g=v[1],m=null!=y?y:h,b=function(){return g(!m)},x=j({display:"flex",flexDirection:"column",gap:"2px",fontSize:"13px",minWidth:0,paddingLeft:"".concat(14,"px")},d?{}:{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)"}}}),w=t.filter((function(e){return e.toolName in E}));if(f&&1===w.length){var k=w[0],S=M(k),_=N(k);return(0,r.BX)("div",j({css:x},{children:[(0,r.BX)("button",j({type:"button",onClick:_?b:void 0,css:{display:"inline-flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"4px 0",cursor:_?"pointer":"default",color:T,textAlign:"left",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[S&&(0,r.tZ)(p,{css:{width:"12px",height:"12px",color:R}}),(0,r.tZ)("span",{children:X(k)}),_&&(0,r.tZ)(s,{css:{width:"12px",height:"12px",color:I,transform:m?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),_&&m&&(0,r.tZ)(F,{row:k,linkColor:l,indent:6})]}))}var Z=f?"Finished working":"Working on it...",L=w.length>0;return(0,r.BX)("div",j({css:x},{children:[(0,r.BX)("button",j({type:"button",onClick:L?b:void 0,css:{display:"inline-flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"4px 0",cursor:L?"pointer":"default",color:T,textAlign:"left",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[(0,r.tZ)("span",j({css:f?void 0:D},{children:Z})),L&&(0,r.tZ)(s,{css:{width:"12px",height:"12px",color:I,transform:m?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),L&&m&&(0,r.tZ)("div",j({css:{display:"flex",flexDirection:"column",gap:"2px",marginLeft:"5px",paddingLeft:"13px",borderLeft:"2px solid ".concat(C)}},{children:w.map((function(e){return(0,r.tZ)(V,{row:e,linkColor:l},e.key)}))}))]}))},V=function(e){var t=e.row,n=e.linkColor,i=N(t),a=K(t.state),l=M(t),u=B((0,o.useState)(null),2),d=u[0],c=u[1],v=null!=d?d:a,y=i?"button":"div";return(0,r.BX)("div",j({css:{display:"flex",flexDirection:"column",gap:"2px"}},{children:[(0,r.BX)(y,j({type:i?"button":void 0,onClick:i?function(){return c(!v)}:void 0,css:{display:"inline-flex",alignItems:"center",gap:"6px",color:l?R:T,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)(f,{css:{width:"12px",height:"12px"}}):l?(0,r.tZ)(p,{css:{width:"12px",height:"12px"}}):(0,r.tZ)(h,{css:{width:"12px",height:"12px"}}),(0,r.tZ)("span",j({css:a?D:void 0},{children:X(t)})),i&&(0,r.tZ)(s,{css:{width:"10px",height:"10px",color:I,transform:v?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),i&&v&&(0,r.tZ)(F,{row:t,linkColor:n})]}))},q=function(){return(0,r.tZ)("div",j({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",j({css:{padding:"4px 0",color:T,fontSize:"13px",alignSelf:"flex-start"}},{children:(0,r.tZ)("span",j({css:D},{children:"Working on it..."}))}))}))},H=n(70917),Y=n(14123),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)},J=(0,H.iv)({color:"#2563eb",fontWeight:400,textDecoration:"underline",textUnderlineOffset:"0.12em",textDecorationSkipInk:"auto",overflowWrap:"break-word","&:visited":{color:"#6d28d9"},"&:hover":{color:"#1d4ed8"}}),$=(0,H.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'),G={a:function(e){var t=e.href,n=e.children;return(0,r.tZ)("a",U({href:t,target:"_blank",rel:"noopener noreferrer",css:J},{children:n}))}},Q=(0,o.memo)((function(e){var t=e.text,n=e.isStreaming,o=void 0!==n&&n;return(0,r.tZ)("div",U({css:$},{children:(0,r.tZ)(Y.qI,U({components:G,isAnimating:o,parseIncompleteMarkdown:o},{children:t}))}))}));Q.displayName="MarkdownText";const ee=Q;var te=function(){return te=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},te.apply(this,arguments)},ne=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())}))},re=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])}}},oe=function(e,t){return ne(void 0,void 0,void 0,(function(){var n;return re(this,(function(r){switch(r.label){case 0:return[4,fetch("".concat(e,"threads/"),{headers:t()})];case 1:return(n=r.sent()).ok?[2,n.json()]:[2,null]}}))}))},ie=function(e,t,n){return ne(void 0,void 0,void 0,(function(){var r;return re(this,(function(o){switch(o.label){case 0:return[4,fetch("".concat(e,"threads/").concat(n,"/"),{headers:t()})];case 1:return(r=o.sent()).ok?[2,r.json()]:[2,null]}}))}))},ae=function(e,t,n){return ne(void 0,void 0,void 0,(function(){return re(this,(function(r){switch(r.label){case 0:return[4,fetch("".concat(e,"threads/").concat(n,"/"),{method:"DELETE",headers:t()})];case 1:return r.sent(),[2]}}))}))},le=n(95710),ue=n(39479),de=n(14428),se=n(54665),ce=n(93861),fe=n(18837),pe=n(7193),he=n(67948),ve=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.")},ye=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=ve(Object.keys(a)),u=l.next();!u.done;u=l.next()){var d=u.value,s=null===(o=a[d])||void 0===o?void 0:o.message;"string"==typeof s&&s.length>0&&(i[d]=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},ge=function(e,t){var n,r;if(!Array.isArray(e)||!Array.isArray(t)||0===t.length)return[];var o=[];try{for(var i=ve(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 d=!0,s=0;s<u.length;s++)if(u[s]!==t[s]){d=!1;break}d&&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 me(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 be=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=de.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 d=null===(r=l.visiblePositions)||void 0===r?void 0:r[null!==(o=(0,fe.gh)(u))&&void 0!==o?o:"root"];if(Array.isArray(d)&&!d.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:[],c=null!==(a=l.fields)&&void 0!==a?a:{},f=s.reduce((function(e,t){var n,r=(null==t?void 0:t.field_key)?null===(n=c[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:f}}},xe=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}},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){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},Se=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))},Ae=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.")},_e=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():""},Ce=function(e,t){if(!e)return"";try{return(0,se.xf)(e,t)}catch(t){return e}},Ie=new Set(["submit","load"]),Te=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))&&(!!Ie.has(t)||Array.isArray(i)&&i.includes(r))}))},Ze=n(99234),Re=n(81075),Le=function(){return Le=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},Le.apply(this,arguments)},je=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())}))},Be=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])}}},Oe=new Set(["file_upload","signature"]),Ee=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"]),ze=new Set(["integer_field","slider","rating"]),We=new Set(["dropdown","radio"]),Ke=new Set(["dropdown_multi","multiselect","checkbox_group","button_group"]);function Me(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 Fe(e,t,n,r){return je(this,void 0,void 0,(function(){var o,i,a;return Be(this,(function(l){switch(l.label){case 0:return(o="number"==typeof e?String(Math.trunc(e)):"string"==typeof e?e:"").replace(/\D/g,"")?(Ze.BZ||(0,Ze.bq)(),[4,Ze.hV]):[2,e];case 1:return l.sent(),Ze.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&&Ze.BZ)try{var l=Ze.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 Ze.BZ.parsePhoneNumber(o,i)}catch(e){return}}())?void 0:a.isValid())?[2,a.number.replace(/^\+/,"")]:[2,e]):[2,e]}}))}))}function Ne(e,t){var n,r;return je(this,void 0,void 0,(function(){var o,i,a,l,u,d,s=this;return Be(this,(function(c){switch(c.label){case 0:return o=e?de.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 je(s,void 0,void 0,(function(){var t,n,r,i,a,l;return Be(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,d,s,c,f=null==e?void 0:e.currentStep,p=null!==(o=null==f?void 0:f.servar_fields)&&void 0!==o?o:[],h=p.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=p.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,m=null!==(a=e.visiblePositions)&&void 0!==a?a:{},b=m[null!==(l=(0,fe.gh)(h))&&void 0!==l?l:"root"];if(Array.isArray(b)&&!b.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"!==le.Hi.collaboratorReview);if((null===(d=h.properties)||void 0===d?void 0:d.disabled)||x)return{ok:!1,errorType:"disabled",error:"Field '".concat(t,"' is disabled and cannot be written.")};if(Oe.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,ce.o$)(f,h):void 0,k=me(r,!!w,w?(null!==(c=m[null!==(s=(0,fe.gh)(w))&&void 0!==s?s:"root"])&&void 0!==c?c:[]).length:0,t);if(k)return Le({ok:!1},k);if("number"==typeof r&&Array.isArray(b)&&!b[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 A=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(ze.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(We.has(o)){if("string"!=typeof t)return"Field '".concat(i,"' (").concat(o,") expects a single option value (string).");var d=Me(e,n).map((function(e){return e.value}));return d.length>0&&!d.includes(t)?"Value not in allowed options. Allowed: ".concat(d.join(", "),"."):null}if(Ke.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(Me(e,n).map((function(e){return e.value})));if(s.size>0){var c=t.filter((function(e){return!s.has(e)}));if(c.length>0)return"Values not in allowed options: ".concat(c.join(", "),".")}return null}return Ee.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 A?{ok:!1,errorType:"shape_mismatch",error:A}:{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=Re.P3[a];if(!l||0===l.length)return e;var u=e.toLowerCase(),d=l.find((function(e){return e.code.toLowerCase()===u||e.name.toLowerCase()===u}));return d?o?d.code:d.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,Fe(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=c.sent(),d=u.map((function(e){var t,n;if("ok"in e)return e;var r="number"==typeof e.repeatIndex?Le(Le({},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:d}]}}))}))}var Xe=function(){return Xe=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},Xe.apply(this,arguments)},De=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.")},Pe=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 Ve(e,t,n){var r,o,i,a,l,u,d,s,c,f,p,h;return c=this,f=void 0,h=function(){var c,f,p,h,v,y,g,m,b,x,w,k,S,A,_,C,I,T,Z,R,L,j,B,O,E,z,W,K,M,F,N,X;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(D){switch(D.label){case 0:if(c=Number.isInteger(n)?n:null,!e)return[2,{ok:!1,errorType:"no_form_state",error:"Form has not loaded yet."}];if(!(f=de.Z[e])||!f.currentStep||!f.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(p=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=De(a),u=l.next();!u.done;u=l.next()){var d=Pe(u.value,2),s=d[0],c=d[1],f=(null!=s?s:[]).find((function(e){return(null==e?void 0:e.id)===t}));if(f){var p=null===(o=null==f?void 0:f.properties)||void 0===o?void 0:o.actions;return{element:f,elementType:c,actions:Array.isArray(p)?p:[],position:Array.isArray(f.position)?f.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}(f,t),!p)return[2,{ok:!1,errorType:"not_on_step",error:"Element '".concat(t,"' is not on the current step.")}];if(h=null!==(r=f.visiblePositions)&&void 0!==r?r:{},v=h[null!==(o=(0,fe.gh)(p.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"===p.elementType&&(y=!(!(null===(i=f.formSettings)||void 0===i?void 0:i.readOnly)&&"readOnly"!==le.Hi.collaboratorReview),(0,he.A)(p.element,f.currentStep,h,y)))return[2,{ok:!1,errorType:"disabled",error:"Button '".concat(t,"' is disabled and cannot be clicked.")}];if(g=p.element.repeated?p.element:(0,ce.o$)(f.currentStep,p.element),m=g?(null!==(l=h[null!==(a=(0,fe.gh)(g))&&void 0!==a?a:"root"])&&void 0!==l?l:[]).length:0,b=me(c,!!g,m,t))return[2,Xe({ok:!1},b)];if("number"==typeof c&&Array.isArray(v)&&!v[c])return[2,{ok:!1,errorType:"hidden",error:"Row ".concat(c," of element '").concat(t,"' is hidden right now.")}];x=f.assistantClient,w=f.currentStep.key,k=ye(f),S="number"==typeof c?Xe(Xe({},p.element),{repeat:c}):p.element,D.label=1;case 1:return D.trys.push([1,13,,14]),"button"!==p.elementType?[3,3]:[4,x.click(S)];case 2:return D.sent(),[3,12];case 3:return A=ge(f.currentStep.subgrids,p.position),[4,x.runActions({actions:p.actions,element:S,elementType:p.elementType})];case 4:D.sent(),D.label=5;case 5:D.trys.push([5,10,11,12]),_=De(A),C=_.next(),D.label=6;case 6:return C.done?[3,9]:(I=C.value,T=null===(u=null==I?void 0:I.properties)||void 0===u?void 0:u.actions,Z="number"==typeof c&&!!g&&I.position.length>=g.position.length,[4,x.runActions({actions:Array.isArray(T)?T:[],element:Z?Xe(Xe({},I),{repeat:c}):I,elementType:"container"})]);case 7:D.sent(),D.label=8;case 8:return C=_.next(),[3,6];case 9:return[3,12];case 10:return R=D.sent(),M={error:R},[3,12];case 11:try{C&&!C.done&&(F=_.return)&&F.call(_)}finally{if(M)throw M.error}return[7];case 12:return[3,14];case 13:return[2,{ok:!1,errorType:"dispatch_failed",error:(L=D.sent())instanceof Error?L.message:String(L)}];case 14:j=null!==(s=null===(d=f.currentStep)||void 0===d?void 0:d.key)&&void 0!==s?s:w,B=ye(f),O={};try{for(E=De(Object.keys(B)),z=E.next();!z.done;z=E.next())W=z.value,B[W]!==k[W]&&(O[W]=B[W])}catch(e){N={error:e}}finally{try{z&&!z.done&&(X=E.return)&&X.call(E)}finally{if(N)throw N.error}}return K="button"===p.elementType?O[t]:void 0,delete O[t],[2,Xe(Xe({ok:!0,navigated:j!==w?{fromStepKey:w,toStepKey:j}:null},K?{buttonError:K}:{}),Object.keys(O).length>0?{fieldErrors:O}:{})]}}))},new((p=void 0)||(p=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 p?o:new p((function(e){e(o)}))).then(n,r)}o((h=h.apply(c,f||[])).next())}))}var qe=function(){return qe=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},qe.apply(this,arguments)};function He(e,t,n,r){var o,i,a,l,u,d,s;return l=this,u=void 0,s=function(){var l,u,d,s,c,f,p,h,v,y,g,m,b,x,w,k,S,A;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(_){switch(_.label){case 0:if(!(l=be(e,t)).ok)return[2,l];if(u=l.found,d=u.state,s=u.table,c=u.rowCount,f="string"==typeof r&&r.length>0,void 0!==r&&!f)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(f){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(xe(s,c).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>=c)return[2,{ok:!1,errorType:"row_out_of_range",error:"Row ".concat(n," is out of range (table has ").concat(c," row").concat(1===c?"":"s",").")}];p=function(e,t){var n,r,o,i,a={};try{for(var l=ve(e.columns),u=l.next();!u.done;u=l.next()){var d=u.value;if(null==d?void 0:d.field_key){var s=null===(i=null===(o=e.state.fields)||void 0===o?void 0:o[d.field_key])||void 0===i?void 0:i.value,c=Array.isArray(s)?s[t]:s;a[d.name]=c}}}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=d.currentStep.key,v=ye(d),_.label=1;case 1:return _.trys.push([1,3,,4]),[4,d.assistantClient.runTableAction({table:s,payload:f?{action:r,rowIndex:n,rowData:p}:{rowIndex:n,rowData:p}})];case 2:return _.sent(),[3,4];case 3:return[2,{ok:!1,errorType:"dispatch_failed",error:(y=_.sent())instanceof Error?y.message:String(y)}];case 4:g=null!==(a=null===(i=d.currentStep)||void 0===i?void 0:i.key)&&void 0!==a?a:h,m=ye(d),b={};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(m)),w=x.next();!w.done;w=x.next())k=w.value,m[k]!==v[k]&&(b[k]=m[k])}catch(e){S={error:e}}finally{try{w&&!w.done&&(A=x.return)&&A.call(x)}finally{if(S)throw S.error}}return[2,qe({ok:!0,navigated:g!==h?{fromStepKey:h,toStepKey:g}:null},Object.keys(b).length>0?{fieldErrors:b}:{})]}}))},new((d=void 0)||(d=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 d?o:new d((function(e){e(o)}))).then(n,r)}o((s=s.apply(l,u||[])).next())}))}var Ye=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())}))},Ue=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])}}},Je=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},$e={add:"adding rows",del:"deleting rows",edit:"cell editing"},Ge=function(e,t,n,r){var o=xe(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($e[n],".")}};function Qe(e,t){return Ye(this,void 0,void 0,(function(){var n,r,o,i,a,l;return Ue(this,(function(u){if(!(n=be(e,t)).ok)return[2,n];if(r=n.found,o=r.state,i=r.table,a=r.rowCount,l=Ge(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 et(e,t,n){return Ye(this,void 0,void 0,(function(){var r,o,i,a,l,u,d;return Ue(this,(function(s){if(!(r=be(e,t)).ok)return[2,r];if(o=r.found,i=o.state,a=o.table,l=o.rowCount,u=Ge(a,t,"del",l))return[2,u];if(d=Je(n,l))return[2,d];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 tt(e,t,n){var r;return Ye(this,void 0,void 0,(function(){var o,i,a,l,u,d,s,c,f,p,h,v,y,g,m,b,x;return Ue(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=be(e,t)).ok)return[2,i(a.errorType,a.error)];if(l=a.found,u=l.state,d=l.table,s=l.columns,c=l.rowCount,f=Ge(d,t,"edit",c))return[2,i(f.errorType,f.error)];p=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=Je(n,c);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=p.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())m=g.value,v(m)}catch(e){b={error:e}}finally{try{g&&!g.done&&(x=y.return)&&x.call(y)}finally{if(b)throw b.error}}return[2,{results:h}]}))}))}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,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},at=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))},lt="feathery.assistant.mode",ut="current",dt=function(){try{var e=(0,ue.Kv)().localStorage.getItem(lt);return"current"===(t=e)||"sidebar-left"===t||"sidebar-right"===t||"fullscreen"===t?e:ut}catch(e){return ut}var t},st="feathery.assistant.sidebarWidth",ct=400,ft=function(e){var t=Math.max(280,function(){try{return Math.min(800,Math.floor(.6*(0,ue.Kv)().innerWidth))}catch(e){return 800}}());return e<280?280:e>t?t:e},pt=function(){try{var e=(0,ue.Kv)().localStorage.getItem(st),t=e?parseInt(e,10):NaN;return Number.isFinite(t)&&t>0?ft(t):ct}catch(e){return ct}},ht=function(e){try{(0,ue.Kv)().localStorage.setItem(st,String(e))}catch(e){}},vt=["current","sidebar-left","sidebar-right","fullscreen"];const yt=function(e){var t,n,u,s=e.instanceId,f=e.getTargets,h=e.getJwt,S=e.baseUrl,T=e.bottom,R=void 0===T?20:T,j=e.color,B=e.workflowActions,O=void 0===B?[]:B,E=e.allowedModes,z=void 0===E?vt:E,W=e.onLayoutChange,K=(0,o.useMemo)((function(){if(h)return function(){return{Authorization:"Bearer ".concat(h())}};var e=(0,le.JQ)().sdkKey;return function(){var t={Authorization:"Token ".concat(e)},n=(0,ue.ej)("feathery_session_token");return n&&(t["X-Feathery-Session"]=n),t}}),[h]),M=it((0,o.useState)(!1),2),F=M[0],N=M[1],X=it((0,o.useState)(dt),2),D=X[0],V=X[1],H=(0,o.useCallback)((function(e){V(e),function(e){try{(0,ue.Kv)().localStorage.setItem(lt,e)}catch(e){}}(e)}),[]),Y=it((0,o.useState)(pt),2),U=Y[0],J=Y[1],$=it((0,o.useState)(!1),2),G=$[0],Q=$[1];(0,o.useEffect)((function(){var e=function(){J((function(e){var t=ft(e);return t!==e&&ht(t),t}))};return(0,ue.Kv)().addEventListener("resize",e),function(){return(0,ue.Kv)().removeEventListener("resize",e)}}),[]);var se=(0,o.useCallback)((function(e){return function(t){if(0===t.button){t.preventDefault(),Q(!0);var n=(0,ue.me)().body;n.style.cursor="col-resize",n.style.userSelect="none";var r=U,o=function(t){var n="right"===e?(0,ue.Kv)().innerWidth-t.clientX:t.clientX;r=ft(n),J(r)},i=function(){(0,ue.Kv)().removeEventListener("pointermove",o),(0,ue.Kv)().removeEventListener("pointerup",i),(0,ue.Kv)().removeEventListener("pointercancel",i),Q(!1),n.style.cursor="",n.style.userSelect="",ht(r)};(0,ue.Kv)().addEventListener("pointermove",o),(0,ue.Kv)().addEventListener("pointerup",i),(0,ue.Kv)().addEventListener("pointercancel",i)}}}),[U]),ve=(0,o.useCallback)((function(){J(ct),ht(ct)}),[]),ye=it((0,o.useState)(""),2),me=ye[0],be=ye[1],Ie=it((0,o.useState)([]),2),Ze=Ie[0],Re=Ie[1],Le=it((0,o.useState)(null),2),je=Le[0],Be=Le[1],Oe=it((0,o.useState)(!1),2),Ee=Oe[0],ze=Oe[1],We=it((0,o.useState)(!1),2),Ke=We[0],Me=We[1],Fe=it((0,o.useState)(null),2),Xe=Fe[0],De=Fe[1],Pe=(0,o.useRef)(null),qe=(0,o.useRef)(null),Ye=(0,o.useRef)(!0),Ue=(0,o.useCallback)((function(){var e=qe.current;if(e){var t=e.scrollHeight-e.scrollTop-e.clientHeight;Ye.current=t<60}}),[]),Je=(0,o.useMemo)((function(){return{primary:e=j||A,hover:L(e,-15),disabled:L(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}),[j]),$e=function(e,t,n){void 0===t&&(t=[]);var r=e,o=!!n,i=new l.PD({api:S,headers:K,body:function(){return nt(nt({},function(){var e={},t=f();if(t.length>0&&(e.targets=t),s){var n=function(e){var t,n,r,o,i,a,l,u,d,s,c,f,p,h,v,y,g,m,b,x,w=de.Z[e];if(!w||!w.currentStep)return null;var k=w.currentStep,S=null!==(i=w.visiblePositions)&&void 0!==i?i:{},A=null!==(a=w.fields)&&void 0!==a?a:{},_=null!==(l=w.inlineErrors)&&void 0!==l?l:{},C=w.logicRules,I=!(!(null===(u=w.formSettings)||void 0===u?void 0:u.readOnly)&&"readOnly"!==le.Hi.collaboratorReview),T=(null!==(d=k.subgrids)&&void 0!==d?d:[]).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)||Te(C,"action",k.id,null!==(n=e.id)&&void 0!==n?n:"")})),Z=function(e){return ge(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:""}))},R={};(0,ce.bW)(k).forEach((function(e){var t=null==e?void 0:e.id;if(t){var n=S[(0,fe.gh)(e)];Array.isArray(n)&&(R[t]=n.length)}}));var L=(null!==(s=k.servar_fields)&&void 0!==s?s:[]).map((function(e){var t,n,r,o,i,a,l,u,d,s,c,f=(null===(t=e.position)||void 0===t?void 0:t.join(","))||"root",p=S[f],h=!Array.isArray(p)||p.some(Boolean),v=A[e.servar.key],y=null!==(n=e.properties)&&void 0!==n?n:{},g="string"==typeof y.placeholder&&y.placeholder.trim()?Ce(y.placeholder):void 0,m="string"==typeof y.tooltipText&&y.tooltipText.trim()?Ce(y.tooltipText):void 0,b=null===(r=_[e.servar.key])||void 0===r?void 0:r.message,x=null!==(o=e.servar)&&void 0!==o?o:{},w=null!==(i=x.metadata)&&void 0!==i?i:{},T=!!x.repeated,L=T?(0,ce.o$)(k,e):void 0,j=null!==(a=null==L?void 0:L.id)&&void 0!==a?a:"",B=Array.isArray(w.options)?w.options:null,O=Array.isArray(w.labels)?w.labels:[],E=B?B.map((function(e,t){var n,r;return{value:String(null!=e?e:""),label:String(null!==(r=null!==(n=O[t])&&void 0!==n?n:e)&&void 0!==r?r:"")}})):void 0,z=Array.isArray(w.repeat_options)?w.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=R[j])&&void 0!==l?l:null==z?void 0:z.length)&&void 0!==u?u:0,K=z?Array.from({length:W},(function(e,t){return Array.isArray(z[t])?z[t]:null})):void 0,M=Array.isArray(w.questions)?w.questions:null,F=M?M.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,N=Se(Se([],ke(Array.isArray(w.file_types)?w.file_types:[]),!1),ke(Array.isArray(w.custom_file_types)?w.custom_file_types.map((function(e){return".".concat(e)})):[]),!1),X=w.min_val_label||w.max_val_label?we(we({},w.min_val_label?{min:String(w.min_val_label)}:{}),w.max_val_label?{max:String(w.max_val_label)}:{}):void 0,D=!(!y.disabled&&!I),P=Te(C,"change",k.id,null!==(d=x.id)&&void 0!==d?d:""),V=Z(e),q=null!==(s=null==v?void 0:v.value)&&void 0!==s?s:null,H=T?null!==(c=R[j])&&void 0!==c?c:Array.isArray(q)?q.length:0:void 0;if("number"==typeof H&&H>0){var Y=Array.isArray(q)?q:[];Y.length<H&&(q=Se(Se([],ke(Y),!1),ke(Array(H-Y.length).fill((0,pe.oe)(e))),!1))}return we(we(we(we(we(we(we(we(we(we(we(we(we(we(we(we(we(we({key:x.key,type:x.type,value:q,visible:h,disabled:D,required:!!x.required},"number"==typeof H?{rowCount:H}:{}),(null==L?void 0:L.id)?{repeatContainerId:L.id}:{}),P?{hasLogicRules:!0}:{}),V.length>0?{clickableAncestorIds:V}:{}),g?{placeholder:g}:{}),m?{tooltip:m}:{}),b?{error:b}:{}),E?{options:E}:{}),K?{rowOptions:K}:{}),F?{questions:F}:{}),"number"==typeof x.min_length?{minLength:x.min_length}:{}),"number"==typeof x.max_length?{maxLength:x.max_length}:{}),x.format?{format:String(x.format)}:{}),N.length>0?{fileTypes:N}:{}),w.multiple?{multipleFiles:!0}:{}),"button_group"===x.type?{multiple:!!w.multiple}:{}),X?{sliderLabels:X}:{}),"number"==typeof w.step_size?{stepSize:w.step_size}:{})})),j=new Set;try{for(var B=Ae(Object.keys(null!==(c=w.steps)&&void 0!==c?c:{})),O=B.next();!O.done;O=B.next()){var E=O.value,z=w.steps[E];(null!==(f=null==z?void 0:z.servar_fields)&&void 0!==f?f:[]).forEach((function(e){var t;(null===(t=null==e?void 0:e.servar)||void 0===t?void 0:t.key)&&j.add(e.servar.key)}))}}catch(e){t={error:e}}finally{try{O&&!O.done&&(n=B.return)&&n.call(B)}finally{if(t)throw t.error}}var W=function(e){return!(null==e||"string"==typeof e&&""===e||Array.isArray(e)&&0===e.length)},K={},M={};try{for(var F=Ae(Object.keys(A)),N=F.next();!N.done;N=F.next()){var X=N.value,D=null!==(h=null===(p=A[X])||void 0===p?void 0:p.value)&&void 0!==h?h:null;j.has(X)?K[X]=D:W(D)&&(M[X]=D)}}catch(e){r={error:e}}finally{try{N&&!N.done&&(o=F.return)&&o.call(F)}finally{if(r)throw r.error}}var P=[],V=function(e){var t,n=(null===(t=e.position)||void 0===t?void 0:t.join(","))||"root",r=S[n];return!Array.isArray(r)||r.some(Boolean)};T.forEach((function(e){var t,n,r,o=e.properties.actions,i=Te(C,"action",k.id,null!==(t=e.id)&&void 0!==t?t:""),a=Z(e),l=e.repeated?e.id:null===(n=(0,ce.o$)(k,e))||void 0===n?void 0:n.id;P.push(we(we(we({type:"container",id:null!==(r=e.id)&&void 0!==r?r:"",visible:V(e),actions:o},i?{hasLogicRules:!0}:{}),a.length>0?{clickableAncestorIds:a}:{}),l?{repeatContainerId:l}:{}))})),(null!==(v=k.texts)&&void 0!==v?v:[]).forEach((function(e){var t,n,r,o,i=_e(null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{});if(i){var a=Ce(i),l=null!==(n=null==e?void 0:e.properties)&&void 0!==n?n:{},u=Array.isArray(l.actions)?l.actions:[],d=Te(C,"action",k.id,null!==(r=e.id)&&void 0!==r?r:""),s=Z(e),c=null===(o=(0,ce.o$)(k,e))||void 0===o?void 0:o.id;P.push(we(we(we(we(we(we({type:"text",text:a,visible:V(e)},e.id?{id:e.id}:{}),i!==a?{templateText:i}:{}),u.length>0?{actions:u}:{}),d?{hasLogicRules:!0}:{}),s.length>0?{clickableAncestorIds:s}:{}),c?{repeatContainerId:c}:{}))}})),(null!==(y=k.buttons)&&void 0!==y?y:[]).forEach((function(e){var t,n,r,o,i,a=_e(null!==(t=null==e?void 0:e.properties)&&void 0!==t?t:{}),l=null!==(n=null==e?void 0:e.properties)&&void 0!==n?n:{},u=Array.isArray(l.actions)?l.actions:[],d=Te(C,"action",k.id,null!==(r=e.id)&&void 0!==r?r:"")||!!l.submit&&(Te(C,"submit",k.id,"")||Te(C,"form_complete",k.id,""));if(a||0!==u.length||l.submit||d){var s=null===(o=(0,ce.o$)(k,e))||void 0===o?void 0:o.id;P.push(we(we({type:"button",id:null!==(i=e.id)&&void 0!==i?i:"",text:Ce(a),visible:V(e),disabled:(0,he.A)(e,k,S,I),submit:!!l.submit,actions:u},d?{hasLogicRules:!0}:{}),s?{repeatContainerId:s}:{}))}})),(null!==(g=k.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=Z(e);P.push(we({type:"image",text:Ce(r),visible:V(e)},o.length>0?{clickableAncestorIds:o}:{}))}})),(null!==(m=k.progress_bars)&&void 0!==m?m:[]).forEach((function(e){var t,n=null===(t=null==e?void 0:e.properties)||void 0===t?void 0:t.num_segments;P.push(we(we({type:"progress"},"number"==typeof n?{segments:n}:{}),{visible:V(e)}))}));var q=[];return(null!==(b=k.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=A[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=A[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}))})),d=(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=xe(e,l),c=s.canEditCells,f=s.canAddRows,p=s.canDeleteRows,h=Te(C,"action",k.id,null!==(o=e.id)&&void 0!==o?o:"");q.push(we(we(we(we(we(we({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},d.length>0?{actions:d}:{}),f?{canAddRows:!0}:{}),p?{canDeleteRows:!0}:{}),c?{canEditCells:!0}:{}),h?{hasLogicRules:!0}:{}),{visible:V(e)}))}})),{currentStep:{id:k.id,key:k.key},previousStepName:w.previousStepName||void 0,totalSteps:Object.keys(null!==(x=w.steps)&&void 0!==x?x:{}).length,currentStepFields:L,currentStepElements:P,currentStepTables:q,values:K,hiddenFieldValues:M}}(s);n&&(e.panel_runtime=n)}return e}()),{thread_id:r||null})},fetch:function(e,t){return rt(void 0,void 0,void 0,(function(){var n,i,a,l,d,c,p,h,v,y;return ot(this,(function(g){switch(g.label){case 0:return[4,fetch(e,t)];case 1:return n=g.sent(),(i=n.headers.get("X-Thread-Id"))&&!r&&(r=i,Re((function(e){return e.map((function(e){return e.chat===u?nt(nt({},e),{id:i,isTemporary:!1}):e}))})),Be(i),ie(S,K,i).then((function(e){e&&Re((function(t){return t.map((function(t){return t.id===i?nt(nt({},e),{chat:u,title:t.title||e.title}):t}))}))}))),o||(a=null===(y=null===(v=null===(h=u.messages.find((function(e){return"user"===e.role})))||void 0===h?void 0:h.parts)||void 0===v?void 0:v[0])||void 0===y?void 0:y.text)&&(o=!0,l=r||i||null,d={},(c=f()).length>0&&(d.targets=c),s&&(p=function(e){var t,n;return null===(n=null===(t=de.Z[e])||void 0===t?void 0:t.currentStep)||void 0===n?void 0:n.key}(s),p&&(d.current_step=p)),function(e,t,n,r,o){return ne(void 0,void 0,void 0,(function(){var i,a,l;return re(this,(function(u){switch(u.label){case 0:return[4,fetch("".concat(e,"threads/title/"),{method:"POST",headers:te(te({},t()),{"Content-Type":"application/json"}),body:JSON.stringify(te({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,K,l,a,d).then((function(e){e&&Re(l?function(t){return t.map((function(t){return t.id===l?nt(nt({},t),{title:e}):t}))}:function(t){return t.map((function(t){return t.chat===u?nt(nt({},t),{title:e}):t}))})}))),[2,n]}}))}))}}),u=new a.en({transport:i,messages:t,sendAutomaticallyWhen:l.Qk,onToolCall:function(e){var t=e.toolCall;return rt(void 0,void 0,void 0,(function(){var e,n,r,o,i,a,l,d,c,f,p,h,v,y,g,m,b,x,w;return ot(this,(function(k){switch(k.label){case 0:return t.dynamic?[2]:"setFieldValue"!==t.toolName?[3,2]:(e=null!==(y=t.input)&&void 0!==y?y:{},n=Array.isArray(e.fields)?e.fields:[],[4,Ne(s,n)]);case 1:return v=k.sent(),u.addToolOutput({tool:"setFieldValue",toolCallId:t.toolCallId,output:v}),[3,12];case 2:return"clickElement"!==t.toolName?[3,4]:(r=null!==(g=t.input)&&void 0!==g?g:{},o="string"==typeof r.elementId?r.elementId:"",[4,Ve(s,o,r.repeatIndex)]);case 3:return v=k.sent(),u.addToolOutput({tool:"clickElement",toolCallId:t.toolCallId,output:v}),[3,12];case 4:return"triggerTableAction"!==t.toolName?[3,6]:(i=null!==(m=t.input)&&void 0!==m?m:{},p="string"==typeof i.tableId?i.tableId:"",c="number"==typeof i.rowIndex?i.rowIndex:NaN,a="string"==typeof i.actionLabel?i.actionLabel:void 0,[4,He(s,p,c,a)]);case 5:return v=k.sent(),u.addToolOutput({tool:"triggerTableAction",toolCallId:t.toolCallId,output:v}),[3,12];case 6:return"addTableRow"!==t.toolName?[3,8]:(l=null!==(b=t.input)&&void 0!==b?b:{},p="string"==typeof l.tableId?l.tableId:"",[4,Qe(s,p)]);case 7:return v=k.sent(),u.addToolOutput({tool:"addTableRow",toolCallId:t.toolCallId,output:v}),[3,12];case 8:return"deleteTableRow"!==t.toolName?[3,10]:(d=null!==(x=t.input)&&void 0!==x?x:{},p="string"==typeof d.tableId?d.tableId:"",c="number"==typeof d.rowIndex?d.rowIndex:NaN,[4,et(s,p,c)]);case 9:return v=k.sent(),u.addToolOutput({tool:"deleteTableRow",toolCallId:t.toolCallId,output:v}),[3,12];case 10:return"setTableCellValue"!==t.toolName?[3,12]:(f=null!==(w=t.input)&&void 0!==w?w:{},p="string"==typeof f.tableId?f.tableId:"",h=Array.isArray(f.cells)?f.cells:[],[4,tt(s,p,h)]);case 11:v=k.sent(),u.addToolOutput({tool:"setTableCellValue",toolCallId:t.toolCallId,output:v}),k.label=12;case 12:return[2]}}))}))},onFinish:function(e){var t=e.isAbort,n=e.isError;t||n||!r||Re((function(e){var t=e.find((function(e){return e.id===r}));return t?at([nt(nt({},t),{updated_at:(new Date).toISOString()})],it(e.filter((function(e){return e.id!==r}))),!1):e}))}});return u},Ge=(0,o.useMemo)((function(){return $e(null)}),[K,f,h]),ut=Ze.find((function(e){return e.id===je})),st=null!==(u=null==ut?void 0:ut.chat)&&void 0!==u?u:Ge,yt=(0,a.RJ)({chat:st}),gt=yt.messages,mt=yt.sendMessage,bt=yt.status,xt=yt.error,wt=(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.")}(gt),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]=nt(nt({},u),{parts:at(at([],it(null!==(n=u.parts)&&void 0!==n?n:[]),!1),it(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}),[gt]);(0,o.useEffect)((function(){var e;Ye.current&&(null===(e=Pe.current)||void 0===e||e.scrollIntoView({behavior:"smooth"}))}),[wt]),(0,o.useEffect)((function(){if("ready"===bt&&Ye.current){var e=(0,ue.Kv)().requestAnimationFrame((function(){var e;null===(e=Pe.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"end"})}));return function(){return(0,ue.Kv)().cancelAnimationFrame(e)}}}),[bt]);var kt=(0,o.useCallback)((function(){return rt(void 0,void 0,void 0,(function(){var e;return ot(this,(function(t){switch(t.label){case 0:return[4,oe(S,K)];case 1:return(e=t.sent())?(Re((function(t){return at(at([],it(e.map((function(e){var n;return nt(nt({},e),{chat:null===(n=t.find((function(t){return t.id===e.id})))||void 0===n?void 0:n.chat})}))),!1),it(t.filter((function(t){return!e.find((function(e){return e.id===t.id}))}))),!1)})),[2]):[2]}}))}))}),[K,S]);(0,o.useEffect)((function(){F&&kt()}),[F,kt]);var St=function(){Ye.current=!0;var e=(0,i.Z)(),t=(new Date).toISOString(),n=$e(null);Re((function(r){return at([{id:e,title:"",created_at:t,updated_at:t,isTemporary:!0,chat:n}],it(r.filter((function(e){return!e.isTemporary||e.title}))),!1)})),Be(e)},At=function(){if(me.trim()&&"ready"===bt){Ye.current=!0;var e=(new Date).toISOString();if(je)ut&&!ut.title&&Re((function(t){return at([nt(nt({},ut),{title:"New Chat",updated_at:e})],it(t.filter((function(e){return e.id!==je}))),!1)}));else{var t=(0,i.Z)();Re((function(n){return at([{id:t,title:"New Chat",created_at:e,updated_at:e,isTemporary:!0,chat:st}],it(n),!1)})),Be(t)}mt({text:me}),be("")}},_t=Ze.filter((function(e){return e.title})),Ct="submitted"===bt||"streaming"===bt,It="sidebar-left"===D?"left":"sidebar-right"===D?"right":null,Tt=F&&It?U:0,Zt=(0,o.useRef)(W);Zt.current=W,(0,o.useEffect)((function(){var e;null===(e=Zt.current)||void 0===e||e.call(Zt,{mode:D,isOpen:F,side:It,width:Tt,isResizing:G})}),[D,F,It,Tt,G]);var Rt="sidebar-left"===D?w:"sidebar-right"===D?k:"fullscreen"===D?p:x,Lt="sidebar-left"===D?g:"sidebar-right"===D?m:"fullscreen"===D?b:y,jt="sidebar-left"===D,Bt=jt?{left:"20px"}:{right:"20px"},Ot=jt?20:R;if(!F)return(0,r.tZ)("button",nt({type:"button",onClick:function(){return N(!0)},css:nt(nt({position:"fixed",bottom:"".concat(Ot,"px")},Bt),{width:"".concat(56,"px"),height:"".concat(56,"px"),borderRadius:"50%",backgroundColor:Je.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:Je.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)(d,{})}));var Et="sidebar-left"===D?{top:0,left:0,width:"".concat(U,"px"),height:"100vh",borderRadius:0,boxShadow:"4px 0 24px rgba(0, 0, 0, 0.12)"}:"sidebar-right"===D?{top:0,right:0,width:"".concat(U,"px"),height:"100vh",borderRadius:0,boxShadow:"-4px 0 24px rgba(0, 0, 0, 0.12)"}:"fullscreen"===D?{inset:0,borderRadius:0,boxShadow:"none",border:"none"}:{bottom:"".concat(R,"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(C)};return(0,r.BX)("div",nt({css:nt({position:"fixed",backgroundColor:"white",display:"flex",flexDirection:"column",overflow:"hidden",zIndex:1e3},Et)},{children:[It&&(0,r.tZ)("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize assistant panel",title:"Drag to resize, double-click to reset",onPointerDown:se(It),onDoubleClick:ve,css:(t={position:"absolute",top:0},t["right"===It?"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"===It?"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",nt({css:nt({display:"flex",alignItems:"center",justifyContent:"space-between",gap:"2px",padding:"12px 16px",backgroundColor:Je.primary,color:"white",position:"relative"},It?{minHeight:"var(--main-nav-height, 55px)",boxSizing:"border-box"}:{})},{children:[(0,r.BX)("div",nt({css:{display:"flex",alignItems:"center",gap:"8px",minWidth:0,flex:1,overflow:"hidden"}},{children:[(0,r.tZ)(d,{}),(0,r.BX)("button",nt({type:"button",onClick:function(){return ze((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",nt({css:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0}},{children:(null==ut?void 0:ut.title)||"AI Assistant"})),(0,r.tZ)("span",nt({css:{display:"flex",opacity:.8,flexShrink:0}},{children:(0,r.tZ)(v,{})}))]}))]})),(0,r.BX)("div",nt({css:{display:"flex",alignItems:"center",gap:"2px",position:"relative",flexShrink:0}},{children:[(0,r.tZ)("button",nt({type:"button",onClick:function(){return Me((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)(Lt,{})})),(0,r.tZ)("button",nt({type:"button",onClick:function(){return N(!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)(Rt,{})})),Ke&&(0,r.BX)(r.HY,{children:[(0,r.tZ)("div",{css:{position:"fixed",inset:0,zIndex:1e3},onClick:function(){return Me(!1)}}),(0,r.tZ)("div",nt({css:{position:"absolute",top:"100%",right:0,marginTop:"4px",minWidth:"180px",backgroundColor:"white",border:"1px solid ".concat(C),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:m},{value:"fullscreen",label:"Fullscreen",Icon:b}].filter((function(e){var t=e.value;return z.includes(t)})).map((function(e){var t=e.value,n=e.label,o=e.Icon;return(0,r.BX)("button",nt({type:"button",onClick:function(){H(t),Me(!1)},css:{width:"100%",padding:"10px 14px",background:t===D?Je.light:"white",border:"none",cursor:"pointer",fontSize:"13px",color:Z,textAlign:"left",display:"flex",alignItems:"center",gap:"10px",":hover":{backgroundColor:_}}},{children:[(0,r.tZ)("span",nt({css:{display:"flex",color:I,flexShrink:0}},{children:(0,r.tZ)(o,{})})),(0,r.tZ)("span",{children:n})]}),t)}))}))]})]})),Ee&&(0,r.BX)(r.HY,{children:[(0,r.tZ)("div",{css:{position:"fixed",inset:0,zIndex:1e3},onClick:function(){return ze(!1)}}),(0,r.BX)("div",nt({css:{position:"absolute",top:"100%",left:0,width:"100%",backgroundColor:"white",border:"1px solid ".concat(C),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",nt({type:"button",onClick:function(){St(),ze(!1)},css:{width:"100%",padding:"10px 14px",background:"none",border:"none",borderBottom:"1px solid ".concat("#f3f4f6"),cursor:"pointer",fontSize:"13px",fontWeight:600,color:Je.primary,textAlign:"left",":hover":{backgroundColor:_}}},{children:"+ New Chat"})),0===_t.length&&(0,r.tZ)("div",nt({css:{padding:"12px 14px",fontSize:"13px",color:I}},{children:"No chats yet"})),_t.map((function(e){return(0,r.BX)("div",nt({onClick:function(){return t=e.id,rt(void 0,void 0,void 0,(function(){var e,n,r,o;return ot(this,(function(i){switch(i.label){case 0:return Ye.current=!0,(null===(r=Ze.find((function(e){return e.id===t})))||void 0===r?void 0:r.chat)?(Be(t),ze(!1),[2]):[4,ie(S,K,t)];case 1:return(e=i.sent())?(n=$e(t,null!==(o=e.messages)&&void 0!==o?o:[],e.title),Re((function(r){return r.map((function(r){return r.id===t?nt(nt({},e),{chat:n}):r}))})),Be(t),ze(!1),[2]):[2]}}))}));var t},css:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 14px",cursor:"pointer",backgroundColor:e.id===je?Je.light:"white",":hover":{backgroundColor:_}}},{children:[(0,r.BX)("div",nt({css:{flex:1,minWidth:0}},{children:[(0,r.tZ)("div",nt({css:{fontSize:"13px",fontWeight:500,color:Z,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:e.title||"Untitled conversation"})),(0,r.tZ)("div",nt({css:{fontSize:"11px",color:I,marginTop:"2px"}},{children:new Date(e.updated_at).toLocaleDateString()}))]})),(0,r.tZ)("button",nt({type:"button",onClick:function(t){return 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 t.stopPropagation(),(null==(n=Ze.find((function(t){return t.id===e})))?void 0:n.isTemporary)?[3,2]:[4,ae(S,K,e)];case 1:r.sent(),r.label=2;case 2:return Re((function(t){return t.filter((function(t){return t.id!==e}))})),je===e&&St(),[2]}}))}))}(e.id,t)},css:{background:"none",border:"none",cursor:"pointer",color:I,fontSize:"16px",padding:"2px 6px",marginLeft:"8px",borderRadius:"4px",lineHeight:1,":hover":{color:"#dc2626",backgroundColor:"#fef2f2"}}},{children:"×"}))]}),e.id)}))]}))]})]})),(0,r.BX)("div",nt({ref:qe,onScroll:Ue,css:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"12px"}},{children:[0===wt.length&&(0,r.tZ)("div",nt({css:{textAlign:"center",color:I,fontSize:"14px",marginTop:"40px"}},{children:"How can I help?"})),wt.map((function(e,t){return"user"===e.role?(0,r.tZ)("div",nt({css:{display:"flex",justifyContent:"flex-end"}},{children:(0,r.tZ)("div",nt({css:{maxWidth:"80%",padding:"10px 14px",borderRadius:"12px",fontSize:"14px",lineHeight:"1.5",backgroundColor:Je.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):(0,r.tZ)(o.Fragment,{children:(n=t===wt.length-1,i=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),a=e.parts[e.parts.length-1],l=!n||"ready"===bt&&"text"===(null==a?void 0:a.type),i.map((function(e,t){if("text"===e.kind)return(0,r.tZ)("div",nt({css:{display:"flex",justifyContent:"flex-start"}},{children:(0,r.tZ)("div",nt({css:{maxWidth:"80%",padding:"10px 14px",borderRadius:"12px",fontSize:"14px",lineHeight:"1.5",backgroundColor:Je.light,color:Z,overflowWrap:"anywhere",wordBreak:"break-word"}},{children:(0,r.tZ)(ee,{text:e.text,isStreaming:Ct&&n&&t===i.length-1})}))}),e.key);var o=i.slice(t+1).some((function(e){return"text"===e.kind}));return(0,r.tZ)("div",nt({css:{display:"flex",justifyContent:"flex-start",maxWidth:"80%",minWidth:0}},{children:(0,r.tZ)(P,{rows:e.rows,turnFinished:l,followedByText:o,linkColor:Je.primary,isFirstChunk:0===t})}),e.key)})))},e.id);var n,i,a,l})),function(){if(!Ct)return null;var e=wt[wt.length-1];if(!e)return null;if("user"!==e.role){var t=(e.parts||[]).some((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}));if(t)return null}return(0,r.tZ)(q,{})}(),xt&&(0,r.tZ)("div",nt({css:{padding:"10px 14px",borderRadius:"8px",backgroundColor:"#fef2f2",color:"#dc2626",fontSize:"14px"}},{children:"Something went wrong. Please try again."})),(0,r.tZ)("div",{ref:Pe})]})),O.length>0&&(0,r.BX)("div",nt({css:{position:"relative",zIndex:1,borderTop:"1px solid ".concat(C),backgroundColor:_,padding:"8px 16px",display:"flex",gap:"6px",overflowX:"auto"}},{children:[O.map((function(e,t){return(0,r.tZ)("button",nt({type:"button",disabled:Ct,onClick:function(){return function(e){if("ready"===bt){var t=(new Date).toISOString();if(je)ut&&!ut.title&&Re((function(e){return at([nt(nt({},ut),{title:"New Chat",updated_at:t})],it(e.filter((function(e){return e.id!==je}))),!1)}));else{var n=(0,i.Z)();Re((function(e){return at([{id:n,title:"New Chat",created_at:t,updated_at:t,isTemporary:!0,chat:st}],it(e),!1)})),Be(n)}mt({parts:[{type:"text",text:e.name},{type:"text",text:e.instructions,hidden:!0,interpolate:!0}]})}}(e)},onMouseEnter:function(t){if(e.description){var n=t.currentTarget.getBoundingClientRect();De({text:e.description,x:n.left+n.width/2,y:n.top})}},onMouseLeave:function(){return De(null)},css:{flexShrink:0,padding:"4px 10px",fontSize:"12px",border:"1px solid ".concat(Je.primary),borderRadius:"12px",backgroundColor:"white",color:Je.primary,cursor:"pointer",whiteSpace:"nowrap",":disabled":{opacity:.5,cursor:"not-allowed"},":hover:not(:disabled)":{backgroundColor:Je.light},transition:"background-color 0.15s, color 0.15s"}},{children:e.name}),t)})),Xe&&(0,r.tZ)("div",nt({css:{position:"fixed",top:Xe.y-34,left:Xe.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:Xe.text}))]})),(0,r.BX)("div",nt({css:{display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",borderTop:"1px solid ".concat(C),backgroundColor:_}},{children:[(0,r.tZ)("input",{type:"text",value:me,onChange:function(e){return be(e.target.value)},onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),e.stopPropagation(),At())},placeholder:"Type a message...",css:{flex:1,padding:"10px 14px",border:"1px solid ".concat(C),borderRadius:"8px",fontSize:"14px",outline:"none",transition:"border-color 0.2s",":focus":{borderColor:Je.primary}}}),(0,r.tZ)("button",nt({type:"button",onClick:At,disabled:Ct||!me.trim(),css:{padding:"10px",backgroundColor:Je.primary,color:"white",border:"none",borderRadius:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s",":hover:not(:disabled)":{backgroundColor:Je.hover},":disabled":{backgroundColor:Je.disabled,cursor:"not-allowed"}}},{children:(0,r.tZ)(c,{})}))]}))]}))}}}]);