@visulima/vis 1.0.0-alpha.13 → 1.0.0-alpha.14

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.
Files changed (100) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/LICENSE.md +7242 -385
  3. package/dist/bin.js +1 -1
  4. package/dist/config/index.d.ts +493 -1
  5. package/dist/config/index.js +1 -1
  6. package/dist/packem_chunks/applyDefaults.js +2 -2
  7. package/dist/packem_chunks/bin.js +1134 -199
  8. package/dist/packem_chunks/doctor-probe.js +2 -2
  9. package/dist/packem_chunks/fix.js +11 -11
  10. package/dist/packem_chunks/handler.js +1 -1
  11. package/dist/packem_chunks/handler10.js +1 -1
  12. package/dist/packem_chunks/handler11.js +1 -1
  13. package/dist/packem_chunks/handler12.js +5 -5
  14. package/dist/packem_chunks/handler13.js +1 -1
  15. package/dist/packem_chunks/handler14.js +20 -18
  16. package/dist/packem_chunks/handler15.js +1 -20
  17. package/dist/packem_chunks/handler16.js +1 -1
  18. package/dist/packem_chunks/handler17.js +1 -1
  19. package/dist/packem_chunks/handler18.js +1 -1
  20. package/dist/packem_chunks/handler19.js +5 -1
  21. package/dist/packem_chunks/handler2.js +1 -1
  22. package/dist/packem_chunks/handler20.js +1 -5
  23. package/dist/packem_chunks/handler21.js +1 -1
  24. package/dist/packem_chunks/handler22.js +5 -1
  25. package/dist/packem_chunks/handler23.js +1 -5
  26. package/dist/packem_chunks/handler24.js +3 -1
  27. package/dist/packem_chunks/handler25.js +1 -3
  28. package/dist/packem_chunks/handler26.js +1 -1
  29. package/dist/packem_chunks/handler27.js +7 -1
  30. package/dist/packem_chunks/handler28.js +22 -6
  31. package/dist/packem_chunks/handler29.js +3 -23
  32. package/dist/packem_chunks/handler3.js +4 -4
  33. package/dist/packem_chunks/handler30.js +18 -3
  34. package/dist/packem_chunks/handler31.js +1 -1
  35. package/dist/packem_chunks/handler32.js +2 -2
  36. package/dist/packem_chunks/handler33.js +24 -24
  37. package/dist/packem_chunks/handler34.js +2 -2
  38. package/dist/packem_chunks/handler35.js +2 -2
  39. package/dist/packem_chunks/handler36.js +20 -20
  40. package/dist/packem_chunks/handler37.js +2 -2
  41. package/dist/packem_chunks/handler38.js +6 -22
  42. package/dist/packem_chunks/handler39.js +11 -11
  43. package/dist/packem_chunks/handler4.js +1 -1
  44. package/dist/packem_chunks/handler40.js +5 -22
  45. package/dist/packem_chunks/handler41.js +24 -6
  46. package/dist/packem_chunks/handler42.js +10 -5
  47. package/dist/packem_chunks/handler43.js +153 -10
  48. package/dist/packem_chunks/handler44.js +25 -153
  49. package/dist/packem_chunks/handler45.js +3 -25
  50. package/dist/packem_chunks/handler46.js +27 -3
  51. package/dist/packem_chunks/handler47.js +41 -26
  52. package/dist/packem_chunks/handler48.js +32 -40
  53. package/dist/packem_chunks/handler5.js +7 -7
  54. package/dist/packem_chunks/handler6.js +1 -1
  55. package/dist/packem_chunks/handler7.js +1 -1
  56. package/dist/packem_chunks/handler8.js +1 -1
  57. package/dist/packem_chunks/handler9.js +1 -1
  58. package/dist/packem_chunks/heal-accept.js +4 -4
  59. package/dist/packem_chunks/heal.js +3 -3
  60. package/dist/packem_chunks/help-command.js +18 -0
  61. package/dist/packem_chunks/index.js +4 -4
  62. package/dist/packem_chunks/loader.js +1 -1
  63. package/dist/packem_chunks/tar.js +1 -1
  64. package/dist/packem_shared/ai-analysis-Dzs_nUwM.js +68 -0
  65. package/dist/packem_shared/ai-cache-Dtvmbsru.js +1 -0
  66. package/dist/packem_shared/{ai-fix-nn4zOE95.js → ai-fix-BmLM72GS.js} +4 -4
  67. package/dist/packem_shared/cache-directory-xASJia6M.js +1 -0
  68. package/dist/packem_shared/dependency-scan-DmwPKwLy.js +2 -0
  69. package/dist/packem_shared/docker-CA-scYu0.js +2 -0
  70. package/dist/packem_shared/failure-log-fD4DiFb1.js +2 -0
  71. package/dist/packem_shared/flakiness-BIg1rwvp.js +1 -0
  72. package/dist/packem_shared/{giget-CcEy_Elm.js → giget-BX2ixMoa.js} +2 -2
  73. package/dist/packem_shared/index-OlP7U_t5.js +6 -0
  74. package/dist/packem_shared/lockfile-BXylopgH.js +1 -0
  75. package/dist/packem_shared/otelPlugin-y5hoCw4b.js +1 -0
  76. package/dist/packem_shared/registry-BHqKXiLb.js +2 -0
  77. package/dist/packem_shared/run-summary-utils-D39XBHWW.js +1 -0
  78. package/dist/packem_shared/runtime-check-BaKni2y1.js +1 -0
  79. package/dist/packem_shared/selectors-BvtUXWGY.js +3 -0
  80. package/dist/packem_shared/toolchain-B7sIiJxK.js +5 -0
  81. package/dist/packem_shared/typosquats-XkC1CnOa.js +1 -0
  82. package/dist/packem_shared/verify-BVTcVfoW.js +1 -0
  83. package/dist/packem_shared/{vis-update-app-D1jl0UZZ.js → vis-update-app-DR8c4OfG.js} +1 -1
  84. package/package.json +15 -30
  85. package/dist/packem_shared/ai-analysis-hm8d2W7z.js +0 -67
  86. package/dist/packem_shared/ai-cache-DoiF80AR.js +0 -1
  87. package/dist/packem_shared/cache-directory-CwHlJhgx.js +0 -1
  88. package/dist/packem_shared/dependency-scan-COr5n63B.js +0 -2
  89. package/dist/packem_shared/docker-D6OGr5_S.js +0 -2
  90. package/dist/packem_shared/failure-log-iUVLf6ts.js +0 -2
  91. package/dist/packem_shared/flakiness-D9wf0t56.js +0 -1
  92. package/dist/packem_shared/otel-DxDUPJJH.js +0 -6
  93. package/dist/packem_shared/otelPlugin-CQq6poq8.js +0 -1
  94. package/dist/packem_shared/registry-CkubDdiY.js +0 -2
  95. package/dist/packem_shared/run-summary-utils-BfBvjzhY.js +0 -1
  96. package/dist/packem_shared/runtime-check-BXZ43CBW.js +0 -1
  97. package/dist/packem_shared/selectors-BylODRiM.js +0 -3
  98. package/dist/packem_shared/toolchain-BgBOUHII.js +0 -5
  99. package/dist/packem_shared/typosquats-CcZl99B1.js +0 -1
  100. package/dist/packem_shared/verify-Baj5mFJ7.js +0 -1
