@feathery/react 2.48.0 → 2.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/cjs/Form/grid/StyledContainer/utils.d.ts.map +1 -1
  2. package/cjs/assistant/ToolStatus.d.ts.map +1 -1
  3. package/cjs/elements/basic/ButtonElement.d.ts.map +1 -1
  4. package/cjs/elements/basic/TableElement/EditableCell.d.ts +5 -2
  5. package/cjs/elements/basic/TableElement/EditableCell.d.ts.map +1 -1
  6. package/cjs/elements/basic/TableElement/index.d.ts.map +1 -1
  7. package/cjs/elements/basic/TableElement/styles.d.ts +0 -23
  8. package/cjs/elements/basic/TableElement/styles.d.ts.map +1 -1
  9. package/cjs/elements/basic/TableElement/types.d.ts +4 -0
  10. package/cjs/elements/basic/TableElement/types.d.ts.map +1 -1
  11. package/cjs/elements/basic/TableElement/useTableMutations.d.ts +0 -1
  12. package/cjs/elements/basic/TableElement/useTableMutations.d.ts.map +1 -1
  13. package/cjs/elements/basic/TableElement/utils.d.ts +14 -0
  14. package/cjs/elements/basic/TableElement/utils.d.ts.map +1 -1
  15. package/cjs/{fthry_AssistantChat.D16Y4E74.js → fthry_AssistantChat.BuqbKhai.js} +21 -17
  16. package/cjs/{fthry_FormControl.D2f1BXqB.js → fthry_FormControl.BuMQfeZ1.js} +1 -1
  17. package/cjs/{fthry_InlineTooltip.DEdTUSm4.js → fthry_InlineTooltip.D8PDRhj_.js} +2 -2
  18. package/cjs/{fthry_Overlay.D62XeoXL.js → fthry_Overlay.D-NnFWEe.js} +1 -1
  19. package/cjs/{fthry_PaymentMethodField.BjRyBUqb.js → fthry_PaymentMethodField.myalaaOZ.js} +4 -4
  20. package/cjs/{fthry_Placeholder.DgZkAMLA.js → fthry_Placeholder.UOTZToMt.js} +1 -1
  21. package/cjs/{fthry_ShowEyeIcon.DN_uKizZ.js → fthry_ShowEyeIcon.D8qDJDzZ.js} +1 -1
  22. package/cjs/{fthry_TabsElement.DvCwi960.js → fthry_TabsElement.BK0wFYNE.js} +2 -2
  23. package/cjs/{fthry_auto-track.6jWwlIt0.js → fthry_auto-track.B5EtzK5A.js} +2 -2
  24. package/cjs/{fthry_highlighted-body-TPN3WLV5.BWETzenp.js → fthry_highlighted-body-TPN3WLV5.BEO11ycd.js} +3 -3
  25. package/cjs/{fthry_index.BkhZkLh-.js → fthry_index.7ndzGWiJ.js} +5 -5
  26. package/cjs/{fthry_index.5BeecFlc.js → fthry_index.964D9mAK.js} +2 -2
  27. package/cjs/{fthry_index.D5ysX_Ku.js → fthry_index.B6qHn3Vr.js} +6 -6
  28. package/cjs/{fthry_index.C1_NpVP-.js → fthry_index.BFw_StvJ.js} +2 -2
  29. package/cjs/{fthry_index.Cz0q4X3R.js → fthry_index.BRo8czXJ.js} +2 -2
  30. package/cjs/{fthry_index.DPm7UcNK.js → fthry_index.BU9fFX-g.js} +1 -1
  31. package/cjs/{fthry_index.BpSfRdvi.js → fthry_index.B_0S-igL.js} +5 -5
  32. package/cjs/{fthry_index.B66Sa4U0.js → fthry_index.BcfL5ZZY.js} +1 -1
  33. package/cjs/{fthry_index.bje_1x-I.js → fthry_index.BckiEDZJ.js} +5 -5
  34. package/cjs/{fthry_index.DG6J-zY-.js → fthry_index.BmILtMAD.js} +3 -3
  35. package/cjs/{fthry_index.C-RRAbJm.js → fthry_index.BvnQTPSY.js} +1 -1
  36. package/cjs/{fthry_index.CdGxoWiK.js → fthry_index.C-kN7c0o.js} +39 -42
  37. package/cjs/{fthry_index.C851WNlT.js → fthry_index.C2vpx_Q9.js} +1 -1
  38. package/cjs/{fthry_index.DTxHjfFB.js → fthry_index.C6ebZNtr.js} +3 -3
  39. package/cjs/{fthry_index.BeoPEbf4.js → fthry_index.C9AIy59J.js} +2 -2
  40. package/cjs/{fthry_index.Ck7YQKQF.js → fthry_index.CHLGQEBH.js} +4 -4
  41. package/cjs/{fthry_index.B31MkOC0.js → fthry_index.CP8jeStb.js} +6 -6
  42. package/cjs/{fthry_index.C0ZwSbPD.js → fthry_index.CoZzaKnE.js} +5 -5
  43. package/cjs/{fthry_index.VYffek6q.js → fthry_index.CrgFXYzE.js} +1 -1
  44. package/cjs/{fthry_index.DDfgMZKh.js → fthry_index.D0My8MmY.js} +1 -1
  45. package/cjs/{fthry_index.CYkjnpqJ.js → fthry_index.DHx_H1T3.js} +151 -141
  46. package/cjs/{fthry_index.DTQrAA3Y.js → fthry_index.DKv8MgEz.js} +8 -8
  47. package/cjs/{fthry_index.xkoAL9cS.js → fthry_index.DPIewKZa.js} +1 -1
  48. package/cjs/{fthry_index.CJVXqn1l.js → fthry_index.DTMlYZBn.js} +1 -1
  49. package/cjs/{fthry_index.DhoBBzQ7.js → fthry_index.DgGKGO1E.js} +10 -10
  50. package/cjs/{fthry_index.Brfzpzrh.js → fthry_index.DrrJo2Gf.js} +6 -6
  51. package/cjs/{fthry_index.Ptr3UN8d.js → fthry_index.OwukJO9-.js} +2 -2
  52. package/cjs/{fthry_index.oTQT38C_.js → fthry_index.b8IraXmQ.js} +4 -4
  53. package/cjs/{fthry_index.BS3CuTH8.js → fthry_index.cpUxhiq-.js} +2 -2
  54. package/cjs/{fthry_index.XFPGCehV.js → fthry_index.e_GKEQRk.js} +1 -1
  55. package/cjs/{fthry_index.umd.wy3zwWSj.js → fthry_index.umd.YAgbegYu.js} +1 -1
  56. package/cjs/{fthry_index.Dyh7d2u3.js → fthry_index.w9-CuoQH.js} +6 -6
  57. package/cjs/{fthry_input.7C_cW8iE.js → fthry_input.D3t8liSW.js} +1 -1
  58. package/cjs/{fthry_mermaid-O7DHMXV3.BNo6HbRp.js → fthry_mermaid-O7DHMXV3.C5wDh0Pr.js} +3 -3
  59. package/cjs/{fthry_script.CPZyEEIq.js → fthry_script.sEVfx6Kl.js} +1 -1
  60. package/cjs/{fthry_styles.Dl7lVFJC.js → fthry_styles.CFNJAwLy.js} +1 -1
  61. package/cjs/{fthry_useElementSize.Dh0Bml3S.js → fthry_useElementSize.yeWmUfpM.js} +1 -1
  62. package/cjs/{fthry_useSalesforceSync.ZmjF5jeJ.js → fthry_useSalesforceSync.C_sMWo9m.js} +1 -1
  63. package/cjs/{fthry_webfontloader.DOEIvOUg.js → fthry_webfontloader.DLiAwukX.js} +1 -1
  64. package/cjs/index.js +1 -1
  65. package/cjs/thumbnail-renderer.js +1 -1
  66. package/cjs/types/Form.d.ts +3 -0
  67. package/cjs/types/Form.d.ts.map +1 -1
  68. package/dist/Form/grid/StyledContainer/utils.d.ts.map +1 -1
  69. package/dist/assistant/ToolStatus.d.ts.map +1 -1
  70. package/dist/elements/basic/ButtonElement.d.ts.map +1 -1
  71. package/dist/elements/basic/TableElement/EditableCell.d.ts +5 -2
  72. package/dist/elements/basic/TableElement/EditableCell.d.ts.map +1 -1
  73. package/dist/elements/basic/TableElement/index.d.ts.map +1 -1
  74. package/dist/elements/basic/TableElement/styles.d.ts +0 -23
  75. package/dist/elements/basic/TableElement/styles.d.ts.map +1 -1
  76. package/dist/elements/basic/TableElement/tests/EditableCell.spec.d.ts +2 -0
  77. package/dist/elements/basic/TableElement/tests/EditableCell.spec.d.ts.map +1 -0
  78. package/dist/elements/basic/TableElement/tests/TableElement.spec.d.ts +2 -0
  79. package/dist/elements/basic/TableElement/tests/TableElement.spec.d.ts.map +1 -0
  80. package/dist/elements/basic/TableElement/tests/tabNavigation.spec.d.ts +2 -0
  81. package/dist/elements/basic/TableElement/tests/tabNavigation.spec.d.ts.map +1 -0
  82. package/dist/elements/basic/TableElement/types.d.ts +4 -0
  83. package/dist/elements/basic/TableElement/types.d.ts.map +1 -1
  84. package/dist/elements/basic/TableElement/useTableMutations.d.ts +0 -1
  85. package/dist/elements/basic/TableElement/useTableMutations.d.ts.map +1 -1
  86. package/dist/elements/basic/TableElement/utils.d.ts +14 -0
  87. package/dist/elements/basic/TableElement/utils.d.ts.map +1 -1
  88. package/dist/{fthry_AssistantChat.BWukgD5o.js → fthry_AssistantChat.BejpFcyu.js} +21 -17
  89. package/dist/{fthry_FormControl.CVdJuRnk.js → fthry_FormControl.C3pHyJdN.js} +1 -1
  90. package/dist/{fthry_InlineTooltip.CWap-WTM.js → fthry_InlineTooltip.mv-Gc2Xw.js} +2 -2
  91. package/dist/{fthry_Overlay.MAk8YndV.js → fthry_Overlay.CPbgvfMU.js} +1 -1
  92. package/dist/{fthry_PaymentMethodField.DST9Yjtv.js → fthry_PaymentMethodField.D7ElRh4C.js} +4 -4
  93. package/dist/{fthry_Placeholder.CtIwoA5S.js → fthry_Placeholder.CRBysDun.js} +1 -1
  94. package/dist/{fthry_ShowEyeIcon.BGA6FQh0.js → fthry_ShowEyeIcon.Ds0oud66.js} +1 -1
  95. package/dist/{fthry_TabsElement.BuntEz0s.js → fthry_TabsElement.BCuhzX6e.js} +2 -2
  96. package/dist/{fthry_auto-track.BKMbIWyQ.js → fthry_auto-track.Dbu38K5j.js} +2 -2
  97. package/dist/{fthry_highlighted-body-TPN3WLV5.G06YuQ2e.js → fthry_highlighted-body-TPN3WLV5.Cuh_lSww.js} +3 -3
  98. package/dist/{fthry_index.CtAHxgAq.js → fthry_index.0OEg6H3i.js} +1 -1
  99. package/dist/{fthry_index.DPQPFDFJ.js → fthry_index.5jB_IKHJ.js} +6 -6
  100. package/dist/{fthry_index._mp6MQTh.js → fthry_index.B-NWpaAl.js} +2 -2
  101. package/dist/{fthry_index.Dpd5r8Nr.js → fthry_index.B0NbPkQc.js} +1 -1
  102. package/dist/{fthry_index.DGGn9OIp.js → fthry_index.B31t0UUz.js} +2 -2
  103. package/dist/{fthry_index.jGH4DDdr.js → fthry_index.B8QhrENg.js} +1 -1
  104. package/dist/{fthry_index.CYZeDMG0.js → fthry_index.BEUoZUyK.js} +1 -1
  105. package/dist/{fthry_index.LTbpRhuO.js → fthry_index.Bb2rQlTP.js} +4 -4
  106. package/dist/{fthry_index.Cancfzx7.js → fthry_index.BgljRyhO.js} +10 -10
  107. package/dist/{fthry_index.BV5orIbT.js → fthry_index.BnWgnMbc.js} +5 -5
  108. package/dist/{fthry_index.C8dO4ksp.js → fthry_index.Bx6S1qZa.js} +2 -2
  109. package/dist/{fthry_index.BjYD1xpd.js → fthry_index.C2TazyZo.js} +1 -1
  110. package/dist/{fthry_index.CvN4Rhcn.js → fthry_index.C8wcBfv1.js} +1 -1
  111. package/dist/{fthry_index.CEOePdHL.js → fthry_index.CQaO0qYK.js} +1 -1
  112. package/dist/{fthry_index.SBGfC-AB.js → fthry_index.CWSqgxAa.js} +6 -6
  113. package/dist/{fthry_index.Cp9ByOuM.js → fthry_index.CreqHrWa.js} +1 -1
  114. package/dist/{fthry_index.3xvzHOZZ.js → fthry_index.D4jtsTFt.js} +2 -2
  115. package/dist/{fthry_index.Ddv2Wl8U.js → fthry_index.DEpC-Z5v.js} +5 -5
  116. package/dist/{fthry_index.iIuAf_k5.js → fthry_index.DJHFwZtE.js} +5 -5
  117. package/dist/{fthry_index.DS4zbyNr.js → fthry_index.DJzR8T-r.js} +5 -5
  118. package/dist/{fthry_index.D4fPFebv.js → fthry_index.DS-rgCeg.js} +6 -6
  119. package/dist/{fthry_index.DnhhW4As.js → fthry_index.DeOBTZSR.js} +2 -2
  120. package/dist/{fthry_index.CAJeovQO.js → fthry_index.Du_mis5t.js} +3 -3
  121. package/dist/{fthry_index.DKux24gh.js → fthry_index.NwQXVZvL.js} +3 -3
  122. package/dist/{fthry_index.BFJaHnz3.js → fthry_index.T_q8o1IJ.js} +1 -1
  123. package/dist/{fthry_index.C8hE_h0-.js → fthry_index.YJH2_M8x.js} +4 -4
  124. package/dist/{fthry_index.CwAjn-OA.js → fthry_index.YWCe9xut.js} +8 -8
  125. package/dist/{fthry_index.Bjgs69zf.js → fthry_index._4LdTVJS.js} +2 -2
  126. package/dist/{fthry_index.D8fPxN-r.js → fthry_index.aL99gjHK.js} +5 -5
  127. package/dist/{fthry_index.AugcPyKH.js → fthry_index.cdWJRcXS.js} +39 -42
  128. package/dist/{fthry_index.umd.8fDW5-do.js → fthry_index.umd.BYgeEgf8.js} +1 -1
  129. package/dist/{fthry_index.d-sboT23.js → fthry_index.xZSdf7ry.js} +152 -142
  130. package/dist/{fthry_input.Ciomtn44.js → fthry_input.DbXz6y8m.js} +1 -1
  131. package/dist/fthry_mermaid-O7DHMXV3.BTTUMTMH.js +8 -0
  132. package/dist/{fthry_script.D5JCT1ya.js → fthry_script.BORBdvL8.js} +1 -1
  133. package/dist/{fthry_styles.B6dfe-Eo.js → fthry_styles.BfxKVFUw.js} +1 -1
  134. package/dist/{fthry_useElementSize.D-kQCo-4.js → fthry_useElementSize.BIz4pNfw.js} +1 -1
  135. package/dist/{fthry_useSalesforceSync.DpnT6_XK.js → fthry_useSalesforceSync.wO8Y6yIk.js} +1 -1
  136. package/dist/{fthry_webfontloader.BOeyjl7h.js → fthry_webfontloader.D4WGyNNh.js} +1 -1
  137. package/dist/index.js +2 -2
  138. package/dist/thumbnail-renderer.js +1 -1
  139. package/dist/types/Form.d.ts +3 -0
  140. package/dist/types/Form.d.ts.map +1 -1
  141. package/package.json +2 -2
  142. package/umd/AssistantChat.4c90e588cefb3c7dcc90.js +1 -0
  143. package/umd/TableElement.f51ba6d3b0a6c7835187.js +1 -0
  144. package/umd/{TabsElement.2630875c197708900706.js → TabsElement.4120dda5e1b0305ddf59.js} +1 -1
  145. package/umd/index.js +1 -1
  146. package/dist/fthry_mermaid-O7DHMXV3.CjYot5Ez.js +0 -8
  147. package/umd/AssistantChat.f140cc1dcdc7d2e7b6ec.js +0 -1
  148. package/umd/TableElement.8c0bec8400517f135fe6.js +0 -1
