@feathery/react 2.43.0 → 2.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/Form/grid/Element/index.d.ts.map +1 -1
- package/cjs/Form/index.d.ts.map +1 -1
- package/cjs/assistant/AssistantChat.d.ts.map +1 -1
- package/cjs/assistant/AssistantClient.d.ts +30 -6
- package/cjs/assistant/AssistantClient.d.ts.map +1 -1
- package/cjs/assistant/ToolStatus.d.ts.map +1 -1
- package/cjs/assistant/tools/clickElement.d.ts +4 -3
- package/cjs/assistant/tools/clickElement.d.ts.map +1 -1
- package/cjs/assistant/tools/panelRuntime.d.ts +18 -1
- package/cjs/assistant/tools/panelRuntime.d.ts.map +1 -1
- package/cjs/assistant/tools/setFieldValue.d.ts +15 -23
- package/cjs/assistant/tools/setFieldValue.d.ts.map +1 -1
- package/cjs/assistant/tools/tableMutations.d.ts +36 -0
- package/cjs/assistant/tools/tableMutations.d.ts.map +1 -0
- package/cjs/assistant/tools/triggerTableAction.d.ts +17 -0
- package/cjs/assistant/tools/triggerTableAction.d.ts.map +1 -0
- package/cjs/assistant/tools/utils.d.ts +33 -0
- package/cjs/assistant/tools/utils.d.ts.map +1 -0
- package/cjs/assistant/utils.d.ts +0 -1
- package/cjs/assistant/utils.d.ts.map +1 -1
- package/cjs/elements/basic/TableElement/index.d.ts +1 -1
- package/cjs/elements/basic/TableElement/index.d.ts.map +1 -1
- package/cjs/{fthry_AssistantChat.Dc6irzAk.js → fthry_AssistantChat.CTrXRHYC.js} +951 -327
- package/cjs/{fthry_FormControl.D_eydQlT.js → fthry_FormControl.BoilLJu3.js} +1 -1
- package/cjs/{fthry_InlineTooltip.Km0nxBV3.js → fthry_InlineTooltip.C3LL7yhx.js} +2 -2
- package/cjs/{fthry_Overlay.ChABiy0m.js → fthry_Overlay.C_kMTQo_.js} +1 -1
- package/cjs/{fthry_PaymentMethodField.BMABompY.js → fthry_PaymentMethodField.B7Y0YcQQ.js} +4 -4
- package/cjs/{fthry_Placeholder.CnNGDD_K.js → fthry_Placeholder.Ckf5rx3l.js} +1 -1
- package/cjs/{fthry_ShowEyeIcon.Cozhh36m.js → fthry_ShowEyeIcon.Dw983jmd.js} +1 -1
- package/cjs/{fthry_auto-track.CzyR3umO.js → fthry_auto-track.DdU0wd90.js} +2 -2
- package/cjs/{fthry_highlighted-body-TPN3WLV5.D8LjPUtI.js → fthry_highlighted-body-TPN3WLV5.Dgq3ZfLo.js} +3 -3
- package/cjs/{fthry_index.B5TkPpn3.js → fthry_index.29ly7g2Z.js} +2 -2
- package/cjs/{fthry_index.B7Slrn_2.js → fthry_index.37lEi-Hp.js} +1 -1
- package/cjs/{fthry_index.Dn7k0XbZ.js → fthry_index.3RtrK8MX.js} +220 -157
- package/cjs/{fthry_index._pqB5lCu.js → fthry_index.5r0bFZtm.js} +8 -8
- package/cjs/{fthry_index.H4GgWRQ-.js → fthry_index.B4peckbq.js} +1 -1
- package/cjs/{fthry_index.wTd_xpVX.js → fthry_index.BGz622Tq.js} +4 -4
- package/cjs/{fthry_index.BPu5GDF3.js → fthry_index.BHqkdfIz.js} +5 -5
- package/cjs/{fthry_index.8ZkixEuX.js → fthry_index.BI8F8bA_.js} +2 -2
- package/cjs/{fthry_index.KMyCBmte.js → fthry_index.BfbtecrW.js} +1 -1
- package/cjs/{fthry_index.D6PlFvY8.js → fthry_index.Buv2Sg-R.js} +5 -5
- package/cjs/{fthry_index.DMmTH04s.js → fthry_index.Bv2eS3Vo.js} +2 -2
- package/cjs/{fthry_index.CsV6zv_0.js → fthry_index.BvbHMtIp.js} +5 -5
- package/cjs/{fthry_index.B76xVeoK.js → fthry_index.C3PGeG-p.js} +10 -10
- package/cjs/{fthry_index.DoliEMOD.js → fthry_index.C8F7fXYY.js} +3 -3
- package/cjs/{fthry_index.CMRH7foG.js → fthry_index.CKVVzHIN.js} +6 -6
- package/cjs/{fthry_index.BYJ0Cjz1.js → fthry_index.CVnv_Jad.js} +1 -1
- package/cjs/{fthry_index.B79ksg_6.js → fthry_index.CZEWDsUp.js} +2 -2
- package/cjs/{fthry_index.B4qsX_2B.js → fthry_index.CelZlNgP.js} +4 -4
- package/cjs/{fthry_index.Cj3i1JIs.js → fthry_index.D3dqn02k.js} +1 -1
- package/cjs/{fthry_index.BVLMhJHP.js → fthry_index.D8Red3Ny.js} +37 -20
- package/cjs/{fthry_index.DfOk3_Vc.js → fthry_index.DDPSNVyH.js} +1 -1
- package/cjs/{fthry_index.5oiWIOUK.js → fthry_index.DicGhamJ.js} +1 -1
- package/cjs/{fthry_index.WbKUUcdS.js → fthry_index.Dod7JSDp.js} +1 -1
- package/cjs/{fthry_index.D7jBFEkz.js → fthry_index.Dom24Lwj.js} +1 -1
- package/cjs/{fthry_index.B-QAg85r.js → fthry_index.DzFvroe5.js} +6 -6
- package/cjs/{fthry_index.DcnmaMvN.js → fthry_index.GMymJjG7.js} +2 -2
- package/cjs/{fthry_index.Crv5Oqdb.js → fthry_index.LV1j0g0M.js} +6 -6
- package/cjs/{fthry_index.Cj8NIIWS.js → fthry_index.LvXa1Omo.js} +6 -6
- package/cjs/{fthry_index.BNFRKqrl.js → fthry_index.hlvuql4I.js} +5 -5
- package/cjs/{fthry_index.x_Q9efXs.js → fthry_index.jKKDa77s.js} +2 -2
- package/cjs/{fthry_index.ecHJPvgK.js → fthry_index.kb1SveDj.js} +3 -3
- package/cjs/{fthry_index.umd.lxnwBuEl.js → fthry_index.umd.IVs8gbvz.js} +1 -1
- package/cjs/{fthry_input.DJaKnXqS.js → fthry_input.CtQ9PDhT.js} +1 -1
- package/cjs/{fthry_mermaid-O7DHMXV3.CyaPsnki.js → fthry_mermaid-O7DHMXV3.OED8wUgR.js} +3 -3
- package/cjs/{fthry_script.DrFnB8ud.js → fthry_script.BVZmLSex.js} +1 -1
- package/cjs/{fthry_styles.qeOM9hPF.js → fthry_styles.D-_UUb_M.js} +1 -1
- package/cjs/{fthry_useElementSize.K1QGuhUj.js → fthry_useElementSize.CDRo_Jkc.js} +1 -1
- package/cjs/{fthry_useSalesforceSync.DQd2UZn6.js → fthry_useSalesforceSync.Bx08h06s.js} +1 -1
- package/cjs/{fthry_webfontloader.D6aR0hiT.js → fthry_webfontloader.BH2uCTmw.js} +1 -1
- package/cjs/index.js +1 -1
- package/cjs/utils/button.d.ts +2 -0
- package/cjs/utils/button.d.ts.map +1 -0
- package/cjs/utils/hideAndRepeats.d.ts.map +1 -1
- package/cjs/utils/repeat.d.ts +5 -0
- package/cjs/utils/repeat.d.ts.map +1 -1
- package/dist/Form/grid/Element/index.d.ts.map +1 -1
- package/dist/Form/index.d.ts.map +1 -1
- package/dist/assistant/AssistantChat.d.ts.map +1 -1
- package/dist/assistant/AssistantClient.d.ts +30 -6
- package/dist/assistant/AssistantClient.d.ts.map +1 -1
- package/dist/assistant/ToolStatus.d.ts.map +1 -1
- package/dist/assistant/tools/clickElement.d.ts +4 -3
- package/dist/assistant/tools/clickElement.d.ts.map +1 -1
- package/dist/assistant/tools/panelRuntime.d.ts +18 -1
- package/dist/assistant/tools/panelRuntime.d.ts.map +1 -1
- package/dist/assistant/tools/setFieldValue.d.ts +15 -23
- package/dist/assistant/tools/setFieldValue.d.ts.map +1 -1
- package/dist/assistant/tools/tableMutations.d.ts +36 -0
- package/dist/assistant/tools/tableMutations.d.ts.map +1 -0
- package/dist/assistant/tools/triggerTableAction.d.ts +17 -0
- package/dist/assistant/tools/triggerTableAction.d.ts.map +1 -0
- package/dist/assistant/tools/utils.d.ts +33 -0
- package/dist/assistant/tools/utils.d.ts.map +1 -0
- package/dist/assistant/utils.d.ts +0 -1
- package/dist/assistant/utils.d.ts.map +1 -1
- package/dist/elements/basic/TableElement/index.d.ts +1 -1
- package/dist/elements/basic/TableElement/index.d.ts.map +1 -1
- package/dist/{fthry_AssistantChat.D2SjzX88.js → fthry_AssistantChat.D97z2Fjs.js} +951 -327
- package/dist/{fthry_FormControl.AWZ2hRhb.js → fthry_FormControl.DJieQaw-.js} +1 -1
- package/dist/{fthry_InlineTooltip.DAaWNMEQ.js → fthry_InlineTooltip.Chat1FIN.js} +2 -2
- package/dist/{fthry_Overlay.C500WG6U.js → fthry_Overlay.pCv-XBOA.js} +1 -1
- package/dist/{fthry_PaymentMethodField.Bl2Ce36L.js → fthry_PaymentMethodField._G2uJ6Ks.js} +4 -4
- package/dist/{fthry_Placeholder.DXrZi2ze.js → fthry_Placeholder.C7B4adz4.js} +1 -1
- package/dist/{fthry_ShowEyeIcon.D3iEMZA7.js → fthry_ShowEyeIcon.DrP5GypN.js} +1 -1
- package/dist/{fthry_auto-track.C9HCW4qJ.js → fthry_auto-track.Bb7a2GMR.js} +2 -2
- package/dist/{fthry_highlighted-body-TPN3WLV5.j0rrY2PD.js → fthry_highlighted-body-TPN3WLV5.QeEpdZbH.js} +3 -3
- package/dist/{fthry_index.IaraEDTR.js → fthry_index.0o3T2ouc.js} +1 -1
- package/dist/{fthry_index.Cn4kA2tn.js → fthry_index.1SZZv9d2.js} +10 -10
- package/dist/{fthry_index.C-Af9t8c.js → fthry_index.B6pEx1zI.js} +5 -5
- package/dist/{fthry_index.BALrl_Ek.js → fthry_index.BJKDlrlW.js} +4 -4
- package/dist/{fthry_index.DFZRIGNF.js → fthry_index.BMzPHmtX.js} +2 -2
- package/dist/{fthry_index.DZviU_0h.js → fthry_index.BWH9S7pc.js} +37 -20
- package/dist/{fthry_index.BHbPxMcy.js → fthry_index.BZvFWQLR.js} +2 -2
- package/dist/{fthry_index.D8_hWgYx.js → fthry_index.BpKf-eNy.js} +1 -1
- package/dist/{fthry_index.DzDuGB1B.js → fthry_index.C5BLw18G.js} +6 -6
- package/dist/{fthry_index.4rXsgo8n.js → fthry_index.C8LO6uJL.js} +6 -6
- package/dist/{fthry_index.BoXwpo3p.js → fthry_index.CDuqBBJn.js} +216 -158
- package/dist/{fthry_index.CB6eTYmX.js → fthry_index.CIlxRQ4S.js} +5 -5
- package/dist/{fthry_index.BDtWG5y-.js → fthry_index.CUY_p8do.js} +5 -5
- package/dist/{fthry_index.C8xVXq31.js → fthry_index.CXn-UnK8.js} +3 -3
- package/dist/{fthry_index.BlrVY1vE.js → fthry_index.ChUSP_4k.js} +6 -6
- package/dist/{fthry_index.0DlQOa4l.js → fthry_index.ClZUnlbG.js} +1 -1
- package/dist/{fthry_index.DtHlcCDX.js → fthry_index.Cqhg3Wmg.js} +1 -1
- package/dist/{fthry_index.DOGU2-kQ.js → fthry_index.Csz_U1Oc.js} +5 -5
- package/dist/{fthry_index.D3O1Qvm3.js → fthry_index.CubzFuFl.js} +3 -3
- package/dist/{fthry_index.C9P7Vo6r.js → fthry_index.D1iW0N2t.js} +1 -1
- package/dist/{fthry_index.Cd0JKkOc.js → fthry_index.D4pTk5dr.js} +8 -8
- package/dist/{fthry_index.DA5HHbVe.js → fthry_index.DA_5F_7_.js} +1 -1
- package/dist/{fthry_index.-lEiRiJ3.js → fthry_index.DG6NlwpO.js} +2 -2
- package/dist/{fthry_index.Co2zkJCZ.js → fthry_index.DJ7vQ3zt.js} +1 -1
- package/dist/{fthry_index.OgRdIE07.js → fthry_index.DJRjeQWm.js} +5 -5
- package/dist/{fthry_index.D2-zTdBQ.js → fthry_index.DdgFKsos.js} +1 -1
- package/dist/{fthry_index.CS604ePK.js → fthry_index.DuRVVFRL.js} +2 -2
- package/dist/{fthry_index.D5dmTp6g.js → fthry_index.QPKqFn46.js} +1 -1
- package/dist/{fthry_index.BjZmdaIR.js → fthry_index.UTYK1bhI.js} +2 -2
- package/dist/{fthry_index.x_DcI6GR.js → fthry_index.XG1xyplD.js} +4 -4
- package/dist/{fthry_index.umd.BhHG1ThX.js → fthry_index.umd.DLnl0brp.js} +1 -1
- package/dist/{fthry_index.DAdR6bYe.js → fthry_index.x66JmbiK.js} +2 -2
- package/dist/{fthry_input.Y2HVhQeo.js → fthry_input.BgzKGmQG.js} +1 -1
- package/dist/{fthry_mermaid-O7DHMXV3._Ng2DeVi.js → fthry_mermaid-O7DHMXV3.DehdVKQ3.js} +3 -3
- package/dist/{fthry_script.4cQVioC4.js → fthry_script.BcdCwqG3.js} +1 -1
- package/dist/{fthry_styles.DX0NUnVP.js → fthry_styles.DNxDElEh.js} +1 -1
- package/dist/{fthry_useElementSize.BCbe9jZd.js → fthry_useElementSize.DvHJBcIE.js} +1 -1
- package/dist/{fthry_useSalesforceSync.DJFGoBIG.js → fthry_useSalesforceSync.DHWXQkeF.js} +1 -1
- package/dist/{fthry_webfontloader.4kqCCEG_.js → fthry_webfontloader.C-DWZTL7.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/button.d.ts +2 -0
- package/dist/utils/button.d.ts.map +1 -0
- package/dist/utils/hideAndRepeats.d.ts.map +1 -1
- package/dist/utils/repeat.d.ts +5 -0
- package/dist/utils/repeat.d.ts.map +1 -1
- package/package.json +1 -1
- package/umd/AssistantChat.685c311fcfd51a09112e.js +1 -0
- package/umd/{TableElement.fef6a362cfa150f0f38e.js → TableElement.e3da137819e9b84b3b82.js} +1 -1
- package/umd/index.js +1 -1
- package/umd/AssistantChat.879f86967feffba1cc6f.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
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",L="#ef4444",R=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"}},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:L}}),(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?L: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),Le=n(81075),Re=function(){return Re=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},Re.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 Re({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=Le.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?Re(Re({},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,L,R,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 L=D.sent(),M={error:L},[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:(R=D.sent())instanceof Error?R.message:String(R)}];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,L=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],Le=Ie[1],Re=it((0,o.useState)(null),2),je=Re[0],Be=Re[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:R(e,-15),disabled:R(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:""}))},L={};(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)&&(L[t]=n.length)}}));var R=(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,R=T?(0,ce.o$)(k,e):void 0,j=null!==(a=null==R?void 0:R.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=L[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=L[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==R?void 0:R.id)?{repeatContainerId:R.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:R,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,Le((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&&Le((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&&Le(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||Le((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())?(Le((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);Le((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&&Le((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)();Le((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 Lt="sidebar-left"===D?w:"sidebar-right"===D?k:"fullscreen"===D?p:x,Rt="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:L;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(L,"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)(Rt,{})})),(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)(Lt,{})})),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),Le((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 Le((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&&Le((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)();Le((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 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunkFeathery=this.webpackChunkFeathery||[]).push([[844],{59215:(e,t,r)=>{r.r(t),r.d(t,{default:()=>rt});var n=r(35944),o=r(67294),i=r(20426),a=function(){return a=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},a.apply(this,arguments)},l="#ffffff",c="#f9fafb",u="#f3f4f6",s="#e5e7eb",d="#d1d5db",f="#9ca3af",p="#4b5563",h="#111827",g="#1d4ed8",v="#ef4444",y="#dc2626",b={width:"16px",height:"16px",color:"#6b7280"},x={display:"flex",flexDirection:"column",gap:"2px","& svg":{marginInlineStart:"4px",width:"20px",height:"20px"}},m={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(s),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(s),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(s)},I={padding:"12px 24px",fontWeight:"500",userSelect:"none",whiteSpace:"nowrap"},L={backgroundColor:l,borderBottom:"1px solid ".concat(s),transition:"background-color 0.2s"},A={padding:"16px 24px",wordBreak:"break-word",overflowWrap:"anywhere"},E={display:"flex",alignItems:"center",flexWrap:"wrap",justifyContent:"space-between",padding:"16px",gap:"8px"},D={fontSize:"14px",fontWeight:"normal",color:p},M={fontWeight:"600",color:h},j={display:"flex",marginLeft:"-1px",fontSize:"14px",listStyle:"none",padding:0,margin:0},T={display:"flex",alignItems:"center",justifyContent:"center",color:p,backgroundColor:c,boxSizing:"border-box",border:"1px solid ".concat(s),fontWeight:"500",fontSize:"14px",textDecoration:"none",cursor:"pointer",height:"36px",wordBreak:"keep-all",overflowWrap:"normal","&:hover":{backgroundColor:u,color:h},"&:disabled:hover":{color:p,backgroundColor:c,cursor:"auto"}},X=a(a({},T),{borderRadius:"4px",paddingInline:"8px",paddingBlock:"4px",width:"auto",height:"auto",minHeight:"28px",position:"relative"}),O={width:"16px",height:"16px",color:p},W={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"},z={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:u},"&:disabled:hover":{backgroundColor:"transparent",cursor:"auto"},"&:first-of-type":{borderTopLeftRadius:"4px",borderTopRightRadius:"4px"},"&:last-of-type":{borderBottomLeftRadius:"4px",borderBottomRightRadius:"4px"}},V={borderTop:"1px solid ".concat(s),margin:"4px 0"},F=a(a({},z),{color:v,"&:hover":{backgroundColor:u,color:y}}),N=a(a({},X),{aspectRatio:1,paddingLeft:0,paddingRight:0}),Q={display:"flex",gap:"8px",justifyContent:"flex-end"},H=a(a({},T),{width:"36px",borderRightWidth:0}),K=a(a({},H),{borderTopLeftRadius:"8px",borderBottomLeftRadius:"8px",paddingLeft:"12px",paddingRight:"12px",width:"auto"}),Y=a(a({},H),{borderTopRightRadius:"8px",borderBottomRightRadius:"8px",paddingLeft:"12px",paddingRight:"12px",width:"auto",borderRightWidth:1}),$=a(a({},H),{color:g,backgroundColor:"#eff6ff",border:"1px solid ".concat(s)}),q={opacity:.8,cursor:"default",color:f,"&:hover":{backgroundColor:c,color:f}},G=a(a({},H),{appearance:"none",WebkitAppearance:"none",cursor:"pointer",paddingLeft:"8px",paddingRight:"8px",width:"36px",textAlign:"center",outline:"none","&:hover":{backgroundColor:u,color:h},"&:focus":{outline:"none"}}),J={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px",borderBottom:"1px solid ".concat(s),gap:"12px"},U=a(a({},T),{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"},ie=a(a({},te),{whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word",visibility:"hidden",pointerEvents:"none"}),ae={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:u,color:p}},ce={width:"40px",padding:"0 8px"},ue={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:u,color:v}},se={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=a(a({},T),{borderRadius:"6px",paddingLeft:"12px",paddingRight:"12px",height:"32px"}),he=a(a({},T),{borderRadius:"6px",paddingLeft:"12px",paddingRight:"12px",height:"32px",backgroundColor:v,color:l,border:"1px solid ".concat(v),"&:hover":{backgroundColor:y,color:l}}),ge=function(){return ge=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},ge.apply(this,arguments)};function ve(){return(0,n.tZ)("svg",ge({css:b,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 ye(e){var t=e.searchQuery,r=e.onSearchChange;return(0,n.BX)("div",ge({css:Z},{children:[(0,n.tZ)("div",ge({css:R},{children:(0,n.tZ)(ve,{})})),(0,n.tZ)("input",{type:"text",css:P,placeholder:"Search",value:t,onChange:function(e){return r(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&e.preventDefault()}})]}))}var be=function(){return be=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},be.apply(this,arguments)};function xe(e){var t=e.isSorted,r=e.sortDirection;return(0,n.BX)("svg",be({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},{children:[(0,n.tZ)("path",{css:m,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:m,stroke:"currentColor","data-active":t&&"desc"===r||void 0,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m8 15 4 4 4-4"})]}))}function me(e){var t=e.columns,r=e.enableSort,o=e.sortColumn,i=e.sortDirection,a=e.onSort,l=e.styles;return(0,n.tZ)(n.HY,{children:t.map((function(e,t){var c=r,u=o===e.name,s=0===t;return(0,n.tZ)("th",be({scope:"col",onClick:function(){return c&&a(e.name)},css:be(be(be(be({},I),s?{}:{paddingLeft:0}),l.getTarget("th")),c?{cursor:"pointer"}:{})},{children:(0,n.BX)("div",be({css:w},{children:[(0,n.tZ)("span",{children:e.name}),c&&(0,n.tZ)("span",be({css:x},{children:(0,n.tZ)(xe,{isSorted:u,sortDirection:i})}))]}))}),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 Ce(e){var t=e.currentPage,r=e.totalItems,o=e.rowsPerPage;return(0,n.BX)("span",we({css:D},{children:["Showing"," ",(0,n.BX)("span",we({css:M},{children:[t*o+1,"-",Math.min((t+1)*o,r)]}))," ","of ",(0,n.tZ)("span",we({css:M},{children:r}))]}))}function ke(e){var t=e.disabled,r=e.onClick;return(0,n.tZ)("button",we({type:"button",onClick:r,disabled:t,css:we(we({},K),t?q:{})},{children:"Previous"}))}function Se(e){var t=e.disabled,r=e.onClick;return(0,n.tZ)("button",we({type:"button",onClick:r,disabled:t,css:we(we({},Y),t?q:{})},{children:"Next"}))}function Ze(e){var t=e.pages,r=e.onPageChange;return(0,n.BX)("select",we({value:"",onChange:function(e){r(Number(e.target.value))},"aria-label":"Go to page",css:G},{children:[(0,n.tZ)("option",we({value:"",disabled:!0,hidden:!0},{children:"..."})),t.map((function(e){return(0,n.tZ)("option",we({value:e},{children:e+1}),e)}))]}))}function Re(e){var t=e.currentPage,r=e.totalPages,o=e.onPageChange,i=new Set;i.add(0),i.add(r-1);for(var a=Math.max(0,t-1);a<=Math.min(r-1,t+1);a++)i.add(a);var l=[],c=Array.from(i).sort((function(e,t){return e-t}));for(a=0;a<c.length;a++){var u=c[a],s=a>0?c[a-1]:-1;if(u-s>1){for(var d=[],f=s+1;f<u;f++)d.push(f);l.push({type:"overflow",pages:d})}l.push({type:"page",page:u})}return(0,n.tZ)(n.HY,{children:l.map((function(e,r){if("overflow"===e.type)return 1===e.pages.length?(0,n.tZ)("li",{children:(0,n.tZ)("button",we({type:"button",onClick:function(){return o(e.pages[0])},css:H},{children:e.pages[0]+1}))},"overflow-".concat(r)):(0,n.tZ)("li",{children:(0,n.tZ)(Ze,{pages:e.pages,onPageChange:o})},"overflow-".concat(r));var i=e.page===t;return(0,n.tZ)("li",{children:(0,n.tZ)("button",we({type:"button",onClick:function(){return o(e.page)},"aria-current":i?"page":void 0,css:i?$:H},{children:e.page+1}))},e.page)}))})}function Pe(e){var t=e.currentPage,r=e.totalPages,o=e.totalItems,i=e.rowsPerPage,a=e.onPageChange;return r<=1?null:(0,n.BX)("nav",we({css:E,"aria-label":"Table navigation"},{children:[(0,n.tZ)(Ce,{currentPage:t,totalItems:o,rowsPerPage:i}),(0,n.BX)("ul",we({css:j},{children:[(0,n.tZ)("li",{children:(0,n.tZ)(ke,{disabled:0===t,onClick:function(){return a(Math.max(0,t-1))}})}),(0,n.tZ)(Re,{currentPage:t,totalPages:r,onPageChange:a}),(0,n.tZ)("li",{children:(0,n.tZ)(Se,{disabled:t>=r-1,onClick:function(){a(Math.min(r-1,t+1))}})})]}))]}))}var _e=r(73935),Be=r(95710),Ie=r(39479),Le=function(){return Le=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},Le.apply(this,arguments)},Ae=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};function Ee(){return(0,n.BX)("svg",Le({css:O,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 De(e){var t,r,i,a=e.actions,l=e.rowIndex,c=e.columnData,u=e.fieldValues,s=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,y=e.canDeleteRows,b=void 0!==y&&y,x=e.onDeleteRow;if(0===a.length)return null;var m=Ae((0,o.useState)(!1),2),w=m[0],C=m[1],k=Ae((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&&a.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,Ie.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=u||Be.u4,r={};c.forEach((function(e){var n=t[e.field_key],o=Array.isArray(n)?n[l]:n;r[e.name]=o})),s({action:e.label,rowIndex:l,rowData:r})},L=null!==(i=null===(r=v["".concat(h,"_").concat(l,"_").concat(null===(t=a.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!==i?i:null;return(0,n.tZ)("div",Le({ref:R,css:Q},{children:B?(0,n.BX)(n.HY,{children:[(0,n.tZ)("button",Le({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)}()},css:N},{children:L?(0,n.tZ)("div",Le({style:{height:"16px",width:"16px",display:"flex",alignItems:"center",justifyContent:"center"}},{children:L})):(0,n.tZ)(Ee,{})})),w&&(0,_e.createPortal)((0,n.BX)("div",Le({ref:P,css:Le(Le({},W),{top:"".concat(S.top,"px"),left:"".concat(S.left,"px"),transform:"translateX(-100%)"})},{children:[a.map((function(e,t){var r=Object.keys(v).length>0;return(0,n.tZ)("button",Le({type:"button",onClick:function(t){t.stopPropagation(),I(e)},css:z,disabled:r},{children:e.label}),t)})),b&&x&&(0,n.BX)(n.HY,{children:[(0,n.tZ)("div",{css:V}),(0,n.tZ)("button",Le({type:"button",onClick:function(e){e.stopPropagation(),C(!1),x(l)},css:F},{children:"Delete"}))]})]})),(0,Ie.me)().body)]}):a.map((function(e,t){var r,o="".concat(h,"_").concat(l,"_").concat(e.label),i=null===(r=v[o])||void 0===r?void 0:r.loader,a=Object.keys(v).length>0;return(0,n.BX)("button",Le({type:"button",onClick:function(t){t.stopPropagation(),I(e)},css:X,disabled:a},{children:[(0,n.tZ)("span",Le({style:{visibility:i?"hidden":"visible"}},{children:e.label})),i&&(0,n.tZ)("div",Le({style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",height:"16px",width:"16px"}},{children:i}))]}),t)}))}))}var Me=function(){return Me=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},Me.apply(this,arguments)};function je(e){var t=e.hasSearchQuery;return(0,n.BX)("div",Me({css:k},{children:[t&&(0,n.tZ)("svg",Me({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",Me({css:S},{children:t?"No results found":"No data available"})),t&&(0,n.tZ)("p",Me({css:Me(Me({},S),{fontSize:"14px",marginTop:"8px"})},{children:"Try adjusting your search query"}))]}))}var Te=function(){return Te=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},Te.apply(this,arguments)};function Xe(e){var t=e.anchorEl,r=e.onConfirm,i=e.onCancel,a=e.message,l=void 0===a?"Delete this row?":a,c=e.confirmLabel,u=void 0===c?"Delete":c,s=(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){s.current&&!s.current.contains(e.target)&&t&&!t.contains(e.target)&&i()},r=function(){return i()},n=function(e){"Escape"===e.key&&i()},o=(0,Ie.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)}}),[i,t]),(0,_e.createPortal)((0,n.BX)("div",Te({ref:s,role:"alertdialog","aria-label":l,css:Te(Te({},se),{top:"".concat(f,"px"),left:"".concat(p,"px"),transform:"translateX(-100%)"})},{children:[(0,n.tZ)("p",Te({css:de},{children:l})),(0,n.BX)("div",Te({css:fe},{children:[(0,n.tZ)("button",Te({type:"button",css:pe,onClick:function(e){e.stopPropagation(),i()}},{children:"Cancel"})),(0,n.tZ)("button",Te({type:"button",css:he,onClick:function(e){e.stopPropagation(),r()}},{children:u}))]}))]})),(0,Ie.me)().body)}var Oe=function(){return Oe=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},Oe.apply(this,arguments)},We=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};function ze(){return(0,n.BX)("svg",Oe({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 Ve(e){var t,r=e.value,a=e.fieldKey,l=e.rowIndex,c=e.onEdit,u=e.onClear,s=We((0,o.useState)(!1),2),d=s[0],f=s[1],p=We((0,o.useState)(""),2),h=p[0],g=p[1],v=We((0,o.useState)(!1),2),y=v[0],b=v[1],x=We((0,o.useState)(!1),2),m=x[0],w=x[1],C=We((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,i.e7)(r))&&void 0!==t?t:"",L=""===I;(0,o.useEffect)((function(){d&&Z.current&&Z.current.focus()}),[d]),(0,o.useEffect)((function(){if(y){var e=function(e){P.current&&!P.current.contains(e.target)&&R.current&&!R.current.contains(e.target)&&b(!1)},t=function(){return b(!1)},r=(0,Ie.me)();return r.addEventListener("mousedown",e),r.addEventListener("scroll",t,!0),function(){r.removeEventListener("mousedown",e),r.removeEventListener("scroll",t,!0)}}}),[y]);var A=function(){g(I),f(!0),b(!1)},E=function(){h!==I&&c(a,l,h),f(!1)};return d?(0,n.BX)("div",Oe({css:oe},{children:[(0,n.tZ)("div",Oe({css:ie},{children:"".concat(h,"")})),(0,n.tZ)("textarea",{ref:Z,value:h,onChange:function(e){return g(e.target.value)},onBlur:function(){_.current&&E(),_.current=!0},onKeyDown:function(e){(e.metaKey||e.ctrlKey)&&"Enter"===e.key?(e.preventDefault(),_.current=!1,E()):"Escape"===e.key?(e.preventDefault(),_.current=!1,f(!1)):"Tab"===e.key&&(_.current=!1,E())},css:Oe(Oe({},te),ae),onClick:function(e){return e.stopPropagation()}})]})):L?(0,n.tZ)("span",Oe({css:ee,onClick:A},{children:"Click to edit"})):(0,n.BX)("div",Oe({css:re},{children:[(0,n.tZ)("span",Oe({css:ne},{children:I})),(0,n.tZ)("button",Oe({ref:R,type:"button","aria-expanded":y,"aria-haspopup":"menu",css:le,onClick:function(e){if(e.stopPropagation(),!y&&R.current){var t=R.current.getBoundingClientRect();S({top:t.bottom+4,left:t.right})}b(!y)}},{children:(0,n.tZ)(ze,{})})),y&&(0,_e.createPortal)((0,n.BX)("div",Oe({ref:P,role:"menu",css:Oe(Oe({},W),{top:"".concat(k.top,"px"),left:"".concat(k.left,"px"),transform:"translateX(-100%)"})},{children:[(0,n.tZ)("button",Oe({type:"button",role:"menuitem",css:z,onClick:function(e){e.stopPropagation(),A()}},{children:"Edit Value"})),(0,n.tZ)("button",Oe({type:"button",role:"menuitem",css:z,onClick:function(e){e.stopPropagation(),b(!1),w(!0)}},{children:"Clear Field"}))]})),(0,Ie.me)().body),m&&(0,n.tZ)(Xe,{anchorEl:R.current,message:"Clear this field?",confirmLabel:"Clear",onConfirm:function(){B(),u(a,l)},onCancel:B})]}))}var Fe=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};function Ne(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 i=String(e).trim(),a=new Date(i);if(!isNaN(a.getTime()))return a;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 u=c.value,s=i.match(u);if(s){var d=void 0,f=void 0,p=void 0;4===s[1].length?(d=(n=Fe(s,4))[1],f=n[2],p=n[3]):(f=(o=Fe(s,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,i.e7)(e))&&void 0!==t?t:""}}function Qe(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 He=function(){return He=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},He.apply(this,arguments)},Ke=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.")},Ye=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},$e=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;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 qe(e){return"".concat("__feathery_table_page_").concat(e)}var Ge=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},Je=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;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))},Ue=r(65096),et=function(){return et=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},et.apply(this,arguments)},tt=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};const rt=function(e){var t=e.element,r=e.responsiveStyles,a=e.onClick,l=void 0===a?function(){}:a,c=e.updateFieldValues,u=void 0===c?function(){}:c,s=e.submitCustom,d=void 0===s?function(){}:s,f=e.editMode,p=void 0!==f&&f,h=e.buttonLoaders,g=void 0===h?{}:h,v=(0,o.useMemo)((function(){return function(e){return e.addTargets("table","thead","tbody","th","td","tr"),e}(r)}),[r]),y=tt((0,o.useState)(0),2),b=y[0],m=y[1],k=(0,o.useCallback)((function(){return m((function(e){return e+1}))}),[]),S=function(e){var t,r,n,a,l,c,u,s,d,f,p,h,g,v,y=e.element,b=e.editMode,x=void 0!==b&&b,m=e.dataVersion,w=void 0===m?0:m,C=(null===(t=y.properties)||void 0===t?void 0:t.columns)||[],k=((null===(r=y.properties)||void 0===r?void 0:r.actions)||[]).filter((function(e){return e.label&&""!==e.label.trim()})),S=null!==(a=null===(n=y.properties)||void 0===n?void 0:n.search)&&void 0!==a&&a,Z=null!==(c=null===(l=y.properties)||void 0===l?void 0:l.sort)&&void 0!==c&&c,R=null!==(s=null===(u=y.properties)||void 0===u?void 0:u.transpose)&&void 0!==s&&s,P=null!==(f=null===(d=y.properties)||void 0===d?void 0:d.enable_editing)&&void 0!==f&&f,_=null!==(h=null===(p=y.properties)||void 0===p?void 0:p.add_delete_rows)&&void 0!==h&&h,B=null!==(v=null===(g=y.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,A=(0,o.useMemo)((function(){var e=C;return x&&(e=e.map((function(e,t){return He(He({},e),{field_key:"example_column_".concat(t)})}))),e}),[x,C]),E=(0,o.useMemo)((function(){return x?function(e,t){void 0===t&&(t=2);var r={};return e.forEach((function(e){r[e.field_key]=Array(t).fill("Sample")})),r}(A):He({},Be.u4)}),[x,A,w]),D=Ye((0,o.useState)(""),2),M=D[0],j=D[1],T=Ye((0,o.useState)(null),2),X=T[0],O=T[1],W=Ye((0,o.useState)("asc"),2),z=W[0],V=W[1],F=Ye((0,o.useState)((function(){return function(e){var t=qe(e),r=sessionStorage.getItem(t);if(!r)return 0;var n=parseInt(r,10);return Number.isInteger(n)&&n>=0?n:0}(y.id)})),2),N=F[0],Q=F[1],H=(0,o.useMemo)((function(){return A.reduce((function(e,t){var r=E[t.field_key];return Array.isArray(r)?Math.max(e,r.length):e}),0)}),[A,E]),K=(0,o.useMemo)((function(){return Array.from({length:H},(function(e,t){return t}))}),[H]),Y=(0,o.useMemo)((function(){return R&&S&&M.trim()?K.filter((function(e){return A.some((function(t){var r,n=E[t.field_key],o=Array.isArray(n)?n[e]:n;return(null!==(r=(0,i.e7)(o))&&void 0!==r?r:"").toLowerCase().includes(M.toLowerCase().trim())}))})):K}),[R,K,A,M,S,E]),$=Ye((0,o.useState)(null),2),q=$[0],G=$[1],J=(0,o.useMemo)((function(){if(!R||!Z||null===q)return Y;var e=A[q];return e?$e([],Ye(Y),!1).sort((function(t,r){var n=E[e.field_key],o=Array.isArray(n)?n[t]:n,i=Array.isArray(n)?n[r]:n,a=Qe(Ne(o),Ne(i));return"asc"===z?a:-a})):Y}),[R,Y,q,z,A,E,Z]),U=(0,o.useMemo)((function(){if(!R||!L)return J;var e=N*I,t=e+I;return J.slice(e,t)}),[R,J,N,I,L]),ee=(0,o.useMemo)((function(){if(!R||0===H)return{columns:A,activeFieldValues:E,transposedRowIndices:[]};var e=function(e,t,r,n){var o,i,a,l,c,u,s=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=Ke(s),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&&(i=f.return)&&i.call(f)}finally{if(o)throw o.error}}var g={_transpose_field_name:e.map((function(e){return e.name}))};try{for(var v=Ke(s),y=v.next();!y.done;y=v.next()){h=y.value;var b=[];try{for(var x=(c=void 0,Ke(e)),m=x.next();!m.done;m=x.next()){var w=t[m.value.field_key],C=Array.isArray(w)?w[h]:w;b.push(C)}}catch(e){c={error:e}}finally{try{m&&!m.done&&(u=x.return)&&u.call(x)}finally{if(c)throw c.error}}g["_transpose_row_".concat(h)]=b}}catch(e){a={error:e}}finally{try{y&&!y.done&&(l=v.return)&&l.call(v)}finally{if(a)throw a.error}}return{transposedColumns:d,transposedFieldValues:g,includedRowIndices:s}}(A,E,H,U);return{columns:e.transposedColumns,activeFieldValues:e.transposedFieldValues,transposedRowIndices:e.includedRowIndices}}),[R,A,E,H,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]),ie=(0,o.useMemo)((function(){return Array.from({length:oe},(function(e,t){return t}))}),[oe]),ae=(0,o.useMemo)((function(){return R?ie:S&&M.trim()?ie.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,i.e7)(o))&&void 0!==r?r:"").toLowerCase().includes(M.toLowerCase().trim())}))})):ie}),[R,ie,te,M,S,re]),le=(0,o.useMemo)((function(){if(R)return ae;if(!Z||!X)return ae;var e=te.find((function(e){return e.name===X}));return e?$e([],Ye(ae),!1).sort((function(t,r){var n=re[e.field_key],o=Array.isArray(n)?n[t]:n,i=Array.isArray(n)?n[r]:n,a=Qe(Ne(o),Ne(i));return"asc"===z?a:-a})):ae}),[R,ae,X,z,te,Z,re]),ce=(0,o.useMemo)((function(){if(R)return ie;if(!L)return le;var e=N*I,t=e+I;return le.slice(e,t)}),[R,ie,le,N,I,L]),ue=(0,o.useRef)({initialMount:!0,search:"",sortColumn:"",sortDirection:""});(0,o.useEffect)((function(){var e=ue.current;if(e.initialMount)return e.initialMount=!1,e.search=M,e.sortColumn=X,void(e.sortDirection=z);M===e.search&&X===e.sortColumn&&z===e.sortDirection||(Q(0),e.search=M,e.sortColumn=X,e.sortDirection=z)}),[M,X,z]);var se=R?J.length:le.length,de=L?Math.ceil(se/I):1;(0,o.useEffect)((function(){var e,t,r;y.id&&(e=y.id,t=N,r=qe(e),sessionStorage.setItem(r,t.toString()))}),[y.id,N]),(0,o.useEffect)((function(){de>0&&N>=de&&Q(de-1)}),[de]);var fe=oe>0,pe=R?Y.length>0:ae.length>0;return{enableSearch:S,searchQuery:M,hasSearchResults:pe,setSearchQuery:j,enableSort:Z,sortColumn:X,sortDirection:z,sortedColumnIndex:q,handleSort:function(e){Z&&(X===e?"asc"===z?V("desc"):(O(null),V("asc")):(O(e),V("asc")))},handleTransposedSort:function(e){Z&&R&&(q===e?"asc"===z?V("desc"):(G(null),V("asc")):(G(e),V("asc")))},enablePagination:L,currentPage:N,paginatedRowIndices:ce,rowsPerPage:I,setCurrentPage:Q,columns:te,actions:k,isTransposed:R&&H>0,transposedRowIndices:ne,enableEditing:P,enableAddDeleteRows:_,totalRows:se,totalPages:de,hasData:fe,activeFieldValues:re,baseColumns:A,baseFieldValues:E}}({element:t,editMode:p,dataVersion:b}),Z=S.enableSearch,R=S.searchQuery,P=S.setSearchQuery,E=S.enableSort,D=S.sortColumn,M=S.sortDirection,j=S.sortedColumnIndex,T=S.handleSort,X=S.handleTransposedSort,O=S.enablePagination,W=S.currentPage,z=S.setCurrentPage,V=S.paginatedRowIndices,F=S.rowsPerPage,N=S.enableEditing,Q=S.enableAddDeleteRows,H=S.columns,K=S.actions,Y=S.isTransposed,$=S.transposedRowIndices,q=S.totalRows,G=S.totalPages,ee=S.hasData,te=S.hasSearchResults,re=S.activeFieldValues,ne=S.baseColumns,oe=S.baseFieldValues,ie=function(e){var t=e.columns,r=e.updateFieldValues,n=e.submitCustom,i=e.editMode,a=e.editModeFieldValues,l=e.enablePagination,c=e.setCurrentPage,u=e.setSearchQuery,s=e.searchQuery,d=e.onMutate,f=(0,o.useRef)(a);f.current=a;var p=(0,o.useCallback)((function(e){var t=(i?f.current:Be.u4)[e];return Array.isArray(t)?t:[]}),[i]),h=(0,o.useCallback)((function(){var e={};t.forEach((function(t){var r=p(t.field_key);e[t.field_key]=Je([""],Ge(r),!1)})),s&&u(""),r(e),d(),l&&c(0)}),[t,p,r,d,l,c,u,s]),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),i||n(t),d()}),[g,r,n,i,d]),y=(0,o.useCallback)((function(e){var t=g(e);r(t),d()}),[g,r,d]),b=(0,o.useCallback)((function(e,t,o){var a,l=p(e),c=Je([],Ge(l),!1);c[t]=o;var u=((a={})[e]=c,a);r(u),i||n(u),d()}),[p,r,n,i,d]),x=(0,o.useCallback)((function(e,t){b(e,t,"")}),[b]);return{handleAddRow:h,handleDeleteRow:v,handleRemoveRowLocal:y,handleCellEdit:b,handleCellClear:x}}({columns:ne,updateFieldValues:u,submitCustom:d,editMode:p,editModeFieldValues:re,enablePagination:O,setCurrentPage:z,setSearchQuery:P,searchQuery:R,onMutate:k}),ae=ie.handleAddRow,le=ie.handleDeleteRow,se=ie.handleCellEdit,de=ie.handleCellClear,fe=N&&!Y,pe=fe&&Q,he=fe&&Q,ge=K.length>1,ve=he&&!ge,be=tt((0,o.useState)(new Set),2),we=be[0],Ce=be[1],ke=(0,o.useRef)(we);ke.current=we;var Se=(0,o.useCallback)((function(e,t,r){ke.current.has(t)&&Ce((function(e){var r=new Set(e);return r.delete(t),r})),se(e,t,r)}),[se]),Ze=tt((0,o.useState)(null),2),Re=Ze[0],_e=Ze[1],Ie=(0,o.useRef)(W);Ie.current!==W&&(Ie.current=W,_e(null));var Le=(0,o.useCallback)((function(){return _e(null)}),[]),Ae=(0,o.useRef)(new Map),Ee=(0,o.useRef)(new Map),Me=!ee||!te,Te=Z||pe;return(0,n.BX)("div",et({css:et(et({},C),v.getTarget("container"))},{children:[Te&&(0,n.BX)("div",et({css:J},{children:[Z?(0,n.tZ)(ye,{searchQuery:R,onSearchChange:P}):(0,n.tZ)("div",{}),pe&&(0,n.tZ)("button",et({type:"button",css:U,onClick:function(){_e(null),ae(),Ce((function(e){var t=new Set;return t.add(0),e.forEach((function(e){return t.add(e+1)})),t}))}},{children:"+ Add Row"}))]})),Me?(0,n.tZ)(je,{hasSearchQuery:R.trim().length>0}):(0,n.tZ)("div",et({css:{overflowX:"auto"}},{children:(0,n.BX)("table",et({css:et(et({},_),v.getTarget("table"))},{children:[!Y&&(0,n.tZ)("thead",et({css:B},{children:(0,n.BX)("tr",{children:[(0,n.tZ)(me,{columns:H,enableSort:E,sortColumn:D,sortDirection:M,onSort:T,styles:v}),K.length>0&&(0,n.tZ)("th",{scope:"col",css:et(et(et({},I),{paddingLeft:0}),v.getTarget("th"))}),ve&&(0,n.tZ)("th",{scope:"col",css:et(et(et({},I),ce),v.getTarget("th"))})]})})),(0,n.BX)("tbody",et({css:v.getTarget("tbody")},{children:[V.map((function(e){var r,o,a={};return Y||H.forEach((function(t){var r=re[t.field_key],n=Array.isArray(r)?r[e]:r;a[t.name]=n})),(0,n.BX)("tr",et({css:et(et({},L),v.getTarget("tr")),onClick:function(){Y||fe||l({rowIndex:e,rowData:a})}},{children:[H.map((function(t,r){var o,a,c=re[t.field_key],u=Array.isArray(c)?c[e]:c,s=Y&&0===r,d=s&&E,f=j===e,p=0===r,h=1===r,g=Y&&!s?t.originalRowIndex:void 0,y=s?et(et(et(et({},I),{backgroundColor:"#f9fafb",borderRight:"1px solid #e5e7eb",width:"1px",whiteSpace:"nowrap"}),v.getTarget("th")),d?{cursor:"pointer"}:{}):et(et(et(et({},A),Y?h?{}:{paddingLeft:0}:p?{}:{paddingLeft:0}),Y&&!s?{cursor:"pointer"}:{}),v.getTarget("td")),b=s?"th":"td";return(0,n.tZ)(b,et({css:y,onClick:function(t){if(d)X(e);else if(Y&&void 0!==g){t.stopPropagation();var r={};ne.forEach((function(e){var t=oe[e.field_key],n=Array.isArray(t)?t[g]:t;r[e.name]=n})),l({rowIndex:g,rowData:r})}}},s?{scope:"row"}:{},{children:s&&d?(0,n.BX)("div",et({css:et(et({},w),{justifyContent:"space-between"})},{children:[(0,n.tZ)("span",{children:null!==(o=(0,i.e7)(u))&&void 0!==o?o:""}),(0,n.tZ)("span",et({css:x},{children:(0,n.tZ)(xe,{isSorted:f,sortDirection:M})}))]})):fe?(0,n.tZ)(Ve,{value:u,fieldKey:t.field_key,rowIndex:e,onEdit:Se,onClear:de}):null!==(a=(0,i.e7)(u))&&void 0!==a?a:""}),r)})),!Y&&K.length>0&&(0,n.BX)("td",et({ref:function(t){t?Ee.current.set(e,t):Ee.current.delete(e)},css:et(et(et({},A),{paddingLeft:0}),v.getTarget("td"))},{children:[(0,n.tZ)(De,{actions:K,rowIndex:e,columnData:ne,fieldValues:oe,onClick:l,tableId:t.id,buttonLoaders:g,canDeleteRows:he&&ge,onDeleteRow:function(e){return _e(e)}}),ge&&he&&Re===e&&(0,n.tZ)(Xe,{anchorEl:null!==(r=Ee.current.get(e))&&void 0!==r?r:null,onConfirm:function(){le(e),_e(null)},onCancel:Le})]})),ve&&(0,n.BX)("td",et({css:et(et({},ce),v.getTarget("td"))},{children:[(0,n.tZ)("button",et({type:"button",ref:function(t){t?Ae.current.set(e,t):Ae.current.delete(e)},css:et(et({},ue),Re===e&&{opacity:1}),onClick:function(t){t.stopPropagation(),_e(Re===e?null:e)}},{children:(0,n.tZ)(Ue.XH,{})})),Re===e&&(0,n.tZ)(Xe,{anchorEl:null!==(o=Ae.current.get(e))&&void 0!==o?o:null,onConfirm:function(){le(e),_e(null)},onCancel:Le})]}))]}),e)})),Y&&K.length>0&&(0,n.BX)("tr",et({css:et(et({},L),v.getTarget("tr"))},{children:[(0,n.tZ)("th",{scope:"row",css:et(et(et({},I),{backgroundColor:"#f9fafb",borderRight:"1px solid #e5e7eb",width:"1px",whiteSpace:"nowrap"}),v.getTarget("th"))}),$.map((function(e,r){return(0,n.tZ)("td",et({css:et(et(et({},A),0===r?{}:{paddingLeft:0}),v.getTarget("td"))},{children:(0,n.tZ)("div",et({css:{display:"flex",justifyContent:"flex-start"}},{children:(0,n.tZ)(De,{actions:K,rowIndex:e,columnData:ne,fieldValues:oe,onClick:l,forceInlineButtons:!0,tableId:t.id,buttonLoaders:g})}))}),e)}))]}))]}))]}))})),!Me&&O&&(0,n.tZ)(Pe,{currentPage:W,totalPages:G,totalItems:q,rowsPerPage:F,onPageChange:z})]}))}}}]);
|
|
1
|
+
"use strict";(this.webpackChunkFeathery=this.webpackChunkFeathery||[]).push([[844],{59215:(e,t,r)=>{r.r(t),r.d(t,{default:()=>rt});var n=r(35944),o=r(67294),i=r(20426),a=function(){return a=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},a.apply(this,arguments)},l="#ffffff",c="#f9fafb",u="#f3f4f6",s="#e5e7eb",d="#d1d5db",f="#9ca3af",p="#4b5563",h="#111827",g="#1d4ed8",v="#ef4444",b="#dc2626",y={width:"16px",height:"16px",color:"#6b7280"},x={display:"flex",flexDirection:"column",gap:"2px","& svg":{marginInlineStart:"4px",width:"20px",height:"20px"}},m={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(s),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(s),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(s)},I={padding:"12px 24px",fontWeight:"500",userSelect:"none",whiteSpace:"nowrap"},L={backgroundColor:l,borderBottom:"1px solid ".concat(s),transition:"background-color 0.2s"},A={padding:"16px 24px",wordBreak:"break-word",overflowWrap:"anywhere"},E={display:"flex",alignItems:"center",flexWrap:"wrap",justifyContent:"space-between",padding:"16px",gap:"8px"},D={fontSize:"14px",fontWeight:"normal",color:p},M={fontWeight:"600",color:h},j={display:"flex",marginLeft:"-1px",fontSize:"14px",listStyle:"none",padding:0,margin:0},T={display:"flex",alignItems:"center",justifyContent:"center",color:p,backgroundColor:c,boxSizing:"border-box",border:"1px solid ".concat(s),fontWeight:"500",fontSize:"14px",textDecoration:"none",cursor:"pointer",height:"36px",wordBreak:"keep-all",overflowWrap:"normal","&:hover":{backgroundColor:u,color:h},"&:disabled:hover":{color:p,backgroundColor:c,cursor:"auto"}},X=a(a({},T),{borderRadius:"4px",paddingInline:"8px",paddingBlock:"4px",width:"auto",height:"auto",minHeight:"28px",position:"relative"}),O={width:"16px",height:"16px",color:p},W={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"},z={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:u},"&:disabled:hover":{backgroundColor:"transparent",cursor:"auto"},"&:first-of-type":{borderTopLeftRadius:"4px",borderTopRightRadius:"4px"},"&:last-of-type":{borderBottomLeftRadius:"4px",borderBottomRightRadius:"4px"}},V={borderTop:"1px solid ".concat(s),margin:"4px 0"},F=a(a({},z),{color:v,"&:hover":{backgroundColor:u,color:b}}),N=a(a({},X),{aspectRatio:1,paddingLeft:0,paddingRight:0}),Q={display:"flex",gap:"8px",justifyContent:"flex-end"},H=a(a({},T),{width:"36px",borderRightWidth:0}),K=a(a({},H),{borderTopLeftRadius:"8px",borderBottomLeftRadius:"8px",paddingLeft:"12px",paddingRight:"12px",width:"auto"}),Y=a(a({},H),{borderTopRightRadius:"8px",borderBottomRightRadius:"8px",paddingLeft:"12px",paddingRight:"12px",width:"auto",borderRightWidth:1}),$=a(a({},H),{color:g,backgroundColor:"#eff6ff",border:"1px solid ".concat(s)}),q={opacity:.8,cursor:"default",color:f,"&:hover":{backgroundColor:c,color:f}},G=a(a({},H),{appearance:"none",WebkitAppearance:"none",cursor:"pointer",paddingLeft:"8px",paddingRight:"8px",width:"36px",textAlign:"center",outline:"none","&:hover":{backgroundColor:u,color:h},"&:focus":{outline:"none"}}),J={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px",borderBottom:"1px solid ".concat(s),gap:"12px"},U=a(a({},T),{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"},ie=a(a({},te),{whiteSpace:"pre-wrap",overflowWrap:"anywhere",wordBreak:"break-word",visibility:"hidden",pointerEvents:"none"}),ae={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:u,color:p}},ce={width:"40px",padding:"0 8px"},ue={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:u,color:v}},se={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=a(a({},T),{borderRadius:"6px",paddingLeft:"12px",paddingRight:"12px",height:"32px"}),he=a(a({},T),{borderRadius:"6px",paddingLeft:"12px",paddingRight:"12px",height:"32px",backgroundColor:v,color:l,border:"1px solid ".concat(v),"&:hover":{backgroundColor:b,color:l}}),ge=function(){return ge=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},ge.apply(this,arguments)};function ve(){return(0,n.tZ)("svg",ge({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 be(e){var t=e.searchQuery,r=e.onSearchChange;return(0,n.BX)("div",ge({css:Z},{children:[(0,n.tZ)("div",ge({css:R},{children:(0,n.tZ)(ve,{})})),(0,n.tZ)("input",{type:"text",css:P,placeholder:"Search",value:t,onChange:function(e){return r(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&e.preventDefault()}})]}))}var ye=function(){return ye=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},ye.apply(this,arguments)};function xe(e){var t=e.isSorted,r=e.sortDirection;return(0,n.BX)("svg",ye({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},{children:[(0,n.tZ)("path",{css:m,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:m,stroke:"currentColor","data-active":t&&"desc"===r||void 0,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m8 15 4 4 4-4"})]}))}function me(e){var t=e.columns,r=e.enableSort,o=e.sortColumn,i=e.sortDirection,a=e.onSort,l=e.styles;return(0,n.tZ)(n.HY,{children:t.map((function(e,t){var c=r,u=o===e.name,s=0===t;return(0,n.tZ)("th",ye({scope:"col",onClick:function(){return c&&a(e.name)},css:ye(ye(ye(ye({},I),s?{}:{paddingLeft:0}),l.getTarget("th")),c?{cursor:"pointer"}:{})},{children:(0,n.BX)("div",ye({css:w},{children:[(0,n.tZ)("span",{children:e.name}),c&&(0,n.tZ)("span",ye({css:x},{children:(0,n.tZ)(xe,{isSorted:u,sortDirection:i})}))]}))}),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 Ce(e){var t=e.currentPage,r=e.totalItems,o=e.rowsPerPage;return(0,n.BX)("span",we({css:D},{children:["Showing"," ",(0,n.BX)("span",we({css:M},{children:[t*o+1,"-",Math.min((t+1)*o,r)]}))," ","of ",(0,n.tZ)("span",we({css:M},{children:r}))]}))}function ke(e){var t=e.disabled,r=e.onClick;return(0,n.tZ)("button",we({type:"button",onClick:r,disabled:t,css:we(we({},K),t?q:{})},{children:"Previous"}))}function Se(e){var t=e.disabled,r=e.onClick;return(0,n.tZ)("button",we({type:"button",onClick:r,disabled:t,css:we(we({},Y),t?q:{})},{children:"Next"}))}function Ze(e){var t=e.pages,r=e.onPageChange;return(0,n.BX)("select",we({value:"",onChange:function(e){r(Number(e.target.value))},"aria-label":"Go to page",css:G},{children:[(0,n.tZ)("option",we({value:"",disabled:!0,hidden:!0},{children:"..."})),t.map((function(e){return(0,n.tZ)("option",we({value:e},{children:e+1}),e)}))]}))}function Re(e){var t=e.currentPage,r=e.totalPages,o=e.onPageChange,i=new Set;i.add(0),i.add(r-1);for(var a=Math.max(0,t-1);a<=Math.min(r-1,t+1);a++)i.add(a);var l=[],c=Array.from(i).sort((function(e,t){return e-t}));for(a=0;a<c.length;a++){var u=c[a],s=a>0?c[a-1]:-1;if(u-s>1){for(var d=[],f=s+1;f<u;f++)d.push(f);l.push({type:"overflow",pages:d})}l.push({type:"page",page:u})}return(0,n.tZ)(n.HY,{children:l.map((function(e,r){if("overflow"===e.type)return 1===e.pages.length?(0,n.tZ)("li",{children:(0,n.tZ)("button",we({type:"button",onClick:function(){return o(e.pages[0])},css:H},{children:e.pages[0]+1}))},"overflow-".concat(r)):(0,n.tZ)("li",{children:(0,n.tZ)(Ze,{pages:e.pages,onPageChange:o})},"overflow-".concat(r));var i=e.page===t;return(0,n.tZ)("li",{children:(0,n.tZ)("button",we({type:"button",onClick:function(){return o(e.page)},"aria-current":i?"page":void 0,css:i?$:H},{children:e.page+1}))},e.page)}))})}function Pe(e){var t=e.currentPage,r=e.totalPages,o=e.totalItems,i=e.rowsPerPage,a=e.onPageChange;return r<=1?null:(0,n.BX)("nav",we({css:E,"aria-label":"Table navigation"},{children:[(0,n.tZ)(Ce,{currentPage:t,totalItems:o,rowsPerPage:i}),(0,n.BX)("ul",we({css:j},{children:[(0,n.tZ)("li",{children:(0,n.tZ)(ke,{disabled:0===t,onClick:function(){return a(Math.max(0,t-1))}})}),(0,n.tZ)(Re,{currentPage:t,totalPages:r,onPageChange:a}),(0,n.tZ)("li",{children:(0,n.tZ)(Se,{disabled:t>=r-1,onClick:function(){a(Math.min(r-1,t+1))}})})]}))]}))}var _e=r(73935),Be=r(95710),Ie=r(39479),Le=function(){return Le=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},Le.apply(this,arguments)},Ae=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};function Ee(){return(0,n.BX)("svg",Le({css:O,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 De(e){var t,r,i,a=e.actions,l=e.rowIndex,c=e.columnData,u=e.fieldValues,s=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,x=e.onDeleteRow;if(0===a.length)return null;var m=Ae((0,o.useState)(!1),2),w=m[0],C=m[1],k=Ae((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&&a.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,Ie.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=u||Be.u4,r={};c.forEach((function(e){var n=t[e.field_key],o=Array.isArray(n)?n[l]:n;r[e.name]=o})),s({action:e.label,rowIndex:l,rowData:r})},L=null!==(i=null===(r=v["".concat(h,"_").concat(l,"_").concat(null===(t=a.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!==i?i:null;return(0,n.tZ)("div",Le({ref:R,css:Q},{children:B?(0,n.BX)(n.HY,{children:[(0,n.tZ)("button",Le({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)}()},css:N},{children:L?(0,n.tZ)("div",Le({style:{height:"16px",width:"16px",display:"flex",alignItems:"center",justifyContent:"center"}},{children:L})):(0,n.tZ)(Ee,{})})),w&&(0,_e.createPortal)((0,n.BX)("div",Le({ref:P,css:Le(Le({},W),{top:"".concat(S.top,"px"),left:"".concat(S.left,"px"),transform:"translateX(-100%)"})},{children:[a.map((function(e,t){var r=Object.keys(v).length>0;return(0,n.tZ)("button",Le({type:"button",onClick:function(t){t.stopPropagation(),I(e)},css:z,disabled:r},{children:e.label}),t)})),y&&x&&(0,n.BX)(n.HY,{children:[(0,n.tZ)("div",{css:V}),(0,n.tZ)("button",Le({type:"button",onClick:function(e){e.stopPropagation(),C(!1),x(l)},css:F},{children:"Delete"}))]})]})),(0,Ie.me)().body)]}):a.map((function(e,t){var r,o="".concat(h,"_").concat(l,"_").concat(e.label),i=null===(r=v[o])||void 0===r?void 0:r.loader,a=Object.keys(v).length>0;return(0,n.BX)("button",Le({type:"button",onClick:function(t){t.stopPropagation(),I(e)},css:X,disabled:a},{children:[(0,n.tZ)("span",Le({style:{visibility:i?"hidden":"visible"}},{children:e.label})),i&&(0,n.tZ)("div",Le({style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",height:"16px",width:"16px"}},{children:i}))]}),t)}))}))}var Me=function(){return Me=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},Me.apply(this,arguments)};function je(e){var t=e.hasSearchQuery;return(0,n.BX)("div",Me({css:k},{children:[t&&(0,n.tZ)("svg",Me({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",Me({css:S},{children:t?"No results found":"No data available"})),t&&(0,n.tZ)("p",Me({css:Me(Me({},S),{fontSize:"14px",marginTop:"8px"})},{children:"Try adjusting your search query"}))]}))}var Te=function(){return Te=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},Te.apply(this,arguments)};function Xe(e){var t=e.anchorEl,r=e.onConfirm,i=e.onCancel,a=e.message,l=void 0===a?"Delete this row?":a,c=e.confirmLabel,u=void 0===c?"Delete":c,s=(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){s.current&&!s.current.contains(e.target)&&t&&!t.contains(e.target)&&i()},r=function(){return i()},n=function(e){"Escape"===e.key&&i()},o=(0,Ie.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)}}),[i,t]),(0,_e.createPortal)((0,n.BX)("div",Te({ref:s,role:"alertdialog","aria-label":l,css:Te(Te({},se),{top:"".concat(f,"px"),left:"".concat(p,"px"),transform:"translateX(-100%)"})},{children:[(0,n.tZ)("p",Te({css:de},{children:l})),(0,n.BX)("div",Te({css:fe},{children:[(0,n.tZ)("button",Te({type:"button",css:pe,onClick:function(e){e.stopPropagation(),i()}},{children:"Cancel"})),(0,n.tZ)("button",Te({type:"button",css:he,onClick:function(e){e.stopPropagation(),r()}},{children:u}))]}))]})),(0,Ie.me)().body)}var Oe=function(){return Oe=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},Oe.apply(this,arguments)},We=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};function ze(){return(0,n.BX)("svg",Oe({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 Ve(e){var t,r=e.value,a=e.fieldKey,l=e.rowIndex,c=e.onEdit,u=e.onClear,s=We((0,o.useState)(!1),2),d=s[0],f=s[1],p=We((0,o.useState)(""),2),h=p[0],g=p[1],v=We((0,o.useState)(!1),2),b=v[0],y=v[1],x=We((0,o.useState)(!1),2),m=x[0],w=x[1],C=We((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,i.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,Ie.me)();return r.addEventListener("mousedown",e),r.addEventListener("scroll",t,!0),function(){r.removeEventListener("mousedown",e),r.removeEventListener("scroll",t,!0)}}}),[b]);var A=function(){g(I),f(!0),y(!1)},E=function(){h!==I&&c(a,l,h),f(!1)};return d?(0,n.BX)("div",Oe({css:oe},{children:[(0,n.tZ)("div",Oe({css:ie},{children:"".concat(h,"")})),(0,n.tZ)("textarea",{ref:Z,value:h,onChange:function(e){return g(e.target.value)},onBlur:function(){_.current&&E(),_.current=!0},onKeyDown:function(e){(e.metaKey||e.ctrlKey)&&"Enter"===e.key?(e.preventDefault(),_.current=!1,E()):"Escape"===e.key?(e.preventDefault(),_.current=!1,f(!1)):"Tab"===e.key&&(_.current=!1,E())},css:Oe(Oe({},te),ae),onClick:function(e){return e.stopPropagation()}})]})):L?(0,n.tZ)("span",Oe({css:ee,onClick:A},{children:"Click to edit"})):(0,n.BX)("div",Oe({css:re},{children:[(0,n.tZ)("span",Oe({css:ne},{children:I})),(0,n.tZ)("button",Oe({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)(ze,{})})),b&&(0,_e.createPortal)((0,n.BX)("div",Oe({ref:P,role:"menu",css:Oe(Oe({},W),{top:"".concat(k.top,"px"),left:"".concat(k.left,"px"),transform:"translateX(-100%)"})},{children:[(0,n.tZ)("button",Oe({type:"button",role:"menuitem",css:z,onClick:function(e){e.stopPropagation(),A()}},{children:"Edit Value"})),(0,n.tZ)("button",Oe({type:"button",role:"menuitem",css:z,onClick:function(e){e.stopPropagation(),y(!1),w(!0)}},{children:"Clear Field"}))]})),(0,Ie.me)().body),m&&(0,n.tZ)(Xe,{anchorEl:R.current,message:"Clear this field?",confirmLabel:"Clear",onConfirm:function(){B(),u(a,l)},onCancel:B})]}))}var Fe=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};function Ne(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 i=String(e).trim(),a=new Date(i);if(!isNaN(a.getTime()))return a;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 u=c.value,s=i.match(u);if(s){var d=void 0,f=void 0,p=void 0;4===s[1].length?(d=(n=Fe(s,4))[1],f=n[2],p=n[3]):(f=(o=Fe(s,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,i.e7)(e))&&void 0!==t?t:""}}function Qe(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 He=function(){return He=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},He.apply(this,arguments)},Ke=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.")},Ye=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},$e=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;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 qe(e){return"".concat("__feathery_table_page_").concat(e)}var Ge=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},Je=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;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))},Ue=r(65096),et=function(){return et=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},et.apply(this,arguments)},tt=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};const rt=function(e){var t=e.element,r=e.responsiveStyles,a=e.onClick,l=void 0===a?function(){}:a,c=e.updateFieldValues,u=void 0===c?function(){}:c,s=e.submitCustom,d=void 0===s?function(){}:s,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=tt((0,o.useState)(0),2),m=y[0],k=y[1],S=(0,o.useCallback)((function(){return k((function(e){return e+1}))}),[]),Z=function(e){var t,r,n,a,l,c,u,s,d,f,p,h,g,v,b=e.element,y=e.editMode,x=void 0!==y&&y,m=e.dataVersion,w=void 0===m?0:m,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!==(a=null===(n=b.properties)||void 0===n?void 0:n.search)&&void 0!==a&&a,Z=null!==(c=null===(l=b.properties)||void 0===l?void 0:l.sort)&&void 0!==c&&c,R=null!==(s=null===(u=b.properties)||void 0===u?void 0:u.transpose)&&void 0!==s&&s,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,A=(0,o.useMemo)((function(){var e=C;return x&&(e=e.map((function(e,t){return He(He({},e),{field_key:"example_column_".concat(t)})}))),e}),[x,C]),E=(0,o.useMemo)((function(){return x?function(e,t){void 0===t&&(t=2);var r={};return e.forEach((function(e){r[e.field_key]=Array(t).fill("Sample")})),r}(A):He({},Be.u4)}),[x,A,w]),D=Ye((0,o.useState)(""),2),M=D[0],j=D[1],T=Ye((0,o.useState)(null),2),X=T[0],O=T[1],W=Ye((0,o.useState)("asc"),2),z=W[0],V=W[1],F=Ye((0,o.useState)((function(){return function(e){var t=qe(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),N=F[0],Q=F[1],H=(0,o.useMemo)((function(){return A.reduce((function(e,t){var r=E[t.field_key];return Array.isArray(r)?Math.max(e,r.length):e}),0)}),[A,E]),K=(0,o.useMemo)((function(){return Array.from({length:H},(function(e,t){return t}))}),[H]),Y=(0,o.useMemo)((function(){return R&&S&&M.trim()?K.filter((function(e){return A.some((function(t){var r,n=E[t.field_key],o=Array.isArray(n)?n[e]:n;return(null!==(r=(0,i.e7)(o))&&void 0!==r?r:"").toLowerCase().includes(M.toLowerCase().trim())}))})):K}),[R,K,A,M,S,E]),$=Ye((0,o.useState)(null),2),q=$[0],G=$[1],J=(0,o.useMemo)((function(){if(!R||!Z||null===q)return Y;var e=A[q];return e?$e([],Ye(Y),!1).sort((function(t,r){var n=E[e.field_key],o=Array.isArray(n)?n[t]:n,i=Array.isArray(n)?n[r]:n,a=Qe(Ne(o),Ne(i));return"asc"===z?a:-a})):Y}),[R,Y,q,z,A,E,Z]),U=(0,o.useMemo)((function(){if(!R||!L)return J;var e=N*I,t=e+I;return J.slice(e,t)}),[R,J,N,I,L]),ee=(0,o.useMemo)((function(){if(!R||0===H)return{columns:A,activeFieldValues:E,transposedRowIndices:[]};var e=function(e,t,r,n){var o,i,a,l,c,u,s=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=Ke(s),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&&(i=f.return)&&i.call(f)}finally{if(o)throw o.error}}var g={_transpose_field_name:e.map((function(e){return e.name}))};try{for(var v=Ke(s),b=v.next();!b.done;b=v.next()){h=b.value;var y=[];try{for(var x=(c=void 0,Ke(e)),m=x.next();!m.done;m=x.next()){var w=t[m.value.field_key],C=Array.isArray(w)?w[h]:w;y.push(C)}}catch(e){c={error:e}}finally{try{m&&!m.done&&(u=x.return)&&u.call(x)}finally{if(c)throw c.error}}g["_transpose_row_".concat(h)]=y}}catch(e){a={error:e}}finally{try{b&&!b.done&&(l=v.return)&&l.call(v)}finally{if(a)throw a.error}}return{transposedColumns:d,transposedFieldValues:g,includedRowIndices:s}}(A,E,H,U);return{columns:e.transposedColumns,activeFieldValues:e.transposedFieldValues,transposedRowIndices:e.includedRowIndices}}),[R,A,E,H,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]),ie=(0,o.useMemo)((function(){return Array.from({length:oe},(function(e,t){return t}))}),[oe]),ae=(0,o.useMemo)((function(){return R?ie:S&&M.trim()?ie.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,i.e7)(o))&&void 0!==r?r:"").toLowerCase().includes(M.toLowerCase().trim())}))})):ie}),[R,ie,te,M,S,re]),le=(0,o.useMemo)((function(){if(R)return ae;if(!Z||!X)return ae;var e=te.find((function(e){return e.name===X}));return e?$e([],Ye(ae),!1).sort((function(t,r){var n=re[e.field_key],o=Array.isArray(n)?n[t]:n,i=Array.isArray(n)?n[r]:n,a=Qe(Ne(o),Ne(i));return"asc"===z?a:-a})):ae}),[R,ae,X,z,te,Z,re]),ce=(0,o.useMemo)((function(){if(R)return ie;if(!L)return le;var e=N*I,t=e+I;return le.slice(e,t)}),[R,ie,le,N,I,L]),ue=(0,o.useRef)({initialMount:!0,search:"",sortColumn:"",sortDirection:""});(0,o.useEffect)((function(){var e=ue.current;if(e.initialMount)return e.initialMount=!1,e.search=M,e.sortColumn=X,void(e.sortDirection=z);M===e.search&&X===e.sortColumn&&z===e.sortDirection||(Q(0),e.search=M,e.sortColumn=X,e.sortDirection=z)}),[M,X,z]);var se=R?J.length:le.length,de=L?Math.ceil(se/I):1;(0,o.useEffect)((function(){var e,t,r;b.id&&(e=b.id,t=N,r=qe(e),sessionStorage.setItem(r,t.toString()))}),[b.id,N]),(0,o.useEffect)((function(){de>0&&N>=de&&Q(de-1)}),[de]);var fe=oe>0,pe=R?Y.length>0:ae.length>0;return{enableSearch:S,searchQuery:M,hasSearchResults:pe,setSearchQuery:j,enableSort:Z,sortColumn:X,sortDirection:z,sortedColumnIndex:q,handleSort:function(e){Z&&(X===e?"asc"===z?V("desc"):(O(null),V("asc")):(O(e),V("asc")))},handleTransposedSort:function(e){Z&&R&&(q===e?"asc"===z?V("desc"):(G(null),V("asc")):(G(e),V("asc")))},enablePagination:L,currentPage:N,paginatedRowIndices:ce,rowsPerPage:I,setCurrentPage:Q,columns:te,actions:k,isTransposed:R&&H>0,transposedRowIndices:ne,enableEditing:P,enableAddDeleteRows:_,totalRows:se,totalPages:de,hasData:fe,activeFieldValues:re,baseColumns:A,baseFieldValues:E}}({element:t,editMode:p,dataVersion:m}),R=Z.enableSearch,P=Z.searchQuery,E=Z.setSearchQuery,D=Z.enableSort,M=Z.sortColumn,j=Z.sortDirection,T=Z.sortedColumnIndex,X=Z.handleSort,O=Z.handleTransposedSort,W=Z.enablePagination,z=Z.currentPage,V=Z.setCurrentPage,F=Z.paginatedRowIndices,N=Z.rowsPerPage,Q=Z.enableEditing,H=Z.enableAddDeleteRows,K=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,ie=Z.baseFieldValues,ae=function(e){var t=e.columns,r=e.updateFieldValues,n=e.submitCustom,i=e.editMode,a=e.editModeFieldValues,l=e.enablePagination,c=e.setCurrentPage,u=e.setSearchQuery,s=e.searchQuery,d=e.onMutate,f=(0,o.useRef)(a);f.current=a;var p=(0,o.useCallback)((function(e){var t=(i?f.current:Be.u4)[e];return Array.isArray(t)?t:[]}),[i]),h=(0,o.useCallback)((function(){var e={};t.forEach((function(t){var r=p(t.field_key);e[t.field_key]=Je([""],Ge(r),!1)})),s&&u(""),r(e),d(),l&&c(0)}),[t,p,r,d,l,c,u,s]),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),i||n(t),d()}),[g,r,n,i,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 a,l=p(e),c=Je([],Ge(l),!1);c[t]=o;var u=((a={})[e]=c,a);r(u),i||n(u),d()}),[p,r,n,i,d]),x=(0,o.useCallback)((function(e,t){y(e,t,"")}),[y]);return{handleAddRow:h,handleDeleteRow:v,handleRemoveRowLocal:b,handleCellEdit:y,handleCellClear:x}}({columns:oe,updateFieldValues:u,submitCustom:d,editMode:p,editModeFieldValues:ne,enablePagination:W,setCurrentPage:V,setSearchQuery:E,searchQuery:P,onMutate:S}),le=ae.handleAddRow,se=ae.handleDeleteRow,de=ae.handleCellEdit,fe=ae.handleCellClear,pe=null==t?void 0:t.id,he=Q&&!$,ge=he&&H,ve=he&&H,ye=Y.length>1,we=ve&&!ye,Ce=tt((0,o.useState)(new Set),2),ke=Ce[0],Se=Ce[1],Ze=(0,o.useRef)(ke);Ze.current=ke;var Re=(0,o.useCallback)((function(e,t,r){Ze.current.has(t)&&Se((function(e){var r=new Set(e);return r.delete(t),r})),de(e,t,r)}),[de]),_e=tt((0,o.useState)(null),2),Ie=_e[0],Le=_e[1],Ae=(0,o.useRef)(z);Ae.current!==z&&(Ae.current=z,Le(null));var Ee=(0,o.useCallback)((function(){return Le(null)}),[]),Me=(0,o.useRef)(new Map),Te=(0,o.useRef)(new Map),Oe=(0,o.useCallback)((function(){Le(null),le(),Se((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){se(e),Le(null)}),[se]);(0,o.useEffect)((function(){if(v&&pe)return v.registerTable(pe,{handleCellEdit:Re,handleAddRow:Oe,handleDeleteRow:We}),function(){return v.unregisterTable(pe)}}),[v,pe,Re,Oe,We]);var ze=!te||!re,Fe=R||ge;return(0,n.BX)("div",et({css:et(et({},C),b.getTarget("container"))},{children:[Fe&&(0,n.BX)("div",et({css:J},{children:[R?(0,n.tZ)(be,{searchQuery:P,onSearchChange:E}):(0,n.tZ)("div",{}),ge&&(0,n.tZ)("button",et({type:"button",css:U,onClick:Oe},{children:"+ Add Row"}))]})),ze?(0,n.tZ)(je,{hasSearchQuery:P.trim().length>0}):(0,n.tZ)("div",et({css:{overflowX:"auto"}},{children:(0,n.BX)("table",et({css:et(et({},_),b.getTarget("table"))},{children:[!$&&(0,n.tZ)("thead",et({css:B},{children:(0,n.BX)("tr",{children:[(0,n.tZ)(me,{columns:K,enableSort:D,sortColumn:M,sortDirection:j,onSort:X,styles:b}),Y.length>0&&(0,n.tZ)("th",{scope:"col",css:et(et(et({},I),{paddingLeft:0}),b.getTarget("th"))}),we&&(0,n.tZ)("th",{scope:"col",css:et(et(et({},I),ce),b.getTarget("th"))})]})})),(0,n.BX)("tbody",et({css:b.getTarget("tbody")},{children:[F.map((function(e){var r,o,a={};return $||K.forEach((function(t){var r=ne[t.field_key],n=Array.isArray(r)?r[e]:r;a[t.name]=n})),(0,n.BX)("tr",et({css:et(et({},L),b.getTarget("tr")),onClick:function(){$||he||l({rowIndex:e,rowData:a})}},{children:[K.map((function(t,r){var o,a,c=ne[t.field_key],u=Array.isArray(c)?c[e]:c,s=$&&0===r,d=s&&D,f=T===e,p=0===r,h=1===r,g=$&&!s?t.originalRowIndex:void 0,v=s?et(et(et(et({},I),{backgroundColor:"#f9fafb",borderRight:"1px solid #e5e7eb",width:"1px",whiteSpace:"nowrap"}),b.getTarget("th")),d?{cursor:"pointer"}:{}):et(et(et(et({},A),$?h?{}:{paddingLeft:0}:p?{}:{paddingLeft:0}),$&&!s?{cursor:"pointer"}:{}),b.getTarget("td")),y=s?"th":"td";return(0,n.tZ)(y,et({css:v,onClick:function(t){if(d)O(e);else if($&&void 0!==g){t.stopPropagation();var r={};oe.forEach((function(e){var t=ie[e.field_key],n=Array.isArray(t)?t[g]:t;r[e.name]=n})),l({rowIndex:g,rowData:r})}}},s?{scope:"row"}:{},{children:s&&d?(0,n.BX)("div",et({css:et(et({},w),{justifyContent:"space-between"})},{children:[(0,n.tZ)("span",{children:null!==(o=(0,i.e7)(u))&&void 0!==o?o:""}),(0,n.tZ)("span",et({css:x},{children:(0,n.tZ)(xe,{isSorted:f,sortDirection:j})}))]})):he?(0,n.tZ)(Ve,{value:u,fieldKey:t.field_key,rowIndex:e,onEdit:Re,onClear:fe}):null!==(a=(0,i.e7)(u))&&void 0!==a?a:""}),r)})),!$&&Y.length>0&&(0,n.BX)("td",et({ref:function(t){t?Te.current.set(e,t):Te.current.delete(e)},css:et(et(et({},A),{paddingLeft:0}),b.getTarget("td"))},{children:[(0,n.tZ)(De,{actions:Y,rowIndex:e,columnData:oe,fieldValues:ie,onClick:l,tableId:t.id,buttonLoaders:g,canDeleteRows:ve&&ye,onDeleteRow:function(e){return Le(e)}}),ye&&ve&&Ie===e&&(0,n.tZ)(Xe,{anchorEl:null!==(r=Te.current.get(e))&&void 0!==r?r:null,onConfirm:function(){return We(e)},onCancel:Ee})]})),we&&(0,n.BX)("td",et({css:et(et({},ce),b.getTarget("td"))},{children:[(0,n.tZ)("button",et({type:"button",ref:function(t){t?Me.current.set(e,t):Me.current.delete(e)},css:et(et({},ue),Ie===e&&{opacity:1}),onClick:function(t){t.stopPropagation(),Le(Ie===e?null:e)}},{children:(0,n.tZ)(Ue.XH,{})})),Ie===e&&(0,n.tZ)(Xe,{anchorEl:null!==(o=Me.current.get(e))&&void 0!==o?o:null,onConfirm:function(){return We(e)},onCancel:Ee})]}))]}),e)})),$&&Y.length>0&&(0,n.BX)("tr",et({css:et(et({},L),b.getTarget("tr"))},{children:[(0,n.tZ)("th",{scope:"row",css:et(et(et({},I),{backgroundColor:"#f9fafb",borderRight:"1px solid #e5e7eb",width:"1px",whiteSpace:"nowrap"}),b.getTarget("th"))}),q.map((function(e,r){return(0,n.tZ)("td",et({css:et(et(et({},A),0===r?{}:{paddingLeft:0}),b.getTarget("td"))},{children:(0,n.tZ)("div",et({css:{display:"flex",justifyContent:"flex-start"}},{children:(0,n.tZ)(De,{actions:Y,rowIndex:e,columnData:oe,fieldValues:ie,onClick:l,forceInlineButtons:!0,tableId:t.id,buttonLoaders:g})}))}),e)}))]}))]}))]}))})),!ze&&W&&(0,n.tZ)(Pe,{currentPage:z,totalPages:ee,totalItems:G,rowsPerPage:N,onPageChange:V})]}))}}}]);
|