@visulima/vis 4.3.1 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +598 -0
- package/LICENSE.md +151 -88
- package/README.md +2 -2
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +42 -19
- package/dist/packem_chunks/CONFIG_FILES.js +4 -4
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +61 -51
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +202 -176
- package/dist/packem_chunks/dart-plan.js +1 -1
- package/dist/packem_chunks/dart-projects.js +1 -1
- package/dist/packem_chunks/dispatch.js +1 -1
- package/dist/packem_chunks/doctor-probe.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +4 -4
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +2 -2
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler26.js +5 -5
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler39.js +6 -6
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +2 -2
- package/dist/packem_chunks/handler51.js +1 -1
- package/dist/packem_chunks/handler53.js +1 -1
- package/dist/packem_chunks/handler54.js +1 -1
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler58.js +1 -1
- package/dist/packem_chunks/handler59.js +1 -1
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler60.js +7 -7
- package/dist/packem_chunks/handler61.js +2 -2
- package/dist/packem_chunks/handler62.js +10 -10
- package/dist/packem_chunks/handler63.js +1 -1
- package/dist/packem_chunks/handler64.js +6 -3
- package/dist/packem_chunks/handler65.js +8 -6
- package/dist/packem_chunks/handler66.js +2 -2
- package/dist/packem_chunks/handler67.js +31 -20
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +22 -153
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +9 -9
- package/dist/packem_chunks/handler71.js +153 -22
- package/dist/packem_chunks/handler72.js +1 -1
- package/dist/packem_chunks/handler73.js +1 -1
- package/dist/packem_chunks/handler74.js +1 -1
- package/dist/packem_chunks/handler75.js +35 -35
- package/dist/packem_chunks/handler76.js +1 -1
- package/dist/packem_chunks/handler77.js +3 -3
- package/dist/packem_chunks/handler78.js +69 -67
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +40 -7
- package/dist/packem_chunks/index2.js +32 -32
- package/dist/packem_chunks/index6.js +1 -1
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +3 -4
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/orchestrator.js +1 -1
- package/dist/packem_chunks/prompts.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tar.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/ts-loader.js +5 -5
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/{affected-selection-D4giBK2X.js → affected-selection-DDxwjwM4.js} +1 -1
- package/dist/packem_shared/affected-shas-BuaWvmsG.js +1 -0
- package/dist/packem_shared/{ai-fix-BC6aIRJT.js → ai-fix-C2BhFFhi.js} +5 -5
- package/dist/packem_shared/{augment-B9kSZuvW.js → augment-CxUPE8KX.js} +1 -1
- package/dist/packem_shared/{bin-C1XKj-O-.js → bin-Be7_QhQK.js} +1 -1
- package/dist/packem_shared/{build-scripts-CEDx_nJp.js → build-scripts-DxyVSkgM.js} +1 -1
- package/dist/packem_shared/command-runtime-BXvH5EC0.js +1 -0
- package/dist/packem_shared/{dart-pubspec-BK_cK2EP.js → dart-pubspec-DvmyleIr.js} +2 -2
- package/dist/packem_shared/{dependency-scan-B8jroa1D.js → dependency-scan-DKK3ZEZI.js} +1 -1
- package/dist/packem_shared/{docker-DXqV-07f.js → docker-BTuwdXaC.js} +1 -1
- package/dist/packem_shared/{ecosystem-gate-ddru_hOg.js → ecosystem-gate-BpQNUJzN.js} +1 -1
- package/dist/packem_shared/env-consistency-CUBJHENL.js +1 -0
- package/dist/packem_shared/{failure-log-D2x5BT8S.js → failure-log-kp0n2rbD.js} +1 -1
- package/dist/packem_shared/{formatBytes-BHAzNIrn-CrusHOew.js → formatBytes-BHAzNIrn-DRcKvqnb.js} +1 -1
- package/dist/packem_shared/git-source-DExWbfN0.js +2 -0
- package/dist/packem_shared/{index-BzhrR_iC.js → index-BdMIfGVZ.js} +15 -15
- package/dist/packem_shared/index-C9ENZqH9.js +39 -0
- package/dist/packem_shared/{index-Chje3u9v.js → index-DQfNpt2u.js} +1 -1
- package/dist/packem_shared/{index-DQ2GJzmy.js → index-DsSWb5XH.js} +1 -1
- package/dist/packem_shared/{index.server-sXNQYpsl.js → index.server-D8BLnYZO.js} +2 -2
- package/dist/packem_shared/{isAccessibleSync-DYKTrrvc-C-_5cgwu.js → isAccessibleSync-DYKTrrvc-BwaMhQs0.js} +1 -1
- package/dist/packem_shared/{lifecycle-D6PMPor-.js → lifecycle-BAhkhE2L.js} +1 -1
- package/dist/packem_shared/{lockfile-CiUtEbnt.js → lockfile-DHmlPGk1.js} +1 -1
- package/dist/packem_shared/{manifests-Du4yKlf_.js → manifests-Dd4Hoztt.js} +1 -1
- package/dist/packem_shared/{min-release-age-JViyQuBM.js → min-release-age-BJnOQaoF.js} +1 -1
- package/dist/packem_shared/{missing-package-json-Cu5YVAot.js → missing-package-json-DfzrGwe1.js} +1 -1
- package/dist/packem_shared/{multi-eco-lockfiles-B2X3yhyo.js → multi-eco-lockfiles-BIa6xvJc.js} +1 -1
- package/dist/packem_shared/{native-config-sync-TdTWjVgI.js → native-config-sync-Dr9XvxOf.js} +1 -1
- package/dist/packem_shared/osv-bloom-t40ra5U5.js +2 -0
- package/dist/packem_shared/{package-version-Dxirp-UO.js → package-version-CFuNUWDG.js} +2 -2
- package/dist/packem_shared/{packument-BQv4je9m.js → packument-C9nRiBJf.js} +1 -1
- package/dist/packem_shared/pm-runner-ImwtpnWY.js +1 -0
- package/dist/packem_shared/{project-name-filter-D6tXD8gd.js → project-name-filter-C2rkW-Vn.js} +1 -1
- package/dist/packem_shared/{provenance-DNyVMxNv.js → provenance-DF-ypZj3.js} +1 -1
- package/dist/packem_shared/{readJsonSync-CbryXYxN-EWl7_7KX.js → readJsonSync-CbryXYxN-Bm5i10UW.js} +1 -1
- package/dist/packem_shared/{registry-keys-DwB3ZXS_.js → registry-keys-BLuHOyZu.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-BPsdmuty.js → resolve-explicit-BDaQRR6o.js} +1 -1
- package/dist/packem_shared/resolve-runtime-Cr19Pk6L.js +1 -0
- package/dist/packem_shared/{run-file-UBukWaha.js → run-file-XbRCF6Mp.js} +1 -1
- package/dist/packem_shared/{runtime-check-1U8HrQd9.js → runtime-check-Bh5q9IrT.js} +1 -1
- package/dist/packem_shared/{s1ngularity-QD2LD1sO.js → s1ngularity-UCZN7skW.js} +1 -1
- package/dist/packem_shared/{scan-progress-CkumcBG-.js → scan-progress-DcYI76zE.js} +1 -1
- package/dist/packem_shared/{selectors-edwcgNl3.js → selectors-DCiEU0iv.js} +2 -2
- package/dist/packem_shared/{signatures-t8LbOaqr.js → signatures-CicxPHN4.js} +1 -1
- package/dist/packem_shared/target-merge-BClIXg2k.js +14 -0
- package/dist/packem_shared/{target-options-DsHFmRZH.js → target-options-PgWIuJnb.js} +1 -1
- package/dist/packem_shared/task-env-Dl08aklA.js +2 -0
- package/dist/packem_shared/toolchain-DvUxlbDz.js +5 -0
- package/dist/packem_shared/{typosquats-8u0drCqQ.js → typosquats-DxPzyK7u.js} +1 -1
- package/dist/packem_shared/{verify-B_MblU_Q.js → verify-CadR9PUk.js} +1 -1
- package/dist/packem_shared/{vis-update-app-BCIccZfA.js → vis-update-app-DrFWQyPn.js} +1 -1
- package/dist/packem_shared/{vis-user-error-75VtCwMv.js → vis-user-error-k7CLTpA4.js} +15 -15
- package/dist/packem_shared/{watch-CcTketln.js → watch-Dr_6yz3o.js} +1 -1
- package/dist/packem_shared/watch-loop-BId9vT7Q.js +11 -0
- package/dist/packem_shared/{writeFileSync-DJoHk3Ks-BPRoepNw.js → writeFileSync-DJoHk3Ks-Dhem3Uof.js} +1 -1
- package/dist/release/core/version-actions/index.d.ts +1 -1
- package/dist/release/presets.d.ts +1 -55
- package/dist/release/presets.js +1 -1
- package/dist/release/types.d.ts +1 -18
- package/dist/runtime/preload.js +1 -1
- package/index.d.ts +204 -204
- package/index.js +52 -52
- package/package.json +10 -10
- package/schemas/project.schema.json +44 -1
- package/schemas/vis-config.schema.json +128 -35
- package/schemas/vis-release-config.schema.json +1 -12
- package/skills/vis/SKILL.md +24 -12
- package/dist/packem_shared/Table-BB8xHTU5-BLPS917D.js +0 -11
- package/dist/packem_shared/affected-shas-B2V84O0g.js +0 -1
- package/dist/packem_shared/command-runtime-p4IXiIf6.js +0 -1
- package/dist/packem_shared/giget-D8Kwb0kD.js +0 -2
- package/dist/packem_shared/index-BisalDCf.js +0 -39
- package/dist/packem_shared/osv-bloom-BCAX5ARR.js +0 -2
- package/dist/packem_shared/pm-runner-CMSml1Bj.js +0 -1
- package/dist/packem_shared/resolve-runtime-CNiHcVtx.js +0 -1
- package/dist/packem_shared/target-merge-DVJl-7Qz.js +0 -4
- package/dist/packem_shared/toolchain-BRdpaAC4.js +0 -5
- package/dist/packem_shared/watch-loop-qRn0IHPG.js +0 -11
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{createRequire as Zt}from"node:module";let Qt;const Xt=t=>(Qt??=Zt(import.meta.url))(t),D=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ti=t=>{if(typeof D<"u"&&D.versions&&D.versions.node){const[i,e]=D.versions.node.split(".").map(Number);if(i>22||i===22&&e>=3||i===20&&e>=16)return D.getBuiltinModule(t)}return Xt(t)},{createRequire:ii}=ti("node:module");let ei;const oi=t=>(ei??=ii(import.meta.url))(t),P=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:J,pt=t=>{if(typeof P<"u"&&P.versions&&P.versions.node){const[i,e]=P.versions.node.split(".").map(Number);if(i>22||i===22&&e>=3||i===20&&e>=16)return P.getBuiltinModule(t)}return oi(t)},J=P,{execFileSync:ri}=pt("node:child_process"),Y=pt("node:fs"),si=pt("node:tty"),ni=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],hi=12288,ai=65510,ci=[12288,12288,65281,65376,65504,65510],li=8361,di=65518,ui=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],fi=32,mi=10630,wi=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],pi=4352,gi=262141,Tt=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],U=(t,i)=>{let e=0,o=Math.floor(t.length/2)-1;for(;e<=o;){const h=Math.floor((e+o)/2),n=h*2;if(i<t[n])o=h-1;else if(i>t[n+1])e=h+1;else return!0}return!1},bt=19968,[bi,xi]=yi(Tt);function yi(t){let i=t[0],e=t[1];for(let o=0;o<t.length;o+=2){const h=t[o],n=t[o+1];if(bt>=h&&bt<=n)return[h,n];n-h>e-i&&(i=h,e=n)}return[i,e]}const Wi=t=>t<161||t>1114109?!1:U(ni,t),Bi=t=>t<hi||t>ai?!1:U(ci,t),vi=t=>t<li||t>di?!1:U(ui,t),Ri=t=>t<fi||t>mi?!1:U(wi,t),Si=t=>t>=bi&&t<=xi?!0:t<pi||t>gi?!1:U(Tt,t);function Ai(t){return Wi(t)?"ambiguous":Bi(t)?"fullwidth":vi(t)?"halfwidth":Ri(t)?"narrow":Si(t)?"wide":"neutral"}function Ci(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function Ot(t){return Ci(t),Ai(t)}const $t=String.raw,xt=$t`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Ii=()=>new RegExp($t`\p{RI}{2}|(?)${xt}(?:\u200D${xt})*`,"gu"),q=new Set(["\x1B",""]),lt="\x07",_t="[",gt="m",K="]8;;",Mi=39,Ei=/[\u200B\uFEFF\u2060-\u2064]/g,ki=new RegExp(`(?:\\${_t}(?<code>\\d+)m|\\${K}(?<uri>.*)${lt})`),ji=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),ht=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,yt=/\u001B\[[\d;]*m[^\u001B]*(?:\u001B\[[\d;]*m|$)/g,Wt=/\u001B\]8;[^\u0007\u001B]*(?:\u0007|\u001B\\)[^\u001B]*\u001B\]8;;(?:\u0007|\u001B\\)/g,Z=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,Ni=Ii(),Bt=new Map,Li=t=>[t.ambiguousIsNarrow?1:0,t.control,t.fullWidth,t.regular,t.wide].join("|"),Fi=t=>{const i=Li(t.width);let e=Bt.get(i);return e||(e=new Map,Bt.set(i,e)),e},Q=new RegExp(ht.source,"y"),dt=new RegExp(Ni.source,"uy"),X=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,Ht=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",Ji=(t,i)=>{const e=Fi(i),o=Math.floor(t/65536),h=t%65536;let n=e.get(o);if(n||(n=new Map,e.set(o,n)),n.has(h))return n.get(h);let r;switch(Ht(t)){case"control":{r=i.width.control;break}case"latin":{r=i.width.regular;break}case"wide":{r=i.width.wide;break}case"zero":{r=0;break}default:switch(Ot(t)){case"ambiguous":{r=i.width.ambiguousIsNarrow?i.width.regular:i.width.wide;break}case"fullwidth":{r=i.width.fullWidth;break}case"wide":{r=i.width.wide;break}default:r=i.width.regular}}return n.set(h,r),r},Ti=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,V=(t,i={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const e={truncation:{countAnsiEscapeCodes:i.countAnsiEscapeCodes??!1,ellipsis:i.ellipsis??"",ellipsisWidth:i.ellipsisWidth??(i.ellipsis?V(i.ellipsis,{...i,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:i.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:i.ambiguousIsNarrow??!1,ansi:i.ansiWidth??0,control:i.controlWidth??0,emoji:i.emojiWidth??2,fullWidth:i.fullWidth??2,halfWidth:i.halfWidth??1,regular:i.regularWidth??1,tab:i.tabWidth??8,wide:i.wideWidth??2}},o=Math.max(0,e.truncation.limit-e.truncation.ellipsisWidth),{length:h}=t,n=h>1e4;let r=0,s=0,a=h,c=!1;const l=t.includes("\x1B")||t.includes("");for(;r<h;){if(l&&(t[r]==="\x1B"||t[r]==="")){if(t.startsWith("\x1B]8;;",r)){const g="\x1B]8;;\x07",f=g.length,b=t.indexOf("\x07",r+5);if(b!==-1){const W=t.indexOf(g,b+1);if(W!==-1){const x=W+f,y=t.slice(b+1,W).replace(ht,""),R=V(y,{ambiguousIsNarrow:e.width.ambiguousIsNarrow,ansiWidth:e.width.ansi,controlWidth:e.width.control,countAnsiEscapeCodes:!1,ellipsis:e.truncation.ellipsis,ellipsisWidth:e.truncation.ellipsisWidth,emojiWidth:e.width.emoji,fullWidth:e.width.fullWidth,halfWidth:e.width.halfWidth,limit:Math.max(0,o-s),regularWidth:e.width.regular,tabWidth:e.width.tab,wideWidth:e.width.wide}),A=R.width;if(R.truncated)c=!0,a=Math.min(a,r);else if(s+A>o&&(a=Math.min(a,r),c=!0,s+A>e.truncation.limit))break;if(s+=A,r=x,c&&s>=e.truncation.limit)break;continue}}}if(Q.lastIndex=r,Q.test(t)){const g=Q.lastIndex-r,f=e.truncation.countAnsiEscapeCodes?g:e.width.ansi;if(s+f>o&&(a=Math.min(a,r),s+f>e.truncation.limit)){c=!0;break}s+=f,r=Q.lastIndex;continue}}const u=t.codePointAt(r);if(u===8203||u===65279||u>=8288&&u<=8292){r+=1;continue}if(u===9){if(s+e.width.tab>o&&(a=Math.min(a,r),s+e.width.tab>e.truncation.limit)){c=!0;break}s+=e.width.tab,r+=1;continue}if(X.lastIndex=r,X.test(t)){const g=(X.lastIndex-r)*e.width.regular;if(s+g>o){const f=e.width.regular>0?Math.floor((o-s)/e.width.regular):0;if(a=Math.min(a,r+f),s+g>e.truncation.limit){c=!0;break}}s+=g,r=X.lastIndex;continue}if((u<=31||u>=127&&u<=159)&&(Z.lastIndex=r,Z.test(t))){const g=(Z.lastIndex-r)*e.width.control;if(s+g>o){const f=e.width.control>0?Math.floor((o-s)/e.width.control):0;if(a=Math.min(a,r+f),s+g>e.truncation.limit){c=!0;break}}s+=g,r=Z.lastIndex;continue}if(dt.lastIndex=r,dt.test(t)){if(s+e.width.emoji>o&&(a=Math.min(a,r),s+e.width.emoji>e.truncation.limit)){c=!0;break}s+=e.width.emoji,r=dt.lastIndex;continue}const w=t.codePointAt(r)??0;if(Ti(w)){r+=w>65535?2:1;continue}let p;if(n)p=Ji(w,e);else switch(Ht(w)){case"control":{p=e.width.control;break}case"latin":{p=e.width.regular;break}case"wide":{p=e.width.wide;break}case"zero":{p=0;break}default:switch(Ot(w)){case"ambiguous":{p=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{p=e.width.fullWidth;break}case"wide":{p=e.width.wide;break}default:p=e.width.regular}}if(s+p>o&&(a=Math.min(a,r),s+p>e.truncation.limit)){c=!0;break}s+=p,r+=w>65535?2:1}let d=s,m=!1;return c&&e.truncation.limit>=e.truncation.ellipsisWidth&&(d=e.truncation.limit,m=!0),{ellipsed:m,index:c?a:h,truncated:c,width:d}},M=(t,i={})=>V(t,{...i,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width;class Oi{capacity;cache;constructor(i){this.capacity=i,this.cache=new Map}get(i){if(!this.cache.has(i))return;const e=this.cache.get(i);return this.cache.delete(i),this.cache.set(i,e),e}has(i){return this.cache.has(i)}set(i,e){if(this.cache.has(i))this.cache.delete(i);else if(this.cache.size>=this.capacity){const o=this.cache.keys().next().value;o!==void 0&&this.cache.delete(o)}this.cache.set(i,e)}delete(i){this.cache.delete(i)}clear(){this.cache.clear()}size(){return this.cache.size}}const vt=new Oi(100),$i=new Intl.Segmenter("en",{granularity:"grapheme"}),_i=/^[\u0000-\u007F]*$/,Hi=new Set(["0","22","23","24","27","28","29","39","49"]),Gi=new Set(["1","3","4","7","8","9"]),Rt=new Map([["22","1"],["23","3"],["24","4"],["27","7"],["28","8"],["29","9"]]),tt=t=>t>="30"&&t<="37"||t>="90"&&t<="97"||t.startsWith("38;"),it=t=>t>="40"&&t<="47"||t>="100"&&t<="107"||t.startsWith("48;"),Pi=[{close:"\x1B[22m",open:"\x1B[1m"},{close:"\x1B[23m",open:"\x1B[3m"},{close:"\x1B[24m",open:"\x1B[4m"},{close:"\x1B[27m",open:"\x1B[7m"},{close:"\x1B[28m",open:"\x1B[8m"},{close:"\x1B[29m",open:"\x1B[9m"}],St=(t,i)=>{let e=-1;for(const o of i){const h=t.indexOf(o);h!==-1&&(e===-1||h<e)&&(e=h)}return e},Vi=(t,i)=>{if(!t.includes("\x1B"))return[{after:"",before:"",content:t,visibleLength:M(t,i.width)}];const e=`${JSON.stringify(i.width??void 0)}\0${t}`,o=vt.get(e);if(o)return o;const h=[],n=[];let r=0,s;for(ht.lastIndex=0;(s=ht.exec(t))!==null;){const d=s[0];h.push(t.slice(r,s.index)),n.push(d),r=s.index+d.length}r<t.length&&h.push(t.slice(r));const a=[];for(const d of n){if(d==="\x1B[0m"||d==="\x1B]8;;\x07"){a.push(d);continue}if(d.startsWith("\x1B[")&&d.endsWith("m")){const m=d.slice(2,-1);if(Hi.has(m)){a.push(d);continue}}}const c=new Set,l=[];for(const[d,m]of h.entries()){if(d>0&&n[d-1]){const p=n[d-1];if(p==="\x1B[0m")c.clear();else if(p==="\x1B]8;;\x07"){for(const g of c)if(g.startsWith("\x1B]8;;")&&!g.endsWith("\x1B]8;;\x07")){c.delete(g);break}}else if(p.startsWith("\x1B[")&&p.endsWith("m")){const g=p.slice(2,-1);if(g==="39"){for(const f of c)if(f.startsWith("\x1B[")&&f.endsWith("m")){const b=f.slice(2,-1);if(tt(b)){c.delete(f);break}}}else if(g==="49"){for(const f of c)if(f.startsWith("\x1B[")&&f.endsWith("m")){const b=f.slice(2,-1);if(it(b)){c.delete(f);break}}}else if(Rt.has(g)){const f=Rt.get(g);for(const b of c)if(b===`\x1B[${f}m`){c.delete(b);break}}else{if(tt(g)){for(const f of c)if(f.startsWith("\x1B[")&&f.endsWith("m")){const b=f.slice(2,-1);if(tt(b)){c.delete(f);break}}}else if(it(g)){for(const f of c)if(f.startsWith("\x1B[")&&f.endsWith("m")){const b=f.slice(2,-1);if(it(b)){c.delete(f);break}}}else if(Gi.has(g)){const f=`\x1B[${g}m`;c.has(f)&&c.delete(f)}c.add(p)}}else if(p.startsWith("\x1B]8;;")&&!p.endsWith("\x1B]8;;\x07")){for(const g of c)if(g.startsWith("\x1B]8;;")&&!g.endsWith("\x1B]8;;\x07")){c.delete(g);break}c.add(p)}}if(m==="")continue;let u="";if(c.size>0)if(a.includes("\x1B[0m"))u="\x1B[0m";else{const p=[];let g=!1;for(const x of c)if(x.startsWith("\x1B]8;;")&&!x.endsWith("\x1B]8;;\x07")){g=!0;break}g&&a.includes("\x1B]8;;\x07")&&p.push("\x1B]8;;\x07");let f=!1,b=!1;for(const x of c)if(x.startsWith("\x1B[")&&x.endsWith("m")){const y=x.slice(2,-1);tt(y)?f=!0:it(y)&&(b=!0)}if(f&&b){const x=St(t,["\x1B[3","\x1B[9","\x1B[38;"]),y=St(t,["\x1B[4","\x1B[10","\x1B[48;"]);x>=0&&y>=0?x>y?p.push("\x1B[39m","\x1B[49m"):p.push("\x1B[49m","\x1B[39m"):p.push("\x1B[39m","\x1B[49m")}else f&&p.push("\x1B[39m"),b&&p.push("\x1B[49m");f&&b&&t.includes("\x1B[39m")&&t.includes("\x1B[49m")&&(t.indexOf("\x1B[39m")<t.indexOf("\x1B[49m")?(p.length-=2,p.push("\x1B[39m","\x1B[49m")):t.indexOf("\x1B[49m")<t.indexOf("\x1B[39m")&&(p.length-=2,p.push("\x1B[49m","\x1B[39m")));const W=Pi.filter(x=>c.has(x.open)).map(x=>({position:t.indexOf(x.open),style:x})).filter(x=>x.position>=0).toSorted((x,y)=>y.position-x.position);for(const x of W){const y=x;a.includes(y.style.close)&&p.push(y.style.close)}u=p.join("")}const w=[...c].join("");l.push({after:u,before:w,content:m,visibleLength:M(m,i.width)})}return vt.set(e,l),l},At=(t,i,e,o)=>{const h=[...o.segmenter.segment(t)],n=[];let r=0,s=!1;for(const a of h){const c=M(a.segment,o.width),l=r,d=r+c;if(!s)if(l<i){r=d;continue}else s=!0;if(l>=e||d>e)break;n.push(a.segment),r=d}return n.join("")},F=(t,i=0,e=Number.MAX_SAFE_INTEGER,o={})=>{const h={segmenter:$i,...o};if(i>=e||t==="")return"";const n=M(t,h.width);if(i===0&&e>=n)return t;if(i<0||e<0)throw new RangeError("Negative indices aren't supported");if(!t.includes("\x1B"))return _i.test(t)?t.slice(i,e):At(t,i,e,h);if(yt.lastIndex=0,Wt.lastIndex=0,!yt.test(t)&&!Wt.test(t))return t;const r=Vi(t,h);if(r.length===0)return"";let s=0;const a=[];for(const[d,m]of r.entries()){const u=s,w=s+m.visibleLength;if(w>i&&u<e){const p=Math.max(0,i-u),g=Math.min(m.visibleLength,e-u);a.push({end:g,index:d,segment:m,start:p})}s=w}if(a.length===0)return"";const c=[],l=a[0].segment;c.push(l.before);for(let d=0;d<a.length;d++){const{end:m,segment:u,start:w}=a[d];if(w===0&&m===u.visibleLength?c.push(u.content):c.push(At(u.content,w,m,h)),d<a.length-1){const p=a[d+1].segment,g=u.after,f=p.before;g!==f&&(g||f)&&c.push(g,f)}}return c.push(a.at(-1).segment.after),c.join("")},Ct="…",qi=3,et=(t,i,e=!1)=>{if(t.charAt(i)===" ")return i;const o=e?1:-1,h=Math.min(qi,e?t.length-i:i);for(let n=1;n<=h;n++){const r=i+n*o;if(t.charAt(r)===" ")return r}return i},ot=(t,i,e)=>V(t,{...e,ellipsis:"",ellipsisWidth:0,limit:i}).index,rt=(t,i,e)=>M(t.slice(0,i),e),It=(t,i,e={})=>{if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof t}`);if(typeof i!="number")throw new TypeError(`Expected \`limit\` to be a number, got ${typeof i}`);if(t===""||i<=0)return"";const o=t.normalize("NFC"),{ellipsis:h=Ct,position:n="end",preferTruncationOnSpace:r=!1}=e;let s=e.ellipsisWidth??(h===Ct?1:void 0);s??=V(h,{...e.width,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width;const{width:a}=V(o,{...e.width,ellipsis:h,ellipsisWidth:s});if(a<=i)return o;switch(n){case"end":{if(r){const c=i-s,l=ot(o,c,e.width),d=et(o,l),m=rt(o,d,e.width);return F(o,0,m,{width:e.width})+h}return F(o,0,i-s,{width:e.width})+h}case"middle":{const c=Math.floor(i/2),l=Math.max(0,i-s),d=Math.min(c,l),m=Math.max(0,l-d);if(r){const u=ot(o,d,e.width),w=et(o,u),p=rt(o,w,e.width),g=a-m,f=ot(o,g,e.width),b=et(o,f,!0),W=rt(o,b,e.width);return F(o,0,p,{width:e.width})+h+F(o,W,a,{width:e.width}).trim()}return F(o,0,d,{width:e.width})+h+F(o,a-m,a,{width:e.width})}case"start":{if(r){const c=a-i+s,l=ot(o,c,e.width),d=et(o,l,!0),m=rt(o,d,e.width);return h+F(o,m,a,{width:e.width}).trim()}return h+F(o,a-i+s,a,{width:e.width})}default:throw new Error(`Invalid position: expected 'start', 'middle' or 'end', got '${n}'`)}},zi=/\x1B\[(\d+)m/;class Gt{activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(i){const e=zi.exec(i);if(!e)return;const o=Number.parseInt(e[1],10);switch(o){case 0:{this.activeForeground=void 0,this.activeBackground=void 0,this.activeFormatting=[];break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}default:if(o>=30&&o<=37||o>=90&&o<=97)this.activeForeground=i;else if(o>=40&&o<=47||o>=100&&o<=107)this.activeBackground=i;else if([1,2,3,4,7,8,9].includes(o))this.activeFormatting.push(i);else if([22,23,24,27,28,29].includes(o)){const h={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[o];h&&(this.activeFormatting=this.activeFormatting.filter(n=>!n.includes(h)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const i=[];if(this.activeFormatting.length>0){const e={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].toReversed().forEach(o=>{const h=e[o];h&&i.push(h)})}return this.activeForeground&&i.push("\x1B[39m"),this.activeBackground&&i.push("\x1B[49m"),i.join("")}}const Di=(t,i)=>{if(!q.has(t[i]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const e=!0,o=t.slice(i+1,i+1+K.length).join("")===K;return{isInsideEscape:e,isInsideLinkEscape:o}},Yi=(t,i={})=>{const e=new Gt;let o="",h=!1,n="",r="",s=!1;const a=[...t];for(let c=0;c<a.length;c++){const l=a[c];if(l&&q.has(l)){if(o){const p=i.getWidth?.(o)??0,g={isEscapeSequence:!1,isGrapheme:!0,text:o,width:p};if(s&&(g.isHyperlink=!0,g.hyperlinkUrl=r),i.onSegment?.(g,e)===!1)return;o=""}h=!0,n=l;const u=Di(a,c),{isInsideLinkEscape:w}=u;if(w){let p=c+1;for(r="";p<a.length;){const f=a[p];if(f===lt)break;r+=f,p+=1}r=r.slice(4);const g={hyperlinkUrl:r,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(i.onSegment?.(g,e)===!1)return;c=p,s=!0,h=!1,n="";continue}if(c+1<a.length&&a[c+1]==="\\"&&s){const p={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(i.onSegment?.(p,e)===!1)return;s=!1,r="",c+=1,h=!1,n="";continue}}if(h){if(n!==l&&(n+=l),l===gt){h=!1,e.processEscape(n);const u={isEscapeSequence:!0,isGrapheme:!1,text:n,width:0};if(i.onSegment?.(u,e)===!1)return;n=""}continue}o+=l;const d=i.getWidth?.(o)??0,m={isEscapeSequence:!1,isGrapheme:!0,text:o,width:d};if(s&&(m.isHyperlink=!0,m.hyperlinkUrl=r),i.onSegment?.(m,e)===!1)return;o=""}if(o){const c=i.getWidth?.(o)??0,l={isEscapeSequence:!1,isGrapheme:!0,text:o,width:c};s&&(l.isHyperlink=!0,l.hyperlinkUrl=r),i.onSegment?.(l,e)}if(n){const c={isEscapeSequence:!0,isGrapheme:!1,text:n,width:0};i.onSegment?.(c,e)}},Mt=t=>`${q.values().next().value}${_t}${String(t)}${gt}`,Et=t=>`${q.values().next().value}${K}${t}${lt}`,Ki=t=>{if(t.length===0)return"";if(t.length===1)return t[0];let i="",e,o;const h=t.join(`
|
|
2
|
-
`),n=[...h];let r=0;for(const[s,a]of n.entries()){if(i+=a,q.has(a)){const l=ki.exec(h.slice(r))?.groups??{};if(l.code!==void 0){const d=Number.parseFloat(l.code);e=d===Mi?void 0:d}else l.uri!==void 0&&(o=l.uri.length===0?void 0:l.uri)}const c=ji.get(Number(e));n[s+1]===`
|
|
3
|
-
`?(o&&(i+=Et("")),e&&c&&(i+=Mt(c))):a===`
|
|
4
|
-
`&&(e&&c&&(i+=Mt(e)),o&&(i+=Et(o))),r+=a.length}return i},Pt=/(?=\s)|(?<=\s)/,Vt=/^\s+$/,kt=new Map,Ui=t=>{const i=kt.get(t);if(i!==void 0)return i;const e=M(t);return kt.set(t,e),e},ut=t=>{if(!t.includes("\x1B"))return t;let i=t;return t.includes("\x1B[30m")&&(i+="\x1B[39m"),t.includes("\x1B[42m")&&(i+="\x1B[49m"),i},O=t=>{const i=t.split(" ");let e=i.length;for(;e>0&&M(i[e-1])===0;)e--;return e===i.length?t:i.slice(0,e).join(" ")+i.slice(e).join("")},qt=(t,i,e)=>{if(t.length===0)return[""];if(i<=0)return[t];const o=[],h=new Gt;let n="",r=0,s=!1,a=!1,c="",l=0;for(;l<t.length;){const d=t.codePointAt(l),m=String.fromCodePoint(d),u=m.length;if(q.has(m)){s=!0,c=m,n+=m,a=t.startsWith(K,l+1),l+=1;continue}if(s){c+=m,n+=m,a?m===lt&&(s=a=!1):m===gt&&(s=!1,h.processEscape(c)),l+=1;continue}const w=Ui(m),p=m===" ";if(w===0){n+=m,l+=u;continue}if(r+w>i&&(n&&o.push(n+h.getEndEscapesForAllActiveAttributes()),n=h.getStartEscapesForAllActiveAttributes(),r=M(n),p&&e)){for(;l<t.length&&t[l]===" ";)l+=1;continue}if(n+=m,r+=w,r===i&&l+u<t.length&&(o.push(n+h.getEndEscapesForAllActiveAttributes()),n=h.getStartEscapesForAllActiveAttributes(),r=M(n),l+u<t.length&&t[l+u]===" "&&e)){for(l+=u;l<t.length&&t[l]===" ";)l+=1;continue}l+=u}return n&&o.push(n+h.getEndEscapesForAllActiveAttributes()),e?o.map(d=>O(d)):o},Zi=(t,i,e)=>{if(t.length===0)return[];const o=e?t.trim():t;if(o.length===0)return[];const h=[];let n="",r=0;return Yi(o,{getWidth:M,onSegment:(s,a)=>{const c=s.text??"";if(s.isEscapeSequence)n+=c;else{const l=c===" ";if(s.width===0)return n+=c,!0;if(r+s.width>i&&(n&&h.push(n),n=a.getStartEscapesForAllActiveAttributes(),r=0,l))return e||h.push(a.getStartEscapesForAllActiveAttributes()+c),!0;n+=c,r+=s.width}return!0}}),n&&h.push(n),e?h.map(s=>O(s)):h},Qi=(t,i,e)=>{if(t.length===0)return[];const o=e?t.trim():t;if(o.length===0)return[];const h=o.split(Pt),n=[];let r="",s=0,a=0;for(;a<h.length;){const c=h[a],l=Vt.test(c),d=M(c);if(c.length===0){a+=1;continue}if(e&&l&&s===0){a+=1;continue}if(s+d>i&&s>0){e?n.push(O(r)):n.push(r),r="",s=0;continue}r+=c,s+=d,a+=1}return r&&(e?n.push(O(r)):n.push(r)),n},Xi=(t,i,e)=>{if(t.length===0)return[];const o=e?t.trim():t;if(o.length===0)return[];const h=o.split(Pt),n=[];let r="",s=0,a=0;for(;a<h.length;){const c=h[a],l=Vt.test(c),d=M(c);if(c.length===0){a+=1;continue}if(e&&l&&s===0){a+=1;continue}if(d>i){r&&n.push(ut(e?O(r):r));const m=qt(c,i,e);if(m.length>0){for(let u=0;u<m.length-1;u+=1)n.push(m[u]);r=m.at(-1),s=M(r)}else r="",s=0;a+=1;continue}if(s+d>i&&s>0&&(n.push(ut(e?O(r):r)),r="",s=0,e&&l)){a+=1;continue}r+=c,s+=d,a+=1}return r&&n.push(ut(e?O(r):r)),n},st={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},te=(t,i={})=>{const{removeZeroWidthCharacters:e=!0,trim:o=!0,width:h=80,wrapMode:n=st.PRESERVE_WORDS}=i;if(o&&t.trim()==="")return"";let r=t.normalize("NFC").replaceAll(`\r
|
|
5
|
-
`,`
|
|
6
|
-
`);return e&&(r=r.replaceAll(Ei,"")),r.split(`
|
|
7
|
-
`).map(s=>{if(o&&s.trim()==="")return"";let a;switch(n){case st.BREAK_AT_CHARACTERS:{a=Zi(s,h,o);break}case st.BREAK_WORDS:{a=Xi(s,h,o);break}case st.STRICT_WIDTH:{a=qt(s,h,o);break}default:a=Qi(s,h,o)}return Ki(a)}).join(`
|
|
8
|
-
`)},zt=80,Dt=24,mt=(t,i,{shell:e,env:o}={})=>ri(t,i,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:e,env:o}).trim(),nt=(t,i)=>({columns:Number.parseInt(t,10),rows:Number.parseInt(i,10)}),Yt=(t,i)=>{const{columns:e,rows:o}=nt(t,i);if(!(Number.isNaN(e)||Number.isNaN(o))&&!(e===zt&&o===Dt))return{columns:e,rows:o}},ie=()=>{if(J.platform!=="linux")return!0;try{const t=Y.readFileSync("/proc/self/stat","utf8"),i=t.lastIndexOf(") ");if(i===-1)return!1;const e=t.slice(i+2).trim().split(/\s+/),o=Number.parseInt(e[2],10),h=Number.parseInt(e[5],10);return Number.isNaN(o)||Number.isNaN(h)||h<=0?!1:o===h}catch{return!1}};function ee(){const{env:t,stdout:i,stderr:e}=J;if(i?.columns&&i?.rows)return nt(i.columns,i.rows);if(e?.columns&&e?.rows)return nt(e.columns,e.rows);if(t.COLUMNS&&t.LINES)return nt(t.COLUMNS,t.LINES);const o={columns:zt,rows:Dt};return J.platform==="win32"?ft()??o:J.platform==="darwin"?jt()??ft()??o:jt()??ft()??oe()??o}const jt=()=>{try{const t=J.platform==="darwin"?Y.constants.O_EVTONLY|Y.constants.O_NONBLOCK:Y.constants.O_NONBLOCK,{columns:i,rows:e}=si.WriteStream(Y.openSync("/dev/tty",t));return{columns:i,rows:e}}catch{}},ft=()=>{try{const t=mt("tput",["cols"],{env:{TERM:"dumb",...J.env}}),i=mt("tput",["lines"],{env:{TERM:"dumb",...J.env}});if(t&&i)return Yt(t,i)}catch{}},oe=()=>{try{if(!ie())return;const t=mt("resize",["-u"]).match(/\d+/g);if(t.length===2)return Yt(t[0],t[1])}catch{}},H=(t,i)=>{switch(i){case"bottom":return{body:t.bottomBody,join:t.bottomJoin,left:t.bottomLeft,right:t.bottomRight};case"middle":return{body:t.joinBody,join:t.joinJoin,left:t.joinLeft,right:t.joinRight};case"top":return{body:t.topBody,join:t.topJoin,left:t.topLeft,right:t.topRight};default:throw new Error(`Invalid borderType: ${String(i)}`)}},re=t=>({join:t.bodyJoin,left:t.bodyLeft,right:t.bodyRight}),at=(t,i,e,o=1)=>{let h=0;for(let n=0;n<e;n+=1)h+=t[i+n]??0;return e>1&&(h+=(e-1)*o),h},wt=(t,i,e,o)=>{let h=i;for(;h>0&&t[h-1]?.[e]===o;)h-=1;let n=i;for(;n<t.length-1&&t[n+1]?.[e]===o;)n+=1;let r;const s=n-h+1;if(s===1)r=!0;else switch(o.vAlign){case"bottom":{r=i===n;break}case"middle":{const a=h+Math.floor(s/2);r=i===a;break}case"top":{r=i===h;break}default:r=i===h}return{firstRow:h,lastRow:n,showContent:r}},se=(t,i,e,o,h)=>{if(t.length===0)return[];const n=e.showBorders?e.border?.bodyJoin.width??0:0,r=e.showBorders&&(e.border?.joinBody.width??0)>0;let s=t.length-1;for(let l=0;l<t.length;l+=1){const d=t[l];if(d){for(const[m,u]of d.entries())if(u&&h(t,l,m,u)===l){const w=wt(t,l,m,u);s=Math.max(s,w.lastRow)}}}const a=Array.from({length:s+1}).fill(1);for(let l=0;l<t.length;l+=1){const d=t[l];if(d)for(let m=0;m<e.columns;m+=1){const u=d[m];if(u&&h(t,l,m,u)===l&&(u.rowSpan??1)===1){const w=u.colSpan??1,p=at(i,m,w,n),g=o(u,p).length;a[l]=Math.max(a[l]??1,g)}}}const c=Array.from({length:a.length}).fill(!1);if(e.fixedRowHeights)for(let l=0;l<a.length;l+=1){let d;e.fixedRowHeights[l]!==void 0?d=e.fixedRowHeights[l]:e.fixedRowHeights.length===1&&e.fixedRowHeights[0]!==void 0&&(d=e.fixedRowHeights[0]),d!==void 0&&(a[l]=Math.max(1,d),c[l]=!0)}for(let l=0;l<t.length;l+=1){const d=t[l];if(d)for(let m=0;m<e.columns;m+=1){const u=d[m];if(u&&h(t,l,m,u)===l&&(u.rowSpan??1)>1){const w=u.colSpan??1,p=at(i,m,w,n),g=o(u,p),f=r?g.length-1:g.length,b=wt(t,l,m,u),{firstRow:W,lastRow:x}=b;let y=0,R=0;for(let v=W;v<=x&&v<a.length;v+=1)y+=a[v]??1,c[v]||(R+=1);const A=f-y;if(A>0)if(R>0){const v=Math.ceil(A/R);let B=0;for(let C=W;C<=x&&C<a.length;C+=1)if(!c[C]){const E=Math.min(v,A-B);if(a[C]=(a[C]??1)+E,B+=E,B>=A)break}}else(e.onWarn??(v=>{console.warn(v)}))(`[calculateRowHeights] Content of spanning cell exceeds fixed height allocated. Cell: ${JSON.stringify(u.content)}, Required: ${String(f)}, Allocated: ${String(y)} (fixed).`)}}}return a},G=(t,i,e,o)=>{let h=i;for(;h>0&&t[h-1]?.[e]===o;)h-=1;return h},Nt=t=>{if(typeof t=="string")return{content:t};if(typeof t=="number"||typeof t=="bigint"||typeof t=="boolean")return{content:String(t)};if(t==null)return{content:"",isEmpty:!0};if(typeof t=="object"&&"content"in t){let{content:i}=t,e=!1;if(typeof i=="number"||typeof i=="bigint"||typeof i=="boolean")i=String(i);else if(i==null)i="",e=!0;else if(typeof i!="string")throw new TypeError(`Invalid item type in grid cell: expected string, number, null, undefined, or GridItem object, but received ${JSON.stringify(t)} (type: ${typeof t})`);return e?{...t,content:i,isEmpty:!0}:{...t,content:i}}throw new TypeError(`Invalid item type in grid cell: expected string, number, null, undefined, or GridItem object, but received ${JSON.stringify(t)} (type: ${typeof t})`)},ne=(t,i,e,o,h)=>{const n=M(t),r=" ".repeat(Math.max(0,o)),s=" ".repeat(Math.max(0,h));if(n===0)return r+" ".repeat(Math.max(0,i))+s;const a=Math.max(0,i-n);switch(e){case"center":{const c=Math.floor(a/2),l=a-c;return r+" ".repeat(c)+t+" ".repeat(l)+s}case"right":return r+" ".repeat(a)+t+s;default:return r+t+" ".repeat(a)+s}},Lt=/\r?\n/,Ft=/\s+/;let Jt;const he=()=>(Jt??=ee().columns,Jt),S=(t,i)=>!t||!i?t:typeof i=="function"?i(t):i.open+t+i.close;class ct{#t;#e=[];#o;#s=new WeakMap;#r=new WeakMap;#i=new WeakMap;#n(i){const e=this.#i.get(i);if(e)return e;const o=String(i.content??"").split(Lt);let h=0;for(const r of o)h=Math.max(h,M(r));const n={lines:o,maxLineWidth:h};return this.#i.set(i,n),n}#h(i){const e=this.#t.onWarn;if(e){e(i);return}console.warn(i)}static createGridLayout(){return[]}static calculateImplicitRowCount(i,e){let o=0;for(const h of i)o+=(h.colSpan??1)*(h.rowSpan??1);return Math.max(1,Math.ceil(o/e))}constructor(i){const e={autoColumns:1,autoFlow:"row",autoRows:1,balancedWidths:!1,gap:0,paddingLeft:1,paddingRight:1,rows:0,showBorders:i.border!==void 0,truncate:!1,truncateOverflow:!0,wordWrap:!1};let o;Array.isArray(i.fixedRowHeights)?o=i.fixedRowHeights:typeof i.fixedRowHeights=="number"&&(o=[i.fixedRowHeights]),this.#t={...e,...i,columns:i.columns,fixedRowHeights:o,showBorders:i.border!==void 0||(i.showBorders??!1)};const{terminalWidth:h}=this.#t;this.#o=h??he(),this.#t.maxWidth&&(this.#t.maxWidth=Math.min(this.#t.maxWidth,this.#o))}addItem(i){const e=Nt(i);return this.#a(e),this.#e.push(e),this}#a(i){i.width!==void 0&&this.#h("@visulima/tabular: GridItem.width is ignored by Grid (it is only consumed by Table). Use fixedColumnWidths or maxWidth to constrain Grid column widths.")}addItems(i){for(const e of i){const o=Nt(e);this.#a(o),this.#e.push(o)}return this}setColumns(i){return this.#t.columns=i,this}setRows(i){return this.#t.rows=i,this}setBorder(i){return this.#t.border=i,this}setShowBorders(i){return this.#t.showBorders=i,this}setMaxWidth(i){return this.#t.maxWidth=i,this}toString(){const i=ct.createGridLayout();if(this.#s=new WeakMap,this.#r=new WeakMap,this.#i=new WeakMap,this.placeItems(i),i.length===0||i[0]?.length===0)return"";let e=this.calculateColumnWidths(i);const o=this.calculateTotalGridWidth(e),h=typeof this.#t.maxWidth=="number"&&this.#t.maxWidth>0?Math.min(this.#t.maxWidth,this.#o):this.#o;return o>h&&(e=this.adjustColumnWidthsForTerminal(e,o)),this.renderGrid(i,e)}placeItems(i){let e=0,o=0;const h=this.#t.rows>0?this.#t.rows:Number.POSITIVE_INFINITY,n=this.#t.rows>0?this.#t.rows:ct.calculateImplicitRowCount(this.#e,Math.max(1,this.#t.columns));for(let r=0;r<this.#e.length;r+=1){const s=this.#e[r];if(s.isEmpty&&!(s.rowSpan&&s.rowSpan>1)&&!(s.colSpan&&s.colSpan>1)){this.#t.autoFlow==="row"?(o+=1,o>=this.#t.columns&&(o=0,e+=1)):(e+=1,e>=n&&(e=0,o+=1));continue}const a=s.colSpan??1,c=s.rowSpan??1;let l=!1,d=e,m=o,u=0;const w=((this.#t.autoFlow==="column"?Math.max(i.length,n):i.length)+c+5)*this.#t.columns,p=a<=this.#t.columns;for(;p&&!l&&d<h&&u<w;){for(u+=1;d+c>i.length;)i.push(Array.from({length:this.#t.columns}).fill(void 0));if(this.canPlaceItem(i,d,m,a,c))this.placeItem(i,d,m,s),l=!0,this.#t.autoFlow==="row"?(o=m+a,e=d,o>=this.#t.columns&&(o=0,e+=1)):(e=d+c,o=m,e>=n&&(e=0,o+=1));else if(this.#t.autoFlow==="row")m+=1,m>=this.#t.columns&&(m=0,d+=1);else if(d+=1,d>=n&&(d=0,m+=1,m>=this.#t.columns))break}l||(this.#h(`@visulima/tabular: Could not find position for item: ${JSON.stringify(s)} after ${String(u)} attempts. Grid might be too small or layout impossible.`),this.#t.autoFlow==="row"?(o+=1,o>=this.#t.columns&&(o=0,e+=1)):(e+=1,e>=n&&(e=0,o+=1)))}if(this.#t.rows>0){if(i.length>0)for(;i.length<this.#t.rows;)i.push(Array.from({length:this.#t.columns}).fill(void 0))}else for(;i.length>0&&i.at(-1)?.every(r=>r===void 0);)i.pop()}canPlaceItem(i,e,o,h,n,r=!1){if(o+h>this.#t.columns)return!1;for(let s=e;s<e+n;s+=1)if(s<i.length){if(!i[s])return this.#h(`Grid layout unexpectedly missing row ${String(s)} during canPlaceItem check.`),!1;for(let a=o;a<o+h;a+=1)if(i[s]?.[a]!==void 0)return!1}else if(!r)return!1;return!0}computeWrappedContentWidth(i,e,o,h){let n=i;if(h){if(n>20){let r=0;for(const s of e){const a=s.split(Ft);for(const c of a)r=Math.max(r,Math.min(M(c),o))}n=Math.min(n,Math.max(r+4,12))}}else{let r=0;for(const s of e){const a=s.split(Ft);for(const c of a)r=Math.max(r,Math.min(M(c),o))}n=Math.min(n,Math.max(r+12,20))}return n}placeItem(i,e,o,h){const n=h.rowSpan??1,r=h.colSpan??1;for(let s=e;s<e+n;s+=1){for(;s>=i.length;)i.push(Array.from({length:this.#t.columns}).fill(void 0));for(let a=o;a<o+r;a+=1)a<this.#t.columns&&(i[s]||(this.#h(`Logic error: Row ${String(s)} not found in placeItem despite check.`),i[s]=Array.from({length:this.#t.columns}).fill(void 0)),i[s][a]=h)}}calculateTotalGridWidth(i){let e=0;const o=this.#t.showBorders?this.#t.border:void 0;o&&(e+=o.bodyLeft.width,e+=o.bodyRight.width);const h=i.length,n=this.#t.showBorders?o?.bodyJoin.width??0:0,r=this.#t.gap;for(let s=0;s<h;s+=1)e+=i[s]??0,s<h-1&&(e+=r,e+=n);return e}adjustColumnWidthsForTerminal(i,e){const o=typeof this.#t.maxWidth=="number"&&this.#t.maxWidth>0?Math.min(this.#t.maxWidth??0,this.#o):this.#o;if(e<=o)return i;let h=0;const n=i.length,r=this.#t.showBorders?this.#t.border:void 0;if(r&&(h+=r.bodyLeft.width,h+=r.bodyRight.width),n>1){h+=(n-1)*this.#t.gap;const m=r?.bodyJoin.width??0;h+=(n-1)*m}if(h>=o)return Array.from({length:n}).fill(1);const s=o-h,a=i.reduce((m,u)=>m+u,0);if(a===0){const m=Math.floor(s/n);return Array.from({length:n}).fill(m)}const c=i.map(m=>{const u=m/a;return Math.max(1,Math.floor(s*u))});let l=c.reduce((m,u)=>m+u,0)-s;for(;l>0;){let m=-1;for(let u=0;u<c.length;u+=1)(c[u]??0)>1&&(m===-1||(c[u]??0)>(c[m]??0))&&(m=u);if(m===-1)break;c[m]-=1,l-=1}let d=s-c.reduce((m,u)=>m+u,0);if(d>0){const m=c.map((u,w)=>{const p=a>0?(i[w]??0)/a:1/n;return{index:w,remainder:s*p%1}}).toSorted((u,w)=>w.remainder-u.remainder);for(const u of m){if(d<=0)break;const{index:w}=u;c[w]!==void 0&&(c[w]+=1,d-=1)}}return c}calculateBalancedColumnWidths(i){const e=this.calculateMinimumColumnWidthsWithGrowableInfo(i),o=e.widths,{growableColumns:h}=e,n=typeof this.#t.maxWidth=="number"&&this.#t.maxWidth>0?Math.min(this.#t.maxWidth,this.#o):this.#o,r=this.#t.showBorders?this.#t.border:void 0;let s=0;if(r&&(s+=r.bodyLeft.width,s+=r.bodyRight.width),this.#t.columns>1){s+=(this.#t.columns-1)*this.#t.gap;const l=r?.bodyJoin.width??0;s+=(this.#t.columns-1)*l}const a=Math.max(0,n-s);if(o.reduce((l,d)=>l+d,0)>0){const l=Math.floor(a/this.#t.columns),d=Array.from({length:this.#t.columns}).fill(l),m=l*this.#t.columns;let u=a-m;for(let f=0;f<d.length&&u>0;f+=1)d[f]=(d[f]??0)+1,u-=1;const w=[];let p=0;for(let f=0;f<this.#t.columns;f+=1){const b=d[f]??0,W=o[f]??0,x=Math.max(b,W);w.push(x),p+=x}if(p>a){const f=a/p,b=w.map(y=>Math.max(3,Math.floor(y*f))),W=b.reduce((y,R)=>y+R,0);let x=a-W;for(let y=0;y<b.length&&x>0;y+=1)b[y]=(b[y]??0)+1,x-=1;return b}let g=a-p;if(g>0){const f=h.length>0?h:w.map((b,W)=>W);for(;g>0&&f.length>0;)for(const b of f){if(g<=0)break;w[b]=(w[b]??0)+1,g-=1}}return w}const c=Math.floor(a/this.#t.columns);return Array.from({length:this.#t.columns}).fill(c)}calculateMinimumColumnWidthsWithGrowableInfo(i){const e=Array.from({length:this.#t.columns}).fill(0),o=[],h=this.#t.paddingLeft+this.#t.paddingRight,n=this.#t.gap+(this.#t.showBorders?this.#t.border?.bodyJoin.width??0:0);for(let r=0;r<this.#t.columns;r+=1)for(let s=0;s<i.length;s+=1){const a=i[s]?.[r];if(!a||G(i,s,r,a)!==s||r>0&&i[s]?.[r-1]===a)continue;const c=a.colSpan??1,l=a.maxWidth??Number.POSITIVE_INFINITY,{lines:d,maxLineWidth:m}=this.#n(a),u=this.#t.wordWrap&&a.wordWrap!==!1;let w=Math.min(m,l);w=this.computeWrappedContentWidth(w,d,l,u),c===1&&(e[r]=Math.max(e[r]??0,w+h),u&&!o.includes(r)&&o.push(r))}for(let r=0;r<i.length;r+=1)for(let s=0;s<this.#t.columns;s+=1){const a=i[r]?.[s];if(!a||G(i,r,s,a)!==r||s>0&&i[r]?.[s-1]===a)continue;const c=a.colSpan??1;if(c>1){const l=a.maxWidth??Number.POSITIVE_INFINITY,{lines:d,maxLineWidth:m}=this.#n(a),u=this.#t.wordWrap&&a.wordWrap!==!1;let w=Math.min(m,l);w=this.computeWrappedContentWidth(w,d,l,u);const p=(c-1)*n,g=w+h+p;let f=0;for(let W=s;W<s+c;W+=1)f+=e[W]??0;const b=f+p;if(g>b){const W=g-b,x=Math.floor(W/c);let y=0;for(let R=0;R<c&&s+R<this.#t.columns;R+=1){const A=Math.min(x,W-y);if(e[s+R]=(e[s+R]??0)+A,y+=A,y>=W)break}}}}return{growableColumns:o,widths:e}}calculateColumnWidths(i){if(this.#t.fixedColumnWidths&&this.#t.fixedColumnWidths.length===this.#t.columns){const n=this.#t.fixedColumnWidths;if(!n.some(r=>r===void 0||!Number.isFinite(r)))return[...n];if(this.#t.balancedWidths){const r=Array.from({length:n.length}).fill(0),s=typeof this.#t.maxWidth=="number"&&this.#t.maxWidth>0?Math.min(this.#t.maxWidth,this.#o):this.#o,a=this.calculateTotalGridWidth(Array.from({length:r.length}).fill(0)),c=Math.max(0,s-a);let l=0;const d=[];for(const[w,p]of n.entries())typeof p=="number"&&Number.isFinite(p)?(r[w]=p,l+=p):d.push(w);let m=Math.max(0,c-l);const u=d.length>0?Math.floor(m/d.length):0;for(const w of d)r[w]=u;m-=u*d.length;for(const w of d){if(m<=0)break;r[w]+=1,m-=1}return r}}if(this.#t.balancedWidths)return this.calculateBalancedColumnWidths(i);const e=Array.from({length:this.#t.columns}).fill(0),o=this.#t.paddingLeft+this.#t.paddingRight,h=this.#t.gap+(this.#t.showBorders?this.#t.border?.bodyJoin.width??0:0);for(let n=0;n<this.#t.columns;n+=1)for(let r=0;r<i.length;r+=1){const s=i[r]?.[n];if(!s||G(i,r,n,s)!==r||n>0&&i[r]?.[n-1]===s)continue;const a=s.colSpan??1,c=s.maxWidth??Number.POSITIVE_INFINITY,{maxLineWidth:l}=this.#n(s),d=Math.min(l,c);a===1&&(e[n]=Math.max(e[n]??0,d+o))}for(let n=0;n<i.length;n+=1)for(let r=0;r<this.#t.columns;r+=1){const s=i[n]?.[r];if(!s||G(i,n,r,s)!==n||r>0&&i[n]?.[r-1]===s)continue;const a=s.colSpan??1;if(a>1){const c=s.maxWidth??Number.POSITIVE_INFINITY,{lines:l,maxLineWidth:d}=this.#n(s),m=this.#t.wordWrap&&s.wordWrap!==!1;let u=Math.min(d,c);u=this.computeWrappedContentWidth(u,l,c,m);let w=0;for(let b=r;b<r+a;b+=1)w+=e[b]??0;const p=a>1?(a-1)*h:0,g=u+o+p,f=w+p;if(g>f){const b=g-f,W=Math.floor(b/a);let x=0;for(let y=0;y<a&&r+y<this.#t.columns;y+=1){const R=Math.min(W,b-x);if(e[r+y]=(e[r+y]??0)+R,x+=R,x>=b)break}}}}if(this.#t.fixedColumnWidths&&this.#t.fixedColumnWidths.length===this.#t.columns)for(const[n,r]of this.#t.fixedColumnWidths.entries())typeof r=="number"&&Number.isFinite(r)&&(e[n]=r);if(this.#t.maxWidth){const n=this.calculateTotalGridWidth(e);if(n>this.#t.maxWidth)return this.adjustColumnWidthsForTerminal(e,n)}return e}renderVisualRowContent(i,e,o,h,n){const r=i[e];if(!r)return"";const s=this.#t.borderColor??this.#t.foregroundColor??void 0,a=[],c=this.#t.showBorders&&this.#t.border?re(this.#t.border):void 0,l=c&&c.left.width>0?c.left.char:"",d=c&&c.right.width>0?c.right.char:"",m=c&&c.join.width>0?c.join.char:"",u=" ".repeat(this.#t.gap);l&&a.push(S(S(l,s),this.#t.backgroundColor));let w=0;for(;w<this.#t.columns;){const p=r[w]??void 0;let g=1,f;if(p){const b=p.colSpan??1;g=b;const W=G(i,e,w,p),x=this.#t.showBorders?this.#t.border?.bodyJoin.width??0:0,y=at(h,w,b,x),R=this.alignCellContent(p,y),A=R.length,v=this.getCachedCellVerticalPosition(i,e,w,p);v.firstRow!==W&&this.#h(`Mismatch between findFirstOccurrenceRow (${String(W)}) and determineCellVerticalPosition (${String(v.firstRow)})`);const B=n.slice(W,v.lastRow+1).reduce((I,k)=>I+k,0),C=v.lastRow-v.firstRow+1;let E=o,L=0;const $=this.#t.showBorders&&(this.#t.border?.joinBody.width??0)>0;for(let I=W;I<e;I+=1)I<n.length&&(E+=n[I]??1),$&&I<v.lastRow&&(L+=1);E+=L;const T=p.vAlign??"top";let j;switch(T){case"bottom":{let I=o;for(let N=W;N<e;N+=1)I+=n[N]??1;const k=B-A;j=I>=k?I-k:-1;break}case"middle":{const I=Math.round((B-A)/2);let k=o;for(let N=W;N<e;N+=1)k+=n[N]??1;j=k>=I&&k<I+A?k-I:-1;break}case"top":{j=E;break}default:j=E}const z=j>=0&&j<A;if(f=" ".repeat(Math.max(0,y)),z){let I=!1;T==="middle"&&C%2===0&&j===0&&(I=!0),I||(f=R[j]??f)}p.colSpan&&p.colSpan>1&&(f+=u.repeat(p.colSpan)),p.foregroundColor?f=S(f,p.foregroundColor):this.#t.foregroundColor&&(f=S(f,this.#t.foregroundColor)),p.backgroundColor?f=S(f,p.backgroundColor):this.#t.backgroundColor&&(f=S(f,this.#t.backgroundColor))}else{const b=this.#t.paddingLeft+this.#t.paddingRight,W=Math.max(0,(h[w]??0)-b),x=" ".repeat(this.#t.paddingLeft+W+this.#t.paddingRight);f=S(S(o===0?x:" ".repeat(x.length),this.#t.foregroundColor),this.#t.backgroundColor)}a.push(f),w+g<this.#t.columns&&(a.push(u),this.#t.showBorders&&m&&a.push(S(S(m,s),this.#t.backgroundColor)),this.#t.gap>0&&a.push(u)),w+=g}return d&&a.push(S(S(d,s),this.#t.backgroundColor)),a.join("")}alignCellContent(i,e){const o=this.#s.get(i);if(o?.has(e))return o.get(e);const{paddingLeft:h,paddingRight:n}=this.#t,r=h+n,s=e-r;if(s<=0){const d=[" ".repeat(r+this.#t.gap)];return o?o.set(e,d):this.#s.set(i,new Map([[e,d]])),d}let a;const c=String(i.content??"");if(a=c.includes(`
|
|
9
|
-
`)||c.includes("\r")?c.split(Lt):[c],this.#t.wordWrap&&i.wordWrap!==!1){const d=typeof this.#t.wordWrap=="object"?this.#t.wordWrap:{},m=typeof i.wordWrap=="object"?i.wordWrap:d;a=te(c,{...m,width:s}).split(`
|
|
10
|
-
`)}if(this.#t.truncate&&i.truncate!==!1){const d=typeof this.#t.truncate=="object"?this.#t.truncate:{},m=typeof i.truncate=="object"?i.truncate:d;a=a.map(u=>It(u,s,m))}else this.#t.truncateOverflow&&(a=a.map(d=>M(d)>s?It(d,s,{}):d));const l=a.map(d=>ne(d,s,i.hAlign??"left",h,n));return o?o.set(e,l):this.#s.set(i,new Map([[e,l]])),l}renderHorizontalBorder(i,e,o,h,n,r=-1){if(!this.#t.showBorders||!this.#t.border)return"";const s=this.#t.border,a=H(s,n),c=a.body.char,l=a.body.width,d=s.bodyJoin.char;if(n!=="middle"&&l===0)return"";let m=a.left.char,u=a.right.char;if(n==="middle"&&r!==-1){const f=i[o]?.[0]??void 0,b=i[r]?.[0]??void 0;f&&b&&f===b&&(m=d);const W=this.#t.columns-1,x=i[o]?.[W]??void 0,y=i[r]?.[W]??void 0;x&&y&&x===y&&(u=d)}const w=[],p=" ".repeat(this.#t.gap);m&&w.push(S(S(m,this.#t.borderColor),this.#t.backgroundColor));let g;for(let f=0;f<this.#t.columns;f+=1){const b=i[o]?.[f]??void 0,W=n==="middle"&&r!==-1?i[r]?.[f]??void 0:void 0;let x,y=!1;if(b&&(f===0||i[o]?.[f-1]!==b)&&(x=b,y=!0),b&&!y)continue;if(!b){const v=h[f]??0;if(g=l>0?c.repeat(v):" ".repeat(v),w.push(S(S(g,this.#t.borderColor),this.#t.backgroundColor)),f<this.#t.columns-1){const B=this.determineJoinChar(n,i,o,r,f,f+1);w.push(p),B.width>0&&w.push(S(S(B.char,this.#t.borderColor),this.#t.backgroundColor))}continue}const R=x?.colSpan??1;if(n==="middle"&&n==="middle"&&W&&b===W&&x){const v=x.vAlign==="middle",{firstRow:B,lastRow:C}=this.getCachedCellVerticalPosition(i,o,f,x),E=C-B+1,L=E%2===0,$=B+Math.ceil(E/2)-1,T=s.bodyJoin.width,j=at(h,f,R,T),z=this.alignCellContent(x,j),I=z.length;if(v&&L&&o===$)g=S(z[0]??"",this.#t.borderColor);else{let k=0;for(let _=B;_<=o;_+=1)k+=e[_]??1,_<o&&(k+=1);const N=k;if(N>=0&&N<I)g=S(z[N]??"",this.#t.foregroundColor);else{const _=h.slice(f,f+R).reduce((Kt,Ut)=>Kt+Ut,0)+(R-1)*(this.#t.gap+this.#t.border.bodyJoin.width);g=S(" ".repeat(_),this.#t.borderColor)}}w.push(S(g,this.#t.backgroundColor))}else{const v=[];for(let B=f;B<f+R;B+=1){const C=h[B]??0,E=l>0?c:" ";if(v.push(E.repeat(C+this.#t.gap)),B<f+R-1){const L=this.determineJoinChar(n,i,o,r,B,B+1);L.width>0&&v.push(L.char)}}g=v.join(""),w.push(S(S(g,this.#t.borderColor),this.#t.backgroundColor))}const A=f+R-1;if(A<this.#t.columns-1){const v=this.determineJoinChar(n,i,o,r,A,A+1);v.width>0&&w.push(S(S(v.char,this.#t.borderColor),this.#t.backgroundColor))}f+=R-1}return u&&w.push(S(S(u,this.#t.borderColor),this.#t.backgroundColor)),w.join("")}determineJoinChar(i,e,o,h,n,r=-1){if(!this.#t.showBorders||!this.#t.border)return{char:" ",width:this.#t.gap};const s=this.#t.border;if(i!=="middle"){const y=H(s,i),R=e[o]?.[n]??void 0,A=r===-1?n+1:r,v=e[o]?.[A]??void 0,B=R!==void 0&&v!==void 0&&R===v?y.body:y.join,{char:C,width:E}=B;return{char:C,width:E>0?E:this.#t.gap}}if(h===-1||r===-1)return{char:" ",width:this.#t.gap};const a=s.bodyJoin,c=e[o]?.[n]??void 0,l=e[h]?.[n]??void 0,d=e[o]?.[r]??void 0,m=e[h]?.[r]??void 0,u=c!==void 0&&l!==void 0&&c===l,w=d!==void 0&&m!==void 0&&d===m,p=c!==void 0&&d!==void 0&&c===d,g=l!==void 0&&m!==void 0&&l===m;let f;const b=H(s,"middle");u&&w?f=p?{char:" ",width:a.width}:a:u?f=s.joinLeft:w?f=s.joinRight:p&&g?f=b.body:p?f=s.topJoin:g?f=s.bottomJoin:f=s.joinJoin;const{char:W,width:x}=f;return{char:W,width:x>0?x:this.#t.gap}}renderGrid(i,e){if(i.length===0)return"";const o=[],h=se(i,e,this.#t,this.alignCellContent.bind(this),G),n=this.#t.showBorders&&this.#t.border?H(this.#t.border,"top"):void 0;n&&n.body.width>0&&o.push(this.renderHorizontalBorder(i,h,0,e,"top"));for(let s=0;s<i.length;s+=1){const a=h[s]??1;for(let l=0;l<a;l+=1)o.push(this.renderVisualRowContent(i,s,l,e,h));const c=this.#t.showBorders&&this.#t.border?H(this.#t.border,"middle"):void 0;if(s<i.length-1&&c&&c.body.width>0){const l=i[s],d=i[s+1];let m=!1;if(l&&d)for(let u=0;u<this.#t.columns;u+=1){const w=l[u],p=d[u];if(w!==p){m=!0;break}}m&&o.push(this.renderHorizontalBorder(i,h,s,e,"middle",s+1))}}const r=this.#t.showBorders&&this.#t.border?H(this.#t.border,"bottom"):void 0;return r&&r.body.width>0&&o.push(this.renderHorizontalBorder(i,h,i.length-1,e,"bottom")),o.join(`
|
|
11
|
-
`)}getCachedCellVerticalPosition(i,e,o,h){const n=this.#r.get(h);if(n)return n;const r=wt(i,e,o,h);return this.#r.set(h,r),r}}const ae={bodyJoin:{char:"│",width:1},bodyLeft:{char:"│",width:1},bodyRight:{char:"│",width:1},bottomBody:{char:"─",width:1},bottomJoin:{char:"┴",width:1},bottomLeft:{char:"└",width:1},bottomRight:{char:"┘",width:1},joinBody:{char:"─",width:1},joinJoin:{char:"┼",width:1},joinLeft:{char:"├",width:1},joinRight:{char:"┤",width:1},topBody:{char:"─",width:1},topJoin:{char:"┬",width:1},topLeft:{char:"┌",width:1},topRight:{char:"┐",width:1}},me={bodyJoin:{char:" ",width:1},bodyLeft:{char:" ",width:1},bodyRight:{char:" ",width:1},bottomBody:{char:"-",width:1},bottomJoin:{char:"-",width:1},bottomLeft:{char:"-",width:1},bottomRight:{char:"-",width:1},joinBody:{char:"-",width:1},joinJoin:{char:"-",width:1},joinLeft:{char:"-",width:1},joinRight:{char:"-",width:1},topBody:{char:"-",width:1},topJoin:{char:"-",width:1},topLeft:{char:"-",width:1},topRight:{char:"-",width:1}},we={bodyJoin:{char:"║",width:1},bodyLeft:{char:"║",width:1},bodyRight:{char:"║",width:1},bottomBody:{char:"═",width:1},bottomJoin:{char:"╩",width:1},bottomLeft:{char:"╚",width:1},bottomRight:{char:"╝",width:1},joinBody:{char:"═",width:1},joinJoin:{char:"╬",width:1},joinLeft:{char:"╠",width:1},joinRight:{char:"╣",width:1},topBody:{char:"═",width:1},topJoin:{char:"╦",width:1},topLeft:{char:"╔",width:1},topRight:{char:"╗",width:1}},pe={bodyJoin:{char:"│",width:1},bodyLeft:{char:"│",width:1},bodyRight:{char:"│",width:1},bottomBody:{char:"─",width:1},bottomJoin:{char:"┴",width:1},bottomLeft:{char:"╰",width:1},bottomRight:{char:"╯",width:1},joinBody:{char:"─",width:1},joinJoin:{char:"┼",width:1},joinLeft:{char:"├",width:1},joinRight:{char:"┤",width:1},topBody:{char:"─",width:1},topJoin:{char:"┬",width:1},topLeft:{char:"╭",width:1},topRight:{char:"╮",width:1}},ge={bodyJoin:{char:"┊",width:1},bodyLeft:{char:"┊",width:1},bodyRight:{char:"┊",width:1},bottomBody:{char:"┈",width:1},bottomJoin:{char:"┴",width:1},bottomLeft:{char:"└",width:1},bottomRight:{char:"┘",width:1},joinBody:{char:"┈",width:1},joinJoin:{char:"┼",width:1},joinLeft:{char:"├",width:1},joinRight:{char:"┤",width:1},topBody:{char:"┈",width:1},topJoin:{char:"┬",width:1},topLeft:{char:"┌",width:1},topRight:{char:"┐",width:1}},be={bodyJoin:{char:"|",width:1},bodyLeft:{char:"|",width:1},bodyRight:{char:"|",width:1},bottomBody:{char:"-",width:1},bottomJoin:{char:"|",width:1},bottomLeft:{char:"|",width:1},bottomRight:{char:"|",width:1},joinBody:{char:"-",width:1},joinJoin:{char:"|",width:1},joinLeft:{char:"|",width:1},joinRight:{char:"|",width:1},topBody:{char:"-",width:1},topJoin:{char:"|",width:1},topLeft:{char:"|",width:1},topRight:{char:"|",width:1}},xe={bodyJoin:{char:"|",width:1},bodyLeft:{char:"|",width:1},bodyRight:{char:"|",width:1},bottomBody:{char:"-",width:1},bottomJoin:{char:"+",width:1},bottomLeft:{char:"+",width:1},bottomRight:{char:"+",width:1},joinBody:{char:"-",width:1},joinJoin:{char:"+",width:1},joinLeft:{char:"+",width:1},joinRight:{char:"+",width:1},topBody:{char:"-",width:1},topJoin:{char:"+",width:1},topLeft:{char:"+",width:1},topRight:{char:"+",width:1}},ye={bodyJoin:{char:"",width:0},bodyLeft:{char:"",width:0},bodyRight:{char:"",width:0},bottomBody:{char:"",width:0},bottomJoin:{char:"",width:0},bottomLeft:{char:"",width:0},bottomRight:{char:"",width:0},joinBody:{char:"",width:0},joinJoin:{char:"",width:0},joinLeft:{char:"",width:0},joinRight:{char:"",width:0},topBody:{char:"",width:0},topJoin:{char:"",width:0},topLeft:{char:"",width:0},topRight:{char:"",width:0}},We={bodyJoin:{char:"█",width:1},bodyLeft:{char:"█",width:1},bodyRight:{char:"█",width:1},bottomBody:{char:"█",width:1},bottomJoin:{char:"█",width:1},bottomLeft:{char:"█",width:1},bottomRight:{char:"█",width:1},joinBody:{char:"█",width:1},joinJoin:{char:"█",width:1},joinLeft:{char:"█",width:1},joinRight:{char:"█",width:1},topBody:{char:"█",width:1},topJoin:{char:"█",width:1},topLeft:{char:"█",width:1},topRight:{char:"█",width:1}},Be={bodyJoin:{char:"┃",width:1},bodyLeft:{char:"┃",width:1},bodyRight:{char:"┃",width:1},bottomBody:{char:"━",width:1},bottomJoin:{char:"┻",width:1},bottomLeft:{char:"┗",width:1},bottomRight:{char:"┛",width:1},joinBody:{char:"━",width:1},joinJoin:{char:"╋",width:1},joinLeft:{char:"┣",width:1},joinRight:{char:"┫",width:1},topBody:{char:"━",width:1},topJoin:{char:"┳",width:1},topLeft:{char:"┏",width:1},topRight:{char:"┓",width:1}},ce=t=>t.reduce((i,e)=>{if(e===null)return i+1;if(typeof e=="object"&&!Array.isArray(e)){const o=typeof e.colSpan=="number"?e.colSpan:1;return i+(o<=0?1:o)}return i+1},0),le=/[\u0000-\u001F\u007F-\u009F]/gu,de=t=>t.replaceAll(le,"");class ue{#t;#e=[];#o=[];#s=[];#r=!0;#i=void 0;#n(i){const e=this.#t.onWarn;if(e){e(i);return}console.warn(i)}constructor(i={}){this.#t={...i,showFooter:i.showFooter??!0,showHeader:i.showHeader??!0,style:{border:ae,paddingLeft:1,paddingRight:1,...i.style}}}setHeaders(i){return i.length>0&&!Array.isArray(i[0])?this.#o=[i]:this.#o=i.map(e=>Array.isArray(e)?e:[e]),this.#r=!0,this.#i=void 0,this}setFooter(i){return i.length>0&&!Array.isArray(i[0])?this.#s=[i]:this.#s=i.map(e=>Array.isArray(e)?e:[e]),this.#r=!0,this.#i=void 0,this}addRow(i){if(!Array.isArray(i))throw new TypeError("Row must be an array");return this.#e.push(i),this.#r=!0,this.#i=void 0,this}addRows(...i){for(const e of i)this.addRow(e);return this.#r=!0,this.#i=void 0,this}getRows(){return this.#e.map(i=>[...i])}get rowCount(){return this.#e.length}removeRow(i){if(!Number.isInteger(i)||i<0||i>=this.#e.length)throw new RangeError(`Row index ${String(i)} is out of bounds (0..${String(this.#e.length-1)})`);return this.#e.splice(i,1),this.#r=!0,this.#i=void 0,this}clear(){return this.#e.length=0,this.#r=!0,this.#i=void 0,this}toString(){if(!this.#r&&this.#i!==void 0)return this.#i;const i=this.#t.showHeader?this.#o:[],e=this.#t.showFooter?this.#s:[],o=[...i,...this.#e,...e];if(o.length===0)return this.#i="",this.#r=!1,"";let h=0;for(const u of o){const w=u;Array.isArray(w)?h=Math.max(h,ce(w)):this.#n(`Unexpected non-array element found while calculating columns: ${JSON.stringify(w)}`)}if(h===0)return this.#i="",this.#r=!1,"";let n;Array.isArray(this.#t.columnWidths)?n=this.#t.columnWidths.length>=h?this.#t.columnWidths.slice(0,h):[...this.#t.columnWidths,...Array.from({length:h-this.#t.columnWidths.length}).fill(void 0)]:typeof this.#t.columnWidths=="number"&&(n=Array.from({length:h}).fill(this.#t.columnWidths));let r;const s=o.length;if(Array.isArray(this.#t.rowHeights)?r=this.#t.rowHeights:typeof this.#t.rowHeights=="number"&&(r=Array.from({length:s}).fill(this.#t.rowHeights)),n||o.some(u=>Array.isArray(u)&&u.some(w=>typeof w=="object"&&w!==null&&!Array.isArray(w)&&w.width!==void 0))&&(n=Array.from({length:h}).fill(void 0)),n&&Array.isArray(n)){const u=[...n];for(const w of o){const p=w;let g=0;for(const f of p){let b={};if(typeof f=="object"&&f!==null&&!Array.isArray(f)){const{content:W,href:x,...y}=f;b=y}b.width!==void 0?u[g]=b.width:b.maxWidth!==void 0&&u[g]!==void 0&&(u[g]=Math.min(u[g],b.maxWidth)),g+=b.colSpan??1}}n=u}const a={autoFlow:"row",backgroundColor:this.#t.style?.backgroundColor,balancedWidths:this.#t.balancedWidths??!1,border:this.#t.style?.border,borderColor:this.#t.style?.borderColor,columns:h,fixedColumnWidths:n,fixedRowHeights:r,foregroundColor:this.#t.style?.foregroundColor,gap:this.#t.gap??0,maxWidth:this.#t.maxWidth,onWarn:this.#t.onWarn,paddingLeft:this.#t.style?.paddingLeft,paddingRight:this.#t.style?.paddingRight,terminalWidth:this.#t.terminalWidth,truncate:this.#t.truncate??(n?.every(u=>typeof u=="number")||this.#t.maxWidth!==void 0&&!this.#t.balancedWidths),truncateOverflow:this.#t.truncateOverflow??!0,wordWrap:this.#t.wordWrap??!1},c=new ct(a),l=[];if(this.#t.columnDefaults)for(const[u,w]of this.#t.columnDefaults.entries())w&&(l[u]={...w});if(this.#t.colAligns)for(const[u,w]of this.#t.colAligns.entries())w!==void 0&&(l[u]={...l[u],hAlign:l[u]?.hAlign??w});const d=l.length>0,m=[];for(const[u,w]of o.entries()){const p=w;if(!Array.isArray(p)){this.#n(`Skipping non-array row while creating GridItems: ${JSON.stringify(p)}`);continue}const g=this.#t.showHeader?this.#o.length:0,f=this.#e.length,b=this.#t.showHeader&&u<g,W=this.#t.showFooter&&u>=g+f,x=b&&p.length===1&&h>1,y=W&&p.length===1&&h>1;let R=0;for(const A of p){let v=A,B={};if(typeof v=="object"&&v!==null&&!Array.isArray(v)){const{content:$,href:T,...j}=v;v=T?`\x1B]8;;${de(T)}\x1B\\${String($)}\x1B]8;;\x1B\\`:$,B=j}const C=d?l[R]:void 0;C&&(B={...B,hAlign:B.hAlign??C.hAlign,maxWidth:B.maxWidth??C.maxWidth,truncate:B.truncate??C.truncate,vAlign:B.vAlign??C.vAlign,wordWrap:B.wordWrap??C.wordWrap}),R+=B.colSpan??1,x&&(B.colSpan=h),y&&(B.colSpan=h);const E=this.#t.transformTabToSpace&&typeof v=="string"?v.replaceAll(" "," ".repeat(this.#t.transformTabToSpace)):v,{maxWidth:L}=B;m.push({backgroundColor:B.backgroundColor,colSpan:B.colSpan,content:E,foregroundColor:B.foregroundColor,hAlign:B.hAlign,maxWidth:L,rowSpan:B.rowSpan,truncate:B.truncate??(L===void 0?void 0:!0),vAlign:B.vAlign,wordWrap:B.wordWrap})}}return c.addItems(m),this.#i=c.toString(),this.#r=!1,this.#i}}const ve=t=>new ue(t);export{ve as N,Be as R,ye as a,be as c,ge as d,me as h,pe as i,ue as k,we as o,xe as r,ae as t,We as w};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as l}from"node:module";import{z as g}from"./index-BzhrR_iC.js";import{y as b}from"./isAccessibleSync-DYKTrrvc-C-_5cgwu.js";let d;const E=e=>(d??=l(import.meta.url))(e),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[t,r]=u.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return u.getBuiltinModule(e)}return E(e)},{spawnSync:p}=h("node:child_process"),f="0000000000000000000000000000000000000000",A=e=>{if(b(e))try{const t=g(e);return JSON.parse(t)}catch{return}},I=(e,t)=>{const r=p("git",e,{cwd:t,encoding:"utf8"});if(!(r.error||typeof r.status!="number"||r.status!==0))return typeof r.stdout=="string"?r.stdout.trim():void 0},_=e=>typeof e=="string"&&e.length>0&&e!==f,R=(e,t,r)=>{const o=[],s=e.GITHUB_BASE_REF,i=e.GITHUB_SHA??"HEAD";if(s&&s.length>0)return o.push(`pull_request: $GITHUB_BASE_REF=${s}`),{base:`origin/${s}`,head:i,notes:o,provider:"github"};const c=e.GITHUB_EVENT_PATH,a=c?r(c):void 0;if(a){const n=typeof a.before=="string"?a.before:void 0;if(_(n))return o.push(`push: event.before=${n}`),{base:n,head:i,notes:o,provider:"github"}}return o.push(`fallback: origin/${t}`),{base:`origin/${t}`,head:i,notes:o,provider:"github"}},C=(e,t)=>{const r=[],o=e.CI_COMMIT_SHA??"HEAD";if(e.CI_PIPELINE_SOURCE==="merge_request_event"){const a=e.CI_MERGE_REQUEST_DIFF_BASE_SHA;if(_(a))return r.push(`merge_request: $CI_MERGE_REQUEST_DIFF_BASE_SHA=${a}`),{base:a,head:o,notes:r,provider:"gitlab"};const n=e.CI_MERGE_REQUEST_TARGET_BRANCH_NAME;if(n&&n.length>0)return r.push(`merge_request: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME=${n}`),{base:`origin/${n}`,head:o,notes:r,provider:"gitlab"}}const i=e.CI_COMMIT_BEFORE_SHA;if(_(i))return r.push(`push: $CI_COMMIT_BEFORE_SHA=${i}`),{base:i,head:o,notes:r,provider:"gitlab"};const c=e.CI_DEFAULT_BRANCH??t;return r.push(`fallback: origin/${c}`),{base:`origin/${c}`,head:o,notes:r,provider:"gitlab"}},S=(e,t)=>{const r=[],o=e.BUILDKITE_COMMIT??"HEAD",s=e.BUILDKITE_PULL_REQUEST_BASE_BRANCH;return s&&s.length>0?(r.push(`pull_request: $BUILDKITE_PULL_REQUEST_BASE_BRANCH=${s}`),{base:`origin/${s}`,head:o,notes:r,provider:"buildkite"}):(r.push(`fallback: origin/${t} (buildkite has no canonical previous-build SHA env)`),{base:`origin/${t}`,head:o,notes:r,provider:"buildkite"})},B=(e,t)=>{const r=[],o=e.CIRCLE_SHA1??"HEAD",s=e.CIRCLE_PR_BASE_BRANCH;return s&&s.length>0?(r.push(`pull_request: $CIRCLE_PR_BASE_BRANCH=${s}`),{base:`origin/${s}`,head:o,notes:r,provider:"circleci"}):(r.push(`fallback: origin/${t} (circleci has no canonical previous-build SHA env)`),{base:`origin/${t}`,head:o,notes:r,provider:"circleci"})},v=(e,t,r)=>{const o=[],s=t(["merge-base","HEAD",`origin/${e}`],r);return s&&s.length>0?(o.push(`local: git merge-base HEAD origin/${e}=${s}`),{base:s,head:"HEAD",notes:o,provider:"local"}):(o.push(`local fallback: origin/${e} (no merge-base available)`),{base:`origin/${e}`,head:"HEAD",notes:o,provider:"local"})},m=e=>{const t=e?.env??process.env,r=e?.defaultBase??"main",o=e?.readEventPayload??A,s=e?.runGit??I,i=e?.workspaceRoot??process.cwd();return t.GITHUB_ACTIONS==="true"?R(t,r,o):t.GITLAB_CI==="true"?C(t,r):t.BUILDKITE==="true"?S(t,r):t.CIRCLECI==="true"?B(t,r):v(r,s,i)};export{m as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i}from"./resolve-runtime-CNiHcVtx.js";const t=e=>{if(e!==null&&typeof e=="object"&&"runtime"in e){const r=e.runtime;if(typeof r=="string")return r}},u=(e,r)=>{const n=i(r,{config:e.visConfig?.runtime,flag:t(e.options)});return n.deferredNotice!==void 0&&e.logger?.warn?.(n.deferredNotice),n},a=e=>e.runtime==="bun"?"bun":void 0;export{a,u as r};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as le}from"node:module";let ue;const de=t=>(ue??=le(import.meta.url))(t),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=t=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[e,r]=y.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return y.getBuiltinModule(t)}return de(t)},{existsSync:g,openSync:he,readSync:fe,closeSync:pe,statSync:me,createWriteStream:V,readdirSync:ge,renameSync:we}=v("node:fs"),{readFile:X,mkdir:O,rm:x,writeFile:ve,mkdtemp:be}=v("node:fs/promises"),{PassThrough:q,Readable:I,pipeline:_e}=v("node:stream"),{pipeline:J}=v("node:stream/promises"),{spawn:Y}=v("node:child_process"),{basename:$e,normalize:ye,delimiter:T,resolve:K,dirname:M,join:j}=v("node:path"),{cwd:Z}=y,ke=v("node:readline"),{homedir:Ee,tmpdir:Q}=v("node:os"),{promisify:xe}=v("node:util");var F=Object.defineProperty,Te=(t,e)=>{let r={};for(var n in t)F(r,n,{get:t[n],enumerable:!0});return F(r,Symbol.toStringTag,{value:"Module"}),r};const Ce=/^[A-Za-z]:\//;function C(t=""){return t&&t.replace(/\\/g,"/").replace(Ce,e=>e.toUpperCase())}const Ae=/^[/\\]{2}/,Se=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,ee=/^[A-Za-z]:$/,te=function(t){if(t.length===0)return".";t=C(t);let e=t.match(Ae),r=k(t),n=t[t.length-1]==="/";return t=re(t,!r),t.length===0?r?"/":n?"./":".":(n&&(t+="/"),ee.test(t)&&(t+="/"),e?r?`//${t}`:`//./${t}`:r&&!k(t)?`/${t}`:t)},D=function(...t){let e="";for(let r of t)if(r)if(e.length>0){let n=e[e.length-1]==="/",s=r[0]==="/";n&&s?e+=r.slice(1):e+=n||s?r:`/${r}`}else e+=r;return te(e)};function Oe(){return typeof process.cwd=="function"?process.cwd().replace(/\\/g,"/"):"/"}const m=function(...t){t=t.map(n=>C(n));let e="",r=!1;for(let n=t.length-1;n>=-1&&!r;n--){let s=n>=0?t[n]:Oe();!s||s.length===0||(e=`${s}/${e}`,r=k(s))}return e=re(e,!r),r&&!k(e)?`/${e}`:e.length>0?e:"."};function re(t,e){let r="",n=0,s=-1,i=0,o=null;for(let a=0;a<=t.length;++a){if(a<t.length)o=t[a];else{if(o==="/")break;o="/"}if(o==="/"){if(s!==a-1&&i!==1)if(i===2){if(r.length<2||n!==2||r[r.length-1]!=="."||r[r.length-2]!=="."){if(r.length>2){let c=r.lastIndexOf("/");c===-1?(r="",n=0):(r=r.slice(0,c),n=r.length-1-r.lastIndexOf("/")),s=a,i=0;continue}else if(r.length>0){r="",n=0,s=a,i=0;continue}}e&&(r+=r.length>0?"/..":"..",n=2)}else r.length>0?r+=`/${t.slice(s+1,a)}`:r=t.slice(s+1,a),n=a-s-1;s=a,i=0}else o==="."&&i!==-1?++i:i=-1}return r}const k=function(t){return Se.test(t)},ne=function(t){let e=C(t).replace(/\/$/,"").split("/").slice(0,-1);return e.length===1&&ee.test(e[0])&&(e[0]+="/"),e.join("/")||(k(t)?"/":".")},se=function(t,e){let r=C(t).split("/"),n="";for(let s=r.length-1;s>=0;s--){let i=r[s];if(i){n=i;break}}return n},ze=/^path$/i,P={key:"PATH",value:""};function ie(t){for(let e in t){if(!Object.prototype.hasOwnProperty.call(t,e)||!ze.test(e))continue;let r=t[e];return r?{key:e,value:r}:P}return P}function Ie(t,e){let r=e.value.split(T),n=[],s=t,i;do n.push(K(s,"node_modules",".bin")),i=s,s=M(s);while(s!==i);n.push(M(process.execPath));let o=n.concat(r).join(T);return{key:e.key,value:o}}function Me(t,e,r=!0){let n={...process.env,...e};if(!r)return n;let s=Ie(t,ie(n));return n[s.key]=s.value,n}const je=t=>{let e=t.length,r=new q,n=()=>{--e===0&&r.end()};for(let s of t)J(s,r,{end:!1}).then(n).catch(n);return r},S=/([()\][%!^"`<>&|;, *?])/g,Fe=/^#!\s*(.+)/,De=/\.(?:com|exe)$/i,Pe=/node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i,Ge=process.platform==="win32",Re=[".EXE",".CMD",".BAT",".COM"];function Be(t,e=[],r={}){if(r.shell===!0||!Ge)return{command:t,args:e,options:r};let n=G(t,r),s=null;if(n!==null){let i=Buffer.alloc(150),o=null;try{o=he(n,"r"),fe(o,i,0,150,0)}catch{}finally{o!==null&&pe(o)}let a=i.toString().match(Fe);if(a!==null){let c=a[1].trim(),d=c.indexOf(" "),l=d===-1?c:c.slice(0,d),f=d===-1?"":c.slice(d+1),h=$e(l);s=h==="env"?f||null:h}}if(s!==null&&n!==null&&(e=[n,...e],t=s,n=G(t,r)),n===null||!De.test(n)){let i=n!==null&&Pe.test(n);t=ye(t),t=t.replace(S,"^$1"),e=e.map(o=>(o=o.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),o=o.replace(/(?=(\\+?)?)\1$/,"$1$1"),o=`"${o}"`,o=o.replace(S,"^$1"),i&&(o=o.replace(S,"^$1")),o)),e=["/d","/s","/c",`"${[t,...e].join(" ")}"`],t=r.env?.comspec??"cmd.exe",r={...r,windowsVerbatimArguments:!0}}return{command:t,args:e,options:r}}function G(t,e){let r=(e.cwd??Z()).toString(),n=e.env??process.env,s=ie(n).value,i=t.includes("/")||t.includes("\\")?[""]:[r,...s.split(T)],o=n.PATHEXT?n.PATHEXT.split(T):Re;t.includes(".")&&o[0]!==""&&o.unshift("");for(let a of i){let c=K(r,a.startsWith('"')&&a.endsWith('"')&&a.length>1?a.slice(1,-1):a,t);for(let d of o){let l=c+d;try{if(me(l).isFile())return l}catch{}}}return null}var R=class extends Error{result;output;get exitCode(){if(this.result.exitCode!==null)return this.result.exitCode}constructor(t,e){super(`Process exited with non-zero status (${t.exitCode})`),this.result=t,this.output=e}};const Ue={timeout:void 0,persist:!1},He={windowsHide:!0};function Ne(t){let e=new AbortController;for(let r of t){if(r.aborted)return e.abort(),r;r.addEventListener("abort",()=>{e.abort(r.reason)},{signal:e.signal})}return e.signal}async function B(t){let e="";try{for await(let r of t)e+=r.toString()}catch{}return e}var Le=class{_process;_aborted=!1;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}constructor(t,e,r){this._options={...Ue,...r},this._command=t,this._args=e??[],this._processClosed=new Promise(n=>{this._resolveClose=n})}kill(t){return this._process?.kill(t)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(t,e,r){return We(t,e,{...r,stdin:this})}async*[Symbol.asyncIterator](){let t=this._process;if(!t)return;let e=[];this._streamErr&&e.push(this._streamErr),this._streamOut&&e.push(this._streamOut);let r=je(e),n=ke.createInterface({input:r});for await(let s of n)yield s.toString();if(await this._processClosed,t.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new R(this)}async _waitForOutput(){let t=this._process;if(!t)throw Error("No process was started");let[e,r]=await Promise.all([this._streamOut?B(this._streamOut):"",this._streamErr?B(this._streamErr):""]);await this._processClosed;let{stdin:n}=this._options;if(n&&typeof n!="string"&&await n,t.removeAllListeners(),this._thrownError)throw this._thrownError;let s={stderr:r,stdout:e,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new R(this,s);return s}then(t,e){return this._waitForOutput().then(t,e)}_streamOut;_streamErr;spawn(){let t=Z(),e=this._options,r={...He,...e.nodeOptions},n=[];this._resetState(),e.timeout!==void 0&&n.push(AbortSignal.timeout(e.timeout)),e.signal!==void 0&&n.push(e.signal),e.persist===!0&&(r.detached=!0),n.length>0&&(r.signal=Ne(n)),r.env=Me(t,r.env,e.nodePath);let s=Be(this._command,this._args,r),i=Y(s.command,s.args,s.options);if(i.stderr&&(this._streamErr=i.stderr),i.stdout&&(this._streamOut=i.stdout),this._process=i,i.once("error",this._onError),i.once("close",this._onClose),i.stdin){let{stdin:o}=e;typeof o=="string"?i.stdin.end(o):o?.process?.stdout?.pipe(i.stdin)}}_resetState(){this._aborted=!1,this._processClosed=new Promise(t=>{this._resolveClose=t}),this._thrownError=void 0}_onError=t=>{if(t.name==="AbortError"&&(!(t.cause instanceof Error)||t.cause.name!=="TimeoutError")){this._aborted=!0;return}this._thrownError=t};_onClose=()=>{this._resolveClose&&this._resolveClose()}};const z=(t,e,r)=>{let n=new Le(t,e,r);return n.spawn(),n},We=z;var Ve=Te({detectPackageManager:()=>ae,installDependencies:()=>et,packageManagers:()=>w});async function Xe(t,e,r={}){let n=te(t).split("/");for(;n.length>0;){let s=await e(n.join("/")||"/");if(s||!r.includeParentDirs)return s;n.pop()}}function qe(t){let e;return()=>(e===void 0&&(e=t().then(r=>(e=r,e))),e)}const Je=qe(async()=>{if(globalThis.process?.versions?.webcontainer)return!1;try{let{exitCode:t}=await z("corepack",["--version"]);return t===0}catch{return!1}});async function Ye(t,e,r={}){let n=t!=="npm"&&t!=="bun"&&t!=="deno"&&t!=="aube"&&t!=="nub"&&r.corepack!==!1&&await Je()?["corepack",[t,...e]]:[t,e],{exitCode:s,stdout:i,stderr:o}=await z(n[0],n[1],{nodeOptions:{cwd:m(r.cwd||process.cwd()),env:r.env,stdio:r.silent?"pipe":"inherit"}});if(s!==0)throw Error(`\`${n.flat().join(" ")}\` failed.${r.silent?["",i,o].join(`
|
|
2
|
-
`):""}`)}async function Ke(t={}){let e=t.cwd||process.cwd(),r={...process.env,...t.env},n=(typeof t.packageManager=="string"?w.find(s=>s.name===t.packageManager):t.packageManager)||await ae(t.cwd||process.cwd());if(!n)throw Error("No package manager auto-detected.");return{cwd:e,env:r,silent:t.silent??!1,packageManager:n,dev:t.dev??!1,workspace:t.workspace,global:t.global??!1,dry:t.dry??!1,corepack:t.corepack??!0}}const oe=/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;function Ze(t){let[e,r]=(t||"").split("@"),[n,s]=r?.split("+")||[];if(e&&e!=="-"&&oe.test(e))return{name:e,version:n,buildMeta:s};let i=(e||"").replace(/\W+/g,"");return{name:i,version:n,buildMeta:s,warnings:[`Abnormal characters found in \`packageManager\` field, sanitizing from \`${e}\` to \`${i}\``]}}function Qe(t){let e=t?.packageManager,r=Array.isArray(e)?e[0]:e,n=typeof r?.name=="string"?r.name:void 0,s=typeof r?.version=="string"?r.version:void 0;if(!n)return{};if(!oe.test(n)){let i=n.replace(/\W+/g,"");return{name:i,version:s,warnings:[`Abnormal characters found in \`devEngines.packageManager\` field, sanitizing from \`${n}\` to \`${i}\``]}}return{name:n,version:s}}const w=[{name:"npm",command:"npm",lockFile:"package-lock.json"},{name:"aube",command:"aube",lockFile:"aube-lock.yaml"},{name:"nub",command:"nub"},{name:"pnpm",command:"pnpm",lockFile:"pnpm-lock.yaml",files:["pnpm-workspace.yaml"]},{name:"bun",command:"bun",lockFile:["bun.lockb","bun.lock"]},{name:"yarn",command:"yarn",lockFile:"yarn.lock",files:[".yarnrc.yml"]},{name:"deno",command:"deno",lockFile:"deno.lock",files:["deno.json"]}];async function ae(t,e={}){let r=await Xe(m(t||"."),async n=>{if(!e.ignorePackageJSON){let s=D(n,"package.json");if(g(s)){let i=JSON.parse(await X(s,"utf8"));if(i?.packageManager){let{name:a,version:c="0.0.0",buildMeta:d,warnings:l}=Ze(i.packageManager);if(a){let f=c.split(".")[0],h=w.find(p=>p.name===a&&p.majorVersion===f)||w.find(p=>p.name===a);return{name:a,command:a,version:c,majorVersion:f,buildMeta:d,warnings:l,files:h?.files,lockFile:h?.lockFile}}}let o=Qe(i?.devEngines);if(o.name){let{name:a,version:c,warnings:d}=o,l=c?.match(/\d+/)?.[0],f=w.find(h=>h.name===a&&h.majorVersion===l)||w.find(h=>h.name===a);return{name:a,command:a,version:c,majorVersion:l,warnings:d,files:f?.files,lockFile:f?.lockFile}}}if(g(D(n,"deno.json")))return w.find(i=>i.name==="deno")}if(!e.ignoreLockFile){for(let s of w)if([s.lockFile,s.files].flat().filter(Boolean).some(i=>g(m(n,i))))return{...s}}},{includeParentDirs:e.includeParentDirs??!0});if(!r&&!e.ignoreArgv){let n=process.argv[1];if(n){for(let s of w)if(RegExp(`[/\\\\]\\.?${s.command}`).test(n))return s}}return r}async function et(t={}){let e=await Ke(t),r=t.frozenLockFile?{npm:["ci"],yarn:["install","--immutable"],bun:["install","--frozen-lockfile"],pnpm:["install","--frozen-lockfile"],deno:["install","--frozen"],aube:["install","--frozen-lockfile"],nub:["install","--frozen-lockfile"]}[e.packageManager.name]:["install"];return t.ignoreWorkspace&&e.packageManager.name==="pnpm"&&r.push("--ignore-workspace"),e.dry||await Ye(e.packageManager.command,r,{cwd:e.cwd,silent:e.silent,corepack:e.corepack}),{exec:{command:e.packageManager.command,args:r}}}const tt=Object.defineProperty({__proto__:null,basename:se,dirname:ne,dist_exports:Ve,resolve:m},Symbol.toStringTag,{value:"Module"});async function rt(t,e,r={}){const n=e+".json",s=JSON.parse(await X(n,"utf8").catch(()=>"{}")),i=(await E(t,{method:"HEAD",headers:r.headers}).catch(()=>{}))?.headers.get("etag");if(s.etag===i&&g(e))return;typeof i=="string"&&(s.etag=i);const o=await E(t,{headers:r.headers});if(o.status>=400)throw new Error(`Failed to download ${t}: ${o.status} ${o.statusText}`);const a=V(e);await xe(_e)(o.body,a),await ve(n,JSON.stringify(s),"utf8")}const nt=/^(?<repo>[-\w.]+\/[-\w.]+)(?<subdir>[^#]+)?(?<ref>#[-\w./@]+)?/,st=/^(?<repo>[-\w.]+(?:\/[-\w.]+)+?)(?:::(?<subdir>[^#]*))?(?<ref>#[-\w./@]+)?$/;function A(t,e){const r=e?.expandRepo||t.includes("::"),n=t.match(r?st:nt)?.groups||{},s=r?n.subdir?"/"+n.subdir:"/":n.subdir||"/";return{repo:n.repo||"",subdir:s,ref:n.ref?n.ref.slice(1):"main"}}function b(...t){process.env.DEBUG&&console.debug("[giget]",...t)}async function E(t,e={}){e.headers?.["sec-fetch-mode"]&&(e.mode=e.headers["sec-fetch-mode"]);const r=await fetch(t,{...e,headers:ce(e.headers)}).catch(n=>{throw new Error(`Failed to download ${t}: ${n}`,{cause:n})});if(e.validateStatus&&r.status>=400)throw new Error(`Failed to fetch ${t}: ${r.status} ${r.statusText}`);return r}function it(){const t=process.env.XDG_CACHE_HOME?m(process.env.XDG_CACHE_HOME,"giget"):m(Ee(),".cache/giget");if(process.platform==="win32"){const e=m(Q(),"giget");if(!g(e)&&g(t))try{we(t,e)}catch{}return e}return t}function ce(t={}){const e={};for(const[r,n]of Object.entries(t))n&&(e[r.toLowerCase()]=n);return e}const ot=(t,e)=>{const r=at(t);return{name:r.name,version:r.subdir?`${r.version||"default"}-${r.subdir.replaceAll("/","-")}`:r.version,tar:({auth:n}={})=>ct(r,n??e.auth)}};function at(t,e={}){const r=e.cwd??process.cwd();let n=t.replace(/#.*$/,""),s;if(/^[./]/.test(t))n=m(r,n);else if(/^https?:\/\//.test(n)){const l=/^(https?:\/\/[^/]+)\/([\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(l){const[,f,h,p]=l;n=`${f}/${h}`,p&&(s=p)}}else if(n.includes("@")){const l=/^(.*?:[\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(l){const[,f,h]=l;n=f,h&&(s=h)}}else{const l={"github:":"https://github.com/","gh:":"https://github.com/","gitlab:":"https://gitlab.com/","bitbucket:":"https://bitbucket.org/","sourcehut:":"https://git.sr.ht/~"},f=/^(.+?:)/.exec(n)?.at(1);f&&l[f]?n=n.replace(f,l[f]):f||(n=`${(process.env.GIGET_GIT_HOST||"https://github.com/").replace(/\/$/,"")}/${n}`);const h=/^(https?:\/\/[^/]+\/~?[\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(h){const[,p,u]=h;n=p,u&&(s=u)}}const i=n.replace(/^https?:\/\//,"").replace(/^.+@/,"").replace(/(\.git)?(#.*)?$/,"").replace(/^\W+/,"").replaceAll(/[:/]/g,"-"),[o,a]=/#(.+)$/.exec(t)?.at(1)?.split(":")??[],c=o||void 0,d=a||s;return{uri:n,name:i,...c&&{version:c},...d&&{subdir:d}}}async function ct(t,e){const r=await be(j(Q(),"giget-git-"));if(e&&/[\r\n]/.test(e))throw new Error("Auth token must not contain newline characters");const n={...process.env,GIT_TERMINAL_PROMPT:"0"};e&&(n.GIT_CONFIG_COUNT="1",n.GIT_CONFIG_KEY_0="http.extraHeader",n.GIT_CONFIG_VALUE_0=`Authorization: Bearer ${e}`);const s={env:n,timeout:6e4},i=lt(),o=c=>H(c,s,i),a=c=>H(c,{...s,cwd:r},i);try{const c=["clone","--progress","--depth","1"];t.subdir&&c.push("--filter=blob:none","--sparse","--no-checkout"),t.version&&c.push("--branch",t.version),c.push("--",t.uri,r);try{i.update("Cloning..."),await o(c),i.update("Cloned.")}catch(u){if(!t.version)throw u;b("Shallow clone failed, falling back to full clone:",u),i.update("Shallow clone failed, cloning..."),await x(r,{recursive:!0,force:!0}),await O(r,{recursive:!0}),await a(["init"]),await a(["remote","add","origin",t.uri]),await a(["fetch","origin"]),await a(["checkout",t.version]),i.update("Fetched.")}t.subdir&&(i.update(`Sparse checkout ${t.subdir}...`),await a(["sparse-checkout","set",t.subdir]),await a(["checkout"])),i.update("Packing...");const d=t.subdir?j(r,t.subdir):r,{create:l}=await import("../packem_chunks/tar.js").then(u=>u.index_min_exports);i.done();const f=l({gzip:!0,cwd:d,filter:u=>!u.startsWith(".git/")&&u!==".git"&&!u.startsWith("./.git/")&&u!=="./.git"},["."]).pipe(new q);let h=!1;const p=()=>{h||(h=!0,x(r,{recursive:!0,force:!0}))};return f.on("end",p),f.on("error",p),f.on("close",p),f}catch(c){throw i.done(),await x(r,{recursive:!0,force:!0}),c}}const U=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function H(t,e,r){return new Promise((n,s)=>{const i=Y("git",t,{...e,stdio:["ignore","pipe","pipe"]});i.stdout.resume();let o="";i.stderr?.on("data",a=>{const c=a.toString();for(const d of c.split(/[\r\n]/)){const l=d.trim();l&&(o=l)}r&&r.update(o)}),i.on("close",a=>{a===0?n(o):s(new Error(`git ${t[0]} exited with code ${a}. Is git installed?`))}),i.on("error",a=>{a.code==="ENOENT"?s(new Error("git is not installed or not found in PATH")):s(a)})})}function lt(){if(!process.stderr.isTTY)return{update(s){},done(){}};let t="",e=0;const r=()=>{const s=U[e%U.length];e++,process.stderr.write(`\x1B[2K\r\x1B[2m${s} ${t}\x1B[0m`)},n=setInterval(r,80);return{update(s){t=s,r()},done(){clearInterval(n),process.stderr.write("\x1B[2K\r")}}}const N=async(t,e)=>{if(t.endsWith(".json"))return await L(t,e);const r=new URL(t);let n=se(r.pathname);try{const s=await E(r.href,{method:"HEAD",validateStatus:!0,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0}});if((s.headers.get("content-type")||"").includes("application/json"))return await L(t,e);const i=s.headers.get("content-disposition")?.match(/filename="?(.+)"?/)?.[1];i&&(n=i.split(".")[0])}catch(s){b(`Failed to fetch HEAD for ${r.href}:`,s)}return{name:`${n}-${r.href.slice(0,8)}`,version:"",subdir:"",tar:r.href,defaultDir:n,headers:{Authorization:e.auth?`Bearer ${e.auth}`:void 0}}},L=async(t,e)=>{const r=await(await E(t,{validateStatus:!0,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0}})).json();if(!r.tar||!r.name)throw new Error(`Invalid template info from ${t}. name or tar fields are missing!`);return r},W=(t,e)=>{const r=A(t),n=process.env.GIGET_GITHUB_URL||"https://api.github.com";return{name:r.repo.replace("/","-"),version:r.ref,subdir:r.subdir,headers:{Authorization:e.auth?`Bearer ${e.auth}`:void 0,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},url:`${n.replace("api.github.com","github.com")}/${r.repo}/tree/${r.ref}${r.subdir}`,tar:`${n}/repos/${r.repo}/tarball/${r.ref}`}},ut=(t,e)=>{const r=A(t,{expandRepo:!0}),n=process.env.GIGET_GITLAB_URL||"https://gitlab.com";return{name:r.repo.replace("/","-"),version:r.ref,subdir:r.subdir,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0,"sec-fetch-mode":"same-origin"},url:`${n}/${r.repo}/tree/${r.ref}${r.subdir}`,tar:`${n}/${r.repo}/-/archive/${r.ref}.tar.gz`}},dt=(t,e)=>{const r=A(t);return{name:r.repo.replace("/","-"),version:r.ref,subdir:r.subdir,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0},url:`https://bitbucket.com/${r.repo}/src/${r.ref}${r.subdir}`,tar:`https://bitbucket.org/${r.repo}/get/${r.ref}.tar.gz`}},ht=(t,e)=>{const r=A(t);return{name:r.repo.replace("/","-"),version:r.ref,subdir:r.subdir,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0},url:`https://git.sr.ht/~${r.repo}/tree/${r.ref}/item${r.subdir}`,tar:`https://git.sr.ht/~${r.repo}/archive/${r.ref}.tar.gz`}},ft={http:N,https:N,git:ot,github:W,gh:W,gitlab:ut,bitbucket:dt,sourcehut:ht},pt="https://raw.githubusercontent.com/unjs/giget/main/templates",mt=(t=pt,e={})=>(async r=>{const n=Date.now(),s=`${t}/${r}.json`,i=await E(s,{headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0}});if(i.status>=400)throw new Error(`Failed to download ${r} template info from ${s}: ${i.status} ${i.statusText}`);const o=await i.json();if(!o.tar||!o.name)throw new Error(`Invalid template info from ${s}. name or tar fields are missing!`);return b(`Fetched ${r} template info from ${s} in ${Date.now()-n}ms`),o}),gt=/^([\w+-.]+):/;function wt(t){if(!t)return;if(typeof t=="function")return t;const e=globalThis.process.getBuiltinModule?.("node:path")?.matchesGlob;if(typeof e!="function")throw new TypeError("Ignore patterns require `path.matchesGlob` which is supported in Node.js v22.5.0, v20.17.0 or later.");return r=>t.some(n=>e(r,n))}async function bt(t,e={}){const r=wt(e.ignore);e.registry=process.env.GIGET_REGISTRY??e.registry,e.auth=process.env.GIGET_AUTH??e.auth;const n=e.registry===!1?void 0:mt(e.registry,{auth:e.auth});let s=e.provider||(n?"registry":"github"),i=t;const o=t.match(gt);o&&(s=o[1],i=t.slice(o[0].length),(s==="http"||s==="https")&&(i=t)),s.endsWith("+git")&&(i=`${s.slice(0,-4)}:${i}`,s="git");const a=e.providers?.[s]||ft[s]||n;if(!a)throw new Error(`Unsupported provider: ${s}`);const c=await Promise.resolve().then(()=>a(i,{auth:e.auth})).catch(u=>{throw new Error(`Failed to download template from ${s}: ${u.message}`)});if(!c)throw new Error(`Failed to resolve template from ${s}`);c.name=(c.name||"template").replace(/[^\da-z-]/gi,"-"),c.defaultDir=(c.defaultDir||c.name).replace(/[^\da-z-]/gi,"-");const d=m(m(it(),s,c.name),(c.version||c.name)+".tar.gz");if(e.preferOffline&&g(d)&&(e.offline=!0),!e.offline){await O(ne(d),{recursive:!0});const u=Date.now();if(typeof c.tar=="function"){const _=c.tar;await(async()=>{const $=await _({auth:e.auth});await J($ instanceof I?$:I.fromWeb($),V(d))})().catch($=>{if(!g(d))throw $;b("Download error. Using cached version:",$),e.offline=!0})}else await rt(c.tar,d,{headers:{Authorization:e.auth?`Bearer ${e.auth}`:void 0,...ce(c.headers)}}).catch(_=>{if(!g(d))throw _;b("Download error. Using cached version:",_),e.offline=!0});b(`Downloaded to ${d} in ${Date.now()-u}ms`)}if(!g(d))throw new Error(`Tarball not found: ${d} (offline: ${e.offline})`);const l=m(m(e.cwd||"."),e.dir||c.defaultDir);if(e.forceClean&&await x(l,{recursive:!0,force:!0}),!e.force&&g(l)&&ge(l).length>0)throw new Error(`Destination ${l} already exists.`);await O(l,{recursive:!0});const f=Date.now(),h=c.subdir?.replace(/^\//,"")||"",{extract:p}=await import("../packem_chunks/tar.js").then(u=>u.index_min_exports);if(await p({file:d,cwd:l,onReadEntry(u){u.path=u.path.split("/").splice(1).join("/"),h&&(u.path.startsWith(h+"/")?u.path=u.path.slice(h.length):u.path=""),r&&u.path&&r(u.path.replace(/^\//,""))&&(u.path="")}}),b(`Extracted to ${l} in ${Date.now()-f}ms`),e.install){b("Installing dependencies...");const{installDependencies:u}=await Promise.resolve().then(()=>tt).then(_=>_.dist_exports);await u({cwd:l,silent:e.silent,...typeof e.install=="object"?e.install:{}})}return{...c,source:i,dir:l}}export{Te as _,bt as d};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const dt=/[\t\n\r ]/,Xt=(t,e,o=4,s=79)=>{let r=e.position,i=e.position,n="",a="";for(;r>0&&!dt.test(t.charAt(r-1));)if(r-=1,e.position-r>s/2-1){n=" ... ",r+=5;break}for(;i<t.length&&!dt.test(t.charAt(i));)if(i+=1,i-e.position>s/2-1){a=" ... ",i-=5;break}const l=t.slice(r,i),u=" ".repeat(o+e.position-r+n.length);return`${" ".repeat(o)}${n}${l}${a}
|
|
2
|
-
${u}^`};let rt=class extends Error{mark;constructor(e,o,s){let r=e,i=o;if(o&&(r+=` at line ${String(o.line+1)}, column ${String(o.column+1)}`,s!==void 0)){const n=Xt(s,o);r+=`:
|
|
3
|
-
${n}`,i={...o,snippet:n}}super(r),this.name="YAMLError",this.mark=i}},x=class extends rt{constructor(e,o,s){super(e,o,s),this.name="YAMLParseError"}},E=class extends rt{constructor(e,o,s){super(e,o,s),this.name="YAMLStringifyError"}},Zt=class extends rt{constructor(e,o,s){super(e,o,s),this.name="YAMLWarning"}},K=class{kind="SCALAR";value;anchor;comment;commentBefore;spaceBefore;tag;type;constructor(e){this.value=e}toJSON(){return I(this)}toString(){return String(this.value)}},$t=class{kind="ALIAS";source;comment;commentBefore;spaceBefore;constructor(e){this.source=e}toString(){return`*${this.source}`}};class ot{kind="PAIR";key;value;comment;commentBefore;spaceBefore;constructor(e,o){this.key=e,this.value=o}toJSON(){return{key:I(this.key),value:I(this.value)}}}const R=(t,e)=>typeof t=="object"&&t!==null&&t.kind===e,v=t=>R(t,"SCALAR"),it=t=>R(t,"ALIAS"),Ct=t=>R(t,"PAIR"),U=t=>R(t,"MAP"),nt=t=>R(t,"SEQ"),W=t=>U(t)||nt(t),Ht=t=>v(t)||it(t)||W(t),te=(t,e)=>{const o=v(t)?t.value:t,s=v(e)?e.value:e;return o===s};let Nt=class{anchor;comment;commentBefore;flow;spaceBefore;tag;getIn(e,o=!1){const[s,...r]=[...e];if(s===void 0)return;const i=this.get(s,!0);return r.length===0?o||!v(i)?i:i.value:W(i)?i.getIn(r,o):void 0}hasIn(e){const[o,...s]=[...e];if(o===void 0)return!1;if(s.length===0)return this.has(o);const r=this.get(o,!0);return W(r)?r.hasIn(s):!1}setIn(e,o){const[s,...r]=[...e];if(s===void 0)return;if(r.length===0){this.set(s,o);return}let i=this.get(s,!0);W(i)||(i=new T,this.set(s,i)),i.setIn(r,o)}deleteIn(e){const[o,...s]=[...e];if(o===void 0)return!1;if(s.length===0)return this.delete(o);const r=this.get(o,!0);return W(r)?r.deleteIn(s):!1}toJSON(){return I(this)}};class T extends Nt{kind="MAP";items=[];#t;#e=0;#r(){if(this.#t===void 0||this.#e!==this.items.length){const e=new Map;for(const o of this.items){const s=v(o.key)?o.key.value:o.key;e.has(s)||e.set(s,o)}this.#t=e,this.#e=this.items.length}return this.#t}#o(e){return this.#r().get(v(e)?e.value:e)}get(e,o=!1){const s=this.#o(e);if(s)return o||!v(s.value)?s.value:s.value.value}set(e,o){const s=this.#o(e);if(s){s.value=o;return}const r=new ot(e,o);this.items.push(r),this.#t!==void 0&&this.#e===this.items.length-1&&(this.#t.set(v(e)?e.value:e,r),this.#e=this.items.length)}has(e){return this.#o(e)!==void 0}delete(e){const o=this.items.findIndex(s=>te(s.key,e));return o===-1?!1:(this.items.splice(o,1),this.#t=void 0,!0)}add(e){this.items.push(e)}}let at=class extends Nt{kind="SEQ";items=[];get(e,o=!1){const s=V(e),r=s===void 0?void 0:this.items[s];return o||!v(r)?r:r.value}set(e,o){const s=V(e);s!==void 0&&(this.items[s]=o)}has(e){const o=V(e);return o!==void 0&&o<this.items.length}delete(e){const o=V(e);return o===void 0||o>=this.items.length?!1:(this.items.splice(o,1),!0)}add(e){this.items.push(e)}};const V=t=>{const e=v(t)?t.value:t,o=typeof e=="number"?e:Number(e);return Number.isInteger(o)&&o>=0?o:void 0},ee=t=>(v(t)?t.value:t)==="<<",xt=(t,e,o)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:o,writable:!0})},w=t=>typeof t=="string"?t:t===null||typeof t!="object"?String(t):v(t)?w(t.value):nt(t)?`[${t.items.map(e=>w(e)).join(",")}]`:U(t)?`{${t.items.map(e=>`${w(e.key)}: ${w(e.value)}`).toSorted((e,o)=>e.localeCompare(o)).join(", ")}}`:it(t)?`*${t.source}`:Array.isArray(t)?`[${t.map(e=>w(e)).join(",")}]`:Object.prototype.toString.call(t)==="[object Object]"?`{${Object.entries(t).map(([e,o])=>`${e}: ${w(o)}`).toSorted((e,o)=>e.localeCompare(o)).join(", ")}}`:Object.prototype.toString.call(t),oe=(t,e)=>{const o=I(t,e);return Array.isArray(o)?o.filter(s=>gt(s)):gt(o)?[o]:[]},gt=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),se=(t,e)=>{const o={};t.anchor&&e.set(t.anchor,o);for(const s of t.items){if(ee(s.key)){re(o,s.value,e);continue}xt(o,w(s.key),I(s.value,e))}return o},re=(t,e,o)=>{for(const s of oe(e,o))for(const[r,i]of Object.entries(s))Object.hasOwn(t,r)||xt(t,r,i)},I=(t,e)=>{const o=e??new Map;if(v(t))return t.anchor&&o.set(t.anchor,t.value),t.value;if(it(t))return o.get(t.source);if(nt(t)){const s=[];t.anchor&&o.set(t.anchor,s);for(const r of t.items)s.push(I(r,o));return s}return U(t)?se(t,o):Ct(t)?{key:I(t.key,o),value:I(t.value,o)}:t},L=t=>{if(Ht(t)||Ct(t))return t;if(Array.isArray(t)){const e=new at;for(const o of t)e.items.push(L(o));return e}if(t instanceof Map){const e=new T;for(const[o,s]of t)e.items.push(new ot(L(o),L(s)));return e}if(typeof t=="object"&&t!==null&&Object.prototype.toString.call(t)==="[object Object]"){const e=new T;for(const[o,s]of Object.entries(t))e.items.push(new ot(new K(o),L(s)));return e}return new K(t)},Mt=/^[-+]?\d+$/,jt=/^0x[0-9a-fA-F]+$/,Lt=/^0o[0-7]+$/,ie=/^[-+]?(?:\.\d+|\d+(?:\.\d*)?)(?:e[-+]?\d+)?$/i,ne=/^([-+]?)\.(?:inf|Inf|INF)$/,ae=/^\.(?:nan|NaN|NAN)$/,le=t=>t==="~"||t==="null"||t==="Null"||t==="NULL",Ot=t=>t==="true"||t==="True"||t==="TRUE",Tt=t=>t==="false"||t==="False"||t==="FALSE",lt=t=>{if(t.length===0)return null;const e=t.charCodeAt(0);if(e>=65&&e<=90||e>=97&&e<=122||e===126){const{length:o}=t;if(o===1)return e===126?null:t;if(o===4){if(le(t))return null;if(Ot(t))return!0}else if(o===5&&Tt(t))return!1;return t}if(e>=48&&e<=57||e===43||e===45||e===46){if(Mt.test(t))return Number.parseInt(t,10);if(e===48&&jt.test(t))return Number.parseInt(t.slice(2),16);if(e===48&&Lt.test(t))return Number.parseInt(t.slice(2),8);if(e===46||e===43||e===45){const o=ne.exec(t);if(o)return o[1]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY;if(ae.test(t))return Number.NaN}if(ie.test(t))return Number.parseFloat(t)}return t},ce=t=>lt(t)!==t,H={status:"invalid"},ue={status:"unknown"},pe=(t,e)=>{switch(t){case"!!bool":case"tag:yaml.org,2002:bool":return Ot(e)?{status:"ok",value:!0}:Tt(e)?{status:"ok",value:!1}:H;case"!!float":case"tag:yaml.org,2002:float":{const o=lt(e);return typeof o=="number"?{status:"ok",value:o}:H}case"!!int":case"tag:yaml.org,2002:int":return jt.test(e)?{status:"ok",value:Number.parseInt(e.slice(2),16)}:Lt.test(e)?{status:"ok",value:Number.parseInt(e.slice(2),8)}:Mt.test(e)?{status:"ok",value:Number.parseInt(e,10)}:H;case"!!null":case"tag:yaml.org,2002:null":return{status:"ok",value:null};case"!!str":case"tag:yaml.org,2002:str":return{status:"ok",value:e};default:return ue}},fe=t=>t.startsWith("!!")?[t,`tag:yaml.org,2002:${t.slice(2)}`]:[t],he=t=>{if(!t)return;const e=typeof t=="function"?t([]):t;if(!Array.isArray(e))throw new x("customTags must be an array of tags, or a function returning one");if(e.length===0)return;const o=new Map,s=[];for(const r of e){for(const i of fe(r.tag))o.set(i,r);if(r.default&&r.test){const i=r.test.flags.includes("g")||r.test.flags.includes("y")?new RegExp(r.test.source,r.test.flags.replaceAll(/[gy]/gu,"")):r.test;s.push({...r,test:i})}}return{byTag:o,implicit:s}},de=(t,e)=>{if(t){for(const o of t.implicit)if(o.test.test(e))return{value:o.resolve(e)}}},ct=(t,e)=>{if(t){for(const o of t)if(o.identify?.(e)){const s=o.stringify?o.stringify(e):String(e);return`${o.tag} ${s}`}}},ge=/[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u2028\u2029\uFFFE\uFFFF]/,me=new Set("!\"#%&'*,-:>?@[\\]`{|}"),be=/^\s|\s$/,ye=/[\n\t]/,Ae=/:[ \t]|:$|[ \t]#/,ke=/[,[\]{}]/,ve=/^\s/,Se=/[ \t]$/,we=t=>{let e=t.length;for(;e>0&&t.codePointAt(e-1)===10;)e-=1;return e===t.length?t:t.slice(0,e)},Ie=/[\n\t]/g,$e=/\t/,Ce=/^\S+(?: \S+)*$/,Z=(t,e)=>" ".repeat(t*e.indent),Ne=(t,e)=>t<e?-1:t>e?1:0,xe=(t,e)=>!(t.length===0||t==="<<"||me.has(t[0])||be.test(t)||ye.test(t)||Ae.test(t)||e&&ke.test(t)),Me=t=>`'${t.replaceAll("'","''")}'`,B=(t,e)=>{let o="";for(const s of t){const r=s.codePointAt(0);switch(s){case`
|
|
4
|
-
`:{o+=String.raw`\n`;break}case" ":{o+=String.raw`\t`;break}case"\r":{o+=String.raw`\r`;break}case"\0":{o+=String.raw`\0`;break}case"\f":{o+=String.raw`\f`;break}case"\v":{o+=String.raw`\v`;break}case"\b":{o+=String.raw`\b`;break}case"\x1B":{o+=String.raw`\e`;break}case'"':{o+=String.raw`\"`;break}case"\\":{o+="\\\\";break}default:{const i=r.toString(16).toUpperCase();r<32||r>=127&&r<=159?o+=String.raw`\x${i.padStart(2,"0")}`:e&&r>126?o+=r<=255?String.raw`\x${i.padStart(2,"0")}`:String.raw`\u${i.padStart(4,"0")}`:o+=s}}}return`"${o}"`},je=(t,e,o)=>{const s=Z(e+1,o);let r="",i=t;t.endsWith(`
|
|
5
|
-
`)?(t.endsWith(`
|
|
6
|
-
|
|
7
|
-
`)&&(r="+"),i=t.slice(0,-1)):r="-";const n=i.split(`
|
|
8
|
-
`).map(a=>a===""?"":s+a).join(`
|
|
9
|
-
`);return`|${r}
|
|
10
|
-
${n}`},Le=(t,e)=>{const o=t.split(" "),s=[];let r="";for(const i of o)r===""?r=i:r.length+1+i.length<=e?r+=` ${i}`:(s.push(r),r=i);return r!==""&&s.push(r),s},Oe=(t,e,o)=>{const s=Z(e+1,o),r=Math.max(1,o.lineWidth-s.length);return`>-
|
|
11
|
-
${Le(t,r).map(i=>s+i).join(`
|
|
12
|
-
`)}`},Te=(t,e,o)=>{if(o.lineWidth<=0)return!1;const s=o.lineWidth-(e+1)*o.indent;return t.length<=s?!1:t.includes(" ")&&Ce.test(t)},ut=(t,e,o,s)=>t===""?'""':ge.test(t.replaceAll(Ie,""))?B(t,o.forceQuotes):o.forceQuotes?B(t,!0):t.includes(`
|
|
13
|
-
`)?o.blockQuote!==!1&&!s&&!ve.test(t)&&!Se.test(we(t))?je(t,e,o):B(t,!1):xe(t,s)&&!ce(t)?!s&&Te(t,e,o)?Oe(t,e,o):t:$e.test(t)?B(t,!1):o.singleQuote?Me(t):B(t,!1),Fe=t=>Number.isNaN(t)?".nan":t===Number.POSITIVE_INFINITY?".inf":t===Number.NEGATIVE_INFINITY?"-.inf":Object.is(t,-0)?"-0":String(t),Ft=(t,e)=>{const o=Object.entries(t);if(e.sortKeys===!0)o.sort(([s],[r])=>Ne(s,r));else if(typeof e.sortKeys=="function"){const s=e.sortKeys;o.sort(([r],[i])=>s(r,i))}return o},Ee=t=>Array.isArray(t)?t.length>0:typeof t=="object"&&t!==null&&Object.keys(t).length>0,D=(t,e,o)=>{let s=o;return s!==null&&typeof s=="object"&&typeof s.toJSON=="function"&&(s=s.toJSON()),t.replacer&&(s=t.replacer(e,s)),s},J=(t,e,o)=>{const s=ct(o.customTags,t);if(s!==void 0)return s;if(Array.isArray(t)){G(t,o),o.stack.add(t);const r=t.map((i,n)=>J(D(o,String(n),i),e,o));return o.stack.delete(t),r.length===0?"[]":o.flowCollectionPadding?`[ ${r.join(", ")} ]`:`[${r.join(", ")}]`}if(typeof t=="object"&&t!==null){G(t,o),o.stack.add(t);const r=Ft(t,o).map(([i,n])=>`${ut(i,e,o,!0)}: ${J(D(o,i,n),e,o)}`);return o.stack.delete(t),r.length===0?"{}":o.flowCollectionPadding?`{ ${r.join(", ")} }`:`{${r.join(", ")}}`}return Et(t,e,o,!0)},Et=(t,e,o,s)=>{if(t==null)return o.nullStr;switch(typeof t){case"bigint":return t.toString();case"boolean":return t?o.trueStr:o.falseStr;case"number":return Fe(t);case"string":return ut(t,e,o,s);default:{if(o.skipInvalid)return o.nullStr;throw new E(`cannot serialize a value of type "${typeof t}"`)}}},_t=(t,e,o)=>{const s=ct(o.customTags,t);return s!==void 0?s:Array.isArray(t)?t.length===0?"[]":st(e,o)?J(t,e,o):_e(t,e,o):typeof t=="object"&&t!==null&&Object.prototype.toString.call(t)==="[object Object]"?Object.keys(t).length===0?"{}":st(e,o)?J(t,e,o):Pe(t,e,o):Et(t,e,o,!1)},G=(t,e)=>{if(e.stack.has(t))throw new E("cannot serialize a circular structure to YAML")},st=(t,e)=>e.collectionStyle==="flow"?!0:e.collectionStyle==="block"?!1:e.flowLevel>=0&&t>=e.flowLevel,Pt=(t,e,o)=>{const s=Ee(t)&&ct(o.customTags,t)===void 0,r=_t(t,s?e+1:e,o);return{block:s&&!st(e+1,o)&&r!=="[]"&&r!=="{}",text:r}},_e=(t,e,o)=>{G(t,o),o.stack.add(t);const s=o.indentSeq||e===0?e:e-1,r=Z(s,o),i=`-${" ".repeat(o.indent-1)}`,n=(s+1)*o.indent,a=[];for(const[l,u]of t.entries()){const p=D(o,String(l),u);if(p===void 0&&o.skipInvalid&&!o.keepUndefined)continue;const{block:f,text:b}=Pt(p,s,o);a.push(r+i+(f?b.slice(n):b))}return o.stack.delete(t),a.length===0?"[]":a.join(`
|
|
14
|
-
`)},Pe=(t,e,o)=>{G(t,o),o.stack.add(t);const s=Z(e,o),r=Ft(t,o),i=[];for(const[n,a]of r){const l=D(o,n,a);if(l===void 0&&!o.keepUndefined)continue;const u=ut(n,e,o,!0),{block:p,text:f}=Pt(l,e,o);i.push(p?`${s+u}:
|
|
15
|
-
${f}`:`${s+u}: ${f}`)}return o.stack.delete(t),i.length===0?"{}":i.join(`
|
|
16
|
-
`)},q=(t,e={})=>{const o={blockQuote:e.blockQuote??!0,collectionStyle:e.collectionStyle??"any",customTags:typeof e.customTags=="function"?e.customTags([]):e.customTags,falseStr:e.falseStr??"false",flowCollectionPadding:e.flowCollectionPadding??!0,flowLevel:e.flowLevel??-1,forceQuotes:e.forceQuotes??!1,indent:e.indent??2,indentSeq:e.indentSeq??!0,keepUndefined:e.keepUndefined??!1,lineWidth:e.lineWidth??80,nullStr:e.nullStr??"null",replacer:e.replacer,singleQuote:e.singleQuote??!1,skipInvalid:e.skipInvalid??!1,sortKeys:e.sortKeys??!1,stack:new Set,trueStr:e.trueStr??"true"};if(o.indent<2)throw new E("indentation width must be at least 2");const s=D(o,"",t);if(s===void 0)return e.directives?`---
|
|
17
|
-
`:`
|
|
18
|
-
`;const r=_t(s,0,o);return`${e.directives?`---
|
|
19
|
-
`:""}${r}
|
|
20
|
-
`},Bt=Symbol("invalid scalar"),Be=/^-?(?:0|[1-9]\d*)$/,We=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:e[-+]?\d+)?$/i,qe=/^[-+]?(?:0|[1-9][\d_]*)$/,Ye=/^[-+]?0[0-7_]+$/,Ke=/^[-+]?0x[\dA-Fa-f_]+$/,Ue=/^[-+]?0b[01_]+$/,De=/^[-+]?(?:\d[\d_]*)?\.[\d_]*(?:e[-+]?\d+)?$/i,Re=/^[-+]?[1-9][\d_]*(?::[0-5]?\d)+$/,Qe=/^[-+]?[1-9][\d_]*(?::[0-5]?\d)+\.[\d_]*$/,Ve=/^([-+])?\.(?:inf|Inf|INF)$/,Je=/^\.(?:nan|NaN|NAN)$/,Ge=/^[-+]?0b/,ze=/^[-+]?0x/,Xe=/^[-+]?0/,Ze=new Set(["","null","Null","NULL","~"]),He=new Set(["on","On","ON","true","True","TRUE","y","Y","yes","Yes","YES"]),to=new Set(["false","False","FALSE","n","N","no","No","NO","off","Off","OFF"]),j=t=>t.includes("_")?t.replaceAll("_",""):t,mt=(t,e)=>{const o=j(t),s=o.startsWith("-"),r=s||o.startsWith("+")?o.slice(1):o;let i=0;for(const n of r.split(":"))i=i*60+(e?Number.parseFloat(n):Number.parseInt(n,10));return s?-i:i},eo=t=>{let e=0;const o=(d,h)=>{let m=0,g=0;for(;g<h&&e<t.length;){const S=t.codePointAt(e)??0;if(S<48||S>57)break;m=m*10+(S-48),e+=1,g+=1}return g<d?-1:m},s=d=>t[e]===d?(e+=1,!0):!1,r=()=>{const d=e;for(;t[e]===" "||t[e]===" ";)e+=1;return e-d},i=o(4,4);if(i<0||!s("-"))return;const n=o(1,2);if(n<0||!s("-"))return;const a=o(1,2);if(a<0)return;if(e===t.length)return new Date(Date.UTC(i,n-1,a));if(!s("T")&&!s("t")&&r()===0)return;const l=o(1,2);if(l<0||!s(":"))return;const u=o(2,2);if(u<0||!s(":"))return;const p=o(2,2);if(p<0)return;let f=0;if(s(".")){const d=e;if(o(1,9)<0)return;f=Math.round(+`0.${t.slice(d,e)}`*1e3)}r();let b=0;if(e<t.length&&!s("Z")&&!s("z")){const d=s("-");if(!d&&!s("+"))return;const h=o(1,2);if(h<0)return;s(":");const m=e<t.length?o(2,2):0;if(m<0)return;b=(h*60+m)*(d?-1:1)}if(e===t.length)return new Date(Date.UTC(i,n-1,a,l,u,p,f)-b*6e4)},oo=t=>t,so=t=>t==="null"?null:t==="true"?!0:t==="false"?!1:Be.test(t)?Number.parseInt(t,10):We.test(t)?Number.parseFloat(t):Bt,ro=t=>{if(Ze.has(t))return null;if(He.has(t))return!0;if(to.has(t))return!1;if(Ue.test(t)){const o=j(t);return(o.startsWith("-")?-1:1)*Number.parseInt(o.replace(Ge,""),2)}if(Ke.test(t)){const o=j(t);return(o.startsWith("-")?-1:1)*Number.parseInt(o.replace(ze,""),16)}if(Ye.test(t)){const o=j(t);return(o.startsWith("-")?-1:1)*Number.parseInt(o.replace(Xe,""),8)}if(Qe.test(t))return mt(t,!0);if(Re.test(t))return mt(t,!1);if(qe.test(t))return Number.parseInt(j(t),10);const e=Ve.exec(t);return e?e[1]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY:Je.test(t)?Number.NaN:De.test(t)?Number.parseFloat(j(t)):eo(t)??t},tt={core:lt,failsafe:oo,json:so,"yaml-1.1":ro},io=/^[-+]?(?:0B[01]+|0O[0-7]+|0X[\dA-F]+|\d+)$/i,no=t=>e=>{const o=t(e);if(typeof o!="number"||!Number.isInteger(o))return o;const s=j(e);return io.test(s)?BigInt(s):o},ao=t=>t==="core"||t==="failsafe"||t==="json"||t==="yaml-1.1",bt=(t,e,o=!1)=>{let s=tt.core;if(t!==void 0){if(!ao(t))throw new x(`unknown schema "${String(t)}"; expected one of core, failsafe, json, yaml-1.1`);s=tt[t]}else e==="1.1"&&(s=tt["yaml-1.1"]);return o?no(s):s},lo="tag:yaml.org,2002:merge",Wt=(t,e)=>t===lo||t==="?"&&e==="<<",co={alias:(t,e)=>t.anchorMap.get(e),anchor:()=>{},finish:(t,e)=>e,has:(t,e)=>Object.hasOwn(t,e),isMergeKey:Wt,key:(t,e)=>w(e),map:()=>({}),push:(t,e)=>{t.push(e)},seq:()=>[],set:(t,e,o,s)=>{if(o==="__proto__"&&t.options.preventProtoPollution){Object.defineProperty(e,o,{configurable:!0,enumerable:!0,value:s,writable:!0});return}e[o]=s}},uo={alias:(t,e)=>t.anchorMap.get(e),anchor:()=>{},finish:(t,e)=>e,has:(t,e)=>t.has(e),isMergeKey:Wt,key:(t,e)=>t.options.stringKeys?w(e):e,map:()=>new Map,push:(t,e)=>{t.push(e)},seq:()=>[],set:(t,e,o,s)=>{e.set(o,s)}},po={alias:(t,e)=>new $t(e),anchor:(t,e)=>{t.anchor=e},finish:(t,e,o)=>fo(t,e,o),has:(t,e)=>t.has(e),isMergeKey:()=>!1,key:(t,e)=>t.options.stringKeys?new K(w(e)):e,map:()=>new T,push:(t,e)=>{t.items.push(e)},seq:()=>new at,set:(t,e,o,s)=>{e.set(o,s)}},fo=(t,e,o)=>{if(e instanceof $t)return e;if(e instanceof K)return t.anchor!==null&&(e.anchor=t.anchor),t.tag!==null&&t.tag!=="?"&&t.tag!=="!"&&(e.tag=t.tag),e;if(e instanceof T||e instanceof at)return t.tag!==null&&t.tag!=="?"&&t.tag!=="!"&&(e.tag=t.tag),e;const s=new K(e);return o&&t.scalarStyle&&(s.type=t.scalarStyle),t.anchor!==null&&(s.anchor=t.anchor),t.tag!==null&&t.tag!=="?"&&t.tag!=="!"&&(s.tag=t.tag),s},ho=(t,e)=>t?po:e?uo:co;class go{input;length;position=0;line=0;lineStart=0;lineIndent=0;firstTabInLine=-1;documentMarkerLine=-1;documents=[];tag=null;anchor=null;kind=null;result=null;anchorMap=new Map;tagMap=new Map;aliasCount=0;depth=0;mappingRanges=null;resolveScalar;#t;nodes;build;lineCounter;scalarStyle=void 0;tags;options;constructor(e,o){this.input=e,this.length=e.length,this.options={...o,duplicateKeys:o.duplicateKeys??"error",maxAliasCount:o.maxAliasCount??100,maxDepth:o.maxDepth??1e3,preventProtoPollution:o.preventProtoPollution??!0,strict:o.strict??!0},this.#t=bt(this.options.schema,this.options.version,this.options.intAsBigInt),this.resolveScalar=this.#t,this.tags=he(this.options.customTags),this.nodes=o.nodes??!1,this.build=ho(this.nodes,this.options.mapAsMap),this.lineCounter=o.lineCounter}applyVersionDirective(e){this.resolveScalar=e==="1.1"||e==="1.2"?bt(this.options.schema,e,this.options.intAsBigInt):this.#t}resetVersionDirective(){this.resolveScalar=this.#t}}const qt=t=>({anchor:t.anchor,firstTabInLine:t.firstTabInLine,kind:t.kind,line:t.line,lineIndent:t.lineIndent,lineStart:t.lineStart,position:t.position,result:t.result,tag:t.tag}),Yt=(t,e)=>{t.position=e.position,t.line=e.line,t.lineStart=e.lineStart,t.lineIndent=e.lineIndent,t.firstTabInLine=e.firstTabInLine,t.tag=e.tag,t.anchor=e.anchor,t.kind=e.kind,t.result=e.result},mo=t=>({aliasCount:t.aliasCount,anchorMap:new Map(t.anchorMap),cursor:qt(t)}),bo=(t,e)=>{t.anchorMap=e.anchorMap,t.aliasCount=e.aliasCount,Yt(t,e.cursor)},c=(t,e)=>{throw new x(e,{column:t.position-t.lineStart,line:t.line,position:t.position},t.input)},yo=(t,e)=>{t.options.onWarning&&t.options.onWarning(new Zt(e,{column:t.position-t.lineStart,line:t.line,position:t.position},t.input))},Kt=t=>typeof t=="object"&&t!==null&&Object.prototype.toString.call(t)==="[object Object]",Ao=t=>t instanceof Map?[...t.keys()]:Object.keys(t),ko=(t,e)=>t instanceof Map?t.get(e):t[String(e)],yt=(t,e,o,s)=>{!Kt(o)&&!(o instanceof Map)&&c(t,"cannot merge mappings; the provided source object is unacceptable");const r=o;for(const i of Ao(r))t.build.has(e,i)||(t.build.set(t,e,i,ko(r,i)),s.add(i))},vo=(t,e,o,s,r,i)=>{if(t.mappingRanges===null||s<0)return;let n=t.mappingRanges.get(e);n===void 0&&(n=[],t.mappingRanges.set(e,n)),n.push({column:s-(t.input.lastIndexOf(`
|
|
21
|
-
`,s-1)+1),end:i,key:w(o),start:s,valueStart:r})},F=(t,e,o,s,r,i)=>{const{build:n}=t;let a=o;if(t.options.merge!==!1&&n.isMergeKey(s,r)){if(a??=new Set,Array.isArray(i))for(const u of i)yt(t,e,u,a);else yt(t,e,i,a);return a}const l=n.key(t,r);if(!a?.has(l)&&n.has(e,l)){if(t.options.duplicateKeys==="error")c(t,`duplicated mapping key "${String(l)}"`);else if(t.options.duplicateKeys==="ignore")return a}return n.set(t,e,l,i),a?.delete(l),a},$=t=>t===10||t===13,C=t=>t===9||t===32,k=t=>t===9||t===32||t===10||t===13||t===0,O=t=>t===44||t===91||t===93||t===123||t===125,Ut=new Uint8Array(128);for(const t of[33,34,35,37,38,39,42,62,64,96,124])Ut[t]=1;const So=t=>t<128&&Ut[t]===1,wo=t=>{if(t>=48&&t<=57)return t-48;const e=t|32;return e>=97&&e<=102?e-97+10:-1},Io=t=>t>=48&&t<=57?t-48:-1,y=Array.from({length:256});y[48]="\0";y[97]="\x07";y[98]="\b";y[116]=" ";y[9]=" ";y[110]=`
|
|
22
|
-
`;y[118]="\v";y[102]="\f";y[114]="\r";y[101]="\x1B";y[32]=" ";y[34]='"';y[47]="/";y[92]="\\";y[78]="
";y[95]=" ";y[76]="\u2028";y[80]="\u2029";const $o=t=>{switch(t){case 85:return 8;case 117:return 4;case 120:return 2;default:return 0}},N=(t,e,o)=>{e<o&&(t.result=t.result+t.input.slice(e,o))},pt=(t,e)=>{e===1?t.result=`${t.result} `:e>1&&(t.result=t.result+`
|
|
23
|
-
`.repeat(e-1))},ft=t=>{const e=t.input.charCodeAt(t.position);e===10?t.position++:e===13?(t.position++,t.input.charCodeAt(t.position)===10&&t.position++):c(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1,t.lineCounter?.addNewLine(t.position)},A=(t,e,o)=>{let s=0,r=t.input.charCodeAt(t.position);for(;r!==0;){for(;C(r);)r===9&&t.firstTabInLine===-1&&(t.firstTabInLine=t.position),r=t.input.charCodeAt(++t.position);if(e&&r===35){const i=t.position===t.lineStart?10:t.input.charCodeAt(t.position-1);k(i)||c(t,"a comment must be separated from other tokens by white space characters");do r=t.input.charCodeAt(++t.position);while(r!==10&&r!==13&&r!==0)}if($(r))for(ft(t),r=t.input.charCodeAt(t.position),s++,t.lineIndent=0;r===32;)t.lineIndent++,r=t.input.charCodeAt(++t.position);else break}return o!==-1&&s!==0&&t.lineIndent<o&&c(t,"deficient indentation"),s},Q=t=>{let{position:e}=t,o=t.input.charCodeAt(e);return!!((o===45||o===46)&&o===t.input.charCodeAt(e+1)&&o===t.input.charCodeAt(e+2)&&(e+=3,o=t.input.charCodeAt(e),o===0||k(o)))},Co=/^(?:!|!!|![a-z-]+!)$/i,No=t=>{let e=t.input.charCodeAt(t.position);if(e!==33)return!1;t.tag!==null&&c(t,"duplication of a tag property");let o=!1,s=!1,r="!";e=t.input.charCodeAt(++t.position),e===60?(o=!0,e=t.input.charCodeAt(++t.position)):e===33&&(s=!0,r="!!",e=t.input.charCodeAt(++t.position));let{position:i}=t,n;if(o){do e=t.input.charCodeAt(++t.position);while(e!==0&&e!==62);if(e===62)n=t.input.slice(i,t.position),t.position++;else return c(t,"unexpected end of the stream within a verbatim tag")}else{for(;e!==0&&!k(e)&&!O(e);)e===33&&(s?c(t,"tag suffix cannot contain exclamation marks"):(r=t.input.slice(i-1,t.position+1),Co.test(r)||c(t,"named tag handle cannot contain such characters"),s=!0,i=t.position+1)),e=t.input.charCodeAt(++t.position);n=t.input.slice(i,t.position)}return o?t.tag=n:t.tagMap.has(r)?t.tag=t.tagMap.get(r)+n:r==="!"?t.tag=`!${n}`:r==="!!"?t.tag=`tag:yaml.org,2002:${n}`:c(t,`undeclared tag handle "${r}"`),!0},xo=t=>{let e=t.input.charCodeAt(t.position);if(e!==38)return!1;t.anchor!==null&&c(t,"duplication of an anchor property"),e=t.input.charCodeAt(++t.position);const{position:o}=t;for(;e!==0&&!k(e)&&!O(e);)e=t.input.charCodeAt(++t.position);return t.position===o&&c(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(o,t.position),!0},Mo=t=>{let e=t.input.charCodeAt(t.position);if(e!==42)return!1;e=t.input.charCodeAt(++t.position);const{position:o}=t;for(;e!==0&&!k(e)&&!O(e);)e=t.input.charCodeAt(++t.position);t.position===o&&c(t,"name of an alias node must contain at least one character");const s=t.input.slice(o,t.position);return t.anchorMap.has(s)||c(t,`unidentified alias "${s}"`),t.aliasCount++,t.aliasCount>t.options.maxAliasCount&&c(t,"alias reference count limit exceeded (possible resource-exhaustion attack)"),t.result=t.build.alias(t,s),t.kind="scalar",!0},et=1,jo=2,At=3,Lo=(t,e,o)=>{t.scalarStyle="PLAIN";const s=t.kind,r=t.result,{input:i}=t;let n=i.charCodeAt(t.position);if(k(n)||O(n)||So(n))return!1;let a;if((n===63||n===45)&&(a=i.charCodeAt(t.position+1),k(a)||o&&O(a)))return!1;t.kind="scalar",t.result="";let l=t.position,u=t.position,p=!1,f=0,b=0,d=0;for(;n!==0;){if(n===58){if(a=i.charCodeAt(t.position+1),k(a)||o&&O(a))break}else if(n===35){const h=i.charCodeAt(t.position-1);if(k(h))break}else{if(t.position===t.lineStart&&Q(t)||o&&O(n))break;if($(n))if(f=t.line,b=t.lineStart,d=t.lineIndent,A(t,!1,-1),t.lineIndent>=e){p=!0,n=i.charCodeAt(t.position);continue}else{t.position=u,t.line=f,t.lineStart=b,t.lineIndent=d;break}}p&&(N(t,l,u),pt(t,t.line-f),l=t.position,u=t.position,p=!1),C(n)||(u=t.position+1),n=i.charCodeAt(++t.position)}return N(t,l,u),t.result!==""?!0:(t.kind=s,t.result=r,!1)},Oo=(t,e)=>{t.scalarStyle="QUOTE_SINGLE";let o=t.input.charCodeAt(t.position);if(o!==39)return!1;t.kind="scalar",t.result="",t.position++;let s=t.position,r=t.position;for(;(o=t.input.charCodeAt(t.position))!==0;)if(o===39)if(N(t,s,t.position),o=t.input.charCodeAt(++t.position),o===39)s=t.position,t.position++,r=t.position;else return!0;else $(o)?(N(t,s,r),pt(t,A(t,!1,e)),s=t.position,r=t.position):t.position===t.lineStart&&Q(t)?c(t,"unexpected end of the document within a single quoted scalar"):(C(o)||(r=t.position+1),t.position++);return c(t,"unexpected end of the stream within a single quoted scalar")},To=(t,e)=>{t.scalarStyle="QUOTE_DOUBLE";let o=t.input.charCodeAt(t.position);if(o!==34)return!1;t.kind="scalar",t.result="",t.position++;let s=t.position,r=t.position;for(;(o=t.input.charCodeAt(t.position))!==0;){if(o===34)return N(t,s,t.position),t.position++,!0;if(o===92){if(N(t,s,t.position),o=t.input.charCodeAt(++t.position),$(o))A(t,!1,e);else if(o<256&&y[o]!==void 0)t.result=t.result+y[o],t.position++;else{const i=$o(o);if(i>0){let n=i,a=0;for(;n>0;n--){o=t.input.charCodeAt(++t.position);const l=wo(o);l>=0?a=a*16+l:c(t,"expected hexadecimal character")}a>1114111&&c(t,`code point "${a.toString(16).toUpperCase()}" is outside the Unicode range`),t.result=t.result+String.fromCodePoint(a),t.position++}else c(t,"unknown escape sequence")}s=t.position,r=t.position}else $(o)?(N(t,s,r),pt(t,A(t,!1,e)),s=t.position,r=t.position):t.position===t.lineStart&&Q(t)?c(t,"unexpected end of the document within a double quoted scalar"):(C(o)||(r=t.position+1),t.position++)}return c(t,"unexpected end of the stream within a double quoted scalar")},Fo=(t,e)=>{let o=t.input.charCodeAt(t.position),s;if(o===124)s=!1,t.scalarStyle="BLOCK_LITERAL";else if(o===62)s=!0,t.scalarStyle="BLOCK_FOLDED";else return!1;t.kind="scalar",t.result="";let r=et,i=!1,n=!1,a=e,l=0,u=!1,p=0;for(;o!==0;)if(o=t.input.charCodeAt(++t.position),o===43||o===45)r===et?r=o===43?At:jo:c(t,"repeat of a chomping mode identifier");else{const f=Io(o);if(f>=0)f===0?c(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):n?c(t,"repeat of an indentation width identifier"):(a=e+f-1,n=!0);else break}if(C(o)){do o=t.input.charCodeAt(++t.position);while(C(o));if(o===35)do o=t.input.charCodeAt(++t.position);while(!$(o)&&o!==0)}for(;o!==0;){for(ft(t),t.lineIndent=0,o=t.input.charCodeAt(t.position);(!n||t.lineIndent<a)&&o===32;)t.lineIndent++,o=t.input.charCodeAt(++t.position);if(!n&&t.lineIndent>a&&(a=t.lineIndent),$(o)){!n&&t.lineIndent>p&&(p=t.lineIndent),l++;continue}t.options.strict&&o===9&&t.lineIndent<a&&c(t,"tab characters must not be used in indentation");const f=t.position===t.lineStart&&Q(t);if(t.options.strict&&o!==0&&!f&&!n&&p>t.lineIndent&&c(t,"a block scalar's leading empty lines cannot be indented more than its content"),t.lineIndent<a||o===0||f){r===At?t.result=t.result+`
|
|
24
|
-
`.repeat(i?1+l:l):r===et&&i&&(t.result=`${t.result}
|
|
25
|
-
`);break}s?C(o)?(u=!0,t.result=t.result+`
|
|
26
|
-
`.repeat(i?1+l:l)):u?(u=!1,t.result=t.result+`
|
|
27
|
-
`.repeat(l+1)):l===0?i&&(t.result=`${t.result} `):t.result=t.result+`
|
|
28
|
-
`.repeat(l):t.result=t.result+`
|
|
29
|
-
`.repeat(i?1+l:l),i=!0,n=!0,l=0;const b=t.position;for(;!$(o)&&o!==0;)o=t.input.charCodeAt(++t.position);N(t,b,t.position)}return!0},z=1,Dt=2,Rt=3,X=4,kt=(t,e)=>{const o=t.tag,s=t.anchor,r=t.build.seq();let i=!1;if(t.firstTabInLine!==-1)return!1;const n=t.line;t.anchor!==null&&(t.build.anchor(r,t.anchor),t.anchorMap.set(t.anchor,r));let a=t.input.charCodeAt(t.position);for(;a!==0&&(t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,c(t,"tab characters must not be used in indentation")),a===45);){const l=t.input.charCodeAt(t.position+1);if(!k(l))break;if(i=!0,t.position++,A(t,!0,-1)&&t.lineIndent<=e){t.build.push(r,null),a=t.input.charCodeAt(t.position);continue}const{line:u}=t;if(_(t,e,Rt,!1,!0),t.build.push(r,t.result),A(t,!0,-1),a=t.input.charCodeAt(t.position),(t.line===u||t.lineIndent>e)&&a!==0)c(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return i?(t.options.strict&&n===t.documentMarkerLine&&c(t,"a block collection cannot start on the same line as the document start marker"),t.tag=o,t.anchor=s,t.kind="sequence",t.result=r,!0):!1},Qt=(t,e,o)=>{const s=t.tag,r=t.anchor,i=t.build.map();let n,a=null,l=null,u=null,p=!1,f=!1,b=!1,d=-1,h=-1;if(t.firstTabInLine!==-1)return!1;const m=t.line;t.anchor!==null&&(t.build.anchor(i,t.anchor),t.anchorMap.set(t.anchor,i));let g=t.input.charCodeAt(t.position);for(;g!==0;){!p&&t.firstTabInLine!==-1&&(t.position=t.firstTabInLine,c(t,"tab characters must not be used in indentation"));const S=t.input.charCodeAt(t.position+1),{line:P}=t;if((g===63||g===58)&&k(S))g===63?(p&&(n=F(t,i,n,a,l,null),a=null,l=null,u=null),f=!0,p=!0,b=!0):p?(p=!1,b=!0):(f=!0,p=!1,b=!1,a=null,l=null),t.position+=1,g=S;else{if(d=t.position,!_(t,o,Dt,!1,!0))break;if(t.line===P){for(g=t.input.charCodeAt(t.position);C(g);)g=t.input.charCodeAt(++t.position);if(g===58)g=t.input.charCodeAt(++t.position),k(g)||c(t,"a whitespace character is expected after the key-value separator within a block mapping"),p&&(n=F(t,i,n,a,l,null),a=null,l=null,u=null),f=!0,p=!1,b=!1,a=t.tag,l=t.result,h=t.position+1;else if(f)c(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=s,t.anchor=r,!0}else if(f)c(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=s,t.anchor=r,!0}if((t.line===P||t.lineIndent>e)&&(_(t,e,X,!0,b)&&(p?l=t.result:u=t.result),p||(vo(t,i,l,d,h,t.position),n=F(t,i,n,a,l,u),a=null,l=null,u=null,d=-1,h=-1),A(t,!0,-1),g=t.input.charCodeAt(t.position)),(t.line===P||t.lineIndent>e)&&g!==0)c(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return p&&F(t,i,n,a,l,null),f&&(t.options.strict&&m===t.documentMarkerLine&&c(t,"a block collection cannot start on the same line as the document start marker"),t.tag=s,t.anchor=r,t.kind="mapping",t.result=i),f},Eo=(t,e)=>{const o=t.tag,s=t.anchor;let r,i=t.input.charCodeAt(t.position),n,a,l;if(i===91)n=93,a=!1,l=t.build.seq();else if(i===123)n=125,a=!0,l=t.build.map();else return!1;t.anchor!==null&&(t.build.anchor(l,t.anchor),t.anchorMap.set(t.anchor,l)),i=t.input.charCodeAt(++t.position);let u=!0;for(;i!==0;){if(A(t,!0,e),i=t.input.charCodeAt(t.position),i===n)return t.position++,t.tag=o,t.anchor=s,t.kind=a?"mapping":"sequence",t.result=l,!0;u?i===44&&c(t,"expected the node content, but found ','"):c(t,"missed comma between flow collection entries");let p=null,f=null,b=null,d=!1;if(i===63){const m=t.input.charCodeAt(t.position+1);k(m)&&(d=!0,t.position++,A(t,!0,e))}const h=t.line;if(_(t,e,z,!1,!0),p=t.tag,f=t.result,A(t,!0,e),i=t.input.charCodeAt(t.position),i===58&&(a||d||h===t.line)&&(d=!0,t.position++,A(t,!0,e),_(t,e,z,!1,!0),b=t.result),a)r=F(t,l,r,p,f,b);else if(d){const m=t.build.map();r=F(t,m,r,p,f,b),t.build.push(l,m)}else t.build.push(l,f);A(t,!0,e),i=t.input.charCodeAt(t.position),i===44?(u=!0,i=t.input.charCodeAt(++t.position)):u=!1}return c(t,"unexpected end of the stream within a flow collection")},vt=(t,e,o,s)=>{const r=mo(t);s&&Yt(t,s),t.tag=null,t.anchor=null,t.kind=null,t.result=null;let i=!1;try{i=Qt(t,e,o)&&t.kind==="mapping"}catch(n){if(!(n instanceof x))throw n;i=!1}return i?!0:(bo(t,r),!1)},_o=(t,e,o,s,r)=>{let i=1,n=!1,a=!1,l=!1,u=!1,p=null;t.tag=null,t.anchor=null,t.kind=null,t.result=null;const f=o===X||o===Rt,b=f;let d=f;if(s&&A(t,!0,-1)&&(n=!0,t.lineIndent>e?i=1:t.lineIndent===e?i=0:i=-1),i===1)for(;;){const h=t.input.charCodeAt(t.position);if(n&&(h===33&&t.tag!==null||h===38&&t.anchor!==null)){u=!0;break}if(n&&(h===33||h===38)&&(t.tag!==null||t.anchor!==null)){const g=t.tag,S=t.anchor;if(vt(t,t.position-t.lineStart,e+1)){t.tag=g,t.anchor=S,t.anchor!==null&&t.anchorMap.set(t.anchor,t.result),l=!0;break}t.tag=g,t.anchor=S}t.options.strict&&n&&i!==1&&(h===33||h===38)&&c(t,"a node property must be indented more than its parent node");const m=qt(t);if(!No(t)&&!xo(t))break;p??=m,A(t,!0,-1)?(n=!0,d=f,t.lineIndent>e?i=1:t.lineIndent===e?i=0:i=-1):d=!1}if(d&&(d=n||r),l)a=!0;else if(i===1||o===X){const h=o===z||o===Dt?e:e+1,m=t.position-t.lineStart;if(i===1){let g=d&&(kt(t,m)||Qt(t,m,h));g||(g=Eo(t,h));const S=t.input.charCodeAt(t.position),P=p!==null&&f&&!d&&S!==124&&S!==62;let ht=!1;if(!g&&P&&p){const M=p.position-p.lineStart;ht=vt(t,M,h,p)}if(t.options.strict&&u&&t.kind!=="mapping"&&t.kind!=="sequence"&&c(t,"a node may only have one anchor and one tag"),g||ht)a=!0;else{let M=b&&Fo(t,h);M||(M=Oo(t,h)),M||(M=To(t,h)),M?a=!0:Mo(t)?(a=!0,(t.tag!==null||t.anchor!==null)&&c(t,"alias node should not have any properties")):Lo(t,h,o===z)&&(a=!0,t.tag??="?")}}else i===0&&(a=d&&kt(t,m))}if(t.tag==="?"){if(t.kind==="scalar"&&typeof t.result=="string"){const h=de(t.tags,t.result);if(h)return t.result=h.value,t.result=t.build.finish(t,t.result,a),t.anchor!==null&&t.anchorMap.set(t.anchor,t.result),t.tag!==null||t.anchor!==null||a;const m=t.resolveScalar(t.result);m===Bt&&c(t,`unquoted scalar "${t.result}" is not valid under the json schema`),t.result=m}}else if(t.tag!==null&&t.tag!=="!"&&(t.kind==="scalar"||!a&&t.kind===null)){const h=typeof t.result=="string"?t.result:"",m=t.tags?.byTag.get(t.tag);if(m)t.result=m.resolve(h);else{const g=pe(t.tag,h);g.status==="ok"?t.result=g.value:g.status==="invalid"&&c(t,`unacceptable value "${h}" for the "${t.tag}" tag`)}}return t.result=t.build.finish(t,t.result,a),t.anchor!==null&&t.anchorMap.set(t.anchor,t.result),t.tag!==null||t.anchor!==null||a},_=(t,e,o,s,r)=>{t.depth>=t.options.maxDepth&&c(t,`maximum nesting depth of ${String(t.options.maxDepth)} exceeded`),t.depth+=1;try{return _o(t,e,o,s,r)}finally{t.depth-=1}},Po=/^\d+\.\d+$/,Vt=t=>{let e=!1,o=!1;t.tagMap=new Map,t.anchorMap=new Map,t.aliasCount=0,t.resetVersionDirective();let s;for(;t.input.charCodeAt(t.position)!==0&&(A(t,!0,-1),s=t.input.charCodeAt(t.position),!(t.lineIndent>0||s!==37));){e=!0,s=t.input.charCodeAt(++t.position);let{position:n}=t;for(;s!==0&&!k(s);)s=t.input.charCodeAt(++t.position);const a=t.input.slice(n,t.position),l=[];for(a.length===0&&c(t,"directive name must not be less than one character in length");s!==0;){for(;C(s);)s=t.input.charCodeAt(++t.position);if(s===35){do s=t.input.charCodeAt(++t.position);while(s!==0&&!$(s));break}if($(s))break;for(n=t.position;s!==0&&!k(s);)s=t.input.charCodeAt(++t.position);l.push(t.input.slice(n,t.position))}s!==0&&ft(t),a==="YAML"?(o?c(t,"duplication of a YAML directive"):l.length!==1?c(t,"the YAML directive accepts exactly one argument"):Po.test(l[0]??"")||c(t,"ill-formed argument of the YAML directive"),o=!0,t.applyVersionDirective(l[0])):a==="TAG"?l.length===2?t.tagMap.set(l[0],l[1]):c(t,"the TAG directive accepts exactly two arguments"):yo(t,`unknown document directive "${a}"`)}A(t,!0,-1);let r=!1;t.lineIndent===0&&t.input.startsWith("---",t.position)&&k(t.input.charCodeAt(t.position+3))?(t.position+=3,r=!0,A(t,!0,-1)===0&&(t.documentMarkerLine=t.line)):e&&c(t,"directives end mark is expected");const i=_(t,t.lineIndent-1,X,!1,!0);if(t.documentMarkerLine=-1,A(t,!0,-1),(i||r||e)&&t.documents.push(t.result),t.position===t.lineStart&&Q(t)){if(t.input.charCodeAt(t.position)===46){t.position+=3;let n=t.input.charCodeAt(t.position);for(;n===32||n===9;)n=t.input.charCodeAt(++t.position);n!==0&&n!==35&&!$(n)&&c(t,"unexpected content after document end marker"),A(t,!0,-1)}return}t.position<t.length-1&&c(t,"end of the stream or a document separator is expected")},Bo=t=>{let e=t;if(e.length>0){const o=e.charCodeAt(e.length-1);o!==10&&o!==13&&(e+=`
|
|
30
|
-
`),e.charCodeAt(0)===65279&&(e=e.slice(1))}return e},Jt=(t,e)=>{if(typeof t!="string")throw new x(`expected a string to parse, received ${t===null?"null":typeof t}`);let o=Bo(t);if(o.includes("\0"))throw new x("null byte is not allowed in input");o+="\0";const s=new go(o,e);return s.position=0,s.lineIndent=0,s},Y=(t,e,o,s)=>{if(Array.isArray(o))for(let r=o.length-1;r>=0;r--){const i=Y(o,String(r),o[r],s);o[r]=i}else if(o instanceof Map)for(const r of o.keys()){const i=Y(o,r,o.get(r),s);i===void 0?o.delete(r):o.set(r,i)}else if(Kt(o)){const r=o;for(const i of Object.keys(r)){const n=Y(r,i,r[i],s);n===void 0?delete r[i]:r[i]=n}}return s.call(t,e,o)},Wo=(t,e={})=>{const o=Jt(t,e);for(;o.position<o.length-1;)Vt(o);const{reviver:s}=e;return s?o.documents.map(r=>Y({"":r},"",r,s)):o.documents},qo=t=>{const{input:e}=t;let o=e.indexOf(`
|
|
31
|
-
`,t.position);for(;o!==-1;){const s=o+1,r=e.slice(s,s+3);if(r==="---"||r==="...")return t.position=s,t.lineStart=s,t.line+=1,t.lineIndent=0,t.firstTabInLine=-1,t.position<t.length-1;o=e.indexOf(`
|
|
32
|
-
`,s)}return!1},Gt=(t,e={})=>{const o=[],s=Jt(t,{...e,onWarning:i=>{o.push(i),e.onWarning?.(i)}});s.mappingRanges=new WeakMap;const r=[];for(;s.position<s.length-1;){const i=s.documents.length,n=o.length,a=s.position;try{Vt(s)}catch(l){if(!(l instanceof x))throw l;if(r.push({contents:null,errors:[l],warnings:o.slice(n)}),!qo(s))break;continue}for(const l of s.documents.slice(i))r.push({contents:l,errors:[],warnings:o.slice(n)});if(s.position===a)break}return{documents:r,ranges:s.mappingRanges}},St=(t,e={})=>{const o=Wo(t,e);if(o.length!==0){if(o.length===1)return o[0];throw new x("expected a single document in the stream, but found more")}},Yo=/\s/,wt=(t,e)=>{let o=e;for(;o>0&&Yo.test(t[o-1]);)o-=1;return o},Ko=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),It=(t,e,o)=>{const s=q(t,o).trimEnd();if(!s.includes(`
|
|
33
|
-
`)&&!Ko(t)&&!Array.isArray(t))return` ${s}`;const r=" ".repeat(e+(o.indent??2));return`
|
|
34
|
-
${s.split(`
|
|
35
|
-
`).map(i=>i===""?i:r+i).join(`
|
|
36
|
-
`)}`};class zt{errors;warnings;contents;#t;#e=[];#r;#o;#s;constructor(e,o,s,r={}){this.#s=e,this.#t=s,this.#r=r,this.contents=o.contents,this.errors=o.errors,this.warnings=o.warnings}toJS(e){const o=I(this.contents);return e?.reviver?Y({"":o},"",o,e.reviver):o}toJSON(){return this.toJS()}getIn(e){this.#o??={value:I(this.contents)};let o=this.#o.value;for(const s of e){if(o===null||typeof o!="object"&&typeof o!="string")return;o=o[s]}return o}get(e){return this.getIn([e])}hasIn(e){return this.getIn(e)!==void 0}has(e){return this.hasIn([e])}setIn(e,o){if(e.length===0)throw new E("setIn requires a non-empty path");const s=e.map(String);let r=this.#i(),i=0;for(;i<s.length-1;){const p=r.get(s[i],!0);if(!U(p))break;r=p,i+=1}const n=this.#t.get(r)??[],a=s.slice(i);if(n.length===0&&r!==this.contents)throw new E(`cannot edit ${JSON.stringify(e)}: the target is not a block mapping`);const l=a.length===1?n.find(p=>p.key===a[0]):void 0;l?this.#n(l,o):this.#a(n,a,o);let u=r;for(const p of a.slice(0,-1)){const f=new T;u.set(L(p),f),u=f}u.set(L(a.at(-1)),L(o)),this.#o=void 0}set(e,o){this.setIn([e],o)}toString(){if(this.#e.length===0)return this.#s;const e=this.#e.toSorted((s,r)=>r.start-s.start);let o=this.#s;for(const s of e)o=o.slice(0,s.start)+s.text+o.slice(s.end);return this.#s=o,this.#e.length=0,o}#i(){if(this.contents===null||this.contents===void 0){const e=new T;return this.contents=e,this.#o=void 0,e}if(!U(this.contents))throw new E("cannot edit a document whose root is not a mapping");return this.contents}#n(e,o){const s=It(o,e.column,this.#r),r=e.valueStart>0?e.valueStart-1:e.end,i=Math.max(r,wt(this.#s,e.end));this.#e.push({end:i,start:r,text:s})}#a(e,o,s){let r;for(const u of e)(r===void 0||u.end>r.end)&&(r=u);const i=r?.column??0;let n="";for(const[u,p]of o.entries()){const f=" ".repeat(i+u*(this.#r.indent??2));n+=`
|
|
37
|
-
${f}${p}:`,u===o.length-1&&(n+=It(s,i+u*(this.#r.indent??2),this.#r))}const a=wt(this.#s,r?.end??this.#s.length);let l=a===0?n.slice(1):n;this.#s.slice(a).includes(`
|
|
38
|
-
`)||(l+=`
|
|
39
|
-
`),this.#e.push({end:a,start:a,text:l})}}const Uo={contents:null,errors:[],warnings:[]};function Zo(t,e,o){const s=typeof e=="function"?St(t,{...o,reviver:e}):St(t,e??o);return s===void 0?null:s}function Ho(t,e,o){if(!(typeof e=="function"||Array.isArray(e)||e===null)&&e!==void 0)return q(t,e);let s={};if(typeof o=="number"?s={indent:o}:typeof o=="string"?s={indent:o.length}:o&&(s=o),Array.isArray(e)){const r=new Set(e.map(String));return q(t,{...s,replacer:(i,n)=>{if(i===""||r.has(i))return n}})}return typeof e=="function"?q(t,{...s,replacer:e}):q(t,s)}const ts=(t,e)=>{const{documents:o,ranges:s}=Gt(t,{...e,nodes:!0});return new zt(t,o[0]??Uo,s)},es=(t,e)=>{const{documents:o,ranges:s}=Gt(t,{...e,nodes:!0});return o.map(r=>new zt(t,r,s))};export{Zo as L,Ho as S,es as h,ts as y};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as j}from"node:module";import{L as J}from"./target-merge-DVJl-7Qz.js";import{osvBloomDecode as z,osvBloomProbeBatch as K,NATIVE_BINDING_VERSION as D}from"#native";let k;const V=e=>(k??=j(import.meta.url))(e),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[s,t]=h.versions.node.split(".").map(Number);if(s>22||s===22&&t>=3||s===20&&t>=16)return h.getBuiltinModule(e)}return V(e)},{createHash:H,randomUUID:P}=v("node:crypto"),{existsSync:g}=v("node:fs"),{readFile:O,mkdir:T,stat:B,writeFile:F,rename:q,unlink:G}=v("node:fs/promises"),{join:d,dirname:W}=v("node:path"),I=6;if(D!==I)throw new Error(`vis native binding ABI mismatch in osv-bloom: expected ${I}, got ${D}. Rebuild via \`pnpm --filter @visulima/vis run build:native\` or reinstall the platform binding package.`);const nt="https://endevco.github.io/osv-bloom",X=new Set(["endevco.github.io"]);class w extends Error{cause="OSV_BLOOM_SOURCE_NOT_ALLOWED";constructor(s){super(`osv-bloom source host '${s}' is not in the built-in allowlist. Add it to \`security.audit.advisories.bloom.allowedHosts\` if intentional.`),this.name="OsvBloomSourceNotAllowedError"}}class b extends Error{cause="OSV_BLOOM_NETWORK";constructor(s,t){super(`osv-bloom fetch failed for ${s}: ${t}. Check connectivity, proxy env vars, or --source.`),this.name="OsvBloomNetworkError"}}class Y extends Error{cause="OSV_BLOOM_INTEGRITY";constructor(s,t){super(`osv-bloom filter.bin sha256 mismatch (expected ${s}, got ${t}). Refusing to install a corrupted filter.`),this.name="OsvBloomIntegrityError"}}class m extends Error{cause="OSV_BLOOM_MANIFEST";constructor(s){super(`osv-bloom manifest invalid: ${s}`),this.name="OsvBloomManifestError"}}class Q extends Error{cause="OSV_BLOOM_CACHE_MISS";constructor(s){super(`No osv-bloom cache at ${s}. Run 'vis advisories bloom sync' first.`),this.name="OsvBloomCacheMissError"}}const p=e=>{const t=J("vis",{create:!0,cwd:e})??d(e,"node_modules",".cache","vis");return d(t,"osv-bloom")},l=e=>d(e,"filter.bin"),L=e=>d(e,"manifest.json"),$=e=>d(e,"state.json"),Z=(e,s)=>{let t;try{t=new URL(e)}catch{throw new w(e)}if(!t.host)throw new w(e);if(t.protocol!=="https:")throw new w(`${t.protocol}//${t.host}`);if(!new Set([...X,...s??[]]).has(t.host))throw new w(t.host);return t},at=async e=>{const s=Date.now(),t=e.cacheDir??p(e.workspaceRoot);await T(t,{recursive:!0});const r=Z(e.source,e.allowedHosts),n=new URL("manifest.json",M(r.toString())),o=new URL("filter.bin",M(r.toString())),a=await A(n,{method:"GET"});if(!a.ok)throw new b(n.toString(),a.status);const _=await a.text(),i=R(_),u=await x(t);if(!e.force&&u?.setDigestSha256===i.setDigestSha256&&g(l(t)))return{bytesOnDisk:(await B(l(t))).size,cacheDir:t,durationMs:Date.now()-s,manifest:i,upToDate:!0};const E={};!e.force&&u?.filterEtag&&(E.headers={"if-none-match":u.filterEtag});const f=await A(o,{...E,method:"GET"});if(f.status===304&&u&&g(l(t)))return await N(t,_,{fetchedAtIso:new Date().toISOString(),filterEtag:u.filterEtag,setDigestSha256:i.setDigestSha256}),{bytesOnDisk:(await B(l(t))).size,cacheDir:t,durationMs:Date.now()-s,manifest:i,upToDate:!0};if(!f.ok||!f.body)throw new b(o.toString(),f.status);const c=Buffer.from(await f.arrayBuffer());e.onProgress&&e.onProgress(c.length,c.length);const y=tt(c);if(y!==i.filterSha256)throw new Y(i.filterSha256,y);if(c.length!==i.bloomByteLen)throw new m(`filter.bin length ${c.length} does not match manifest.bloom_byte_len ${i.bloomByteLen}`);const U=f.headers.get("etag")??void 0;return await S(l(t),c),await N(t,_,{fetchedAtIso:new Date().toISOString(),filterEtag:U,setDigestSha256:i.setDigestSha256}),{bytesOnDisk:c.length,cacheDir:t,durationMs:Date.now()-s,manifest:i,upToDate:!1}},it=async(e,s)=>{const t=s?.cacheDir??p(e),r=l(t);if(!g(r)){if(s?.softFail)return null;throw new Q(t)}const n=await O(r);return z(n)},ct=(e,s)=>K(e,s),lt=async(e,s)=>{const t=s??p(e);if(!g(l(t)))return{cacheDir:t,present:!1};let n,o;try{n=R(await O(L(t),"utf8"))}catch{}try{o=await x(t)}catch{}return{cacheDir:t,fetchedAtIso:o?.fetchedAtIso,manifest:n,present:!0}},R=e=>{let s;try{s=JSON.parse(e)}catch(o){throw new m(o instanceof Error?o.message:String(o))}const t=o=>{const a=s[o];if(typeof a!="number"||Number.isNaN(a))throw new m(`field '${o}' missing or non-numeric`);return a},r=o=>{const a=s[o];if(typeof a!="string"||a.length===0)throw new m(`field '${o}' missing or empty`);return a},n=t("format_version");if(n!==1)throw new m(`unsupported format_version ${n} (this build expects v1)`);return{advisoryCount:t("advisory_count"),bloomByteLen:t("bloom_byte_len"),bloomKHashes:t("bloom_k_hashes"),bloomMBits:t("bloom_m_bits"),builtAtRfc3339:r("built_at_rfc3339"),builtAtUnix:t("built_at_unix"),entryCount:t("entry_count"),filterSha256:r("filter_sha256"),formatVersion:n,setDigestSha256:r("set_digest_sha256"),sourceUrl:r("source_url"),targetFpr:t("target_fpr")}},x=async e=>{try{const s=await O($(e),"utf8"),t=JSON.parse(s);return typeof t.setDigestSha256!="string"||typeof t.fetchedAtIso!="string"?void 0:{fetchedAtIso:t.fetchedAtIso,filterEtag:typeof t.filterEtag=="string"?t.filterEtag:void 0,setDigestSha256:t.setDigestSha256}}catch{return}},N=async(e,s,t)=>{await S(L(e),Buffer.from(s,"utf8")),await S($(e),Buffer.from(`${JSON.stringify(t,void 0,2)}
|
|
2
|
-
`,"utf8"))},S=async(e,s)=>{await T(W(e),{recursive:!0});const t=`${e}.${process.pid}.${P()}.tmp`;try{await F(t,s),await q(t,e)}catch(r){throw await G(t).catch(()=>{}),r}},tt=e=>H("sha256").update(e).digest("hex"),M=e=>e.endsWith("/")?e:`${e}/`,et=3e4,A=async(e,s)=>{try{return await fetch(e,{...s,signal:AbortSignal.timeout(et)})}catch(t){throw new b(e.toString(),t instanceof Error?t.message:String(t))}};export{nt as D,Q as O,lt as g,it as l,ct as p,at as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as U}from"node:module";import{e as y,m as O,b as S,z as J}from"./index-BzhrR_iC.js";import{withEnhancedPath as Y,collectNodeModulesBinDirs as z}from"@visulima/task-runner";import{s as j}from"./index-B4AjSxHU.js";import{detectPackageManager as G,resolveAdd as H,resolveRemove as V,whichBin as X,resolveUnlink as K,resolveInstall as Q,execPmCommandInteractive as Z,resolveDlx as ee,resolveExec as ne,resolveDedupe as re,resolveWhy as se,resolveLink as ae,resolvePmCommand as ie}from"#native";import{y as R}from"./isAccessibleSync-DYKTrrvc-C-_5cgwu.js";let T;const x=e=>(T??=U(import.meta.url))(e),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,q=e=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[n,r]=k.versions.node.split(".").map(Number);if(n>22||n===22&&r>=3||n===20&&r>=16)return k.getBuiltinModule(e)}return x(e)},{spawn:F,spawnSync:E}=q("node:child_process"),p=(e,n,r,s)=>{for(const a of n)e.push("--filter",a);r&&e.push("--recursive"),s&&e.push("--workspace-root")},te=e=>{const n=[],r=[];return p(n,e.filter,e.recursive,e.workspaceRoot),e.silent&&n.push("--silent"),e.frozenLockfile&&n.push("--frozen-lockfile"),n.push("install"),e.dev&&n.push("--dev"),e.prod&&n.push("--prod"),e.force&&n.push("--force"),e.ignoreScripts&&n.push("--ignore-scripts"),e.lockfileOnly&&n.push("--lockfile-only"),e.noOptional&&n.push("--no-optional"),e.offline&&n.push("--offline"),{args:n,bin:"aube",warnings:r}},oe=e=>{const n=[],r=[];return p(n,e.filter,!1,!1),n.push("add"),e.saveDev&&n.push("--save-dev"),e.exact&&n.push("--save-exact"),e.global&&n.push("--global"),e.optional&&n.push("--save-optional"),e.peer&&n.push("--save-peer"),e.workspace&&r.push("aube has no flag for the `workspace:` protocol; it auto-detects local workspace members during add. Ignoring --workspace."),e.workspaceRoot&&n.push("--workspace"),n.push(...e.packages),{args:n,bin:"aube",warnings:r}},ue=e=>{const n=[];return p(n,e.filter,e.recursive,!1),n.push("remove"),e.saveDev&&n.push("--save-dev"),e.global&&n.push("--global"),e.workspaceRoot&&n.push("--workspace"),n.push(...e.packages),{args:n,bin:"aube",warnings:[]}},ce=e=>{const n=["dedupe"];return e&&n.push("--check"),{args:n,bin:"aube",warnings:[]}},le=e=>{const n=[],r=[];p(n,e.filter,e.recursive,!1),n.push("why"),e.dev&&n.push("--dev"),e.prod&&n.push("--prod"),e.json&&n.push("--json"),e.long&&n.push("--long"),e.parseable&&n.push("--parseable"),e.depth!==void 0&&r.push("aube why does not accept --depth; ignoring."),e.noOptional&&r.push("aube why does not accept --no-optional; ignoring."),e.global&&r.push("aube why does not accept --global; ignoring.");const[s,...a]=e.packages;return s===void 0?r.push("aube why requires a package name; none provided."):(a.length>0&&r.push("aube why takes a single package; using the first."),n.push(s)),{args:n,bin:"aube",warnings:r}},fe=e=>{const n=[];e.silent&&n.push("--silent"),n.push("dlx");for(const r of e.additionalPackages)n.push("--package",r);return e.shellMode&&n.push("--shell-mode"),n.push(e.package),n.push(...e.args),{args:n,bin:"aube",warnings:[]}},de=e=>{const n=[];return p(n,e.filter,e.recursive,e.workspaceRoot),n.push("exec"),e.parallel&&n.push("--parallel"),e.reverse&&n.push("--reverse"),e.shellMode&&n.push("--shell-mode"),n.push(e.command),n.push(...e.args),{args:n,bin:"aube",warnings:[]}},he=e=>{const n=["link"];return e!==null&&n.push(e),{args:n,bin:"aube",warnings:[]}},pe=(e,n)=>{const r=[],s=[];return n&&r.push("--recursive"),r.push("unlink"),e.length>1&&s.push("aube unlink takes a single package; using the first."),e.length>0&&r.push(e[0]),{args:r,bin:"aube",warnings:s}},ge=e=>{const n=["view","--",e.package],r=[],[s,...a]=e.fields;return s!==void 0?(a.length>0&&r.push("aube view only supports a single field; using the first."),e.json&&r.push("aube view does not support --json with a field selector; printing the field without --json."),n.push(s)):e.json&&n.push("--json"),{args:n,bin:"aube",warnings:r}},Ye=e=>{const n=[],r=[];return p(n,e.filters,e.recursive,e.workspaceRoot),n.push("update"),e.dev&&n.push("--dev"),e.prod&&n.push("--prod"),e.global&&n.push("--global"),e.interactive&&n.push("--interactive"),e.latest&&n.push("--latest"),e.noOptional&&n.push("--no-optional"),e.noSave&&n.push("--no-save"),n.push(...e.packages),{args:n,bin:"aube",warnings:r}},be=new Set(["fund","ping","search","token"]),ke=(e,n)=>be.has(e)?{args:[e,...n],bin:"npm",warnings:[`'${e}' is not natively supported by aube. Delegating to npm.`]}:{args:[e,...n],bin:"aube",warnings:[]},w=256*1024,we=e=>{const n=e?{...process.env,...e}:{...process.env};return process.stderr.isTTY&&n.FORCE_COLOR===void 0&&n.NO_COLOR===void 0&&(n.FORCE_COLOR="1"),n},I=e=>e!==""&&!/[\s"&()<>^|%!]/u.test(e)?e:`"${e.replaceAll(/(\\*)"/gu,String.raw`$1$1\"`).replace(/(\\+)$/u,"$1$1").replaceAll(/[&()<>^|%!]/gu,String.raw`^$&`)}"`,ve=async(e,n,r)=>new Promise((s,a)=>{const i=process.platform==="win32",t=F(i?I(e):e,i?n.map(o=>I(o)):[...n],{cwd:r.cwd,env:we(r.env),shell:i,stdio:["inherit","pipe","pipe"],windowsHide:!0});let c=[],f=0;const d=o=>{if(c.push(o),f+=o.length,!(f<=w)){for(;c.length>1&&f-c[0].length>w;)f-=c.shift().length;if(c.length===1&&f>w){const h=c[0];c[0]=h.subarray(h.length-w),f=w}}},b=()=>Buffer.concat(c).toString("utf8");t.stdout?.on("data",o=>{process.stdout.write(o),d(o)}),t.stderr?.on("data",o=>{process.stderr.write(o),d(o)}),t.on("error",a),t.on("close",o=>{const h=b();c=[],s({code:o??1,output:h})})}),v=e=>{const n=j.coerce(e);return n?j.gte(n,"11.0.0"):!1},l=e=>e.name==="yarn"&&!e.version.startsWith("1."),$=e=>e.name==="yarn"&&e.version.startsWith("1."),ye=e=>e[0]==="rm"?["remove",...e.slice(1)]:e,me=(e,n,r)=>{switch(n){case"audit":return l(e)?{args:["npm","audit",...r],bin:"yarn",kind:"rewrite"}:{kind:"passthrough"};case"config":{if(l(e)){const[s,...a]=r;return s==="delete"?{args:["config","unset",...a],bin:"yarn",kind:"rewrite",warning:"yarn berry uses `config unset`, not `config delete`."}:{kind:"passthrough"}}return e.name==="bun"?{kind:"skip",warning:"bun has no `config` CLI. Edit bunfig.toml or .npmrc directly."}:e.name==="deno"?{kind:"skip",warning:"deno has no registry-config CLI. Edit deno.json directly."}:{kind:"passthrough"}}case"dist-tag":return $(e)?{args:["tag",...r],bin:"yarn",kind:"rewrite",warning:"yarn 1 has no `dist-tag`; using `yarn tag`."}:l(e)?{args:["npm","tag",...ye(r)],bin:"yarn",kind:"rewrite"}:e.name==="bun"||e.name==="deno"?{kind:"skip",warning:`${e.name} has no \`dist-tag\`. Use \`npm dist-tag\` instead.`}:{kind:"passthrough"};case"login":case"logout":return l(e)?{args:["npm",n,...r],bin:"yarn",kind:"rewrite"}:e.name==="bun"?{args:[n,...r],bin:"npm",kind:"rewrite",warning:`bun has no \`${n}\`; falling back to \`npm ${n}\` (writes ~/.npmrc, which bun reads).`}:e.name==="deno"?{kind:"skip",warning:`deno has no \`${n}\`. JSR uses browser OAuth via \`deno publish\`.`}:{kind:"passthrough"};case"owner":return e.name==="pnpm"&&v(e.version)?{args:["owner",...r],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `owner`; falling back to `npm owner`."}:l(e)?{args:["owner",...r],bin:"npm",kind:"rewrite",warning:"yarn berry has no `owner` (not in `yarn npm`); falling back to `npm owner`."}:e.name==="bun"?{args:["owner",...r],bin:"npm",kind:"rewrite",warning:"bun has no `owner`; falling back to `npm owner`."}:e.name==="deno"?{kind:"skip",warning:"deno has no `owner`. JSR uses scope-member roles via the web UI."}:{kind:"passthrough"};case"ping":return e.name==="pnpm"&&v(e.version)?{args:["ping",...r],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `ping`; falling back to `npm ping`."}:{kind:"passthrough"};case"plugin":return l(e)?{kind:"passthrough"}:{kind:"skip",warning:`${e.name} does not support yarn-style plugins. Skipping (no-op).`};case"prune":return $(e)?{kind:"skip",warning:"yarn 1 has no `prune`. Use `yarn install --production` for a prod-only tree."}:l(e)?{kind:"skip",warning:"yarn berry has no `prune`. Use `yarn workspaces focus --production` instead."}:e.name==="bun"||e.name==="deno"?{kind:"skip",warning:`${e.name} has no \`prune\`. Pruning happens automatically on install.`}:{kind:"passthrough"};case"publish":return l(e)?{args:["npm","publish",...r],bin:"yarn",kind:"rewrite"}:{kind:"passthrough"};case"rebuild":return $(e)?{kind:"skip",warning:"yarn 1 has no `rebuild`. Re-install instead."}:e.name==="bun"?{kind:"skip",warning:"bun has no `rebuild`. Use `bun install --force` instead."}:e.name==="deno"?{kind:"skip",warning:"deno has no `rebuild`."}:{kind:"passthrough"};case"search":return e.name==="pnpm"&&v(e.version)?{args:["search",...r],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `search`; falling back to `npm search`."}:{kind:"passthrough"};case"token":return e.name==="pnpm"&&v(e.version)?{args:["token",...r],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `token`; falling back to `npm token`."}:{kind:"passthrough"};case"whoami":return e.name==="pnpm"&&v(e.version)?{args:["whoami",...r],bin:"npm",kind:"rewrite",warning:"pnpm 11 removed `whoami`; falling back to `npm whoami`."}:l(e)?{args:["npm","whoami",...r],bin:"yarn",kind:"rewrite"}:e.name==="bun"?{args:["pm","whoami",...r],bin:"bun",kind:"rewrite"}:e.name==="deno"?{kind:"skip",warning:"deno has no `whoami`. JSR uses browser auth."}:{kind:"passthrough"};default:return{kind:"passthrough"}}},A=e=>X(e)!==null,je=e=>{const n=[["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["package-lock.json","npm"],["npm-shrinkwrap.json","npm"],["bun.lock","bun"],["bun.lockb","bun"],["deno.lock","deno"]];let r=e;for(;;){for(const[a,i]of n)if(R(y(r,a)))return i;const s=O(r);if(s===r||S(r).root===r)return;r=s}},ze=(e,n)=>{if(n.name!=="aube")return;const r=je(e);if(r!==void 0)return`Resolved installer is aube but the workspace has a ${r} lockfile. Aube reads and writes ${r}'s lockfile format in place, but its byte output may differ subtly — expect a one-time churn diff on the first install, and ongoing drift if your team mixes tools on the same lockfile. To pin the choice across the team, set \`install.backend\` in vis.config; to bypass aube for this run, pass --no-aube.`},C=e=>{if(R(e))try{return JSON.parse(J(e,{buffer:!1}))}catch{return}},Re=e=>{let n=e;for(;;){const r=y(n,"package.json"),s=C(r);if(s&&typeof s.packageManager=="string"&&s.packageManager.length>0)return s.packageManager;const a=O(n);if(a===n||S(n).root===n)return;n=a}},M=new Set(["npm","pnpm","yarn"]),P=(e,n,r)=>r===!1||!M.has(n)||!A("corepack")?!1:r===!0?!0:Re(e)!==void 0,Ge=(e,n)=>{const r=n.backend,s=process.env.VIS_INSTALLER,a=r??s??n.configBackend,i=n.configCorepack??"auto";if(a&&a!=="auto"){if(a==="aube"&&!A("aube"))throw new Error('install.backend is set to "aube" but the `aube` binary is not on PATH. Install it via `npm i -g @endevco/aube`, `mise use -g aube`, or `brew install endevco/tap/aube`.');return{name:a,useCorepack:P(e,a,i),version:"latest"}}if(A("aube"))return{name:"aube",useCorepack:!1,version:"latest"};const t=$e(e);return{...t,useCorepack:P(e,t.name,i)}},$e=e=>{if(!R(e))throw new Error(`Could not detect package manager in ${e}. Directory does not exist.`);const n=G(e);return{name:n.name,version:n.version||"latest"}},L=(e,n)=>n.useCorepack!==!0||!M.has(n.name)||e.bin==="corepack"||e.bin!==n.name?e:{...e,args:[n.name,...e.args],bin:"corepack"},Ae=(e,n,r)=>{if(r===void 0)return Z(e.bin,e.args,n);const s=E(e.bin,e.args,{cwd:n,env:{...process.env,...r},stdio:"inherit"});if(s.error)throw s.error;return s.status??1},u=(e,n,r,s,a={})=>{const i=L(n,e);for(const t of i.warnings)s.warn(`warning: ${t}`);return a.dry?(s.log(`[dry-run] ${i.bin} ${i.args.join(" ")}`),0):Ae(i,r,a.env)},g=(e,n,r,s,a={})=>u(e,n(),r,s,a),Oe=(e,n)=>n==="aube"||n==="deno"?e:{...e,args:[...e.args,"--prefer-offline"]},Se=(e,n,r)=>n!=="yarn"||r.startsWith("1.")||!e.args.includes("--immutable")||e.args.includes("--immutable-cache")?e:{...e,args:[...e.args,"--immutable-cache"]},W=(e,n,r)=>{let s=e.name==="aube"?te(n):Q(e.name,e.version,{...n,silent:n.silent||r.silent===!0});return r.preferOffline&&(s=Oe(s,e.name)),r.ciMode&&(s=Se(s,e.name,e.version)),s},He=(e,n,r,s,a={})=>{const i=W(e,n,a);return D(e,i,r,s,{dry:a.dry,env:a.env})},Ve=async(e,n,r,s,a={})=>{const i=L(W(e,n,a),e);for(const t of i.warnings)s.warn(`warning: ${t}`);return a.dry?(s.log(`[dry-run] ${i.bin} ${i.args.join(" ")}`),{code:0,output:""}):ve(i.bin,i.args,{cwd:r,env:a.env?{...process.env,...a.env}:process.env})},N=(e,n)=>{const r=n==="deno"?"--quiet":"--silent";return{...e,args:[...e.args,r]}},Ce=(e,n)=>n==="yarn"||n==="aube"?null:{...e,args:[...e.args,"--dry-run"]},D=(e,n,r,s,a)=>{if(a.dry!==!0)return u(e,n,r,s,a);const i=Ce(n,e.name);return i===null?u(e,n,r,s,a):u(e,i,r,s,{env:a.env})},De=(e,n)=>n==="aube"?{...e,args:[...e.args,"--ignore-scripts"]}:n==="deno"?e:{...e,args:[...e.args,"--ignore-scripts"]},_e=(e,n,r,s,a={})=>{let i=e.name==="aube"?oe(n):H(e.name,e.version,n);a.ignoreScripts&&(i=De(i,e.name)),a.silent&&(i=N(i,e.name));const t=D(e,i,r,s,{dry:a.dry,env:a.env});return t===0&&a.autoInstallPeers&&Me(e,n,r,s,a),t},Ie=e=>{if(e.startsWith("@")){const r=e.indexOf("/");if(r===-1)return e;const s=e.indexOf("@",r);return s===-1?e:e.slice(0,s)}const n=e.indexOf("@");return n===-1?e:e.slice(0,n)},Pe=(e,n)=>{let r=e;for(;;){const s=y(r,"node_modules",n,"package.json"),a=C(s);if(a)return a;const i=O(r);if(i===r||S(r).root===r)return;r=i}},Ee=e=>{const n=C(y(e,"package.json")),r=new Set;if(!n)return r;for(const s of["dependencies","devDependencies","peerDependencies","optionalDependencies"]){const a=n[s];if(a)for(const i of Object.keys(a))r.add(i)}return r},Me=(e,n,r,s,a)=>{if(e.name==="deno")return;const i=Ee(r),t=new Map;for(const d of n.packages){const b=Ie(d),o=Pe(r,b);if(!o?.peerDependencies)continue;const h=o.peerDependenciesMeta??{};for(const[m,B]of Object.entries(o.peerDependencies))h[m]?.optional||i.has(m)||t.has(m)||t.set(m,B)}if(t.size===0)return;const c=[...t.entries()].map(([d,b])=>`${d}@${b}`);s.log(`auto-installing peer dependencies: ${c.join(", ")}`);const f={exact:!1,filter:n.filter,global:!1,optional:!1,packages:c,peer:!1,saveDev:n.saveDev,workspace:!1,workspaceRoot:n.workspaceRoot};_e(e,f,r,s,{ignoreScripts:a.ignoreScripts})},Xe=(e,n,r,s,a={})=>{let i=e.name==="aube"?ue(n):V(e.name,e.version,n);return a.silent&&(i=N(i,e.name)),D(e,i,r,s,{dry:a.dry,env:a.env})},Ke=(e,n,r,s,a={})=>e.name==="aube"?u(e,ce(n),r,s,a):g(e,()=>re(e.name,e.version,n),r,s,a),Qe=(e,n,r,s,a={})=>e.name==="aube"?u(e,le(n),r,s,a):g(e,()=>se(e.name,e.version,n),r,s,a),Le=(e,n)=>{if(e.name==="aube")return ge(n);const r=[],s=[],a=e.name;switch(e.name){case"bun":{const i=j.coerce(e.version);i&&j.lt(i,"1.3.0")&&s.push(`bun ${e.version} does not support \`bun pm view\` (added in bun 1.3). Upgrade bun, or run \`npm view ${n.package}\` instead.`),r.push("pm","view","--",n.package,...n.fields),n.json&&r.push("--json");break}case"deno":{const i=n.package.startsWith("npm:")||n.package.startsWith("jsr:")||n.package.startsWith("https://")||n.package.startsWith("http://")||n.package.startsWith("file:")?n.package:`npm:${n.package}`;r.push("info","--",i),n.json&&r.push("--json"),n.fields.length>0&&s.push("deno info does not accept field selectors; ignoring.");break}case"npm":case"pnpm":{r.push("view","--",n.package,...n.fields),n.json&&r.push("--json");break}case"yarn":{if(e.version.startsWith("1.")){r.push("info","--",n.package);const[i,...t]=n.fields;i!==void 0&&(t.length>0&&s.push("yarn v1 only supports querying one field at a time; using the first."),r.push(i)),n.json&&r.push("--json")}else r.push("npm","info","--",n.package),n.fields.length>0&&s.push("yarn berry does not support field arguments to 'npm info'; ignoring."),n.json&&r.push("--json");break}default:{const i=e.name;throw new Error(`Unsupported package manager: ${i}`)}}return{args:r,bin:a,warnings:s}},Ze=(e,n,r,s,a={})=>u(e,Le(e,n),r,s,a),en=(e,n,r,s,a={})=>e.name==="aube"?u(e,he(n),r,s,a):g(e,()=>ae(e.name,e.version,n),r,s,a),nn=(e,n,r,s,a,i={})=>e.name==="aube"?u(e,pe(n,r),s,a,i):g(e,()=>K(e.name,e.version,n,r),s,a,i),We=(e,n,r)=>{if(e.args.includes("--offline")||e.args.includes("--cached-only"))return e;const s=(a,i)=>{const t=[...e.args];return t.splice(i,0,a),{...e,args:t}};switch(n){case"aube":case"pnpm":return s("--offline",1);case"bun":return{...e,warnings:[...e.warnings,"bun x does not support --offline. Pre-install the package via `vis install` so bun x resolves from the local cache."]};case"deno":return s("--cached-only",1);case"npm":return s("--offline",1);case"yarn":return r.startsWith("1.")?s("--offline",0):{...e,warnings:[...e.warnings,"yarn berry has no --offline flag for dlx. Configure `enableNetwork: false` in .yarnrc.yml or set `enableMirror: true` for offline-first behavior."]};default:{const a=n;return{...e,warnings:[...e.warnings,`applyDlxOffline: unsupported pm ${String(a)}`]}}}},rn=(e,n,r,s,a={})=>{let i=e.name==="aube"?fe(n):ee(e.name,e.version,n);return a.offline&&(i=We(i,e.name,e.version)),u(e,i,r,s,{dry:a.dry,env:a.env})},_=process.platform==="win32",Ne=_?[".exe",".cmd",".bat",".ps1",""]:[""],Be=(e,n)=>{if(!(e.includes("/")||e.includes("\\")))for(const r of z(n))for(const s of Ne){const a=y(r,`${e}${s}`);if(R(a))return _?a.replaceAll("/","\\"):a}},sn=(e,n,r)=>{const s=Be(e,r);if(s===void 0||_&&!s.toLowerCase().endsWith(".exe"))return null;const a=E(s,n,{cwd:r,env:Y({...process.env},r),stdio:"inherit"});if(a.error)throw a.error;return a.status??1},an=(e,n,r,s,a={})=>e.name==="aube"?u(e,de(n),r,s,a):g(e,()=>ne(e.name,e.version,n),r,s,a),tn=(e,n,r,s,a,i={})=>{if(e.name==="aube")return u(e,ke(n,r),s,a,i);const t=me(e,n,r);return t.kind==="skip"?(a.warn(`warning: ${t.warning}`),0):t.kind==="rewrite"?u(e,{args:t.args,bin:t.bin,warnings:t.warning?[t.warning]:[]},s,a,i):g(e,()=>ie(e.name,e.version,n,r),s,a,i)};export{Ge as a,an as b,_e as c,$e as d,Ke as e,Ze as f,ze as g,Ve as h,en as i,tn as j,Xe as k,nn as l,Qe as m,He as n,rn as o,Ye as p,sn as r,ve as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as d,m as E,b}from"./index-BzhrR_iC.js";import{y as u}from"./isAccessibleSync-DYKTrrvc-C-_5cgwu.js";const g={id:"bun",label:"Bun",lockfiles:["bun.lock","bun.lockb"],scriptSource:"package.json"},R={id:"node",label:"Node.js",lockfiles:["pnpm-lock.yaml","yarn.lock","package-lock.json","npm-shrinkwrap.json"],scriptSource:"package.json"},l={bun:g,node:R},a=["node","bun"],i={"deno.lock":"deno"},j=a.flatMap(n=>l[n].lockfiles.map(e=>[e,n])),p="Deno is not supported yet (deferred — see rfc/design-runtime-multitool.md).",s=(n,e)=>{if(n==="node"||n==="bun")return n;throw n in i||n==="deno"?new Error(`${e} requested runtime "${n}", but ${p}`):new Error(`${e} requested unknown runtime "${n}". Supported: ${a.join(", ")}.`)},D=n=>{let e=n;for(;;){for(const[o,t]of j)if(u(d(e,o)))return{runtime:t};for(const o of Object.keys(i))if(u(d(e,o)))return{deferred:i[o]};const r=E(e);if(r===e||b(e).root===e)return{};e=r}},$=(n,e={})=>{const r=e.env??process.env,o=(f,m,k)=>({adapter:l[f],deferredNotice:k,runtime:f,source:m});if(e.flag!==void 0&&e.flag!=="")return o(s(e.flag,"--runtime"),"flag");const t=r.VIS_RUNTIME;if(t!==void 0&&t!=="")return o(s(t,"VIS_RUNTIME"),"env");if(e.config!==void 0)return o(s(e.config,"config runtime:"),"config");const c=D(n);return c.runtime!==void 0?o(c.runtime,"lockfile"):c.deferred!==void 0?o("node","default",`Detected a ${c.deferred} project but ${p} Falling back to node.`):o("node","default")};export{$ as r};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{createRequire as ue}from"node:module";import{_ as he}from"./index-BzhrR_iC.js";import{y as be}from"./isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{U as ve}from"./writeFileSync-DJoHk3Ks-BPRoepNw.js";let me;const de=e=>(me??=ue(import.meta.url))(e),x=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ge=e=>{if(typeof x<"u"&&x.versions&&x.versions.node){const[t,s]=x.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return x.getBuiltinModule(e)}return de(e)},{createRequire:ne}=ge("node:module"),ye=/^(?:( )+|\t+)/,M="space";function Z(e,t,s){return e&&t===M&&s===1}function G(e,t){const s=new Map;let o=0,r,n;for(const c of e.split(/\n/g)){if(!c)continue;const i=c.match(ye);if(i===null)o=0,r="";else{const u=i[0].length,a=i[1]?M:"tab";if(Z(t,a,u))continue;a!==r&&(o=0),r=a;let l=1,p=0;const f=u-o;if(o=u,f===0)l=0,p=1;else{const g=Math.abs(f);if(Z(t,a,g))continue;n=xe(a,g)}const m=s.get(n);s.set(n,m===void 0?[1,0]:[m[0]+l,m[1]+p])}}return s}function xe(e,t){return(e===M?"s":"t")+String(t)}function we(e){const t=e[0]==="s"?M:"tab",s=Number(e.slice(1));return{type:t,amount:s}}function Te(e){let t,s=0,o=0;for(const[r,[n,c]]of e)(n>s||n===s&&c>o)&&(s=n,o=c,t=r);return t}function ke(e,t){return(e===M?" ":" ").repeat(t)}function ze(e){if(typeof e!="string")throw new TypeError("Expected a string");let t=G(e,!0);t.size===0&&(t=G(e,!1));const s=Te(t);let o,r=0,n="";return s!==void 0&&({type:o,amount:r}=we(s),n=ke(o,r)),{amount:r,type:o,indent:n}}let $e;const Ee=e=>($e??=ne(import.meta.url))(e),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ne=e=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[t,s]=w.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return w.getBuiltinModule(e)}return Ee(e)},{readFileSync:Se}=Ne("node:fs"),os=(e,t,s={})=>{const{detectIndent:o,indent:r,replacer:n,stringify:c=JSON.stringify,...i}={indent:" ",...s};let u=r,a=`
|
|
2
|
-
`;if(be(e,he))try{const p=Se(e,"utf8");if(o){const{indent:f}=ze(p);u=f}a=p.endsWith(`
|
|
3
|
-
`)?`
|
|
4
|
-
`:""}catch(p){if(p.code!=="ENOENT")throw p}const l=c(t,n,u);ve(e,`${l}${a}`,i)};let _e;const je=e=>(_e??=ne(import.meta.url))(e),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,re=e=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[t,s]=b.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return b.getBuiltinModule(e)}return je(e)},{homedir:Ce,tmpdir:B}=re("node:os"),{env:A,cwd:Ie,platform:V}=b,{createRequire:h}=re("node:module"),Ae=0,ie=2,Oe=Symbol("findUpStop"),Me=/^[A-Z]:\//i,y=(e="")=>e&&e.replaceAll("\\","/").replace(Me,t=>t.toUpperCase()),Re=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,ce=/^[A-Z]:$/i,Le=/[^/](\.[^./]+)$/,De=/^[/\\]|^[a-z]:[/\\]/i,Be=/\/$/,Fe=()=>{if(typeof process.cwd=="function")try{const e=process.cwd();if(typeof e=="string")return y(e)}catch{}return"/"},Ue=(e,t)=>{let s="",o=0,r=-1,n=0,c;for(let i=0;i<=e.length;++i){if(i<e.length)c=e[i];else{if(c==="/")break;c="/"}if(c==="/"){if(!(r===i-1||n===1))if(n===2){if(s.length<2||o!==2||!s.endsWith(".")||s.at(-2)!=="."){if(s.length>2){const u=s.lastIndexOf("/");u===-1?(s="",o=0):(s=s.slice(0,u),o=s.length-1-s.lastIndexOf("/")),r=i,n=0;continue}else if(s.length>0){s="",o=0,r=i,n=0;continue}}t&&(s+=s.length>0?"/..":"..",o=2)}else s.length>0?s+=`/${e.slice(r+1,i)}`:s=e.slice(r+1,i),o=i-r-1;r=i,n=0}else c==="."&&n!==-1?++n:n=-1}return s},O=e=>Re.test(e),F=function(...e){e=e.map(o=>y(o));let t="",s=!1;for(let o=e.length-1;o>=-1&&!s;o--){const r=o>=0?e[o]:Fe();!r||r.length===0||(t=`${r}/${t}`,s=O(r))}return t=Ue(t,!s),ce.test(t)?`${t}/`:s&&!O(t)?`/${t}`:t.length>0?t:"."},Pe=function(e){return Le.exec(y(e))?.[1]??""},le=e=>{const t=y(e).replace(Be,""),s=t.lastIndexOf("/");if(s===-1)return O(e)?"/":".";const o=t.slice(0,s);return ce.test(o)?`${o}/`:o||(O(e)?"/":".")},qe=(e,t)=>{const s=y(e);return s.slice(s.lastIndexOf("/")+1)},We=function(e){const t=De.exec(e)?.[0]?.replaceAll("\\","/")??"",s=qe(e),o=Pe(s);return{base:s,dir:le(e),ext:o,name:s.slice(0,s.length-o.length),root:t}};let He;const Ze=e=>(He??=h(import.meta.url))(e),T=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ge=e=>{if(typeof T<"u"&&T.versions&&T.versions.node){const[t,s]=T.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return T.getBuiltinModule(e)}return Ze(e)},{fileURLToPath:Ve}=Ge("node:url");function Xe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var X,Y;function Ye(){return Y||(Y=1,X=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),X}var Je=Ye();const Ke=Xe(Je);new Set(Ke);const L=e=>y(e instanceof URL?Ve(e):e),pe=e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},J=e=>{if(e.isFile())return"file";if(e.isDirectory())return"dir";if(e.isSymbolicLink())return"symlink"};let Qe;const et=e=>(Qe??=h(import.meta.url))(e),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,tt=e=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[t,s]=k.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return k.getBuiltinModule(e)}return et(e)},{lstat:ns,mkdir:rs}=tt("node:fs/promises");let st;const ot=e=>(st??=h(import.meta.url))(e),z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,nt=e=>{if(typeof z<"u"&&z.versions&&z.versions.node){const[t,s]=z.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return z.getBuiltinModule(e)}return ot(e)},{lstatSync:K,mkdirSync:rt}=nt("node:fs"),$=e=>{pe(e);try{const t=K(e);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(J(t))}'`);return}catch(t){if(t.code!=="ENOENT")throw t}try{rt(e,{recursive:!0})}catch(t){if(t.code!=="EEXIST")throw t;const s=K(e);if(!s.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(J(s))}'`,{cause:t})}};let it;const ct=e=>(it??=h(import.meta.url))(e),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,lt=e=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[t,s]=E.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return E.getBuiltinModule(e)}return ct(e)},{stat:is,lstat:cs}=lt("node:fs/promises");let pt;const at=e=>(pt??=h(import.meta.url))(e),N=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ft=e=>{if(typeof N<"u"&&N.versions&&N.versions.node){const[t,s]=N.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return N.getBuiltinModule(e)}return at(e)},{statSync:ut,lstatSync:mt}=ft("node:fs"),dt=(e,t={})=>{const s=t.cwd?L(t.cwd):process.cwd();let o=F(s);const{root:r}=We(o),n=L(t.stopAt??r),c=F(o,n),i=t.type??"file",u=function(l){return[e]};t.allowSymlinks??=!0;const a=t.allowSymlinks?ut:mt;for(;o;){for(let l of u()){if(l===Oe)return;if(l===void 0)continue;Buffer.isBuffer(l)?l=l.toString():l instanceof URL&&(l=L(l));const p=O(l)?l:F(o,l);try{const f=a(p);if(i==="file"&&f.isFile()||i==="directory"&&f.isDirectory())return p}catch{}}if(o===c||o===r)break;o=le(o)}};let gt;const ht=e=>(gt??=h(import.meta.url))(e),S=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,bt=e=>{if(typeof S<"u"&&S.versions&&S.versions.node){const[t,s]=S.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return S.getBuiltinModule(e)}return ht(e)},{access:ls}=bt("node:fs/promises");let vt;const yt=e=>(vt??=h(import.meta.url))(e),_=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,xt=e=>{if(typeof _<"u"&&_.versions&&_.versions.node){const[t,s]=_.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return _.getBuiltinModule(e)}return yt(e)},{accessSync:wt}=xt("node:fs");function D(e,t=Ae){pe(e),e=L(e);try{return wt(e,t),!0}catch{return!1}}class Tt extends Error{constructor(t){super(`ENOENT: ${t}`)}get code(){return"ENOENT"}set code(t){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(t){throw new Error("Cannot overwrite name of NotFoundError")}}let kt;const zt=e=>(kt??=h(import.meta.url))(e),j=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,q=e=>{if(typeof j<"u"&&j.versions&&j.versions.node){const[t,s]=j.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return j.getBuiltinModule(e)}return zt(e)},$t=q("fs"),Et=q("os"),Nt=q("path");var U={},Q;function St(){if(Q)return U;Q=1;var e=Object.defineProperty,t=(l,p)=>e(l,"name",{value:p,configurable:!0}),s=$t,o=Et,r=Nt;const n=t(l=>{let p="";for(let f=0;f<l.length;f+=1){const m=l[f],g=m.toUpperCase();p+=m===g?m.toLowerCase():g}return p},"invertCase"),c=new Map,i=t((l,p)=>{const f=r.join(l,`.is-fs-case-sensitive-test-${process.pid}`);try{return p.writeFileSync(f,""),!p.existsSync(n(f))}finally{try{p.unlinkSync(f)}catch{}}},"checkDirectoryCaseWithWrite"),u=t((l,p,f)=>{try{return i(l,f)}catch(m){if(p===void 0)return i(o.tmpdir(),f);throw m}},"checkDirectoryCaseWithFallback"),a=t((l,p=s,f=!0)=>{const m=l??process.cwd();if(f&&c.has(m))return c.get(m);let g;const H=n(m);return H!==m&&p.existsSync(m)?g=!p.existsSync(H):g=u(m,l,p),f&&c.set(m,g),g},"isFsCaseSensitive");return U.isFsCaseSensitive=a,U}var _t=St();_t.isFsCaseSensitive;const jt=/^[A-Z]:\//i,R=(e="")=>e&&e.replaceAll("\\","/").replace(jt,t=>t.toUpperCase()),Ct=/^[/\\]{2}/,It=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,W=/^[A-Z]:$/i,At=/\/$/,Ot=()=>{if(typeof process.cwd=="function")try{const e=process.cwd();if(typeof e=="string")return R(e)}catch{}return"/"},P="/",ae=(e,t)=>{let s="",o=0,r=-1,n=0,c;for(let i=0;i<=e.length;++i){if(i<e.length)c=e[i];else{if(c==="/")break;c="/"}if(c==="/"){if(!(r===i-1||n===1))if(n===2){if(s.length<2||o!==2||!s.endsWith(".")||s.at(-2)!=="."){if(s.length>2){const u=s.lastIndexOf("/");u===-1?(s="",o=0):(s=s.slice(0,u),o=s.length-1-s.lastIndexOf("/")),r=i,n=0;continue}else if(s.length>0){s="",o=0,r=i,n=0;continue}}t&&(s+=s.length>0?"/..":"..",o=2)}else s.length>0?s+=`/${e.slice(r+1,i)}`:s=e.slice(r+1,i),o=i-r-1;r=i,n=0}else c==="."&&n!==-1?++n:n=-1}return s},v=e=>It.test(e),Mt=function(e){if(e.length===0)return".";e=R(e);const t=Ct.exec(e),s=v(e),o=e.at(-1)==="/";return e=ae(e,!s),e.length===0?s?"/":o?"./":".":(o&&(e+="/"),W.test(e)&&(e+="/"),t?s?`//${e}`:`//./${e}`:s&&!v(e)?`/${e}`:e)},d=(...e)=>{let t="";for(const s of e)if(s)if(t.length>0){const o=t.at(-1)==="/",r=s[0]==="/";o&&r?t+=s.slice(1):t+=o||r?s:`/${s}`}else t+=s;return Mt(t)},Rt=function(...e){e=e.map(o=>R(o));let t="",s=!1;for(let o=e.length-1;o>=-1&&!s;o--){const r=o>=0?e[o]:Ot();!r||r.length===0||(t=`${r}/${t}`,s=v(r))}return t=ae(t,!s),W.test(t)?`${t}/`:s&&!v(t)?`/${t}`:t.length>0?t:"."},Lt=e=>{const t=R(e).replace(At,""),s=t.lastIndexOf("/");if(s===-1)return v(e)?"/":".";const o=t.slice(0,s);return W.test(o)?`${o}/`:o||(v(e)?"/":".")};let Dt;const Bt=e=>(Dt??=h(import.meta.url))(e),C=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ft=e=>{if(typeof C<"u"&&C.versions&&C.versions.node){const[t,s]=C.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return C.getBuiltinModule(e)}return Bt(e)},{fileURLToPath:Ut}=Ft("node:url");function Pt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ee,te;function qt(){return te||(te=1,ee=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),ee}var Wt=qt();const Ht=Pt(Wt);new Set(Ht);const fe=e=>R(e instanceof URL?Ut(e):e),se=e=>{const t=Ce();if(V==="win32"){const n=A.LOCALAPPDATA,c=t?d(t,"AppData","Local"):B(),i=n&&n.length>0?n:c;return d(i,e,"Cache")}if(V==="darwin"){const n=t?d(t,"Library","Caches"):B();return d(n,e)}const s=A.XDG_CACHE_HOME,o=t?d(t,".cache"):B(),r=s&&s.length>0?s:o;return d(r,e)},Zt=e=>{if(e.length===0)return;const t=e.map(n=>Rt(fe(n)).split(P));let s=Number.POSITIVE_INFINITY;for(const n of t)n.length<s&&(s=n.length);const o=[];for(let n=0;n<s;n+=1){const c=t[0][n];if(t.every(i=>i[n]===c))o.push(c);else break}const r=o.join(P);return r===""?P:r},I=(e,t)=>{if(e!==void 0)return t?(...s)=>d(e,...s):e},Gt=e=>{if(e?.files&&e.files.length>0){const t=Zt(e.files);if(t!==void 0)return t}return e?.cwd??Ie()},Vt=e=>new Tt(`No package.json found searching upwards from '${fe(e)}'.`),Xt=e=>!D(e,ie)&&D(e),Yt=(e,t)=>{if(A.CACHE_DIR&&!["0","1","false","true"].includes(A.CACHE_DIR)){const a=d(A.CACHE_DIR,e);return t?.create&&$(a),I(a,t?.thunk)}const s=Gt(t),o=dt("package.json",{cwd:s,type:"file"});if(!o){if(t?.useGlobalCacheFallback){const a=se(e);return t.create&&$(a),I(a,t.thunk)}if(t?.throwError)throw Vt(s);return}const r=Lt(o),n=d(r,"node_modules"),c=d(n,".cache"),i=d(c,e);if(D(i,ie))return t?.create&&$(i),I(i,t?.thunk);const u=[i,c,n];if(D(n)||u.push(r),u.some(a=>Xt(a))){if(t?.useGlobalCacheFallback){const a=se(e);return t.create&&$(a),I(a,t.thunk)}return}return t?.create&&$(i),I(i,t?.thunk)},ps=Yt,oe="@inherit",Jt=["aliases","dependsOn","inputs","outputs"],Kt=(e,t)=>{if(t===void 0)return e===void 0?void 0:[...e];if(!t.includes(oe))return[...t];const s=[];for(const o of t){if(o===oe){e!==void 0&&s.push(...e);continue}s.push(o)}return s},as=(e,t)=>{const s={...e,...t};for(const o of Jt){const r=e?.[o],n=t?.[o],c=Kt(r,n);c===void 0?delete s[o]:s[o]=c}return s};export{ps as L,os as T,as as m};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{createRequire as z}from"node:module";import{e as p,l as H,z as M}from"./index-BzhrR_iC.js";import{y as v}from"./isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{p as A}from"./readJsonSync-CbryXYxN-EWl7_7KX.js";let B;const D=e=>(B??=z(import.meta.url))(e),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=e=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[n,t]=k.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return k.getBuiltinModule(e)}return D(e)},{execFileSync:P}=T("node:child_process"),{randomBytes:L}=T("node:crypto"),{writeFileSync:V,renameSync:q,unlinkSync:R}=T("node:fs"),{delimiter:U}=T("node:path"),J=["proto","mise","fnm","volta","asdf","nvm","corepack"],G={asdf:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],corepack:["npm","pnpm","yarn"],fnm:["node"],mise:["aube","bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],nvm:["node"],proto:["bun","deno","go","node","npm","pnpm","python","ruby","rust","yarn"],volta:["node","npm","pnpm","yarn"]},Z=["proto","mise","fnm","volta","asdf","nvm","corepack"],O={asdf:[".tool-versions"],corepack:[],fnm:[".nvmrc",".node-version"],mise:[".mise.toml",".config/mise.toml","mise.toml"],nvm:[".nvmrc"],proto:[".prototools"],volta:[]},y=new Map,b=e=>{const n=y.get(e);if(n!==void 0||y.has(e))return n;const t=process.env.PATH;if(!t){y.set(e,void 0);return}const o=process.platform==="win32"?["",...(process.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";")]:[""];for(const i of t.split(U)){const c=i.replaceAll(/^["']|["']$/g,"").trim();if(c!=="")for(const s of o){const a=`${c}${H}${e}${s}`;if(v(a))return y.set(e,a),a}}y.set(e,void 0)},S=(e,n=["--version"])=>{try{const t=P(e,n,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}),r=/\d+\.\d+(?:\.\d+)?/.exec(t);return r?r[0]:t.trim()||void 0}catch{return}},j=(e,n)=>{const t=p(e,"package.json");if(!v(t))return[];try{const o=A(t)[n];if(n==="volta"&&typeof o=="object"&&o!==null&&Object.keys(o).length>0)return["package.json"];if(n==="packageManager"&&typeof o=="string"&&o.length>0)return["package.json"]}catch{}return[]},X=(e,n)=>e==="volta"?j(n,"volta"):e==="corepack"?j(n,"packageManager"):O[e].filter(t=>v(p(n,t))),x=new Map,Y=()=>{x.clear(),y.clear()},N=(e,n)=>{{const i=x.get(e);if(i)return i}const t=[],r=!!b("pnpm")||!!b("yarn");for(const i of Z){const c=i==="nvm"?void 0:b(i),s=i==="nvm"&&!!process.env.NVM_DIR,a=X(i,e),l=!!c||s;i==="corepack"&&!l&&(!(a.length>0)||r)||!l&&a.length===0||t.push({binPath:c,configFiles:a,installed:l,name:i,version:c?S(c):void 0})}const o=Object.freeze(t);return x.set(e,o),o},$n=(e,n,t)=>{const r=N(e);return n?.preferredManager&&n.preferredManager!=="none"?r.find(o=>o.name===n.preferredManager)??{configFiles:[],installed:!1,name:n.preferredManager}:r.find(o=>o.installed&&o.configFiles.length>0)??r.find(o=>o.installed)??r.find(o=>o.configFiles.length>0)??{configFiles:[],installed:!1,name:"none"}},K=(e,n)=>{for(const t of n){const r=p(e,t);if(v(r))try{const o=M(r).trim();if(o!=="")return{name:t,value:o.replace(/^v/,"")}}catch{}}},Q=/^([a-z][\w-]*)\s*=\s*"?([^"\n#]+?)"?\s*(?:#.*)?$/i,nn=e=>{const n=p(e,".prototools");if(!v(n))return[];const t=M(n),r=[];let o=!1;for(const i of t.split(/\r?\n/)){const c=i.trim();if(c===""||c.startsWith("#"))continue;if(c.startsWith("[")){o=!0;continue}if(o)continue;const s=Q.exec(c);if(!s)continue;const[,a,l]=s,f=g(a);f&&r.push({source:".prototools",tool:f,version:l.trim()})}return r},en=/^\[tools\]\s*$/i,tn=/^([a-z][\w-]*)\s*=\s*"?([^"\n#]+?)"?\s*(?:#.*)?$/i,on=e=>{for(const n of O.mise){const t=p(e,n);if(!v(t))continue;const r=[],o=M(t);let i=!1;for(const c of o.split(/\r?\n/)){const s=c.trim();if(s===""||s.startsWith("#"))continue;if(s.startsWith("[")){i=en.test(s);continue}if(!i)continue;const a=tn.exec(s);if(!a)continue;const[,l,f]=a,d=g(l);d&&r.push({source:".mise.toml",tool:d,version:f.trim()})}if(r.length>0)return r}return[]},rn=e=>{const n=p(e,".tool-versions");if(!v(n))return[];const t=M(n),r=[];for(const o of t.split(/\r?\n/)){const i=o.trim();if(i===""||i.startsWith("#"))continue;const c=i.split(/\s+/);if(c.length<2)continue;const[s,...a]=c,l=g(s);l&&a[0]&&r.push({source:".tool-versions",tool:l,version:a[0]})}return r},g=e=>{switch(e.toLowerCase()){case"aube":return"aube";case"bun":return"bun";case"deno":return"deno";case"go":case"golang":return"go";case"node":case"nodejs":return"node";case"npm":return"npm";case"pnpm":return"pnpm";case"python":case"python3":return"python";case"ruby":return"ruby";case"rust":case"rustc":return"rust";case"yarn":return"yarn";default:return}},sn=e=>{const[n]=e.split("+",1),t=/^(pnpm|yarn|npm|bun)@(.+)$/.exec(n??"");if(!t)return;const r=g(t[1]);if(r)return{source:"packageManager",tool:r,version:t[2]}},an=(e,n)=>{const t=new Map,r=s=>{t.set(s.tool,s)},o=p(e,"package.json");let i={};try{v(o)&&(i=A(o))}catch{}if(i.engines)for(const[s,a]of Object.entries(i.engines)){const l=g(s);l&&typeof a=="string"&&r({source:"engines",tool:l,version:a})}if(i.packageManager){const s=sn(i.packageManager);s&&r(s)}if(i.volta)for(const[s,a]of Object.entries(i.volta)){const l=g(s);l&&typeof a=="string"&&r({source:"volta",tool:l,version:a})}const c=K(e,[".nvmrc",".node-version"]);c&&r({source:c.name===".nvmrc"?".nvmrc":".node-version",tool:"node",version:c.value});for(const s of rn(e))r(s);for(const s of on(e))r(s);for(const s of nn(e))r(s);if(n?.tools)for(const[s,a]of Object.entries(n.tools)){const l=g(s);l&&typeof a=="string"&&r({source:"vis.config.ts",tool:l,version:a})}return[...t.values()]},E={aube:{args:["--version"],binaries:["aube"]},bun:{args:["--version"],binaries:["bun"]},deno:{args:["--version"],binaries:["deno"]},go:{args:["version"],binaries:["go"]},node:{args:["--version"],binaries:["node"]},npm:{args:["--version"],binaries:["npm"]},pnpm:{args:["--version"],binaries:["pnpm"]},python:{args:["--version"],binaries:["python","python3"]},ruby:{args:["--version"],binaries:["ruby"]},rust:{args:["--version"],binaries:["rustc"]},yarn:{args:["--version"],binaries:["yarn"]}},F=e=>{const n=E[e];for(const t of n.binaries){const r=b(t);if(r)return S(r,n.args)}if(e==="node")return process.versions.node},W=(e,n)=>{const t=n.trim();if(t===""||t==="*"||t==="latest")return!0;if(/^\d[\d.]*$/.test(t))return e===t||e.startsWith(`${t}.`);const r=s=>s.split(/[.\-+]/).map(a=>Number.parseInt(a,10)||0),o=(s,a)=>{const l=r(s),f=r(a),d=Math.max(l.length,f.length);for(let h=0;h<d;h++){const $=l[h]??0,u=f[h]??0;if($!==u)return $-u}return 0},i=s=>{for(const a of s)if(a.startsWith(">=")){if(o(e,a.slice(2).trim())<0)return!1}else if(a.startsWith("<=")){if(o(e,a.slice(2).trim())>0)return!1}else if(a.startsWith(">")){if(o(e,a.slice(1).trim())<=0)return!1}else if(a.startsWith("<")){if(o(e,a.slice(1).trim())>=0)return!1}else if(a.startsWith("^")||a.startsWith("~")){const l=a.slice(1).trim(),[f,d]=r(l),[h,$]=r(e);if(h!==f||a.startsWith("~")&&$!==d||o(e,l)<0)return!1}return!0},c=t.split("||").map(s=>s.trim().split(/\s+/).filter(Boolean)).filter(s=>s.length>0);return c.length===0?!0:c.some(s=>i(s))},cn=(e,n)=>{switch(e){case".mise.toml":return["mise"];case".node-version":case".nvmrc":return["fnm","nvm","volta","proto","mise","asdf"];case".prototools":return["proto"];case".tool-versions":return["asdf","mise"];case"packageManager":return n==="pnpm"||n==="yarn"?["self-activate","volta","proto","mise","corepack"]:n==="npm"?["volta","proto","mise","asdf","corepack"]:n==="aube"?["mise"]:n==="bun"?["proto","mise","asdf"]:["volta","proto","mise"];case"volta":return["volta"];default:return["proto","mise","fnm","volta","asdf","nvm","corepack"]}},ln=(e,n,t)=>{if(t?.preferredManager&&t.preferredManager!=="none"&&_(t.preferredManager,e.tool)){const o=n.find(i=>i.name===t.preferredManager);return o?{installed:o.installed,name:o.name}:{installed:!1,name:t.preferredManager,note:`${t.preferredManager} is the preferred manager but isn't on PATH`}}const r=cn(e.source,e.tool);for(const o of r){if(o==="self-activate"){if((e.tool==="pnpm"||e.tool==="yarn")&&b(e.tool))return{installed:!0,name:"self-activate",note:`${e.tool} will activate ${e.version} from the packageManager field on next invocation`};continue}if(!_(o,e.tool))continue;if(n.find(c=>c.name===o)?.installed)return{installed:!0,name:o}}for(const o of r)if(!(o==="self-activate"||!_(o,e.tool)))return{installed:!1,name:o,note:`${o} can install ${e.tool} — run \`vis toolchain install\` after adding it to PATH`};return{installed:!1,name:"none",note:"No manager knows how to install this tool"}},_=(e,n)=>e==="none"?!1:e==="self-activate"?n==="pnpm"||n==="yarn":G[e].includes(n),fn=(e,n)=>{const t=N(e),o=an(e,n).map(i=>{const c=F(i.tool),s=c!==void 0&&W(c,i.version),a=ln(i,t,n);return{actual:c,expected:i,manager:a,matches:s}});return{detected:t,tools:o}},un=(e,n)=>{switch(e){case"asdf":return n?{args:["install",n.tool,n.version],bin:"asdf"}:void 0;case"corepack":return n?{args:["prepare",`${n.tool}@${n.version}`,"--activate"],bin:"corepack"}:{args:["prepare","--activate"],bin:"corepack",hint:"reads the packageManager field in package.json"};case"fnm":return n?.tool!=="node"?void 0:{args:["install",n.version],bin:"fnm"};case"mise":return n?{args:["install",`${n.tool}@${n.version}`],bin:"mise"}:void 0;case"none":return;case"nvm":return{args:[],bin:"nvm",hint:"nvm is a shell function — run `nvm install` / `nvm use` from your shell"};case"proto":return n?{args:["install",n.tool,n.version],bin:"proto"}:void 0;case"self-activate":return{args:[],bin:n?.tool??"pnpm",hint:`${n?.tool??"pnpm"} will self-activate on next invocation — no install needed`};case"volta":return n?{args:["install",`${n.tool}@${n.version}`],bin:"volta"}:{args:["install","node@lts"],bin:"volta",hint:"volta pins per-tool; specify <tool>@<version>"};default:{const t=e;throw new Error(`Unknown manager: ${t}`)}}},yn=(e,n)=>{switch(e){case"asdf":return{args:["local",n.tool,n.version],bin:"asdf",configChange:{file:".tool-versions",hint:`Pins ${n.tool} ${n.version}`}};case"corepack":return n.tool!=="npm"&&n.tool!=="pnpm"&&n.tool!=="yarn"?void 0:{args:["use",`${n.tool}@${n.version}`],bin:"corepack",configChange:{file:"package.json",hint:`Writes packageManager: "${n.tool}@${n.version}"`}};case"fnm":return n.tool==="node"?{args:["use",n.version],bin:"fnm"}:void 0;case"mise":return{args:["use","--",`${n.tool}@${n.version}`],bin:"mise",configChange:{file:".mise.toml",hint:`Pins ${n.tool} ${n.version}`}};case"none":return;case"nvm":return n.tool==="node"?{args:[],bin:"nvm",configChange:{file:".nvmrc",hint:"Write version to .nvmrc manually (nvm doesn't persist)."}}:void 0;case"proto":return{args:["pin",n.tool,n.version],bin:"proto",configChange:{file:".prototools",hint:`Pins ${n.tool} ${n.version}`}};case"self-activate":return{args:[],bin:n.tool,configChange:{file:"package.json",hint:`Set packageManager: "${n.tool}@${n.version}" — ${n.tool} will self-activate on next invocation`}};case"volta":return{args:["pin",`${n.tool}@${n.version}`],bin:"volta",configChange:{file:"package.json",hint:`Writes volta.${n.tool}`}};default:{const t=e;throw new Error(`Unknown manager: ${t}`)}}},Mn=e=>{for(const n of E[e].binaries){const t=b(n);if(t)return t}},wn=(e,n)=>{const t=E[n].binaries;if(e.installed&&e.binPath&&(e.name==="proto"||e.name==="mise"||e.name==="asdf"||e.name==="volta"||e.name==="fnm"))for(const r of t)try{const i=P(e.binPath,["which",r],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}).trim();if(i)return i}catch{}for(const r of t){const o=b(r);if(o)return o}},I=(e,n)=>{const t=`${e}.${process.pid}.${L(6).toString("hex")}.tmp`;V(t,n);try{q(t,e)}catch(r){try{R(t)}catch{}throw r}},dn=(e,n)=>{if("packageManager"in e)return e.packageManager=n,e;const t={};let r=!1;for(const[o,i]of Object.entries(e))!r&&(o==="dependencies"||o==="devDependencies"||o==="peerDependencies"||o==="optionalDependencies")&&(t.packageManager=n,r=!0),t[o]=i;return r||(t.packageManager=n),t},kn=(e,n)=>{if(n.tool!=="pnpm"&&n.tool!=="yarn"&&n.tool!=="npm"&&n.tool!=="bun")return;const t=p(e,"package.json");if(!v(t))throw new Error(`Cannot pin ${n.tool}: ${t} does not exist.`);const r=M(t),i=/\n([ \t]+)/.exec(r)?.[1]??" ";let c;try{c=JSON.parse(r)}catch(f){throw new Error(`${t} is not valid JSON — fix it before running \`vis toolchain use\`. Underlying error: ${f.message}`,{cause:f})}const s=`${n.tool}@${n.version}`,a=dn(c,s),l=r.endsWith(`
|
|
2
|
-
`)?`
|
|
3
|
-
`:"";return I(t,`${JSON.stringify(a,void 0,i)}${l}`),s},Tn=(e,n)=>{const t=p(e,"package.json");if(!v(t))return;const r=M(t);let o;try{o=JSON.parse(r)}catch(a){throw new Error(`${t} is not valid JSON — fix it before running \`vis toolchain use\`. Underlying error: ${a.message}`,{cause:a})}if(o.engines?.[n.tool]===void 0||o.engines[n.tool]===n.version)return;o.engines[n.tool]=n.version;const c=/\n([ \t]+)/.exec(r)?.[1]??" ",s=r.endsWith(`
|
|
4
|
-
`)?`
|
|
5
|
-
`:"";return I(t,`${JSON.stringify(o,void 0,c)}${s}`),n.version},Pn=e=>{const n=/^([a-z][\w-]*)@(.+)$/i.exec(e.trim());if(!n)return;const t=g(n[1]);if(t)return{source:"vis.config.ts",tool:t,version:n[2]}},mn=async(e,n,t)=>{const r=fn(e,n),o=r.tools.filter(f=>!f.matches);if(o.length===0)return{attempted:[],failed:[],upToDate:!0};const i=r.detected.some(f=>f.installed);if(!(n?.autoInstall??i))return{attempted:[],failed:[],upToDate:!1};const s=[],a=[],l=new Map;for(const f of o){const d=l.get(f.manager.name);d?d.push(f):l.set(f.manager.name,[f])}for(const[f,d]of l){if(f==="self-activate"){for(const{expected:u}of d)t.info(`toolchain: ${u.tool} ${u.version} will self-activate on next ${u.tool} invocation`),s.push(u);continue}if(f==="none"){for(const{expected:u}of d)a.push({error:`no manager can install ${u.tool} — install one of ${J.join(", ")}`,spec:u});continue}if(!r.detected.find(u=>u.name===f)?.installed){for(const{expected:u}of d)a.push({error:`${f} is not on PATH`,spec:u});continue}const $=d.map(u=>({invocation:un(f,u.expected),tool:u})).filter(u=>u.invocation!==void 0);for(const{invocation:u,tool:C}of $){const{expected:m}=C;if(u.bin==="nvm"&&u.args.length===0){const w=F(m.tool);if(w!==void 0&&W(w,m.version)){t.info(`toolchain: ${m.tool} ${w} already satisfies ${m.version}; skipping nvm shell activation`),s.push(m);continue}t.warn(`toolchain: nvm requires a shell-side activation for ${m.tool} ${m.version}. Run \`nvm install\` / \`nvm use\` manually.`),a.push({error:"nvm requires shell-side activation",spec:m});continue}t.info(`toolchain: $ ${u.bin} ${u.args.join(" ")}`);try{P(u.bin,u.args,{cwd:e,stdio:"inherit"}),s.push(m),f==="fnm"&&vn(u.bin,t)}catch(w){a.push({error:w.message,spec:m});break}}}return Y(),{attempted:s,failed:a,upToDate:!1}},_n=async(e,n,t,r=!1)=>{if(r)return;const o=await mn(e,n,t);for(const i of o.failed)t.warn(`toolchain: ${i.spec.tool} ${i.spec.version} — ${i.error}`)},vn=(e,n)=>{const t=process.platform==="win32"?"powershell":"bash";try{const r=P(e,["env","--shell",t],{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3});for(const o of r.split(/\r?\n/)){const i=o.trim();if(i==="")continue;const c=/^\$env:([A-Z_]\w*)\s*=\s*(.+)$/i.exec(i);if(c){const[,l,f]=c;process.env[l]=f.replaceAll(/^["']|["']$/g,"");continue}const s=/^set\s+"?([A-Z_]\w*)=(.*?)"?$/i.exec(i);if(s){const[,l,f]=s;process.env[l]=f;continue}const a=/^(?:export\s+)?([A-Z_]\w*)=(.+)$/i.exec(i);if(a){const[,l,f]=a;process.env[l]=f.replaceAll(/^["']|["']$/g,"")}}}catch(r){n.warn(`toolchain: could not activate fnm env (${r.message}). Subsequent tasks may use the previous Node version.`)}};export{J as S,Pn as a,un as b,ln as c,yn as d,wn as e,N as f,fn as g,Mn as h,$n as p,_n as r,Tn as u,kn as w};
|