@baseline-ui/core 3.9.0 → 3.10.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/dist/Accordion.mjs +1 -1
- package/dist/ActionButton.mjs +1 -1
- package/dist/ActionGroup.mjs +1 -1
- package/dist/ActionIconButton.mjs +1 -1
- package/dist/Actionable.mjs +1 -1
- package/dist/AlertDialog.mjs +1 -1
- package/dist/AudioPlayer.mjs +1 -1
- package/dist/Breadcrumbs.mjs +1 -1
- package/dist/ButtonSelect.mjs +1 -1
- package/dist/Calendar.mjs +1 -1
- package/dist/Checkbox.mjs +1 -1
- package/dist/ColorInput.mjs +1 -1
- package/dist/ColorSwatch.mjs +1 -1
- package/dist/ColorSwatchPicker.mjs +1 -1
- package/dist/ComboBox.mjs +1 -1
- package/dist/DateField.mjs +1 -1
- package/dist/Dialog.mjs +1 -1
- package/dist/Disclosure.mjs +1 -1
- package/dist/DomNodeRenderer.mjs +1 -1
- package/dist/Drawer.mjs +1 -1
- package/dist/Editor.mjs +1 -1
- package/dist/FileInput.mjs +1 -1
- package/dist/FileList.css +1 -1
- package/dist/FileList.mjs +1 -1
- package/dist/FileUploader.mjs +1 -1
- package/dist/FrameProvider.mjs +1 -1
- package/dist/FreehandCanvas.mjs +1 -1
- package/dist/GridList.mjs +1 -1
- package/dist/Group.mjs +1 -1
- package/dist/Icon.mjs +1 -1
- package/dist/Image.mjs +1 -1
- package/dist/ImageDropZone.mjs +1 -1
- package/dist/ImageGallery.mjs +1 -1
- package/dist/InlineAlert.mjs +1 -1
- package/dist/InlineToolbar.mjs +2 -2
- package/dist/Kbd.mjs +1 -1
- package/dist/Link.mjs +1 -1
- package/dist/ListBox.mjs +1 -1
- package/dist/Markdown.css +1 -1
- package/dist/Markdown.mjs +1 -1
- package/dist/Menu.mjs +1 -1
- package/dist/MessageFormat.mjs +1 -1
- package/dist/Modal.mjs +1 -1
- package/dist/NumberInput.mjs +1 -1
- package/dist/Pagination.mjs +1 -1
- package/dist/Panel.mjs +1 -1
- package/dist/PointPicker.mjs +1 -1
- package/dist/Popover.mjs +1 -1
- package/dist/Portal.mjs +1 -1
- package/dist/Preview.mjs +1 -1
- package/dist/ProgressBar.mjs +1 -1
- package/dist/ProgressSpinner.mjs +1 -1
- package/dist/RadioGroup.css +1 -1
- package/dist/RadioGroup.mjs +1 -1
- package/dist/Reaction.mjs +1 -1
- package/dist/ScrollControlButton.css +1 -1
- package/dist/ScrollControlButton.mjs +1 -1
- package/dist/SearchInput.mjs +1 -1
- package/dist/Select.mjs +1 -1
- package/dist/Slider.mjs +1 -1
- package/dist/Stepper.mjs +1 -1
- package/dist/Switch.mjs +1 -1
- package/dist/Table.mjs +1 -1
- package/dist/Tabs.mjs +1 -1
- package/dist/Tag.mjs +1 -1
- package/dist/TagGroup.mjs +1 -1
- package/dist/TaggedPagination.mjs +1 -1
- package/dist/Text.mjs +1 -1
- package/dist/TextInput.mjs +1 -1
- package/dist/ThemeProvider.mjs +1 -1
- package/dist/TimeField.mjs +1 -1
- package/dist/Toast.mjs +1 -1
- package/dist/ToggleButton.mjs +1 -1
- package/dist/ToggleIconButton.mjs +1 -1
- package/dist/Toolbar.mjs +1 -1
- package/dist/Tooltip.mjs +1 -1
- package/dist/TreeView.mjs +1 -1
- package/dist/UNSAFE_ListBox.mjs +1 -1
- package/dist/Virtualizer.mjs +1 -1
- package/dist/{chunk-E3TD3EJQ.mjs → chunk-23OLSA2X.mjs} +2 -2
- package/dist/{chunk-X6K4M542.mjs → chunk-24WOG72O.mjs} +2 -2
- package/dist/{chunk-YK3KAPIK.mjs → chunk-2CFMM7MZ.mjs} +2 -2
- package/dist/{chunk-WSRXTVYB.mjs → chunk-2KRVQJDA.mjs} +2 -2
- package/dist/{chunk-SCJ3RG7B.mjs → chunk-2MNK24YJ.mjs} +1 -1
- package/dist/{chunk-3PBFSDMT.mjs → chunk-2PTLJDIT.mjs} +1 -1
- package/dist/{chunk-YSQ3YHJN.mjs → chunk-2TMQUHHU.mjs} +1 -1
- package/dist/chunk-3A7ZISTE.mjs +10 -0
- package/dist/{chunk-DOFT4BQH.mjs → chunk-3EFE2WAJ.mjs} +1 -1
- package/dist/{chunk-CKUHFL5G.mjs → chunk-3HJAQJWA.mjs} +1 -1
- package/dist/chunk-3IHIKAT4.mjs +10 -0
- package/dist/chunk-3JHXI33A.mjs +10 -0
- package/dist/chunk-3K6XNSYE.mjs +10 -0
- package/dist/chunk-3LS73XVI.mjs +10 -0
- package/dist/chunk-3P25UGHE.mjs +10 -0
- package/dist/{chunk-BFW26T6V.mjs → chunk-43U6RZ5C.mjs} +2 -2
- package/dist/{chunk-54MWEZUP.mjs → chunk-46UWKP7W.mjs} +1 -1
- package/dist/chunk-4CMATAQ2.mjs +10 -0
- package/dist/{chunk-F3EOLTFM.mjs → chunk-4FN6UAXD.mjs} +1 -1
- package/dist/{chunk-NWYRVUTX.mjs → chunk-4Y5IKZSW.mjs} +1 -1
- package/dist/{chunk-ZRD2DMEX.mjs → chunk-5B6263RO.mjs} +13 -13
- package/dist/{chunk-WAPBLICF.mjs → chunk-5NVCSLXT.mjs} +1 -1
- package/dist/{chunk-OBEPT4LR.mjs → chunk-5YV74V36.mjs} +1 -1
- package/dist/{chunk-VWSTMBQK.mjs → chunk-64Y62MDR.mjs} +2 -2
- package/dist/{chunk-IVM5IBQS.mjs → chunk-6DVKR25T.mjs} +1 -1
- package/dist/{chunk-ADEALCJB.mjs → chunk-6IK2TDLH.mjs} +2 -2
- package/dist/{chunk-ES3IQZSH.mjs → chunk-6V7S5IG5.mjs} +2 -2
- package/dist/chunk-6VKIT2PF.mjs +10 -0
- package/dist/{chunk-NTUW55EB.mjs → chunk-7EOAYPSZ.mjs} +2 -2
- package/dist/{chunk-LZEZW5RE.mjs → chunk-7LQTLZJ5.mjs} +2 -2
- package/dist/{chunk-IOHULFEP.mjs → chunk-A4PXU7GU.mjs} +2 -2
- package/dist/chunk-A52PIXOO.mjs +10 -0
- package/dist/chunk-AANAI2XF.mjs +10 -0
- package/dist/{chunk-UQJB6AGO.mjs → chunk-AB7LDKP2.mjs} +1 -1
- package/dist/{chunk-BPLTQDXX.mjs → chunk-ACHYZYVA.mjs} +2 -2
- package/dist/{chunk-JB3UIJ3I.mjs → chunk-AFJ3QV2Q.mjs} +2 -2
- package/dist/{chunk-NQVTVL24.mjs → chunk-AIG23SN5.mjs} +2 -2
- package/dist/chunk-ASIKCQC6.mjs +10 -0
- package/dist/{chunk-DV72V6NI.mjs → chunk-AU3GNNEG.mjs} +2 -2
- package/dist/{chunk-45EAFDOZ.mjs → chunk-AYBI4SQV.mjs} +1 -1
- package/dist/chunk-BJHDL2HH.mjs +10 -0
- package/dist/chunk-BNWDQ4KX.mjs +10 -0
- package/dist/{chunk-QSFRMY47.mjs → chunk-BPXZ6J5G.mjs} +1 -1
- package/dist/{chunk-2UDXAKWA.mjs → chunk-C6TD53KY.mjs} +2 -2
- package/dist/chunk-CBQO7JUC.mjs +11 -0
- package/dist/{chunk-LN2NT32E.mjs → chunk-CE2W5D44.mjs} +1 -1
- package/dist/{chunk-UR42GQO4.mjs → chunk-CEUVH4UZ.mjs} +1 -1
- package/dist/chunk-CGBI7OB5.mjs +10 -0
- package/dist/chunk-CMM5JW7L.mjs +10 -0
- package/dist/chunk-CPX5CB4L.mjs +10 -0
- package/dist/{chunk-HMAVZPRE.mjs → chunk-CRNJAQPI.mjs} +1 -1
- package/dist/chunk-DIMNDTFC.mjs +10 -0
- package/dist/{chunk-KADD66HZ.mjs → chunk-DNZMQ7EA.mjs} +2 -2
- package/dist/{chunk-RFCTQQMD.mjs → chunk-DP76DMVO.mjs} +1 -1
- package/dist/{chunk-DZFNVFYT.mjs → chunk-EGSNIMDP.mjs} +1 -1
- package/dist/chunk-EHIGJYGW.mjs +10 -0
- package/dist/{chunk-U6M2GCPD.mjs → chunk-EJGGWOY5.mjs} +1 -1
- package/dist/chunk-EKRT3PPK.mjs +10 -0
- package/dist/{chunk-FDDB7QNQ.mjs → chunk-ELW6SXDM.mjs} +1 -1
- package/dist/{chunk-YQFS4UHL.mjs → chunk-EPWWEFTP.mjs} +1 -1
- package/dist/{chunk-VDUFLHKK.mjs → chunk-EYKQGC4O.mjs} +2 -2
- package/dist/{chunk-PLRUMLNB.mjs → chunk-FFPJBDWH.mjs} +1 -1
- package/dist/{chunk-KFJE5ZBK.mjs → chunk-G2IYZES5.mjs} +1 -1
- package/dist/chunk-G2RVM2KB.mjs +10 -0
- package/dist/{chunk-AALXW5AP.mjs → chunk-GAKWWL3Y.mjs} +1 -1
- package/dist/chunk-GHKMHXQ3.mjs +10 -0
- package/dist/{chunk-VYBJ36ZR.mjs → chunk-GJVQMTGA.mjs} +1 -1
- package/dist/chunk-GKPZBTRE.mjs +10 -0
- package/dist/{chunk-TN7FPPGM.mjs → chunk-GZTF5YE3.mjs} +1 -1
- package/dist/{chunk-RXADOJLS.mjs → chunk-HI56YXPJ.mjs} +2 -2
- package/dist/{chunk-R7Y36JCO.mjs → chunk-HOG4QRLG.mjs} +1 -1
- package/dist/chunk-HOV7MM7M.mjs +10 -0
- package/dist/{chunk-XKNL5LSL.mjs → chunk-HOZPCWCF.mjs} +2 -2
- package/dist/{chunk-IBBDZQPO.mjs → chunk-HVSDXCZP.mjs} +2 -2
- package/dist/{chunk-64ZD4EKW.mjs → chunk-I4F5NJUI.mjs} +1 -1
- package/dist/{chunk-DLJHL4V7.mjs → chunk-I5YPTKMM.mjs} +2 -2
- package/dist/chunk-IHCKLMWD.mjs +10 -0
- package/dist/chunk-IIYP5UE7.mjs +10 -0
- package/dist/{chunk-GXQQZWIP.mjs → chunk-IQ3Z6ZO2.mjs} +1 -1
- package/dist/{chunk-3COKCTB2.mjs → chunk-J4T6TE7V.mjs} +2 -2
- package/dist/{chunk-OS6PVCFX.mjs → chunk-JANI446W.mjs} +1 -1
- package/dist/{chunk-6MTVNQKW.mjs → chunk-JGKBJHX2.mjs} +1 -1
- package/dist/chunk-JQSZFPWJ.mjs +10 -0
- package/dist/{chunk-IDIZSV2Y.mjs → chunk-JYWJE6L5.mjs} +2 -2
- package/dist/{chunk-ARMWQYH2.mjs → chunk-KDNT54DP.mjs} +2 -2
- package/dist/{chunk-KMSNBINF.mjs → chunk-L42WN3AP.mjs} +2 -2
- package/dist/{chunk-SY24O432.mjs → chunk-L4MQCPRT.mjs} +3 -3
- package/dist/chunk-L7GYT3MC.mjs +10 -0
- package/dist/{chunk-6CSP66NI.mjs → chunk-LGE4377M.mjs} +1 -1
- package/dist/chunk-LJAVEZ2H.mjs +10 -0
- package/dist/{chunk-JDDA4R2D.mjs → chunk-LJM26E7W.mjs} +1 -1
- package/dist/chunk-LNEOOIXS.mjs +10 -0
- package/dist/{chunk-VSGVHATE.mjs → chunk-LPHX7UMQ.mjs} +1 -1
- package/dist/{chunk-L6ISOTLH.mjs → chunk-LZOXWIAS.mjs} +2 -2
- package/dist/{chunk-W3YUV7IF.mjs → chunk-M3NJURGR.mjs} +1 -1
- package/dist/{chunk-IIBBR266.mjs → chunk-MMLAKHLR.mjs} +3 -3
- package/dist/{chunk-Z7JRM3NW.mjs → chunk-MQCTOCK2.mjs} +2 -2
- package/dist/{chunk-X34RHNLT.mjs → chunk-NIAMDJYU.mjs} +2 -2
- package/dist/{chunk-WD2TPSZV.mjs → chunk-NIGOM3FD.mjs} +1 -1
- package/dist/{chunk-6NUHEJGL.mjs → chunk-NOTKA3RL.mjs} +1 -1
- package/dist/chunk-NYH6JQMA.mjs +10 -0
- package/dist/{chunk-SZNDCHMJ.mjs → chunk-OFEX3RHY.mjs} +1 -1
- package/dist/{chunk-GLIN7JAI.mjs → chunk-OJIOLYTM.mjs} +1 -1
- package/dist/chunk-OWXMAVXI.mjs +10 -0
- package/dist/chunk-OY57K37D.mjs +10 -0
- package/dist/{chunk-OO3ZVB2T.mjs → chunk-OYE6VSTU.mjs} +2 -2
- package/dist/{chunk-GIUNLLWW.mjs → chunk-P3RRGPNM.mjs} +2 -2
- package/dist/{chunk-GPT4DR4P.mjs → chunk-PGDGNOYE.mjs} +1 -1
- package/dist/{chunk-DPFX25HC.mjs → chunk-PITIJLE3.mjs} +1 -1
- package/dist/{chunk-RSKKEGJZ.mjs → chunk-PPGEEMZ2.mjs} +2 -2
- package/dist/{chunk-UKBBSYRC.mjs → chunk-PTL6NSYA.mjs} +2 -2
- package/dist/chunk-PV4E7XDP.mjs +10 -0
- package/dist/chunk-PZBJGZ57.mjs +10 -0
- package/dist/chunk-Q5SN5AQT.mjs +10 -0
- package/dist/{chunk-EISLHUT5.mjs → chunk-Q7BJGV4I.mjs} +1 -1
- package/dist/{chunk-R5JHN4X6.mjs → chunk-QDMG3P5Z.mjs} +1 -1
- package/dist/{chunk-RE7ZGPOY.mjs → chunk-QMFL5BMI.mjs} +1 -1
- package/dist/{chunk-JTGVIAOK.mjs → chunk-QMP72J5L.mjs} +1 -1
- package/dist/chunk-QMSBDXK6.mjs +10 -0
- package/dist/{chunk-JIGOXUY4.mjs → chunk-QPWBJW2X.mjs} +1 -1
- package/dist/{chunk-67QIBKUN.mjs → chunk-QRLUWOGW.mjs} +1 -1
- package/dist/{chunk-FTV6OWMI.mjs → chunk-QSNYILCF.mjs} +2 -2
- package/dist/chunk-QVXIFV7W.mjs +10 -0
- package/dist/{chunk-M7BCIQ2J.mjs → chunk-QYU7CWJD.mjs} +1 -1
- package/dist/{chunk-JC22ELJM.mjs → chunk-RGWXVYDG.mjs} +1 -1
- package/dist/{chunk-N4NDPTX6.mjs → chunk-RKPWFZB4.mjs} +1 -1
- package/dist/chunk-RM64ROGL.mjs +10 -0
- package/dist/{chunk-CIOPWCOS.mjs → chunk-RPV3UUIN.mjs} +2 -2
- package/dist/chunk-RS7TRDRM.mjs +10 -0
- package/dist/{chunk-CHBF3XQ6.mjs → chunk-S2MA4MRM.mjs} +1 -1
- package/dist/chunk-S3LWWMMQ.mjs +10 -0
- package/dist/{chunk-WID7IWNC.mjs → chunk-SL5Q4NLV.mjs} +1 -1
- package/dist/{chunk-A63HMTSM.mjs → chunk-SMPF53W4.mjs} +1 -1
- package/dist/{chunk-5MR5L5JZ.mjs → chunk-SQPWV3OX.mjs} +2 -2
- package/dist/chunk-ST3TDAOP.mjs +10 -0
- package/dist/{chunk-ENUU2IVX.mjs → chunk-SUJD4QFW.mjs} +1 -1
- package/dist/{chunk-OKEXEU3C.mjs → chunk-T7K4WI76.mjs} +1 -1
- package/dist/{chunk-DFMPVQM3.mjs → chunk-TJDL7HT5.mjs} +2 -2
- package/dist/{chunk-SI7LO2L4.mjs → chunk-TK33MBDB.mjs} +1 -1
- package/dist/{chunk-BK3RBPST.mjs → chunk-TLUB6FCT.mjs} +1 -1
- package/dist/{chunk-UBC32WQB.mjs → chunk-TMGB4HZ7.mjs} +1 -1
- package/dist/{chunk-ALMW6S4I.mjs → chunk-TQMBJFQC.mjs} +2 -2
- package/dist/{chunk-E6DZSC2G.mjs → chunk-TUSG5ZRW.mjs} +2 -2
- package/dist/{chunk-D2NVLRIU.mjs → chunk-TZSRU3GG.mjs} +1 -1
- package/dist/{chunk-WXILHRBE.mjs → chunk-U5XI3CZD.mjs} +1 -1
- package/dist/chunk-U6W7D7TT.mjs +10 -0
- package/dist/chunk-UC6WAEPH.mjs +10 -0
- package/dist/{chunk-TGLVJRZE.mjs → chunk-UXAMVDQ4.mjs} +1 -1
- package/dist/chunk-V2C4UDOC.mjs +10 -0
- package/dist/{chunk-5LGYS5CZ.mjs → chunk-V3DTS6FF.mjs} +1 -1
- package/dist/{chunk-AC44TKUI.mjs → chunk-V6ZIMZ53.mjs} +1 -1
- package/dist/{chunk-B5NICAFU.mjs → chunk-VGBHKFW7.mjs} +1 -1
- package/dist/{chunk-BSFG32AL.mjs → chunk-VOWLLVPD.mjs} +2 -2
- package/dist/chunk-W4DOEGYH.mjs +10 -0
- package/dist/chunk-WJBURR7M.mjs +10 -0
- package/dist/{chunk-MUQR2YER.mjs → chunk-WN4QRMX6.mjs} +2 -2
- package/dist/chunk-WSDEMATI.mjs +10 -0
- package/dist/{chunk-UPOQXYUI.mjs → chunk-XDORZSJQ.mjs} +1 -1
- package/dist/{chunk-6HTOSJOJ.mjs → chunk-Y5LEKSMM.mjs} +1 -1
- package/dist/{chunk-3JOOFCEF.mjs → chunk-YI5VNFT4.mjs} +2 -2
- package/dist/{chunk-PQIDCA7P.mjs → chunk-YYOOJMQZ.mjs} +1 -1
- package/dist/chunk-ZNZBHN2V.mjs +10 -0
- package/dist/chunk-ZOCNDYUQ.mjs +10 -0
- package/dist/{chunk-E2VXJPSE.mjs → chunk-ZRPR4V5U.mjs} +1 -1
- package/dist/chunk-ZY3ZKJVD.mjs +10 -0
- package/dist/{chunk-4PZGQTXE.mjs → chunk-ZZGRLSEK.mjs} +2 -2
- package/dist/hooks/useCommitEffect.mjs +1 -0
- package/dist/hooks/useDevice.mjs +1 -1
- package/dist/hooks/useI18n.mjs +1 -1
- package/dist/hooks/useIntersectionObserver.mjs +1 -1
- package/dist/hooks/useLiveInteractionModality.mjs +1 -1
- package/dist/hooks/useLocalStorage.mjs +1 -1
- package/dist/hooks/useMedia.mjs +1 -1
- package/dist/hooks/useMutationObserver.mjs +1 -1
- package/dist/hooks/usePortalContainer.mjs +1 -1
- package/dist/hooks/usePreventFocus.mjs +1 -1
- package/dist/hooks/useResizeObserver.mjs +1 -1
- package/dist/hooks/useTextSelection.mjs +1 -1
- package/dist/hooks/useUndoRedo.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +116 -40
- package/dist/index.js +22 -22
- package/dist/index.mjs +1 -1
- package/dist/react-aria.mjs +1 -1
- package/dist/utils/dom.mjs +1 -1
- package/dist/utils/isInShadowDOM.mjs +1 -1
- package/dist/utils/keyboards.mjs +1 -1
- package/dist/utils/objects.mjs +1 -1
- package/package.json +5 -5
- package/sbom.json +13 -13
- package/dist/chunk-25NW6ZEB.mjs +0 -10
- package/dist/chunk-2O4HB7UL.mjs +0 -10
- package/dist/chunk-35AM4QEA.mjs +0 -10
- package/dist/chunk-3V4W6OGG.mjs +0 -10
- package/dist/chunk-4HOAPQDQ.mjs +0 -10
- package/dist/chunk-5GZAORDK.mjs +0 -10
- package/dist/chunk-6LFOODXI.mjs +0 -10
- package/dist/chunk-6PBBHYCA.mjs +0 -10
- package/dist/chunk-B3W7VMJR.mjs +0 -10
- package/dist/chunk-C4XJOYAW.mjs +0 -10
- package/dist/chunk-D6AOHRAV.mjs +0 -10
- package/dist/chunk-DHZKZ3AV.mjs +0 -10
- package/dist/chunk-DRQHSYY3.mjs +0 -10
- package/dist/chunk-DZJTPX2G.mjs +0 -10
- package/dist/chunk-F4YBUGLD.mjs +0 -10
- package/dist/chunk-G76NJ3IU.mjs +0 -10
- package/dist/chunk-HNKEI45D.mjs +0 -10
- package/dist/chunk-INHZHYOF.mjs +0 -10
- package/dist/chunk-J7BCMF23.mjs +0 -10
- package/dist/chunk-JVD752FA.mjs +0 -10
- package/dist/chunk-JXJZIKEY.mjs +0 -10
- package/dist/chunk-K276BGP2.mjs +0 -10
- package/dist/chunk-KBLJ34QI.mjs +0 -10
- package/dist/chunk-KMZ3YVPE.mjs +0 -10
- package/dist/chunk-L5H5GE3H.mjs +0 -10
- package/dist/chunk-LHLY432N.mjs +0 -10
- package/dist/chunk-LXZOYBTL.mjs +0 -10
- package/dist/chunk-MPJXTZ6L.mjs +0 -10
- package/dist/chunk-MZIQ27JP.mjs +0 -10
- package/dist/chunk-NN6HKMC4.mjs +0 -10
- package/dist/chunk-NYNS3UDR.mjs +0 -10
- package/dist/chunk-OAOIUNNG.mjs +0 -10
- package/dist/chunk-OMCGORTH.mjs +0 -10
- package/dist/chunk-P6LYION6.mjs +0 -10
- package/dist/chunk-PJINRIA6.mjs +0 -10
- package/dist/chunk-PSUZMSD3.mjs +0 -10
- package/dist/chunk-Q3FYMLAA.mjs +0 -10
- package/dist/chunk-QVFGEXDU.mjs +0 -10
- package/dist/chunk-SYA6LAFU.mjs +0 -10
- package/dist/chunk-TEQHGF4G.mjs +0 -10
- package/dist/chunk-UCRJ3AR5.mjs +0 -10
- package/dist/chunk-UI4SJCQU.mjs +0 -10
- package/dist/chunk-V6DZG4PM.mjs +0 -11
- package/dist/chunk-VKWXATZ3.mjs +0 -10
- package/dist/chunk-VNJDCKLQ.mjs +0 -10
- package/dist/chunk-VQ45RUYJ.mjs +0 -10
- package/dist/chunk-VQHI3ZCW.mjs +0 -10
- package/dist/chunk-WBOFQ4BH.mjs +0 -10
- package/dist/chunk-XC5H4EVW.mjs +0 -10
- package/dist/chunk-Z7UPVYL5.mjs +0 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$
|
|
1
|
+
import {a as a$t}from'./chunk-JI4SJ53O.mjs';import {a as a$9}from'./chunk-AFJ3QV2Q.mjs';import {a as a$2}from'./chunk-WDWBYTJG.mjs';import {b as b$2}from'./chunk-BPW4QRPV.mjs';import {a as a$q}from'./chunk-U5XI3CZD.mjs';import {a as a$u}from'./chunk-TDYBXLYP.mjs';import {a as a$r}from'./chunk-K3WFKO7R.mjs';import {b as b$a}from'./chunk-HZM2XZP4.mjs';import {b as b$5,a as a$o}from'./chunk-HOZPCWCF.mjs';import {a as a$f}from'./chunk-PPGEEMZ2.mjs';import {b as b$3}from'./chunk-LNEOOIXS.mjs';import {b as b$7,c as c$1}from'./chunk-U6W7D7TT.mjs';import {f as f$1}from'./chunk-V6ZIMZ53.mjs';import {a as a$l}from'./chunk-5BAHJXOI.mjs';import {a as a$7}from'./chunk-FCKJCFMD.mjs';import {a as a$m}from'./chunk-NGZRN4SF.mjs';import {a as a$s}from'./chunk-YI5VNFT4.mjs';import {a as a$h}from'./chunk-ACHYZYVA.mjs';import {a as a$j}from'./chunk-C6TD53KY.mjs';import {a as a$k}from'./chunk-UC6WAEPH.mjs';import {a as a$p}from'./chunk-QMP72J5L.mjs';import {b as b$8,e as e$1}from'./chunk-G2RVM2KB.mjs';import {a as a$b}from'./chunk-JZXLV6JU.mjs';import {a as a$e}from'./chunk-EJGGWOY5.mjs';import {c,b}from'./chunk-JYWJE6L5.mjs';import {b as b$9}from'./chunk-P3RRGPNM.mjs';import {a as a$a}from'./chunk-DIL5HL6K.mjs';import {a as a$c}from'./chunk-L7GYT3MC.mjs';import {b as b$6,f as f$2}from'./chunk-CFDIUF4H.mjs';import {a as a$n}from'./chunk-NIGOM3FD.mjs';import {a as a$d}from'./chunk-5IC46G5J.mjs';import {b as b$4,j as j$1}from'./chunk-QDMG3P5Z.mjs';import {a as a$1}from'./chunk-FPM5UJRF.mjs';import {a as a$5}from'./chunk-3K6XNSYE.mjs';import {a as a$3}from'./chunk-ELW6SXDM.mjs';import {a as a$4}from'./chunk-LRFFL765.mjs';import {j}from'./chunk-AIG23SN5.mjs';import {e}from'./chunk-2MNK24YJ.mjs';import {f,g as g$1,a as a$i,c as c$2}from'./chunk-V2C4UDOC.mjs';import {a as a$8,b as b$1,j as j$2,h}from'./chunk-TYOEGCPS.mjs';import {a as a$g}from'./chunk-UBLCUHRL.mjs';import {a}from'./chunk-JQQGRJ5J.mjs';import {a as a$6}from'./chunk-4QEH5CGK.mjs';import {BoldIcon,ItalicIcon,UnderlineIcon,ArrowUpCircleFilledIcon,AtIcon,XCircleFilledIcon,LinkIcon,XIcon}from'@baseline-ui/icons/20';import {layoutSprinkleValues,sprinkles}from'@baseline-ui/tokens';import wt,{useCallback,useImperativeHandle,useEffect,useRef,useState,useMemo,useId,useContext,useLayoutEffect,Fragment as Fragment$1}from'react';import {useGranularLayoutEffect}from'granular-hooks';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import vi from'just-camel-case';import {QuestionmarkCircleIcon,TextIcon,HighlightTextIcon}from'@baseline-ui/icons/24';import*as br from'dompurify';import Ki from'just-kebab-case';import {createPortal}from'react-dom';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
@@ -7,24 +7,24 @@ import {a as a$s}from'./chunk-JI4SJ53O.mjs';import {a as a$9}from'./chunk-JB3UIJ
|
|
|
7
7
|
* This notice may not be removed from this file.
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
|
-
var Vo="f6jv6bm",Wo="_1yep5z64u _1yep5z64v _1yep5z64w _1yep5z676 _1yep5z677 _1yep5z678 _1yep5z6k8 _1yep5z6k9 _1yep5z6ka",it="_1yep5z689 _1yep5z68a _1yep5z68b _1yep5z65x _1yep5z65y _1yep5z65z",qo=a({defaultClassName:"f6jv6b0 _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6g9",variantClassNames:{isInline:{true:"f6jv6b1"},isMinimal:{true:"_1yep5z6160 _1yep5z6161 _1yep5z6162 _1yep5z6w4 _1yep5z6w5 _1yep5z6w6 _1yep5z616i _1yep5z616j _1yep5z616k",false:"_1yep5z6163 _1yep5z6164 _1yep5z6165"}},defaultVariants:{},compoundVariants:[[{isInline:true,isMinimal:false},"_1yep5z61jn _1yep5z61jo _1yep5z61jp _1yep5z61kb _1yep5z61kc _1yep5z61kd _1yep5z61kz _1yep5z61l0 _1yep5z61l1 _1yep5z61ln _1yep5z61lo _1yep5z61lp _1yep5z61vj _1yep5z61vh _1yep5z61qi"]]}),xt=a({defaultClassName:"f6jv6b4 _1yep5z69 _1yep5z6a _1yep5z6b _1yep5z62l _1yep5z62m _1yep5z62n _1yep5z63r _1yep5z63s _1yep5z63t _1yep5z61f _1yep5z61g _1yep5z61h _1yep5z6e3 _1yep5z6ey _1yep5z6m6",variantClassNames:{isDisabled:{true:"f6jv6b5 _1yep5z611l"}},defaultVariants:{},compoundVariants:[]}),$o="f6jv6b6",Go="f6jv6bj _1yep5z6x7 _1yep5z6x8 _1yep5z6x9 _1yep5z6xv _1yep5z6xw _1yep5z6xx _1yep5z6yj _1yep5z6yk _1yep5z6yl _1yep5z6z7 _1yep5z6z8 _1yep5z6z9",Yo="f6jv6bk";var Xo="f6jv6bn _1yep5z63l _1yep5z63m _1yep5z63n _1yep5z619 _1yep5z61a _1yep5z61b _1yep5z6ai _1yep5z6aj _1yep5z6ak _1yep5z6b6 _1yep5z6b7 _1yep5z6b8 _1yep5z6bu _1yep5z6bv _1yep5z6bw _1yep5z6ci _1yep5z6cj _1yep5z6ck _1yep5z6jb _1yep5z6jc _1yep5z6jd _1yep5z6me _1yep5z6m9 _1yep5z6m7 _1yep5z6id _1yep5z6ey",Zo=a({defaultClassName:"f6jv6bg _1yep5z63r _1yep5z63s _1yep5z63t _1yep5z61f _1yep5z61g _1yep5z61h _1yep5z63 _1yep5z64 _1yep5z65 _1yep5z62f _1yep5z62g _1yep5z62h _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jh _1yep5z6ji _1yep5z6jj _1yep5z6jz _1yep5z6k0 _1yep5z6k1 _1yep5z69l _1yep5z69m _1yep5z69n _1yep5z6m6 _1yep5z6lq _1yep5z6lt _1yep5z6m5",variantClassNames:{isHovered:{true:"_1yep5z612u"},isDisabled:{true:"_1yep5z6zt"}},defaultVariants:{},compoundVariants:[]}),Jo="_1yep5z6ke _1yep5z6kf _1yep5z6kg",Qo="f6jv6bf f6jv6bb _1yep5z6ai _1yep5z6aj _1yep5z6ak _1yep5z6b6 _1yep5z6b7 _1yep5z6b8 _1yep5z6j5 _1yep5z6j6 _1yep5z6j7 _1yep5z6ey _1yep5z6e3 _1yep5z6m3",er=a({defaultClassName:"f6jv6bc _1yep5z6ai _1yep5z6aj _1yep5z6ak _1yep5z6b6 _1yep5z6b7 _1yep5z6b8 _1yep5z6bu _1yep5z6bv _1yep5z6bw _1yep5z6ci _1yep5z6cj _1yep5z6ck _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jh _1yep5z6ji _1yep5z6jj _1yep5z69l _1yep5z69m _1yep5z69n _1yep5z6kk _1yep5z6kl _1yep5z6km",variantClassNames:{isInline:{true:"_1yep5z6q7 _1yep5z6q8 _1yep5z6q9 _1yep5z6190 _1yep5z618y _1yep5z613z",false:"_1yep5z6qa _1yep5z6qb _1yep5z6qc _1yep5z6xm _1yep5z6xn _1yep5z6xo _1yep5z6ya _1yep5z6yb _1yep5z6yc _1yep5z6yy _1yep5z6yz _1yep5z6z0 _1yep5z6zm _1yep5z6zn _1yep5z6zo"}},defaultVariants:{},compoundVariants:[]}),tr="f6jv6bl",nr="f6jv6bb _1yep5z6ai _1yep5z6aj _1yep5z6ak _1yep5z6b6 _1yep5z6b7 _1yep5z6b8 _1yep5z6j5 _1yep5z6j6 _1yep5z6j7 _1yep5z6ey",Wt=a({defaultClassName:"f6jv6b7",variantClassNames:{isInline:{true:"f6jv6b8",false:"f6jv6b9"}},defaultVariants:{},compoundVariants:[]}),qt="f6jv6ba _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jh _1yep5z6ji _1yep5z6jj _1yep5z6jz _1yep5z6k0 _1yep5z6k1",yt="f6jv6bo";var $t=wt.forwardRef(({value:t,defaultValue:e,onChange:n,placeholder:o,spellCheck:r,textBoxRef:i,isInline:s,isMinimal:l,isDisabled:a,editableContentAriaLabel:c$1,editorHandle:d,autoFocus:u,saveOnEnter:f,onSave:p},h)=>{let m=wt.useRef(null),[k,I]=a$1(t,e||"",n),$=useCallback(E=>{I(E.currentTarget.value||"");},[I]),w=useCallback(E=>{a$2(E)||(f&&E.key==="Enter"&&!E.shiftKey||(E.ctrlKey||E.metaKey)&&E.key==="Enter")&&(E.preventDefault(),p());},[f,p]);useImperativeHandle(h,()=>({clear:()=>{I("");}}));let j=useCallback(E=>{E.currentTarget.style.height="16px",E.currentTarget.style.height=E.currentTarget.scrollHeight+"px";},[]);useGranularLayoutEffect(()=>{let E=m.current;E&&(E.style.height="16px",E.style.height=E.scrollHeight+"px");},[l],[k]),useImperativeHandle(d,()=>({setCaretPosition:E=>{m.current&&(m.current.focus(),m.current.setSelectionRange(E,E));},focus:()=>{m.current&&m.current.focus();}}));let N=u===true||u==="start"||u==="end",D=typeof u=="string"?u:void 0;useEffect(()=>{if(D&&m.current){let E=D==="start"?0:D==="end"?m.current.value.length:void 0;E!==void 0&&m.current.setSelectionRange(E,E);}},[D]);let{focusProps:Q,isFocused:U,isFocusVisible:pe}=a$3(),{hoverProps:x,isHovered:M}=a$4({isDisabled:a}),G=a$5({"data-focus-visible":pe,"data-hovered":M,"data-focused":U});return jsx("textarea",{...c(Q,x,G),ref:b(m,i),className:a$6({[xt()]:!l,[Wt({isInline:s})]:!l,[nr]:!l,[Qo]:l},"BaselineUI-Editor-PlainEditorEditingArea"),autoFocus:N,onChange:$,disabled:a,onInput:j,value:k,placeholder:o,spellCheck:r,"aria-label":c$1,onKeyDown:w})});$t.displayName="PlainEditor";var sr=[["Toolbar Focus","Alt+F10"],["Bold","Ctrl+B"],["Italic","Ctrl+I"],["Underline","Ctrl+U"],["Select All","Ctrl+A"],["Cut","Ctrl+X"],["Copy","Ctrl+C"],["Paste","Ctrl+V"],["Undo","Ctrl+Z"],["Redo","Ctrl+Shift+Z"],["Submit","Ctrl+Enter"],["Open Help Dialog","Ctrl+Shift+H"]],{dialog:{row:bt}}=layoutSprinkleValues,lr=({isOpen:t,onClose:e,toolbarFocusLabel:n,helpLabel:o,closeLabel:r,actionLabel:i,shortcutLabel:s,boldLabel:l,italicLabel:a,underlineLabel:c,selectAllLabel:d,cutLabel:u,copyLabel:f,pasteLabel:p,undoLabel:h,redoLabel:m,openHelpDialogLabel:k,submitLabel:I})=>{let{formatMessage:$}=b$1(),w=c$3(),j={toolbarFocus:n,help:o,close:r,action:i,shortcut:s,bold:l,italic:a,underline:c,selectAll:d,cut:u,copy:f,paste:p,undo:h,redo:m,openHelpDialog:k,submit:I},N=D=>j[D]??$(Ti[D]);return jsx(b$9,{isOpen:t,onOpenChange:D=>{D||e();},children:jsx(e$1,{enableDrawer:"auto",style:{zIndex:999999},children:jsxs(a$j,{"aria-labelledby":w,className:Go,drawerBackground:"subtle",children:[jsxs(a$a,{paddingLeft:bt.padding.horizontal.lg,paddingRight:bt.padding.horizontal.sm,display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",backgroundColor:"background.primary.subtle",className:Yo,children:[jsx(a$o,{id:w,elementType:"h3",type:"title",size:"md",children:N("help")}),jsx(a$c,{icon:XIcon,size:"md",variant:"secondary","aria-label":N("close"),"data-testid":"editor-help-dialog-close-button",onPress:e})]}),jsx(a$b,{className:tr}),jsxs(a$a,{paddingX:bt.padding.horizontal.lg,role:"table","aria-labelledby":w,backgroundColor:"background.primary.subtle",children:[jsx("div",{role:"rowgroup",children:jsxs(a$a,{role:"row",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingY:bt.padding.vertical.md,color:"text.primary",children:[jsx("h6",{className:sprinkles({typography:"heading.h6.semibold"}),role:"columnheader",children:N("action")}),jsx("h6",{className:sprinkles({typography:"heading.h6.semibold"}),role:"columnheader",style:{textTransform:"capitalize"},children:N("shortcut")})]})}),jsx("div",{role:"rowgroup",children:sr.map(([D,Q],U)=>jsxs(Fragment$1,{children:[jsxs(a$a,{role:"row",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingY:bt.padding.vertical.xs,style:{minHeight:40},children:[jsx(a$o,{type:"subtitle",size:"sm",role:"cell",children:N(bi(D))}),jsx(a$o,{elementType:"kbd",type:"subtitle",size:"sm",role:"cell",children:a$p(Q,true)})]}),U!==sr.length-1&&jsx(a$b,{})]},D))})]})]})})})},Ti=c$1({toolbarFocus:{id:"bui.editor.toolbarFocus",defaultMessage:"Toolbar Focus"},help:{id:"bui.editor.help",defaultMessage:"Help"},close:{id:"bui.editor.close",defaultMessage:"Close"},action:{id:"bui.editor.action",defaultMessage:"Action"},shortcut:{id:"bui.editor.shortcut",defaultMessage:"Shortcut"},bold:{id:"bui.editor.bold",defaultMessage:"Bold"},italic:{id:"bui.editor.italic",defaultMessage:"Italic"},underline:{id:"bui.editor.underline",defaultMessage:"Underline"},selectAll:{id:"bui.editor.selectAll",defaultMessage:"Select All"},cut:{id:"bui.editor.cut",defaultMessage:"Cut"},copy:{id:"bui.editor.copy",defaultMessage:"Copy"},paste:{id:"bui.editor.paste",defaultMessage:"Paste"},undo:{id:"bui.editor.undo",defaultMessage:"Undo"},redo:{id:"bui.editor.redo",defaultMessage:"Redo"},openHelpDialog:{id:"bui.editor.openHelpDialog",defaultMessage:"Open Help Dialog"},submit:{id:"bui.editor.submit",defaultMessage:"Submit"}});var vi=a$7("#ffffff00").toString("hexa"),Mn=[{label:"Red",color:"#ff0000"},{label:"Green",color:"#00ff00"},{label:"Blue",color:"#0000ff"},{label:"Yellow",color:"#ffff00"},{label:"Cyan",color:"#00ffff"},{label:"Magenta",color:"#ff00ff"},{label:"Black",color:"#000000"},{label:"White",color:"#ffffff"},{label:"Gray",color:"#808080"},{label:"Orange",color:"#ffa500"},{label:"Brown",color:"#a52a2a"},{label:"Purple",color:"#800080"}];[...Mn,{label:"Transparent",color:vi}];var lt="p",X="a",ce="mention",Me="mention_input";function Ln(t,e){return typeof t=="object"&&t!==null&&"type"in t&&t.type===e}function g(t){return typeof t=="object"&&t!==null&&"text"in t&&!("type"in t)}function R(t){return Ln(t,X)}function oe(t){return Ln(t,ce)}function Z(t){return Ln(t,Me)}function re(t){return oe(t)||Z(t)}function ge(){return [{type:lt,children:[{text:""}]}]}function Et(t,e){return t.bold===e.bold&&t.italic===e.italic&&t.underline===e.underline&&b$b(t.color,e.color)&&b$b(t.backgroundColor,e.backgroundColor)&&t.fontFamily===e.fontFamily&&t.fontSize===e.fontSize}function ar(t,e){return t.text===e.text&&Et(t,e)}function Ri(t,e){return g(t)?g(e)&&ar(t,e):g(e)||t.type!==e.type||t.children.length!==e.children.length||R(t)&&R(e)&&t.url!==e.url||oe(t)&&oe(e)&&(t.value!==e.value||t.displayName!==e.displayName)?false:t.children.every((n,o)=>ar(n,e.children[o]))}function dr(t,e){return t.length===e.length&&t.every((n,o)=>Sn(n,e[o]))}function Sn(t,e){return t.textAlign===e.textAlign&&t.children.length===e.children.length&&t.children.every((n,o)=>Ri(n,e.children[o]))}function Cn(t){let[e]=t.children;return t.children.length===1&&g(e)&&e.text===""}function ur(t,e){let n=(a,c)=>Sn(a,c)||Cn(a)&&Cn(c)&&a.textAlign===c.textAlign,o=Math.min(t.length,e.length),r=0;for(;r<o&&n(t[r],e[r]);)r+=1;let i=0;for(;i<o-r&&n(t[t.length-1-i],e[e.length-1-i]);)i+=1;let s=null,l=(a,c)=>{let d=e[c];!Cn(d)||Sn(t[a],d)||(s??=[...t],s[a]=d);};for(let a=0;a<r;a++)l(a,a);for(let a=0;a<i;a++)l(t.length-1-a,e.length-1-a);return s??t}function Gt(t,e){let n=false;for(let i=0;i<t.length;i++){let s=t[i];if(s.text===""&&!(e&&t.length===1)){n=true;break}if(i>0&&Et(t[i-1],s)){n=true;break}}if(!n)return t;let o=t.filter(i=>i.text!==""),r=[];for(let i of o){let s=r.at(-1);s!==void 0&&Et(s,i)?r[r.length-1]={...s,text:s.text+i.text}:r.push(i);}return r}function ki(t){let e=(i,s)=>i===0&&s===t.length||i>0&&re(t[i-1]),n=false,o=-1;for(let i=0;i<=t.length;i++){let s=t[i],l=i<t.length&&g(s);if(l&&o===-1)o=i;else if(!l&&o!==-1){let a=t.slice(o,i);if(Gt(a,e(o,i))!==a){n=true;break}o=-1;}}if(!n)return t;let r=[];o=-1;for(let i=0;i<=t.length;i++){let s=t[i],l=i<t.length&&g(s);if(l&&o===-1)o=i;else if(!l&&o!==-1){let a=t.slice(o,i),c=Gt(a,e(o,i));for(let d of c)r.push(d);o=-1;}!l&&i<t.length&&r.push(s);}return r}function Mi(t){let e=false;for(let o=1;o<t.length;o++){let r=t[o-1],i=t[o];if(R(r)&&R(i)&&r.url===i.url){e=true;break}}if(!e)return t;let n=[];for(let o of t){let r=n.at(-1);if(R(o)&&r!==void 0&&R(r)&&r.url===o.url){let i=Gt([...r.children,...o.children],false);n[n.length-1]={...r,children:i};}else n.push(o);}return n}function Ci(t){let e=Gt(t.children,t.children.length===1);return e.reduce((o,r)=>o+r.text,"")===""?null:e===t.children?t:{...t,children:e}}function Si(t){let e=false,n=[];for(let a of t)if(R(a)){let c=Ci(a);c===null?e=true:(n.push(c),c!==a&&(e=true));}else n.push(a);let o=e?n:t,r=ki(o),i=Mi(r),s=(a,c)=>re(a[c])&&(c===a.length-1||!g(a[c+1])),l=i;if(i.some((a,c)=>s(i,c))){l=[];for(let[a,c]of i.entries())l.push(c),s(i,a)&&l.push({text:""});}return l.length===0?[{text:""}]:l===o&&!e?t:l}function L(t){if(t.length===0)return ge();let e=false,n=t.map(o=>{let r=Si(o.children);return r===o.children?o:(e=true,{...o,children:r})});return e?n:t}function Tt(t,e){let n=e>0&&e<t.length&&/[\uD800-\uDBFF]/.test(t[e-1]);return t.slice(0,n?e-1:e)}function Li(t,e){let n=[],o=e;for(let r of t){if(o<=0)break;n.push(r.text.length>o?{...r,text:Tt(r.text,o)}:r),o-=r.text.length;}return n}function Di(t,e){let n=[],o=e;for(let r of t){let i=B(r);if(i<=o)n.push(r),o-=i;else if(g(r)){n.push({...r,text:Tt(r.text,o)});break}else if(R(r)){n.push({...r,children:Li(r.children,o)});break}else break}return n}function cr(t){return t.reduce((e,n)=>e+B(n),0)}function Dn(t,e){if(A(t)<=e)return t;let n=[],o=e;for(let[r,i]of t.entries()){if(r>0){if(o===0)break;o-=1;}let s=Di(i.children,o);n.push({...i,children:s});let l=cr(s);if(l<cr(i.children))break;o-=l;}return L(n)}function fr(t){throw new Error(`Editor: unknown inline node "${String(t.type)}".`)}function zi(t){if(g(t))return t.text;switch(t.type){case X:return t.children.map(e=>e.text).join("");case ce:return t.displayName;case Me:return t.children[0].text;default:return fr(t)}}function zn(t){return t.map(e=>e.children.map(n=>zi(n)).join("")).join(`
|
|
11
|
-
`)}function B(t){if(g(t))return t.text.length;switch(t.type){case X:{let e=0;for(let n=0;n<t.children.length;n++)e+=t.children[n].text.length;return e}case ce:return t.displayName.length;case
|
|
10
|
+
var qo="f6jv6bm",$o="_1yep5z64u _1yep5z64v _1yep5z64w _1yep5z676 _1yep5z677 _1yep5z678 _1yep5z6k8 _1yep5z6k9 _1yep5z6ka",it="_1yep5z689 _1yep5z68a _1yep5z68b _1yep5z65x _1yep5z65y _1yep5z65z",Go=a({defaultClassName:"f6jv6b0 _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6g9",variantClassNames:{isInline:{true:"f6jv6b1"},isMinimal:{true:"_1yep5z6160 _1yep5z6161 _1yep5z6162 _1yep5z6w4 _1yep5z6w5 _1yep5z6w6 _1yep5z616i _1yep5z616j _1yep5z616k",false:"_1yep5z6163 _1yep5z6164 _1yep5z6165"}},defaultVariants:{},compoundVariants:[[{isInline:true,isMinimal:false},"_1yep5z61jn _1yep5z61jo _1yep5z61jp _1yep5z61kb _1yep5z61kc _1yep5z61kd _1yep5z61kz _1yep5z61l0 _1yep5z61l1 _1yep5z61ln _1yep5z61lo _1yep5z61lp _1yep5z61vj _1yep5z61vh _1yep5z61qi"]]}),xt=a({defaultClassName:"f6jv6b4 _1yep5z69 _1yep5z6a _1yep5z6b _1yep5z62l _1yep5z62m _1yep5z62n _1yep5z63r _1yep5z63s _1yep5z63t _1yep5z61f _1yep5z61g _1yep5z61h _1yep5z6e3 _1yep5z6ey _1yep5z6m6",variantClassNames:{isDisabled:{true:"f6jv6b5 _1yep5z611l"}},defaultVariants:{},compoundVariants:[]}),Yo="f6jv6b6",Xo="f6jv6bj _1yep5z6x7 _1yep5z6x8 _1yep5z6x9 _1yep5z6xv _1yep5z6xw _1yep5z6xx _1yep5z6yj _1yep5z6yk _1yep5z6yl _1yep5z6z7 _1yep5z6z8 _1yep5z6z9",Zo="f6jv6bk";var Jo="f6jv6bn _1yep5z63l _1yep5z63m _1yep5z63n _1yep5z619 _1yep5z61a _1yep5z61b _1yep5z6ai _1yep5z6aj _1yep5z6ak _1yep5z6b6 _1yep5z6b7 _1yep5z6b8 _1yep5z6bu _1yep5z6bv _1yep5z6bw _1yep5z6ci _1yep5z6cj _1yep5z6ck _1yep5z6jb _1yep5z6jc _1yep5z6jd _1yep5z6me _1yep5z6m9 _1yep5z6m7 _1yep5z6id _1yep5z6ey",Qo=a({defaultClassName:"f6jv6bg _1yep5z63r _1yep5z63s _1yep5z63t _1yep5z61f _1yep5z61g _1yep5z61h _1yep5z63 _1yep5z64 _1yep5z65 _1yep5z62f _1yep5z62g _1yep5z62h _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jh _1yep5z6ji _1yep5z6jj _1yep5z6jz _1yep5z6k0 _1yep5z6k1 _1yep5z69l _1yep5z69m _1yep5z69n _1yep5z6m6 _1yep5z6lq _1yep5z6lt _1yep5z6m5",variantClassNames:{isHovered:{true:"_1yep5z612u"},isDisabled:{true:"_1yep5z6zt"}},defaultVariants:{},compoundVariants:[]}),er="_1yep5z6ke _1yep5z6kf _1yep5z6kg",tr="f6jv6bf f6jv6bb _1yep5z6ai _1yep5z6aj _1yep5z6ak _1yep5z6b6 _1yep5z6b7 _1yep5z6b8 _1yep5z6j5 _1yep5z6j6 _1yep5z6j7 _1yep5z6ey _1yep5z6e3 _1yep5z6m3",nr=a({defaultClassName:"f6jv6bc _1yep5z6ai _1yep5z6aj _1yep5z6ak _1yep5z6b6 _1yep5z6b7 _1yep5z6b8 _1yep5z6bu _1yep5z6bv _1yep5z6bw _1yep5z6ci _1yep5z6cj _1yep5z6ck _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jh _1yep5z6ji _1yep5z6jj _1yep5z69l _1yep5z69m _1yep5z69n _1yep5z6kk _1yep5z6kl _1yep5z6km",variantClassNames:{isInline:{true:"_1yep5z6q7 _1yep5z6q8 _1yep5z6q9 _1yep5z6190 _1yep5z618y _1yep5z613z",false:"_1yep5z6qa _1yep5z6qb _1yep5z6qc _1yep5z6xm _1yep5z6xn _1yep5z6xo _1yep5z6ya _1yep5z6yb _1yep5z6yc _1yep5z6yy _1yep5z6yz _1yep5z6z0 _1yep5z6zm _1yep5z6zn _1yep5z6zo"}},defaultVariants:{},compoundVariants:[]}),or="f6jv6bl",rr="f6jv6bb _1yep5z6ai _1yep5z6aj _1yep5z6ak _1yep5z6b6 _1yep5z6b7 _1yep5z6b8 _1yep5z6j5 _1yep5z6j6 _1yep5z6j7 _1yep5z6ey",Wt=a({defaultClassName:"f6jv6b7",variantClassNames:{isInline:{true:"f6jv6b8",false:"f6jv6b9"}},defaultVariants:{},compoundVariants:[]}),qt="f6jv6ba _1yep5z6j8 _1yep5z6j9 _1yep5z6ja _1yep5z6jh _1yep5z6ji _1yep5z6jj _1yep5z6jz _1yep5z6k0 _1yep5z6k1",yt="f6jv6bo";var $t=wt.forwardRef(({value:t,defaultValue:e,onChange:n,placeholder:o,spellCheck:r,textBoxRef:i,isInline:s,isMinimal:l,isDisabled:a,editableContentAriaLabel:c,editorHandle:d,autoFocus:u,saveOnEnter:f$1,onSave:p},h)=>{let m=wt.useRef(null),[k,I]=a$1(t,e||"",n),$=useCallback(E=>{I(E.currentTarget.value||"");},[I]),w=useCallback(E=>{a$2(E)||(f$1&&E.key==="Enter"&&!E.shiftKey||(E.ctrlKey||E.metaKey)&&E.key==="Enter")&&(E.preventDefault(),p());},[f$1,p]);useImperativeHandle(h,()=>({clear:()=>{I("");}}));let j=useCallback(E=>{E.currentTarget.style.height="16px",E.currentTarget.style.height=E.currentTarget.scrollHeight+"px";},[]);useGranularLayoutEffect(()=>{let E=m.current;E&&(E.style.height="16px",E.style.height=E.scrollHeight+"px");},[l],[k]),useImperativeHandle(d,()=>({setCaretPosition:E=>{m.current&&(m.current.focus(),m.current.setSelectionRange(E,E));},focus:()=>{m.current&&m.current.focus();}}));let N=u===true||u==="start"||u==="end",D=typeof u=="string"?u:void 0;useEffect(()=>{if(D&&m.current){let E=D==="start"?0:D==="end"?m.current.value.length:void 0;E!==void 0&&m.current.setSelectionRange(E,E);}},[D]);let{focusProps:Q,isFocused:U,isFocusVisible:pe}=a$3(),{hoverProps:x,isHovered:M}=a$4({isDisabled:a}),G=a$5({"data-focus-visible":pe,"data-hovered":M,"data-focused":U});return jsx("textarea",{...g$1(Q,x,G),ref:f(m,i),className:a$6({[xt()]:!l,[Wt({isInline:s})]:!l,[rr]:!l,[tr]:l},"BaselineUI-Editor-PlainEditorEditingArea"),autoFocus:N,onChange:$,disabled:a,onInput:j,value:k,placeholder:o,spellCheck:r,"aria-label":c,onKeyDown:w})});$t.displayName="PlainEditor";var ar=[["Toolbar Focus","Alt+F10"],["Bold","Ctrl+B"],["Italic","Ctrl+I"],["Underline","Ctrl+U"],["Select All","Ctrl+A"],["Cut","Ctrl+X"],["Copy","Ctrl+C"],["Paste","Ctrl+V"],["Undo","Ctrl+Z"],["Redo","Ctrl+Shift+Z"],["Submit","Ctrl+Enter"],["Open Help Dialog","Ctrl+Shift+H"]],{dialog:{row:bt}}=layoutSprinkleValues,cr=({isOpen:t,onClose:e,toolbarFocusLabel:n,helpLabel:o,closeLabel:r,actionLabel:i,shortcutLabel:s,boldLabel:l,italicLabel:a,underlineLabel:c,selectAllLabel:d,cutLabel:u,copyLabel:f,pasteLabel:p,undoLabel:h,redoLabel:m,openHelpDialogLabel:k,submitLabel:I})=>{let{formatMessage:$}=b(),w=c$2(),j={toolbarFocus:n,help:o,close:r,action:i,shortcut:s,bold:l,italic:a,underline:c,selectAll:d,cut:u,copy:f,paste:p,undo:h,redo:m,openHelpDialog:k,submit:I},N=D=>j[D]??$(ki[D]);return jsx(b$8,{isOpen:t,onOpenChange:D=>{D||e();},children:jsx(e$1,{enableDrawer:"auto",style:{zIndex:999999},children:jsxs(a$k,{"aria-labelledby":w,className:Xo,drawerBackground:"subtle",children:[jsxs(a$a,{paddingLeft:bt.padding.horizontal.lg,paddingRight:bt.padding.horizontal.sm,display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",backgroundColor:"background.primary.subtle",className:Zo,children:[jsx(a$p,{id:w,elementType:"h3",type:"title",size:"md",children:N("help")}),jsx(a$c,{icon:XIcon,size:"md",variant:"secondary","aria-label":N("close"),"data-testid":"editor-help-dialog-close-button",onPress:e})]}),jsx(a$b,{className:or}),jsxs(a$a,{paddingX:bt.padding.horizontal.lg,role:"table","aria-labelledby":w,backgroundColor:"background.primary.subtle",children:[jsx("div",{role:"rowgroup",children:jsxs(a$a,{role:"row",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingY:bt.padding.vertical.md,color:"text.primary",children:[jsx("h6",{className:sprinkles({typography:"heading.h6.semibold"}),role:"columnheader",children:N("action")}),jsx("h6",{className:sprinkles({typography:"heading.h6.semibold"}),role:"columnheader",style:{textTransform:"capitalize"},children:N("shortcut")})]})}),jsx("div",{role:"rowgroup",children:ar.map(([D,Q],U)=>jsxs(Fragment$1,{children:[jsxs(a$a,{role:"row",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingY:bt.padding.vertical.xs,style:{minHeight:40},children:[jsx(a$p,{type:"subtitle",size:"sm",role:"cell",children:N(vi(D))}),jsx(a$p,{elementType:"kbd",type:"subtitle",size:"sm",role:"cell",children:a$q(Q,true)})]}),U!==ar.length-1&&jsx(a$b,{})]},D))})]})]})})})},ki=c({toolbarFocus:{id:"bui.editor.toolbarFocus",defaultMessage:"Toolbar Focus"},help:{id:"bui.editor.help",defaultMessage:"Help"},close:{id:"bui.editor.close",defaultMessage:"Close"},action:{id:"bui.editor.action",defaultMessage:"Action"},shortcut:{id:"bui.editor.shortcut",defaultMessage:"Shortcut"},bold:{id:"bui.editor.bold",defaultMessage:"Bold"},italic:{id:"bui.editor.italic",defaultMessage:"Italic"},underline:{id:"bui.editor.underline",defaultMessage:"Underline"},selectAll:{id:"bui.editor.selectAll",defaultMessage:"Select All"},cut:{id:"bui.editor.cut",defaultMessage:"Cut"},copy:{id:"bui.editor.copy",defaultMessage:"Copy"},paste:{id:"bui.editor.paste",defaultMessage:"Paste"},undo:{id:"bui.editor.undo",defaultMessage:"Undo"},redo:{id:"bui.editor.redo",defaultMessage:"Redo"},openHelpDialog:{id:"bui.editor.openHelpDialog",defaultMessage:"Open Help Dialog"},submit:{id:"bui.editor.submit",defaultMessage:"Submit"}});var Mi=a$7("#ffffff00").toString("hexa"),Mn=[{label:"Red",color:"#ff0000"},{label:"Green",color:"#00ff00"},{label:"Blue",color:"#0000ff"},{label:"Yellow",color:"#ffff00"},{label:"Cyan",color:"#00ffff"},{label:"Magenta",color:"#ff00ff"},{label:"Black",color:"#000000"},{label:"White",color:"#ffffff"},{label:"Gray",color:"#808080"},{label:"Orange",color:"#ffa500"},{label:"Brown",color:"#a52a2a"},{label:"Purple",color:"#800080"}];[...Mn,{label:"Transparent",color:Mi}];var lt="p",X="a",ce="mention",Ce="mention_input";function Ln(t,e){return typeof t=="object"&&t!==null&&"type"in t&&t.type===e}function g(t){return typeof t=="object"&&t!==null&&"text"in t&&!("type"in t)}function R(t){return Ln(t,X)}function oe(t){return Ln(t,ce)}function Z(t){return Ln(t,Ce)}function re(t){return oe(t)||Z(t)}function xe(){return [{type:lt,children:[{text:""}]}]}function Et(t,e){return t.bold===e.bold&&t.italic===e.italic&&t.underline===e.underline&&b$a(t.color,e.color)&&b$a(t.backgroundColor,e.backgroundColor)&&t.fontFamily===e.fontFamily&&t.fontSize===e.fontSize}function dr(t,e){return t.text===e.text&&Et(t,e)}function Ci(t,e){return g(t)?g(e)&&dr(t,e):g(e)||t.type!==e.type||t.children.length!==e.children.length||R(t)&&R(e)&&t.url!==e.url||oe(t)&&oe(e)&&(t.value!==e.value||t.displayName!==e.displayName)?false:t.children.every((n,o)=>dr(n,e.children[o]))}function fr(t,e){return t.length===e.length&&t.every((n,o)=>Sn(n,e[o]))}function Sn(t,e){return t.textAlign===e.textAlign&&t.children.length===e.children.length&&t.children.every((n,o)=>Ci(n,e.children[o]))}function Cn(t){let[e]=t.children;return t.children.length===1&&g(e)&&e.text===""}function pr(t,e){let n=(a,c)=>Sn(a,c)||Cn(a)&&Cn(c)&&a.textAlign===c.textAlign,o=Math.min(t.length,e.length),r=0;for(;r<o&&n(t[r],e[r]);)r+=1;let i=0;for(;i<o-r&&n(t[t.length-1-i],e[e.length-1-i]);)i+=1;let s=null,l=(a,c)=>{let d=e[c];!Cn(d)||Sn(t[a],d)||(s??=[...t],s[a]=d);};for(let a=0;a<r;a++)l(a,a);for(let a=0;a<i;a++)l(t.length-1-a,e.length-1-a);return s??t}function Gt(t,e){let n=false;for(let i=0;i<t.length;i++){let s=t[i];if(s.text===""&&!(e&&t.length===1)){n=true;break}if(i>0&&Et(t[i-1],s)){n=true;break}}if(!n)return t;let o=t.filter(i=>i.text!==""),r=[];for(let i of o){let s=r.at(-1);s!==void 0&&Et(s,i)?r[r.length-1]={...s,text:s.text+i.text}:r.push(i);}return r}function Si(t){let e=(i,s)=>i===0&&s===t.length||i>0&&re(t[i-1]),n=false,o=-1;for(let i=0;i<=t.length;i++){let s=t[i],l=i<t.length&&g(s);if(l&&o===-1)o=i;else if(!l&&o!==-1){let a=t.slice(o,i);if(Gt(a,e(o,i))!==a){n=true;break}o=-1;}}if(!n)return t;let r=[];o=-1;for(let i=0;i<=t.length;i++){let s=t[i],l=i<t.length&&g(s);if(l&&o===-1)o=i;else if(!l&&o!==-1){let a=t.slice(o,i),c=Gt(a,e(o,i));for(let d of c)r.push(d);o=-1;}!l&&i<t.length&&r.push(s);}return r}function Li(t){let e=false;for(let o=1;o<t.length;o++){let r=t[o-1],i=t[o];if(R(r)&&R(i)&&r.url===i.url){e=true;break}}if(!e)return t;let n=[];for(let o of t){let r=n.at(-1);if(R(o)&&r!==void 0&&R(r)&&r.url===o.url){let i=Gt([...r.children,...o.children],false);n[n.length-1]={...r,children:i};}else n.push(o);}return n}function Di(t){let e=Gt(t.children,t.children.length===1);return e.reduce((o,r)=>o+r.text,"")===""?null:e===t.children?t:{...t,children:e}}function zi(t){let e=false,n=[];for(let a of t)if(R(a)){let c=Di(a);c===null?e=true:(n.push(c),c!==a&&(e=true));}else n.push(a);let o=e?n:t,r=Si(o),i=Li(r),s=(a,c)=>re(a[c])&&(c===a.length-1||!g(a[c+1])),l=i;if(i.some((a,c)=>s(i,c))){l=[];for(let[a,c]of i.entries())l.push(c),s(i,a)&&l.push({text:""});}return l.length===0?[{text:""}]:l===o&&!e?t:l}function L(t){if(t.length===0)return xe();let e=false,n=t.map(o=>{let r=zi(o.children);return r===o.children?o:(e=true,{...o,children:r})});return e?n:t}function Tt(t,e){let n=e>0&&e<t.length&&/[\uD800-\uDBFF]/.test(t[e-1]);return t.slice(0,n?e-1:e)}function Pi(t,e){let n=[],o=e;for(let r of t){if(o<=0)break;n.push(r.text.length>o?{...r,text:Tt(r.text,o)}:r),o-=r.text.length;}return n}function wi(t,e){let n=[],o=e;for(let r of t){let i=B(r);if(i<=o)n.push(r),o-=i;else if(g(r)){n.push({...r,text:Tt(r.text,o)});break}else if(R(r)){n.push({...r,children:Pi(r.children,o)});break}else break}return n}function ur(t){return t.reduce((e,n)=>e+B(n),0)}function Dn(t,e){if(A(t)<=e)return t;let n=[],o=e;for(let[r,i]of t.entries()){if(r>0){if(o===0)break;o-=1;}let s=wi(i.children,o);n.push({...i,children:s});let l=ur(s);if(l<ur(i.children))break;o-=l;}return L(n)}function hr(t){throw new Error(`Editor: unknown inline node "${String(t.type)}".`)}function Ai(t){if(g(t))return t.text;switch(t.type){case X:return t.children.map(e=>e.text).join("");case ce:return t.displayName;case Ce:return t.children[0].text;default:return hr(t)}}function zn(t){return t.map(e=>e.children.map(n=>Ai(n)).join("")).join(`
|
|
11
|
+
`)}function B(t){if(g(t))return t.text.length;switch(t.type){case X:{let e=0;for(let n=0;n<t.children.length;n++)e+=t.children[n].text.length;return e}case ce:return t.displayName.length;case Ce:return t.children[0].text.length;default:return hr(t)}}function A(t){if(t.length===0)return 0;let e=t.length-1;for(let n of t)for(let o of n.children)e+=B(o);return e}var vt=["color","backgroundColor"],gr=["color","backgroundColor","fontFamily","fontSize","textAlign"],Ii=1,wn=3;function Rt(t){return t.nodeType===Ii}function at(t,e){return t.tagName.toLowerCase()===e}function _i(t){if(!Rt(t))return false;let e=t.tagName.toLowerCase();return e==="p"||e==="div"}function Ni(t){return Rt(t)&&t.querySelector("p, div")!==null}var Oi=new RegExp("["+String.fromCodePoint(8203)+String.fromCodePoint(65279)+"]","g"),Bi=String.fromCodePoint(160);function Ue(t){return t.replaceAll(Oi,"").replaceAll(Bi," ")}function Yt(t,e,n){let o={...e},r=t.tagName.toLowerCase();(r==="b"||r==="strong")&&(o.bold=true),(r==="i"||r==="em")&&(o.italic=true),r==="u"&&(o.underline=true);let i=t.style;if(i){let s=i.fontWeight;(s==="bold"||Number.parseInt(s,10)>=600&&s!=="")&&(o.bold=true),i.fontStyle==="italic"&&(o.italic=true),i.textDecoration?.includes("underline")&&(o.underline=true);let l=i.color;l&&n.includes("color")&&(o.color=l);let a=i.backgroundColor;a&&n.includes("backgroundColor")&&(o.backgroundColor=a);let c=i.fontFamily;c&&n.includes("fontFamily")&&(o.fontFamily=c);let d=i.fontSize;d&&n.includes("fontSize")&&(o.fontSize=d);}return o}function Xt(t,e,n,o,r){for(let i=0;i<t.childNodes.length;i++){let s=t.childNodes[i];if(s.nodeType===wn){let a=s.nodeValue??"",c=Ue(a);c.length>0&&o.push(kt(c,e));continue}if(!Rt(s))continue;if(at(s,"span")&&s.dataset.userId!==void 0){let a=s.dataset.userId??"",c=s.textContent??"",d=c.startsWith("@")?c.slice(1):c;o.push({type:ce,value:a,displayName:d,children:[{text:""}]});continue}if(at(s,"span")&&s.dataset.mentionAnchor!==void 0){let a=s.textContent??"";o.push({type:Ce,children:[{text:a}]});continue}if(at(s,"a")){let a=Yt(s,e,r);{let c=s.getAttribute("href")??"",d=[];xr(s,a,d,r);let u=An(d);u.some(p=>p.text.length>0)&&o.push({type:X,url:c,children:u});}continue}if(at(s,"br")){o.push({text:"\0BR\0"});continue}let l=Yt(s,e,r);Xt(s,l,n,o,r);}}function xr(t,e,n,o){for(let r=0;r<t.childNodes.length;r++){let i=t.childNodes[r];if(i.nodeType===wn){let l=i.nodeValue??"",a=Ue(l);a.length>0&&n.push(kt(a,e));continue}if(!Rt(i))continue;if(at(i,"br")){n.push({text:"\0BR\0"});continue}let s=Yt(i,e,o);xr(i,s,n,o);}}function kt(t,e){let n={text:t};return e.bold&&(n.bold=true),e.italic&&(n.italic=true),e.underline&&(n.underline=true),e.color&&(n.color=e.color),e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.fontFamily&&(n.fontFamily=e.fontFamily),e.fontSize&&(n.fontSize=e.fontSize),n}var yr="\0BR\0";function An(t){let e=[...t];if(e.length===1&&Pn(e[0]))return [{text:""}];let n=e.length,o=0;for(;o<n&&Pn(e[n-1-o]);)o+=1;let r=o>=2?o-1:0;n-=o;let i=[];for(let s=0;s<n;s++){let l=e[s];Pn(l)?mr(i):i.push(l);}for(let s=0;s<r;s++)mr(i);return i}function Pn(t){return "text"in t&&t.text===yr}function mr(t){let e=t.at(-1);e!==void 0&&"text"in e&&!("type"in e)?e.text+=`
|
|
12
12
|
`:t.push({text:`
|
|
13
|
-
`});}function
|
|
13
|
+
`});}function Fi(t,e){let n=[];Xt(t,Yt(t,{},e),false,n,e);let o=An(n),r=e.includes("textAlign")?t.style?.textAlign:void 0;return {type:lt,...r?{textAlign:r}:{},children:o.length>0?o:[{text:""}]}}function Zt(t,e=vt){let n=t.childNodes;if(n.length===0)return xe();let o=[],r=[];function i(){if(r.length===0)return;let l=An(r);o.push({type:lt,children:l.length>0?l:[{text:""}]}),r=[];}function s(l){for(let a of l)if(_i(a))i(),o.push(Fi(a,e));else if(a.nodeType===wn){let c=a.nodeValue??"",d=Ue(c);d.trim().length>0&&r.push({text:d});}else Rt(a)&&(at(a,"br")?r.push({text:yr}):Ni(a)?(i(),s(a.childNodes)):Xt(a,{},false,r,e));}return s(n),i(),o.length===0?xe():L(o)}function Hi(t){return Object.entries(t).map(([e,n])=>`${Ki(e)}:${n}`).filter(([,e])=>!!e).join(";")}function In(t){return !t.color&&!t.backgroundColor&&!t.fontFamily&&!t.fontSize?"":Hi(a$5({color:Ve(t.color),backgroundColor:Ve(t.backgroundColor),fontFamily:Ve(t.fontFamily),fontSize:Ve(t.fontSize)}))}function Er(t){return "text"in t}function Ve(t){if(!(t===void 0||/[;{}]|url\(/i.test(t)))return t}function ct(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function ye(t){let e=t.trim(),n=e.replaceAll(/[\u0000- ]/g,""),o=/^([a-z][a-z0-9+.-]*):/i.exec(n);if(!o)return e;let r=o[1].toLowerCase();return new Set(["javascript","data","vbscript"]).has(r)?"":e}function _n(t){let e=t.trim();if(/^[/#?.]/.test(e))return e;let n=/^([^/:?#]+):\d+(?:[/?#]|$)/.exec(e)?.[1];if(n==="localhost"||n?.includes("."))return `https://${e}`;try{return new URL(e),e}catch{return `https://${e}`}}function Tr(t,e){if(!(e.mac?e.metaKey:e.ctrlKey))return {isLinkClick:false,url:null};let o=t?.closest?.("a")??null;if(!o)return {isLinkClick:false,url:null};let r=ye(o.getAttribute("href")??"");return {isLinkClick:true,url:r===""?null:r}}function ji(t){return t.text.includes(`
|
|
14
14
|
`)?t.text.split(`
|
|
15
|
-
`).map(n=>{let o={text:n};return n.length>0&&(t.bold!==void 0&&(o.bold=t.bold),t.italic!==void 0&&(o.italic=t.italic),t.underline!==void 0&&(o.underline=t.underline),t.color!==void 0&&(o.color=t.color),t.backgroundColor!==void 0&&(o.backgroundColor=t.backgroundColor),t.fontFamily!==void 0&&(o.fontFamily=t.fontFamily),t.fontSize!==void 0&&(o.fontSize=t.fontSize)),o}):[t]}function Ki(t){let e=[[]],n=0;for(let o of t)if(yr(o)){let r=Fi(o);for(let i=0;i<r.length;i++)e[n].push(r[i]),i<r.length-1&&(n++,e[n]=[]);}else e[n].push(o);return e}function ie(t){if(!t)return "";function e(n){if(yr(n)){if(n.text==="")return "";let r=ct(n.text);n.bold&&(r=`<b>${r}</b>`),n.italic&&(r=`<i>${r}</i>`),n.underline&&(r=`<u>${r}</u>`);let i=In(n);return i&&(r=`<span style="${ct(i)}">${r}</span>`),r}let o=n.children?.map(r=>ie(r)).join("");switch(n.type){case lt:{let r=Ki(n.children),i=Ve(n.textAlign),s=i?`<p style="text-align:${ct(i)}">`:"<p>";return r.map(l=>{let a=l.map(c=>ie(c)).join("");return `${s}${a}</p>`}).join("")}case X:return `<a href="${ct(xe(n.url))}">${o}</a>`;case ce:return `<span data-user-id="${ct(n.value)}">${ct(n.displayName)}</span>`;default:return o}}return Array.isArray(t)?t.map(n=>e(n)).join(""):e(t)}function Nn(t,e=vt){let n=new DOMParser().parseFromString(xr.default.sanitize(t),"text/html");if(!n.body.querySelector("p, div")){let o=n.createElement("p");o.append(...n.body.childNodes),n.body.append(o);}return Zt(n.body,e)}var Hi=new Set(["(","[","{","<",'"',"'","`","\xAB"]),ji=new Set([".",",","!","?",":",";",'"',"'","`","\xBB"]),Ui=new Map([[")","("],["]","["],["}","{"]]);function Er(t,e){let n=0;for(let o of t)o===e&&n++;return n}function Jt(t){let e=0,n=t.length;for(;e<n&&Hi.has(t[e]);)e++;for(;n>e;){let s=t[n-1];if(ji.has(s)){n--;continue}let l=Ui.get(s);if(l!==void 0){let a=t.slice(e,n);if(Er(a,s)>Er(a,l)){n--;continue}}break}if(n<=e)return null;let o=t.slice(e,n),r;if(/^https?:\/\//i.test(o))r=o;else if(/^www\./i.test(o)){if(o.length<=4)return null;r=`https://${o}`;}else return null;let i;try{i=new URL(r);}catch{return null}return i.hostname===""?null:{start:e,end:n,url:r}}function Vi(t){let e=[],n=/\S+/g,o;for(;(o=n.exec(t))!==null;){let r=Jt(o[0]);if(r){let i=o.index+r.start,s=o.index+r.end;e.push({start:i,end:s,text:t.slice(i,s),url:r.url});}}return e}function Tr(t){let e=t.trim();if(e===""||/\s/.test(e))return null;let n=Jt(e);return n&&n.start===0&&n.end===e.length?n.url:null}function Wi(t){let e=Vi(t.text);if(e.length===0)return null;let n=[],o=0;for(let r of e)r.start>o&&n.push({...t,text:t.text.slice(o,r.start)}),n.push({type:X,url:r.url,children:[{...t,text:r.text}]}),o=r.end;return o<t.text.length&&n.push({...t,text:t.text.slice(o)}),n}function On(t){let e=false,n=t.map(o=>{let r=false,i=[];for(let s of o.children){let l=g(s)?Wi(s):null;l?(i.push(...l),r=true):i.push(s);}return r?(e=true,{...o,children:i}):o});return e?n:t}function vr(t){return oe(t)?0:B(t)}function Rr(t){return t.children.reduce((e,n)=>e+B(n),0)}function Bn(t,e,n){return Math.min(Math.max(t,e),n)}function J(t,e){return t.path[0]!==e.path[0]?t.path[0]<e.path[0]?-1:1:t.path[1]!==e.path[1]?t.path[1]<e.path[1]?-1:1:t.offset!==e.offset?t.offset<e.offset?-1:1:0}function z(t){return J(t.anchor,t.focus)===0}function Fn(t){return J(t.anchor,t.focus)<=0?t:{anchor:t.focus,focus:t.anchor}}function de(t,e){let n=Bn(e.path[0],0,t.length-1),o=t[n].children,r=Bn(e.path[1],0,o.length-1),i=Bn(e.offset,0,vr(o[r]));return {path:[n,r],offset:i}}function we(t){return {path:[0,0],offset:0}}function Ae(t){let e=t.length-1,n=t[e].children,o=n.length-1;return {path:[e,o],offset:vr(n[o])}}function P(t,e){let n=Math.max(e,0);for(let o=0;o<t.length;o++){let r=t[o],i=Rr(r);if(n>i){n-=i+1;continue}let s=r.children;for(let l=0;l<s.length;l++){let a=s[l],c=B(a);if(oe(a)){if(n===0)return {path:[o,l],offset:0};if(n<c)return {path:[o,l+1],offset:0}}else if(n<=c)return {path:[o,l],offset:n};n-=c;}}return Ae(t)}function C(t,e){let[n,o]=e.path,r=0;for(let s=0;s<n;s++)r+=Rr(t[s])+1;let i=t[n].children;for(let s=0;s<o;s++)r+=B(i[s]);return r+e.offset}function We(t){let e={};for(let[n,o]of Object.entries(t))o!==null&&Object.assign(e,{[n]:o});return e}var dt=Object.freeze({bold:false,italic:false,underline:false}),Kn=["color","backgroundColor","fontFamily","fontSize"];function Ie(t,e,n,o,r){let i=n==="atomic";if(t<o.path[0]||t>r.path[0])return null;let s=0;if(t===o.path[0]){if(e<o.path[1])return null;e===o.path[1]&&(s=i?0:o.offset);}let l=i?1:n;if(t===r.path[0]){if(e>r.path[1])return null;e===r.path[1]&&(l=i?r.offset>0?1:0:r.offset);}return s>=l?null:{from:s,to:l}}function Hn(t,e,n){let o=0;for(let r of t.children)n(r,Math.max(e.from-o,0),Math.min(e.to-o,r.text.length)),o+=r.text.length;}function Mr(t,e,n,o){for(let r=e.path[0];r<=n.path[0]&&r<t.length;r++){let i=t[r].children;for(let[s,l]of i.entries())if(!re(l)){if(g(l)){let a=Ie(r,s,l.text.length,e,n);a&&o(l,a.from,a.to);}else if(R(l)){let a=Ie(r,s,B(l),e,n);a&&Hn(l,a,(c,d,u)=>{d<u&&o(c,d,u);});}}}}function Cr(t){return g(t)?t:R(t)?t.children.at(-1)??null:null}function Sr(t,e){let n=de(t,e),o=t[n.path[0]].children,r=o[n.path[1]],i=n.path[1]>0?Cr(o[n.path[1]-1]):null;if(g(r))return n.offset>0?r:i??r;if(R(r)){if(n.offset===0)return i??r.children[0]??null;let s=0;for(let l of r.children)if(s+=l.text.length,n.offset<=s)return l;return r.children.at(-1)??null}return Z(r)?n.offset>0?r.children[0]:i??r.children[0]:i}function kr(t){let e={bold:!!t.bold,italic:!!t.italic,underline:!!t.underline};return t.color!==void 0&&(e.color=t.color),t.backgroundColor!==void 0&&(e.backgroundColor=t.backgroundColor),t.fontFamily!==void 0&&(e.fontFamily=t.fontFamily),t.fontSize!==void 0&&(e.fontSize=t.fontSize),e}function qi(t,e){let n={};t.bold!==void 0&&t.bold===e.bold&&(n.bold=t.bold),t.italic!==void 0&&t.italic===e.italic&&(n.italic=t.italic),t.underline!==void 0&&t.underline===e.underline&&(n.underline=t.underline);for(let o of Kn){let r=t[o],i=e[o];if(r===void 0&&i===void 0)continue;let s=o==="color"||o==="backgroundColor"?b$b(r??void 0,i??void 0):r===i;n[o]=s&&r!=null?r:null;}return n}function ye(t,e){if(z(e)){let s=Sr(t,e.focus);return s?kr(s):{...dt}}let n=Fn(e),o=de(t,n.anchor),r=de(t,n.focus),i=null;return Mr(t,o,r,s=>{let l=kr(s);i=i===null?l:qi(i,l);}),i??{...dt}}function Qt(t,e,n){if(n===t)return {doc:t,range:e};let o=L(n);return {doc:o,range:{anchor:P(o,C(t,de(t,e.anchor))),focus:P(o,C(t,de(t,e.focus)))}}}function Lr(t,e,n,o){let r={...t,text:t.text.slice(e,n)},i=o(r);if(Et(i,r))return null;let s=[];return e>0&&s.push({...t,text:t.text.slice(0,e)}),s.push(i),n<t.text.length&&s.push({...t,text:t.text.slice(n)}),s}function $i(t,e,n){let o=false,r=[];return Hn(t,e,(i,s,l)=>{let a=s<l?Lr(i,s,l,n):null;a?(r.push(...a),o=true):r.push(i);}),o?{...t,children:r}:null}function Dr(t,e,n,o){let r=false,i=t.map((s,l)=>{if(l<e.path[0]||l>n.path[0])return s;let a=false,c=[];for(let[d,u]of s.children.entries())if(g(u)){let f=Ie(l,d,u.text.length,e,n),p=f?Lr(u,f.from,f.to,o):null;p?(c.push(...p),a=true):c.push(u);}else if(R(u)){let f=Ie(l,d,B(u),e,n),p=f?$i(u,f,o):null;p?(c.push(p),a=true):c.push(u);}else c.push(u);return a?(r=true,{...s,children:c}):s});return r?i:t}function qe(t,e){let n=Fn(e);return [de(t,n.anchor),de(t,n.focus)]}function en(t,e,n){if(z(e))return {doc:t,range:e};let[o,r]=qe(t,e),i=false,s=true;return Mr(t,o,r,a=>{i=true,a[n]||(s=false);}),i?Qt(t,e,Dr(t,o,r,s?a=>{let c={...a};return delete c[n],c}:a=>a[n]?a:{...a,[n]:true})):{doc:t,range:e}}function tn(t,e,n,o){if(z(e))return {doc:t,range:e};let[r,i]=qe(t,e);return Qt(t,e,Dr(t,r,i,l=>{if(l[n]===o)return l;let a={...l};return o===void 0?delete a[n]:a[n]=o,a}))}function zr(t,e){let n=[],o=[],r=0;for(let i of t){let s=r+i.text.length;s<=e?n.push(i):r>=e?o.push(i):(n.push({...i,text:i.text.slice(0,e-r)}),o.push({...i,text:i.text.slice(e-r)})),r=s;}return [n,o]}function ue(t,e,n){if(e>=t.length)return [[...t],[]];let o=t.slice(0,e),r=t.slice(e+1),i=t[e];if(g(i))o.push({...i,text:i.text.slice(0,n)}),r.unshift({...i,text:i.text.slice(n)});else if(R(i)){let[s,l]=zr(i.children,n);o.push({...i,children:s}),r.unshift({...i,children:l});}else n===0?r.unshift(i):o.push(i);return [o,r]}function jn(t,e){let[n,o]=qe(t,e);for(let r=n.path[0];r<=o.path[0]&&r<t.length;r++)for(let[i,s]of t[r].children.entries()){if(!R(s))continue;let l={path:[r,i],offset:0},a={path:[r,i],offset:B(s)};if(J(n,a)<=0&&J(o,l)>=0)return {paragraphIndex:r,inlineIndex:i,link:s}}return null}function Pr(t,e){let n=jn(t,e);if(!n)return null;let{paragraphIndex:o,inlineIndex:r,link:i}=n;return {url:i.url,range:{anchor:{path:[o,r],offset:0},focus:{path:[o,r],offset:B(i)}}}}function wr(t,e){let[n,o]=qe(t,e);for(let r=n.path[0];r<=o.path[0]&&r<t.length;r++)for(let[i,s]of t[r].children.entries()){if(g(s))continue;let l=re(s)?"atomic":B(s);if(Ie(r,i,l,n,o))return true}return false}function Gi(t,e,n,o){let r=[],i=(s,l,a)=>{l<a&&r.push({...s,text:s.text.slice(l,a)});};for(let[s,l]of t[e].children.entries())if(!re(l)){if(g(l)){let a=Ie(e,s,l.text.length,n,o);a&&i(l,a.from,a.to);}else if(R(l)){let a=Ie(e,s,B(l),n,o);a&&Hn(l,a,i);}}return r}function Un(t,e,n){if(z(e))return {doc:t,range:e};let[o,r]=qe(t,e);for(let l=o.path[0];l<=r.path[0]&&l<t.length;l++)for(let[a,c]of t[l].children.entries())if(re(c)&&Ie(l,a,"atomic",o,r))return {doc:t,range:e};let i=false,s=t.map((l,a)=>{if(a<o.path[0]||a>r.path[0])return l;let c=Gi(t,a,o,r);if(c.length===0)return l;let d=l.children,[u]=a===o.path[0]?ue(d,o.path[1],o.offset):[[]],f=a===r.path[0]?ue(d,r.path[1],r.offset)[1]:[];return i=true,{...l,children:[...u,{type:X,url:n,children:c},...f]}});return i?Qt(t,e,s):{doc:t,range:e}}function Ar(t,e,n){let o=jn(t,e);if(!o||o.link.url===n)return {doc:t,range:e};let{paragraphIndex:r,inlineIndex:i,link:s}=o,l=t.map((a,c)=>c!==r?a:{...a,children:a.children.map((d,u)=>u===i?{...s,url:n}:d)});return {doc:L(l),range:e}}function Ir(t,e){let n=jn(t,e);if(!n)return {doc:t,range:e};let{paragraphIndex:o,inlineIndex:r,link:i}=n,s=t.map((l,a)=>a!==o?l:{...l,children:l.children.flatMap((c,d)=>d===r?i.children:[c])});return Qt(t,e,s)}function $e(t,e){if(z(e))return {doc:t,range:e};let[n,o]=qe(t,e);if(J(n,o)===0)return {doc:t,range:e};let r=C(t,n),i=ue(t[n.path[0]].children,n.path[1],n.offset)[0],s=ue(t[o.path[0]].children,o.path[1],o.offset)[1],l={...t[n.path[0]],children:[...i,...s]},a=L([...t.slice(0,n.path[0]),l,...t.slice(o.path[0]+1)]),c=P(a,r);return {doc:a,range:{anchor:c,focus:c}}}function Vn(t,e){if(z(e))return ge();let[n,o]=qe(t,e);if(J(n,o)===0)return ge();let r=t[n.path[0]],i=t[o.path[0]],s;if(r===i){let l=ue(r.children,o.path[1],o.offset)[0];s=[{...r,children:ue(l,n.path[1],n.offset)[1]}];}else s=[{...r,children:ue(r.children,n.path[1],n.offset)[1]},...t.slice(n.path[0]+1,o.path[0]),{...i,children:ue(i.children,o.path[1],o.offset)[0]}];return structuredClone(L(s.map(l=>({...l,children:l.children.map(a=>Z(a)?{text:a.children[0].text}:a)}))))}function Mt(t,e,n){let o=de(t,e);if(n==="")return {doc:t,range:{anchor:o,focus:o}};let r=Sr(t,o),i=r?{...r,text:n}:{text:n},s=o.path[0],l=t[s].children,a=l[o.path[1]],c;if(R(a)&&o.offset>0&&o.offset<B(a)){let[f,p]=zr(a.children,o.offset),h={...a,children:[...f,i,...p]};c=l.map((m,k)=>k===o.path[1]?h:m);}else {let[f,p]=ue(l,o.path[1],o.offset);c=[...f,i,...p];}let d=L(t.map((f,p)=>p===s?{...f,children:c}:f)),u=P(d,C(t,o)+n.length);return {doc:d,range:{anchor:u,focus:u}}}function Wn(t,e,n){let o=L(n),r=A(o),i=t,s;if(z(e))s=de(t,e.focus);else {let p=$e(t,e);i=p.doc,s=p.range.focus;}if(o.length===1&&r===0)return {doc:i,range:{anchor:s,focus:s}};let l=s.path[0],[a,c]=ue(i[l].children,s.path[1],s.offset),d=o.length===1?[{...i[l],children:[...a,...o[0].children,...c]}]:[{...i[l],children:[...a,...o[0].children]},...o.slice(1,-1),{...i[l],children:[...o.at(-1).children,...c]}],u=L([...i.slice(0,l),...d,...i.slice(l+1)]),f=P(u,C(i,s)+r);return {doc:u,range:{anchor:f,focus:f}}}function _r(t,e){if(z(e))return Mt(t,e.focus,`
|
|
15
|
+
`).map(n=>{let o={text:n};return n.length>0&&(t.bold!==void 0&&(o.bold=t.bold),t.italic!==void 0&&(o.italic=t.italic),t.underline!==void 0&&(o.underline=t.underline),t.color!==void 0&&(o.color=t.color),t.backgroundColor!==void 0&&(o.backgroundColor=t.backgroundColor),t.fontFamily!==void 0&&(o.fontFamily=t.fontFamily),t.fontSize!==void 0&&(o.fontSize=t.fontSize)),o}):[t]}function Ui(t){let e=[[]],n=0;for(let o of t)if(Er(o)){let r=ji(o);for(let i=0;i<r.length;i++)e[n].push(r[i]),i<r.length-1&&(n++,e[n]=[]);}else e[n].push(o);return e}function ie(t){if(!t)return "";function e(n){if(Er(n)){if(n.text==="")return "";let r=ct(n.text);n.bold&&(r=`<b>${r}</b>`),n.italic&&(r=`<i>${r}</i>`),n.underline&&(r=`<u>${r}</u>`);let i=In(n);return i&&(r=`<span style="${ct(i)}">${r}</span>`),r}let o=n.children?.map(r=>ie(r)).join("");switch(n.type){case lt:{let r=Ui(n.children),i=Ve(n.textAlign),s=i?`<p style="text-align:${ct(i)}">`:"<p>";return r.map(l=>{let a=l.map(c=>ie(c)).join("");return `${s}${a}</p>`}).join("")}case X:return `<a href="${ct(ye(n.url))}">${o}</a>`;case ce:return `<span data-user-id="${ct(n.value)}">${ct(n.displayName)}</span>`;default:return o}}return Array.isArray(t)?t.map(n=>e(n)).join(""):e(t)}function Nn(t,e=vt){let n=new DOMParser().parseFromString(br.default.sanitize(t),"text/html");if(!n.body.querySelector("p, div")){let o=n.createElement("p");o.append(...n.body.childNodes),n.body.append(o);}return Zt(n.body,e)}var Vi=new Set(["(","[","{","<",'"',"'","`","\xAB"]),Wi=new Set([".",",","!","?",":",";",'"',"'","`","\xBB"]),qi=new Map([[")","("],["]","["],["}","{"]]);function vr(t,e){let n=0;for(let o of t)o===e&&n++;return n}function Jt(t){let e=0,n=t.length;for(;e<n&&Vi.has(t[e]);)e++;for(;n>e;){let s=t[n-1];if(Wi.has(s)){n--;continue}let l=qi.get(s);if(l!==void 0){let a=t.slice(e,n);if(vr(a,s)>vr(a,l)){n--;continue}}break}if(n<=e)return null;let o=t.slice(e,n),r;if(/^https?:\/\//i.test(o))r=o;else if(/^www\./i.test(o)){if(o.length<=4)return null;r=`https://${o}`;}else return null;let i;try{i=new URL(r);}catch{return null}return i.hostname===""?null:{start:e,end:n,url:r}}function $i(t){let e=[],n=/\S+/g,o;for(;(o=n.exec(t))!==null;){let r=Jt(o[0]);if(r){let i=o.index+r.start,s=o.index+r.end;e.push({start:i,end:s,text:t.slice(i,s),url:r.url});}}return e}function Rr(t){let e=t.trim();if(e===""||/\s/.test(e))return null;let n=Jt(e);return n&&n.start===0&&n.end===e.length?n.url:null}function Gi(t){let e=$i(t.text);if(e.length===0)return null;let n=[],o=0;for(let r of e)r.start>o&&n.push({...t,text:t.text.slice(o,r.start)}),n.push({type:X,url:r.url,children:[{...t,text:r.text}]}),o=r.end;return o<t.text.length&&n.push({...t,text:t.text.slice(o)}),n}function On(t){let e=false,n=t.map(o=>{let r=false,i=[];for(let s of o.children){let l=g(s)?Gi(s):null;l?(i.push(...l),r=true):i.push(s);}return r?(e=true,{...o,children:i}):o});return e?n:t}function kr(t){return oe(t)?0:B(t)}function Mr(t){return t.children.reduce((e,n)=>e+B(n),0)}function Bn(t,e,n){return Math.min(Math.max(t,e),n)}function J(t,e){return t.path[0]!==e.path[0]?t.path[0]<e.path[0]?-1:1:t.path[1]!==e.path[1]?t.path[1]<e.path[1]?-1:1:t.offset!==e.offset?t.offset<e.offset?-1:1:0}function z(t){return J(t.anchor,t.focus)===0}function Fn(t){return J(t.anchor,t.focus)<=0?t:{anchor:t.focus,focus:t.anchor}}function de(t,e){let n=Bn(e.path[0],0,t.length-1),o=t[n].children,r=Bn(e.path[1],0,o.length-1),i=Bn(e.offset,0,kr(o[r]));return {path:[n,r],offset:i}}function we(t){return {path:[0,0],offset:0}}function Ae(t){let e=t.length-1,n=t[e].children,o=n.length-1;return {path:[e,o],offset:kr(n[o])}}function P(t,e){let n=Math.max(e,0);for(let o=0;o<t.length;o++){let r=t[o],i=Mr(r);if(n>i){n-=i+1;continue}let s=r.children;for(let l=0;l<s.length;l++){let a=s[l],c=B(a);if(oe(a)){if(n===0)return {path:[o,l],offset:0};if(n<c)return {path:[o,l+1],offset:0}}else if(n<=c)return {path:[o,l],offset:n};n-=c;}}return Ae(t)}function C(t,e){let[n,o]=e.path,r=0;for(let s=0;s<n;s++)r+=Mr(t[s])+1;let i=t[n].children;for(let s=0;s<o;s++)r+=B(i[s]);return r+e.offset}function We(t){let e={};for(let[n,o]of Object.entries(t))o!==null&&Object.assign(e,{[n]:o});return e}var dt=Object.freeze({bold:false,italic:false,underline:false}),Kn=["color","backgroundColor","fontFamily","fontSize"];function Ie(t,e,n,o,r){let i=n==="atomic";if(t<o.path[0]||t>r.path[0])return null;let s=0;if(t===o.path[0]){if(e<o.path[1])return null;e===o.path[1]&&(s=i?0:o.offset);}let l=i?1:n;if(t===r.path[0]){if(e>r.path[1])return null;e===r.path[1]&&(l=i?r.offset>0?1:0:r.offset);}return s>=l?null:{from:s,to:l}}function Hn(t,e,n){let o=0;for(let r of t.children)n(r,Math.max(e.from-o,0),Math.min(e.to-o,r.text.length)),o+=r.text.length;}function Sr(t,e,n,o){for(let r=e.path[0];r<=n.path[0]&&r<t.length;r++){let i=t[r].children;for(let[s,l]of i.entries())if(!re(l)){if(g(l)){let a=Ie(r,s,l.text.length,e,n);a&&o(l,a.from,a.to);}else if(R(l)){let a=Ie(r,s,B(l),e,n);a&&Hn(l,a,(c,d,u)=>{d<u&&o(c,d,u);});}}}}function Lr(t){return g(t)?t:R(t)?t.children.at(-1)??null:null}function Dr(t,e){let n=de(t,e),o=t[n.path[0]].children,r=o[n.path[1]],i=n.path[1]>0?Lr(o[n.path[1]-1]):null;if(g(r))return n.offset>0?r:i??r;if(R(r)){if(n.offset===0)return i??r.children[0]??null;let s=0;for(let l of r.children)if(s+=l.text.length,n.offset<=s)return l;return r.children.at(-1)??null}return Z(r)?n.offset>0?r.children[0]:i??r.children[0]:i}function Cr(t){let e={bold:!!t.bold,italic:!!t.italic,underline:!!t.underline};return t.color!==void 0&&(e.color=t.color),t.backgroundColor!==void 0&&(e.backgroundColor=t.backgroundColor),t.fontFamily!==void 0&&(e.fontFamily=t.fontFamily),t.fontSize!==void 0&&(e.fontSize=t.fontSize),e}function Yi(t,e){let n={};t.bold!==void 0&&t.bold===e.bold&&(n.bold=t.bold),t.italic!==void 0&&t.italic===e.italic&&(n.italic=t.italic),t.underline!==void 0&&t.underline===e.underline&&(n.underline=t.underline);for(let o of Kn){let r=t[o],i=e[o];if(r===void 0&&i===void 0)continue;let s=o==="color"||o==="backgroundColor"?b$a(r??void 0,i??void 0):r===i;n[o]=s&&r!=null?r:null;}return n}function be(t,e){if(z(e)){let s=Dr(t,e.focus);return s?Cr(s):{...dt}}let n=Fn(e),o=de(t,n.anchor),r=de(t,n.focus),i=null;return Sr(t,o,r,s=>{let l=Cr(s);i=i===null?l:Yi(i,l);}),i??{...dt}}function Qt(t,e,n){if(n===t)return {doc:t,range:e};let o=L(n);return {doc:o,range:{anchor:P(o,C(t,de(t,e.anchor))),focus:P(o,C(t,de(t,e.focus)))}}}function zr(t,e,n,o){let r={...t,text:t.text.slice(e,n)},i=o(r);if(Et(i,r))return null;let s=[];return e>0&&s.push({...t,text:t.text.slice(0,e)}),s.push(i),n<t.text.length&&s.push({...t,text:t.text.slice(n)}),s}function Xi(t,e,n){let o=false,r=[];return Hn(t,e,(i,s,l)=>{let a=s<l?zr(i,s,l,n):null;a?(r.push(...a),o=true):r.push(i);}),o?{...t,children:r}:null}function Pr(t,e,n,o){let r=false,i=t.map((s,l)=>{if(l<e.path[0]||l>n.path[0])return s;let a=false,c=[];for(let[d,u]of s.children.entries())if(g(u)){let f=Ie(l,d,u.text.length,e,n),p=f?zr(u,f.from,f.to,o):null;p?(c.push(...p),a=true):c.push(u);}else if(R(u)){let f=Ie(l,d,B(u),e,n),p=f?Xi(u,f,o):null;p?(c.push(p),a=true):c.push(u);}else c.push(u);return a?(r=true,{...s,children:c}):s});return r?i:t}function qe(t,e){let n=Fn(e);return [de(t,n.anchor),de(t,n.focus)]}function en(t,e,n){if(z(e))return {doc:t,range:e};let[o,r]=qe(t,e),i=false,s=true;return Sr(t,o,r,a=>{i=true,a[n]||(s=false);}),i?Qt(t,e,Pr(t,o,r,s?a=>{let c={...a};return delete c[n],c}:a=>a[n]?a:{...a,[n]:true})):{doc:t,range:e}}function tn(t,e,n,o){if(z(e))return {doc:t,range:e};let[r,i]=qe(t,e);return Qt(t,e,Pr(t,r,i,l=>{if(l[n]===o)return l;let a={...l};return o===void 0?delete a[n]:a[n]=o,a}))}function wr(t,e){let n=[],o=[],r=0;for(let i of t){let s=r+i.text.length;s<=e?n.push(i):r>=e?o.push(i):(n.push({...i,text:i.text.slice(0,e-r)}),o.push({...i,text:i.text.slice(e-r)})),r=s;}return [n,o]}function ue(t,e,n){if(e>=t.length)return [[...t],[]];let o=t.slice(0,e),r=t.slice(e+1),i=t[e];if(g(i))o.push({...i,text:i.text.slice(0,n)}),r.unshift({...i,text:i.text.slice(n)});else if(R(i)){let[s,l]=wr(i.children,n);o.push({...i,children:s}),r.unshift({...i,children:l});}else n===0?r.unshift(i):o.push(i);return [o,r]}function jn(t,e){let[n,o]=qe(t,e);for(let r=n.path[0];r<=o.path[0]&&r<t.length;r++)for(let[i,s]of t[r].children.entries()){if(!R(s))continue;let l={path:[r,i],offset:0},a={path:[r,i],offset:B(s)};if(J(n,a)<=0&&J(o,l)>=0)return {paragraphIndex:r,inlineIndex:i,link:s}}return null}function Ar(t,e){let n=jn(t,e);if(!n)return null;let{paragraphIndex:o,inlineIndex:r,link:i}=n;return {url:i.url,range:{anchor:{path:[o,r],offset:0},focus:{path:[o,r],offset:B(i)}}}}function Ir(t,e){let[n,o]=qe(t,e);for(let r=n.path[0];r<=o.path[0]&&r<t.length;r++)for(let[i,s]of t[r].children.entries()){if(g(s))continue;let l=re(s)?"atomic":B(s);if(Ie(r,i,l,n,o))return true}return false}function Zi(t,e,n,o){let r=[],i=(s,l,a)=>{l<a&&r.push({...s,text:s.text.slice(l,a)});};for(let[s,l]of t[e].children.entries())if(!re(l)){if(g(l)){let a=Ie(e,s,l.text.length,n,o);a&&i(l,a.from,a.to);}else if(R(l)){let a=Ie(e,s,B(l),n,o);a&&Hn(l,a,i);}}return r}function Un(t,e,n){if(z(e))return {doc:t,range:e};let[o,r]=qe(t,e);for(let l=o.path[0];l<=r.path[0]&&l<t.length;l++)for(let[a,c]of t[l].children.entries())if(re(c)&&Ie(l,a,"atomic",o,r))return {doc:t,range:e};let i=false,s=t.map((l,a)=>{if(a<o.path[0]||a>r.path[0])return l;let c=Zi(t,a,o,r);if(c.length===0)return l;let d=l.children,[u]=a===o.path[0]?ue(d,o.path[1],o.offset):[[]],f=a===r.path[0]?ue(d,r.path[1],r.offset)[1]:[];return i=true,{...l,children:[...u,{type:X,url:n,children:c},...f]}});return i?Qt(t,e,s):{doc:t,range:e}}function _r(t,e,n){let o=jn(t,e);if(!o||o.link.url===n)return {doc:t,range:e};let{paragraphIndex:r,inlineIndex:i,link:s}=o,l=t.map((a,c)=>c!==r?a:{...a,children:a.children.map((d,u)=>u===i?{...s,url:n}:d)});return {doc:L(l),range:e}}function Nr(t,e){let n=jn(t,e);if(!n)return {doc:t,range:e};let{paragraphIndex:o,inlineIndex:r,link:i}=n,s=t.map((l,a)=>a!==o?l:{...l,children:l.children.flatMap((c,d)=>d===r?i.children:[c])});return Qt(t,e,s)}function $e(t,e){if(z(e))return {doc:t,range:e};let[n,o]=qe(t,e);if(J(n,o)===0)return {doc:t,range:e};let r=C(t,n),i=ue(t[n.path[0]].children,n.path[1],n.offset)[0],s=ue(t[o.path[0]].children,o.path[1],o.offset)[1],l={...t[n.path[0]],children:[...i,...s]},a=L([...t.slice(0,n.path[0]),l,...t.slice(o.path[0]+1)]),c=P(a,r);return {doc:a,range:{anchor:c,focus:c}}}function Vn(t,e){if(z(e))return xe();let[n,o]=qe(t,e);if(J(n,o)===0)return xe();let r=t[n.path[0]],i=t[o.path[0]],s;if(r===i){let l=ue(r.children,o.path[1],o.offset)[0];s=[{...r,children:ue(l,n.path[1],n.offset)[1]}];}else s=[{...r,children:ue(r.children,n.path[1],n.offset)[1]},...t.slice(n.path[0]+1,o.path[0]),{...i,children:ue(i.children,o.path[1],o.offset)[0]}];return structuredClone(L(s.map(l=>({...l,children:l.children.map(a=>Z(a)?{text:a.children[0].text}:a)}))))}function Mt(t,e,n){let o=de(t,e);if(n==="")return {doc:t,range:{anchor:o,focus:o}};let r=Dr(t,o),i=r?{...r,text:n}:{text:n},s=o.path[0],l=t[s].children,a=l[o.path[1]],c;if(R(a)&&o.offset>0&&o.offset<B(a)){let[f,p]=wr(a.children,o.offset),h={...a,children:[...f,i,...p]};c=l.map((m,k)=>k===o.path[1]?h:m);}else {let[f,p]=ue(l,o.path[1],o.offset);c=[...f,i,...p];}let d=L(t.map((f,p)=>p===s?{...f,children:c}:f)),u=P(d,C(t,o)+n.length);return {doc:d,range:{anchor:u,focus:u}}}function Wn(t,e,n){let o=L(n),r=A(o),i=t,s;if(z(e))s=de(t,e.focus);else {let p=$e(t,e);i=p.doc,s=p.range.focus;}if(o.length===1&&r===0)return {doc:i,range:{anchor:s,focus:s}};let l=s.path[0],[a,c]=ue(i[l].children,s.path[1],s.offset),d=o.length===1?[{...i[l],children:[...a,...o[0].children,...c]}]:[{...i[l],children:[...a,...o[0].children]},...o.slice(1,-1),{...i[l],children:[...o.at(-1).children,...c]}],u=L([...i.slice(0,l),...d,...i.slice(l+1)]),f=P(u,C(i,s)+r);return {doc:u,range:{anchor:f,focus:f}}}function Or(t,e){if(z(e))return Mt(t,e.focus,`
|
|
16
16
|
`);let n=$e(t,e);return Mt(n.doc,n.range.focus,`
|
|
17
|
-
`)}function
|
|
18
|
-
`);for(let i=0;i<r.length;i++){let s=r[i],l=i===r.length-1;if(s.length>0){let c=t.createTextNode(s);if(n.underline){let f=t.createElement("u");f.append(c),c=f;}if(n.italic){let f=t.createElement("i");f.append(c),c=f;}if(n.bold){let f=t.createElement("b");f.append(c),c=f;}let d=t.createElement("span");d.dataset.editorNode="text";let u=In(n);u&&d.setAttribute("style",u),d.append(c),e.append(d);}l?s===""&&r.length>1&&o&&e.append($n(t,"filler")):e.append($n(t,"break"));}}function
|
|
17
|
+
`)}function Br(t,e){return Wn(t,e,[{type:"p",children:[{text:""}]},{type:"p",children:[{text:""}]}])}function Fr(t,e){for(let[n,o]of t.entries()){let r=o.children.indexOf(e);if(r!==-1)return [n,r]}return null}function Kr(t){for(let[e,n]of t.entries())for(let[o,r]of n.children.entries())if(Z(r))return [e,o];return null}function Hr(t){let e=Ae(t);return {anchor:e,focus:e}}function jr(t,e){let n=t,o;if(z(e))o=de(t,e.focus);else {let u=$e(t,e);n=u.doc,o=u.range.focus;}let r={type:Ce,children:[{text:""}]},i=o.path[0],[s,l]=ue(n[i].children,o.path[1],o.offset),a=L(n.map((u,f)=>f===i?{...u,children:[...s,r,...l]}:u)),d={path:Fr(a,r)??[0,0],offset:0};return {doc:a,range:{anchor:d,focus:d}}}function Ur(t,e){let n=Kr(t);if(!n)return {doc:t,range:Hr(t)};let[o,r]=n,i={type:ce,value:e.id,displayName:e.displayName,children:[{text:""}]},s=L(t.map((d,u)=>u===o?{...d,children:d.children.map((f,p)=>p===r?i:f)}:d)),[l,a]=Fr(s,i)??[o,r],c={path:[l,a+1],offset:0};return {doc:s,range:{anchor:c,focus:c}}}function qn(t,e,n="end"){let o=Kr(t);if(!o)return {doc:t,range:Hr(t)};let[r,i]=o,s=t[r].children,l=i>0?Lr(s[i-1]):null,a=l?{...l,text:e}:{text:e},c=C(t,{path:[r,i],offset:0})+(n==="end"?e.length:0),d=L(t.map((f,p)=>p===r?{...f,children:s.map((h,m)=>m===i?a:h)}:f)),u=P(d,c);return {doc:d,range:{anchor:u,focus:u}}}function Ji(t){for(let e of t.children)if(re(e)||R(e)&&e.children.map(o=>o.text).join("").length>0||g(e)&&e.text.length>0)return false;return true}function $n(t,e){let n=t.createElement("br");return e==="break"?n.dataset.editorNode="break":n.dataset.editorFiller="true",n}function Vr(t,e,n,o){if(n.text==="")return;let r=n.text.split(`
|
|
18
|
+
`);for(let i=0;i<r.length;i++){let s=r[i],l=i===r.length-1;if(s.length>0){let c=t.createTextNode(s);if(n.underline){let f=t.createElement("u");f.append(c),c=f;}if(n.italic){let f=t.createElement("i");f.append(c),c=f;}if(n.bold){let f=t.createElement("b");f.append(c),c=f;}let d=t.createElement("span");d.dataset.editorNode="text";let u=In(n);u&&d.setAttribute("style",u),d.append(c),e.append(d);}l?s===""&&r.length>1&&o&&e.append($n(t,"filler")):e.append($n(t,"break"));}}function Qi(t,e,n,o){if(g(n)){Vr(t,e,n,o);return}switch(n.type){case X:{let r=t.createElement("a");r.dataset.editorNode="link",r.setAttribute("href",ye(n.url)),r.className=a$u({size:"sm",variant:"inline"});for(let i of n.children)Vr(t,r,i,false);e.append(r);break}case ce:{let r=t.createElement("span");r.setAttribute("contenteditable","false"),r.dataset.userId=n.value,r.dataset.editorNode="mention",r.textContent=`@${n.displayName}`,e.append(r);break}case Ce:{let r=t.createElement("span");r.setAttribute("contenteditable","false"),r.dataset.mentionAnchor="true",r.dataset.editorNode="mention-input",r.textContent=n.children[0].text,e.append(r);break}}}function nn(t){return g(t)?t.text!=="":R(t)?t.children.some(e=>e.text!==""):true}function es(t,e){let n=t.createElement("p");n.dataset.editorNode="paragraph";let o=Ve(e.textAlign);if(o&&(n.style.textAlign=o),Ji(e)){let i=t.createElement("span");return i.dataset.editorNode="text",i.append($n(t,"filler")),n.append(i),n}let r=-1;for(let i=e.children.length-1;i>=0;i--)if(nn(e.children[i])){r=i;break}for(let[i,s]of e.children.entries())Qi(t,n,s,i===r);return n}function Ct(t,e){let n=e.ownerDocument,o=n.createDocumentFragment();for(let r of t)o.append(es(n,r));e.replaceChildren(o);}var ts=1,ns=3,os=11;function fe(t){return t.nodeType===ts}function qr(t){return t.nodeType===os&&"host"in t}function on(t){return t.nodeType===ns}function St(t,e){return t.tagName.toLowerCase()===e}function rs(t){return St(t,"span")?t.getAttribute("contenteditable")==="false":false}function is(t,e,n,o,r){if(o===t){let l=t.childNodes,a=Math.min(r,l.length);return a===0?{found:true,point:{path:[n,0],offset:0}}:ss(e,n,a)}let i=t.childNodes,s=0;for(let l=0;l<e.children.length;l++){let a=e.children[l];if(g(a)){let c=rn(e.children,l),d=Yr(a.text,i,s,n,l,o,r,c);if(d.found)return d;s+=Ye(a.text,c);}else if(R(a)){if(s>=i.length)continue;let c=i[s];if(!fe(c)||!St(c,"a")){s++;continue}let d=ls(a,c,n,l,o,r);if(d.found)return d;s++;}else if(oe(a)||Z(a)){if(s>=i.length)continue;let c=i[s];if(!fe(c)||!rs(c)){s++;continue}if(o===c||(fe(o)||on(o))&&h(c,o))return {found:true,point:{path:[n,l+1],offset:0}};s++;}}return {found:false}}function ss(t,e,n){let o=0;for(let s=0;s<t.children.length;s++){let l=t.children[s],a=g(l)?Ye(l.text,rn(t.children,s)):1;if(o+a>=n){if(g(l))return {found:true,point:{path:[e,s],offset:Gr(l.text,n-o)}};if(re(l))return {found:true,point:{path:[e,s+1],offset:0}};{let c=l.children.reduce((d,u)=>d+u.text.length,0);return {found:true,point:{path:[e,s],offset:c}}}}o+=a;}let r=t.children.length-1,i=t.children[r];if(g(i))return {found:true,point:{path:[e,r],offset:i.text.length}};if(re(i))return {found:true,point:{path:[e,r+1],offset:0}};if(R(i)){let s=i.children.reduce((l,a)=>l+a.text.length,0);return {found:true,point:{path:[e,r],offset:s}}}return {found:false}}function $r(t){return !t.children.some(e=>nn(e))}function rn(t,e){for(let n=e+1;n<t.length;n++)if(nn(t[n]))return false;return true}function Ye(t,e){if(t==="")return 0;let n=t.split(`
|
|
19
19
|
`),o=0;for(let r=0;r<n.length;r++)n[r].length>0&&o++,r<n.length-1&&o++;return e&&t.endsWith(`
|
|
20
|
-
`)&&o++,o}function
|
|
20
|
+
`)&&o++,o}function Gr(t,e){if(t==="")return 0;let n=t.split(`
|
|
21
21
|
`),o=0,r=0;for(let i=0;i<n.length&&!(o>=e);i++){if(n[i].length>0){if(o+1>=e){r+=n[i].length,o++;break}r+=n[i].length,o++;}if(i<n.length-1){if(o+1>=e){r++,o++;break}r++,o++;}}return t.endsWith(`
|
|
22
|
-
`)&&o<e&&(r=t.length),Math.min(r,t.length)}function
|
|
22
|
+
`)&&o<e&&(r=t.length),Math.min(r,t.length)}function Yr(t,e,n,o,r,i,s,l=false){if(t==="")return {found:false};let a=t.split(`
|
|
23
23
|
`),c=n,d=0;for(let u=0;u<a.length;u++){let f=a[u],p=u===a.length-1;if(f.length>0&&c<e.length){let h$1=e[c],m=sn(h$1);if(m!==null){if(i===m){let k=Math.min(s,f.length);return {found:true,point:{path:[o,r],offset:d+k}}}if(fe(i)&&h(i,m))return {found:true,point:{path:[o,r],offset:d+(s===0?0:f.length)}}}d+=f.length,c++;}if(p){if(p&&l&&t.endsWith(`
|
|
24
|
-
`)&&f===""&&c<e.length){let h=e[c];if(fe(h)&&St(h,"br")&&i===h)return {found:true,point:{path:[o,r],offset:d}};c++;}}else if(c<e.length){let h=e[c];if(fe(h)&&St(h,"br")&&i===h)return {found:true,point:{path:[o,r],offset:d+(s===0?0:1)}};d++,c++;}}return {found:false}}function
|
|
24
|
+
`)&&f===""&&c<e.length){let h=e[c];if(fe(h)&&St(h,"br")&&i===h)return {found:true,point:{path:[o,r],offset:d}};c++;}}else if(c<e.length){let h=e[c];if(fe(h)&&St(h,"br")&&i===h)return {found:true,point:{path:[o,r],offset:d+(s===0?0:1)}};d++,c++;}}return {found:false}}function ls(t,e,n,o,r,i){if(!fe(e))return {found:false};if(r===e){let c=e.childNodes,d=Math.min(i,c.length),u=0,f=0,p=0;for(let h of t.children){let m=Ye(h.text,false);if(p+m>=d){f=u+Gr(h.text,d-p);break}u+=h.text.length,p+=m;}return p>=t.children.reduce((h,m)=>h+Ye(m.text,false),0)&&(f=t.children.reduce((h,m)=>h+m.text.length,0)),{found:true,point:{path:[n,o],offset:f}}}if(!h(e,r))return {found:false};let s=e.childNodes,l=0,a=0;for(let c of t.children){let d=Yr(c.text,s,a,n,o,r,i);if(d.found)return {found:true,point:{path:[n,o],offset:l+d.point.offset}};l+=c.text.length,a+=Ye(c.text,false);}return {found:false}}function sn(t){if(on(t))return t;if(fe(t)){let e=t;for(;fe(e)&&e.childNodes.length===1;){let n=e.childNodes[0];if(on(n))return n;if(fe(n))e=n;else break}}return null}function Ge(t,e,n,o){try{if(n!==t&&!h(t,n)||e.length===0)return null;if(n===t){let i=Math.min(o,t.childNodes.length);if(i===0)return {path:[0,0],offset:0};let s=Math.min(i,e.length)-1,l=e[s];if(!l)return null;let a=l.children.length-1,c=l.children[a];if(!c)return null;let d=g(c)?c.text.length:R(c)?c.children.reduce((u,f)=>u+f.text.length,0):0;return {path:[s,a],offset:d}}let r=t.children;for(let i=0;i<e.length;i++){let s=r[i];if(!s)return null;let l=e[i];if(n!==s&&!h(s,n))continue;if($r(l))return {path:[i,0],offset:0};let a=is(s,l,i,n,o);return a.found?a.point:null}return null}catch{return null}}function Wr(t,e,n){try{let[o,r]=n.path,i=n.offset;if(o<0||o>=e.length)return null;let s=e[o];if(r<0||r>=s.children.length)return null;let l=s.children[r],a=t.children[o];if(!a)return null;if($r(s))return {node:a.firstChild??a,offset:0};let c=a.childNodes,d=0;for(let u=0;u<r;u++){let f=s.children[u];g(f)?d+=Ye(f.text,rn(s.children,u)):d++;}if(g(l))return Xr(l.text,i,c,d,a,rn(s.children,r));if(R(l)){if(d>=c.length)return null;let u=c[d];return !fe(u)||!St(u,"a")?null:as(l,i,u)}else if(oe(l)||Z(l)){let u=d+1;if(u<c.length){let f=c[u];if(on(f))return {node:f,offset:0}}return {node:a,offset:Math.min(u,a.childNodes.length)}}return null}catch{return null}}function Xr(t,e,n,o,r,i=false){if(t==="")return {node:r,offset:o};let s=t.split(`
|
|
25
25
|
`),l=o,a=0;for(let c=0;c<s.length;c++){let d=s[c],u=c===s.length-1;if(d.length>0&&l<n.length){let f=n[l];if(e>=a&&e<=a+d.length){let p=sn(f);return p!==null?{node:p,offset:e-a}:{node:r,offset:l}}a+=d.length,l++;}if(u){if(u&&t.endsWith(`
|
|
26
|
-
`)&&d===""&&l<=n.length){if(e===a)return {node:r,offset:Math.min(l,r.childNodes.length)};i&&l++;}}else if(l<n.length){if(e===a)return {node:r,offset:l};a++,l++;}}if(l>o&&l-1<n.length){let c=n[l-1],d=sn(c);return d!==null?{node:d,offset:d.length}:{node:r,offset:l}}return {node:r,offset:Math.min(l,r.childNodes.length)}}function is(t,e,n){let o=n.childNodes,r=0,i=0;for(let s of t.children){let l=s.text.length;if(e<=r+l)return Gr(s.text,e-r,o,i,n);r+=l,i+=Ye(s.text,false);}if(o.length>0){let s=n.lastChild,l=s===null?null:sn(s);return l!==null?{node:l,offset:l.length}:{node:n,offset:o.length}}return {node:n,offset:0}}function ss(t,e){let n=t.getComposedRanges;if(typeof n!="function")return null;let o;try{o=n.call(t,{shadowRoots:[e]});}catch{try{o=n.call(t,e);}catch{return null}}let r=o?.[0];return r?{startContainer:r.startContainer,startOffset:r.startOffset,endContainer:r.endContainer,endOffset:r.endOffset}:null}function Gn(t,e){let n=e.rangeCount>0?e.getRangeAt(0):null,o=n?{startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset}:null;if(o&&h(t,o.startContainer))return o;let r=t.getRootNode();if(Vr(r)){let i=ss(e,r);if(i&&h(t,i.startContainer))return i}return o}function ut(t,e){try{let n=a$q(t);if(!n)return null;let{anchorNode:o,focusNode:r}=n;if(o&&r&&h(t,o)&&h(t,r)){let a=Ge(t,e,o,n.anchorOffset),c=Ge(t,e,r,n.focusOffset);if(a!==null&&c!==null)return {anchor:a,focus:c}}let i=Gn(t,n);if(!i)return null;let s=Ge(t,e,i.startContainer,i.startOffset);if(s===null)return null;let l=Ge(t,e,i.endContainer,i.endOffset);return l===null?null:{anchor:s,focus:l}}catch{return null}}function ft(t,e,n){try{let o=Ur(t,e,n.anchor);if(o===null)return;let r=Ur(t,e,n.focus);if(r===null)return;let i=t.ownerDocument;if(!i)return;let s=a$q(t);if(!s)return;if(J(n.anchor,n.focus)>0||Vr(t.getRootNode())){s.setBaseAndExtent(o.node,o.offset,r.node,r.offset);return}let a=i.createRange();a.setStart(o.node,o.offset),a.setEnd(r.node,r.offset),s.removeAllRanges(),s.addRange(a);}catch{}}var an=class{constructor(e,n){this.getEl=e;this.getDoc=n;}getEl;getDoc;remembered=null;lastEmitted=null;writeDeferred=null;focusFromPointer=false;get range(){return this.remembered}set(e,n){if(this.remembered=e,!e||n==="remember")return false;if(n==="place"&&!this.hasFocus())return this.writeDeferred="render",false;let o=this.getEl();return o?(ft(o,this.getDoc(),e),true):false}markEmitted(){this.lastEmitted=this.remembered;}hasFocus(){let e=this.getEl();return e?h(e,f$1(e)):false}select(e,n){let o=this.getEl();if(!o)return false;let r=!this.remembered||!ln(this.remembered,e);return this.remembered=e,r&&(this.lastEmitted=e),this.writeDeferred="select",!n&&!this.hasFocus()||(o.focus(),this.writeDeferred=null,ft(o,this.getDoc(),e)),r}collapseToFocus(){if(!this.getEl())return false;let e=this.current();return !e||z(e)?false:this.select({anchor:e.focus,focus:e.focus},true)}onPointerDown(){this.writeDeferred=null,this.focusFromPointer=!this.hasFocus();}onFocus(){let e=this.focusFromPointer,n=this.writeDeferred;this.focusFromPointer=false,this.writeDeferred=null;let o=this.getEl();if(e||!o||!this.remembered)return;let r=this.getDoc(),i=n===null?ut(o,r):null;if(i&&!ls(r,i)){this.remembered=i;return}ft(o,r,this.remembered);}current(){let e=this.getEl();if(!e)return this.remembered;let n=ut(e,this.getDoc());return n&&this.adoptsLiveSelection(n)&&(this.remembered=n),this.remembered}adoptsLiveSelection(e){return this.writeDeferred===null?true:this.writeDeferred==="select"||z(e)?false:(this.writeDeferred=null,true)}adopt(e){let n=this.remembered;return this.remembered=e,!n||!ln(n,e)}follow(e){if(e&&!this.adoptsLiveSelection(e))return "ignored";if(e===null)return "silent";let n=this.remembered;return this.remembered=e,!n||!ln(n,e)||!this.lastEmitted||!ln(this.lastEmitted,e)?"changed":"silent"}};function ls(t,e){let n=we();return J(e.anchor,n)===0&&J(e.focus,n)===0}function ln(t,e){return t.anchor.path[0]===e.anchor.path[0]&&t.anchor.path[1]===e.anchor.path[1]&&t.anchor.offset===e.anchor.offset&&t.focus.path[0]===e.focus.path[0]&&t.focus.path[1]===e.focus.path[1]&&t.focus.offset===e.focus.offset}var Yr="typing";var cn=class{undoStack=[];redoStack=[];now;maxDepth;lastKind=null;lastTime=null;constructor(e={}){this.now=e.now??Date.now,this.maxDepth=e.maxDepth??100;}record(e,n){let o=this.now();this.redoStack.length>0&&(this.redoStack=[]);let r=n===Yr&&this.lastKind===Yr&&this.lastTime!==null&&o-this.lastTime<=1e3;this.lastKind=n,this.lastTime=o,!r&&(this.undoStack.push(e),this.undoStack.length>this.maxDepth&&this.undoStack.shift());}undo(e){let n=this.undoStack.pop();return n?(this.redoStack.push(e),this.lastKind=null,this.lastTime=null,n):null}redo(e){let n=this.redoStack.pop();return n?(this.undoStack.push(e),this.lastKind=null,this.lastTime=null,n):null}clear(){this.undoStack=[],this.redoStack=[],this.lastKind=null,this.lastTime=null;}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}};var dn=10,un=class{pending=null;preserveSelectionChanges=0;get marks(){return this.pending?.marks}get caretOffset(){return this.pending?.caretOffset}merge(e){return this.pending?.marks??e}clear(){this.pending=null;}toggle(e,n,o){let r=this.effectiveMarks(e,n);r[o]=!r[o],this.pending={marks:r,caretOffset:C(e,n.anchor)};}setValue(e,n,o,r){let i=this.effectiveMarks(e,n);r===void 0?delete i[o]:i[o]=r,this.pending={marks:i,caretOffset:C(e,n.anchor)};}effectiveMarks(e,n){return this.pending?{...this.pending.marks}:We(ye(e,n))}afterCommand(e,n,o,r){let i=this.pending?.marks;if(this.pending=null,e==="insertText"&&i){let s=Math.min(C(n,o.anchor),C(n,o.focus)),l=C(r.doc,r.range.focus),a=this.applyMarkSnapshot(r.doc,i,s,l),c=P(a,l);r={doc:a,range:{anchor:c,focus:c}};}return (e==="insertSoftBreak"||e==="insertParagraph")&&this.carryAcrossBreak(n,o,i,r),this.keepOfEmptiedDoc(n,r.doc),r}afterInput(e,n,o,r){this.keepOfEmptiedDoc(e,o),this.inheritOfEmptyRun(e,n);let i=o,s=r,l=false;if(!this.pending)return {doc:i,range:s,remarked:l};if(!r)return this.pending=null,{doc:i,range:s,remarked:l};let a=this.applyToTypedText(o,r,this.pending);return a.doc!==o&&(i=a.doc,s=a.range,l=true),this.pending={marks:this.pending.marks,caretOffset:C(i,a.range.anchor)},this.preserveSelectionChanges=dn,{doc:i,range:s,remarked:l}}onSelectionChange(e,n){this.preserveSelectionChanges>0?(this.preserveSelectionChanges-=1,this.pending&&n&&(this.pending={...this.pending,caretOffset:C(e,n.anchor)})):this.pending&&n&&C(e,n.anchor)!==this.pending.caretOffset&&(this.pending=null);}onGenuineCaretMove(){this.preserveSelectionChanges=0;}keepOfEmptiedDoc(e,n){A(e)===0||A(n)!==0||(this.pending={marks:this.pending?.marks??We(ye(e,{anchor:we(),focus:P(e,1)})),caretOffset:0},this.preserveSelectionChanges=dn);}inheritOfEmptyRun(e,n){if(this.pending)return;let o;if(A(e)===0)o=we();else if(n&&z(n)&&A([e[n.anchor.path[0]]])===0)o=n.anchor;else return;let r=We(ye(e,{anchor:o,focus:o}));Object.values(r).some(Boolean)&&(this.pending={marks:r,caretOffset:C(e,o)},this.preserveSelectionChanges=dn);}carryAcrossBreak(e,n,o,r){let i=o?{...o}:We(ye(e,n));!o&&!Object.values(i).some(Boolean)||(this.pending={marks:i,caretOffset:C(r.doc,r.range.anchor)},this.preserveSelectionChanges=dn);}applyToTypedText(e,n,o){let r=o.caretOffset,i=C(e,n.anchor);if(i<=r)return {doc:e,range:n};let s=this.applyMarkSnapshot(e,o.marks,r,i),l=P(s,i);return {doc:s,range:{anchor:l,focus:l}}}applyMarkSnapshot(e,n,o,r){let i=e,s=()=>({anchor:P(i,o),focus:P(i,r)});for(let l of ["bold","italic","underline"]){let a=s(),c=!!n[l],d=!!ye(i,a)[l];c!==d&&(i=en(i,a,l).doc);}for(let l of Kn){let a=s(),c=n[l],d=ye(i,a)[l];d!==null&&(l==="color"||l==="backgroundColor"?b$b(c,d):c===d)||(i=tn(i,a,l,c).doc);}return i}};function Zr(t){return g(t)?[t]:R(t)||Z(t)?t.children:[]}function Xr(t){return t.some(e=>!!e.textAlign||e.children.some(n=>Zr(n).some(o=>!!o.fontFamily||!!o.fontSize)))}function Jr(t,e,n){if(!Xr(t)&&!Xr(e))return t;let o=n.createElement("span"),r=(u,f)=>(o.style.removeProperty(Oi(u)),o.style[u]=f,o.style[u]),i={fontFamily:new Map,fontSize:new Map,textAlign:new Map},s=(u,f)=>{if(!f)return;let p=r(u,f);i[u].has(p)||i[u].set(p,f);};for(let u of e){s("textAlign",u.textAlign);for(let f of u.children)for(let p of Zr(f))s("fontFamily",p.fontFamily),s("fontSize",p.fontSize);}let l=(u,f)=>f===void 0?void 0:i[u].get(r(u,f))??f,a=u=>{let f={...u};for(let p of ["fontFamily","fontSize"]){let h=l(p,u[p]);h!==void 0&&(f[p]=h);}return f.fontFamily===u.fontFamily&&f.fontSize===u.fontSize?u:f},c=false,d=t.map(u=>{let f=l("textAlign",u.textAlign),p=u.children.map(h=>{if(g(h))return a(h);if(R(h)||Z(h)){let m=h.children.map(k=>a(k));return m.some((k,I)=>k!==h.children[I])?{...h,children:m}:h}return h});return f===u.textAlign&&p.every((h,m)=>h===u.children[m])?u:(c=true,{...u,...f===void 0?{}:{textAlign:f},children:p})});return c?d:t}var cs=1,ds=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]);function us(t){return (t.key==="ArrowLeft"||t.key==="ArrowRight")&&!t.shiftKey&&(t.ctrlKey||t.altKey||t.metaKey)}function Yn(t){if(t!==void 0&&!(Number.isInteger(t)&&t>=0))throw new Error(`Editor: maxLength must be a finite integer >= 0, received ${String(t)}.`)}var Lt=class t{doc=ge();lastKnownHtml="";lastAppliedValue=null;lastAppliedDoc=null;selection;composing=false;enterHasShift=false;pendingMarks=new un;history=new cn;opts;el=null;pendingExternalRender=null;keyboardShortcutsOverride=void 0;constructor(e={}){this.opts=e,this.selection=new an(()=>this.el,()=>this.doc),this.lastKnownHtml=ie(this.doc);}setKeyboardShortcutsEnabled(e){this.keyboardShortcutsOverride=e;}attach(e){this.maxLength(),this.el=e,Ct(this.doc,e),this.selection.set(this.selection.range,"write");let n=this.handleBeforeInputBound,o=this.handleInputBound,r=this.handlePasteBound,i=this.handleCopyBound,s=this.handleCompositionStartBound,l=this.handleCompositionEndBound,a=this.handleSelectionChangeBound,c=this.handlePointerDownBound,d=this.handleFocusBound,u=this.handleKeyDownBound,f=this.handleDocumentKeyDownBound,p=e.ownerDocument;return e.addEventListener("beforeinput",n),e.addEventListener("input",o),e.addEventListener("paste",r),e.addEventListener("copy",i),e.addEventListener("cut",i),e.addEventListener("compositionstart",s),e.addEventListener("compositionend",l),e.addEventListener("pointerdown",c),e.addEventListener("focus",d),e.addEventListener("keydown",u),p.addEventListener("selectionchange",a),p.addEventListener("keydown",f),()=>{e.removeEventListener("beforeinput",n),e.removeEventListener("input",o),e.removeEventListener("paste",r),e.removeEventListener("copy",i),e.removeEventListener("cut",i),e.removeEventListener("compositionstart",s),e.removeEventListener("compositionend",l),e.removeEventListener("pointerdown",c),e.removeEventListener("focus",d),e.removeEventListener("keydown",u),p.removeEventListener("selectionchange",a),p.removeEventListener("keydown",f),this.el===e&&(this.el=null);}}handleBeforeInputBound=e=>{let n=e;if(j$2(n)===this.el){if(this.opts.isReadOnly?.()){n.preventDefault();return}this.selection.current(),this.handleBeforeInput(n);}};handleInputBound=e=>{j$2(e)===this.el&&(this.composing||this.syncFromDom());};isClipboardTargetInEditor(e,n=false){let o=j$2(e);return !o||!h(this.el,o)?false:!(o.nodeType===cs?o:o.parentElement)?.closest(n?"input":'input, [contenteditable="false"]')}handlePasteBound=e=>{let n=e;if(!this.isClipboardTargetInEditor(n)||(n.preventDefault(),this.opts.isReadOnly?.())||this.composing)return;this.selection.current();let o;try{o=this.opts.onPaste?.(n),o&&(o=L(o));}catch(r){o=null,queueMicrotask(()=>{throw r});}if(o!==null){if(o!==void 0){this.exec("insertFragment",o);return}this.insertPastedData(n.clipboardData);}};handleCopyBound=e=>{let n=e;if(!this.opts.onCopy||!this.isClipboardTargetInEditor(n,true))return;let o=this.selection.current(),r=o!==null&&!z(o),i=this.doc,s=r?Vn(i,o):ge();this.opts.onCopy(n,s)&&(n.preventDefault(),r&&n.type==="cut"&&!this.opts.isReadOnly?.()&&this.doc===i&&(this.select(o),this.exec("deleteRange")));};handleKeyDownBound=e=>{this.enterHasShift=e.key==="Enter"&&e.shiftKey,ds.has(e.key)&&this.pendingMarks.onGenuineCaretMove();};handleDocumentKeyDownBound=e=>{e.defaultPrevented||!this.el||!e.composedPath().includes(this.el)||!us(e)||this.selection.collapseToFocus()&&this.emitSelectionChange();};handlePointerDownBound=()=>{this.pendingMarks.onGenuineCaretMove(),this.selection.onPointerDown();};handleFocusBound=()=>{this.selection.onFocus();};handleCompositionStartBound=()=>{this.composing=true;};handleCompositionEndBound=()=>{if(this.composing=false,this.pendingExternalRender){let e=this.pendingExternalRender;this.pendingExternalRender=null,e();return}this.syncFromDom();};handleSelectionChangeBound=()=>{this.el&&this.handleSelectionChange();};getDoc(e){return e?Vn(this.doc,e):this.doc}getValue(){return ie(this.doc)}setValue(e,n={}){if(e===this.lastKnownHtml||e===this.lastAppliedValue)return;let o,r;try{o=L(Nn(e,this.allowedStyles())),r=ie(o);}catch(i){process.env.NODE_ENV!=="production"&&console.error("[Editor] setValue failed to parse value:",i);return}this.lastAppliedValue=e,this.lastAppliedDoc=null,this.replaceDoc(o,r,n);}setDoc(e,n={}){if(e===this.doc||e===this.lastAppliedDoc)return;let o=L(e);this.lastAppliedDoc=e,!dr(o,this.doc)&&(this.lastAppliedValue=null,this.replaceDoc(o,ie(o),n));}replaceDoc(e,n,o){let r=this.selection.range?C(this.doc,this.selection.range.anchor):null,i=null;if(r!==null){let s=P(e,Math.min(r,A(e)));i={anchor:s,focus:s};}this.history.clear(),this.commit(e,i,{type:"external",html:n,emit:!!o.emit});}static docHasMentionInput(e){return e.some(n=>n.children.some(o=>Z(o)))}exec(e,...n){let o=this.selection.current(),r=this.doc,i=o??this.collapsedAtDocEnd(),s={doc:r,range:o},l;try{let a=this.fitToCapacity(e,n,i);if(a===null)return;l=this.dispatchCommand(e,a);}catch(a){process.env.NODE_ENV!=="production"&&console.error(`[Editor] command "${e}" threw:`,a);return}if(e==="confirmMention"){let a=this.maxLength();a!==void 0&&A(l.doc)>Math.max(a,A(r))&&(l=qn(r,""));}if(l.doc===r){if(e==="toggleMark"&&z(i)){let[a]=n;this.pendingMarks.toggle(this.doc,i,a),this.emitSelectionChange();return}if(e==="setMarkValue"&&z(i)){let[a,c]=n;this.pendingMarks.setValue(this.doc,i,a,c),this.emitSelectionChange();return}this.pendingMarks.clear();return}l=this.pendingMarks.afterCommand(e,r,i,l),this.history.record(s,e),this.commit(l.doc,l.range,{type:"command"});}fitToCapacity(e,n,o){let r=this.capacity(o);if(r===void 0)return n;switch(e){case "insertText":{let[i]=n,s=Tt(i,r);return s===""?null:[s]}case "removeMentionInput":{let[i,s]=n;return [Tt(i,r),s]}case "insertFragment":{let[i]=n;if(r===0)return null;let s=Dn(i,r);return A(s)===0&&A(i)>0?null:[s]}case "insertSoftBreak":case "insertParagraph":return r===0?null:n;default:return n}}maxLength(){let e=this.opts.maxLength?.();return Yn(e),e}clampToMaxLength(e){let n=ut(this.el,e),o=this.maxLength(),r=o===void 0?void 0:Math.max(o,A(this.doc));if(r===void 0||A(e)<=r)return {doc:e,range:n,overflowed:false};let i=n?C(e,n.focus):this.insertionEnd(e),s=A(e)-r;if(i===void 0||i<s){let c=Dn(e,r);if(i===void 0)return {doc:c,range:n,overflowed:true};let d=P(c,Math.min(i,r));return {doc:c,range:{anchor:d,focus:d},overflowed:true}}let l=i-s;/[\uDC00-\uDFFF]/.test(zn(e)[l]??"")&&(l-=1);let a=$e(e,{anchor:P(e,l),focus:P(e,i)});return {doc:a.doc,range:a.range,overflowed:true}}insertionEnd(e){let n=this.selection.range;if(!n)return;let o=C(this.doc,n.anchor),r=C(this.doc,n.focus),i=A(this.doc)-Math.abs(o-r);return Math.min(o,r)+A(e)-i}capacity(e){let n=this.maxLength();if(n===void 0)return;let o=Math.abs(C(this.doc,e.anchor)-C(this.doc,e.focus)),r=A(this.doc);return Math.max(0,Math.max(n,r)-(r-o))}undo(){if(!this.history.canUndo)return;let e={doc:this.doc,range:this.selection.range},n=this.history.undo(e);n&&this.commit(n.doc,n.range,{type:"history"});}redo(){if(!this.history.canRedo)return;let e={doc:this.doc,range:this.selection.range},n=this.history.redo(e);n&&this.commit(n.doc,n.range,{type:"history"});}canUndo(){return this.history.canUndo}canRedo(){return this.history.canRedo}focus(){this.el?.focus();}setCaretPosition(e){if(!this.el)return;let n=P(this.doc,e);this.select({anchor:n,focus:n});}select(e,n){this.selection.select(e,n?.focus!==false)&&(this.pendingMarks.clear(),this.emitSelectionChange());}selectStart(){this.setCaretPosition(0);}selectEnd(){let e=Ae(this.doc);this.select({anchor:e,focus:e});}selectAll(e){this.select({anchor:we(this.doc),focus:Ae(this.doc)},e);}getSelectionState(){return this.buildSelectionState(this.selection.current())}buildSelectionState(e){let n=e?ye(this.doc,e):{...dt},o=this.pendingMarks.merge(n),r=e?Pr(this.doc,e):null;return {marks:o,link:r,range:e}}notifyChange(e,n){let o;try{this.opts.onChange?.(n);}catch(r){o={error:r};}if(this.doc===e&&this.opts.onDocChange?.(e),o)throw o.error}emitSelectionChange(){this.selection.markEmitted(),this.opts.onSelectionChange&&this.opts.onSelectionChange(this.buildSelectionState(this.selection.range));}commit(e,n,o){let r=o.type==="external"?o.html:ie(e),i=o.type==="external"&&t.docHasMentionInput(this.doc);this.doc=e,this.lastKnownHtml=r,(o.type==="history"||o.type==="external")&&this.pendingMarks.clear(),this.selection.set(n,"remember"),o.type!=="external"&&(this.lastAppliedValue=null,this.lastAppliedDoc=null);let s=this.el;switch(o.type){case "command":case "history":{s&&!this.composing&&(Ct(e,s),this.selection.set(n,"place"));break}case "native":{s&&o.rerender&&(Ct(e,s),this.selection.set(n,"write"));break}case "external":{if(!s)break;let l=()=>{this.el&&(Ct(e,this.el),n&&!this.selection.set(n,"place")&&!o.emit&&this.emitSelectionChange());};this.composing?this.pendingExternalRender=l:l();break}}o.type==="external"&&(i&&!t.docHasMentionInput(e)&&this.opts.onMentionInputRemoved?.(),!o.emit)||((o.type!=="native"||o.contentChanged)&&this.notifyChange(e,r),this.emitSelectionChange());}insertOverflowingText(e){if(!e.data)return false;let n=this.capacity(this.selection.current()??this.collapsedAtDocEnd());if(n===void 0||e.data.length<=n)return false;e.preventDefault();let o=this.pendingMarks.marks;return o?this.exec("insertFragment",[{type:"p",children:[kt(e.data,o)]}]):this.exec("insertText",e.data),true}handleNativeInsert(e){return e.inputType==="insertText"?this.insertOverflowingText(e):e.inputType==="insertReplacementText"&&this.replaceTargetText(e)}replaceTargetText(e){let n=this.el,o=e.getTargetRanges?.()[0],r=e.data??e.dataTransfer?.getData("text/plain");if(!n||!o||!r)return false;let i=Ge(n,this.doc,o.startContainer,o.startOffset),s=Ge(n,this.doc,o.endContainer,o.endOffset);if(!i||!s)return false;e.preventDefault();let l=kt(r,We(ye(this.doc,{anchor:i,focus:s}))),a=this.doc[i.path[0]]?.children[i.path[1]],c=R(a)&&i.path[0]===s.path[0]&&i.path[1]===s.path[1];return ft(n,this.doc,{anchor:i,focus:s}),this.exec("insertFragment",[{type:"p",children:[c?{...a,children:[l]}:l]}]),true}breakCommand(e){return e==="insertParagraph"&&!this.enterHasShift&&this.opts.enterInsertsParagraph?.()?"insertParagraph":"insertSoftBreak"}handleBeforeInput(e){let{inputType:n}=e;if(n==="insertParagraph"||n==="insertLineBreak"){e.preventDefault();let r=this.detectAutoLinkBeforeCaret(),i=this.doc;this.exec(this.breakCommand(n)),r&&this.applyAutoLink(r,i);return}if(n==="insertText"&&e.data===" "){let r=this.detectAutoLinkBeforeCaret();if(r){e.preventDefault();let i=this.doc;this.exec("insertText"," "),this.applyAutoLink(r,i);return}}if(this.handleNativeInsert(e))return;if(n==="insertFromPaste"||n==="insertFromDrop"){e.preventDefault(),this.handlePasteInput(e);return}let o=this.keyboardShortcutsOverride??this.opts.areKeyboardShortcutsEnabled?.()??true;if(n==="formatBold"){e.preventDefault(),o&&this.exec("toggleMark","bold");return}if(n==="formatItalic"){e.preventDefault(),o&&this.exec("toggleMark","italic");return}if(n==="formatUnderline"){e.preventDefault(),o&&this.exec("toggleMark","underline");return}if(n==="historyUndo"){e.preventDefault(),o&&this.undo();return}if(n==="historyRedo"){e.preventDefault(),o&&this.redo();return}if(n==="insertText"&&e.data==="@"&&this.shouldTriggerMention()&&this.opts.canStartMention?.()!==false){e.preventDefault();let r=this.doc;this.exec("insertMentionInput"),this.doc===r?this.exec("insertText","@"):this.opts.onMentionTrigger?.();}}shouldTriggerMention(){if(!this.selection.range)return true;if(!z(this.selection.range))return false;let e=this.selection.range,[n,o]=e.anchor.path,r=e.anchor.offset,i=this.doc;if(n>=i.length)return true;let s=i[n];if(o>=s.children.length)return true;let l=s.children[o];if(r===0&&o===0)return true;let a=null;if(g(l)){let c=l.text;if(r>0)a=c[r-1];else if(o>0)a=this.lastCharOf(s.children[o-1]);else return true}else if(R(l)){let c=l.children.map(d=>d.text).join("");if(r>0)a=c[r-1]??null;else if(o>0)a=this.lastCharOf(s.children[o-1]);else return true}else if(r===0&&o>0)a=this.lastCharOf(s.children[o-1]);else return true;return a===null?true:/^[\s"']$/.test(a)}lastCharOf(e){if(g(e)){let n=e.text;return n.length>0?n.at(-1)??null:null}if(R(e)){let o=(e.children??[]).at(-1);return o&&o.text.length>0?o.text.at(-1)??null:null}if(oe(e)){let n=e.displayName??"";return n.length>0?n.at(-1)??null:null}return null}allowedStyles(){return this.opts.htmlStyles?.()??vt}autoLinkEnabled(){return this.opts.autoLink?.()??true}detectAutoLinkBeforeCaret(){return !this.autoLinkEnabled()||this.composing?null:this.findAutoLinkBeforeCaret()}findAutoLinkBeforeCaret(){let e=this.selection.range;if(!e||!z(e))return null;let n=e.anchor,o=this.doc,r=n.path[0];if(r>=o.length)return null;let i=o[r].children,s=n.path[1],l=n.offset;if(s>=i.length){s=i.length-1;let f=i[s];if(!f||!g(f))return null;l=f.text.length;}else {let f=i[s];g(f)&&l>f.text.length&&(l=f.text.length);}let a=i[s];if(g(a)&&l<a.text.length&&!/\s/.test(a.text[l]))return null;let c="";for(;;){let f=i[s];if(!f||!g(f))break;if(l>0){let p=f.text[l-1];if(/\s/.test(p))break;c=p+c,l-=1;}else {if(s===0)break;let p=i[s-1];if(!g(p))break;s-=1,l=p.text.length;}}if(c==="")return null;let d=Jt(c);if(!d)return null;let u=C(o,{path:[r,s],offset:l});return {startAbs:u+d.start,endAbs:u+d.end,url:d.url}}applyAutoLink(e,n){if(this.doc===n)return;let o=xe(e.url);if(o==="")return;let r=this.doc,i={anchor:P(r,e.startAbs),focus:P(r,e.endAbs)},s={doc:r,range:this.selection.range},l=Un(r,i,o);if(l.doc===r)return;let a=this.selection.range?C(r,this.selection.range.anchor):e.endAbs;this.history.record(s,"wrapLink");let c=P(l.doc,a);this.commit(l.doc,{anchor:c,focus:c},{type:"command"});}handlePasteInput(e){this.insertPastedData(e.dataTransfer);}resolvePastedMentions(e){let n=this.opts.resolveMention;return n?e.map(o=>({...o,children:o.children.map(r=>{if(!oe(r))return r;let i=n(r.value);return i===void 0?{text:`@${r.displayName}`}:{...r,displayName:i}})})):e}insertPastedData(e){if(!e)return;let n=this.autoLinkEnabled(),o=e.getData("text/plain");if(n&&o){let i=this.selection.range;if(i&&!z(i)&&i.anchor.path[0]===i.focus.path[0]){let s=Tr(o),l=s?xe(s):"";if(l&&!wr(this.doc,i)){this.exec("wrapLink",l);return}}}let r=e.getData("text/html");if(r)try{let i=L(this.resolvePastedMentions(Nn(r)));n&&(i=L(On(i))),this.exec("insertFragment",i);return}catch(i){process.env.NODE_ENV!=="production"&&console.error("[Editor] failed to parse pasted HTML:",i);}if(o){let i=Ue(o.replaceAll(`\r
|
|
26
|
+
`)&&d===""&&l<=n.length){if(e===a)return {node:r,offset:Math.min(l,r.childNodes.length)};i&&l++;}}else if(l<n.length){if(e===a)return {node:r,offset:l};a++,l++;}}if(l>o&&l-1<n.length){let c=n[l-1],d=sn(c);return d!==null?{node:d,offset:d.length}:{node:r,offset:l}}return {node:r,offset:Math.min(l,r.childNodes.length)}}function as(t,e,n){let o=n.childNodes,r=0,i=0;for(let s of t.children){let l=s.text.length;if(e<=r+l)return Xr(s.text,e-r,o,i,n);r+=l,i+=Ye(s.text,false);}if(o.length>0){let s=n.lastChild,l=s===null?null:sn(s);return l!==null?{node:l,offset:l.length}:{node:n,offset:o.length}}return {node:n,offset:0}}function cs(t,e){let n=t.getComposedRanges;if(typeof n!="function")return null;let o;try{o=n.call(t,{shadowRoots:[e]});}catch{try{o=n.call(t,e);}catch{return null}}let r=o?.[0];return r?{startContainer:r.startContainer,startOffset:r.startOffset,endContainer:r.endContainer,endOffset:r.endOffset}:null}function Gn(t,e){let n=e.rangeCount>0?e.getRangeAt(0):null,o=n?{startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset}:null;if(o&&h(t,o.startContainer))return o;let r=t.getRootNode();if(qr(r)){let i=cs(e,r);if(i&&h(t,i.startContainer))return i}return o}function ut(t,e){try{let n=a$r(t);if(!n)return null;let{anchorNode:o,focusNode:r}=n;if(o&&r&&h(t,o)&&h(t,r)){let a=Ge(t,e,o,n.anchorOffset),c=Ge(t,e,r,n.focusOffset);if(a!==null&&c!==null)return {anchor:a,focus:c}}let i=Gn(t,n);if(!i)return null;let s=Ge(t,e,i.startContainer,i.startOffset);if(s===null)return null;let l=Ge(t,e,i.endContainer,i.endOffset);return l===null?null:{anchor:s,focus:l}}catch{return null}}function ft(t,e,n){try{let o=Wr(t,e,n.anchor);if(o===null)return;let r=Wr(t,e,n.focus);if(r===null)return;let i=t.ownerDocument;if(!i)return;let s=a$r(t);if(!s)return;if(J(n.anchor,n.focus)>0||qr(t.getRootNode())){s.setBaseAndExtent(o.node,o.offset,r.node,r.offset);return}let a=i.createRange();a.setStart(o.node,o.offset),a.setEnd(r.node,r.offset),s.removeAllRanges(),s.addRange(a);}catch{}}var an=class{constructor(e,n){this.getEl=e;this.getDoc=n;}getEl;getDoc;remembered=null;lastEmitted=null;writeDeferred=null;focusFromPointer=false;get range(){return this.remembered}set(e,n){if(this.remembered=e,!e||n==="remember")return false;if(n==="place"&&!this.hasFocus())return this.writeDeferred="render",false;let o=this.getEl();return o?(ft(o,this.getDoc(),e),true):false}markEmitted(){this.lastEmitted=this.remembered;}hasFocus(){let e=this.getEl();return e?h(e,f$2(e)):false}select(e,n){let o=this.getEl();if(!o)return false;let r=!this.remembered||!ln(this.remembered,e);return this.remembered=e,r&&(this.lastEmitted=e),this.writeDeferred="select",!n&&!this.hasFocus()||(o.focus(),this.writeDeferred=null,ft(o,this.getDoc(),e)),r}collapseToFocus(){if(!this.getEl())return false;let e=this.current();return !e||z(e)?false:this.select({anchor:e.focus,focus:e.focus},true)}onPointerDown(){this.writeDeferred=null,this.focusFromPointer=!this.hasFocus();}onFocus(){let e=this.focusFromPointer,n=this.writeDeferred;this.focusFromPointer=false,this.writeDeferred=null;let o=this.getEl();if(e||!o||!this.remembered)return;let r=this.getDoc(),i=n===null?ut(o,r):null;if(i&&!ds(r,i)){this.remembered=i;return}ft(o,r,this.remembered);}current(){let e=this.getEl();if(!e)return this.remembered;let n=ut(e,this.getDoc());return n&&this.adoptsLiveSelection(n)&&(this.remembered=n),this.remembered}adoptsLiveSelection(e){return this.writeDeferred===null?true:this.writeDeferred==="select"||z(e)?false:(this.writeDeferred=null,true)}adopt(e){let n=this.remembered;return this.remembered=e,!n||!ln(n,e)}follow(e){if(e&&!this.adoptsLiveSelection(e))return "ignored";if(e===null)return "silent";let n=this.remembered;return this.remembered=e,!n||!ln(n,e)||!this.lastEmitted||!ln(this.lastEmitted,e)?"changed":"silent"}};function ds(t,e){let n=we();return J(e.anchor,n)===0&&J(e.focus,n)===0}function ln(t,e){return t.anchor.path[0]===e.anchor.path[0]&&t.anchor.path[1]===e.anchor.path[1]&&t.anchor.offset===e.anchor.offset&&t.focus.path[0]===e.focus.path[0]&&t.focus.path[1]===e.focus.path[1]&&t.focus.offset===e.focus.offset}var Zr="typing";var cn=class{undoStack=[];redoStack=[];now;maxDepth;lastKind=null;lastTime=null;constructor(e={}){this.now=e.now??Date.now,this.maxDepth=e.maxDepth??100;}record(e,n){let o=this.now();this.redoStack.length>0&&(this.redoStack=[]);let r=n===Zr&&this.lastKind===Zr&&this.lastTime!==null&&o-this.lastTime<=1e3;this.lastKind=n,this.lastTime=o,!r&&(this.undoStack.push(e),this.undoStack.length>this.maxDepth&&this.undoStack.shift());}undo(e){let n=this.undoStack.pop();return n?(this.redoStack.push(e),this.lastKind=null,this.lastTime=null,n):null}redo(e){let n=this.redoStack.pop();return n?(this.undoStack.push(e),this.lastKind=null,this.lastTime=null,n):null}clear(){this.undoStack=[],this.redoStack=[],this.lastKind=null,this.lastTime=null;}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}};var dn=10,un=class{pending=null;preserveSelectionChanges=0;get marks(){return this.pending?.marks}get caretOffset(){return this.pending?.caretOffset}merge(e){return this.pending?.marks??e}clear(){this.pending=null;}toggle(e,n,o){let r=this.effectiveMarks(e,n);r[o]=!r[o],this.pending={marks:r,caretOffset:C(e,n.anchor)};}setValue(e,n,o,r){let i=this.effectiveMarks(e,n);r===void 0?delete i[o]:i[o]=r,this.pending={marks:i,caretOffset:C(e,n.anchor)};}effectiveMarks(e,n){return this.pending?{...this.pending.marks}:We(be(e,n))}afterCommand(e,n,o,r){let i=this.pending?.marks;if(this.pending=null,e==="insertText"&&i){let s=Math.min(C(n,o.anchor),C(n,o.focus)),l=C(r.doc,r.range.focus),a=this.applyMarkSnapshot(r.doc,i,s,l),c=P(a,l);r={doc:a,range:{anchor:c,focus:c}};}return (e==="insertSoftBreak"||e==="insertParagraph")&&this.carryAcrossBreak(n,o,i,r),this.keepOfEmptiedDoc(n,r.doc),r}afterInput(e,n,o,r){this.keepOfEmptiedDoc(e,o),this.inheritOfEmptyRun(e,n);let i=o,s=r,l=false;if(!this.pending)return {doc:i,range:s,remarked:l};if(!r)return this.pending=null,{doc:i,range:s,remarked:l};let a=this.applyToTypedText(o,r,this.pending);return a.doc!==o&&(i=a.doc,s=a.range,l=true),this.pending={marks:this.pending.marks,caretOffset:C(i,a.range.anchor)},this.preserveSelectionChanges=dn,{doc:i,range:s,remarked:l}}onSelectionChange(e,n){this.preserveSelectionChanges>0?(this.preserveSelectionChanges-=1,this.pending&&n&&(this.pending={...this.pending,caretOffset:C(e,n.anchor)})):this.pending&&n&&C(e,n.anchor)!==this.pending.caretOffset&&(this.pending=null);}onGenuineCaretMove(){this.preserveSelectionChanges=0;}keepOfEmptiedDoc(e,n){A(e)===0||A(n)!==0||(this.pending={marks:this.pending?.marks??We(be(e,{anchor:we(),focus:P(e,1)})),caretOffset:0},this.preserveSelectionChanges=dn);}inheritOfEmptyRun(e,n){if(this.pending)return;let o;if(A(e)===0)o=we();else if(n&&z(n)&&A([e[n.anchor.path[0]]])===0)o=n.anchor;else return;let r=We(be(e,{anchor:o,focus:o}));Object.values(r).some(Boolean)&&(this.pending={marks:r,caretOffset:C(e,o)},this.preserveSelectionChanges=dn);}carryAcrossBreak(e,n,o,r){let i=o?{...o}:We(be(e,n));!o&&!Object.values(i).some(Boolean)||(this.pending={marks:i,caretOffset:C(r.doc,r.range.anchor)},this.preserveSelectionChanges=dn);}applyToTypedText(e,n,o){let r=o.caretOffset,i=C(e,n.anchor);if(i<=r)return {doc:e,range:n};let s=this.applyMarkSnapshot(e,o.marks,r,i),l=P(s,i);return {doc:s,range:{anchor:l,focus:l}}}applyMarkSnapshot(e,n,o,r){let i=e,s=()=>({anchor:P(i,o),focus:P(i,r)});for(let l of ["bold","italic","underline"]){let a=s(),c=!!n[l],d=!!be(i,a)[l];c!==d&&(i=en(i,a,l).doc);}for(let l of Kn){let a=s(),c=n[l],d=be(i,a)[l];d!==null&&(l==="color"||l==="backgroundColor"?b$a(c,d):c===d)||(i=tn(i,a,l,c).doc);}return i}};function Qr(t){return g(t)?[t]:R(t)||Z(t)?t.children:[]}function Jr(t){return t.some(e=>!!e.textAlign||e.children.some(n=>Qr(n).some(o=>!!o.fontFamily||!!o.fontSize)))}function ei(t,e,n){if(!Jr(t)&&!Jr(e))return t;let o=n.createElement("span"),r=(u,f)=>(o.style.removeProperty(Ki(u)),o.style[u]=f,o.style[u]),i={fontFamily:new Map,fontSize:new Map,textAlign:new Map},s=(u,f)=>{if(!f)return;let p=r(u,f);i[u].has(p)||i[u].set(p,f);};for(let u of e){s("textAlign",u.textAlign);for(let f of u.children)for(let p of Qr(f))s("fontFamily",p.fontFamily),s("fontSize",p.fontSize);}let l=(u,f)=>f===void 0?void 0:i[u].get(r(u,f))??f,a=u=>{let f={...u};for(let p of ["fontFamily","fontSize"]){let h=l(p,u[p]);h!==void 0&&(f[p]=h);}return f.fontFamily===u.fontFamily&&f.fontSize===u.fontSize?u:f},c=false,d=t.map(u=>{let f=l("textAlign",u.textAlign),p=u.children.map(h=>{if(g(h))return a(h);if(R(h)||Z(h)){let m=h.children.map(k=>a(k));return m.some((k,I)=>k!==h.children[I])?{...h,children:m}:h}return h});return f===u.textAlign&&p.every((h,m)=>h===u.children[m])?u:(c=true,{...u,...f===void 0?{}:{textAlign:f},children:p})});return c?d:t}var fs=1,ps=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]);function hs(t){return (t.key==="ArrowLeft"||t.key==="ArrowRight")&&!t.shiftKey&&(t.ctrlKey||t.altKey||t.metaKey)}function Yn(t){if(t!==void 0&&!(Number.isInteger(t)&&t>=0))throw new Error(`Editor: maxLength must be a finite integer >= 0, received ${String(t)}.`)}var Lt=class t{doc=xe();lastKnownHtml="";lastAppliedValue=null;lastAppliedDoc=null;selection;composing=false;enterHasShift=false;pendingMarks=new un;history=new cn;opts;el=null;pendingExternalRender=null;keyboardShortcutsOverride=void 0;constructor(e={}){this.opts=e,this.selection=new an(()=>this.el,()=>this.doc),this.lastKnownHtml=ie(this.doc);}setKeyboardShortcutsEnabled(e){this.keyboardShortcutsOverride=e;}attach(e){this.maxLength(),this.el=e,Ct(this.doc,e),this.selection.set(this.selection.range,"write");let n=this.handleBeforeInputBound,o=this.handleInputBound,r=this.handlePasteBound,i=this.handleCopyBound,s=this.handleCompositionStartBound,l=this.handleCompositionEndBound,a=this.handleSelectionChangeBound,c=this.handlePointerDownBound,d=this.handleFocusBound,u=this.handleKeyDownBound,f=this.handleDocumentKeyDownBound,p=e.ownerDocument;return e.addEventListener("beforeinput",n),e.addEventListener("input",o),e.addEventListener("paste",r),e.addEventListener("copy",i),e.addEventListener("cut",i),e.addEventListener("compositionstart",s),e.addEventListener("compositionend",l),e.addEventListener("pointerdown",c),e.addEventListener("focus",d),e.addEventListener("keydown",u),p.addEventListener("selectionchange",a),p.addEventListener("keydown",f),()=>{e.removeEventListener("beforeinput",n),e.removeEventListener("input",o),e.removeEventListener("paste",r),e.removeEventListener("copy",i),e.removeEventListener("cut",i),e.removeEventListener("compositionstart",s),e.removeEventListener("compositionend",l),e.removeEventListener("pointerdown",c),e.removeEventListener("focus",d),e.removeEventListener("keydown",u),p.removeEventListener("selectionchange",a),p.removeEventListener("keydown",f),this.el===e&&(this.el=null);}}handleBeforeInputBound=e=>{let n=e;if(j$2(n)===this.el){if(this.opts.isReadOnly?.()){n.preventDefault();return}this.selection.current(),this.handleBeforeInput(n);}};handleInputBound=e=>{j$2(e)===this.el&&(this.composing||this.syncFromDom());};isClipboardTargetInEditor(e,n=false){let o=j$2(e);return !o||!h(this.el,o)?false:!(o.nodeType===fs?o:o.parentElement)?.closest(n?"input":'input, [contenteditable="false"]')}handlePasteBound=e=>{let n=e;if(!this.isClipboardTargetInEditor(n)||(n.preventDefault(),this.opts.isReadOnly?.())||this.composing)return;this.selection.current();let o;try{o=this.opts.onPaste?.(n),o&&(o=L(o));}catch(r){o=null,queueMicrotask(()=>{throw r});}if(o!==null){if(o!==void 0){this.exec("insertFragment",o);return}this.insertPastedData(n.clipboardData);}};handleCopyBound=e=>{let n=e;if(!this.opts.onCopy||!this.isClipboardTargetInEditor(n,true))return;let o=this.selection.current(),r=o!==null&&!z(o),i=this.doc,s=r?Vn(i,o):xe();this.opts.onCopy(n,s)&&(n.preventDefault(),r&&n.type==="cut"&&!this.opts.isReadOnly?.()&&this.doc===i&&(this.select(o),this.exec("deleteRange")));};handleKeyDownBound=e=>{this.enterHasShift=e.key==="Enter"&&e.shiftKey,ps.has(e.key)&&this.pendingMarks.onGenuineCaretMove();};handleDocumentKeyDownBound=e=>{e.defaultPrevented||!this.el||!e.composedPath().includes(this.el)||!hs(e)||this.selection.collapseToFocus()&&this.emitSelectionChange();};handlePointerDownBound=()=>{this.pendingMarks.onGenuineCaretMove(),this.selection.onPointerDown();};handleFocusBound=()=>{this.selection.onFocus();};handleCompositionStartBound=()=>{this.composing=true;};handleCompositionEndBound=()=>{if(this.composing=false,this.pendingExternalRender){let e=this.pendingExternalRender;this.pendingExternalRender=null,e();return}this.syncFromDom();};handleSelectionChangeBound=()=>{this.el&&this.handleSelectionChange();};getDoc(e){return e?Vn(this.doc,e):this.doc}getValue(){return ie(this.doc)}setValue(e,n={}){if(e===this.lastKnownHtml||e===this.lastAppliedValue)return;let o,r;try{o=L(Nn(e,this.allowedStyles())),r=ie(o);}catch(i){process.env.NODE_ENV!=="production"&&console.error("[Editor] setValue failed to parse value:",i);return}this.lastAppliedValue=e,this.lastAppliedDoc=null,this.replaceDoc(o,r,n);}setDoc(e,n={}){if(e===this.doc||e===this.lastAppliedDoc)return;let o=L(e);this.lastAppliedDoc=e,!fr(o,this.doc)&&(this.lastAppliedValue=null,this.replaceDoc(o,ie(o),n));}replaceDoc(e,n,o){let r=this.selection.range?C(this.doc,this.selection.range.anchor):null,i=null;if(r!==null){let s=P(e,Math.min(r,A(e)));i={anchor:s,focus:s};}this.history.clear(),this.commit(e,i,{type:"external",html:n,emit:!!o.emit});}static docHasMentionInput(e){return e.some(n=>n.children.some(o=>Z(o)))}exec(e,...n){let o=this.selection.current(),r=this.doc,i=o??this.collapsedAtDocEnd(),s={doc:r,range:o},l;try{let a=this.fitToCapacity(e,n,i);if(a===null)return;l=this.dispatchCommand(e,a);}catch(a){process.env.NODE_ENV!=="production"&&console.error(`[Editor] command "${e}" threw:`,a);return}if(e==="confirmMention"){let a=this.maxLength();a!==void 0&&A(l.doc)>Math.max(a,A(r))&&(l=qn(r,""));}if(l.doc===r){if(e==="toggleMark"&&z(i)){let[a]=n;this.pendingMarks.toggle(this.doc,i,a),this.emitSelectionChange();return}if(e==="setMarkValue"&&z(i)){let[a,c]=n;this.pendingMarks.setValue(this.doc,i,a,c),this.emitSelectionChange();return}this.pendingMarks.clear();return}l=this.pendingMarks.afterCommand(e,r,i,l),this.history.record(s,e),this.commit(l.doc,l.range,{type:"command"});}fitToCapacity(e,n,o){let r=this.capacity(o);if(r===void 0)return n;switch(e){case "insertText":{let[i]=n,s=Tt(i,r);return s===""?null:[s]}case "removeMentionInput":{let[i,s]=n;return [Tt(i,r),s]}case "insertFragment":{let[i]=n;if(r===0)return null;let s=Dn(i,r);return A(s)===0&&A(i)>0?null:[s]}case "insertSoftBreak":case "insertParagraph":return r===0?null:n;default:return n}}maxLength(){let e=this.opts.maxLength?.();return Yn(e),e}clampToMaxLength(e){let n=ut(this.el,e),o=this.maxLength(),r=o===void 0?void 0:Math.max(o,A(this.doc));if(r===void 0||A(e)<=r)return {doc:e,range:n,overflowed:false};let i=n?C(e,n.focus):this.insertionEnd(e),s=A(e)-r;if(i===void 0||i<s){let c=Dn(e,r);if(i===void 0)return {doc:c,range:n,overflowed:true};let d=P(c,Math.min(i,r));return {doc:c,range:{anchor:d,focus:d},overflowed:true}}let l=i-s;/[\uDC00-\uDFFF]/.test(zn(e)[l]??"")&&(l-=1);let a=$e(e,{anchor:P(e,l),focus:P(e,i)});return {doc:a.doc,range:a.range,overflowed:true}}insertionEnd(e){let n=this.selection.range;if(!n)return;let o=C(this.doc,n.anchor),r=C(this.doc,n.focus),i=A(this.doc)-Math.abs(o-r);return Math.min(o,r)+A(e)-i}capacity(e){let n=this.maxLength();if(n===void 0)return;let o=Math.abs(C(this.doc,e.anchor)-C(this.doc,e.focus)),r=A(this.doc);return Math.max(0,Math.max(n,r)-(r-o))}undo(){if(!this.history.canUndo)return;let e={doc:this.doc,range:this.selection.range},n=this.history.undo(e);n&&this.commit(n.doc,n.range,{type:"history"});}redo(){if(!this.history.canRedo)return;let e={doc:this.doc,range:this.selection.range},n=this.history.redo(e);n&&this.commit(n.doc,n.range,{type:"history"});}canUndo(){return this.history.canUndo}canRedo(){return this.history.canRedo}focus(){this.el?.focus();}setCaretPosition(e){if(!this.el)return;let n=P(this.doc,e);this.select({anchor:n,focus:n});}select(e,n){this.selection.select(e,n?.focus!==false)&&(this.pendingMarks.clear(),this.emitSelectionChange());}selectStart(){this.setCaretPosition(0);}selectEnd(){let e=Ae(this.doc);this.select({anchor:e,focus:e});}selectAll(e){this.select({anchor:we(this.doc),focus:Ae(this.doc)},e);}getSelectionState(){return this.buildSelectionState(this.selection.current())}buildSelectionState(e){let n=e?be(this.doc,e):{...dt},o=this.pendingMarks.merge(n),r=e?Ar(this.doc,e):null;return {marks:o,link:r,range:e}}notifyChange(e,n){let o;try{this.opts.onChange?.(n);}catch(r){o={error:r};}if(this.doc===e&&this.opts.onDocChange?.(e),o)throw o.error}emitSelectionChange(){this.selection.markEmitted(),this.opts.onSelectionChange&&this.opts.onSelectionChange(this.buildSelectionState(this.selection.range));}commit(e,n,o){let r=o.type==="external"?o.html:ie(e),i=o.type==="external"&&t.docHasMentionInput(this.doc);this.doc=e,this.lastKnownHtml=r,(o.type==="history"||o.type==="external")&&this.pendingMarks.clear(),this.selection.set(n,"remember"),o.type!=="external"&&(this.lastAppliedValue=null,this.lastAppliedDoc=null);let s=this.el;switch(o.type){case "command":case "history":{s&&!this.composing&&(Ct(e,s),this.selection.set(n,"place"));break}case "native":{s&&o.rerender&&(Ct(e,s),this.selection.set(n,"write"));break}case "external":{if(!s)break;let l=()=>{this.el&&(Ct(e,this.el),n&&!this.selection.set(n,"place")&&!o.emit&&this.emitSelectionChange());};this.composing?this.pendingExternalRender=l:l();break}}o.type==="external"&&(i&&!t.docHasMentionInput(e)&&this.opts.onMentionInputRemoved?.(),!o.emit)||((o.type!=="native"||o.contentChanged)&&this.notifyChange(e,r),this.emitSelectionChange());}insertOverflowingText(e){if(!e.data)return false;let n=this.capacity(this.selection.current()??this.collapsedAtDocEnd());if(n===void 0||e.data.length<=n)return false;e.preventDefault();let o=this.pendingMarks.marks;return o?this.exec("insertFragment",[{type:"p",children:[kt(e.data,o)]}]):this.exec("insertText",e.data),true}handleNativeInsert(e){return e.inputType==="insertText"?this.insertOverflowingText(e):e.inputType==="insertReplacementText"&&this.replaceTargetText(e)}replaceTargetText(e){let n=this.el,o=e.getTargetRanges?.()[0],r=e.data??e.dataTransfer?.getData("text/plain");if(!n||!o||!r)return false;let i=Ge(n,this.doc,o.startContainer,o.startOffset),s=Ge(n,this.doc,o.endContainer,o.endOffset);if(!i||!s)return false;e.preventDefault();let l=kt(r,We(be(this.doc,{anchor:i,focus:s}))),a=this.doc[i.path[0]]?.children[i.path[1]],c=R(a)&&i.path[0]===s.path[0]&&i.path[1]===s.path[1];return ft(n,this.doc,{anchor:i,focus:s}),this.exec("insertFragment",[{type:"p",children:[c?{...a,children:[l]}:l]}]),true}breakCommand(e){return e==="insertParagraph"&&!this.enterHasShift&&this.opts.enterInsertsParagraph?.()?"insertParagraph":"insertSoftBreak"}handleBeforeInput(e){let{inputType:n}=e;if(n==="insertParagraph"||n==="insertLineBreak"){e.preventDefault();let r=this.detectAutoLinkBeforeCaret(),i=this.doc;this.exec(this.breakCommand(n)),r&&this.applyAutoLink(r,i);return}if(n==="insertText"&&e.data===" "){let r=this.detectAutoLinkBeforeCaret();if(r){e.preventDefault();let i=this.doc;this.exec("insertText"," "),this.applyAutoLink(r,i);return}}if(this.handleNativeInsert(e))return;if(n==="insertFromPaste"||n==="insertFromDrop"){e.preventDefault(),this.handlePasteInput(e);return}let o=this.keyboardShortcutsOverride??this.opts.areKeyboardShortcutsEnabled?.()??true;if(n==="formatBold"){e.preventDefault(),o&&this.exec("toggleMark","bold");return}if(n==="formatItalic"){e.preventDefault(),o&&this.exec("toggleMark","italic");return}if(n==="formatUnderline"){e.preventDefault(),o&&this.exec("toggleMark","underline");return}if(n==="historyUndo"){e.preventDefault(),o&&this.undo();return}if(n==="historyRedo"){e.preventDefault(),o&&this.redo();return}if(n==="insertText"&&e.data==="@"&&this.shouldTriggerMention()&&this.opts.canStartMention?.()!==false){e.preventDefault();let r=this.doc;this.exec("insertMentionInput"),this.doc===r?this.exec("insertText","@"):this.opts.onMentionTrigger?.();}}shouldTriggerMention(){if(!this.selection.range)return true;if(!z(this.selection.range))return false;let e=this.selection.range,[n,o]=e.anchor.path,r=e.anchor.offset,i=this.doc;if(n>=i.length)return true;let s=i[n];if(o>=s.children.length)return true;let l=s.children[o];if(r===0&&o===0)return true;let a=null;if(g(l)){let c=l.text;if(r>0)a=c[r-1];else if(o>0)a=this.lastCharOf(s.children[o-1]);else return true}else if(R(l)){let c=l.children.map(d=>d.text).join("");if(r>0)a=c[r-1]??null;else if(o>0)a=this.lastCharOf(s.children[o-1]);else return true}else if(r===0&&o>0)a=this.lastCharOf(s.children[o-1]);else return true;return a===null?true:/^[\s"']$/.test(a)}lastCharOf(e){if(g(e)){let n=e.text;return n.length>0?n.at(-1)??null:null}if(R(e)){let o=(e.children??[]).at(-1);return o&&o.text.length>0?o.text.at(-1)??null:null}if(oe(e)){let n=e.displayName??"";return n.length>0?n.at(-1)??null:null}return null}allowedStyles(){return this.opts.htmlStyles?.()??vt}autoLinkEnabled(){return this.opts.autoLink?.()??true}detectAutoLinkBeforeCaret(){return !this.autoLinkEnabled()||this.composing?null:this.findAutoLinkBeforeCaret()}findAutoLinkBeforeCaret(){let e=this.selection.range;if(!e||!z(e))return null;let n=e.anchor,o=this.doc,r=n.path[0];if(r>=o.length)return null;let i=o[r].children,s=n.path[1],l=n.offset;if(s>=i.length){s=i.length-1;let f=i[s];if(!f||!g(f))return null;l=f.text.length;}else {let f=i[s];g(f)&&l>f.text.length&&(l=f.text.length);}let a=i[s];if(g(a)&&l<a.text.length&&!/\s/.test(a.text[l]))return null;let c="";for(;;){let f=i[s];if(!f||!g(f))break;if(l>0){let p=f.text[l-1];if(/\s/.test(p))break;c=p+c,l-=1;}else {if(s===0)break;let p=i[s-1];if(!g(p))break;s-=1,l=p.text.length;}}if(c==="")return null;let d=Jt(c);if(!d)return null;let u=C(o,{path:[r,s],offset:l});return {startAbs:u+d.start,endAbs:u+d.end,url:d.url}}applyAutoLink(e,n){if(this.doc===n)return;let o=ye(e.url);if(o==="")return;let r=this.doc,i={anchor:P(r,e.startAbs),focus:P(r,e.endAbs)},s={doc:r,range:this.selection.range},l=Un(r,i,o);if(l.doc===r)return;let a=this.selection.range?C(r,this.selection.range.anchor):e.endAbs;this.history.record(s,"wrapLink");let c=P(l.doc,a);this.commit(l.doc,{anchor:c,focus:c},{type:"command"});}handlePasteInput(e){this.insertPastedData(e.dataTransfer);}resolvePastedMentions(e){let n=this.opts.resolveMention;return n?e.map(o=>({...o,children:o.children.map(r=>{if(!oe(r))return r;let i=n(r.value);return i===void 0?{text:`@${r.displayName}`}:{...r,displayName:i}})})):e}insertPastedData(e){if(!e)return;let n=this.autoLinkEnabled(),o=e.getData("text/plain");if(n&&o){let i=this.selection.range;if(i&&!z(i)&&i.anchor.path[0]===i.focus.path[0]){let s=Rr(o),l=s?ye(s):"";if(l&&!Ir(this.doc,i)){this.exec("wrapLink",l);return}}}let r=e.getData("text/html");if(r)try{let i=L(this.resolvePastedMentions(Nn(r)));n&&(i=L(On(i))),this.exec("insertFragment",i);return}catch(i){process.env.NODE_ENV!=="production"&&console.error("[Editor] failed to parse pasted HTML:",i);}if(o){let i=Ue(o.replaceAll(`\r
|
|
27
27
|
`,`
|
|
28
28
|
`).replaceAll("\r",`
|
|
29
|
-
`)),s=L([{type:"p",children:[{text:i}]}]);n&&(s=L(On(s))),this.exec("insertFragment",s);}}syncFromDom(){if(!this.el||this.composing)return;let e=this.doc,n={doc:e,range:this.selection.range},{doc:o,range:r,overflowed:i}=this.clampToMaxLength(ur(Jr(Zt(this.el,hr),e,this.el.ownerDocument),e)),l=ie(o)!==this.lastKnownHtml;if(!l&&!i){r&&this.selection.adopt(r)&&this.emitSelectionChange();return}l&&this.history.record(n,"typing");let a=o,c=r,d=i;if(!c&&n.range){let f=Math.max(A(o)-A(e),0),p=this.pendingMarks.caretOffset??C(e,n.range.anchor),h=P(o,p+f);c={anchor:h,focus:h};}let u=this.pendingMarks.afterInput(e,n.range,o,c);a=u.doc,c=u.range,u.remarked&&(d=true),this.commit(a,c,{type:"native",rerender:d,contentChanged:l});}handleSelectionChange(){if(!this.el)return;let e=a$q(this.el);if(!e)return;let n=Gn(this.el,e);if(!n||!h(this.el,n.startContainer))return;let o=ut(this.el,this.doc),r=this.selection.follow(o);r!=="ignored"&&(this.pendingMarks.onSelectionChange(this.doc,o),r==="changed"&&this.emitSelectionChange());}dispatchCommand(e,n){let o=this.doc,r=this.selection.range??this.collapsedAtDocEnd();switch(e){case "toggleMark":{let[i]=n;return en(o,r,i)}case "setMarkValue":{let[i,s]=n;return tn(o,r,i,s)}case "wrapLink":{let[i]=n;return Un(o,r,i)}case "updateLinkUrl":{let[i]=n;return Ar(o,r,i)}case "unwrapLink":return Ir(o,r);case "deleteRange":return $e(o,r);case "insertText":{let[i]=n;if(!z(r)){let s=$e(o,r);return Mt(s.doc,s.range.focus,i)}return Mt(o,r.anchor,i)}case "insertFragment":{let[i]=n;return Wn(o,r,i)}case "insertSoftBreak":return _r(o,r);case "insertParagraph":return Nr(o,r);case "insertMentionInput":return Kr(o,r);case "confirmMention":{let[i]=n;return Hr(o,i)}case "removeMentionInput":{let[i,s]=n;return qn(o,i,s)}default:return {doc:o,range:r}}}collapsedAtDocEnd(){let e=Ae(this.doc);return {anchor:e,focus:e}}};var Dt=wt.createContext(null);function Ce(){let t=wt.useContext(Dt);if(!t)throw new Error("useEditorContext must be used within an EditorProvider");return t}var fn=Object.freeze({marks:dt,link:null,range:null});function ps(t){let e=Ue(t.replaceAll(/<br\s*\/?>/gi,"").replaceAll(/<p\s[^>]*>/gi,"<p>"));return e==="<p></p>"||e===""||e==="<p> </p>"}function Xn(t={}){let{value:e,defaultValue:n,doc:o,defaultDoc:r,onChange:i,onDocChange:s,isDisabled:l,keyboardShortcuts:a,onSelectionChange:c,onMentionTrigger:d,onMentionInputRemoved:u,canStartMention:f,resolveMention:p,onPaste:h,onCopy:m,maxLength:k,htmlStyles:I,isReadOnly:$,autoLink:w,enterInsertsParagraph:j}=t;if(e!==void 0&&i===void 0&&a$d("use-editor-value-without-onchange","useEditor: `value` without `onChange` is controlled but cannot reflect edits \u2014 they are discarded on the next render. Use `defaultValue` for initial content, or add `onChange`."),(e!==void 0||n!==void 0)&&(o!==void 0||r!==void 0)||o!==void 0&&r!==void 0)throw new Error("useEditor: pass at most one of `doc` and `defaultDoc`, and not together with `value` or `defaultValue`.");o!==void 0&&s===void 0&&a$d("use-editor-doc-without-ondocchange","useEditor: `doc` without `onDocChange` is controlled but cannot reflect edits \u2014 they are discarded on the next render. Use `defaultDoc` for initial content, or add `onDocChange`."),Yn(k);let[D,Q]=useState(fn),U=o??r,[pe,x]=useState(()=>U?ie(L(U)):e??n??""),M=useMemo(()=>o===void 0?void 0:ie(L(o)),[o]),G=useRef(i);G.current=i;let E=useRef(s);E.current=s;let Ee=useRef(c);Ee.current=c;let he=useRef(d);he.current=d;let Te=useRef(u);Te.current=u;let ve=useRef(f);ve.current=f;let ee=useRef(p);ee.current=p;let V=useRef(h);V.current=h;let Se=useRef(m);Se.current=m;let Le=useRef(k);Le.current=k;let Ne=useRef(I);Ne.current=I;let Qe=useRef($);Qe.current=$;let Oe=useRef(l);Oe.current=l;let Be=useRef(a);Be.current=a;let le=useRef(w);le.current=w;let De=useRef(j);De.current=j;let y=useRef(null);if(y.current===null){y.current=new Lt({onChange:v=>{x(v),G.current?.(v);},onDocChange:v=>{E.current?.(v);},onSelectionChange:v=>{Q(v),Ee.current?.(v);},onMentionTrigger:()=>{he.current?.();},onMentionInputRemoved:()=>{Te.current?.();},canStartMention:()=>ve.current?.()??false,get resolveMention(){return ee.current},get onPaste(){return V.current},get onCopy(){return Se.current},maxLength:()=>Le.current,htmlStyles:()=>Ne.current,autoLink:()=>le.current!==false,isReadOnly:()=>Qe.current?.()??!!Oe.current,areKeyboardShortcutsEnabled:()=>Be.current!==false,enterInsertsParagraph:()=>!!De.current});let b=e??n;U?y.current.setDoc(U):b&&typeof DOMParser<"u"&&y.current.setValue(b);}let S=y.current;a$h(()=>{o!==void 0?S.setDoc(o):e!==void 0&&S.setValue(e);}),useEffect(()=>{l&&Q(fn);},[l]);let Re=M??e??pe,ze=ps(Re),Pe=S.canUndo(),T=S.canRedo();return useMemo(()=>({core:S,selectionState:D,value:Re,isEmpty:ze,isDisabled:!!l,keyboardShortcuts:a!==false,canUndo:Pe,canRedo:T,focus:()=>{S.focus();},selectStart:()=>{S.selectStart();},selectEnd:()=>{S.selectEnd();},setCaretPosition:b=>{S.setCaretPosition(b);},undo:()=>{S.undo();},redo:()=>{S.redo();},getValue:()=>S.getValue(),setValue:(b,v)=>{S.setValue(b,v);},getDoc:b=>S.getDoc(b),setDoc:(b,v)=>{S.setDoc(b,v);},selectAll:b=>{S.selectAll(b);},select:(b,v)=>{S.select(b,v);},getSelectionState:()=>S.getSelectionState(),exec:(b,...v)=>{S.exec(b,...v);},isMarkActive:b=>!!D.marks[b],toggleMark:b=>{S.exec("toggleMark",b);},setMark:(b,v)=>{S.exec("setMarkValue",b,v);}}),[S,D,Re,ze,l,a,Pe,T])}function oi(t,e){let n=t.ctrlKey||t.metaKey,o=t.key.toLowerCase();if(n&&!t.altKey&&o==="z")return t.preventDefault(),t.shiftKey?e.redo():e.undo(),true;if(t.ctrlKey&&!t.altKey&&!t.shiftKey&&o==="y")return t.preventDefault(),e.redo(),true;if(n&&!t.shiftKey&&!t.altKey){if(o==="b")return t.preventDefault(),e.toggleMark("bold"),true;if(o==="i")return t.preventDefault(),e.toggleMark("italic"),true;if(o==="u")return t.preventDefault(),e.toggleMark("underline"),true}return false}function Jn(t,e={}){let n=ys(t),{ref:o,autoFocus:r,onKeyDown:i,keyboardShortcuts:s}=e,l=s??n.keyboardShortcuts,a=useId(),c=useRef(null),d=useRef(null),u=useCallback(m=>{d.current&&(d.current(),d.current=null),m&&(d.current=n.core.attach(m));},[n.core]),f=useMemo(()=>b(c,u,o??null),[u,o]);useEffect(()=>(n.core.setKeyboardShortcutsEnabled(s),()=>{n.core.setKeyboardShortcutsEnabled(void 0);}),[n.core,s]);let p=useRef(false);useEffect(()=>{if(!p.current)switch(p.current=true,r){case true:{n.focus();break}case "start":{n.selectStart();break}case "end":{n.selectEnd();break}}},[n.core]);let{keyboardProps:h}=j({onKeyDown:m=>{i?.(m)||l&&oi(m,n)||m.continuePropagation();}});return {editableProps:{...h,id:a,ref:f,contentEditable:!n.isDisabled,suppressContentEditableWarning:true,role:"textbox","aria-multiline":true,"data-editor-root":"true"}}}function ys(t){let e=useContext(Dt);if(t)return t;if(!e)throw new Error("useEditable must be passed an editor or used within an EditorProvider");return e}var Qn=({editor:t,children:e})=>jsx(Dt.Provider,{value:t,children:e});var pn=({markName:t,icon:e,ariaLabel:n,isDisabled:o})=>{let{core:r,selectionState:i}=Ce(),s=!!i.marks[t];return jsx(a$g,{variant:"tertiary",isSelected:s,size:"sm",icon:e,"aria-label":n,"data-testid":`editor-${t}-button`,isDisabled:o,onPress:()=>{r.exec("toggleMark",t),r.focus();},preventFocusOnPress:true})},to=({colorKey:t,"aria-label":e,isDisabled:n})=>{let{core:o,selectionState:r}=Ce(),i=t==="color"?r.marks.color:r.marks.backgroundColor,s=wt.useRef(null),l=useCallback(()=>{s.current=r.range;},[r.range]),a=useCallback(p=>{setTimeout(()=>{let h=o.getSelectionState().range??s.current;h&&o.select(h),o.exec("setMarkValue",t,p);},0);},[o,t]),c=useCallback(p=>{a(p);},[a]),d=useCallback(()=>{a();},[a]),u=useCallback(({ref:p,triggerProps:h})=>jsx(a$c,{icon:t==="color"?TextIcon:HighlightTextIcon,"aria-label":e,"data-testid":t==="color"?"editor-font-color-button":"editor-background-color-button",size:"md",variant:"popover",isDisabled:n,className:it,preventFocusOnPress:true,...h,ref:p}),[t,e,n]),f=useCallback(p=>{p?c(p.toString("rgba")):d();},[d,c]);return jsx(b$4,{presets:Mn,allowRemoval:true,pickerMode:"lazy",placement:"top end",colorLabel:false,renderTriggerButton:u,onTriggerPress:l,value:i||"#000000",onChange:f,isDisabled:n})};var Xe={Add:"add",Edit:"edit",Show:"show"},ii=({isDisabled:t,addLinkLabel:e,editLinkLabel:n,removeLinkLabel:o,linkAnnotationLabel:r,linkCancelLabel:i,linkSaveLabel:s})=>{let{formatMessage:l}=b$1(),{core:a}=Ce();return jsxs(b$5,{type:"dialog",children:[jsx(j$1,{children:jsx(a$c,{icon:LinkIcon,size:"sm",isDisabled:t,"aria-label":e??l(Ze.addLink),"data-testid":"editor-add-link-button",className:it,preventFocusOnPress:true})}),jsx(a$i,{className:sprinkles({boxShadow:"medium"}),placement:"top end",children:({close:c})=>jsx(a$j,{size:"content",style:{minWidth:240},children:jsx(Ms,{addLinkLabel:e,editLinkLabel:n,removeLinkLabel:o,linkAnnotationLabel:r,linkCancelLabel:i,linkSaveLabel:s,close:()=>{c(),setTimeout(()=>{a.focus();},0);}})})})]})},Ms=({close:t,addLinkLabel:e,editLinkLabel:n,removeLinkLabel:o,linkAnnotationLabel:r,linkCancelLabel:i,linkSaveLabel:s})=>{let{core:l,selectionState:a}=Ce(),{formatMessage:c}=b$1(),d=a.link?.url,[u,f]=wt.useState(d?Xe.Show:Xe.Add),[p,h]=wt.useState(d||""),m=jsx(a$a,{padding:"lg",children:jsx(a$r,{label:r??c(Ze.link),value:p,autoFocus:true,onChange:h,placeholder:"https://yourdomain.com","data-testid":"editor-link-input"})});return jsxs(Fragment,{children:[u===Xe.Add&&jsxs(Fragment,{children:[m,jsx(a$a,{display:"flex",justifyContent:"flex-end",padding:"lg",className:Vo,children:jsx(b$a,{isDisabled:!a$s(p,true)||xe(p)==="",label:e??c(Ze.addLink),"data-testid":"editor-link-add-button",size:"sm",onPress:()=>{l.exec("wrapLink",_n(p)),t?.();},preventFocusOnPress:true})})]}),u===Xe.Show&&jsxs(Fragment,{children:[jsx(a$a,{padding:"lg",children:jsx(a$o,{type:"subtitle",size:"sm",children:d})}),jsxs(a$a,{display:"flex",justifyContent:"flex-end",padding:"lg",gap:"lg",borderColor:"border.subtle",borderWidth:1,borderStyle:"solid",children:[jsx(b$a,{label:n??c(Ze.editLink),"data-testid":"editor-link-edit-button",size:"sm",variant:"secondary",onPress:()=>{f(Xe.Edit);},style:{flex:1,justifyContent:"center"}}),jsx(b$a,{label:o??c(Ze.removeLink),"data-testid":"editor-link-remove-button",size:"sm",onPress:()=>{l.exec("unwrapLink"),t?.();},preventFocusOnPress:true,style:{flex:1,justifyContent:"center"}})]})]}),u===Xe.Edit&&jsxs(Fragment,{children:[m,jsxs(a$a,{display:"flex",justifyContent:"flex-end",padding:"lg",gap:"lg",borderColor:"border.subtle",borderWidth:1,borderStyle:"solid",children:[jsx(b$a,{label:i??c(Ze.cancel),"data-testid":"editor-link-cancel-button",size:"sm",variant:"secondary",onPress:()=>{f(Xe.Show),t?.();}}),jsx(b$a,{label:s??c(Ze.save),"data-testid":"editor-link-save-button",size:"sm",isDisabled:!a$s(p,true)||xe(p)==="",onPress:()=>{l.exec("updateLinkUrl",_n(p)),t?.();}})]})]})]})},Ze=c$1({addLink:{id:"bui.editor.addLink",defaultMessage:"Add Link"},editLink:{id:"bui.editor.editLink",defaultMessage:"Edit Link"},removeLink:{id:"bui.editor.removeLink",defaultMessage:"Remove Link"},cancel:{id:"bui.editor.cancel",defaultMessage:"Cancel"},save:{id:"bui.editor.save",defaultMessage:"Save"},link:{id:"bui.editor.linkAnnotation",defaultMessage:"Link"}});var oo=wt.createContext({items:[],containerRef:{current:null},maxMentionableUsersSuggestions:10}),ws=({key:t,value:e},{isDisabled:n,optionProps:o,isFocused:r,_state:i},s)=>{let{hoverProps:l}=a$4({isDisabled:n}),{label:a,data:c$1}=e;return jsxs(Fragment,{children:[jsxs("li",{...c(o,l),className:Zo({isDisabled:n,isHovered:r}),"data-active":r||void 0,ref:s,children:[jsx(a$a,{elementType:"span",display:"flex","aria-hidden":true,children:jsx(a$f,{name:a,...c$1?.avatar})}),jsxs(a$a,{display:"flex",flexDirection:"column",children:[jsx(a$o,{type:"subtitle",size:"sm",children:a}),jsx(a$o,{type:"helper",size:"sm",children:c$1?.description})]})]}),t===i.collection.getLastKey()?null:jsx(a$b,{})]})};function no(t){return t.displayName?.trim()||t.name?.trim()||t.id}function ro(t){return t.displayName??no(t)}function io({anchor:t,onClose:e,mentionLabel:n}){let{core:o}=Ce(),{containerRef:r,items:i,maxMentionableUsersSuggestions:s}=useContext(oo),[l,a]=useState(""),{contains:c$1}=a$k({sensitivity:"base"}),{formatMessage:d}=b$1(),u=useRef(false),f$1=useCallback(()=>{u.current=true,e();},[e]),p=useMemo(()=>{let x=i.filter(M=>l===""||c$1(no(M),l)).map(M=>({id:M.id,label:no(M),data:M}));return s?x.slice(0,s):x},[i,s,l,c$1]),h=useCallback(x=>jsx(a$l,{textValue:x.label,children:x.label},x.id),[]),m=useCallback(x=>{if(u.current||x==null)return;let M=i.find(G=>G.id===x);M&&(f$1(),o.exec("confirmMention",{id:M.id,displayName:ro(M)}),o.exec("insertText"," "),o.focus());},[f$1,o,i]),k=b$6({items:p,children:h,menuTrigger:"focus",onSelectionChange:m}),I=useCallback(x=>{if(u.current)return;f$1();let M=x==="backspace"?"":`@${k.inputValue}`;o.exec("removeMentionInput",M,x==="arrowStart"?"start":"end"),o.focus();},[f$1,o,k.inputValue]),$=useRef(null),w=useRef(null),j=useRef(null),N=useRef(null);a$m({ref:N,onInteractOutside:()=>{k.close();}});let{inputProps:D,listBoxProps:Q}=a$n({defaultItems:p,inputRef:w,buttonRef:$,listBoxRef:j,popoverRef:N,menuTrigger:"focus","aria-label":n??d(As.mention)},k);useLayoutEffect(()=>{w.current?.focus(),setTimeout(()=>{w.current?.focus();});},[]);let U=useCallback(x=>{let M=x.currentTarget,G=M.selectionStart===0&&M.selectionEnd===0,E=M.selectionStart===M.value.length&&M.selectionEnd===M.value.length;if(x.key==="Backspace"&&G)x.preventDefault(),I("backspace");else if(x.key==="Escape")I("escape");else if(x.key==="ArrowLeft"||x.key==="ArrowRight"){let ee=V=>x.key==="ArrowLeft"!=(b$2(V).getComputedStyle(V).direction==="rtl");(ee(M)?G:E)&&(x.preventDefault(),I(ee(t)?"arrowStart":"arrowEnd"));}let Ee=x.metaKey||x.ctrlKey,he=x.key.toLowerCase(),Te=Ee&&!x.shiftKey&&he==="z"&&o.canUndo(),ve=(Ee&&x.shiftKey&&he==="z"||x.ctrlKey&&he==="y")&&o.canRedo();(Te||ve)&&(x.preventDefault(),Te?o.undo():o.redo(),f$1(),o.focus());},[t,I,f$1,o]),pe=useMemo(()=>{if(!CSS.supports("field-sizing","content")){let x=b$2(w.current),M=w.current?x?.getComputedStyle(w.current).font:void 0;return {width:M?b$7({text:k.inputValue,font:M,element:w.current}).width+10:"4ch"}}},[k.inputValue]);return jsxs(Fragment,{children:[createPortal(jsx("input",{...c(D,{onKeyDown:U,onBlur:()=>{I("blur");},onChange:x=>{a(x.target.value);}}),style:pe,dir:/\p{L}/u.test(k.inputValue)?"auto":void 0,className:Xo,ref:w}),t),jsx(b$8.Provider,{value:k,children:jsx(a$i,{triggerRef:r,isNonModal:true,ref:N,state:k,crossOffset:-2,children:jsx(c$2,{...Q,items:void 0,ref:j,"data-testid":"editor-mention-listbox",className:a$6(f,sprinkles({width:"full"})),renderOption:ws})})})]})}io.displayName="MentionInputOverlay";var As=c$1({mention:{defaultMessage:"Mention",id:"bui.editor.mention"}});var ao=wt.forwardRef(({value:t,defaultValue:e$1,onChange:n,style:o,spellCheck:r,placeholder:i,isInline:s,isDisabled:l,editableContentAriaLabel:a,containerRef:c,onHelpDialogOpenRequest:d,mentionableUsers:u,editorHandle:f,maxMentionableUsersSuggestions:p,autoFocus:h,editorRef:m,saveOnEnter:k,onSave:I,autoLink:$,mentionLabel:w,boldLabel:j,italicLabel:N,underlineLabel:D,fontColorLabel:Q,backgroundColorLabel:U,helpLabel:pe,addLinkLabel:x,editLinkLabel:M,removeLinkLabel:G,linkAnnotationLabel:E,linkCancelLabel:Ee,linkSaveLabel:he},Te)=>{let ve=useRef(null),ee=useRef(null),{formatMessage:V}=b$1(),[Se,Le]=useState(null),Ne=useRef(0),[Qe,Oe]=useState(false),Be=()=>{let T=ee.current?.querySelector("[data-mention-anchor]");T&&(Ne.current+=1,Le({anchor:T,id:Ne.current}));},le=Xn({value:t,defaultValue:e$1,onChange:n,isDisabled:l,onMentionTrigger:Be,onMentionInputRemoved:()=>{Le(null);},canStartMention:()=>(u?.length??0)>0,resolveMention:T=>{let b=u?.find(v=>v.id===T);return b&&ro(b)},autoLink:$}),De=le.core;wt.useEffect(()=>{m&&(m.current=De);},[De,m]);let y=T=>a$2(T)?false:k&&T.key==="Enter"&&!T.shiftKey||(T.ctrlKey||T.metaKey)&&T.key==="Enter"?(T.preventDefault(),I(),true):T.altKey&&T.key==="F10"?(T.preventDefault(),ve.current?.querySelector("button")?.focus(),true):false,{editableProps:S}=Jn(le,{ref:ee,autoFocus:h,onKeyDown:y}),Re=T=>{if(l)return;let{isLinkClick:b,url:v}=br(T.target,{metaKey:T.metaKey,ctrlKey:T.ctrlKey,mac:e()});b&&(T.preventDefault(),v&&b$2(T.currentTarget).open(v,"_blank","noopener,noreferrer"));};wt.useEffect(()=>{let T=ee.current;if(!T||l)return;let b=a$8(T),v=b$2(T),Fe=Ke=>{Oe(e()?Ke.metaKey:Ke.ctrlKey);},mt=()=>{Oe(false);};return b.addEventListener("keydown",Fe),b.addEventListener("keyup",Fe),v.addEventListener("blur",mt),()=>{b.removeEventListener("keydown",Fe),b.removeEventListener("keyup",Fe),v.removeEventListener("blur",mt),mt();}},[l]),useImperativeHandle(Te,()=>({startMention:()=>{u?.length&&(ee.current?.querySelector("input[role='combobox']")||(De.exec("insertMentionInput"),Be()));}})),useImperativeHandle(f,()=>({setCaretPosition:T=>{le.setCaretPosition(T);},focus:()=>{le.focus();}}));let ze=useMemo(()=>({items:u||[],containerRef:c,maxMentionableUsersSuggestions:p}),[u,c,p]),Pe=le.isEmpty;return jsx(oo.Provider,{value:ze,children:jsxs(Qn,{editor:le,children:[jsxs(a$9,{className:a$6(qt,"BaselineUI-Editor-RichEditorToolbar"),"aria-controls":S.id,ref:ve,children:[jsxs(a$a,{display:"flex",flexDirection:"row",role:"group",gap:"xs",paddingX:"sm",children:[jsx(pn,{markName:"bold",icon:BoldIcon,ariaLabel:j??V(ht.bold),isDisabled:l}),jsx(pn,{markName:"italic",icon:ItalicIcon,ariaLabel:N??V(ht.italic),isDisabled:l}),jsx(pn,{markName:"underline",icon:UnderlineIcon,ariaLabel:D??V(ht.underline),isDisabled:l})]}),jsx(a$b,{orientation:"vertical",className:yt}),jsx(to,{colorKey:"color","aria-label":Q??V(ht.fontColor),isDisabled:l}),jsx(a$b,{orientation:"vertical",className:yt}),jsx(to,{colorKey:"backgroundColor","aria-label":U??V(ht.backgroundColor),isDisabled:l}),jsx(a$b,{orientation:"vertical",className:yt}),jsx(ii,{isDisabled:l,addLinkLabel:x,editLinkLabel:M,removeLinkLabel:G,linkAnnotationLabel:E,linkCancelLabel:Ee,linkSaveLabel:he}),jsx(a$b,{orientation:"vertical",className:yt}),jsx(a$c,{className:it,icon:QuestionmarkCircleIcon,size:"sm","aria-label":pe??V(ht.help),"data-testid":"editor-help-button",onPress:d})]}),jsx(a$b,{variant:"secondary"}),jsxs("div",{style:{position:"relative"},children:[!!(i&&Pe)&&jsx("span",{"aria-hidden":true,"aria-disabled":true,"data-testid":"editor-placeholder",style:{position:"absolute",pointerEvents:"none",userSelect:"none",top:0,left:0,right:0},className:a$6(xt({isDisabled:l}),$o,"BaselineUI-Editor-RichEditorPlaceholder"),children:i}),jsx("div",{...S,onClick:Re,"data-mod-held":Qe?"":void 0,"aria-label":a,"aria-placeholder":i,spellCheck:r,style:o,className:a$6(xt({isDisabled:l}),Wt({isInline:s}),"BaselineUI-Editor-RichEditorEditingArea")})]}),Se!==null&&jsx(io,{anchor:Se.anchor,mentionLabel:w,onClose:()=>{Le(null);}},Se.id)]})})});ao.displayName="RichEditor";var ht=c$1({bold:{defaultMessage:"Bold",id:"bui.editor.bold"},italic:{defaultMessage:"Italic",id:"bui.editor.italic"},underline:{defaultMessage:"Underline",id:"bui.editor.underline"},backgroundColor:{defaultMessage:"Background Color",id:"bui.editor.backgroundColor"},fontColor:{defaultMessage:"Font Color",id:"bui.editor.fontColor"},help:{defaultMessage:"Help",id:"bui.editor.help"}});var di=wt.memo(wt.forwardRef(({className:t,style:e,"data-block-id":n,"data-block-class":o,enableRichText:r=false,onCancel:i,onSave:s,isInline:l=true,submitButtonIcon:a=ArrowUpCircleFilledIcon,submitButtonAriaLabel:c$1,cancelButtonAriaLabel:d,"aria-label":u,"aria-describedby":f,"aria-labelledby":p,"aria-details":h,editableContentAriaLabel:m="Editing Area",footerButtons:k,clearOnCancel:I,clearOnSave:$,mentionLabel:w,boldLabel:j$1,italicLabel:N,underlineLabel:D,fontColorLabel:Q,backgroundColorLabel:U,helpLabel:pe,closeLabel:x,actionLabel:M,shortcutLabel:G,toolbarFocusLabel:E,selectAllLabel:Ee,cutLabel:he,copyLabel:Te,pasteLabel:ve,undoLabel:ee,redoLabel:V,openHelpDialogLabel:Se,submitLabel:Le,addLinkLabel:Ne,editLinkLabel:Qe,removeLinkLabel:Oe,linkAnnotationLabel:Be,linkCancelLabel:le,linkSaveLabel:De,...y},S)=>{let Re=useRef(null),{formatMessage:ze}=b$1(),Pe=useRef(null),T=useRef(null),b$2=useRef(null),v=!r&&y.variant==="minimal",Fe=useRef(null),[mt,Ke]=wt.useState(y.value||y.defaultValue),xn=y.value!==void 0&&y.onChange!==void 0;r&&y.value!==void 0&&!y.onChange&&a$d("editor-rich-value-uncontrolled","Editor: `value` without `onChange` in rich text mode sets the initial content only. Use `defaultValue` for uncontrolled content, or add `onChange` to control the value.");let po=y.value!==void 0&&(!r||xn),yn=y.value;wt.useEffect(()=>{po&&yn!==void 0&&Ke(yn);},[po,yn]);let bn=y.isDisabled||y.isSaveDisabled||!b$3(mt||""),{fieldProps:ui}=a$e({"aria-label":u,"aria-labelledby":p,"aria-describedby":f,"aria-details":h,labelElementType:"div"});v&&!y.avatarName&&console.warn("Editor: When using the minimal `variant` and `enableRichText` is `false`, you should provide an `avatarName`.");let En=useCallback(()=>{Ke(""),r?Re.current?.setValue("<p></p>",{emit:true}):T.current?.clear();},[r]),It=useCallback(()=>{bn||(s?.(r?Re.current?.getValue()??"":Pe.current.value),$&&En());},[En,$,r,s,bn]),ho=jsx(a$c,{variant:"ghost","aria-label":c$1||ze(uo.save),icon:a,isDisabled:bn,"data-testid":"editor-save-button",size:"md",excludeFromTabOrder:v,className:a$6({[Jo]:v},"BaselineUI-Editor-Save"),onPress:It,preventFocusOnPress:true}),[fi,Tn]=wt.useState(false),{keyboardProps:pi}=j({onKeyDown:W=>{(W.metaKey||W.ctrlKey)&&W.shiftKey&&W.key.toLowerCase()==="h"?(W.preventDefault(),Tn(true)):W.continuePropagation();}}),mo=useCallback(W=>{Ke(W),y.onChange?.(W);},[y]);return jsxs("div",{...c(ui,r?pi:{}),role:"application",ref:b(b$2,S),style:e,"data-block-id":n,"data-block-class":o,className:a$6(qo({isInline:l,isMinimal:v}),"BaselineUI-Editor",t),"aria-disabled":y.isDisabled,children:[v?jsxs(Fragment,{children:[l?jsx(a$f,{className:Wo,name:y.avatarName||""}):null,jsxs("div",{className:er({isInline:l}),children:[jsx($t,{isMinimal:v,textBoxRef:Pe,ref:T,isInline:l,editableContentAriaLabel:m,...y,onChange:mo,onSave:It}),ho]})]}):jsxs(Fragment,{children:[r?jsx(ao,{containerRef:b$2,ref:Fe,editorRef:Re,isInline:l,editableContentAriaLabel:m,onHelpDialogOpenRequest:()=>{Tn(true);},mentionLabel:w,boldLabel:j$1,italicLabel:N,underlineLabel:D,fontColorLabel:Q,backgroundColorLabel:U,helpLabel:pe,addLinkLabel:Ne,editLinkLabel:Qe,removeLinkLabel:Oe,linkAnnotationLabel:Be,linkCancelLabel:le,linkSaveLabel:De,...y,value:xn?y.value:void 0,defaultValue:y.defaultValue??(xn?void 0:y.value),onChange:mo,onSave:It}):jsxs(Fragment,{children:[!l&&jsx(a$b,{variant:"secondary"}),jsx($t,{onCancel:i,textBoxRef:Pe,ref:T,isInline:l,editableContentAriaLabel:m,...y,onChange:W=>{Ke(W),y.onChange?.(W);},onSave:It})]}),jsx(a$b,{variant:"secondary"}),jsxs("div",{className:a$6(qt,sprinkles({justifyContent:"space-between"}),"BaselineUI-Editor-Footer"),children:[jsxs(a$a,{paddingX:"sm",gap:"sm",display:"flex",children:[r&&y.mentionableUsers?jsx(a$c,{icon:AtIcon,size:"sm","aria-label":w??ze(uo.mention),"data-testid":"editor-mention-button",onPress:()=>Fe.current?.startMention(),preventFocusOnPress:true,className:"BaselineUI-Editor-Mention"}):null,k?.map(({type:W,props:_t},go)=>W==="action"?jsx(a$c,{..._t,size:"sm",isDisabled:y.isDisabled||_t.isDisabled},go):jsx(a$g,{..._t,size:"sm",variant:"tertiary",isDisabled:y.isDisabled||_t.isDisabled},go))]}),jsxs(a$a,{children:[!!i&&jsx(a$c,{variant:"secondary",icon:XCircleFilledIcon,isDisabled:y.isDisabled,"data-testid":"editor-cancel-button",size:"md",onPress:()=>{i(),I&&En();},"aria-label":d||ze(uo.cancel),className:"BaselineUI-Editor-Cancel"}),ho]})]})]}),jsx(lr,{isOpen:fi,onClose:()=>{Tn(false);},toolbarFocusLabel:E,helpLabel:pe,closeLabel:x,actionLabel:M,shortcutLabel:G,boldLabel:j$1,italicLabel:N,underlineLabel:D,selectAllLabel:Ee,cutLabel:he,copyLabel:Te,pasteLabel:ve,undoLabel:ee,redoLabel:V,openHelpDialogLabel:Se,submitLabel:Le})]})}));di.displayName="Editor";var uo=c$1({cancel:{defaultMessage:"Cancel",id:"bui.editor.cancel"},save:{defaultMessage:"Save",id:"bui.editor.save"},mention:{defaultMessage:"Mention",id:"bui.editor.mention"}});
|
|
30
|
-
export{zn as a,J as b,we as c,Ae as d,Lt as e,
|
|
29
|
+
`)),s=L([{type:"p",children:[{text:i}]}]);n&&(s=L(On(s))),this.exec("insertFragment",s);}}syncFromDom(){if(!this.el||this.composing)return;let e=this.doc,n={doc:e,range:this.selection.range},{doc:o,range:r,overflowed:i}=this.clampToMaxLength(pr(ei(Zt(this.el,gr),e,this.el.ownerDocument),e)),l=ie(o)!==this.lastKnownHtml;if(!l&&!i){r&&this.selection.adopt(r)&&this.emitSelectionChange();return}l&&this.history.record(n,"typing");let a=o,c=r,d=i;if(!c&&n.range){let f=Math.max(A(o)-A(e),0),p=this.pendingMarks.caretOffset??C(e,n.range.anchor),h=P(o,p+f);c={anchor:h,focus:h};}let u=this.pendingMarks.afterInput(e,n.range,o,c);a=u.doc,c=u.range,u.remarked&&(d=true),this.commit(a,c,{type:"native",rerender:d,contentChanged:l});}handleSelectionChange(){if(!this.el)return;let e=a$r(this.el);if(!e)return;let n=Gn(this.el,e);if(!n||!h(this.el,n.startContainer))return;let o=ut(this.el,this.doc),r=this.selection.follow(o);r!=="ignored"&&(this.pendingMarks.onSelectionChange(this.doc,o),r==="changed"&&this.emitSelectionChange());}dispatchCommand(e,n){let o=this.doc,r=this.selection.range??this.collapsedAtDocEnd();switch(e){case "toggleMark":{let[i]=n;return en(o,r,i)}case "setMarkValue":{let[i,s]=n;return tn(o,r,i,s)}case "wrapLink":{let[i]=n;return Un(o,r,i)}case "updateLinkUrl":{let[i]=n;return _r(o,r,i)}case "unwrapLink":return Nr(o,r);case "deleteRange":return $e(o,r);case "insertText":{let[i]=n;if(!z(r)){let s=$e(o,r);return Mt(s.doc,s.range.focus,i)}return Mt(o,r.anchor,i)}case "insertFragment":{let[i]=n;return Wn(o,r,i)}case "insertSoftBreak":return Or(o,r);case "insertParagraph":return Br(o,r);case "insertMentionInput":return jr(o,r);case "confirmMention":{let[i]=n;return Ur(o,i)}case "removeMentionInput":{let[i,s]=n;return qn(o,i,s)}default:return {doc:o,range:r}}}collapsedAtDocEnd(){let e=Ae(this.doc);return {anchor:e,focus:e}}};var Dt=wt.createContext(null);function Se(){let t=wt.useContext(Dt);if(!t)throw new Error("useEditorContext must be used within an EditorProvider");return t}var fn=Object.freeze({marks:dt,link:null,range:null});function gs(t){let e=Ue(t.replaceAll(/<br\s*\/?>/gi,"").replaceAll(/<p\s[^>]*>/gi,"<p>"));return e==="<p></p>"||e===""||e==="<p> </p>"}function Xn(t={}){let{value:e,defaultValue:n,doc:o,defaultDoc:r,onChange:i,onDocChange:s,isDisabled:l,keyboardShortcuts:a,onSelectionChange:c,onMentionTrigger:d,onMentionInputRemoved:u,canStartMention:f,resolveMention:p,onPaste:h,onCopy:m,maxLength:k,htmlStyles:I,isReadOnly:$,autoLink:w,enterInsertsParagraph:j}=t;if(e!==void 0&&i===void 0&&a$d("use-editor-value-without-onchange","useEditor: `value` without `onChange` is controlled but cannot reflect edits \u2014 they are discarded on the next render. Use `defaultValue` for initial content, or add `onChange`."),(e!==void 0||n!==void 0)&&(o!==void 0||r!==void 0)||o!==void 0&&r!==void 0)throw new Error("useEditor: pass at most one of `doc` and `defaultDoc`, and not together with `value` or `defaultValue`.");o!==void 0&&s===void 0&&a$d("use-editor-doc-without-ondocchange","useEditor: `doc` without `onDocChange` is controlled but cannot reflect edits \u2014 they are discarded on the next render. Use `defaultDoc` for initial content, or add `onDocChange`."),Yn(k);let[D,Q]=useState(fn),U=o??r,[pe,x]=useState(()=>U?ie(L(U)):e??n??""),M=useMemo(()=>o===void 0?void 0:ie(L(o)),[o]),G=useRef(i);G.current=i;let E=useRef(s);E.current=s;let Te=useRef(c);Te.current=c;let he=useRef(d);he.current=d;let ve=useRef(u);ve.current=u;let Re=useRef(f);Re.current=f;let ee=useRef(p);ee.current=p;let V=useRef(h);V.current=h;let Le=useRef(m);Le.current=m;let De=useRef(k);De.current=k;let Ne=useRef(I);Ne.current=I;let Qe=useRef($);Qe.current=$;let Oe=useRef(l);Oe.current=l;let Be=useRef(a);Be.current=a;let le=useRef(w);le.current=w;let ze=useRef(j);ze.current=j;let y=useRef(null);if(y.current===null){y.current=new Lt({onChange:v=>{x(v),G.current?.(v);},onDocChange:v=>{E.current?.(v);},onSelectionChange:v=>{Q(v),Te.current?.(v);},onMentionTrigger:()=>{he.current?.();},onMentionInputRemoved:()=>{ve.current?.();},canStartMention:()=>Re.current?.()??false,get resolveMention(){return ee.current},get onPaste(){return V.current},get onCopy(){return Le.current},maxLength:()=>De.current,htmlStyles:()=>Ne.current,autoLink:()=>le.current!==false,isReadOnly:()=>Qe.current?.()??!!Oe.current,areKeyboardShortcutsEnabled:()=>Be.current!==false,enterInsertsParagraph:()=>!!ze.current});let b=e??n;U?y.current.setDoc(U):b&&typeof DOMParser<"u"&&y.current.setValue(b);}let S=y.current;a$i(()=>{o!==void 0?S.setDoc(o):e!==void 0&&S.setValue(e);}),useEffect(()=>{l&&Q(fn);},[l]);let me=M??e??pe,Pe=gs(me),ke=S.canUndo(),T=S.canRedo();return useMemo(()=>({core:S,selectionState:D,value:me,isEmpty:Pe,isDisabled:!!l,keyboardShortcuts:a!==false,canUndo:ke,canRedo:T,focus:()=>{S.focus();},selectStart:()=>{S.selectStart();},selectEnd:()=>{S.selectEnd();},setCaretPosition:b=>{S.setCaretPosition(b);},undo:()=>{S.undo();},redo:()=>{S.redo();},getValue:()=>S.getValue(),setValue:(b,v)=>{S.setValue(b,v);},getDoc:b=>S.getDoc(b),setDoc:(b,v)=>{S.setDoc(b,v);},selectAll:b=>{S.selectAll(b);},select:(b,v)=>{S.select(b,v);},getSelectionState:()=>S.getSelectionState(),exec:(b,...v)=>{S.exec(b,...v);},isMarkActive:b=>!!D.marks[b],toggleMark:b=>{S.exec("toggleMark",b);},setMark:(b,v)=>{S.exec("setMarkValue",b,v);}}),[S,D,me,Pe,l,a,ke,T])}function ii(t,e){let n=t.ctrlKey||t.metaKey,o=t.key.toLowerCase();if(n&&!t.altKey&&o==="z")return t.preventDefault(),t.shiftKey?e.redo():e.undo(),true;if(t.ctrlKey&&!t.altKey&&!t.shiftKey&&o==="y")return t.preventDefault(),e.redo(),true;if(n&&!t.shiftKey&&!t.altKey){if(o==="b")return t.preventDefault(),e.toggleMark("bold"),true;if(o==="i")return t.preventDefault(),e.toggleMark("italic"),true;if(o==="u")return t.preventDefault(),e.toggleMark("underline"),true}return false}function Jn(t,e={}){let n=Ts(t),{ref:o,autoFocus:r,onKeyDown:i,keyboardShortcuts:s}=e,l=s??n.keyboardShortcuts,a=useId(),c=useRef(null),d=useRef(null),u=useCallback(m=>{d.current&&(d.current(),d.current=null),m&&(d.current=n.core.attach(m));},[n.core]),f$1=useMemo(()=>f(c,u,o??null),[u,o]);useEffect(()=>(n.core.setKeyboardShortcutsEnabled(s),()=>{n.core.setKeyboardShortcutsEnabled(void 0);}),[n.core,s]);let p=useRef(false);useEffect(()=>{if(!p.current)switch(p.current=true,r){case true:{n.focus();break}case "start":{n.selectStart();break}case "end":{n.selectEnd();break}}},[n.core]);let{keyboardProps:h}=j({onKeyDown:m=>{i?.(m)||l&&ii(m,n)||m.continuePropagation();}});return {editableProps:{...h,id:a,ref:f$1,contentEditable:!n.isDisabled,suppressContentEditableWarning:true,role:"textbox","aria-multiline":true,"data-editor-root":"true"}}}function Ts(t){let e=useContext(Dt);if(t)return t;if(!e)throw new Error("useEditable must be passed an editor or used within an EditorProvider");return e}var Qn=({editor:t,children:e})=>jsx(Dt.Provider,{value:t,children:e});var pn=({markName:t,icon:e,ariaLabel:n,isDisabled:o})=>{let{core:r,selectionState:i}=Se(),s=!!i.marks[t];return jsx(a$h,{variant:"tertiary",isSelected:s,size:"sm",icon:e,"aria-label":n,"data-testid":`editor-${t}-button`,isDisabled:o,onPress:()=>{r.exec("toggleMark",t),r.focus();},preventFocusOnPress:true})},to=({colorKey:t,"aria-label":e,isDisabled:n})=>{let{core:o,selectionState:r}=Se(),i=t==="color"?r.marks.color:r.marks.backgroundColor,s=wt.useRef(null),l=useCallback(()=>{s.current=r.range;},[r.range]),a=useCallback(p=>{setTimeout(()=>{let h=o.getSelectionState().range??s.current;h&&o.select(h),o.exec("setMarkValue",t,p);},0);},[o,t]),c=useCallback(p=>{a(p);},[a]),d=useCallback(()=>{a();},[a]),u=useCallback(({ref:p,triggerProps:h})=>jsx(a$c,{icon:t==="color"?TextIcon:HighlightTextIcon,"aria-label":e,"data-testid":t==="color"?"editor-font-color-button":"editor-background-color-button",size:"md",variant:"popover",isDisabled:n,className:it,preventFocusOnPress:true,...h,ref:p}),[t,e,n]),f=useCallback(p=>{p?c(p.toString("rgba")):d();},[d,c]);return jsx(b$3,{presets:Mn,allowRemoval:true,pickerMode:"lazy",placement:"top end",colorLabel:false,renderTriggerButton:u,onTriggerPress:l,value:i||"#000000",onChange:f,isDisabled:n})};var Xe={Add:"add",Edit:"edit",Show:"show"},li=({isDisabled:t,addLinkLabel:e,editLinkLabel:n,removeLinkLabel:o,linkAnnotationLabel:r,linkCancelLabel:i,linkSaveLabel:s})=>{let{formatMessage:l}=b(),{core:a}=Se();return jsxs(b$4,{type:"dialog",children:[jsx(j$1,{children:jsx(a$c,{icon:LinkIcon,size:"sm",isDisabled:t,"aria-label":e??l(Ze.addLink),"data-testid":"editor-add-link-button",className:it,preventFocusOnPress:true})}),jsx(a$j,{className:sprinkles({boxShadow:"medium"}),placement:"top end",children:({close:c})=>jsx(a$k,{size:"content",style:{minWidth:240},children:jsx(Ls,{addLinkLabel:e,editLinkLabel:n,removeLinkLabel:o,linkAnnotationLabel:r,linkCancelLabel:i,linkSaveLabel:s,close:()=>{c(),setTimeout(()=>{a.focus();},0);}})})})]})},Ls=({close:t,addLinkLabel:e,editLinkLabel:n,removeLinkLabel:o,linkAnnotationLabel:r,linkCancelLabel:i,linkSaveLabel:s})=>{let{core:l,selectionState:a}=Se(),{formatMessage:c}=b(),d=a.link?.url,[u,f]=wt.useState(d?Xe.Show:Xe.Add),[p,h]=wt.useState(d||""),m=jsx(a$a,{padding:"lg",children:jsx(a$s,{label:r??c(Ze.link),value:p,autoFocus:true,onChange:h,placeholder:"https://yourdomain.com","data-testid":"editor-link-input"})});return jsxs(Fragment,{children:[u===Xe.Add&&jsxs(Fragment,{children:[m,jsx(a$a,{display:"flex",justifyContent:"flex-end",padding:"lg",className:qo,children:jsx(b$9,{isDisabled:!a$t(p,true)||ye(p)==="",label:e??c(Ze.addLink),"data-testid":"editor-link-add-button",size:"sm",onPress:()=>{l.exec("wrapLink",_n(p)),t?.();},preventFocusOnPress:true})})]}),u===Xe.Show&&jsxs(Fragment,{children:[jsx(a$a,{padding:"lg",children:jsx(a$p,{type:"subtitle",size:"sm",children:d})}),jsxs(a$a,{display:"flex",justifyContent:"flex-end",padding:"lg",gap:"lg",borderColor:"border.subtle",borderWidth:1,borderStyle:"solid",children:[jsx(b$9,{label:n??c(Ze.editLink),"data-testid":"editor-link-edit-button",size:"sm",variant:"secondary",onPress:()=>{f(Xe.Edit);},style:{flex:1,justifyContent:"center"}}),jsx(b$9,{label:o??c(Ze.removeLink),"data-testid":"editor-link-remove-button",size:"sm",onPress:()=>{l.exec("unwrapLink"),t?.();},preventFocusOnPress:true,style:{flex:1,justifyContent:"center"}})]})]}),u===Xe.Edit&&jsxs(Fragment,{children:[m,jsxs(a$a,{display:"flex",justifyContent:"flex-end",padding:"lg",gap:"lg",borderColor:"border.subtle",borderWidth:1,borderStyle:"solid",children:[jsx(b$9,{label:i??c(Ze.cancel),"data-testid":"editor-link-cancel-button",size:"sm",variant:"secondary",onPress:()=>{f(Xe.Show),t?.();}}),jsx(b$9,{label:s??c(Ze.save),"data-testid":"editor-link-save-button",size:"sm",isDisabled:!a$t(p,true)||ye(p)==="",onPress:()=>{l.exec("updateLinkUrl",_n(p)),t?.();}})]})]})]})},Ze=c({addLink:{id:"bui.editor.addLink",defaultMessage:"Add Link"},editLink:{id:"bui.editor.editLink",defaultMessage:"Edit Link"},removeLink:{id:"bui.editor.removeLink",defaultMessage:"Remove Link"},cancel:{id:"bui.editor.cancel",defaultMessage:"Cancel"},save:{id:"bui.editor.save",defaultMessage:"Save"},link:{id:"bui.editor.linkAnnotation",defaultMessage:"Link"}});var oo=wt.createContext({items:[],containerRef:{current:null},maxMentionableUsersSuggestions:10}),_s=({key:t,value:e},{isDisabled:n,optionProps:o,isFocused:r,_state:i},s)=>{let{hoverProps:l}=a$4({isDisabled:n}),{label:a,data:c}=e;return jsxs(Fragment,{children:[jsxs("li",{...g$1(o,l),className:Qo({isDisabled:n,isHovered:r}),"data-active":r||void 0,ref:s,children:[jsx(a$a,{elementType:"span",display:"flex","aria-hidden":true,children:jsx(a$g,{name:a,...c?.avatar})}),jsxs(a$a,{display:"flex",flexDirection:"column",children:[jsx(a$p,{type:"subtitle",size:"sm",children:a}),jsx(a$p,{type:"helper",size:"sm",children:c?.description})]})]}),t===i.collection.getLastKey()?null:jsx(a$b,{})]})};function no(t){return t.displayName?.trim()||t.name?.trim()||t.id}function ro(t){return t.displayName??no(t)}function io({anchor:t,onClose:e,mentionLabel:n}){let{core:o}=Se(),{containerRef:r,items:i,maxMentionableUsersSuggestions:s}=useContext(oo),[l,a]=useState(""),{contains:c}=a$l({sensitivity:"base"}),{formatMessage:d}=b(),u=useRef(false),f=useCallback(()=>{u.current=true,e();},[e]),p=useMemo(()=>{let x=i.filter(M=>l===""||c(no(M),l)).map(M=>({id:M.id,label:no(M),data:M}));return s?x.slice(0,s):x},[i,s,l,c]),h=useCallback(x=>jsx(a$m,{textValue:x.label,children:x.label},x.id),[]),m=useCallback(x=>{if(u.current||x==null)return;let M=i.find(G=>G.id===x);M&&(f(),o.exec("confirmMention",{id:M.id,displayName:ro(M)}),o.exec("insertText"," "),o.focus());},[f,o,i]),k=b$5({items:p,children:h,menuTrigger:"focus",onSelectionChange:m}),I=useCallback(x=>{if(u.current)return;f();let M=x==="backspace"?"":`@${k.inputValue}`;o.exec("removeMentionInput",M,x==="arrowStart"?"start":"end"),o.focus();},[f,o,k.inputValue]),$=useRef(null),w=useRef(null),j=useRef(null),N=useRef(null);a$n({ref:N,onInteractOutside:()=>{k.close();}});let{inputProps:D,listBoxProps:Q}=a$o({defaultItems:p,inputRef:w,buttonRef:$,listBoxRef:j,popoverRef:N,menuTrigger:"focus","aria-label":n??d(Ns.mention)},k);useLayoutEffect(()=>{w.current?.focus(),setTimeout(()=>{w.current?.focus();});},[]);let U=useCallback(x=>{let M=x.currentTarget,G=M.selectionStart===0&&M.selectionEnd===0,E=M.selectionStart===M.value.length&&M.selectionEnd===M.value.length;if(x.key==="Backspace"&&G)x.preventDefault(),I("backspace");else if(x.key==="Escape")I("escape");else if(x.key==="ArrowLeft"||x.key==="ArrowRight"){let ee=V=>x.key==="ArrowLeft"!=(b$1(V).getComputedStyle(V).direction==="rtl");(ee(M)?G:E)&&(x.preventDefault(),I(ee(t)?"arrowStart":"arrowEnd"));}let Te=x.metaKey||x.ctrlKey,he=x.key.toLowerCase(),ve=Te&&!x.shiftKey&&he==="z"&&o.canUndo(),Re=(Te&&x.shiftKey&&he==="z"||x.ctrlKey&&he==="y")&&o.canRedo();(ve||Re)&&(x.preventDefault(),ve?o.undo():o.redo(),f(),o.focus());},[t,I,f,o]),pe=useMemo(()=>{if(!CSS.supports("field-sizing","content")){let x=b$1(w.current),M=w.current?x?.getComputedStyle(w.current).font:void 0;return {width:M?b$6({text:k.inputValue,font:M,element:w.current}).width+10:"4ch"}}},[k.inputValue]);return jsxs(Fragment,{children:[createPortal(jsx("input",{...g$1(D,{onKeyDown:U,onBlur:()=>{I("blur");},onChange:x=>{a(x.target.value);}}),style:pe,dir:/\p{L}/u.test(k.inputValue)?"auto":void 0,className:Jo,ref:w}),t),jsx(b$7.Provider,{value:k,children:jsx(a$j,{triggerRef:r,isNonModal:true,ref:N,state:k,crossOffset:-2,children:jsx(c$1,{...Q,items:void 0,ref:j,"data-testid":"editor-mention-listbox",className:a$6(f$1,sprinkles({width:"full"})),renderOption:_s})})})]})}io.displayName="MentionInputOverlay";var Ns=c({mention:{defaultMessage:"Mention",id:"bui.editor.mention"}});var ao=wt.forwardRef(({value:t,defaultValue:e$1,onChange:n,style:o,spellCheck:r,placeholder:i,isInline:s,isDisabled:l,editableContentAriaLabel:a,containerRef:c,onHelpDialogOpenRequest:d,mentionableUsers:u,editorHandle:f,maxMentionableUsersSuggestions:p,autoFocus:h,editorRef:m,saveOnEnter:k,onSave:I,autoLink:$,mentionLabel:w,boldLabel:j,italicLabel:N,underlineLabel:D,fontColorLabel:Q,backgroundColorLabel:U,helpLabel:pe,addLinkLabel:x,editLinkLabel:M,removeLinkLabel:G,linkAnnotationLabel:E,linkCancelLabel:Te,linkSaveLabel:he},ve)=>{let Re=useRef(null),ee=useRef(null),{formatMessage:V}=b(),[Le,De]=useState(null),Ne=useRef(0),[Qe,Oe]=useState(false),Be=()=>{let T=ee.current?.querySelector("[data-mention-anchor]");T&&(Ne.current+=1,De({anchor:T,id:Ne.current}));},le=Xn({value:t,defaultValue:e$1,onChange:n,isDisabled:l,onMentionTrigger:Be,onMentionInputRemoved:()=>{De(null);},canStartMention:()=>(u?.length??0)>0,resolveMention:T=>{let b=u?.find(v=>v.id===T);return b&&ro(b)},autoLink:$}),ze=le.core;wt.useEffect(()=>{m&&(m.current=ze);},[ze,m]);let y=T=>a$2(T)?false:k&&T.key==="Enter"&&!T.shiftKey||(T.ctrlKey||T.metaKey)&&T.key==="Enter"?(T.preventDefault(),I(),true):T.altKey&&T.key==="F10"?(T.preventDefault(),Re.current?.querySelector("button")?.focus(),true):false,{editableProps:S}=Jn(le,{ref:ee,autoFocus:h,onKeyDown:y}),me=T=>{if(l)return;let{isLinkClick:b,url:v}=Tr(T.target,{metaKey:T.metaKey,ctrlKey:T.ctrlKey,mac:e()});b&&(T.preventDefault(),v&&b$1(T.currentTarget).open(v,"_blank","noopener,noreferrer"));};wt.useEffect(()=>{let T=ee.current;if(!T||l)return;let b=a$8(T),v=b$1(T),Fe=Ke=>{Oe(e()?Ke.metaKey:Ke.ctrlKey);},mt=()=>{Oe(false);};return b.addEventListener("keydown",Fe),b.addEventListener("keyup",Fe),v.addEventListener("blur",mt),()=>{b.removeEventListener("keydown",Fe),b.removeEventListener("keyup",Fe),v.removeEventListener("blur",mt),mt();}},[l]),useImperativeHandle(ve,()=>({startMention:()=>{u?.length&&(ee.current?.querySelector("input[role='combobox']")||(ze.exec("insertMentionInput"),Be()));}})),useImperativeHandle(f,()=>({setCaretPosition:T=>{le.setCaretPosition(T);},focus:()=>{le.focus();}}));let Pe=useMemo(()=>({items:u||[],containerRef:c,maxMentionableUsersSuggestions:p}),[u,c,p]),ke=le.isEmpty;return jsx(oo.Provider,{value:Pe,children:jsxs(Qn,{editor:le,children:[jsxs(a$9,{className:a$6(qt,"BaselineUI-Editor-RichEditorToolbar"),"aria-controls":S.id,ref:Re,children:[jsxs(a$a,{display:"flex",flexDirection:"row",role:"group",gap:"xs",paddingX:"sm",children:[jsx(pn,{markName:"bold",icon:BoldIcon,ariaLabel:j??V(ht.bold),isDisabled:l}),jsx(pn,{markName:"italic",icon:ItalicIcon,ariaLabel:N??V(ht.italic),isDisabled:l}),jsx(pn,{markName:"underline",icon:UnderlineIcon,ariaLabel:D??V(ht.underline),isDisabled:l})]}),jsx(a$b,{orientation:"vertical",className:yt}),jsx(to,{colorKey:"color","aria-label":Q??V(ht.fontColor),isDisabled:l}),jsx(a$b,{orientation:"vertical",className:yt}),jsx(to,{colorKey:"backgroundColor","aria-label":U??V(ht.backgroundColor),isDisabled:l}),jsx(a$b,{orientation:"vertical",className:yt}),jsx(li,{isDisabled:l,addLinkLabel:x,editLinkLabel:M,removeLinkLabel:G,linkAnnotationLabel:E,linkCancelLabel:Te,linkSaveLabel:he}),jsx(a$b,{orientation:"vertical",className:yt}),jsx(a$c,{className:it,icon:QuestionmarkCircleIcon,size:"sm","aria-label":pe??V(ht.help),"data-testid":"editor-help-button",onPress:d})]}),jsx(a$b,{variant:"secondary"}),jsxs("div",{style:{position:"relative"},children:[!!(i&&ke)&&jsx("span",{"aria-hidden":true,"aria-disabled":true,"data-testid":"editor-placeholder",style:{position:"absolute",pointerEvents:"none",userSelect:"none",top:0,left:0,right:0},className:a$6(xt({isDisabled:l}),Yo,"BaselineUI-Editor-RichEditorPlaceholder"),children:i}),jsx("div",{...S,onClick:me,"data-mod-held":Qe?"":void 0,"aria-label":a,"aria-placeholder":i,spellCheck:r,style:o,className:a$6(xt({isDisabled:l}),Wt({isInline:s}),"BaselineUI-Editor-RichEditorEditingArea")})]}),Le!==null&&jsx(io,{anchor:Le.anchor,mentionLabel:w,onClose:()=>{De(null);}},Le.id)]})})});ao.displayName="RichEditor";var ht=c({bold:{defaultMessage:"Bold",id:"bui.editor.bold"},italic:{defaultMessage:"Italic",id:"bui.editor.italic"},underline:{defaultMessage:"Underline",id:"bui.editor.underline"},backgroundColor:{defaultMessage:"Background Color",id:"bui.editor.backgroundColor"},fontColor:{defaultMessage:"Font Color",id:"bui.editor.fontColor"},help:{defaultMessage:"Help",id:"bui.editor.help"}});var fi=wt.memo(wt.forwardRef(({className:t,style:e,"data-block-id":n,"data-block-class":o,enableRichText:r=false,onCancel:i,onSave:s,isInline:l=true,submitButtonIcon:a=ArrowUpCircleFilledIcon,submitButtonAriaLabel:c,cancelButtonAriaLabel:d,"aria-label":u,"aria-describedby":f$1,"aria-labelledby":p,"aria-details":h,editableContentAriaLabel:m="Editing Area",footerButtons:k,clearOnCancel:I,clearOnSave:$,mentionLabel:w,boldLabel:j$1,italicLabel:N,underlineLabel:D,fontColorLabel:Q,backgroundColorLabel:U,helpLabel:pe,closeLabel:x,actionLabel:M,shortcutLabel:G,toolbarFocusLabel:E,selectAllLabel:Te,cutLabel:he,copyLabel:ve,pasteLabel:Re,undoLabel:ee,redoLabel:V,openHelpDialogLabel:Le,submitLabel:De,addLinkLabel:Ne,editLinkLabel:Qe,removeLinkLabel:Oe,linkAnnotationLabel:Be,linkCancelLabel:le,linkSaveLabel:ze,...y},S)=>{let me=useRef(null),{formatMessage:Pe}=b(),ke=useRef(null),T=useRef(null),b$1=useRef(null),v=!r&&y.variant==="minimal",Fe=useRef(null),[mt,Ke]=wt.useState(y.value||y.defaultValue),xn=y.value!==void 0&&y.onChange!==void 0;r&&y.value!==void 0&&!y.onChange&&a$d("editor-rich-value-uncontrolled","Editor: `value` without `onChange` in rich text mode sets the initial content only. Use `defaultValue` for uncontrolled content, or add `onChange` to control the value.");let po=y.value!==void 0&&(!r||xn),yn=y.value;wt.useEffect(()=>{po&&yn!==void 0&&Ke(yn);},[po,yn]);let ho=!b$2(mt||""),bn=y.isDisabled||y.isSaveDisabled||ho,{fieldProps:pi}=a$e({"aria-label":u,"aria-labelledby":p,"aria-describedby":f$1,"aria-details":h,labelElementType:"div"});v&&!y.avatarName&&console.warn("Editor: When using the minimal `variant` and `enableRichText` is `false`, you should provide an `avatarName`.");let En=useCallback(()=>{Ke(""),r?me.current?.setValue("<p></p>",{emit:true}):T.current?.clear();},[r]),It=useCallback(()=>{bn||(s?.(r?me.current?.getValue()??"":ke.current.value),$&&En());},[En,$,r,s,bn]),hi=a$f(ho&&!y.isDisabled,()=>r?me.current?.focus():ke.current?.focus()),mo=jsx(a$c,{variant:"ghost","aria-label":c||Pe(uo.save),icon:a,isDisabled:bn,onFocusChange:hi,"data-testid":"editor-save-button",size:"md",excludeFromTabOrder:v,className:a$6({[er]:v},"BaselineUI-Editor-Save"),onPress:It,preventFocusOnPress:true}),[mi,Tn]=wt.useState(false),{keyboardProps:gi}=j({onKeyDown:W=>{(W.metaKey||W.ctrlKey)&&W.shiftKey&&W.key.toLowerCase()==="h"?(W.preventDefault(),Tn(true)):W.continuePropagation();}}),go=useCallback(W=>{Ke(W),y.onChange?.(W);},[y]);return jsxs("div",{...g$1(pi,r?gi:{}),role:"application",ref:f(b$1,S),style:e,"data-block-id":n,"data-block-class":o,className:a$6(Go({isInline:l,isMinimal:v}),"BaselineUI-Editor",t),"aria-disabled":y.isDisabled,children:[v?jsxs(Fragment,{children:[l?jsx(a$g,{className:$o,name:y.avatarName||""}):null,jsxs("div",{className:nr({isInline:l}),children:[jsx($t,{isMinimal:v,textBoxRef:ke,ref:T,isInline:l,editableContentAriaLabel:m,...y,onChange:go,onSave:It}),mo]})]}):jsxs(Fragment,{children:[r?jsx(ao,{containerRef:b$1,ref:Fe,editorRef:me,isInline:l,editableContentAriaLabel:m,onHelpDialogOpenRequest:()=>{Tn(true);},mentionLabel:w,boldLabel:j$1,italicLabel:N,underlineLabel:D,fontColorLabel:Q,backgroundColorLabel:U,helpLabel:pe,addLinkLabel:Ne,editLinkLabel:Qe,removeLinkLabel:Oe,linkAnnotationLabel:Be,linkCancelLabel:le,linkSaveLabel:ze,...y,value:xn?y.value:void 0,defaultValue:y.defaultValue??(xn?void 0:y.value),onChange:go,onSave:It}):jsxs(Fragment,{children:[!l&&jsx(a$b,{variant:"secondary"}),jsx($t,{onCancel:i,textBoxRef:ke,ref:T,isInline:l,editableContentAriaLabel:m,...y,onChange:W=>{Ke(W),y.onChange?.(W);},onSave:It})]}),jsx(a$b,{variant:"secondary"}),jsxs("div",{className:a$6(qt,sprinkles({justifyContent:"space-between"}),"BaselineUI-Editor-Footer"),children:[jsxs(a$a,{paddingX:"sm",gap:"sm",display:"flex",children:[r&&y.mentionableUsers?jsx(a$c,{icon:AtIcon,size:"sm","aria-label":w??Pe(uo.mention),"data-testid":"editor-mention-button",onPress:()=>Fe.current?.startMention(),preventFocusOnPress:true,className:"BaselineUI-Editor-Mention"}):null,k?.map(({type:W,props:_t},xo)=>W==="action"?jsx(a$c,{..._t,size:"sm",isDisabled:y.isDisabled||_t.isDisabled},xo):jsx(a$h,{..._t,size:"sm",variant:"tertiary",isDisabled:y.isDisabled||_t.isDisabled},xo))]}),jsxs(a$a,{children:[!!i&&jsx(a$c,{variant:"secondary",icon:XCircleFilledIcon,isDisabled:y.isDisabled,"data-testid":"editor-cancel-button",size:"md",onPress:()=>{i(),I&&En();},"aria-label":d||Pe(uo.cancel),className:"BaselineUI-Editor-Cancel"}),mo]})]})]}),jsx(cr,{isOpen:mi,onClose:()=>{Tn(false);},toolbarFocusLabel:E,helpLabel:pe,closeLabel:x,actionLabel:M,shortcutLabel:G,boldLabel:j$1,italicLabel:N,underlineLabel:D,selectAllLabel:Te,cutLabel:he,copyLabel:ve,pasteLabel:Re,undoLabel:ee,redoLabel:V,openHelpDialogLabel:Le,submitLabel:De})]})}));fi.displayName="Editor";var uo=c({cancel:{defaultMessage:"Cancel",id:"bui.editor.cancel"},save:{defaultMessage:"Save",id:"bui.editor.save"},mention:{defaultMessage:"Mention",id:"bui.editor.mention"}});
|
|
30
|
+
export{zn as a,J as b,we as c,Ae as d,Lt as e,Se as f,fn as g,Xn as h,ii as i,Jn as j,Qn as k,fi as l};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {u}from'./chunk-
|
|
1
|
+
import {u}from'./chunk-2MNK24YJ.mjs';import {useEffect}from'react';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {c,b}from'./chunk-
|
|
1
|
+
import {c,b}from'./chunk-JYWJE6L5.mjs';import {a}from'./chunk-JJG67M2S.mjs';import m,{useEffect,useCallback}from'react';/**
|
|
2
2
|
* Copyright (c) 2023-2024 PSPDFKit GmbH. All rights reserved.
|
|
3
3
|
*
|
|
4
4
|
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
|