@visulima/vis 1.0.0-alpha.42 → 1.0.0-alpha.43

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 (157) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/binx.js +1 -1
  4. package/dist/config/index.js +1 -1
  5. package/dist/packem_chunks/CONFIG_FILES.js +8 -0
  6. package/dist/packem_chunks/bloom-status.js +1 -1
  7. package/dist/packem_chunks/bloom-sync.js +1 -1
  8. package/dist/packem_chunks/catalog.js +113 -0
  9. package/dist/packem_chunks/cli-exec.js +1 -1
  10. package/dist/packem_chunks/cli-main.js +295 -433
  11. package/dist/packem_chunks/detect.js +3 -3
  12. package/dist/packem_chunks/fix.js +1 -1
  13. package/dist/packem_chunks/handler.js +1 -1
  14. package/dist/packem_chunks/handler10.js +5 -1
  15. package/dist/packem_chunks/handler11.js +1 -5
  16. package/dist/packem_chunks/handler12.js +27 -1
  17. package/dist/packem_chunks/handler13.js +5 -27
  18. package/dist/packem_chunks/handler14.js +1 -5
  19. package/dist/packem_chunks/handler15.js +1 -1
  20. package/dist/packem_chunks/handler16.js +1 -1
  21. package/dist/packem_chunks/handler17.js +1 -1
  22. package/dist/packem_chunks/handler18.js +1 -1
  23. package/dist/packem_chunks/handler19.js +5 -1
  24. package/dist/packem_chunks/handler2.js +1 -1
  25. package/dist/packem_chunks/handler20.js +2 -5
  26. package/dist/packem_chunks/handler21.js +2 -2
  27. package/dist/packem_chunks/handler22.js +5 -2
  28. package/dist/packem_chunks/handler23.js +1 -5
  29. package/dist/packem_chunks/handler24.js +1 -1
  30. package/dist/packem_chunks/handler25.js +1 -1
  31. package/dist/packem_chunks/handler26.js +5 -1
  32. package/dist/packem_chunks/handler27.js +1 -5
  33. package/dist/packem_chunks/handler28.js +3 -1
  34. package/dist/packem_chunks/handler29.js +1 -3
  35. package/dist/packem_chunks/handler3.js +4 -1
  36. package/dist/packem_chunks/handler30.js +1 -1
  37. package/dist/packem_chunks/handler31.js +2 -1
  38. package/dist/packem_chunks/handler32.js +2 -2
  39. package/dist/packem_chunks/handler33.js +2 -2
  40. package/dist/packem_chunks/handler34.js +3 -2
  41. package/dist/packem_chunks/handler35.js +6 -3
  42. package/dist/packem_chunks/handler36.js +1 -6
  43. package/dist/packem_chunks/handler37.js +42 -1
  44. package/dist/packem_chunks/handler38.js +8 -42
  45. package/dist/packem_chunks/handler39.js +9 -8
  46. package/dist/packem_chunks/handler4.js +4 -4
  47. package/dist/packem_chunks/handler40.js +75 -9
  48. package/dist/packem_chunks/handler41.js +5 -75
  49. package/dist/packem_chunks/handler42.js +4 -5
  50. package/dist/packem_chunks/handler43.js +3 -4
  51. package/dist/packem_chunks/handler44.js +2 -3
  52. package/dist/packem_chunks/handler45.js +1 -2
  53. package/dist/packem_chunks/handler46.js +1 -1
  54. package/dist/packem_chunks/handler47.js +1 -1
  55. package/dist/packem_chunks/handler48.js +3 -1
  56. package/dist/packem_chunks/handler49.js +1 -3
  57. package/dist/packem_chunks/handler5.js +6 -4
  58. package/dist/packem_chunks/handler50.js +7 -1
  59. package/dist/packem_chunks/handler51.js +32 -6
  60. package/dist/packem_chunks/handler52.js +3 -33
  61. package/dist/packem_chunks/handler53.js +8 -3
  62. package/dist/packem_chunks/handler54.js +2 -6
  63. package/dist/packem_chunks/handler55.js +1 -4
  64. package/dist/packem_chunks/handler56.js +12 -1
  65. package/dist/packem_chunks/handler57.js +5 -12
  66. package/dist/packem_chunks/handler58.js +11 -5
  67. package/dist/packem_chunks/handler59.js +3 -11
  68. package/dist/packem_chunks/handler6.js +8 -6
  69. package/dist/packem_chunks/handler60.js +22 -3
  70. package/dist/packem_chunks/handler61.js +60 -21
  71. package/dist/packem_chunks/handler62.js +3 -61
  72. package/dist/packem_chunks/handler63.js +6 -3
  73. package/dist/packem_chunks/handler64.js +9 -6
  74. package/dist/packem_chunks/handler65.js +2 -9
  75. package/dist/packem_chunks/handler66.js +12 -12
  76. package/dist/packem_chunks/handler67.js +5 -5
  77. package/dist/packem_chunks/handler68.js +1 -1
  78. package/dist/packem_chunks/handler69.js +4 -4
  79. package/dist/packem_chunks/handler7.js +1 -8
  80. package/dist/packem_chunks/handler70.js +7 -7
  81. package/dist/packem_chunks/handler71.js +12 -12
  82. package/dist/packem_chunks/handler72.js +5 -5
  83. package/dist/packem_chunks/handler73.js +7 -7
  84. package/dist/packem_chunks/handler74.js +3 -3
  85. package/dist/packem_chunks/handler75.js +3 -3
  86. package/dist/packem_chunks/handler76.js +31 -31
  87. package/dist/packem_chunks/handler77.js +1 -1
  88. package/dist/packem_chunks/handler8.js +1 -1
  89. package/dist/packem_chunks/handler9.js +1 -1
  90. package/dist/packem_chunks/heal-accept.js +1 -1
  91. package/dist/packem_chunks/heal.js +1 -1
  92. package/dist/packem_chunks/help-command.js +1 -1
  93. package/dist/packem_chunks/index2.js +2 -2
  94. package/dist/packem_chunks/keys-refresh.js +1 -1
  95. package/dist/packem_chunks/list.js +1 -1
  96. package/dist/packem_chunks/loader.js +1 -1
  97. package/dist/packem_chunks/orchestrator.js +19 -19
  98. package/dist/packem_chunks/prune.js +1 -1
  99. package/dist/packem_chunks/run.js +1 -1
  100. package/dist/packem_chunks/status.js +1 -1
  101. package/dist/packem_chunks/sync.js +1 -1
  102. package/dist/packem_chunks/sync2.js +1 -1
  103. package/dist/packem_chunks/tripwire.js +1 -1
  104. package/dist/packem_chunks/verify-lockfile.js +1 -1
  105. package/dist/packem_chunks/version-resolver.js +1 -1
  106. package/dist/packem_shared/{advisories-aiDtubZQ.js → advisories-CefYKEPe.js} +1 -1
  107. package/dist/packem_shared/{ai-analysis-CubpCxZJ.js → ai-analysis-Co-b15d_.js} +7 -7
  108. package/dist/packem_shared/{ai-fix-Btd5AnSr.js → ai-fix-DnJDgPN-.js} +9 -9
  109. package/dist/packem_shared/bin-DDq2oszw.js +1 -0
  110. package/dist/packem_shared/{cyclonedx-NUJ9R2GQ.js → cyclonedx-BTBzGCBW.js} +1 -1
  111. package/dist/packem_shared/dependency-scan-DEv-scN6.js +1 -0
  112. package/dist/packem_shared/env-XJzocuUP.js +27 -0
  113. package/dist/packem_shared/failure-log-Sp1j-5qo.js +2 -0
  114. package/dist/packem_shared/index-B0EsgdzO.js +1 -0
  115. package/dist/packem_shared/{index-Cb4x6lWY.js → index-Cg0IHaFI.js} +1 -1
  116. package/dist/packem_shared/index-CkZnT2Fe.js +1 -0
  117. package/dist/packem_shared/{index-CPhv-r4c.js → index-DJAnbLEh.js} +13 -13
  118. package/dist/packem_shared/{lifecycle-D5roTh0a.js → lifecycle-C4nRsXxc.js} +1 -1
  119. package/dist/packem_shared/{min-release-age-pUAqTiv3.js → min-release-age-B23Mr7NO.js} +1 -1
  120. package/dist/packem_shared/missing-package-json-DdMNbe_j.js +1 -0
  121. package/dist/packem_shared/{osv-bloom-OuTfu_LE.js → osv-bloom-BsQ-aFiM.js} +1 -1
  122. package/dist/packem_shared/packument-QjOLAMSk.js +1 -0
  123. package/dist/packem_shared/{pm-runner-Dws_Bw1y.js → pm-runner-CIH0wPh-.js} +1 -1
  124. package/dist/packem_shared/prompt-DjXHVgYU.js +1 -0
  125. package/dist/packem_shared/provenance-CilBg0Ee.js +1 -0
  126. package/dist/packem_shared/registry-keys-BEavOCPz.js +1 -0
  127. package/dist/packem_shared/resolve-explicit-C4o8_-SE.js +5 -0
  128. package/dist/packem_shared/s1ngularity-DuG-LLaX.js +1 -0
  129. package/dist/packem_shared/scan-progress-RTMsE3Z4.js +2 -0
  130. package/dist/packem_shared/{signatures-BOUhghTv.js → signatures-CYheSqd3.js} +2 -2
  131. package/dist/packem_shared/spinner-DuJJvFTl.js +1 -0
  132. package/dist/packem_shared/tabs-CgxCvjCY.js +1 -0
  133. package/dist/packem_shared/target-merge-DOm6h6tW.js +11 -0
  134. package/dist/packem_shared/{typosquats-DBOvXwph.js → typosquats-hCtH-23t.js} +1 -1
  135. package/dist/packem_shared/use-measured-height-BKUjhm_3.js +1 -0
  136. package/dist/packem_shared/vis-update-app-K-qATSeh.js +1 -0
  137. package/dist/packem_shared/watch-loop-WE7nWIEt.js +11 -0
  138. package/dist/packem_shared/window-ops-DDePlWLV.js +2 -0
  139. package/index.js +52 -52
  140. package/package.json +10 -10
  141. package/dist/packem_chunks/config.js +0 -18
  142. package/dist/packem_shared/CONFIG_FILES-MsOntfYT.js +0 -1
  143. package/dist/packem_shared/bin-CnDBuLh3.js +0 -2
  144. package/dist/packem_shared/dependency-scan-B0HV_qeB.js +0 -1
  145. package/dist/packem_shared/failure-log-C7r6UZLP.js +0 -2
  146. package/dist/packem_shared/index-BKFEWXU_.js +0 -1
  147. package/dist/packem_shared/missing-package-json-DhYzuKhD.js +0 -1
  148. package/dist/packem_shared/provenance-C0P-UYOM.js +0 -1
  149. package/dist/packem_shared/registry-keys-D4chF-Wj.js +0 -1
  150. package/dist/packem_shared/resolve-explicit-Cgheka3B.js +0 -5
  151. package/dist/packem_shared/s1ngularity-Du1NnSFP.js +0 -1
  152. package/dist/packem_shared/scan-progress-CN9ONR0y.js +0 -2
  153. package/dist/packem_shared/spinner-lhXugSx3.js +0 -1
  154. package/dist/packem_shared/tabs-DTiU3usb.js +0 -1
  155. package/dist/packem_shared/use-measured-height-CK2Co3XI.js +0 -1
  156. package/dist/packem_shared/vis-update-app-DtHkwBca.js +0 -1
  157. package/dist/packem_shared/watch-loop-D9zbXzRd.js +0 -11