@@ -1,7 +1,7 @@
1
- var z=Object.defineProperty;var v=(e,t)=>z(e,"name",{value:t,configurable:!0});import{walkSync as H,readFileSync as k}from"@visulima/fs";import{readYamlSync as X}from"@visulima/fs/yaml";import{relative as M,join as N}from"@visulima/path";import{p as Z,ao as ee}from"./bin.js";import{constantCase as te,trainCase as ne,snakeCase as re,pascalCase as ie,kebabCase as se,camelCase as ae}from"@visulima/string/case";var oe=Object.defineProperty,d=v((e,t)=>oe(e,"name",{value:t,configurable:!0}),"e");const h=d(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),S={camel_case:d(e=>ae(h(e)),"camel_case"),kebab_case:d(e=>se(h(e)),"kebab_case"),lower_case:d(e=>h(e).toLowerCase(),"lower_case"),pascal_case:d(e=>ie(h(e)),"pascal_case"),path_join:d((e,...t)=>{const r=[h(e),...t.map(n=>h(n))];return N(...r)},"path_join"),path_relative:d((e,t)=>M(h(t),h(e)),"path_relative"),snake_case:d(e=>re(h(e)),"snake_case"),upper_case:d(e=>h(e).toUpperCase(),"upper_case"),upper_kebab_case:d(e=>ne(h(e)),"upper_kebab_case"),upper_snake_case:d(e=>te(h(e)),"upper_snake_case")};d(e=>Object.hasOwn(S,e),"isKnownFilter");const R=d((e,t,r=[])=>{const n=S[e];if(!n)throw new Error(`Unknown filter "${e}". Known filters: ${Object.keys(S).sort().join(", ")}.`);return n(t,...r)},"applyFilter");var le=Object.defineProperty,I=v((e,t)=>le(e,"name",{value:t,configurable:!0}),"d$1");const L=I(e=>{const t=[];let r=0,n=0,i,s=-1;for(const a of e){if(s+=1,i){a===i&&(i=void 0);continue}if(a==='"'||a==="'"){i=a;continue}a==="("?r+=1:a===")"?r-=1:a===","&&r===0&&(t.push(e.slice(n,s)),n=s+1)}return t.push(e.slice(n)),t},"splitCommaOutsideQuotes"),ce=I(e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},"stripQuotes");var fe=Object.defineProperty,$=v((e,t)=>fe(e,"name",{value:t,configurable:!0}),"s$1");const ue=/\[([^\]]+)\]/g,pe=$(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(),i=t.slice(r+1,-1).trim();return i===""?{args:[],name:n}:{args:L(i).map(s=>{const a=s.trim();return ce(a)??a}),name:n}},"parseFilterCall"),me=$(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=>pe(n)),name:r}},"parsePipe"),de=$(e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),"stringify"),he=$((e,t)=>{const r=e.replaceAll(ue,(n,i)=>{const{filters:s,name:a}=me(i);if(!Object.hasOwn(t,a))throw new Error(`Variable "${a}" used in filename "${e}" but not defined`);let o=t[a];for(const l of s)o=R(l.name,o,l.args);return de(o)});return q(r)},"interpolateFilename"),q=$(e=>e.split("/").map(t=>t.endsWith(".tera")||t.endsWith(".twig")?t.slice(0,-5):t).join("/"),"stripTeraSuffix"),ye=$(e=>e.endsWith(".raw")?e.slice(0,-4):e,"stripRawSuffix"),ge=$(e=>{const t=e.split("/");return(t.at(-1)??"").startsWith("_")?!0:t.slice(0,-1).includes("partials")},"isPartialPath");var be=Object.defineProperty,we=v((e,t)=>be(e,"name",{value:t,configurable:!0}),"i");const ve=we((e,t)=>{if(!e.startsWith(`---
1
+ var Te=Object.defineProperty;var w=(e,t)=>Te(e,"name",{value:t,configurable:!0});import{createRequire as ze}from"node:module";import{walkSync as Be,readFileSync as I}from"@visulima/fs";import{readYamlSync as Ie}from"@visulima/fs/yaml";import{z as he,M as me}from"../packem_shared/index-OlP7U_t5.js";import{p as Ne,aN as qe}from"./bin.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}|(?![#*\d](?!\uFE0F?\u20E3))${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(`---
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
- `&&(n+=1);const i=e.startsWith(`---\r
6
- `)?5:4,s=e.slice(i,r).replaceAll("\r","");let a;try{a=t(s)}catch(o){const l=o instanceof Error?o.message:String(o);throw new Error(`Failed to parse frontmatter YAML: ${l}`,{cause:o})}if(a==null)return{body:e.slice(n)};if(typeof a!="object"||Array.isArray(a))throw new TypeError(`Frontmatter must be a YAML mapping, got ${Array.isArray(a)?"array":typeof a}`);return{body:e.slice(n),frontmatter:a}},"splitFrontmatter");var $e=Object.defineProperty,f=v((e,t)=>$e(e,"name",{value:t,configurable:!0}),"c");const xe=/\{\{-?(.+?)-?\}\}|\{%-?(.+?)-?%\}/gs,U=f(e=>{const t=[];let r=0,n=1;const i=f(s=>{for(const a of s)a===`
7
- `&&(n+=1)},"advanceLine");for(const s of e.matchAll(xe)){const a=s.index??0;if(a>r){const c=e.slice(r,a);t.push({line:n,type:"text",value:c}),i(c)}const o=n,l=s[0];l.startsWith("{{")?t.push({line:o,type:"expr",value:(s[1]??"").trim()}):t.push({line:o,type:"stmt",value:(s[2]??"").trim()}),i(l),r=a+l.length}if(r<e.length){const s=e.slice(r);t.push({line:n,type:"text",value:s})}return t},"tokenize"),Ee=new Set(["block","endblock","endfilter","endmacro","extends","filter","import","macro","set"]),Q=f((e,t)=>{let r=0;const n=f((s,a)=>{throw new Error(`${t}:${s}: ${a}`)},"error"),i=f(s=>{const a=[];for(;r<e.length;){const o=e[r];if(o.type==="text"){a.push({type:"text",value:o.value}),r+=1;continue}if(o.type==="expr"){a.push({expression:o.value,line:o.line,type:"expr"}),r+=1;continue}const l=o.value.split(/\s+/)[0]??"";if(s.includes(l))return a;if(Ee.has(l)&&n(o.line,`Tera feature "{% ${l} %}" is not supported. Supported: if/else/endif, for/endfor, include. Rewrite the template to avoid macros, set, extends, block, and import.`),l==="if"){r+=1;const c=o.value.slice(2).trim(),m=i(["else","endif"]);let u;r<e.length&&e[r].type==="stmt"&&e[r].value.split(/\s+/)[0]==="else"&&(r+=1,u=i(["endif"])),(r>=e.length||e[r].type!=="stmt"||e[r].value.split(/\s+/)[0]!=="endif")&&n(o.line,"Unterminated {% if %} — missing {% endif %}"),r+=1,a.push({alternate:u,condition:c,consequent:m,line:o.line,type:"if"});continue}if(l==="for"){r+=1;const c=o.value.slice(3).trim(),m=c.indexOf(" in ");m===-1&&n(o.line,"Malformed {% for %} — expected `for <name> in <collection>`");const u=c.slice(0,m).trim(),g=c.slice(m+4).trim();(!u||!g)&&n(o.line,"Malformed {% for %} — missing binding or collection");const p=i(["endfor"]);(r>=e.length||e[r].type!=="stmt"||e[r].value.split(/\s+/)[0]!=="endfor")&&n(o.line,"Unterminated {% for %} — missing {% endfor %}"),r+=1,a.push({binding:u,body:p,collection:g,line:o.line,type:"for"});continue}if(l==="include"){r+=1;const c=o.value.slice(7).trim(),m=G(c);m===void 0&&n(o.line,"Malformed {% include %} — expected a quoted partial name"),a.push({line:o.line,name:m,type:"include"});continue}n(o.line,`Unknown tag "{% ${l} %}". Supported: if, for, include.`)}return a},"parseBlock");return i([])},"parse"),G=f(e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},"stripQuotes"),Oe=f(e=>e==null?"":typeof e=="boolean"||typeof e=="number"?String(e):typeof e=="string"?e:JSON.stringify(e),"stringify"),ke=f(e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:!0,"isTruthy"),V=f((e,t,r,n,i=!0)=>{const s=e.split(".");if(i&&s.length>0&&!Object.hasOwn(t,s[0]))throw new Error(`${n}:${r}: Variable "${e}" is not defined`);let a=t;for(const o of s){if(a==null)return;if(typeof a!="object")throw new TypeError(`${n}:${r}: Cannot read "${o}" on non-object value`);a=a[o]}return a},"lookupVariable"),je=f(e=>{const t=[];let r=0,n=0,i;for(let s=0;s<e.length;s+=1){const a=e[s];if(i){a===i&&(i=void 0);continue}if(a==='"'||a==="'"){i=a;continue}a==="("?r+=1:a===")"?r-=1:a==="|"&&r===0&&(t.push(e.slice(n,s)),n=s+1)}return t.push(e.slice(n)),t},"splitFilterPipe"),Se=f(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(),i=t.slice(r+1,-1).trim();return i?{args:L(i).map(s=>s.trim()),name:n}:{args:[],name:n}},"parseFilterCall"),j=f((e,t,r,n,i=!0)=>{const s=e.trim();if(s==="true")return!0;if(s==="false")return!1;if(s==="null"||s==="none")return null;const a=G(s);return a!==void 0?a:/^-?\d+(?:\.\d+)?$/.test(s)?Number(s):V(s,t,r,n,i)},"evaluatePrimary"),B=f((e,t,r,n,i=!0)=>{const s=je(e),a=s[0].trim();let o=j(a,t,r,n,i);for(let l=1;l<s.length;l+=1){const c=s[l].trim(),{args:m,name:u}=Se(c),g=m.map(p=>j(p,t,r,n,i));try{o=R(u,o,g)}catch(p){const w=p instanceof Error?p.message:String(p);throw new Error(`${n}:${r}: ${w}`,{cause:p})}}return o},"evaluateExpression"),D=f((e,t)=>{let r,n=0;for(let i=0;i<=e.length-t.length;i+=1){const s=e[i];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(i,i+t.length)===t)return i}return-1},"findOperatorOutsideQuotes"),A=f((e,t)=>{const r=[];let n=0,i=0;for(;i<=e.length-t.length;){const s=D(e.slice(i),t);if(s===-1)break;r.push(e.slice(n,i+s)),i+=s+t.length,n=i}return r.push(e.slice(n)),r},"splitLogical"),x=f((e,t,r,n)=>{const i=e.trim();if(i==="")return!1;if(i.startsWith("(")&&i.endsWith(")")&&Ce(i)===i.length-1)return x(i.slice(1,-1),t,r,n);const s=A(i," or ");if(s.length>1)return s.some(o=>x(o,t,r,n));const a=A(i," and ");if(a.length>1)return a.every(o=>x(o,t,r,n));if(i.startsWith("not "))return!x(i.slice(4),t,r,n);for(const o of["==","!="]){const l=D(i,o);if(l!==-1){const c=j(i.slice(0,l),t,n,r,!1),m=j(i.slice(l+o.length),t,n,r,!1),u=c===m;return o==="=="?u:!u}}return ke(B(i,t,n,r,!1))},"evaluateConditionExpression"),Ce=f(e=>{if(e[0]!=="(")return-1;let t=0,r,n=-1;for(const i of e){if(n+=1,r){i===r&&(r=void 0);continue}if(i==='"'||i==="'"){r=i;continue}if(i==="(")t+=1;else if(i===")"&&(t-=1,t===0))return n}return-1},"matchingParen"),E=f((e,t)=>{let r="";for(const n of e){if(n.type==="text"){r+=n.value;continue}if(n.type==="expr"){r+=Oe(B(n.expression,t.scope,n.line,t.filename));continue}if(n.type==="if"){const i=x(n.condition,t.scope,t.filename,n.line)?n.consequent:n.alternate??[];r+=E(i,t);continue}if(n.type==="for"){const i=V(n.collection,t.scope,n.line,t.filename,!1);if(i==null)continue;if(!Array.isArray(i))throw new TypeError(`${t.filename}:${n.line}: {% for %} expected an array, got ${typeof i}`);for(const s of i){const a={...t.scope,[n.binding]:s};r+=E(n.body,{...t,scope:a})}continue}if(n.type==="include"){const i=t.partials?.get(n.name);if(!i)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 a=[...s,n.name].join(" → ");throw new Error(`${t.filename}:${n.line}: Circular partial include detected: ${a}`)}s.add(n.name);try{r+=E(i,{...t,filename:`<partial:${n.name}>`,includeStack:s})}finally{s.delete(n.name)}}}return r},"renderNodes"),_e=f((e,t)=>Q(U(e),t),"parseTemplate");f((e,t)=>E(e,t),"renderAst");const C=f((e,t)=>E(Q(U(e),t.filename),t),"renderTemplate");var Te=Object.defineProperty,y=v((e,t)=>Te(e,"name",{value:t,configurable:!0}),"s");const P="template.yml",We=".raw",Ae=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"]),Pe=new Set(["Brewfile","CHANGELOG","CODEOWNERS","CONTRIBUTING","COPYING","Dockerfile","Gemfile","LICENCE","LICENSE","Makefile","NOTICE","Procfile","Rakefile","README","VERSION"]),Fe=y(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"),Y=y(e=>{const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)},"basename"),Me=y(e=>{const t=Fe(e);if(t!=="")return Ae.has(t);const r=Y(e);return Pe.has(r)},"isLikelyText"),Ne=y(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"),Re=y(e=>e.replaceAll("\\","/").replace(/^\.\//,"").replaceAll(/\/+/g,"/"),"normalizeDestinationPath"),Ie=y((e,t,r)=>{const n=t.split("/").filter(Boolean);if(n.length===0)throw new Error("Empty destination path for value");let i=e;for(let s=0;s<n.length-1;s+=1){const a=n[s],o=i[a];if(o===void 0){const l={};i[a]=l,i=l}else if(typeof o=="object"&&!Buffer.isBuffer(o))i=o;else throw new TypeError(`Path conflict: "${n.slice(0,s+1).join("/")}" is both a file and a directory`)}i[n.at(-1)]=r},"flattenFiles"),F=y((e,t,r)=>{if(typeof e!="string")return Le(e);const n=e.includes("{{")||e.includes("{%")?C(e,{filename:`${r}#frontmatter`,scope:t}):e;return x(n,t,`${r}#frontmatter`,1)},"evaluateGate"),Le=y(e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:typeof e=="string"?e!=="false"&&e!=="0":!0,"truthyValue"),Ye=y((e,t)=>{const r=N(e,P),n=X(r);if(!n||typeof n!="object")throw new Error(`${r}: must contain a YAML mapping`);const i={};if(n.variables)for(const[l,c]of Object.entries(n.variables))i[l]=Ne(c);const s=new Map,a=[];for(const l of H(e,{includeDirs:!1,includeSymlinks:!1})){if(l.path===r)continue;const c=M(e,l.path).replaceAll("\\","/");if(c===P)continue;if(ge(c)){const u=k(l.path),g=_e(u,c);for(const p of qe(c))s.has(p)&&s.get(p)!==g&&Z.warn(`partial name "${p}" is declared by multiple files — last one wins. Use distinct names or fully-qualified includes.`),s.set(p,g);continue}if(c.endsWith(We)){const u=k(l.path);a.push({binary:null,isRaw:!0,rawText:u,relativePath:c});continue}if(Me(c)){const u=k(l.path);a.push({binary:null,isRaw:!1,rawText:u,relativePath:c});continue}const m=k(l.path,{buffer:!0});a.push({binary:m,isRaw:!1,rawText:null,relativePath:c})}const o=y(l=>{const c={...l.builtins,...l.options},m={},u={};for(const p of a){const w=p.relativePath;let O,_,T=!1;if(p.binary)O=p.binary;else if(p.isRaw)O=p.rawText??"";else{const J=p.rawText??"",b=ve(J,K=>ee(K));if(b.frontmatter){if(b.frontmatter.skip!==void 0&&F(b.frontmatter.skip,c,w)||b.frontmatter.if!==void 0&&!F(b.frontmatter.if,c,w))continue;typeof b.frontmatter.to=="string"&&(_=C(b.frontmatter.to,{filename:`${w}#frontmatter.to`,partials:s,scope:c})),b.frontmatter.force===!0&&(T=!0)}O=C(b.body,{filename:w,partials:s,scope:c})}const W=Re(_??he(ye(w),c));Ie(m,W,O),T&&(u[W]={force:!0})}const g={files:m};return Object.keys(u).length>0&&(g.filesMeta=u),g},"produce");return{about:{description:n.description??`Moon-format template at ${e}`,name:n.title??t},destination:n.destination,options:i,produce:o}},"loadMoonTemplate"),qe=y(e=>{const t=q(e),r=Y(t),n=new Set([r,t]);if(r.startsWith("_")){n.add(r.replace(/^_+/,""));const i=t.slice(0,t.length-r.length);n.add(`${i}${r.replace(/^_+/,"")}`)}return[...n]},"partialKeys");export{Ye as loadMoonTemplate};
5
+ `&&(n+=1);const a=e.startsWith(`---\r
6
+ `)?5:4,i=e.slice(a,r).replaceAll("\r","");let l;try{l=t(i)}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 xn=Object.defineProperty,j=w((e,t)=>xn(e,"name",{value:t,configurable:!0}),"c");const Cn=/\{\{-?(.+?)-?\}\}|\{%-?(.+?)-?%\}/gs,Se=j(e=>{const t=[];let r=0,n=1;const a=j(i=>{for(const l of i)l===`
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"),Zn=C((e,t)=>{const r=me(e,pe),n=Ie(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 Be(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{Zn as loadMoonTemplate};
@@ -1 +1 @@
1
- var n=Object.defineProperty;var o=(t,e)=>n(t,"name",{value:e,configurable:!0});import{dirname as u}from"@visulima/path";import{createJiti as l}from"jiti";var i=Object.defineProperty,a=o((t,e)=>i(t,"name",{value:e,configurable:!0}),"r");const p=a((t,e)=>{if(!e||typeof e!="object")throw new TypeError(`${t}: default export must be an object (got ${e===null?"null":typeof e}). Use createTemplate({ ... }).`);const r=e;if(typeof r.about!="object"||r.about===null)throw new TypeError(`${t}: default export missing required "about" object`);if(typeof r.produce!="function")throw new TypeError(`${t}: default export missing required "produce" function`);return e},"validateTemplateExport"),d=a(async t=>{const e=await l(u(t),{fsCache:!1,moduleCache:!1}).import(t,{default:!0,try:!0})??null;return p(t,e)},"loadNativeTemplate");export{d as loadNativeTemplate};
1
+ var u=Object.defineProperty;var o=(t,e)=>u(t,"name",{value:e,configurable:!0});import{K as n}from"../packem_shared/index-OlP7U_t5.js";import{createJiti as l}from"jiti";var p=Object.defineProperty,a=o((t,e)=>p(t,"name",{value:e,configurable:!0}),"r");const i=a((t,e)=>{if(!e||typeof e!="object")throw new TypeError(`${t}: default export must be an object (got ${e===null?"null":typeof e}). Use createTemplate({ ... }).`);const r=e;if(typeof r.about!="object"||r.about===null)throw new TypeError(`${t}: default export missing required "about" object`);if(typeof r.produce!="function")throw new TypeError(`${t}: default export missing required "produce" function`);return e},"validateTemplateExport"),s=a(async t=>{const e=await l(n(t),{fsCache:!1,moduleCache:!1}).import(t,{default:!0,try:!0})??null;return i(t,e)},"loadNativeTemplate");export{s as loadNativeTemplate};
@@ -1,3 +1,3 @@
1
- var lr=Object.defineProperty;var f=(e,t)=>lr(e,"name",{value:t,configurable:!0});import{createRequire as dr}from"node:module";import{p as fr}from"../packem_shared/giget-CcEy_Elm.js";const ur=dr(import.meta.url),Me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,N=f(e=>{if(typeof Me<"u"&&Me.versions&&Me.versions.node){const[t,i]=Me.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return Me.getBuiltinModule(e)}return ur(e)},"__cjs_getBuiltinModule"),d=N("node:fs"),cr=N("node:fs/promises"),As=N("node:stream"),p=N("node:path"),{posix:ve,basename:mr,join:Ds,win32:pr}=p,Ns=N("events"),{EventEmitter:yr}=Ns,b=N("fs"),{EventEmitter:Pi}=N("node:events"),{StringDecoder:br}=N("node:string_decoder"),rt=N("path"),{parse:Er,dirname:gr}=rt,pi=N("assert"),{Buffer:we}=N("buffer"),Xi=N("zlib"),qi={...Xi,default:Xi},wr=N("zlib"),Rr=N("node:assert"),{randomBytes:Is}=N("node:crypto");var _r=Object.defineProperty,o=f((e,t)=>_r(e,"name",{value:t,configurable:!0}),"o"),rn=fr({Header:o(()=>le,"Header"),Pack:o(()=>ot,"Pack"),PackJob:o(()=>ki,"PackJob"),PackSync:o(()=>Ut,"PackSync"),Parser:o(()=>Ie,"Parser"),Pax:o(()=>ht,"Pax"),ReadEntry:o(()=>Zi,"ReadEntry"),Unpack:o(()=>Ft,"Unpack"),UnpackSync:o(()=>Mi,"UnpackSync"),WriteEntry:o(()=>Yi,"WriteEntry"),WriteEntrySync:o(()=>Gs,"WriteEntrySync"),WriteEntryTar:o(()=>$s,"WriteEntryTar"),c:o(()=>bs,"c"),create:o(()=>bs,"create"),extract:o(()=>xs,"extract"),filesFilter:o(()=>Wi,"filesFilter"),list:o(()=>Ce,"list"),r:o(()=>ge,"r"),replace:o(()=>ge,"replace"),t:o(()=>Ce,"t"),types:o(()=>js,"types"),x:o(()=>xs,"x")}),Sr=Object.defineProperty,vr=o((e,t)=>{for(var i in t)Sr(e,i,{get:t[i],enumerable:!0})},"ue"),Ji=process||{stdout:null,stderr:null},Or=o(e=>!!e&&typeof e=="object"&&(e instanceof Se||e instanceof As||Tr(e)||kr(e)),"fe"),Tr=o(e=>!!e&&typeof e=="object"&&e instanceof Pi&&typeof e.pipe=="function"&&e.pipe!==As.Writable.prototype.pipe,"pe"),kr=o(e=>!!e&&typeof e=="object"&&e instanceof Pi&&typeof e.write=="function"&&typeof e.end=="function","me"),$=Symbol("EOF"),Y=Symbol("maybeEmitEnd"),J=Symbol("emittedEnd"),at=Symbol("emittingEnd"),Pe=Symbol("emittedError"),lt=Symbol("closed"),Qi=Symbol("read"),dt=Symbol("flush"),es=Symbol("flushChunk"),C=Symbol("encoding"),Oe=Symbol("decoder"),v=Symbol("flowing"),ze=Symbol("paused"),xe=Symbol("resume"),O=Symbol("buffer"),D=Symbol("pipes"),T=Symbol("bufferLength"),Ht=Symbol("bufferPush"),ut=Symbol("bufferShift"),A=Symbol("objectMode"),R=Symbol("destroyed"),Zt=Symbol("error"),Wt=Symbol("emitData"),ts=Symbol("emitEnd"),Gt=Symbol("emitEnd2"),j=Symbol("async"),$t=Symbol("abort"),ft=Symbol("aborted"),Ue=Symbol("signal"),de=Symbol("dataListeners"),I=Symbol("discarded"),je=o(e=>Promise.resolve().then(e),"Pe"),Lr=o(e=>e(),"Fe"),xr=o(e=>e==="end"||e==="finish"||e==="prefinish","Ie"),Ar=o(e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,"Le"),Dr=o(e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),"Re"),Bs=class{static{f(this,"As")}static{o(this,"ze")}src;dest;opts;ondrain;constructor(e,t,i){this.src=e,this.dest=t,this.opts=i,this.ondrain=()=>e[xe](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Nr=class extends Bs{static{f(this,"Sr")}static{o(this,"Be")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,i){super(e,t,i),this.proxyErrors=s=>this.dest.emit("error",s),e.on("error",this.proxyErrors)}},Ir=o(e=>!!e.objectMode,"Ve"),Br=o(e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer","He"),Se=class extends Pi{static{f(this,"Rt")}static{o(this,"Ue")}[v]=!1;[ze]=!1;[D]=[];[O]=[];[A];[C];[j];[Oe];[$]=!1;[J]=!1;[at]=!1;[lt]=!1;[Pe]=null;[T]=0;[R]=!1;[Ue];[ft]=!1;[de]=0;[I]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw TypeError("Encoding and objectMode may not be used together");Ir(t)?(this[A]=!0,this[C]=null):Br(t)?(this[C]=t.encoding,this[A]=!1):(this[A]=!1,this[C]=null),this[j]=!!t.async,this[Oe]=this[C]?new br(this[C]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[O],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[D],"get")});let{signal:i}=t;i&&(this[Ue]=i,i.aborted?this[$t]():i.addEventListener("abort",()=>this[$t]()))}get bufferLength(){return this[T]}get encoding(){return this[C]}set encoding(e){throw Error("Encoding must be set at instantiation time")}setEncoding(e){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[A]}set objectMode(e){throw Error("objectMode must be set at instantiation time")}get async(){return this[j]}set async(e){this[j]=this[j]||!!e}[$t](){this[ft]=!0,this.emit("abort",this[Ue]?.reason),this.destroy(this[Ue]?.reason)}get aborted(){return this[ft]}set aborted(e){}write(e,t,i){if(this[ft])return!1;if(this[$])throw Error("write after end");if(this[R])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(i=t,t="utf8"),t||="utf8";let s=this[j]?je:Lr;if(!this[A]&&!Buffer.isBuffer(e)){if(Dr(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Ar(e))e=Buffer.from(e);else if(typeof e!="string")throw Error("Non-contiguous data written to non-objectMode stream")}return this[A]?(this[v]&&this[T]!==0&&this[dt](!0),this[v]?this.emit("data",e):this[Ht](e),this[T]!==0&&this.emit("readable"),i&&s(i),this[v]):e.length?(typeof e=="string"&&!(t===this[C]&&!this[Oe]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[C]&&(e=this[Oe].write(e)),this[v]&&this[T]!==0&&this[dt](!0),this[v]?this.emit("data",e):this[Ht](e),this[T]!==0&&this.emit("readable"),i&&s(i),this[v]):(this[T]!==0&&this.emit("readable"),i&&s(i),this[v])}read(e){if(this[R])return null;if(this[I]=!1,this[T]===0||e===0||e&&e>this[T])return this[Y](),null;this[A]&&(e=null),this[O].length>1&&!this[A]&&(this[O]=[this[C]?this[O].join(""):Buffer.concat(this[O],this[T])]);let t=this[Qi](e||null,this[O][0]);return this[Y](),t}[Qi](e,t){if(this[A])this[ut]();else{let i=t;e===i.length||e===null?this[ut]():typeof i=="string"?(this[O][0]=i.slice(e),t=i.slice(0,e),this[T]-=e):(this[O][0]=i.subarray(e),t=i.subarray(0,e),this[T]-=e)}return this.emit("data",t),!this[O].length&&!this[$]&&this.emit("drain"),t}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t="utf8"),e!==void 0&&this.write(e,t),i&&this.once("end",i),this[$]=!0,this.writable=!1,(this[v]||!this[ze])&&this[Y](),this}[xe](){this[R]||(!this[de]&&!this[D].length&&(this[I]=!0),this[ze]=!1,this[v]=!0,this.emit("resume"),this[O].length?this[dt]():this[$]?this[Y]():this.emit("drain"))}resume(){return this[xe]()}pause(){this[v]=!1,this[ze]=!0,this[I]=!1}get destroyed(){return this[R]}get flowing(){return this[v]}get paused(){return this[ze]}[Ht](e){this[A]?this[T]+=1:this[T]+=e.length,this[O].push(e)}[ut](){return this[A]?--this[T]:this[T]-=this[O][0].length,this[O].shift()}[dt](e=!1){do;while(this[es](this[ut]())&&this[O].length);!e&&!this[O].length&&!this[$]&&this.emit("drain")}[es](e){return this.emit("data",e),this[v]}pipe(e,t){if(this[R])return e;this[I]=!1;let i=this[J];return t||={},e===Ji.stdout||e===Ji.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,i?t.end&&e.end():(this[D].push(t.proxyErrors?new Nr(this,e,t):new Bs(this,e,t)),this[j]?je(()=>this[xe]()):this[xe]()),e}unpipe(e){let t=this[D].find(i=>i.dest===e);t&&(this[D].length===1?(this[v]&&this[de]===0&&(this[v]=!1),this[D]=[]):this[D].splice(this[D].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let i=super.on(e,t);if(e==="data")this[I]=!1,this[de]++,!this[D].length&&!this[v]&&this[xe]();else if(e==="readable"&&this[T]!==0)super.emit("readable");else if(xr(e)&&this[J])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Pe]){let s=t;this[j]?je(()=>s.call(this,this[Pe])):s.call(this,this[Pe])}return i}removeListener(e,t){return this.off(e,t)}off(e,t){let i=super.off(e,t);return e==="data"&&(this[de]=this.listeners("data").length,this[de]===0&&!this[I]&&!this[D].length&&(this[v]=!1)),i}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[de]=0,!this[I]&&!this[D].length&&(this[v]=!1)),t}get emittedEnd(){return this[J]}[Y](){!this[at]&&!this[J]&&!this[R]&&this[O].length===0&&this[$]&&(this[at]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[lt]&&this.emit("close"),this[at]=!1)}emit(e,...t){let i=t[0];if(e!=="error"&&e!=="close"&&e!==R&&this[R])return!1;if(e==="data")return!this[A]&&!i?!1:this[j]?(je(()=>this[Wt](i)),!0):this[Wt](i);if(e==="end")return this[ts]();if(e==="close"){if(this[lt]=!0,!this[J]&&!this[R])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(e==="error"){this[Pe]=i,super.emit(Zt,i);let r=!this[Ue]||this.listeners("error").length?super.emit("error",i):!1;return this[Y](),r}else if(e==="resume"){let r=super.emit("resume");return this[Y](),r}else if(e==="finish"||e==="prefinish"){let r=super.emit(e);return this.removeAllListeners(e),r}let s=super.emit(e,...t);return this[Y](),s}[Wt](e){for(let i of this[D])i.dest.write(e)===!1&&this.pause();let t=this[I]?!1:super.emit("data",e);return this[Y](),t}[ts](){return this[J]?!1:(this[J]=!0,this.readable=!1,this[j]?(je(()=>this[Gt]()),!0):this[Gt]())}[Gt](){if(this[Oe]){let t=this[Oe].end();if(t){for(let i of this[D])i.dest.write(t);this[I]||super.emit("data",t)}}for(let t of this[D])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[A]||(e.dataLength=0);let t=this.promise();return this.on("data",i=>{e.push(i),this[A]||(e.dataLength+=i.length)}),await t,e}async concat(){if(this[A])throw Error("cannot concat in objectMode");let e=await this.collect();return this[C]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(R,()=>t(Error("stream destroyed"))),this.on("error",i=>t(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[I]=!1;let e=!1,t=o(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"t");return{next:o(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[$])return t();let s,r,h=o(u=>{this.off("data",n),this.off("end",a),this.off(R,l),t(),r(u)},"a"),n=o(u=>{this.off("error",h),this.off("end",a),this.off(R,l),this.pause(),s({value:u,done:!!this[$]})},"o"),a=o(()=>{this.off("error",h),this.off("data",n),this.off(R,l),t(),s({done:!0,value:void 0})},"s"),l=o(()=>h(Error("stream destroyed")),"c");return new Promise((u,m)=>{r=m,s=u,this.once(R,l),this.once("error",h),this.once("end",a),this.once("data",n)})},"next"),throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[I]=!1;let e=!1,t=o(()=>(this.pause(),this.off(Zt,t),this.off(R,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"t");return this.once("end",t),this.once(Zt,t),this.once(R,t),{next:o(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next"),throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[R])return e?this.emit("error",e):this.emit(R),this;this[R]=!0,this[I]=!0,this[O].length=0,this[T]=0;let t=this;return typeof t.close=="function"&&!this[lt]&&t.close(),e?this.emit("error",e):this.emit(R),this}static get isStream(){return Or}},Fr=b.writev,oe=Symbol("_autoClose"),U=Symbol("_close"),He=Symbol("_ended"),y=Symbol("_fd"),Yt=Symbol("_finished"),q=Symbol("_flags"),Vt=Symbol("_flush"),yi=Symbol("_handleChunk"),bi=Symbol("_makeBuf"),qe=Symbol("_mode"),ct=Symbol("_needDrain"),Be=Symbol("_onerror"),Fe=Symbol("_onopen"),Kt=Symbol("_onread"),Ae=Symbol("_onwrite"),ae=Symbol("_open"),z=Symbol("_path"),ie=Symbol("_pos"),H=Symbol("_queue"),De=Symbol("_read"),Xt=Symbol("_readSize"),X=Symbol("_reading"),Ze=Symbol("_remain"),qt=Symbol("_size"),_t=Symbol("_write"),ue=Symbol("_writing"),St=Symbol("_defaultFlag"),Re=Symbol("_errored"),zi=class extends Se{static{f(this,"Ce")}static{o(this,"dt")}[Re]=!1;[y];[z];[Xt];[X]=!1;[qt];[Ze];[oe];constructor(e,t){if(t||={},super(t),this.readable=!0,this.writable=!1,typeof e!="string")throw TypeError("path must be a string");this[Re]=!1,this[y]=typeof t.fd=="number"?t.fd:void 0,this[z]=e,this[Xt]=t.readSize||16*1024*1024,this[X]=!1,this[qt]=typeof t.size=="number"?t.size:1/0,this[Ze]=this[qt],this[oe]=typeof t.autoClose=="boolean"?t.autoClose:!0,typeof this[y]=="number"?this[De]():this[ae]()}get fd(){return this[y]}get path(){return this[z]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[ae](){b.open(this[z],"r",(e,t)=>this[Fe](e,t))}[Fe](e,t){e?this[Be](e):(this[y]=t,this.emit("open",t),this[De]())}[bi](){return Buffer.allocUnsafe(Math.min(this[Xt],this[Ze]))}[De](){if(!this[X]){this[X]=!0;let e=this[bi]();if(e.length===0)return process.nextTick(()=>this[Kt](null,0,e));b.read(this[y],e,0,e.length,null,(t,i,s)=>this[Kt](t,i,s))}}[Kt](e,t,i){this[X]=!1,e?this[Be](e):this[yi](t,i)&&this[De]()}[U](){if(this[oe]&&typeof this[y]=="number"){let e=this[y];this[y]=void 0,b.close(e,t=>t?this.emit("error",t):this.emit("close"))}}[Be](e){this[X]=!0,this[U](),this.emit("error",e)}[yi](e,t){let i=!1;return this[Ze]-=e,e>0&&(i=super.write(e<t.length?t.subarray(0,e):t)),(e===0||this[Ze]<=0)&&(i=!1,this[U](),super.end()),i}emit(e,...t){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[y]=="number"&&this[De](),!1;case"error":return this[Re]?!1:(this[Re]=!0,super.emit(e,...t));default:return super.emit(e,...t)}}},Cr=class extends zi{static{f(this,"kr")}static{o(this,"ft")}[ae](){let e=!0;try{this[Fe](null,b.openSync(this[z],"r")),e=!1}finally{e&&this[U]()}}[De](){let e=!0;try{if(!this[X]){this[X]=!0;do{let t=this[bi](),i=t.length===0?0:b.readSync(this[y],t,0,t.length,null);if(!this[yi](i,t))break}while(!0);this[X]=!1}e=!1}finally{e&&this[U]()}}[U](){if(this[oe]&&typeof this[y]=="number"){let e=this[y];this[y]=void 0,b.closeSync(e),this.emit("close")}}},Ct=class extends Ns{static{f(this,"Ii")}static{o(this,"pt")}readable=!1;writable=!0;[Re]=!1;[ue]=!1;[He]=!1;[H]=[];[ct]=!1;[z];[qe];[oe];[y];[St];[q];[Yt]=!1;[ie];constructor(e,t){t||={},super(t),this[z]=e,this[y]=typeof t.fd=="number"?t.fd:void 0,this[qe]=t.mode===void 0?438:t.mode,this[ie]=typeof t.start=="number"?t.start:void 0,this[oe]=typeof t.autoClose=="boolean"?t.autoClose:!0;let i=this[ie]===void 0?"w":"r+";this[St]=t.flags===void 0,this[q]=t.flags===void 0?i:t.flags,this[y]===void 0&&this[ae]()}emit(e,...t){if(e==="error"){if(this[Re])return!1;this[Re]=!0}return super.emit(e,...t)}get fd(){return this[y]}get path(){return this[z]}[Be](e){this[U](),this[ue]=!0,this.emit("error",e)}[ae](){b.open(this[z],this[q],this[qe],(e,t)=>this[Fe](e,t))}[Fe](e,t){this[St]&&this[q]==="r+"&&e&&e.code==="ENOENT"?(this[q]="w",this[ae]()):e?this[Be](e):(this[y]=t,this.emit("open",t),this[ue]||this[Vt]())}end(e,t){return e&&this.write(e,t),this[He]=!0,!this[ue]&&!this[H].length&&typeof this[y]=="number"&&this[Ae](null,0),this}write(e,t){return typeof e=="string"&&(e=Buffer.from(e,t)),this[He]?(this.emit("error",Error("write() after end()")),!1):this[y]===void 0||this[ue]||this[H].length?(this[H].push(e),this[ct]=!0,!1):(this[ue]=!0,this[_t](e),!0)}[_t](e){b.write(this[y],e,0,e.length,this[ie],(t,i)=>this[Ae](t,i))}[Ae](e,t){e?this[Be](e):(this[ie]!==void 0&&typeof t=="number"&&(this[ie]+=t),this[H].length?this[Vt]():(this[ue]=!1,this[He]&&!this[Yt]?(this[Yt]=!0,this[U](),this.emit("finish")):this[ct]&&(this[ct]=!1,this.emit("drain"))))}[Vt](){if(this[H].length===0)this[He]&&this[Ae](null,0);else if(this[H].length===1)this[_t](this[H].pop());else{let e=this[H];this[H]=[],Fr(this[y],e,this[ie],(t,i)=>this[Ae](t,i))}}[U](){if(this[oe]&&typeof this[y]=="number"){let e=this[y];this[y]=void 0,b.close(e,t=>t?this.emit("error",t):this.emit("close"))}}},Fs=class extends Ct{static{f(this,"Ds")}static{o(this,"mt")}[ae](){let e;if(this[St]&&this[q]==="r+")try{e=b.openSync(this[z],this[q],this[qe])}catch(t){if(t?.code==="ENOENT")return this[q]="w",this[ae]();throw t}else e=b.openSync(this[z],this[q],this[qe]);this[Fe](null,e)}[U](){if(this[oe]&&typeof this[y]=="number"){let e=this[y];this[y]=void 0,b.closeSync(e),this.emit("close")}}[_t](e){let t=!0;try{this[Ae](null,b.writeSync(this[y],e,0,e.length,this[ie])),t=!1}finally{if(t)try{this[U]()}catch{}}}},Mr=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),Pr=o(e=>!!e.sync&&!!e.file,"gt"),zr=o(e=>!e.sync&&!!e.file,"_t"),Ur=o(e=>!!e.sync&&!e.file,"vt"),jr=o(e=>!e.sync&&!e.file,"yt"),Hr=o(e=>!!e.file,"bt"),Zr=o(e=>Mr.get(e)||e,"xt"),Ui=o((e={})=>{if(!e)return{};let t={};for(let[i,s]of Object.entries(e)){let r=Zr(i);t[r]=s}return t.chmod===void 0&&t.noChmod===!1&&(t.chmod=!0),delete t.noChmod,t},"St"),nt=o((e,t,i,s,r)=>Object.assign((h=[],n,a)=>{Array.isArray(h)&&(n=h,h={}),typeof n=="function"&&(a=n,n=void 0),n=n?Array.from(n):[];let l=Ui(h);if(r?.(l,n),Pr(l)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return e(l,n)}else if(zr(l)){let u=t(l,n);return a?u.then(()=>a(),a):u}else if(Ur(l)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return i(l,n)}else if(jr(l)){if(typeof a=="function")throw TypeError("callback only supported with file option");return s(l,n)}throw Error("impossible options??")},{syncFile:e,asyncFile:t,syncNoFile:i,asyncNoFile:s,validate:r}),"Ct"),Wr=wr.constants||{ZLIB_VERNUM:4736},G=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},Wr)),Gr=we.concat,is=Object.getOwnPropertyDescriptor(we,"concat"),$r=o(e=>e,"Dt"),Jt=is?.writable===!0||is?.set!==void 0?e=>{we.concat=e?$r:Gr}:e=>{},_e=Symbol("_superWrite"),mt=class extends Error{static{f(this,"di")}static{o(this,"At")}code;errno;constructor(e,t){super("zlib: "+e.message,{cause:e}),this.code=e.code,this.errno=e.errno,this.code||="ZLIB_ERROR",this.message="zlib: "+e.message,Error.captureStackTrace(this,t??this.constructor)}get name(){return"ZlibError"}},Qt=Symbol("flushFlag"),ji=class extends Se{static{f(this,"Pe")}static{o(this,"Mt")}#e=!1;#i=!1;#s;#h;#r;#t;#n;get sawError(){return this.#e}get handle(){return this.#t}get flushFlag(){return this.#s}constructor(e,t){if(!e||typeof e!="object")throw TypeError("invalid options for ZlibBase constructor");if(super(e),this.#s=e.flush??0,this.#h=e.finishFlush??0,this.#r=e.fullFlushFlag??0,typeof qi[t]!="function")throw TypeError("Compression method not supported: "+t);try{this.#t=new qi[t](e)}catch(i){throw new mt(i,this.constructor)}this.#n=i=>{this.#e||(this.#e=!0,this.close(),this.emit("error",i))},this.#t?.on("error",i=>this.#n(new mt(i))),this.once("end",()=>this.close)}close(){this.#t&&(this.#t.close(),this.#t=void 0,this.emit("close"))}reset(){if(!this.#e)return pi(this.#t,"zlib binding closed"),this.#t.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#r),this.write(Object.assign(we.alloc(0),{[Qt]:e})))}end(e,t,i){return typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),e&&(t?this.write(e,t):this.write(e)),this.flush(this.#h),this.#i=!0,super.end(i)}get ended(){return this.#i}[_e](e){return super.write(e)}write(e,t,i){if(typeof t=="function"&&(i=t,t="utf8"),typeof e=="string"&&(e=we.from(e,t)),this.#e)return;pi(this.#t,"zlib binding closed");let s=this.#t._handle,r=s.close;s.close=()=>{};let h=this.#t.close;this.#t.close=()=>{},Jt(!0);let n;try{let l=typeof e[Qt]=="number"?e[Qt]:this.#s;n=this.#t._processChunk(e,l),Jt(!1)}catch(l){Jt(!1),this.#n(new mt(l,this.write))}finally{this.#t&&(this.#t._handle=s,s.close=r,this.#t.close=h,this.#t.removeAllListeners("error"))}this.#t&&this.#t.on("error",l=>this.#n(new mt(l,this.write)));let a;if(n)if(Array.isArray(n)&&n.length>0){let l=n[0];a=this[_e](we.from(l));for(let u=1;u<n.length;u++)a=this[_e](n[u])}else a=this[_e](we.from(n));return i&&i(),a}},Cs=class extends ji{static{f(this,"xs")}static{o(this,"Nt")}#e;#i;constructor(e,t){e||={},e.flush=e.flush||G.Z_NO_FLUSH,e.finishFlush=e.finishFlush||G.Z_FINISH,e.fullFlushFlag=G.Z_FULL_FLUSH,super(e,t),this.#e=e.level,this.#i=e.strategy}params(e,t){if(!this.sawError){if(!this.handle)throw Error("cannot switch params when binding is closed");if(!this.handle.params)throw Error("not supported in this implementation");if(this.#e!==e||this.#i!==t){this.flush(G.Z_SYNC_FLUSH),pi(this.handle,"zlib binding closed");let i=this.handle.flush;this.handle.flush=(s,r)=>{typeof s=="function"&&(r=s,s=this.flushFlag),this.flush(s),r?.()};try{this.handle.params(e,t)}finally{this.handle.flush=i}this.handle&&(this.#e=e,this.#i=t)}}}},Yr=class extends Cs{static{f(this,"Pr")}static{o(this,"Pt")}#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[_e](e){return this.#e?(this.#e=!1,e[9]=255,super[_e](e)):super[_e](e)}},Vr=class extends Cs{static{f(this,"zr")}static{o(this,"Ft")}constructor(e){super(e,"Unzip")}},Ms=class extends ji{static{f(this,"Ns")}static{o(this,"It")}constructor(e,t){e||={},e.flush=e.flush||G.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||G.BROTLI_OPERATION_FINISH,e.fullFlushFlag=G.BROTLI_OPERATION_FLUSH,super(e,t)}},Kr=class extends Ms{static{f(this,"Ur")}static{o(this,"Lt")}constructor(e){super(e,"BrotliCompress")}},Xr=class extends Ms{static{f(this,"jr")}static{o(this,"Rt")}constructor(e){super(e,"BrotliDecompress")}},Ps=class extends ji{static{f(this,"Is")}static{o(this,"zt")}constructor(e,t){e||={},e.flush=e.flush||G.ZSTD_e_continue,e.finishFlush=e.finishFlush||G.ZSTD_e_end,e.fullFlushFlag=G.ZSTD_e_flush,super(e,t)}},qr=class extends Ps{static{f(this,"Hr")}static{o(this,"Bt")}constructor(e){super(e,"ZstdCompress")}},Jr=class extends Ps{static{f(this,"Zr")}static{o(this,"Vt")}constructor(e){super(e,"ZstdDecompress")}},Qr=o((e,t)=>{if(Number.isSafeInteger(e))e<0?th(e,t):eh(e,t);else throw Error("cannot encode number outside of javascript safe integer range");return t},"Ht"),eh=o((e,t)=>{t[0]=128;for(var i=t.length;i>1;i--)t[i-1]=e&255,e=Math.floor(e/256)},"Ut"),th=o((e,t)=>{t[0]=255;var i=!1;e*=-1;for(var s=t.length;s>1;s--){var r=e&255;e=Math.floor(e/256),i?t[s-1]=zs(r):r===0?t[s-1]=0:(i=!0,t[s-1]=Us(r))}},"Wt"),ih=o(e=>{let t=e[0],i=t===128?rh(e.subarray(1,e.length)):t===255?sh(e):null;if(i===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i},"Gt"),sh=o(e=>{for(var t=e.length,i=0,s=!1,r=t-1;r>-1;r--){var h=Number(e[r]),n;s?n=zs(h):h===0?n=h:(s=!0,n=Us(h)),n!==0&&(i-=n*256**(t-r-1))}return i},"Kt"),rh=o(e=>{for(var t=e.length,i=0,s=t-1;s>-1;s--){var r=Number(e[s]);r!==0&&(i+=r*256**(t-s-1))}return i},"qt"),zs=o(e=>(255^e)&255,"Jt"),Us=o(e=>(255^e)+1&255,"Yt"),js={};vr(js,{code:o(()=>Hi,"code"),isCode:o(()=>vt,"isCode"),isName:o(()=>hh,"isName"),name:o(()=>Mt,"name")});var vt=o(e=>Mt.has(e),"Zt"),hh=o(e=>Hi.has(e),"Qt"),Mt=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Hi=new Map(Array.from(Mt).map(e=>[e[1],e[0]])),le=class{static{f(this,"ot")}static{o(this,"I")}cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,t=0,i,s){Buffer.isBuffer(e)?this.decode(e,t||0,i,s):e&&this.#i(e)}decode(e,t,i,s){if(t||=0,!e||!(e.length>=t+512))throw Error("need 512 bytes for header");this.path=i?.path??fe(e,t,100),this.mode=i?.mode??s?.mode??se(e,t+100,8),this.uid=i?.uid??s?.uid??se(e,t+108,8),this.gid=i?.gid??s?.gid??se(e,t+116,8),this.size=i?.size??s?.size??se(e,t+124,12),this.mtime=i?.mtime??s?.mtime??ei(e,t+136,12),this.cksum=se(e,t+148,12),s&&this.#i(s,!0),i&&this.#i(i);let r=fe(e,t+156,1);if(vt(r)&&(this.#e=r||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=fe(e,t+157,100),e.subarray(t+257,t+265).toString()==="ustar\x0000")if(this.uname=i?.uname??s?.uname??fe(e,t+265,32),this.gname=i?.gname??s?.gname??fe(e,t+297,32),this.devmaj=i?.devmaj??s?.devmaj??se(e,t+329,8)??0,this.devmin=i?.devmin??s?.devmin??se(e,t+337,8)??0,e[t+475]!==0)this.path=fe(e,t+345,155)+"/"+this.path;else{let n=fe(e,t+345,130);n&&(this.path=n+"/"+this.path),this.atime=i?.atime??s?.atime??ei(e,t+476,12),this.ctime=i?.ctime??s?.ctime??ei(e,t+488,12)}let h=256;for(let n=t;n<t+148;n++)h+=e[n];for(let n=t+156;n<t+512;n++)h+=e[n];this.cksumValid=h===this.cksum,this.cksum===void 0&&h===256&&(this.nullBlock=!0)}#i(e,t=!1){Object.assign(this,Object.fromEntries(Object.entries(e).filter(([i,s])=>!(s==null||i==="path"&&t||i==="linkpath"&&t||i==="global"))))}encode(e,t=0){if(e||=this.block=Buffer.alloc(512),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=t+512))throw Error("need 512 bytes for header");let i=this.ctime||this.atime?130:155,s=nh(this.path||"",i),r=s[0],h=s[1];this.needPax=!!s[2],this.needPax=ce(e,t,100,r)||this.needPax,this.needPax=re(e,t+100,8,this.mode)||this.needPax,this.needPax=re(e,t+108,8,this.uid)||this.needPax,this.needPax=re(e,t+116,8,this.gid)||this.needPax,this.needPax=re(e,t+124,12,this.size)||this.needPax,this.needPax=ti(e,t+136,12,this.mtime)||this.needPax,e[t+156]=Number(this.#e.codePointAt(0)),this.needPax=ce(e,t+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",t+257,8),this.needPax=ce(e,t+265,32,this.uname)||this.needPax,this.needPax=ce(e,t+297,32,this.gname)||this.needPax,this.needPax=re(e,t+329,8,this.devmaj)||this.needPax,this.needPax=re(e,t+337,8,this.devmin)||this.needPax,this.needPax=ce(e,t+345,i,h)||this.needPax,e[t+475]===0?(this.needPax=ce(e,t+345,130,h)||this.needPax,this.needPax=ti(e,t+476,12,this.atime)||this.needPax,this.needPax=ti(e,t+488,12,this.ctime)||this.needPax):this.needPax=ce(e,t+345,155,h)||this.needPax;let n=256;for(let a=t;a<t+148;a++)n+=e[a];for(let a=t+156;a<t+512;a++)n+=e[a];return this.cksum=n,re(e,t+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:Mt.get(this.#e)}get typeKey(){return this.#e}set type(e){let t=String(Hi.get(e));if(vt(t)||t==="Unsupported")this.#e=t;else if(vt(e))this.#e=e;else throw TypeError("invalid entry type: "+e)}},nh=o((e,t)=>{let i=e,s="",r,h=ve.parse(e).root||".";if(Buffer.byteLength(i)<100)r=[i,s,!1];else{s=ve.dirname(i),i=ve.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(s)<=t?r=[i,s,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(s)<=t?r=[i.slice(0,99),s,!0]:(i=ve.join(ve.basename(s),i),s=ve.dirname(s));while(s!==h&&r===void 0);r||=[e.slice(0,99),"",!0]}return r},"tn"),fe=o((e,t,i)=>e.subarray(t,t+i).toString("utf8").replace(/\0.*/,""),"nn"),ei=o((e,t,i)=>oh(se(e,t,i)),"rn"),oh=o(e=>e===void 0?void 0:new Date(e*1e3),"an"),se=o((e,t,i)=>Number(e[t])&128?ih(e.subarray(t,t+i)):lh(e,t,i),"L"),ah=o(e=>isNaN(e)?void 0:e,"on"),lh=o((e,t,i)=>ah(parseInt(e.subarray(t,t+i).toString("utf8").replace(/\0.*$/,"").trim(),8)),"sn"),dh={12:8589934591,8:2097151},re=o((e,t,i,s)=>s===void 0?!1:s>dh[i]||s<0?(Qr(s,e.subarray(t,t+i)),!0):(uh(e,t,i,s),!1),"R"),uh=o((e,t,i,s)=>e.write(fh(s,i),t,i,"ascii"),"ln"),fh=o((e,t)=>ch(Math.floor(e).toString(8),t),"un"),ch=o((e,t)=>(e.length===t-1?e:Array(t-e.length-1).join("0")+e+" ")+"\0","dn"),ti=o((e,t,i,s)=>s===void 0?!1:re(e,t,i,s.getTime()/1e3),"fn"),mh=Array(156).join("\0"),ce=o((e,t,i,s)=>s===void 0?!1:(e.write(s+mh,t,i,"utf8"),s.length!==Buffer.byteLength(s)||s.length>i),"mn"),ht=class Hs{static{f(this,"Ms")}static{o(this,"e")}atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,i=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=i,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){let t=this.encodeBody();if(t==="")return Buffer.allocUnsafe(0);let i=Buffer.byteLength(t),s=512*Math.ceil(1+i/512),r=Buffer.allocUnsafe(s);for(let h=0;h<512;h++)r[h]=0;new le({path:("PaxHeader/"+mr(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:i,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(r),r.write(t,512,i,"utf8");for(let h=i+512;h<r.length;h++)r[h]=0;return r}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(t){if(this[t]===void 0)return"";let i=this[t],s=i instanceof Date?i.getTime()/1e3:i,r=" "+(t==="dev"||t==="ino"||t==="nlink"?"SCHILY.":"")+t+"="+s+`
1
+ var lr=Object.defineProperty;var f=(e,t)=>lr(e,"name",{value:t,configurable:!0});import{createRequire as dr}from"node:module";import{p as fr}from"../packem_shared/giget-BX2ixMoa.js";const ur=dr(import.meta.url),Me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,N=f(e=>{if(typeof Me<"u"&&Me.versions&&Me.versions.node){const[t,i]=Me.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return Me.getBuiltinModule(e)}return ur(e)},"__cjs_getBuiltinModule"),d=N("node:fs"),cr=N("node:fs/promises"),As=N("node:stream"),p=N("node:path"),{posix:ve,basename:mr,join:Ds,win32:pr}=p,Ns=N("events"),{EventEmitter:yr}=Ns,b=N("fs"),{EventEmitter:Pi}=N("node:events"),{StringDecoder:br}=N("node:string_decoder"),rt=N("path"),{parse:Er,dirname:gr}=rt,pi=N("assert"),{Buffer:we}=N("buffer"),Xi=N("zlib"),qi={...Xi,default:Xi},wr=N("zlib"),Rr=N("node:assert"),{randomBytes:Is}=N("node:crypto");var _r=Object.defineProperty,o=f((e,t)=>_r(e,"name",{value:t,configurable:!0}),"o"),rn=fr({Header:o(()=>le,"Header"),Pack:o(()=>ot,"Pack"),PackJob:o(()=>ki,"PackJob"),PackSync:o(()=>Ut,"PackSync"),Parser:o(()=>Ie,"Parser"),Pax:o(()=>ht,"Pax"),ReadEntry:o(()=>Zi,"ReadEntry"),Unpack:o(()=>Ft,"Unpack"),UnpackSync:o(()=>Mi,"UnpackSync"),WriteEntry:o(()=>Yi,"WriteEntry"),WriteEntrySync:o(()=>Gs,"WriteEntrySync"),WriteEntryTar:o(()=>$s,"WriteEntryTar"),c:o(()=>bs,"c"),create:o(()=>bs,"create"),extract:o(()=>xs,"extract"),filesFilter:o(()=>Wi,"filesFilter"),list:o(()=>Ce,"list"),r:o(()=>ge,"r"),replace:o(()=>ge,"replace"),t:o(()=>Ce,"t"),types:o(()=>js,"types"),x:o(()=>xs,"x")}),Sr=Object.defineProperty,vr=o((e,t)=>{for(var i in t)Sr(e,i,{get:t[i],enumerable:!0})},"ue"),Ji=process||{stdout:null,stderr:null},Or=o(e=>!!e&&typeof e=="object"&&(e instanceof Se||e instanceof As||Tr(e)||kr(e)),"fe"),Tr=o(e=>!!e&&typeof e=="object"&&e instanceof Pi&&typeof e.pipe=="function"&&e.pipe!==As.Writable.prototype.pipe,"pe"),kr=o(e=>!!e&&typeof e=="object"&&e instanceof Pi&&typeof e.write=="function"&&typeof e.end=="function","me"),$=Symbol("EOF"),Y=Symbol("maybeEmitEnd"),J=Symbol("emittedEnd"),at=Symbol("emittingEnd"),Pe=Symbol("emittedError"),lt=Symbol("closed"),Qi=Symbol("read"),dt=Symbol("flush"),es=Symbol("flushChunk"),C=Symbol("encoding"),Oe=Symbol("decoder"),v=Symbol("flowing"),ze=Symbol("paused"),xe=Symbol("resume"),O=Symbol("buffer"),D=Symbol("pipes"),T=Symbol("bufferLength"),Ht=Symbol("bufferPush"),ut=Symbol("bufferShift"),A=Symbol("objectMode"),R=Symbol("destroyed"),Zt=Symbol("error"),Wt=Symbol("emitData"),ts=Symbol("emitEnd"),Gt=Symbol("emitEnd2"),j=Symbol("async"),$t=Symbol("abort"),ft=Symbol("aborted"),Ue=Symbol("signal"),de=Symbol("dataListeners"),I=Symbol("discarded"),je=o(e=>Promise.resolve().then(e),"Pe"),Lr=o(e=>e(),"Fe"),xr=o(e=>e==="end"||e==="finish"||e==="prefinish","Ie"),Ar=o(e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,"Le"),Dr=o(e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),"Re"),Bs=class{static{f(this,"As")}static{o(this,"ze")}src;dest;opts;ondrain;constructor(e,t,i){this.src=e,this.dest=t,this.opts=i,this.ondrain=()=>e[xe](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Nr=class extends Bs{static{f(this,"Sr")}static{o(this,"Be")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,i){super(e,t,i),this.proxyErrors=s=>this.dest.emit("error",s),e.on("error",this.proxyErrors)}},Ir=o(e=>!!e.objectMode,"Ve"),Br=o(e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer","He"),Se=class extends Pi{static{f(this,"Rt")}static{o(this,"Ue")}[v]=!1;[ze]=!1;[D]=[];[O]=[];[A];[C];[j];[Oe];[$]=!1;[J]=!1;[at]=!1;[lt]=!1;[Pe]=null;[T]=0;[R]=!1;[Ue];[ft]=!1;[de]=0;[I]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw TypeError("Encoding and objectMode may not be used together");Ir(t)?(this[A]=!0,this[C]=null):Br(t)?(this[C]=t.encoding,this[A]=!1):(this[A]=!1,this[C]=null),this[j]=!!t.async,this[Oe]=this[C]?new br(this[C]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[O],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[D],"get")});let{signal:i}=t;i&&(this[Ue]=i,i.aborted?this[$t]():i.addEventListener("abort",()=>this[$t]()))}get bufferLength(){return this[T]}get encoding(){return this[C]}set encoding(e){throw Error("Encoding must be set at instantiation time")}setEncoding(e){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[A]}set objectMode(e){throw Error("objectMode must be set at instantiation time")}get async(){return this[j]}set async(e){this[j]=this[j]||!!e}[$t](){this[ft]=!0,this.emit("abort",this[Ue]?.reason),this.destroy(this[Ue]?.reason)}get aborted(){return this[ft]}set aborted(e){}write(e,t,i){if(this[ft])return!1;if(this[$])throw Error("write after end");if(this[R])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(i=t,t="utf8"),t||="utf8";let s=this[j]?je:Lr;if(!this[A]&&!Buffer.isBuffer(e)){if(Dr(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Ar(e))e=Buffer.from(e);else if(typeof e!="string")throw Error("Non-contiguous data written to non-objectMode stream")}return this[A]?(this[v]&&this[T]!==0&&this[dt](!0),this[v]?this.emit("data",e):this[Ht](e),this[T]!==0&&this.emit("readable"),i&&s(i),this[v]):e.length?(typeof e=="string"&&!(t===this[C]&&!this[Oe]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[C]&&(e=this[Oe].write(e)),this[v]&&this[T]!==0&&this[dt](!0),this[v]?this.emit("data",e):this[Ht](e),this[T]!==0&&this.emit("readable"),i&&s(i),this[v]):(this[T]!==0&&this.emit("readable"),i&&s(i),this[v])}read(e){if(this[R])return null;if(this[I]=!1,this[T]===0||e===0||e&&e>this[T])return this[Y](),null;this[A]&&(e=null),this[O].length>1&&!this[A]&&(this[O]=[this[C]?this[O].join(""):Buffer.concat(this[O],this[T])]);let t=this[Qi](e||null,this[O][0]);return this[Y](),t}[Qi](e,t){if(this[A])this[ut]();else{let i=t;e===i.length||e===null?this[ut]():typeof i=="string"?(this[O][0]=i.slice(e),t=i.slice(0,e),this[T]-=e):(this[O][0]=i.subarray(e),t=i.subarray(0,e),this[T]-=e)}return this.emit("data",t),!this[O].length&&!this[$]&&this.emit("drain"),t}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t="utf8"),e!==void 0&&this.write(e,t),i&&this.once("end",i),this[$]=!0,this.writable=!1,(this[v]||!this[ze])&&this[Y](),this}[xe](){this[R]||(!this[de]&&!this[D].length&&(this[I]=!0),this[ze]=!1,this[v]=!0,this.emit("resume"),this[O].length?this[dt]():this[$]?this[Y]():this.emit("drain"))}resume(){return this[xe]()}pause(){this[v]=!1,this[ze]=!0,this[I]=!1}get destroyed(){return this[R]}get flowing(){return this[v]}get paused(){return this[ze]}[Ht](e){this[A]?this[T]+=1:this[T]+=e.length,this[O].push(e)}[ut](){return this[A]?--this[T]:this[T]-=this[O][0].length,this[O].shift()}[dt](e=!1){do;while(this[es](this[ut]())&&this[O].length);!e&&!this[O].length&&!this[$]&&this.emit("drain")}[es](e){return this.emit("data",e),this[v]}pipe(e,t){if(this[R])return e;this[I]=!1;let i=this[J];return t||={},e===Ji.stdout||e===Ji.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,i?t.end&&e.end():(this[D].push(t.proxyErrors?new Nr(this,e,t):new Bs(this,e,t)),this[j]?je(()=>this[xe]()):this[xe]()),e}unpipe(e){let t=this[D].find(i=>i.dest===e);t&&(this[D].length===1?(this[v]&&this[de]===0&&(this[v]=!1),this[D]=[]):this[D].splice(this[D].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let i=super.on(e,t);if(e==="data")this[I]=!1,this[de]++,!this[D].length&&!this[v]&&this[xe]();else if(e==="readable"&&this[T]!==0)super.emit("readable");else if(xr(e)&&this[J])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Pe]){let s=t;this[j]?je(()=>s.call(this,this[Pe])):s.call(this,this[Pe])}return i}removeListener(e,t){return this.off(e,t)}off(e,t){let i=super.off(e,t);return e==="data"&&(this[de]=this.listeners("data").length,this[de]===0&&!this[I]&&!this[D].length&&(this[v]=!1)),i}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[de]=0,!this[I]&&!this[D].length&&(this[v]=!1)),t}get emittedEnd(){return this[J]}[Y](){!this[at]&&!this[J]&&!this[R]&&this[O].length===0&&this[$]&&(this[at]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[lt]&&this.emit("close"),this[at]=!1)}emit(e,...t){let i=t[0];if(e!=="error"&&e!=="close"&&e!==R&&this[R])return!1;if(e==="data")return!this[A]&&!i?!1:this[j]?(je(()=>this[Wt](i)),!0):this[Wt](i);if(e==="end")return this[ts]();if(e==="close"){if(this[lt]=!0,!this[J]&&!this[R])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(e==="error"){this[Pe]=i,super.emit(Zt,i);let r=!this[Ue]||this.listeners("error").length?super.emit("error",i):!1;return this[Y](),r}else if(e==="resume"){let r=super.emit("resume");return this[Y](),r}else if(e==="finish"||e==="prefinish"){let r=super.emit(e);return this.removeAllListeners(e),r}let s=super.emit(e,...t);return this[Y](),s}[Wt](e){for(let i of this[D])i.dest.write(e)===!1&&this.pause();let t=this[I]?!1:super.emit("data",e);return this[Y](),t}[ts](){return this[J]?!1:(this[J]=!0,this.readable=!1,this[j]?(je(()=>this[Gt]()),!0):this[Gt]())}[Gt](){if(this[Oe]){let t=this[Oe].end();if(t){for(let i of this[D])i.dest.write(t);this[I]||super.emit("data",t)}}for(let t of this[D])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[A]||(e.dataLength=0);let t=this.promise();return this.on("data",i=>{e.push(i),this[A]||(e.dataLength+=i.length)}),await t,e}async concat(){if(this[A])throw Error("cannot concat in objectMode");let e=await this.collect();return this[C]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(R,()=>t(Error("stream destroyed"))),this.on("error",i=>t(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[I]=!1;let e=!1,t=o(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"t");return{next:o(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[$])return t();let s,r,h=o(u=>{this.off("data",n),this.off("end",a),this.off(R,l),t(),r(u)},"a"),n=o(u=>{this.off("error",h),this.off("end",a),this.off(R,l),this.pause(),s({value:u,done:!!this[$]})},"o"),a=o(()=>{this.off("error",h),this.off("data",n),this.off(R,l),t(),s({done:!0,value:void 0})},"s"),l=o(()=>h(Error("stream destroyed")),"c");return new Promise((u,m)=>{r=m,s=u,this.once(R,l),this.once("error",h),this.once("end",a),this.once("data",n)})},"next"),throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[I]=!1;let e=!1,t=o(()=>(this.pause(),this.off(Zt,t),this.off(R,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"t");return this.once("end",t),this.once(Zt,t),this.once(R,t),{next:o(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next"),throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[R])return e?this.emit("error",e):this.emit(R),this;this[R]=!0,this[I]=!0,this[O].length=0,this[T]=0;let t=this;return typeof t.close=="function"&&!this[lt]&&t.close(),e?this.emit("error",e):this.emit(R),this}static get isStream(){return Or}},Fr=b.writev,oe=Symbol("_autoClose"),U=Symbol("_close"),He=Symbol("_ended"),y=Symbol("_fd"),Yt=Symbol("_finished"),q=Symbol("_flags"),Vt=Symbol("_flush"),yi=Symbol("_handleChunk"),bi=Symbol("_makeBuf"),qe=Symbol("_mode"),ct=Symbol("_needDrain"),Be=Symbol("_onerror"),Fe=Symbol("_onopen"),Kt=Symbol("_onread"),Ae=Symbol("_onwrite"),ae=Symbol("_open"),z=Symbol("_path"),ie=Symbol("_pos"),H=Symbol("_queue"),De=Symbol("_read"),Xt=Symbol("_readSize"),X=Symbol("_reading"),Ze=Symbol("_remain"),qt=Symbol("_size"),_t=Symbol("_write"),ue=Symbol("_writing"),St=Symbol("_defaultFlag"),Re=Symbol("_errored"),zi=class extends Se{static{f(this,"Ce")}static{o(this,"dt")}[Re]=!1;[y];[z];[Xt];[X]=!1;[qt];[Ze];[oe];constructor(e,t){if(t||={},super(t),this.readable=!0,this.writable=!1,typeof e!="string")throw TypeError("path must be a string");this[Re]=!1,this[y]=typeof t.fd=="number"?t.fd:void 0,this[z]=e,this[Xt]=t.readSize||16*1024*1024,this[X]=!1,this[qt]=typeof t.size=="number"?t.size:1/0,this[Ze]=this[qt],this[oe]=typeof t.autoClose=="boolean"?t.autoClose:!0,typeof this[y]=="number"?this[De]():this[ae]()}get fd(){return this[y]}get path(){return this[z]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[ae](){b.open(this[z],"r",(e,t)=>this[Fe](e,t))}[Fe](e,t){e?this[Be](e):(this[y]=t,this.emit("open",t),this[De]())}[bi](){return Buffer.allocUnsafe(Math.min(this[Xt],this[Ze]))}[De](){if(!this[X]){this[X]=!0;let e=this[bi]();if(e.length===0)return process.nextTick(()=>this[Kt](null,0,e));b.read(this[y],e,0,e.length,null,(t,i,s)=>this[Kt](t,i,s))}}[Kt](e,t,i){this[X]=!1,e?this[Be](e):this[yi](t,i)&&this[De]()}[U](){if(this[oe]&&typeof this[y]=="number"){let e=this[y];this[y]=void 0,b.close(e,t=>t?this.emit("error",t):this.emit("close"))}}[Be](e){this[X]=!0,this[U](),this.emit("error",e)}[yi](e,t){let i=!1;return this[Ze]-=e,e>0&&(i=super.write(e<t.length?t.subarray(0,e):t)),(e===0||this[Ze]<=0)&&(i=!1,this[U](),super.end()),i}emit(e,...t){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[y]=="number"&&this[De](),!1;case"error":return this[Re]?!1:(this[Re]=!0,super.emit(e,...t));default:return super.emit(e,...t)}}},Cr=class extends zi{static{f(this,"kr")}static{o(this,"ft")}[ae](){let e=!0;try{this[Fe](null,b.openSync(this[z],"r")),e=!1}finally{e&&this[U]()}}[De](){let e=!0;try{if(!this[X]){this[X]=!0;do{let t=this[bi](),i=t.length===0?0:b.readSync(this[y],t,0,t.length,null);if(!this[yi](i,t))break}while(!0);this[X]=!1}e=!1}finally{e&&this[U]()}}[U](){if(this[oe]&&typeof this[y]=="number"){let e=this[y];this[y]=void 0,b.closeSync(e),this.emit("close")}}},Ct=class extends Ns{static{f(this,"Ii")}static{o(this,"pt")}readable=!1;writable=!0;[Re]=!1;[ue]=!1;[He]=!1;[H]=[];[ct]=!1;[z];[qe];[oe];[y];[St];[q];[Yt]=!1;[ie];constructor(e,t){t||={},super(t),this[z]=e,this[y]=typeof t.fd=="number"?t.fd:void 0,this[qe]=t.mode===void 0?438:t.mode,this[ie]=typeof t.start=="number"?t.start:void 0,this[oe]=typeof t.autoClose=="boolean"?t.autoClose:!0;let i=this[ie]===void 0?"w":"r+";this[St]=t.flags===void 0,this[q]=t.flags===void 0?i:t.flags,this[y]===void 0&&this[ae]()}emit(e,...t){if(e==="error"){if(this[Re])return!1;this[Re]=!0}return super.emit(e,...t)}get fd(){return this[y]}get path(){return this[z]}[Be](e){this[U](),this[ue]=!0,this.emit("error",e)}[ae](){b.open(this[z],this[q],this[qe],(e,t)=>this[Fe](e,t))}[Fe](e,t){this[St]&&this[q]==="r+"&&e&&e.code==="ENOENT"?(this[q]="w",this[ae]()):e?this[Be](e):(this[y]=t,this.emit("open",t),this[ue]||this[Vt]())}end(e,t){return e&&this.write(e,t),this[He]=!0,!this[ue]&&!this[H].length&&typeof this[y]=="number"&&this[Ae](null,0),this}write(e,t){return typeof e=="string"&&(e=Buffer.from(e,t)),this[He]?(this.emit("error",Error("write() after end()")),!1):this[y]===void 0||this[ue]||this[H].length?(this[H].push(e),this[ct]=!0,!1):(this[ue]=!0,this[_t](e),!0)}[_t](e){b.write(this[y],e,0,e.length,this[ie],(t,i)=>this[Ae](t,i))}[Ae](e,t){e?this[Be](e):(this[ie]!==void 0&&typeof t=="number"&&(this[ie]+=t),this[H].length?this[Vt]():(this[ue]=!1,this[He]&&!this[Yt]?(this[Yt]=!0,this[U](),this.emit("finish")):this[ct]&&(this[ct]=!1,this.emit("drain"))))}[Vt](){if(this[H].length===0)this[He]&&this[Ae](null,0);else if(this[H].length===1)this[_t](this[H].pop());else{let e=this[H];this[H]=[],Fr(this[y],e,this[ie],(t,i)=>this[Ae](t,i))}}[U](){if(this[oe]&&typeof this[y]=="number"){let e=this[y];this[y]=void 0,b.close(e,t=>t?this.emit("error",t):this.emit("close"))}}},Fs=class extends Ct{static{f(this,"Ds")}static{o(this,"mt")}[ae](){let e;if(this[St]&&this[q]==="r+")try{e=b.openSync(this[z],this[q],this[qe])}catch(t){if(t?.code==="ENOENT")return this[q]="w",this[ae]();throw t}else e=b.openSync(this[z],this[q],this[qe]);this[Fe](null,e)}[U](){if(this[oe]&&typeof this[y]=="number"){let e=this[y];this[y]=void 0,b.closeSync(e),this.emit("close")}}[_t](e){let t=!0;try{this[Ae](null,b.writeSync(this[y],e,0,e.length,this[ie])),t=!1}finally{if(t)try{this[U]()}catch{}}}},Mr=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),Pr=o(e=>!!e.sync&&!!e.file,"gt"),zr=o(e=>!e.sync&&!!e.file,"_t"),Ur=o(e=>!!e.sync&&!e.file,"vt"),jr=o(e=>!e.sync&&!e.file,"yt"),Hr=o(e=>!!e.file,"bt"),Zr=o(e=>Mr.get(e)||e,"xt"),Ui=o((e={})=>{if(!e)return{};let t={};for(let[i,s]of Object.entries(e)){let r=Zr(i);t[r]=s}return t.chmod===void 0&&t.noChmod===!1&&(t.chmod=!0),delete t.noChmod,t},"St"),nt=o((e,t,i,s,r)=>Object.assign((h=[],n,a)=>{Array.isArray(h)&&(n=h,h={}),typeof n=="function"&&(a=n,n=void 0),n=n?Array.from(n):[];let l=Ui(h);if(r?.(l,n),Pr(l)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return e(l,n)}else if(zr(l)){let u=t(l,n);return a?u.then(()=>a(),a):u}else if(Ur(l)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return i(l,n)}else if(jr(l)){if(typeof a=="function")throw TypeError("callback only supported with file option");return s(l,n)}throw Error("impossible options??")},{syncFile:e,asyncFile:t,syncNoFile:i,asyncNoFile:s,validate:r}),"Ct"),Wr=wr.constants||{ZLIB_VERNUM:4736},G=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},Wr)),Gr=we.concat,is=Object.getOwnPropertyDescriptor(we,"concat"),$r=o(e=>e,"Dt"),Jt=is?.writable===!0||is?.set!==void 0?e=>{we.concat=e?$r:Gr}:e=>{},_e=Symbol("_superWrite"),mt=class extends Error{static{f(this,"di")}static{o(this,"At")}code;errno;constructor(e,t){super("zlib: "+e.message,{cause:e}),this.code=e.code,this.errno=e.errno,this.code||="ZLIB_ERROR",this.message="zlib: "+e.message,Error.captureStackTrace(this,t??this.constructor)}get name(){return"ZlibError"}},Qt=Symbol("flushFlag"),ji=class extends Se{static{f(this,"Pe")}static{o(this,"Mt")}#e=!1;#i=!1;#s;#h;#r;#t;#n;get sawError(){return this.#e}get handle(){return this.#t}get flushFlag(){return this.#s}constructor(e,t){if(!e||typeof e!="object")throw TypeError("invalid options for ZlibBase constructor");if(super(e),this.#s=e.flush??0,this.#h=e.finishFlush??0,this.#r=e.fullFlushFlag??0,typeof qi[t]!="function")throw TypeError("Compression method not supported: "+t);try{this.#t=new qi[t](e)}catch(i){throw new mt(i,this.constructor)}this.#n=i=>{this.#e||(this.#e=!0,this.close(),this.emit("error",i))},this.#t?.on("error",i=>this.#n(new mt(i))),this.once("end",()=>this.close)}close(){this.#t&&(this.#t.close(),this.#t=void 0,this.emit("close"))}reset(){if(!this.#e)return pi(this.#t,"zlib binding closed"),this.#t.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#r),this.write(Object.assign(we.alloc(0),{[Qt]:e})))}end(e,t,i){return typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),e&&(t?this.write(e,t):this.write(e)),this.flush(this.#h),this.#i=!0,super.end(i)}get ended(){return this.#i}[_e](e){return super.write(e)}write(e,t,i){if(typeof t=="function"&&(i=t,t="utf8"),typeof e=="string"&&(e=we.from(e,t)),this.#e)return;pi(this.#t,"zlib binding closed");let s=this.#t._handle,r=s.close;s.close=()=>{};let h=this.#t.close;this.#t.close=()=>{},Jt(!0);let n;try{let l=typeof e[Qt]=="number"?e[Qt]:this.#s;n=this.#t._processChunk(e,l),Jt(!1)}catch(l){Jt(!1),this.#n(new mt(l,this.write))}finally{this.#t&&(this.#t._handle=s,s.close=r,this.#t.close=h,this.#t.removeAllListeners("error"))}this.#t&&this.#t.on("error",l=>this.#n(new mt(l,this.write)));let a;if(n)if(Array.isArray(n)&&n.length>0){let l=n[0];a=this[_e](we.from(l));for(let u=1;u<n.length;u++)a=this[_e](n[u])}else a=this[_e](we.from(n));return i&&i(),a}},Cs=class extends ji{static{f(this,"xs")}static{o(this,"Nt")}#e;#i;constructor(e,t){e||={},e.flush=e.flush||G.Z_NO_FLUSH,e.finishFlush=e.finishFlush||G.Z_FINISH,e.fullFlushFlag=G.Z_FULL_FLUSH,super(e,t),this.#e=e.level,this.#i=e.strategy}params(e,t){if(!this.sawError){if(!this.handle)throw Error("cannot switch params when binding is closed");if(!this.handle.params)throw Error("not supported in this implementation");if(this.#e!==e||this.#i!==t){this.flush(G.Z_SYNC_FLUSH),pi(this.handle,"zlib binding closed");let i=this.handle.flush;this.handle.flush=(s,r)=>{typeof s=="function"&&(r=s,s=this.flushFlag),this.flush(s),r?.()};try{this.handle.params(e,t)}finally{this.handle.flush=i}this.handle&&(this.#e=e,this.#i=t)}}}},Yr=class extends Cs{static{f(this,"Pr")}static{o(this,"Pt")}#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[_e](e){return this.#e?(this.#e=!1,e[9]=255,super[_e](e)):super[_e](e)}},Vr=class extends Cs{static{f(this,"zr")}static{o(this,"Ft")}constructor(e){super(e,"Unzip")}},Ms=class extends ji{static{f(this,"Ns")}static{o(this,"It")}constructor(e,t){e||={},e.flush=e.flush||G.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||G.BROTLI_OPERATION_FINISH,e.fullFlushFlag=G.BROTLI_OPERATION_FLUSH,super(e,t)}},Kr=class extends Ms{static{f(this,"Ur")}static{o(this,"Lt")}constructor(e){super(e,"BrotliCompress")}},Xr=class extends Ms{static{f(this,"jr")}static{o(this,"Rt")}constructor(e){super(e,"BrotliDecompress")}},Ps=class extends ji{static{f(this,"Is")}static{o(this,"zt")}constructor(e,t){e||={},e.flush=e.flush||G.ZSTD_e_continue,e.finishFlush=e.finishFlush||G.ZSTD_e_end,e.fullFlushFlag=G.ZSTD_e_flush,super(e,t)}},qr=class extends Ps{static{f(this,"Hr")}static{o(this,"Bt")}constructor(e){super(e,"ZstdCompress")}},Jr=class extends Ps{static{f(this,"Zr")}static{o(this,"Vt")}constructor(e){super(e,"ZstdDecompress")}},Qr=o((e,t)=>{if(Number.isSafeInteger(e))e<0?th(e,t):eh(e,t);else throw Error("cannot encode number outside of javascript safe integer range");return t},"Ht"),eh=o((e,t)=>{t[0]=128;for(var i=t.length;i>1;i--)t[i-1]=e&255,e=Math.floor(e/256)},"Ut"),th=o((e,t)=>{t[0]=255;var i=!1;e*=-1;for(var s=t.length;s>1;s--){var r=e&255;e=Math.floor(e/256),i?t[s-1]=zs(r):r===0?t[s-1]=0:(i=!0,t[s-1]=Us(r))}},"Wt"),ih=o(e=>{let t=e[0],i=t===128?rh(e.subarray(1,e.length)):t===255?sh(e):null;if(i===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i},"Gt"),sh=o(e=>{for(var t=e.length,i=0,s=!1,r=t-1;r>-1;r--){var h=Number(e[r]),n;s?n=zs(h):h===0?n=h:(s=!0,n=Us(h)),n!==0&&(i-=n*256**(t-r-1))}return i},"Kt"),rh=o(e=>{for(var t=e.length,i=0,s=t-1;s>-1;s--){var r=Number(e[s]);r!==0&&(i+=r*256**(t-s-1))}return i},"qt"),zs=o(e=>(255^e)&255,"Jt"),Us=o(e=>(255^e)+1&255,"Yt"),js={};vr(js,{code:o(()=>Hi,"code"),isCode:o(()=>vt,"isCode"),isName:o(()=>hh,"isName"),name:o(()=>Mt,"name")});var vt=o(e=>Mt.has(e),"Zt"),hh=o(e=>Hi.has(e),"Qt"),Mt=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Hi=new Map(Array.from(Mt).map(e=>[e[1],e[0]])),le=class{static{f(this,"ot")}static{o(this,"I")}cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,t=0,i,s){Buffer.isBuffer(e)?this.decode(e,t||0,i,s):e&&this.#i(e)}decode(e,t,i,s){if(t||=0,!e||!(e.length>=t+512))throw Error("need 512 bytes for header");this.path=i?.path??fe(e,t,100),this.mode=i?.mode??s?.mode??se(e,t+100,8),this.uid=i?.uid??s?.uid??se(e,t+108,8),this.gid=i?.gid??s?.gid??se(e,t+116,8),this.size=i?.size??s?.size??se(e,t+124,12),this.mtime=i?.mtime??s?.mtime??ei(e,t+136,12),this.cksum=se(e,t+148,12),s&&this.#i(s,!0),i&&this.#i(i);let r=fe(e,t+156,1);if(vt(r)&&(this.#e=r||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=fe(e,t+157,100),e.subarray(t+257,t+265).toString()==="ustar\x0000")if(this.uname=i?.uname??s?.uname??fe(e,t+265,32),this.gname=i?.gname??s?.gname??fe(e,t+297,32),this.devmaj=i?.devmaj??s?.devmaj??se(e,t+329,8)??0,this.devmin=i?.devmin??s?.devmin??se(e,t+337,8)??0,e[t+475]!==0)this.path=fe(e,t+345,155)+"/"+this.path;else{let n=fe(e,t+345,130);n&&(this.path=n+"/"+this.path),this.atime=i?.atime??s?.atime??ei(e,t+476,12),this.ctime=i?.ctime??s?.ctime??ei(e,t+488,12)}let h=256;for(let n=t;n<t+148;n++)h+=e[n];for(let n=t+156;n<t+512;n++)h+=e[n];this.cksumValid=h===this.cksum,this.cksum===void 0&&h===256&&(this.nullBlock=!0)}#i(e,t=!1){Object.assign(this,Object.fromEntries(Object.entries(e).filter(([i,s])=>!(s==null||i==="path"&&t||i==="linkpath"&&t||i==="global"))))}encode(e,t=0){if(e||=this.block=Buffer.alloc(512),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=t+512))throw Error("need 512 bytes for header");let i=this.ctime||this.atime?130:155,s=nh(this.path||"",i),r=s[0],h=s[1];this.needPax=!!s[2],this.needPax=ce(e,t,100,r)||this.needPax,this.needPax=re(e,t+100,8,this.mode)||this.needPax,this.needPax=re(e,t+108,8,this.uid)||this.needPax,this.needPax=re(e,t+116,8,this.gid)||this.needPax,this.needPax=re(e,t+124,12,this.size)||this.needPax,this.needPax=ti(e,t+136,12,this.mtime)||this.needPax,e[t+156]=Number(this.#e.codePointAt(0)),this.needPax=ce(e,t+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",t+257,8),this.needPax=ce(e,t+265,32,this.uname)||this.needPax,this.needPax=ce(e,t+297,32,this.gname)||this.needPax,this.needPax=re(e,t+329,8,this.devmaj)||this.needPax,this.needPax=re(e,t+337,8,this.devmin)||this.needPax,this.needPax=ce(e,t+345,i,h)||this.needPax,e[t+475]===0?(this.needPax=ce(e,t+345,130,h)||this.needPax,this.needPax=ti(e,t+476,12,this.atime)||this.needPax,this.needPax=ti(e,t+488,12,this.ctime)||this.needPax):this.needPax=ce(e,t+345,155,h)||this.needPax;let n=256;for(let a=t;a<t+148;a++)n+=e[a];for(let a=t+156;a<t+512;a++)n+=e[a];return this.cksum=n,re(e,t+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:Mt.get(this.#e)}get typeKey(){return this.#e}set type(e){let t=String(Hi.get(e));if(vt(t)||t==="Unsupported")this.#e=t;else if(vt(e))this.#e=e;else throw TypeError("invalid entry type: "+e)}},nh=o((e,t)=>{let i=e,s="",r,h=ve.parse(e).root||".";if(Buffer.byteLength(i)<100)r=[i,s,!1];else{s=ve.dirname(i),i=ve.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(s)<=t?r=[i,s,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(s)<=t?r=[i.slice(0,99),s,!0]:(i=ve.join(ve.basename(s),i),s=ve.dirname(s));while(s!==h&&r===void 0);r||=[e.slice(0,99),"",!0]}return r},"tn"),fe=o((e,t,i)=>e.subarray(t,t+i).toString("utf8").replace(/\0.*/,""),"nn"),ei=o((e,t,i)=>oh(se(e,t,i)),"rn"),oh=o(e=>e===void 0?void 0:new Date(e*1e3),"an"),se=o((e,t,i)=>Number(e[t])&128?ih(e.subarray(t,t+i)):lh(e,t,i),"L"),ah=o(e=>isNaN(e)?void 0:e,"on"),lh=o((e,t,i)=>ah(parseInt(e.subarray(t,t+i).toString("utf8").replace(/\0.*$/,"").trim(),8)),"sn"),dh={12:8589934591,8:2097151},re=o((e,t,i,s)=>s===void 0?!1:s>dh[i]||s<0?(Qr(s,e.subarray(t,t+i)),!0):(uh(e,t,i,s),!1),"R"),uh=o((e,t,i,s)=>e.write(fh(s,i),t,i,"ascii"),"ln"),fh=o((e,t)=>ch(Math.floor(e).toString(8),t),"un"),ch=o((e,t)=>(e.length===t-1?e:Array(t-e.length-1).join("0")+e+" ")+"\0","dn"),ti=o((e,t,i,s)=>s===void 0?!1:re(e,t,i,s.getTime()/1e3),"fn"),mh=Array(156).join("\0"),ce=o((e,t,i,s)=>s===void 0?!1:(e.write(s+mh,t,i,"utf8"),s.length!==Buffer.byteLength(s)||s.length>i),"mn"),ht=class Hs{static{f(this,"Ms")}static{o(this,"e")}atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,i=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=i,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){let t=this.encodeBody();if(t==="")return Buffer.allocUnsafe(0);let i=Buffer.byteLength(t),s=512*Math.ceil(1+i/512),r=Buffer.allocUnsafe(s);for(let h=0;h<512;h++)r[h]=0;new le({path:("PaxHeader/"+mr(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:i,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(r),r.write(t,512,i,"utf8");for(let h=i+512;h<r.length;h++)r[h]=0;return r}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(t){if(this[t]===void 0)return"";let i=this[t],s=i instanceof Date?i.getTime()/1e3:i,r=" "+(t==="dev"||t==="ino"||t==="nlink"?"SCHILY.":"")+t+"="+s+`
2
2
  `,h=Buffer.byteLength(r),n=Math.floor(Math.log(h)/Math.log(10))+1;return h+n>=10**n&&(n+=1),n+h+r}static parse(t,i,s=!1){return new Hs(ph(yh(t),i),s)}},ph=o((e,t)=>t?Object.assign({},t,e):e,"gn"),yh=o(e=>e.replace(/\n$/,"").split(`
3
3
  `).reduce(bh,Object.create(null)),"_n"),bh=o((e,t)=>{let i=parseInt(t,10);if(i!==Buffer.byteLength(t)+1)return e;t=t.slice((i+" ").length);let s=t.split("="),r=s.shift();if(!r)return e;let h=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),n=s.join("=");return e[h]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(h)?new Date(Number(n)*1e3):/^[0-9]+$/.test(n)?+n:n,e},"vn"),c=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32"?e=>e&&e.replaceAll(/\\/g,"/"):e=>e,Zi=class extends Se{static{f(this,"Ue")}static{o(this,"yn")}extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(e,t,i){switch(super({}),this.pause(),this.extended=t,this.globalExtended=i,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!e.path)throw Error("no path provided for tar.ReadEntry");this.path=c(e.path),this.mode=e.mode,this.mode&&(this.mode&=4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?c(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,t&&this.#e(t),i&&this.#e(i,!0)}write(e){let t=e.length;if(t>this.blockRemain)throw Error("writing more to entry than is appropriate");let i=this.remain,s=this.blockRemain;return this.remain=Math.max(0,i-t),this.blockRemain=Math.max(0,s-t),this.ignore?!0:i>=t?super.write(e):super.write(e.subarray(0,i))}#e(e,t=!1){e.path&&=c(e.path),e.linkpath&&=c(e.linkpath),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([i,s])=>!(s==null||i==="path"&&t))))}},Pt=o((e,t,i,s={})=>{e.file&&(s.file=e.file),e.cwd&&(s.cwd=e.cwd),s.code=i instanceof Error&&i.code||t,s.tarCode=t,!e.strict&&s.recoverable!==!1?(i instanceof Error&&(s=Object.assign(i,s),i=i.message),e.emit("warn",t,i,s)):i instanceof Error?e.emit("error",Object.assign(i,s)):e.emit("error",Object.assign(Error(`${t}: ${i}`),s))},"bn"),Eh=1024*1024,Ei=Buffer.from([31,139]),gi=Buffer.from([40,181,47,253]),gh=Math.max(Ei.length,gi.length),B=Symbol("state"),me=Symbol("writeEntry"),V=Symbol("readEntry"),ii=Symbol("nextEntry"),ss=Symbol("processEntry"),Z=Symbol("extendedHeader"),We=Symbol("globalExtendedHeader"),Q=Symbol("meta"),rs=Symbol("emitMeta"),E=Symbol("buffer"),K=Symbol("queue"),ee=Symbol("ended"),si=Symbol("emittedEnd"),pe=Symbol("emit"),S=Symbol("unzip"),pt=Symbol("consumeChunk"),yt=Symbol("consumeChunkSub"),ri=Symbol("consumeBody"),hs=Symbol("consumeMeta"),ns=Symbol("consumeHeader"),Ge=Symbol("consuming"),hi=Symbol("bufferConcat"),bt=Symbol("maybeEnd"),Te=Symbol("writing"),te=Symbol("aborted"),Et=Symbol("onDone"),ye=Symbol("sawValidEntry"),gt=Symbol("sawNullBlock"),wt=Symbol("sawEOF"),os=Symbol("closeStream"),wh=o(()=>!0,"qn"),Ie=class extends yr{static{f(this,"xt")}static{o(this,"Jn")}file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[K]=[];[E];[V];[me];[B]="begin";[Q]="";[Z];[We];[ee]=!1;[S];[te]=!1;[ye];[gt]=!1;[wt]=!1;[Te]=!1;[Ge]=!1;[si]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(Et,()=>{(this[B]==="begin"||this[ye]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(Et,e.ondone):this.on(Et,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||Eh,this.filter=typeof e.filter=="function"?e.filter:wh;let t=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:t?void 0:!1;let i=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:i?!0:void 0,this.on("end",()=>this[os]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,t,i={}){Pt(this,e,t,i)}[ns](e,t){this[ye]===void 0&&(this[ye]=!1);let i;try{i=new le(e,t,this[Z],this[We])}catch(s){return this.warn("TAR_ENTRY_INVALID",s)}if(i.nullBlock)this[gt]?(this[wt]=!0,this[B]==="begin"&&(this[B]="header"),this[pe]("eof")):(this[gt]=!0,this[pe]("nullBlock"));else if(this[gt]=!1,!i.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i});else if(!i.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else{let s=i.type;if(/^(Symbolic)?Link$/.test(s)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(!/^(Symbolic)?Link$/.test(s)&&!/^(Global)?ExtendedHeader$/.test(s)&&i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i});else{let r=this[me]=new Zi(i,this[Z],this[We]);this[ye]||(r.remain?r.on("end",()=>{r.invalid||(this[ye]=!0)}):this[ye]=!0),r.meta?r.size>this.maxMetaEntrySize?(r.ignore=!0,this[pe]("ignoredEntry",r),this[B]="ignore",r.resume()):r.size>0&&(this[Q]="",r.on("data",h=>this[Q]+=h),this[B]="meta"):(this[Z]=void 0,r.ignore=r.ignore||!this.filter(r.path,r),r.ignore?(this[pe]("ignoredEntry",r),this[B]=r.remain?"ignore":"header",r.resume()):(r.remain?this[B]="body":(this[B]="header",r.end()),this[V]?this[K].push(r):(this[K].push(r),this[ii]())))}}}[os](){queueMicrotask(()=>this.emit("close"))}[ss](e){let t=!0;if(!e)this[V]=void 0,t=!1;else if(Array.isArray(e)){let[i,...s]=e;this.emit(i,...s)}else this[V]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[ii]()),t=!1);return t}[ii](){do;while(this[ss](this[K].shift()));if(this[K].length===0){let e=this[V];!e||e.flowing||e.size===e.remain?this[Te]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[ri](e,t){let i=this[me];if(!i)throw Error("attempt to consume body without entry??");let s=i.blockRemain??0,r=s>=e.length&&t===0?e:e.subarray(t,t+s);return i.write(r),i.blockRemain||(this[B]="header",this[me]=void 0,i.end()),r.length}[hs](e,t){let i=this[me],s=this[ri](e,t);return!this[me]&&i&&this[rs](i),s}[pe](e,t,i){this[K].length===0&&!this[V]?this.emit(e,t,i):this[K].push([e,t,i])}[rs](e){switch(this[pe]("meta",this[Q]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[Z]=ht.parse(this[Q],this[Z],!1);break;case"GlobalExtendedHeader":this[We]=ht.parse(this[Q],this[We],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[Z]??Object.create(null);this[Z]=t,t.path=this[Q].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[Z]||Object.create(null);this[Z]=t,t.linkpath=this[Q].replace(/\0.*/,"");break}default:throw Error("unknown meta: "+e.type)}}abort(e){this[te]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,t,i){if(typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this[te])return i?.(),!1;if((this[S]===void 0||this.brotli===void 0&&this[S]===!1)&&e){if(this[E]&&(e=Buffer.concat([this[E],e]),this[E]=void 0),e.length<gh)return this[E]=e,i?.(),!0;for(let n=0;this[S]===void 0&&n<Ei.length;n++)e[n]!==Ei[n]&&(this[S]=!1);let r=!1;if(this[S]===!1&&this.zstd!==!1){r=!0;for(let n=0;n<gi.length;n++)if(e[n]!==gi[n]){r=!1;break}}let h=this.brotli===void 0&&!r;if(this[S]===!1&&h)if(e.length<512)if(this[ee])this.brotli=!0;else return this[E]=e,i?.(),!0;else try{new le(e.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[S]===void 0||this[S]===!1&&(this.brotli||r)){let n=this[ee];this[ee]=!1,this[S]=this[S]===void 0?new Vr({}):r?new Jr({}):new Xr({}),this[S].on("data",l=>this[pt](l)),this[S].on("error",l=>this.abort(l)),this[S].on("end",()=>{this[ee]=!0,this[pt]()}),this[Te]=!0;let a=!!this[S][n?"end":"write"](e);return this[Te]=!1,i?.(),a}}this[Te]=!0,this[S]?this[S].write(e):this[pt](e),this[Te]=!1;let s=this[K].length>0?!1:this[V]?this[V].flowing:!0;return!s&&this[K].length===0&&this[V]?.once("drain",()=>this.emit("drain")),i?.(),s}[hi](e){e&&!this[te]&&(this[E]=this[E]?Buffer.concat([this[E],e]):e)}[bt](){if(this[ee]&&!this[si]&&!this[te]&&!this[Ge]){this[si]=!0;let e=this[me];if(e&&e.blockRemain){let t=this[E]?this[E].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${t} available)`,{entry:e}),this[E]&&e.write(this[E]),e.end()}this[pe](Et)}}[pt](e){if(this[Ge]&&e)this[hi](e);else if(!e&&!this[E])this[bt]();else if(e){if(this[Ge]=!0,this[E]){this[hi](e);let t=this[E];this[E]=void 0,this[yt](t)}else this[yt](e);for(;this[E]&&this[E]?.length>=512&&!this[te]&&!this[wt];){let t=this[E];this[E]=void 0,this[yt](t)}this[Ge]=!1}(!this[E]||this[ee])&&this[bt]()}[yt](e){let t=0,i=e.length;for(;t+512<=i&&!this[te]&&!this[wt];)switch(this[B]){case"begin":case"header":this[ns](e,t),t+=512;break;case"ignore":case"body":t+=this[ri](e,t);break;case"meta":t+=this[hs](e,t);break;default:throw Error("invalid state: "+this[B])}t<i&&(this[E]=this[E]?Buffer.concat([e.subarray(t),this[E]]):e.subarray(t))}end(e,t,i){return typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t)),i&&this.once("finish",i),this[te]||(this[S]?(e&&this[S].write(e),this[S].end()):(this[ee]=!0,(this.brotli===void 0||this.zstd===void 0)&&(e||=Buffer.alloc(0)),e&&this.write(e),this[bt]())),this}},Je=o(e=>{let t=e.length-1,i=-1;for(;t>-1&&e.charAt(t)==="/";)i=t,t--;return i===-1?e:e.slice(0,i)},"Yn"),Rh=o(e=>{let t=e.onReadEntry;e.onReadEntry=t?i=>{t(i),i.resume()}:i=>i.resume()},"Xn"),Wi=o((e,t)=>{let i=new Map(t.map(h=>[Je(h),!0])),s=e.filter,r=o((h,n="")=>{let a=n||Er(h).root||".",l;if(h===a)l=!1;else{let u=i.get(h);l=u===void 0?r(gr(h),a):u}return i.set(h,l),l},"i");e.filter=s?(h,n)=>s(h,n)&&r(Je(h)):h=>r(Je(h))},"Zn"),Ce=nt(e=>{let t=new Ie(e),i=e.file,s;try{s=d.openSync(i,"r");let r=d.fstatSync(s),h=e.maxReadSize||16*1024*1024;if(r.size<h){let n=Buffer.allocUnsafe(r.size),a=d.readSync(s,n,0,r.size,0);t.end(a===n.byteLength?n:n.subarray(0,a))}else{let n=0,a=Buffer.allocUnsafe(h);for(;n<r.size;){let l=d.readSync(s,a,0,h,n);if(l===0)break;n+=l,t.write(a.subarray(0,l))}t.end()}}finally{if(typeof s=="number")try{d.closeSync(s)}catch{}}},(e,t)=>{let i=new Ie(e),s=e.maxReadSize||16*1024*1024,r=e.file;return new Promise((h,n)=>{i.on("error",n),i.on("end",h),d.stat(r,(a,l)=>{if(a)n(a);else{let u=new zi(r,{readSize:s,size:l.size});u.on("error",n),u.pipe(i)}})})},e=>new Ie(e),e=>new Ie(e),(e,t)=>{t?.length&&Wi(e,t),e.noResume||Rh(e)}),Zs=o((e,t,i)=>(e&=4095,i&&(e=(e|384)&-19),t&&(e&256&&(e|=64),e&32&&(e|=8),e&4&&(e|=1)),e),"$n"),{isAbsolute:_h,parse:as}=pr,Gi=o(e=>{let t="",i=as(e);for(;_h(e)||i.root;){let s=e.charAt(0)==="/"&&e.slice(0,4)!=="//?/"?"/":i.root;e=e.slice(s.length),t+=s,i=as(e)}return[t,e]},"nr"),zt=["|","<",">","?",":"],$i=zt.map(e=>String.fromCodePoint(61440+Number(e.codePointAt(0)))),Sh=new Map(zt.map((e,t)=>[e,$i[t]])),vh=new Map($i.map((e,t)=>[e,zt[t]])),ls=o(e=>zt.reduce((t,i)=>t.split(i).join(Sh.get(i)),e),"sr"),Oh=o(e=>$i.reduce((t,i)=>t.split(i).join(vh.get(i)),e),"cr"),Ws=o((e,t)=>t?(e=c(e).replace(/^\.(\/|$)/,""),Je(t)+"/"+e):c(e),"lr"),Th=16*1024*1024,ds=Symbol("process"),us=Symbol("file"),fs=Symbol("directory"),wi=Symbol("symlink"),cs=Symbol("hardlink"),$e=Symbol("header"),Ot=Symbol("read"),Ri=Symbol("lstat"),Tt=Symbol("onlstat"),_i=Symbol("onread"),Si=Symbol("onreadlink"),vi=Symbol("openfile"),Oi=Symbol("onopenfile"),he=Symbol("close"),It=Symbol("mode"),Ti=Symbol("awaitDrain"),ni=Symbol("ondrain"),W=Symbol("prefix"),Yi=class extends Se{static{f(this,"We")}static{o(this,"Dr")}path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#e=!1;constructor(e,t={}){let i=Ui(t);super(),this.path=c(e),this.portable=!!i.portable,this.maxReadSize=i.maxReadSize||Th,this.linkCache=i.linkCache||new Map,this.statCache=i.statCache||new Map,this.preservePaths=!!i.preservePaths,this.cwd=c(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?c(i.prefix):void 0,this.onWriteEntry=i.onWriteEntry,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let s=!1;if(!this.preservePaths){let[h,n]=Gi(this.path);h&&typeof n=="string"&&(this.path=n,s=h)}this.win32=!!i.win32||process.platform==="win32",this.win32&&(this.path=Oh(this.path.replaceAll(/\\/g,"/")),e=e.replaceAll(/\\/g,"/")),this.absolute=c(i.absolute||rt.resolve(this.cwd,e)),this.path===""&&(this.path="./"),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path});let r=this.statCache.get(this.absolute);r?this[Tt](r):this[Ri]()}warn(e,t,i={}){return Pt(this,e,t,i)}emit(e,...t){return e==="error"&&(this.#e=!0),super.emit(e,...t)}[Ri](){b.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Tt](t)})}[Tt](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=kh(e),this.emit("stat",e),this[ds]()}[ds](){switch(this.type){case"File":return this[us]();case"Directory":return this[fs]();case"SymbolicLink":return this[wi]();default:return this.end()}}[It](e){return Zs(e,this.type==="Directory",this.portable)}[W](e){return Ws(e,this.prefix)}[$e](){if(!this.stat)throw Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new le({path:this[W](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[W](this.linkpath):this.linkpath,mode:this[It](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new ht({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[W](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[W](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw Error("failed to encode header");super.write(e)}[fs](){if(!this.stat)throw Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[$e](),this.end()}[wi](){b.readlink(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Si](t)})}[Si](e){this.linkpath=c(e),this[$e](),this.end()}[cs](e){if(!this.stat)throw Error("cannot create link entry without stat");this.type="Link",this.linkpath=c(rt.relative(this.cwd,e)),this.stat.size=0,this[$e](),this.end()}[us](){if(!this.stat)throw Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,t=this.linkCache.get(e);if(t?.indexOf(this.cwd)===0)return this[cs](t);this.linkCache.set(e,this.absolute)}if(this[$e](),this.stat.size===0)return this.end();this[vi]()}[vi](){b.open(this.absolute,"r",(e,t)=>{if(e)return this.emit("error",e);this[Oi](t)})}[Oi](e){if(this.fd=e,this.#e)return this[he]();if(!this.stat)throw Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let t=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(t),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[Ot]()}[Ot](){let{fd:e,buf:t,offset:i,length:s,pos:r}=this;if(e===void 0||t===void 0)throw Error("cannot read file without first opening");b.read(e,t,i,s,r,(h,n)=>{if(h)return this[he](()=>this.emit("error",h));this[_i](n)})}[he](e=()=>{}){this.fd!==void 0&&b.close(this.fd,e)}[_i](e){if(e<=0&&this.remain>0){let i=Object.assign(Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[he](()=>this.emit("error",i))}if(e>this.remain){let i=Object.assign(Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[he](()=>this.emit("error",i))}if(!this.buf)throw Error("should have created buffer prior to reading");if(e===this.remain)for(let i=e;i<this.length&&e<this.blockRemain;i++)this.buf[i+this.offset]=0,e++,this.remain++;let t=this.offset===0&&e===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+e);this.write(t)?this[ni]():this[Ti](()=>this[ni]())}[Ti](e){this.once("drain",e)}write(e,t,i){if(typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this.blockRemain<e.length){let s=Object.assign(Error("writing more data than expected"),{path:this.absolute});return this.emit("error",s)}return this.remain-=e.length,this.blockRemain-=e.length,this.pos+=e.length,this.offset+=e.length,super.write(e,null,i)}[ni](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[he](e=>e?this.emit("error",e):this.end());if(!this.buf)throw Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[Ot]()}},Gs=class extends Yi{static{f(this,"Us")}static{o(this,"Or")}sync=!0;[Ri](){this[Tt](b.lstatSync(this.absolute))}[wi](){this[Si](b.readlinkSync(this.absolute))}[vi](){this[Oi](b.openSync(this.absolute,"r"))}[Ot](){let e=!0;try{let{fd:t,buf:i,offset:s,length:r,pos:h}=this;if(t===void 0||i===void 0)throw Error("fd and buf must be set in READ method");let n=b.readSync(t,i,s,r,h);this[_i](n),e=!1}finally{if(e)try{this[he](()=>{})}catch{}}}[Ti](e){e()}[he](e=()=>{}){this.fd!==void 0&&b.closeSync(this.fd),e()}},$s=class extends Se{static{f(this,"js")}static{o(this,"kr")}blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(e,t,i={}){return Pt(this,e,t,i)}constructor(e,t={}){let i=Ui(t);super(),this.preservePaths=!!i.preservePaths,this.portable=!!i.portable,this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.onWriteEntry=i.onWriteEntry,this.readEntry=e;let{type:s}=e;if(s==="Unsupported")throw Error("writing entry that should be ignored");this.type=s,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=i.prefix,this.path=c(e.path),this.mode=e.mode===void 0?void 0:this[It](e.mode),this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:i.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath===void 0?void 0:c(e.linkpath),typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let r=!1;if(!this.preservePaths){let[n,a]=Gi(this.path);n&&typeof a=="string"&&(this.path=a,r=n)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new le({path:this[W](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[W](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),r&&this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:this,path:r+this.path}),this.header.encode()&&!this.noPax&&super.write(new ht({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[W](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[W](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let h=this.header?.block;if(!h)throw Error("failed to encode header");super.write(h),e.pipe(this)}[W](e){return Ws(e,this.prefix)}[It](e){return Zs(e,this.type==="Directory",this.portable)}write(e,t,i){typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8"));let s=e.length;if(s>this.blockRemain)throw Error("writing more to entry than is appropriate");return this.blockRemain-=s,super.write(e,i)}end(e,t,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t??"utf8")),i&&this.once("finish",i),e?super.end(e,i):super.end(i),this}},kh=o(e=>e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":"Unsupported","Ar"),Lh=class Ne{static{f(this,"Dt")}static{o(this,"e")}tail;head;length=0;static create(t=[]){return new Ne(t)}constructor(t=[]){for(let i of t)this.push(i)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw Error("removing node which does not belong to this list");let i=t.next,s=t.prev;return i&&(i.prev=s),s&&(s.next=i),t===this.head&&(this.head=i),t===this.tail&&(this.tail=s),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,i}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let i=this.head;t.list=this,t.next=i,i&&(i.prev=t),this.head=t,this.tail||=t,this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let i=this.tail;t.list=this,t.prev=i,i&&(i.next=t),this.tail=t,this.head||=t,this.length++}push(...t){for(let i=0,s=t.length;i<s;i++)Vs(this,t[i]);return this.length}unshift(...t){for(var i=0,s=t.length;i<s;i++)Ks(this,t[i]);return this.length}pop(){if(!this.tail)return;let t=this.tail.value,i=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,i.list=void 0,this.length--,t}shift(){if(!this.head)return;let t=this.head.value,i=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,i.list=void 0,this.length--,t}forEach(t,i){i||=this;for(let s=this.head,r=0;s;r++)t.call(i,s.value,r,this),s=s.next}forEachReverse(t,i){i||=this;for(let s=this.tail,r=this.length-1;s;r--)t.call(i,s.value,r,this),s=s.prev}get(t){let i=0,s=this.head;for(;s&&i<t;i++)s=s.next;if(i===t&&s)return s.value}getReverse(t){let i=0,s=this.tail;for(;s&&i<t;i++)s=s.prev;if(i===t&&s)return s.value}map(t,i){i||=this;let s=new Ne;for(let r=this.head;r;)s.push(t.call(i,r.value,this)),r=r.next;return s}mapReverse(t,i){i||=this;var s=new Ne;for(let r=this.tail;r;)s.push(t.call(i,r.value,this)),r=r.prev;return s}reduce(t,i){let s,r=this.head;if(arguments.length>1)s=i;else if(this.head)r=this.head.next,s=this.head.value;else throw TypeError("Reduce of empty list with no initial value");for(var h=0;r;h++)s=t(s,r.value,h),r=r.next;return s}reduceReverse(t,i){let s,r=this.tail;if(arguments.length>1)s=i;else if(this.tail)r=this.tail.prev,s=this.tail.value;else throw TypeError("Reduce of empty list with no initial value");for(let h=this.length-1;r;h--)s=t(s,r.value,h),r=r.prev;return s}toArray(){let t=Array(this.length);for(let i=0,s=this.head;s;i++)t[i]=s.value,s=s.next;return t}toArrayReverse(){let t=Array(this.length);for(let i=0,s=this.tail;s;i++)t[i]=s.value,s=s.prev;return t}slice(t=0,i=this.length){i<0&&(i+=this.length),t<0&&(t+=this.length);let s=new Ne;if(i<t||i<0)return s;t<0&&(t=0),i>this.length&&(i=this.length);let r=this.head,h=0;for(h=0;r&&h<t;h++)r=r.next;for(;r&&h<i;h++,r=r.next)s.push(r.value);return s}sliceReverse(t=0,i=this.length){i<0&&(i+=this.length),t<0&&(t+=this.length);let s=new Ne;if(i<t||i<0)return s;t<0&&(t=0),i>this.length&&(i=this.length);let r=this.length,h=this.tail;for(;h&&r>i;r--)h=h.prev;for(;h&&r>t;r--,h=h.prev)s.push(h.value);return s}splice(t,i=0,...s){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let r=this.head;for(let n=0;r&&n<t;n++)r=r.next;let h=[];for(let n=0;r&&n<i;n++)h.push(r.value),r=this.removeNode(r);r?r!==this.tail&&(r=r.prev):r=this.tail;for(let n of s)r=Ys(this,r,n);return h}reverse(){let t=this.head,i=this.tail;for(let s=t;s;s=s.prev){let r=s.prev;s.prev=s.next,s.next=r}return this.head=i,this.tail=t,this}};function Ys(e,t,i){let s=new Vi(i,t,t?t.next:e.head,e);return s.next===void 0&&(e.tail=s),s.prev===void 0&&(e.head=s),e.length++,s}f(Ys,"wh");o(Ys,"Mr");function Vs(e,t){e.tail=new Vi(t,e.tail,void 0,e),e.head||=e.tail,e.length++}f(Vs,"Rh");o(Vs,"Nr");function Ks(e,t){e.head=new Vi(t,void 0,e.head,e),e.tail||=e.head,e.length++}f(Ks,"_h");o(Ks,"Pr");var Vi=class{static{f(this,"Ge")}static{o(this,"Fr")}list;next;prev;value;constructor(e,t,i,s){this.list=s,this.value=e,t?(t.next=this,this.prev=t):this.prev=void 0,i?(i.prev=this,this.next=i):this.next=void 0}},ki=class{static{f(this,"ve")}static{o(this,"Ir")}path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(e,t){this.path=e||"./",this.absolute=t}},ms=Buffer.alloc(1024),kt=Symbol("onStat"),Ye=Symbol("ended"),M=Symbol("queue"),be=Symbol("current"),Ee=Symbol("process"),Ve=Symbol("processing"),oi=Symbol("processJob"),P=Symbol("jobs"),ai=Symbol("jobDone"),Lt=Symbol("addFSEntry"),ps=Symbol("addTarEntry"),Li=Symbol("stat"),xi=Symbol("readdir"),xt=Symbol("onreaddir"),At=Symbol("pipe"),ys=Symbol("entry"),li=Symbol("entryOpt"),Dt=Symbol("writeEntryClass"),Xs=Symbol("write"),di=Symbol("ondrain"),ot=class extends Se{static{f(this,"si")}static{o(this,"ni")}sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[Dt];onWriteEntry;[M];[P]=0;[Ve]=!1;[Ye]=!1;constructor(e={}){if(super(),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=c(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this.onWriteEntry=e.onWriteEntry,this[Dt]=Yi,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,e.gzip||e.brotli||e.zstd){if((e.gzip?1:0)+(e.brotli?1:0)+(e.zstd?1:0)>1)throw TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new Yr(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new Kr(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new qr(e.zstd)),!this.zip)throw Error("impossible");let t=this.zip;t.on("data",i=>super.write(i)),t.on("end",()=>super.end()),t.on("drain",()=>this[di]()),this.on("resume",()=>t.resume())}else this.on("drain",this[di]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[M]=new Lh,this[P]=0,this.jobs=Number(e.jobs)||4,this[Ve]=!1,this[Ye]=!1}[Xs](e){return super.write(e)}add(e){return this.write(e),this}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t=void 0),e&&this.add(e),this[Ye]=!0,this[Ee](),i&&i(),this}write(e){if(this[Ye])throw Error("write after end");return e instanceof Zi?this[ps](e):this[Lt](e),this.flowing}[ps](e){let t=c(rt.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let i=new ki(e.path,t);i.entry=new $s(e,this[li](i)),i.entry.on("end",()=>this[ai](i)),this[P]+=1,this[M].push(i)}this[Ee]()}[Lt](e){let t=c(rt.resolve(this.cwd,e));this[M].push(new ki(e,t)),this[Ee]()}[Li](e){e.pending=!0,this[P]+=1,b[this.follow?"stat":"lstat"](e.absolute,(t,i)=>{e.pending=!1,--this[P],t?this.emit("error",t):this[kt](e,i)})}[kt](e,t){this.statCache.set(e.absolute,t),e.stat=t,this.filter(e.path,t)?t.isFile()&&t.nlink>1&&e===this[be]&&!this.linkCache.get(`${t.dev}:${t.ino}`)&&!this.sync&&this[oi](e):e.ignore=!0,this[Ee]()}[xi](e){e.pending=!0,this[P]+=1,b.readdir(e.absolute,(t,i)=>{if(e.pending=!1,--this[P],t)return this.emit("error",t);this[xt](e,i)})}[xt](e,t){this.readdirCache.set(e.absolute,t),e.readdir=t,this[Ee]()}[Ee](){if(!this[Ve]){this[Ve]=!0;for(let e=this[M].head;e&&this[P]<this.jobs;e=e.next)if(this[oi](e.value),e.value.ignore){let t=e.next;this[M].removeNode(e),e.next=t}this[Ve]=!1,this[Ye]&&this[M].length===0&&this[P]===0&&(this.zip?this.zip.end(ms):(super.write(ms),super.end()))}}get[be](){return this[M]&&this[M].head&&this[M].head.value}[ai](e){this[M].shift(),--this[P],this[Ee]()}[oi](e){if(!e.pending){if(e.entry){e===this[be]&&!e.piped&&this[At](e);return}if(!e.stat){let t=this.statCache.get(e.absolute);t?this[kt](e,t):this[Li](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let t=this.readdirCache.get(e.absolute);if(t?this[xt](e,t):this[xi](e),!e.readdir)return}if(e.entry=this[ys](e),!e.entry){e.ignore=!0;return}e===this[be]&&!e.piped&&this[At](e)}}}[li](e){return{onwarn:o((t,i,s)=>this.warn(t,i,s),"onwarn"),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[ys](e){this[P]+=1;try{return new this[Dt](e.path,this[li](e)).on("end",()=>this[ai](e)).on("error",t=>this.emit("error",t))}catch(t){this.emit("error",t)}}[di](){this[be]&&this[be].entry&&this[be].entry.resume()}[At](e){e.piped=!0,e.readdir&&e.readdir.forEach(s=>{let r=e.path,h=r==="./"?"":r.replace(/\/*$/,"/");this[Lt](h+s)});let t=e.entry,i=this.zip;if(!t)throw Error("cannot pipe without source");i?t.on("data",s=>{i.write(s)||t.pause()}):t.on("data",s=>{super.write(s)||t.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,t,i={}){Pt(this,e,t,i)}},Ut=class extends ot{static{f(this,"Mi")}static{o(this,"ri")}sync=!0;constructor(e){super(e),this[Dt]=Gs}pause(){}resume(){}[Li](e){let t=this.follow?"statSync":"lstatSync";this[kt](e,b[t](e.absolute))}[xi](e){this[xt](e,b.readdirSync(e.absolute))}[At](e){let t=e.entry,i=this.zip;if(e.readdir&&e.readdir.forEach(s=>{let r=e.path,h=r==="./"?"":r.replace(/\/*$/,"/");this[Lt](h+s)}),!t)throw Error("Cannot pipe without source");i?t.on("data",s=>{i.write(s)}):t.on("data",s=>{super[Xs](s)})}},xh=o((e,t)=>{let i=new Ut(e),s=new Fs(e.file,{mode:e.mode||438});i.pipe(s),qs(i,t)},"ii"),Ah=o((e,t)=>{let i=new ot(e),s=new Ct(e.file,{mode:e.mode||438});i.pipe(s);let r=new Promise((h,n)=>{s.on("error",n),s.on("close",h),i.on("error",n)});return Js(i,t).catch(h=>i.emit("error",h)),r},"ai"),qs=o((e,t)=>{t.forEach(i=>{i.charAt(0)==="@"?Ce({file:p.resolve(e.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:o(s=>e.add(s),"onReadEntry")}):e.add(i)}),e.end()},"oi"),Js=o(async(e,t)=>{for(let i of t)i.charAt(0)==="@"?await Ce({file:p.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:o(s=>{e.add(s)},"onReadEntry")}):e.add(i);e.end()},"si"),bs=nt(xh,Ah,(e,t)=>{let i=new Ut(e);return qs(i,t),i},(e,t)=>{let i=new ot(e);return Js(i,t).catch(s=>i.emit("error",s)),i},(e,t)=>{if(!t?.length)throw TypeError("no paths specified to add to archive")}),Qs=(process.env.__FAKE_PLATFORM__||process.platform)==="win32",{O_CREAT:er,O_NOFOLLOW:Es,O_TRUNC:tr,O_WRONLY:ir}=b.constants,sr=Number(process.env.__FAKE_FS_O_FILENAME__)||b.constants.UV_FS_O_FILEMAP||0,Dh=Qs&&!!sr,Nh=512*1024,Ih=sr|tr|er|ir,gs=!Qs&&typeof Es=="number"?Es|tr|er|ir:null,rr=gs===null?Dh?e=>e<Nh?Ih:"w":()=>"w":()=>gs,Ai=o((e,t,i)=>{try{return d.lchownSync(e,t,i)}catch(s){if(s?.code!=="ENOENT")throw s}},"bi"),Bt=o((e,t,i,s)=>{d.lchown(e,t,i,r=>{s(r&&r?.code!=="ENOENT"?r:null)})},"xi"),Bh=o((e,t,i,s,r)=>{t.isDirectory()?hr(p.resolve(e,t.name),i,s,h=>{if(h)return r(h);Bt(p.resolve(e,t.name),i,s,r)}):Bt(p.resolve(e,t.name),i,s,r)},"Si"),hr=o((e,t,i,s)=>{d.readdir(e,{withFileTypes:!0},(r,h)=>{if(r){if(r.code==="ENOENT")return s();if(r.code!=="ENOTDIR"&&r.code!=="ENOTSUP")return s(r)}if(r||!h.length)return Bt(e,t,i,s);let n=h.length,a=null,l=o(u=>{if(!a){if(u)return s(a=u);if(--n===0)return Bt(e,t,i,s)}},"c");for(let u of h)Bh(e,u,t,i,l)})},"Ci"),Fh=o((e,t,i,s)=>{t.isDirectory()&&nr(p.resolve(e,t.name),i,s),Ai(p.resolve(e,t.name),i,s)},"wi"),nr=o((e,t,i)=>{let s;try{s=d.readdirSync(e,{withFileTypes:!0})}catch(r){let h=r;if(h?.code==="ENOENT")return;if(h?.code==="ENOTDIR"||h?.code==="ENOTSUP")return Ai(e,t,i);throw h}for(let r of s)Fh(e,r,t,i);return Ai(e,t,i)},"Ti"),or=class extends Error{static{f(this,"Js")}static{o(this,"Ei")}path;code;syscall="chdir";constructor(e,t){super(`${t}: Cannot cd into '${e}'`),this.path=e,this.code=t}get name(){return"CwdError"}},jt=class extends Error{static{f(this,"Pi")}static{o(this,"Di")}path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,t){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=t}get name(){return"SymlinkError"}},Ch=o((e,t)=>{d.stat(e,(i,s)=>{(i||!s.isDirectory())&&(i=new or(e,i?.code||"ENOTDIR")),t(i)})},"Oi"),Mh=o((e,t,i)=>{e=c(e);let s=t.umask??18,r=t.mode|448,h=(r&s)!==0,n=t.uid,a=t.gid,l=typeof n=="number"&&typeof a=="number"&&(n!==t.processUid||a!==t.processGid),u=t.preserve,m=t.unlink,g=c(t.cwd),w=o((L,_)=>{L?i(L):_&&l?hr(_,n,a,x=>w(x)):h?d.chmod(e,r,i):i()},"m");if(e===g)return Ch(e,w);if(u)return cr.mkdir(e,{mode:r,recursive:!0}).then(L=>w(null,L??void 0),w);Di(g,c(p.relative(g,e)).split("/"),r,m,g,void 0,w)},"ki"),Di=o((e,t,i,s,r,h,n)=>{if(t.length===0)return n(null,h);let a=t.shift(),l=c(p.resolve(e+"/"+a));d.mkdir(l,i,ar(l,t,i,s,r,h,n))},"Ai"),ar=o((e,t,i,s,r,h,n)=>a=>{a?d.lstat(e,(l,u)=>{if(l)l.path=l.path&&c(l.path),n(l);else if(u.isDirectory())Di(e,t,i,s,r,h,n);else if(s)d.unlink(e,m=>{if(m)return n(m);d.mkdir(e,i,ar(e,t,i,s,r,h,n))});else{if(u.isSymbolicLink())return n(new jt(e,e+"/"+t.join("/")));n(a)}}):(h||=e,Di(e,t,i,s,r,h,n))},"ji"),Ph=o(e=>{let t=!1,i;try{t=d.statSync(e).isDirectory()}catch(s){i=s?.code}finally{if(!t)throw new or(e,i??"ENOTDIR")}},"Mi"),zh=o((e,t)=>{e=c(e);let i=t.umask??18,s=t.mode|448,r=(s&i)!==0,h=t.uid,n=t.gid,a=typeof h=="number"&&typeof n=="number"&&(h!==t.processUid||n!==t.processGid),l=t.preserve,u=t.unlink,m=c(t.cwd),g=o(_=>{_&&a&&nr(_,h,n),r&&d.chmodSync(e,s)},"ee");if(e===m)return Ph(m),g();if(l)return g(d.mkdirSync(e,{mode:s,recursive:!0})??void 0);let w=c(p.relative(m,e)).split("/"),L;for(let _=w.shift(),x=m;_&&(x+="/"+_);_=w.shift()){x=c(p.resolve(x));try{d.mkdirSync(x,s),L||=x}catch{let Ki=d.lstatSync(x);if(Ki.isDirectory())continue;if(u){d.unlinkSync(x),d.mkdirSync(x,s),L||=x;continue}else if(Ki.isSymbolicLink())return new jt(x,x+"/"+w.join("/"))}}return g(L)},"Ni"),ui=Object.create(null),ws=1e4,ke=new Set,Uh=o(e=>{ke.has(e)?ke.delete(e):ui[e]=e.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),ke.add(e);let t=ui[e],i=ke.size-ws;if(i>ws/10){for(let s of ke)if(ke.delete(s),delete ui[s],--i<=0)break}return t},"Li"),jh=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",Hh=o(e=>e.split("/").slice(0,-1).reduce((t,i)=>{let s=t.at(-1);return s!==void 0&&(i=Ds(s,i)),t.push(i||"/"),t},[]),"zi"),Zh=class{static{f(this,"Mh")}static{o(this,"Bi")}#e=new Map;#i=new Map;#s=new Set;reserve(e,t){e=jh?["win32 parallelization disabled"]:e.map(s=>Je(Ds(Uh(s))));let i=new Set(e.map(s=>Hh(s)).reduce((s,r)=>s.concat(r)));this.#i.set(t,{dirs:i,paths:e});for(let s of e){let r=this.#e.get(s);r?r.push(t):this.#e.set(s,[t])}for(let s of i){let r=this.#e.get(s);if(!r)this.#e.set(s,[new Set([t])]);else{let h=r.at(-1);h instanceof Set?h.add(t):r.push(new Set([t]))}}return this.#r(t)}#h(e){let t=this.#i.get(e);if(!t)throw Error("function does not have any path reservations");return{paths:t.paths.map(i=>this.#e.get(i)),dirs:[...t.dirs].map(i=>this.#e.get(i))}}check(e){let{paths:t,dirs:i}=this.#h(e);return t.every(s=>s&&s[0]===e)&&i.every(s=>s&&s[0]instanceof Set&&s[0].has(e))}#r(e){return this.#s.has(e)||!this.check(e)?!1:(this.#s.add(e),e(()=>this.#t(e)),!0)}#t(e){if(!this.#s.has(e))return!1;let t=this.#i.get(e);if(!t)throw Error("invalid reservation");let{paths:i,dirs:s}=t,r=new Set;for(let h of i){let n=this.#e.get(h);if(!n||n?.[0]!==e)continue;let a=n[1];if(!a){this.#e.delete(h);continue}if(n.shift(),typeof a=="function")r.add(a);else for(let l of a)r.add(l)}for(let h of s){let n=this.#e.get(h),a=n?.[0];if(!(!n||!(a instanceof Set)))if(a.size===1&&n.length===1){this.#e.delete(h);continue}else if(a.size===1){n.shift();let l=n[0];typeof l=="function"&&r.add(l)}else a.delete(e)}return this.#s.delete(e),r.forEach(h=>this.#r(h)),!0}},Wh=o(()=>process.umask(),"Vi"),Rs=Symbol("onEntry"),Ni=Symbol("checkFs"),_s=Symbol("checkFs2"),Ii=Symbol("isReusable"),F=Symbol("makeFs"),Bi=Symbol("file"),Fi=Symbol("directory"),Nt=Symbol("link"),Ss=Symbol("symlink"),vs=Symbol("hardlink"),Xe=Symbol("ensureNoSymlink"),Os=Symbol("unsupported"),Ts=Symbol("checkPath"),fi=Symbol("stripAbsolutePath"),ne=Symbol("mkdir"),k=Symbol("onError"),Rt=Symbol("pending"),ks=Symbol("pend"),Le=Symbol("unpend"),ci=Symbol("ended"),mi=Symbol("maybeClose"),Ci=Symbol("skip"),Qe=Symbol("doChown"),et=Symbol("uid"),tt=Symbol("gid"),it=Symbol("checkedCwd"),st=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",Gh=1024,$h=o((e,t)=>{if(!st)return d.unlink(e,t);let i=e+".DELETE."+Is(16).toString("hex");d.rename(e,i,s=>{if(s)return t(s);d.unlink(i,t)})},"ma"),Yh=o(e=>{if(!st)return d.unlinkSync(e);let t=e+".DELETE."+Is(16).toString("hex");d.renameSync(e,t),d.unlinkSync(t)},"ha"),Ls=o((e,t,i)=>e!==void 0&&e===e>>>0?e:t!==void 0&&t===t>>>0?t:i,"ga"),Ft=class extends Ie{static{f(this,"Ni")}static{o(this,"_a")}[ci]=!1;[it]=!1;[Rt]=0;reservations=new Zh;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[ci]=!0,this[mi]()},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=e.preserveOwner===void 0&&typeof e.uid!="number"?!!(process.getuid&&process.getuid()===0):!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:Gh,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||st,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=c(p.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:Wh():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",t=>this[Rs](t))}warn(e,t,i={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(i.recoverable=!1),super.warn(e,t,i)}[mi](){this[ci]&&this[Rt]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[fi](e,t){let i=e[t],{type:s}=e;if(!i||this.preservePaths)return!0;let[r,h]=Gi(i),n=h.replaceAll(/\\/g,"/").split("/");if(n.includes("..")||st&&/^[a-z]:\.\.$/i.test(n[0]??"")){if(t==="path"||s==="Link")return this.warn("TAR_ENTRY_ERROR",`${t} contains '..'`,{entry:e,[t]:i}),!1;let a=p.posix.dirname(e.path),l=p.posix.normalize(p.posix.join(a,n.join("/")));if(l.startsWith("../")||l==="..")return this.warn("TAR_ENTRY_ERROR",`${t} escapes extraction directory`,{entry:e,[t]:i}),!1}return r&&(e[t]=String(h),this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute ${t}`,{entry:e,[t]:i})),!0}[Ts](e){let t=c(e.path),i=t.split("/");if(this.strip){if(i.length<this.strip)return!1;if(e.type==="Link"){let s=c(String(e.linkpath)).split("/");if(s.length>=this.strip)e.linkpath=s.slice(this.strip).join("/");else return!1}i.splice(0,this.strip),e.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:t,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this[fi](e,"path")||!this[fi](e,"linkpath"))return!1;if(e.absolute=p.isAbsolute(e.path)?c(p.resolve(e.path)):c(p.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:c(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:s}=p.win32.parse(String(e.absolute));e.absolute=s+ls(String(e.absolute).slice(s.length));let{root:r}=p.win32.parse(e.path);e.path=r+ls(e.path.slice(r.length))}return!0}[Rs](e){if(!this[Ts](e))return e.resume();switch(Rr.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode|=448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Ni](e);default:return this[Os](e)}}[k](e,t){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:t}),this[Le](),t.resume())}[ne](e,t,i){Mh(c(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t},i)}[Qe](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[et](e){return Ls(this.uid,e.uid,this.processUid)}[tt](e){return Ls(this.gid,e.gid,this.processGid)}[Bi](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.fmode,s=new Ct(String(e.absolute),{flags:rr(e.size),mode:i,autoClose:!1});s.on("error",a=>{s.fd&&d.close(s.fd,()=>{}),s.write=()=>!0,this[k](a,e),t()});let r=1,h=o(a=>{if(a){s.fd&&d.close(s.fd,()=>{}),this[k](a,e),t();return}--r===0&&s.fd!==void 0&&d.close(s.fd,l=>{l?this[k](l,e):this[Le](),t()})},"o");s.on("finish",()=>{let a=String(e.absolute),l=s.fd;if(typeof l=="number"&&e.mtime&&!this.noMtime){r++;let u=e.atime||new Date,m=e.mtime;d.futimes(l,u,m,g=>g?d.utimes(a,u,m,w=>h(w&&g)):h())}if(typeof l=="number"&&this[Qe](e)){r++;let u=this[et](e),m=this[tt](e);typeof u=="number"&&typeof m=="number"&&d.fchown(l,u,m,g=>g?d.chown(a,u,m,w=>h(w&&g)):h())}h()});let n=this.transform&&this.transform(e)||e;n!==e&&(n.on("error",a=>{this[k](a,e),t()}),e.pipe(n)),n.pipe(s)}[Fi](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.dmode;this[ne](String(e.absolute),i,s=>{if(s){this[k](s,e),t();return}let r=1,h=o(()=>{--r===0&&(t(),this[Le](),e.resume())},"a");e.mtime&&!this.noMtime&&(r++,d.utimes(String(e.absolute),e.atime||new Date,e.mtime,h)),this[Qe](e)&&(r++,d.chown(String(e.absolute),Number(this[et](e)),Number(this[tt](e)),h)),h()})}[Os](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[Ss](e,t){let i=c(p.relative(this.cwd,p.resolve(p.dirname(String(e.absolute)),String(e.linkpath)))).split("/");this[Xe](e,this.cwd,i,()=>this[Nt](e,String(e.linkpath),"symlink",t),s=>{this[k](s,e),t()})}[vs](e,t){let i=c(p.resolve(this.cwd,String(e.linkpath))),s=c(String(e.linkpath)).split("/");this[Xe](e,this.cwd,s,()=>this[Nt](e,i,"link",t),r=>{this[k](r,e),t()})}[Xe](e,t,i,s,r){let h=i.shift();if(this.preservePaths||h===void 0)return s();let n=p.resolve(t,h);d.lstat(n,(a,l)=>{if(a)return s();if(l?.isSymbolicLink())return r(new jt(n,p.resolve(n,i.join("/"))));this[Xe](e,n,i,s,r)})}[ks](){this[Rt]++}[Le](){this[Rt]--,this[mi]()}[Ci](e){this[Le](),e.resume()}[Ii](e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!st}[Ni](e){this[ks]();let t=[e.path];e.linkpath&&t.push(e.linkpath),this.reservations.reserve(t,i=>this[_s](e,i))}[_s](e,t){let i=o(n=>{t(n)},"r"),s=o(()=>{this[ne](this.cwd,this.dmode,n=>{if(n){this[k](n,e),i();return}this[it]=!0,r()})},"a"),r=o(()=>{if(e.absolute!==this.cwd){let n=c(p.dirname(String(e.absolute)));if(n!==this.cwd)return this[ne](n,this.dmode,a=>{if(a){this[k](a,e),i();return}h()})}h()},"o"),h=o(()=>{d.lstat(String(e.absolute),(n,a)=>{if(a&&(this.keep||this.newer&&a.mtime>(e.mtime??a.mtime))){this[Ci](e),i();return}if(n||this[Ii](e,a))return this[F](null,e,i);if(a.isDirectory()){if(e.type==="Directory"){let l=this.chmod&&e.mode&&(a.mode&4095)!==e.mode,u=o(m=>this[F](m??null,e,i),"a");return l?d.chmod(String(e.absolute),Number(e.mode),u):u()}if(e.absolute!==this.cwd)return d.rmdir(String(e.absolute),l=>this[F](l??null,e,i))}if(e.absolute===this.cwd)return this[F](null,e,i);$h(String(e.absolute),l=>this[F](l??null,e,i))})},"s");this[it]?r():s()}[F](e,t,i){if(e){this[k](e,t),i();return}switch(t.type){case"File":case"OldFile":case"ContiguousFile":return this[Bi](t,i);case"Link":return this[vs](t,i);case"SymbolicLink":return this[Ss](t,i);case"Directory":case"GNUDumpDir":return this[Fi](t,i)}}[Nt](e,t,i,s){d[i](t,String(e.absolute),r=>{r?this[k](r,e):(this[Le](),e.resume()),s()})}},Ke=o(e=>{try{return[null,e()]}catch(t){return[t,null]}},"va"),Mi=class extends Ft{static{f(this,"Be")}static{o(this,"ya")}sync=!0;[F](e,t){return super[F](e,t,()=>{})}[Ni](e){if(!this[it]){let r=this[ne](this.cwd,this.dmode);if(r)return this[k](r,e);this[it]=!0}if(e.absolute!==this.cwd){let r=c(p.dirname(String(e.absolute)));if(r!==this.cwd){let h=this[ne](r,this.dmode);if(h)return this[k](h,e)}}let[t,i]=Ke(()=>d.lstatSync(String(e.absolute)));if(i&&(this.keep||this.newer&&i.mtime>(e.mtime??i.mtime)))return this[Ci](e);if(t||this[Ii](e,i))return this[F](null,e);if(i.isDirectory()){if(e.type==="Directory"){let[h]=this.chmod&&e.mode&&(i.mode&4095)!==e.mode?Ke(()=>{d.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[F](h,e)}let[r]=Ke(()=>d.rmdirSync(String(e.absolute)));this[F](r,e)}let[s]=e.absolute===this.cwd?[]:Ke(()=>Yh(String(e.absolute)));this[F](s,e)}[Bi](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.fmode,s=o(n=>{let a;try{d.closeSync(r)}catch(l){a=l}(n||a)&&this[k](n||a,e),t()},"i"),r;try{r=d.openSync(String(e.absolute),rr(e.size),i)}catch(n){return s(n)}let h=this.transform&&this.transform(e)||e;h!==e&&(h.on("error",n=>this[k](n,e)),e.pipe(h)),h.on("data",n=>{try{d.writeSync(r,n,0,n.length)}catch(a){s(a)}}),h.on("end",()=>{let n=null;if(e.mtime&&!this.noMtime){let a=e.atime||new Date,l=e.mtime;try{d.futimesSync(r,a,l)}catch(u){try{d.utimesSync(String(e.absolute),a,l)}catch{n=u}}}if(this[Qe](e)){let a=this[et](e),l=this[tt](e);try{d.fchownSync(r,Number(a),Number(l))}catch(u){try{d.chownSync(String(e.absolute),Number(a),Number(l))}catch{n||=u}}}s(n)})}[Fi](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.dmode,s=this[ne](String(e.absolute),i);if(s){this[k](s,e),t();return}if(e.mtime&&!this.noMtime)try{d.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[Qe](e))try{d.chownSync(String(e.absolute),Number(this[et](e)),Number(this[tt](e)))}catch{}t(),e.resume()}[ne](e,t){try{return zh(c(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t})}catch(i){return i}}[Xe](e,t,i,s,r){if(this.preservePaths||i.length===0)return s();let h=t;for(let n of i){h=p.resolve(h,n);let[a,l]=Ke(()=>d.lstatSync(h));if(a)return s();if(l.isSymbolicLink())return r(new jt(h,p.resolve(t,i.join("/"))))}s()}[Nt](e,t,i,s){let r=`${i}Sync`;try{d[r](t,String(e.absolute)),s(),e.resume()}catch(h){return this[k](h,e)}}},xs=nt(e=>{let t=new Mi(e),i=e.file,s=d.statSync(i);new Cr(i,{readSize:e.maxReadSize||16*1024*1024,size:s.size}).pipe(t)},(e,t)=>{let i=new Ft(e),s=e.maxReadSize||16*1024*1024,r=e.file;return new Promise((h,n)=>{i.on("error",n),i.on("close",h),d.stat(r,(a,l)=>{if(a)n(a);else{let u=new zi(r,{readSize:s,size:l.size});u.on("error",n),u.pipe(i)}})})},e=>new Mi(e),e=>new Ft(e),(e,t)=>{t?.length&&Wi(e,t)}),Vh=o((e,t)=>{let i=new Ut(e),s=!0,r,h;try{try{r=d.openSync(e.file,"r+")}catch(l){if(l?.code==="ENOENT")r=d.openSync(e.file,"w+");else throw l}let n=d.fstatSync(r),a=Buffer.alloc(512);e:for(h=0;h<n.size;h+=512){for(let m=0,g=0;m<512;m+=g){if(g=d.readSync(r,a,m,a.length-m,h+m),h===0&&a[0]===31&&a[1]===139)throw Error("cannot append to compressed archives");if(!g)break e}let l=new le(a);if(!l.cksumValid)break;let u=512*Math.ceil((l.size||0)/512);if(h+u+512>n.size)break;h+=u,e.mtimeCache&&l.mtime&&e.mtimeCache.set(String(l.path),l.mtime)}s=!1,Kh(e,i,h,r,t)}finally{if(s)try{d.closeSync(r)}catch{}}},"xa"),Kh=o((e,t,i,s,r)=>{let h=new Fs(e.file,{fd:s,start:i});t.pipe(h),qh(t,r)},"Sa"),Xh=o((e,t)=>{t=Array.from(t);let i=new ot(e),s=o((r,h,n)=>{let a=o((w,L)=>{w?d.close(r,_=>n(w)):n(null,L)},"a"),l=0;if(h===0)return a(null,0);let u=0,m=Buffer.alloc(512),g=o((w,L)=>{if(w||L===void 0)return a(w);if(u+=L,u<512&&L)return d.read(r,m,u,m.length-u,l+u,g);if(l===0&&m[0]===31&&m[1]===139)return a(Error("cannot append to compressed archives"));if(u<512)return a(null,l);let _=new le(m);if(!_.cksumValid)return a(null,l);let x=512*Math.ceil((_.size??0)/512);if(l+x+512>h||(l+=x+512,l>=h))return a(null,l);e.mtimeCache&&_.mtime&&e.mtimeCache.set(String(_.path),_.mtime),u=0,d.read(r,m,0,512,l,g)},"l");d.read(r,m,0,512,l,g)},"i");return new Promise((r,h)=>{i.on("error",h);let n="r+",a=o((l,u)=>{if(l&&l.code==="ENOENT"&&n==="r+")return n="w+",d.open(e.file,n,a);if(l||!u)return h(l);d.fstat(u,(m,g)=>{if(m)return d.close(u,()=>h(m));s(u,g.size,(w,L)=>{if(w)return h(w);let _=new Ct(e.file,{fd:u,start:L});i.pipe(_),_.on("error",h),_.on("close",r),Jh(i,t)})})},"c");d.open(e.file,n,a)})},"Ca"),qh=o((e,t)=>{t.forEach(i=>{i.charAt(0)==="@"?Ce({file:p.resolve(e.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:o(s=>e.add(s),"onReadEntry")}):e.add(i)}),e.end()},"wa"),Jh=o(async(e,t)=>{for(let i of t)i.charAt(0)==="@"?await Ce({file:p.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:o(s=>e.add(s),"onReadEntry")}):e.add(i);e.end()},"Ta"),ge=nt(Vh,Xh,()=>{throw TypeError("file is required")},()=>{throw TypeError("file is required")},(e,t)=>{if(!Hr(e))throw TypeError("file is required");if(e.gzip||e.brotli||e.zstd||e.file.endsWith(".br")||e.file.endsWith(".tbr"))throw TypeError("cannot append to compressed archives");if(!t?.length)throw TypeError("no paths specified to add/replace")});nt(ge.syncFile,ge.asyncFile,ge.syncNoFile,ge.asyncNoFile,(e,t=[])=>{ge.validate?.(e,t),Qh(e)});var Qh=o(e=>{let t=e.filter;e.mtimeCache||=new Map,e.filter=t?(i,s)=>t(i,s)&&!((e.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0)):(i,s)=>!((e.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0))},"Da");export{rn as t};
@@ -0,0 +1,68 @@
1
+ var H=Object.defineProperty;var k=(e,r)=>H(e,"name",{value:r,configurable:!0});import{createRequire as B}from"node:module";import{renderToString as z,Box as U,Text as y,Table as W}from"@visulima/tui";import v from"react";import{k as K,T as G,R as Y,j as X}from"./ai-cache-Dtvmbsru.js";const F=B(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=k(e=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[r,a]=w.versions.node.split(".").map(Number);if(r>22||r===22&&a>=3||r===20&&a>=16)return w.getBuiltinModule(e)}return F(e)},"__cjs_getBuiltinModule"),{spawn:D,execFileSync:O}=$("node:child_process"),{existsSync:T}=$("node:fs"),{platform:J,homedir:R}=$("node:os"),{join:g}=$("node:path"),Q=/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/,Z=5e3,ee=1e4,re=3e5,te=4096,E=J()==="win32",M=["amp","claude","codex","copilot","crush","cursor","droid","gemini","kimi","opencode","qwen"];var ae=Object.defineProperty,ne=k((e,r)=>ae(e,"name",{value:r,configurable:!0}),"A$1"),ie=Object.defineProperty,m=ne((e,r)=>ie(e,"name",{value:r,configurable:!0}),"o"),oe=Object.defineProperty,se=m((e,r)=>oe(e,"name",{value:r,configurable:!0}),"a$6");const ce={alternateCommands:[],buildArgs:se((e,r,a)=>["-x",e,"--dangerously-allow-all"],"buildArgs"),command:"amp",defaultModel:"",envVariable:"AMP_PATH"};var le=Object.defineProperty,ue=m((e,r)=>le(e,"name",{value:r,configurable:!0}),"t$8");const de={alternateCommands:[],buildArgs:ue((e,r,a)=>["--dangerously-skip-permissions","--model",r,"--output-format","text","-p",e],"buildArgs"),command:"claude",defaultModel:"claude-sonnet-4-20250514",envVariable:"CLAUDE_PATH"};var me=Object.defineProperty,pe=m((e,r)=>me(e,"name",{value:r,configurable:!0}),"a$4");const ge={alternateCommands:["openai-codex"],buildArgs:pe((e,r,a)=>[e,"--approval-mode","full-auto","--quiet","--model",r,"--max-tokens",String(a)],"buildArgs"),command:"codex",defaultModel:"o3",envVariable:"CODEX_PATH"};var fe=Object.defineProperty,he=m((e,r)=>fe(e,"name",{value:r,configurable:!0}),"l");const ve={alternateCommands:[],buildArgs:he((e,r,a)=>{const t=["-p",e,"--allow-all-tools"];return r&&t.push("--model",r),t},"buildArgs"),command:"copilot",defaultModel:"",envVariable:"COPILOT_PATH"};var ye=Object.defineProperty,be=m((e,r)=>ye(e,"name",{value:r,configurable:!0}),"n$2");const ke={alternateCommands:[],buildArgs:be((e,r,a)=>{const t=["run","--yolo"];return r&&t.push("-m",r),t.push(e),t},"buildArgs"),command:"crush",defaultModel:"",envVariable:"CRUSH_PATH"};var we=Object.defineProperty,Ae=m((e,r)=>we(e,"name",{value:r,configurable:!0}),"t$5");const $e={alternateCommands:["cursor"],buildArgs:Ae((e,r,a)=>{const t=["-p","--force","--output-format","text"];return r&&t.push("--model",r),t.push(e),t},"buildArgs"),command:"agent",defaultModel:"",envVariable:"CURSOR_PATH"};var Se=Object.defineProperty,Pe=m((e,r)=>Se(e,"name",{value:r,configurable:!0}),"i");const Te={alternateCommands:[],buildArgs:Pe((e,r,a)=>{const t=[e,"--skip-permissions-unsafe","-o","text"];return r&&t.push("-m",r),t},"buildArgs"),command:"droid",defaultModel:"",envVariable:"DROID_PATH"};var Ce=Object.defineProperty,je=m((e,r)=>Ce(e,"name",{value:r,configurable:!0}),"o$1");const Oe={alternateCommands:["gemini-cli"],buildArgs:je((e,r,a)=>["--sandbox","--model",r,"--max-output-tokens",String(a),"-p",e],"buildArgs"),command:"gemini",defaultModel:"gemini-2.5-pro",envVariable:"GEMINI_PATH"};var Re=Object.defineProperty,Ee=m((e,r)=>Re(e,"name",{value:r,configurable:!0}),"o");const Me={alternateCommands:[],buildArgs:Ee((e,r,a)=>{const t=["--quiet","-p",e];return r&&t.push("-m",r),t},"buildArgs"),command:"kimi",defaultModel:"",envVariable:"KIMI_PATH"};var xe=Object.defineProperty,_e=m((e,r)=>xe(e,"name",{value:r,configurable:!0}),"r");const Ie={alternateCommands:[],buildArgs:_e((e,r,a)=>{const t=["run",e];return r&&t.push("-m",r),t},"buildArgs"),command:"opencode",defaultModel:"anthropic/claude-sonnet-4",envVariable:"OPENCODE_PATH"};var Ne=Object.defineProperty,Le=m((e,r)=>Ne(e,"name",{value:r,configurable:!0}),"n");const qe={alternateCommands:["qwen-code"],buildArgs:Le((e,r,a)=>["-p",e,"--yolo","-o","text"],"buildArgs"),command:"qwen",defaultModel:"",envVariable:"QWEN_PATH"};var Ve=Object.defineProperty,f=m((e,r)=>Ve(e,"name",{value:r,configurable:!0}),"s");const x={amp:ce,claude:de,codex:ge,copilot:ve,crush:ke,cursor:$e,droid:Te,gemini:Oe,kimi:Me,opencode:Ie,qwen:qe},C=f(e=>e.startsWith("~")?g(R(),e.slice(1)):e,"resolveHome"),He=f(e=>{try{const r=O(E?"where":"which",[e],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:Z}).trim().split(`
2
+ `)[0]?.trim();return r&&r.length>0?r:void 0}catch{return}},"whichCommand"),Be=f(e=>{const r=R();if(E){const a=process.env.APPDATA??"",t=process.env.LOCALAPPDATA??"",n=process.env.ProgramFiles??"";return[g(a,"npm",`${e}.cmd`),g(a,"npm",e),g(t,"Programs",e,`${e}.exe`),g(n,e,`${e}.exe`),g(r,".npm-global","bin",`${e}.cmd`)]}return[`/opt/homebrew/bin/${e}`,`/usr/local/bin/${e}`,g(r,".npm-global","bin",e),g(r,".local","bin",e),g(r,".cargo","bin",e)]},"getKnownPaths"),S=f(e=>{try{const r=O(e,["--version"],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:ee}),a=Q.exec(r);return a?a[1]:void 0}catch{return}},"detectVersion"),_=f(e=>{const r=x[e],a={available:!1,name:e},t=process.env[r.envVariable];if(t&&T(C(t))){const i=C(t);return{...a,available:!0,detectionMethod:"envvar",path:i,version:S(i)}}const n=[r.command,...r.alternateCommands];for(const i of n){const o=He(i);if(o)return{...a,available:!0,detectionMethod:"which",path:o,version:S(o)}}for(const i of n)for(const o of Be(i))if(T(o))return{...a,available:!0,detectionMethod:"known-path",path:o,version:S(o)};return a},"detectProvider"),Fe=f(()=>M.map(e=>_(e)),"detectAllProviders"),De=f(()=>Fe().filter(e=>e.available),"detectAvailableProviders"),Je=f((e,r,a={})=>{const t=x[e],n=a.model??t.defaultModel,i=a.maxTokens??te;return t.buildArgs(r,n,i)},"buildCliArgs"),ze=f(async(e,r,a={})=>{if(!e.available||!e.path)throw new Error(`AI provider "${e.name}" is not available.`);const t=Je(e.name,r,a),n=a.timeoutMs??re;return new Promise((i,o)=>{const p={env:{...process.env,FORCE_COLOR:"0",NO_COLOR:"1"},stdio:["pipe","pipe","pipe"]},s=D(e.path,t,p);s.stdin.end();let c="",d="",u=!1;const b=setTimeout(()=>{u=!0,s.kill("SIGTERM"),o(new Error(`${e.name} CLI timed out after ${String(n)}ms`))},n);s.stdout.on("data",h=>{c+=h.toString("utf8")}),s.stderr.on("data",h=>{d+=h.toString("utf8")}),s.on("close",h=>{clearTimeout(b),!u&&(h===0?i({provider:e.name,stderr:d,stdout:c}):o(new Error(`${e.name} CLI exited with code ${String(h)}: ${d||c}`)))}),s.on("error",h=>{clearTimeout(b),u||o(new Error(`Failed to spawn ${e.name} CLI: ${h.message}`))})})},"runProvider");var Ue=Object.defineProperty,I=k((e,r)=>Ue(e,"name",{value:r,configurable:!0}),"i");const We=12e4,Ke=2,Ge=1e3,Ye=I(e=>new Promise(r=>{setTimeout(r,e)}),"sleep"),N=I(async(e,r,a=Ke)=>{let t;for(let n=0;n<=a;n+=1)try{return(await ze(e,r,{timeoutMs:We})).stdout}catch(i){if(t=i instanceof Error?i:new Error(String(i)),t.message.includes("timed out"))throw t;if(n<a){const o=Ge*2**n;await Ye(o)}}throw t??new Error("AI request failed after retries")},"runWithRetry");var Xe=Object.defineProperty,l=k((e,r)=>Xe(e,"name",{value:r,configurable:!0}),"c");const Qe={amp:30,claude:80,codex:60,copilot:50,crush:35,cursor:40,droid:20,gemini:100,kimi:25,opencode:35,qwen:30},Ze=l(e=>{if(e?.provider){if(!M.includes(e.provider))return;const t=_(e.provider);return t.available?t:void 0}const r=De();if(r.length===0)return;const a={...Qe,...e?.priority};return r.toSorted((t,n)=>(a[n.name]??0)-(a[t.name]??0))[0]},"resolveProvider"),er=new Set(["defer","review","skip","update"]),rr=new Set(["critical","high","low","medium"]),tr=new Set(["high","low","medium"]),ar=50,P=30,nr=l(e=>e.map(r=>{const a=r.vulnerabilities&&r.vulnerabilities.length>0?` [VULNERABILITIES: ${r.vulnerabilities.map(n=>`${n.severity} ${n.id}`).join(", ")}]`:"";let t="";if(r.socketReport){const n=Math.round(r.socketReport.score.overall*100),i=[`score:${String(n)}%`];if(r.socketReport.alerts.length>0){const o={};for(const s of r.socketReport.alerts)o[s.severity]=(o[s.severity]??0)+1;const p=Object.entries(o).map(([s,c])=>`${String(c)} ${s}`).join(", ");i.push(`alerts: ${p}`)}i.push(`supply-chain:${String(Math.round(r.socketReport.score.supplyChain*100))}%`),i.push(`quality:${String(Math.round(r.socketReport.score.quality*100))}%`),t=` [SOCKET.DEV: ${i.join(", ")}]`}return`- ${r.packageName}: ${r.currentRange} → ${r.newRange} (${r.updateType})${a}${t}`}).join(`
3
+ `),"buildPackageList"),A=`Respond ONLY with valid JSON in this exact structure:
4
+ {
5
+ "summary": "Brief overall summary",
6
+ "recommendations": [
7
+ {
8
+ "package": "package-name",
9
+ "action": "update|skip|review|defer",
10
+ "reason": "explanation",
11
+ "riskLevel": "low|medium|high|critical",
12
+ "breakingChanges": ["change1"],
13
+ "effort": "low|medium|high"
14
+ }
15
+ ],
16
+ "warnings": ["warning1"]
17
+ }`,ir={compatibility:l(e=>`Analyze the compatibility of these package updates:
18
+
19
+ ${e}
20
+
21
+ For each package:
22
+ 1. Check peer dependency compatibility
23
+ 2. Identify potential conflicts with other packages in the list
24
+ 3. Assess API compatibility between current and target versions
25
+ 4. Check for deprecated features being removed
26
+ 5. Evaluate Node.js version requirements
27
+
28
+ ${A}`,"compatibility"),impact:l(e=>`Analyze the impact of updating these npm packages:
29
+
30
+ ${e}
31
+
32
+ For each package, provide:
33
+ 1. Risk level (low/medium/high/critical)
34
+ 2. Recommended action (update/skip/review/defer)
35
+ 3. Reason for recommendation
36
+ 4. Known breaking changes (if any)
37
+ 5. Estimated migration effort (low/medium/high)
38
+
39
+ ${A}`,"impact"),recommend:l(e=>`Provide smart recommendations for updating these packages:
40
+
41
+ ${e}
42
+
43
+ Consider:
44
+ 1. Update priority based on security, features, and stability
45
+ 2. Grouping related packages for atomic updates
46
+ 3. Best practices for the specific package ecosystem
47
+ 4. Risk vs. benefit analysis
48
+ 5. Suggested update order
49
+ 6. If Socket.dev scores are provided, prioritize packages with low supply chain or quality scores
50
+
51
+ ${A}`,"recommend"),security:l(e=>`Analyze the security implications of these package updates:
52
+
53
+ ${e}
54
+
55
+ For each package:
56
+ 1. Check if the update fixes known vulnerabilities (use the vulnerability data above)
57
+ 2. Assess if the new version introduces security risks
58
+ 3. Evaluate if this is a security-sensitive package (auth, crypto, session, etc.)
59
+ 4. Recommend urgency of the update based on vulnerability severity
60
+ 5. Flag any packages where skipping the update poses security risk
61
+ 6. If Socket.dev scores are provided, factor in supply chain and quality scores — low scores indicate higher risk
62
+
63
+ ${A}`,"security")},or=new Set(["compatibility","impact","recommend","security"]),kr=l(e=>or.has(e)?e:"impact","validateAnalysisType"),L=l((e,r="impact")=>{const a=nr(e);return ir[r](a)},"buildAnalysisPrompt"),sr=/```(?:json)?\s*([\s\S]*?)```/,cr=/\{[\s\S]*\}/,lr=l(e=>{try{return JSON.parse(e)}catch{}const r=sr.exec(e);if(r?.[1])try{return JSON.parse(r[1])}catch{}const a=cr.exec(e);if(a?.[0])try{return JSON.parse(a[0])}catch{}},"extractJson"),ur=l(e=>({action:er.has(e.action)?e.action:"review",breakingChanges:Array.isArray(e.breakingChanges)?e.breakingChanges:[],effort:tr.has(e.effort)?e.effort:"medium",package:typeof e.package=="string"?e.package:"",reason:typeof e.reason=="string"?e.reason:"",riskLevel:rr.has(e.riskLevel)?e.riskLevel:"medium"}),"normalizeRecommendation"),q=l((e,r,a)=>{const t=lr(e);if(!t||typeof t!="object")return{analysisType:a,provider:r,recommendations:[],summary:"Failed to parse AI response.",warnings:["AI response was not valid JSON."]};const n=t,i=Array.isArray(n.recommendations)?n.recommendations:[];return{analysisType:a,provider:r,recommendations:i.map(o=>ur(o)),summary:typeof n.summary=="string"?n.summary:"",warnings:Array.isArray(n.warnings)?n.warnings:[]}},"parseAiResponse"),dr={eslint:["ESLint 9.0: Flat config required","ESLint 8.0+: New rule formats"],next:["Next.js 13+: App router changes","Next.js 14+: Server components default"],react:["React 17 to 18: Concurrent features","React 18+: Strict mode changes"],typescript:["TypeScript 5.0: New decorators","TypeScript 4.7+: ESM changes"],vite:["Vite 5: Node.js 18+ required"],vue:["Vue 3: Composition API","Vue 3: Breaking template changes"],webpack:["Webpack 5: Node.js polyfills removed"]},mr=new Set(["bcrypt","cors","crypto-js","express-session","helmet","jose","jsonwebtoken","node-forge","oauth","passport"]),j=l((e,r)=>{const a=e.map(t=>{const n=t.vulnerabilities&&t.vulnerabilities.length>0,i=mr.has(t.packageName),o=dr[t.packageName]??[];let p="low",s="update",c="low",d="Patch/minor update, safe to apply.";return t.updateType==="major"?(p="high",s=o.length>0?"review":"update",c="medium",d=o.length>0?`Major update with known breaking changes: ${o[0]}`:"Major version update, review changelog before applying."):t.updateType==="minor"&&(p="medium",d="Minor update, generally safe."),n&&(p="high",s="update",d="Security update — current version has known vulnerabilities."),i&&t.updateType==="major"&&(s="review",d="Security-sensitive package with major update, careful review needed.",c="high"),{action:s,breakingChanges:o,effort:c,package:t.packageName,reason:d,riskLevel:p}});return{analysisType:r,provider:"rule-engine",recommendations:a,summary:`Rule-based ${r} analysis for ${String(e.length)} packages.`,warnings:["No AI provider available — using built-in rule engine."]}},"ruleBasedAnalysis"),pr=l(async(e,r,a)=>{const t=L(r,a),n=await N(e,t);return q(n,e.name,a)},"analyzeChunk"),gr=l((e,r,a)=>{const t=[],n=[],i=[];for(const o of e)t.push(...o.recommendations),n.push(...o.warnings),o.summary&&i.push(o.summary);return{analysisType:a,provider:r,recommendations:t,summary:i.length===1?i[0]??"":`Analyzed ${String(t.length)} packages in ${String(e.length)} batches.`,warnings:[...new Set(n)]}},"mergeResults"),V={compatibility:"Compatibility",impact:"Impact",recommend:"Recommendations",security:"Security"},wr=l(e=>{const r=`${V[e.analysisType]??e.analysisType} Analysis (${e.provider})`,a=e.recommendations.flatMap(n=>{const i=[{action:n.action,effort:n.effort,package:n.package,reason:n.reason,risk:n.riskLevel}];return n.breakingChanges.length>0&&i.push({action:"",effort:"",package:"",reason:`Breaking: ${n.breakingChanges.join("; ")}`,risk:""}),i}),t=process.stdout.columns||80;return z(v.createElement(U,{borderStyle:"round",flexDirection:"column",paddingLeft:1,paddingRight:1},v.createElement(y,{bold:!0},r),v.createElement(y,null,""),v.createElement(y,null,e.summary),v.createElement(y,null,""),v.createElement(W,{borderStyle:"none",data:a}),...e.warnings.length>0?[v.createElement(y,null,""),...e.warnings.map((n,i)=>v.createElement(y,{dimColor:!0,key:String(i)},` ${n}`))]:[]),{columns:t})},"formatAiAnalysis");l(e=>JSON.stringify(e,void 0,2),"formatAiAnalysisJson");const Ar=l(async(e,r,a,t="impact")=>{const n=Ze(a);if(!n)return r.info(`No AI CLI tool found, using rule-based analysis.
64
+ `),j(e,t);const i=K(n.name,t,e),o=G(i);if(o)return r.info(`Using cached ${t} analysis from ${o.provider}.
65
+ `),o;const p=V[t]??t;r.info(`Running ${p.toLowerCase()} analysis with ${n.name}...
66
+ `);try{let s;if(e.length>ar){r.info(`Splitting ${String(e.length)} packages into batches of ${String(P)}...
67
+ `);const c=[];for(let u=0;u<e.length;u+=P)c.push(e.slice(u,u+P));const d=[];for(let u=0;u<c.length;u+=1){r.info(` Batch ${String(u+1)}/${String(c.length)}...`);const b=c[u];b&&d.push(await pr(n,b,t))}s=gr(d,n.name,t)}else{const c=await N(n,L(e,t));s=q(c,n.name,t)}return Y(i,s,X(t,a?.cacheTtl)),s}catch(s){const c=s instanceof Error?s.message:String(s);return r.warn(`AI analysis failed (${c}), falling back to rule engine.
68
+ `),j(e,t)}},"runAiAnalysis");export{kr as H,ze as O,Qe as R,wr as Z,Fe as _,Ze as b,Ar as e,N as r,lr as w};