@@ -1,8 +0,0 @@
1
- export { u as Mermaid } from './fthry_AssistantChat.BWukgD5o.js';
2
- import './fthry_index.AugcPyKH.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.BjYD1xpd.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)"}}});if(f&&1===t.length){var w=t[0],k=M(w),S=N(w);return(0,r.BX)("div",j({css:x},{children:[(0,r.BX)("button",j({type:"button",onClick:S?b:void 0,css:{display:"inline-flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"4px 0",cursor:S?"pointer":"default",color:T,textAlign:"left",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[k&&(0,r.tZ)(p,{css:{width:"12px",height:"12px",color:R}}),(0,r.tZ)("span",{children:X(w)}),S&&(0,r.tZ)(s,{css:{width:"12px",height:"12px",color:I,transform:m?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease",flexShrink:0}})]})),S&&m&&(0,r.tZ)(F,{row:w,linkColor:l,indent:6})]}))}var _=f?"Finished working":"Working on it...";return(0,r.BX)("div",j({css:x},{children:[(0,r.BX)("button",j({type:"button",onClick:b,css:{display:"inline-flex",alignItems:"center",gap:"6px",background:"none",border:"none",padding:"4px 0",cursor:"pointer",color:T,textAlign:"left",font:"inherit",fontSize:"13px",alignSelf:"flex-start"}},{children:[(0,r.tZ)("span",j({css:f?void 0:D},{children:_})),(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)("div",j({css:{display:"flex",flexDirection:"column",gap:"2px",marginLeft:"5px",paddingLeft:"13px",borderLeft:"2px solid ".concat(C)}},{children:t.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,{})}))]}))]}))}}}]);
@@ -1 +0,0 @@
1
- "use strict";(this.webpackChunkFeathery=this.webpackChunkFeathery||[]).push([[844],{5983:(e,t,r)=>{r.r(t),r.d(t,{default:()=>ct});var n=r(35944),o=r(67294),a=r(20426),i=function(){return i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)},l="#ffffff",c="#f9fafb",s="#f3f4f6",u="#e5e7eb",d="#d1d5db",f="#9ca3af",p="#4b5563",h="#111827",g="#1d4ed8",v="#ef4444",b="#dc2626",y={width:"16px",height:"16px",color:"#6b7280"},m={display:"flex",flexDirection:"column",gap:"2px","& svg":{marginInlineStart:"4px",width:"20px",height:"20px"}},x={width:"12px",height:"12px",color:f,opacity:.3,'&[data-active="true"]':{color:g,opacity:1}},w={display:"flex",alignItems:"center",gap:"8px"},C={position:"relative",overflowX:"auto",overflowY:"auto",backgroundColor:l,boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",borderRadius:"8px",border:"1px solid ".concat(u),minWidth:"100%",maxWidth:"100%",height:"100%",boxSizing:"border-box"},k={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"64px 24px",textAlign:"center"},S={color:p,fontSize:"16px",fontWeight:"500",margin:0},Z={position:"relative",flex:1},R={position:"absolute",top:0,bottom:0,left:0,display:"flex",alignItems:"center",paddingLeft:"12px",pointerEvents:"none"},P={display:"block",width:"100%",maxWidth:"384px",paddingLeft:"36px",paddingRight:"12px",paddingTop:"10px",paddingBottom:"10px",backgroundColor:c,border:"1px solid ".concat(u),color:h,fontSize:"14px",borderRadius:"8px",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",boxSizing:"border-box"},_={width:"100%",maxWidth:"100%",fontSize:"14px",textAlign:"left",color:p,textIndent:0,borderColor:"inherit",borderCollapse:"collapse"},B={fontSize:"14px",color:p,backgroundColor:c,borderBottom:"1px solid ".concat(u)},I={padding:"12px 24px",fontWeight:"500",userSelect:"none",whiteSpace:"nowrap"},L={backgroundColor:l,borderBottom:"1px solid ".concat(u),transition:"background-color 0.2s"},N={padding:"16px 24px",wordBreak:"break-word",overflowWrap:"anywhere"},A={display:"flex",alignItems:"center",flexWrap:"wrap",justifyContent:"space-between",padding:"16px",gap:"8px"},E={fontSize:"14px",fontWeight:"normal",color:p},D={fontWeight:"600",color:h},M={display:"flex",marginLeft:"-1px",fontSize:"14px",listStyle:"none",padding:0,margin:0},j={display:"flex",alignItems:"center",justifyContent:"center",color:p,backgroundColor:c,boxSizing:"border-box",border:"1px solid ".concat(u),fontWeight:"500",fontSize:"14px",textDecoration:"none",cursor:"pointer",height:"36px",wordBreak:"keep-all",overflowWrap:"normal","&:hover":{backgroundColor:s,color:h},"&:disabled:hover":{color:p,backgroundColor:c,cursor:"auto"}},T=i(i({},j),{borderRadius:"4px",paddingInline:"8px",paddingBlock:"4px",width:"auto",height:"auto",minHeight:"28px",position:"relative"}),X={width:"16px",height:"16px",color:p},O={position:"fixed",backgroundColor:l,border:"1px solid ".concat(d),borderRadius:"4px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",zIndex:9999,minWidth:"120px"},W={display:"block",width:"100%",textAlign:"left",paddingLeft:"12px",paddingRight:"12px",paddingTop:"8px",paddingBottom:"8px",fontSize:"14px",color:"#374151",backgroundColor:"transparent",border:"none",cursor:"pointer",whiteSpace:"nowrap",position:"relative","&:hover":{backgroundColor:s},"&:disabled:hover":{backgroundColor:"transparent",cursor:"auto"},"&:first-of-type":{borderTopLeftRadius:"4px",borderTopRightRadius:"4px"},"&:last-of-type":{borderBottomLeftRadius:"4px",borderBottomRightRadius:"4px"}},F={borderTop:"1px solid ".concat(u),margin:"4px 0"},z=i(i({},W),{color:v,"&:hover":{backgroundColor:s,color:b}}),V=i(i({},T),{aspectRatio:1,paddingLeft:0,paddingRight:0}),Q={display:"flex",gap:"8px",justifyContent:"flex-end"},K=i(i({},j),{width:"36px",borderRightWidth:0}),H=i(i({},K),{borderTopLeftRadius:"8px",borderBottomLeftRadius:"8px",paddingLeft:"12px",paddingRight:"12px",width:"auto"}),Y=i(i({},K),{borderTopRightRadius:"8px",borderBottomRightRadius:"8px",paddingLeft:"12px",paddingRight:"12px",width:"auto",borderRightWidth:1}),$=i(i({},K),{color:g,backgroundColor:"#eff6ff",border:"1px solid ".concat(u)}),q={opacity:.8,cursor:"default",color:f,"&:hover":{backgroundColor:c,color:f}},G=i(i({},K),{appearance:"none",WebkitAppearance:"none",cursor:"pointer",paddingLeft:"8px",paddingRight:"8px",width:"36px",textAlign:"center",outline:"none","&:hover":{backgroundColor:s,color:h},"&:focus":{outline:"none"}}),J={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px",borderBottom:"1px solid ".concat(u),gap:"12px"},U=i(i({},j),{borderRadius:"8px",paddingLeft:"12px",paddingRight:"12px",whiteSpace:"nowrap"}),ee={color:f,cursor:"pointer",userSelect:"none",fontSize:"14px"},te={display:"block",width:"100%",minWidth:0,maxWidth:"100%",padding:"4px 8px",border:"1px solid ".concat(g),borderRadius:"4px",fontSize:"14px",color:h,outline:"none",boxSizing:"border-box",resize:"none",overflowY:"auto",fontFamily:"inherit",lineHeight:1.5},re={display:"flex",alignItems:"flex-start",gap:"8px"},ne={flex:1,minWidth:0,whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word",lineHeight:1.5},oe={flex:1,minWidth:0,position:"relative",alignSelf:"stretch"},ae=i(i({},te),{whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word",visibility:"hidden",pointerEvents:"none"}),ie={position:"absolute",inset:0,height:"100%"},le={display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",borderRadius:"4px",border:"none",backgroundColor:"transparent",color:f,cursor:"pointer",opacity:0,transition:"opacity 0.15s",flexShrink:0,padding:0,'tr:hover &, &[aria-expanded="true"]':{opacity:1},"&:hover":{backgroundColor:s,color:p}},ce={width:"40px",padding:"0 8px"},se={display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",borderRadius:"4px",border:"none",backgroundColor:"transparent",color:f,cursor:"pointer",opacity:0,transition:"opacity 0.15s",padding:0,"tr:hover &":{opacity:1},"&:hover":{backgroundColor:s,color:v}},ue={position:"fixed",backgroundColor:l,border:"1px solid ".concat(d),borderRadius:"8px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",zIndex:9999,padding:"12px 16px"},de={margin:"0 0 12px 0",fontSize:"14px",fontWeight:"500",color:h},fe={display:"flex",gap:"8px",justifyContent:"flex-end"},pe=i(i({},j),{borderRadius:"6px",paddingLeft:"12px",paddingRight:"12px",height:"32px"}),he=i(i({},j),{borderRadius:"6px",paddingLeft:"12px",paddingRight:"12px",height:"32px",backgroundColor:v,color:l,border:"1px solid ".concat(v),"&:hover":{backgroundColor:b,color:l}}),ge="feathery-table-header-cell",ve="feathery-table-row",be="feathery-table-cell",ye="feathery-table-editable-cell",me="feathery-table-action-menu-item",xe="feathery-table-page-button",we=function(){return we=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},we.apply(this,arguments)};function Ce(){return(0,n.tZ)("svg",we({css:y,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2},{children:(0,n.tZ)("path",{strokeLinecap:"round",d:"M21 21l-3.5-3.5M17 10a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"})}))}function ke(e){var t=e.searchQuery,r=e.onSearchChange;return(0,n.BX)("div",we({className:"feathery-table-search",css:Z},{children:[(0,n.tZ)("div",we({css:R},{children:(0,n.tZ)(Ce,{})})),(0,n.tZ)("input",{type:"text",className:"feathery-table-search-input",css:P,placeholder:"Search",value:t,onChange:function(e){return r(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&e.preventDefault()}})]}))}var Se=function(){return Se=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Se.apply(this,arguments)};function Ze(e){var t=e.isSorted,r=e.sortDirection;return(0,n.BX)("svg",Se({xmlns:"http://www.w3.org/2000/svg",className:"feathery-table-sort-icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},{children:[(0,n.tZ)("path",{css:x,stroke:"currentColor","data-active":t&&"asc"===r||void 0,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m8 9 4-4 4 4"}),(0,n.tZ)("path",{css:x,stroke:"currentColor","data-active":t&&"desc"===r||void 0,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m8 15 4 4 4-4"})]}))}function Re(e){var t=e.columns,r=e.enableSort,a=e.sortColumn,i=e.sortDirection,l=e.onSort,c=e.styles;return(0,n.tZ)(o.Fragment,{children:t.map((function(e,t){var o=r,s=a===e.name,u=0===t;return(0,n.tZ)("th",Se({scope:"col",className:ge,"data-feathery-field":e.field_key,onClick:function(){return o&&l(e.name)},css:Se(Se(Se(Se({},I),u?{}:{paddingLeft:0}),c.getTarget("th")),o?{cursor:"pointer"}:{})},{children:(0,n.BX)("div",Se({css:w},{children:[(0,n.tZ)("span",{children:e.name}),o&&(0,n.tZ)("span",Se({css:m},{children:(0,n.tZ)(Ze,{isSorted:s,sortDirection:i})}))]}))}),t)}))})}var Pe=function(){return Pe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Pe.apply(this,arguments)};function _e(e){var t=e.currentPage,r=e.totalItems,o=e.rowsPerPage;return(0,n.BX)("span",Pe({css:E},{children:["Showing"," ",(0,n.BX)("span",Pe({css:D},{children:[t*o+1,"-",Math.min((t+1)*o,r)]}))," ","of ",(0,n.tZ)("span",Pe({css:D},{children:r}))]}))}function Be(e){var t=e.disabled,r=e.onClick;return(0,n.tZ)("button",Pe({type:"button",onClick:r,disabled:t,className:xe,css:Pe(Pe({},H),t?q:{})},{children:"Previous"}))}function Ie(e){var t=e.disabled,r=e.onClick;return(0,n.tZ)("button",Pe({type:"button",onClick:r,disabled:t,className:xe,css:Pe(Pe({},Y),t?q:{})},{children:"Next"}))}function Le(e){var t=e.pages,r=e.onPageChange;return(0,n.BX)("select",Pe({value:"",onChange:function(e){r(Number(e.target.value))},"aria-label":"Go to page",className:"feathery-table-page-select",css:G},{children:[(0,n.tZ)("option",Pe({value:"",disabled:!0,hidden:!0},{children:"..."})),t.map((function(e){return(0,n.tZ)("option",Pe({value:e},{children:e+1}),e)}))]}))}function Ne(e){var t=e.currentPage,r=e.totalPages,a=e.onPageChange,i=new Set;i.add(0),i.add(r-1);for(var l=Math.max(0,t-1);l<=Math.min(r-1,t+1);l++)i.add(l);var c=[],s=Array.from(i).sort((function(e,t){return e-t}));for(l=0;l<s.length;l++){var u=s[l],d=l>0?s[l-1]:-1;if(u-d>1){for(var f=[],p=d+1;p<u;p++)f.push(p);c.push({type:"overflow",pages:f})}c.push({type:"page",page:u})}return(0,n.tZ)(o.Fragment,{children:c.map((function(e,r){if("overflow"===e.type)return 1===e.pages.length?(0,n.tZ)("li",{children:(0,n.tZ)("button",Pe({type:"button",onClick:function(){return a(e.pages[0])},className:xe,css:K},{children:e.pages[0]+1}))},"overflow-".concat(r)):(0,n.tZ)("li",{children:(0,n.tZ)(Le,{pages:e.pages,onPageChange:a})},"overflow-".concat(r));var o=e.page===t;return(0,n.tZ)("li",{children:(0,n.tZ)("button",Pe({type:"button",onClick:function(){return a(e.page)},"aria-current":o?"page":void 0,className:xe,css:o?$:K},{children:e.page+1}))},e.page)}))})}function Ae(e){var t=e.currentPage,r=e.totalPages,o=e.totalItems,a=e.rowsPerPage,i=e.onPageChange;return r<=1?null:(0,n.BX)("nav",Pe({className:"feathery-table-pagination",css:A,"aria-label":"Table navigation"},{children:[(0,n.tZ)(_e,{currentPage:t,totalItems:o,rowsPerPage:a}),(0,n.BX)("ul",Pe({css:M},{children:[(0,n.tZ)("li",{children:(0,n.tZ)(Be,{disabled:0===t,onClick:function(){return i(Math.max(0,t-1))}})}),(0,n.tZ)(Ne,{currentPage:t,totalPages:r,onPageChange:i}),(0,n.tZ)("li",{children:(0,n.tZ)(Ie,{disabled:t>=r-1,onClick:function(){i(Math.min(r-1,t+1))}})})]}))]}))}var Ee=r(73935),De=r(95710),Me=r(39479),je=function(){return je=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},je.apply(this,arguments)},Te=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i};function Xe(){return(0,n.BX)("svg",je({css:X,fill:"currentColor",viewBox:"0 0 24 24"},{children:[(0,n.tZ)("circle",{cx:"12",cy:"5",r:"2"}),(0,n.tZ)("circle",{cx:"12",cy:"12",r:"2"}),(0,n.tZ)("circle",{cx:"12",cy:"19",r:"2"})]}))}function Oe(e){var t,r,a,i=e.actions,l=e.rowIndex,c=e.columnData,s=e.fieldValues,u=e.onClick,d=e.forceInlineButtons,f=void 0!==d&&d,p=e.tableId,h=void 0===p?"":p,g=e.buttonLoaders,v=void 0===g?{}:g,b=e.canDeleteRows,y=void 0!==b&&b,m=e.onDeleteRow;if(0===i.length)return null;var x=Te((0,o.useState)(!1),2),w=x[0],C=x[1],k=Te((0,o.useState)({top:0,left:0}),2),S=k[0],Z=k[1],R=(0,o.useRef)(null),P=(0,o.useRef)(null),_=(0,o.useRef)(null),B=!f&&i.length>1;(0,o.useEffect)((function(){if(w){var e=function(e){P.current&&!P.current.contains(e.target)&&_.current&&!_.current.contains(e.target)&&C(!1)},t=function(){C(!1)},r=(0,Me.me)();return r.addEventListener("mousedown",e),r.addEventListener("scroll",t,!0),function(){r.removeEventListener("mousedown",e),r.removeEventListener("scroll",t,!0)}}}),[w]);var I=function(e){C(!1);var t=s||De.u4,r={};c.forEach((function(e){var n=t[e.field_key],o=Array.isArray(n)?n[l]:n;r[e.name]=o})),u({action:e.label,rowIndex:l,rowData:r})},L=null!==(a=null===(r=v["".concat(h,"_").concat(l,"_").concat(null===(t=i.find((function(e){var t,r="".concat(h,"_").concat(l,"_").concat(e.label);return null===(t=v[r])||void 0===t?void 0:t.loader})))||void 0===t?void 0:t.label)])||void 0===r?void 0:r.loader)&&void 0!==a?a:null;return(0,n.tZ)("div",je({ref:R,css:Q},{children:B?(0,n.BX)(o.Fragment,{children:[(0,n.tZ)("button",je({ref:_,type:"button",disabled:L,onClick:function(e){e.stopPropagation(),function(){if(!w&&_.current){var e=_.current.getBoundingClientRect();Z({top:e.bottom+4,left:e.right})}C(!w)}()},className:"feathery-table-action-menu-button",css:V},{children:L?(0,n.tZ)("div",je({style:{height:"16px",width:"16px",display:"flex",alignItems:"center",justifyContent:"center"}},{children:L})):(0,n.tZ)(Xe,{})})),w&&(0,Ee.createPortal)((0,n.BX)("div",je({ref:P,className:"feathery-table-action-menu",css:je(je({},O),{top:"".concat(S.top,"px"),left:"".concat(S.left,"px"),transform:"translateX(-100%)"})},{children:[i.map((function(e,t){var r=Object.keys(v).length>0;return(0,n.tZ)("button",je({type:"button",onClick:function(t){t.stopPropagation(),I(e)},className:me,css:W,disabled:r},{children:e.label}),t)})),y&&m&&(0,n.BX)(n.HY,{children:[(0,n.tZ)("div",{css:F}),(0,n.tZ)("button",je({type:"button",onClick:function(e){e.stopPropagation(),C(!1),m(l)},className:me,css:z},{children:"Delete"}))]})]})),(0,Me.me)().body)]}):i.map((function(e,t){var r,o="".concat(h,"_").concat(l,"_").concat(e.label),a=null===(r=v[o])||void 0===r?void 0:r.loader,i=Object.keys(v).length>0;return(0,n.BX)("button",je({type:"button",onClick:function(t){t.stopPropagation(),I(e)},className:"feathery-table-action-button",css:T,disabled:i},{children:[(0,n.tZ)("span",je({style:{visibility:a?"hidden":"visible"}},{children:e.label})),a&&(0,n.tZ)("div",je({style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",height:"16px",width:"16px"}},{children:a}))]}),t)}))}))}var We=function(){return We=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},We.apply(this,arguments)};function Fe(e){var t=e.hasSearchQuery;return(0,n.BX)("div",We({className:"feathery-table-empty",css:k},{children:[t&&(0,n.tZ)("svg",We({css:{width:"48px",height:"48px",color:"#9ca3af",marginBottom:"16px"},fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5},{children:(0,n.tZ)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"})})),(0,n.tZ)("p",We({css:S},{children:t?"No results found":"No data available"})),t&&(0,n.tZ)("p",We({css:We(We({},S),{fontSize:"14px",marginTop:"8px"})},{children:"Try adjusting your search query"}))]}))}var ze=function(){return ze=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ze.apply(this,arguments)};function Ve(e){var t=e.anchorEl,r=e.onConfirm,a=e.onCancel,i=e.message,l=void 0===i?"Delete this row?":i,c=e.confirmLabel,s=void 0===c?"Delete":c,u=(0,o.useRef)(null);if(!t)return null;var d=t.getBoundingClientRect(),f=d.bottom+4,p=d.right;return(0,o.useEffect)((function(){var e=function(e){u.current&&!u.current.contains(e.target)&&t&&!t.contains(e.target)&&a()},r=function(){return a()},n=function(e){"Escape"===e.key&&a()},o=(0,Me.me)();return o.addEventListener("mousedown",e),o.addEventListener("scroll",r,!0),o.addEventListener("keydown",n),function(){o.removeEventListener("mousedown",e),o.removeEventListener("scroll",r,!0),o.removeEventListener("keydown",n)}}),[a,t]),(0,Ee.createPortal)((0,n.BX)("div",ze({ref:u,role:"alertdialog","aria-label":l,className:"feathery-table-delete-confirm",css:ze(ze({},ue),{top:"".concat(f,"px"),left:"".concat(p,"px"),transform:"translateX(-100%)"})},{children:[(0,n.tZ)("p",ze({css:de},{children:l})),(0,n.BX)("div",ze({css:fe},{children:[(0,n.tZ)("button",ze({type:"button",css:pe,onClick:function(e){e.stopPropagation(),a()}},{children:"Cancel"})),(0,n.tZ)("button",ze({type:"button",css:he,onClick:function(e){e.stopPropagation(),r()}},{children:s}))]}))]})),(0,Me.me)().body)}var Qe=function(){return Qe=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Qe.apply(this,arguments)},Ke=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i};function He(){return(0,n.BX)("svg",Qe({width:"16",height:"16",fill:"currentColor",viewBox:"0 0 24 24"},{children:[(0,n.tZ)("circle",{cx:"12",cy:"5",r:"2"}),(0,n.tZ)("circle",{cx:"12",cy:"12",r:"2"}),(0,n.tZ)("circle",{cx:"12",cy:"19",r:"2"})]}))}function Ye(e){var t,r=e.value,i=e.fieldKey,l=e.rowIndex,c=e.onEdit,s=e.onClear,u=Ke((0,o.useState)(!1),2),d=u[0],f=u[1],p=Ke((0,o.useState)(""),2),h=p[0],g=p[1],v=Ke((0,o.useState)(!1),2),b=v[0],y=v[1],m=Ke((0,o.useState)(!1),2),x=m[0],w=m[1],C=Ke((0,o.useState)({top:0,left:0}),2),k=C[0],S=C[1],Z=(0,o.useRef)(null),R=(0,o.useRef)(null),P=(0,o.useRef)(null),_=(0,o.useRef)(!0),B=(0,o.useCallback)((function(){return w(!1)}),[]),I=null!==(t=(0,a.e7)(r))&&void 0!==t?t:"",L=""===I;(0,o.useEffect)((function(){d&&Z.current&&Z.current.focus()}),[d]),(0,o.useEffect)((function(){if(b){var e=function(e){P.current&&!P.current.contains(e.target)&&R.current&&!R.current.contains(e.target)&&y(!1)},t=function(){return y(!1)},r=(0,Me.me)();return r.addEventListener("mousedown",e),r.addEventListener("scroll",t,!0),function(){r.removeEventListener("mousedown",e),r.removeEventListener("scroll",t,!0)}}}),[b]);var N=function(){g(I),f(!0),y(!1)},A=function(){h!==I&&c(i,l,h),f(!1)};return d?(0,n.BX)("div",Qe({className:ye,css:oe},{children:[(0,n.tZ)("div",Qe({css:ae},{children:"".concat(h,"​")})),(0,n.tZ)("textarea",{ref:Z,value:h,onChange:function(e){return g(e.target.value)},onBlur:function(){_.current&&A(),_.current=!0},onKeyDown:function(e){(e.metaKey||e.ctrlKey)&&"Enter"===e.key?(e.preventDefault(),_.current=!1,A()):"Escape"===e.key?(e.preventDefault(),_.current=!1,f(!1)):"Tab"===e.key&&(_.current=!1,A())},className:"feathery-table-cell-input",css:Qe(Qe({},te),ie),onClick:function(e){return e.stopPropagation()}})]})):L?(0,n.tZ)("span",Qe({className:ye,css:ee,onClick:N},{children:"Click to edit"})):(0,n.BX)("div",Qe({className:ye,css:re},{children:[(0,n.tZ)("span",Qe({css:ne},{children:I})),(0,n.tZ)("button",Qe({ref:R,type:"button","aria-expanded":b,"aria-haspopup":"menu",css:le,onClick:function(e){if(e.stopPropagation(),!b&&R.current){var t=R.current.getBoundingClientRect();S({top:t.bottom+4,left:t.right})}y(!b)}},{children:(0,n.tZ)(He,{})})),b&&(0,Ee.createPortal)((0,n.BX)("div",Qe({ref:P,role:"menu",css:Qe(Qe({},O),{top:"".concat(k.top,"px"),left:"".concat(k.left,"px"),transform:"translateX(-100%)"})},{children:[(0,n.tZ)("button",Qe({type:"button",role:"menuitem",css:W,onClick:function(e){e.stopPropagation(),N()}},{children:"Edit Value"})),(0,n.tZ)("button",Qe({type:"button",role:"menuitem",css:W,onClick:function(e){e.stopPropagation(),y(!1),w(!0)}},{children:"Clear Field"}))]})),(0,Me.me)().body),x&&(0,n.tZ)(Ve,{anchorEl:R.current,message:"Clear this field?",confirmLabel:"Clear",onConfirm:function(){B(),s(i,l)},onCancel:B})]}))}var $e=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i};function qe(e){var t,r=function(e){if(null==e||""===e)return null;var t=String(e).trim().replace(/[$€£¥]/g,"").replace(/[,%]/g,"").replace(/\s/g,""),r=parseFloat(t);return isNaN(r)?null:r}(e),n=function(e){var t,r,n,o;if(null==e||""===e)return null;var a=String(e).trim(),i=new Date(a);if(!isNaN(i.getTime()))return i;try{for(var l=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}([/^(\d{1,2})[/-](\d{1,2})[/-](\d{2,4})$/,/^(\d{4})[/-](\d{1,2})[/-](\d{1,2})$/]),c=l.next();!c.done;c=l.next()){var s=c.value,u=a.match(s);if(u){var d=void 0,f=void 0,p=void 0;4===u[1].length?(d=(n=$e(u,4))[1],f=n[2],p=n[3]):(f=(o=$e(u,4))[1],p=o[2],d=o[3]),2===d.length&&(d=parseInt(d)<50?"20".concat(d):"19".concat(d));var h=new Date(parseInt(d),parseInt(f)-1,parseInt(p));if(!isNaN(h.getTime()))return h}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}return null}(e);return{original:e,asNumber:r,asDate:n,asString:null!==(t=(0,a.e7)(e))&&void 0!==t?t:""}}function Ge(e,t){return null!==e.asNumber&&null!==t.asNumber?e.asNumber-t.asNumber:null!==e.asDate&&null!==t.asDate?e.asDate.getTime()-t.asDate.getTime():e.asString.localeCompare(t.asString)}var Je=function(){return Je=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Je.apply(this,arguments)},Ue=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},et=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i},tt=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};function rt(e){return"".concat("__feathery_table_page_").concat(e)}var nt=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i},ot=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},at=r(65096),it=function(){return it=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},it.apply(this,arguments)},lt=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i};const ct=function(e){var t=e.element,r=e.responsiveStyles,i=e.onClick,l=void 0===i?function(){}:i,c=e.updateFieldValues,s=void 0===c?function(){}:c,u=e.submitCustom,d=void 0===u?function(){}:u,f=e.editMode,p=void 0!==f&&f,h=e.buttonLoaders,g=void 0===h?{}:h,v=e.assistantClient,b=(0,o.useMemo)((function(){return function(e){return e.addTargets("table","thead","tbody","th","td","tr"),e}(r)}),[r]),y=lt((0,o.useState)(0),2),x=y[0],k=y[1],S=(0,o.useCallback)((function(){return k((function(e){return e+1}))}),[]),Z=function(e){var t,r,n,i,l,c,s,u,d,f,p,h,g,v,b=e.element,y=e.editMode,m=void 0!==y&&y,x=e.dataVersion,w=void 0===x?0:x,C=(null===(t=b.properties)||void 0===t?void 0:t.columns)||[],k=((null===(r=b.properties)||void 0===r?void 0:r.actions)||[]).filter((function(e){return e.label&&""!==e.label.trim()})),S=null!==(i=null===(n=b.properties)||void 0===n?void 0:n.search)&&void 0!==i&&i,Z=null!==(c=null===(l=b.properties)||void 0===l?void 0:l.sort)&&void 0!==c&&c,R=null!==(u=null===(s=b.properties)||void 0===s?void 0:s.transpose)&&void 0!==u&&u,P=null!==(f=null===(d=b.properties)||void 0===d?void 0:d.enable_editing)&&void 0!==f&&f,_=null!==(h=null===(p=b.properties)||void 0===p?void 0:p.add_delete_rows)&&void 0!==h&&h,B=null!==(v=null===(g=b.properties)||void 0===g?void 0:g.pagination)&&void 0!==v?v:0,I="number"==typeof B&&B>0?Math.floor(B):0,L=I>0,N=(0,o.useMemo)((function(){var e=C;return m&&(e=e.map((function(e,t){return Je(Je({},e),{field_key:"example_column_".concat(t)})}))),e}),[m,C]),A=(0,o.useMemo)((function(){return m?function(e,t){void 0===t&&(t=2);var r={};return e.forEach((function(e){r[e.field_key]=Array(t).fill("Sample")})),r}(N):Je({},De.u4)}),[m,N,w]),E=et((0,o.useState)(""),2),D=E[0],M=E[1],j=et((0,o.useState)(null),2),T=j[0],X=j[1],O=et((0,o.useState)("asc"),2),W=O[0],F=O[1],z=et((0,o.useState)((function(){return function(e){var t=rt(e),r=sessionStorage.getItem(t);if(!r)return 0;var n=parseInt(r,10);return Number.isInteger(n)&&n>=0?n:0}(b.id)})),2),V=z[0],Q=z[1],K=(0,o.useMemo)((function(){return N.reduce((function(e,t){var r=A[t.field_key];return Array.isArray(r)?Math.max(e,r.length):e}),0)}),[N,A]),H=(0,o.useMemo)((function(){return Array.from({length:K},(function(e,t){return t}))}),[K]),Y=(0,o.useMemo)((function(){return R&&S&&D.trim()?H.filter((function(e){return N.some((function(t){var r,n=A[t.field_key],o=Array.isArray(n)?n[e]:n;return(null!==(r=(0,a.e7)(o))&&void 0!==r?r:"").toLowerCase().includes(D.toLowerCase().trim())}))})):H}),[R,H,N,D,S,A]),$=et((0,o.useState)(null),2),q=$[0],G=$[1],J=(0,o.useMemo)((function(){if(!R||!Z||null===q)return Y;var e=N[q];return e?tt([],et(Y),!1).sort((function(t,r){var n=A[e.field_key],o=Array.isArray(n)?n[t]:n,a=Array.isArray(n)?n[r]:n,i=Ge(qe(o),qe(a));return"asc"===W?i:-i})):Y}),[R,Y,q,W,N,A,Z]),U=(0,o.useMemo)((function(){if(!R||!L)return J;var e=V*I,t=e+I;return J.slice(e,t)}),[R,J,V,I,L]),ee=(0,o.useMemo)((function(){if(!R||0===K)return{columns:N,activeFieldValues:A,transposedRowIndices:[]};var e=function(e,t,r,n){var o,a,i,l,c,s,u=n||Array.from({length:r},(function(e,t){return t})),d=[{name:"",field_id:"_transpose_field_name",field_type:"text",field_key:"_transpose_field_name"}];try{for(var f=Ue(u),p=f.next();!p.done;p=f.next()){var h=p.value;d.push({name:"",field_id:"_transpose_row_".concat(h),field_type:"text",field_key:"_transpose_row_".concat(h),originalRowIndex:h})}}catch(e){o={error:e}}finally{try{p&&!p.done&&(a=f.return)&&a.call(f)}finally{if(o)throw o.error}}var g={_transpose_field_name:e.map((function(e){return e.name}))};try{for(var v=Ue(u),b=v.next();!b.done;b=v.next()){h=b.value;var y=[];try{for(var m=(c=void 0,Ue(e)),x=m.next();!x.done;x=m.next()){var w=t[x.value.field_key],C=Array.isArray(w)?w[h]:w;y.push(C)}}catch(e){c={error:e}}finally{try{x&&!x.done&&(s=m.return)&&s.call(m)}finally{if(c)throw c.error}}g["_transpose_row_".concat(h)]=y}}catch(e){i={error:e}}finally{try{b&&!b.done&&(l=v.return)&&l.call(v)}finally{if(i)throw i.error}}return{transposedColumns:d,transposedFieldValues:g,includedRowIndices:u}}(N,A,K,U);return{columns:e.transposedColumns,activeFieldValues:e.transposedFieldValues,transposedRowIndices:e.includedRowIndices}}),[R,N,A,K,U]),te=ee.columns,re=ee.activeFieldValues,ne=ee.transposedRowIndices,oe=(0,o.useMemo)((function(){return te.reduce((function(e,t){var r=re[t.field_key];return Array.isArray(r)?Math.max(e,r.length):e}),0)}),[te,re]),ae=(0,o.useMemo)((function(){return Array.from({length:oe},(function(e,t){return t}))}),[oe]),ie=(0,o.useMemo)((function(){return R?ae:S&&D.trim()?ae.filter((function(e){return te.some((function(t){var r,n=re[t.field_key],o=Array.isArray(n)?n[e]:n;return(null!==(r=(0,a.e7)(o))&&void 0!==r?r:"").toLowerCase().includes(D.toLowerCase().trim())}))})):ae}),[R,ae,te,D,S,re]),le=(0,o.useMemo)((function(){if(R)return ie;if(!Z||!T)return ie;var e=te.find((function(e){return e.name===T}));return e?tt([],et(ie),!1).sort((function(t,r){var n=re[e.field_key],o=Array.isArray(n)?n[t]:n,a=Array.isArray(n)?n[r]:n,i=Ge(qe(o),qe(a));return"asc"===W?i:-i})):ie}),[R,ie,T,W,te,Z,re]),ce=(0,o.useMemo)((function(){if(R)return ae;if(!L)return le;var e=V*I,t=e+I;return le.slice(e,t)}),[R,ae,le,V,I,L]),se=(0,o.useRef)({initialMount:!0,search:"",sortColumn:"",sortDirection:""});(0,o.useEffect)((function(){var e=se.current;if(e.initialMount)return e.initialMount=!1,e.search=D,e.sortColumn=T,void(e.sortDirection=W);D===e.search&&T===e.sortColumn&&W===e.sortDirection||(Q(0),e.search=D,e.sortColumn=T,e.sortDirection=W)}),[D,T,W]);var ue=R?J.length:le.length,de=L?Math.ceil(ue/I):1;(0,o.useEffect)((function(){var e,t,r;b.id&&(e=b.id,t=V,r=rt(e),sessionStorage.setItem(r,t.toString()))}),[b.id,V]),(0,o.useEffect)((function(){de>0&&V>=de&&Q(de-1)}),[de]);var fe=oe>0,pe=R?Y.length>0:ie.length>0;return{enableSearch:S,searchQuery:D,hasSearchResults:pe,setSearchQuery:M,enableSort:Z,sortColumn:T,sortDirection:W,sortedColumnIndex:q,handleSort:function(e){Z&&(T===e?"asc"===W?F("desc"):(X(null),F("asc")):(X(e),F("asc")))},handleTransposedSort:function(e){Z&&R&&(q===e?"asc"===W?F("desc"):(G(null),F("asc")):(G(e),F("asc")))},enablePagination:L,currentPage:V,paginatedRowIndices:ce,rowsPerPage:I,setCurrentPage:Q,columns:te,actions:k,isTransposed:R&&K>0,transposedRowIndices:ne,enableEditing:P,enableAddDeleteRows:_,totalRows:ue,totalPages:de,hasData:fe,activeFieldValues:re,baseColumns:N,baseFieldValues:A}}({element:t,editMode:p,dataVersion:x}),R=Z.enableSearch,P=Z.searchQuery,A=Z.setSearchQuery,E=Z.enableSort,D=Z.sortColumn,M=Z.sortDirection,j=Z.sortedColumnIndex,T=Z.handleSort,X=Z.handleTransposedSort,O=Z.enablePagination,W=Z.currentPage,F=Z.setCurrentPage,z=Z.paginatedRowIndices,V=Z.rowsPerPage,Q=Z.enableEditing,K=Z.enableAddDeleteRows,H=Z.columns,Y=Z.actions,$=Z.isTransposed,q=Z.transposedRowIndices,G=Z.totalRows,ee=Z.totalPages,te=Z.hasData,re=Z.hasSearchResults,ne=Z.activeFieldValues,oe=Z.baseColumns,ae=Z.baseFieldValues,ie=function(e){var t=e.columns,r=e.updateFieldValues,n=e.submitCustom,a=e.editMode,i=e.editModeFieldValues,l=e.enablePagination,c=e.setCurrentPage,s=e.setSearchQuery,u=e.searchQuery,d=e.onMutate,f=(0,o.useRef)(i);f.current=i;var p=(0,o.useCallback)((function(e){var t=(a?f.current:De.u4)[e];return Array.isArray(t)?t:[]}),[a]),h=(0,o.useCallback)((function(){var e={};t.forEach((function(t){var r=p(t.field_key);e[t.field_key]=ot([""],nt(r),!1)})),u&&s(""),r(e),d(),l&&c(0)}),[t,p,r,d,l,c,s,u]),g=(0,o.useCallback)((function(e){var r={};return t.forEach((function(t){var n=p(t.field_key);r[t.field_key]=n.filter((function(t,r){return r!==e}))})),r}),[t,p]),v=(0,o.useCallback)((function(e){var t=g(e);r(t),a||n(t),d()}),[g,r,n,a,d]),b=(0,o.useCallback)((function(e){var t=g(e);r(t),d()}),[g,r,d]),y=(0,o.useCallback)((function(e,t,o){var i,l=p(e),c=ot([],nt(l),!1);c[t]=o;var s=((i={})[e]=c,i);r(s),a||n(s),d()}),[p,r,n,a,d]),m=(0,o.useCallback)((function(e,t){y(e,t,"")}),[y]);return{handleAddRow:h,handleDeleteRow:v,handleRemoveRowLocal:b,handleCellEdit:y,handleCellClear:m}}({columns:oe,updateFieldValues:s,submitCustom:d,editMode:p,editModeFieldValues:ne,enablePagination:O,setCurrentPage:F,setSearchQuery:A,searchQuery:P,onMutate:S}),le=ie.handleAddRow,ue=ie.handleDeleteRow,de=ie.handleCellEdit,fe=ie.handleCellClear,pe=null==t?void 0:t.id,he=Q&&!$,ye=he&&K,me=he&&K,xe=Y.length>1,we=me&&!xe,Ce=lt((0,o.useState)(new Set),2),Se=Ce[0],Pe=Ce[1],_e=(0,o.useRef)(Se);_e.current=Se;var Be=(0,o.useCallback)((function(e,t,r){_e.current.has(t)&&Pe((function(e){var r=new Set(e);return r.delete(t),r})),de(e,t,r)}),[de]),Ie=lt((0,o.useState)(null),2),Le=Ie[0],Ne=Ie[1],Ee=(0,o.useRef)(W);Ee.current!==W&&(Ee.current=W,Ne(null));var Me=(0,o.useCallback)((function(){return Ne(null)}),[]),je=(0,o.useRef)(new Map),Te=(0,o.useRef)(new Map),Xe=(0,o.useCallback)((function(){Ne(null),le(),Pe((function(e){var t=new Set;return t.add(0),e.forEach((function(e){return t.add(e+1)})),t}))}),[le]),We=(0,o.useCallback)((function(e){ue(e),Ne(null)}),[ue]);(0,o.useEffect)((function(){if(v&&pe)return v.registerTable(pe,{handleCellEdit:Be,handleAddRow:Xe,handleDeleteRow:We}),function(){return v.unregisterTable(pe)}}),[v,pe,Be,Xe,We]);var ze=!te||!re,Qe=R||ye;return(0,n.BX)("div",it({className:"feathery-table-container",css:it(it({},C),b.getTarget("container"))},{children:[Qe&&(0,n.BX)("div",it({className:"feathery-table-toolbar",css:J},{children:[R?(0,n.tZ)(ke,{searchQuery:P,onSearchChange:A}):(0,n.tZ)("div",{}),ye&&(0,n.tZ)("button",it({type:"button",className:"feathery-table-add-row-button",css:U,onClick:Xe},{children:"+ Add Row"}))]})),ze?(0,n.tZ)(Fe,{hasSearchQuery:P.trim().length>0}):(0,n.tZ)("div",it({css:{overflowX:"auto"}},{children:(0,n.BX)("table",it({className:"feathery-table",css:it(it({},_),b.getTarget("table"))},{children:[!$&&(0,n.tZ)("thead",it({className:"feathery-table-header",css:B},{children:(0,n.BX)("tr",{children:[(0,n.tZ)(Re,{columns:H,enableSort:E,sortColumn:D,sortDirection:M,onSort:T,styles:b}),Y.length>0&&(0,n.tZ)("th",{scope:"col",className:ge,css:it(it(it({},I),{paddingLeft:0}),b.getTarget("th"))}),we&&(0,n.tZ)("th",{scope:"col",className:ge,css:it(it(it({},I),ce),b.getTarget("th"))})]})})),(0,n.BX)("tbody",it({className:"feathery-table-body",css:b.getTarget("tbody")},{children:[z.map((function(e){var r,o,i={};return $||H.forEach((function(t){var r=ne[t.field_key],n=Array.isArray(r)?r[e]:r;i[t.name]=n})),(0,n.BX)("tr",it({className:ve,css:it(it({},L),b.getTarget("tr")),onClick:function(){$||he||l({rowIndex:e,rowData:i})}},{children:[H.map((function(t,r){var o,i,c,s=ne[t.field_key],u=Array.isArray(s)?s[e]:s,d=$&&0===r,f=d&&E,p=j===e,h=0===r,g=1===r,v=$&&!d?t.originalRowIndex:void 0,y=d?it(it(it(it({},I),{backgroundColor:"#f9fafb",borderRight:"1px solid #e5e7eb",width:"1px",whiteSpace:"nowrap"}),b.getTarget("th")),f?{cursor:"pointer"}:{}):it(it(it(it({},N),$?g?{}:{paddingLeft:0}:h?{}:{paddingLeft:0}),$&&!d?{cursor:"pointer"}:{}),b.getTarget("td")),x=d?"th":"td",C=$?null===(o=oe[e])||void 0===o?void 0:o.field_key:t.field_key;return(0,n.tZ)(x,it({className:d?ge:be,"data-feathery-field":C,css:y,onClick:function(t){if(f)X(e);else if($&&void 0!==v){t.stopPropagation();var r={};oe.forEach((function(e){var t=ae[e.field_key],n=Array.isArray(t)?t[v]:t;r[e.name]=n})),l({rowIndex:v,rowData:r})}}},d?{scope:"row"}:{},{children:d&&f?(0,n.BX)("div",it({css:it(it({},w),{justifyContent:"space-between"})},{children:[(0,n.tZ)("span",{children:null!==(i=(0,a.e7)(u))&&void 0!==i?i:""}),(0,n.tZ)("span",it({css:m},{children:(0,n.tZ)(Ze,{isSorted:p,sortDirection:M})}))]})):he?(0,n.tZ)(Ye,{value:u,fieldKey:t.field_key,rowIndex:e,onEdit:Be,onClear:fe}):null!==(c=(0,a.e7)(u))&&void 0!==c?c:""}),r)})),!$&&Y.length>0&&(0,n.BX)("td",it({ref:function(t){t?Te.current.set(e,t):Te.current.delete(e)},className:be,css:it(it(it({},N),{paddingLeft:0}),b.getTarget("td"))},{children:[(0,n.tZ)(Oe,{actions:Y,rowIndex:e,columnData:oe,fieldValues:ae,onClick:l,tableId:t.id,buttonLoaders:g,canDeleteRows:me&&xe,onDeleteRow:function(e){return Ne(e)}}),xe&&me&&Le===e&&(0,n.tZ)(Ve,{anchorEl:null!==(r=Te.current.get(e))&&void 0!==r?r:null,onConfirm:function(){return We(e)},onCancel:Me})]})),we&&(0,n.BX)("td",it({className:be,css:it(it({},ce),b.getTarget("td"))},{children:[(0,n.tZ)("button",it({type:"button",ref:function(t){t?je.current.set(e,t):je.current.delete(e)},className:"feathery-table-delete-button",css:it(it({},se),Le===e&&{opacity:1}),onClick:function(t){t.stopPropagation(),Ne(Le===e?null:e)}},{children:(0,n.tZ)(at.XH,{})})),Le===e&&(0,n.tZ)(Ve,{anchorEl:null!==(o=je.current.get(e))&&void 0!==o?o:null,onConfirm:function(){return We(e)},onCancel:Me})]}))]}),e)})),$&&Y.length>0&&(0,n.BX)("tr",it({className:ve,css:it(it({},L),b.getTarget("tr"))},{children:[(0,n.tZ)("th",{scope:"row",className:ge,css:it(it(it({},I),{backgroundColor:"#f9fafb",borderRight:"1px solid #e5e7eb",width:"1px",whiteSpace:"nowrap"}),b.getTarget("th"))}),q.map((function(e,r){return(0,n.tZ)("td",it({className:be,css:it(it(it({},N),0===r?{}:{paddingLeft:0}),b.getTarget("td"))},{children:(0,n.tZ)("div",it({css:{display:"flex",justifyContent:"flex-start"}},{children:(0,n.tZ)(Oe,{actions:Y,rowIndex:e,columnData:oe,fieldValues:ae,onClick:l,forceInlineButtons:!0,tableId:t.id,buttonLoaders:g})}))}),e)}))]}))]}))]}))})),!ze&&O&&(0,n.tZ)(Ae,{currentPage:W,totalPages:ee,totalItems:G,rowsPerPage:V,onPageChange:F})]}))}}}]);