diff --git "a/_next/static/chunks/724-884b93c7198c58be.js" "b/_next/static/chunks/724-884b93c7198c58be.js" new file mode 100644--- /dev/null +++ "b/_next/static/chunks/724-884b93c7198c58be.js" @@ -0,0 +1,16 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[724],{1957:function(e,t,r){"use strict";r.d(t,{J:function(){return l}});var n=r(2265),i=r(2989),o=r(7470),a=r(2281);let s=e=>{let{color:t="black",size:r=24,...n}=e;return(0,a.jsx)(i.ny,{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...n,children:(0,a.jsx)(i.y$,{d:"M20 6 9 17l-5-5",stroke:t})})};s.displayName="Check";let l=(0,n.memo)((0,o.H)(s))},1569:function(e,t,r){"use strict";r.d(t,{_:function(){return l}});var n=r(2265),i=r(2989),o=r(7470),a=r(2281);let s=e=>{let{color:t="black",size:r=24,...n}=e;return(0,a.jsx)(i.ny,{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...n,children:(0,a.jsx)(i.y$,{d:"m6 9 6 6 6-6",stroke:t})})};s.displayName="ChevronDown";let l=(0,n.memo)((0,o.H)(s))},1378:function(e,t,r){"use strict";r.d(t,{K:function(){return l}});var n=r(2265),i=r(2989),o=r(7470),a=r(2281);let s=e=>{let{color:t="black",size:r=24,...n}=e;return(0,a.jsx)(i.ny,{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...n,children:(0,a.jsx)(i.y$,{d:"m18 15-6-6-6 6",stroke:t})})};s.displayName="ChevronUp";let l=(0,n.memo)((0,o.H)(s))},6916:function(e,t,r){"use strict";r.d(t,{l:function(){return l}});var n=r(2265),i=r(2989),o=r(7470),a=r(2281);let s=e=>{let{color:t="black",size:r=24,...n}=e;return(0,a.jsxs)(i.ny,{width:r,height:r,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...n,children:[(0,a.jsx)(i.y$,{d:"m5 8 6 6",stroke:t}),(0,a.jsx)(i.y$,{d:"m4 14 6-6 2-3",stroke:t}),(0,a.jsx)(i.y$,{d:"M2 5h12",stroke:t}),(0,a.jsx)(i.y$,{d:"M7 2h1",stroke:t}),(0,a.jsx)(i.y$,{d:"m22 22-5-10-5 10",stroke:t}),(0,a.jsx)(i.y$,{d:"M14 18h6",stroke:t})]})};s.displayName="Languages";let l=(0,n.memo)((0,o.H)(s))},7746:function(e,t,r){"use strict";r.r(t),r.d(t,{InferenceSession:function(){return y},Tensor:function(){return m},env:function(){return l},registerBackend:function(){return o}});let n={},i=[],o=(e,t,r)=>{if(t&&"function"==typeof t.init&&"function"==typeof t.createSessionHandler){let o=n[e];if(void 0===o)n[e]={backend:t,priority:r};else if(o.priority>r)return;else if(o.priority===r&&o.backend!==t)throw Error(`cannot register backend "${e}" using priority ${r}`);if(r>=0){let t=i.indexOf(e);-1!==t&&i.splice(t,1);for(let t=0;t{let t=0===e.length?i:e,r=[];for(let e of t){let t=n[e];if(t){if(t.initialized)return t.backend;if(t.aborted)continue;let n=!!t.initPromise;try{return n||(t.initPromise=t.backend.init()),await t.initPromise,t.initialized=!0,t.backend}catch(i){n||r.push({name:e,err:i}),t.aborted=!0}finally{delete t.initPromise}}}throw Error(`no available backend found. ERR: ${r.map(e=>`[${e.name}] ${e.err}`).join(", ")}`)};class s{constructor(){this.wasm={},this.webgl={},this.logLevelInternal="warning"}set logLevel(e){if(void 0!==e){if("string"!=typeof e||-1===["verbose","info","warning","error","fatal"].indexOf(e))throw Error(`Unsupported logging level: ${e}`);this.logLevelInternal=e}}get logLevel(){return this.logLevelInternal}}let l=new s,u="undefined"!=typeof BigInt64Array&&"function"==typeof BigInt64Array.from,h="undefined"!=typeof BigUint64Array&&"function"==typeof BigUint64Array.from,c=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array]]),f=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]);u&&(c.set("int64",BigInt64Array),f.set(BigInt64Array,"int64")),h&&(c.set("uint64",BigUint64Array),f.set(BigUint64Array,"uint64"));let d=e=>{let t=1;for(let r=0;r{let i=document.createElement("canvas"),o=i.getContext("2d");if(!e||!o)return n();let a=new Image;a.crossOrigin="Anonymous",a.src=e,a.onload=()=>{i.width=a.width,i.height=a.height,o.drawImage(a,0,0,i.width,i.height);let e=o.getImageData(0,0,i.width,i.height);if(void 0!==t){if(void 0!==t.height&&t.height!==i.height)throw Error("Image input config height doesn't match ImageBitmap height");if(s.height=i.height,void 0!==t.width&&t.width!==i.width)throw Error("Image input config width doesn't match ImageBitmap width");s.width=i.width}else s.height=i.height,s.width=i.width;r(p.bufferToTensor(e.data,s))}});else throw Error("Input data provided is not supported - aborted tensor creation");if(void 0!==r)return p.bufferToTensor(r,s);throw Error("Input data provided is not supported - aborted tensor creation")}toImageData(e){var t,r;let n;let i=document.createElement("canvas").getContext("2d");if(null!=i){let o=this.dims[3],a=this.dims[2],s=this.dims[1],l=void 0!==e&&void 0!==e.format?e.format:"RGB",u=void 0!==e&&(null===(t=e.norm)||void 0===t?void 0:t.mean)!==void 0?e.norm.mean:255,h=void 0!==e&&(null===(r=e.norm)||void 0===r?void 0:r.bias)!==void 0?e.norm.bias:0,c=a*o;if(void 0!==e){if(void 0!==e.height&&e.height!==a)throw Error("Image output config height doesn't match tensor height");if(void 0!==e.width&&e.width!==o)throw Error("Image output config width doesn't match tensor width");if(void 0!==e.format&&4===s&&"RGBA"!==e.format||3===s&&"RGB"!==e.format&&"BGR"!==e.format)throw Error("Tensor format doesn't match input tensor dims")}let f=0,d=1,p=2,m=3,g=0,y=c,w=2*c,_=-1;"RGBA"===l?(g=0,y=c,w=2*c,_=3*c):"RGB"===l?(g=0,y=c,w=2*c):"RBG"===l&&(g=0,w=c,y=2*c),n=i.createImageData(o,a);for(let e=0;e=e.byteLength)throw RangeError(`'byteOffset' is out of range [0, ${e.byteLength}).`);if(s=e.byteLength-a,"number"==typeof r){if(!Number.isSafeInteger(s=r))throw RangeError("'byteLength' must be an integer.");if(s<=0||a+s>e.byteLength)throw RangeError(`'byteLength' is out of range (0, ${e.byteLength-a}].`);if("object"==typeof n&&null!==n)o=n;else if(void 0!==n)throw TypeError("'options' must be an object.")}else if(void 0!==r)throw TypeError("'byteLength' must be a number.")}else if(void 0!==t)throw TypeError("'options' must be an object.");i=new Uint8Array(e,a,s)}else throw TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let s=(o.executionProviders||[]).map(e=>"string"==typeof e?e:e.name),l=await a(s);return new g(await l.createSessionHandler(i,o))}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}}let y=g},8738:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,o=l(e),a=o[0],s=o[1],u=new i((a+s)*3/4-s),h=0,c=s>0?a-4:a;for(r=0;r>16&255,u[h++]=t>>8&255,u[h++]=255&t;return 2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[h++]=255&t),1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[h++]=t>>8&255,u[h++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=0,s=n-i;a>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return o.join("")}(e,a,a+16383>s?s:a+16383));return 1===i?o.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&o.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=o.length;a0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},9109:function(e,t,r){"use strict";/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */var n=r(8738),i=r(6868),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function a(e){if(e>2147483647)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return h(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!s.isEncoding(t))throw TypeError("Unknown encoding: "+t);var r=0|p(e,t),n=a(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(I(e,Uint8Array)){var t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return c(e)}(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(I(e,ArrayBuffer)||e&&I(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(I(e,SharedArrayBuffer)||e&&I(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return s.from(n,t,r);var i=function(e){if(s.isBuffer(e)){var t,r=0|d(e.length),n=a(r);return 0===n.length||e.copy(n,0,0,r),n}return void 0!==e.length?"number"!=typeof e.length||(t=e.length)!=t?a(0):c(e):"Buffer"===e.type&&Array.isArray(e.data)?c(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return u(e),a(e<0?0:0|d(e))}function c(e){for(var t=e.length<0?0:0|d(e.length),r=a(t),n=0;n=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||I(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return C(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return S(e).length;default:if(i)return n?-1:C(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,r){var i,o,a=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),(o=r=+r)!=o&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return -1;r=e.length-1}else if(r<0){if(!i)return -1;r=0}if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:w(e,t,r,n,i);if("number"==typeof t)return(t&=255,"function"==typeof Uint8Array.prototype.indexOf)?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):w(e,[t],r,n,i);throw TypeError("val must be string, number or Buffer")}function w(e,t,r,n,i){var o,a=1,s=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;a=2,s/=2,l/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var h=-1;for(o=r;os&&(r=s-l),o=r;o>=0;o--){for(var c=!0,f=0;f239?4:u>223?3:u>191?2:1;if(i+c<=r)switch(c){case 1:u<128&&(h=u);break;case 2:(192&(o=e[i+1]))==128&&(l=(31&u)<<6|63&o)>127&&(h=l);break;case 3:o=e[i+1],a=e[i+2],(192&o)==128&&(192&a)==128&&(l=(15&u)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(h=l);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],(192&o)==128&&(192&a)==128&&(192&s)==128&&(l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(h=l)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",n=0;nr)throw RangeError("Trying to access beyond buffer length")}function b(e,t,r,n,i,o){if(!s.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw RangeError("Index out of range")}function x(e,t,r,n,i,o){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function E(e,t,r,n,o){return t=+t,r>>>=0,o||x(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function k(e,t,r,n,o){return t=+t,r>>>=0,o||x(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}t.lW=s,t.h2=50,s.TYPED_ARRAY_SUPPORT=function(){try{var 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}}(),s.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(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(e,t,r){return(u(e),e<=0)?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)},s.allocUnsafe=function(e){return h(e)},s.allocUnsafeSlow=function(e){return h(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(I(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),I(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);in.length?s.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else if(s.isBuffer(o))o.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=o.length}return n},s.byteLength=p,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},o&&(s.prototype[o]=s.prototype.inspect),s.prototype.compare=function(e,t,r,n,i){if(I(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var o=i-n,a=r-t,l=Math.min(o,a),u=this.slice(n,i),h=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,o,a,s,l,u,h,c,f=this.length-t;if((void 0===r||r>f)&&(r=f),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var d=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var a=0;a>8,i.push(r%256),i.push(n);return i}(e,this.length-h),this,h,c);default:if(d)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},s.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||v(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},s.prototype.readInt8=function(e,t){return(e>>>=0,t||v(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||v(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;b(this,e,t,r,i,0)}var o=1,a=0;for(this[t]=255&e;++a>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;b(this,e,t,r,i,0)}var o=r-1,a=1;for(this[t+o]=255&e;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||b(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},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||b(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},s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);b(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);b(this,e,t,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||b(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},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||b(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},s.prototype.writeFloatLE=function(e,t,r){return E(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return E(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return k(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return k(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&r<57344){if(!i){if(r>56319||a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return o}function S(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(A,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,r,n){for(var i=0;i=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function I(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var M=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},6868:function(e,t){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */t.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,l=(1<>1,h=-7,c=r?i-1:0,f=r?-1:1,d=e[t+c];for(c+=f,o=d&(1<<-h)-1,d>>=-h,h+=s;h>0;o=256*o+e[t+c],c+=f,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=256*a+e[t+c],c+=f,h-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=u}return(d?-1:1)*a*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var a,s,l,u=8*o-i-1,h=(1<>1,f=23===i?5960464477539062e-23:0,d=n?0:o-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(s=isNaN(t)?1:0,a=h):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+c>=1?t+=f/l:t+=f*Math.pow(2,1-c),t*l>=2&&(a++,l/=2),a+c>=h?(s=0,a=h):a+c>=1?(s=(t*l-1)*Math.pow(2,i),a+=c):(s=t*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;e[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;e[r+d]=255&a,d+=p,a/=256,u-=8);e[r+d-p]|=128*m}},8464:function(e,t,r){!function(){var t={452:function(e){"use strict";e.exports=r(6405)}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var o=n[e]={exports:{}},a=!0;try{t[e](o,o.exports,i),a=!1}finally{a&&delete n[e]}return o.exports}i.ab="//";var o={};!function(){var e,t=(e=i(452))&&"object"==typeof e&&"default"in e?e.default:e,r=/https?|ftp|gopher|file/;function n(e){"string"==typeof e&&(e=y(e));var n,i,o,a,s,l,u,h,c,f=(i=(n=e).auth,o=n.hostname,a=n.protocol||"",s=n.pathname||"",l=n.hash||"",u=n.query||"",h=!1,i=i?encodeURIComponent(i).replace(/%3A/i,":")+"@":"",n.host?h=i+n.host:o&&(h=i+(~o.indexOf(":")?"["+o+"]":o),n.port&&(h+=":"+n.port)),u&&"object"==typeof u&&(u=t.encode(u)),c=n.search||u&&"?"+u||"",a&&":"!==a.substr(-1)&&(a+=":"),n.slashes||(!a||r.test(a))&&!1!==h?(h="//"+(h||""),s&&"/"!==s[0]&&(s="/"+s)):h||(h=""),l&&"#"!==l[0]&&(l="#"+l),c&&"?"!==c[0]&&(c="?"+c),{protocol:a,host:h,pathname:s=s.replace(/[?#]/g,encodeURIComponent),search:c=c.replace("#","%23"),hash:l});return""+f.protocol+f.host+f.pathname+f.search+f.hash}var a="http://",s=a+"w.w",l=/^([a-z0-9.+-]*:\/\/\/)([a-z0-9.+-]:\/*)?/i,u=/https?|ftp|gopher|file/;function h(e,t){var r="string"==typeof e?y(e):e;e="object"==typeof e?n(e):e;var i=y(t),o="";r.protocol&&!r.slashes&&(o=r.protocol,e=e.replace(r.protocol,""),o+="/"===t[0]||"/"===e[0]?"/":""),o&&i.protocol&&(o="",i.slashes||(o=i.protocol,t=t.replace(i.protocol,"")));var h=e.match(l);h&&!i.protocol&&(e=e.substr((o=h[1]+(h[2]||"")).length),/^\/\/[^/]/.test(t)&&(o=o.slice(0,-1)));var c=new URL(e,s+"/"),f=new URL(t,c).toString().replace(s,""),d=i.protocol||r.protocol;return d+=r.slashes||i.slashes?"//":"",!o&&d?f=f.replace(a,d):o&&(f=f.replace(a,"")),u.test(f)||~t.indexOf(".")||"/"===e.slice(-1)||"/"===t.slice(-1)||"/"!==f.slice(-1)||(f=f.slice(0,-1)),o&&(f=o+("/"===f[0]?f.substr(1):f)),f}function c(){}c.prototype.parse=y,c.prototype.format=n,c.prototype.resolve=h,c.prototype.resolveObject=h;var f=/^https?|ftp|gopher|file/,d=/^(.*?)([#?].*)/,p=/^([a-z0-9.+-]*:)(\/{0,3})(.*)/i,m=/^([a-z0-9.+-]*:)?\/\/\/*/i,g=/^([a-z0-9.+-]*:)(\/{0,2})\[(.*)\]$/i;function y(e,r,i){if(void 0===r&&(r=!1),void 0===i&&(i=!1),e&&"object"==typeof e&&e instanceof c)return e;var o=(e=e.trim()).match(d);e=o?o[1].replace(/\\/g,"/")+o[2]:e.replace(/\\/g,"/"),g.test(e)&&"/"!==e.slice(-1)&&(e+="/");var a=!/(^javascript)/.test(e)&&e.match(p),l=m.test(e),u="";a&&(f.test(a[1])||(u=a[1].toLowerCase(),e=""+a[2]+a[3]),a[2]||(l=!1,f.test(a[1])?(u=a[1],e=""+a[3]):e="//"+a[3]),3!==a[2].length&&1!==a[2].length||(u=a[1],e="/"+a[3]));var h,y=(o?o[1]:e).match(/^https?:\/\/[^/]+(:[0-9]+)(?=\/|$)/),w=y&&y[1],_=new c,v="",b="";try{h=new URL(e)}catch(t){v=t,u||i||!/^\/\//.test(e)||/^\/\/.+[@.]/.test(e)||(b="/",e=e.substr(1));try{h=new URL(e,s)}catch(e){return _.protocol=u,_.href=u,_}}_.slashes=l&&!b,_.host="w.w"===h.host?"":h.host,_.hostname="w.w"===h.hostname?"":h.hostname.replace(/(\[|\])/g,""),_.protocol=v?u||null:h.protocol,_.search=h.search.replace(/\\/g,"%5C"),_.hash=h.hash.replace(/\\/g,"%5C");var x=e.split("#");!_.search&&~x[0].indexOf("?")&&(_.search="?"),_.hash||""!==x[1]||(_.hash="#"),_.query=r?t.decode(h.search.substr(1)):_.search.substr(1),_.pathname=b+(a?h.pathname.replace(/['^|`]/g,function(e){return"%"+e.charCodeAt().toString(16).toUpperCase()}).replace(/((?:%[0-9A-F]{2})+)/g,function(e,t){try{return decodeURIComponent(t).split("").map(function(e){var t=e.charCodeAt();return t>256||/^[a-z0-9]$/i.test(e)?e:"%"+t.toString(16).toUpperCase()}).join("")}catch(e){return t}}):h.pathname),"about:"===_.protocol&&"blank"===_.pathname&&(_.protocol="",_.pathname=""),v&&"/"!==e[0]&&(_.pathname=_.pathname.substr(1)),u&&!f.test(u)&&"/"!==e.slice(-1)&&"/"===_.pathname&&(_.pathname=""),_.path=_.pathname+_.search,_.auth=[h.username,h.password].map(decodeURIComponent).filter(Boolean).join(":"),_.port=h.port,w&&!_.host.endsWith(w)&&(_.host+=w,_.port=w.slice(1)),_.href=b?""+_.pathname+_.search+_.hash:n(_);var E=/^(file)/.test(_.href)?["host","hostname"]:[];return Object.keys(_).forEach(function(e){~E.indexOf(e)||(_[e]=_[e]||null)}),_}o.parse=y,o.format=n,o.resolve=h,o.resolveObject=function(e,t){return y(h(e,t))},o.Url=c}(),e.exports=o}()},6405:function(e){!function(){"use strict";var t={815:function(e){e.exports=function(e,r,n,i){r=r||"&",n=n||"=";var o={};if("string"!=typeof e||0===e.length)return o;var a=/\+/g;e=e.split(r);var s=1e3;i&&"number"==typeof i.maxKeys&&(s=i.maxKeys);var l=e.length;s>0&&l>s&&(l=s);for(var u=0;u=0?(h=p.substr(0,m),c=p.substr(m+1)):(h=p,c=""),f=decodeURIComponent(h),d=decodeURIComponent(c),Object.prototype.hasOwnProperty.call(o,f))?t(o[f])?o[f].push(d):o[f]=[o[f],d]:o[f]=d}return o};var t=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},577:function(e){var t=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,o,a,s){return(o=o||"&",a=a||"=",null===e&&(e=void 0),"object"==typeof e)?n(i(e),function(i){var s=encodeURIComponent(t(i))+a;return r(e[i])?n(e[i],function(e){return s+encodeURIComponent(t(e))}).join(o):s+encodeURIComponent(t(e[i]))}).join(o):s?encodeURIComponent(t(s))+a+encodeURIComponent(t(e)):""};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function n(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n=",n.ComparisonBinaryOperator],["==",n.ComparisonBinaryOperator],["!=",n.ComparisonBinaryOperator],["<",n.ComparisonBinaryOperator],[">",n.ComparisonBinaryOperator],["+",n.AdditiveBinaryOperator],["-",n.AdditiveBinaryOperator],["*",n.MultiplicativeBinaryOperator],["/",n.MultiplicativeBinaryOperator],["%",n.MultiplicativeBinaryOperator],["=",n.Equals]],u=new Map([["n","\n"],["t"," "],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]),h=class{type="Statement"},c=class extends h{constructor(e){super(),this.body=e}type="Program"},f=class extends h{constructor(e,t,r){super(),this.test=e,this.body=t,this.alternate=r}type="If"},d=class extends h{constructor(e,t,r){super(),this.loopvar=e,this.iterable=t,this.body=r}type="For"},p=class extends h{constructor(e,t){super(),this.assignee=e,this.value=t}type="Set"},m=class extends h{type="Expression"},g=class extends m{constructor(e,t,r){super(),this.object=e,this.property=t,this.computed=r}type="MemberExpression"},y=class extends m{constructor(e,t){super(),this.callee=e,this.args=t}type="CallExpression"},w=class extends m{constructor(e){super(),this.value=e}type="Identifier"},_=class extends m{constructor(e){super(),this.value=e}type="Literal"},v=class extends _{type="NumericLiteral"},b=class extends _{type="StringLiteral"},x=class extends _{type="BooleanLiteral"},E=class extends _{type="ArrayLiteral"},k=class extends _{type="TupleLiteral"},A=class extends _{type="ObjectLiteral"},C=class extends m{constructor(e,t,r){super(),this.operator=e,this.left=t,this.right=r}type="BinaryExpression"},S=class extends m{constructor(e,t){super(),this.operand=e,this.filter=t}type="FilterExpression"},z=class extends m{constructor(e,t,r){super(),this.operand=e,this.negate=t,this.test=r}type="TestExpression"},I=class extends m{constructor(e,t){super(),this.operator=e,this.argument=t}type="UnaryExpression"},M=class extends m{constructor(e,t,r){super(),this.start=e,this.stop=t,this.step=r}type="SliceExpression"},T=class extends m{constructor(e,t){super(),this.key=e,this.value=t}type="KeywordArgumentExpression"};function O(e,t,r=1){void 0===t&&(t=e,e=0);let n=[];for(let i=e;i=0?(t=(t??=0)<0?Math.max(e.length+t,0):Math.min(t,e.length),r=(r??=e.length)<0?Math.max(e.length+r,0):Math.min(r,e.length)):(t=(t??=e.length-1)<0?Math.max(e.length+t,-1):Math.min(t,e.length-1),r=(r??=-1)<-1?Math.max(e.length+r,-1):Math.min(r,e.length-1));let o=[];for(let a=t;i*ae.toUpperCase())}var $=class{type="RuntimeValue";value;builtins=new Map;constructor(e){this.value=e}__bool__(){return new R(!!this.value)}},U=class extends ${type="NumericValue"},L=class extends ${type="StringValue";builtins=new Map([["upper",new V(()=>new L(this.value.toUpperCase()))],["lower",new V(()=>new L(this.value.toLowerCase()))],["strip",new V(()=>new L(this.value.trim()))],["title",new V(()=>new L(j(this.value)))],["length",new U(this.value.length)]])},R=class extends ${type="BooleanValue"},F=class extends ${type="ObjectValue";__bool__(){return new R(this.value.size>0)}builtins=new Map([["get",new V(([e,t])=>{if(!(e instanceof L))throw Error(`Object key must be a string: got ${e.type}`);return this.value.get(e.value)??t??new D})],["items",new V(()=>new N(Array.from(this.value.entries()).map(([e,t])=>new N([new L(e),t]))))]])},N=class extends ${type="ArrayValue";builtins=new Map([["length",new U(this.value.length)]]);__bool__(){return new R(this.value.length>0)}},P=class extends N{type="TupleValue"},V=class extends ${type="FunctionValue"},D=class extends ${type="NullValue"},q=class extends ${type="UndefinedValue"},H=class{constructor(e){this.parent=e}variables=new Map([["namespace",new V(e=>{if(0===e.length)return new F(new Map);if(1!==e.length||!(e[0]instanceof F))throw 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 V],["odd",e=>{if("NumericValue"!==e.type)throw Error(`Cannot apply test "odd" to type: ${e.type}`);return e.value%2!=0}],["even",e=>{if("NumericValue"!==e.type)throw 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],["number",e=>"NumericValue"===e.type],["integer",e=>"NumericValue"===e.type&&Number.isInteger(e.value)],["iterable",e=>e instanceof N||e instanceof L],["lower",e=>{let t=e.value;return"StringValue"===e.type&&t===t.toLowerCase()}],["upper",e=>{let 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]]);set(e,t){return this.declareVariable(e,function e(t){switch(typeof t){case"number":return new U(t);case"string":return new L(t);case"boolean":return new R(t);case"object":if(null===t)return new D;if(Array.isArray(t))return new N(t.map(e));return new F(new Map(Object.entries(t).map(([t,r])=>[t,e(r)])));case"function":return new V((r,n)=>e(t(...r.map(e=>e.value))??null));default:throw Error(`Cannot convert to runtime value: ${t}`)}}(t))}declareVariable(e,t){if(this.variables.has(e))throw 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 Error(`Unknown variable: ${e}`)}lookupVariable(e){try{return this.resolve(e).variables.get(e)??new q}catch{return new q}}},W=class{global;constructor(e){this.global=e??new H}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 n=this.evaluate(e.right,t);switch(e.operator.value){case"==":return new R(r.value==n.value);case"!=":return new R(r.value!=n.value)}if(r instanceof q||n instanceof q)throw Error("Cannot perform operation on undefined values");if(r instanceof D||n instanceof D)throw Error("Cannot perform operation on null values");if(r instanceof U&&n instanceof U)switch(e.operator.value){case"+":return new U(r.value+n.value);case"-":return new U(r.value-n.value);case"*":return new U(r.value*n.value);case"/":return new U(r.value/n.value);case"%":return new U(r.value%n.value);case"<":return new R(r.value":return new R(r.value>n.value);case">=":return new R(r.value>=n.value);case"<=":return new R(r.value<=n.value)}else if(r instanceof N&&n instanceof N){if("+"===e.operator.value)return new N(r.value.concat(n.value))}else if(n instanceof N){let t=void 0!==n.value.find(e=>e.value===r.value);switch(e.operator.value){case"in":return new R(t);case"not in":return new R(!t)}}if((r instanceof L||n instanceof L)&&"+"===e.operator.value)return new L(r.value.toString()+n.value.toString());if(r instanceof L&&n instanceof L)switch(e.operator.value){case"in":return new R(n.value.includes(r.value));case"not in":return new R(!n.value.includes(r.value))}if(r instanceof L&&n instanceof F)switch(e.operator.value){case"in":return new R(n.value.has(r.value));case"not in":return new R(!n.value.has(r.value))}throw SyntaxError(`Unknown operator "${e.operator.value}" between ${r.type} and ${n.type}`)}evaluateFilterExpression(e,t){let r=this.evaluate(e.operand,t);if("Identifier"===e.filter.type){let t=e.filter;if(r instanceof N)switch(t.value){case"list":return r;case"first":return r.value[0];case"last":return r.value[r.value.length-1];case"length":return new U(r.value.length);case"reverse":return new N(r.value.reverse());case"sort":return new N(r.value.sort((e,t)=>{if(e.type!==t.type)throw 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 Error(`Cannot compare type: ${e.type}`)}}));default:throw Error(`Unknown ArrayValue filter: ${t.value}`)}else if(r instanceof L)switch(t.value){case"length":return new U(r.value.length);case"upper":return new L(r.value.toUpperCase());case"lower":return new L(r.value.toLowerCase());case"title":return new L(j(r.value));case"capitalize":return new L(r.value.charAt(0).toUpperCase()+r.value.slice(1));case"trim":return new L(r.value.trim());default:throw Error(`Unknown StringValue filter: ${t.value}`)}else if(r instanceof U){if("abs"===t.value)return new U(Math.abs(r.value));throw Error(`Unknown NumericValue filter: ${t.value}`)}else if(r instanceof F)switch(t.value){case"items":return new N(Array.from(r.value.entries()).map(([e,t])=>new N([new L(e),t])));case"length":return new U(r.value.size);default:throw Error(`Unknown ObjectValue filter: ${t.value}`)}throw Error(`Cannot apply filter "${t.value}" to type: ${r.type}`)}if("CallExpression"===e.filter.type){let n=e.filter;if("Identifier"!==n.callee.type)throw Error(`Unknown filter: ${n.callee.type}`);let i=n.callee.value;if(r instanceof N){if("selectattr"===i){let e;if(r.value.some(e=>!(e instanceof F)))throw Error("`selectattr` can only be applied to array of objects");if(n.args.some(e=>"StringLiteral"!==e.type))throw Error("arguments of `selectattr` must be strings");let[i,o,a]=n.args.map(e=>this.evaluate(e,t));if(o){let r=t.tests.get(o.value);if(!r)throw Error(`Unknown test: ${o.value}`);e=r}else e=(...e)=>e[0].__bool__().value;return new N(r.value.filter(t=>{let r=t.value.get(i.value);return!!r&&e(r,a)}))}throw Error(`Unknown ArrayValue filter: ${i}`)}throw Error(`Cannot apply filter "${i}" to type: ${r.type}`)}throw Error(`Unknown filter: ${e.filter.type}`)}evaluateTestExpression(e,t){let r=this.evaluate(e.operand,t),n=t.tests.get(e.test.value);if(!n)throw Error(`Unknown test: ${e.test.value}`);let i=n(r);return new R(e.negate?!i:i)}evaluateUnaryExpression(e,t){let r=this.evaluate(e.argument,t);if("not"===e.operator.value)return new R(!r.value);throw SyntaxError(`Unknown operator: ${e.operator.value}`)}evalProgram(e,t){return this.evaluateBlock(e.body,t)}evaluateBlock(e,t){let r="";for(let n of e){let e=this.evaluate(n,t);"NullValue"!==e.type&&"UndefinedValue"!==e.type&&(r+=e.value)}return new L(r)}evaluateIdentifier(e,t){return t.lookupVariable(e.value)}evaluateCallExpression(e,t){let r=[],n=new Map;for(let i of e.args)"KeywordArgumentExpression"===i.type?n.set(i.key.value,this.evaluate(i.value,t)):r.push(this.evaluate(i,t));n.size>0&&r.push(new F(n));let i=this.evaluate(e.callee,t);if("FunctionValue"!==i.type)throw Error(`Cannot call something that is not a function: got ${i.type}`);return i.value(r,t)}evaluateSliceExpression(e,t,r){if(!(e instanceof N||e instanceof L))throw Error("Slice object must be an array or string");let n=this.evaluate(t.start,r),i=this.evaluate(t.stop,r),o=this.evaluate(t.step,r);if(!(n instanceof U||n instanceof q))throw Error("Slice start must be numeric or undefined");if(!(i instanceof U||i instanceof q))throw Error("Slice stop must be numeric or undefined");if(!(o instanceof U||o instanceof q))throw Error("Slice step must be numeric or undefined");return e instanceof N?new N(B(e.value,n.value,i.value,o.value)):new L(B(Array.from(e.value),n.value,i.value,o.value).join(""))}evaluateMemberExpression(e,t){let r,n;let i=this.evaluate(e.object,t);if(e.computed){if("SliceExpression"===e.property.type)return this.evaluateSliceExpression(i,e.property,t);r=this.evaluate(e.property,t)}else r=new L(e.property.value);if(i instanceof F){if(!(r instanceof L))throw Error(`Cannot access property with non-string: got ${r.type}`);n=i.value.get(r.value)??i.builtins.get(r.value)}else if(i instanceof N||i instanceof L){if(r instanceof U)n=i.value.at(r.value),i instanceof L&&(n=new L(i.value.at(r.value)));else if(r instanceof L)n=i.builtins.get(r.value);else throw Error(`Cannot access property with non-string/non-number: got ${r.type}`)}else{if(!(r instanceof L))throw Error(`Cannot access property with non-string: got ${r.type}`);n=i.builtins.get(r.value)}return n instanceof $?n:new q}evaluateSet(e,t){let r=this.evaluate(e.value,t);if("Identifier"===e.assignee.type){let n=e.assignee.value;t.setVariable(n,r)}else if("MemberExpression"===e.assignee.type){let n=e.assignee,i=this.evaluate(n.object,t);if(!(i instanceof F))throw Error("Cannot assign to member of non-object");if("Identifier"!==n.property.type)throw Error("Cannot assign to member with non-identifier property");i.value.set(n.property.value,r)}else throw Error(`Invalid LHS inside assignment expression: ${JSON.stringify(e.assignee)}`);return new D}evaluateIf(e,t){let r=this.evaluate(e.test,t);return this.evaluateBlock(r.__bool__().value?e.body:e.alternate,t)}evaluateFor(e,t){let r=new H(t),n=this.evaluate(e.iterable,r);if(!(n instanceof N))throw Error(`Expected iterable type in for loop: got ${n.type}`);let i="";for(let t=0;t0?n.value[t-1]:new q],["nextitem",ta.value.length?"few":"many"} items to unpack`);for(let e=0;ethis.evaluate(e,t)));case"TupleLiteral":return new P(e.value.map(e=>this.evaluate(e,t)));case"ObjectLiteral":{let r=new Map;for(let[n,i]of e.value){let e=this.evaluate(n,t);if(!(e instanceof L))throw Error(`Object keys must be strings: got ${e.type}`);r.set(e.value,this.evaluate(i,t))}return new F(r)}case"Identifier":return this.evaluateIdentifier(e,t);case"CallExpression":return this.evaluateCallExpression(e,t);case"MemberExpression":return this.evaluateMemberExpression(e,t);case"UnaryExpression":return this.evaluateUnaryExpression(e,t);case"BinaryExpression":return this.evaluateBinaryExpression(e,t);case"FilterExpression":return this.evaluateFilterExpression(e,t);case"TestExpression":return this.evaluateTestExpression(e,t);default:throw SyntaxError(`Unknown node type: ${e.type}`)}}},G=class{parsed;constructor(e){let t=function(e,t={}){let r=[],h=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),c=0,f=e=>{let t="";for(;e(h[c]);){if("\\"===h[c]){if(++c>=h.length)throw SyntaxError("Unexpected end of input");let e=h[c++],r=u.get(e);if(void 0===r)throw SyntaxError(`Unexpected escaped character: ${e}`);t+=r;continue}if(t+=h[c++],c>=h.length)throw SyntaxError("Unexpected end of input")}return t};e:for(;c0){r.push(new o(e,n.Text));continue}}f(e=>/\s/.test(e));let t=h[c];if("-"===t||"+"===t){let e=r.at(-1)?.type;if(e===n.Text||void 0===e)throw SyntaxError(`Unexpected character: ${t}`);switch(e){case n.Identifier:case n.NumericLiteral:case n.BooleanLiteral:case n.StringLiteral:case n.CloseParen:case n.CloseSquareBracket:break;default:{++c;let e=f(s);r.push(new o(`${t}${e}`,e.length>0?n.NumericLiteral:n.UnaryOperator));continue}}}for(let[e,t]of l)if(h.slice(c,c+e.length)===e){r.push(new o(e,t)),c+=e.length;continue e}if("'"===t||'"'===t){++c;let e=f(e=>e!==t);r.push(new o(e,n.StringLiteral)),++c;continue}if(s(t)){let e=f(s);r.push(new o(e,n.NumericLiteral));continue}if(a(t)){let e=f(a),t=Object.hasOwn(i,e)?i[e]:n.Identifier;t===n.In&&r.at(-1)?.type===n.Not?(r.pop(),r.push(new o("not in",n.NotIn))):r.push(new o(e,t));continue}throw SyntaxError(`Unexpected character: ${t}`)}return r}(e,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=function(e){let t=new c([]),r=0;function i(t,n){let i=e[r++];if(!i||i.type!==t)throw Error(`Parser Error: ${n}. ${i.type} !== ${t}.`);return i}function o(...t){return r+t.length<=e.length&&t.every((t,n)=>t===e[r+n].type)}function a(e=!1){let t=e?j:s,i=[t()],a=o(n.Comma);for(;a&&(++r,i.push(t()),o(n.Comma)););return a?new k(i):i[0]}function s(){return function(){let e=l();if(o(n.If)){++r;let t=l();return i(n.Else,"Expected else token"),new f(t,[e],[l()])}return e}()}function l(){let t=u();for(;o(n.Or);){let n=e[r];++r,t=new C(n,t,u())}return t}function u(){let t=h();for(;o(n.And);){let n=e[r];++r,t=new C(n,t,h())}return t}function h(){let t;for(;o(n.Not);){let n=e[r];++r,t=new I(n,h())}return t??function(){let t=m();for(;o(n.ComparisonBinaryOperator)||o(n.In)||o(n.NotIn);){let n=e[r];++r,t=new C(n,t,m())}return t}()}function m(){let t=O();for(;o(n.AdditiveBinaryOperator);){let n=e[r];++r,t=new C(n,t,O())}return t}function _(e){let t=new y(e,function(){i(n.OpenParen,"Expected opening parenthesis for arguments list");let e=function(){let e=[];for(;!o(n.CloseParen);){let t=s();if(o(n.Equals)){if(++r,!(t instanceof w))throw SyntaxError("Expected identifier for keyword argument");t=new T(t,s())}e.push(t),o(n.Comma)&&++r}return e}();return i(n.CloseParen,"Expected closing parenthesis for arguments list"),e}());return o(n.OpenParen)&&(t=_(t)),t}function O(){let t=B();for(;o(n.MultiplicativeBinaryOperator);){let n=e[r];++r,t=new C(n,t,B())}return t}function B(){let t=function(){let t=function(){let t=function(){let t=j();for(;o(n.Dot)||o(n.OpenSquareBracket);){let a;let l=e[r];++r;let u=l.type!==n.Dot;if(u)a=function(){let e=[],t=!1;for(;!o(n.CloseSquareBracket);)o(n.Colon)?(e.push(void 0),++r,t=!0):(e.push(s()),o(n.Colon)&&(++r,t=!0));if(0===e.length)throw SyntaxError("Expected at least one argument for member/slice expression");if(t){if(e.length>3)throw SyntaxError("Expected 0-3 arguments for slice expression");return new M(...e)}return e[0]}(),i(n.CloseSquareBracket,"Expected closing square bracket");else if("Identifier"!==(a=j()).type)throw SyntaxError("Expected identifier following dot operator");t=new g(t,a,u)}return t}();return o(n.OpenParen)?_(t):t}();for(;o(n.Pipe);){++r;let e=j();if(!(e instanceof w))throw SyntaxError("Expected identifier for the filter");o(n.OpenParen)&&(e=_(e)),t=new S(t,e)}return t}();for(;o(n.Is);){++r;let e=o(n.Not);e&&++r;let i=j();if(i instanceof x&&(i=new w(i.value.toString())),!(i instanceof w))throw SyntaxError("Expected identifier for the test");t=new z(t,e,i)}return t}function j(){let t=e[r];switch(t.type){case n.NumericLiteral:return++r,new v(Number(t.value));case n.StringLiteral:return++r,new b(t.value);case n.BooleanLiteral:return++r,new x("true"===t.value);case n.Identifier:return++r,new w(t.value);case n.OpenParen:{++r;let t=a();if(e[r].type!==n.CloseParen)throw SyntaxError(`Expected closing parenthesis, got ${e[r].type} instead`);return++r,t}case n.OpenSquareBracket:{++r;let e=[];for(;!o(n.CloseSquareBracket);)e.push(s()),o(n.Comma)&&++r;return++r,new E(e)}case n.OpenCurlyBracket:{++r;let e=new Map;for(;!o(n.CloseCurlyBracket);){let t=s();i(n.Colon,"Expected colon between key and value in object literal");let a=s();e.set(t,a),o(n.Comma)&&++r}return++r,new A(e)}default:throw SyntaxError(`Unexpected token: ${t.type}`)}}for(;rt!==e[r+n].type)}(n.OpenStatement,n.EndFor);)u.push(t());return new d(o,l,u)}(),i(n.OpenStatement,"Expected {% token"),i(n.EndFor,"Expected endfor token"),i(n.CloseStatement,"Expected %} token");break;default:throw SyntaxError(`Unknown statement type: ${e[r].type}`)}return l}();case n.OpenExpression:return function(){i(n.OpenExpression,"Expected opening expression token");let e=s();return i(n.CloseExpression,"Expected closing expression token"),e}();default:throw SyntaxError(`Unexpected token type: ${e[r].type}`)}}());return t}(t)}render(e){let t=new H;for(let[r,n]of(t.set("false",!1),t.set("true",!0),t.set("raise_exception",e=>{throw Error(e)}),t.set("range",O),Object.entries(e)))t.set(r,n);return new W(t).run(this.parsed).value}}},3515:function(e,t,r){"use strict";r.d(t,{Q8:function(){return i},QS:function(){return n}});let n=(e,t)=>()=>{},i=e=>{}},8131:function(e,t,r){"use strict";r.d(t,{__:function(){return v}});var n=r(9046),i=r(281),o=r(301),a=r(3515),s=r(8306),l=r(8970),u=r(2026),h=r(4975),c=r(9235),f=r(2265),d=r(2281),p=r(357);let m="Label",[g,y]=(0,o.k)(m,{id:void 0,controlRef:{current:null}}),w=(0,h.z)(u.J,{name:"Label",tag:"label",variants:{unstyled:{false:{size:"$true",color:"$color",backgroundColor:"transparent",display:"flex",alignItems:"center",userSelect:"none",cursor:"default",pressStyle:{color:"$colorPress"}}},size:{"...size":(e,t)=>{let r=s.f(e,t)?.height;return{...(0,l.H)(e,t),lineHeight:r?t.tokens.size[r]:void 0}}}},defaultVariants:{unstyled:"1"===p.env.TAMAGUI_HEADLESS}}),_=f.forwardRef((e,t)=>{let{htmlFor:r,id:o,...s}=e,l=f.useRef(null),u=f.useRef(null),h=(0,n.ex)(t,u),c=f.useId(),p=o??c;return i.$L&&f.useEffect(()=>{if(r){let e=document.getElementById(r);if(u.current&&e){let t=()=>e.getAttribute("aria-labelledby"),r=[p,t()].filter(Boolean).join(" ");return e.setAttribute("aria-labelledby",r),l.current=e,()=>{if(!p)return;let r=t()?.replace(p,"");""===r?e.removeAttribute("aria-labelledby"):r&&e.setAttribute("aria-labelledby",r)}}}},[p,r]),(0,d.jsx)(g,{id:p,controlRef:l,children:(0,d.jsx)(w,{id:p,htmlFor:r,...s,ref:h,onMouseDown:t=>{e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault()},onPress:t=>{if(e.onPress?.(t),i.$L){if(r||!l.current||t.defaultPrevented)return;let e=l.current.contains(t.target),n=!0===t.isTrusted;!e&&n&&(l.current.click(),l.current.focus())}else e.htmlFor&&(0,a.Q8)(e.htmlFor)}})})});_.displayName=m;let v=w.extractable((0,c.Y)(_),{neverFlatten:!0})},8030:function(e,t,r){"use strict";r.d(t,{o:function(){return d}});var n=r(4975),i=r(1386),o=r(8411),a=r(5377),s=r(2117),l=r(2265),u=r(5275),h=r(2281);function c({colors:e,locations:t,start:r,end:n,...i}){let[{height:o,width:a},c]=l.useState({height:1,width:1}),f=l.useMemo(()=>(function(e,t,r,n,i=1,o=1){let a=e.map((e,r)=>{let n=(0,s.ut)(e);if(t&&t[r]){let e=100*Math.max(0,Math.min(1,t[r]));return`${n} ${e}%`}return n});return`linear-gradient(${function(e,t,r,n){let i,o;let[a,s]=(i=[0,0],Array.isArray(r)&&(i=[null!=r[0]?r[0]:0,null!=r[1]?r[1]:0]),o=[0,1],Array.isArray(n)&&(o=[null!=n[0]?n[0]:0,null!=n[1]?n[1]:1]),[i,o]);return a[0]*=e,s[0]*=e,a[1]*=t,s[1]*=t,90+180*Math.atan2(s[1]-a[1],s[0]-a[0])/Math.PI}(i,o,r,n)}deg, ${a.join(", ")})`})(e,t,r,n,a,o),[e,t,r,n,a,o]);return(0,h.jsx)(u.Z,{...i,style:[i.style,{backgroundImage:f}],onLayout:e=>{let{width:t,height:r}=e.nativeEvent.layout;c(e=>t!==e.width||r!==e.height?{height:r,width:t}:e),i.onLayout&&i.onLayout(e)}})}let f=(0,n.z)(a.FA,{name:"LinearGradient",overflow:"hidden",position:"relative"}),d=f.styleable((e,t)=>{let r=(0,i.wN)(e),{start:n,end:a,colors:s,locations:l,children:u,...d}=r,m=(0,o.Fg)(),g=r.colors?.map(e=>m[e]?.get("web")??e)||[];return(0,h.jsxs)(f,{ref:t,...d,children:[(0,h.jsx)(c,{start:n,end:a,colors:g,locations:l,style:p}),u]})}),p={position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:0}},663:function(e,t,r){"use strict";r.d(t,{Ex:function(){return k}});var n=r(4975),i=r(2202),o=r(301),a=r(6748),s=r(2145),l=r(2545),u=r(2265),h=r(2281),c=r(357);let f="Progress",[d,p]=(0,o.b)(f),[m,g]=d(f),y="ProgressIndicator",w=(0,n.z)(l.K,{name:y,variants:{unstyled:{false:{height:"100%",width:"100%",backgrounded:!0}}},defaultVariants:{unstyled:"1"===c.env.TAMAGUI_HEADLESS}}),_=w.styleable(function(e,t){let{__scopeProgress:r,...n}=e,i=g(y,r),o=i.max-(i.value??0),a=-(0===i.width?300:i.width)*(o/100);return(0,h.jsx)(w,{"data-state":b(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,x:a,width:i.width,...!e.unstyled&&{animateOnly:["transform"],opacity:0===i.width?0:1},...n,ref:t})});function v(e,t){return`${Math.round(e/t*100)}%`}function b(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function x(e){return"number"==typeof e}let E=(0,n.z)(l.K,{name:"Progress",variants:{unstyled:{false:{borderRadius:1e5,overflow:"hidden",backgrounded:!0}},size:{"...size":e=>{let t=Math.round(.25*(0,i.Ve)((0,a.ap)(e)));return{height:t,minWidth:20*(0,i.Ve)(t),width:"100%"}}}},defaultVariants:{unstyled:"1"===c.env.TAMAGUI_HEADLESS}}),k=(0,s.$e)(E.styleable(function(e,t){let{__scopeProgress:r,value:n,max:i,getValueLabel:o=v,size:a="$true",...s}=e,l=x(i)&&!Number.isNaN(i)&&i>0?i:100,c=x(n)&&!Number.isNaN(n)&&n<=l&&n>=0?n:null,f=x(c)?o(c,l):void 0,[d,p]=u.useState(0);return(0,h.jsx)(m,{scope:r,value:c,max:l,width:d,children:(0,h.jsx)(E,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":x(c)?c:void 0,"aria-valuetext":f,role:"progressbar","data-state":b(c,l),"data-value":c??void 0,"data-max":l,...!0!==s.unstyled&&{size:a},...s,onLayout:e=>{p(e.nativeEvent.layout.width),s.onLayout?.(e)},ref:t})})}),{Indicator:_})},312:function(e,t,r){"use strict";r.d(t,{Ph:function(){return eK}});var n=r(3370),i=r(9046),o=r(281),a=r(4975),s=r(2202),l=r(9087),u=r(6748),h=r(2145),c=r(3924),f=r(8970),d=r(1676),p=r(2545),m=r(5377),g=r(2026),y=r(2875),w=r(1386),_=r(5986),v=r(5260),b=r(2281),x=r(357);let E=(0,a.z)(p.K,{name:"ListItem",tag:"li",variants:{unstyled:{false:{size:"$true",alignItems:"center",justifyContent:"space-between",flexWrap:"nowrap",width:"100%",borderColor:"$borderColor",maxWidth:"100%",overflow:"hidden",flexDirection:"row",backgroundColor:"$background"}},size:{"...size":(e,{tokens:t})=>({minHeight:t.size[e],paddingHorizontal:t.space[e],paddingVertical:(0,u.Pj)(t.space[e],{shift:-4})})},active:{true:{hoverStyle:{backgroundColor:"$background"}}},disabled:{true:{opacity:.5,pointerEvents:"none"}}},defaultVariants:{unstyled:"1"===x.env.TAMAGUI_HEADLESS}}),k=(0,a.z)(g.J,{name:"ListItemText",variants:{unstyled:{false:{color:"$color",size:"$true",flexGrow:1,flexShrink:1,ellipse:!0,cursor:"default"}}},defaultVariants:{unstyled:"1"===x.env.TAMAGUI_HEADLESS}}),A=(0,a.z)(k,{name:"ListItemSubtitle",variants:{unstyled:{false:{opacity:.6,maxWidth:"100%",color:"$color"}},size:{"...size":(e,t)=>{let r=(0,u.ap)(e,{shift:-1,excludeHalfSteps:!0});return(0,f.H)(r.key,t)}}},defaultVariants:{unstyled:"1"===x.env.TAMAGUI_HEADLESS}}),C=(0,a.z)(k,{name:"ListItemTitle"}),S=(e,{Text:t=k,Subtitle:r=A,Title:n=C}={Text:k,Subtitle:A,Title:C})=>{let i=(0,w.wN)(e),{children:o,icon:a,iconAfter:l,noTextWrap:u,theme:h,space:f,spaceFlex:p,scaleIcon:g=1,scaleSpace:x=1,unstyled:E=!1,subTitle:S,title:z,color:I,fontWeight:M,fontSize:T,fontFamily:O,letterSpacing:B,textAlign:j,ellipse:$,...U}=i,L=i.size||"$true",R=(0,c.yv)(L)*g,[F,N]=[a,l].map((0,d.Zw)({size:R,color:I})),P=(0,s.Ve)((0,_.lz)().space[i.space]??R)*x,V=(0,y.k)(t,{color:I,fontWeight:M,fontSize:T,fontFamily:O,letterSpacing:B,textAlign:j,ellipse:$,children:o});return{props:{...U,children:(0,b.jsxs)(b.Fragment,{children:[F?(0,b.jsxs)(b.Fragment,{children:[F,(0,b.jsx)(v.LZ,{size:P})]}):null,z||S?(0,b.jsxs)(m.FA,{flex:1,children:["all"===u?z:(0,b.jsx)(n,{size:L,children:z}),S?(0,b.jsx)(b.Fragment,{children:"string"==typeof S&&"all"!==u?(0,b.jsx)(r,{unstyled:E,size:L,children:S}):S}):null,V]}):V,N?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(v.LZ,{size:P}),N]}):null]})}}},z=E.styleable(function(e,t){let{props:r}=S(e);return(0,b.jsx)(E,{ref:t,...r})}),I=(0,h.$e)(z,{Text:k,Subtitle:A});var M=r(4624),T=r(6505),O=r(4077),B=r(1021),j=r(1217),$=r(3277),U=r(2265);let L={leading:!1},R="Select",F="SelectViewport";var N=r(301);let[P,V]=(0,N.b)(R),[D,q]=P(R),[H,W]=(0,N.b)(R),[G,X]=P(R),K=({__scopeSelect:e,context:t,itemContext:r,children:n})=>(0,b.jsx)(D,{isInSheet:!0,scope:e,...t,children:(0,b.jsx)(G,{scope:e,...r,children:n})});var Z=r(4243),J=r(4582),Y=r(1130),Q=r(6616);let ee=()=>!o.$L||!!(0,Q.SZ)()&&o.wT;var et=r(9018),er=r(9097);let en=e=>{let t=(0,er.GS)();return!!e&&(!0===e||!!e&&t[e])},ei=e=>{let t=en(e.sheetBreakpoint);return!1!==e.open&&t},eo="SelectContent";var ea=r(8143),es=r(4674),el=r(4887);let eu=e=>{let{__scopeSelect:t,children:r,open:n=!1,selectedIndexRef:i,listContentRef:a}=e,s=q("SelectSheetImpl",t),u=X("SelectSheetImpl",t),{setActiveIndex:h,selectedIndex:c,activeIndex:f,forceUpdate:d}=s,{setOpen:p,setSelectedIndex:m}=u,[g,y]=U.useState(0),w=ee(),_=U.useRef([]),v=U.useRef(null),x=U.useRef(null),E=U.useRef(null),k=U.useRef(!1),A=U.useRef(!0),C=U.useRef(),S=U.useRef({isMouseOutside:!1,isTyping:!1}),[z,I]=U.useState(!1),[M,T]=U.useState(!1),[O,B]=U.useState(0),[j,$]=U.useState(!1),L=U.useRef({});(0,o.LI)(()=>{queueMicrotask(()=>{n||(y(0),T(!1),h(null),I(!1))})},[n,h]),o.$L&&o.C5&&(0,o.LI)(()=>{if(!n)return;let e=e=>{S.current.isMouseOutside&&p(!1)};return document.addEventListener("mouseup",e),()=>{document.removeEventListener("mouseup",e)}},[n]);let{x:R,y:F,strategy:N,context:P,refs:V,update:H}=(0,Z.YF)({open:n,onOpenChange:p,placement:"bottom-start",whileElementsMounted:ea.Me,middleware:[(0,es.dp)({apply({rects:{reference:{width:e}}}){Object.assign(L.current,{minWidth:e+8}),V.floating.current&&Object.assign(V.floating.current.style,L.current)}}),(0,Z.aN)({listRef:_,overflowRef:v,index:c,offset:O,onFallbackChange:T,padding:10,minItemsVisible:w?10:4,referenceOverflowThreshold:20}),(0,es.cv)({crossAxis:-5})]}),W=V.floating,K=n&&g>8,J=n&&W.current&&g(window.addEventListener("resize",H),n&&H(),()=>window.removeEventListener("resize",H)),[H,n]);let Y=(0,l.z)(e=>(n?h:m)(e)),Q=[(0,Z.eS)(P,{event:"mousedown",keyboardHandlers:!1}),(0,Z.bQ)(P,{outsidePress:!1}),(0,Z.qs)(P,{role:"listbox"}),(0,Z.Rz)(P,{enabled:!M&&(J||K),onChange:B,overflowRef:v,scrollRef:V.floating}),(0,Z.c0)(P,{listRef:_,activeIndex:f||0,selectedIndex:c,onNavigate:h,scrollItemIntoView:!1}),(0,Z.ox)(P,{listRef:a,onMatch:Y,selectedIndex:c,activeIndex:f,onTypingChange:e=>{S.current.isTyping=e}})],et=(0,Z.NI)(U.useMemo(()=>Q,Q)),er=U.useMemo(()=>({...et,getReferenceProps:()=>et.getReferenceProps({ref:V.reference,className:"SelectTrigger",onKeyDown(e){"Enter"!==e.key&&"Space"!==e.code&&(" "!==e.key||S.current.isTyping)||(e.preventDefault(),p(!0))}}),getFloatingProps:e=>et.getFloatingProps({ref:V.floating,className:"Select",...e,style:{position:N,top:F??"",left:R??"",outline:0,scrollbarWidth:"none",...L.current,...e?.style},onPointerEnter(){I(!1),S.current.isMouseOutside=!1},onPointerLeave(){S.current.isMouseOutside=!0},onPointerMove(){S.current.isMouseOutside=!1,I(!1)},onKeyDown(){I(!0)},onContextMenu(e){e.preventDefault()},onScroll(e){(0,el.flushSync)(()=>{y(e.currentTarget.scrollTop)})}})}),[V.reference.current,R,F,V.floating.current,et]);return(0,o.LI)(()=>{if(n)return C.current=setTimeout(()=>{k.current=!0},300),()=>{clearTimeout(C.current)};k.current=!1,A.current=!0,B(0),T(!1),$(!1)},[n]),(0,o.LI)(()=>{!n&&S.current.isMouseOutside&&(S.current.isMouseOutside=!1)},[n]),(0,o.LI)(()=>{function e(e){let t=e.target;V.floating.current?.contains(t)||x.current?.contains(t)||E.current?.contains(t)||(p(!1),I(!1))}if(n)return document.addEventListener("pointerdown",e),()=>{document.removeEventListener("pointerdown",e)}},[n,V,p]),U.useEffect(()=>{n&&z&&null!=f&&_.current[f]?.scrollIntoView({block:"nearest"}),y(V.floating.current?.scrollTop??0)},[n,V,z,f]),U.useEffect(()=>{n&&M&&null!=c&&_.current[c]?.scrollIntoView({block:"nearest"})},[n,M,c]),(0,o.LI)(()=>{V.floating.current&&M&&(V.floating.current.style.maxHeight="")},[V,M]),(0,b.jsx)(D,{scope:t,...s,setScrollTop:y,setInnerOffset:B,fallback:M,floatingContext:P,activeIndex:f,canScrollDown:!!J,canScrollUp:!!K,controlledScrolling:z,blockSelection:j,upArrowRef:x,downArrowRef:E,update:H,children:(0,b.jsx)(G,{scope:t,...u,allowMouseUpRef:A,allowSelectRef:k,dataRef:P.dataRef,interactions:er,listRef:_,selectTimeoutRef:C,children:r})})},eh="SelectItem",[ec,ef]=P(eh),ed=E.styleable(function(e,t){let{__scopeSelect:r,value:n,disabled:a=!1,textValue:s,index:l,...u}=e,{props:h}=S({...!e.unstyled&&{ellipse:!0},...u}),{setSelectedIndex:c,listRef:f,setOpen:d,onChange:p,activeIndexSubscribe:m,valueSubscribe:g,allowMouseUpRef:y,allowSelectRef:w,setValueAtIndex:_,selectTimeoutRef:v,dataRef:x,interactions:k,shouldRenderWebNative:A,size:C,onActiveChange:z,initialValue:I}=X(eh,r),[M,T]=U.useState(I===n);U.useEffect(()=>m(e=>{l===e&&(z(n,l),f?.current[l]?.focus())}),[l]),U.useEffect(()=>g(e=>{T(e===n)}),[n]);let O=U.useId(),B=(0,i.ex)(t,e=>{o.$L&&e instanceof HTMLElement&&f&&(f.current[l]=e)});function j(){c(l),p(n),d(!1)}(0,o.LI)(()=>{_(l,n)},[l,_,n]);let $=U.useMemo(()=>k?k.getItemProps({onTouchMove(){w.current=!0,y.current=!1},onTouchEnd(){w.current=!1,y.current=!0},onKeyDown(e){"Enter"!==e.key&&(" "!==e.key||x?.current.typing)?w.current=!0:(e.preventDefault(),j())},onClick(){w.current&&j()},onMouseUp(){y.current&&(w.current&&j(),clearTimeout(v.current),v.current=setTimeout(()=>{w.current=!0}))}}):{onPress:j},[j]);return(0,b.jsx)(ec,{scope:r,value:n,textId:O||"",isSelected:M,children:A?(0,b.jsx)("option",{value:n,children:e.children}):(0,b.jsx)(E,{tag:"div",componentName:eh,ref:B,"aria-labelledby":O,"aria-selected":M,"data-state":M?"active":"inactive","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...!e.unstyled&&{backgrounded:!0,pressTheme:!0,hoverTheme:!0,focusTheme:!0,cursor:"default",size:C,outlineOffset:-.5,focusVisibleStyle:{outlineColor:"$outlineColor",outlineWidth:1,outlineStyle:"solid"}},...h,...$})})},{disableTheme:!0});var ep=r(357);let em="SelectItemText",eg=(0,a.z)(g.J,{name:em,variants:{unstyled:{false:{userSelect:"none",color:"$color",ellipse:!0}}},defaultVariants:{unstyled:"1"===ep.env.TAMAGUI_HEADLESS}}),ey=eg.styleable(function(e,t){let{__scopeSelect:r,className:n,...o}=e,a=q(em,r),s=X(em,r),l=U.useRef(null),u=(0,i.ex)(t,l),h=ef(em,r),c=U.useRef();return c.current=(0,b.jsx)(eg,{className:n,size:s.size,id:h.textId,...o,ref:u}),U.useEffect(()=>{s.initialValue!==h.value||a.selectedIndex||a.setSelectedItem(c.current)},[]),U.useEffect(()=>s.valueSubscribe(e=>{e===h.value&&a.setSelectedItem(c.current)}),[h.value]),s.shouldRenderWebNative?(0,b.jsx)(b.Fragment,{children:e.children}):(0,b.jsx)(b.Fragment,{children:c.current})}),ew="SelectScrollUpButton",e_=U.forwardRef((e,t)=>(0,b.jsx)(ex,{componentName:ew,...e,dir:"up",ref:t}));e_.displayName=ew;let ev="SelectScrollDownButton",eb=U.forwardRef((e,t)=>(0,b.jsx)(ex,{componentName:ev,...e,dir:"down",ref:t}));eb.displayName=ev;let ex=U.memo(U.forwardRef((e,t)=>{let{__scopeSelect:r,dir:n,componentName:o,...a}=e,{forceUpdate:s,open:l,fallback:u,setScrollTop:h,setInnerOffset:c,...f}=q(o,r),d=f.floatingContext?.refs.floating,p=U.useRef("idle"),g=f["down"===n?"canScrollDown":"canScrollUp"],y=U.useRef(),{x:w,y:_,refs:v,strategy:x}=(0,Z.YF)({open:l&&g,strategy:"fixed",elements:{reference:d?.current},placement:"up"===n?"top":"bottom",middleware:[(0,es.cv)(({rects:e})=>-e.floating.height)],whileElementsMounted:(...e)=>(0,ea.Me)(...e,{animationFrame:!0})}),E=(0,i.ex)(t,v.setFloating);if(!g)return null;let k=e=>{d&&(u?d.current&&(d.current.scrollTop-=e,(0,el.flushSync)(()=>h(d.current?.scrollTop??0))):(0,el.flushSync)(()=>c(t=>t-e)))};return(0,b.jsx)(m.FA,{ref:E,componentName:o,"aria-hidden":!0,...a,zIndex:1e3,position:x,left:w||0,top:_||0,width:`calc(${(d?.current?.offsetWidth??0)-2}px)`,onPointerEnter:()=>{p.current="active";let e=Date.now();cancelAnimationFrame(y.current),y.current=requestAnimationFrame(function t(){let r=d?.current;if(r){let i=Date.now(),o=i-e;e=i;let a=o/2,s="up"===n?r.scrollTop:r.scrollHeight-r.clientHeight-r.scrollTop,l="up"===n?r.scrollTop-a>0:r.scrollTop+a{p.current="idle",cancelAnimationFrame(y.current)}})})),eE="SelectTrigger",ek=!o.$L||!o.C5||window.matchMedia("(pointer:coarse)").matches,eA=U.forwardRef(function(e,t){let{__scopeSelect:r,disabled:n=!1,unstyled:o=!1,...a}=e,s=q(eE,r),l=X(eE,r),u=(0,i.ex)(t,s.floatingContext?.refs.setReference);return l.shouldRenderWebNative?null:(0,b.jsx)(I,{componentName:eE,unstyled:o,tag:"button",type:"button",id:l.id,...!o&&{backgrounded:!0,radiused:!0,hoverTheme:!0,pressTheme:!0,focusable:!0,focusVisibleStyle:{outlineStyle:"solid",outlineWidth:2,outlineColor:"$outlineColor"},borderWidth:1,size:l.size},"aria-expanded":s.open,"aria-autocomplete":"none",dir:s.dir,disabled:n,"data-disabled":n?"":void 0,...a,ref:u,...l.interactions?{...l.interactions.getReferenceProps(),...ek?{onPress(){l.setOpen(!s.open)}}:{onMouseDown(){s.floatingContext?.update(),l.setOpen(!s.open)}}}:{onPress(){l.setOpen(!s.open)}}})});var eC=r(126),eS=r(357);let ez=(0,a.z)(p.K,{name:F,variants:{unstyled:{false:{size:"$2",backgroundColor:"$background",elevate:!0,bordered:!0,userSelect:"none",outlineWidth:0}},size:{"...size":(e,{tokens:t})=>({borderRadius:t.radius[e]??e})}},defaultVariants:{unstyled:"1"===eS.env.TAMAGUI_HEADLESS}}),eI=ez.styleable(function(e,t){let{__scopeSelect:r,children:n,disableScroll:a,...s}=e,l=q(F,r),u=X(F,r),h=en(l.sheetBreakpoint);if((0,o.LI)(()=>{l.update&&l.update()},[h]),u.shouldRenderWebNative)return(0,b.jsx)(b.Fragment,{children:n});if(h||!o.$L)return(0,b.jsx)(M.b5,{hostName:`${l.scopeKey}SheetContents`,children:(0,b.jsx)(K,{__scopeSelect:r,itemContext:u,context:l,children:n})});if(!u.interactions)return null;let{style:c,className:f,...d}=u.interactions.getFloatingProps(),p=(0,i.FE)(t,l.floatingContext?.refs.setFloating);return(0,b.jsxs)(b.Fragment,{children:[!a&&!e.unstyled&&(0,b.jsx)("style",{dangerouslySetInnerHTML:{__html:eM}}),(0,b.jsx)(eC.M,{children:l.open?(0,b.jsx)(Z.wD,{context:l.floatingContext,modal:!1,children:(0,b.jsx)(ez,{size:u.size,role:"presentation",...s,...c,...d,...!e.unstyled&&{overflowY:a?void 0:c.overflow??"auto"},ref:p,children:n},"select-viewport")}):null}),!l.open&&(0,b.jsx)("div",{style:{display:"none"},children:e.children})]})}),eM=` +.is_SelectViewport { + scrollbar-width: none; + -webkit-overflow-scrolling: touch; + overscroll-behavior: contain; +} + +.is_SelectViewport::-webkit-scrollbar{ + display:none +} +`,eT="SelectValue",eO=(0,a.z)(g.J,{name:eT,userSelect:"none"}),eB=eO.styleable(function({__scopeSelect:e,children:t,placeholder:r,...n},o){let a=q(eT,e),s=X(eT,e),l=(0,i.ex)(o,a.onValueNodeChange),u=t??a.selectedItem,h=null==a.value||""===a.value?r??u:u;return(0,b.jsx)(eO,{...!n.unstyled&&{size:s.size,ellipse:!0,pointerEvents:"none"},ref:l,...n,children:function e(t){return U.Children.map(t,t=>{if(t){if(t.type?.staticConfig?.componentName===em)return t.props.children;if(t.props?.children)return e(t.props.children)}return t})}(h)})}),ej=(0,a.z)(m.sL,{name:"SelectIcon","aria-hidden":!0,children:(0,b.jsx)(j.n,{children:"â–¼"})}),e$="SelectItemIndicator",eU=(0,a.z)(m.sL,{name:em}),eL=U.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,i=X(e$,r),o=ef(e$,r);return i.shouldRenderWebNative?null:o.isSelected?(0,b.jsx)(eU,{"aria-hidden":!0,...n,ref:t}):null});eL.displayName=e$;let eR="SelectGroup",[eF,eN]=P(eR),eP=(0,a.z)(m.FA,{name:eR,width:"100%"}),eV=(0,a.z)(g.J,{tag:"select",backgroundColor:"$background",borderColor:"$borderColor",hoverStyle:{backgroundColor:"$backgroundHover"}}),eD=(0,a.z)(p.K,{name:"NativeSelect",bordered:!0,userSelect:"none",outlineWidth:0,paddingRight:10,variants:{size:{"...size":(e,t)=>{let{tokens:r}=t,n=(0,s.Ve)(r.space[e]);return{borderRadius:r.radius[e]??e,minHeight:r.size[e],paddingRight:n+20,paddingLeft:n,paddingVertical:(0,u.Pj)(e,{shift:-3})}}}},defaultVariants:{size:"$2"}}),eq=U.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,i=U.useId(),o=q(eR,r),a=X(eR,r),s=a.size??"$true",l=U.useRef(null),u=a.shouldRenderWebNative?(0,b.jsx)(eD,{asChild:!0,size:s,value:o.value,id:a.id,children:(0,b.jsx)(eV,{onChange:e=>{a.onChange(e.currentTarget.value)},size:s,ref:l,style:{color:"var(--color)",appearance:"none"},children:e.children})}):(0,b.jsx)(eP,{role:"group","aria-labelledby":i,...n,ref:t});return(0,b.jsx)(eF,{scope:r,id:i||"",children:u})});eq.displayName=eR;let eH="SelectLabel",eW=U.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,i=X(eH,r),o=eN(eH,r);return i.shouldRenderWebNative?null:(0,b.jsx)(I,{tag:"div",componentName:eH,fontWeight:"800",id:o.id,size:i.size,...n,ref:t})});eW.displayName=eH,(0,a.z)(T.Z,{name:"SelectSeparator"});let eG=e=>{let t=q("SelectSheetController",e.__scopeSelect),r=ei(t),n=en(t.sheetBreakpoint),i=(0,l.X)(r);return(0,b.jsx)(O.f,{onOpenChange:t=>{i()&&e.onOpenChange(t)},open:t.open,hidden:!1===n,children:e.children})},eX=e=>(0,b.jsx)(b.Fragment,{children:e.children}),eK=(0,h.$e)(e=>{let{__scopeSelect:t,native:r,children:i,open:a,defaultOpen:s,onOpenChange:u,value:h,defaultValue:c,onValueChange:f,disablePreventBodyScroll:d,size:p="$true",onActiveChange:m,dir:g,id:y}=e,w=U.useId(),_=t?Object.keys(t)[0]??w:w,{when:v,AdaptProvider:x}=(0,n.pV)({Contents:U.useCallback(()=>(0,b.jsx)(M.$2,{name:`${_}SheetContents`}),[_])}),E=en(v)||!o.$L?eX:eu,k=U.useReducer(()=>({}),{})[1],[A,C]=U.useState(null),[S,z]=(0,$.T)({prop:a,defaultProp:s||!1,onChange:u}),[I,T]=(0,$.T)({prop:h,defaultProp:c||"",onChange:f,transition:!0});U.useEffect(()=>{S&&j(I)},[S]),U.useEffect(()=>{j(I)},[I]);let[O,B]=U.useState(0),[j,R]=eZ(),[F,N]=eZ(),P=U.useRef(null),V=U.useRef(null),q=U.useRef([]),[H,W]=U.useState(0),[X,K]=U.useState(null);(0,o.LI)(()=>{P.current=H,V.current=O});let Z=o.$L&&(!0===r||"web"===r||Array.isArray(r)&&r.includes("web")),J=function(e,t,r=L,n=[e]){let i=(0,U.useRef)(null);return(0,U.useEffect)(()=>()=>{i.current?.cancel()},[]),(0,U.useMemo)(()=>(i.current=function(e,t,r){let n,i=!1;function o(){i=!1;let o=arguments;r&&!n&&e.apply(this,o),clearTimeout(n),n=setTimeout(()=>{n=null,r||i||e.apply(this,o),i=!1},t)}return o.cancel=()=>{i=!0},o}(e,1,r.leading),i.current),[r.leading,...n])}(e=>{B(t=>t!==e&&"number"==typeof e&&V.current!==e?(F(e),e):null)},0,{},[]);return(0,b.jsx)(x,{children:(0,b.jsx)(G,{scope:t,initialValue:U.useMemo(()=>I,[S]),size:p,activeIndexSubscribe:N,valueSubscribe:R,setOpen:z,id:y,onChange:U.useCallback(e=>{T(e),j(e)},[]),onActiveChange:(0,l.z)((...e)=>{m?.(...e)}),setSelectedIndex:W,setValueAtIndex:U.useCallback((e,t)=>{q.current[e]=t},[]),shouldRenderWebNative:Z,children:(0,b.jsx)(D,{scope:t,disablePreventBodyScroll:d,dir:g,blockSelection:!1,fallback:!1,selectedItem:A,setSelectedItem:C,forceUpdate:k,valueNode:X,onValueNodeChange:K,scopeKey:_,sheetBreakpoint:v,activeIndex:O,selectedIndex:H,setActiveIndex:J,value:I,open:S,native:r,children:(0,b.jsx)(eG,{onOpenChange:z,__scopeSelect:t,children:Z?i:(0,b.jsx)(E,{activeIndexRef:V,listContentRef:q,selectedIndexRef:P,...e,open:S,value:I,children:i})})})})})},{Adapt:n.Tr,Content:({children:e,__scopeSelect:t,zIndex:r=1e3,...n})=>{let i=q(eo,t),o=X(eo,t),a=(0,J.C)(),s=ei(i),l=(0,b.jsx)(Y.Q,{forceClassName:!0,name:a,children:e}),u=ee(),h=(0,U.useMemo)(()=>({zIndex:r,pointerEvents:i.open?"auto":"none"}),[i.open]);return o.shouldRenderWebNative?(0,b.jsx)(b.Fragment,{children:e}):s?i.open?(0,b.jsx)(b.Fragment,{children:l}):null:(0,b.jsx)(Z.ll,{children:(0,b.jsx)(Z.y0,{style:h,lockScroll:!i.disablePreventBodyScroll&&!!i.open&&!u,children:(0,b.jsx)(et.M,{loop:!0,enabled:!!i.open,trapped:!0,...n,children:l})})})},Group:eq,Icon:ej,Item:ed,ItemIndicator:eL,ItemText:ey,Label:eW,ScrollDownButton:eb,ScrollUpButton:e_,Trigger:eA,Value:eB,Viewport:eI,Sheet:B.yo.Controlled});function eZ(){let e=U.useRef();return e.current||(e.current=new Set),[t=>{e.current.forEach(e=>e(t))},U.useCallback(t=>(e.current.add(t),()=>{e.current.delete(t)}),[])]}eK.displayName=R},967:function(e,t,r){"use strict";let n;r.d(t,{ONNX:function(){return n},p:function(){return u}});var i,o,a=r(495),s=r(6388),l=r(357);let u=["wasm"];void 0!==l&&l?.release?.name==="node"?(n=a??(i||(i=r.t(a,2))),u.unshift("cpu")):(n=s??(o||(o=r.t(s,2))),"undefined"!=typeof navigator&&/iP(hone|od|ad).+16_4.+AppleWebKit/.test(navigator.userAgent)&&(n.env.wasm.simd=!1))},16:function(e,t,r){"use strict";r.d(t,{z:function(){return a}});var n=r(911);async function i(e,t){return await (0,n.yM)(e,"config.json",!0,t)}class o{constructor(e){this.model_type=null,this.is_encoder_decoder=!1,Object.assign(this,e)}static async from_pretrained(e,{progress_callback:t=null,config:r=null,cache_dir:n=null,local_files_only:o=!1,revision:a="main"}={}){return new this(r??await i(e,{progress_callback:t,config:r,cache_dir:n,local_files_only:o,revision:a}))}}class a{static async from_pretrained(...e){return o.from_pretrained(...e)}}},851:function(e,t,r){"use strict";r.d(t,{O:function(){return g}});var n=r(8386),i=r(3342),o=r(8464);let{env:a}=r(967).ONNX,s="2.17.2",l="undefined"!=typeof self&&"caches"in self,u=!y(n),h=!y(i),c=u&&h,f=c?i.dirname(i.dirname(o.fileURLToPath("file:///mnt/c/tools/projects/translator-tamagui/node_modules/@xenova/transformers/src/env.js"))):"./",d=c?i.join(f,"/.cache/"):null,p="/models/",m=c?i.join(f,p):p;a?.wasm&&(a.wasm.wasmPaths=c?i.join(f,"/dist/"):`https://cdn.jsdelivr.net/npm/@xenova/transformers@${s}/dist/`);let g={backends:{onnx:a,tfjs:{}},__dirname:f,version:s,allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!0,localModelPath:m,useFS:u,useBrowserCache:l,useFSCache:u,cacheDir:d,useCustomCache:!1,customCache:null};function y(e){return 0===Object.keys(e).length}},9078:function(e,t,r){"use strict";let n,i,o;r.d(t,{qCb:function(){return h.qC},EUT:function(){return eJ}});var a=r(2018),s=r(9454),l=r(761),u=r(911),h=r(8709),c=r(2414),f=r(851),d=r(8741);let p="undefined"!=typeof self,m=p&&"DedicatedWorkerGlobalScope"===self.constructor.name;if(p)n=(e,t)=>{if(!self.OffscreenCanvas)throw Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas(e,t)},o=self.createImageBitmap,i=self.ImageData;else if(d)o=async e=>{let t=(await e.metadata()).channels,{data:r,info:n}=await e.rotate().raw().toBuffer({resolveWithObject:!0}),i=new w(new Uint8ClampedArray(r),n.width,n.height,n.channels);return void 0!==t&&t!==n.channels&&i.convert(t),i};else throw Error("Unable to load image processing library.");let g={0:"nearest",1:"lanczos",2:"bilinear",3:"bicubic",4:"box",5:"hamming"},y=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"]]);class w{constructor(e,t,r,n){this.data=e,this.width=t,this.height=r,this.channels=n}get size(){return[this.width,this.height]}static async read(e){if(e instanceof w)return e;if("string"==typeof e||e instanceof URL)return await this.fromURL(e);throw Error(`Unsupported input type: ${typeof e}`)}static async fromURL(e){let t=await (0,u.hn)(e);if(200!==t.status)throw Error(`Unable to read image from "${e}" (${t.status} ${t.statusText})`);let r=await t.blob();return this.fromBlob(r)}static async fromBlob(e){if(p){let t=await o(e),r=n(t.width,t.height).getContext("2d");return r.drawImage(t,0,0),new this(r.getImageData(0,0,t.width,t.height).data,t.width,t.height,4)}{let t=d(await e.arrayBuffer());return await o(t)}}static fromTensor(e,t="CHW"){if(3!==e.dims.length)throw Error(`Tensor should have 3 dimensions, but has ${e.dims.length} dimensions.`);if("CHW"===t)e=e.transpose(1,2,0);else if("HWC"===t);else throw Error(`Unsupported channel format: ${t}`);if(!(e.data instanceof Uint8ClampedArray||e.data instanceof Uint8Array))throw Error(`Unsupported tensor type: ${e.type}`);switch(e.dims[2]){case 1:case 2:case 3:case 4:return new w(e.data,e.dims[1],e.dims[0],e.dims[2]);default:throw Error(`Unsupported number of channels: ${e.dims[2]}`)}}grayscale(){if(1===this.channels)return this;let e=new Uint8ClampedArray(this.width*this.height*1);switch(this.channels){case 3:case 4:for(let t=0,r=0;t=0?l=r:h=-r,i>=0?u=i:c=-i,s.drawImage(a,l,u,e,t,h,c,e,t),new w(s.getImageData(0,0,e,t).data,e,t,4).convert(o)}{let n=this.toSharp();if(r>=0&&i>=0)n=n.extract({left:Math.floor(r),top:Math.floor(i),width:e,height:t});else if(r<=0&&i<=0){let o=Math.floor(-i),a=Math.floor(-r);n=n.extend({top:o,left:a,right:e-this.width-a,bottom:t-this.height-o})}else{let o=[0,0],a=0;i<0?(o[0]=Math.floor(-i),o[1]=t-this.height-o[0]):a=Math.floor(i);let s=[0,0],l=0;r<0?(s[0]=Math.floor(-r),s[1]=e-this.width-s[0]):l=Math.floor(r),n=n.extend({top:o[0],bottom:o[1],left:s[0],right:s[1]}).extract({left:l,top:a,width:e,height:t})}return await o(n)}}async toBlob(e="image/png",t=1){if(!p)throw Error("toBlob() is only supported in browser environments.");let r=this.toCanvas();return await r.convertToBlob({type:e,quality:t})}toTensor(e="CHW"){let t=new c.es("uint8",new Uint8Array(this.data),[this.height,this.width,this.channels]);if("HWC"===e);else if("CHW"===e)t=t.permute(2,0,1);else throw Error(`Unsupported channel format: ${e}`);return t}toCanvas(){if(!p)throw Error("toCanvas() is only supported in browser environments.");let e=this.clone().rgba(),t=n(e.width,e.height),r=new i(e.data,e.width,e.height);return t.getContext("2d").putImageData(r,0,0),t}_update(e,t,r,n=null){return this.data=e,this.width=t,this.height=r,null!==n&&(this.channels=n),this}clone(){return new w(this.data.slice(),this.width,this.height,this.channels)}convert(e){if(this.channels===e)return this;switch(e){case 1:this.grayscale();break;case 3:this.rgb();break;case 4:this.rgba();break;default:throw Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this}async save(e){if(p){if(m)throw Error("Unable to save an image from a Web Worker.");let t=e.split(".").pop().toLowerCase(),r=y.get(t)??"image/png",n=await this.toBlob(r),i=URL.createObjectURL(n),o=document.createElement("a");o.href=i,o.download=e,o.click(),o.remove()}else if(f.O.useFS){let t=this.toSharp();return await t.toFile(e)}else throw Error("Unable to save the image because filesystem is disabled in this environment.")}toSharp(){if(p)throw Error("toSharp() is only supported in server-side environments.");return d(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}}async function _(e,t){let r;if("undefined"==typeof AudioContext)throw Error("Unable to load audio from path/URL since `AudioContext` is not available in your environment. Instead, audio data should be passed directly to the pipeline/processor. For more information and some example code, see https://huggingface.co/docs/transformers.js/guides/node-audio-processing.");let n=await (await (0,u.hn)(e)).arrayBuffer(),i=new AudioContext({sampleRate:t});void 0===t&&console.warn(`No sampling rate provided, using default of ${i.sampleRate}Hz.`);let o=await i.decodeAudioData(n);if(2===o.numberOfChannels){let e=Math.sqrt(2),t=o.getChannelData(0),n=o.getChannelData(1);r=new Float32Array(t.length);for(let i=0;i2595*Math.log10(1+e/700),kaldi:e=>1127*Math.log(1+e/700),slaney:(e,t=1e3,r=15,n=27/Math.log(6.4))=>e>=t?r+Math.log(e/t)*n:3*e/200};function x(e,t="htk"){let r=b[t];if(!r)throw Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?r(e):e.map(e=>r(e))}let E={htk:e=>700*(10**(e/2595)-1),kaldi:e=>700*(Math.exp(e/1127)-1),slaney:(e,t=1e3,r=15,n=Math.log(6.4)/27)=>e>=r?t*Math.exp(n*(e-r)):200*e/3};function k(e,t,r){let n=(t-e)/(r-1);return Float64Array.from({length:r},(t,r)=>e+n*r)}function A(e,t,r,n,i,o=null,a="htk",s=!1){let l;if(null!==o&&"slaney"!==o)throw Error('norm must be one of null or "slaney"');let u=k(x(r,a),x(n,a),t+2),h=function(e,t="htk"){let r=E[t];if(!r)throw Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return"number"==typeof e?r(e):e.map(e=>r(e))}(u,a);if(s){let t=i/(2*e);l=x(Float64Array.from({length:e},(e,r)=>r*t),a),h=u}else l=k(0,Math.floor(i/2),e);let c=function(e,t){let r=Float64Array.from({length:t.length-1},(e,r)=>t[r+1]-t[r]),n=Array.from({length:e.length},()=>Array(t.length));for(let r=0;rArray(e.length));for(let t=0;ti)throw Error(`frame_length (${r}) may not be larger than fft_length (${i})`);if(x!==r)throw Error(`Length of the window (${x}) must equal frame_length (${r})`);if(n<=0)throw Error("hop_length must be greater than zero");if(null===o&&null!==f)throw Error("You have provided `mel_filters` but `power` is `None`. Mel spectrogram computation is not yet supported for complex-valued spectrogram. Specify `power` to fix this issue.");if(a){if("reflect"!==s)throw Error(`pad_mode="${s}" not implemented yet.`);let t=Math.floor((i-1)/2)+1;e=function(e,t,r){let n=new e.constructor(e.length+t+r),i=e.length-1;for(let r=0;rE?v&&(S=_):S=A=_);let z=new h.vw(i),I=new Float64Array(i),M=new Float64Array(z.outputBufferSize),T=Array(A);for(let i=0;i=1;--e)I[e]-=c*I[e-1];I[0]*=1-c}for(let e=0;eMath.pow(e,.85));break;default:throw Error(`Unknown window type ${t}.`)}if(r&&(o=o.subarray(0,e)),null===n)return o;if(e>n)throw Error(`Length of the window (${e}) may not be larger than frame_length (${n})`);return o}function I(e,t=.5,r=null,n=!1){let i=e.logits,o=e.pred_boxes,[a,s,l]=i.dims;if(null!==r&&r.length!==a)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let u=[];for(let e=0;et&&o.push(e)}else{let e=(0,h.Fp)(i.data)[1];if(e===l-1)continue;o.push(e),r=(0,h.XA)(i.data)}for(let t of o){let n=d[e].data;n=function([e,t,r,n]){return[e-r/2,t-n/2,e+r/2,t+n/2]}(n),null!==a&&(n=n.map((e,t)=>e*a[(t+1)%2])),c.boxes.push(n),c.classes.push(t),c.scores.push(r[t])}}u.push(c)}return u}function M(e,t){if(!(e instanceof Float32Array||e instanceof Float64Array))throw Error(`${t} expects input to be a Float32Array or a Float64Array, but got ${e?.constructor?.name??typeof e} instead. If using the feature extractor directly, remember to use \`read_audio(url, sampling_rate)\` to obtain the raw audio data of the file/url.`)}function T(e,t,r=0,n=null){let i=e/t,o=(0,h.eT)(i)*t;return null!==n&&o>n&&(o=Math.floor(i)*t),oi?l=Math.floor(i*s/n):i>n&&(s=Math.floor(n*l/i)),await e.resize(l,s,{resample:r}))}async crop_margin(e,t=200){let r=e.clone().grayscale(),n=(0,h.VV)(r.data)[0],i=(0,h.Fp)(r.data)[0]-n;if(0===i)return e;let o=t/255,a=r.width,s=r.height,l=0,u=0;for(let e=0;ethis.preprocess(e)));return{pixel_values:(0,c.kn)(r.map(e=>e.pixel_values),0),original_sizes:r.map(e=>e.original_size),reshaped_input_sizes:r.map(e=>e.reshaped_input_size)}}}class $ extends j{post_process_semantic_segmentation(e,t=null){let r=e.logits,n=r.dims[0];if(null!==t&&t.length!==n)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let i=[];for(let e=0;eu[r]&&(u[r]=t[r],l.data[r]=e)}let h=Array(o.dims[0]),f=l.data;for(let e=0;evoid 0!==e);i.push({segmentation:l,labels:d})}return i}}class U extends j{}class L extends U{}class R extends j{}class F extends j{}class N extends j{}class P extends j{}class V extends j{}class D extends j{constructor(e){super(e),this.crop_pct=this.config.crop_pct??.875}async resize(e){let t=this.size?.shortest_edge;if(void 0===t)throw Error("Size dictionary must contain 'shortest_edge' key.");if(t<384){let r=Math.floor(t/this.crop_pct),[n,i]=this.get_resize_output_image_size(e,{shortest_edge:r});e=await e.resize(n,i,{resample:this.resample}),e=await e.center_crop(t,t)}else e=await e.resize(t,t,{resample:this.resample});return e}}class q extends D{}class H extends j{}class W extends j{}class G extends j{constructor(e){super(e),this.include_top=this.config.include_top??!0,this.include_top&&(this.image_std=this.image_std.map(e=>e*e))}}class X extends j{}class K extends X{}class Z extends j{post_process_object_detection(...e){return I(...e)}}class J extends Z{}class Y extends j{}class Q extends j{}class ee extends j{pad_image(e,t,r,n={}){let[i,o,a]=t,s=this.image_mean;Array.isArray(this.image_mean)||(s=Array(a).fill(s));let l=this.image_std;Array.isArray(l)||(l=Array(a).fill(s));let u=s.map((e,t)=>-e/l[t]);return super.pad_image(e,t,r,{center:!0,constant_values:u,...n})}}class et extends ee{}class er extends j{async _call(e){let t=await super._call(e),r=[t.pixel_values.dims[0],64,64],n=new c.es("int64",new BigInt64Array(r.reduce((e,t)=>e*t)).fill(1n),r);return{...t,pixel_mask:n}}post_process_object_detection(...e){return I(...e)}remove_low_and_no_objects(e,t,r,n){let i=[],o=[],a=[];for(let s=0;sr&&(i.push(u),o.push(f),a.push(c))}return[i,o,a]}check_segment_validity(e,t,r,n=.5,i=.8){let o=[],a=0,s=0;for(let i=0;i=n&&++s;let l=a>0&&s>0;return l&&(l=a/s>i),[l,o]}compute_segments(e,t,r,n,i,o=null,a=null){let[s,l]=a??e[0].dims,u=new c.es("int32",new Int32Array(s*l),[s,l]),h=[];if(null!==a)for(let t=0;td[t]&&(f[t]=r,d[t]=e[r].data[t])}let p=0;for(let o=0;oe!==t.dims[r]))throw Error(`The first ${r.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new c.es("int64",e.flat(1/0).map(BigInt),r)}async _call(e,t=null,r=null){let n=await super._call(e);if(t&&(n.input_points=this.reshape_input_points(t,n.original_sizes,n.reshaped_input_sizes)),r){if(!n.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");n.input_labels=this.add_input_labels(r,n.input_points)}return n}post_process_masks(e,t,r,{mask_threshold:n=0,binarize:i=!0,pad_size:o=null}={}){let a=[],s=[(o=o??this.pad_size).height,o.width];for(let o=0;on&&(e[t]=1);r=new c.es("bool",e,r.dims)}f.push(r)}a.push((0,c.kn)(f))}return a}}class eo extends j{pad_image(e,t,r,n={}){let[i,o,a]=t;return super.pad_image(e,t,{width:o+(r-o%r)%r,height:i+(r-i%r)%r},{mode:"symmetric",center:!1,constant_values:-1,...n})}}class ea extends j{async _call(e,t){Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]);let r=await Promise.all(e.map(e=>this.preprocess(e))),n=await Promise.all(t.map(e=>this.preprocess(e,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0})));return{pixel_values:(0,c.kn)(r.map((e,t)=>(0,c.d3)([e.pixel_values,n[t].pixel_values],0)),0),original_sizes:r.map(e=>e.original_size),reshaped_input_sizes:r.map(e=>e.reshaped_input_size)}}}class es extends B{constructor(e){super(e),this.config.mel_filters??=A(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,8e3,this.config.sampling_rate,"slaney","slaney"),this.window=z(this.config.n_fft,"hann")}_extract_fbank_features(e){let{data:t,dims:r}=S(e,this.window,this.config.n_fft,this.config.hop_length,{power:2,mel_filters:this.config.mel_filters,log_mel:"log10",max_num_frames:this.config.nb_max_frames}),n=(0,h.Fp)(t)[0];for(let e=0;ethis.config.n_samples?(console.warn("Attempting to extract features for audio longer than 30 seconds. If using a pipeline to extract transcript from a long audio clip, remember to specify `chunk_length_s` and/or `stride_length_s`."),t=e.slice(0,this.config.n_samples)):(t=new Float32Array(this.config.n_samples)).set(e);let{data:r,dims:n}=this._extract_fbank_features(t);return{input_features:new c.es("float32",r,[1,...n])}}}class el extends B{_zero_mean_unit_var_norm(e){let t=e.reduce((e,t)=>e+t,0)/e.length,r=e.reduce((e,r)=>e+(r-t)**2,0)/e.length;return e.map(e=>(e-t)/Math.sqrt(r+1e-7))}async _call(e){M(e,"Wav2Vec2FeatureExtractor"),e instanceof Float64Array&&(e=new Float32Array(e));let t=e;this.config.do_normalize&&(t=this._zero_mean_unit_var_norm(t));let r=[1,t.length];return{input_values:new c.es("float32",t,r),attention_mask:new c.es("int64",new BigInt64Array(t.length).fill(1n),r)}}}class eu extends B{constructor(e){super(e);let t=this.config.sampling_rate,r=A(256,this.config.num_mel_bins,20,Math.floor(t/2),t,null,"kaldi",!0);for(let e=0;e32768*e),this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,max_num_frames:t,transpose:!0})}async _call(e,{padding:t=!0,pad_to_multiple_of:r=2,do_normalize_per_mel_bins:n=!0,return_attention_mask:i=!0}={}){let o;M(e,"SeamlessM4TFeatureExtractor");let a=this._extract_fbank_features(e,this.config.max_length);if(n){let[e,t]=a.dims;for(let r=0;r0){let r=new Float32Array(t*(e+n));r.set(a.data),r.fill(this.config.padding_value,a.data.length);let s=e+n;a={data:r,dims:[s,t]},i&&(o=new c.es("int64",new BigInt64Array(s),[1,s])).data.fill(1n,0,e)}}let[s,l]=a.dims,u=this.config.stride;if(0!=s%u)throw Error(`The number of frames (${s}) must be a multiple of the stride (${u}).`);let h=new c.es("float32",a.data,a.dims).view(1,Math.floor(s/u),l*u),f={input_features:h};if(i){let e=h.dims[1],t=new c.es("int64",new BigInt64Array(e),[1,e]);if(o)for(let e=1,r=0;e0){if("rand_trunc"===r){o=!0;let r=Math.floor(Math.random()*(a+1));e=e.subarray(r,r+t),(i=this._extract_fbank_features(e,this.mel_filters_slaney,this.config.nb_max_samples)).dims=[1,...i.dims]}else throw Error(`Truncation strategy "${r}" not implemented`)}else{if(a<0){let r=new Float64Array(t);if(r.set(e),"repeat"===n)for(let n=e.length;nw.read(e)))}async function eb(e,t){return Array.isArray(e)||(e=[e]),await Promise.all(e.map(e=>"string"==typeof e||e instanceof URL?_(e,t):e instanceof Float64Array?new Float32Array(e):e))}function ex(e,t){t&&(e=e.map(e=>0|e));let[r,n,i,o]=e;return{xmin:r,ymin:n,xmax:i,ymax:o}}class eE extends l.Ag{constructor({task:e,model:t,tokenizer:r=null,processor:n=null}){super(),this.task=e,this.model=t,this.tokenizer=r,this.processor=n}async dispose(){await this.model.dispose()}}class ek extends eE{constructor(e){super(e)}async _call(e,{topk:t=1}={}){let r=this.tokenizer(e,{padding:!0,truncation:!0}),n=await this.model(r),i="multi_label_classification"===this.model.config.problem_type?e=>e.sigmoid().data:e=>(0,h.XA)(e.data),o=this.model.config.id2label,a=[];for(let e of n.logits){let r=i(e),n=(0,h.em)(r,t).map(e=>({label:o[e[0]],score:e[1]}));1===t?a.push(...n):a.push(n)}return Array.isArray(e)||1===t?a:a[0]}}class eA extends eE{constructor(e){super(e)}async _call(e,{ignore_labels:t=["O"]}={}){let r=Array.isArray(e),n=this.tokenizer(r?e:[e],{padding:!0,truncation:!0}),i=(await this.model(n)).logits,o=this.model.config.id2label,a=[];for(let e=0;e[e,t]).filter(e=>e[1]>a),u=Array.from((0,h.XA)(i.end_logits[e].data)).map((e,t)=>[e,t]).filter(e=>e[1]>a),c=(0,l.O7)(s,u).filter(e=>e[0][1]<=e[1][1]).map(e=>[e[0][1],e[1][1],e[0][0]*e[1][0]]).sort((e,t)=>t[2]-e[2]);for(let e=0;e{let t=[...o];return t[a]=e[0],{score:e[1],token:e[0],token_str:this.tokenizer.model.vocab[e[0]],sequence:this.tokenizer.decode(t,{skip_special_tokens:!0})}}))}return Array.isArray(e)?i:i[0]}}class ez extends eE{_key="generated_text";constructor(e){super(e)}async _call(e,t={}){let r;Array.isArray(e)||(e=[e]),this.model.config.prefix&&(e=e.map(e=>this.model.config.prefix+e));let n=this.model.config.task_specific_params;n&&n[this.task]&&n[this.task].prefix&&(e=e.map(e=>n[this.task].prefix+e));let i=this.tokenizer,o={padding:!0,truncation:!0};r=this instanceof eM&&"_build_translation_inputs"in i?i._build_translation_inputs(e,o,t).input_ids:i(e,o).input_ids;let a=await this.model.generate(r,t);return i.batch_decode(a,{skip_special_tokens:!0}).map(e=>({[this._key]:e}))}}class eI extends ez{_key="summary_text";constructor(e){super(e)}}class eM extends ez{_key="translation_text";constructor(e){super(e)}}function eT(e){return Array.isArray(e)&&e.every(e=>"role"in e&&"content"in e)}class eO extends eE{constructor(e){super(e)}async _call(e,t={}){let r,n,i=!1,o=!1;if("string"==typeof e)r=e=[e];else if(Array.isArray(e)&&e.every(e=>"string"==typeof e))i=!0,r=e;else{if(eT(e))e=[e];else if(Array.isArray(e)&&e.every(eT))i=!0;else throw Error("Input must be a string, an array of strings, a Chat, or an array of Chats");o=!0,r=e.map(e=>this.tokenizer.apply_chat_template(e,{tokenize:!1,add_generation_prompt:!0}))}let a=t.add_special_tokens??!1,s=!o&&(t.return_full_text??!0);this.tokenizer.padding_side="left";let{input_ids:l,attention_mask:u}=this.tokenizer(r,{add_special_tokens:a,padding:!0,truncation:!0}),h=await this.model.generate(l,t,null,{inputs_attention_mask:u}),c=this.tokenizer.batch_decode(h,{skip_special_tokens:!0});!s&&l.dims.at(-1)>0&&(n=this.tokenizer.batch_decode(l,{skip_special_tokens:!0}).map(e=>e.length));let f=Array.from({length:e.length},e=>[]);for(let t=0;t[e.toLowerCase(),t])),this.entailment_id=this.label2id.entailment,void 0===this.entailment_id&&(console.warn("Could not find 'entailment' in label2id mapping. Using 2 as entailment_id."),this.entailment_id=2),this.contradiction_id=this.label2id.contradiction??this.label2id.not_entailment,void 0===this.contradiction_id&&(console.warn("Could not find 'contradiction' in label2id mapping. Using 0 as contradiction_id."),this.contradiction_id=0)}async _call(e,t,{hypothesis_template:r="This example is {}.",multi_label:n=!1}={}){let i=Array.isArray(e);i||(e=[e]),Array.isArray(t)||(t=[t]);let o=t.map(e=>r.replace("{}",e)),a=n||1===t.length,s=[];for(let r of e){let e=[];for(let t of o){let n=this.tokenizer(r,{text_pair:t,padding:!0,truncation:!0}),i=await this.model(n);a?e.push([i.logits.data[this.contradiction_id],i.logits.data[this.entailment_id]]):e.push(i.logits.data[this.entailment_id])}let n=(a?e.map(e=>(0,h.XA)(e)[1]):(0,h.XA)(e)).map((e,t)=>[e,t]).sort((e,t)=>t[0]-e[0]);s.push({sequence:r,labels:n.map(e=>t[e[1]]),scores:n.map(e=>e[0])})}return i?s:s[0]}}class ej extends eE{constructor(e){super(e)}async _call(e,{pooling:t="none",normalize:r=!1,quantize:n=!1,precision:i="binary"}={}){let o=this.tokenizer(e,{padding:!0,truncation:!0}),a=await this.model(o),s=a.last_hidden_state??a.logits??a.token_embeddings;if("none"===t);else if("mean"===t)s=(0,c.v6)(s,o.attention_mask);else if("cls"===t)s=s.slice(null,0);else throw Error(`Pooling method '${t}' not supported.`);return r&&(s=s.normalize(2,-1)),n&&(s=(0,c.e)(s,i)),s}}class e$ extends eE{constructor(e){super(e)}async _call(e,{pool:t=null}={}){let r;let n=await ev(e),{pixel_values:i}=await this.processor(n),o=await this.model({pixel_values:i});if(t){if(!("pooler_output"in o))throw Error("No pooled output was returned. Make sure the model has a 'pooler' layer when using the 'pool' option.");r=o.pooler_output}else r=o.last_hidden_state??o.logits??o.image_embeds;return r}}class eU extends eE{constructor(e){super(e)}async _call(e,{topk:t=null}={}){let r=!Array.isArray(e),n=this.processor.feature_extractor.config.sampling_rate,i=await eb(e,n),o=this.model.config.id2label,a=[];for(let e of i){let r=await this.processor(e),n=(await this.model(r)).logits[0],i=(0,h.em)((0,h.XA)(n.data),t).map(e=>({label:o[e[0]],score:e[1]}));1===t?a.push(...i):a.push(i)}return r&&1!==t?a[0]:a}}class eL extends eE{constructor(e){super(e)}async _call(e,t,{hypothesis_template:r="This is a sound of {}."}={}){let n=!Array.isArray(e);n&&(e=[e]);let i=t.map(e=>r.replace("{}",e)),o=this.tokenizer(i,{padding:!0,truncation:!0}),a=this.processor.feature_extractor.config.sampling_rate,s=await eb(e,a),l=[];for(let e of s){let r=await this.processor(e),n=await this.model({...o,...r}),i=(0,h.XA)(n.logits_per_audio.data);l.push([...i].map((e,r)=>({score:e,label:t[r]})))}return n?l[0]:l}}class eR extends eE{constructor(e){super(e)}async _call(e,t={}){switch(this.model.config.model_type){case"whisper":return this._call_whisper(e,t);case"wav2vec2":case"wav2vec2-bert":case"unispeech":case"unispeech-sat":case"hubert":return this._call_wav2vec2(e,t);default:throw Error(`AutomaticSpeechRecognitionPipeline does not support model type '${this.model.config.model_type}'.`)}}async _call_wav2vec2(e,t={}){t.language&&console.warn('`language` parameter is not yet supported for `wav2vec2` models, defaulting to "English".'),t.task&&console.warn('`task` parameter is not yet supported for `wav2vec2` models, defaulting to "transcribe".');let r=!Array.isArray(e);r&&(e=[e]);let n=this.processor.feature_extractor.config.sampling_rate,i=await eb(e,n),o=[];for(let e of i){let t=await this.processor(e),r=(await this.model(t)).logits[0],n=[];for(let e of r)n.push((0,h.Fp)(e.data)[1]);let i=this.tokenizer.decode(n);o.push({text:i})}return r?o[0]:o}async _call_whisper(e,t={}){let r=t.return_timestamps??!1,n=t.chunk_length_s??0,i=t.chunk_callback??null,o=t.force_full_sequences??!1,a=t.stride_length_s??null;"word"===r&&(t.return_token_timestamps=!0);let s=(0,l.Sw)(t,"language",null),u=(0,l.Sw)(t,"task",null);if(s||u||r){if(t.forced_decoder_ids)throw Error("Cannot specify `language`/`task`/`return_timestamps` and `forced_decoder_ids` at the same time.");let e=this.tokenizer.get_decoder_prompt_ids({language:s,task:u,no_timestamps:!r});e.length>0&&(t.forced_decoder_ids=e)}let c=!Array.isArray(e);c&&(e=[e]);let f=this.processor.feature_extractor.config.chunk_length/this.model.config.max_source_positions,d=this.processor.feature_extractor.config.hop_length,p=this.processor.feature_extractor.config.sampling_rate,m=await eb(e,p),g=[];for(let e of m){let s=[];if(n>0){if(null===a)a=n/6;else if(n<=a)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");let t=p*n,r=p*a,i=t-2*r,o=0;for(;o=e.length;s.push({stride:[n.length,l?0:r,u?0:r],input_features:a.input_features,is_last:u}),o+=i}}else s=[{stride:[e.length,0,0],input_features:(await this.processor(e)).input_features,is_last:!0}];for(let e of s){t.num_frames=Math.floor(e.stride[0]/d);let n=await this.model.generate(e.input_features,t);"word"===r?(e.tokens=n.sequences[0],e.token_timestamps=n.token_timestamps.tolist()[0].map(e=>(0,h.NM)(e,2))):e.tokens=n[0],e.stride=e.stride.map(e=>e/p),null!==i&&i(e)}let[l,u]=this.tokenizer._decode_asr(s,{time_precision:f,return_timestamps:r,force_full_sequences:o});g.push({text:l,...u})}return c?g[0]:g}}class eF extends eE{constructor(e){super(e)}async _call(e,t={}){let r=Array.isArray(e),n=await ev(e),{pixel_values:i}=await this.processor(n),o=[];for(let e of i){e.dims=[1,...e.dims];let r=await this.model.generate(e,t),n=this.tokenizer.batch_decode(r,{skip_special_tokens:!0}).map(e=>({generated_text:e.trim()}));o.push(n)}return r?o:o[0]}}class eN extends eE{constructor(e){super(e)}async _call(e,{topk:t=1}={}){let r=Array.isArray(e),n=await ev(e),{pixel_values:i}=await this.processor(n),o=await this.model({pixel_values:i}),a=this.model.config.id2label,s=[];for(let e of o.logits){let r=(0,h.em)((0,h.XA)(e.data),t).map(e=>({label:a[e[0]],score:e[1]}));1===t?s.push(...r):s.push(r)}return r||1===t?s:s[0]}}class eP extends eE{constructor(e){super(e),this.subtasks_mapping={panoptic:"post_process_panoptic_segmentation",instance:"post_process_instance_segmentation",semantic:"post_process_semantic_segmentation"}}async _call(e,{threshold:t=.5,mask_threshold:r=.5,overlap_mask_area_threshold:n=.8,label_ids_to_fuse:i=null,target_sizes:o=null,subtask:a=null}={}){if(Array.isArray(e)&&1!==e.length)throw Error("Image segmentation pipeline currently only supports a batch size of 1.");let s=await ev(e),l=s.map(e=>[e.height,e.width]),{pixel_values:u,pixel_mask:h}=await this.processor(s),c=await this.model({pixel_values:u,pixel_mask:h}),f=null;if(null!==a)f=this.subtasks_mapping[a];else for(let[e,t]of Object.entries(this.subtasks_mapping))if(t in this.processor.feature_extractor){f=this.processor.feature_extractor[t].bind(this.processor.feature_extractor),a=e;break}let d=this.model.config.id2label,p=[];if("panoptic"===a||"instance"===a){let e=f(c,t,r,n,i,o??l)[0],a=e.segmentation;for(let t of e.segments_info){let e=new Uint8ClampedArray(a.data.length);for(let r=0;rr.replace("{}",e)),a=this.tokenizer(o,{padding:"siglip"!==this.model.config.model_type||"max_length",truncation:!0}),{pixel_values:s}=await this.processor(i),l=await this.model({...a,pixel_values:s}),u="siglip"===this.model.config.model_type?e=>e.sigmoid().data:e=>(0,h.XA)(e.data),c=[];for(let e of l.logits_per_image){let r=[...u(e)].map((e,r)=>({score:e,label:t[r]}));r.sort((e,t)=>t.score-e.score),c.push(r)}return n?c:c[0]}}class eD extends eE{constructor(e){super(e)}async _call(e,{threshold:t=.9,percentage:r=!1}={}){let n=Array.isArray(e);if(n&&1!==e.length)throw Error("Object detection pipeline currently only supports a batch size of 1.");let i=await ev(e),o=r?null:i.map(e=>[e.height,e.width]),{pixel_values:a,pixel_mask:s}=await this.processor(i),l=await this.model({pixel_values:a,pixel_mask:s}),u=this.processor.feature_extractor.post_process_object_detection(l,t,o),h=this.model.config.id2label,c=u.map(e=>e.boxes.map((t,n)=>({score:e.scores[n],label:h[e.classes[n]],box:ex(t,!r)})));return n?c:c[0]}}class eq extends eE{constructor(e){super(e)}async _call(e,t,{threshold:r=.1,topk:n=null,percentage:i=!1}={}){let o=Array.isArray(e),a=await ev(e),s=this.tokenizer(t,{padding:!0,truncation:!0}),l=await this.processor(a),u=[];for(let e=0;e({score:d.scores[r],label:t[d.classes[r]],box:ex(e,!i)})).sort((e,t)=>t.score-e.score);null!==n&&(p=p.slice(0,n)),u.push(p)}return o?u:u[0]}}class eH extends eE{constructor(e){super(e)}async _call(e,t,r={}){let n=(await ev(e))[0],{pixel_values:i}=await this.processor(n),o=`${t}`,a=this.tokenizer(o,{add_special_tokens:!1,padding:!0,truncation:!0}).input_ids,s=await this.model.generate(i,{...r,decoder_input_ids:a,max_length:this.model.config.decoder.max_position_embeddings}),l=this.tokenizer.batch_decode(s)[0].match(/(.*?)<\/s_answer>/),u=null;return l&&l.length>=2&&(u=l[1].trim()),[{answer:u}]}}class eW extends eE{DEFAULT_VOCODER_ID="Xenova/speecht5_hifigan";constructor(e){super(e),this.vocoder=e.vocoder??null}async _call(e,{speaker_embeddings:t=null}={}){return this.processor?this._call_text_to_spectrogram(e,{speaker_embeddings:t}):this._call_text_to_waveform(e)}async _call_text_to_waveform(e){let t=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:r}=await this.model(t),n=this.model.config.sampling_rate;return{audio:r.data,sampling_rate:n}}async _call_text_to_spectrogram(e,{speaker_embeddings:t}){if(this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await s.$Sz.from_pretrained(this.DEFAULT_VOCODER_ID,{quantized:!1})),("string"==typeof t||t instanceof URL)&&(t=new Float32Array(await (await fetch(t)).arrayBuffer())),t instanceof Float32Array)t=new c.es("float32",t,[1,t.length]);else if(!(t instanceof c.es))throw Error("Speaker embeddings must be a `Tensor`, `Float32Array`, `string`, or `URL`.");let{input_ids:r}=this.tokenizer(e,{padding:!0,truncation:!0}),{waveform:n}=await this.model.generate_speech(r,t,{vocoder:this.vocoder}),i=this.processor.feature_extractor.config.sampling_rate;return{audio:n.data,sampling_rate:i}}}class eG extends eE{constructor(e){super(e)}async _call(e){let t=await ev(e),r=await this.processor(t),n=await this.model(r),i=[];for(let e of n.reconstruction){let t=e.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");i.push(w.fromTensor(t))}return i.length>1?i:i[0]}}class eX extends eE{constructor(e){super(e)}async _call(e){let t=await ev(e),r=await this.processor(t),{predicted_depth:n}=await this.model(r),i=[];for(let e=0;e1?i:i[0]}}let eK=Object.freeze({"text-classification":{tokenizer:a.t2,pipeline:ek,model:s.o$X,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:a.t2,pipeline:eA,model:s.OjJ,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:a.t2,pipeline:eC,model:s.wiU,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:a.t2,pipeline:eS,model:s.t78,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:a.t2,pipeline:eI,model:s.Kf0,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:a.t2,pipeline:eM,model:s.Kf0,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:a.t2,pipeline:ez,model:s.Kf0,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:a.t2,pipeline:eO,model:s.Hqk,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:a.t2,pipeline:eB,model:s.o$X,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:eU,model:s.K2m,processor:e_,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{tokenizer:a.t2,pipeline:eL,model:s.$Sz,processor:e_,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:a.t2,pipeline:eR,model:[s.hZO,s.ENH],processor:e_,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:a.t2,pipeline:eW,model:[s.z6E,s.lbf],processor:[e_,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:a.t2,pipeline:eF,model:s.tLj,processor:e_,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:eN,model:s.En$,processor:e_,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:eP,model:[s.U$$,s.$Bv],processor:e_,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"zero-shot-image-classification":{tokenizer:a.t2,pipeline:eV,model:s.$Sz,processor:e_,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:eD,model:s.Zn,processor:e_,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{tokenizer:a.t2,pipeline:eq,model:s.LdW,processor:e_,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:a.t2,pipeline:eH,model:s.DcG,processor:e_,default:{model:"Xenova/donut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:eG,model:s.S2d,processor:e_,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:eX,model:s.hY6,processor:e_,default:{model:"Xenova/dpt-large"},type:"image"},"feature-extraction":{tokenizer:a.t2,pipeline:ej,model:s.$Sz,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"},"image-feature-extraction":{processor:e_,pipeline:e$,model:[s.IFL,s.$Sz],default:{model:"Xenova/vit-base-patch16-224-in21k"},type:"image"}}),eZ=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function eJ(e,t=null,{quantized:r=!0,progress_callback:n=null,config:i=null,cache_dir:o=null,local_files_only:a=!1,revision:s="main",model_file_name:u=null}={}){let h=eK[(e=eZ[e]??e).split("_",1)[0]];if(!h)throw Error(`Unsupported pipeline: ${e}. Must be one of [${Object.keys(eK)}]`);t||(t=h.default.model,console.log(`No model specified. Using default model: "${t}".`));let c=new Map([["tokenizer",h.tokenizer],["model",h.model],["processor",h.processor]]),f=await eY(c,t,{quantized:r,progress_callback:n,config:i,cache_dir:o,local_files_only:a,revision:s,model_file_name:u});return f.task=e,(0,l.T2)(n,{status:"ready",task:e,model:t}),new h.pipeline(f)}async function eY(e,t,r){let n=Object.create(null),i=[];for(let[o,a]of e.entries()){let e;a&&(e=Array.isArray(a)?new Promise(async(e,n)=>{let i;for(let n of a){if(null===n){e(null);return}try{e(await n.from_pretrained(t,r));return}catch(e){i=e}}n(i)}):a.from_pretrained(t,r),n[o]=e,i.push(e))}for(let[e,t]of(await Promise.all(i),Object.entries(n)))n[e]=await t;return n}r(16)},761:function(e,t,r){"use strict";function n(e,t){e&&e(t)}function i(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[t,e]))}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}r.d(t,{$2:function(){return i},Ag:function(){return a},Gg:function(){return u},O7:function(){return d},Sw:function(){return c},T2:function(){return n},Wy:function(){return l},eG:function(){return f},fU:function(){return s},hr:function(){return o},hs:function(){return p},jg:function(){return h}});let a=class{constructor(){let e=function(...t){return e._call(...t)};return Object.setPrototypeOf(e,new.target.prototype)}_call(...e){throw Error("Must implement _call method in subclass")}};function s(e){return e?.prototype?.__proto__?.constructor?.name==="TypedArray"}function l(e){return Number.isInteger(e)||"bigint"==typeof e}function u(e){return null!=e}function h(e){let t=[],r=e;for(;Array.isArray(r);)t.push(r.length),r=r[0];return t}function c(e,t,r){let n=e[t];if(void 0!==n)return delete e[t],n;if(void 0===r)throw Error(`Key ${t} does not exist in object.`);return r}function f(...e){return Array.prototype.concat.apply([],e)}function d(...e){return e.reduce((e,t)=>e.flatMap(e=>t.map(t=>[e,t])))}function p(e,t){return Math.abs((e+t)%(2*t)-t)}},1510:function(e,t,r){"use strict";r.d(t,{GA:function(){return i},Z3:function(){return n},pQ:function(){return a}});class n{constructor(e=(e,t)=>e>t){this._heap=[],this._comparator=e}get size(){return this._heap.length}isEmpty(){return 0===this.size}peek(){return this._heap[0]}push(...e){return this.extend(e)}extend(e){for(let t of e)this._heap.push(t),this._siftUp();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(){let e=this.size-1;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.endNodes=Array.from({length:this.len+1},()=>[]);let n=new s(this.bosTokenId,0,0,0,0),i=new s(this.eosTokenId,1,this.len,0,0);this.nodes.push(n.clone()),this.nodes.push(i.clone()),this.beginNodes[this.len].push(i),this.endNodes[0].push(n)}insert(e,t,r,n){let i=new s(n,this.nodes.length,e,t,r);this.beginNodes[e].push(i),this.endNodes[e+t].push(i),this.nodes.push(i)}viterbi(){let e=this.len,t=0;for(;t<=e;){if(0==this.beginNodes[t].length)return[];for(let e of this.beginNodes[t]){e.prev=null;let r=0,n=null;for(let i of this.endNodes[t]){let t=i.backtraceScore+e.score;(null===n||t>r)&&(n=i.clone(),r=t)}if(null===n)return[];e.prev=n,e.backtraceScore=r}++t}let r=[],n=this.beginNodes[e][0].prev;if(null===n)return[];let i=n.clone();for(;null!==i.prev;)r.push(i.clone()),i=i.clone().prev.clone();return r.reverse(),r}piece(e){return this.sentence.slice(e.pos,e.pos+e.length)}tokens(){return this.viterbi().map(e=>this.piece(e))}tokenIds(){return this.viterbi().map(e=>e.tokenId)}}class s{constructor(e,t,r,n,i){this.tokenId=e,this.nodeId=t,this.pos=r,this.length=n,this.score=i,this.prev=null,this.backtraceScore=0}clone(){let e=new s(this.tokenId,this.nodeId,this.pos,this.length,this.score);return e.prev=this.prev,e.backtraceScore=this.backtraceScore,e}}},5774:function(e,t,r){"use strict";r.d(t,{AE:function(){return g},C9:function(){return l},CJ:function(){return m},E:function(){return s},GU:function(){return h},Jj:function(){return d},Jm:function(){return o},Pg:function(){return c},Z4:function(){return w},aP:function(){return y},dZ:function(){return u},ez:function(){return p},jF:function(){return f}}),r(2414);var n=r(761),i=r(8709);class o extends n.Ag{constructor(){super(),this.processors=[]}push(e){this.processors.push(e)}extend(e){this.processors.push(...e)}_call(e,t){for(let r of t)this.processors.forEach(t=>t(e,r))}[Symbol.iterator](){return this.processors.values()}}class a extends n.Ag{_call(e,t){throw Error("`_call` should be implemented in a subclass")}}class s extends a{constructor(e){super(),this.force_token_map=Object.fromEntries(e??[])}_call(e,t){let r=this.force_token_map[e.length];return(0,n.Gg)(r)&&(t.data.fill(-1/0),t.data[r]=0),t}}class l extends a{constructor(e){super(),this.bos_token_id=e}_call(e,t){return 1===e.length&&(t.data.fill(-1/0),t.data[this.bos_token_id]=0),t}}class u extends a{constructor(e,t){super(),this.max_length=e,this.forced_eos_token_id=t}_call(e,t){}}class h extends a{constructor(e,t){super(),this.begin_suppress_tokens=e,this.begin_index=t}_call(e,t){if(e.length===this.begin_index)for(let e of this.begin_suppress_tokens)t.data[e]=-1/0;return t}}class c extends a{constructor(e){super(),this.eos_token_id=e.eos_token_id,this.no_timestamps_token_id=e.no_timestamps_token_id,this.timestamp_begin=this.no_timestamps_token_id+1,this.begin_index=(e.forced_decoder_ids||[]).length+2,e.forced_decoder_ids.slice(-1)[0][1]===this.no_timestamps_token_id&&(this.begin_index-=1),this.max_initial_timestamp_index=e.max_initial_timestamp_index}_call(e,t){let r=t.data;if(r[this.no_timestamps_token_id]=-1/0,e.length===this.begin_index-1)return r.fill(-1/0),r[this.timestamp_begin]=0,t;let n=e.slice(this.begin_index),o=n.length>=1&&n[n.length-1]>=this.timestamp_begin,a=n.length<2||n[n.length-2]>=this.timestamp_begin;if(o&&(a?r.subarray(this.timestamp_begin).fill(-1/0):r.subarray(0,this.eos_token_id).fill(-1/0)),e.length===this.begin_index&&null!==this.max_initial_timestamp_index){let e=this.timestamp_begin+this.max_initial_timestamp_index;r.subarray(e+1).fill(-1/0)}let s=(0,i.CI)(r);return Math.log(s.subarray(this.timestamp_begin).map(Math.exp).reduce((e,t)=>e+t))>(0,i.Fp)(s.subarray(0,this.timestamp_begin))[0]&&r.subarray(0,this.timestamp_begin).fill(-1/0),t}}class f extends a{constructor(e){super(),this.no_repeat_ngram_size=e}getNgrams(e){let t=e.length,r=[];for(let n=0;n0&&(n=n.map(e=>e/this.generation_config.temperature)),n}randomSelect(e){let t=Math.random()*e.reduce((e,t)=>e+t,0);for(let r=0;r1)return new b(e);if(e.num_return_sequences>1)throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${e.num_return_sequences}.`);return new _(e)}}class _ extends w{sample(e,t=-1){let r=this.getLogits(e,t);return[[(0,i.Fp)(r)[1],0]]}}class v extends w{sample(e,t=-1){let r=e.dims.at(-1);this.generation_config.top_k>0&&(r=Math.min(this.generation_config.top_k,r));let n=this.getLogits(e,t),o=(0,i.em)(n,r),a=(0,i.XA)(o.map(e=>e[1]));return Array.from({length:this.generation_config.num_beams},()=>{let e=this.randomSelect(a);return[o[e][0],Math.log(a[e])]})}}class b extends w{sample(e,t=-1){let r=e.dims.at(-1);this.generation_config.top_k>0&&(r=Math.min(this.generation_config.top_k,r));let n=this.getLogits(e,t),o=(0,i.em)(n,r),a=(0,i.XA)(o.map(e=>e[1]));return Array.from({length:this.generation_config.num_beams},(e,t)=>[o[t][0],Math.log(a[t])])}}},911:function(e,t,r){"use strict";r.d(t,{hn:function(){return c},st:function(){return m},yM:function(){return g}});var n=r(7147),i=r(1418),o=r(851),a=r(761),s=r(357),l=r(9109).lW;class u{_CONTENT_TYPE_MAP={txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif"};constructor(e){if(this.filePath=e,this.headers=new Headers,this.exists=n.existsSync(e),this.exists){this.status=200,this.statusText="OK";let t=n.statSync(e);this.headers.set("content-length",t.size.toString()),this.updateContentType();let r=this;this.body=new ReadableStream({start(e){r.arrayBuffer().then(t=>{e.enqueue(new Uint8Array(t)),e.close()})}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){let e=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",this._CONTENT_TYPE_MAP[e]??"application/octet-stream")}clone(){let e=new u(this.filePath);return e.exists=this.exists,e.status=this.status,e.statusText=this.statusText,e.headers=new Headers(this.headers),e}async arrayBuffer(){return(await n.promises.readFile(this.filePath)).buffer}async blob(){return new Blob([await n.promises.readFile(this.filePath)],{type:this.headers.get("content-type")})}async text(){return await n.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function h(e,t=null,r=null){let n;try{n=new URL(e)}catch(e){return!1}return(!t||!!t.includes(n.protocol))&&(!r||!!r.includes(n.hostname))}async function c(e){if(o.O.useFS&&!h(e,["http:","https:","blob:"]))return new u(e);if(void 0===s||s?.release?.name!=="node")return fetch(e);{let t=!!s.env?.TESTING_REMOTELY,r=o.O.version,n=new Headers;if(n.set("User-Agent",`transformers.js/${r}; is_ci/${t};`),h(e,["http:","https:"],["huggingface.co","hf.co"])){let e=s.env?.HF_TOKEN??s.env?.HF_ACCESS_TOKEN;e&&n.set("Authorization",`Bearer ${e}`)}return fetch(e,{headers:n})}}let f={400:"Bad request error occurred while trying to load file",401:"Unauthorized access to file",403:"Forbidden access to file",404:"Could not locate file",408:"Request timeout error occurred while trying to load file",500:"Internal server error error occurred while trying to load file",502:"Bad gateway error occurred while trying to load file",503:"Service unavailable error occurred while trying to load file",504:"Gateway timeout error occurred while trying to load file"};class d{constructor(e){this.path=e}async match(e){let t=new u(i.join(this.path,e));return t.exists?t:void 0}async put(e,t){let r=l.from(await t.arrayBuffer()),o=i.join(this.path,e);try{await n.promises.mkdir(i.dirname(o),{recursive:!0}),await n.promises.writeFile(o,r)}catch(e){console.warn("An error occurred while writing the file to cache:",e)}}}async function p(e,...t){for(let r of t)try{let t=await e.match(r);if(t)return t}catch(e){continue}}async function m(e,t,r=!0,n={}){let i,s,l,u;if(!o.O.allowLocalModels){if(n.local_files_only)throw Error("Invalid configuration detected: local models are disabled (`env.allowLocalModels=false`) but you have requested to only use local models (`local_files_only=true`).");if(!o.O.allowRemoteModels)throw Error("Invalid configuration detected: both local and remote models are disabled. Fix by setting `env.allowLocalModels` or `env.allowRemoteModels` to `true`.")}if((0,a.T2)(n.progress_callback,{status:"initiate",name:e,file:t}),!i&&o.O.useBrowserCache){if("undefined"==typeof caches)throw Error("Browser cache is not available in this environment.");try{i=await caches.open("transformers-cache")}catch(e){console.warn("An error occurred while opening the browser cache:",e)}}if(!i&&o.O.useFSCache&&(i=new d(n.cache_dir??o.O.cacheDir)),!i&&o.O.useCustomCache){if(!o.O.customCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");if(!o.O.customCache.match||!o.O.customCache.put)throw Error("`env.customCache` must be an object which implements the `match` and `put` functions of the Web Cache API. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/Cache");i=o.O.customCache}let m=n.revision??"main",g=w(e,t),_=w(o.O.localModelPath,g),v=w(o.O.remoteHost,o.O.remotePathTemplate.replaceAll("{model}",e).replaceAll("{revision}",encodeURIComponent(m)),t),b="main"===m?g:w(e,m,t),x=i instanceof d?b:v,E=!1;i&&(l=await p(i,_,x));let k=void 0!==l;if(void 0===l){if(o.O.allowLocalModels){if(h(g,["http:","https:"])){if(n.local_files_only)throw Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${g}.`);if(!o.O.allowRemoteModels)throw Error(`\`env.allowRemoteModels=false\`, but attempted to load a remote file from: ${g}.`)}else try{l=await c(_),s=_}catch(e){console.warn(`Unable to load from local path "${_}": "${e}"`)}}if(void 0===l||404===l.status){if(n.local_files_only||!o.O.allowRemoteModels){if(!r)return null;throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${_}".`)}if(200!==(l=await c(v)).status)return function(e,t,r){if(!r)return null;let n=f[e]??`Error (${e}) occurred while trying to load file`;throw Error(`${n}: "${t}".`)}(l.status,v,r);s=x}E=i&&"undefined"!=typeof Response&&l instanceof Response&&200===l.status}(0,a.T2)(n.progress_callback,{status:"download",name:e,file:t});let A={status:"progress",name:e,file:t};return n.progress_callback?k&&"undefined"!=typeof navigator&&/firefox/i.test(navigator.userAgent)?(u=new Uint8Array(await l.arrayBuffer()),(0,a.T2)(n.progress_callback,{...A,progress:100,loaded:u.length,total:u.length})):u=await y(l,e=>{(0,a.T2)(n.progress_callback,{...A,...e})}):u=new Uint8Array(await l.arrayBuffer()),E&&s&&await i.match(s)===void 0&&await i.put(s,new Response(u,{headers:l.headers})).catch(e=>{console.warn(`Unable to add response to browser cache: ${e}.`)}),(0,a.T2)(n.progress_callback,{status:"done",name:e,file:t}),u}async function g(e,t,r=!0,n={}){let i=await m(e,t,r,n);return null===i?{}:JSON.parse(new TextDecoder("utf-8").decode(i))}async function y(e,t){let r=e.headers.get("Content-Length");null===r&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let n=parseInt(r??"0"),i=new Uint8Array(n),o=0,a=e.body.getReader();async function s(){let{done:e,value:r}=await a.read();if(e)return;let l=o+r.length;if(l>n){let e=new Uint8Array(n=l);e.set(i),i=e}return i.set(r,o),t({progress:(o=l)/n*100,loaded:o,total:n}),s()}return await s(),i}function w(...e){return(e=e.map((t,r)=>(r&&(t=t.replace(RegExp("^/"),"")),r!==e.length-1&&(t=t.replace(RegExp("/$"),"")),t))).join("/")}},8709:function(e,t,r){"use strict";function n(e,[t,r,n],[i,o],a="bilinear",s=!1){let l=o/n,u=i/r,h=new e.constructor(i*o*t),c=r*n,f=i*o;for(let a=0;a=0;--e)i[e]=o,n[e]=t[r[e]],o*=n[e];let o=r.map((e,t)=>i[r.indexOf(t)]),a=new e.constructor(e.length);for(let r=0;r=0;--e)n+=i%t[e]*o[e],i=Math.floor(i/t[e]);a[n]=e[r]}return[a,n]}function o(e){let t=u(e)[0],r=e.map(e=>Math.exp(e-t)),n=r.reduce((e,t)=>e+t,0);return r.map(e=>e/n)}function a(e){return o(e).map(e=>Math.log(e))}function s(e,t=0){return e=Array.from(e).map((e,t)=>[t,e]).sort((e,t)=>t[1]-e[1]),null!==t&&t>0&&(e=e.slice(0,t)),e}function l(e){if(0===e.length)throw Error("Array must not be empty");let t=e[0],r=0;for(let n=1;nt&&(t=e[n],r=n);return[Number(t),r]}function h(e){return e>0&&(e&e-1)==0}r.d(t,{CI:function(){return a},Fp:function(){return u},NM:function(){return m},Nq:function(){return n},VV:function(){return l},XA:function(){return o},eT:function(){return g},em:function(){return s},nu:function(){return i},qC:function(){return p},vw:function(){return d}});class c{constructor(e){if(this.size=0|e,this.size<=1||!h(this.size))throw Error("FFT size must be a power of two larger than 1");this._csize=e<<1,this.table=new Float64Array(2*this.size);for(let e=0;ee;e<<=1)++t;this._width=t%2==0?t-1:t,this._bitrev=new Int32Array(1<>>t&3)<>>1);for(let t=0;t>>1]=e[t];return r}toComplexArray(e,t){let r=t||this.createComplexArray();for(let t=0;t>>1],r[t+1]=0;return r}transform(e,t){if(e===t)throw Error("Input and output buffers must be different");this._transform4(e,t,1)}realTransform(e,t){if(e===t)throw Error("Input and output buffers must be different");this._realTransform4(e,t,1)}inverseTransform(e,t){if(e===t)throw Error("Input and output buffers must be different");this._transform4(e,t,-1);for(let t=0;t>=2;a>=2;a>>=2){let t=(s=o/a<<1)>>>2;for(n=0;n>>1,a>>>1)}else for(n=0,i=0;n>>1,a>>>1,r)}let u=this.table;for(a>>=2;a>=2;a>>=2){let t=(s=o/a<<1)>>>1,i=t>>>1,l=i>>>1;for(n=0;n>>1;for(let t=2;t>1;++t){let r=(t+1-e)**2/2,n=Math.sqrt(s**2+l**2)**r,a=r*Math.atan2(l,s),u=2*t;i[u]=n*Math.cos(a),i[u+1]=n*Math.sin(a),o[u]=i[u],o[u+1]=-i[u+1]}this._slicedChirpBuffer=i.subarray(t,r),this._f=new c(n>>1),this._f.transform(this._chirpBuffer,o)}_transform(e,t,r){let n=this._buffer1,i=this._buffer2,o=this._outBuffer1,a=this._outBuffer2,s=this._chirpBuffer,l=this._slicedChirpBuffer,u=this._a;if(r)for(let e=0;e>1];n[e]=i*l[e],n[r]=i*l[r]}else for(let e=0;e=e.length&&(i=2*(e.length-1)-i),n[o++]=e[i]}n.sort(),r[t]=n[i]}return r}function m(e,t){let r=Math.pow(10,t);return Math.round(e*r)/r}function g(e){let t=Math.round(e);return Math.abs(e)%1==.5?t%2==0?t:t-1:t}},2414:function(e,t,r){"use strict";r.d(t,{J6:function(){return g},Ks:function(){return y},d3:function(){return d},e:function(){return _},es:function(){return s},f3:function(){return m},kn:function(){return p},r6:function(){return w},sX:function(){return l},v6:function(){return u}});var n=r(967),i=r(8709);let o=Object.freeze({float32:Float32Array,float64:Float64Array,string:Array,int8:Int8Array,uint8:Uint8Array,int16:Int16Array,uint16:Uint16Array,int32:Int32Array,uint32:Uint32Array,int64:BigInt64Array,uint64:BigUint64Array,bool:Uint8Array}),a=n.ONNX.Tensor;class s{dims;type;data;size;constructor(...e){return e[0]instanceof a?Object.assign(this,e[0]):Object.assign(this,new a(e[0],e[1],e[2])),new Proxy(this,{get:(e,t)=>{if("string"==typeof t){let r=Number(t);if(Number.isInteger(r))return e._getitem(r)}return e[t]},set:(e,t,r)=>e[t]=r})}*[Symbol.iterator](){let[e,...t]=this.dims;if(t.length>0){let r=t.reduce((e,t)=>e*t);for(let n=0;n0))return new s(this.type,[this.data[e]],r);{let t=r.reduce((e,t)=>e*t);return this._subarray(e,t,r)}}indexOf(e){for(let t=0;te*t))throw Error(`cannot reshape array of size ${r} into shape (${t})`);let n=e;for(let e=t.length-1;e>=0;e--)n=n.reduce((r,n)=>{let i=r[r.length-1];return i.lengthi[1])throw Error(`Invalid slice: ${i}`);let e=[Math.max(i[0],0),Math.min(i[1],this.dims[n])];r.push(e),t.push(e[1]-e[0])}else throw Error(`Invalid slice: ${i}`)}let n=r.map(([e,t])=>t-e),i=n.reduce((e,t)=>e*t),o=new this.data.constructor(i),a=this.stride();for(let e=0;e=0;--i){let e=n[i];t+=(o%e+r[i][0])*a[i],o=Math.floor(o/e)}o[e]=this.data[t]}return new s(this.type,o,t)}permute(...e){return function(e,t){let[r,n]=(0,i.nu)(e.data,e.dims,t);return new s(e.type,r,n)}(this,e)}transpose(...e){return this.permute(...e)}sum(e=null,t=!1){return this.norm(1,e,t)}norm(e="fro",t=null,r=!1){if("fro"===e)e=2;else if("string"==typeof e)throw Error(`Unsupported norm: ${e}`);if(null===t){let t=this.data.reduce((t,r)=>t+r**e,0)**(1/e);return new s(this.type,[t],[])}t=f(t,this.dims.length);let n=this.dims.slice();n[t]=1;let i=new this.data.constructor(this.data.length/this.dims[t]);for(let r=0;r=0;--e){let r=this.dims[e];e!==t&&(o+=i%r*a,a*=n[e]),i=Math.floor(i/r)}i[o]+=this.data[r]**e}if(1!==e)for(let t=0;t=0;--r){let e=this.dims[r];r!==t&&(n+=i%e*o,o*=this.dims[r]),i=Math.floor(i/e)}this.data[e]/=r.data[n]}return this}normalize(e=2,t=1){return this.clone().normalize_(e,t)}stride(){return function(e){let t=Array(e.length);for(let r=e.length-1,n=1;r>=0;--r)t[r]=n,n*=e[r];return t}(this.dims)}squeeze(e=null){return new s(this.type,this.data,h(this.dims,e))}squeeze_(e=null){return this.dims=h(this.dims,e),this}unsqueeze(e=null){return new s(this.type,this.data,c(this.dims,e))}unsqueeze_(e=null){return this.dims=c(this.dims,e),this}flatten_(e=0,t=-1){t=(t+this.dims.length)%this.dims.length;let r=this.dims.slice(0,e),n=this.dims.slice(e,t+1),i=this.dims.slice(t+1);return this.dims=[...r,n.reduce((e,t)=>e*t,1),...i],this}flatten(e=0,t=-1){return this.clone().flatten_(e,t)}view(...e){let t=-1;for(let r=0;rn!==t?e*r:e,1);e[t]=this.data.length/r}return new s(this.type,this.data,e)}neg_(){for(let e=0;e1!==e):"number"==typeof t?1===e[t]&&e.splice(t,1):Array.isArray(t)&&(e=e.filter((e,r)=>1!==e||!t.includes(r))),e}function c(e,t){return t=f(t,e.length+1),(e=e.slice()).splice(t,0,1),e}function f(e,t,r=null){if(e<-t||e>=t)throw Error(`IndexError: index ${e} is out of bounds for dimension${null===r?"":" "+r} with size ${t}`);return e<0&&(e=(e%t+t)%t),e}function d(e,t=0){t=f(t,e[0].dims.length);let r=e[0].dims.slice();r[t]=e.reduce((e,r)=>e+r.dims[t],0);let n=r.reduce((e,t)=>e*t,1),i=new e[0].data.constructor(n),o=e[0].type;if(0===t){let t=0;for(let r of e)i.set(r.data,t),t+=r.data.length}else{let n=0;for(let o=0;o=0;--i){let e=a.dims[i],u=s%e;i===t&&(u+=n),o+=u*l,l*=r[i],s=Math.floor(s/e)}i[o]=a.data[e]}n+=a.dims[t]}}return new s(o,i,r)}function p(e,t=0){return d(e.map(e=>e.unsqueeze(t)),t)}function m(e,t=null,r=1,n=!1){if(null===t){let t=e.data.reduce((e,t)=>e+t,0)/e.data.length,n=Math.sqrt(e.data.reduce((e,r)=>e+(r-t)**2,0)/(e.data.length-r)),i=new s(e.type,[t],[]);return[new s(e.type,[n],[]),i]}t=f(t,e.dims.length);let i=g(e,t,n),o=e.dims.slice();o[t]=1;let a=new e.data.constructor(e.data.length/e.dims[t]);for(let r=0;r=0;--i){let r=e.dims[i];i!==t&&(n+=a%r*s,s*=o[i]),a=Math.floor(a/r)}a[n]+=(e.data[r]-i.data[n])**2}for(let n=0;ne+t,0);return new s(e.type,[t/e.data.length],[])}t=f(t,e.dims.length);let n=e.dims.slice();n[t]=1;let i=new e.data.constructor(e.data.length/e.dims[t]);for(let r=0;r=0;--i){let r=e.dims[i];i!==t&&(o+=a%r*s,s*=n[i]),a=Math.floor(a/r)}i[o]+=e.data[r]}if(1!==e.dims[t])for(let r=0;r0||l>0;)switch(u.push(a-1),h.push(l-1),o[a][l].item()){case 0:--a,--l;break;case 1:--a;break;case 2:--l;break;default:throw Error(`Internal error in dynamic time warping. Unexpected trace[${a}, ${l}]. Please file a bug report.`)}return u.reverse(),h.reverse(),[u,h]}function w(e){var t;return new s("int64",new BigInt64Array((t=e.dims).reduce((e,t)=>e*t,1)).fill(1n),t)}function _(e,t){if(2!==e.dims.length)throw Error("The tensor must have 2 dimensions");if(e.dims.at(-1)%8!=0)throw Error("The last dimension of the tensor must be a multiple of 8");if(!["binary","ubinary"].includes(t))throw Error("The precision must be either 'binary' or 'ubinary'");let r="binary"===t,n=r?Int8Array:Uint8Array,i=e.data,o=new n(i.length/8);for(let e=0;e0?1:0,n=Math.floor(e/8),a=e%8;o[n]|=t<<7-a,r&&0===a&&(o[n]-=128)}return new s(r?"int8":"uint8",o,[e.dims[0],e.dims[1]/8])}},2869:function(e,t,r){"use strict";r.d(t,{$:function(){return w}});var n=r(9235),i=r(8411),o=r(2202),a=r(5377),s=r(2265),l=r(2988),u=r(3950),h=r(929),c=r(5275),f=["animating","color","hidesWhenStopped","size","style"],d=e=>s.createElement("circle",{cx:"16",cy:"16",fill:"none",r:"14",strokeWidth:"4",style:e}),p=s.forwardRef((e,t)=>{var r=e.animating,n=void 0===r||r,i=e.color,o=void 0===i?"#1976D2":i,a=e.hidesWhenStopped,h=e.size,p=void 0===h?"small":h,y=e.style,w=(0,u.Z)(e,f),_=s.createElement("svg",{height:"100%",viewBox:"0 0 32 32",width:"100%"},d({stroke:o,opacity:.2}),d({stroke:o,strokeDasharray:80,strokeDashoffset:60}));return s.createElement(c.Z,(0,l.Z)({},w,{"aria-valuemax":1,"aria-valuemin":0,ref:t,role:"progressbar",style:[m.container,y]}),s.createElement(c.Z,{children:_,style:["number"==typeof p?{height:p,width:p}:g[p],m.animation,!n&&m.animationPause,!n&&(void 0===a||a)&&m.hidesWhenStopped]}))});p.displayName="ActivityIndicator";var m=h.Z.create({container:{alignItems:"center",justifyContent:"center"},hidesWhenStopped:{visibility:"hidden"},animation:{animationDuration:"0.75s",animationKeyframes:[{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}],animationTimingFunction:"linear",animationIterationCount:"infinite"},animationPause:{animationPlayState:"paused"}}),g=h.Z.create({small:{width:20,height:20},large:{width:36,height:36}}),y=r(2281);let w=a.FA.extractable((0,n.Y)(s.forwardRef((e,t)=>{let{size:r,color:n,...s}=e,l=(0,i.Fg)(),u=n;return u&&"$"===u[0]&&(u=(0,o.lk)(l[u])),(0,y.jsx)(a.FA,{ref:t,...s,children:(0,y.jsx)(p,{size:r,color:u})})}),{componentName:"Spinner"}))},2642:function(e,t,r){"use strict";r.d(t,{K:function(){return P}});var n=r(281),i=r(4975),o=r(9046),a=r(2202),s=r(8306),l=r(8970),u=r(6748);let h=(e="$true",t)=>{let{props:r}=t,n=(0,s.f)(e,t),i=(0,l.H)(e,t),o=r.rows??r.numberOfLines,h="number"==typeof o?o*(0,a.Ve)(i.lineHeight):"auto",c=(0,u.Pj)(e,{shift:-2,bounds:[2]}),f=(0,u.Pj)(e,{shift:-1,bounds:[2]});return{...n,...i,paddingVertical:c,paddingHorizontal:f,height:h}};var c=r(8411),f=r(9087),d=r(2265),p=r(3515),m=r(2281),g=r(5803),y=r(7792),w=r(9115),_=r(9647),v=r(1435),b=r(9926),x=r(5158),E=r(4886),k=r(3201),A=r(929),C=r(3013),S=r(131),z=(e,t)=>{var r=e.selectionEnd,n=e.selectionStart,i=t.start,o=t.end;return i!==n||o!==r},I=(e,t)=>{if(z(e,t)){var r=t.start,n=t.end;try{e.setSelectionRange(r,n||r)}catch(e){}}},M=Object.assign({},y.lG,y.LO,y._T,y.YB,y.Uy,y.hJ,y.E5,y.vr,{autoCapitalize:!0,autoComplete:!0,autoCorrect:!0,autoFocus:!0,defaultValue:!0,disabled:!0,lang:!0,maxLength:!0,onChange:!0,onScroll:!0,placeholder:!0,pointerEvents:!0,readOnly:!0,rows:!0,spellCheck:!0,value:!0,type:!0}),T=e=>(0,w.Z)(e,M),O=null,B=d.forwardRef((e,t)=>{var r,n,i=e.autoCapitalize,o=e.autoComplete,a=e.autoCompleteType,s=e.autoCorrect,l=void 0===s||s,u=e.blurOnSubmit,h=e.caretHidden,c=e.clearTextOnFocus,f=e.dir,p=e.editable,m=e.enterKeyHint,y=e.inputMode,w=e.keyboardType,A=e.multiline,z=void 0!==A&&A,M=e.numberOfLines,B=e.onBlur,$=e.onChange,U=e.onChangeText,L=e.onContentSizeChange,R=e.onFocus,F=e.onKeyPress,N=e.onLayout,P=e.onMoveShouldSetResponder,V=e.onMoveShouldSetResponderCapture,D=e.onResponderEnd,q=e.onResponderGrant,H=e.onResponderMove,W=e.onResponderReject,G=e.onResponderRelease,X=e.onResponderStart,K=e.onResponderTerminate,Z=e.onResponderTerminationRequest,J=e.onScrollShouldSetResponder,Y=e.onScrollShouldSetResponderCapture,Q=e.onSelectionChange,ee=e.onSelectionChangeShouldSetResponder,et=e.onSelectionChangeShouldSetResponderCapture,er=e.onStartShouldSetResponder,en=e.onStartShouldSetResponderCapture,ei=e.onSubmitEditing,eo=e.placeholderTextColor,ea=e.readOnly,es=e.returnKeyType,el=e.rows,eu=e.secureTextEntry,eh=void 0!==eu&&eu,ec=e.selection,ef=e.selectTextOnFocus,ed=e.showSoftInputOnFocus,ep=e.spellCheck;if(null!=y)n=y,r="email"===y?"email":"tel"===y?"tel":"search"===y?"search":"url"===y?"url":"text";else if(null!=w)switch((0,S.O)("keyboardType","keyboardType is deprecated. Use inputMode."),w){case"email-address":r="email";break;case"number-pad":case"numeric":n="numeric";break;case"decimal-pad":n="decimal";break;case"phone-pad":r="tel";break;case"search":case"web-search":r="search";break;case"url":r="url";break;default:r="text"}eh&&(r="password");var em=d.useRef({height:null,width:null}),eg=d.useRef(null),ey=d.useRef(null),ew=d.useRef(!1);d.useEffect(()=>{eg.current&&ey.current&&I(eg.current,ey.current),ew.current=eh},[eh]);var e_=d.useCallback(e=>{if(z&&L&&null!=e){var t=e.scrollHeight,r=e.scrollWidth;(t!==em.current.height||r!==em.current.width)&&(em.current.height=t,em.current.width=r,L({nativeEvent:{contentSize:{height:em.current.height,width:em.current.width}}}))}},[z,L]),ev=d.useMemo(()=>e=>{null!=e&&(e.clear=function(){null!=e&&(e.value="")},e.isFocused=function(){return null!=e&&C.Z.currentlyFocusedField()===e},e_(e))},[e_]);(0,v.Z)(()=>{var e=eg.current;null!=e&&null!=ec&&I(e,ec),document.activeElement===e&&(C.Z._currentlyFocusedNode=e)},[eg,ec]),(0,_.Z)(eg,N),(0,E.Z)(eg,{onMoveShouldSetResponder:P,onMoveShouldSetResponderCapture:V,onResponderEnd:D,onResponderGrant:q,onResponderMove:H,onResponderReject:W,onResponderRelease:G,onResponderStart:X,onResponderTerminate:K,onResponderTerminationRequest:Z,onScrollShouldSetResponder:J,onScrollShouldSetResponderCapture:Y,onSelectionChangeShouldSetResponder:ee,onSelectionChangeShouldSetResponderCapture:et,onStartShouldSetResponder:er,onStartShouldSetResponderCapture:en});var eb=(0,k.PE)().direction,ex=T(e);ex.autoCapitalize=void 0===i?"sentences":i,ex.autoComplete=o||a||"on",ex.autoCorrect=l?"on":"off",ex.dir=void 0!==f?f:"auto",null!=es&&(0,S.O)("returnKeyType","returnKeyType is deprecated. Use enterKeyHint."),ex.enterKeyHint=m||es,ex.inputMode=n,ex.onBlur=function(e){C.Z._currentlyFocusedNode=null,B&&(e.nativeEvent.text=e.target.value,B(e))},ex.onChange=function(e){var t=e.target,r=t.value;e.nativeEvent.text=r,e_(t),$&&$(e),U&&U(r)},ex.onFocus=function(e){var t=e.target;R&&(e.nativeEvent.text=t.value,R(e)),null!=t&&(C.Z._currentlyFocusedNode=t,c&&(t.value=""),ef&&(null!=O&&clearTimeout(O),O=setTimeout(()=>{null!=t&&t.select()},0)))},ex.onKeyDown=function(e){var t=e.target;e.stopPropagation();var r=!z,n=e.nativeEvent,i=n.isComposing||229===n.keyCode;F&&F(e),"Enter"!==e.key||e.shiftKey||i||e.isDefaultPrevented()||((u||!z)&&ei&&(e.preventDefault(),n.text=e.target.value,ei(e)),(null==u?r:u)&&null!=t&&setTimeout(()=>t.blur(),0))},ex.onSelect=function(e){try{var t=e.target,r=t.selectionStart,n=t.selectionEnd,i={start:r,end:n};Q&&(e.nativeEvent.selection=i,e.nativeEvent.text=e.target.value,Q(e)),ew.current===eh&&(ey.current=i)}catch(e){}},null!=p&&(0,S.O)("editable","editable is deprecated. Use readOnly."),ex.readOnly=!0===(void 0!==ea&&ea)||!1===p,null!=M&&(0,S.O)("numberOfLines","TextInput numberOfLines is deprecated. Use rows."),ex.rows=z?null!=el?el:M:1,ex.spellCheck=null!=ep?ep:l,ex.style=[{"--placeholderTextColor":eo},j.textinput$raw,j.placeholder,e.style,h&&j.caretHidden],ex.type=z?void 0:r,ex.virtualkeyboardpolicy=!1===ed?"manual":"auto";var eE=(0,x.Z)(ex),ek=(0,b.Z)(eg,eE,ev,t);ex.ref=ek;var eA=null!=e.lang?(0,k.w1)(e.lang):null,eC=e.dir||eA;return(0,g.Z)(z?"textarea":"input",ex,{writingDirection:eC||eb})});B.displayName="TextInput",B.State=C.Z;var j=A.Z.create({textinput$raw:{MozAppearance:"textfield",WebkitAppearance:"none",backgroundColor:"transparent",border:"0 solid black",borderRadius:0,boxSizing:"border-box",font:"14px System",margin:0,padding:0,resize:"none"},placeholder:{placeholderTextColor:"var(--placeholderTextColor)"},caretHidden:{caretColor:"transparent"}}),$=r(357);let U={size:"$true",fontFamily:"$body",borderWidth:1,outlineWidth:0,color:"$color",...n.$L?{tabIndex:0}:{focusable:!0},borderColor:"$borderColor",backgroundColor:"$background",minWidth:0,hoverStyle:{borderColor:"$borderColorHover"},focusStyle:{borderColor:"$borderColorFocus"},focusVisibleStyle:{outlineColor:"$outlineColor",outlineWidth:2,outlineStyle:"solid"}},L=(0,i.z)(B,{name:"Input",variants:{unstyled:{false:U},size:{"...size":(e="$true",t)=>{if(t.props.multiline||t.props.numberOfLines>1)return h(e,t);let r=(0,s.f)(e,t),i=(0,u.Pj)(e,{shift:-1,bounds:[2]}),o=(0,l.H)(e,t);return!n.$L&&o&&delete o.lineHeight,{...o,...r,paddingHorizontal:i}}},disabled:{true:{}}},defaultVariants:{unstyled:"1"===$.env.TAMAGUI_HEADLESS}},{isInput:!0,accept:{placeholderTextColor:"color",selectionColor:"color"}});function R(e,t){let r=(0,c.Fg)(),{onChangeText:n,ref:i}=function({isInput:e,props:t,ref:r}){let{id:n,onChangeText:i,value:a,defaultValue:s}=t,l=(0,d.useRef)(a||s||""),u=(0,d.useRef)(),h=(0,d.useCallback)(t=>{n&&t&&(u.current?.(),u.current=(0,p.QS)(n,{focus:t.focus,...e&&{focusAndSelect(){t.focus(),t.setSelection&&"string"==typeof l.current&&t.setSelection(0,l.current.length)}}}))},[e,n]),c=(0,o.FE)(r,h);return(0,d.useEffect)(()=>()=>{u.current?.()},[]),{ref:c,onChangeText:(0,f.z)(e=>{l.current=e,i?.(e)})}}({props:e,ref:t,isInput:!0}),a=e.placeholderTextColor,s=r[a]?.get()??a??r.placeholderColor?.get();return{ref:i,readOnly:e.disabled,...e,placeholderTextColor:s,onChangeText:n}}L.styleable((e,t)=>{let r=(0,d.useRef)(null),n=R(e,(0,o.ex)(t,r));return(0,m.jsx)(L,{...n})});var F=r(357);let N=(0,i.z)(L,{name:"TextArea",multiline:!0,whiteSpace:"pre-wrap",variants:{unstyled:{false:{height:"auto",...U}},size:{"...size":h}},defaultVariants:{unstyled:"1"===F.env.TAMAGUI_HEADLESS}}),P=N.styleable((e,t)=>{let r=(0,d.useRef)(null),i=R(e,(0,o.ex)(t,r)),a={[n.$L?"rows":"numberOfLines"]:e.unstyled?void 0:4};return(0,m.jsx)(N,{...a,...i})})}}]); \ No newline at end of file