@testmuai/kane-cli 0.7.1 → 0.8.1
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-U37VZDCW.js +8 -0
- package/dist/{ChromeProfilePicker-4CDSPBWL.js → ChromeProfilePicker-AUU7JF6F.js} +1 -1
- package/dist/{CliFeedbackPrompt-TLRVBA4E.js → CliFeedbackPrompt-4W74Y3UF.js} +1 -1
- package/dist/{CliUploadProgress-WGGFLUSF.js → CliUploadProgress-6HL7WTEX.js} +1 -1
- package/dist/ConfigView-6BSCZP5Y.js +2 -0
- package/dist/EvidenceViewOffer-62XHEEGW.js +2 -0
- package/dist/FolderPicker-S7U2EN2M.js +2 -0
- package/dist/{HelpView-FBCX32U7.js → HelpView-TU7ED43J.js} +1 -1
- package/dist/{InfoBox-KK2ICVS4.js → InfoBox-JLTMKVDE.js} +1 -1
- package/dist/{LinksBox-KKRANMR3.js → LinksBox-LREUUJDV.js} +1 -1
- package/dist/{ProfilesView-DGPXSAQN.js → ProfilesView-W3GX2N2E.js} +1 -1
- package/dist/{ProjectPicker-ESQSL4TT.js → ProjectPicker-SYQUJK2J.js} +1 -1
- package/dist/{SaveSessionPrompt-AQGP5W6E.js → SaveSessionPrompt-MR5NJMRP.js} +1 -1
- package/dist/SingleShotApp-XOKVOM7C.js +2 -0
- package/dist/{SummaryBox-BFZJW2KK.js → SummaryBox-UAYSVFB7.js} +1 -1
- package/dist/TestMdRunView-7UVSDAF4.js +2 -0
- package/dist/{WhoamiView-JABY3I5Q.js → WhoamiView-2YU76ASQ.js} +1 -1
- package/dist/adbkit-apkreader-ORZBGCJQ.js +184 -0
- package/dist/app-client-OEXESV4U.js +2 -0
- package/dist/app-download-AEEFQ63M.js +2 -0
- package/dist/{auth-76LVI6B5.js → auth-HET3TBRI.js} +1 -1
- package/dist/bind-STKXOUYI.js +12 -0
- package/dist/bootstrap-44YKVWWE.js +2 -0
- package/dist/bridge-5Z3BIB77.js +2 -0
- package/dist/{changelog-PSWPPOAF.js → changelog-7OWRHFHZ.js} +1 -1
- package/dist/chat-committer-ZWWCLJFD.js +2 -0
- package/dist/chat-controller-T2FAI55V.js +2 -0
- package/dist/{chunk-C4G7RVJ6.js → chunk-27U4PLPX.js} +1 -1
- package/dist/{chunk-V36ATG7A.js → chunk-2BGUUWNF.js} +2 -2
- package/dist/chunk-2KDGIZED.js +4 -0
- package/dist/chunk-2UIHS2FH.js +2 -0
- package/dist/chunk-2YEHV2CX.js +2 -0
- package/dist/{chunk-NRTHYROA.js → chunk-3LJWYRAA.js} +1 -1
- package/dist/chunk-3PECJD6S.js +11 -0
- package/dist/chunk-3POR47RC.js +8 -0
- package/dist/{chunk-KVQOBPAZ.js → chunk-3Q6WAK6P.js} +1 -1
- package/dist/chunk-4JOD47QI.js +2 -0
- package/dist/chunk-56PAQAX5.js +19 -0
- package/dist/{chunk-FCMLIK7P.js → chunk-5DBK6QNS.js} +1 -1
- package/dist/chunk-5DT7PIGB.js +5 -0
- package/dist/chunk-65ZTD5SJ.js +7 -0
- package/dist/chunk-6IA6QMPH.js +2 -0
- package/dist/{chunk-5KFS3GAZ.js → chunk-6KPPGMO2.js} +1 -1
- package/dist/{chunk-F6ZOJXYU.js → chunk-6O3DDOP2.js} +1 -1
- package/dist/chunk-6XX4LEVJ.js +2 -0
- package/dist/{chunk-KT6G7AF2.js → chunk-766WGMBU.js} +1 -1
- package/dist/chunk-7BZSCUPP.js +10 -0
- package/dist/{chunk-UBFKZEX3.js → chunk-7JWKHKFU.js} +2 -2
- package/dist/{chunk-PMHJRT3A.js → chunk-7KORP5FF.js} +1 -1
- package/dist/chunk-7Q6M6P4X.js +26 -0
- package/dist/{chunk-AM5S4KG4.js → chunk-AFPHLUQ5.js} +1 -1
- package/dist/chunk-AW2XUHH4.js +2 -0
- package/dist/chunk-BKHXPBWN.js +2 -0
- package/dist/chunk-BRHNRCEZ.js +3 -0
- package/dist/chunk-BRIEBB2U.js +2 -0
- package/dist/{chunk-NJPTOKW5.js → chunk-C7HSWZP6.js} +1 -1
- package/dist/{chunk-JEUA4UWK.js → chunk-CLGC7VEO.js} +1 -1
- package/dist/chunk-CTW2VQKS.js +6 -0
- package/dist/{chunk-L4JIMNKW.js → chunk-CUM23TLF.js} +1 -1
- package/dist/chunk-DBIBROYW.js +5 -0
- package/dist/{chunk-L7VREJTG.js → chunk-DCY6R5DP.js} +1 -1
- package/dist/{chunk-X3ICV5M5.js → chunk-DO5HAO3H.js} +1 -1
- package/dist/chunk-DPUV6OSP.js +2 -0
- package/dist/{chunk-M7WQM4UA.js → chunk-DUAXZYAD.js} +1 -1
- package/dist/{chunk-HPMS5KO6.js → chunk-DZGCXKKI.js} +3 -3
- package/dist/chunk-EDSZJZFG.js +4 -0
- package/dist/{chunk-OIYGGEUL.js → chunk-ELM6MXGJ.js} +1 -1
- package/dist/{chunk-R2RGSO4B.js → chunk-EWCAFKLX.js} +1 -1
- package/dist/chunk-EYOCNMUM.js +2 -0
- package/dist/{chunk-73C4PRYU.js → chunk-FEJXWJ3L.js} +1 -1
- package/dist/{chunk-BAL64WSI.js → chunk-FMRSMN34.js} +1 -1
- package/dist/chunk-FNH55WSR.js +19 -0
- package/dist/chunk-FQLIW3LM.js +2 -0
- package/dist/{chunk-JRMDGLLT.js → chunk-G7VQCS4J.js} +1 -1
- package/dist/chunk-GCBKDX2J.js +2 -0
- package/dist/{chunk-AAONIIQV.js → chunk-GFKCTYCA.js} +1 -1
- package/dist/chunk-GKYPNSQP.js +26 -0
- package/dist/chunk-GPG3FIN3.js +21 -0
- package/dist/chunk-GZPK6FRP.js +7 -0
- package/dist/{chunk-NOCIMJSN.js → chunk-HCKH44I2.js} +1 -1
- package/dist/chunk-HEAIJCGZ.js +2 -0
- package/dist/{chunk-3FN5VJMV.js → chunk-HMYMSRA4.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-IOFZSQAA.js +2 -0
- package/dist/chunk-IP2O264K.js +3 -0
- package/dist/{chunk-CSQ46PJ7.js → chunk-JJHG3BWO.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-KFSUPQAG.js +66 -0
- package/dist/chunk-KRKGZ2ZW.js +47 -0
- package/dist/chunk-KU6IXFGZ.js +9 -0
- package/dist/chunk-L7MXYCD7.js +2 -0
- package/dist/chunk-MA34UWKX.js +4 -0
- package/dist/chunk-MBF3FP5P.js +5 -0
- package/dist/chunk-MSGW4JDG.js +2 -0
- package/dist/chunk-MXHHMIO2.js +349 -0
- package/dist/chunk-N2P4MI32.js +2 -0
- package/dist/{chunk-CDQX6HGJ.js → chunk-NX7TM662.js} +1 -1
- package/dist/chunk-OMQCD3KR.js +2 -0
- package/dist/{chunk-QROUKGKU.js → chunk-OS4VSIHT.js} +1 -1
- package/dist/chunk-OTTGS2TE.js +2 -0
- package/dist/chunk-QGKPLOUI.js +2 -0
- package/dist/{chunk-JKTFTF24.js → chunk-QRZRSAZH.js} +1 -1
- package/dist/{chunk-WJ5HDEVH.js → chunk-QSDH5P7C.js} +1 -1
- package/dist/{chunk-322JEJEH.js → chunk-QW6EZC53.js} +1 -1
- package/dist/{chunk-2XMJ6YAE.js → chunk-R5T4RLF5.js} +1 -1
- package/dist/chunk-R7QAS6LZ.js +4 -0
- package/dist/{chunk-LR5XO2KD.js → chunk-RC52N7PC.js} +1 -1
- package/dist/{chunk-33QXD75Y.js → chunk-RFR4ZKIC.js} +3 -3
- package/dist/{chunk-3LWTUMDG.js → chunk-RLRNLIRS.js} +1 -1
- package/dist/{chunk-XDHZMCTA.js → chunk-SDPRO2LE.js} +2 -2
- package/dist/chunk-T5Y6MOLM.js +4 -0
- package/dist/{chunk-4OPQJ7PE.js → chunk-TFPPEOAK.js} +1 -1
- package/dist/chunk-TH47OOBV.js +4 -0
- package/dist/{chunk-XVDJ423L.js → chunk-TKGUT425.js} +1 -1
- package/dist/{chunk-OHRS3H7Z.js → chunk-TRJUD3XJ.js} +1 -1
- package/dist/chunk-TYLYFERW.js +10 -0
- package/dist/chunk-TZXXJWHA.js +2 -0
- package/dist/chunk-UD7KKHPW.js +5 -0
- package/dist/{chunk-APAIWBIH.js → chunk-UDIQOJEL.js} +1 -1
- package/dist/chunk-UV462FZR.js +2 -0
- package/dist/{chunk-323MLBYA.js → chunk-UXDL4XDL.js} +1 -1
- package/dist/chunk-V2R3LCA3.js +12 -0
- package/dist/chunk-VAYBKR76.js +4 -0
- package/dist/{chunk-AH7ZZIZY.js → chunk-VRVFPMCR.js} +1 -1
- package/dist/chunk-W2JFDDIB.js +2 -0
- 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-6HEGD6H2.js → chunk-XO5ZH3ZR.js} +1 -1
- package/dist/chunk-XWKUZJCP.js +2 -0
- package/dist/{chunk-2KBD6JZX.js → chunk-YFYCCTSL.js} +1 -1
- package/dist/{chunk-ZM5PVRJK.js → chunk-YJELGSKJ.js} +1 -1
- package/dist/chunk-YRFMPIU2.js +4 -0
- package/dist/{chunk-2XGDWUJ5.js → chunk-ZGBSGZZM.js} +1 -1
- package/dist/{chunk-NBKQT7LJ.js → chunk-ZIUAOEUC.js} +1 -1
- package/dist/chunk-ZMNJBUAO.js +2 -0
- package/dist/chunk-ZVHCQMJ6.js +13 -0
- package/dist/committer-SWEWEYNX.js +2 -0
- package/dist/{config-R3GF2FZA.js → config-RS47F5SC.js} +1 -1
- package/dist/{controller-client-RD2YEMAH.js → controller-client-OB4WD2C4.js} +1 -1
- package/dist/{cover-cmd-TXICWHUU.js → cover-cmd-HDZZWJXG.js} +1 -1
- package/dist/{credentials-XN4ROCQ3.js → credentials-OH6AVI6N.js} +1 -1
- package/dist/deps-resolve-XC5S53DG.js +2 -0
- package/dist/descriptor-OEUZZCOK.js +2 -0
- package/dist/design-committer-VYT6NU3T.js +2 -0
- package/dist/dispatch-SE5GY3Z2.js +2 -0
- package/dist/doctor-FSECFZUU.js +2 -0
- package/dist/docx-convert-JMUMT5C4.js +2 -0
- package/dist/{dossier-QZV74XOS.js → dossier-KTLTGT2X.js} +1 -1
- package/dist/evidence-OYPHZUKI.js +2 -0
- package/dist/evolve-cmd-BCPNXAMV.js +2 -0
- package/dist/exec-P2IKJRRR.js +2 -0
- package/dist/exit-manager-3FVBTNYR.js +2 -0
- package/dist/explain-UAAQWHYR.js +2 -0
- package/dist/{explain-cmd-X7JZLSZZ.js → explain-cmd-3GEKR7O5.js} +1 -1
- package/dist/{explain-cmd-RZW6QJYM.js → explain-cmd-EX24XKD6.js} +1 -1
- package/dist/extract-bind-LLEASZAK.js +10 -0
- package/dist/extract-cmd-UZMEZMGP.js +5 -0
- package/dist/feeder-C3TOJPKK.js +2 -0
- package/dist/{gaps-cmd-BWCRLLBK.js → gaps-cmd-IVXFPFAQ.js} +1 -1
- package/dist/{gate-YHBPWEM5.js → gate-54BRAE7N.js} +1 -1
- package/dist/{generate-headless-BSTDLZZY.js → generate-headless-D3SVQ2AI.js} +3 -3
- package/dist/{headless-io-BL3TEAX5.js → headless-io-66RG5NN5.js} +1 -1
- package/dist/host-7GZPBA74.js +2 -0
- package/dist/identity-ADZ4PAJF.js +2 -0
- package/dist/index.js +85 -69
- package/dist/ingest-EX72IEQT.js +2 -0
- package/dist/ingest-cmd-EAE7N5RC.js +2 -0
- package/dist/{interactive-bind-43HGDF5K.js → interactive-bind-ORMN2REX.js} +7 -6
- package/dist/{lifecycle-cmd-D6TVTYRK.js → lifecycle-cmd-O2324GN6.js} +1 -1
- package/dist/{list-cmd-XCAV2FKA.js → list-cmd-N4KMA34H.js} +1 -1
- package/dist/list-commands-MRXL5HGS.js +2 -0
- package/dist/locks-cmd-CSVSWY2Y.js +2 -0
- package/dist/logical-ids-TEBCQJGO.js +2 -0
- package/dist/login-flow-QJQM3RHT.js +2 -0
- package/dist/maintenance-cmd-6XSVO6FO.js +2 -0
- package/dist/mobile-prompts-TOX35ER6.js +2 -0
- package/dist/pdf-convert-OZIRUADA.js +2 -0
- package/dist/persist-recorded-session-TLDQ5HKP.js +3 -0
- package/dist/phase-seed-VFHIH6FL.js +2 -0
- package/dist/pipeline-UOM4LNAI.js +2 -0
- package/dist/prepare-target-QYWIJIVQ.js +2 -0
- package/dist/readmodel-XOYGGQ3S.js +2 -0
- package/dist/reconcile-cmd-3H34KVVD.js +2 -0
- package/dist/reconcile-deps-XIH75ZLY.js +4 -0
- package/dist/reconcile-engine-UKWPG2LV.js +2 -0
- package/dist/{recording-banner-TALO7PUR.js → recording-banner-4M7XHVGI.js} +1 -1
- package/dist/records-IOZTZUZV.js +2 -0
- package/dist/registry-PYOTKZYZ.js +2 -0
- package/dist/{require-project-folder-R347LFDQ.js → require-project-folder-4UPQNEBJ.js} +1 -1
- package/dist/resolve-run-intent-X72V3KJA.js +7 -0
- package/dist/{resolver-IDCGRPFJ.js → resolver-UBOZLFFE.js} +1 -1
- package/dist/revert-NQ7GEVSE.js +2 -0
- package/dist/review-cmd-DQRKQUMG.js +4 -0
- package/dist/run-2COODVX2.js +2 -0
- package/dist/run-URPGHOQM.js +2 -0
- package/dist/run-channel-RGH4WIQX.js +2 -0
- package/dist/{run-test-md-DFNIGYB7.js → run-test-md-76ZPKXO6.js} +3 -3
- package/dist/session-target-UWROGOCY.js +2 -0
- package/dist/sessions-GIEXOCE4.js +2 -0
- package/dist/{sessions-cmd-AQWLL5ZN.js → sessions-cmd-ZZIZN2VB.js} +4 -4
- package/dist/{skill-installer-ANXTCXQV.js → skill-installer-CIS6GAYF.js} +1 -1
- package/dist/spawner-J67QR4QP.js +2 -0
- package/dist/structured-answers-5EY2AZN7.js +5 -0
- package/dist/tcg-generate-BDTRKY2A.js +2 -0
- package/dist/testmd-actions-77ELR5UU.js +2 -0
- package/dist/token-refresh-4BPAPXKK.js +2 -0
- package/dist/types-6E2HTDKJ.js +2 -0
- package/dist/{validate-basic-O2DP2XJL.js → validate-basic-2GVSQ2R5.js} +1 -1
- package/dist/verdicts-TRSTJLCL.js +2 -0
- package/dist/{version-check-RNR3JCQ5.js → version-check-O6PYTI4T.js} +1 -1
- package/dist/{view-cmd-YSEGA5PI.js → view-cmd-KPJTP4DI.js} +1 -1
- package/dist/walk-session-CHJXHZMO.js +2 -0
- package/dist/with-telemetry-CQCWLVOC.js +2 -0
- package/package.json +12 -6
- package/dist/ChatSurface-D66CACLX.js +0 -8
- package/dist/ConfigView-DBANTBXC.js +0 -2
- package/dist/EvidenceViewOffer-DNCQ3A6R.js +0 -2
- package/dist/FolderPicker-W7RCIFEL.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-6UJDOAYR.js +0 -26
- package/dist/chunk-BQHKBOSF.js +0 -11
- package/dist/chunk-DQ54MH7F.js +0 -13
- package/dist/chunk-DXV6MBTD.js +0 -8
- 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-IXVOXJP6.js +0 -6
- package/dist/chunk-KNDSQ4PS.js +0 -2
- package/dist/chunk-KRXSXQBU.js +0 -12
- package/dist/chunk-LQZ2BU7Q.js +0 -2
- package/dist/chunk-NAC7SFBE.js +0 -5
- package/dist/chunk-NAE7MBR2.js +0 -23
- package/dist/chunk-NRC2G4Y5.js +0 -5
- package/dist/chunk-O56PUUNL.js +0 -9
- package/dist/chunk-QM4S2APK.js +0 -2
- package/dist/chunk-RKWJG3WW.js +0 -19
- package/dist/chunk-RNSSM2BK.js +0 -11
- package/dist/chunk-SE6WNCYU.js +0 -4
- package/dist/chunk-SRDHPKJT.js +0 -2
- package/dist/chunk-SWESH2J7.js +0 -10
- package/dist/chunk-T63R6QT4.js +0 -4
- package/dist/chunk-UI7KULSI.js +0 -7
- package/dist/chunk-UPPEOQJQ.js +0 -3
- package/dist/chunk-URQUQWGW.js +0 -62
- 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-WAOCHXJ5.js +0 -2
- 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/evidence-V23FPVXQ.js +0 -2
- package/dist/evolve-cmd-PZCPXDMR.js +0 -2
- package/dist/exit-manager-HNFATGSM.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/list-commands-747UTUSS.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/persist-recorded-session-MDPWWUA7.js +0 -3
- 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
package/dist/chunk-BQHKBOSF.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{g as G}from"./chunk-EV3EHXEI.js";import{a as q,b as X,k as Z}from"./chunk-F7WKDMX7.js";import{a as z}from"./chunk-VOHQA2SP.js";import{c as U}from"./chunk-ZLCZDAEX.js";import{a as M,b as Y,f as V,g as H,h as F,i as K}from"./chunk-SE6WNCYU.js";import{b as B}from"./chunk-NVGBE2DR.js";import{a as D}from"./chunk-CH273NAE.js";import{a as O}from"./chunk-GW5DWAXY.js";import{x as k}from"./chunk-C4G7RVJ6.js";import{existsSync as Te}from"fs";import{basename as $e}from"path";import{appendFileSync as de,mkdirSync as le}from"fs";import{homedir as me}from"os";import{dirname as fe,join as pe}from"path";function W(t,r){let e=/^(DOCX_[A-Z_]+):/.exec(r)?.[1];if(e)try{let o=process.env.KANE_CONTEXT_REFUSAL_LOG??pe(me(),".testmuai","kaneai","context-refusals.log");le(fe(o),{recursive:!0}),de(o,`${new Date().toISOString()} ${e} ${t}
|
|
3
|
-
`)}catch{}}var y=class extends Error{constructor(e,o){super(o);this.code=e;this.name="LisError"}};function ge(t){let r=t.TESTMUAI_ENV==="stage"?"stage":"prod";return`${k[r].shareApiBaseUrl}/lis/api/v1`}function he(t){let r=t.env??process.env,e=t.auth?.TESTMUAI_BASIC_AUTH||r.TESTMUAI_BASIC_AUTH;if(e)return{authorization:`Basic ${e}`};let o=t.auth?.TESTMUAI_API_KEY||r.TESTMUAI_API_KEY;return o?{authorization:`Bearer ${o}`}:{}}function R(t,r,e="the issue"){return t===401||t===403?new y("LIS_AUTH","credentials rejected \u2014 run `kane-cli login` and retry"):t>=500?new y("LIS_UNAVAILABLE",`the integrations service returned an error (HTTP ${t}) \u2014 retry later`):new y("JIRA_ISSUE_UNAVAILABLE",`could not fetch ${e}: ${r||`HTTP ${t}`}`)}function j(t){try{return JSON.parse(t.bytes.toString("utf8"))}catch{throw new y("LIS_UNAVAILABLE","the integrations service returned a malformed response \u2014 retry later")}}var ye=3e4;async function T(t,r,e){let o=e.env??process.env,m=e.fetchImpl??fetch,l=new AbortController,d=setTimeout(()=>l.abort(),ye);try{let a=await m(`${ge(o)}${t}`,{...r,headers:{"content-type":"application/json",...he(e),...r.headers??{}},signal:l.signal}),n=await Promise.race([a.arrayBuffer(),new Promise((s,u)=>{l.signal.addEventListener("abort",()=>u(new DOMException("aborted","AbortError")),{once:!0})})]);return{status:a.status,ok:a.ok,headers:a.headers,bytes:Buffer.from(n)}}catch(a){throw l.signal.aborted?new y("LIS_UNAVAILABLE","the integrations service did not respond within 30 seconds \u2014 retry later"):new y("LIS_UNAVAILABLE",`could not reach the integrations service (${a instanceof Error?a.message:String(a)}) \u2014 check your connection and retry`)}finally{clearTimeout(d)}}function $(t){try{return JSON.parse(t.bytes.toString("utf8")).message??""}catch{return""}}async function Q(t={}){let r=await T("/jira/info",{method:"GET"},t);if(!r.ok)throw R(r.status,$(r));let e=j(r),o=(e.data?.SELECTED_PROJECTS??[]).map(m=>m?.key).filter(m=>typeof m=="string"&&m.length>0);return{installed:e.data?.INSTALLED==="YES",selectAll:e.data?.SELECT_ALL===!0,selectedProjects:o}}async function ee(t,r={}){let e=await T("/jira/issue?details=true",{method:"POST",body:JSON.stringify({plugin_code:"jira",issueKey:t})},r);if(!e.ok)throw R(e.status,$(e));let o=j(e);if(o.type==="error"||!o.data)throw new y("JIRA_ISSUE_UNAVAILABLE",`could not fetch the issue: ${o.message??"issue not found or not accessible"}`);return o.data}async function te(t,r={}){let e=await T("/jira/attachment",{method:"POST",body:JSON.stringify({attachment_id:t})},r);if(e.status===413)throw new y("ATTACHMENT_TOO_LARGE","the attachment exceeds the integrations service's size cap");if(e.status===404)throw new y("JIRA_NOT_CONNECTED","Jira is not connected for this account \u2014 connect it in the Integrations screen and retry");if(!e.ok)throw R(e.status,$(e),`attachment ${t}`);return{bytes:e.bytes,mediaType:e.headers.get("content-type")??"application/octet-stream"}}var S="kane.source.jira/1";function re(t){if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t)){let r=t.map(re).filter(e=>e!==null);return r.length===0?null:r.join(", ")}if(t!==null&&typeof t=="object"){let r=t;for(let e of["name","value","displayName"])if(typeof r[e]=="string")return r[e];return null}return null}function ne(t,r){let e=[],o={},m=t.additional_fields??{};for(let n of Object.keys(m).sort()){let s=re(m[n]);if(s===null){e.push(`field "${n}" has no stable text form \u2014 dropped from the envelope`);continue}o[n]=s}let l=[...t.attachments??[]].map(n=>({id:String(n.id),filename:n.filename??"",media_type:n.mime_type??"application/octet-stream",size:n.size??0})).sort((n,s)=>{let u=Number(n.id),i=Number(s.id);return Number.isFinite(u)&&Number.isFinite(i)?u-i:n.id<s.id?-1:n.id>s.id?1:0}),d=t.key;if(!/^[A-Za-z][A-Za-z0-9_]*-\d+$/.test(d))throw new Error(`cannot build a stable identity for issue key "${d}" \u2014 expected a PROJECT-NUMBER key`);let a={schema:S,site:r,project:d.slice(0,d.lastIndexOf("-")),issue:{id:t.id,key:d},content:{summary:t.summary??"",description:t.description??"",fields:o},attachments:l};return{bytes:Buffer.from(JSON.stringify(a),"utf8"),envelope:a,warnings:e}}var se=64,be=16,Ee=6e6,Ie=5e7,_e=12e6,we={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"},Ae=new Set(["png","jpeg","webp"]);function ie(t){return async r=>{let e;try{e=JSON.parse(r.toString("utf8"))}catch{throw new Error("JIRA_ENVELOPE_SCHEMA: source bytes are not a kane jira envelope")}if(e.schema!==S)throw new Error(`JIRA_ENVELOPE_SCHEMA: unknown envelope schema "${e.schema}" \u2014 this CLI understands ${S}`);let o=[],m=new Map,l=[],d=0,a=new Map,n=[];for(let i=0;i<e.attachments.length;i++){let c=e.attachments[i],g=`i${i+1}`,w=`attachment:${c.filename}`,p=I=>`[img#${g}] ${c.filename} (${c.media_type}, ${c.size} bytes${I?"":" \u2014 not delivered"})`,f=(I,ue,L)=>{o.push({ref:g,loc:w,media_type:I,...L?.blob?{blob:L.blob}:{},...L?.appearance?{appearance:L.appearance}:{},delivery:ue,...L?.duplicate_of?{duplicate_of:L.duplicate_of}:{}})};if(!c.media_type.startsWith("image/")){f(c.media_type,"unsupported-vision-media-type"),n.push(p(!1));continue}let b;try{b=await t.fetchAttachment(c.id)}catch{f(c.media_type,"external-image-not-fetched"),n.push(p(!1));continue}let A=b.bytes,h=q(A),_=we[h.format],E=B(A);if(m.set(E,A),!Ae.has(h.format)){let I=h.format==="gif"||h.format==="bmp"||h.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";f(_,I,{blob:E}),n.push(p(!1));continue}if(h.width===void 0||h.height===void 0||h.width*h.height>Ie){f(_,"undecodable",{blob:E}),n.push(p(!1));continue}let v;if(h.format==="png"||h.format==="jpeg"){let I=X(A,h.format);if(I===null){f(_,"undecodable",{blob:E}),n.push(p(!1));continue}v=z(I.data,{width:I.width,height:I.height,channels:I.channels})}if(h.width<se||h.height<se){f(_,"below-dimension-floor",{blob:E,appearance:v}),n.push(p(!1));continue}let N=a.get(E);if(N!==void 0){f(_,"duplicate",{blob:E,appearance:v,duplicate_of:N}),n.push(p(!1));continue}if(A.byteLength>Ee){f(_,"image-too-large",{blob:E,appearance:v}),n.push(p(!1));continue}if(d+A.byteLength>_e){f(_,"vision-byte-budget-reached",{blob:E,appearance:v}),n.push(p(!1));continue}if(l.length>=be){f(_,"image-cap-reached",{blob:E,appearance:v}),n.push(p(!1));continue}a.set(E,g),d+=A.byteLength,l.push(g),f(_,"selected",{blob:E,appearance:v}),n.push(p(!0))}let s=[];s.push(`${e.issue.key} \xB7 ${e.site}/${e.project}`,`Summary: ${e.content.summary}`),e.content.description!==""&&s.push("",...e.content.description.split(`
|
|
4
|
-
`));let u=Object.keys(e.content.fields);return u.length>0&&s.push("","--- fields ---",...u.map(i=>`${i}: ${e.content.fields[i]}`)),n.length>0&&s.push("","--- attachments ---",...n),{projection:s.join(`
|
|
5
|
-
`)+`
|
|
6
|
-
`,inventory:o,blobs:m,delivered:l,converter:{name:"jira-convert",version:"1",policy:"v1"}}}}var ve=/^[A-Za-z][A-Za-z0-9_]*-\d+$/;function P(t){if(!/^https?:\/\/.+/i.test(t))return null;let r;try{r=new URL(t)}catch{return null}let e=r.pathname.split("/").filter(Boolean),o=e.lastIndexOf("browse");if(o===-1||o+1>=e.length)return null;let m=e[o+1];return ve.test(m)?{site:r.hostname,issueKey:m.toUpperCase()}:null}async function Le(t,r,e,o,m){let l=P(t);if(l===null)return(e.err??e.out)(`error: ${t}: unsupported remote URL \u2014 expected a Jira issue URL (https://<site>/browse/KEY-123)`),{code:1};let d=m?.lis??{jiraInfo:Q,jiraIssue:ee,jiraAttachment:te};try{let n={auth:await(m?.authEnv??(await import("./auth-76LVI6B5.js")).resolveLisAuthEnv)(),env:process.env},s=await d.jiraInfo(n);if(!s.installed)return(e.err??e.out)(`error: ${t}: Jira is not connected for this account \u2014 connect it in the Integrations screen (integrations.lambdatest.com) and retry`),{code:1};let u=l.issueKey.slice(0,l.issueKey.lastIndexOf("-"));if(!s.selectAll&&s.selectedProjects.length>0&&!s.selectedProjects.includes(u))return(e.err??e.out)(`error: ${t}: project ${u} is not in the integration's selected projects (${s.selectedProjects.join(", ")}) \u2014 add it in the Integrations screen to ingest from it`),{code:1};let i=await d.jiraIssue(l.issueKey,n),c=l.site;if(i.host)try{c=new URL(i.host).hostname}catch{c=i.host.replace(/^https?:\/\//,"").replace(/[/:].*$/,"")}let{bytes:g,warnings:w}=ne(i,c),p=r??l.issueKey.toLowerCase();M(p);let f=await K({contextDir:o,bytes:g,media:Y,sourceId:p,label:t,confirmSameSource:e.isTTY?b=>e.confirm(`identical content already ingested as ${b} \u2014 treat as the same source?`):void 0,converters:{jira:ie({fetchAttachment:b=>d.jiraAttachment(b,n)})}});e.out(x(e.isTTY,f,l.issueKey));for(let b of w)e.out(`warning: ${b}`);for(let b of f.warnings??[])e.out(`warning: ${b}`);if(f.composite){let b=f.composite.delivered+f.composite.omitted;e.out(`${f.source_id}: jira, ${b} attachments, ${f.composite.delivered} images delivered (${f.composite.omitted} omitted)`)}return{code:0,result:{status:f.status,source_id:f.source_id,source_cid:f.cid}}}catch(a){return a instanceof y?((e.err??e.out)(`error: ${t}: ${a.message}`),{code:1}):((e.err??e.out)(`error: ${t}: ${Re(a instanceof Error?a.message:String(a))}`),{code:1})}}function Re(t){let r=t.match(/too large — ([\d.]+ [KM]B), the limit for .+ is ([\d.]+ [KM]B) \[FILE_TOO_LARGE\]/);return r?`the issue's content is too large to ingest (${r[1]}; the limit is ${r[2]}) \u2014 trim the description or attachments in Jira and retry`:t.startsWith("PROJECTION_TOO_LARGE:")?"the issue's text is too large to ingest \u2014 trim the description in Jira and retry":t}var oe={name:"jira",hint:"Jira issue URLs (https://<site>/browse/KEY-123)",match:t=>P(t)!==null,ingest:Le};function x(t,r,e){return t?r.status==="created"?`landed ${r.source_id} (${e}) \u2014 new source`:r.status==="versioned"?`landed ${r.source_id} (${e}) \u2014 new version; dependents go stale`:`${r.source_id} unchanged \u2014 already landed`:`${r.status} ${r.source_id} source ${r.cid} blob ${r.blob}`}var J=[oe];function ae(t){return/^https?:\/\/.+/i.test(t)}function ce(t){return J.find(r=>r.match(t))??null}async function C(t,r,e,o=process.cwd(),m){let l=D(o),d=[];if(r.as!==void 0&&t.length>1)return(e.err??e.out)(`error: --as names ONE source identity \u2014 pass a single file (got ${t.length})`),{code:2,results:d};for(let a of t){if(ae(a)){let u=ce(a);if(u===null)return(e.err??e.out)(`error: ${a}: unsupported remote URL \u2014 supported: ${J.map(c=>c.hint).join("; ")}`),{code:1,results:d};let i=await u.ingest(a,r.as,e,l,m);if(i.code!==0)return{code:i.code,results:d};i.result&&d.push({status:i.result.status==="versioned"?"versioned":i.result.status==="unchanged"?"unchanged":"created",source_id:i.result.source_id,source_cid:i.result.source_cid});continue}let n=r.as;if(e.isTTY&&n===void 0&&Te(l)){let u=V(a),i=H(u);if(i){let c=O(l);c.heads.get(i)!=null&&c.heads.get(u)==null&&await e.confirm(`${u} looks like a new version of existing source '${i}' \u2014 ingest as '${i}' (replaces the current version; items built on it go stale)?`)&&(n=i)}}let s;try{s=await F({contextDir:l,filePath:a,asId:n,confirmSameSource:e.isTTY?u=>e.confirm(`identical bytes already ingested as ${u} \u2014 treat as the same source?`):void 0,converters:{pdf:G,docx:Z}})}catch(u){let i=u instanceof Error?u.message:String(u);return W(a,i),e.out(`error: ${a}: ${i}`),{code:1,results:d}}e.out(x(e.isTTY,s,$e(a)));for(let u of s.warnings??[])e.out(`warning: ${u}`);if(s.composite){let u=s.composite.pages!==void 0?` ${s.composite.pages} pages,`:"";e.out(`${s.source_id}: ${s.composite.kind},${u} ${s.composite.delivered} images delivered (${s.composite.omitted} omitted)`)}if(!e.isTTY&&s.status==="created"){let u=O(l);for(let[i,c]of u.heads.entries())if(!(i===s.source_id||c==null)&&u.getNode(c)?.content.blob===s.blob){e.out(`hint: identical bytes already ingested as ${i} \u2014 merged later via review`);break}}d.push({status:s.status,source_id:s.source_id,source_cid:s.cid})}return{code:0,results:d}}async function mt(t,r,e,o=process.cwd(),m){return(await C(t,r,e,o,m)).code}async function ft(t,r){if(r.mode!=null&&!["interactive","agent","ci","override"].includes(r.mode))return process.stderr.write(`ingest: --mode must be interactive | agent | ci | override, got '${r.mode}'
|
|
7
|
-
`),2;let e=U();if(r.mode==="interactive"&&!e)return process.stderr.write(`ingest: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
|
|
8
|
-
`),2;let o=r.mode??(e?"interactive":void 0),m=o==="interactive"||o==="agent"||o==="override";if(!m&&(r.plan||r.force||r.trust!==void 0))return process.stderr.write(`ingest: --plan/--force/--trust steer the extraction \u2014 not available when only landing (use --mode agent to extract headless)
|
|
9
|
-
`),2;let{createInterface:l}=await import("readline/promises"),d={out:c=>process.stdout.write(c+`
|
|
10
|
-
`),err:c=>process.stderr.write(c+`
|
|
11
|
-
`),isTTY:e,confirm:async c=>{let g=l({input:process.stdin,output:process.stdout});try{let w=await g.question(`${c} [Y/n] `);return!/^n(o)?$/i.test(w.trim())}finally{g.close()}}};if(!m){let{withTelemetry:c}=await import("./with-telemetry-PNP6CAVM.js");return c("ingest",async()=>{let{code:g,results:w}=await C(t,{as:r.as},d,void 0,void 0);if(g!==0)return g;let p=w.filter(f=>f.status!=="unchanged").length;return p>0&&(d.err??d.out)(`landed ${p} source(s) \u2014 run kane-cli context extract to extract them`),0},{write:!0})}let{code:a,results:n}=await C(t,{as:r.as},d,void 0,void 0);if(a!==0)return a;if(n.length===0)return 0;let{extractCommand:s}=await import("./extract-cmd-U3MGK2LP.js"),u=[...new Set(n.map(c=>c.source_id))],i=await s({...r.mode!==void 0?{mode:r.mode}:{},...r.plan?{plan:!0}:{},...r.force?{force:!0}:{},...r.trust!==void 0?{trust:r.trust}:{},sources:u,landed:n});if(i===2){let c=n.filter(g=>g.status!=="unchanged").length;c>0&&(d.err??d.out)(`note: the ${c} landed source(s) are safe \u2014 extract later with kane-cli context extract`)}return i}export{C as a,mt as b,ft as c};
|
package/dist/chunk-DQ54MH7F.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as qe,g as et}from"./chunk-FCMLIK7P.js";import{b as w,c as Q,d as Ye,f as q,g as ee}from"./chunk-CJJXT5DO.js";import{a as Ke,e as P,f as T,g as We,h as H,i as D,j as Je}from"./chunk-ZPDM6FO7.js";import{a as F,b as L,d as Ue}from"./chunk-EHN5HTUD.js";import{d as tt}from"./chunk-NVGBE2DR.js";import{a as Y}from"./chunk-CH273NAE.js";import{a as R,b as y}from"./chunk-L5LI2JF4.js";import{a as _}from"./chunk-GW5DWAXY.js";import{b as U}from"./chunk-T63R6QT4.js";import{a as Ze}from"./chunk-L4JIMNKW.js";import{b as Qe,f as z,i as G}from"./chunk-M7WQM4UA.js";import{d as te,f as Xe}from"./chunk-5YPBPZUR.js";import{a as Ge}from"./chunk-JRMDGLLT.js";import{a as ze}from"./chunk-C4G7RVJ6.js";function $(t){if(t===null)return"broken";let e=Math.floor(t/100);return e===1?"passed":e===7?"failed":e===2?"skipped":"broken"}var C={failed:3,broken:2,passed:1,skipped:0};function re(t){let e="skipped";for(let r of t)C[r]>C[e]&&(e=r);return e}import{createHash as At}from"crypto";import{basename as Ot}from"path";function ne(t){let e=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return e.length>0?e:"session"}function ie(t){return At("sha256").update(t).digest("hex").slice(0,8)}function oe(t){let e=Ot(t).replace(/_test\.md$/i,"").replace(/\.md$/i,"");return`${ne(e)}-${ie(t)}`}function se(t,e){return`${ne(t)}-${ie(e)}`}function ae(t){let e={};for(let[r,n]of Object.entries(t))typeof n=="string"&&n.length>0&&(e[r]=n);return e}var Ft={darwin:"macOS",linux:"Linux",win32:"Windows"};function ce(t){return Ft[t]??t}function de(t,e){let r={},n=(i,o)=>{o!==void 0&&o!==""&&(r[i]=o)};return n("model",e.model),n("os",t.os),n("browser",t.browser),n("browser_version",t.browser_version),n("resolution",t.resolution),n("platform",e.platform),n("platform_type",e.platform_type),n("run_kind",e.run_kind),n("os_version",t.os_version),t.device!==void 0&&t.device!==""?r.device=t.device:e.platform_type&&e.platform_type!=="web"&&(r.device=null),r}function Lt(t,e){return{pack_test_dir:t,ordinal_offset:e}}import{promises as x}from"fs";import{join as k}from"path";function ue(t){let e={evidence:"0.1",run_id:t.execution_id,status:"running",title:t.title,started:t.started,environment:{producer:{name:"kane-cli",version:t.producerVersion},...t.surfaces?{surfaces:t.surfaces}:{},run_kind:t.run_kind,origin:t.origin,pid:t.pid},...t.credits!==void 0?{metrics:{credits:{value:t.credits,type:"count"}}}:{}};return y(e,{lineWidth:-1})}async function le(t,e,r,n=process.cwd(),i){let o=i??w(t.execution_id,n),s=k(o,"tests",e);return await x.mkdir(k(o,"coverage"),{recursive:!0}),await x.writeFile(k(o,"coverage",".keep"),""),await x.mkdir(s,{recursive:!0}),await x.writeFile(k(o,"run.yaml"),ue(t)),r&&await x.writeFile(k(s,r.path),r.content),o}async function Tt(t,e=process.cwd()){let r=w(t.execution_id,e);await x.mkdir(k(r,"coverage"),{recursive:!0}),await x.writeFile(k(r,"coverage",".keep"),"");let n=R(ue(t));return n.environment&&delete n.environment.run_kind,await x.writeFile(k(r,"run.yaml"),y(n,{lineWidth:-1})),r}async function jt(t,e=process.cwd()){return L(w(t,e),new Date().toISOString())}async function pe(t,e=process.cwd()){await x.rm(w(t,e),{recursive:!0,force:!0})}import{promises as fe}from"fs";import{join as me}from"path";function ge(t){let e={evidence:"0.1",test:t.testId,status:t.status,...t.durationMs!==void 0?{duration_ms:t.durationMs}:{},...t.definitionPath?{definition:{path:t.definitionPath}}:{},...t.definitionId?{definition_id:t.definitionId}:{},...t.assuranceId?{assurance_id:t.assuranceId}:{},...Object.keys(t.externalId).length?{external_id:t.externalId}:{},...t.tags&&t.tags.length?{tags:t.tags}:{},...Object.keys(t.environment).length?{environment:t.environment}:{},steps:t.steps};return y(e,{lineWidth:-1})}function ve(t){return y({logs:t},{lineWidth:-1})}async function he(t,e,r){await fe.writeFile(me(t,"tests",e,"result.yaml"),r)}async function we(t,e,r){let n=me(t,"tests",e,"logs");await fe.mkdir(n,{recursive:!0}),await fe.writeFile(me(n,"meta.yaml"),r)}import{promises as K}from"fs";import{join as rt}from"path";function nt(t){return rt(t,".internal","meta.json")}async function it(t){let e;try{e=await K.readFile(nt(t),"utf8")}catch(n){if(n?.code==="ENOENT")return null;throw n}let r=JSON.parse(e);if(!r||typeof r!="object"||Array.isArray(r))throw new Error("meta.json is not a JSON object");return r}async function ye(t,e){let r;try{r=await it(t)??{}}catch(s){console.warn(`evidence: meta.json at ${t} unreadable \u2014 skipping execution-pointer append to preserve identity`,s);return}let n=Array.isArray(r.executions)?r.executions:[];n.push(e),r.executions=n,await K.mkdir(rt(t,".internal"),{recursive:!0});let i=nt(t),o=`${i}.tmp-${process.pid}-${Date.now()}`;await K.writeFile(o,JSON.stringify(r,null,2)+`
|
|
3
|
-
`),await K.rename(o,i)}async function Nt(t){try{let e=await it(t);return e&&Array.isArray(e.executions)?e.executions:[]}catch{return[]}}async function Vt(t,e,r=process.cwd()){let n=await q(t,r);if(!n){let o=`evidence: no pack found for "${t}"`;return e.json?console.log(JSON.stringify({valid:!1,error:"not_found",target:t})):console.error(o),2}let i=await F(n,e.profile??"L1");return e.json?console.log(JSON.stringify({valid:i.valid,status:i.status,diagnostics:i.diagnostics})):console.log(`evidence: ${i.valid?"valid":"INVALID"} (${e.profile??"L1"}, status ${i.status})`),i.valid?0:1}function _e(t){let e=[];for(let r of t){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(i=>i.resultCode):[r.resultCode];for(let i of n)e.push($(i))}return re(e)}function Mt(t){let e=null;for(let r of t){let n=r.perFlow&&r.perFlow.length?r.perFlow.map(i=>i.resultCode):[r.resultCode];for(let i of n)i!=null&&(e==null||C[$(i)]>C[$(e)]||C[$(i)]===C[$(e)]&&i>e)&&(e=i)}return e}import{promises as Bt}from"fs";import{extname as ot,basename as Ht}from"path";var zt={".ndjson":"ndjson",".log":"log",".json":"json",".har":"har"};async function xe(t){let e;try{e=await Bt.readdir(t)}catch{return[]}return e.filter(r=>r!=="meta.yaml").sort().map(r=>({name:Ht(r,ot(r)),file:r,format:zt[ot(r)]??"txt"}))}import{mkdirSync as Gt,appendFileSync as Ut}from"fs";import{join as st}from"path";function Ie(t,e){return st(t,"tests",e,"logs")}function be(t,e,r,n={},i){try{i?.(e,r,r,n)}catch{}if(t)try{Gt(t,{recursive:!0});let o=JSON.stringify({ts:new Date().toISOString(),level:e,event:r,...n})+`
|
|
4
|
-
`;Ut(st(t,"diagnostics.ndjson"),o)}catch{}}import{promises as E}from"fs";import{join as A}from"path";async function Yt(t){try{let e=A(t,"tests"),r=await E.readdir(e).catch(()=>[]);for(let n of r){let i=A(e,n,"steps"),o=await E.readdir(i).catch(()=>[]);for(let s of o){let a=await E.readFile(A(i,s,"failure.yaml"),"utf8").catch(()=>null);if(a!=null)try{let c=R(a);if(c&&typeof c=="object"&&c.triage)return!0}catch{}}}}catch{}return!1}async function at(t,e,r){let n=A(t,"tests",e,"logs");if(r)try{await E.mkdir(n,{recursive:!0}),await E.copyFile(r,A(n,"tui.log"))}catch{}let i=await xe(n);i.length&&await we(t,e,ve(i))}async function ke(t){let e=t.cwd??process.cwd(),r=t.packDir??w(t.executionId,e);if(!t.saved&&!t.packDir)return await pe(t.executionId,e),{sealed:!1};await at(r,t.testId,t.tuiLogPath);let n=A(r,"run.yaml"),i=R(await E.readFile(n,"utf8"));i.environment={...i.environment??{},saved:t.saved,run_kind:t.runKind},await E.writeFile(n,y(i,{lineWidth:-1}));let o=await E.open(n,"r+");try{await o.sync()}finally{await o.close()}let s=await Yt(r);await L(r,new Date().toISOString());let a;try{let d=await F(r,"L1");a=d.valid;let p=(d.diagnostics??[]).filter(u=>String(u?.code??"").includes("failure.status_disagrees"));if(p.length>0)if(t.expectStatusDisagrees||s){let u=t.expectStatusDisagrees?"expected under --bug-detection continue":"self-explained by triaged failure record(s)";console.warn(`evidence: ${p.length} status_disagrees advisory(ies) \u2014 ${u}`)}else console.warn(`evidence: ${p.length} status_disagrees advisory(ies) \u2014 step verdicts disagree with their failure records`,p);if(!d.valid){console.warn(`evidence: sealed pack ${t.executionId} failed L1 validation`,d.diagnostics);let u=String(d.diagnostics?.[0]?.code??"");be(Ie(r,t.testId),"warn","EVIDENCE_INVALID",{execution_id:t.executionId,first_code:u,surface:t.surface??"testmd"},t.log)}}catch(d){console.warn(`evidence: validation error for ${t.executionId}`,d)}let c;if(t.saved&&t.packDir)try{c=await Ye(r,t.executionId,e)}catch(d){console.warn(`evidence: store install failed for ${t.executionId}`,d)}if(t.outputStemDir)try{await ye(t.outputStemDir,{execution_id:t.executionId,run_kind:t.runKind,status:t.verdict,valid:a,at:new Date().toISOString()})}catch(d){console.warn(`evidence: execution-pointer append failed for ${t.executionId} (pack is sealed)`,d)}return{sealed:!0,valid:a,storePath:c}}import{release as ct}from"os";import{execFileSync as Kt}from"child_process";var dt=!1,W;function Wt(){if(!dt)if(dt=!0,process.platform==="darwin")try{W=Kt("sw_vers",["-productVersion"],{timeout:2e3}).toString().trim()||void 0}catch{W=ct()||void 0}else W=ct()||void 0;return W}function Ee(t){let e={os:ce(process.platform)},r=Wt();if(r&&(e.os_version=r),t.cdpBrowser){let n=/^([A-Za-z]+)\/(\d+)/.exec(t.cdpBrowser);n&&(e.browser=n[1].replace(/^Headless/,""),e.browser_version=n[2])}return t.resolution&&(e.resolution=t.resolution),e}async function ut(t){if(t)try{let e=await fetch(`${t}/json/version`,{signal:AbortSignal.timeout(2e3)});if(!e.ok)return;let r=await e.json();return typeof r.Browser=="string"?r.Browser:void 0}catch{return}}function Jt(t){let e;return()=>(e||(e=ut(t)),e)}import{promises as Se,existsSync as Re,readFileSync as qt}from"fs";import{basename as er,join as S}from"path";import{readFileSync as Xt}from"fs";import{dirname as Zt,resolve as Qt}from"path";function lt(t,e){let r=Qt(t),n=Xt(r,"utf8");return P(e?T(n,H(Zt(r),e)):n)}var j=class t{constructor(e){this.opts=e}executionId;testId;definitionPath=null;definitionContent=null;accumulatedSteps=[];maxOrdinal=0;_packDirOverride;_attached=!1;get attached(){return this._attached}static async attach(e){let r=er(e.packDir).replace(/\.evidence$/,""),n=new t({origin:"testrun",runKind:"author",pid:process.pid,title:e.testId,started:new Date().toISOString(),producerVersion:ze,cwd:e.cwd});n.executionId=r,n.testId=e.testId,n._packDirOverride=e.packDir,n._attached=!0;let i=S(e.packDir,"tests",e.testId);return await Se.mkdir(i,{recursive:!0}),e.definition&&(await Se.writeFile(S(i,e.definition.path),e.definition.content),n.definitionPath=e.definition.path,n.definitionContent=e.definition.content),n}async start(){if(this._attached)throw new Error("attach-mode session is already started");this.executionId=Q(),this.testId=this.opts.testmdRelPath?oe(this.opts.testmdRelPath):se(this.opts.objectiveOrName??"session",this.opts.sessionId??this.executionId);let e=this.opts.definition??null;return await le({execution_id:this.executionId,title:this.opts.title,started:this.opts.started,producerVersion:this.opts.producerVersion,surfaces:this.opts.surfaces,run_kind:this.opts.runKind,origin:this.opts.origin,pid:this.opts.pid,...this.opts.credits!==void 0?{credits:this.opts.credits}:{}},this.testId,e,this.opts.cwd,this.opts.packRootDir?this.pack:void 0),e&&(this.definitionPath=e.path,this.definitionContent=e.content),{executionId:this.executionId,testId:this.testId,packTestDir:this.packTestDir}}get pack(){return this._packDirOverride?this._packDirOverride:this.opts.packRootDir?S(this.opts.packRootDir,`${this.executionId}.evidence`):w(this.executionId,this.opts.cwd)}get packTestDir(){return S(this.pack,"tests",this.testId)}async writeDefinition(e,r="test.md"){await Se.writeFile(S(this.packTestDir,r),e),this.definitionPath=r,this.definitionContent=e}computeAssuranceId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let e=S(this.opts.cwd,this.opts.testmdRelPath);if(Re(e))return D(qt(e,"utf8"))?.id}}catch{}}computeDefinitionId(){try{if(this.opts.testmdRelPath&&this.opts.cwd){let e=S(this.opts.cwd,this.opts.testmdRelPath),r=S(this.opts.cwd,".context"),n=Re(r)?_(r):void 0;if(Re(e))return lt(e,n)}if(this.definitionContent!=null)return P(this.definitionContent)}catch{}}noteSpawn(e){this.accumulatedSteps.push(...e.steps),this.maxOrdinal=Math.max(this.maxOrdinal,e.maxOrdinal)}nextOrdinalOffset(){return this.maxOrdinal}get steps(){return this.accumulatedSteps}async writeResult(e){let r=_e(e.spawns),n=this.pack;await he(n,this.testId,ge({testId:this.testId,status:r,durationMs:e.durationMs,definitionPath:this.definitionPath,definitionId:this.computeDefinitionId(),assuranceId:this.computeAssuranceId(),externalId:ae(e.externalIdInput),environment:de(e.runnerEnv,e.intentEnv),steps:e.steps,tags:e.tags}));let i=e.externalIdInput;return e.log&&(i.commit_id||i.test_id||i.testcase_id)&&e.log("info","EVIDENCE_EXTERNAL_ID","Evidence external-id mapping",{execution_id:this.executionId,commit_id:i.commit_id??null,test_id:i.test_id??null,testcase_id:i.testcase_id??null,project_id:i.project_id??null,session_id:i.session_id??null,session_name:i.session_name??null}),r}get id(){return this.executionId}get test(){return this.testId}};async function tr(t,e,r=ee){try{let n=await r(t);if(n.aborted.length>0||n.removed.length>0)try{e?.("info","EVIDENCE_RECOVERY","Startup evidence recovery swept incomplete packs",{aborted:n.aborted,removed:n.removed,origin:"startup"})}catch{}return n}catch(n){return console.warn("evidence: startup recovery failed",n),{aborted:[],removed:[]}}}import{promises as Ir}from"fs";import{existsSync as $e,mkdirSync as gr,readdirSync as vr,readFileSync as hr,rmSync as wr,statSync as yr,writeFileSync as _r}from"fs";import{join as O}from"path";import{mkdirSync as rr,renameSync as nr,rmSync as ir,writeFileSync as or}from"fs";import{join as pt}from"path";var sr=5e6;function ft(t,e,r){let n=pt(t,"coverage","sources"),i=new Map,o=!1;try{for(let s of r.usecases)for(let a of s.sources){if(i.has(a.id)){a.file=i.get(a.id);continue}if(!a.cid)continue;let c=tt(e,a.cid);if(c===null||c.byteLength>sr)continue;o||(rr(n,{recursive:!0}),o=!0);let d=pt(n,a.id),l=`${d}.tmp-${process.pid}`;or(l,c),nr(l,d);let p=`coverage/sources/${a.id}`;i.set(a.id,p),a.file=p}}catch{for(let s of r.usecases)for(let a of s.sources)delete a.file;if(o)try{ir(n,{recursive:!0,force:!0})}catch{}}}import{existsSync as Ce,readFileSync as N,renameSync as ur,writeFileSync as lr}from"fs";import{dirname as wt,isAbsolute as yt,resolve as _t}from"path";var ar=new Set(["inline","testmd","testrun"]),cr=new Set(["inferred","authored","runtime-derived"]),Pe=new Set(["passed","failed","broken","skipped"]);function mt(t,e,r){if(r.facts.length===0)return{record:null,errors:[{code:"EMPTY_EXECUTIONS",detail:"a run with no designed units attaches no facts \u2014 skip the call"}]};let n=e;for(let i=0;;i++){let o=z(t);if(n.latestHash!==o){if(i>=3)return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(n.latestHash)} but chain head is ${String(o)} \u2014 retry budget exhausted`}]};n=_(t);continue}let s=dr(t,n,r);if(s!=="cas")return s;if(i>=3)return{record:null,errors:[{code:"STALE_BASIS",detail:"concurrent appends kept moving the head \u2014 retry budget exhausted"}]};n=_(t)}}function dr(t,e,r){let n=[],i=[];for(let s of r.facts){let a=`executions[${s.ref}]`,c=e.resolve(s.ref),d=c?e.tipOf(c.cid):null;if(!c||!d||e.superseded.has(d)){n.push({code:"UNKNOWN_REF",detail:`${a}: '${s.ref}' is not a live committed node`});continue}if(e.nodeLabel.get(d)!==te.TEST){n.push({code:"ILLEGAL_TARGET",detail:`${a}: execution facts attach to tests \u2014 '${s.ref}' is a ${e.nodeLabel.get(d)}`});continue}if(!ar.has(s.mode)){n.push({code:"BAD_MODE",detail:`${a}: mode '${s.mode}' not in inline|testmd|testrun`});continue}if(!Pe.has(s.verdict)){n.push({code:"BAD_VERDICT",detail:`${a}: verdict '${s.verdict}' not in ${[...Pe].join("|")}`});continue}if(!cr.has(s.oracle_mode)){n.push({code:"BAD_ORACLE_MODE",detail:`${a}: oracle_mode '${s.oracle_mode}' not in inferred|authored|runtime-derived`});continue}if(typeof s.drift_flag!="boolean"||typeof s.stale_at_run!="boolean"){n.push({code:"MISSING_FIELD",detail:`${a}: drift_flag and stale_at_run are required booleans`});continue}if(!s.execution_id||!s.started_at||!s.definition_id_at_run){n.push({code:"MISSING_FIELD",detail:`${a}: execution_id, started_at and definition_id_at_run are required`});continue}let l=[];for(let p of s.per_ac??[]){let u=e.resolve(p.ac_ref),f=u?e.tipOf(u.cid):null;if(!u||!f||e.superseded.has(f)||e.nodeLabel.get(f)!==te.AC){n.push({code:"UNKNOWN_REF",detail:`${a}.per_ac: '${p.ac_ref}' is not a live AC`});continue}if(!Pe.has(p.verdict)){n.push({code:"BAD_VERDICT",detail:`${a}.per_ac['${p.ac_ref}']: verdict '${p.verdict}'`});continue}l.push({ac_ref:e.nameOf.get(f)??f,verdict:p.verdict})}i.push({about:d,definition_id_at_run:s.definition_id_at_run,verdict:s.verdict,...l.length?{per_ac:l}:{},drift_flag:s.drift_flag,oracle_mode:s.oracle_mode,stale_at_run:s.stale_at_run,...s.unresolved_acs?.length?{unresolved_acs:s.unresolved_acs}:{},execution_id:s.execution_id,...s.evidence_id?{evidence_id:s.evidence_id}:{},...s.duration_ms!==void 0?{duration_ms:s.duration_ms}:{},started_at:s.started_at,mode:s.mode,local:s.local,...s.via_parent?{via_parent:s.via_parent}:{}})}if(n.length>0)return{record:null,errors:n};let o;try{o=G(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[],executions:i,...r.eventIds&&r.eventIds.length>0?{event_ids:r.eventIds}:{},source_head_moves:{}},{expectPrev:e.latestHash})}catch(s){if(s instanceof Qe)return"cas";throw s}return U(t),{record:o.record,errors:null}}function xt(t){let e={failed:3,broken:2,skipped:1,passed:0},r=new Map;for(let n of t)for(let i of n.verifies??[]){let o=r.get(i);(o===void 0||(e[n.status]??0)>(e[o]??0))&&r.set(i,n.status)}return[...r.entries()].map(([n,i])=>({ref:n,verdict:i}))}function It(t){let e=[],r=Y(t.cwd);if(!Ce(r))return{synced:0,superseded:0,skipped:"no-context",warnings:e};let n=t.by??{kind:"ai",id:"exec-sync"},i=_(r),o=[],s=0,a=new Set;for(let d of t.members){let l=yt(d.path)?d.path:_t(t.cwd,d.path);for(let p of pr(l)){if(a.has(p.path))continue;a.add(p.path);let u=p.path===l?void 0:D(N(l,"utf8"))?.id,f=N(p.path,"utf8"),m=D(f);if(!m?.id)continue;let g=i.resolve(m.id),I=g?i.tipOf(g.cid):null;if(!g||!I||i.superseded.has(I)){e.push(`sync: ${m.id} does not resolve to a live test \u2014 skipped (foreign store?)`);continue}let b=P(T(f,H(wt(p.path),i))),v=String(i.getNode(I)?.content.test_md_blob??""),M=P(T(v,We(i))),B=!1,Z=I;if(b===M)m.base!==M&&ht(p.path,f,M,e);else if(m.base===M){let h=fr(r,i,I,f,b,n);h.error?(e.push(`sync: could not supersede ${m.id}: ${h.error}`),B=!0):(s++,Z=h.newCid,B=h.oracleTier,ht(p.path,N(p.path,"utf8"),b,e),i=_(r))}else B=!0,e.push(m.base?`sync: ${m.id} was edited from an older version \u2014 graph kept; reconcile via a redesign or maintain`:`sync: ${m.id} carries no base pin (hand-copied file?) \u2014 fact attached with drift flag`);let Ve=i.getNode(Z)?.content.check,Me=p.path===l?d.acs??[]:[],Be=Me.filter(h=>gt(i,h.ref)),He=Me.filter(h=>!gt(i,h.ref)).map(h=>h.ref);o.push({ref:m.id,definition_id_at_run:b,verdict:d.verdict,...Be.length?{per_ac:Be.map(h=>({ac_ref:h.ref,verdict:h.verdict}))}:{},drift_flag:B,oracle_mode:Ve?.expected_mode??(Ke(Ve?.operand)?"runtime-derived":"inferred"),stale_at_run:i.stale(Z)!=="fresh",...He.length?{unresolved_acs:He}:{},execution_id:d.executionId,...d.evidenceId?{evidence_id:d.evidenceId}:{},...d.durationMs!==void 0?{duration_ms:d.durationMs}:{},started_at:d.startedAt,mode:d.mode,local:d.local,...u?{via_parent:u}:{}})}}if(o.length===0)return{synced:0,superseded:s,warnings:e};let c=mt(r,_(r),{facts:o,by:n});return c.errors?(e.push(...c.errors.map(d=>`sync facts: ${d.code}: ${d.detail}`)),{synced:0,superseded:s,warnings:e}):{synced:o.length,superseded:s,warnings:e}}function pr(t){let e=[],r=new Set,n=i=>{if(r.has(i)||!Ce(i))return;r.add(i);let o=N(i,"utf8");for(let s of o.split(`
|
|
5
|
-
`)){let a=/^@import\s+(\S+)\s*$/.exec(s.trim());if(!a)continue;let c=yt(a[1])?a[1]:_t(wt(i),a[1]);Ce(c)&&D(N(c,"utf8"))?.id&&n(c)}e.push({path:i})};return n(t),e}function gt(t,e){let r=t.resolve(e),n=r?t.tipOf(r.cid):null;return!!(r&&n&&!t.superseded.has(n)&&t.nodeLabel.get(n)==="ac")}function fr(t,e,r,n,i,o){let s=e.getNode(r);if(!s)return{oracleTier:!1,error:"tip unreadable"};let a=Je(n),c=String(s.content.test_md_blob??""),d=/^#\s+(.+?)\s*$/m.exec(a)?.[1]??String(s.content.title??""),l={...s.content,test_md_blob:a,definitionId:i,title:d},p=Xe("test",l);if(p.length>0)return{oracleTier:!1,error:p.map(g=>g.detail).join("; ")};let u=Ze("test",l);if(u===r)return{newCid:r,oracleTier:!1};let f=vt(c)!==vt(a),m=z(t);if(e.latestHash!==m)return{oracleTier:f,error:`store advanced under the sync (basis ${String(e.latestHash)} vs head ${String(m)}) \u2014 re-run to retry`};try{G(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:u,label:"test",content:l}],edges:[],review:[{id:u,kind:"review-item",resolution:"edited",edit:null,reason:"edited on disk (run sync)",by:o}],supersessions:[{kind:"node",old:r,new:u,reason:"edited on disk (run sync)",by:o}],source_head_moves:{}},{expectPrev:m})}catch(g){return{oracleTier:f,error:g instanceof Error?g.message:String(g)}}return U(t),{newCid:u,oracleTier:f}}var mr=/\s@verifies\s+(ac-[\w.:\/-]+(?:\s*,\s*ac-[\w.:\/-]+)*)\s*$/;function vt(t){let e=[],r=t.split(`
|
|
6
|
-
`),n=!1;for(let i of r){if(/^##\s/.test(i)){n=/\bassert\b/i.test(i);let o=mr.exec(i);o&&e.push(`v:${o[1].trim()}`);continue}n&&i.trim()!==""&&e.push(i.trim())}return e.join(`
|
|
7
|
-
`)}function ht(t,e,r,n){try{let i=e.split(`
|
|
8
|
-
`),o=-1;if(i[0]?.trim()==="---"){for(let c=1;c<i.length;c++)if(i[c].trim()==="---"){o=c;break}}if(o<0)return;let s=!1;for(let c=1;c<o;c++){if(/^\s+base:\s*sha256:[0-9a-f]+\s*$/.test(i[c])){i[c]=i[c].replace(/sha256:[0-9a-f]+/,r),s=!0;break}if(/^assurance:\s*$/.test(i[c])&&!i.slice(c,Math.min(c+3,o)).some(d=>/^\s+base:/.test(d))){i.splice(c+2,0,` base: ${r}`),s=!0;break}}if(!s)return;let a=`${t}.tmp-sync`;lr(a,i.join(`
|
|
9
|
-
`)),ur(a,t)}catch(i){n.push(`sync: pin refresh failed for ${t} (${i instanceof Error?i.message:String(i)}) \u2014 next run self-heals`)}}var xr={passed:"passed",failed:"failed",broken:"blocked",skipped:"not-run"},bt=(t,e)=>{try{if(!$e(e))return{status:"skipped",reason:"no context store at the project root"};let r=O(t,"tests");if(!$e(r))return{status:"skipped",reason:"pack has no tests/"};let n=new Map;for(let a of vr(r)){let c=O(r,a,"result.yaml");if(!$e(c)||!yr(O(r,a)).isDirectory())continue;let d=R(hr(c,"utf8"));if(!d?.definition_id&&!d?.assurance_id)continue;let l=xt(d.steps??[]),p={testShortId:String(d.test??a),execution:xr[String(d.status)]??"not-run",...l.length?{acs:l}:{}};d.assurance_id&&n.set(`id:${d.assurance_id}`,p),d.definition_id&&n.set(`def:${d.definition_id}`,p)}let i=et(_(e),n,{scope:"run"}),o=qe(i);ft(t,e,i);let s=y({...i,rollup:o},{lineWidth:-1});return gr(O(t,"coverage"),{recursive:!0}),_r(O(t,"coverage","usecases.yaml"),s),{status:"written"}}catch(r){try{wr(O(t,"coverage","sources"),{recursive:!0,force:!0})}catch{}return{status:"skipped",reason:r instanceof Error?r.message:String(r)}}};async function br(t){try{let e=new j({origin:"inline",runKind:"author",pid:t.pid,title:t.title,started:new Date().toISOString(),producerVersion:t.producerVersion,surfaces:t.surfaces,objectiveOrName:t.objectiveOrName,sessionId:t.sessionId,cwd:t.cwd,packRootDir:t.packRootDir}),r=await e.start();return{session:e,...r,packDir:e.pack,spawns:[],startedAtMs:Date.now(),cwd:t.cwd}}catch(e){return console.warn("evidence: inline pack creation failed",e),null}}function kr(t,e,r){if(!t)return;t.session.noteSpawn(e),e.resolution&&(t.resolution=e.resolution);let n=(r?.per_flow_metadata??[]).map(i=>({resultCode:i?.result_code!=null?Number(i.result_code):null}));t.spawns.push({resultCode:r?.result_code!=null?Number(r.result_code):null,...n.length?{perFlow:n}:{}})}function Er(t){if(t)return{packTestDir:t.packTestDir,ordinalOffset:t.session.nextOrdinalOffset()}}async function Sr(t,e){if(!t)return null;if(t.finalized)return t.finalized;let r=(n,i,o)=>e.log?e.log("warn",n,i,o):console.warn(`evidence: ${i}`,o??"");try{if(e.recordedTestPath)try{await t.session.writeDefinition(await Ir.readFile(e.recordedTestPath,"utf8"))}catch(s){r("EVIDENCE_DEFINITION_FAILED","could not attach synthesized test.md",{error:String(s)})}let n=e.cdpBrowserCapture?await e.cdpBrowserCapture():void 0,i=await t.session.writeResult({steps:t.session.steps,spawns:t.spawns.length?t.spawns:[{resultCode:null}],externalIdInput:{...e.externalIdInput,execution_id:t.executionId},runnerEnv:Ee({cdpBrowser:n,resolution:t.resolution}),intentEnv:{model:e.model,platform:"Desktop",platform_type:"web"},durationMs:e.durationMs??Date.now()-t.startedAtMs,log:e.log});try{if(e.recordedTestPath){let s=It({cwd:e.cwd??t.cwd??process.cwd(),members:[{path:e.recordedTestPath,verdict:i,executionId:t.executionId,startedAt:new Date(t.startedAtMs).toISOString(),mode:"inline",local:e.local??!1}]});for(let a of s.warnings)r("EXEC_SYNC",a)}}catch(s){r("EXEC_SYNC","exec-sync failed",{error:String(s)})}try{let s=(e.coverageWriter??bt)(t.packDir,Y(e.cwd??t.cwd??process.cwd()));s.status==="skipped"&&r("EVIDENCE_COVERAGE_SKIPPED",`coverage/usecases.yaml not written: ${s.reason}`)}catch(s){r("EVIDENCE_COVERAGE_SKIPPED","coverage writer threw",{error:String(s)})}let o=await ke({executionId:t.executionId,testId:t.testId,saved:e.saved,runKind:"author",verdict:i,cwd:e.cwd??t.cwd,packDir:t.packDir,tuiLogPath:e.tuiLogPath,log:e.log,surface:"inline"});return t.finalized=o,e.log?.("info","EVIDENCE_SEALED","Inline pack sealed",{execution_id:t.executionId,verdict:i,valid:o.valid,pack:t.packDir,store_copy:o.storePath??null}),o}catch(n){return r("EVIDENCE_SEAL_FAILED","inline pack finalize failed",{error:String(n)}),null}}import{statSync as Ar,openSync as Or,readSync as Fr,closeSync as Lr}from"fs";import{basename as Tr,resolve as jr}from"path";import{createServer as Rr}from"http";import{createReadStream as Pr,promises as Cr}from"fs";import{randomBytes as $r}from"crypto";var J="127.0.0.1";function kt(t,e){if(!t)return null;let r=/^bytes=(\d*)-(\d*)$/.exec(t.trim());if(!r)return null;let[,n,i]=r;if(n===""&&i==="")return null;if(n===""){let a=Number(i);return a===0||e===0?"unsatisfiable":{start:Math.max(0,e-a),end:e-1}}let o=Number(n);if(o>=e)return"unsatisfiable";let s=i===""?e-1:Math.min(Number(i),e-1);return s<o?null:{start:o,end:s}}async function De(t){let e=$r(16).toString("hex"),r=Rr((i,o)=>{Dr(i,o,t,e).catch(()=>o.destroy())});await new Promise((i,o)=>{r.once("error",o),r.listen(t.port??0,J,()=>{r.removeListener("error",o),i()})});let n=r.address().port;return{port:n,urlFor:i=>`http://${J}:${n}/${e}/${encodeURIComponent(i)}`,close:()=>new Promise(i=>{r.close(()=>i()),r.closeAllConnections()})}}async function Dr(t,e,r,n){let i=t.url??"/",o=v=>{try{r.log?.("warn","EVIDENCE_SERVE_DENIED",{reason:v,path:i})}catch{}};if(t.headers.host!==`${J}:${t.socket.localPort}`){o("host_mismatch"),e.writeHead(403).end();return}let s=t.headers.origin;if(s!==void 0&&!r.allowedOrigins.includes(s)){o("origin_denied"),e.writeHead(403).end();return}let a=s?{"Access-Control-Allow-Origin":s,Vary:"Origin","Access-Control-Expose-Headers":"Content-Range, Content-Length"}:{};if(t.method==="OPTIONS"){let v={...a,"Access-Control-Allow-Methods":"GET, HEAD, OPTIONS","Access-Control-Allow-Headers":"range","Access-Control-Max-Age":"86400"};t.headers["access-control-request-private-network"]==="true"&&(v["Access-Control-Allow-Private-Network"]="true"),e.writeHead(204,v).end();return}if(t.method!=="GET"&&t.method!=="HEAD"){e.writeHead(405,a).end();return}let c;try{let v=new URL(t.url??"/",`http://${J}`).pathname.split("/");if(v.length!==3||v[1]!==n){o("bad_token"),e.writeHead(404,a).end();return}c=decodeURIComponent(v[2])}catch{o("not_found"),e.writeHead(404,a).end();return}let d=r.packs.get(c);if(!d){o("not_found"),e.writeHead(404,a).end();return}let l;try{let v=await Cr.stat(d);if(!v.isFile())throw new Error("not a file");l=v.size}catch{o("not_found"),e.writeHead(404,a).end();return}let p={...a,"Accept-Ranges":"bytes","Content-Type":"application/zip","Cache-Control":"no-store"};if(t.method==="HEAD"){e.writeHead(200,{...p,"Content-Length":String(l)}).end();return}let u=kt(t.headers.range,l);if(u==="unsatisfiable"){o("unsatisfiable"),e.writeHead(416,{...a,"Content-Range":`bytes */${l}`}).end();return}let[f,m,g]=u===null?[0,l-1,200]:[u.start,u.end,206],I={...p,"Content-Length":String(m-f+1)};if(g===206&&(I["Content-Range"]=`bytes ${f}-${m}/${l}`),e.writeHead(g,I),l===0){e.end();return}let b=Pr(d,{start:f,end:m});b.on("error",()=>e.destroy()),e.on("close",()=>b.destroy()),b.pipe(e)}function V(t,e){return(e??Ge(t).evidenceViewerUrl).replace(/\/+$/,"")}function Ae(t,e){return`${e}/?pack=${encodeURIComponent(t)}`}function Oe(t){return`evidence: view locally with \`kane-cli evidence serve ${t}\``}async function Nr(t,e,r={}){let n=r.out??(l=>process.stdout.write(l+`
|
|
10
|
-
`)),i=l=>(n(`error: ${l}`),2);if(e.env!=="prod"&&e.env!=="stage")return i(`invalid --env: ${String(e.env)}`);if(e.port!==void 0&&(!Number.isInteger(e.port)||e.port<1||e.port>65535))return i("invalid --port: expected an integer 1-65535");let o;try{o=V(e.env,e.viewerUrl),new URL(o)}catch{return i(`invalid --viewer-url: ${e.viewerUrl}`)}if(t.length===0)return i("no pack paths given");let s=new Map;for(let l of t){let p=jr(l),u;try{u=Ar(p)}catch{return i(`${l}: not found`)}if(u.isDirectory())return i(`${l}: is a directory \u2014 packs must be sealed .evidence files (run the execution to completion, or seal it, first)`);if(!u.isFile())return i(`${l}: not a regular file`);let f=Buffer.alloc(2),m=Or(p,"r");try{Fr(m,f,0,2,0)}finally{Lr(m)}if(f.toString("latin1")!=="PK")return i(`${l}: not a sealed evidence pack (zip magic missing)`);let g=Tr(p);if(s.has(g))return i(`duplicate pack basename: ${g} (URL names collide \u2014 rename one)`);s.set(g,p)}let a=r.log??((l,p,u)=>process.stderr.write(`warn: ${p} reason=${u.reason} path=${u.path}
|
|
11
|
-
`)),c;try{c=await De({packs:s,allowedOrigins:[new URL(o).origin],port:e.port,log:a})}catch(l){return i(`could not bind 127.0.0.1${e.port?`:${e.port}`:""} \u2014 ${l.message}`)}n(`serving ${s.size} pack${s.size===1?"":"s"} on http://127.0.0.1:${c.port}`);for(let l of s.keys()){let p=c.urlFor(l);n(l),n(` pack ${p}`),n(` viewer ${Ae(p,o)}`)}return n("press Ctrl-C to stop"),await(r.hold??Vr)(),await c.close(),0}function Vr(){return new Promise(t=>{let e=process.listeners("SIGINT");process.removeAllListeners("SIGINT"),process.once("SIGINT",()=>{for(let r of e)process.on("SIGINT",r);t()})})}import{promises as X}from"fs";import{tmpdir as zr}from"os";import{join as Rt,resolve as Le}from"path";var Mr=["error","prefer_first","prefer_latest","discard"],Br=["external_id.commit_id","external_id.test_id"];function Et(t){let e=t.replace(/-/g,"_");return Mr.includes(e)?e:null}function St(t){let e=t==="discard"?{on_collision:"discard"}:{on_collision:"error",identity:{keys:[...Br],on_same:t??"nest",on_different:t?"error":"split"}};return y({packs:{require_status:"finalized",require_valid:"L1",on_ineligible:"abort"},tests:e,rules:[{file:"run.yaml",key:"run_id",must:"different",on_violation:"skip"},{file:"result.yaml",key:"external_id.project_id",must:"same",on_violation:"error"},{file:"result.yaml",key:"external_id.org_id",must:"same",on_violation:"error"}]},{lineWidth:-1})}async function Fe(t){try{if(!t.isTTY){t.log(Oe(t.packPath));return}let e=V(t.env);await(t.renderPrompt??Hr)(t.packPath,e)}catch(e){try{t.log(`evidence view failed \u2014 ${e.message}`)}catch{}}}async function Hr(t,e){let r=await import("./react-QWOAB3TB.js"),{render:n}=await import("./build-JIKYOZUH.js"),{EvidenceViewOffer:i}=await import("./EvidenceViewOffer-DNCQ3A6R.js");await new Promise(o=>{let s=n(r.default.createElement(i,{packPath:t,viewerBase:e,onDone:()=>{s.unmount(),o()}}),{stdout:process.stderr,exitOnCtrlC:!1})})}async function Gr(t,e,r=process.cwd(),n={}){let i=n.out??(u=>process.stdout.write(u+`
|
|
12
|
-
`)),o=n.err??(u=>process.stderr.write(u+`
|
|
13
|
-
`)),s=u=>(o(`evidence merge: ${u}`),2);if(!e.runId)return s("--run-id is required (merged identity is the caller's fact)");if(e.rules&&e.onCollision)return s("--rules and --on-collision are mutually exclusive");let a;if(e.onCollision!==void 0){let u=Et(e.onCollision);if(!u)return s(`invalid --on-collision: ${e.onCollision} (expected error | prefer-first | prefer-latest | discard)`);a=u}let c=[];for(let u of t){let f=await Ur(u,r);if(!f)return s(`no pack found for "${u}"`);c.push(f)}let d=e.out?Le(r,e.out):w(e.runId,r),l=null,p;e.rules?p=Le(r,e.rules):(l=await X.mkdtemp(Rt(zr(),"kane-merge-rules-")),p=Rt(l,"merge-rules.yaml"),await X.writeFile(p,St(a)));try{let u=await(n.mergeFn??Ue)(c,{runId:e.runId,out:d,rulesPath:p,title:e.title,finalize:e.finalize});return e.json?i(JSON.stringify(u)):Yr(i,u),u.output.finalized&&!e.json&&await(n.offer??Fe)({packPath:d,env:e.env,isTTY:n.isTTY??(!!process.stdin.isTTY&&!!process.stderr.isTTY),log:o}),0}catch(u){let f=u instanceof Error?u.message:String(u);return u?.code==="ABORT"?(o(`evidence merge: aborted \u2014 ${f}`),1):s(f)}finally{l&&await X.rm(l,{recursive:!0,force:!0}).catch(()=>{})}}async function Ur(t,e){let r=Le(e,t);if(await Pt(r))return r;let n=w(t,e);return await Pt(n)?n:null}async function Pt(t){try{return await X.stat(t),!0}catch{return!1}}function Yr(t,e){let{packs:r,tests:n,output:i}=e;t(`evidence: merged ${n.merged} tests from ${r.eligible.length} packs -> ${i.path} (${i.finalized?"sealed":"live"})`);for(let o of r.skipped)t(` skipped ${o.runId}: ${o.rule} \u2014 ${o.reason}`);for(let o of n.collisions){let s;o.action==="nest"?s=`nested into ${o.folder}, latest ${o.winner}`:o.action==="split"?s=`split into ${o.folder}`:s=`winner ${o.winner}`,t(` collision ${o.test}: ${s} (${o.rule})`)}for(let o of n.discarded)t(` discarded ${o}`)}import{copyFileSync as Kr,existsSync as Te,mkdirSync as Wr}from"fs";import{join as Ct}from"path";function Jr(t,e,r){try{let n=Ct(t,"auteur","execution.json");if(Te(n))return!0;for(let i of e)if(!(!i||!Te(i)))return Wr(Ct(t,"auteur"),{recursive:!0}),Kr(i,n),!0}catch(n){try{r?.("debug","EVIDENCE_BLOB_COPY_FAILED","auteur execution blob copy failed",{operation:"ensureAuteurExecution",source:e.find(i=>i&&Te(i))??null,error:n instanceof Error?n.message:String(n)})}catch{}}return!1}import{readFileSync as Xr}from"fs";import{join as Zr}from"path";function Ne(t){let e=[],r=!0,n=o=>{if(o===null||typeof o!="object")return;let s=o;if(Array.isArray(s.operations))for(let a of s.operations){let c=a?.operation_id;typeof c=="string"&&c&&e.push(c)}if(Array.isArray(s.children)){s.content_type!=="generative_block"&&(r=!1);for(let a of s.children)n(a)}if(Array.isArray(s.branches)){r=!1;for(let a of s.branches){let c=a?.children;if(Array.isArray(c))for(let d of c)n(d)}}},i=t?.instructions;if(Array.isArray(i))for(let o of i)n(o);return{ids:e,linear:r}}function Qr(t){return Ne(t).ids}function je(t,e){let r=new Set(e.map(a=>a.action_id).filter(Boolean)),n=-1;for(let a of r){let c=t.indexOf(a);c>n&&(n=c)}let i=e.reduce((a,c)=>Math.max(a,c.ordinal),0),o=new Set,s=[];for(let a of t.slice(n+1))r.has(a)||o.has(a)||(o.add(a),s.push({id:a,ordinal:++i,status:"skipped",action_id:a}));return s}function $t(t,e){let r=new Set(e),n=t.filter(o=>o.action_id);if(n.some(o=>r.has(o.action_id))||n.length>e.length)return null;let i=0;return t.map(o=>o.action_id?{...o,action_id:e[i++]}:o)}function qr(t,e){if(t.length>e.length)return!1;for(let r=0;r<t.length;r++)if(e[r]!==t[r].action_id)return!1;return!0}function en(t,e,r,n=!0){if(e.length===0)return{steps:t,tail:[]};let i=(r&&n?$t(t,e):null)??t,o=i.filter(a=>a.action_id),s=new Set(e);return o.length>0&&o.every(a=>s.has(a.action_id))?{steps:i,tail:je(e,i)}:o.length>0&&!qr(o,e)?{steps:i,tail:[],unjoined:!0}:{steps:i,tail:je(e,i)}}function Dt(t){try{let e=Xr(Zr(t,"auteur","execution.json"),"utf8");return Ne(JSON.parse(e))}catch{return{ids:[],linear:!0}}}function tn(t){return Dt(t).ids}export{$ as a,re as b,ne as c,ie as d,oe as e,se as f,ae as g,ce as h,de as i,Lt as j,ue as k,le as l,Tt as m,jt as n,pe as o,ge as p,ve as q,he as r,we as s,ye as t,Nt as u,Vt as v,_e as w,Mt as x,xe as y,Ie as z,be as A,at as B,ke as C,Ee as D,ut as E,Jt as F,j as G,tr as H,xt as I,It as J,bt as K,br as L,kr as M,Er as N,Sr as O,kt as P,De as Q,V as R,Ae as S,Oe as T,Nr as U,Fe as V,Gr as W,Jr as X,Ne as Y,Qr as Z,je as _,$t as $,en as aa,Dt as ba,tn as ca};
|
package/dist/chunk-DXV6MBTD.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as s,k as l}from"./chunk-C4G7RVJ6.js";import{readFileSync as g,writeFileSync as o,mkdirSync as i,existsSync as p}from"fs";import{dirname as a}from"path";var n={window_size:{width:1920,height:1080},chrome_profile_path:"",default_url:l,model:"v16-alpha",project_id:null,project_name:null,folder_id:null,folder_name:null,mode:"testing",assertion_mode:"dom",network_ws:!1,network_sse:!1,bug_detection:"off",final_validation:!1,code_export:{enabled:!0,language:"python",skip_validation:!0},generate:{scenario_limit:2,per_scenario_limit:3,memory_enabled:!1},last_seen_version:"",hints_enabled:!0},c=class{constructor(r=s){this.path=r}exists(){return p(this.path)}load(){try{let r=g(this.path,"utf-8"),e=JSON.parse(r);return{...n,...e,code_export:{...n.code_export,...e.code_export??{}},generate:{...n.generate,...e.generate??{}}}}catch{return{...n,code_export:{...n.code_export},generate:{...n.generate}}}}set(r,e){try{let t=this.load();t[r]=e,i(a(this.path),{recursive:!0}),o(this.path,JSON.stringify(t,null,2)+`
|
|
3
|
-
`)}catch(t){let d=t instanceof Error?t.message:String(t);process.stderr.write(`[config] Failed to save config: ${d}
|
|
4
|
-
`)}}save(r){try{let t={...this.load(),...r};i(a(this.path),{recursive:!0}),o(this.path,JSON.stringify(t,null,2)+`
|
|
5
|
-
`)}catch(e){let t=e instanceof Error?e.message:String(e);process.stderr.write(`[config] Failed to save config: ${t}
|
|
6
|
-
`)}}writeRaw(r){try{i(a(this.path),{recursive:!0}),o(this.path,JSON.stringify(r,null,2)+`
|
|
7
|
-
`)}catch(e){let t=e instanceof Error?e.message:String(e);process.stderr.write(`[config] Failed to save config: ${t}
|
|
8
|
-
`)}}};export{c as a};
|
package/dist/chunk-EV3EHXEI.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as k,b as F}from"./chunk-VOHQA2SP.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};
|
package/dist/chunk-F7WKDMX7.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as ri,b as ii}from"./chunk-VOHQA2SP.js";import{b as ei}from"./chunk-NVGBE2DR.js";import{a as Rt,c as pt,e as Le}from"./chunk-UR6MHSHU.js";var di=pt(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.CHAR=`
|
|
3
|
-
\r -\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}`;wt.S=` \r
|
|
4
|
-
`;wt.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}";wt.NAME_CHAR="-"+wt.NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";wt.CHAR_RE=new RegExp("^["+wt.CHAR+"]$","u");wt.S_RE=new RegExp("^["+wt.S+"]+$","u");wt.NAME_START_CHAR_RE=new RegExp("^["+wt.NAME_START_CHAR+"]$","u");wt.NAME_CHAR_RE=new RegExp("^["+wt.NAME_CHAR+"]$","u");wt.NAME_RE=new RegExp("^["+wt.NAME_START_CHAR+"]["+wt.NAME_CHAR+"]*$","u");wt.NMTOKEN_RE=new RegExp("^["+wt.NAME_CHAR+"]+$","u");var tr=9,er=10,rr=13,ir=32;wt.S_LIST=[ir,er,rr,tr];function Ds(t){return t>=ir&&t<=55295||t===er||t===rr||t===tr||t>=57344&&t<=65533||t>=65536&&t<=1114111}wt.isChar=Ds;function ks(t){return t===ir||t===er||t===rr||t===tr}wt.isS=ks;function ci(t){return t>=65&&t<=90||t>=97&&t<=122||t===58||t===95||t===8204||t===8205||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=767||t>=880&&t<=893||t>=895&&t<=8191||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533||t>=65536&&t<=983039}wt.isNameStartChar=ci;function Rs(t){return ci(t)||t>=48&&t<=57||t===45||t===46||t===183||t>=768&&t<=879||t>=8255&&t<=8256}wt.isNameChar=Rs});var _i=pt(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.CHAR="-\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}";ct.RESTRICTED_CHAR="-\b\v\f-\x7F-\x84\x86-\x9F";ct.S=` \r
|
|
5
|
-
`;ct.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}";ct.NAME_CHAR="-"+ct.NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";ct.CHAR_RE=new RegExp("^["+ct.CHAR+"]$","u");ct.RESTRICTED_CHAR_RE=new RegExp("^["+ct.RESTRICTED_CHAR+"]$","u");ct.S_RE=new RegExp("^["+ct.S+"]+$","u");ct.NAME_START_CHAR_RE=new RegExp("^["+ct.NAME_START_CHAR+"]$","u");ct.NAME_CHAR_RE=new RegExp("^["+ct.NAME_CHAR+"]$","u");ct.NAME_RE=new RegExp("^["+ct.NAME_START_CHAR+"]["+ct.NAME_CHAR+"]*$","u");ct.NMTOKEN_RE=new RegExp("^["+ct.NAME_CHAR+"]+$","u");var pi=9,xi=10,gi=13,mi=32;ct.S_LIST=[mi,xi,gi,pi];function Ss(t){return t>=1&&t<=55295||t>=57344&&t<=65533||t>=65536&&t<=1114111}ct.isChar=Ss;function Os(t){return t>=1&&t<=8||t===11||t===12||t>=14&&t<=31||t>=127&&t<=132||t>=134&&t<=159}ct.isRestrictedChar=Os;function Ns(t){return t===9||t===10||t===13||t>31&&t<127||t===133||t>159&&t<=55295||t>=57344&&t<=65533||t>=65536&&t<=1114111}ct.isCharAndNotRestricted=Ns;function Is(t){return t===mi||t===xi||t===gi||t===pi}ct.isS=Is;function vi(t){return t>=65&&t<=90||t>=97&&t<=122||t===58||t===95||t===8204||t===8205||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=767||t>=880&&t<=893||t>=895&&t<=8191||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533||t>=65536&&t<=983039}ct.isNameStartChar=vi;function Ms(t){return vi(t)||t>=48&&t<=57||t===45||t===46||t===183||t>=768&&t<=879||t>=8255&&t<=8256}ct.isNameChar=Ms});var Ei=pt(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.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}";Mt.NC_NAME_CHAR="-"+Mt.NC_NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";Mt.NC_NAME_START_CHAR_RE=new RegExp("^["+Mt.NC_NAME_START_CHAR+"]$","u");Mt.NC_NAME_CHAR_RE=new RegExp("^["+Mt.NC_NAME_CHAR+"]$","u");Mt.NC_NAME_RE=new RegExp("^["+Mt.NC_NAME_START_CHAR+"]["+Mt.NC_NAME_CHAR+"]*$","u");function wi(t){return t>=65&&t<=90||t===95||t>=97&&t<=122||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=767||t>=880&&t<=893||t>=895&&t<=8191||t>=8204&&t<=8205||t>=8304&&t<=8591||t>=11264&&t<=12271||t>=12289&&t<=55295||t>=63744&&t<=64975||t>=65008&&t<=65533||t>=65536&&t<=983039}Mt.isNCNameStartChar=wi;function Ls(t){return wi(t)||t===45||t===46||t>=48&&t<=57||t===183||t>=768&&t<=879||t>=8255&&t<=8256}Mt.isNCNameChar=Ls});var vr=pt(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.SaxesParser=ue.EVENTS=void 0;var ce=di(),Ps=_i(),mr=Ei(),Lt=ce.isS,Bs=ce.isChar,De=ce.isNameStartChar,Ci=ce.isNameChar,Li=ce.S_LIST,Us=ce.NAME_RE,Hs=Ps.isChar,Xs=mr.isNCNameStartChar,$s=mr.isNCNameChar,Ys=mr.NC_NAME_RE,$e="http://www.w3.org/XML/1998/namespace",fe="http://www.w3.org/2000/xmlns/",qs={__proto__:null,xml:$e,xmlns:fe},zs={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},Ct=-1,zt=-2,bi=0,Gs=1,nr=2,Ws=3,oe=4,Vs=5,js=6,Zs=7,sr=8,Qs=9,Ks=10,Js=11,ta=12,Nt=13,Pe=14,ar=15,ea=16,or=17,ra=18,ia=19,hr=20,na=21,sa=22,aa=23,Ti=24,lr=25,Be=26,yi=27,oa=28,ha=29,Ai=30,la=31,fa=32,Kt=33,ua=34,fr=35,ke=36,ur=37,ca=38,Fi=39,Di=40,da=41,ki=42,pa=43,xa=44,cr=9,$t=10,dr=13,Ri=32,Si=33,Pi=34,Re=38,Bi=39,Ue=45,He=47,ga=59,Vt=60,he=61,Tt=62,kt=63,Ui=91,le=93,Oi=133,Ni=8232,Xe=t=>t===Pi||t===Bi,Hi=[Pi,Bi],ma=[...Hi,Ui,Tt],va=[...Hi,Vt,le],_a=[he,kt,...Li],wa=[...Li,Tt,Re,Vt];function xr(t,e,r){switch(e){case"xml":r!==$e&&t.fail(`xml prefix must be bound to ${$e}.`);break;case"xmlns":r!==fe&&t.fail(`xmlns prefix must be bound to ${fe}.`);break;default:}switch(r){case fe:t.fail(e===""?`the default namespace may not be set to ${r}.`:`may not assign a prefix (even "xmlns") to the URI ${fe}.`);break;case $e:switch(e){case"xml":break;case"":t.fail(`the default namespace may not be set to ${r}.`);break;default:t.fail("may not assign the xml namespace to another prefix.")}break;default:}}function Ea(t,e){for(let r of Object.keys(e))xr(t,r,e[r])}var Ca=t=>Ys.test(t),ba=t=>Us.test(t),Jt=0,Ii=1,pr=2;ue.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var Mi={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"},gr=class{constructor(e){this.opt=e??{},this.fragmentOpt=!!this.opt.fragment;let r=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,r){this.nameStartCheck=Xs,this.nameCheck=$s,this.isName=Ca,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},qs);let i=this.opt.additionalNamespaces;i!=null&&(Ea(this,i),Object.assign(this.ns,i))}else this.nameStartCheck=De,this.nameCheck=Ci,this.isName=ba,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 e;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=Jt,this.attribList=[];let{fragmentOpt:r}=this;this.state=r?Nt:bi,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=r,this.xmlDeclPossible=!r,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:i}=this.opt;if(i===void 0){if(this.opt.forceXMLVersion===!0)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");i="1.0"}this.setXMLVersion(i),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(zs),(e=this.readyHandler)===null||e===void 0||e.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(e,r){this[Mi[e]]=r}off(e){this[Mi[e]]=void 0}makeError(e){var r;let i=(r=this.fileName)!==null&&r!==void 0?r:"";return this.trackPosition&&(i.length>0&&(i+=":"),i+=`${this.line}:${this.column}`),i.length>0&&(i+=": "),new Error(i+e)}fail(e){let r=this.makeError(e),i=this.errorHandler;if(i===void 0)throw r;return i(r),this}write(e){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let r=!1;e===null?(r=!0,e=""):typeof e=="object"&&(e=e.toString()),this.carriedFromPrevious!==void 0&&(e=`${this.carriedFromPrevious}${e}`,this.carriedFromPrevious=void 0);let i=e.length,n=e.charCodeAt(i-1);!r&&(n===dr||n>=55296&&n<=56319)&&(this.carriedFromPrevious=e[i-1],i--,e=e.slice(0,i));let{stateTable:s}=this;for(this.chunk=e,this.i=0;this.i<i;)s[this.state].call(this);return this.chunkPosition+=i,r?this.end():this}close(){return this.write(null)}getCode10(){let{chunk:e,i:r}=this;if(this.prevI=r,this.i=r+1,r>=e.length)return Ct;let i=e.charCodeAt(r);if(this.column++,i<55296){if(i>=Ri||i===cr)return i;switch(i){case $t:return this.line++,this.column=0,this.positionAtNewLine=this.position,$t;case dr:return e.charCodeAt(r+1)===$t&&(this.i=r+2),this.line++,this.column=0,this.positionAtNewLine=this.position,zt;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;let n=65536+(i-55296)*1024+(e.charCodeAt(r+1)-56320);return this.i=r+2,n>1114111&&this.fail("disallowed character."),n}getCode11(){let{chunk:e,i:r}=this;if(this.prevI=r,this.i=r+1,r>=e.length)return Ct;let i=e.charCodeAt(r);if(this.column++,i<55296){if(i>31&&i<127||i>159&&i!==Ni||i===cr)return i;switch(i){case $t:return this.line++,this.column=0,this.positionAtNewLine=this.position,$t;case dr:{let s=e.charCodeAt(r+1);(s===$t||s===Oi)&&(this.i=r+2)}case Oi:case Ni:return this.line++,this.column=0,this.positionAtNewLine=this.position,zt;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;let n=65536+(i-55296)*1024+(e.charCodeAt(r+1)-56320);return this.i=r+2,n>1114111&&this.fail("disallowed character."),n}getCodeNorm(){let e=this.getCode();return e===zt?$t:e}unget(){this.i=this.prevI,this.column--}captureTo(e){let{i:r}=this,{chunk:i}=this;for(;;){let n=this.getCode(),s=n===zt,a=s?$t:n;if(a===Ct||e.includes(a))return this.text+=i.slice(r,this.prevI),a;s&&(this.text+=`${i.slice(r,this.prevI)}
|
|
6
|
-
`,r=this.i)}}captureToChar(e){let{i:r}=this,{chunk:i}=this;for(;;){let n=this.getCode();switch(n){case zt:this.text+=`${i.slice(r,this.prevI)}
|
|
7
|
-
`,r=this.i,n=$t;break;case Ct:return this.text+=i.slice(r),!1;default:}if(n===e)return this.text+=i.slice(r,this.prevI),!0}}captureNameChars(){let{chunk:e,i:r}=this;for(;;){let i=this.getCode();if(i===Ct)return this.name+=e.slice(r),Ct;if(!Ci(i))return this.name+=e.slice(r,this.prevI),i===zt?$t:i}}skipSpaces(){for(;;){let e=this.getCodeNorm();if(e===Ct||!Lt(e))return e}}setXMLVersion(e){this.currentXMLVersion=e,e==="1.0"?(this.isChar=Bs,this.getCode=this.getCode10):(this.isChar=Hs,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=Gs}sBeginWhitespace(){let e=this.i,r=this.skipSpaces();switch(this.prevI!==e&&(this.xmlDeclPossible=!1),r){case Vt:if(this.state=ar,this.text.length!==0)throw new Error("no-empty text at start");break;case Ct:break;default:this.unget(),this.state=Nt,this.xmlDeclPossible=!1}}sDoctype(){var e;let r=this.captureTo(ma);switch(r){case Tt:{(e=this.doctypeHandler)===null||e===void 0||e.call(this,this.text),this.text="",this.state=Nt,this.doctype=!0;break}case Ct:break;default:this.text+=String.fromCodePoint(r),r===Ui?this.state=oe:Xe(r)&&(this.state=Ws,this.q=r)}}sDoctypeQuote(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.q=null,this.state=nr)}sDTD(){let e=this.captureTo(va);e!==Ct&&(this.text+=String.fromCodePoint(e),e===le?this.state=nr:e===Vt?this.state=js:Xe(e)&&(this.state=Vs,this.q=e))}sDTDQuoted(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.state=oe,this.q=null)}sDTDOpenWaka(){let e=this.getCodeNorm();switch(this.text+=String.fromCodePoint(e),e){case Si:this.state=Zs,this.openWakaBang="";break;case kt:this.state=Js;break;default:this.state=oe}}sDTDOpenWakaBang(){let e=String.fromCodePoint(this.getCodeNorm()),r=this.openWakaBang+=e;this.text+=e,r!=="-"&&(this.state=r==="--"?sr:oe,this.openWakaBang="")}sDTDComment(){this.captureToChar(Ue)&&(this.text+="-",this.state=Qs)}sDTDCommentEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),this.state=e===Ue?Ks:sr}sDTDCommentEnded(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===Tt?this.state=oe:(this.fail("malformed comment."),this.state=sr)}sDTDPI(){this.captureToChar(kt)&&(this.text+="?",this.state=ta)}sDTDPIEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===Tt&&(this.state=oe)}sText(){this.tags.length!==0?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:e}=this,{chunk:r}=this;t:for(;;)switch(this.getCode()){case zt:this.entity+=`${r.slice(e,this.prevI)}
|
|
8
|
-
`,e=this.i;break;case ga:{let{entityReturnState:i}=this,n=this.entity+r.slice(e,this.prevI);this.state=i;let s;n===""?(this.fail("empty entity name."),s="&;"):(s=this.parseEntity(n),this.entity=""),(i!==Nt||this.textHandler!==void 0)&&(this.text+=s);break t}case Ct:this.entity+=r.slice(e);break t;default:}}sOpenWaka(){let e=this.getCode();if(De(e))this.state=ua,this.unget(),this.xmlDeclPossible=!1;else switch(e){case He:this.state=pa,this.xmlDeclPossible=!1;break;case Si:this.state=ea,this.openWakaBang="",this.xmlDeclPossible=!1;break;case kt:this.state=aa;break;default:this.fail("disallowed character in tag name"),this.state=Nt,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=hr,this.openWakaBang="";break;case"--":this.state=or,this.openWakaBang="";break;case"DOCTYPE":this.state=nr,(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(Ue)&&(this.state=ra)}sCommentEnding(){var e;let r=this.getCodeNorm();r===Ue?(this.state=ia,(e=this.commentHandler)===null||e===void 0||e.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(r)}`,this.state=or)}sCommentEnded(){let e=this.getCodeNorm();e!==Tt?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(e)}`,this.state=or):this.state=Nt}sCData(){this.captureToChar(le)&&(this.state=na)}sCDataEnding(){let e=this.getCodeNorm();e===le?this.state=sa:(this.text+=`]${String.fromCodePoint(e)}`,this.state=hr)}sCDataEnding2(){var e;let r=this.getCodeNorm();switch(r){case Tt:{(e=this.cdataHandler)===null||e===void 0||e.call(this,this.text),this.text="",this.state=Nt;break}case le:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(r)}`,this.state=hr}}sPIFirstChar(){let e=this.getCodeNorm();this.nameStartCheck(e)?(this.piTarget+=String.fromCodePoint(e),this.state=Ti):e===kt||Lt(e)?(this.fail("processing instruction without a target."),this.state=e===kt?Be:lr):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(e),this.state=Ti)}sPIRest(){let{chunk:e,i:r}=this;for(;;){let i=this.getCodeNorm();if(i===Ct){this.piTarget+=e.slice(r);return}if(!this.nameCheck(i)){this.piTarget+=e.slice(r,this.prevI);let n=i===kt;n||Lt(i)?this.piTarget==="xml"?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=n?Kt:yi):this.state=n?Be:lr:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(i));break}}}sPIBody(){if(this.text.length===0){let e=this.getCodeNorm();e===kt?this.state=Be:Lt(e)||(this.text=String.fromCodePoint(e))}else this.captureToChar(kt)&&(this.state=Be)}sPIEnding(){var e;let r=this.getCodeNorm();if(r===Tt){let{piTarget:i}=this;i.toLowerCase()==="xml"&&this.fail("the XML declaration must appear at the start of the document."),(e=this.piHandler)===null||e===void 0||e.call(this,{target:i,body:this.text}),this.piTarget=this.text="",this.state=Nt}else r===kt?this.text+="?":(this.text+=`?${String.fromCodePoint(r)}`,this.state=lr);this.xmlDeclPossible=!1}sXMLDeclNameStart(){let e=this.skipSpaces();if(e===kt){this.state=Kt;return}e!==Ct&&(this.state=oa,this.name=String.fromCodePoint(e))}sXMLDeclName(){let e=this.captureTo(_a);if(e===kt){this.state=Kt,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(Lt(e)||e===he){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=e===he?Ai:ha}}sXMLDeclEq(){let e=this.getCodeNorm();if(e===kt){this.state=Kt,this.fail("XML declaration is incomplete.");return}Lt(e)||(e!==he&&this.fail("value required."),this.state=Ai)}sXMLDeclValueStart(){let e=this.getCodeNorm();if(e===kt){this.state=Kt,this.fail("XML declaration is incomplete.");return}Lt(e)||(Xe(e)?this.q=e:(this.fail("value must be quoted."),this.q=Ri),this.state=la)}sXMLDeclValue(){let e=this.captureTo([this.q,kt]);if(e===kt){this.state=Kt,this.text="",this.fail("XML declaration is incomplete.");return}if(e===Ct)return;let r=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let i=r;this.xmlDecl.version=i,/^1\.[0-9]+$/.test(i)?this.opt.forceXMLVersion||this.setXMLVersion(i):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(r)||this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=r;break;case"standalone":r!=="yes"&&r!=="no"&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=r;break;default:}this.name="",this.state=fa}sXMLDeclSeparator(){let e=this.getCodeNorm();if(e===kt){this.state=Kt;return}Lt(e)||(this.fail("whitespace required."),this.unget()),this.state=yi}sXMLDeclEnding(){var e;this.getCodeNorm()===Tt?(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."),(e=this.xmldeclHandler)===null||e===void 0||e.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=Nt):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var e;let r=this.captureNameChars();if(r===Ct)return;let i=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=i.ns=Object.create(null)),(e=this.openTagStartHandler)===null||e===void 0||e.call(this,i),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),r){case Tt:this.openTag();break;case He:this.state=fr;break;default:Lt(r)||this.fail("disallowed character in tag name."),this.state=ke}}sOpenTagSlash(){this.getCode()===Tt?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=ke)}sAttrib(){let e=this.skipSpaces();e!==Ct&&(De(e)?(this.unget(),this.state=ur):e===Tt?this.openTag():e===He?this.state=fr:this.fail("disallowed character in attribute name."))}sAttribName(){let e=this.captureNameChars();e===he?this.state=Fi:Lt(e)?this.state=ca:e===Tt?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):e!==Ct&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){let e=this.skipSpaces();switch(e){case Ct:return;case he:this.state=Fi;break;default:this.fail("attribute without value."),this.text="",this.name="",e===Tt?this.openTag():De(e)?(this.unget(),this.state=ur):(this.fail("disallowed character in attribute name."),this.state=ke)}}sAttribValue(){let e=this.getCodeNorm();Xe(e)?(this.q=e,this.state=Di):Lt(e)||(this.fail("unquoted attribute value."),this.state=ki,this.unget())}sAttribValueQuoted(){let{q:e,chunk:r}=this,{i}=this;for(;;)switch(this.getCode()){case e:this.pushAttrib(this.name,this.text+r.slice(i,this.prevI)),this.name=this.text="",this.q=null,this.state=da;return;case Re:this.text+=r.slice(i,this.prevI),this.state=Pe,this.entityReturnState=Di;return;case $t:case zt:case cr:this.text+=`${r.slice(i,this.prevI)} `,i=this.i;break;case Vt:this.text+=r.slice(i,this.prevI),this.fail("disallowed character.");return;case Ct:this.text+=r.slice(i);return;default:}}sAttribValueClosed(){let e=this.getCodeNorm();Lt(e)?this.state=ke:e===Tt?this.openTag():e===He?this.state=fr:De(e)?(this.fail("no whitespace between attributes."),this.unget(),this.state=ur):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){let e=this.captureTo(wa);switch(e){case Re:this.state=Pe,this.entityReturnState=ki;break;case Vt:this.fail("disallowed character.");break;case Ct:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",e===Tt?this.openTag():this.state=ke}}sCloseTag(){let e=this.captureNameChars();e===Tt?this.closeTag():Lt(e)?this.state=xa:e!==Ct&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case Tt:this.closeTag();break;case Ct:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:e,forbiddenState:r}=this,{chunk:i,textHandler:n}=this;t:for(;;)switch(this.getCode()){case Vt:{if(this.state=ar,n!==void 0){let{text:s}=this,a=i.slice(e,this.prevI);s.length!==0?(n(s+a),this.text=""):a.length!==0&&n(a)}r=Jt;break t}case Re:this.state=Pe,this.entityReturnState=Nt,n!==void 0&&(this.text+=i.slice(e,this.prevI)),r=Jt;break t;case le:switch(r){case Jt:r=Ii;break;case Ii:r=pr;break;case pr:break;default:throw new Error("impossible state")}break;case Tt:r===pr&&this.fail('the string "]]>" is disallowed in char data.'),r=Jt;break;case zt:n!==void 0&&(this.text+=`${i.slice(e,this.prevI)}
|
|
9
|
-
`),e=this.i,r=Jt;break;case Ct:n!==void 0&&(this.text+=i.slice(e));break t;default:r=Jt}this.forbiddenState=r}handleTextOutsideRoot(){let{i:e}=this,{chunk:r,textHandler:i}=this,n=!1;t:for(;;){let s=this.getCode();switch(s){case Vt:{if(this.state=ar,i!==void 0){let{text:a}=this,o=r.slice(e,this.prevI);a.length!==0?(i(a+o),this.text=""):o.length!==0&&i(o)}break t}case Re:this.state=Pe,this.entityReturnState=Nt,i!==void 0&&(this.text+=r.slice(e,this.prevI)),n=!0;break t;case zt:i!==void 0&&(this.text+=`${r.slice(e,this.prevI)}
|
|
10
|
-
`),e=this.i;break;case Ct:i!==void 0&&(this.text+=r.slice(e));break t;default:Lt(s)||(n=!0)}}n&&(!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(e,r){var i;let{prefix:n,local:s}=this.qname(e),a={name:e,prefix:n,local:s,value:r};if(this.attribList.push(a),(i=this.attributeHandler)===null||i===void 0||i.call(this,a),n==="xmlns"){let o=r.trim();this.currentXMLVersion==="1.0"&&o===""&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[s]=o,xr(this,s,o)}else if(e==="xmlns"){let o=r.trim();this.topNS[""]=o,xr(this,"",o)}}pushAttribPlain(e,r){var i;let n={name:e,value:r};this.attribList.push(n),(i=this.attributeHandler)===null||i===void 0||i.call(this,n)}end(){var e,r;this.sawRoot||this.fail("document must contain a root element.");let{tags:i}=this;for(;i.length>0;){let s=i.pop();this.fail(`unclosed tag: ${s.name}`)}this.state!==bi&&this.state!==Nt&&this.fail("unexpected end.");let{text:n}=this;return n.length!==0&&((e=this.textHandler)===null||e===void 0||e.call(this,n),this.text=""),this._closed=!0,(r=this.endHandler)===null||r===void 0||r.call(this),this._init(),this}resolve(e){var r,i;let n=this.topNS[e];if(n!==void 0)return n;let{tags:s}=this;for(let a=s.length-1;a>=0;a--)if(n=s[a].ns[e],n!==void 0)return n;return n=this.ns[e],n!==void 0?n:(i=(r=this.opt).resolvePrefix)===null||i===void 0?void 0:i.call(r,e)}qname(e){let r=e.indexOf(":");if(r===-1)return{prefix:"",local:e};let i=e.slice(r+1),n=e.slice(0,r);return(n===""||i===""||i.includes(":"))&&this.fail(`malformed name: ${e}.`),{prefix:n,local:i}}processAttribsNS(){var e;let{attribList:r}=this,i=this.tag;{let{prefix:a,local:o}=this.qname(i.name);i.prefix=a,i.local=o;let h=i.uri=(e=this.resolve(a))!==null&&e!==void 0?e:"";a!==""&&(a==="xmlns"&&this.fail('tags may not have "xmlns" as prefix.'),h===""&&(this.fail(`unbound namespace prefix: ${JSON.stringify(a)}.`),i.uri=a))}if(r.length===0)return;let{attributes:n}=i,s=new Set;for(let a of r){let{name:o,prefix:h,local:l}=a,p,f;h===""?(p=o==="xmlns"?fe:"",f=o):(p=this.resolve(h),p===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(h)}.`),p=h),f=`{${p}}${l}`),s.has(f)&&this.fail(`duplicate attribute: ${f}.`),s.add(f),a.uri=p,n[o]=a}this.attribList=[]}processAttribsPlain(){let{attribList:e}=this,r=this.tag.attributes;for(let{name:i,value:n}of e)r[i]!==void 0&&this.fail(`duplicate attribute: ${i}.`),r[i]=n;this.attribList=[]}openTag(){var e;this.processAttribs();let{tags:r}=this,i=this.tag;i.isSelfClosing=!1,(e=this.openTagHandler)===null||e===void 0||e.call(this,i),r.push(i),this.state=Nt,this.name=""}openSelfClosingTag(){var e,r,i;this.processAttribs();let{tags:n}=this,s=this.tag;s.isSelfClosing=!0,(e=this.openTagHandler)===null||e===void 0||e.call(this,s),(r=this.closeTagHandler)===null||r===void 0||r.call(this,s),(this.tag=(i=n[n.length-1])!==null&&i!==void 0?i:null)===null&&(this.closedRoot=!0),this.state=Nt,this.name=""}closeTag(){let{tags:e,name:r}=this;if(this.state=Nt,this.name="",r===""){this.fail("weird empty close tag."),this.text+="</>";return}let i=this.closeTagHandler,n=e.length;for(;n-- >0;){let s=this.tag=e.pop();if(this.topNS=s.ns,i?.(s),s.name===r)break;this.fail("unexpected close tag.")}n===0?this.closedRoot=!0:n<0&&(this.fail(`unmatched closing tag: ${r}.`),this.text+=`</${r}>`)}parseEntity(e){if(e[0]!=="#"){let i=this.ENTITIES[e];return i!==void 0?i:(this.fail(this.isName(e)?"undefined entity.":"disallowed character in entity name."),`&${e};`)}let r=NaN;return e[1]==="x"&&/^#x[0-9a-f]+$/i.test(e)?r=parseInt(e.slice(2),16):/^#[0-9]+$/.test(e)&&(r=parseInt(e.slice(1),10)),this.isChar(r)?String.fromCodePoint(r):(this.fail("malformed character entity."),`&${e};`)}};ue.SaxesParser=gr});var wr=pt((mh,Ki)=>{"use strict";var La=Rt("util"),Qi=Rt("stream"),Yt=Ki.exports=function(){Qi.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};La.inherits(Yt,Qi);Yt.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e}),process.nextTick(function(){this._process(),this._paused&&this._reads&&this._reads.length>0&&(this._paused=!1,this.emit("drain"))}.bind(this))};Yt.prototype.write=function(t,e){if(!this.writable)return this.emit("error",new Error("Stream not writable")),!1;let r;return Buffer.isBuffer(t)?r=t:r=Buffer.from(t,e||this._encoding),this._buffers.push(r),this._buffered+=r.length,this._process(),this._reads&&this._reads.length===0&&(this._paused=!0),this.writable&&!this._paused};Yt.prototype.end=function(t,e){t&&this.write(t,e),this.writable=!1,this._buffers&&(this._buffers.length===0?this._end():(this._buffers.push(null),this._process()))};Yt.prototype.destroySoon=Yt.prototype.end;Yt.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("Unexpected end of input")),this.destroy()};Yt.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))};Yt.prototype._processReadAllowingLess=function(t){this._reads.shift();let e=this._buffers[0];e.length>t.length?(this._buffered-=t.length,this._buffers[0]=e.slice(t.length),t.func.call(this,e.slice(0,t.length))):(this._buffered-=e.length,this._buffers.shift(),t.func.call(this,e))};Yt.prototype._processRead=function(t){this._reads.shift();let e=0,r=0,i=Buffer.alloc(t.length);for(;e<t.length;){let n=this._buffers[r++],s=Math.min(n.length,t.length-e);n.copy(i,e,0,s),e+=s,s!==n.length&&(this._buffers[--r]=n.slice(s))}r>0&&this._buffers.splice(0,r),this._buffered-=t.length,t.func.call(this,i)};Yt.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){let t=this._reads[0];if(t.allowLess)this._processReadAllowingLess(t);else if(this._buffered>=t.length)this._processRead(t);else break}this._buffers&&!this.writable&&this._end()}catch(t){this.emit("error",t)}}});var Cr=pt(Er=>{"use strict";var jt=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];Er.getImagePasses=function(t,e){let r=[],i=t%8,n=e%8,s=(t-i)/8,a=(e-n)/8;for(let o=0;o<jt.length;o++){let h=jt[o],l=s*h.x.length,p=a*h.y.length;for(let f=0;f<h.x.length&&h.x[f]<i;f++)l++;for(let f=0;f<h.y.length&&h.y[f]<n;f++)p++;l>0&&p>0&&r.push({width:l,height:p,index:o})}return r};Er.getInterlaceIterator=function(t){return function(e,r,i){let n=e%jt[i].x.length,s=(e-n)/jt[i].x.length*8+jt[i].x[n],a=r%jt[i].y.length,o=(r-a)/jt[i].y.length*8+jt[i].y[a];return s*4+o*t*4}}});var br=pt((_h,Ji)=>{"use strict";Ji.exports=function(e,r,i){let n=e+r-i,s=Math.abs(n-e),a=Math.abs(n-r),o=Math.abs(n-i);return s<=a&&s<=o?e:a<=o?r:i}});var Tr=pt((wh,en)=>{"use strict";var Pa=Cr(),Ba=br();function tn(t,e,r){let i=t*e;return r!==8&&(i=Math.ceil(i/(8/r))),i}var pe=en.exports=function(t,e){let r=t.width,i=t.height,n=t.interlace,s=t.bpp,a=t.depth;if(this.read=e.read,this.write=e.write,this.complete=e.complete,this._imageIndex=0,this._images=[],n){let o=Pa.getImagePasses(r,i);for(let h=0;h<o.length;h++)this._images.push({byteWidth:tn(o[h].width,s,a),height:o[h].height,lineIndex:0})}else this._images.push({byteWidth:tn(r,s,a),height:i,lineIndex:0});a===8?this._xComparison=s:a===16?this._xComparison=s*2:this._xComparison=1};pe.prototype.start=function(){this.read(this._images[this._imageIndex].byteWidth+1,this._reverseFilterLine.bind(this))};pe.prototype._unFilterType1=function(t,e,r){let i=this._xComparison,n=i-1;for(let s=0;s<r;s++){let a=t[1+s],o=s>n?e[s-i]:0;e[s]=a+o}};pe.prototype._unFilterType2=function(t,e,r){let i=this._lastLine;for(let n=0;n<r;n++){let s=t[1+n],a=i?i[n]:0;e[n]=s+a}};pe.prototype._unFilterType3=function(t,e,r){let i=this._xComparison,n=i-1,s=this._lastLine;for(let a=0;a<r;a++){let o=t[1+a],h=s?s[a]:0,l=a>n?e[a-i]:0,p=Math.floor((l+h)/2);e[a]=o+p}};pe.prototype._unFilterType4=function(t,e,r){let i=this._xComparison,n=i-1,s=this._lastLine;for(let a=0;a<r;a++){let o=t[1+a],h=s?s[a]:0,l=a>n?e[a-i]:0,p=a>n&&s?s[a-i]:0,f=Ba(l,h,p);e[a]=o+f}};pe.prototype._reverseFilterLine=function(t){let e=t[0],r,i=this._images[this._imageIndex],n=i.byteWidth;if(e===0)r=t.slice(1,n+1);else switch(r=Buffer.alloc(n),e){case 1:this._unFilterType1(t,r,n);break;case 2:this._unFilterType2(t,r,n);break;case 3:this._unFilterType3(t,r,n);break;case 4:this._unFilterType4(t,r,n);break;default:throw new Error("Unrecognised filter type - "+e)}this.write(r),i.lineIndex++,i.lineIndex>=i.height?(this._lastLine=null,this._imageIndex++,i=this._images[this._imageIndex]):this._lastLine=r,i?this.read(i.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}});var sn=pt((Eh,nn)=>{"use strict";var Ua=Rt("util"),rn=wr(),Ha=Tr(),Xa=nn.exports=function(t){rn.call(this);let e=[],r=this;this._filter=new Ha(t,{read:this.read.bind(this),write:function(i){e.push(i)},complete:function(){r.emit("complete",Buffer.concat(e))}}),this._filter.start()};Ua.inherits(Xa,rn)});var xe=pt((Ch,an)=>{"use strict";an.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}});var Fr=pt((bh,on)=>{"use strict";var yr=[];(function(){for(let t=0;t<256;t++){let e=t;for(let r=0;r<8;r++)e&1?e=3988292384^e>>>1:e=e>>>1;yr[t]=e}})();var Ar=on.exports=function(){this._crc=-1};Ar.prototype.write=function(t){for(let e=0;e<t.length;e++)this._crc=yr[(this._crc^t[e])&255]^this._crc>>>8;return!0};Ar.prototype.crc32=function(){return this._crc^-1};Ar.crc32=function(t){let e=-1;for(let r=0;r<t.length;r++)e=yr[(e^t[r])&255]^e>>>8;return e^-1}});var Dr=pt((Th,hn)=>{"use strict";var yt=xe(),$a=Fr(),Ft=hn.exports=function(t,e){this._options=t,t.checkCRC=t.checkCRC!==!1,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[yt.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[yt.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[yt.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[yt.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[yt.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[yt.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=e.read,this.error=e.error,this.metadata=e.metadata,this.gamma=e.gamma,this.transColor=e.transColor,this.palette=e.palette,this.parsed=e.parsed,this.inflateData=e.inflateData,this.finished=e.finished,this.simpleTransparency=e.simpleTransparency,this.headersFinished=e.headersFinished||function(){}};Ft.prototype.start=function(){this.read(yt.PNG_SIGNATURE.length,this._parseSignature.bind(this))};Ft.prototype._parseSignature=function(t){let e=yt.PNG_SIGNATURE;for(let r=0;r<e.length;r++)if(t[r]!==e[r]){this.error(new Error("Invalid file signature"));return}this.read(8,this._parseChunkBegin.bind(this))};Ft.prototype._parseChunkBegin=function(t){let e=t.readUInt32BE(0),r=t.readUInt32BE(4),i="";for(let s=4;s<8;s++)i+=String.fromCharCode(t[s]);let n=!!(t[4]&32);if(!this._hasIHDR&&r!==yt.TYPE_IHDR){this.error(new Error("Expected IHDR on beggining"));return}if(this._crc=new $a,this._crc.write(Buffer.from(i)),this._chunks[r])return this._chunks[r](e);if(!n){this.error(new Error("Unsupported critical chunk type "+i));return}this.read(e+4,this._skipChunk.bind(this))};Ft.prototype._skipChunk=function(){this.read(8,this._parseChunkBegin.bind(this))};Ft.prototype._handleChunkEnd=function(){this.read(4,this._parseChunkEnd.bind(this))};Ft.prototype._parseChunkEnd=function(t){let e=t.readInt32BE(0),r=this._crc.crc32();if(this._options.checkCRC&&r!==e){this.error(new Error("Crc error - "+e+" - "+r));return}this._hasIEND||this.read(8,this._parseChunkBegin.bind(this))};Ft.prototype._handleIHDR=function(t){this.read(t,this._parseIHDR.bind(this))};Ft.prototype._parseIHDR=function(t){this._crc.write(t);let e=t.readUInt32BE(0),r=t.readUInt32BE(4),i=t[8],n=t[9],s=t[10],a=t[11],o=t[12];if(i!==8&&i!==4&&i!==2&&i!==1&&i!==16){this.error(new Error("Unsupported bit depth "+i));return}if(!(n in yt.COLORTYPE_TO_BPP_MAP)){this.error(new Error("Unsupported color type"));return}if(s!==0){this.error(new Error("Unsupported compression method"));return}if(a!==0){this.error(new Error("Unsupported filter method"));return}if(o!==0&&o!==1){this.error(new Error("Unsupported interlace method"));return}this._colorType=n;let h=yt.COLORTYPE_TO_BPP_MAP[this._colorType];this._hasIHDR=!0,this.metadata({width:e,height:r,depth:i,interlace:!!o,palette:!!(n&yt.COLORTYPE_PALETTE),color:!!(n&yt.COLORTYPE_COLOR),alpha:!!(n&yt.COLORTYPE_ALPHA),bpp:h,colorType:n}),this._handleChunkEnd()};Ft.prototype._handlePLTE=function(t){this.read(t,this._parsePLTE.bind(this))};Ft.prototype._parsePLTE=function(t){this._crc.write(t);let e=Math.floor(t.length/3);for(let r=0;r<e;r++)this._palette.push([t[r*3],t[r*3+1],t[r*3+2],255]);this.palette(this._palette),this._handleChunkEnd()};Ft.prototype._handleTRNS=function(t){this.simpleTransparency(),this.read(t,this._parseTRNS.bind(this))};Ft.prototype._parseTRNS=function(t){if(this._crc.write(t),this._colorType===yt.COLORTYPE_PALETTE_COLOR){if(this._palette.length===0){this.error(new Error("Transparency chunk must be after palette"));return}if(t.length>this._palette.length){this.error(new Error("More transparent colors than palette size"));return}for(let e=0;e<t.length;e++)this._palette[e][3]=t[e];this.palette(this._palette)}this._colorType===yt.COLORTYPE_GRAYSCALE&&this.transColor([t.readUInt16BE(0)]),this._colorType===yt.COLORTYPE_COLOR&&this.transColor([t.readUInt16BE(0),t.readUInt16BE(2),t.readUInt16BE(4)]),this._handleChunkEnd()};Ft.prototype._handleGAMA=function(t){this.read(t,this._parseGAMA.bind(this))};Ft.prototype._parseGAMA=function(t){this._crc.write(t),this.gamma(t.readUInt32BE(0)/yt.GAMMA_DIVISION),this._handleChunkEnd()};Ft.prototype._handleIDAT=function(t){this._emittedHeadersFinished||(this._emittedHeadersFinished=!0,this.headersFinished()),this.read(-t,this._parseIDAT.bind(this,t))};Ft.prototype._parseIDAT=function(t,e){if(this._crc.write(e),this._colorType===yt.COLORTYPE_PALETTE_COLOR&&this._palette.length===0)throw new Error("Expected palette not found");this.inflateData(e);let r=t-e.length;r>0?this._handleIDAT(r):this._handleChunkEnd()};Ft.prototype._handleIEND=function(t){this.read(t,this._parseIEND.bind(this))};Ft.prototype._parseIEND=function(t){this._crc.write(t),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}});var kr=pt(fn=>{"use strict";var ln=Cr(),Ya=[function(){},function(t,e,r,i){if(i===e.length)throw new Error("Ran out of data");let n=e[i];t[r]=n,t[r+1]=n,t[r+2]=n,t[r+3]=255},function(t,e,r,i){if(i+1>=e.length)throw new Error("Ran out of data");let n=e[i];t[r]=n,t[r+1]=n,t[r+2]=n,t[r+3]=e[i+1]},function(t,e,r,i){if(i+2>=e.length)throw new Error("Ran out of data");t[r]=e[i],t[r+1]=e[i+1],t[r+2]=e[i+2],t[r+3]=255},function(t,e,r,i){if(i+3>=e.length)throw new Error("Ran out of data");t[r]=e[i],t[r+1]=e[i+1],t[r+2]=e[i+2],t[r+3]=e[i+3]}],qa=[function(){},function(t,e,r,i){let n=e[0];t[r]=n,t[r+1]=n,t[r+2]=n,t[r+3]=i},function(t,e,r){let i=e[0];t[r]=i,t[r+1]=i,t[r+2]=i,t[r+3]=e[1]},function(t,e,r,i){t[r]=e[0],t[r+1]=e[1],t[r+2]=e[2],t[r+3]=i},function(t,e,r){t[r]=e[0],t[r+1]=e[1],t[r+2]=e[2],t[r+3]=e[3]}];function za(t,e){let r=[],i=0;function n(){if(i===t.length)throw new Error("Ran out of data");let s=t[i];i++;let a,o,h,l,p,f,d,C;switch(e){default:throw new Error("unrecognised depth");case 16:d=t[i],i++,r.push((s<<8)+d);break;case 4:d=s&15,C=s>>4,r.push(C,d);break;case 2:p=s&3,f=s>>2&3,d=s>>4&3,C=s>>6&3,r.push(C,d,f,p);break;case 1:a=s&1,o=s>>1&1,h=s>>2&1,l=s>>3&1,p=s>>4&1,f=s>>5&1,d=s>>6&1,C=s>>7&1,r.push(C,d,f,p,l,h,o,a);break}}return{get:function(s){for(;r.length<s;)n();let a=r.slice(0,s);return r=r.slice(s),a},resetAfterLine:function(){r.length=0},end:function(){if(i!==t.length)throw new Error("extra data found")}}}function Ga(t,e,r,i,n,s){let a=t.width,o=t.height,h=t.index;for(let l=0;l<o;l++)for(let p=0;p<a;p++){let f=r(p,l,h);Ya[i](e,n,f,s),s+=i}return s}function Wa(t,e,r,i,n,s){let a=t.width,o=t.height,h=t.index;for(let l=0;l<o;l++){for(let p=0;p<a;p++){let f=n.get(i),d=r(p,l,h);qa[i](e,f,d,s)}n.resetAfterLine()}}fn.dataToBitMap=function(t,e){let r=e.width,i=e.height,n=e.depth,s=e.bpp,a=e.interlace,o;n!==8&&(o=za(t,n));let h;n<=8?h=Buffer.alloc(r*i*4):h=new Uint16Array(r*i*4);let l=Math.pow(2,n)-1,p=0,f,d;if(a)f=ln.getImagePasses(r,i),d=ln.getInterlaceIterator(r,i);else{let C=0;d=function(){let m=C;return C+=4,m},f=[{width:r,height:i}]}for(let C=0;C<f.length;C++)n===8?p=Ga(f[C],h,d,s,t,p):Wa(f[C],h,d,s,o,l);if(n===8){if(p!==t.length)throw new Error("extra data found")}else o.end();return h}});var Rr=pt((Ah,un)=>{"use strict";function Va(t,e,r,i,n){let s=0;for(let a=0;a<i;a++)for(let o=0;o<r;o++){let h=n[t[s]];if(!h)throw new Error("index "+t[s]+" not in palette");for(let l=0;l<4;l++)e[s+l]=h[l];s+=4}}function ja(t,e,r,i,n){let s=0;for(let a=0;a<i;a++)for(let o=0;o<r;o++){let h=!1;if(n.length===1?n[0]===t[s]&&(h=!0):n[0]===t[s]&&n[1]===t[s+1]&&n[2]===t[s+2]&&(h=!0),h)for(let l=0;l<4;l++)e[s+l]=0;s+=4}}function Za(t,e,r,i,n){let s=255,a=Math.pow(2,n)-1,o=0;for(let h=0;h<i;h++)for(let l=0;l<r;l++){for(let p=0;p<4;p++)e[o+p]=Math.floor(t[o+p]*s/a+.5);o+=4}}un.exports=function(t,e,r=!1){let i=e.depth,n=e.width,s=e.height,a=e.colorType,o=e.transColor,h=e.palette,l=t;return a===3?Va(t,l,n,s,h):(o&&ja(t,l,n,s,o),i!==8&&!r&&(i===16&&(l=Buffer.alloc(n*s*4)),Za(t,l,n,s,i))),l}});var pn=pt((Fh,dn)=>{"use strict";var Qa=Rt("util"),Sr=Rt("zlib"),cn=wr(),Ka=sn(),Ja=Dr(),to=kr(),eo=Rr(),Gt=dn.exports=function(t){cn.call(this),this._parser=new Ja(t,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=t,this.writable=!0,this._parser.start()};Qa.inherits(Gt,cn);Gt.prototype._handleError=function(t){this.emit("error",t),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on("error",function(){})),this.errord=!0};Gt.prototype._inflateData=function(t){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=Sr.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{let r=((this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3)+1)*this._bitmapInfo.height,i=Math.max(r,Sr.Z_MIN_CHUNK);this._inflate=Sr.createInflate({chunkSize:i});let n=r,s=this.emit.bind(this,"error");this._inflate.on("error",function(o){n&&s(o)}),this._filter.on("complete",this._complete.bind(this));let a=this._filter.write.bind(this._filter);this._inflate.on("data",function(o){n&&(o.length>n&&(o=o.slice(0,n)),n-=o.length,a(o))}),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(t)};Gt.prototype._handleMetaData=function(t){this._metaData=t,this._bitmapInfo=Object.create(t),this._filter=new Ka(this._bitmapInfo)};Gt.prototype._handleTransColor=function(t){this._bitmapInfo.transColor=t};Gt.prototype._handlePalette=function(t){this._bitmapInfo.palette=t};Gt.prototype._simpleTransparency=function(){this._metaData.alpha=!0};Gt.prototype._headersFinished=function(){this.emit("metadata",this._metaData)};Gt.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"))};Gt.prototype._complete=function(t){if(this.errord)return;let e;try{let r=to.dataToBitMap(t,this._bitmapInfo);e=eo(r,this._bitmapInfo,this._options.skipRescale),r=null}catch(r){this._handleError(r);return}this.emit("parsed",e)}});var gn=pt((Dh,xn)=>{"use strict";var Ut=xe();xn.exports=function(t,e,r,i){let n=[Ut.COLORTYPE_COLOR_ALPHA,Ut.COLORTYPE_ALPHA].indexOf(i.colorType)!==-1;if(i.colorType===i.inputColorType){let m=(function(){let F=new ArrayBuffer(2);return new DataView(F).setInt16(0,256,!0),new Int16Array(F)[0]!==256})();if(i.bitDepth===8||i.bitDepth===16&&m)return t}let s=i.bitDepth!==16?t:new Uint16Array(t.buffer),a=255,o=Ut.COLORTYPE_TO_BPP_MAP[i.inputColorType];o===4&&!i.inputHasAlpha&&(o=3);let h=Ut.COLORTYPE_TO_BPP_MAP[i.colorType];i.bitDepth===16&&(a=65535,h*=2);let l=Buffer.alloc(e*r*h),p=0,f=0,d=i.bgColor||{};d.red===void 0&&(d.red=a),d.green===void 0&&(d.green=a),d.blue===void 0&&(d.blue=a);function C(){let m,F,w,T=a;switch(i.inputColorType){case Ut.COLORTYPE_COLOR_ALPHA:T=s[p+3],m=s[p],F=s[p+1],w=s[p+2];break;case Ut.COLORTYPE_COLOR:m=s[p],F=s[p+1],w=s[p+2];break;case Ut.COLORTYPE_ALPHA:T=s[p+1],m=s[p],F=m,w=m;break;case Ut.COLORTYPE_GRAYSCALE:m=s[p],F=m,w=m;break;default:throw new Error("input color type:"+i.inputColorType+" is not supported at present")}return i.inputHasAlpha&&(n||(T/=a,m=Math.min(Math.max(Math.round((1-T)*d.red+T*m),0),a),F=Math.min(Math.max(Math.round((1-T)*d.green+T*F),0),a),w=Math.min(Math.max(Math.round((1-T)*d.blue+T*w),0),a))),{red:m,green:F,blue:w,alpha:T}}for(let m=0;m<r;m++)for(let F=0;F<e;F++){let w=C(s,p);switch(i.colorType){case Ut.COLORTYPE_COLOR_ALPHA:case Ut.COLORTYPE_COLOR:i.bitDepth===8?(l[f]=w.red,l[f+1]=w.green,l[f+2]=w.blue,n&&(l[f+3]=w.alpha)):(l.writeUInt16BE(w.red,f),l.writeUInt16BE(w.green,f+2),l.writeUInt16BE(w.blue,f+4),n&&l.writeUInt16BE(w.alpha,f+6));break;case Ut.COLORTYPE_ALPHA:case Ut.COLORTYPE_GRAYSCALE:{let T=(w.red+w.green+w.blue)/3;i.bitDepth===8?(l[f]=T,n&&(l[f+1]=w.alpha)):(l.writeUInt16BE(T,f),n&&l.writeUInt16BE(w.alpha,f+2));break}default:throw new Error("unrecognised color Type "+i.colorType)}p+=o,f+=h}return l}});var _n=pt((kh,vn)=>{"use strict";var mn=br();function ro(t,e,r,i,n){for(let s=0;s<r;s++)i[n+s]=t[e+s]}function io(t,e,r){let i=0,n=e+r;for(let s=e;s<n;s++)i+=Math.abs(t[s]);return i}function no(t,e,r,i,n,s){for(let a=0;a<r;a++){let o=a>=s?t[e+a-s]:0,h=t[e+a]-o;i[n+a]=h}}function so(t,e,r,i){let n=0;for(let s=0;s<r;s++){let a=s>=i?t[e+s-i]:0,o=t[e+s]-a;n+=Math.abs(o)}return n}function ao(t,e,r,i,n){for(let s=0;s<r;s++){let a=e>0?t[e+s-r]:0,o=t[e+s]-a;i[n+s]=o}}function oo(t,e,r){let i=0,n=e+r;for(let s=e;s<n;s++){let a=e>0?t[s-r]:0,o=t[s]-a;i+=Math.abs(o)}return i}function ho(t,e,r,i,n,s){for(let a=0;a<r;a++){let o=a>=s?t[e+a-s]:0,h=e>0?t[e+a-r]:0,l=t[e+a]-(o+h>>1);i[n+a]=l}}function lo(t,e,r,i){let n=0;for(let s=0;s<r;s++){let a=s>=i?t[e+s-i]:0,o=e>0?t[e+s-r]:0,h=t[e+s]-(a+o>>1);n+=Math.abs(h)}return n}function fo(t,e,r,i,n,s){for(let a=0;a<r;a++){let o=a>=s?t[e+a-s]:0,h=e>0?t[e+a-r]:0,l=e>0&&a>=s?t[e+a-(r+s)]:0,p=t[e+a]-mn(o,h,l);i[n+a]=p}}function uo(t,e,r,i){let n=0;for(let s=0;s<r;s++){let a=s>=i?t[e+s-i]:0,o=e>0?t[e+s-r]:0,h=e>0&&s>=i?t[e+s-(r+i)]:0,l=t[e+s]-mn(a,o,h);n+=Math.abs(l)}return n}var co={0:ro,1:no,2:ao,3:ho,4:fo},po={0:io,1:so,2:oo,3:lo,4:uo};vn.exports=function(t,e,r,i,n){let s;if(!("filterType"in i)||i.filterType===-1)s=[0,1,2,3,4];else if(typeof i.filterType=="number")s=[i.filterType];else throw new Error("unrecognised filter types");i.bitDepth===16&&(n*=2);let a=e*n,o=0,h=0,l=Buffer.alloc((a+1)*r),p=s[0];for(let f=0;f<r;f++){if(s.length>1){let d=1/0;for(let C=0;C<s.length;C++){let m=po[s[C]](t,h,a,n);m<d&&(p=s[C],d=m)}}l[o]=p,o++,co[p](t,h,a,l,o,n),o+=a,h+=a}return l}});var Or=pt((Rh,wn)=>{"use strict";var Ot=xe(),xo=Fr(),go=gn(),mo=_n(),vo=Rt("zlib"),Zt=wn.exports=function(t){if(this._options=t,t.deflateChunkSize=t.deflateChunkSize||32*1024,t.deflateLevel=t.deflateLevel!=null?t.deflateLevel:9,t.deflateStrategy=t.deflateStrategy!=null?t.deflateStrategy:3,t.inputHasAlpha=t.inputHasAlpha!=null?t.inputHasAlpha:!0,t.deflateFactory=t.deflateFactory||vo.createDeflate,t.bitDepth=t.bitDepth||8,t.colorType=typeof t.colorType=="number"?t.colorType:Ot.COLORTYPE_COLOR_ALPHA,t.inputColorType=typeof t.inputColorType=="number"?t.inputColorType:Ot.COLORTYPE_COLOR_ALPHA,[Ot.COLORTYPE_GRAYSCALE,Ot.COLORTYPE_COLOR,Ot.COLORTYPE_COLOR_ALPHA,Ot.COLORTYPE_ALPHA].indexOf(t.colorType)===-1)throw new Error("option color type:"+t.colorType+" is not supported at present");if([Ot.COLORTYPE_GRAYSCALE,Ot.COLORTYPE_COLOR,Ot.COLORTYPE_COLOR_ALPHA,Ot.COLORTYPE_ALPHA].indexOf(t.inputColorType)===-1)throw new Error("option input color type:"+t.inputColorType+" is not supported at present");if(t.bitDepth!==8&&t.bitDepth!==16)throw new Error("option bit depth:"+t.bitDepth+" is not supported at present")};Zt.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}};Zt.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())};Zt.prototype.filterData=function(t,e,r){let i=go(t,e,r,this._options),n=Ot.COLORTYPE_TO_BPP_MAP[this._options.colorType];return mo(i,e,r,this._options,n)};Zt.prototype._packChunk=function(t,e){let r=e?e.length:0,i=Buffer.alloc(r+12);return i.writeUInt32BE(r,0),i.writeUInt32BE(t,4),e&&e.copy(i,8),i.writeInt32BE(xo.crc32(i.slice(4,i.length-4)),i.length-4),i};Zt.prototype.packGAMA=function(t){let e=Buffer.alloc(4);return e.writeUInt32BE(Math.floor(t*Ot.GAMMA_DIVISION),0),this._packChunk(Ot.TYPE_gAMA,e)};Zt.prototype.packIHDR=function(t,e){let r=Buffer.alloc(13);return r.writeUInt32BE(t,0),r.writeUInt32BE(e,4),r[8]=this._options.bitDepth,r[9]=this._options.colorType,r[10]=0,r[11]=0,r[12]=0,this._packChunk(Ot.TYPE_IHDR,r)};Zt.prototype.packIDAT=function(t){return this._packChunk(Ot.TYPE_IDAT,t)};Zt.prototype.packIEND=function(){return this._packChunk(Ot.TYPE_IEND,null)}});var Tn=pt((Sh,bn)=>{"use strict";var _o=Rt("util"),En=Rt("stream"),wo=xe(),Eo=Or(),Cn=bn.exports=function(t){En.call(this);let e=t||{};this._packer=new Eo(e),this._deflate=this._packer.createDeflate(),this.readable=!0};_o.inherits(Cn,En);Cn.prototype.pack=function(t,e,r,i){this.emit("data",Buffer.from(wo.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(e,r)),i&&this.emit("data",this._packer.packGAMA(i));let n=this._packer.filterData(t,e,r);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(s){this.emit("data",this._packer.packIDAT(s))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(n)}});var Rn=pt((Se,kn)=>{"use strict";var yn=Rt("assert").ok,ge=Rt("zlib"),Co=Rt("util"),An=Rt("buffer").kMaxLength;function te(t){if(!(this instanceof te))return new te(t);t&&t.chunkSize<ge.Z_MIN_CHUNK&&(t.chunkSize=ge.Z_MIN_CHUNK),ge.Inflate.call(this,t),this._offset=this._offset===void 0?this._outOffset:this._offset,this._buffer=this._buffer||this._outBuffer,t&&t.maxLength!=null&&(this._maxLength=t.maxLength)}function bo(t){return new te(t)}function Fn(t,e){e&&process.nextTick(e),t._handle&&(t._handle.close(),t._handle=null)}te.prototype._processChunk=function(t,e,r){if(typeof r=="function")return ge.Inflate._processChunk.call(this,t,e,r);let i=this,n=t&&t.length,s=this._chunkSize-this._offset,a=this._maxLength,o=0,h=[],l=0,p;this.on("error",function(m){p=m});function f(m,F){if(i._hadError)return;let w=s-F;if(yn(w>=0,"have should not go down"),w>0){let T=i._buffer.slice(i._offset,i._offset+w);if(i._offset+=w,T.length>a&&(T=T.slice(0,a)),h.push(T),l+=T.length,a-=T.length,a===0)return!1}return(F===0||i._offset>=i._chunkSize)&&(s=i._chunkSize,i._offset=0,i._buffer=Buffer.allocUnsafe(i._chunkSize)),F===0?(o+=n-m,n=m,!0):!1}yn(this._handle,"zlib binding closed");let d;do d=this._handle.writeSync(e,t,o,n,this._buffer,this._offset,s),d=d||this._writeState;while(!this._hadError&&f(d[0],d[1]));if(this._hadError)throw p;if(l>=An)throw Fn(this),new RangeError("Cannot create final Buffer. It would be larger than 0x"+An.toString(16)+" bytes");let C=Buffer.concat(h,l);return Fn(this),C};Co.inherits(te,ge.Inflate);function To(t,e){if(typeof e=="string"&&(e=Buffer.from(e)),!(e instanceof Buffer))throw new TypeError("Not a string or buffer");let r=t._finishFlushFlag;return r==null&&(r=ge.Z_FINISH),t._processChunk(e,r)}function Dn(t,e){return To(new te(e),t)}kn.exports=Se=Dn;Se.Inflate=te;Se.createInflate=bo;Se.inflateSync=Dn});var Nr=pt((Oh,On)=>{"use strict";var Sn=On.exports=function(t){this._buffer=t,this._reads=[]};Sn.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e})};Sn.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){let t=this._reads[0];if(this._buffer.length&&(this._buffer.length>=t.length||t.allowLess)){this._reads.shift();let e=this._buffer;this._buffer=e.slice(t.length),t.func.call(this,e.slice(0,t.length))}else break}if(this._reads.length>0)throw new Error("There are some read requests waitng on finished stream");if(this._buffer.length>0)throw new Error("unrecognised content at end of stream")}});var In=pt(Nn=>{"use strict";var yo=Nr(),Ao=Tr();Nn.process=function(t,e){let r=[],i=new yo(t);return new Ao(e,{read:i.read.bind(i),write:function(s){r.push(s)},complete:function(){}}).start(),i.process(),Buffer.concat(r)}});var Bn=pt((Ih,Pn)=>{"use strict";var Mn=!0,Ln=Rt("zlib"),Fo=Rn();Ln.deflateSync||(Mn=!1);var Do=Nr(),ko=In(),Ro=Dr(),So=kr(),Oo=Rr();Pn.exports=function(t,e){if(!Mn)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let r;function i(y){r=y}let n;function s(y){n=y}function a(y){n.transColor=y}function o(y){n.palette=y}function h(){n.alpha=!0}let l;function p(y){l=y}let f=[];function d(y){f.push(y)}let C=new Do(t);if(new Ro(e,{read:C.read.bind(C),error:i,metadata:s,gamma:p,palette:o,transColor:a,inflateData:d,simpleTransparency:h}).start(),C.process(),r)throw r;let F=Buffer.concat(f);f.length=0;let w;if(n.interlace)w=Ln.inflateSync(F);else{let x=((n.width*n.bpp*n.depth+7>>3)+1)*n.height;w=Fo(F,{chunkSize:x,maxLength:x})}if(F=null,!w||!w.length)throw new Error("bad png - invalid inflate data response");let T=ko.process(w,n);F=null;let S=So.dataToBitMap(T,n);T=null;let g=Oo(S,n,e.skipRescale);return n.data=g,n.gamma=l||0,n}});var $n=pt((Mh,Xn)=>{"use strict";var Un=!0,Hn=Rt("zlib");Hn.deflateSync||(Un=!1);var No=xe(),Io=Or();Xn.exports=function(t,e){if(!Un)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let r=e||{},i=new Io(r),n=[];n.push(Buffer.from(No.PNG_SIGNATURE)),n.push(i.packIHDR(t.width,t.height)),t.gamma&&n.push(i.packGAMA(t.gamma));let s=i.filterData(t.data,t.width,t.height),a=Hn.deflateSync(s,i.getDeflateOptions());if(s=null,!a||!a.length)throw new Error("bad png - invalid compressed data response");return n.push(i.packIDAT(a)),n.push(i.packIEND()),Buffer.concat(n)}});var Yn=pt(Ir=>{"use strict";var Mo=Bn(),Lo=$n();Ir.read=function(t,e){return Mo(t,e||{})};Ir.write=function(t,e){return Lo(t,e)}});var Gn=pt(zn=>{"use strict";var Po=Rt("util"),qn=Rt("stream"),Bo=pn(),Uo=Tn(),Ho=Yn(),It=zn.PNG=function(t){qn.call(this),t=t||{},this.width=t.width|0,this.height=t.height|0,this.data=this.width>0&&this.height>0?Buffer.alloc(4*this.width*this.height):null,t.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new Bo(t),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(e){this.data=e,this.emit("parsed",e)}.bind(this)),this._packer=new Uo(t),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};Po.inherits(It,qn);It.sync=Ho;It.prototype.pack=function(){return!this.data||!this.data.length?(this.emit("error","No data provided"),this):(process.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this)};It.prototype.parse=function(t,e){if(e){let r,i;r=function(n){this.removeListener("error",i),this.data=n,e(null,this)}.bind(this),i=function(n){this.removeListener("parsed",r),e(n,null)}.bind(this),this.once("parsed",r),this.once("error",i)}return this.end(t),this};It.prototype.write=function(t){return this._parser.write(t),!0};It.prototype.end=function(t){this._parser.end(t)};It.prototype._metadata=function(t){this.width=t.width,this.height=t.height,this.emit("metadata",t)};It.prototype._gamma=function(t){this.gamma=t};It.prototype._handleClose=function(){!this._parser.writable&&!this._packer.readable&&this.emit("close")};It.bitblt=function(t,e,r,i,n,s,a,o){if(r|=0,i|=0,n|=0,s|=0,a|=0,o|=0,r>t.width||i>t.height||r+n>t.width||i+s>t.height)throw new Error("bitblt reading outside image");if(a>e.width||o>e.height||a+n>e.width||o+s>e.height)throw new Error("bitblt writing outside image");for(let h=0;h<s;h++)t.data.copy(e.data,(o+h)*e.width+a<<2,(i+h)*t.width+r<<2,(i+h)*t.width+r+n<<2)};It.prototype.bitblt=function(t,e,r,i,n,s,a){return It.bitblt(this,t,e,r,i,n,s,a),this};It.adjustGamma=function(t){if(t.gamma){for(let e=0;e<t.height;e++)for(let r=0;r<t.width;r++){let i=t.width*e+r<<2;for(let n=0;n<3;n++){let s=t.data[i+n]/255;s=Math.pow(s,1/2.2/t.gamma),t.data[i+n]=Math.round(s*255)}}t.gamma=0}};It.prototype.adjustGamma=function(){It.adjustGamma(this)}});var jn=pt((Bh,Ye)=>{"use strict";var Vn=Vn||function(t){return Buffer.from(t).toString("base64")};function Xo(t){var e=this,r=Math.round,i=Math.floor,n=new Array(64),s=new Array(64),a=new Array(64),o=new Array(64),h,l,p,f,d=new Array(65535),C=new Array(65535),m=new Array(64),F=new Array(64),w=[],T=0,S=7,g=new Array(64),y=new Array(64),x=new Array(64),z=new Array(256),_=new Array(2048),X,R=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],U=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],O=[0,1,2,3,4,5,6,7,8,9,10,11],nt=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],k=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],mt=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],M=[0,1,2,3,4,5,6,7,8,9,10,11],I=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],tt=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function st(c){for(var N=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],H=0;H<64;H++){var L=i((N[H]*c+50)/100);L<1?L=1:L>255&&(L=255),n[R[H]]=L}for(var W=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],j=0;j<64;j++){var at=i((W[j]*c+50)/100);at<1?at=1:at>255&&(at=255),s[R[j]]=at}for(var ot=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],bt=0,gt=0;gt<8;gt++)for(var v=0;v<8;v++)a[bt]=1/(n[R[bt]]*ot[gt]*ot[v]*8),o[bt]=1/(s[R[bt]]*ot[gt]*ot[v]*8),bt++}function P(c,N){for(var H=0,L=0,W=new Array,j=1;j<=16;j++){for(var at=1;at<=c[j];at++)W[N[L]]=[],W[N[L]][0]=H,W[N[L]][1]=j,L++,H++;H*=2}return W}function vt(){h=P(U,O),l=P(mt,M),p=P(nt,k),f=P(I,tt)}function rt(){for(var c=1,N=2,H=1;H<=15;H++){for(var L=c;L<N;L++)C[32767+L]=H,d[32767+L]=[],d[32767+L][1]=H,d[32767+L][0]=L;for(var W=-(N-1);W<=-c;W++)C[32767+W]=H,d[32767+W]=[],d[32767+W][1]=H,d[32767+W][0]=N-1+W;c<<=1,N<<=1}}function G(){for(var c=0;c<256;c++)_[c]=19595*c,_[c+256>>0]=38470*c,_[c+512>>0]=7471*c+32768,_[c+768>>0]=-11059*c,_[c+1024>>0]=-21709*c,_[c+1280>>0]=32768*c+8421375,_[c+1536>>0]=-27439*c,_[c+1792>>0]=-5329*c}function B(c){for(var N=c[0],H=c[1]-1;H>=0;)N&1<<H&&(T|=1<<S),H--,S--,S<0&&(T==255?(u(255),u(0)):u(T),S=7,T=0)}function u(c){w.push(c)}function D(c){u(c>>8&255),u(c&255)}function ht(c,N){var H,L,W,j,at,ot,bt,gt,v=0,A,q=8,Et=64;for(A=0;A<q;++A){H=c[v],L=c[v+1],W=c[v+2],j=c[v+3],at=c[v+4],ot=c[v+5],bt=c[v+6],gt=c[v+7];var Z=H+gt,it=H-gt,xt=L+bt,$=L-bt,ft=W+ot,Dt=W-ot,_t=j+at,Bt=j-at,qt=Z+_t,Qt=Z-_t,ee=xt+ft,re=xt-ft;c[v]=qt+ee,c[v+4]=qt-ee;var me=(re+Qt)*.707106781;c[v+2]=Qt+me,c[v+6]=Qt-me,qt=Bt+Dt,ee=Dt+$,re=$+it;var ve=(qt-re)*.382683433,Oe=.5411961*qt+ve,_e=1.306562965*re+ve,we=ee*.707106781,Ee=it+we,Ce=it-we;c[v+5]=Ce+Oe,c[v+3]=Ce-Oe,c[v+1]=Ee+_e,c[v+7]=Ee-_e,v+=8}for(v=0,A=0;A<q;++A){H=c[v],L=c[v+8],W=c[v+16],j=c[v+24],at=c[v+32],ot=c[v+40],bt=c[v+48],gt=c[v+56];var $r=H+gt,Ge=H-gt,Yr=L+bt,qr=L-bt,zr=W+ot,Gr=W-ot,Wr=j+at,ls=j-at,be=$r+Wr,We=$r-Wr,Ne=Yr+zr,Ie=Yr-zr;c[v]=be+Ne,c[v+32]=be-Ne;var Vr=(Ie+We)*.707106781;c[v+16]=We+Vr,c[v+48]=We-Vr,be=ls+Gr,Ne=Gr+qr,Ie=qr+Ge;var jr=(be-Ie)*.382683433,Zr=.5411961*be+jr,Qr=1.306562965*Ie+jr,Kr=Ne*.707106781,Jr=Ge+Kr,ti=Ge-Kr;c[v+40]=ti+Zr,c[v+24]=ti-Zr,c[v+8]=Jr+Qr,c[v+56]=Jr-Qr,v++}var Me;for(A=0;A<Et;++A)Me=c[A]*N[A],m[A]=Me>0?Me+.5|0:Me-.5|0;return m}function lt(){D(65504),D(16),u(74),u(70),u(73),u(70),u(0),u(1),u(1),u(0),D(1),D(1),u(0),u(0)}function Q(c){if(c){D(65505),c[0]===69&&c[1]===120&&c[2]===105&&c[3]===102?D(c.length+2):(D(c.length+5+2),u(69),u(120),u(105),u(102),u(0));for(var N=0;N<c.length;N++)u(c[N])}}function K(c,N){D(65472),D(17),u(8),D(N),D(c),u(3),u(1),u(17),u(0),u(2),u(17),u(1),u(3),u(17),u(1)}function V(){D(65499),D(132),u(0);for(var c=0;c<64;c++)u(n[c]);u(1);for(var N=0;N<64;N++)u(s[N])}function b(){D(65476),D(418),u(0);for(var c=0;c<16;c++)u(U[c+1]);for(var N=0;N<=11;N++)u(O[N]);u(16);for(var H=0;H<16;H++)u(nt[H+1]);for(var L=0;L<=161;L++)u(k[L]);u(1);for(var W=0;W<16;W++)u(mt[W+1]);for(var j=0;j<=11;j++)u(M[j]);u(17);for(var at=0;at<16;at++)u(I[at+1]);for(var ot=0;ot<=161;ot++)u(tt[ot])}function E(c){typeof c>"u"||c.constructor!==Array||c.forEach(N=>{if(typeof N=="string"){D(65534);var H=N.length;D(H+2);var L;for(L=0;L<H;L++)u(N.charCodeAt(L))}})}function dt(){D(65498),D(12),u(3),u(1),u(0),u(2),u(17),u(3),u(17),u(0),u(63),u(0)}function Y(c,N,H,L,W){for(var j=W[0],at=W[240],ot,bt=16,gt=63,v=64,A=ht(c,N),q=0;q<v;++q)F[R[q]]=A[q];var Et=F[0]-H;H=F[0],Et==0?B(L[0]):(ot=32767+Et,B(L[C[ot]]),B(d[ot]));for(var Z=63;Z>0&&F[Z]==0;Z--);if(Z==0)return B(j),H;for(var it=1,xt;it<=Z;){for(var $=it;F[it]==0&&it<=Z;++it);var ft=it-$;if(ft>=bt){xt=ft>>4;for(var Dt=1;Dt<=xt;++Dt)B(at);ft=ft&15}ot=32767+F[it],B(W[(ft<<4)+C[ot]]),B(d[ot]),it++}return Z!=gt&&B(j),H}function J(){for(var c=String.fromCharCode,N=0;N<256;N++)z[N]=c(N)}this.encode=function(c,N){var H=new Date().getTime();N&&Pt(N),w=new Array,T=0,S=7,D(65496),lt(),E(c.comments),Q(c.exifBuffer),V(),K(c.width,c.height),b(),dt();var L=0,W=0,j=0;T=0,S=7,this.encode.displayName="_encode_";for(var at=c.data,ot=c.width,bt=c.height,gt=ot*4,v=ot*3,A,q=0,Et,Z,it,xt,$,ft,Dt,_t;q<bt;){for(A=0;A<gt;){for(xt=gt*q+A,$=xt,ft=-1,Dt=0,_t=0;_t<64;_t++)Dt=_t>>3,ft=(_t&7)*4,$=xt+Dt*gt+ft,q+Dt>=bt&&($-=gt*(q+1+Dt-bt)),A+ft>=gt&&($-=A+ft-gt+4),Et=at[$++],Z=at[$++],it=at[$++],g[_t]=(_[Et]+_[Z+256>>0]+_[it+512>>0]>>16)-128,y[_t]=(_[Et+768>>0]+_[Z+1024>>0]+_[it+1280>>0]>>16)-128,x[_t]=(_[Et+1280>>0]+_[Z+1536>>0]+_[it+1792>>0]>>16)-128;L=Y(g,a,L,h,p),W=Y(y,o,W,l,f),j=Y(x,o,j,l,f),A+=32}q+=8}if(S>=0){var Bt=[];Bt[1]=S+1,Bt[0]=(1<<S+1)-1,B(Bt)}if(D(65497),typeof Ye>"u")return new Uint8Array(w);return Buffer.from(w);var qt,Qt};function Pt(c){if(c<=0&&(c=1),c>100&&(c=100),X!=c){var N=0;c<50?N=Math.floor(5e3/c):N=Math.floor(200-c*2),st(N),X=c}}function Ht(){var c=new Date().getTime();t||(t=50),J(),vt(),rt(),G(),Pt(t);var N=new Date().getTime()-c}Ht()}typeof Ye<"u"?Ye.exports=Wn:typeof window<"u"&&(window["jpeg-js"]=window["jpeg-js"]||{},window["jpeg-js"].encode=Wn);function Wn(t,e){typeof e>"u"&&(e=50);var r=new Xo(e),i=r.encode(t,e);return{data:i,width:t.width,height:t.height}}});var Qn=pt((Uh,Lr)=>{"use strict";var Mr=(function(){"use strict";var e=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),r=4017,i=799,n=3406,s=2276,a=1567,o=3784,h=5793,l=2896;function p(){}function f(S,g){for(var y=0,x=[],z,_,X=16;X>0&&!S[X-1];)X--;x.push({children:[],index:0});var R=x[0],U;for(z=0;z<X;z++){for(_=0;_<S[z];_++){for(R=x.pop(),R.children[R.index]=g[y];R.index>0;){if(x.length===0)throw new Error("Could not recreate Huffman Table");R=x.pop()}for(R.index++,x.push(R);x.length<=z;)x.push(U={children:[],index:0}),R.children[R.index]=U.children,R=U;y++}z+1<X&&(x.push(U={children:[],index:0}),R.children[R.index]=U.children,R=U)}return x[0].children}function d(S,g,y,x,z,_,X,R,U,O){var nt=y.precision,k=y.samplesPerLine,mt=y.scanLines,M=y.mcusPerLine,I=y.progressive,tt=y.maxH,st=y.maxV,P=g,vt=0,rt=0;function G(){if(rt>0)return rt--,vt>>rt&1;if(vt=S[g++],vt==255){var v=S[g++];if(v)throw new Error("unexpected marker: "+(vt<<8|v).toString(16))}return rt=7,vt>>>7}function B(v){for(var A=v,q;(q=G())!==null;){if(A=A[q],typeof A=="number")return A;if(typeof A!="object")throw new Error("invalid huffman sequence")}return null}function u(v){for(var A=0;v>0;){var q=G();if(q===null)return;A=A<<1|q,v--}return A}function D(v){var A=u(v);return A>=1<<v-1?A:A+(-1<<v)+1}function ht(v,A){var q=B(v.huffmanTableDC),Et=q===0?0:D(q);A[0]=v.pred+=Et;for(var Z=1;Z<64;){var it=B(v.huffmanTableAC),xt=it&15,$=it>>4;if(xt===0){if($<15)break;Z+=16;continue}Z+=$;var ft=e[Z];A[ft]=D(xt),Z++}}function lt(v,A){var q=B(v.huffmanTableDC),Et=q===0?0:D(q)<<U;A[0]=v.pred+=Et}function Q(v,A){A[0]|=G()<<U}var K=0;function V(v,A){if(K>0){K--;return}for(var q=_,Et=X;q<=Et;){var Z=B(v.huffmanTableAC),it=Z&15,xt=Z>>4;if(it===0){if(xt<15){K=u(xt)+(1<<xt)-1;break}q+=16;continue}q+=xt;var $=e[q];A[$]=D(it)*(1<<U),q++}}var b=0,E;function dt(v,A){for(var q=_,Et=X,Z=0;q<=Et;){var it=e[q],xt=A[it]<0?-1:1;switch(b){case 0:var $=B(v.huffmanTableAC),ft=$&15,Z=$>>4;if(ft===0)Z<15?(K=u(Z)+(1<<Z),b=4):(Z=16,b=1);else{if(ft!==1)throw new Error("invalid ACn encoding");E=D(ft),b=Z?2:3}continue;case 1:case 2:A[it]?A[it]+=(G()<<U)*xt:(Z--,Z===0&&(b=b==2?3:0));break;case 3:A[it]?A[it]+=(G()<<U)*xt:(A[it]=E<<U,b=0);break;case 4:A[it]&&(A[it]+=(G()<<U)*xt);break}q++}b===4&&(K--,K===0&&(b=0))}function Y(v,A,q,Et,Z){var it=q/M|0,xt=q%M,$=it*v.v+Et,ft=xt*v.h+Z;v.blocks[$]===void 0&&O.tolerantDecoding||A(v,v.blocks[$][ft])}function J(v,A,q){var Et=q/v.blocksPerLine|0,Z=q%v.blocksPerLine;v.blocks[Et]===void 0&&O.tolerantDecoding||A(v,v.blocks[Et][Z])}var Pt=x.length,Ht,c,N,H,L,W;I?_===0?W=R===0?lt:Q:W=R===0?V:dt:W=ht;var j=0,at,ot;Pt==1?ot=x[0].blocksPerLine*x[0].blocksPerColumn:ot=M*y.mcusPerColumn,z||(z=ot);for(var bt,gt;j<ot;){for(c=0;c<Pt;c++)x[c].pred=0;if(K=0,Pt==1)for(Ht=x[0],L=0;L<z;L++)J(Ht,W,j),j++;else for(L=0;L<z;L++){for(c=0;c<Pt;c++)for(Ht=x[c],bt=Ht.h,gt=Ht.v,N=0;N<gt;N++)for(H=0;H<bt;H++)Y(Ht,W,j,N,H);if(j++,j===ot)break}if(j===ot)do{if(S[g]===255&&S[g+1]!==0)break;g+=1}while(g<S.length-2);if(rt=0,at=S[g]<<8|S[g+1],at<65280)throw new Error("marker was not found");if(at>=65488&&at<=65495)g+=2;else break}return g-P}function C(S,g){var y=[],x=g.blocksPerLine,z=g.blocksPerColumn,_=x<<3,X=new Int32Array(64),R=new Uint8Array(64);function U(P,vt,rt){var G=g.quantizationTable,B,u,D,ht,lt,Q,K,V,b,E=rt,dt;for(dt=0;dt<64;dt++)E[dt]=P[dt]*G[dt];for(dt=0;dt<8;++dt){var Y=8*dt;if(E[1+Y]==0&&E[2+Y]==0&&E[3+Y]==0&&E[4+Y]==0&&E[5+Y]==0&&E[6+Y]==0&&E[7+Y]==0){b=h*E[0+Y]+512>>10,E[0+Y]=b,E[1+Y]=b,E[2+Y]=b,E[3+Y]=b,E[4+Y]=b,E[5+Y]=b,E[6+Y]=b,E[7+Y]=b;continue}B=h*E[0+Y]+128>>8,u=h*E[4+Y]+128>>8,D=E[2+Y],ht=E[6+Y],lt=l*(E[1+Y]-E[7+Y])+128>>8,V=l*(E[1+Y]+E[7+Y])+128>>8,Q=E[3+Y]<<4,K=E[5+Y]<<4,b=B-u+1>>1,B=B+u+1>>1,u=b,b=D*o+ht*a+128>>8,D=D*a-ht*o+128>>8,ht=b,b=lt-K+1>>1,lt=lt+K+1>>1,K=b,b=V+Q+1>>1,Q=V-Q+1>>1,V=b,b=B-ht+1>>1,B=B+ht+1>>1,ht=b,b=u-D+1>>1,u=u+D+1>>1,D=b,b=lt*s+V*n+2048>>12,lt=lt*n-V*s+2048>>12,V=b,b=Q*i+K*r+2048>>12,Q=Q*r-K*i+2048>>12,K=b,E[0+Y]=B+V,E[7+Y]=B-V,E[1+Y]=u+K,E[6+Y]=u-K,E[2+Y]=D+Q,E[5+Y]=D-Q,E[3+Y]=ht+lt,E[4+Y]=ht-lt}for(dt=0;dt<8;++dt){var J=dt;if(E[8+J]==0&&E[16+J]==0&&E[24+J]==0&&E[32+J]==0&&E[40+J]==0&&E[48+J]==0&&E[56+J]==0){b=h*rt[dt+0]+8192>>14,E[0+J]=b,E[8+J]=b,E[16+J]=b,E[24+J]=b,E[32+J]=b,E[40+J]=b,E[48+J]=b,E[56+J]=b;continue}B=h*E[0+J]+2048>>12,u=h*E[32+J]+2048>>12,D=E[16+J],ht=E[48+J],lt=l*(E[8+J]-E[56+J])+2048>>12,V=l*(E[8+J]+E[56+J])+2048>>12,Q=E[24+J],K=E[40+J],b=B-u+1>>1,B=B+u+1>>1,u=b,b=D*o+ht*a+2048>>12,D=D*a-ht*o+2048>>12,ht=b,b=lt-K+1>>1,lt=lt+K+1>>1,K=b,b=V+Q+1>>1,Q=V-Q+1>>1,V=b,b=B-ht+1>>1,B=B+ht+1>>1,ht=b,b=u-D+1>>1,u=u+D+1>>1,D=b,b=lt*s+V*n+2048>>12,lt=lt*n-V*s+2048>>12,V=b,b=Q*i+K*r+2048>>12,Q=Q*r-K*i+2048>>12,K=b,E[0+J]=B+V,E[56+J]=B-V,E[8+J]=u+K,E[48+J]=u-K,E[16+J]=D+Q,E[40+J]=D-Q,E[24+J]=ht+lt,E[32+J]=ht-lt}for(dt=0;dt<64;++dt){var Pt=128+(E[dt]+8>>4);vt[dt]=Pt<0?0:Pt>255?255:Pt}}T(_*z*8);for(var O,nt,k=0;k<z;k++){var mt=k<<3;for(O=0;O<8;O++)y.push(new Uint8Array(_));for(var M=0;M<x;M++){U(g.blocks[k][M],R,X);var I=0,tt=M<<3;for(nt=0;nt<8;nt++){var st=y[mt+nt];for(O=0;O<8;O++)st[tt+O]=R[I++]}}}return y}function m(S){return S<0?0:S>255?255:S}p.prototype={load:function(g){var y=new XMLHttpRequest;y.open("GET",g,!0),y.responseType="arraybuffer",y.onload=(function(){var x=new Uint8Array(y.response||y.mozResponseArrayBuffer);this.parse(x),this.onload&&this.onload()}).bind(this),y.send(null)},parse:function(g){var y=this.opts.maxResolutionInMP*1e3*1e3,x=0,z=g.length;function _(){var $=g[x]<<8|g[x+1];return x+=2,$}function X(){var $=_(),ft=g.subarray(x,x+$-2);return x+=ft.length,ft}function R($){var ft=1,Dt=1,_t,Bt;for(Bt in $.components)$.components.hasOwnProperty(Bt)&&(_t=$.components[Bt],ft<_t.h&&(ft=_t.h),Dt<_t.v&&(Dt=_t.v));var qt=Math.ceil($.samplesPerLine/8/ft),Qt=Math.ceil($.scanLines/8/Dt);for(Bt in $.components)if($.components.hasOwnProperty(Bt)){_t=$.components[Bt];var ee=Math.ceil(Math.ceil($.samplesPerLine/8)*_t.h/ft),re=Math.ceil(Math.ceil($.scanLines/8)*_t.v/Dt),me=qt*_t.h,ve=Qt*_t.v,Oe=ve*me,_e=[];T(Oe*256);for(var we=0;we<ve;we++){for(var Ee=[],Ce=0;Ce<me;Ce++)Ee.push(new Int32Array(64));_e.push(Ee)}_t.blocksPerLine=ee,_t.blocksPerColumn=re,_t.blocks=_e}$.maxH=ft,$.maxV=Dt,$.mcusPerLine=qt,$.mcusPerColumn=Qt}var U=null,O=null,nt=null,k,mt,M=[],I=[],tt=[],st=[],P=_(),vt=-1;if(this.comments=[],P!=65496)throw new Error("SOI not found");for(P=_();P!=65497;){var rt,G,B;switch(P){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var u=X();if(P===65534){var D=String.fromCharCode.apply(null,u);this.comments.push(D)}P===65504&&u[0]===74&&u[1]===70&&u[2]===73&&u[3]===70&&u[4]===0&&(U={version:{major:u[5],minor:u[6]},densityUnits:u[7],xDensity:u[8]<<8|u[9],yDensity:u[10]<<8|u[11],thumbWidth:u[12],thumbHeight:u[13],thumbData:u.subarray(14,14+3*u[12]*u[13])}),P===65505&&u[0]===69&&u[1]===120&&u[2]===105&&u[3]===102&&u[4]===0&&(this.exifBuffer=u.subarray(5,u.length)),P===65518&&u[0]===65&&u[1]===100&&u[2]===111&&u[3]===98&&u[4]===101&&u[5]===0&&(O={version:u[6],flags0:u[7]<<8|u[8],flags1:u[9]<<8|u[10],transformCode:u[11]});break;case 65499:for(var ht=_(),lt=ht+x-2;x<lt;){var Q=g[x++];T(256);var K=new Int32Array(64);if(Q>>4===0)for(G=0;G<64;G++){var V=e[G];K[V]=g[x++]}else if(Q>>4===1)for(G=0;G<64;G++){var V=e[G];K[V]=_()}else throw new Error("DQT: invalid table spec");M[Q&15]=K}break;case 65472:case 65473:case 65474:_(),k={},k.extended=P===65473,k.progressive=P===65474,k.precision=g[x++],k.scanLines=_(),k.samplesPerLine=_(),k.components={},k.componentsOrder=[];var b=k.scanLines*k.samplesPerLine;if(b>y){var E=Math.ceil((b-y)/1e6);throw new Error(`maxResolutionInMP limit exceeded by ${E}MP`)}var dt=g[x++],Y,J=0,Pt=0;for(rt=0;rt<dt;rt++){Y=g[x];var Ht=g[x+1]>>4,c=g[x+1]&15,N=g[x+2];if(Ht<=0||c<=0)throw new Error("Invalid sampling factor, expected values above 0");k.componentsOrder.push(Y),k.components[Y]={h:Ht,v:c,quantizationIdx:N},x+=3}R(k),I.push(k);break;case 65476:var H=_();for(rt=2;rt<H;){var L=g[x++],W=new Uint8Array(16),j=0;for(G=0;G<16;G++,x++)j+=W[G]=g[x];T(16+j);var at=new Uint8Array(j);for(G=0;G<j;G++,x++)at[G]=g[x];rt+=17+j,(L>>4===0?st:tt)[L&15]=f(W,at)}break;case 65501:_(),mt=_();break;case 65500:_(),_();break;case 65498:var ot=_(),bt=g[x++],gt=[],v;for(rt=0;rt<bt;rt++){v=k.components[g[x++]];var A=g[x++];v.huffmanTableDC=st[A>>4],v.huffmanTableAC=tt[A&15],gt.push(v)}var q=g[x++],Et=g[x++],Z=g[x++],it=d(g,x,k,gt,mt,q,Et,Z>>4,Z&15,this.opts);x+=it;break;case 65535:g[x]!==255&&x--;break;default:if(g[x-3]==255&&g[x-2]>=192&&g[x-2]<=254){x-=3;break}else if(P===224||P==225){if(vt!==-1)throw new Error(`first unknown JPEG marker at offset ${vt.toString(16)}, second unknown JPEG marker ${P.toString(16)} at offset ${(x-1).toString(16)}`);vt=x-1;let $=_();if(g[x+$-2]===255){x+=$-2;break}}throw new Error("unknown JPEG marker "+P.toString(16))}P=_()}if(I.length!=1)throw new Error("only single frame JPEGs supported");for(var rt=0;rt<I.length;rt++){var xt=I[rt].components;for(var G in xt)xt[G].quantizationTable=M[xt[G].quantizationIdx],delete xt[G].quantizationIdx}this.width=k.samplesPerLine,this.height=k.scanLines,this.jfif=U,this.adobe=O,this.components=[];for(var rt=0;rt<k.componentsOrder.length;rt++){var v=k.components[k.componentsOrder[rt]];this.components.push({lines:C(k,v),scaleX:v.h/k.maxH,scaleY:v.v/k.maxV})}},getData:function(g,y){var x=this.width/g,z=this.height/y,_,X,R,U,O,nt,k,mt,M,I,tt=0,st,P,vt,rt,G,B,u,D,ht,lt,Q,K=g*y*this.components.length;T(K);var V=new Uint8Array(K);switch(this.components.length){case 1:for(_=this.components[0],I=0;I<y;I++)for(O=_.lines[0|I*_.scaleY*z],M=0;M<g;M++)st=O[0|M*_.scaleX*x],V[tt++]=st;break;case 2:for(_=this.components[0],X=this.components[1],I=0;I<y;I++)for(O=_.lines[0|I*_.scaleY*z],nt=X.lines[0|I*X.scaleY*z],M=0;M<g;M++)st=O[0|M*_.scaleX*x],V[tt++]=st,st=nt[0|M*X.scaleX*x],V[tt++]=st;break;case 3:for(Q=!0,this.adobe&&this.adobe.transformCode?Q=!0:typeof this.opts.colorTransform<"u"&&(Q=!!this.opts.colorTransform),_=this.components[0],X=this.components[1],R=this.components[2],I=0;I<y;I++)for(O=_.lines[0|I*_.scaleY*z],nt=X.lines[0|I*X.scaleY*z],k=R.lines[0|I*R.scaleY*z],M=0;M<g;M++)Q?(st=O[0|M*_.scaleX*x],P=nt[0|M*X.scaleX*x],vt=k[0|M*R.scaleX*x],D=m(st+1.402*(vt-128)),ht=m(st-.3441363*(P-128)-.71413636*(vt-128)),lt=m(st+1.772*(P-128))):(D=O[0|M*_.scaleX*x],ht=nt[0|M*X.scaleX*x],lt=k[0|M*R.scaleX*x]),V[tt++]=D,V[tt++]=ht,V[tt++]=lt;break;case 4:if(!this.adobe)throw new Error("Unsupported color mode (4 components)");for(Q=!1,this.adobe&&this.adobe.transformCode?Q=!0:typeof this.opts.colorTransform<"u"&&(Q=!!this.opts.colorTransform),_=this.components[0],X=this.components[1],R=this.components[2],U=this.components[3],I=0;I<y;I++)for(O=_.lines[0|I*_.scaleY*z],nt=X.lines[0|I*X.scaleY*z],k=R.lines[0|I*R.scaleY*z],mt=U.lines[0|I*U.scaleY*z],M=0;M<g;M++)Q?(st=O[0|M*_.scaleX*x],P=nt[0|M*X.scaleX*x],vt=k[0|M*R.scaleX*x],rt=mt[0|M*U.scaleX*x],G=255-m(st+1.402*(vt-128)),B=255-m(st-.3441363*(P-128)-.71413636*(vt-128)),u=255-m(st+1.772*(P-128))):(G=O[0|M*_.scaleX*x],B=nt[0|M*X.scaleX*x],u=k[0|M*R.scaleX*x],rt=mt[0|M*U.scaleX*x]),V[tt++]=255-G,V[tt++]=255-B,V[tt++]=255-u,V[tt++]=255-rt;break;default:throw new Error("Unsupported color mode")}return V},copyToImageData:function(g,y){var x=g.width,z=g.height,_=g.data,X=this.getData(x,z),R=0,U=0,O,nt,k,mt,M,I,tt,st,P;switch(this.components.length){case 1:for(nt=0;nt<z;nt++)for(O=0;O<x;O++)k=X[R++],_[U++]=k,_[U++]=k,_[U++]=k,y&&(_[U++]=255);break;case 3:for(nt=0;nt<z;nt++)for(O=0;O<x;O++)tt=X[R++],st=X[R++],P=X[R++],_[U++]=tt,_[U++]=st,_[U++]=P,y&&(_[U++]=255);break;case 4:for(nt=0;nt<z;nt++)for(O=0;O<x;O++)M=X[R++],I=X[R++],k=X[R++],mt=X[R++],tt=255-m(M*(1-mt/255)+mt),st=255-m(I*(1-mt/255)+mt),P=255-m(k*(1-mt/255)+mt),_[U++]=tt,_[U++]=st,_[U++]=P,y&&(_[U++]=255);break;default:throw new Error("Unsupported color mode")}}};var F=0,w=0;function T(S=0){var g=F+S;if(g>w){var y=Math.ceil((g-w)/1024/1024);throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${y}MB`)}F=g}return p.resetMaxMemoryUsage=function(S){F=0,w=S},p.getBytesAllocated=function(){return F},p.requestMemoryAllocation=T,p})();typeof Lr<"u"?Lr.exports=Zn:typeof window<"u"&&(window["jpeg-js"]=window["jpeg-js"]||{},window["jpeg-js"].decode=Zn);function Zn(t,e={}){var r={colorTransform:void 0,useTArray:!1,formatAsRGBA:!0,tolerantDecoding:!0,maxResolutionInMP:100,maxMemoryUsageInMB:512},i={...r,...e},n=new Uint8Array(t),s=new Mr;s.opts=i,Mr.resetMaxMemoryUsage(i.maxMemoryUsageInMB*1024*1024),s.parse(n);var a=i.formatAsRGBA?4:3,o=s.width*s.height*a;try{Mr.requestMemoryAllocation(o);var h={width:s.width,height:s.height,exifBuffer:s.exifBuffer,data:i.useTArray?new Uint8Array(o):Buffer.alloc(o)};s.comments.length>0&&(h.comments=s.comments)}catch(l){throw l instanceof RangeError?new Error("Could not allocate enough memory for the image. Required: "+o):l instanceof ReferenceError&&l.message==="Buffer is not defined"?new Error("Buffer is not globally defined in this environment. Consider setting useTArray to true"):l}return s.copyToImageData(h,i.formatAsRGBA),h}});var Jn=pt((Hh,Kn)=>{"use strict";var $o=jn(),Yo=Qn();Kn.exports={encode:$o,decode:Yo}});import{createRequire as fs}from"module";var us=fs("/"),ae,cs,ds;try{ae=us("worker_threads"),cs=ae.Worker,ds=ae.isMarkedAsUntransferable}catch{}var St=Uint8Array,ie=Uint16Array,ps=Int32Array,ni=new St([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]),si=new St([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]),xs=new St([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ai=function(t,e){for(var r=new ie(31),i=0;i<31;++i)r[i]=e+=1<<t[i-1];for(var n=new ps(r[30]),i=1;i<30;++i)for(var s=r[i];s<r[i+1];++s)n[s]=s-r[i]<<5|i;return{b:r,r:n}},ae=ai(ni,2),oi=ae.b,gs=ae.r;oi[28]=258,gs[258]=28;var hi=ai(si,0),ms=hi.b,hh=hi.r,Qe=new ie(32768);for(ut=0;ut<32768;++ut)Wt=(ut&43690)>>1|(ut&21845)<<1,Wt=(Wt&52428)>>2|(Wt&13107)<<2,Wt=(Wt&61680)>>4|(Wt&3855)<<4,Qe[ut]=((Wt&65280)>>8|(Wt&255)<<8)>>1;var Wt,ut,ye=(function(t,e,r){for(var i=t.length,n=0,s=new ie(e);n<i;++n)t[n]&&++s[t[n]-1];var a=new ie(e);for(n=1;n<e;++n)a[n]=a[n-1]+s[n-1]<<1;var o;if(r){o=new ie(1<<e);var h=15-e;for(n=0;n<i;++n)if(t[n])for(var l=n<<4|t[n],p=e-t[n],f=a[t[n]-1]++<<p,d=f|(1<<p)-1;f<=d;++f)o[Qe[f]>>h]=l}else for(o=new ie(i),n=0;n<i;++n)t[n]&&(o[n]=Qe[a[t[n]-1]++]>>15-t[n]);return o}),Fe=new St(288);for(ut=0;ut<144;++ut)Fe[ut]=8;var ut;for(ut=144;ut<256;++ut)Fe[ut]=9;var ut;for(ut=256;ut<280;++ut)Fe[ut]=7;var ut;for(ut=280;ut<288;++ut)Fe[ut]=8;var ut,li=new St(32);for(ut=0;ut<32;++ut)li[ut]=5;var ut;var vs=ye(Fe,9,1);var _s=ye(li,5,1),Ve=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},Xt=function(t,e,r){var i=e/8|0;return(t[i]|t[i+1]<<8)>>(e&7)&r},je=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},ws=function(t){return(t+7)/8|0},Ae=function(t,e,r){return(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length),new St(t.subarray(e,r))};var Es=["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"],At=function(t,e,r){var i=new Error(e||Es[t]);if(i.code=t,Error.captureStackTrace&&Error.captureStackTrace(i,At),!r)throw i;return i},Cs=function(t,e,r,i){var n=t.length,s=i?i.length:0;if(!n||e.f&&!e.l)return r||new St(0);var a=!r,o=a||e.i!=2,h=e.i;a&&(r=new St(n*3));var l=function(b){var E=r.length;if(b>E){var dt=new St(Math.max(E*2,b));dt.set(r),r=dt}},p=e.f||0,f=e.p||0,d=e.b||0,C=e.l,m=e.d,F=e.m,w=e.n,T=n*8;do{if(!C){p=Xt(t,f,1);var S=Xt(t,f+1,3);if(f+=3,S)if(S==1)C=vs,m=_s,F=9,w=5;else if(S==2){var z=Xt(t,f,31)+257,_=Xt(t,f+10,15)+4,X=z+Xt(t,f+5,31)+1;f+=14;for(var R=new St(X),U=new St(19),O=0;O<_;++O)U[xs[O]]=Xt(t,f+O*3,7);f+=_*3;for(var nt=Ve(U),k=(1<<nt)-1,mt=ye(U,nt,1),O=0;O<X;){var M=mt[Xt(t,f,k)];f+=M&15;var g=M>>4;if(g<16)R[O++]=g;else{var I=0,tt=0;for(g==16?(tt=3+Xt(t,f,3),f+=2,I=R[O-1]):g==17?(tt=3+Xt(t,f,7),f+=3):g==18&&(tt=11+Xt(t,f,127),f+=7);tt--;)R[O++]=I}}var st=R.subarray(0,z),P=R.subarray(z);F=Ve(st),w=Ve(P),C=ye(st,F,1),m=ye(P,w,1)}else At(1);else{var g=ws(f)+4,y=t[g-4]|t[g-3]<<8,x=g+y;if(x>n){h&&At(0);break}o&&l(d+y),r.set(t.subarray(g,x),d),e.b=d+=y,e.p=f=x*8,e.f=p;continue}if(f>T){h&&At(0);break}}o&&l(d+131072);for(var vt=(1<<F)-1,rt=(1<<w)-1,G=f;;G=f){var I=C[je(t,f)&vt],B=I>>4;if(f+=I&15,f>T){h&&At(0);break}if(I||At(2),B<256)r[d++]=B;else if(B==256){G=f,C=null;break}else{var u=B-254;if(B>264){var O=B-257,D=ni[O];u=Xt(t,f,(1<<D)-1)+oi[O],f+=D}var ht=m[je(t,f)&rt],lt=ht>>4;ht||At(3),f+=ht&15;var P=ms[lt];if(lt>3){var D=si[lt];P+=je(t,f)&(1<<D)-1,f+=D}if(f>T){h&&At(0);break}o&&l(d+131072);var Q=d+u;if(d<P){var K=s-P,V=Math.min(P,Q);for(K+d<0&&At(3);d<V;++d)r[d]=i[K+d]}for(;d<Q;++d)r[d]=r[d-P]}}e.l=C,e.p=G,e.b=d,e.f=p,C&&(p=1,e.m=F,e.d=m,e.n=w)}while(!p);return d!=r.length&&a?Ae(r,0,d):r.subarray(0,d)};var Te=new St(0);var ne=function(t,e){return t[e]|t[e+1]<<8},se=function(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0},Ze=function(t,e){return se(t,e)+se(t,e+4)*4294967296};var bs=(function(){function t(e,r){typeof e=="function"&&(r=e,e={}),this.ondata=r;var i=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:i?i.length:0},this.o=new St(32768),this.p=new St(0),i&&this.o.set(i)}return t.prototype.e=function(e){if(this.ondata||At(5),this.d&&At(4),!this.p.length)this.p=e;else if(e.length){var r=new St(this.p.length+e.length);r.set(this.p),r.set(e,this.p.length),this.p=r}},t.prototype.c=function(e){this.s.i=+(this.d=e||!1);var r=this.s.b,i=Cs(this.p,this.s,this.o);this.ondata(Ae(i,r,this.s.b),this.d),this.o=Ae(i,this.s.b-32768),this.s.b=this.o.length,this.p=Ae(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(e,r){this.e(e),this.c(r)},t})();var Ke=typeof TextDecoder<"u"&&new TextDecoder,Ts=0;try{Ke.decode(Te,{stream:!0}),Ts=1}catch{}var ys=function(t){for(var e="",r=0;;){var i=t[r++],n=(i>127)+(i>223)+(i>239);if(r+n>t.length)return{s:e,r:Ae(t,r-1)};n?n==3?(i=((i&15)<<18|(t[r++]&63)<<12|(t[r++]&63)<<6|t[r++]&63)-65536,e+=String.fromCharCode(55296|i>>10,56320|i&1023)):n&1?e+=String.fromCharCode((i&31)<<6|t[r++]&63):e+=String.fromCharCode((i&15)<<12|(t[r++]&63)<<6|t[r++]&63):e+=String.fromCharCode(i)}};function As(t,e){if(e){for(var r="",i=0;i<t.length;i+=16384)r+=String.fromCharCode.apply(null,t.subarray(i,i+16384));return r}else{if(Ke)return Ke.decode(t);var n=ys(t),s=n.s,r=n.r;return r.length&&At(8),s}}var Fs=function(t,e,r,i,n,s,a){var o=n==4294967295,h=s==4294967295,l=a==4294967295,p=e+r,f=o+h+l;if(i&&f){for(;e+4<p;e+=4+ne(t,e+2))if(ne(t,e)==1)return[o?Ze(t,e+4+8*h):n,h?Ze(t,e+4):s,l?Ze(t,e+4+8*(h+o)):a,1];i<2&&At(13)}return[n,s,a,0]};var Je=(function(){function t(){}return t.prototype.push=function(e,r){this.ondata(null,e,r)},t.compression=0,t})();var fi=(function(){function t(){var e=this;this.i=new bs(function(r,i){e.ondata(null,r,i)})}return t.prototype.push=function(e,r){try{this.i.push(e,r)}catch(i){this.ondata(i,null,r)}},t.compression=8,t})();var ui=(function(){function t(e){this.onfile=e,this.k=[],this.o={0:Je},this.p=Te}return t.prototype.push=function(e,r){var i=this;if(this.onfile||At(5),this.p||At(4),this.c>0){var n=Math.min(this.c,e.length),s=e.subarray(0,n);if(this.c-=n,this.d?this.d.push(s,!this.c):this.k[0].push(s),e=e.subarray(n),e.length)return this.push(e,r)}else{var a=0,o=0,h=void 0,l=void 0;this.p.length?e.length?(l=new St(this.p.length+e.length),l.set(this.p),l.set(e,this.p.length)):l=this.p:l=e;for(var p=l.length,f=this.c,d=f&&this.d,C=function(){var T=se(l,o);if(T==67324752){a=1,h=o,m.d=null,m.c=0;var S=ne(l,o+6),g=ne(l,o+8),y=S&2048,x=S&8,z=ne(l,o+26),_=ne(l,o+28);if(p>o+30+z+_){var X=[];m.k.unshift(X),a=2;var R=se(l,o+18),U=se(l,o+22),O=As(l.subarray(o+30,o+=30+z),!y),nt=Fs(l,o,_,2,R,U,0),k=nt[0],mt=nt[1],M=nt[3];x&&(k=-1-M),o+=_,m.c=k;var I,tt={name:O,compression:g,start:function(){if(tt.ondata||At(5),!k)tt.ondata(null,Te,!0);else{var st=i.o[g];st||tt.ondata(At(14,"unknown compression type "+g,1),null,!1),I=k<0?new st(O):new st(O,k,mt),I.ondata=function(G,B,u){tt.ondata(G,B,u)};for(var P=0,vt=X;P<vt.length;P++){var rt=vt[P];I.push(rt,!1)}i.k[0]==X&&i.c?i.d=I:I.push(Te,!0)}},terminate:function(){I&&I.terminate&&I.terminate()}};k>=0&&(tt.size=k,tt.originalSize=mt),m.onfile(tt)}return"break"}else if(f){if(T==134695760)return h=o+=12+(f==-2&&8),a=3,m.c=0,"break";if(T==33639248)return h=o-=4,a=3,m.c=0,"break"}},m=this;o<p-4;++o){var F=C();if(F==="break")break}if(this.p=Te,f<0){var w=a?l.subarray(0,h-12-(f==-2&&8)-(se(l,h-16)==134695760&&4)):l.subarray(0,o);d?d.push(w,!!a):this.k[+(a==2)].push(w)}if(a&2)return this.push(l.subarray(o),r);this.p=l.subarray(o)}r&&(this.c&&At(13),this.p=null)},t.prototype.register=function(e){this.o[e.compression]=e},t})();var Yi=Le(vr(),1);var Ta=1e4,ya=5e7,Aa=25e7,qi=5e6,zi=256,Gi=65536,_r=256,Wi=3e4,et=class extends Error{constructor(r,i){super(`${r}: ${i}`);this.code=r}},Fa="http://schemas.openxmlformats.org/package/2006/relationships",Da="http://schemas.openxmlformats.org/package/2006/content-types",ka=new Set(["http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","http://purl.oclc.org/ooxml/officeDocument/relationships/officeDocument"]),Ra=["application/vnd.openxmlformats-officedocument.wordprocessingml.document.main","application/vnd.ms-word.document.main"];function Vi(t){return t.length===0?"empty name":t.includes("\\")?"backslash":t.includes("\0")?"NUL byte":t.startsWith("/")?"absolute path":/^[a-zA-Z]:/.test(t)?"drive letter":t.split("/").some(e=>e==="..")?"dot-dot segment":null}function Sa(t,e){let r=Math.max(0,t.length-65557),i=-1;for(let l=t.length-22;l>=r;l--)if(t.readUInt32LE(l)===101010256){i=l;break}if(i<0)throw new et("DOCX_UNREADABLE","not a zip archive (no end-of-central-directory)");let n=t.readUInt16LE(i+10);if(n>e)throw new et("DOCX_TOO_MANY_PARTS",`${n} entries > ${e} cap`);let s=t.readUInt32LE(i+16),a=[],o=new Set,h=s;for(let l=0;l<n;l++){if(h+46>t.length||t.readUInt32LE(h)!==33639248)throw new et("DOCX_UNREADABLE","malformed central directory");let p=t.readUInt32LE(h+16),f=t.readUInt16LE(h+28),d=t.readUInt16LE(h+30),C=t.readUInt16LE(h+32),m=t.subarray(h+46,h+46+f).toString("utf8"),F=Vi(m);if(F!==null)throw new et("DOCX_UNREADABLE",`unsafe entry name (${F}): ${JSON.stringify(m)}`);if(o.has(m))throw new et("DOCX_UNREADABLE",`duplicate entry: ${m}`);o.add(m),a.push({name:m,crc:p}),h+=46+f+d+C}return a}function Oa(t,e){let r=new Map,i=0,n=null,s=o=>{n||(n=o)},a=new ui(o=>{let h=Vi(o.name);if(h!==null){s(new et("DOCX_UNREADABLE",`unsafe entry name (${h}): ${JSON.stringify(o.name)}`));return}let l=[],p=0;o.ondata=(f,d,C)=>{if(f){s(new et("DOCX_UNREADABLE",`entry ${o.name}: ${f.message??String(f)}`));return}if(d&&d.length>0){if(p+=d.length,i+=d.length,p>e.maxPartBytes){s(new et("DOCX_PART_TOO_LARGE",`${o.name}: ${p} actual bytes > ${e.maxPartBytes} cap`));return}if(i>e.maxTotalBytes){s(new et("DOCX_BOMB",`total actual inflated bytes exceed ${e.maxTotalBytes} cap`));return}l.push(d)}C&&!n&&r.set(o.name,Buffer.concat(l))},o.start()});a.register(Je),a.register(fi);try{for(let o=0;o<t.length;o+=65536)if(a.push(t.subarray(o,Math.min(o+65536,t.length)),o+65536>=t.length),n)throw n}catch(o){throw o instanceof et?o:new et("DOCX_UNREADABLE",`zip stream: ${o instanceof Error?o.message:String(o)}`)}if(n)throw n;return r}function ji(t,e,r){let i=new Yi.SaxesParser({xmlns:!0}),n=null;if(i.on("doctype",()=>{n=new et("DOCX_UNREADABLE",`DOCTYPE not allowed (${e})`)}),i.on("error",s=>{n=n??new et("DOCX_UNREADABLE",`${e}: ${s.message}`)}),i.on("opentag",s=>{if(n)return;let a={};for(let[o,h]of Object.entries(s.attributes))a[h.local||o]=h.value;r(s.uri??"",s.local,a)}),i.write(t).close(),n)throw n}function Xi(t,e){let r=new Map;return ji(t,e,(i,n,s)=>{i===Fa&&n==="Relationship"&&s.Id&&s.Type&&s.Target!==void 0&&r.set(s.Id,{type:s.Type,target:s.Target,targetMode:s.TargetMode==="External"?"External":"Internal"})}),r}function Na(t){let e=new Map,r=new Map;return ji(t,"[Content_Types].xml",(i,n,s)=>{i===Da&&(n==="Default"&&s.Extension&&s.ContentType?e.set(s.Extension.toLowerCase(),s.ContentType):n==="Override"&&s.PartName&&s.ContentType&&r.set(s.PartName.replace(/^\//,""),s.ContentType))}),{defaults:e,overrides:r}}function Ia(t,e){let r=t.overrides.get(e);if(r)return r;let i=e.lastIndexOf(".");if(!(i<0))return t.defaults.get(e.slice(i+1).toLowerCase())}function $i(t,e){if(/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e)||e.includes("\\")||e.includes("\0"))return null;let r;try{r=decodeURIComponent(e)}catch{return null}let i=r.startsWith("/")?[]:t.split("/").slice(0,-1).filter(n=>n.length>0);for(let n of r.split("/"))if(!(n===""||n===".")){if(n===".."){if(i.length===0)return null;i.pop();continue}i.push(n)}return i.length>0?i.join("/"):null}var Ma=Buffer.from([208,207,17,224,161,177,26,225]);function de(t){try{return t.length>=3&&t[0]===239&&t[1]===187&&t[2]===191?new TextDecoder("utf-8",{fatal:!0}).decode(t.subarray(3)):t.length>=2&&t[0]===255&&t[1]===254?new TextDecoder("utf-16le",{fatal:!0}).decode(t.subarray(2)):t.length>=2&&t[0]===254&&t[1]===255?new TextDecoder("utf-16be",{fatal:!0}).decode(t.subarray(2)):new TextDecoder("utf-8",{fatal:!0}).decode(t)}catch{throw new et("DOCX_UNREADABLE","XML part is not valid UTF-8/UTF-16 text")}}function Zi(t,e){if(t.length>=8&&t.subarray(0,8).equals(Ma))throw new et("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 r={maxEntries:e?.maxEntries??Ta,maxPartBytes:e?.maxPartBytes??ya,maxTotalBytes:e?.maxTotalBytes??Aa},i=Sa(t,r.maxEntries),n=Oa(t,r),s=new Map(i.map(d=>[d.name,d]));if(n.size!==i.length)throw new et("DOCX_UNREADABLE",`central directory lists ${i.length} entries, stream produced ${n.size}`);for(let[d,C]of n){let m=s.get(d);if(!m)throw new et("DOCX_UNREADABLE",`entry ${d} missing from central directory`);if(ii(C)!==m.crc)throw new et("DOCX_UNREADABLE",`CRC mismatch: ${d}`)}let a=n.get("_rels/.rels");if(!a)throw new et("DOCX_NOT_WORDPROCESSING","no package relationships (_rels/.rels missing)");let o=Xi(de(a),"_rels/.rels"),h=null;for(let d of o.values()){if(!ka.has(d.type)||d.targetMode!=="Internal")continue;let C=$i("",d.target);if(C!==null&&n.has(C)){h=C;break}}if(h===null)throw new et("DOCX_NOT_WORDPROCESSING","this zip is not a Word document (no officeDocument relationship)");let l=n.get("[Content_Types].xml");if(!l)throw new et("DOCX_NOT_WORDPROCESSING","package has no [Content_Types].xml");let p=Ia(Na(de(l)),h);if(!p||!Ra.some(d=>p.startsWith(d)))throw new et("DOCX_NOT_WORDPROCESSING",`this zip is not a Word document (main part content type: ${p??"unknown"} \u2014 pptx/xlsx or unknown package)`);let f=new Map;return{parts:n,mainPart:h,relsFor(d){let C=f.get(d);if(C)return C;let m=d.lastIndexOf("/"),F=`${m>=0?d.slice(0,m+1):""}_rels/${m>=0?d.slice(m+1):d}.rels`,w=n.get(F),T=w?Xi(de(w),F):new Map;return f.set(d,T),T},resolveTarget:$i}}var ts=Le(Gn(),1),es=Le(Jn(),1);function rs(t){return t.length>=24&&t[0]===137&&t[1]===80&&t[2]===78&&t[3]===71?t.toString("latin1",12,16)!=="IHDR"?{format:"png"}:{format:"png",width:t.readUInt32BE(16),height:t.readUInt32BE(20)}:t.length>=4&&t[0]===255&&t[1]===216&&t[2]===255?{format:"jpeg",...qo(t)}:t.length>=16&&t.toString("latin1",0,4)==="RIFF"&&t.toString("latin1",8,12)==="WEBP"?{format:"webp",...zo(t)}:t.length>=4&&t.toString("latin1",0,4).startsWith("GIF8")?{format:"gif"}:t.length>=2&&t[0]===66&&t[1]===77?{format:"bmp"}:t.length>=4&&(t[0]===73&&t[1]===73&&t[2]===42&&t[3]===0||t[0]===77&&t[1]===77&&t[2]===0&&t[3]===42)?{format:"tiff"}:t.length>=44&&t.readUInt32LE(0)===1&&t.toString("latin1",40,44)===" EMF"?{format:"emf"}:t.length>=4&&(t[0]===215&&t[1]===205&&t[2]===198&&t[3]===154||t[0]===1&&t[1]===0&&t[2]===9&&t[3]===0)?{format:"wmf"}:{format:"unknown"}}function qo(t){let e=2;for(;e+9<t.length;){if(t[e]!==255)return{};let r=t[e+1];if(r===216||r>=208&&r<=215){e+=2;continue}let i=t.readUInt16BE(e+2);if(r>=192&&r<=207&&r!==196&&r!==200&&r!==204)return{height:t.readUInt16BE(e+5),width:t.readUInt16BE(e+7)};if(i<2)return{};e+=2+i}return{}}function zo(t){let e=t.toString("latin1",12,16);if(e==="VP8X"&&t.length>=30)return{width:1+t.readUIntLE(24,3),height:1+t.readUIntLE(27,3)};if(e==="VP8 "&&t.length>=30)return t[23]!==157||t[24]!==1||t[25]!==42?{}:{width:t.readUInt16LE(26)&16383,height:t.readUInt16LE(28)&16383};if(e==="VP8L"&&t.length>=25){if(t[20]!==47)return{};let r=t.readUInt32LE(21);return{width:(r&16383)+1,height:(r>>>14&16383)+1}}return{}}function is(t,e){try{if(e==="png"){let r=ts.PNG.sync.read(t);return{data:Buffer.from(r.data),width:r.width,height:r.height,channels:4}}if(e==="jpeg"){let r=es.decode(t,{useTArray:!0,maxMemoryUsageInMB:512});return{data:Buffer.from(r.data),width:r.width,height:r.height,channels:4}}return null}catch{return null}}var ss=Le(vr(),1);var qe=new Set(["http://schemas.openxmlformats.org/wordprocessingml/2006/main","http://purl.oclc.org/ooxml/wordprocessingml/main"]),Go=new Set(["http://schemas.openxmlformats.org/drawingml/2006/main","http://purl.oclc.org/ooxml/drawingml/main"]),Wo=new Set(["http://schemas.openxmlformats.org/officeDocument/2006/math","http://purl.oclc.org/ooxml/officeDocument/math"]),ns="urn:schemas-microsoft-com:vml",Pr="http://schemas.openxmlformats.org/markup-compatibility/2006",ze=class{constructor(e,r,i=n=>this.tokens.push(n)){this.partName=e;this.budget=r;this.sink=i}tokens=[];storyRefs=[];stack=[];skipUntilDepth=[];fields=[];runVanish=[];acStack=[];txbxDepths=[];drawing=null;failed=null;setSink(e){this.sink=e}fail(e){this.failed||(this.failed=e)}abort(e){throw!this.failed&&e instanceof et&&(this.failed=e),e}emit(e){this.failed||(this.drawing&&e.t==="text"&&this.txbxDepths.length>0&&(this.drawing.emittedContent=!0),this.sink(e))}suppressed(){return this.skipUntilDepth.length>0}inInstruction(){return this.fields.some(e=>!e.hasSeparate)}parent(){return this.stack.length>=2?this.stack[this.stack.length-2]:void 0}depth(){return this.stack.length}onOpen(e,r,i){if(this.failed)return;this.budget.nodesRemaining-=1,this.budget.nodesRemaining<0&&this.abort(new et("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 et("DOCX_UNREADABLE",`conversion budget exhausted (${this.partName})`)),this.stack.push({uri:e,local:r});let n=this.depth();if(n>_r&&this.abort(new et("DOCX_UNREADABLE",`XML nesting exceeds ${_r} (${this.partName})`)),this.suppressed())return;if(e===Pr&&r==="AlternateContent"){this.acStack.push({branchTaken:!1});return}if(e===Pr&&(r==="Choice"||r==="Fallback")){let a=this.acStack[this.acStack.length-1];if(!a)return;a.branchTaken?this.skipUntilDepth.push(n):a.branchTaken=!0;return}let s=qe.has(e);if((s&&r==="txbxContent"||e===ns&&r==="textbox")&&this.txbxDepths.push(n),s&&(r==="del"||r==="moveFrom"||r==="sdtPr"||r==="delText"||r==="pPrChange"||r==="rPrChange"||r==="sectPrChange"||r==="tblPrChange"||r==="trPrChange"||r==="tcPrChange")){this.skipUntilDepth.push(n);return}if(Wo.has(e)&&(r==="oMath"||r==="oMathPara")){this.emit({t:"marker",value:"[equation omitted]"}),this.skipUntilDepth.push(n);return}if(s&&r==="altChunk"){this.emit({t:"marker",value:"[embedded content omitted]"}),this.skipUntilDepth.push(n);return}if(s&&r==="tabs"){this.skipUntilDepth.push(n);return}if(s){switch(r){case"r":this.runVanish.push(!1);break;case"vanish":{let a=i.val;this.parent()?.local==="rPr"&&a!=="false"&&a!=="0"&&this.runVanish.length>0&&(this.runVanish[this.runVanish.length-1]=!0);break}case"fldChar":{let a=i.fldCharType;if(a==="begin")this.fields.push({hasSeparate:!1});else if(a==="separate"){let o=this.fields[this.fields.length-1];o&&(o.hasSeparate=!0)}else if(a==="end"){let o=this.fields.pop();o&&!o.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":i.id!==void 0&&!this.textSuppressed()&&this.emit({t:"note-ref",noteKind:"footnote",id:i.id});break;case"endnoteReference":i.id!==void 0&&!this.textSuppressed()&&this.emit({t:"note-ref",noteKind:"endnote",id:i.id});break;case"headerReference":case"footerReference":{let a=i.id;if(a){let o=i.type==="first"?"first":i.type==="even"?"even":"default";this.storyRefs.push({kind:r==="headerReference"?"header":"footer",type:o,relId:a})}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(Go.has(e)&&r==="blip"&&this.drawing&&!this.drawing.found){let a=this.relAttr(i,"embed"),o=this.relAttr(i,"link");a?(this.drawing.relId=a,this.drawing.external=!1,this.drawing.found=!0):o&&(this.drawing.relId=o,this.drawing.external=!0,this.drawing.found=!0);return}if(e===ns&&r==="imagedata"&&this.drawing&&!this.drawing.found){let a=this.relAttr(i,"id")??i.relid;a&&(this.drawing.relId=a,this.drawing.kind="vml",this.drawing.found=!0);return}}onClose(){let e=this.depth();this.skipUntilDepth[this.skipUntilDepth.length-1]===e&&this.skipUntilDepth.pop(),this.txbxDepths[this.txbxDepths.length-1]===e&&this.txbxDepths.pop();let i=this.stack.pop();if(!(!i||this.failed)&&!this.suppressed()){if(i.uri===Pr&&i.local==="AlternateContent"){this.acStack.pop();return}if(qe.has(i.uri))switch(i.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 n=this.drawing;if(this.drawing=null,!n)break;n.found?this.emit({t:"image",relId:n.relId,kind:n.kind,external:n.external}):n.emittedContent||this.emit({t:"marker",value:"[object omitted: drawing]"});break}}}}onText(e){if(this.failed||this.suppressed()||e.length===0)return;let r=this.stack[this.stack.length-1];!r||!qe.has(r.uri)||r.local==="t"&&(this.textSuppressed()||(this.budget.textCharsRemaining!==void 0&&(this.budget.textCharsRemaining-=e.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:e})))}textSuppressed(){return this.inInstruction()?!0:this.runVanish.length>0&&this.runVanish[this.runVanish.length-1]}relAttr(e,r){return e[r]}run(e){let r=new ss.SaxesParser({xmlns:!0});if(r.on("doctype",()=>{this.fail(new et("DOCX_UNREADABLE",`DOCTYPE not allowed (${this.partName})`))}),r.on("error",i=>{this.fail(new et("DOCX_UNREADABLE",`${this.partName}: ${i.message}`))}),r.on("opentag",i=>{let n={},s=Object.entries(i.attributes);s.length>zi&&this.abort(new et("DOCX_UNREADABLE",`too many attributes (${this.partName})`));for(let[a,o]of s)o.value.length>Gi&&this.abort(new et("DOCX_UNREADABLE",`oversized attribute (${this.partName})`)),n[o.local||a]=o.value;this.onOpen(i.uri??"",i.local,n)}),r.on("closetag",()=>this.onClose()),r.on("text",i=>this.onText(i)),r.write(e).close(),this.failed)throw this.failed}};function as(t,e){let r=e.budget??{nodesRemaining:Number.MAX_SAFE_INTEGER},i=new ze(e.partName,r);return i.run(t),{tokens:i.tokens,storyRefs:i.storyRefs}}var Br=class extends ze{notes=new Map;current=null;noteDepth=0;constructor(e,r){super(e,r),this.setSink(i=>this.current?.push(i))}onOpen(e,r,i){super.onOpen(e,r,i),!(!qe.has(e)||r!=="footnote"&&r!=="endnote")&&(i.type!==void 0&&i.type!=="normal"||(this.current=[],i.id!==void 0&&this.notes.set(i.id,this.current),this.noteDepth=this.depth()))}onClose(){let e=this.depth();super.onClose(),this.noteDepth===e&&(this.current=null,this.noteDepth=0)}};function os(t,e){let r=new Br(e.partName,e.budget??{nodesRemaining:Number.MAX_SAFE_INTEGER});return r.run(t),r.notes}var jo="v1",Zo="1.0.0+saxes6.0.0+fflate0.8.3+pngjs7.0.0+jpeg-js0.4.4",Qo=64,Ko=16,Jo=12e6,th=6e6,eh=5e7,rh=new Set(["http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","http://purl.oclc.org/ooxml/officeDocument/relationships/footnotes"]),ih=new Set(["http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes","http://purl.oclc.org/ooxml/officeDocument/relationships/endnotes"]),nh={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"},sh=new Set(["png","jpeg","webp"]);function ah(t){if(t==="body")return"in body";if(t.startsWith("header:"))return"in header";if(t.startsWith("footer:"))return"in footer";let e=/^(footnote|endnote):(.+)$/.exec(t);return e?`in ${e[1]} ${e[2]}`:`in ${t}`}var Xr=class{constructor(e,r){this.pkg=e;this.caps=r}inventory=[];blobs=new Map;delivered=[];n=0;deliveredBytes=0;firstRefByFp=new Map;count(){return this.n}occurrence(e,r,i){this.n+=1;let n=`i${this.n}`,s=ah(i),a=(w,T,S)=>{this.inventory.push({ref:n,loc:i,media_type:w,...S?.blob?{blob:S.blob}:{},...S?.appearance?{appearance:S.appearance}:{},delivery:T,...S?.duplicate_of?{duplicate_of:S.duplicate_of}:{}})},o=w=>`[img#${n} omitted: ${w}]`,h=e.relId!==null?this.pkg.relsFor(r).get(e.relId):void 0;if(e.external||h?.targetMode==="External")return a("application/octet-stream","external-image-not-fetched"),o("external-image-not-fetched");let l=h?this.pkg.resolveTarget(r,h.target):null,p=l!==null?this.pkg.parts.get(l):void 0;if(!p)return a("application/octet-stream","undecodable"),o("undecodable");let f=rs(p),d=nh[f.format],C=ei(p);if(this.blobs.set(C,p),!sh.has(f.format)){let w=f.format==="gif"||f.format==="bmp"||f.format==="tiff"?"unsupported-vision-media-type":"unsupported-image-kind";return a(d,w,{blob:C}),o(w)}if(f.width===void 0||f.height===void 0||f.width*f.height>this.caps.maxPixels)return a(d,"undecodable",{blob:C}),o("undecodable");let m;if(f.format==="png"||f.format==="jpeg"){let w=is(p,f.format);if(w===null)return a(d,"undecodable",{blob:C}),o("undecodable");m=ri(w.data,{width:w.width,height:w.height,channels:w.channels})}if(f.width<this.caps.dimensionFloor||f.height<this.caps.dimensionFloor)return a(d,"below-dimension-floor",{blob:C,appearance:m}),o("below-dimension-floor");let F=this.firstRefByFp.get(C);return F!==void 0?(a(d,"duplicate",{blob:C,appearance:m,duplicate_of:F}),`[img#${n}: image ${s} \u2014 same as img#${F}; cite img#${F}]`):p.byteLength>this.caps.imageMaxBytes?(a(d,"image-too-large",{blob:C,appearance:m}),o("image-too-large")):this.deliveredBytes+p.byteLength>this.caps.visionByteBudget?(a(d,"vision-byte-budget-reached",{blob:C,appearance:m}),o("vision-byte-budget-reached")):this.delivered.length>=this.caps.imageCap?(a(d,"image-cap-reached",{blob:C,appearance:m}),o("image-cap-reached")):(this.firstRefByFp.set(C,n),this.deliveredBytes+=p.byteLength,this.delivered.push(n),a(d,"selected",{blob:C,appearance:m}),`[img#${n}: image ${s}]`)}};function Ur(t,e){let r=[];for(let i of t)switch(i.t){case"text":r.push(i.value);break;case"tab":r.push(" ");break;case"break":r.push(`
|
|
11
|
-
`);break;case"para-end":r.push(`
|
|
12
|
-
`);break;case"table-cell-end":r[r.length-1]===`
|
|
13
|
-
`&&r.pop(),r.push(" ");break;case"table-row-end":r[r.length-1]===" "&&r.pop(),r.push(`
|
|
14
|
-
`);break;case"marker":r.push(i.value);break;case"note-ref":r.push(`[${i.noteKind} ${i.id}]`);break;case"image":{let n=e(i);n!==null&&r.push(n);break}}return r.join("")}function Hr(t){let e=0;for(let r of t)r.t==="text"&&(e+=r.value.length);return e}function hs(t,e,r){let i=t.parts.get(e);if(!i)throw new et("DOCX_UNREADABLE",`referenced part missing: ${e}`);return as(de(i),{partName:e,budget:r})}async function Zh(t,e){let r=Date.now()+(e?.budgetMs??Wi),i=m=>{if(Date.now()>r)throw new et("DOCX_UNREADABLE",`conversion budget exhausted (${m})`)},n=Zi(t),s={nodesRemaining:qi,textCharsRemaining:2*4e5,deadline:r},a={dimensionFloor:e?.caps?.dimensionFloor??Qo,imageCap:e?.caps?.imageCap??Ko,visionByteBudget:e?.caps?.visionByteBudget??Jo,imageMaxBytes:e?.caps?.imageMaxBytes??th,maxPixels:e?.caps?.maxPixels??eh},o=new Xr(n,a),h=hs(n,n.mainPart,s);i(n.mainPart);let l=Hr(h.tokens),p=[Ur(h.tokens,m=>o.occurrence(m,n.mainPart,"body"))],f=n.relsFor(n.mainPart),d=new Set;for(let m of["header","footer"])for(let F of h.storyRefs.filter(w=>w.kind===m)){let w=f.get(F.relId);if(!w||w.targetMode!=="Internal")continue;let T=n.resolveTarget(n.mainPart,w.target);if(T===null||!n.parts.has(T)||d.has(T))continue;d.add(T);let S=hs(n,T,s);i(T),l+=Hr(S.tokens);let g=F.type==="default"?`[${m}]`:`[${m} ${F.type}]`;p.push(`${g}
|
|
15
|
-
${Ur(S.tokens,y=>o.occurrence(y,T,`${m}:${T}`))}`)}for(let[m,F]of[["footnote",rh],["endnote",ih]]){let w=[];for(let g of h.tokens)g.t==="note-ref"&&g.noteKind===m&&!w.includes(g.id)&&w.push(g.id);if(w.length===0)continue;let T=null;for(let g of f.values())if(F.has(g.type)&&g.targetMode==="Internal"){T=n.resolveTarget(n.mainPart,g.target);break}if(T===null||!n.parts.has(T))continue;let S=os(de(n.parts.get(T)),{partName:T,budget:s});i(T);for(let g of w){let y=S.get(g);if(!y)continue;l+=Hr(y);let x=T;p.push(`[${m} ${g}]
|
|
16
|
-
${Ur(y,z=>o.occurrence(z,x,`${m}:${g}`))}`)}}if(l===0&&o.count()===0)throw new et("DOCX_NO_TEXT","no extractable text or images \u2014 nothing citable in this document");let C=p.join("");return C.endsWith(`
|
|
17
|
-
`)||(C+=`
|
|
18
|
-
`),{projection:C,inventory:o.inventory,blobs:o.blobs,delivered:o.delivered,converter:{name:"ooxml-walk",version:Zo,policy:jo}}}export{rs as a,is as b,jo as c,Zo as d,Qo as e,Ko as f,Jo as g,th as h,eh as i,Ur as j,Zh as k};
|
|
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
|
-
*/
|
package/dist/chunk-FPFOW6BS.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-WAOCHXJ5.js";import{a as c}from"./chunk-NLCCBXXV.js";import{a as o}from"./chunk-RZ4F3BHX.js";var u=class{constructor(e,r,t,s){this.controllerBaseUrl=e;this.getOAuthToken=r;this.directBasicAuth=t;this.log=s}_cached=null;_revoked=!1;_lastError=null;revoke(){this._revoked=!0,this._cached=null}prime(e){this._revoked||(this._cached=e)}get revoked(){return this._revoked}get cached(){return this._cached}get lastError(){return this._lastError}async resolve(e=!1){if(this._cached&&!e)return this._cached;try{let r;if(this.directBasicAuth)r=new a(this.controllerBaseUrl,{username:this.directBasicAuth.username,accessKey:this.directBasicAuth.access_key});else{let s=await this.getOAuthToken();if(!s)return null;r=new a(this.controllerBaseUrl,s)}let t=await r.getTmsCredentials();return this.directBasicAuth&&!t.access_key&&(t.access_key=this.directBasicAuth.access_key),this._cached=t,this._lastError=null,this.log?.("info","AUTH_RESOLVE_OK","Auth resolved",{username:t.username,org_id:t.org_id,user_id:t.user_id}),t}catch(r){return this._lastError=r instanceof Error?r:new Error(String(r)),this.log?.("warn","AUTH_RESOLVE_FAILED","Auth resolve failed",{error:this._lastError.message}),null}}async fetch(e,r={}){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");let t=await this.resolve();if(!t)throw new Error("Not authenticated \u2014 no credentials resolved");let s=i=>({...r,headers:{...r.headers,Authorization:c(i.username,i.access_key)}}),l=await o(e,s(t));if(l.status===401){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");this.log?.("warn","AUTH_RESOLVE_401","Got 401, re-resolving",{url:e});let i=await this.resolve(!0);if(!i)throw new Error("Re-authentication failed after 401");return o(e,s(i))}return l}};function f(n){if(!n)return"network";let e=/failed:\s*(\d{3})\b/.exec(n.message)?.[1];return e==="401"||e==="403"?"auth":e?"server":"network"}export{u as a,f as b};
|
package/dist/chunk-GVIPTX6T.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{existsSync as f,fsyncSync as G,mkdirSync as X,readFileSync as l,readdirSync as P,renameSync as w,rmSync as _,writeFileSync as C,openSync as K,closeSync as q}from"fs";import{randomBytes as z}from"crypto";import{join as O}from"path";var d=class extends Error{constructor(t,i){super(`${t}: ${i}`);this.code=t}},F=1440*60*1e3,H=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,E=n=>O(n,"sessions"),h=(n,e)=>O(E(n),e),g=(n,e)=>O(h(n,e),"state.json"),m=(n,e)=>O(h(n,e),".lock"),v=n=>(n?.now??(()=>new Date))();function M(n){if(!Number.isInteger(n)||n<=0)return!1;try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}function N(n,e){let t=`${n}.tmp-${process.pid}`,i=K(t,"w");try{C(i,e,{mode:384}),G(i)}finally{q(i)}w(t,n)}function b(n,e,t,i=0){if(i>20)throw new d("SESSION_LOCKED",`${e}: lock contention did not settle`);let o=m(n,e),s=z(8).toString("hex"),c=JSON.stringify({pid:process.pid,ts:t.toISOString(),nonce:s})+`
|
|
3
|
-
`;try{let r=K(o,"wx",384);return C(r,c),q(r),s}catch(r){if(r.code!=="EEXIST")throw r;let u=!1,p;try{let a=JSON.parse(l(o,"utf8")),y=t.getTime()-new Date(a.ts).getTime();u=!M(a.pid)||y>=F,p=a.nonce}catch{u=!0}if(!u)throw new d("SESSION_LOCKED",`${e} is held by another live process`);let S=`${o}.break-${s}`;try{w(o,S);let a;try{a=JSON.parse(l(S,"utf8"))}catch{a=null}if(a===null||a.nonce===p)_(S,{force:!0});else try{w(S,o)}catch{_(S,{force:!0})}}catch(a){if(a.code!=="ENOENT")throw a}return b(n,e,t,i+1)}}function j(n,e,t,i,o){let s=()=>{try{if(JSON.parse(l(m(n,e),"utf8")).nonce!==i)throw new d("SESSION_LOCK_LOST",`${e} lock was taken over`)}catch(r){throw r instanceof d?r:new d("SESSION_LOCK_LOST",`${e} lock file unreadable/gone`)}},c=()=>N(g(n,e),JSON.stringify(t)+`
|
|
4
|
-
`);return{get state(){return t},isApplied:r=>t.applied_events.includes(r),markApplied(r){s(),t={...t,applied_events:[...new Set([...t.applied_events,...r])].sort()},c()},reconcileSave(r){s(),t={...t,applied_events:[...new Set([...t.applied_events,...r.appliedEvents])].sort(),held_receipts:r.heldReceipts,pending:r.pending},c()},save(r){s();let{agent_state:u,pending:p,assumed:S,read_basis:a,corpus_cursor:y,expires_at:I,force:k,conv_source:x,held_receipts:T,force_scope:D,user_session_id:J,checkpoint:L,target_pins:$,ingest_registry:R,ingest_schedule:A}=r;t={...t,...u!==void 0?{agent_state:u}:{},...p!==void 0?{pending:p}:{},...S!==void 0?{assumed:S}:{},...a!==void 0?{read_basis:a}:{},...y!==void 0?{corpus_cursor:y}:{},...I!==void 0?{expires_at:I}:{},...k!==void 0?{force:k}:{},...x!==void 0?{conv_source:x}:{},...T!==void 0?{held_receipts:T}:{},...D!==void 0?{force_scope:D}:{},...J!==void 0?{user_session_id:J}:{},...L!==void 0?{checkpoint:L}:{},...$!==void 0?{target_pins:$}:{},...R!==void 0?{ingest_registry:R}:{},...A!==void 0?{ingest_schedule:A}:{}},c()},complete(){s(),_(h(n,e),{recursive:!0,force:!0})},release(){try{s(),_(m(n,e),{force:!0})}catch(r){if(r instanceof d||r.code==="ENOENT")return;throw r}}}}function U(n,e,t){if(!H.test(e.sid))throw new d("SESSION_MISSING",`bad sid ${JSON.stringify(e.sid)}`);let i=v(t);if(f(g(n,e.sid)))throw new d("SESSION_LOCKED",`${e.sid} already exists \u2014 resume it`);X(h(n,e.sid),{recursive:!0,mode:448});let o=b(n,e.sid,i),s={schema:1,applied_events:[],...e};return N(g(n,e.sid),JSON.stringify(s)+`
|
|
5
|
-
`),j(n,e.sid,s,o,t)}function V(n,e,t){if(!H.test(e)||!f(g(n,e)))throw new d("SESSION_MISSING",`no session ${e}`);let i=v(t),o=b(n,e,i),s=JSON.parse(l(g(n,e),"utf8"));if(new Date(s.expires_at).getTime()<=i.getTime())throw _(m(n,e),{force:!0}),new d("SESSION_EXPIRED",`${e} expired at ${s.expires_at}`);let c={...s,expires_at:new Date(i.getTime()+F).toISOString()};return N(g(n,e),JSON.stringify(c)+`
|
|
6
|
-
`),j(n,e,c,o,t)}function W(n,e){let t=g(n,e);return f(t)?JSON.parse(l(t,"utf8")):null}function Y(n){let e=E(n);if(!f(e))return[];let t=[];for(let i of P(e)){let o=g(n,i);if(f(o))try{let s=JSON.parse(l(o,"utf8"));t.push({sid:s.sid,mode:s.mode,created_at:s.created_at,expires_at:s.expires_at,pendingCount:s.pending.questions.length+s.pending.proposals.length,verb:s.verb,use_case:s.use_case})}catch{t.push({sid:i,mode:"?",created_at:"",expires_at:"",pendingCount:0,corrupt:!0})}}return t.sort((i,o)=>i.created_at<o.created_at?-1:1)}function ee(n,e){let t=v(e),i=[],o=[],s=E(n);if(!f(s))return{removed:i,skipped:o};for(let c of P(s)){if(e?.sid&&c!==e.sid)continue;let r=!1,u=!1;try{let p=JSON.parse(l(g(n,c),"utf8"));r=new Date(p.expires_at).getTime()<=t.getTime()}catch{u=!0}if(e?.sid||e?.all||r||u&&e?.all){try{let p=JSON.parse(l(m(n,c),"utf8"));if(M(p.pid)&&p.pid!==process.pid){o.push({sid:c,reason:`in use by live pid ${p.pid}`});continue}}catch{}_(h(n,c),{recursive:!0,force:!0}),i.push(c)}}return{removed:i,skipped:o}}export{d as a,U as b,V as c,W as d,Y as e,ee as f};
|
package/dist/chunk-GW5DWAXY.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as L,b as R}from"./chunk-T63R6QT4.js";import{v as I}from"./chunk-3STZLM5J.js";import{a as N}from"./chunk-M7WQM4UA.js";import{e as G,g as S}from"./chunk-5YPBPZUR.js";import{existsSync as P,readFileSync as D}from"fs";function z(d){let s=R(d),g=new Map(Object.entries(s.heads)),l=new Map(Object.entries(s.trust)),a=new Map(Object.entries(s.nodeLabel)),i=new Map(Object.entries(s.superseded)),f=new Map(Object.entries(s.names)),q=new Map(Object.entries(s.archivedReason)),T=new Set(s.appliedEvents),O=new Map(Object.entries(s.conv)),k=e=>s.media[e]??{format:"text",media_type:"text/plain",anchors_supported:["L-L"]},m=new Map;for(let[e,t]of f)m.set(t,e);let h=new Map,x=e=>{if(h.has(e))return h.get(e);if(!a.has(e))return h.set(e,null),null;let t=L(d,e);if(!P(t))throw new N(`derived node file missing for ${e} \u2014 run kane-cli context rebuild`);let n=JSON.parse(D(t,"utf8"));return h.set(e,n),n},b=e=>{let t=e,n=new Set;for(;i.has(t)&&!n.has(t);){n.add(t);let r=i.get(t);if(typeof r!="string")break;t=r}return t},w=null,H=e=>{let t=m.get(e);if(t!==void 0)return t;if(w===null){w=new Map;for(let[c,o]of i)typeof o=="string"&&w.set(o,c)}let n=new Set,r=e;for(;!n.has(r);){n.add(r);let c=w.get(r);if(c===void 0)return null;let o=m.get(c);if(o!==void 0)return o;r=c}return null},C=e=>{I.test(e)&&(e=e.toLowerCase());let t=g.get(e),n=a.has(e)?e:f.get(e)??(typeof t=="string"?t:void 0);if(n===void 0||!a.has(n))return null;let r=b(n);return{cid:n,tip:r,superseded:i.has(n)||i.has(r)}},M=new Map;for(let e of Object.values(s.forward))for(let t of e){let n=M.get(t.dst);n?n.push(t):M.set(t.dst,[t])}let v=e=>(e??[]).filter(t=>!i.has(t.ecid)),E=e=>v(M.get(e)),y=e=>E(e).filter(t=>t.type===G.DERIVES),_=e=>v(s.forward[e]).some(t=>S(t.type)?.pin?.comparesTo==="dst_tip"&&i.has(t.dst)),j=e=>{if(i.has(e))return"superseded";let t=y(e);if(t.length===0)return _(e)?"stale":"fresh";let n=new Map;for(let o of t)n.set(o.props.source_id,o);let r=!1,c=!1;for(let[o,p]of n){let u=g.get(o);if(u!=null&&(r=!0,u!==p.props.source_cid)){let F=O.get(o)?.chain;(!F||!F.includes(p.props.source_cid))&&(c=!0)}}return r?c||_(e)?"stale":"fresh":"orphaned"};return{heads:g,trust:l,nodeLabel:a,superseded:i,names:f,nameOf:m,archivedReason:q,appliedEvents:T,convChains:O,mediaOf:k,extractedSourceCids:new Set(s.extracted),extractionCompleteness:new Map(Object.entries(s.completeness??{}).map(([e,{seq:t,...n}])=>[e,n])),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:e=>a.has(e),getNode:x,byLabel:e=>[...a.entries()].filter(([,t])=>t===e).map(([t])=>({cid:t,content:x(t)?.content??{}})),edgesFrom:e=>v(s.forward[e]),edgesInto:E,derivesInto:y,resolve:C,tipOf:b,displayNameOf:H,stale:j,staleList:()=>[...a.keys()].map(e=>({cid:e,state:j(e)})).filter(e=>e.state!=="fresh"),execHistory:e=>{let t=C(e);if(!t)return[];let n=b(t.cid),r=new Set([n]),c=!0;for(;c;){c=!1;for(let[p,u]of i)u!==null&&r.has(u)&&!r.has(p)&&(r.add(p),c=!0)}let o=[];for(let p of Object.entries(s.exec??{}))r.has(p[0])&&o.push(...p[1]);return o.sort((p,u)=>p.started_at<u.started_at?-1:1)}}}function B(d,s){if(d.stale(s)!=="stale")return!1;let g=new Map;for(let l of d.derivesInto(s))g.set(l.props.source_id,l);for(let[l,a]of g){let i=d.heads.get(l);if(i==null||i===a.props.source_cid)continue;let f=d.convChains.get(l)?.chain;if(!f||!f.includes(a.props.source_cid))return!0}for(let l of d.edgesFrom(s)){if(S(l.type)?.pin?.comparesTo!=="dst_tip"||!d.superseded.has(l.dst))continue;let a=d.tipOf(l.dst);if(d.superseded.has(a)||d.nodeLabel.get(a)==="usecase")return!0}return!1}export{z as a,B as b};
|