UNPKG

@lenml/tokenizers

Version:

a lightweight no-dependency fork of transformers.js (only tokenizers)

3 lines 101 kB
var ku=Object.create;var ke=Object.defineProperty;var Eu=Object.getOwnPropertyDescriptor;var Su=Object.getOwnPropertyNames;var Ou=Object.getPrototypeOf,qu=Object.prototype.hasOwnProperty;var Au=(n,e,t)=>e in n?ke(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var o=(n,e)=>ke(n,"name",{value:e,configurable:!0});var d=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Cu=(n,e)=>{for(var t in e)ke(n,t,{get:e[t],enumerable:!0})},Iu=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Su(e))!qu.call(n,s)&&s!==t&&ke(n,s,{get:()=>e[s],enumerable:!(r=Eu(e,s))||r.enumerable});return n};var ju=(n,e,t)=>(t=n!=null?ku(Ou(n)):{},Iu(e||!n||!n.__esModule?ke(t,"default",{value:n,enumerable:!0}):t,n));var g=(n,e,t)=>(Au(n,typeof e!="symbol"?e+"":e,t),t);var F=d((Kr,jo)=>{"use strict";var Ee=o(function(n){return n&&n.Math===Math&&n},"check");jo.exports=Ee(typeof globalThis=="object"&&globalThis)||Ee(typeof window=="object"&&window)||Ee(typeof self=="object"&&self)||Ee(typeof global=="object"&&global)||Ee(typeof Kr=="object"&&Kr)||function(){return this}()||Function("return this")()});var W=d((A_,Mo)=>{"use strict";Mo.exports=function(n){try{return!!n()}catch{return!0}}});var te=d((C_,No)=>{"use strict";var Mu=W();No.exports=!Mu(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Wr=d((I_,To)=>{"use strict";var Nu=W();To.exports=!Nu(function(){var n=function(){}.bind();return typeof n!="function"||n.hasOwnProperty("prototype")})});var yt=d((j_,$o)=>{"use strict";var Tu=Wr(),mt=Function.prototype.call;$o.exports=Tu?mt.bind(mt):function(){return mt.apply(mt,arguments)}});var Fo=d(Bo=>{"use strict";var Po={}.propertyIsEnumerable,Ro=Object.getOwnPropertyDescriptor,$u=Ro&&!Po.call({1:2},1);Bo.f=$u?o(function(e){var t=Ro(this,e);return!!t&&t.enumerable},"propertyIsEnumerable"):Po});var Gr=d((T_,Lo)=>{"use strict";Lo.exports=function(n,e){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:e}}});var L=d(($_,Do)=>{"use strict";var Uo=Wr(),Vo=Function.prototype,Jr=Vo.call,Pu=Uo&&Vo.bind.bind(Jr,Jr);Do.exports=Uo?Pu:function(n){return function(){return Jr.apply(n,arguments)}}});var Yr=d((P_,Ko)=>{"use strict";var zo=L(),Ru=zo({}.toString),Bu=zo("".slice);Ko.exports=function(n){return Bu(Ru(n),8,-1)}});var Go=d((R_,Wo)=>{"use strict";var Fu=L(),Lu=W(),Uu=Yr(),Hr=Object,Vu=Fu("".split);Wo.exports=Lu(function(){return!Hr("z").propertyIsEnumerable(0)})?function(n){return Uu(n)==="String"?Vu(n,""):Hr(n)}:Hr});var Zr=d((B_,Jo)=>{"use strict";Jo.exports=function(n){return n==null}});var Xr=d((F_,Yo)=>{"use strict";var Du=Zr(),zu=TypeError;Yo.exports=function(n){if(Du(n))throw new zu("Can't call method on "+n);return n}});var _e=d((L_,Ho)=>{"use strict";var Ku=Go(),Wu=Xr();Ho.exports=function(n){return Ku(Wu(n))}});var z=d((U_,Zo)=>{"use strict";var Qr=typeof document=="object"&&document.all;Zo.exports=typeof Qr>"u"&&Qr!==void 0?function(n){return typeof n=="function"||n===Qr}:function(n){return typeof n=="function"}});var ve=d((V_,Xo)=>{"use strict";var Gu=z();Xo.exports=function(n){return typeof n=="object"?n!==null:Gu(n)}});var xt=d((D_,Qo)=>{"use strict";var en=F(),Ju=z(),Yu=o(function(n){return Ju(n)?n:void 0},"aFunction");Qo.exports=function(n,e){return arguments.length<2?Yu(en[n]):en[n]&&en[n][e]}});var ta=d((K_,ea)=>{"use strict";var Hu=L();ea.exports=Hu({}.isPrototypeOf)});var Se=d((W_,sa)=>{"use strict";var Zu=F(),ra=Zu.navigator,na=ra&&ra.userAgent;sa.exports=na?String(na):""});var rn=d((G_,ua)=>{"use strict";var ca=F(),tn=Se(),ia=ca.process,oa=ca.Deno,aa=ia&&ia.versions||oa&&oa.version,la=aa&&aa.v8,G,bt;la&&(G=la.split("."),bt=G[0]>0&&G[0]<4?1:+(G[0]+G[1]));!bt&&tn&&(G=tn.match(/Edge\/(\d+)/),(!G||G[1]>=74)&&(G=tn.match(/Chrome\/(\d+)/),G&&(bt=+G[1])));ua.exports=bt});var nn=d((J_,pa)=>{"use strict";var ha=rn(),Xu=W(),Qu=F(),eh=Qu.String;pa.exports=!!Object.getOwnPropertySymbols&&!Xu(function(){var n=Symbol("symbol detection");return!eh(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&ha&&ha<41})});var sn=d((Y_,fa)=>{"use strict";var th=nn();fa.exports=th&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var on=d((H_,da)=>{"use strict";var rh=xt(),nh=z(),sh=ta(),ih=sn(),oh=Object;da.exports=ih?function(n){return typeof n=="symbol"}:function(n){var e=rh("Symbol");return nh(e)&&sh(e.prototype,oh(n))}});var an=d((Z_,_a)=>{"use strict";var ah=String;_a.exports=function(n){try{return ah(n)}catch{return"Object"}}});var kt=d((X_,va)=>{"use strict";var lh=z(),ch=an(),uh=TypeError;va.exports=function(n){if(lh(n))return n;throw new uh(ch(n)+" is not a function")}});var wa=d((Q_,ga)=>{"use strict";var hh=kt(),ph=Zr();ga.exports=function(n,e){var t=n[e];return ph(t)?void 0:hh(t)}});var ya=d((ev,ma)=>{"use strict";var ln=yt(),cn=z(),un=ve(),fh=TypeError;ma.exports=function(n,e){var t,r;if(e==="string"&&cn(t=n.toString)&&!un(r=ln(t,n))||cn(t=n.valueOf)&&!un(r=ln(t,n))||e!=="string"&&cn(t=n.toString)&&!un(r=ln(t,n)))return r;throw new fh("Can't convert object to primitive value")}});var ba=d((tv,xa)=>{"use strict";xa.exports=!1});var Et=d((rv,Ea)=>{"use strict";var ka=F(),dh=Object.defineProperty;Ea.exports=function(n,e){try{dh(ka,n,{value:e,configurable:!0,writable:!0})}catch{ka[n]=e}return e}});var St=d((nv,qa)=>{"use strict";var _h=ba(),vh=F(),gh=Et(),Sa="__core-js_shared__",Oa=qa.exports=vh[Sa]||gh(Sa,{});(Oa.versions||(Oa.versions=[])).push({version:"3.38.1",mode:_h?"pure":"global",copyright:"\xA9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE",source:"https://github.com/zloirock/core-js"})});var hn=d((sv,Ca)=>{"use strict";var Aa=St();Ca.exports=function(n,e){return Aa[n]||(Aa[n]=e||{})}});var pn=d((iv,Ia)=>{"use strict";var wh=Xr(),mh=Object;Ia.exports=function(n){return mh(wh(n))}});var ie=d((ov,ja)=>{"use strict";var yh=L(),xh=pn(),bh=yh({}.hasOwnProperty);ja.exports=Object.hasOwn||o(function(e,t){return bh(xh(e),t)},"hasOwn")});var fn=d((lv,Ma)=>{"use strict";var kh=L(),Eh=0,Sh=Math.random(),Oh=kh(1 .toString);Ma.exports=function(n){return"Symbol("+(n===void 0?"":n)+")_"+Oh(++Eh+Sh,36)}});var Oe=d((cv,Ta)=>{"use strict";var qh=F(),Ah=hn(),Na=ie(),Ch=fn(),Ih=nn(),jh=sn(),ge=qh.Symbol,dn=Ah("wks"),Mh=jh?ge.for||ge:ge&&ge.withoutSetter||Ch;Ta.exports=function(n){return Na(dn,n)||(dn[n]=Ih&&Na(ge,n)?ge[n]:Mh("Symbol."+n)),dn[n]}});var Ba=d((uv,Ra)=>{"use strict";var Nh=yt(),$a=ve(),Pa=on(),Th=wa(),$h=ya(),Ph=Oe(),Rh=TypeError,Bh=Ph("toPrimitive");Ra.exports=function(n,e){if(!$a(n)||Pa(n))return n;var t=Th(n,Bh),r;if(t){if(e===void 0&&(e="default"),r=Nh(t,n,e),!$a(r)||Pa(r))return r;throw new Rh("Can't convert object to primitive value")}return e===void 0&&(e="number"),$h(n,e)}});var _n=d((hv,Fa)=>{"use strict";var Fh=Ba(),Lh=on();Fa.exports=function(n){var e=Fh(n,"string");return Lh(e)?e:e+""}});var gn=d((pv,Ua)=>{"use strict";var Uh=F(),La=ve(),vn=Uh.document,Vh=La(vn)&&La(vn.createElement);Ua.exports=function(n){return Vh?vn.createElement(n):{}}});var wn=d((fv,Va)=>{"use strict";var Dh=te(),zh=W(),Kh=gn();Va.exports=!Dh&&!zh(function(){return Object.defineProperty(Kh("div"),"a",{get:function(){return 7}}).a!==7})});var mn=d(za=>{"use strict";var Wh=te(),Gh=yt(),Jh=Fo(),Yh=Gr(),Hh=_e(),Zh=_n(),Xh=ie(),Qh=wn(),Da=Object.getOwnPropertyDescriptor;za.f=Wh?Da:o(function(e,t){if(e=Hh(e),t=Zh(t),Qh)try{return Da(e,t)}catch{}if(Xh(e,t))return Yh(!Gh(Jh.f,e,t),e[t])},"getOwnPropertyDescriptor")});var yn=d((vv,Ka)=>{"use strict";var ep=te(),tp=W();Ka.exports=ep&&tp(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var qe=d((gv,Wa)=>{"use strict";var rp=ve(),np=String,sp=TypeError;Wa.exports=function(n){if(rp(n))return n;throw new sp(np(n)+" is not an object")}});var we=d(Ja=>{"use strict";var ip=te(),op=wn(),ap=yn(),Ot=qe(),Ga=_n(),lp=TypeError,xn=Object.defineProperty,cp=Object.getOwnPropertyDescriptor,bn="enumerable",kn="configurable",En="writable";Ja.f=ip?ap?o(function(e,t,r){if(Ot(e),t=Ga(t),Ot(r),typeof e=="function"&&t==="prototype"&&"value"in r&&En in r&&!r[En]){var s=cp(e,t);s&&s[En]&&(e[t]=r.value,r={configurable:kn in r?r[kn]:s[kn],enumerable:bn in r?r[bn]:s[bn],writable:!1})}return xn(e,t,r)},"defineProperty"):xn:o(function(e,t,r){if(Ot(e),t=Ga(t),Ot(r),op)try{return xn(e,t,r)}catch{}if("get"in r||"set"in r)throw new lp("Accessors not supported");return"value"in r&&(e[t]=r.value),e},"defineProperty")});var Sn=d((yv,Ya)=>{"use strict";var up=te(),hp=we(),pp=Gr();Ya.exports=up?function(n,e,t){return hp.f(n,e,pp(1,t))}:function(n,e,t){return n[e]=t,n}});var Xa=d((xv,Za)=>{"use strict";var On=te(),fp=ie(),Ha=Function.prototype,dp=On&&Object.getOwnPropertyDescriptor,qn=fp(Ha,"name"),_p=qn&&o(function(){},"something").name==="something",vp=qn&&(!On||On&&dp(Ha,"name").configurable);Za.exports={EXISTS:qn,PROPER:_p,CONFIGURABLE:vp}});var el=d((kv,Qa)=>{"use strict";var gp=L(),wp=z(),An=St(),mp=gp(Function.toString);wp(An.inspectSource)||(An.inspectSource=function(n){return mp(n)});Qa.exports=An.inspectSource});var nl=d((Ev,rl)=>{"use strict";var yp=F(),xp=z(),tl=yp.WeakMap;rl.exports=xp(tl)&&/native code/.test(String(tl))});var Cn=d((Sv,il)=>{"use strict";var bp=hn(),kp=fn(),sl=bp("keys");il.exports=function(n){return sl[n]||(sl[n]=kp(n))}});var qt=d((Ov,ol)=>{"use strict";ol.exports={}});var ul=d((qv,cl)=>{"use strict";var Ep=nl(),ll=F(),Sp=ve(),Op=Sn(),In=ie(),jn=St(),qp=Cn(),Ap=qt(),al="Object already initialized",Mn=ll.TypeError,Cp=ll.WeakMap,At,Ae,Ct,Ip=o(function(n){return Ct(n)?Ae(n):At(n,{})},"enforce"),jp=o(function(n){return function(e){var t;if(!Sp(e)||(t=Ae(e)).type!==n)throw new Mn("Incompatible receiver, "+n+" required");return t}},"getterFor");Ep||jn.state?(J=jn.state||(jn.state=new Cp),J.get=J.get,J.has=J.has,J.set=J.set,At=o(function(n,e){if(J.has(n))throw new Mn(al);return e.facade=n,J.set(n,e),e},"set"),Ae=o(function(n){return J.get(n)||{}},"get"),Ct=o(function(n){return J.has(n)},"has")):(ue=qp("state"),Ap[ue]=!0,At=o(function(n,e){if(In(n,ue))throw new Mn(al);return e.facade=n,Op(n,ue,e),e},"set"),Ae=o(function(n){return In(n,ue)?n[ue]:{}},"get"),Ct=o(function(n){return In(n,ue)},"has"));var J,ue;cl.exports={set:At,get:Ae,has:Ct,enforce:Ip,getterFor:jp}});var dl=d((Cv,fl)=>{"use strict";var Tn=L(),Mp=W(),Np=z(),It=ie(),Nn=te(),Tp=Xa().CONFIGURABLE,$p=el(),pl=ul(),Pp=pl.enforce,Rp=pl.get,hl=String,jt=Object.defineProperty,Bp=Tn("".slice),Fp=Tn("".replace),Lp=Tn([].join),Up=Nn&&!Mp(function(){return jt(function(){},"length",{value:8}).length!==8}),Vp=String(String).split("String"),Dp=fl.exports=function(n,e,t){Bp(hl(e),0,7)==="Symbol("&&(e="["+Fp(hl(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!It(n,"name")||Tp&&n.name!==e)&&(Nn?jt(n,"name",{value:e,configurable:!0}):n.name=e),Up&&t&&It(t,"arity")&&n.length!==t.arity&&jt(n,"length",{value:t.arity});try{t&&It(t,"constructor")&&t.constructor?Nn&&jt(n,"prototype",{writable:!1}):n.prototype&&(n.prototype=void 0)}catch{}var r=Pp(n);return It(r,"source")||(r.source=Lp(Vp,typeof e=="string"?e:"")),n};Function.prototype.toString=Dp(o(function(){return Np(this)&&Rp(this).source||$p(this)},"toString"),"toString")});var vl=d((jv,_l)=>{"use strict";var zp=z(),Kp=we(),Wp=dl(),Gp=Et();_l.exports=function(n,e,t,r){r||(r={});var s=r.enumerable,i=r.name!==void 0?r.name:e;if(zp(t)&&Wp(t,i,r),r.global)s?n[e]=t:Gp(e,t);else{try{r.unsafe?n[e]&&(s=!0):delete n[e]}catch{}s?n[e]=t:Kp.f(n,e,{value:t,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return n}});var wl=d((Mv,gl)=>{"use strict";var Jp=Math.ceil,Yp=Math.floor;gl.exports=Math.trunc||o(function(e){var t=+e;return(t>0?Yp:Jp)(t)},"trunc")});var $n=d((Tv,ml)=>{"use strict";var Hp=wl();ml.exports=function(n){var e=+n;return e!==e||e===0?0:Hp(e)}});var xl=d(($v,yl)=>{"use strict";var Zp=$n(),Xp=Math.max,Qp=Math.min;yl.exports=function(n,e){var t=Zp(n);return t<0?Xp(t+e,0):Qp(t,e)}});var kl=d((Pv,bl)=>{"use strict";var ef=$n(),tf=Math.min;bl.exports=function(n){var e=ef(n);return e>0?tf(e,9007199254740991):0}});var Mt=d((Rv,El)=>{"use strict";var rf=kl();El.exports=function(n){return rf(n.length)}});var ql=d((Bv,Ol)=>{"use strict";var nf=_e(),sf=xl(),of=Mt(),Sl=o(function(n){return function(e,t,r){var s=nf(e),i=of(s);if(i===0)return!n&&-1;var a=sf(r,i),l;if(n&&t!==t){for(;i>a;)if(l=s[a++],l!==l)return!0}else for(;i>a;a++)if((n||a in s)&&s[a]===t)return n||a||0;return!n&&-1}},"createMethod");Ol.exports={includes:Sl(!0),indexOf:Sl(!1)}});var Rn=d((Lv,Cl)=>{"use strict";var af=L(),Pn=ie(),lf=_e(),cf=ql().indexOf,uf=qt(),Al=af([].push);Cl.exports=function(n,e){var t=lf(n),r=0,s=[],i;for(i in t)!Pn(uf,i)&&Pn(t,i)&&Al(s,i);for(;e.length>r;)Pn(t,i=e[r++])&&(~cf(s,i)||Al(s,i));return s}});var Nt=d((Uv,Il)=>{"use strict";Il.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Ml=d(jl=>{"use strict";var hf=Rn(),pf=Nt(),ff=pf.concat("length","prototype");jl.f=Object.getOwnPropertyNames||o(function(e){return hf(e,ff)},"getOwnPropertyNames")});var Tl=d(Nl=>{"use strict";Nl.f=Object.getOwnPropertySymbols});var Pl=d((Kv,$l)=>{"use strict";var df=xt(),_f=L(),vf=Ml(),gf=Tl(),wf=qe(),mf=_f([].concat);$l.exports=df("Reflect","ownKeys")||o(function(e){var t=vf.f(wf(e)),r=gf.f;return r?mf(t,r(e)):t},"ownKeys")});var Fl=d((Gv,Bl)=>{"use strict";var Rl=ie(),yf=Pl(),xf=mn(),bf=we();Bl.exports=function(n,e,t){for(var r=yf(e),s=bf.f,i=xf.f,a=0;a<r.length;a++){var l=r[a];!Rl(n,l)&&!(t&&Rl(t,l))&&s(n,l,i(e,l))}}});var Ul=d((Jv,Ll)=>{"use strict";var kf=W(),Ef=z(),Sf=/#|\.prototype\./,Ce=o(function(n,e){var t=qf[Of(n)];return t===Cf?!0:t===Af?!1:Ef(e)?kf(e):!!e},"isForced"),Of=Ce.normalize=function(n){return String(n).replace(Sf,".").toLowerCase()},qf=Ce.data={},Af=Ce.NATIVE="N",Cf=Ce.POLYFILL="P";Ll.exports=Ce});var Bn=d((Hv,Vl)=>{"use strict";var Tt=F(),If=mn().f,jf=Sn(),Mf=vl(),Nf=Et(),Tf=Fl(),$f=Ul();Vl.exports=function(n,e){var t=n.target,r=n.global,s=n.stat,i,a,l,u,h,f;if(r?a=Tt:s?a=Tt[t]||Nf(t,{}):a=Tt[t]&&Tt[t].prototype,a)for(l in e){if(h=e[l],n.dontCallGetSet?(f=If(a,l),u=f&&f.value):u=a[l],i=$f(r?l:t+(s?".":"#")+l,n.forced),!i&&u!==void 0){if(typeof h==typeof u)continue;Tf(h,u)}(n.sham||u&&u.sham)&&jf(h,"sham",!0),Mf(a,l,h,n)}}});var Kl=d((Zv,zl)=>{"use strict";var Dl=an(),Pf=TypeError;zl.exports=function(n,e){if(!delete n[e])throw new Pf("Cannot delete property "+Dl(e)+" of "+Dl(n))}});var Jl=d((Xv,Gl)=>{"use strict";var Rf=Oe(),Bf=Rf("toStringTag"),Wl={};Wl[Bf]="z";Gl.exports=String(Wl)==="[object z]"});var Hl=d((Qv,Yl)=>{"use strict";var Ff=Jl(),Lf=z(),$t=Yr(),Uf=Oe(),Vf=Uf("toStringTag"),Df=Object,zf=$t(function(){return arguments}())==="Arguments",Kf=o(function(n,e){try{return n[e]}catch{}},"tryGet");Yl.exports=Ff?$t:function(n){var e,t,r;return n===void 0?"Undefined":n===null?"Null":typeof(t=Kf(e=Df(n),Vf))=="string"?t:zf?$t(e):(r=$t(e))==="Object"&&Lf(e.callee)?"Arguments":r}});var Xl=d((tg,Zl)=>{"use strict";var Wf=Hl(),Gf=String;Zl.exports=function(n){if(Wf(n)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return Gf(n)}});var ec=d((rg,Ql)=>{"use strict";var Jf=L();Ql.exports=Jf([].slice)});var nc=d((ng,rc)=>{"use strict";var tc=ec(),Yf=Math.floor,Fn=o(function(n,e){var t=n.length;if(t<8)for(var r=1,s,i;r<t;){for(i=r,s=n[r];i&&e(n[i-1],s)>0;)n[i]=n[--i];i!==r++&&(n[i]=s)}else for(var a=Yf(t/2),l=Fn(tc(n,0,a),e),u=Fn(tc(n,a),e),h=l.length,f=u.length,v=0,y=0;v<h||y<f;)n[v+y]=v<h&&y<f?e(l[v],u[y])<=0?l[v++]:u[y++]:v<h?l[v++]:u[y++];return n},"sort");rc.exports=Fn});var ic=d((ig,sc)=>{"use strict";var Hf=W();sc.exports=function(n,e){var t=[][n];return!!t&&Hf(function(){t.call(null,e||function(){return 1},1)})}});var lc=d((og,ac)=>{"use strict";var Zf=Se(),oc=Zf.match(/firefox\/(\d+)/i);ac.exports=!!oc&&+oc[1]});var uc=d((ag,cc)=>{"use strict";var Xf=Se();cc.exports=/MSIE|Trident/.test(Xf)});var fc=d((lg,pc)=>{"use strict";var Qf=Se(),hc=Qf.match(/AppleWebKit\/(\d+)\./);pc.exports=!!hc&&+hc[1]});var bc=d(()=>{"use strict";var ed=Bn(),yc=L(),td=kt(),rd=pn(),dc=Mt(),nd=Kl(),_c=Xl(),Ln=W(),sd=nc(),id=ic(),vc=lc(),od=uc(),gc=rn(),wc=fc(),oe=[],mc=yc(oe.sort),ad=yc(oe.push),ld=Ln(function(){oe.sort(void 0)}),cd=Ln(function(){oe.sort(null)}),ud=id("sort"),xc=!Ln(function(){if(gc)return gc<70;if(!(vc&&vc>3)){if(od)return!0;if(wc)return wc<603;var n="",e,t,r,s;for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(s=0;s<47;s++)oe.push({k:t+s,v:r})}for(oe.sort(function(i,a){return a.v-i.v}),s=0;s<oe.length;s++)t=oe[s].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return n!=="DGBEFHACIJK"}}),hd=ld||!cd||!ud||!xc,pd=o(function(n){return function(e,t){return t===void 0?-1:e===void 0?1:n!==void 0?+n(e,t)||0:_c(e)>_c(t)?1:-1}},"getSortCompare");ed({target:"Array",proto:!0,forced:hd},{sort:o(function(e){e!==void 0&&td(e);var t=rd(this);if(xc)return e===void 0?mc(t):mc(t,e);var r=[],s=dc(t),i,a;for(a=0;a<s;a++)a in t&&ad(r,t[a]);for(sd(r,pd(e)),i=dc(r),a=0;a<i;)t[a]=r[a++];for(;a<s;)nd(t,a++);return t},"sort")})});var Ec=d((pg,kc)=>{"use strict";var fd=Mt();kc.exports=function(n,e,t){for(var r=0,s=arguments.length>2?t:fd(e),i=new n(s);s>r;)i[r]=e[r++];return i}});var Oc=d((fg,Sc)=>{"use strict";var dd=F();Sc.exports=function(n,e){var t=dd[n],r=t&&t.prototype;return r&&r[e]}});var Ac=d((dg,qc)=>{"use strict";var _d=Rn(),vd=Nt();qc.exports=Object.keys||o(function(e){return _d(e,vd)},"keys")});var Ic=d(Cc=>{"use strict";var gd=te(),wd=yn(),md=we(),yd=qe(),xd=_e(),bd=Ac();Cc.f=gd&&!wd?Object.defineProperties:o(function(e,t){yd(e);for(var r=xd(t),s=bd(t),i=s.length,a=0,l;i>a;)md.f(e,l=s[a++],r[l]);return e},"defineProperties")});var Mc=d((wg,jc)=>{"use strict";var kd=xt();jc.exports=kd("document","documentElement")});var Lc=d((mg,Fc)=>{"use strict";var Ed=qe(),Sd=Ic(),Nc=Nt(),Od=qt(),qd=Mc(),Ad=gn(),Cd=Cn(),Tc=">",$c="<",Vn="prototype",Dn="script",Rc=Cd("IE_PROTO"),Un=o(function(){},"EmptyConstructor"),Bc=o(function(n){return $c+Dn+Tc+n+$c+"/"+Dn+Tc},"scriptTag"),Pc=o(function(n){n.write(Bc("")),n.close();var e=n.parentWindow.Object;return n=null,e},"NullProtoObjectViaActiveX"),Id=o(function(){var n=Ad("iframe"),e="java"+Dn+":",t;return n.style.display="none",qd.appendChild(n),n.src=String(e),t=n.contentWindow.document,t.open(),t.write(Bc("document.F=Object")),t.close(),t.F},"NullProtoObjectViaIFrame"),Pt,Rt=o(function(){try{Pt=new ActiveXObject("htmlfile")}catch{}Rt=typeof document<"u"?document.domain&&Pt?Pc(Pt):Id():Pc(Pt);for(var n=Nc.length;n--;)delete Rt[Vn][Nc[n]];return Rt()},"NullProtoObject");Od[Rc]=!0;Fc.exports=Object.create||o(function(e,t){var r;return e!==null?(Un[Vn]=Ed(e),r=new Un,Un[Vn]=null,r[Rc]=e):r=Rt(),t===void 0?r:Sd.f(r,t)},"create")});var Vc=d((xg,Uc)=>{"use strict";var jd=Oe(),Md=Lc(),Nd=we().f,zn=jd("unscopables"),Kn=Array.prototype;Kn[zn]===void 0&&Nd(Kn,zn,{configurable:!0,value:Md(null)});Uc.exports=function(n){Kn[zn][n]=!0}});var Wn=d(()=>{"use strict";var Td=Bn(),$d=L(),Pd=kt(),Rd=_e(),Bd=Ec(),Fd=Oc(),Ld=Vc(),Ud=Array,Vd=$d(Fd("Array","sort"));Td({target:"Array",proto:!0},{toSorted:o(function(e){e!==void 0&&Pd(e);var t=Rd(this),r=Bd(Ud,t);return Vd(r,e)},"toSorted")});Ld("toSorted")});var zc=d((Sg,Dc)=>{"use strict";var Dd=F(),zd=L();Dc.exports=function(n,e){return zd(Dd[n].prototype[e])}});var Wc=d((Og,Kc)=>{"use strict";bc();Wn();var Kd=zc();Kc.exports=Kd("Array","toSorted")});var Jc=d((qg,Gc)=>{"use strict";var Wd=Wc();Gc.exports=Wd});var Yc=d(()=>{"use strict";Wn()});var Zc=d((Ig,Hc)=>{"use strict";var Gd=Jc();Yc();Hc.exports=Gd});var aw=ju(Zc());var yu={};Cu(yu,{AlbertTokenizer:()=>Qt,AutoTokenizer:()=>de,BartTokenizer:()=>fr,BertTokenizer:()=>Xt,BlenderbotSmallTokenizer:()=>Pr,BlenderbotTokenizer:()=>$r,BloomTokenizer:()=>vr,CLIPTokenizer:()=>jr,CamembertTokenizer:()=>lr,CodeGenTokenizer:()=>Ir,CodeLlamaTokenizer:()=>wr,CohereTokenizer:()=>Lr,ConvBertTokenizer:()=>ir,DebertaTokenizer:()=>rr,DebertaV2Tokenizer:()=>nr,DistilBertTokenizer:()=>ar,ElectraTokenizer:()=>ur,EsmTokenizer:()=>kr,FalconTokenizer:()=>xr,GPT2Tokenizer:()=>pr,GPTNeoXTokenizer:()=>br,GemmaTokenizer:()=>Sr,Grok1Tokenizer:()=>Or,HerbertTokenizer:()=>sr,LlamaTokenizer:()=>gr,M2M100Tokenizer:()=>Ar,MBart50Tokenizer:()=>dr,MBartTokenizer:()=>wt,MPNetTokenizer:()=>yr,MarianTokenizer:()=>Nr,MgpstrTokenizer:()=>Ur,MobileBertTokenizer:()=>er,NllbTokenizer:()=>qr,NougatTokenizer:()=>Br,PreTrainedTokenizer:()=>m,Qwen2Tokenizer:()=>Er,RoFormerTokenizer:()=>or,RobertaTokenizer:()=>_r,SiglipTokenizer:()=>Mr,SpeechT5Tokenizer:()=>Rr,SqueezeBertTokenizer:()=>tr,T5Tokenizer:()=>hr,TokenizerModel:()=>ae,VitsTokenizer:()=>Fr,Wav2Vec2CTCTokenizer:()=>Tr,WhisperTokenizer:()=>Cr,XLMRobertaTokenizer:()=>mr,XLMTokenizer:()=>cr,is_chinese_char:()=>wu});var Ie,he=(Ie=class{constructor(){let e=o(function(...t){return e._call(...t)},"closure");return Object.setPrototypeOf(e,new.target.prototype)}_call(...e){throw Error("Must implement _call method in subclass")}},o(Ie,"Callable"),Ie);function Xc(n){return Object.fromEntries(Object.entries(n).map(([e,t])=>[t,e]))}o(Xc,"reverseDictionary");function Gn(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(Gn,"escapeRegExp");function Qc(n){return Number.isInteger(n)||typeof n=="bigint"}o(Qc,"isIntegralNumber");function N(...n){return Array.prototype.concat.apply([],n)}o(N,"mergeArrays");function eu(n){let e=0;for(let t of n)++e;return e}o(eu,"len");async function Jd(n,e,t=!0,r={}){if(n.startsWith("http"))return fetch(n+e).then(s=>{if(!s.ok){if(t)throw new Error(`File not found at ${n}${e}`);return null}return s.arrayBuffer()});throw new Error("Filesystem not supported, please implement your own file reading logic.")}o(Jd,"getModelFile");async function Jn(n,e,t=!0,r={}){let s=await Jd(n,e,t,r);if(s===null)return{};let a=new TextDecoder("utf-8").decode(s);return JSON.parse(a)}o(Jn,"getModelJSON");function tu(n){if(n.length===0)throw Error("Array must not be empty");let e=n[0],t=0;for(let r=1;r<n.length;++r)n[r]<e&&(e=n[r],t=r);return[e,t]}o(tu,"min");function ru(n){if(n.length===0)throw Error("Array must not be empty");let e=n[0],t=0;for(let r=1;r<n.length;++r)n[r]>e&&(e=n[r],t=r);return[Number(e),t]}o(ru,"max");function je(n,e){let t=Math.pow(10,e);return Math.round(n*t)/t}o(je,"round");var Hn=class Hn extends Error{constructor(e){super(e)}};o(Hn,"TensorError");var Yn=Hn,Zn=class Zn{constructor(...e){throw new Yn("You seem to be creating a tensor object. Unfortunately, the '@lenml/tokenizers' library does not support returning any ONNX-related object instances. Please try setting 'return_tensor=false' to avoid this error")}};o(Zn,"Tensor");var pe=Zn;var Xn=class Xn{constructor(e=(r,s)=>r>s,t=1/0){this._heap=[],this._comparator=e,this._maxSize=t}get size(){return this._heap.length}isEmpty(){return this.size===0}peek(){return this._heap[0]}push(...e){return this.extend(e)}extend(e){for(let t of e)if(this.size<this._maxSize)this._heap.push(t),this._siftUp();else{let r=this._smallest();this._comparator(t,this._heap[r])&&(this._heap[r]=t,this._siftUpFrom(r))}return this.size}pop(){let e=this.peek(),t=this.size-1;return t>0&&this._swap(0,t),this._heap.pop(),this._siftDown(),e}replace(e){let t=this.peek();return this._heap[0]=e,this._siftDown(),t}_parent(e){return(e+1>>>1)-1}_left(e){return(e<<1)+1}_right(e){return e+1<<1}_greater(e,t){return this._comparator(this._heap[e],this._heap[t])}_swap(e,t){let r=this._heap[e];this._heap[e]=this._heap[t],this._heap[t]=r}_siftUp(){this._siftUpFrom(this.size-1)}_siftUpFrom(e){for(;e>0&&this._greater(e,this._parent(e));)this._swap(e,this._parent(e)),e=this._parent(e)}_siftDown(){let e=0;for(;this._left(e)<this.size&&this._greater(this._left(e),e)||this._right(e)<this.size&&this._greater(this._right(e),e);){let t=this._right(e)<this.size&&this._greater(this._right(e),this._left(e))?this._right(e):this._left(e);this._swap(e,t),e=t}}_smallest(){return 2**Math.floor(Math.log2(this.size))-1}};o(Xn,"PriorityQueue");var Bt=Xn,Qn=class Qn{constructor(){this.root=Lt.default()}extend(e){for(let t of e)this.push(t)}push(e){let t=this.root;for(let r of e){let s=t.children.get(r);s===void 0&&(s=Lt.default(),t.children.set(r,s)),t=s}t.isLeaf=!0}*commonPrefixSearch(e){let t=this.root;if(t===void 0)return;let r="";for(let s of e){if(r+=s,t=t.children.get(s),t===void 0)return;t.isLeaf&&(yield r)}}};o(Qn,"CharTrie");var Ft=Qn,Vt=class Vt{constructor(e,t){this.isLeaf=e,this.children=t}static default(){return new Vt(!1,new Map)}};o(Vt,"CharTrieNode");var Lt=Vt,es=class es{constructor(e,t,r){this.chars=Array.from(e),this.len=this.chars.length,this.bosTokenId=t,this.eosTokenId=r,this.nodes=[],this.beginNodes=Array.from({length:this.len+1},()=>[]),this.endNodes=Array.from({length:this.len+1},()=>[]);let s=new Me(this.bosTokenId,0,0,0,0),i=new Me(this.eosTokenId,1,this.len,0,0);this.nodes.push(s.clone()),this.nodes.push(i.clone()),this.beginNodes[this.len].push(i),this.endNodes[0].push(s)}insert(e,t,r,s){let i=this.nodes.length,a=new Me(s,i,e,t,r);this.beginNodes[e].push(a),this.endNodes[e+t].push(a),this.nodes.push(a)}viterbi(){let e=this.len,t=0;for(;t<=e;){if(this.beginNodes[t].length==0)return[];for(let l of this.beginNodes[t]){l.prev=null;let u=0,h=null;for(let f of this.endNodes[t]){let v=f.backtraceScore+l.score;(h===null||v>u)&&(h=f.clone(),u=v)}if(h!==null)l.prev=h,l.backtraceScore=u;else return[]}++t}let r=[],i=this.beginNodes[e][0].prev;if(i===null)return[];let a=i.clone();for(;a.prev!==null;)r.push(a.clone()),a=a.clone().prev.clone();return r.reverse(),r}piece(e){return this.chars.slice(e.pos,e.pos+e.length).join("")}tokens(){return this.viterbi().map(t=>this.piece(t))}tokenIds(){return this.viterbi().map(t=>t.tokenId)}};o(es,"TokenLattice");var Ut=es,Dt=class Dt{constructor(e,t,r,s,i){this.tokenId=e,this.nodeId=t,this.pos=r,this.length=s,this.score=i,this.prev=null,this.backtraceScore=0}clone(){let e=new Dt(this.tokenId,this.nodeId,this.pos,this.length,this.score);return e.prev=this.prev,e.backtraceScore=this.backtraceScore,e}};o(Dt,"TokenLatticeNode");var Me=Dt;var c=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",BooleanLiteral:"BooleanLiteral",StringLiteral:"StringLiteral",Identifier:"Identifier",Equals:"Equals",OpenParen:"OpenParen",CloseParen:"CloseParen",OpenStatement:"OpenStatement",CloseStatement:"CloseStatement",OpenExpression:"OpenExpression",CloseExpression:"CloseExpression",OpenSquareBracket:"OpenSquareBracket",CloseSquareBracket:"CloseSquareBracket",OpenCurlyBracket:"OpenCurlyBracket",CloseCurlyBracket:"CloseCurlyBracket",Comma:"Comma",Dot:"Dot",Colon:"Colon",Pipe:"Pipe",CallOperator:"CallOperator",AdditiveBinaryOperator:"AdditiveBinaryOperator",MultiplicativeBinaryOperator:"MultiplicativeBinaryOperator",ComparisonBinaryOperator:"ComparisonBinaryOperator",UnaryOperator:"UnaryOperator",Set:"Set",If:"If",For:"For",In:"In",Is:"Is",NotIn:"NotIn",Else:"Else",EndIf:"EndIf",ElseIf:"ElseIf",EndFor:"EndFor",And:"And",Or:"Or",Not:"UnaryOperator"}),nu=Object.freeze({set:c.Set,for:c.For,in:c.In,is:c.Is,if:c.If,else:c.Else,endif:c.EndIf,elif:c.ElseIf,endfor:c.EndFor,and:c.And,or:c.Or,not:c.Not,"not in":c.NotIn,true:c.BooleanLiteral,false:c.BooleanLiteral}),$e,fe=($e=class{constructor(e,t){this.value=e,this.type=t}},o($e,"Token"),$e);function su(n){return/\w/.test(n)}o(su,"isWord");function ts(n){return/[0-9]/.test(n)}o(ts,"isInteger");var Yd=[["{%",c.OpenStatement],["%}",c.CloseStatement],["{{",c.OpenExpression],["}}",c.CloseExpression],["(",c.OpenParen],[")",c.CloseParen],["{",c.OpenCurlyBracket],["}",c.CloseCurlyBracket],["[",c.OpenSquareBracket],["]",c.CloseSquareBracket],[",",c.Comma],[".",c.Dot],[":",c.Colon],["|",c.Pipe],["<=",c.ComparisonBinaryOperator],[">=",c.ComparisonBinaryOperator],["==",c.ComparisonBinaryOperator],["!=",c.ComparisonBinaryOperator],["<",c.ComparisonBinaryOperator],[">",c.ComparisonBinaryOperator],["+",c.AdditiveBinaryOperator],["-",c.AdditiveBinaryOperator],["*",c.MultiplicativeBinaryOperator],["/",c.MultiplicativeBinaryOperator],["%",c.MultiplicativeBinaryOperator],["=",c.Equals]],Hd=new Map([["n",` `],["t"," "],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]);function Zd(n,e={}){return n.endsWith(` `)&&(n=n.slice(0,-1)),n=n.replace(/{#.*?#}/gs,"{##}"),e.lstrip_blocks&&(n=n.replace(/^[ \t]*({[#%])/gm,"$1")),e.trim_blocks&&(n=n.replace(/([#%]})\n/g,"$1")),n.replace(/{##}/g,"").replace(/-%}\s*/g,"%}").replace(/\s*{%-/g,"{%").replace(/-}}\s*/g,"}}").replace(/\s*{{-/g,"{{")}o(Zd,"preprocess");function Xd(n,e={}){let t=[],r=Zd(n,e),s=0,i=o(a=>{let l="";for(;a(r[s]);){if(r[s]==="\\"){if(++s,s>=r.length)throw new SyntaxError("Unexpected end of input");let u=r[s++],h=Hd.get(u);if(h===void 0)throw new SyntaxError(`Unexpected escaped character: ${u}`);l+=h;continue}if(l+=r[s++],s>=r.length)throw new SyntaxError("Unexpected end of input")}return l},"consumeWhile");e:for(;s<r.length;){let a=t.at(-1)?.type;if(a===void 0||a===c.CloseStatement||a===c.CloseExpression){let u="";for(;s<r.length&&!(r[s]==="{"&&(r[s+1]==="%"||r[s+1]==="{"));)u+=r[s++];if(u.length>0){t.push(new fe(u,c.Text));continue}}i(u=>/\s/.test(u));let l=r[s];if(l==="-"||l==="+"){let u=t.at(-1)?.type;if(u===c.Text||u===void 0)throw new SyntaxError(`Unexpected character: ${l}`);switch(u){case c.Identifier:case c.NumericLiteral:case c.BooleanLiteral:case c.StringLiteral:case c.CloseParen:case c.CloseSquareBracket:break;default:{++s;let h=i(ts);t.push(new fe(`${l}${h}`,h.length>0?c.NumericLiteral:c.UnaryOperator));continue}}}for(let[u,h]of Yd)if(r.slice(s,s+u.length)===u){t.push(new fe(u,h)),s+=u.length;continue e}if(l==="'"||l==='"'){++s;let u=i(h=>h!==l);t.push(new fe(u,c.StringLiteral)),++s;continue}if(ts(l)){let u=i(ts);t.push(new fe(u,c.NumericLiteral));continue}if(su(l)){let u=i(su),h=Object.hasOwn(nu,u)?nu[u]:c.Identifier;h===c.In&&t.at(-1)?.type===c.Not?(t.pop(),t.push(new fe("not in",c.NotIn))):t.push(new fe(u,h));continue}throw new SyntaxError(`Unexpected character: ${l}`)}return t}o(Xd,"tokenize");var Pe,gt=(Pe=class{constructor(){g(this,"type","Statement")}},o(Pe,"Statement"),Pe),Re,Qd=(Re=class extends gt{constructor(t){super();g(this,"type","Program");this.body=t}},o(Re,"Program"),Re),Be,iu=(Be=class extends gt{constructor(t,r,s){super();g(this,"type","If");this.test=t,this.body=r,this.alternate=s}},o(Be,"If"),Be),Fe,e_=(Fe=class extends gt{constructor(t,r,s){super();g(this,"type","For");this.loopvar=t,this.iterable=r,this.body=s}},o(Fe,"For"),Fe),Le,t_=(Le=class extends gt{constructor(t,r){super();g(this,"type","Set");this.assignee=t,this.value=r}},o(Le,"SetStatement"),Le),Ue,X=(Ue=class extends gt{constructor(){super(...arguments);g(this,"type","Expression")}},o(Ue,"Expression"),Ue),Ve,r_=(Ve=class extends X{constructor(t,r,s){super();g(this,"type","MemberExpression");this.object=t,this.property=r,this.computed=s}},o(Ve,"MemberExpression"),Ve),De,n_=(De=class extends X{constructor(t,r){super();g(this,"type","CallExpression");this.callee=t,this.args=r}},o(De,"CallExpression"),De),ze,me=(ze=class extends X{constructor(t){super();g(this,"type","Identifier");this.value=t}},o(ze,"Identifier"),ze),Ke,ye=(Ke=class extends X{constructor(t){super();g(this,"type","Literal");this.value=t}},o(Ke,"Literal"),Ke),We,s_=(We=class extends ye{constructor(){super(...arguments);g(this,"type","NumericLiteral")}},o(We,"NumericLiteral"),We),Ge,ou=(Ge=class extends ye{constructor(){super(...arguments);g(this,"type","StringLiteral")}},o(Ge,"StringLiteral"),Ge),Je,au=(Je=class extends ye{constructor(){super(...arguments);g(this,"type","BooleanLiteral")}},o(Je,"BooleanLiteral"),Je),Ye,i_=(Ye=class extends ye{constructor(){super(...arguments);g(this,"type","ArrayLiteral")}},o(Ye,"ArrayLiteral"),Ye),He,lu=(He=class extends ye{constructor(){super(...arguments);g(this,"type","TupleLiteral")}},o(He,"TupleLiteral"),He),Ze,o_=(Ze=class extends ye{constructor(){super(...arguments);g(this,"type","ObjectLiteral")}},o(Ze,"ObjectLiteral"),Ze),Xe,Ne=(Xe=class extends X{constructor(t,r,s){super();g(this,"type","BinaryExpression");this.operator=t,this.left=r,this.right=s}},o(Xe,"BinaryExpression"),Xe),Qe,a_=(Qe=class extends X{constructor(t,r){super();g(this,"type","FilterExpression");this.operand=t,this.filter=r}},o(Qe,"FilterExpression"),Qe),et,l_=(et=class extends X{constructor(t,r,s){super();g(this,"type","TestExpression");this.operand=t,this.negate=r,this.test=s}},o(et,"TestExpression"),et),tt,c_=(tt=class extends X{constructor(t,r){super();g(this,"type","UnaryExpression");this.operator=t,this.argument=r}},o(tt,"UnaryExpression"),tt),rt,u_=(rt=class extends X{constructor(t=void 0,r=void 0,s=void 0){super();g(this,"type","SliceExpression");this.start=t,this.stop=r,this.step=s}},o(rt,"SliceExpression"),rt),nt,h_=(nt=class extends X{constructor(t,r){super();g(this,"type","KeywordArgumentExpression");this.key=t,this.value=r}},o(nt,"KeywordArgumentExpression"),nt);function p_(n){let e=new Qd([]),t=0;function r(p,_){let w=n[t++];if(!w||w.type!==p)throw new Error(`Parser Error: ${_}. ${w.type} !== ${p}.`);return w}o(r,"expect");function s(){switch(n[t].type){case c.Text:return l();case c.OpenStatement:return u();case c.OpenExpression:return h();default:throw new SyntaxError(`Unexpected token type: ${n[t].type}`)}}o(s,"parseAny");function i(...p){return t+p.length<=n.length&&p.some((_,w)=>_!==n[t+w].type)}o(i,"not");function a(...p){return t+p.length<=n.length&&p.every((_,w)=>_===n[t+w].type)}o(a,"is");function l(){return new ou(r(c.Text,"Expected text token").value)}o(l,"parseText");function u(){r(c.OpenStatement,"Expected opening statement token");let p;switch(n[t].type){case c.Set:++t,p=f(),r(c.CloseStatement,"Expected closing statement token");break;case c.If:++t,p=v(),r(c.OpenStatement,"Expected {% token"),r(c.EndIf,"Expected endif token"),r(c.CloseStatement,"Expected %} token");break;case c.For:++t,p=b(),r(c.OpenStatement,"Expected {% token"),r(c.EndFor,"Expected endfor token"),r(c.CloseStatement,"Expected %} token");break;default:throw new SyntaxError(`Unknown statement type: ${n[t].type}`)}return p}o(u,"parseJinjaStatement");function h(){r(c.OpenExpression,"Expected opening expression token");let p=k();return r(c.CloseExpression,"Expected closing expression token"),p}o(h,"parseJinjaExpression");function f(){let p=k();if(a(c.Equals)){++t;let _=f();return new t_(p,_)}return p}o(f,"parseSetStatement");function v(){let p=k();r(c.CloseStatement,"Expected closing statement token");let _=[],w=[];for(;!(n[t]?.type===c.OpenStatement&&(n[t+1]?.type===c.ElseIf||n[t+1]?.type===c.Else||n[t+1]?.type===c.EndIf));)_.push(s());if(n[t]?.type===c.OpenStatement&&n[t+1]?.type!==c.EndIf)if(++t,a(c.ElseIf))r(c.ElseIf,"Expected elseif token"),w.push(v());else for(r(c.Else,"Expected else token"),r(c.CloseStatement,"Expected closing statement token");!(n[t]?.type===c.OpenStatement&&n[t+1]?.type===c.EndIf);)w.push(s());return new iu(p,_,w)}o(v,"parseIfStatement");function y(p=!1){let _=p?q:k,w=[_()],K=a(c.Comma);for(;K&&(++t,w.push(_()),!!a(c.Comma)););return K?new lu(w):w[0]}o(y,"parseExpressionSequence");function b(){let p=y(!0);if(!(p instanceof me||p instanceof lu))throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${p.type} instead`);r(c.In,"Expected `in` keyword following loop variable");let _=k();r(c.CloseStatement,"Expected closing statement token");let w=[];for(;i(c.OpenStatement,c.EndFor);)w.push(s());return new e_(p,_,w)}o(b,"parseForStatement");function k(){return E()}o(k,"parseExpression");function E(){let p=I();if(a(c.If)){++t;let _=I();r(c.Else,"Expected else token");let w=I();return new iu(_,[p],[w])}return p}o(E,"parseTernaryExpression");function I(){let p=$();for(;a(c.Or);){let _=n[t];++t;let w=$();p=new Ne(_,p,w)}return p}o(I,"parseLogicalOrExpression");function $(){let p=P();for(;a(c.And);){let _=n[t];++t;let w=P();p=new Ne(_,p,w)}return p}o($,"parseLogicalAndExpression");function P(){let p;for(;a(c.Not);){let _=n[t];++t;let w=P();p=new c_(_,w)}return p??Q()}o(P,"parseLogicalNegationExpression");function Q(){let p=R();for(;a(c.ComparisonBinaryOperator)||a(c.In)||a(c.NotIn);){let _=n[t];++t;let w=R();p=new Ne(_,p,w)}return p}o(Q,"parseComparisonExpression");function R(){let p=T();for(;a(c.AdditiveBinaryOperator);){let _=n[t];++t;let w=T();p=new Ne(_,p,w)}return p}o(R,"parseAdditiveExpression");function ce(){let p=se();return a(c.OpenParen)?S(p):p}o(ce,"parseCallMemberExpression");function S(p){let _=new n_(p,j());return a(c.OpenParen)&&(_=S(_)),_}o(S,"parseCallExpression");function j(){r(c.OpenParen,"Expected opening parenthesis for arguments list");let p=V();return r(c.CloseParen,"Expected closing parenthesis for arguments list"),p}o(j,"parseArgs");function V(){let p=[];for(;!a(c.CloseParen);){let _=k();if(a(c.Equals)){if(++t,!(_ instanceof me))throw new SyntaxError("Expected identifier for keyword argument");let w=k();_=new h_(_,w)}p.push(_),a(c.Comma)&&++t}return p}o(V,"parseArgumentsList");function ee(){let p=[],_=!1;for(;!a(c.CloseSquareBracket);)a(c.Colon)?(p.push(void 0),++t,_=!0):(p.push(k()),a(c.Colon)&&(++t,_=!0));if(p.length===0)throw new SyntaxError("Expected at least one argument for member/slice expression");if(_){if(p.length>3)throw new SyntaxError("Expected 0-3 arguments for slice expression");return new u_(...p)}return p[0]}o(ee,"parseMemberExpressionArgumentsList");function se(){let p=q();for(;a(c.Dot)||a(c.OpenSquareBracket);){let _=n[t];++t;let w,K=_.type!==c.Dot;if(K)w=ee(),r(c.CloseSquareBracket,"Expected closing square bracket");else if(w=q(),w.type!=="Identifier")throw new SyntaxError("Expected identifier following dot operator");p=new r_(p,w,K)}return p}o(se,"parseMemberExpression");function T(){let p=Z();for(;a(c.MultiplicativeBinaryOperator);){let _=n[t];++t;let w=Z();p=new Ne(_,p,w)}return p}o(T,"parseMultiplicativeExpression");function Z(){let p=M();for(;a(c.Is);){++t;let _=a(c.Not);_&&++t;let w=q();if(w instanceof au&&(w=new me(w.value.toString())),!(w instanceof me))throw new SyntaxError("Expected identifier for the test");p=new l_(p,_,w)}return p}o(Z,"parseTestExpression");function M(){let p=ce();for(;a(c.Pipe);){++t;let _=q();if(!(_ instanceof me))throw new SyntaxError("Expected identifier for the filter");a(c.OpenParen)&&(_=S(_)),p=new a_(p,_)}return p}o(M,"parseFilterExpression");function q(){let p=n[t];switch(p.type){case c.NumericLiteral:return++t,new s_(Number(p.value));case c.StringLiteral:return++t,new ou(p.value);case c.BooleanLiteral:return++t,new au(p.value==="true");case c.Identifier:return++t,new me(p.value);case c.OpenParen:{++t;let _=y();if(n[t].type!==c.CloseParen)throw new SyntaxError(`Expected closing parenthesis, got ${n[t].type} instead`);return++t,_}case c.OpenSquareBracket:{++t;let _=[];for(;!a(c.CloseSquareBracket);)_.push(k()),a(c.Comma)&&++t;return++t,new i_(_)}case c.OpenCurlyBracket:{++t;let _=new Map;for(;!a(c.CloseCurlyBracket);){let w=k();r(c.Colon,"Expected colon between key and value in object literal");let K=k();_.set(w,K),a(c.Comma)&&++t}return++t,new o_(_)}default:throw new SyntaxError(`Unexpected token: ${p.type}`)}}for(o(q,"parsePrimaryExpression");t<n.length;)e.body.push(s());return e}o(p_,"parse");function f_(n,e,t=1){e===void 0&&(e=n,n=0);let r=[];for(let s=n;s<e;s+=t)r.push(s);return r}o(f_,"range");function cu(n,e,t,r=1){let s=Math.sign(r);s>=0?(e=(e??(e=0))<0?Math.max(n.length+e,0):Math.min(e,n.length),t=(t??(t=n.length))<0?Math.max(n.length+t,0):Math.min(t,n.length)):(e=(e??(e=n.length-1))<0?Math.max(n.length+e,-1):Math.min(e,n.length-1),t=(t??(t=-1))<-1?Math.max(n.length+t,-1):Math.min(t,n.length-1));let i=[];for(let a=e;s*a<s*t;a+=r)i.push(n[a]);return i}o(cu,"slice");function uu(n){return n.replace(/\b\w/g,e=>e.toUpperCase())}o(uu,"titleCase");var st,ne=(st=class{constructor(e=void 0){g(this,"type","RuntimeValue");g(this,"value");g(this,"builtins",new Map);this.value=e}__bool__(){return new C(!!this.value)}},o(st,"RuntimeValue"),st),it,O=(it=class extends ne{constructor(){super(...arguments);g(this,"type","NumericValue")}},o(it,"NumericValue"),it),ot,x=(ot=class extends ne{constructor(){super(...arguments);g(this,"type","StringValue");g(this,"builtins",new Map([["upper",new re(()=>new x(this.value.toUpperCase()))],["lower",new re(()=>new x(this.value.toLowerCase()))],["strip",new re(()=>new x(this.value.trim()))],["title",new re(()=>new x(uu(this.value)))],["length",new O(this.value.length)]]))}},o(ot,"StringValue"),ot),at,C=(at=class extends ne{constructor(){super(...arguments);g(this,"type","BooleanValue")}},o(at,"BooleanValue"),at),lt,H=(lt=class extends ne{constructor(){super(...arguments);g(this,"type","ObjectValue");g(this,"builtins",new Map([["get",new re(([t,r])=>{if(!(t instanceof x))throw new Error(`Object key must be a string: got ${t.type}`);return this.value.get(t.value)??r??new Te})],["items",new re(()=>new A(Array.from(this.value.entries()).map(([t,r])=>new A([new x(t),r]))))]]))}__bool__(){return new C(this.value.size>0)}},o(lt,"ObjectValue"),lt),ct,A=(ct=class extends ne{constructor(){super(...arguments);g(this,"type","ArrayValue");g(this,"builtins",new Map([["length",new O(this.value.length)]]))}__bool__(){return new C(this.value.length>0)}},o(ct,"ArrayValue"),ct),ut,d_=(ut=class extends A{constructor(){super(...arguments);g(this,"type","TupleValue")}},o(ut,"TupleValue"),ut),ht,re=(ht=class extends ne{constructor(){super(...arguments);g(this,"type","FunctionValue")}},o(ht,"FunctionValue"),ht),pt,Te=(pt=class extends ne{constructor(){super(...arguments);g(this,"type","NullValue")}},o(pt,"NullValue"),pt),ft,Y=(ft=class extends ne{constructor(){super(...arguments);g(this,"type","UndefinedValue")}},o(ft,"UndefinedValue"),ft),dt,rs=(dt=class{constructor(e){g(this,"variables",new Map([["namespace",new re(e=>{if(e.length===0)return new H(new Map);if(e.length!==1||!(e[0]instanceof H))throw new Error("`namespace` expects either zero arguments or a single object argument");return e[0]})]]));g(this,"tests",new Map([["boolean",e=>e.type==="BooleanValue"],["callable",e=>e instanceof re],["odd",e=>{if(e.type!=="NumericValue")throw new Error(`Cannot apply test "odd" to type: ${e.type}`);return e.value%2!==0}],["even",e=>{if(e.type!=="NumericValue")throw new Error(`Cannot apply test "even" to type: ${e.type}`);return e.value%2===0}],["false",e=>e.type==="BooleanValue"&&!e.value],["true",e=>e.type==="BooleanValue"&&e.value],["number",e=>e.type==="NumericValue"],["integer",e=>e.type==="NumericValue"&&Number.isInteger(e.value)],["iterable",e=>e instanceof A||e instanceof x],["lower",e=>{let t=e.value;return e.type==="StringValue"&&t===t.toLowerCase()}],["upper",e=>{let t=e.value;return e.type==="StringValue"&&t===t.toUpperCase()}],["none",e=>e.type==="NullValue"],["defined",e=>e.type!=="UndefinedValue"],["undefined",e=>e.type==="UndefinedValue"],["equalto",(e,t)=>e.value===t.value]]));this.parent=e}set(e,t){return this.declareVariable(e,zt(t))}declareVariable(e,t){if(this.variables.has(e))throw new SyntaxError(`Variable already declared: ${e}`);return this.variables.set(e,t),t}setVariable(e,t){return this.variables.set(e,t),t}resolve(e){if(this.variables.has(e))return this;if(this.parent)return this.parent.resolve(e);throw new Error(`Unknown variable: ${e}`)}lookupVariable(e){try{return this.resolve(e).variables.get(e)??new Y}catch{return new Y}}},o(dt,"Environment"),dt),_t,__=(_t=class{constructor(e){g(this,"global");this.global=e??new rs}run(e){return this.evaluate(e,this.global)}evaluateBinaryExpression(e,t){let r=this.evaluate(e.left,t);switch(e.operator.value){case"and":return r.__bool__().value?this.evaluate(e.right,t):r;case"or":return r.__bool__().value?r:this.evaluate(e.right,t)}let s=this.evaluate(e.right,t);switch(e.operator.value){case"==":return new C(r.value==s.value);case"!=":return new C(r.value!=s.value)}if(r instanceof Y||s instanceof Y)throw new Error("Cannot perform operation on undefined values");if(r instanceof Te||s instanceof Te)throw new Error("Cannot perform operation on null values");if(r instanceof O&&s instanceof O)switch(e.operator.value){case"+":return new O(r.value+s.value);case"-":return new O(r.value-s.value);case"*":return new O(r.value*s.value);case"/":return new O(r.value/s.value);case"%":return new O(r.value%s.value);case"<":return new C(r.value<s.value);case">":return new C(r.value>s.value);case">=":return new C(r.value>=s.value);case"<=":return new C(r.value<=s.value)}else if(r instanceof A&&s instanceof A)switch(e.operator.value){case"+":return new A(r.value.concat(s.value))}else if(s instanceof A){let i=s.value.find(a=>a.value===r.value)!==void 0;switch(e.operator.value){case"in":return new C(i);case"not in":return new C(!i)}}if(r instanceof x||s instanceof x)switch(e.operator.value){case"+":return new x(r.value.toString()+s.value.toString())}if(r instanceof x&&s instanceof x)switch(e.operator.value){case"in":return new C(s.value.includes(r.value));case"not in":return new C(!s.value.includes(r.value))}if(r instanceof x&&s instanceof H)switch(e.operator.value){case"in":return new C(s.value.has(r.value));case"not in":return new C(!s.value.has(r.value))}throw new SyntaxError(`Unknown operator "${e.operator.value}" between ${r.type} and ${s.type}`)}evaluateFilterExpression(e,t){let r=this.evaluate(e.operand,t);if(e.filter.type==="Identifier"){let s=e.filter;if(r instanceof A)switch(s.value){case"list":return r;case"first":return r.value[0];case"last":return r.value[r.value.length-1];case"length":return new O(r.value.length);case"reverse":return new A(r.value.reverse());case"sort":return new A(r.value.sort((i,a)=>{if(i.type!==a.type)throw new Error(`Cannot compare different types: ${i.type} and ${a.type}`);switch(i.type){case"NumericValue":return i.value-a.value;case"StringValue":return i.value.localeCompare(a.value);default:throw new Error(`Cannot compare type: ${i.type}`)}}));default:throw new Error(`Unknown ArrayValue filter: ${s.value}`)}else if(r instanceof x)switch(s.value){case"length":return new O(r.value.length);case"upper":return new x(r.value.toUpperCase());case"lower":return new x(r.value.toLowerCase());case"title":return new x(uu(r.value));case"capitalize":return new x(r.value.charAt(0).toUpperCase()+r.value.slice(1));case"trim":return new x(r.value.trim());default:throw new Error(`Unknown StringValue filter: ${s.value}`)}else if(r instanceof O)switch(s.value){case"abs":return new O(Math.abs(r.value));default:throw new Error(`Unknown NumericValue filter: ${s.value}`)}else if(r instanceof H)switch(s.value){case"items":return new A(Array.from(r.value.entries()).map(([i,a])=>new A([new x(i),a])));case"length":return new O(r.value.size);default:throw new Error(`Unknown ObjectValue filter: ${s.value}`)}throw new Error(`Cannot apply filter "${s.value}" to type: ${r.type}`)}else if(e.filter.type==="CallExpression"){let s=e.filter;if(s.callee.type!=="Identifier")throw new Error(`Unknown filter: ${s.callee.type}`);let i=s.callee.value;if(r instanceof A){switch(i){case"selectattr":{if(r.value.some(v=>!(v instanceof H)))throw new Error("`selectattr` can only be applied to array of objects");if(s.args.some(v=>v.type!=="StringLiteral"))throw new Error("arguments of `selectattr` must be strings");let[a,l,u]=s.args.map(v=>this.evaluate(v,t)),h;if(l){let v=t.tests.get(l.value);if(!v)throw new Error(`Unknown test: ${l.value}`);h=v}else h=o((...v)=>v[0].__bool__().value,"testFunction");let f=r.value.filter(v=>{let y=v.value.get(a.value);return y?h(y,u):!1});return new A(f)}}throw new Error(`Unknown ArrayValue filter: ${i}`)}else throw new Error(`Cannot apply filter "${i}" to type: ${r.type}`)}throw new Error(`Unknown filter: ${e.filter.type}`)}evaluateTestExpression(e,t){let r=this.evaluate(e.operand,t),s=t.tests.get(e.test.value);if(!s)throw new Error(`Unknown test: ${e.test.value}`);let i=s(r);return new C(e.negate?!i:i)}evaluateUnaryExpression(e,t){let r=this.evaluate(e.argument,t);switch(e.operator.value){case"not":return new C(!r.value);default:throw new SyntaxError(`Unknown operator: ${e.operator.value}`)}}evalProgram(e,t){return this.evaluateBlock(e.body,t)}evaluateBlock(e,t){let r="";for(let s of e){let i=this.evaluate(s,t);i.type!=="NullValue"&&i.type!=="UndefinedValue"&&(r+=i.value)}return new x(r)}evaluateIdentifier(e,t){return t.lookupVariable(e.value)}evaluateCallExpression(e,t){let r=[],s=new Map;for(let a of e.args)if(a.type==="KeywordArgumentExpression"){let l=a;s.set(l.key.value,this.evaluate(l.value,t))}else r.push(this.evaluate(a,t));s.size>0&&r.push(new H(s));let i=this.evaluate(e.callee,t);if(i.type!=="FunctionValue")throw new Error(`Cannot call something that is not a function: got ${i.type}`);return i.value(r,t)}evaluateSliceExpression(e,t,r){if(!(e instanceof A||e instanceof x))throw new Error("Slice object must be an array or string");let s=this.evaluate(t.start,r),i=this.evaluate(t.stop,r),a=this.evaluate(t.step,r);if(!(s instanceof O||s instanceof Y))throw new Error("Slice start must be numeric or undefined");if(!(i instanceof O||i instanceof Y))throw new Error("Slice stop must be numeric or undefined");if(!(a instanceof O||a instanceof Y))throw new Error("Slice step must be numeric or undefined");return e instanceof A?new A(cu(e.value,s.value,i.value,a.value)):new x(cu(Array.from(e.value),s.value,i.value,a.value).join(""))}evaluateMemberExpression(e,t){let r=this.evaluate(e.object,t),s;if(e.computed){if(e.property.type==="SliceExpression")return this.evaluateSliceExpression(r,e.property,t);s=this.evaluate(e.property,t)}else s=new x(e.property.value);let i;if(r instanceof H){if(!(s instanceof x))throw new Error(`Cannot access property with non-string: got ${s.type}`);i=r.value.get(s.value)??r.builtins.get(s.value)}else if(r instanceof A||r instanceof x)if(s instanceof O)i=r.value.at(s.value),r instanceof x&&(i=new x(r.value.at(s.value)));else if(s instanceof x)i=r.builtins.get(s.value);else throw new Error(`Cannot access property with non-string/non-number: got ${s.type}`);else{if(!(s instanceof x))throw new Error(`Cannot access property with non-string: got ${