UNPKG

@fugood/transformers

Version:

State-of-the-art Machine Learning for the web. Run 🤗 Transformers directly in your browser, with no need for a server!

1 lines • 419 kB
(()=>{var e,t,s={"./node_modules/base64-js/index.js":(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),s=t[0],r=t[1];return 3*(s+r)/4-r},t.toByteArray=function(e){var t,s,o=a(e),i=o[0],l=o[1],c=new n(function(e,t,s){return 3*(t+s)/4-s}(0,i,l)),d=0,u=l>0?i-4:i;for(s=0;s<u;s+=4)t=r[e.charCodeAt(s)]<<18|r[e.charCodeAt(s+1)]<<12|r[e.charCodeAt(s+2)]<<6|r[e.charCodeAt(s+3)],c[d++]=t>>16&255,c[d++]=t>>8&255,c[d++]=255&t;2===l&&(t=r[e.charCodeAt(s)]<<2|r[e.charCodeAt(s+1)]>>4,c[d++]=255&t);1===l&&(t=r[e.charCodeAt(s)]<<10|r[e.charCodeAt(s+1)]<<4|r[e.charCodeAt(s+2)]>>2,c[d++]=t>>8&255,c[d++]=255&t);return c},t.fromByteArray=function(e){for(var t,r=e.length,n=r%3,o=[],i=16383,a=0,c=r-n;a<c;a+=i)o.push(l(e,a,a+i>c?c:a+i));1===n?(t=e[r-1],o.push(s[t>>2]+s[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],o.push(s[t>>10]+s[t>>4&63]+s[t<<2&63]+"="));return o.join("")};for(var s=[],r=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)s[i]=o[i],r[o.charCodeAt(i)]=i;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var s=e.indexOf("=");return-1===s&&(s=t),[s,s===t?0:4-s%4]}function l(e,t,r){for(var n,o,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(s[(o=n)>>18&63]+s[o>>12&63]+s[o>>6&63]+s[63&o]);return i.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},"./node_modules/buffer/index.js":(e,t,s)=>{"use strict";const r=s("./node_modules/base64-js/index.js"),n=s("./node_modules/ieee754/index.js"),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function a(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,s){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return c(e,t,s)}function c(e,t,s){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const s=0|m(e,t);let r=a(s);const n=r.write(e,t);n!==s&&(r=r.slice(0,n));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(H(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return _(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(H(e,ArrayBuffer)||e&&H(e.buffer,ArrayBuffer))return p(e,t,s);if("undefined"!=typeof SharedArrayBuffer&&(H(e,SharedArrayBuffer)||e&&H(e.buffer,SharedArrayBuffer)))return p(e,t,s);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return l.from(r,t,s);const n=function(e){if(l.isBuffer(e)){const t=0|h(e.length),s=a(t);return 0===s.length||e.copy(s,0,0,t),s}if(void 0!==e.length)return"number"!=typeof e.length||J(e.length)?a(0):_(e);if("Buffer"===e.type&&Array.isArray(e.data))return _(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,s);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function d(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return d(e),a(e<0?0:0|h(e))}function _(e){const t=e.length<0?0:0|h(e.length),s=a(t);for(let r=0;r<t;r+=1)s[r]=255&e[r];return s}function p(e,t,s){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(s||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===s?new Uint8Array(e):void 0===s?new Uint8Array(e,t):new Uint8Array(e,t,s),Object.setPrototypeOf(r,l.prototype),r}function h(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function m(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||H(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const s=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===s)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return s;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*s;case"hex":return s>>>1;case"base64":return X(e).length;default:if(n)return r?-1:W(e).length;t=(""+t).toLowerCase(),n=!0}}function f(e,t,s){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===s||s>this.length)&&(s=this.length),s<=0)return"";if((s>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return E(this,t,s);case"utf8":case"utf-8":return P(this,t,s);case"ascii":return C(this,t,s);case"latin1":case"binary":return S(this,t,s);case"base64":return v(this,t,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,s);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,s){const r=e[t];e[t]=e[s],e[s]=r}function w(e,t,s,r,n){if(0===e.length)return-1;if("string"==typeof s?(r=s,s=0):s>2147483647?s=2147483647:s<-2147483648&&(s=-2147483648),J(s=+s)&&(s=n?0:e.length-1),s<0&&(s=e.length+s),s>=e.length){if(n)return-1;s=e.length-1}else if(s<0){if(!n)return-1;s=0}if("string"==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:M(e,t,s,r,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,s):Uint8Array.prototype.lastIndexOf.call(e,t,s):M(e,[t],s,r,n);throw new TypeError("val must be string, number or Buffer")}function M(e,t,s,r,n){let o,i=1,a=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;i=2,a/=2,l/=2,s/=2}function c(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(n){let r=-1;for(o=s;o<a;o++)if(c(e,o)===c(t,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===l)return r*i}else-1!==r&&(o-=o-r),r=-1}else for(s+l>a&&(s=a-l),o=s;o>=0;o--){let s=!0;for(let r=0;r<l;r++)if(c(e,o+r)!==c(t,r)){s=!1;break}if(s)return o}return-1}function b(e,t,s,r){s=Number(s)||0;const n=e.length-s;r?(r=Number(r))>n&&(r=n):r=n;const o=t.length;let i;for(r>o/2&&(r=o/2),i=0;i<r;++i){const r=parseInt(t.substr(2*i,2),16);if(J(r))return i;e[s+i]=r}return i}function x(e,t,s,r){return Q(W(t,e.length-s),e,s,r)}function y(e,t,s,r){return Q(function(e){const t=[];for(let s=0;s<e.length;++s)t.push(255&e.charCodeAt(s));return t}(t),e,s,r)}function k(e,t,s,r){return Q(X(t),e,s,r)}function T(e,t,s,r){return Q(function(e,t){let s,r,n;const o=[];for(let i=0;i<e.length&&!((t-=2)<0);++i)s=e.charCodeAt(i),r=s>>8,n=s%256,o.push(n),o.push(r);return o}(t,e.length-s),e,s,r)}function v(e,t,s){return 0===t&&s===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,s))}function P(e,t,s){s=Math.min(e.length,s);const r=[];let n=t;for(;n<s;){const t=e[n];let o=null,i=t>239?4:t>223?3:t>191?2:1;if(n+i<=s){let s,r,a,l;switch(i){case 1:t<128&&(o=t);break;case 2:s=e[n+1],128==(192&s)&&(l=(31&t)<<6|63&s,l>127&&(o=l));break;case 3:s=e[n+1],r=e[n+2],128==(192&s)&&128==(192&r)&&(l=(15&t)<<12|(63&s)<<6|63&r,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:s=e[n+1],r=e[n+2],a=e[n+3],128==(192&s)&&128==(192&r)&&128==(192&a)&&(l=(15&t)<<18|(63&s)<<12|(63&r)<<6|63&a,l>65535&&l<1114112&&(o=l))}}null===o?(o=65533,i=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),n+=i}return function(e){const t=e.length;if(t<=F)return String.fromCharCode.apply(String,e);let s="",r=0;for(;r<t;)s+=String.fromCharCode.apply(String,e.slice(r,r+=F));return s}(r)}t.kMaxLength=i,l.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,s){return c(e,t,s)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,s){return function(e,t,s){return d(e),e<=0?a(e):void 0!==t?"string"==typeof s?a(e).fill(t,s):a(e).fill(t):a(e)}(e,t,s)},l.allocUnsafe=function(e){return u(e)},l.allocUnsafeSlow=function(e){return u(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(H(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),H(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let s=e.length,r=t.length;for(let n=0,o=Math.min(s,r);n<o;++n)if(e[n]!==t[n]){s=e[n],r=t[n];break}return s<r?-1:r<s?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);let s;if(void 0===t)for(t=0,s=0;s<e.length;++s)t+=e[s].length;const r=l.allocUnsafe(t);let n=0;for(s=0;s<e.length;++s){let t=e[s];if(H(t,Uint8Array))n+t.length>r.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(r,n)):Uint8Array.prototype.set.call(r,t,n);else{if(!l.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,n)}n+=t.length}return r},l.byteLength=m,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)g(this,t,t+1);return this},l.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},l.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},l.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?P(this,0,e):f.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){let e="";const s=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,s).replace(/(.{2})/g,"$1 ").trim(),this.length>s&&(e+=" ... "),"<Buffer "+e+">"},o&&(l.prototype[o]=l.prototype.inspect),l.prototype.compare=function(e,t,s,r,n){if(H(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===s&&(s=e?e.length:0),void 0===r&&(r=0),void 0===n&&(n=this.length),t<0||s>e.length||r<0||n>this.length)throw new RangeError("out of range index");if(r>=n&&t>=s)return 0;if(r>=n)return-1;if(t>=s)return 1;if(this===e)return 0;let o=(n>>>=0)-(r>>>=0),i=(s>>>=0)-(t>>>=0);const a=Math.min(o,i),c=this.slice(r,n),d=e.slice(t,s);for(let e=0;e<a;++e)if(c[e]!==d[e]){o=c[e],i=d[e];break}return o<i?-1:i<o?1:0},l.prototype.includes=function(e,t,s){return-1!==this.indexOf(e,t,s)},l.prototype.indexOf=function(e,t,s){return w(this,e,t,s,!0)},l.prototype.lastIndexOf=function(e,t,s){return w(this,e,t,s,!1)},l.prototype.write=function(e,t,s,r){if(void 0===t)r="utf8",s=this.length,t=0;else if(void 0===s&&"string"==typeof t)r=t,s=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(s)?(s>>>=0,void 0===r&&(r="utf8")):(r=s,s=void 0)}const n=this.length-t;if((void 0===s||s>n)&&(s=n),e.length>0&&(s<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return b(this,e,t,s);case"utf8":case"utf-8":return x(this,e,t,s);case"ascii":case"latin1":case"binary":return y(this,e,t,s);case"base64":return k(this,e,t,s);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,s);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const F=4096;function C(e,t,s){let r="";s=Math.min(e.length,s);for(let n=t;n<s;++n)r+=String.fromCharCode(127&e[n]);return r}function S(e,t,s){let r="";s=Math.min(e.length,s);for(let n=t;n<s;++n)r+=String.fromCharCode(e[n]);return r}function E(e,t,s){const r=e.length;(!t||t<0)&&(t=0),(!s||s<0||s>r)&&(s=r);let n="";for(let r=t;r<s;++r)n+=Y[e[r]];return n}function A(e,t,s){const r=e.slice(t,s);let n="";for(let e=0;e<r.length-1;e+=2)n+=String.fromCharCode(r[e]+256*r[e+1]);return n}function I(e,t,s){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>s)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,s,r,n,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw new RangeError('"value" argument is out of bounds');if(s+r>e.length)throw new RangeError("Index out of range")}function z(e,t,s,r,n){G(t,r,n,e,s,7);let o=Number(t&BigInt(4294967295));e[s++]=o,o>>=8,e[s++]=o,o>>=8,e[s++]=o,o>>=8,e[s++]=o;let i=Number(t>>BigInt(32)&BigInt(4294967295));return e[s++]=i,i>>=8,e[s++]=i,i>>=8,e[s++]=i,i>>=8,e[s++]=i,s}function j(e,t,s,r,n){G(t,r,n,e,s,7);let o=Number(t&BigInt(4294967295));e[s+7]=o,o>>=8,e[s+6]=o,o>>=8,e[s+5]=o,o>>=8,e[s+4]=o;let i=Number(t>>BigInt(32)&BigInt(4294967295));return e[s+3]=i,i>>=8,e[s+2]=i,i>>=8,e[s+1]=i,i>>=8,e[s]=i,s+8}function N(e,t,s,r,n,o){if(s+r>e.length)throw new RangeError("Index out of range");if(s<0)throw new RangeError("Index out of range")}function B(e,t,s,r,o){return t=+t,s>>>=0,o||N(e,0,s,4),n.write(e,t,s,r,23,4),s+4}function O(e,t,s,r,o){return t=+t,s>>>=0,o||N(e,0,s,8),n.write(e,t,s,r,52,8),s+8}l.prototype.slice=function(e,t){const s=this.length;(e=~~e)<0?(e+=s)<0&&(e=0):e>s&&(e=s),(t=void 0===t?s:~~t)<0?(t+=s)<0&&(t=0):t>s&&(t=s),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,l.prototype),r},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,s){e>>>=0,t>>>=0,s||I(e,t,this.length);let r=this[e],n=1,o=0;for(;++o<t&&(n*=256);)r+=this[e+o]*n;return r},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,s){e>>>=0,t>>>=0,s||I(e,t,this.length);let r=this[e+--t],n=1;for(;t>0&&(n*=256);)r+=this[e+--t]*n;return r},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=K((function(e){U(e>>>=0,"offset");const t=this[e],s=this[e+7];void 0!==t&&void 0!==s||$(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,n=this[++e]+256*this[++e]+65536*this[++e]+s*2**24;return BigInt(r)+(BigInt(n)<<BigInt(32))})),l.prototype.readBigUInt64BE=K((function(e){U(e>>>=0,"offset");const t=this[e],s=this[e+7];void 0!==t&&void 0!==s||$(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],n=this[++e]*2**24+65536*this[++e]+256*this[++e]+s;return(BigInt(r)<<BigInt(32))+BigInt(n)})),l.prototype.readIntLE=function(e,t,s){e>>>=0,t>>>=0,s||I(e,t,this.length);let r=this[e],n=1,o=0;for(;++o<t&&(n*=256);)r+=this[e+o]*n;return n*=128,r>=n&&(r-=Math.pow(2,8*t)),r},l.prototype.readIntBE=function(e,t,s){e>>>=0,t>>>=0,s||I(e,t,this.length);let r=t,n=1,o=this[e+--r];for(;r>0&&(n*=256);)o+=this[e+--r]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*t)),o},l.prototype.readInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||I(e,2,this.length);const s=this[e]|this[e+1]<<8;return 32768&s?4294901760|s:s},l.prototype.readInt16BE=function(e,t){e>>>=0,t||I(e,2,this.length);const s=this[e+1]|this[e]<<8;return 32768&s?4294901760|s:s},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=K((function(e){U(e>>>=0,"offset");const t=this[e],s=this[e+7];void 0!==t&&void 0!==s||$(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(s<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),l.prototype.readBigInt64BE=K((function(e){U(e>>>=0,"offset");const t=this[e],s=this[e+7];void 0!==t&&void 0!==s||$(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+s)})),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,s,r){if(e=+e,t>>>=0,s>>>=0,!r){L(this,e,t,s,Math.pow(2,8*s)-1,0)}let n=1,o=0;for(this[t]=255&e;++o<s&&(n*=256);)this[t+o]=e/n&255;return t+s},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,s,r){if(e=+e,t>>>=0,s>>>=0,!r){L(this,e,t,s,Math.pow(2,8*s)-1,0)}let n=s-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+s},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,s){return e=+e,t>>>=0,s||L(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,s){return e=+e,t>>>=0,s||L(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,s){return e=+e,t>>>=0,s||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,s){return e=+e,t>>>=0,s||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,s){return e=+e,t>>>=0,s||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigUInt64LE=K((function(e,t=0){return z(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=K((function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(e,t,s,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*s-1);L(this,e,t,s,r-1,-r)}let n=0,o=1,i=0;for(this[t]=255&e;++n<s&&(o*=256);)e<0&&0===i&&0!==this[t+n-1]&&(i=1),this[t+n]=(e/o|0)-i&255;return t+s},l.prototype.writeIntBE=function(e,t,s,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*s-1);L(this,e,t,s,r-1,-r)}let n=s-1,o=1,i=0;for(this[t+n]=255&e;--n>=0&&(o*=256);)e<0&&0===i&&0!==this[t+n+1]&&(i=1),this[t+n]=(e/o|0)-i&255;return t+s},l.prototype.writeInt8=function(e,t,s){return e=+e,t>>>=0,s||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,s){return e=+e,t>>>=0,s||L(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,s){return e=+e,t>>>=0,s||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,s){return e=+e,t>>>=0,s||L(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,s){return e=+e,t>>>=0,s||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigInt64LE=K((function(e,t=0){return z(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=K((function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(e,t,s){return B(this,e,t,!0,s)},l.prototype.writeFloatBE=function(e,t,s){return B(this,e,t,!1,s)},l.prototype.writeDoubleLE=function(e,t,s){return O(this,e,t,!0,s)},l.prototype.writeDoubleBE=function(e,t,s){return O(this,e,t,!1,s)},l.prototype.copy=function(e,t,s,r){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(s||(s=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<s&&(r=s),r===s)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(s<0||s>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-s&&(r=e.length-t+s);const n=r-s;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,s,r):Uint8Array.prototype.set.call(e,this.subarray(s,r),t),n},l.prototype.fill=function(e,t,s,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,s=this.length):"string"==typeof s&&(r=s,s=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!l.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<s)throw new RangeError("Out of range index");if(s<=t)return this;let n;if(t>>>=0,s=void 0===s?this.length:s>>>0,e||(e=0),"number"==typeof e)for(n=t;n<s;++n)this[n]=e;else{const o=l.isBuffer(e)?e:l.from(e,r),i=o.length;if(0===i)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<s-t;++n)this[n+t]=o[n%i]}return this};const V={};function D(e,t,s){V[e]=class extends s{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function R(e){let t="",s=e.length;const r="-"===e[0]?1:0;for(;s>=r+4;s-=3)t=`_${e.slice(s-3,s)}${t}`;return`${e.slice(0,s)}${t}`}function G(e,t,s,r,n,o){if(e>s||e<t){const r="bigint"==typeof t?"n":"";let n;throw n=o>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${s}${r}`,new V.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,s){U(t,"offset"),void 0!==e[t]&&void 0!==e[t+s]||$(t,e.length-(s+1))}(r,n,o)}function U(e,t){if("number"!=typeof e)throw new V.ERR_INVALID_ARG_TYPE(t,"number",e)}function $(e,t,s){if(Math.floor(e)!==e)throw U(e,s),new V.ERR_OUT_OF_RANGE(s||"offset","an integer",e);if(t<0)throw new V.ERR_BUFFER_OUT_OF_BOUNDS;throw new V.ERR_OUT_OF_RANGE(s||"offset",`>= ${s?1:0} and <= ${t}`,e)}D("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),D("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),D("ERR_OUT_OF_RANGE",(function(e,t,s){let r=`The value of "${e}" is out of range.`,n=s;return Number.isInteger(s)&&Math.abs(s)>2**32?n=R(String(s)):"bigint"==typeof s&&(n=String(s),(s>BigInt(2)**BigInt(32)||s<-(BigInt(2)**BigInt(32)))&&(n=R(n)),n+="n"),r+=` It must be ${t}. Received ${n}`,r}),RangeError);const q=/[^+/0-9A-Za-z-_]/g;function W(e,t){let s;t=t||1/0;const r=e.length;let n=null;const o=[];for(let i=0;i<r;++i){if(s=e.charCodeAt(i),s>55295&&s<57344){if(!n){if(s>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(i+1===r){(t-=3)>-1&&o.push(239,191,189);continue}n=s;continue}if(s<56320){(t-=3)>-1&&o.push(239,191,189),n=s;continue}s=65536+(n-55296<<10|s-56320)}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=null,s<128){if((t-=1)<0)break;o.push(s)}else if(s<2048){if((t-=2)<0)break;o.push(s>>6|192,63&s|128)}else if(s<65536){if((t-=3)<0)break;o.push(s>>12|224,s>>6&63|128,63&s|128)}else{if(!(s<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(s>>18|240,s>>12&63|128,s>>6&63|128,63&s|128)}}return o}function X(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Q(e,t,s,r){let n;for(n=0;n<r&&!(n+s>=t.length||n>=e.length);++n)t[n+s]=e[n];return n}function H(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let s=0;s<16;++s){const r=16*s;for(let n=0;n<16;++n)t[r+n]=e[s]+e[n]}return t}();function K(e){return"undefined"==typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},"./node_modules/ieee754/index.js":(e,t)=>{t.read=function(e,t,s,r,n){var o,i,a=8*n-r-1,l=(1<<a)-1,c=l>>1,d=-7,u=s?n-1:0,_=s?-1:1,p=e[t+u];for(u+=_,o=p&(1<<-d)-1,p>>=-d,d+=a;d>0;o=256*o+e[t+u],u+=_,d-=8);for(i=o&(1<<-d)-1,o>>=-d,d+=r;d>0;i=256*i+e[t+u],u+=_,d-=8);if(0===o)o=1-c;else{if(o===l)return i?NaN:1/0*(p?-1:1);i+=Math.pow(2,r),o-=c}return(p?-1:1)*i*Math.pow(2,o-r)},t.write=function(e,t,s,r,n,o){var i,a,l,c=8*o-n-1,d=(1<<c)-1,u=d>>1,_=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,h=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=d):(i=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-i))<1&&(i--,l*=2),(t+=i+u>=1?_/l:_*Math.pow(2,1-u))*l>=2&&(i++,l/=2),i+u>=d?(a=0,i=d):i+u>=1?(a=(t*l-1)*Math.pow(2,n),i+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,n),i=0));n>=8;e[s+p]=255&a,p+=h,a/=256,n-=8);for(i=i<<n|a,c+=n;c>0;e[s+p]=255&i,p+=h,i/=256,c-=8);e[s+p-h]|=128*m}},fs:e=>{"use strict";e.exports=require("fs")},"onnxruntime-common":e=>{"use strict";e.exports=require("onnxruntime-common")},"onnxruntime-node":e=>{"use strict";e.exports=require("onnxruntime-node")},path:e=>{"use strict";e.exports=require("path")},sharp:e=>{"use strict";e.exports=require("sharp")},url:e=>{"use strict";e.exports=require("url")},"?8b6b":()=>{},"?6ee6":()=>{},"?8af6":()=>{},"?5b7f":()=>{},"?e39f":()=>{},"./node_modules/@huggingface/jinja/dist/index.js":(e,t,s)=>{"use strict";s.r(t),s.d(t,{Environment:()=>Y,Interpreter:()=>K,Template:()=>te,parse:()=>N,tokenize:()=>d});var r=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",BooleanLiteral:"BooleanLiteral",NullLiteral:"NullLiteral",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",Macro:"Macro",EndMacro:"EndMacro"}),n=Object.freeze({set:r.Set,for:r.For,in:r.In,is:r.Is,if:r.If,else:r.Else,endif:r.EndIf,elif:r.ElseIf,endfor:r.EndFor,and:r.And,or:r.Or,not:r.Not,"not in":r.NotIn,macro:r.Macro,endmacro:r.EndMacro,true:r.BooleanLiteral,false:r.BooleanLiteral,none:r.NullLiteral,True:r.BooleanLiteral,False:r.BooleanLiteral,None:r.NullLiteral}),o=class{constructor(e,t){this.value=e,this.type=t}};function i(e){return/\w/.test(e)}function a(e){return/[0-9]/.test(e)}var l=[["{%",r.OpenStatement],["%}",r.CloseStatement],["{{",r.OpenExpression],["}}",r.CloseExpression],["(",r.OpenParen],[")",r.CloseParen],["{",r.OpenCurlyBracket],["}",r.CloseCurlyBracket],["[",r.OpenSquareBracket],["]",r.CloseSquareBracket],[",",r.Comma],[".",r.Dot],[":",r.Colon],["|",r.Pipe],["<=",r.ComparisonBinaryOperator],[">=",r.ComparisonBinaryOperator],["==",r.ComparisonBinaryOperator],["!=",r.ComparisonBinaryOperator],["<",r.ComparisonBinaryOperator],[">",r.ComparisonBinaryOperator],["+",r.AdditiveBinaryOperator],["-",r.AdditiveBinaryOperator],["*",r.MultiplicativeBinaryOperator],["/",r.MultiplicativeBinaryOperator],["%",r.MultiplicativeBinaryOperator],["=",r.Equals]],c=new Map([["n","\n"],["t","\t"],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]);function d(e,t={}){const s=[],d=function(e,t={}){return e.endsWith("\n")&&(e=e.slice(0,-1)),e=e.replace(/{#.*?#}/gs,"{##}"),t.lstrip_blocks&&(e=e.replace(/^[ \t]*({[#%])/gm,"$1")),t.trim_blocks&&(e=e.replace(/([#%]})\n/g,"$1")),e.replace(/{##}/g,"").replace(/-%}\s*/g,"%}").replace(/\s*{%-/g,"{%").replace(/-}}\s*/g,"}}").replace(/\s*{{-/g,"{{")}(e,t);let u=0;const _=e=>{let t="";for(;e(d[u]);)if("\\"!==d[u]){if(t+=d[u++],u>=d.length)throw new SyntaxError("Unexpected end of input")}else{if(++u,u>=d.length)throw new SyntaxError("Unexpected end of input");const e=d[u++],s=c.get(e);if(void 0===s)throw new SyntaxError(`Unexpected escaped character: ${e}`);t+=s}return t};e:for(;u<d.length;){const e=s.at(-1)?.type;if(void 0===e||e===r.CloseStatement||e===r.CloseExpression){let e="";for(;u<d.length&&("{"!==d[u]||"%"!==d[u+1]&&"{"!==d[u+1]);)e+=d[u++];if(e.length>0){s.push(new o(e,r.Text));continue}}_((e=>/\s/.test(e)));const t=d[u];if("-"===t||"+"===t){const e=s.at(-1)?.type;if(e===r.Text||void 0===e)throw new SyntaxError(`Unexpected character: ${t}`);switch(e){case r.Identifier:case r.NumericLiteral:case r.BooleanLiteral:case r.NullLiteral:case r.StringLiteral:case r.CloseParen:case r.CloseSquareBracket:break;default:{++u;const e=_(a);s.push(new o(`${t}${e}`,e.length>0?r.NumericLiteral:r.UnaryOperator));continue}}}for(const[e,t]of l){if(d.slice(u,u+e.length)===e){s.push(new o(e,t)),u+=e.length;continue e}}if("'"!==t&&'"'!==t)if(a(t)){const e=_(a);s.push(new o(e,r.NumericLiteral))}else{if(!i(t))throw new SyntaxError(`Unexpected character: ${t}`);{const e=_(i),t=Object.hasOwn(n,e)?n[e]:r.Identifier;t===r.In&&s.at(-1)?.type===r.Not?(s.pop(),s.push(new o("not in",r.NotIn))):s.push(new o(e,t))}}else{++u;const e=_((e=>e!==t));s.push(new o(e,r.StringLiteral)),++u}}return s}var u=class{type="Statement"},_=class extends u{constructor(e){super(),this.body=e}type="Program"},p=class extends u{constructor(e,t,s){super(),this.test=e,this.body=t,this.alternate=s}type="If"},h=class extends u{constructor(e,t,s,r){super(),this.loopvar=e,this.iterable=t,this.body=s,this.defaultBlock=r}type="For"},m=class extends u{constructor(e,t){super(),this.assignee=e,this.value=t}type="Set"},f=class extends u{constructor(e,t,s){super(),this.name=e,this.args=t,this.body=s}type="Macro"},g=class extends u{type="Expression"},w=class extends g{constructor(e,t,s){super(),this.object=e,this.property=t,this.computed=s}type="MemberExpression"},M=class extends g{constructor(e,t){super(),this.callee=e,this.args=t}type="CallExpression"},b=class extends g{constructor(e){super(),this.value=e}type="Identifier"},x=class extends g{constructor(e){super(),this.value=e}type="Literal"},y=class extends x{type="NumericLiteral"},k=class extends x{type="StringLiteral"},T=class extends x{type="BooleanLiteral"},v=class extends x{type="NullLiteral"},P=class extends x{type="ArrayLiteral"},F=class extends x{type="TupleLiteral"},C=class extends x{type="ObjectLiteral"},S=class extends g{constructor(e,t,s){super(),this.operator=e,this.left=t,this.right=s}type="BinaryExpression"},E=class extends g{constructor(e,t){super(),this.operand=e,this.filter=t}type="FilterExpression"},A=class extends g{constructor(e,t){super(),this.iterable=e,this.test=t}type="SelectExpression"},I=class extends g{constructor(e,t,s){super(),this.operand=e,this.negate=t,this.test=s}type="TestExpression"},L=class extends g{constructor(e,t){super(),this.operator=e,this.argument=t}type="UnaryExpression"},z=class extends g{constructor(e=void 0,t=void 0,s=void 0){super(),this.start=e,this.stop=t,this.step=s}type="SliceExpression"},j=class extends g{constructor(e,t){super(),this.key=e,this.value=t}type="KeywordArgumentExpression"};function N(e){const t=new _([]);let s=0;function n(t,r){const n=e[s++];if(!n||n.type!==t)throw new Error(`Parser Error: ${r}. ${n.type} !== ${t}.`);return n}function o(){switch(e[s].type){case r.Text:return new k(n(r.Text,"Expected text token").value);case r.OpenStatement:return function(){let t;switch(n(r.OpenStatement,"Expected opening statement token"),e[s].type){case r.Set:++s,t=l(),n(r.CloseStatement,"Expected closing statement token");break;case r.If:++s,t=c(),n(r.OpenStatement,"Expected {% token"),n(r.EndIf,"Expected endif token"),n(r.CloseStatement,"Expected %} token");break;case r.Macro:++s,t=function(){const e=$();if("Identifier"!==e.type)throw new SyntaxError("Expected identifier following macro statement");const t=V();n(r.CloseStatement,"Expected closing statement token");const s=[];for(;i(r.OpenStatement,r.EndMacro);)s.push(o());return new f(e,t,s)}(),n(r.OpenStatement,"Expected {% token"),n(r.EndMacro,"Expected endmacro token"),n(r.CloseStatement,"Expected %} token");break;case r.For:++s,t=function(){const e=d(!0);if(!(e instanceof b||e instanceof F))throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${e.type} instead`);n(r.In,"Expected `in` keyword following loop variable");const t=u();n(r.CloseStatement,"Expected closing statement token");const l=[];for(;i(r.OpenStatement,r.EndFor)&&i(r.OpenStatement,r.Else);)l.push(o());const c=[];if(a(r.OpenStatement,r.Else))for(++s,++s,n(r.CloseStatement,"Expected closing statement token");i(r.OpenStatement,r.EndFor);)c.push(o());return new h(e,t,l,c)}(),n(r.OpenStatement,"Expected {% token"),n(r.EndFor,"Expected endfor token"),n(r.CloseStatement,"Expected %} token");break;default:throw new SyntaxError(`Unknown statement type: ${e[s].type}`)}return t}();case r.OpenExpression:return function(){n(r.OpenExpression,"Expected opening expression token");const e=u();return n(r.CloseExpression,"Expected closing expression token"),e}();default:throw new SyntaxError(`Unexpected token type: ${e[s].type}`)}}function i(...t){return s+t.length<=e.length&&t.some(((t,r)=>t!==e[s+r].type))}function a(...t){return s+t.length<=e.length&&t.every(((t,r)=>t===e[s+r].type))}function l(){const e=u();if(a(r.Equals)){++s;const t=l();return new m(e,t)}return e}function c(){const t=u();n(r.CloseStatement,"Expected closing statement token");const i=[],l=[];for(;e[s]?.type!==r.OpenStatement||e[s+1]?.type!==r.ElseIf&&e[s+1]?.type!==r.Else&&e[s+1]?.type!==r.EndIf;)i.push(o());if(e[s]?.type===r.OpenStatement&&e[s+1]?.type!==r.EndIf)if(++s,a(r.ElseIf))n(r.ElseIf,"Expected elseif token"),l.push(c());else for(n(r.Else,"Expected else token"),n(r.CloseStatement,"Expected closing statement token");e[s]?.type!==r.OpenStatement||e[s+1]?.type!==r.EndIf;)l.push(o());return new p(t,i,l)}function d(e=!1){const t=e?$:u,n=[t()],o=a(r.Comma);for(;o&&(++s,n.push(t()),a(r.Comma)););return o?new F(n):n[0]}function u(){return function(){const e=g();if(a(r.If)){++s;const t=g();if(a(r.Else)){++s;const r=g();return new p(t,[e],[r])}return new A(e,t)}return e}()}function g(){let t=x();for(;a(r.Or);){const r=e[s];++s;const n=x();t=new S(r,t,n)}return t}function x(){let t=N();for(;a(r.And);){const r=e[s];++s;const n=N();t=new S(r,t,n)}return t}function N(){let t;for(;a(r.Not);){const r=e[s];++s;const n=N();t=new L(r,n)}return t??function(){let t=B();for(;a(r.ComparisonBinaryOperator)||a(r.In)||a(r.NotIn);){const r=e[s];++s;const n=B();t=new S(r,t,n)}return t}()}function B(){let t=G();for(;a(r.AdditiveBinaryOperator);){const r=e[s];++s;const n=G();t=new S(r,t,n)}return t}function O(e){let t=new M(e,V());return t=R(t),a(r.OpenParen)&&(t=O(t)),t}function V(){n(r.OpenParen,"Expected opening parenthesis for arguments list");const e=function(){const e=[];for(;!a(r.CloseParen);){let t=u();if(a(r.Equals)){if(++s,!(t instanceof b))throw new SyntaxError("Expected identifier for keyword argument");const e=u();t=new j(t,e)}e.push(t),a(r.Comma)&&++s}return e}();return n(r.CloseParen,"Expected closing parenthesis for arguments list"),e}function D(){const e=[];let t=!1;for(;!a(r.CloseSquareBracket);)a(r.Colon)?(e.push(void 0),++s,t=!0):(e.push(u()),a(r.Colon)&&(++s,t=!0));if(0===e.length)throw new SyntaxError("Expected at least one argument for member/slice expression");if(t){if(e.length>3)throw new SyntaxError("Expected 0-3 arguments for slice expression");return new z(...e)}return e[0]}function R(t){for(;a(r.Dot)||a(r.OpenSquareBracket);){const o=e[s];let i;++s;const a=o.type!==r.Dot;if(a)i=D(),n(r.CloseSquareBracket,"Expected closing square bracket");else if(i=$(),"Identifier"!==i.type)throw new SyntaxError("Expected identifier following dot operator");t=new w(t,i,a)}return t}function G(){let t=U();for(;a(r.MultiplicativeBinaryOperator);){const r=e[s];++s;const n=U();t=new S(r,t,n)}return t}function U(){let e=function(){let e=function(){const e=R($());return a(r.OpenParen)?O(e):e}();for(;a(r.Pipe);){++s;let t=$();if(!(t instanceof b))throw new SyntaxError("Expected identifier for the filter");a(r.OpenParen)&&(t=O(t)),e=new E(e,t)}return e}();for(;a(r.Is);){++s;const t=a(r.Not);t&&++s;let n=$();if(n instanceof T?n=new b(n.value.toString()):n instanceof v&&(n=new b("none")),!(n instanceof b))throw new SyntaxError("Expected identifier for the test");e=new I(e,t,n)}return e}function $(){const t=e[s];switch(t.type){case r.NumericLiteral:return++s,new y(Number(t.value));case r.StringLiteral:return++s,new k(t.value);case r.BooleanLiteral:return++s,new T("true"===t.value.toLowerCase());case r.NullLiteral:return++s,new v(null);case r.Identifier:return++s,new b(t.value);case r.OpenParen:{++s;const t=d();if(e[s].type!==r.CloseParen)throw new SyntaxError(`Expected closing parenthesis, got ${e[s].type} instead`);return++s,t}case r.OpenSquareBracket:{++s;const e=[];for(;!a(r.CloseSquareBracket);)e.push(u()),a(r.Comma)&&++s;return++s,new P(e)}case r.OpenCurlyBracket:{++s;const e=new Map;for(;!a(r.CloseCurlyBracket);){const t=u();n(r.Colon,"Expected colon between key and value in object literal");const o=u();e.set(t,o),a(r.Comma)&&++s}return++s,new C(e)}default:throw new SyntaxError(`Unexpected token: ${t.type}`)}}for(;s<e.length;)t.body.push(o());return t}function B(e,t,s=1){void 0===t&&(t=e,e=0);const r=[];for(let n=e;n<t;n+=s)r.push(n);return r}function O(e,t,s,r=1){const n=Math.sign(r);n>=0?(t=(t??=0)<0?Math.max(e.length+t,0):Math.min(t,e.length),s=(s??=e.length)<0?Math.max(e.length+s,0):Math.min(s,e.length)):(t=(t??=e.length-1)<0?Math.max(e.length+t,-1):Math.min(t,e.length-1),s=(s??=-1)<-1?Math.max(e.length+s,-1):Math.min(s,e.length-1));const o=[];for(let i=t;n*i<n*s;i+=r)o.push(e[i]);return o}function V(e){return e.replace(/\b\w/g,(e=>e.toUpperCase()))}var D=class{type="RuntimeValue";value;builtins=new Map;constructor(e=void 0){this.value=e}__bool__(){return new U(!!this.value)}},R=class extends D{type="NumericValue"},G=class extends D{type="StringValue";builtins=new Map([["upper",new Q((()=>new G(this.value.toUpperCase())))],["lower",new Q((()=>new G(this.value.toLowerCase())))],["strip",new Q((()=>new G(this.value.trim())))],["title",new Q((()=>new G(V(this.value))))],["length",new R(this.value.length)],["rstrip",new Q((()=>new G(this.value.trimEnd())))],["lstrip",new Q((()=>new G(this.value.trimStart())))],["split",new Q((e=>{const t=e[0]??new H;if(!(t instanceof G||t instanceof H))throw new Error("sep argument must be a string or null");const s=e[1]??new R(-1);if(!(s instanceof R))throw new Error("maxsplit argument must be a number");let r=[];if(t instanceof H){const e=this.value.trimStart();for(const{0:t,index:n}of e.matchAll(/\S+/g)){if(-1!==s.value&&r.length>=s.value&&void 0!==n){r.push(t+e.slice(n+t.length));break}r.push(t)}}else{if(""===t.value)throw new Error("empty separator");r=this.value.split(t.value),-1!==s.value&&r.length>s.value&&r.push(r.splice(s.value).join(t.value))}return new W(r.map((e=>new G(e))))}))]])},U=class extends D{type="BooleanValue"},$=class extends D{type="ObjectValue";__bool__(){return new U(this.value.size>0)}builtins=new Map([["get",new Q((([e,t])=>{if(!(e instanceof G))throw new Error(`Object key must be a string: got ${e.type}`);return this.value.get(e.value)??t??new H}))],["items",new Q((()=>new W(Array.from(this.value.entries()).map((([e,t])=>new W([new G(e),t]))))))]])},q=class extends ${type="KeywordArgumentsValue"},W=class extends D{type="ArrayValue";builtins=new Map([["length",new R(this.value.length)]]);__bool__(){return new U(this.value.length>0)}},X=class extends W{type="TupleValue"},Q=class extends D{type="FunctionValue"},H=class extends D{type="NullValue"},J=class extends D{type="UndefinedValue"},Y=class{constructor(e){this.parent=e}variables=new Map([["namespace",new Q((e=>{if(0===e.length)return new $(new Map);if(1!==e.length||!(e[0]instanceof $))throw new Error("`namespace` expects either zero arguments or a single object argument");return e[0]}))]]);tests=new Map([["boolean",e=>"BooleanValue"===e.type],["callable",e=>e instanceof Q],["odd",e=>{if("NumericValue"!==e.type)throw new Error(`Cannot apply test "odd" to type: ${e.type}`);return e.value%2!=0}],["even",e=>{if("NumericValue"!==e.type)throw new Error(`Cannot apply test "even" to type: ${e.type}`);return e.value%2==0}],["false",e=>"BooleanValue"===e.type&&!e.value],["true",e=>"BooleanValue"===e.type&&e.value],["none",e=>"NullValue"===e.type],["string",e=>"StringValue"===e.type],["number",e=>"NumericValue"===e.type],["integer",e=>"NumericValue"===e.type&&Number.isInteger(e.value)],["iterable",e=>"ArrayValue"===e.type||"StringValue"===e.type],["mapping",e=>"ObjectValue"===e.type],["lower",e=>{const t=e.value;return"StringValue"===e.type&&t===t.toLowerCase()}],["upper",e=>{const t=e.value;return"StringValue"===e.type&&t===t.toUpperCase()}],["none",e=>"NullValue"===e.type],["defined",e=>"UndefinedValue"!==e.type],["undefined",e=>"UndefinedValue"===e.type],["equalto",(e,t)=>e.value===t.value],["eq",(e,t)=>e.value===t.value]]);set(e,t){return this.declareVariable(e,Z(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 J}catch{return new J}}},K=class{global;constructor(e){this.global=e??new Y}run(e){return this.evaluate(e,this.global)}evaluateBinaryExpression(e,t){const s=this.evaluate(e.left,t);switch(e.operator.value){case"and":return s.__bool__().value?this.evaluate(e.right,t):s;case"or":return s.__bool__().value?s:this.evaluate(e.right,t)}const r=this.evaluate(e.right,t);switch(e.operator.value){case"==":return new U(s.value==r.value);case"!=":return new U(s.value!=r.value)}if(s instanceof J||r instanceof J)throw new Error("Cannot perform operation on undefined values");if(s instanceof H||r instanceof H)throw new Error("Cannot perform operation on null values");if(s instanceof R&&r instanceof R)switch(e.operator.value){case"+":return new R(s.value+r.value);case"-":return new R(s.value-r.value);case"*":return new R(s.value*r.value);case"/":return new R(s.value/r.value);case"%":return new R(s.value%r.value);case"<":return new U(s.value<r.value);case">":return new U(s.value>r.value);case">=":return new U(s.value>=r.value);case"<=":return new U(s.value<=r.value)}else if(s instanceof W&&r instanceof W){if("+"===e.operator.value)return new W(s.value.concat(r.value))}else if(r instanceof W){const t=void 0!==r.value.find((e=>e.value===s.value));switch(e.operator.value){case"in":return new U(t);case"not in":return new U(!t)}}if((s instanceof G||r instanceof G)&&"+"===e.operator.value)return new G(s.value.toString()+r.value.toString());if(s instanceof G&&r instanceof G)switch(e.operator.value){case"in":return new U(r.value.includes(s.value));case"not in":return new U(!r.value.includes(s.value))}if(s instanceof G&&r instanceof $)switch(e.operator.value){case"in":return new U(r.value.has(s.value));case"not in":return new U(!r.value.has(s.value))}throw new SyntaxError(`Unknown operator "${e.operator.value}" between ${s.type} and ${r.type}`)}evaluateArguments(e,t){const s=[],r=new Map;for(const n of e)if("KeywordArgumentExpression"===n.type){const e=n;r.set(e.key.value,this.evaluate(e.value,t))}else{if(r.size>0)throw new Error("Positional arguments must come before keyword arguments");s.push(this.evaluate(n,t))}return[s,r]}evaluateFilterExpression(e,t){const s=this.evaluate(e.operand,t);if("Identifier"===e.filter.type){const t=e.filter;if("tojson"===t.value)return new G(ee(s));if(s instanceof W)switch(t.value){case"list":return s;case"first":return s.value[0];case"last":return s.value[s.value.length-1];case"length":return new R(s.value.length);case"reverse":return new W(s.value.reverse());case"sort":return new W(s.value.sort(((e,t)=>{if(e.type!==t.type)throw new Error(`Cannot compare different types: ${e.type} and ${t.type}`);switch(e.type){case"NumericValue":return e.value-t.value;case"StringValue":return e.value.localeCompare(t.value);default:throw new Error(`Cannot compare type: ${e.type}`)}})));case"join":return new G(s.value.map((e=>e.value)).join(""));default:throw new Error(`Unknown ArrayValue filter: ${t.value}`)}else if(s instanceof G)switch(t.value){case"length":return new R(s.value.length);case"upper":return new G(s.value.toUpperCase());case"lower":return new G(s.value.toLowerCase());case"title":return new G(V(s.value));case"capitalize":return new G(s.value.charAt(0).toUpperCase()+s.value.slice(1));case"trim":return new G(s.value.trim());case"indent":return new G(s.value.split("\n").map(((e,t)=>0===t||0===e.length?e:" "+e)).join("\n"));case"join":case"string":return s;default:throw new Error(`Unknown StringValue filter: ${t.value}`)}else{if(s instanceof R){if("abs"===t.value)return new R(Math.abs(s.value));throw new Error(`Unknown NumericValue filter: ${t.value}`)}if(s instanceof $)switch(t.value){case"items":return new W(Array.from(s.value.entries()).map((([e,t])=>new W([new G(e),t]))));case"length":return new R(s.value.size);default:throw new Error(`Unknown ObjectValue filter: ${t.value}`)}}throw new Error(`Cannot apply filter "${t.value}" to type: ${s.type}`)}if("CallExpression"===e.filter.type){const r=e.filter;if("Identifier"!==r.callee.type)throw new Error(`Unknown filter: ${r.callee.type}`);const n=r.callee.value;if("tojson"===n){const[,e]=this.evaluateArguments(r.args,t),n=e.get("indent")??new H;if(!(n instanceof R||n instanceof H))throw new Error("If set, indent must be a number");return new G(ee(s,n.value))}if("join"===n){let e;if(s instanceof G)e=Array.from(s.value);else{if(!(s instanceof W))throw new Error(`Cannot apply filter "${n}" to type: ${s.type}`);e=s.value.map((e=>e.value))}const[o,i]=this.evaluateArguments(r.args,t),a=o.at(0)??i.get("separator")??new G("");if(!(a instanceof G))throw new Error("separator must be a string");return new G(e.join(a.value))}if(s instanceof W){switch(n){case"selectattr":case"rejectattr":{const e="selectattr"===n;if(s.value.some((e=>!(e instanceof $))))throw new Error(`\`${n}\` can only be applied to array of objects`);if(r.args.some((e=>"StringLiteral"!==e.type)))throw new Error(`arguments of \`${n}\` must be strings`);const[o,i,a]=r.args.map((e=>this.evaluate(e,t)));let l;if(i){const e=t.tests.get(i.value);if(!e)throw new Error(`Unknown test: ${i.value}`);l=e}else l=(...e)=>e[0].__bool__().value;const c=s.value.filter((t=>{const s=t.value.get(o.value),r=!!s&&l(s,a);return e?r:!r}));return new W(c)}case"map":{const[,e]=this.evaluateArguments(r.args,t);if(e.has("attribute")){const t=e.get("attribute");if(!(t instanceof G))throw new Error("attribute must be a string");const r=e.get("default"),n=s.value.map((e=>{if(!(e instanceof $))throw new Error("items in map must be an object");return e.value.get(t.value)??r??new J}));return new W(n)}throw new Error("`map` expressions without `attribute` set are not