@testmuai/kane-cli 0.7.1 → 0.7.2
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/ChatSurface-E7QKI4LA.js +8 -0
- package/dist/{ChromeProfilePicker-4CDSPBWL.js → ChromeProfilePicker-DGDWGCZD.js} +1 -1
- package/dist/{CliFeedbackPrompt-TLRVBA4E.js → CliFeedbackPrompt-SYCZXSME.js} +1 -1
- package/dist/{CliUploadProgress-WGGFLUSF.js → CliUploadProgress-VDEAKXJY.js} +1 -1
- package/dist/{ConfigView-DBANTBXC.js → ConfigView-HPKRQXMC.js} +1 -1
- package/dist/EvidenceViewOffer-F5YG54OC.js +2 -0
- package/dist/{FolderPicker-W7RCIFEL.js → FolderPicker-4NSDXQY5.js} +1 -1
- package/dist/{HelpView-FBCX32U7.js → HelpView-ON6BFGJM.js} +1 -1
- package/dist/{InfoBox-KK2ICVS4.js → InfoBox-B23NZ6IG.js} +1 -1
- package/dist/{LinksBox-KKRANMR3.js → LinksBox-TI26VFFH.js} +1 -1
- package/dist/{ProfilesView-DGPXSAQN.js → ProfilesView-CRO5AH3H.js} +1 -1
- package/dist/{ProjectPicker-ESQSL4TT.js → ProjectPicker-3N7LJOXU.js} +1 -1
- package/dist/{SaveSessionPrompt-AQGP5W6E.js → SaveSessionPrompt-UTOEC5AW.js} +1 -1
- package/dist/SingleShotApp-Y3YDFQSD.js +2 -0
- package/dist/{SummaryBox-BFZJW2KK.js → SummaryBox-JK64EKC2.js} +1 -1
- package/dist/TestMdRunView-O6JTHV5W.js +2 -0
- package/dist/{WhoamiView-JABY3I5Q.js → WhoamiView-6QSLPNF6.js} +1 -1
- package/dist/{auth-76LVI6B5.js → auth-IKFVW3NX.js} +1 -1
- package/dist/bind-KCUSVJXG.js +12 -0
- package/dist/bootstrap-NFYYRGGR.js +2 -0
- package/dist/bridge-JSKEO4N3.js +2 -0
- package/dist/{changelog-PSWPPOAF.js → changelog-AAH2ZBYO.js} +1 -1
- package/dist/chat-committer-UUC6JTRJ.js +2 -0
- package/dist/chat-controller-T2FAI55V.js +2 -0
- package/dist/{chunk-NAE7MBR2.js → chunk-23VPUWBD.js} +3 -3
- package/dist/chunk-2UIHS2FH.js +2 -0
- package/dist/chunk-2WFZIQ62.js +2 -0
- package/dist/chunk-2WRBTLFN.js +13 -0
- package/dist/chunk-2YEHV2CX.js +2 -0
- package/dist/{chunk-KVQOBPAZ.js → chunk-3Q6WAK6P.js} +1 -1
- package/dist/{chunk-6HEGD6H2.js → chunk-4LTXE3IX.js} +1 -1
- package/dist/{chunk-KT6G7AF2.js → chunk-4NFCAGRK.js} +1 -1
- package/dist/chunk-53IBTIL3.js +12 -0
- package/dist/{chunk-FCMLIK7P.js → chunk-5DBK6QNS.js} +1 -1
- package/dist/chunk-5DT7PIGB.js +5 -0
- package/dist/{chunk-XDHZMCTA.js → chunk-5FJJJNJK.js} +2 -2
- package/dist/{chunk-XVDJ423L.js → chunk-5SXMV66P.js} +1 -1
- package/dist/{chunk-6UJDOAYR.js → chunk-5WXGMXGA.js} +2 -2
- package/dist/chunk-5ZQZOVWY.js +4 -0
- package/dist/{chunk-5KFS3GAZ.js → chunk-6KPPGMO2.js} +1 -1
- package/dist/{chunk-RNSSM2BK.js → chunk-74HTO7K3.js} +1 -1
- package/dist/{chunk-PMHJRT3A.js → chunk-7KORP5FF.js} +1 -1
- package/dist/chunk-7OYZR6JA.js +3 -0
- package/dist/chunk-7QJ75SYR.js +8 -0
- package/dist/{chunk-DXV6MBTD.js → chunk-AECMF3T2.js} +1 -1
- package/dist/{chunk-3LWTUMDG.js → chunk-AFBKGZFG.js} +1 -1
- package/dist/{chunk-AM5S4KG4.js → chunk-AFPHLUQ5.js} +1 -1
- package/dist/chunk-AJ56AMT6.js +9 -0
- package/dist/{chunk-NJPTOKW5.js → chunk-APPYQZFK.js} +1 -1
- package/dist/{chunk-CSQ46PJ7.js → chunk-AXTGYOMK.js} +1 -1
- package/dist/{chunk-HPMS5KO6.js → chunk-B5RS2XZU.js} +2 -2
- package/dist/chunk-BKHXPBWN.js +2 -0
- package/dist/{chunk-SRDHPKJT.js → chunk-BXYWX4J3.js} +1 -1
- package/dist/chunk-C3T7TKAC.js +349 -0
- package/dist/{chunk-JEUA4UWK.js → chunk-CLGC7VEO.js} +1 -1
- package/dist/{chunk-L4JIMNKW.js → chunk-CUM23TLF.js} +1 -1
- package/dist/chunk-DBIBROYW.js +5 -0
- package/dist/chunk-DBKNJRJG.js +2 -0
- package/dist/{chunk-M7WQM4UA.js → chunk-DUAXZYAD.js} +1 -1
- package/dist/chunk-DZPGG4S6.js +7 -0
- package/dist/{chunk-2KBD6JZX.js → chunk-EOLFTMWF.js} +1 -1
- package/dist/{chunk-2XGDWUJ5.js → chunk-F7ISS545.js} +1 -1
- package/dist/{chunk-JKTFTF24.js → chunk-FBHRBFHP.js} +1 -1
- package/dist/{chunk-L7VREJTG.js → chunk-FDIPQRX4.js} +1 -1
- package/dist/{chunk-AAONIIQV.js → chunk-GFKCTYCA.js} +1 -1
- package/dist/{chunk-73C4PRYU.js → chunk-GYNTNKNB.js} +1 -1
- package/dist/{chunk-KNDSQ4PS.js → chunk-H32GM5G4.js} +1 -1
- package/dist/{chunk-323MLBYA.js → chunk-HYSFJSIG.js} +1 -1
- package/dist/chunk-I7TIGB7K.js +2 -0
- package/dist/chunk-IDX3TOPY.js +6 -0
- package/dist/{chunk-CVOGP253.js → chunk-IMR64OCZ.js} +1 -1
- package/dist/{chunk-IBNC444G.js → chunk-IOD3HQVW.js} +1 -1
- package/dist/{chunk-URQUQWGW.js → chunk-J5FBU425.js} +40 -40
- package/dist/chunk-JKM2PUHI.js +4 -0
- package/dist/{chunk-ZM5PVRJK.js → chunk-JPWLGHPM.js} +1 -1
- package/dist/{chunk-5JTUL6XL.js → chunk-JZ26R6UL.js} +1 -1
- package/dist/chunk-KBM3XHAM.js +2 -0
- package/dist/{chunk-SY3HLQMV.js → chunk-KCCSWEGA.js} +1 -1
- package/dist/{chunk-APAIWBIH.js → chunk-KQZA2QSC.js} +1 -1
- package/dist/{chunk-X3ICV5M5.js → chunk-KWIK22R6.js} +1 -1
- package/dist/{chunk-33QXD75Y.js → chunk-M6FKJKC6.js} +2 -2
- package/dist/{chunk-IXVOXJP6.js → chunk-MK7JUOYV.js} +1 -1
- package/dist/chunk-N2P4MI32.js +2 -0
- package/dist/{chunk-JRMDGLLT.js → chunk-O75ZHGJG.js} +1 -1
- package/dist/chunk-OR6MCL6Z.js +2 -0
- package/dist/chunk-ORQNKZ2Z.js +5 -0
- package/dist/{chunk-QROUKGKU.js → chunk-OS4VSIHT.js} +1 -1
- package/dist/{chunk-UI7KULSI.js → chunk-OUJQVBUT.js} +3 -3
- package/dist/{chunk-UBFKZEX3.js → chunk-PLOWZLG5.js} +1 -1
- package/dist/chunk-QIGPXYMF.js +19 -0
- package/dist/chunk-QOFZSHSC.js +47 -0
- package/dist/{chunk-2XMJ6YAE.js → chunk-R5T4RLF5.js} +1 -1
- package/dist/chunk-R7QAS6LZ.js +4 -0
- package/dist/{chunk-CDQX6HGJ.js → chunk-RDNFVZEB.js} +1 -1
- package/dist/{chunk-NRTHYROA.js → chunk-SFII7HPP.js} +1 -1
- package/dist/{chunk-3FN5VJMV.js → chunk-SL6PCVM2.js} +1 -1
- package/dist/{chunk-LQZ2BU7Q.js → chunk-STVP2XHO.js} +1 -1
- package/dist/chunk-TH47OOBV.js +4 -0
- package/dist/{chunk-OHRS3H7Z.js → chunk-TRJUD3XJ.js} +1 -1
- package/dist/{chunk-BAL64WSI.js → chunk-UC7MNPIN.js} +1 -1
- package/dist/chunk-UD7KKHPW.js +5 -0
- package/dist/chunk-VAYBKR76.js +4 -0
- package/dist/chunk-VFII6C46.js +2 -0
- package/dist/{chunk-R2RGSO4B.js → chunk-VHZ4S57N.js} +1 -1
- package/dist/{chunk-WJ5HDEVH.js → chunk-VLWMMOMF.js} +1 -1
- package/dist/chunk-VMM4LC4V.js +10 -0
- package/dist/{chunk-322JEJEH.js → chunk-VOOPWFHW.js} +1 -1
- package/dist/{chunk-4OPQJ7PE.js → chunk-VRLUNZAK.js} +1 -1
- package/dist/{chunk-AH7ZZIZY.js → chunk-VRVFPMCR.js} +1 -1
- package/dist/{chunk-F6ZOJXYU.js → chunk-VT54ARGE.js} +1 -1
- package/dist/{chunk-NBKQT7LJ.js → chunk-VWKVUOXU.js} +1 -1
- package/dist/chunk-W4B5LOEX.js +4 -0
- package/dist/{chunk-36OC3TFE.js → chunk-W5TTF7GB.js} +2 -2
- package/dist/chunk-WXHQYYD5.js +2 -0
- package/dist/{chunk-NOCIMJSN.js → chunk-XUS4WKDS.js} +1 -1
- package/dist/chunk-XWKUZJCP.js +2 -0
- package/dist/chunk-YTHQNN2L.js +3 -0
- package/dist/{chunk-V36ATG7A.js → chunk-ZBOWFJB2.js} +2 -2
- package/dist/chunk-ZMNJBUAO.js +2 -0
- package/dist/{chunk-LR5XO2KD.js → chunk-ZRASQ63J.js} +1 -1
- package/dist/{chunk-C4G7RVJ6.js → chunk-ZUGCHQFC.js} +1 -1
- package/dist/committer-SWEWEYNX.js +2 -0
- package/dist/{config-R3GF2FZA.js → config-CWZV6XPT.js} +1 -1
- package/dist/{cover-cmd-TXICWHUU.js → cover-cmd-NWIRJY5Z.js} +1 -1
- package/dist/{credentials-XN4ROCQ3.js → credentials-YHTJGKEO.js} +1 -1
- package/dist/descriptor-OEUZZCOK.js +2 -0
- package/dist/design-committer-VYT6NU3T.js +2 -0
- package/dist/dispatch-WVNXB7AD.js +2 -0
- package/dist/docx-convert-CHLJUTFH.js +2 -0
- package/dist/{dossier-QZV74XOS.js → dossier-KTLTGT2X.js} +1 -1
- package/dist/{evidence-V23FPVXQ.js → evidence-IVDNXWPL.js} +1 -1
- package/dist/evolve-cmd-XBX4SX5H.js +2 -0
- package/dist/{exit-manager-HNFATGSM.js → exit-manager-XZL4KIJU.js} +1 -1
- package/dist/explain-UAAQWHYR.js +2 -0
- package/dist/{explain-cmd-RZW6QJYM.js → explain-cmd-75MCF2ZV.js} +1 -1
- package/dist/{explain-cmd-X7JZLSZZ.js → explain-cmd-IZEHWZV5.js} +1 -1
- package/dist/extract-bind-5OWELRME.js +10 -0
- package/dist/extract-cmd-ZRYMJ6IC.js +5 -0
- package/dist/feeder-C3TOJPKK.js +2 -0
- package/dist/{gaps-cmd-BWCRLLBK.js → gaps-cmd-XBRXKXDL.js} +1 -1
- package/dist/{gate-YHBPWEM5.js → gate-54BRAE7N.js} +1 -1
- package/dist/{generate-headless-BSTDLZZY.js → generate-headless-D6BISWDC.js} +2 -2
- package/dist/{headless-io-BL3TEAX5.js → headless-io-66RG5NN5.js} +1 -1
- package/dist/identity-ADZ4PAJF.js +2 -0
- package/dist/index.js +43 -43
- package/dist/ingest-EX72IEQT.js +2 -0
- package/dist/ingest-cmd-YTGOICTC.js +2 -0
- package/dist/{interactive-bind-43HGDF5K.js → interactive-bind-XSRD36MO.js} +7 -6
- package/dist/{lifecycle-cmd-D6TVTYRK.js → lifecycle-cmd-EQSFAZG6.js} +1 -1
- package/dist/{list-cmd-XCAV2FKA.js → list-cmd-IRJSUCM5.js} +1 -1
- package/dist/{list-commands-747UTUSS.js → list-commands-RCYHJ5Y3.js} +1 -1
- package/dist/locks-cmd-CSVSWY2Y.js +2 -0
- package/dist/logical-ids-TEBCQJGO.js +2 -0
- package/dist/login-flow-PYAPYCPY.js +2 -0
- package/dist/maintenance-cmd-MVFA6H74.js +2 -0
- package/dist/pdf-convert-OZIRUADA.js +2 -0
- package/dist/{persist-recorded-session-MDPWWUA7.js → persist-recorded-session-DTYCLXTQ.js} +1 -1
- package/dist/phase-seed-DIRETNU6.js +2 -0
- package/dist/pipeline-MXFOD6ES.js +2 -0
- package/dist/readmodel-XOYGGQ3S.js +2 -0
- package/dist/reconcile-cmd-EG6BOU3A.js +2 -0
- package/dist/reconcile-deps-HTT6IPHT.js +4 -0
- package/dist/reconcile-engine-JQNXALNY.js +2 -0
- package/dist/{recording-banner-TALO7PUR.js → recording-banner-76GCIPUN.js} +1 -1
- package/dist/records-IOZTZUZV.js +2 -0
- package/dist/{require-project-folder-R347LFDQ.js → require-project-folder-ACRDP5ZB.js} +1 -1
- package/dist/{resolver-IDCGRPFJ.js → resolver-SRPCFW7P.js} +1 -1
- package/dist/revert-NQ7GEVSE.js +2 -0
- package/dist/review-cmd-L3V5UP5T.js +4 -0
- package/dist/run-GMZCDRDD.js +2 -0
- package/dist/run-TFRWPGXP.js +2 -0
- package/dist/run-channel-RGH4WIQX.js +2 -0
- package/dist/{run-test-md-DFNIGYB7.js → run-test-md-KEHSRMCM.js} +2 -2
- package/dist/sessions-GIEXOCE4.js +2 -0
- package/dist/{sessions-cmd-AQWLL5ZN.js → sessions-cmd-ZVYGSRJ3.js} +4 -4
- package/dist/{skill-installer-ANXTCXQV.js → skill-installer-HBN3A35K.js} +1 -1
- package/dist/spawner-GC5CFAJ7.js +2 -0
- package/dist/structured-answers-A43Q25CZ.js +5 -0
- package/dist/tcg-generate-V7YFNC5O.js +2 -0
- package/dist/testmd-actions-MNDOO76O.js +2 -0
- package/dist/token-refresh-3UYMCYG3.js +2 -0
- package/dist/{validate-basic-O2DP2XJL.js → validate-basic-ZGWPBYB6.js} +1 -1
- package/dist/verdicts-SCETLY5J.js +2 -0
- package/dist/{version-check-RNR3JCQ5.js → version-check-CJWKDAXV.js} +1 -1
- package/dist/{view-cmd-YSEGA5PI.js → view-cmd-SOVM64L2.js} +1 -1
- package/dist/walk-session-YUYRULPY.js +2 -0
- package/dist/with-telemetry-E7QWPGL6.js +2 -0
- package/package.json +6 -6
- package/dist/ChatSurface-D66CACLX.js +0 -8
- package/dist/EvidenceViewOffer-DNCQ3A6R.js +0 -2
- package/dist/SingleShotApp-SMCAIKCE.js +0 -2
- package/dist/TestMdRunView-FMKZJ3A3.js +0 -2
- package/dist/bind-AACBTSAA.js +0 -12
- package/dist/bootstrap-CNOZ5VRB.js +0 -2
- package/dist/bridge-T4HL4TG7.js +0 -2
- package/dist/chat-committer-4BQBOKI4.js +0 -2
- package/dist/chat-controller-NNTMKEPG.js +0 -2
- package/dist/chunk-2SREGETM.js +0 -4
- package/dist/chunk-3STZLM5J.js +0 -4
- package/dist/chunk-5YPBPZUR.js +0 -2
- package/dist/chunk-BQHKBOSF.js +0 -11
- package/dist/chunk-DQ54MH7F.js +0 -13
- package/dist/chunk-EV3EHXEI.js +0 -4
- package/dist/chunk-F7WKDMX7.js +0 -47
- package/dist/chunk-FPFOW6BS.js +0 -2
- package/dist/chunk-GVIPTX6T.js +0 -6
- package/dist/chunk-GW5DWAXY.js +0 -2
- package/dist/chunk-HJERKSBK.js +0 -349
- package/dist/chunk-IQDWBTRJ.js +0 -3
- package/dist/chunk-KRXSXQBU.js +0 -12
- package/dist/chunk-NAC7SFBE.js +0 -5
- package/dist/chunk-NRC2G4Y5.js +0 -5
- package/dist/chunk-O56PUUNL.js +0 -9
- package/dist/chunk-QM4S2APK.js +0 -2
- package/dist/chunk-SE6WNCYU.js +0 -4
- package/dist/chunk-SWESH2J7.js +0 -10
- package/dist/chunk-T63R6QT4.js +0 -4
- package/dist/chunk-UPPEOQJQ.js +0 -3
- package/dist/chunk-UX2B7L6K.js +0 -2
- package/dist/chunk-VOHQA2SP.js +0 -2
- package/dist/chunk-W5DOU2DV.js +0 -2
- package/dist/chunk-W6VD2XFO.js +0 -19
- package/dist/chunk-WWNSD6FA.js +0 -6
- package/dist/chunk-ZLCZDAEX.js +0 -6
- package/dist/committer-2EJPVVCQ.js +0 -2
- package/dist/descriptor-KXDJ4XYD.js +0 -2
- package/dist/design-committer-BQUWD6AC.js +0 -2
- package/dist/docx-convert-ZBVQO2LG.js +0 -2
- package/dist/evolve-cmd-PZCPXDMR.js +0 -2
- package/dist/explain-UE4IACQH.js +0 -2
- package/dist/extract-bind-BFY7IRL4.js +0 -10
- package/dist/extract-cmd-U3MGK2LP.js +0 -6
- package/dist/feeder-XGTFV7TZ.js +0 -2
- package/dist/ingest-AL6CABJT.js +0 -2
- package/dist/ingest-cmd-O6OWWZT4.js +0 -2
- package/dist/locks-cmd-QAULI5LV.js +0 -2
- package/dist/logical-ids-4G4FAHNJ.js +0 -2
- package/dist/login-flow-CV76ENHV.js +0 -2
- package/dist/maintenance-cmd-ZRB4NTGG.js +0 -2
- package/dist/pdf-convert-S7VYE6AV.js +0 -2
- package/dist/phase-seed-52LRE3LH.js +0 -2
- package/dist/pipeline-LM5JAK7F.js +0 -2
- package/dist/readmodel-X7L7W2BA.js +0 -2
- package/dist/reconcile-cmd-DGCSDML6.js +0 -2
- package/dist/records-5SVUXJBW.js +0 -2
- package/dist/revert-DXXYXJGN.js +0 -2
- package/dist/review-cmd-2QF5HTI7.js +0 -4
- package/dist/run-52UIBPXD.js +0 -2
- package/dist/run-VRVH4VO3.js +0 -2
- package/dist/sessions-BLXZVK5U.js +0 -2
- package/dist/spawner-AH5FTUYU.js +0 -2
- package/dist/structured-answers-QHFGZPSS.js +0 -5
- package/dist/tcg-generate-WKCBBKI5.js +0 -2
- package/dist/testmd-actions-RPYG6TJG.js +0 -2
- package/dist/token-refresh-NIDUOTRM.js +0 -2
- package/dist/verdicts-TJH3O5UW.js +0 -2
- package/dist/walk-session-HXW4OSA2.js +0 -2
- package/dist/with-telemetry-PNP6CAVM.js +0 -2
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as De}from"./chunk-BKHXPBWN.js";import{a as we,b as Ae}from"./chunk-2UIHS2FH.js";import{a as Ee}from"./chunk-N2P4MI32.js";import{b as Ce}from"./chunk-NVGBE2DR.js";import{c as _t,e as xe}from"./chunk-UR6MHSHU.js";var Oe=_t(D=>{"use strict";Object.defineProperty(D,"__esModule",{value:!0});D.CHAR=`
|
|
3
|
+
\r -\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}`;D.S=` \r
|
|
4
|
+
`;D.NAME_START_CHAR=":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";D.NAME_CHAR="-"+D.NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";D.CHAR_RE=new RegExp("^["+D.CHAR+"]$","u");D.S_RE=new RegExp("^["+D.S+"]+$","u");D.NAME_START_CHAR_RE=new RegExp("^["+D.NAME_START_CHAR+"]$","u");D.NAME_CHAR_RE=new RegExp("^["+D.NAME_CHAR+"]$","u");D.NAME_RE=new RegExp("^["+D.NAME_START_CHAR+"]["+D.NAME_CHAR+"]*$","u");D.NMTOKEN_RE=new RegExp("^["+D.NAME_CHAR+"]+$","u");var Ut=9,Ht=10,Wt=13,Vt=32;D.S_LIST=[Vt,Ht,Wt,Ut];function zi(e){return e>=Vt&&e<=55295||e===Ht||e===Wt||e===Ut||e>=57344&&e<=65533||e>=65536&&e<=1114111}D.isChar=zi;function Ui(e){return e===Vt||e===Ht||e===Wt||e===Ut}D.isS=Ui;function ke(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}D.isNameStartChar=ke;function Hi(e){return ke(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}D.isNameChar=Hi});var Xe=_t(x=>{"use strict";Object.defineProperty(x,"__esModule",{value:!0});x.CHAR="-\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}";x.RESTRICTED_CHAR="-\b\v\f-\x7F-\x84\x86-\x9F";x.S=` \r
|
|
5
|
+
`;x.NAME_START_CHAR=":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";x.NAME_CHAR="-"+x.NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";x.CHAR_RE=new RegExp("^["+x.CHAR+"]$","u");x.RESTRICTED_CHAR_RE=new RegExp("^["+x.RESTRICTED_CHAR+"]$","u");x.S_RE=new RegExp("^["+x.S+"]+$","u");x.NAME_START_CHAR_RE=new RegExp("^["+x.NAME_START_CHAR+"]$","u");x.NAME_CHAR_RE=new RegExp("^["+x.NAME_CHAR+"]$","u");x.NAME_RE=new RegExp("^["+x.NAME_START_CHAR+"]["+x.NAME_CHAR+"]*$","u");x.NMTOKEN_RE=new RegExp("^["+x.NAME_CHAR+"]+$","u");var Me=9,Ie=10,Pe=13,Be=32;x.S_LIST=[Be,Ie,Pe,Me];function Wi(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}x.isChar=Wi;function Vi(e){return e>=1&&e<=8||e===11||e===12||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159}x.isRestrictedChar=Vi;function Gi(e){return e===9||e===10||e===13||e>31&&e<127||e===133||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}x.isCharAndNotRestricted=Gi;function qi(e){return e===Be||e===Ie||e===Pe||e===Me}x.isS=qi;function Le(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}x.isNameStartChar=Le;function ji(e){return Le(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}x.isNameChar=ji});var ze=_t(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.NC_NAME_START_CHAR="A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";k.NC_NAME_CHAR="-"+k.NC_NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";k.NC_NAME_START_CHAR_RE=new RegExp("^["+k.NC_NAME_START_CHAR+"]$","u");k.NC_NAME_CHAR_RE=new RegExp("^["+k.NC_NAME_CHAR+"]$","u");k.NC_NAME_RE=new RegExp("^["+k.NC_NAME_START_CHAR+"]["+k.NC_NAME_CHAR+"]*$","u");function $e(e){return e>=65&&e<=90||e===95||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}k.isNCNameStartChar=$e;function Zi(e){return $e(e)||e===45||e===46||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256}k.isNCNameChar=Zi});var ae=_t(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.SaxesParser=ot.EVENTS=void 0;var ht=Oe(),Yi=Xe(),re=ze(),O=ht.isS,Qi=ht.isChar,vt=ht.isNameStartChar,Ue=ht.isNameChar,ii=ht.S_LIST,Ki=ht.NAME_RE,Ji=Yi.isChar,tn=re.isNCNameStartChar,en=re.isNCNameChar,nn=re.NC_NAME_RE,Nt="http://www.w3.org/XML/1998/namespace",at="http://www.w3.org/2000/xmlns/",sn={__proto__:null,xml:Nt,xmlns:at},rn={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},A=-1,X=-2,He=0,an=1,Gt=2,on=3,nt=4,hn=5,ln=6,un=7,qt=8,fn=9,cn=10,pn=11,dn=12,R=13,Tt=14,jt=15,gn=16,Zt=17,mn=18,vn=19,Yt=20,xn=21,Cn=22,En=23,We=24,Qt=25,bt=26,Ve=27,Dn=28,wn=29,Ge=30,An=31,_n=32,q=33,Tn=34,Kt=35,xt=36,Jt=37,bn=38,qe=39,je=40,yn=41,Ze=42,Fn=43,Sn=44,te=9,L=10,ee=13,Ye=32,Qe=33,ni=34,Ct=38,si=39,yt=45,Ft=47,Nn=59,W=60,st=61,_=62,y=63,ri=91,rt=93,Ke=133,Je=8232,St=e=>e===ni||e===si,ai=[ni,si],Rn=[...ai,ri,_],kn=[...ai,W,rt],On=[st,y,...ii],Mn=[...ii,_,Ct,W];function ne(e,t,i){switch(t){case"xml":i!==Nt&&e.fail(`xml prefix must be bound to ${Nt}.`);break;case"xmlns":i!==at&&e.fail(`xmlns prefix must be bound to ${at}.`);break;default:}switch(i){case at:e.fail(t===""?`the default namespace may not be set to ${i}.`:`may not assign a prefix (even "xmlns") to the URI ${at}.`);break;case Nt:switch(t){case"xml":break;case"":e.fail(`the default namespace may not be set to ${i}.`);break;default:e.fail("may not assign the xml namespace to another prefix.")}break;default:}}function In(e,t){for(let i of Object.keys(t))ne(e,i,t[i])}var Pn=e=>nn.test(e),Bn=e=>Ki.test(e),j=0,ti=1,ie=2;ot.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var ei={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"},se=class{constructor(t){this.opt=t??{},this.fragmentOpt=!!this.opt.fragment;let i=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,i){this.nameStartCheck=tn,this.nameCheck=en,this.isName=Pn,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},sn);let n=this.opt.additionalNamespaces;n!=null&&(In(this,n),Object.assign(this.ns,n))}else this.nameStartCheck=vt,this.nameCheck=Ue,this.isName=Bn,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}get closed(){return this._closed}_init(){var t;this.openWakaBang="",this.text="",this.name="",this.piTarget="",this.entity="",this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk="",this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=j,this.attribList=[];let{fragmentOpt:i}=this;this.state=i?R:He,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=i,this.xmlDeclPossible=!i,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:n}=this.opt;if(n===void 0){if(this.opt.forceXMLVersion===!0)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");n="1.0"}this.setXMLVersion(n),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(rn),(t=this.readyHandler)===null||t===void 0||t.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(t,i){this[ei[t]]=i}off(t){this[ei[t]]=void 0}makeError(t){var i;let n=(i=this.fileName)!==null&&i!==void 0?i:"";return this.trackPosition&&(n.length>0&&(n+=":"),n+=`${this.line}:${this.column}`),n.length>0&&(n+=": "),new Error(n+t)}fail(t){let i=this.makeError(t),n=this.errorHandler;if(n===void 0)throw i;return n(i),this}write(t){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let i=!1;t===null?(i=!0,t=""):typeof t=="object"&&(t=t.toString()),this.carriedFromPrevious!==void 0&&(t=`${this.carriedFromPrevious}${t}`,this.carriedFromPrevious=void 0);let n=t.length,s=t.charCodeAt(n-1);!i&&(s===ee||s>=55296&&s<=56319)&&(this.carriedFromPrevious=t[n-1],n--,t=t.slice(0,n));let{stateTable:a}=this;for(this.chunk=t,this.i=0;this.i<n;)a[this.state].call(this);return this.chunkPosition+=n,i?this.end():this}close(){return this.write(null)}getCode10(){let{chunk:t,i}=this;if(this.prevI=i,this.i=i+1,i>=t.length)return A;let n=t.charCodeAt(i);if(this.column++,n<55296){if(n>=Ye||n===te)return n;switch(n){case L:return this.line++,this.column=0,this.positionAtNewLine=this.position,L;case ee:return t.charCodeAt(i+1)===L&&(this.i=i+2),this.line++,this.column=0,this.positionAtNewLine=this.position,X;default:return this.fail("disallowed character."),n}}if(n>56319)return n>=57344&&n<=65533||this.fail("disallowed character."),n;let s=65536+(n-55296)*1024+(t.charCodeAt(i+1)-56320);return this.i=i+2,s>1114111&&this.fail("disallowed character."),s}getCode11(){let{chunk:t,i}=this;if(this.prevI=i,this.i=i+1,i>=t.length)return A;let n=t.charCodeAt(i);if(this.column++,n<55296){if(n>31&&n<127||n>159&&n!==Je||n===te)return n;switch(n){case L:return this.line++,this.column=0,this.positionAtNewLine=this.position,L;case ee:{let a=t.charCodeAt(i+1);(a===L||a===Ke)&&(this.i=i+2)}case Ke:case Je:return this.line++,this.column=0,this.positionAtNewLine=this.position,X;default:return this.fail("disallowed character."),n}}if(n>56319)return n>=57344&&n<=65533||this.fail("disallowed character."),n;let s=65536+(n-55296)*1024+(t.charCodeAt(i+1)-56320);return this.i=i+2,s>1114111&&this.fail("disallowed character."),s}getCodeNorm(){let t=this.getCode();return t===X?L:t}unget(){this.i=this.prevI,this.column--}captureTo(t){let{i}=this,{chunk:n}=this;for(;;){let s=this.getCode(),a=s===X,o=a?L:s;if(o===A||t.includes(o))return this.text+=n.slice(i,this.prevI),o;a&&(this.text+=`${n.slice(i,this.prevI)}
|
|
6
|
+
`,i=this.i)}}captureToChar(t){let{i}=this,{chunk:n}=this;for(;;){let s=this.getCode();switch(s){case X:this.text+=`${n.slice(i,this.prevI)}
|
|
7
|
+
`,i=this.i,s=L;break;case A:return this.text+=n.slice(i),!1;default:}if(s===t)return this.text+=n.slice(i,this.prevI),!0}}captureNameChars(){let{chunk:t,i}=this;for(;;){let n=this.getCode();if(n===A)return this.name+=t.slice(i),A;if(!Ue(n))return this.name+=t.slice(i,this.prevI),n===X?L:n}}skipSpaces(){for(;;){let t=this.getCodeNorm();if(t===A||!O(t))return t}}setXMLVersion(t){this.currentXMLVersion=t,t==="1.0"?(this.isChar=Qi,this.getCode=this.getCode10):(this.isChar=Ji,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=an}sBeginWhitespace(){let t=this.i,i=this.skipSpaces();switch(this.prevI!==t&&(this.xmlDeclPossible=!1),i){case W:if(this.state=jt,this.text.length!==0)throw new Error("no-empty text at start");break;case A:break;default:this.unget(),this.state=R,this.xmlDeclPossible=!1}}sDoctype(){var t;let i=this.captureTo(Rn);switch(i){case _:{(t=this.doctypeHandler)===null||t===void 0||t.call(this,this.text),this.text="",this.state=R,this.doctype=!0;break}case A:break;default:this.text+=String.fromCodePoint(i),i===ri?this.state=nt:St(i)&&(this.state=on,this.q=i)}}sDoctypeQuote(){let t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.q=null,this.state=Gt)}sDTD(){let t=this.captureTo(kn);t!==A&&(this.text+=String.fromCodePoint(t),t===rt?this.state=Gt:t===W?this.state=ln:St(t)&&(this.state=hn,this.q=t))}sDTDQuoted(){let t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.state=nt,this.q=null)}sDTDOpenWaka(){let t=this.getCodeNorm();switch(this.text+=String.fromCodePoint(t),t){case Qe:this.state=un,this.openWakaBang="";break;case y:this.state=pn;break;default:this.state=nt}}sDTDOpenWakaBang(){let t=String.fromCodePoint(this.getCodeNorm()),i=this.openWakaBang+=t;this.text+=t,i!=="-"&&(this.state=i==="--"?qt:nt,this.openWakaBang="")}sDTDComment(){this.captureToChar(yt)&&(this.text+="-",this.state=fn)}sDTDCommentEnding(){let t=this.getCodeNorm();this.text+=String.fromCodePoint(t),this.state=t===yt?cn:qt}sDTDCommentEnded(){let t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===_?this.state=nt:(this.fail("malformed comment."),this.state=qt)}sDTDPI(){this.captureToChar(y)&&(this.text+="?",this.state=dn)}sDTDPIEnding(){let t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===_&&(this.state=nt)}sText(){this.tags.length!==0?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:t}=this,{chunk:i}=this;t:for(;;)switch(this.getCode()){case X:this.entity+=`${i.slice(t,this.prevI)}
|
|
8
|
+
`,t=this.i;break;case Nn:{let{entityReturnState:n}=this,s=this.entity+i.slice(t,this.prevI);this.state=n;let a;s===""?(this.fail("empty entity name."),a="&;"):(a=this.parseEntity(s),this.entity=""),(n!==R||this.textHandler!==void 0)&&(this.text+=a);break t}case A:this.entity+=i.slice(t);break t;default:}}sOpenWaka(){let t=this.getCode();if(vt(t))this.state=Tn,this.unget(),this.xmlDeclPossible=!1;else switch(t){case Ft:this.state=Fn,this.xmlDeclPossible=!1;break;case Qe:this.state=gn,this.openWakaBang="",this.xmlDeclPossible=!1;break;case y:this.state=En;break;default:this.fail("disallowed character in tag name"),this.state=R,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0),this.state=Yt,this.openWakaBang="";break;case"--":this.state=Zt,this.openWakaBang="";break;case"DOCTYPE":this.state=Gt,(this.doctype||this.sawRoot)&&this.fail("inappropriately located doctype declaration."),this.openWakaBang="";break;default:this.openWakaBang.length>=7&&this.fail("incorrect syntax.")}}sComment(){this.captureToChar(yt)&&(this.state=mn)}sCommentEnding(){var t;let i=this.getCodeNorm();i===yt?(this.state=vn,(t=this.commentHandler)===null||t===void 0||t.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(i)}`,this.state=Zt)}sCommentEnded(){let t=this.getCodeNorm();t!==_?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(t)}`,this.state=Zt):this.state=R}sCData(){this.captureToChar(rt)&&(this.state=xn)}sCDataEnding(){let t=this.getCodeNorm();t===rt?this.state=Cn:(this.text+=`]${String.fromCodePoint(t)}`,this.state=Yt)}sCDataEnding2(){var t;let i=this.getCodeNorm();switch(i){case _:{(t=this.cdataHandler)===null||t===void 0||t.call(this,this.text),this.text="",this.state=R;break}case rt:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(i)}`,this.state=Yt}}sPIFirstChar(){let t=this.getCodeNorm();this.nameStartCheck(t)?(this.piTarget+=String.fromCodePoint(t),this.state=We):t===y||O(t)?(this.fail("processing instruction without a target."),this.state=t===y?bt:Qt):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(t),this.state=We)}sPIRest(){let{chunk:t,i}=this;for(;;){let n=this.getCodeNorm();if(n===A){this.piTarget+=t.slice(i);return}if(!this.nameCheck(n)){this.piTarget+=t.slice(i,this.prevI);let s=n===y;s||O(n)?this.piTarget==="xml"?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=s?q:Ve):this.state=s?bt:Qt:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(n));break}}}sPIBody(){if(this.text.length===0){let t=this.getCodeNorm();t===y?this.state=bt:O(t)||(this.text=String.fromCodePoint(t))}else this.captureToChar(y)&&(this.state=bt)}sPIEnding(){var t;let i=this.getCodeNorm();if(i===_){let{piTarget:n}=this;n.toLowerCase()==="xml"&&this.fail("the XML declaration must appear at the start of the document."),(t=this.piHandler)===null||t===void 0||t.call(this,{target:n,body:this.text}),this.piTarget=this.text="",this.state=R}else i===y?this.text+="?":(this.text+=`?${String.fromCodePoint(i)}`,this.state=Qt);this.xmlDeclPossible=!1}sXMLDeclNameStart(){let t=this.skipSpaces();if(t===y){this.state=q;return}t!==A&&(this.state=Dn,this.name=String.fromCodePoint(t))}sXMLDeclName(){let t=this.captureTo(On);if(t===y){this.state=q,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(O(t)||t===st){if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=t===st?Ge:wn}}sXMLDeclEq(){let t=this.getCodeNorm();if(t===y){this.state=q,this.fail("XML declaration is incomplete.");return}O(t)||(t!==st&&this.fail("value required."),this.state=Ge)}sXMLDeclValueStart(){let t=this.getCodeNorm();if(t===y){this.state=q,this.fail("XML declaration is incomplete.");return}O(t)||(St(t)?this.q=t:(this.fail("value must be quoted."),this.q=Ye),this.state=An)}sXMLDeclValue(){let t=this.captureTo([this.q,y]);if(t===y){this.state=q,this.text="",this.fail("XML declaration is incomplete.");return}if(t===A)return;let i=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let n=i;this.xmlDecl.version=n,/^1\.[0-9]+$/.test(n)?this.opt.forceXMLVersion||this.setXMLVersion(n):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(i)||this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=i;break;case"standalone":i!=="yes"&&i!=="no"&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=i;break;default:}this.name="",this.state=_n}sXMLDeclSeparator(){let t=this.getCodeNorm();if(t===y){this.state=q;return}O(t)||(this.fail("whitespace required."),this.unget()),this.state=Ve}sXMLDeclEnding(){var t;this.getCodeNorm()===_?(this.piTarget!=="xml"?this.fail("processing instructions are not allowed before root."):this.name!=="version"&&this.xmlDeclExpects.includes("version")&&this.fail("XML declaration must contain a version."),(t=this.xmldeclHandler)===null||t===void 0||t.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=R):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var t;let i=this.captureNameChars();if(i===A)return;let n=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=n.ns=Object.create(null)),(t=this.openTagStartHandler)===null||t===void 0||t.call(this,n),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),i){case _:this.openTag();break;case Ft:this.state=Kt;break;default:O(i)||this.fail("disallowed character in tag name."),this.state=xt}}sOpenTagSlash(){this.getCode()===_?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=xt)}sAttrib(){let t=this.skipSpaces();t!==A&&(vt(t)?(this.unget(),this.state=Jt):t===_?this.openTag():t===Ft?this.state=Kt:this.fail("disallowed character in attribute name."))}sAttribName(){let t=this.captureNameChars();t===st?this.state=qe:O(t)?this.state=bn:t===_?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):t!==A&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){let t=this.skipSpaces();switch(t){case A:return;case st:this.state=qe;break;default:this.fail("attribute without value."),this.text="",this.name="",t===_?this.openTag():vt(t)?(this.unget(),this.state=Jt):(this.fail("disallowed character in attribute name."),this.state=xt)}}sAttribValue(){let t=this.getCodeNorm();St(t)?(this.q=t,this.state=je):O(t)||(this.fail("unquoted attribute value."),this.state=Ze,this.unget())}sAttribValueQuoted(){let{q:t,chunk:i}=this,{i:n}=this;for(;;)switch(this.getCode()){case t:this.pushAttrib(this.name,this.text+i.slice(n,this.prevI)),this.name=this.text="",this.q=null,this.state=yn;return;case Ct:this.text+=i.slice(n,this.prevI),this.state=Tt,this.entityReturnState=je;return;case L:case X:case te:this.text+=`${i.slice(n,this.prevI)} `,n=this.i;break;case W:this.text+=i.slice(n,this.prevI),this.fail("disallowed character.");return;case A:this.text+=i.slice(n);return;default:}}sAttribValueClosed(){let t=this.getCodeNorm();O(t)?this.state=xt:t===_?this.openTag():t===Ft?this.state=Kt:vt(t)?(this.fail("no whitespace between attributes."),this.unget(),this.state=Jt):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){let t=this.captureTo(Mn);switch(t){case Ct:this.state=Tt,this.entityReturnState=Ze;break;case W:this.fail("disallowed character.");break;case A:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",t===_?this.openTag():this.state=xt}}sCloseTag(){let t=this.captureNameChars();t===_?this.closeTag():O(t)?this.state=Sn:t!==A&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case _:this.closeTag();break;case A:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:t,forbiddenState:i}=this,{chunk:n,textHandler:s}=this;t:for(;;)switch(this.getCode()){case W:{if(this.state=jt,s!==void 0){let{text:a}=this,o=n.slice(t,this.prevI);a.length!==0?(s(a+o),this.text=""):o.length!==0&&s(o)}i=j;break t}case Ct:this.state=Tt,this.entityReturnState=R,s!==void 0&&(this.text+=n.slice(t,this.prevI)),i=j;break t;case rt:switch(i){case j:i=ti;break;case ti:i=ie;break;case ie:break;default:throw new Error("impossible state")}break;case _:i===ie&&this.fail('the string "]]>" is disallowed in char data.'),i=j;break;case X:s!==void 0&&(this.text+=`${n.slice(t,this.prevI)}
|
|
9
|
+
`),t=this.i,i=j;break;case A:s!==void 0&&(this.text+=n.slice(t));break t;default:i=j}this.forbiddenState=i}handleTextOutsideRoot(){let{i:t}=this,{chunk:i,textHandler:n}=this,s=!1;t:for(;;){let a=this.getCode();switch(a){case W:{if(this.state=jt,n!==void 0){let{text:o}=this,r=i.slice(t,this.prevI);o.length!==0?(n(o+r),this.text=""):r.length!==0&&n(r)}break t}case Ct:this.state=Tt,this.entityReturnState=R,n!==void 0&&(this.text+=i.slice(t,this.prevI)),s=!0;break t;case X:n!==void 0&&(this.text+=`${i.slice(t,this.prevI)}
|
|
10
|
+
`),t=this.i;break;case A:n!==void 0&&(this.text+=i.slice(t));break t;default:O(a)||(s=!0)}}s&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0))}pushAttribNS(t,i){var n;let{prefix:s,local:a}=this.qname(t),o={name:t,prefix:s,local:a,value:i};if(this.attribList.push(o),(n=this.attributeHandler)===null||n===void 0||n.call(this,o),s==="xmlns"){let r=i.trim();this.currentXMLVersion==="1.0"&&r===""&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[a]=r,ne(this,a,r)}else if(t==="xmlns"){let r=i.trim();this.topNS[""]=r,ne(this,"",r)}}pushAttribPlain(t,i){var n;let s={name:t,value:i};this.attribList.push(s),(n=this.attributeHandler)===null||n===void 0||n.call(this,s)}end(){var t,i;this.sawRoot||this.fail("document must contain a root element.");let{tags:n}=this;for(;n.length>0;){let a=n.pop();this.fail(`unclosed tag: ${a.name}`)}this.state!==He&&this.state!==R&&this.fail("unexpected end.");let{text:s}=this;return s.length!==0&&((t=this.textHandler)===null||t===void 0||t.call(this,s),this.text=""),this._closed=!0,(i=this.endHandler)===null||i===void 0||i.call(this),this._init(),this}resolve(t){var i,n;let s=this.topNS[t];if(s!==void 0)return s;let{tags:a}=this;for(let o=a.length-1;o>=0;o--)if(s=a[o].ns[t],s!==void 0)return s;return s=this.ns[t],s!==void 0?s:(n=(i=this.opt).resolvePrefix)===null||n===void 0?void 0:n.call(i,t)}qname(t){let i=t.indexOf(":");if(i===-1)return{prefix:"",local:t};let n=t.slice(i+1),s=t.slice(0,i);return(s===""||n===""||n.includes(":"))&&this.fail(`malformed name: ${t}.`),{prefix:s,local:n}}processAttribsNS(){var t;let{attribList:i}=this,n=this.tag;{let{prefix:o,local:r}=this.qname(n.name);n.prefix=o,n.local=r;let u=n.uri=(t=this.resolve(o))!==null&&t!==void 0?t:"";o!==""&&(o==="xmlns"&&this.fail('tags may not have "xmlns" as prefix.'),u===""&&(this.fail(`unbound namespace prefix: ${JSON.stringify(o)}.`),n.uri=o))}if(i.length===0)return;let{attributes:s}=n,a=new Set;for(let o of i){let{name:r,prefix:u,local:f}=o,p,h;u===""?(p=r==="xmlns"?at:"",h=r):(p=this.resolve(u),p===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(u)}.`),p=u),h=`{${p}}${f}`),a.has(h)&&this.fail(`duplicate attribute: ${h}.`),a.add(h),o.uri=p,s[r]=o}this.attribList=[]}processAttribsPlain(){let{attribList:t}=this,i=this.tag.attributes;for(let{name:n,value:s}of t)i[n]!==void 0&&this.fail(`duplicate attribute: ${n}.`),i[n]=s;this.attribList=[]}openTag(){var t;this.processAttribs();let{tags:i}=this,n=this.tag;n.isSelfClosing=!1,(t=this.openTagHandler)===null||t===void 0||t.call(this,n),i.push(n),this.state=R,this.name=""}openSelfClosingTag(){var t,i,n;this.processAttribs();let{tags:s}=this,a=this.tag;a.isSelfClosing=!0,(t=this.openTagHandler)===null||t===void 0||t.call(this,a),(i=this.closeTagHandler)===null||i===void 0||i.call(this,a),(this.tag=(n=s[s.length-1])!==null&&n!==void 0?n:null)===null&&(this.closedRoot=!0),this.state=R,this.name=""}closeTag(){let{tags:t,name:i}=this;if(this.state=R,this.name="",i===""){this.fail("weird empty close tag."),this.text+="</>";return}let n=this.closeTagHandler,s=t.length;for(;s-- >0;){let a=this.tag=t.pop();if(this.topNS=a.ns,n?.(a),a.name===i)break;this.fail("unexpected close tag.")}s===0?this.closedRoot=!0:s<0&&(this.fail(`unmatched closing tag: ${i}.`),this.text+=`</${i}>`)}parseEntity(t){if(t[0]!=="#"){let n=this.ENTITIES[t];return n!==void 0?n:(this.fail(this.isName(t)?"undefined entity.":"disallowed character in entity name."),`&${t};`)}let i=NaN;return t[1]==="x"&&/^#x[0-9a-f]+$/i.test(t)?i=parseInt(t.slice(2),16):/^#[0-9]+$/.test(t)&&(i=parseInt(t.slice(1),10)),this.isChar(i)?String.fromCodePoint(i):(this.fail("malformed character entity."),`&${t};`)}};ot.SaxesParser=se});import{createRequire as Ai}from"module";var _i=Ai("/"),it,Ti,bi;try{it=_i("worker_threads"),Ti=it.Worker,bi=it.isMarkedAsUntransferable}catch{}var S=Uint8Array,J=Uint16Array,yi=Int32Array,_e=new S([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Te=new S([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Fi=new S([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),be=function(e,t){for(var i=new J(31),n=0;n<31;++n)i[n]=t+=1<<e[n-1];for(var s=new yi(i[30]),n=1;n<30;++n)for(var a=i[n];a<i[n+1];++a)s[a]=a-i[n]<<5|n;return{b:i,r:s}},it=be(_e,2),ye=it.b,Si=it.r;ye[28]=258,Si[258]=28;var Fe=be(Te,0),Ni=Fe.b,cs=Fe.r,Xt=new J(32768);for(v=0;v<32768;++v)z=(v&43690)>>1|(v&21845)<<1,z=(z&52428)>>2|(z&13107)<<2,z=(z&61680)>>4|(z&3855)<<4,Xt[v]=((z&65280)>>8|(z&255)<<8)>>1;var z,v,dt=(function(e,t,i){for(var n=e.length,s=0,a=new J(t);s<n;++s)e[s]&&++a[e[s]-1];var o=new J(t);for(s=1;s<t;++s)o[s]=o[s-1]+a[s-1]<<1;var r;if(i){r=new J(1<<t);var u=15-t;for(s=0;s<n;++s)if(e[s])for(var f=s<<4|e[s],p=t-e[s],h=o[e[s]-1]++<<p,l=h|(1<<p)-1;h<=l;++h)r[Xt[h]>>u]=f}else for(r=new J(n),s=0;s<n;++s)e[s]&&(r[s]=Xt[o[e[s]-1]++]>>15-e[s]);return r}),mt=new S(288);for(v=0;v<144;++v)mt[v]=8;var v;for(v=144;v<256;++v)mt[v]=9;var v;for(v=256;v<280;++v)mt[v]=7;var v;for(v=280;v<288;++v)mt[v]=8;var v,Se=new S(32);for(v=0;v<32;++v)Se[v]=5;var v;var Ri=dt(mt,9,1);var ki=dt(Se,5,1),Pt=function(e){for(var t=e[0],i=1;i<e.length;++i)e[i]>t&&(t=e[i]);return t},B=function(e,t,i){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(t&7)&i},Bt=function(e,t){var i=t/8|0;return(e[i]|e[i+1]<<8|e[i+2]<<16)>>(t&7)},Oi=function(e){return(e+7)/8|0},gt=function(e,t,i){return(t==null||t<0)&&(t=0),(i==null||i>e.length)&&(i=e.length),new S(e.subarray(t,i))};var Mi=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],b=function(e,t,i){var n=new Error(t||Mi[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,b),!i)throw n;return n},Ii=function(e,t,i,n){var s=e.length,a=n?n.length:0;if(!s||t.f&&!t.l)return i||new S(0);var o=!i,r=o||t.i!=2,u=t.i;o&&(i=new S(s*3));var f=function(ge){var me=i.length;if(ge>me){var ve=new S(Math.max(me*2,ge));ve.set(i),i=ve}},p=t.f||0,h=t.p||0,l=t.b||0,d=t.l,c=t.d,w=t.m,m=t.n,C=s*8;do{if(!d){p=B(e,h,1);var T=B(e,h+1,3);if(h+=3,T)if(T==1)d=Ri,c=ki,w=9,m=5;else if(T==2){var U=B(e,h,31)+257,Z=B(e,h+10,15)+4,Y=U+B(e,h+5,31)+1;h+=14;for(var G=new S(Y),ut=new S(19),F=0;F<Z;++F)ut[Fi[F]]=B(e,h+F*3,7);h+=Z*3;for(var Q=Pt(ut),$=(1<<Q)-1,Et=dt(ut,Q,1),F=0;F<Y;){var Dt=Et[B(e,h,$)];h+=Dt&15;var E=Dt>>4;if(E<16)G[F++]=E;else{var N=0,M=0;for(E==16?(M=3+B(e,h,3),h+=2,N=G[F-1]):E==17?(M=3+B(e,h,7),h+=3):E==18&&(M=11+B(e,h,127),h+=7);M--;)G[F++]=N}}var K=G.subarray(0,U),I=G.subarray(U);w=Pt(K),m=Pt(I),d=dt(K,w,1),c=dt(I,m,1)}else b(1);else{var E=Oi(h)+4,P=e[E-4]|e[E-3]<<8,V=E+P;if(V>s){u&&b(0);break}r&&f(l+P),i.set(e.subarray(E,V),l),t.b=l+=P,t.p=h=V*8,t.f=p;continue}if(h>C){u&&b(0);break}}r&&f(l+131072);for(var wt=(1<<w)-1,Ot=(1<<m)-1,ft=h;;ft=h){var N=d[Bt(e,h)&wt],H=N>>4;if(h+=N&15,h>C){u&&b(0);break}if(N||b(2),H<256)i[l++]=H;else if(H==256){ft=h,d=null;break}else{var At=H-254;if(H>264){var F=H-257,ct=_e[F];At=B(e,h,(1<<ct)-1)+ye[F],h+=ct}var Mt=c[Bt(e,h)&Ot],It=Mt>>4;Mt||b(3),h+=Mt&15;var I=Ni[It];if(It>3){var ct=Te[It];I+=Bt(e,h)&(1<<ct)-1,h+=ct}if(h>C){u&&b(0);break}r&&f(l+131072);var pe=l+At;if(l<I){var de=a-I,wi=Math.min(I,pe);for(de+l<0&&b(3);l<wi;++l)i[l]=n[de+l]}for(;l<pe;++l)i[l]=i[l-I]}}t.l=d,t.p=ft,t.b=l,t.f=p,d&&(p=1,t.m=w,t.d=c,t.n=m)}while(!p);return l!=i.length&&o?gt(i,0,l):i.subarray(0,l)};var pt=new S(0);var tt=function(e,t){return e[t]|e[t+1]<<8},et=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Lt=function(e,t){return et(e,t)+et(e,t+4)*4294967296};var Pi=(function(){function e(t,i){typeof t=="function"&&(i=t,t={}),this.ondata=i;var n=t&&t.dictionary&&t.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new S(32768),this.p=new S(0),n&&this.o.set(n)}return e.prototype.e=function(t){if(this.ondata||b(5),this.d&&b(4),!this.p.length)this.p=t;else if(t.length){var i=new S(this.p.length+t.length);i.set(this.p),i.set(t,this.p.length),this.p=i}},e.prototype.c=function(t){this.s.i=+(this.d=t||!1);var i=this.s.b,n=Ii(this.p,this.s,this.o);this.ondata(gt(n,i,this.s.b),this.d),this.o=gt(n,this.s.b-32768),this.s.b=this.o.length,this.p=gt(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(t,i){this.e(t),this.c(i)},e})();var $t=typeof TextDecoder<"u"&&new TextDecoder,Bi=0;try{$t.decode(pt,{stream:!0}),Bi=1}catch{}var Li=function(e){for(var t="",i=0;;){var n=e[i++],s=(n>127)+(n>223)+(n>239);if(i+s>e.length)return{s:t,r:gt(e,i-1)};s?s==3?(n=((n&15)<<18|(e[i++]&63)<<12|(e[i++]&63)<<6|e[i++]&63)-65536,t+=String.fromCharCode(55296|n>>10,56320|n&1023)):s&1?t+=String.fromCharCode((n&31)<<6|e[i++]&63):t+=String.fromCharCode((n&15)<<12|(e[i++]&63)<<6|e[i++]&63):t+=String.fromCharCode(n)}};function Xi(e,t){if(t){for(var i="",n=0;n<e.length;n+=16384)i+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return i}else{if($t)return $t.decode(e);var s=Li(e),a=s.s,i=s.r;return i.length&&b(8),a}}var $i=function(e,t,i,n,s,a,o){var r=s==4294967295,u=a==4294967295,f=o==4294967295,p=t+i,h=r+u+f;if(n&&h){for(;t+4<p;t+=4+tt(e,t+2))if(tt(e,t)==1)return[r?Lt(e,t+4+8*u):s,u?Lt(e,t+4):a,f?Lt(e,t+4+8*(u+r)):o,1];n<2&&b(13)}return[s,a,o,0]};var zt=(function(){function e(){}return e.prototype.push=function(t,i){this.ondata(null,t,i)},e.compression=0,e})();var Ne=(function(){function e(){var t=this;this.i=new Pi(function(i,n){t.ondata(null,i,n)})}return e.prototype.push=function(t,i){try{this.i.push(t,i)}catch(n){this.ondata(n,null,i)}},e.compression=8,e})();var Re=(function(){function e(t){this.onfile=t,this.k=[],this.o={0:zt},this.p=pt}return e.prototype.push=function(t,i){var n=this;if(this.onfile||b(5),this.p||b(4),this.c>0){var s=Math.min(this.c,t.length),a=t.subarray(0,s);if(this.c-=s,this.d?this.d.push(a,!this.c):this.k[0].push(a),t=t.subarray(s),t.length)return this.push(t,i)}else{var o=0,r=0,u=void 0,f=void 0;this.p.length?t.length?(f=new S(this.p.length+t.length),f.set(this.p),f.set(t,this.p.length)):f=this.p:f=t;for(var p=f.length,h=this.c,l=h&&this.d,d=function(){var C=et(f,r);if(C==67324752){o=1,u=r,c.d=null,c.c=0;var T=tt(f,r+6),E=tt(f,r+8),P=T&2048,V=T&8,U=tt(f,r+26),Z=tt(f,r+28);if(p>r+30+U+Z){var Y=[];c.k.unshift(Y),o=2;var G=et(f,r+18),ut=et(f,r+22),F=Xi(f.subarray(r+30,r+=30+U),!P),Q=$i(f,r,Z,2,G,ut,0),$=Q[0],Et=Q[1],Dt=Q[3];V&&($=-1-Dt),r+=Z,c.c=$;var N,M={name:F,compression:E,start:function(){if(M.ondata||b(5),!$)M.ondata(null,pt,!0);else{var K=n.o[E];K||M.ondata(b(14,"unknown compression type "+E,1),null,!1),N=$<0?new K(F):new K(F,$,Et),N.ondata=function(ft,H,At){M.ondata(ft,H,At)};for(var I=0,wt=Y;I<wt.length;I++){var Ot=wt[I];N.push(Ot,!1)}n.k[0]==Y&&n.c?n.d=N:N.push(pt,!0)}},terminate:function(){N&&N.terminate&&N.terminate()}};$>=0&&(M.size=$,M.originalSize=Et),c.onfile(M)}return"break"}else if(h){if(C==134695760)return u=r+=12+(h==-2&&8),o=3,c.c=0,"break";if(C==33639248)return u=r-=4,o=3,c.c=0,"break"}},c=this;r<p-4;++r){var w=d();if(w==="break")break}if(this.p=pt,h<0){var m=o?f.subarray(0,u-12-(h==-2&&8)-(et(f,u-16)==134695760&&4)):f.subarray(0,r);l?l.push(m,!!o):this.k[+(o==2)].push(m)}if(o&2)return this.push(f.subarray(r),i);this.p=f.subarray(r)}i&&(this.c&&b(13),this.p=null)},e.prototype.register=function(t){this.o[t.compression]=t},e})();var li=xe(ae(),1);var Ln=1e4,Xn=5e7,$n=25e7,ui=5e6,fi=256,ci=65536,oe=256,pi=3e4,g=class extends Error{constructor(i,n){super(`${i}: ${n}`);this.code=i}},zn="http://schemas.openxmlformats.org/package/2006/relationships",Un="http://schemas.openxmlformats.org/package/2006/content-types",Hn=new Set(["http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","http://purl.oclc.org/ooxml/officeDocument/relationships/officeDocument"]),Wn=["application/vnd.openxmlformats-officedocument.wordprocessingml.document.main","application/vnd.ms-word.document.main"];function di(e){return e.length===0?"empty name":e.includes("\\")?"backslash":e.includes("\0")?"NUL byte":e.startsWith("/")?"absolute path":/^[a-zA-Z]:/.test(e)?"drive letter":e.split("/").some(t=>t==="..")?"dot-dot segment":null}function Vn(e,t){let i=Math.max(0,e.length-65557),n=-1;for(let f=e.length-22;f>=i;f--)if(e.readUInt32LE(f)===101010256){n=f;break}if(n<0)throw new g("DOCX_UNREADABLE","not a zip archive (no end-of-central-directory)");let s=e.readUInt16LE(n+10);if(s>t)throw new g("DOCX_TOO_MANY_PARTS",`${s} entries > ${t} cap`);let a=e.readUInt32LE(n+16),o=[],r=new Set,u=a;for(let f=0;f<s;f++){if(u+46>e.length||e.readUInt32LE(u)!==33639248)throw new g("DOCX_UNREADABLE","malformed central directory");let p=e.readUInt32LE(u+16),h=e.readUInt16LE(u+28),l=e.readUInt16LE(u+30),d=e.readUInt16LE(u+32),c=e.subarray(u+46,u+46+h).toString("utf8"),w=di(c);if(w!==null)throw new g("DOCX_UNREADABLE",`unsafe entry name (${w}): ${JSON.stringify(c)}`);if(r.has(c))throw new g("DOCX_UNREADABLE",`duplicate entry: ${c}`);r.add(c),o.push({name:c,crc:p}),u+=46+h+l+d}return o}function Gn(e,t){let i=new Map,n=0,s=null,a=r=>{s||(s=r)},o=new Re(r=>{let u=di(r.name);if(u!==null){a(new g("DOCX_UNREADABLE",`unsafe entry name (${u}): ${JSON.stringify(r.name)}`));return}let f=[],p=0;r.ondata=(h,l,d)=>{if(h){a(new g("DOCX_UNREADABLE",`entry ${r.name}: ${h.message??String(h)}`));return}if(l&&l.length>0){if(p+=l.length,n+=l.length,p>t.maxPartBytes){a(new g("DOCX_PART_TOO_LARGE",`${r.name}: ${p} actual bytes > ${t.maxPartBytes} cap`));return}if(n>t.maxTotalBytes){a(new g("DOCX_BOMB",`total actual inflated bytes exceed ${t.maxTotalBytes} cap`));return}f.push(l)}d&&!s&&i.set(r.name,Buffer.concat(f))},r.start()});o.register(zt),o.register(Ne);try{for(let r=0;r<e.length;r+=65536)if(o.push(e.subarray(r,Math.min(r+65536,e.length)),r+65536>=e.length),s)throw s}catch(r){throw r instanceof g?r:new g("DOCX_UNREADABLE",`zip stream: ${r instanceof Error?r.message:String(r)}`)}if(s)throw s;return i}function gi(e,t,i){let n=new li.SaxesParser({xmlns:!0}),s=null;if(n.on("doctype",()=>{s=new g("DOCX_UNREADABLE",`DOCTYPE not allowed (${t})`)}),n.on("error",a=>{s=s??new g("DOCX_UNREADABLE",`${t}: ${a.message}`)}),n.on("opentag",a=>{if(s)return;let o={};for(let[r,u]of Object.entries(a.attributes))o[u.local||r]=u.value;i(a.uri??"",a.local,o)}),n.write(e).close(),s)throw s}function oi(e,t){let i=new Map;return gi(e,t,(n,s,a)=>{n===zn&&s==="Relationship"&&a.Id&&a.Type&&a.Target!==void 0&&i.set(a.Id,{type:a.Type,target:a.Target,targetMode:a.TargetMode==="External"?"External":"Internal"})}),i}function qn(e){let t=new Map,i=new Map;return gi(e,"[Content_Types].xml",(n,s,a)=>{n===Un&&(s==="Default"&&a.Extension&&a.ContentType?t.set(a.Extension.toLowerCase(),a.ContentType):s==="Override"&&a.PartName&&a.ContentType&&i.set(a.PartName.replace(/^\//,""),a.ContentType))}),{defaults:t,overrides:i}}function jn(e,t){let i=e.overrides.get(t);if(i)return i;let n=t.lastIndexOf(".");if(!(n<0))return e.defaults.get(t.slice(n+1).toLowerCase())}function hi(e,t){if(/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t)||t.includes("\\")||t.includes("\0"))return null;let i;try{i=decodeURIComponent(t)}catch{return null}let n=i.startsWith("/")?[]:e.split("/").slice(0,-1).filter(s=>s.length>0);for(let s of i.split("/"))if(!(s===""||s===".")){if(s===".."){if(n.length===0)return null;n.pop();continue}n.push(s)}return n.length>0?n.join("/"):null}var Zn=Buffer.from([208,207,17,224,161,177,26,225]);function lt(e){try{return e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191?new TextDecoder("utf-8",{fatal:!0}).decode(e.subarray(3)):e.length>=2&&e[0]===255&&e[1]===254?new TextDecoder("utf-16le",{fatal:!0}).decode(e.subarray(2)):e.length>=2&&e[0]===254&&e[1]===255?new TextDecoder("utf-16be",{fatal:!0}).decode(e.subarray(2)):new TextDecoder("utf-8",{fatal:!0}).decode(e)}catch{throw new g("DOCX_UNREADABLE","XML part is not valid UTF-8/UTF-16 text")}}function mi(e,t){if(e.length>=8&&e.subarray(0,8).equals(Zn))throw new g("DOCX_ENCRYPTED_OR_LEGACY","password-protected Office file (or a legacy .doc renamed .docx) \u2014 remove the password / save as .docx and re-ingest");let i={maxEntries:t?.maxEntries??Ln,maxPartBytes:t?.maxPartBytes??Xn,maxTotalBytes:t?.maxTotalBytes??$n},n=Vn(e,i.maxEntries),s=Gn(e,i),a=new Map(n.map(l=>[l.name,l]));if(s.size!==n.length)throw new g("DOCX_UNREADABLE",`central directory lists ${n.length} entries, stream produced ${s.size}`);for(let[l,d]of s){let c=a.get(l);if(!c)throw new g("DOCX_UNREADABLE",`entry ${l} missing from central directory`);if(De(d)!==c.crc)throw new g("DOCX_UNREADABLE",`CRC mismatch: ${l}`)}let o=s.get("_rels/.rels");if(!o)throw new g("DOCX_NOT_WORDPROCESSING","no package relationships (_rels/.rels missing)");let r=oi(lt(o),"_rels/.rels"),u=null;for(let l of r.values()){if(!Hn.has(l.type)||l.targetMode!=="Internal")continue;let d=hi("",l.target);if(d!==null&&s.has(d)){u=d;break}}if(u===null)throw new g("DOCX_NOT_WORDPROCESSING","this zip is not a Word document (no officeDocument relationship)");let f=s.get("[Content_Types].xml");if(!f)throw new g("DOCX_NOT_WORDPROCESSING","package has no [Content_Types].xml");let p=jn(qn(lt(f)),u);if(!p||!Wn.some(l=>p.startsWith(l)))throw new g("DOCX_NOT_WORDPROCESSING",`this zip is not a Word document (main part content type: ${p??"unknown"} \u2014 pptx/xlsx or unknown package)`);let h=new Map;return{parts:s,mainPart:u,relsFor(l){let d=h.get(l);if(d)return d;let c=l.lastIndexOf("/"),w=`${c>=0?l.slice(0,c+1):""}_rels/${c>=0?l.slice(c+1):l}.rels`,m=s.get(w),C=m?oi(lt(m),w):new Map;return h.set(l,C),C},resolveTarget:hi}}var xi=xe(ae(),1);var Rt=new Set(["http://schemas.openxmlformats.org/wordprocessingml/2006/main","http://purl.oclc.org/ooxml/wordprocessingml/main"]),Yn=new Set(["http://schemas.openxmlformats.org/drawingml/2006/main","http://purl.oclc.org/ooxml/drawingml/main"]),Qn=new Set(["http://schemas.openxmlformats.org/officeDocument/2006/math","http://purl.oclc.org/ooxml/officeDocument/math"]),vi="urn:schemas-microsoft-com:vml",he="http://schemas.openxmlformats.org/markup-compatibility/2006",kt=class{constructor(t,i,n=s=>this.tokens.push(s)){this.partName=t;this.budget=i;this.sink=n}tokens=[];storyRefs=[];stack=[];skipUntilDepth=[];fields=[];runVanish=[];acStack=[];txbxDepths=[];drawing=null;failed=null;setSink(t){this.sink=t}fail(t){this.failed||(this.failed=t)}abort(t){throw!this.failed&&t instanceof g&&(this.failed=t),t}emit(t){this.failed||(this.drawing&&t.t==="text"&&this.txbxDepths.length>0&&(this.drawing.emittedContent=!0),this.sink(t))}suppressed(){return this.skipUntilDepth.length>0}inInstruction(){return this.fields.some(t=>!t.hasSeparate)}parent(){return this.stack.length>=2?this.stack[this.stack.length-2]:void 0}depth(){return this.stack.length}onOpen(t,i,n){if(this.failed)return;this.budget.nodesRemaining-=1,this.budget.nodesRemaining<0&&this.abort(new g("DOCX_UNREADABLE",`XML node budget exhausted (${this.partName})`)),(this.budget.nodesRemaining&4095)===0&&this.budget.deadline!==void 0&&Date.now()>this.budget.deadline&&this.abort(new g("DOCX_UNREADABLE",`conversion budget exhausted (${this.partName})`)),this.stack.push({uri:t,local:i});let s=this.depth();if(s>oe&&this.abort(new g("DOCX_UNREADABLE",`XML nesting exceeds ${oe} (${this.partName})`)),this.suppressed())return;if(t===he&&i==="AlternateContent"){this.acStack.push({branchTaken:!1});return}if(t===he&&(i==="Choice"||i==="Fallback")){let o=this.acStack[this.acStack.length-1];if(!o)return;o.branchTaken?this.skipUntilDepth.push(s):o.branchTaken=!0;return}let a=Rt.has(t);if((a&&i==="txbxContent"||t===vi&&i==="textbox")&&this.txbxDepths.push(s),a&&(i==="del"||i==="moveFrom"||i==="sdtPr"||i==="delText"||i==="pPrChange"||i==="rPrChange"||i==="sectPrChange"||i==="tblPrChange"||i==="trPrChange"||i==="tcPrChange")){this.skipUntilDepth.push(s);return}if(Qn.has(t)&&(i==="oMath"||i==="oMathPara")){this.emit({t:"marker",value:"[equation omitted]"}),this.skipUntilDepth.push(s);return}if(a&&i==="altChunk"){this.emit({t:"marker",value:"[embedded content omitted]"}),this.skipUntilDepth.push(s);return}if(a&&i==="tabs"){this.skipUntilDepth.push(s);return}if(a){switch(i){case"r":this.runVanish.push(!1);break;case"vanish":{let o=n.val;this.parent()?.local==="rPr"&&o!=="false"&&o!=="0"&&this.runVanish.length>0&&(this.runVanish[this.runVanish.length-1]=!0);break}case"fldChar":{let o=n.fldCharType;if(o==="begin")this.fields.push({hasSeparate:!1});else if(o==="separate"){let r=this.fields[this.fields.length-1];r&&(r.hasSeparate=!0)}else if(o==="end"){let r=this.fields.pop();r&&!r.hasSeparate&&this.emit({t:"marker",value:"[field: no stored result]"})}break}case"tab":this.parent()?.local==="r"&&!this.textSuppressed()&&this.emit({t:"tab"});break;case"br":case"cr":this.textSuppressed()||this.emit({t:"break"});break;case"noBreakHyphen":this.textSuppressed()||this.emit({t:"text",value:"\u2011"});break;case"softHyphen":break;case"sym":this.textSuppressed()||this.emit({t:"marker",value:"[symbol]"});break;case"numPr":this.parent()?.local==="pPr"&&this.emit({t:"marker",value:"- "});break;case"footnoteReference":n.id!==void 0&&!this.textSuppressed()&&this.emit({t:"note-ref",noteKind:"footnote",id:n.id});break;case"endnoteReference":n.id!==void 0&&!this.textSuppressed()&&this.emit({t:"note-ref",noteKind:"endnote",id:n.id});break;case"headerReference":case"footerReference":{let o=n.id;if(o){let r=n.type==="first"?"first":n.type==="even"?"even":"default";this.storyRefs.push({kind:i==="headerReference"?"header":"footer",type:r,relId:o})}break}case"drawing":this.drawing||(this.drawing={relId:null,kind:"drawing",external:!1,found:!1,emittedContent:!1});break;case"pict":case"object":this.drawing||(this.drawing={relId:null,kind:"vml",external:!1,found:!1,emittedContent:!1});break}return}if(Yn.has(t)&&i==="blip"&&this.drawing&&!this.drawing.found){let o=this.relAttr(n,"embed"),r=this.relAttr(n,"link");o?(this.drawing.relId=o,this.drawing.external=!1,this.drawing.found=!0):r&&(this.drawing.relId=r,this.drawing.external=!0,this.drawing.found=!0);return}if(t===vi&&i==="imagedata"&&this.drawing&&!this.drawing.found){let o=this.relAttr(n,"id")??n.relid;o&&(this.drawing.relId=o,this.drawing.kind="vml",this.drawing.found=!0);return}}onClose(){let t=this.depth();this.skipUntilDepth[this.skipUntilDepth.length-1]===t&&this.skipUntilDepth.pop(),this.txbxDepths[this.txbxDepths.length-1]===t&&this.txbxDepths.pop();let n=this.stack.pop();if(!(!n||this.failed)&&!this.suppressed()){if(n.uri===he&&n.local==="AlternateContent"){this.acStack.pop();return}if(Rt.has(n.uri))switch(n.local){case"r":this.runVanish.pop();break;case"p":this.emit({t:"para-end"});break;case"tc":this.emit({t:"table-cell-end"});break;case"tr":this.emit({t:"table-row-end"});break;case"drawing":case"pict":case"object":{let s=this.drawing;if(this.drawing=null,!s)break;s.found?this.emit({t:"image",relId:s.relId,kind:s.kind,external:s.external}):s.emittedContent||this.emit({t:"marker",value:"[object omitted: drawing]"});break}}}}onText(t){if(this.failed||this.suppressed()||t.length===0)return;let i=this.stack[this.stack.length-1];!i||!Rt.has(i.uri)||i.local==="t"&&(this.textSuppressed()||(this.budget.textCharsRemaining!==void 0&&(this.budget.textCharsRemaining-=t.length,this.budget.textCharsRemaining<0&&this.abort(new Error(`PROJECTION_TOO_LARGE: projection text exceeds the conversion cap during the walk (${this.partName}) \u2014 split the document and re-ingest`))),this.emit({t:"text",value:t})))}textSuppressed(){return this.inInstruction()?!0:this.runVanish.length>0&&this.runVanish[this.runVanish.length-1]}relAttr(t,i){return t[i]}run(t){let i=new xi.SaxesParser({xmlns:!0});if(i.on("doctype",()=>{this.fail(new g("DOCX_UNREADABLE",`DOCTYPE not allowed (${this.partName})`))}),i.on("error",n=>{this.fail(new g("DOCX_UNREADABLE",`${this.partName}: ${n.message}`))}),i.on("opentag",n=>{let s={},a=Object.entries(n.attributes);a.length>fi&&this.abort(new g("DOCX_UNREADABLE",`too many attributes (${this.partName})`));for(let[o,r]of a)r.value.length>ci&&this.abort(new g("DOCX_UNREADABLE",`oversized attribute (${this.partName})`)),s[r.local||o]=r.value;this.onOpen(n.uri??"",n.local,s)}),i.on("closetag",()=>this.onClose()),i.on("text",n=>this.onText(n)),i.write(t).close(),this.failed)throw this.failed}};function Ci(e,t){let i=t.budget??{nodesRemaining:Number.MAX_SAFE_INTEGER},n=new kt(t.partName,i);return n.run(e),{tokens:n.tokens,storyRefs:n.storyRefs}}var le=class extends kt{notes=new Map;current=null;noteDepth=0;constructor(t,i){super(t,i),this.setSink(n=>this.current?.push(n))}onOpen(t,i,n){super.onOpen(t,i,n),!(!Rt.has(t)||i!=="footnote"&&i!=="endnote")&&(n.type!==void 0&&n.type!=="normal"||(this.current=[],n.id!==void 0&&this.notes.set(n.id,this.current),this.noteDepth=this.depth()))}onClose(){let t=this.depth();super.onClose(),this.noteDepth===t&&(this.current=null,this.noteDepth=0)}};function Ei(e,t){let i=new le(t.partName,t.budget??{nodesRemaining:Number.MAX_SAFE_INTEGER});return i.run(e),i.notes}var Jn="v1",ts="1.0.0+saxes6.0.0+fflate0.8.3+pngjs7.0.0+jpeg-js0.4.4",es=64,is=16,ns=12e6,ss=6e6,rs=5e7,as=new Set(["http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","http://purl.oclc.org/ooxml/officeDocument/relationships/footnotes"]),os=new Set(["http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes","http://purl.oclc.org/ooxml/officeDocument/relationships/endnotes"]),hs={png:"image/png",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",bmp:"image/bmp",tiff:"image/tiff",emf:"image/emf",wmf:"image/wmf",unknown:"application/octet-stream"},ls=new Set(["png","jpeg","webp"]);function us(e){if(e==="body")return"in body";if(e.startsWith("header:"))return"in header";if(e.startsWith("footer:"))return"in footer";let t=/^(footnote|endnote):(.+)$/.exec(e);return t?`in ${t[1]} ${t[2]}`:`in ${e}`}var ce=class{constructor(t,i){this.pkg=t;this.caps=i}inventory=[];blobs=new Map;delivered=[];n=0;deliveredBytes=0;firstRefByFp=new Map;count(){return this.n}occurrence(t,i,n){this.n+=1;let s=`i${this.n}`,a=us(n),o=(m,C,T)=>{this.inventory.push({ref:s,loc:n,media_type:m,...T?.blob?{blob:T.blob}:{},...T?.appearance?{appearance:T.appearance}:{},delivery:C,...T?.duplicate_of?{duplicate_of:T.duplicate_of}:{}})},r=m=>`[img#${s} omitted: ${m}]`,u=t.relId!==null?this.pkg.relsFor(i).get(t.relId):void 0;if(t.external||u?.targetMode==="External")return o("application/octet-stream","external-image-not-fetched"),r("external-image-not-fetched");let f=u?this.pkg.resolveTarget(i,u.target):null,p=f!==null?this.pkg.parts.get(f):void 0;if(!p)return o("application/octet-stream","undecodable"),r("undecodable");let h=we(p),l=hs[h.format],d=Ce(p);if(this.blobs.set(d,p),!ls.has(h.format)){let m=h.format==="gif"||h.format==="bmp"||h.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";return o(l,m,{blob:d}),r(m)}if(h.width===void 0||h.height===void 0||h.width*h.height>this.caps.maxPixels)return o(l,"undecodable",{blob:d}),r("undecodable");let c;if(h.format==="png"||h.format==="jpeg"){let m=Ae(p,h.format);if(m===null)return o(l,"undecodable",{blob:d}),r("undecodable");c=Ee(m.data,{width:m.width,height:m.height,channels:m.channels})}if(h.width<this.caps.dimensionFloor||h.height<this.caps.dimensionFloor)return o(l,"below-dimension-floor",{blob:d,appearance:c}),r("below-dimension-floor");let w=this.firstRefByFp.get(d);return w!==void 0?(o(l,"duplicate",{blob:d,appearance:c,duplicate_of:w}),`[img#${s}: image ${a} \u2014 same as img#${w}; cite img#${w}]`):p.byteLength>this.caps.imageMaxBytes?(o(l,"image-too-large",{blob:d,appearance:c}),r("image-too-large")):this.deliveredBytes+p.byteLength>this.caps.visionByteBudget?(o(l,"vision-byte-budget-reached",{blob:d,appearance:c}),r("vision-byte-budget-reached")):this.delivered.length>=this.caps.imageCap?(o(l,"image-cap-reached",{blob:d,appearance:c}),r("image-cap-reached")):(this.firstRefByFp.set(d,s),this.deliveredBytes+=p.byteLength,this.delivered.push(s),o(l,"selected",{blob:d,appearance:c}),`[img#${s}: image ${a}]`)}};function ue(e,t){let i=[];for(let n of e)switch(n.t){case"text":i.push(n.value);break;case"tab":i.push(" ");break;case"break":i.push(`
|
|
11
|
+
`);break;case"para-end":i.push(`
|
|
12
|
+
`);break;case"table-cell-end":i[i.length-1]===`
|
|
13
|
+
`&&i.pop(),i.push(" ");break;case"table-row-end":i[i.length-1]===" "&&i.pop(),i.push(`
|
|
14
|
+
`);break;case"marker":i.push(n.value);break;case"note-ref":i.push(`[${n.noteKind} ${n.id}]`);break;case"image":{let s=t(n);s!==null&&i.push(s);break}}return i.join("")}function fe(e){let t=0;for(let i of e)i.t==="text"&&(t+=i.value.length);return t}function Di(e,t,i){let n=e.parts.get(t);if(!n)throw new g("DOCX_UNREADABLE",`referenced part missing: ${t}`);return Ci(lt(n),{partName:t,budget:i})}async function Ss(e,t){let i=Date.now()+(t?.budgetMs??pi),n=c=>{if(Date.now()>i)throw new g("DOCX_UNREADABLE",`conversion budget exhausted (${c})`)},s=mi(e),a={nodesRemaining:ui,textCharsRemaining:2*4e5,deadline:i},o={dimensionFloor:t?.caps?.dimensionFloor??es,imageCap:t?.caps?.imageCap??is,visionByteBudget:t?.caps?.visionByteBudget??ns,imageMaxBytes:t?.caps?.imageMaxBytes??ss,maxPixels:t?.caps?.maxPixels??rs},r=new ce(s,o),u=Di(s,s.mainPart,a);n(s.mainPart);let f=fe(u.tokens),p=[ue(u.tokens,c=>r.occurrence(c,s.mainPart,"body"))],h=s.relsFor(s.mainPart),l=new Set;for(let c of["header","footer"])for(let w of u.storyRefs.filter(m=>m.kind===c)){let m=h.get(w.relId);if(!m||m.targetMode!=="Internal")continue;let C=s.resolveTarget(s.mainPart,m.target);if(C===null||!s.parts.has(C)||l.has(C))continue;l.add(C);let T=Di(s,C,a);n(C),f+=fe(T.tokens);let E=w.type==="default"?`[${c}]`:`[${c} ${w.type}]`;p.push(`${E}
|
|
15
|
+
${ue(T.tokens,P=>r.occurrence(P,C,`${c}:${C}`))}`)}for(let[c,w]of[["footnote",as],["endnote",os]]){let m=[];for(let E of u.tokens)E.t==="note-ref"&&E.noteKind===c&&!m.includes(E.id)&&m.push(E.id);if(m.length===0)continue;let C=null;for(let E of h.values())if(w.has(E.type)&&E.targetMode==="Internal"){C=s.resolveTarget(s.mainPart,E.target);break}if(C===null||!s.parts.has(C))continue;let T=Ei(lt(s.parts.get(C)),{partName:C,budget:a});n(C);for(let E of m){let P=T.get(E);if(!P)continue;f+=fe(P);let V=C;p.push(`[${c} ${E}]
|
|
16
|
+
${ue(P,U=>r.occurrence(U,V,`${c}:${E}`))}`)}}if(f===0&&r.count()===0)throw new g("DOCX_NO_TEXT","no extractable text or images \u2014 nothing citable in this document");let d=p.join("");return d.endsWith(`
|
|
17
|
+
`)||(d+=`
|
|
18
|
+
`),{projection:d,inventory:r.inventory,blobs:r.blobs,delivered:r.delivered,converter:{name:"ooxml-walk",version:ts,policy:Jn}}}export{Jn as a,ts as b,es as c,is as d,ns as e,ss as f,rs as g,ue as h,Ss as i};
|
|
19
|
+
/*! Bundled license information:
|
|
20
|
+
|
|
21
|
+
xmlchars/xml/1.0/ed5.js:
|
|
22
|
+
(**
|
|
23
|
+
* Character classes and associated utilities for the 5th edition of XML 1.0.
|
|
24
|
+
*
|
|
25
|
+
* @author Louis-Dominique Dubeau
|
|
26
|
+
* @license MIT
|
|
27
|
+
* @copyright Louis-Dominique Dubeau
|
|
28
|
+
*)
|
|
29
|
+
|
|
30
|
+
xmlchars/xml/1.1/ed2.js:
|
|
31
|
+
(**
|
|
32
|
+
* Character classes and associated utilities for the 2nd edition of XML 1.1.
|
|
33
|
+
*
|
|
34
|
+
* @author Louis-Dominique Dubeau
|
|
35
|
+
* @license MIT
|
|
36
|
+
* @copyright Louis-Dominique Dubeau
|
|
37
|
+
*)
|
|
38
|
+
|
|
39
|
+
xmlchars/xmlns/1.0/ed3.js:
|
|
40
|
+
(**
|
|
41
|
+
* Character class utilities for XML NS 1.0 edition 3.
|
|
42
|
+
*
|
|
43
|
+
* @author Louis-Dominique Dubeau
|
|
44
|
+
* @license MIT
|
|
45
|
+
* @copyright Louis-Dominique Dubeau
|
|
46
|
+
*)
|
|
47
|
+
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as h}from"./chunk-RZ4F3BHX.js";var
|
|
2
|
+
import{a as h}from"./chunk-RZ4F3BHX.js";var l=class{config;buffer=[];stepBuffer=new Map;flushTimer=null;currentRunIndex=null;stopped=!1;_droppedBatches=0;_droppedEntries=0;constructor(t){this.config=t}start(){if(this.flushTimer)return;let t=this.config.flushIntervalMs??5e3;this.flushTimer=setInterval(()=>{this.flush().catch(()=>{})},t),this.flushTimer.unref&&this.flushTimer.unref()}setRunIndex(t){this.currentRunIndex=t}log(t,e,n,i={}){if(this.stopped)return;let s=this.buildEntry(t,e,n,i);this.buffer.push(s)}logStep(t,e,n,i={}){if(this.stopped)return;let s=this.buildEntry("debug",e,n,i);s.run_index=t,this.stepBuffer.has(t)||this.stepBuffer.set(t,[]),this.stepBuffer.get(t).push(s)}escalate(t){let e=this.stepBuffer.get(t);e&&e.length>0&&this.buffer.push(...e),this.stepBuffer.delete(t)}discardSteps(t){this.stepBuffer.delete(t)}async flush(){if(this.buffer.length===0)return;let t=this.buffer.splice(0),e=null;try{e=await this.config.getToken()}catch{this.buffer.unshift(...t);return}let n={"Content-Type":"application/json"};e&&(n.Authorization=`Bearer ${e}`);let i=JSON.stringify(t);for(let s=0;s<3;s++){try{let u=new AbortController,f=setTimeout(()=>u.abort(),1e4),o=await h(this.config.proxyUrl,{method:"POST",headers:n,body:i,signal:u.signal});if(clearTimeout(f),o.ok)return}catch{}s<2&&await new Promise(u=>setTimeout(u,1e3*Math.pow(2,s)))}this._droppedBatches++,this._droppedEntries+=t.length}async flushOnce(t){if(this.buffer.length===0)return"empty";let e=this.buffer.splice(0),n=Date.now()+t,i=null;try{i=await Promise.race([this.config.getToken(),new Promise(f=>{let o=setTimeout(()=>f(null),t);o.unref&&o.unref()})])}catch{i=null}let s=n-Date.now();if(s<=0)return this.buffer.unshift(...e),"timeout";let u={"Content-Type":"application/json"};i&&(u.Authorization=`Bearer ${i}`);try{let f=new AbortController,o=setTimeout(()=>f.abort(),s);o.unref&&o.unref();let c=await h(this.config.proxyUrl,{method:"POST",headers:u,body:JSON.stringify(e),signal:f.signal});return clearTimeout(o),c.ok?"sent":(this.buffer.unshift(...e),"failed")}catch{return this.buffer.unshift(...e),Date.now()>=n?"timeout":"failed"}}drainBuffer(){return this.buffer.splice(0)}get droppedBatches(){return this._droppedBatches}get droppedEntries(){return this._droppedEntries}async shutdown(){this._droppedBatches>0&&this.log("warn","LOG_DROPS",`Dropped ${this._droppedEntries} entries in ${this._droppedBatches} batches`,{dropped_batches:this._droppedBatches,dropped_entries:this._droppedEntries}),this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),await this.flush()}shutdownSync(){this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}get bufferSize(){return this.buffer.length}stepBufferSize(t){return this.stepBuffer.get(t)?.length??0}buildEntry(t,e,n,i){return{hostname:"kane-cli",service:"kane-cli",ddsource:"kane-cli",ddtags:`version:${this.config.device.cli_version}`,level:t,event:e,message:n,session_id:this.config.sessionId,run_index:e.startsWith("tcg_")?null:this.currentRunIndex,identity:this.config.identity,device:this.config.device,context:i,timestamp:new Date().toISOString()}}};function g(r=process.env){try{let t=r.KANE_CLI_USER_AGENT;return t&&t.trim()?a(t):r.CLAUDECODE==="1"||r.CLAUDE_CODE_ENTRYPOINT?"claude-code":r.CURSOR_TRACE_ID||r.TERM_PROGRAM==="cursor"?"cursor":r.TERM_PROGRAM==="vscode"||r.VSCODE_PID?"vscode":r.CI==="true"||r.GITHUB_ACTIONS==="true"||r.GITLAB_CI==="true"||r.CIRCLECI==="true"||r.BUILDKITE==="true"?"ci":"unknown"}catch{return"unknown"}}function a(r){return r.toLowerCase().replace(/[^a-z0-9_-]/g,"-").slice(0,40)}export{l as a,g as b};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as F}from"./chunk-BKHXPBWN.js";import{a as k}from"./chunk-N2P4MI32.js";import{b as $}from"./chunk-NVGBE2DR.js";import{deflateSync as Y}from"zlib";function j(n,s){let e=Buffer.alloc(4);e.writeUInt32BE(s.length);let o=Buffer.concat([Buffer.from(n,"latin1"),s]),i=Buffer.alloc(4);return i.writeUInt32BE(F(o)),Buffer.concat([e,o,i])}var G={1:0,3:2,4:6};function N(n,s){let{width:e,height:o,channels:i}=s;if(n.byteLength!==e*o*i)throw new Error(`pngEncode: raw length ${n.byteLength} != ${e}x${o}x${i}`);let d=Buffer.alloc(13);d.writeUInt32BE(e,0),d.writeUInt32BE(o,4),d[8]=8,d[9]=G[i];let t=e*i,a=Buffer.alloc(o*(t+1));for(let f=0;f<o;f++)a[f*(t+1)]=0,n.copy(a,f*(t+1)+1,f*t,(f+1)*t);return Buffer.concat([Buffer.from([137,80,78,71,13,10,26,10]),j("IHDR",d),j("IDAT",Y(a)),j("IEND",Buffer.alloc(0))])}var U=64,X=16,J=12e6,V=6e6,K=5e3,W=3e4,H="",_=class extends Error{constructor(e,o){super(`${e}: ${o}`);this.code=e}};async function q(n,s,e){let o=n.objs.has(s)?n.objs:n.commonObjs.has(s)?n.commonObjs:null;if(o)try{return o.get(s)??null}catch{return null}if(e.remainingMs<=0)return null;let i=s.startsWith("g_")?n.commonObjs:n.objs,d,t=Date.now();try{return await Promise.race([new Promise(a=>{try{i.get(s,f=>a(f??null))}catch{a(null)}}),new Promise(a=>{d=setTimeout(()=>a(null),Math.min(K,e.remainingMs))})])}finally{clearTimeout(d),e.remainingMs-=Date.now()-t}}async function z(){let n=await import("pdfjs-dist/legacy/build/pdf.mjs");return n.default??n}async function oe(n,s){let e=await z();H=e.version;let o={remainingMs:s?.resolveBudgetMs??W},i,d=e.getDocument({data:new Uint8Array(n),isEvalSupported:!1,verbosity:0});try{i=await d.promise}catch(t){throw t.name==="PasswordException"?new _("PDF_ENCRYPTED","password-protected \u2014 decrypt and re-ingest"):new _("PDF_UNREADABLE",String(t.message??t))}try{let t=[],a=[],f=new Map,D=[],T=new Map,R=0,A=0;for(let u=1;u<=i.numPages;u++){let O=await i.getPage(u);t.push(`[page ${u}]`);let C=await O.getTextContent(),c="",E=null;for(let m of C.items){if(typeof m!="object"||m===null||!("str"in m))continue;let p=m,P=Math.round(p.transform[5]);E!==null&&P!==E&&c.trim()!==""&&(t.push(c.trimEnd()),c=""),c!==""&&!c.endsWith(" ")&&p.str!==""&&!p.str.startsWith(" ")&&P===E&&(c+=" "),c+=p.str,A+=p.str.trim().length,E=P,p.hasEOL&&c.trim()!==""&&(t.push(c.trimEnd()),c="",E=null)}c.trim()!==""&&t.push(c.trimEnd());let B=await O.getOperatorList(),M=0;for(let m=0;m<B.fnArray.length;m++){let p=B.fnArray[m]===e.OPS.paintImageXObject,P=B.fnArray[m]===e.OPS.paintInlineImageXObject;if(!p&&!P)continue;M+=1;let h=`p${u}-${M}`,l=(v,L,w,S)=>{a.push({ref:h,page:u,media_type:"image/png",...L?{blob:L}:{},...S?{appearance:S}:{},delivery:v,...w?{duplicate_of:w}:{}}),t.push(v==="duplicate"&&w?`[img#${h}: image on page ${u} \u2014 same as img#${w}; cite img#${w}]`:`[img#${h} omitted: ${v}]`)};if(P){l("unsupported-image-kind");continue}let r=await q(O,B.argsArray[m][0],o);if(!r?.data||!r.width||!r.height){l("undecodable");continue}let I;if(r.kind===e.ImageKind.RGB_24BPP)I=3;else if(r.kind===e.ImageKind.RGBA_32BPP)I=4;else{l("unsupported-image-kind");continue}let y;try{y=N(Buffer.from(r.data.buffer,r.data.byteOffset,r.data.byteLength),{width:r.width,height:r.height,channels:I})}catch{l("undecodable");continue}let g=$(y);f.set(g,y);let b=k(Buffer.from(r.data.buffer,r.data.byteOffset,r.data.byteLength),{width:r.width,height:r.height,channels:I});if(r.width<U||r.height<U){l("below-dimension-floor",g,void 0,b);continue}let x=T.get(g);if(x!==void 0){l("duplicate",g,x,b);continue}if(y.byteLength>V){l("image-too-large",g,void 0,b);continue}if(R+y.byteLength>J){l("vision-byte-budget-reached",g,void 0,b);continue}if(D.length>=X){l("image-cap-reached",g,void 0,b);continue}T.set(g,h),R+=y.byteLength,D.push(h),a.push({ref:h,page:u,media_type:"image/png",blob:g,appearance:b,delivery:"selected"}),t.push(`[img#${h}: image on page ${u}]`)}}if(A===0&&i.numPages>0)throw new _("PDF_NO_TEXT_LAYER","no extractable text \u2014 image-only or scanned pdfs are not supported yet");return{projection:t.join(`
|
|
3
|
+
`)+`
|
|
4
|
+
`,inventory:a,blobs:f,delivered:D,pages:i.numPages,converter:{name:"pdfjs-dist",version:e.version,policy:"v1"}}}finally{await d.destroy().catch(()=>{})}}export{U as a,X as b,J as c,V as d,H as e,_ as f,oe as g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as h}from"./chunk-
|
|
2
|
+
import{a as h}from"./chunk-VRLUNZAK.js";import{y as l}from"./chunk-ZUGCHQFC.js";import{a as A}from"./chunk-HCBYKLMW.js";import{a as c,b as f,i as P}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as x}from"./chunk-UR6MHSHU.js";var L=x(B(),1);var n=x(A(),1);function S(r,d,s,u,m){let p=s==="basic"&&u?`basic (${u})`:s,i=20,a=`${r} [${d}]`,g="\xB7".repeat(Math.max(2,i-a.length+3));return{label:`${a} ${g} ${p}`,profile:r,env:d,isActive:m}}function M({creds:r,onSwitch:d,onCancel:s}){let u=r.listProfiles(),m=r.getActiveProfile(),p=r.getDefaultEnv(),i=u.map(e=>{let o=r.loadBasicAuth(e.profile,e.env),t=r.loadCredentials(e.profile,e.env)!==null,v=o?"basic":t?"oauth":"none",b=o?o.username:null,w=e.profile===m&&e.env===p;return S(e.profile,e.env,v,b,w)}),[a,g]=(0,L.useState)(()=>{let e=i.findIndex(o=>o.isActive);return e>=0?e:0});return P((e,o)=>{if(o.escape){s();return}if(o.upArrow){g(t=>Math.max(0,t-1));return}if(o.downArrow){g(t=>Math.min(i.length-1,t+1));return}if(o.return&&i[a]){let t=i[a];t.isActive||d(t.profile,t.env),s();return}}),i.length===0?(0,n.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,n.jsx)(f,{color:l.orange,bold:!0,children:"Profiles"}),(0,n.jsx)(c,{marginTop:1,children:(0,n.jsx)(f,{color:l.dim,children:"No profiles \u2014 use Login to create one"})}),(0,n.jsx)(h,{bindings:[],escBackLabel:"back"})]}):(0,n.jsxs)(c,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,n.jsx)(f,{color:l.orange,bold:!0,children:"Profiles"}),(0,n.jsx)(c,{flexDirection:"column",marginTop:1,children:i.map((e,o)=>{let t=o===a,v=t?"\u276F ":" ",b=e.isActive?l.green:t?l.orange:void 0;return(0,n.jsxs)(f,{color:b,children:[v,e.label,e.isActive?" \u25CF active":""]},`${e.profile}-${e.env}`)})}),(0,n.jsx)(h,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"switch"}],escBackLabel:"back"})]})}export{S as a,M as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as k}from"./chunk-
|
|
2
|
+
import{a as k}from"./chunk-GYNTNKNB.js";import{y as u}from"./chunk-ZUGCHQFC.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as m,b as s,k as b}from"./chunk-C44QQJR4.js";import{e as p}from"./chunk-UR6MHSHU.js";function B(t){let e=t;return e=e.replace(/@TS\{([^}]+)\}/g,"@S{$1}"),e=e.replace(/@TS-(\d+)/g,(o,i)=>`@S${parseInt(i,10)}.C1`),e=e.replace(/@TS(\d+)/g,(o,i)=>`@S${parseInt(i,10)}`),e=e.replace(/\\n/g,`
|
|
3
3
|
`),e}var c=p(f(),1),S=t=>t!==void 0&&/[A-Za-z0-9]/.test(t);function x(t){let e=[],o="",i=()=>{o&&(e.push({text:o}),o="")},d=(a,l,r)=>(a===0||!S(t[a-1]))&&(l+r>=t.length||!S(t[l+r])),n=0;for(;n<t.length;){let a=t.slice(n,n+2),l=t[n];if(a==="**"||a==="__"){let r=t.indexOf(a,n+2);if(r!==-1&&r>n+2&&(a==="**"||d(n,r,2))){i(),e.push({text:t.slice(n+2,r),bold:!0}),n=r+2;continue}}if(l==="`"){let r=t.indexOf("`",n+1);if(r!==-1&&r>n+1){i(),e.push({text:t.slice(n+1,r),code:!0}),n=r+1;continue}}if(l==="*"||l==="_"){let r=t.indexOf(l,n+1);if(r!==-1&&r>n+1&&(l==="*"||d(n,r,1))){i(),e.push({text:t.slice(n+1,r),italic:!0}),n=r+1;continue}}o+=l,n+=1}return i(),e.length===0&&e.push({text:""}),e}function h(t){return t.map((e,o)=>(0,c.jsx)(s,{bold:e.bold,italic:e.italic,color:e.code?u.dim:void 0,children:e.text},o))}function T(t){return t.split(`
|
|
4
4
|
`).map(e=>{if(e.trim()==="")return{kind:"blank"};let o=e.match(/^\s*[-*+]\s+(.*)$/);if(o)return{kind:"bullet",segs:x(o[1])};let i=e.match(/^\s*(\d+)\.\s+(.*)$/);if(i)return{kind:"numbered",n:i[1],segs:x(i[2])};let d=e.match(/^#{1,6}\s+(.*)$/);return d?{kind:"heading",segs:x(d[1])}:{kind:"para",segs:x(e)}})}function R(t,e,o=""){switch(t.kind){case"blank":return(0,c.jsx)(s,{children:o||" "},e);case"heading":return(0,c.jsxs)(s,{bold:!0,children:[o,h(t.segs)]},e);case"bullet":return(0,c.jsx)(m,{marginLeft:1,children:(0,c.jsxs)(s,{children:[o,"\u2022 ",h(t.segs)]})},e);case"numbered":return(0,c.jsx)(m,{marginLeft:1,children:(0,c.jsxs)(s,{children:[o,`${t.n}. `,h(t.segs)]})},e);default:return(0,c.jsxs)(s,{children:[o,h(t.segs)]},e)}}function $({text:t,accent:e=u.generateAccent}){let o=T(B(t)),{stdout:i}=b(),d=i?.columns??80;return(0,c.jsxs)(m,{marginBottom:1,children:[(0,c.jsx)(m,{width:2,flexShrink:0,children:(0,c.jsx)(s,{color:e,children:"\u2503"})}),(0,c.jsx)(m,{flexDirection:"column",width:d-2,children:o.map((n,a)=>R(n,a))})]})}var g=p(f(),1),I=5;function C({thinking:t,expanded:e,thinkingDone:o,maxLines:i=I}){if(!e)return(0,g.jsxs)(m,{paddingX:1,children:[(0,g.jsx)(s,{color:u.dim,children:o?"\u2237 thinking complete ":"\u2237 thinking\u2026 "}),(0,g.jsx)(s,{color:u.muted,children:o?"(ctrl+t to view)":"(ctrl+t to show)"})]});let d=t.split(`
|
|
5
5
|
`),n=Math.max(0,d.length-i),a=n>0?d.slice(-i).join(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{
|
|
2
|
+
import{a as _}from"./chunk-TDPWFYTJ.js";import{b as m}from"./chunk-L5LI2JF4.js";import{c as h}from"./chunk-ZUGCHQFC.js";import{randomUUID as F}from"crypto";import{mkdirSync as A,writeFileSync as v,appendFileSync as O,existsSync as b}from"fs";import{join as u}from"path";import{writeFileSync as x,mkdirSync as I,existsSync as j}from"fs";import{join as p,relative as L}from"path";function f(n){let t=Object.keys(n.frontmatter).length>0?m(n.frontmatter).trimEnd():"",s=["---"];return t&&s.push(t),s.push("---",""),s.push(`# ${n.heading}`,""),n.steps.forEach((i,r)=>{s.push(`## Step ${r+1}`,i,"")}),s.join(`
|
|
3
3
|
`)}function T(n,e){let t={},s={},i=e;for(let[r,l]of Object.entries(n)){if(r.startsWith("global.")||r.startsWith("secrets.user.")||r.startsWith("environment.")){let o=r.startsWith("secrets.user.");t[r]={value:l.value,secret:o,syntax:`{{${r}}}`,type:o?"secret":r.startsWith("environment.")?"environment":"global"},s[r]=r;continue}if(l.secret){let o=`secrets.user.${r}`;t[o]={value:l.value,secret:!0,syntax:`{{secrets.user.${r}}}`,type:"secret"},s[r]=o,i=i.replaceAll(`{{${r}}}`,`{{secrets.user.${r}}}`)}else{let o=`global.${r}`;t[o]={value:l.value,secret:!1,syntax:`{{global.${r}}}`,type:"global"},s[r]=o,i=i.replaceAll(`{{${r}}}`,`{{global.${r}}}`)}}return{variables:t,objective:i,keyMap:s}}var w=/\{\{\s*(?:global|secrets\.user|environment)\.([^{}]+?)\s*\}\}/g;function c(n){return typeof n!="string"||!n.includes("{{")?n:n.replace(w,"{{$1}}")}function d(n){if(typeof n=="string")return c(n);if(Array.isArray(n))return n.map(e=>d(e));if(n&&typeof n=="object"){let e={};for(let[t,s]of Object.entries(n))e[t]=d(s);return e}return n}var N=new Set(["username","access_key","oauth","profile","project_id","folder_id"]),$=new Set(["model","env"]),g=class{constructor(e){this.opts=e}objectives=[];flushed=!1;lastWrittenPath=null;lastCollisionSuffixed=!1;appendObjective(e){this.objectives.push(e)}flush(){if(this.flushed||(this.flushed=!0,this.objectives.length===0))return;let e=this.opts.getName();if(!e)return;let t=p(this.opts.cwd,".testmuai","tests");try{I(t,{recursive:!0})}catch(a){process.stderr.write(`
|
|
4
4
|
\u26A0 Failed to create ${L(this.opts.cwd,t)}/
|
|
5
5
|
${a.message}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as f}from"./chunk-
|
|
2
|
+
import{a as f}from"./chunk-VHZ4S57N.js";import{y as t}from"./chunk-ZUGCHQFC.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as r,b as n}from"./chunk-C44QQJR4.js";import{a as B}from"./chunk-6YGTRKDT.js";import{e as p}from"./chunk-UR6MHSHU.js";var c=p(B(),1);var e=p(x(),1);function v(){return[{name:"convert",label:"Converting session data",status:"pending"},{name:"zip",label:"Compressing artifacts",status:"pending"},{name:"presign",label:"Requesting upload URLs",status:"pending"},{name:"upload",label:"Uploading to KaneAI",status:"pending"},{name:"atomic_replace",label:"Replacing local output",status:"pending"},{name:"commit_lock",label:"Committing to TMS",status:"pending"},{name:"finalize",label:"Finalizing test case",status:"pending"},{name:"code_export",label:"Downloading test code",status:"pending"}]}function U(s,o,d,a){return s.map(l=>l.name===o?{...l,status:d,detail:a}:l)}function R(s){let o=s/1e3;if(o<60)return`${o.toFixed(1)}s`;let d=Math.floor(o/60),a=Math.round(o%60);return`${d}m ${a}s`}function D(s){let[o,d]=(0,c.useState)(0),a=c.default.useRef(Date.now());return(0,c.useEffect)(()=>{if(!s)return;a.current=Date.now();let l=setInterval(()=>{d(Date.now()-a.current)},100);return()=>clearInterval(l)},[s]),o}function h({steps:s,status:o,testUrl:d,error:a}){let l=D(o==="uploading");return o==="uploading"?(0,e.jsxs)(r,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(r,{children:[(0,e.jsx)(n,{color:t.orange,children:"\u2601 "}),(0,e.jsx)(n,{color:t.orange,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dim,children:[" ",R(l)]})]}),(0,e.jsx)(r,{flexDirection:"column",marginTop:1,children:s.filter(i=>i.status!=="skipped").map((i,S,T)=>{let b=S===T.length-1?"\u2514\u2500":"\u251C\u2500",u=i.status==="done",m=i.status==="running",g=i.status==="failed";return(0,e.jsxs)(r,{children:[(0,e.jsxs)(n,{color:t.dim,children:[" ",b," "]}),(0,e.jsx)(r,{width:3,children:m?(0,e.jsx)(f,{}):u?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):g?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:u?t.dim:m?void 0:g?t.red:t.muted,children:i.label}),i.detail&&(0,e.jsxs)(n,{color:t.dim,children:[" ",i.detail]})]},i.name)})}),(0,e.jsx)(r,{marginTop:1,children:(0,e.jsx)(n,{color:t.muted,children:" press Ctrl+C twice to force exit"})})]}):o==="success"?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)(r,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(r,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),a&&(0,e.jsxs)(r,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dim,children:" "}),(0,e.jsx)(n,{color:t.dim,children:a})]})]})}export{v as a,U as b,h as c};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as xe,b as ye}from"./chunk-VAYBKR76.js";import{a as oe,b as q,d as ae}from"./chunk-CUM23TLF.js";import{a as Ne,b as Ee,f as ue,i as X}from"./chunk-DUAXZYAD.js";import{d as Z,e as b,f as se,g as ne,h as _e}from"./chunk-WXHQYYD5.js";function ke(r,s){let t=r.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");if(t.length>60){let o=t.lastIndexOf("-",60);t=(o>0?t.slice(0,o):t.slice(0,60)).replace(/-+$/g,"")}if(!de.test(t))return null;let e=t;for(let o=2;s(e);o++)e=`${t}-${o}`;return de.test(e)?e:null}var Ae={source:"src",usecase:"uc",scenario:"sc",ac:"ac",test:"t",gap:"gap",stylenote:"sty"};function Ye(r,s,t){let e=Ae[r];return ke(e?`${e} ${s}`:s,t)}var De={usecase:"uc",scenario:"sc",ac:"ac",test:"t",gap:"gap",stylenote:"sty"},Re=/^(uc|sc|ac|t|gap|sty)-\d+$/i;function Oe(r,s,t){let e=De[r];if(!e)return null;let o=new RegExp(`^${e}-(\\d+)$`),u=0;for(let a of t){let g=o.exec(a);if(!g)continue;let n=Number(g[1]);Number.isSafeInteger(n)&&n>u&&(u=n)}let d=u+1;for(;s(`${e}-${d}`);)d+=1;return`${e}-${d}`}var Me=/^L([1-9]\d*)-L([1-9]\d*)$/,Ve=/^img#(p[1-9]\d*-[1-9]\d*|i[1-9]\d*)$/;function le(r){if(r==="img#whole")return{kind:"img-whole"};let s=Ve.exec(r);if(s)return{kind:"img-part",ref:s[1]};let t=Me.exec(r);return t?{kind:"lines",a:parseInt(t[1],10),b:parseInt(t[2],10)}:null}function Pe(r,s){let t=/^L(\d+)-L(\d+)$/.exec(s);if(!t)return null;let e=parseInt(t[1],10),o=parseInt(t[2],10),u=r.split(`
|
|
3
|
+
`);return e<1||o<e||o>u.length?null:u.slice(e-1,o).map(d=>d.replace(/^\d+\| /,"")).join(`
|
|
4
|
+
`)}function be(r,s,t){let e=le(s.anchor);if(r.format==="image")return e?.kind==="img-whole"?[]:[{code:"CITE_ANCHOR_INVALID",detail:`image cites are anchor-only (img#whole), got ${s.anchor}`}];if(e?.kind==="img-part")return new Set((r.images??[]).map(d=>d.ref)).has(e.ref)?[]:[{code:"CITE_ANCHOR_INVALID",detail:`anchor ${s.anchor} names no embedded image of this source version`}];if(!s.anchor||s.quote===void 0||s.quote==="")return[{code:"MISSING_CITE",detail:"text-kind cites need anchor+quote"}];let o=t!==null?Pe(t,s.anchor):null;return o===null?[{code:"BAD_ANCHOR",detail:`anchor ${s.anchor} does not resolve in the source`}]:o.includes(s.quote)?[]:[{code:"QUOTE_MISMATCH",detail:`quote is not verbatim within ${s.anchor}`}]}import{existsSync as Ge,readFileSync as Le}from"fs";function nt(r){let s=ye(r),t=new Map(Object.entries(s.heads)),e=new Map(Object.entries(s.trust)),o=new Map(Object.entries(s.nodeLabel)),u=new Map(Object.entries(s.superseded)),d=new Map(Object.entries(s.names)),a=new Map(Object.entries(s.archivedReason)),g=new Set(s.appliedEvents),n=new Map(Object.entries(s.conv)),_=p=>s.media[p]??{format:"text",media_type:"text/plain",anchors_supported:["L-L"]},h=new Map;for(let[p,E]of d)h.set(E,p);let c=new Map,C=p=>{if(c.has(p))return c.get(p);if(!o.has(p))return c.set(p,null),null;let E=xe(r,p);if(!Ge(E))throw new Ne(`derived node file missing for ${p} \u2014 run kane-cli context rebuild`);let I=JSON.parse(Le(E,"utf8"));return c.set(p,I),I},N=p=>{let E=p,I=new Set;for(;u.has(E)&&!I.has(E);){I.add(E);let O=u.get(E);if(typeof O!="string")break;E=O}return E},x=null,z=p=>{let E=h.get(p);if(E!==void 0)return E;if(x===null){x=new Map;for(let[L,k]of u)typeof k=="string"&&x.set(k,L)}let I=new Set,O=p;for(;!I.has(O);){I.add(O);let L=x.get(O);if(L===void 0)return null;let k=h.get(L);if(k!==void 0)return k;O=L}return null},Q=p=>{Re.test(p)&&(p=p.toLowerCase());let E=t.get(p),I=o.has(p)?p:d.get(p)??(typeof E=="string"?E:void 0);if(I===void 0||!o.has(I))return null;let O=N(I);return{cid:I,tip:O,superseded:u.has(I)||u.has(O)}},G=new Map;for(let p of Object.values(s.forward))for(let E of p){let I=G.get(E.dst);I?I.push(E):G.set(E.dst,[E])}let w=p=>(p??[]).filter(E=>!u.has(E.ecid)),ee=p=>w(G.get(p)),F=p=>ee(p).filter(E=>E.type===b.DERIVES),te=p=>w(s.forward[p]).some(E=>ne(E.type)?.pin?.comparesTo==="dst_tip"&&u.has(E.dst)),re=p=>{if(u.has(p))return"superseded";let E=F(p);if(E.length===0)return te(p)?"stale":"fresh";let I=new Map;for(let k of E)I.set(k.props.source_id,k);let O=!1,L=!1;for(let[k,D]of I){let J=t.get(k);if(J!=null&&(O=!0,J!==D.props.source_cid)){let i=n.get(k)?.chain;(!i||!i.includes(D.props.source_cid))&&(L=!0)}}return O?L||te(p)?"stale":"fresh":"orphaned"};return{heads:t,trust:e,nodeLabel:o,superseded:u,names:d,nameOf:h,archivedReason:a,appliedEvents:g,convChains:n,mediaOf:_,extractedSourceCids:new Set(s.extracted),extractionCompleteness:new Map(Object.entries(s.completeness??{}).map(([p,{seq:E,...I}])=>[p,I])),designOf:new Map(Object.entries(s.design_of??{})),designGenerationOf:new Map(Object.entries(s.design_generation??{})),latestHash:s.applied.hash,lastSeq:s.applied.seq,hasNode:p=>o.has(p),getNode:C,byLabel:p=>[...o.entries()].filter(([,E])=>E===p).map(([E])=>({cid:E,content:C(E)?.content??{}})),edgesFrom:p=>w(s.forward[p]),edgesInto:ee,derivesInto:F,resolve:Q,tipOf:N,displayNameOf:z,stale:re,staleList:()=>[...o.keys()].map(p=>({cid:p,state:re(p)})).filter(p=>p.state!=="fresh"),execHistory:p=>{let E=Q(p);if(!E)return[];let I=N(E.cid),O=new Set([I]),L=!0;for(;L;){L=!1;for(let[D,J]of u)J!==null&&O.has(J)&&!O.has(D)&&(O.add(D),L=!0)}let k=[];for(let D of Object.entries(s.exec??{}))O.has(D[0])&&k.push(...D[1]);return k.sort((D,J)=>D.started_at<J.started_at?-1:1)}}}function ot(r,s){if(r.stale(s)!=="stale")return!1;let t=new Map;for(let e of r.derivesInto(s))t.set(e.props.source_id,e);for(let[e,o]of t){let u=r.heads.get(e);if(u==null||u===o.props.source_cid)continue;let d=r.convChains.get(e)?.chain;if(!d||!d.includes(o.props.source_cid))return!0}for(let e of r.edgesFrom(s)){if(ne(e.type)?.pin?.comparesTo!=="dst_tip"||!r.superseded.has(e.dst))continue;let o=r.tipOf(e.dst);if(r.superseded.has(o)||r.nodeLabel.get(o)==="usecase")return!0}return!1}function pe(r,s){let t=new Map;for(let[d,a]of r.superseded)typeof a=="string"&&a!==d&&t.set(a,[...t.get(a)??[],d]);let e=[],o=[s],u=new Set;for(;o.length>0;){let d=o.pop();u.has(d)||(u.add(d),e.push(d),o.push(...t.get(d)??[]))}return e}function Ue(r,s){return(r.extraction_claims??[]).some(t=>t.source_id===s&&t.completeness==="complete")}function Fe(r,s){let t=new Set;for(let e of pe(r,s))for(let o of r.derivesInto(e))t.add(o.props?.source_id??"conversation");return t}function ve(r,s){let t=[],e=[],o=r.archived??[];if(o.length===0)return{valid:t,errors:e};let u=new Set([...r.source?[r.source.source_id]:[],...(r.sources??[]).map(a=>a.source_id)]),d=new Set;for(let a of r.use_cases){if(!a.matches_existing)continue;let g=s.resolve(a.matches_existing.cid);g&&d.add(s.tipOf(g.cid))}for(let a of o){let g=`archived[${a.target}]`,n=s.resolve(a.target),_=n?s.tipOf(n.cid):null;if(!_||(s.trust.get(_)??null)==="archived"){e.push({code:"ARCHIVE_TARGET_UNKNOWN",detail:`${g}: target does not resolve to an existing, live item`});continue}let h=Fe(s,_);if(!h.has(a.basis)){e.push({code:"ARCHIVE_FOREIGN_PROVENANCE",detail:`${g}: its provenance does not include ${a.basis} \u2014 an archive claim must come from a source that evidences the item`});continue}if(!u.has(a.basis)){e.push({code:"ARCHIVE_WITHOUT_COMPLETE_CLAIM",detail:`${g}: ${a.basis} was not read by this extraction \u2014 a completeness claim only counts for a source this run actually read`});continue}if(!Ue(r,a.basis)){e.push({code:"ARCHIVE_WITHOUT_COMPLETE_CLAIM",detail:`${g}: archiving needs an EXPLICIT complete extraction claim for ${a.basis} (the omitted-claims default does not count) \u2014 add extraction_claims`});continue}if(d.has(_)){e.push({code:"ARCHIVE_TARGET_MATCHED",detail:`${g}: this proposal also matches the target via matches_existing \u2014 a matched item cannot be archived by the same extraction; propose the change as an update instead`});continue}let c=[...h].filter(C=>C!==a.basis);if(c.length>0){e.push({code:"ARCHIVE_OTHER_LIVE_EVIDENCE",detail:`${g}: still evidenced by ${c.join(", ")} \u2014 an item another live source evidences is never archived from here`});continue}t.push({op:a,cid:_})}return{valid:t,errors:e}}var de=/^[a-z0-9][a-z0-9-]{1,63}$/;function we(r,s,t,e){if(!s)return{error:{code:"SUPERSEDE_TARGET_MISSING",detail:"supersede verdict needs a target (slug or cid)"}};let o=r.resolve(s);return o?o.superseded||e.has(o.cid)?{error:{code:"ALREADY_SUPERSEDED",detail:`${s} is already superseded (tip: ${o.tip})`}}:o.cid===t?{error:{code:"SELF_SUPERSEDE",detail:"a node cannot supersede itself"}}:{targetCid:o.cid}:{error:{code:"UNKNOWN_SUPERSEDE_TARGET",detail:`${s} names nothing in the graph`}}}function He(r,s,t,e,o=[]){if(!ne(s)?.acyclic)return null;if(t===e)return{code:"EDGE_CYCLE",detail:`${s} ${t} \u2192 itself`};let d=n=>[...r.edgesFrom(n).filter(_=>_.type===s).map(_=>_.dst),...o.filter(_=>_.type===s&&_.src===n).map(_=>_.dst)],a=new Set,g=[e];for(;g.length>0;){let n=g.pop();if(n===t)return{code:"EDGE_CYCLE",detail:`${s} ${t} \u2192 ${e} closes a cycle`};a.has(n)||(a.add(n),g.push(...d(n)))}return null}function vt(r,s,t,e){let u=ne(s)?.cardinality;if(u!=="one-live-per-src"&&u!=="one-live-per-src-and-dst")return null;let d=r.edgesFrom(t).filter(a=>a.type===s&&!r.superseded.has(a.dst));if(d.length>0)return{code:"CARDINALITY_VIOLATION",detail:`${s} from ${t} already has a live edge (${d[0].ecid}) \u2014 supersede it first`};if(u==="one-live-per-src-and-dst"&&e!==void 0){let a=r.edgesInto(e).filter(g=>g.type===s&&!r.superseded.has(g.src));if(a.length>0)return{code:"CARDINALITY_VIOLATION",detail:`${s} onto ${e} already has a live edge (${a[0].ecid}) \u2014 strict 1:1, supersede it first`}}return null}var Se=new Set(["high","med","low"]),fe=r=>r.cites&&r.cites.length>0?r.cites:[r.cite];function ge(r){let s=0;for(let t of r)typeof t=="object"&&t!==null&&"op"in t&&s++;return s===0?"flat":s===r.length?"ops":"mixed"}var qe=/^c[1-9][0-9]*$/;function Te(r,s,t,e){let o=new Map,u=[],d=[];for(let[g,n]of s.entries()){let _=`${r}.updated.criteria[${g}]`;if(n.op==="keep"||n.op==="remove"){if(!qe.test(n.ref??"")){e.push({code:"CRITERIA_REF_UNKNOWN",detail:`${_}: ref ${JSON.stringify(n.ref)} is not a c<N> criterion index`});continue}if(o.has(n.ref)){e.push({code:"CRITERIA_REF_DUPLICATE",detail:`${_}: ${n.ref} is already named by another op \u2014 every prior criterion appears in exactly one keep or remove`});continue}o.set(n.ref,n);let h=Number.parseInt(n.ref.slice(1),10);if(h>t.length){e.push({code:"CRITERIA_REF_UNKNOWN",detail:`${_}: ${n.ref} \u2014 the live target has ${t.length} criteria`});continue}if(t[h-1]!==n.text){e.push({code:"CRITERIA_REF_MISMATCH",detail:`${_}: ${n.ref} echo mismatch \u2014 the live target's criterion ${h} reads ${JSON.stringify(t[h-1])}, the op echoed ${JSON.stringify(n.text)} \u2014 re-read the node and re-emit`});continue}n.op==="remove"&&(u.push(n.text),(!n.reason||!n.reason.trim())&&e.push({code:"EMPTY_REASON",detail:`${_}: a remove op carries its reason`}))}else!n.text||!n.text.trim()?e.push({code:"EMPTY_CRITERION",detail:`${_}: set text is empty`}):d.push(n.text)}let a=[];for(let g=1;g<=t.length;g++)o.has(`c${g}`)||a.push(`c${g}`);a.length>0&&e.push({code:"CRITERIA_PARTITION_INCOMPLETE",detail:`${r}: prior criteria ${a.join(", ")} named by no keep/remove op \u2014 every prior criterion must be kept or removed (with a reason)`});for(let g of u)d.includes(g)&&e.push({code:"CRITERIA_OP_CONFLICT",detail:`${r}: ${JSON.stringify(g)} is removed AND re-set in the same update \u2014 drop one of the two ops`})}function St(r,s,t){let e=[],o=r.sources??[r.source],u=new Map(o.map(n=>[n.source_id,n.source_cid])),d=new Map;if(typeof s=="string")d.set(r.source.source_id,{media:t.mediaOf(r.source.source_cid),numberedText:s});else for(let[n,_]of s)d.set(n,_);for(let n of o)t.hasNode(n.source_cid)||e.push({code:"MISSING_SOURCE_NODE",detail:`source ${n.source_id} (${n.source_cid}) is not a committed node \u2014 ingest it first`});let a=(n,_)=>{let h=_.source_id??r.source.source_id;if(!u.has(h)){e.push({code:"CITE_SOURCE_UNKNOWN",detail:`${n}: cite source ${JSON.stringify(h)} is not in read_basis`});return}let c=d.get(h);if(!c){e.push({code:"MISSING_SOURCE_NODE",detail:`${n}: no citable text available for source ${h}`});return}for(let C of be(c.media,_,c.numberedText))e.push({code:C.code,detail:`${n}: ${C.detail}`})},g=new Set;for(let n of r.use_cases){if(g.has(n.temp_ref)&&e.push({code:"DUP_TEMP_REF",detail:`duplicate temp_ref ${n.temp_ref}`}),g.add(n.temp_ref),(!n.title||!n.title.trim())&&e.push({code:"EMPTY_TITLE",detail:`${n.temp_ref}: title is empty`}),Se.has(n.risk)||e.push({code:"BAD_RISK",detail:`${n.temp_ref}: risk ${JSON.stringify(n.risk)} not in high|med|low`}),!n.cite||!n.cite.anchor)e.push({code:"MISSING_CITE",detail:`${n.temp_ref}: every derived use-case must carry a cite`});else for(let h of fe(n))a(n.temp_ref,h);n.matches_existing&&!t.hasNode(n.matches_existing.cid)&&e.push({code:"UNKNOWN_MATCH",detail:`${n.temp_ref}: matches_existing ${n.matches_existing.cid} is not in the graph`});for(let[h,c]of(n.criteria??[]).entries())(!c.text||!c.text.trim())&&e.push({code:"EMPTY_CRITERION",detail:`${n.temp_ref}.criteria[${h}]: text is empty`}),!c.cite||!c.cite.anchor?e.push({code:"MISSING_CITE",detail:`${n.temp_ref}.criteria[${h}]: every criterion carries its own cite`}):a(`${n.temp_ref}.criteria[${h}]`,c.cite);let _=n.updated?.criteria??[];if(_.length>0){let h=ge(_);if(h==="mixed")e.push({code:"CRITERIA_SHAPE_MIXED",detail:`${n.temp_ref}.updated.criteria mixes op-shaped (keep/set/remove) and {text, cite} entries \u2014 emit ONE shape for the whole array`});else if(h==="ops"){let c=_,C=n.matches_existing?We(t,n.matches_existing.cid):null;if(!C)e.push({code:"CRITERIA_REF_UNKNOWN",detail:`${n.temp_ref}: op-union criteria address a prior version \u2014 they need a resolvable matches_existing target`});else{let N=t.getNode(C.cid)?.content.criteria??[];Te(n.temp_ref,c,N,e)}for(let[N,x]of c.entries())x.op==="set"&&(!x.cite||!x.cite.anchor?e.push({code:"MISSING_CITE",detail:`${n.temp_ref}.updated.criteria[${N}]: a set op carries the proposing source's cite`}):a(`${n.temp_ref}.updated.criteria[${N}]`,x.cite))}else for(let[c,C]of _.entries())(!C.text||!C.text.trim())&&e.push({code:"EMPTY_CRITERION",detail:`${n.temp_ref}.updated.criteria[${c}]: text is empty`}),!C.cite||!C.cite.anchor?e.push({code:"MISSING_CITE",detail:`${n.temp_ref}.updated.criteria[${c}]: every updated criterion carries its own cite`}):a(`${n.temp_ref}.updated.criteria[${c}]`,C.cite)}}return e.push(...ve(r,t).errors),e}function je(r,s,t){return`${r}:${s}:${t}`}function Ke(r,s,t,e){let o=`${s}:${t}:`,u=0;for(let d of r.appliedEvents){if(!d.startsWith(o))continue;let a=d.slice(o.length);if(!/^\d+$/.test(a))continue;let g=Number.parseInt(a,10);g>u&&(u=g)}return Array.from({length:e},(d,a)=>je(s,t,u+1+a))}function We(r,s){let t=r.resolve(s);if(t===null)return null;let e=t.cid;if(r.superseded.has(e)){let o=r.tipOf(e);return r.superseded.has(o)?null:{cid:o,redirected:!0}}return{cid:e,redirected:!1}}function It(r){let{contextDir:s,graph:t,proposal:e,proposalId:o,verdicts:u,by:d,allowStaleBasis:a,extractorVersion:g,autoName:n}=r,_=ue(s);if(!a&&e.read_basis!==_)return{record:null,errors:[{code:"STALE_BASIS",detail:`proposal read_basis ${String(e.read_basis)} != latest ${String(_)}`}]};for(let i of e.sources??[e.source])if(!t.hasNode(i.source_cid))return{record:null,errors:[{code:"MISSING_SOURCE_NODE",detail:`source ${i.source_id} (${i.source_cid}) is not a committed node \u2014 ingest it first`}]};let h=new Map((e.sources??[e.source]).map(i=>[i.source_id,i.source_cid])),c=[],C=[],N=new Map,x=[],z=t.mediaOf(e.source.source_cid),Q=new Set,G=[],w=[],ee=[],F=[];for(let i of ve(e,t).valid)F.push({id:i.cid,kind:"pending_archive",resolution:"pending",edit:null,reason:i.op.reason,by:d});let te=[],re=[],p=new Set,E=new Set,I=(i,f,M)=>{let j=we(t,f.supersedeTarget,M,p);if("error"in j){c.push({code:j.error.code,detail:`${i}: ${j.error.detail}`});return}p.add(j.targetCid),te.push({kind:"node",old:j.targetCid,new:M,reason:f.reason??`superseded via review by ${d.id}`,by:d})};for(let i of e.use_cases){let f=u.get(i.temp_ref)??{resolution:"skipped"};Q.has(i.temp_ref)&&c.push({code:"DUP_TEMP_REF",detail:`duplicate temp_ref ${i.temp_ref}`}),Q.add(i.temp_ref),(!i.title||!i.title.trim())&&c.push({code:"EMPTY_TITLE",detail:`${i.temp_ref}: title is empty`}),Se.has(i.risk)||c.push({code:"BAD_RISK",detail:`${i.temp_ref}: risk ${JSON.stringify(i.risk)} not in high|med|low`});let M=le(i.cite?.anchor??""),j=i.cite?.source_id!==void 0&&h.has(i.cite.source_id)?t.mediaOf(h.get(i.cite.source_id)):z;if(j.format==="image"){if(M?.kind!=="img-whole"){c.push({code:i.cite?.anchor?"CITE_ANCHOR_INVALID":"MISSING_CITE",detail:`${i.temp_ref}: image cites are anchor-only (img#whole)`});continue}}else if(M?.kind==="img-part"){if(!(j.images??[]).some(m=>m.ref===M.ref)){c.push({code:"CITE_ANCHOR_INVALID",detail:`${i.temp_ref}: anchor ${i.cite?.anchor} names no embedded image of this source version`});continue}}else if(!i.cite||!i.cite.anchor||!i.cite.quote){c.push({code:"MISSING_CITE",detail:`${i.temp_ref}: every derived use-case must cite anchor+quote`});continue}f.resolution==="edited"&&f.edit&&(f.edit.title!==void 0&&!f.edit.title.trim()&&c.push({code:"EMPTY_TITLE",detail:`${i.temp_ref}: edited title is empty`}),f.edit.risk!==void 0&&!Se.has(f.edit.risk)&&c.push({code:"BAD_RISK",detail:`${i.temp_ref}: edited risk ${JSON.stringify(f.edit.risk)} invalid`}));let he=ae({title:f.edit?.title??i.title,description:i.description,summary:f.edit?.summary??i.summary,actors:i.actors,value:i.value,risk:f.edit?.risk??i.risk,...i.criteria&&i.criteria.length>0?{criteria:i.criteria.map(l=>l.text)}:{}}),$=oe("usecase",he),me=i.cite.source_id??e.source.source_id,Ie=h.get(me);if(i.cite.source_id!==void 0&&Ie===void 0){c.push({code:"CITE_SOURCE_UNKNOWN",detail:`${i.temp_ref}: cite source ${JSON.stringify(me)} is not in read_basis`});continue}let Y={source_id:me,source_cid:Ie??e.source.source_cid,anchor:i.cite.anchor,...i.cite.quote?{quote:i.cite.quote}:{}};if(i.matches_existing&&!t.hasNode(i.matches_existing.cid)){c.push({code:"UNKNOWN_MATCH",detail:`${i.temp_ref}: matches_existing ${i.matches_existing.cid} is not in the graph`});continue}let y=i.matches_existing?.cid??(t.hasNode($)?$:null);if(y&&t.superseded.has(y)){let l=t.tipOf(y);y=t.superseded.has(l)?null:l}if(y&&i.matches_existing&&(t.trust.get(y)??null)==="derived"){let l=i.updated?.criteria??[];if(i.changed&&l.length>0&&ge(l)==="ops"&&(f.resolution==="approved"||f.resolution==="edited")){c.push({code:"UC_UNREVIEWED",detail:`${i.temp_ref}: merge target ${y.slice(0,19)} is unreviewed (derived) \u2014 bless it first (kane-cli context review) and re-propose the merge`});continue}let m=(r.probeHits??[]).find(v=>v.tempRef===i.temp_ref&&v.candidateCid===y);x.push({tempRef:i.temp_ref,candidate_cid:y,score:m?.score??1,scorer:m?.scorer??"lexical_fallback"}),y=null}if(y){if(i.changed&&(f.resolution==="approved"||f.resolution==="edited")){let l=i.updated;if(!l||Object.keys(l).length===0){c.push({code:"CHANGED_NEEDS_PAYLOAD",detail:`${i.temp_ref}: changed:true needs an updated{...} payload naming the moved fields`});continue}let m=t.getNode(y)?.content??{},v=l.criteria??[],T=v.length>0?ge(v):"flat";if(T==="mixed"){c.push({code:"CRITERIA_SHAPE_MIXED",detail:`${i.temp_ref}.updated.criteria mixes op-shaped (keep/set/remove) and {text, cite} entries \u2014 emit ONE shape for the whole array`});continue}if(T==="ops"){let A=v,V=m.criteria??[],P=c.length;Te(i.temp_ref,A,V,c);for(let[ie,ce]of A.entries())ce.op==="set"&&(!ce.cite||!ce.cite.anchor)&&c.push({code:"MISSING_CITE",detail:`${i.temp_ref}.updated.criteria[${ie}]: a set op carries the proposing source's cite`});if(c.length>P)continue;let R=A.filter(ie=>ie.op!=="remove").map(ie=>ie.text),H=ae({title:f.edit?.title??l.title??String(m.title??i.title),...l.description??m.description?{description:l.description??m.description}:{},...f.edit?.summary??l.summary??m.summary?{summary:f.edit?.summary??l.summary??m.summary}:{},...l.actors??m.actors?{actors:l.actors??m.actors}:{},...l.value??m.value?{value:l.value??m.value}:{},risk:f.edit?.risk??l.risk??String(m.risk??i.risk),...R.length>0?{criteria:R}:{}}),K=oe("usecase",H);if(K!==y){for(let S of se("usecase",H))c.push({code:S.code,detail:`${i.temp_ref}: ${S.detail}`});G.push({cid:K,label:Z.USECASE,content:H});for(let S of fe(i)){let W=S.source_id??e.source.source_id,U=h.get(W);if(!U){c.push({code:"CITE_SOURCE_UNKNOWN",detail:`${i.temp_ref}: cite source ${JSON.stringify(W)} is not in read_basis`});continue}let B={source_id:W,source_cid:U,anchor:S.anchor,...S.quote?{quote:S.quote}:{}};w.push({ecid:q("DERIVES",U,K,B),type:b.DERIVES,src:U,dst:K,props:B})}let ce=pe(t,y).flatMap(S=>t.edgesInto(S)).filter(S=>S.type===b.DERIVES&&typeof S.props.claim=="string");for(let S of A){if(S.op!=="keep")continue;let W=new Set;for(let U of ce){let B=U.props;if(B.claim!==S.text)continue;let $e=`${B.source_id}|${B.source_cid}|${B.anchor}`;if(W.has($e))continue;W.add($e);let Ce={...U.props};w.push({ecid:q("DERIVES",U.src,K,Ce),type:b.DERIVES,src:U.src,dst:K,props:Ce})}}for(let S of A){if(S.op!=="set")continue;let W=S.cite.source_id??e.source.source_id,U=h.get(W);if(!U){c.push({code:"CITE_SOURCE_UNKNOWN",detail:`${i.temp_ref}: set cite source ${JSON.stringify(W)} is not in read_basis`});continue}let B={source_id:W,source_cid:U,anchor:S.cite.anchor,...S.cite.quote?{quote:S.cite.quote}:{},claim:S.text};w.push({ecid:q("DERIVES",U,K,B),type:b.DERIVES,src:U,dst:K,props:B})}for(let S of A)S.op==="remove"&&C.push({about:y,ref:S.ref,text:S.text,reason:S.reason});I(i.temp_ref,{resolution:"supersede",supersedeTarget:y,reason:f.reason??`criteria merge: ${e.source.source_id} (${A.filter(S=>S.op==="keep").length} kept, ${A.filter(S=>S.op==="set").length} set, ${A.filter(S=>S.op==="remove").length} removed)`},K),F.push({id:K,kind:"review-item",resolution:f.resolution,edit:f.resolution==="edited"?{...f.edit}:null,reason:null,by:d});continue}}else{let A=v.map(R=>typeof R=="string"?{text:R,cite:void 0}:R),V=ae({title:f.edit?.title??l.title??String(m.title??i.title),...l.description??m.description?{description:l.description??m.description}:{},...f.edit?.summary??l.summary??m.summary?{summary:f.edit?.summary??l.summary??m.summary}:{},...l.actors??m.actors?{actors:l.actors??m.actors}:{},...l.value??m.value?{value:l.value??m.value}:{},risk:f.edit?.risk??l.risk??String(m.risk??i.risk),...l.criteria?A.length>0?{criteria:A.map(R=>R.text)}:{}:m.criteria?{criteria:m.criteria}:{}}),P=oe("usecase",V);if(P!==y){for(let R of se("usecase",V))c.push({code:R.code,detail:`${i.temp_ref}: ${R.detail}`});G.push({cid:P,label:Z.USECASE,content:V}),w.push({ecid:q("DERIVES",Y.source_cid,P,Y),type:b.DERIVES,src:Y.source_cid,dst:P,props:Y});for(let R of A){if(!R.cite)continue;let H={source_id:e.source.source_id,source_cid:e.source.source_cid,anchor:R.cite.anchor,...R.cite.quote?{quote:R.cite.quote}:{},claim:R.text};w.push({ecid:q("DERIVES",H.source_cid,P,H),type:b.DERIVES,src:H.source_cid,dst:P,props:H})}I(i.temp_ref,{resolution:"supersede",supersedeTarget:y,reason:f.reason??`matches-but-changed: ${e.source.source_id} moved (${Object.keys(l).join(", ")})`},P),F.push({id:P,kind:"review-item",resolution:f.resolution,edit:f.resolution==="edited"?{...f.edit}:null,reason:null,by:d});continue}for(let R of A){if(!R.cite)continue;let H={source_id:e.source.source_id,source_cid:e.source.source_cid,anchor:R.cite.anchor,...R.cite.quote?{quote:R.cite.quote}:{},claim:R.text};w.push({ecid:q("DERIVES",H.source_cid,y,H),type:b.DERIVES,src:H.source_cid,dst:y,props:H})}}}if(i.changed&&f.resolution==="skipped"){let l=i.updated?.criteria??[];l.length>0&&ge(l)==="ops"&&F.push({id:y,kind:"pending_update",resolution:"pending",edit:{temp_ref:i.temp_ref,source_id:e.source.source_id,updated:i.updated},reason:i.change_note??null,by:d})}if(f.resolution!=="rejected"){for(let l of fe(i)){let m=l.source_id??e.source.source_id,v=h.get(m);if(!v){c.push({code:"CITE_SOURCE_UNKNOWN",detail:`${i.temp_ref}: cite source ${JSON.stringify(m)} is not in read_basis`});continue}let T={source_id:m,source_cid:v,anchor:l.anchor,...l.quote?{quote:l.quote}:{}};w.push({ecid:q("DERIVES",v,y,T),type:b.DERIVES,src:v,dst:y,props:T})}(f.resolution==="approved"||f.resolution==="edited"||f.resolution==="supersede")&&F.push({id:y,kind:"review-item",resolution:"approved",edit:null,reason:null,by:d}),f.resolution==="supersede"&&I(i.temp_ref,f,y)}continue}for(let l of se("usecase",he))c.push({code:l.code,detail:`${i.temp_ref}: ${l.detail}`});for(let l of _e(b.DERIVES,"source","usecase",Y))c.push({code:l.code,detail:`${i.temp_ref}: ${l.detail}`});G.push({cid:$,label:Z.USECASE,content:he}),N.set(i.temp_ref,$),w.push({ecid:q("DERIVES",Y.source_cid,$,Y),type:b.DERIVES,src:Y.source_cid,dst:$,props:Y});for(let l of fe(i).slice(1)){let m=l.source_id??e.source.source_id,v=h.get(m);if(!v){c.push({code:"CITE_SOURCE_UNKNOWN",detail:`${i.temp_ref}: cite source ${JSON.stringify(m)} is not in read_basis`});continue}let T={source_id:m,source_cid:v,anchor:l.anchor,...l.quote?{quote:l.quote}:{}};for(let A of _e(b.DERIVES,"source","usecase",T))c.push({code:A.code,detail:`${i.temp_ref}: ${A.detail}`});w.push({ecid:q("DERIVES",v,$,T),type:b.DERIVES,src:v,dst:$,props:T})}for(let l of i.criteria??[]){let m=l.cite.source_id??e.source.source_id,v=h.get(m);if(!v){c.push({code:"CITE_SOURCE_UNKNOWN",detail:`${i.temp_ref}: criterion cite source ${JSON.stringify(m)} is not in read_basis`});continue}let T={source_id:m,source_cid:v,anchor:l.cite.anchor,...l.cite.quote?{quote:l.cite.quote}:{},claim:l.text};w.push({ecid:q("DERIVES",T.source_cid,$,T),type:b.DERIVES,src:T.source_cid,dst:$,props:T})}for(let l of i.depends_on_hint??[]){let m=V=>V.toLowerCase().trim().replace(/\s+/g," "),v=null,T=t.resolve(l);if(T&&!T.superseded&&t.nodeLabel.get(T.cid)===Z.USECASE&&(v=T.cid),!v){for(let{cid:V,content:P}of t.byLabel(Z.USECASE))if(!t.superseded.has(V)&&m(String(P.title??""))===m(l)){v=V;break}}if(!v){let V=G.find(P=>P.label===Z.USECASE&&m(String(P.content.title??""))===m(l));V&&(v=V.cid)}!v||v===$||He(t,b.DEPENDS_ON,$,v,ee)||ee.some(V=>V.src===$&&V.dst===v)||(w.push({ecid:q(b.DEPENDS_ON,$,v,{reason:"extract hint"}),type:b.DEPENDS_ON,src:$,dst:v,props:{reason:"extract hint"}}),ee.push({src:$,dst:v,type:b.DEPENDS_ON}))}if((f.resolution==="approved"||f.resolution==="edited"||f.resolution==="supersede")&&t.superseded.get($)===null&&!p.has($)&&te.push({kind:"node",old:$,new:$,reason:`re-minted after tombstone via review by ${d.id}`,by:d}),n){let l=Oe("usecase",m=>E.has(m),t.names.keys());l!==null&&!t.nameOf.has($)&&(E.add(l),re.push({cid:$,slug:l,by:d}))}f.resolution==="approved"?F.push({id:$,kind:"review-item",resolution:"approved",edit:null,reason:null,by:d}):f.resolution==="edited"?F.push({id:$,kind:"review-item",resolution:"edited",edit:{...f.edit},reason:null,by:d}):f.resolution==="rejected"?F.push({id:$,kind:"review-item",resolution:"rejected",edit:null,reason:f.reason??null,by:d}):f.resolution==="supersede"&&(F.push({id:$,kind:"review-item",resolution:"approved",edit:null,reason:f.reason??null,by:d}),I(i.temp_ref,f,$))}if(c.length)return{record:null,errors:c};let O=new Date().toISOString(),L=(e.sources?.length??0)>1||(e.extraction_claims?.length??0)>0,k;if(L){let i=[];if(e.extraction_claims==null)i.push({source_id:e.source.source_id,source_cid:e.source.source_cid,completeness:"complete",...g?{extractor_version:g}:{},at:O});else{let f=new Map(e.extraction_claims.map(M=>[M.source_id,M.completeness]));for(let M of e.sources??[e.source]){let j=f.get(M.source_id)??null;j!==null&&i.push({source_id:M.source_id,source_cid:M.source_cid,completeness:j,...g?{extractor_version:g}:{},at:O})}}k=i}else k=e.source.source_cid;let D=[];for(let i of r.probeHits??[])D.push({...N.has(i.tempRef)?{new_cid:N.get(i.tempRef)}:{},candidate_cid:i.candidateCid,score:i.score,scorer:i.scorer,probe_basis:null});for(let i of x){let f=N.get(i.tempRef);D.some(M=>M.new_cid===f&&M.candidate_cid===i.candidate_cid)||D.push({...f!==void 0?{new_cid:f}:{},candidate_cid:i.candidate_cid,score:i.score,scorer:i.scorer,probe_basis:null})}return{record:X(s,{ts:O,proposal_id:o,...o!=null?{extraction_of:k}:{},...o!=null&&g?{extractor_version:g}:{},...C.length>0?{criteria_removed:C}:{},...D.length>0?{dedup_hits:D}:{},nodes:G,edges:w,review:F,supersessions:te,...re.length>0?{names:re}:{},...r.judgements&&r.judgements.length>0?{judgements:r.judgements}:{},...r.eventIds&&r.eventIds.length>0?{event_ids:r.eventIds}:r.sid?{event_ids:Ke(t,r.sid,"extract",1)}:{},...r.sid?{sid:r.sid}:{},source_head_moves:{}},{expectPrev:_}).record,errors:null}}function $t(r){let{contextDir:s,graph:t,verdicts:e,by:o}=r,u=[],d=[],a=[],g=[],n=new Set;for(let[h,c]of e){if(c.resolution==="skipped")continue;let C=t.resolve(h);if(!C){u.push({code:"UNKNOWN_NODE",detail:`${h} names nothing in the graph`});continue}if(C.superseded){u.push({code:"SUPERSEDED_TARGET",detail:`${h} is superseded \u2014 review the tip (${C.tip})`});continue}let N=C.cid;if(c.resolution==="approved")a.push({id:N,kind:"review-item",resolution:"approved",edit:null,reason:null,by:o});else if(c.resolution==="rejected")r.holdArchives?a.push({id:N,kind:"pending_archive",resolution:"pending",edit:null,reason:c.reason??null,by:o}):a.push({id:N,kind:"review-item",resolution:"rejected",edit:null,reason:c.reason??null,by:o});else if(c.resolution==="edited"){let x=t.getNode(N);if(!x){u.push({code:"UNKNOWN_NODE",detail:`${h}: node file unreadable`});continue}let z={...x.content,...c.edit?.title!==void 0?{title:c.edit.title}:{},...c.edit?.summary!==void 0?{summary:c.edit.summary}:{},...c.edit?.risk!==void 0?{risk:c.edit.risk}:{}},Q=se(x.label,z);if(Q.length>0){for(let w of Q)u.push({code:w.code,detail:`${h}: ${w.detail}`});continue}let G=oe(x.label,z);if(G===N){a.push({id:N,kind:"review-item",resolution:"approved",edit:null,reason:null,by:o});continue}d.push({cid:G,label:x.label,content:z}),n.add(N),g.push({kind:"node",old:N,new:G,reason:c.reason??"edited in review",by:o}),a.push({id:G,kind:"review-item",resolution:"edited",edit:{...c.edit},reason:null,by:o})}else if(c.resolution==="supersede"){let x=we(t,c.supersedeTarget,N,n);if("error"in x){u.push({code:x.error.code,detail:`${h}: ${x.error.detail}`});continue}n.add(x.targetCid),r.holdArchives?a.push({id:x.targetCid,kind:"pending_archive",resolution:"pending",edit:null,reason:`supersede by ${N}${c.reason?` \u2014 ${c.reason}`:""}`,by:o}):(g.push({kind:"node",old:x.targetCid,new:N,reason:c.reason??`superseded via review by ${o.id}`,by:o}),a.push({id:N,kind:"review-item",resolution:"approved",edit:null,reason:c.reason??null,by:o}))}}return u.length?{record:null,errors:u}:a.length===0&&g.length===0?{record:null,errors:[{code:"NO_VERDICTS",detail:"every item was skipped \u2014 nothing to commit"}]}:{record:X(s,{ts:new Date().toISOString(),proposal_id:null,nodes:d,edges:[],review:a,supersessions:g,source_head_moves:{}},{expectPrev:t.latestHash}).record,errors:null}}function Ct(r){let{contextDir:s,graph:t,survivor:e,merged:o,reason:u,by:d}=r,a=t.resolve(e),g=t.resolve(o);return a?g?a.superseded||g.superseded?{record:null,errors:[{code:"ALREADY_SUPERSEDED",detail:"a side of the pair is already superseded \u2014 the pair is drained"}]}:a.cid===g.cid?{record:null,errors:[{code:"SELF_SUPERSEDE",detail:"a pair cannot merge a node into itself"}]}:{record:X(s,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:g.cid,new:a.cid,reason:u??`pair merge: duplicate of ${e}`,by:d}],source_head_moves:{}},{expectPrev:t.latestHash}).record,errors:null}:{record:null,errors:[{code:"UNKNOWN_NODE",detail:`${o} names nothing in the graph`}]}:{record:null,errors:[{code:"UNKNOWN_NODE",detail:`${e} names nothing in the graph`}]}}function Nt(r){let{contextDir:s,graph:t,assignments:e,by:o}=r,u=[],d=[],a=new Set;for(let{ref:n,slug:_}of e){if(!de.test(_)){u.push({code:"BAD_SLUG",detail:`${JSON.stringify(_)} \u2014 slugs are kebab-case ${String(de)}`});continue}let h=t.resolve(n);if(!h){u.push({code:"UNKNOWN_REF",detail:`${n} names nothing in the graph`});continue}if(h.superseded){u.push({code:"SUPERSEDED_TARGET",detail:`${n} is superseded \u2014 name the tip instead (${h.tip})`});continue}let c=t.names.get(_);if(c!==void 0&&!t.superseded.has(c)&&c!==h.cid||a.has(_)){u.push({code:"SLUG_TAKEN",detail:`${_} already names ${c??"another node in this record"}`});continue}a.add(_),d.push({cid:h.cid,slug:_,by:o})}return u.length?{record:null,errors:u}:d.length===0?{record:null,errors:[{code:"NO_ASSIGNMENTS",detail:"nothing to name"}]}:{record:X(s,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[],names:d,source_head_moves:{}},{expectPrev:t.latestHash}).record,errors:null}}function xt(r){let{contextDir:s,graph:t,sourceId:e,reason:o,by:u}=r,d=t.heads.get(e);return d===void 0?{record:null,errors:[{code:"UNKNOWN_SOURCE",detail:`no source ${e} in the graph`}]}:d===null?{record:null,errors:[{code:"ALREADY_RETIRED",detail:`source ${e} is already retired`}]}:{record:X(s,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:d,new:null,reason:o??`retired source ${e}`,by:u}],source_head_moves:{[e]:null},names:[]},{expectPrev:t.latestHash}).record,errors:null}}function yt(r){let s=se("gap",r.content);if(s.length>0)return{ok:!1,refusal:`defer gap failed schema validation: ${s.map(u=>u.detail).join("; ")}`};let t=oe("gap",r.content),e={reason:"reconcile change deferred"},o=r.annotates?[{ecid:q(b.ANNOTATES,t,r.annotates,e),type:b.ANNOTATES,src:t,dst:r.annotates,props:e}]:[];for(let u=0;;u++)try{return X(r.contextDir,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:t,label:"gap",content:r.content}],edges:o,review:[],supersessions:[],source_head_moves:{}},{expectPrev:ue(r.contextDir)}),{ok:!0,cid:t}}catch(d){if(d instanceof Ee){if(u<3)continue;return{ok:!1,refusal:"concurrent activity kept moving the store \u2014 try the card again"}}throw d}}function Rt(r){let s=r.graph.byLabel("gap").filter(t=>t.content.kind==="reconcile_deferred"&&typeof t.content.uc=="string"&&r.graph.tipOf(t.content.uc)===r.targetTip&&(r.sourceId===void 0||t.content.basis?.source_id===void 0||t.content.basis.source_id===r.sourceId)&&!r.graph.superseded.has(t.cid)&&r.graph.trust.get(t.cid)!=="archived");if(s.length===0)return{resolved:0};for(let t=0;;t++)try{return X(r.contextDir,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:s.map(e=>({kind:"node",old:e.cid,new:r.resolvedBy,reason:"reconcile change resolved by a later verdict",by:r.by})),source_head_moves:{}},{expectPrev:ue(r.contextDir)}),{resolved:s.length}}catch(e){if(e instanceof Ee){if(t<3)continue;return{resolved:0}}throw e}}export{le as a,Pe as b,be as c,ve as d,de as e,He as f,vt as g,fe as h,ge as i,Te as j,St as k,je as l,Ke as m,We as n,It as o,$t as p,Ct as q,Nt as r,xt as s,yt as t,Rt as u,ke as v,Ae as w,Ye as x,Re as y,Oe as z,nt as A,ot as B,pe as C};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as w}from"./chunk-DNNZ353O.js";import{b as k}from"./chunk-
|
|
2
|
+
import{a as w}from"./chunk-DNNZ353O.js";import{b as k}from"./chunk-TH47OOBV.js";import{d as S,e as m}from"./chunk-WXHQYYD5.js";var a=(e,t,o=new Set)=>{let s=e.nameOf.get(t);if(s!==void 0)return s;if(o.has(t))return t;o.add(t);for(let[r,n]of e.superseded){if(n!==t)continue;let u=a(e,r,o);if(u!==r)return u}return t};function b(e,t){let o=e.stale(t);if(o==="fresh")return;if(o==="orphaned")return"orphaned \u2014 no live source evidences this item";let s=[],r=new Map;for(let n of e.derivesInto(t))r.set(String(n.props.source_id),n);for(let[n,u]of r){let i=e.heads.get(n);if(i==null||i===u.props.source_cid)continue;let c=e.convChains.get(n)?.chain;c&&c.includes(String(u.props.source_cid))||s.push(`DERIVES pin ${n}@${String(u.props.source_cid).slice(0,19)} broke \u2014 the source head moved`)}for(let n of e.edgesFrom(t)){if(n.type===m.DERIVES||!e.superseded.has(n.dst))continue;let u=e.tipOf(n.dst);if(e.superseded.has(u)){s.push(`${n.type} pin \u2192 ${a(e,n.dst)} \u2014 target retired`);continue}let i=D(e,n.dst,u);s.push(i.length>0?`${a(e,n.dst)} updated: ${i.map(c=>c.field).join(", ")}`:`${n.type} pin \u2192 ${a(e,n.dst)} \u2014 target superseded`)}return s.length>0?s.join("; "):"stale \u2014 a pinned dependency moved"}function D(e,t,o){let s=e.getNode(t)?.content??{},r=e.getNode(o)?.content??{},n=i=>i===void 0?"":Array.isArray(i)?i.map(String).join(" \xB7 "):typeof i=="object"?JSON.stringify(i):String(i),u=[];for(let i of[...new Set([...Object.keys(s),...Object.keys(r)])].sort())JSON.stringify(s[i])!==JSON.stringify(r[i])&&u.push({field:i,old:n(s[i]),new:n(r[i])});return u}function C(e,t){let o=[];for(let{cid:s}of e.byLabel(S.SCENARIO))e.superseded.has(s)||e.edgesFrom(s).some(r=>r.type===m.BELONGS_TO&&e.tipOf(r.dst)===t)&&o.push(s);return o}function O(e,t){let o=[],s=[],r=[],n=C(e,t),u=new Set(n),i=(c,f)=>{let d=b(e,f);return d===void 0?c:{...c,stale:!0,stale_reason:d}};for(let c of n){let f=e.getNode(c)?.content??{};o.push(i({ref:a(e,c),title:String(f.title??""),case_type:String(f.case_type??""),intent:String(f.intent??"")},c));for(let d of e.edgesInto(c)){if(d.type!==m.AUTOMATES||e.superseded.has(d.src))continue;let p=e.getNode(d.src)?.content??{},g=e.edgesFrom(d.src).filter(l=>l.type===m.VERIFIES&&!e.superseded.has(l.dst)).map(l=>a(e,l.dst));s.push(i({ref:a(e,d.src),title:String(p.title??""),check:p.check,verifies:g},d.src))}}for(let{cid:c}of e.byLabel(S.AC)){if(e.superseded.has(c))continue;let f=e.edgesFrom(c).find(l=>l.type===m.SCOPED_TO);if(!f)continue;let d=e.tipOf(f.dst);if(!(d===t||u.has(d)))continue;let g=e.getNode(c)?.content??{};r.push(i({ref:a(e,c),text:String(g.text??""),kind:String(g.kind??""),scope:d===t?"use-case":a(e,d)},c))}return{scenarios:o,tests:s,acs:r}}function E(e,t,o){let s=w(e,t,o);return s===null?null:s.toString("utf8")}function v(e,t){let o=t.split(`
|
|
3
3
|
`).map(r=>r.replace(/^\d+\| /,"")),s=[];for(let r of e.split(`
|
|
4
4
|
`)){let n=r.trim();if(n.length===0)continue;let u=o.find(i=>i.includes(n));u!==void 0&&!s.includes(u.trim())&&s.push(u.trim())}return s.length>0?s.join(`
|
|
5
5
|
`):{removed:!0}}function G(e,t,o,s){if(s!==void 0&&s.trim().length>0)return{kind:"user-directive",text:s.trim()};let r=[o,...O(t,o).acs.map(c=>t.resolve(c.ref)?.cid??"")].filter(Boolean),n=[],u=new Set;for(let c of r){let f=new Map;for(let d of t.derivesInto(c))f.set(String(d.props.source_id),d);for(let[d,p]of f){let g=t.heads.get(d);if(g==null||g===p.props.source_cid)continue;let l=String(p.props.anchor),_=`${d}\0${l}`;if(u.has(_)||l==="img#whole")continue;u.add(_);let y=E(e,t,String(p.props.source_cid)),h=y===null?null:k(y,l);if(h===null)continue;let x=E(e,t,g);n.push({source_id:d,anchor:l,old_anchor_text:h,new_anchor_text:x===null?{removed:!0}:v(h,x)})}}let i;for(let[c,f]of t.superseded){if(f!==o||t.nodeLabel.get(c)!==S.USECASE)continue;let d=D(t,c,o);d.length>0&&(i=d);break}return{kind:"source-change",changes:n,...i?{uc_updated:i}:{}}}function P(e,t,o,s){let r=O(t,o);if(r.scenarios.length===0&&r.tests.length===0&&r.acs.length===0)return;let n=G(e,t,o,s);if(!(n.kind==="source-change"&&n.changes.length===0&&!n.uc_updated))return{prior_design:r,change_delta:n}}export{O as a,P as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as b}from"./chunk-
|
|
2
|
+
import{a as b}from"./chunk-4NFCAGRK.js";import{c as k}from"./chunk-RFHMDQXZ.js";import{a as C}from"./chunk-VT54ARGE.js";import{q as m,r as u,s as f,t as x,u as y}from"./chunk-ZUGCHQFC.js";import{createServer as S}from"http";import{randomBytes as A}from"crypto";import{URL as L}from"url";var P=class{profile;environment;creds;oauth;constructor(r="default",o="prod",e){this.profile=r,this.environment=o,this.creds=e??new C,this.oauth=new b(o)}async login(){let{server:r,port:o}=await this.startCallbackServer(),e=y(o);try{let t=this.creds.loadClient(this.profile,this.environment),i=t?.redirect_uris;(!t||!i?.includes(e))&&(t=await this.oauth.registerClient(e),this.creds.saveClient(this.profile,this.environment,t));let c=t.client_id,[h,d]=b.generatePkce(),a=A(32).toString("hex"),n=this.oauth.buildAuthorizationUrl(c,d,a,e),l=await this.waitForCallback(r,o,n,a);if(!l)throw new Error("Login cancelled or timed out");let p=await this.oauth.exchangeCode(l,c,h,e),g={access_token:p.access_token,refresh_token:p.refresh_token,expires_at:Math.floor(Date.now()/1e3)+p.expires_in,scope:p.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,g),this.creds.setActiveProfile(this.profile),g}catch(t){throw r.close(),t}}startCallbackServer(){return new Promise((r,o)=>{let e=u,t=()=>{let i=S();i.on("error",c=>{c.code==="EADDRINUSE"&&e<f?(e++,t()):o(new Error(`Failed to start callback server: ${c.message}. Ports ${u}-${f} are all in use.`))}),i.listen(e,m,()=>{r({server:i,port:e})})};t()})}waitForCallback(r,o,e,t){return new Promise(i=>{let c=!1,h=setTimeout(()=>d(null),12e4),d=a=>{c||(c=!0,clearTimeout(h),r.close(),i(a))};r.on("request",(a,n)=>{let l=new L(a.url??"/",`http://${m}:${o}`);if(l.pathname!==x){n.writeHead(404),n.end();return}let p=l.searchParams.get("state"),g=l.searchParams.get("code");if(l.searchParams.get("error")){n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),d(null);return}if(p!==t){n.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),d(null);return}n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),d(g)}),k(e).catch(a=>{let n=a instanceof Error?a.message:String(a);process.stderr.write(`[auth] Could not open browser: ${n}
|
|
3
3
|
Please open this URL manually: ${e}
|
|
4
4
|
`)})})}};function v(s){let r=s.state==="success",o=r?"#22c55e":"#ef4444",e=r?"rgba(34, 197, 94, 0.12)":"rgba(239, 68, 68, 0.12)",t=r?'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7"/></svg>':'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',i=s.autoClose?"<script>setTimeout(function(){try{window.close();}catch(e){}}, 1500);</script>":"";return`<!doctype html>
|
|
5
5
|
<html lang="en">
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{AsyncLocalStorage as o}from"async_hooks";var r=new o;function s(n,e){return r.run(n,e)}function a(n){let e=r.getStore()?.event;if(e){e(n);return}process.env.KANE_DEV_MODE==="1"&&process.stderr.write(JSON.stringify(n)+`
|
|
3
|
+
`)}function c(n,e){let t=r.getStore()?.event;if(t){t({type:"warning",message:n,...e?{code:e}:{}});return}process.stderr.write(n.endsWith(`
|
|
4
|
+
`)?n:n+`
|
|
5
|
+
`)}export{s as a,a as b,c};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as j}from"./chunk-CUM23TLF.js";import{a as v,d as N,g as C}from"./chunk-DUAXZYAD.js";import{a as y,e as S,f as D,g as F,h as L}from"./chunk-WXHQYYD5.js";import{existsSync as b,mkdirSync as V,readFileSync as $,renameSync as G,rmSync as J,writeFileSync as W}from"fs";import{dirname as H,join as w}from"path";var q=i=>w(i,"derived"),M=i=>w(q(i),"index.json");function T(i,s){let t=s.startsWith("sha256:")?s.slice(7):s;return w(q(i),"nodes",t.slice(0,2),t.slice(2)+".json")}function O(){return{applied:{seq:0,hash:null},heads:{},trust:{},nodeLabel:{},forward:{},extracted:[],design_of:{},design_generation:{},exec:{},superseded:{},names:{},archivedReason:{},appliedEvents:[],completeness:{},srcOwner:{},conv:{},media:{},design_phases:{}}}function U(i){let s=M(i);if(!b(s))return null;try{let t=JSON.parse($(s,"utf8"));return t.superseded===void 0||t.names===void 0||t.archivedReason===void 0||t.appliedEvents===void 0||t.conv===void 0||t.media===void 0||t.exec===void 0||t.completeness===void 0||t.srcOwner===void 0||t.design_phases===void 0||t.reverse!==void 0?null:t}catch{return null}}function P(i,s){V(H(i),{recursive:!0});let t=`${i}.tmp-${process.pid}`;W(t,s),G(t,i)}function R(i,s,t,p,_={}){let l=_.writeNodeFiles!==!1,g=new Set(s.extracted),h=new Set(s.appliedEvents);t.forEach((n,E)=>{for(let e of n.nodes){let d=T(i,e.cid);l&&!b(d)&&P(d,JSON.stringify({label:e.label,content:e.content})+`
|
|
3
|
+
`),!(e.cid in s.trust)&&e.content.derived===!0&&(s.trust[e.cid]="derived"),s.nodeLabel[e.cid]=e.label}for(let[e,d]of Object.entries(n.source_head_moves))typeof d=="string"&&(s.srcOwner[d]=e);if(n.proposal_id!=null&&typeof n.extraction_of=="string"){g.add(n.extraction_of);let e=null;for(let d of n.edges)if(d.type===S.DERIVES&&d.props.source_cid===n.extraction_of&&typeof d.props.source_id=="string"){e=d.props.source_id;break}if(e??=s.srcOwner[n.extraction_of]??null,e!==null){let d=s.completeness[e];(!d||n.seq>=d.seq)&&(s.completeness[e]={source_cid:n.extraction_of,completeness:"complete",...n.extractor_version?{extractor_version:n.extractor_version}:{},at:n.ts,seq:n.seq})}else s.completenessSkipped=(s.completenessSkipped??0)+1}else if(n.proposal_id!=null&&Array.isArray(n.extraction_of))for(let e of n.extraction_of){g.add(e.source_cid);let d=s.completeness[e.source_id];(!d||n.seq>=d.seq)&&(s.completeness[e.source_id]={source_cid:e.source_cid,completeness:e.completeness,...e.extractor_version?{extractor_version:e.extractor_version}:{},at:e.at,seq:n.seq})}n.design_of&&((s.design_of??={})[n.design_of.uc_cid]={engine:n.design_of.engine,seq:n.seq}),n.design_generation&&((s.design_generation??={})[n.design_generation.uc_root]={gen:n.design_generation.generation,seq:n.seq});{let e=n.design_phase;e&&typeof e.uc_root=="string"&&typeof e.phase=="string"&&typeof e.generation=="number"&&((s.design_phases??={})[e.uc_root]??=[]).push({phase:e.phase,generation:e.generation,seq:n.seq,completeness:e.completeness==="partial"?"partial":"complete"})}for(let e of n.executions??[])((s.exec??={})[e.about]??=[]).push(e);for(let e of n.edges){let{quote:d,...r}=e.props,o=s.forward[e.src]??=[];o.some(a=>a.ecid===e.ecid)||o.push({...e,props:r}),n.proposal_id!=null&&e.type===S.DERIVES&&typeof e.props.source_cid=="string"&&g.add(e.props.source_cid)}for(let e of n.review)e.resolution==="approved"||e.resolution==="edited"?(s.trust[e.id]="trusted",delete s.archivedReason[e.id]):e.resolution==="rejected"?(s.trust[e.id]="archived",e.reason?s.archivedReason[e.id]=e.reason:delete s.archivedReason[e.id]):e.resolution==="reset"&&(s.trust[e.id]="derived",delete s.archivedReason[e.id]);for(let e of n.supersessions)e.kind==="node"?e.new===e.old?delete s.superseded[e.old]:s.superseded[e.old]=e.new:s.superseded[e.ecid]=null;for(let e of n.names??[])s.names[e.slug]=e.cid;for(let[e,d]of Object.entries(n.source_head_moves))s.heads[e]=d;for(let e of n.event_ids??[])h.add(e);if(n.media)for(let[e,d]of Object.entries(n.media)){let r=n.source_head_moves[e];typeof r=="string"&&(s.media[r]=d)}if(n.conv){let e=n.source_head_moves[n.conv.source_id];if(typeof e=="string"){let d=s.conv[n.conv.source_id],r=d&&d.chain.length>0?d.chain[d.chain.length-1]:null;n.conv.append_of===r?s.conv[n.conv.source_id]={turns:n.conv.turn,chain:[...d?.chain??[],e]}:s.conv[n.conv.source_id]={turns:n.conv.turn,chain:[e]}}}for(let[e,d]of Object.entries(n.source_head_moves))n.conv?.source_id!==e&&s.conv[e]!==void 0&&(s.conv[e]=typeof d=="string"?{turns:s.conv[e].turns,chain:[d]}:{turns:s.conv[e].turns,chain:[]});s.applied={seq:n.seq,hash:p[E]}}),s.extracted=[...g].sort(),s.appliedEvents=[...h].sort()}function x(i,s){P(M(i),JSON.stringify(s)+`
|
|
4
|
+
`)}function K(i){let s=w(i,"meta.json");if(b(s))try{let t=JSON.parse($(s,"utf8"));if(t.schema!==y||t.canonicalizer!=="v1")throw new v(`schema fence: store is ${t.schema}/${t.canonicalizer}, this build is ${y}/${"v1"} \u2014 migrate explicitly (kane-cli context rebuild after upgrading)`)}catch(t){throw t instanceof v?t:new v(`corrupt meta.json in ${i} \u2014 fix or remove it`)}}function Y(i){K(i);let s=U(i);if(s===null){s=O();let{records:_,hashes:l}=N(i);return R(i,s,_,l),x(i,s),s}let{records:t,hashes:p}=C(i,s.applied.seq,s.applied.hash);return t.length>0&&(R(i,s,t,p),x(i,s)),s}function se(i){return J(q(i),{recursive:!0,force:!0}),Y(i)}var z=new Set(["CHAIN_ERROR","DERIVED_MISSING","DERIVED_DRIFT","NODE_FILE_MISSING","NODE_FILE_MISMATCH","NODE_FILE_CORRUPT"]);function ne(i){return z.has(i.code)?i.detail:`${i.code}: ${i.detail}`}function te(i){let s=[],t=(r,o)=>{s.push({code:r,detail:o})},p=[],_=[];try{({records:p,hashes:_}=N(i))}catch(r){return{ok:!1,issues:[{code:"CHAIN_ERROR",detail:r instanceof v?r.message:String(r)}],records:0}}let l=O();R(i,l,p,_,{writeNodeFiles:!1});let g=U(i),h=0,n=l;if(g!==null&&g.applied.seq<p.length){let r=g.applied.seq;g.applied.hash===(r===0?null:_[r-1])&&(h=p.length-r,n=O(),R(i,n,p.slice(0,r),_.slice(0,r),{writeNodeFiles:!1}))}if(g===null)t("DERIVED_MISSING","derived/index.json missing or corrupt (run kane-cli context rebuild)");else{let r=o=>JSON.stringify(k(o));for(let o of["applied","heads","trust","nodeLabel","forward","extracted","superseded","names","archivedReason","appliedEvents","conv","media","design_of","design_generation","design_phases","exec","completeness","srcOwner"])r(n[o])!==r(g[o])&&t("DERIVED_DRIFT",`derived drift in index.${o} (run kane-cli context rebuild)`)}let E=new Set;for(let r of Object.values(l.forward))for(let o of r)E.add(o.ecid);let e=new Set;for(let r of p)for(let o of r.supersessions)o.kind==="node"?(o.old in l.nodeLabel||t("SUPERSEDE_UNKNOWN_OLD",`${o.old} (record ${r.seq})`),o.new!==null&&o.new!==o.old&&!(o.new in l.nodeLabel)&&t("SUPERSEDE_UNKNOWN_NEW",`${String(o.new)} (record ${r.seq})`),o.new===o.old?e.delete(o.old):(e.has(o.old)&&t("DOUBLE_SUPERSEDE",`${o.old} re-superseded while live (record ${r.seq})`),e.add(o.old))):E.has(o.ecid)||t("SUPERSEDE_UNKNOWN_ECID",`${o.ecid} (record ${r.seq})`);for(let r of Object.keys(l.superseded)){let o=new Set,a=r;for(;a!==null&&a in l.superseded;){if(o.has(a)){t("SUPERSEDE_CYCLE",`chain from ${r} revisits ${a}`);break}o.add(a),a=l.superseded[a]}}for(let[r,o]of Object.entries(l.names))o in l.nodeLabel||t("NAME_UNKNOWN_TARGET",`slug ${r} \u2192 ${o} not in the graph`);for(let r of p)for(let o of r.edges){let a=l.nodeLabel[o.src]??"(unknown)",f=l.nodeLabel[o.dst]??"(unknown)";for(let c of L(o.type,a,f,o.props))t(c.code,`${o.ecid} ${c.detail}`)}let d=new Map;for(let r of Object.values(l.forward))for(let o of r){if(o.ecid in l.superseded)continue;let a=d.get(o.type)??[];a.push(o),d.set(o.type,a)}for(let[r,o]of d){let a=F(r);if(a?.acyclic){let f=new Map;for(let u of o)f.set(u.src,[...f.get(u.src)??[],u.dst]);let c=new Map,m=u=>{c.set(u,1);for(let I of f.get(u)??[])if(c.get(I)===1||c.get(I)===void 0&&m(I))return!0;return c.set(u,2),!1};for(let u of f.keys())if(c.get(u)===void 0&&m(u)){t("EDGE_CYCLE",`live ${r} edges form a cycle reachable from ${u}`);break}}if(a?.cardinality==="one-live-per-src"||a?.cardinality==="one-live-per-src-and-dst"){let f=new Map;for(let c of o)c.dst in l.superseded||f.set(c.src,[...f.get(c.src)??[],c]);for(let[c,m]of f)m.length>1&&t("CARDINALITY_VIOLATION",`${m.length} live ${r} edges from ${c} (one-live-per-src): ecids ${m.map(u=>u.ecid).join(",")}`)}if(a?.cardinality==="one-live-per-src-and-dst"){let f=new Map;for(let c of o)c.src in l.superseded||c.dst in l.superseded||f.set(c.dst,[...f.get(c.dst)??[],c]);for(let[c,m]of f)m.length>1&&t("CARDINALITY_VIOLATION",`${m.length} live ${r} edges onto ${c} (one-live-per-dst): ecids ${m.map(u=>u.ecid).join(",")}`)}}for(let[r,o]of Object.entries(n.nodeLabel)){let a=T(i,r);if(!b(a)){t("NODE_FILE_MISSING",`missing node file for ${r} (run kane-cli context rebuild)`);continue}try{let f=JSON.parse($(a,"utf8"));(f.label!==o||j(f.label,f.content)!==r)&&t("NODE_FILE_MISMATCH",`node file content mismatch for ${r} (run kane-cli context rebuild)`);for(let c of D(f.label,f.content))t(c.code,`${r} ${c.detail}`)}catch{t("NODE_FILE_CORRUPT",`corrupt node file for ${r} (run kane-cli context rebuild)`)}}return{ok:s.length===0,issues:s,records:p.length,...h>0?{pending:h}:{}}}function k(i){return Array.isArray(i)?i.map(k):i&&typeof i=="object"?Object.fromEntries(Object.entries(i).sort(([s],[t])=>s<t?-1:1).map(([s,t])=>[s,k(t)])):i}export{T as a,Y as b,se as c,ne as d,te as e};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as D}from"./chunk-CLGC7VEO.js";import{a as y}from"./chunk-YCCUBQY4.js";import{y as r}from"./chunk-ZUGCHQFC.js";import{a as B}from"./chunk-HCBYKLMW.js";import{a as p,b as t,i as _,k as C}from"./chunk-C44QQJR4.js";import{a as W}from"./chunk-6YGTRKDT.js";import{e as $}from"./chunk-UR6MHSHU.js";var a=$(B(),1);function G(e){let c=e.findIndex(d=>d.free);return c>=0?c:null}var F=60,N=100;function J({headline:e,ask:c=!1,rows:d,sel:i,focused:v,legend:s,freeText:f=null,freeTextNote:g,sublines:u=[]}){let{stdout:o}=C(),h=o?.columns??80,A=h<F,m=Math.min(h-1,N),b=l=>v&&i===l?(0,a.jsx)(t,{color:r.assuranceAccent,children:"\u276F"}):" ",x=c?`? ${e}`:e,R=Math.max(4,m-3),w=u.map((l,T)=>(0,a.jsx)(t,{color:r.dim,children:` ${l.length>R?`${l.slice(0,R-1)}\u2026`:l}`},`sub-${T}`)),k=0,E=d.map((l,T)=>l.free?f?(0,a.jsxs)(p,{flexDirection:"column",children:[(0,a.jsxs)(p,{children:[(0,a.jsxs)(t,{children:[(0,a.jsx)(t,{color:r.assuranceAccent,children:"\u276F"})," ",(0,a.jsx)(t,{color:r.dim,children:"\u270E "})]}),(0,a.jsx)(y,{value:f.value,onChange:f.onChange,onSubmit:f.onSubmit,onCancel:f.onCancel,placeholder:l.label})]}),g?(0,a.jsx)(t,{color:r.muted,children:` ${g}`}):null]},l.key):(0,a.jsxs)(t,{children:[b(T)," ",(0,a.jsx)(t,{color:r.dim,children:`\u270E ${l.label}`})]},l.key):(k+=1,(0,a.jsxs)(t,{bold:v&&i===T,children:[b(T),` ${k}. ${l.label}`,l.detail?(0,a.jsx)(t,{color:r.dim,bold:!1,children:` \u2014 ${l.detail}`}):null]},l.key)));if(A)return(0,a.jsxs)(p,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsx)(t,{bold:!0,color:r.assuranceAccent,children:x}),w,E,(0,a.jsx)(t,{color:r.muted,children:s})]});let M=Math.max(2,m-(3+x.length+1)),L=Math.max(2,m-(3+s.length+1));return(0,a.jsxs)(p,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,a.jsxs)(t,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,a.jsx)(t,{bold:!0,children:x}),` ${"\u2500".repeat(M)}`]}),w,(0,a.jsx)(t,{children:" "}),E,(0,a.jsx)(t,{children:" "}),(0,a.jsxs)(t,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,a.jsx)(t,{color:r.muted,children:s}),` ${"\u2500".repeat(L)}`]})]})}var S=$(B(),1),H="ctrl+t thinking \xB7 ctrl+c exit";function I(e,c){if(e.length<=c)return e;if(c<=1)return"\u2026";let d=Math.ceil((c-1)/2),i=Math.floor((c-1)/2);return`${e.slice(0,d)}\u2026${i>0?e.slice(-i):""}`}function te({verb:e,subject:c,pendingCount:d,creditsTotal:i,state:v,hints:s=H}){let{stdout:f}=C(),g=f?.columns??80,u=[];u.push(e),v&&u.push(v),i!==void 0&&u.push(`${i.toFixed(1)} credits`);let o=d?`[${d} pending]`:null,h=" \xB7 ",m=[...u,...o?[o]:[]].join(h).length,b,x=[...u,...c?[c]:[],...o?[o]:[],s].join(h);if(x.length<=g)b=x;else{let R=g-m-(c?h.length:0)-h.length-s.length;if(c&&R>=8)b=[...u,I(c,R),...o?[o]:[],s].join(h);else{let w=g-m-(c?h.length:0);b=[...u,...c&&w>=4?[I(c,w)]:[],...o?[o]:[]].join(h)}}if(v){let R=` \xB7 ${v}`,w=b.indexOf(R);if(w>=0)return(0,S.jsxs)(t,{color:r.dim,children:[b.slice(0,w+3),(0,S.jsx)(t,{color:r.assuranceAccent,children:v}),b.slice(w+R.length)]})}return(0,S.jsx)(t,{color:r.dim,children:b})}var O=$(W(),1);function re({onToggleThinking:e,onCtrlC:c,explorer:d,panel:i}){let s=(0,O.useRef)(null),f=(0,O.useRef)(""),g=()=>{s.current&&clearTimeout(s.current),s.current=null,f.current=""};return(0,O.useEffect)(()=>g,[]),_((u,o)=>{if(o.ctrl&&u==="t"){e();return}if(o.ctrl&&u==="c"){c();return}if(!o.ctrl&&u.includes("")){c();return}if(!o.ctrl&&u.includes("")){e();return}if(d&&d.isOpen()){let h=()=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{g(),d.onBack()},150)};if(s.current){if(o.upArrow||o.downArrow||o.return){g(),o.return?d.onEnter():d.onMove(o.upArrow?-1:1);return}if(f.current+=u,f.current==="["){h();return}let A=f.current;g();let m=/^\[([ABCD])/.exec(A);if(m){(m[1]==="A"||m[1]==="B")&&d.onMove(m[1]==="A"?-1:1);return}d.onBack();return}if(o.upArrow){d.onMove(-1);return}if(o.downArrow){d.onMove(1);return}if(o.return){d.onEnter();return}if(o.escape){f.current="",h();return}return}if(i&&i.isFocused()){let h=()=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{g(),i.onBack()},150)};if(s.current){if(o.upArrow||o.downArrow||o.return||o.leftArrow||o.rightArrow){g(),o.return?i.onSelect():o.leftArrow?i.onLeft?.():o.rightArrow?i.onRight?.():i.onMove(o.upArrow?-1:1);return}if(f.current+=u,f.current==="["){h();return}let A=f.current;g();let m=/^\[([ABCD])/.exec(A);if(m){m[1]==="A"||m[1]==="B"?i.onMove(m[1]==="A"?-1:1):m[1]==="C"?i.onRight?.():i.onLeft?.();return}i.onBack();return}if(o.upArrow){i.onMove(-1);return}if(o.downArrow){i.onMove(1);return}if(o.leftArrow){i.onLeft?.();return}if(o.rightArrow){i.onRight?.();return}if(o.return){i.onSelect();return}if(o.escape){f.current="",h();return}if(/^[1-9]$/.test(u)){i.onDigit(Number(u));return}if(o.tab){i.onTab?.();return}if(u===" "&&i.isMulti()){i.onSpace();return}if(u&&!o.ctrl&&!o.meta){i.onType(u);return}return}}),null}var n=$(B(),1);function V(e){return e.kind==="REVIEW"?[{v:"approve",label:"approve",detail:"mark it reviewed and trusted"},{v:"archive",label:"archive",detail:"reject it \u2014 asks for a reason; impact shown above"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="PAIR"?[{v:"merge",label:"merge",detail:"duplicate \u2014 fold into the older item (it stays unreviewed)"},{v:"keep_both",label:"keep both",detail:"genuinely distinct \u2014 promote both"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"hidden from now on; history is kept and it can be reverted"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:e.heldPayload?[{v:"approve",label:"approve update",detail:"commit the held payload \u2014 impact preview above"},{v:"skip",label:"keep current",detail:"drop the held payload (the owner's disk state stays untouched)"},{v:"defer",label:"defer",detail:"not now \u2014 stays held"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}function P(e){let c=V(e);return e.viewDiff&&c.push({v:"view_diff",label:"view diff",detail:"full old \u2192 new"}),c}function K(e){return e.kind==="ARCHIVE"?null:P(e).length}var j={ADD:{color:r.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:r.red},REVIEW:{color:"cyan"},PAIR:{color:"magenta"}},q=60,Q=100;function ue({card:e,position:c,sel:d=0,focused:i=!1,freeText:v=null,editorIntent:s="steer"}){let{stdout:f}=C(),g=f?.columns??80,u=g<q,o=Math.min(g-1,Q),h=P(e),A=K(e),m=j[e.kind],b=l=>i&&d===l?(0,n.jsx)(t,{color:r.assuranceAccent,children:"\u276F"}):" ",x=e.impact,R=x&&"stale_refs"in x&&x.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring leaves":"approving marks"} ${x.stale_refs.length} item(s) stale`+((x.direct_refs?.length??0)>0?` \u2014 ${x.direct_refs.length} directly touched: ${x.direct_refs.join(", ")}`:""):x&&"design_children"in x?`${e.kind==="REVIEW"?"archiving drops":"merging folds"} ${x.design_children} design child(ren)`:null,w=`? reconcile \u2014 item ${c.n} of ${c.of}`,k=A!==null?"\u2191\u2193 \xB7 \u23CE select \xB7 1-9 \xB7 type = adjust \xB7 esc \xB7 nothing to undo":"\u2191\u2193 \xB7 \u23CE select \xB7 1-9 \xB7 esc \xB7 nothing to undo",E=(0,n.jsxs)(p,{flexDirection:"column",children:[(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsxs)(t,{bold:!0,children:[(0,n.jsx)(t,{color:m.color,children:`[${e.kind}]`}),` ${D(e.title)}`]})}),(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.muted,children:e.why})}),e.diffSummary?(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.dim,children:e.diffSummary})}):(e.diff??[]).map((l,T)=>(0,n.jsx)(p,{paddingLeft:4,children:(0,n.jsx)(t,{color:l.op==="-"?"red":"green",children:`${l.op==="-"?"\u2212":"+"} ${l.field==="criteria"?"criterion":l.field}: ${l.text}`})},`d-${T}`)),e.tier?(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.dim,children:`match: ${e.tier}`})}):null,(e.citeLines??[]).map((l,T)=>(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.dim,children:l})},`c-${T}`)),R?(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.muted,children:`impact: ${R}`})}):null,e.kind==="ARCHIVE"&&e.provenance&&e.provenance!==e.why?(0,n.jsx)(p,{paddingLeft:2,children:(0,n.jsx)(t,{color:r.muted,children:e.provenance})}):null,(0,n.jsx)(t,{children:" "}),h.map((l,T)=>(0,n.jsxs)(t,{children:[b(T),` ${T+1}. ${l.label}`,(0,n.jsx)(t,{color:r.dim,children:` \u2014 ${l.detail}`})]},`o-${T}`)),A!==null||v&&s==="because"?v?(0,n.jsxs)(p,{flexDirection:"column",children:[(0,n.jsxs)(p,{children:[(0,n.jsxs)(t,{children:[(0,n.jsx)(t,{color:r.assuranceAccent,children:"\u276F"})," ",(0,n.jsx)(t,{color:r.dim,children:"\u270E "})]}),(0,n.jsx)(y,{value:v.value,onChange:v.onChange,onSubmit:v.onSubmit,onCancel:v.onCancel,placeholder:s==="because"?"why archive it?":"say what to adjust"})]}),(0,n.jsx)(t,{color:r.muted,children:s==="because"?" submits as: archive \xB7 your reason goes on the record":e.kind==="PAIR"?" submits as: defer \xB7 your note parks with the card (it re-offers)":" submits as: approve \xB7 your words steer the re-design"})]}):A!==null?(0,n.jsxs)(t,{children:[b(A)," ",(0,n.jsx)(t,{color:r.dim,children:e.kind==="PAIR"?"\u270E defer with a note \u2014 say what you noticed":"\u270E approve with changes \u2014 say what to adjust"})]}):null:null]});if(u)return(0,n.jsxs)(p,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,n.jsx)(t,{bold:!0,color:r.assuranceAccent,children:w}),E,(0,n.jsx)(t,{color:r.muted,children:k})]});let M=Math.max(2,o-(3+w.length+1)),L=Math.max(2,o-(3+k.length+1));return(0,n.jsxs)(p,{marginTop:1,marginBottom:1,flexDirection:"column",children:[(0,n.jsxs)(t,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,n.jsx)(t,{bold:!0,children:w}),` ${"\u2500".repeat(M)}`]}),(0,n.jsx)(t,{children:" "}),E,(0,n.jsx)(t,{children:" "}),(0,n.jsxs)(t,{color:r.assuranceAccent,children:["\u2500\u2500 ",(0,n.jsx)(t,{color:r.muted,children:k}),` ${"\u2500".repeat(L)}`]})]})}export{G as a,J as b,te as c,re as d,V as e,P as f,K as g,ue as h};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-5Y2G4NC7.js";import{y as o}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-5Y2G4NC7.js";import{y as o}from"./chunk-ZUGCHQFC.js";import{a as n}from"./chunk-HCBYKLMW.js";import{b as t}from"./chunk-C44QQJR4.js";import{a as s}from"./chunk-6YGTRKDT.js";import{e as r}from"./chunk-UR6MHSHU.js";var l=r(s(),1);var m=r(n(),1),i=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function b({active:e=!0}){let[p,c]=(0,l.useState)(0);return a(()=>{c(f=>(f+1)%i.length)},e?80:null),(0,m.jsx)(t,{color:o.orange,children:e?i[p]:"\u25CF"})}export{b as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as u,c as p}from"./chunk-
|
|
2
|
+
import{b as u,c as p}from"./chunk-DBKNJRJG.js";import{spawn as h}from"child_process";var k=new Set(["progress","ask_user","graph_query","ingest_request","proposal","design","error","done","reasoning_delta","reasoning_done","tool_activity","decision_activity","text_delta","usage","receipt","chat_ops","session_paused","session_complete","state_checkpoint"]);function v(g,n={}){let a=n.spawnCmd!==void 0?n.spawnCmd:u();if(!a)throw new Error("assurance agent not found \u2014 your platform package may be missing; reinstall kane-cli (npm i -g @testmuai/kane-cli)");let f=g.source.images?.length??0;a.tier==="dev-python"&&f>0&&n.onWarn?.("warn: development agent in use \u2014 if image citations are missing, update the agent package");let t=h(a.cmd,a.args,{stdio:["pipe","pipe","pipe"],env:p(g.session_id,n.auth)});if(t.stdin.write(JSON.stringify(g)+`
|
|
3
3
|
`),n.onStderr){let e="";t.stderr.on("data",r=>{e+=r.toString("utf8");let i;for(;(i=e.indexOf(`
|
|
4
4
|
`))>=0;){let o=e.slice(0,i);e=e.slice(i+1),o.trim()&&n.onStderr(o)}})}let d=new Promise(e=>{t.on("exit",(r,i)=>e({code:r,signal:i}))});async function*m(){let e="",r=!1;for await(let i of t.stdout){e+=i.toString("utf8");let o;for(;(o=e.indexOf(`
|
|
5
5
|
`))>=0;){let l=e.slice(0,o).trim();if(e=e.slice(o+1),!l)continue;let c;try{c=JSON.parse(l)}catch{n.onWarn?.(`agent: skipping malformed line: ${l.slice(0,120)}`);continue}let s=c;if(!s||typeof s!="object"||!k.has(s.type)){n.onWarn?.(`agent: skipping unknown event type "${s&&typeof s=="object"?String(s.type??"?"):"?"}"`);continue}if(yield s,s.type==="done"){r=!0;break}}if(r)break}await d.catch(()=>{})}return{events:m(),send:e=>{t.stdin&&!t.stdin.destroyed&&t.stdin.write(JSON.stringify(e)+`
|