@visulima/vis 1.0.0-alpha.26 → 1.0.0-alpha.28
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 +30 -0
- package/LICENSE.md +3213 -95
- package/README.md +24 -22
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +176 -16
- package/dist/packem_chunks/bin.js +468 -364
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/config.js +15 -15
- package/dist/packem_chunks/devtools.js +82 -0
- package/dist/packem_chunks/doctor-probe.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- 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 +8 -9
- 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 +1 -1
- package/dist/packem_chunks/handler21.js +3 -3
- package/dist/packem_chunks/handler22.js +1 -1
- package/dist/packem_chunks/handler23.js +2 -2
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler26.js +1 -1
- 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 +6 -6
- package/dist/packem_chunks/handler31.js +1 -1
- package/dist/packem_chunks/handler33.js +1 -1
- package/dist/packem_chunks/handler34.js +4 -4
- package/dist/packem_chunks/handler35.js +3 -22
- package/dist/packem_chunks/handler36.js +21 -60
- package/dist/packem_chunks/handler37.js +61 -6
- package/dist/packem_chunks/handler38.js +3 -24
- package/dist/packem_chunks/handler39.js +6 -153
- package/dist/packem_chunks/handler4.js +5 -5
- package/dist/packem_chunks/handler40.js +24 -10
- package/dist/packem_chunks/handler41.js +153 -25
- package/dist/packem_chunks/handler42.js +25 -708
- package/dist/packem_chunks/handler43.js +10 -24
- package/dist/packem_chunks/handler44.js +659 -273
- package/dist/packem_chunks/handler45.js +24 -46
- package/dist/packem_chunks/handler46.js +322 -3
- package/dist/packem_chunks/handler47.js +48 -27
- package/dist/packem_chunks/handler48.js +3 -187
- package/dist/packem_chunks/handler49.js +23 -30
- package/dist/packem_chunks/handler5.js +7 -7
- package/dist/packem_chunks/handler50.js +195 -0
- package/dist/packem_chunks/handler51.js +34 -0
- 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 +7 -17
- package/dist/packem_chunks/index.js +3 -3
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/list.js +2 -2
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/run.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/tripwire.js +1 -1
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/Table-CwC2kW07-EjFLNV0q.js +12 -0
- package/dist/packem_shared/_commonjsHelpers-CLblCigl.js +1 -0
- package/dist/packem_shared/{advisories-DS8JEB_g.js → advisories-BxXiKFbL.js} +1 -1
- package/dist/packem_shared/{ai-analysis-Csn82p17.js → ai-analysis-BnmDFqc8.js} +5 -5
- package/dist/packem_shared/{ai-fix-BlYyz5bI.js → ai-fix-BGbnrWCz.js} +7 -7
- package/dist/packem_shared/{cyclonedx-ja1cbU69.js → cyclonedx-C2k2HmvI.js} +1 -1
- package/dist/packem_shared/{dependency-scan-s2MD0vi-.js → dependency-scan-Bki15Yi-.js} +1 -1
- package/dist/packem_shared/{docker-Bw9gKo69.js → docker-k-Sl8b-w.js} +1 -1
- package/dist/packem_shared/{failure-log-B0Uh-65U.js → failure-log-C3bG1bCA.js} +1 -1
- package/dist/packem_shared/index-2r730kXY.js +29 -0
- package/dist/packem_shared/{index-88UK-tt_.js → index-DBq4TVu5.js} +1 -1
- package/dist/packem_shared/{lifecycle-ChCFTm5Q.js → lifecycle-B91p_ra8.js} +2 -2
- package/dist/packem_shared/{lockfile-BG1HvBzH.js → lockfile-DmDfgKaT.js} +1 -1
- package/dist/packem_shared/{min-release-age-heJgeP7o.js → min-release-age-B1Jm1_JY.js} +1 -1
- package/dist/packem_shared/{native-config-sync-BOeuyrBj.js → native-config-sync-Cnpj2xcn.js} +6 -6
- package/dist/packem_shared/{osv-bloom-QSAn2Dcw.js → osv-bloom-ep8GlDGT.js} +2 -2
- package/dist/packem_shared/pm-runner-COoPLGKi.js +1 -0
- package/dist/packem_shared/{provenance-BsBn1f5S.js → provenance-DbkJRDqt.js} +1 -1
- package/dist/packem_shared/{registry-keys-pemEkRM9.js → registry-keys-SylX07bs.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-CBPr617N.js → resolve-explicit-CJ_5wYSu.js} +1 -1
- package/dist/packem_shared/s1ngularity-DlS-4a6K.js +1 -0
- package/dist/packem_shared/scan-progress-CU4ttEHQ.js +2 -0
- package/dist/packem_shared/{signatures-CaXzNuEn.js → signatures-B-1u4t-c.js} +1 -1
- package/dist/packem_shared/spinner-B9ZPv1iT.js +1 -0
- package/dist/packem_shared/spinners-f91Rbo99-Bjf3NcO0.js +1 -0
- package/dist/packem_shared/tabs-C-qFIoUv.js +1 -0
- package/dist/packem_shared/typosquats-BxCOUvTJ.js +1 -0
- package/dist/packem_shared/use-measured-height-kIDCuc76.js +1 -0
- package/dist/packem_shared/vis-update-app-COYmjGKv.js +1 -0
- package/dist/packem_shared/watch-BSVsZ_1I.js +1 -0
- package/dist/packem_shared/watch-loop-CP318TfG.js +11 -0
- package/index.js +751 -567
- package/package.json +11 -11
- package/schemas/project.schema.json +86 -1
- package/schemas/vis-config.schema.json +255 -7
- package/dist/packem_shared/index-CS6a2wFB.js +0 -29
- package/dist/packem_shared/index.server-B7ETiT4C.js +0 -2
- package/dist/packem_shared/pm-runner-BzGZmzYs.js +0 -1
- package/dist/packem_shared/s1ngularity-j_ArCZAs.js +0 -1
- package/dist/packem_shared/scan-progress-EbvmIh4i.js +0 -2
- package/dist/packem_shared/typosquats-C1e6RNjF.js +0 -1
- package/dist/packem_shared/use-measured-height-DjYgUOKk.js +0 -1
- package/dist/packem_shared/vis-update-app-qhQPV97i.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var Te=Object.defineProperty;var w=(e,t)=>Te(e,"name",{value:t,configurable:!0});import{createRequire as ze}from"node:module";import{o as Be,ac as Ie,p as Ne,aF as qe}from"./bin.js";import{z as he,M as me,$ as I}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";const Me=ze(import.meta.url),z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Fe=w(e=>{if(typeof z<"u"&&z.versions&&z.versions.node){const[t,r]=z.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return z.getBuiltinModule(e)}return Me(e)},"__cjs_getBuiltinModule"),{createRequire:Ge}=Fe("node:module");var De=Object.defineProperty,Ke=w((e,t)=>De(e,"name",{value:t,configurable:!0}),"p$6"),Qe=Object.defineProperty,de=Ke((e,t)=>Qe(e,"name",{value:t,configurable:!0}),"e"),Ve=Object.defineProperty,He=de((e,t)=>Ve(e,"name",{value:t,configurable:!0}),"E");const ge=String.raw,re=ge`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Je=He(()=>new RegExp(ge`\p{RI}{2}|(?)${re}(?:\u200D${re})*`,"gu"),"default");var Ye=Object.defineProperty,Xe=de((e,t)=>Ye(e,"name",{value:t,configurable:!0}),"p");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]]));const T=Je(),Ze=/[-_./\s]+/g,L=/(\u001B\[[0-9;]*[a-z])/i,ne=new RegExp("\\p{Script=Arabic}","u"),et=new RegExp("\\p{Script=Bengali}","u"),_=new RegExp("\\p{Script=Cyrillic}","u"),tt=new RegExp("\\p{Script=Devanagari}","u"),rt=new RegExp("\\p{Script=Ethiopic}","u"),Q=new RegExp("\\p{Script=Greek}","u"),ae=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),nt=new RegExp("\\p{Script=Gujarati}","u"),at=new RegExp("\\p{Script=Gurmukhi}","u"),ie=new RegExp("\\p{Script=Hangul}","u"),se=new RegExp("\\p{Script=Hebrew}","u"),it=new RegExp("\\p{Script=Hiragana}","u"),oe=new RegExp("\\p{Script=Han}","u"),st=new RegExp("\\p{Script=Kannada}","u"),ot=new RegExp("\\p{Script=Katakana}","u"),lt=new RegExp("\\p{Script=Khmer}","u"),ct=new RegExp("\\p{Script=Lao}","u"),O=new RegExp("\\p{Script=Latin}","u"),ut=new RegExp("\\p{Script=Malayalam}","u"),pt=new RegExp("\\p{Script=Myanmar}","u"),ft=new RegExp("\\p{Script=Oriya}","u"),ht=new RegExp("\\p{Script=Sinhala}","u"),mt=new RegExp("\\p{Script=Tamil}","u"),dt=new RegExp("\\p{Script=Telugu}","u"),gt=new RegExp("\\p{Script=Thai}","u"),yt=new RegExp("\\p{Script=Tibetan}","u"),le=/[\u02BB\u02BC\u0027]/u,bt=Xe(e=>e.replace(T,""),"stripEmoji");var $t=Object.defineProperty,ye=w((e,t)=>$t(e,"name",{value:t,configurable:!0}),"i$5"),vt=Object.defineProperty,be=ye((e,t)=>vt(e,"name",{value:t,configurable:!0}),"r"),wt=Object.defineProperty,jt=be((e,t)=>wt(e,"name",{value:t,configurable:!0}),"c");let W=class{static{w(this,"l")}static{ye(this,"y")}static{be(this,"s")}static{jt(this,"LRUCache")}capacity;cache;keyOrder;constructor(t){this.capacity=t,this.cache=new Map,this.keyOrder=[]}get(t){if(this.cache.has(t))return this.keyOrder=this.keyOrder.filter(r=>r!==t),this.keyOrder.push(t),this.cache.get(t)}has(t){return this.cache.has(t)}set(t,r){if(this.cache.has(t))this.keyOrder=this.keyOrder.filter(n=>n!==t);else if(this.cache.size>=this.capacity){const n=this.keyOrder.shift();n!==void 0&&this.cache.delete(n)}this.cache.set(t,r),this.keyOrder.push(t)}delete(t){this.cache.delete(t),this.keyOrder=this.keyOrder.filter(r=>r!==t)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}};var Et=Object.defineProperty,Ot=w((e,t)=>Et(e,"name",{value:t,configurable:!0}),"r$6"),kt=Object.defineProperty,xt=Ot((e,t)=>kt(e,"name",{value:t,configurable:!0}),"a"),Ct=Object.defineProperty,St=xt((e,t)=>Ct(e,"name",{value:t,configurable:!0}),"s");const Pt=St((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleLowerCase(t.locale):e[0].toLowerCase())+e.slice(1),"lowerFirst");var At=Object.defineProperty,Lt=w((e,t)=>At(e,"name",{value:t,configurable:!0}),"I"),Wt=Object.defineProperty,q=Lt((e,t)=>Wt(e,"name",{value:t,configurable:!0}),"W");const Rt=Ge(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_t=q(e=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[t,r]=M.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return M.getBuiltinModule(e)}return Rt(e)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:Ut}=_t("node:util");var Tt=Object.defineProperty,zt=q((e,t)=>Tt(e,"name",{value:t,configurable:!0}),"g");const V=new W(1e3),Mt=/[.*+?^${}()|[\]\\]/g,Ft=zt(e=>{const t=e.join("");if(V.has(t))return V.get(t);const r=e.map(a=>a.replaceAll(Mt,String.raw`\$&`)).join("|"),n=new RegExp(r,"g");return V.set(t,n),n},"getSeparatorsRegex");var Bt=Object.defineProperty,It=q((e,t)=>Bt(e,"name",{value:t,configurable:!0}),"t");const Nt=It(e=>{const t=[];let r=0,n;for(T.lastIndex=0;(n=T.exec(e))!==null;)n.index>r&&t.push(e.slice(r,n.index)),t.push(n[0]),r=T.lastIndex;return r<e.length&&t.push(e.slice(r)),t.filter(Boolean)},"splitByEmoji");var qt=Object.defineProperty,$=q((e,t)=>qt(e,"name",{value:t,configurable:!0}),"u");const Gt=/[ČŠŽĐ]/i,$e=new Uint8Array(128),ve=new Uint8Array(128),we=new Uint8Array(128);for(let e=0;e<128;e++)$e[e]=e>=65&&e<=90?1:0,ve[e]=e>=97&&e<=122?1:0,we[e]=e>=48&&e<=57?1:0;const H=$(e=>$e[e],"isUpper"),ce=$(e=>ve[e],"isLower"),J=$(e=>we[e],"isDigit"),A=$((e,t,r,n,a)=>{if(e.length===0)return[];let i=!1;const l=Object.values(t);for(const u of l)if(u(e[0])){i=!0;break}if(!i&&!r)return[e];const o=[...e],h=[];let s=o[0],f="other";const m=Object.entries(t);for(const u of m){const[p,g]=u;if(g(o[0])){f=p;break}}let c=r&&n?o[0]===o[0].toLocaleUpperCase(n):!1;for(let u=1;u<o.length;u++){const p=o[u];let g="other";for(const b of m){const[v,E]=b;if(E(p)){g=v;break}}const y=r&&n?p===p.toLocaleUpperCase(n):!1;let d=!1;a?d=a(f,g,c,y,p,u,o):(f!==g&&f!=="other"&&g!=="other"&&(d=!0),r&&g!=="other"&&!c&&y&&(d=!0)),d?(h.push(s),s=p):s+=p,f=g,r&&(c=y)}return s&&s.length>0&&h.push(s),h.length>0?h:[e]},"handleScriptTransitions"),Dt=$((e,t,r,n)=>{if(r.size===0)return t;for(const a of r)if(e.startsWith(a,t))return n.push(a),t+a.length;return t},"detectAndProcessAcronym"),je=$((e,t=new Set)=>{if(e.length===0)return[];if(e.toUpperCase()===e)return[e];let r=0;const n=[],a=e.length;for(let i=1;i<a;i++){const l=Dt(e,r,t,n);if(l!==r){r=l,i=r-1;continue}const o=e.codePointAt(i-1),h=e.codePointAt(i),s=o&&o<128&&H(o),f=h&&h<128&&H(h),m=o&&o<128&&ce(o),c=o&&o<128&&J(o),u=h&&h<128&&J(h);if(m&&f){n.push(e.slice(r,i)),r=i;continue}if(c&&!u||!c&&u){n.push(e.slice(r,i)),r=i;continue}if(u&&!c){let p=!1,g=!1;if(i+1<a){const y=e.codePointAt(i+1);p=y&&y<128&&H(y),g=y&&y<128&&J(y)}if(!g&&p){n.push(e.slice(r,i),e.slice(i,i+1)),r=i+1;continue}}if(i+1<a){const p=e.codePointAt(i+1),g=p&&p<128&&ce(p);if(s&&f&&g){const y=e.slice(r,i+1);t.has(y)||(n.push(e.slice(r,i)),r=i)}}}return r<a&&n.push(e.slice(r)),n.filter(i=>i!=="")},"splitCamelCaseFast"),Ee=$((e,t,r)=>{if(e.length===0)return[];const n=e===e.toLocaleUpperCase(t);if(t.startsWith("de")){if(!n&&e.replaceAll("ß","SS")===e.toLocaleUpperCase(t))return[e];const s=[...e],f=s.length,m=[];let c=s[0],u=s[0]===s[0].toLocaleUpperCase(t),p=u,g=u?0:-1;for(let y=1;y<f;y++){const d=s[y],b=d===d.toLocaleUpperCase(t);if(b===u)c+=d;else if(b)c&&c.length>0&&(m.push(c),c=d),p=!0,g=y;else{if(p&&y-g>1){const v=s[y-1],E=c.slice(0,-1);E&&E.length>0&&m.push(E),c=v+d}else c+=d;p=!1,g=-1}u=b}return c&&c.length>0&&m.push(c),m}if(t.startsWith("uk")||t.startsWith("ru")||t.startsWith("bg")||t.startsWith("sr")||t.startsWith("mk")||t.startsWith("be")){if(!_.test(e)&&!O.test(e))return[e];const s=[...e],f=s.length,m=[];let c=s[0];const u=s[0];let p;_.test(u)?p=1:O.test(u)?p=2:p=0;let g=u===u.toLocaleUpperCase(t);for(let d=1;d<f;d++){const b=s[d];let v;_.test(b)?v=1:O.test(b)?v=2:v=0;const E=b===b.toLocaleUpperCase(t);p!==v&&(p===1||p===2)&&(v===1||v===2)||v===p&&!g&&E?(m.push(c),c=b):c+=b,p=v,g=E}c&&c.length>0&&m.push(c);const y=[];for(let d=0;d<m.length;d++)d<m.length-1&&m[d].length===1&&O.test(m[d])&&_.test(m[d+1][0])?(y.push(m[d]+m[d+1]),d+=1):y.push(m[d]);return y}if(t.startsWith("el")){if(!Q.test(e)&&!O.test(e))return[e];const s=[];ae.lastIndex=0;let f;for(;(f=ae.exec(e))!==null;)s.push(f[0]);s.length===0&&s.push(e);const m=[];if(s.length===1){const c=s[0];if(!c||!Q.test(c[0])||c.length===1)return[c??e]}for(const c of s){if(!c)continue;if(!Q.test(c[0])||c.length===1){m.push(c);continue}const u=c.length;let p=c[0],g=c[0]===c[0].toLocaleUpperCase(t);for(let y=1;y<u;y++){const d=c[y],b=d===d.toLocaleUpperCase(t);!g&&b?(m.push(p),p=d):p+=d,g=b}p&&m.push(p)}return m}if(t.startsWith("ja")||t.startsWith("ko")){const s=t.startsWith("ja"),f=s?{hiragana:$(c=>it.test(c),"hiragana"),kanji:$(c=>oe.test(c),"kanji"),katakana:$(c=>ot.test(c),"katakana"),latin:$(c=>O.test(c),"latin")}:{hangul:$(c=>ie.test(c),"hangul"),latin:$(c=>O.test(c),"latin")},m=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(s){const c=A(e,f,!1,t,(p,g)=>p==="hiragana"&&g==="katakana"||p==="katakana"&&g==="hiragana"||p==="hiragana"&&g==="latin"||p==="katakana"&&g==="latin"||p==="kanji"&&g==="latin"||p==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),u=[];for(const p of c){const g=p;g.length===1&&m.has(g)&&u.length>0?u[u.length-1]=u.at(-1)+g:u.push(g)}return u.length>0?u:[e]}return A(e,f,!1,t,(c,u)=>c==="hangul"&&u==="latin"||c==="latin"&&u==="hangul")}if(t.startsWith("sl")){const s=[...e],f=s.length,m=[];let c=s[0],u=s[0]===s[0].toLocaleUpperCase(t);for(let p=1;p<f;p++){const g=s[p],y=g===g.toLocaleUpperCase(t),d=Gt.test(g),b=p<f-1&&s[p+1]===s[p+1].toLocaleUpperCase(t);!u&&y||d&&b?(m.push(c),c=g,d&&b&&(m.push(c),c="")):c+=g,u=y}return c&&c.length>0&&m.push(c),m}if(t.startsWith("zh"))return A(e,{han:$(s=>oe.test(s),"han"),latin:$(s=>O.test(s),"latin")},!1,t);if(["ar","fa","he","ur"].includes(t.split("-")[0])){const s=$(f=>se.test(f)||ne.test(f),"isRtlChar");return A(e,{latin:$(f=>O.test(f),"latin"),rtl:$(f=>s(f),"rtl")},!1,t)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(t.split("-")[0])){const s=$(f=>tt.test(f)||et.test(f)||nt.test(f)||at.test(f)||st.test(f)||mt.test(f)||dt.test(f)||ut.test(f)||ht.test(f)||gt.test(f)||ct.test(f)||yt.test(f)||pt.test(f)||rt.test(f)||lt.test(f)||ft.test(f),"isIndicChar");return A(e,{indic:$(f=>s(f),"indic"),latin:$(f=>O.test(f),"latin")},!1,t)}if(["be","bg","ru","sr","uk"].includes(t))return A(e,{cyrillic:$(s=>_.test(s),"cyrillic"),latin:$(s=>O.test(s),"latin")},!0,t);if(["ar","fa","he"].includes(t))return A(e,{latin:$(s=>O.test(s),"latin"),rtl:$(s=>se.test(s)||ne.test(s),"rtl")},!1,t);if(t.startsWith("ko"))return A(e,{hangul:$(s=>ie.test(s),"hangul"),latin:$(s=>O.test(s),"latin")},!1,t);if(t.startsWith("uz")){if(!_.test(e)&&!O.test(e))return[e];const s=[...e],f=s.length,m=[];let c=s[0],u=s[0]===s[0].toLocaleUpperCase(t);for(let p=1;p<f;p++){const g=s[p],y=g===g.toLocaleUpperCase(t);if(le.test(g)||le.test(s[p-1])){c+=g;continue}!u&&y?(m.push(c),c=g):c+=g,u=y}return c&&c.length>0&&m.push(c),m}const a=[...e],i=a.length,l=[];let o=a[0],h=a[0]===a[0].toLocaleUpperCase(t);for(const s of r)if(e.startsWith(s)){l.push(s),o=a[s.length],h=o===o.toLocaleUpperCase(t);break}for(let s=1;s<i;s++){const f=a[s],m=f===f.toLocaleUpperCase(t);let c=0;for(const u of r)if(e.startsWith(u,s)){l.push(o,u),c=u.length,o="";const p=u.at(-1);p&&(h=p===p.toLocaleUpperCase(t));break}if(c>0){s+=c-1;continue}!h&&m?(l.push(o),o=f):o+=f,h=m}return o&&l.push(o),l},"splitCamelCaseLocale"),Kt=$((e,t,r)=>{const n=[],a=L.test(e)?e.split(L).filter(Boolean):[e];for(const i of a){const l=i;if(L.test(l))n.push(l);else{const o=T.test(l)?Nt(l).filter(Boolean):[l];for(const h of o)if(T.test(h))n.push(h);else if(t){const s=t.toLowerCase().split("-")[0];n.push(...Ee(h,s,r))}else n.push(...je(h,r))}}return n},"processTextWithAnsiEmoji"),G=$((e,t={})=>{if(!e||typeof e!="string")return[];const{handleAnsi:r=!1,handleEmoji:n=!1,knownAcronyms:a=[],locale:i,normalize:l=!1,separators:o,stripAnsi:h=!1,stripEmoji:s=!1}=t,f=new Set([...a].toSorted((d,b)=>b.length-d.length));let m=e;h&&(m=Ut(m)),s&&(m=bt(m));let c;Array.isArray(o)?c=Ft(o):o instanceof RegExp?c=o:c=Ze;const u=[];let p=m;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;p.length>0;){const d=g.exec(p);if(!d){p===".."?u.push(".."):p==="."?u.push("."):p.length>0&&u.push(p);break}const b=d.index,v=d[0],E=v.length,B=p.slice(0,b),Ue=p.slice(b+E);if(v.startsWith("../"))u.push(".."),p=p.slice(b+3);else if(v.startsWith("./"))u.push("."),p=p.slice(b+2);else if(b===0&&v==="..")u.push(".."),p=p.slice(2);else if(b===0&&v===".")u.push("."),p=p.slice(1);else{B.length>0&&u.push(B);let S=0;for(;(S=v.indexOf("../",S))!==-1;)u.push(".."),S+=3;for(S=0;(S=v.indexOf("./",S))!==-1;)(S===0||v[S-1]!==".")&&u.push("."),S+=2;let P=Ue;for(;P.startsWith("../");)u.push(".."),P=P.slice(3);for(;P.startsWith("./");)u.push("."),P=P.slice(2);if(P===".."){u.push("..");break}else if(P==="."){u.push(".");break}else p=P}g.lastIndex=0}if(u.length===0){const d=m.split(c).filter(Boolean);u.push(...d)}let y=[];for(const d of u)r||n?y.push(...Kt(d,i,f)):i?y.push(...Ee(d,i,f)):y.push(...je(d,f));return l&&(y=y.map(d=>f.has(d)?d:i&&d===d.toLocaleUpperCase(i)?d[0]+d.slice(1).toLocaleLowerCase(i):d.toUpperCase()===d&&!f.has(d)?d.slice(0,1)+d.slice(1).toLowerCase():d)),y},"splitByCase");var Qt=Object.defineProperty,Vt=w((e,t)=>Qt(e,"name",{value:t,configurable:!0}),"r$5"),Ht=Object.defineProperty,Jt=Vt((e,t)=>Ht(e,"name",{value:t,configurable:!0}),"o"),Yt=Object.defineProperty,Xt=Jt((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"s");const Z=Xt((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleUpperCase(t.locale):e[0].toUpperCase())+e.slice(1),"upperFirst");var Zt=Object.defineProperty,er=w((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"r$4"),tr=Object.defineProperty,rr=er((e,t)=>tr(e,"name",{value:t,configurable:!0}),"r"),nr=Object.defineProperty,ar=rr((e,t)=>nr(e,"name",{value:t,configurable:!0}),"n");const D=ar((e,t)=>`${e}::${t?.joiner??""}::${t?.locale??""}::${t?.knownAcronyms?.join(",")??""}::${t?.normalize?"true":"false"}`,"generateCacheKey");var ir=Object.defineProperty,sr=w((e,t)=>ir(e,"name",{value:t,configurable:!0}),"i$3"),or=Object.defineProperty,lr=sr((e,t)=>or(e,"name",{value:t,configurable:!0}),"f"),cr=Object.defineProperty,ur=lr((e,t)=>cr(e,"name",{value:t,configurable:!0}),"l");const K=ur((e,t)=>{const{length:r}=e;if(r===0)return"";if(r===1)return e[0];const n=[];let a="",i="";for(let l=0;l<r;l++){const o=e[l];if(L.test(o)){a?(n.push(a+i+o),a="",i=""):(n.length>0&&n.push(t),a=o);continue}a?(i&&(i+=t),i+=o):(n.length>0&&n.push(t),n.push(o))}return n.join("")},"joinSegments");var pr=Object.defineProperty,fr=w((e,t)=>pr(e,"name",{value:t,configurable:!0}),"r$3"),hr=Object.defineProperty,mr=fr((e,t)=>hr(e,"name",{value:t,configurable:!0}),"a"),dr=Object.defineProperty,gr=mr((e,t)=>dr(e,"name",{value:t,configurable:!0}),"e");const yr=/(?<![a-zß])SS(?![a-z])/g,ee=gr(e=>e.replaceAll(yr,"ß"),"normalizeGermanEszett");var br=Object.defineProperty,$r=w((e,t)=>br(e,"name",{value:t,configurable:!0}),"c$3"),vr=Object.defineProperty,wr=$r((e,t)=>vr(e,"name",{value:t,configurable:!0}),"c"),jr=Object.defineProperty,Er=wr((e,t)=>jr(e,"name",{value:t,configurable:!0}),"o");const Or=new W(1e3),kr=Er((e,t)=>{if(typeof e!="string"||!e)return"";const r=t?.cache??!1,n=t?.cacheStore??Or;let a;if(r&&(a=D(e,t)),r&&a&&n.has(a))return n.get(a);let i=!0;const l=K(G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(o=>{if(t?.handleAnsi&&L.test(o))return o;const h=t?.locale?.startsWith("de")?ee(o):o,s=t?.locale?h.toLocaleLowerCase(t.locale):h.toLowerCase();return i?(i=!1,Pt(s,t)):Z(s,t)}),"");return r&&a&&n.set(a,l),l},"camelCase");var xr=Object.defineProperty,Cr=w((e,t)=>xr(e,"name",{value:t,configurable:!0}),"l$3"),Sr=Object.defineProperty,Pr=Cr((e,t)=>Sr(e,"name",{value:t,configurable:!0}),"l"),Ar=Object.defineProperty,Lr=Pr((e,t)=>Ar(e,"name",{value:t,configurable:!0}),"o");const Wr=new W(1e3),te=Lr((e,t)=>{if(typeof e!="string")return"";const r=t?.cache??!1,n=t?.cacheStore??Wr;let a;if(r&&(a=D(e,t)),r&&a&&n.has(a))return n.get(a);const i=G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(o=>{if(t?.handleAnsi&&L.test(o))return o;if(t?.toUpperCase)return t.locale?o.toLocaleUpperCase(t.locale):o.toUpperCase();const h=t?.locale?.startsWith("de")?ee(o):o;return t?.locale?h.toLocaleLowerCase(t.locale):h.toLowerCase()}),l=K(i,t?.joiner??"-");return r&&a&&n.set(a,l),l},"kebabCase");var Rr=Object.defineProperty,_r=w((e,t)=>Rr(e,"name",{value:t,configurable:!0}),"r$2"),Ur=Object.defineProperty,Tr=_r((e,t)=>Ur(e,"name",{value:t,configurable:!0}),"a"),zr=Object.defineProperty,Mr=Tr((e,t)=>zr(e,"name",{value:t,configurable:!0}),"s");const Fr=new W(1e3),Br=Mr((e,t)=>te(e,{cacheStore:Fr,...t,joiner:"_",toUpperCase:!0}),"constantCase");var Ir=Object.defineProperty,Nr=w((e,t)=>Ir(e,"name",{value:t,configurable:!0}),"l$2"),qr=Object.defineProperty,Gr=Nr((e,t)=>qr(e,"name",{value:t,configurable:!0}),"l"),Dr=Object.defineProperty,Kr=Gr((e,t)=>Dr(e,"name",{value:t,configurable:!0}),"i");const Qr=new W(1e3),Vr=Kr((e,t)=>{if(typeof e!="string"||!e)return"";const r=t?.cache??!1,n=t?.cacheStore??Qr;let a;if(r&&(a=D(e,t)),r&&a&&n.has(a))return n.get(a);const i=K(G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(l=>{if(t?.handleAnsi&&L.test(l))return l;const o=t?.locale?.startsWith("de")?ee(l):l;return Z(t?.locale?o.toLocaleLowerCase(t.locale):o.toLowerCase(),{locale:t?.locale})}),"");return r&&a&&n.set(a,i),i},"pascalCase");var Hr=Object.defineProperty,Jr=w((e,t)=>Hr(e,"name",{value:t,configurable:!0}),"r$1"),Yr=Object.defineProperty,Xr=Jr((e,t)=>Yr(e,"name",{value:t,configurable:!0}),"a"),Zr=Object.defineProperty,en=Xr((e,t)=>Zr(e,"name",{value:t,configurable:!0}),"s");const tn=new W(1e3),rn=en((e,t)=>te(e,{cacheStore:tn,...t,joiner:"_"}),"snakeCase");var nn=Object.defineProperty,an=w((e,t)=>nn(e,"name",{value:t,configurable:!0}),"r"),sn=Object.defineProperty,on=an((e,t)=>sn(e,"name",{value:t,configurable:!0}),"e"),ln=Object.defineProperty,cn=on((e,t)=>ln(e,"name",{value:t,configurable:!0}),"i");const un=new W(1e3),pn=cn((e,t)=>{if(typeof e!="string")return"";const r=t?.cache??!1,n=t?.cacheStore??un;let a;if(r&&(a=D(e,t)),r&&a&&n.has(a))return n.get(a);const i=K(G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(l=>Z(l,{locale:t?.locale})),"-");return r&&a&&n.set(a,i),i},"trainCase");var fn=Object.defineProperty,k=w((e,t)=>fn(e,"name",{value:t,configurable:!0}),"e");const x=k(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),Y={camel_case:k(e=>kr(x(e)),"camel_case"),kebab_case:k(e=>te(x(e)),"kebab_case"),lower_case:k(e=>x(e).toLowerCase(),"lower_case"),pascal_case:k(e=>Vr(x(e)),"pascal_case"),path_join:k((e,...t)=>{const r=[x(e),...t.map(n=>x(n))];return me(...r)},"path_join"),path_relative:k((e,t)=>he(x(t),x(e)),"path_relative"),snake_case:k(e=>rn(x(e)),"snake_case"),upper_case:k(e=>x(e).toUpperCase(),"upper_case"),upper_kebab_case:k(e=>pn(x(e)),"upper_kebab_case"),upper_snake_case:k(e=>Br(x(e)),"upper_snake_case")};k(e=>Object.hasOwn(Y,e),"isKnownFilter");const Oe=k((e,t,r=[])=>{const n=Y[e];if(!n)throw new Error(`Unknown filter "${e}". Known filters: ${Object.keys(Y).sort().join(", ")}.`);return n(t,...r)},"applyFilter");var hn=Object.defineProperty,ke=w((e,t)=>hn(e,"name",{value:t,configurable:!0}),"d$1");const xe=ke(e=>{const t=[];let r=0,n=0,a,i=-1;for(const l of e){if(i+=1,a){l===a&&(a=void 0);continue}if(l==='"'||l==="'"){a=l;continue}l==="("?r+=1:l===")"?r-=1:l===","&&r===0&&(t.push(e.slice(n,i)),n=i+1)}return t.push(e.slice(n)),t},"splitCommaOutsideQuotes"),mn=ke(e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},"stripQuotes");var dn=Object.defineProperty,R=w((e,t)=>dn(e,"name",{value:t,configurable:!0}),"s$1");const gn=/\[([^\]]+)\]/g,yn=R(e=>{const t=e.trim(),r=t.indexOf("(");if(r===-1)return{args:[],name:t};if(!t.endsWith(")"))throw new Error(`Filter call "${e}" missing closing ")"`);const n=t.slice(0,r).trim(),a=t.slice(r+1,-1).trim();return a===""?{args:[],name:n}:{args:xe(a).map(i=>{const l=i.trim();return mn(l)??l}),name:n}},"parseFilterCall"),bn=R(e=>{const t=e.split("|").map(n=>n.trim()),r=t[0]??"";if(!r)throw new Error(`Empty variable name in expression "${e}"`);return{filters:t.slice(1).map(n=>yn(n)),name:r}},"parsePipe"),$n=R(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),vn=R((e,t)=>{const r=e.replaceAll(gn,(n,a)=>{const{filters:i,name:l}=bn(a);if(!Object.hasOwn(t,l))throw new Error(`Variable "${l}" used in filename "${e}" but not defined`);let o=t[l];for(const h of i)o=Oe(h.name,o,h.args);return $n(o)});return Ce(r)},"interpolateFilename"),Ce=R(e=>e.split("/").map(t=>t.endsWith(".tera")||t.endsWith(".twig")?t.slice(0,-5):t).join("/"),"stripTeraSuffix"),wn=R(e=>e.endsWith(".raw")?e.slice(0,-4):e,"stripRawSuffix"),jn=R(e=>{const t=e.split("/");return(t.at(-1)??"").startsWith("_")?!0:t.slice(0,-1).includes("partials")},"isPartialPath");var En=Object.defineProperty,On=w((e,t)=>En(e,"name",{value:t,configurable:!0}),"i");const kn=On((e,t)=>{if(!e.startsWith(`---
|
|
1
|
+
var Le=Object.defineProperty;var C=(e,t)=>Le(e,"name",{value:t,configurable:!0});import{createRequire as Se}from"node:module";import{bc as Te,bd as ze,be as S,bf as L,bg as M,bh as U,bi as O,bj as D,bk as re,bl as Re,bm as ne,bn as Me,bo as ae,bp as se,bq as ie,br as Fe,bs as Ie,bt as Ne,bu as Be,bv as qe,bw as Ge,bx as Qe,by as Ve,bz as De,bA as Ke,bB as Je,bC as Ye,bD as He,bE as Xe,bF as Ze,bG as et,bH as oe,o as tt,an as rt,p as nt,b0 as at}from"./bin.js";import{z as pe,M as he,$ as N}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";const _e=Se(import.meta.url),z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ue=C(e=>{if(typeof z<"u"&&z.versions&&z.versions.node){const[t,r]=z.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return z.getBuiltinModule(e)}return _e(e)},"__cjs_getBuiltinModule"),{createRequire:st}=Ue("node:module");var it=Object.defineProperty,ot=C((e,t)=>it(e,"name",{value:t,configurable:!0}),"r$6"),lt=Object.defineProperty,ct=ot((e,t)=>lt(e,"name",{value:t,configurable:!0}),"a"),ut=Object.defineProperty,ft=ct((e,t)=>ut(e,"name",{value:t,configurable:!0}),"s");const pt=ft((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleLowerCase(t.locale):e[0].toLowerCase())+e.slice(1),"lowerFirst");var ht=Object.defineProperty,mt=C((e,t)=>ht(e,"name",{value:t,configurable:!0}),"I"),dt=Object.defineProperty,q=mt((e,t)=>dt(e,"name",{value:t,configurable:!0}),"W");const gt=st(import.meta.url),R=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,bt=q(e=>{if(typeof R<"u"&&R.versions&&R.versions.node){const[t,r]=R.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return R.getBuiltinModule(e)}return gt(e)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:yt}=bt("node:util");var $t=Object.defineProperty,vt=q((e,t)=>$t(e,"name",{value:t,configurable:!0}),"g");const K=new S(1e3),wt=/[.*+?^${}()|[\]\\]/g,jt=vt(e=>{const t=e.join("");if(K.has(t))return K.get(t);const r=e.map(a=>a.replaceAll(wt,String.raw`\$&`)).join("|"),n=new RegExp(r,"g");return K.set(t,n),n},"getSeparatorsRegex");var Ct=Object.defineProperty,Ot=q((e,t)=>Ct(e,"name",{value:t,configurable:!0}),"t");const kt=Ot(e=>{const t=[];let r=0,n;for(M.lastIndex=0;(n=M.exec(e))!==null;)n.index>r&&t.push(e.slice(r,n.index)),t.push(n[0]),r=M.lastIndex;return r<e.length&&t.push(e.slice(r)),t.filter(Boolean)},"splitByEmoji");var At=Object.defineProperty,$=q((e,t)=>At(e,"name",{value:t,configurable:!0}),"u");const Pt=/[ČŠŽĐ]/i,me=new Uint8Array(128),de=new Uint8Array(128),ge=new Uint8Array(128);for(let e=0;e<128;e++)me[e]=e>=65&&e<=90?1:0,de[e]=e>=97&&e<=122?1:0,ge[e]=e>=48&&e<=57?1:0;const J=$(e=>me[e],"isUpper"),le=$(e=>de[e],"isLower"),Y=$(e=>ge[e],"isDigit"),W=$((e,t,r,n,a)=>{if(e.length===0)return[];let s=!1;const l=Object.values(t);for(const u of l)if(u(e[0])){s=!0;break}if(!s&&!r)return[e];const o=[...e],h=[];let i=o[0],p="other";const m=Object.entries(t);for(const u of m){const[f,g]=u;if(g(o[0])){p=f;break}}let c=r&&n?o[0]===o[0].toLocaleUpperCase(n):!1;for(let u=1;u<o.length;u++){const f=o[u];let g="other";for(const y of m){const[v,j]=y;if(j(f)){g=v;break}}const b=r&&n?f===f.toLocaleUpperCase(n):!1;let d=!1;a?d=a(p,g,c,b,f,u,o):(p!==g&&p!=="other"&&g!=="other"&&(d=!0),r&&g!=="other"&&!c&&b&&(d=!0)),d?(h.push(i),i=f):i+=f,p=g,r&&(c=b)}return i&&i.length>0&&h.push(i),h.length>0?h:[e]},"handleScriptTransitions"),xt=$((e,t,r,n)=>{if(r.size===0)return t;for(const a of r)if(e.startsWith(a,t))return n.push(a),t+a.length;return t},"detectAndProcessAcronym"),be=$((e,t=new Set)=>{if(e.length===0)return[];if(e.toUpperCase()===e)return[e];let r=0;const n=[],a=e.length;for(let s=1;s<a;s++){const l=xt(e,r,t,n);if(l!==r){r=l,s=r-1;continue}const o=e.codePointAt(s-1),h=e.codePointAt(s),i=o&&o<128&&J(o),p=h&&h<128&&J(h),m=o&&o<128&&le(o),c=o&&o<128&&Y(o),u=h&&h<128&&Y(h);if(m&&p){n.push(e.slice(r,s)),r=s;continue}if(c&&!u||!c&&u){n.push(e.slice(r,s)),r=s;continue}if(u&&!c){let f=!1,g=!1;if(s+1<a){const b=e.codePointAt(s+1);f=b&&b<128&&J(b),g=b&&b<128&&Y(b)}if(!g&&f){n.push(e.slice(r,s),e.slice(s,s+1)),r=s+1;continue}}if(s+1<a){const f=e.codePointAt(s+1),g=f&&f<128&&le(f);if(i&&p&&g){const b=e.slice(r,s+1);t.has(b)||(n.push(e.slice(r,s)),r=s)}}}return r<a&&n.push(e.slice(r)),n.filter(s=>s!=="")},"splitCamelCaseFast"),ye=$((e,t,r)=>{if(e.length===0)return[];const n=e===e.toLocaleUpperCase(t);if(t.startsWith("de")){if(!n&&e.replaceAll("ß","SS")===e.toLocaleUpperCase(t))return[e];const i=[...e],p=i.length,m=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(t),f=u,g=u?0:-1;for(let b=1;b<p;b++){const d=i[b],y=d===d.toLocaleUpperCase(t);if(y===u)c+=d;else if(y)c&&c.length>0&&(m.push(c),c=d),f=!0,g=b;else{if(f&&b-g>1){const v=i[b-1],j=c.slice(0,-1);j&&j.length>0&&m.push(j),c=v+d}else c+=d;f=!1,g=-1}u=y}return c&&c.length>0&&m.push(c),m}if(t.startsWith("uk")||t.startsWith("ru")||t.startsWith("bg")||t.startsWith("sr")||t.startsWith("mk")||t.startsWith("be")){if(!U.test(e)&&!O.test(e))return[e];const i=[...e],p=i.length,m=[];let c=i[0];const u=i[0];let f;U.test(u)?f=1:O.test(u)?f=2:f=0;let g=u===u.toLocaleUpperCase(t);for(let d=1;d<p;d++){const y=i[d];let v;U.test(y)?v=1:O.test(y)?v=2:v=0;const j=y===y.toLocaleUpperCase(t);f!==v&&(f===1||f===2)&&(v===1||v===2)||v===f&&!g&&j?(m.push(c),c=y):c+=y,f=v,g=j}c&&c.length>0&&m.push(c);const b=[];for(let d=0;d<m.length;d++)d<m.length-1&&m[d].length===1&&O.test(m[d])&&U.test(m[d+1][0])?(b.push(m[d]+m[d+1]),d+=1):b.push(m[d]);return b}if(t.startsWith("el")){if(!D.test(e)&&!O.test(e))return[e];const i=[];re.lastIndex=0;let p;for(;(p=re.exec(e))!==null;)i.push(p[0]);i.length===0&&i.push(e);const m=[];if(i.length===1){const c=i[0];if(!c||!D.test(c[0])||c.length===1)return[c??e]}for(const c of i){if(!c)continue;if(!D.test(c[0])||c.length===1){m.push(c);continue}const u=c.length;let f=c[0],g=c[0]===c[0].toLocaleUpperCase(t);for(let b=1;b<u;b++){const d=c[b],y=d===d.toLocaleUpperCase(t);!g&&y?(m.push(f),f=d):f+=d,g=y}f&&m.push(f)}return m}if(t.startsWith("ja")||t.startsWith("ko")){const i=t.startsWith("ja"),p=i?{hiragana:$(c=>Me.test(c),"hiragana"),kanji:$(c=>ne.test(c),"kanji"),katakana:$(c=>Re.test(c),"katakana"),latin:$(c=>O.test(c),"latin")}:{hangul:$(c=>ae.test(c),"hangul"),latin:$(c=>O.test(c),"latin")},m=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(i){const c=W(e,p,!1,t,(f,g)=>f==="hiragana"&&g==="katakana"||f==="katakana"&&g==="hiragana"||f==="hiragana"&&g==="latin"||f==="katakana"&&g==="latin"||f==="kanji"&&g==="latin"||f==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),u=[];for(const f of c){const g=f;g.length===1&&m.has(g)&&u.length>0?u[u.length-1]=u.at(-1)+g:u.push(g)}return u.length>0?u:[e]}return W(e,p,!1,t,(c,u)=>c==="hangul"&&u==="latin"||c==="latin"&&u==="hangul")}if(t.startsWith("sl")){const i=[...e],p=i.length,m=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(t);for(let f=1;f<p;f++){const g=i[f],b=g===g.toLocaleUpperCase(t),d=Pt.test(g),y=f<p-1&&i[f+1]===i[f+1].toLocaleUpperCase(t);!u&&b||d&&y?(m.push(c),c=g,d&&y&&(m.push(c),c="")):c+=g,u=b}return c&&c.length>0&&m.push(c),m}if(t.startsWith("zh"))return W(e,{han:$(i=>ne.test(i),"han"),latin:$(i=>O.test(i),"latin")},!1,t);if(["ar","fa","he","ur"].includes(t.split("-")[0])){const i=$(p=>se.test(p)||ie.test(p),"isRtlChar");return W(e,{latin:$(p=>O.test(p),"latin"),rtl:$(p=>i(p),"rtl")},!1,t)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(t.split("-")[0])){const i=$(p=>Fe.test(p)||Ie.test(p)||Ne.test(p)||Be.test(p)||qe.test(p)||Ge.test(p)||Qe.test(p)||Ve.test(p)||De.test(p)||Ke.test(p)||Je.test(p)||Ye.test(p)||He.test(p)||Xe.test(p)||Ze.test(p)||et.test(p),"isIndicChar");return W(e,{indic:$(p=>i(p),"indic"),latin:$(p=>O.test(p),"latin")},!1,t)}if(["be","bg","ru","sr","uk"].includes(t))return W(e,{cyrillic:$(i=>U.test(i),"cyrillic"),latin:$(i=>O.test(i),"latin")},!0,t);if(["ar","fa","he"].includes(t))return W(e,{latin:$(i=>O.test(i),"latin"),rtl:$(i=>se.test(i)||ie.test(i),"rtl")},!1,t);if(t.startsWith("ko"))return W(e,{hangul:$(i=>ae.test(i),"hangul"),latin:$(i=>O.test(i),"latin")},!1,t);if(t.startsWith("uz")){if(!U.test(e)&&!O.test(e))return[e];const i=[...e],p=i.length,m=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(t);for(let f=1;f<p;f++){const g=i[f],b=g===g.toLocaleUpperCase(t);if(oe.test(g)||oe.test(i[f-1])){c+=g;continue}!u&&b?(m.push(c),c=g):c+=g,u=b}return c&&c.length>0&&m.push(c),m}const a=[...e],s=a.length,l=[];let o=a[0],h=a[0]===a[0].toLocaleUpperCase(t);for(const i of r)if(e.startsWith(i)){l.push(i),o=a[i.length],h=o===o.toLocaleUpperCase(t);break}for(let i=1;i<s;i++){const p=a[i],m=p===p.toLocaleUpperCase(t);let c=0;for(const u of r)if(e.startsWith(u,i)){l.push(o,u),c=u.length,o="";const f=u.at(-1);f&&(h=f===f.toLocaleUpperCase(t));break}if(c>0){i+=c-1;continue}!h&&m?(l.push(o),o=p):o+=p,h=m}return o&&l.push(o),l},"splitCamelCaseLocale"),Et=$((e,t,r)=>{const n=[],a=L.test(e)?e.split(L).filter(Boolean):[e];for(const s of a){const l=s;if(L.test(l))n.push(l);else{const o=M.test(l)?kt(l).filter(Boolean):[l];for(const h of o)if(M.test(h))n.push(h);else if(t){const i=t.toLowerCase().split("-")[0];n.push(...ye(h,i,r))}else n.push(...be(h,r))}}return n},"processTextWithAnsiEmoji"),G=$((e,t={})=>{if(!e||typeof e!="string")return[];const{handleAnsi:r=!1,handleEmoji:n=!1,knownAcronyms:a=[],locale:s,normalize:l=!1,separators:o,stripAnsi:h=!1,stripEmoji:i=!1}=t,p=new Set([...a].toSorted((d,y)=>y.length-d.length));let m=e;h&&(m=yt(m)),i&&(m=Te(m));let c;Array.isArray(o)?c=jt(o):o instanceof RegExp?c=o:c=ze;const u=[];let f=m;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;f.length>0;){const d=g.exec(f);if(!d){f===".."?u.push(".."):f==="."?u.push("."):f.length>0&&u.push(f);break}const y=d.index,v=d[0],j=v.length,I=f.slice(0,y),We=f.slice(y+j);if(v.startsWith("../"))u.push(".."),f=f.slice(y+3);else if(v.startsWith("./"))u.push("."),f=f.slice(y+2);else if(y===0&&v==="..")u.push(".."),f=f.slice(2);else if(y===0&&v===".")u.push("."),f=f.slice(1);else{I.length>0&&u.push(I);let x=0;for(;(x=v.indexOf("../",x))!==-1;)u.push(".."),x+=3;for(x=0;(x=v.indexOf("./",x))!==-1;)(x===0||v[x-1]!==".")&&u.push("."),x+=2;let E=We;for(;E.startsWith("../");)u.push(".."),E=E.slice(3);for(;E.startsWith("./");)u.push("."),E=E.slice(2);if(E===".."){u.push("..");break}else if(E==="."){u.push(".");break}else f=E}g.lastIndex=0}if(u.length===0){const d=m.split(c).filter(Boolean);u.push(...d)}let b=[];for(const d of u)r||n?b.push(...Et(d,s,p)):s?b.push(...ye(d,s,p)):b.push(...be(d,p));return l&&(b=b.map(d=>p.has(d)?d:s&&d===d.toLocaleUpperCase(s)?d[0]+d.slice(1).toLocaleLowerCase(s):d.toUpperCase()===d&&!p.has(d)?d.slice(0,1)+d.slice(1).toLowerCase():d)),b},"splitByCase");var Wt=Object.defineProperty,Lt=C((e,t)=>Wt(e,"name",{value:t,configurable:!0}),"r$5"),St=Object.defineProperty,_t=Lt((e,t)=>St(e,"name",{value:t,configurable:!0}),"o"),Ut=Object.defineProperty,Tt=_t((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"s");const Z=Tt((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleUpperCase(t.locale):e[0].toUpperCase())+e.slice(1),"upperFirst");var zt=Object.defineProperty,Rt=C((e,t)=>zt(e,"name",{value:t,configurable:!0}),"r$4"),Mt=Object.defineProperty,Ft=Rt((e,t)=>Mt(e,"name",{value:t,configurable:!0}),"r"),It=Object.defineProperty,Nt=Ft((e,t)=>It(e,"name",{value:t,configurable:!0}),"n");const Q=Nt((e,t)=>`${e}::${t?.joiner??""}::${t?.locale??""}::${t?.knownAcronyms?.join(",")??""}::${t?.normalize?"true":"false"}`,"generateCacheKey");var Bt=Object.defineProperty,qt=C((e,t)=>Bt(e,"name",{value:t,configurable:!0}),"i$3"),Gt=Object.defineProperty,Qt=qt((e,t)=>Gt(e,"name",{value:t,configurable:!0}),"f"),Vt=Object.defineProperty,Dt=Qt((e,t)=>Vt(e,"name",{value:t,configurable:!0}),"l");const V=Dt((e,t)=>{const{length:r}=e;if(r===0)return"";if(r===1)return e[0];const n=[];let a="",s="";for(let l=0;l<r;l++){const o=e[l];if(L.test(o)){a?(n.push(a+s+o),a="",s=""):(n.length>0&&n.push(t),a=o);continue}a?(s&&(s+=t),s+=o):(n.length>0&&n.push(t),n.push(o))}return n.join("")},"joinSegments");var Kt=Object.defineProperty,Jt=C((e,t)=>Kt(e,"name",{value:t,configurable:!0}),"r$3"),Yt=Object.defineProperty,Ht=Jt((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"a"),Xt=Object.defineProperty,Zt=Ht((e,t)=>Xt(e,"name",{value:t,configurable:!0}),"e");const er=/(?<![a-zß])SS(?![a-z])/g,ee=Zt(e=>e.replaceAll(er,"ß"),"normalizeGermanEszett");var tr=Object.defineProperty,rr=C((e,t)=>tr(e,"name",{value:t,configurable:!0}),"c$3"),nr=Object.defineProperty,ar=rr((e,t)=>nr(e,"name",{value:t,configurable:!0}),"c"),sr=Object.defineProperty,ir=ar((e,t)=>sr(e,"name",{value:t,configurable:!0}),"o");const or=new S(1e3),lr=ir((e,t)=>{if(typeof e!="string"||!e)return"";const r=t?.cache??!1,n=t?.cacheStore??or;let a;if(r&&(a=Q(e,t)),r&&a&&n.has(a))return n.get(a);let s=!0;const l=V(G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(o=>{if(t?.handleAnsi&&L.test(o))return o;const h=t?.locale?.startsWith("de")?ee(o):o,i=t?.locale?h.toLocaleLowerCase(t.locale):h.toLowerCase();return s?(s=!1,pt(i,t)):Z(i,t)}),"");return r&&a&&n.set(a,l),l},"camelCase");var cr=Object.defineProperty,ur=C((e,t)=>cr(e,"name",{value:t,configurable:!0}),"l$3"),fr=Object.defineProperty,pr=ur((e,t)=>fr(e,"name",{value:t,configurable:!0}),"l"),hr=Object.defineProperty,mr=pr((e,t)=>hr(e,"name",{value:t,configurable:!0}),"o");const dr=new S(1e3),te=mr((e,t)=>{if(typeof e!="string")return"";const r=t?.cache??!1,n=t?.cacheStore??dr;let a;if(r&&(a=Q(e,t)),r&&a&&n.has(a))return n.get(a);const s=G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(o=>{if(t?.handleAnsi&&L.test(o))return o;if(t?.toUpperCase)return t.locale?o.toLocaleUpperCase(t.locale):o.toUpperCase();const h=t?.locale?.startsWith("de")?ee(o):o;return t?.locale?h.toLocaleLowerCase(t.locale):h.toLowerCase()}),l=V(s,t?.joiner??"-");return r&&a&&n.set(a,l),l},"kebabCase");var gr=Object.defineProperty,br=C((e,t)=>gr(e,"name",{value:t,configurable:!0}),"r$2"),yr=Object.defineProperty,$r=br((e,t)=>yr(e,"name",{value:t,configurable:!0}),"a"),vr=Object.defineProperty,wr=$r((e,t)=>vr(e,"name",{value:t,configurable:!0}),"s");const jr=new S(1e3),Cr=wr((e,t)=>te(e,{cacheStore:jr,...t,joiner:"_",toUpperCase:!0}),"constantCase");var Or=Object.defineProperty,kr=C((e,t)=>Or(e,"name",{value:t,configurable:!0}),"l$2"),Ar=Object.defineProperty,Pr=kr((e,t)=>Ar(e,"name",{value:t,configurable:!0}),"l"),xr=Object.defineProperty,Er=Pr((e,t)=>xr(e,"name",{value:t,configurable:!0}),"i");const Wr=new S(1e3),Lr=Er((e,t)=>{if(typeof e!="string"||!e)return"";const r=t?.cache??!1,n=t?.cacheStore??Wr;let a;if(r&&(a=Q(e,t)),r&&a&&n.has(a))return n.get(a);const s=V(G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(l=>{if(t?.handleAnsi&&L.test(l))return l;const o=t?.locale?.startsWith("de")?ee(l):l;return Z(t?.locale?o.toLocaleLowerCase(t.locale):o.toLowerCase(),{locale:t?.locale})}),"");return r&&a&&n.set(a,s),s},"pascalCase");var Sr=Object.defineProperty,_r=C((e,t)=>Sr(e,"name",{value:t,configurable:!0}),"r$1"),Ur=Object.defineProperty,Tr=_r((e,t)=>Ur(e,"name",{value:t,configurable:!0}),"a"),zr=Object.defineProperty,Rr=Tr((e,t)=>zr(e,"name",{value:t,configurable:!0}),"s");const Mr=new S(1e3),Fr=Rr((e,t)=>te(e,{cacheStore:Mr,...t,joiner:"_"}),"snakeCase");var Ir=Object.defineProperty,Nr=C((e,t)=>Ir(e,"name",{value:t,configurable:!0}),"r"),Br=Object.defineProperty,qr=Nr((e,t)=>Br(e,"name",{value:t,configurable:!0}),"e"),Gr=Object.defineProperty,Qr=qr((e,t)=>Gr(e,"name",{value:t,configurable:!0}),"i");const Vr=new S(1e3),Dr=Qr((e,t)=>{if(typeof e!="string")return"";const r=t?.cache??!1,n=t?.cacheStore??Vr;let a;if(r&&(a=Q(e,t)),r&&a&&n.has(a))return n.get(a);const s=V(G(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(l=>Z(l,{locale:t?.locale})),"-");return r&&a&&n.set(a,s),s},"trainCase");var Kr=Object.defineProperty,k=C((e,t)=>Kr(e,"name",{value:t,configurable:!0}),"e");const A=k(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),H={camel_case:k(e=>lr(A(e)),"camel_case"),kebab_case:k(e=>te(A(e)),"kebab_case"),lower_case:k(e=>A(e).toLowerCase(),"lower_case"),pascal_case:k(e=>Lr(A(e)),"pascal_case"),path_join:k((e,...t)=>{const r=[A(e),...t.map(n=>A(n))];return he(...r)},"path_join"),path_relative:k((e,t)=>pe(A(t),A(e)),"path_relative"),snake_case:k(e=>Fr(A(e)),"snake_case"),upper_case:k(e=>A(e).toUpperCase(),"upper_case"),upper_kebab_case:k(e=>Dr(A(e)),"upper_kebab_case"),upper_snake_case:k(e=>Cr(A(e)),"upper_snake_case")};k(e=>Object.hasOwn(H,e),"isKnownFilter");const $e=k((e,t,r=[])=>{const n=H[e];if(!n)throw new Error(`Unknown filter "${e}". Known filters: ${Object.keys(H).sort().join(", ")}.`);return n(t,...r)},"applyFilter");var Jr=Object.defineProperty,ve=C((e,t)=>Jr(e,"name",{value:t,configurable:!0}),"d$1");const we=ve(e=>{const t=[];let r=0,n=0,a,s=-1;for(const l of e){if(s+=1,a){l===a&&(a=void 0);continue}if(l==='"'||l==="'"){a=l;continue}l==="("?r+=1:l===")"?r-=1:l===","&&r===0&&(t.push(e.slice(n,s)),n=s+1)}return t.push(e.slice(n)),t},"splitCommaOutsideQuotes"),Yr=ve(e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},"stripQuotes");var Hr=Object.defineProperty,_=C((e,t)=>Hr(e,"name",{value:t,configurable:!0}),"s$1");const Xr=/\[([^\]]+)\]/g,Zr=_(e=>{const t=e.trim(),r=t.indexOf("(");if(r===-1)return{args:[],name:t};if(!t.endsWith(")"))throw new Error(`Filter call "${e}" missing closing ")"`);const n=t.slice(0,r).trim(),a=t.slice(r+1,-1).trim();return a===""?{args:[],name:n}:{args:we(a).map(s=>{const l=s.trim();return Yr(l)??l}),name:n}},"parseFilterCall"),en=_(e=>{const t=e.split("|").map(n=>n.trim()),r=t[0]??"";if(!r)throw new Error(`Empty variable name in expression "${e}"`);return{filters:t.slice(1).map(n=>Zr(n)),name:r}},"parsePipe"),tn=_(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),rn=_((e,t)=>{const r=e.replaceAll(Xr,(n,a)=>{const{filters:s,name:l}=en(a);if(!Object.hasOwn(t,l))throw new Error(`Variable "${l}" used in filename "${e}" but not defined`);let o=t[l];for(const h of s)o=$e(h.name,o,h.args);return tn(o)});return je(r)},"interpolateFilename"),je=_(e=>e.split("/").map(t=>t.endsWith(".tera")||t.endsWith(".twig")?t.slice(0,-5):t).join("/"),"stripTeraSuffix"),nn=_(e=>e.endsWith(".raw")?e.slice(0,-4):e,"stripRawSuffix"),an=_(e=>{const t=e.split("/");return(t.at(-1)??"").startsWith("_")?!0:t.slice(0,-1).includes("partials")},"isPartialPath");var sn=Object.defineProperty,on=C((e,t)=>sn(e,"name",{value:t,configurable:!0}),"i");const ln=on((e,t)=>{if(!e.startsWith(`---
|
|
2
2
|
`)&&!e.startsWith(`---\r
|
|
3
3
|
`))return{body:e};const r=e.indexOf(`
|
|
4
4
|
---`,3);if(r===-1)return{body:e};let n=r+1+3;e[n]==="\r"&&(n+=1),e[n]===`
|
|
5
5
|
`&&(n+=1);const a=e.startsWith(`---\r
|
|
6
|
-
`)?5:4,
|
|
7
|
-
`&&(n+=1)},"advanceLine");for(const i of e.matchAll(Cn)){const l=i.index??0;if(l>r){const s=e.slice(r,l);t.push({line:n,type:"text",value:s}),a(s)}const o=n,h=i[0];h.startsWith("{{")?t.push({line:o,type:"expr",value:(i[1]??"").trim()}):t.push({line:o,type:"stmt",value:(i[2]??"").trim()}),a(h),r=l+h.length}if(r<e.length){const i=e.slice(r);t.push({line:n,type:"text",value:i})}return t},"tokenize"),Sn=new Set(["block","endblock","endfilter","endmacro","extends","filter","import","macro","set"]),Pe=j((e,t)=>{let r=0;const n=j((i,l)=>{throw new Error(`${t}:${i}: ${l}`)},"error"),a=j(i=>{const l=[];for(;r<e.length;){const o=e[r];if(o.type==="text"){l.push({type:"text",value:o.value}),r+=1;continue}if(o.type==="expr"){l.push({expression:o.value,line:o.line,type:"expr"}),r+=1;continue}const h=o.value.split(/\s+/)[0]??"";if(i.includes(h))return l;if(Sn.has(h)&&n(o.line,`Tera feature "{% ${h} %}" is not supported. Supported: if/else/endif, for/endfor, include. Rewrite the template to avoid macros, set, extends, block, and import.`),h==="if"){r+=1;const s=o.value.slice(2).trim(),f=a(["else","endif"]);let m;r<e.length&&e[r].type==="stmt"&&e[r].value.split(/\s+/)[0]==="else"&&(r+=1,m=a(["endif"])),(r>=e.length||e[r].type!=="stmt"||e[r].value.split(/\s+/)[0]!=="endif")&&n(o.line,"Unterminated {% if %} — missing {% endif %}"),r+=1,l.push({alternate:m,condition:s,consequent:f,line:o.line,type:"if"});continue}if(h==="for"){r+=1;const s=o.value.slice(3).trim(),f=s.indexOf(" in ");f===-1&&n(o.line,"Malformed {% for %} — expected `for <name> in <collection>`");const m=s.slice(0,f).trim(),c=s.slice(f+4).trim();(!m||!c)&&n(o.line,"Malformed {% for %} — missing binding or collection");const u=a(["endfor"]);(r>=e.length||e[r].type!=="stmt"||e[r].value.split(/\s+/)[0]!=="endfor")&&n(o.line,"Unterminated {% for %} — missing {% endfor %}"),r+=1,l.push({binding:m,body:u,collection:c,line:o.line,type:"for"});continue}if(h==="include"){r+=1;const s=o.value.slice(7).trim(),f=Ae(s);f===void 0&&n(o.line,"Malformed {% include %} — expected a quoted partial name"),l.push({line:o.line,name:f,type:"include"});continue}n(o.line,`Unknown tag "{% ${h} %}". Supported: if, for, include.`)}return l},"parseBlock");return a([])},"parse"),Ae=j(e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},"stripQuotes"),Pn=j(e=>e==null?"":typeof e=="boolean"||typeof e=="number"?String(e):typeof e=="string"?e:JSON.stringify(e),"stringify"),An=j(e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:!0,"isTruthy"),Le=j((e,t,r,n,a=!0)=>{const i=e.split(".");if(a&&i.length>0&&!Object.hasOwn(t,i[0]))throw new Error(`${n}:${r}: Variable "${e}" is not defined`);let l=t;for(const o of i){if(l==null)return;if(typeof l!="object")throw new TypeError(`${n}:${r}: Cannot read "${o}" on non-object value`);l=l[o]}return l},"lookupVariable"),Ln=j(e=>{const t=[];let r=0,n=0,a;for(let i=0;i<e.length;i+=1){const l=e[i];if(a){l===a&&(a=void 0);continue}if(l==='"'||l==="'"){a=l;continue}l==="("?r+=1:l===")"?r-=1:l==="|"&&r===0&&(t.push(e.slice(n,i)),n=i+1)}return t.push(e.slice(n)),t},"splitFilterPipe"),Wn=j(e=>{const t=e.trim(),r=t.indexOf("(");if(r===-1)return{args:[],name:t};if(!t.endsWith(")"))throw new Error(`Filter call "${e}" missing closing ")"`);const n=t.slice(0,r).trim(),a=t.slice(r+1,-1).trim();return a?{args:xe(a).map(i=>i.trim()),name:n}:{args:[],name:n}},"parseFilterCall"),N=j((e,t,r,n,a=!0)=>{const i=e.trim();if(i==="true")return!0;if(i==="false")return!1;if(i==="null"||i==="none")return null;const l=Ae(i);return l!==void 0?l:/^-?\d+(?:\.\d+)?$/.test(i)?Number(i):Le(i,t,r,n,a)},"evaluatePrimary"),We=j((e,t,r,n,a=!0)=>{const i=Ln(e),l=i[0].trim();let o=N(l,t,r,n,a);for(let h=1;h<i.length;h+=1){const s=i[h].trim(),{args:f,name:m}=Wn(s),c=f.map(u=>N(u,t,r,n,a));try{o=Oe(m,o,c)}catch(u){const p=u instanceof Error?u.message:String(u);throw new Error(`${n}:${r}: ${p}`,{cause:u})}}return o},"evaluateExpression"),Re=j((e,t)=>{let r,n=0;for(let a=0;a<=e.length-t.length;a+=1){const i=e[a];if(r){i===r&&(r=void 0);continue}if(i==='"'||i==="'"){r=i;continue}if(i==="("){n+=1;continue}if(i===")"){n-=1;continue}if(n===0&&e.slice(a,a+t.length)===t)return a}return-1},"findOperatorOutsideQuotes"),ue=j((e,t)=>{const r=[];let n=0,a=0;for(;a<=e.length-t.length;){const i=Re(e.slice(a),t);if(i===-1)break;r.push(e.slice(n,a+i)),a+=i+t.length,n=a}return r.push(e.slice(n)),r},"splitLogical"),U=j((e,t,r,n)=>{const a=e.trim();if(a==="")return!1;if(a.startsWith("(")&&a.endsWith(")")&&Rn(a)===a.length-1)return U(a.slice(1,-1),t,r,n);const i=ue(a," or ");if(i.length>1)return i.some(o=>U(o,t,r,n));const l=ue(a," and ");if(l.length>1)return l.every(o=>U(o,t,r,n));if(a.startsWith("not "))return!U(a.slice(4),t,r,n);for(const o of["==","!="]){const h=Re(a,o);if(h!==-1){const s=N(a.slice(0,h),t,n,r,!1),f=N(a.slice(h+o.length),t,n,r,!1),m=s===f;return o==="=="?m:!m}}return An(We(a,t,n,r,!1))},"evaluateConditionExpression"),Rn=j(e=>{if(e[0]!=="(")return-1;let t=0,r,n=-1;for(const a of e){if(n+=1,r){a===r&&(r=void 0);continue}if(a==='"'||a==="'"){r=a;continue}if(a==="(")t+=1;else if(a===")"&&(t-=1,t===0))return n}return-1},"matchingParen"),F=j((e,t)=>{let r="";for(const n of e){if(n.type==="text"){r+=n.value;continue}if(n.type==="expr"){r+=Pn(We(n.expression,t.scope,n.line,t.filename));continue}if(n.type==="if"){const a=U(n.condition,t.scope,t.filename,n.line)?n.consequent:n.alternate??[];r+=F(a,t);continue}if(n.type==="for"){const a=Le(n.collection,t.scope,n.line,t.filename,!1);if(a==null)continue;if(!Array.isArray(a))throw new TypeError(`${t.filename}:${n.line}: {% for %} expected an array, got ${typeof a}`);for(const i of a){const l={...t.scope,[n.binding]:i};r+=F(n.body,{...t,scope:l})}continue}if(n.type==="include"){const a=t.partials?.get(n.name);if(!a)throw new Error(`${t.filename}:${n.line}: Partial "${n.name}" not found. Available: ${[...t.partials?.keys()??[]].join(", ")||"(none)"}`);const i=t.includeStack??new Set;if(i.has(n.name)){const l=[...i,n.name].join(" → ");throw new Error(`${t.filename}:${n.line}: Circular partial include detected: ${l}`)}i.add(n.name);try{r+=F(a,{...t,filename:`<partial:${n.name}>`,includeStack:i})}finally{i.delete(n.name)}}}return r},"renderNodes"),_n=j((e,t)=>Pe(Se(e),t),"parseTemplate");j((e,t)=>F(e,t),"renderAst");const X=j((e,t)=>F(Pe(Se(e),t.filename),t),"renderTemplate");var Un=Object.defineProperty,C=w((e,t)=>Un(e,"name",{value:t,configurable:!0}),"s");const pe="template.yml",Tn=".raw",zn=new Set([".cjs",".css",".env",".gitattributes",".gitignore",".graphql",".html",".ini",".js",".json",".json5",".jsonc",".jsx",".lock",".md",".mdx",".mjs",".prettierrc",".raw",".rs",".scss",".sh",".sql",".svg",".tera",".toml",".ts",".tsx",".twig",".txt",".vue",".xml",".yaml",".yml"]),Mn=new Set(["Brewfile","CHANGELOG","CODEOWNERS","CONTRIBUTING","COPYING","Dockerfile","Gemfile","LICENCE","LICENSE","Makefile","NOTICE","Procfile","Rakefile","README","VERSION"]),Fn=C(e=>{const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),r=t===-1?e:e.slice(t+1),n=r.lastIndexOf(".");return n===-1||n===0?"":r.slice(n).toLowerCase()},"lastDot"),_e=C(e=>{const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)},"basename"),Bn=C(e=>{const t=Fn(e);if(t!=="")return zn.has(t);const r=_e(e);return Mn.has(r)},"isLikelyText"),In=C(e=>{const t={default:e.default,internal:e.internal,order:e.order,prompt:e.prompt,required:e.required};switch(e.type){case"array":return{...t,type:"array"};case"boolean":return{...t,default:typeof t.default=="boolean"?t.default:void 0,type:"boolean"};case"enum":return{...t,multiple:e.multiple,type:"enum",values:e.values??[]};case"number":return{...t,type:"number"};case"string":return{...t,type:"string"};default:throw new Error(`Unsupported variable type "${String(e.type)}"`)}},"yamlVariableToVariable"),Nn=C(e=>e.replaceAll("\\","/").replace(/^\.\//,"").replaceAll(/\/+/g,"/"),"normalizeDestinationPath"),qn=C((e,t,r)=>{const n=t.split("/").filter(Boolean);if(n.length===0)throw new Error("Empty destination path for value");let a=e;for(let i=0;i<n.length-1;i+=1){const l=n[i],o=a[l];if(o===void 0){const h={};a[l]=h,a=h}else if(typeof o=="object"&&!Buffer.isBuffer(o))a=o;else throw new TypeError(`Path conflict: "${n.slice(0,i+1).join("/")}" is both a file and a directory`)}a[n.at(-1)]=r},"flattenFiles"),fe=C((e,t,r)=>{if(typeof e!="string")return Gn(e);const n=e.includes("{{")||e.includes("{%")?X(e,{filename:`${r}#frontmatter`,scope:t}):e;return U(n,t,`${r}#frontmatter`,1)},"evaluateGate"),Gn=C(e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:typeof e=="string"?e!=="false"&&e!=="0":!0,"truthyValue"),Yn=C((e,t)=>{const r=me(e,pe),n=Be(r);if(!n||typeof n!="object")throw new Error(`${r}: must contain a YAML mapping`);const a={};if(n.variables)for(const[h,s]of Object.entries(n.variables))a[h]=In(s);const i=new Map,l=[];for(const h of Ie(e,{includeDirs:!1,includeSymlinks:!1})){if(h.path===r)continue;const s=he(e,h.path).replaceAll("\\","/");if(s===pe)continue;if(jn(s)){const m=I(h.path),c=_n(m,s);for(const u of Dn(s))i.has(u)&&i.get(u)!==c&&Ne.warn(`partial name "${u}" is declared by multiple files — last one wins. Use distinct names or fully-qualified includes.`),i.set(u,c);continue}if(s.endsWith(Tn)){const m=I(h.path);l.push({binary:null,isRaw:!0,rawText:m,relativePath:s});continue}if(Bn(s)){const m=I(h.path);l.push({binary:null,isRaw:!1,rawText:m,relativePath:s});continue}const f=I(h.path,{buffer:!0});l.push({binary:f,isRaw:!1,rawText:null,relativePath:s})}const o=C(h=>{const s={...h.builtins,...h.options},f={},m={};for(const u of l){const p=u.relativePath;let g,y,d=!1;if(u.binary)g=u.binary;else if(u.isRaw)g=u.rawText??"";else{const v=u.rawText??"",E=kn(v,B=>qe(B));if(E.frontmatter){if(E.frontmatter.skip!==void 0&&fe(E.frontmatter.skip,s,p)||E.frontmatter.if!==void 0&&!fe(E.frontmatter.if,s,p))continue;typeof E.frontmatter.to=="string"&&(y=X(E.frontmatter.to,{filename:`${p}#frontmatter.to`,partials:i,scope:s})),E.frontmatter.force===!0&&(d=!0)}g=X(E.body,{filename:p,partials:i,scope:s})}const b=Nn(y??vn(wn(p),s));qn(f,b,g),d&&(m[b]={force:!0})}const c={files:f};return Object.keys(m).length>0&&(c.filesMeta=m),c},"produce");return{about:{description:n.description??`Moon-format template at ${e}`,name:n.title??t},destination:n.destination,options:a,produce:o}},"loadMoonTemplate"),Dn=C(e=>{const t=Ce(e),r=_e(t),n=new Set([r,t]);if(r.startsWith("_")){n.add(r.replace(/^_+/,""));const a=t.slice(0,t.length-r.length);n.add(`${a}${r.replace(/^_+/,"")}`)}return[...n]},"partialKeys");export{Yn as loadMoonTemplate};
|
|
6
|
+
`)?5:4,s=e.slice(a,r).replaceAll("\r","");let l;try{l=t(s)}catch(o){const h=o instanceof Error?o.message:String(o);throw new Error(`Failed to parse frontmatter YAML: ${h}`,{cause:o})}if(l==null)return{body:e.slice(n)};if(typeof l!="object"||Array.isArray(l))throw new TypeError(`Frontmatter must be a YAML mapping, got ${Array.isArray(l)?"array":typeof l}`);return{body:e.slice(n),frontmatter:l}},"splitFrontmatter");var cn=Object.defineProperty,w=C((e,t)=>cn(e,"name",{value:t,configurable:!0}),"c");const un=/\{\{-?(.+?)-?\}\}|\{%-?(.+?)-?%\}/gs,Ce=w(e=>{const t=[];let r=0,n=1;const a=w(s=>{for(const l of s)l===`
|
|
7
|
+
`&&(n+=1)},"advanceLine");for(const s of e.matchAll(un)){const l=s.index??0;if(l>r){const i=e.slice(r,l);t.push({line:n,type:"text",value:i}),a(i)}const o=n,h=s[0];h.startsWith("{{")?t.push({line:o,type:"expr",value:(s[1]??"").trim()}):t.push({line:o,type:"stmt",value:(s[2]??"").trim()}),a(h),r=l+h.length}if(r<e.length){const s=e.slice(r);t.push({line:n,type:"text",value:s})}return t},"tokenize"),fn=new Set(["block","endblock","endfilter","endmacro","extends","filter","import","macro","set"]),Oe=w((e,t)=>{let r=0;const n=w((s,l)=>{throw new Error(`${t}:${s}: ${l}`)},"error"),a=w(s=>{const l=[];for(;r<e.length;){const o=e[r];if(o.type==="text"){l.push({type:"text",value:o.value}),r+=1;continue}if(o.type==="expr"){l.push({expression:o.value,line:o.line,type:"expr"}),r+=1;continue}const h=o.value.split(/\s+/)[0]??"";if(s.includes(h))return l;if(fn.has(h)&&n(o.line,`Tera feature "{% ${h} %}" is not supported. Supported: if/else/endif, for/endfor, include. Rewrite the template to avoid macros, set, extends, block, and import.`),h==="if"){r+=1;const i=o.value.slice(2).trim(),p=a(["else","endif"]);let m;r<e.length&&e[r].type==="stmt"&&e[r].value.split(/\s+/)[0]==="else"&&(r+=1,m=a(["endif"])),(r>=e.length||e[r].type!=="stmt"||e[r].value.split(/\s+/)[0]!=="endif")&&n(o.line,"Unterminated {% if %} — missing {% endif %}"),r+=1,l.push({alternate:m,condition:i,consequent:p,line:o.line,type:"if"});continue}if(h==="for"){r+=1;const i=o.value.slice(3).trim(),p=i.indexOf(" in ");p===-1&&n(o.line,"Malformed {% for %} — expected `for <name> in <collection>`");const m=i.slice(0,p).trim(),c=i.slice(p+4).trim();(!m||!c)&&n(o.line,"Malformed {% for %} — missing binding or collection");const u=a(["endfor"]);(r>=e.length||e[r].type!=="stmt"||e[r].value.split(/\s+/)[0]!=="endfor")&&n(o.line,"Unterminated {% for %} — missing {% endfor %}"),r+=1,l.push({binding:m,body:u,collection:c,line:o.line,type:"for"});continue}if(h==="include"){r+=1;const i=o.value.slice(7).trim(),p=ke(i);p===void 0&&n(o.line,"Malformed {% include %} — expected a quoted partial name"),l.push({line:o.line,name:p,type:"include"});continue}n(o.line,`Unknown tag "{% ${h} %}". Supported: if, for, include.`)}return l},"parseBlock");return a([])},"parse"),ke=w(e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},"stripQuotes"),pn=w(e=>e==null?"":typeof e=="boolean"||typeof e=="number"?String(e):typeof e=="string"?e:JSON.stringify(e),"stringify"),hn=w(e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:!0,"isTruthy"),Ae=w((e,t,r,n,a=!0)=>{const s=e.split(".");if(a&&s.length>0&&!Object.hasOwn(t,s[0]))throw new Error(`${n}:${r}: Variable "${e}" is not defined`);let l=t;for(const o of s){if(l==null)return;if(typeof l!="object")throw new TypeError(`${n}:${r}: Cannot read "${o}" on non-object value`);l=l[o]}return l},"lookupVariable"),mn=w(e=>{const t=[];let r=0,n=0,a;for(let s=0;s<e.length;s+=1){const l=e[s];if(a){l===a&&(a=void 0);continue}if(l==='"'||l==="'"){a=l;continue}l==="("?r+=1:l===")"?r-=1:l==="|"&&r===0&&(t.push(e.slice(n,s)),n=s+1)}return t.push(e.slice(n)),t},"splitFilterPipe"),dn=w(e=>{const t=e.trim(),r=t.indexOf("(");if(r===-1)return{args:[],name:t};if(!t.endsWith(")"))throw new Error(`Filter call "${e}" missing closing ")"`);const n=t.slice(0,r).trim(),a=t.slice(r+1,-1).trim();return a?{args:we(a).map(s=>s.trim()),name:n}:{args:[],name:n}},"parseFilterCall"),B=w((e,t,r,n,a=!0)=>{const s=e.trim();if(s==="true")return!0;if(s==="false")return!1;if(s==="null"||s==="none")return null;const l=ke(s);return l!==void 0?l:/^-?\d+(?:\.\d+)?$/.test(s)?Number(s):Ae(s,t,r,n,a)},"evaluatePrimary"),Pe=w((e,t,r,n,a=!0)=>{const s=mn(e),l=s[0].trim();let o=B(l,t,r,n,a);for(let h=1;h<s.length;h+=1){const i=s[h].trim(),{args:p,name:m}=dn(i),c=p.map(u=>B(u,t,r,n,a));try{o=$e(m,o,c)}catch(u){const f=u instanceof Error?u.message:String(u);throw new Error(`${n}:${r}: ${f}`,{cause:u})}}return o},"evaluateExpression"),xe=w((e,t)=>{let r,n=0;for(let a=0;a<=e.length-t.length;a+=1){const s=e[a];if(r){s===r&&(r=void 0);continue}if(s==='"'||s==="'"){r=s;continue}if(s==="("){n+=1;continue}if(s===")"){n-=1;continue}if(n===0&&e.slice(a,a+t.length)===t)return a}return-1},"findOperatorOutsideQuotes"),ce=w((e,t)=>{const r=[];let n=0,a=0;for(;a<=e.length-t.length;){const s=xe(e.slice(a),t);if(s===-1)break;r.push(e.slice(n,a+s)),a+=s+t.length,n=a}return r.push(e.slice(n)),r},"splitLogical"),T=w((e,t,r,n)=>{const a=e.trim();if(a==="")return!1;if(a.startsWith("(")&&a.endsWith(")")&&gn(a)===a.length-1)return T(a.slice(1,-1),t,r,n);const s=ce(a," or ");if(s.length>1)return s.some(o=>T(o,t,r,n));const l=ce(a," and ");if(l.length>1)return l.every(o=>T(o,t,r,n));if(a.startsWith("not "))return!T(a.slice(4),t,r,n);for(const o of["==","!="]){const h=xe(a,o);if(h!==-1){const i=B(a.slice(0,h),t,n,r,!1),p=B(a.slice(h+o.length),t,n,r,!1),m=i===p;return o==="=="?m:!m}}return hn(Pe(a,t,n,r,!1))},"evaluateConditionExpression"),gn=w(e=>{if(e[0]!=="(")return-1;let t=0,r,n=-1;for(const a of e){if(n+=1,r){a===r&&(r=void 0);continue}if(a==='"'||a==="'"){r=a;continue}if(a==="(")t+=1;else if(a===")"&&(t-=1,t===0))return n}return-1},"matchingParen"),F=w((e,t)=>{let r="";for(const n of e){if(n.type==="text"){r+=n.value;continue}if(n.type==="expr"){r+=pn(Pe(n.expression,t.scope,n.line,t.filename));continue}if(n.type==="if"){const a=T(n.condition,t.scope,t.filename,n.line)?n.consequent:n.alternate??[];r+=F(a,t);continue}if(n.type==="for"){const a=Ae(n.collection,t.scope,n.line,t.filename,!1);if(a==null)continue;if(!Array.isArray(a))throw new TypeError(`${t.filename}:${n.line}: {% for %} expected an array, got ${typeof a}`);for(const s of a){const l={...t.scope,[n.binding]:s};r+=F(n.body,{...t,scope:l})}continue}if(n.type==="include"){const a=t.partials?.get(n.name);if(!a)throw new Error(`${t.filename}:${n.line}: Partial "${n.name}" not found. Available: ${[...t.partials?.keys()??[]].join(", ")||"(none)"}`);const s=t.includeStack??new Set;if(s.has(n.name)){const l=[...s,n.name].join(" → ");throw new Error(`${t.filename}:${n.line}: Circular partial include detected: ${l}`)}s.add(n.name);try{r+=F(a,{...t,filename:`<partial:${n.name}>`,includeStack:s})}finally{s.delete(n.name)}}}return r},"renderNodes"),bn=w((e,t)=>Oe(Ce(e),t),"parseTemplate");w((e,t)=>F(e,t),"renderAst");const X=w((e,t)=>F(Oe(Ce(e),t.filename),t),"renderTemplate");var yn=Object.defineProperty,P=C((e,t)=>yn(e,"name",{value:t,configurable:!0}),"s");const ue="template.yml",$n=".raw",vn=new Set([".cjs",".css",".env",".gitattributes",".gitignore",".graphql",".html",".ini",".js",".json",".json5",".jsonc",".jsx",".lock",".md",".mdx",".mjs",".prettierrc",".raw",".rs",".scss",".sh",".sql",".svg",".tera",".toml",".ts",".tsx",".twig",".txt",".vue",".xml",".yaml",".yml"]),wn=new Set(["Brewfile","CHANGELOG","CODEOWNERS","CONTRIBUTING","COPYING","Dockerfile","Gemfile","LICENCE","LICENSE","Makefile","NOTICE","Procfile","Rakefile","README","VERSION"]),jn=P(e=>{const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),r=t===-1?e:e.slice(t+1),n=r.lastIndexOf(".");return n===-1||n===0?"":r.slice(n).toLowerCase()},"lastDot"),Ee=P(e=>{const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)},"basename"),Cn=P(e=>{const t=jn(e);if(t!=="")return vn.has(t);const r=Ee(e);return wn.has(r)},"isLikelyText"),On=P(e=>{const t={default:e.default,internal:e.internal,order:e.order,prompt:e.prompt,required:e.required};switch(e.type){case"array":return{...t,type:"array"};case"boolean":return{...t,default:typeof t.default=="boolean"?t.default:void 0,type:"boolean"};case"enum":return{...t,multiple:e.multiple,type:"enum",values:e.values??[]};case"number":return{...t,type:"number"};case"string":return{...t,type:"string"};default:throw new Error(`Unsupported variable type "${String(e.type)}"`)}},"yamlVariableToVariable"),kn=P(e=>e.replaceAll("\\","/").replace(/^\.\//,"").replaceAll(/\/+/g,"/"),"normalizeDestinationPath"),An=P((e,t,r)=>{const n=t.split("/").filter(Boolean);if(n.length===0)throw new Error("Empty destination path for value");let a=e;for(let s=0;s<n.length-1;s+=1){const l=n[s],o=a[l];if(o===void 0){const h={};a[l]=h,a=h}else if(typeof o=="object"&&!Buffer.isBuffer(o))a=o;else throw new TypeError(`Path conflict: "${n.slice(0,s+1).join("/")}" is both a file and a directory`)}a[n.at(-1)]=r},"flattenFiles"),fe=P((e,t,r)=>{if(typeof e!="string")return Pn(e);const n=e.includes("{{")||e.includes("{%")?X(e,{filename:`${r}#frontmatter`,scope:t}):e;return T(n,t,`${r}#frontmatter`,1)},"evaluateGate"),Pn=P(e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:typeof e=="string"?e!=="false"&&e!=="0":!0,"truthyValue"),_n=P((e,t)=>{const r=he(e,ue),n=tt(r);if(!n||typeof n!="object")throw new Error(`${r}: must contain a YAML mapping`);const a={};if(n.variables)for(const[h,i]of Object.entries(n.variables))a[h]=On(i);const s=new Map,l=[];for(const h of rt(e,{includeDirs:!1,includeSymlinks:!1})){if(h.path===r)continue;const i=pe(e,h.path).replaceAll("\\","/");if(i===ue)continue;if(an(i)){const m=N(h.path),c=bn(m,i);for(const u of xn(i))s.has(u)&&s.get(u)!==c&&nt.warn(`partial name "${u}" is declared by multiple files — last one wins. Use distinct names or fully-qualified includes.`),s.set(u,c);continue}if(i.endsWith($n)){const m=N(h.path);l.push({binary:null,isRaw:!0,rawText:m,relativePath:i});continue}if(Cn(i)){const m=N(h.path);l.push({binary:null,isRaw:!1,rawText:m,relativePath:i});continue}const p=N(h.path,{buffer:!0});l.push({binary:p,isRaw:!1,rawText:null,relativePath:i})}const o=P(h=>{const i={...h.builtins,...h.options},p={},m={};for(const u of l){const f=u.relativePath;let g,b,d=!1;if(u.binary)g=u.binary;else if(u.isRaw)g=u.rawText??"";else{const v=u.rawText??"",j=ln(v,I=>at(I));if(j.frontmatter){if(j.frontmatter.skip!==void 0&&fe(j.frontmatter.skip,i,f)||j.frontmatter.if!==void 0&&!fe(j.frontmatter.if,i,f))continue;typeof j.frontmatter.to=="string"&&(b=X(j.frontmatter.to,{filename:`${f}#frontmatter.to`,partials:s,scope:i})),j.frontmatter.force===!0&&(d=!0)}g=X(j.body,{filename:f,partials:s,scope:i})}const y=kn(b??rn(nn(f),i));An(p,y,g),d&&(m[y]={force:!0})}const c={files:p};return Object.keys(m).length>0&&(c.filesMeta=m),c},"produce");return{about:{description:n.description??`Moon-format template at ${e}`,name:n.title??t},destination:n.destination,options:a,produce:o}},"loadMoonTemplate"),xn=P(e=>{const t=je(e),r=Ee(t),n=new Set([r,t]);if(r.startsWith("_")){n.add(r.replace(/^_+/,""));const a=t.slice(0,t.length-r.length);n.add(`${a}${r.replace(/^_+/,"")}`)}return[...n]},"partialKeys");export{_n as loadMoonTemplate};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var i=Object.defineProperty;var a=(r,e)=>i(r,"name",{value:e,configurable:!0});import{p as s}from"./bin.js";import{c as o,f as c}from"../packem_shared/registry-keys-
|
|
1
|
+
var i=Object.defineProperty;var a=(r,e)=>i(r,"name",{value:e,configurable:!0});import{p as s}from"./bin.js";import{c as o,f as c}from"../packem_shared/registry-keys-SylX07bs.js";var n=Object.defineProperty,f=a((r,e)=>n(r,"name",{value:e,configurable:!0}),"n");const g=f(async({options:r})=>{if(r.clear){const t=o();if(r.json){process.stdout.write(`${JSON.stringify({cleared:t,refetched:!1},void 0,2)}
|
|
2
2
|
`);return}s.success(t?"Cleared cached npm signing keys.":"No cached npm signing keys to clear.");return}const e=await c({forceRefresh:!0});if(e===void 0){if(r.json){process.stdout.write(`${JSON.stringify({cleared:!1,error:"fetch-failed",refetched:!1},void 0,2)}
|
|
3
3
|
`),process.exitCode=1;return}s.error("Failed to fetch npm signing keys (network error and no cached keys available)."),process.exitCode=1;return}if(r.json){process.stdout.write(`${JSON.stringify({cleared:!1,fromCache:e.fromCache,keyCount:e.keys.length,refetched:!e.fromCache,stale:e.stale??!1},void 0,2)}
|
|
4
4
|
`);return}if(e.fromCache&&e.stale===!0){s.warn(`Network fetch failed — falling back to expired cache (${String(e.keys.length)} keys).`);return}s.success(`Refreshed npm signing keys (${String(e.keys.length)} keys).`)},"execute");export{g as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var x=Object.defineProperty;var w=(t,
|
|
1
|
+
var x=Object.defineProperty;var w=(t,i)=>x(t,"name",{value:i,configurable:!0});import{createRequire as B}from"node:module";import{ah as P,p as o,ai as R}from"./bin.js";import{A as V}from"../packem_shared/pm-runner-COoPLGKi.js";import{x as C}from"../packem_shared/build-scripts-3E2pmscY.js";import{M as y,i as k}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{n as q}from"./config.js";const D=B(import.meta.url),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,M=w(t=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[i,f]=v.versions.node.split(".").map(Number);if(i>22||i===22&&f>=3||i===20&&f>=16)return v.getBuiltinModule(t)}return D(t)},"__cjs_getBuiltinModule"),{readdirSync:j,statSync:O}=M("node:fs");var A=Object.defineProperty,_=w((t,i)=>A(t,"name",{value:i,configurable:!0}),"p$1");const N=_((t,i={})=>{const f=y(t,"node_modules");if(!k(f))return[];const l=new Map,p=new Set,b=_((n,s,a)=>{const e=`${s}@${a}`;if(p.has(e))return;p.add(e);const r=a.startsWith(t)?a.slice(t.length+1):a;let u=l.get(n);u||(u=[],l.set(n,u)),u.some($=>$.name===s)||u.push({name:s,relativePath:r})},"recordBin"),m=_((n,s="")=>{let a;try{a=j(n)}catch{return}for(const e of a){const r=y(n,e);if(e.startsWith("@")){m(r,`${e}/`);continue}if(e===".pnpm"&&s===""){let c;try{c=j(r)}catch{continue}for(const d of c){const h=y(r,d,"node_modules");k(h)&&m(h)}continue}if(e.startsWith("."))continue;const u=s+e,$=y(r,"package.json");try{if(!O(r).isDirectory()||!k($))continue;const c=q($),d=typeof c.name=="string"?c.name:u;if(typeof c.bin=="string"){const S=d.includes("/")?d.split("/").pop():d;b(S,d,r)}else if(c.bin&&typeof c.bin=="object")for(const S of Object.keys(c.bin))b(S,d,r);const h=y(r,"node_modules");k(h)&&m(h)}catch{}}},"scanDir");m(f);const g=[];for(const[n,s]of l)s.length<2||i[n]===!0||s.every(a=>i[`${a.name}#${n}`]===!0)||g.push({bin:n,packages:s});return g.sort((n,s)=>n.bin.localeCompare(s.bin))},"collectBinShadows");var T=Object.defineProperty,W=w((t,i)=>T(t,"name",{value:i,configurable:!0}),"p");const U=new Set(["bun","npm","pnpm","yarn"]),K=W(({options:t,visConfig:i,workspaceRoot:f})=>{const l=f??process.cwd(),p=V(l),b=i?.security?.policies?.installScripts?.allow??{},m=i?.security?.allowBins??{},g=i?.security?.pinVersions===!0,n=C(l,b,{pinVersions:g}),s=N(l,m),a=i&&U.has(p.name)?P(i,p.name,l):void 0;if(t.json){process.stdout.write(`${JSON.stringify({binConflicts:s,drift:a,excess:n.excess,installed:n.installed.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),packageManager:p.name,pinVersions:g,unapproved:n.unapproved.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),versionDrift:n.versionDrift},void 0,2)}
|
|
2
2
|
`);return}if(o.info(`Build-script status (${p.name}):
|
|
3
|
-
`),n.installed.length===0&&n.unapproved.length===0&&o.success(" No installed packages declare lifecycle scripts."),n.installed.length>0){o.success(` Approved (${String(n.installed.length)}):`);for(const e of n.installed)o.info(` ✓ ${e.name} — ${e.hooks.join(", ")}`)}if(n.unapproved.length>0){o.info(""),o.warn(` Unapproved (${String(n.unapproved.length)}):`);for(const e of n.unapproved)o.info(` ✗ ${e.name} — ${e.hooks.join(", ")}`);o.notice(" Run 'vis approve-builds' to review.")}if(n.excess.length>0){o.info(""),o.warn(` Stale allowlist entries (${String(n.excess.length)}):`);for(const e of n.excess)o.info(` ! ${e}`);o.notice(" Remove these from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){o.info(""),o.warn(` Version drift (pinVersions: true) — ${String(n.versionDrift.length)} entr${n.versionDrift.length===1?"y":"ies"} point at outdated versions:`);for(const{from:e,to:r}of n.versionDrift)o.info(` ${e} → ${r}`);o.notice(" Update vis.config.ts security.policies.installScripts.allow keys to migrate.")}if(
|
|
3
|
+
`),n.installed.length===0&&n.unapproved.length===0&&o.success(" No installed packages declare lifecycle scripts."),n.installed.length>0){o.success(` Approved (${String(n.installed.length)}):`);for(const e of n.installed)o.info(` ✓ ${e.name} — ${e.hooks.join(", ")}`)}if(n.unapproved.length>0){o.info(""),o.warn(` Unapproved (${String(n.unapproved.length)}):`);for(const e of n.unapproved)o.info(` ✗ ${e.name} — ${e.hooks.join(", ")}`);o.notice(" Run 'vis approve-builds' to review.")}if(n.excess.length>0){o.info(""),o.warn(` Stale allowlist entries (${String(n.excess.length)}):`);for(const e of n.excess)o.info(` ! ${e}`);o.notice(" Remove these from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){o.info(""),o.warn(` Version drift (pinVersions: true) — ${String(n.versionDrift.length)} entr${n.versionDrift.length===1?"y":"ies"} point at outdated versions:`);for(const{from:e,to:r}of n.versionDrift)o.info(` ${e} → ${r}`);o.notice(" Update vis.config.ts security.policies.installScripts.allow keys to migrate.")}if(s.length>0){o.info(""),o.warn(` Bin conflicts (${String(s.length)}) — multiple packages expose the same bin name:`);for(const e of s)o.info(` ${e.bin} ← ${e.packages.map(r=>r.name).join(", ")}`);o.notice(" Add the bin (or 'pkg#bin') to vis.config.ts security.allowBins to silence this.")}if(a?.hasDrift){o.info("");for(const e of R(a))o.warn(e)}},"execute");export{K as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var w=Object.defineProperty;var c=(e,t)=>w(e,"name",{value:t,configurable:!0});import{createRequire as y}from"node:module";import{A as m,P as $}from"../packem_shared/pm-runner-
|
|
1
|
+
var w=Object.defineProperty;var c=(e,t)=>w(e,"name",{value:t,configurable:!0});import{createRequire as y}from"node:module";import{A as m,P as $}from"../packem_shared/pm-runner-COoPLGKi.js";const _=y(import.meta.url),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=c(e=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[t,s]=a.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return a.getBuiltinModule(e)}return _(e)},"__cjs_getBuiltinModule"),{createInterface:I}=v("node:readline");var h=Object.defineProperty,o=c((e,t)=>h(e,"name",{value:t,configurable:!0}),"n");const r="sigstore",b=o(()=>!!process.stdout.isTTY&&process.env.CI!=="true","isInteractive"),O=o(e=>new Promise(t=>{const s=I({input:process.stdin,output:process.stderr});s.question(`${e} (Y/n) `,i=>{s.close();const n=i.trim().toLowerCase();t(n===""||n==="y"||n==="yes")})}),"defaultPrompt"),D=o(e=>{const t=m(e),s=$(t,{exact:!1,filter:[],global:!1,optional:!1,packages:[r],peer:!1,saveDev:!0,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:s})},"defaultRunInstall"),k=o(()=>{try{return import.meta.resolve(r),!0}catch{return!1}},"isSigstoreInstalled"),P=o(e=>{let t="pnpm";try{t=m(e).name}catch{}switch(t){case"bun":return`bun add -d ${r}`;case"npm":return`npm install -D ${r}`;case"yarn":return`yarn add -D ${r}`;default:return`pnpm add -D ${r}`}},"installCommandFor"),R=o(()=>import("sigstore"),"defaultImport"),x=o(async(e={})=>{const t=e.interactive??b(),s=e.prompt??O,i=e.runInstall??D,n=e.importImpl??R,d=e.workspaceRoot??process.cwd(),l=P(d);try{return await n()}catch(p){const{code:f,message:g}=p;if(!(f==="ERR_MODULE_NOT_FOUND"||f==="MODULE_NOT_FOUND")||!g.includes(r))throw p}if(!t)throw new Error(`${r} is not installed. \`vis attest\` needs it for keyless signing/verification. Install it in your repo first:
|
|
2
2
|
${l}`);if(!await s(`${r} isn't installed. Install it now?`))throw new Error(`${r} install declined. Re-run \`vis attest\` after installing manually:
|
|
3
3
|
${l}`);const u=await i(d);if(u.exitCode!==0)throw new Error(`Install of ${r} failed (exit ${String(u.exitCode)}). Install manually and retry:
|
|
4
4
|
${l}`);return await n()},"loadOptionalSigstore");export{P as installCommandFor,k as isSigstoreInstalled,x as loadOptionalSigstore};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var d=Object.defineProperty;var u=(r,o)=>d(r,"name",{value:o,configurable:!0});import{p as s}from"./bin.js";import{r as m}from"../packem_shared/advisories-
|
|
1
|
+
var d=Object.defineProperty;var u=(r,o)=>d(r,"name",{value:o,configurable:!0});import{p as s}from"./bin.js";import{r as m}from"../packem_shared/advisories-BxXiKFbL.js";var p=Object.defineProperty,l=u((r,o)=>p(r,"name",{value:o,configurable:!0}),"a");const v=l(async({fs:r,logger:o,options:t,workspaceRoot:n})=>{if(!n)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const e=t.db??m(n),a=t.format==="json";if(!t.force){s.warn(`Prune is destructive. Will remove: ${e}`),s.info("Re-run with --force to proceed."),a&&process.stdout.write(`${JSON.stringify({dbPath:e,reason:"needs --force",removed:!1})}
|
|
2
2
|
`);return}const f=[e,`${e}-wal`,`${e}-shm`,`${e}-journal`],i=[];for(const c of f)try{await r.rm(c,{force:!0}),i.push(c)}catch{}if(a){process.stdout.write(`${JSON.stringify({dbPath:e,files:i,removed:!0})}
|
|
3
3
|
`);return}s.success(`Removed ${e}.`)},"execute"),b=v;export{b as advisoriesPruneExecute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var l=Object.defineProperty;var a=(t,o)=>l(t,"name",{value:o,configurable:!0});import{p as c,
|
|
1
|
+
var l=Object.defineProperty;var a=(t,o)=>l(t,"name",{value:o,configurable:!0});import{p as c,D as p,E as u}from"./bin.js";var w=Object.defineProperty,f=a((t,o)=>w(t,"name",{value:o,configurable:!0}),"c");const m=f(({options:t,visConfig:o,workspaceRoot:s})=>{const i=s??process.cwd(),n=o?.security?.policies?.installScripts?.allow??{},r=Object.entries(n).filter(([,e])=>e).map(([e])=>e);r.length===0&&!t.rootOnly&&(c.warn("No approved packages in security.policies.installScripts.allow — nothing to run."),!t.withRoot)||(t.rootOnly||p(i,r),(t.withRoot||t.rootOnly)&&u(i))},"execute");export{m as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var l=Object.defineProperty;var c=(s,e)=>l(s,"name",{value:e,configurable:!0});import{e as v,E as f,I as p}from"../packem_shared/
|
|
1
|
+
var l=Object.defineProperty;var c=(s,e)=>l(s,"name",{value:e,configurable:!0});import{e as v,E as f,I as p}from"../packem_shared/Table-CwC2kW07-EjFLNV0q.js";import{p as r}from"./bin.js";import{r as g,g as h}from"../packem_shared/advisories-BxXiKFbL.js";var $=Object.defineProperty,i=c((s,e)=>$(s,"name",{value:e,configurable:!0}),"a");const B=i(s=>{if(s===0)return"0 B";const e=["B","KB","MB","GB"],a=Math.min(Math.floor(Math.log(s)/Math.log(1024)),e.length-1),o=s/1024**a;return`${o.toFixed(o<10&&a>0?1:0)} ${e[a]}`},"formatBytes"),w=i(s=>{if(!s)return"never";const e=Date.parse(s);if(Number.isNaN(e))return s;const a=Date.now()-e;if(a<0)return s;const o=Math.floor(a/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const t=Math.floor(o/60);return t<24?`${t}h ago`:`${Math.floor(t/24)}d ago`},"formatRelative"),S=i(async({logger:s,options:e,workspaceRoot:a})=>{if(!a)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const o=e.db??g(a),t=await h(a,o);if(e.format==="json"){process.stdout.write(`${JSON.stringify({dbPath:o,ecosystems:t.ecosystems.map(n=>({advisoryCount:n.advisoryCount,lastSyncIso:n.lastSyncIso,manifestEtag:n.manifestEtag??null,name:n.name})),exists:t.exists,schemaVersion:t.schemaVersion,sizeBytes:t.sizeBytes},void 0,2)}
|
|
2
2
|
`);return}if(r.info(`DB: ${o}`),!t.exists){r.warn(`No advisory DB yet. Run ${v("vis advisories sync")} to populate.`);return}if(r.info(`Schema: v${t.schemaVersion} Size: ${B(t.sizeBytes)}`),t.ecosystems.length===0){r.warn("DB exists but contains no ecosystems. Run `vis advisories sync`.");return}r.info(""),r.info("Ecosystem Advisories Last sync ETag"),r.info(f("────────── ────────── ───────────────── ──────"));for(const n of t.ecosystems){const m=n.name.padEnd(10),u=n.advisoryCount.toLocaleString().padStart(10),d=`${n.lastSyncIso||"never"} (${w(n.lastSyncIso)})`.padEnd(19),y=n.manifestEtag??f("—");r.info(`${p(m)} ${u} ${d} ${y}`)}},"execute"),D=S;export{D as advisoriesStatusExecute};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var w=Object.defineProperty;var y=(e,o)=>w(e,"name",{value:o,configurable:!0});import{E as $}from"../packem_shared/
|
|
1
|
+
var w=Object.defineProperty;var y=(e,o)=>w(e,"name",{value:o,configurable:!0});import{E as $}from"../packem_shared/Table-CwC2kW07-EjFLNV0q.js";import{p as l}from"./bin.js";import{s as D}from"../packem_shared/scan-progress-CU4ttEHQ.js";import{s as b,D as S}from"../packem_shared/advisories-BxXiKFbL.js";var E=Object.defineProperty,c=y((e,o)=>E(e,"name",{value:o,configurable:!0}),"c");const P=c(e=>e?.security?.audit?.advisories??{},"readAdvisoriesConfig"),k=c(e=>e?e.split(",").map(o=>o.trim()).filter(o=>o.length>0):["npm"],"parseEcosystems"),x=c(async({logger:e,options:o,visConfig:g,workspaceRoot:d})=>{if(!d)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const u=o.format==="json",m=P(g),f=o.source??m.source??S,p=k(o.ecosystem),v=p.map(s=>({id:s,label:`Sync ${s} advisories`})),n=D(v,{live:!u}),i=[];try{for(const s of p){n.start(s);const r=Date.now();try{const t=await b({allowedHosts:m.allowedHosts,dbPath:o.db,ecosystem:s,force:!!o.force,source:f,workspaceRoot:d});i.push({ecosystem:s,result:t}),t.upToDate?n.finish(s,"ok",`up to date · ${h(Date.now()-r)}`):n.finish(s,"ok",`${t.advisoriesIngested.toLocaleString()} advisories · ${h(t.durationMs)}`)}catch(t){const a=t instanceof Error?t.message:String(t);i.push({ecosystem:s,error:a}),n.finish(s,"error",a)}}}finally{n.stop()}if(u){const s={ecosystems:i.map(r=>({advisoriesIngested:r.result?.advisoriesIngested??0,dbPath:r.result?.dbPath??null,durationMs:r.result?.durationMs??0,ecosystem:r.ecosystem,error:r.error??null,upToDate:r.result?.upToDate??!1})),source:f};process.stdout.write(`${JSON.stringify(s,void 0,2)}
|
|
2
2
|
`)}else{const s=i.filter(a=>a.error),r=i.filter(a=>a.result),t=r[0];t?.result?.dbPath&&l.info($(`DB: ${t.result.dbPath}`)),s.length===0?l.success(`Synced ${r.length} ecosystem${r.length===1?"":"s"}.`):l.error(`${s.length} ecosystem${s.length===1?"":"s"} failed to sync.`)}i.some(s=>s.error)&&(process.exitCode=1)},"execute"),h=c(e=>e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`,"formatDuration"),O=x;export{O as advisoriesSyncExecute};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var m=Object.defineProperty;var f=(e,n)=>m(e,"name",{value:n,configurable:!0});import{p as i}from"./bin.js";import{A as g}from"../packem_shared/pm-runner-
|
|
1
|
+
var m=Object.defineProperty;var f=(e,n)=>m(e,"name",{value:n,configurable:!0});import{p as i}from"./bin.js";import{A as g}from"../packem_shared/pm-runner-COoPLGKi.js";import{N as y}from"../packem_shared/native-config-sync-Cnpj2xcn.js";import{E as v}from"../packem_shared/min-release-age-B1Jm1_JY.js";var h=Object.defineProperty,w=f((e,n)=>h(e,"name",{value:n,configurable:!0}),"l");const b=new Set(["bun","npm","pnpm","yarn"]),x=w(({options:e,visConfig:n,workspaceRoot:u})=>{const o=u??process.cwd(),t=g(o);if(!b.has(t.name)){i.warn(`Package manager '${t.name}' has no native security config to sync.`);return}if(!n?.security){i.warn("vis.config has no `security` block — nothing to sync.");return}const r=n.security.policies??{},a=Object.fromEntries(Object.entries(r.installScripts?.allow??{}).filter(([,c])=>c)),p=r.firstSeen?.minutes,l=r.firstSeen?.exclude??[],s=[];if(Object.keys(a).length>0&&!e.skipAllowBuilds&&s.push(...y(t.name,o,a)),e.skipMinReleaseAge||s.push(...v(t.name,o,p,l)),s.length===0){i.success("Nothing to sync — vis.config and native PM config are aligned.");return}i.info(`Syncing vis.config security settings to ${t.name} native config…
|
|
2
2
|
`);for(const c of s)i.success(` ${c}`)},"execute");export{x as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var y=Object.defineProperty;var d=(r,n)=>y(r,"name",{value:n,configurable:!0});import{createRequire as w}from"node:module";import{M as u,i as f}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{n as m,B as k}from"./config.js";import{p as e}from"./bin.js";import{A as j}from"../packem_shared/pm-runner-
|
|
1
|
+
var y=Object.defineProperty;var d=(r,n)=>y(r,"name",{value:n,configurable:!0});import{createRequire as w}from"node:module";import{M as u,i as f}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{n as m,B as k}from"./config.js";import{p as e}from"./bin.js";import{A as j}from"../packem_shared/pm-runner-COoPLGKi.js";const v=w(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=d(r=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[n,s]=c.versions.node.split(".").map(Number);if(n>22||n===22&&s>=3||n===20&&s>=16)return c.getBuiltinModule(r)}return v(r)},"__cjs_getBuiltinModule"),{spawnSync:$}=h("node:child_process");var _=Object.defineProperty,l=d((r,n)=>_(r,"name",{value:n,configurable:!0}),"c");const t="@lavamoat/preinstall-always-fail",p=l(r=>{const n=u(r,"package.json");if(!f(n))return"no-package-json";try{const s=m(n);if(s.devDependencies?.[t]||s.dependencies?.[t])return"installed"}catch{}return"missing"},"tripwireStatus"),b=l(r=>{const n=u(r,"package.json");if(!f(n))return!1;try{const s=m(n);let o=!1;const a=l(i=>!i||!(t in i)?i:(o=!0,Object.fromEntries(Object.entries(i).filter(([g])=>g!==t))),"stripFrom");return s.devDependencies=a(s.devDependencies),s.dependencies=a(s.dependencies),o&&k(n,`${JSON.stringify(s,null,2)}
|
|
2
2
|
`),o}catch{return!1}},"removeFromPackageJson"),O=l(({options:r,workspaceRoot:n})=>{const s=n??process.cwd();if(r.status){switch(p(s)){case"installed":{e.success(`Preinstall tripwire is installed (${t}).`),e.info("Removing 'ignore-scripts=true' will cause future installs to fail loudly.");break}case"missing":{e.warn("Preinstall tripwire is not installed."),e.info(`Run 'vis security tripwire' to add ${t} as a devDependency.`);break}default:e.error("No package.json found at the workspace root."),process.exitCode=1}return}if(r.remove){b(s)?e.success(`Removed ${t} from package.json. Run your PM's install to clean node_modules.`):e.info(`${t} was not present in package.json.`);return}if(p(s)==="installed"){e.info(`${t} is already installed.`);return}const o=j(s),a={bun:["add","-d",t],npm:["install","--save-dev",t],pnpm:["add","-D","-w",t],yarn:["add","-D",t]}[o.name];if(!a){e.error(`Cannot install tripwire — unsupported package manager '${o.name}'.`),process.exitCode=1;return}e.info(`Installing ${t} via ${o.name}…`);const i=$(o.name,a,{cwd:s,stdio:"inherit"});if(i.error){e.error(`Failed to install tripwire: ${i.error.message}`),process.exitCode=1;return}if(i.signal!==null){e.error(`${o.name} was terminated by signal ${i.signal}`),process.exitCode=1;return}if(i.status!==0){e.error(`${o.name} exited with code ${String(i.status)}`),process.exitCode=i.status??1;return}e.success(`Installed ${t} as a devDependency.`),e.notice(""),e.notice("How the tripwire works:"),e.notice(` ${t} declares a preinstall script that always fails.`),e.notice(" When 'ignore-scripts=true' is set (.npmrc / bunfig.toml / .yarnrc.yml),"),e.notice(" the script is skipped and installs succeed normally. If someone deletes"),e.notice(" that setting, the next install fails — loudly — instead of silently"),e.notice(" running every dependency's lifecycle scripts.")},"execute");export{O as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var $=Object.defineProperty;var k=(e,o)=>$(e,"name",{value:o,configurable:!0});import{p}from"./bin.js";import{A as x}from"../packem_shared/pm-runner-
|
|
1
|
+
var $=Object.defineProperty;var k=(e,o)=>$(e,"name",{value:o,configurable:!0});import{p}from"./bin.js";import{A as x}from"../packem_shared/pm-runner-COoPLGKi.js";import{r as v,l as C,L as S}from"../packem_shared/dependency-scan-Bki15Yi-.js";import{$ as M,M as h,i as L}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{F as E}from"../packem_shared/lockfile-DmDfgKaT.js";import{e as P}from"../packem_shared/index-DBq4TVu5.js";var D=Object.defineProperty,m=k((e,o)=>D(e,"name",{value:o,configurable:!0}),"r");const V=m(e=>{const o=e.trim();return o===""?!1:/^(?:git\+|git:\/\/|git@|ssh:\/\/)/i.test(o)||/^(?:github|gitlab|bitbucket|gist):/i.test(o)||/^[\w.-]+\/[\w.-]+(?:#.+)?$/.test(o)&&!o.includes("@")?!0:/^https?:\/\//i.test(o)},"isExoticSpecifier"),N=m((e,o)=>{for(const s of o)if(s===e||s.endsWith("*")&&e.startsWith(s.slice(0,-1)))return!0;return!1},"matchesAllow"),O=m((e,o,s={})=>{const t=v(e,o);if(!t)return[];let i;try{i=M(h(e,t.file))}catch{return[]}const n=E(i,t.type);if(n.length===0)return[];const c=s.allow??[],l=[],f=new Set;for(const r of n){const a=`${r.name}@${r.version}`;for(const g of[r.dependencies,r.optionalDependencies])if(g){for(const[u,w]of Object.entries(g))if(!N(u,c))for(const y of w){if(!V(y))continue;const b=`${a}->${u}@${y}`;f.has(b)||(f.add(b),l.push({declaredBy:a,packageName:u,source:y}))}}}return l.sort((r,a)=>r.packageName.localeCompare(a.packageName)||r.declaredBy.localeCompare(a.declaredBy))},"scanExoticSubdeps");var R=Object.defineProperty,d=k((e,o)=>R(e,"name",{value:o,configurable:!0}),"n");const j=new Set(["firstSeen","publisherChange"]),A=d(e=>e.severity==="block"&&e.acceptedRisk===void 0,"isGatingDecision"),B=d(e=>{const o=e.security?.policies?.firstSeen?.minutes,s=typeof o=="number"&&o>0,t=e.security?.policies?.publisherChange?.mode==="no-downgrade",i=e.security?.blockExoticSubdeps===!0;return s||t||i},"anyPolicyConfigured"),F=d(async e=>{const{offline:o=!1,packageManager:s,visConfig:t,workspaceRoot:i}=e,n=Date.now();if(!B(t))return{decisions:[],durationMs:Date.now()-n,entryCount:0,exoticViolations:[],lockfileMissing:!1,status:"skipped"};const c=v(i,s);if(!c||!L(h(i,c.file)))return{decisions:[],durationMs:Date.now()-n,entryCount:0,exoticViolations:[],lockfileMissing:!0,status:"fail"};const l=C(i,s,{includeDev:!0}),f=l.length,r=await P({offline:o,packageManager:s,packages:l,workspaceRoot:i},"install",{enabledPolicies:new Set(j),visConfig:t}),a=t.security?.blockExoticSubdeps===!0?O(i,s,{allow:t.security.exoticSubdepsAllow}):[],g=r.some(u=>A(u))||a.length>0;return{decisions:r,durationMs:Date.now()-n,entryCount:f,exoticViolations:a,lockfileMissing:!1,status:g?"fail":"pass"}},"verifyLockfile"),W=d(e=>e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`,"formatElapsed"),G=d(e=>{if(e.status==="skipped")return["– Lockfile supply-chain verification skipped (no firstSeen / publisherChange / blockExoticSubdeps policy configured)"];if(e.lockfileMissing)return["✗ Lockfile supply-chain verification failed — no lockfile found, the resolved closure cannot be attested"];const o=`(${String(e.entryCount)} ${e.entryCount===1?"entry":"entries"}, ${W(e.durationMs)})`;if(e.status==="pass")return[`✓ Lockfile passes supply-chain policies ${o}`];const s=[`✗ Lockfile failed supply-chain policy check ${o}`];for(const t of e.decisions)t.severity==="block"&&t.acceptedRisk===void 0&&s.push(` [${t.policy}] ${t.reason}`);for(const t of e.exoticViolations)s.push(` [blockExoticSubdeps] ${t.packageName} pulled from exotic source by ${t.declaredBy}: ${t.source}`);return s},"formatLockfileVerification");var I=Object.defineProperty,J=k((e,o)=>I(e,"name",{value:o,configurable:!0}),"a");const U=J(async({options:e,visConfig:o,workspaceRoot:s})=>{const t=s??process.cwd(),i=x(t);if(!S[i.name]){p.warn(`Package manager '${i.name}' has no lockfile vis can verify.`);return}const n=await F({offline:!!e.offline,packageManager:i.name,visConfig:o??{},workspaceRoot:t});if(e.json){process.stdout.write(`${JSON.stringify(n,void 0,2)}
|
|
2
2
|
`),n.status==="fail"&&(process.exitCode=1);return}const[c,...l]=G(n);if(n.status==="skipped"){p.info(c);return}if(n.status==="pass"){p.success(c);return}p.error(c);for(const f of l)p.error(f);process.exitCode=1},"execute");export{U as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var hi=Object.defineProperty;var E=(t,e)=>hi(t,"name",{value:e,configurable:!0});import{createRequire as ci}from"node:module";const li=ci(import.meta.url),ft=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,di=E(t=>{if(typeof ft<"u"&&ft.versions&&ft.versions.node){const[e,i]=ft.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return ft.getBuiltinModule(t)}return li(t)},"__cjs_getBuiltinModule"),{createRequire:ui}=di("node:module"),vt=0,H=1,mt=2,G=3;var fi=Object.defineProperty,mi=E((t,e)=>fi(t,"name",{value:e,configurable:!0}),"p$2"),gi=Object.defineProperty,pi=mi((t,e)=>gi(t,"name",{value:e,configurable:!0}),"C"),bi=Object.defineProperty,$t=pi((t,e)=>bi(t,"name",{value:e,configurable:!0}),"u");const wi=/^-{1,2}(no-color|no-colors|color=false|color=never)$/,yi=/^-{1,2}(color=256)$/,vi=/^-{1,2}(color=16m|color=full|color=truecolor)$/,xi=/^-{1,2}(color|colors|color=true|color=always)$/,Bi=/-mono|dumb/i,Ri=/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/,Wi=/-256(color)?$/i,Si=/^screen|^tmux|^xterm|^vt[1-5]\d\d|^ansi|color|mintty|rxvt|cygwin|linux/i,Te=$t(t=>{const e=globalThis,i=e.Deno!=null,r=e.process??e.Deno??{},h=r.argv??r.args??[],s=$t(g=>{const p=h.indexOf("--"),u=h.findIndex(x=>g.test(x));return u!==-1&&(p===-1||u<p)},"oneOfFlags");let o={};try{o=i?r.env.toObject():r.env??{}}catch{}const a="FORCE_COLOR",n=a in o,l=o[a]??void 0,d=Object.prototype.toString.call(l).slice(8,-1)==="String",c=typeof l=="number";let m;if(l==="true"?m=H:l==="false"?m=vt:d&&l.length===0?m=H:d&&l.length>0?m=Math.min(Number.parseInt(l,10),3):c&&(m=Math.min(l,3)),l!=="true"&&l!=="false"&&m!==void 0&&m<4)return m;if("NO_COLOR"in o||n&&m===0||s(wi))return vt;if(s(yi))return mt;if(s(vi))return G;if(s(xi))return H;const b=m??vt;if("TF_BUILD"in o&&"AGENT_NAME"in o)return H;if(o.TERM&&Bi.test(o.TERM))return b;if((i?e.Deno.build.os:r.platform)==="win32")try{const g=(i?e.Deno.osRelease():r.os.release()).split(".");return Number(g[0])>=10&&Number(g[2])>=10586?Number(g[2])>=14931?G:mt:H}catch{}if("CI"in o)return["GITEA_ACTIONS","CIRCLECI","GITHUB_WORKFLOW","GITHUB_ACTIONS"].some(g=>g in o)?G:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(g=>g in o)||o.CI_NAME==="codeship"?H:b;if(o.TERMINAL_EMULATOR?.includes("JediTerm"))return G;if("TEAMCITY_VERSION"in o)return Ri.test(o.TEAMCITY_VERSION)?H:vt;if(o.COLORTERM==="truecolor"||o.TERM==="xterm-kitty"||o.TERM==="xterm-ghostty"||o.TERM==="wezterm")return G;if("TERM_PROGRAM"in o){const g=Number.parseInt((o.TERM_PROGRAM_VERSION??"").split(".")[0],10);if(o.TERM_PROGRAM==="iTerm.app")return g>=3?G:mt;if(o.TERM_PROGRAM==="Apple_Terminal")return mt}if(Wi.test(o.TERM))return mt;let f;return i?f=t==="out"?e.Deno.stdout.isTerminal():e.Deno.stderr.isTerminal():"PM2_HOME"in o&&"pm_id"in o?f=!0:f=r[`std${t}`]&&"isTTY"in r[`std${t}`],f&&Si.test(o.TERM)||"COLORTERM"in o?H:b},"isColorSupportedFactory"),ji=$t(()=>Te("out"),"isStdoutColorSupported");$t(()=>Te("err"),"isStderrColorSupported");var Oi=Object.defineProperty,ke=E((t,e)=>Oi(t,"name",{value:e,configurable:!0}),"B$2"),Ai=Object.defineProperty,q=ke((t,e)=>Ai(t,"name",{value:e,configurable:!0}),"u"),Ci=Object.defineProperty,Ii=q((t,e)=>Ci(t,"name",{value:e,configurable:!0}),"e$1");function Pt({onlyFirst:t=!1}={}){const e="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,t?void 0:"g")}E(Pt,"x");ke(Pt,"N");q(Pt,"t$1");Ii(Pt,"ansiRegex");var Mi=Object.defineProperty,$i=q((t,e)=>Mi(t,"name",{value:e,configurable:!0}),"n$1");const V=$i((t,e,i)=>e>t?e:Math.min(t,i),"clamp");var Ei=Object.defineProperty,Ti=q((t,e)=>Ei(t,"name",{value:e,configurable:!0}),"a$1");const ki=/([a-f\d]{3,6})/i,Ni=Ti(t=>{let[,e]=ki.exec(t)??[];const i=e?e.length:0;if(i===3){const h=e.charAt(0),s=e.charAt(1),o=e.charAt(2);e=h+h+s+s+o+o}else if(i!==6)return[0,0,0];const r=Number.parseInt(e,16);return[r>>16&255,r>>8&255,r&255]},"convertHexToRgb");var Pi=Object.defineProperty,ne=q((t,e)=>Pi(t,"name",{value:e,configurable:!0}),"e");const Ne=ne((t,e,i)=>t===e&&e===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/51)+6*Math.round(e/51)+Math.round(i/51),"rgbToAnsi256"),Kt=ne(t=>{let e,i,r;if(t<8)return 30+t;if(t<16)return 90+(t-8);if(t>=232)e=i=r=((t-232)*10+8)/255;else{t-=16;const o=t%36;e=Math.floor(t/36)/5,i=Math.floor(o/6)/5,r=o%6/5}const h=Math.max(e,i,r)*2;if(h===0)return 30;const s=30+(Math.round(r)<<2|Math.round(i)<<1|Math.round(e));return h===2?s+60:s},"ansi256To16"),ue=ne((t,e,i)=>Kt(Ne(t,e,i)),"rgbToAnsi16");var Li=Object.defineProperty,T=q((t,e)=>Li(t,"name",{value:e,configurable:!0}),"b");const C=39,I=49,fe=10,Zt=ji(),Pe={close:"",open:""},y=Zt>0?(t,e)=>({close:`\x1B[${String(e)}m`,open:`\x1B[${String(t)}m`}):()=>Pe,me=T(t=>(e,i,r)=>t(Ne(Number(e),Number(i),Number(r))),"createRgbFunction"),ge=T(t=>e=>{const[i,r,h]=Ni(e);return t(i,r,h)},"createHexFunction");let Xt=T(t=>y(`38;5;${String(t)}`,C),"createAnsi256"),Qt=T(t=>y(`48;5;${String(t)}`,I),"createBgAnsi256"),Et=T((t,e,i)=>y(`38;2;${String(t)};${String(e)};${String(i)}`,C),"createRgb"),Tt=T((t,e,i)=>y(`48;2;${String(t)};${String(e)};${String(i)}`,I),"createBgRgb");Zt===1?(Xt=T(t=>y(Kt(Number(t)),C),"createAnsi256"),Qt=T(t=>y(Kt(Number(t))+fe,I),"createBgAnsi256"),Et=T((t,e,i)=>y(ue(Number(t),Number(e),Number(i)),C),"createRgb"),Tt=T((t,e,i)=>y(ue(Number(t),Number(e),Number(i))+fe,I),"createBgRgb")):Zt===2&&(Et=me(Xt),Tt=me(Qt));const pe={bold:y(1,22),dim:y(2,22),hidden:y(8,28),inverse:y(7,27),italic:y(3,23),overline:y(53,55),reset:y(0,0),strike:y(9,29),strikethrough:y(9,29),underline:y(4,24),visible:Pe},be={bgBlack:y(40,I),bgBlackBright:y(100,I),bgBlue:y(44,I),bgBlueBright:y(104,I),bgCyan:y(46,I),bgCyanBright:y(106,I),bgGray:y(100,I),bgGreen:y(42,I),bgGreenBright:y(102,I),bgGrey:y(100,I),bgMagenta:y(45,I),bgMagentaBright:y(105,I),bgRed:y(41,I),bgRedBright:y(101,I),bgWhite:y(47,I),bgWhiteBright:y(107,I),bgYellow:y(43,I),bgYellowBright:y(103,I),black:y(30,C),blackBright:y(90,C),blue:y(34,C),blueBright:y(94,C),cyan:y(36,C),cyanBright:y(96,C),gray:y(90,C),green:y(32,C),greenBright:y(92,C),grey:y(90,C),magenta:y(35,C),magentaBright:y(95,C),red:y(31,C),redBright:y(91,C),white:y(37,C),whiteBright:y(97,C),yellow:y(33,C),yellowBright:y(93,C)},we={bg:T(t=>Qt(V(t,0,255)),"bg"),bgHex:ge(Tt),bgRgb:T((t,e,i)=>Tt(V(t,0,255),V(e,0,255),V(i,0,255)),"bgRgb"),fg:T(t=>Xt(V(t,0,255)),"fg"),hex:ge(Et),rgb:T((t,e,i)=>Et(V(t,0,255),V(e,0,255),V(i,0,255)),"rgb")};var Fi=Object.defineProperty,_i=q((t,e)=>Fi(t,"name",{value:e,configurable:!0}),"s");const Ji=_i((t,e,i)=>{if(e==="")return t;let r=t.indexOf(e);if(r<0)return t;const h=e.length;let s=0,o="";for(;~r;)o+=t.slice(s,r)+i,s=r+h,r=t.indexOf(e,s);return o+t.slice(s)},"stringReplaceAll");var Hi=Object.defineProperty,bt=q((t,e)=>Hi(t,"name",{value:e,configurable:!0}),"a");const z={};let te=null;const Gi=bt((t,e,i)=>{if(!t)return"";let r;if(t.raw===void 0?r=String(t):r=String.raw(t,...e),r.includes("\x1B"))for(let h=i;h;h=h.props)r=Ji(r,h.close,h.open);return r.includes(`
|
|
2
|
+
`)&&(r=r.replace(/(\r*\n)/g,`${i.closeStack}$1${i.openStack}`)),i.openStack+r+i.closeStack},"wrapText"),ee=bt(({props:t},{close:e,open:i})=>{const r=(t?.openStack??"")+i,h=e+(t?.closeStack??""),s=bt((o,...a)=>Gi(o,a,s.props),"style");return Object.setPrototypeOf(s,te),s.props={close:e,closeStack:h,open:i,openStack:r,props:t},s.open=r,s.close=h,s},"createStyle"),Vi=bt(function(){const t=bt(e=>String(e),"self");t.strip=e=>e.replaceAll(Pt(),"");for(const e in be)z[e]={get(){const i=ee(this,be[e]);return Object.defineProperty(this,e,{value:i}),i}};for(const e in pe)z[e]={get(){const i=ee(this,pe[e]);return Object.defineProperty(this,e,{value:i}),i}};return te=Object.defineProperties({},z),Object.setPrototypeOf(t,te),t},"Colorize");for(const t in we)z[t]={get(){return(...e)=>ee(this,we[t](...e))}};z.ansi256=z.fg;z.bgAnsi256=z.bg;const U=new Vi,dn=U.bold,un=U.cyan,fn=U.dim,mn=U.green,gn=U.inverse,pn=U.magenta,bn=U.red,wn=U.yellow;var Di=Object.defineProperty,_=E((t,e)=>Di(t,"name",{value:e,configurable:!0}),"j"),zi=Object.defineProperty,S=_((t,e)=>zi(t,"name",{value:e,configurable:!0}),"$");const Yi=ui(import.meta.url),at=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,se=S(t=>{if(typeof at<"u"&&at.versions&&at.versions.node){const[e,i]=at.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return at.getBuiltinModule(t)}return Yi(t)},"__cjs_getBuiltinModule"),X=at,{execFileSync:qi}=se("node:child_process"),pt=se("node:fs"),Ui=se("node:tty");var Ki=Object.defineProperty,ae=S((t,e)=>Ki(t,"name",{value:e,configurable:!0}),"u$5"),Zi=Object.defineProperty,Lt=ae((t,e)=>Zi(t,"name",{value:e,configurable:!0}),"l");const Xi=[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],Qi=12288,tr=65510,er=[12288,12288,65281,65376,65504,65510],ir=8361,rr=65518,or=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],nr=32,sr=10630,ar=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],hr=4352,cr=262141,Le=[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];var lr=Object.defineProperty,dr=Lt((t,e)=>lr(t,"name",{value:e,configurable:!0}),"r$1");const wt=dr((t,e)=>{let i=0,r=Math.floor(t.length/2)-1;for(;i<=r;){const h=Math.floor((i+r)/2),s=h*2;if(e<t[s])r=h-1;else if(e>t[s+1])i=h+1;else return!0}return!1},"isInRange");var ur=Object.defineProperty,tt=Lt((t,e)=>ur(t,"name",{value:e,configurable:!0}),"r");const ye=19968,[fr,mr]=ct(Le);function ct(t){let e=t[0],i=t[1];for(let r=0;r<t.length;r+=2){const h=t[r],s=t[r+1];if(ye>=h&&ye<=s)return[h,s];s-h>i-e&&(e=h,i=s)}return[e,i]}E(ct,"nt");_(ct,"ge");S(ct,"c$2");ae(ct,"f");Lt(ct,"k");tt(ct,"findWideFastPathRange");const Fe=tt(t=>t<161||t>1114109?!1:wt(Xi,t),"isAmbiguous"),_e=tt(t=>t<Qi||t>tr?!1:wt(er,t),"isFullWidth"),gr=tt(t=>t<ir||t>rr?!1:wt(or,t),"isHalfWidth"),pr=tt(t=>t<nr||t>sr?!1:wt(ar,t),"isNarrow"),Je=tt(t=>t>=fr&&t<=mr?!0:t<hr||t>cr?!1:wt(Le,t),"isWide");function lt(t){return Fe(t)?"ambiguous":_e(t)?"fullwidth":gr(t)?"halfwidth":pr(t)?"narrow":Je(t)?"wide":"neutral"}E(lt,"rt");_(lt,"be");S(lt,"g$4");ae(lt,"S");Lt(lt,"getCategory");tt(lt,"getCategory");var br=Object.defineProperty,Ft=S((t,e)=>br(t,"name",{value:e,configurable:!0}),"i$4"),wr=Object.defineProperty,_t=Ft((t,e)=>wr(t,"name",{value:e,configurable:!0}),"a"),yr=Object.defineProperty,he=_t((t,e)=>yr(t,"name",{value:e,configurable:!0}),"e");function et(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}E(et,"U$1");_(et,"ee");S(et,"s$1");Ft(et,"s");_t(et,"r");he(et,"validate");function it(t){return et(t),lt(t)}E(it,"Z");_(it,"te");S(it,"r$3");Ft(it,"p");_t(it,"eastAsianWidthType");he(it,"eastAsianWidthType");function yt(t,{ambiguousAsWide:e=!1}={}){return et(t),_e(t)||Je(t)||e&&Fe(t)?2:1}E(yt,"yt");_(yt,"je");S(yt,"o$2");Ft(yt,"W");_t(yt,"eastAsianWidth");he(yt,"eastAsianWidth");var vr=Object.defineProperty,xr=S((t,e)=>vr(t,"name",{value:e,configurable:!0}),"p$3"),Br=Object.defineProperty,He=xr((t,e)=>Br(t,"name",{value:e,configurable:!0}),"e"),Rr=Object.defineProperty,Wr=He((t,e)=>Rr(t,"name",{value:e,configurable:!0}),"E");const Ge=String.raw,ve=Ge`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Sr=Wr(()=>new RegExp(Ge`\p{RI}{2}|(?)${ve}(?:\u200D${ve})*`,"gu"),"default");var jr=Object.defineProperty,Or=He((t,e)=>jr(t,"name",{value:e,configurable:!0}),"p");const dt=new Set(["\x1B",""]),Jt="\x07",Ve="[",ce="m",kt="]8;;",Ar=39,Cr=/[\u200B\uFEFF\u2060-\u2064]/g,Ir=new RegExp(`(?:\\${Ve}(?<code>\\d+)m|\\${kt}(?<uri>.*)${Jt})`),Mr=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]])),Z=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,xe=/\u001B\[(\d+(?:;\d+)*)?m[^\u001B]*(?:\u001B\[(?:\d+(?:;\d+)*)?m|$)/g,Be=/\u001B\]8;[^\u0007\u001B]*(?:\u0007|\u001B\\)(.*?)\u001B\]8;;(?:\u0007|\u001B\\)/g,xt=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,Ct=Sr();Or(t=>t.replace(Ct,""),"stripEmoji");var $r=Object.defineProperty,Er=S((t,e)=>$r(t,"name",{value:e,configurable:!0}),"E$1"),Tr=Object.defineProperty,kr=Er((t,e)=>Tr(t,"name",{value:e,configurable:!0}),"A"),Nr=Object.defineProperty,Ht=kr((t,e)=>Nr(t,"name",{value:e,configurable:!0}),"d");const Re=new Map,Bt=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,It=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","getCharType"),Pr=Ht((t,e)=>{const i=Math.floor(t/65536),r=t%65536;let h=Re.get(i);if(h||(h=new Map,Re.set(i,h)),h.has(r))return h.get(r);let s;if(It(t)==="latin")s=e.width.regular;else if(It(t)==="control")s=e.width.control;else if(It(t)==="wide")s=e.width.wide;else switch(it(t)){case"ambiguous":{s=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{s=e.width.fullWidth;break}case"wide":{s=e.width.wide;break}default:s=e.width.regular}return h.set(r,s),s},"getCachedCharWidth"),Lr=Ht(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,"isCombiningCharacter"),ht=Ht((t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const i={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?ht(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},r=Math.max(0,i.truncation.limit-i.truncation.ellipsisWidth),{length:h}=t,s=h>1e4;let o=0,a=0,n=h,l=!1;const d=t.includes("\x1B")||t.includes("");for(;o<h;){if(d&&(t[o]==="\x1B"||t[o]==="")){if(t.startsWith("\x1B]8;;",o)){const p="\x1B]8;;\x07",u=p.length,x=t.indexOf("\x07",o+5);if(x!==-1){const w=t.indexOf(p,x+1);if(w!==-1){const v=w+u,B=t.slice(x+1,w).replace(Z,""),R=ht(B,{ambiguousIsNarrow:i.width.ambiguousIsNarrow,ansiWidth:i.width.ansi,controlWidth:i.width.control,countAnsiEscapeCodes:!1,ellipsis:i.truncation.ellipsis,ellipsisWidth:i.truncation.ellipsisWidth,emojiWidth:i.width.emoji,fullWidth:i.width.fullWidth,halfWidth:i.width.halfWidth,limit:Math.max(0,r-a),regularWidth:i.width.regular,tabWidth:i.width.tab,wideWidth:i.width.wide}),j=R.width;if(R.truncated)l=!0,n=Math.min(n,o);else if(a+j>r&&(n=Math.min(n,o),l=!0,a+j>i.truncation.limit))break;if(a+=j,o=v,l&&a>=i.truncation.limit)break;continue}}}if(Z.lastIndex=o,Z.test(t)){const p=Z.lastIndex-o,u=i.truncation.countAnsiEscapeCodes?p:i.width.ansi;if(a+u>r&&(n=Math.min(n,o),a+u>i.truncation.limit)){l=!0;break}a+=u,o=Z.lastIndex;continue}}const b=t.codePointAt(o);if(b===8203||b===65279||b>=8288&&b<=8292){o+=1;continue}if(b===9){if(a+i.width.tab>r&&(n=Math.min(n,o),a+i.width.tab>i.truncation.limit)){l=!0;break}a+=i.width.tab,o+=1;continue}if(Bt.lastIndex=o,Bt.test(t)){const p=(Bt.lastIndex-o)*i.width.regular;if(a+p>r){const u=Math.floor((r-a)/i.width.regular);if(n=Math.min(n,o+u),a+p>i.truncation.limit){l=!0;break}}a+=p,o=Bt.lastIndex;continue}if((b<=31||b>=127&&b<=159)&&(xt.lastIndex=o,xt.test(t))){const p=(xt.lastIndex-o)*i.width.control;if(a+p>r&&(n=Math.min(n,o+Math.floor((r-a)/i.width.control)),a+p>i.truncation.limit)){l=!0;break}a+=p,o=xt.lastIndex;continue}if(Ct.lastIndex=o,Ct.test(t)){if(a+i.width.emoji>r&&(n=Math.min(n,o),a+i.width.emoji>i.truncation.limit)){l=!0;break}a+=i.width.emoji,o=Ct.lastIndex;continue}const f=t.codePointAt(o)??0;if(Lr(f)){o+=f>65535?2:1;continue}let g;if(s)g=Pr(f,i);else switch(It(f)){case"control":{g=i.width.control;break}case"latin":{g=i.width.regular;break}case"wide":{g=i.width.wide;break}case"zero":{g=0;break}default:switch(it(f)){case"ambiguous":{g=i.width.ambiguousIsNarrow?i.width.regular:i.width.wide;break}case"fullwidth":{g=i.width.fullWidth;break}case"wide":{g=i.width.wide;break}default:g=i.width.regular}}if(a+g>r&&(n=Math.min(n,o),a+g>i.truncation.limit)){l=!0;break}a+=g,o+=f>65535?2:1}let c=a,m=!1;return l&&i.truncation.limit>=i.truncation.ellipsisWidth&&(c=i.truncation.limit,m=!0),{ellipsed:m,index:l?n:h,truncated:l,width:c}},"getStringTruncatedWidth");var Fr=Object.defineProperty,_r=S((t,e)=>Fr(t,"name",{value:e,configurable:!0}),"i$2"),Jr=Object.defineProperty,Hr=_r((t,e)=>Jr(t,"name",{value:e,configurable:!0}),"e"),Gr=Object.defineProperty,Vr=Hr((t,e)=>Gr(t,"name",{value:e,configurable:!0}),"r");const M=Vr((t,e={})=>ht(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,"getStringWidth");var Dr=Object.defineProperty,De=S((t,e)=>Dr(t,"name",{value:e,configurable:!0}),"i$1"),zr=Object.defineProperty,ze=De((t,e)=>zr(t,"name",{value:e,configurable:!0}),"r"),Yr=Object.defineProperty,qr=ze((t,e)=>Yr(t,"name",{value:e,configurable:!0}),"c");let Ur=class{static{E(this,"ki")}static{_(this,"Si")}static{S(this,"l")}static{De(this,"y")}static{ze(this,"s")}static{qr(this,"LRUCache")}capacity;cache;keyOrder;constructor(t){this.capacity=t,this.cache=new Map,this.keyOrder=[]}get(t){if(this.cache.has(t))return this.keyOrder=this.keyOrder.filter(e=>e!==t),this.keyOrder.push(t),this.cache.get(t)}has(t){return this.cache.has(t)}set(t,e){if(this.cache.has(t))this.keyOrder=this.keyOrder.filter(i=>i!==t);else if(this.cache.size>=this.capacity){const i=this.keyOrder.shift();i!==void 0&&this.cache.delete(i)}this.cache.set(t,e),this.keyOrder.push(t)}delete(t){this.cache.delete(t),this.keyOrder=this.keyOrder.filter(e=>e!==t)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}};var Kr=Object.defineProperty,Zr=S((t,e)=>Kr(t,"name",{value:e,configurable:!0}),"S$1"),Xr=Object.defineProperty,Qr=Zr((t,e)=>Xr(t,"name",{value:e,configurable:!0}),"w"),to=Object.defineProperty,ut=Qr((t,e)=>to(t,"name",{value:e,configurable:!0}),"y");const We=new Ur(100),eo=new Intl.Segmenter("en",{granularity:"grapheme"}),io=/^[\u0000-\u007F]*$/,ro=new Set(["0","22","23","24","27","28","29","39","49"]),oo=new Set(["1","3","4","7","8","9"]),Se=new Map([["22","1"],["23","3"],["24","4"],["27","7"],["28","8"],["29","9"]]),Rt=ut(t=>t>="30"&&t<="37"||t>="90"&&t<="97"||t.startsWith("38;"),"isForegroundColor"),Wt=ut(t=>t>="40"&&t<="47"||t>="100"&&t<="107"||t.startsWith("48;"),"isBackgroundColor"),no=[{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"}],je=ut((t,e)=>{let i=-1;for(const r of e){const h=t.indexOf(r);h!==-1&&(i===-1||h<i)&&(i=h)}return i},"findFirstPositionOfAny"),so=ut((t,e)=>{if(!t.includes("\x1B"))return[{after:"",before:"",content:t,visibleLength:M(t,e.width)}];const i=We.get(t);if(i)return i;const r=[],h=[];let s=0,o;for(Z.lastIndex=0;(o=Z.exec(t))!==null;){const d=o[0];r.push(t.slice(s,o.index)),h.push(d),s=o.index+d.length}s<t.length&&r.push(t.slice(s));const a=[];for(const d of h){if(d==="\x1B[0m"||d==="\x1B]8;;\x07"){a.push(d);continue}if(d.startsWith("\x1B[")&&d.endsWith("m")){const c=d.slice(2,-1);if(ro.has(c)){a.push(d);continue}}}const n=new Set,l=[];for(const[d,c]of r.entries()){if(d>0&&h[d-1]){const f=h[d-1];if(f==="\x1B[0m")n.clear();else if(f==="\x1B]8;;\x07"){for(const g of n)if(g.startsWith("\x1B]8;;")&&!g.endsWith("\x1B]8;;\x07")){n.delete(g);break}}else if(f.startsWith("\x1B[")&&f.endsWith("m")){const g=f.slice(2,-1);if(g==="39"){for(const p of n)if(p.startsWith("\x1B[")&&p.endsWith("m")){const u=p.slice(2,-1);if(Rt(u)){n.delete(p);break}}}else if(g==="49"){for(const p of n)if(p.startsWith("\x1B[")&&p.endsWith("m")){const u=p.slice(2,-1);if(Wt(u)){n.delete(p);break}}}else if(Se.has(g)){const p=Se.get(g);for(const u of n)if(u===`\x1B[${p}m`){n.delete(u);break}}else{if(Rt(g)){for(const p of n)if(p.startsWith("\x1B[")&&p.endsWith("m")){const u=p.slice(2,-1);if(Rt(u)){n.delete(p);break}}}else if(Wt(g)){for(const p of n)if(p.startsWith("\x1B[")&&p.endsWith("m")){const u=p.slice(2,-1);if(Wt(u)){n.delete(p);break}}}else if(oo.has(g)){const p=`\x1B[${g}m`;n.has(p)&&n.delete(p)}n.add(f)}}else if(f.startsWith("\x1B]8;;")&&!f.endsWith("\x1B]8;;\x07")){for(const g of n)if(g.startsWith("\x1B]8;;")&&!g.endsWith("\x1B]8;;\x07")){n.delete(g);break}n.add(f)}}if(c==="")continue;let m="";if(n.size>0)if(a.includes("\x1B[0m"))m="\x1B[0m";else{const f=[];let g=!1;for(const w of n)if(w.startsWith("\x1B]8;;")&&!w.endsWith("\x1B]8;;\x07")){g=!0;break}g&&a.includes("\x1B]8;;\x07")&&f.push("\x1B]8;;\x07");let p=!1,u=!1;for(const w of n)if(w.startsWith("\x1B[")&&w.endsWith("m")){const v=w.slice(2,-1);Rt(v)?p=!0:Wt(v)&&(u=!0)}if(p&&u){const w=je(t,["\x1B[3","\x1B[9","\x1B[38;"]),v=je(t,["\x1B[4","\x1B[10","\x1B[48;"]);w>=0&&v>=0?w>v?f.push("\x1B[39m","\x1B[49m"):f.push("\x1B[49m","\x1B[39m"):f.push("\x1B[39m","\x1B[49m")}else p&&f.push("\x1B[39m"),u&&f.push("\x1B[49m");p&&u&&t.includes("\x1B[39m")&&t.includes("\x1B[49m")&&(t.indexOf("\x1B[39m")<t.indexOf("\x1B[49m")?(f.length-=2,f.push("\x1B[39m","\x1B[49m")):t.indexOf("\x1B[49m")<t.indexOf("\x1B[39m")&&(f.length-=2,f.push("\x1B[49m","\x1B[39m")));const x=no.filter(w=>n.has(w.open)).map(w=>({position:t.indexOf(w.open),style:w})).filter(w=>w.position>=0).toSorted((w,v)=>v.position-w.position);for(const w of x){const v=w;a.includes(v.style.close)&&f.push(v.style.close)}m=f.join("")}const b=[...n].join("");l.push({after:m,before:b,content:c,visibleLength:M(c,{fullWidth:1,wideWidth:1})})}return We.set(t,l),l},"processIntoStyledSegments"),ao=ut((t,e,i,r)=>{const h=[...r.segmenter.segment(t)],s=[];let o=0,a=!1;for(const n of h){const l=M(n.segment,r.width),d=o,c=o+l;if(!a)if(d<e){o=c;continue}else a=!0;if(d>=i||c>i)break;s.push(n.segment),o=c}return s.join("")},"fastSlice"),D=ut((t,e=0,i=Number.MAX_SAFE_INTEGER,r={})=>{const h={segmenter:eo,...r};if(e>=i||t==="")return"";const s=M(t,h.width);if(e===0&&i>=s)return t;if(e<0||i<0)throw new RangeError("Negative indices aren't supported");if(!t.includes("\x1B"))return io.test(t)?t.slice(e,i):ao(t,e,i,h);if(xe.lastIndex=0,Be.lastIndex=0,!xe.test(t)&&!Be.test(t))return t;const o=so(t,h);if(o.length===0)return"";let a=0;const n=[];for(const[c,m]of o.entries()){const b=a,f=a+m.visibleLength;if(f>e&&b<i){const g=Math.max(0,e-b),p=Math.min(m.visibleLength,i-b);n.push({end:p,index:c,segment:m,start:g})}a=f}if(n.length===0)return"";const l=[],d=n[0].segment;l.push(d.before);for(let c=0;c<n.length;c++){const{end:m,segment:b,start:f}=n[c];if(f===0&&m===b.visibleLength)l.push(b.content);else{const g=[...h.segmenter.segment(b.content)];l.push(g.slice(f,m).map(p=>p.segment).join(""))}if(c<n.length-1){const g=n[c+1].segment,p=b.after,u=g.before;p!==u&&(p||u)&&l.push(p,u)}}return l.push(n.at(-1).segment.after),l.join("")},"slice");var ho=Object.defineProperty,co=S((t,e)=>ho(t,"name",{value:e,configurable:!0}),"x"),lo=Object.defineProperty,uo=co((t,e)=>lo(t,"name",{value:e,configurable:!0}),"T"),fo=Object.defineProperty,Gt=uo((t,e)=>fo(t,"name",{value:e,configurable:!0}),"f");const Oe="…",mo=3,St=Gt((t,e,i=!1)=>{if(t.charAt(e)===" ")return e;const r=i?1:-1,h=Math.min(mo,i?t.length-e:e);for(let s=1;s<=h;s++){const o=e+s*r;if(t.charAt(o)===" ")return o}return e},"findNearestSpace"),jt=Gt((t,e,i)=>ht(t,{...i,ellipsis:"",ellipsisWidth:0,limit:e}).index,"widthToIndex"),Ot=Gt((t,e,i)=>M(t.slice(0,e),i),"indexToWidth"),Ae=Gt((t,e,i={})=>{if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof t}`);if(typeof e!="number")throw new TypeError(`Expected \`limit\` to be a number, got ${typeof e}`);if(t===""||e<=0)return"";const r=t.normalize("NFC"),{ellipsis:h=Oe,position:s="end",preferTruncationOnSpace:o=!1}=i;let a=i.ellipsisWidth??h===Oe?1:void 0;a??=ht(h,{...i.width,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width;const{width:n}=ht(r,{...i.width,ellipsis:h,ellipsisWidth:a});if(n<=e)return r;switch(s){case"end":{if(o){const l=e-a,d=jt(r,l,i.width),c=St(r,d),m=Ot(r,c,i.width);return D(r,0,m,{width:i.width})+h}return D(r,0,e-a,{width:i.width})+h}case"middle":{const l=Math.floor(e/2),d=Math.max(0,e-a),c=Math.min(l,d),m=Math.max(0,d-c);if(o){const b=jt(r,c,i.width),f=St(r,b),g=Ot(r,f,i.width),p=n-m,u=jt(r,p,i.width),x=St(r,u,!0),w=Ot(r,x,i.width);return D(r,0,g,{width:i.width})+h+D(r,w,n,{width:i.width}).trim()}return D(r,0,c,{width:i.width})+h+D(r,n-m,n,{width:i.width})}case"start":{if(o){const l=n-e+a,d=jt(r,l,i.width),c=St(r,d,!0),m=Ot(r,c,i.width);return h+D(r,m,n,{width:i.width}).trim()}return h+D(r,n-e+a,n,{width:i.width})}default:throw new Error(`Invalid position: expected 'start', 'middle' or 'end', got '${s}'`)}},"truncate");var go=Object.defineProperty,Ye=S((t,e)=>go(t,"name",{value:e,configurable:!0}),"b$2"),po=Object.defineProperty,rt=Ye((t,e)=>po(t,"name",{value:e,configurable:!0}),"d"),bo=Object.defineProperty,wo=rt((t,e)=>bo(t,"name",{value:e,configurable:!0}),"a");const yo=/\x1B\[(\d+)m/;class qe{static{E(this,"he")}static{_(this,"at")}static{S(this,"T")}static{Ye(this,"T")}static{rt(this,"d")}static{wo(this,"AnsiStateTracker")}activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(e){const i=yo.exec(e);if(!i)return;const r=Number.parseInt(i[1],10);switch(r){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(r>=30&&r<=37||r>=90&&r<=97)this.activeForeground=e;else if(r>=40&&r<=47||r>=100&&r<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(r))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(r)){const h={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[r];h&&(this.activeFormatting=this.activeFormatting.filter(s=>!s.includes(h)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const i={"\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(r=>{const h=i[r];h&&e.push(h)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}}var vo=Object.defineProperty,Ue=rt((t,e)=>vo(t,"name",{value:e,configurable:!0}),"o");const Ke=Ue((t,e)=>{if(!dt.has(t[e]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const i=!0,r=t.slice(e+1,e+1+kt.length).join("")===kt;return{isInsideEscape:i,isInsideLinkEscape:r}},"checkEscapeSequence"),xo=Ue((t,e={})=>{const i=new qe;let r="",h=!1,s="",o="",a=!1;const n=[...t];for(let l=0;l<n.length;l++){const d=n[l];if(d&&dt.has(d)){if(r){const g=e.getWidth?.(r)??0,p={isEscapeSequence:!1,isGrapheme:!0,text:r,width:g};if(a&&(p.isHyperlink=!0,p.hyperlinkUrl=o),e.onSegment?.(p,i)===!1)return;r=""}h=!0,s=d;const b=Ke(n,l),{isInsideLinkEscape:f}=b;if(f){let g=l+1;for(o="";g<n.length;){const u=n[g];if(u===Jt)break;o+=u,g+=1}o=o.slice(4);const p={hyperlinkUrl:o,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(e.onSegment?.(p,i)===!1)return;l=g,a=!0,h=!1,s="";continue}if(l+1<n.length&&n[l+1]==="\\"&&a){const g={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(e.onSegment?.(g,i)===!1)return;a=!1,o="",l+=1,h=!1,s="";continue}}if(h){if(s!==d&&(s+=d),d===ce){h=!1,i.processEscape(s);const b={isEscapeSequence:!0,isGrapheme:!1,text:s,width:0};if(e.onSegment?.(b,i)===!1)return;s=""}continue}r+=d;const c=e.getWidth?.(r)??0,m={isEscapeSequence:!1,isGrapheme:!0,text:r,width:c};if(a&&(m.isHyperlink=!0,m.hyperlinkUrl=o),e.onSegment?.(m,i)===!1)return;r=""}if(r){const l=e.getWidth?.(r)??0,d={isEscapeSequence:!1,isGrapheme:!0,text:r,width:l};a&&(d.isHyperlink=!0,d.hyperlinkUrl=o),e.onSegment?.(d,i)}if(s){const l={isEscapeSequence:!0,isGrapheme:!1,text:s,width:0};e.onSegment?.(l,i)}},"processAnsiString");var Bo=Object.defineProperty,Ro=rt((t,e)=>Bo(t,"name",{value:e,configurable:!0}),"t$1");const Ce=Ro(t=>`${dt.values().next().value}${Ve}${String(t)}${ce}`,"wrapAnsiCode");var Wo=Object.defineProperty,So=rt((t,e)=>Wo(t,"name",{value:e,configurable:!0}),"s");const Ie=So(t=>`${dt.values().next().value}${kt}${t}${Jt}`,"wrapAnsiHyperlink");var jo=Object.defineProperty,Oo=rt((t,e)=>jo(t,"name",{value:e,configurable:!0}),"l");const Ao=Oo(t=>{if(t.length===0)return"";if(t.length===1)return t[0];let e="",i,r;const h=t.join(`
|
|
3
|
+
`),s=[...h];let o=0;for(const[a,n]of s.entries()){if(e+=n,dt.has(n)){const d=Ir.exec(h.slice(o))?.groups??{};if(d.code!==void 0){const c=Number.parseFloat(d.code);i=c===Ar?void 0:c}else d.uri!==void 0&&(r=d.uri.length===0?void 0:d.uri)}const l=Mr.get(Number(i));s[a+1]===`
|
|
4
|
+
`?(r&&(e+=Ie("")),i&&l&&(e+=Ce(l))):n===`
|
|
5
|
+
`&&(i&&l&&(e+=Ce(i)),r&&(e+=Ie(r))),o+=n.length}return e},"preserveAnsi");var Co=Object.defineProperty,Y=rt((t,e)=>Co(t,"name",{value:e,configurable:!0}),"f");const Ze=/(?=\s)|(?<=\s)/,Xe=/^\s+$/,qt=Y(t=>{if(!t.includes("\x1B"))return t;let e=t;return t.includes("\x1B[30m")&&(e+="\x1B[39m"),t.includes("\x1B[42m")&&(e+="\x1B[49m"),e},"resetAnsiAtLineBreak"),Q=Y(t=>{const e=t.split(" ");let i=e.length;for(;i>0&&M(e[i-1])===0;)i--;return i===e.length?t:e.slice(0,i).join(" ")+e.slice(i).join("")},"stringVisibleTrimSpacesRight"),Qe=Y((t,e,i)=>{if(t.length===0)return[""];if(e<=0)return[t];const r=[],h=new qe;let s="",o=0,a=!1,n=!1,l="",d=0;for(;d<t.length;){const c=t[d];if(dt.has(c)){a=!0,l=c,s+=c,n=Ke([...t],d).isInsideLinkEscape,d+=1;continue}if(a){l+=c,s+=c,n?c===Jt&&(a=n=!1):c===ce&&(a=!1,h.processEscape(l)),d+=1;continue}const m=M(c),b=c===" ";if(m===0){s+=c,d+=1;continue}if(o+m>e&&(s&&r.push(s+h.getEndEscapesForAllActiveAttributes()),s=h.getStartEscapesForAllActiveAttributes(),o=M(s),b&&i)){for(;d<t.length&&t[d]===" ";)d+=1;continue}if(s+=c,o+=m,o===e&&d<t.length-1&&(r.push(s+h.getEndEscapesForAllActiveAttributes()),s=h.getStartEscapesForAllActiveAttributes(),o=M(s),d+1<t.length&&t[d+1]===" "&&i)){for(d+=1;d<t.length&&t[d]===" ";)d+=1;continue}d+=1}return s&&r.push(s+h.getEndEscapesForAllActiveAttributes()),i?r.map(c=>Q(c)):r},"wrapWithBreakAtWidth"),Io=Y((t,e,i)=>{if(t.length===0)return[];const r=i?t.trim():t;if(r.length===0)return[];const h=[];let s="",o=0;return xo(r,{getWidth:M,onSegment:Y((a,n)=>{const l=a.text??"";if(a.isEscapeSequence)s+=l;else{const d=l===" ";if(a.width===0)return s+=l,!0;if(o+a.width>e&&(s&&h.push(s),s=n.getStartEscapesForAllActiveAttributes(),o=0,d))return i||h.push(n.getStartEscapesForAllActiveAttributes()+l),!0;s+=l,o+=a.width}return!0},"onSegment")}),s&&h.push(s),i?h.map(a=>Q(a)):h},"wrapCharByChar"),Mo=Y((t,e,i)=>{if(t.length===0)return[];const r=i?t.trim():t;if(r.length===0)return[];const h=r.split(Ze),s=[];let o="",a=0,n=0;for(;n<h.length;){const l=h[n],d=Xe.test(l),c=M(l);if(l.length===0){n+=1;continue}if(i&&d&&a===0){n+=1;continue}if(a+c>e&&a>0){i?s.push(Q(o)):s.push(o),o="",a=0;continue}o+=l,a+=c,n+=1}return o&&(i?s.push(Q(o)):s.push(o)),s},"wrapWithWordBoundaries"),$o=Y((t,e,i)=>{if(t.length===0)return[];const r=i?t.trim():t;if(r.length===0)return[];const h=r.split(Ze),s=[];let o="",a=0,n=0;for(;n<h.length;){const l=h[n],d=Xe.test(l),c=M(l);if(l.length===0){n+=1;continue}if(i&&d&&a===0){n+=1;continue}if(c>e){o&&s.push(qt(i?Q(o):o));const m=Qe(l,e,i);if(m.length>0){for(let b=0;b<m.length-1;b+=1)s.push(m[b]);o=m.at(-1),a=M(o)}else o="",a=0;n+=1;continue}if(a+c>e&&a>0&&(s.push(qt(i?Q(o):o)),o="",a=0,i&&d)){n+=1;continue}o+=l,a+=c,n+=1}return o&&s.push(qt(i?Q(o):o)),s},"wrapAndBreakWords"),At={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},Eo=Y((t,e={})=>{const{removeZeroWidthCharacters:i=!0,trim:r=!0,width:h=80,wrapMode:s=At.PRESERVE_WORDS}=e;if(r&&t.trim()==="")return"";let o=t.normalize("NFC").replaceAll(`\r
|
|
6
|
+
`,`
|
|
7
|
+
`);return i&&(o=o.replaceAll(Cr,"")),o.split(`
|
|
8
|
+
`).map(a=>{if(r&&a.trim()==="")return"";let n;switch(s){case At.BREAK_AT_CHARACTERS:{n=Io(a,h,r);break}case At.BREAK_WORDS:{n=$o(a,h,r);break}case At.STRICT_WIDTH:{n=Qe(a,h,r);break}default:n=Mo(a,h,r)}return Ao(n)}).join(`
|
|
9
|
+
`)},"wordWrap");var To=Object.defineProperty,K=S((t,e)=>To(t,"name",{value:e,configurable:!0}),"n$3");const ti=80,ei=24,ie=K((t,e,{shell:i,env:r}={})=>qi(t,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:i,env:r}).trim(),"exec"),Mt=K((t,e)=>({columns:Number.parseInt(t,10),rows:Number.parseInt(e,10)}),"create"),ii=K((t,e)=>{const{columns:i,rows:r}=Mt(t,e);if(!(Number.isNaN(i)||Number.isNaN(r))&&!(i===ti&&r===ei))return{columns:i,rows:r}},"createIfNotDefault"),ko=K(()=>{if(X.platform!=="linux")return!0;try{const t=pt.readFileSync("/proc/self/stat","utf8"),e=t.lastIndexOf(") ");if(e===-1)return!1;const i=t.slice(e+2).trim().split(/\s+/),r=Number.parseInt(i[2],10),h=Number.parseInt(i[5],10);return Number.isNaN(r)||Number.isNaN(h)||h<=0?!1:r===h}catch{return!1}},"isForegroundProcess");function Vt(){const{env:t,stdout:e,stderr:i}=X;if(e?.columns&&e?.rows)return Mt(e.columns,e.rows);if(i?.columns&&i?.rows)return Mt(i.columns,i.rows);if(t.COLUMNS&&t.LINES)return Mt(t.COLUMNS,t.LINES);const r={columns:ti,rows:ei};return X.platform==="win32"?Ut()??r:X.platform==="darwin"?Me()??Ut()??r:Me()??Ut()??No()??r}E(Vt,"Tt");_(Vt,"bt");S(Vt,"O");K(Vt,"terminalSize");const Me=K(()=>{try{const t=X.platform==="darwin"?pt.constants.O_EVTONLY|pt.constants.O_NONBLOCK:pt.constants.O_NONBLOCK,{columns:e,rows:i}=Ui.WriteStream(pt.openSync("/dev/tty",t));return{columns:e,rows:i}}catch{}},"devTty"),Ut=K(()=>{try{const t=ie("tput",["cols"],{env:{TERM:"dumb",...X.env}}),e=ie("tput",["lines"],{env:{TERM:"dumb",...X.env}});if(t&&e)return ii(t,e)}catch{}},"tput"),No=K(()=>{try{if(!ko())return;const t=ie("resize",["-u"]).match(/\d+/g);if(t.length===2)return ii(t[0],t[1])}catch{}},"resize");var Po=Object.defineProperty,ri=S((t,e)=>Po(t,"name",{value:e,configurable:!0}),"e");const nt=ri((t,e)=>{switch(e){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(e)}`)}},"getHorizontalBorderChars"),Lo=ri(t=>({join:t.bodyJoin,left:t.bodyLeft,right:t.bodyRight}),"getVerticalBorderChars");var Fo=Object.defineProperty,_o=S((t,e)=>Fo(t,"name",{value:e,configurable:!0}),"n$1");const Nt=_o((t,e,i)=>{let r=0;for(let h=0;h<i;h+=1)r+=t[e+h]??0;return i>1&&(r+=i-1),r},"calculateCellTotalWidth");var Jo=Object.defineProperty,Ho=S((t,e)=>Jo(t,"name",{value:e,configurable:!0}),"a");const re=Ho((t,e,i,r)=>{let h=e;for(;h>0&&t[h-1]?.[i]===r;)h-=1;let s=e;for(;s<t.length-1&&t[s+1]?.[i]===r;)s+=1;let o;const a=s-h+1;if(a===1)o=!0;else switch(r.vAlign){case"bottom":{o=e===s;break}case"middle":{const n=h+Math.floor(a/2);o=e===n;break}case"top":{o=e===h;break}default:o=e===h}return{firstRow:h,lastRow:s,showContent:o}},"determineCellVerticalPosition");var Go=Object.defineProperty,Vo=S((t,e)=>Go(t,"name",{value:e,configurable:!0}),"F");const Do=Vo((t,e,i,r,h)=>{if(t.length===0)return[];let s=t.length-1;for(let n=0;n<t.length;n+=1){const l=t[n];if(l){for(const[d,c]of l.entries())if(c&&h(t,n,d,c)===n){const m=re(t,n,d,c);s=Math.max(s,m.lastRow)}}}const o=Array.from({length:s+1}).fill(1);for(let n=0;n<t.length;n+=1){const l=t[n];if(l)for(let d=0;d<i.columns;d+=1){const c=l[d];if(c&&h(t,n,d,c)===n&&(c.rowSpan??1)===1){const m=c.colSpan??1,b=Nt(e,d,m),f=r(c,b).length;o[n]=Math.max(o[n]??1,f)}}}const a=Array.from({length:o.length}).fill(!1);if(i.fixedRowHeights)for(let n=0;n<o.length;n+=1){let l;i.fixedRowHeights[n]!==void 0?l=i.fixedRowHeights[n]:i.fixedRowHeights.length===1&&i.fixedRowHeights[0]!==void 0&&(l=i.fixedRowHeights[0]),l!==void 0&&(o[n]=Math.max(1,l),a[n]=!0)}for(let n=0;n<t.length;n+=1){const l=t[n];if(l)for(let d=0;d<i.columns;d+=1){const c=l[d];if(c&&h(t,n,d,c)===n&&(c.rowSpan??1)>1){const m=c.colSpan??1,b=Nt(e,d,m),f=r(c,b).length-1,g=re(t,n,d,c),{firstRow:p,lastRow:u}=g;let x=0,w=0;for(let B=p;B<=u&&B<o.length;B+=1)x+=o[B]??1,a[B]||(w+=1);const v=f-x;if(v>0)if(w>0){const B=Math.ceil(v/w);let R=0;for(let j=p;j<=u&&j<o.length;j+=1)if(!a[j]){const O=Math.min(B,v-R);if(o[j]=(o[j]??1)+O,R+=O,R>=v)break}}else console.warn(`[calculateRowHeights] Content of spanning cell exceeds fixed height allocated. Cell: ${JSON.stringify(c.content)}, Required: ${String(f)}, Allocated: ${String(x)} (fixed).`)}}}return o},"calculateRowHeights");var zo=Object.defineProperty,Yo=S((t,e)=>zo(t,"name",{value:e,configurable:!0}),"i");const st=Yo((t,e,i,r)=>{let h=e;for(;h>0&&t[h-1]?.[i]===r;)h-=1;return h},"findFirstOccurrenceRow");var qo=Object.defineProperty,Uo=S((t,e)=>qo(t,"name",{value:e,configurable:!0}),"n");const oe="__EMPTY__",$e=Uo(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:oe};if(typeof t=="object"&&"content"in t){let{content:e}=t;if(typeof e=="number"||typeof e=="bigint"||typeof e=="boolean")e=String(e);else if(e==null)e=oe;else if(typeof e!="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{...t,content:e}}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})`)},"normalizeGridCell");var Ko=Object.defineProperty,Zo=S((t,e)=>Ko(t,"name",{value:e,configurable:!0}),"p");const Xo=Zo((t,e,i,r,h)=>{const s=M(t),o=" ".repeat(Math.max(0,r)),a=" ".repeat(Math.max(0,h));if(s===0)return o+" ".repeat(Math.max(0,e))+a;const n=Math.max(0,e-s);switch(i){case"center":{const l=Math.floor(n/2),d=n-l;return o+" ".repeat(l)+t+" ".repeat(d)+a}case"right":return o+" ".repeat(n)+t+a;default:return o+t+" ".repeat(n)+a}},"padAndAlignContent");var Qo=Object.defineProperty,le=S((t,e)=>Qo(t,"name",{value:e,configurable:!0}),"H");const gt=/\r?\n/,Ee=/\s+/,W=le((t,e)=>!t||!e?t:typeof e=="function"?e(t):e.open+t+e.close,"applyColor");class Dt{static{E(this,"It")}static{_(this,"Te")}static{S(this,"Grid")}static{le(this,"Grid")}#t;#o=[];#e;#n=new WeakMap;#i=new WeakMap;static createGridLayout(){return[]}constructor(e){const i={autoColumns:1,autoFlow:"row",autoRows:1,balancedWidths:!1,gap:0,paddingLeft:1,paddingRight:1,rows:0,showBorders:e.border!==void 0,truncate:!1,truncateOverflow:!0,wordWrap:!1};let r;Array.isArray(e.fixedRowHeights)?r=e.fixedRowHeights:typeof e.fixedRowHeights=="number"&&(r=[e.fixedRowHeights]),this.#t={...i,...e,columns:e.columns,fixedRowHeights:r,showBorders:e.border!==void 0||(e.showBorders??!1)};let{terminalWidth:h}=this.#t;if(h===void 0){const{columns:s}=Vt();h=s}this.#e=h,this.#t.maxWidth&&(this.#t.maxWidth=Math.min(this.#t.maxWidth,this.#e))}addItem(e){return this.#o.push($e(e)),this}addItems(e){return this.#o.push(...e.map(i=>$e(i))),this}setColumns(e){return this.#t.columns=e,this}setRows(e){return this.#t.rows=e,this}setBorder(e){return this.#t.border=e,this}setShowBorders(e){return this.#t.showBorders=e,this}setMaxWidth(e){return this.#t.maxWidth=e,this}toString(){const e=Dt.createGridLayout();if(this.placeItems(e),e.length===0||e[0]?.length===0)return"";let i=this.calculateColumnWidths(e);const r=this.calculateTotalGridWidth(i),h=typeof this.#t.maxWidth=="number"&&this.#t.maxWidth>0?Math.min(this.#t.maxWidth,this.#e):this.#e;return r>h&&(i=this.adjustColumnWidthsForTerminal(i,r)),this.renderGrid(e,i)}placeItems(e){let i=0,r=0;const h=this.#t.rows>0?this.#t.rows:Number.POSITIVE_INFINITY;for(let s=0;s<this.#o.length;s+=1){const o=this.#o[s];if(o.content===oe&&!(o.rowSpan&&o.rowSpan>1)&&!(o.colSpan&&o.colSpan>1)){if(this.#t.autoFlow==="row")r+=1,r>=this.#t.columns&&(r=0,i+=1);else{i+=1;const f=e.length>0?e.length:h;i>=f&&f!==Number.POSITIVE_INFINITY?(i=0,r+=1):e.length===0&&f===Number.POSITIVE_INFINITY&&(r+=1)}continue}const a=o.colSpan??1,n=o.rowSpan??1;let l=!1,d=i,c=r,m=0;const b=(e.length+n+5)*this.#t.columns;for(;!l&&d<h&&m<b;){for(m+=1;d+n>e.length;)e.push(Array.from({length:this.#t.columns}).fill(void 0));if(this.canPlaceItem(e,d,c,a,n))if(this.placeItem(e,d,c,o),l=!0,this.#t.autoFlow==="row")r=c+a,i=d,r>=this.#t.columns&&(r=0,i+=1);else{i=d+n,r=c;const f=e.length>0?e.length:h;i>=f&&(i=0,r+=1)}else if(this.#t.autoFlow==="row")c+=1,c>=this.#t.columns&&(c=0,d+=1);else{for(d+=1;d+n>e.length;)e.push(Array.from({length:this.#t.columns}).fill(void 0));const f=e.length>0?e.length:h;if(d>=f&&(d=0,c+=1,c>=this.#t.columns))break}}if(!l)if(console.warn(`@visulima/tabular: Could not find position for item: ${JSON.stringify(o)} after ${String(m)} attempts. Grid might be too small or layout impossible.`),this.#t.autoFlow==="row")r+=1,r>=this.#t.columns&&(r=0,i+=1);else{i+=1;const f=e.length>0?e.length:h;i>=f&&(i=0,r+=1)}if(m>=b)break}if(this.#t.rows===0)for(;e.length>0&&e.at(-1)?.every(s=>s===void 0);)e.pop()}canPlaceItem(e,i,r,h,s,o=!1){if(r+h>this.#t.columns)return!1;for(let a=i;a<i+s;a+=1)if(a<e.length){if(!e[a])return console.warn(`Grid layout unexpectedly missing row ${String(a)} during canPlaceItem check.`),!1;for(let n=r;n<r+h;n+=1)if(e[a]?.[n]!==void 0)return!1}else if(!o)return!1;return!0}computeWrappedContentWidth(e,i,r,h){let s=e;if(h){if(s>20){let o=0;for(const a of i){const n=a.split(Ee);for(const l of n)o=Math.max(o,Math.min(M(l),r))}s=Math.min(s,Math.max(o+4,12))}}else{let o=0;for(const a of i){const n=a.split(Ee);for(const l of n)o=Math.max(o,Math.min(M(l),r))}s=Math.min(s,Math.max(o+12,20))}return s}placeItem(e,i,r,h){const s=h.rowSpan??1,o=h.colSpan??1;for(let a=i;a<i+s;a+=1){for(;a>=e.length;)e.push(Array.from({length:this.#t.columns}).fill(void 0));for(let n=r;n<r+o;n+=1)n<this.#t.columns&&(e[a]||(console.error(`Logic error: Row ${String(a)} not found in placeItem despite check.`),e[a]=Array.from({length:this.#t.columns}).fill(void 0)),e[a][n]=h)}}calculateTotalGridWidth(e){let i=0;const r=this.#t.showBorders?this.#t.border:void 0;r&&(i+=r.bodyLeft.width,i+=r.bodyRight.width);const h=e.length,s=this.#t.showBorders?r?.bodyJoin.width??0:0,o=this.#t.gap;for(let a=0;a<h;a+=1)i+=e[a]??0,a<h-1&&(i+=o,i+=s);return i}adjustColumnWidthsForTerminal(e,i){const r=typeof this.#t.maxWidth=="number"&&this.#t.maxWidth>0?Math.min(this.#t.maxWidth??0,this.#e):this.#e;if(i<=r)return e;let h=0;const s=e.length,o=this.#t.showBorders?this.#t.border:void 0;if(o&&(h+=o.bodyLeft.width,h+=o.bodyRight.width),s>1){h+=(s-1)*this.#t.gap;const c=o?.bodyJoin.width??0;h+=(s-1)*c}if(h>=r)return Array.from({length:s}).fill(1);const a=r-h,n=e.reduce((c,m)=>c+m,0);if(n===0){const c=Math.floor(a/s);return Array.from({length:s}).fill(c)}const l=e.map(c=>{const m=c/n;return Math.max(1,Math.floor(a*m))});let d=a-l.reduce((c,m)=>c+m,0);if(d>0){const c=l.map((m,b)=>{const f=n>0?(e[b]??0)/n:1/s;return{index:b,remainder:a*f%1}}).toSorted((m,b)=>b.remainder-m.remainder);for(const m of c){if(d<=0)break;const{index:b}=m;l[b]!==void 0&&(l[b]+=1,d-=1)}}return l}calculateBalancedColumnWidths(e){const i=this.calculateMinimumColumnWidthsWithGrowableInfo(e),r=i.widths,{growableColumns:h}=i,s=typeof this.#t.maxWidth=="number"&&this.#t.maxWidth>0?Math.min(this.#t.maxWidth,this.#e):this.#e,o=this.#t.showBorders?this.#t.border:void 0;let a=0;if(o&&(a+=o.bodyLeft.width,a+=o.bodyRight.width),this.#t.columns>1){a+=(this.#t.columns-1)*this.#t.gap;const d=o?.bodyJoin.width??0;a+=(this.#t.columns-1)*d}const n=Math.max(0,s-a);if(r.reduce((d,c)=>d+c,0)>0){const d=Math.floor(n/this.#t.columns),c=Array.from({length:this.#t.columns}).fill(d),m=d*this.#t.columns;let b=n-m;for(let u=0;u<c.length&&b>0;u+=1)c[u]=(c[u]??0)+1,b-=1;const f=[];let g=0;for(let u=0;u<this.#t.columns;u+=1){const x=c[u]??0,w=r[u]??0,v=Math.max(x,w);f.push(v),g+=v}if(g>n){const u=n/g,x=f.map(B=>Math.max(3,Math.floor(B*u))),w=x.reduce((B,R)=>B+R,0);let v=n-w;for(let B=0;B<x.length&&v>0;B+=1)x[B]=(x[B]??0)+1,v-=1;return x}let p=n-g;if(p>0){const u=h.length>0?h:f.map((x,w)=>w);for(;p>0&&u.length>0;)for(const x of u){if(p<=0)break;f[x]=(f[x]??0)+1,p-=1}}return f}const l=Math.floor(n/this.#t.columns);return Array.from({length:this.#t.columns}).fill(l)}calculateMinimumColumnWidthsWithGrowableInfo(e){const i=Array.from({length:this.#t.columns}).fill(0),r=[],h=this.#t.paddingLeft+this.#t.paddingRight,s=this.#t.gap+(this.#t.showBorders?this.#t.border?.bodyJoin.width??0:0);for(let o=0;o<this.#t.columns;o+=1)for(let a=0;a<e.length;a+=1){const n=e[a]?.[o];if(!n||st(e,a,o,n)!==a||o>0&&e[a]?.[o-1]===n)continue;const l=n.colSpan??1,d=n.maxWidth??Number.POSITIVE_INFINITY,c=String(n.content??"").split(gt),m=this.#t.wordWrap&&n.wordWrap!==!1;let b=0;for(const f of c)b=Math.max(b,Math.min(M(f),d));b=this.computeWrappedContentWidth(b,c,d,m),l===1&&(i[o]=Math.max(i[o]??0,b+h),m&&!r.includes(o)&&r.push(o))}for(let o=0;o<e.length;o+=1)for(let a=0;a<this.#t.columns;a+=1){const n=e[o]?.[a];if(!n||st(e,o,a,n)!==o||a>0&&e[o]?.[a-1]===n)continue;const l=n.colSpan??1;if(l>1){const d=n.maxWidth??Number.POSITIVE_INFINITY,c=String(n.content??"").split(gt),m=this.#t.wordWrap&&n.wordWrap!==!1;let b=0;for(const u of c)b=Math.max(b,Math.min(M(u),d));b=this.computeWrappedContentWidth(b,c,d,m);const f=(l-1)*s,g=b+h+f;let p=0;for(let u=a;u<a+l;u+=1)p+=i[u]??0;if(g>p){const u=g-p,x=Math.ceil(u/l);for(let w=0;w<l&&a+w<this.#t.columns;w+=1)i[a+w]=Math.max(i[a+w]??0,x)}}}return{growableColumns:r,widths:i}}calculateColumnWidths(e){if(this.#t.fixedColumnWidths&&this.#t.fixedColumnWidths.length===this.#t.columns){const s=this.#t.fixedColumnWidths;if(!s.some(o=>o===void 0||!Number.isFinite(o)))return[...s];if(this.#t.balancedWidths){const o=Array.from({length:s.length}).fill(0),a=typeof this.#t.maxWidth=="number"&&this.#t.maxWidth>0?Math.min(this.#t.maxWidth,this.#e):this.#e,n=this.calculateTotalGridWidth(Array.from({length:o.length}).fill(0)),l=Math.max(0,a-n);let d=0;const c=[];for(const[f,g]of s.entries())typeof g=="number"&&Number.isFinite(g)?(o[f]=g,d+=g):c.push(f);let m=Math.max(0,l-d);const b=c.length>0?Math.floor(m/c.length):0;for(const f of c)o[f]=b;m-=b*c.length;for(const f of c){if(m<=0)break;o[f]+=1,m-=1}return o}}if(this.#t.balancedWidths)return this.calculateBalancedColumnWidths(e);const i=Array.from({length:this.#t.columns}).fill(0),r=this.#t.paddingLeft+this.#t.paddingRight,h=this.#t.gap+(this.#t.showBorders?this.#t.border?.bodyJoin.width??0:0);for(let s=0;s<this.#t.columns;s+=1)for(let o=0;o<e.length;o+=1){const a=e[o]?.[s];if(!a||st(e,o,s,a)!==o||s>0&&e[o]?.[s-1]===a)continue;const n=a.colSpan??1,l=a.maxWidth??Number.POSITIVE_INFINITY,d=String(a.content??"").split(gt);let c=0;for(const m of d)c=Math.max(c,Math.min(M(m),l));n===1&&(i[s]=Math.max(i[s]??0,c+r))}for(let s=0;s<e.length;s+=1)for(let o=0;o<this.#t.columns;o+=1){const a=e[s]?.[o];if(!a||st(e,s,o,a)!==s||o>0&&e[s]?.[o-1]===a)continue;const n=a.colSpan??1;if(n>1){const l=a.maxWidth??Number.POSITIVE_INFINITY,d=String(a.content??"").split(gt),c=this.#t.wordWrap&&a.wordWrap!==!1;let m=0;for(const u of d)m=Math.max(m,Math.min(M(u),l));m=this.computeWrappedContentWidth(m,d,l,c);let b=0;for(let u=o;u<o+n;u+=1)b+=i[u]??0;const f=n>1?(n-1)*h:0,g=m+r+f,p=b+f;if(g>p){const u=g-p,x=Math.floor(u/n);let w=0;for(let v=0;v<n&&o+v<this.#t.columns;v+=1){const B=Math.min(x,u-w);if(i[o+v]=(i[o+v]??0)+B,w+=B,w>=u)break}}}}if(this.#t.maxWidth){const s=this.calculateTotalGridWidth(i);if(s>this.#t.maxWidth)return this.adjustColumnWidthsForTerminal(i,s)}return i}renderVisualRowContent(e,i,r,h,s){const o=e[i];if(!o)return"";const a=this.#t.borderColor??this.#t.foregroundColor??void 0,n=[],l=this.#t.showBorders&&this.#t.border?Lo(this.#t.border):void 0,d=l&&l.left.width>0?l.left.char:"",c=l&&l.right.width>0?l.right.char:"",m=l&&l.join.width>0?l.join.char:"",b=" ".repeat(this.#t.gap);d&&n.push(W(W(d,a),this.#t.backgroundColor));let f=0;for(;f<this.#t.columns;){const g=o[f]??void 0;let p=1,u;if(g){const x=g.colSpan??1;p=x;const w=st(e,i,f,g),v=Nt(h,f,x),B=this.alignCellContent(g,v),R=B.length,j=this.getCachedCellVerticalPosition(e,i,f,g);j.firstRow!==w&&console.warn(`Mismatch between findFirstOccurrenceRow (${String(w)}) and determineCellVerticalPosition (${String(j.firstRow)})`);const O=s.slice(w,j.lastRow+1).reduce((A,P)=>A+P,0),$=j.lastRow-j.firstRow+1;let k=r,N=0;for(let A=w;A<i;A+=1)A<s.length&&(k+=s[A]??1),A<j.lastRow&&(N+=1);k+=N;const J=g.vAlign??"top";let F;switch(J){case"bottom":{let A=r;for(let L=w;L<i;L+=1)A+=s[L]??1;const P=O-R;F=A>=P?A-P:-1;break}case"middle":{const A=Math.round((O-R)/2);let P=r;for(let L=w;L<i;L+=1)P+=s[L]??1;F=P>=A&&P<A+R?P-A:-1;break}case"top":{F=k;break}default:F=k}const zt=F>=0&&F<R;if(u=" ".repeat(Math.max(0,v)),zt){let A=!1;J==="middle"&&$%2===0&&F===0&&(A=!0),A||(u=B[F]??u)}g.colSpan&&g.colSpan>1&&(u+=b.repeat(g.colSpan)),g.foregroundColor?u=W(u,g.foregroundColor):this.#t.foregroundColor&&(u=W(u,this.#t.foregroundColor)),g.backgroundColor?u=W(u,g.backgroundColor):this.#t.backgroundColor&&(u=W(u,this.#t.backgroundColor))}else{const x=this.#t.paddingLeft+this.#t.paddingRight,w=Math.max(0,(h[f]??0)-x),v=" ".repeat(this.#t.paddingLeft+w+this.#t.paddingRight);u=W(W(r===0?v:" ".repeat(v.length),this.#t.foregroundColor),this.#t.backgroundColor)}n.push(u),f+p<this.#t.columns&&(n.push(b),this.#t.showBorders&&m&&n.push(W(W(m,a),this.#t.backgroundColor)),this.#t.gap>0&&n.push(b)),f+=p}return c&&n.push(W(W(c,a),this.#t.backgroundColor)),n.join("")}alignCellContent(e,i){const r=this.#n.get(e);if(r?.has(i))return r.get(i);const{paddingLeft:h,paddingRight:s}=this.#t,o=h+s,a=i-o;if(a<=0){const c=[" ".repeat(o+this.#t.gap)];return r?r.set(i,c):this.#n.set(e,new Map([[i,c]])),c}let n;const l=String(e.content??"");if(n=l.includes(`
|
|
10
|
+
`)||l.includes("\r")?l.split(gt):[l],this.#t.wordWrap&&e.wordWrap!==!1){const c=typeof this.#t.wordWrap=="object"?this.#t.wordWrap:{},m=typeof e.wordWrap=="object"?e.wordWrap:c;n=Eo(l,{...m,width:a}).split(`
|
|
11
|
+
`)}if(this.#t.truncate&&e.truncate!==!1){const c=typeof this.#t.truncate=="object"?this.#t.truncate:{},m=typeof e.truncate=="object"?e.truncate:c;n=n.map(b=>Ae(b,a,m))}else this.#t.truncateOverflow&&(n=n.map(c=>M(c)>a?Ae(c,a,{}):c));const d=n.map(c=>Xo(c,a,e.hAlign??"left",h,s));return r?r.set(i,d):this.#n.set(e,new Map([[i,d]])),d}renderHorizontalBorder(e,i,r,h,s,o=-1){if(!this.#t.showBorders||!this.#t.border)return"";const a=this.#t.border,n=nt(a,s),l=n.body.char,d=n.body.width,c=a.bodyJoin.char;if(s!=="middle"&&d===0)return"";let m=n.left.char,b=n.right.char;if(s==="middle"&&o!==-1){const u=e[r]?.[0]??void 0,x=e[o]?.[0]??void 0;u&&x&&u===x&&(m=c);const w=this.#t.columns-1,v=e[r]?.[w]??void 0,B=e[o]?.[w]??void 0;v&&B&&v===B&&(b=c)}const f=[],g=" ".repeat(this.#t.gap);m&&f.push(W(W(m,this.#t.borderColor),this.#t.backgroundColor));let p;for(let u=0;u<this.#t.columns;u+=1){const x=e[r]?.[u]??void 0,w=s==="middle"&&o!==-1?e[o]?.[u]??void 0:void 0;let v,B=!1;if(x&&(u===0||e[r]?.[u-1]!==x)&&(v=x,B=!0),x&&!B)continue;if(!x){const O=h[u]??0;if(p=d>0?l.repeat(O):" ".repeat(O),f.push(W(W(p,this.#t.borderColor),this.#t.backgroundColor)),u<this.#t.columns-1){const $=this.determineJoinChar(s,e,r,o,u,u+1);f.push(g),$.width>0&&f.push(W(W($.char,this.#t.borderColor),this.#t.backgroundColor))}continue}const R=v?.colSpan??1;if(s==="middle"&&s==="middle"&&w&&x===w&&v){const O=v.vAlign==="middle",{firstRow:$,lastRow:k}=this.getCachedCellVerticalPosition(e,r,u,v),N=k-$+1,J=N%2===0,F=$+Math.ceil(N/2)-1,zt=Nt(h,u,R),A=this.alignCellContent(v,zt),P=A.length;if(O&&J&&r===F)p=W(A[0]??"",this.#t.borderColor);else{let L=0;for(let ot=$;ot<=r;ot+=1)L+=i[ot]??1,ot<r&&(L+=1);const Yt=L;if(Yt>=0&&Yt<P)p=W(A[Yt]??"",this.#t.foregroundColor);else{const ot=h.slice(u,u+R).reduce((si,ai)=>si+ai,0)+(R-1)*(this.#t.gap+this.#t.border.bodyJoin.width);p=W(" ".repeat(ot),this.#t.borderColor)}}f.push(W(p,this.#t.backgroundColor))}else{const O=[];for(let $=u;$<u+R;$+=1){const k=h[$]??0,N=d>0?l:" ";if(O.push(N.repeat(k+this.#t.gap)),$<u+R-1){const J=this.determineJoinChar(s,e,r,o,$,$+1);J.width>0&&O.push(J.char)}}p=O.join(""),f.push(W(W(p,this.#t.borderColor),this.#t.backgroundColor))}const j=u+R-1;if(j<this.#t.columns-1){const O=this.determineJoinChar(s,e,r,o,j,j+1);O.width>0&&f.push(W(W(O.char,this.#t.borderColor),this.#t.backgroundColor))}u+=R-1}return b&&f.push(W(W(b,this.#t.borderColor),this.#t.backgroundColor)),f.join("")}determineJoinChar(e,i,r,h,s,o=-1){if(!this.#t.showBorders||!this.#t.border)return{char:" ",width:this.#t.gap};const a=this.#t.border;if(e!=="middle"){const B=nt(a,e),R=i[r]?.[s]??void 0,j=o===-1?s+1:o,O=i[r]?.[j]??void 0,$=R!==void 0&&O!==void 0&&R===O?B.body:B.join,{char:k,width:N}=$;return{char:k,width:N>0?N:this.#t.gap}}if(h===-1||o===-1)return{char:" ",width:this.#t.gap};const n=a.bodyJoin,l=i[r]?.[s]??void 0,d=i[h]?.[s]??void 0,c=i[r]?.[o]??void 0,m=i[h]?.[o]??void 0,b=l!==void 0&&d!==void 0&&l===d,f=c!==void 0&&m!==void 0&&c===m,g=l!==void 0&&c!==void 0&&l===c,p=d!==void 0&&m!==void 0&&d===m;let u;const x=nt(a,"middle");b&&f?u=g?{char:" ",width:n.width}:n:b?u=a.joinLeft:f?u=a.joinRight:g&&p?u=x.body:g?u=a.topJoin:p?u=a.bottomJoin:u=a.joinJoin;const{char:w,width:v}=u;return{char:w,width:v>0?v:this.#t.gap}}renderGrid(e,i){if(e.length===0)return"";const r=[],h=Do(e,i,this.#t,this.alignCellContent.bind(this),st),s=this.#t.showBorders&&this.#t.border?nt(this.#t.border,"top"):void 0;s&&s.body.width>0&&r.push(this.renderHorizontalBorder(e,h,0,i,"top"));for(let a=0;a<e.length;a+=1){const n=h[a]??1;for(let d=0;d<n;d+=1)r.push(this.renderVisualRowContent(e,a,d,i,h));const l=this.#t.showBorders&&this.#t.border?nt(this.#t.border,"middle"):void 0;if(a<e.length-1&&l&&l.body.width>0){const d=e[a],c=e[a+1];let m=!1;if(d&&c)for(let b=0;b<this.#t.columns;b+=1){const f=d[b],g=c[b];if(f!==g){m=!0;break}}m&&r.push(this.renderHorizontalBorder(e,h,a,i,"middle",a+1))}}const o=this.#t.showBorders&&this.#t.border?nt(this.#t.border,"bottom"):void 0;return o&&o.body.width>0&&r.push(this.renderHorizontalBorder(e,h,e.length-1,i,"bottom")),r.join(`
|
|
12
|
+
`)}getCachedCellVerticalPosition(e,i,r,h){const s=this.#i.get(h);if(s)return s;const o=re(e,i,r,h);return this.#i.set(h,o),o}}le(t=>new Dt(t),"createGrid");const tn={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}},yn={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}},vn={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}},xn={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}},Bn={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}},Rn={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}},Wn={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}},Sn={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}},jn={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}},On={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}};var en=Object.defineProperty,oi=E((t,e)=>en(t,"name",{value:e,configurable:!0}),"p"),rn=Object.defineProperty,de=oi((t,e)=>rn(t,"name",{value:e,configurable:!0}),"g"),on=Object.defineProperty,nn=de((t,e)=>on(t,"name",{value:e,configurable:!0}),"u");const sn=nn(t=>t.reduce((e,i)=>i===null?e+1:typeof i=="object"&&!Array.isArray(i)?(i.colSpan??=1,i.colSpan<=0?e+1:e+i.colSpan):e+1,0),"computeRowLogicalWidth");var an=Object.defineProperty,ni=de((t,e)=>an(t,"name",{value:e,configurable:!0}),"b");class hn{static{E(this,"H")}static{oi(this,"$")}static{de(this,"Table")}static{ni(this,"Table")}#t;#o=[];#e=[];#n=[];#i=!0;#r=void 0;constructor(e={}){this.#t={...e,showFooter:e.showFooter??!0,showHeader:e.showHeader??!0,style:{border:tn,paddingLeft:1,paddingRight:1,...e.style}}}setHeaders(e){return e.length>0&&!Array.isArray(e[0])?this.#e=[e]:this.#e=e.map(i=>Array.isArray(i)?i:[i]),this.#i=!0,this.#r=void 0,this}setFooter(e){return e.length>0&&!Array.isArray(e[0])?this.#n=[e]:this.#n=e.map(i=>Array.isArray(i)?i:[i]),this.#i=!0,this.#r=void 0,this}addRow(e){if(!Array.isArray(e))throw new TypeError("Row must be an array");return this.#o.push(e),this.#i=!0,this.#r=void 0,this}addRows(...e){for(const i of e)this.addRow(i);return this.#i=!0,this.#r=void 0,this}toString(){if(!this.#i&&this.#r!==void 0)return this.#r;const e=this.#t.showHeader?this.#e:[],i=this.#t.showFooter?this.#n:[],r=[...e,...this.#o,...i];if(r.length===0)return this.#r="",this.#i=!1,"";let h=0;for(const c of r){const m=c;Array.isArray(m)?h=Math.max(h,sn(m)):console.error("Unexpected non-array element found while calculating columns:",m)}if(h===0)return this.#r="",this.#i=!1,"";let s;Array.isArray(this.#t.columnWidths)?s=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"&&(s=Array.from({length:h}).fill(this.#t.columnWidths));let o;const a=r.length;if(Array.isArray(this.#t.rowHeights)?o=this.#t.rowHeights:typeof this.#t.rowHeights=="number"&&(o=Array.from({length:a}).fill(this.#t.rowHeights)),s&&Array.isArray(s)){const c=[...s];for(const m of r){const b=m;for(const[f,g]of b.entries()){let p={};if(typeof g=="object"&&g!==null&&!Array.isArray(g)){const{content:u,href:x,...w}=g;p=w}p.width!==void 0?c[f]=p.width:p.maxWidth!==void 0&&c[f]!==void 0&&(c[f]=Math.min(c[f],p.maxWidth))}}s=c}const n={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:s,fixedRowHeights:o,foregroundColor:this.#t.style?.foregroundColor,gap:this.#t.gap??0,maxWidth:this.#t.maxWidth,paddingLeft:this.#t.style?.paddingLeft,paddingRight:this.#t.style?.paddingRight,terminalWidth:this.#t.terminalWidth,truncate:this.#t.truncate??(s?.every(c=>typeof c=="number")||this.#t.maxWidth!==void 0&&!this.#t.balancedWidths),truncateOverflow:this.#t.truncateOverflow??!0,wordWrap:this.#t.wordWrap??!1},l=new Dt(n),d=[];for(const[c,m]of r.entries()){const b=m;if(!Array.isArray(b)){console.error("Skipping non-array row while creating GridItems:",b);continue}const f=this.#t.showHeader?this.#e.length:0,g=this.#o.length,p=this.#t.showHeader&&c<f,u=this.#t.showFooter&&c>=f+g,x=p&&b.length===1&&h>1,w=u&&b.length===1&&h>1;for(const v of b){let B=v,R={};if(typeof B=="object"&&B!==null&&!Array.isArray(B)){const{content:k,href:N,...J}=B;B=N?`\x1B]8;;${N}\x1B\\${String(k)}\x1B]8;;\x1B\\`:k,R=J}x&&(R.colSpan=h),w&&(R.colSpan=h);const j=this.#t.transformTabToSpace&&typeof B=="string"?B.replaceAll(" "," ".repeat(this.#t.transformTabToSpace)):B,{maxWidth:O,width:$}=R;d.push({backgroundColor:R.backgroundColor,colSpan:R.colSpan,content:j,foregroundColor:R.foregroundColor,hAlign:R.hAlign,maxWidth:O,rowSpan:R.rowSpan,truncate:R.truncate??(O===void 0?void 0:!0),vAlign:R.vAlign,width:$,wordWrap:R.wordWrap})}}return l.addItems(d),this.#r=l.toString(),this.#i=!1,this.#r}}const An=ni(t=>new hn(t),"createTable");export{ji as B,An as D,fn as E,hn as H,mn as I,gn as N,pn as P,On as R,bn as T,Rn as a,Wn as c,Bn as d,wn as e,U as g,yn as h,vn as i,dn as j,xn as o,un as q,Sn as r,tn as t,jn as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c=Object.defineProperty;var r=(t,e)=>c(t,"name",{value:e,configurable:!0});var p=Object.defineProperty,a=r((t,e)=>p(t,"name",{value:e,configurable:!0}),"t");function f(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}r(f,"getDefaultExportFromCjs");a(f,"getDefaultExportFromCjs");function l(t){return t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}r(l,"getDefaultExportFromNamespaceIfPresent");a(l,"getDefaultExportFromNamespaceIfPresent");function s(t){return t&&Object.prototype.hasOwnProperty.call(t,"default")&&Object.keys(t).length===1?t.default:t}r(s,"getDefaultExportFromNamespaceIfNotNamed");a(s,"getDefaultExportFromNamespaceIfNotNamed");function m(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var o=a(r(function n(){var u=!1;try{u=this instanceof n}catch{}return u?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)},"a"),"a");o.prototype=e.prototype}else o={};return Object.defineProperty(o,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var u=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(o,n,u.get?u:{enumerable:!0,get:a(function(){return t[n]},"get")})}),o}r(m,"getAugmentedNamespace");a(m,"getAugmentedNamespace");export{m as a,f as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var I=Object.defineProperty;var d=(s,e)=>I(s,"name",{value:e,configurable:!0});import{createRequire as $}from"node:module";import{
|
|
1
|
+
var I=Object.defineProperty;var d=(s,e)=>I(s,"name",{value:e,configurable:!0});import{createRequire as $}from"node:module";import{b as j}from"../packem_chunks/config.js";import{advisoriesStatus as E,NATIVE_BINDING_VERSION as A,advisoriesIngest as q,advisoriesQuery as B}from"#native";const T=$(import.meta.url),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=d(s=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[e,t]=v.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return v.getBuiltinModule(s)}return T(s)},"__cjs_getBuiltinModule"),{randomUUID:O}=l("node:crypto"),{createWriteStream:P,existsSync:k}=l("node:fs"),{mkdir:U,unlink:x,stat:C}=l("node:fs/promises"),{join:w,dirname:L}=l("node:path"),{Readable:M}=l("node:stream"),{pipeline:W}=l("node:stream/promises");var F=Object.defineProperty,r=d((s,e)=>F(s,"name",{value:e,configurable:!0}),"s");const b=5;if(A!==b)throw new Error(`vis native binding ABI mismatch in advisories: expected ${b}, got ${A}. Rebuild via \`pnpm --filter @visulima/vis run build:native\` or reinstall the platform binding package.`);const es="https://osv-vulnerabilities.storage.googleapis.com",V=new Set(["osv-vulnerabilities.storage.googleapis.com"]);class H extends Error{static{d(this,"AdvisoryDbNotFoundError")}static{r(this,"AdvisoryDbNotFoundError")}cause="DB_NOT_FOUND";constructor(e){super(`No local advisory DB at ${e}. Run 'vis advisories sync' first.`),this.name="AdvisoryDbNotFoundError"}}class p extends Error{static{d(this,"AdvisorySourceNotAllowedError")}static{r(this,"AdvisorySourceNotAllowedError")}cause="SOURCE_NOT_ALLOWED";constructor(e){super(`Advisory source host '${e}' is not in the built-in allowlist. Add it to \`security.audit.advisories.allowedHosts\` if intentional.`),this.name="AdvisorySourceNotAllowedError"}}class N extends Error{static{d(this,"AdvisorySyncNetworkError")}static{r(this,"AdvisorySyncNetworkError")}cause="SYNC_NETWORK";constructor(e,t){super(`Advisory sync failed for ${e}: ${t}. Check connectivity, proxy env vars, or --source.`),this.name="AdvisorySyncNetworkError"}}const g=r(s=>{const e=j("vis",{create:!0,cwd:s})??w(s,"node_modules",".cache","vis");return w(e,"advisories","db.sqlite")},"resolveAdvisoryDbPath"),z=r((s,e)=>{let t;try{t=new URL(s)}catch{throw new p(s)}if(t.protocol!=="https:")throw new p(`${t.protocol}//${t.host}`);if(!new Set([...V,...e??[]]).has(t.host))throw new p(t.host);return t},"validateAdvisorySource"),ts=r(async s=>{const e=s.dbPath??g(s.workspaceRoot);await U(L(e),{recursive:!0});const t=z(s.source,s.allowedHosts),u=new URL(`${s.ecosystem}/all.zip`,Q(t.toString())),y=await G(e,s.ecosystem);let i=null;if(!s.force){const n=await S(u,{method:"HEAD"});if(n.ok&&(i=n.headers.get("etag"),i&&y&&i===y))return{advisoriesIngested:0,dbPath:e,durationMs:0,upToDate:!0}}const a=`${e}.${s.ecosystem}.${process.pid}.${O()}.zip.tmp`,o=await S(u,{method:"GET"});if(!o.ok||!o.body)throw new N(u.toString(),o.status);i||(i=o.headers.get("etag"));const m=o.headers.get("content-length"),c=m?Number.parseInt(m,10):null;let h=0;const _=P(a),f=M.fromWeb(o.body);s.onProgress&&c&&f.on("data",n=>{h+=n.byteLength,s.onProgress?.(h,c,"download")}),await W(f,_);try{const n=await q({dbPath:e,ecosystem:s.ecosystem,manifestEtag:i??void 0,zipPath:a},(D,R)=>s.onProgress?.(D,R,"ingest"));return{advisoriesIngested:n.advisoriesIngested,dbPath:e,durationMs:n.durationMs,upToDate:!1}}finally{await x(a).catch(()=>{})}},"syncAdvisories"),rs=r((s,e)=>{if(s.length===0)return new Map;const t=e.dbPath??g(e.workspaceRoot),u=e.ecosystem??"npm";if(!k(t))throw new H(t);const y=s.map(o=>({ecosystem:u,name:o.name,version:o.version})),i=B(t,y),a=new Map;for(const[o,m]of s.entries()){const c=i[o];!c||c.vulnerabilities.length===0||a.set(m.name,c.vulnerabilities.map(h=>K(h)))}return a},"queryAdvisories"),os=r(async(s,e)=>{const t=e??g(s);return E(t)},"getAdvisoryStatus"),G=r(async(s,e)=>{try{await C(s)}catch{return null}return E(s).ecosystems.find(t=>t.name===e)?.manifestEtag??null},"readStoredEtag"),K=r(s=>({aliases:s.aliases.length>0?s.aliases:void 0,cvssScore:s.cvssScore??void 0,fixedVersions:s.fixedVersions,id:s.id,severity:Y(s.severity),summary:s.summary}),"toSecurityVulnerability"),Y=r(s=>{const e=s.toUpperCase();return e==="CRITICAL"||e==="HIGH"||e==="MODERATE"||e==="LOW"?e:"UNKNOWN"},"normalizeSeverity"),Q=r(s=>s.endsWith("/")?s:`${s}/`,"ensureTrailingSlash"),S=r(async(s,e)=>{try{return await fetch(s,e)}catch(t){throw new N(s.toString(),t instanceof Error?t.message:String(t))}},"safeFetch");export{H as A,es as D,os as g,rs as q,g as r,ts as s};
|