@visulima/vis 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/bin.js +1 -1
- package/dist/binx.js +2 -2
- package/dist/packem_chunks/CONFIG_FILES.js +1 -1
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +52 -52
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +216 -217
- package/dist/packem_chunks/dispatch.js +1 -1
- package/dist/packem_chunks/doctor-probe.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/group-tags.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler22.js +1 -1
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler26.js +1 -1
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +3 -3
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +2 -2
- package/dist/packem_chunks/handler51.js +1 -1
- package/dist/packem_chunks/handler53.js +1 -1
- package/dist/packem_chunks/handler54.js +1 -1
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler58.js +4 -4
- package/dist/packem_chunks/handler59.js +1 -1
- package/dist/packem_chunks/handler6.js +7 -7
- package/dist/packem_chunks/handler60.js +2 -2
- package/dist/packem_chunks/handler61.js +1 -1
- package/dist/packem_chunks/handler62.js +2 -2
- package/dist/packem_chunks/handler63.js +3 -3
- package/dist/packem_chunks/handler64.js +3 -3
- package/dist/packem_chunks/handler66.js +1 -1
- package/dist/packem_chunks/handler67.js +13 -13
- package/dist/packem_chunks/handler68.js +4 -4
- package/dist/packem_chunks/handler69.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +4 -4
- package/dist/packem_chunks/handler71.js +1 -1
- package/dist/packem_chunks/handler72.js +14 -14
- package/dist/packem_chunks/handler73.js +1 -1
- package/dist/packem_chunks/handler74.js +12 -12
- package/dist/packem_chunks/handler75.js +1 -1
- package/dist/packem_chunks/handler76.js +1 -1
- package/dist/packem_chunks/handler77.js +21 -21
- package/dist/packem_chunks/handler78.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +17 -17
- package/dist/packem_chunks/index3.js +2 -2
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/orchestrator.js +1 -1
- package/dist/packem_chunks/prompts.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/ts-loader.js +9 -22
- package/dist/packem_chunks/verify-lockfile.js +2 -2
- package/dist/packem_chunks/version-resolver.js +1 -1
- package/dist/packem_shared/{affected-shas-BfO3PDJq.js → affected-shas-DkrQVQla.js} +1 -1
- package/dist/packem_shared/{ai-analysis-CO7No4rt.js → ai-analysis-DWBi9tSU.js} +3 -3
- package/dist/packem_shared/{ai-fix-B4u2zlVG.js → ai-fix-BocGeQu4.js} +1 -1
- package/dist/packem_shared/{augment-8z86AwtF.js → augment-BIUGEy1Q.js} +1 -1
- package/dist/packem_shared/bin-CMAImDGD.js +1 -0
- package/dist/packem_shared/{build-scripts-D477Ou-x.js → build-scripts-CpTeQE1L.js} +1 -1
- package/dist/packem_shared/clean-DWjQl14S.js +1 -0
- package/dist/packem_shared/{command-runtime-EWjmSxPj.js → command-runtime-Buz4F5LM.js} +1 -1
- package/dist/packem_shared/{cyclonedx-CDWHbD9s.js → cyclonedx-C96cm9hF.js} +1 -1
- package/dist/packem_shared/dependency-scan-I_UnVof_.js +1 -0
- package/dist/packem_shared/{docker-CD7o1D1o.js → docker-B2h5KRZH.js} +41 -41
- package/dist/packem_shared/{env-Cpxa_7UE.js → en-BRcjb70R.js} +11 -11
- package/dist/packem_shared/failure-log-C3c5AVfc.js +2 -0
- package/dist/packem_shared/glob-DMbPwGSj-DFkUYBco.js +1 -0
- package/dist/packem_shared/index-BAe6e0XE.js +1 -0
- package/dist/packem_shared/{index-CnEiZmdX.js → index-BtpMNLKq.js} +3 -3
- package/dist/packem_shared/index-D75r1yKp.js +35 -0
- package/dist/packem_shared/{index-CdTXvj-V.js → index-Ro_3oUtR.js} +1 -1
- package/dist/packem_shared/{index.server-J83sowC4.js → index.server-qvZ-cy29.js} +2 -2
- package/dist/packem_shared/{lifecycle-hzwghh5a.js → lifecycle-CG0Ccu4h.js} +1 -1
- package/dist/packem_shared/{lockfile-CWcVTdRc.js → lockfile-D_JiWcwS.js} +1 -1
- package/dist/packem_shared/{manifests-CaPqgQxW.js → manifests-mFrrpzXW.js} +1 -1
- package/dist/packem_shared/{min-release-age-skpcnlpk.js → min-release-age-Cdh1dLz1.js} +1 -1
- package/dist/packem_shared/{missing-package-json-_hOp4AW5.js → missing-package-json-sYPP3cm-.js} +1 -1
- package/dist/packem_shared/{native-config-sync-CFi1iQNG.js → native-config-sync-DW8549FX.js} +2 -2
- package/dist/packem_shared/package-version-gyjskW3N.js +4 -0
- package/dist/packem_shared/packument-BFekEvwn.js +1 -0
- package/dist/packem_shared/{pm-runner-mVFjedM6.js → pm-runner-D5NWL8yv.js} +1 -1
- package/dist/packem_shared/{provenance-CI_WQx7G.js → provenance-ByHgofYo.js} +1 -1
- package/dist/packem_shared/{readJsonSync-DuMMeB3s-Cx08VBQg.js → readJsonSync-DuMMeB3s-wlhgSHes.js} +1 -1
- package/dist/packem_shared/registry-keys-BCD7Ir8g.js +1 -0
- package/dist/packem_shared/{resolve-explicit-DVE9cfkm.js → resolve-explicit-CnEsy-zC.js} +1 -1
- package/dist/packem_shared/{resolve-runtime-CGHf-wHz.js → resolve-runtime-Z2n59SEd.js} +1 -1
- package/dist/packem_shared/{run-file-Bs_E9O6O.js → run-file-u9hMNu8K.js} +1 -1
- package/dist/packem_shared/{runtime-check-pS2XH4BO.js → runtime-check-B1OF152E.js} +1 -1
- package/dist/packem_shared/s1ngularity-DkNDQiKU.js +1 -0
- package/dist/packem_shared/scan-progress-CHdHWhVw.js +2 -0
- package/dist/packem_shared/{selectors-CRgS4bU9.js → selectors-DiZWa7R4.js} +1 -1
- package/dist/packem_shared/{signatures-Dp3th1DB.js → signatures-kvrwi3Un.js} +1 -1
- package/dist/packem_shared/{target-options-TM6ETDAS.js → target-options-BJIDkfDf.js} +1 -1
- package/dist/packem_shared/{toolchain-B5KwUZfq.js → toolchain-CAbopPwK.js} +1 -1
- package/dist/packem_shared/{typosquats-C0layQsP.js → typosquats-DWB80Gyv.js} +1 -1
- package/dist/packem_shared/use-measured-height-C4jA0yNy.js +1 -0
- package/dist/packem_shared/verify-BajubByH.js +1 -0
- package/dist/packem_shared/vis-update-app-M3dw6XRC.js +1 -0
- package/dist/packem_shared/{watch-BnE1TzYn.js → watch-B8WT65yN.js} +1 -1
- package/dist/packem_shared/{watch-loop-Irf3Pm-1.js → watch-loop-CZazUnGB.js} +1 -1
- package/dist/runtime/preload.js +1 -1
- package/index.js +26 -26
- package/package.json +10 -10
- package/dist/packem_shared/bin-Cv8vsMEo.js +0 -1
- package/dist/packem_shared/dependency-scan-P52jY0pU.js +0 -1
- package/dist/packem_shared/failure-log-MOhz-TBv.js +0 -2
- package/dist/packem_shared/glob-DMbPwGSj-uzODoE-1.js +0 -1
- package/dist/packem_shared/index-BAUIIRZJ.js +0 -1
- package/dist/packem_shared/index-BVuCxe14.js +0 -22
- package/dist/packem_shared/packument-CYxvm590.js +0 -1
- package/dist/packem_shared/registry-keys-AGlSEY6R.js +0 -1
- package/dist/packem_shared/runtime-process-Dmz0vCJy-DUwTvH1J.js +0 -1
- package/dist/packem_shared/s1ngularity-xmrq5T5r.js +0 -1
- package/dist/packem_shared/scan-progress-DQ4TMXcb.js +0 -2
- package/dist/packem_shared/use-measured-height-Drobr4fe.js +0 -1
- package/dist/packem_shared/verify-Cjo4EBFZ.js +0 -1
- package/dist/packem_shared/vis-update-app-qIkyvrd1.js +0 -1
|
@@ -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-BVuCxe14.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{aq as ks,ar 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-DuMMeB3s-Cx08VBQg.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-qvZ-cy29.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-D75r1yKp.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{an as ks,ao 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-DuMMeB3s-wlhgSHes.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,"&"),e=e.replace(/</g,"<"),e=e.replace(/>/g,">"),e=e.replace(/"/g,"""),e=e.replace(/'/g,"'"),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{createRequire as p}from"node:module";import{m as u,f as _,I as $}from"../packem_shared/index-
|
|
1
|
+
import{createRequire as p}from"node:module";import{m as u,f as _,I as $}from"../packem_shared/index-D75r1yKp.js";import{cleanWorkspace as R}from"#native";import{l as b}from"../packem_shared/missing-package-json-sYPP3cm-.js";import{p as c}from"./cli-main.js";import{o as j}from"../packem_shared/utils-CRueU43T.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{h as t,M as l}from"../packem_shared/pm-runner-
|
|
1
|
+
import{h as t,M as l}from"../packem_shared/pm-runner-D5NWL8yv.js";import{r as p,a as m}from"../packem_shared/command-runtime-Buz4F5LM.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-
|
|
1
|
+
import{createRequire as G}from"node:module";import{B as y,y as N}from"../packem_shared/index-D75r1yKp.js";import{d as O,k as U,P as H,R as F,p as P}from"./heal.js";import{A as D,j as S}from"../packem_shared/pm-runner-D5NWL8yv.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-
|
|
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-qvZ-cy29.js";import{y as A}from"../packem_shared/index-D75r1yKp.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-BocGeQu4.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(`
|