@@ -1,4 +1,4 @@
1
- import{createRequire as ps}from"node:module";import{E as De,s as Wt,V as oi,I as Cr,q as ai}from"../packem_shared/index.server-J83sowC4.js";import{T as ms,f as jr,A as At,y as Nr,B as Pt,v as fs,m as St}from"../packem_shared/index-OQZQyN5R.js";import{g as bs}from"../packem_shared/_commonjsHelpers-B5Y90VFO.js";import{fingerprint as yt,scan as ii,scanFiles as vs,inspectRuleset as ys,listRules as Ir,listRequiredValidators as ws,scanGitHistory as $s}from"@visulima/secret-scanner";import{bn as ks,bo as Rr,p as de}from"./cli-main.js";import{o as Ps}from"../packem_shared/MultiSpinner-B9U0-aE3-B-gIXhFk.js";import{a as As}from"../packem_shared/readJsonSync-CvkZyKmL-CY7PZob_.js";const gs=ps(import.meta.url),Tt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ri=e=>{if(typeof Tt<"u"&&Tt.versions&&Tt.versions.node){const[t,n]=Tt.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Tt.getBuiltinModule(e)}return gs(e)},{pathToFileURL:si}=ri("node:url"),{execFileSync:xs}=ri("node:child_process"),Cs={one:{},two:{},three:{},four:{}},js={one:{},two:{},three:{}},Ns={},Is=[],ar={methods:Cs,model:js,compute:Ns,hooks:Is},Ts=e=>Object.prototype.toString.call(e)==="[object Array]",Es={compute:function(e){const{world:t}=this,n=t.compute;return typeof e=="string"&&n.hasOwnProperty(e)?n[e](this):Ts(e)?e.forEach(r=>{t.compute.hasOwnProperty(r)?n[r](this):console.warn("no compute:",e)}):typeof e=="function"?e(this):console.warn("no compute:",e),this}},Ds=function(e){return this.fullPointer.forEach((t,n)=>{const r=this.update([t]);e(r,n)}),this},Hs=function(e,t){const n=this.fullPointer.map((o,a)=>{const i=this.update([o]),s=e(i,a);return s===void 0?this.none():s});if(n.length===0)return t||this.update([]);if(n[0]!==void 0&&(typeof n[0]=="string"||typeof n[0]=="object"&&(n[0]===null||!n[0].isView)))return n;let r=[];return n.forEach(o=>{r=r.concat(o.fullPointer)}),this.toView(r)},Gs=function(e){let t=this.fullPointer;return t=t.filter((n,r)=>{const o=this.update([n]);return e(o,r)}),this.update(t)},Os=function(e){const t=this.fullPointer.find((n,r)=>{const o=this.update([n]);return e(o,r)});return this.update([t])},Fs=function(e){return this.fullPointer.some((t,n)=>{const r=this.update([t]);return e(r,n)})},Vs=function(e=1){let t=this.fullPointer,n=Math.floor(Math.random()*t.length);return n+e>this.length&&(n=this.length-e,n=n<0?0:n),t=t.slice(n,n+e),this.update(t)},zs={forEach:Ds,map:Hs,filter:Gs,find:Os,some:Fs,random:Vs},He={termList:function(){return this.methods.one.termList(this.docs)},terms:function(e){const t=this.match(".");return typeof e=="number"?t.eq(e):t},groups:function(e){if(e||e===0)return this.update(this._groups[e]||[]);const t={};return Object.keys(this._groups).forEach(n=>{t[n]=this.update(this._groups[n])}),t},eq:function(e){let t=this.pointer;return t||(t=this.docs.map((n,r)=>[r])),t[e]?this.update([t[e]]):this.none()},first:function(){return this.eq(0)},last:function(){const e=this.fullPointer.length-1;return this.eq(e)},firstTerms:function(){return this.match("^.")},lastTerms:function(){return this.match(".$")},slice:function(e,t){let n=this.pointer||this.docs.map((r,o)=>[o]);return n=n.slice(e,t),this.update(n)},all:function(){return this.update().toView()},fullSentences:function(){const e=this.fullPointer.map(t=>[t[0]]);return this.update(e).toView()},none:function(){return this.update([])},isDoc:function(e){if(!e||!e.isView)return!1;const t=this.fullPointer,n=e.fullPointer;return!t.length===n.length?!1:t.every((r,o)=>n[o]?r[0]===n[o][0]&&r[1]===n[o][1]&&r[2]===n[o][2]:!1)},wordCount:function(){return this.docs.reduce((e,t)=>(e+=t.filter(n=>n.text!=="").length,e),0)},isFull:function(){const e=this.pointer;if(!e)return!0;if(e.length===0||e[0][0]!==0)return!1;let t=0,n=0;return this.document.forEach(r=>t+=r.length),this.docs.forEach(r=>n+=r.length),t===n},getNth:function(e){return typeof e=="number"?this.eq(e):typeof e=="string"?this.if(e):this}};He.group=He.groups;He.fullSentence=He.fullSentences;He.sentence=He.fullSentences;He.lastTerm=He.lastTerms;He.firstTerm=He.firstTerms;const ir=Object.assign({},He,Es,zs);ir.get=ir.eq;let En=class vn{constructor(t,n,r={}){[["document",t],["world",ar],["_groups",r],["_cache",null],["viewType","View"]].forEach(o=>{Object.defineProperty(this,o[0],{value:o[1],writable:!0})}),this.ptrs=n}get docs(){let t=this.document;return this.ptrs&&(t=ar.methods.one.getDoc(this.ptrs,this.document)),t}get pointer(){return this.ptrs}get methods(){return this.world.methods}get model(){return this.world.model}get hooks(){return this.world.hooks}get isView(){return!0}get found(){return this.docs.length>0}get length(){return this.docs.length}get fullPointer(){const{docs:t,ptrs:n,document:r}=this;return(n||t.map((o,a)=>[a])).map(o=>{let[a,i,s,u,l]=o;return i=i||0,s=s||(r[a]||[]).length,r[a]&&r[a][i]&&(u=u||r[a][i].id,r[a][s-1]&&(l=l||r[a][s-1].id)),[a,i,s,u,l]})}update(t){const n=new vn(this.document,t);if(this._cache&&t&&t.length>0){const r=[];t.forEach((o,a)=>{const[i,s,u]=o;o.length===1?r[a]=this._cache[i]:s===0&&this.document[i].length===u&&(r[a]=this._cache[i])}),r.length>0&&(n._cache=r)}return n.world=this.world,n}toView(t){return new vn(this.document,t||this.pointer)}fromText(t){const{methods:n}=this,r=n.one.tokenize.fromString(t,this.world),o=new vn(r);return o.world=this.world,o.compute(["normal","freeze","lexicon"]),this.world.compute.preTagger&&o.compute("preTagger"),o.compute("unfreeze"),o}clone(){let t=this.document.slice(0);t=t.map(r=>r.map(o=>(o=Object.assign({},o),o.tags=new Set(o.tags),o)));const n=this.update(this.pointer);return n.document=t,n._cache=this._cache,n}};Object.assign(En.prototype,ir);const Bs="14.15.1",Ur=function(e){return e&&typeof e=="object"&&!Array.isArray(e)},Ss=function(e){return Object.prototype.toString.call(e)==="[object Array]"};function ui(e,t){if(Ur(t))for(const n in t)Ur(t[n])?(e[n]||Object.assign(e,{[n]:{}}),ui(e[n],t[n])):Object.assign(e,{[n]:t[n]});return e}function Ms(e,t){for(const n in t)e[n]=e[n]||{},Object.assign(e[n],t[n]);return e}const Ls=function(e,t){const n=e.two.models||{};Object.keys(t).forEach(r=>{t[r].pastTense&&(n.toPast&&(n.toPast.ex[r]=t[r].pastTense),n.fromPast&&(n.fromPast.ex[t[r].pastTense]=r)),t[r].presentTense&&(n.toPresent&&(n.toPresent.ex[r]=t[r].presentTense),n.fromPresent&&(n.fromPresent.ex[t[r].presentTense]=r)),t[r].gerund&&(n.toGerund&&(n.toGerund.ex[r]=t[r].gerund),n.fromGerund&&(n.fromGerund.ex[t[r].gerund]=r)),t[r].comparative&&(n.toComparative&&(n.toComparative.ex[r]=t[r].comparative),n.fromComparative&&(n.fromComparative.ex[t[r].comparative]=r)),t[r].superlative&&(n.toSuperlative&&(n.toSuperlative.ex[r]=t[r].superlative),n.fromSuperlative&&(n.fromSuperlative.ex[t[r].superlative]=r))})},li=function(e,t,n,r){if(Ss(e)){e.forEach(u=>li(u,t,n,r));return}const{methods:o,model:a,compute:i,hooks:s}=t;e.methods&&Ms(o,e.methods),e.model&&ui(a,e.model),e.irregulars&&Ls(a,e.irregulars),e.compute&&Object.assign(i,e.compute),s&&(t.hooks=s.concat(e.hooks||[])),e.api&&e.api(n),e.lib&&Object.keys(e.lib).forEach(u=>r[u]=e.lib[u]),e.tags&&r.addTags(e.tags),e.words&&r.addWords(e.words),e.frozen&&r.addWords(e.frozen,!0),e.mutate&&e.mutate(t,r)},Ks=function(e){const t=process.env?process.env:self.env||{};return t.DEBUG_TAGS=e==="tagger"||e===!0?!0:"",t.DEBUG_MATCH=e==="match"||e===!0?!0:"",t.DEBUG_CHUNKS=e==="chunker"||e===!0?!0:"",this},Js=e=>Object.prototype.toString.call(e)==="[object Object]",sr=function(e){return Object.prototype.toString.call(e)==="[object Array]"},Ws=function(e){return e.map(t=>t.terms.map(n=>(sr(n.tags)&&(n.tags=new Set(n.tags)),n)))},qs=function(e){return e.map(t=>t.map(n=>({text:n,normal:n,pre:"",post:" ",tags:new Set})))},ci=function(e,t,n){const{methods:r}=n,o=new t([]);if(o.world=n,typeof e=="number"&&(e=String(e)),!e)return o;if(typeof e=="string"){const a=r.one.tokenize.fromString(e,n);return new t(a)}if(Js(e)&&e.isView)return new t(e.document,e.ptrs);if(sr(e)){if(sr(e[0])){const i=qs(e);return new t(i)}const a=Ws(e);return new t(a)}return o},xn=Object.assign({},ar),T=function(e,t){t&&T.addWords(t);const n=ci(e,En,xn);return e&&n.compute(xn.hooks),n};Object.defineProperty(T,"_world",{value:xn,writable:!0});T.tokenize=function(e,t){const{compute:n}=this._world;t&&T.addWords(t);const r=ci(e,En,xn);return n.contractions&&r.compute(["alias","normal","machine","contractions"]),r};T.plugin=function(e){return li(e,this._world,En,this),this};T.extend=T.plugin;T.world=function(){return this._world};T.model=function(){return this._world.model};T.methods=function(){return this._world.methods};T.hooks=function(){return this._world.hooks};T.verbose=Ks;T.version=Bs;const Rs=function(e){return e.map(t=>{const n=new Set;return t.forEach(r=>{r.normal!==""&&n.add(r.normal),r.switch&&n.add(`%${r.switch}%`),r.implicit&&n.add(r.implicit),r.machine&&n.add(r.machine),r.root&&n.add(r.root),r.alias&&r.alias.forEach(a=>n.add(a));const o=Array.from(r.tags);for(let a=0;a<o.length;a+=1)n.add("#"+o[a])}),n})},Us={one:{cacheDoc:Rs}},_s={cache:function(){return this._cache=this.methods.one.cacheDoc(this.document),this},uncache:function(){return this._cache=null,this}},Qs=function(e){Object.assign(e.prototype,_s)},Zs={cache:function(e){e._cache=e.methods.one.cacheDoc(e.document)}},Xs={api:Qs,compute:Zs,methods:Us},Ys={toLowerCase:function(){return this.termList().forEach(e=>{e.text=e.text.toLowerCase()}),this},toUpperCase:function(){return this.termList().forEach(e=>{e.text=e.text.toUpperCase()}),this},toTitleCase:function(){return this.termList().forEach(e=>{e.text=e.text.replace(/^ *[a-z\u00C0-\u00FF]/,t=>t.toUpperCase())}),this},toCamelCase:function(){return this.docs.forEach(e=>{e.forEach((t,n)=>{n!==0&&(t.text=t.text.replace(/^ *[a-z\u00C0-\u00FF]/,r=>r.toUpperCase())),n!==e.length-1&&(t.post="")})}),this}},_r=e=>new RegExp("^\\p{Lu}[\\p{Ll}'’]","u").test(e)||new RegExp("^\\p{Lu}$","u").test(e),eu=e=>e.replace(new RegExp("^\\p{Ll}","u"),t=>t.toUpperCase()),tu=e=>e.replace(new RegExp("^\\p{Lu}","u"),t=>t.toLowerCase()),hi=(e,t,n)=>{if(n.forEach(r=>r.dirty=!0),e){const r=[t,0].concat(n);Array.prototype.splice.apply(e,r)}return e},Vt=function(e){const t=/ $/,n=/[-–—]/,r=e[e.length-1];r&&!t.test(r.post)&&!n.test(r.post)&&(r.post+=" ")},Qr=(e,t,n)=>{const r=/[-.?!,;:)–—'"]/g,o=e[t-1];if(!o)return;const a=o.post;if(r.test(a)){const i=a.match(r).join(""),s=n[n.length-1];s.post=i+s.post,o.post=o.post.replace(r,"")}},nu=function(e,t,n){const r=e[t];if(t!==0||!_r(r.text))return;n[0].text=eu(n[0].text);const o=e[t];o.tags.has("ProperNoun")||o.tags.has("Acronym")||_r(o.text)&&o.text.length>1&&(o.text=tu(o.text))},ru=function(e,t,n,r){const[o,a,i]=t;a===0||i===r[o].length?Vt(n):(Vt(n),Vt([e[t[1]]])),nu(e,a,n),hi(e,a,n)},ou=function(e,t,n,r){const[o,,a]=t,i=(r[o]||[]).length;a<i?(Qr(e,a,n),Vt(n)):i===a&&(Vt(e),Qr(e,a,n),r[o+1]&&(n[n.length-1].post+=" ")),hi(e,t[2],n),t[4]=n[n.length-1].id};let Et=0;const Zr=e=>(e=e.length<3?"0"+e:e,e.length<3?"0"+e:e),di=function(e){let[t,n]=e.index||[0,0];Et+=1,Et=Et>46655?0:Et,t=t>46655?0:t,n=n>1294?0:n;let r=Zr(Et.toString(36));r+=Zr(t.toString(36));let o=n.toString(36);o=o.length<2?"0"+o:o,r+=o;const a=parseInt(Math.random()*36,10);return r+=a.toString(36),e.normal+"|"+r.toUpperCase()},Xr=function(e){e.has("@hasContraction")&&typeof e.contractions=="function"&&e.grow("@hasContraction").contractions().expand()},Yr=e=>Object.prototype.toString.call(e)==="[object Array]",au=function(e){return e=e.map(t=>(t.id=di(t),t)),e},iu=function(e,t){const{methods:n}=t;return typeof e=="string"?n.one.tokenize.fromString(e,t)[0]:typeof e=="object"&&e.isView?e.clone().docs[0]||[]:Yr(e)?Yr(e[0])?e[0]:e:[]},eo=function(e,t,n){const{document:r,world:o}=t;t.uncache();const a=t.fullPointer,i=t.fullPointer;t.forEach((u,l)=>{const c=u.fullPointer[0],[d]=c,g=r[d];let x=iu(e,o);x.length!==0&&(x=au(x),n?(Xr(t.update([c]).firstTerm()),ru(g,c,x,r)):(Xr(t.update([c]).lastTerm()),ou(g,c,x,r)),r[d]&&r[d][c[1]]&&(c[3]=r[d][c[1]].id),i[l]=c,c[2]+=x.length,a[l]=c)});const s=t.toView(a);return t.ptrs=i,s.compute(["id","index","freeze","lexicon"]),s.world.compute.preTagger&&s.compute("preTagger"),s.compute("unfreeze"),s},ut={insertAfter:function(e){return eo(e,this,!1)},insertBefore:function(e){return eo(e,this,!0)}};ut.append=ut.insertAfter;ut.prepend=ut.insertBefore;ut.insert=ut.insertAfter;const su=/\$[0-9a-z]+/g,Tr={},uu=e=>new RegExp("^\\p{Lu}[\\p{Ll}'’]","u").test(e)||new RegExp("^\\p{Lu}$","u").test(e),lu=e=>e.replace(new RegExp("^\\p{Ll}","u"),t=>t.toUpperCase()),cu=e=>e.replace(new RegExp("^\\p{Lu}","u"),t=>t.toLowerCase()),hu=function(e,t,n){return e.forEach(r=>{const o=t(r);r.replaceWith(o,n)}),e},du=function(e,t){if(typeof e!="string")return e;const n=t.groups();return e=e.replace(su,r=>{const o=r.replace(/\$/,"");return n.hasOwnProperty(o)?n[o].text():r}),e};Tr.replaceWith=function(e,t={}){let n=this.fullPointer;const r=this;if(this.uncache(),typeof e=="function")return hu(r,e,t);const o=r.docs[0];if(!o)return r;const a=t.possessives&&o[o.length-1].tags.has("Possessive"),i=t.case&&uu(o[0].text);e=du(e,r);const s=this.update(n);n=n.map(g=>g.slice(0,3));const u=(s.docs[0]||[]).map(g=>Array.from(g.tags)),l=s.docs[0][0].pre,c=s.docs[0][s.docs[0].length-1].post;if(typeof e=="string"&&(e=this.fromText(e).compute("id")),r.insertAfter(e),s.has("@hasContraction")&&r.contractions&&r.grow("@hasContraction+").contractions().expand(),r.delete(s),a){const g=r.docs[0],x=g[g.length-1];x.tags.has("Possessive")||(x.text+="'s",x.normal+="'s",x.tags.add("Possessive"))}if(l&&r.docs[0]&&(r.docs[0][0].pre=l),c&&r.docs[0]){const g=r.docs[0][r.docs[0].length-1];g.post.trim()||(g.post=c)}const d=r.toView(n).compute(["index","freeze","lexicon"]);if(d.world.compute.preTagger&&d.compute("preTagger"),d.compute("unfreeze"),t.tags&&d.terms().forEach((g,x)=>{g.tagSafe(u[x])}),!d.docs[0]||!d.docs[0][0])return d;if(t.case){const g=i?lu:cu;d.docs[0][0].text=g(d.docs[0][0].text)}return d};Tr.replace=function(e,t,n){if(e&&!t)return this.replaceWith(e,n);const r=this.match(e);return r.found?(this.soften(),r.replaceWith(t,n)):this};const pu=function(e,t){const n=e.length-1,r=e[n],o=e[n-t];o&&r&&(o.post+=r.post,o.post=o.post.replace(/ +([.?!,;:])/,"$1"),o.post=o.post.replace(/[,;:]+([.?!])/,"$1"))},gu=function(e,t){t.forEach(n=>{const[r,o,a]=n,i=a-o;e[r]&&(a===e[r].length&&a>1&&pu(e[r],i),e[r].splice(o,i))});for(let n=e.length-1;n>=0;n-=1)if(e[n].length===0&&(e.splice(n,1),n===e.length&&e[n-1])){const r=e[n-1],o=r[r.length-1];o&&(o.post=o.post.trimEnd())}return e},mu=function(e,t){return e=e.map(n=>{const[r]=n;return t[r]&&t[r].forEach(o=>{const a=o[2]-o[1];n[1]<=o[1]&&n[2]>=o[2]&&(n[2]-=a)}),n}),e.forEach((n,r)=>{if(n[1]===0&&n[2]==0)for(let o=r+1;o<e.length;o+=1)e[o][0]-=1,e[o][0]<0&&(e[o][0]=0)}),e=e.filter(n=>n[2]-n[1]>0),e=e.map(n=>(n[3]=null,n[4]=null,n)),e},ur={remove:function(e){const{indexN:t}=this.methods.one.pointer;this.uncache();let n=this.all(),r=this;e&&(n=this,r=this.match(e));const o=!n.ptrs;r.has("@hasContraction")&&r.contractions&&r.grow("@hasContraction").contractions().expand();let a=n.fullPointer;const i=r.fullPointer.reverse(),s=gu(this.document,i),u=t(i);return a=mu(a,u),n.ptrs=a,n.document=s,n.compute("index"),o&&(n.ptrs=void 0),e?n.toView(a):(this.ptrs=[],n.none())}};ur.delete=ur.remove;const Mt={pre:function(e,t){return e===void 0&&this.found?this.docs[0][0].pre:(this.docs.forEach(n=>{const r=n[0];t===!0?r.pre+=e:r.pre=e}),this)},post:function(e,t){if(e===void 0){const n=this.docs[this.docs.length-1];return n[n.length-1].post}return this.docs.forEach(n=>{const r=n[n.length-1];t===!0?r.post+=e:r.post=e}),this},trim:function(){if(!this.found)return this;const e=this.docs,t=e[0][0];t.pre=t.pre.trimStart();const n=e[e.length-1],r=n[n.length-1];return r.post=r.post.trimEnd(),this},hyphenate:function(){return this.docs.forEach(e=>{e.forEach((t,n)=>{n!==0&&(t.pre=""),e[n+1]&&(t.post="-")})}),this},dehyphenate:function(){const e=/[-–—]/;return this.docs.forEach(t=>{t.forEach(n=>{e.test(n.post)&&(n.post=" ")})}),this},toQuotations:function(e,t){return e=e||'"',t=t||'"',this.docs.forEach(n=>{n[0].pre=e+n[0].pre;const r=n[n.length-1];r.post=t+r.post}),this},toParentheses:function(e,t){return e=e||"(",t=t||")",this.docs.forEach(n=>{n[0].pre=e+n[0].pre;const r=n[n.length-1];r.post=t+r.post}),this}};Mt.deHyphenate=Mt.dehyphenate;Mt.toQuotation=Mt.toQuotations;const fu=(e,t)=>e.normal<t.normal?-1:e.normal>t.normal?1:0,bu=(e,t)=>{const n=e.normal.trim().length,r=t.normal.trim().length;return n<r?1:n>r?-1:0},vu=(e,t)=>e.words<t.words?1:e.words>t.words?-1:0,yu=(e,t)=>e[0]<t[0]?1:e[0]>t[0]?-1:e[1]>t[1]?1:-1,wu=function(e){const t={};return e.forEach(n=>{t[n.normal]=t[n.normal]||0,t[n.normal]+=1}),e.sort((n,r)=>{const o=t[n.normal],a=t[r.normal];return o<a?1:o>a?-1:0}),e},Vn={alpha:fu,length:bu,wordCount:vu,sequential:yu,byFreq:wu},$u=new Set(["index","sequence","seq","sequential","chron","chronological"]),ku=new Set(["freq","frequency","topk","repeats"]),Pu=new Set(["alpha","alphabetical"]),Au=function(e,t){let n=e.fullPointer;return n=n.sort((r,o)=>(r=e.update([r]),o=e.update([o]),t(r,o))),e.ptrs=n,e},xu=function(e){const{docs:t,pointer:n}=this;if(this.uncache(),typeof e=="function")return Au(this,e);e=e||"alpha";const r=n||t.map((a,i)=>[i]);let o=t.map((a,i)=>({index:i,words:a.length,normal:a.map(s=>s.machine||s.normal||"").join(" "),pointer:r[i]}));return $u.has(e)&&(e="sequential"),Pu.has(e)&&(e="alpha"),ku.has(e)?(o=Vn.byFreq(o),this.update(o.map(a=>a.pointer))):typeof Vn[e]=="function"?(o=o.sort(Vn[e]),this.update(o.map(a=>a.pointer))):this},Cu=function(){let e=this.pointer||this.docs.map((t,n)=>[n]);return e=[].concat(e),e=e.reverse(),this._cache&&(this._cache=this._cache.reverse()),this.update(e)},ju=function(){const e=new Set;return this.filter(t=>{const n=t.text("machine");return e.has(n)?!1:(e.add(n),!0)})},Nu={unique:ju,reverse:Cu,sort:xu},Iu=e=>Object.prototype.toString.call(e)==="[object Array]",pi=function(e,t){if(e.length>0){const n=e[e.length-1],r=n[n.length-1];/ /.test(r.post)===!1&&(r.post+=" ")}return e=e.concat(t),e},Tu=function(e,t){if(e.document===t.document){const n=e.fullPointer.concat(t.fullPointer);return e.toView(n).compute("index")}return t.fullPointer.forEach(n=>{n[0]+=e.document.length}),e.document=pi(e.document,t.docs),e.all()},Eu={concat:function(e){if(typeof e=="string"){const t=this.fromText(e);if(!this.found||!this.ptrs)this.document=this.document.concat(t.document);else{const n=this.fullPointer,r=n[n.length-1][0];this.document.splice(r,0,...t.document)}return this.all().compute("index")}if(typeof e=="object"&&e.isView)return Tu(this,e);if(Iu(e)){const t=pi(this.document,e);return this.document=t,this.all()}return this}},Du=function(){return this.ptrs=this.fullPointer,this},Hu=function(){let e=this.ptrs;return!e||e.length<1?this:(e=e.map(t=>t.slice(0,3)),this.ptrs=e,this)},Gu={harden:Du,soften:Hu},Ou=Object.assign({},Ys,ut,Tr,ur,Mt,Nu,Eu,Gu),Fu=function(e){Object.assign(e.prototype,Ou)},Vu={id:function(e){const t=e.docs;for(let n=0;n<t.length;n+=1)for(let r=0;r<t[n].length;r+=1){const o=t[n][r];o.id=o.id||di(o)}}},zu={api:Fu,compute:Vu},Bu=[{word:"@",out:["at"]},{word:"arent",out:["are","not"]},{word:"alot",out:["a","lot"]},{word:"brb",out:["be","right","back"]},{word:"cannot",out:["can","not"]},{word:"dun",out:["do","not"]},{word:"can't",out:["can","not"]},{word:"shan't",out:["should","not"]},{word:"won't",out:["will","not"]},{word:"that's",out:["that","is"]},{word:"what's",out:["what","is"]},{word:"let's",out:["let","us"]},{word:"dunno",out:["do","not","know"]},{word:"gonna",out:["going","to"]},{word:"gotta",out:["have","got","to"]},{word:"gimme",out:["give","me"]},{word:"outta",out:["out","of"]},{word:"tryna",out:["trying","to"]},{word:"gtg",out:["got","to","go"]},{word:"im",out:["i","am"]},{word:"imma",out:["I","will"]},{word:"imo",out:["in","my","opinion"]},{word:"irl",out:["in","real","life"]},{word:"ive",out:["i","have"]},{word:"rn",out:["right","now"]},{word:"tbh",out:["to","be","honest"]},{word:"wanna",out:["want","to"]},{word:"c'mere",out:["come","here"]},{word:"c'mon",out:["come","on"]},{word:"shoulda",out:["should","have"]},{word:"coulda",out:["coulda","have"]},{word:"woulda",out:["woulda","have"]},{word:"musta",out:["must","have"]},{word:"tis",out:["it","is"]},{word:"twas",out:["it","was"]},{word:"y'know",out:["you","know"]},{word:"ne'er",out:["never"]},{word:"o'er",out:["over"]},{after:"ll",out:["will"]},{after:"ve",out:["have"]},{after:"re",out:["are"]},{after:"m",out:["am"]},{before:"c",out:["ce"]},{before:"m",out:["me"]},{before:"n",out:["ne"]},{before:"qu",out:["que"]},{before:"s",out:["se"]},{before:"t",out:["tu"]},{word:"shouldnt",out:["should","not"]},{word:"couldnt",out:["could","not"]},{word:"wouldnt",out:["would","not"]},{word:"hasnt",out:["has","not"]},{word:"wasnt",out:["was","not"]},{word:"isnt",out:["is","not"]},{word:"cant",out:["can","not"]},{word:"dont",out:["do","not"]},{word:"wont",out:["will","not"]},{word:"howd",out:["how","did"]},{word:"whatd",out:["what","did"]},{word:"whend",out:["when","did"]},{word:"whered",out:["where","did"]}],Su={st:!0,nd:!0,rd:!0,th:!0,am:!0,pm:!0,max:!0,"°":!0,s:!0,e:!0,er:!0,ère:!0,ème:!0},Mu={one:{contractions:Bu,numberSuffixes:Su}},zn=function(e,t,n){const[r,o]=t;!n||n.length===0||(n=n.map((a,i)=>(a.implicit=a.text,a.machine=a.text,a.pre="",a.post="",a.text="",a.normal="",a.index=[r,o+i],a)),n[0]&&(n[0].pre=e[r][o].pre,n[n.length-1].post=e[r][o].post,n[0].text=e[r][o].text,n[0].normal=e[r][o].normal),e[r].splice(o,1,...n))},Lu=/'/,Ku=new Set(["what","how","when","where","why"]),Ju=new Set(["be","go","start","think","need"]),Wu=new Set(["been","gone"]),qu=function(e,t){const n=e[t].normal.split(Lu)[0];if(Ku.has(n))return[n,"did"];if(e[t+1]){if(Wu.has(e[t+1].normal))return[n,"had"];if(Ju.has(e[t+1].normal))return[n,"would"]}return null},Ru=function(e,t){return e[t].normal==="ain't"||e[t].normal==="aint"?null:[e[t].normal.replace(/n't/,""),"not"]},Er=/'/,Uu=/(e|é|aison|sion|tion)$/,_u=/(age|isme|acle|ege|oire)$/,Qu=(e,t)=>{const n=e[t].normal.split(Er)[1];return n&&n.endsWith("e")?["la",n]:["le",n]},Zu=(e,t)=>{const n=e[t].normal.split(Er)[1];return n&&Uu.test(n)&&!_u.test(n)?["du",n]:n&&n.endsWith("s")?["des",n]:["de",n]},Xu=(e,t)=>["je",e[t].normal.split(Er)[1]],Bn={preJ:Xu,preL:Qu,preD:Zu},Yu=/^([0-9.]{1,4}[a-z]{0,2}) ?[-–—] ?([0-9]{1,4}[a-z]{0,2})$/i,el=/^([0-9]{1,2}(:[0-9][0-9])?(am|pm)?) ?[-–—] ?([0-9]{1,2}(:[0-9][0-9])?(am|pm)?)$/i,tl=/^[0-9]{3}-[0-9]{4}$/,nl=function(e,t){const n=e[t];let r=n.text.match(Yu);return r!==null?n.tags.has("PhoneNumber")===!0||tl.test(n.text)?null:[r[1],"to",r[2]]:(r=n.text.match(el),r!==null?[r[1],"to",r[4]]:null)},rl=/^([+-]?[0-9][.,0-9]*)([a-z°²³µ/]+)$/,ol=function(e,t,n){const r=n.model.one.numberSuffixes||{},o=e[t].text.match(rl);if(o!==null){const a=o[2].toLowerCase().trim();return r.hasOwnProperty(a)?null:[o[1],a]}return null},to=/'/,al=/^[0-9][^-–—]*[-–—].*?[0-9]/,no=function(e,t,n,r){const o=t.update();o.document=[e];let a=n+r;n>0&&(n-=1),e[a]&&(a+=1),o.ptrs=[[0,n,a]]},ro={t:(e,t)=>Ru(e,t),d:(e,t)=>qu(e,t)},oo={j:(e,t)=>Bn.preJ(e,t),l:(e,t)=>Bn.preL(e,t),d:(e,t)=>Bn.preD(e,t)},il=function(e,t,n,r){for(let o=0;o<e.length;o+=1){const a=e[o];if(a.word===t.normal)return a.out;if(r!==null&&r===a.after)return[n].concat(a.out);if(n!==null&&n===a.before&&r&&r.length>2)return a.out.concat(r)}return null},Sn=function(e,t){const n=t.fromText(e.join(" "));return n.compute(["id","alias"]),n.docs[0]},sl=function(e,t){for(let n=t+1;n<5&&e[n];n+=1)if(e[n].normal==="been")return["there","has"];return["there","is"]},ul=e=>{const{world:t,document:n}=e,{model:r,methods:o}=t,a=r.one.contractions||[];n.forEach((i,s)=>{for(let u=i.length-1;u>=0;u-=1){let l=null,c=null;if(to.test(i[u].normal)===!0){const g=i[u].normal.split(to);l=g[0],c=g[1]}let d=il(a,i[u],l,c);if(!d&&ro.hasOwnProperty(c)&&(d=ro[c](i,u,t)),!d&&oo.hasOwnProperty(l)&&(d=oo[l](i,u)),l==="there"&&c==="s"&&(d=sl(i,u)),d){d=Sn(d,e),zn(n,[s,u],d),no(n[s],e,u,d.length);continue}if(al.test(i[u].normal)){d=nl(i,u),d&&(d=Sn(d,e),zn(n,[s,u],d),o.one.setTag(d,"NumberRange",t),d[2]&&d[2].tags.has("Time")&&o.one.setTag([d[0]],"Time",t,null,"time-range"),no(n[s],e,u,d.length));continue}d=ol(i,u,t),d&&(d=Sn(d,e),zn(n,[s,u],d),o.one.setTag([d[1]],"Unit",t,null,"contraction-unit"))}})},ll={contractions:ul},cl={model:Mu,compute:ll,hooks:["contractions"]},ao=function(e){const t=e.world,{model:n,methods:r}=e.world,o=r.one.setTag,{frozenLex:a}=n.one,i=n.one._multiCache||{};e.docs.forEach(s=>{for(let u=0;u<s.length;u+=1){const l=s[u],c=l.machine||l.normal;if(i[c]!==void 0&&s[u+1]){const d=u+i[c]-1;for(let g=d;g>u;g-=1){const x=s.slice(u,g+1),G=x.map(U=>U.machine||U.normal).join(" ");if(a.hasOwnProperty(G)===!0){o(x,a[G],t,!1,"1-frozen-multi-lexicon"),x.forEach(U=>U.frozen=!0);continue}}}if(a[c]!==void 0&&a.hasOwnProperty(c)){o([l],a[c],t,!1,"1-freeze-lexicon"),l.frozen=!0;continue}}})},hl=function(e){return e.docs.forEach(t=>{t.forEach(n=>{delete n.frozen})}),e},dl={frozen:ao,freeze:ao,unfreeze:hl},io=e=>"\x1B[34m"+e+"\x1B[0m",so=e=>"\x1B[3m\x1B[2m"+e+"\x1B[0m",uo=function(e){e.docs.forEach(t=>{console.log(io(`
1
+ import{createRequire as ps}from"node:module";import{E as De,s as Wt,V as oi,I as Cr,q as ai}from"../packem_shared/index.server-J83sowC4.js";import{T as ms,f as jr,A as At,y as Nr,B as Pt,v as fs,m as St}from"../packem_shared/index-OQZQyN5R.js";import{g as bs}from"../packem_shared/_commonjsHelpers-B5Y90VFO.js";import{fingerprint as yt,scan as ii,scanFiles as vs,inspectRuleset as ys,listRules as Ir,listRequiredValidators as ws,scanGitHistory as $s}from"@visulima/secret-scanner";import{ao as ks,ap as Rr,p as de}from"./cli-main.js";import{o as Ps}from"../packem_shared/MultiSpinner-B9U0-aE3-B-gIXhFk.js";import{a as As}from"../packem_shared/readJsonSync-CvkZyKmL-CY7PZob_.js";const gs=ps(import.meta.url),Tt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ri=e=>{if(typeof Tt<"u"&&Tt.versions&&Tt.versions.node){const[t,n]=Tt.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return Tt.getBuiltinModule(e)}return gs(e)},{pathToFileURL:si}=ri("node:url"),{execFileSync:xs}=ri("node:child_process"),Cs={one:{},two:{},three:{},four:{}},js={one:{},two:{},three:{}},Ns={},Is=[],ar={methods:Cs,model:js,compute:Ns,hooks:Is},Ts=e=>Object.prototype.toString.call(e)==="[object Array]",Es={compute:function(e){const{world:t}=this,n=t.compute;return typeof e=="string"&&n.hasOwnProperty(e)?n[e](this):Ts(e)?e.forEach(r=>{t.compute.hasOwnProperty(r)?n[r](this):console.warn("no compute:",e)}):typeof e=="function"?e(this):console.warn("no compute:",e),this}},Ds=function(e){return this.fullPointer.forEach((t,n)=>{const r=this.update([t]);e(r,n)}),this},Hs=function(e,t){const n=this.fullPointer.map((o,a)=>{const i=this.update([o]),s=e(i,a);return s===void 0?this.none():s});if(n.length===0)return t||this.update([]);if(n[0]!==void 0&&(typeof n[0]=="string"||typeof n[0]=="object"&&(n[0]===null||!n[0].isView)))return n;let r=[];return n.forEach(o=>{r=r.concat(o.fullPointer)}),this.toView(r)},Gs=function(e){let t=this.fullPointer;return t=t.filter((n,r)=>{const o=this.update([n]);return e(o,r)}),this.update(t)},Os=function(e){const t=this.fullPointer.find((n,r)=>{const o=this.update([n]);return e(o,r)});return this.update([t])},Fs=function(e){return this.fullPointer.some((t,n)=>{const r=this.update([t]);return e(r,n)})},Vs=function(e=1){let t=this.fullPointer,n=Math.floor(Math.random()*t.length);return n+e>this.length&&(n=this.length-e,n=n<0?0:n),t=t.slice(n,n+e),this.update(t)},zs={forEach:Ds,map:Hs,filter:Gs,find:Os,some:Fs,random:Vs},He={termList:function(){return this.methods.one.termList(this.docs)},terms:function(e){const t=this.match(".");return typeof e=="number"?t.eq(e):t},groups:function(e){if(e||e===0)return this.update(this._groups[e]||[]);const t={};return Object.keys(this._groups).forEach(n=>{t[n]=this.update(this._groups[n])}),t},eq:function(e){let t=this.pointer;return t||(t=this.docs.map((n,r)=>[r])),t[e]?this.update([t[e]]):this.none()},first:function(){return this.eq(0)},last:function(){const e=this.fullPointer.length-1;return this.eq(e)},firstTerms:function(){return this.match("^.")},lastTerms:function(){return this.match(".$")},slice:function(e,t){let n=this.pointer||this.docs.map((r,o)=>[o]);return n=n.slice(e,t),this.update(n)},all:function(){return this.update().toView()},fullSentences:function(){const e=this.fullPointer.map(t=>[t[0]]);return this.update(e).toView()},none:function(){return this.update([])},isDoc:function(e){if(!e||!e.isView)return!1;const t=this.fullPointer,n=e.fullPointer;return!t.length===n.length?!1:t.every((r,o)=>n[o]?r[0]===n[o][0]&&r[1]===n[o][1]&&r[2]===n[o][2]:!1)},wordCount:function(){return this.docs.reduce((e,t)=>(e+=t.filter(n=>n.text!=="").length,e),0)},isFull:function(){const e=this.pointer;if(!e)return!0;if(e.length===0||e[0][0]!==0)return!1;let t=0,n=0;return this.document.forEach(r=>t+=r.length),this.docs.forEach(r=>n+=r.length),t===n},getNth:function(e){return typeof e=="number"?this.eq(e):typeof e=="string"?this.if(e):this}};He.group=He.groups;He.fullSentence=He.fullSentences;He.sentence=He.fullSentences;He.lastTerm=He.lastTerms;He.firstTerm=He.firstTerms;const ir=Object.assign({},He,Es,zs);ir.get=ir.eq;let En=class vn{constructor(t,n,r={}){[["document",t],["world",ar],["_groups",r],["_cache",null],["viewType","View"]].forEach(o=>{Object.defineProperty(this,o[0],{value:o[1],writable:!0})}),this.ptrs=n}get docs(){let t=this.document;return this.ptrs&&(t=ar.methods.one.getDoc(this.ptrs,this.document)),t}get pointer(){return this.ptrs}get methods(){return this.world.methods}get model(){return this.world.model}get hooks(){return this.world.hooks}get isView(){return!0}get found(){return this.docs.length>0}get length(){return this.docs.length}get fullPointer(){const{docs:t,ptrs:n,document:r}=this;return(n||t.map((o,a)=>[a])).map(o=>{let[a,i,s,u,l]=o;return i=i||0,s=s||(r[a]||[]).length,r[a]&&r[a][i]&&(u=u||r[a][i].id,r[a][s-1]&&(l=l||r[a][s-1].id)),[a,i,s,u,l]})}update(t){const n=new vn(this.document,t);if(this._cache&&t&&t.length>0){const r=[];t.forEach((o,a)=>{const[i,s,u]=o;o.length===1?r[a]=this._cache[i]:s===0&&this.document[i].length===u&&(r[a]=this._cache[i])}),r.length>0&&(n._cache=r)}return n.world=this.world,n}toView(t){return new vn(this.document,t||this.pointer)}fromText(t){const{methods:n}=this,r=n.one.tokenize.fromString(t,this.world),o=new vn(r);return o.world=this.world,o.compute(["normal","freeze","lexicon"]),this.world.compute.preTagger&&o.compute("preTagger"),o.compute("unfreeze"),o}clone(){let t=this.document.slice(0);t=t.map(r=>r.map(o=>(o=Object.assign({},o),o.tags=new Set(o.tags),o)));const n=this.update(this.pointer);return n.document=t,n._cache=this._cache,n}};Object.assign(En.prototype,ir);const Bs="14.15.1",Ur=function(e){return e&&typeof e=="object"&&!Array.isArray(e)},Ss=function(e){return Object.prototype.toString.call(e)==="[object Array]"};function ui(e,t){if(Ur(t))for(const n in t)Ur(t[n])?(e[n]||Object.assign(e,{[n]:{}}),ui(e[n],t[n])):Object.assign(e,{[n]:t[n]});return e}function Ms(e,t){for(const n in t)e[n]=e[n]||{},Object.assign(e[n],t[n]);return e}const Ls=function(e,t){const n=e.two.models||{};Object.keys(t).forEach(r=>{t[r].pastTense&&(n.toPast&&(n.toPast.ex[r]=t[r].pastTense),n.fromPast&&(n.fromPast.ex[t[r].pastTense]=r)),t[r].presentTense&&(n.toPresent&&(n.toPresent.ex[r]=t[r].presentTense),n.fromPresent&&(n.fromPresent.ex[t[r].presentTense]=r)),t[r].gerund&&(n.toGerund&&(n.toGerund.ex[r]=t[r].gerund),n.fromGerund&&(n.fromGerund.ex[t[r].gerund]=r)),t[r].comparative&&(n.toComparative&&(n.toComparative.ex[r]=t[r].comparative),n.fromComparative&&(n.fromComparative.ex[t[r].comparative]=r)),t[r].superlative&&(n.toSuperlative&&(n.toSuperlative.ex[r]=t[r].superlative),n.fromSuperlative&&(n.fromSuperlative.ex[t[r].superlative]=r))})},li=function(e,t,n,r){if(Ss(e)){e.forEach(u=>li(u,t,n,r));return}const{methods:o,model:a,compute:i,hooks:s}=t;e.methods&&Ms(o,e.methods),e.model&&ui(a,e.model),e.irregulars&&Ls(a,e.irregulars),e.compute&&Object.assign(i,e.compute),s&&(t.hooks=s.concat(e.hooks||[])),e.api&&e.api(n),e.lib&&Object.keys(e.lib).forEach(u=>r[u]=e.lib[u]),e.tags&&r.addTags(e.tags),e.words&&r.addWords(e.words),e.frozen&&r.addWords(e.frozen,!0),e.mutate&&e.mutate(t,r)},Ks=function(e){const t=process.env?process.env:self.env||{};return t.DEBUG_TAGS=e==="tagger"||e===!0?!0:"",t.DEBUG_MATCH=e==="match"||e===!0?!0:"",t.DEBUG_CHUNKS=e==="chunker"||e===!0?!0:"",this},Js=e=>Object.prototype.toString.call(e)==="[object Object]",sr=function(e){return Object.prototype.toString.call(e)==="[object Array]"},Ws=function(e){return e.map(t=>t.terms.map(n=>(sr(n.tags)&&(n.tags=new Set(n.tags)),n)))},qs=function(e){return e.map(t=>t.map(n=>({text:n,normal:n,pre:"",post:" ",tags:new Set})))},ci=function(e,t,n){const{methods:r}=n,o=new t([]);if(o.world=n,typeof e=="number"&&(e=String(e)),!e)return o;if(typeof e=="string"){const a=r.one.tokenize.fromString(e,n);return new t(a)}if(Js(e)&&e.isView)return new t(e.document,e.ptrs);if(sr(e)){if(sr(e[0])){const i=qs(e);return new t(i)}const a=Ws(e);return new t(a)}return o},xn=Object.assign({},ar),T=function(e,t){t&&T.addWords(t);const n=ci(e,En,xn);return e&&n.compute(xn.hooks),n};Object.defineProperty(T,"_world",{value:xn,writable:!0});T.tokenize=function(e,t){const{compute:n}=this._world;t&&T.addWords(t);const r=ci(e,En,xn);return n.contractions&&r.compute(["alias","normal","machine","contractions"]),r};T.plugin=function(e){return li(e,this._world,En,this),this};T.extend=T.plugin;T.world=function(){return this._world};T.model=function(){return this._world.model};T.methods=function(){return this._world.methods};T.hooks=function(){return this._world.hooks};T.verbose=Ks;T.version=Bs;const Rs=function(e){return e.map(t=>{const n=new Set;return t.forEach(r=>{r.normal!==""&&n.add(r.normal),r.switch&&n.add(`%${r.switch}%`),r.implicit&&n.add(r.implicit),r.machine&&n.add(r.machine),r.root&&n.add(r.root),r.alias&&r.alias.forEach(a=>n.add(a));const o=Array.from(r.tags);for(let a=0;a<o.length;a+=1)n.add("#"+o[a])}),n})},Us={one:{cacheDoc:Rs}},_s={cache:function(){return this._cache=this.methods.one.cacheDoc(this.document),this},uncache:function(){return this._cache=null,this}},Qs=function(e){Object.assign(e.prototype,_s)},Zs={cache:function(e){e._cache=e.methods.one.cacheDoc(e.document)}},Xs={api:Qs,compute:Zs,methods:Us},Ys={toLowerCase:function(){return this.termList().forEach(e=>{e.text=e.text.toLowerCase()}),this},toUpperCase:function(){return this.termList().forEach(e=>{e.text=e.text.toUpperCase()}),this},toTitleCase:function(){return this.termList().forEach(e=>{e.text=e.text.replace(/^ *[a-z\u00C0-\u00FF]/,t=>t.toUpperCase())}),this},toCamelCase:function(){return this.docs.forEach(e=>{e.forEach((t,n)=>{n!==0&&(t.text=t.text.replace(/^ *[a-z\u00C0-\u00FF]/,r=>r.toUpperCase())),n!==e.length-1&&(t.post="")})}),this}},_r=e=>new RegExp("^\\p{Lu}[\\p{Ll}'’]","u").test(e)||new RegExp("^\\p{Lu}$","u").test(e),eu=e=>e.replace(new RegExp("^\\p{Ll}","u"),t=>t.toUpperCase()),tu=e=>e.replace(new RegExp("^\\p{Lu}","u"),t=>t.toLowerCase()),hi=(e,t,n)=>{if(n.forEach(r=>r.dirty=!0),e){const r=[t,0].concat(n);Array.prototype.splice.apply(e,r)}return e},Vt=function(e){const t=/ $/,n=/[-–—]/,r=e[e.length-1];r&&!t.test(r.post)&&!n.test(r.post)&&(r.post+=" ")},Qr=(e,t,n)=>{const r=/[-.?!,;:)–—'"]/g,o=e[t-1];if(!o)return;const a=o.post;if(r.test(a)){const i=a.match(r).join(""),s=n[n.length-1];s.post=i+s.post,o.post=o.post.replace(r,"")}},nu=function(e,t,n){const r=e[t];if(t!==0||!_r(r.text))return;n[0].text=eu(n[0].text);const o=e[t];o.tags.has("ProperNoun")||o.tags.has("Acronym")||_r(o.text)&&o.text.length>1&&(o.text=tu(o.text))},ru=function(e,t,n,r){const[o,a,i]=t;a===0||i===r[o].length?Vt(n):(Vt(n),Vt([e[t[1]]])),nu(e,a,n),hi(e,a,n)},ou=function(e,t,n,r){const[o,,a]=t,i=(r[o]||[]).length;a<i?(Qr(e,a,n),Vt(n)):i===a&&(Vt(e),Qr(e,a,n),r[o+1]&&(n[n.length-1].post+=" ")),hi(e,t[2],n),t[4]=n[n.length-1].id};let Et=0;const Zr=e=>(e=e.length<3?"0"+e:e,e.length<3?"0"+e:e),di=function(e){let[t,n]=e.index||[0,0];Et+=1,Et=Et>46655?0:Et,t=t>46655?0:t,n=n>1294?0:n;let r=Zr(Et.toString(36));r+=Zr(t.toString(36));let o=n.toString(36);o=o.length<2?"0"+o:o,r+=o;const a=parseInt(Math.random()*36,10);return r+=a.toString(36),e.normal+"|"+r.toUpperCase()},Xr=function(e){e.has("@hasContraction")&&typeof e.contractions=="function"&&e.grow("@hasContraction").contractions().expand()},Yr=e=>Object.prototype.toString.call(e)==="[object Array]",au=function(e){return e=e.map(t=>(t.id=di(t),t)),e},iu=function(e,t){const{methods:n}=t;return typeof e=="string"?n.one.tokenize.fromString(e,t)[0]:typeof e=="object"&&e.isView?e.clone().docs[0]||[]:Yr(e)?Yr(e[0])?e[0]:e:[]},eo=function(e,t,n){const{document:r,world:o}=t;t.uncache();const a=t.fullPointer,i=t.fullPointer;t.forEach((u,l)=>{const c=u.fullPointer[0],[d]=c,g=r[d];let x=iu(e,o);x.length!==0&&(x=au(x),n?(Xr(t.update([c]).firstTerm()),ru(g,c,x,r)):(Xr(t.update([c]).lastTerm()),ou(g,c,x,r)),r[d]&&r[d][c[1]]&&(c[3]=r[d][c[1]].id),i[l]=c,c[2]+=x.length,a[l]=c)});const s=t.toView(a);return t.ptrs=i,s.compute(["id","index","freeze","lexicon"]),s.world.compute.preTagger&&s.compute("preTagger"),s.compute("unfreeze"),s},ut={insertAfter:function(e){return eo(e,this,!1)},insertBefore:function(e){return eo(e,this,!0)}};ut.append=ut.insertAfter;ut.prepend=ut.insertBefore;ut.insert=ut.insertAfter;const su=/\$[0-9a-z]+/g,Tr={},uu=e=>new RegExp("^\\p{Lu}[\\p{Ll}'’]","u").test(e)||new RegExp("^\\p{Lu}$","u").test(e),lu=e=>e.replace(new RegExp("^\\p{Ll}","u"),t=>t.toUpperCase()),cu=e=>e.replace(new RegExp("^\\p{Lu}","u"),t=>t.toLowerCase()),hu=function(e,t,n){return e.forEach(r=>{const o=t(r);r.replaceWith(o,n)}),e},du=function(e,t){if(typeof e!="string")return e;const n=t.groups();return e=e.replace(su,r=>{const o=r.replace(/\$/,"");return n.hasOwnProperty(o)?n[o].text():r}),e};Tr.replaceWith=function(e,t={}){let n=this.fullPointer;const r=this;if(this.uncache(),typeof e=="function")return hu(r,e,t);const o=r.docs[0];if(!o)return r;const a=t.possessives&&o[o.length-1].tags.has("Possessive"),i=t.case&&uu(o[0].text);e=du(e,r);const s=this.update(n);n=n.map(g=>g.slice(0,3));const u=(s.docs[0]||[]).map(g=>Array.from(g.tags)),l=s.docs[0][0].pre,c=s.docs[0][s.docs[0].length-1].post;if(typeof e=="string"&&(e=this.fromText(e).compute("id")),r.insertAfter(e),s.has("@hasContraction")&&r.contractions&&r.grow("@hasContraction+").contractions().expand(),r.delete(s),a){const g=r.docs[0],x=g[g.length-1];x.tags.has("Possessive")||(x.text+="'s",x.normal+="'s",x.tags.add("Possessive"))}if(l&&r.docs[0]&&(r.docs[0][0].pre=l),c&&r.docs[0]){const g=r.docs[0][r.docs[0].length-1];g.post.trim()||(g.post=c)}const d=r.toView(n).compute(["index","freeze","lexicon"]);if(d.world.compute.preTagger&&d.compute("preTagger"),d.compute("unfreeze"),t.tags&&d.terms().forEach((g,x)=>{g.tagSafe(u[x])}),!d.docs[0]||!d.docs[0][0])return d;if(t.case){const g=i?lu:cu;d.docs[0][0].text=g(d.docs[0][0].text)}return d};Tr.replace=function(e,t,n){if(e&&!t)return this.replaceWith(e,n);const r=this.match(e);return r.found?(this.soften(),r.replaceWith(t,n)):this};const pu=function(e,t){const n=e.length-1,r=e[n],o=e[n-t];o&&r&&(o.post+=r.post,o.post=o.post.replace(/ +([.?!,;:])/,"$1"),o.post=o.post.replace(/[,;:]+([.?!])/,"$1"))},gu=function(e,t){t.forEach(n=>{const[r,o,a]=n,i=a-o;e[r]&&(a===e[r].length&&a>1&&pu(e[r],i),e[r].splice(o,i))});for(let n=e.length-1;n>=0;n-=1)if(e[n].length===0&&(e.splice(n,1),n===e.length&&e[n-1])){const r=e[n-1],o=r[r.length-1];o&&(o.post=o.post.trimEnd())}return e},mu=function(e,t){return e=e.map(n=>{const[r]=n;return t[r]&&t[r].forEach(o=>{const a=o[2]-o[1];n[1]<=o[1]&&n[2]>=o[2]&&(n[2]-=a)}),n}),e.forEach((n,r)=>{if(n[1]===0&&n[2]==0)for(let o=r+1;o<e.length;o+=1)e[o][0]-=1,e[o][0]<0&&(e[o][0]=0)}),e=e.filter(n=>n[2]-n[1]>0),e=e.map(n=>(n[3]=null,n[4]=null,n)),e},ur={remove:function(e){const{indexN:t}=this.methods.one.pointer;this.uncache();let n=this.all(),r=this;e&&(n=this,r=this.match(e));const o=!n.ptrs;r.has("@hasContraction")&&r.contractions&&r.grow("@hasContraction").contractions().expand();let a=n.fullPointer;const i=r.fullPointer.reverse(),s=gu(this.document,i),u=t(i);return a=mu(a,u),n.ptrs=a,n.document=s,n.compute("index"),o&&(n.ptrs=void 0),e?n.toView(a):(this.ptrs=[],n.none())}};ur.delete=ur.remove;const Mt={pre:function(e,t){return e===void 0&&this.found?this.docs[0][0].pre:(this.docs.forEach(n=>{const r=n[0];t===!0?r.pre+=e:r.pre=e}),this)},post:function(e,t){if(e===void 0){const n=this.docs[this.docs.length-1];return n[n.length-1].post}return this.docs.forEach(n=>{const r=n[n.length-1];t===!0?r.post+=e:r.post=e}),this},trim:function(){if(!this.found)return this;const e=this.docs,t=e[0][0];t.pre=t.pre.trimStart();const n=e[e.length-1],r=n[n.length-1];return r.post=r.post.trimEnd(),this},hyphenate:function(){return this.docs.forEach(e=>{e.forEach((t,n)=>{n!==0&&(t.pre=""),e[n+1]&&(t.post="-")})}),this},dehyphenate:function(){const e=/[-–—]/;return this.docs.forEach(t=>{t.forEach(n=>{e.test(n.post)&&(n.post=" ")})}),this},toQuotations:function(e,t){return e=e||'"',t=t||'"',this.docs.forEach(n=>{n[0].pre=e+n[0].pre;const r=n[n.length-1];r.post=t+r.post}),this},toParentheses:function(e,t){return e=e||"(",t=t||")",this.docs.forEach(n=>{n[0].pre=e+n[0].pre;const r=n[n.length-1];r.post=t+r.post}),this}};Mt.deHyphenate=Mt.dehyphenate;Mt.toQuotation=Mt.toQuotations;const fu=(e,t)=>e.normal<t.normal?-1:e.normal>t.normal?1:0,bu=(e,t)=>{const n=e.normal.trim().length,r=t.normal.trim().length;return n<r?1:n>r?-1:0},vu=(e,t)=>e.words<t.words?1:e.words>t.words?-1:0,yu=(e,t)=>e[0]<t[0]?1:e[0]>t[0]?-1:e[1]>t[1]?1:-1,wu=function(e){const t={};return e.forEach(n=>{t[n.normal]=t[n.normal]||0,t[n.normal]+=1}),e.sort((n,r)=>{const o=t[n.normal],a=t[r.normal];return o<a?1:o>a?-1:0}),e},Vn={alpha:fu,length:bu,wordCount:vu,sequential:yu,byFreq:wu},$u=new Set(["index","sequence","seq","sequential","chron","chronological"]),ku=new Set(["freq","frequency","topk","repeats"]),Pu=new Set(["alpha","alphabetical"]),Au=function(e,t){let n=e.fullPointer;return n=n.sort((r,o)=>(r=e.update([r]),o=e.update([o]),t(r,o))),e.ptrs=n,e},xu=function(e){const{docs:t,pointer:n}=this;if(this.uncache(),typeof e=="function")return Au(this,e);e=e||"alpha";const r=n||t.map((a,i)=>[i]);let o=t.map((a,i)=>({index:i,words:a.length,normal:a.map(s=>s.machine||s.normal||"").join(" "),pointer:r[i]}));return $u.has(e)&&(e="sequential"),Pu.has(e)&&(e="alpha"),ku.has(e)?(o=Vn.byFreq(o),this.update(o.map(a=>a.pointer))):typeof Vn[e]=="function"?(o=o.sort(Vn[e]),this.update(o.map(a=>a.pointer))):this},Cu=function(){let e=this.pointer||this.docs.map((t,n)=>[n]);return e=[].concat(e),e=e.reverse(),this._cache&&(this._cache=this._cache.reverse()),this.update(e)},ju=function(){const e=new Set;return this.filter(t=>{const n=t.text("machine");return e.has(n)?!1:(e.add(n),!0)})},Nu={unique:ju,reverse:Cu,sort:xu},Iu=e=>Object.prototype.toString.call(e)==="[object Array]",pi=function(e,t){if(e.length>0){const n=e[e.length-1],r=n[n.length-1];/ /.test(r.post)===!1&&(r.post+=" ")}return e=e.concat(t),e},Tu=function(e,t){if(e.document===t.document){const n=e.fullPointer.concat(t.fullPointer);return e.toView(n).compute("index")}return t.fullPointer.forEach(n=>{n[0]+=e.document.length}),e.document=pi(e.document,t.docs),e.all()},Eu={concat:function(e){if(typeof e=="string"){const t=this.fromText(e);if(!this.found||!this.ptrs)this.document=this.document.concat(t.document);else{const n=this.fullPointer,r=n[n.length-1][0];this.document.splice(r,0,...t.document)}return this.all().compute("index")}if(typeof e=="object"&&e.isView)return Tu(this,e);if(Iu(e)){const t=pi(this.document,e);return this.document=t,this.all()}return this}},Du=function(){return this.ptrs=this.fullPointer,this},Hu=function(){let e=this.ptrs;return!e||e.length<1?this:(e=e.map(t=>t.slice(0,3)),this.ptrs=e,this)},Gu={harden:Du,soften:Hu},Ou=Object.assign({},Ys,ut,Tr,ur,Mt,Nu,Eu,Gu),Fu=function(e){Object.assign(e.prototype,Ou)},Vu={id:function(e){const t=e.docs;for(let n=0;n<t.length;n+=1)for(let r=0;r<t[n].length;r+=1){const o=t[n][r];o.id=o.id||di(o)}}},zu={api:Fu,compute:Vu},Bu=[{word:"@",out:["at"]},{word:"arent",out:["are","not"]},{word:"alot",out:["a","lot"]},{word:"brb",out:["be","right","back"]},{word:"cannot",out:["can","not"]},{word:"dun",out:["do","not"]},{word:"can't",out:["can","not"]},{word:"shan't",out:["should","not"]},{word:"won't",out:["will","not"]},{word:"that's",out:["that","is"]},{word:"what's",out:["what","is"]},{word:"let's",out:["let","us"]},{word:"dunno",out:["do","not","know"]},{word:"gonna",out:["going","to"]},{word:"gotta",out:["have","got","to"]},{word:"gimme",out:["give","me"]},{word:"outta",out:["out","of"]},{word:"tryna",out:["trying","to"]},{word:"gtg",out:["got","to","go"]},{word:"im",out:["i","am"]},{word:"imma",out:["I","will"]},{word:"imo",out:["in","my","opinion"]},{word:"irl",out:["in","real","life"]},{word:"ive",out:["i","have"]},{word:"rn",out:["right","now"]},{word:"tbh",out:["to","be","honest"]},{word:"wanna",out:["want","to"]},{word:"c'mere",out:["come","here"]},{word:"c'mon",out:["come","on"]},{word:"shoulda",out:["should","have"]},{word:"coulda",out:["coulda","have"]},{word:"woulda",out:["woulda","have"]},{word:"musta",out:["must","have"]},{word:"tis",out:["it","is"]},{word:"twas",out:["it","was"]},{word:"y'know",out:["you","know"]},{word:"ne'er",out:["never"]},{word:"o'er",out:["over"]},{after:"ll",out:["will"]},{after:"ve",out:["have"]},{after:"re",out:["are"]},{after:"m",out:["am"]},{before:"c",out:["ce"]},{before:"m",out:["me"]},{before:"n",out:["ne"]},{before:"qu",out:["que"]},{before:"s",out:["se"]},{before:"t",out:["tu"]},{word:"shouldnt",out:["should","not"]},{word:"couldnt",out:["could","not"]},{word:"wouldnt",out:["would","not"]},{word:"hasnt",out:["has","not"]},{word:"wasnt",out:["was","not"]},{word:"isnt",out:["is","not"]},{word:"cant",out:["can","not"]},{word:"dont",out:["do","not"]},{word:"wont",out:["will","not"]},{word:"howd",out:["how","did"]},{word:"whatd",out:["what","did"]},{word:"whend",out:["when","did"]},{word:"whered",out:["where","did"]}],Su={st:!0,nd:!0,rd:!0,th:!0,am:!0,pm:!0,max:!0,"°":!0,s:!0,e:!0,er:!0,ère:!0,ème:!0},Mu={one:{contractions:Bu,numberSuffixes:Su}},zn=function(e,t,n){const[r,o]=t;!n||n.length===0||(n=n.map((a,i)=>(a.implicit=a.text,a.machine=a.text,a.pre="",a.post="",a.text="",a.normal="",a.index=[r,o+i],a)),n[0]&&(n[0].pre=e[r][o].pre,n[n.length-1].post=e[r][o].post,n[0].text=e[r][o].text,n[0].normal=e[r][o].normal),e[r].splice(o,1,...n))},Lu=/'/,Ku=new Set(["what","how","when","where","why"]),Ju=new Set(["be","go","start","think","need"]),Wu=new Set(["been","gone"]),qu=function(e,t){const n=e[t].normal.split(Lu)[0];if(Ku.has(n))return[n,"did"];if(e[t+1]){if(Wu.has(e[t+1].normal))return[n,"had"];if(Ju.has(e[t+1].normal))return[n,"would"]}return null},Ru=function(e,t){return e[t].normal==="ain't"||e[t].normal==="aint"?null:[e[t].normal.replace(/n't/,""),"not"]},Er=/'/,Uu=/(e|é|aison|sion|tion)$/,_u=/(age|isme|acle|ege|oire)$/,Qu=(e,t)=>{const n=e[t].normal.split(Er)[1];return n&&n.endsWith("e")?["la",n]:["le",n]},Zu=(e,t)=>{const n=e[t].normal.split(Er)[1];return n&&Uu.test(n)&&!_u.test(n)?["du",n]:n&&n.endsWith("s")?["des",n]:["de",n]},Xu=(e,t)=>["je",e[t].normal.split(Er)[1]],Bn={preJ:Xu,preL:Qu,preD:Zu},Yu=/^([0-9.]{1,4}[a-z]{0,2}) ?[-–—] ?([0-9]{1,4}[a-z]{0,2})$/i,el=/^([0-9]{1,2}(:[0-9][0-9])?(am|pm)?) ?[-–—] ?([0-9]{1,2}(:[0-9][0-9])?(am|pm)?)$/i,tl=/^[0-9]{3}-[0-9]{4}$/,nl=function(e,t){const n=e[t];let r=n.text.match(Yu);return r!==null?n.tags.has("PhoneNumber")===!0||tl.test(n.text)?null:[r[1],"to",r[2]]:(r=n.text.match(el),r!==null?[r[1],"to",r[4]]:null)},rl=/^([+-]?[0-9][.,0-9]*)([a-z°²³µ/]+)$/,ol=function(e,t,n){const r=n.model.one.numberSuffixes||{},o=e[t].text.match(rl);if(o!==null){const a=o[2].toLowerCase().trim();return r.hasOwnProperty(a)?null:[o[1],a]}return null},to=/'/,al=/^[0-9][^-–—]*[-–—].*?[0-9]/,no=function(e,t,n,r){const o=t.update();o.document=[e];let a=n+r;n>0&&(n-=1),e[a]&&(a+=1),o.ptrs=[[0,n,a]]},ro={t:(e,t)=>Ru(e,t),d:(e,t)=>qu(e,t)},oo={j:(e,t)=>Bn.preJ(e,t),l:(e,t)=>Bn.preL(e,t),d:(e,t)=>Bn.preD(e,t)},il=function(e,t,n,r){for(let o=0;o<e.length;o+=1){const a=e[o];if(a.word===t.normal)return a.out;if(r!==null&&r===a.after)return[n].concat(a.out);if(n!==null&&n===a.before&&r&&r.length>2)return a.out.concat(r)}return null},Sn=function(e,t){const n=t.fromText(e.join(" "));return n.compute(["id","alias"]),n.docs[0]},sl=function(e,t){for(let n=t+1;n<5&&e[n];n+=1)if(e[n].normal==="been")return["there","has"];return["there","is"]},ul=e=>{const{world:t,document:n}=e,{model:r,methods:o}=t,a=r.one.contractions||[];n.forEach((i,s)=>{for(let u=i.length-1;u>=0;u-=1){let l=null,c=null;if(to.test(i[u].normal)===!0){const g=i[u].normal.split(to);l=g[0],c=g[1]}let d=il(a,i[u],l,c);if(!d&&ro.hasOwnProperty(c)&&(d=ro[c](i,u,t)),!d&&oo.hasOwnProperty(l)&&(d=oo[l](i,u)),l==="there"&&c==="s"&&(d=sl(i,u)),d){d=Sn(d,e),zn(n,[s,u],d),no(n[s],e,u,d.length);continue}if(al.test(i[u].normal)){d=nl(i,u),d&&(d=Sn(d,e),zn(n,[s,u],d),o.one.setTag(d,"NumberRange",t),d[2]&&d[2].tags.has("Time")&&o.one.setTag([d[0]],"Time",t,null,"time-range"),no(n[s],e,u,d.length));continue}d=ol(i,u,t),d&&(d=Sn(d,e),zn(n,[s,u],d),o.one.setTag([d[1]],"Unit",t,null,"contraction-unit"))}})},ll={contractions:ul},cl={model:Mu,compute:ll,hooks:["contractions"]},ao=function(e){const t=e.world,{model:n,methods:r}=e.world,o=r.one.setTag,{frozenLex:a}=n.one,i=n.one._multiCache||{};e.docs.forEach(s=>{for(let u=0;u<s.length;u+=1){const l=s[u],c=l.machine||l.normal;if(i[c]!==void 0&&s[u+1]){const d=u+i[c]-1;for(let g=d;g>u;g-=1){const x=s.slice(u,g+1),G=x.map(U=>U.machine||U.normal).join(" ");if(a.hasOwnProperty(G)===!0){o(x,a[G],t,!1,"1-frozen-multi-lexicon"),x.forEach(U=>U.frozen=!0);continue}}}if(a[c]!==void 0&&a.hasOwnProperty(c)){o([l],a[c],t,!1,"1-freeze-lexicon"),l.frozen=!0;continue}}})},hl=function(e){return e.docs.forEach(t=>{t.forEach(n=>{delete n.frozen})}),e},dl={frozen:ao,freeze:ao,unfreeze:hl},io=e=>"\x1B[34m"+e+"\x1B[0m",so=e=>"\x1B[3m\x1B[2m"+e+"\x1B[0m",uo=function(e){e.docs.forEach(t=>{console.log(io(`
2
2
  ┌─────────`)),t.forEach(n=>{let r=` ${so("│")} `;const o=n.implicit||n.text||"-";n.frozen===!0?r+=`${io(o)} ❄️`:r+=so(o),console.log(r)})})},pl={compute:dl,mutate:e=>{const t=e.methods.one;t.termMethods.isFrozen=n=>n.frozen===!0,t.debug.freeze=uo,t.debug.frozen=uo},api:function(e){e.prototype.freeze=function(){return this.docs.forEach(t=>{t.forEach(n=>{n.frozen=!0})}),this},e.prototype.unfreeze=function(){this.compute("unfreeze")},e.prototype.isFrozen=function(){return this.match("@isFrozen+")}},hooks:["freeze"]},gl=function(e,t,n){const{model:r,methods:o}=n,a=o.one.setTag,i=r.one._multiCache||{},{lexicon:s}=r.one||{},u=e[t],l=u.machine||u.normal;if(i[l]!==void 0&&e[t+1]){const c=t+i[l]-1;for(let d=c;d>t;d-=1){const g=e.slice(t,d+1);if(g.length<=1)return!1;const x=g.map(G=>G.machine||G.normal).join(" ");if(s.hasOwnProperty(x)===!0){const G=s[x];return a(g,G,n,!1,"1-multi-lexicon"),G&&G.length===2&&(G[0]==="PhrasalVerb"||G[1]==="PhrasalVerb")&&a([g[1]],"Particle",n,!1,"1-phrasal-particle"),!0}}return!1}return null},lo=/^(under|over|mis|re|un|dis|semi|pre|post)-?/,ml=new Set(["Verb","Infinitive","PastTense","Gerund","PresentTense","Adjective","Participle"]),fl=function(e,t,n){const{model:r,methods:o}=n,a=o.one.setTag,{lexicon:i}=r.one,s=e[t],u=s.machine||s.normal;if(i[u]!==void 0&&i.hasOwnProperty(u))return a([s],i[u],n,!1,"1-lexicon"),!0;if(s.alias){const l=s.alias.find(c=>i.hasOwnProperty(c));if(l)return a([s],i[l],n,!1,"1-lexicon-alias"),!0}if(lo.test(u)===!0){const l=u.replace(lo,"");if(i.hasOwnProperty(l)&&l.length>3&&ml.has(i[l]))return a([s],i[l],n,!1,"1-lexicon-prefix"),!0}return null},bl=function(e){const t=e.world;e.docs.forEach(n=>{for(let r=0;r<n.length;r+=1)if(n[r].tags.size===0){let o=null;o=o||gl(n,r,t),o=o||fl(n,r,t)}})},vl={lexicon:bl},yl=function(e){const t={},n={};return Object.keys(e).forEach(r=>{const o=e[r];r=r.toLowerCase().trim(),r=r.replace(/'s\b/,"");const a=r.split(/ /);a.length>1&&(n[a[0]]===void 0||a.length>n[a[0]])&&(n[a[0]]=a.length),t[r]=t[r]||o}),delete t[""],delete t[null],delete t[" "],{lex:t,_multi:n}},wl={one:{expandLexicon:yl}},$l=function(e,t=!1){const n=this.world(),{methods:r,model:o}=n;if(!e)return;if(Object.keys(e).forEach(s=>{typeof e[s]=="string"&&e[s].startsWith("#")&&(e[s]=e[s].replace(/^#/,""))}),t===!0){const{lex:s,_multi:u}=r.one.expandLexicon(e,n);Object.assign(o.one._multiCache,u),Object.assign(o.one.frozenLex,s);return}if(r.two.expandLexicon){const{lex:s,_multi:u}=r.two.expandLexicon(e,n);Object.assign(o.one.lexicon,s),Object.assign(o.one._multiCache,u)}const{lex:a,_multi:i}=r.one.expandLexicon(e,n);Object.assign(o.one.lexicon,a),Object.assign(o.one._multiCache,i)},kl={addWords:$l},Pl={one:{lexicon:{},_multiCache:{},frozenLex:{}}},Al={model:Pl,methods:wl,compute:vl,lib:kl,hooks:["lexicon"]},xl=function(e,t){const{methods:n,model:r}=t;return n.one.tokenize.splitTerms(e,r).map(o=>n.one.tokenize.splitWhitespace(o,r)).map(o=>o.text.toLowerCase())},gi=function(e,t){const n=[{}],r=[null],o=[0],a=[];let i=0;e.forEach(function(s){let u=0;const l=xl(s,t);for(let c=0;c<l.length;c++){const d=l[c];n[u]&&n[u].hasOwnProperty(d)?u=n[u][d]:(i++,n[u][d]=i,n[i]={},u=i,r[i]=null)}r[u]=[l.length]});for(const s in n[0])i=n[0][s],o[i]=0,a.push(i);for(;a.length;){const s=a.shift(),u=Object.keys(n[s]);for(let l=0;l<u.length;l+=1){const c=u[l],d=n[s][c];for(a.push(d),i=o[s];i>0&&!n[i].hasOwnProperty(c);)i=o[i];if(n.hasOwnProperty(i)){const g=n[i][c];o[d]=g,r[g]&&(r[d]=r[d]||[],r[d]=r[d].concat(r[g]))}else o[d]=0}}return{goNext:n,endAs:r,failTo:o}},Cl=function(e,t,n){let r=0;const o=[];for(let a=0;a<e.length;a++){const i=e[a][n.form]||e[a].normal;for(;r>0&&(t.goNext[r]===void 0||!t.goNext[r].hasOwnProperty(i));)r=t.failTo[r]||0;if(t.goNext[r].hasOwnProperty(i)&&(r=t.goNext[r][i],t.endAs[r])){const s=t.endAs[r];for(let u=0;u<s.length;u++){const l=s[u],c=e[a-l+1],[d,g]=c.index;o.push([d,g,g+l,c.id])}}}return o},jl=function(e,t){for(let n=0;n<e.length;n+=1)if(t.has(e[n])===!0)return!1;return!0},Nl=function(e,t,n){let r=[];n.form=n.form||"normal";const o=e.docs;if(!t.goNext||!t.goNext[0])return console.error("Compromise invalid lookup trie"),e.none();const a=Object.keys(t.goNext[0]);for(let i=0;i<o.length;i++){if(e._cache&&e._cache[i]&&jl(a,e._cache[i])===!0)continue;const s=o[i],u=Cl(s,t,n);u.length>0&&(r=r.concat(u))}return e.update(r)},Il=e=>Object.prototype.toString.call(e)==="[object Object]";function Tl(e){e.prototype.lookup=function(t,n={}){if(!t)return this.none();typeof t=="string"&&(t=[t]);const r=Il(t)?t:gi(t,this.world);let o=Nl(this,r,n);return o=o.settle(),o}}const Mn=(e,t)=>{for(let n=e.length-1;n>=0;n-=1)if(e[n]!==t)return e=e.slice(0,n+1),e;return e},El=function(e){return e.goNext=e.goNext.map(t=>{if(Object.keys(t).length!==0)return t}),e.goNext=Mn(e.goNext,void 0),e.failTo=Mn(e.failTo,0),e.endAs=Mn(e.endAs,null),e},lr={buildTrie:function(e){const t=gi(e,this.world());return El(t)}};lr.compile=lr.buildTrie;const Dl={api:Tl,lib:lr},co=function(e,t){return t&&e.forEach(n=>{const r=n[0];t[r]&&(n[0]=t[r][0],n[1]+=t[r][1],n[2]+=t[r][1])}),e},mi=function(e,t){let{ptrs:n}=e;const{byGroup:r}=e;return n=co(n,t),Object.keys(r).forEach(o=>{r[o]=co(r[o],t)}),{ptrs:n,byGroup:r}},qt=function(e,t,n){const r=n.methods.one;return typeof e=="number"&&(e=String(e)),typeof e=="string"&&(e=r.killUnicode(e,n),e=r.parseMatch(e,t,n)),e},fi=e=>Object.prototype.toString.call(e)==="[object Object]",Rt=e=>e&&fi(e)&&e.isView===!0,Ut=e=>e&&fi(e)&&e.isNet===!0,Hl=function(e,t,n){const r=this.methods.one;if(Rt(e))return this.intersection(e);if(Ut(e))return this.sweep(e,{tagger:!1}).view.settle();e=qt(e,n,this.world);const o={regs:e,group:t},a=r.match(this.docs,o,this._cache),{ptrs:i,byGroup:s}=mi(a,this.fullPointer),u=this.toView(i);return u._groups=s,u},Gl=function(e,t,n){const r=this.methods.one;if(Rt(e))return this.intersection(e).eq(0);if(Ut(e))return this.sweep(e,{tagger:!1,matchOne:!0}).view;e=qt(e,n,this.world);const o={regs:e,group:t,justOne:!0},a=r.match(this.docs,o,this._cache),{ptrs:i,byGroup:s}=mi(a,this.fullPointer),u=this.toView(i);return u._groups=s,u},Ol=function(e,t,n){const r=this.methods.one;if(Rt(e))return this.intersection(e).fullPointer.length>0;if(Ut(e))return this.sweep(e,{tagger:!1}).view.found;e=qt(e,n,this.world);const o={regs:e,group:t,justOne:!0};return r.match(this.docs,o,this._cache).ptrs.length>0},Fl=function(e,t,n){const r=this.methods.one;if(Rt(e))return this.filter(u=>u.intersection(e).found);if(Ut(e)){const u=this.sweep(e,{tagger:!1}).view.settle();return this.if(u)}e=qt(e,n,this.world);const o={regs:e,group:t,justOne:!0};let a=this.fullPointer;const i=this._cache||[];a=a.filter((u,l)=>{const c=this.update([u]);return r.match(c.docs,o,i[l]).ptrs.length>0});const s=this.update(a);return this._cache&&(s._cache=a.map(u=>i[u[0]])),s},Vl=function(e,t,n){const{methods:r}=this,o=r.one;if(Rt(e))return this.filter(s=>!s.intersection(e).found);if(Ut(e)){const s=this.sweep(e,{tagger:!1}).view.settle();return this.ifNo(s)}e=qt(e,n,this.world);const a=this._cache||[],i=this.filter((s,u)=>{const l={regs:e,group:t,justOne:!0};return o.match(s.docs,l,a[u]).ptrs.length===0});return this._cache&&(i._cache=i.ptrs.map(s=>a[s[0]])),i},zl={matchOne:Gl,match:Hl,has:Ol,if:Fl,ifNo:Vl},Bl=function(e,t,n){const{indexN:r}=this.methods.one.pointer,o=[],a=r(this.fullPointer);Object.keys(a).forEach(s=>{const u=a[s].sort((l,c)=>l[1]>c[1]?1:-1)[0];u[1]>0&&o.push([u[0],0,u[1]])});const i=this.toView(o);return e?i.match(e,t,n):i},Sl=function(e,t,n){const{indexN:r}=this.methods.one.pointer,o=[],a=r(this.fullPointer),i=this.document;Object.keys(a).forEach(u=>{const l=a[u].sort((g,x)=>g[1]>x[1]?-1:1)[0],[c,,d]=l;d<i[c].length&&o.push([c,d,i[c].length])});const s=this.toView(o);return e?s.match(e,t,n):s},Ml=function(e,t,n){typeof e=="string"&&(e=this.world.methods.one.parseMatch(e,n,this.world)),e[e.length-1].end=!0;const r=this.fullPointer;return this.forEach((o,a)=>{const i=o.before(e,t);if(i.found){const s=i.terms();r[a][1]-=s.length,r[a][3]=s.docs[0][0].id}}),this.update(r)},Ll=function(e,t,n){typeof e=="string"&&(e=this.world.methods.one.parseMatch(e,n,this.world)),e[0].start=!0;const r=this.fullPointer;return this.forEach((o,a)=>{const i=o.after(e,t);if(i.found){const s=i.terms();r[a][2]+=s.length,r[a][4]=null}}),this.update(r)},Kl=function(e,t,n){return this.growRight(e,t,n).growLeft(e,t,n)},Jl={before:Bl,after:Sl,growLeft:Ml,growRight:Ll,grow:Kl},bi=function(e,t){return[e[0],e[1],t[2]]},Wl=function(e){return Object.prototype.toString.call(e)==="[object Array]"},Dr=(e,t,n)=>typeof e=="string"||Wl(e)?t.match(e,n):e||t.none(),Hr=function(e,t){const[n,r,o]=e;return t.document[n]&&t.document[n][r]&&(e[3]=e[3]||t.document[n][r].id,t.document[n][o-1]&&(e[4]=e[4]||t.document[n][o-1].id)),e},xt={};xt.splitOn=function(e,t){const{splitAll:n}=this.methods.one.pointer,r=Dr(e,this,t).fullPointer,o=n(this.fullPointer,r);let a=[];return o.forEach(i=>{a.push(i.passthrough),a.push(i.before),a.push(i.match),a.push(i.after)}),a=a.filter(i=>i),a=a.map(i=>Hr(i,this)),this.update(a)};xt.splitBefore=function(e,t){const{splitAll:n}=this.methods.one.pointer,r=Dr(e,this,t).fullPointer,o=n(this.fullPointer,r);for(let i=0;i<o.length;i+=1)!o[i].after&&o[i+1]&&o[i+1].before&&o[i].match&&o[i].match[0]===o[i+1].before[0]&&(o[i].after=o[i+1].before,delete o[i+1].before);let a=[];return o.forEach(i=>{a.push(i.passthrough),a.push(i.before),i.match&&i.after?a.push(bi(i.match,i.after)):a.push(i.match)}),a=a.filter(i=>i),a=a.map(i=>Hr(i,this)),this.update(a)};xt.splitAfter=function(e,t){const{splitAll:n}=this.methods.one.pointer,r=Dr(e,this,t).fullPointer,o=n(this.fullPointer,r);let a=[];return o.forEach(i=>{a.push(i.passthrough),i.before&&i.match?a.push(bi(i.before,i.match)):(a.push(i.before),a.push(i.match)),a.push(i.after)}),a=a.filter(i=>i),a=a.map(i=>Hr(i,this)),this.update(a)};xt.split=xt.splitAfter;const ql=function(e,t){return!e||!t||e[0]!==t[0]?!1:e[2]===t[1]},ho=function(e,t,n){const r=e.world,o=r.methods.one.parseMatch;t=t||".$",n=n||"^.";const a=o(t,{},r),i=o(n,{},r);a[a.length-1].end=!0,i[0].start=!0;const s=e.fullPointer,u=[s[0]];for(let l=1;l<s.length;l+=1){const c=u[u.length-1],d=s[l],g=e.update([c]),x=e.update([d]);ql(c,d)&&g.has(a)&&x.has(i)?u[u.length-1]=[c[0],c[1],d[2],c[3],d[4]]:u.push(d)}return e.update(u)},Rl={joinIf:function(e,t){return ho(this,e,t)},join:function(){return ho(this)}},Ge=Object.assign({},zl,Jl,xt,Rl);Ge.lookBehind=Ge.before;Ge.lookBefore=Ge.before;Ge.lookAhead=Ge.after;Ge.lookAfter=Ge.after;Ge.notIf=Ge.ifNo;const Ul=function(e){Object.assign(e.prototype,Ge)},_l=/(?:^|\s)([![^]*(?:<[^<]*>)?\/.*?[^\\/]\/[?\]+*$~]*)(?:\s|$)/,Ql=/([!~[^]*(?:<[^<]*>)?\([^)]+[^\\)]\)[?\]+*$~]*)(?:\s|$)/,Zl=/ /g,Xl=e=>/^[![^]*(<[^<]*>)?\(/.test(e)&&/\)[?\]+*$~]*$/.test(e),po=e=>/^[![^]*(<[^<]*>)?\//.test(e)&&/\/[?\]+*$~]*$/.test(e),go=function(e){return e=e.map(t=>t.trim()),e=e.filter(t=>t),e},Yl=function(e){const t=e.split(_l);let n=[];t.forEach(o=>{if(po(o)){n.push(o);return}n=n.concat(o.split(Ql))}),n=go(n);let r=[];return n.forEach(o=>{Xl(o)||po(o)?r.push(o):r=r.concat(o.split(Zl))}),r=go(r),r},mo=/\{([0-9]+)?(, *[0-9]*)?\}/,fo=/&&/,ec=new RegExp(/^<\s*(\S+)\s*>/),bo=e=>e.charAt(0).toUpperCase()+e.substring(1),$e=e=>e.charAt(e.length-1),me=e=>e.charAt(0),wt=e=>e.substring(1),$t=e=>e.substring(0,e.length-1),Dt=function(e){return e=wt(e),e=$t(e),e},vi=function(e,t){const n={};for(let r=0;r<2;r+=1){if($e(e)==="$"&&(n.end=!0,e=$t(e)),me(e)==="^"&&(n.start=!0,e=wt(e)),$e(e)==="?"&&(n.optional=!0,e=$t(e)),(me(e)==="["||$e(e)==="]")&&(n.group=null,me(e)==="["&&(n.groupStart=!0),$e(e)==="]"&&(n.groupEnd=!0),e=e.replace(/^\[/,""),e=e.replace(/\]$/,""),me(e)==="<")){const o=ec.exec(e);o.length>=2&&(n.group=o[1],e=e.replace(o[0],""))}if($e(e)==="+"&&(n.greedy=!0,e=$t(e)),e!=="*"&&$e(e)==="*"&&e!=="\\*"&&(n.greedy=!0,e=$t(e)),me(e)==="!"&&(n.negative=!0,e=wt(e)),me(e)==="~"&&$e(e)==="~"&&e.length>2&&(e=Dt(e),n.fuzzy=!0,n.min=t.fuzzy||.85,/\(/.test(e)===!1))return n.word=e,n;if(me(e)==="/"&&$e(e)==="/")return e=Dt(e),t.caseSensitive&&(n.use="text"),n.regex=new RegExp(e),n;if(mo.test(e)===!0&&(e=e.replace(mo,(o,a,i)=>(i===void 0?(n.min=Number(a),n.max=Number(a)):(i=i.replace(/, */,""),a===void 0?(n.min=0,n.max=Number(i)):(n.min=Number(a),n.max=Number(i||999))),n.greedy=!0,n.min||(n.optional=!0),""))),me(e)==="("&&$e(e)===")"){fo.test(e)?(n.choices=e.split(fo),n.operator="and"):(n.choices=e.split("|"),n.operator="or"),n.choices[0]=wt(n.choices[0]);const o=n.choices.length-1;n.choices[o]=$t(n.choices[o]),n.choices=n.choices.map(a=>a.trim()),n.choices=n.choices.filter(a=>a),n.choices=n.choices.map(a=>a.split(/ /g).map(i=>vi(i,t))),e=""}if(me(e)==="{"&&$e(e)==="}"){if(e=Dt(e),n.root=e,/\//.test(e)){const o=n.root.split(/\//);n.root=o[0],n.pos=o[1],n.pos==="adj"&&(n.pos="Adjective"),n.pos=n.pos.charAt(0).toUpperCase()+n.pos.substr(1).toLowerCase(),o[2]!==void 0&&(n.sense=o[2])}return n}if(me(e)==="<"&&$e(e)===">")return e=Dt(e),n.chunk=bo(e),n.greedy=!0,n;if(me(e)==="%"&&$e(e)==="%")return e=Dt(e),n.switch=e,n}return me(e)==="#"?(n.tag=wt(e),n.tag=bo(n.tag),n):me(e)==="@"?(n.method=wt(e),n):e==="."?(n.anything=!0,n):e==="*"?(n.anything=!0,n.greedy=!0,n.optional=!0,n):(e&&(e=e.replace("\\*","*"),e=e.replace("\\.","."),t.caseSensitive?n.use="text":e=e.toLowerCase(),n.word=e),n)},tc=/[a-z0-9][-–—][a-z]/i,nc=function(e,t){const n=t.model.one.prefixes;for(let r=e.length-1;r>=0;r-=1){const o=e[r];if(o.word&&tc.test(o.word)){let a=o.word.split(/[-–—]/g);if(n.hasOwnProperty(a[0]))continue;a=a.filter(i=>i).reverse(),e.splice(r,1),a.forEach(i=>{const s=Object.assign({},o);s.word=i,e.splice(r,0,s)})}}return e},vo=function(e,t){const{all:n}=t.methods.two.transform.verb||{},r=e.root;return n?n(r,t.model):[]},yo=function(e,t){const{all:n}=t.methods.two.transform.noun||{};return n?n(e.root,t.model):[e.root]},wo=function(e,t){const{all:n}=t.methods.two.transform.adjective||{};return n?n(e.root,t.model):[e.root]},rc=function(e,t){return e=e.map(n=>{if(n.root)if(t.methods.two&&t.methods.two.transform){let r=[];n.pos?n.pos==="Verb"?r=r.concat(vo(n,t)):n.pos==="Noun"?r=r.concat(yo(n,t)):n.pos==="Adjective"&&(r=r.concat(wo(n,t))):(r=r.concat(vo(n,t)),r=r.concat(yo(n,t)),r=r.concat(wo(n,t))),r=r.filter(o=>o),r.length>0&&(n.operator="or",n.fastOr=new Set(r))}else n.machine=n.root,delete n.id,delete n.root;return n}),e},oc=function(e){let t=0,n=null;for(let r=0;r<e.length;r++){const o=e[r];o.groupStart===!0&&(n=o.group,n===null&&(n=String(t),t+=1)),n!==null&&(o.group=n),o.groupEnd===!0&&(n=null)}return e},ac=function(e){return e.map(t=>{if(t.choices!==void 0){if(t.operator!=="or"||t.fuzzy===!0)return t;t.choices.every(n=>{if(n.length!==1)return!1;const r=n[0];return r.fuzzy===!0||r.start||r.end?!1:r.word!==void 0&&r.negative!==!0&&r.optional!==!0&&r.method!==!0})===!0&&(t.fastOr=new Set,t.choices.forEach(n=>{t.fastOr.add(n[0].word)}),delete t.choices)}return t})},ic=function(e){return e.map(t=>(t.fuzzy&&t.choices&&t.choices.forEach(n=>{n.length===1&&n[0].word&&(n[0].fuzzy=!0,n[0].min=t.min)}),t))},sc=function(e){return e=oc(e),e=ac(e),e=ic(e),e},uc=function(e,t,n){if(e==null||e==="")return[];t=t||{},typeof e=="number"&&(e=String(e));let r=Yl(e);return r=r.map(o=>vi(o,t)),r=nc(r,n),r=rc(r,n),r=sc(r),r},lc=function(e,t){for(const n of t)if(e.has(n))return!0;return!1},cc=function(e,t){for(let n=0;n<e.length;n+=1){const r=e[n];if(!(r.optional===!0||r.negative===!0||r.fuzzy===!0)){if(r.word!==void 0&&t.has(r.word)===!1||r.tag!==void 0&&t.has("#"+r.tag)===!1)return!0;if(r.fastOr&&lc(r.fastOr,t)===!1)return!1}}return!1},hc=function(e,t){const n=e.length,r=t.length;if(n===0)return r;if(r===0)return n;const o=(r>n?r:n)+1;if(Math.abs(n-r)>(o||100))return o||100;const a=[];for(let g=0;g<o;g++)a[g]=[g],a[g].length=o;for(let g=0;g<o;g++)a[0][g]=g;let i,s,u,l,c,d;for(let g=1;g<=n;++g)for(s=e[g-1],i=1;i<=r;++i){if(g===i&&a[g][i]>4)return n;u=t[i-1],l=s===u?0:1,c=a[g-1][i]+1,(d=a[g][i-1]+1)<c&&(c=d),(d=a[g-1][i-1]+l)<c&&(c=d),g>1&&i>1&&s===t[i-2]&&e[g-2]===u&&(d=a[g-2][i-2]+l)<c?a[g][i]=d:a[g][i]=c}return a[n][r]},dc=function(e,t,n=3){if(e===t)return 1;if(e.length<n||t.length<n)return 0;const r=hc(e,t),o=Math.max(e.length,t.length);return 1-(o===0?0:r/o)},pc=/([\u0022\uFF02\u0027\u201C\u2018\u201F\u201B\u201E\u2E42\u201A\u00AB\u2039\u2035\u2036\u2037\u301D\u0060\u301F])/,gc=/([\u0022\uFF02\u0027\u201D\u2019\u00BB\u203A\u2032\u2033\u2034\u301E\u00B4])/,$o=/^[-–—]$/,ko=/ [-–—]{1,3} /,Oe=(e,t)=>e.post.indexOf(t)!==-1,Lt={hasQuote:e=>pc.test(e.pre)||gc.test(e.post),hasComma:e=>Oe(e,","),hasPeriod:e=>Oe(e,".")===!0&&Oe(e,"...")===!1,hasExclamation:e=>Oe(e,"!"),hasQuestionMark:e=>Oe(e,"?")||Oe(e,"¿"),hasEllipses:e=>Oe(e,"..")||Oe(e,"…"),hasSemicolon:e=>Oe(e,";"),hasColon:e=>Oe(e,":"),hasSlash:e=>/\//.test(e.text),hasHyphen:e=>$o.test(e.post)||$o.test(e.pre),hasDash:e=>ko.test(e.post)||ko.test(e.pre),hasContraction:e=>!!e.implicit,isAcronym:e=>e.tags.has("Acronym"),isKnown:e=>e.tags.size>0,isTitleCase:e=>new RegExp("^\\p{Lu}[a-z'\\u00C0-\\u00FF]","u").test(e.text),isUpperCase:e=>new RegExp("^\\p{Lu}+$","u").test(e.text)};Lt.hasQuotation=Lt.hasQuote;let Cn=function(){};const mc=function(e,t,n,r){if(t.anything===!0)return!0;if(t.start===!0&&n!==0||t.end===!0&&n!==r-1)return!1;if(t.id!==void 0&&t.id===e.id)return!0;if(t.word!==void 0)return t.use?t.word===e[t.use]:e.machine!==null&&e.machine===t.word||e.alias!==void 0&&e.alias.hasOwnProperty(t.word)||t.fuzzy===!0&&(t.word===e.root||dc(t.word,e.normal)>=t.min)||e.alias&&e.alias.some(o=>o===t.word)?!0:t.word===e.text||t.word===e.normal;if(t.tag!==void 0)return e.tags.has(t.tag)===!0;if(t.method!==void 0)return typeof Lt[t.method]=="function"&&Lt[t.method](e)===!0;if(t.pre!==void 0)return e.pre&&e.pre.includes(t.pre);if(t.post!==void 0)return e.post&&e.post.includes(t.post);if(t.regex!==void 0){let o=e.normal;return t.use&&(o=e[t.use]),t.regex.test(o)}if(t.chunk!==void 0)return e.chunk===t.chunk;if(t.switch!==void 0)return e.switch===t.switch;if(t.machine!==void 0)return e.normal===t.machine||e.machine===t.machine||e.root===t.machine;if(t.sense!==void 0)return e.sense===t.sense;if(t.fastOr!==void 0){if(t.pos&&!e.tags.has(t.pos))return null;const o=e.root||e.implicit||e.machine||e.normal;return t.fastOr.has(o)||t.fastOr.has(e.text)}return t.choices!==void 0?t.operator==="and"?t.choices.every(o=>Cn(e,o,n,r)):t.choices.some(o=>Cn(e,o,n,r)):!1};Cn=function(e,t,n,r){const o=mc(e,t,n,r);return t.negative===!0?!o:o};const pe=Cn,fc=function(e,t){const n=Object.assign({},e.regs[e.r],{start:!1,end:!1}),r=e.t;for(;e.t<e.terms.length;e.t+=1){if(t&&pe(e.terms[e.t],t,e.start_i+e.t,e.phrase_length))return e.t;const o=e.t-r+1;if(n.max!==void 0&&o===n.max)return e.t;if(pe(e.terms[e.t],n,e.start_i+e.t,e.phrase_length)===!1)return n.min!==void 0&&o<n.min?null:e.t}return e.t},bc=function(e,t){let n=e.t;if(!t)return e.terms.length;for(;n<e.terms.length;n+=1)if(pe(e.terms[n],t,e.start_i+n,e.phrase_length)===!0)return n;return null},vc=function(e,t){if(e.end===!0&&e.greedy===!0&&t.start_i+t.t<t.phrase_length-1){const n=Object.assign({},e,{end:!1});if(pe(t.terms[t.t],n,t.start_i+t.t,t.phrase_length)===!0)return!0}return!1},Dn=function(e,t){return e.groups[e.inGroup]||(e.groups[e.inGroup]={start:t,length:0}),e.groups[e.inGroup]},yc=function(e){const{regs:t}=e,n=t[e.r],r=bc(e,t[e.r+1]);if(r===null||r===0||n.min!==void 0&&r-e.t<n.min)return null;if(n.max!==void 0&&r-e.t>n.max)return e.t=e.t+n.max,!0;if(e.hasGroup===!0){const o=Dn(e,e.t);o.length=r-e.t}return e.t=r,!0},wc=function(e){return Object.prototype.toString.call(e)==="[object Array]"},yi=function(e,t=0){const n=e.regs[e.r];let r=!1;for(let o=0;o<n.choices.length;o+=1){const a=n.choices[o];if(!wc(a))return!1;if(r=a.every((i,s)=>{let u=0;const l=e.t+s+t+u;if(e.terms[l]===void 0)return!1;const c=pe(e.terms[l],i,l+e.start_i,e.phrase_length);if(c===!0&&i.greedy===!0)for(let d=1;d<e.terms.length;d+=1){const g=e.terms[l+d];if(g)if(pe(g,i,e.start_i+d,e.phrase_length)===!0)u+=1;else break}return t+=u,c}),r){t+=a.length;break}}return r&&n.greedy===!0?yi(e,t):t},$c=function(e){let t=0;return e.regs[e.r].choices.every(n=>{const r=n.every((o,a)=>{const i=e.t+a;return e.terms[i]===void 0?!1:pe(e.terms[i],o,i,e.phrase_length)});return r===!0&&n.length>t&&(t=n.length),r})===!0?t:!1},kc=function(e){const{regs:t}=e,n=t[e.r],r=yi(e);if(r){if(n.negative===!0)return null;if(e.hasGroup===!0){const o=Dn(e,e.t);o.length+=r}if(n.end===!0){const o=e.phrase_length;if(e.t+e.start_i+r!==o)return null}return e.t+=r,!0}else if(!n.optional)return null;return!0},Pc=function(e){const{regs:t}=e,n=t[e.r],r=$c(e);if(r){if(n.negative===!0)return null;if(e.hasGroup===!0){const o=Dn(e,e.t);o.length+=r}if(n.end===!0){const o=e.phrase_length-1;if(e.t+e.start_i!==o)return null}return e.t+=r,!0}else if(!n.optional)return null;return!0},Ac=function(e,t,n){let r=0;for(let o=e.t;o<e.terms.length;o+=1){let a=pe(e.terms[o],t,e.start_i+e.t,e.phrase_length);if(a||n&&(a=pe(e.terms[o],n,e.start_i+e.t,e.phrase_length),a)||(r+=1,t.max!==void 0&&r===t.max))break}return r===0||t.min&&t.min>r?!1:(e.t+=r,!0)},xc=function(e){const{regs:t}=e,n=t[e.r],r=Object.assign({},n);if(r.negative=!1,pe(e.terms[e.t],r,e.start_i+e.t,e.phrase_length))return!1;if(n.optional){const o=t[e.r+1];o&&(pe(e.terms[e.t],o,e.start_i+e.t,e.phrase_length)?e.r+=1:o.optional&&t[e.r+2]&&pe(e.terms[e.t],t[e.r+2],e.start_i+e.t,e.phrase_length)&&(e.r+=2))}return n.greedy?Ac(e,r,t[e.r+1]):(e.t+=1,!0)},Cc=function(e){const{regs:t}=e,n=t[e.r],r=e.terms[e.t],o=pe(r,t[e.r+1],e.start_i+e.t,e.phrase_length);if(n.negative||o){const a=e.terms[e.t+1];(!a||!pe(a,t[e.r+1],e.start_i+e.t,e.phrase_length))&&(e.r+=1)}},jc=function(e){const{regs:t,phrase_length:n}=e,r=t[e.r];return e.t=fc(e,t[e.r+1]),e.t===null||r.min&&r.min>e.t||r.end===!0&&e.start_i+e.t!==n?null:!0},Nc=function(e){const t=e.terms[e.t],n=e.regs[e.r];if(t.implicit&&e.terms[e.t+1]){if(!e.terms[e.t+1].implicit)return;n.word===t.normal&&(e.t+=1),n.method==="hasContraction"&&(e.t+=1)}},Ic=function(e,t){const n=e.regs[e.r],r=Dn(e,t);e.t>1&&n.greedy?r.length+=e.t-t:r.length++},Ln=function(e){const{regs:t}=e,n=t[e.r],r=e.terms[e.t],o=e.t;return n.optional&&t[e.r+1]&&n.negative?!0:(n.optional&&t[e.r+1]&&Cc(e),r.implicit&&e.terms[e.t+1]&&Nc(e),e.t+=1,n.end===!0&&e.t!==e.terms.length&&n.greedy!==!0||n.greedy===!0&&!jc(e)?null:(e.hasGroup===!0&&Ic(e,o),!0))},Gr=function(e,t,n,r){if(e.length===0||t.length===0)return null;const o={t:0,terms:e,r:0,regs:t,groups:{},start_i:n,phrase_length:r,inGroup:null};for(;o.r<t.length;o.r+=1){const s=t[o.r];if(o.hasGroup=!!s.group,o.hasGroup===!0?o.inGroup=s.group:o.inGroup=null,!o.terms[o.t]){if(t.slice(o.r).some(u=>!u.optional)===!1)break;return null}if(s.anything===!0&&s.greedy===!0){if(!yc(o))return null;continue}if(s.choices!==void 0&&s.operator==="or"){if(!kc(o))return null;continue}if(s.choices!==void 0&&s.operator==="and"){if(!Pc(o))return null;continue}if(s.anything===!0){if(s.negative&&s.anything||!Ln(o))return null;continue}if(vc(s,o)===!0){if(!Ln(o))return null;continue}if(s.negative){if(!xc(o))return null;continue}if(pe(o.terms[o.t],s,o.start_i+o.t,o.phrase_length)===!0){if(!Ln(o))return null;continue}if(s.optional!==!0)return null}const a=[null,n,o.t+n];if(a[1]===a[2])return null;const i={};return Object.keys(o.groups).forEach(s=>{const u=o.groups[s],l=n+u.start;i[s]=[null,l,l+u.length]}),{pointer:a,groups:i}},Tc=function(e,t){const n=[],r={};return e.length===0?{ptrs:n,byGroup:r}:(typeof t=="number"&&(t=String(t)),t?e.forEach(o=>{o.groups[t]&&n.push(o.groups[t])}):e.forEach(o=>{n.push(o.pointer),Object.keys(o.groups).forEach(a=>{r[a]=r[a]||[],r[a].push(o.groups[a])})}),{ptrs:n,byGroup:r})},Ec=function(e,t,n){return e=e.filter(r=>{const[o,a,i]=r.pointer,s=n[o].slice(a,i);for(let u=0;u<s.length;u+=1){const l=s.slice(u);if(Gr(l,t,u,s.length)!==null)return!1}return!0}),e},wi=function(e,t){return e.pointer[0]=t,Object.keys(e.groups).forEach(n=>{e.groups[n][0]=t}),e},Dc=function(e,t,n){let r=Gr(e,t,0,e.length);return r?(r=wi(r,n),r):null},Hc=function(e,t,n){n=n||[];const{regs:r,group:o,justOne:a}=t;let i=[];if(!r||r.length===0)return{ptrs:[],byGroup:{}};const s=r.filter(u=>u.optional!==!0&&u.negative!==!0).length;e:for(let u=0;u<e.length;u+=1){const l=e[u];if(!(n[u]&&cc(r,n[u]))){if(r[0].start===!0){const c=Dc(l,r,u);c&&i.push(c);continue}for(let c=0;c<l.length;c+=1){const d=l.slice(c);if(d.length<s)break;let g=Gr(d,r,c,l.length);if(g){if(g=wi(g,u),i.push(g),a===!0)break e;const x=g.pointer[2];Math.abs(x-1)>c&&(c=Math.abs(x-1))}}}}return r[r.length-1].end===!0&&(i=i.filter(u=>{const l=u.pointer[0];return e[l].length===u.pointer[2]})),t.notIf&&(i=Ec(i,t.notIf,e)),i=Tc(i,o),i.ptrs.forEach(u=>{const[l,c,d]=u;u[3]=e[l][c].id,u[4]=e[l][d-1].id}),i},Gc={one:{termMethods:Lt,parseMatch:uc,match:Hc}},Oc={parseMatch:function(e,t){const n=this.world(),r=n.methods.one.killUnicode;return r&&(e=r(e,n)),n.methods.one.parseMatch(e,t,n)}},Fc={api:Ul,methods:Gc,lib:Oc},Vc=/^\../,zc=/^#./,Bc=e=>(e=e.replace(/&/g,"&amp;"),e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;"),e=e.replace(/"/g,"&quot;"),e=e.replace(/'/g,"&apos;"),e),Sc=function(e){let t="",n="</span>";return e=Bc(e),Vc.test(e)?t=`<span class="${e.replace(/^\./,"")}"`:zc.test(e)?t=`<span id="${e.replace(/^#/,"")}"`:(t=`<${e}`,n=`</${e}>`),t+=">",{start:t,end:n}},Mc=function(e,t){const n={},r={};return Object.keys(t).forEach(o=>{let a=t[o];const i=Sc(o);typeof a=="string"&&(a=e.match(a)),a.docs.forEach(s=>{if(s.every(c=>c.implicit))return;const u=s[0].id;n[u]=n[u]||[],n[u].push(i.start);const l=s[s.length-1].id;r[l]=r[l]||[],r[l].push(i.end)})}),{starts:n,ends:r}},Lc=function(e){const{starts:t,ends:n}=Mc(this,e);let r="";return this.docs.forEach(o=>{for(let a=0;a<o.length;a+=1){const i=o[a];t.hasOwnProperty(i.id)&&(r+=t[i.id].join("")),r+=i.pre||"",r+=i.text||"",n.hasOwnProperty(i.id)&&(r+=n[i.id].join("")),r+=i.post||""}}),r},Kc={html:Lc},$i=/[,:;)\]*.?~!\u0022\uFF02\u201D\u2019\u00BB\u203A\u2032\u2033\u2034\u301E\u00B4—-]+$/,cr=/^[(['"*~\uFF02\u201C\u2018\u201F\u201B\u201E\u2E42\u201A\u00AB\u2039\u2035\u2036\u2037\u301D\u0060\u301F]+/,Jc=/[,:;)('"\u201D\]]/,Wc=/^[-–—]$/,qc=/ /,it=function(e,t,n=!0){let r="";return e.forEach(o=>{let a=o.pre||"",i=o.post||"";t.punctuation==="some"&&(a=a.replace(cr,""),Wc.test(i)&&(i=" "),i=i.replace(Jc,""),i=i.replace(/\?!+/,"?"),i=i.replace(/!+/,"!"),i=i.replace(/\?+/,"?"),i=i.replace(/\.{2,}/,""),o.tags.has("Abbreviation")&&(i=i.replace(/\./,""))),t.whitespace==="some"&&(a=a.replace(/\s/,""),i=i.replace(/\s+/," ")),t.keepPunct||(a=a.replace(cr,""),i==="-"?i=" ":i=i.replace($i,""));let s=o[t.form||"text"]||o.normal||"";t.form==="implicit"&&(s=o.implicit||o.text),t.form==="root"&&o.implicit&&(s=o.root||o.implicit||o.normal),(t.form==="machine"||t.form==="implicit"||t.form==="root")&&o.implicit&&(!i||!qc.test(i))&&(i+=" "),r+=a+s+i}),n===!1&&(r=r.trim()),t.lowerCase===!0&&(r=r.toLowerCase()),r},Rc=function(e,t){let n="";if(!e||!e[0]||!e[0][0])return n;for(let r=0;r<e.length;r+=1)n+=it(e[r],t,!0);if(t.keepSpace||(n=n.trim()),t.keepEndPunct===!1){e[0][0].tags.has("Emoticon")||(n=n.replace(cr,""));const r=e[e.length-1];r[r.length-1].tags.has("Emoticon")||(n=n.replace($i,"")),n.endsWith("'")&&!n.endsWith("s'")&&(n=n.replace(/'/,""))}return t.cleanWhitespace===!0&&(n=n.trim()),n},tt={text:{form:"text"},normal:{whitespace:"some",punctuation:"some",case:"some",unicode:"some",form:"normal"},machine:{keepSpace:!1,whitespace:"some",punctuation:"some",case:"none",unicode:"some",form:"machine"},root:{keepSpace:!1,whitespace:"some",punctuation:"some",case:"some",unicode:"some",form:"root"},implicit:{form:"implicit"}};tt.clean=tt.normal;tt.reduced=tt.root;const ki=[];let st=0;for(;st<64;)ki[st]=0|Math.sin(++st%Math.PI)*4294967296;const Or=function(e){let t,n,r,o=decodeURI(encodeURI(e))+"€",a=o.length;const i=[t=1732584193,n=4023233417,~t,~n],s=[];for(e=--a/4+2|15,s[--e]=a*8;~a;)s[a>>2]|=o.charCodeAt(a)<<8*a--;for(st=o=0;st<e;st+=16){for(a=i;o<64;a=[r=a[3],t+((r=a[0]+[t&n|~t&r,r&t|~r&n,t^n^r,n^(t|~r)][a=o>>4]+ki[o]+~~s[st|[o,5*o+1,3*o+5,7*o][a]&15])<<(a=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21][4*a+o++%4])|r>>>-a),t,n])t=a[1]|0,n=a[2];for(o=4;o;)i[--o]+=a[o]}for(e="";o<32;)e+=(i[o>>3]>>(1^o++)*4&15).toString(16);return e},Uc={text:!0,terms:!0},Po={case:"none",unicode:"some",form:"machine",punctuation:"some"},Kn=function(e,t){return Object.assign({},e,t)},_e={text:e=>it(e,{keepPunct:!0},!1),normal:e=>it(e,Kn(tt.normal,{keepPunct:!0}),!1),implicit:e=>it(e,Kn(tt.implicit,{keepPunct:!0}),!1),machine:e=>it(e,Po,!1),root:e=>it(e,Kn(Po,{form:"root"}),!1),hash:e=>Or(it(e,{keepPunct:!0},!1)),offset:e=>{const t=_e.text(e).length;return{index:e[0].offset.index,start:e[0].offset.start,length:t}},terms:e=>e.map(t=>{const n=Object.assign({},t);return n.tags=Array.from(t.tags),n}),confidence:(e,t,n)=>t.eq(n).confidence(),syllables:(e,t,n)=>t.eq(n).syllables(),sentence:(e,t,n)=>t.eq(n).fullSentence().text(),dirty:e=>e.some(t=>t.dirty===!0)};_e.sentences=_e.sentence;_e.clean=_e.normal;_e.reduced=_e.root;const _c=function(e,t){return t=t||{},typeof t=="string"&&(t={}),t=Object.assign({},Uc,t),t.offset&&e.compute("offset"),e.docs.map((n,r)=>{const o={};return Object.keys(t).forEach(a=>{t[a]&&_e[a]&&(o[a]=_e[a](n,e,r))}),o})},hr={json:function(e){const t=_c(this,e);return typeof e=="number"?t[e]:t}};hr.data=hr.json;const Qc=()=>typeof window<"u"&&window.document,Zc=function(e){const t=this.methods.one.debug||{};return e&&t.hasOwnProperty(e)?(t[e](this),this):Qc()?(t.clientSide(this),this):(t.tags(this),this)},Xc=function(e){const t=e.pre||"",n=e.post||"";return t+e.text+n},Yc=function(e,t){const n={};return Object.keys(t).forEach(r=>{e.match(r).fullPointer.forEach(o=>{n[o[3]]={fn:t[r],end:o[2]}})}),n},Pi=function(e,t){const n=Yc(e,t);let r="";return e.docs.forEach((o,a)=>{for(let i=0;i<o.length;i+=1){const s=o[i];if(n.hasOwnProperty(s.id)){const{fn:u,end:l}=n[s.id],c=e.update([[a,i,l]]);r+=o[i].pre||"",r+=u(c),i=l-1,r+=o[i].post||""}else r+=Xc(s)}}),r},eh=e=>Object.prototype.toString.call(e)==="[object Object]",th=function(e){const t={};return e.forEach(n=>{t[n]=t[n]||0,t[n]+=1}),Object.keys(t).map(n=>({normal:n,count:t[n]})).sort((n,r)=>n.count>r.count?-1:0)},nh=function(e){if(eh(e))return Pi(this,e);if(e==="text")return this.text();if(e==="normal")return this.text("normal");if(e==="root")return this.text("root");if(e==="machine"||e==="reduced")return this.text("machine");if(e==="hash"||e==="md5")return Or(this.text());if(e==="json")return this.json();if(e==="offset"||e==="offsets")return this.compute("offset"),this.json({offset:!0});if(e==="array")return this.docs.map(t=>t.reduce((n,r)=>n+r.pre+r.text+r.post,"").trim()).filter(t=>t);if(e==="freq"||e==="frequency"||e==="topk")return th(this.json({normal:!0}).map(t=>t.normal));if(e==="terms"){let t=[];return this.docs.forEach(n=>{let r=n.map(o=>o.text);r=r.filter(o=>o),t=t.concat(r)}),t}return e==="tags"?this.docs.map(t=>t.reduce((n,r)=>(n[r.implicit||r.normal]=Array.from(r.tags),n),{})):e==="debug"?this.debug():this.text()},rh={debug:Zc,out:nh,wrap:function(e){return Pi(this,e)}},oh=e=>Object.prototype.toString.call(e)==="[object Object]",ah={text:function(e){let t={};if(e&&typeof e=="string"&&tt.hasOwnProperty(e)?t=Object.assign({},tt[e]):e&&oh(e)&&(t=Object.assign({},e)),t.keepSpace===void 0&&!this.isFull()&&(t.keepSpace=!1),t.keepEndPunct===void 0&&this.pointer){const n=this.pointer[0];n&&n[1]?t.keepEndPunct=!1:t.keepEndPunct=!0}return t.keepPunct===void 0&&(t.keepPunct=!0),t.keepSpace===void 0&&(t.keepSpace=!0),Rc(this.docs,t)}},ih=Object.assign({},rh,ah,hr,Kc),sh=function(e){Object.assign(e.prototype,ih)},uh=function(e){console.log("%c -=-=- ","background-color:#6699cc;"),e.forEach(t=>{console.groupCollapsed(t.text());const n=t.docs[0].map(r=>{let o=r.text||"-";r.implicit&&(o="["+r.implicit+"]");const a="["+Array.from(r.tags).join(", ")+"]";return{text:o,tags:a}});console.table(n,["text","tags"]),console.groupEnd()})},Be="\x1B[0m",ve={green:e=>"\x1B[32m"+e+Be,red:e=>"\x1B[31m"+e+Be,blue:e=>"\x1B[34m"+e+Be,magenta:e=>"\x1B[35m"+e+Be,cyan:e=>"\x1B[36m"+e+Be,yellow:e=>"\x1B[33m"+e+Be,black:e=>"\x1B[30m"+e+Be,dim:e=>"\x1B[2m"+e+Be,i:e=>"\x1B[3m"+e+Be},lh=function(e,t){return t.one.tagSet&&(e=e.map(n=>{if(!t.one.tagSet.hasOwnProperty(n))return n;const r=t.one.tagSet[n].color||"blue";return ve[r](n)})),e.join(", ")},ch=function(e){const{docs:t,model:n}=e;t.length===0&&console.log(ve.blue(`
3
3
  ──────`)),t.forEach(r=>{console.log(ve.blue(`
4
4
  ┌─────────`)),r.forEach(o=>{const a=[...o.tags||[]];let i=o.text||"-";o.sense&&(i=`{${o.normal}/${o.sense}}`),o.implicit&&(i="["+o.implicit+"]"),i=ve.yellow(i);let s="'"+i+"'";if(o.reference){const l=e.update([o.reference]).text("normal");s+=` - ${ve.dim(ve.i("["+l+"]"))}`}s=s.padEnd(18);const u=ve.blue(" │ ")+ve.i(s)+" - "+lh(a,n);console.log(u)})}),console.log(`
@@ -1 +1 @@
1
- import{r as g}from"../packem_shared/affected-shas-C1XuRlvo.js";import{r as m}from"../packem_shared/toolchain-DyCKnGch.js";const w=async({argument:d,logger:t,options:o,runtime:r,visConfig:s,workspaceRoot:e})=>{const l=d[0];if(!l)throw new Error("Missing targets. Usage: vis ci <target>[,<target>…]");const f=l.split(",").map(a=>a.trim()).filter(Boolean);if(f.length===0)throw new Error("Missing targets. Usage: vis ci <target>[,<target>…]");if(!e)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=g({defaultBase:s?.defaultBase,workspaceRoot:e}),p=o.base??i.base,c=o.head??i.head;!o.base&&!o.head&&t.info(`▸ Resolved affected refs from ${i.provider} (${i.notes.join("; ")})`),o.skipToolchain||t.info("▸ Toolchain pre-flight"),await m(e,s?.toolchain,{error:a=>{t.error(a)},info:a=>{t.info(a)},warn:a=>{t.warn(a)}},!!o.skipToolchain),o.install===!1?t.info(" Skipping install (--no-install)"):(t.info(" Installing dependencies"),await r.runCommand("install",{argv:["--ci","--frozen-lockfile"]}));for(const a of f){t.info(`▸ Running affected ${a} (base=${p}, head=${c})`);const n=[a,`--base=${p}`,`--head=${c}`,`--upstream=${String(o.upstream??"none")}`,`--downstream=${String(o.downstream??"deep")}`];o.parallel!==void 0&&n.push(`--parallel=${String(o.parallel)}`),o.partition&&n.push(`--partition=${String(o.partition)}`),o.query&&n.push(`--query=${String(o.query)}`),await r.runCommand("affected",{argv:n})}t.info("▸ CI pipeline complete")};export{w as default};
1
+ import{createRequire as p}from"node:module";import{m as u,f as _,I as $}from"../packem_shared/index-OQZQyN5R.js";import{cleanWorkspace as R}from"#native";import{l as b}from"../packem_shared/missing-package-json-DdMNbe_j.js";import{p as c}from"./cli-main.js";import{c as j}from"../packem_shared/utils-Cxree603.js";const g=p(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=o=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[r,n]=d.versions.node.split(".").map(Number);if(r>22||r===22&&n>=3||r===20&&n>=16)return d.getBuiltinModule(o)}return g(o)},{readdirSync:y,lstatSync:h,rmSync:v}=k("node:fs"),S=/node_modules/,w=/\.git/,C=o=>{const r=[],n=[o];for(;n.length>0;){const s=n.pop();let i;try{i=y(s)}catch{continue}for(const t of i){const e=u(s,t);try{const f=h(e);if(f.isSymbolicLink()||!f.isDirectory())continue}catch{continue}t==="node_modules"?r.push(e):t!==".git"&&t!==".hg"&&n.push(e)}}return r},P=["pnpm-lock.yaml","package-lock.json","npm-shrinkwrap.json","yarn.lock","bun.lock","bun.lockb"],q=(o,r,n)=>{let s=0,i=!1;for(const t of P){const e=u(o,t);if(_(e)){n.info(` ${e}`),s++;continue}}return{hadError:i,removed:s}},x=o=>{for(const r of $(o,{includeDirs:!1,includeSymlinks:!1,skip:[S,w]}))if(r.name==="package.json")return!0;return!1},m=(o,r,n)=>{let s=0,i=!1;for(const{packageDir:t}of b(o)){const e=u(o,t);if(!x(e)){if(r){n.info(` ${e}`),s++;continue}try{v(e,{force:!0,recursive:!0}),c.success(`Removed empty package ${e}`),s++}catch(f){c.error(`${e}: ${j(f)}`),i=!0}}}return{hadError:i,removed:s}},B=async({logger:o,options:r,workspaceRoot:n})=>{const s=n??process.cwd(),i=r.lockfile||!1,t=r.emptyPackages||!1;if(r.dryRun){const l=C(s);if(l.length>0){c.info("Would remove:");for(const a of l)o.info(` ${a}`)}else c.info("No node_modules directories found.");i&&q(s,!0,o),t&&(c.info("Would remove empty packages:"),m(s,!0,o));return}const e=R(s,i);for(const l of e.removed)c.success(`Removed ${l}`);for(const l of e.lockfilesRemoved)c.success(`Removed ${l}`);for(const l of e.errors)c.error(l);e.removed.length===0&&e.lockfilesRemoved.length===0?c.info("No node_modules directories found."):c.info(`Cleaned ${e.removed.length} node_modules director${e.removed.length===1?"y":"ies"}`);let f=!1;if(t){const{hadError:l,removed:a}=m(s,!1,o);f=l,a>0&&c.info(`Cleaned ${a} empty package director${a===1?"y":"ies"}`)}(e.errors.length>0||f)&&(process.exitCode=1)};export{B as default};
@@ -1 +1 @@
1
- import{createRequire as p}from"node:module";import{m as u,f as _,I as $}from"../packem_shared/index-OQZQyN5R.js";import{cleanWorkspace as R}from"#native";import{l as b}from"../packem_shared/missing-package-json-DhYzuKhD.js";import{p as c}from"./cli-main.js";import{c as j}from"../packem_shared/utils-Cxree603.js";const g=p(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=o=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[r,n]=d.versions.node.split(".").map(Number);if(r>22||r===22&&n>=3||r===20&&n>=16)return d.getBuiltinModule(o)}return g(o)},{readdirSync:y,lstatSync:h,rmSync:v}=k("node:fs"),S=/node_modules/,w=/\.git/,C=o=>{const r=[],n=[o];for(;n.length>0;){const s=n.pop();let i;try{i=y(s)}catch{continue}for(const t of i){const e=u(s,t);try{const f=h(e);if(f.isSymbolicLink()||!f.isDirectory())continue}catch{continue}t==="node_modules"?r.push(e):t!==".git"&&t!==".hg"&&n.push(e)}}return r},P=["pnpm-lock.yaml","package-lock.json","npm-shrinkwrap.json","yarn.lock","bun.lock","bun.lockb"],q=(o,r,n)=>{let s=0,i=!1;for(const t of P){const e=u(o,t);if(_(e)){n.info(` ${e}`),s++;continue}}return{hadError:i,removed:s}},x=o=>{for(const r of $(o,{includeDirs:!1,includeSymlinks:!1,skip:[S,w]}))if(r.name==="package.json")return!0;return!1},m=(o,r,n)=>{let s=0,i=!1;for(const{packageDir:t}of b(o)){const e=u(o,t);if(!x(e)){if(r){n.info(` ${e}`),s++;continue}try{v(e,{force:!0,recursive:!0}),c.success(`Removed empty package ${e}`),s++}catch(f){c.error(`${e}: ${j(f)}`),i=!0}}}return{hadError:i,removed:s}},B=async({logger:o,options:r,workspaceRoot:n})=>{const s=n??process.cwd(),i=r.lockfile||!1,t=r.emptyPackages||!1;if(r.dryRun){const l=C(s);if(l.length>0){c.info("Would remove:");for(const a of l)o.info(` ${a}`)}else c.info("No node_modules directories found.");i&&q(s,!0,o),t&&(c.info("Would remove empty packages:"),m(s,!0,o));return}const e=R(s,i);for(const l of e.removed)c.success(`Removed ${l}`);for(const l of e.lockfilesRemoved)c.success(`Removed ${l}`);for(const l of e.errors)c.error(l);e.removed.length===0&&e.lockfilesRemoved.length===0?c.info("No node_modules directories found."):c.info(`Cleaned ${e.removed.length} node_modules director${e.removed.length===1?"y":"ies"}`);let f=!1;if(t){const{hadError:l,removed:a}=m(s,!1,o);f=l,a>0&&c.info(`Cleaned ${a} empty package director${a===1?"y":"ies"}`)}(e.errors.length>0||f)&&(process.exitCode=1)};export{B as default};
1
+ import{I as t,x as l}from"../packem_shared/pm-runner-CIH0wPh-.js";import{r as p,a as m}from"../packem_shared/command-runtime-RiCMa2C8.js";const g=async({logger:n,options:a,visConfig:o,workspaceRoot:c})=>{const s=c??process.cwd(),i=p({logger:n,options:a,visConfig:o},s),r=t(s,{backend:m(i),configBackend:o?.install?.backend,configCorepack:o?.install?.corepack}),e=l(r,a.check||!1,s,n);e!==0&&(process.exitCode=e)};export{g as default};
@@ -1,4 +1,4 @@
1
- import{createRequire as G}from"node:module";import{B as y,y as N}from"../packem_shared/index-OQZQyN5R.js";import{d as O,k as U,P as H,R as F,p as P}from"./heal.js";import{w as D,M as S}from"../packem_shared/pm-runner-Dws_Bw1y.js";import{p as a}from"./cli-main.js";const L=G(import.meta.url),_=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,x=e=>{if(typeof _<"u"&&_.versions&&_.versions.node){const[t,o]=_.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return _.getBuiltinModule(e)}return L(e)},{readFile:$}=x("node:fs/promises"),{createInterface:K}=x("node:readline"),j=()=>!!process.stdout.isTTY&&process.env.CI!=="true",V=e=>new Promise(t=>{const o=K({input:process.stdin,output:process.stderr});o.question(`${e} (Y/n) `,i=>{o.close();const s=i.trim().toLowerCase();t(s===""||s==="y"||s==="yes")})}),M=(e,t)=>{const o=D(t),i=S(o,{exact:!1,filter:[],global:!1,optional:!1,packages:[e],peer:!1,saveDev:!1,workspace:!1,workspaceRoot:!1},t,console);return Promise.resolve({exitCode:i})},R=e=>`pnpm add ${e}`,q=e=>e==="@gitbeaker/rest"?import("@gitbeaker/rest"):import("@octokit/rest"),B=async(e,t={})=>{const o=t.interactive??j(),i=t.prompt??V,s=t.runInstall??M,l=t.importImpl??q,d=t.workspaceRoot??process.cwd();try{return await l(e)}catch(n){const{code:p}=n;if(p!=="ERR_MODULE_NOT_FOUND"&&p!=="MODULE_NOT_FOUND")throw n}if(!o)throw new Error(`${e} is not installed. \`vis ai heal accept\` needs it to talk to the host. Install it in your repo first:
1
+ import{createRequire as G}from"node:module";import{B as y,y as N}from"../packem_shared/index-OQZQyN5R.js";import{d as O,k as U,P as H,R as F,p as P}from"./heal.js";import{w as D,M as S}from"../packem_shared/pm-runner-CIH0wPh-.js";import{p as a}from"./cli-main.js";const L=G(import.meta.url),_=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,x=e=>{if(typeof _<"u"&&_.versions&&_.versions.node){const[t,o]=_.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return _.getBuiltinModule(e)}return L(e)},{readFile:$}=x("node:fs/promises"),{createInterface:K}=x("node:readline"),j=()=>!!process.stdout.isTTY&&process.env.CI!=="true",V=e=>new Promise(t=>{const o=K({input:process.stdin,output:process.stderr});o.question(`${e} (Y/n) `,i=>{o.close();const s=i.trim().toLowerCase();t(s===""||s==="y"||s==="yes")})}),M=(e,t)=>{const o=D(t),i=S(o,{exact:!1,filter:[],global:!1,optional:!1,packages:[e],peer:!1,saveDev:!1,workspace:!1,workspaceRoot:!1},t,console);return Promise.resolve({exitCode:i})},R=e=>`pnpm add ${e}`,q=e=>e==="@gitbeaker/rest"?import("@gitbeaker/rest"):import("@octokit/rest"),B=async(e,t={})=>{const o=t.interactive??j(),i=t.prompt??V,s=t.runInstall??M,l=t.importImpl??q,d=t.workspaceRoot??process.cwd();try{return await l(e)}catch(n){const{code:p}=n;if(p!=="ERR_MODULE_NOT_FOUND"&&p!=="MODULE_NOT_FOUND")throw n}if(!o)throw new Error(`${e} is not installed. \`vis ai heal accept\` needs it to talk to the host. Install it in your repo first:
2
2
  ${R(e)}`);if(!await i(`${e} isn't installed. Install it now?`))throw new Error(`${e} install declined. Re-run \`vis ai heal accept\` after installing manually:
3
3
  ${R(e)}`);const r=await s(e,d);if(r.exitCode!==0)throw new Error(`Install of ${e} failed (exit ${String(r.exitCode)}). Install manually and retry:
4
4
  ${R(e)}`);return await l(e)},Y=e=>{const t=e.indexOf("/");if(t<=0||t===e.length-1)throw new Error(`Expected GITHUB_REPOSITORY in "owner/repo" form, got: ${e}`);return{owner:e.slice(0,t),repo:e.slice(t+1)}},J=async(e,t)=>{if(t.githubClient)return t.githubClient;const o=(await(t.loadSdk??B)("@octokit/rest")).Octokit;if(!o)throw new TypeError("Loaded `@octokit/rest` but no `Octokit` export was found. Reinstall the package or pin to a supported major.");return new o({auth:e})},W=async(e,t,o)=>{if(o.gitlabClient)return o.gitlabClient;const i=(await(o.loadSdk??B)("@gitbeaker/rest")).Gitlab;if(!i)throw new TypeError("Loaded `@gitbeaker/rest` but no `Gitlab` export was found. Reinstall the package or pin to a supported major.");return new i({host:t,token:e})},z=e=>e.replace(/\/api\/v\d+\/?$/,""),X=async e=>{const{branch:t,ciContext:o,files:i,message:s,workspaceRoot:l}=e,d=e.readFile??(w=>$(w,"utf8"));if(!o.repo)throw new Error("Cannot commit on GitHub: GITHUB_REPOSITORY (owner/repo) is not set.");if(!o.token)throw new Error("Cannot commit on GitHub: GITHUB_TOKEN is not set. Grant the workflow `contents: write` and pass the token through.");const{owner:r,repo:n}=Y(o.repo),p=await J(o.token,e),u=(await p.rest.git.getRef({owner:r,ref:`heads/${t}`,repo:n})).data.object.sha,h=(await p.rest.git.getCommit({commit_sha:u,owner:r,repo:n})).data.tree.sha,m=await Promise.all(i.map(async w=>{const C=y(l,w),k=await d(C),b=await p.rest.git.createBlob({content:Buffer.from(k,"utf8").toString("base64"),encoding:"base64",owner:r,repo:n});return{mode:"100644",path:w,sha:b.data.sha,type:"blob"}})),f=await p.rest.git.createTree({base_tree:h,owner:r,repo:n,tree:m}),g=await p.rest.git.createCommit({message:s,owner:r,parents:[u],repo:n,tree:f.data.sha});return await p.rest.git.updateRef({owner:r,ref:`heads/${t}`,repo:n,sha:g.data.sha}),{sha:g.data.sha,url:g.data.html_url}},Q=async e=>{const{branch:t,ciContext:o,files:i,message:s,workspaceRoot:l}=e,d=e.readFile??(m=>$(m,"utf8"));if(!o.repo)throw new Error("Cannot commit on GitLab: CI_PROJECT_ID / CI_PROJECT_PATH is not set.");if(!o.token)throw new Error("Cannot commit on GitLab: no token. CI_JOB_TOKEN cannot push commits — set GITLAB_TOKEN to a PAT/project-token with `api` scope.");if(!o.apiBaseUrl)throw new Error("Cannot commit on GitLab: CI_API_V4_URL is not set.");const r=z(o.apiBaseUrl),n=await W(o.token,r,e),p=await Promise.all(i.map(async m=>{const f=y(l,m);return{action:"update",content:await d(f),filePath:m}})),u=await n.Commits.create(o.repo,t,s,p),h=u.id??u.sha;if(!h)throw new Error("GitLab Commits.create returned no commit ID — cannot reference the new commit.");return{sha:h,url:u.web_url??u.webUrl}},Z=async e=>{if(e.files.length===0)throw new Error("Cannot commit: no files to include.");if(e.ciContext.provider==="github-actions")return await X(e);if(e.ciContext.provider==="gitlab-ci")return await Q(e);throw new Error(`Cannot commit: unsupported CI provider \`${e.ciContext.provider}\`. Run \`vis ai heal accept\` from a recognised CI environment.`)},v="/vis heal accept",ee=async e=>{if(!e)return;let t;try{t=await $(e,"utf8")}catch{return}const o=JSON.parse(t),i=o.comment?.body??"",s=o.comment?.user?.login??"",l=o.pull_request?.head?.repo?.full_name,d=o.pull_request?.base?.repo?.full_name??o.repository?.full_name,r=l!==void 0&&d!==void 0&&l!==d;return{actor:s,body:i,headRef:o.pull_request?.head?.ref,isFork:r}},te=e=>{const t=e.VIS_HEAL_TRIGGER_BODY,o=e.VIS_HEAL_TRIGGER_ACTOR;if(!(!t||!o))return{actor:o,body:t,headRef:e.VIS_HEAL_HEAD_REF,isFork:!1}},oe=e=>{const t=e.BUILDKITE_UNBLOCKER_EMAIL??e.BUILDKITE_UNBLOCKER;if(t)return{actor:t,body:v,headRef:e.BUILDKITE_BRANCH,isFork:!1}},re=async(e,t)=>{if(e.provider==="github-actions")return await ee(t.GITHUB_EVENT_PATH);if(e.provider==="gitlab-ci")return te(t);if(e.provider==="buildkite")return oe(t)},ie=(e,t)=>{const o=t.BUILDKITE_REPO;if(!o)return;const i=/(?:^|@|\/\/)github\.com[:/]([^/]+)\/([^/]+?)(?:\.git)?\/?$/i.exec(o);if(i&&t.GITHUB_TOKEN)return{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:e.prNumber,provider:"github-actions",repo:`${i[1]}/${i[2]}`,sha:e.sha,token:t.GITHUB_TOKEN};const s=/\/\/([^/]*gitlab[^/]*)\/([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(o),l=s?null:/@([^/:]*gitlab[^/:]*):([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(o),d=s??l;if(d&&t.GITLAB_TOKEN){const r=d[1];return{apiBaseUrl:t.CI_API_V4_URL??`https://${r}/api/v4`,buildId:void 0,buildNumber:void 0,prNumber:e.prNumber,provider:"gitlab-ci",repo:`${d[2]}/${d[3]}`,sha:e.sha,token:t.GITLAB_TOKEN}}},ae=async e=>{const t=e.fetchImpl??globalThis.fetch,o=`${(e.apiBaseUrl??"https://api.github.com").replace(/\/+$/,"")}/repos/${e.repo}/pulls/${String(e.prNumber)}`;try{const i=await t(o,{headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${e.token}`,"X-GitHub-Api-Version":"2022-11-28"}});return i.ok?(await i.json()).head?.ref:void 0}catch{return}},ne=(e,t,o,i)=>{const s=t.map(l=>`- \`${l}\``).join(`
@@ -1,4 +1,4 @@
1
- import{createRequire as S}from"node:module";import{s as B,j as U,E as I,V as P,I as L}from"../packem_shared/index.server-J83sowC4.js";import{y as A}from"../packem_shared/index-OQZQyN5R.js";import{readLastRunSummary as O}from"@visulima/task-runner";import{a as j,r as G,b as K,c as D}from"../packem_shared/ai-fix-Btd5AnSr.js";import{p as u,z as H}from"./cli-main.js";const R=S(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[t,o]=m.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return m.getBuiltinModule(e)}return R(e)},{spawn:h}=g("node:child_process"),{readFile:F}=g("node:fs/promises"),M=e=>{if(!e)return;const t=/^refs\/pull\/(\d+)\//.exec(e);return t?Number.parseInt(t[1],10):void 0},V=async e=>{if(!e)return{prNumber:void 0,sha:void 0};try{const t=await F(e,"utf8"),o=JSON.parse(t),r=o.pull_request?.number??o.issue?.number??o.number,i=o.pull_request?.head?.sha;return{prNumber:r,sha:i}}catch{return{prNumber:void 0,sha:void 0}}},J=async e=>{const t=M(e.GITHUB_REF),{prNumber:o,sha:r}=t===void 0?await V(e.GITHUB_EVENT_PATH):{prNumber:t,sha:void 0};return{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:t??o,provider:"github-actions",repo:e.GITHUB_REPOSITORY,sha:r??e.GITHUB_SHA,token:e.GITHUB_TOKEN}},q=e=>{const t=e.CI_MERGE_REQUEST_IID,o=t!==void 0&&t!==""?Number.parseInt(t,10):void 0,r=e.CI_API_V4_URL,i=e.GITLAB_TOKEN??e.CI_TOKEN;return{apiBaseUrl:r,buildId:void 0,buildNumber:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"gitlab-ci",repo:e.CI_PROJECT_ID??e.CI_PROJECT_PATH,sha:e.CI_COMMIT_SHA,token:i}},z=e=>{const t=e.BUILDKITE_PULL_REQUEST,o=t!==void 0&&t!==""&&t!=="false"?Number.parseInt(t,10):void 0,r=e.BUILDKITE_BUILD_NUMBER,i=r!==void 0&&r!==""?Number.parseInt(r,10):void 0,n=e.BUILDKITE_ORGANIZATION_SLUG,a=e.BUILDKITE_PIPELINE_SLUG,s=n!==void 0&&n!==""&&a!==void 0&&a!==""?`${n}/${a}`:void 0;return{apiBaseUrl:(e.BUILDKITE_API_BASE_URL??"https://api.buildkite.com").replace(/\/+$/,""),buildId:e.BUILDKITE_BUILD_ID,buildNumber:Number.isFinite(i)?i:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"buildkite",repo:s,sha:e.BUILDKITE_COMMIT,token:e.BUILDKITE_API_TOKEN}},Q=async(e=process.env)=>e.GITHUB_ACTIONS==="true"?await J(e):e.GITLAB_CI==="true"?q(e):e.BUILDKITE==="true"?z(e):{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:void 0,provider:"unknown",repo:void 0,sha:void 0,token:void 0},Y=(e,t,o,r)=>new Promise(i=>{const n=["pr","comment",String(t),"--body-file","-"];r&&n.push("--repo",r);const a=h(e,n,{stdio:["pipe","ignore","pipe"]});let s="";a.stderr?.setEncoding("utf8"),a.stderr?.on("data",d=>{s+=d}),a.once("error",()=>{i({exitCode:127,stderr:s})}),a.once("close",d=>{i({exitCode:d??-1,stderr:s})}),a.stdin?.on("error",()=>{}),a.stdin?.end(o)}),Z=async(e,t,o,r,i)=>{const n=`https://api.github.com/repos/${t}/issues/${String(o)}/comments`;try{const a=await e(n,{body:JSON.stringify({body:r}),headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${i}`,"Content-Type":"application/json","X-GitHub-Api-Version":"2022-11-28"},method:"POST"});if(!a.ok){const s=await a.text().catch(()=>"");return{error:`GitHub REST returned ${String(a.status)}: ${s.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(a){return{error:a instanceof Error?a.message:String(a),ok:!1}}},W=async(e,t,o,r,i,n)=>{const a=encodeURIComponent(o),s=`${t.replace(/\/+$/,"")}/projects/${a}/merge_requests/${String(r)}/notes`;try{const d=await e(s,{body:JSON.stringify({body:i}),headers:{"Content-Type":"application/json","PRIVATE-TOKEN":n},method:"POST"});if(!d.ok){const c=await d.text().catch(()=>"");return{error:`GitLab REST returned ${String(d.status)}: ${c.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(d){return{error:d instanceof Error?d.message:String(d),ok:!1}}},X=(e,t,o,r)=>new Promise(i=>{const n=h(e,["annotate","--style",o,"--context",r],{stdio:["pipe","ignore","pipe"]});let a="";n.stderr?.setEncoding("utf8"),n.stderr?.on("data",s=>{a+=s}),n.once("error",()=>{i({exitCode:127,stderr:a})}),n.once("close",s=>{i({exitCode:s??-1,stderr:a})}),n.stdin?.on("error",()=>{}),n.stdin?.end(t)}),tt=async(e,t,o,r,i,n,a,s)=>{const[d,c]=o.split("/",2);if(!d||!c)return{error:`Buildkite repo identifier \`${o}\` is not in {org}/{pipeline} form.`,ok:!1};const f=`${t}/v2/organizations/${encodeURIComponent(d)}/pipelines/${encodeURIComponent(c)}/builds/${String(r)}/annotations`;try{const p=await e(f,{body:JSON.stringify({body:i,context:a,style:n}),headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},method:"POST"});if(!p.ok){const l=await p.text().catch(()=>"");return{error:`Buildkite REST returned ${String(p.status)}: ${l.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(p){return{error:p instanceof Error?p.message:String(p),ok:!1}}},et=async(e,t,o,r)=>{const i=t.buildId?`vis-ai-heal-${t.buildId}`:"vis-ai-heal",n="info",a=await X(o,e,n,i);if(a.exitCode===0)return{method:"buildkite-cli",posted:!0};if(!t.apiBaseUrl||!t.repo||t.buildNumber===void 0||!t.token){const d=[];return t.repo||d.push("BUILDKITE_ORGANIZATION_SLUG / BUILDKITE_PIPELINE_SLUG"),t.buildNumber===void 0&&d.push("BUILDKITE_BUILD_NUMBER"),t.token||d.push("BUILDKITE_API_TOKEN (with `write_build_annotations` scope)"),{error:`buildkite-agent annotate exited ${String(a.exitCode)} (${a.stderr.trim().slice(0,200)}); cannot fall back to REST without ${d.join(", ")}`,method:"buildkite-cli",posted:!1}}const s=await tt(r,t.apiBaseUrl,t.repo,t.buildNumber,e,n,i,t.token);return s.ok?{method:"rest",posted:!0}:{error:`buildkite-agent annotate exited ${String(a.exitCode)}; REST fallback also failed: ${s.error??"unknown"}`,method:"rest",posted:!1}},ot=async(e,t,o,r)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};const i=await Y(o,t.prNumber,e,t.repo);if(i.exitCode===0)return{method:"gh-cli",posted:!0};if(!t.repo||!t.token)return{error:`gh exited ${String(i.exitCode)} (${i.stderr.trim().slice(0,200)}); cannot fall back to REST without GITHUB_REPOSITORY + GITHUB_TOKEN`,method:"gh-cli",posted:!1};const n=await Z(r,t.repo,t.prNumber,e,t.token);return n.ok?{method:"rest",posted:!0}:{error:`gh exited ${String(i.exitCode)}; REST fallback also failed: ${n.error??"unknown"}`,method:"rest",posted:!1}},rt=async(e,t,o)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};if(!t.apiBaseUrl||!t.repo)return{error:"GitLab CI context is missing CI_API_V4_URL or CI_PROJECT_ID; cannot post note.",method:"rest",posted:!1};if(!t.token)return{error:"GitLab CI context has no token. CI_JOB_TOKEN cannot post MR notes — set GITLAB_TOKEN to a personal/project access token with `api` scope.",method:"rest",posted:!1};const r=await W(o,t.apiBaseUrl,t.repo,t.prNumber,e,t.token);return r.ok?{method:"rest",posted:!0}:{error:r.error,method:"rest",posted:!1}},it=async e=>{const{body:t,buildkiteAgentBin:o="buildkite-agent",context:r,fetchImpl:i=globalThis.fetch,ghBin:n="gh"}=e;return r.provider==="github-actions"?await ot(t,r,n,i):r.provider==="gitlab-ci"?await rt(t,r,i):r.provider==="buildkite"?await et(t,r,o,i):{method:"skipped",posted:!1}},k=e=>{let t=0,o=0;for(const r of e)r.status==="applied"?t+=1:o+=1;return{applied:t,failed:o}},b=(e,t,o)=>{const r=D(e,t,o),i=A(e,r);return i===""||i.startsWith("..")?r:i},nt=(e,t,o,r)=>new Promise(i=>{const n=process.argv[1];if(!n){i({exitCode:-1,stderr:"Cannot locate vis bin (process.argv[1] missing).",stdout:""});return}const a=[n,"run",o,"--projects",t,"--no-cache","--summarize","--fail-fast"],s=h(process.execPath,a,{cwd:e,env:{...process.env,NO_COLOR:"1"},stdio:["ignore","pipe","pipe"]});let d="",c="";const f=setTimeout(()=>{s.kill("SIGTERM"),setTimeout(()=>s.kill("SIGKILL"),2e3).unref()},r);s.stdout?.setEncoding("utf8"),s.stdout?.on("data",p=>{d+=p}),s.stderr?.setEncoding("utf8"),s.stderr?.on("data",p=>{c+=p}),s.once("error",p=>{clearTimeout(f),i({exitCode:-1,stderr:p.message,stdout:d})}),s.once("close",p=>{clearTimeout(f),i({exitCode:p??-1,stderr:c,stdout:d})})}),at=6e4,T=e=>{let t=0;const o=e.match(/`{3,}/g);if(o)for(const r of o)t=Math.max(t,r.length);return"`".repeat(Math.max(3,t+1))},v=(e,t,o)=>{if(e.patches.length===0)return"_No patches proposed._";const r=[];for(const[i,n]of e.patches.entries()){const a=b(t,o,n.file),s=[`**[${String(i+1)}] \`${a}\`**`];n.reason&&s.push(`_${n.reason}_`);const d=T(`${n.oldString}
1
+ import{createRequire as S}from"node:module";import{s as B,j as U,E as I,V as P,I as L}from"../packem_shared/index.server-J83sowC4.js";import{y as A}from"../packem_shared/index-OQZQyN5R.js";import{readLastRunSummary as O}from"@visulima/task-runner";import{a as j,r as G,b as K,c as D}from"../packem_shared/ai-fix-DnJDgPN-.js";import{p as u,r as H}from"./cli-main.js";const R=S(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[t,o]=m.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return m.getBuiltinModule(e)}return R(e)},{spawn:h}=g("node:child_process"),{readFile:F}=g("node:fs/promises"),M=e=>{if(!e)return;const t=/^refs\/pull\/(\d+)\//.exec(e);return t?Number.parseInt(t[1],10):void 0},V=async e=>{if(!e)return{prNumber:void 0,sha:void 0};try{const t=await F(e,"utf8"),o=JSON.parse(t),r=o.pull_request?.number??o.issue?.number??o.number,i=o.pull_request?.head?.sha;return{prNumber:r,sha:i}}catch{return{prNumber:void 0,sha:void 0}}},J=async e=>{const t=M(e.GITHUB_REF),{prNumber:o,sha:r}=t===void 0?await V(e.GITHUB_EVENT_PATH):{prNumber:t,sha:void 0};return{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:t??o,provider:"github-actions",repo:e.GITHUB_REPOSITORY,sha:r??e.GITHUB_SHA,token:e.GITHUB_TOKEN}},q=e=>{const t=e.CI_MERGE_REQUEST_IID,o=t!==void 0&&t!==""?Number.parseInt(t,10):void 0,r=e.CI_API_V4_URL,i=e.GITLAB_TOKEN??e.CI_TOKEN;return{apiBaseUrl:r,buildId:void 0,buildNumber:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"gitlab-ci",repo:e.CI_PROJECT_ID??e.CI_PROJECT_PATH,sha:e.CI_COMMIT_SHA,token:i}},z=e=>{const t=e.BUILDKITE_PULL_REQUEST,o=t!==void 0&&t!==""&&t!=="false"?Number.parseInt(t,10):void 0,r=e.BUILDKITE_BUILD_NUMBER,i=r!==void 0&&r!==""?Number.parseInt(r,10):void 0,n=e.BUILDKITE_ORGANIZATION_SLUG,a=e.BUILDKITE_PIPELINE_SLUG,s=n!==void 0&&n!==""&&a!==void 0&&a!==""?`${n}/${a}`:void 0;return{apiBaseUrl:(e.BUILDKITE_API_BASE_URL??"https://api.buildkite.com").replace(/\/+$/,""),buildId:e.BUILDKITE_BUILD_ID,buildNumber:Number.isFinite(i)?i:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"buildkite",repo:s,sha:e.BUILDKITE_COMMIT,token:e.BUILDKITE_API_TOKEN}},Q=async(e=process.env)=>e.GITHUB_ACTIONS==="true"?await J(e):e.GITLAB_CI==="true"?q(e):e.BUILDKITE==="true"?z(e):{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:void 0,provider:"unknown",repo:void 0,sha:void 0,token:void 0},Y=(e,t,o,r)=>new Promise(i=>{const n=["pr","comment",String(t),"--body-file","-"];r&&n.push("--repo",r);const a=h(e,n,{stdio:["pipe","ignore","pipe"]});let s="";a.stderr?.setEncoding("utf8"),a.stderr?.on("data",d=>{s+=d}),a.once("error",()=>{i({exitCode:127,stderr:s})}),a.once("close",d=>{i({exitCode:d??-1,stderr:s})}),a.stdin?.on("error",()=>{}),a.stdin?.end(o)}),Z=async(e,t,o,r,i)=>{const n=`https://api.github.com/repos/${t}/issues/${String(o)}/comments`;try{const a=await e(n,{body:JSON.stringify({body:r}),headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${i}`,"Content-Type":"application/json","X-GitHub-Api-Version":"2022-11-28"},method:"POST"});if(!a.ok){const s=await a.text().catch(()=>"");return{error:`GitHub REST returned ${String(a.status)}: ${s.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(a){return{error:a instanceof Error?a.message:String(a),ok:!1}}},W=async(e,t,o,r,i,n)=>{const a=encodeURIComponent(o),s=`${t.replace(/\/+$/,"")}/projects/${a}/merge_requests/${String(r)}/notes`;try{const d=await e(s,{body:JSON.stringify({body:i}),headers:{"Content-Type":"application/json","PRIVATE-TOKEN":n},method:"POST"});if(!d.ok){const c=await d.text().catch(()=>"");return{error:`GitLab REST returned ${String(d.status)}: ${c.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(d){return{error:d instanceof Error?d.message:String(d),ok:!1}}},X=(e,t,o,r)=>new Promise(i=>{const n=h(e,["annotate","--style",o,"--context",r],{stdio:["pipe","ignore","pipe"]});let a="";n.stderr?.setEncoding("utf8"),n.stderr?.on("data",s=>{a+=s}),n.once("error",()=>{i({exitCode:127,stderr:a})}),n.once("close",s=>{i({exitCode:s??-1,stderr:a})}),n.stdin?.on("error",()=>{}),n.stdin?.end(t)}),tt=async(e,t,o,r,i,n,a,s)=>{const[d,c]=o.split("/",2);if(!d||!c)return{error:`Buildkite repo identifier \`${o}\` is not in {org}/{pipeline} form.`,ok:!1};const f=`${t}/v2/organizations/${encodeURIComponent(d)}/pipelines/${encodeURIComponent(c)}/builds/${String(r)}/annotations`;try{const p=await e(f,{body:JSON.stringify({body:i,context:a,style:n}),headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},method:"POST"});if(!p.ok){const l=await p.text().catch(()=>"");return{error:`Buildkite REST returned ${String(p.status)}: ${l.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(p){return{error:p instanceof Error?p.message:String(p),ok:!1}}},et=async(e,t,o,r)=>{const i=t.buildId?`vis-ai-heal-${t.buildId}`:"vis-ai-heal",n="info",a=await X(o,e,n,i);if(a.exitCode===0)return{method:"buildkite-cli",posted:!0};if(!t.apiBaseUrl||!t.repo||t.buildNumber===void 0||!t.token){const d=[];return t.repo||d.push("BUILDKITE_ORGANIZATION_SLUG / BUILDKITE_PIPELINE_SLUG"),t.buildNumber===void 0&&d.push("BUILDKITE_BUILD_NUMBER"),t.token||d.push("BUILDKITE_API_TOKEN (with `write_build_annotations` scope)"),{error:`buildkite-agent annotate exited ${String(a.exitCode)} (${a.stderr.trim().slice(0,200)}); cannot fall back to REST without ${d.join(", ")}`,method:"buildkite-cli",posted:!1}}const s=await tt(r,t.apiBaseUrl,t.repo,t.buildNumber,e,n,i,t.token);return s.ok?{method:"rest",posted:!0}:{error:`buildkite-agent annotate exited ${String(a.exitCode)}; REST fallback also failed: ${s.error??"unknown"}`,method:"rest",posted:!1}},ot=async(e,t,o,r)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};const i=await Y(o,t.prNumber,e,t.repo);if(i.exitCode===0)return{method:"gh-cli",posted:!0};if(!t.repo||!t.token)return{error:`gh exited ${String(i.exitCode)} (${i.stderr.trim().slice(0,200)}); cannot fall back to REST without GITHUB_REPOSITORY + GITHUB_TOKEN`,method:"gh-cli",posted:!1};const n=await Z(r,t.repo,t.prNumber,e,t.token);return n.ok?{method:"rest",posted:!0}:{error:`gh exited ${String(i.exitCode)}; REST fallback also failed: ${n.error??"unknown"}`,method:"rest",posted:!1}},rt=async(e,t,o)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};if(!t.apiBaseUrl||!t.repo)return{error:"GitLab CI context is missing CI_API_V4_URL or CI_PROJECT_ID; cannot post note.",method:"rest",posted:!1};if(!t.token)return{error:"GitLab CI context has no token. CI_JOB_TOKEN cannot post MR notes — set GITLAB_TOKEN to a personal/project access token with `api` scope.",method:"rest",posted:!1};const r=await W(o,t.apiBaseUrl,t.repo,t.prNumber,e,t.token);return r.ok?{method:"rest",posted:!0}:{error:r.error,method:"rest",posted:!1}},it=async e=>{const{body:t,buildkiteAgentBin:o="buildkite-agent",context:r,fetchImpl:i=globalThis.fetch,ghBin:n="gh"}=e;return r.provider==="github-actions"?await ot(t,r,n,i):r.provider==="gitlab-ci"?await rt(t,r,i):r.provider==="buildkite"?await et(t,r,o,i):{method:"skipped",posted:!1}},k=e=>{let t=0,o=0;for(const r of e)r.status==="applied"?t+=1:o+=1;return{applied:t,failed:o}},b=(e,t,o)=>{const r=D(e,t,o),i=A(e,r);return i===""||i.startsWith("..")?r:i},nt=(e,t,o,r)=>new Promise(i=>{const n=process.argv[1];if(!n){i({exitCode:-1,stderr:"Cannot locate vis bin (process.argv[1] missing).",stdout:""});return}const a=[n,"run",o,"--projects",t,"--no-cache","--summarize","--fail-fast"],s=h(process.execPath,a,{cwd:e,env:{...process.env,NO_COLOR:"1"},stdio:["ignore","pipe","pipe"]});let d="",c="";const f=setTimeout(()=>{s.kill("SIGTERM"),setTimeout(()=>s.kill("SIGKILL"),2e3).unref()},r);s.stdout?.setEncoding("utf8"),s.stdout?.on("data",p=>{d+=p}),s.stderr?.setEncoding("utf8"),s.stderr?.on("data",p=>{c+=p}),s.once("error",p=>{clearTimeout(f),i({exitCode:-1,stderr:p.message,stdout:d})}),s.once("close",p=>{clearTimeout(f),i({exitCode:p??-1,stderr:c,stdout:d})})}),at=6e4,T=e=>{let t=0;const o=e.match(/`{3,}/g);if(o)for(const r of o)t=Math.max(t,r.length);return"`".repeat(Math.max(3,t+1))},v=(e,t,o)=>{if(e.patches.length===0)return"_No patches proposed._";const r=[];for(const[i,n]of e.patches.entries()){const a=b(t,o,n.file),s=[`**[${String(i+1)}] \`${a}\`**`];n.reason&&s.push(`_${n.reason}_`);const d=T(`${n.oldString}
2
2
  ${n.newString}`);s.push(`${d}diff`);for(const c of n.oldString.split(`
3
3
  `))s.push(`- ${c}`);for(const c of n.newString.split(`
4
4
  `))s.push(`+ ${c}`);s.push(d),r.push(s.join(`
@@ -1,4 +1,4 @@
1
- import{createRequire as nt}from"node:module";import{U as gt,$ as dt,j as tt,O as U,q as oe,I as mi,s as Ie}from"../packem_shared/index.server-J83sowC4.js";import{o as pe,p as We,L as Jo,t as st,s as ht,i as lt,n as vt,a as yt,b as ct}from"../packem_shared/index-CPhv-r4c.js";import{N as Ke,r as Oe}from"../packem_shared/Table-CcVkyULl-DLWu6XHL.js";import{t as bt}from"../packem_shared/runtime-process-Dmz0vCJy-DUwTvH1J.js";const at=nt(import.meta.url),be=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ut=i=>{if(typeof be<"u"&&be.versions&&be.versions.node){const[e,o]=be.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return be.getBuiltinModule(i)}return at(i)},{createRequire:rt}=ut("node:module"),pt=/^#?([a-f\d]{3}|[a-f\d]{6})$/i,Fo=i=>{let[,e]=pt.exec(i)??[];const o=e?e.length:0;if(o===3){const a=e.charAt(0),u=e.charAt(1),g=e.charAt(2);e=a+a+u+u+g+g}else if(o!==6)return globalThis.process?.env?.NODE_ENV!=="production"&&console.warn(`[@visulima/colorize] Invalid hex color "${i}"; expected a 3- or 6-digit hex string (e.g. "#96C" or "#E0115F"). Falling back to black.`),[0,0,0];const n=Number.parseInt(e,16);return[n>>16&255,n>>8&255,n&255]},ku=(i,e,o)=>i===e&&e===o?i<8?16:i>248?231:Math.round((i-8)/247*24)+232:16+36*Math.round(i/51)+6*Math.round(e/51)+Math.round(o/51),Ko=i=>{let e,o,n;if(i<8)return 30+i;if(i<16)return 90+(i-8);if(i>=232)e=o=n=((i-232)*10+8)/255;else{i-=16;const g=i%36;e=Math.floor(i/36)/5,o=Math.floor(g/6)/5,n=g%6/5}const a=Math.max(e,o,n)*2;if(a===0)return 30;const u=30+(Math.round(n)<<2|Math.round(o)<<1|Math.round(e));return a===2?u+60:u},na=(i,e,o)=>Ko(ku(i,e,o));function wt({onlyFirst:i=!1}={}){const e="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,i?void 0:"g")}const Mi=(i,e,o)=>e>i?e:Math.min(i,o),N=39,W=49,aa=10,ua={close:"",open:""},Lu=i=>{const e=i>0?(h,v)=>({close:`\x1B[${String(v)}m`,open:`\x1B[${String(h)}m`}):()=>ua,o=h=>(v,y,c)=>h(ku(Number(v),Number(y),Number(c))),n=h=>v=>{const[y,c,b]=Fo(v);return h(y,c,b)};let a=h=>e(`38;5;${String(h)}`,N),u=h=>e(`48;5;${String(h)}`,W),g=(h,v,y)=>e(`38;2;${String(h)};${String(v)};${String(y)}`,N),d=(h,v,y)=>e(`48;2;${String(h)};${String(v)};${String(y)}`,W);i===1?(a=h=>e(Ko(Number(h)),N),u=h=>e(Ko(Number(h))+aa,W),g=(h,v,y)=>e(na(Number(h),Number(v),Number(y)),N),d=(h,v,y)=>e(na(Number(h),Number(v),Number(y))+aa,W)):i===2&&(g=o(a),d=o(u));const r={bold:e(1,22),dim:e(2,22),hidden:e(8,28),inverse:e(7,27),italic:e(3,23),overline:e(53,55),reset:e(0,0),strike:e(9,29),strikethrough:e(9,29),underline:e(4,24),visible:ua},s={bgBlack:e(40,W),bgBlackBright:e(100,W),bgBlue:e(44,W),bgBlueBright:e(104,W),bgCyan:e(46,W),bgCyanBright:e(106,W),bgGray:e(100,W),bgGreen:e(42,W),bgGreenBright:e(102,W),bgGrey:e(100,W),bgMagenta:e(45,W),bgMagentaBright:e(105,W),bgRed:e(41,W),bgRedBright:e(101,W),bgWhite:e(47,W),bgWhiteBright:e(107,W),bgYellow:e(43,W),bgYellowBright:e(103,W),black:e(30,N),blackBright:e(90,N),blue:e(34,N),blueBright:e(94,N),cyan:e(36,N),cyanBright:e(96,N),gray:e(90,N),green:e(32,N),greenBright:e(92,N),grey:e(90,N),magenta:e(35,N),magentaBright:e(95,N),red:e(31,N),redBright:e(91,N),white:e(37,N),whiteBright:e(97,N),yellow:e(33,N),yellowBright:e(93,N)},l={bg:h=>u(Mi(h,0,255)),bgHex:n(d),bgRgb:(h,v,y)=>d(Mi(h,0,255),Mi(v,0,255),Mi(y,0,255)),fg:h=>a(Mi(h,0,255)),hex:n(g),rgb:(h,v,y)=>g(Mi(h,0,255),Mi(v,0,255),Mi(y,0,255))};return{baseColors:s,baseStyles:r,styleMethods:l}},Zu=gt();dt();Lu(Zu);const jt=(i,e,o)=>{if(e==="")return i;let n=i.indexOf(e);if(n<0)return i;const a=e.length;let u=0,g="";for(;~n;)g+=i.slice(u,n)+o,u=n+a,n=i.indexOf(e,u);return g+i.slice(u)},mt=(i,e,o)=>{if(!i)return"";let n;if(i.raw===void 0?n=String(i):n=String.raw(i,...e),n.includes("\x1B"))for(let a=o;a;a=a.props)n=jt(n,a.close,a.open);return n.includes(`
1
+ import{createRequire as nt}from"node:module";import{U as gt,$ as dt,j as tt,O as U,q as oe,I as mi,s as Ie}from"../packem_shared/index.server-J83sowC4.js";import{o as pe,p as We,L as Jo,t as st,s as ht,i as lt,n as vt,a as yt,b as ct}from"../packem_shared/index-DJAnbLEh.js";import{N as Ke,r as Oe}from"../packem_shared/Table-CcVkyULl-DLWu6XHL.js";import{t as bt}from"../packem_shared/runtime-process-Dmz0vCJy-DUwTvH1J.js";const at=nt(import.meta.url),be=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ut=i=>{if(typeof be<"u"&&be.versions&&be.versions.node){const[e,o]=be.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return be.getBuiltinModule(i)}return at(i)},{createRequire:rt}=ut("node:module"),pt=/^#?([a-f\d]{3}|[a-f\d]{6})$/i,Fo=i=>{let[,e]=pt.exec(i)??[];const o=e?e.length:0;if(o===3){const a=e.charAt(0),u=e.charAt(1),g=e.charAt(2);e=a+a+u+u+g+g}else if(o!==6)return globalThis.process?.env?.NODE_ENV!=="production"&&console.warn(`[@visulima/colorize] Invalid hex color "${i}"; expected a 3- or 6-digit hex string (e.g. "#96C" or "#E0115F"). Falling back to black.`),[0,0,0];const n=Number.parseInt(e,16);return[n>>16&255,n>>8&255,n&255]},ku=(i,e,o)=>i===e&&e===o?i<8?16:i>248?231:Math.round((i-8)/247*24)+232:16+36*Math.round(i/51)+6*Math.round(e/51)+Math.round(o/51),Ko=i=>{let e,o,n;if(i<8)return 30+i;if(i<16)return 90+(i-8);if(i>=232)e=o=n=((i-232)*10+8)/255;else{i-=16;const g=i%36;e=Math.floor(i/36)/5,o=Math.floor(g/6)/5,n=g%6/5}const a=Math.max(e,o,n)*2;if(a===0)return 30;const u=30+(Math.round(n)<<2|Math.round(o)<<1|Math.round(e));return a===2?u+60:u},na=(i,e,o)=>Ko(ku(i,e,o));function wt({onlyFirst:i=!1}={}){const e="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,i?void 0:"g")}const Mi=(i,e,o)=>e>i?e:Math.min(i,o),N=39,W=49,aa=10,ua={close:"",open:""},Lu=i=>{const e=i>0?(h,v)=>({close:`\x1B[${String(v)}m`,open:`\x1B[${String(h)}m`}):()=>ua,o=h=>(v,y,c)=>h(ku(Number(v),Number(y),Number(c))),n=h=>v=>{const[y,c,b]=Fo(v);return h(y,c,b)};let a=h=>e(`38;5;${String(h)}`,N),u=h=>e(`48;5;${String(h)}`,W),g=(h,v,y)=>e(`38;2;${String(h)};${String(v)};${String(y)}`,N),d=(h,v,y)=>e(`48;2;${String(h)};${String(v)};${String(y)}`,W);i===1?(a=h=>e(Ko(Number(h)),N),u=h=>e(Ko(Number(h))+aa,W),g=(h,v,y)=>e(na(Number(h),Number(v),Number(y)),N),d=(h,v,y)=>e(na(Number(h),Number(v),Number(y))+aa,W)):i===2&&(g=o(a),d=o(u));const r={bold:e(1,22),dim:e(2,22),hidden:e(8,28),inverse:e(7,27),italic:e(3,23),overline:e(53,55),reset:e(0,0),strike:e(9,29),strikethrough:e(9,29),underline:e(4,24),visible:ua},s={bgBlack:e(40,W),bgBlackBright:e(100,W),bgBlue:e(44,W),bgBlueBright:e(104,W),bgCyan:e(46,W),bgCyanBright:e(106,W),bgGray:e(100,W),bgGreen:e(42,W),bgGreenBright:e(102,W),bgGrey:e(100,W),bgMagenta:e(45,W),bgMagentaBright:e(105,W),bgRed:e(41,W),bgRedBright:e(101,W),bgWhite:e(47,W),bgWhiteBright:e(107,W),bgYellow:e(43,W),bgYellowBright:e(103,W),black:e(30,N),blackBright:e(90,N),blue:e(34,N),blueBright:e(94,N),cyan:e(36,N),cyanBright:e(96,N),gray:e(90,N),green:e(32,N),greenBright:e(92,N),grey:e(90,N),magenta:e(35,N),magentaBright:e(95,N),red:e(31,N),redBright:e(91,N),white:e(37,N),whiteBright:e(97,N),yellow:e(33,N),yellowBright:e(93,N)},l={bg:h=>u(Mi(h,0,255)),bgHex:n(d),bgRgb:(h,v,y)=>d(Mi(h,0,255),Mi(v,0,255),Mi(y,0,255)),fg:h=>a(Mi(h,0,255)),hex:n(g),rgb:(h,v,y)=>g(Mi(h,0,255),Mi(v,0,255),Mi(y,0,255))};return{baseColors:s,baseStyles:r,styleMethods:l}},Zu=gt();dt();Lu(Zu);const jt=(i,e,o)=>{if(e==="")return i;let n=i.indexOf(e);if(n<0)return i;const a=e.length;let u=0,g="";for(;~n;)g+=i.slice(u,n)+o,u=n+a,n=i.indexOf(e,u);return g+i.slice(u)},mt=(i,e,o)=>{if(!i)return"";let n;if(i.raw===void 0?n=String(i):n=String.raw(i,...e),n.includes("\x1B"))for(let a=o;a;a=a.props)n=jt(n,a.close,a.open);return n.includes(`
2
2
  `)&&(n=n.replace(/(\r*\n)/g,`${o.closeStack}$1${o.openStack}`)),o.openStack+n+o.closeStack},ft=function(i){const e=i?.level??Zu,{baseColors:o,baseStyles:n,styleMethods:a}=Lu(e),u={};let g=null;const d=({props:s},{close:l,open:h})=>{const v=(s?.openStack??"")+h,y=l+(s?.closeStack??""),c=(b,...p)=>mt(b,p,c.props);return Object.setPrototypeOf(c,g),c.props={close:l,closeStack:y,open:h,openStack:v,props:s},c.open=v,c.close=y,c},r=s=>String(s);r.strip=s=>s.replaceAll(wt(),"");for(const s in o)u[s]={get(){const l=d(this,o[s]);return Object.defineProperty(this,s,{value:l}),l}};for(const s in n)u[s]={get(){const l=d(this,n[s]);return Object.defineProperty(this,s,{value:l}),l}};for(const s in a)u[s]={get(){return(...l)=>d(this,a[s](...l))}};return u.ansi256=u.fg,u.bgAnsi256=u.bg,g=Object.defineProperties({},u),Object.setPrototypeOf(r,g),r},Yt=i=>(e,...o)=>{if(!Array.isArray(e)||!Array.isArray(e.raw))throw new TypeError("A tagged template literal must be provided");const n=[e.raw[0]];for(let a=1;a<e.raw.length;a+=1)n.push(String(o[a-1]).replaceAll(/[{}\\]/g,String.raw`\$&`),String(e.raw[a]));return i(n.join(""))},kt=new Map([["0","\0"],["\\","\\"],["a","\x07"],["b","\b"],["e","\x1B"],["f","\f"],["n",`
3
3
  `],["r","\r"],["t"," "],["v","\v"]]),Su=i=>{const e=i.startsWith("u"),o=i[1]==="{";return e&&!o&&i.length===5||i.startsWith("x")&&i.length===3?String.fromCodePoint(Number.parseInt(i.slice(1),16)):e&&o?String.fromCodePoint(Number.parseInt(i.slice(2,-1),16)):kt.get(i)??i},Lt=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|\{(~)?(#?[\w:]+(?:\([^)]*\))?(?:\.#?[\w:]+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n))|(\})|((?:.|[\r\n\f])+?)/gi,ga=/(?:^|\.)(?:(\w+)(?:\(([^)]*)\))?|#(?=[:a-f\d]{2,})([a-f\d]{6})?(?::([a-f\d]{6}))?)/gi,Zt=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,St=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,Jt=/\s*,\s*/,Ct=(i,e)=>{const o=[],n=e.trim().split(Jt);let a;for(const u of n){const g=Number(u);if(!Number.isNaN(g))o.push(g);else if(a=Zt.exec(u))o.push(a[2].replaceAll(St,(d,r,s)=>r?Su(r):s));else throw new Error(`Invalid template style argument: ${u} (in style '${i}')`)}return o},Xt=i=>{ga.lastIndex=0;const e=[];let o;for(;(o=ga.exec(i))!==null;){const n=o[1];o[2]?e.push([n,...Ct(n,o[2])]):o[3]||o[4]?(o[3]&&e.push(["rgb",...Fo(o[3])]),o[4]&&e.push(["bgRgb",...Fo(o[4])])):e.push([n])}return e},da=(i,e)=>{const o={};for(const a of e)for(const u of a.styles)o[u[0]]=a.inverse?void 0:u.slice(1);let n=i;for(const[a,u]of Object.entries(o))if(Array.isArray(u)){if(!(a in n))throw new Error(`Unknown style: ${a}`);n=u.length>0?n[a](...u):n[a]}return n},Ht=i=>e=>{const o=[],n=[];let a=[];if(e.replaceAll(Lt,(u,g,d,r,s,l)=>{if(g)a.push(Su(g));else if(r){const h=a.join("");a=[],n.push(o.length===0?h:da(i,o)(h)),o.push({inverse:d,styles:Xt(r)})}else if(s){if(o.length===0)throw new Error("Found extraneous } in template literal");n.push(da(i,o)(a.join(""))),a=[],o.pop()}else a.push(l)}),n.push(a.join("")),o.length>0)throw new Error(`template literal is missing ${String(o.length)} closing bracket${o.length===1?"":"s"} (\`}\`)`);return n.join("")},Dt=new ft,Tt=Ht(Dt),Bt=Yt(Tt),Qt=rt(import.meta.url),Vi=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Xe=i=>{if(typeof Vi<"u"&&Vi.versions&&Vi.versions.node){const[e,o]=Vi.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Vi.getBuiltinModule(i)}return Qt(i)},{createRequire:Mt}=Xe("node:module"),Ri=Vi,{execFileSync:Gt}=Xe("node:child_process"),Ye=Xe("node:fs"),Nt=Xe("node:tty"),Wt=Xe("node:os"),xt=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],Pt=12288,Ft=65510,Kt=[12288,12288,65281,65376,65504,65510],Ot=8361,At=65518,Rt=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],_t=32,zt=10630,Et=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],qt=4352,It=262141,Ju=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],He=(i,e)=>{let o=0,n=Math.floor(i.length/2)-1;for(;o<=n;){const a=Math.floor((o+n)/2),u=a*2;if(e<i[u])n=a-1;else if(e>i[u+1])o=a+1;else return!0}return!1},ta=19968,[Ut,$t]=Vt(Ju);function Vt(i){let e=i[0],o=i[1];for(let n=0;n<i.length;n+=2){const a=i[n],u=i[n+1];if(ta>=a&&ta<=u)return[a,u];u-a>o-e&&(e=a,o=u)}return[e,o]}const ir=i=>i<161||i>1114109?!1:He(xt,i),er=i=>i<Pt||i>Ft?!1:He(Kt,i),or=i=>i<Ot||i>At?!1:He(Rt,i),nr=i=>i<_t||i>zt?!1:He(Et,i),ar=i=>i>=Ut&&i<=$t?!0:i<qt||i>It?!1:He(Ju,i);function ur(i){return ir(i)?"ambiguous":er(i)?"fullwidth":or(i)?"halfwidth":nr(i)?"narrow":ar(i)?"wide":"neutral"}function gr(i){if(!Number.isSafeInteger(i))throw new TypeError(`Expected a code point, got \`${typeof i}\`.`)}function Cu(i){return gr(i),ur(i)}const ra=new Map,dr=i=>[i.ambiguousIsNarrow?1:0,i.control,i.fullWidth,i.regular,i.wide].join("|"),tr=i=>{const e=dr(i.width);let o=ra.get(e);return o||(o=new Map,ra.set(e,o)),o},xe=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,Xu=i=>i>=32&&i<=126?"latin":i===8203||i===8204||i===8205||i===8288?"zero":i<=31||i>=127&&i<=159?"control":i>=160&&i<=255||i>=9472&&i<=9599?"latin":i>=4352&&i<=4607||i>=11904&&i<=40959||i>=44032&&i<=55215||i>=63744&&i<=64255||i>=65280&&i<=65519&&!(i>=65377&&i<=65439)||i>=12352&&i<=12543?"wide":i===8230?"latin":"other",rr=(i,e)=>{const o=tr(e),n=Math.floor(i/65536),a=i%65536;let u=o.get(n);if(u||(u=new Map,o.set(n,u)),u.has(a))return u.get(a);let g;switch(Xu(i)){case"control":{g=e.width.control;break}case"latin":{g=e.width.regular;break}case"wide":{g=e.width.wide;break}case"zero":{g=0;break}default:switch(Cu(i)){case"ambiguous":{g=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{g=e.width.fullWidth;break}case"wide":{g=e.width.wide;break}default:g=e.width.regular}}return u.set(a,g),g},sr=i=>i>=768&&i<=879||i>=6832&&i<=6911||i>=7616&&i<=7679||i>=8400&&i<=8447||i>=65056&&i<=65071||i>=917760&&i<=917999||i>=65024&&i<=65039||i>=3633&&i<=3642||i>=3655&&i<=3662||i>=3761&&i<=3769||i>=3771&&i<=3772||i>=3784&&i<=3789||i>=2304&&i<=2307||i>=2362&&i<=2383||i>=2385&&i<=2391||i>=2402&&i<=2403||i>=2433&&i<=2435||i>=2492&&i<=2500||i>=2509&&i<=2509||i>=2561&&i<=2563||i>=2620&&i<=2637||i>=1611&&i<=1631||i>=1648&&i<=1648||i>=1750&&i<=1773||i>=2276&&i<=2302||i>=1425&&i<=1469||i>=1471&&i<=1471||i>=1473&&i<=1474||i>=1476&&i<=1477||i>=1479&&i<=1479||i>=3893&&i<=3893||i>=3895&&i<=3895||i>=3897&&i<=3897||i>=3953&&i<=3966||i>=3968&&i<=3972||i>=3974&&i<=3975?!0:i>=768&&i<=777||i>=803&&i<=803,Oo=(i,e={})=>{if(!i||i.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const o={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?Oo(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},n=Math.max(0,o.truncation.limit-o.truncation.ellipsisWidth),{length:a}=i,u=a>1e4;let g=0,d=0,r=a,s=!1;const l=i.includes("\x1B")||i.includes("›");for(;g<a;){if(l&&(i[g]==="\x1B"||i[g]==="›")){if(i.startsWith("\x1B]8;;",g)){const p="\x1B]8;;\x07",j=p.length,L=i.indexOf("\x07",g+5);if(L!==-1){const R=i.indexOf(p,L+1);if(R!==-1){const _=R+j,q=i.slice(L+1,R).replace(pe,""),Q=Oo(q,{ambiguousIsNarrow:o.width.ambiguousIsNarrow,ansiWidth:o.width.ansi,controlWidth:o.width.control,countAnsiEscapeCodes:!1,ellipsis:o.truncation.ellipsis,ellipsisWidth:o.truncation.ellipsisWidth,emojiWidth:o.width.emoji,fullWidth:o.width.fullWidth,halfWidth:o.width.halfWidth,limit:Math.max(0,n-d),regularWidth:o.width.regular,tabWidth:o.width.tab,wideWidth:o.width.wide}),I=Q.width;if(Q.truncated)s=!0,r=Math.min(r,g);else if(d+I>n&&(r=Math.min(r,g),s=!0,d+I>o.truncation.limit))break;if(d+=I,g=_,s&&d>=o.truncation.limit)break;continue}}}if(pe.lastIndex=g,pe.test(i)){const p=pe.lastIndex-g,j=o.truncation.countAnsiEscapeCodes?p:o.width.ansi;if(d+j>n&&(r=Math.min(r,g),d+j>o.truncation.limit)){s=!0;break}d+=j,g=pe.lastIndex;continue}}const y=i.codePointAt(g);if(y===8203||y===65279||y>=8288&&y<=8292){g+=1;continue}if(y===9){if(d+o.width.tab>n&&(r=Math.min(r,g),d+o.width.tab>o.truncation.limit)){s=!0;break}d+=o.width.tab,g+=1;continue}if(xe.lastIndex=g,xe.test(i)){const p=(xe.lastIndex-g)*o.width.regular;if(d+p>n){const j=Math.floor((n-d)/o.width.regular);if(r=Math.min(r,g+j),d+p>o.truncation.limit){s=!0;break}}d+=p,g=xe.lastIndex;continue}if((y<=31||y>=127&&y<=159)&&(We.lastIndex=g,We.test(i))){const p=(We.lastIndex-g)*o.width.control;if(d+p>n&&(r=Math.min(r,g+Math.floor((n-d)/o.width.control)),d+p>o.truncation.limit)){s=!0;break}d+=p,g=We.lastIndex;continue}if(Jo.lastIndex=g,Jo.test(i)){if(d+o.width.emoji>n&&(r=Math.min(r,g),d+o.width.emoji>o.truncation.limit)){s=!0;break}d+=o.width.emoji,g=Jo.lastIndex;continue}const c=i.codePointAt(g)??0;if(sr(c)){g+=c>65535?2:1;continue}let b;if(u)b=rr(c,o);else switch(Xu(c)){case"control":{b=o.width.control;break}case"latin":{b=o.width.regular;break}case"wide":{b=o.width.wide;break}case"zero":{b=0;break}default:switch(Cu(c)){case"ambiguous":{b=o.width.ambiguousIsNarrow?o.width.regular:o.width.wide;break}case"fullwidth":{b=o.width.fullWidth;break}case"wide":{b=o.width.wide;break}default:b=o.width.regular}}if(d+b>n&&(r=Math.min(r,g),d+b>o.truncation.limit)){s=!0;break}d+=b,g+=c>65535?2:1}let h=d,v=!1;return s&&o.truncation.limit>=o.truncation.ellipsisWidth&&(h=o.truncation.limit,v=!0),{ellipsed:v,index:s?r:a,truncated:s,width:h}},hr=(i,e={})=>Oo(i,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,lr=Mt(import.meta.url),we=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,vr=i=>{if(typeof we<"u"&&we.versions&&we.versions.node){const[e,o]=we.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return we.getBuiltinModule(i)}return lr(i)};vr("node:util");function yr(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Co,sa;function cr(){if(sa)return Co;sa=1,Co=e;function i(n){return n instanceof Buffer?Buffer.from(n):new n.constructor(n.buffer.slice(),n.byteOffset,n.length)}function e(n){if(n=n||{},n.circles)return o(n);const a=new Map;if(a.set(Date,s=>new Date(s)),a.set(Map,(s,l)=>new Map(g(Array.from(s),l))),a.set(Set,(s,l)=>new Set(g(Array.from(s),l))),n.constructorHandlers)for(const s of n.constructorHandlers)a.set(s[0],s[1]);let u=null;return n.proto?r:d;function g(s,l){const h=Object.keys(s),v=new Array(h.length);for(let y=0;y<h.length;y++){const c=h[y],b=s[c];typeof b!="object"||b===null?v[c]=b:b.constructor!==Object&&(u=a.get(b.constructor))?v[c]=u(b,l):ArrayBuffer.isView(b)?v[c]=i(b):v[c]=l(b)}return v}function d(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return g(s,d);if(s.constructor!==Object&&(u=a.get(s.constructor)))return u(s,d);const l={};for(const h in s){if(Object.hasOwnProperty.call(s,h)===!1)continue;const v=s[h];typeof v!="object"||v===null?l[h]=v:v.constructor!==Object&&(u=a.get(v.constructor))?l[h]=u(v,d):ArrayBuffer.isView(v)?l[h]=i(v):l[h]=d(v)}return l}function r(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return g(s,r);if(s.constructor!==Object&&(u=a.get(s.constructor)))return u(s,r);const l={};for(const h in s){const v=s[h];typeof v!="object"||v===null?l[h]=v:v.constructor!==Object&&(u=a.get(v.constructor))?l[h]=u(v,r):ArrayBuffer.isView(v)?l[h]=i(v):l[h]=r(v)}return l}}function o(n){const a=[],u=[],g=new Map;if(g.set(Date,h=>new Date(h)),g.set(Map,(h,v)=>new Map(r(Array.from(h),v))),g.set(Set,(h,v)=>new Set(r(Array.from(h),v))),n.constructorHandlers)for(const h of n.constructorHandlers)g.set(h[0],h[1]);let d=null;return n.proto?l:s;function r(h,v){const y=Object.keys(h),c=new Array(y.length);for(let b=0;b<y.length;b++){const p=y[b],j=h[p];if(typeof j!="object"||j===null)c[p]=j;else if(j.constructor!==Object&&(d=g.get(j.constructor)))c[p]=d(j,v);else if(ArrayBuffer.isView(j))c[p]=i(j);else{const L=a.indexOf(j);L!==-1?c[p]=u[L]:c[p]=v(j)}}return c}function s(h){if(typeof h!="object"||h===null)return h;if(Array.isArray(h))return r(h,s);if(h.constructor!==Object&&(d=g.get(h.constructor)))return d(h,s);const v={};a.push(h),u.push(v);for(const y in h){if(Object.hasOwnProperty.call(h,y)===!1)continue;const c=h[y];if(typeof c!="object"||c===null)v[y]=c;else if(c.constructor!==Object&&(d=g.get(c.constructor)))v[y]=d(c,s);else if(ArrayBuffer.isView(c))v[y]=i(c);else{const b=a.indexOf(c);b!==-1?v[y]=u[b]:v[y]=s(c)}}return a.pop(),u.pop(),v}function l(h){if(typeof h!="object"||h===null)return h;if(Array.isArray(h))return r(h,l);if(h.constructor!==Object&&(d=g.get(h.constructor)))return d(h,l);const v={};a.push(h),u.push(v);for(const y in h){const c=h[y];if(typeof c!="object"||c===null)v[y]=c;else if(c.constructor!==Object&&(d=g.get(c.constructor)))v[y]=d(c,l);else if(ArrayBuffer.isView(c))v[y]=i(c);else{const b=a.indexOf(c);b!==-1?v[y]=u[b]:v[y]=l(c)}}return a.pop(),u.pop(),v}}return Co}var br=cr();const Hu=yr(br);Hu();var Du=typeof global=="object"&&global&&global.Object===Object&&global,pr=typeof self=="object"&&self&&self.Object===Object&&self,O=Du||pr||Function("return this")(),E=O.Symbol,Tu=Object.prototype,wr=Tu.hasOwnProperty,jr=Tu.toString,je=E?E.toStringTag:void 0;function mr(i){var e=wr.call(i,je),o=i[je];try{i[je]=void 0;var n=!0}catch{}var a=jr.call(i);return n&&(e?i[je]=o:delete i[je]),a}var fr=Object.prototype,Yr=fr.toString;function kr(i){return Yr.call(i)}var Lr="[object Null]",Zr="[object Undefined]",ha=E?E.toStringTag:void 0;function V(i){return i==null?i===void 0?Zr:Lr:ha&&ha in Object(i)?mr(i):kr(i)}function x(i){return i!=null&&typeof i=="object"}var Sr="[object Symbol]";function ui(i){return typeof i=="symbol"||x(i)&&V(i)==Sr}var Jr=NaN;function la(i){return typeof i=="number"?i:ui(i)?Jr:+i}function M(i,e){for(var o=-1,n=i==null?0:i.length,a=Array(n);++o<n;)a[o]=e(i[o],o,i);return a}var k=Array.isArray,va=E?E.prototype:void 0,ya=va?va.toString:void 0;function gi(i){if(typeof i=="string")return i;if(k(i))return M(i,gi)+"";if(ui(i))return ya?ya.call(i):"";var e=i+"";return e=="0"&&1/i==-1/0?"-0":e}function eo(i,e){return function(o,n){var a;if(o===void 0&&n===void 0)return e;if(o!==void 0&&(a=o),n!==void 0){if(a===void 0)return n;typeof o=="string"||typeof n=="string"?(o=gi(o),n=gi(n)):(o=la(o),n=la(n)),a=i(o,n)}return a}}var Cr=eo(function(i,e){return i+e},0),Xr=/\s/;function Bu(i){for(var e=i.length;e--&&Xr.test(i.charAt(e)););return e}var Hr=/^\s+/;function Qu(i){return i&&i.slice(0,Bu(i)+1).replace(Hr,"")}function G(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var ca=NaN,Dr=/^[-+]0x[0-9a-f]+$/i,Tr=/^0b[01]+$/i,Br=/^0o[0-7]+$/i,Qr=parseInt;function si(i){if(typeof i=="number")return i;if(ui(i))return ca;if(G(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=G(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=Qu(i);var o=Tr.test(i);return o||Br.test(i)?Qr(i.slice(2),o?2:8):Dr.test(i)?ca:+i}var ba=1/0,Mr=17976931348623157e292;function Ci(i){if(!i)return i===0?i:0;if(i=si(i),i===ba||i===-ba){var e=i<0?-1:1;return e*Mr}return i===i?i:0}function Z(i){var e=Ci(i),o=e%1;return e===e?o?e-o:e:0}var Gr="Expected a function";function Nr(i,e){if(typeof e!="function")throw new TypeError(Gr);return i=Z(i),function(){if(--i<1)return e.apply(this,arguments)}}function oi(i){return i}var Wr="[object AsyncFunction]",xr="[object Function]",Pr="[object GeneratorFunction]",Fr="[object Proxy]";function Xi(i){if(!G(i))return!1;var e=V(i);return e==xr||e==Pr||e==Wr||e==Fr}var Ae=O["__core-js_shared__"],pa=(function(){var i=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""})();function Kr(i){return!!pa&&pa in i}var Or=Function.prototype,Ar=Or.toString;function qi(i){if(i!=null){try{return Ar.call(i)}catch{}try{return i+""}catch{}}return""}var Rr=/[\\^$.*+?()[\]{}|]/g,_r=/^\[object .+?Constructor\]$/,zr=Function.prototype,Er=Object.prototype,qr=zr.toString,Ir=Er.hasOwnProperty,Ur=RegExp("^"+qr.call(Ir).replace(Rr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Mu(i){if(!G(i)||Kr(i))return!1;var e=Xi(i)?Ur:_r;return e.test(qi(i))}function $r(i,e){return i?.[e]}function Ii(i,e){var o=$r(i,e);return Mu(o)?o:void 0}var Le=Ii(O,"WeakMap"),Ue=Le&&new Le,Gu=Ue?function(i,e){return Ue.set(i,e),i}:oi,wa=Object.create,de=(function(){function i(){}return function(e){if(!G(e))return{};if(wa)return wa(e);i.prototype=e;var o=new i;return i.prototype=void 0,o}})();function Ze(i){return function(){var e=arguments;switch(e.length){case 0:return new i;case 1:return new i(e[0]);case 2:return new i(e[0],e[1]);case 3:return new i(e[0],e[1],e[2]);case 4:return new i(e[0],e[1],e[2],e[3]);case 5:return new i(e[0],e[1],e[2],e[3],e[4]);case 6:return new i(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new i(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var o=de(i.prototype),n=i.apply(o,e);return G(n)?n:o}}var Vr=1;function is(i,e,o){var n=e&Vr,a=Ze(i);function u(){var g=this&&this!==O&&this instanceof u?a:i;return g.apply(n?o:this,arguments)}return u}function di(i,e,o){switch(o.length){case 0:return i.call(e);case 1:return i.call(e,o[0]);case 2:return i.call(e,o[0],o[1]);case 3:return i.call(e,o[0],o[1],o[2])}return i.apply(e,o)}var es=Math.max;function Nu(i,e,o,n){for(var a=-1,u=i.length,g=o.length,d=-1,r=e.length,s=es(u-g,0),l=Array(r+s),h=!n;++d<r;)l[d]=e[d];for(;++a<g;)(h||a<u)&&(l[o[a]]=i[a]);for(;s--;)l[d++]=i[a++];return l}var os=Math.max;function Wu(i,e,o,n){for(var a=-1,u=i.length,g=-1,d=o.length,r=-1,s=e.length,l=os(u-d,0),h=Array(l+s),v=!n;++a<l;)h[a]=i[a];for(var y=a;++r<s;)h[y+r]=e[r];for(;++g<d;)(v||a<u)&&(h[y+o[g]]=i[a++]);return h}function ns(i,e){for(var o=i.length,n=0;o--;)i[o]===e&&++n;return n}function oo(){}var as=4294967295;function J(i){this.__wrapped__=i,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=as,this.__views__=[]}J.prototype=de(oo.prototype);J.prototype.constructor=J;function gn(){}var dn=Ue?function(i){return Ue.get(i)}:gn,ne={},us=Object.prototype,gs=us.hasOwnProperty;function Re(i){for(var e=i.name+"",o=ne[e],n=gs.call(ne,e)?o.length:0;n--;){var a=o[n],u=a.func;if(u==null||u==i)return a.name}return e}function li(i,e){this.__wrapped__=i,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=void 0}li.prototype=de(oo.prototype);li.prototype.constructor=li;function ei(i,e){var o=-1,n=i.length;for(e||(e=Array(n));++o<n;)e[o]=i[o];return e}function xu(i){if(i instanceof J)return i.clone();var e=new li(i.__wrapped__,i.__chain__);return e.__actions__=ei(i.__actions__),e.__index__=i.__index__,e.__values__=i.__values__,e}var ds=Object.prototype,ts=ds.hasOwnProperty;function t(i){if(x(i)&&!k(i)&&!(i instanceof J)){if(i instanceof li)return i;if(ts.call(i,"__wrapped__"))return xu(i)}return new li(i)}t.prototype=oo.prototype;t.prototype.constructor=t;function Ao(i){var e=Re(i),o=t[e];if(typeof o!="function"||!(e in J.prototype))return!1;if(i===o)return!0;var n=dn(o);return!!n&&i===n[0]}var rs=800,ss=16,hs=Date.now;function Pu(i){var e=0,o=0;return function(){var n=hs(),a=ss-(n-o);if(o=n,a>0){if(++e>=rs)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}var Fu=Pu(Gu),ls=/\{\n\/\* \[wrapped with (.+)\] \*/,vs=/,? & /;function ys(i){var e=i.match(ls);return e?e[1].split(vs):[]}var cs=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function bs(i,e){var o=e.length;if(!o)return i;var n=o-1;return e[n]=(o>1?"& ":"")+e[n],e=e.join(o>2?", ":" "),i.replace(cs,`{
4
4
  /* [wrapped with `+e+`] */
@@ -1,7 +1,7 @@
1
- import{y as U,m as I,I as K,v as b}from"../packem_shared/index-OQZQyN5R.js";import{E as Q}from"../packem_shared/public-api-WqUCiyIe.js";import{b4 as N,b5 as A,b6 as x,u as X,p as Z}from"./cli-main.js";const ee=(e,t)=>typeof e!="string"||e===""?"":e[0].toLowerCase()+e.slice(1),k=(e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleUpperCase(t.locale):e[0].toUpperCase())+e.slice(1),te=(e,t)=>`${e}::${t?.joiner??""}::${t?.locale??""}::${t?.knownAcronyms?.join(",")??""}::${t?.normalize?"true":"false"}`,$=(e,t)=>{const{length:r}=e;if(r===0)return"";if(r===1)return e[0];const n=[];let i="",o="";for(let s=0;s<r;s++){const l=e[s];if(N.test(l)){i?(n.push(i+o+l),i="",o=""):(n.length>0&&n.push(t),i=l);continue}i?(o&&(o+=t),o+=l):(n.length>0&&n.push(t),n.push(l))}return n.join("")},ne=/(?<![a-zß])SS(?![a-z])/g,re=e=>e.replaceAll(ne,"ß"),ie=(e,t)=>{if(typeof e!="string"||!e)return"";let r=!0;return $(A(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(i=>{const o=i,s=o.toLowerCase();return r?(r=!1,ee(s)):k(s,t)}),"")},oe=new x(1e3),S=(e,t)=>{if(typeof e!="string")return"";const r=t?.cache??!1,n=t?.cacheStore??oe;let i;if(r&&(i=te(e,t)),r&&i&&n.has(i))return n.get(i);const o=A(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&&N.test(l))return l;if(t?.toUpperCase)return t.locale?l.toLocaleUpperCase(t.locale):l.toUpperCase();const a=t?.locale?.startsWith("de")?re(l):l;return t?.locale?a.toLocaleLowerCase(t.locale):a.toLowerCase()}),s=$(o,t?.joiner??"-");return r&&i&&n.set(i,s),s},se=new x(1e3),le=(e,t)=>S(e,{cacheStore:se,...t,joiner:"_",toUpperCase:!0}),ae=(e,t)=>typeof e!="string"||!e?"":$(A(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(n=>k(n.toLowerCase(),{locale:t?.locale})),""),ce=new x(1e3),fe=(e,t)=>S(e,{cacheStore:ce,...t,joiner:"_"}),ue=(e,t)=>typeof e!="string"?"":$(A(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(n=>k(n,{locale:t?.locale})),"-"),m=e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),T={camel_case:e=>ie(m(e)),kebab_case:e=>S(m(e)),lower_case:e=>m(e).toLowerCase(),pascal_case:e=>ae(m(e)),path_join:(e,...t)=>{const r=[m(e),...t.map(n=>m(n))];return I(...r)},path_relative:(e,t)=>U(m(t),m(e)),snake_case:e=>fe(m(e)),upper_case:e=>m(e).toUpperCase(),upper_kebab_case:e=>ue(m(e)),upper_snake_case:e=>le(m(e))},z=(e,t,r=[])=>{const n=T[e];if(!n)throw new Error(`Unknown filter "${e}". Known filters: ${Object.keys(T).sort().join(", ")}.`);return n(t,...r)},R=e=>{const t=[];let r=0,n=0,i,o=-1;for(const s of e){if(o+=1,i){s===i&&(i=void 0);continue}if(s==='"'||s==="'"){i=s;continue}s==="("?r+=1:s===")"?r-=1:s===","&&r===0&&(t.push(e.slice(n,o)),n=o+1)}return t.push(e.slice(n)),t},pe=e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},me=/\[([^\]]+)\]/g,de=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:R(i).map(o=>{const s=o.trim();return pe(s)??s}),name:n}},he=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=>de(n)),name:r}},ye=e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),ge=(e,t)=>{const r=e.replaceAll(me,(n,i)=>{const{filters:o,name:s}=he(i);if(!Object.hasOwn(t,s))throw new Error(`Variable "${s}" used in filename "${e}" but not defined`);let l=t[s];for(const a of o)l=z(a.name,l,a.args);return ye(l)});return P(r)},P=e=>e.split("/").map(t=>t.endsWith(".tera")||t.endsWith(".twig")?t.slice(0,-5):t).join("/"),we=e=>e.endsWith(".raw")?e.slice(0,-4):e,be=e=>{const t=e.split("/");return(t.at(-1)??"").startsWith("_")?!0:t.slice(0,-1).includes("partials")},Ee=(e,t)=>{if(!e.startsWith(`---
1
+ import{y as U,m as I,I as K,v as b}from"../packem_shared/index-OQZQyN5R.js";import{E as Q}from"../packem_shared/public-api-WqUCiyIe.js";import{u as X,p as Z}from"./cli-main.js";import{k as N,j as A,l as x}from"../packem_shared/env-XJzocuUP.js";const ee=(e,t)=>typeof e!="string"||e===""?"":e[0].toLowerCase()+e.slice(1),k=(e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleUpperCase(t.locale):e[0].toUpperCase())+e.slice(1),te=(e,t)=>`${e}::${t?.joiner??""}::${t?.locale??""}::${t?.knownAcronyms?.join(",")??""}::${t?.normalize?"true":"false"}`,$=(e,t)=>{const{length:r}=e;if(r===0)return"";if(r===1)return e[0];const n=[];let i="",o="";for(let s=0;s<r;s++){const l=e[s];if(N.test(l)){i?(n.push(i+o+l),i="",o=""):(n.length>0&&n.push(t),i=l);continue}i?(o&&(o+=t),o+=l):(n.length>0&&n.push(t),n.push(l))}return n.join("")},ne=/(?<![a-zß])SS(?![a-z])/g,re=e=>e.replaceAll(ne,"ß"),ie=(e,t)=>{if(typeof e!="string"||!e)return"";let r=!0;return $(A(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(i=>{const o=i,s=o.toLowerCase();return r?(r=!1,ee(s)):k(s,t)}),"")},oe=new x(1e3),S=(e,t)=>{if(typeof e!="string")return"";const r=t?.cache??!1,n=t?.cacheStore??oe;let i;if(r&&(i=te(e,t)),r&&i&&n.has(i))return n.get(i);const o=A(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&&N.test(l))return l;if(t?.toUpperCase)return t.locale?l.toLocaleUpperCase(t.locale):l.toUpperCase();const a=t?.locale?.startsWith("de")?re(l):l;return t?.locale?a.toLocaleLowerCase(t.locale):a.toLowerCase()}),s=$(o,t?.joiner??"-");return r&&i&&n.set(i,s),s},se=new x(1e3),le=(e,t)=>S(e,{cacheStore:se,...t,joiner:"_",toUpperCase:!0}),ae=(e,t)=>typeof e!="string"||!e?"":$(A(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(n=>k(n.toLowerCase(),{locale:t?.locale})),""),ce=new x(1e3),fe=(e,t)=>S(e,{cacheStore:ce,...t,joiner:"_"}),ue=(e,t)=>typeof e!="string"?"":$(A(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(n=>k(n,{locale:t?.locale})),"-"),m=e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),T={camel_case:e=>ie(m(e)),kebab_case:e=>S(m(e)),lower_case:e=>m(e).toLowerCase(),pascal_case:e=>ae(m(e)),path_join:(e,...t)=>{const r=[m(e),...t.map(n=>m(n))];return I(...r)},path_relative:(e,t)=>U(m(t),m(e)),snake_case:e=>fe(m(e)),upper_case:e=>m(e).toUpperCase(),upper_kebab_case:e=>ue(m(e)),upper_snake_case:e=>le(m(e))},z=(e,t,r=[])=>{const n=T[e];if(!n)throw new Error(`Unknown filter "${e}". Known filters: ${Object.keys(T).sort().join(", ")}.`);return n(t,...r)},R=e=>{const t=[];let r=0,n=0,i,o=-1;for(const s of e){if(o+=1,i){s===i&&(i=void 0);continue}if(s==='"'||s==="'"){i=s;continue}s==="("?r+=1:s===")"?r-=1:s===","&&r===0&&(t.push(e.slice(n,o)),n=o+1)}return t.push(e.slice(n)),t},pe=e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},me=/\[([^\]]+)\]/g,de=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:R(i).map(o=>{const s=o.trim();return pe(s)??s}),name:n}},he=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=>de(n)),name:r}},ye=e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),ge=(e,t)=>{const r=e.replaceAll(me,(n,i)=>{const{filters:o,name:s}=he(i);if(!Object.hasOwn(t,s))throw new Error(`Variable "${s}" used in filename "${e}" but not defined`);let l=t[s];for(const a of o)l=z(a.name,l,a.args);return ye(l)});return P(r)},P=e=>e.split("/").map(t=>t.endsWith(".tera")||t.endsWith(".twig")?t.slice(0,-5):t).join("/"),we=e=>e.endsWith(".raw")?e.slice(0,-4):e,be=e=>{const t=e.split("/");return(t.at(-1)??"").startsWith("_")?!0:t.slice(0,-1).includes("partials")},Ee=(e,t)=>{if(!e.startsWith(`---
2
2
  `)&&!e.startsWith(`---\r
3
3
  `))return{body:e};const r=e.indexOf(`
4
4
  ---`,3);if(r===-1)return{body:e};let n=r+1+3;e[n]==="\r"&&(n+=1),e[n]===`
5
5
  `&&(n+=1);const i=e.startsWith(`---\r
6
6
  `)?5:4,o=e.slice(i,r).replaceAll("\r","");let s;try{s=t(o)}catch(l){const a=l instanceof Error?l.message:String(l);throw new Error(`Failed to parse frontmatter YAML: ${a}`,{cause:l})}if(s==null)return{body:e.slice(n)};if(typeof s!="object"||Array.isArray(s))throw new TypeError(`Frontmatter must be a YAML mapping, got ${Array.isArray(s)?"array":typeof s}`);return{body:e.slice(n),frontmatter:s}},ve=/\{\{-?(.+?)-?\}\}|\{%-?(.+?)-?%\}/gs,q=e=>{const t=[];let r=0,n=1;const i=o=>{for(const s of o)s===`
7
- `&&(n+=1)};for(const o of e.matchAll(ve)){const s=o.index??0;if(s>r){const c=e.slice(r,s);t.push({line:n,type:"text",value:c}),i(c)}const l=n,a=o[0];a.startsWith("{{")?t.push({line:l,type:"expr",value:(o[1]??"").trim()}):t.push({line:l,type:"stmt",value:(o[2]??"").trim()}),i(a),r=s+a.length}if(r<e.length){const o=e.slice(r);t.push({line:n,type:"text",value:o})}return t},Ae=new Set(["block","endblock","endfilter","endmacro","extends","filter","import","macro","set"]),F=(e,t)=>{let r=0;const n=(o,s)=>{throw new Error(`${t}:${o}: ${s}`)},i=o=>{const s=[];for(;r<e.length;){const l=e[r];if(l.type==="text"){s.push({type:"text",value:l.value}),r+=1;continue}if(l.type==="expr"){s.push({expression:l.value,line:l.line,type:"expr"}),r+=1;continue}const a=l.value.split(/\s+/)[0]??"";if(o.includes(a))return s;if(Ae.has(a)&&n(l.line,`Tera feature "{% ${a} %}" is not supported. Supported: if/else/endif, for/endfor, include. Rewrite the template to avoid macros, set, extends, block, and import.`),a==="if"){r+=1;const c=l.value.slice(2).trim(),p=i(["else","endif"]);let f;r<e.length&&e[r].type==="stmt"&&e[r].value.split(/\s+/)[0]==="else"&&(r+=1,f=i(["endif"])),(r>=e.length||e[r].type!=="stmt"||e[r].value.split(/\s+/)[0]!=="endif")&&n(l.line,"Unterminated {% if %} — missing {% endif %}"),r+=1,s.push({alternate:f,condition:c,consequent:p,line:l.line,type:"if"});continue}if(a==="for"){r+=1;const c=l.value.slice(3).trim(),p=c.indexOf(" in ");p===-1&&n(l.line,"Malformed {% for %} — expected `for <name> in <collection>`");const f=c.slice(0,p).trim(),d=c.slice(p+4).trim();(!f||!d)&&n(l.line,"Malformed {% for %} — missing binding or collection");const u=i(["endfor"]);(r>=e.length||e[r].type!=="stmt"||e[r].value.split(/\s+/)[0]!=="endfor")&&n(l.line,"Unterminated {% for %} — missing {% endfor %}"),r+=1,s.push({binding:f,body:u,collection:d,line:l.line,type:"for"});continue}if(a==="include"){r+=1;const c=l.value.slice(7).trim(),p=G(c);p===void 0&&n(l.line,"Malformed {% include %} — expected a quoted partial name"),s.push({line:l.line,name:p,type:"include"});continue}n(l.line,`Unknown tag "{% ${a} %}". Supported: if, for, include.`)}return s};return i([])},G=e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},$e=e=>e==null?"":typeof e=="boolean"||typeof e=="number"?String(e):typeof e=="string"?e:JSON.stringify(e),je=e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:!0,B=(e,t,r,n,i=!0)=>{const o=e.split(".");if(i&&o.length>0&&!Object.hasOwn(t,o[0]))throw new Error(`${n}:${r}: Variable "${e}" is not defined`);let s=t;for(const l of o){if(s==null)return;if(typeof s!="object")throw new TypeError(`${n}:${r}: Cannot read "${l}" on non-object value`);s=s[l]}return s},xe=e=>{const t=[];let r=0,n=0,i;for(let o=0;o<e.length;o+=1){const s=e[o];if(i){s===i&&(i=void 0);continue}if(s==='"'||s==="'"){i=s;continue}s==="("?r+=1:s===")"?r-=1:s==="|"&&r===0&&(t.push(e.slice(n,o)),n=o+1)}return t.push(e.slice(n)),t},ke=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:R(i).map(o=>o.trim()),name:n}:{args:[],name:n}},v=(e,t,r,n,i=!0)=>{const o=e.trim();if(o==="true")return!0;if(o==="false")return!1;if(o==="null"||o==="none")return null;const s=G(o);return s!==void 0?s:/^-?\d+(?:\.\d+)?$/.test(o)?Number(o):B(o,t,r,n,i)},D=(e,t,r,n,i=!0)=>{const o=xe(e),s=o[0].trim();let l=v(s,t,r,n,i);for(let a=1;a<o.length;a+=1){const c=o[a].trim(),{args:p,name:f}=ke(c),d=p.map(u=>v(u,t,r,n,i));try{l=z(f,l,d)}catch(u){const y=u instanceof Error?u.message:String(u);throw new Error(`${n}:${r}: ${y}`,{cause:u})}}return l},Y=(e,t)=>{let r,n=0;for(let i=0;i<=e.length-t.length;i+=1){const o=e[i];if(r){o===r&&(r=void 0);continue}if(o==='"'||o==="'"){r=o;continue}if(o==="("){n+=1;continue}if(o===")"){n-=1;continue}if(n===0&&e.slice(i,i+t.length)===t)return i}return-1},_=(e,t)=>{const r=[];let n=0,i=0;for(;i<=e.length-t.length;){const o=Y(e.slice(i),t);if(o===-1)break;r.push(e.slice(n,i+o)),i+=o+t.length,n=i}return r.push(e.slice(n)),r},g=(e,t,r,n)=>{const i=e.trim();if(i==="")return!1;if(i.startsWith("(")&&i.endsWith(")")&&Se(i)===i.length-1)return g(i.slice(1,-1),t,r,n);const o=_(i," or ");if(o.length>1)return o.some(l=>g(l,t,r,n));const s=_(i," and ");if(s.length>1)return s.every(l=>g(l,t,r,n));if(i.startsWith("not "))return!g(i.slice(4),t,r,n);for(const l of["==","!="]){const a=Y(i,l);if(a!==-1){const c=v(i.slice(0,a),t,n,r,!1),p=v(i.slice(a+l.length),t,n,r,!1),f=c===p;return l==="=="?f:!f}}return je(D(i,t,n,r,!1))},Se=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},E=(e,t)=>{let r="";for(const n of e){if(n.type==="text"){r+=n.value;continue}if(n.type==="expr"){r+=$e(D(n.expression,t.scope,n.line,t.filename));continue}if(n.type==="if"){const i=g(n.condition,t.scope,t.filename,n.line)?n.consequent:n.alternate??[];r+=E(i,t);continue}if(n.type==="for"){const i=B(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 o of i){const s={...t.scope,[n.binding]:o};r+=E(n.body,{...t,scope:s})}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 o=t.includeStack??new Set;if(o.has(n.name)){const s=[...o,n.name].join(" → ");throw new Error(`${t.filename}:${n.line}: Circular partial include detected: ${s}`)}o.add(n.name);try{r+=E(i,{...t,filename:`<partial:${n.name}>`,includeStack:o})}finally{o.delete(n.name)}}}return r},Ce=(e,t)=>F(q(e),t),j=(e,t)=>E(F(q(e),t.filename),t),L="template.yml",Oe=".raw",We=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"]),Te=new Set(["Brewfile","CHANGELOG","CODEOWNERS","CONTRIBUTING","COPYING","Dockerfile","Gemfile","LICENCE","LICENSE","Makefile","NOTICE","Procfile","Rakefile","README","VERSION"]),_e=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()},J=e=>{const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)},Le=e=>{const t=_e(e);if(t!=="")return We.has(t);const r=J(e);return Te.has(r)},Me=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)}"`)}},Ue=e=>e.replaceAll("\\","/").replace(/^\.\//,"").replaceAll(/\/+/g,"/"),Ie=(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 o=0;o<n.length-1;o+=1){const s=n[o],l=i[s];if(l===void 0){const a={};i[s]=a,i=a}else if(typeof l=="object"&&!Buffer.isBuffer(l))i=l;else throw new TypeError(`Path conflict: "${n.slice(0,o+1).join("/")}" is both a file and a directory`)}i[n.at(-1)]=r},M=(e,t,r)=>{if(typeof e!="string")return Ne(e);const n=e.includes("{{")||e.includes("{%")?j(e,{filename:`${r}#frontmatter`,scope:t}):e;return g(n,t,`${r}#frontmatter`,1)},Ne=e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:typeof e=="string"?e!=="false"&&e!=="0":!0,Fe=(e,t)=>{const r=I(e,L),n=X(r);if(!n||typeof n!="object")throw new Error(`${r}: must contain a YAML mapping`);const i={};if(n.variables)for(const[a,c]of Object.entries(n.variables))i[a]=Me(c);const o=new Map,s=[];for(const a of K(e,{includeDirs:!1,includeSymlinks:!1})){if(a.path===r)continue;const c=U(e,a.path).replaceAll("\\","/");if(c===L)continue;if(be(c)){const f=b(a.path),d=Ce(f,c);for(const u of ze(c))o.has(u)&&o.get(u)!==d&&Z.warn(`partial name "${u}" is declared by multiple files — last one wins. Use distinct names or fully-qualified includes.`),o.set(u,d);continue}if(c.endsWith(Oe)){const f=b(a.path);s.push({binary:null,isRaw:!0,rawText:f,relativePath:c});continue}if(Le(c)){const f=b(a.path);s.push({binary:null,isRaw:!1,rawText:f,relativePath:c});continue}const p=b(a.path,{buffer:!0});s.push({binary:p,isRaw:!1,rawText:null,relativePath:c})}const l=a=>{const c={...a.builtins,...a.options},p={},f={};for(const u of s){const y=u.relativePath;let w,C,O=!1;if(u.binary)w=u.binary;else if(u.isRaw)w=u.rawText??"";else{const V=u.rawText??"",h=Ee(V,H=>Q(H));if(h.frontmatter){if(h.frontmatter.skip!==void 0&&M(h.frontmatter.skip,c,y)||h.frontmatter.if!==void 0&&!M(h.frontmatter.if,c,y))continue;typeof h.frontmatter.to=="string"&&(C=j(h.frontmatter.to,{filename:`${y}#frontmatter.to`,partials:o,scope:c})),h.frontmatter.force===!0&&(O=!0)}w=j(h.body,{filename:y,partials:o,scope:c})}const W=Ue(C??ge(we(y),c));Ie(p,W,w),O&&(f[W]={force:!0})}const d={files:p};return Object.keys(f).length>0&&(d.filesMeta=f),d};return{about:{description:n.description??`Moon-format template at ${e}`,name:n.title??t},destination:n.destination,options:i,produce:l}},ze=e=>{const t=P(e),r=J(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]};export{Fe as loadMoonTemplate};
7
+ `&&(n+=1)};for(const o of e.matchAll(ve)){const s=o.index??0;if(s>r){const c=e.slice(r,s);t.push({line:n,type:"text",value:c}),i(c)}const l=n,a=o[0];a.startsWith("{{")?t.push({line:l,type:"expr",value:(o[1]??"").trim()}):t.push({line:l,type:"stmt",value:(o[2]??"").trim()}),i(a),r=s+a.length}if(r<e.length){const o=e.slice(r);t.push({line:n,type:"text",value:o})}return t},Ae=new Set(["block","endblock","endfilter","endmacro","extends","filter","import","macro","set"]),F=(e,t)=>{let r=0;const n=(o,s)=>{throw new Error(`${t}:${o}: ${s}`)},i=o=>{const s=[];for(;r<e.length;){const l=e[r];if(l.type==="text"){s.push({type:"text",value:l.value}),r+=1;continue}if(l.type==="expr"){s.push({expression:l.value,line:l.line,type:"expr"}),r+=1;continue}const a=l.value.split(/\s+/)[0]??"";if(o.includes(a))return s;if(Ae.has(a)&&n(l.line,`Tera feature "{% ${a} %}" is not supported. Supported: if/else/endif, for/endfor, include. Rewrite the template to avoid macros, set, extends, block, and import.`),a==="if"){r+=1;const c=l.value.slice(2).trim(),p=i(["else","endif"]);let f;r<e.length&&e[r].type==="stmt"&&e[r].value.split(/\s+/)[0]==="else"&&(r+=1,f=i(["endif"])),(r>=e.length||e[r].type!=="stmt"||e[r].value.split(/\s+/)[0]!=="endif")&&n(l.line,"Unterminated {% if %} — missing {% endif %}"),r+=1,s.push({alternate:f,condition:c,consequent:p,line:l.line,type:"if"});continue}if(a==="for"){r+=1;const c=l.value.slice(3).trim(),p=c.indexOf(" in ");p===-1&&n(l.line,"Malformed {% for %} — expected `for <name> in <collection>`");const f=c.slice(0,p).trim(),d=c.slice(p+4).trim();(!f||!d)&&n(l.line,"Malformed {% for %} — missing binding or collection");const u=i(["endfor"]);(r>=e.length||e[r].type!=="stmt"||e[r].value.split(/\s+/)[0]!=="endfor")&&n(l.line,"Unterminated {% for %} — missing {% endfor %}"),r+=1,s.push({binding:f,body:u,collection:d,line:l.line,type:"for"});continue}if(a==="include"){r+=1;const c=l.value.slice(7).trim(),p=G(c);p===void 0&&n(l.line,"Malformed {% include %} — expected a quoted partial name"),s.push({line:l.line,name:p,type:"include"});continue}n(l.line,`Unknown tag "{% ${a} %}". Supported: if, for, include.`)}return s};return i([])},G=e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},$e=e=>e==null?"":typeof e=="boolean"||typeof e=="number"?String(e):typeof e=="string"?e:JSON.stringify(e),je=e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:!0,B=(e,t,r,n,i=!0)=>{const o=e.split(".");if(i&&o.length>0&&!Object.hasOwn(t,o[0]))throw new Error(`${n}:${r}: Variable "${e}" is not defined`);let s=t;for(const l of o){if(s==null)return;if(typeof s!="object")throw new TypeError(`${n}:${r}: Cannot read "${l}" on non-object value`);s=s[l]}return s},xe=e=>{const t=[];let r=0,n=0,i;for(let o=0;o<e.length;o+=1){const s=e[o];if(i){s===i&&(i=void 0);continue}if(s==='"'||s==="'"){i=s;continue}s==="("?r+=1:s===")"?r-=1:s==="|"&&r===0&&(t.push(e.slice(n,o)),n=o+1)}return t.push(e.slice(n)),t},ke=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:R(i).map(o=>o.trim()),name:n}:{args:[],name:n}},v=(e,t,r,n,i=!0)=>{const o=e.trim();if(o==="true")return!0;if(o==="false")return!1;if(o==="null"||o==="none")return null;const s=G(o);return s!==void 0?s:/^-?\d+(?:\.\d+)?$/.test(o)?Number(o):B(o,t,r,n,i)},D=(e,t,r,n,i=!0)=>{const o=xe(e),s=o[0].trim();let l=v(s,t,r,n,i);for(let a=1;a<o.length;a+=1){const c=o[a].trim(),{args:p,name:f}=ke(c),d=p.map(u=>v(u,t,r,n,i));try{l=z(f,l,d)}catch(u){const y=u instanceof Error?u.message:String(u);throw new Error(`${n}:${r}: ${y}`,{cause:u})}}return l},Y=(e,t)=>{let r,n=0;for(let i=0;i<=e.length-t.length;i+=1){const o=e[i];if(r){o===r&&(r=void 0);continue}if(o==='"'||o==="'"){r=o;continue}if(o==="("){n+=1;continue}if(o===")"){n-=1;continue}if(n===0&&e.slice(i,i+t.length)===t)return i}return-1},_=(e,t)=>{const r=[];let n=0,i=0;for(;i<=e.length-t.length;){const o=Y(e.slice(i),t);if(o===-1)break;r.push(e.slice(n,i+o)),i+=o+t.length,n=i}return r.push(e.slice(n)),r},g=(e,t,r,n)=>{const i=e.trim();if(i==="")return!1;if(i.startsWith("(")&&i.endsWith(")")&&Se(i)===i.length-1)return g(i.slice(1,-1),t,r,n);const o=_(i," or ");if(o.length>1)return o.some(l=>g(l,t,r,n));const s=_(i," and ");if(s.length>1)return s.every(l=>g(l,t,r,n));if(i.startsWith("not "))return!g(i.slice(4),t,r,n);for(const l of["==","!="]){const a=Y(i,l);if(a!==-1){const c=v(i.slice(0,a),t,n,r,!1),p=v(i.slice(a+l.length),t,n,r,!1),f=c===p;return l==="=="?f:!f}}return je(D(i,t,n,r,!1))},Se=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},E=(e,t)=>{let r="";for(const n of e){if(n.type==="text"){r+=n.value;continue}if(n.type==="expr"){r+=$e(D(n.expression,t.scope,n.line,t.filename));continue}if(n.type==="if"){const i=g(n.condition,t.scope,t.filename,n.line)?n.consequent:n.alternate??[];r+=E(i,t);continue}if(n.type==="for"){const i=B(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 o of i){const s={...t.scope,[n.binding]:o};r+=E(n.body,{...t,scope:s})}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 o=t.includeStack??new Set;if(o.has(n.name)){const s=[...o,n.name].join(" → ");throw new Error(`${t.filename}:${n.line}: Circular partial include detected: ${s}`)}o.add(n.name);try{r+=E(i,{...t,filename:`<partial:${n.name}>`,includeStack:o})}finally{o.delete(n.name)}}}return r},Ce=(e,t)=>F(q(e),t),j=(e,t)=>E(F(q(e),t.filename),t),L="template.yml",Oe=".raw",We=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"]),Te=new Set(["Brewfile","CHANGELOG","CODEOWNERS","CONTRIBUTING","COPYING","Dockerfile","Gemfile","LICENCE","LICENSE","Makefile","NOTICE","Procfile","Rakefile","README","VERSION"]),_e=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()},J=e=>{const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)},Le=e=>{const t=_e(e);if(t!=="")return We.has(t);const r=J(e);return Te.has(r)},Me=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)}"`)}},Ue=e=>e.replaceAll("\\","/").replace(/^\.\//,"").replaceAll(/\/+/g,"/"),Ie=(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 o=0;o<n.length-1;o+=1){const s=n[o],l=i[s];if(l===void 0){const a={};i[s]=a,i=a}else if(typeof l=="object"&&!Buffer.isBuffer(l))i=l;else throw new TypeError(`Path conflict: "${n.slice(0,o+1).join("/")}" is both a file and a directory`)}i[n.at(-1)]=r},M=(e,t,r)=>{if(typeof e!="string")return Ne(e);const n=e.includes("{{")||e.includes("{%")?j(e,{filename:`${r}#frontmatter`,scope:t}):e;return g(n,t,`${r}#frontmatter`,1)},Ne=e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:typeof e=="string"?e!=="false"&&e!=="0":!0,Ge=(e,t)=>{const r=I(e,L),n=X(r);if(!n||typeof n!="object")throw new Error(`${r}: must contain a YAML mapping`);const i={};if(n.variables)for(const[a,c]of Object.entries(n.variables))i[a]=Me(c);const o=new Map,s=[];for(const a of K(e,{includeDirs:!1,includeSymlinks:!1})){if(a.path===r)continue;const c=U(e,a.path).replaceAll("\\","/");if(c===L)continue;if(be(c)){const f=b(a.path),d=Ce(f,c);for(const u of ze(c))o.has(u)&&o.get(u)!==d&&Z.warn(`partial name "${u}" is declared by multiple files — last one wins. Use distinct names or fully-qualified includes.`),o.set(u,d);continue}if(c.endsWith(Oe)){const f=b(a.path);s.push({binary:null,isRaw:!0,rawText:f,relativePath:c});continue}if(Le(c)){const f=b(a.path);s.push({binary:null,isRaw:!1,rawText:f,relativePath:c});continue}const p=b(a.path,{buffer:!0});s.push({binary:p,isRaw:!1,rawText:null,relativePath:c})}const l=a=>{const c={...a.builtins,...a.options},p={},f={};for(const u of s){const y=u.relativePath;let w,C,O=!1;if(u.binary)w=u.binary;else if(u.isRaw)w=u.rawText??"";else{const V=u.rawText??"",h=Ee(V,H=>Q(H));if(h.frontmatter){if(h.frontmatter.skip!==void 0&&M(h.frontmatter.skip,c,y)||h.frontmatter.if!==void 0&&!M(h.frontmatter.if,c,y))continue;typeof h.frontmatter.to=="string"&&(C=j(h.frontmatter.to,{filename:`${y}#frontmatter.to`,partials:o,scope:c})),h.frontmatter.force===!0&&(O=!0)}w=j(h.body,{filename:y,partials:o,scope:c})}const W=Ue(C??ge(we(y),c));Ie(p,W,w),O&&(f[W]={force:!0})}const d={files:p};return Object.keys(f).length>0&&(d.filesMeta=f),d};return{about:{description:n.description??`Moon-format template at ${e}`,name:n.title??t},destination:n.destination,options:i,produce:l}},ze=e=>{const t=P(e),r=J(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]};export{Ge as loadMoonTemplate};
@@ -1,4 +1,4 @@
1
- import{p as r}from"./cli-main.js";import{c as i,f as a}from"../packem_shared/registry-keys-D4chF-Wj.js";const n=async({options:s})=>{if(s.clear){const t=i();if(s.json){process.stdout.write(`${JSON.stringify({cleared:t,refetched:!1},void 0,2)}
1
+ import{p as r}from"./cli-main.js";import{c as i,f as a}from"../packem_shared/registry-keys-BEavOCPz.js";const n=async({options:s})=>{if(s.clear){const t=i();if(s.json){process.stdout.write(`${JSON.stringify({cleared:t,refetched:!1},void 0,2)}
2
2
  `);return}r.success(t?"Cleared cached npm signing keys.":"No cached npm signing keys to clear.");return}const e=await a({forceRefresh:!0});if(e===void 0){if(s.json){process.stdout.write(`${JSON.stringify({cleared:!1,error:"fetch-failed",refetched:!1},void 0,2)}
3
3
  `),process.exitCode=1;return}r.error("Failed to fetch npm signing keys (network error and no cached keys available)."),process.exitCode=1;return}if(s.json){process.stdout.write(`${JSON.stringify({cleared:!1,fromCache:e.fromCache,keyCount:e.keys.length,refetched:!e.fromCache,stale:e.stale??!1},void 0,2)}
4
4
  `);return}if(e.fromCache&&e.stale===!0){r.warn(`Network fetch failed — falling back to expired cache (${String(e.keys.length)} keys).`);return}r.success(`Refreshed npm signing keys (${String(e.keys.length)} keys).`)};export{n as default};
@@ -1,3 +1,3 @@
1
- import{createRequire as _}from"node:module";import{ad as x,p as o,ae as B}from"./cli-main.js";import{w as R}from"../packem_shared/pm-runner-Dws_Bw1y.js";import{W as V}from"../packem_shared/build-scripts-Doxce2VM.js";import{m as y,f as w}from"../packem_shared/index-OQZQyN5R.js";import{a as W}from"../packem_shared/readJsonSync-CvkZyKmL-CY7PZob_.js";const j=_(import.meta.url),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=c=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[r,f]=v.versions.node.split(".").map(Number);if(r>22||r===22&&f>=3||r===20&&f>=16)return v.getBuiltinModule(c)}return j(c)},{readdirSync:S,statSync:M}=D("node:fs"),q=(c,r={})=>{const f=y(c,"node_modules");if(!w(f))return[];const l=new Map,p=new Set,$=(n,s,t)=>{const e=`${s}@${t}`;if(p.has(e))return;p.add(e);const i=t.startsWith(c)?t.slice(c.length+1):t;let u=l.get(n);u||(u=[],l.set(n,u)),u.some(b=>b.name===s)||u.push({name:s,relativePath:i})},d=(n,s="")=>{let t;try{t=S(n)}catch{return}for(const e of t){const i=y(n,e);if(e.startsWith("@")){d(i,`${e}/`);continue}if(e===".pnpm"&&s===""){let a;try{a=S(i)}catch{continue}for(const m of a){const h=y(i,m,"node_modules");w(h)&&d(h)}continue}if(e.startsWith("."))continue;const u=s+e,b=y(i,"package.json");try{if(!M(i).isDirectory()||!w(b))continue;const a=W(b),m=typeof a.name=="string"?a.name:u;if(typeof a.bin=="string"){const k=m.includes("/")?m.split("/").pop():m;$(k,m,i)}else if(a.bin&&typeof a.bin=="object")for(const k of Object.keys(a.bin))$(k,m,i);const h=y(i,"node_modules");w(h)&&d(h)}catch{}}};d(f);const g=[];for(const[n,s]of l)s.length<2||r[n]===!0||s.every(t=>r[`${t.name}#${n}`]===!0)||g.push({bin:n,packages:s});return g.sort((n,s)=>n.bin.localeCompare(s.bin))},C=new Set(["bun","npm","pnpm","yarn"]),J=({options:c,visConfig:r,workspaceRoot:f})=>{const l=f??process.cwd(),p=R(l),$=r?.security?.policies?.installScripts?.allow??{},d=r?.security?.allowBins??{},g=r?.security?.pinVersions===!0,n=V(l,$,{pinVersions:g}),s=q(l,d),t=r&&C.has(p.name)?x(r,p.name,l):void 0;if(c.json){process.stdout.write(`${JSON.stringify({binConflicts:s,drift:t,excess:n.excess,installed:n.installed.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),packageManager:p.name,pinVersions:g,unapproved:n.unapproved.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),versionDrift:n.versionDrift},void 0,2)}
1
+ import{createRequire as _}from"node:module";import{h as x,p as o,v as B}from"./cli-main.js";import{w as R}from"../packem_shared/pm-runner-CIH0wPh-.js";import{W as V}from"../packem_shared/build-scripts-Doxce2VM.js";import{m as y,f as w}from"../packem_shared/index-OQZQyN5R.js";import{a as W}from"../packem_shared/readJsonSync-CvkZyKmL-CY7PZob_.js";const j=_(import.meta.url),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=c=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[r,f]=v.versions.node.split(".").map(Number);if(r>22||r===22&&f>=3||r===20&&f>=16)return v.getBuiltinModule(c)}return j(c)},{readdirSync:S,statSync:M}=D("node:fs"),q=(c,r={})=>{const f=y(c,"node_modules");if(!w(f))return[];const l=new Map,p=new Set,$=(n,s,t)=>{const e=`${s}@${t}`;if(p.has(e))return;p.add(e);const i=t.startsWith(c)?t.slice(c.length+1):t;let u=l.get(n);u||(u=[],l.set(n,u)),u.some(b=>b.name===s)||u.push({name:s,relativePath:i})},d=(n,s="")=>{let t;try{t=S(n)}catch{return}for(const e of t){const i=y(n,e);if(e.startsWith("@")){d(i,`${e}/`);continue}if(e===".pnpm"&&s===""){let a;try{a=S(i)}catch{continue}for(const m of a){const h=y(i,m,"node_modules");w(h)&&d(h)}continue}if(e.startsWith("."))continue;const u=s+e,b=y(i,"package.json");try{if(!M(i).isDirectory()||!w(b))continue;const a=W(b),m=typeof a.name=="string"?a.name:u;if(typeof a.bin=="string"){const k=m.includes("/")?m.split("/").pop():m;$(k,m,i)}else if(a.bin&&typeof a.bin=="object")for(const k of Object.keys(a.bin))$(k,m,i);const h=y(i,"node_modules");w(h)&&d(h)}catch{}}};d(f);const g=[];for(const[n,s]of l)s.length<2||r[n]===!0||s.every(t=>r[`${t.name}#${n}`]===!0)||g.push({bin:n,packages:s});return g.sort((n,s)=>n.bin.localeCompare(s.bin))},C=new Set(["bun","npm","pnpm","yarn"]),J=({options:c,visConfig:r,workspaceRoot:f})=>{const l=f??process.cwd(),p=R(l),$=r?.security?.policies?.installScripts?.allow??{},d=r?.security?.allowBins??{},g=r?.security?.pinVersions===!0,n=V(l,$,{pinVersions:g}),s=q(l,d),t=r&&C.has(p.name)?x(r,p.name,l):void 0;if(c.json){process.stdout.write(`${JSON.stringify({binConflicts:s,drift:t,excess:n.excess,installed:n.installed.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),packageManager:p.name,pinVersions:g,unapproved:n.unapproved.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),versionDrift:n.versionDrift},void 0,2)}
2
2
  `);return}if(o.info(`Build-script status (${p.name}):
3
3
  `),n.installed.length===0&&n.unapproved.length===0&&o.success(" No installed packages declare lifecycle scripts."),n.installed.length>0){o.success(` Approved (${String(n.installed.length)}):`);for(const e of n.installed)o.info(` ✓ ${e.name} — ${e.hooks.join(", ")}`)}if(n.unapproved.length>0){o.info(""),o.warn(` Unapproved (${String(n.unapproved.length)}):`);for(const e of n.unapproved)o.info(` ✗ ${e.name} — ${e.hooks.join(", ")}`);o.notice(" Run 'vis approve-builds' to review.")}if(n.excess.length>0){o.info(""),o.warn(` Stale allowlist entries (${String(n.excess.length)}):`);for(const e of n.excess)o.info(` ! ${e}`);o.notice(" Remove these from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){o.info(""),o.warn(` Version drift (pinVersions: true) — ${String(n.versionDrift.length)} entr${n.versionDrift.length===1?"y":"ies"} point at outdated versions:`);for(const{from:e,to:i}of n.versionDrift)o.info(` ${e} → ${i}`);o.notice(" Update vis.config.ts security.policies.installScripts.allow keys to migrate.")}if(s.length>0){o.info(""),o.warn(` Bin conflicts (${String(s.length)}) — multiple packages expose the same bin name:`);for(const e of s)o.info(` ${e.bin} ← ${e.packages.map(i=>i.name).join(", ")}`);o.notice(" Add the bin (or 'pkg#bin') to vis.config.ts security.allowBins to silence this.")}if(t?.hasDrift){o.info("");for(const e of B(t))o.warn(e)}};export{J as default};
@@ -1,4 +1,4 @@
1
- import{createRequire as m}from"node:module";import{w as d,M as _}from"../packem_shared/pm-runner-Dws_Bw1y.js";const w=m(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,r]=o.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return o.getBuiltinModule(e)}return w(e)},{createInterface:y}=g("node:readline"),s="sigstore",$=()=>!!process.stdout.isTTY&&process.env.CI!=="true",v=e=>new Promise(t=>{const r=y({input:process.stdin,output:process.stderr});r.question(`${e} (Y/n) `,i=>{r.close();const n=i.trim().toLowerCase();t(n===""||n==="y"||n==="yes")})}),h=e=>{const t=d(e),r=_(t,{exact:!1,filter:[],global:!1,optional:!1,packages:[s],peer:!1,saveDev:!0,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:r})},R=()=>{try{return import.meta.resolve(s),!0}catch{return!1}},I=e=>{let t="pnpm";try{t=d(e).name}catch{}switch(t){case"bun":return`bun add -d ${s}`;case"npm":return`npm install -D ${s}`;case"yarn":return`yarn add -D ${s}`;default:return`pnpm add -D ${s}`}},D=()=>import("sigstore"),T=async(e={})=>{const t=e.interactive??$(),r=e.prompt??v,i=e.runInstall??h,n=e.importImpl??D,l=e.workspaceRoot??process.cwd(),a=I(l);try{return await n()}catch(p){const{code:u,message:f}=p;if(!(u==="ERR_MODULE_NOT_FOUND"||u==="MODULE_NOT_FOUND")||!f.includes(s))throw p}if(!t)throw new Error(`${s} is not installed. \`vis attest\` needs it for keyless signing/verification. Install it in your repo first:
1
+ import{createRequire as m}from"node:module";import{w as d,M as _}from"../packem_shared/pm-runner-CIH0wPh-.js";const w=m(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,r]=o.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return o.getBuiltinModule(e)}return w(e)},{createInterface:y}=g("node:readline"),s="sigstore",$=()=>!!process.stdout.isTTY&&process.env.CI!=="true",v=e=>new Promise(t=>{const r=y({input:process.stdin,output:process.stderr});r.question(`${e} (Y/n) `,i=>{r.close();const n=i.trim().toLowerCase();t(n===""||n==="y"||n==="yes")})}),h=e=>{const t=d(e),r=_(t,{exact:!1,filter:[],global:!1,optional:!1,packages:[s],peer:!1,saveDev:!0,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:r})},R=()=>{try{return import.meta.resolve(s),!0}catch{return!1}},I=e=>{let t="pnpm";try{t=d(e).name}catch{}switch(t){case"bun":return`bun add -d ${s}`;case"npm":return`npm install -D ${s}`;case"yarn":return`yarn add -D ${s}`;default:return`pnpm add -D ${s}`}},D=()=>import("sigstore"),T=async(e={})=>{const t=e.interactive??$(),r=e.prompt??v,i=e.runInstall??h,n=e.importImpl??D,l=e.workspaceRoot??process.cwd(),a=I(l);try{return await n()}catch(p){const{code:u,message:f}=p;if(!(u==="ERR_MODULE_NOT_FOUND"||u==="MODULE_NOT_FOUND")||!f.includes(s))throw p}if(!t)throw new Error(`${s} is not installed. \`vis attest\` needs it for keyless signing/verification. Install it in your repo first:
2
2
  ${a}`);if(!await r(`${s} isn't installed. Install it now?`))throw new Error(`${s} install declined. Re-run \`vis attest\` after installing manually:
3
3
  ${a}`);const c=await i(l);if(c.exitCode!==0)throw new Error(`Install of ${s} failed (exit ${String(c.exitCode)}). Install manually and retry:
4
4
  ${a}`);return await n()};export{I as installCommandFor,R as isSigstoreInstalled,T as loadOptionalSigstore};