@feathery/react 2.42.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.BOyDRP1t.js → fthry_AssistantChat.CTrXRHYC.js} +951 -327
- package/cjs/{fthry_FormControl.ChDphBiw.js → fthry_FormControl.BoilLJu3.js} +1 -1
- package/cjs/{fthry_InlineTooltip.Ddh8_6aY.js → fthry_InlineTooltip.C3LL7yhx.js} +2 -2
- package/cjs/{fthry_Overlay.Bd1qiy6-.js → fthry_Overlay.C_kMTQo_.js} +1 -1
- package/cjs/{fthry_PaymentMethodField.DmbR79FW.js → fthry_PaymentMethodField.B7Y0YcQQ.js} +4 -4
- package/cjs/{fthry_Placeholder.BZUp2I1J.js → fthry_Placeholder.Ckf5rx3l.js} +1 -1
- package/cjs/{fthry_ShowEyeIcon.D9DLoHqI.js → fthry_ShowEyeIcon.Dw983jmd.js} +1 -1
- package/cjs/fthry_auto-track.DdU0wd90.js +114 -0
- package/cjs/{fthry_highlighted-body-TPN3WLV5.W8KTEXCF.js → fthry_highlighted-body-TPN3WLV5.Dgq3ZfLo.js} +3 -3
- package/cjs/fthry_index.29ly7g2Z.js +73 -0
- package/cjs/{fthry_index.DjWcky2z.js → fthry_index.37lEi-Hp.js} +1 -1
- package/cjs/{fthry_index.Cts348D4.js → fthry_index.3RtrK8MX.js} +283 -240
- package/cjs/{fthry_index.B8IGhOnl.js → fthry_index.5r0bFZtm.js} +8 -8
- package/cjs/{fthry_index.BcSPIfHw.js → fthry_index.B4peckbq.js} +1 -1
- package/cjs/{fthry_index.LPXprTDf.js → fthry_index.BGz622Tq.js} +4 -4
- package/cjs/{fthry_index.CW5rWtuZ.js → fthry_index.BHqkdfIz.js} +5 -5
- package/cjs/fthry_index.BI8F8bA_.js +477 -0
- package/cjs/{fthry_index.DMa8KL_d.js → fthry_index.BfbtecrW.js} +1 -1
- package/cjs/{fthry_index.JJYyApby.js → fthry_index.Buv2Sg-R.js} +5 -5
- package/cjs/fthry_index.Bv2eS3Vo.js +34 -0
- package/cjs/{fthry_index.VXMfU8Ig.js → fthry_index.BvbHMtIp.js} +5 -5
- package/cjs/fthry_index.C3PGeG-p.js +6893 -0
- package/cjs/{fthry_index.BEwwo45U.js → fthry_index.C8F7fXYY.js} +3 -3
- package/cjs/{fthry_index.B4iCcGUt.js → fthry_index.CKVVzHIN.js} +6 -6
- package/cjs/{fthry_index.aU4Q-Vhi.js → fthry_index.CVnv_Jad.js} +1 -1
- package/cjs/fthry_index.CZEWDsUp.js +68 -0
- package/cjs/{fthry_index.BJAzpvPO.js → fthry_index.CelZlNgP.js} +4 -4
- package/cjs/{fthry_index.DQ3tM-b4.js → fthry_index.D3dqn02k.js} +1 -1
- package/cjs/{fthry_index.DJzIqovs.js → fthry_index.D8Red3Ny.js} +37 -20
- package/cjs/fthry_index.DDPSNVyH.js +72 -0
- package/cjs/{fthry_index.pqZR4gSb.js → fthry_index.DicGhamJ.js} +1 -1
- package/cjs/{fthry_index.Wf6EoIZb.js → fthry_index.Dod7JSDp.js} +1 -1
- package/cjs/{fthry_index.DNNK_WNB.js → fthry_index.Dom24Lwj.js} +1 -1
- package/cjs/{fthry_index.C_KCwy5K.js → fthry_index.DzFvroe5.js} +6 -6
- package/cjs/{fthry_index.DcZhokGw.js → fthry_index.GMymJjG7.js} +2 -2
- package/cjs/fthry_index.KDrRVPx5.js +575 -0
- package/cjs/{fthry_index.pmG3XerW.js → fthry_index.LV1j0g0M.js} +6 -6
- package/cjs/{fthry_index.Bcl3u2bt.js → fthry_index.LvXa1Omo.js} +6 -6
- package/cjs/{fthry_index.C3bArUa4.js → fthry_index.hlvuql4I.js} +5 -5
- package/cjs/{fthry_index.l6iPtqf7.js → fthry_index.jKKDa77s.js} +2 -2
- package/cjs/{fthry_index.DzpicfAn.js → fthry_index.kb1SveDj.js} +3 -3
- package/cjs/fthry_index.umd.IVs8gbvz.js +41 -0
- package/cjs/{fthry_input.C3lHXfth.js → fthry_input.CtQ9PDhT.js} +1 -1
- package/cjs/fthry_is-plan-event-enabled.nMt_kVye.js +19 -0
- package/cjs/{fthry_mermaid-O7DHMXV3.BODsiYW_.js → fthry_mermaid-O7DHMXV3.OED8wUgR.js} +3 -3
- package/cjs/{fthry_script.C70Bm3qk.js → fthry_script.BVZmLSex.js} +1 -1
- package/cjs/{fthry_styles.BLUeHaH3.js → fthry_styles.D-_UUb_M.js} +1 -1
- package/cjs/{fthry_useElementSize.B4RuT8C5.js → fthry_useElementSize.CDRo_Jkc.js} +1 -1
- package/cjs/{fthry_useSalesforceSync.CNNAgWe2.js → fthry_useSalesforceSync.Bx08h06s.js} +1 -1
- package/cjs/{fthry_webfontloader.CJNW-DFS.js → fthry_webfontloader.BH2uCTmw.js} +1 -1
- package/cjs/index.js +1 -1
- package/cjs/integrations/segment.d.ts +1 -1
- package/cjs/integrations/segment.d.ts.map +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.HxV8LV1W.js → fthry_AssistantChat.D97z2Fjs.js} +951 -327
- package/dist/{fthry_FormControl.CnYezAfl.js → fthry_FormControl.DJieQaw-.js} +1 -1
- package/dist/{fthry_InlineTooltip.bROBNZ_Z.js → fthry_InlineTooltip.Chat1FIN.js} +2 -2
- package/dist/{fthry_Overlay.c1qlB9ct.js → fthry_Overlay.pCv-XBOA.js} +1 -1
- package/dist/{fthry_PaymentMethodField.t7Dvi81Y.js → fthry_PaymentMethodField._G2uJ6Ks.js} +4 -4
- package/dist/{fthry_Placeholder.BH2h6ybj.js → fthry_Placeholder.C7B4adz4.js} +1 -1
- package/dist/{fthry_ShowEyeIcon.BRmzNxYQ.js → fthry_ShowEyeIcon.DrP5GypN.js} +1 -1
- package/dist/fthry_auto-track.Bb7a2GMR.js +111 -0
- package/dist/{fthry_highlighted-body-TPN3WLV5.VbtSFmzn.js → fthry_highlighted-body-TPN3WLV5.QeEpdZbH.js} +3 -3
- package/dist/{fthry_index.vtPqJ0XE.js → fthry_index.0o3T2ouc.js} +1 -1
- package/dist/fthry_index.1SZZv9d2.js +6871 -0
- package/dist/{fthry_index.BabA9Mw-.js → fthry_index.B6pEx1zI.js} +5 -5
- package/dist/{fthry_index.Cni5qhKo.js → fthry_index.BJKDlrlW.js} +4 -4
- package/dist/{fthry_index.CNnWO_IQ.js → fthry_index.BMzPHmtX.js} +2 -2
- package/dist/{fthry_index.DXdUdmGQ.js → fthry_index.BWH9S7pc.js} +37 -20
- package/dist/fthry_index.BZvFWQLR.js +71 -0
- package/dist/{fthry_index.DDOGQlw5.js → fthry_index.BpKf-eNy.js} +1 -1
- package/dist/{fthry_index.IiZ-zUFp.js → fthry_index.C5BLw18G.js} +6 -6
- package/dist/{fthry_index.BU1tBfl4.js → fthry_index.C8LO6uJL.js} +6 -6
- package/dist/{fthry_index._5bwnWsa.js → fthry_index.CDuqBBJn.js} +278 -241
- package/dist/{fthry_index.BwtbJAEO.js → fthry_index.CIlxRQ4S.js} +5 -5
- package/dist/{fthry_index.CTKKbjOj.js → fthry_index.CUY_p8do.js} +5 -5
- package/dist/{fthry_index.D703JOs7.js → fthry_index.CXn-UnK8.js} +3 -3
- package/dist/{fthry_index.D9AlZz3i.js → fthry_index.ChUSP_4k.js} +6 -6
- package/dist/{fthry_index.fobb7KRG.js → fthry_index.ClZUnlbG.js} +1 -1
- package/dist/{fthry_index.DObbQIll.js → fthry_index.Cqhg3Wmg.js} +1 -1
- package/dist/{fthry_index.C3UMQKv8.js → fthry_index.Csz_U1Oc.js} +5 -5
- package/dist/{fthry_index.C3ADr7W7.js → fthry_index.CubzFuFl.js} +3 -3
- package/dist/{fthry_index.BCEtAYB2.js → fthry_index.D1iW0N2t.js} +1 -1
- package/dist/{fthry_index.D3YVIQwB.js → fthry_index.D4pTk5dr.js} +8 -8
- package/dist/{fthry_index.CrDUdmXr.js → fthry_index.DA_5F_7_.js} +1 -1
- package/dist/fthry_index.DG6NlwpO.js +66 -0
- package/dist/fthry_index.DJ7vQ3zt.js +70 -0
- package/dist/{fthry_index.CI2e6tdr.js → fthry_index.DJRjeQWm.js} +5 -5
- package/dist/{fthry_index.DjOqKkBq.js → fthry_index.DdgFKsos.js} +1 -1
- package/dist/{fthry_index.DO15Hx14.js → fthry_index.DuRVVFRL.js} +2 -2
- package/dist/fthry_index.JD44HVFL.js +573 -0
- package/dist/{fthry_index.DkcH8BMq.js → fthry_index.QPKqFn46.js} +1 -1
- package/dist/fthry_index.UTYK1bhI.js +474 -0
- package/dist/{fthry_index.BXQYUbtj.js → fthry_index.XG1xyplD.js} +4 -4
- package/dist/fthry_index.umd.DLnl0brp.js +39 -0
- package/dist/fthry_index.x66JmbiK.js +32 -0
- package/dist/{fthry_input.DNaXMuMS.js → fthry_input.BgzKGmQG.js} +1 -1
- package/dist/fthry_is-plan-event-enabled.mXX0dwl-.js +17 -0
- package/dist/{fthry_mermaid-O7DHMXV3.WhXC51ol.js → fthry_mermaid-O7DHMXV3.DehdVKQ3.js} +3 -3
- package/dist/{fthry_script.Bqz_se84.js → fthry_script.BcdCwqG3.js} +1 -1
- package/dist/{fthry_styles.DMI6ijBl.js → fthry_styles.DNxDElEh.js} +1 -1
- package/dist/{fthry_useElementSize.BcPjULOb.js → fthry_useElementSize.DvHJBcIE.js} +1 -1
- package/dist/{fthry_useSalesforceSync.lJhIijY2.js → fthry_useSalesforceSync.DHWXQkeF.js} +1 -1
- package/dist/{fthry_webfontloader.B0wgjWSB.js → fthry_webfontloader.C-DWZTL7.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/integrations/segment.d.ts +1 -1
- package/dist/integrations/segment.d.ts.map +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 +2 -1
- package/umd/277.1a33ea06f86326613fcb.js +1 -0
- package/umd/301.b40f38397dcde848ba46.js +1 -0
- package/umd/435.a94343a900f83a1ba8eb.js +1 -0
- package/umd/466.c82e14e5b06ae17649ff.js +1 -0
- package/umd/509.d49410af0cc948b08d73.js +2 -0
- package/umd/529.e7a0a831bf80398fda0f.js +1 -0
- package/umd/542.5168cf86fc7255c8b7fd.js +1 -0
- package/umd/598.9bc05f78267c055211d9.js +2 -0
- package/umd/602.ddda17ac6b2cabb3d639.js +1 -0
- package/umd/664.4a3ec465094a3d59c184.js +1 -0
- package/umd/834.b4ef33227c4c872368d6.js +1 -0
- package/umd/94.391827577c1c62f73f29.js +2 -0
- package/umd/AddressField.648b3da916171008dc9f.js +1 -0
- package/umd/AssistantChat.685c311fcfd51a09112e.js +1 -0
- package/umd/ButtonGroupField.d39ac976a6dee9ef593a.js +1 -0
- package/umd/CheckboxField.3323fdfd4a7377580d46.js +1 -0
- package/umd/CheckboxGroupField.e495eb152c4faa000d4b.js +1 -0
- package/umd/ColorPickerField.7e0f3c3a7dc1bcaf5e30.js +1 -0
- package/umd/CustomField.895d9a1d34e8e7b8b8d0.js +1 -0
- package/umd/DateSelectorField.e702b3e6b0a5b498c824.js +1 -0
- package/umd/DropdownField.d1a234d236d9989bbf20.js +1 -0
- package/umd/DropdownMultiField.5b4e24025035f1678c83.js +1 -0
- package/umd/FileUploadField.f0d66cf87244c0e565a1.js +1 -0
- package/umd/MatrixField.bcd6f58ea1896f386988.js +1 -0
- package/umd/PasswordField.593d7b7d3d954634fa30.js +1 -0
- package/umd/PaymentMethodField.8e4fd6353793eaaa2b5b.js +1 -0
- package/umd/PhoneField.861b99c7e81b4b9c8648.js +1 -0
- package/umd/PinInputField.ddc30797191dfbed7fe3.js +1 -0
- package/umd/QRScanner.94381603047f5db6b5c0.js +1 -0
- package/umd/RadioButtonGroupField.7a333a6f7e578a181a98.js +1 -0
- package/umd/RatingField.204cb92c30aeb4b8952a.js +1 -0
- package/umd/SignatureField.9cc9b3783cf8149ba767.js +1 -0
- package/umd/SliderField.d746a57527031d551f58.js +1 -0
- package/umd/TableElement.e3da137819e9b84b3b82.js +1 -0
- package/umd/TextArea.04335be4f0f0d6c0cc1a.js +1 -0
- package/umd/TextField.749931ebb258bf38e007.js +1 -0
- package/umd/ajs-destination.19322d501875cd260554.js +1 -0
- package/umd/auto-track.e6503d851d1d8c634ff0.js +1 -0
- package/umd/index.js +1 -1
- package/umd/legacyVideos.5ab9e462d737eca6f817.js +1 -0
- package/umd/libphonenumber.721378defae8d84deae2.js +1 -0
- package/umd/queryString.74978b49d70f9556e22a.js +1 -0
- package/umd/remoteMiddleware.fb68e7490b3379937c68.js +1 -0
- package/umd/schemaFilter.45d31876c08e74664f1d.js +1 -0
- package/umd/segment.76c3946188b5c80e77d6.js +2 -0
- package/umd/segment.76c3946188b5c80e77d6.js.LICENSE.txt +1 -0
- package/umd/tsub-middleware.4d4d00320fa7aa6a97cc.js +2 -0
- package/umd/tsub-middleware.4d4d00320fa7aa6a97cc.js.LICENSE.txt +1 -0
- package/umd/webfontloader.419636e0eb0cfb39b078.js +1 -0
- package/umd/277.87e6ca5c1cf2a7477992.js +0 -1
- package/umd/301.a96bba9d529bf7fd379e.js +0 -1
- package/umd/435.faa037e36038c2c766da.js +0 -1
- package/umd/466.e3456c8b3407ad04ba56.js +0 -1
- package/umd/509.bca2ff43c66b1dba064f.js +0 -2
- package/umd/529.63afee65c745ca950f81.js +0 -1
- package/umd/542.f1dbbbb062e82a2995e9.js +0 -1
- package/umd/598.ca92da6595afad37b511.js +0 -2
- package/umd/602.1fde434923c6596acd40.js +0 -1
- package/umd/664.42541009d1fcb121cc49.js +0 -1
- package/umd/94.e8ad20ab98c664d13197.js +0 -2
- package/umd/AddressField.c4188872f2a931394aa1.js +0 -1
- package/umd/AssistantChat.7af8f8f25348f5379aeb.js +0 -1
- package/umd/ButtonGroupField.33cf9c939c8e82cc6c83.js +0 -1
- package/umd/CheckboxField.782999cad642da04434d.js +0 -1
- package/umd/CheckboxGroupField.18ab392a2890a239fd0b.js +0 -1
- package/umd/ColorPickerField.f6740bb7c4c20a520db5.js +0 -1
- package/umd/CustomField.a5b2965922f2d170b9b5.js +0 -1
- package/umd/DateSelectorField.568bb30a220837a36660.js +0 -1
- package/umd/DropdownField.9f0f8a425ddf09771ad8.js +0 -1
- package/umd/DropdownMultiField.72a44c0280217eeb5652.js +0 -1
- package/umd/FileUploadField.7a5028fb6035d09b3e81.js +0 -1
- package/umd/MatrixField.2b65107453ddf2322137.js +0 -1
- package/umd/PasswordField.7585ef588333cb4181f7.js +0 -1
- package/umd/PaymentMethodField.d08bcfa1efb56084572d.js +0 -1
- package/umd/PhoneField.b9293ead8e5a2a3b7c37.js +0 -1
- package/umd/PinInputField.b1aee0ef9d3c9f9a1933.js +0 -1
- package/umd/QRScanner.3c22391de30dba001f13.js +0 -1
- package/umd/RadioButtonGroupField.20268d1b4649053bf1db.js +0 -1
- package/umd/RatingField.eeeb0ac499c308c120ba.js +0 -1
- package/umd/SignatureField.0e7d60fa2fafcb6be554.js +0 -1
- package/umd/SliderField.a5ab58e4b89fa67d6ac6.js +0 -1
- package/umd/TableElement.1076e69a66923cfe6434.js +0 -1
- package/umd/TextArea.7cca0d69e618846660c5.js +0 -1
- package/umd/TextField.28c59425e129e78a4551.js +0 -1
- package/umd/libphonenumber.4ab4d30edb4e455b2fc4.js +0 -1
- package/umd/webfontloader.b44bdf00049b175713ae.js +0 -1
- /package/umd/{509.bca2ff43c66b1dba064f.js.LICENSE.txt → 509.d49410af0cc948b08d73.js.LICENSE.txt} +0 -0
- /package/umd/{598.ca92da6595afad37b511.js.LICENSE.txt → 598.9bc05f78267c055211d9.js.LICENSE.txt} +0 -0
- /package/umd/{94.e8ad20ab98c664d13197.js.LICENSE.txt → 94.391827577c1c62f73f29.js.LICENSE.txt} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index$1 = require('./fthry_index.
|
|
3
|
+
var index$1 = require('./fthry_index.3RtrK8MX.js');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var clsx = require('./fthry_clsx.BtxeOLZW.js');
|
|
6
6
|
var ReactJSXRuntime = require('react/jsx-runtime');
|
|
7
7
|
var ReactDOM = require('react-dom');
|
|
8
|
-
var index$2 = require('./fthry_index.
|
|
8
|
+
var index$2 = require('./fthry_index.B4peckbq.js');
|
|
9
9
|
|
|
10
10
|
// src/errors/ai-sdk-error.ts
|
|
11
11
|
var marker = "vercel.ai.error";
|
|
@@ -9803,15 +9803,39 @@ var getChatColors = function (primary) { return ({
|
|
|
9803
9803
|
}); };
|
|
9804
9804
|
|
|
9805
9805
|
var TOOL_LABELS = {
|
|
9806
|
-
searchDocuments: {
|
|
9807
|
-
running: 'Searching documents...',
|
|
9808
|
-
done: 'Searched the documents'
|
|
9809
|
-
},
|
|
9810
9806
|
searchWeb: {
|
|
9811
9807
|
running: 'Searching the web...',
|
|
9812
9808
|
done: 'Searched the web'
|
|
9813
9809
|
},
|
|
9814
9810
|
scrapeUrl: { running: 'Reading web page...', done: 'Read the web page' },
|
|
9811
|
+
searchDocuments: {
|
|
9812
|
+
running: 'Searching documents...',
|
|
9813
|
+
done: 'Searched the documents'
|
|
9814
|
+
},
|
|
9815
|
+
setFieldValue: {
|
|
9816
|
+
running: 'Updating form fields...',
|
|
9817
|
+
done: 'Updated form fields'
|
|
9818
|
+
},
|
|
9819
|
+
clickElement: {
|
|
9820
|
+
running: 'Running form action...',
|
|
9821
|
+
done: 'Ran the form action'
|
|
9822
|
+
},
|
|
9823
|
+
addTableRow: {
|
|
9824
|
+
running: 'Adding a row...',
|
|
9825
|
+
done: 'Added a row'
|
|
9826
|
+
},
|
|
9827
|
+
deleteTableRow: {
|
|
9828
|
+
running: 'Deleting a row...',
|
|
9829
|
+
done: 'Deleted a row'
|
|
9830
|
+
},
|
|
9831
|
+
setTableCellValue: {
|
|
9832
|
+
running: 'Updating table cells...',
|
|
9833
|
+
done: 'Updated table cells'
|
|
9834
|
+
},
|
|
9835
|
+
triggerTableAction: {
|
|
9836
|
+
running: 'Running table action...',
|
|
9837
|
+
done: 'Ran the table action'
|
|
9838
|
+
},
|
|
9815
9839
|
getPanelSnapshot: {
|
|
9816
9840
|
running: 'Reading the form...',
|
|
9817
9841
|
done: 'Reviewed the form'
|
|
@@ -9820,10 +9844,6 @@ var TOOL_LABELS = {
|
|
|
9820
9844
|
running: 'Looking up your submission...',
|
|
9821
9845
|
done: 'Reviewed the submission'
|
|
9822
9846
|
},
|
|
9823
|
-
listFormExtractions: {
|
|
9824
|
-
running: 'Looking up extractions...',
|
|
9825
|
-
done: 'Reviewed available extractions'
|
|
9826
|
-
},
|
|
9827
9847
|
getExtractionSnapshot: {
|
|
9828
9848
|
running: 'Reading extraction setup...',
|
|
9829
9849
|
done: 'Reviewed the extraction setup'
|
|
@@ -9832,13 +9852,9 @@ var TOOL_LABELS = {
|
|
|
9832
9852
|
running: 'Reading extraction results...',
|
|
9833
9853
|
done: 'Reviewed the extraction results'
|
|
9834
9854
|
},
|
|
9835
|
-
|
|
9836
|
-
running: '
|
|
9837
|
-
done: '
|
|
9838
|
-
},
|
|
9839
|
-
clickElement: {
|
|
9840
|
-
running: 'Just a moment...',
|
|
9841
|
-
done: 'Triggered a form action'
|
|
9855
|
+
listFormExtractions: {
|
|
9856
|
+
running: 'Looking up extractions...',
|
|
9857
|
+
done: 'Reviewed available extractions'
|
|
9842
9858
|
},
|
|
9843
9859
|
getLogicRules: {
|
|
9844
9860
|
running: 'Reading form logic...',
|
|
@@ -51274,14 +51290,14 @@ ${e}</tr>
|
|
|
51274
51290
|
Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+T(n.message+"",true)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}};var L$1=new D;function g(u,e){return L$1.parse(u,e)}g.options=g.setOptions=function(u){return L$1.setOptions(u),g.defaults=L$1.defaults,G(g.defaults),g};g.getDefaults=M;g.defaults=O;g.use=function(...u){return L$1.use(...u),g.defaults=L$1.defaults,G(g.defaults),g};g.walkTokens=function(u,e){return L$1.walkTokens(u,e)};g.parseInline=L$1.parseInline;g.Parser=b;g.parser=b.parse;g.Renderer=y$1;g.TextRenderer=$;g.Lexer=x;g.lexer=x.lex;g.Tokenizer=w;g.Hooks=P;g.parse=g;g.options;g.setOptions;g.use;g.walkTokens;g.parseInline;b.parse;x.lex;
|
|
51275
51291
|
|
|
51276
51292
|
var En=300,Hn="300px",Dn=500;function Lt(e={}){let{immediate:t=false,debounceDelay:o=En,rootMargin:n=Hn,idleTimeout:r=Dn}=e,[s,a]=React.useState(false),l=React.useRef(null),i=React.useRef(null),c=React.useRef(null),d=React.useMemo(()=>p=>{let g=Date.now();return window.setTimeout(()=>{p({didTimeout:false,timeRemaining:()=>Math.max(0,50-(Date.now()-g))});},1)},[]),u=React.useMemo(()=>typeof window!="undefined"&&window.requestIdleCallback?(p,g)=>window.requestIdleCallback(p,g):d,[d]),m=React.useMemo(()=>typeof window!="undefined"&&window.cancelIdleCallback?p=>window.cancelIdleCallback(p):p=>{clearTimeout(p);},[]);return React.useEffect(()=>{if(t){a(true);return}let p=l.current;if(!p)return;i.current&&(clearTimeout(i.current),i.current=null),c.current&&(m(c.current),c.current=null);let g=()=>{i.current&&(clearTimeout(i.current),i.current=null),c.current&&(m(c.current),c.current=null);},h=x=>{c.current=u(w=>{w.timeRemaining()>0||w.didTimeout?(a(true),x.disconnect()):c.current=u(()=>{a(true),x.disconnect();},{timeout:r/2});},{timeout:r});},b=x=>{g(),i.current=window.setTimeout(()=>{var I,H;let w=x.takeRecords();(w.length===0||(H=(I=w.at(-1))==null?void 0:I.isIntersecting)!=null&&H)&&h(x);},o);},f=(x,w)=>{x.isIntersecting?b(w):g();},T=new IntersectionObserver(x=>{for(let w of x)f(w,T);},{rootMargin:n,threshold:0});return T.observe(p),()=>{i.current&&clearTimeout(i.current),c.current&&m(c.current),T.disconnect();}},[t,o,n,r,m,u]),{shouldRender:s,containerRef:l}}var Rt=/\s/,On=/^\s+$/,Vn=new Set(["code","pre","svg","math","annotation"]),jn=e=>typeof e=="object"&&e!==null&&"type"in e&&e.type==="element",Fn=e=>e.some(t=>jn(t)&&Vn.has(t.tagName)),zn=e=>{let t=[],o="",n=false;for(let r of e){let s=Rt.test(r);s!==n&&o&&(t.push(o),o=""),o+=r,n=s;}return o&&t.push(o),t},_n=e=>{let t=[],o="";for(let n of e)Rt.test(n)?o+=n:(o&&(t.push(o),o=""),t.push(n));return o&&t.push(o),t},qn=(e,t,o,n,r)=>({type:"element",tagName:"span",properties:{"data-sd-animate":true,style:r?`--sd-animation:sd-${t};--sd-duration:0ms;--sd-easing:${n}`:`--sd-animation:sd-${t};--sd-duration:${o}ms;--sd-easing:${n}`},children:[{type:"text",value:e}]}),$n=(e,t,o,n,r)=>{let s=t.at(-1);if(!(s&&"children"in s))return;if(Fn(t))return SKIP;let a=s,l=a.children.indexOf(e);if(l===-1)return;let i=e.value;if(!i.trim()){r.count+=i.length;return}let c=o.sep==="char"?_n(i):zn(i),d=n.prevContentLength,u=c.map(m=>{let p=r.count;if(r.count+=m.length,On.test(m))return {type:"text",value:m};let g=d>0&&p<d;return qn(m,o.animation,o.duration,o.easing,g)});return a.children.splice(l,1,...u),l+u.length},Wn=0;function be(e){var s,a,l,i;let t={animation:(s=e==null?void 0:e.animation)!=null?s:"fadeIn",duration:(a=e==null?void 0:e.duration)!=null?a:150,easing:(l=e==null?void 0:e.easing)!=null?l:"ease",sep:(i=e==null?void 0:e.sep)!=null?i:"word"},o={prevContentLength:0,lastRenderCharCount:0},n=Wn++,r=()=>c=>{let d={count:0};visitParents(c,"text",(u,m)=>$n(u,m,t,o,d)),o.lastRenderCharCount=d.count,o.prevContentLength=0;};return Object.defineProperty(r,"name",{value:`rehypeAnimate$${n}`}),{name:"animate",type:"animate",rehypePlugin:r,setPrevContentLength(c){o.prevContentLength=c;},getLastRenderCharCount(){let c=o.lastRenderCharCount;return o.lastRenderCharCount=0,c}}}be();var Qe=React.createContext(false),et=()=>React.useContext(Qe);var he=(...e)=>twMerge(clsx.clsx(e)),Jn=(e,t)=>{if(!e||!t)return t;let o=`${e}:`;return t.split(/\s+/).filter(Boolean).map(n=>n.startsWith(o)?n:`${e}:${n}`).join(" ")},Ht=e=>e?(...t)=>Jn(e,twMerge(clsx.clsx(t))):he,J=(e,t,o)=>{let n=typeof t=="string"?new Blob([t],{type:o}):t,r=URL.createObjectURL(n),s=document.createElement("a");s.href=r,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r);};var Se=React.createContext(he),y=()=>React.useContext(Se);var Yn=he("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-6","before:mr-4","before:text-[13px]","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),Qn=e=>{let t={};for(let o of e.split(";")){let n=o.indexOf(":");if(n>0){let r=o.slice(0,n).trim(),s=o.slice(n+1).trim();r&&s&&(t[r]=s);}}return t},Bt=React.memo(({children:e,result:t,language:o,className:n,startLine:r,...s})=>{let a=y(),l=React.useMemo(()=>a(Yn),[a]),i=React.useMemo(()=>{let c={};return t.bg&&(c["--sdm-bg"]=t.bg),t.fg&&(c["--sdm-fg"]=t.fg),t.rootStyle&&Object.assign(c,Qn(t.rootStyle)),c},[t.bg,t.fg,t.rootStyle]);return ReactJSXRuntime.jsx("div",{className:a(n,"overflow-hidden rounded-md border border-border bg-background p-4 text-sm"),"data-language":o,"data-streamdown":"code-block-body",...s,children:ReactJSXRuntime.jsx("pre",{className:a(n,"bg-[var(--sdm-bg,inherit]","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]"),style:i,children:ReactJSXRuntime.jsx("code",{className:a("[counter-increment:line_0] [counter-reset:line]"),style:r&&r>1?{counterReset:`line ${r-1}`}:void 0,children:t.tokens.map((c,d)=>ReactJSXRuntime.jsx("span",{className:l,children:c.length===0||c.length===1&&c[0].content===""?`
|
|
51277
|
-
`:c.map((u,m)=>{let p={},g=!!u.bgColor;if(u.color&&(p["--sdm-c"]=u.color),u.bgColor&&(p["--sdm-tbg"]=u.bgColor),u.htmlStyle)for(let[h,b]of Object.entries(u.htmlStyle))h==="color"?p["--sdm-c"]=b:h==="background-color"?(p["--sdm-tbg"]=b,g=true):p[h]=b;return ReactJSXRuntime.jsx("span",{className:a("text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",g&&"bg-[var(--sdm-tbg)]",g&&"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),style:p,...u.htmlAttrs,children:u.content},m)})},d))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className&&e.startLine===t.startLine);var tt=({className:e,language:t,style:o,isIncomplete:n,...r})=>{let s=y();return ReactJSXRuntime.jsx("div",{className:s("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",e),"data-incomplete":n||void 0,"data-language":t,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...o},...r})};var ot=React.createContext({code:""}),Ee=()=>React.useContext(ot);var nt=({language:e})=>{let t=y();return ReactJSXRuntime.jsx("div",{className:t("flex h-8 items-center text-muted-foreground text-xs"),"data-language":e,"data-streamdown":"code-block-header",children:ReactJSXRuntime.jsx("span",{className:t("ml-1 font-mono lowercase"),children:e})})};var sr=/\n+$/,ar=React.lazy(()=>Promise.resolve().then(function () { return require('./fthry_highlighted-body-TPN3WLV5.
|
|
51293
|
+
`:c.map((u,m)=>{let p={},g=!!u.bgColor;if(u.color&&(p["--sdm-c"]=u.color),u.bgColor&&(p["--sdm-tbg"]=u.bgColor),u.htmlStyle)for(let[h,b]of Object.entries(u.htmlStyle))h==="color"?p["--sdm-c"]=b:h==="background-color"?(p["--sdm-tbg"]=b,g=true):p[h]=b;return ReactJSXRuntime.jsx("span",{className:a("text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",g&&"bg-[var(--sdm-tbg)]",g&&"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),style:p,...u.htmlAttrs,children:u.content},m)})},d))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className&&e.startLine===t.startLine);var tt=({className:e,language:t,style:o,isIncomplete:n,...r})=>{let s=y();return ReactJSXRuntime.jsx("div",{className:s("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",e),"data-incomplete":n||void 0,"data-language":t,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...o},...r})};var ot=React.createContext({code:""}),Ee=()=>React.useContext(ot);var nt=({language:e})=>{let t=y();return ReactJSXRuntime.jsx("div",{className:t("flex h-8 items-center text-muted-foreground text-xs"),"data-language":e,"data-streamdown":"code-block-header",children:ReactJSXRuntime.jsx("span",{className:t("ml-1 font-mono lowercase"),children:e})})};var sr=/\n+$/,ar=React.lazy(()=>Promise.resolve().then(function () { return require('./fthry_highlighted-body-TPN3WLV5.Dgq3ZfLo.js'); }).then(e=>({default:e.HighlightedCodeBlockBody}))),rt=({code:e,language:t,className:o,children:n,isIncomplete:r=false,startLine:s,...a})=>{let l=y(),i=React.useMemo(()=>e.replace(sr,""),[e]),c=React.useMemo(()=>({bg:"transparent",fg:"inherit",tokens:i.split(`
|
|
51278
51294
|
`).map(d=>[{content:d,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[i]);return ReactJSXRuntime.jsx(ot.Provider,{value:{code:e},children:ReactJSXRuntime.jsxs(tt,{isIncomplete:r,language:t,children:[ReactJSXRuntime.jsx(nt,{language:t}),n?ReactJSXRuntime.jsx("div",{className:l("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:ReactJSXRuntime.jsx("div",{className:l("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),"data-streamdown":"code-block-actions",children:n})}):null,ReactJSXRuntime.jsx(React.Suspense,{fallback:ReactJSXRuntime.jsx(Bt,{className:o,language:t,result:c,startLine:s,...a}),children:ReactJSXRuntime.jsx(ar,{className:o,code:i,language:t,raw:c,startLine:s,...a})})]})})};var Vt=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z",fill:"currentColor",fillRule:"evenodd"})}),jt=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z",fill:"currentColor",fillRule:"evenodd"})}),Ft=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z",fill:"currentColor",fillRule:"evenodd"})}),zt=e=>ReactJSXRuntime.jsxs("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:[ReactJSXRuntime.jsx("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),ReactJSXRuntime.jsx("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),_t=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z",fill:"currentColor",fillRule:"evenodd"})}),qt=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z",fill:"currentColor",fillRule:"evenodd"})}),$t=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z",fill:"currentColor",fillRule:"evenodd"})}),Wt=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z",fill:"currentColor",fillRule:"evenodd"})}),Zt=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})}),Xt=e=>ReactJSXRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:ReactJSXRuntime.jsx("path",{clipRule:"evenodd",d:"M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z",fill:"currentColor",fillRule:"evenodd"})});var we={CheckIcon:Vt,CopyIcon:jt,DownloadIcon:Ft,ExternalLinkIcon:Wt,Loader2Icon:zt,Maximize2Icon:_t,RotateCcwIcon:qt,XIcon:$t,ZoomInIcon:Zt,ZoomOutIcon:Xt},Kt=React.createContext(we),mr=(e,t)=>{if(e===t)return true;if(!(e&&t))return e===t;let o=Object.keys(e),n=Object.keys(t);return o.length!==n.length?false:o.every(r=>e[r]===t[r])},st=({icons:e,children:t})=>{let o=React.useRef(e),n=React.useRef(e?{...we,...e}:we);mr(o.current,e)||(o.current=e,n.current=e?{...we,...e}:we);let r=n.current;return ReactJSXRuntime.jsx(Kt.Provider,{value:r,children:t})},L=()=>React.useContext(Kt);var He={copyCode:"Copy Code",downloadFile:"Download file",downloadDiagram:"Download diagram",downloadDiagramAsSvg:"Download diagram as SVG",downloadDiagramAsPng:"Download diagram as PNG",downloadDiagramAsMmd:"Download diagram as MMD",viewFullscreen:"View fullscreen",exitFullscreen:"Exit fullscreen",mermaidFormatSvg:"SVG",mermaidFormatPng:"PNG",mermaidFormatMmd:"MMD",copyTable:"Copy table",copyTableAsMarkdown:"Copy table as Markdown",copyTableAsCsv:"Copy table as CSV",copyTableAsTsv:"Copy table as TSV",downloadTable:"Download table",downloadTableAsCsv:"Download table as CSV",downloadTableAsMarkdown:"Download table as Markdown",tableFormatMarkdown:"Markdown",tableFormatCsv:"CSV",tableFormatTsv:"TSV",imageNotAvailable:"Image not available",downloadImage:"Download image",openExternalLink:"Open external link?",externalLinkWarning:"You're about to visit an external website.",close:"Close",copyLink:"Copy link",copied:"Copied",openLink:"Open link"},De=React.createContext(He),B=()=>React.useContext(De);var Be=({onCopy:e,onError:t,timeout:o=2e3,children:n,className:r,code:s,...a})=>{let l=y(),[i,c]=React.useState(false),d=React.useRef(0),{code:u}=Ee(),{isAnimating:m}=React.useContext(R),p=B(),g=s!=null?s:u,h=async()=>{var T;if(typeof window=="undefined"||!((T=navigator==null?void 0:navigator.clipboard)!=null&&T.writeText)){t==null||t(new Error("Clipboard API not available"));return}try{i||(await navigator.clipboard.writeText(g),c(!0),e==null||e(),d.current=window.setTimeout(()=>c(!1),o));}catch(x){t==null||t(x);}};React.useEffect(()=>()=>{window.clearTimeout(d.current);},[]);let b=L(),f=i?b.CheckIcon:b.CopyIcon;return ReactJSXRuntime.jsx("button",{className:l("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),"data-streamdown":"code-block-copy-button",disabled:m,onClick:h,title:p.copyCode,type:"button",...a,children:n!=null?n:ReactJSXRuntime.jsx(f,{size:14})})};var Gt={"1c":"1c","1c-query":"1cq",abap:"abap","actionscript-3":"as",ada:"ada",adoc:"adoc","angular-html":"html","angular-ts":"ts",apache:"conf",apex:"cls",apl:"apl",applescript:"applescript",ara:"ara",asciidoc:"adoc",asm:"asm",astro:"astro",awk:"awk",ballerina:"bal",bash:"sh",bat:"bat",batch:"bat",be:"be",beancount:"beancount",berry:"berry",bibtex:"bib",bicep:"bicep",blade:"blade.php",bsl:"bsl",c:"c","c#":"cs","c++":"cpp",cadence:"cdc",cairo:"cairo",cdc:"cdc",clarity:"clar",clj:"clj",clojure:"clj","closure-templates":"soy",cmake:"cmake",cmd:"cmd",cobol:"cob",codeowners:"CODEOWNERS",codeql:"ql",coffee:"coffee",coffeescript:"coffee","common-lisp":"lisp",console:"sh",coq:"v",cpp:"cpp",cql:"cql",crystal:"cr",cs:"cs",csharp:"cs",css:"css",csv:"csv",cue:"cue",cypher:"cql",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",docker:"dockerfile",dockerfile:"dockerfile",dotenv:"env","dream-maker":"dm",edge:"edge",elisp:"el",elixir:"ex",elm:"elm","emacs-lisp":"el",erb:"erb",erl:"erl",erlang:"erl",f:"f","f#":"fs",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"f90",f95:"f95",fennel:"fnl",fish:"fish",fluent:"ftl",for:"for","fortran-fixed-form":"f","fortran-free-form":"f90",fs:"fs",fsharp:"fs",fsl:"fsl",ftl:"ftl",gdresource:"tres",gdscript:"gd",gdshader:"gdshader",genie:"gs",gherkin:"feature","git-commit":"gitcommit","git-rebase":"gitrebase",gjs:"js",gleam:"gleam","glimmer-js":"js","glimmer-ts":"ts",glsl:"glsl",gnuplot:"plt",go:"go",gql:"gql",graphql:"graphql",groovy:"groovy",gts:"gts",hack:"hack",haml:"haml",handlebars:"hbs",haskell:"hs",haxe:"hx",hbs:"hbs",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",hs:"hs",html:"html","html-derivative":"html",http:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",jade:"jade",java:"java",javascript:"js",jinja:"jinja",jison:"jison",jl:"jl",js:"js",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",julia:"jl",kotlin:"kt",kql:"kql",kt:"kt",kts:"kts",kusto:"kql",latex:"tex",lean:"lean",lean4:"lean",less:"less",liquid:"liquid",lisp:"lisp",lit:"lit",llvm:"ll",log:"log",logo:"logo",lua:"lua",luau:"luau",make:"mak",makefile:"mak",markdown:"md",marko:"marko",matlab:"m",md:"md",mdc:"mdc",mdx:"mdx",mediawiki:"wiki",mermaid:"mmd",mips:"s",mipsasm:"s",mmd:"mmd",mojo:"mojo",move:"move",nar:"nar",narrat:"narrat",nextflow:"nf",nf:"nf",nginx:"conf",nim:"nim",nix:"nix",nu:"nu",nushell:"nu",objc:"m","objective-c":"m","objective-cpp":"mm",ocaml:"ml",pascal:"pas",perl:"pl",perl6:"p6",php:"php",plsql:"pls",po:"po",polar:"polar",postcss:"pcss",pot:"pot",potx:"potx",powerquery:"pq",powershell:"ps1",prisma:"prisma",prolog:"pl",properties:"properties",proto:"proto",protobuf:"proto",ps:"ps",ps1:"ps1",pug:"pug",puppet:"pp",purescript:"purs",py:"py",python:"py",ql:"ql",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",racket:"rkt",raku:"raku",razor:"cshtml",rb:"rb",reg:"reg",regex:"regex",regexp:"regexp",rel:"rel",riscv:"s",rs:"rs",rst:"rst",ruby:"rb",rust:"rs",sas:"sas",sass:"sass",scala:"scala",scheme:"scm",scss:"scss",sdbl:"sdbl",sh:"sh",shader:"shader",shaderlab:"shader",shell:"sh",shellscript:"sh",shellsession:"sh",smalltalk:"st",solidity:"sol",soy:"soy",sparql:"rq",spl:"spl",splunk:"spl",sql:"sql","ssh-config":"config",stata:"do",styl:"styl",stylus:"styl",svelte:"svelte",swift:"swift","system-verilog":"sv",systemd:"service",talon:"talon",talonscript:"talon",tasl:"tasl",tcl:"tcl",templ:"templ",terraform:"tf",tex:"tex",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"ts","ts-tags":"ts",tsp:"tsp",tsv:"tsv",tsx:"tsx",turtle:"ttl",twig:"twig",typ:"typ",typescript:"ts",typespec:"tsp",typst:"typ",v:"v",vala:"vala",vb:"vb",verilog:"v",vhdl:"vhdl",vim:"vim",viml:"vim",vimscript:"vim",vue:"vue","vue-html":"html","vue-vine":"vine",vy:"vy",vyper:"vy",wasm:"wasm",wenyan:"wy",wgsl:"wgsl",wiki:"wiki",wikitext:"wiki",wit:"wit",wl:"wl",wolfram:"wl",xml:"xml",xsl:"xsl",yaml:"yaml",yml:"yml",zenscript:"zs",zig:"zig",zsh:"zsh",\u6587\u8A00:"wy"},at=({onDownload:e,onError:t,language:o,children:n,className:r,code:s,...a})=>{let l=y(),{code:i}=Ee(),{isAnimating:c}=React.useContext(R),d=B(),u=L(),m=s!=null?s:i,g=`file.${o&&o in Gt?Gt[o]:"txt"}`,h="text/plain",b=()=>{try{J(g,m,h),e==null||e();}catch(f){t==null||t(f);}};return ReactJSXRuntime.jsx("button",{className:l("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),"data-streamdown":"code-block-download-button",disabled:c,onClick:b,title:d.downloadFile,type:"button",...a,children:n!=null?n:ReactJSXRuntime.jsx(u.DownloadIcon,{size:14})})};var Ae=()=>{let{Loader2Icon:e}=L(),t=y();return ReactJSXRuntime.jsxs("div",{className:t("w-full divide-y divide-border overflow-hidden rounded-xl border border-border"),children:[ReactJSXRuntime.jsx("div",{className:t("h-[46px] w-full bg-muted/80")}),ReactJSXRuntime.jsx("div",{className:t("flex w-full items-center justify-center p-4"),children:ReactJSXRuntime.jsx(e,{className:t("size-4 animate-spin")})})]})};var xr=/\.[^/.]+$/,to=({node:e,className:t,src:o,alt:n,onLoad:r,onError:s,...a})=>{let{DownloadIcon:l}=L(),i=y(),c=React.useRef(null),[d,u]=React.useState(false),[m,p]=React.useState(false),g=B(),h=a.width!=null||a.height!=null,b=(d||h)&&!m,f=m&&!h;React.useEffect(()=>{let k=c.current;if(k!=null&&k.complete){let I=k.naturalWidth>0;u(I),p(!I);}},[]);let T=React.useCallback(k=>{u(true),p(false),r==null||r(k);},[r]),x=React.useCallback(k=>{u(false),p(true),s==null||s(k);},[s]),w=async()=>{if(o)try{let I=await(await fetch(o)).blob(),S=new URL(o,window.location.origin).pathname.split("/").pop()||"",F=S.split(".").pop(),z=S.includes(".")&&F!==void 0&&F.length<=4,q="";if(z)q=S;else {let A=I.type,K="png";A.includes("jpeg")||A.includes("jpg")?K="jpg":A.includes("png")?K="png":A.includes("svg")?K="svg":A.includes("gif")?K="gif":A.includes("webp")&&(K="webp"),q=`${(n||S||"image").replace(xr,"")}.${K}`;}J(q,I,I.type);}catch(k){window.open(o,"_blank");}};return o?ReactJSXRuntime.jsxs("div",{className:i("group relative my-4 inline-block"),"data-streamdown":"image-wrapper",children:[ReactJSXRuntime.jsx("img",{alt:n,className:i("max-w-full rounded-lg",f&&"hidden",t),"data-streamdown":"image",onError:x,onLoad:T,ref:c,src:o,...a}),f&&ReactJSXRuntime.jsx("span",{className:i("text-muted-foreground text-xs italic"),"data-streamdown":"image-fallback",children:g.imageNotAvailable}),ReactJSXRuntime.jsx("div",{className:i("pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block")}),b&&ReactJSXRuntime.jsx("button",{className:i("absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background","opacity-0 group-hover:opacity-100"),onClick:w,title:g.downloadImage,type:"button",children:ReactJSXRuntime.jsx(l,{size:14})})]}):null};var ke=0,le=()=>{ke+=1,ke===1&&(document.body.style.overflow="hidden");},ce=()=>{ke=Math.max(0,ke-1),ke===0&&(document.body.style.overflow="");};var ro=({url:e,isOpen:t,onClose:o,onConfirm:n})=>{let{CheckIcon:r,CopyIcon:s,ExternalLinkIcon:a,XIcon:l}=L(),i=y(),[c,d]=React.useState(false),u=B(),m=React.useCallback(async()=>{try{await navigator.clipboard.writeText(e),d(!0),setTimeout(()=>d(!1),2e3);}catch(g){}},[e]),p=React.useCallback(()=>{n(),o();},[n,o]);return React.useEffect(()=>{if(t){le();let g=h=>{h.key==="Escape"&&o();};return document.addEventListener("keydown",g),()=>{document.removeEventListener("keydown",g),ce();}}},[t,o]),t?ReactJSXRuntime.jsx("div",{className:i("fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm"),"data-streamdown":"link-safety-modal",onClick:o,onKeyDown:g=>{g.key==="Escape"&&o();},role:"button",tabIndex:0,children:ReactJSXRuntime.jsxs("div",{className:i("relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg"),onClick:g=>g.stopPropagation(),onKeyDown:g=>g.stopPropagation(),role:"presentation",children:[ReactJSXRuntime.jsx("button",{className:i("absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:o,title:u.close,type:"button",children:ReactJSXRuntime.jsx(l,{size:16})}),ReactJSXRuntime.jsxs("div",{className:i("flex flex-col gap-2"),children:[ReactJSXRuntime.jsxs("div",{className:i("flex items-center gap-2 font-semibold text-lg"),children:[ReactJSXRuntime.jsx(a,{size:20}),ReactJSXRuntime.jsx("span",{children:u.openExternalLink})]}),ReactJSXRuntime.jsx("p",{className:i("text-muted-foreground text-sm"),children:u.externalLinkWarning})]}),ReactJSXRuntime.jsx("div",{className:i("break-all rounded-md bg-muted p-3 font-mono text-sm",e.length>100&&"max-h-32 overflow-y-auto"),children:e}),ReactJSXRuntime.jsxs("div",{className:i("flex gap-2"),children:[ReactJSXRuntime.jsx("button",{className:i("flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted"),onClick:m,type:"button",children:c?ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[ReactJSXRuntime.jsx(r,{size:14}),ReactJSXRuntime.jsx("span",{children:u.copied})]}):ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[ReactJSXRuntime.jsx(s,{size:14}),ReactJSXRuntime.jsx("span",{children:u.copyLink})]})}),ReactJSXRuntime.jsxs("button",{className:i("flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90"),onClick:p,type:"button",children:[ReactJSXRuntime.jsx(a,{size:14}),ReactJSXRuntime.jsx("span",{children:u.openLink})]})]})]})}):null};var Oe=React.createContext(null),lt=()=>React.useContext(Oe),Mi=()=>{var t;let e=lt();return (t=e==null?void 0:e.code)!=null?t:null},de=()=>{var t;let e=lt();return (t=e==null?void 0:e.mermaid)!=null?t:null};var so=e=>{var o;let t=lt();return t!=null&&t.renderers&&e&&(o=t.renderers.find(n=>Array.isArray(n.language)?n.language.includes(e):n.language===e))!=null?o:null};var ao=(e,t)=>{var n;let o=(n=void 0)!=null?n:5;return new Promise((r,s)=>{let a="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e))),l=new Image;l.crossOrigin="anonymous",l.onload=()=>{let i=document.createElement("canvas"),c=l.width*o,d=l.height*o;i.width=c,i.height=d;let u=i.getContext("2d");if(!u){s(new Error("Failed to create 2D canvas context for PNG export"));return}u.drawImage(l,0,0,c,d),i.toBlob(m=>{if(!m){s(new Error("Failed to create PNG blob"));return}r(m);},"image/png");},l.onerror=()=>s(new Error("Failed to load SVG image")),l.src=a;})};var lo=({chart:e,children:t,className:o,onDownload:n,config:r,onError:s})=>{let a=y(),[l,i]=React.useState(false),c=React.useRef(null),{isAnimating:d}=React.useContext(R),u=L(),m=de(),p=B(),g=async h=>{try{if(h==="mmd"){J("diagram.mmd",e,"text/plain"),i(!1),n==null||n(h);return}if(!m){s==null||s(new Error("Mermaid plugin not available"));return}let b=m.getMermaid(r),f=e.split("").reduce((w,k)=>(w<<5)-w+k.charCodeAt(0)|0,0),T=`mermaid-${Math.abs(f)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:x}=await b.render(T,e);if(!x){s==null||s(new Error("SVG not found. Please wait for the diagram to render."));return}if(h==="svg"){J("diagram.svg",x,"image/svg+xml"),i(!1),n==null||n(h);return}if(h==="png"){let w=await ao(x);J("diagram.png",w,"image/png"),n==null||n(h),i(!1);return}}catch(b){s==null||s(b);}};return React.useEffect(()=>{let h=b=>{let f=b.composedPath();c.current&&!f.includes(c.current)&&i(false);};return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h);}},[]),ReactJSXRuntime.jsxs("div",{className:a("relative"),ref:c,children:[ReactJSXRuntime.jsx("button",{className:a("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",o),disabled:d,onClick:()=>i(!l),title:p.downloadDiagram,type:"button",children:t!=null?t:ReactJSXRuntime.jsx(u.DownloadIcon,{size:14})}),l?ReactJSXRuntime.jsxs("div",{className:a("absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[ReactJSXRuntime.jsx("button",{className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("svg"),title:p.downloadDiagramAsSvg,type:"button",children:p.mermaidFormatSvg}),ReactJSXRuntime.jsx("button",{className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("png"),title:p.downloadDiagramAsPng,type:"button",children:p.mermaidFormatPng}),ReactJSXRuntime.jsx("button",{className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("mmd"),title:p.downloadDiagramAsMmd,type:"button",children:p.mermaidFormatMmd})]}):null]})};var po=({chart:e,config:t,onFullscreen:o,onExit:n,className:r,...s})=>{let{Maximize2Icon:a,XIcon:l}=L(),i=y(),[c,d]=React.useState(false),{isAnimating:u,controls:m}=React.useContext(R),p=B(),g=(()=>{if(typeof m=="boolean")return m;let b=m.mermaid;return b===false?false:b===true||b===void 0?true:b.panZoom!==false})(),h=()=>{d(!c);};return React.useEffect(()=>{if(c){le();let b=f=>{f.key==="Escape"&&d(false);};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b),ce();}}},[c]),React.useEffect(()=>{c?o==null||o():n&&n();},[c,o,n]),ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[ReactJSXRuntime.jsx("button",{className:i("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),disabled:u,onClick:h,title:p.viewFullscreen,type:"button",...s,children:ReactJSXRuntime.jsx(a,{size:14})}),c?ReactDOM.createPortal(ReactJSXRuntime.jsxs("div",{className:i("fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm"),onClick:h,onKeyDown:b=>{b.key==="Escape"&&h();},role:"button",tabIndex:0,children:[ReactJSXRuntime.jsx("button",{className:i("absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:h,title:p.exitFullscreen,type:"button",children:ReactJSXRuntime.jsx(l,{size:20})}),ReactJSXRuntime.jsx("div",{className:i("flex size-full items-center justify-center p-4"),onClick:b=>b.stopPropagation(),onKeyDown:b=>b.stopPropagation(),role:"presentation",children:ReactJSXRuntime.jsx(uo,{chart:e,className:i("size-full [&_svg]:h-auto [&_svg]:w-auto"),config:t,fullscreen:true,showControls:g})})]}),document.body):null]})};var ue=e=>{var s,a;let t=[],o=[],n=e.querySelectorAll("thead th");for(let l of n)t.push(((s=l.textContent)==null?void 0:s.trim())||"");let r=e.querySelectorAll("tbody tr");for(let l of r){let i=[],c=l.querySelectorAll("td");for(let d of c)i.push(((a=d.textContent)==null?void 0:a.trim())||"");o.push(i);}return {headers:t,rows:o}},oe=e=>{let{headers:t,rows:o}=e,n=l=>{let i=false,c=false;for(let d of l){if(d==='"'){i=true,c=true;break}(d===","||d===`
|
|
51279
51295
|
`)&&(i=true);}return i?c?`"${l.replace(/"/g,'""')}"`:`"${l}"`:l},r=t.length>0?o.length+1:o.length,s=new Array(r),a=0;t.length>0&&(s[a]=t.map(n).join(","),a+=1);for(let l of o)s[a]=l.map(n).join(","),a+=1;return s.join(`
|
|
51280
51296
|
`)},ct=e=>{let{headers:t,rows:o}=e,n=l=>{let i=false;for(let d of l)if(d===" "||d===`
|
|
51281
51297
|
`||d==="\r"){i=true;break}if(!i)return l;let c=[];for(let d of l)d===" "?c.push("\\t"):d===`
|
|
51282
51298
|
`?c.push("\\n"):d==="\r"?c.push("\\r"):c.push(d);return c.join("")},r=t.length>0?o.length+1:o.length,s=new Array(r),a=0;t.length>0&&(s[a]=t.map(n).join(" "),a+=1);for(let l of o)s[a]=l.map(n).join(" "),a+=1;return s.join(`
|
|
51283
51299
|
`)},Ve=e=>{let t=false;for(let n of e)if(n==="\\"||n==="|"){t=true;break}if(!t)return e;let o=[];for(let n of e)n==="\\"?o.push("\\\\"):n==="|"?o.push("\\|"):o.push(n);return o.join("")},ne=e=>{let{headers:t,rows:o}=e;if(t.length===0)return "";let n=new Array(o.length+2),r=0,s=t.map(l=>Ve(l));n[r]=`| ${s.join(" | ")} |`,r+=1;let a=new Array(t.length);for(let l=0;l<t.length;l+=1)a[l]="---";n[r]=`| ${a.join(" | ")} |`,r+=1;for(let l of o)if(l.length<t.length){let i=new Array(t.length);for(let c=0;c<t.length;c+=1)i[c]=c<l.length?Ve(l[c]):"";n[r]=`| ${i.join(" | ")} |`,r+=1;}else {let i=l.map(c=>Ve(c));n[r]=`| ${i.join(" | ")} |`,r+=1;}return n.join(`
|
|
51284
|
-
`)};var Te=({children:e,className:t,onCopy:o,onError:n,timeout:r=2e3})=>{let s=y(),[a,l]=React.useState(false),[i,c]=React.useState(false),d=React.useRef(null),u=React.useRef(0),{isAnimating:m}=React.useContext(R),p=B(),g=async f=>{var T,x;if(typeof window=="undefined"||!((T=navigator==null?void 0:navigator.clipboard)!=null&&T.write)){n==null||n(new Error("Clipboard API not available"));return}try{let w=(x=d.current)==null?void 0:x.closest('[data-streamdown="table-wrapper"]'),k=w==null?void 0:w.querySelector("table");if(!k){n==null||n(new Error("Table not found"));return}let I=ue(k),F=({csv:oe,tsv:ct,md:ne}[f]||ne)(I),z=new ClipboardItem({"text/plain":new Blob([F],{type:"text/plain"}),"text/html":new Blob([k.outerHTML],{type:"text/html"})});await navigator.clipboard.write([z]),c(!0),l(!1),o==null||o(f),u.current=window.setTimeout(()=>c(!1),r);}catch(w){n==null||n(w);}};React.useEffect(()=>{let f=T=>{let x=T.composedPath();d.current&&!x.includes(d.current)&&l(false);};return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f),window.clearTimeout(u.current);}},[]);let h=L(),b=i?h.CheckIcon:h.CopyIcon;return ReactJSXRuntime.jsxs("div",{className:s("relative"),ref:d,children:[ReactJSXRuntime.jsx("button",{className:s("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:m,onClick:()=>l(!a),title:p.copyTable,type:"button",children:e!=null?e:ReactJSXRuntime.jsx(b,{height:14,width:14})}),a?ReactJSXRuntime.jsxs("div",{className:s("absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[ReactJSXRuntime.jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("md"),title:p.copyTableAsMarkdown,type:"button",children:p.tableFormatMarkdown}),ReactJSXRuntime.jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("csv"),title:p.copyTableAsCsv,type:"button",children:p.tableFormatCsv}),ReactJSXRuntime.jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("tsv"),title:p.copyTableAsTsv,type:"button",children:p.tableFormatTsv})]}):null]})};var Pe=({children:e,className:t,onDownload:o,onError:n})=>{let r=y(),[s,a]=React.useState(false),l=React.useRef(null),{isAnimating:i}=React.useContext(R),c=B(),d=L(),u=m=>{var p;try{let g=(p=l.current)==null?void 0:p.closest('[data-streamdown="table-wrapper"]'),h=g==null?void 0:g.querySelector("table");if(!h){n==null||n(new Error("Table not found"));return}let b=ue(h),f=m==="csv"?oe(b):ne(b);J(`table.${m==="csv"?"csv":"md"}`,f,m==="csv"?"text/csv":"text/markdown"),a(!1),o==null||o(m);}catch(g){n==null||n(g);}};return React.useEffect(()=>{let m=p=>{let g=p.composedPath();l.current&&!g.includes(l.current)&&a(false);};return document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[]),ReactJSXRuntime.jsxs("div",{className:r("relative"),ref:l,children:[ReactJSXRuntime.jsx("button",{className:r("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:i,onClick:()=>a(!s),title:c.downloadTable,type:"button",children:e!=null?e:ReactJSXRuntime.jsx(d.DownloadIcon,{size:14})}),s?ReactJSXRuntime.jsxs("div",{className:r("absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[ReactJSXRuntime.jsx("button",{className:r("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>u("csv"),title:c.downloadTableAsCsv,type:"button",children:c.tableFormatCsv}),ReactJSXRuntime.jsx("button",{className:r("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>u("markdown"),title:c.downloadTableAsMarkdown,type:"button",children:c.tableFormatMarkdown})]}):null]})};var wo=({children:e,className:t,showCopy:o=true,showDownload:n=true})=>{let{Maximize2Icon:r,XIcon:s}=L(),a=y(),[l,i]=React.useState(false),{isAnimating:c}=React.useContext(R),d=B(),u=()=>{i(true);},m=()=>{i(false);};return React.useEffect(()=>{if(l){le();let p=g=>{g.key==="Escape"&&i(false);};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p),ce();}}},[l]),ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[ReactJSXRuntime.jsx("button",{className:a("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:c,onClick:u,title:d.viewFullscreen,type:"button",children:ReactJSXRuntime.jsx(r,{size:14})}),l?ReactDOM.createPortal(ReactJSXRuntime.jsx("div",{"aria-label":d.viewFullscreen,"aria-modal":"true",className:a("fixed inset-0 z-50 flex flex-col bg-background"),"data-streamdown":"table-fullscreen",onClick:m,onKeyDown:p=>{p.key==="Escape"&&m();},role:"dialog",children:ReactJSXRuntime.jsxs("div",{className:a("flex h-full flex-col"),onClick:p=>p.stopPropagation(),onKeyDown:p=>p.stopPropagation(),role:"presentation",children:[ReactJSXRuntime.jsxs("div",{className:a("flex items-center justify-end gap-1 p-4"),children:[o?ReactJSXRuntime.jsx(Te,{}):null,n?ReactJSXRuntime.jsx(Pe,{}):null,ReactJSXRuntime.jsx("button",{className:a("rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:m,title:d.exitFullscreen,type:"button",children:ReactJSXRuntime.jsx(s,{size:20})})]}),ReactJSXRuntime.jsx("div",{className:a("flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10"),children:ReactJSXRuntime.jsx("table",{className:a("w-full border-collapse border border-border"),"data-streamdown":"table",children:e})})]})}),document.body):null]})};var ko=({children:e,className:t,showControls:o,showCopy:n=true,showDownload:r=true,showFullscreen:s=true,...a})=>{let l=y(),i=o&&n,c=o&&r,d=o&&s,u=i||c||d;return ReactJSXRuntime.jsxs("div",{className:l("my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2"),"data-streamdown":"table-wrapper",children:[u?ReactJSXRuntime.jsxs("div",{className:l("flex items-center justify-end gap-1"),children:[i?ReactJSXRuntime.jsx(Te,{}):null,c?ReactJSXRuntime.jsx(Pe,{}):null,d?ReactJSXRuntime.jsx(wo,{showCopy:i,showDownload:c,children:e}):null]}):null,ReactJSXRuntime.jsx("div",{className:l("border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background"),children:ReactJSXRuntime.jsx("table",{className:l("w-full divide-y divide-border",t),"data-streamdown":"table",...a,children:e})})]})};var Gr=/startLine=(\d+)/,Yr=React.lazy(()=>Promise.resolve().then(function () { return require('./fthry_mermaid-O7DHMXV3.BODsiYW_.js'); }).then(e=>({default:e.Mermaid}))),Qr=/language-([^\s]+)/;function _e(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return true;if(!(e!=null&&e.position&&(t!=null&&t.position)))return false;let o=e.position.start,n=t.position.start,r=e.position.end,s=t.position.end;return (o==null?void 0:o.line)===(n==null?void 0:n.line)&&(o==null?void 0:o.column)===(n==null?void 0:n.column)&&(r==null?void 0:r.line)===(s==null?void 0:s.line)&&(r==null?void 0:r.column)===(s==null?void 0:s.column)}function E(e,t){return e.className===t.className&&_e(e.node,t.node)}var pt=(e,t)=>typeof e=="boolean"?e:e[t]!==false,ut=(e,t)=>{if(typeof e=="boolean")return e;let o=e.table;return o===false?false:o===true||o===void 0?true:o[t]!==false},xo=(e,t)=>{if(typeof e=="boolean")return e;let o=e.code;return o===false?false:o===true||o===void 0?true:o[t]!==false},je=(e,t)=>{if(typeof e=="boolean")return e;let o=e.mermaid;return o===false?false:o===true||o===void 0?true:o[t]!==false},gt=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("ol",{className:r("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...n,children:e})},(e,t)=>E(e,t));gt.displayName="MarkdownOl";var To=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("li",{className:r("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...n,children:e})},(e,t)=>e.className===t.className&&_e(e.node,t.node));To.displayName="MarkdownLi";var Po=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("ul",{className:r("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...n,children:e})},(e,t)=>E(e,t));Po.displayName="MarkdownUl";var Mo=React.memo(({className:e,node:t,...o})=>{let n=y();return ReactJSXRuntime.jsx("hr",{className:n("my-6 border-border",e),"data-streamdown":"horizontal-rule",...o})},(e,t)=>E(e,t));Mo.displayName="MarkdownHr";var Io=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("span",{className:r("font-semibold",t),"data-streamdown":"strong",...n,children:e})},(e,t)=>E(e,t));Io.displayName="MarkdownStrong";var es=({children:e,className:t,href:o,node:n,...r})=>{let s=y(),{linkSafety:a}=React.useContext(R),[l,i]=React.useState(false),c=o==="streamdown:incomplete-link",d=React.useCallback(async g=>{if(!(!(a!=null&&a.enabled&&o)||c)){if(g.preventDefault(),a.onLinkCheck&&await a.onLinkCheck(o)){window.open(o,"_blank","noreferrer");return}i(true);}},[a,o,c]),u=React.useCallback(()=>{o&&window.open(o,"_blank","noreferrer");},[o]),m=React.useCallback(()=>{i(false);},[]),p={url:o!=null?o:"",isOpen:l,onClose:m,onConfirm:u};return a!=null&&a.enabled&&o?ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[ReactJSXRuntime.jsx("button",{className:s("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":c,"data-streamdown":"link",onClick:d,type:"button",children:e}),a.renderModal?a.renderModal(p):ReactJSXRuntime.jsx(ro,{...p})]}):ReactJSXRuntime.jsx("a",{className:s("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":c,"data-streamdown":"link",href:o,rel:"noreferrer",target:"_blank",...r,children:e})},No=React.memo(es,(e,t)=>E(e,t)&&e.href===t.href);No.displayName="MarkdownA";var Lo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h1",{className:r("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...n,children:e})},(e,t)=>E(e,t));Lo.displayName="MarkdownH1";var Ro=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h2",{className:r("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...n,children:e})},(e,t)=>E(e,t));Ro.displayName="MarkdownH2";var So=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h3",{className:r("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...n,children:e})},(e,t)=>E(e,t));So.displayName="MarkdownH3";var Eo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h4",{className:r("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...n,children:e})},(e,t)=>E(e,t));Eo.displayName="MarkdownH4";var Ho=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h5",{className:r("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...n,children:e})},(e,t)=>E(e,t));Ho.displayName="MarkdownH5";var Do=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h6",{className:r("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...n,children:e})},(e,t)=>E(e,t));Do.displayName="MarkdownH6";var Bo=React.memo(({children:e,className:t,node:o,...n})=>{let{controls:r}=React.useContext(R),s=pt(r,"table"),a=ut(r,"copy"),l=ut(r,"download"),i=ut(r,"fullscreen");return ReactJSXRuntime.jsx(ko,{className:t,showControls:s,showCopy:a,showDownload:l,showFullscreen:i,...n,children:e})},(e,t)=>E(e,t));Bo.displayName="MarkdownTable";var Ao=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("thead",{className:r("bg-muted/80",t),"data-streamdown":"table-header",...n,children:e})},(e,t)=>E(e,t));Ao.displayName="MarkdownThead";var Oo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("tbody",{className:r("divide-y divide-border",t),"data-streamdown":"table-body",...n,children:e})},(e,t)=>E(e,t));Oo.displayName="MarkdownTbody";var Vo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("tr",{className:r("border-border",t),"data-streamdown":"table-row",...n,children:e})},(e,t)=>E(e,t));Vo.displayName="MarkdownTr";var jo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("th",{className:r("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...n,children:e})},(e,t)=>E(e,t));jo.displayName="MarkdownTh";var Fo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("td",{className:r("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...n,children:e})},(e,t)=>E(e,t));Fo.displayName="MarkdownTd";var zo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("blockquote",{className:r("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...n,children:e})},(e,t)=>E(e,t));zo.displayName="MarkdownBlockquote";var _o=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("sup",{className:r("text-sm",t),"data-streamdown":"superscript",...n,children:e})},(e,t)=>E(e,t));_o.displayName="MarkdownSup";var qo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("sub",{className:r("text-sm",t),"data-streamdown":"subscript",...n,children:e})},(e,t)=>E(e,t));qo.displayName="MarkdownSub";var $o=React.memo(({children:e,className:t,node:o,...n})=>{if("data-footnotes"in n){let s=i=>{var m,p;if(!React.isValidElement(i))return false;let c=Array.isArray(i.props.children)?i.props.children:[i.props.children],d=false,u=false;for(let g of c)if(g){if(typeof g=="string")g.trim()!==""&&(d=true);else if(React.isValidElement(g))if(((m=g.props)==null?void 0:m["data-footnote-backref"])!==void 0)u=true;else {let h=Array.isArray(g.props.children)?g.props.children:[g.props.children];for(let b of h){if(typeof b=="string"&&b.trim()!==""){d=true;break}if(React.isValidElement(b)&&((p=b.props)==null?void 0:p["data-footnote-backref"])===void 0){d=true;break}}}}return u&&!d},a=Array.isArray(e)?e.map(i=>{if(!React.isValidElement(i))return i;if(i.type===gt){let d=(Array.isArray(i.props.children)?i.props.children:[i.props.children]).filter(u=>!s(u));return d.length===0?null:{...i,props:{...i.props,children:d}}}return i}):e;return (Array.isArray(a)?a.some(i=>i!==null):a!==null)?ReactJSXRuntime.jsx("section",{className:t,...n,children:a}):null}return ReactJSXRuntime.jsx("section",{className:t,...n,children:e})},(e,t)=>E(e,t));$o.displayName="MarkdownSection";var ts=({node:e,className:t,children:o,...n})=>{var k,I;let r=y(),s=!("data-block"in n),{mermaid:a,controls:l}=React.useContext(R),i=de(),c=et(),d=t==null?void 0:t.match(Qr),u=(k=d==null?void 0:d.at(1))!=null?k:"",m=so(u);if(s)return ReactJSXRuntime.jsx("code",{className:r("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...n,children:o});let p=(I=e==null?void 0:e.properties)==null?void 0:I.metastring,g=p==null?void 0:p.match(Gr),h=g?Number.parseInt(g[1],10):void 0,b=h!==void 0&&h>=1?h:void 0,f="";if(React.isValidElement(o)&&o.props&&typeof o.props=="object"&&"children"in o.props&&typeof o.props.children=="string"?f=o.props.children:typeof o=="string"&&(f=o),m){let H=m.component;return ReactJSXRuntime.jsx(React.Suspense,{fallback:ReactJSXRuntime.jsx(Ae,{}),children:ReactJSXRuntime.jsx(H,{code:f,isIncomplete:c,language:u})})}if(u==="mermaid"&&i){let H=pt(l,"mermaid"),S=je(l,"download"),F=je(l,"copy"),z=je(l,"fullscreen"),q=je(l,"panZoom"),A=H&&(S||F||z);return ReactJSXRuntime.jsx(React.Suspense,{fallback:ReactJSXRuntime.jsx(Ae,{}),children:ReactJSXRuntime.jsxs("div",{className:r("group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",t),"data-streamdown":"mermaid-block",children:[ReactJSXRuntime.jsx("div",{className:r("flex h-8 items-center text-muted-foreground text-xs"),children:ReactJSXRuntime.jsx("span",{className:r("ml-1 font-mono lowercase"),children:"mermaid"})}),A?ReactJSXRuntime.jsx("div",{className:r("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:ReactJSXRuntime.jsxs("div",{className:r("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),"data-streamdown":"mermaid-block-actions",children:[S?ReactJSXRuntime.jsx(lo,{chart:f,config:a==null?void 0:a.config}):null,F?ReactJSXRuntime.jsx(Be,{code:f}):null,z?ReactJSXRuntime.jsx(po,{chart:f,config:a==null?void 0:a.config}):null]})}):null,ReactJSXRuntime.jsx("div",{className:r("rounded-md border border-border bg-background"),children:ReactJSXRuntime.jsx(Yr,{chart:f,config:a==null?void 0:a.config,showControls:q})})]})})}let T=pt(l,"code"),x=xo(l,"download"),w=xo(l,"copy");return ReactJSXRuntime.jsx(rt,{className:t,code:f,isIncomplete:c,language:u,startLine:b,children:T?ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[x?ReactJSXRuntime.jsx(at,{code:f,language:u}):null,w?ReactJSXRuntime.jsx(Be,{}):null]}):null})},Wo=React.memo(ts,(e,t)=>e.className===t.className&&_e(e.node,t.node));Wo.displayName="MarkdownCode";var Zo=React.memo(to,(e,t)=>e.className===t.className&&_e(e.node,t.node));Zo.displayName="MarkdownImg";var Xo=React.memo(({children:e,node:t,...o})=>{let r=(Array.isArray(e)?e:[e]).filter(s=>s!=null&&s!=="");if(r.length===1&&React.isValidElement(r[0])){let s=r[0].props.node,a=s==null?void 0:s.tagName;if(a==="img")return ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment,{children:e});if(a==="code"&&"data-block"in r[0].props)return ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment,{children:e})}return ReactJSXRuntime.jsx("p",{...o,children:e})},(e,t)=>E(e,t));Xo.displayName="MarkdownParagraph";var Jo={ol:gt,li:To,ul:Po,hr:Mo,strong:Io,a:No,h1:Lo,h2:Ro,h3:So,h4:Eo,h5:Ho,h6:Do,table:Bo,thead:Ao,tbody:Oo,tr:Vo,th:jo,td:Fo,blockquote:zo,code:Wo,img:Zo,pre:({children:e})=>React.isValidElement(e)?React.cloneElement(e,{"data-block":"true"}):e,sup:_o,sub:qo,p:Xo,section:$o};var os=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,ns=/\p{L}/u;function qe(e){let t=e.replace(/^#{1,6}\s+/gm,"").replace(/(\*{1,3}|_{1,3})/g,"").replace(/`[^`]*`/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^[\s>*\-+\d.]+/gm,"");for(let o of t){if(os.test(o))return "rtl";if(ns.test(o))return "ltr"}return "ltr"}var rs=/^[ \t]{0,3}(`{3,}|~{3,})/,ss=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,bt=e=>{let t=e.split(`
|
|
51300
|
+
`)};var Te=({children:e,className:t,onCopy:o,onError:n,timeout:r=2e3})=>{let s=y(),[a,l]=React.useState(false),[i,c]=React.useState(false),d=React.useRef(null),u=React.useRef(0),{isAnimating:m}=React.useContext(R),p=B(),g=async f=>{var T,x;if(typeof window=="undefined"||!((T=navigator==null?void 0:navigator.clipboard)!=null&&T.write)){n==null||n(new Error("Clipboard API not available"));return}try{let w=(x=d.current)==null?void 0:x.closest('[data-streamdown="table-wrapper"]'),k=w==null?void 0:w.querySelector("table");if(!k){n==null||n(new Error("Table not found"));return}let I=ue(k),F=({csv:oe,tsv:ct,md:ne}[f]||ne)(I),z=new ClipboardItem({"text/plain":new Blob([F],{type:"text/plain"}),"text/html":new Blob([k.outerHTML],{type:"text/html"})});await navigator.clipboard.write([z]),c(!0),l(!1),o==null||o(f),u.current=window.setTimeout(()=>c(!1),r);}catch(w){n==null||n(w);}};React.useEffect(()=>{let f=T=>{let x=T.composedPath();d.current&&!x.includes(d.current)&&l(false);};return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f),window.clearTimeout(u.current);}},[]);let h=L(),b=i?h.CheckIcon:h.CopyIcon;return ReactJSXRuntime.jsxs("div",{className:s("relative"),ref:d,children:[ReactJSXRuntime.jsx("button",{className:s("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:m,onClick:()=>l(!a),title:p.copyTable,type:"button",children:e!=null?e:ReactJSXRuntime.jsx(b,{height:14,width:14})}),a?ReactJSXRuntime.jsxs("div",{className:s("absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[ReactJSXRuntime.jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("md"),title:p.copyTableAsMarkdown,type:"button",children:p.tableFormatMarkdown}),ReactJSXRuntime.jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("csv"),title:p.copyTableAsCsv,type:"button",children:p.tableFormatCsv}),ReactJSXRuntime.jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("tsv"),title:p.copyTableAsTsv,type:"button",children:p.tableFormatTsv})]}):null]})};var Pe=({children:e,className:t,onDownload:o,onError:n})=>{let r=y(),[s,a]=React.useState(false),l=React.useRef(null),{isAnimating:i}=React.useContext(R),c=B(),d=L(),u=m=>{var p;try{let g=(p=l.current)==null?void 0:p.closest('[data-streamdown="table-wrapper"]'),h=g==null?void 0:g.querySelector("table");if(!h){n==null||n(new Error("Table not found"));return}let b=ue(h),f=m==="csv"?oe(b):ne(b);J(`table.${m==="csv"?"csv":"md"}`,f,m==="csv"?"text/csv":"text/markdown"),a(!1),o==null||o(m);}catch(g){n==null||n(g);}};return React.useEffect(()=>{let m=p=>{let g=p.composedPath();l.current&&!g.includes(l.current)&&a(false);};return document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[]),ReactJSXRuntime.jsxs("div",{className:r("relative"),ref:l,children:[ReactJSXRuntime.jsx("button",{className:r("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:i,onClick:()=>a(!s),title:c.downloadTable,type:"button",children:e!=null?e:ReactJSXRuntime.jsx(d.DownloadIcon,{size:14})}),s?ReactJSXRuntime.jsxs("div",{className:r("absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[ReactJSXRuntime.jsx("button",{className:r("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>u("csv"),title:c.downloadTableAsCsv,type:"button",children:c.tableFormatCsv}),ReactJSXRuntime.jsx("button",{className:r("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>u("markdown"),title:c.downloadTableAsMarkdown,type:"button",children:c.tableFormatMarkdown})]}):null]})};var wo=({children:e,className:t,showCopy:o=true,showDownload:n=true})=>{let{Maximize2Icon:r,XIcon:s}=L(),a=y(),[l,i]=React.useState(false),{isAnimating:c}=React.useContext(R),d=B(),u=()=>{i(true);},m=()=>{i(false);};return React.useEffect(()=>{if(l){le();let p=g=>{g.key==="Escape"&&i(false);};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p),ce();}}},[l]),ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[ReactJSXRuntime.jsx("button",{className:a("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:c,onClick:u,title:d.viewFullscreen,type:"button",children:ReactJSXRuntime.jsx(r,{size:14})}),l?ReactDOM.createPortal(ReactJSXRuntime.jsx("div",{"aria-label":d.viewFullscreen,"aria-modal":"true",className:a("fixed inset-0 z-50 flex flex-col bg-background"),"data-streamdown":"table-fullscreen",onClick:m,onKeyDown:p=>{p.key==="Escape"&&m();},role:"dialog",children:ReactJSXRuntime.jsxs("div",{className:a("flex h-full flex-col"),onClick:p=>p.stopPropagation(),onKeyDown:p=>p.stopPropagation(),role:"presentation",children:[ReactJSXRuntime.jsxs("div",{className:a("flex items-center justify-end gap-1 p-4"),children:[o?ReactJSXRuntime.jsx(Te,{}):null,n?ReactJSXRuntime.jsx(Pe,{}):null,ReactJSXRuntime.jsx("button",{className:a("rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:m,title:d.exitFullscreen,type:"button",children:ReactJSXRuntime.jsx(s,{size:20})})]}),ReactJSXRuntime.jsx("div",{className:a("flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10"),children:ReactJSXRuntime.jsx("table",{className:a("w-full border-collapse border border-border"),"data-streamdown":"table",children:e})})]})}),document.body):null]})};var ko=({children:e,className:t,showControls:o,showCopy:n=true,showDownload:r=true,showFullscreen:s=true,...a})=>{let l=y(),i=o&&n,c=o&&r,d=o&&s,u=i||c||d;return ReactJSXRuntime.jsxs("div",{className:l("my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2"),"data-streamdown":"table-wrapper",children:[u?ReactJSXRuntime.jsxs("div",{className:l("flex items-center justify-end gap-1"),children:[i?ReactJSXRuntime.jsx(Te,{}):null,c?ReactJSXRuntime.jsx(Pe,{}):null,d?ReactJSXRuntime.jsx(wo,{showCopy:i,showDownload:c,children:e}):null]}):null,ReactJSXRuntime.jsx("div",{className:l("border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background"),children:ReactJSXRuntime.jsx("table",{className:l("w-full divide-y divide-border",t),"data-streamdown":"table",...a,children:e})})]})};var Gr=/startLine=(\d+)/,Yr=React.lazy(()=>Promise.resolve().then(function () { return require('./fthry_mermaid-O7DHMXV3.OED8wUgR.js'); }).then(e=>({default:e.Mermaid}))),Qr=/language-([^\s]+)/;function _e(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return true;if(!(e!=null&&e.position&&(t!=null&&t.position)))return false;let o=e.position.start,n=t.position.start,r=e.position.end,s=t.position.end;return (o==null?void 0:o.line)===(n==null?void 0:n.line)&&(o==null?void 0:o.column)===(n==null?void 0:n.column)&&(r==null?void 0:r.line)===(s==null?void 0:s.line)&&(r==null?void 0:r.column)===(s==null?void 0:s.column)}function E(e,t){return e.className===t.className&&_e(e.node,t.node)}var pt=(e,t)=>typeof e=="boolean"?e:e[t]!==false,ut=(e,t)=>{if(typeof e=="boolean")return e;let o=e.table;return o===false?false:o===true||o===void 0?true:o[t]!==false},xo=(e,t)=>{if(typeof e=="boolean")return e;let o=e.code;return o===false?false:o===true||o===void 0?true:o[t]!==false},je=(e,t)=>{if(typeof e=="boolean")return e;let o=e.mermaid;return o===false?false:o===true||o===void 0?true:o[t]!==false},gt=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("ol",{className:r("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...n,children:e})},(e,t)=>E(e,t));gt.displayName="MarkdownOl";var To=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("li",{className:r("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...n,children:e})},(e,t)=>e.className===t.className&&_e(e.node,t.node));To.displayName="MarkdownLi";var Po=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("ul",{className:r("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...n,children:e})},(e,t)=>E(e,t));Po.displayName="MarkdownUl";var Mo=React.memo(({className:e,node:t,...o})=>{let n=y();return ReactJSXRuntime.jsx("hr",{className:n("my-6 border-border",e),"data-streamdown":"horizontal-rule",...o})},(e,t)=>E(e,t));Mo.displayName="MarkdownHr";var Io=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("span",{className:r("font-semibold",t),"data-streamdown":"strong",...n,children:e})},(e,t)=>E(e,t));Io.displayName="MarkdownStrong";var es=({children:e,className:t,href:o,node:n,...r})=>{let s=y(),{linkSafety:a}=React.useContext(R),[l,i]=React.useState(false),c=o==="streamdown:incomplete-link",d=React.useCallback(async g=>{if(!(!(a!=null&&a.enabled&&o)||c)){if(g.preventDefault(),a.onLinkCheck&&await a.onLinkCheck(o)){window.open(o,"_blank","noreferrer");return}i(true);}},[a,o,c]),u=React.useCallback(()=>{o&&window.open(o,"_blank","noreferrer");},[o]),m=React.useCallback(()=>{i(false);},[]),p={url:o!=null?o:"",isOpen:l,onClose:m,onConfirm:u};return a!=null&&a.enabled&&o?ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[ReactJSXRuntime.jsx("button",{className:s("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":c,"data-streamdown":"link",onClick:d,type:"button",children:e}),a.renderModal?a.renderModal(p):ReactJSXRuntime.jsx(ro,{...p})]}):ReactJSXRuntime.jsx("a",{className:s("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":c,"data-streamdown":"link",href:o,rel:"noreferrer",target:"_blank",...r,children:e})},No=React.memo(es,(e,t)=>E(e,t)&&e.href===t.href);No.displayName="MarkdownA";var Lo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h1",{className:r("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...n,children:e})},(e,t)=>E(e,t));Lo.displayName="MarkdownH1";var Ro=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h2",{className:r("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...n,children:e})},(e,t)=>E(e,t));Ro.displayName="MarkdownH2";var So=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h3",{className:r("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...n,children:e})},(e,t)=>E(e,t));So.displayName="MarkdownH3";var Eo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h4",{className:r("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...n,children:e})},(e,t)=>E(e,t));Eo.displayName="MarkdownH4";var Ho=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h5",{className:r("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...n,children:e})},(e,t)=>E(e,t));Ho.displayName="MarkdownH5";var Do=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("h6",{className:r("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...n,children:e})},(e,t)=>E(e,t));Do.displayName="MarkdownH6";var Bo=React.memo(({children:e,className:t,node:o,...n})=>{let{controls:r}=React.useContext(R),s=pt(r,"table"),a=ut(r,"copy"),l=ut(r,"download"),i=ut(r,"fullscreen");return ReactJSXRuntime.jsx(ko,{className:t,showControls:s,showCopy:a,showDownload:l,showFullscreen:i,...n,children:e})},(e,t)=>E(e,t));Bo.displayName="MarkdownTable";var Ao=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("thead",{className:r("bg-muted/80",t),"data-streamdown":"table-header",...n,children:e})},(e,t)=>E(e,t));Ao.displayName="MarkdownThead";var Oo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("tbody",{className:r("divide-y divide-border",t),"data-streamdown":"table-body",...n,children:e})},(e,t)=>E(e,t));Oo.displayName="MarkdownTbody";var Vo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("tr",{className:r("border-border",t),"data-streamdown":"table-row",...n,children:e})},(e,t)=>E(e,t));Vo.displayName="MarkdownTr";var jo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("th",{className:r("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...n,children:e})},(e,t)=>E(e,t));jo.displayName="MarkdownTh";var Fo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("td",{className:r("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...n,children:e})},(e,t)=>E(e,t));Fo.displayName="MarkdownTd";var zo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("blockquote",{className:r("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...n,children:e})},(e,t)=>E(e,t));zo.displayName="MarkdownBlockquote";var _o=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("sup",{className:r("text-sm",t),"data-streamdown":"superscript",...n,children:e})},(e,t)=>E(e,t));_o.displayName="MarkdownSup";var qo=React.memo(({children:e,className:t,node:o,...n})=>{let r=y();return ReactJSXRuntime.jsx("sub",{className:r("text-sm",t),"data-streamdown":"subscript",...n,children:e})},(e,t)=>E(e,t));qo.displayName="MarkdownSub";var $o=React.memo(({children:e,className:t,node:o,...n})=>{if("data-footnotes"in n){let s=i=>{var m,p;if(!React.isValidElement(i))return false;let c=Array.isArray(i.props.children)?i.props.children:[i.props.children],d=false,u=false;for(let g of c)if(g){if(typeof g=="string")g.trim()!==""&&(d=true);else if(React.isValidElement(g))if(((m=g.props)==null?void 0:m["data-footnote-backref"])!==void 0)u=true;else {let h=Array.isArray(g.props.children)?g.props.children:[g.props.children];for(let b of h){if(typeof b=="string"&&b.trim()!==""){d=true;break}if(React.isValidElement(b)&&((p=b.props)==null?void 0:p["data-footnote-backref"])===void 0){d=true;break}}}}return u&&!d},a=Array.isArray(e)?e.map(i=>{if(!React.isValidElement(i))return i;if(i.type===gt){let d=(Array.isArray(i.props.children)?i.props.children:[i.props.children]).filter(u=>!s(u));return d.length===0?null:{...i,props:{...i.props,children:d}}}return i}):e;return (Array.isArray(a)?a.some(i=>i!==null):a!==null)?ReactJSXRuntime.jsx("section",{className:t,...n,children:a}):null}return ReactJSXRuntime.jsx("section",{className:t,...n,children:e})},(e,t)=>E(e,t));$o.displayName="MarkdownSection";var ts=({node:e,className:t,children:o,...n})=>{var k,I;let r=y(),s=!("data-block"in n),{mermaid:a,controls:l}=React.useContext(R),i=de(),c=et(),d=t==null?void 0:t.match(Qr),u=(k=d==null?void 0:d.at(1))!=null?k:"",m=so(u);if(s)return ReactJSXRuntime.jsx("code",{className:r("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...n,children:o});let p=(I=e==null?void 0:e.properties)==null?void 0:I.metastring,g=p==null?void 0:p.match(Gr),h=g?Number.parseInt(g[1],10):void 0,b=h!==void 0&&h>=1?h:void 0,f="";if(React.isValidElement(o)&&o.props&&typeof o.props=="object"&&"children"in o.props&&typeof o.props.children=="string"?f=o.props.children:typeof o=="string"&&(f=o),m){let H=m.component;return ReactJSXRuntime.jsx(React.Suspense,{fallback:ReactJSXRuntime.jsx(Ae,{}),children:ReactJSXRuntime.jsx(H,{code:f,isIncomplete:c,language:u})})}if(u==="mermaid"&&i){let H=pt(l,"mermaid"),S=je(l,"download"),F=je(l,"copy"),z=je(l,"fullscreen"),q=je(l,"panZoom"),A=H&&(S||F||z);return ReactJSXRuntime.jsx(React.Suspense,{fallback:ReactJSXRuntime.jsx(Ae,{}),children:ReactJSXRuntime.jsxs("div",{className:r("group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",t),"data-streamdown":"mermaid-block",children:[ReactJSXRuntime.jsx("div",{className:r("flex h-8 items-center text-muted-foreground text-xs"),children:ReactJSXRuntime.jsx("span",{className:r("ml-1 font-mono lowercase"),children:"mermaid"})}),A?ReactJSXRuntime.jsx("div",{className:r("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:ReactJSXRuntime.jsxs("div",{className:r("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),"data-streamdown":"mermaid-block-actions",children:[S?ReactJSXRuntime.jsx(lo,{chart:f,config:a==null?void 0:a.config}):null,F?ReactJSXRuntime.jsx(Be,{code:f}):null,z?ReactJSXRuntime.jsx(po,{chart:f,config:a==null?void 0:a.config}):null]})}):null,ReactJSXRuntime.jsx("div",{className:r("rounded-md border border-border bg-background"),children:ReactJSXRuntime.jsx(Yr,{chart:f,config:a==null?void 0:a.config,showControls:q})})]})})}let T=pt(l,"code"),x=xo(l,"download"),w=xo(l,"copy");return ReactJSXRuntime.jsx(rt,{className:t,code:f,isIncomplete:c,language:u,startLine:b,children:T?ReactJSXRuntime.jsxs(ReactJSXRuntime.Fragment,{children:[x?ReactJSXRuntime.jsx(at,{code:f,language:u}):null,w?ReactJSXRuntime.jsx(Be,{}):null]}):null})},Wo=React.memo(ts,(e,t)=>e.className===t.className&&_e(e.node,t.node));Wo.displayName="MarkdownCode";var Zo=React.memo(to,(e,t)=>e.className===t.className&&_e(e.node,t.node));Zo.displayName="MarkdownImg";var Xo=React.memo(({children:e,node:t,...o})=>{let r=(Array.isArray(e)?e:[e]).filter(s=>s!=null&&s!=="");if(r.length===1&&React.isValidElement(r[0])){let s=r[0].props.node,a=s==null?void 0:s.tagName;if(a==="img")return ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment,{children:e});if(a==="code"&&"data-block"in r[0].props)return ReactJSXRuntime.jsx(ReactJSXRuntime.Fragment,{children:e})}return ReactJSXRuntime.jsx("p",{...o,children:e})},(e,t)=>E(e,t));Xo.displayName="MarkdownParagraph";var Jo={ol:gt,li:To,ul:Po,hr:Mo,strong:Io,a:No,h1:Lo,h2:Ro,h3:So,h4:Eo,h5:Ho,h6:Do,table:Bo,thead:Ao,tbody:Oo,tr:Vo,th:jo,td:Fo,blockquote:zo,code:Wo,img:Zo,pre:({children:e})=>React.isValidElement(e)?React.cloneElement(e,{"data-block":"true"}):e,sup:_o,sub:qo,p:Xo,section:$o};var os=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,ns=/\p{L}/u;function qe(e){let t=e.replace(/^#{1,6}\s+/gm,"").replace(/(\*{1,3}|_{1,3})/g,"").replace(/`[^`]*`/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^[\s>*\-+\d.]+/gm,"");for(let o of t){if(os.test(o))return "rtl";if(ns.test(o))return "ltr"}return "ltr"}var rs=/^[ \t]{0,3}(`{3,}|~{3,})/,ss=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,bt=e=>{let t=e.split(`
|
|
51285
51301
|
`),o=null,n=0;for(let r of t){let s=rs.exec(r);if(o===null){if(s){let a=s[1];o=a[0],n=a.length;}}else if(s){let a=s[1],l=a[0],i=a.length;l===o&&i>=n&&(o=null,n=0);}}return o!==null},Ko=e=>{let t=e.split(`
|
|
51286
51302
|
`);for(let o of t){let n=o.trim();if(n.length>0&&n.includes("|")&&ss.test(n))return true}return false};var Uo=()=>e=>{visit(e,"html",(t,o,n)=>{!n||typeof o!="number"||(n.children[o]={type:"text",value:t.value});});};var Yo=[],Qo={allowDangerousHtml:true},$e=new WeakMap,yt=class{constructor(){this.cache=new Map;this.keyCache=new WeakMap;this.maxSize=100;}generateCacheKey(t){let o=this.keyCache.get(t);if(o)return o;let n=t.rehypePlugins,r=t.remarkPlugins,s=t.remarkRehypeOptions;if(!(n||r||s)){let u="default";return this.keyCache.set(t,u),u}let a=u=>{if(!u||u.length===0)return "";let m="";for(let p=0;p<u.length;p+=1){let g=u[p];if(p>0&&(m+=","),Array.isArray(g)){let[h,b]=g;if(typeof h=="function"){let f=$e.get(h);f||(f=h.name,$e.set(h,f)),m+=f;}else m+=String(h);m+=":",m+=JSON.stringify(b);}else if(typeof g=="function"){let h=$e.get(g);h||(h=g.name,$e.set(g,h)),m+=h;}else m+=String(g);}return m},l=a(n),i=a(r),c=s?JSON.stringify(s):"",d=`${i}::${l}::${c}`;return this.keyCache.set(t,d),d}get(t){let o=this.generateCacheKey(t),n=this.cache.get(o);return n&&(this.cache.delete(o),this.cache.set(o,n)),n}set(t,o){let n=this.generateCacheKey(t);if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;r&&this.cache.delete(r);}this.cache.set(n,o);}clear(){this.cache.clear();}},en=new yt,wt=e=>{let t=gs(e),o=e.children||"",n=t.runSync(t.parse(o),o);return ks(n,e)},gs=e=>{let t=en.get(e);if(t)return t;let o=hs(e);return en.set(e,o),o},bs=e=>e.some(t=>Array.isArray(t)?t[0]===rehypeRaw:t===rehypeRaw),hs=e=>{let t=e.rehypePlugins||Yo,o=e.remarkPlugins||Yo,n=bs(t)?o:[...o,Uo],r=e.remarkRehypeOptions?{...Qo,...e.remarkRehypeOptions}:Qo;return unified().use(remarkParse).use(n).use(remarkRehype,r).use(t)},tn=e=>e,ys=(e,t,o,n)=>{o?e.children.splice(t,1):e.children[t]={type:"text",value:n};},ws=(e,t)=>{var o;for(let n in urlAttributes)if(Object.hasOwn(urlAttributes,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],s=urlAttributes[n];(s===null||s.includes(e.tagName))&&(e.properties[n]=(o=t(String(r||""),n,e))!=null?o:void 0);}},Cs=(e,t,o,n,r,s)=>{let a=false;return n?a=!n.includes(e.tagName):r&&(a=r.includes(e.tagName)),!a&&s&&typeof t=="number"&&(a=!s(e,t,o)),a},ks=(e,t)=>{let{allowElement:o,allowedElements:n,disallowedElements:r,skipHtml:s,unwrapDisallowed:a,urlTransform:l}=t;if(o||n||r||s||l){let c=l||tn;visit(e,(d,u,m)=>{if(d.type==="raw"&&m&&typeof u=="number")return ys(m,u,s,d.value),u;if(d.type==="element"&&(ws(d,c),Cs(d,u,m,n,r,o)&&m&&typeof u=="number"))return a&&d.children?m.children.splice(u,1,...d.children):m.children.splice(u,1),u});}return toJsxRuntime(e,{Fragment:ReactJSXRuntime.Fragment,components:t.components,ignoreInvalidStyle:true,jsx:ReactJSXRuntime.jsx,jsxs:ReactJSXRuntime.jsxs,passKeys:true,passNode:true})};var xs=/\[\^[\w-]{1,200}\](?!:)/,Ts=/\[\^[\w-]{1,200}\]:/;var Ps=/<(\w+)[\s>]/,Ms=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),on=new Map,nn=new Map,Is=e=>{let t=e.toLowerCase(),o=on.get(t);if(o)return o;let n=new RegExp(`<${t}(?=[\\s>/])[^>]*>`,"gi");return on.set(t,n),n},Ns=e=>{let t=e.toLowerCase(),o=nn.get(t);if(o)return o;let n=new RegExp(`</${t}(?=[\\s>])[^>]*>`,"gi");return nn.set(t,n),n},rn=(e,t)=>{if(Ms.has(t.toLowerCase()))return 0;let o=e.match(Is(t));if(!o)return 0;let n=0;for(let r of o)r.trimEnd().endsWith("/>")||(n+=1);return n},sn=(e,t)=>{let o=e.match(Ns(t));return o?o.length:0},Ls=e=>{let t=0;for(let o=0;o<e.length-1;o+=1)e[o]==="$"&&e[o+1]==="$"&&(t+=1,o+=1);return t},Ct=e=>{let t=xs.test(e),o=Ts.test(e);if(t||o)return [e];let n=x.lex(e,{gfm:true}),r=[],s=[],a=false;for(let l of n){let i=l.raw,c=r.length;if(s.length>0){r[c-1]+=i;let d=s.at(-1),u=rn(i,d),m=sn(i,d);for(let p=0;p<u;p+=1)s.push(d);for(let p=0;p<m;p+=1)s.length>0&&s.at(-1)===d&&s.pop();continue}if(l.type==="html"&&l.block){let d=i.match(Ps);if(d){let u=d[1],m=rn(i,u),p=sn(i,u);m>p&&s.push(u);}}if(c>0&&!a){let d=r[c-1];if(Ls(d)%2===1){r[c-1]=d+i;continue}}r.push(i),l.type!=="space"&&(a=l.type==="code");}return r};var an=(e,t)=>{if(!t.length)return e;let o=e;for(let n of t){let r=new RegExp(`(<${n}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${n}\\s*>)`,"gi");o=o.replace(r,(s,a,l,i)=>{let c=l.replace(/\n\n/g,`
|
|
51287
51303
|
<!---->
|
|
@@ -51377,10 +51393,33 @@ var deleteThread = function (baseUrl, headers, threadId) { return index$1.__awai
|
|
|
51377
51393
|
return [2 /*return*/];
|
|
51378
51394
|
}
|
|
51379
51395
|
});
|
|
51380
|
-
}); };
|
|
51396
|
+
}); };
|
|
51397
|
+
|
|
51398
|
+
var snapshotInlineErrors = function (state) {
|
|
51399
|
+
var e_1, _a;
|
|
51400
|
+
var _b, _c;
|
|
51401
|
+
var out = {};
|
|
51402
|
+
var inlineErrors = (_b = state === null || state === void 0 ? void 0 : state.inlineErrors) !== null && _b !== void 0 ? _b : {};
|
|
51403
|
+
try {
|
|
51404
|
+
for (var _d = index$1.__values(Object.keys(inlineErrors)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
51405
|
+
var key = _e.value;
|
|
51406
|
+
var message = (_c = inlineErrors[key]) === null || _c === void 0 ? void 0 : _c.message;
|
|
51407
|
+
if (typeof message === 'string' && message.length > 0)
|
|
51408
|
+
out[key] = message;
|
|
51409
|
+
}
|
|
51410
|
+
}
|
|
51411
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
51412
|
+
finally {
|
|
51413
|
+
try {
|
|
51414
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
51415
|
+
}
|
|
51416
|
+
finally { if (e_1) throw e_1.error; }
|
|
51417
|
+
}
|
|
51418
|
+
return out;
|
|
51419
|
+
};
|
|
51381
51420
|
// Subgrids whose position is a strict prefix of `position` (callers pre-filter to those whose handler does anything), innermost first.
|
|
51382
51421
|
var findClickableAncestorSubgrids = function (subgrids, position) {
|
|
51383
|
-
var
|
|
51422
|
+
var e_2, _a;
|
|
51384
51423
|
if (!Array.isArray(subgrids) ||
|
|
51385
51424
|
!Array.isArray(position) ||
|
|
51386
51425
|
position.length === 0)
|
|
@@ -51404,15 +51443,122 @@ var findClickableAncestorSubgrids = function (subgrids, position) {
|
|
|
51404
51443
|
matches.push(sg);
|
|
51405
51444
|
}
|
|
51406
51445
|
}
|
|
51407
|
-
catch (
|
|
51446
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
51408
51447
|
finally {
|
|
51409
51448
|
try {
|
|
51410
51449
|
if (subgrids_1_1 && !subgrids_1_1.done && (_a = subgrids_1.return)) _a.call(subgrids_1);
|
|
51411
51450
|
}
|
|
51412
|
-
finally { if (
|
|
51451
|
+
finally { if (e_2) throw e_2.error; }
|
|
51413
51452
|
}
|
|
51414
51453
|
matches.sort(function (a, b) { return b.position.length - a.position.length; });
|
|
51415
51454
|
return matches;
|
|
51455
|
+
};
|
|
51456
|
+
function validateRepeatIndex(repeatIndex, inRepeat, rowCount, id) {
|
|
51457
|
+
if (!inRepeat) {
|
|
51458
|
+
if (typeof repeatIndex === 'number') {
|
|
51459
|
+
return {
|
|
51460
|
+
errorType: 'repeated_index_unexpected',
|
|
51461
|
+
error: "'".concat(id, "' is not in a repeated container; do not pass repeatIndex.")
|
|
51462
|
+
};
|
|
51463
|
+
}
|
|
51464
|
+
return null;
|
|
51465
|
+
}
|
|
51466
|
+
if (typeof repeatIndex !== 'number') {
|
|
51467
|
+
var range = rowCount === 0 ? '(none yet - add a row first)' : "0..".concat(rowCount - 1);
|
|
51468
|
+
return {
|
|
51469
|
+
errorType: 'repeated_index_missing',
|
|
51470
|
+
error: "'".concat(id, "' is in a repeated container; pass repeatIndex ").concat(range, ".")
|
|
51471
|
+
};
|
|
51472
|
+
}
|
|
51473
|
+
if (repeatIndex < 0 || repeatIndex >= rowCount) {
|
|
51474
|
+
return {
|
|
51475
|
+
errorType: 'repeated_index_out_of_range',
|
|
51476
|
+
error: "repeatIndex ".concat(repeatIndex, " is out of range for '").concat(id, "' (rowCount ").concat(rowCount, ").")
|
|
51477
|
+
};
|
|
51478
|
+
}
|
|
51479
|
+
return null;
|
|
51480
|
+
}
|
|
51481
|
+
var findTableOnCurrentStep = function (formUuid, tableId) {
|
|
51482
|
+
var _a, _b, _c, _d, _e;
|
|
51483
|
+
if (!formUuid) {
|
|
51484
|
+
return {
|
|
51485
|
+
ok: false,
|
|
51486
|
+
errorType: 'no_form_state',
|
|
51487
|
+
error: 'Form has not loaded yet.'
|
|
51488
|
+
};
|
|
51489
|
+
}
|
|
51490
|
+
var state = index$1.internalState[formUuid];
|
|
51491
|
+
if (!state || !state.currentStep || !state.assistantClient) {
|
|
51492
|
+
return {
|
|
51493
|
+
ok: false,
|
|
51494
|
+
errorType: 'no_form_state',
|
|
51495
|
+
error: 'Form has not loaded yet.'
|
|
51496
|
+
};
|
|
51497
|
+
}
|
|
51498
|
+
if (typeof tableId !== 'string' || tableId.length === 0) {
|
|
51499
|
+
return {
|
|
51500
|
+
ok: false,
|
|
51501
|
+
errorType: 'shape_mismatch',
|
|
51502
|
+
error: 'tableId is required.'
|
|
51503
|
+
};
|
|
51504
|
+
}
|
|
51505
|
+
var table = ((_a = state.currentStep.tables) !== null && _a !== void 0 ? _a : []).find(function (t) { return (t === null || t === void 0 ? void 0 : t.id) === tableId; });
|
|
51506
|
+
if (!table) {
|
|
51507
|
+
return {
|
|
51508
|
+
ok: false,
|
|
51509
|
+
errorType: 'not_on_step',
|
|
51510
|
+
error: "Table '".concat(tableId, "' is not on the current step.")
|
|
51511
|
+
};
|
|
51512
|
+
}
|
|
51513
|
+
var flags = (_b = state.visiblePositions) === null || _b === void 0 ? void 0 : _b[(_c = index$1.getPositionKey(table)) !== null && _c !== void 0 ? _c : 'root'];
|
|
51514
|
+
if (Array.isArray(flags) && !flags.some(Boolean)) {
|
|
51515
|
+
return {
|
|
51516
|
+
ok: false,
|
|
51517
|
+
errorType: 'hidden',
|
|
51518
|
+
error: "Table '".concat(tableId, "' is on the current step but is hidden right now.")
|
|
51519
|
+
};
|
|
51520
|
+
}
|
|
51521
|
+
var columns = Array.isArray((_d = table === null || table === void 0 ? void 0 : table.properties) === null || _d === void 0 ? void 0 : _d.columns)
|
|
51522
|
+
? table.properties.columns
|
|
51523
|
+
: [];
|
|
51524
|
+
var fieldsMap = (_e = state.fields) !== null && _e !== void 0 ? _e : {};
|
|
51525
|
+
var rowCount = columns.reduce(function (max, col) {
|
|
51526
|
+
var _a;
|
|
51527
|
+
var v = (col === null || col === void 0 ? void 0 : col.field_key) ? (_a = fieldsMap[col.field_key]) === null || _a === void 0 ? void 0 : _a.value : undefined;
|
|
51528
|
+
return Array.isArray(v) ? Math.max(max, v.length) : max;
|
|
51529
|
+
}, 0);
|
|
51530
|
+
return { ok: true, found: { state: state, table: table, columns: columns, rowCount: rowCount } };
|
|
51531
|
+
};
|
|
51532
|
+
var getTableCapabilities = function (table, rowCount) {
|
|
51533
|
+
var _a;
|
|
51534
|
+
var props = (_a = table === null || table === void 0 ? void 0 : table.properties) !== null && _a !== void 0 ? _a : {};
|
|
51535
|
+
// A transpose table with zero rows renders un-transposed, so it stays editable
|
|
51536
|
+
var canEditCells = !!props.enable_editing && !(props.transpose && rowCount > 0);
|
|
51537
|
+
var addDelete = canEditCells && !!props.add_delete_rows;
|
|
51538
|
+
return { canEditCells: canEditCells, canAddRows: addDelete, canDeleteRows: addDelete };
|
|
51539
|
+
};
|
|
51540
|
+
var buildRowData = function (found, rowIndex) {
|
|
51541
|
+
var e_3, _a;
|
|
51542
|
+
var _b, _c;
|
|
51543
|
+
var rowData = {};
|
|
51544
|
+
try {
|
|
51545
|
+
for (var _d = index$1.__values(found.columns), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
51546
|
+
var col = _e.value;
|
|
51547
|
+
if (!(col === null || col === void 0 ? void 0 : col.field_key))
|
|
51548
|
+
continue;
|
|
51549
|
+
var v = (_c = (_b = found.state.fields) === null || _b === void 0 ? void 0 : _b[col.field_key]) === null || _c === void 0 ? void 0 : _c.value;
|
|
51550
|
+
var cValue = Array.isArray(v) ? v[rowIndex] : v;
|
|
51551
|
+
rowData[col.name] = cValue;
|
|
51552
|
+
}
|
|
51553
|
+
}
|
|
51554
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
51555
|
+
finally {
|
|
51556
|
+
try {
|
|
51557
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
51558
|
+
}
|
|
51559
|
+
finally { if (e_3) throw e_3.error; }
|
|
51560
|
+
}
|
|
51561
|
+
return rowData;
|
|
51416
51562
|
};
|
|
51417
51563
|
|
|
51418
51564
|
var extractRawText = function (props) {
|
|
@@ -51478,9 +51624,19 @@ var getPanelRuntimeSnapshot = function (formId) {
|
|
|
51478
51624
|
var findClickableAncestorIds = function (el) {
|
|
51479
51625
|
return findClickableAncestorSubgrids(clickableSubgrids, Array.isArray(el === null || el === void 0 ? void 0 : el.position) ? el.position : []).map(function (sg) { var _a; return (_a = sg.id) !== null && _a !== void 0 ? _a : ''; });
|
|
51480
51626
|
};
|
|
51627
|
+
// Match the renderer (fields + text-variable arrays) by reading the same flags it builds
|
|
51628
|
+
var rowCountByContainer = {};
|
|
51629
|
+
index$1.getRepeatedContainers(step).forEach(function (container) {
|
|
51630
|
+
var id = container === null || container === void 0 ? void 0 : container.id;
|
|
51631
|
+
if (!id)
|
|
51632
|
+
return;
|
|
51633
|
+
var flags = visiblePositions[index$1.getPositionKey(container)];
|
|
51634
|
+
if (Array.isArray(flags))
|
|
51635
|
+
rowCountByContainer[id] = flags.length;
|
|
51636
|
+
});
|
|
51481
51637
|
// Build per-field entries for the current step
|
|
51482
51638
|
var currentStepFields = ((_h = step.servar_fields) !== null && _h !== void 0 ? _h : []).map(function (field) {
|
|
51483
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
51639
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
51484
51640
|
var positionKey = ((_a = field.position) === null || _a === void 0 ? void 0 : _a.join(',')) || 'root';
|
|
51485
51641
|
var visibilityFlags = visiblePositions[positionKey];
|
|
51486
51642
|
var visible = Array.isArray(visibilityFlags)
|
|
@@ -51497,6 +51653,11 @@ var getPanelRuntimeSnapshot = function (formId) {
|
|
|
51497
51653
|
var error = (_c = inlineErrors[field.servar.key]) === null || _c === void 0 ? void 0 : _c.message;
|
|
51498
51654
|
var servar = (_d = field.servar) !== null && _d !== void 0 ? _d : {};
|
|
51499
51655
|
var meta = (_e = servar.metadata) !== null && _e !== void 0 ? _e : {};
|
|
51656
|
+
var repeated = !!servar.repeated;
|
|
51657
|
+
var repeatAncestor = repeated
|
|
51658
|
+
? index$1.getRepeatedContainer(step, field)
|
|
51659
|
+
: undefined;
|
|
51660
|
+
var repeatAncestorId = (_f = repeatAncestor === null || repeatAncestor === void 0 ? void 0 : repeatAncestor.id) !== null && _f !== void 0 ? _f : '';
|
|
51500
51661
|
var rawOptions = Array.isArray(meta.options) ? meta.options : null;
|
|
51501
51662
|
var rawLabels = Array.isArray(meta.labels) ? meta.labels : [];
|
|
51502
51663
|
var options = rawOptions
|
|
@@ -51508,6 +51669,26 @@ var getPanelRuntimeSnapshot = function (formId) {
|
|
|
51508
51669
|
});
|
|
51509
51670
|
})
|
|
51510
51671
|
: undefined;
|
|
51672
|
+
// Per-row option overrides for repeated choice fields
|
|
51673
|
+
var rawRowOptions = Array.isArray(meta.repeat_options)
|
|
51674
|
+
? meta.repeat_options.map(function (row) {
|
|
51675
|
+
return Array.isArray(row)
|
|
51676
|
+
? row.map(function (o) {
|
|
51677
|
+
var _a, _b, _c, _d, _e;
|
|
51678
|
+
return ({
|
|
51679
|
+
value: String((_b = (_a = o === null || o === void 0 ? void 0 : o.value) !== null && _a !== void 0 ? _a : o) !== null && _b !== void 0 ? _b : ''),
|
|
51680
|
+
label: String((_e = (_d = (_c = o === null || o === void 0 ? void 0 : o.label) !== null && _c !== void 0 ? _c : o === null || o === void 0 ? void 0 : o.value) !== null && _d !== void 0 ? _d : o) !== null && _e !== void 0 ? _e : '')
|
|
51681
|
+
});
|
|
51682
|
+
})
|
|
51683
|
+
: null;
|
|
51684
|
+
})
|
|
51685
|
+
: undefined;
|
|
51686
|
+
var padTarget = (_h = (_g = rowCountByContainer[repeatAncestorId]) !== null && _g !== void 0 ? _g : rawRowOptions === null || rawRowOptions === void 0 ? void 0 : rawRowOptions.length) !== null && _h !== void 0 ? _h : 0;
|
|
51687
|
+
var rowOptions = rawRowOptions
|
|
51688
|
+
? Array.from({ length: padTarget }, function (_, i) {
|
|
51689
|
+
return Array.isArray(rawRowOptions[i]) ? rawRowOptions[i] : null;
|
|
51690
|
+
})
|
|
51691
|
+
: undefined;
|
|
51511
51692
|
var rawQuestions = Array.isArray(meta.questions) ? meta.questions : null;
|
|
51512
51693
|
var questions = rawQuestions
|
|
51513
51694
|
? rawQuestions
|
|
@@ -51526,9 +51707,20 @@ var getPanelRuntimeSnapshot = function (formId) {
|
|
|
51526
51707
|
var sliderLabels = meta.min_val_label || meta.max_val_label
|
|
51527
51708
|
? index$1.__assign(index$1.__assign({}, (meta.min_val_label ? { min: String(meta.min_val_label) } : {})), (meta.max_val_label ? { max: String(meta.max_val_label) } : {})) : undefined;
|
|
51528
51709
|
var disabled = !!(props.disabled || formReadOnly);
|
|
51529
|
-
var hasLogicRules = elementHasLogicRules(logicRules, 'change', step.id, (
|
|
51710
|
+
var hasLogicRules = elementHasLogicRules(logicRules, 'change', step.id, (_j = servar.id) !== null && _j !== void 0 ? _j : '');
|
|
51530
51711
|
var clickableAncestorIds = findClickableAncestorIds(field);
|
|
51531
|
-
|
|
51712
|
+
var value = (_k = fieldEntity === null || fieldEntity === void 0 ? void 0 : fieldEntity.value) !== null && _k !== void 0 ? _k : null;
|
|
51713
|
+
var rowCount = repeated
|
|
51714
|
+
? (_l = rowCountByContainer[repeatAncestorId]) !== null && _l !== void 0 ? _l : (Array.isArray(value) ? value.length : 0)
|
|
51715
|
+
: undefined;
|
|
51716
|
+
// Pad to rowCount so trailing rendered-but-unwritten rows read as blank
|
|
51717
|
+
if (typeof rowCount === 'number' && rowCount > 0) {
|
|
51718
|
+
var base = Array.isArray(value) ? value : [];
|
|
51719
|
+
if (base.length < rowCount) {
|
|
51720
|
+
value = index$1.__spreadArray(index$1.__spreadArray([], index$1.__read(base), false), index$1.__read(Array(rowCount - base.length).fill(index$1.getDefaultFieldValue(field))), false);
|
|
51721
|
+
}
|
|
51722
|
+
}
|
|
51723
|
+
return index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign({ key: servar.key, type: servar.type, value: value, visible: visible, disabled: disabled, required: !!servar.required }, (typeof rowCount === 'number' ? { rowCount: rowCount } : {})), ((repeatAncestor === null || repeatAncestor === void 0 ? void 0 : repeatAncestor.id) ? { repeatContainerId: repeatAncestor.id } : {})), (hasLogicRules ? { hasLogicRules: true } : {})), (clickableAncestorIds.length > 0 ? { clickableAncestorIds: clickableAncestorIds } : {})), (placeholder ? { placeholder: placeholder } : {})), (tooltip ? { tooltip: tooltip } : {})), (error ? { error: error } : {})), (options ? { options: options } : {})), (rowOptions ? { rowOptions: rowOptions } : {})), (questions ? { questions: questions } : {})), (typeof servar.min_length === 'number'
|
|
51532
51724
|
? { minLength: servar.min_length }
|
|
51533
51725
|
: {})), (typeof servar.max_length === 'number'
|
|
51534
51726
|
? { maxLength: servar.max_length }
|
|
@@ -51595,14 +51787,20 @@ var getPanelRuntimeSnapshot = function (formId) {
|
|
|
51595
51787
|
return Array.isArray(flags) ? flags.some(Boolean) : true;
|
|
51596
51788
|
};
|
|
51597
51789
|
clickableSubgrids.forEach(function (sg) {
|
|
51598
|
-
var _a, _b;
|
|
51790
|
+
var _a, _b, _c;
|
|
51599
51791
|
var actions = sg.properties.actions;
|
|
51600
51792
|
var hasLogicRules = elementHasLogicRules(logicRules, 'action', step.id, (_a = sg.id) !== null && _a !== void 0 ? _a : '');
|
|
51601
51793
|
var clickableAncestorIds = findClickableAncestorIds(sg);
|
|
51602
|
-
|
|
51794
|
+
// A repeated subgrid is its own repeat container (one clickable instance per row)
|
|
51795
|
+
var containerRepeatContainer = !sg.repeated
|
|
51796
|
+
? (_b = index$1.getRepeatedContainer(step, sg)) === null || _b === void 0 ? void 0 : _b.id
|
|
51797
|
+
: sg.id;
|
|
51798
|
+
currentStepElements.push(index$1.__assign(index$1.__assign(index$1.__assign({ type: 'container', id: (_c = sg.id) !== null && _c !== void 0 ? _c : '', visible: visibilityFor(sg), actions: actions }, (hasLogicRules ? { hasLogicRules: true } : {})), (clickableAncestorIds.length > 0 ? { clickableAncestorIds: clickableAncestorIds } : {})), (containerRepeatContainer
|
|
51799
|
+
? { repeatContainerId: containerRepeatContainer }
|
|
51800
|
+
: {})));
|
|
51603
51801
|
});
|
|
51604
51802
|
((_o = step.texts) !== null && _o !== void 0 ? _o : []).forEach(function (el) {
|
|
51605
|
-
var _a, _b, _c;
|
|
51803
|
+
var _a, _b, _c, _d;
|
|
51606
51804
|
var raw = extractRawText((_a = el === null || el === void 0 ? void 0 : el.properties) !== null && _a !== void 0 ? _a : {});
|
|
51607
51805
|
if (!raw)
|
|
51608
51806
|
return;
|
|
@@ -51611,13 +51809,12 @@ var getPanelRuntimeSnapshot = function (formId) {
|
|
|
51611
51809
|
var actions = Array.isArray(props.actions) ? props.actions : [];
|
|
51612
51810
|
var hasLogicRules = elementHasLogicRules(logicRules, 'action', step.id, (_c = el.id) !== null && _c !== void 0 ? _c : '');
|
|
51613
51811
|
var clickableAncestorIds = findClickableAncestorIds(el);
|
|
51614
|
-
|
|
51812
|
+
var textRepeatContainer = (_d = index$1.getRepeatedContainer(step, el)) === null || _d === void 0 ? void 0 : _d.id;
|
|
51813
|
+
currentStepElements.push(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign({ type: 'text', text: resolved, visible: visibilityFor(el) }, (el.id ? { id: el.id } : {})), (raw !== resolved ? { templateText: raw } : {})), (actions.length > 0 ? { actions: actions } : {})), (hasLogicRules ? { hasLogicRules: true } : {})), (clickableAncestorIds.length > 0 ? { clickableAncestorIds: clickableAncestorIds } : {})), (textRepeatContainer ? { repeatContainerId: textRepeatContainer } : {})));
|
|
51615
51814
|
});
|
|
51616
51815
|
((_p = step.buttons) !== null && _p !== void 0 ? _p : []).forEach(function (el) {
|
|
51617
|
-
var _a, _b, _c, _d;
|
|
51816
|
+
var _a, _b, _c, _d, _e;
|
|
51618
51817
|
var raw = extractRawText((_a = el === null || el === void 0 ? void 0 : el.properties) !== null && _a !== void 0 ? _a : {});
|
|
51619
|
-
if (!raw)
|
|
51620
|
-
return;
|
|
51621
51818
|
var props = (_b = el === null || el === void 0 ? void 0 : el.properties) !== null && _b !== void 0 ? _b : {};
|
|
51622
51819
|
var actions = Array.isArray(props.actions) ? props.actions : [];
|
|
51623
51820
|
// submit-flagged buttons also fire submit-trigger and form_complete-trigger rules on this step
|
|
@@ -51625,7 +51822,12 @@ var getPanelRuntimeSnapshot = function (formId) {
|
|
|
51625
51822
|
(!!props.submit &&
|
|
51626
51823
|
(elementHasLogicRules(logicRules, 'submit', step.id, '') ||
|
|
51627
51824
|
elementHasLogicRules(logicRules, 'form_complete', step.id, '')));
|
|
51628
|
-
|
|
51825
|
+
if (!raw && actions.length === 0 && !props.submit && !hasLogicRules)
|
|
51826
|
+
return;
|
|
51827
|
+
var buttonRepeatContainer = (_d = index$1.getRepeatedContainer(step, el)) === null || _d === void 0 ? void 0 : _d.id;
|
|
51828
|
+
currentStepElements.push(index$1.__assign(index$1.__assign({ type: 'button', id: (_e = el.id) !== null && _e !== void 0 ? _e : '', text: resolveText(raw), visible: visibilityFor(el), disabled: index$1.isButtonDisabled(el, step, visiblePositions, formReadOnly), submit: !!props.submit, actions: actions }, (hasLogicRules ? { hasLogicRules: true } : {})), (buttonRepeatContainer
|
|
51829
|
+
? { repeatContainerId: buttonRepeatContainer }
|
|
51830
|
+
: {})));
|
|
51629
51831
|
});
|
|
51630
51832
|
((_q = step.images) !== null && _q !== void 0 ? _q : []).forEach(function (el) {
|
|
51631
51833
|
var _a;
|
|
@@ -51646,7 +51848,7 @@ var getPanelRuntimeSnapshot = function (formId) {
|
|
|
51646
51848
|
// Collect tables with their column headers and row data
|
|
51647
51849
|
var currentStepTables = [];
|
|
51648
51850
|
((_s = step.tables) !== null && _s !== void 0 ? _s : []).forEach(function (el) {
|
|
51649
|
-
var _a, _b;
|
|
51851
|
+
var _a, _b, _c, _d, _e;
|
|
51650
51852
|
var cols = ((_b = (_a = el === null || el === void 0 ? void 0 : el.properties) === null || _a === void 0 ? void 0 : _a.columns) !== null && _b !== void 0 ? _b : []);
|
|
51651
51853
|
if (cols.length === 0)
|
|
51652
51854
|
return;
|
|
@@ -51662,17 +51864,21 @@ var getPanelRuntimeSnapshot = function (formId) {
|
|
|
51662
51864
|
return Array.isArray(v) ? (_b = v[i]) !== null && _b !== void 0 ? _b : null : v !== null && v !== void 0 ? v : null;
|
|
51663
51865
|
});
|
|
51664
51866
|
});
|
|
51665
|
-
|
|
51666
|
-
|
|
51867
|
+
var rawActions = Array.isArray((_c = el === null || el === void 0 ? void 0 : el.properties) === null || _c === void 0 ? void 0 : _c.actions)
|
|
51868
|
+
? el.properties.actions
|
|
51869
|
+
: [];
|
|
51870
|
+
var actions = rawActions
|
|
51871
|
+
.map(function (a) { return ({ label: typeof (a === null || a === void 0 ? void 0 : a.label) === 'string' ? a.label : '' }); })
|
|
51872
|
+
.filter(function (a) { return a.label.trim().length > 0; });
|
|
51873
|
+
var _f = getTableCapabilities(el, numRows), canEditCells = _f.canEditCells, canAddRows = _f.canAddRows, canDeleteRows = _f.canDeleteRows;
|
|
51874
|
+
var hasLogicRules = elementHasLogicRules(logicRules, 'action', step.id, (_d = el.id) !== null && _d !== void 0 ? _d : '');
|
|
51875
|
+
currentStepTables.push(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign(index$1.__assign({ id: (_e = el.id) !== null && _e !== void 0 ? _e : '', columns: cols.map(function (c) {
|
|
51667
51876
|
var _a, _b, _c;
|
|
51668
51877
|
return ({
|
|
51669
51878
|
name: (_b = (_a = c.name) !== null && _a !== void 0 ? _a : c.field_key) !== null && _b !== void 0 ? _b : '',
|
|
51670
51879
|
fieldKey: (_c = c.field_key) !== null && _c !== void 0 ? _c : ''
|
|
51671
51880
|
});
|
|
51672
|
-
}),
|
|
51673
|
-
rows: rows,
|
|
51674
|
-
visible: visibilityFor(el)
|
|
51675
|
-
});
|
|
51881
|
+
}), rows: rows }, (actions.length > 0 ? { actions: actions } : {})), (canAddRows ? { canAddRows: true } : {})), (canDeleteRows ? { canDeleteRows: true } : {})), (canEditCells ? { canEditCells: true } : {})), (hasLogicRules ? { hasLogicRules: true } : {})), { visible: visibilityFor(el) }));
|
|
51676
51882
|
});
|
|
51677
51883
|
return {
|
|
51678
51884
|
currentStep: { id: step.id, key: step.key },
|
|
@@ -51711,102 +51917,164 @@ var MULTI_CHOICE_TYPES = new Set([
|
|
|
51711
51917
|
'checkbox_group',
|
|
51712
51918
|
'button_group'
|
|
51713
51919
|
]);
|
|
51714
|
-
function validateSetFieldValue(fieldKey, rawValue,
|
|
51715
|
-
var _a;
|
|
51716
|
-
var
|
|
51717
|
-
var
|
|
51718
|
-
|
|
51719
|
-
|
|
51920
|
+
function validateSetFieldValue(state, fieldKey, rawValue, repeatIndex) {
|
|
51921
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
51922
|
+
var currentStep = state === null || state === void 0 ? void 0 : state.currentStep;
|
|
51923
|
+
var stepFields = (_a = currentStep === null || currentStep === void 0 ? void 0 : currentStep.servar_fields) !== null && _a !== void 0 ? _a : [];
|
|
51924
|
+
var found = stepFields.find(function (f) { var _a; return ((_a = f === null || f === void 0 ? void 0 : f.servar) === null || _a === void 0 ? void 0 : _a.key) === fieldKey; });
|
|
51925
|
+
if (!found) {
|
|
51926
|
+
var available = stepFields
|
|
51927
|
+
.map(function (f) { var _a; return (_a = f === null || f === void 0 ? void 0 : f.servar) === null || _a === void 0 ? void 0 : _a.key; })
|
|
51928
|
+
.filter(Boolean)
|
|
51929
|
+
.join(', ') || '(none)';
|
|
51720
51930
|
return {
|
|
51721
51931
|
ok: false,
|
|
51722
51932
|
errorType: 'not_on_step',
|
|
51723
51933
|
error: "Field '".concat(fieldKey, "' is not on the current step. Available field keys here: ").concat(available, ".")
|
|
51724
51934
|
};
|
|
51725
51935
|
}
|
|
51726
|
-
|
|
51936
|
+
var servar = (_b = found.servar) !== null && _b !== void 0 ? _b : {};
|
|
51937
|
+
var type = servar.type;
|
|
51938
|
+
var visiblePositions = (_c = state.visiblePositions) !== null && _c !== void 0 ? _c : {};
|
|
51939
|
+
var flags = visiblePositions[(_d = index$1.getPositionKey(found)) !== null && _d !== void 0 ? _d : 'root'];
|
|
51940
|
+
if (Array.isArray(flags) && !flags.some(Boolean)) {
|
|
51727
51941
|
return {
|
|
51728
51942
|
ok: false,
|
|
51729
51943
|
errorType: 'hidden',
|
|
51730
51944
|
error: "Field '".concat(fieldKey, "' is on the current step but is hidden right now.")
|
|
51731
51945
|
};
|
|
51732
51946
|
}
|
|
51733
|
-
|
|
51947
|
+
var formReadOnly = !!(((_e = state.formSettings) === null || _e === void 0 ? void 0 : _e.readOnly) || index$1.initState.collaboratorReview === 'readOnly');
|
|
51948
|
+
if (((_f = found.properties) === null || _f === void 0 ? void 0 : _f.disabled) || formReadOnly) {
|
|
51734
51949
|
return {
|
|
51735
51950
|
ok: false,
|
|
51736
51951
|
errorType: 'disabled',
|
|
51737
51952
|
error: "Field '".concat(fieldKey, "' is disabled and cannot be written.")
|
|
51738
51953
|
};
|
|
51739
51954
|
}
|
|
51740
|
-
if (UNWRITABLE_TYPES.has(
|
|
51955
|
+
if (UNWRITABLE_TYPES.has(type)) {
|
|
51741
51956
|
return {
|
|
51742
51957
|
ok: false,
|
|
51743
51958
|
errorType: 'unwriteable_type',
|
|
51744
|
-
error: "Field '".concat(fieldKey, "' (").concat(
|
|
51959
|
+
error: "Field '".concat(fieldKey, "' (").concat(type, ") cannot be filled by the assistant; the user has to provide this themselves.")
|
|
51960
|
+
};
|
|
51961
|
+
}
|
|
51962
|
+
var repeatContainer = servar.repeated
|
|
51963
|
+
? index$1.getRepeatedContainer(currentStep, found)
|
|
51964
|
+
: undefined;
|
|
51965
|
+
var rowCount = repeatContainer
|
|
51966
|
+
? ((_h = visiblePositions[(_g = index$1.getPositionKey(repeatContainer)) !== null && _g !== void 0 ? _g : 'root']) !== null && _h !== void 0 ? _h : []).length
|
|
51967
|
+
: 0;
|
|
51968
|
+
var repeatFailure = validateRepeatIndex(repeatIndex, !!repeatContainer, rowCount, fieldKey);
|
|
51969
|
+
if (repeatFailure)
|
|
51970
|
+
return index$1.__assign({ ok: false }, repeatFailure);
|
|
51971
|
+
// Reject writes to a row hidden by a per-row rule
|
|
51972
|
+
if (typeof repeatIndex === 'number' &&
|
|
51973
|
+
Array.isArray(flags) &&
|
|
51974
|
+
!flags[repeatIndex]) {
|
|
51975
|
+
return {
|
|
51976
|
+
ok: false,
|
|
51977
|
+
errorType: 'hidden',
|
|
51978
|
+
error: "Row ".concat(repeatIndex, " of field '").concat(fieldKey, "' is hidden right now.")
|
|
51745
51979
|
};
|
|
51746
51980
|
}
|
|
51747
51981
|
// Phone numbers commonly arrive as numbers
|
|
51748
51982
|
var value = rawValue;
|
|
51749
|
-
if (
|
|
51983
|
+
if (type === 'phone_number' &&
|
|
51750
51984
|
typeof value === 'number' &&
|
|
51751
51985
|
Number.isFinite(value)) {
|
|
51752
51986
|
value = String(Math.trunc(value));
|
|
51753
51987
|
}
|
|
51754
51988
|
// Type and bound checks
|
|
51755
|
-
var shapeError = checkValueAgainstField(
|
|
51989
|
+
var shapeError = checkValueAgainstField(servar, value, repeatIndex);
|
|
51756
51990
|
if (shapeError)
|
|
51757
51991
|
return { ok: false, errorType: 'shape_mismatch', error: shapeError };
|
|
51758
|
-
return { ok: true, value: value };
|
|
51992
|
+
return { ok: true, field: found, servar: servar, value: value };
|
|
51759
51993
|
}
|
|
51760
|
-
function
|
|
51761
|
-
var _a
|
|
51994
|
+
function resolveOptions(servar, repeatIndex) {
|
|
51995
|
+
var _a;
|
|
51996
|
+
var meta = (_a = servar.metadata) !== null && _a !== void 0 ? _a : {};
|
|
51997
|
+
var rawRowOptions = Array.isArray(meta.repeat_options)
|
|
51998
|
+
? meta.repeat_options
|
|
51999
|
+
: null;
|
|
52000
|
+
if (typeof repeatIndex === 'number' &&
|
|
52001
|
+
rawRowOptions &&
|
|
52002
|
+
Array.isArray(rawRowOptions[repeatIndex])) {
|
|
52003
|
+
return rawRowOptions[repeatIndex].map(function (o) {
|
|
52004
|
+
var _a, _b, _c, _d, _e;
|
|
52005
|
+
return ({
|
|
52006
|
+
value: String((_b = (_a = o === null || o === void 0 ? void 0 : o.value) !== null && _a !== void 0 ? _a : o) !== null && _b !== void 0 ? _b : ''),
|
|
52007
|
+
label: String((_e = (_d = (_c = o === null || o === void 0 ? void 0 : o.label) !== null && _c !== void 0 ? _c : o === null || o === void 0 ? void 0 : o.value) !== null && _d !== void 0 ? _d : o) !== null && _e !== void 0 ? _e : '')
|
|
52008
|
+
});
|
|
52009
|
+
});
|
|
52010
|
+
}
|
|
52011
|
+
var rawOptions = Array.isArray(meta.options) ? meta.options : null;
|
|
52012
|
+
if (!rawOptions)
|
|
52013
|
+
return [];
|
|
52014
|
+
var rawLabels = Array.isArray(meta.labels) ? meta.labels : [];
|
|
52015
|
+
return rawOptions.map(function (value, i) {
|
|
52016
|
+
var _a, _b;
|
|
52017
|
+
return ({
|
|
52018
|
+
value: String(value !== null && value !== void 0 ? value : ''),
|
|
52019
|
+
label: String((_b = (_a = rawLabels[i]) !== null && _a !== void 0 ? _a : value) !== null && _b !== void 0 ? _b : '')
|
|
52020
|
+
});
|
|
52021
|
+
});
|
|
52022
|
+
}
|
|
52023
|
+
function checkValueAgainstField(servar, value, repeatIndex) {
|
|
52024
|
+
var _a;
|
|
52025
|
+
var type = servar.type;
|
|
52026
|
+
var key = servar.key;
|
|
52027
|
+
var meta = (_a = servar.metadata) !== null && _a !== void 0 ? _a : {};
|
|
52028
|
+
var minLength = typeof servar.min_length === 'number' ? servar.min_length : undefined;
|
|
52029
|
+
var maxLength = typeof servar.max_length === 'number' ? servar.max_length : undefined;
|
|
51762
52030
|
// Boolean field
|
|
51763
|
-
if (
|
|
52031
|
+
if (type === 'checkbox') {
|
|
51764
52032
|
return typeof value === 'boolean'
|
|
51765
52033
|
? null
|
|
51766
|
-
: "Field '".concat(
|
|
52034
|
+
: "Field '".concat(key, "' (checkbox) expects a boolean.");
|
|
51767
52035
|
}
|
|
51768
52036
|
// Numeric fields with min/max bounds
|
|
51769
|
-
if (NUMERIC_TYPES.has(
|
|
52037
|
+
if (NUMERIC_TYPES.has(type)) {
|
|
51770
52038
|
if (typeof value !== 'number' || !Number.isFinite(value)) {
|
|
51771
|
-
return "Field '".concat(
|
|
52039
|
+
return "Field '".concat(key, "' (").concat(type, ") expects a number.");
|
|
51772
52040
|
}
|
|
51773
|
-
if (typeof
|
|
51774
|
-
return "Value below minimum (".concat(
|
|
52041
|
+
if (typeof minLength === 'number' && value < minLength) {
|
|
52042
|
+
return "Value below minimum (".concat(minLength, ").");
|
|
51775
52043
|
}
|
|
51776
|
-
if (typeof
|
|
51777
|
-
return "Value above maximum (".concat(
|
|
52044
|
+
if (typeof maxLength === 'number' && value > maxLength) {
|
|
52045
|
+
return "Value above maximum (".concat(maxLength, ").");
|
|
51778
52046
|
}
|
|
51779
52047
|
return null;
|
|
51780
52048
|
}
|
|
51781
52049
|
// ISO date string
|
|
51782
|
-
if (
|
|
52050
|
+
if (type === 'date_selector') {
|
|
51783
52051
|
if (typeof value !== 'string') {
|
|
51784
|
-
return "Field '".concat(
|
|
52052
|
+
return "Field '".concat(key, "' (date_selector) expects a string.");
|
|
51785
52053
|
}
|
|
51786
52054
|
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
51787
|
-
return "Field '".concat(
|
|
52055
|
+
return "Field '".concat(key, "' expects ISO date 'YYYY-MM-DD'.");
|
|
51788
52056
|
}
|
|
51789
52057
|
return null;
|
|
51790
52058
|
}
|
|
51791
52059
|
// Single-choice picker
|
|
51792
|
-
if (SINGLE_CHOICE_TYPES.has(
|
|
52060
|
+
if (SINGLE_CHOICE_TYPES.has(type)) {
|
|
51793
52061
|
if (typeof value !== 'string') {
|
|
51794
|
-
return "Field '".concat(
|
|
52062
|
+
return "Field '".concat(key, "' (").concat(type, ") expects a single option value (string).");
|
|
51795
52063
|
}
|
|
51796
|
-
var opts = (
|
|
52064
|
+
var opts = resolveOptions(servar, repeatIndex).map(function (o) { return o.value; });
|
|
51797
52065
|
if (opts.length > 0 && !opts.includes(value)) {
|
|
51798
52066
|
return "Value not in allowed options. Allowed: ".concat(opts.join(', '), ".");
|
|
51799
52067
|
}
|
|
51800
52068
|
return null;
|
|
51801
52069
|
}
|
|
51802
|
-
if (MULTI_CHOICE_TYPES.has(
|
|
52070
|
+
if (MULTI_CHOICE_TYPES.has(type)) {
|
|
51803
52071
|
if (!Array.isArray(value) || !value.every(function (v) { return typeof v === 'string'; })) {
|
|
51804
|
-
return "Field '".concat(
|
|
52072
|
+
return "Field '".concat(key, "' (").concat(type, ") expects an array of option-value strings.");
|
|
51805
52073
|
}
|
|
51806
|
-
if (
|
|
51807
|
-
return "Field '".concat(
|
|
52074
|
+
if (type === 'button_group' && !meta.multiple && value.length > 1) {
|
|
52075
|
+
return "Field '".concat(key, "' (button_group) is single-select; pass at most one option.");
|
|
51808
52076
|
}
|
|
51809
|
-
var opts_1 = new Set((
|
|
52077
|
+
var opts_1 = new Set(resolveOptions(servar, repeatIndex).map(function (o) { return o.value; }));
|
|
51810
52078
|
if (opts_1.size > 0) {
|
|
51811
52079
|
var bad = value.filter(function (v) { return !opts_1.has(v); });
|
|
51812
52080
|
if (bad.length > 0) {
|
|
@@ -51816,76 +52084,20 @@ function checkValueAgainstField(field, value) {
|
|
|
51816
52084
|
return null;
|
|
51817
52085
|
}
|
|
51818
52086
|
// Text fields with optional length bounds
|
|
51819
|
-
if (TEXT_TYPES.has(
|
|
52087
|
+
if (TEXT_TYPES.has(type)) {
|
|
51820
52088
|
if (typeof value !== 'string') {
|
|
51821
|
-
return "Field '".concat(
|
|
52089
|
+
return "Field '".concat(key, "' (").concat(type, ") expects a string.");
|
|
51822
52090
|
}
|
|
51823
|
-
if (typeof
|
|
51824
|
-
return "Value shorter than minimum length (".concat(
|
|
52091
|
+
if (typeof minLength === 'number' && value.length < minLength) {
|
|
52092
|
+
return "Value shorter than minimum length (".concat(minLength, ").");
|
|
51825
52093
|
}
|
|
51826
|
-
if (typeof
|
|
51827
|
-
return "Value exceeds maximum length (".concat(
|
|
52094
|
+
if (typeof maxLength === 'number' && value.length > maxLength) {
|
|
52095
|
+
return "Value exceeds maximum length (".concat(maxLength, ").");
|
|
51828
52096
|
}
|
|
51829
52097
|
return null;
|
|
51830
52098
|
}
|
|
51831
52099
|
return null;
|
|
51832
52100
|
}
|
|
51833
|
-
function applyServarValues(formUuid, entries) {
|
|
51834
|
-
return index$1.__awaiter(this, void 0, void 0, function () {
|
|
51835
|
-
var state, payload, entries_1, entries_1_1, _a, fieldKey, value, servar, normalized, e_1_1;
|
|
51836
|
-
var e_1, _b;
|
|
51837
|
-
return index$1.__generator(this, function (_c) {
|
|
51838
|
-
switch (_c.label) {
|
|
51839
|
-
case 0:
|
|
51840
|
-
if (!formUuid || entries.length === 0)
|
|
51841
|
-
return [2 /*return*/];
|
|
51842
|
-
state = index$1.internalState[formUuid];
|
|
51843
|
-
if (!state)
|
|
51844
|
-
return [2 /*return*/];
|
|
51845
|
-
payload = {};
|
|
51846
|
-
_c.label = 1;
|
|
51847
|
-
case 1:
|
|
51848
|
-
_c.trys.push([1, 8, 9, 10]);
|
|
51849
|
-
entries_1 = index$1.__values(entries), entries_1_1 = entries_1.next();
|
|
51850
|
-
_c.label = 2;
|
|
51851
|
-
case 2:
|
|
51852
|
-
if (!!entries_1_1.done) return [3 /*break*/, 7];
|
|
51853
|
-
_a = entries_1_1.value, fieldKey = _a.fieldKey, value = _a.value;
|
|
51854
|
-
servar = findServar(state, fieldKey);
|
|
51855
|
-
normalized = value;
|
|
51856
|
-
if (!((servar === null || servar === void 0 ? void 0 : servar.type) === 'gmap_state')) return [3 /*break*/, 3];
|
|
51857
|
-
normalized = normalizeGmapState(value, servar);
|
|
51858
|
-
return [3 /*break*/, 5];
|
|
51859
|
-
case 3:
|
|
51860
|
-
if (!((servar === null || servar === void 0 ? void 0 : servar.type) === 'phone_number')) return [3 /*break*/, 5];
|
|
51861
|
-
return [4 /*yield*/, normalizePhone(value, servar, state, fieldKey)];
|
|
51862
|
-
case 4:
|
|
51863
|
-
normalized = _c.sent();
|
|
51864
|
-
_c.label = 5;
|
|
51865
|
-
case 5:
|
|
51866
|
-
payload[fieldKey] = normalized;
|
|
51867
|
-
_c.label = 6;
|
|
51868
|
-
case 6:
|
|
51869
|
-
entries_1_1 = entries_1.next();
|
|
51870
|
-
return [3 /*break*/, 2];
|
|
51871
|
-
case 7: return [3 /*break*/, 10];
|
|
51872
|
-
case 8:
|
|
51873
|
-
e_1_1 = _c.sent();
|
|
51874
|
-
e_1 = { error: e_1_1 };
|
|
51875
|
-
return [3 /*break*/, 10];
|
|
51876
|
-
case 9:
|
|
51877
|
-
try {
|
|
51878
|
-
if (entries_1_1 && !entries_1_1.done && (_b = entries_1.return)) _b.call(entries_1);
|
|
51879
|
-
}
|
|
51880
|
-
finally { if (e_1) throw e_1.error; }
|
|
51881
|
-
return [7 /*endfinally*/];
|
|
51882
|
-
case 10:
|
|
51883
|
-
index$1.setFieldValues(payload, true, true);
|
|
51884
|
-
return [2 /*return*/];
|
|
51885
|
-
}
|
|
51886
|
-
});
|
|
51887
|
-
});
|
|
51888
|
-
}
|
|
51889
52101
|
function normalizeGmapState(value, servar) {
|
|
51890
52102
|
var _a, _b;
|
|
51891
52103
|
if (typeof value !== 'string' || !value)
|
|
@@ -51955,27 +52167,135 @@ function resolveCountry(state, fieldKey, servar) {
|
|
|
51955
52167
|
var dc = (_c = servar.metadata) === null || _c === void 0 ? void 0 : _c.default_country;
|
|
51956
52168
|
return dc && dc !== 'auto' ? dc : 'US';
|
|
51957
52169
|
}
|
|
51958
|
-
function
|
|
51959
|
-
var
|
|
51960
|
-
|
|
51961
|
-
|
|
51962
|
-
|
|
51963
|
-
|
|
51964
|
-
|
|
51965
|
-
|
|
51966
|
-
|
|
51967
|
-
|
|
51968
|
-
|
|
51969
|
-
|
|
51970
|
-
|
|
51971
|
-
|
|
51972
|
-
|
|
51973
|
-
|
|
51974
|
-
|
|
51975
|
-
|
|
51976
|
-
|
|
51977
|
-
|
|
51978
|
-
|
|
52170
|
+
function dispatchSetFieldValue(formUuid, fields) {
|
|
52171
|
+
var _a, _b;
|
|
52172
|
+
return index$1.__awaiter(this, void 0, void 0, function () {
|
|
52173
|
+
var state, client, requestedKeys, priorValues, prepared, results;
|
|
52174
|
+
var _this = this;
|
|
52175
|
+
return index$1.__generator(this, function (_c) {
|
|
52176
|
+
switch (_c.label) {
|
|
52177
|
+
case 0:
|
|
52178
|
+
state = formUuid ? index$1.internalState[formUuid] : undefined;
|
|
52179
|
+
client = state === null || state === void 0 ? void 0 : state.assistantClient;
|
|
52180
|
+
if (!state || !client) {
|
|
52181
|
+
return [2 /*return*/, {
|
|
52182
|
+
results: fields.map(function (item) {
|
|
52183
|
+
var fieldKey = typeof (item === null || item === void 0 ? void 0 : item.fieldKey) === 'string' ? item.fieldKey : '';
|
|
52184
|
+
var repeatIndex = Number.isInteger(item === null || item === void 0 ? void 0 : item.repeatIndex)
|
|
52185
|
+
? item.repeatIndex
|
|
52186
|
+
: undefined;
|
|
52187
|
+
if (!fieldKey) {
|
|
52188
|
+
return {
|
|
52189
|
+
fieldKey: fieldKey,
|
|
52190
|
+
repeatIndex: repeatIndex,
|
|
52191
|
+
ok: false,
|
|
52192
|
+
errorType: 'shape_mismatch',
|
|
52193
|
+
error: 'fieldKey is required.'
|
|
52194
|
+
};
|
|
52195
|
+
}
|
|
52196
|
+
return {
|
|
52197
|
+
fieldKey: fieldKey,
|
|
52198
|
+
repeatIndex: repeatIndex,
|
|
52199
|
+
ok: false,
|
|
52200
|
+
errorType: 'no_form_state',
|
|
52201
|
+
error: 'Form has not loaded yet.'
|
|
52202
|
+
};
|
|
52203
|
+
})
|
|
52204
|
+
}];
|
|
52205
|
+
}
|
|
52206
|
+
requestedKeys = new Set(fields
|
|
52207
|
+
.map(function (f) { return (typeof (f === null || f === void 0 ? void 0 : f.fieldKey) === 'string' ? f.fieldKey : ''); })
|
|
52208
|
+
.filter(Boolean));
|
|
52209
|
+
priorValues = new Map(((_b = (_a = state.currentStep) === null || _a === void 0 ? void 0 : _a.servar_fields) !== null && _b !== void 0 ? _b : [])
|
|
52210
|
+
.filter(function (f) { var _a; return requestedKeys.has((_a = f === null || f === void 0 ? void 0 : f.servar) === null || _a === void 0 ? void 0 : _a.key); })
|
|
52211
|
+
.map(function (f) {
|
|
52212
|
+
var _a, _b;
|
|
52213
|
+
var key = f.servar.key;
|
|
52214
|
+
var v = (_b = (_a = state.fields) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.value;
|
|
52215
|
+
return [key, v == null ? null : JSON.parse(JSON.stringify(v))];
|
|
52216
|
+
}));
|
|
52217
|
+
return [4 /*yield*/, Promise.all(fields.map(function (item) { return index$1.__awaiter(_this, void 0, void 0, function () {
|
|
52218
|
+
var fieldKey, repeatIndex, validation, field, servar, normalized;
|
|
52219
|
+
return index$1.__generator(this, function (_a) {
|
|
52220
|
+
switch (_a.label) {
|
|
52221
|
+
case 0:
|
|
52222
|
+
fieldKey = typeof (item === null || item === void 0 ? void 0 : item.fieldKey) === 'string' ? item.fieldKey : '';
|
|
52223
|
+
repeatIndex = Number.isInteger(item === null || item === void 0 ? void 0 : item.repeatIndex)
|
|
52224
|
+
? item.repeatIndex
|
|
52225
|
+
: undefined;
|
|
52226
|
+
// Validate shape, value, and field presence on current step
|
|
52227
|
+
if (!fieldKey) {
|
|
52228
|
+
return [2 /*return*/, {
|
|
52229
|
+
fieldKey: fieldKey,
|
|
52230
|
+
repeatIndex: repeatIndex,
|
|
52231
|
+
ok: false,
|
|
52232
|
+
errorType: 'shape_mismatch',
|
|
52233
|
+
error: 'fieldKey is required.'
|
|
52234
|
+
}];
|
|
52235
|
+
}
|
|
52236
|
+
validation = validateSetFieldValue(state, fieldKey, item.value, repeatIndex);
|
|
52237
|
+
if (!validation.ok) {
|
|
52238
|
+
return [2 /*return*/, {
|
|
52239
|
+
fieldKey: fieldKey,
|
|
52240
|
+
repeatIndex: repeatIndex,
|
|
52241
|
+
ok: false,
|
|
52242
|
+
errorType: validation.errorType,
|
|
52243
|
+
error: validation.error
|
|
52244
|
+
}];
|
|
52245
|
+
}
|
|
52246
|
+
field = validation.field, servar = validation.servar;
|
|
52247
|
+
normalized = validation.value;
|
|
52248
|
+
if (!(servar.type === 'gmap_state')) return [3 /*break*/, 1];
|
|
52249
|
+
normalized = normalizeGmapState(normalized, servar);
|
|
52250
|
+
return [3 /*break*/, 3];
|
|
52251
|
+
case 1:
|
|
52252
|
+
if (!(servar.type === 'phone_number')) return [3 /*break*/, 3];
|
|
52253
|
+
return [4 /*yield*/, normalizePhone(normalized, servar, state, fieldKey)];
|
|
52254
|
+
case 2:
|
|
52255
|
+
normalized = _a.sent();
|
|
52256
|
+
_a.label = 3;
|
|
52257
|
+
case 3: return [2 /*return*/, { fieldKey: fieldKey, repeatIndex: repeatIndex, field: field, normalized: normalized }];
|
|
52258
|
+
}
|
|
52259
|
+
});
|
|
52260
|
+
}); }))];
|
|
52261
|
+
case 1:
|
|
52262
|
+
prepared = _c.sent();
|
|
52263
|
+
results = prepared.map(function (p) {
|
|
52264
|
+
var _a, _b;
|
|
52265
|
+
if ('ok' in p)
|
|
52266
|
+
return p;
|
|
52267
|
+
var fieldForChange = typeof p.repeatIndex === 'number'
|
|
52268
|
+
? index$1.__assign(index$1.__assign({}, p.field), { repeat: p.repeatIndex }) : p.field;
|
|
52269
|
+
try {
|
|
52270
|
+
client.changeValue(p.normalized, fieldForChange, (_a = p.repeatIndex) !== null && _a !== void 0 ? _a : null);
|
|
52271
|
+
}
|
|
52272
|
+
catch (err) {
|
|
52273
|
+
return {
|
|
52274
|
+
fieldKey: p.fieldKey,
|
|
52275
|
+
repeatIndex: p.repeatIndex,
|
|
52276
|
+
ok: false,
|
|
52277
|
+
errorType: 'dispatch_failed',
|
|
52278
|
+
error: err instanceof Error ? err.message : String(err)
|
|
52279
|
+
};
|
|
52280
|
+
}
|
|
52281
|
+
var prior = priorValues.get(p.fieldKey);
|
|
52282
|
+
var priorValue = p.repeatIndex !== undefined
|
|
52283
|
+
? Array.isArray(prior)
|
|
52284
|
+
? (_b = prior[p.repeatIndex]) !== null && _b !== void 0 ? _b : null
|
|
52285
|
+
: null
|
|
52286
|
+
: prior !== null && prior !== void 0 ? prior : null;
|
|
52287
|
+
return {
|
|
52288
|
+
fieldKey: p.fieldKey,
|
|
52289
|
+
repeatIndex: p.repeatIndex,
|
|
52290
|
+
ok: true,
|
|
52291
|
+
value: p.normalized,
|
|
52292
|
+
priorValue: priorValue
|
|
52293
|
+
};
|
|
52294
|
+
});
|
|
52295
|
+
return [2 /*return*/, { results: results }];
|
|
52296
|
+
}
|
|
52297
|
+
});
|
|
52298
|
+
});
|
|
51979
52299
|
}
|
|
51980
52300
|
|
|
51981
52301
|
var findElement = function (state, elementId) {
|
|
@@ -52013,43 +52333,17 @@ var findElement = function (state, elementId) {
|
|
|
52013
52333
|
}
|
|
52014
52334
|
return null;
|
|
52015
52335
|
};
|
|
52016
|
-
|
|
52017
|
-
var _a;
|
|
52018
|
-
var positionKey = position.join(',') || 'root';
|
|
52019
|
-
var flags = (_a = state.visiblePositions) === null || _a === void 0 ? void 0 : _a[positionKey];
|
|
52020
|
-
return Array.isArray(flags) ? flags.some(Boolean) : true;
|
|
52021
|
-
};
|
|
52022
|
-
var snapshotInlineErrors = function (state) {
|
|
52023
|
-
var e_2, _a;
|
|
52024
|
-
var _b, _c;
|
|
52025
|
-
var inlineErrors = (_b = state === null || state === void 0 ? void 0 : state.inlineErrors) !== null && _b !== void 0 ? _b : {};
|
|
52026
|
-
var out = {};
|
|
52027
|
-
try {
|
|
52028
|
-
for (var _d = index$1.__values(Object.keys(inlineErrors)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
52029
|
-
var key = _e.value;
|
|
52030
|
-
var message = (_c = inlineErrors[key]) === null || _c === void 0 ? void 0 : _c.message;
|
|
52031
|
-
if (typeof message === 'string' && message.length > 0) {
|
|
52032
|
-
out[key] = message;
|
|
52033
|
-
}
|
|
52034
|
-
}
|
|
52035
|
-
}
|
|
52036
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
52037
|
-
finally {
|
|
52038
|
-
try {
|
|
52039
|
-
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
52040
|
-
}
|
|
52041
|
-
finally { if (e_2) throw e_2.error; }
|
|
52042
|
-
}
|
|
52043
|
-
return out;
|
|
52044
|
-
};
|
|
52045
|
-
function dispatchClickElement(formUuid, elementId) {
|
|
52046
|
-
var _a, _b, _c;
|
|
52336
|
+
function dispatchClickElement(formUuid, elementId, rawRepeatIndex) {
|
|
52337
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
52047
52338
|
return index$1.__awaiter(this, void 0, void 0, function () {
|
|
52048
|
-
var state, found, client, fromStepKey, errorsBefore, ancestors, ancestors_1, ancestors_1_1, sg, acts,
|
|
52049
|
-
var
|
|
52050
|
-
return index$1.__generator(this, function (
|
|
52051
|
-
switch (
|
|
52339
|
+
var repeatIndex, state, found, visiblePositions, flags, formReadOnly, repeatContainer, rowCount, repeatFailure, client, fromStepKey, errorsBefore, elementForDispatch, ancestors, ancestors_1, ancestors_1_1, sg, acts, insideRepeat, e_2_1, err_1, toStepKey, errorsAfter, fieldErrors, _j, _k, key, buttonError;
|
|
52340
|
+
var e_2, _l, e_3, _m;
|
|
52341
|
+
return index$1.__generator(this, function (_o) {
|
|
52342
|
+
switch (_o.label) {
|
|
52052
52343
|
case 0:
|
|
52344
|
+
repeatIndex = Number.isInteger(rawRepeatIndex)
|
|
52345
|
+
? rawRepeatIndex
|
|
52346
|
+
: null;
|
|
52053
52347
|
if (!formUuid) {
|
|
52054
52348
|
return [2 /*return*/, {
|
|
52055
52349
|
ok: false,
|
|
@@ -52080,89 +52374,126 @@ function dispatchClickElement(formUuid, elementId) {
|
|
|
52080
52374
|
error: "Element '".concat(elementId, "' is not on the current step.")
|
|
52081
52375
|
}];
|
|
52082
52376
|
}
|
|
52083
|
-
|
|
52377
|
+
visiblePositions = (_a = state.visiblePositions) !== null && _a !== void 0 ? _a : {};
|
|
52378
|
+
flags = visiblePositions[(_b = index$1.getPositionKey(found.element)) !== null && _b !== void 0 ? _b : 'root'];
|
|
52379
|
+
if (Array.isArray(flags) && !flags.some(Boolean)) {
|
|
52084
52380
|
return [2 /*return*/, {
|
|
52085
52381
|
ok: false,
|
|
52086
52382
|
errorType: 'hidden',
|
|
52087
52383
|
error: "Element '".concat(elementId, "' is on the current step but is hidden right now.")
|
|
52088
52384
|
}];
|
|
52089
52385
|
}
|
|
52386
|
+
if (found.elementType === 'button') {
|
|
52387
|
+
formReadOnly = !!(((_c = state.formSettings) === null || _c === void 0 ? void 0 : _c.readOnly) ||
|
|
52388
|
+
index$1.initState.collaboratorReview === 'readOnly');
|
|
52389
|
+
if (index$1.isButtonDisabled(found.element, state.currentStep, visiblePositions, formReadOnly)) {
|
|
52390
|
+
return [2 /*return*/, {
|
|
52391
|
+
ok: false,
|
|
52392
|
+
errorType: 'disabled',
|
|
52393
|
+
error: "Button '".concat(elementId, "' is disabled and cannot be clicked.")
|
|
52394
|
+
}];
|
|
52395
|
+
}
|
|
52396
|
+
}
|
|
52397
|
+
repeatContainer = found.element.repeated
|
|
52398
|
+
? found.element
|
|
52399
|
+
: index$1.getRepeatedContainer(state.currentStep, found.element);
|
|
52400
|
+
rowCount = repeatContainer
|
|
52401
|
+
? ((_e = visiblePositions[(_d = index$1.getPositionKey(repeatContainer)) !== null && _d !== void 0 ? _d : 'root']) !== null && _e !== void 0 ? _e : []).length
|
|
52402
|
+
: 0;
|
|
52403
|
+
repeatFailure = validateRepeatIndex(repeatIndex, !!repeatContainer, rowCount, elementId);
|
|
52404
|
+
if (repeatFailure)
|
|
52405
|
+
return [2 /*return*/, index$1.__assign({ ok: false }, repeatFailure)];
|
|
52406
|
+
// Reject clicks on a row hidden by a per-row rule
|
|
52407
|
+
if (typeof repeatIndex === 'number' &&
|
|
52408
|
+
Array.isArray(flags) &&
|
|
52409
|
+
!flags[repeatIndex]) {
|
|
52410
|
+
return [2 /*return*/, {
|
|
52411
|
+
ok: false,
|
|
52412
|
+
errorType: 'hidden',
|
|
52413
|
+
error: "Row ".concat(repeatIndex, " of element '").concat(elementId, "' is hidden right now.")
|
|
52414
|
+
}];
|
|
52415
|
+
}
|
|
52090
52416
|
client = state.assistantClient;
|
|
52091
52417
|
fromStepKey = state.currentStep.key;
|
|
52092
52418
|
errorsBefore = snapshotInlineErrors(state);
|
|
52093
|
-
|
|
52419
|
+
elementForDispatch = typeof repeatIndex === 'number'
|
|
52420
|
+
? index$1.__assign(index$1.__assign({}, found.element), { repeat: repeatIndex }) : found.element;
|
|
52421
|
+
_o.label = 1;
|
|
52094
52422
|
case 1:
|
|
52095
|
-
|
|
52423
|
+
_o.trys.push([1, 13, , 14]);
|
|
52096
52424
|
if (!(found.elementType === 'button')) return [3 /*break*/, 3];
|
|
52097
|
-
return [4 /*yield*/, client.click(
|
|
52425
|
+
return [4 /*yield*/, client.click(elementForDispatch)];
|
|
52098
52426
|
case 2:
|
|
52099
|
-
|
|
52427
|
+
_o.sent();
|
|
52100
52428
|
return [3 /*break*/, 12];
|
|
52101
52429
|
case 3:
|
|
52102
52430
|
ancestors = findClickableAncestorSubgrids(state.currentStep.subgrids, found.position);
|
|
52103
52431
|
return [4 /*yield*/, client.runActions({
|
|
52104
52432
|
actions: found.actions,
|
|
52105
|
-
element:
|
|
52433
|
+
element: elementForDispatch,
|
|
52106
52434
|
elementType: found.elementType
|
|
52107
52435
|
})];
|
|
52108
52436
|
case 4:
|
|
52109
|
-
|
|
52110
|
-
|
|
52437
|
+
_o.sent();
|
|
52438
|
+
_o.label = 5;
|
|
52111
52439
|
case 5:
|
|
52112
|
-
|
|
52440
|
+
_o.trys.push([5, 10, 11, 12]);
|
|
52113
52441
|
ancestors_1 = index$1.__values(ancestors), ancestors_1_1 = ancestors_1.next();
|
|
52114
|
-
|
|
52442
|
+
_o.label = 6;
|
|
52115
52443
|
case 6:
|
|
52116
52444
|
if (!!ancestors_1_1.done) return [3 /*break*/, 9];
|
|
52117
52445
|
sg = ancestors_1_1.value;
|
|
52118
|
-
acts = (
|
|
52446
|
+
acts = (_f = sg === null || sg === void 0 ? void 0 : sg.properties) === null || _f === void 0 ? void 0 : _f.actions;
|
|
52447
|
+
insideRepeat = typeof repeatIndex === 'number' &&
|
|
52448
|
+
!!repeatContainer &&
|
|
52449
|
+
sg.position.length >= repeatContainer.position.length;
|
|
52119
52450
|
return [4 /*yield*/, client.runActions({
|
|
52120
52451
|
actions: Array.isArray(acts) ? acts : [],
|
|
52121
|
-
element: sg,
|
|
52452
|
+
element: insideRepeat ? index$1.__assign(index$1.__assign({}, sg), { repeat: repeatIndex }) : sg,
|
|
52122
52453
|
elementType: 'container'
|
|
52123
52454
|
})];
|
|
52124
52455
|
case 7:
|
|
52125
|
-
|
|
52126
|
-
|
|
52456
|
+
_o.sent();
|
|
52457
|
+
_o.label = 8;
|
|
52127
52458
|
case 8:
|
|
52128
52459
|
ancestors_1_1 = ancestors_1.next();
|
|
52129
52460
|
return [3 /*break*/, 6];
|
|
52130
52461
|
case 9: return [3 /*break*/, 12];
|
|
52131
52462
|
case 10:
|
|
52132
|
-
|
|
52133
|
-
|
|
52463
|
+
e_2_1 = _o.sent();
|
|
52464
|
+
e_2 = { error: e_2_1 };
|
|
52134
52465
|
return [3 /*break*/, 12];
|
|
52135
52466
|
case 11:
|
|
52136
52467
|
try {
|
|
52137
|
-
if (ancestors_1_1 && !ancestors_1_1.done && (
|
|
52468
|
+
if (ancestors_1_1 && !ancestors_1_1.done && (_l = ancestors_1.return)) _l.call(ancestors_1);
|
|
52138
52469
|
}
|
|
52139
|
-
finally { if (
|
|
52470
|
+
finally { if (e_2) throw e_2.error; }
|
|
52140
52471
|
return [7 /*endfinally*/];
|
|
52141
52472
|
case 12: return [3 /*break*/, 14];
|
|
52142
52473
|
case 13:
|
|
52143
|
-
err_1 =
|
|
52474
|
+
err_1 = _o.sent();
|
|
52144
52475
|
return [2 /*return*/, {
|
|
52145
52476
|
ok: false,
|
|
52146
52477
|
errorType: 'dispatch_failed',
|
|
52147
52478
|
error: err_1 instanceof Error ? err_1.message : String(err_1)
|
|
52148
52479
|
}];
|
|
52149
52480
|
case 14:
|
|
52150
|
-
toStepKey = (
|
|
52481
|
+
toStepKey = (_h = (_g = state.currentStep) === null || _g === void 0 ? void 0 : _g.key) !== null && _h !== void 0 ? _h : fromStepKey;
|
|
52151
52482
|
errorsAfter = snapshotInlineErrors(state);
|
|
52152
52483
|
fieldErrors = {};
|
|
52153
52484
|
try {
|
|
52154
|
-
for (
|
|
52155
|
-
key =
|
|
52485
|
+
for (_j = index$1.__values(Object.keys(errorsAfter)), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
52486
|
+
key = _k.value;
|
|
52156
52487
|
if (errorsAfter[key] !== errorsBefore[key])
|
|
52157
52488
|
fieldErrors[key] = errorsAfter[key];
|
|
52158
52489
|
}
|
|
52159
52490
|
}
|
|
52160
|
-
catch (
|
|
52491
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
52161
52492
|
finally {
|
|
52162
52493
|
try {
|
|
52163
|
-
if (
|
|
52494
|
+
if (_k && !_k.done && (_m = _j.return)) _m.call(_j);
|
|
52164
52495
|
}
|
|
52165
|
-
finally { if (
|
|
52496
|
+
finally { if (e_3) throw e_3.error; }
|
|
52166
52497
|
}
|
|
52167
52498
|
buttonError = found.elementType === 'button' ? fieldErrors[elementId] : undefined;
|
|
52168
52499
|
delete fieldErrors[elementId];
|
|
@@ -52172,6 +52503,328 @@ function dispatchClickElement(formUuid, elementId) {
|
|
|
52172
52503
|
});
|
|
52173
52504
|
}
|
|
52174
52505
|
|
|
52506
|
+
function dispatchTriggerTableAction(formUuid, tableId, rowIndex, actionLabel) {
|
|
52507
|
+
var _a, _b, _c;
|
|
52508
|
+
return index$1.__awaiter(this, void 0, void 0, function () {
|
|
52509
|
+
var lookup, _d, state, table, rowCount, hasLabel, actions, rowData, fromStepKey, errorsBefore, err_1, toStepKey, errorsAfter, fieldErrors, _e, _f, key;
|
|
52510
|
+
var e_1, _g;
|
|
52511
|
+
return index$1.__generator(this, function (_h) {
|
|
52512
|
+
switch (_h.label) {
|
|
52513
|
+
case 0:
|
|
52514
|
+
lookup = findTableOnCurrentStep(formUuid, tableId);
|
|
52515
|
+
if (!lookup.ok)
|
|
52516
|
+
return [2 /*return*/, lookup];
|
|
52517
|
+
_d = lookup.found, state = _d.state, table = _d.table, rowCount = _d.rowCount;
|
|
52518
|
+
hasLabel = typeof actionLabel === 'string' && actionLabel.length > 0;
|
|
52519
|
+
if (actionLabel !== undefined && !hasLabel) {
|
|
52520
|
+
return [2 /*return*/, {
|
|
52521
|
+
ok: false,
|
|
52522
|
+
errorType: 'shape_mismatch',
|
|
52523
|
+
error: 'actionLabel must be a non-empty string when provided.'
|
|
52524
|
+
}];
|
|
52525
|
+
}
|
|
52526
|
+
if (!Number.isInteger(rowIndex) || rowIndex < 0) {
|
|
52527
|
+
return [2 /*return*/, {
|
|
52528
|
+
ok: false,
|
|
52529
|
+
errorType: 'shape_mismatch',
|
|
52530
|
+
error: 'rowIndex must be a non-negative integer.'
|
|
52531
|
+
}];
|
|
52532
|
+
}
|
|
52533
|
+
if (hasLabel) {
|
|
52534
|
+
actions = Array.isArray((_a = table === null || table === void 0 ? void 0 : table.properties) === null || _a === void 0 ? void 0 : _a.actions)
|
|
52535
|
+
? table.properties.actions
|
|
52536
|
+
: [];
|
|
52537
|
+
if (!actions.some(function (a) { return (a === null || a === void 0 ? void 0 : a.label) === actionLabel; })) {
|
|
52538
|
+
return [2 /*return*/, {
|
|
52539
|
+
ok: false,
|
|
52540
|
+
errorType: 'unknown_action',
|
|
52541
|
+
error: "Table '".concat(tableId, "' has no action labeled '").concat(actionLabel, "'.")
|
|
52542
|
+
}];
|
|
52543
|
+
}
|
|
52544
|
+
}
|
|
52545
|
+
else if (getTableCapabilities(table, rowCount).canEditCells) {
|
|
52546
|
+
// Editable tables suppress the bare row click, so the user can't fire it either
|
|
52547
|
+
return [2 /*return*/, {
|
|
52548
|
+
ok: false,
|
|
52549
|
+
errorType: 'not_allowed',
|
|
52550
|
+
error: "Table '".concat(tableId, "' is editable, so bare row clicks are not wired; use a named action.")
|
|
52551
|
+
}];
|
|
52552
|
+
}
|
|
52553
|
+
if (rowIndex >= rowCount) {
|
|
52554
|
+
return [2 /*return*/, {
|
|
52555
|
+
ok: false,
|
|
52556
|
+
errorType: 'row_out_of_range',
|
|
52557
|
+
error: "Row ".concat(rowIndex, " is out of range (table has ").concat(rowCount, " row").concat(rowCount === 1 ? '' : 's', ").")
|
|
52558
|
+
}];
|
|
52559
|
+
}
|
|
52560
|
+
rowData = buildRowData(lookup.found, rowIndex);
|
|
52561
|
+
fromStepKey = state.currentStep.key;
|
|
52562
|
+
errorsBefore = snapshotInlineErrors(state);
|
|
52563
|
+
_h.label = 1;
|
|
52564
|
+
case 1:
|
|
52565
|
+
_h.trys.push([1, 3, , 4]);
|
|
52566
|
+
return [4 /*yield*/, state.assistantClient.runTableAction({
|
|
52567
|
+
table: table,
|
|
52568
|
+
payload: hasLabel
|
|
52569
|
+
? { action: actionLabel, rowIndex: rowIndex, rowData: rowData }
|
|
52570
|
+
: { rowIndex: rowIndex, rowData: rowData }
|
|
52571
|
+
})];
|
|
52572
|
+
case 2:
|
|
52573
|
+
_h.sent();
|
|
52574
|
+
return [3 /*break*/, 4];
|
|
52575
|
+
case 3:
|
|
52576
|
+
err_1 = _h.sent();
|
|
52577
|
+
return [2 /*return*/, {
|
|
52578
|
+
ok: false,
|
|
52579
|
+
errorType: 'dispatch_failed',
|
|
52580
|
+
error: err_1 instanceof Error ? err_1.message : String(err_1)
|
|
52581
|
+
}];
|
|
52582
|
+
case 4:
|
|
52583
|
+
toStepKey = (_c = (_b = state.currentStep) === null || _b === void 0 ? void 0 : _b.key) !== null && _c !== void 0 ? _c : fromStepKey;
|
|
52584
|
+
errorsAfter = snapshotInlineErrors(state);
|
|
52585
|
+
fieldErrors = {};
|
|
52586
|
+
try {
|
|
52587
|
+
for (_e = index$1.__values(Object.keys(errorsAfter)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
52588
|
+
key = _f.value;
|
|
52589
|
+
if (errorsAfter[key] !== errorsBefore[key])
|
|
52590
|
+
fieldErrors[key] = errorsAfter[key];
|
|
52591
|
+
}
|
|
52592
|
+
}
|
|
52593
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
52594
|
+
finally {
|
|
52595
|
+
try {
|
|
52596
|
+
if (_f && !_f.done && (_g = _e.return)) _g.call(_e);
|
|
52597
|
+
}
|
|
52598
|
+
finally { if (e_1) throw e_1.error; }
|
|
52599
|
+
}
|
|
52600
|
+
return [2 /*return*/, index$1.__assign({ ok: true, navigated: toStepKey !== fromStepKey ? { fromStepKey: fromStepKey, toStepKey: toStepKey } : null }, (Object.keys(fieldErrors).length > 0 ? { fieldErrors: fieldErrors } : {}))];
|
|
52601
|
+
}
|
|
52602
|
+
});
|
|
52603
|
+
});
|
|
52604
|
+
}
|
|
52605
|
+
|
|
52606
|
+
var validateRowIndex = function (rowIndex, rowCount) {
|
|
52607
|
+
if (!Number.isInteger(rowIndex) || rowIndex < 0) {
|
|
52608
|
+
return {
|
|
52609
|
+
ok: false,
|
|
52610
|
+
errorType: 'shape_mismatch',
|
|
52611
|
+
error: 'rowIndex must be a non-negative integer.'
|
|
52612
|
+
};
|
|
52613
|
+
}
|
|
52614
|
+
if (rowIndex >= rowCount) {
|
|
52615
|
+
return {
|
|
52616
|
+
ok: false,
|
|
52617
|
+
errorType: 'row_out_of_range',
|
|
52618
|
+
error: "Row ".concat(rowIndex, " is out of range (table has ").concat(rowCount, " row").concat(rowCount === 1 ? '' : 's', ").")
|
|
52619
|
+
};
|
|
52620
|
+
}
|
|
52621
|
+
return null;
|
|
52622
|
+
};
|
|
52623
|
+
var CAPABILITY_LABELS = {
|
|
52624
|
+
add: 'adding rows',
|
|
52625
|
+
del: 'deleting rows',
|
|
52626
|
+
edit: 'cell editing'
|
|
52627
|
+
};
|
|
52628
|
+
var requireCapability = function (table, tableId, capability, rowCount) {
|
|
52629
|
+
var caps = getTableCapabilities(table, rowCount);
|
|
52630
|
+
var allowed = (capability === 'add' && caps.canAddRows) ||
|
|
52631
|
+
(capability === 'del' && caps.canDeleteRows) ||
|
|
52632
|
+
(capability === 'edit' && caps.canEditCells);
|
|
52633
|
+
if (allowed)
|
|
52634
|
+
return null;
|
|
52635
|
+
return {
|
|
52636
|
+
ok: false,
|
|
52637
|
+
errorType: 'not_allowed',
|
|
52638
|
+
error: "Table '".concat(tableId, "' does not allow ").concat(CAPABILITY_LABELS[capability], ".")
|
|
52639
|
+
};
|
|
52640
|
+
};
|
|
52641
|
+
function dispatchAddTableRow(formUuid, tableId) {
|
|
52642
|
+
return index$1.__awaiter(this, void 0, void 0, function () {
|
|
52643
|
+
var lookup, _a, state, table, rowCount, cap;
|
|
52644
|
+
return index$1.__generator(this, function (_b) {
|
|
52645
|
+
lookup = findTableOnCurrentStep(formUuid, tableId);
|
|
52646
|
+
if (!lookup.ok)
|
|
52647
|
+
return [2 /*return*/, lookup];
|
|
52648
|
+
_a = lookup.found, state = _a.state, table = _a.table, rowCount = _a.rowCount;
|
|
52649
|
+
cap = requireCapability(table, tableId, 'add', rowCount);
|
|
52650
|
+
if (cap)
|
|
52651
|
+
return [2 /*return*/, cap];
|
|
52652
|
+
try {
|
|
52653
|
+
if (!state.assistantClient.addTableRow(tableId)) {
|
|
52654
|
+
return [2 /*return*/, {
|
|
52655
|
+
ok: false,
|
|
52656
|
+
errorType: 'not_mounted',
|
|
52657
|
+
error: "Table '".concat(tableId, "' is not mounted yet.")
|
|
52658
|
+
}];
|
|
52659
|
+
}
|
|
52660
|
+
}
|
|
52661
|
+
catch (err) {
|
|
52662
|
+
return [2 /*return*/, {
|
|
52663
|
+
ok: false,
|
|
52664
|
+
errorType: 'dispatch_failed',
|
|
52665
|
+
error: err instanceof Error ? err.message : String(err)
|
|
52666
|
+
}];
|
|
52667
|
+
}
|
|
52668
|
+
return [2 /*return*/, { ok: true }];
|
|
52669
|
+
});
|
|
52670
|
+
});
|
|
52671
|
+
}
|
|
52672
|
+
function dispatchDeleteTableRow(formUuid, tableId, rowIndex) {
|
|
52673
|
+
return index$1.__awaiter(this, void 0, void 0, function () {
|
|
52674
|
+
var lookup, _a, state, table, rowCount, cap, rowErr;
|
|
52675
|
+
return index$1.__generator(this, function (_b) {
|
|
52676
|
+
lookup = findTableOnCurrentStep(formUuid, tableId);
|
|
52677
|
+
if (!lookup.ok)
|
|
52678
|
+
return [2 /*return*/, lookup];
|
|
52679
|
+
_a = lookup.found, state = _a.state, table = _a.table, rowCount = _a.rowCount;
|
|
52680
|
+
cap = requireCapability(table, tableId, 'del', rowCount);
|
|
52681
|
+
if (cap)
|
|
52682
|
+
return [2 /*return*/, cap];
|
|
52683
|
+
rowErr = validateRowIndex(rowIndex, rowCount);
|
|
52684
|
+
if (rowErr)
|
|
52685
|
+
return [2 /*return*/, rowErr];
|
|
52686
|
+
try {
|
|
52687
|
+
if (!state.assistantClient.deleteTableRow(tableId, rowIndex)) {
|
|
52688
|
+
return [2 /*return*/, {
|
|
52689
|
+
ok: false,
|
|
52690
|
+
errorType: 'not_mounted',
|
|
52691
|
+
error: "Table '".concat(tableId, "' is not mounted yet.")
|
|
52692
|
+
}];
|
|
52693
|
+
}
|
|
52694
|
+
}
|
|
52695
|
+
catch (err) {
|
|
52696
|
+
return [2 /*return*/, {
|
|
52697
|
+
ok: false,
|
|
52698
|
+
errorType: 'dispatch_failed',
|
|
52699
|
+
error: err instanceof Error ? err.message : String(err)
|
|
52700
|
+
}];
|
|
52701
|
+
}
|
|
52702
|
+
return [2 /*return*/, { ok: true }];
|
|
52703
|
+
});
|
|
52704
|
+
});
|
|
52705
|
+
}
|
|
52706
|
+
function dispatchSetTableCellValue(formUuid, tableId, cells) {
|
|
52707
|
+
var _a;
|
|
52708
|
+
return index$1.__awaiter(this, void 0, void 0, function () {
|
|
52709
|
+
var safeCells, fanOut, lookup, _b, state, table, columns, rowCount, cap, priorValues, results, _loop_1, safeCells_1, safeCells_1_1, c;
|
|
52710
|
+
var e_1, _c;
|
|
52711
|
+
return index$1.__generator(this, function (_d) {
|
|
52712
|
+
safeCells = (Array.isArray(cells) ? cells : []).map(function (c) { return ({
|
|
52713
|
+
rowIndex: typeof (c === null || c === void 0 ? void 0 : c.rowIndex) === 'number' ? c.rowIndex : NaN,
|
|
52714
|
+
fieldKey: typeof (c === null || c === void 0 ? void 0 : c.fieldKey) === 'string' ? c.fieldKey : '',
|
|
52715
|
+
value: c === null || c === void 0 ? void 0 : c.value
|
|
52716
|
+
}); });
|
|
52717
|
+
fanOut = function (errorType, error) { return ({
|
|
52718
|
+
results: safeCells.map(function (c) { return ({
|
|
52719
|
+
rowIndex: c.rowIndex,
|
|
52720
|
+
fieldKey: c.fieldKey,
|
|
52721
|
+
ok: false,
|
|
52722
|
+
errorType: errorType,
|
|
52723
|
+
error: error
|
|
52724
|
+
}); })
|
|
52725
|
+
}); };
|
|
52726
|
+
lookup = findTableOnCurrentStep(formUuid, tableId);
|
|
52727
|
+
if (!lookup.ok)
|
|
52728
|
+
return [2 /*return*/, fanOut(lookup.errorType, lookup.error)];
|
|
52729
|
+
_b = lookup.found, state = _b.state, table = _b.table, columns = _b.columns, rowCount = _b.rowCount;
|
|
52730
|
+
cap = requireCapability(table, tableId, 'edit', rowCount);
|
|
52731
|
+
if (cap)
|
|
52732
|
+
return [2 /*return*/, fanOut(cap.errorType, cap.error)];
|
|
52733
|
+
priorValues = new Map(safeCells
|
|
52734
|
+
.filter(function (c) { return c.fieldKey; })
|
|
52735
|
+
.map(function (c) {
|
|
52736
|
+
var _a, _b;
|
|
52737
|
+
var v = (_b = (_a = state.fields) === null || _a === void 0 ? void 0 : _a[c.fieldKey]) === null || _b === void 0 ? void 0 : _b.value;
|
|
52738
|
+
var prior = Array.isArray(v) ? v[c.rowIndex] : undefined;
|
|
52739
|
+
return [
|
|
52740
|
+
"".concat(c.fieldKey, ":").concat(c.rowIndex),
|
|
52741
|
+
prior == null ? null : JSON.parse(JSON.stringify(prior))
|
|
52742
|
+
];
|
|
52743
|
+
}));
|
|
52744
|
+
results = [];
|
|
52745
|
+
_loop_1 = function (c) {
|
|
52746
|
+
var rowIndex = c.rowIndex, fieldKey = c.fieldKey, value = c.value;
|
|
52747
|
+
if (!fieldKey) {
|
|
52748
|
+
results.push({
|
|
52749
|
+
rowIndex: rowIndex,
|
|
52750
|
+
fieldKey: fieldKey,
|
|
52751
|
+
ok: false,
|
|
52752
|
+
errorType: 'shape_mismatch',
|
|
52753
|
+
error: 'fieldKey is required.'
|
|
52754
|
+
});
|
|
52755
|
+
return "continue";
|
|
52756
|
+
}
|
|
52757
|
+
if (!columns.some(function (col) { return (col === null || col === void 0 ? void 0 : col.field_key) === fieldKey; })) {
|
|
52758
|
+
results.push({
|
|
52759
|
+
rowIndex: rowIndex,
|
|
52760
|
+
fieldKey: fieldKey,
|
|
52761
|
+
ok: false,
|
|
52762
|
+
errorType: 'unknown_field',
|
|
52763
|
+
error: "Table '".concat(tableId, "' has no column with fieldKey '").concat(fieldKey, "'.")
|
|
52764
|
+
});
|
|
52765
|
+
return "continue";
|
|
52766
|
+
}
|
|
52767
|
+
var rowErr = validateRowIndex(rowIndex, rowCount);
|
|
52768
|
+
if (rowErr) {
|
|
52769
|
+
results.push({
|
|
52770
|
+
rowIndex: rowIndex,
|
|
52771
|
+
fieldKey: fieldKey,
|
|
52772
|
+
ok: false,
|
|
52773
|
+
errorType: rowErr.errorType,
|
|
52774
|
+
error: rowErr.error
|
|
52775
|
+
});
|
|
52776
|
+
return "continue";
|
|
52777
|
+
}
|
|
52778
|
+
// Write what typing would produce: text only, clear as empty string
|
|
52779
|
+
var writeValue = value == null ? '' : String(value);
|
|
52780
|
+
try {
|
|
52781
|
+
if (!state.assistantClient.editTableCell(tableId, rowIndex, fieldKey, writeValue)) {
|
|
52782
|
+
results.push({
|
|
52783
|
+
rowIndex: rowIndex,
|
|
52784
|
+
fieldKey: fieldKey,
|
|
52785
|
+
ok: false,
|
|
52786
|
+
errorType: 'not_mounted',
|
|
52787
|
+
error: "Table '".concat(tableId, "' is not mounted yet.")
|
|
52788
|
+
});
|
|
52789
|
+
return "continue";
|
|
52790
|
+
}
|
|
52791
|
+
}
|
|
52792
|
+
catch (err) {
|
|
52793
|
+
results.push({
|
|
52794
|
+
rowIndex: rowIndex,
|
|
52795
|
+
fieldKey: fieldKey,
|
|
52796
|
+
ok: false,
|
|
52797
|
+
errorType: 'dispatch_failed',
|
|
52798
|
+
error: err instanceof Error ? err.message : String(err)
|
|
52799
|
+
});
|
|
52800
|
+
return "continue";
|
|
52801
|
+
}
|
|
52802
|
+
results.push({
|
|
52803
|
+
rowIndex: rowIndex,
|
|
52804
|
+
fieldKey: fieldKey,
|
|
52805
|
+
ok: true,
|
|
52806
|
+
value: writeValue,
|
|
52807
|
+
priorValue: (_a = priorValues.get("".concat(fieldKey, ":").concat(rowIndex))) !== null && _a !== void 0 ? _a : null
|
|
52808
|
+
});
|
|
52809
|
+
};
|
|
52810
|
+
try {
|
|
52811
|
+
for (safeCells_1 = index$1.__values(safeCells), safeCells_1_1 = safeCells_1.next(); !safeCells_1_1.done; safeCells_1_1 = safeCells_1.next()) {
|
|
52812
|
+
c = safeCells_1_1.value;
|
|
52813
|
+
_loop_1(c);
|
|
52814
|
+
}
|
|
52815
|
+
}
|
|
52816
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
52817
|
+
finally {
|
|
52818
|
+
try {
|
|
52819
|
+
if (safeCells_1_1 && !safeCells_1_1.done && (_c = safeCells_1.return)) _c.call(safeCells_1);
|
|
52820
|
+
}
|
|
52821
|
+
finally { if (e_1) throw e_1.error; }
|
|
52822
|
+
}
|
|
52823
|
+
return [2 /*return*/, { results: results }];
|
|
52824
|
+
});
|
|
52825
|
+
});
|
|
52826
|
+
}
|
|
52827
|
+
|
|
52175
52828
|
var FAB_SIZE = 56;
|
|
52176
52829
|
var PANEL_WIDTH = 380;
|
|
52177
52830
|
var PANEL_HEIGHT = 500;
|
|
@@ -52465,128 +53118,99 @@ var AssistantChat = function (_a) {
|
|
|
52465
53118
|
onToolCall: function (_a) {
|
|
52466
53119
|
var toolCall = _a.toolCall;
|
|
52467
53120
|
return index$1.__awaiter(void 0, void 0, void 0, function () {
|
|
52468
|
-
var input_1, fields,
|
|
52469
|
-
var
|
|
52470
|
-
|
|
52471
|
-
|
|
52472
|
-
switch (_k.label) {
|
|
53121
|
+
var input_1, fields, output, input_2, elementId, output, input_3, tableId, rowIndex, actionLabel, output, input_4, tableId, output, input_5, tableId, rowIndex, output, input_6, tableId, cells, output;
|
|
53122
|
+
var _b, _c, _d, _e, _f, _g;
|
|
53123
|
+
return index$1.__generator(this, function (_h) {
|
|
53124
|
+
switch (_h.label) {
|
|
52473
53125
|
case 0:
|
|
52474
53126
|
if (toolCall.dynamic)
|
|
52475
53127
|
return [2 /*return*/];
|
|
52476
|
-
if (!(toolCall.toolName === 'setFieldValue')) return [3 /*break*/,
|
|
52477
|
-
input_1 = ((
|
|
53128
|
+
if (!(toolCall.toolName === 'setFieldValue')) return [3 /*break*/, 2];
|
|
53129
|
+
input_1 = ((_b = toolCall.input) !== null && _b !== void 0 ? _b : {});
|
|
52478
53130
|
fields = Array.isArray(input_1.fields) ? input_1.fields : [];
|
|
52479
|
-
|
|
52480
|
-
toCloneable_1 = function (v) {
|
|
52481
|
-
return v == null ? null : JSON.parse(JSON.stringify(v));
|
|
52482
|
-
};
|
|
52483
|
-
priorValues = new Map(((_g = snap === null || snap === void 0 ? void 0 : snap.currentStepFields) !== null && _g !== void 0 ? _g : []).map(function (f) { return [
|
|
52484
|
-
f.key,
|
|
52485
|
-
toCloneable_1(f.value)
|
|
52486
|
-
]; }));
|
|
52487
|
-
results = [];
|
|
52488
|
-
toApply = [];
|
|
52489
|
-
try {
|
|
52490
|
-
for (fields_1 = index$1.__values(fields), fields_1_1 = fields_1.next(); !fields_1_1.done; fields_1_1 = fields_1.next()) {
|
|
52491
|
-
item = fields_1_1.value;
|
|
52492
|
-
fieldKey = typeof (item === null || item === void 0 ? void 0 : item.fieldKey) === 'string' ? item.fieldKey : '';
|
|
52493
|
-
if (!fieldKey) {
|
|
52494
|
-
results.push({
|
|
52495
|
-
fieldKey: fieldKey,
|
|
52496
|
-
ok: false,
|
|
52497
|
-
errorType: 'shape_mismatch',
|
|
52498
|
-
error: 'fieldKey is required.'
|
|
52499
|
-
});
|
|
52500
|
-
continue;
|
|
52501
|
-
}
|
|
52502
|
-
validation = validateSetFieldValue(fieldKey, item.value, snap);
|
|
52503
|
-
if (!validation.ok) {
|
|
52504
|
-
results.push({
|
|
52505
|
-
fieldKey: fieldKey,
|
|
52506
|
-
ok: false,
|
|
52507
|
-
error: validation.error,
|
|
52508
|
-
errorType: validation.errorType
|
|
52509
|
-
});
|
|
52510
|
-
continue;
|
|
52511
|
-
}
|
|
52512
|
-
toApply.push({ fieldKey: fieldKey, value: validation.value });
|
|
52513
|
-
}
|
|
52514
|
-
}
|
|
52515
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
52516
|
-
finally {
|
|
52517
|
-
try {
|
|
52518
|
-
if (fields_1_1 && !fields_1_1.done && (_c = fields_1.return)) _c.call(fields_1);
|
|
52519
|
-
}
|
|
52520
|
-
finally { if (e_1) throw e_1.error; }
|
|
52521
|
-
}
|
|
52522
|
-
_k.label = 1;
|
|
53131
|
+
return [4 /*yield*/, dispatchSetFieldValue(instanceId, fields)];
|
|
52523
53132
|
case 1:
|
|
52524
|
-
|
|
52525
|
-
|
|
53133
|
+
output = _h.sent();
|
|
53134
|
+
chat.addToolOutput({
|
|
53135
|
+
tool: 'setFieldValue',
|
|
53136
|
+
toolCallId: toolCall.toolCallId,
|
|
53137
|
+
output: output
|
|
53138
|
+
});
|
|
53139
|
+
return [3 /*break*/, 12];
|
|
52526
53140
|
case 2:
|
|
52527
|
-
|
|
52528
|
-
|
|
52529
|
-
|
|
52530
|
-
|
|
52531
|
-
results.push({
|
|
52532
|
-
fieldKey: fieldKey,
|
|
52533
|
-
ok: true,
|
|
52534
|
-
value: value,
|
|
52535
|
-
priorValue: (_h = priorValues.get(fieldKey)) !== null && _h !== void 0 ? _h : null
|
|
52536
|
-
});
|
|
52537
|
-
}
|
|
52538
|
-
}
|
|
52539
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
52540
|
-
finally {
|
|
52541
|
-
try {
|
|
52542
|
-
if (toApply_1_1 && !toApply_1_1.done && (_d = toApply_1.return)) _d.call(toApply_1);
|
|
52543
|
-
}
|
|
52544
|
-
finally { if (e_2) throw e_2.error; }
|
|
52545
|
-
}
|
|
52546
|
-
return [3 /*break*/, 4];
|
|
53141
|
+
if (!(toolCall.toolName === 'clickElement')) return [3 /*break*/, 4];
|
|
53142
|
+
input_2 = ((_c = toolCall.input) !== null && _c !== void 0 ? _c : {});
|
|
53143
|
+
elementId = typeof input_2.elementId === 'string' ? input_2.elementId : '';
|
|
53144
|
+
return [4 /*yield*/, dispatchClickElement(instanceId, elementId, input_2.repeatIndex)];
|
|
52547
53145
|
case 3:
|
|
52548
|
-
|
|
52549
|
-
message = err_1 instanceof Error ? err_1.message : String(err_1);
|
|
52550
|
-
try {
|
|
52551
|
-
for (toApply_2 = index$1.__values(toApply), toApply_2_1 = toApply_2.next(); !toApply_2_1.done; toApply_2_1 = toApply_2.next()) {
|
|
52552
|
-
fieldKey = toApply_2_1.value.fieldKey;
|
|
52553
|
-
results.push({
|
|
52554
|
-
fieldKey: fieldKey,
|
|
52555
|
-
ok: false,
|
|
52556
|
-
errorType: 'apply_failed',
|
|
52557
|
-
error: message
|
|
52558
|
-
});
|
|
52559
|
-
}
|
|
52560
|
-
}
|
|
52561
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
52562
|
-
finally {
|
|
52563
|
-
try {
|
|
52564
|
-
if (toApply_2_1 && !toApply_2_1.done && (_e = toApply_2.return)) _e.call(toApply_2);
|
|
52565
|
-
}
|
|
52566
|
-
finally { if (e_3) throw e_3.error; }
|
|
52567
|
-
}
|
|
52568
|
-
return [3 /*break*/, 4];
|
|
52569
|
-
case 4:
|
|
53146
|
+
output = _h.sent();
|
|
52570
53147
|
chat.addToolOutput({
|
|
52571
|
-
tool: '
|
|
53148
|
+
tool: 'clickElement',
|
|
52572
53149
|
toolCallId: toolCall.toolCallId,
|
|
52573
|
-
output:
|
|
53150
|
+
output: output
|
|
52574
53151
|
});
|
|
52575
|
-
return [3 /*break*/,
|
|
53152
|
+
return [3 /*break*/, 12];
|
|
53153
|
+
case 4:
|
|
53154
|
+
if (!(toolCall.toolName === 'triggerTableAction')) return [3 /*break*/, 6];
|
|
53155
|
+
input_3 = ((_d = toolCall.input) !== null && _d !== void 0 ? _d : {});
|
|
53156
|
+
tableId = typeof input_3.tableId === 'string' ? input_3.tableId : '';
|
|
53157
|
+
rowIndex = typeof input_3.rowIndex === 'number' ? input_3.rowIndex : NaN;
|
|
53158
|
+
actionLabel = typeof input_3.actionLabel === 'string'
|
|
53159
|
+
? input_3.actionLabel
|
|
53160
|
+
: undefined;
|
|
53161
|
+
return [4 /*yield*/, dispatchTriggerTableAction(instanceId, tableId, rowIndex, actionLabel)];
|
|
52576
53162
|
case 5:
|
|
52577
|
-
|
|
52578
|
-
|
|
52579
|
-
|
|
52580
|
-
|
|
53163
|
+
output = _h.sent();
|
|
53164
|
+
chat.addToolOutput({
|
|
53165
|
+
tool: 'triggerTableAction',
|
|
53166
|
+
toolCallId: toolCall.toolCallId,
|
|
53167
|
+
output: output
|
|
53168
|
+
});
|
|
53169
|
+
return [3 /*break*/, 12];
|
|
52581
53170
|
case 6:
|
|
52582
|
-
|
|
53171
|
+
if (!(toolCall.toolName === 'addTableRow')) return [3 /*break*/, 8];
|
|
53172
|
+
input_4 = ((_e = toolCall.input) !== null && _e !== void 0 ? _e : {});
|
|
53173
|
+
tableId = typeof input_4.tableId === 'string' ? input_4.tableId : '';
|
|
53174
|
+
return [4 /*yield*/, dispatchAddTableRow(instanceId, tableId)];
|
|
53175
|
+
case 7:
|
|
53176
|
+
output = _h.sent();
|
|
52583
53177
|
chat.addToolOutput({
|
|
52584
|
-
tool: '
|
|
53178
|
+
tool: 'addTableRow',
|
|
53179
|
+
toolCallId: toolCall.toolCallId,
|
|
53180
|
+
output: output
|
|
53181
|
+
});
|
|
53182
|
+
return [3 /*break*/, 12];
|
|
53183
|
+
case 8:
|
|
53184
|
+
if (!(toolCall.toolName === 'deleteTableRow')) return [3 /*break*/, 10];
|
|
53185
|
+
input_5 = ((_f = toolCall.input) !== null && _f !== void 0 ? _f : {});
|
|
53186
|
+
tableId = typeof input_5.tableId === 'string' ? input_5.tableId : '';
|
|
53187
|
+
rowIndex = typeof input_5.rowIndex === 'number' ? input_5.rowIndex : NaN;
|
|
53188
|
+
return [4 /*yield*/, dispatchDeleteTableRow(instanceId, tableId, rowIndex)];
|
|
53189
|
+
case 9:
|
|
53190
|
+
output = _h.sent();
|
|
53191
|
+
chat.addToolOutput({
|
|
53192
|
+
tool: 'deleteTableRow',
|
|
53193
|
+
toolCallId: toolCall.toolCallId,
|
|
53194
|
+
output: output
|
|
53195
|
+
});
|
|
53196
|
+
return [3 /*break*/, 12];
|
|
53197
|
+
case 10:
|
|
53198
|
+
if (!(toolCall.toolName === 'setTableCellValue')) return [3 /*break*/, 12];
|
|
53199
|
+
input_6 = ((_g = toolCall.input) !== null && _g !== void 0 ? _g : {});
|
|
53200
|
+
tableId = typeof input_6.tableId === 'string' ? input_6.tableId : '';
|
|
53201
|
+
cells = Array.isArray(input_6.cells)
|
|
53202
|
+
? input_6.cells
|
|
53203
|
+
: [];
|
|
53204
|
+
return [4 /*yield*/, dispatchSetTableCellValue(instanceId, tableId, cells)];
|
|
53205
|
+
case 11:
|
|
53206
|
+
output = _h.sent();
|
|
53207
|
+
chat.addToolOutput({
|
|
53208
|
+
tool: 'setTableCellValue',
|
|
52585
53209
|
toolCallId: toolCall.toolCallId,
|
|
52586
53210
|
output: output
|
|
52587
53211
|
});
|
|
52588
|
-
|
|
52589
|
-
case
|
|
53212
|
+
_h.label = 12;
|
|
53213
|
+
case 12: return [2 /*return*/];
|
|
52590
53214
|
}
|
|
52591
53215
|
});
|
|
52592
53216
|
});
|
|
@@ -52614,7 +53238,7 @@ var AssistantChat = function (_a) {
|
|
|
52614
53238
|
chat: activeChat
|
|
52615
53239
|
}), rawMessages = _t.messages, sendMessage = _t.sendMessage, status = _t.status, error = _t.error;
|
|
52616
53240
|
var messages = React.useMemo(function () {
|
|
52617
|
-
var
|
|
53241
|
+
var e_1, _a;
|
|
52618
53242
|
var _b, _c;
|
|
52619
53243
|
var combined = [];
|
|
52620
53244
|
try {
|
|
@@ -52631,12 +53255,12 @@ var AssistantChat = function (_a) {
|
|
|
52631
53255
|
}
|
|
52632
53256
|
}
|
|
52633
53257
|
}
|
|
52634
|
-
catch (
|
|
53258
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
52635
53259
|
finally {
|
|
52636
53260
|
try {
|
|
52637
53261
|
if (rawMessages_1_1 && !rawMessages_1_1.done && (_a = rawMessages_1.return)) _a.call(rawMessages_1);
|
|
52638
53262
|
}
|
|
52639
|
-
finally { if (
|
|
53263
|
+
finally { if (e_1) throw e_1.error; }
|
|
52640
53264
|
}
|
|
52641
53265
|
return combined;
|
|
52642
53266
|
}, [rawMessages]);
|