@inkeep/open-knowledge 0.4.0-beta.25 → 0.4.0-beta.27
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/THIRD_PARTY_NOTICES.md +5 -0
- package/dist/alias-JE7RI5QX-BCGl9_yw.mjs +1 -0
- package/dist/assets/skills/open-knowledge/SKILL.md +1 -1
- package/dist/awk2-POPGKRAI-CGGIG9fD.mjs +1 -0
- package/dist/{banner-DdbR6AZr.mjs → banner-8cQrR88n.mjs} +2 -2
- package/dist/base64-4YMZCVJ5-DQZX3-n8.mjs +1 -0
- package/dist/basename-AA2KJYZQ-BxQSdX4k.mjs +1 -0
- package/dist/bash-IJWYRKFO-BitzNsGT.mjs +1 -0
- package/dist/build-GAD37AZK.mjs +1 -0
- package/dist/build-fAc55Z_L.mjs +2 -0
- package/dist/cat-RDUMLXKC-DT-A9snL.mjs +1 -0
- package/dist/chmod-SYMGL4JA-DjEw7qQb.mjs +1 -0
- package/dist/{chokidar-CxU7f6JW.mjs → chokidar-DnkSPA-1.mjs} +1 -1
- package/dist/{chunk-24IMIIXA-B6yIPkk2.mjs → chunk-24IMIIXA-_PX4ITYZ.mjs} +2 -2
- package/dist/{chunk-3THT3N7L-DztAF386.mjs → chunk-3THT3N7L-DrzOuTpA.mjs} +1 -1
- package/dist/{chunk-3ZUFRYJ4-qsYuZX7b.mjs → chunk-3ZUFRYJ4-BUqSdAvt.mjs} +1 -1
- package/dist/{chunk-44UOCSGV-CaFxJDHm.mjs → chunk-44UOCSGV-BbZqjKvt.mjs} +1 -1
- package/dist/{chunk-4GTNDTRF-PuLVuVJW.mjs → chunk-4GTNDTRF-C7Bk89yc.mjs} +2 -2
- package/dist/{chunk-4HHKTUW3-CQ53AiA_.mjs → chunk-4HHKTUW3-DaxBqSRO.mjs} +1 -1
- package/dist/{chunk-4Q4SM6WR-BlQvqCag.mjs → chunk-4Q4SM6WR-CQ3yG3KJ.mjs} +2 -2
- package/dist/{chunk-55VFSPNA-DLwfww5b.mjs → chunk-55VFSPNA-o6aQtPTI.mjs} +2 -2
- package/dist/{chunk-5QMZ5MUS-CAp625aG.mjs → chunk-5QMZ5MUS-SLhNX8t9.mjs} +2 -2
- package/dist/{chunk-5QVNJEHU-dbrKfPGl.mjs → chunk-5QVNJEHU-Besgjasu.mjs} +2 -2
- package/dist/{chunk-5V6VZH6T-DMPvCPbn.mjs → chunk-5V6VZH6T-1WdUUj8r.mjs} +2 -2
- package/dist/{chunk-62RKD26F-B9la0pfD.mjs → chunk-62RKD26F-BbNaH0fp.mjs} +2 -2
- package/dist/{chunk-64BAICW3-D92CLSK-.mjs → chunk-64BAICW3-CQTRuYnm.mjs} +2 -2
- package/dist/{chunk-74CEPOFO-BcZUJMO1.mjs → chunk-74CEPOFO-CLQh_oXv.mjs} +1 -1
- package/dist/{chunk-7L36YK2X-D7Z_Qw_C.mjs → chunk-7L36YK2X-VJvKq7OX.mjs} +1 -1
- package/dist/{chunk-7TSDKFEO-DUQhJkDy.mjs → chunk-7TSDKFEO-D7K8a1nI.mjs} +1 -1
- package/dist/{chunk-A4HU7SVR-DKLaJeys.mjs → chunk-A4HU7SVR-SqitiwTc.mjs} +1 -1
- package/dist/{chunk-A4JSPFCI-CEm2r8SB.mjs → chunk-A4JSPFCI-BzZWBgeR.mjs} +2 -2
- package/dist/{chunk-A5O5YHGN-DvJz5Cpw.mjs → chunk-A5O5YHGN-DQP-O5US.mjs} +2 -2
- package/dist/{chunk-A65PWWJC-DV6RO_es.mjs → chunk-A65PWWJC-C9G7KuCV.mjs} +2 -2
- package/dist/{chunk-A7A2DBEE-dTNL-45u.mjs → chunk-A7A2DBEE-CWXz1JTo.mjs} +1 -1
- package/dist/{chunk-A7ICOL4V-BvXPAaHu.mjs → chunk-A7ICOL4V-k5RTBWOL.mjs} +2 -2
- package/dist/{chunk-ALLTKNUZ-Cu6JFoC4.mjs → chunk-ALLTKNUZ-SyOkRvXW.mjs} +2 -2
- package/dist/{chunk-APT7OOP2-DmUrFuRy.mjs → chunk-APT7OOP2-CriAmyUL.mjs} +2 -2
- package/dist/{chunk-BBXLRYSX-K758HlCs.mjs → chunk-BBXLRYSX-dCISWeRn.mjs} +2 -2
- package/dist/{chunk-BRGMQKJV-BXc-9Cgj.mjs → chunk-BRGMQKJV-Dnv0H02a.mjs} +3 -3
- package/dist/{chunk-CR5AFCPT-DxNsgM0M.mjs → chunk-CR5AFCPT-BS9vrR_k.mjs} +2 -2
- package/dist/{chunk-CWQS3NFK-Co4ALolT.mjs → chunk-CWQS3NFK-BQ5SUtd7.mjs} +1 -1
- package/dist/{chunk-D4J545R4-DkHLjHX6.mjs → chunk-D4J545R4-T2J_By_d.mjs} +2 -2
- package/dist/{chunk-D6CWQ5DW-7lvT8dGP.mjs → chunk-D6CWQ5DW-0uvJGnRG.mjs} +2 -2
- package/dist/{chunk-D7MEQ3VN-D8jJZr4A.mjs → chunk-D7MEQ3VN-CSN8BGNX.mjs} +2 -2
- package/dist/{chunk-DCAAORBQ-C3s1D8OY.mjs → chunk-DCAAORBQ-BgX2K5fq.mjs} +2 -2
- package/dist/{chunk-DXB73IDG-DIKSLkPq.mjs → chunk-DXB73IDG-DfmyzFzL.mjs} +1 -1
- package/dist/{chunk-EEXR5ZDP-CETL3_Uw.mjs → chunk-EEXR5ZDP-DUXT2_T-.mjs} +1 -1
- package/dist/{chunk-EIZGF4BS-DOoQW9jQ.mjs → chunk-EIZGF4BS-BMblx_pb.mjs} +2 -2
- package/dist/{chunk-F23WWYKW-BK2tpXPf.mjs → chunk-F23WWYKW-B0xoXfw7.mjs} +2 -2
- package/dist/{chunk-F55TLFGB-Vy5RU2P3.mjs → chunk-F55TLFGB-CekdCv-K.mjs} +2 -2
- package/dist/{chunk-FEIOJCZD-C25Und0M.mjs → chunk-FEIOJCZD-Vm1q1kLH.mjs} +2 -2
- package/dist/{chunk-GCTKCWKD-Di-RB9Qt.mjs → chunk-GCTKCWKD-ByezaQ15.mjs} +1 -1
- package/dist/{chunk-GFQRA5P5-DnjwTqP3.mjs → chunk-GFQRA5P5-CkMj9l7f.mjs} +1 -1
- package/dist/{chunk-GOV5EKKI-CKV9jOGv.mjs → chunk-GOV5EKKI-B4qGAgcI.mjs} +2 -2
- package/dist/{chunk-GXVXFKBA-CUKDClxt.mjs → chunk-GXVXFKBA-CQs4HBko.mjs} +2 -2
- package/dist/{chunk-HDQ56CKY-MTQ75a8z.mjs → chunk-HDQ56CKY-DnAJDKCm.mjs} +2 -2
- package/dist/{chunk-HJQJAYMS-D-8Vc6Zb.mjs → chunk-HJQJAYMS-lEGf1x1q.mjs} +1 -1
- package/dist/{chunk-HJWBQKYG-XrOcsn2f.mjs → chunk-HJWBQKYG-lmVh-ZXn.mjs} +2 -2
- package/dist/{chunk-HWBSOZZR-BZF8XsyZ.mjs → chunk-HWBSOZZR-CdcHflPt.mjs} +2 -2
- package/dist/{chunk-HWKDQ44K-wgmyck2O.mjs → chunk-HWKDQ44K-cV6V5ZgY.mjs} +2 -2
- package/dist/{chunk-I57KEIP3-DipCOPKf.mjs → chunk-I57KEIP3-Cr5Okw7t.mjs} +2 -2
- package/dist/{chunk-IPJHKYVM-C3IodQq7.mjs → chunk-IPJHKYVM-orb6vjJ1.mjs} +1 -1
- package/dist/{chunk-J642UCRS-YiNealfn.mjs → chunk-J642UCRS-DfKEFKiV.mjs} +2 -2
- package/dist/{chunk-JVPRLUMK-VMFWXimu.mjs → chunk-JVPRLUMK-Bf9V_Gv7.mjs} +2 -2
- package/dist/{chunk-KMEYNNUA-pRogdye4.mjs → chunk-KMEYNNUA-Caoc9sHa.mjs} +2 -2
- package/dist/{chunk-LL3S3NLB-ByBS5IDP.mjs → chunk-LL3S3NLB-GadY6GUd.mjs} +2 -2
- package/dist/{chunk-LPQPILI2-FRQB9gt5.mjs → chunk-LPQPILI2-DDrAB1na.mjs} +2 -2
- package/dist/{chunk-LTZRCH7N-46S7WKw8.mjs → chunk-LTZRCH7N-DsWqztAp.mjs} +2 -2
- package/dist/{chunk-LWEGUNWT-DdGmM3wr.mjs → chunk-LWEGUNWT-DQ_TsrhS.mjs} +2 -2
- package/dist/{chunk-MDDMCKUK-CuRdI1Uv.mjs → chunk-MDDMCKUK-Cnfznbkf.mjs} +2 -2
- package/dist/{chunk-MDLLFABN-Wd1iVjXi.mjs → chunk-MDLLFABN-C_2lIHFT.mjs} +2 -2
- package/dist/{chunk-MHTUABJP-BWrqic3t.mjs → chunk-MHTUABJP-7AQ2Pv6q.mjs} +1 -1
- package/dist/{chunk-MIZPJHVH-DWdPvcYR.mjs → chunk-MIZPJHVH-BB7Is338.mjs} +2 -2
- package/dist/{chunk-MLXIYONF-CiCzoeGt.mjs → chunk-MLXIYONF-BI0CC1Dm.mjs} +2 -2
- package/dist/{chunk-MYE6AGBJ-DJo74dVC.mjs → chunk-MYE6AGBJ-DWNp4Fd-.mjs} +2 -2
- package/dist/{chunk-NAERJDUW-CIHrNgJB.mjs → chunk-NAERJDUW-D3VeMMYB.mjs} +2 -2
- package/dist/{chunk-NCNPKYJZ-BVljycUZ.mjs → chunk-NCNPKYJZ-BBZ5fJNa.mjs} +2 -2
- package/dist/{chunk-NUYSJFDK-BTseBdxv.mjs → chunk-NUYSJFDK-5tRwRhY2.mjs} +2 -2
- package/dist/{chunk-NYQYO467-BgXuDHUQ.mjs → chunk-NYQYO467-Blr3IMkQ.mjs} +2 -2
- package/dist/{chunk-OARHFVLG-Cr0x3Si_.mjs → chunk-OARHFVLG-Irp_vfLa.mjs} +2 -2
- package/dist/{chunk-OCLXQMOG-BW6rwyzS.mjs → chunk-OCLXQMOG-DKBkjIbk.mjs} +2 -2
- package/dist/{chunk-OCS6LSEM-D7VAOziZ.mjs → chunk-OCS6LSEM-C2EAQI0w.mjs} +2 -2
- package/dist/{chunk-OJDRYQWQ-ikvLWpfV.mjs → chunk-OJDRYQWQ-D4lSWh0K.mjs} +1 -1
- package/dist/{chunk-OL3S66CO-CQnF8cPH.mjs → chunk-OL3S66CO-BSC-nhbc.mjs} +2 -2
- package/dist/{chunk-PBXLG62G-CgbPJTiw.mjs → chunk-PBXLG62G-9wkRpzkO.mjs} +2 -2
- package/dist/{chunk-PP6PSHAB-CO4MYU__.mjs → chunk-PP6PSHAB-BkN6oaqq.mjs} +1 -1
- package/dist/{chunk-PYSFUGCK-DsRn64Ef.mjs → chunk-PYSFUGCK-C-zBGrN0.mjs} +2 -2
- package/dist/{chunk-QCDB2VPH-BUMOhlW7.mjs → chunk-QCDB2VPH-BUg_3i-W.mjs} +2 -2
- package/dist/{chunk-QJ7O6ZN3-F0_rcDPM.mjs → chunk-QJ7O6ZN3-h8P6Rj5g.mjs} +2 -2
- package/dist/{chunk-R6QSAL5T-CeW6f7-x.mjs → chunk-R6QSAL5T-CBXSpChE.mjs} +1 -1
- package/dist/{chunk-R6VWJ2ZL-FwG_Za20.mjs → chunk-R6VWJ2ZL-DSqbA7Rj.mjs} +1 -1
- package/dist/{chunk-RPNGRAAP-BmkapBPD.mjs → chunk-RPNGRAAP-BVzuWIcl.mjs} +2 -2
- package/dist/{chunk-SDNKECQQ-DkebEzkd.mjs → chunk-SDNKECQQ-CQaGD8tt.mjs} +2 -2
- package/dist/{chunk-SYMJJMQ4-DOZMaECk.mjs → chunk-SYMJJMQ4-C3GxJv_z.mjs} +2 -2
- package/dist/{chunk-T56QNPHK-DPXaSSfC.mjs → chunk-T56QNPHK-DLf9xkTG.mjs} +2 -2
- package/dist/{chunk-TLSUDHID-BovZg0r1.mjs → chunk-TLSUDHID-BHtR3boD.mjs} +2 -2
- package/dist/{chunk-TOMNU26N-AAglMy4J.mjs → chunk-TOMNU26N-DerX6zSM.mjs} +2 -2
- package/dist/{chunk-TXBZCHCQ-WeVWfqYv.mjs → chunk-TXBZCHCQ-CAbfX7on.mjs} +2 -2
- package/dist/{chunk-UNYNJIFU-CqGlXAg7.mjs → chunk-UNYNJIFU-Bd2svF5l.mjs} +3 -3
- package/dist/{chunk-V7TAPXDL-DQgGPvBY.mjs → chunk-V7TAPXDL-BUbPC-Wn.mjs} +2 -2
- package/dist/{chunk-VJFXDYWH-DIo0Ia0_.mjs → chunk-VJFXDYWH-B5EkAwKK.mjs} +2 -2
- package/dist/{chunk-VLGZJRPG-DymOu90-.mjs → chunk-VLGZJRPG-C9UlHcZa.mjs} +2 -2
- package/dist/{chunk-VOBGTVA6-Bfa1NTzt.mjs → chunk-VOBGTVA6-BbJdoZlr.mjs} +2 -2
- package/dist/{chunk-VYOJP4TV-PBsHe2md.mjs → chunk-VYOJP4TV-B4Ua-c0F.mjs} +2 -2
- package/dist/{chunk-WKFATFPP-KO2zkfs2.mjs → chunk-WKFATFPP-DWw-N9hi.mjs} +2 -2
- package/dist/{chunk-X2AJGDEF-D5w6wtaX.mjs → chunk-X2AJGDEF-BosVr67X.mjs} +1 -1
- package/dist/{chunk-XHM67O4N-akBjDPaR.mjs → chunk-XHM67O4N-Cd7Fiqsb.mjs} +1 -1
- package/dist/{chunk-XKQRETAK-RHzVmuiF.mjs → chunk-XKQRETAK-ud_FNcYV.mjs} +2 -2
- package/dist/{chunk-XORM457F-wr_DBBnV.mjs → chunk-XORM457F-B_0Xbzib.mjs} +2 -2
- package/dist/{chunk-XVDPCNWR-DxaG1FfA.mjs → chunk-XVDPCNWR-DNk_0jVb.mjs} +2 -2
- package/dist/{chunk-YCFVLTST-Dzwevuc3.mjs → chunk-YCFVLTST-0XsXjpJU.mjs} +2 -2
- package/dist/{chunk-YFG2CMIF-BoZQym0L.mjs → chunk-YFG2CMIF-BwW9XX2A.mjs} +2 -2
- package/dist/{chunk-YNYSPYQ5-DesxOVHh.mjs → chunk-YNYSPYQ5-Dq-BWW-f.mjs} +1 -1
- package/dist/{chunk-YS3AZT3J-CBc9LHIy.mjs → chunk-YS3AZT3J-CLwj1P0Z.mjs} +2 -2
- package/dist/{chunk-YTNYSM6T-WMIf3AF8.mjs → chunk-YTNYSM6T-TIb8x1lA.mjs} +2 -2
- package/dist/{chunk-Z6LRHWXI-DGTVoTuf.mjs → chunk-Z6LRHWXI-VE8VWpH9.mjs} +2 -2
- package/dist/{chunk-Z7JVV2SM-Cb4YKOCM.mjs → chunk-Z7JVV2SM-BAsPuUWb.mjs} +2 -2
- package/dist/clear-5CZ5X4YR-ph4db-bT.mjs +1 -0
- package/dist/cli.mjs +41 -38
- package/dist/colors-BCE2jNgl.mjs +1 -0
- package/dist/{colors-BNufdynn.mjs → colors-BtKMHmBX.mjs} +1 -1
- package/dist/column-WLPMMSTS-BCX6Q17n.mjs +1 -0
- package/dist/comm-5SLSESQG-C7AhH0K0.mjs +1 -0
- package/dist/constants-DjLdNmzD.mjs +2 -0
- package/dist/cp-XOYR4ABJ-CQdiaiBl.mjs +1 -0
- package/dist/{curl-47BFPSFW-C2kRcGkX.mjs → curl-47BFPSFW-BzVtpc-O.mjs} +2 -2
- package/dist/cut-OPC3VAGB-oTKBumd9.mjs +1 -0
- package/dist/date-DD7FVA2V-BrmKZaC_.mjs +1 -0
- package/dist/diff-HJF2MPDN-BNIGqrz6.mjs +1 -0
- package/dist/dirname-LEMTZZFS-BwH_Sy4c.mjs +1 -0
- package/dist/{dist-Cl_t5NRm.mjs → dist-BY6hbGlq.mjs} +29 -28
- package/dist/dist-DKX8LweU.mjs +1 -0
- package/dist/{dist-JNaknvi7.mjs → dist-DNYO-J2I.mjs} +805 -59
- package/dist/du-WO2ENHXQ-CaFJHtt9.mjs +1 -0
- package/dist/echo-O45JWWI2-BVUJjhWK.mjs +1 -0
- package/dist/env-5EPCWSXR-DH5CCl6V.mjs +1 -0
- package/dist/{execAsync-CulVJBMN.mjs → execAsync-Bpfn4nfY.mjs} +1 -1
- package/dist/{execAsync-CzW9fUYQ.mjs → execAsync-D93HRpVy.mjs} +1 -1
- package/dist/{execAsync-DuQoqWaW.mjs → execAsync-DMx5TUjh.mjs} +1 -1
- package/dist/expand-DTNXU4LQ-eK5V8PVi.mjs +1 -0
- package/dist/expansion-ENLSRCXJ-DJReNXZq.mjs +1 -0
- package/dist/expr-5T3UU5KE-DTdq14FE.mjs +1 -0
- package/dist/file-ZIGAJ4YS-WHJtEeVR.mjs +1 -0
- package/dist/find-TPUOAIUQ-Dk362bwv.mjs +1 -0
- package/dist/flag-coverage-QT4N2Z44-C5s46vwi.mjs +2 -0
- package/dist/fold-LDSORVYE-CkRa6rpW.mjs +1 -0
- package/dist/{getMachineId-bsd-DAmB-Ym0.mjs → getMachineId-bsd-B3nMvpKd.mjs} +2 -2
- package/dist/{getMachineId-bsd-FYDP9w5Q.mjs → getMachineId-bsd-CbGsKq4x.mjs} +2 -2
- package/dist/{getMachineId-bsd-mPrX3ckm.mjs → getMachineId-bsd-Cbosky3N.mjs} +2 -2
- package/dist/{getMachineId-darwin-B0Qw-MTj.mjs → getMachineId-darwin-BNex6tJ8.mjs} +2 -2
- package/dist/{getMachineId-darwin-C79HtyON.mjs → getMachineId-darwin-BnJVzhVS.mjs} +2 -2
- package/dist/{getMachineId-darwin-Co8Jnu5v.mjs → getMachineId-darwin-UUooObuL.mjs} +2 -2
- package/dist/{getMachineId-linux-BizmCjYq.mjs → getMachineId-linux-BCV7VFT0.mjs} +1 -1
- package/dist/{getMachineId-linux-BvLCCmKQ.mjs → getMachineId-linux-Bo4OhbSY.mjs} +1 -1
- package/dist/{getMachineId-linux-BBORs2cS.mjs → getMachineId-linux-D4ybKI-D.mjs} +1 -1
- package/dist/{getMachineId-unsupported-CbR45h2D.mjs → getMachineId-unsupported-4i2apDO3.mjs} +1 -1
- package/dist/{getMachineId-unsupported-DbGFOAw1.mjs → getMachineId-unsupported-DKWpTC9E.mjs} +1 -1
- package/dist/{getMachineId-unsupported-Bgp-Es9j.mjs → getMachineId-unsupported-DYYMUAWj.mjs} +1 -1
- package/dist/{getMachineId-win-Cy0XHq4X.mjs → getMachineId-win-CHxnm_JZ.mjs} +2 -2
- package/dist/{getMachineId-win-D5gDnBHa.mjs → getMachineId-win-E9RqBHbs.mjs} +2 -2
- package/dist/{getMachineId-win-CT_Y5i_4.mjs → getMachineId-win-W9lSyLKl.mjs} +2 -2
- package/dist/grep-3AIAIJVR-9FFpNxXg.mjs +1 -0
- package/dist/gzip-AQXSGOVS-B69jDA3r.mjs +1 -0
- package/dist/head-HT2B6D2J-LVz3MZgn.mjs +1 -0
- package/dist/help-VVWX7SA5-NiesqNE9.mjs +1 -0
- package/dist/history-J4QRNGRO-CJ6sdqLF.mjs +1 -0
- package/dist/hostname-BK6HG2DE-BTiQGLXj.mjs +1 -0
- package/dist/html-to-markdown-TFCECAGV-gA9lIhli.mjs +1 -0
- package/dist/index.mjs +1 -1
- package/dist/{init-uWmRmgCA.mjs → init-BdDRn515.mjs} +7 -7
- package/dist/init-CovPPI41.mjs +1 -0
- package/dist/{is-object-DF0ZeuvD.mjs → is-object-C-4FJ0rP.mjs} +1 -1
- package/dist/join-GG2LDHE5-DP2t9Lzd.mjs +1 -0
- package/dist/jq-ODXZBPLY-DIh5TTSi.mjs +1 -0
- package/dist/{js-exec-M6UR76J5-IyD-lpzv.mjs → js-exec-M6UR76J5-2jDKLOtz.mjs} +2 -2
- package/dist/{lib-BOCdCkg7.mjs → lib-CxZz7HCo.mjs} +1 -1
- package/dist/ln-4TRFBYAT-CcfWdebC.mjs +1 -0
- package/dist/loader-C4NU0t04.mjs +1 -0
- package/dist/{loader-hjhxvSRP.mjs → loader-CJZ7xojT.mjs} +2 -2
- package/dist/ls-KSXFZCWH-Ck3u5K5M.mjs +1 -0
- package/dist/{lzma-vr8hBkhz.mjs → lzma-noRZ7I73.mjs} +1 -1
- package/dist/md5sum-INMIK4DX-B5BLDgGd.mjs +1 -0
- package/dist/mkdir-TDEMSB6C-BHFCS7vA.mjs +1 -0
- package/dist/mv-Z6MORUFL-CmLWSH1J.mjs +1 -0
- package/dist/nl-U5YJDM32-Cn7q_PFe.mjs +1 -0
- package/dist/od-VJEF2UR5-BMxC8c-2.mjs +1 -0
- package/dist/paste-7N6AFSDS-C9XyEur2.mjs +1 -0
- package/dist/preview-CA76mHAB.mjs +1 -0
- package/dist/{preview-vq_EvsiP.mjs → preview-f8NorGUB.mjs} +2 -2
- package/dist/printf-CX64KX2P-Hzp-xme8.mjs +1 -0
- package/dist/public/assets/ActivityModeContent-Dlois8m1.js +2 -0
- package/dist/public/assets/{ConsentDialogBody-Ch5CwNgh.js → ConsentDialogBody-DmS5j5pu.js} +1 -1
- package/dist/public/assets/DocumentContext-B0jD_DRX.js +37 -0
- package/dist/public/assets/{GraphPanel-BKsp7Crh.js → GraphPanel-BWlIJ3tc.js} +2 -2
- package/dist/public/assets/{SettingsDialog-C9FPnh00.js → SettingsDialog-Jq0VRnPP.js} +2 -2
- package/dist/public/assets/SourceEditor-BGZmwp3D.js +2 -0
- package/dist/public/assets/config-validation-events-Czaccnqg.js +10 -0
- package/dist/public/assets/{dist-WhY-UbDY.js → dist-BYGzJeLM.js} +1 -1
- package/dist/public/assets/dist-BrsSsfiw.js +1 -0
- package/dist/public/assets/dist-CXGJFbY5.js +9 -0
- package/dist/public/assets/dist-Cq1LYbUj.js +1 -0
- package/dist/public/assets/{dist-BNZ2DXnR.js → dist-CyaBbyDQ.js} +1 -1
- package/dist/public/assets/dist-DsbVHLNy.js +1 -0
- package/dist/public/assets/{dist-B-xmnigy.js → dist-Du-s1q8P.js} +1 -1
- package/dist/public/assets/doc-hash-CBF-HGTP.js +422 -0
- package/dist/public/assets/index-CS7FfInu.js +1853 -0
- package/dist/public/assets/index-gFJyDijz.css +1 -0
- package/dist/public/assets/stex-CzCFWeB9.js +1 -0
- package/dist/public/assets/{target-navigation-intent-FPPCIJIk.js → target-navigation-intent-CFNdedu6.js} +1 -1
- package/dist/public/assets/{toggle-group-CP96D5oH.js → toggle-group-DC1U2RZo.js} +1 -1
- package/dist/public/assets/{tooltip-qQkwljHf.js → tooltip-BsZgyNLI.js} +1 -1
- package/dist/public/assets/typing-burst-detector-CvoRQQEa.js +2 -0
- package/dist/public/index.html +30 -20
- package/dist/pwd-D4OZ7N27-CxX1ETVW.mjs +1 -0
- package/dist/{python3-AUFTPCU6-BaJugIdp.mjs → python3-AUFTPCU6-C74hXpFG.mjs} +2 -2
- package/dist/readlink-MI4GCHJF-DeD4E7nz.mjs +1 -0
- package/dist/rev-XOSYPP45-BnymxcnA.mjs +1 -0
- package/dist/rg-FOQSCCX3-BiJSKli9.mjs +1 -0
- package/dist/rm-RTZG23RL-Djvo3nEY.mjs +1 -0
- package/dist/rmdir-XTQXT7RK-OI_3n90A.mjs +1 -0
- package/dist/sed-VFTTATXJ-Tyu5G4I6.mjs +1 -0
- package/dist/seq-RN5ZUASB-CG-hfPIu.mjs +1 -0
- package/dist/sha1sum-VJPNLNU6-CEXqRxvP.mjs +1 -0
- package/dist/sha256sum-PI32XWXY-Bxzw_ykX.mjs +1 -0
- package/dist/sleep-VZFPZFWA-WRTGZhTn.mjs +1 -0
- package/dist/sort-DCNRDA7U-CuSJrCSQ.mjs +1 -0
- package/dist/split-SITCSYCZ-DqKN3r-A.mjs +1 -0
- package/dist/sqlite3-56UMWEY3-C6G8A9IC.mjs +1 -0
- package/dist/{src-jO7GzWRA.mjs → src-B4WFg5kb.mjs} +2 -2
- package/dist/start-BeA0EREH.mjs +1 -0
- package/dist/{start-BnicFP1K.mjs → start-CuX8s4nh.mjs} +2 -2
- package/dist/stat-BT5A227F-D3-4IZjb.mjs +1 -0
- package/dist/strings-7PLOGTPD-DoJhZcXP.mjs +1 -0
- package/dist/tac-SJGXQ4T2-CGNEtOiG.mjs +1 -0
- package/dist/tail-S5ULNTJU-17nfIM0G.mjs +1 -0
- package/dist/tar-ANUBEFJY-C-eZUMPO.mjs +1 -0
- package/dist/tee-O7VXZDCO-D4C0E2s8.mjs +1 -0
- package/dist/time-DEUO3QV2-Wc9ZVUVu.mjs +1 -0
- package/dist/timeout-VRKMCG72-2MptSPRD.mjs +1 -0
- package/dist/touch-DX2IJOQ4-DOTz2-NU.mjs +1 -0
- package/dist/tr-2HXZRDSW-5aOBfN_I.mjs +1 -0
- package/dist/tree-LYXBS7DC-BVyeg_3R.mjs +1 -0
- package/dist/true-WHJNXCHG-QiTH9f1Z.mjs +1 -0
- package/dist/unexpand-RGTMIGZM-m3YwxdOg.mjs +1 -0
- package/dist/uniq-SUNANL47-CuhWyTTO.mjs +1 -0
- package/dist/wc-TQB3VNOX-CaEqXvYd.mjs +1 -0
- package/dist/which-XZHEH76L-DA_Bm_KM.mjs +1 -0
- package/dist/whoami-DGKU3D2X-Bdt58SNY.mjs +1 -0
- package/dist/xan-BXDXYEIB-CWBZ1rgf.mjs +1 -0
- package/dist/xan-view-ECQUO7AJ-eo_owVyX.mjs +1 -0
- package/dist/xargs-I6EZUCYF-VBH5v0oN.mjs +1 -0
- package/dist/yq-MJMAR36V-eZBfA9vJ.mjs +1 -0
- package/package.json +1 -1
- package/dist/alias-JE7RI5QX-Bia4gLMF.mjs +0 -1
- package/dist/awk2-POPGKRAI-DDrFV-7v.mjs +0 -1
- package/dist/base64-4YMZCVJ5-DDKKOjMm.mjs +0 -1
- package/dist/basename-AA2KJYZQ-BK5zVs3W.mjs +0 -1
- package/dist/bash-IJWYRKFO-B9r1a0X9.mjs +0 -1
- package/dist/build-B6buVrsB.mjs +0 -2
- package/dist/cat-RDUMLXKC-CeNrSElK.mjs +0 -1
- package/dist/chmod-SYMGL4JA-DFJ4ylQU.mjs +0 -1
- package/dist/clear-5CZ5X4YR-CadVxKrq.mjs +0 -1
- package/dist/colors-T3xmlXQT.mjs +0 -1
- package/dist/column-WLPMMSTS-6o4DDsDk.mjs +0 -1
- package/dist/comm-5SLSESQG-C2GatHU6.mjs +0 -1
- package/dist/constants-Dlyng5m6.mjs +0 -2
- package/dist/cp-XOYR4ABJ-DmS6dER-.mjs +0 -1
- package/dist/cut-OPC3VAGB-s4tQWhL5.mjs +0 -1
- package/dist/date-DD7FVA2V-Dubgjr6a.mjs +0 -1
- package/dist/diff-HJF2MPDN-DjGBLQph.mjs +0 -1
- package/dist/dirname-LEMTZZFS-B477CImE.mjs +0 -1
- package/dist/dist-DVNDjpnz.mjs +0 -1
- package/dist/du-WO2ENHXQ-C4c5wweW.mjs +0 -1
- package/dist/echo-O45JWWI2-TudodhHR.mjs +0 -1
- package/dist/env-5EPCWSXR-CTcNEMpy.mjs +0 -1
- package/dist/expand-DTNXU4LQ-BT6M2Tdc.mjs +0 -1
- package/dist/expansion-ENLSRCXJ-Cy7j--Iy.mjs +0 -1
- package/dist/expr-5T3UU5KE-D2Kr5nuJ.mjs +0 -1
- package/dist/file-ZIGAJ4YS-BH3jYcuM.mjs +0 -1
- package/dist/find-TPUOAIUQ-RFxkUcGN.mjs +0 -1
- package/dist/flag-coverage-QT4N2Z44--nNG-HLV.mjs +0 -2
- package/dist/fold-LDSORVYE-CfKQmrJ1.mjs +0 -1
- package/dist/grep-3AIAIJVR-DgQJLmW0.mjs +0 -1
- package/dist/gzip-AQXSGOVS-yXjpnIVd.mjs +0 -1
- package/dist/head-HT2B6D2J-BR4RHRTk.mjs +0 -1
- package/dist/help-VVWX7SA5-M6C6klSC.mjs +0 -1
- package/dist/history-J4QRNGRO-C1r7-kvT.mjs +0 -1
- package/dist/hostname-BK6HG2DE-BBBcRrtV.mjs +0 -1
- package/dist/html-to-markdown-TFCECAGV-B9oYuMVf.mjs +0 -1
- package/dist/init-BKrp4NZQ.mjs +0 -1
- package/dist/join-GG2LDHE5-xeTE0Mi4.mjs +0 -1
- package/dist/jq-ODXZBPLY-C5v6qNu_.mjs +0 -1
- package/dist/ln-4TRFBYAT-4XMTO1OQ.mjs +0 -1
- package/dist/loader-DqxqwNEe.mjs +0 -1
- package/dist/ls-KSXFZCWH-Bw_Cf-VY.mjs +0 -1
- package/dist/md5sum-INMIK4DX-CAIH4ZVI.mjs +0 -1
- package/dist/mkdir-TDEMSB6C-D1oUG8Jf.mjs +0 -1
- package/dist/mrmime-C2W7cgq2.mjs +0 -2
- package/dist/mv-Z6MORUFL-CN471qcL.mjs +0 -1
- package/dist/nl-U5YJDM32-CFzXKze3.mjs +0 -1
- package/dist/od-VJEF2UR5-C2R4Accu.mjs +0 -1
- package/dist/paste-7N6AFSDS-bUl2Dwz3.mjs +0 -1
- package/dist/preview-CpmoA4SU.mjs +0 -1
- package/dist/printf-CX64KX2P-Ce--gWAq.mjs +0 -1
- package/dist/public/assets/ActivityModeContent-C-OqZ3Ro.js +0 -2
- package/dist/public/assets/DocumentContext-Ccj8qLzP.js +0 -37
- package/dist/public/assets/OutlinePanel-DP5j1Wq1.js +0 -2
- package/dist/public/assets/SourceEditor-mNodigv_.js +0 -2
- package/dist/public/assets/config-validation-events-BJEehccy.js +0 -10
- package/dist/public/assets/dist-BNOfnTlI.js +0 -9
- package/dist/public/assets/dist-Nw1RXfXU.js +0 -1
- package/dist/public/assets/dist-W2rlYChw.js +0 -1
- package/dist/public/assets/dist-Z6vgTDkw.js +0 -1
- package/dist/public/assets/doc-hash-C9Z2AnUu.js +0 -421
- package/dist/public/assets/index-BDj01myg.js +0 -1853
- package/dist/public/assets/index-BzPHdvNz.css +0 -1
- package/dist/public/assets/stex-CJTvJH5f.js +0 -1
- package/dist/pwd-D4OZ7N27-C18XewhV.mjs +0 -1
- package/dist/readlink-MI4GCHJF-CHvs7DDT.mjs +0 -1
- package/dist/rev-XOSYPP45-2mnFFZWW.mjs +0 -1
- package/dist/rg-FOQSCCX3-BJahNfSe.mjs +0 -1
- package/dist/rm-RTZG23RL-D9-0WGRY.mjs +0 -1
- package/dist/rmdir-XTQXT7RK-Br7eH9kL.mjs +0 -1
- package/dist/sed-VFTTATXJ-mYhAmixc.mjs +0 -1
- package/dist/seq-RN5ZUASB-CKf5MNNO.mjs +0 -1
- package/dist/sha1sum-VJPNLNU6-DuOHap1X.mjs +0 -1
- package/dist/sha256sum-PI32XWXY-D9fEipQ7.mjs +0 -1
- package/dist/sleep-VZFPZFWA-B1fSoYuO.mjs +0 -1
- package/dist/sort-DCNRDA7U-DDCY4JZu.mjs +0 -1
- package/dist/split-SITCSYCZ-b9hfEJw7.mjs +0 -1
- package/dist/sqlite3-56UMWEY3-BQEx5i3P.mjs +0 -1
- package/dist/start-CNyWXmFb.mjs +0 -1
- package/dist/stat-BT5A227F-Dzp4sgau.mjs +0 -1
- package/dist/strings-7PLOGTPD-DT41jX9d.mjs +0 -1
- package/dist/tac-SJGXQ4T2-BpdVoP8b.mjs +0 -1
- package/dist/tail-S5ULNTJU-0-sYrYik.mjs +0 -1
- package/dist/tar-ANUBEFJY-Wh3na_NU.mjs +0 -1
- package/dist/tee-O7VXZDCO-CwnGG0go.mjs +0 -1
- package/dist/time-DEUO3QV2-DzkqaQ1k.mjs +0 -1
- package/dist/timeout-VRKMCG72-BtPBpIRq.mjs +0 -1
- package/dist/touch-DX2IJOQ4-KW0Ui-lB.mjs +0 -1
- package/dist/tr-2HXZRDSW-C6Kf0M8T.mjs +0 -1
- package/dist/tree-LYXBS7DC-BN1FBqvM.mjs +0 -1
- package/dist/true-WHJNXCHG-DxCMVdqj.mjs +0 -1
- package/dist/unexpand-RGTMIGZM-DZ4Kf6Xq.mjs +0 -1
- package/dist/uniq-SUNANL47-Ceg51JdA.mjs +0 -1
- package/dist/wc-TQB3VNOX-BzWNq0MY.mjs +0 -1
- package/dist/which-XZHEH76L-DH_U2-Cj.mjs +0 -1
- package/dist/whoami-DGKU3D2X-BholYNPM.mjs +0 -1
- package/dist/xan-BXDXYEIB-b1eAtgch.mjs +0 -1
- package/dist/xan-view-ECQUO7AJ-DWDC57b_.mjs +0 -1
- package/dist/xargs-I6EZUCYF-Cov-i7kW.mjs +0 -1
- package/dist/yq-MJMAR36V-1r29nH4p.mjs +0 -1
- /package/dist/public/assets/{go-e6pdpn6U.js → go-wMvjCq97.js} +0 -0
- /package/dist/public/assets/{shell-BkCD5kyH.js → shell-DdhS5_h8.js} +0 -0
- /package/dist/public/assets/{textarea-57j4gLcZ.js → textarea-CaFqgjns.js} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{Nt as i,Qt as a,it as o,n as s,on as c,xn as l}from"./DocumentContext-B0jD_DRX.js";import{$ as u,C as d,Gt as f,I as p,Ir as m,L as h,Ln as g,Q as _,Rr as v,S as y,T as b,Ut as x,b as S,et as C,p as w,tt as T,w as E,x as D,yn as O}from"./doc-hash-CBF-HGTP.js";import{C as k,S as A,a as j,b as M,c as N,f as P,g as F,h as I,l as L,m as R,o as ee,r as z,s as te,t as B,u as ne,v as V,w as re,x as H}from"./button-C1nwPVFQ.js";import{n as ie,t as ae}from"./dist-Bej94Urx.js";import{c as oe,d as se,l as ce,m as le,p as ue,u as de}from"./dist-OTL8-1C2.js";import{t as fe}from"./dist-Cg-Qaqw_.js";import{a as pe,i as me,r as he}from"./toggle-group-DC1U2RZo.js";import{t as ge}from"./label-Dv_9VZWz.js";import{a as _e,c as U,i as ve,n as ye,o as be,r as xe,s as Se,t as Ce}from"./dialog-BFN-ujuF.js";import{t as we}from"./input-BOmkuBId.js";import{t as Te}from"./textarea-CaFqgjns.js";var Ee=k(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),De=k(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Oe=k(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),ke=k(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Ae=k(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),je=k(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),Me=k(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),W=n(),G=r(),K=e(t(),1);function Ne(e,t){let n=(0,G.c)(7),r,i;n[0]!==e||n[1]!==t?(r=()=>{if(t!==`light`&&t!==`dark`&&t!==`system`||!e)return;let n=!1;return e.setThemeSource(t).catch(e=>{console.warn(JSON.stringify({event:`theme-source-set-failed`,themeValue:t,error:e instanceof Error?e.message:String(e)}))}).finally(()=>{if(n)return;let t=window.matchMedia(`(prefers-reduced-transparency: reduce)`).matches;e.signalThemeApplied({reducedTransparency:t})}),()=>{n=!0}},i=[e,t],n[0]=e,n[1]=t,n[2]=r,n[3]=i):(r=n[2],i=n[3]),(0,K.useEffect)(r,i);let a,o;n[4]===e?(a=n[5],o=n[6]):(a=()=>{if(!e)return;let t=window.matchMedia(`(prefers-reduced-transparency: reduce)`),n=t=>{e.signalThemeApplied({reducedTransparency:t.matches})};return t.addEventListener(`change`,n),()=>{t.removeEventListener(`change`,n)}},o=[e],n[4]=e,n[5]=a,n[6]=o),(0,K.useEffect)(a,o)}function Pe(){let e=(0,G.c)(4),[t,n]=(0,K.useState)(null),r=(0,K.useRef)(!1),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=typeof window<`u`?window.okDesktop:void 0;if(!e)return;let t=e.onChannelChanged(e=>{let{channel:t}=e;r.current=!0,n(t)});return e.state.query().then(e=>{r.current||n(e.channel)}).catch(Ie),t},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,K.useEffect)(i,a);let o;return e[2]===t?o=e[3]:(o={channel:t,setChannel:Fe},e[2]=t,e[3]=o),o}async function Fe(e){let t=typeof window<`u`?window.okDesktop:void 0;if(!t)throw Error(`useUpdateChannel.setChannel called without desktop bridge`);await t.update.setChannel(e)}function Ie(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}var Le=e(re());function Re(e,t){let n=window.okDesktop?.shell?.openExternal;n&&(e.preventDefault(),n(t))}var ze=[`Enter`,` `],Be=[`ArrowDown`,`PageUp`,`Home`],Ve=[`ArrowUp`,`PageDown`,`End`],He=[...Be,...Ve],Ue={ltr:[...ze,`ArrowRight`],rtl:[...ze,`ArrowLeft`]},We={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Ge=`Menu`,[Ke,qe,Je]=h(Ge),[Ye,Xe]=R(Ge,[Je,b,pe]),Ze=b(),Qe=pe(),[$e,et]=Ye(Ge),[tt,nt]=Ye(Ge),rt=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Ze(t),[c,l]=K.useState(null),u=K.useRef(!1),d=te(a),f=p(i);return K.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,W.jsx)(E,{...s,children:(0,W.jsx)($e,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,W.jsx)(tt,{scope:t,onClose:K.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};rt.displayName=Ge;var it=`MenuAnchor`,at=K.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Ze(n);return(0,W.jsx)(D,{...i,...r,ref:t})});at.displayName=it;var ot=`MenuPortal`,[st,ct]=Ye(ot,{forceMount:void 0}),lt=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=et(ot,t);return(0,W.jsx)(st,{scope:t,forceMount:n,children:(0,W.jsx)(L,{present:n||a.open,children:(0,W.jsx)(j,{asChild:!0,container:i,children:r})})})};lt.displayName=ot;var q=`MenuContent`,[ut,dt]=Ye(q),ft=K.forwardRef((e,t)=>{let n=ct(q,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=et(q,e.__scopeMenu),o=nt(q,e.__scopeMenu);return(0,W.jsx)(Ke.Provider,{scope:e.__scopeMenu,children:(0,W.jsx)(L,{present:r||a.open,children:(0,W.jsx)(Ke.Slot,{scope:e.__scopeMenu,children:o.modal?(0,W.jsx)(pt,{...i,ref:t}):(0,W.jsx)(mt,{...i,ref:t})})})})}),pt=K.forwardRef((e,t)=>{let n=et(q,e.__scopeMenu),r=K.useRef(null),i=H(t,r);return K.useEffect(()=>{let e=r.current;if(e)return oe(e)},[]),(0,W.jsx)(gt,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:P(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),mt=K.forwardRef((e,t)=>{let n=et(q,e.__scopeMenu);return(0,W.jsx)(gt,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ht=V(`MenuContent.ScrollLock`),gt=K.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:p,onDismiss:m,disableOutsideScroll:h,...g}=e,_=et(q,n),v=nt(q,n),y=Ze(n),b=Qe(n),x=qe(n),[S,C]=K.useState(null),w=K.useRef(null),T=H(t,w,_.onContentChange),E=K.useRef(0),D=K.useRef(``),O=K.useRef(0),k=K.useRef(null),A=K.useRef(`right`),j=K.useRef(0),M=h?ce:K.Fragment,N=h?{as:ht,allowPinchZoom:!0}:void 0,F=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=en(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};K.useEffect(()=>()=>window.clearTimeout(E.current),[]),de();let I=K.useCallback(e=>A.current===k.current?.side&&nn(e,k.current?.area),[]);return(0,W.jsx)(ut,{scope:n,searchRef:D,onItemEnter:K.useCallback(e=>{I(e)&&e.preventDefault()},[I]),onItemLeave:K.useCallback(e=>{I(e)||(w.current?.focus(),C(null))},[I]),onTriggerLeave:K.useCallback(e=>{I(e)&&e.preventDefault()},[I]),pointerGraceTimerRef:O,onPointerGraceIntentChange:K.useCallback(e=>{k.current=e},[]),children:(0,W.jsx)(M,{...N,children:(0,W.jsx)(se,{asChild:!0,trapped:i,onMountAutoFocus:P(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,W.jsx)(ee,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:p,onDismiss:m,children:(0,W.jsx)(me,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:P(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,W.jsx)(d,{role:`menu`,"aria-orientation":`vertical`,"data-state":Yt(_.open),"data-radix-menu-content":``,dir:v.dir,...y,...g,ref:T,style:{outline:`none`,...g.style},onKeyDown:P(g.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&F(e.key));let i=w.current;if(e.target!==i||!He.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);Ve.includes(e.key)&&a.reverse(),Qt(a)}),onBlur:P(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:P(e.onPointerMove,rn(e=>{let t=e.target,n=j.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>j.current?`right`:`left`,j.current=e.clientX)}))})})})})})})});ft.displayName=q;var _t=`MenuGroup`,vt=K.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(I.div,{role:`group`,...r,ref:t})});vt.displayName=_t;var yt=`MenuLabel`,bt=K.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(I.div,{...r,ref:t})});bt.displayName=yt;var xt=`MenuItem`,St=`menu.itemSelect`,Ct=K.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=K.useRef(null),o=nt(xt,e.__scopeMenu),s=dt(xt,e.__scopeMenu),c=H(t,a),l=K.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(St,{bubbles:!0,cancelable:!0});e.addEventListener(St,e=>r?.(e),{once:!0}),F(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,W.jsx)(wt,{...i,ref:c,disabled:n,onClick:P(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:P(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:P(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||ze.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Ct.displayName=xt;var wt=K.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=dt(xt,n),s=Qe(n),c=K.useRef(null),l=H(t,c),[u,d]=K.useState(!1),[f,p]=K.useState(``);return K.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,W.jsx)(Ke.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,W.jsx)(he,{asChild:!0,...s,focusable:!r,children:(0,W.jsx)(I.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:P(e.onPointerMove,rn(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:P(e.onPointerLeave,rn(e=>o.onItemLeave(e))),onFocus:P(e.onFocus,()=>d(!0)),onBlur:P(e.onBlur,()=>d(!1))})})})}),Tt=`MenuCheckboxItem`,Et=K.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,W.jsx)(Pt,{scope:e.__scopeMenu,checked:n,children:(0,W.jsx)(Ct,{role:`menuitemcheckbox`,"aria-checked":Xt(n)?`mixed`:n,...i,ref:t,"data-state":Zt(n),onSelect:P(i.onSelect,()=>r?.(Xt(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Et.displayName=Tt;var Dt=`MenuRadioGroup`,[Ot,kt]=Ye(Dt,{value:void 0,onValueChange:()=>{}}),At=K.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=te(r);return(0,W.jsx)(Ot,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,W.jsx)(vt,{...i,ref:t})})});At.displayName=Dt;var jt=`MenuRadioItem`,Mt=K.forwardRef((e,t)=>{let{value:n,...r}=e,i=kt(jt,e.__scopeMenu),a=n===i.value;return(0,W.jsx)(Pt,{scope:e.__scopeMenu,checked:a,children:(0,W.jsx)(Ct,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Zt(a),onSelect:P(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Mt.displayName=jt;var Nt=`MenuItemIndicator`,[Pt,Ft]=Ye(Nt,{checked:!1}),It=K.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Ft(Nt,n);return(0,W.jsx)(L,{present:r||Xt(a.checked)||a.checked===!0,children:(0,W.jsx)(I.span,{...i,ref:t,"data-state":Zt(a.checked)})})});It.displayName=Nt;var Lt=`MenuSeparator`,Rt=K.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(I.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Rt.displayName=Lt;var zt=`MenuArrow`,Bt=K.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Ze(n);return(0,W.jsx)(y,{...i,...r,ref:t})});Bt.displayName=zt;var Vt=`MenuSub`,[Ht,Ut]=Ye(Vt),Wt=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=et(Vt,t),o=Ze(t),[s,c]=K.useState(null),[l,u]=K.useState(null),d=te(i);return K.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,W.jsx)(E,{...o,children:(0,W.jsx)($e,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,W.jsx)(Ht,{scope:t,contentId:N(),triggerId:N(),trigger:s,onTriggerChange:c,children:n})})})};Wt.displayName=Vt;var Gt=`MenuSubTrigger`,Kt=K.forwardRef((e,t)=>{let n=et(Gt,e.__scopeMenu),r=nt(Gt,e.__scopeMenu),i=Ut(Gt,e.__scopeMenu),a=dt(Gt,e.__scopeMenu),o=K.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=K.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return K.useEffect(()=>u,[u]),K.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,W.jsx)(at,{asChild:!0,...l,children:(0,W.jsx)(wt,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":Yt(n.open),...e,ref:M(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:P(e.onPointerMove,rn(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:P(e.onPointerLeave,rn(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:P(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Ue[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Kt.displayName=Gt;var qt=`MenuSubContent`,Jt=K.forwardRef((e,t)=>{let n=ct(q,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=et(q,e.__scopeMenu),o=nt(q,e.__scopeMenu),s=Ut(qt,e.__scopeMenu),c=K.useRef(null),l=H(t,c);return(0,W.jsx)(Ke.Provider,{scope:e.__scopeMenu,children:(0,W.jsx)(L,{present:r||a.open,children:(0,W.jsx)(Ke.Slot,{scope:e.__scopeMenu,children:(0,W.jsx)(gt,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:P(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:P(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:P(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=We[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});Jt.displayName=qt;function Yt(e){return e?`open`:`closed`}function Xt(e){return e===`indeterminate`}function Zt(e){return Xt(e)?`indeterminate`:e?`checked`:`unchecked`}function Qt(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function $t(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function en(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=$t(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function tn(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function nn(e,t){return t?tn({x:e.clientX,y:e.clientY},t):!1}function rn(e){return t=>t.pointerType===`mouse`?e(t):void 0}var an=rt,on=at,sn=lt,cn=ft,ln=vt,un=bt,dn=Ct,fn=Et,pn=At,mn=Mt,hn=It,gn=Rt,_n=Bt,vn=Wt,yn=Kt,bn=Jt,xn=`DropdownMenu`,[Sn,Cn]=R(xn,[Xe]),J=Xe(),[wn,Tn]=Sn(xn),En=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=J(t),l=K.useRef(null),[u,d]=ne({prop:i,defaultProp:a??!1,onChange:o,caller:xn});return(0,W.jsx)(wn,{scope:t,triggerId:N(),triggerRef:l,contentId:N(),open:u,onOpenChange:d,onOpenToggle:K.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,W.jsx)(an,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};En.displayName=xn;var Dn=`DropdownMenuTrigger`,On=K.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Tn(Dn,n),o=J(n);return(0,W.jsx)(on,{asChild:!0,...o,children:(0,W.jsx)(I.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:M(t,a.triggerRef),onPointerDown:P(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:P(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});On.displayName=Dn;var kn=`DropdownMenuPortal`,An=e=>{let{__scopeDropdownMenu:t,...n}=e,r=J(t);return(0,W.jsx)(sn,{...r,...n})};An.displayName=kn;var jn=`DropdownMenuContent`,Mn=K.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Tn(jn,n),a=J(n),o=K.useRef(!1);return(0,W.jsx)(cn,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:P(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:P(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Mn.displayName=jn;var Nn=`DropdownMenuGroup`,Pn=K.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,W.jsx)(ln,{...i,...r,ref:t})});Pn.displayName=Nn;var Fn=`DropdownMenuLabel`,In=K.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,W.jsx)(un,{...i,...r,ref:t})});In.displayName=Fn;var Ln=`DropdownMenuItem`,Rn=K.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,W.jsx)(dn,{...i,...r,ref:t})});Rn.displayName=Ln;var zn=`DropdownMenuCheckboxItem`,Bn=K.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,W.jsx)(fn,{...i,...r,ref:t})});Bn.displayName=zn;var Vn=`DropdownMenuRadioGroup`,Hn=K.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,W.jsx)(pn,{...i,...r,ref:t})});Hn.displayName=Vn;var Un=`DropdownMenuRadioItem`,Wn=K.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,W.jsx)(mn,{...i,...r,ref:t})});Wn.displayName=Un;var Gn=`DropdownMenuItemIndicator`,Kn=K.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,W.jsx)(hn,{...i,...r,ref:t})});Kn.displayName=Gn;var qn=`DropdownMenuSeparator`,Jn=K.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,W.jsx)(gn,{...i,...r,ref:t})});Jn.displayName=qn;var Yn=`DropdownMenuArrow`,Xn=K.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,W.jsx)(_n,{...i,...r,ref:t})});Xn.displayName=Yn;var Zn=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=J(t),[s,c]=ne({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,W.jsx)(vn,{...o,open:s,onOpenChange:c,children:n})},Qn=`DropdownMenuSubTrigger`,$n=K.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,W.jsx)(yn,{...i,...r,ref:t})});$n.displayName=Qn;var er=`DropdownMenuSubContent`,tr=K.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=J(n);return(0,W.jsx)(bn,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});tr.displayName=er;var nr=En,rr=On,ir=An,ar=Mn,or=In,sr=Rn,cr=Hn,lr=Wn,ur=Kn,dr=Jn,fr=Zn,pr=$n,mr=tr,hr=`Radio`,[gr,_r]=R(hr),[vr,yr]=gr(hr),br=K.forwardRef((e,t)=>{let{__scopeRadio:n,name:r,checked:i=!1,required:a,disabled:o,value:s=`on`,onCheck:c,form:l,...u}=e,[d,f]=K.useState(null),p=H(t,e=>f(e)),m=K.useRef(!1),h=d?l||!!d.closest(`form`):!0;return(0,W.jsxs)(vr,{scope:n,checked:i,disabled:o,children:[(0,W.jsx)(I.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":Tr(i),"data-disabled":o?``:void 0,disabled:o,value:s,...u,ref:p,onClick:P(e.onClick,e=>{i||c?.(),h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())})}),h&&(0,W.jsx)(wr,{control:d,bubbles:!m.current,name:r,value:s,checked:i,required:a,disabled:o,form:l,style:{transform:`translateX(-100%)`}})]})});br.displayName=hr;var xr=`RadioIndicator`,Sr=K.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:r,...i}=e,a=yr(xr,n);return(0,W.jsx)(L,{present:r||a.checked,children:(0,W.jsx)(I.span,{"data-state":Tr(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})});Sr.displayName=xr;var Cr=`RadioBubbleInput`,wr=K.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=K.useRef(null),s=H(o,a),c=ae(n),l=fe(t);return K.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,W.jsx)(I.input,{type:`radio`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});wr.displayName=Cr;function Tr(e){return e?`checked`:`unchecked`}var Er=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Dr=`RadioGroup`,[Or,kr]=R(Dr,[pe,_r]),Ar=pe(),jr=_r(),[Mr,Nr]=Or(Dr),Pr=K.forwardRef((e,t)=>{let{__scopeRadioGroup:n,name:r,defaultValue:i,value:a,required:o=!1,disabled:s=!1,orientation:c,dir:l,loop:u=!0,onValueChange:d,...f}=e,m=Ar(n),h=p(l),[g,_]=ne({prop:a,defaultProp:i??null,onChange:d,caller:Dr});return(0,W.jsx)(Mr,{scope:n,name:r,required:o,disabled:s,value:g,onValueChange:_,children:(0,W.jsx)(me,{asChild:!0,...m,orientation:c,dir:h,loop:u,children:(0,W.jsx)(I.div,{role:`radiogroup`,"aria-required":o,"aria-orientation":c,"data-disabled":s?``:void 0,dir:h,...f,ref:t})})})});Pr.displayName=Dr;var Fr=`RadioGroupItem`,Ir=K.forwardRef((e,t)=>{let{__scopeRadioGroup:n,disabled:r,...i}=e,a=Nr(Fr,n),o=a.disabled||r,s=Ar(n),c=jr(n),l=K.useRef(null),u=H(t,l),d=a.value===i.value,f=K.useRef(!1);return K.useEffect(()=>{let e=e=>{Er.includes(e.key)&&(f.current=!0)},t=()=>f.current=!1;return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,W.jsx)(he,{asChild:!0,...s,focusable:!o,active:d,children:(0,W.jsx)(br,{disabled:o,required:a.required,checked:d,...c,...i,name:a.name,ref:u,onCheck:()=>a.onValueChange(i.value),onKeyDown:P(e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:P(i.onFocus,()=>{f.current&&l.current?.click()})})})});Ir.displayName=Fr;var Lr=`RadioGroupIndicator`,Rr=K.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,W.jsx)(Sr,{...jr(n),...r,ref:t})});Rr.displayName=Lr;var zr=Pr,Br=Ir,Vr=Rr,Hr=`Separator`,Ur=`horizontal`,Wr=[`horizontal`,`vertical`],Gr=K.forwardRef((e,t)=>{let{decorative:n,orientation:r=Ur,...i}=e,a=Kr(r)?r:Ur,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,W.jsx)(I.div,{"data-orientation":a,...o,...i,ref:t})});Gr.displayName=Hr;function Kr(e){return Wr.includes(e)}var qr=Gr;function Jr(e){let t=(0,G.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`animate-pulse rounded-md bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`div`,{"data-slot":`skeleton`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Yr(e){let t=(0,G.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`grid w-full gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(zr,{"data-slot":`radio-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Xr(e){let t=(0,G.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,W.jsx)(Vr,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:(0,W.jsx)(`span`,{className:`absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground`})}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,W.jsx)(Br,{"data-slot":`radio-group-item`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function Zr(e){let t=(0,G.c)(9),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,K.useState)(n),[a,o]=(0,K.useState)(0),s;t[1]===e?s=t[2]:(s=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then($r).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:`Server returned an incomplete folder response.`});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null,frontmatterSources:e.frontmatter_sources??{}}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[1]=e,t[2]=s);let c;t[3]!==e||t[4]!==a?(c=[e,a],t[3]=e,t[4]=a,t[5]=c):c=t[5],(0,K.useEffect)(s,c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>o(Qr),t[6]=l):l=t[6];let u;return t[7]===r?u=t[8]:(u={state:r,refresh:l},t[7]=r,t[8]=u),u}function Qr(e){return e+1}async function $r(e){if(!e.ok){let t=await e.json().catch(ei);throw Error(S(t)??`HTTP ${e.status}`)}return e.json()}function ei(){return null}function ti(e,t,n){let r=(0,G.c)(6),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={status:`idle`},r[0]=i):i=r[0];let[a,o]=(0,K.useState)(i),s,c;return r[1]!==e||r[2]!==t||r[3]!==n?(s=()=>{if(!t){o({status:`idle`});return}if(n!==`user`&&e===null){o({status:`idle`});return}let r=!1;o({status:`loading`});let i=`?folder=${encodeURIComponent(n===`user`?``:e??``)}&name=${encodeURIComponent(t)}`;return n!==void 0&&(i+=`&target=${encodeURIComponent(n)}`),fetch(`/api/template${i}`).then(ni).then(e=>{if(!r){if(!e||typeof e!=`object`||!e.template){o({status:`error`,message:`Server returned an incomplete template response.`});return}o({status:`ready`,data:e.template})}}).catch(e=>{r||o({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{r=!0}},c=[e,t,n],r[1]=e,r[2]=t,r[3]=n,r[4]=s,r[5]=c):(s=r[4],c=r[5]),(0,K.useEffect)(s,c),a}async function ni(e){if(!e.ok){let t=await e.json().catch(ri);throw Error(S(t)??`HTTP ${e.status}`)}return e.json()}function ri(){return null}async function ii(){try{let e=await fetch(`/api/sync/status`);return e.ok?{status:await e.json()}:{status:null,error:`server`}}catch{return{status:null,error:`network`}}}function ai(){return oi().status}function oi(){let e=(0,G.c)(8),[t,n]=(0,K.useState)(null),[r,i]=(0,K.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(){ii().then(e=>{let{status:t,error:r}=e;i(r??null),t&&n(t)})},e[0]=a):a=e[0];let o=a,s,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{o()},c=[],e[1]=s,e[2]=c):(s=e[1],c=e[2]),(0,K.useEffect)(s,c);let l,u;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>w(e=>{e.includes(`sync-status`)&&o()}),u=[],e[3]=l,e[4]=u):(l=e[3],u=e[4]),(0,K.useEffect)(l,u);let d;return e[5]!==r||e[6]!==t?(d={status:t,fetchError:r},e[5]=r,e[6]=t,e[7]=d):d=e[7],d}var si=(0,K.createContext)(null);function ci(e,t,n){let r=new i,a=new o({url:e,name:t,document:r}),s=x(a,n);return{binding:s,config:s.current(),cleanup:()=>{s.dispose(),a.destroy(),r.destroy()}}}function li(e){let t=new i,n=new o({url:e,name:_,document:t}),r=f(n);return{binding:r,provider:n,cleanup:()=>{r.dispose(),n.destroy(),t.destroy()}}}function ui(e){let t=(0,G.c)(25),{children:n}=e,{collabUrl:r}=s(),[i,a]=(0,K.useState)(null),[o,c]=(0,K.useState)(null),[l,d]=(0,K.useState)(null),[f,p]=(0,K.useState)(null),m,h;t[0]===r?(m=t[1],h=t[2]):(m=()=>{if(r===null)return;let e=ci(r,T,`user`),t=ci(r,u,`project`),n=ci(r,C,`project-local`),i=li(r);a({binding:e.binding,config:e.config}),c({binding:t.binding,config:t.config}),d({binding:n.binding,config:n.config,synced:n.binding.hasSynced()}),p({binding:i.binding,synced:!1});let o=e.binding.subscribe(t=>{a(n=>n?.binding===e.binding?{...n,config:t}:n)}),s=t.binding.subscribe(e=>{c(n=>n?.binding===t.binding?{...n,config:e}:n)}),l=n.binding.subscribe(e=>{d(t=>t?.binding===n.binding?{...t,config:e}:t)}),f=n.binding.subscribeSynced(()=>{d(e=>e?.binding===n.binding?{...e,synced:!0}:e)}),m=()=>{p(e=>e?.binding===i.binding?{...e,synced:!0}:e)};return i.provider.on(`synced`,m),()=>{o(),s(),l(),f(),i.provider.off(`synced`,m),e.cleanup(),t.cleanup(),n.cleanup(),i.cleanup(),a(t=>t?.binding===e.binding?null:t),c(e=>e?.binding===t.binding?null:e),d(e=>e?.binding===n.binding?null:e),p(e=>e?.binding===i.binding?null:e)}},h=[r],t[0]=r,t[1]=m,t[2]=h),(0,K.useEffect)(m,h);let _;t[3]!==l?.config||t[4]!==o||t[5]!==i?(_=i&&o?g(i.config,o.config,l?.config):null,t[3]=l?.config,t[4]=o,t[5]=i,t[6]=_):_=t[6];let y=_,{setTheme:b}=v(),x=y?.appearance?.theme,S,w;t[7]!==b||t[8]!==x?(S=()=>{(x===`light`||x===`dark`||x===`system`)&&b(x)},w=[x,b],t[7]=b,t[8]=x,t[9]=S,t[10]=w):(S=t[9],w=t[10]),(0,K.useEffect)(S,w),Ne(typeof window<`u`?window.okDesktop:void 0,x??`system`);let E=i?.binding??null,D=o?.binding??null,O=l?.binding??null,k=f?.binding??null,A=f?.synced??!1,j=i?.config??null,M=o?.config??null,N=l?.config??null,P=l?.synced??!1,F;t[11]!==y||t[12]!==A||t[13]!==j||t[14]!==M||t[15]!==N||t[16]!==P||t[17]!==E||t[18]!==D||t[19]!==O||t[20]!==k?(F={userBinding:E,projectBinding:D,projectLocalBinding:O,okignoreBinding:k,okignoreSynced:A,userConfig:j,projectConfig:M,projectLocalConfig:N,projectLocalSynced:P,merged:y},t[11]=y,t[12]=A,t[13]=j,t[14]=M,t[15]=N,t[16]=P,t[17]=E,t[18]=D,t[19]=O,t[20]=k,t[21]=F):F=t[21];let I=F,L;return t[22]!==n||t[23]!==I?(L=(0,W.jsx)(si,{value:I,children:n}),t[22]=n,t[23]=I,t[24]=L):L=t[24],L}function di(){let e=(0,K.use)(si);if(e===null)throw Error(`useConfigContext must be used within <ConfigProvider />`);return e}function fi(){let e=(0,G.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(U,{children:`Enable git auto-sync?`}),(0,W.jsx)(_e,{children:`Auto-sync periodically fetches, pulls, and pushes commits to your remote git repository so your edits stay in sync across machines.`})]}),e[0]=t):t=e[0],t}function pi(){let e=(0,G.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:`Before you enable it:`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,W.jsxs)(W.Fragment,{children:[t,(0,W.jsxs)(`ul`,{className:`list-disc space-y-1.5 pl-5 text-sm text-muted-foreground`,children:[(0,W.jsx)(`li`,{children:`Pulls may overwrite uncommitted local file changes.`}),(0,W.jsx)(`li`,{children:`If you do not want automatic commits in your git history, you should not enable auto-sync.`})]})]}),e[1]=n):n=e[1],n}function mi(){let e=(0,G.c)(2),{projectLocalBinding:t}=di();if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=e=>{let n=t.patch({autoSync:{enabled:e}});return n.ok?{ok:!0}:{ok:!1,error:O(n.error)}},e[0]=t,e[1]=n),n}function hi(e){let t=(0,G.c)(10),[n,r]=(0,K.useState)(!1),i;t[0]===e?i=t[1]:(i=function(t){if(e===null)return ue.error(`Sync settings not yet loaded — try again in a moment`),!1;let n=e(t);return n.ok?!0:(console.error(`[sync] toggle failed:`,n.error),ue.error(`Failed to ${t?`enable`:`disable`} sync — ${n.error}`),!1)},t[0]=e,t[1]=i);let a=i,o;t[2]===a?o=t[3]:(o=function(e){if(e){r(!0);return}a(!1)},t[2]=a,t[3]=o);let s=o,c;t[4]===a?c=t[5]:(c=function(){a(!0)&&r(!1)},t[4]=a,t[5]=c);let l=c,u;return t[6]!==n||t[7]!==l||t[8]!==s?(u={confirmOpen:n,setConfirmOpen:r,onToggleRequest:s,onConfirm:l},t[6]=n,t[7]=l,t[8]=s,t[9]=u):u=t[9],u}function gi(e){let t=(0,G.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,orientation:i,decorative:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`horizontal`:i,s=a===void 0?!0:a,c;t[5]===n?c=t[6]:(c=z(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,n),t[5]=n,t[6]=c);let l;return t[7]!==s||t[8]!==o||t[9]!==r||t[10]!==c?(l=(0,W.jsx)(qr,{"data-slot":`separator`,decorative:s,orientation:o,className:c,...r}),t[7]=s,t[8]=o,t[9]=r,t[10]=c,t[11]=l):l=t[11],l}function _i(e){let t=(0,G.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`div`,{"data-slot":`field-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var vi=A(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function yi(e){let t=(0,G.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`vertical`:i,o;t[4]!==n||t[5]!==a?(o=z(vi({orientation:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,W.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":a,className:o,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function bi(e){let t=(0,G.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`group/field-content flex flex-1 flex-col gap-0.5 leading-snug`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`div`,{"data-slot":`field-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xi(e){let t=(0,G.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(ge,{"data-slot":`field-label`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Si(e){let t=(0,G.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`div`,{"data-slot":`field-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ci(e){let t=(0,G.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`p`,{"data-slot":`field-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function wi(e){let t=(0,G.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,errors:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;bb0:{if(n){o=n;break bb0}if(!i?.length){o=null;break bb0}let e;t[5]===i?e=t[6]:(e=[...new Map(i.map(Ei)).values()],t[5]=i,t[6]=e);let r=e;if(r?.length===1){o=r[0]?.message;break bb0}let a;t[7]===r?a=t[8]:(a=(0,W.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:r.map(Ti)}),t[7]=r,t[8]=a),o=a}let s=o;if(!s)return null;let c;t[9]===r?c=t[10]:(c=z(`text-sm font-normal text-destructive`,r),t[9]=r,t[10]=c);let l;return t[11]!==s||t[12]!==a||t[13]!==c?(l=(0,W.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:c,...a,children:s}),t[11]=s,t[12]=a,t[13]=c,t[14]=l):l=t[14],l}function Ti(e){return e?.message&&(0,W.jsx)(`li`,{children:e.message},e.message)}function Ei(e){return[e?.message,e]}function Di(){var e=[...arguments];return(0,K.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var Oi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function ki(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Ai(e){return`nodeType`in e}function Y(e){return e?ki(e)?e:Ai(e)?e.ownerDocument?.defaultView??window:window:window}function ji(e){let{Document:t}=Y(e);return e instanceof t}function Mi(e){return ki(e)?!1:e instanceof Y(e).HTMLElement}function Ni(e){return e instanceof Y(e).SVGElement}function Pi(e){return e?ki(e)?e.document:Ai(e)?ji(e)?e:Mi(e)||Ni(e)?e.ownerDocument:document:document:document}var Fi=Oi?K.useLayoutEffect:K.useEffect;function Ii(e){let t=(0,K.useRef)(e);return Fi(()=>{t.current=e}),(0,K.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Li(){let e=(0,K.useRef)(null);return[(0,K.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,K.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Ri(e,t){t===void 0&&(t=[e]);let n=(0,K.useRef)(e);return Fi(()=>{n.current!==e&&(n.current=e)},t),n}function zi(e,t){let n=(0,K.useRef)();return(0,K.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Bi(e){let t=Ii(e),n=(0,K.useRef)(null);return[n,(0,K.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Vi(e){let t=(0,K.useRef)();return(0,K.useEffect)(()=>{t.current=e},[e]),t.current}var Hi={};function Ui(e,t){return(0,K.useMemo)(()=>{if(t)return t;let n=Hi[e]==null?0:Hi[e]+1;return Hi[e]=n,e+`-`+n},[e,t])}function Wi(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var Gi=Wi(1),Ki=Wi(-1);function qi(e){return`clientX`in e&&`clientY`in e}function Ji(e){if(!e)return!1;let{KeyboardEvent:t}=Y(e.target);return t&&e instanceof t}function Yi(e){if(!e)return!1;let{TouchEvent:t}=Y(e.target);return t&&e instanceof t}function Xi(e){if(Yi(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return qi(e)?{x:e.clientX,y:e.clientY}:null}var Zi=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[Zi.Translate.toString(e),Zi.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),Qi=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function $i(e){return e.matches(Qi)?e:e.querySelector(Qi)}var ea={display:`none`};function ta(e){let{id:t,value:n}=e;return K.createElement(`div`,{id:t,style:ea},n)}function na(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return K.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function ra(){let[e,t]=(0,K.useState)(``);return{announce:(0,K.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var ia=(0,K.createContext)(null);function aa(e){let t=(0,K.useContext)(ia);(0,K.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function oa(){let[e]=(0,K.useState)(()=>new Set),t=(0,K.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,K.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var sa={draggable:`
|
|
2
|
+
To pick up a draggable item, press the space bar.
|
|
3
|
+
While dragging, use the arrow keys to move the item.
|
|
4
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
5
|
+
`},ca={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function la(e){let{announcements:t=ca,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=sa}=e,{announce:a,announcement:o}=ra(),s=Ui(`DndLiveRegion`),[c,l]=(0,K.useState)(!1);if((0,K.useEffect)(()=>{l(!0)},[]),aa((0,K.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=K.createElement(K.Fragment,null,K.createElement(ta,{id:r,value:i.draggable}),K.createElement(na,{id:s,announcement:o}));return n?(0,Le.createPortal)(u,n):u}var X;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(X||={});function ua(){}function da(e,t){return(0,K.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function fa(){var e=[...arguments];return(0,K.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var Z=Object.freeze({x:0,y:0});function pa(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function ma(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ha(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ga(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function _a(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function va(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var ya=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=va(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=pa(va(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(ma)},ba=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=ga(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=ga(r),o=i.reduce((e,t,r)=>e+pa(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(ma)};function xa(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var Sa=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=xa(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(ha)};function Ca(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function wa(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Z}function Ta(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var Ea=Ta(1);function Da(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Oa(e,t,n){let r=Da(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var ka={ignoreTransform:!1};function Aa(e,t){t===void 0&&(t=ka);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=Y(e).getComputedStyle(e);t&&(n=Oa(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function ja(e){return Aa(e,{ignoreTransform:!0})}function Ma(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Na(e,t){return t===void 0&&(t=Y(e).getComputedStyle(e)),t.position===`fixed`}function Pa(e,t){t===void 0&&(t=Y(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function Fa(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(ji(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Mi(i)||Ni(i)||n.includes(i))return n;let a=Y(e).getComputedStyle(i);return i!==e&&Pa(i,a)&&n.push(i),Na(i,a)?n:r(i.parentNode)}return e?r(e):n}function Ia(e){let[t]=Fa(e,1);return t??null}function La(e){return!Oi||!e?null:ki(e)?e:Ai(e)?ji(e)||e===Pi(e).scrollingElement?window:Mi(e)?e:null:null}function Ra(e){return ki(e)?e.scrollX:e.scrollLeft}function za(e){return ki(e)?e.scrollY:e.scrollTop}function Ba(e){return{x:Ra(e),y:za(e)}}var Q;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Q||={});function Va(e){return!Oi||!e?!1:e===document.scrollingElement}function Ha(e){let t={x:0,y:0},n=Va(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Ua={x:.2,y:.2};function Wa(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Ua);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Ha(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Q.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Q.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Q.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Q.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Ga(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Ka(e){return e.reduce((e,t)=>Gi(e,Ba(t)),Z)}function qa(e){return e.reduce((e,t)=>e+Ra(t),0)}function Ja(e){return e.reduce((e,t)=>e+za(t),0)}function Ya(e,t){if(t===void 0&&(t=Aa),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Ia(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Xa=[[`x`,[`left`,`right`],qa],[`y`,[`top`,`bottom`],Ja]],Za=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=Fa(t),r=Ka(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Xa)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},Qa=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function $a(e){let{EventTarget:t}=Y(e);return e instanceof t?e:Pi(e)}function eo(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var to;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(to||={});function no(e){e.preventDefault()}function ro(e){e.stopPropagation()}var $;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})($||={});var io={start:[$.Space,$.Enter],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},ao=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $.Right:return{...n,x:n.x+25};case $.Left:return{...n,x:n.x-25};case $.Down:return{...n,y:n.y+25};case $.Up:return{...n,y:n.y-25}}},oo=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Qa(Pi(t)),this.windowListeners=new Qa(Y(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(to.Resize,this.handleCancel),this.windowListeners.add(to.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(to.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Ya(n),t(Z)}handleKeyDown(e){if(Ji(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=io,coordinateGetter:a=ao,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:Z;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Ki(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Ha(n),p=Ga(n),m={x:Math.min(i===$.Right?p.right-p.width/2:p.right,Math.max(i===$.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===$.Down?p.bottom-p.height/2:p.bottom,Math.max(i===$.Down?p.top:p.top+p.height/2,u.y))},h=i===$.Right&&!s||i===$.Left&&!c,g=i===$.Down&&!l||i===$.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===$.Right&&e<=d.x||i===$.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===$.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===$.Down&&e<=d.y||i===$.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===$.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Gi(Ki(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};oo.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=io,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function so(e){return!!(e&&`distance`in e)}function co(e){return!!(e&&`delay`in e)}var lo=class{constructor(e,t,n){n===void 0&&(n=$a(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=Pi(i),this.documentListeners=new Qa(this.document),this.listeners=new Qa(n),this.windowListeners=new Qa(Y(i)),this.initialCoordinates=Xi(r)??Z,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(to.Resize,this.handleCancel),this.windowListeners.add(to.DragStart,no),this.windowListeners.add(to.VisibilityChange,this.handleCancel),this.windowListeners.add(to.ContextMenu,no),this.documentListeners.add(to.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(co(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(so(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(to.Click,ro,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(to.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Xi(e)??Z,s=Ki(n,o);if(!t&&a){if(so(a)){if(a.tolerance!=null&&eo(s,a.tolerance))return this.handleCancel();if(eo(s,a.distance))return this.handleStart()}if(co(a)&&eo(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===$.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},uo={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},fo=class extends lo{constructor(e){let{event:t}=e,n=Pi(t.target);super(e,uo,n)}};fo.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var po={move:{name:`mousemove`},end:{name:`mouseup`}},mo;(function(e){e[e.RightClick=2]=`RightClick`})(mo||={});var ho=class extends lo{constructor(e){super(e,po,Pi(e.event.target))}};ho.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===mo.RightClick?!1:(r?.({event:n}),!0)}}];var go={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},_o=class extends lo{constructor(e){super(e,go)}static setup(){return window.addEventListener(go.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(go.move.name,e)};function e(){}}};_o.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var vo;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(vo||={});var yo;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(yo||={});function bo(e){let{acceleration:t,activator:n=vo.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=yo.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=So({delta:d,disabled:!a}),[m,h]=Li(),g=(0,K.useRef)({x:0,y:0}),_=(0,K.useRef)({x:0,y:0}),v=(0,K.useMemo)(()=>{switch(n){case vo.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case vo.DraggableRect:return i}},[n,i,c]),y=(0,K.useRef)(null),b=(0,K.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,K.useMemo)(()=>s===yo.TreeOrder?[...l].reverse():l,[s,l]);(0,K.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=Wa(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var xo={x:{[Q.Backward]:!1,[Q.Forward]:!1},y:{[Q.Backward]:!1,[Q.Forward]:!1}};function So(e){let{delta:t,disabled:n}=e,r=Vi(t);return zi(e=>{if(n||!r||!e)return xo;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Q.Backward]:e.x[Q.Backward]||i.x===-1,[Q.Forward]:e.x[Q.Forward]||i.x===1},y:{[Q.Backward]:e.y[Q.Backward]||i.y===-1,[Q.Forward]:e.y[Q.Forward]||i.y===1}}},[n,t,r])}function Co(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return zi(e=>t==null?null:r??e??null,[r,t])}function wo(e,t){return(0,K.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var To;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(To||={});var Eo;(function(e){e.Optimized=`optimized`})(Eo||={});var Do=new Map;function Oo(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,K.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,K.useRef)(e),d=g(),f=Ri(d),p=(0,K.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,K.useRef)(null),h=zi(t=>{if(d&&!n)return Do;if(!t||t===Do||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Za(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,K.useEffect)(()=>{u.current=e},[e]),(0,K.useEffect)(()=>{d||p()},[n,d]),(0,K.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,K.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case To.Always:return!1;case To.BeforeDragging:return n;default:return!n}}}function ko(e,t){return zi(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Ao(e,t){return ko(e,t)}function jo(e){let{callback:t,disabled:n}=e,r=Ii(t),i=(0,K.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,K.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Mo(e){let{callback:t,disabled:n}=e,r=Ii(t),i=(0,K.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,K.useEffect)(()=>()=>i?.disconnect(),[i]),i}function No(e){return new Za(Aa(e),e)}function Po(e,t,n){t===void 0&&(t=No);let[r,i]=(0,K.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=jo({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=Mo({callback:a});return Fi(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Fo(e){return wa(e,ko(e))}var Io=[];function Lo(e){let t=(0,K.useRef)(e),n=zi(n=>e?n&&n!==Io&&e&&t.current&&e.parentNode===t.current.parentNode?n:Fa(e):Io,[e]);return(0,K.useEffect)(()=>{t.current=e},[e]),n}function Ro(e){let[t,n]=(0,K.useState)(null),r=(0,K.useRef)(e),i=(0,K.useCallback)(e=>{let t=La(e.target);t&&n(e=>e?(e.set(t,Ba(t)),new Map(e)):null)},[]);return(0,K.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=La(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Ba(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{La(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,K.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Gi(e,t),Z):Ka(e):Z,[e,t])}function zo(e,t){t===void 0&&(t=[]);let n=(0,K.useRef)(null);return(0,K.useEffect)(()=>{n.current=null},t),(0,K.useEffect)(()=>{let t=e!==Z;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Ki(e,n.current):Z}function Bo(e){(0,K.useEffect)(()=>{if(!Oi)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Vo(e,t){return(0,K.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Ho(e){return(0,K.useMemo)(()=>e?Ma(e):null,[e])}var Uo=[];function Wo(e,t){t===void 0&&(t=Aa);let[n]=e,r=Ho(n?Y(n):null),[i,a]=(0,K.useState)(Uo);function o(){a(()=>e.length?e.map(e=>Va(e)?r:new Za(t(e),e)):Uo)}let s=Mo({callback:o});return Fi(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Go(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Mi(t)?t:e}function Ko(e){let{measure:t}=e,[n,r]=(0,K.useState)(null),i=Mo({callback:(0,K.useCallback)(e=>{for(let{target:n}of e)if(Mi(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=Bi((0,K.useCallback)(e=>{let n=Go(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,K.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var qo=[{sensor:fo,options:{}},{sensor:oo,options:{}}],Jo={current:{}},Yo={draggable:{measure:ja},droppable:{measure:ja,strategy:To.WhileDragging,frequency:Eo.Optimized},dragOverlay:{measure:Aa}},Xo=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Zo={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Xo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ua},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Yo,measureDroppableContainers:ua,windowRect:null,measuringScheduled:!1},Qo={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:ua,draggableNodes:new Map,over:null,measureDroppableContainers:ua},$o=(0,K.createContext)(Qo),es=(0,K.createContext)(Zo);function ts(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Xo}}}function ns(e,t){switch(t.type){case X.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case X.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case X.DragEnd:case X.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case X.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Xo(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case X.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Xo(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case X.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Xo(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function rs(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,K.useContext)($o),a=Vi(r),o=Vi(n?.id);return(0,K.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Ji(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=$i(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function is(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function as(e){return(0,K.useMemo)(()=>({draggable:{...Yo.draggable,...e?.draggable},droppable:{...Yo.droppable,...e?.droppable},dragOverlay:{...Yo.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function os(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,K.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Fi(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=wa(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=Ia(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var ss=(0,K.createContext)({...Z,scaleX:1,scaleY:1}),cs;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(cs||={});var ls=(0,K.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=qo,collisionDetection:o=Sa,measuring:s,modifiers:c,...l}=e,[u,d]=(0,K.useReducer)(ns,void 0,ts),[f,p]=oa(),[m,h]=(0,K.useState)(cs.Uninitialized),g=m===cs.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,K.useRef)({initial:null,translated:null}),C=(0,K.useMemo)(()=>_==null?null:{id:_,data:x?.data??Jo,rect:S},[_,x]),w=(0,K.useRef)(null),[T,E]=(0,K.useState)(null),[D,O]=(0,K.useState)(null),k=Ri(l,Object.values(l)),A=Ui(`DndDescribedBy`,t),j=(0,K.useMemo)(()=>b.getEnabled(),[b]),M=as(s),{droppableRects:N,measureDroppableContainers:P,measuringScheduled:F}=Oo(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),I=Co(v,_),L=(0,K.useMemo)(()=>D?Xi(D):null,[D]),R=Te(),ee=Ao(I,M.draggable.measure);os({activeNode:_==null?null:v.get(_),config:R.layoutShiftCompensation,initialRect:ee,measure:M.draggable.measure});let z=Po(I,M.draggable.measure,ee),te=Po(I?I.parentElement:null),B=(0,K.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=b.getNodeFor(B.current.over?.id),V=Ko({measure:M.dragOverlay.measure}),re=V.nodeRef.current??I,H=g?V.rect??z:null,ie=!!(V.nodeRef.current&&V.rect),ae=Fo(ie?null:z),oe=Ho(re?Y(re):null),se=Lo(g?ne??I:null),ce=Wo(se),le=is(c,{transform:{x:y.x-ae.x,y:y.y-ae.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:z,containerNodeRect:te,draggingNodeRect:H,over:B.current.over,overlayNodeRect:V.rect,scrollableAncestors:se,scrollableAncestorRects:ce,windowRect:oe}),ue=L?Gi(L,y):null,de=Ro(se),fe=zo(de),pe=zo(de,[z]),me=Gi(le,fe),he=H?Ea(H,le):null,ge=C&&he?o({active:C,collisionRect:he,droppableRects:N,droppableContainers:j,pointerCoordinates:ue}):null,_e=_a(ge,`id`),[U,ve]=(0,K.useState)(null),ye=Ca(ie?le:Gi(le,pe),U?.rect??null,z),be=(0,K.useRef)(null),xe=(0,K.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;be.current=new n({active:w.current,activeNode:i,event:a,options:r,context:B,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,Le.unstable_batchedUpdates)(()=>{r?.(i),h(cs.Initializing),d({type:X.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(be.current),O(a)})},onMove(e){d({type:X.DragMove,coordinates:e})},onEnd:o(X.DragEnd),onCancel:o(X.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=B.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===X.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=X.DragCancel)}w.current=null,(0,Le.unstable_batchedUpdates)(()=>{d({type:e}),h(cs.Uninitialized),ve(null),E(null),O(null),be.current=null;let t=e===X.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Se=wo(a,(0,K.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,xe(n,t))},[v,xe]));Bo(a),Fi(()=>{z&&m===cs.Initializing&&h(cs.Initialized)},[z,m]),(0,K.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=B.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:me.x,y:me.y},over:i};(0,Le.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[me.x,me.y]),(0,K.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=B.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(_e),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Le.unstable_batchedUpdates)(()=>{ve(s),a?.(c),f({type:`onDragOver`,event:c})})},[_e]),Fi(()=>{B.current={activatorEvent:D,active:C,activeNode:I,collisionRect:he,collisions:ge,droppableRects:N,draggableNodes:v,draggingNode:re,draggingNodeRect:H,droppableContainers:b,over:U,scrollableAncestors:se,scrollAdjustedTranslate:me},S.current={initial:H,translated:he}},[C,I,ge,he,v,re,H,N,b,U,se,me]),bo({...R,delta:y,draggingRect:he,pointerCoordinates:ue,scrollableAncestors:se,scrollableAncestorRects:ce});let Ce=(0,K.useMemo)(()=>({active:C,activeNode:I,activeNodeRect:z,activatorEvent:D,collisions:ge,containerNodeRect:te,dragOverlay:V,draggableNodes:v,droppableContainers:b,droppableRects:N,over:U,measureDroppableContainers:P,scrollableAncestors:se,scrollableAncestorRects:ce,measuringConfiguration:M,measuringScheduled:F,windowRect:oe}),[C,I,z,D,ge,te,V,v,b,N,U,P,se,ce,M,F,oe]),we=(0,K.useMemo)(()=>({activatorEvent:D,activators:Se,active:C,activeNodeRect:z,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:U,measureDroppableContainers:P}),[D,Se,C,z,d,A,v,U,P]);return K.createElement(ia.Provider,{value:p},K.createElement($o.Provider,{value:we},K.createElement(es.Provider,{value:Ce},K.createElement(ss.Provider,{value:ye},i)),K.createElement(rs,{disabled:n?.restoreFocus===!1})),K.createElement(la,{...n,hiddenTextDescribedById:A}));function Te(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),us=(0,K.createContext)(null),ds=`button`,fs=`Draggable`;function ps(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Ui(fs),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,K.useContext)($o),{role:p=ds,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,K.useContext)(g?ss:us),[v,y]=Bi(),[b,x]=Bi(),S=Vo(o,t),C=Ri(n);return Fi(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,K.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===ds?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function ms(){return(0,K.useContext)(es)}var hs=`Droppable`,gs={timeout:25};function _s(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Ui(hs),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,K.useContext)($o),u=(0,K.useRef)({disabled:n}),d=(0,K.useRef)(!1),f=(0,K.useRef)(null),p=(0,K.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...gs,...i},_=Ri(h??r),v=Mo({callback:(0,K.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=Bi((0,K.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=Ri(t);return(0,K.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,K.useEffect)(()=>(s({type:X.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:X.UnregisterDroppable,key:a,id:r})),[r]),(0,K.useEffect)(()=>{n!==u.current.disabled&&(s({type:X.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function vs(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function ys(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function bs(e){return e!==null&&e>=0}function xs(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ss(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var Cs=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=vs(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},ws={scaleX:1,scaleY:1},Ts=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...ws}:null}let s=Es(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...ws}:r<t&&r>=a?{x:0,y:o.height+s,...ws}:{x:0,y:0,...ws}};function Es(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var Ds=`Sortable`,Os=K.createContext({activeIndex:-1,containerId:Ds,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Cs,disabled:{draggable:!1,droppable:!1}});function ks(e){let{children:t,id:n,items:r,strategy:i=Cs,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=ms(),d=Ui(Ds,n),f=s.rect!==null,p=(0,K.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,K.useRef)(p),v=!xs(p,_.current),y=g!==-1&&h===-1||v,b=Ss(a);Fi(()=>{v&&m&&u(p)},[v,p,m,u]),(0,K.useEffect)(()=>{_.current=p},[p]);let x=(0,K.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:ys(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return K.createElement(Os.Provider,{value:x},t)}var As=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return vs(n,r,i).indexOf(t)},js=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},Ms={duration:200,easing:`ease`},Ns=`transform`,Ps=Zi.Transition.toString({property:Ns,duration:0,easing:`linear`}),Fs={roleDescription:`sortable`};function Is(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,K.useState)(null),s=(0,K.useRef)(n);return Fi(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=Aa(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,K.useEffect)(()=>{a&&o(null)},[a]),a}function Ls(e){let{animateLayoutChanges:t=js,attributes:n,disabled:r,data:i,getNewIndex:a=As,id:o,strategy:s,resizeObserverConfig:c,transition:l=Ms}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,K.useContext)(Os),y=Rs(r,p),b=u.indexOf(o),x=(0,K.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,K.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=_s({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:A,setNodeRef:j,listeners:M,isDragging:N,over:P,setActivatorNodeRef:F,transform:I}=ps({id:o,data:x,attributes:{...Fs,...n},disabled:y.draggable}),L=Di(E,j),R=!!D,ee=R&&!m&&bs(f)&&bs(g),z=!_&&N,te=ee?(z&&ee?I:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,B=bs(f)&&bs(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ne=D?.id,V=(0,K.useRef)({activeId:ne,items:u,newIndex:B,containerId:d}),re=u!==V.current.items,H=t({active:D,containerId:d,isDragging:N,isSorting:R,id:o,index:b,items:u,newIndex:V.current.newIndex,previousItems:V.current.items,previousContainerId:V.current.containerId,transition:l,wasDragging:V.current.activeId!=null}),ie=Is({disabled:!H,index:b,node:w,rect:C});return(0,K.useEffect)(()=>{R&&V.current.newIndex!==B&&(V.current.newIndex=B),d!==V.current.containerId&&(V.current.containerId=d),u!==V.current.items&&(V.current.items=u)},[R,B,d,u]),(0,K.useEffect)(()=>{if(ne===V.current.activeId)return;if(ne!=null&&V.current.activeId==null){V.current.activeId=ne;return}let e=setTimeout(()=>{V.current.activeId=ne},50);return()=>clearTimeout(e)},[ne]),{active:D,activeIndex:f,attributes:A,data:x,rect:C,index:b,newIndex:B,items:u,isOver:T,isSorting:R,isDragging:N,listeners:M,node:w,overIndex:g,over:P,setNodeRef:L,setActivatorNodeRef:F,setDroppableNodeRef:E,setDraggableNodeRef:j,transform:ie??te,transition:ae()};function ae(){if(ie||re&&V.current.newIndex===b)return Ps;if(!(z&&!Ji(O)||!l)&&(R||H))return Zi.Transition.toString({...l,property:Ns})}}function Rs(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function zs(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var Bs=[$.Down,$.Right,$.Up,$.Left],Vs=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(Bs.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case $.Down:r.top<a.top&&t.push(n);break;case $.Up:r.top>a.top&&t.push(n);break;case $.Left:r.left>a.left&&t.push(n);break;case $.Right:r.left<a.left&&t.push(n);break}});let c=ba({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=_a(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=Fa(c).some((e,t)=>s[t]!==e),i=Hs(e,t),a=Us(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Ki(u,l)}}}};function Hs(e,t){return!zs(e)||!zs(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Us(e,t){return!zs(e)||!zs(t)||!Hs(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Ws(e){let t=(0,G.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,W.jsx)(nr,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function Gs(e){let t=(0,G.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,W.jsx)(rr,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function Ks(e){let t=(0,G.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,align:i,sideOffset:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`start`:i,s=a===void 0?4:a,c;t[5]===n?c=t[6]:(c=z(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n),t[5]=n,t[6]=c);let l;return t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(l=(0,W.jsx)(ir,{children:(0,W.jsx)(ar,{"data-slot":`dropdown-menu-content`,sideOffset:s,align:o,className:c,...r})}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function qs(e){let t=(0,G.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=z(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,W.jsx)(sr,{"data-slot":`dropdown-menu-item`,"data-inset":r,"data-variant":o,className:s,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function Js(e){let t=(0,G.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,W.jsx)(cr,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function Ys(e){let t=(0,G.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,inset:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=z(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,W.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,W.jsx)(ur,{children:(0,W.jsx)(ie,{})})}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,W.jsxs)(lr,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:o,...a,children:[s,n]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function Xs(e){let t=(0,G.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=z(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,W.jsx)(or,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function Zs(e){let t=(0,G.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(dr,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Qs(e){let t=(0,G.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,W.jsx)(fr,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function $s(e){let t=(0,G.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=z(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,W.jsx)(l,{className:`ml-auto`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,W.jsxs)(pr,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":i,className:o,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function ec(e){let t=(0,G.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(mr,{"data-slot":`dropdown-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}async function tc(e){return S(await e.json().catch(()=>null))??`HTTP ${e.status}`}async function nc(e,t){try{let n=await fetch(`/api/folder-config`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,frontmatter:t})});return n.ok?{ok:!0}:{ok:!1,error:await tc(n)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function rc(e){try{let t=await fetch(`/api/template`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,error:await tc(t)};let n=await t.json().catch(()=>null);return{ok:!0,created:n?.created??!1,warnings:n?.warnings??[]}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function ic(e,t,n){try{let r=`?folder=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`;n!==void 0&&(r+=`&target=${encodeURIComponent(n)}`);let i=await fetch(`/api/template${r}`,{method:`DELETE`});return i.ok?{ok:!0,existed:(await i.json().catch(()=>null))?.existed??!1}:{ok:!1,error:await tc(i)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}function ac(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function oc(e,t){return e===``?`.ok/templates/${t}.md`:`${e}/.ok/templates/${t}.md`}function sc(e){let t=(0,G.c)(22),{itemName:n,isSubmitting:r,onDelete:i,customTitle:a,customDescription:o,children:s}=e,l=n===void 0?`this item`:n,u=a??`Delete ${l}`,d;t[0]===u?d=t[1]:(d=(0,W.jsx)(U,{children:u}),t[0]=u,t[1]=d);let f=o??`Are you sure you want to delete ${l}? This action cannot be undone.`,p;t[2]===f?p=t[3]:(p=(0,W.jsx)(_e,{className:`whitespace-pre-wrap`,children:f}),t[2]=f,t[3]=p);let m;t[4]===s?m=t[5]:(m=s?(0,W.jsx)(ye,{children:s}):null,t[4]=s,t[5]=m);let h;t[6]===r?h=t[7]:(h=(0,W.jsx)(xe,{asChild:!0,children:(0,W.jsx)(B,{variant:`outline`,disabled:r,children:`Cancel`})}),t[6]=r,t[7]=h);let g;t[8]===r?g=t[9]:(g=r?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(c,{className:`size-4 animate-spin`}),` Deleting...`]}):`Delete`,t[8]=r,t[9]=g);let _;t[10]!==r||t[11]!==i||t[12]!==g?(_=(0,W.jsx)(B,{variant:`destructive`,onClick:i,disabled:r,children:g}),t[10]=r,t[11]=i,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==h||t[15]!==_?(v=(0,W.jsxs)(be,{children:[h,_]}),t[14]=h,t[15]=_,t[16]=v):v=t[16];let y;return t[17]!==v||t[18]!==d||t[19]!==p||t[20]!==m?(y=(0,W.jsxs)(ve,{children:[d,p,m,v]}),t[17]=v,t[18]=d,t[19]=p,t[20]=m,t[21]=y):y=t[21],y}function cc(e){let t=(0,G.c)(40),{value:n,onChange:r,onBlur:i,placeholder:o,id:s,disabled:c,"aria-describedby":l,"aria-invalid":u,ref:d}=e,f=o===void 0?`Add tag…`:o,[p,m]=(0,K.useState)(``),h;t[0]!==r||t[1]!==n?(h=e=>{let t=e.trim();if(t){if(n.includes(t)){m(``);return}r([...n,t]),m(``)}},t[0]=r,t[1]=n,t[2]=h):h=t[2];let g=h,_;t[3]!==r||t[4]!==n?(_=e=>{r(n.filter((t,n)=>n!==e))},t[3]=r,t[4]=n,t[5]=_):_=t[5];let v=_,y=c&&`pointer-events-none opacity-60`,b;t[6]===y?b=t[7]:(b=z(`flex min-h-8 w-full flex-wrap items-center gap-1.5 rounded-lg border border-input bg-transparent px-2 py-1 text-sm transition-colors`,`focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20`,`dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,y),t[6]=y,t[7]=b);let x;if(t[8]!==c||t[9]!==v||t[10]!==n){let e;t[12]!==c||t[13]!==v?(e=(e,t)=>(0,W.jsxs)(a,{variant:`secondary`,className:`gap-1 pl-2 pr-1`,children:[(0,W.jsx)(`span`,{className:`font-mono`,children:e}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>v(t),"aria-label":`Remove ${e}`,className:`rounded-sm p-0.5 hover:bg-background/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,disabled:c,children:(0,W.jsx)(le,{className:`size-3`,"aria-hidden":`true`})})]},e),t[12]=c,t[13]=v,t[14]=e):e=t[14],x=n.map(e),t[8]=c,t[9]=v,t[10]=n,t[11]=x}else x=t[11];let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>m(e.target.value),t[15]=S):S=t[15];let C;t[16]!==g||t[17]!==p||t[18]!==v||t[19]!==n.length?(C=e=>{e.key===`Enter`?p.trim()&&(e.preventDefault(),g(p)):e.key===`,`?(e.preventDefault(),p.trim()&&g(p)):e.key===`Tab`?p.trim()&&(e.preventDefault(),g(p)):e.key===`Backspace`&&p===``&&n.length>0&&(e.preventDefault(),v(n.length-1))},t[16]=g,t[17]=p,t[18]=v,t[19]=n.length,t[20]=C):C=t[20];let w;t[21]!==g||t[22]!==p||t[23]!==i?(w=()=>{p.trim()&&g(p),i?.()},t[21]=g,t[22]=p,t[23]=i,t[24]=w):w=t[24];let T=n.length===0?f:``,E;t[25]!==l||t[26]!==u||t[27]!==c||t[28]!==p||t[29]!==s||t[30]!==d||t[31]!==T||t[32]!==C||t[33]!==w?(E=(0,W.jsx)(`input`,{id:s,ref:d,type:`text`,value:p,onChange:S,onKeyDown:C,onBlur:w,placeholder:T,"aria-describedby":l,"aria-invalid":u,disabled:c,className:`min-w-[8ch] flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed`}),t[25]=l,t[26]=u,t[27]=c,t[28]=p,t[29]=s,t[30]=d,t[31]=T,t[32]=C,t[33]=w,t[34]=E):E=t[34];let D;return t[35]!==u||t[36]!==E||t[37]!==b||t[38]!==x?(D=(0,W.jsxs)(`div`,{"data-slot":`tag-pill-input`,"aria-invalid":u,className:b,children:[x,E]}),t[35]=u,t[36]=E,t[37]=b,t[38]=x,t[39]=D):D=t[39],D}function lc(e){let t=(0,G.c)(49),{title:n,description:r,tags:i,onTitleChange:a,onDescriptionChange:o,onTagsChange:s,requireTitle:c,disabled:l}=e,u=c===void 0?!1:c,d=l===void 0?!1:l,f=(0,K.useId)(),p=(0,K.useId)(),m=(0,K.useId)(),[h,g]=(0,K.useState)(!1),_;t[0]!==u||t[1]!==n?(_=u&&n.trim()===``,t[0]=u,t[1]=n,t[2]=_):_=t[2];let v=_&&h,y;t[3]===u?y=t[4]:(y=u?(0,W.jsx)(`span`,{className:`text-destructive`,children:`*`}):null,t[3]=u,t[4]=y);let b;t[5]!==y||t[6]!==f?(b=(0,W.jsxs)(xi,{htmlFor:f,children:[`Title`,y]}),t[5]=y,t[6]=f,t[7]=b):b=t[7];let x;t[8]===a?x=t[9]:(x=e=>a(e.target.value),t[8]=a,t[9]=x);let S;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>g(!0),t[10]=S):S=t[10];let C;t[11]!==d||t[12]!==v||t[13]!==x||t[14]!==n||t[15]!==f?(C=(0,W.jsx)(we,{id:f,value:n,onChange:x,onBlur:S,disabled:d,"aria-invalid":v}),t[11]=d,t[12]=v,t[13]=x,t[14]=n,t[15]=f,t[16]=C):C=t[16];let w;t[17]===v?w=t[18]:(w=v?(0,W.jsx)(wi,{children:`Required — title is the agent menu surface.`}):null,t[17]=v,t[18]=w);let T;t[19]!==b||t[20]!==C||t[21]!==w?(T=(0,W.jsxs)(yi,{children:[b,C,w]}),t[19]=b,t[20]=C,t[21]=w,t[22]=T):T=t[22];let E;t[23]===p?E=t[24]:(E=(0,W.jsx)(xi,{htmlFor:p,children:`Description`}),t[23]=p,t[24]=E);let D;t[25]===o?D=t[26]:(D=e=>o(e.target.value),t[25]=o,t[26]=D);let O;t[27]!==r||t[28]!==p||t[29]!==d||t[30]!==D?(O=(0,W.jsx)(Te,{id:p,value:r,onChange:D,disabled:d,rows:2}),t[27]=r,t[28]=p,t[29]=d,t[30]=D,t[31]=O):O=t[31];let k;t[32]!==E||t[33]!==O?(k=(0,W.jsxs)(yi,{children:[E,O]}),t[32]=E,t[33]=O,t[34]=k):k=t[34];let A;t[35]===m?A=t[36]:(A=(0,W.jsx)(xi,{htmlFor:m,children:`Tags`}),t[35]=m,t[36]=A);let j;t[37]!==d||t[38]!==s||t[39]!==i||t[40]!==m?(j=(0,W.jsx)(cc,{id:m,value:i,onChange:s,disabled:d}),t[37]=d,t[38]=s,t[39]=i,t[40]=m,t[41]=j):j=t[41];let M;t[42]!==A||t[43]!==j?(M=(0,W.jsxs)(yi,{children:[A,j]}),t[42]=A,t[43]=j,t[44]=M):M=t[44];let N;return t[45]!==T||t[46]!==k||t[47]!==M?(N=(0,W.jsxs)(W.Fragment,{children:[T,k,M]}),t[45]=T,t[46]=k,t[47]=M,t[48]=N):N=t[48],N}function uc(e){let t={},n=e.title.trim();n&&(t.title=n);let r=e.description.trim();r&&(t.description=r);let i=e.tags.map(e=>e.trim()).filter(e=>e.length>0);return i.length>0&&(t.tags=i),t}function dc(e){let t=(0,G.c)(17),{value:n,onChange:r,disabled:i,placeholder:a,rows:o}=e,s=i===void 0?!1:i,c=o===void 0?12:o,l=(0,K.useId)(),u;t[0]===l?u=t[1]:(u=(0,W.jsx)(xi,{htmlFor:l,children:`Body`}),t[0]=l,t[1]=u);let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,W.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/70`,children:[`Allowed substitutions: `,`{{date}}`,`, `,`{{user}}`]}),t[2]=d):d=t[2];let f;t[3]===u?f=t[4]:(f=(0,W.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[u,d]}),t[3]=u,t[4]=f);let p;t[5]===r?p=t[6]:(p=e=>r(e.target.value),t[5]=r,t[6]=p);let m;t[7]!==s||t[8]!==l||t[9]!==a||t[10]!==c||t[11]!==p||t[12]!==n?(m=(0,W.jsx)(Te,{id:l,value:n,onChange:p,disabled:s,rows:c,spellCheck:!1,placeholder:a,className:`font-mono text-xs leading-relaxed min-h-72`}),t[7]=s,t[8]=l,t[9]=a,t[10]=c,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==f||t[15]!==m?(h=(0,W.jsxs)(yi,{children:[f,m]}),t[14]=f,t[15]=m,t[16]=h):h=t[16],h}var fc=/^[A-Za-z0-9_-]+$/;function pc(e){let t=(0,G.c)(36),{mode:n,folderPath:r,initial:i,existingNames:a,onCommitted:o,target:s}=e,[c,l]=(0,K.useState)(i.name),[u,d]=(0,K.useState)(i.title),[f,p]=(0,K.useState)(i.description),[m,h]=(0,K.useState)(i.tags),[g,_]=(0,K.useState)(i.body),[v,y]=(0,K.useState)(!1),b,x,S,C;if(t[0]!==a||t[1]!==n||t[2]!==c||t[3]!==u){S=c.trim();let e;t[8]===u?e=t[9]:(e=u.trim(),t[8]=u,t[9]=e),C=e,b=n===`create`&&(S===``||!fc.test(S)),x=n===`create`&&!b&&(a?.has(S)??!1),t[0]=a,t[1]=n,t[2]=c,t[3]=u,t[4]=b,t[5]=x,t[6]=S,t[7]=C}else b=t[4],x=t[5],S=t[6],C=t[7];let w=x,T=!v&&!b&&C!==``,E;t[10]!==g||t[11]!==T||t[12]!==f||t[13]!==r||t[14]!==i.name||t[15]!==n||t[16]!==o||t[17]!==m||t[18]!==s||t[19]!==u||t[20]!==S?(E=async function(){if(!T)return;y(!0);let e=uc({title:u,description:f,tags:m}),t={folder:r,name:n===`create`?S:i.name,frontmatter:e,body:g};s!==void 0&&(t.target=s);let a=await rc(t);if(y(!1),!a.ok){ue.error(`${n===`create`?`Create`:`Save`} failed: ${a.error}`);return}a.warnings.length>0?ue.warning(a.warnings.join(` `)):n===`create`?ue.success(`Template "${S}" created`):ue.success(`Template saved`),o()},t[10]=g,t[11]=T,t[12]=f,t[13]=r,t[14]=i.name,t[15]=n,t[16]=o,t[17]=m,t[18]=s,t[19]=u,t[20]=S,t[21]=E):E=t[21];let D=E,O=s??`project`,k;return t[22]!==g||t[23]!==T||t[24]!==f||t[25]!==n||t[26]!==c||t[27]!==b||t[28]!==w||t[29]!==v||t[30]!==D||t[31]!==O||t[32]!==m||t[33]!==u||t[34]!==S?(k={mode:n,name:c,title:u,description:f,tags:m,body:g,setName:l,setTitle:d,setDescription:p,setTags:h,setBody:_,isSaving:v,canSubmit:T,nameInvalid:b,nameShadows:w,trimmedName:S,target:O,submit:D},t[22]=g,t[23]=T,t[24]=f,t[25]=n,t[26]=c,t[27]=b,t[28]=w,t[29]=v,t[30]=D,t[31]=O,t[32]=m,t[33]=u,t[34]=S,t[35]=k):k=t[35],k}function mc(e){let t=(0,G.c)(21),{form:n,bodyPlaceholder:r}=e,i=(0,K.useId)(),a=n.mode===`create`&&n.trimmedName!==``&&n.nameInvalid,o;t[0]!==n||t[1]!==i||t[2]!==a?(o=n.mode===`create`?(0,W.jsxs)(yi,{children:[(0,W.jsxs)(xi,{htmlFor:i,children:[`Name`,(0,W.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,W.jsx)(we,{id:i,value:n.name,onChange:e=>n.setName(e.target.value),placeholder:`article`,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":a}),a?(0,W.jsxs)(wi,{children:[`Letters, digits, `,(0,W.jsx)(`code`,{className:`font-mono`,children:`_`}),`,`,` `,(0,W.jsx)(`code`,{className:`font-mono`,children:`-`}),` only — no slashes, dots, spaces, or`,` `,(0,W.jsx)(`code`,{className:`font-mono`,children:`.md`}),`.`]}):n.nameShadows?(0,W.jsx)(Ci,{className:`text-yellow-600 dark:text-yellow-500`,children:n.target===`user`?(0,W.jsxs)(W.Fragment,{children:[`A template named `,(0,W.jsx)(`code`,{className:`font-mono`,children:n.trimmedName}),` already exists in your user scope. Saving overwrites it. Project or folder templates with the same name will continue to shadow this one in their respective scopes.`]}):(0,W.jsxs)(W.Fragment,{children:[`A template named `,(0,W.jsx)(`code`,{className:`font-mono`,children:n.trimmedName}),` already resolves here (likely inherited). Saving creates a`,` `,(0,W.jsx)(`code`,{className:`font-mono`,children:`local`}),` shadow that supersedes it for this folder.`]})}):null]}):null,t[0]=n,t[1]=i,t[2]=a,t[3]=o):o=t[3];let s;t[4]!==n.description||t[5]!==n.isSaving||t[6]!==n.setDescription||t[7]!==n.setTags||t[8]!==n.setTitle||t[9]!==n.tags||t[10]!==n.title?(s=(0,W.jsx)(lc,{title:n.title,description:n.description,tags:n.tags,onTitleChange:n.setTitle,onDescriptionChange:n.setDescription,onTagsChange:n.setTags,requireTitle:!0,disabled:n.isSaving}),t[4]=n.description,t[5]=n.isSaving,t[6]=n.setDescription,t[7]=n.setTags,t[8]=n.setTitle,t[9]=n.tags,t[10]=n.title,t[11]=s):s=t[11];let c;t[12]!==r||t[13]!==n.body||t[14]!==n.isSaving||t[15]!==n.setBody?(c=(0,W.jsx)(dc,{value:n.body,onChange:n.setBody,disabled:n.isSaving,placeholder:r}),t[12]=r,t[13]=n.body,t[14]=n.isSaving,t[15]=n.setBody,t[16]=c):c=t[16];let l;return t[17]!==o||t[18]!==s||t[19]!==c?(l=(0,W.jsxs)(_i,{children:[o,s,c]}),t[17]=o,t[18]=s,t[19]=c,t[20]=l):l=t[20],l}var hc={name:``,title:``,description:``,tags:[],body:``},gc=`## Summary
|
|
6
|
+
|
|
7
|
+
(One-paragraph summary. Edit later via edit_document.)
|
|
8
|
+
`;function _c(e){let t=(0,G.c)(13),{folderPath:n,existingNames:r,open:i,onOpenChange:a,onCreated:o,target:s}=e,c;t[0]!==r||t[1]!==n||t[2]!==o||t[3]!==a||t[4]!==i||t[5]!==s?(c=i?(0,W.jsx)(vc,{folderPath:n,existingNames:r,onOpenChange:a,onCreated:o,target:s}):null,t[0]=r,t[1]=n,t[2]=o,t[3]=a,t[4]=i,t[5]=s,t[6]=c):c=t[6];let l;t[7]===c?l=t[8]:(l=(0,W.jsx)(ve,{className:`sm:max-w-3xl max-h-[85vh] flex flex-col`,children:c}),t[7]=c,t[8]=l);let u;return t[9]!==a||t[10]!==i||t[11]!==l?(u=(0,W.jsx)(Ce,{open:i,onOpenChange:a,children:l}),t[9]=a,t[10]=i,t[11]=l,t[12]=u):u=t[12],u}function vc(e){let t=(0,G.c)(43),{folderPath:n,existingNames:r,onOpenChange:i,onCreated:a,target:o}=e,s=o===`user`,c;t[0]!==n||t[1]!==s?(c=s?`~/.ok/templates/<name>.md`:oc(n,`<name>`),t[0]=n,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]!==a||t[4]!==i?(u=()=>{a(),i(!1)},t[3]=a,t[4]=i,t[5]=u):u=t[5];let d;t[6]===o?d=t[7]:(d=o===void 0?{}:{target:o},t[6]=o,t[7]=d);let f;t[8]!==r||t[9]!==n||t[10]!==u||t[11]!==d?(f={mode:`create`,folderPath:n,initial:hc,existingNames:r,onCommitted:u,...d},t[8]=r,t[9]=n,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p=pc(f),m=s?`New user template`:`New template`,h;t[13]===m?h=t[14]:(h=(0,W.jsx)(U,{children:m}),t[13]=m,t[14]=h);let g;t[15]===l?g=t[16]:(g=(0,W.jsx)(`code`,{className:`font-mono`,children:l}),t[15]=l,t[16]=g);let _=s?`Available across every OK project you open with this user account.`:`Agents resolve it via leaf → root walk-up — closest-wins on filename collision.`,v;t[17]!==g||t[18]!==_?(v=(0,W.jsxs)(_e,{children:[`Lands at `,g,`.`,` `,_]}),t[17]=g,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==h||t[21]!==v?(y=(0,W.jsxs)(Se,{children:[h,v]}),t[20]=h,t[21]=v,t[22]=y):y=t[22];let b;t[23]===p?b=t[24]:(b=(0,W.jsx)(ye,{children:(0,W.jsx)(mc,{form:p,bodyPlaceholder:gc})}),t[23]=p,t[24]=b);let x;t[25]===i?x=t[26]:(x=()=>i(!1),t[25]=i,t[26]=x);let S;t[27]!==p.isSaving||t[28]!==x?(S=(0,W.jsx)(B,{variant:`outline`,className:`font-mono uppercase`,onClick:x,disabled:p.isSaving,children:`Cancel`}),t[27]=p.isSaving,t[28]=x,t[29]=S):S=t[29];let C;t[30]===p?C=t[31]:(C=()=>void p.submit(),t[30]=p,t[31]=C);let w=!p.canSubmit,T=p.isSaving?`Creating…`:`Create template`,E;t[32]!==C||t[33]!==w||t[34]!==T?(E=(0,W.jsx)(B,{onClick:C,disabled:w,children:T}),t[32]=C,t[33]=w,t[34]=T,t[35]=E):E=t[35];let D;t[36]!==S||t[37]!==E?(D=(0,W.jsxs)(be,{children:[S,E]}),t[36]=S,t[37]=E,t[38]=D):D=t[38];let O;return t[39]!==y||t[40]!==b||t[41]!==D?(O=(0,W.jsxs)(W.Fragment,{children:[y,b,D]}),t[39]=y,t[40]=b,t[41]=D,t[42]=O):O=t[42],O}function yc(e){let t=(0,G.c)(33),{folderPath:n,template:r,onOpenChange:i,onSaved:o,target:s}=e,c=r!==null,l;t[0]===i?l=t[1]:(l=function(){i(!1)},t[0]=i,t[1]=l);let u=l,d;t[2]!==u||t[3]!==o?(d=function(){o(),u()},t[2]=u,t[3]=o,t[4]=d):d=t[4];let f=d,p;t[5]===u?p=t[6]:(p=e=>e?null:u(),t[5]=u,t[6]=p);let m=r?.title??r?.name??`Template`,h;t[7]===r?.scope?h=t[8]:(h=r?.scope===`inherited`?(0,W.jsx)(a,{variant:`gray`,className:`text-2xs`,children:`inherited`}):null,t[7]=r?.scope,t[8]=h);let g;t[9]===r?.scope?g=t[10]:(g=r?.scope===`user`?(0,W.jsx)(a,{variant:`primary`,className:`text-2xs`,children:`user`}):null,t[9]=r?.scope,t[10]=g);let _;t[11]!==m||t[12]!==h||t[13]!==g?(_=(0,W.jsxs)(U,{className:`flex items-center gap-2`,children:[`Edit `,m,h,g]}),t[11]=m,t[12]=h,t[13]=g,t[14]=_):_=t[14];let v=r?.description??`Edit template`,y;t[15]===v?y=t[16]:(y=(0,W.jsx)(_e,{className:`sr-only`,children:v}),t[15]=v,t[16]=y);let b;t[17]!==_||t[18]!==y?(b=(0,W.jsxs)(Se,{children:[_,y]}),t[17]=_,t[18]=y,t[19]=b):b=t[19];let x;t[20]!==n||t[21]!==u||t[22]!==f||t[23]!==s||t[24]!==r?(x=r?(0,W.jsx)(bc,{folderPath:n,template:r,onCancel:u,onSaved:f,target:s},`${r.source_folder}::${r.name}`):null,t[20]=n,t[21]=u,t[22]=f,t[23]=s,t[24]=r,t[25]=x):x=t[25];let S;t[26]!==b||t[27]!==x?(S=(0,W.jsxs)(ve,{className:`sm:max-w-3xl max-h-[85vh] flex flex-col`,children:[b,x]}),t[26]=b,t[27]=x,t[28]=S):S=t[28];let C;return t[29]!==c||t[30]!==S||t[31]!==p?(C=(0,W.jsx)(Ce,{open:c,onOpenChange:p,children:S}),t[29]=c,t[30]=S,t[31]=p,t[32]=C):C=t[32],C}function bc(e){let t=(0,G.c)(8),{folderPath:n,template:r,onCancel:i,onSaved:a,target:o}=e,s=ti(n,r.name,o);if(s.status===`loading`||s.status===`idle`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,W.jsx)(ye,{className:`overflow-y-auto subtle-scrollbar`,children:(0,W.jsxs)(`div`,{className:`space-y-3`,children:[(0,W.jsx)(Jr,{className:`h-32 w-full`}),(0,W.jsx)(Jr,{className:`h-48 w-full`})]})}),t[0]=e):e=t[0],e}if(s.status===`error`){let e;return t[1]===s.message?e=t[2]:(e=(0,W.jsx)(ye,{className:`overflow-y-auto subtle-scrollbar`,children:(0,W.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Failed to load template: `,s.message]})}),t[1]=s.message,t[2]=e),e}let c;return t[3]!==i||t[4]!==a||t[5]!==s.data||t[6]!==o?(c=(0,W.jsx)(xc,{detail:s.data,onCancel:i,onSaved:a,target:o}),t[3]=i,t[4]=a,t[5]=s.data,t[6]=o,t[7]=c):c=t[7],c}function xc(e){let t=(0,G.c)(42),{detail:n,onCancel:r,onSaved:i,target:a}=e,o=n.frontmatter,s=typeof o.title==`string`?o.title:``,c=typeof o.description==`string`?o.description:``,l;t[0]===o.tags?l=t[1]:(l=Array.isArray(o.tags)?o.tags.filter(Sc):[],t[0]=o.tags,t[1]=l);let u;t[2]!==n.body||t[3]!==n.name||t[4]!==s||t[5]!==c||t[6]!==l?(u={name:n.name,title:s,description:c,tags:l,body:n.body},t[2]=n.body,t[3]=n.name,t[4]=s,t[5]=c,t[6]=l,t[7]=u):u=t[7];let d;t[8]===a?d=t[9]:(d=a===void 0?{}:{target:a},t[8]=a,t[9]=d);let f;t[10]!==n.folder||t[11]!==i||t[12]!==u||t[13]!==d?(f={mode:`edit`,folderPath:n.folder,initial:u,onCommitted:i,...d},t[10]=n.folder,t[11]=i,t[12]=u,t[13]=d,t[14]=f):f=t[14];let p=pc(f),m;t[15]===n.name?m=t[16]:(m=(0,W.jsxs)(`code`,{className:`font-mono`,children:[`write_document({ template: "`,n.name,`" })`]}),t[15]=n.name,t[16]=m);let h;t[17]===n.path?h=t[18]:(h=(0,W.jsx)(`code`,{className:`font-mono`,children:n.path}),t[17]=n.path,t[18]=h);let g;t[19]!==m||t[20]!==h?(g=(0,W.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Instantiate as`,` `,m,`. This template is located at `,h,`.`]}),t[19]=m,t[20]=h,t[21]=g):g=t[21];let _;t[22]===p?_=t[23]:(_=(0,W.jsx)(mc,{form:p}),t[22]=p,t[23]=_);let v;t[24]!==_||t[25]!==g?(v=(0,W.jsx)(ye,{className:`overflow-y-auto subtle-scrollbar`,children:(0,W.jsxs)(`div`,{className:`space-y-4`,children:[g,_]})}),t[24]=_,t[25]=g,t[26]=v):v=t[26];let y;t[27]!==p.isSaving||t[28]!==r?(y=(0,W.jsx)(B,{variant:`outline`,className:`font-mono uppercase`,onClick:r,disabled:p.isSaving,children:`Cancel`}),t[27]=p.isSaving,t[28]=r,t[29]=y):y=t[29];let b;t[30]===p?b=t[31]:(b=()=>void p.submit(),t[30]=p,t[31]=b);let x=!p.canSubmit,S=p.isSaving?`Saving…`:`Save`,C;t[32]!==b||t[33]!==x||t[34]!==S?(C=(0,W.jsx)(B,{onClick:b,disabled:x,children:S}),t[32]=b,t[33]=x,t[34]=S,t[35]=C):C=t[35];let w;t[36]!==y||t[37]!==C?(w=(0,W.jsxs)(be,{children:[y,C]}),t[36]=y,t[37]=C,t[38]=w):w=t[38];let T;return t[39]!==v||t[40]!==w?(T=(0,W.jsxs)(W.Fragment,{children:[v,w]}),t[39]=v,t[40]=w,t[41]=T):T=t[41],T}function Sc(e){return typeof e==`string`}var Cc=`npx @inkeep/open-knowledge install-skill`,wc=`https://inkeep.github.io/open-knowledge/guides/install-claude-cowork`;function Tc(){return typeof window<`u`&&typeof window.okDesktop?.skill==`object`}function Ec(e){let t=(0,G.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,W.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 font-mono text-[0.85em]`,children:n}),t[0]=n,t[1]=r),r}function Dc(e){let t=(0,G.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=z(`font-mono tracking-wide uppercase text-primary font-medium text-xs`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,W.jsx)(`p`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function Oc(e){let t=(0,G.c)(4),{n}=e,r;t[0]===n?r=t[1]:(r=n.toString().padStart(2,`0`),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-5 w-5 shrink-0 items-center justify-center text-xs font-medium text-muted-foreground font-mono tabular-nums`,children:r}),t[2]=r,t[3]=i),i}function kc(){let e=(0,G.c)(17),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsx)(Dc,{children:`In the Claude Desktop App`}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,W.jsx)(Oc,{n:1}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,W.jsx)(`strong`,{className:`font-medium`,children:`Customize`}),e[2]=r):r=e[2];let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,W.jsx)(Ee,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[3]=i):i=e[3];let a;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,W.jsxs)(`li`,{className:`flex gap-3`,children:[n,(0,W.jsxs)(`span`,{children:[`Open `,r,` in the sidebar`,` `,i,` `,(0,W.jsx)(`strong`,{className:`font-medium`,children:`Skills`}),`.`]})]}),e[4]=a):a=e[4];let o;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,W.jsx)(Oc,{n:2}),e[5]=o):o=e[5];let s;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,W.jsx)(`span`,{className:`inline-flex items-center justify-center font-medium border h-5 w-5 rounded-md text-xs`,children:`+`}),e[6]=s):s=e[6];let c;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,W.jsx)(Ee,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[7]=c):c=e[7];let l;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,W.jsx)(`strong`,{className:`font-medium`,children:`Create skill`}),e[8]=l):l=e[8];let u;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,W.jsx)(Ee,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[9]=u):u=e[9];let d;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,W.jsxs)(`li`,{className:`flex gap-3`,children:[o,(0,W.jsxs)(`span`,{children:[`Click`,` `,s,` `,c,` `,l,` `,u,` `,(0,W.jsx)(`strong`,{className:`font-medium`,children:`Upload skill`}),`.`]})]}),e[10]=d):d=e[10];let f;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,W.jsx)(Oc,{n:3}),e[11]=f):f=e[11];let p;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,W.jsx)(Ec,{children:`openknowledge.skill`}),e[12]=p):p=e[12];let m;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,W.jsxs)(`ol`,{className:`flex flex-col gap-4 text-sm`,children:[a,d,(0,W.jsxs)(`li`,{className:`flex gap-3`,children:[f,(0,W.jsxs)(`span`,{children:[`Pick `,p,` from your`,` `,(0,W.jsx)(`strong`,{className:`font-medium`,children:`Downloads`}),` folder. It enables automatically.`]})]})]}),e[13]=m):m=e[13];let h;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,W.jsx)(`strong`,{className:`font-medium`,children:`Skills`}),e[14]=h):h=e[14];let g;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,W.jsx)(Ee,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),e[15]=g):g=e[15];let _;return e[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t,m,(0,W.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-4`,children:[`Don't see `,h,`? Enable`,` `,(0,W.jsxs)(`strong`,{className:`font-medium`,children:[`Settings`,` `,g,` `,`Capabilities`,` `,(0,W.jsx)(Ee,{"aria-hidden":`true`,className:`inline h-3 w-3 text-muted-foreground`}),` Code execution and file creation`]}),` `,`first.`]})]}),e[16]=_):_=e[16],_}function Ac(e){let t=(0,G.c)(61),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={kind:`idle`},t[0]=i):i=t[0];let[a,o]=(0,K.useState)(i),[s,l]=(0,K.useState)(!1),u,d;t[1]===n?(u=t[2],d=t[3]):(u=()=>{n||(o({kind:`idle`}),l(!1))},d=[n],t[1]=n,t[2]=u,t[3]=d),(0,K.useEffect)(u,d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=async function(){o({kind:`downloading`});let e=window.okDesktop?.skill;if(!e){o({kind:`error`,message:`Electron bridge unavailable. Refresh and try again.`});return}let t=await e.buildAndOpen();if(t.ok)o({kind:`handed-off`,path:t.path});else{let e=t.message??t.reason;ue.error(`Install handoff failed: ${e}`),o({kind:`error`,message:t.reason===`open-failed`?`The Claude Desktop App didn't open the file. Is it installed? (${e})`:`${t.reason}: ${e}`})}},t[4]=f):f=t[4];let p=f,h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=async function(){try{await navigator.clipboard.writeText(Cc),l(!0),setTimeout(()=>l(!1),2e3)}catch(e){let t=e;ue.error(`Couldn't copy: ${t instanceof Error?t.message:String(t)}`)}},t[5]=h):h=t[5];let g=h,_;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=Tc(),t[6]=_):_=t[6];let v=_,y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,W.jsxs)(U,{className:`flex items-center gap-2`,children:[(0,W.jsx)(Oe,{"aria-hidden":`true`,className:`h-4 w-4`}),`Install for Claude Chat & Cowork`]}),t[7]=y):y=t[7];let b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,W.jsxs)(Se,{children:[y,(0,W.jsxs)(_e,{children:[`Adds the Open Knowledge skill to the`,` `,(0,W.jsx)(`strong`,{className:`font-medium text-foreground`,children:`Claude Desktop App`}),` so it's available in Chat and Cowork sessions.`]})]}),t[8]=b):b=t[8];let x;t[9]===a.kind?x=t[10]:(x=a.kind===`idle`&&v&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(Dc,{className:`text-muted-foreground`,children:`Automatic`}),(0,W.jsxs)(`p`,{className:`text-sm`,children:[`We'll build `,(0,W.jsx)(Ec,{children:`openknowledge.skill`}),`, save it to`,` `,(0,W.jsx)(Ec,{children:`~/Downloads`}),`, and open the Claude Desktop App for you.`]})]}),(0,W.jsx)(kc,{})]}),t[9]=a.kind,t[10]=x);let S;t[11]!==s||t[12]!==a.kind?(S=a.kind===`idle`&&!v&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(Dc,{children:`Run this in your terminal`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border bg-muted/40 p-2`,children:[(0,W.jsx)(`code`,{className:`flex-1 font-mono text-xs`,children:Cc}),(0,W.jsx)(B,{variant:`ghost`,size:`sm`,onClick:g,"aria-label":`Copy command`,className:`h-7 gap-1`,children:s?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(m,{"aria-hidden":`true`,className:`h-3 w-3`}),`Copied`]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(De,{"aria-hidden":`true`,className:`h-3 w-3`}),`Copy`]})})]}),(0,W.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Saves the file to `,(0,W.jsx)(Ec,{children:`~/Downloads/openknowledge.skill`}),` and opens the Claude Desktop App. Requires Node.js or Bun on your PATH.`]})]}),(0,W.jsx)(kc,{})]}),t[11]=s,t[12]=a.kind,t[13]=S):S=t[13];let C;t[14]===a.kind?C=t[15]:(C=a.kind===`downloading`&&(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,W.jsx)(c,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Building `,(0,W.jsx)(Ec,{children:`openknowledge.skill`}),` and opening the Claude Desktop App…`]}),t[14]=a.kind,t[15]=C);let w;t[16]!==a.kind||t[17]!==a.path?(w=a.kind===`handed-off`&&v&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,W.jsx)(m,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,W.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`File saved & Claude Desktop App opened`}),(0,W.jsx)(`code`,{className:`font-mono text-xs text-muted-foreground`,children:a.path??`~/Downloads/openknowledge.skill`})]})]}),(0,W.jsx)(kc,{})]}),t[16]=a.kind,t[17]=a.path,t[18]=w):w=t[18];let T;t[19]===a.kind?T=t[20]:(T=a.kind===`handed-off`&&!v&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-primary/30 bg-primary/5 px-3 py-2`,children:[(0,W.jsx)(m,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 text-primary`}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,W.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`Download started`}),(0,W.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`File saves to `,(0,W.jsx)(Ec,{children:`~/Downloads/openknowledge.skill`}),`.`]})]})]}),(0,W.jsx)(kc,{})]}),t[19]=a.kind,t[20]=T);let E;t[21]!==a.kind||t[22]!==a.message?(E=a.kind===`error`&&(0,W.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm`,children:[(0,W.jsx)(`span`,{className:`text-destructive`,children:a.message}),(0,W.jsx)(`a`,{href:wc,target:`_blank`,rel:`noopener noreferrer`,onClick:Pc,onAuxClick:Nc,className:`text-xs underline underline-offset-2 hover:text-foreground`,children:`See the full install guide`})]}),t[21]=a.kind,t[22]=a.message,t[23]=E):E=t[23];let D;t[24]!==S||t[25]!==C||t[26]!==w||t[27]!==T||t[28]!==E||t[29]!==x?(D=(0,W.jsx)(ye,{children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-6 py-2`,children:[x,S,C,w,T,E]})}),t[24]=S,t[25]=C,t[26]=w,t[27]=T,t[28]=E,t[29]=x,t[30]=D):D=t[30];let O;t[31]===a.kind?O=t[32]:(O=a.kind!==`error`&&(0,W.jsxs)(`a`,{href:wc,target:`_blank`,rel:`noopener noreferrer`,onClick:Mc,onAuxClick:jc,className:`inline-flex items-center gap-1 self-center text-xs text-muted-foreground underline underline-offset-2 hover:text-foreground sm:mr-auto font-mono tracking-wide uppercase`,children:[`Full guide`,(0,W.jsx)(je,{"aria-hidden":`true`,className:`h-3 w-3`})]}),t[31]=a.kind,t[32]=O);let k;t[33]!==r||t[34]!==a.kind?(k=a.kind===`idle`&&v&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,W.jsxs)(B,{onClick:p,children:[(0,W.jsx)(Oe,{"aria-hidden":`true`,className:`h-4 w-4`}),`Install`]})]}),t[33]=r,t[34]=a.kind,t[35]=k):k=t[35];let A;t[36]!==r||t[37]!==a.kind?(A=a.kind===`idle`&&!v&&(0,W.jsx)(B,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Close`}),t[36]=r,t[37]=a.kind,t[38]=A):A=t[38];let j;t[39]!==r||t[40]!==a.kind?(j=a.kind===`error`&&v&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B,{className:`uppercase font-mono`,variant:`ghost`,onClick:()=>r(!1),children:`Cancel`}),(0,W.jsxs)(B,{onClick:p,children:[(0,W.jsx)(Oe,{"aria-hidden":`true`,className:`h-4 w-4`}),`Try again`]})]}),t[39]=r,t[40]=a.kind,t[41]=j):j=t[41];let M;t[42]===a.kind?M=t[43]:(M=a.kind===`downloading`&&(0,W.jsxs)(B,{disabled:!0,children:[(0,W.jsx)(c,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Installing…`]}),t[42]=a.kind,t[43]=M);let N;t[44]!==r||t[45]!==a.kind?(N=a.kind===`handed-off`&&(0,W.jsx)(B,{onClick:()=>r(!1),children:`Done`}),t[44]=r,t[45]=a.kind,t[46]=N):N=t[46];let P;t[47]!==O||t[48]!==k||t[49]!==A||t[50]!==j||t[51]!==M||t[52]!==N?(P=(0,W.jsxs)(be,{children:[O,k,A,j,M,N]}),t[47]=O,t[48]=k,t[49]=A,t[50]=j,t[51]=M,t[52]=N,t[53]=P):P=t[53];let F;t[54]!==D||t[55]!==P?(F=(0,W.jsxs)(ve,{className:`sm:max-w-lg`,"data-ok-layer-spawned":``,children:[b,D,P]}),t[54]=D,t[55]=P,t[56]=F):F=t[56];let I;return t[57]!==r||t[58]!==n||t[59]!==F?(I=(0,W.jsx)(Ce,{open:n,onOpenChange:r,children:F}),t[57]=r,t[58]=n,t[59]=F,t[60]=I):I=t[60],I}function jc(e){return Re(e,wc)}function Mc(e){return Re(e,wc)}function Nc(e){return Re(e,wc)}function Pc(e){return Re(e,wc)}function Fc(e){let t=(0,G.c)(9),{open:n,onOpenChange:r,onConfirm:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,W.jsx)(Se,{children:(0,W.jsx)(fi,{})}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,W.jsx)(ye,{children:(0,W.jsx)(pi,{})}),t[1]=o):o=t[1];let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,W.jsx)(xe,{asChild:!0,children:(0,W.jsx)(B,{variant:`outline`,children:`Cancel`})}),t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=(0,W.jsxs)(ve,{children:[a,o,(0,W.jsxs)(be,{children:[s,(0,W.jsx)(B,{onClick:i,children:`Enable auto-sync`})]})]}),t[3]=i,t[4]=c);let l;return t[5]!==r||t[6]!==n||t[7]!==c?(l=(0,W.jsx)(Ce,{open:n,onOpenChange:r,children:c}),t[5]=r,t[6]=n,t[7]=c,t[8]=l):l=t[8],l}function Ic(e){let t=e.trim();return t.length===0?{kind:`blank`,raw:e}:t.startsWith(`#`)?{kind:`comment`,raw:e}:{kind:`pattern`,raw:e,text:t}}function Lc(e){return{lines:e.split(`
|
|
9
|
+
`).map(Ic)}}function Rc(e){return e.lines.map(e=>e.raw).join(`
|
|
10
|
+
`)}function zc(e){return e.lines.filter(e=>e.kind===`pattern`)}function Bc(e,t){let n=t.trim();if(n.length===0)return e;let r={kind:`pattern`,raw:n,text:n},i=e.lines.slice(),a=i[i.length-1];return a&&a.kind===`blank`&&a.raw===``?i.splice(i.length-1,0,r):i.push(r,{kind:`blank`,raw:``}),{lines:i}}function Vc(e,t,n){let r=n.trim();if(r.length===0)return Hc(e,t);let i=Wc(e,t);if(i<0)return e;let a=e.lines.slice();return a[i]={kind:`pattern`,raw:r,text:r},{lines:a}}function Hc(e,t){let n=Wc(e,t);if(n<0)return e;let r=e.lines.slice();return r.splice(n,1),{lines:r}}function Uc(e,t,n){if(t===n)return e;let r=[],i=[];if(e.lines.forEach((e,t)=>{e.kind===`pattern`&&(r.push(t),i.push(e))}),t<0||t>=i.length||n<0||n>=i.length)return e;let a=i.slice(),[o]=a.splice(t,1);if(!o)return e;a.splice(n,0,o);let s=e.lines.slice();return r.forEach((e,t)=>{let n=a[t];n&&(s[e]=n)}),{lines:s}}function Wc(e,t){if(t<0)return-1;let n=0;for(let r=0;r<e.lines.length;r++)if(e.lines[r]?.kind===`pattern`){if(n===t)return r;n++}return-1}var Gc=new Set;function Kc(e){for(let t of Gc)try{t(e)}catch(e){console.warn(`[config-ignore-nested-error-events] listener threw:`,e)}}function qc(e){return Gc.add(e),()=>{Gc.delete(e)}}var Jc=new Set;function Yc(e){for(let t of Jc)try{t(e)}catch(e){console.warn(`[config-validation-events] listener threw:`,e)}}function Xc(e){return Jc.add(e),()=>{Jc.delete(e)}}export{di as $,Gs as A,fa as B,Xs as C,Qs as D,Zs as E,ls as F,xi as G,yi as H,oo as I,hi as J,Si as K,fo as L,Vs as M,Ls as N,ec as O,Ts as P,ui as Q,ya as R,qs as S,Ys as T,bi as U,Zi as V,Ci as W,fi as X,mi as Y,pi as Z,ac as _,Bc as a,Jr as at,Ws as b,Lc as c,Ne as ct,Rc as d,ke as dt,ai as et,Fc as f,Oe as ft,sc as g,_c as h,qc as i,Xr as it,ks as j,$s as k,Hc as l,Me as lt,yc as m,Ee as mt,Xc as n,Zr as nt,Vc as o,Re as ot,Ac as p,De as pt,gi as q,Kc as r,Yr as rt,zc as s,Pe as st,Yc as t,oi as tt,Uc as u,Ae as ut,ic as v,Js as w,Ks as x,nc as y,da as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as e,G as t,H as n,R as r,V as i,W as a,z as o}from"./dist-B-xmnigy.js";var s=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new c(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),t==0){this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(n,this.reducePos);return}let o=this.stack.length-(t-1)*3-(e&262144?6:0),s=o?this.stack[o-2]:this.p.ranges[0].from,c=this.reducePos-s;c>=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=s,this.p.lastBigReductionSize=c));let l=o?this.stack[o-1]:0,u=this.bufferBase+this.buffer.length-l;if(n<r.minRepeatTerm||e&131072){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,s,e,u+4,!0)}if(e&262144)this.state=this.stack[o];else{let e=this.stack[o-3];this.state=r.getGoto(e,n,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this,r=this.buffer.length;if(r==0&&e.parent&&(r=e.bufferBase-e.parent.bufferBase,e=e.parent),r>0&&e.buffer[r-4]==0&&e.buffer[r-1]>-1){if(t==n)return;if(e.buffer[r-2]>=t){e.buffer[r-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(;n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new l(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>t&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216))if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new c(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},c=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},l=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3,this.state=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0)}},u=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function d(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r<e.length;){let a=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(t==126){a=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var f=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},p=new f,m=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=p,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(t==null)return-1;if(n=t,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw RangeError(`Token end out of bounds`);this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos);this.chunk=this.pos+e.length>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=p,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk=``,this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},h=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;v(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};h.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var g=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?d(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(v(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};g.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var _=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function v(e,t,n,r,i,a){let o=0,s=1<<r,{dialect:c}=n.p.parser;scan:for(;(s&e[o])!=0;){let n=e[o+1];for(let r=o+3;r<n;r+=2)if((e[r+1]&s)>0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||b(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l<u;){let i=l+u>>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r<s)u=i;else if(r>=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function y(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function b(e,t,n,r){let i=y(n,r,t);return i<0||y(n,r,e)<i}var x=typeof process<`u`&&/\bparse\b/.test({}.LOG),S=null;function C(e,t,n){let r=e.cursor(o.IncludeAnonymous);for(r.moveTo(t);;)if(!(n<0?r.childBefore(t):r.childAfter(t)))for(;;){if((n<0?r.to<t:r.from>t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}var w=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?C(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?C(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(n){if(n<this.nextStart)return null;for(;this.fragment&&this.safeTo<=n;)this.nextFragment();if(!this.fragment)return null;for(;;){let r=this.trees.length-1;if(r<0)return this.nextFragment(),null;let i=this.trees[r],a=this.index[r];if(a==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=i.children[a],s=this.start[r]+i.positions[a];if(s>n)return this.nextStart=s,null;if(o instanceof t){if(s==n){if(s<this.safeFrom)return null;let t=s+o.length;if(t<=this.safeTo){let n=o.prop(e.lookAhead);if(!n||t+n<this.fragment.to)return o}}this.index[r]++,s+o.length>=Math.max(this.safeFrom,n)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[r]++,this.nextStart=s+o.length}}},T=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new f)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;r<i.length;r++){if(!(1<<r&a))continue;let c=i[r],l=this.tokens[r];if(!(n&&!c.fallback)&&((c.contextual||l.start!=e.pos||l.mask!=a||l.context!=o)&&(this.updateCachedToken(l,c,e),l.mask=a,l.context=o),l.lookAhead>l.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new f,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new f,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:a}=e.p,{data:o}=a;for(let e=0;e<2;e++)for(let s=a.stateSlot(i,e?2:1);;s+=3){if(o[s]==65535)if(o[s+1]==1)s=M(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(M(o,s+2),t,n,r));break}o[s]==t&&(r=this.putAction(M(o,s+1),t,n,r))}return r}},E=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new m(t,r),this.tokens=new T(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[s.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new w(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let o=e[a];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&N(r);if(e)return x&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw x&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return x&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e<n.length-1;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let i=n[r];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500)if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e<n.length;e++)n[e].pos<this.minStackPos&&(this.minStackPos=n[e].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}advanceStack(n,r,i){let a=n.pos,{parser:o}=this,s=x?this.stackID(n)+` -> `:``;if(this.stoppedAt!=null&&a>this.stoppedAt)return n.forceReduce()?n:null;if(this.fragments){let r=n.curContext&&n.curContext.tracker.strict,i=r?n.curContext.hash:0;for(let c=this.fragments.nodeAt(a);c;){let a=this.parser.nodeSet.types[c.type.id]==c.type?o.getGoto(n.state,c.type.id):-1;if(a>-1&&c.length&&(!r||(c.prop(e.contextHash)||0)==i))return n.useNode(c,a),x&&console.log(s+this.stackID(n)+` (via reuse of ${o.getName(c.type.id)})`),!0;if(!(c instanceof t)||c.children.length==0||c.positions[0]>0)break;let l=c.children[0];if(l instanceof t&&c.positions[0]==0)c=l;else break}}let c=o.stateSlot(n.state,4);if(c>0)return n.reduce(c),x&&console.log(s+this.stackID(n)+` (via always-reduce ${o.getName(c&65535)})`),!0;if(n.stack.length>=8400)for(;n.stack.length>6e3&&n.forceReduce(););let l=this.tokens.getActions(n);for(let e=0;e<l.length;){let t=l[e++],c=l[e++],u=l[e++],d=e==l.length||!i,f=d?n:n.split(),p=this.tokens.mainToken;if(f.apply(t,c,p?p.start:f.pos,u),x&&console.log(s+this.stackID(f)+` (via ${t&65536?`reduce of ${o.getName(t&65535)}`:`shift`} for ${o.getName(c)} @ ${a}${f==n?``:`, split`})`),d)return!0;f.pos>a?r.push(f):i.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return D(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=t[a<<1],c=t[(a<<1)+1],l=x?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),x&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(x&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)x&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))x&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),x&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),D(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),t.build({buffer:u.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(S||=new WeakMap).get(e);return t||S.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function D(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}var O=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},k=e=>e,A=class{constructor(e){this.start=e.start,this.shift=e.shift||k,this.reduce=e.reduce||k,this.reuse=e.reuse||k,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},j=class t extends a{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let a=t.nodeNames.split(` `);this.minRepeatTerm=a.length;for(let e=0;e<t.repeatNodeCount;e++)a.push(``);let o=Object.keys(t.topRules).map(e=>t.topRules[e][1]),s=[];for(let e=0;e<a.length;e++)s.push([]);function c(e,t,n){s[e].push([t,t.deserialize(String(n))])}if(t.nodeProps)for(let n of t.nodeProps){let t=n[0];typeof t==`string`&&(t=e[t]);for(let e=1;e<n.length;){let r=n[e++];if(r>=0)c(r,t,n[e++]);else{let i=n[e+-r];for(let a=-r;a>0;a--)c(n[e++],t,i);e++}}}this.nodeSet=new i(a.map((e,r)=>n.define({name:r>=this.minRepeatTerm?void 0:e,id:r,props:s[r],top:o.indexOf(r)>-1,error:r==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(r)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=r;let l=d(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(P),this.states=d(t.states,Uint32Array),this.data=d(t.stateData),this.goto=d(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(e=>typeof e==`number`?new h(l,e):e),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new E(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return o;if(a)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),a;;i+=3){if((a=n[i])==65535)if(n[i+1]==1)a=n[i=M(n,i+2)];else if(n[i+1]==2)return M(n,i+2);else break;if(a==t||a==0)return M(n,i+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=M(this.data,n+2);else break;r=t(M(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=M(this.data,n+2);else break;if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(e){let n=Object.assign(Object.create(t.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let t=this.topRules[e.top];if(!t)throw RangeError(`Invalid top rule name ${e.top}`);n.top=t}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(t=>{let n=e.tokenizers.find(e=>e.from==t);return n?n.to:t})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((t,r)=>{let i=e.specializers.find(e=>e.from==t.external);if(!i)return t;let a=Object.assign(Object.assign({},t),{external:i.to});return n.specializers[r]=P(a),a})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],i;(i=this.data[n++])!=65535;)(r||=new Uint8Array(this.maxTerm+1))[i]=1;return new O(e,n,r)}static deserialize(e){return new t(e)}};function M(e,t){return e[t]|e[t+1]<<16}function N(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||e!=null&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}function P(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}export{g as i,_ as n,j as r,A as t};
|
|
1
|
+
import{B as e,G as t,H as n,K as r,U as i,V as a,z as o}from"./dist-Du-s1q8P.js";var s=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new c(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=r.dynamicPrecedence(n);if(a&&(this.score+=a),t==0){this.pushState(r.getGoto(this.state,n,!0),this.reducePos),n<r.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(n,this.reducePos);return}let o=this.stack.length-(t-1)*3-(e&262144?6:0),s=o?this.stack[o-2]:this.p.ranges[0].from,c=this.reducePos-s;c>=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=s,this.p.lastBigReductionSize=c));let l=o?this.stack[o-1]:0,u=this.bufferBase+this.buffer.length-l;if(n<r.minRepeatTerm||e&131072){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,s,e,u+4,!0)}if(e&262144)this.state=this.stack[o];else{let e=this.stack[o-3];this.state=r.getGoto(e,n,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this,r=this.buffer.length;if(r==0&&e.parent&&(r=e.bufferBase-e.parent.bufferBase,e=e.parent),r>0&&e.buffer[r-4]==0&&e.buffer[r-1]>-1){if(t==n)return;if(e.buffer[r-2]>=t){e.buffer[r-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;this.pos=r;let o=a.stateFlag(i,1);!o&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(i,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(;n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new l(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let r=t[e+1];n.some((e,t)=>t&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let r=t[e+1];if(r==this.state)continue;let i=this.split();i.pushState(r,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(t[e],this.pos),i.reducePos=this.pos,i.score-=200,n.push(i)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216))if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new c(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},c=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},l=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3,this.state=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0)}},u=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function d(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r<e.length;){let a=0;for(;;){let t=e.charCodeAt(r++),n=!1;if(t==126){a=65535;break}t>=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var f=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},p=new f,m=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=p,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<n.from;){if(!r)return null;let e=this.ranges[--r];i-=n.from-e.to,n=e}for(;t<0?i>n.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let t=this.resolveOffset(e,1);if(t==null)return-1;if(n=t,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let e=this.rangeIndex,t=this.range;for(;t.to<=n;)t=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>t.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw RangeError(`Token end out of bounds`);this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos);this.chunk=this.pos+e.length>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=p,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk=``,this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},h=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;v(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};h.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var g=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?d(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(v(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};g.prototype.contextual=h.prototype.fallback=h.prototype.extend=!1;var _=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function v(e,t,n,r,i,a){let o=0,s=1<<r,{dialect:c}=n.p.parser;scan:for(;(s&e[o])!=0;){let n=e[o+1];for(let r=o+3;r<n;r+=2)if((e[r+1]&s)>0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||b(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l<u;){let i=l+u>>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r<s)u=i;else if(r>=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function y(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function b(e,t,n,r){let i=y(n,r,t);return i<0||y(n,r,e)<i}var x=typeof process<`u`&&/\bparse\b/.test({}.LOG),S=null;function C(t,n,r){let i=t.cursor(e.IncludeAnonymous);for(i.moveTo(n);;)if(!(r<0?i.childBefore(n):i.childAfter(n)))for(;;){if((r<0?i.to<n:i.from>n)&&!i.type.isError)return r<0?Math.max(0,Math.min(i.to-1,n-25)):Math.min(t.length,Math.max(i.from+1,n+25));if(r<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return r<0?0:t.length}}var w=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?C(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?C(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],i=this.index[t];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=n.children[i],s=this.start[t]+n.positions[i];if(s>e)return this.nextStart=s,null;if(o instanceof r){if(s==e){if(s<this.safeFrom)return null;let e=s+o.length;if(e<=this.safeTo){let t=o.prop(a.lookAhead);if(!t||e+t<this.fragment.to)return o}}this.index[t]++,s+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(s),this.index.push(0))}else this.index[t]++,this.nextStart=s+o.length}}},T=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new f)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;r<i.length;r++){if(!(1<<r&a))continue;let c=i[r],l=this.tokens[r];if(!(n&&!c.fallback)&&((c.contextual||l.start!=e.pos||l.mask!=a||l.context!=o)&&(this.updateCachedToken(l,c,e),l.mask=a,l.context=o),l.lookAhead>l.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new f,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new f,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r<t.specialized.length;r++)if(t.specialized[r]==e.value){let i=t.specializers[r](this.stream.read(e.start,e.end),n);if(i>=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;t<r;t+=3)if(this.actions[t]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:i}=e,{parser:a}=e.p,{data:o}=a;for(let e=0;e<2;e++)for(let s=a.stateSlot(i,e?2:1);;s+=3){if(o[s]==65535)if(o[s+1]==1)s=M(o,s+2);else{r==0&&o[s+1]==2&&(r=this.putAction(M(o,s+2),t,n,r));break}o[s]==t&&(r=this.putAction(M(o,s+1),t,n,r))}return r}},E=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new m(t,r),this.tokens=new T(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[s.start(this,e.top[0],i)],this.fragments=n.length&&this.stream.end-i>e.bufferLength*4?new w(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let o=e[a];for(;;){if(this.tokens.mainToken=null,o.pos>t)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&N(r);if(e)return x&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw x&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return x&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e<n.length-1;e++){let t=n[e];for(let r=e+1;r<n.length;r++){let i=n[r];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500)if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}n.length>12&&(n.sort((e,t)=>t.score-e.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let e=1;e<n.length;e++)n[e].pos<this.minStackPos&&(this.minStackPos=n[e].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}advanceStack(e,t,n){let i=e.pos,{parser:o}=this,s=x?this.stackID(e)+` -> `:``;if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let c=this.fragments.nodeAt(i);c;){let i=this.parser.nodeSet.types[c.type.id]==c.type?o.getGoto(e.state,c.type.id):-1;if(i>-1&&c.length&&(!t||(c.prop(a.contextHash)||0)==n))return e.useNode(c,i),x&&console.log(s+this.stackID(e)+` (via reuse of ${o.getName(c.type.id)})`),!0;if(!(c instanceof r)||c.children.length==0||c.positions[0]>0)break;let l=c.children[0];if(l instanceof r&&c.positions[0]==0)c=l;else break}}let c=o.stateSlot(e.state,4);if(c>0)return e.reduce(c),x&&console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let r=0;r<l.length;){let a=l[r++],c=l[r++],u=l[r++],d=r==l.length||!n,f=d?e:e.split(),p=this.tokens.mainToken;if(f.apply(a,c,p?p.start:f.pos,u),x&&console.log(s+this.stackID(f)+` (via ${a&65536?`reduce of ${o.getName(a&65535)}`:`shift`} for ${o.getName(c)} @ ${i}${f==e?``:`, split`})`),d)return!0;f.pos>i?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return D(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=t[a<<1],c=t[(a<<1)+1],l=x?this.stackID(o)+` -> `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),x&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(x&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)x&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))x&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),x&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),D(o,n)):(!r||r.score<u.score)&&(r=u)}return r}stackToTree(e){return e.close(),r.build({buffer:u.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(S||=new WeakMap).get(e);return t||S.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function D(e,t){for(let n=0;n<t.length;n++){let r=t[n];if(r.pos==e.pos&&r.sameState(e)){t[n].score<e.score&&(t[n]=e);return}}t.push(e)}var O=class{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}},k=e=>e,A=class{constructor(e){this.start=e.start,this.shift=e.shift||k,this.reduce=e.reduce||k,this.reuse=e.reuse||k,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},j=class e extends t{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(` `);this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push(``);let r=Object.keys(e.topRules).map(t=>e.topRules[t][1]),s=[];for(let e=0;e<t.length;e++)s.push([]);function c(e,t,n){s[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];typeof e==`string`&&(e=a[e]);for(let n=1;n<t.length;){let r=t[n++];if(r>=0)c(r,e,t[n++]);else{let i=t[n+-r];for(let a=-r;a>0;a--)c(t[n++],e,i);n++}}}this.nodeSet=new n(t.map((t,n)=>i.define({name:n>=this.minRepeatTerm?void 0:t,id:n,props:s[n],top:r.indexOf(n)>-1,error:n==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(n)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=o;let l=d(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(P),this.states=d(e.states,Uint32Array),this.data=d(e.stateData),this.goto=d(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>typeof e==`number`?new h(l,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new E(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i<n;i++)if(r[i]==e)return o;if(a)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),a;;i+=3){if((a=n[i])==65535)if(n[i+1]==1)a=n[i=M(n,i+2)];else if(n[i+1]==2)return M(n,i+2);else break;if(a==t||a==0)return M(n,i+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=M(this.data,n+2);else break;r=t(M(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=M(this.data,n+2);else break;if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(t){let n=Object.assign(Object.create(e.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let e=this.topRules[t.top];if(!e)throw RangeError(`Invalid top rule name ${t.top}`);n.top=e}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(e=>{let n=t.tokenizers.find(t=>t.from==e);return n?n.to:e})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((e,r)=>{let i=t.specializers.find(t=>t.from==e.external);if(!i)return e;let a=Object.assign(Object.assign({},e),{external:i.to});return n.specializers[r]=P(a),a})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n=this.dialects[t[e]],i;(i=this.data[n++])!=65535;)(r||=new Uint8Array(this.maxTerm+1))[i]=1;return new O(e,n,r)}static deserialize(t){return new e(t)}};function M(e,t){return e[t]|e[t+1]<<16}function N(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||e!=null&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}function P(e){if(e.external){let t=+!!e.extend;return(n,r)=>e.external(n,r)<<1|t}return e.get}export{g as i,_ as n,j as r,A as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$ as e,At as t,Bt as n,Et as r,Ft as i,It as a,J as o,Lt as s,Nt as c,O as l,Ot as u,P as d,Pt as f,Q as p,Rt as m,Ut as h,X as g,Y as ee,ft as _,it as v,jt as y,kt as b,ut as x,vt as te,wt as S,xt as ne,zt as C}from"./dist-Du-s1q8P.js";var w=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=d(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(se(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function T(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function re(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=T(t)+T(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function ie(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:re(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function ae(e,t){return n=>{for(let t=d(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}var oe=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function E(e){return e.selection.main.from}function se(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var D=ne.define();function ce(e,t,n,i){let{main:a}=e.selection,o=n-a.from,s=i-a.from;return{...e.changeByRange(c=>{if(c!=a&&n!=i&&e.sliceDoc(c.from+o,c.from+s)!=e.sliceDoc(n,i))return{range:c};let l=e.toText(t);return{changes:{from:c.from+o,to:i==a.from?c.to:c.from+s,insert:l},range:r.cursor(c.from+o+l.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var O=new WeakMap;function le(e){if(!Array.isArray(e))return e;let t=O.get(e);return t||O.set(e,t=ie(e)),t}var k=f.define(),A=f.define(),ue=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=m(e,t),r=C(n);this.chars.push(n);let i=e.slice(t,t+r),a=i.toUpperCase();this.folded.push(m(a==i?i.toLowerCase():a,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:a}=this;if(t.length==1){let r=m(e,0),i=C(r),a=i==e.length?0:-100;if(r!=t[0])if(r==n[0])a+=-200;else return null;return this.ret(a,[0,i])}let o=e.indexOf(this.pattern);if(o==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let s=t.length,c=0;if(o<0){for(let i=0,a=Math.min(e.length,200);i<a&&c<s;){let a=m(e,i);(a==t[c]||a==n[c])&&(r[c++]=i),i+=C(a)}if(c<s)return null}let l=0,u=0,d=!1,f=0,p=-1,g=-1,ee=/[a-z]/.test(e),_=!0;for(let r=0,c=Math.min(e.length,200),v=0;r<c&&u<s;){let c=m(e,r);o<0&&(l<s&&c==t[l]&&(i[l++]=r),f<s&&(c==t[f]||c==n[f]?(f==0&&(p=r),g=r+1,f++):f=0));let y,b=c<255?c>=48&&c<=57||c>=97&&c<=122?2:+(c>=65&&c<=90):(y=h(c))==y.toLowerCase()?y==y.toUpperCase()?0:2:1;(!r||b==1&&ee||v==0&&b!=0)&&(t[u]==c||n[u]==c&&(d=!0)?a[u++]=r:a.length&&(_=!1)),v=b,r+=C(c)}return u==s&&a[0]==0&&_?this.result(-100+(d?-200:0),a,e):f==s&&p==0?this.ret(-200-e.length+(g==e.length?0:-100),[0,g]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):f==s?this.ret(-900-e.length,[p,g]):u==s?this.result(-100+(d?-200:0)+-700+(_?0:-1100),a,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?C(m(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}},de=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},j=u.define({combine(e){return n(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:fe,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>M(e(n),t(n)),optionClass:(e,t)=>n=>M(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function M(e,t){return e?t?e+` `+t:e:t}function fe(e,t,n,r,i,a){let o=e.textDirection==ee.RTL,s=o,c=!1,l=`top`,u,d,f=t.left-i.left,p=i.right-t.right,m=r.right-r.left,h=r.bottom-r.top;if(s&&f<Math.min(m,p)?s=!1:!s&&p<Math.min(m,f)&&(s=!0),m<=(s?f:p))u=Math.max(i.top,Math.min(n.top,i.bottom-h))-t.top,d=Math.min(400,s?f:p);else{c=!0,d=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=h||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let g=(t.bottom-t.top)/a.offsetHeight,_=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/g}px; max-width: ${d/_}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var N=f.define();function pe(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement(`div`);return t.classList.add(`cm-completionIcon`),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>`cm-completionIcon-`+e)),t.setAttribute(`aria-hidden`,`true`),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function P(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.floor((e-t)/n);return{from:e-(r+1)*n,to:e-r*n}}var me=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass=``;let r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet(j);this.optionContent=pe(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=P(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:N.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(j).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:A.of(null)})}),this.showOptions(i,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener(`scroll`,()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;(!n.open||n.open.options!=r)&&(this.range=P(r.length,i,e.state.facet(j).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(` `))e&&this.dom.classList.remove(e);for(let e of t.split(` `))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=P(t.options.length,t.selected,this.view.state.facet(j).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let a=typeof i==`string`?document.createTextNode(i):i(r);if(!a)return;`then`in a?a.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>_(this.view.state,e,`completion info`)):(this.addInfoPane(a,r),n.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&ge(this.list,t),t}measureInfo(){let e=this.dom.querySelector(`[aria-selected]`);if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(j).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0))if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function he(e,t){return n=>new me(n,e,t)}function ge(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function F(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function _e(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet(j);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new oe(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new de(n):new ue(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new oe(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):F(e.completion)>F(c)&&(s[s.length-1]=e),c=e.completion}return s}var ve=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,I(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=_e(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(j).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,I(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:Te,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},ye=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(Ce,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(j),i=(r.override||n.languageDataAt(`autocomplete`,E(n)).map(le)).map(e=>(this.active.find(t=>t.source==e)||new R(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(B));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!be(i,this.active)||o?a=ve.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new R(e.source,0):e));for(let e of t.effects)e.is(N)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?xe:Se}};function be(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var xe={"aria-autocomplete":`list`},Se={};function I(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var Ce=[];function L(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(D);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var R=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=L(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(k))i=new e(i.source,1,n.value);else if(n.is(A))i=new e(i.source,0);else if(n.is(B))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(E(e.state))}},z=class e extends R{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=E(t.state);if(o>a||!r||n&2&&(E(t.startState)==this.from||o<this.limit))return new R(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return we(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new w(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??E(t.state)):new R(this.source,1,this.explicit)}map(t){return t.empty?this:(this.result.map?this.result.map(this.result,t):this.result)?new e(this.source,this.explicit,t.mapPos(this.limit),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new R(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function we(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):se(e,!0).test(i)}var B=f.define({map(e,t){return e.map(e=>e.map(t))}}),V=i.define({create(){return ye.start()},update(e,t){return e.update(t)},provide:e=>[te.from(e,e=>e.tooltip),g.contentAttributes.from(e,e=>e.attrs)]});function H(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(V).active.find(e=>e.source==t.source);return r instanceof z?(typeof n==`string`?e.dispatch({...ce(e.state,n,r.from,r.to),annotations:D.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}var Te=he(V,H);function U(e,t=`option`){return n=>{let r=n.state.field(V,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(j).interactionDelay)return!1;let i=1,a;t==`page`&&(a=v(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector(`li`).offsetHeight)-1));let{length:o}=r.open.options,s=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:o-1;return s<0?s=t==`page`?0:o-1:s>=o&&(s=t==`page`?o-1:0),n.dispatch({effects:N.of(s)}),!0}}var Ee=e=>{let t=e.state.field(V,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(j).interactionDelay?!1:H(e,t.open.options[t.open.selected])},W=e=>e.state.field(V,!1)?(e.dispatch({effects:k.of(!0)}),!0):!1,De=e=>{let t=e.state.field(V,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:A.of(null)}),!0)},Oe=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},ke=50,Ae=1e3,je=p.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(V).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(V),n=e.state.facet(j);if(!e.selectionSet&&!e.docChanged&&e.startState.field(V)==t)return;let r=e.transactions.some(e=>{let t=L(e,n);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>ke&&Date.now()-n.time>Ae){for(let e of n.context.abortListeners)try{e()}catch(e){_(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(k)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let t of e.transactions)t.isUserEvent(`input.type`)?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(V);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(j).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new w(t,E(t),e.explicit,this.view),r=new Oe(e,n);this.running.push(r),Promise.resolve(e.source(n)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:A.of(null)}),_(this.view.state,e)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(j).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(j),n=this.view.state.field(V);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let n=E(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new z(i.active.source,i.active.explicit,r,i.done,i.done.from,i.done.to??n);for(let e of i.updates)a=a.update(e,t);if(a.hasResult()){e.push(a);continue}}let a=n.active.find(e=>e.source==i.active.source);if(a&&a.isPending)if(i.done==null){let n=new R(i.active.source,0);for(let e of i.updates)n=n.update(e,t);n.isPending||e.push(n)}else this.startQuery(a)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:B.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(V,!1);if(t&&t.tooltip&&this.view.state.facet(j).closeOnBlur){let n=t.open&&v(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:A.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:k.of(!1)}),20),this.composing=0}}}),Me=typeof navigator==`object`&&/Win/.test(navigator.platform),Ne=t.highest(g.domEventHandlers({keydown(e,t){let n=t.state.field(V,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Me&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),a=r.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&H(t,r),!1}})),G=g.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),Pe=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},Fe=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,b.TrackDel),r=t.mapPos(this.to,1,b.TrackDel);return n==null||r==null?null:new e(this.field,n,r)}},Ie=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(l);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new Fe(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1,c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new Pe(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},Le=o.widget({widget:new class extends e{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),Re=o.mark({class:`cm-snippetField`}),K=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=o.set(e.map(e=>(e.from==e.to?Le:Re).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},q=f.define({map(e,t){return e&&e.map(t)}}),ze=f.define(),J=i.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(q))return n.value;if(n.is(ze)&&e)return new K(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>g.decorations.from(e,e=>e?e.deco:o.none)});function Y(e,t){return r.create(e.filter(e=>e.field==t).map(e=>r.range(e.from,e.to)))}function Be(e){let t=Ie.parse(e);return(e,n,r,i)=>{let{text:o,ranges:c}=t.instantiate(e.state,r),{main:l}=e.state.selection,u={changes:{from:r,to:i==l.from?l.to:i,insert:a.of(o)},scrollIntoView:!0,annotations:n?[D.of(n),s.userEvent.of(`input.complete`)]:void 0};if(c.length&&(u.selection=Y(c,0)),c.some(e=>e.field>0)){let t=new K(c,0),n=u.effects=[q.of(t)];e.state.field(J,!1)===void 0&&n.push(f.appendConfig.of([J,We,Ke,G]))}e.dispatch(e.state.update(u))}}function Ve(e){return({state:t,dispatch:n})=>{let r=t.field(J,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:Y(r.ranges,i),effects:q.of(a?null:new K(r.ranges,i)),scrollIntoView:!0})),!0}}var He=[{key:`Tab`,run:Ve(1),shift:Ve(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(J,!1)?(t(e.update({effects:q.of(null)})),!0):!1}],Ue=u.define({combine(e){return e.length?e[0]:He}}),We=t.highest(x.compute([Ue],e=>e.facet(Ue)));function Ge(e,t){return{...t,apply:Be(e)}}var Ke=g.domEventHandlers({mousedown(e,t){let n=t.state.field(J,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:Y(n.ranges,i.field),effects:q.of(n.ranges.some(e=>e.field>i.field)?new K(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),X={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},Z=f.define({map(e,t){return t.mapPos(e,-1,b.TrackAfter)??void 0}}),Q=new class extends c{};Q.startSide=1,Q.endSide=-1;var qe=i.define({create(){return y.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(Z)&&(e=e.update({add:[Q.range(n.value,n.value+1)]}));return e}});function Je(){return[$e,qe]}var Ye=`()[]{}<>«»»«[]{}`;function Xe(e){for(let t=0;t<16;t+=2)if(Ye.charCodeAt(t)==e)return Ye.charAt(t+1);return h(e<128?e:e+1)}function Ze(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||X}var Qe=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),$e=g.inputHandler.of((e,t,n,r)=>{if((Qe?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&C(m(r,0))==1||t!=i.from||n!=i.to)return!1;let a=tt(e.state,r);return a?(e.dispatch(a),!0):!1}),et=[{key:`Backspace`,run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Ze(e,e.selection.main.head).brackets||X.brackets,i=null,a=e.changeByRange(t=>{if(t.empty){let i=rt(e.doc,t.head);for(let a of n)if(a==i&&$(e.doc,t.head)==Xe(m(a,0)))return{changes:{from:t.head-a.length,to:t.head+a.length},range:r.cursor(t.head-a.length)}}return{range:i=t}});return i||t(e.update(a,{scrollIntoView:!0,userEvent:`delete.backward`})),!i}}];function tt(e,t){let n=Ze(e,e.selection.main.head),r=n.brackets||X.brackets;for(let i of r){let a=Xe(m(i,0));if(t==i)return a==i?ot(e,i,r.indexOf(i+i+i)>-1,n):it(e,i,a,n.before||X.before);if(t==a&&nt(e,e.selection.main.from))return at(e,i,a)}return null}function nt(e,t){let n=!1;return e.field(qe).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function $(e,t){let n=e.sliceString(t,t+2);return n.slice(0,C(m(n,0)))}function rt(e,t){let n=e.sliceString(t-2,t);return C(m(n,0))==n.length?n:n.slice(1)}function it(e,t,n,i){let a=null,o=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:n,from:o.to}],effects:Z.of(o.to+t.length),range:r.range(o.anchor+t.length,o.head+t.length)};let s=$(e.doc,o.head);return!s||/\s/.test(s)||i.indexOf(s)>-1?{changes:{insert:t+n,from:o.head},effects:Z.of(o.head+t.length),range:r.cursor(o.head+t.length)}:{range:a=o}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function at(e,t,n){let i=null,a=e.changeByRange(t=>t.empty&&$(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:r.cursor(t.head+n.length)}:i={range:t});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function ot(e,t,n,i){let a=i.stringPrefixes||X.stringPrefixes,o=null,s=e.changeByRange(i=>{if(!i.empty)return{changes:[{insert:t,from:i.from},{insert:t,from:i.to}],effects:Z.of(i.to+t.length),range:r.range(i.anchor+t.length,i.head+t.length)};let s=i.head,c=$(e.doc,s),l;if(c==t){if(st(e,s))return{changes:{insert:t+t,from:s},effects:Z.of(s+t.length),range:r.cursor(s+t.length)};if(nt(e,s)){let i=n&&e.sliceDoc(s,s+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:s,to:s+i.length,insert:i},range:r.cursor(s+i.length)}}}else if(n&&e.sliceDoc(s-2*t.length,s)==t+t&&(l=lt(e,s-2*t.length,a))>-1&&st(e,l))return{changes:{insert:t+t+t+t,from:s},effects:Z.of(s+t.length),range:r.cursor(s+t.length)};else if(e.charCategorizer(s)(c)!=S.Word&<(e,s,a)>-1&&!ct(e,s,t,a))return{changes:{insert:t+t,from:s},effects:Z.of(s+t.length),range:r.cursor(s+t.length)};return{range:o=i}});return o?null:e.update(s,{scrollIntoView:!0,userEvent:`input.type`})}function st(e,t){let n=d(e).resolveInner(t+1);return n.parent&&n.from==t}function ct(e,t,n,r){let i=d(e).resolveInner(t,-1),a=r.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+a)),s=o.indexOf(n);if(!s||s>-1&&r.indexOf(o.slice(0,s))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+s;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function lt(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=S.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=S.Word)return n}return-1}function ut(e={}){return[Ne,V,j.of(e),je,ft,G]}var dt=[{key:`Ctrl-Space`,run:W},{mac:"Alt-`",run:W},{mac:`Alt-i`,run:W},{key:`Escape`,run:De},{key:`ArrowDown`,run:U(!0)},{key:`ArrowUp`,run:U(!1)},{key:`PageDown`,run:U(!0,`page`)},{key:`PageUp`,run:U(!1,`page`)},{key:`Enter`,run:Ee}],ft=t.highest(x.computeN([j],e=>e.facet(j).defaultKeymap?[dt]:[]));export{ie as a,Ge as c,et as i,ut as n,dt as o,Je as r,ae as s,w as t};
|