@barbapapazes/video-toolkit 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.mjs +70 -70
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -1,145 +1,145 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as e}from"node:module";import t,{basename as n,extname as r,isAbsolute as i,join as a,resolve as o}from"node:path";import s,{stdin as c,stdout as l}from"node:process";import{format as u,inspect as d,stripVTControlCharacters as f}from"node:util";import*as p from"node:readline";import m from"node:readline";import{Writable as h}from"node:stream";import{EventEmitter as g}from"events";import{homedir as _}from"node:os";import v,{copyFileSync as y,createReadStream as b,existsSync as x,lstatSync as S,mkdirSync as C,promises as w,readFileSync as ee,readdirSync as te,realpathSync as T,statSync as ne,unlinkSync as re,writeFileSync as ie}from"node:fs";import{readFile as ae,rm as oe,writeFile as se}from"node:fs/promises";import{URL as E,fileURLToPath as D,pathToFileURL as ce}from"node:url";import O from"node:assert";import le from"node:v8";import{Buffer as ue}from"node:buffer";import{execSync as k}from"node:child_process";var A=Object.create,de=Object.defineProperty,fe=Object.getOwnPropertyDescriptor,pe=Object.getOwnPropertyNames,me=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,M=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),he=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=pe(t),a=0,o=i.length,s;a<o;a++)s=i[a],!j.call(e,s)&&s!==n&&de(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=fe(t,s))||r.enumerable});return e},ge=(e,t,n)=>(n=e==null?{}:A(me(e)),he(t||!e||!e.__esModule?de(n,`default`,{value:e,enumerable:!0}):n,e)),_e=e=>t=>ge(t.default,e),N=e(import.meta.url),P=M(((e,t)=>{let n={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};t.exports={cursor:n,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let r=0;r<e;r++)t+=this.line+(r<e-1?n.up():``);return e&&(t+=n.left),t}},beep:`\x07`}})),ve=M(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c})),ye=P(),F=ge(ve(),1);function be({onlyFirst:e=!1}={}){let t=[`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))`,`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))`].join(`|`);return new RegExp(t,e?void 0:`g`)}const xe=be();function Se(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(xe,``)}function Ce(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var we={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(e){var t=e.charCodeAt(0),n=e.length==2?e.charCodeAt(1):0,r=t;return 55296<=t&&t<=56319&&56320<=n&&n<=57343&&(t&=1023,n&=1023,r=t<<10|n,r+=65536),r==12288||65281<=r&&r<=65376||65504<=r&&r<=65510?`F`:r==8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?`H`:4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?`W`:32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r==172||r==175||10214<=r&&r<=10221||10629<=r&&r<=10630?`Na`:r==161||r==164||167<=r&&r<=168||r==170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r==198||r==208||215<=r&&r<=216||222<=r&&r<=225||r==230||232<=r&&r<=234||236<=r&&r<=237||r==240||242<=r&&r<=243||247<=r&&r<=250||r==252||r==254||r==257||r==273||r==275||r==283||294<=r&&r<=295||r==299||305<=r&&r<=307||r==312||319<=r&&r<=322||r==324||328<=r&&r<=331||r==333||338<=r&&r<=339||358<=r&&r<=359||r==363||r==462||r==464||r==466||r==468||r==470||r==472||r==474||r==476||r==593||r==609||r==708||r==711||713<=r&&r<=715||r==717||r==720||728<=r&&r<=731||r==733||r==735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r==1025||1040<=r&&r<=1103||r==1105||r==8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r==8240||8242<=r&&r<=8243||r==8245||r==8251||r==8254||r==8308||r==8319||8321<=r&&r<=8324||r==8364||r==8451||r==8453||r==8457||r==8467||r==8470||8481<=r&&r<=8482||r==8486||r==8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r==8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r==8658||r==8660||r==8679||r==8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r==8715||r==8719||r==8721||r==8725||r==8730||8733<=r&&r<=8736||r==8739||r==8741||8743<=r&&r<=8748||r==8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r==8776||r==8780||r==8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r==8853||r==8857||r==8869||r==8895||r==8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r==9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r==9711||9733<=r&&r<=9734||r==9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r==9756||r==9758||r==9792||r==9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r==9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r==9955||9960<=r&&r<=9983||r==10045||r==10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r==65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?`A`:`N`},t.characterLength=function(e){var t=this.eastAsianWidth(e);return t==`F`||t==`W`||t==`A`?2:1};function n(e){return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(e){for(var t=n(e),r=0,i=0;i<t.length;i++)r+=this.characterLength(t[i]);return r},t.slice=function(e,r,i){textLen=t.length(e),r||=0,i||=1,r<0&&(r=textLen+r),i<0&&(i=textLen+i);for(var a=``,o=0,s=n(e),c=0;c<s.length;c++){var l=s[c],u=t.length(l);if(o>=r-(u==2?1:0))if(o+u<=i)a+=l;else break;o+=u}return a}})(we);var Te=we.exports;const I=Ce(Te),Ee=Ce(function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g});function L(e,t={}){if(typeof e!=`string`||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=Se(e),e.length===0))return 0;e=e.replace(Ee(),` `);let n=t.ambiguousIsNarrow?1:2,r=0;for(let t of e){let e=t.codePointAt(0);if(!(e<=31||e>=127&&e<=159||e>=768&&e<=879))switch(I.eastAsianWidth(t)){case`F`:case`W`:r+=2;break;case`A`:r+=n;break;default:r+=1}}return r}const De=(e=0)=>t=>`\x1B[${t+e}m`,Oe=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,ke=(e=0)=>(t,n,r)=>`\x1B[${38+e};2;${t};${n};${r}m`,R={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(R.modifier);const Ae=Object.keys(R.color),je=Object.keys(R.bgColor);[...Ae,...je];function Me(){let e=new Map;for(let[t,n]of Object.entries(R)){for(let[t,r]of Object.entries(n))R[t]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},n[t]=R[t],e.set(r[0],r[1]);Object.defineProperty(R,t,{value:n,enumerable:!1})}return Object.defineProperty(R,`codes`,{value:e,enumerable:!1}),R.color.close=`\x1B[39m`,R.bgColor.close=`\x1B[49m`,R.color.ansi=De(),R.color.ansi256=Oe(),R.color.ansi16m=ke(),R.bgColor.ansi=De(10),R.bgColor.ansi256=Oe(10),R.bgColor.ansi16m=ke(10),Object.defineProperties(R,{rgbToAnsi256:{value:(e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>R.rgbToAnsi256(...R.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,r;if(e>=232)t=((e-232)*10+8)/255,n=t,r=t;else{e-=16;let i=e%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}let i=Math.max(t,n,r)*2;if(i===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>R.ansi256ToAnsi(R.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>R.ansi256ToAnsi(R.hexToAnsi256(e)),enumerable:!1}}),R}const Ne=Me(),Pe=new Set([`\x1B`,`›`]),Fe=`]8;;`,Ie=e=>`${Pe.values().next().value}[${e}m`,Le=e=>`${Pe.values().next().value}${Fe}${e}`,Re=e=>e.split(` `).map(e=>L(e)),ze=(e,t,n)=>{let r=[...t],i=!1,a=!1,o=L(Se(e[e.length-1]));for(let[t,s]of r.entries()){let c=L(s);if(o+c<=n?e[e.length-1]+=s:(e.push(s),o=0),Pe.has(s)&&(i=!0,a=r.slice(t+1).join(``).startsWith(Fe)),i){a?s===`\x07`&&(i=!1,a=!1):s===`m`&&(i=!1);continue}o+=c,o===n&&t<r.length-1&&(e.push(``),o=0)}!o&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Be=e=>{let t=e.split(` `),n=t.length;for(;n>0&&!(L(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ve=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=Re(e),s=[``];for(let[r,i]of e.split(` `).entries()){n.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let e=L(s[s.length-1]);if(r!==0&&(e>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),e=0),(e>0||n.trim===!1)&&(s[s.length-1]+=` `,e++)),n.hard&&o[r]>t){let n=t-e,a=1+Math.floor((o[r]-n-1)/t);Math.floor((o[r]-1)/t)<a&&s.push(``),ze(s,i,t);continue}if(e+o[r]>t&&e>0&&o[r]>0){if(n.wordWrap===!1&&e<t){ze(s,i,t);continue}s.push(``)}if(e+o[r]>t&&n.wordWrap===!1){ze(s,i,t);continue}s[s.length-1]+=i}n.trim!==!1&&(s=s.map(e=>Be(e)));let c=[...s.join(`
3
- `)];for(let[e,t]of c.entries()){if(r+=t,Pe.has(t)){let{groups:t}=RegExp(`(?:\\[(?<code>\\d+)m|\\${Fe}(?<uri>.*))`).exec(c.slice(e).join(``))||{groups:{}};if(t.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}let n=Ne.codes.get(Number(i));c[e+1]===`
4
- `?(a&&(r+=Le(``)),i&&n&&(r+=Ie(n))):t===`
5
- `&&(i&&n&&(r+=Ie(i)),a&&(r+=Le(a)))}return r};function He(e,t,n){return String(e).normalize().replace(/\r\n/g,`
2
+ import{createRequire as e}from"node:module";import t,{basename as n,extname as r,isAbsolute as i,join as a,resolve as o}from"node:path";import s,{stdin as c,stdout as l}from"node:process";import{format as u,inspect as d,stripVTControlCharacters as f}from"node:util";import*as p from"node:readline";import m from"node:readline";import{Writable as h}from"node:stream";import{EventEmitter as g}from"events";import{homedir as _}from"node:os";import v,{copyFileSync as y,createReadStream as b,existsSync as x,lstatSync as S,mkdirSync as C,promises as w,readFileSync as ee,readdirSync as te,realpathSync as T,statSync as ne,unlinkSync as re,writeFileSync as ie}from"node:fs";import{readFile as ae,rm as oe,writeFile as se}from"node:fs/promises";import{URL as E,fileURLToPath as D,pathToFileURL as ce}from"node:url";import O from"node:assert";import le from"node:v8";import{Buffer as ue}from"node:buffer";import{execSync as k}from"node:child_process";var de=Object.create,fe=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,me=Object.getOwnPropertyNames,he=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty,A=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_e=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=me(t),a=0,o=i.length,s;a<o;a++)s=i[a],!ge.call(e,s)&&s!==n&&fe(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=pe(t,s))||r.enumerable});return e},ve=(e,t,n)=>(n=e==null?{}:de(he(e)),_e(t||!e||!e.__esModule?fe(n,`default`,{value:e,enumerable:!0}):n,e)),ye=e=>t=>ve(t.default,e),j=e(import.meta.url),M=A(((e,t)=>{let n={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};t.exports={cursor:n,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let r=0;r<e;r++)t+=this.line+(r<e-1?n.up():``);return e&&(t+=n.left),t}},beep:`\x07`}})),be=A(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c})),xe=M(),N=ve(be(),1);function Se({onlyFirst:e=!1}={}){let t=[`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))`,`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))`].join(`|`);return new RegExp(t,e?void 0:`g`)}const Ce=Se();function we(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(Ce,``)}function Te(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var Ee={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(e){var t=e.charCodeAt(0),n=e.length==2?e.charCodeAt(1):0,r=t;return 55296<=t&&t<=56319&&56320<=n&&n<=57343&&(t&=1023,n&=1023,r=t<<10|n,r+=65536),r==12288||65281<=r&&r<=65376||65504<=r&&r<=65510?`F`:r==8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?`H`:4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?`W`:32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r==172||r==175||10214<=r&&r<=10221||10629<=r&&r<=10630?`Na`:r==161||r==164||167<=r&&r<=168||r==170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r==198||r==208||215<=r&&r<=216||222<=r&&r<=225||r==230||232<=r&&r<=234||236<=r&&r<=237||r==240||242<=r&&r<=243||247<=r&&r<=250||r==252||r==254||r==257||r==273||r==275||r==283||294<=r&&r<=295||r==299||305<=r&&r<=307||r==312||319<=r&&r<=322||r==324||328<=r&&r<=331||r==333||338<=r&&r<=339||358<=r&&r<=359||r==363||r==462||r==464||r==466||r==468||r==470||r==472||r==474||r==476||r==593||r==609||r==708||r==711||713<=r&&r<=715||r==717||r==720||728<=r&&r<=731||r==733||r==735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r==1025||1040<=r&&r<=1103||r==1105||r==8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r==8240||8242<=r&&r<=8243||r==8245||r==8251||r==8254||r==8308||r==8319||8321<=r&&r<=8324||r==8364||r==8451||r==8453||r==8457||r==8467||r==8470||8481<=r&&r<=8482||r==8486||r==8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r==8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r==8658||r==8660||r==8679||r==8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r==8715||r==8719||r==8721||r==8725||r==8730||8733<=r&&r<=8736||r==8739||r==8741||8743<=r&&r<=8748||r==8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r==8776||r==8780||r==8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r==8853||r==8857||r==8869||r==8895||r==8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r==9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r==9711||9733<=r&&r<=9734||r==9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r==9756||r==9758||r==9792||r==9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r==9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r==9955||9960<=r&&r<=9983||r==10045||r==10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r==65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?`A`:`N`},t.characterLength=function(e){var t=this.eastAsianWidth(e);return t==`F`||t==`W`||t==`A`?2:1};function n(e){return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(e){for(var t=n(e),r=0,i=0;i<t.length;i++)r+=this.characterLength(t[i]);return r},t.slice=function(e,r,i){textLen=t.length(e),r||=0,i||=1,r<0&&(r=textLen+r),i<0&&(i=textLen+i);for(var a=``,o=0,s=n(e),c=0;c<s.length;c++){var l=s[c],u=t.length(l);if(o>=r-(u==2?1:0))if(o+u<=i)a+=l;else break;o+=u}return a}})(Ee);var De=Ee.exports;const P=Te(De),Oe=Te(function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g});function F(e,t={}){if(typeof e!=`string`||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=we(e),e.length===0))return 0;e=e.replace(Oe(),` `);let n=t.ambiguousIsNarrow?1:2,r=0;for(let t of e){let e=t.codePointAt(0);if(!(e<=31||e>=127&&e<=159||e>=768&&e<=879))switch(P.eastAsianWidth(t)){case`F`:case`W`:r+=2;break;case`A`:r+=n;break;default:r+=1}}return r}const ke=(e=0)=>t=>`\x1B[${t+e}m`,Ae=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,je=(e=0)=>(t,n,r)=>`\x1B[${38+e};2;${t};${n};${r}m`,I={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(I.modifier);const Me=Object.keys(I.color),Ne=Object.keys(I.bgColor);[...Me,...Ne];function Pe(){let e=new Map;for(let[t,n]of Object.entries(I)){for(let[t,r]of Object.entries(n))I[t]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},n[t]=I[t],e.set(r[0],r[1]);Object.defineProperty(I,t,{value:n,enumerable:!1})}return Object.defineProperty(I,`codes`,{value:e,enumerable:!1}),I.color.close=`\x1B[39m`,I.bgColor.close=`\x1B[49m`,I.color.ansi=ke(),I.color.ansi256=Ae(),I.color.ansi16m=je(),I.bgColor.ansi=ke(10),I.bgColor.ansi256=Ae(10),I.bgColor.ansi16m=je(10),Object.defineProperties(I,{rgbToAnsi256:{value:(e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>I.rgbToAnsi256(...I.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,r;if(e>=232)t=((e-232)*10+8)/255,n=t,r=t;else{e-=16;let i=e%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}let i=Math.max(t,n,r)*2;if(i===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>I.ansi256ToAnsi(I.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>I.ansi256ToAnsi(I.hexToAnsi256(e)),enumerable:!1}}),I}const Fe=Pe(),Ie=new Set([`\x1B`,`›`]),Le=`]8;;`,Re=e=>`${Ie.values().next().value}[${e}m`,ze=e=>`${Ie.values().next().value}${Le}${e}`,Be=e=>e.split(` `).map(e=>F(e)),Ve=(e,t,n)=>{let r=[...t],i=!1,a=!1,o=F(we(e[e.length-1]));for(let[t,s]of r.entries()){let c=F(s);if(o+c<=n?e[e.length-1]+=s:(e.push(s),o=0),Ie.has(s)&&(i=!0,a=r.slice(t+1).join(``).startsWith(Le)),i){a?s===`\x07`&&(i=!1,a=!1):s===`m`&&(i=!1);continue}o+=c,o===n&&t<r.length-1&&(e.push(``),o=0)}!o&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},He=e=>{let t=e.split(` `),n=t.length;for(;n>0&&!(F(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ue=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=Be(e),s=[``];for(let[r,i]of e.split(` `).entries()){n.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let e=F(s[s.length-1]);if(r!==0&&(e>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),e=0),(e>0||n.trim===!1)&&(s[s.length-1]+=` `,e++)),n.hard&&o[r]>t){let n=t-e,a=1+Math.floor((o[r]-n-1)/t);Math.floor((o[r]-1)/t)<a&&s.push(``),Ve(s,i,t);continue}if(e+o[r]>t&&e>0&&o[r]>0){if(n.wordWrap===!1&&e<t){Ve(s,i,t);continue}s.push(``)}if(e+o[r]>t&&n.wordWrap===!1){Ve(s,i,t);continue}s[s.length-1]+=i}n.trim!==!1&&(s=s.map(e=>He(e)));let c=[...s.join(`
3
+ `)];for(let[e,t]of c.entries()){if(r+=t,Ie.has(t)){let{groups:t}=RegExp(`(?:\\[(?<code>\\d+)m|\\${Le}(?<uri>.*))`).exec(c.slice(e).join(``))||{groups:{}};if(t.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}let n=Fe.codes.get(Number(i));c[e+1]===`
4
+ `?(a&&(r+=ze(``)),i&&n&&(r+=Re(n))):t===`
5
+ `&&(i&&n&&(r+=Re(i)),a&&(r+=ze(a)))}return r};function We(e,t,n){return String(e).normalize().replace(/\r\n/g,`
6
6
  `).split(`
7
- `).map(e=>Ve(e,t,n)).join(`
8
- `)}const Ue={actions:new Set([`up`,`down`,`left`,`right`,`space`,`enter`,`cancel`]),aliases:new Map([[`k`,`up`],[`j`,`down`],[`h`,`left`],[`l`,`right`],[``,`cancel`],[`escape`,`cancel`]])};function We(e,t){if(typeof e==`string`)return Ue.aliases.get(e)===t;for(let n of e)if(n!==void 0&&We(n,t))return!0;return!1}function Ge(e,t){if(e===t)return;let n=e.split(`
7
+ `).map(e=>Ue(e,t,n)).join(`
8
+ `)}const Ge={actions:new Set([`up`,`down`,`left`,`right`,`space`,`enter`,`cancel`]),aliases:new Map([[`k`,`up`],[`j`,`down`],[`h`,`left`],[`l`,`right`],[``,`cancel`],[`escape`,`cancel`]])};function Ke(e,t){if(typeof e==`string`)return Ge.aliases.get(e)===t;for(let n of e)if(n!==void 0&&Ke(n,t))return!0;return!1}function qe(e,t){if(e===t)return;let n=e.split(`
9
9
  `),r=t.split(`
10
- `),i=[];for(let e=0;e<Math.max(n.length,r.length);e++)n[e]!==r[e]&&i.push(e);return i}const Ke=globalThis.process.platform.startsWith(`win`),qe=Symbol(`clack:cancel`);function Je(e,t){let n=e;n.isTTY&&n.setRawMode(t)}function Ye({input:e=c,output:t=l,overwrite:n=!0,hideCursor:r=!0}={}){let i=p.createInterface({input:e,output:t,prompt:``,tabSize:1});p.emitKeypressEvents(e,i),e.isTTY&&e.setRawMode(!0);let a=(i,{name:o,sequence:s})=>{if(We([String(i),o,s],`cancel`)){r&&t.write(ye.cursor.show),process.exit(0);return}if(!n)return;let c=o===`return`?0:-1,l=o===`return`?-1:0;p.moveCursor(t,c,l,()=>{p.clearLine(t,1,()=>{e.once(`keypress`,a)})})};return r&&t.write(ye.cursor.hide),e.once(`keypress`,a),()=>{e.off(`keypress`,a),r&&t.write(ye.cursor.show),e.isTTY&&!Ke&&e.setRawMode(!1),i.terminal=!1,i.close()}}var Xe=Object.defineProperty,z=(e,t,n)=>t in e?Xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ze=(e,t,n)=>(z(e,typeof t==`symbol`?t:t+``,n),n),Qe=class{constructor(e,t=!0){Ze(this,`input`),Ze(this,`output`),Ze(this,`_abortSignal`),Ze(this,`rl`),Ze(this,`opts`),Ze(this,`_render`),Ze(this,`_track`,!1),Ze(this,`_prevFrame`,``),Ze(this,`_subscribers`,new Map),Ze(this,`_cursor`,0),Ze(this,`state`,`initial`),Ze(this,`error`,``),Ze(this,`value`);let{input:n=c,output:r=l,render:i,signal:a,...o}=e;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=t,this._abortSignal=a,this.input=n,this.output=r}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let n=this._subscribers.get(e)??[];n.push(t),this._subscribers.set(e,n)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let n=this._subscribers.get(e)??[],r=[];for(let e of n)e.cb(...t),e.once&&r.push(()=>n.splice(n.indexOf(e),1));for(let e of r)e()}prompt(){return new Promise((e,t)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state=`cancel`,this.close(),e(qe);this._abortSignal.addEventListener(`abort`,()=>{this.state=`cancel`,this.close()},{once:!0})}let n=new h;n._write=(e,t,n)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,``),this._cursor=this.rl?.cursor??0,this.emit(`value`,this.value)),n()},this.input.pipe(n),this.rl=m.createInterface({input:this.input,output:n,tabSize:2,prompt:``,escapeCodeTimeout:50,terminal:!0}),m.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on(`keypress`,this.onKeypress),Je(this.input,!0),this.output.on(`resize`,this.render),this.render(),this.once(`submit`,()=>{this.output.write(ye.cursor.show),this.output.off(`resize`,this.render),Je(this.input,!1),e(this.value)}),this.once(`cancel`,()=>{this.output.write(ye.cursor.show),this.output.off(`resize`,this.render),Je(this.input,!1),e(qe)})})}onKeypress(e,t){if(this.state===`error`&&(this.state=`active`),t?.name&&(!this._track&&Ue.aliases.has(t.name)&&this.emit(`cursor`,Ue.aliases.get(t.name)),Ue.actions.has(t.name)&&this.emit(`cursor`,t.name)),e&&(e.toLowerCase()===`y`||e.toLowerCase()===`n`)&&this.emit(`confirm`,e.toLowerCase()===`y`),e===` `&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit(`value`,this.opts.placeholder))),e&&this.emit(`key`,e.toLowerCase()),t?.name===`return`){if(!this.value&&this.opts.placeholder&&(this.rl?.write(this.opts.placeholder),this.emit(`value`,this.opts.placeholder)),this.opts.validate){let e=this.opts.validate(this.value);e&&(this.error=e instanceof Error?e.message:e,this.state=`error`,this.rl?.write(this.value))}this.state!==`error`&&(this.state=`submit`)}We([e,t?.name,t?.sequence],`cancel`)&&(this.state=`cancel`),(this.state===`submit`||this.state===`cancel`)&&this.emit(`finalize`),this.render(),(this.state===`submit`||this.state===`cancel`)&&this.close()}close(){this.input.unpipe(),this.input.removeListener(`keypress`,this.onKeypress),this.output.write(`
11
- `),Je(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=He(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
12
- `).length-1;this.output.write(ye.cursor.move(-999,e*-1))}render(){let e=He(this._render(this)??``,process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state===`initial`)this.output.write(ye.cursor.hide);else{let t=Ge(this._prevFrame,e);if(this.restoreCursor(),t&&t?.length===1){let n=t[0];this.output.write(ye.cursor.move(0,n)),this.output.write(ye.erase.lines(1));let r=e.split(`
13
- `);this.output.write(r[n]),this._prevFrame=e,this.output.write(ye.cursor.move(0,r.length-n-1));return}if(t&&t?.length>1){let n=t[0];this.output.write(ye.cursor.move(0,n)),this.output.write(ye.erase.down());let r=e.split(`
10
+ `),i=[];for(let e=0;e<Math.max(n.length,r.length);e++)n[e]!==r[e]&&i.push(e);return i}const Je=globalThis.process.platform.startsWith(`win`),Ye=Symbol(`clack:cancel`);function Xe(e){return e===Ye}function Ze(e,t){let n=e;n.isTTY&&n.setRawMode(t)}function Qe({input:e=c,output:t=l,overwrite:n=!0,hideCursor:r=!0}={}){let i=p.createInterface({input:e,output:t,prompt:``,tabSize:1});p.emitKeypressEvents(e,i),e.isTTY&&e.setRawMode(!0);let a=(i,{name:o,sequence:s})=>{if(Ke([String(i),o,s],`cancel`)){r&&t.write(xe.cursor.show),process.exit(0);return}if(!n)return;let c=o===`return`?0:-1,l=o===`return`?-1:0;p.moveCursor(t,c,l,()=>{p.clearLine(t,1,()=>{e.once(`keypress`,a)})})};return r&&t.write(xe.cursor.hide),e.once(`keypress`,a),()=>{e.off(`keypress`,a),r&&t.write(xe.cursor.show),e.isTTY&&!Je&&e.setRawMode(!1),i.terminal=!1,i.close()}}var L=Object.defineProperty,$e=(e,t,n)=>t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R=(e,t,n)=>($e(e,typeof t==`symbol`?t:t+``,n),n),et=class{constructor(e,t=!0){R(this,`input`),R(this,`output`),R(this,`_abortSignal`),R(this,`rl`),R(this,`opts`),R(this,`_render`),R(this,`_track`,!1),R(this,`_prevFrame`,``),R(this,`_subscribers`,new Map),R(this,`_cursor`,0),R(this,`state`,`initial`),R(this,`error`,``),R(this,`value`);let{input:n=c,output:r=l,render:i,signal:a,...o}=e;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=t,this._abortSignal=a,this.input=n,this.output=r}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let n=this._subscribers.get(e)??[];n.push(t),this._subscribers.set(e,n)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let n=this._subscribers.get(e)??[],r=[];for(let e of n)e.cb(...t),e.once&&r.push(()=>n.splice(n.indexOf(e),1));for(let e of r)e()}prompt(){return new Promise((e,t)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state=`cancel`,this.close(),e(Ye);this._abortSignal.addEventListener(`abort`,()=>{this.state=`cancel`,this.close()},{once:!0})}let n=new h;n._write=(e,t,n)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,``),this._cursor=this.rl?.cursor??0,this.emit(`value`,this.value)),n()},this.input.pipe(n),this.rl=m.createInterface({input:this.input,output:n,tabSize:2,prompt:``,escapeCodeTimeout:50,terminal:!0}),m.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on(`keypress`,this.onKeypress),Ze(this.input,!0),this.output.on(`resize`,this.render),this.render(),this.once(`submit`,()=>{this.output.write(xe.cursor.show),this.output.off(`resize`,this.render),Ze(this.input,!1),e(this.value)}),this.once(`cancel`,()=>{this.output.write(xe.cursor.show),this.output.off(`resize`,this.render),Ze(this.input,!1),e(Ye)})})}onKeypress(e,t){if(this.state===`error`&&(this.state=`active`),t?.name&&(!this._track&&Ge.aliases.has(t.name)&&this.emit(`cursor`,Ge.aliases.get(t.name)),Ge.actions.has(t.name)&&this.emit(`cursor`,t.name)),e&&(e.toLowerCase()===`y`||e.toLowerCase()===`n`)&&this.emit(`confirm`,e.toLowerCase()===`y`),e===` `&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit(`value`,this.opts.placeholder))),e&&this.emit(`key`,e.toLowerCase()),t?.name===`return`){if(!this.value&&this.opts.placeholder&&(this.rl?.write(this.opts.placeholder),this.emit(`value`,this.opts.placeholder)),this.opts.validate){let e=this.opts.validate(this.value);e&&(this.error=e instanceof Error?e.message:e,this.state=`error`,this.rl?.write(this.value))}this.state!==`error`&&(this.state=`submit`)}Ke([e,t?.name,t?.sequence],`cancel`)&&(this.state=`cancel`),(this.state===`submit`||this.state===`cancel`)&&this.emit(`finalize`),this.render(),(this.state===`submit`||this.state===`cancel`)&&this.close()}close(){this.input.unpipe(),this.input.removeListener(`keypress`,this.onKeypress),this.output.write(`
11
+ `),Ze(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=We(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
12
+ `).length-1;this.output.write(xe.cursor.move(-999,e*-1))}render(){let e=We(this._render(this)??``,process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state===`initial`)this.output.write(xe.cursor.hide);else{let t=qe(this._prevFrame,e);if(this.restoreCursor(),t&&t?.length===1){let n=t[0];this.output.write(xe.cursor.move(0,n)),this.output.write(xe.erase.lines(1));let r=e.split(`
13
+ `);this.output.write(r[n]),this._prevFrame=e,this.output.write(xe.cursor.move(0,r.length-n-1));return}if(t&&t?.length>1){let n=t[0];this.output.write(xe.cursor.move(0,n)),this.output.write(xe.erase.down());let r=e.split(`
14
14
  `).slice(n);this.output.write(r.join(`
15
- `)),this._prevFrame=e;return}this.output.write(ye.erase.down())}this.output.write(e),this.state===`initial`&&(this.state=`active`),this._prevFrame=e}}};Object.defineProperty,Object.defineProperty,Object.defineProperty;var $e=Object.defineProperty,et=(e,t,n)=>t in e?$e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tt=(e,t,n)=>(et(e,typeof t==`symbol`?t:t+``,n),n),nt=class extends Qe{constructor(e){super(e,!1),tt(this,`options`),tt(this,`cursor`,0),this.options=e.options,this.cursor=this.options.findIndex(({value:t})=>t===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case`down`:case`right`:this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};Object.defineProperty;var rt=class extends Qe{get valueWithCursor(){if(this.state===`submit`)return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let e=this.value.slice(0,this.cursor),[t,...n]=this.value.slice(this.cursor);return`${e}${F.default.inverse(t)}${n.join(``)}`}get cursor(){return this._cursor}constructor(e){super(e),this.on(`finalize`,()=>{this.value||=e.defaultValue})}};function it(){return s.platform===`win32`?!!s.env.CI||!!s.env.WT_SESSION||!!s.env.TERMINUS_SUBLIME||s.env.ConEmuTask===`{cmd::Cmder}`||s.env.TERM_PROGRAM===`Terminus-Sublime`||s.env.TERM_PROGRAM===`vscode`||s.env.TERM===`xterm-256color`||s.env.TERM===`alacritty`||s.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:s.env.TERM!==`linux`}const at=it(),ot=(e,t)=>at?e:t,st=ot(`◆`,`*`),ct=ot(`■`,`x`),B=ot(`▲`,`x`),lt=ot(`◇`,`o`),ut=ot(`┌`,`T`),V=ot(`│`,`|`),dt=ot(`└`,`—`),ft=ot(`●`,`>`),pt=ot(`○`,` `),mt=ot(`●`,`•`),ht=ot(`◆`,`*`),gt=ot(`▲`,`!`),_t=ot(`■`,`x`),vt=e=>{switch(e){case`initial`:case`active`:return F.default.cyan(st);case`cancel`:return F.default.red(ct);case`error`:return F.default.yellow(B);case`submit`:return F.default.green(lt)}},yt=e=>{let{cursor:t,options:n,style:r}=e,i=e.maxItems??1/0,a=Math.max(process.stdout.rows-4,0),o=Math.min(a,Math.max(i,5)),s=0;t>=s+o-3?s=Math.max(Math.min(t-o+3,n.length-o),0):t<s+2&&(s=Math.max(t-2,0));let c=o<n.length&&s>0,l=o<n.length&&s+o<n.length;return n.slice(s,s+o).map((e,n,i)=>{let a=n===0&&c,o=n===i.length-1&&l;return a||o?F.default.dim(`...`):r(e,n+s===t)})},bt=e=>new rt({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,render(){let t=`${F.default.gray(V)}
16
- ${vt(this.state)} ${e.message}
17
- `,n=e.placeholder?F.default.inverse(e.placeholder[0])+F.default.dim(e.placeholder.slice(1)):F.default.inverse(F.default.hidden(`_`)),r=this.value?this.valueWithCursor:n;switch(this.state){case`error`:return`${t.trim()}
18
- ${F.default.yellow(V)} ${r}
19
- ${F.default.yellow(dt)} ${F.default.yellow(this.error)}
20
- `;case`submit`:return`${t}${F.default.gray(V)} ${F.default.dim(this.value||e.placeholder)}`;case`cancel`:return`${t}${F.default.gray(V)} ${F.default.strikethrough(F.default.dim(this.value??``))}${this.value?.trim()?`
21
- ${F.default.gray(V)}`:``}`;default:return`${t}${F.default.cyan(V)} ${r}
22
- ${F.default.cyan(dt)}
23
- `}}}).prompt(),xt=e=>{let t=(e,t)=>{let n=e.label??String(e.value);switch(t){case`selected`:return`${F.default.dim(n)}`;case`active`:return`${F.default.green(ft)} ${n} ${e.hint?F.default.dim(`(${e.hint})`):``}`;case`cancelled`:return`${F.default.strikethrough(F.default.dim(n))}`;default:return`${F.default.dim(pt)} ${F.default.dim(n)}`}};return new nt({options:e.options,initialValue:e.initialValue,render(){let n=`${F.default.gray(V)}
24
- ${vt(this.state)} ${e.message}
25
- `;switch(this.state){case`submit`:return`${n}${F.default.gray(V)} ${t(this.options[this.cursor],`selected`)}`;case`cancel`:return`${n}${F.default.gray(V)} ${t(this.options[this.cursor],`cancelled`)}
26
- ${F.default.gray(V)}`;default:return`${n}${F.default.cyan(V)} ${yt({cursor:this.cursor,options:this.options,maxItems:e.maxItems,style:(e,n)=>t(e,n?`active`:`inactive`)}).join(`
27
- ${F.default.cyan(V)} `)}
28
- ${F.default.cyan(dt)}
29
- `}}}).prompt()},St=(e=``)=>{process.stdout.write(`${F.default.gray(ut)} ${e}
30
- `)},Ct=(e=``)=>{process.stdout.write(`${F.default.gray(V)}
31
- ${F.default.gray(dt)} ${e}
15
+ `)),this._prevFrame=e;return}this.output.write(xe.erase.down())}this.output.write(e),this.state===`initial`&&(this.state=`active`),this._prevFrame=e}}};Object.defineProperty,Object.defineProperty,Object.defineProperty;var tt=Object.defineProperty,nt=(e,t,n)=>t in e?tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rt=(e,t,n)=>(nt(e,typeof t==`symbol`?t:t+``,n),n),it=class extends et{constructor(e){super(e,!1),rt(this,`options`),rt(this,`cursor`,0),this.options=e.options,this.cursor=this.options.findIndex(({value:t})=>t===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case`down`:case`right`:this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};Object.defineProperty;var at=class extends et{get valueWithCursor(){if(this.state===`submit`)return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let e=this.value.slice(0,this.cursor),[t,...n]=this.value.slice(this.cursor);return`${e}${N.default.inverse(t)}${n.join(``)}`}get cursor(){return this._cursor}constructor(e){super(e),this.on(`finalize`,()=>{this.value||=e.defaultValue})}};function ot(){return s.platform===`win32`?!!s.env.CI||!!s.env.WT_SESSION||!!s.env.TERMINUS_SUBLIME||s.env.ConEmuTask===`{cmd::Cmder}`||s.env.TERM_PROGRAM===`Terminus-Sublime`||s.env.TERM_PROGRAM===`vscode`||s.env.TERM===`xterm-256color`||s.env.TERM===`alacritty`||s.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:s.env.TERM!==`linux`}const st=ot(),ct=(e,t)=>st?e:t,lt=ct(`◆`,`*`),z=ct(`■`,`x`),ut=ct(`▲`,`x`),dt=ct(`◇`,`o`),ft=ct(`┌`,`T`),B=ct(`│`,`|`),pt=ct(`└`,`—`),mt=ct(`●`,`>`),ht=ct(`○`,` `),gt=ct(`●`,`•`),_t=ct(`◆`,`*`),vt=ct(`▲`,`!`),yt=ct(`■`,`x`),bt=e=>{switch(e){case`initial`:case`active`:return N.default.cyan(lt);case`cancel`:return N.default.red(z);case`error`:return N.default.yellow(ut);case`submit`:return N.default.green(dt)}},xt=e=>{let{cursor:t,options:n,style:r}=e,i=e.maxItems??1/0,a=Math.max(process.stdout.rows-4,0),o=Math.min(a,Math.max(i,5)),s=0;t>=s+o-3?s=Math.max(Math.min(t-o+3,n.length-o),0):t<s+2&&(s=Math.max(t-2,0));let c=o<n.length&&s>0,l=o<n.length&&s+o<n.length;return n.slice(s,s+o).map((e,n,i)=>{let a=n===0&&c,o=n===i.length-1&&l;return a||o?N.default.dim(`...`):r(e,n+s===t)})},St=e=>new at({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,render(){let t=`${N.default.gray(B)}
16
+ ${bt(this.state)} ${e.message}
17
+ `,n=e.placeholder?N.default.inverse(e.placeholder[0])+N.default.dim(e.placeholder.slice(1)):N.default.inverse(N.default.hidden(`_`)),r=this.value?this.valueWithCursor:n;switch(this.state){case`error`:return`${t.trim()}
18
+ ${N.default.yellow(B)} ${r}
19
+ ${N.default.yellow(pt)} ${N.default.yellow(this.error)}
20
+ `;case`submit`:return`${t}${N.default.gray(B)} ${N.default.dim(this.value||e.placeholder)}`;case`cancel`:return`${t}${N.default.gray(B)} ${N.default.strikethrough(N.default.dim(this.value??``))}${this.value?.trim()?`
21
+ ${N.default.gray(B)}`:``}`;default:return`${t}${N.default.cyan(B)} ${r}
22
+ ${N.default.cyan(pt)}
23
+ `}}}).prompt(),Ct=e=>{let t=(e,t)=>{let n=e.label??String(e.value);switch(t){case`selected`:return`${N.default.dim(n)}`;case`active`:return`${N.default.green(mt)} ${n} ${e.hint?N.default.dim(`(${e.hint})`):``}`;case`cancelled`:return`${N.default.strikethrough(N.default.dim(n))}`;default:return`${N.default.dim(ht)} ${N.default.dim(n)}`}};return new it({options:e.options,initialValue:e.initialValue,render(){let n=`${N.default.gray(B)}
24
+ ${bt(this.state)} ${e.message}
25
+ `;switch(this.state){case`submit`:return`${n}${N.default.gray(B)} ${t(this.options[this.cursor],`selected`)}`;case`cancel`:return`${n}${N.default.gray(B)} ${t(this.options[this.cursor],`cancelled`)}
26
+ ${N.default.gray(B)}`;default:return`${n}${N.default.cyan(B)} ${xt({cursor:this.cursor,options:this.options,maxItems:e.maxItems,style:(e,n)=>t(e,n?`active`:`inactive`)}).join(`
27
+ ${N.default.cyan(B)} `)}
28
+ ${N.default.cyan(pt)}
29
+ `}}}).prompt()},wt=(e=``)=>{process.stdout.write(`${N.default.gray(ft)} ${e}
30
+ `)},Tt=(e=``)=>{process.stdout.write(`${N.default.gray(B)}
31
+ ${N.default.gray(pt)} ${e}
32
32
 
33
- `)},H={message:(e=``,{symbol:t=F.default.gray(V)}={})=>{let n=[`${F.default.gray(V)}`];if(e){let[r,...i]=e.split(`
34
- `);n.push(`${t} ${r}`,...i.map(e=>`${F.default.gray(V)} ${e}`))}process.stdout.write(`${n.join(`
33
+ `)},V={message:(e=``,{symbol:t=N.default.gray(B)}={})=>{let n=[`${N.default.gray(B)}`];if(e){let[r,...i]=e.split(`
34
+ `);n.push(`${t} ${r}`,...i.map(e=>`${N.default.gray(B)} ${e}`))}process.stdout.write(`${n.join(`
35
35
  `)}
36
- `)},info:e=>{H.message(e,{symbol:F.default.blue(mt)})},success:e=>{H.message(e,{symbol:F.default.green(ht)})},step:e=>{H.message(e,{symbol:F.default.green(lt)})},warn:e=>{H.message(e,{symbol:F.default.yellow(gt)})},warning:e=>{H.warn(e)},error:e=>{H.message(e,{symbol:F.default.red(_t)})}},wt=`${F.default.gray(V)} `,Tt={message:async(e,{symbol:t=F.default.gray(V)}={})=>{process.stdout.write(`${F.default.gray(V)}
36
+ `)},info:e=>{V.message(e,{symbol:N.default.blue(gt)})},success:e=>{V.message(e,{symbol:N.default.green(_t)})},step:e=>{V.message(e,{symbol:N.default.green(dt)})},warn:e=>{V.message(e,{symbol:N.default.yellow(vt)})},warning:e=>{V.warn(e)},error:e=>{V.message(e,{symbol:N.default.red(yt)})}},Et=`${N.default.gray(B)} `,Dt={message:async(e,{symbol:t=N.default.gray(B)}={})=>{process.stdout.write(`${N.default.gray(B)}
37
37
  ${t} `);let n=3;for await(let t of e){t=t.replace(/\n/g,`
38
- ${wt}`),t.includes(`
38
+ ${Et}`),t.includes(`
39
39
  `)&&(n=3+f(t.slice(t.lastIndexOf(`
40
40
  `))).length);let e=f(t).length;n+e<process.stdout.columns?(n+=e,process.stdout.write(t)):(process.stdout.write(`
41
- ${wt}${t.trimStart()}`),n=3+f(t.trimStart()).length)}process.stdout.write(`
42
- `)},info:e=>Tt.message(e,{symbol:F.default.blue(mt)}),success:e=>Tt.message(e,{symbol:F.default.green(ht)}),step:e=>Tt.message(e,{symbol:F.default.green(lt)}),warn:e=>Tt.message(e,{symbol:F.default.yellow(gt)}),warning:e=>Tt.warn(e),error:e=>Tt.message(e,{symbol:F.default.red(_t)})},Et=({indicator:e=`dots`}={})=>{let t=at?[`◒`,`◐`,`◓`,`◑`]:[`•`,`o`,`O`,`0`],n=at?80:120,r=process.env.CI===`true`,i,a,o=!1,s=``,c,l=performance.now(),u=e=>{o&&y(e>1?`Something went wrong`:`Canceled`,e)},d=()=>u(2),f=()=>u(1),p=()=>{process.on(`uncaughtExceptionMonitor`,d),process.on(`unhandledRejection`,d),process.on(`SIGINT`,f),process.on(`SIGTERM`,f),process.on(`exit`,u)},m=()=>{process.removeListener(`uncaughtExceptionMonitor`,d),process.removeListener(`unhandledRejection`,d),process.removeListener(`SIGINT`,f),process.removeListener(`SIGTERM`,f),process.removeListener(`exit`,u)},h=()=>{if(c===void 0)return;r&&process.stdout.write(`
41
+ ${Et}${t.trimStart()}`),n=3+f(t.trimStart()).length)}process.stdout.write(`
42
+ `)},info:e=>Dt.message(e,{symbol:N.default.blue(gt)}),success:e=>Dt.message(e,{symbol:N.default.green(_t)}),step:e=>Dt.message(e,{symbol:N.default.green(dt)}),warn:e=>Dt.message(e,{symbol:N.default.yellow(vt)}),warning:e=>Dt.warn(e),error:e=>Dt.message(e,{symbol:N.default.red(yt)})},Ot=({indicator:e=`dots`}={})=>{let t=st?[`◒`,`◐`,`◓`,`◑`]:[`•`,`o`,`O`,`0`],n=st?80:120,r=process.env.CI===`true`,i,a,o=!1,s=``,c,l=performance.now(),u=e=>{o&&y(e>1?`Something went wrong`:`Canceled`,e)},d=()=>u(2),f=()=>u(1),p=()=>{process.on(`uncaughtExceptionMonitor`,d),process.on(`unhandledRejection`,d),process.on(`SIGINT`,f),process.on(`SIGTERM`,f),process.on(`exit`,u)},m=()=>{process.removeListener(`uncaughtExceptionMonitor`,d),process.removeListener(`unhandledRejection`,d),process.removeListener(`SIGINT`,f),process.removeListener(`SIGTERM`,f),process.removeListener(`exit`,u)},h=()=>{if(c===void 0)return;r&&process.stdout.write(`
43
43
  `);let e=c.split(`
44
- `);process.stdout.write(ye.cursor.move(-999,e.length-1)),process.stdout.write(ye.erase.down(e.length))},g=e=>e.replace(/\.+$/,``),_=e=>{let t=(performance.now()-e)/1e3,n=Math.floor(t/60),r=Math.floor(t%60);return n>0?`[${n}m ${r}s]`:`[${r}s]`},v=(u=``)=>{o=!0,i=Ye(),s=g(u),l=performance.now(),process.stdout.write(`${F.default.gray(V)}
45
- `);let d=0,f=0;p(),a=setInterval(()=>{if(r&&s===c)return;h(),c=s;let n=F.default.magenta(t[d]);if(r)process.stdout.write(`${n} ${s}...`);else if(e===`timer`)process.stdout.write(`${n} ${s} ${_(l)}`);else{let e=`.`.repeat(Math.floor(f)).slice(0,3);process.stdout.write(`${n} ${s}${e}`)}d=d+1<t.length?d+1:0,f=f<t.length?f+.125:0},n)},y=(t=``,n=0)=>{o=!1,clearInterval(a),h();let r=n===0?F.default.green(lt):n===1?F.default.red(ct):F.default.red(B);s=g(t??s),e===`timer`?process.stdout.write(`${r} ${s} ${_(l)}
44
+ `);process.stdout.write(xe.cursor.move(-999,e.length-1)),process.stdout.write(xe.erase.down(e.length))},g=e=>e.replace(/\.+$/,``),_=e=>{let t=(performance.now()-e)/1e3,n=Math.floor(t/60),r=Math.floor(t%60);return n>0?`[${n}m ${r}s]`:`[${r}s]`},v=(u=``)=>{o=!0,i=Qe(),s=g(u),l=performance.now(),process.stdout.write(`${N.default.gray(B)}
45
+ `);let d=0,f=0;p(),a=setInterval(()=>{if(r&&s===c)return;h(),c=s;let n=N.default.magenta(t[d]);if(r)process.stdout.write(`${n} ${s}...`);else if(e===`timer`)process.stdout.write(`${n} ${s} ${_(l)}`);else{let e=`.`.repeat(Math.floor(f)).slice(0,3);process.stdout.write(`${n} ${s}${e}`)}d=d+1<t.length?d+1:0,f=f<t.length?f+.125:0},n)},y=(t=``,n=0)=>{o=!1,clearInterval(a),h();let r=n===0?N.default.green(dt):n===1?N.default.red(z):N.default.red(ut);s=g(t??s),e===`timer`?process.stdout.write(`${r} ${s} ${_(l)}
46
46
  `):process.stdout.write(`${r} ${s}
47
- `),m(),i()};return{start:v,stop:y,message:(e=``)=>{s=g(e??s)}}};function Dt(e){return e==null?[]:Array.isArray(e)?e:[e]}function Ot(e,t,n,r){var i,a=e[t],o=~r.string.indexOf(t)?n==null||n===!0?``:String(n):typeof n==`boolean`?n:~r.boolean.indexOf(t)?n===`false`?!1:n===`true`||(e._.push((i=+n,i*0==0?i:n)),!!n):(i=+n,i*0==0?i:n);e[t]=a==null?o:Array.isArray(a)?a.concat(o):[a,o]}function kt(e,t){e||=[],t||={};var n,r,i,a,o,s={_:[]},c=0,l=0,u=0,d=e.length;let f=t.alias!==void 0,p=t.unknown!==void 0,m=t.default!==void 0;if(t.alias=t.alias||{},t.string=Dt(t.string),t.boolean=Dt(t.boolean),f)for(n in t.alias)for(r=t.alias[n]=Dt(t.alias[n]),c=0;c<r.length;c++)(t.alias[r[c]]=r.concat(n)).splice(c,1);for(c=t.boolean.length;c-- >0;)for(r=t.alias[t.boolean[c]]||[],l=r.length;l-- >0;)t.boolean.push(r[l]);for(c=t.string.length;c-- >0;)for(r=t.alias[t.string[c]]||[],l=r.length;l-- >0;)t.string.push(r[l]);if(m){for(n in t.default)if(a=typeof t.default[n],r=t.alias[n]=t.alias[n]||[],t[a]!==void 0)for(t[a].push(n),c=0;c<r.length;c++)t[a].push(r[c])}let h=p?Object.keys(t.alias):[];for(c=0;c<d;c++){if(i=e[c],i===`--`){s._=s._.concat(e.slice(++c));break}for(l=0;l<i.length&&i.charCodeAt(l)===45;l++);if(l===0)s._.push(i);else if(i.substring(l,l+3)===`no-`){if(a=i.substring(l+3),p&&!~h.indexOf(a))return t.unknown(i);s[a]=!1}else{for(u=l+1;u<i.length&&i.charCodeAt(u)!==61;u++);for(a=i.substring(l,u),o=i.substring(++u)||c+1===d||(``+e[c+1]).charCodeAt(0)===45||e[++c],r=l===2?[a]:a,u=0;u<r.length;u++){if(a=r[u],p&&!~h.indexOf(a))return t.unknown(`-`.repeat(l)+a);Ot(s,a,u+1<r.length||o,t)}}}if(m)for(n in t.default)s[n]===void 0&&(s[n]=t.default[n]);if(f)for(n in s)for(r=t.alias[n]||[];r.length>0;)s[r.shift()]=s[n];return s}const At=e=>e.replace(/[<[].+/,``).trim(),jt=e=>{let t=/<([^>]+)>/g,n=/\[([^\]]+)\]/g,r=[],i=e=>{let t=!1,n=e[1];return n.startsWith(`...`)&&(n=n.slice(3),t=!0),{required:e[0].startsWith(`<`),value:n,variadic:t}},a;for(;a=t.exec(e);)r.push(i(a));let o;for(;o=n.exec(e);)r.push(i(o));return r},U=e=>{let t={alias:{},boolean:[]};for(let[n,r]of e.entries())r.names.length>1&&(t.alias[r.names[0]]=r.names.slice(1)),r.isBoolean&&(r.negated&&e.some((e,t)=>t!==n&&e.names.some(e=>r.names.includes(e))&&typeof e.required==`boolean`)||t.boolean.push(r.names[0]));return t},Mt=e=>e.sort((e,t)=>e.length>t.length?-1:1)[0],Nt=(e,t)=>e.length>=t?e:`${e}${` `.repeat(t-e.length)}`,Pt=e=>e.replace(/([a-z])-([a-z])/g,(e,t,n)=>t+n.toUpperCase()),Ft=(e,t,n)=>{let r=0,i=t.length,a=e,o;for(;r<i;++r)o=a[t[r]],a=a[t[r]]=r===i-1?n:o??(~t[r+1].indexOf(`.`)||!(+t[r+1]>-1)?{}:[])},It=(e,t)=>{for(let n of Object.keys(t)){let r=t[n];r.shouldTransform&&(e[n]=Array.prototype.concat.call([],e[n]),typeof r.transformFunction==`function`&&(e[n]=e[n].map(r.transformFunction)))}},Lt=e=>{let t=/([^\\\/]+)$/.exec(e);return t?t[1]:``},Rt=e=>e.split(`.`).map((e,t)=>t===0?Pt(e):e).join(`.`);var zt=class extends Error{constructor(e){super(e),this.name=this.constructor.name,typeof Error.captureStackTrace==`function`?Error.captureStackTrace(this,this.constructor):this.stack=Error(e).stack}},Bt=class{constructor(e,t,n){this.rawName=e,this.description=t,this.config=Object.assign({},n),e=e.replace(/\.\*/g,``),this.negated=!1,this.names=At(e).split(`,`).map(e=>{let t=e.trim().replace(/^-{1,2}/,``);return t.startsWith(`no-`)&&(this.negated=!0,t=t.replace(/^no-/,``)),Rt(t)}).sort((e,t)=>e.length>t.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null&&(this.config.default=!0),e.includes(`<`)?this.required=!0:e.includes(`[`)?this.required=!1:this.isBoolean=!0}};const Vt=process.argv,Ht=`${process.platform}-${process.arch} node-${process.version}`;var Ut=class{constructor(e,t,n={},r){this.rawName=e,this.description=t,this.config=n,this.cli=r,this.options=[],this.aliasNames=[],this.name=At(e),this.args=jt(e),this.examples=[]}usage(e){return this.usageText=e,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(e,t=`-v, --version`){return this.versionNumber=e,this.option(t,`Display version number`),this}example(e){return this.examples.push(e),this}option(e,t,n){let r=new Bt(e,t,n);return this.options.push(r),this}alias(e){return this.aliasNames.push(e),this}action(e){return this.commandAction=e,this}isMatched(e){return this.name===e||this.aliasNames.includes(e)}get isDefaultCommand(){return this.name===``||this.aliasNames.includes(`!`)}get isGlobalCommand(){return this instanceof Wt}hasOption(e){return e=e.split(`.`)[0],this.options.find(t=>t.names.includes(e))}outputHelp(){let{name:e,commands:t}=this.cli,{versionNumber:n,options:r,helpCallback:i}=this.cli.globalCommand,a=[{body:`${e}${n?`/${n}`:``}`}];if(a.push({title:`Usage`,body:` $ ${e} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&t.length>0){let n=Mt(t.map(e=>e.rawName));a.push({title:`Commands`,body:t.map(e=>` ${Nt(e.rawName,n.length)} ${e.description}`).join(`
47
+ `),m(),i()};return{start:v,stop:y,message:(e=``)=>{s=g(e??s)}}};function kt(e){return e==null?[]:Array.isArray(e)?e:[e]}function At(e,t,n,r){var i,a=e[t],o=~r.string.indexOf(t)?n==null||n===!0?``:String(n):typeof n==`boolean`?n:~r.boolean.indexOf(t)?n===`false`?!1:n===`true`||(e._.push((i=+n,i*0==0?i:n)),!!n):(i=+n,i*0==0?i:n);e[t]=a==null?o:Array.isArray(a)?a.concat(o):[a,o]}function jt(e,t){e||=[],t||={};var n,r,i,a,o,s={_:[]},c=0,l=0,u=0,d=e.length;let f=t.alias!==void 0,p=t.unknown!==void 0,m=t.default!==void 0;if(t.alias=t.alias||{},t.string=kt(t.string),t.boolean=kt(t.boolean),f)for(n in t.alias)for(r=t.alias[n]=kt(t.alias[n]),c=0;c<r.length;c++)(t.alias[r[c]]=r.concat(n)).splice(c,1);for(c=t.boolean.length;c-- >0;)for(r=t.alias[t.boolean[c]]||[],l=r.length;l-- >0;)t.boolean.push(r[l]);for(c=t.string.length;c-- >0;)for(r=t.alias[t.string[c]]||[],l=r.length;l-- >0;)t.string.push(r[l]);if(m){for(n in t.default)if(a=typeof t.default[n],r=t.alias[n]=t.alias[n]||[],t[a]!==void 0)for(t[a].push(n),c=0;c<r.length;c++)t[a].push(r[c])}let h=p?Object.keys(t.alias):[];for(c=0;c<d;c++){if(i=e[c],i===`--`){s._=s._.concat(e.slice(++c));break}for(l=0;l<i.length&&i.charCodeAt(l)===45;l++);if(l===0)s._.push(i);else if(i.substring(l,l+3)===`no-`){if(a=i.substring(l+3),p&&!~h.indexOf(a))return t.unknown(i);s[a]=!1}else{for(u=l+1;u<i.length&&i.charCodeAt(u)!==61;u++);for(a=i.substring(l,u),o=i.substring(++u)||c+1===d||(``+e[c+1]).charCodeAt(0)===45||e[++c],r=l===2?[a]:a,u=0;u<r.length;u++){if(a=r[u],p&&!~h.indexOf(a))return t.unknown(`-`.repeat(l)+a);At(s,a,u+1<r.length||o,t)}}}if(m)for(n in t.default)s[n]===void 0&&(s[n]=t.default[n]);if(f)for(n in s)for(r=t.alias[n]||[];r.length>0;)s[r.shift()]=s[n];return s}const Mt=e=>e.replace(/[<[].+/,``).trim(),H=e=>{let t=/<([^>]+)>/g,n=/\[([^\]]+)\]/g,r=[],i=e=>{let t=!1,n=e[1];return n.startsWith(`...`)&&(n=n.slice(3),t=!0),{required:e[0].startsWith(`<`),value:n,variadic:t}},a;for(;a=t.exec(e);)r.push(i(a));let o;for(;o=n.exec(e);)r.push(i(o));return r},Nt=e=>{let t={alias:{},boolean:[]};for(let[n,r]of e.entries())r.names.length>1&&(t.alias[r.names[0]]=r.names.slice(1)),r.isBoolean&&(r.negated&&e.some((e,t)=>t!==n&&e.names.some(e=>r.names.includes(e))&&typeof e.required==`boolean`)||t.boolean.push(r.names[0]));return t},Pt=e=>e.sort((e,t)=>e.length>t.length?-1:1)[0],Ft=(e,t)=>e.length>=t?e:`${e}${` `.repeat(t-e.length)}`,It=e=>e.replace(/([a-z])-([a-z])/g,(e,t,n)=>t+n.toUpperCase()),Lt=(e,t,n)=>{let r=0,i=t.length,a=e,o;for(;r<i;++r)o=a[t[r]],a=a[t[r]]=r===i-1?n:o??(~t[r+1].indexOf(`.`)||!(+t[r+1]>-1)?{}:[])},Rt=(e,t)=>{for(let n of Object.keys(t)){let r=t[n];r.shouldTransform&&(e[n]=Array.prototype.concat.call([],e[n]),typeof r.transformFunction==`function`&&(e[n]=e[n].map(r.transformFunction)))}},zt=e=>{let t=/([^\\\/]+)$/.exec(e);return t?t[1]:``},Bt=e=>e.split(`.`).map((e,t)=>t===0?It(e):e).join(`.`);var Vt=class extends Error{constructor(e){super(e),this.name=this.constructor.name,typeof Error.captureStackTrace==`function`?Error.captureStackTrace(this,this.constructor):this.stack=Error(e).stack}},Ht=class{constructor(e,t,n){this.rawName=e,this.description=t,this.config=Object.assign({},n),e=e.replace(/\.\*/g,``),this.negated=!1,this.names=Mt(e).split(`,`).map(e=>{let t=e.trim().replace(/^-{1,2}/,``);return t.startsWith(`no-`)&&(this.negated=!0,t=t.replace(/^no-/,``)),Bt(t)}).sort((e,t)=>e.length>t.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null&&(this.config.default=!0),e.includes(`<`)?this.required=!0:e.includes(`[`)?this.required=!1:this.isBoolean=!0}};const Ut=process.argv,Wt=`${process.platform}-${process.arch} node-${process.version}`;var Gt=class{constructor(e,t,n={},r){this.rawName=e,this.description=t,this.config=n,this.cli=r,this.options=[],this.aliasNames=[],this.name=Mt(e),this.args=H(e),this.examples=[]}usage(e){return this.usageText=e,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(e,t=`-v, --version`){return this.versionNumber=e,this.option(t,`Display version number`),this}example(e){return this.examples.push(e),this}option(e,t,n){let r=new Ht(e,t,n);return this.options.push(r),this}alias(e){return this.aliasNames.push(e),this}action(e){return this.commandAction=e,this}isMatched(e){return this.name===e||this.aliasNames.includes(e)}get isDefaultCommand(){return this.name===``||this.aliasNames.includes(`!`)}get isGlobalCommand(){return this instanceof Kt}hasOption(e){return e=e.split(`.`)[0],this.options.find(t=>t.names.includes(e))}outputHelp(){let{name:e,commands:t}=this.cli,{versionNumber:n,options:r,helpCallback:i}=this.cli.globalCommand,a=[{body:`${e}${n?`/${n}`:``}`}];if(a.push({title:`Usage`,body:` $ ${e} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&t.length>0){let n=Pt(t.map(e=>e.rawName));a.push({title:`Commands`,body:t.map(e=>` ${Ft(e.rawName,n.length)} ${e.description}`).join(`
48
48
  `)}),a.push({title:"For more info, run any command with the `--help` flag",body:t.map(t=>` $ ${e}${t.name===``?``:` ${t.name}`} --help`).join(`
49
- `)})}let o=this.isGlobalCommand?r:[...this.options,...r||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand&&(o=o.filter(e=>e.name!==`version`)),o.length>0){let e=Mt(o.map(e=>e.rawName));a.push({title:`Options`,body:o.map(t=>` ${Nt(t.rawName,e.length)} ${t.description} ${t.config.default===void 0?``:`(default: ${t.config.default})`}`).join(`
49
+ `)})}let o=this.isGlobalCommand?r:[...this.options,...r||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand&&(o=o.filter(e=>e.name!==`version`)),o.length>0){let e=Pt(o.map(e=>e.rawName));a.push({title:`Options`,body:o.map(t=>` ${Ft(t.rawName,e.length)} ${t.description} ${t.config.default===void 0?``:`(default: ${t.config.default})`}`).join(`
50
50
  `)})}this.examples.length>0&&a.push({title:`Examples`,body:this.examples.map(t=>typeof t==`function`?t(e):t).join(`
51
51
  `)}),i&&(a=i(a)||a),console.log(a.map(e=>e.title?`${e.title}:
52
52
  ${e.body}`:e.body).join(`
53
53
 
54
- `))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;t&&console.log(`${e}/${t} ${Ht}`)}checkRequiredArgs(){let e=this.args.filter(e=>e.required).length;if(this.cli.args.length<e)throw new zt(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let n of Object.keys(e))if(n!==`--`&&!this.hasOption(n)&&!t.hasOption(n))throw new zt(`Unknown option \`${n.length>1?`--${n}`:`-${n}`}\``)}}checkOptionValue(){let{options:e,globalCommand:t}=this.cli,n=[...t.options,...this.options];for(let t of n){let r=e[t.name.split(`.`)[0]];if(t.required){let e=n.some(e=>e.negated&&e.names.includes(t.name));if(r===!0||r===!1&&!e)throw new zt(`option \`${t.rawName}\` value is missing`)}}}},Wt=class extends Ut{constructor(e){super(`@@global@@`,``,{},e)}},Gt=Object.assign,Kt=class extends g{constructor(e=``){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new Wt(this),this.globalCommand.usage(`<command> [options]`)}usage(e){return this.globalCommand.usage(e),this}command(e,t,n){let r=new Ut(e,t||``,n,this);return r.globalCommand=this.globalCommand,this.commands.push(r),r}option(e,t,n){return this.globalCommand.option(e,t,n),this}help(e){return this.globalCommand.option(`-h, --help`,`Display this message`),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t=`-v, --version`){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},n,r){return this.args=e,this.options=t,n&&(this.matchedCommand=n),r&&(this.matchedCommandName=r),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(e=Vt,{run:t=!0}={}){this.rawArgs=e,this.name||=e[1]?Lt(e[1]):`cli`;let n=!0;for(let t of this.commands){let r=this.mri(e.slice(2),t),i=r.args[0];if(t.isMatched(i)){n=!1;let e=Gt(Gt({},r),{args:r.args.slice(1)});this.setParsedInfo(e,t,i),this.emit(`command:${i}`,t)}}if(n){for(let t of this.commands)if(t.name===``){n=!1;let r=this.mri(e.slice(2),t);this.setParsedInfo(r,t),this.emit(`command:!`,t)}}if(n){let t=this.mri(e.slice(2));this.setParsedInfo(t)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),t=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),t=!1,this.unsetMatchedCommand());let r={args:this.args,options:this.options};return t&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.emit(`command:*`),r}mri(e,t){let n=[...this.globalCommand.options,...t?t.options:[]],r=U(n),i=[],a=e.indexOf(`--`);a>-1&&(i=e.slice(a+1),e=e.slice(0,a));let o=kt(e,r);o=Object.keys(o).reduce((e,t)=>Gt(Gt({},e),{[Rt(t)]:o[t]}),{_:[]});let s=o._,c={"--":i},l=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,u=Object.create(null);for(let e of n){if(!l&&e.config.default!==void 0)for(let t of e.names)c[t]=e.config.default;Array.isArray(e.config.type)&&u[e.name]===void 0&&(u[e.name]=Object.create(null),u[e.name].shouldTransform=!0,u[e.name].transformFunction=e.config.type[0])}for(let e of Object.keys(o))e!==`_`&&(Ft(c,e.split(`.`),o[e]),It(c,u));return{args:s,options:c}}runMatchedCommand(){let{args:e,options:t,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs();let r=[];return n.args.forEach((t,n)=>{t.variadic?r.push(e.slice(n)):r.push(e[n])}),r.push(t),n.commandAction.apply(this,r)}};const qt=(e=``)=>new Kt(e);var Jt=`0.6.0`;const Yt=/^[A-Za-z]:\//;function Xt(e=``){return e&&e.replace(/\\/g,`/`).replace(Yt,e=>e.toUpperCase())}const Zt=/^[/\\]{2}/,Qt=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,$t=/^[A-Za-z]:$/,en=/.(\.[^./]+|\.)$/,tn=function(e){if(e.length===0)return`.`;e=Xt(e);let t=e.match(Zt),n=sn(e),r=e[e.length-1]===`/`;return e=on(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),$t.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!sn(e)?`/${e}`:e)},nn=function(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;e&&r?t+=n.slice(1):t+=e||r?n:`/${n}`}else t+=n;return tn(t)};function rn(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const an=function(...e){e=e.map(e=>Xt(e));let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:rn();!i||i.length===0||(t=`${i}/${t}`,n=sn(i))}return t=on(t,!n),n&&!sn(t)?`/${t}`:t.length>0?t:`.`};function on(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}const sn=function(e){return Qt.test(e)},cn=function(e){if(e===`..`)return``;let t=en.exec(Xt(e));return t&&t[1]||``},ln=function(e){let t=Xt(e).replace(/\/$/,``).split(`/`).slice(0,-1);return t.length===1&&$t.test(t[0])&&(t[0]+=`/`),t.join(`/`)||(sn(e)?`/`:`.`)},un=function(e,t){let n=Xt(e).split(`/`),r=``;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t){r=t;break}}return t&&r.endsWith(t)?r.slice(0,-t.length):r};var dn=M(((e,t)=>{t.exports={name:`dotenv`,version:`17.2.3`,description:`Loads environment variables from .env file`,main:`lib/main.js`,types:`lib/main.d.ts`,exports:{".":{types:`./lib/main.d.ts`,require:`./lib/main.js`,default:`./lib/main.js`},"./config":`./config.js`,"./config.js":`./config.js`,"./lib/env-options":`./lib/env-options.js`,"./lib/env-options.js":`./lib/env-options.js`,"./lib/cli-options":`./lib/cli-options.js`,"./lib/cli-options.js":`./lib/cli-options.js`,"./package.json":`./package.json`},scripts:{"dts-check":`tsc --project tests/types/tsconfig.json`,lint:`standard`,pretest:`npm run lint && npm run dts-check`,test:`tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000`,"test:coverage":`tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov`,prerelease:`npm test`,release:`standard-version`},repository:{type:`git`,url:`git://github.com/motdotla/dotenv.git`},homepage:`https://github.com/motdotla/dotenv#readme`,funding:`https://dotenvx.com`,keywords:[`dotenv`,`env`,`.env`,`environment`,`variables`,`config`,`settings`],readmeFilename:`README.md`,license:`BSD-2-Clause`,devDependencies:{"@types/node":`^18.11.3`,decache:`^4.6.2`,sinon:`^14.0.1`,standard:`^17.0.0`,"standard-version":`^9.5.0`,tap:`^19.2.0`,typescript:`^4.8.4`},engines:{node:`>=12`},browser:{fs:!1}}})),fn=ge(M(((e,t)=>{let n=N(`fs`),r=N(`path`),i=N(`os`),a=N(`crypto`),o=dn().version,s=[`🔐 encrypt with Dotenvx: https://dotenvx.com`,`🔐 prevent committing .env to code: https://dotenvx.com/precommit`,`🔐 prevent building .env in docker: https://dotenvx.com/prebuild`,`📡 add observability to secrets: https://dotenvx.com/ops`,`👥 sync secrets across teammates & machines: https://dotenvx.com/ops`,`🗂️ backup and recover secrets: https://dotenvx.com/ops`,`✅ audit secrets and track compliance: https://dotenvx.com/ops`,`🔄 add secrets lifecycle management: https://dotenvx.com/ops`,`🔑 add access controls to secrets: https://dotenvx.com/ops`,"🛠️ run anywhere with `dotenvx run -- yourcommand`",`⚙️ specify custom .env file path with { path: '/custom/path/.env' }`,`⚙️ enable debug logging with { debug: true }`,`⚙️ override existing env vars with { override: true }`,`⚙️ suppress all logs with { quiet: true }`,`⚙️ write to custom object with { processEnv: myObject }`,`⚙️ load multiple .env files with { path: ['.env.local', '.env'] }`];function c(){return s[Math.floor(Math.random()*s.length)]}function l(e){return typeof e==`string`?![`false`,`0`,`no`,`off`,``].includes(e.toLowerCase()):!!e}function u(){return process.stdout.isTTY}function d(e){return u()?`\x1b[2m${e}\x1b[0m`:e}let f=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function p(e){let t={},n=e.toString();n=n.replace(/\r\n?/gm,`
54
+ `))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;t&&console.log(`${e}/${t} ${Wt}`)}checkRequiredArgs(){let e=this.args.filter(e=>e.required).length;if(this.cli.args.length<e)throw new Vt(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let n of Object.keys(e))if(n!==`--`&&!this.hasOption(n)&&!t.hasOption(n))throw new Vt(`Unknown option \`${n.length>1?`--${n}`:`-${n}`}\``)}}checkOptionValue(){let{options:e,globalCommand:t}=this.cli,n=[...t.options,...this.options];for(let t of n){let r=e[t.name.split(`.`)[0]];if(t.required){let e=n.some(e=>e.negated&&e.names.includes(t.name));if(r===!0||r===!1&&!e)throw new Vt(`option \`${t.rawName}\` value is missing`)}}}},Kt=class extends Gt{constructor(e){super(`@@global@@`,``,{},e)}},qt=Object.assign,Jt=class extends g{constructor(e=``){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new Kt(this),this.globalCommand.usage(`<command> [options]`)}usage(e){return this.globalCommand.usage(e),this}command(e,t,n){let r=new Gt(e,t||``,n,this);return r.globalCommand=this.globalCommand,this.commands.push(r),r}option(e,t,n){return this.globalCommand.option(e,t,n),this}help(e){return this.globalCommand.option(`-h, --help`,`Display this message`),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t=`-v, --version`){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},n,r){return this.args=e,this.options=t,n&&(this.matchedCommand=n),r&&(this.matchedCommandName=r),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(e=Ut,{run:t=!0}={}){this.rawArgs=e,this.name||=e[1]?zt(e[1]):`cli`;let n=!0;for(let t of this.commands){let r=this.mri(e.slice(2),t),i=r.args[0];if(t.isMatched(i)){n=!1;let e=qt(qt({},r),{args:r.args.slice(1)});this.setParsedInfo(e,t,i),this.emit(`command:${i}`,t)}}if(n){for(let t of this.commands)if(t.name===``){n=!1;let r=this.mri(e.slice(2),t);this.setParsedInfo(r,t),this.emit(`command:!`,t)}}if(n){let t=this.mri(e.slice(2));this.setParsedInfo(t)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),t=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),t=!1,this.unsetMatchedCommand());let r={args:this.args,options:this.options};return t&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.emit(`command:*`),r}mri(e,t){let n=[...this.globalCommand.options,...t?t.options:[]],r=Nt(n),i=[],a=e.indexOf(`--`);a>-1&&(i=e.slice(a+1),e=e.slice(0,a));let o=jt(e,r);o=Object.keys(o).reduce((e,t)=>qt(qt({},e),{[Bt(t)]:o[t]}),{_:[]});let s=o._,c={"--":i},l=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,u=Object.create(null);for(let e of n){if(!l&&e.config.default!==void 0)for(let t of e.names)c[t]=e.config.default;Array.isArray(e.config.type)&&u[e.name]===void 0&&(u[e.name]=Object.create(null),u[e.name].shouldTransform=!0,u[e.name].transformFunction=e.config.type[0])}for(let e of Object.keys(o))e!==`_`&&(Lt(c,e.split(`.`),o[e]),Rt(c,u));return{args:s,options:c}}runMatchedCommand(){let{args:e,options:t,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs();let r=[];return n.args.forEach((t,n)=>{t.variadic?r.push(e.slice(n)):r.push(e[n])}),r.push(t),n.commandAction.apply(this,r)}};const Yt=(e=``)=>new Jt(e);var Xt=`0.8.0`;const Zt=/^[A-Za-z]:\//;function Qt(e=``){return e&&e.replace(/\\/g,`/`).replace(Zt,e=>e.toUpperCase())}const $t=/^[/\\]{2}/,en=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,tn=/^[A-Za-z]:$/,nn=/.(\.[^./]+|\.)$/,rn=function(e){if(e.length===0)return`.`;e=Qt(e);let t=e.match($t),n=ln(e),r=e[e.length-1]===`/`;return e=cn(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),tn.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!ln(e)?`/${e}`:e)},an=function(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;e&&r?t+=n.slice(1):t+=e||r?n:`/${n}`}else t+=n;return rn(t)};function on(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const sn=function(...e){e=e.map(e=>Qt(e));let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:on();!i||i.length===0||(t=`${i}/${t}`,n=ln(i))}return t=cn(t,!n),n&&!ln(t)?`/${t}`:t.length>0?t:`.`};function cn(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}const ln=function(e){return en.test(e)},un=function(e){if(e===`..`)return``;let t=nn.exec(Qt(e));return t&&t[1]||``},dn=function(e){let t=Qt(e).replace(/\/$/,``).split(`/`).slice(0,-1);return t.length===1&&tn.test(t[0])&&(t[0]+=`/`),t.join(`/`)||(ln(e)?`/`:`.`)},fn=function(e,t){let n=Qt(e).split(`/`),r=``;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t){r=t;break}}return t&&r.endsWith(t)?r.slice(0,-t.length):r};var pn=A(((e,t)=>{t.exports={name:`dotenv`,version:`17.2.3`,description:`Loads environment variables from .env file`,main:`lib/main.js`,types:`lib/main.d.ts`,exports:{".":{types:`./lib/main.d.ts`,require:`./lib/main.js`,default:`./lib/main.js`},"./config":`./config.js`,"./config.js":`./config.js`,"./lib/env-options":`./lib/env-options.js`,"./lib/env-options.js":`./lib/env-options.js`,"./lib/cli-options":`./lib/cli-options.js`,"./lib/cli-options.js":`./lib/cli-options.js`,"./package.json":`./package.json`},scripts:{"dts-check":`tsc --project tests/types/tsconfig.json`,lint:`standard`,pretest:`npm run lint && npm run dts-check`,test:`tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000`,"test:coverage":`tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov`,prerelease:`npm test`,release:`standard-version`},repository:{type:`git`,url:`git://github.com/motdotla/dotenv.git`},homepage:`https://github.com/motdotla/dotenv#readme`,funding:`https://dotenvx.com`,keywords:[`dotenv`,`env`,`.env`,`environment`,`variables`,`config`,`settings`],readmeFilename:`README.md`,license:`BSD-2-Clause`,devDependencies:{"@types/node":`^18.11.3`,decache:`^4.6.2`,sinon:`^14.0.1`,standard:`^17.0.0`,"standard-version":`^9.5.0`,tap:`^19.2.0`,typescript:`^4.8.4`},engines:{node:`>=12`},browser:{fs:!1}}})),mn=ve(A(((e,t)=>{let n=j(`fs`),r=j(`path`),i=j(`os`),a=j(`crypto`),o=pn().version,s=[`🔐 encrypt with Dotenvx: https://dotenvx.com`,`🔐 prevent committing .env to code: https://dotenvx.com/precommit`,`🔐 prevent building .env in docker: https://dotenvx.com/prebuild`,`📡 add observability to secrets: https://dotenvx.com/ops`,`👥 sync secrets across teammates & machines: https://dotenvx.com/ops`,`🗂️ backup and recover secrets: https://dotenvx.com/ops`,`✅ audit secrets and track compliance: https://dotenvx.com/ops`,`🔄 add secrets lifecycle management: https://dotenvx.com/ops`,`🔑 add access controls to secrets: https://dotenvx.com/ops`,"🛠️ run anywhere with `dotenvx run -- yourcommand`",`⚙️ specify custom .env file path with { path: '/custom/path/.env' }`,`⚙️ enable debug logging with { debug: true }`,`⚙️ override existing env vars with { override: true }`,`⚙️ suppress all logs with { quiet: true }`,`⚙️ write to custom object with { processEnv: myObject }`,`⚙️ load multiple .env files with { path: ['.env.local', '.env'] }`];function c(){return s[Math.floor(Math.random()*s.length)]}function l(e){return typeof e==`string`?![`false`,`0`,`no`,`off`,``].includes(e.toLowerCase()):!!e}function u(){return process.stdout.isTTY}function d(e){return u()?`\x1b[2m${e}\x1b[0m`:e}let f=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function p(e){let t={},n=e.toString();n=n.replace(/\r\n?/gm,`
55
55
  `);let r;for(;(r=f.exec(n))!=null;){let e=r[1],n=r[2]||``;n=n.trim();let i=n[0];n=n.replace(/^(['"`])([\s\S]*)\1$/gm,`$2`),i===`"`&&(n=n.replace(/\\n/g,`
56
- `),n=n.replace(/\\r/g,`\r`)),t[e]=n}return t}function m(e){e||={};let t=b(e);e.path=t;let n=T.configDotenv(e);if(!n.parsed){let e=Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw e.code=`MISSING_DATA`,e}let r=v(e).split(`,`),i=r.length,a;for(let e=0;e<i;e++)try{let t=y(n,r[e].trim());a=T.decrypt(t.ciphertext,t.key);break}catch(t){if(e+1>=i)throw t}return T.parse(a)}function h(e){console.error(`[dotenv@${o}][WARN] ${e}`)}function g(e){console.log(`[dotenv@${o}][DEBUG] ${e}`)}function _(e){console.log(`[dotenv@${o}] ${e}`)}function v(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:``}function y(e,t){let n;try{n=new URL(t)}catch(e){if(e.code===`ERR_INVALID_URL`){let e=Error(`INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development`);throw e.code=`INVALID_DOTENV_KEY`,e}throw e}let r=n.password;if(!r){let e=Error(`INVALID_DOTENV_KEY: Missing key part`);throw e.code=`INVALID_DOTENV_KEY`,e}let i=n.searchParams.get(`environment`);if(!i){let e=Error(`INVALID_DOTENV_KEY: Missing environment part`);throw e.code=`INVALID_DOTENV_KEY`,e}let a=`DOTENV_VAULT_${i.toUpperCase()}`,o=e.parsed[a];if(!o){let e=Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${a} in your .env.vault file.`);throw e.code=`NOT_FOUND_DOTENV_ENVIRONMENT`,e}return{ciphertext:o,key:r}}function b(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)n.existsSync(r)&&(t=r.endsWith(`.vault`)?r:`${r}.vault`);else t=e.path.endsWith(`.vault`)?e.path:`${e.path}.vault`;else t=r.resolve(process.cwd(),`.env.vault`);return n.existsSync(t)?t:null}function x(e){return e[0]===`~`?r.join(i.homedir(),e.slice(1)):e}function S(e){let t=l(process.env.DOTENV_CONFIG_DEBUG||e&&e.debug),n=l(process.env.DOTENV_CONFIG_QUIET||e&&e.quiet);(t||!n)&&_(`Loading env from encrypted .env.vault`);let r=T._parseVault(e),i=process.env;return e&&e.processEnv!=null&&(i=e.processEnv),T.populate(i,r,e),{parsed:r}}function C(e){let t=r.resolve(process.cwd(),`.env`),i=`utf8`,a=process.env;e&&e.processEnv!=null&&(a=e.processEnv);let o=l(a.DOTENV_CONFIG_DEBUG||e&&e.debug),s=l(a.DOTENV_CONFIG_QUIET||e&&e.quiet);e&&e.encoding?i=e.encoding:o&&g(`No encoding is specified. UTF-8 is used by default`);let u=[t];if(e&&e.path)if(!Array.isArray(e.path))u=[x(e.path)];else{u=[];for(let t of e.path)u.push(x(t))}let f,p={};for(let t of u)try{let r=T.parse(n.readFileSync(t,{encoding:i}));T.populate(p,r,e)}catch(e){o&&g(`Failed to load ${t} ${e.message}`),f=e}let m=T.populate(a,p,e);if(o=l(a.DOTENV_CONFIG_DEBUG||o),s=l(a.DOTENV_CONFIG_QUIET||s),o||!s){let e=Object.keys(m).length,t=[];for(let e of u)try{let n=r.relative(process.cwd(),e);t.push(n)}catch(t){o&&g(`Failed to load ${e} ${t.message}`),f=t}_(`injecting env (${e}) from ${t.join(`,`)} ${d(`-- tip: ${c()}`)}`)}return f?{parsed:p,error:f}:{parsed:p}}function w(e){if(v(e).length===0)return T.configDotenv(e);let t=b(e);return t?T._configVault(e):(h(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`),T.configDotenv(e))}function ee(e,t){let n=Buffer.from(t.slice(-64),`hex`),r=Buffer.from(e,`base64`),i=r.subarray(0,12),o=r.subarray(-16);r=r.subarray(12,-16);try{let e=a.createDecipheriv(`aes-256-gcm`,n,i);return e.setAuthTag(o),`${e.update(r)}${e.final()}`}catch(e){let t=e instanceof RangeError,n=e.message===`Invalid key length`,r=e.message===`Unsupported state or unable to authenticate data`;if(t||n){let e=Error(`INVALID_DOTENV_KEY: It must be 64 characters long (or more)`);throw e.code=`INVALID_DOTENV_KEY`,e}else if(r){let e=Error(`DECRYPTION_FAILED: Please check your DOTENV_KEY`);throw e.code=`DECRYPTION_FAILED`,e}else throw e}}function te(e,t,n={}){let r=!!(n&&n.debug),i=!!(n&&n.override),a={};if(typeof t!=`object`){let e=Error(`OBJECT_REQUIRED: Please check the processEnv argument being passed to populate`);throw e.code=`OBJECT_REQUIRED`,e}for(let n of Object.keys(t))Object.prototype.hasOwnProperty.call(e,n)?(i===!0&&(e[n]=t[n],a[n]=t[n]),r&&g(i===!0?`"${n}" is already defined and WAS overwritten`:`"${n}" is already defined and was NOT overwritten`)):(e[n]=t[n],a[n]=t[n]);return a}let T={configDotenv:C,_configVault:S,_parseVault:m,config:w,decrypt:ee,parse:p,populate:te};t.exports.configDotenv=T.configDotenv,t.exports._configVault=T._configVault,t.exports._parseVault=T._parseVault,t.exports.config=T.config,t.exports.decrypt=T.decrypt,t.exports.parse=T.parse,t.exports.populate=T.populate,t.exports=T}))(),1);const pn=`_http_agent._http_client._http_common._http_incoming._http_outgoing._http_server._stream_duplex._stream_passthrough._stream_readable._stream_transform._stream_wrap._stream_writable._tls_common._tls_wrap.assert.assert/strict.async_hooks.buffer.child_process.cluster.console.constants.crypto.dgram.diagnostics_channel.dns.dns/promises.domain.events.fs.fs/promises.http.http2.https.inspector.inspector/promises.module.net.os.path.path/posix.path/win32.perf_hooks.process.punycode.querystring.readline.readline/promises.repl.stream.stream/consumers.stream/promises.stream/web.string_decoder.sys.timers.timers/promises.tls.trace_events.tty.url.util.util/types.v8.vm.wasi.worker_threads.zlib`.split(`.`),mn={}.hasOwnProperty,hn=/^([A-Z][a-z\d]*)+$/,gn=new Set([`string`,`function`,`number`,`object`,`Function`,`Object`,`boolean`,`bigint`,`symbol`]),_n=new Map;let vn;function yn(e,t=`and`){return e.length<3?e.join(` ${t} `):`${e.slice(0,-1).join(`, `)}, ${t} ${e.at(-1)}`}function bn(e,t,n){return _n.set(e,t),xn(n,e)}function xn(e,t){return function(...n){let r=Error.stackTraceLimit;Sn()&&(Error.stackTraceLimit=0);let i=new e;Sn()&&(Error.stackTraceLimit=r);let a=Tn(t,n,i);return Object.defineProperties(i,{message:{value:a,enumerable:!1,writable:!0,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},enumerable:!1,writable:!0,configurable:!0}}),wn(i),i.code=t,i}}function Sn(){try{if(le.startupSnapshot.isBuildingSnapshot())return!1}catch{}let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):mn.call(e,`writable`)&&e.writable!==void 0?e.writable:e.set!==void 0}function Cn(e){let t=`__node_internal_`+e.name;return Object.defineProperty(e,`name`,{value:t}),e}const wn=Cn(function(e){let t=Sn();return t&&(vn=Error.stackTraceLimit,Error.stackTraceLimit=1/0),Error.captureStackTrace(e),t&&(Error.stackTraceLimit=vn),e});function Tn(e,t,n){let r=_n.get(e);if(O.ok(r!==void 0,"expected `message` to be found"),typeof r==`function`)return O.ok(r.length<=t.length,`Code: ${e}; The provided arguments length (${t.length}) does not match the required ones (${r.length}).`),Reflect.apply(r,n,t);let i=/%[dfijoOs]/g,a=0;for(;i.exec(r)!==null;)a++;return O.ok(a===t.length,`Code: ${e}; The provided arguments length (${t.length}) does not match the required ones (${a}).`),t.length===0?r:(t.unshift(r),Reflect.apply(u,null,t))}function En(e){if(e==null)return String(e);if(typeof e==`function`&&e.name)return`function ${e.name}`;if(typeof e==`object`)return e.constructor&&e.constructor.name?`an instance of ${e.constructor.name}`:`${d(e,{depth:-1})}`;let t=d(e,{colors:!1});return t.length>28&&(t=`${t.slice(0,25)}...`),`type ${typeof e} (${t})`}bn(`ERR_INVALID_ARG_TYPE`,(e,t,n)=>{O.ok(typeof e==`string`,`'name' must be a string`),Array.isArray(t)||(t=[t]);let r=`The `;if(e.endsWith(` argument`))r+=`${e} `;else{let t=e.includes(`.`)?`property`:`argument`;r+=`"${e}" ${t} `}r+=`must be `;let i=[],a=[],o=[];for(let e of t)O.ok(typeof e==`string`,`All expected entries have to be of type string`),gn.has(e)?i.push(e.toLowerCase()):hn.exec(e)===null?(O.ok(e!==`object`,`The value "object" should be written as "Object"`),o.push(e)):a.push(e);if(a.length>0){let e=i.indexOf(`object`);e!==-1&&(i.slice(e,1),a.push(`Object`))}return i.length>0&&(r+=`${i.length>1?`one of type`:`of type`} ${yn(i,`or`)}`,(a.length>0||o.length>0)&&(r+=` or `)),a.length>0&&(r+=`an instance of ${yn(a,`or`)}`,o.length>0&&(r+=` or `)),o.length>0&&(o.length>1?r+=`one of ${yn(o,`or`)}`:(o[0]?.toLowerCase()!==o[0]&&(r+=`an `),r+=`${o[0]}`)),r+=`. Received ${En(n)}`,r},TypeError);const Dn=bn(`ERR_INVALID_MODULE_SPECIFIER`,(e,t,n)=>`Invalid module "${e}" ${t}${n?` imported from ${n}`:``}`,TypeError),On=bn(`ERR_INVALID_PACKAGE_CONFIG`,(e,t,n)=>`Invalid package config ${e}${t?` while importing ${t}`:``}${n?`. ${n}`:``}`,Error),kn=bn(`ERR_INVALID_PACKAGE_TARGET`,(e,t,n,r=!1,i)=>{let a=typeof n==`string`&&!r&&n.length>0&&!n.startsWith(`./`);return t===`.`?(O.ok(r===!1),`Invalid "exports" main target ${JSON.stringify(n)} defined in the package config ${e}package.json${i?` imported from ${i}`:``}${a?`; targets must start with "./"`:``}`):`Invalid "${r?`imports`:`exports`}" target ${JSON.stringify(n)} defined for '${t}' in the package config ${e}package.json${i?` imported from ${i}`:``}${a?`; targets must start with "./"`:``}`},Error),An=bn(`ERR_MODULE_NOT_FOUND`,(e,t,n=!1)=>`Cannot find ${n?`module`:`package`} '${e}' imported from ${t}`,Error);bn(`ERR_NETWORK_IMPORT_DISALLOWED`,`import of '%s' by %s is not supported: %s`,Error);const jn=bn(`ERR_PACKAGE_IMPORT_NOT_DEFINED`,(e,t,n)=>`Package import specifier "${e}" is not defined${t?` in package ${t||``}package.json`:``} imported from ${n}`,TypeError),Mn=bn(`ERR_PACKAGE_PATH_NOT_EXPORTED`,(e,t,n)=>t===`.`?`No "exports" main defined in ${e}package.json${n?` imported from ${n}`:``}`:`Package subpath '${t}' is not defined by "exports" in ${e}package.json${n?` imported from ${n}`:``}`,Error),Nn=bn(`ERR_UNSUPPORTED_DIR_IMPORT`,`Directory import '%s' is not supported resolving ES modules imported from %s`,Error),Pn=bn(`ERR_UNSUPPORTED_RESOLVE_REQUEST`,`Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.`,TypeError),Fn=bn(`ERR_UNKNOWN_FILE_EXTENSION`,(e,t)=>`Unknown file extension "${e}" for ${t}`,TypeError);bn(`ERR_INVALID_ARG_VALUE`,(e,t,n=`is invalid`)=>{let r=d(t);return r.length>128&&(r=`${r.slice(0,128)}...`),`The ${e.includes(`.`)?`property`:`argument`} '${e}' ${n}. Received ${r}`},TypeError);const In={}.hasOwnProperty,Ln=new Map;function Rn(e,{base:n,specifier:r}){let i=Ln.get(e);if(i)return i;let a;try{a=v.readFileSync(t.toNamespacedPath(e),`utf8`)}catch(e){let t=e;if(t.code!==`ENOENT`)throw t}let o={exists:!1,pjsonPath:e,main:void 0,name:void 0,type:`none`,exports:void 0,imports:void 0};if(a!==void 0){let t;try{t=JSON.parse(a)}catch(t){let i=new On(e,(n?`"${r}" from `:``)+D(n||r),t.message);throw i.cause=t,i}o.exists=!0,In.call(t,`name`)&&typeof t.name==`string`&&(o.name=t.name),In.call(t,`main`)&&typeof t.main==`string`&&(o.main=t.main),In.call(t,`exports`)&&(o.exports=t.exports),In.call(t,`imports`)&&(o.imports=t.imports),In.call(t,`type`)&&(t.type===`commonjs`||t.type===`module`)&&(o.type=t.type)}return Ln.set(e,o),o}function zn(e){let t=new URL(`package.json`,e);for(;!t.pathname.endsWith(`node_modules/package.json`);){let n=Rn(D(t),{specifier:e});if(n.exists)return n;let r=t;if(t=new URL(`../package.json`,t),t.pathname===r.pathname)break}return{pjsonPath:D(t),exists:!1,type:`none`}}const Bn={}.hasOwnProperty,Vn={__proto__:null,".json":`json`,".cjs":`commonjs`,".cts":`commonjs`,".js":`module`,".ts":`module`,".mts":`module`,".mjs":`module`},Hn={__proto__:null,"data:":Wn,"file:":Kn,"node:":()=>`builtin`};function Un(e){return e&&/\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(e)?`module`:e===`application/json`?`json`:null}function Wn(e){let{1:t}=/^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(e.pathname)||[null,null,null];return Un(t)}function Gn(e){let t=e.pathname,n=t.length;for(;n--;){let e=t.codePointAt(n);if(e===47)return``;if(e===46)return t.codePointAt(n-1)===47?``:t.slice(n)}return``}function Kn(e,t,n){let r=Gn(e);if(r===`.js`){let{type:t}=zn(e);return t===`none`?`commonjs`:t}if(r===``){let{type:t}=zn(e);return t===`none`||t===`commonjs`?`commonjs`:`module`}let i=Vn[r];if(i)return i;if(!n)throw new Fn(r,D(e))}function qn(e,t){let n=e.protocol;return Bn.call(Hn,n)&&Hn[n](e,t,!0)||null}const Jn=RegExp.prototype[Symbol.replace],Yn={}.hasOwnProperty,Xn=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i,Zn=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i,Qn=/^\.|%|\\/,$n=/\*/g,er=/%2f|%5c/i,tr=new Set,nr=/[/\\]{2}/;function rr(e,t,n,r,i,a,o){if(s.noDeprecation)return;let c=D(r),l=nr.exec(o?e:t)!==null;s.emitWarning(`Use of deprecated ${l?`double slash`:`leading or trailing slash matching`} resolving "${e}" for module request "${t}" ${t===n?``:`matched to "${n}" `}in the "${i?`imports`:`exports`}" field module resolution of the package at ${c}${a?` imported from ${D(a)}`:``}.`,`DeprecationWarning`,`DEP0166`)}function ir(e,n,r,i){if(s.noDeprecation||qn(e,{parentURL:r.href})!==`module`)return;let a=D(e.href),o=D(new E(`.`,n)),c=D(r);i?t.resolve(o,i)!==a&&s.emitWarning(`Package ${o} has a "main" field set to "${i}", excluding the full filename and extension to the resolved file at "${a.slice(o.length)}", imported from ${c}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`,`DeprecationWarning`,`DEP0151`):s.emitWarning(`No "main" or "exports" field defined in the package.json for ${o} resolving the main entry point "${a.slice(o.length)}", imported from ${c}.\nDefault "index" lookups for the main are deprecated for ES modules.`,`DeprecationWarning`,`DEP0151`)}function ar(e){try{return ne(e)}catch{}}function or(e){let t=ne(e,{throwIfNoEntry:!1});return(t?t.isFile():void 0)??!1}function sr(e,t,n){let r;if(t.main!==void 0){if(r=new E(t.main,e),or(r))return r;let i=[`./${t.main}.js`,`./${t.main}.json`,`./${t.main}.node`,`./${t.main}/index.js`,`./${t.main}/index.json`,`./${t.main}/index.node`],a=-1;for(;++a<i.length&&(r=new E(i[a],e),!or(r));)r=void 0;if(r)return ir(r,e,n,t.main),r}let i=[`./index.js`,`./index.json`,`./index.node`],a=-1;for(;++a<i.length&&(r=new E(i[a],e),!or(r));)r=void 0;if(r)return ir(r,e,n,t.main),r;throw new An(D(new E(`.`,e)),D(n))}function cr(e,n,r){if(er.exec(e.pathname)!==null)throw new Dn(e.pathname,String.raw`must not include encoded "/" or "\" characters`,D(n));let i;try{i=D(e)}catch(t){throw Object.defineProperty(t,`input`,{value:String(e)}),Object.defineProperty(t,`module`,{value:String(n)}),t}let a=ar(i.endsWith(`/`)?i.slice(-1):i);if(a&&a.isDirectory()){let t=new Nn(i,D(n));throw t.url=String(e),t}if(!a||!a.isFile()){let t=new An(i||e.pathname,n&&D(n),!0);throw t.url=String(e),t}if(!r){let n=T(i),{search:r,hash:a}=e;e=ce(n+(i.endsWith(t.sep)?`/`:``)),e.search=r,e.hash=a}return e}function lr(e,t,n){return new jn(e,t&&D(new E(`.`,t)),D(n))}function ur(e,t,n){return new Mn(D(new E(`.`,t)),e,n&&D(n))}function dr(e,t,n,r,i){throw new Dn(e,`request is not a valid match in pattern "${t}" for the "${r?`imports`:`exports`}" resolution of ${D(n)}`,i&&D(i))}function fr(e,t,n,r,i){return t=typeof t==`object`&&t?JSON.stringify(t,null,``):`${t}`,new kn(D(new E(`.`,n)),e,t,r,i&&D(i))}function pr(e,t,n,r,i,a,o,s,c){if(t!==``&&!a&&e.at(-1)!==`/`)throw fr(n,e,r,o,i);if(!e.startsWith(`./`)){if(o&&!e.startsWith(`../`)&&!e.startsWith(`/`)){let n=!1;try{new E(e),n=!0}catch{}if(!n)return Sr(a?Jn.call($n,e,()=>t):e+t,r,c)}throw fr(n,e,r,o,i)}if(Xn.exec(e.slice(2))!==null)if(Zn.exec(e.slice(2))===null){if(!s){let s=a?n.replace(`*`,()=>t):n+t;rr(a?Jn.call($n,e,()=>t):e,s,n,r,o,i,!0)}}else throw fr(n,e,r,o,i);let l=new E(e,r),u=l.pathname,d=new E(`.`,r).pathname;if(!u.startsWith(d))throw fr(n,e,r,o,i);if(t===``)return l;if(Xn.exec(t)!==null){let c=a?n.replace(`*`,()=>t):n+t;Zn.exec(t)===null?s||rr(a?Jn.call($n,e,()=>t):e,c,n,r,o,i,!1):dr(c,n,r,o,i)}return a?new E(Jn.call($n,l.href,()=>t)):new E(t,l)}function mr(e){let t=Number(e);return`${t}`===e?t>=0&&t<4294967295:!1}function hr(e,t,n,r,i,a,o,s,c){if(typeof t==`string`)return pr(t,n,r,e,i,a,o,s,c);if(Array.isArray(t)){let l=t;if(l.length===0)return null;let u,d=-1;for(;++d<l.length;){let t=l[d],f;try{f=hr(e,t,n,r,i,a,o,s,c)}catch(e){let t=e;if(u=t,t.code===`ERR_INVALID_PACKAGE_TARGET`)continue;throw e}if(f!==void 0){if(f===null){u=null;continue}return f}}if(u==null)return null;throw u}if(typeof t==`object`&&t){let l=Object.getOwnPropertyNames(t),u=-1;for(;++u<l.length;){let t=l[u];if(mr(t))throw new On(D(e),D(i),`"exports" cannot contain numeric property keys.`)}for(u=-1;++u<l.length;){let d=l[u];if(d===`default`||c&&c.has(d)){let l=t[d],u=hr(e,l,n,r,i,a,o,s,c);if(u===void 0)continue;return u}}return null}if(t===null)return null;throw fr(r,t,e,o,i)}function gr(e,t,n){if(typeof e==`string`||Array.isArray(e))return!0;if(typeof e!=`object`||!e)return!1;let r=Object.getOwnPropertyNames(e),i=!1,a=0,o=-1;for(;++o<r.length;){let e=r[o],s=e===``||e[0]!==`.`;if(a++===0)i=s;else if(i!==s)throw new On(D(t),D(n),`"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`)}return i}function _r(e,t,n){if(s.noDeprecation)return;let r=D(t);tr.has(r+`|`+e)||(tr.add(r+`|`+e),s.emitWarning(`Use of deprecated trailing slash pattern mapping "${e}" in the "exports" field module resolution of the package at ${r}${n?` imported from ${D(n)}`:``}. Mapping specifiers ending in "/" is no longer supported.`,`DeprecationWarning`,`DEP0155`))}function vr(e,t,n,r,i){let a=n.exports;if(gr(a,e,r)&&(a={".":a}),Yn.call(a,t)&&!t.includes(`*`)&&!t.endsWith(`/`)){let n=a[t],o=hr(e,n,``,t,r,!1,!1,!1,i);if(o==null)throw ur(t,e,r);return o}let o=``,s=``,c=Object.getOwnPropertyNames(a),l=-1;for(;++l<c.length;){let n=c[l],i=n.indexOf(`*`);if(i!==-1&&t.startsWith(n.slice(0,i))){t.endsWith(`/`)&&_r(t,e,r);let a=n.slice(i+1);t.length>=n.length&&t.endsWith(a)&&yr(o,n)===1&&n.lastIndexOf(`*`)===i&&(o=n,s=t.slice(i,t.length-a.length))}}if(o){let n=a[o],c=hr(e,n,s,o,r,!0,!1,t.endsWith(`/`),i);if(c==null)throw ur(t,e,r);return c}throw ur(t,e,r)}function yr(e,t){let n=e.indexOf(`*`),r=t.indexOf(`*`),i=n===-1?e.length:n+1,a=r===-1?t.length:r+1;return i>a?-1:a>i||n===-1?1:r===-1||e.length>t.length?-1:t.length>e.length?1:0}function br(e,t,n){if(e===`#`||e.startsWith(`#/`)||e.endsWith(`/`))throw new Dn(e,`is not a valid internal imports specifier name`,D(t));let r,i=zn(t);if(i.exists){r=ce(i.pjsonPath);let a=i.imports;if(a)if(Yn.call(a,e)&&!e.includes(`*`)){let i=hr(r,a[e],``,e,t,!1,!0,!1,n);if(i!=null)return i}else{let i=``,o=``,s=Object.getOwnPropertyNames(a),c=-1;for(;++c<s.length;){let t=s[c],n=t.indexOf(`*`);if(n!==-1&&e.startsWith(t.slice(0,-1))){let r=t.slice(n+1);e.length>=t.length&&e.endsWith(r)&&yr(i,t)===1&&t.lastIndexOf(`*`)===n&&(i=t,o=e.slice(n,e.length-r.length))}}if(i){let e=a[i],s=hr(r,e,o,i,t,!0,!0,!1,n);if(s!=null)return s}}}throw lr(e,r,t)}function xr(e,t){let n=e.indexOf(`/`),r=!0,i=!1;e[0]===`@`&&(i=!0,n===-1||e.length===0?r=!1:n=e.indexOf(`/`,n+1));let a=n===-1?e:e.slice(0,n);if(Qn.exec(a)!==null&&(r=!1),!r)throw new Dn(e,`is not a valid package name`,D(t));return{packageName:a,packageSubpath:`.`+(n===-1?``:e.slice(n)),isScoped:i}}function Sr(e,t,n){if(pn.includes(e))return new E(`node:`+e);let{packageName:r,packageSubpath:i,isScoped:a}=xr(e,t),o=zn(t);if(o.exists&&o.name===r&&o.exports!==void 0&&o.exports!==null)return vr(ce(o.pjsonPath),i,o,t,n);let s=new E(`./node_modules/`+r+`/package.json`,t),c=D(s),l;do{let o=ar(c.slice(0,-13));if(!o||!o.isDirectory()){l=c,s=new E((a?`../../../../node_modules/`:`../../../node_modules/`)+r+`/package.json`,s),c=D(s);continue}let u=Rn(c,{base:t,specifier:e});return u.exports!==void 0&&u.exports!==null?vr(s,i,u,t,n):i===`.`?sr(s,u,t):new E(i,s)}while(c.length!==l.length);throw new An(r,D(t),!1)}function Cr(e){return e[0]===`.`&&(e.length===1||e[1]===`/`||e[1]===`.`&&(e.length===2||e[2]===`/`))}function wr(e){return e===``?!1:e[0]===`/`?!0:Cr(e)}function Tr(e,t,n,r){let i=t.protocol,a=i===`data:`,o;if(wr(e))try{o=new E(e,t)}catch(n){let r=new Pn(e,t);throw r.cause=n,r}else if(i===`file:`&&e[0]===`#`)o=br(e,t,n);else try{o=new E(e)}catch(r){if(a&&!pn.includes(e)){let n=new Pn(e,t);throw n.cause=r,n}o=Sr(e,t,n)}return O.ok(o!==void 0,`expected to be defined`),o.protocol===`file:`?cr(o,t,r):o}const W=new Set([`node`,`import`]),Er=(()=>process.platform===`win32`)(),Dr=(()=>globalThis.__EXSOLVE_CACHE__||=new Map)();function Or(e,t){let n=Lr(e);if(`external`in n)return n.external;let r=n.specifier,i=n.url,a=n.absolutePath,o,s;if(t?.cache!==!1&&(o=Pr(a||r,t),s=t?.cache&&typeof t?.cache==`object`?t.cache:Dr),s){let e=s.get(o);if(typeof e==`string`)return e;if(e instanceof Error){if(t?.try)return;throw e}}if(a)try{let e=S(a);if(e.isSymbolicLink()&&(a=T(a),i=ce(a)),e.isFile())return s&&s.set(o,i.href),i.href}catch(e){if(e?.code!==`ENOENT`)throw s&&s.set(o,e),e}let c=t?.conditions?new Set(t.conditions):W,l=r||i.href,u=jr(t?.from),d=t?.suffixes||[``],f=t?.extensions?[``,...t.extensions]:[``],p;for(let e of u){for(let t of d){let n=G(l,t);n===`.`&&(n+=`/.`);for(let t of f)if(p=Ar(n+t,e,c),p)break;if(p)break}if(p)break}if(!p){let n=Error(`Cannot resolve module "${e}" (from: ${u.map(e=>Nr(e)).join(`, `)})`);if(n.code=`ERR_MODULE_NOT_FOUND`,s&&s.set(o,n),t?.try)return;throw n}return s&&s.set(o,p.href),p.href}function kr(e,t){let n=Or(e,t);if(!n||!n.startsWith(`file://`)&&t?.try)return;let r=D(n);return Er?Fr(r):r}function Ar(e,t,n){try{return Tr(e,t,n)}catch{}}function jr(e){let t=(Array.isArray(e)?e:[e]).flatMap(e=>Mr(e));return t.length===0?[ce(`./`)]:t}function Mr(e){if(!e)return[];if(Ir(e))return[e];if(typeof e!=`string`)return[];if(/^(?:node|data|http|https|file):/.test(e))return new URL(e);try{return e.endsWith(`/`)||ne(e).isDirectory()?ce(e+`/`):ce(e)}catch{return[ce(e+`/`),ce(e)]}}function Nr(e){try{return D(e)}catch{return e}}function Pr(e,t){return JSON.stringify([e,(t?.conditions||[`node`,`import`]).sort(),t?.extensions,t?.from,t?.suffixes])}function G(e,t){return!e||!t||t===`/`?e:(e.endsWith(`/`)?e:e+`/`)+(t.startsWith(`/`)?t.slice(1):t)}function Fr(e){return e.replace(/\\/g,`/`).replace(/^[a-z]:\//,e=>e.toUpperCase())}function Ir(e){return e instanceof URL||e?.constructor?.name===`URL`}function Lr(e){if(typeof e==`string`){if(e.startsWith(`file:`)){let t=new URL(e);return{url:t,absolutePath:D(t)}}return i(e)?{url:ce(e),absolutePath:e}:/^(?:node|data|http|https):/.test(e)?{external:e}:pn.includes(e)&&!e.includes(`:`)?{external:`node:${e}`}:{specifier:e}}if(Ir(e))return e.protocol===`file:`?{url:e,absolutePath:D(e)}:{external:e.href};throw TypeError("id must be a `string` or `URL`")}var Rr=ge(M(((e,t)=>{(()=>{var e={"./node_modules/.pnpm/mlly@1.8.0/node_modules/mlly/dist lazy recursive":function(e){function t(e){return Promise.resolve().then(function(){var t=Error(`Cannot find module '`+e+`'`);throw t.code=`MODULE_NOT_FOUND`,t})}t.keys=()=>[],t.resolve=t,t.id=`./node_modules/.pnpm/mlly@1.8.0/node_modules/mlly/dist lazy recursive`,e.exports=t}},n={};function r(t){var i=n[t];if(i!==void 0)return i.exports;var a=n[t]={exports:{}};return e[t](a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var i={};(()=>{r.d(i,{default:()=>$r});let e=N(`node:os`);var t=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],n=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],a=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,o={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},s=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,c={5:s,"5module":s+` export import`,6:s+` const class extends export import super`},l=/^in(stanceof)?$/,u=RegExp(`[`+a+`]`),d=RegExp(`[`+a+`‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・]`);function f(e,t){for(var n=65536,r=0;r<t.length;r+=2){if((n+=t[r])>e)return!1;if((n+=t[r+1])>=e)return!0}return!1}function p(e,t){return e<65?e===36:e<91||(e<97?e===95:e<123||(e<=65535?e>=170&&u.test(String.fromCharCode(e)):!1!==t&&f(e,n)))}function m(e,r){return e<48?e===36:e<58||!(e<65)&&(e<91||(e<97?e===95:e<123||(e<=65535?e>=170&&d.test(String.fromCharCode(e)):!1!==r&&(f(e,n)||f(e,t)))))}var h=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function g(e,t){return new h(e,{beforeExpr:!0,binop:t})}var _={beforeExpr:!0},v={startsExpr:!0},y={};function b(e,t){return t===void 0&&(t={}),t.keyword=e,y[e]=new h(e,t)}var x={num:new h(`num`,v),regexp:new h(`regexp`,v),string:new h(`string`,v),name:new h(`name`,v),privateId:new h(`privateId`,v),eof:new h(`eof`),bracketL:new h(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new h(`]`),braceL:new h(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new h(`}`),parenL:new h(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new h(`)`),comma:new h(`,`,_),semi:new h(`;`,_),colon:new h(`:`,_),dot:new h(`.`),question:new h(`?`,_),questionDot:new h(`?.`),arrow:new h(`=>`,_),template:new h(`template`),invalidTemplate:new h(`invalidTemplate`),ellipsis:new h(`...`,_),backQuote:new h("`",v),dollarBraceL:new h("${",{beforeExpr:!0,startsExpr:!0}),eq:new h(`=`,{beforeExpr:!0,isAssign:!0}),assign:new h(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new h(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new h(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:g(`||`,1),logicalAND:g(`&&`,2),bitwiseOR:g(`|`,3),bitwiseXOR:g(`^`,4),bitwiseAND:g(`&`,5),equality:g(`==/!=/===/!==`,6),relational:g(`</>/<=/>=`,7),bitShift:g(`<</>>/>>>`,8),plusMin:new h(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:g(`%`,10),star:g(`*`,10),slash:g(`/`,10),starstar:new h(`**`,{beforeExpr:!0}),coalesce:g(`??`,1),_break:b(`break`),_case:b(`case`,_),_catch:b(`catch`),_continue:b(`continue`),_debugger:b(`debugger`),_default:b(`default`,_),_do:b(`do`,{isLoop:!0,beforeExpr:!0}),_else:b(`else`,_),_finally:b(`finally`),_for:b(`for`,{isLoop:!0}),_function:b(`function`,v),_if:b(`if`),_return:b(`return`,_),_switch:b(`switch`),_throw:b(`throw`,_),_try:b(`try`),_var:b(`var`),_const:b(`const`),_while:b(`while`,{isLoop:!0}),_with:b(`with`),_new:b(`new`,{beforeExpr:!0,startsExpr:!0}),_this:b(`this`,v),_super:b(`super`,v),_class:b(`class`,v),_extends:b(`extends`,_),_export:b(`export`),_import:b(`import`,v),_null:b(`null`,v),_true:b(`true`,v),_false:b(`false`,v),_in:b(`in`,{beforeExpr:!0,binop:7}),_instanceof:b(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:b(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:b(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:b(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},S=/\r\n?|\n|\u2028|\u2029/,C=new RegExp(S.source,`g`);function w(e){return e===10||e===13||e===8232||e===8233}function ee(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(w(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var te=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,T=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ne=Object.prototype,re=ne.hasOwnProperty,ie=ne.toString,ae=Object.hasOwn||function(e,t){return re.call(e,t)},oe=Array.isArray||function(e){return ie.call(e)===`[object Array]`},se=Object.create(null);function E(e){return se[e]||(se[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function D(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var ce=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,O=function(e,t){this.line=e,this.column=t};O.prototype.offset=function(e){return new O(this.line,this.column+e)};var le=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function ue(e,t){for(var n=1,r=0;;){var i=ee(e,r,t);if(i<0)return new O(n,t-r);++n,r=i}}var k={ecmaVersion:null,sourceType:`script`,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},A=!1;function de(e){var t={};for(var n in k)t[n]=e&&ae(e,n)?e[n]:k[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!A&&typeof console==`object`&&console.warn&&(A=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
57
- Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,e&&e.allowHashBang!=null||(t.allowHashBang=t.ecmaVersion>=14),oe(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return oe(t.onComment)&&(t.onComment=function(e,t){return function(n,r,i,a,o,s){var c={type:n?`Block`:`Line`,value:r,start:i,end:a};e.locations&&(c.loc=new le(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}(t,t.onComment)),t}var fe=256,pe=259;function me(e,t){return 2|(e?4:0)|(t?8:0)}var j=function(e,t,n){this.options=e=de(e),this.sourceFile=e.sourceFile,this.keywords=E(c[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;!0!==e.allowReserved&&(r=o[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=E(r);var i=(r?r+` `:``)+o.strict;this.reservedWordsStrict=E(i),this.reservedWordsStrictBind=E(i+` `+o.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(`
58
- `,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(S).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=x.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType===`module`,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(1),this.regexpState=null,this.privateNameStack=[]},M={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};j.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},M.inFunction.get=function(){return(2&this.currentVarScope().flags)>0},M.inGenerator.get=function(){return(8&this.currentVarScope().flags)>0},M.inAsync.get=function(){return(4&this.currentVarScope().flags)>0},M.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(768&t)return!1;if(2&t)return(4&t)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},M.allowSuper.get=function(){return(64&this.currentThisScope().flags)>0||this.options.allowSuperOutsideMethod},M.allowDirectSuper.get=function(){return(128&this.currentThisScope().flags)>0},M.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},M.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(768&t||2&t&&!(16&t))return!0}return!1},M.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&fe)>0},j.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},j.parse=function(e,t){return new this(t,e).parse()},j.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},j.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(j.prototype,M);var he=j.prototype,ge=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;he.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){T.lastIndex=e,e+=T.exec(this.input)[0].length;var t=ge.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){T.lastIndex=e+t[0].length;var n=T.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||S.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,T.lastIndex=e,e+=T.exec(this.input)[0].length,this.input[e]===`;`&&e++}},he.eat=function(e){return this.type===e&&(this.next(),!0)},he.isContextual=function(e){return this.type===x.name&&this.value===e&&!this.containsEsc},he.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},he.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},he.canInsertSemicolon=function(){return this.type===x.eof||this.type===x.braceR||S.test(this.input.slice(this.lastTokEnd,this.start))},he.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},he.semicolon=function(){this.eat(x.semi)||this.insertSemicolon()||this.unexpected()},he.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},he.expect=function(e){this.eat(e)||this.unexpected()},he.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};var _e=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};he.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},he.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},he.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,`Yield expression cannot be a default value`),this.awaitPos&&this.raise(this.awaitPos,`Await expression cannot be a default value`)},he.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var P=j.prototype;P.parseTopLevel=function(e){var t=Object.create(null);for(e.body||=[];this.type!==x.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,`Program`)};var ve={kind:`loop`},ye={kind:`switch`};P.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;T.lastIndex=this.pos;var t=T.exec(this.input),n=this.pos+t[0].length,r=this.input.charCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123||r>55295&&r<56320)return!0;if(p(r,!0)){for(var i=n+1;m(r=this.input.charCodeAt(i),!0);)++i;if(r===92||r>55295&&r<56320)return!0;var a=this.input.slice(n,i);if(!l.test(a))return!0}return!1},P.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;T.lastIndex=this.pos;var e,t=T.exec(this.input),n=this.pos+t[0].length;return!(S.test(this.input.slice(this.pos,n))||this.input.slice(n,n+8)!==`function`||n+8!==this.input.length&&(m(e=this.input.charCodeAt(n+8))||e>55295&&e<56320))},P.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?`await`:`using`))return!1;T.lastIndex=this.pos;var n=T.exec(this.input),r=this.pos+n[0].length;if(S.test(this.input.slice(this.pos,r)))return!1;if(e){var i,a=r+5;if(this.input.slice(r,a)!==`using`||a===this.input.length||m(i=this.input.charCodeAt(a))||i>55295&&i<56320)return!1;T.lastIndex=a;var o=T.exec(this.input);if(o&&S.test(this.input.slice(a,a+o[0].length)))return!1}if(t){var s,c=r+2;if(!(this.input.slice(r,c)!==`of`||c!==this.input.length&&(m(s=this.input.charCodeAt(c))||s>55295&&s<56320)))return!1}var l=this.input.charCodeAt(r);return p(l,!0)||l===92},P.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},P.isUsing=function(e){return this.isUsingKeyword(!1,e)},P.parseStatement=function(e,t,n){var r,i=this.type,a=this.startNode();switch(this.isLet(e)&&(i=x._var,r=`let`),i){case x._break:case x._continue:return this.parseBreakContinueStatement(a,i.keyword);case x._debugger:return this.parseDebuggerStatement(a);case x._do:return this.parseDoStatement(a);case x._for:return this.parseForStatement(a);case x._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(a,!1,!e);case x._class:return e&&this.unexpected(),this.parseClass(a,!0);case x._if:return this.parseIfStatement(a);case x._return:return this.parseReturnStatement(a);case x._switch:return this.parseSwitchStatement(a);case x._throw:return this.parseThrowStatement(a);case x._try:return this.parseTryStatement(a);case x._const:case x._var:return r||=this.value,e&&r!==`var`&&this.unexpected(),this.parseVarStatement(a,r);case x._while:return this.parseWhileStatement(a);case x._with:return this.parseWithStatement(a);case x.braceL:return this.parseBlock(!0,a);case x.semi:return this.parseEmptyStatement(a);case x._export:case x._import:if(this.options.ecmaVersion>10&&i===x._import){T.lastIndex=this.pos;var o=T.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(a,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,`'import' and 'export' may only appear at the top level`),this.inModule||this.raise(this.start,`'import' and 'export' may appear only with 'sourceType: module'`)),i===x._import?this.parseImport(a):this.parseExport(a,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(a,!0,!e);var l=this.isAwaitUsing(!1)?`await using`:this.isUsing(!1)?`using`:null;if(l)return t&&this.options.sourceType===`script`&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),l===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.next(),this.parseVar(a,!1,l),this.semicolon(),this.finishNode(a,`VariableDeclaration`);var u=this.value,d=this.parseExpression();return i===x.name&&d.type===`Identifier`&&this.eat(x.colon)?this.parseLabeledStatement(a,u,d,e):this.parseExpressionStatement(a,d)}},P.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(x.semi)||this.insertSemicolon()?e.label=null:this.type===x.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},P.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},P.parseDoStatement=function(e){return this.next(),this.labels.push(ve),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(x._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(x.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},P.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(ve),this.enterScope(0),this.expect(x.parenL),this.type===x.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===x._var||this.type===x._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),this.parseForAfterInit(e,r,t)}var a=this.isContextual(`let`),o=!1,s=this.isUsing(!0)?`using`:this.isAwaitUsing(!0)?`await using`:null;if(s){var c=this.startNode();return this.next(),s===`await using`&&this.next(),this.parseVar(c,!0,s),this.finishNode(c,`VariableDeclaration`),this.parseForAfterInit(e,c,t)}var l=this.containsEsc,u=new _e,d=this.start,f=t>-1?this.parseExprSubscripts(u,`await`):this.parseExpression(!0,u);return this.type===x._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===x._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(f.start!==d||l||f.type!==`Identifier`||f.name!==`async`?this.options.ecmaVersion>=9&&(e.await=!1):this.unexpected()),a&&o&&this.raise(f.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(f,!1,u),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))},P.parseForAfterInit=function(e,t,n){return(this.type===x._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&t.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===x._in?n>-1&&this.unexpected(n):e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},P.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,be|(n?0:xe),!1,t)},P.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(x._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},P.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,`'return' outside of function`),this.next(),this.eat(x.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},P.parseSwitchStatement=function(e){var t;this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(x.braceL),this.labels.push(ye),this.enterScope(0);for(var n=!1;this.type!==x.braceR;)if(this.type===x._case||this.type===x._default){var r=this.type===x._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(x.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},P.parseThrowStatement=function(e){return this.next(),S.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)};var F=[];P.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type===`Identifier`;return this.enterScope(t?32:0),this.checkLValPattern(e,t?4:2),this.expect(x.parenR),e},P.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===x._catch){var t=this.startNode();this.next(),this.eat(x.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(x._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},P.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},P.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(ve),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},P.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},P.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},P.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===x._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart!==e.start)break;c.statementStart=this.start,c.kind=o}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},P.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},P.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(x.braceL),e&&this.enterScope(0);this.type!==x.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},P.parseFor=function(e,t){return e.init=t,this.expect(x.semi),e.test=this.type===x.semi?null:this.parseExpression(),this.expect(x.semi),e.update=this.type===x.parenR?null:this.parseExpression(),this.expect(x.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},P.parseForIn=function(e,t){var n=this.type===x._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(x.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},P.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(x.eq)?i.init=this.parseMaybeAssign(t):r||n!==`const`||this.type===x._in||this.options.ecmaVersion>=6&&this.isContextual(`of`)?r||n!==`using`&&n!==`await using`||!(this.options.ecmaVersion>=17)||this.type===x._in||this.isContextual(`of`)?r||i.id.type===`Identifier`||t&&(this.type===x._in||this.isContextual(`of`))?i.init=null:this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):this.raise(this.lastTokEnd,`Missing initializer in `+n+` declaration`):this.unexpected(),e.declarations.push(this.finishNode(i,`VariableDeclarator`)),!this.eat(x.comma))break}return e},P.parseVarId=function(e,t){e.id=t===`using`||t===`await using`?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?1:2,!1)};var be=1,xe=2;function Se(e,t){var n=t.key.name,r=e[n],i=`true`;return t.type!==`MethodDefinition`||t.kind!==`get`&&t.kind!==`set`||(i=(t.static?`s`:`i`)+t.kind),r===`iget`&&i===`iset`||r===`iset`&&i===`iget`||r===`sget`&&i===`sset`||r===`sset`&&i===`sget`?(e[n]=`true`,!1):!!r||(e[n]=i,!1)}function Ce(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}P.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===x.star&&t&xe&&this.unexpected(),e.generator=this.eat(x.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&be&&(e.id=4&t&&this.type!==x.name?null:this.parseIdent(),!e.id||t&xe||this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?1:2:3));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(me(e.async,e.generator)),t&be||(e.id=this.type===x.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&be?`FunctionDeclaration`:`FunctionExpression`)},P.parseFunctionParams=function(e){this.expect(x.parenL),e.params=this.parseBindingList(x.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},P.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(x.braceL);this.type!==x.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type===`MethodDefinition`&&o.kind===`constructor`?(a&&this.raiseRecoverable(o.start,`Duplicate constructor in the same class`),a=!0):o.key&&o.key.type===`PrivateIdentifier`&&Se(r,o)&&this.raiseRecoverable(o.key.start,`Identifier '#`+o.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(i,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},P.parseClassElement=function(e){if(this.eat(x.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,i=!1,a=!1,o=`method`,s=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(x.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===x.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&(!this.isClassElementNameStart()&&this.type!==x.star||this.canInsertSemicolon()?r=`async`:a=!0),!r&&(t>=9||!a)&&this.eat(x.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===x.parenL||o!==`method`||i||a){var l=!n.static&&Ce(n,`constructor`),u=l&&e;l&&o!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=l?`constructor`:o,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},P.isClassElementNameStart=function(){return this.type===x.name||this.type===x.privateId||this.type===x.num||this.type===x.string||this.type===x.bracketL||this.type.keyword},P.parseClassElementName=function(e){this.type===x.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},P.parseClassMethod=function(e,t,n,r){var i=e.key;e.kind===`constructor`?(t&&this.raise(i.start,`Constructor can't be a generator`),n&&this.raise(i.start,`Constructor can't be an async method`)):e.static&&Ce(e,`prototype`)&&this.raise(i.start,`Classes may not have a static property named prototype`);var a=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&a.params.length!==0&&this.raiseRecoverable(a.start,`getter should have no params`),e.kind===`set`&&a.params.length!==1&&this.raiseRecoverable(a.start,`setter should have exactly one param`),e.kind===`set`&&a.params[0].type===`RestElement`&&this.raiseRecoverable(a.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},P.parseClassField=function(e){return Ce(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&Ce(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(x.eq)?(this.enterScope(576),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,`PropertyDefinition`)},P.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(320);this.type!==x.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},P.parseClassId=function(e,t){this.type===x.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,2,!1)):(!0===t&&this.unexpected(),e.id=null)},P.parseClassSuper=function(e){e.superClass=this.eat(x._extends)?this.parseExprSubscripts(null,!1):null},P.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},P.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var o=n[a];ae(t,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,`Private field '#`+o.name+`' must be declared in an enclosing class`))}},P.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==x.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)},P.parseExport=function(e,t){if(this.next(),this.eat(x.star))return this.parseExportAllDeclaration(e,t);if(this.eat(x._default))return this.checkExport(t,`default`,this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,`ExportDefaultDeclaration`);if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==x.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,r=e.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type===`Literal`&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},P.parseExportDeclaration=function(e){return this.parseStatement(null)},P.parseExportDefaultDeclaration=function(){var e;if(this.type===x._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,4|be,!1,e)}if(this.type===x._class){var n=this.startNode();return this.parseClass(n,`nullableID`)}var r=this.parseMaybeAssign();return this.semicolon(),r},P.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),ae(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},P.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`&&this.checkPatternExport(e,t.argument)},P.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},P.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},P.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual(`as`)?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,`ExportSpecifier`)},P.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(x.braceL);!this.eat(x.braceR);){if(n)n=!1;else if(this.expect(x.comma),this.afterTrailingComma(x.braceR))break;t.push(this.parseExportSpecifier(e))}return t},P.parseImport=function(e){return this.next(),this.type===x.string?(e.specifiers=F,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===x.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},P.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual(`as`)?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,2),this.finishNode(e,`ImportSpecifier`)},P.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,2),this.finishNode(e,`ImportDefaultSpecifier`)},P.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual(`as`),e.local=this.parseIdent(),this.checkLValSimple(e.local,2),this.finishNode(e,`ImportNamespaceSpecifier`)},P.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===x.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(x.comma)))return e;if(this.type===x.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(x.braceL);!this.eat(x.braceR);){if(t)t=!1;else if(this.expect(x.comma),this.afterTrailingComma(x.braceR))break;e.push(this.parseImportSpecifier())}return e},P.parseWithClause=function(){var e=[];if(!this.eat(x._with))return e;this.expect(x.braceL);for(var t={},n=!0;!this.eat(x.braceR);){if(n)n=!1;else if(this.expect(x.comma),this.afterTrailingComma(x.braceR))break;var r=this.parseImportAttribute(),i=r.key.type===`Identifier`?r.key.name:r.key.value;ae(t,i)&&this.raiseRecoverable(r.key.start,`Duplicate attribute key '`+i+`'`),t[i]=!0,e.push(r)}return e},P.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===x.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(x.colon),this.type!==x.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},P.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===x.string){var e=this.parseLiteral(this.value);return ce.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},P.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},P.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var we=j.prototype;we.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type!==`RestElement`||a.argument.type!==`ArrayPattern`&&a.argument.type!==`ObjectPattern`||this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},we.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},we.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},we.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==x.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},we.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case x.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(x.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case x.braceL:return this.parseObj(!0)}return this.parseIdent()},we.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(x.comma),t&&this.type===x.comma)i.push(null);else{if(n&&this.afterTrailingComma(e))break;if(this.type===x.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===x.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}i.push(this.parseAssignableListItem(r))}return i},we.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},we.parseBindingListItem=function(e){return e},we.parseMaybeDefault=function(e,t,n){if(n||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(x.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},we.checkLValSimple=function(e,t,n){t===void 0&&(t=0);var r=t!==0;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===2&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&(ae(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==5&&this.declareName(e.name,t,e.start));break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},we.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=0),e.type){case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},we.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=0),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var Te=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},I={b_stat:new Te(`{`,!1),b_expr:new Te(`{`,!0),b_tmpl:new Te("${",!1),p_stat:new Te(`(`,!1),p_expr:new Te(`(`,!0),q_tmpl:new Te("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new Te(`function`,!1),f_expr:new Te(`function`,!0),f_expr_gen:new Te(`function`,!0,!1,null,!0),f_gen:new Te(`function`,!1,!1,null,!0)},Ee=j.prototype;Ee.initialContext=function(){return[I.b_stat]},Ee.curContext=function(){return this.context[this.context.length-1]},Ee.braceIsBlock=function(e){var t=this.curContext();return t===I.f_expr||t===I.f_stat||(e!==x.colon||t!==I.b_stat&&t!==I.b_expr?e===x._return||e===x.name&&this.exprAllowed?S.test(this.input.slice(this.lastTokEnd,this.start)):e===x._else||e===x.semi||e===x.eof||e===x.parenR||e===x.arrow||(e===x.braceL?t===I.b_stat:e!==x._var&&e!==x._const&&e!==x.name&&!this.exprAllowed):!t.isExpr)},Ee.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},Ee.updateContext=function(e){var t,n=this.type;n.keyword&&e===x.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},Ee.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},x.parenR.updateContext=x.braceR.updateContext=function(){if(this.context.length!==1){var e=this.context.pop();e===I.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},x.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?I.b_stat:I.b_expr),this.exprAllowed=!0},x.dollarBraceL.updateContext=function(){this.context.push(I.b_tmpl),this.exprAllowed=!0},x.parenL.updateContext=function(e){var t=e===x._if||e===x._for||e===x._with||e===x._while;this.context.push(t?I.p_stat:I.p_expr),this.exprAllowed=!0},x.incDec.updateContext=function(){},x._function.updateContext=x._class.updateContext=function(e){!e.beforeExpr||e===x._else||e===x.semi&&this.curContext()!==I.p_stat||e===x._return&&S.test(this.input.slice(this.lastTokEnd,this.start))||(e===x.colon||e===x.braceL)&&this.curContext()===I.b_stat?this.context.push(I.f_stat):this.context.push(I.f_expr),this.exprAllowed=!1},x.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},x.backQuote.updateContext=function(){this.curContext()===I.q_tmpl?this.context.pop():this.context.push(I.q_tmpl),this.exprAllowed=!1},x.star.updateContext=function(e){if(e===x._function){var t=this.context.length-1;this.context[t]===I.f_expr?this.context[t]=I.f_expr_gen:this.context[t]=I.f_gen}this.exprAllowed=!0},x.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==x.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var L=j.prototype;function De(e){return e.type===`Identifier`||e.type===`ParenthesizedExpression`&&De(e.expression)}function Oe(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&Oe(e.expression)||e.type===`ParenthesizedExpression`&&Oe(e.expression)}L.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r,i=e.key;switch(i.type){case`Identifier`:r=i.name;break;case`Literal`:r=String(i.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6)r===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=i.start):this.raiseRecoverable(i.start,`Redefinition of __proto__ property`)),t.proto=!0);else{var o=t[r=`$`+r];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(i.start,`Redefinition of property`):o=t[r]={init:!1,get:!1,set:!1},o[a]=!0}}},L.parseExpression=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeAssign(e,t);if(this.type===x.comma){var a=this.startNodeAt(n,r);for(a.expressions=[i];this.eat(x.comma);)a.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(a,`SequenceExpression`)}return i},L.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new _e,r=!0);var s=this.start,c=this.startLoc;this.type!==x.parenL&&this.type!==x.name||(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,s,c)),this.type.isAssign){var u=this.startNodeAt(s,c);return u.operator=this.value,this.type===x.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===x.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(u,`AssignmentExpression`)}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},L.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(x.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(x.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},L.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},L.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==x._in)&&a>r){var o=this.type===x.logicalOR||this.type===x.logicalAND,s=this.type===x.coalesce;s&&(a=x.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),f=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===x.coalesce||s&&(this.type===x.logicalOR||this.type===x.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(f,t,n,r,i)}return e},L.buildBinary=function(e,t,n,r,i,a){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},L.parseMaybeUnary=function(e,t,n,r){var i,a=this.start,o=this.startLoc;if(this.isContextual(`await`)&&this.canAwait)i=this.parseAwait(r),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===x.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&s.operator===`delete`&&De(s.argument)?this.raiseRecoverable(s.start,`Deleting local variable in strict mode`):s.operator===`delete`&&Oe(s.argument)?this.raiseRecoverable(s.start,`Private fields can not be deleted`):t=!0,i=this.finishNode(s,c?`UpdateExpression`:`UnaryExpression`)}else if(t||this.type!==x.privateId){if(i=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return i;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(a,o);l.operator=this.value,l.prefix=!1,l.argument=i,this.checkLValSimple(i),this.next(),i=this.finishNode(l,`UpdateExpression`)}}else (r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),i=this.parsePrivateIdent(),this.type!==x._in&&this.unexpected();return n||!this.eat(x.starstar)?i:t?void this.unexpected(this.lastTokStart):this.buildBinary(a,o,i,this.parseMaybeUnary(null,!1,!1,r),`**`,!1)},L.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if(i.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&a.type===`MemberExpression`&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},L.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,n,r,a,o,i);if(s.optional&&(o=!0),s===e||s.type===`ArrowFunctionExpression`){if(o){var c=this.startNodeAt(t,n);c.expression=s,s=this.finishNode(c,`ChainExpression`)}return s}e=s}},L.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(x.arrow)},L.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},L.parseSubscript=function(e,t,n,r,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(x.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(x.bracketL);if(l||c&&this.type!==x.parenL&&this.type!==x.backQuote||this.eat(x.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(x.bracketR)):this.type===x.privateId&&e.type!==`Super`?u.property=this.parsePrivateIdent():u.property=this.parseIdent(this.options.allowReserved!==`never`),u.computed=!!l,s&&(u.optional=c),e=this.finishNode(u,`MemberExpression`)}else if(!r&&this.eat(x.parenL)){var d=new _e,f=this.yieldPos,p=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var h=this.parseExprList(x.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=f,this.awaitPos=p,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(t,n,h,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var g=this.startNodeAt(t,n);g.callee=e,g.arguments=h,s&&(g.optional=c),e=this.finishNode(g,`CallExpression`)}else if(this.type===x.backQuote){(c||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var _=this.startNodeAt(t,n);_.tag=e,_.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(_,`TaggedTemplateExpression`)}return e},L.parseExprAtom=function(e,t,n){this.type===x.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case x._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type!==x.parenL||this.allowDirectSuper||this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==x.dot&&this.type!==x.bracketL&&this.type!==x.parenL&&this.unexpected(),this.finishNode(r,`Super`);case x._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case x.name:var a=this.start,o=this.startLoc,s=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!s&&c.name===`async`&&!this.canInsertSemicolon()&&this.eat(x._function))return this.overrideContext(I.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(x.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name===`async`&&this.type===x.name&&!s&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return c=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat(x.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case x.regexp:var l=this.value;return(r=this.parseLiteral(l.value)).regex={pattern:l.pattern,flags:l.flags},r;case x.num:case x.string:return this.parseLiteral(this.value);case x._null:case x._true:case x._false:return(r=this.startNode()).value=this.type===x._null?null:this.type===x._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case x.parenL:var u=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),d;case x.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(x.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case x.braceL:return this.overrideContext(I.b_expr),this.parseObj(!1,e);case x._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case x._class:return this.parseClass(this.startNode(),!1);case x._new:return this.parseNew();case x.backQuote:return this.parseTemplate();case x._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},L.parseExprAtomDefault=function(){this.unexpected()},L.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`),this.next(),this.type===x.parenL&&!e)return this.parseDynamicImport(t);if(this.type===x.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name=`import`,t.meta=this.finishNode(n,`Identifier`),this.parseImportMeta(t)}this.unexpected()},L.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(x.parenR)?e.options=null:(this.expect(x.comma),this.afterTrailingComma(x.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(x.parenR)||(this.expect(x.comma),this.afterTrailingComma(x.parenR)||this.unexpected())));else if(!this.eat(x.parenR)){var t=this.start;this.eat(x.comma)&&this.eat(x.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},L.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType===`module`||this.options.allowImportExportEverywhere||this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},L.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value==null?t.raw.slice(0,-1).replace(/_/g,``):t.value.toString()),this.next(),this.finishNode(t,`Literal`)},L.parseParenExpression=function(){this.expect(x.parenL);var e=this.parseExpression();return this.expect(x.parenR),e},L.shouldParseArrow=function(e){return!this.canInsertSemicolon()},L.parseParenAndDistinguishExpression=function(e,t){var n,r=this.start,i=this.startLoc,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o,s=this.start,c=this.startLoc,l=[],u=!0,d=!1,f=new _e,p=this.yieldPos,m=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==x.parenR;){if(u?u=!1:this.expect(x.comma),a&&this.afterTrailingComma(x.parenR,!0)){d=!0;break}if(this.type===x.ellipsis){o=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===x.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`);break}l.push(this.parseMaybeAssign(!1,f,this.parseParenItem))}var h=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(x.parenR),e&&this.shouldParseArrow(l)&&this.eat(x.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=p,this.awaitPos=m,this.parseParenArrowList(r,i,l,t);l.length&&!d||this.unexpected(this.lastTokStart),o&&this.unexpected(o),this.checkExpressionErrors(f,!0),this.yieldPos=p||this.yieldPos,this.awaitPos=m||this.awaitPos,l.length>1?((n=this.startNodeAt(s,c)).expressions=l,this.finishNodeAt(n,`SequenceExpression`,h,g)):n=l[0]}else n=this.parseParenExpression();if(this.options.preserveParens){var _=this.startNodeAt(r,i);return _.expression=n,this.finishNode(_,`ParenthesizedExpression`)}return n},L.parseParenItem=function(e){return e},L.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var ke=[];L.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===x.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name=`new`,e.meta=this.finishNode(t,`Identifier`),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.allowNewDotTarget||this.raiseRecoverable(e.start,`'new.target' can only be used in functions and class static block`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),this.eat(x.parenL)?e.arguments=this.parseExprList(x.parenR,this.options.ecmaVersion>=8,!1):e.arguments=ke,this.finishNode(e,`NewExpression`)},L.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===x.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
56
+ `),n=n.replace(/\\r/g,`\r`)),t[e]=n}return t}function m(e){e||={};let t=b(e);e.path=t;let n=T.configDotenv(e);if(!n.parsed){let e=Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw e.code=`MISSING_DATA`,e}let r=v(e).split(`,`),i=r.length,a;for(let e=0;e<i;e++)try{let t=y(n,r[e].trim());a=T.decrypt(t.ciphertext,t.key);break}catch(t){if(e+1>=i)throw t}return T.parse(a)}function h(e){console.error(`[dotenv@${o}][WARN] ${e}`)}function g(e){console.log(`[dotenv@${o}][DEBUG] ${e}`)}function _(e){console.log(`[dotenv@${o}] ${e}`)}function v(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:``}function y(e,t){let n;try{n=new URL(t)}catch(e){if(e.code===`ERR_INVALID_URL`){let e=Error(`INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development`);throw e.code=`INVALID_DOTENV_KEY`,e}throw e}let r=n.password;if(!r){let e=Error(`INVALID_DOTENV_KEY: Missing key part`);throw e.code=`INVALID_DOTENV_KEY`,e}let i=n.searchParams.get(`environment`);if(!i){let e=Error(`INVALID_DOTENV_KEY: Missing environment part`);throw e.code=`INVALID_DOTENV_KEY`,e}let a=`DOTENV_VAULT_${i.toUpperCase()}`,o=e.parsed[a];if(!o){let e=Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${a} in your .env.vault file.`);throw e.code=`NOT_FOUND_DOTENV_ENVIRONMENT`,e}return{ciphertext:o,key:r}}function b(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)n.existsSync(r)&&(t=r.endsWith(`.vault`)?r:`${r}.vault`);else t=e.path.endsWith(`.vault`)?e.path:`${e.path}.vault`;else t=r.resolve(process.cwd(),`.env.vault`);return n.existsSync(t)?t:null}function x(e){return e[0]===`~`?r.join(i.homedir(),e.slice(1)):e}function S(e){let t=l(process.env.DOTENV_CONFIG_DEBUG||e&&e.debug),n=l(process.env.DOTENV_CONFIG_QUIET||e&&e.quiet);(t||!n)&&_(`Loading env from encrypted .env.vault`);let r=T._parseVault(e),i=process.env;return e&&e.processEnv!=null&&(i=e.processEnv),T.populate(i,r,e),{parsed:r}}function C(e){let t=r.resolve(process.cwd(),`.env`),i=`utf8`,a=process.env;e&&e.processEnv!=null&&(a=e.processEnv);let o=l(a.DOTENV_CONFIG_DEBUG||e&&e.debug),s=l(a.DOTENV_CONFIG_QUIET||e&&e.quiet);e&&e.encoding?i=e.encoding:o&&g(`No encoding is specified. UTF-8 is used by default`);let u=[t];if(e&&e.path)if(!Array.isArray(e.path))u=[x(e.path)];else{u=[];for(let t of e.path)u.push(x(t))}let f,p={};for(let t of u)try{let r=T.parse(n.readFileSync(t,{encoding:i}));T.populate(p,r,e)}catch(e){o&&g(`Failed to load ${t} ${e.message}`),f=e}let m=T.populate(a,p,e);if(o=l(a.DOTENV_CONFIG_DEBUG||o),s=l(a.DOTENV_CONFIG_QUIET||s),o||!s){let e=Object.keys(m).length,t=[];for(let e of u)try{let n=r.relative(process.cwd(),e);t.push(n)}catch(t){o&&g(`Failed to load ${e} ${t.message}`),f=t}_(`injecting env (${e}) from ${t.join(`,`)} ${d(`-- tip: ${c()}`)}`)}return f?{parsed:p,error:f}:{parsed:p}}function w(e){if(v(e).length===0)return T.configDotenv(e);let t=b(e);return t?T._configVault(e):(h(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`),T.configDotenv(e))}function ee(e,t){let n=Buffer.from(t.slice(-64),`hex`),r=Buffer.from(e,`base64`),i=r.subarray(0,12),o=r.subarray(-16);r=r.subarray(12,-16);try{let e=a.createDecipheriv(`aes-256-gcm`,n,i);return e.setAuthTag(o),`${e.update(r)}${e.final()}`}catch(e){let t=e instanceof RangeError,n=e.message===`Invalid key length`,r=e.message===`Unsupported state or unable to authenticate data`;if(t||n){let e=Error(`INVALID_DOTENV_KEY: It must be 64 characters long (or more)`);throw e.code=`INVALID_DOTENV_KEY`,e}else if(r){let e=Error(`DECRYPTION_FAILED: Please check your DOTENV_KEY`);throw e.code=`DECRYPTION_FAILED`,e}else throw e}}function te(e,t,n={}){let r=!!(n&&n.debug),i=!!(n&&n.override),a={};if(typeof t!=`object`){let e=Error(`OBJECT_REQUIRED: Please check the processEnv argument being passed to populate`);throw e.code=`OBJECT_REQUIRED`,e}for(let n of Object.keys(t))Object.prototype.hasOwnProperty.call(e,n)?(i===!0&&(e[n]=t[n],a[n]=t[n]),r&&g(i===!0?`"${n}" is already defined and WAS overwritten`:`"${n}" is already defined and was NOT overwritten`)):(e[n]=t[n],a[n]=t[n]);return a}let T={configDotenv:C,_configVault:S,_parseVault:m,config:w,decrypt:ee,parse:p,populate:te};t.exports.configDotenv=T.configDotenv,t.exports._configVault=T._configVault,t.exports._parseVault=T._parseVault,t.exports.config=T.config,t.exports.decrypt=T.decrypt,t.exports.parse=T.parse,t.exports.populate=T.populate,t.exports=T}))(),1);const hn=`_http_agent._http_client._http_common._http_incoming._http_outgoing._http_server._stream_duplex._stream_passthrough._stream_readable._stream_transform._stream_wrap._stream_writable._tls_common._tls_wrap.assert.assert/strict.async_hooks.buffer.child_process.cluster.console.constants.crypto.dgram.diagnostics_channel.dns.dns/promises.domain.events.fs.fs/promises.http.http2.https.inspector.inspector/promises.module.net.os.path.path/posix.path/win32.perf_hooks.process.punycode.querystring.readline.readline/promises.repl.stream.stream/consumers.stream/promises.stream/web.string_decoder.sys.timers.timers/promises.tls.trace_events.tty.url.util.util/types.v8.vm.wasi.worker_threads.zlib`.split(`.`),gn={}.hasOwnProperty,_n=/^([A-Z][a-z\d]*)+$/,vn=new Set([`string`,`function`,`number`,`object`,`Function`,`Object`,`boolean`,`bigint`,`symbol`]),yn=new Map;let bn;function xn(e,t=`and`){return e.length<3?e.join(` ${t} `):`${e.slice(0,-1).join(`, `)}, ${t} ${e.at(-1)}`}function Sn(e,t,n){return yn.set(e,t),Cn(n,e)}function Cn(e,t){return function(...n){let r=Error.stackTraceLimit;wn()&&(Error.stackTraceLimit=0);let i=new e;wn()&&(Error.stackTraceLimit=r);let a=Dn(t,n,i);return Object.defineProperties(i,{message:{value:a,enumerable:!1,writable:!0,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},enumerable:!1,writable:!0,configurable:!0}}),En(i),i.code=t,i}}function wn(){try{if(le.startupSnapshot.isBuildingSnapshot())return!1}catch{}let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):gn.call(e,`writable`)&&e.writable!==void 0?e.writable:e.set!==void 0}function Tn(e){let t=`__node_internal_`+e.name;return Object.defineProperty(e,`name`,{value:t}),e}const En=Tn(function(e){let t=wn();return t&&(bn=Error.stackTraceLimit,Error.stackTraceLimit=1/0),Error.captureStackTrace(e),t&&(Error.stackTraceLimit=bn),e});function Dn(e,t,n){let r=yn.get(e);if(O.ok(r!==void 0,"expected `message` to be found"),typeof r==`function`)return O.ok(r.length<=t.length,`Code: ${e}; The provided arguments length (${t.length}) does not match the required ones (${r.length}).`),Reflect.apply(r,n,t);let i=/%[dfijoOs]/g,a=0;for(;i.exec(r)!==null;)a++;return O.ok(a===t.length,`Code: ${e}; The provided arguments length (${t.length}) does not match the required ones (${a}).`),t.length===0?r:(t.unshift(r),Reflect.apply(u,null,t))}function On(e){if(e==null)return String(e);if(typeof e==`function`&&e.name)return`function ${e.name}`;if(typeof e==`object`)return e.constructor&&e.constructor.name?`an instance of ${e.constructor.name}`:`${d(e,{depth:-1})}`;let t=d(e,{colors:!1});return t.length>28&&(t=`${t.slice(0,25)}...`),`type ${typeof e} (${t})`}Sn(`ERR_INVALID_ARG_TYPE`,(e,t,n)=>{O.ok(typeof e==`string`,`'name' must be a string`),Array.isArray(t)||(t=[t]);let r=`The `;if(e.endsWith(` argument`))r+=`${e} `;else{let t=e.includes(`.`)?`property`:`argument`;r+=`"${e}" ${t} `}r+=`must be `;let i=[],a=[],o=[];for(let e of t)O.ok(typeof e==`string`,`All expected entries have to be of type string`),vn.has(e)?i.push(e.toLowerCase()):_n.exec(e)===null?(O.ok(e!==`object`,`The value "object" should be written as "Object"`),o.push(e)):a.push(e);if(a.length>0){let e=i.indexOf(`object`);e!==-1&&(i.slice(e,1),a.push(`Object`))}return i.length>0&&(r+=`${i.length>1?`one of type`:`of type`} ${xn(i,`or`)}`,(a.length>0||o.length>0)&&(r+=` or `)),a.length>0&&(r+=`an instance of ${xn(a,`or`)}`,o.length>0&&(r+=` or `)),o.length>0&&(o.length>1?r+=`one of ${xn(o,`or`)}`:(o[0]?.toLowerCase()!==o[0]&&(r+=`an `),r+=`${o[0]}`)),r+=`. Received ${On(n)}`,r},TypeError);const kn=Sn(`ERR_INVALID_MODULE_SPECIFIER`,(e,t,n)=>`Invalid module "${e}" ${t}${n?` imported from ${n}`:``}`,TypeError),An=Sn(`ERR_INVALID_PACKAGE_CONFIG`,(e,t,n)=>`Invalid package config ${e}${t?` while importing ${t}`:``}${n?`. ${n}`:``}`,Error),jn=Sn(`ERR_INVALID_PACKAGE_TARGET`,(e,t,n,r=!1,i)=>{let a=typeof n==`string`&&!r&&n.length>0&&!n.startsWith(`./`);return t===`.`?(O.ok(r===!1),`Invalid "exports" main target ${JSON.stringify(n)} defined in the package config ${e}package.json${i?` imported from ${i}`:``}${a?`; targets must start with "./"`:``}`):`Invalid "${r?`imports`:`exports`}" target ${JSON.stringify(n)} defined for '${t}' in the package config ${e}package.json${i?` imported from ${i}`:``}${a?`; targets must start with "./"`:``}`},Error),Mn=Sn(`ERR_MODULE_NOT_FOUND`,(e,t,n=!1)=>`Cannot find ${n?`module`:`package`} '${e}' imported from ${t}`,Error);Sn(`ERR_NETWORK_IMPORT_DISALLOWED`,`import of '%s' by %s is not supported: %s`,Error);const Nn=Sn(`ERR_PACKAGE_IMPORT_NOT_DEFINED`,(e,t,n)=>`Package import specifier "${e}" is not defined${t?` in package ${t||``}package.json`:``} imported from ${n}`,TypeError),Pn=Sn(`ERR_PACKAGE_PATH_NOT_EXPORTED`,(e,t,n)=>t===`.`?`No "exports" main defined in ${e}package.json${n?` imported from ${n}`:``}`:`Package subpath '${t}' is not defined by "exports" in ${e}package.json${n?` imported from ${n}`:``}`,Error),Fn=Sn(`ERR_UNSUPPORTED_DIR_IMPORT`,`Directory import '%s' is not supported resolving ES modules imported from %s`,Error),In=Sn(`ERR_UNSUPPORTED_RESOLVE_REQUEST`,`Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.`,TypeError),Ln=Sn(`ERR_UNKNOWN_FILE_EXTENSION`,(e,t)=>`Unknown file extension "${e}" for ${t}`,TypeError);Sn(`ERR_INVALID_ARG_VALUE`,(e,t,n=`is invalid`)=>{let r=d(t);return r.length>128&&(r=`${r.slice(0,128)}...`),`The ${e.includes(`.`)?`property`:`argument`} '${e}' ${n}. Received ${r}`},TypeError);const Rn={}.hasOwnProperty,zn=new Map;function Bn(e,{base:n,specifier:r}){let i=zn.get(e);if(i)return i;let a;try{a=v.readFileSync(t.toNamespacedPath(e),`utf8`)}catch(e){let t=e;if(t.code!==`ENOENT`)throw t}let o={exists:!1,pjsonPath:e,main:void 0,name:void 0,type:`none`,exports:void 0,imports:void 0};if(a!==void 0){let t;try{t=JSON.parse(a)}catch(t){let i=new An(e,(n?`"${r}" from `:``)+D(n||r),t.message);throw i.cause=t,i}o.exists=!0,Rn.call(t,`name`)&&typeof t.name==`string`&&(o.name=t.name),Rn.call(t,`main`)&&typeof t.main==`string`&&(o.main=t.main),Rn.call(t,`exports`)&&(o.exports=t.exports),Rn.call(t,`imports`)&&(o.imports=t.imports),Rn.call(t,`type`)&&(t.type===`commonjs`||t.type===`module`)&&(o.type=t.type)}return zn.set(e,o),o}function Vn(e){let t=new URL(`package.json`,e);for(;!t.pathname.endsWith(`node_modules/package.json`);){let n=Bn(D(t),{specifier:e});if(n.exists)return n;let r=t;if(t=new URL(`../package.json`,t),t.pathname===r.pathname)break}return{pjsonPath:D(t),exists:!1,type:`none`}}const Hn={}.hasOwnProperty,Un={__proto__:null,".json":`json`,".cjs":`commonjs`,".cts":`commonjs`,".js":`module`,".ts":`module`,".mts":`module`,".mjs":`module`},Wn={__proto__:null,"data:":Kn,"file:":Jn,"node:":()=>`builtin`};function Gn(e){return e&&/\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(e)?`module`:e===`application/json`?`json`:null}function Kn(e){let{1:t}=/^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(e.pathname)||[null,null,null];return Gn(t)}function qn(e){let t=e.pathname,n=t.length;for(;n--;){let e=t.codePointAt(n);if(e===47)return``;if(e===46)return t.codePointAt(n-1)===47?``:t.slice(n)}return``}function Jn(e,t,n){let r=qn(e);if(r===`.js`){let{type:t}=Vn(e);return t===`none`?`commonjs`:t}if(r===``){let{type:t}=Vn(e);return t===`none`||t===`commonjs`?`commonjs`:`module`}let i=Un[r];if(i)return i;if(!n)throw new Ln(r,D(e))}function Yn(e,t){let n=e.protocol;return Hn.call(Wn,n)&&Wn[n](e,t,!0)||null}const Xn=RegExp.prototype[Symbol.replace],Zn={}.hasOwnProperty,Qn=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i,$n=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i,er=/^\.|%|\\/,tr=/\*/g,nr=/%2f|%5c/i,rr=new Set,ir=/[/\\]{2}/;function ar(e,t,n,r,i,a,o){if(s.noDeprecation)return;let c=D(r),l=ir.exec(o?e:t)!==null;s.emitWarning(`Use of deprecated ${l?`double slash`:`leading or trailing slash matching`} resolving "${e}" for module request "${t}" ${t===n?``:`matched to "${n}" `}in the "${i?`imports`:`exports`}" field module resolution of the package at ${c}${a?` imported from ${D(a)}`:``}.`,`DeprecationWarning`,`DEP0166`)}function or(e,n,r,i){if(s.noDeprecation||Yn(e,{parentURL:r.href})!==`module`)return;let a=D(e.href),o=D(new E(`.`,n)),c=D(r);i?t.resolve(o,i)!==a&&s.emitWarning(`Package ${o} has a "main" field set to "${i}", excluding the full filename and extension to the resolved file at "${a.slice(o.length)}", imported from ${c}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`,`DeprecationWarning`,`DEP0151`):s.emitWarning(`No "main" or "exports" field defined in the package.json for ${o} resolving the main entry point "${a.slice(o.length)}", imported from ${c}.\nDefault "index" lookups for the main are deprecated for ES modules.`,`DeprecationWarning`,`DEP0151`)}function sr(e){try{return ne(e)}catch{}}function cr(e){let t=ne(e,{throwIfNoEntry:!1});return(t?t.isFile():void 0)??!1}function lr(e,t,n){let r;if(t.main!==void 0){if(r=new E(t.main,e),cr(r))return r;let i=[`./${t.main}.js`,`./${t.main}.json`,`./${t.main}.node`,`./${t.main}/index.js`,`./${t.main}/index.json`,`./${t.main}/index.node`],a=-1;for(;++a<i.length&&(r=new E(i[a],e),!cr(r));)r=void 0;if(r)return or(r,e,n,t.main),r}let i=[`./index.js`,`./index.json`,`./index.node`],a=-1;for(;++a<i.length&&(r=new E(i[a],e),!cr(r));)r=void 0;if(r)return or(r,e,n,t.main),r;throw new Mn(D(new E(`.`,e)),D(n))}function ur(e,n,r){if(nr.exec(e.pathname)!==null)throw new kn(e.pathname,String.raw`must not include encoded "/" or "\" characters`,D(n));let i;try{i=D(e)}catch(t){throw Object.defineProperty(t,`input`,{value:String(e)}),Object.defineProperty(t,`module`,{value:String(n)}),t}let a=sr(i.endsWith(`/`)?i.slice(-1):i);if(a&&a.isDirectory()){let t=new Fn(i,D(n));throw t.url=String(e),t}if(!a||!a.isFile()){let t=new Mn(i||e.pathname,n&&D(n),!0);throw t.url=String(e),t}if(!r){let n=T(i),{search:r,hash:a}=e;e=ce(n+(i.endsWith(t.sep)?`/`:``)),e.search=r,e.hash=a}return e}function dr(e,t,n){return new Nn(e,t&&D(new E(`.`,t)),D(n))}function fr(e,t,n){return new Pn(D(new E(`.`,t)),e,n&&D(n))}function pr(e,t,n,r,i){throw new kn(e,`request is not a valid match in pattern "${t}" for the "${r?`imports`:`exports`}" resolution of ${D(n)}`,i&&D(i))}function mr(e,t,n,r,i){return t=typeof t==`object`&&t?JSON.stringify(t,null,``):`${t}`,new jn(D(new E(`.`,n)),e,t,r,i&&D(i))}function hr(e,t,n,r,i,a,o,s,c){if(t!==``&&!a&&e.at(-1)!==`/`)throw mr(n,e,r,o,i);if(!e.startsWith(`./`)){if(o&&!e.startsWith(`../`)&&!e.startsWith(`/`)){let n=!1;try{new E(e),n=!0}catch{}if(!n)return wr(a?Xn.call(tr,e,()=>t):e+t,r,c)}throw mr(n,e,r,o,i)}if(Qn.exec(e.slice(2))!==null)if($n.exec(e.slice(2))===null){if(!s){let s=a?n.replace(`*`,()=>t):n+t;ar(a?Xn.call(tr,e,()=>t):e,s,n,r,o,i,!0)}}else throw mr(n,e,r,o,i);let l=new E(e,r),u=l.pathname,d=new E(`.`,r).pathname;if(!u.startsWith(d))throw mr(n,e,r,o,i);if(t===``)return l;if(Qn.exec(t)!==null){let c=a?n.replace(`*`,()=>t):n+t;$n.exec(t)===null?s||ar(a?Xn.call(tr,e,()=>t):e,c,n,r,o,i,!1):pr(c,n,r,o,i)}return a?new E(Xn.call(tr,l.href,()=>t)):new E(t,l)}function gr(e){let t=Number(e);return`${t}`===e?t>=0&&t<4294967295:!1}function _r(e,t,n,r,i,a,o,s,c){if(typeof t==`string`)return hr(t,n,r,e,i,a,o,s,c);if(Array.isArray(t)){let l=t;if(l.length===0)return null;let u,d=-1;for(;++d<l.length;){let t=l[d],f;try{f=_r(e,t,n,r,i,a,o,s,c)}catch(e){let t=e;if(u=t,t.code===`ERR_INVALID_PACKAGE_TARGET`)continue;throw e}if(f!==void 0){if(f===null){u=null;continue}return f}}if(u==null)return null;throw u}if(typeof t==`object`&&t){let l=Object.getOwnPropertyNames(t),u=-1;for(;++u<l.length;){let t=l[u];if(gr(t))throw new An(D(e),D(i),`"exports" cannot contain numeric property keys.`)}for(u=-1;++u<l.length;){let d=l[u];if(d===`default`||c&&c.has(d)){let l=t[d],u=_r(e,l,n,r,i,a,o,s,c);if(u===void 0)continue;return u}}return null}if(t===null)return null;throw mr(r,t,e,o,i)}function vr(e,t,n){if(typeof e==`string`||Array.isArray(e))return!0;if(typeof e!=`object`||!e)return!1;let r=Object.getOwnPropertyNames(e),i=!1,a=0,o=-1;for(;++o<r.length;){let e=r[o],s=e===``||e[0]!==`.`;if(a++===0)i=s;else if(i!==s)throw new An(D(t),D(n),`"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`)}return i}function yr(e,t,n){if(s.noDeprecation)return;let r=D(t);rr.has(r+`|`+e)||(rr.add(r+`|`+e),s.emitWarning(`Use of deprecated trailing slash pattern mapping "${e}" in the "exports" field module resolution of the package at ${r}${n?` imported from ${D(n)}`:``}. Mapping specifiers ending in "/" is no longer supported.`,`DeprecationWarning`,`DEP0155`))}function br(e,t,n,r,i){let a=n.exports;if(vr(a,e,r)&&(a={".":a}),Zn.call(a,t)&&!t.includes(`*`)&&!t.endsWith(`/`)){let n=a[t],o=_r(e,n,``,t,r,!1,!1,!1,i);if(o==null)throw fr(t,e,r);return o}let o=``,s=``,c=Object.getOwnPropertyNames(a),l=-1;for(;++l<c.length;){let n=c[l],i=n.indexOf(`*`);if(i!==-1&&t.startsWith(n.slice(0,i))){t.endsWith(`/`)&&yr(t,e,r);let a=n.slice(i+1);t.length>=n.length&&t.endsWith(a)&&xr(o,n)===1&&n.lastIndexOf(`*`)===i&&(o=n,s=t.slice(i,t.length-a.length))}}if(o){let n=a[o],c=_r(e,n,s,o,r,!0,!1,t.endsWith(`/`),i);if(c==null)throw fr(t,e,r);return c}throw fr(t,e,r)}function xr(e,t){let n=e.indexOf(`*`),r=t.indexOf(`*`),i=n===-1?e.length:n+1,a=r===-1?t.length:r+1;return i>a?-1:a>i||n===-1?1:r===-1||e.length>t.length?-1:t.length>e.length?1:0}function Sr(e,t,n){if(e===`#`||e.startsWith(`#/`)||e.endsWith(`/`))throw new kn(e,`is not a valid internal imports specifier name`,D(t));let r,i=Vn(t);if(i.exists){r=ce(i.pjsonPath);let a=i.imports;if(a)if(Zn.call(a,e)&&!e.includes(`*`)){let i=_r(r,a[e],``,e,t,!1,!0,!1,n);if(i!=null)return i}else{let i=``,o=``,s=Object.getOwnPropertyNames(a),c=-1;for(;++c<s.length;){let t=s[c],n=t.indexOf(`*`);if(n!==-1&&e.startsWith(t.slice(0,-1))){let r=t.slice(n+1);e.length>=t.length&&e.endsWith(r)&&xr(i,t)===1&&t.lastIndexOf(`*`)===n&&(i=t,o=e.slice(n,e.length-r.length))}}if(i){let e=a[i],s=_r(r,e,o,i,t,!0,!0,!1,n);if(s!=null)return s}}}throw dr(e,r,t)}function Cr(e,t){let n=e.indexOf(`/`),r=!0,i=!1;e[0]===`@`&&(i=!0,n===-1||e.length===0?r=!1:n=e.indexOf(`/`,n+1));let a=n===-1?e:e.slice(0,n);if(er.exec(a)!==null&&(r=!1),!r)throw new kn(e,`is not a valid package name`,D(t));return{packageName:a,packageSubpath:`.`+(n===-1?``:e.slice(n)),isScoped:i}}function wr(e,t,n){if(hn.includes(e))return new E(`node:`+e);let{packageName:r,packageSubpath:i,isScoped:a}=Cr(e,t),o=Vn(t);if(o.exists&&o.name===r&&o.exports!==void 0&&o.exports!==null)return br(ce(o.pjsonPath),i,o,t,n);let s=new E(`./node_modules/`+r+`/package.json`,t),c=D(s),l;do{let o=sr(c.slice(0,-13));if(!o||!o.isDirectory()){l=c,s=new E((a?`../../../../node_modules/`:`../../../node_modules/`)+r+`/package.json`,s),c=D(s);continue}let u=Bn(c,{base:t,specifier:e});return u.exports!==void 0&&u.exports!==null?br(s,i,u,t,n):i===`.`?lr(s,u,t):new E(i,s)}while(c.length!==l.length);throw new Mn(r,D(t),!1)}function Tr(e){return e[0]===`.`&&(e.length===1||e[1]===`/`||e[1]===`.`&&(e.length===2||e[2]===`/`))}function Er(e){return e===``?!1:e[0]===`/`?!0:Tr(e)}function U(e,t,n,r){let i=t.protocol,a=i===`data:`,o;if(Er(e))try{o=new E(e,t)}catch(n){let r=new In(e,t);throw r.cause=n,r}else if(i===`file:`&&e[0]===`#`)o=Sr(e,t,n);else try{o=new E(e)}catch(r){if(a&&!hn.includes(e)){let n=new In(e,t);throw n.cause=r,n}o=wr(e,t,n)}return O.ok(o!==void 0,`expected to be defined`),o.protocol===`file:`?ur(o,t,r):o}const Dr=new Set([`node`,`import`]),Or=(()=>process.platform===`win32`)(),kr=(()=>globalThis.__EXSOLVE_CACHE__||=new Map)();function Ar(e,t){let n=Br(e);if(`external`in n)return n.external;let r=n.specifier,i=n.url,a=n.absolutePath,o,s;if(t?.cache!==!1&&(o=Ir(a||r,t),s=t?.cache&&typeof t?.cache==`object`?t.cache:kr),s){let e=s.get(o);if(typeof e==`string`)return e;if(e instanceof Error){if(t?.try)return;throw e}}if(a)try{let e=S(a);if(e.isSymbolicLink()&&(a=T(a),i=ce(a)),e.isFile())return s&&s.set(o,i.href),i.href}catch(e){if(e?.code!==`ENOENT`)throw s&&s.set(o,e),e}let c=t?.conditions?new Set(t.conditions):Dr,l=r||i.href,u=Nr(t?.from),d=t?.suffixes||[``],f=t?.extensions?[``,...t.extensions]:[``],p;for(let e of u){for(let t of d){let n=Lr(l,t);n===`.`&&(n+=`/.`);for(let t of f)if(p=Mr(n+t,e,c),p)break;if(p)break}if(p)break}if(!p){let n=Error(`Cannot resolve module "${e}" (from: ${u.map(e=>Fr(e)).join(`, `)})`);if(n.code=`ERR_MODULE_NOT_FOUND`,s&&s.set(o,n),t?.try)return;throw n}return s&&s.set(o,p.href),p.href}function jr(e,t){let n=Ar(e,t);if(!n||!n.startsWith(`file://`)&&t?.try)return;let r=D(n);return Or?Rr(r):r}function Mr(e,t,n){try{return U(e,t,n)}catch{}}function Nr(e){let t=(Array.isArray(e)?e:[e]).flatMap(e=>Pr(e));return t.length===0?[ce(`./`)]:t}function Pr(e){if(!e)return[];if(zr(e))return[e];if(typeof e!=`string`)return[];if(/^(?:node|data|http|https|file):/.test(e))return new URL(e);try{return e.endsWith(`/`)||ne(e).isDirectory()?ce(e+`/`):ce(e)}catch{return[ce(e+`/`),ce(e)]}}function Fr(e){try{return D(e)}catch{return e}}function Ir(e,t){return JSON.stringify([e,(t?.conditions||[`node`,`import`]).sort(),t?.extensions,t?.from,t?.suffixes])}function Lr(e,t){return!e||!t||t===`/`?e:(e.endsWith(`/`)?e:e+`/`)+(t.startsWith(`/`)?t.slice(1):t)}function Rr(e){return e.replace(/\\/g,`/`).replace(/^[a-z]:\//,e=>e.toUpperCase())}function zr(e){return e instanceof URL||e?.constructor?.name===`URL`}function Br(e){if(typeof e==`string`){if(e.startsWith(`file:`)){let t=new URL(e);return{url:t,absolutePath:D(t)}}return i(e)?{url:ce(e),absolutePath:e}:/^(?:node|data|http|https):/.test(e)?{external:e}:hn.includes(e)&&!e.includes(`:`)?{external:`node:${e}`}:{specifier:e}}if(zr(e))return e.protocol===`file:`?{url:e,absolutePath:D(e)}:{external:e.href};throw TypeError("id must be a `string` or `URL`")}var Vr=ve(A(((e,t)=>{(()=>{var e={"./node_modules/.pnpm/mlly@1.8.0/node_modules/mlly/dist lazy recursive":function(e){function t(e){return Promise.resolve().then(function(){var t=Error(`Cannot find module '`+e+`'`);throw t.code=`MODULE_NOT_FOUND`,t})}t.keys=()=>[],t.resolve=t,t.id=`./node_modules/.pnpm/mlly@1.8.0/node_modules/mlly/dist lazy recursive`,e.exports=t}},n={};function r(t){var i=n[t];if(i!==void 0)return i.exports;var a=n[t]={exports:{}};return e[t](a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var i={};(()=>{r.d(i,{default:()=>ti});let e=j(`node:os`);var t=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],n=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],a=`ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ`,o={3:`abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile`,5:`class enum extends super const export import`,6:`enum`,strict:`implements interface let package private protected public static yield`,strictBind:`eval arguments`},s=`break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this`,c={5:s,"5module":s+` export import`,6:s+` const class extends export import super`},l=/^in(stanceof)?$/,u=RegExp(`[`+a+`]`),d=RegExp(`[`+a+`‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・]`);function f(e,t){for(var n=65536,r=0;r<t.length;r+=2){if((n+=t[r])>e)return!1;if((n+=t[r+1])>=e)return!0}return!1}function p(e,t){return e<65?e===36:e<91||(e<97?e===95:e<123||(e<=65535?e>=170&&u.test(String.fromCharCode(e)):!1!==t&&f(e,n)))}function m(e,r){return e<48?e===36:e<58||!(e<65)&&(e<91||(e<97?e===95:e<123||(e<=65535?e>=170&&d.test(String.fromCharCode(e)):!1!==r&&(f(e,n)||f(e,t)))))}var h=function(e,t){t===void 0&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function g(e,t){return new h(e,{beforeExpr:!0,binop:t})}var _={beforeExpr:!0},v={startsExpr:!0},y={};function b(e,t){return t===void 0&&(t={}),t.keyword=e,y[e]=new h(e,t)}var x={num:new h(`num`,v),regexp:new h(`regexp`,v),string:new h(`string`,v),name:new h(`name`,v),privateId:new h(`privateId`,v),eof:new h(`eof`),bracketL:new h(`[`,{beforeExpr:!0,startsExpr:!0}),bracketR:new h(`]`),braceL:new h(`{`,{beforeExpr:!0,startsExpr:!0}),braceR:new h(`}`),parenL:new h(`(`,{beforeExpr:!0,startsExpr:!0}),parenR:new h(`)`),comma:new h(`,`,_),semi:new h(`;`,_),colon:new h(`:`,_),dot:new h(`.`),question:new h(`?`,_),questionDot:new h(`?.`),arrow:new h(`=>`,_),template:new h(`template`),invalidTemplate:new h(`invalidTemplate`),ellipsis:new h(`...`,_),backQuote:new h("`",v),dollarBraceL:new h("${",{beforeExpr:!0,startsExpr:!0}),eq:new h(`=`,{beforeExpr:!0,isAssign:!0}),assign:new h(`_=`,{beforeExpr:!0,isAssign:!0}),incDec:new h(`++/--`,{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new h(`!/~`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:g(`||`,1),logicalAND:g(`&&`,2),bitwiseOR:g(`|`,3),bitwiseXOR:g(`^`,4),bitwiseAND:g(`&`,5),equality:g(`==/!=/===/!==`,6),relational:g(`</>/<=/>=`,7),bitShift:g(`<</>>/>>>`,8),plusMin:new h(`+/-`,{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:g(`%`,10),star:g(`*`,10),slash:g(`/`,10),starstar:new h(`**`,{beforeExpr:!0}),coalesce:g(`??`,1),_break:b(`break`),_case:b(`case`,_),_catch:b(`catch`),_continue:b(`continue`),_debugger:b(`debugger`),_default:b(`default`,_),_do:b(`do`,{isLoop:!0,beforeExpr:!0}),_else:b(`else`,_),_finally:b(`finally`),_for:b(`for`,{isLoop:!0}),_function:b(`function`,v),_if:b(`if`),_return:b(`return`,_),_switch:b(`switch`),_throw:b(`throw`,_),_try:b(`try`),_var:b(`var`),_const:b(`const`),_while:b(`while`,{isLoop:!0}),_with:b(`with`),_new:b(`new`,{beforeExpr:!0,startsExpr:!0}),_this:b(`this`,v),_super:b(`super`,v),_class:b(`class`,v),_extends:b(`extends`,_),_export:b(`export`),_import:b(`import`,v),_null:b(`null`,v),_true:b(`true`,v),_false:b(`false`,v),_in:b(`in`,{beforeExpr:!0,binop:7}),_instanceof:b(`instanceof`,{beforeExpr:!0,binop:7}),_typeof:b(`typeof`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:b(`void`,{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:b(`delete`,{beforeExpr:!0,prefix:!0,startsExpr:!0})},S=/\r\n?|\n|\u2028|\u2029/,C=new RegExp(S.source,`g`);function w(e){return e===10||e===13||e===8232||e===8233}function ee(e,t,n){n===void 0&&(n=e.length);for(var r=t;r<n;r++){var i=e.charCodeAt(r);if(w(i))return r<n-1&&i===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var te=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,T=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ne=Object.prototype,re=ne.hasOwnProperty,ie=ne.toString,ae=Object.hasOwn||function(e,t){return re.call(e,t)},oe=Array.isArray||function(e){return ie.call(e)===`[object Array]`},se=Object.create(null);function E(e){return se[e]||(se[e]=RegExp(`^(?:`+e.replace(/ /g,`|`)+`)$`))}function D(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var ce=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,O=function(e,t){this.line=e,this.column=t};O.prototype.offset=function(e){return new O(this.line,this.column+e)};var le=function(e,t,n){this.start=t,this.end=n,e.sourceFile!==null&&(this.source=e.sourceFile)};function ue(e,t){for(var n=1,r=0;;){var i=ee(e,r,t);if(i<0)return new O(n,t-r);++n,r=i}}var k={ecmaVersion:null,sourceType:`script`,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},de=!1;function fe(e){var t={};for(var n in k)t[n]=e&&ae(e,n)?e[n]:k[n];if(t.ecmaVersion===`latest`?t.ecmaVersion=1e8:t.ecmaVersion==null?(!de&&typeof console==`object`&&console.warn&&(de=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
57
+ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,e&&e.allowHashBang!=null||(t.allowHashBang=t.ecmaVersion>=14),oe(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return oe(t.onComment)&&(t.onComment=function(e,t){return function(n,r,i,a,o,s){var c={type:n?`Block`:`Line`,value:r,start:i,end:a};e.locations&&(c.loc=new le(this,o,s)),e.ranges&&(c.range=[i,a]),t.push(c)}}(t,t.onComment)),t}var pe=256,me=259;function he(e,t){return 2|(e?4:0)|(t?8:0)}var ge=function(e,t,n){this.options=e=fe(e),this.sourceFile=e.sourceFile,this.keywords=E(c[e.ecmaVersion>=6?6:e.sourceType===`module`?`5module`:5]);var r=``;!0!==e.allowReserved&&(r=o[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType===`module`&&(r+=` await`)),this.reservedWords=E(r);var i=(r?r+` `:``)+o.strict;this.reservedWordsStrict=E(i),this.reservedWordsStrictBind=E(i+` `+o.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf(`
58
+ `,n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(S).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=x.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=e.sourceType===`module`,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&e.allowHashBang&&this.input.slice(0,2)===`#!`&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(1),this.regexpState=null,this.privateNameStack=[]},A={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};ge.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},A.inFunction.get=function(){return(2&this.currentVarScope().flags)>0},A.inGenerator.get=function(){return(8&this.currentVarScope().flags)>0},A.inAsync.get=function(){return(4&this.currentVarScope().flags)>0},A.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(768&t)return!1;if(2&t)return(4&t)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},A.allowSuper.get=function(){return(64&this.currentThisScope().flags)>0||this.options.allowSuperOutsideMethod},A.allowDirectSuper.get=function(){return(128&this.currentThisScope().flags)>0},A.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},A.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(768&t||2&t&&!(16&t))return!0}return!1},A.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&pe)>0},ge.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},ge.parse=function(e,t){return new this(t,e).parse()},ge.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},ge.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(ge.prototype,A);var _e=ge.prototype,ve=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;_e.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){T.lastIndex=e,e+=T.exec(this.input)[0].length;var t=ve.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])===`use strict`){T.lastIndex=e+t[0].length;var n=T.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return i===`;`||i===`}`||S.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||i===`!`&&this.input.charAt(r+1)===`=`)}e+=t[0].length,T.lastIndex=e,e+=T.exec(this.input)[0].length,this.input[e]===`;`&&e++}},_e.eat=function(e){return this.type===e&&(this.next(),!0)},_e.isContextual=function(e){return this.type===x.name&&this.value===e&&!this.containsEsc},_e.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},_e.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},_e.canInsertSemicolon=function(){return this.type===x.eof||this.type===x.braceR||S.test(this.input.slice(this.lastTokEnd,this.start))},_e.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},_e.semicolon=function(){this.eat(x.semi)||this.insertSemicolon()||this.unexpected()},_e.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},_e.expect=function(e){this.eat(e)||this.unexpected()},_e.unexpected=function(e){this.raise(e??this.start,`Unexpected token`)};var ye=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};_e.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,`Comma is not permitted after the rest element`);var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,t?`Assigning to rvalue`:`Parenthesized pattern`)}},_e.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,`Shorthand property assignments are valid only in destructuring patterns`),r>=0&&this.raiseRecoverable(r,`Redefinition of __proto__ property`)},_e.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,`Yield expression cannot be a default value`),this.awaitPos&&this.raise(this.awaitPos,`Await expression cannot be a default value`)},_e.isSimpleAssignTarget=function(e){return e.type===`ParenthesizedExpression`?this.isSimpleAssignTarget(e.expression):e.type===`Identifier`||e.type===`MemberExpression`};var M=ge.prototype;M.parseTopLevel=function(e){var t=Object.create(null);for(e.body||=[];this.type!==x.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,`Export '`+a+`' is not defined`)}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,`Program`)};var be={kind:`loop`},xe={kind:`switch`};M.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual(`let`))return!1;T.lastIndex=this.pos;var t=T.exec(this.input),n=this.pos+t[0].length,r=this.input.charCodeAt(n);if(r===91||r===92)return!0;if(e)return!1;if(r===123||r>55295&&r<56320)return!0;if(p(r,!0)){for(var i=n+1;m(r=this.input.charCodeAt(i),!0);)++i;if(r===92||r>55295&&r<56320)return!0;var a=this.input.slice(n,i);if(!l.test(a))return!0}return!1},M.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual(`async`))return!1;T.lastIndex=this.pos;var e,t=T.exec(this.input),n=this.pos+t[0].length;return!(S.test(this.input.slice(this.pos,n))||this.input.slice(n,n+8)!==`function`||n+8!==this.input.length&&(m(e=this.input.charCodeAt(n+8))||e>55295&&e<56320))},M.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?`await`:`using`))return!1;T.lastIndex=this.pos;var n=T.exec(this.input),r=this.pos+n[0].length;if(S.test(this.input.slice(this.pos,r)))return!1;if(e){var i,a=r+5;if(this.input.slice(r,a)!==`using`||a===this.input.length||m(i=this.input.charCodeAt(a))||i>55295&&i<56320)return!1;T.lastIndex=a;var o=T.exec(this.input);if(o&&S.test(this.input.slice(a,a+o[0].length)))return!1}if(t){var s,c=r+2;if(!(this.input.slice(r,c)!==`of`||c!==this.input.length&&(m(s=this.input.charCodeAt(c))||s>55295&&s<56320)))return!1}var l=this.input.charCodeAt(r);return p(l,!0)||l===92},M.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},M.isUsing=function(e){return this.isUsingKeyword(!1,e)},M.parseStatement=function(e,t,n){var r,i=this.type,a=this.startNode();switch(this.isLet(e)&&(i=x._var,r=`let`),i){case x._break:case x._continue:return this.parseBreakContinueStatement(a,i.keyword);case x._debugger:return this.parseDebuggerStatement(a);case x._do:return this.parseDoStatement(a);case x._for:return this.parseForStatement(a);case x._function:return e&&(this.strict||e!==`if`&&e!==`label`)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(a,!1,!e);case x._class:return e&&this.unexpected(),this.parseClass(a,!0);case x._if:return this.parseIfStatement(a);case x._return:return this.parseReturnStatement(a);case x._switch:return this.parseSwitchStatement(a);case x._throw:return this.parseThrowStatement(a);case x._try:return this.parseTryStatement(a);case x._const:case x._var:return r||=this.value,e&&r!==`var`&&this.unexpected(),this.parseVarStatement(a,r);case x._while:return this.parseWhileStatement(a);case x._with:return this.parseWithStatement(a);case x.braceL:return this.parseBlock(!0,a);case x.semi:return this.parseEmptyStatement(a);case x._export:case x._import:if(this.options.ecmaVersion>10&&i===x._import){T.lastIndex=this.pos;var o=T.exec(this.input),s=this.pos+o[0].length,c=this.input.charCodeAt(s);if(c===40||c===46)return this.parseExpressionStatement(a,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,`'import' and 'export' may only appear at the top level`),this.inModule||this.raise(this.start,`'import' and 'export' may appear only with 'sourceType: module'`)),i===x._import?this.parseImport(a):this.parseExport(a,n);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(a,!0,!e);var l=this.isAwaitUsing(!1)?`await using`:this.isUsing(!1)?`using`:null;if(l)return t&&this.options.sourceType===`script`&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),l===`await using`&&(this.canAwait||this.raise(this.start,`Await using cannot appear outside of async function`),this.next()),this.next(),this.parseVar(a,!1,l),this.semicolon(),this.finishNode(a,`VariableDeclaration`);var u=this.value,d=this.parseExpression();return i===x.name&&d.type===`Identifier`&&this.eat(x.colon)?this.parseLabeledStatement(a,u,d,e):this.parseExpressionStatement(a,d)}},M.parseBreakContinueStatement=function(e,t){var n=t===`break`;this.next(),this.eat(x.semi)||this.insertSemicolon()?e.label=null:this.type===x.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var r=0;r<this.labels.length;++r){var i=this.labels[r];if((e.label==null||i.name===e.label.name)&&(i.kind!=null&&(n||i.kind===`loop`)||e.label&&n))break}return r===this.labels.length&&this.raise(e.start,`Unsyntactic `+t),this.finishNode(e,n?`BreakStatement`:`ContinueStatement`)},M.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,`DebuggerStatement`)},M.parseDoStatement=function(e){return this.next(),this.labels.push(be),e.body=this.parseStatement(`do`),this.labels.pop(),this.expect(x._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(x.semi):this.semicolon(),this.finishNode(e,`DoWhileStatement`)},M.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual(`await`)?this.lastTokStart:-1;if(this.labels.push(be),this.enterScope(0),this.expect(x.parenL),this.type===x.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var n=this.isLet();if(this.type===x._var||this.type===x._const||n){var r=this.startNode(),i=n?`let`:this.value;return this.next(),this.parseVar(r,!0,i),this.finishNode(r,`VariableDeclaration`),this.parseForAfterInit(e,r,t)}var a=this.isContextual(`let`),o=!1,s=this.isUsing(!0)?`using`:this.isAwaitUsing(!0)?`await using`:null;if(s){var c=this.startNode();return this.next(),s===`await using`&&this.next(),this.parseVar(c,!0,s),this.finishNode(c,`VariableDeclaration`),this.parseForAfterInit(e,c,t)}var l=this.containsEsc,u=new ye,d=this.start,f=t>-1?this.parseExprSubscripts(u,`await`):this.parseExpression(!0,u);return this.type===x._in||(o=this.options.ecmaVersion>=6&&this.isContextual(`of`))?(t>-1?(this.type===x._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(f.start!==d||l||f.type!==`Identifier`||f.name!==`async`?this.options.ecmaVersion>=9&&(e.await=!1):this.unexpected()),a&&o&&this.raise(f.start,`The left-hand side of a for-of loop may not start with 'let'.`),this.toAssignable(f,!1,u),this.checkLValPattern(f),this.parseForIn(e,f)):(this.checkExpressionErrors(u,!0),t>-1&&this.unexpected(t),this.parseFor(e,f))},M.parseForAfterInit=function(e,t,n){return(this.type===x._in||this.options.ecmaVersion>=6&&this.isContextual(`of`))&&t.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===x._in?n>-1&&this.unexpected(n):e.await=n>-1),this.parseForIn(e,t)):(n>-1&&this.unexpected(n),this.parseFor(e,t))},M.parseFunctionStatement=function(e,t,n){return this.next(),this.parseFunction(e,Se|(n?0:Ce),!1,t)},M.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(`if`),e.alternate=this.eat(x._else)?this.parseStatement(`if`):null,this.finishNode(e,`IfStatement`)},M.parseReturnStatement=function(e){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,`'return' outside of function`),this.next(),this.eat(x.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,`ReturnStatement`)},M.parseSwitchStatement=function(e){var t;this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(x.braceL),this.labels.push(xe),this.enterScope(0);for(var n=!1;this.type!==x.braceR;)if(this.type===x._case||this.type===x._default){var r=this.type===x._case;t&&this.finishNode(t,`SwitchCase`),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(n&&this.raiseRecoverable(this.lastTokStart,`Multiple default clauses`),n=!0,t.test=null),this.expect(x.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,`SwitchCase`),this.next(),this.labels.pop(),this.finishNode(e,`SwitchStatement`)},M.parseThrowStatement=function(e){return this.next(),S.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,`Illegal newline after throw`),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,`ThrowStatement`)};var N=[];M.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type===`Identifier`;return this.enterScope(t?32:0),this.checkLValPattern(e,t?4:2),this.expect(x.parenR),e},M.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===x._catch){var t=this.startNode();this.next(),this.eat(x.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,`CatchClause`)}return e.finalizer=this.eat(x._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,`Missing catch or finally clause`),this.finishNode(e,`TryStatement`)},M.parseVarStatement=function(e,t,n){return this.next(),this.parseVar(e,!1,t,n),this.semicolon(),this.finishNode(e,`VariableDeclaration`)},M.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(be),e.body=this.parseStatement(`while`),this.labels.pop(),this.finishNode(e,`WhileStatement`)},M.parseWithStatement=function(e){return this.strict&&this.raise(this.start,`'with' in strict mode`),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(`with`),this.finishNode(e,`WithStatement`)},M.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,`EmptyStatement`)},M.parseLabeledStatement=function(e,t,n,r){for(var i=0,a=this.labels;i<a.length;i+=1)a[i].name===t&&this.raise(n.start,`Label '`+t+`' is already declared`);for(var o=this.type.isLoop?`loop`:this.type===x._switch?`switch`:null,s=this.labels.length-1;s>=0;s--){var c=this.labels[s];if(c.statementStart!==e.start)break;c.statementStart=this.start,c.kind=o}return this.labels.push({name:t,kind:o,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf(`label`)===-1?r+`label`:r:`label`),this.labels.pop(),e.label=n,this.finishNode(e,`LabeledStatement`)},M.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,`ExpressionStatement`)},M.parseBlock=function(e,t,n){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(x.braceL),e&&this.enterScope(0);this.type!==x.braceR;){var r=this.parseStatement(null);t.body.push(r)}return n&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,`BlockStatement`)},M.parseFor=function(e,t){return e.init=t,this.expect(x.semi),e.test=this.type===x.semi?null:this.parseExpression(),this.expect(x.semi),e.update=this.type===x.parenR?null:this.parseExpression(),this.expect(x.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,`ForStatement`)},M.parseForIn=function(e,t){var n=this.type===x._in;return this.next(),t.type===`VariableDeclaration`&&t.declarations[0].init!=null&&(!n||this.options.ecmaVersion<8||this.strict||t.kind!==`var`||t.declarations[0].id.type!==`Identifier`)&&this.raise(t.start,(n?`for-in`:`for-of`)+` loop variable declaration may not have an initializer`),e.left=t,e.right=n?this.parseExpression():this.parseMaybeAssign(),this.expect(x.parenR),e.body=this.parseStatement(`for`),this.exitScope(),this.labels.pop(),this.finishNode(e,n?`ForInStatement`:`ForOfStatement`)},M.parseVar=function(e,t,n,r){for(e.declarations=[],e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),this.eat(x.eq)?i.init=this.parseMaybeAssign(t):r||n!==`const`||this.type===x._in||this.options.ecmaVersion>=6&&this.isContextual(`of`)?r||n!==`using`&&n!==`await using`||!(this.options.ecmaVersion>=17)||this.type===x._in||this.isContextual(`of`)?r||i.id.type===`Identifier`||t&&(this.type===x._in||this.isContextual(`of`))?i.init=null:this.raise(this.lastTokEnd,`Complex binding patterns require an initialization value`):this.raise(this.lastTokEnd,`Missing initializer in `+n+` declaration`):this.unexpected(),e.declarations.push(this.finishNode(i,`VariableDeclarator`)),!this.eat(x.comma))break}return e},M.parseVarId=function(e,t){e.id=t===`using`||t===`await using`?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t===`var`?1:2,!1)};var Se=1,Ce=2;function we(e,t){var n=t.key.name,r=e[n],i=`true`;return t.type!==`MethodDefinition`||t.kind!==`get`&&t.kind!==`set`||(i=(t.static?`s`:`i`)+t.kind),r===`iget`&&i===`iset`||r===`iset`&&i===`iget`||r===`sget`&&i===`sset`||r===`sset`&&i===`sget`?(e[n]=`true`,!1):!!r||(e[n]=i,!1)}function Te(e,t){var n=e.computed,r=e.key;return!n&&(r.type===`Identifier`&&r.name===t||r.type===`Literal`&&r.value===t)}M.parseFunction=function(e,t,n,r,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===x.star&&t&Ce&&this.unexpected(),e.generator=this.eat(x.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&Se&&(e.id=4&t&&this.type!==x.name?null:this.parseIdent(),!e.id||t&Ce||this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?1:2:3));var a=this.yieldPos,o=this.awaitPos,s=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(he(e.async,e.generator)),t&Se||(e.id=this.type===x.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,n,!1,i),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=s,this.finishNode(e,t&Se?`FunctionDeclaration`:`FunctionExpression`)},M.parseFunctionParams=function(e){this.expect(x.parenL),e.params=this.parseBindingList(x.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},M.parseClass=function(e,t){this.next();var n=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),i=this.startNode(),a=!1;for(i.body=[],this.expect(x.braceL);this.type!==x.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(i.body.push(o),o.type===`MethodDefinition`&&o.kind===`constructor`?(a&&this.raiseRecoverable(o.start,`Duplicate constructor in the same class`),a=!0):o.key&&o.key.type===`PrivateIdentifier`&&we(r,o)&&this.raiseRecoverable(o.key.start,`Identifier '#`+o.key.name+`' has already been declared`))}return this.strict=n,this.next(),e.body=this.finishNode(i,`ClassBody`),this.exitClassBody(),this.finishNode(e,t?`ClassDeclaration`:`ClassExpression`)},M.parseClassElement=function(e){if(this.eat(x.semi))return null;var t=this.options.ecmaVersion,n=this.startNode(),r=``,i=!1,a=!1,o=`method`,s=!1;if(this.eatContextual(`static`)){if(t>=13&&this.eat(x.braceL))return this.parseClassStaticBlock(n),n;this.isClassElementNameStart()||this.type===x.star?s=!0:r=`static`}if(n.static=s,!r&&t>=8&&this.eatContextual(`async`)&&(!this.isClassElementNameStart()&&this.type!==x.star||this.canInsertSemicolon()?r=`async`:a=!0),!r&&(t>=9||!a)&&this.eat(x.star)&&(i=!0),!r&&!a&&!i){var c=this.value;(this.eatContextual(`get`)||this.eatContextual(`set`))&&(this.isClassElementNameStart()?o=c:r=c)}if(r?(n.computed=!1,n.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),n.key.name=r,this.finishNode(n.key,`Identifier`)):this.parseClassElementName(n),t<13||this.type===x.parenL||o!==`method`||i||a){var l=!n.static&&Te(n,`constructor`),u=l&&e;l&&o!==`method`&&this.raise(n.key.start,`Constructor can't have get/set modifier`),n.kind=l?`constructor`:o,this.parseClassMethod(n,i,a,u)}else this.parseClassField(n);return n},M.isClassElementNameStart=function(){return this.type===x.name||this.type===x.privateId||this.type===x.num||this.type===x.string||this.type===x.bracketL||this.type.keyword},M.parseClassElementName=function(e){this.type===x.privateId?(this.value===`constructor`&&this.raise(this.start,`Classes can't have an element named '#constructor'`),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},M.parseClassMethod=function(e,t,n,r){var i=e.key;e.kind===`constructor`?(t&&this.raise(i.start,`Constructor can't be a generator`),n&&this.raise(i.start,`Constructor can't be an async method`)):e.static&&Te(e,`prototype`)&&this.raise(i.start,`Classes may not have a static property named prototype`);var a=e.value=this.parseMethod(t,n,r);return e.kind===`get`&&a.params.length!==0&&this.raiseRecoverable(a.start,`getter should have no params`),e.kind===`set`&&a.params.length!==1&&this.raiseRecoverable(a.start,`setter should have exactly one param`),e.kind===`set`&&a.params[0].type===`RestElement`&&this.raiseRecoverable(a.params[0].start,`Setter cannot use rest params`),this.finishNode(e,`MethodDefinition`)},M.parseClassField=function(e){return Te(e,`constructor`)?this.raise(e.key.start,`Classes can't have a field named 'constructor'`):e.static&&Te(e,`prototype`)&&this.raise(e.key.start,`Classes can't have a static field named 'prototype'`),this.eat(x.eq)?(this.enterScope(576),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,`PropertyDefinition`)},M.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(320);this.type!==x.braceR;){var n=this.parseStatement(null);e.body.push(n)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,`StaticBlock`)},M.parseClassId=function(e,t){this.type===x.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,2,!1)):(!0===t&&this.unexpected(),e.id=null)},M.parseClassSuper=function(e){e.superClass=this.eat(x._extends)?this.parseExprSubscripts(null,!1):null},M.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},M.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,n=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,i=r===0?null:this.privateNameStack[r-1],a=0;a<n.length;++a){var o=n[a];ae(t,o.name)||(i?i.used.push(o):this.raiseRecoverable(o.start,`Private field '#`+o.name+`' must be declared in an enclosing class`))}},M.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==x.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)},M.parseExport=function(e,t){if(this.next(),this.eat(x.star))return this.parseExportAllDeclaration(e,t);if(this.eat(x._default))return this.checkExport(t,`default`,this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,`ExportDefaultDeclaration`);if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`))this.type!==x.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var n=0,r=e.specifiers;n<r.length;n+=1){var i=r[n];this.checkUnreserved(i.local),this.checkLocalExport(i.local),i.local.type===`Literal`&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)},M.parseExportDeclaration=function(e){return this.parseStatement(null)},M.parseExportDefaultDeclaration=function(){var e;if(this.type===x._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,4|Se,!1,e)}if(this.type===x._class){var n=this.startNode();return this.parseClass(n,`nullableID`)}var r=this.parseMaybeAssign();return this.semicolon(),r},M.checkExport=function(e,t,n){e&&(typeof t!=`string`&&(t=t.type===`Identifier`?t.name:t.value),ae(e,t)&&this.raiseRecoverable(n,`Duplicate export '`+t+`'`),e[t]=!0)},M.checkPatternExport=function(e,t){var n=t.type;if(n===`Identifier`)this.checkExport(e,t,t.start);else if(n===`ObjectPattern`)for(var r=0,i=t.properties;r<i.length;r+=1){var a=i[r];this.checkPatternExport(e,a)}else if(n===`ArrayPattern`)for(var o=0,s=t.elements;o<s.length;o+=1){var c=s[o];c&&this.checkPatternExport(e,c)}else n===`Property`?this.checkPatternExport(e,t.value):n===`AssignmentPattern`?this.checkPatternExport(e,t.left):n===`RestElement`&&this.checkPatternExport(e,t.argument)},M.checkVariableExport=function(e,t){if(e)for(var n=0,r=t;n<r.length;n+=1){var i=r[n];this.checkPatternExport(e,i.id)}},M.shouldParseExportStatement=function(){return this.type.keyword===`var`||this.type.keyword===`const`||this.type.keyword===`class`||this.type.keyword===`function`||this.isLet()||this.isAsyncFunction()},M.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual(`as`)?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,`ExportSpecifier`)},M.parseExportSpecifiers=function(e){var t=[],n=!0;for(this.expect(x.braceL);!this.eat(x.braceR);){if(n)n=!1;else if(this.expect(x.comma),this.afterTrailingComma(x.braceR))break;t.push(this.parseExportSpecifier(e))}return t},M.parseImport=function(e){return this.next(),this.type===x.string?(e.specifiers=N,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===x.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,`ImportDeclaration`)},M.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual(`as`)?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,2),this.finishNode(e,`ImportSpecifier`)},M.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,2),this.finishNode(e,`ImportDefaultSpecifier`)},M.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual(`as`),e.local=this.parseIdent(),this.checkLValSimple(e.local,2),this.finishNode(e,`ImportNamespaceSpecifier`)},M.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===x.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(x.comma)))return e;if(this.type===x.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(x.braceL);!this.eat(x.braceR);){if(t)t=!1;else if(this.expect(x.comma),this.afterTrailingComma(x.braceR))break;e.push(this.parseImportSpecifier())}return e},M.parseWithClause=function(){var e=[];if(!this.eat(x._with))return e;this.expect(x.braceL);for(var t={},n=!0;!this.eat(x.braceR);){if(n)n=!1;else if(this.expect(x.comma),this.afterTrailingComma(x.braceR))break;var r=this.parseImportAttribute(),i=r.key.type===`Identifier`?r.key.name:r.key.value;ae(t,i)&&this.raiseRecoverable(r.key.start,`Duplicate attribute key '`+i+`'`),t[i]=!0,e.push(r)}return e},M.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===x.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`),this.expect(x.colon),this.type!==x.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,`ImportAttribute`)},M.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===x.string){var e=this.parseLiteral(this.value);return ce.test(e.value)&&this.raise(e.start,`An export name cannot include a lone surrogate.`),e}return this.parseIdent(!0)},M.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},M.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type===`ExpressionStatement`&&e.expression.type===`Literal`&&typeof e.expression.value==`string`&&(this.input[e.start]===`"`||this.input[e.start]===`'`)};var Ee=ge.prototype;Ee.toAssignable=function(e,t,n){if(this.options.ecmaVersion>=6&&e)switch(e.type){case`Identifier`:this.inAsync&&e.name===`await`&&this.raise(e.start,`Cannot use 'await' as identifier inside an async function`);break;case`ObjectPattern`:case`ArrayPattern`:case`AssignmentPattern`:case`RestElement`:break;case`ObjectExpression`:e.type=`ObjectPattern`,n&&this.checkPatternErrors(n,!0);for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.toAssignable(a,t),a.type!==`RestElement`||a.argument.type!==`ArrayPattern`&&a.argument.type!==`ObjectPattern`||this.raise(a.argument.start,`Unexpected token`)}break;case`Property`:e.kind!==`init`&&this.raise(e.key.start,`Object pattern can't contain getter or setter`),this.toAssignable(e.value,t);break;case`ArrayExpression`:e.type=`ArrayPattern`,n&&this.checkPatternErrors(n,!0),this.toAssignableList(e.elements,t);break;case`SpreadElement`:e.type=`RestElement`,this.toAssignable(e.argument,t),e.argument.type===`AssignmentPattern`&&this.raise(e.argument.start,`Rest elements cannot have a default value`);break;case`AssignmentExpression`:e.operator!==`=`&&this.raise(e.left.end,`Only '=' operator can be used for specifying default value.`),e.type=`AssignmentPattern`,delete e.operator,this.toAssignable(e.left,t);break;case`ParenthesizedExpression`:this.toAssignable(e.expression,t,n);break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:if(!t)break;default:this.raise(e.start,`Assigning to rvalue`)}else n&&this.checkPatternErrors(n,!0);return e},Ee.toAssignableList=function(e,t){for(var n=e.length,r=0;r<n;r++){var i=e[r];i&&this.toAssignable(i,t)}if(n){var a=e[n-1];this.options.ecmaVersion===6&&t&&a&&a.type===`RestElement`&&a.argument.type!==`Identifier`&&this.unexpected(a.argument.start)}return e},Ee.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,`SpreadElement`)},Ee.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==x.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,`RestElement`)},Ee.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case x.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(x.bracketR,!0,!0),this.finishNode(e,`ArrayPattern`);case x.braceL:return this.parseObj(!0)}return this.parseIdent()},Ee.parseBindingList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(x.comma),t&&this.type===x.comma)i.push(null);else{if(n&&this.afterTrailingComma(e))break;if(this.type===x.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),i.push(o),this.type===x.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.expect(e);break}i.push(this.parseAssignableListItem(r))}return i},Ee.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},Ee.parseBindingListItem=function(e){return e},Ee.parseMaybeDefault=function(e,t,n){if(n||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(x.eq))return n;var r=this.startNodeAt(e,t);return r.left=n,r.right=this.parseMaybeAssign(),this.finishNode(r,`AssignmentPattern`)},Ee.checkLValSimple=function(e,t,n){t===void 0&&(t=0);var r=t!==0;switch(e.type){case`Identifier`:this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?`Binding `:`Assigning to `)+e.name+` in strict mode`),r&&(t===2&&e.name===`let`&&this.raiseRecoverable(e.start,`let is disallowed as a lexically bound name`),n&&(ae(n,e.name)&&this.raiseRecoverable(e.start,`Argument name clash`),n[e.name]=!0),t!==5&&this.declareName(e.name,t,e.start));break;case`ChainExpression`:this.raiseRecoverable(e.start,`Optional chaining cannot appear in left-hand side`);break;case`MemberExpression`:r&&this.raiseRecoverable(e.start,`Binding member expression`);break;case`ParenthesizedExpression`:return r&&this.raiseRecoverable(e.start,`Binding parenthesized expression`),this.checkLValSimple(e.expression,t,n);default:this.raise(e.start,(r?`Binding`:`Assigning to`)+` rvalue`)}},Ee.checkLValPattern=function(e,t,n){switch(t===void 0&&(t=0),e.type){case`ObjectPattern`:for(var r=0,i=e.properties;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,t,n)}break;case`ArrayPattern`:for(var o=0,s=e.elements;o<s.length;o+=1){var c=s[o];c&&this.checkLValInnerPattern(c,t,n)}break;default:this.checkLValSimple(e,t,n)}},Ee.checkLValInnerPattern=function(e,t,n){switch(t===void 0&&(t=0),e.type){case`Property`:this.checkLValInnerPattern(e.value,t,n);break;case`AssignmentPattern`:this.checkLValPattern(e.left,t,n);break;case`RestElement`:this.checkLValPattern(e.argument,t,n);break;default:this.checkLValPattern(e,t,n)}};var De=function(e,t,n,r,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!n,this.override=r,this.generator=!!i},P={b_stat:new De(`{`,!1),b_expr:new De(`{`,!0),b_tmpl:new De("${",!1),p_stat:new De(`(`,!1),p_expr:new De(`(`,!0),q_tmpl:new De("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new De(`function`,!1),f_expr:new De(`function`,!0),f_expr_gen:new De(`function`,!0,!1,null,!0),f_gen:new De(`function`,!1,!1,null,!0)},Oe=ge.prototype;Oe.initialContext=function(){return[P.b_stat]},Oe.curContext=function(){return this.context[this.context.length-1]},Oe.braceIsBlock=function(e){var t=this.curContext();return t===P.f_expr||t===P.f_stat||(e!==x.colon||t!==P.b_stat&&t!==P.b_expr?e===x._return||e===x.name&&this.exprAllowed?S.test(this.input.slice(this.lastTokEnd,this.start)):e===x._else||e===x.semi||e===x.eof||e===x.parenR||e===x.arrow||(e===x.braceL?t===P.b_stat:e!==x._var&&e!==x._const&&e!==x.name&&!this.exprAllowed):!t.isExpr)},Oe.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token===`function`)return t.generator}return!1},Oe.updateContext=function(e){var t,n=this.type;n.keyword&&e===x.dot?this.exprAllowed=!1:(t=n.updateContext)?t.call(this,e):this.exprAllowed=n.beforeExpr},Oe.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},x.parenR.updateContext=x.braceR.updateContext=function(){if(this.context.length!==1){var e=this.context.pop();e===P.b_stat&&this.curContext().token===`function`&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},x.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?P.b_stat:P.b_expr),this.exprAllowed=!0},x.dollarBraceL.updateContext=function(){this.context.push(P.b_tmpl),this.exprAllowed=!0},x.parenL.updateContext=function(e){var t=e===x._if||e===x._for||e===x._with||e===x._while;this.context.push(t?P.p_stat:P.p_expr),this.exprAllowed=!0},x.incDec.updateContext=function(){},x._function.updateContext=x._class.updateContext=function(e){!e.beforeExpr||e===x._else||e===x.semi&&this.curContext()!==P.p_stat||e===x._return&&S.test(this.input.slice(this.lastTokEnd,this.start))||(e===x.colon||e===x.braceL)&&this.curContext()===P.b_stat?this.context.push(P.f_stat):this.context.push(P.f_expr),this.exprAllowed=!1},x.colon.updateContext=function(){this.curContext().token===`function`&&this.context.pop(),this.exprAllowed=!0},x.backQuote.updateContext=function(){this.curContext()===P.q_tmpl?this.context.pop():this.context.push(P.q_tmpl),this.exprAllowed=!1},x.star.updateContext=function(e){if(e===x._function){var t=this.context.length-1;this.context[t]===P.f_expr?this.context[t]=P.f_expr_gen:this.context[t]=P.f_gen}this.exprAllowed=!0},x.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==x.dot&&(this.value===`of`&&!this.exprAllowed||this.value===`yield`&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var F=ge.prototype;function ke(e){return e.type===`Identifier`||e.type===`ParenthesizedExpression`&&ke(e.expression)}function Ae(e){return e.type===`MemberExpression`&&e.property.type===`PrivateIdentifier`||e.type===`ChainExpression`&&Ae(e.expression)||e.type===`ParenthesizedExpression`&&Ae(e.expression)}F.checkPropClash=function(e,t,n){if(!(this.options.ecmaVersion>=9&&e.type===`SpreadElement`||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r,i=e.key;switch(i.type){case`Identifier`:r=i.name;break;case`Literal`:r=String(i.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6)r===`__proto__`&&a===`init`&&(t.proto&&(n?n.doubleProto<0&&(n.doubleProto=i.start):this.raiseRecoverable(i.start,`Redefinition of __proto__ property`)),t.proto=!0);else{var o=t[r=`$`+r];o?(a===`init`?this.strict&&o.init||o.get||o.set:o.init||o[a])&&this.raiseRecoverable(i.start,`Redefinition of property`):o=t[r]={init:!1,get:!1,set:!1},o[a]=!0}}},F.parseExpression=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeAssign(e,t);if(this.type===x.comma){var a=this.startNodeAt(n,r);for(a.expressions=[i];this.eat(x.comma);)a.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(a,`SequenceExpression`)}return i},F.parseMaybeAssign=function(e,t,n){if(this.isContextual(`yield`)){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,i=-1,a=-1,o=-1;t?(i=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new ye,r=!0);var s=this.start,c=this.startLoc;this.type!==x.parenL&&this.type!==x.name||(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e===`await`);var l=this.parseMaybeConditional(e,t);if(n&&(l=n.call(this,l,s,c)),this.type.isAssign){var u=this.startNodeAt(s,c);return u.operator=this.value,this.type===x.eq&&(l=this.toAssignable(l,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=l.start&&(t.shorthandAssign=-1),this.type===x.eq?this.checkLValPattern(l):this.checkLValSimple(l),u.left=l,this.next(),u.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(u,`AssignmentExpression`)}return r&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),a>-1&&(t.trailingComma=a),l},F.parseMaybeConditional=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(this.eat(x.question)){var a=this.startNodeAt(n,r);return a.test=i,a.consequent=this.parseMaybeAssign(),this.expect(x.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,`ConditionalExpression`)}return i},F.parseExprOps=function(e,t){var n=this.start,r=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===n&&i.type===`ArrowFunctionExpression`?i:this.parseExprOp(i,n,r,-1,e)},F.parseExprOp=function(e,t,n,r,i){var a=this.type.binop;if(a!=null&&(!i||this.type!==x._in)&&a>r){var o=this.type===x.logicalOR||this.type===x.logicalAND,s=this.type===x.coalesce;s&&(a=x.logicalAND.binop);var c=this.value;this.next();var l=this.start,u=this.startLoc,d=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),l,u,a,i),f=this.buildBinary(t,n,e,d,c,o||s);return(o&&this.type===x.coalesce||s&&(this.type===x.logicalOR||this.type===x.logicalAND))&&this.raiseRecoverable(this.start,`Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses`),this.parseExprOp(f,t,n,r,i)}return e},F.buildBinary=function(e,t,n,r,i,a){r.type===`PrivateIdentifier`&&this.raise(r.start,`Private identifier can only be left side of binary expression`);var o=this.startNodeAt(e,t);return o.left=n,o.operator=i,o.right=r,this.finishNode(o,a?`LogicalExpression`:`BinaryExpression`)},F.parseMaybeUnary=function(e,t,n,r){var i,a=this.start,o=this.startLoc;if(this.isContextual(`await`)&&this.canAwait)i=this.parseAwait(r),t=!0;else if(this.type.prefix){var s=this.startNode(),c=this.type===x.incDec;s.operator=this.value,s.prefix=!0,this.next(),s.argument=this.parseMaybeUnary(null,!0,c,r),this.checkExpressionErrors(e,!0),c?this.checkLValSimple(s.argument):this.strict&&s.operator===`delete`&&ke(s.argument)?this.raiseRecoverable(s.start,`Deleting local variable in strict mode`):s.operator===`delete`&&Ae(s.argument)?this.raiseRecoverable(s.start,`Private fields can not be deleted`):t=!0,i=this.finishNode(s,c?`UpdateExpression`:`UnaryExpression`)}else if(t||this.type!==x.privateId){if(i=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return i;for(;this.type.postfix&&!this.canInsertSemicolon();){var l=this.startNodeAt(a,o);l.operator=this.value,l.prefix=!1,l.argument=i,this.checkLValSimple(i),this.next(),i=this.finishNode(l,`UpdateExpression`)}}else (r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),i=this.parsePrivateIdent(),this.type!==x._in&&this.unexpected();return n||!this.eat(x.starstar)?i:t?void this.unexpected(this.lastTokStart):this.buildBinary(a,o,i,this.parseMaybeUnary(null,!1,!1,r),`**`,!1)},F.parseExprSubscripts=function(e,t){var n=this.start,r=this.startLoc,i=this.parseExprAtom(e,t);if(i.type===`ArrowFunctionExpression`&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==`)`)return i;var a=this.parseSubscripts(i,n,r,!1,t);return e&&a.type===`MemberExpression`&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a},F.parseSubscripts=function(e,t,n,r,i){for(var a=this.options.ecmaVersion>=8&&e.type===`Identifier`&&e.name===`async`&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=!1;;){var s=this.parseSubscript(e,t,n,r,a,o,i);if(s.optional&&(o=!0),s===e||s.type===`ArrowFunctionExpression`){if(o){var c=this.startNodeAt(t,n);c.expression=s,s=this.finishNode(c,`ChainExpression`)}return s}e=s}},F.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(x.arrow)},F.parseSubscriptAsyncArrow=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!0,r)},F.parseSubscript=function(e,t,n,r,i,a,o){var s=this.options.ecmaVersion>=11,c=s&&this.eat(x.questionDot);r&&c&&this.raise(this.lastTokStart,`Optional chaining cannot appear in the callee of new expressions`);var l=this.eat(x.bracketL);if(l||c&&this.type!==x.parenL&&this.type!==x.backQuote||this.eat(x.dot)){var u=this.startNodeAt(t,n);u.object=e,l?(u.property=this.parseExpression(),this.expect(x.bracketR)):this.type===x.privateId&&e.type!==`Super`?u.property=this.parsePrivateIdent():u.property=this.parseIdent(this.options.allowReserved!==`never`),u.computed=!!l,s&&(u.optional=c),e=this.finishNode(u,`MemberExpression`)}else if(!r&&this.eat(x.parenL)){var d=new ye,f=this.yieldPos,p=this.awaitPos,m=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var h=this.parseExprList(x.parenR,this.options.ecmaVersion>=8,!1,d);if(i&&!c&&this.shouldParseAsyncArrow())return this.checkPatternErrors(d,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,`Cannot use 'await' as identifier inside an async function`),this.yieldPos=f,this.awaitPos=p,this.awaitIdentPos=m,this.parseSubscriptAsyncArrow(t,n,h,o);this.checkExpressionErrors(d,!0),this.yieldPos=f||this.yieldPos,this.awaitPos=p||this.awaitPos,this.awaitIdentPos=m||this.awaitIdentPos;var g=this.startNodeAt(t,n);g.callee=e,g.arguments=h,s&&(g.optional=c),e=this.finishNode(g,`CallExpression`)}else if(this.type===x.backQuote){(c||a)&&this.raise(this.start,`Optional chaining cannot appear in the tag of tagged template expressions`);var _=this.startNodeAt(t,n);_.tag=e,_.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(_,`TaggedTemplateExpression`)}return e},F.parseExprAtom=function(e,t,n){this.type===x.slash&&this.readRegexp();var r,i=this.potentialArrowAt===this.start;switch(this.type){case x._super:return this.allowSuper||this.raise(this.start,`'super' keyword outside a method`),r=this.startNode(),this.next(),this.type!==x.parenL||this.allowDirectSuper||this.raise(r.start,`super() call outside constructor of a subclass`),this.type!==x.dot&&this.type!==x.bracketL&&this.type!==x.parenL&&this.unexpected(),this.finishNode(r,`Super`);case x._this:return r=this.startNode(),this.next(),this.finishNode(r,`ThisExpression`);case x.name:var a=this.start,o=this.startLoc,s=this.containsEsc,c=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!s&&c.name===`async`&&!this.canInsertSemicolon()&&this.eat(x._function))return this.overrideContext(P.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(x.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[c],!1,t);if(this.options.ecmaVersion>=8&&c.name===`async`&&this.type===x.name&&!s&&(!this.potentialArrowInForAwait||this.value!==`of`||this.containsEsc))return c=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat(x.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[c],!0,t)}return c;case x.regexp:var l=this.value;return(r=this.parseLiteral(l.value)).regex={pattern:l.pattern,flags:l.flags},r;case x.num:case x.string:return this.parseLiteral(this.value);case x._null:case x._true:case x._false:return(r=this.startNode()).value=this.type===x._null?null:this.type===x._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,`Literal`);case x.parenL:var u=this.start,d=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(d)&&(e.parenthesizedAssign=u),e.parenthesizedBind<0&&(e.parenthesizedBind=u)),d;case x.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(x.bracketR,!0,!0,e),this.finishNode(r,`ArrayExpression`);case x.braceL:return this.overrideContext(P.b_expr),this.parseObj(!1,e);case x._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case x._class:return this.parseClass(this.startNode(),!1);case x._new:return this.parseNew();case x.backQuote:return this.parseTemplate();case x._import:return this.options.ecmaVersion>=11?this.parseExprImport(n):this.unexpected();default:return this.parseExprAtomDefault()}},F.parseExprAtomDefault=function(){this.unexpected()},F.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword import`),this.next(),this.type===x.parenL&&!e)return this.parseDynamicImport(t);if(this.type===x.dot){var n=this.startNodeAt(t.start,t.loc&&t.loc.start);return n.name=`import`,t.meta=this.finishNode(n,`Identifier`),this.parseImportMeta(t)}this.unexpected()},F.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(x.parenR)?e.options=null:(this.expect(x.comma),this.afterTrailingComma(x.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(x.parenR)||(this.expect(x.comma),this.afterTrailingComma(x.parenR)||this.unexpected())));else if(!this.eat(x.parenR)){var t=this.start;this.eat(x.comma)&&this.eat(x.parenR)?this.raiseRecoverable(t,`Trailing comma is not allowed in import()`):this.unexpected(t)}return this.finishNode(e,`ImportExpression`)},F.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`meta`&&this.raiseRecoverable(e.property.start,`The only valid meta property for import is 'import.meta'`),t&&this.raiseRecoverable(e.start,`'import.meta' must not contain escaped characters`),this.options.sourceType===`module`||this.options.allowImportExportEverywhere||this.raiseRecoverable(e.start,`Cannot use 'import.meta' outside a module`),this.finishNode(e,`MetaProperty`)},F.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value==null?t.raw.slice(0,-1).replace(/_/g,``):t.value.toString()),this.next(),this.finishNode(t,`Literal`)},F.parseParenExpression=function(){this.expect(x.parenL);var e=this.parseExpression();return this.expect(x.parenR),e},F.shouldParseArrow=function(e){return!this.canInsertSemicolon()},F.parseParenAndDistinguishExpression=function(e,t){var n,r=this.start,i=this.startLoc,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o,s=this.start,c=this.startLoc,l=[],u=!0,d=!1,f=new ye,p=this.yieldPos,m=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==x.parenR;){if(u?u=!1:this.expect(x.comma),a&&this.afterTrailingComma(x.parenR,!0)){d=!0;break}if(this.type===x.ellipsis){o=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===x.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`);break}l.push(this.parseMaybeAssign(!1,f,this.parseParenItem))}var h=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(x.parenR),e&&this.shouldParseArrow(l)&&this.eat(x.arrow))return this.checkPatternErrors(f,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=p,this.awaitPos=m,this.parseParenArrowList(r,i,l,t);l.length&&!d||this.unexpected(this.lastTokStart),o&&this.unexpected(o),this.checkExpressionErrors(f,!0),this.yieldPos=p||this.yieldPos,this.awaitPos=m||this.awaitPos,l.length>1?((n=this.startNodeAt(s,c)).expressions=l,this.finishNodeAt(n,`SequenceExpression`,h,g)):n=l[0]}else n=this.parseParenExpression();if(this.options.preserveParens){var _=this.startNodeAt(r,i);return _.expression=n,this.finishNode(_,`ParenthesizedExpression`)}return n},F.parseParenItem=function(e){return e},F.parseParenArrowList=function(e,t,n,r){return this.parseArrowExpression(this.startNodeAt(e,t),n,!1,r)};var je=[];F.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword new`);var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===x.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name=`new`,e.meta=this.finishNode(t,`Identifier`),this.next();var n=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!==`target`&&this.raiseRecoverable(e.property.start,`The only valid meta property for new is 'new.target'`),n&&this.raiseRecoverable(e.start,`'new.target' must not contain escaped characters`),this.allowNewDotTarget||this.raiseRecoverable(e.start,`'new.target' can only be used in functions and class static block`),this.finishNode(e,`MetaProperty`)}var r=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,i,!0,!1),this.eat(x.parenL)?e.arguments=this.parseExprList(x.parenR,this.options.ecmaVersion>=8,!1):e.arguments=je,this.finishNode(e,`NewExpression`)},F.parseTemplateElement=function(e){var t=e.isTagged,n=this.startNode();return this.type===x.invalidTemplate?(t||this.raiseRecoverable(this.start,`Bad escape sequence in untagged template literal`),n.value={raw:this.value.replace(/\r\n?/g,`
59
59
  `),cooked:null}):n.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
60
- `),cooked:this.value},this.next(),n.tail=this.type===x.backQuote,this.finishNode(n,`TemplateElement`)},L.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.type===x.eof&&this.raise(this.pos,`Unterminated template literal`),this.expect(x.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(x.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,`TemplateLiteral`)},L.isAsyncProp=function(e){return!e.computed&&e.key.type===`Identifier`&&e.key.name===`async`&&(this.type===x.name||this.type===x.num||this.type===x.string||this.type===x.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===x.star)&&!S.test(this.input.slice(this.lastTokEnd,this.start))},L.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(x.braceR);){if(r)r=!1;else if(this.expect(x.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(x.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),n.properties.push(a)}return this.finishNode(n,e?`ObjectPattern`:`ObjectExpression`)},L.parseProperty=function(e,t){var n,r,i,a,o=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(x.ellipsis))return e?(o.argument=this.parseIdent(!1),this.type===x.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.finishNode(o,`RestElement`)):(o.argument=this.parseMaybeAssign(!1,t),this.type===x.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(o,`SpreadElement`));this.options.ecmaVersion>=6&&(o.method=!1,o.shorthand=!1,(e||t)&&(i=this.start,a=this.startLoc),e||(n=this.eat(x.star)));var s=this.containsEsc;return this.parsePropertyName(o),!e&&!s&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(o)?(r=!0,n=this.options.ecmaVersion>=9&&this.eat(x.star),this.parsePropertyName(o)):r=!1,this.parsePropertyValue(o,e,n,r,i,a,t,s),this.finishNode(o,`Property`)},L.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var n=e.kind===`get`?0:1;if(e.value.params.length!==n){var r=e.value.start;e.kind===`get`?this.raiseRecoverable(r,`getter should have no params`):this.raiseRecoverable(r,`setter should have exactly one param`)}else e.kind===`set`&&e.value.params[0].type===`RestElement`&&this.raiseRecoverable(e.value.params[0].start,`Setter cannot use rest params`)},L.parsePropertyValue=function(e,t,n,r,i,a,o,s){(n||r)&&this.type===x.colon&&this.unexpected(),this.eat(x.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind=`init`):this.options.ecmaVersion>=6&&this.type===x.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(n,r),e.kind=`init`):t||s||!(this.options.ecmaVersion>=5)||e.computed||e.key.type!==`Identifier`||e.key.name!==`get`&&e.key.name!==`set`||this.type===x.comma||this.type===x.braceR||this.type===x.eq?this.options.ecmaVersion>=6&&!e.computed&&e.key.type===`Identifier`?((n||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name!==`await`||this.awaitIdentPos||(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===x.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind=`init`,e.shorthand=!0):this.unexpected():((n||r)&&this.unexpected(),this.parseGetterSetter(e))},L.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(x.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(x.bracketR),e.key;e.computed=!1}return e.key=this.type===x.num||this.type===x.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`)},L.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},L.parseMethod=function(e,t,n){var r=this.startNode(),i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(64|me(t,r.generator)|(n?128:0)),this.expect(x.parenL),r.params=this.parseBindingList(x.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(r,`FunctionExpression`)},L.parseArrowExpression=function(e,t,n,r){var i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(16|me(n,!1)),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,`ArrowFunctionExpression`)},L.parseFunctionBody=function(e,t,n,r){var i=t&&this.type!==x.braceL,a=this.strict,o=!1;if(i)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);a&&!s||(o=this.strictDirective(this.end))&&s&&this.raiseRecoverable(e.start,`Illegal 'use strict' directive in function with non-simple parameter list`);var c=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,5),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},L.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1)if(n[t].type!==`Identifier`)return!1;return!0},L.checkParams=function(e,t){for(var n=Object.create(null),r=0,i=e.params;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,1,t?null:n)}},L.parseExprList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(x.comma),t&&this.afterTrailingComma(e))break;var o=void 0;n&&this.type===x.comma?o=null:this.type===x.ellipsis?(o=this.parseSpread(r),r&&this.type===x.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i},L.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;(this.inGenerator&&r===`yield`&&this.raiseRecoverable(t,`Cannot use 'yield' as identifier inside a generator`),this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use 'await' as identifier inside an async function`),this.currentThisScope().flags&pe||r!==`arguments`||this.raiseRecoverable(t,`Cannot use 'arguments' in class field initializer`),!this.inClassStaticBlock||r!==`arguments`&&r!==`await`||this.raise(t,`Cannot use `+r+` in class static initialization block`),this.keywords.test(r)&&this.raise(t,`Unexpected keyword '`+r+`'`),this.options.ecmaVersion<6&&this.input.slice(t,n).indexOf(`\\`)!==-1)||(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(this.inAsync||r!==`await`||this.raiseRecoverable(t,`Cannot use keyword 'await' outside an async function`),this.raiseRecoverable(t,`The keyword '`+r+`' is reserved`))},L.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,`Identifier`),e||(this.checkUnreserved(t),t.name!==`await`||this.awaitIdentPos||(this.awaitIdentPos=t.start)),t},L.parseIdentNode=function(){var e=this.startNode();return this.type===x.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,e.name!==`class`&&e.name!==`function`||this.lastTokEnd===this.lastTokStart+1&&this.input.charCodeAt(this.lastTokStart)===46||this.context.pop(),this.type=x.name):this.unexpected(),e},L.parsePrivateIdent=function(){var e=this.startNode();return this.type===x.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,`PrivateIdentifier`),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,`Private field '#`+e.name+`' must be declared in an enclosing class`):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},L.parseYield=function(e){this.yieldPos||=this.start;var t=this.startNode();return this.next(),this.type===x.semi||this.canInsertSemicolon()||this.type!==x.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(x.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,`YieldExpression`)},L.parseAwait=function(e){this.awaitPos||=this.start;var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,`AwaitExpression`)};var R=j.prototype;R.raise=function(e,t){var n=ue(this.input,e);t+=` (`+n.line+`:`+n.column+`)`,this.sourceFile&&(t+=` in `+this.sourceFile);var r=SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},R.raiseRecoverable=R.raise,R.curPosition=function(){if(this.options.locations)return new O(this.curLine,this.pos-this.lineStart)};var Ae=j.prototype,je=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};Ae.enterScope=function(e){this.scopeStack.push(new je(e))},Ae.exitScope=function(){this.scopeStack.pop()},Ae.treatFunctionsAsVarInScope=function(e){return 2&e.flags||!this.inModule&&1&e.flags},Ae.declareName=function(e,t,n){var r=!1;if(t===2){var i=this.currentScope();r=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&1&i.flags&&delete this.undefinedExports[e]}else if(t===4)this.currentScope().lexical.push(e);else if(t===3){var a=this.currentScope();r=this.treatFunctionsAsVar?a.lexical.indexOf(e)>-1:a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var s=this.scopeStack[o];if(s.lexical.indexOf(e)>-1&&!(32&s.flags&&s.lexical[0]===e)||!this.treatFunctionsAsVarInScope(s)&&s.functions.indexOf(e)>-1){r=!0;break}if(s.var.push(e),this.inModule&&1&s.flags&&delete this.undefinedExports[e],s.flags&pe)break}r&&this.raiseRecoverable(n,`Identifier '`+e+`' has already been declared`)},Ae.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},Ae.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Ae.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(771&t.flags)return t}},Ae.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(771&t.flags&&!(16&t.flags))return t}};var Me=function(e,t,n){this.type=``,this.start=t,this.end=0,e.options.locations&&(this.loc=new le(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},Ne=j.prototype;function Pe(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}Ne.startNode=function(){return new Me(this,this.start,this.startLoc)},Ne.startNodeAt=function(e,t){return new Me(this,e,t)},Ne.finishNode=function(e,t){return Pe.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},Ne.finishNodeAt=function(e,t,n,r){return Pe.call(this,e,t,n,r)},Ne.copyNode=function(e){var t=new Me(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t};var Fe=`ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS`,Ie=Fe+` Extended_Pictographic`,Le=Ie+` EBase EComp EMod EPres ExtPict`,Re={9:Fe,10:Ie,11:Ie,12:Le,13:Le,14:Le},ze={9:``,10:``,11:``,12:``,13:``,14:`Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji`},Be=`Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu`,Ve=`Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb`,He=Ve+` Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd`,Ue=He+` Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho`,We=Ue+` Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi`,Ge=We+` Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith`,Ke={9:Ve,10:He,11:Ue,12:We,13:Ge,14:Ge+` Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz`},qe={};function Je(e){var t=qe[e]={binary:E(Re[e]+` `+Be),binaryOfStrings:E(ze[e]),nonBinary:{General_Category:E(Be),Script:E(Ke[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var Ye=0,Xe=[9,10,11,12,13,14];Ye<Xe.length;Ye+=1)Je(Xe[Ye]);var z=j.prototype,Ze=function(e,t){this.parent=e,this.base=t||this};Ze.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var n=e;n;n=n.parent)if(t.base===n.base&&t!==n)return!0;return!1},Ze.prototype.sibling=function(){return new Ze(this.parent,this.base)};var Qe=function(e){this.parser=e,this.validFlags=`gim`+(e.options.ecmaVersion>=6?`uy`:``)+(e.options.ecmaVersion>=9?`s`:``)+(e.options.ecmaVersion>=13?`d`:``)+(e.options.ecmaVersion>=15?`v`:``),this.unicodeProperties=qe[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source=``,this.flags=``,this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue=``,this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function $e(e){return e===105||e===109||e===115}function et(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}function tt(e){return e>=65&&e<=90||e>=97&&e<=122}Qe.prototype.reset=function(e,t,n){var r=n.indexOf(`v`)!==-1,i=n.indexOf(`u`)!==-1;this.start=0|e,this.source=t+``,this.flags=n,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},Qe.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,`Invalid regular expression: /`+this.source+`/: `+e)},Qe.prototype.at=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return-1;var i=n.charCodeAt(e);if(!t&&!this.switchU||i<=55295||i>=57344||e+1>=r)return i;var a=n.charCodeAt(e+1);return a>=56320&&a<=57343?(i<<10)+a-56613888:i},Qe.prototype.nextIndex=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return r;var i,a=n.charCodeAt(e);return!t&&!this.switchU||a<=55295||a>=57344||e+1>=r||(i=n.charCodeAt(e+1))<56320||i>57343?e+1:e+2},Qe.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)},Qe.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},Qe.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)},Qe.prototype.eat=function(e,t){return t===void 0&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},Qe.prototype.eatChars=function(e,t){t===void 0&&(t=!1);for(var n=this.pos,r=0,i=e;r<i.length;r+=1){var a=i[r],o=this.at(n,t);if(o===-1||o!==a)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},z.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,r=!1,i=!1,a=0;a<n.length;a++){var o=n.charAt(a);t.indexOf(o)===-1&&this.raise(e.start,`Invalid regular expression flag`),n.indexOf(o,a+1)>-1&&this.raise(e.start,`Duplicate regular expression flag`),o===`u`&&(r=!0),o===`v`&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(e.start,`Invalid regular expression flag`)},z.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&function(e){for(var t in e)return!0;return!1}(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},z.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue=``,e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise(`Unmatched ')'`),(e.eat(93)||e.eat(125))&&e.raise(`Lone quantifier brackets`)),e.maxBackReference>e.numCapturingParens&&e.raise(`Invalid escape`);for(var t=0,n=e.backReferenceNames;t<n.length;t+=1){var r=n[t];e.groupNames[r]||e.raise(`Invalid named capture referenced`)}},z.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Ze(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise(`Nothing to repeat`),e.eat(123)&&e.raise(`Lone quantifier brackets`)},z.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},z.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise(`Invalid quantifier`),!0):!!(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))&&(this.regexp_eatQuantifier(e),!0)},z.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise(`Unterminated group`),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},z.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),!!this.regexp_eatQuantifierPrefix(e,t)&&(e.eat(63),!0)},z.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},z.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return i!==-1&&i<r&&!t&&e.raise(`numbers out of order in {} quantifier`),!0;e.switchU&&!t&&e.raise(`Incomplete quantifier`),e.pos=n}return!1},z.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},z.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},z.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(e),r=e.eat(45);if(n||r){for(var i=0;i<n.length;i++){var a=n.charAt(i);n.indexOf(a,i+1)>-1&&e.raise(`Duplicate regular expression modifiers`)}if(r){var o=this.regexp_eatModifiers(e);n||o||e.current()!==58||e.raise(`Invalid regular expression modifiers`);for(var s=0;s<o.length;s++){var c=o.charAt(s);(o.indexOf(c,s+1)>-1||n.indexOf(c)>-1)&&e.raise(`Duplicate regular expression modifiers`)}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise(`Unterminated group`)}}e.pos=t}return!1},z.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise(`Invalid group`),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise(`Unterminated group`)}return!1},z.regexp_eatModifiers=function(e){for(var t=``,n=0;(n=e.current())!==-1&&$e(n);)t+=D(n),e.advance();return t},z.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},z.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise(`Nothing to repeat`),!1},z.regexp_eatSyntaxCharacter=function(e){var t=e.current();return!!et(t)&&(e.lastIntValue=t,e.advance(),!0)},z.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;(n=e.current())!==-1&&!et(n);)e.advance();return e.pos!==t},z.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return!(t===-1||t===36||t>=40&&t<=43||t===46||t===63||t===91||t===94||t===124)&&(e.advance(),!0)},z.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise(`Invalid group`);var t=this.options.ecmaVersion>=16,n=e.groupNames[e.lastStringValue];if(n)if(t)for(var r=0,i=n;r<i.length;r+=1)i[r].separatedFrom(e.branchID)||e.raise(`Duplicate capture group name`);else e.raise(`Duplicate capture group name`);t?(n||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},z.regexp_eatGroupName=function(e){if(e.lastStringValue=``,e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise(`Invalid capture group name`)}return!1},z.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue=``,this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=D(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=D(e.lastIntValue);return!0}return!1},z.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),function(e){return p(e,!0)||e===36||e===95}(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)},z.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),function(e){return m(e,!0)||e===36||e===95||e===8204||e===8205}(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)},z.regexp_eatAtomEscape=function(e){return!!(this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e))||(e.switchU&&(e.current()===99&&e.raise(`Invalid unicode escape`),e.raise(`Invalid escape`)),!1)},z.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},z.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise(`Invalid named reference`)}return!1},z.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},z.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},z.regexp_eatZero=function(e){return e.current()===48&&!it(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},z.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114&&(e.lastIntValue=13,e.advance(),!0)},z.regexp_eatControlLetter=function(e){var t=e.current();return!!tt(t)&&(e.lastIntValue=t%32,e.advance(),!0)},z.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var n,r=e.pos,i=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var a=e.lastIntValue;if(i&&a>=55296&&a<=56319){var o=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var s=e.lastIntValue;if(s>=56320&&s<=57343)return e.lastIntValue=1024*(a-55296)+(s-56320)+65536,!0}e.pos=o,e.lastIntValue=a}return!0}if(i&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&(n=e.lastIntValue)>=0&&n<=1114111)return!0;i&&e.raise(`Invalid unicode escape`),e.pos=r}return!1},z.regexp_eatIdentityEscape=function(e){if(e.switchU)return!!this.regexp_eatSyntaxCharacter(e)||!!e.eat(47)&&(e.lastIntValue=47,!0);var t=e.current();return!(t===99||e.switchN&&t===107)&&(e.lastIntValue=t,e.advance(),!0)},z.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};function nt(e){return tt(e)||e===95}function rt(e){return nt(e)||it(e)}function it(e){return e>=48&&e<=57}function at(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function ot(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e-48}function st(e){return e>=48&&e<=55}z.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(function(e){return e===100||e===68||e===115||e===83||e===119||e===87}(t))return e.lastIntValue=-1,e.advance(),1;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=t===80)||t===112)){var r;if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&r===2&&e.raise(`Invalid property name`),r;e.raise(`Invalid property name`)}return 0},z.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,r),1}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return 0},z.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){ae(e.unicodeProperties.nonBinary,t)||e.raise(`Invalid property name`),e.unicodeProperties.nonBinary[t].test(n)||e.raise(`Invalid property value`)},z.regexp_validateUnicodePropertyNameOrValue=function(e,t){return e.unicodeProperties.binary.test(t)?1:e.switchV&&e.unicodeProperties.binaryOfStrings.test(t)?2:void e.raise(`Invalid property name`)},z.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue=``;nt(t=e.current());)e.lastStringValue+=D(t),e.advance();return e.lastStringValue!==``},z.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue=``;rt(t=e.current());)e.lastStringValue+=D(t),e.advance();return e.lastStringValue!==``},z.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},z.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),n=this.regexp_classContents(e);return e.eat(93)||e.raise(`Unterminated character class`),t&&n===2&&e.raise(`Negated character class may contain strings`),!0}return!1},z.regexp_classContents=function(e){return e.current()===93?1:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),1)},z.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;!e.switchU||t!==-1&&n!==-1||e.raise(`Invalid character class`),t!==-1&&n!==-1&&t>n&&e.raise(`Range out of order in character class`)}}},z.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(n===99||st(n))&&e.raise(`Invalid class escape`),e.raise(`Invalid escape`)}e.pos=t}var r=e.current();return r!==93&&(e.lastIntValue=r,e.advance(),!0)},z.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},z.regexp_classSetExpression=function(e){var t,n=1;if(!this.regexp_eatClassSetRange(e))if(t=this.regexp_eatClassSetOperand(e)){t===2&&(n=2);for(var r=e.pos;e.eatChars([38,38]);)e.current()!==38&&(t=this.regexp_eatClassSetOperand(e))?t!==2&&(n=1):e.raise(`Invalid character in character class`);if(r!==e.pos)return n;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise(`Invalid character in character class`);if(r!==e.pos)return n}else e.raise(`Invalid character in character class`);for(;;)if(!this.regexp_eatClassSetRange(e)){if(!(t=this.regexp_eatClassSetOperand(e)))return n;t===2&&(n=2)}},z.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return n!==-1&&r!==-1&&n>r&&e.raise(`Range out of order in character class`),!0}e.pos=t}return!1},z.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?1:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},z.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var n=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return n&&r===2&&e.raise(`Negated character class may contain strings`),r;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},z.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var n=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return n}else e.raise(`Invalid escape`);e.pos=t}return null},z.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===2&&(t=2);return t},z.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?1:2},z.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return!(!this.regexp_eatCharacterEscape(e)&&!this.regexp_eatClassSetReservedPunctuator(e))||(e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1));var n=e.current();return!(n<0||n===e.lookahead()&&function(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}(n))&&!function(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}(n)&&(e.advance(),e.lastIntValue=n,!0)},z.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return!!function(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}(t)&&(e.lastIntValue=t,e.advance(),!0)},z.regexp_eatClassControlLetter=function(e){var t=e.current();return!(!it(t)&&t!==95)&&(e.lastIntValue=t%32,e.advance(),!0)},z.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise(`Invalid escape`),e.pos=t}return!1},z.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;it(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t},z.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;at(n=e.current());)e.lastIntValue=16*e.lastIntValue+ot(n),e.advance();return e.pos!==t},z.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=64*t+8*n+e.lastIntValue:e.lastIntValue=8*t+n}else e.lastIntValue=t;return!0}return!1},z.regexp_eatOctalDigit=function(e){var t=e.current();return st(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},z.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var i=e.current();if(!at(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+ot(i),e.advance()}return!0};var ct=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new le(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},B=j.prototype;function lt(e){return typeof BigInt==`function`?BigInt(e.replace(/_/g,``)):null}B.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword `+this.type.keyword),this.options.onToken&&this.options.onToken(new ct(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},B.getToken=function(){return this.next(),new ct(this)},typeof Symbol<`u`&&(B[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===x.eof,value:t}}}}),B.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(x.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},B.readToken=function(e){return p(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},B.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888},B.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf(`*/`,this.pos+=2);if(n===-1&&this.raise(this.pos-2,`Unterminated comment`),this.pos=n+2,this.options.locations)for(var r=void 0,i=t;(r=ee(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},B.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!w(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},B.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&e<14||e>=5760&&te.test(String.fromCharCode(e))))break e;++this.pos}}},B.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},B.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(x.ellipsis)):(++this.pos,this.finishToken(x.dot))},B.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(x.assign,2):this.finishOp(x.slash,1)},B.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=e===42?x.star:x.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++n,r=x.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(x.assign,n+1):this.finishOp(r,n)},B.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(x.assign,3):this.finishOp(e===124?x.logicalOR:x.logicalAND,2):t===61?this.finishOp(x.assign,2):this.finishOp(e===124?x.bitwiseOR:x.bitwiseAND,1)},B.readToken_caret=function(){return this.input.charCodeAt(this.pos+1)===61?this.finishOp(x.assign,2):this.finishOp(x.bitwiseXOR,1)},B.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t!==45||this.inModule||this.input.charCodeAt(this.pos+2)!==62||this.lastTokEnd!==0&&!S.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(x.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):t===61?this.finishOp(x.assign,2):this.finishOp(x.plusMin,1)},B.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(x.assign,n+1):this.finishOp(x.bitShift,n)):t!==33||e!==60||this.inModule||this.input.charCodeAt(this.pos+2)!==45||this.input.charCodeAt(this.pos+3)!==45?(t===61&&(n=2),this.finishOp(x.relational,n)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},B.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(x.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(x.arrow)):this.finishOp(e===61?x.eq:x.prefix,1)},B.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(x.questionDot,2)}if(t===63)return e>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(x.assign,3):this.finishOp(x.coalesce,2)}return this.finishOp(x.question,1)},B.readToken_numberSign=function(){var e=35;if(this.options.ecmaVersion>=13&&(++this.pos,p(e=this.fullCharCodeAtPos(),!0)||e===92))return this.finishToken(x.privateId,this.readWord1());this.raise(this.pos,`Unexpected character '`+D(e)+`'`)},B.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(x.parenL);case 41:return++this.pos,this.finishToken(x.parenR);case 59:return++this.pos,this.finishToken(x.semi);case 44:return++this.pos,this.finishToken(x.comma);case 91:return++this.pos,this.finishToken(x.bracketL);case 93:return++this.pos,this.finishToken(x.bracketR);case 123:return++this.pos,this.finishToken(x.braceL);case 125:return++this.pos,this.finishToken(x.braceR);case 58:return++this.pos,this.finishToken(x.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(x.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(x.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,`Unexpected character '`+D(e)+`'`)},B.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},B.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,`Unterminated regular expression`);var r=this.input.charAt(this.pos);if(S.test(r)&&this.raise(n,`Unterminated regular expression`),e)e=!1;else{if(r===`[`)t=!0;else if(r===`]`&&t)t=!1;else if(r===`/`&&!t)break;e=r===`\\`}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var s=this.regexpState||=new Qe(this);s.reset(n,i,o),this.validateRegExpFlags(s),this.validateRegExpPattern(s);var c=null;try{c=new RegExp(i,o)}catch{}return this.finishToken(x.regexp,{pattern:i,flags:o,value:c})},B.readInt=function(e,t,n){for(var r=this.options.ecmaVersion>=12&&t===void 0,i=n&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,s=0,c=0,l=t??1/0;c<l;++c,++this.pos){var u=this.input.charCodeAt(this.pos),d=void 0;if(r&&u===95)i&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed in legacy octal numeric literals`),s===95&&this.raiseRecoverable(this.pos,`Numeric separator must be exactly one underscore`),c===0&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed at the first of digits`),s=u;else{if((d=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0)>=e)break;s=u,o=o*e+d}}return r&&s===95&&this.raiseRecoverable(this.pos-1,`Numeric separator is not allowed at the last of digits`),this.pos===a||t!=null&&this.pos-a!==t?null:o},B.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return n??this.raise(this.start+2,`Expected number in radix `+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=lt(this.input.slice(t,this.pos)),++this.pos):p(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(x.num,n)},B.readNumber=function(e){var t=this.pos;e||this.readInt(10,void 0,!0)!==null||this.raise(t,`Invalid number`);var n=this.pos-t>=2&&this.input.charCodeAt(t)===48;n&&this.strict&&this.raise(t,`Invalid number`);var r=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&r===110){var i=lt(this.input.slice(t,this.pos));return++this.pos,p(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(x.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),r!==46||n||(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),r!==69&&r!==101||n||((r=this.input.charCodeAt(++this.pos))!==43&&r!==45||++this.pos,this.readInt(10)===null&&this.raise(t,`Invalid number`)),p(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`);var a,o=(a=this.input.slice(t,this.pos),n?parseInt(a,8):parseFloat(a.replace(/_/g,``)));return this.finishToken(x.num,o)},B.readCodePoint=function(){var e;if(this.input.charCodeAt(this.pos)===123){this.options.ecmaVersion<6&&this.unexpected();var t=++this.pos;e=this.readHexChar(this.input.indexOf(`}`,this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(t,`Code point out of bounds`)}else e=this.readHexChar(4);return e},B.readString=function(e){for(var t=``,n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated string constant`);var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,`Unterminated string constant`),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(w(r)&&this.raise(this.start,`Unterminated string constant`),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(x.string,t)};var ut={};B.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==ut)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},B.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw ut;this.raise(e,t)},B.readTmplToken=function(){for(var e=``,t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated template`);var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos!==this.start||this.type!==x.template&&this.type!==x.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(x.template,e)):n===36?(this.pos+=2,this.finishToken(x.dollarBraceL)):(++this.pos,this.finishToken(x.backQuote));if(n===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(w(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
61
- `;break;default:e+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else ++this.pos}},B.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case`\\`:++this.pos;break;case`$`:if(this.input[this.pos+1]!==`{`)break;case"`":return this.finishToken(x.invalidTemplate,this.input.slice(this.start,this.pos));case`\r`:this.input[this.pos+1]===`
60
+ `),cooked:this.value},this.next(),n.tail=this.type===x.backQuote,this.finishNode(n,`TemplateElement`)},F.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var n=this.startNode();this.next(),n.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(n.quasis=[r];!r.tail;)this.type===x.eof&&this.raise(this.pos,`Unterminated template literal`),this.expect(x.dollarBraceL),n.expressions.push(this.parseExpression()),this.expect(x.braceR),n.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(n,`TemplateLiteral`)},F.isAsyncProp=function(e){return!e.computed&&e.key.type===`Identifier`&&e.key.name===`async`&&(this.type===x.name||this.type===x.num||this.type===x.string||this.type===x.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===x.star)&&!S.test(this.input.slice(this.lastTokEnd,this.start))},F.parseObj=function(e,t){var n=this.startNode(),r=!0,i={};for(n.properties=[],this.next();!this.eat(x.braceR);){if(r)r=!1;else if(this.expect(x.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(x.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,i,t),n.properties.push(a)}return this.finishNode(n,e?`ObjectPattern`:`ObjectExpression`)},F.parseProperty=function(e,t){var n,r,i,a,o=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(x.ellipsis))return e?(o.argument=this.parseIdent(!1),this.type===x.comma&&this.raiseRecoverable(this.start,`Comma is not permitted after the rest element`),this.finishNode(o,`RestElement`)):(o.argument=this.parseMaybeAssign(!1,t),this.type===x.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(o,`SpreadElement`));this.options.ecmaVersion>=6&&(o.method=!1,o.shorthand=!1,(e||t)&&(i=this.start,a=this.startLoc),e||(n=this.eat(x.star)));var s=this.containsEsc;return this.parsePropertyName(o),!e&&!s&&this.options.ecmaVersion>=8&&!n&&this.isAsyncProp(o)?(r=!0,n=this.options.ecmaVersion>=9&&this.eat(x.star),this.parsePropertyName(o)):r=!1,this.parsePropertyValue(o,e,n,r,i,a,t,s),this.finishNode(o,`Property`)},F.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var n=e.kind===`get`?0:1;if(e.value.params.length!==n){var r=e.value.start;e.kind===`get`?this.raiseRecoverable(r,`getter should have no params`):this.raiseRecoverable(r,`setter should have exactly one param`)}else e.kind===`set`&&e.value.params[0].type===`RestElement`&&this.raiseRecoverable(e.value.params[0].start,`Setter cannot use rest params`)},F.parsePropertyValue=function(e,t,n,r,i,a,o,s){(n||r)&&this.type===x.colon&&this.unexpected(),this.eat(x.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind=`init`):this.options.ecmaVersion>=6&&this.type===x.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(n,r),e.kind=`init`):t||s||!(this.options.ecmaVersion>=5)||e.computed||e.key.type!==`Identifier`||e.key.name!==`get`&&e.key.name!==`set`||this.type===x.comma||this.type===x.braceR||this.type===x.eq?this.options.ecmaVersion>=6&&!e.computed&&e.key.type===`Identifier`?((n||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name!==`await`||this.awaitIdentPos||(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key)):this.type===x.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind=`init`,e.shorthand=!0):this.unexpected():((n||r)&&this.unexpected(),this.parseGetterSetter(e))},F.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(x.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(x.bracketR),e.key;e.computed=!1}return e.key=this.type===x.num||this.type===x.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!==`never`)},F.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},F.parseMethod=function(e,t,n){var r=this.startNode(),i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(64|he(t,r.generator)|(n?128:0)),this.expect(x.parenL),r.params=this.parseBindingList(x.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(r,`FunctionExpression`)},F.parseArrowExpression=function(e,t,n,r){var i=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(16|he(n,!1)),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!n),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,`ArrowFunctionExpression`)},F.parseFunctionBody=function(e,t,n,r){var i=t&&this.type!==x.braceL,a=this.strict,o=!1;if(i)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);else{var s=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);a&&!s||(o=this.strictDirective(this.end))&&s&&this.raiseRecoverable(e.start,`Illegal 'use strict' directive in function with non-simple parameter list`);var c=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!n&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,5),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=c}this.exitScope()},F.isSimpleParamList=function(e){for(var t=0,n=e;t<n.length;t+=1)if(n[t].type!==`Identifier`)return!1;return!0},F.checkParams=function(e,t){for(var n=Object.create(null),r=0,i=e.params;r<i.length;r+=1){var a=i[r];this.checkLValInnerPattern(a,1,t?null:n)}},F.parseExprList=function(e,t,n,r){for(var i=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(x.comma),t&&this.afterTrailingComma(e))break;var o=void 0;n&&this.type===x.comma?o=null:this.type===x.ellipsis?(o=this.parseSpread(r),r&&this.type===x.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),i.push(o)}return i},F.checkUnreserved=function(e){var t=e.start,n=e.end,r=e.name;(this.inGenerator&&r===`yield`&&this.raiseRecoverable(t,`Cannot use 'yield' as identifier inside a generator`),this.inAsync&&r===`await`&&this.raiseRecoverable(t,`Cannot use 'await' as identifier inside an async function`),this.currentThisScope().flags&me||r!==`arguments`||this.raiseRecoverable(t,`Cannot use 'arguments' in class field initializer`),!this.inClassStaticBlock||r!==`arguments`&&r!==`await`||this.raise(t,`Cannot use `+r+` in class static initialization block`),this.keywords.test(r)&&this.raise(t,`Unexpected keyword '`+r+`'`),this.options.ecmaVersion<6&&this.input.slice(t,n).indexOf(`\\`)!==-1)||(this.strict?this.reservedWordsStrict:this.reservedWords).test(r)&&(this.inAsync||r!==`await`||this.raiseRecoverable(t,`Cannot use keyword 'await' outside an async function`),this.raiseRecoverable(t,`The keyword '`+r+`' is reserved`))},F.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,`Identifier`),e||(this.checkUnreserved(t),t.name!==`await`||this.awaitIdentPos||(this.awaitIdentPos=t.start)),t},F.parseIdentNode=function(){var e=this.startNode();return this.type===x.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,e.name!==`class`&&e.name!==`function`||this.lastTokEnd===this.lastTokStart+1&&this.input.charCodeAt(this.lastTokStart)===46||this.context.pop(),this.type=x.name):this.unexpected(),e},F.parsePrivateIdent=function(){var e=this.startNode();return this.type===x.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,`PrivateIdentifier`),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,`Private field '#`+e.name+`' must be declared in an enclosing class`):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},F.parseYield=function(e){this.yieldPos||=this.start;var t=this.startNode();return this.next(),this.type===x.semi||this.canInsertSemicolon()||this.type!==x.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(x.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,`YieldExpression`)},F.parseAwait=function(e){this.awaitPos||=this.start;var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,`AwaitExpression`)};var I=ge.prototype;I.raise=function(e,t){var n=ue(this.input,e);t+=` (`+n.line+`:`+n.column+`)`,this.sourceFile&&(t+=` in `+this.sourceFile);var r=SyntaxError(t);throw r.pos=e,r.loc=n,r.raisedAt=this.pos,r},I.raiseRecoverable=I.raise,I.curPosition=function(){if(this.options.locations)return new O(this.curLine,this.pos-this.lineStart)};var Me=ge.prototype,Ne=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};Me.enterScope=function(e){this.scopeStack.push(new Ne(e))},Me.exitScope=function(){this.scopeStack.pop()},Me.treatFunctionsAsVarInScope=function(e){return 2&e.flags||!this.inModule&&1&e.flags},Me.declareName=function(e,t,n){var r=!1;if(t===2){var i=this.currentScope();r=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&1&i.flags&&delete this.undefinedExports[e]}else if(t===4)this.currentScope().lexical.push(e);else if(t===3){var a=this.currentScope();r=this.treatFunctionsAsVar?a.lexical.indexOf(e)>-1:a.lexical.indexOf(e)>-1||a.var.indexOf(e)>-1,a.functions.push(e)}else for(var o=this.scopeStack.length-1;o>=0;--o){var s=this.scopeStack[o];if(s.lexical.indexOf(e)>-1&&!(32&s.flags&&s.lexical[0]===e)||!this.treatFunctionsAsVarInScope(s)&&s.functions.indexOf(e)>-1){r=!0;break}if(s.var.push(e),this.inModule&&1&s.flags&&delete this.undefinedExports[e],s.flags&me)break}r&&this.raiseRecoverable(n,`Identifier '`+e+`' has already been declared`)},Me.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)},Me.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Me.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(771&t.flags)return t}},Me.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(771&t.flags&&!(16&t.flags))return t}};var Pe=function(e,t,n){this.type=``,this.start=t,this.end=0,e.options.locations&&(this.loc=new le(e,n)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},Fe=ge.prototype;function Ie(e,t,n,r){return e.type=t,e.end=n,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=n),e}Fe.startNode=function(){return new Pe(this,this.start,this.startLoc)},Fe.startNodeAt=function(e,t){return new Pe(this,e,t)},Fe.finishNode=function(e,t){return Ie.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},Fe.finishNodeAt=function(e,t,n,r){return Ie.call(this,e,t,n,r)},Fe.copyNode=function(e){var t=new Pe(this,e.start,this.startLoc);for(var n in e)t[n]=e[n];return t};var Le=`ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS`,Re=Le+` Extended_Pictographic`,ze=Re+` EBase EComp EMod EPres ExtPict`,Be={9:Le,10:Re,11:Re,12:ze,13:ze,14:ze},Ve={9:``,10:``,11:``,12:``,13:``,14:`Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji`},He=`Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu`,Ue=`Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb`,We=Ue+` Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd`,Ge=We+` Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho`,Ke=Ge+` Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi`,qe=Ke+` Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith`,Je={9:Ue,10:We,11:Ge,12:Ke,13:qe,14:qe+` Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz`},Ye={};function Xe(e){var t=Ye[e]={binary:E(Be[e]+` `+He),binaryOfStrings:E(Ve[e]),nonBinary:{General_Category:E(He),Script:E(Je[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var Ze=0,Qe=[9,10,11,12,13,14];Ze<Qe.length;Ze+=1)Xe(Qe[Ze]);var L=ge.prototype,$e=function(e,t){this.parent=e,this.base=t||this};$e.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var n=e;n;n=n.parent)if(t.base===n.base&&t!==n)return!0;return!1},$e.prototype.sibling=function(){return new $e(this.parent,this.base)};var R=function(e){this.parser=e,this.validFlags=`gim`+(e.options.ecmaVersion>=6?`uy`:``)+(e.options.ecmaVersion>=9?`s`:``)+(e.options.ecmaVersion>=13?`d`:``)+(e.options.ecmaVersion>=15?`v`:``),this.unicodeProperties=Ye[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source=``,this.flags=``,this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue=``,this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function et(e){return e===105||e===109||e===115}function tt(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}function nt(e){return e>=65&&e<=90||e>=97&&e<=122}R.prototype.reset=function(e,t,n){var r=n.indexOf(`v`)!==-1,i=n.indexOf(`u`)!==-1;this.start=0|e,this.source=t+``,this.flags=n,r&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},R.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,`Invalid regular expression: /`+this.source+`/: `+e)},R.prototype.at=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return-1;var i=n.charCodeAt(e);if(!t&&!this.switchU||i<=55295||i>=57344||e+1>=r)return i;var a=n.charCodeAt(e+1);return a>=56320&&a<=57343?(i<<10)+a-56613888:i},R.prototype.nextIndex=function(e,t){t===void 0&&(t=!1);var n=this.source,r=n.length;if(e>=r)return r;var i,a=n.charCodeAt(e);return!t&&!this.switchU||a<=55295||a>=57344||e+1>=r||(i=n.charCodeAt(e+1))<56320||i>57343?e+1:e+2},R.prototype.current=function(e){return e===void 0&&(e=!1),this.at(this.pos,e)},R.prototype.lookahead=function(e){return e===void 0&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},R.prototype.advance=function(e){e===void 0&&(e=!1),this.pos=this.nextIndex(this.pos,e)},R.prototype.eat=function(e,t){return t===void 0&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},R.prototype.eatChars=function(e,t){t===void 0&&(t=!1);for(var n=this.pos,r=0,i=e;r<i.length;r+=1){var a=i[r],o=this.at(n,t);if(o===-1||o!==a)return!1;n=this.nextIndex(n,t)}return this.pos=n,!0},L.validateRegExpFlags=function(e){for(var t=e.validFlags,n=e.flags,r=!1,i=!1,a=0;a<n.length;a++){var o=n.charAt(a);t.indexOf(o)===-1&&this.raise(e.start,`Invalid regular expression flag`),n.indexOf(o,a+1)>-1&&this.raise(e.start,`Duplicate regular expression flag`),o===`u`&&(r=!0),o===`v`&&(i=!0)}this.options.ecmaVersion>=15&&r&&i&&this.raise(e.start,`Invalid regular expression flag`)},L.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&function(e){for(var t in e)return!0;return!1}(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},L.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue=``,e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise(`Unmatched ')'`),(e.eat(93)||e.eat(125))&&e.raise(`Lone quantifier brackets`)),e.maxBackReference>e.numCapturingParens&&e.raise(`Invalid escape`);for(var t=0,n=e.backReferenceNames;t<n.length;t+=1){var r=n[t];e.groupNames[r]||e.raise(`Invalid named capture referenced`)}},L.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new $e(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise(`Nothing to repeat`),e.eat(123)&&e.raise(`Lone quantifier brackets`)},L.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},L.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise(`Invalid quantifier`),!0):!!(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))&&(this.regexp_eatQuantifier(e),!0)},L.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var n=!1;if(this.options.ecmaVersion>=9&&(n=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise(`Unterminated group`),e.lastAssertionIsQuantifiable=!n,!0}return e.pos=t,!1},L.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),!!this.regexp_eatQuantifierPrefix(e,t)&&(e.eat(63),!0)},L.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},L.regexp_eatBracedQuantifier=function(e,t){var n=e.pos;if(e.eat(123)){var r=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return i!==-1&&i<r&&!t&&e.raise(`numbers out of order in {} quantifier`),!0;e.switchU&&!t&&e.raise(`Incomplete quantifier`),e.pos=n}return!1},L.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},L.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},L.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var n=this.regexp_eatModifiers(e),r=e.eat(45);if(n||r){for(var i=0;i<n.length;i++){var a=n.charAt(i);n.indexOf(a,i+1)>-1&&e.raise(`Duplicate regular expression modifiers`)}if(r){var o=this.regexp_eatModifiers(e);n||o||e.current()!==58||e.raise(`Invalid regular expression modifiers`);for(var s=0;s<o.length;s++){var c=o.charAt(s);(o.indexOf(c,s+1)>-1||n.indexOf(c)>-1)&&e.raise(`Duplicate regular expression modifiers`)}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise(`Unterminated group`)}}e.pos=t}return!1},L.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise(`Invalid group`),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise(`Unterminated group`)}return!1},L.regexp_eatModifiers=function(e){for(var t=``,n=0;(n=e.current())!==-1&&et(n);)t+=D(n),e.advance();return t},L.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},L.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise(`Nothing to repeat`),!1},L.regexp_eatSyntaxCharacter=function(e){var t=e.current();return!!tt(t)&&(e.lastIntValue=t,e.advance(),!0)},L.regexp_eatPatternCharacters=function(e){for(var t=e.pos,n=0;(n=e.current())!==-1&&!tt(n);)e.advance();return e.pos!==t},L.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return!(t===-1||t===36||t>=40&&t<=43||t===46||t===63||t===91||t===94||t===124)&&(e.advance(),!0)},L.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise(`Invalid group`);var t=this.options.ecmaVersion>=16,n=e.groupNames[e.lastStringValue];if(n)if(t)for(var r=0,i=n;r<i.length;r+=1)i[r].separatedFrom(e.branchID)||e.raise(`Duplicate capture group name`);else e.raise(`Duplicate capture group name`);t?(n||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},L.regexp_eatGroupName=function(e){if(e.lastStringValue=``,e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise(`Invalid capture group name`)}return!1},L.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue=``,this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=D(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=D(e.lastIntValue);return!0}return!1},L.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),function(e){return p(e,!0)||e===36||e===95}(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)},L.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,n=this.options.ecmaVersion>=11,r=e.current(n);return e.advance(n),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,n)&&(r=e.lastIntValue),function(e){return m(e,!0)||e===36||e===95||e===8204||e===8205}(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)},L.regexp_eatAtomEscape=function(e){return!!(this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e))||(e.switchU&&(e.current()===99&&e.raise(`Invalid unicode escape`),e.raise(`Invalid escape`)),!1)},L.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var n=e.lastIntValue;if(e.switchU)return n>e.maxBackReference&&(e.maxBackReference=n),!0;if(n<=e.numCapturingParens)return!0;e.pos=t}return!1},L.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise(`Invalid named reference`)}return!1},L.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},L.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},L.regexp_eatZero=function(e){return e.current()===48&&!at(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},L.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114&&(e.lastIntValue=13,e.advance(),!0)},L.regexp_eatControlLetter=function(e){var t=e.current();return!!nt(t)&&(e.lastIntValue=t%32,e.advance(),!0)},L.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var n,r=e.pos,i=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var a=e.lastIntValue;if(i&&a>=55296&&a<=56319){var o=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var s=e.lastIntValue;if(s>=56320&&s<=57343)return e.lastIntValue=1024*(a-55296)+(s-56320)+65536,!0}e.pos=o,e.lastIntValue=a}return!0}if(i&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&(n=e.lastIntValue)>=0&&n<=1114111)return!0;i&&e.raise(`Invalid unicode escape`),e.pos=r}return!1},L.regexp_eatIdentityEscape=function(e){if(e.switchU)return!!this.regexp_eatSyntaxCharacter(e)||!!e.eat(47)&&(e.lastIntValue=47,!0);var t=e.current();return!(t===99||e.switchN&&t===107)&&(e.lastIntValue=t,e.advance(),!0)},L.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return!0}return!1};function rt(e){return nt(e)||e===95}function it(e){return rt(e)||at(e)}function at(e){return e>=48&&e<=57}function ot(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function st(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e-48}function ct(e){return e>=48&&e<=55}L.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(function(e){return e===100||e===68||e===115||e===83||e===119||e===87}(t))return e.lastIntValue=-1,e.advance(),1;var n=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((n=t===80)||t===112)){var r;if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return n&&r===2&&e.raise(`Invalid property name`),r;e.raise(`Invalid property name`)}return 0},L.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var n=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,n,r),1}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return 0},L.regexp_validateUnicodePropertyNameAndValue=function(e,t,n){ae(e.unicodeProperties.nonBinary,t)||e.raise(`Invalid property name`),e.unicodeProperties.nonBinary[t].test(n)||e.raise(`Invalid property value`)},L.regexp_validateUnicodePropertyNameOrValue=function(e,t){return e.unicodeProperties.binary.test(t)?1:e.switchV&&e.unicodeProperties.binaryOfStrings.test(t)?2:void e.raise(`Invalid property name`)},L.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue=``;rt(t=e.current());)e.lastStringValue+=D(t),e.advance();return e.lastStringValue!==``},L.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue=``;it(t=e.current());)e.lastStringValue+=D(t),e.advance();return e.lastStringValue!==``},L.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},L.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),n=this.regexp_classContents(e);return e.eat(93)||e.raise(`Unterminated character class`),t&&n===2&&e.raise(`Negated character class may contain strings`),!0}return!1},L.regexp_classContents=function(e){return e.current()===93?1:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),1)},L.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var n=e.lastIntValue;!e.switchU||t!==-1&&n!==-1||e.raise(`Invalid character class`),t!==-1&&n!==-1&&t>n&&e.raise(`Range out of order in character class`)}}},L.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var n=e.current();(n===99||ct(n))&&e.raise(`Invalid class escape`),e.raise(`Invalid escape`)}e.pos=t}var r=e.current();return r!==93&&(e.lastIntValue=r,e.advance(),!0)},L.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},L.regexp_classSetExpression=function(e){var t,n=1;if(!this.regexp_eatClassSetRange(e))if(t=this.regexp_eatClassSetOperand(e)){t===2&&(n=2);for(var r=e.pos;e.eatChars([38,38]);)e.current()!==38&&(t=this.regexp_eatClassSetOperand(e))?t!==2&&(n=1):e.raise(`Invalid character in character class`);if(r!==e.pos)return n;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise(`Invalid character in character class`);if(r!==e.pos)return n}else e.raise(`Invalid character in character class`);for(;;)if(!this.regexp_eatClassSetRange(e)){if(!(t=this.regexp_eatClassSetOperand(e)))return n;t===2&&(n=2)}},L.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return n!==-1&&r!==-1&&n>r&&e.raise(`Range out of order in character class`),!0}e.pos=t}return!1},L.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?1:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},L.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var n=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return n&&r===2&&e.raise(`Negated character class may contain strings`),r;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},L.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var n=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return n}else e.raise(`Invalid escape`);e.pos=t}return null},L.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===2&&(t=2);return t},L.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?1:2},L.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return!(!this.regexp_eatCharacterEscape(e)&&!this.regexp_eatClassSetReservedPunctuator(e))||(e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1));var n=e.current();return!(n<0||n===e.lookahead()&&function(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}(n))&&!function(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}(n)&&(e.advance(),e.lastIntValue=n,!0)},L.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return!!function(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}(t)&&(e.lastIntValue=t,e.advance(),!0)},L.regexp_eatClassControlLetter=function(e){var t=e.current();return!(!at(t)&&t!==95)&&(e.lastIntValue=t%32,e.advance(),!0)},L.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise(`Invalid escape`),e.pos=t}return!1},L.regexp_eatDecimalDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;at(n=e.current());)e.lastIntValue=10*e.lastIntValue+(n-48),e.advance();return e.pos!==t},L.regexp_eatHexDigits=function(e){var t=e.pos,n=0;for(e.lastIntValue=0;ot(n=e.current());)e.lastIntValue=16*e.lastIntValue+st(n),e.advance();return e.pos!==t},L.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var n=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=64*t+8*n+e.lastIntValue:e.lastIntValue=8*t+n}else e.lastIntValue=t;return!0}return!1},L.regexp_eatOctalDigit=function(e){var t=e.current();return ct(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},L.regexp_eatFixedHexDigits=function(e,t){var n=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var i=e.current();if(!ot(i))return e.pos=n,!1;e.lastIntValue=16*e.lastIntValue+st(i),e.advance()}return!0};var lt=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new le(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},z=ge.prototype;function ut(e){return typeof BigInt==`function`?BigInt(e.replace(/_/g,``)):null}z.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,`Escape sequence in keyword `+this.type.keyword),this.options.onToken&&this.options.onToken(new lt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},z.getToken=function(){return this.next(),new lt(this)},typeof Symbol<`u`&&(z[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===x.eof,value:t}}}}),z.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(x.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},z.readToken=function(e){return p(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)},z.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888},z.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,n=this.input.indexOf(`*/`,this.pos+=2);if(n===-1&&this.raise(this.pos-2,`Unterminated comment`),this.pos=n+2,this.options.locations)for(var r=void 0,i=t;(r=ee(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,n),t,this.pos,e,this.curPosition())},z.skipLineComment=function(e){for(var t=this.pos,n=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!w(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,n,this.curPosition())},z.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&e<14||e>=5760&&te.test(String.fromCharCode(e))))break e;++this.pos}}},z.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var n=this.type;this.type=e,this.value=t,this.updateContext(n)},z.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(x.ellipsis)):(++this.pos,this.finishToken(x.dot))},z.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(x.assign,2):this.finishOp(x.slash,1)},z.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),n=1,r=e===42?x.star:x.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++n,r=x.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(x.assign,n+1):this.finishOp(r,n)},z.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(x.assign,3):this.finishOp(e===124?x.logicalOR:x.logicalAND,2):t===61?this.finishOp(x.assign,2):this.finishOp(e===124?x.bitwiseOR:x.bitwiseAND,1)},z.readToken_caret=function(){return this.input.charCodeAt(this.pos+1)===61?this.finishOp(x.assign,2):this.finishOp(x.bitwiseXOR,1)},z.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t!==45||this.inModule||this.input.charCodeAt(this.pos+2)!==62||this.lastTokEnd!==0&&!S.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(x.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):t===61?this.finishOp(x.assign,2):this.finishOp(x.plusMin,1)},z.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),n=1;return t===e?(n=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+n)===61?this.finishOp(x.assign,n+1):this.finishOp(x.bitShift,n)):t!==33||e!==60||this.inModule||this.input.charCodeAt(this.pos+2)!==45||this.input.charCodeAt(this.pos+3)!==45?(t===61&&(n=2),this.finishOp(x.relational,n)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},z.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(x.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(x.arrow)):this.finishOp(e===61?x.eq:x.prefix,1)},z.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var n=this.input.charCodeAt(this.pos+2);if(n<48||n>57)return this.finishOp(x.questionDot,2)}if(t===63)return e>=12&&this.input.charCodeAt(this.pos+2)===61?this.finishOp(x.assign,3):this.finishOp(x.coalesce,2)}return this.finishOp(x.question,1)},z.readToken_numberSign=function(){var e=35;if(this.options.ecmaVersion>=13&&(++this.pos,p(e=this.fullCharCodeAtPos(),!0)||e===92))return this.finishToken(x.privateId,this.readWord1());this.raise(this.pos,`Unexpected character '`+D(e)+`'`)},z.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(x.parenL);case 41:return++this.pos,this.finishToken(x.parenR);case 59:return++this.pos,this.finishToken(x.semi);case 44:return++this.pos,this.finishToken(x.comma);case 91:return++this.pos,this.finishToken(x.bracketL);case 93:return++this.pos,this.finishToken(x.bracketR);case 123:return++this.pos,this.finishToken(x.braceL);case 125:return++this.pos,this.finishToken(x.braceR);case 58:return++this.pos,this.finishToken(x.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(x.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(x.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,`Unexpected character '`+D(e)+`'`)},z.finishOp=function(e,t){var n=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,n)},z.readRegexp=function(){for(var e,t,n=this.pos;;){this.pos>=this.input.length&&this.raise(n,`Unterminated regular expression`);var r=this.input.charAt(this.pos);if(S.test(r)&&this.raise(n,`Unterminated regular expression`),e)e=!1;else{if(r===`[`)t=!0;else if(r===`]`&&t)t=!1;else if(r===`/`&&!t)break;e=r===`\\`}++this.pos}var i=this.input.slice(n,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var s=this.regexpState||=new R(this);s.reset(n,i,o),this.validateRegExpFlags(s),this.validateRegExpPattern(s);var c=null;try{c=new RegExp(i,o)}catch{}return this.finishToken(x.regexp,{pattern:i,flags:o,value:c})},z.readInt=function(e,t,n){for(var r=this.options.ecmaVersion>=12&&t===void 0,i=n&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,s=0,c=0,l=t??1/0;c<l;++c,++this.pos){var u=this.input.charCodeAt(this.pos),d=void 0;if(r&&u===95)i&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed in legacy octal numeric literals`),s===95&&this.raiseRecoverable(this.pos,`Numeric separator must be exactly one underscore`),c===0&&this.raiseRecoverable(this.pos,`Numeric separator is not allowed at the first of digits`),s=u;else{if((d=u>=97?u-97+10:u>=65?u-65+10:u>=48&&u<=57?u-48:1/0)>=e)break;s=u,o=o*e+d}}return r&&s===95&&this.raiseRecoverable(this.pos-1,`Numeric separator is not allowed at the last of digits`),this.pos===a||t!=null&&this.pos-a!==t?null:o},z.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var n=this.readInt(e);return n??this.raise(this.start+2,`Expected number in radix `+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(n=ut(this.input.slice(t,this.pos)),++this.pos):p(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(x.num,n)},z.readNumber=function(e){var t=this.pos;e||this.readInt(10,void 0,!0)!==null||this.raise(t,`Invalid number`);var n=this.pos-t>=2&&this.input.charCodeAt(t)===48;n&&this.strict&&this.raise(t,`Invalid number`);var r=this.input.charCodeAt(this.pos);if(!n&&!e&&this.options.ecmaVersion>=11&&r===110){var i=ut(this.input.slice(t,this.pos));return++this.pos,p(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`),this.finishToken(x.num,i)}n&&/[89]/.test(this.input.slice(t,this.pos))&&(n=!1),r!==46||n||(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),r!==69&&r!==101||n||((r=this.input.charCodeAt(++this.pos))!==43&&r!==45||++this.pos,this.readInt(10)===null&&this.raise(t,`Invalid number`)),p(this.fullCharCodeAtPos())&&this.raise(this.pos,`Identifier directly after number`);var a,o=(a=this.input.slice(t,this.pos),n?parseInt(a,8):parseFloat(a.replace(/_/g,``)));return this.finishToken(x.num,o)},z.readCodePoint=function(){var e;if(this.input.charCodeAt(this.pos)===123){this.options.ecmaVersion<6&&this.unexpected();var t=++this.pos;e=this.readHexChar(this.input.indexOf(`}`,this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(t,`Code point out of bounds`)}else e=this.readHexChar(4);return e},z.readString=function(e){for(var t=``,n=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated string constant`);var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(n,this.pos),t+=this.readEscapedChar(!1),n=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,`Unterminated string constant`),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(w(r)&&this.raise(this.start,`Unterminated string constant`),++this.pos)}return t+=this.input.slice(n,this.pos++),this.finishToken(x.string,t)};var dt={};z.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==dt)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},z.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw dt;this.raise(e,t)},z.readTmplToken=function(){for(var e=``,t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,`Unterminated template`);var n=this.input.charCodeAt(this.pos);if(n===96||n===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos!==this.start||this.type!==x.template&&this.type!==x.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(x.template,e)):n===36?(this.pos+=2,this.finishToken(x.dollarBraceL)):(++this.pos,this.finishToken(x.backQuote));if(n===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(w(n)){switch(e+=this.input.slice(t,this.pos),++this.pos,n){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
61
+ `;break;default:e+=String.fromCharCode(n)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else ++this.pos}},z.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case`\\`:++this.pos;break;case`$`:if(this.input[this.pos+1]!==`{`)break;case"`":return this.finishToken(x.invalidTemplate,this.input.slice(this.start,this.pos));case`\r`:this.input[this.pos+1]===`
62
62
  `&&++this.pos;case`
63
- `:case`\u2028`:case`\u2029`:++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,`Unterminated template`)},B.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
64
- `;case 114:return`\r`;case 120:return String.fromCharCode(this.readHexChar(2));case 117:return D(this.readCodePoint());case 116:return` `;case 98:return`\b`;case 118:return`\v`;case 102:return`\f`;case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),``;case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,`Invalid escape sequence`),e){var n=this.pos-1;this.invalidStringToken(n,`Invalid escape sequence in template string`)}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),r===`0`&&t!==56&&t!==57||!this.strict&&!e||this.invalidStringToken(this.pos-1-r.length,e?`Octal literal in template string`:`Octal literal in strict mode`),String.fromCharCode(i)}return w(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),``):String.fromCharCode(t)}},B.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,`Bad character escape sequence`),n},B.readWord1=function(){this.containsEsc=!1;for(var e=``,t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(m(i,r))this.pos+=i<=65535?1:2;else{if(i!==92)break;this.containsEsc=!0,e+=this.input.slice(n,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,`Expecting Unicode escape sequence \\uXXXX`),++this.pos;var o=this.readCodePoint();(t?p:m)(o,r)||this.invalidStringToken(a,`Invalid Unicode escape`),e+=D(o),n=this.pos}t=!1}return e+this.input.slice(n,this.pos)},B.readWord=function(){var e=this.readWord1(),t=x.name;return this.keywords.test(e)&&(t=y[e]),this.finishToken(t,e)},j.acorn={Parser:j,version:`8.15.0`,defaultOptions:k,Position:O,SourceLocation:le,getLineInfo:ue,Node:Me,TokenType:h,tokTypes:x,keywordTypes:y,TokContext:Te,tokContexts:I,isIdentifierChar:m,isIdentifierStart:p,Token:ct,isNewLine:w,lineBreak:S,lineBreakG:C,nonASCIIwhitespace:te};let V=N(`node:module`),dt=N(`node:fs`);String.fromCharCode;let ft=/\/$|\/\?|\/#/,pt=/^\.?\//;function mt(e=``,t){return t?ft.test(e):e.endsWith(`/`)}function ht(e=``,t){if(!t)return e.endsWith(`/`)?e:e+`/`;if(mt(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);if(i!==-1&&(n=e.slice(0,i),r=e.slice(i),!n))return r;let[a,...o]=n.split(`?`);return a+`/`+(o.length>0?`?${o.join(`?`)}`:``)+r}function gt(e){return e&&e!==`/`}function _t(e,...t){let n=e||``;for(let e of t.filter(e=>gt(e)))if(n){let t=e.replace(pt,``);n=ht(n)+t}else n=e;return n}let vt=/^[A-Za-z]:\//;function yt(e=``){return e&&e.replace(/\\/g,`/`).replace(vt,e=>e.toUpperCase())}let bt=/^[/\\]{2}/,xt=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,St=/^[A-Za-z]:$/,Ct=/.(\.[^./]+|\.)$/,H=function(e){if(e.length===0)return`.`;let t=(e=yt(e)).match(bt),n=Ot(e),r=e[e.length-1]===`/`;return(e=Dt(e,!n)).length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),St.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!Ot(e)?`/${e}`:e)},wt=function(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;t+=e&&r?n.slice(1):e||r?n:`/${n}`}else t+=n;return H(t)};function Tt(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}let Et=function(...e){let t=``,n=!1;for(let r=(e=e.map(e=>yt(e))).length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:Tt();i&&i.length!==0&&(t=`${i}/${t}`,n=Ot(i))}return t=Dt(t,!n),n&&!Ot(t)?`/${t}`:t.length>0?t:`.`};function Dt(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else{if(o===`/`)break;o=`/`}if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}let Ot=function(e){return xt.test(e)},kt=function(e){if(e===`..`)return``;let t=Ct.exec(yt(e));return t&&t[1]||``},At=function(e){let t=yt(e).replace(/\/$/,``).split(`/`).slice(0,-1);return t.length===1&&St.test(t[0])&&(t[0]+=`/`),t.join(`/`)||(Ot(e)?`/`:`.`)},jt=function(e,t){let n=yt(e).split(`/`),r=``;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t){r=t;break}}return t&&r.endsWith(t)?r.slice(0,-t.length):r},U=N(`node:url`),Mt=N(`node:assert`),Nt=N(`node:process`),Pt=N(`node:path`),Ft=N(`node:v8`),It=N(`node:util`),Lt=new Set(V.builtinModules);function Rt(e){return e.replace(/\\/g,`/`)}let zt={}.hasOwnProperty,Bt=/^([A-Z][a-z\d]*)+$/,Vt=new Set([`string`,`function`,`number`,`object`,`Function`,`Object`,`boolean`,`bigint`,`symbol`]),Ht={};function Ut(e,t=`and`){return e.length<3?e.join(` ${t} `):`${e.slice(0,-1).join(`, `)}, ${t} ${e[e.length-1]}`}let Wt=new Map,Gt;function Kt(e,t,n){return Wt.set(e,t),function(e,t){return n;function n(...n){let r=Error.stackTraceLimit;qt()&&(Error.stackTraceLimit=0);let i=new e;qt()&&(Error.stackTraceLimit=r);let a=function(e,t,n){let r=Wt.get(e);if(Mt(r!==void 0,"expected `message` to be found"),typeof r==`function`)return Mt(r.length<=t.length,`Code: ${e}; The provided arguments length (${t.length}) does not match the required ones (${r.length}).`),Reflect.apply(r,n,t);let i=/%[dfijoOs]/g,a=0;for(;i.exec(r)!==null;)a++;return Mt(a===t.length,`Code: ${e}; The provided arguments length (${t.length}) does not match the required ones (${a}).`),t.length===0?r:(t.unshift(r),Reflect.apply(It.format,null,t))}(t,n,i);return Object.defineProperties(i,{message:{value:a,enumerable:!1,writable:!0,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},enumerable:!1,writable:!0,configurable:!0}}),Jt(i),i.code=t,i}}(n,e)}function qt(){try{if(Ft.startupSnapshot.isBuildingSnapshot())return!1}catch{}let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):zt.call(e,`writable`)&&e.writable!==void 0?e.writable:e.set!==void 0}Ht.ERR_INVALID_ARG_TYPE=Kt(`ERR_INVALID_ARG_TYPE`,(e,t,n)=>{Mt(typeof e==`string`,`'name' must be a string`),Array.isArray(t)||(t=[t]);let r=`The `;if(e.endsWith(` argument`))r+=`${e} `;else{let t=e.includes(`.`)?`property`:`argument`;r+=`"${e}" ${t} `}r+=`must be `;let i=[],a=[],o=[];for(let e of t)Mt(typeof e==`string`,`All expected entries have to be of type string`),Vt.has(e)?i.push(e.toLowerCase()):Bt.exec(e)===null?(Mt(e!==`object`,`The value "object" should be written as "Object"`),o.push(e)):a.push(e);if(a.length>0){let e=i.indexOf(`object`);e!==-1&&(i.slice(e,1),a.push(`Object`))}return i.length>0&&(r+=`${i.length>1?`one of type`:`of type`} ${Ut(i,`or`)}`,(a.length>0||o.length>0)&&(r+=` or `)),a.length>0&&(r+=`an instance of ${Ut(a,`or`)}`,o.length>0&&(r+=` or `)),o.length>0&&(o.length>1?r+=`one of ${Ut(o,`or`)}`:(o[0].toLowerCase()!==o[0]&&(r+=`an `),r+=`${o[0]}`)),r+=`. Received ${function(e){if(e==null)return String(e);if(typeof e==`function`&&e.name)return`function ${e.name}`;if(typeof e==`object`)return e.constructor&&e.constructor.name?`an instance of ${e.constructor.name}`:`${(0,It.inspect)(e,{depth:-1})}`;let t=(0,It.inspect)(e,{colors:!1});return t.length>28&&(t=`${t.slice(0,25)}...`),`type ${typeof e} (${t})`}(n)}`,r},TypeError),Ht.ERR_INVALID_MODULE_SPECIFIER=Kt(`ERR_INVALID_MODULE_SPECIFIER`,(e,t,n=void 0)=>`Invalid module "${e}" ${t}${n?` imported from ${n}`:``}`,TypeError),Ht.ERR_INVALID_PACKAGE_CONFIG=Kt(`ERR_INVALID_PACKAGE_CONFIG`,(e,t,n)=>`Invalid package config ${e}${t?` while importing ${t}`:``}${n?`. ${n}`:``}`,Error),Ht.ERR_INVALID_PACKAGE_TARGET=Kt(`ERR_INVALID_PACKAGE_TARGET`,(e,t,n,r=!1,i=void 0)=>{let a=typeof n==`string`&&!r&&n.length>0&&!n.startsWith(`./`);return t===`.`?(Mt(!1===r),`Invalid "exports" main target ${JSON.stringify(n)} defined in the package config ${e}package.json${i?` imported from ${i}`:``}${a?`; targets must start with "./"`:``}`):`Invalid "${r?`imports`:`exports`}" target ${JSON.stringify(n)} defined for '${t}' in the package config ${e}package.json${i?` imported from ${i}`:``}${a?`; targets must start with "./"`:``}`},Error),Ht.ERR_MODULE_NOT_FOUND=Kt(`ERR_MODULE_NOT_FOUND`,(e,t,n=!1)=>`Cannot find ${n?`module`:`package`} '${e}' imported from ${t}`,Error),Ht.ERR_NETWORK_IMPORT_DISALLOWED=Kt(`ERR_NETWORK_IMPORT_DISALLOWED`,`import of '%s' by %s is not supported: %s`,Error),Ht.ERR_PACKAGE_IMPORT_NOT_DEFINED=Kt(`ERR_PACKAGE_IMPORT_NOT_DEFINED`,(e,t,n)=>`Package import specifier "${e}" is not defined${t?` in package ${t}package.json`:``} imported from ${n}`,TypeError),Ht.ERR_PACKAGE_PATH_NOT_EXPORTED=Kt(`ERR_PACKAGE_PATH_NOT_EXPORTED`,(e,t,n=void 0)=>t===`.`?`No "exports" main defined in ${e}package.json${n?` imported from ${n}`:``}`:`Package subpath '${t}' is not defined by "exports" in ${e}package.json${n?` imported from ${n}`:``}`,Error),Ht.ERR_UNSUPPORTED_DIR_IMPORT=Kt(`ERR_UNSUPPORTED_DIR_IMPORT`,`Directory import '%s' is not supported resolving ES modules imported from %s`,Error),Ht.ERR_UNSUPPORTED_RESOLVE_REQUEST=Kt(`ERR_UNSUPPORTED_RESOLVE_REQUEST`,`Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.`,TypeError),Ht.ERR_UNKNOWN_FILE_EXTENSION=Kt(`ERR_UNKNOWN_FILE_EXTENSION`,(e,t)=>`Unknown file extension "${e}" for ${t}`,TypeError),Ht.ERR_INVALID_ARG_VALUE=Kt(`ERR_INVALID_ARG_VALUE`,(e,t,n=`is invalid`)=>{let r=(0,It.inspect)(t);return r.length>128&&(r=`${r.slice(0,128)}...`),`The ${e.includes(`.`)?`property`:`argument`} '${e}' ${n}. Received ${r}`},TypeError);let Jt=function(e){let t=`__node_internal_`+e.name;return Object.defineProperty(e,`name`,{value:t}),e}(function(e){let t=qt();return t&&(Gt=Error.stackTraceLimit,Error.stackTraceLimit=1/0),Error.captureStackTrace(e),t&&(Error.stackTraceLimit=Gt),e}),Yt={}.hasOwnProperty,{ERR_INVALID_PACKAGE_CONFIG:Xt}=Ht,Zt=new Map;function Qt(e,{base:t,specifier:n}){let r=Zt.get(e);if(r)return r;let i;try{i=dt.readFileSync(Pt.toNamespacedPath(e),`utf8`)}catch(e){let t=e;if(t.code!==`ENOENT`)throw t}let a={exists:!1,pjsonPath:e,main:void 0,name:void 0,type:`none`,exports:void 0,imports:void 0};if(i!==void 0){let r;try{r=JSON.parse(i)}catch(r){let i=r,a=new Xt(e,(t?`"${n}" from `:``)+(0,U.fileURLToPath)(t||n),i.message);throw a.cause=i,a}a.exists=!0,Yt.call(r,`name`)&&typeof r.name==`string`&&(a.name=r.name),Yt.call(r,`main`)&&typeof r.main==`string`&&(a.main=r.main),Yt.call(r,`exports`)&&(a.exports=r.exports),Yt.call(r,`imports`)&&(a.imports=r.imports),!Yt.call(r,`type`)||r.type!==`commonjs`&&r.type!==`module`||(a.type=r.type)}return Zt.set(e,a),a}function $t(e){let t=new URL(`package.json`,e);for(;!t.pathname.endsWith(`node_modules/package.json`);){let n=Qt((0,U.fileURLToPath)(t),{specifier:e});if(n.exists)return n;let r=t;if(t=new URL(`../package.json`,t),t.pathname===r.pathname)break}return{pjsonPath:(0,U.fileURLToPath)(t),exists:!1,type:`none`}}function en(e){return $t(e).type}let{ERR_UNKNOWN_FILE_EXTENSION:tn}=Ht,nn={}.hasOwnProperty,rn={__proto__:null,".cjs":`commonjs`,".js":`module`,".json":`json`,".mjs":`module`},an={__proto__:null,"data:":function(e){let{1:t}=/^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(e.pathname)||[null,null,null];return function(e){return e&&/\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(e)?`module`:e===`application/json`?`json`:null}(t)},"file:":function(e,t,n){let r=function(e){let t=e.pathname,n=t.length;for(;n--;){let e=t.codePointAt(n);if(e===47)return``;if(e===46)return t.codePointAt(n-1)===47?``:t.slice(n)}return``}(e);if(r===`.js`){let t=en(e);return t===`none`?`commonjs`:t}if(r===``){let t=en(e);return t===`none`||t===`commonjs`?`commonjs`:`module`}let i=rn[r];if(i)return i;if(!n)throw new tn(r,(0,U.fileURLToPath)(e))},"http:":on,"https:":on,"node:":()=>`builtin`};function on(){}let sn=RegExp.prototype[Symbol.replace],{ERR_INVALID_MODULE_SPECIFIER:cn,ERR_INVALID_PACKAGE_CONFIG:ln,ERR_INVALID_PACKAGE_TARGET:un,ERR_MODULE_NOT_FOUND:dn,ERR_PACKAGE_IMPORT_NOT_DEFINED:fn,ERR_PACKAGE_PATH_NOT_EXPORTED:pn,ERR_UNSUPPORTED_DIR_IMPORT:mn,ERR_UNSUPPORTED_RESOLVE_REQUEST:hn}=Ht,gn={}.hasOwnProperty,_n=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i,vn=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i,yn=/^\.|%|\\/,bn=/\*/g,xn=/%2f|%5c/i,Sn=new Set,Cn=/[/\\]{2}/;function wn(e,t,n,r,i,a,o){if(Nt.noDeprecation)return;let s=(0,U.fileURLToPath)(r),c=Cn.exec(o?e:t)!==null;Nt.emitWarning(`Use of deprecated ${c?`double slash`:`leading or trailing slash matching`} resolving "${e}" for module request "${t}" ${t===n?``:`matched to "${n}" `}in the "${i?`imports`:`exports`}" field module resolution of the package at ${s}${a?` imported from ${(0,U.fileURLToPath)(a)}`:``}.`,`DeprecationWarning`,`DEP0166`)}function Tn(e,t,n,r){if(Nt.noDeprecation||function(e,t){let n=e.protocol;return nn.call(an,n)&&an[n](e,t,!0)||null}(e,{parentURL:n.href})!==`module`)return;let i=(0,U.fileURLToPath)(e.href),a=(0,U.fileURLToPath)(new U.URL(`.`,t)),o=(0,U.fileURLToPath)(n);r?Pt.resolve(a,r)!==i&&Nt.emitWarning(`Package ${a} has a "main" field set to "${r}", excluding the full filename and extension to the resolved file at "${i.slice(a.length)}", imported from ${o}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`,`DeprecationWarning`,`DEP0151`):Nt.emitWarning(`No "main" or "exports" field defined in the package.json for ${a} resolving the main entry point "${i.slice(a.length)}", imported from ${o}.\nDefault "index" lookups for the main are deprecated for ES modules.`,`DeprecationWarning`,`DEP0151`)}function En(e){try{return(0,dt.statSync)(e)}catch{}}function Dn(e){let t=(0,dt.statSync)(e,{throwIfNoEntry:!1}),n=t?t.isFile():void 0;return n!=null&&n}function On(e,t,n){let r;if(t.main!==void 0){if(r=new U.URL(t.main,e),Dn(r))return r;let i=[`./${t.main}.js`,`./${t.main}.json`,`./${t.main}.node`,`./${t.main}/index.js`,`./${t.main}/index.json`,`./${t.main}/index.node`],a=-1;for(;++a<i.length&&(r=new U.URL(i[a],e),!Dn(r));)r=void 0;if(r)return Tn(r,e,n,t.main),r}let i=[`./index.js`,`./index.json`,`./index.node`],a=-1;for(;++a<i.length&&(r=new U.URL(i[a],e),!Dn(r));)r=void 0;if(r)return Tn(r,e,n,t.main),r;throw new dn((0,U.fileURLToPath)(new U.URL(`.`,e)),(0,U.fileURLToPath)(n))}function kn(e,t,n){return new pn((0,U.fileURLToPath)(new U.URL(`.`,t)),e,n&&(0,U.fileURLToPath)(n))}function An(e,t,n,r,i){return t=typeof t==`object`&&t?JSON.stringify(t,null,``):`${t}`,new un((0,U.fileURLToPath)(new U.URL(`.`,n)),e,t,r,i&&(0,U.fileURLToPath)(i))}function jn(e,t,n,r,i,a,o,s,c){if(t!==``&&!a&&e[e.length-1]!==`/`)throw An(n,e,r,o,i);if(!e.startsWith(`./`)){if(o&&!e.startsWith(`../`)&&!e.startsWith(`/`)){let n=!1;try{new U.URL(e),n=!0}catch{}if(!n)return Rn(a?sn.call(bn,e,()=>t):e+t,r,c)}throw An(n,e,r,o,i)}if(_n.exec(e.slice(2))!==null){if(vn.exec(e.slice(2))!==null)throw An(n,e,r,o,i);if(!s){let s=a?n.replace(`*`,()=>t):n+t;wn(a?sn.call(bn,e,()=>t):e,s,n,r,o,i,!0)}}let l=new U.URL(e,r),u=l.pathname,d=new U.URL(`.`,r).pathname;if(!u.startsWith(d))throw An(n,e,r,o,i);if(t===``)return l;if(_n.exec(t)!==null){let c=a?n.replace(`*`,()=>t):n+t;vn.exec(t)===null?s||wn(a?sn.call(bn,e,()=>t):e,c,n,r,o,i,!1):(function(e,t,n,r,i){throw new cn(e,`request is not a valid match in pattern "${t}" for the "${r?`imports`:`exports`}" resolution of ${(0,U.fileURLToPath)(n)}`,i&&(0,U.fileURLToPath)(i))})(c,n,r,o,i)}return a?new U.URL(sn.call(bn,l.href,()=>t)):new U.URL(t,l)}function Mn(e){let t=Number(e);return`${t}`===e&&t>=0&&t<4294967295}function Nn(e,t,n,r,i,a,o,s,c){if(typeof t==`string`)return jn(t,n,r,e,i,a,o,s,c);if(Array.isArray(t)){let l=t;if(l.length===0)return null;let u,d=-1;for(;++d<l.length;){let t=l[d],f;try{f=Nn(e,t,n,r,i,a,o,s,c)}catch(e){if(u=e,e.code===`ERR_INVALID_PACKAGE_TARGET`)continue;throw e}if(f!==void 0){if(f!==null)return f;u=null}}if(u==null)return null;throw u}if(typeof t==`object`&&t){let l=Object.getOwnPropertyNames(t),u=-1;for(;++u<l.length;)if(Mn(l[u]))throw new ln((0,U.fileURLToPath)(e),i,`"exports" cannot contain numeric property keys.`);for(u=-1;++u<l.length;){let d=l[u];if(d===`default`||c&&c.has(d)){let l=Nn(e,t[d],n,r,i,a,o,s,c);if(l===void 0)continue;return l}}return null}if(t===null)return null;throw An(r,t,e,o,i)}function Pn(e,t,n){if(Nt.noDeprecation)return;let r=(0,U.fileURLToPath)(t);Sn.has(r+`|`+e)||(Sn.add(r+`|`+e),Nt.emitWarning(`Use of deprecated trailing slash pattern mapping "${e}" in the "exports" field module resolution of the package at ${r}${n?` imported from ${(0,U.fileURLToPath)(n)}`:``}. Mapping specifiers ending in "/" is no longer supported.`,`DeprecationWarning`,`DEP0155`))}function Fn(e,t,n,r,i){let a=n.exports;if(function(e,t,n){if(typeof e==`string`||Array.isArray(e))return!0;if(typeof e!=`object`||!e)return!1;let r=Object.getOwnPropertyNames(e),i=!1,a=0,o=-1;for(;++o<r.length;){let e=r[o],s=e===``||e[0]!==`.`;if(a++===0)i=s;else if(i!==s)throw new ln((0,U.fileURLToPath)(t),n,`"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`)}return i}(a,e,r)&&(a={".":a}),gn.call(a,t)&&!t.includes(`*`)&&!t.endsWith(`/`)){let n=Nn(e,a[t],``,t,r,!1,!1,!1,i);if(n==null)throw kn(t,e,r);return n}let o=``,s=``,c=Object.getOwnPropertyNames(a),l=-1;for(;++l<c.length;){let n=c[l],i=n.indexOf(`*`);if(i!==-1&&t.startsWith(n.slice(0,i))){t.endsWith(`/`)&&Pn(t,e,r);let a=n.slice(i+1);t.length>=n.length&&t.endsWith(a)&&In(o,n)===1&&n.lastIndexOf(`*`)===i&&(o=n,s=t.slice(i,t.length-a.length))}}if(o){let n=Nn(e,a[o],s,o,r,!0,!1,t.endsWith(`/`),i);if(n==null)throw kn(t,e,r);return n}throw kn(t,e,r)}function In(e,t){let n=e.indexOf(`*`),r=t.indexOf(`*`),i=n===-1?e.length:n+1,a=r===-1?t.length:r+1;return i>a?-1:a>i||n===-1?1:r===-1||e.length>t.length?-1:t.length>e.length?1:0}function Ln(e,t,n){if(e===`#`||e.startsWith(`#/`)||e.endsWith(`/`))throw new cn(e,`is not a valid internal imports specifier name`,(0,U.fileURLToPath)(t));let r,i=$t(t);if(i.exists){r=(0,U.pathToFileURL)(i.pjsonPath);let a=i.imports;if(a)if(gn.call(a,e)&&!e.includes(`*`)){let i=Nn(r,a[e],``,e,t,!1,!0,!1,n);if(i!=null)return i}else{let i=``,o=``,s=Object.getOwnPropertyNames(a),c=-1;for(;++c<s.length;){let t=s[c],n=t.indexOf(`*`);if(n!==-1&&e.startsWith(t.slice(0,-1))){let r=t.slice(n+1);e.length>=t.length&&e.endsWith(r)&&In(i,t)===1&&t.lastIndexOf(`*`)===n&&(i=t,o=e.slice(n,e.length-r.length))}}if(i){let e=Nn(r,a[i],o,i,t,!0,!0,!1,n);if(e!=null)return e}}}throw function(e,t,n){return new fn(e,t&&(0,U.fileURLToPath)(new U.URL(`.`,t)),(0,U.fileURLToPath)(n))}(e,r,t)}function Rn(e,t,n){if(V.builtinModules.includes(e))return new U.URL(`node:`+e);let{packageName:r,packageSubpath:i,isScoped:a}=function(e,t){let n=e.indexOf(`/`),r=!0,i=!1;e[0]===`@`&&(i=!0,n===-1||e.length===0?r=!1:n=e.indexOf(`/`,n+1));let a=n===-1?e:e.slice(0,n);if(yn.exec(a)!==null&&(r=!1),!r)throw new cn(e,`is not a valid package name`,(0,U.fileURLToPath)(t));return{packageName:a,packageSubpath:`.`+(n===-1?``:e.slice(n)),isScoped:i}}(e,t),o=$t(t);if(o.exists){let e=(0,U.pathToFileURL)(o.pjsonPath);if(o.name===r&&o.exports!==void 0&&o.exports!==null)return Fn(e,i,o,t,n)}let s,c=new U.URL(`./node_modules/`+r+`/package.json`,t),l=(0,U.fileURLToPath)(c);do{let o=En(l.slice(0,-13));if(!o||!o.isDirectory()){s=l,c=new U.URL((a?`../../../../node_modules/`:`../../../node_modules/`)+r+`/package.json`,c),l=(0,U.fileURLToPath)(c);continue}let u=Qt(l,{base:t,specifier:e});return u.exports!==void 0&&u.exports!==null?Fn(c,i,u,t,n):i===`.`?On(c,u,t):new U.URL(i,c)}while(l.length!==s.length);throw new dn(r,(0,U.fileURLToPath)(t),!1)}function zn(e,t,n,r){let i=t.protocol,a=i===`data:`||i===`http:`||i===`https:`,o;if(function(e){return e!==``&&(e[0]===`/`||function(e){return e[0]===`.`&&(e.length===1||e[1]===`/`||e[1]===`.`&&(e.length===2||e[2]===`/`))}(e))}(e))try{o=new U.URL(e,t)}catch(n){let r=new hn(e,t);throw r.cause=n,r}else if(i===`file:`&&e[0]===`#`)o=Ln(e,t,n);else try{o=new U.URL(e)}catch(r){if(a&&!V.builtinModules.includes(e)){let n=new hn(e,t);throw n.cause=r,n}o=Rn(e,t,n)}return Mt(o!==void 0,`expected to be defined`),o.protocol===`file:`?function(e,t){if(xn.exec(e.pathname)!==null)throw new cn(e.pathname,`must not include encoded "/" or "\\" characters`,(0,U.fileURLToPath)(t));let n;try{n=(0,U.fileURLToPath)(e)}catch(n){let r=n;throw Object.defineProperty(r,`input`,{value:String(e)}),Object.defineProperty(r,`module`,{value:String(t)}),r}let r=En(n.endsWith(`/`)?n.slice(-1):n);if(r&&r.isDirectory()){let r=new mn(n,(0,U.fileURLToPath)(t));throw r.url=String(e),r}if(!r||!r.isFile()){let r=new dn(n||e.pathname,t&&(0,U.fileURLToPath)(t),!0);throw r.url=String(e),r}{let t=(0,dt.realpathSync)(n),{search:r,hash:i}=e;(e=(0,U.pathToFileURL)(t+(n.endsWith(Pt.sep)?`/`:``))).search=r,e.hash=i}return e}(o,t):o}function Bn(e){return typeof e!=`string`||e.startsWith(`file://`)?Rt((0,U.fileURLToPath)(e)):Rt(e)}function Vn(e){return(0,U.pathToFileURL)(Bn(e)).toString()}let Hn=new Set([`node`,`import`]),Un=[`.mjs`,`.cjs`,`.js`,`.json`],Wn=new Set([`ERR_MODULE_NOT_FOUND`,`ERR_UNSUPPORTED_DIR_IMPORT`,`MODULE_NOT_FOUND`,`ERR_PACKAGE_PATH_NOT_EXPORTED`]);function Gn(e,t,n){try{return zn(e,t,n)}catch(e){if(!Wn.has(e?.code))throw e}}function Kn(e,t={}){if(typeof e!=`string`){if(!(e instanceof URL))throw TypeError("input must be a `string` or `URL`");e=Bn(e)}if(/(?:node|data|http|https):/.test(e))return e;if(Lt.has(e))return`node:`+e;if(e.startsWith(`file://`)&&(e=Bn(e)),Ot(e))try{if((0,dt.statSync)(e).isFile())return Vn(e)}catch(e){if(e?.code!==`ENOENT`)throw e}let n=t.conditions?new Set(t.conditions):Hn,r=(Array.isArray(t.url)?t.url:[t.url]).filter(Boolean).map(e=>new URL(function(e){return typeof e!=`string`&&(e=e.toString()),/(?:node|data|http|https|file):/.test(e)?e:Lt.has(e)?`node:`+e:`file://`+encodeURI(Rt(e))}(e.toString())));r.length===0&&r.push(new URL(Vn(process.cwd())));let i=[...r];for(let e of r)e.protocol===`file:`&&i.push(new URL(`./`,e),new URL(_t(e.pathname,`_index.js`),e),new URL(`node_modules`,e));let a;for(let r of i){if(a=Gn(e,r,n),a)break;for(let i of[``,`/index`]){for(let o of t.extensions||Un)if(a=Gn(_t(e,i)+o,r,n),a)break;if(a)break}if(a)break}if(!a){let t=Error(`Cannot find module ${e} imported from ${i.join(`, `)}`);throw t.code=`ERR_MODULE_NOT_FOUND`,t}return Vn(a)}function qn(e,t){return Kn(e,t)}function Jn(e,t){return Bn(qn(e,t))}let Yn=/(?:[\s;]|^)(?:import[\s\w*,{}]*from|import\s*["'*{]|export\b\s*(?:[*{]|default|class|type|function|const|var|let|async function)|import\.meta\b)/m,Xn=/\/\*.+?\*\/|\/\/.*(?=[nr])/g;function Zn(e,t={}){return t.stripComments&&(e=e.replace(Xn,``)),Yn.test(e)}function Qn(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}let $n=new Set([`/`,`\\`,void 0]),er=Symbol.for(`pathe:normalizedAlias`),tr=/[/\\]/;function nr(e){if(e[er])return e;let t=Object.fromEntries(Object.entries(e).sort(([e],[t])=>function(e,t){return t.split(`/`).length-e.split(`/`).length}(e,t)));for(let e in t)for(let n in t)n===e||e.startsWith(n)||t[e]?.startsWith(n)&&$n.has(t[e][n.length])&&(t[e]=t[n]+t[e].slice(n.length));return Object.defineProperty(t,er,{value:!0,enumerable:!1}),t}function rr(e=`/`){let t=e[e.length-1];return t===`/`||t===`\\`}var ir={rE:`2.6.1`};let ar=N(`node:crypto`);var or=r.n(ar);let sr=Object.create(null),cr=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?sr:globalThis),lr=new Proxy(sr,{get:(e,t)=>cr()[t]??sr[t],has:(e,t)=>t in cr()||t in sr,set:(e,t,n)=>(cr(!0)[t]=n,!0),deleteProperty(e,t){return t?(delete cr(!0)[t],!0):!1},ownKeys(){let e=cr(!0);return Object.keys(e)}}),ur=typeof process<`u`&&process.env&&process.env.NODE_ENV||``,dr=[[`APPVEYOR`],[`AWS_AMPLIFY`,`AWS_APP_ID`,{ci:!0}],[`AZURE_PIPELINES`,`SYSTEM_TEAMFOUNDATIONCOLLECTIONURI`],[`AZURE_STATIC`,`INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN`],[`APPCIRCLE`,`AC_APPCIRCLE`],[`BAMBOO`,`bamboo_planKey`],[`BITBUCKET`,`BITBUCKET_COMMIT`],[`BITRISE`,`BITRISE_IO`],[`BUDDY`,`BUDDY_WORKSPACE_ID`],[`BUILDKITE`],[`CIRCLE`,`CIRCLECI`],[`CIRRUS`,`CIRRUS_CI`],[`CLOUDFLARE_PAGES`,`CF_PAGES`,{ci:!0}],[`CLOUDFLARE_WORKERS`,`WORKERS_CI`,{ci:!0}],[`CODEBUILD`,`CODEBUILD_BUILD_ARN`],[`CODEFRESH`,`CF_BUILD_ID`],[`DRONE`],[`DRONE`,`DRONE_BUILD_EVENT`],[`DSARI`],[`GITHUB_ACTIONS`],[`GITLAB`,`GITLAB_CI`],[`GITLAB`,`CI_MERGE_REQUEST_ID`],[`GOCD`,`GO_PIPELINE_LABEL`],[`LAYERCI`],[`HUDSON`,`HUDSON_URL`],[`JENKINS`,`JENKINS_URL`],[`MAGNUM`],[`NETLIFY`],[`NETLIFY`,`NETLIFY_LOCAL`,{ci:!1}],[`NEVERCODE`],[`RENDER`],[`SAIL`,`SAILCI`],[`SEMAPHORE`],[`SCREWDRIVER`],[`SHIPPABLE`],[`SOLANO`,`TDDIUM`],[`STRIDER`],[`TEAMCITY`,`TEAMCITY_VERSION`],[`TRAVIS`],[`VERCEL`,`NOW_BUILDER`],[`VERCEL`,`VERCEL`,{ci:!1}],[`VERCEL`,`VERCEL_ENV`,{ci:!1}],[`APPCENTER`,`APPCENTER_BUILD_ID`],[`CODESANDBOX`,`CODESANDBOX_SSE`,{ci:!1}],[`CODESANDBOX`,`CODESANDBOX_HOST`,{ci:!1}],[`STACKBLITZ`],[`STORMKIT`],[`CLEAVR`],[`ZEABUR`],[`CODESPHERE`,`CODESPHERE_APP_ID`,{ci:!0}],[`RAILWAY`,`RAILWAY_PROJECT_ID`],[`RAILWAY`,`RAILWAY_SERVICE_ID`],[`DENO-DEPLOY`,`DENO_DEPLOYMENT_ID`],[`FIREBASE_APP_HOSTING`,`FIREBASE_APP_HOSTING`,{ci:!0}]],fr=function(){if(globalThis.process?.env)for(let e of dr){let t=e[1]||e[0];if(globalThis.process?.env[t])return{name:e[0].toLowerCase(),...e[2]}}return globalThis.process?.env?.SHELL===`/bin/jsh`&&globalThis.process?.versions?.webcontainer?{name:`stackblitz`,ci:!1}:{name:``,ci:!1}}();fr.name;function pr(e){return!!e&&e!==`false`}let mr=globalThis.process?.platform||``;pr(lr.CI)||fr.ci;let hr=pr(globalThis.process?.stdout&&globalThis.process?.stdout.isTTY);lr.DEBUG,ur===`test`||lr.TEST;let gr=(lr.MINIMAL,/^win/i.test(mr)),_r=(/^linux/i.test(mr),/^darwin/i.test(mr),!pr(lr.NO_COLOR)&&(pr(lr.FORCE_COLOR)||(hr||gr)&&lr.TERM),(globalThis.process?.versions?.node||``).replace(/^v/,``)||null),vr=(Number(_r?.split(`.`)[0]),globalThis.process||Object.create(null)),yr={versions:{}},br=(new Proxy(vr,{get:(e,t)=>t===`env`?lr:t in e?e[t]:t in yr?yr[t]:void 0}),globalThis.process?.release?.name===`node`),xr=!!globalThis.Bun||!!globalThis.process?.versions?.bun,Sr=!!globalThis.Deno,Cr=!!globalThis.fastly,wr=[[!!globalThis.Netlify,`netlify`],[!!globalThis.EdgeRuntime,`edge-light`],[globalThis.navigator?.userAgent===`Cloudflare-Workers`,`workerd`],[Cr,`fastly`],[Sr,`deno`],[xr,`bun`],[br,`node`]];(function(){let e=wr.find(e=>e[0]);e&&e[1]})();let Tr=N(`node:tty`)?.WriteStream?.prototype?.hasColors?.()??!1,W=(e,t)=>{if(!Tr)return e=>e;let n=`[${e}m`,r=`[${t}m`;return e=>{let i=e+``,a=i.indexOf(r);if(a===-1)return n+i+r;let o=n,s=0,c=(t===22?r:``)+n;for(;a!==-1;)o+=i.slice(s,a)+c,s=a+r.length,a=i.indexOf(r,s);return o+=i.slice(s)+r,o}},Er=(W(0,0),W(1,22),W(2,22),W(3,23),W(4,24),W(53,55),W(7,27),W(8,28),W(9,29),W(30,39),W(31,39)),Dr=W(32,39),Or=W(33,39),kr=W(34,39),Ar=(W(35,39),W(36,39)),jr=(W(37,39),W(90,39));W(40,49),W(41,49),W(42,49),W(43,49),W(44,49),W(45,49),W(46,49),W(47,49),W(100,49),W(91,39),W(92,39),W(93,39),W(94,39),W(95,39),W(96,39),W(97,39),W(101,49),W(102,49),W(103,49),W(104,49),W(105,49),W(106,49),W(107,49);function Mr(e){if(typeof e!=`string`||e.startsWith(`file://`))return!1;try{return(0,dt.lstatSync)(e).isDirectory()}catch{return!1}}function Nr(e,t=8){return(function(){if(Ir!==void 0)return Ir;try{return Ir=!!or().getFips?.(),Ir}catch{return Ir=!1,Ir}}()?or().createHash(`sha256`):or().createHash(`md5`)).update(e).digest(`hex`).slice(0,t)}let Pr={true:Dr(`true`),false:Or(`false`),"[rebuild]":Or(`[rebuild]`),"[esm]":kr(`[esm]`),"[cjs]":Dr(`[cjs]`),"[import]":kr(`[import]`),"[require]":Dr(`[require]`),"[native]":Ar(`[native]`),"[transpile]":Or(`[transpile]`),"[fallback]":Er(`[fallback]`),"[unknown]":Er(`[unknown]`),"[hit]":Dr(`[hit]`),"[miss]":Or(`[miss]`),"[json]":Dr(`[json]`),"[data]":Dr(`[data]`)};function G(e,...t){if(!e.opts.debug)return;let n=process.cwd();console.log(jr([`[jiti]`,...t.map(e=>e in Pr?Pr[e]:typeof e==`string`?e.replace(n,`.`):JSON.stringify(e))].join(` `)))}function Fr(e,t){return e.opts.interopDefault?function(e){let t=typeof e;if(e===null||t!==`object`&&t!==`function`)return e;let n=e.default,r=typeof n,i=n==null,a=r===`object`||r===`function`;return i&&e instanceof Promise?e:new Proxy(e,{get(t,r,o){if(r===`__esModule`)return!0;if(r===`default`)return i?e:typeof n?.default==`function`&&e.__esModule?n.default:n;if(Reflect.has(t,r))return Reflect.get(t,r,o);if(a&&!(n instanceof Promise)){let e=Reflect.get(n,r,o);return typeof e==`function`&&(e=e.bind(n)),e}},apply:(e,t,i)=>typeof e==`function`?Reflect.apply(e,t,i):r===`function`?Reflect.apply(n,t,i):void 0})}(t):t}let Ir;function Lr(e,t){return!!Rr(e,t)}function Rr(e,t){let n=process.env[e];if(!(e in process.env))return t;try{return JSON.parse(n)}catch{return t}}let zr=/\.(c|m)?j(sx?)$/,Br=/\.(c|m)?t(sx?)$/;function Vr(e,t,n){let r,i;if(e.isNativeRe.test(t))return t;e.alias&&(t=function(e,t){let n=yt(e);t=nr(t);for(let[e,r]of Object.entries(t))if(n.startsWith(e)&&rr(n[(rr(e)?e.slice(0,-1):e).length]))return wt(r,n.slice(e.length));return n}(t,e.alias));let a=n?.parentURL||e.url;Mr(a)&&(a=wt(a,`_index.js`));let o=(n?.async?[n?.conditions,[`node`,`import`],[`node`,`require`]]:[n?.conditions,[`node`,`require`],[`node`,`import`]]).filter(Boolean);for(let n of o){try{r=Jn(t,{url:a,conditions:n,extensions:e.opts.extensions})}catch(e){i=e}if(r)return r}try{return e.nativeRequire.resolve(t,{paths:n.paths})}catch(e){i=e}for(let i of e.additionalExts)if(r=Hr(e,t+i,a,n)||Hr(e,t+`/index`+i,a,n),r||(Br.test(e.filename)||Br.test(e.parentModule?.filename||``)||zr.test(t))&&(r=Hr(e,t.replace(zr,`.$1t$2`),a,n),r))return r;if(!n?.try)throw i}function Hr(e,t,n,r){try{return e.nativeRequire.resolve(t,{...r,paths:[At(Bn(n)),...r?.paths||[]]})}catch{}}let Ur=N(`node:perf_hooks`),Wr=N(`node:vm`);var Gr=r.n(Wr);function Kr(e,t,n){let r=e.parentCache||{};if(t.startsWith(`node:`))return qr(e,t,n.async);if(t.startsWith(`file:`))t=(0,U.fileURLToPath)(t);else if(t.startsWith(`data:`)){if(!n.async)throw Error("`data:` URLs are only supported in ESM context. Use `import` or `jiti.import` instead.");return G(e,`[native]`,`[data]`,`[import]`,t),qr(e,t,!0)}if(V.builtinModules.includes(t)||t===`.pnp.js`)return qr(e,t,n.async);if(e.opts.tryNative&&!e.opts.transformOptions)try{if(!(t=Vr(e,t,n))&&n.try)return;if(G(e,`[try-native]`,n.async&&e.nativeImport?`[import]`:`[require]`,t),n.async&&e.nativeImport)return e.nativeImport(t).then(n=>(!1===e.opts.moduleCache&&delete e.nativeRequire.cache[t],Fr(e,n)));{let n=e.nativeRequire(t);return!1===e.opts.moduleCache&&delete e.nativeRequire.cache[t],Fr(e,n)}}catch(n){G(e,`[try-native] Using fallback for ${t} because of an error:`,n)}let i=Vr(e,t,n);if(!i&&n.try)return;let a=kt(i);if(a===`.json`){G(e,`[json]`,i);let t=e.nativeRequire(i);return t&&!(`default`in t)&&Object.defineProperty(t,`default`,{value:t,enumerable:!1}),t}if(a&&!e.opts.extensions.includes(a))return G(e,`[native]`,`[unknown]`,n.async?`[import]`:`[require]`,i),qr(e,i,n.async);if(e.isNativeRe.test(i))return G(e,`[native]`,n.async?`[import]`:`[require]`,i),qr(e,i,n.async);if(r[i])return Fr(e,r[i]?.exports);if(e.opts.moduleCache){let t=e.nativeRequire.cache[i];if(t?.loaded)return Fr(e,t.exports)}return Zr(e,(0,dt.readFileSync)(i,`utf8`),{id:t,filename:i,ext:a,cache:r,async:n.async})}function qr(e,t,n){return n&&e.nativeImport?e.nativeImport(function(e){return gr&&Ot(e)?Vn(e):e}(t)).then(t=>Fr(e,t)):Fr(e,e.nativeRequire(t))}function Jr(e,t,n){if(!e.opts.fsCache||!t.filename)return n();let r=` /* v9-${Nr(t.source,16)} */\n`,i=`${jt(At(t.filename))}-${function(e){let t=e.split(tr).pop();if(!t)return;let n=t.lastIndexOf(`.`);return n<=0?t:t.slice(0,n)}(t.filename)}`+(e.opts.sourceMaps?`+map`:``)+(t.interopDefault?`.i`:``)+`.${Nr(t.filename)}`+(t.async?`.mjs`:`.cjs`);t.jsx&&t.filename.endsWith(`x`)&&(i+=`x`);let a=e.opts.fsCache,o=wt(a,i);if(!e.opts.rebuildFsCache&&(0,dt.existsSync)(o)){let n=(0,dt.readFileSync)(o,`utf8`);if(n.endsWith(r))return G(e,`[cache]`,`[hit]`,t.filename,`~>`,o),n}G(e,`[cache]`,`[miss]`,t.filename);let s=n();return s.includes(`__JITI_ERROR__`)||((0,dt.writeFileSync)(o,s+r,`utf8`),G(e,`[cache]`,`[store]`,t.filename,`~>`,o)),s}function Yr(t){if(!0===t.opts.fsCache&&(t.opts.fsCache=function(t){let n=t.filename&&Et(t.filename,`../node_modules`);if(n&&(0,dt.existsSync)(n))return wt(n,`.cache/jiti`);let r=(0,e.tmpdir)();if(process.env.TMPDIR&&r===process.cwd()&&!process.env.JITI_RESPECT_TMPDIR_ENV){let t=process.env.TMPDIR;delete process.env.TMPDIR,r=(0,e.tmpdir)(),process.env.TMPDIR=t}return wt(r,`jiti`)}(t)),t.opts.fsCache)try{if((0,dt.mkdirSync)(t.opts.fsCache,{recursive:!0}),!function(e){try{return(0,dt.accessSync)(e,dt.constants.W_OK),!0}catch{return!1}}(t.opts.fsCache))throw Error(`directory is not writable!`)}catch(e){G(t,`Error creating cache directory at `,t.opts.fsCache,e),t.opts.fsCache=!1}}function Xr(e,t){let n=Jr(e,t,()=>{let n=e.opts.transform({...e.opts.transformOptions,babel:{...e.opts.sourceMaps?{sourceFileName:t.filename,sourceMaps:`inline`}:{},...e.opts.transformOptions?.babel},interopDefault:e.opts.interopDefault,...t});return n.error&&e.opts.debug&&G(e,n.error),n.code});return n.startsWith(`#!`)&&(n=`// `+n),n}function Zr(e,t,n={}){let r=n.id||(n.filename?jt(n.filename):`_jitiEval.${n.ext||(n.async?`mjs`:`js`)}`),i=n.filename||Vr(e,r,{async:n.async}),a=n.ext||kt(i),o=n.cache||e.parentCache||{},s=/\.[cm]?tsx?$/.test(a),c=a===`.mjs`||a===`.js`&&function(e){for(;e&&e!==`.`&&e!==`/`;){e=wt(e,`..`);try{let t=(0,dt.readFileSync)(wt(e,`package.json`),`utf8`);try{return JSON.parse(t)}catch{}break}catch{}}}(i)?.type===`module`,l=a===`.cjs`,u=n.forceTranspile??(!l&&!(c&&n.async)&&(s||c||e.isTransformRe.test(i)||Zn(t))),d=Ur.performance.now();if(u){t=Xr(e,{filename:i,source:t,ts:s,async:n.async??!1,jsx:e.opts.jsx});let r=Math.round(1e3*(Ur.performance.now()-d))/1e3;G(e,`[transpile]`,n.async?`[esm]`:`[cjs]`,i,`(${r}ms)`)}else{if(G(e,`[native]`,n.async?`[import]`:`[require]`,i),n.async)return Promise.resolve(qr(e,i,n.async)).catch(r=>(G(e,`Native import error:`,r),G(e,`[fallback]`,i),Zr(e,t,{...n,forceTranspile:!0})));try{return qr(e,i,n.async)}catch(r){G(e,`Native require error:`,r),G(e,`[fallback]`,i),t=Xr(e,{filename:i,source:t,ts:s,async:n.async??!1,jsx:e.opts.jsx})}}let f=new V.Module(i);f.filename=i,e.parentModule&&(f.parent=e.parentModule,Array.isArray(e.parentModule.children)&&!e.parentModule.children.includes(f)&&e.parentModule.children.push(f));let p=$r(i,e.opts,{parentModule:f,parentCache:o,nativeImport:e.nativeImport,onError:e.onError,createRequire:e.createRequire},!0),m;f.require=p,f.path=At(i),f.paths=V.Module._nodeModulePaths(f.path),o[i]=f,e.opts.moduleCache&&(e.nativeRequire.cache[i]=f);let h=function(e,t){return`(${t?.async?`async `:``}function (exports, require, module, __filename, __dirname, jitiImport, jitiESMResolve) { ${e}\n});`}(t,{async:n.async});try{m=Gr().runInThisContext(h,{filename:i,lineOffset:0,displayErrors:!1})}catch(t){t.name===`SyntaxError`&&n.async&&e.nativeImport?(G(e,`[esm]`,`[import]`,`[fallback]`,i),m=function(e,t){let n=`data:text/javascript;base64,${Buffer.from(`export default ${e}`).toString(`base64`)}`;return(...e)=>t(n).then(t=>t.default(...e))}(h,e.nativeImport)):(e.opts.moduleCache&&delete e.nativeRequire.cache[i],e.onError(t))}let g;try{g=m(f.exports,f.require,f,f.filename,At(f.filename),p.import,p.esmResolve)}catch(t){e.opts.moduleCache&&delete e.nativeRequire.cache[i],e.onError(t)}function _(){if(f.exports&&f.exports.__JITI_ERROR__){let{filename:t,line:n,column:r,code:i,message:a}=f.exports.__JITI_ERROR__,o=Error(`${i}: ${a} \n ${`${t}:${n}:${r}`}`);Error.captureStackTrace(o,Kr),e.onError(o)}return f.loaded=!0,Fr(e,f.exports)}return n.async?Promise.resolve(g).then(_):_()}let Qr=(0,e.platform)()===`win32`;function $r(e,t={},n,r=!1){let i=r?t:function(e){let t={fsCache:Lr(`JITI_FS_CACHE`,Lr(`JITI_CACHE`,!0)),rebuildFsCache:Lr(`JITI_REBUILD_FS_CACHE`,!1),moduleCache:Lr(`JITI_MODULE_CACHE`,Lr(`JITI_REQUIRE_CACHE`,!0)),debug:Lr(`JITI_DEBUG`,!1),sourceMaps:Lr(`JITI_SOURCE_MAPS`,!1),interopDefault:Lr(`JITI_INTEROP_DEFAULT`,!0),extensions:Rr(`JITI_EXTENSIONS`,[`.js`,`.mjs`,`.cjs`,`.ts`,`.tsx`,`.mts`,`.cts`,`.mtsx`,`.ctsx`]),alias:Rr(`JITI_ALIAS`,{}),nativeModules:Rr(`JITI_NATIVE_MODULES`,[]),transformModules:Rr(`JITI_TRANSFORM_MODULES`,[]),tryNative:Rr(`JITI_TRY_NATIVE`,`Bun`in globalThis),jsx:Lr(`JITI_JSX`,!1)};t.jsx&&t.extensions.push(`.jsx`,`.tsx`);let n={};return e.cache!==void 0&&(n.fsCache=e.cache),e.requireCache!==void 0&&(n.moduleCache=e.requireCache),{...t,...n,...e}}(t),a=i.alias&&Object.keys(i.alias).length>0?nr(i.alias||{}):void 0,o=[`typescript`,`jiti`,...i.nativeModules||[]],s=RegExp(`node_modules/(${o.map(e=>Qn(e)).join(`|`)})/`),c=[...i.transformModules||[]],l=RegExp(`node_modules/(${c.map(e=>Qn(e)).join(`|`)})/`);e||=process.cwd(),!r&&Mr(e)&&(e=wt(e,`_index.js`));let u=Vn(e),d=[...i.extensions].filter(e=>e!==`.js`),f=n.createRequire(Qr?e.replace(/\//g,`\\`):e),p={filename:e,url:u,opts:i,alias:a,nativeModules:o,transformModules:c,isNativeRe:s,isTransformRe:l,additionalExts:d,nativeRequire:f,onError:n.onError,parentModule:n.parentModule,parentCache:n.parentCache,nativeImport:n.nativeImport,createRequire:n.createRequire};return r||G(p,`[init]`,...[[`version:`,ir.rE],[`module-cache:`,i.moduleCache],[`fs-cache:`,i.fsCache],[`rebuild-fs-cache:`,i.rebuildFsCache],[`interop-defaults:`,i.interopDefault]].flat()),r||Yr(p),Object.assign(function(e){return Kr(p,e,{async:!1})},{cache:i.moduleCache?f.cache:Object.create(null),extensions:f.extensions,main:f.main,options:i,resolve:Object.assign(function(e){return Vr(p,e,{async:!1})},{paths:f.resolve.paths}),transform:e=>Xr(p,e),evalModule:(e,t)=>Zr(p,e,t),async import(e,t){let n=await Kr(p,e,{...t,async:!0});return t?.default?n?.default??n:n},esmResolve(e,t){typeof t==`string`&&(t={parentURL:t});let n=Vr(p,e,{parentURL:u,...t,async:!0});return!n||typeof n!=`string`||n.startsWith(`file://`)?n:Vn(n)}})}})(),t.exports=i.default})()}))(),1);function zr(e){throw e}const Br=e=>import(e);let Vr;function Hr(...t){return Vr||=e(import.meta.url)(`../dist/babel.cjs`),Vr(...t)}function Ur(t,n={}){return n.transform||(n={...n,transform:Hr}),(0,Rr.default)(t,n,{onError:zr,nativeImport:Br,createRequire:e})}const Wr=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,Gr=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Kr=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function qr(e,t){if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){Jr(e);return}return t}function Jr(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function Yr(e,t={}){if(typeof e!=`string`)return e;if(e[0]===`"`&&e[e.length-1]===`"`&&e.indexOf(`\\`)===-1)return e.slice(1,-1);let n=e.trim();if(n.length<=9)switch(n.toLowerCase()){case`true`:return!0;case`false`:return!1;case`undefined`:return;case`null`:return null;case`nan`:return NaN;case`infinity`:return 1/0;case`-infinity`:return-1/0}if(!Kr.test(e)){if(t.strict)throw SyntaxError(`[destr] Invalid JSON`);return e}try{if(Wr.test(e)||Gr.test(e)){if(t.strict)throw Error(`[destr] Possible prototype pollution`);return JSON.parse(e,qr)}return JSON.parse(e)}catch(n){if(t.strict)throw n;return e}}function Xr(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function Zr(e,t,n=`.`,r){if(!Xr(t))return Zr(e,{},n,r);let i=Object.assign({},t);for(let t in e){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:Xr(a)&&Xr(i[t])?i[t]=Zr(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function Qr(e){return(...t)=>t.reduce((t,n)=>Zr(t,n,``,e),{})}const $r=Qr();function ei(e){return e&&e.constructor&&typeof e.constructor.isBuffer==`function`&&e.constructor.isBuffer(e)}function ti(e){return e}function ni(e,t){t||={};let n=t.delimiter||`.`,r=t.maxDepth,i=t.transformKey||ti,a={};function o(e,s,c){c||=1,Object.keys(e).forEach(function(l){let u=e[l],d=t.safe&&Array.isArray(u),f=Object.prototype.toString.call(u),p=ei(u),m=f===`[object Object]`||f===`[object Array]`,h=s?s+n+i(l):i(l);if(!d&&!p&&m&&Object.keys(u).length&&(!t.maxDepth||c<r))return o(u,h,c+1);a[h]=u})}return o(e),a}function ri(e,t){t||={};let n=t.delimiter||`.`,r=t.overwrite||!1,i=t.transformKey||ti,a={};if(ei(e)||Object.prototype.toString.call(e)!==`[object Object]`)return e;function o(e){let n=Number(e);return isNaN(n)||e.indexOf(`.`)!==-1||t.object?e:n}function s(e,t,r){return Object.keys(r).reduce(function(t,i){return t[e+n+i]=r[i],t},t)}function c(e){let t=Object.prototype.toString.call(e),n=t===`[object Array]`,r=t===`[object Object]`;if(e){if(n)return!e.length;if(r)return!Object.keys(e).length}else return!0}return e=Object.keys(e).reduce(function(n,r){let i=Object.prototype.toString.call(e[r]);return!(i===`[object Object]`||i===`[object Array]`)||c(e[r])?(n[r]=e[r],n):s(r,n,ni(e[r],t))},{}),Object.keys(e).forEach(function(s){let c=s.split(n).map(i),l=o(c.shift()),u=o(c[0]),d=a;for(;u!==void 0;){if(l===`__proto__`)return;let e=Object.prototype.toString.call(d[l]),n=e===`[object Object]`||e===`[object Array]`;if(!r&&!n&&d[l]!==void 0)return;(r&&!n||!r&&d[l]==null)&&(d[l]=typeof u==`number`&&!t.object?[]:{}),d=d[l],c.length>0&&(l=o(c.shift()),u=o(c[0]))}d[l]=ri(e[s],t)}),a}const ii=/^\s*([^\s=]+)\s*=\s*(.*)?\s*$/,ai=/\n|\r|\r\n/,oi={name:`.conf`,dir:process.cwd(),flat:!1};function si(e){return typeof e==`string`&&(e={name:e}),{...oi,...e}}function ci(e,t={}){let n={},r=e.split(ai);for(let e of r){let t=e.match(ii);if(!t)continue;let r=t[1];if(!r||r===`__proto__`||r===`constructor`)continue;let i=Yr((t[2]||``).trim());if(r.endsWith(`[]`)){let e=r.slice(0,Math.max(0,r.length-2));n[e]=(n[e]||[]).concat(i);continue}n[r]=i}return t.flat?n:ri(n,{overwrite:!0})}function li(e,t){return x(e)?ci(ee(e,`utf8`),t):{}}function ui(e){return e=si(e),li(o(e.dir,e.name),e)}function di(e){return e=si(e),e.dir=process.env.XDG_CONFIG_HOME||_(),ui(e)}const fi=Symbol.for(`__confbox_fmt__`),pi=/^(\s+)/,mi=/(\s+)$/;function hi(e,t={}){return{sample:t.indent===void 0&&t.preserveIndentation!==!1&&e.slice(0,t?.sampleSize||1024),whiteSpace:t.preserveWhitespace===!1?void 0:{start:pi.exec(e)?.[0]||``,end:mi.exec(e)?.[0]||``}}}function gi(e,t,n){!t||typeof t!=`object`||Object.defineProperty(t,fi,{enumerable:!1,configurable:!0,writable:!0,value:hi(e,n)})}function _i(e,t=!1){let n=e.length,r=0,i=``,a=0,o=16,s=0,c=0,l=0,u=0,d=0;function f(t,n){let i=0,a=0;for(;i<t;){let t=e.charCodeAt(r);if(t>=48&&t<=57)a=a*16+t-48;else if(t>=65&&t<=70)a=a*16+t-65+10;else if(t>=97&&t<=102)a=a*16+t-97+10;else break;r++,i++}return i<t&&(a=-1),a}function p(e){r=e,i=``,a=0,o=16,d=0}function m(){let t=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&bi(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&bi(e.charCodeAt(r)))for(r++;r<e.length&&bi(e.charCodeAt(r));)r++;else return d=3,e.substring(t,r);let n=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&bi(e.charCodeAt(r))){for(r++;r<e.length&&bi(e.charCodeAt(r));)r++;n=r}else d=3;return e.substring(t,n)}function h(){let t=``,i=r;for(;;){if(r>=n){t+=e.substring(i,r),d=2;break}let a=e.charCodeAt(r);if(a===34){t+=e.substring(i,r),r++;break}if(a===92){if(t+=e.substring(i,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
65
- `;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=f(4);e>=0?t+=String.fromCharCode(e):d=4;break;default:d=5}i=r;continue}if(a>=0&&a<=31)if(yi(a)){t+=e.substring(i,r),d=2;break}else d=6;r++}return t}function g(){if(i=``,d=0,a=r,c=s,u=l,r>=n)return a=n,o=17;let t=e.charCodeAt(r);if(vi(t)){do r++,i+=String.fromCharCode(t),t=e.charCodeAt(r);while(vi(t));return o=15}if(yi(t))return r++,i+=String.fromCharCode(t),t===13&&e.charCodeAt(r)===10&&(r++,i+=`
66
- `),s++,l=r,o=14;switch(t){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,i=h(),o=10;case 47:let c=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!yi(e.charCodeAt(r));)r++;return i=e.substring(c,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;let t=n-1,a=!1;for(;r<t;){let t=e.charCodeAt(r);if(t===42&&e.charCodeAt(r+1)===47){r+=2,a=!0;break}r++,yi(t)&&(t===13&&e.charCodeAt(r)===10&&r++,s++,l=r)}return a||(r++,d=1),i=e.substring(c,r),o=13}return i+=String.fromCharCode(t),r++,o=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!bi(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;r<n&&_(t);)r++,t=e.charCodeAt(r);if(a!==r){switch(i=e.substring(a,r),i){case`true`:return o=8;case`false`:return o=9;case`null`:return o=7}return o=16}return i+=String.fromCharCode(t),r++,o=16}}function _(e){if(vi(e)||yi(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let e;do e=g();while(e>=12&&e<=15);return e}return{setPosition:p,getPosition:()=>r,scan:t?v:g,getToken:()=>o,getTokenValue:()=>i,getTokenOffset:()=>a,getTokenLength:()=>r-a,getTokenStartLine:()=>c,getTokenStartCharacter:()=>a-u,getTokenError:()=>d}}function vi(e){return e===32||e===9}function yi(e){return e===10||e===13}function bi(e){return e>=48&&e<=57}var xi;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(xi||={}),Array(20).fill(0).map((e,t)=>` `.repeat(t)),Array(200).fill(0).map((e,t)=>`
63
+ `:case`\u2028`:case`\u2029`:++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,`Unterminated template`)},z.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
64
+ `;case 114:return`\r`;case 120:return String.fromCharCode(this.readHexChar(2));case 117:return D(this.readCodePoint());case 116:return` `;case 98:return`\b`;case 118:return`\v`;case 102:return`\f`;case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),``;case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,`Invalid escape sequence`),e){var n=this.pos-1;this.invalidStringToken(n,`Invalid escape sequence in template string`)}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(r,8);return i>255&&(r=r.slice(0,-1),i=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),r===`0`&&t!==56&&t!==57||!this.strict&&!e||this.invalidStringToken(this.pos-1-r.length,e?`Octal literal in template string`:`Octal literal in strict mode`),String.fromCharCode(i)}return w(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),``):String.fromCharCode(t)}},z.readHexChar=function(e){var t=this.pos,n=this.readInt(16,e);return n===null&&this.invalidStringToken(t,`Bad character escape sequence`),n},z.readWord1=function(){this.containsEsc=!1;for(var e=``,t=!0,n=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(m(i,r))this.pos+=i<=65535?1:2;else{if(i!==92)break;this.containsEsc=!0,e+=this.input.slice(n,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,`Expecting Unicode escape sequence \\uXXXX`),++this.pos;var o=this.readCodePoint();(t?p:m)(o,r)||this.invalidStringToken(a,`Invalid Unicode escape`),e+=D(o),n=this.pos}t=!1}return e+this.input.slice(n,this.pos)},z.readWord=function(){var e=this.readWord1(),t=x.name;return this.keywords.test(e)&&(t=y[e]),this.finishToken(t,e)},ge.acorn={Parser:ge,version:`8.15.0`,defaultOptions:k,Position:O,SourceLocation:le,getLineInfo:ue,Node:Pe,TokenType:h,tokTypes:x,keywordTypes:y,TokContext:De,tokContexts:P,isIdentifierChar:m,isIdentifierStart:p,Token:lt,isNewLine:w,lineBreak:S,lineBreakG:C,nonASCIIwhitespace:te};let ft=j(`node:module`),B=j(`node:fs`);String.fromCharCode;let pt=/\/$|\/\?|\/#/,mt=/^\.?\//;function ht(e=``,t){return t?pt.test(e):e.endsWith(`/`)}function gt(e=``,t){if(!t)return e.endsWith(`/`)?e:e+`/`;if(ht(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);if(i!==-1&&(n=e.slice(0,i),r=e.slice(i),!n))return r;let[a,...o]=n.split(`?`);return a+`/`+(o.length>0?`?${o.join(`?`)}`:``)+r}function _t(e){return e&&e!==`/`}function vt(e,...t){let n=e||``;for(let e of t.filter(e=>_t(e)))if(n){let t=e.replace(mt,``);n=gt(n)+t}else n=e;return n}let yt=/^[A-Za-z]:\//;function bt(e=``){return e&&e.replace(/\\/g,`/`).replace(yt,e=>e.toUpperCase())}let xt=/^[/\\]{2}/,St=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,Ct=/^[A-Za-z]:$/,wt=/.(\.[^./]+|\.)$/,Tt=function(e){if(e.length===0)return`.`;let t=(e=bt(e)).match(xt),n=kt(e),r=e[e.length-1]===`/`;return(e=Ot(e,!n)).length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),Ct.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!kt(e)?`/${e}`:e)},V=function(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;t+=e&&r?n.slice(1):e||r?n:`/${n}`}else t+=n;return Tt(t)};function Et(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}let Dt=function(...e){let t=``,n=!1;for(let r=(e=e.map(e=>bt(e))).length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:Et();i&&i.length!==0&&(t=`${i}/${t}`,n=kt(i))}return t=Ot(t,!n),n&&!kt(t)?`/${t}`:t.length>0?t:`.`};function Ot(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else{if(o===`/`)break;o=`/`}if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}let kt=function(e){return St.test(e)},At=function(e){if(e===`..`)return``;let t=wt.exec(bt(e));return t&&t[1]||``},jt=function(e){let t=bt(e).replace(/\/$/,``).split(`/`).slice(0,-1);return t.length===1&&Ct.test(t[0])&&(t[0]+=`/`),t.join(`/`)||(kt(e)?`/`:`.`)},Mt=function(e,t){let n=bt(e).split(`/`),r=``;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t){r=t;break}}return t&&r.endsWith(t)?r.slice(0,-t.length):r},H=j(`node:url`),Nt=j(`node:assert`),Pt=j(`node:process`),Ft=j(`node:path`),It=j(`node:v8`),Lt=j(`node:util`),Rt=new Set(ft.builtinModules);function zt(e){return e.replace(/\\/g,`/`)}let Bt={}.hasOwnProperty,Vt=/^([A-Z][a-z\d]*)+$/,Ht=new Set([`string`,`function`,`number`,`object`,`Function`,`Object`,`boolean`,`bigint`,`symbol`]),Ut={};function Wt(e,t=`and`){return e.length<3?e.join(` ${t} `):`${e.slice(0,-1).join(`, `)}, ${t} ${e[e.length-1]}`}let Gt=new Map,Kt;function qt(e,t,n){return Gt.set(e,t),function(e,t){return n;function n(...n){let r=Error.stackTraceLimit;Jt()&&(Error.stackTraceLimit=0);let i=new e;Jt()&&(Error.stackTraceLimit=r);let a=function(e,t,n){let r=Gt.get(e);if(Nt(r!==void 0,"expected `message` to be found"),typeof r==`function`)return Nt(r.length<=t.length,`Code: ${e}; The provided arguments length (${t.length}) does not match the required ones (${r.length}).`),Reflect.apply(r,n,t);let i=/%[dfijoOs]/g,a=0;for(;i.exec(r)!==null;)a++;return Nt(a===t.length,`Code: ${e}; The provided arguments length (${t.length}) does not match the required ones (${a}).`),t.length===0?r:(t.unshift(r),Reflect.apply(Lt.format,null,t))}(t,n,i);return Object.defineProperties(i,{message:{value:a,enumerable:!1,writable:!0,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},enumerable:!1,writable:!0,configurable:!0}}),Yt(i),i.code=t,i}}(n,e)}function Jt(){try{if(It.startupSnapshot.isBuildingSnapshot())return!1}catch{}let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Bt.call(e,`writable`)&&e.writable!==void 0?e.writable:e.set!==void 0}Ut.ERR_INVALID_ARG_TYPE=qt(`ERR_INVALID_ARG_TYPE`,(e,t,n)=>{Nt(typeof e==`string`,`'name' must be a string`),Array.isArray(t)||(t=[t]);let r=`The `;if(e.endsWith(` argument`))r+=`${e} `;else{let t=e.includes(`.`)?`property`:`argument`;r+=`"${e}" ${t} `}r+=`must be `;let i=[],a=[],o=[];for(let e of t)Nt(typeof e==`string`,`All expected entries have to be of type string`),Ht.has(e)?i.push(e.toLowerCase()):Vt.exec(e)===null?(Nt(e!==`object`,`The value "object" should be written as "Object"`),o.push(e)):a.push(e);if(a.length>0){let e=i.indexOf(`object`);e!==-1&&(i.slice(e,1),a.push(`Object`))}return i.length>0&&(r+=`${i.length>1?`one of type`:`of type`} ${Wt(i,`or`)}`,(a.length>0||o.length>0)&&(r+=` or `)),a.length>0&&(r+=`an instance of ${Wt(a,`or`)}`,o.length>0&&(r+=` or `)),o.length>0&&(o.length>1?r+=`one of ${Wt(o,`or`)}`:(o[0].toLowerCase()!==o[0]&&(r+=`an `),r+=`${o[0]}`)),r+=`. Received ${function(e){if(e==null)return String(e);if(typeof e==`function`&&e.name)return`function ${e.name}`;if(typeof e==`object`)return e.constructor&&e.constructor.name?`an instance of ${e.constructor.name}`:`${(0,Lt.inspect)(e,{depth:-1})}`;let t=(0,Lt.inspect)(e,{colors:!1});return t.length>28&&(t=`${t.slice(0,25)}...`),`type ${typeof e} (${t})`}(n)}`,r},TypeError),Ut.ERR_INVALID_MODULE_SPECIFIER=qt(`ERR_INVALID_MODULE_SPECIFIER`,(e,t,n=void 0)=>`Invalid module "${e}" ${t}${n?` imported from ${n}`:``}`,TypeError),Ut.ERR_INVALID_PACKAGE_CONFIG=qt(`ERR_INVALID_PACKAGE_CONFIG`,(e,t,n)=>`Invalid package config ${e}${t?` while importing ${t}`:``}${n?`. ${n}`:``}`,Error),Ut.ERR_INVALID_PACKAGE_TARGET=qt(`ERR_INVALID_PACKAGE_TARGET`,(e,t,n,r=!1,i=void 0)=>{let a=typeof n==`string`&&!r&&n.length>0&&!n.startsWith(`./`);return t===`.`?(Nt(!1===r),`Invalid "exports" main target ${JSON.stringify(n)} defined in the package config ${e}package.json${i?` imported from ${i}`:``}${a?`; targets must start with "./"`:``}`):`Invalid "${r?`imports`:`exports`}" target ${JSON.stringify(n)} defined for '${t}' in the package config ${e}package.json${i?` imported from ${i}`:``}${a?`; targets must start with "./"`:``}`},Error),Ut.ERR_MODULE_NOT_FOUND=qt(`ERR_MODULE_NOT_FOUND`,(e,t,n=!1)=>`Cannot find ${n?`module`:`package`} '${e}' imported from ${t}`,Error),Ut.ERR_NETWORK_IMPORT_DISALLOWED=qt(`ERR_NETWORK_IMPORT_DISALLOWED`,`import of '%s' by %s is not supported: %s`,Error),Ut.ERR_PACKAGE_IMPORT_NOT_DEFINED=qt(`ERR_PACKAGE_IMPORT_NOT_DEFINED`,(e,t,n)=>`Package import specifier "${e}" is not defined${t?` in package ${t}package.json`:``} imported from ${n}`,TypeError),Ut.ERR_PACKAGE_PATH_NOT_EXPORTED=qt(`ERR_PACKAGE_PATH_NOT_EXPORTED`,(e,t,n=void 0)=>t===`.`?`No "exports" main defined in ${e}package.json${n?` imported from ${n}`:``}`:`Package subpath '${t}' is not defined by "exports" in ${e}package.json${n?` imported from ${n}`:``}`,Error),Ut.ERR_UNSUPPORTED_DIR_IMPORT=qt(`ERR_UNSUPPORTED_DIR_IMPORT`,`Directory import '%s' is not supported resolving ES modules imported from %s`,Error),Ut.ERR_UNSUPPORTED_RESOLVE_REQUEST=qt(`ERR_UNSUPPORTED_RESOLVE_REQUEST`,`Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.`,TypeError),Ut.ERR_UNKNOWN_FILE_EXTENSION=qt(`ERR_UNKNOWN_FILE_EXTENSION`,(e,t)=>`Unknown file extension "${e}" for ${t}`,TypeError),Ut.ERR_INVALID_ARG_VALUE=qt(`ERR_INVALID_ARG_VALUE`,(e,t,n=`is invalid`)=>{let r=(0,Lt.inspect)(t);return r.length>128&&(r=`${r.slice(0,128)}...`),`The ${e.includes(`.`)?`property`:`argument`} '${e}' ${n}. Received ${r}`},TypeError);let Yt=function(e){let t=`__node_internal_`+e.name;return Object.defineProperty(e,`name`,{value:t}),e}(function(e){let t=Jt();return t&&(Kt=Error.stackTraceLimit,Error.stackTraceLimit=1/0),Error.captureStackTrace(e),t&&(Error.stackTraceLimit=Kt),e}),Xt={}.hasOwnProperty,{ERR_INVALID_PACKAGE_CONFIG:Zt}=Ut,Qt=new Map;function $t(e,{base:t,specifier:n}){let r=Qt.get(e);if(r)return r;let i;try{i=B.readFileSync(Ft.toNamespacedPath(e),`utf8`)}catch(e){let t=e;if(t.code!==`ENOENT`)throw t}let a={exists:!1,pjsonPath:e,main:void 0,name:void 0,type:`none`,exports:void 0,imports:void 0};if(i!==void 0){let r;try{r=JSON.parse(i)}catch(r){let i=r,a=new Zt(e,(t?`"${n}" from `:``)+(0,H.fileURLToPath)(t||n),i.message);throw a.cause=i,a}a.exists=!0,Xt.call(r,`name`)&&typeof r.name==`string`&&(a.name=r.name),Xt.call(r,`main`)&&typeof r.main==`string`&&(a.main=r.main),Xt.call(r,`exports`)&&(a.exports=r.exports),Xt.call(r,`imports`)&&(a.imports=r.imports),!Xt.call(r,`type`)||r.type!==`commonjs`&&r.type!==`module`||(a.type=r.type)}return Qt.set(e,a),a}function en(e){let t=new URL(`package.json`,e);for(;!t.pathname.endsWith(`node_modules/package.json`);){let n=$t((0,H.fileURLToPath)(t),{specifier:e});if(n.exists)return n;let r=t;if(t=new URL(`../package.json`,t),t.pathname===r.pathname)break}return{pjsonPath:(0,H.fileURLToPath)(t),exists:!1,type:`none`}}function tn(e){return en(e).type}let{ERR_UNKNOWN_FILE_EXTENSION:nn}=Ut,rn={}.hasOwnProperty,an={__proto__:null,".cjs":`commonjs`,".js":`module`,".json":`json`,".mjs":`module`},on={__proto__:null,"data:":function(e){let{1:t}=/^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(e.pathname)||[null,null,null];return function(e){return e&&/\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(e)?`module`:e===`application/json`?`json`:null}(t)},"file:":function(e,t,n){let r=function(e){let t=e.pathname,n=t.length;for(;n--;){let e=t.codePointAt(n);if(e===47)return``;if(e===46)return t.codePointAt(n-1)===47?``:t.slice(n)}return``}(e);if(r===`.js`){let t=tn(e);return t===`none`?`commonjs`:t}if(r===``){let t=tn(e);return t===`none`||t===`commonjs`?`commonjs`:`module`}let i=an[r];if(i)return i;if(!n)throw new nn(r,(0,H.fileURLToPath)(e))},"http:":sn,"https:":sn,"node:":()=>`builtin`};function sn(){}let cn=RegExp.prototype[Symbol.replace],{ERR_INVALID_MODULE_SPECIFIER:ln,ERR_INVALID_PACKAGE_CONFIG:un,ERR_INVALID_PACKAGE_TARGET:dn,ERR_MODULE_NOT_FOUND:fn,ERR_PACKAGE_IMPORT_NOT_DEFINED:pn,ERR_PACKAGE_PATH_NOT_EXPORTED:mn,ERR_UNSUPPORTED_DIR_IMPORT:hn,ERR_UNSUPPORTED_RESOLVE_REQUEST:gn}=Ut,_n={}.hasOwnProperty,vn=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i,yn=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i,bn=/^\.|%|\\/,xn=/\*/g,Sn=/%2f|%5c/i,Cn=new Set,wn=/[/\\]{2}/;function Tn(e,t,n,r,i,a,o){if(Pt.noDeprecation)return;let s=(0,H.fileURLToPath)(r),c=wn.exec(o?e:t)!==null;Pt.emitWarning(`Use of deprecated ${c?`double slash`:`leading or trailing slash matching`} resolving "${e}" for module request "${t}" ${t===n?``:`matched to "${n}" `}in the "${i?`imports`:`exports`}" field module resolution of the package at ${s}${a?` imported from ${(0,H.fileURLToPath)(a)}`:``}.`,`DeprecationWarning`,`DEP0166`)}function En(e,t,n,r){if(Pt.noDeprecation||function(e,t){let n=e.protocol;return rn.call(on,n)&&on[n](e,t,!0)||null}(e,{parentURL:n.href})!==`module`)return;let i=(0,H.fileURLToPath)(e.href),a=(0,H.fileURLToPath)(new H.URL(`.`,t)),o=(0,H.fileURLToPath)(n);r?Ft.resolve(a,r)!==i&&Pt.emitWarning(`Package ${a} has a "main" field set to "${r}", excluding the full filename and extension to the resolved file at "${i.slice(a.length)}", imported from ${o}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`,`DeprecationWarning`,`DEP0151`):Pt.emitWarning(`No "main" or "exports" field defined in the package.json for ${a} resolving the main entry point "${i.slice(a.length)}", imported from ${o}.\nDefault "index" lookups for the main are deprecated for ES modules.`,`DeprecationWarning`,`DEP0151`)}function Dn(e){try{return(0,B.statSync)(e)}catch{}}function On(e){let t=(0,B.statSync)(e,{throwIfNoEntry:!1}),n=t?t.isFile():void 0;return n!=null&&n}function kn(e,t,n){let r;if(t.main!==void 0){if(r=new H.URL(t.main,e),On(r))return r;let i=[`./${t.main}.js`,`./${t.main}.json`,`./${t.main}.node`,`./${t.main}/index.js`,`./${t.main}/index.json`,`./${t.main}/index.node`],a=-1;for(;++a<i.length&&(r=new H.URL(i[a],e),!On(r));)r=void 0;if(r)return En(r,e,n,t.main),r}let i=[`./index.js`,`./index.json`,`./index.node`],a=-1;for(;++a<i.length&&(r=new H.URL(i[a],e),!On(r));)r=void 0;if(r)return En(r,e,n,t.main),r;throw new fn((0,H.fileURLToPath)(new H.URL(`.`,e)),(0,H.fileURLToPath)(n))}function An(e,t,n){return new mn((0,H.fileURLToPath)(new H.URL(`.`,t)),e,n&&(0,H.fileURLToPath)(n))}function jn(e,t,n,r,i){return t=typeof t==`object`&&t?JSON.stringify(t,null,``):`${t}`,new dn((0,H.fileURLToPath)(new H.URL(`.`,n)),e,t,r,i&&(0,H.fileURLToPath)(i))}function Mn(e,t,n,r,i,a,o,s,c){if(t!==``&&!a&&e[e.length-1]!==`/`)throw jn(n,e,r,o,i);if(!e.startsWith(`./`)){if(o&&!e.startsWith(`../`)&&!e.startsWith(`/`)){let n=!1;try{new H.URL(e),n=!0}catch{}if(!n)return zn(a?cn.call(xn,e,()=>t):e+t,r,c)}throw jn(n,e,r,o,i)}if(vn.exec(e.slice(2))!==null){if(yn.exec(e.slice(2))!==null)throw jn(n,e,r,o,i);if(!s){let s=a?n.replace(`*`,()=>t):n+t;Tn(a?cn.call(xn,e,()=>t):e,s,n,r,o,i,!0)}}let l=new H.URL(e,r),u=l.pathname,d=new H.URL(`.`,r).pathname;if(!u.startsWith(d))throw jn(n,e,r,o,i);if(t===``)return l;if(vn.exec(t)!==null){let c=a?n.replace(`*`,()=>t):n+t;yn.exec(t)===null?s||Tn(a?cn.call(xn,e,()=>t):e,c,n,r,o,i,!1):(function(e,t,n,r,i){throw new ln(e,`request is not a valid match in pattern "${t}" for the "${r?`imports`:`exports`}" resolution of ${(0,H.fileURLToPath)(n)}`,i&&(0,H.fileURLToPath)(i))})(c,n,r,o,i)}return a?new H.URL(cn.call(xn,l.href,()=>t)):new H.URL(t,l)}function Nn(e){let t=Number(e);return`${t}`===e&&t>=0&&t<4294967295}function Pn(e,t,n,r,i,a,o,s,c){if(typeof t==`string`)return Mn(t,n,r,e,i,a,o,s,c);if(Array.isArray(t)){let l=t;if(l.length===0)return null;let u,d=-1;for(;++d<l.length;){let t=l[d],f;try{f=Pn(e,t,n,r,i,a,o,s,c)}catch(e){if(u=e,e.code===`ERR_INVALID_PACKAGE_TARGET`)continue;throw e}if(f!==void 0){if(f!==null)return f;u=null}}if(u==null)return null;throw u}if(typeof t==`object`&&t){let l=Object.getOwnPropertyNames(t),u=-1;for(;++u<l.length;)if(Nn(l[u]))throw new un((0,H.fileURLToPath)(e),i,`"exports" cannot contain numeric property keys.`);for(u=-1;++u<l.length;){let d=l[u];if(d===`default`||c&&c.has(d)){let l=Pn(e,t[d],n,r,i,a,o,s,c);if(l===void 0)continue;return l}}return null}if(t===null)return null;throw jn(r,t,e,o,i)}function Fn(e,t,n){if(Pt.noDeprecation)return;let r=(0,H.fileURLToPath)(t);Cn.has(r+`|`+e)||(Cn.add(r+`|`+e),Pt.emitWarning(`Use of deprecated trailing slash pattern mapping "${e}" in the "exports" field module resolution of the package at ${r}${n?` imported from ${(0,H.fileURLToPath)(n)}`:``}. Mapping specifiers ending in "/" is no longer supported.`,`DeprecationWarning`,`DEP0155`))}function In(e,t,n,r,i){let a=n.exports;if(function(e,t,n){if(typeof e==`string`||Array.isArray(e))return!0;if(typeof e!=`object`||!e)return!1;let r=Object.getOwnPropertyNames(e),i=!1,a=0,o=-1;for(;++o<r.length;){let e=r[o],s=e===``||e[0]!==`.`;if(a++===0)i=s;else if(i!==s)throw new un((0,H.fileURLToPath)(t),n,`"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`)}return i}(a,e,r)&&(a={".":a}),_n.call(a,t)&&!t.includes(`*`)&&!t.endsWith(`/`)){let n=Pn(e,a[t],``,t,r,!1,!1,!1,i);if(n==null)throw An(t,e,r);return n}let o=``,s=``,c=Object.getOwnPropertyNames(a),l=-1;for(;++l<c.length;){let n=c[l],i=n.indexOf(`*`);if(i!==-1&&t.startsWith(n.slice(0,i))){t.endsWith(`/`)&&Fn(t,e,r);let a=n.slice(i+1);t.length>=n.length&&t.endsWith(a)&&Ln(o,n)===1&&n.lastIndexOf(`*`)===i&&(o=n,s=t.slice(i,t.length-a.length))}}if(o){let n=Pn(e,a[o],s,o,r,!0,!1,t.endsWith(`/`),i);if(n==null)throw An(t,e,r);return n}throw An(t,e,r)}function Ln(e,t){let n=e.indexOf(`*`),r=t.indexOf(`*`),i=n===-1?e.length:n+1,a=r===-1?t.length:r+1;return i>a?-1:a>i||n===-1?1:r===-1||e.length>t.length?-1:t.length>e.length?1:0}function Rn(e,t,n){if(e===`#`||e.startsWith(`#/`)||e.endsWith(`/`))throw new ln(e,`is not a valid internal imports specifier name`,(0,H.fileURLToPath)(t));let r,i=en(t);if(i.exists){r=(0,H.pathToFileURL)(i.pjsonPath);let a=i.imports;if(a)if(_n.call(a,e)&&!e.includes(`*`)){let i=Pn(r,a[e],``,e,t,!1,!0,!1,n);if(i!=null)return i}else{let i=``,o=``,s=Object.getOwnPropertyNames(a),c=-1;for(;++c<s.length;){let t=s[c],n=t.indexOf(`*`);if(n!==-1&&e.startsWith(t.slice(0,-1))){let r=t.slice(n+1);e.length>=t.length&&e.endsWith(r)&&Ln(i,t)===1&&t.lastIndexOf(`*`)===n&&(i=t,o=e.slice(n,e.length-r.length))}}if(i){let e=Pn(r,a[i],o,i,t,!0,!0,!1,n);if(e!=null)return e}}}throw function(e,t,n){return new pn(e,t&&(0,H.fileURLToPath)(new H.URL(`.`,t)),(0,H.fileURLToPath)(n))}(e,r,t)}function zn(e,t,n){if(ft.builtinModules.includes(e))return new H.URL(`node:`+e);let{packageName:r,packageSubpath:i,isScoped:a}=function(e,t){let n=e.indexOf(`/`),r=!0,i=!1;e[0]===`@`&&(i=!0,n===-1||e.length===0?r=!1:n=e.indexOf(`/`,n+1));let a=n===-1?e:e.slice(0,n);if(bn.exec(a)!==null&&(r=!1),!r)throw new ln(e,`is not a valid package name`,(0,H.fileURLToPath)(t));return{packageName:a,packageSubpath:`.`+(n===-1?``:e.slice(n)),isScoped:i}}(e,t),o=en(t);if(o.exists){let e=(0,H.pathToFileURL)(o.pjsonPath);if(o.name===r&&o.exports!==void 0&&o.exports!==null)return In(e,i,o,t,n)}let s,c=new H.URL(`./node_modules/`+r+`/package.json`,t),l=(0,H.fileURLToPath)(c);do{let o=Dn(l.slice(0,-13));if(!o||!o.isDirectory()){s=l,c=new H.URL((a?`../../../../node_modules/`:`../../../node_modules/`)+r+`/package.json`,c),l=(0,H.fileURLToPath)(c);continue}let u=$t(l,{base:t,specifier:e});return u.exports!==void 0&&u.exports!==null?In(c,i,u,t,n):i===`.`?kn(c,u,t):new H.URL(i,c)}while(l.length!==s.length);throw new fn(r,(0,H.fileURLToPath)(t),!1)}function Bn(e,t,n,r){let i=t.protocol,a=i===`data:`||i===`http:`||i===`https:`,o;if(function(e){return e!==``&&(e[0]===`/`||function(e){return e[0]===`.`&&(e.length===1||e[1]===`/`||e[1]===`.`&&(e.length===2||e[2]===`/`))}(e))}(e))try{o=new H.URL(e,t)}catch(n){let r=new gn(e,t);throw r.cause=n,r}else if(i===`file:`&&e[0]===`#`)o=Rn(e,t,n);else try{o=new H.URL(e)}catch(r){if(a&&!ft.builtinModules.includes(e)){let n=new gn(e,t);throw n.cause=r,n}o=zn(e,t,n)}return Nt(o!==void 0,`expected to be defined`),o.protocol===`file:`?function(e,t){if(Sn.exec(e.pathname)!==null)throw new ln(e.pathname,`must not include encoded "/" or "\\" characters`,(0,H.fileURLToPath)(t));let n;try{n=(0,H.fileURLToPath)(e)}catch(n){let r=n;throw Object.defineProperty(r,`input`,{value:String(e)}),Object.defineProperty(r,`module`,{value:String(t)}),r}let r=Dn(n.endsWith(`/`)?n.slice(-1):n);if(r&&r.isDirectory()){let r=new hn(n,(0,H.fileURLToPath)(t));throw r.url=String(e),r}if(!r||!r.isFile()){let r=new fn(n||e.pathname,t&&(0,H.fileURLToPath)(t),!0);throw r.url=String(e),r}{let t=(0,B.realpathSync)(n),{search:r,hash:i}=e;(e=(0,H.pathToFileURL)(t+(n.endsWith(Ft.sep)?`/`:``))).search=r,e.hash=i}return e}(o,t):o}function Vn(e){return typeof e!=`string`||e.startsWith(`file://`)?zt((0,H.fileURLToPath)(e)):zt(e)}function Hn(e){return(0,H.pathToFileURL)(Vn(e)).toString()}let Un=new Set([`node`,`import`]),Wn=[`.mjs`,`.cjs`,`.js`,`.json`],Gn=new Set([`ERR_MODULE_NOT_FOUND`,`ERR_UNSUPPORTED_DIR_IMPORT`,`MODULE_NOT_FOUND`,`ERR_PACKAGE_PATH_NOT_EXPORTED`]);function Kn(e,t,n){try{return Bn(e,t,n)}catch(e){if(!Gn.has(e?.code))throw e}}function qn(e,t={}){if(typeof e!=`string`){if(!(e instanceof URL))throw TypeError("input must be a `string` or `URL`");e=Vn(e)}if(/(?:node|data|http|https):/.test(e))return e;if(Rt.has(e))return`node:`+e;if(e.startsWith(`file://`)&&(e=Vn(e)),kt(e))try{if((0,B.statSync)(e).isFile())return Hn(e)}catch(e){if(e?.code!==`ENOENT`)throw e}let n=t.conditions?new Set(t.conditions):Un,r=(Array.isArray(t.url)?t.url:[t.url]).filter(Boolean).map(e=>new URL(function(e){return typeof e!=`string`&&(e=e.toString()),/(?:node|data|http|https|file):/.test(e)?e:Rt.has(e)?`node:`+e:`file://`+encodeURI(zt(e))}(e.toString())));r.length===0&&r.push(new URL(Hn(process.cwd())));let i=[...r];for(let e of r)e.protocol===`file:`&&i.push(new URL(`./`,e),new URL(vt(e.pathname,`_index.js`),e),new URL(`node_modules`,e));let a;for(let r of i){if(a=Kn(e,r,n),a)break;for(let i of[``,`/index`]){for(let o of t.extensions||Wn)if(a=Kn(vt(e,i)+o,r,n),a)break;if(a)break}if(a)break}if(!a){let t=Error(`Cannot find module ${e} imported from ${i.join(`, `)}`);throw t.code=`ERR_MODULE_NOT_FOUND`,t}return Hn(a)}function Jn(e,t){return qn(e,t)}function Yn(e,t){return Vn(Jn(e,t))}let Xn=/(?:[\s;]|^)(?:import[\s\w*,{}]*from|import\s*["'*{]|export\b\s*(?:[*{]|default|class|type|function|const|var|let|async function)|import\.meta\b)/m,Zn=/\/\*.+?\*\/|\/\/.*(?=[nr])/g;function Qn(e,t={}){return t.stripComments&&(e=e.replace(Zn,``)),Xn.test(e)}function $n(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}let er=new Set([`/`,`\\`,void 0]),tr=Symbol.for(`pathe:normalizedAlias`),nr=/[/\\]/;function rr(e){if(e[tr])return e;let t=Object.fromEntries(Object.entries(e).sort(([e],[t])=>function(e,t){return t.split(`/`).length-e.split(`/`).length}(e,t)));for(let e in t)for(let n in t)n===e||e.startsWith(n)||t[e]?.startsWith(n)&&er.has(t[e][n.length])&&(t[e]=t[n]+t[e].slice(n.length));return Object.defineProperty(t,tr,{value:!0,enumerable:!1}),t}function ir(e=`/`){let t=e[e.length-1];return t===`/`||t===`\\`}var ar={rE:`2.6.1`};let or=j(`node:crypto`);var sr=r.n(or);let cr=Object.create(null),lr=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?cr:globalThis),ur=new Proxy(cr,{get:(e,t)=>lr()[t]??cr[t],has:(e,t)=>t in lr()||t in cr,set:(e,t,n)=>(lr(!0)[t]=n,!0),deleteProperty(e,t){return t?(delete lr(!0)[t],!0):!1},ownKeys(){let e=lr(!0);return Object.keys(e)}}),dr=typeof process<`u`&&process.env&&process.env.NODE_ENV||``,fr=[[`APPVEYOR`],[`AWS_AMPLIFY`,`AWS_APP_ID`,{ci:!0}],[`AZURE_PIPELINES`,`SYSTEM_TEAMFOUNDATIONCOLLECTIONURI`],[`AZURE_STATIC`,`INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN`],[`APPCIRCLE`,`AC_APPCIRCLE`],[`BAMBOO`,`bamboo_planKey`],[`BITBUCKET`,`BITBUCKET_COMMIT`],[`BITRISE`,`BITRISE_IO`],[`BUDDY`,`BUDDY_WORKSPACE_ID`],[`BUILDKITE`],[`CIRCLE`,`CIRCLECI`],[`CIRRUS`,`CIRRUS_CI`],[`CLOUDFLARE_PAGES`,`CF_PAGES`,{ci:!0}],[`CLOUDFLARE_WORKERS`,`WORKERS_CI`,{ci:!0}],[`CODEBUILD`,`CODEBUILD_BUILD_ARN`],[`CODEFRESH`,`CF_BUILD_ID`],[`DRONE`],[`DRONE`,`DRONE_BUILD_EVENT`],[`DSARI`],[`GITHUB_ACTIONS`],[`GITLAB`,`GITLAB_CI`],[`GITLAB`,`CI_MERGE_REQUEST_ID`],[`GOCD`,`GO_PIPELINE_LABEL`],[`LAYERCI`],[`HUDSON`,`HUDSON_URL`],[`JENKINS`,`JENKINS_URL`],[`MAGNUM`],[`NETLIFY`],[`NETLIFY`,`NETLIFY_LOCAL`,{ci:!1}],[`NEVERCODE`],[`RENDER`],[`SAIL`,`SAILCI`],[`SEMAPHORE`],[`SCREWDRIVER`],[`SHIPPABLE`],[`SOLANO`,`TDDIUM`],[`STRIDER`],[`TEAMCITY`,`TEAMCITY_VERSION`],[`TRAVIS`],[`VERCEL`,`NOW_BUILDER`],[`VERCEL`,`VERCEL`,{ci:!1}],[`VERCEL`,`VERCEL_ENV`,{ci:!1}],[`APPCENTER`,`APPCENTER_BUILD_ID`],[`CODESANDBOX`,`CODESANDBOX_SSE`,{ci:!1}],[`CODESANDBOX`,`CODESANDBOX_HOST`,{ci:!1}],[`STACKBLITZ`],[`STORMKIT`],[`CLEAVR`],[`ZEABUR`],[`CODESPHERE`,`CODESPHERE_APP_ID`,{ci:!0}],[`RAILWAY`,`RAILWAY_PROJECT_ID`],[`RAILWAY`,`RAILWAY_SERVICE_ID`],[`DENO-DEPLOY`,`DENO_DEPLOYMENT_ID`],[`FIREBASE_APP_HOSTING`,`FIREBASE_APP_HOSTING`,{ci:!0}]],pr=function(){if(globalThis.process?.env)for(let e of fr){let t=e[1]||e[0];if(globalThis.process?.env[t])return{name:e[0].toLowerCase(),...e[2]}}return globalThis.process?.env?.SHELL===`/bin/jsh`&&globalThis.process?.versions?.webcontainer?{name:`stackblitz`,ci:!1}:{name:``,ci:!1}}();pr.name;function mr(e){return!!e&&e!==`false`}let hr=globalThis.process?.platform||``;mr(ur.CI)||pr.ci;let gr=mr(globalThis.process?.stdout&&globalThis.process?.stdout.isTTY);ur.DEBUG,dr===`test`||ur.TEST;let _r=(ur.MINIMAL,/^win/i.test(hr)),vr=(/^linux/i.test(hr),/^darwin/i.test(hr),!mr(ur.NO_COLOR)&&(mr(ur.FORCE_COLOR)||(gr||_r)&&ur.TERM),(globalThis.process?.versions?.node||``).replace(/^v/,``)||null),yr=(Number(vr?.split(`.`)[0]),globalThis.process||Object.create(null)),br={versions:{}},xr=(new Proxy(yr,{get:(e,t)=>t===`env`?ur:t in e?e[t]:t in br?br[t]:void 0}),globalThis.process?.release?.name===`node`),Sr=!!globalThis.Bun||!!globalThis.process?.versions?.bun,Cr=!!globalThis.Deno,wr=!!globalThis.fastly,Tr=[[!!globalThis.Netlify,`netlify`],[!!globalThis.EdgeRuntime,`edge-light`],[globalThis.navigator?.userAgent===`Cloudflare-Workers`,`workerd`],[wr,`fastly`],[Cr,`deno`],[Sr,`bun`],[xr,`node`]];(function(){let e=Tr.find(e=>e[0]);e&&e[1]})();let Er=j(`node:tty`)?.WriteStream?.prototype?.hasColors?.()??!1,U=(e,t)=>{if(!Er)return e=>e;let n=`[${e}m`,r=`[${t}m`;return e=>{let i=e+``,a=i.indexOf(r);if(a===-1)return n+i+r;let o=n,s=0,c=(t===22?r:``)+n;for(;a!==-1;)o+=i.slice(s,a)+c,s=a+r.length,a=i.indexOf(r,s);return o+=i.slice(s)+r,o}},Dr=(U(0,0),U(1,22),U(2,22),U(3,23),U(4,24),U(53,55),U(7,27),U(8,28),U(9,29),U(30,39),U(31,39)),Or=U(32,39),kr=U(33,39),Ar=U(34,39),jr=(U(35,39),U(36,39)),Mr=(U(37,39),U(90,39));U(40,49),U(41,49),U(42,49),U(43,49),U(44,49),U(45,49),U(46,49),U(47,49),U(100,49),U(91,39),U(92,39),U(93,39),U(94,39),U(95,39),U(96,39),U(97,39),U(101,49),U(102,49),U(103,49),U(104,49),U(105,49),U(106,49),U(107,49);function Nr(e){if(typeof e!=`string`||e.startsWith(`file://`))return!1;try{return(0,B.lstatSync)(e).isDirectory()}catch{return!1}}function Pr(e,t=8){return(function(){if(Rr!==void 0)return Rr;try{return Rr=!!sr().getFips?.(),Rr}catch{return Rr=!1,Rr}}()?sr().createHash(`sha256`):sr().createHash(`md5`)).update(e).digest(`hex`).slice(0,t)}let Fr={true:Or(`true`),false:kr(`false`),"[rebuild]":kr(`[rebuild]`),"[esm]":Ar(`[esm]`),"[cjs]":Or(`[cjs]`),"[import]":Ar(`[import]`),"[require]":Or(`[require]`),"[native]":jr(`[native]`),"[transpile]":kr(`[transpile]`),"[fallback]":Dr(`[fallback]`),"[unknown]":Dr(`[unknown]`),"[hit]":Or(`[hit]`),"[miss]":kr(`[miss]`),"[json]":Or(`[json]`),"[data]":Or(`[data]`)};function Ir(e,...t){if(!e.opts.debug)return;let n=process.cwd();console.log(Mr([`[jiti]`,...t.map(e=>e in Fr?Fr[e]:typeof e==`string`?e.replace(n,`.`):JSON.stringify(e))].join(` `)))}function Lr(e,t){return e.opts.interopDefault?function(e){let t=typeof e;if(e===null||t!==`object`&&t!==`function`)return e;let n=e.default,r=typeof n,i=n==null,a=r===`object`||r===`function`;return i&&e instanceof Promise?e:new Proxy(e,{get(t,r,o){if(r===`__esModule`)return!0;if(r===`default`)return i?e:typeof n?.default==`function`&&e.__esModule?n.default:n;if(Reflect.has(t,r))return Reflect.get(t,r,o);if(a&&!(n instanceof Promise)){let e=Reflect.get(n,r,o);return typeof e==`function`&&(e=e.bind(n)),e}},apply:(e,t,i)=>typeof e==`function`?Reflect.apply(e,t,i):r===`function`?Reflect.apply(n,t,i):void 0})}(t):t}let Rr;function zr(e,t){return!!Br(e,t)}function Br(e,t){let n=process.env[e];if(!(e in process.env))return t;try{return JSON.parse(n)}catch{return t}}let Vr=/\.(c|m)?j(sx?)$/,Hr=/\.(c|m)?t(sx?)$/;function Ur(e,t,n){let r,i;if(e.isNativeRe.test(t))return t;e.alias&&(t=function(e,t){let n=bt(e);t=rr(t);for(let[e,r]of Object.entries(t))if(n.startsWith(e)&&ir(n[(ir(e)?e.slice(0,-1):e).length]))return V(r,n.slice(e.length));return n}(t,e.alias));let a=n?.parentURL||e.url;Nr(a)&&(a=V(a,`_index.js`));let o=(n?.async?[n?.conditions,[`node`,`import`],[`node`,`require`]]:[n?.conditions,[`node`,`require`],[`node`,`import`]]).filter(Boolean);for(let n of o){try{r=Yn(t,{url:a,conditions:n,extensions:e.opts.extensions})}catch(e){i=e}if(r)return r}try{return e.nativeRequire.resolve(t,{paths:n.paths})}catch(e){i=e}for(let i of e.additionalExts)if(r=Wr(e,t+i,a,n)||Wr(e,t+`/index`+i,a,n),r||(Hr.test(e.filename)||Hr.test(e.parentModule?.filename||``)||Vr.test(t))&&(r=Wr(e,t.replace(Vr,`.$1t$2`),a,n),r))return r;if(!n?.try)throw i}function Wr(e,t,n,r){try{return e.nativeRequire.resolve(t,{...r,paths:[jt(Vn(n)),...r?.paths||[]]})}catch{}}let Gr=j(`node:perf_hooks`),Kr=j(`node:vm`);var qr=r.n(Kr);function Jr(e,t,n){let r=e.parentCache||{};if(t.startsWith(`node:`))return Yr(e,t,n.async);if(t.startsWith(`file:`))t=(0,H.fileURLToPath)(t);else if(t.startsWith(`data:`)){if(!n.async)throw Error("`data:` URLs are only supported in ESM context. Use `import` or `jiti.import` instead.");return Ir(e,`[native]`,`[data]`,`[import]`,t),Yr(e,t,!0)}if(ft.builtinModules.includes(t)||t===`.pnp.js`)return Yr(e,t,n.async);if(e.opts.tryNative&&!e.opts.transformOptions)try{if(!(t=Ur(e,t,n))&&n.try)return;if(Ir(e,`[try-native]`,n.async&&e.nativeImport?`[import]`:`[require]`,t),n.async&&e.nativeImport)return e.nativeImport(t).then(n=>(!1===e.opts.moduleCache&&delete e.nativeRequire.cache[t],Lr(e,n)));{let n=e.nativeRequire(t);return!1===e.opts.moduleCache&&delete e.nativeRequire.cache[t],Lr(e,n)}}catch(n){Ir(e,`[try-native] Using fallback for ${t} because of an error:`,n)}let i=Ur(e,t,n);if(!i&&n.try)return;let a=At(i);if(a===`.json`){Ir(e,`[json]`,i);let t=e.nativeRequire(i);return t&&!(`default`in t)&&Object.defineProperty(t,`default`,{value:t,enumerable:!1}),t}if(a&&!e.opts.extensions.includes(a))return Ir(e,`[native]`,`[unknown]`,n.async?`[import]`:`[require]`,i),Yr(e,i,n.async);if(e.isNativeRe.test(i))return Ir(e,`[native]`,n.async?`[import]`:`[require]`,i),Yr(e,i,n.async);if(r[i])return Lr(e,r[i]?.exports);if(e.opts.moduleCache){let t=e.nativeRequire.cache[i];if(t?.loaded)return Lr(e,t.exports)}return $r(e,(0,B.readFileSync)(i,`utf8`),{id:t,filename:i,ext:a,cache:r,async:n.async})}function Yr(e,t,n){return n&&e.nativeImport?e.nativeImport(function(e){return _r&&kt(e)?Hn(e):e}(t)).then(t=>Lr(e,t)):Lr(e,e.nativeRequire(t))}function Xr(e,t,n){if(!e.opts.fsCache||!t.filename)return n();let r=` /* v9-${Pr(t.source,16)} */\n`,i=`${Mt(jt(t.filename))}-${function(e){let t=e.split(nr).pop();if(!t)return;let n=t.lastIndexOf(`.`);return n<=0?t:t.slice(0,n)}(t.filename)}`+(e.opts.sourceMaps?`+map`:``)+(t.interopDefault?`.i`:``)+`.${Pr(t.filename)}`+(t.async?`.mjs`:`.cjs`);t.jsx&&t.filename.endsWith(`x`)&&(i+=`x`);let a=e.opts.fsCache,o=V(a,i);if(!e.opts.rebuildFsCache&&(0,B.existsSync)(o)){let n=(0,B.readFileSync)(o,`utf8`);if(n.endsWith(r))return Ir(e,`[cache]`,`[hit]`,t.filename,`~>`,o),n}Ir(e,`[cache]`,`[miss]`,t.filename);let s=n();return s.includes(`__JITI_ERROR__`)||((0,B.writeFileSync)(o,s+r,`utf8`),Ir(e,`[cache]`,`[store]`,t.filename,`~>`,o)),s}function Zr(t){if(!0===t.opts.fsCache&&(t.opts.fsCache=function(t){let n=t.filename&&Dt(t.filename,`../node_modules`);if(n&&(0,B.existsSync)(n))return V(n,`.cache/jiti`);let r=(0,e.tmpdir)();if(process.env.TMPDIR&&r===process.cwd()&&!process.env.JITI_RESPECT_TMPDIR_ENV){let t=process.env.TMPDIR;delete process.env.TMPDIR,r=(0,e.tmpdir)(),process.env.TMPDIR=t}return V(r,`jiti`)}(t)),t.opts.fsCache)try{if((0,B.mkdirSync)(t.opts.fsCache,{recursive:!0}),!function(e){try{return(0,B.accessSync)(e,B.constants.W_OK),!0}catch{return!1}}(t.opts.fsCache))throw Error(`directory is not writable!`)}catch(e){Ir(t,`Error creating cache directory at `,t.opts.fsCache,e),t.opts.fsCache=!1}}function Qr(e,t){let n=Xr(e,t,()=>{let n=e.opts.transform({...e.opts.transformOptions,babel:{...e.opts.sourceMaps?{sourceFileName:t.filename,sourceMaps:`inline`}:{},...e.opts.transformOptions?.babel},interopDefault:e.opts.interopDefault,...t});return n.error&&e.opts.debug&&Ir(e,n.error),n.code});return n.startsWith(`#!`)&&(n=`// `+n),n}function $r(e,t,n={}){let r=n.id||(n.filename?Mt(n.filename):`_jitiEval.${n.ext||(n.async?`mjs`:`js`)}`),i=n.filename||Ur(e,r,{async:n.async}),a=n.ext||At(i),o=n.cache||e.parentCache||{},s=/\.[cm]?tsx?$/.test(a),c=a===`.mjs`||a===`.js`&&function(e){for(;e&&e!==`.`&&e!==`/`;){e=V(e,`..`);try{let t=(0,B.readFileSync)(V(e,`package.json`),`utf8`);try{return JSON.parse(t)}catch{}break}catch{}}}(i)?.type===`module`,l=a===`.cjs`,u=n.forceTranspile??(!l&&!(c&&n.async)&&(s||c||e.isTransformRe.test(i)||Qn(t))),d=Gr.performance.now();if(u){t=Qr(e,{filename:i,source:t,ts:s,async:n.async??!1,jsx:e.opts.jsx});let r=Math.round(1e3*(Gr.performance.now()-d))/1e3;Ir(e,`[transpile]`,n.async?`[esm]`:`[cjs]`,i,`(${r}ms)`)}else{if(Ir(e,`[native]`,n.async?`[import]`:`[require]`,i),n.async)return Promise.resolve(Yr(e,i,n.async)).catch(r=>(Ir(e,`Native import error:`,r),Ir(e,`[fallback]`,i),$r(e,t,{...n,forceTranspile:!0})));try{return Yr(e,i,n.async)}catch(r){Ir(e,`Native require error:`,r),Ir(e,`[fallback]`,i),t=Qr(e,{filename:i,source:t,ts:s,async:n.async??!1,jsx:e.opts.jsx})}}let f=new ft.Module(i);f.filename=i,e.parentModule&&(f.parent=e.parentModule,Array.isArray(e.parentModule.children)&&!e.parentModule.children.includes(f)&&e.parentModule.children.push(f));let p=ti(i,e.opts,{parentModule:f,parentCache:o,nativeImport:e.nativeImport,onError:e.onError,createRequire:e.createRequire},!0),m;f.require=p,f.path=jt(i),f.paths=ft.Module._nodeModulePaths(f.path),o[i]=f,e.opts.moduleCache&&(e.nativeRequire.cache[i]=f);let h=function(e,t){return`(${t?.async?`async `:``}function (exports, require, module, __filename, __dirname, jitiImport, jitiESMResolve) { ${e}\n});`}(t,{async:n.async});try{m=qr().runInThisContext(h,{filename:i,lineOffset:0,displayErrors:!1})}catch(t){t.name===`SyntaxError`&&n.async&&e.nativeImport?(Ir(e,`[esm]`,`[import]`,`[fallback]`,i),m=function(e,t){let n=`data:text/javascript;base64,${Buffer.from(`export default ${e}`).toString(`base64`)}`;return(...e)=>t(n).then(t=>t.default(...e))}(h,e.nativeImport)):(e.opts.moduleCache&&delete e.nativeRequire.cache[i],e.onError(t))}let g;try{g=m(f.exports,f.require,f,f.filename,jt(f.filename),p.import,p.esmResolve)}catch(t){e.opts.moduleCache&&delete e.nativeRequire.cache[i],e.onError(t)}function _(){if(f.exports&&f.exports.__JITI_ERROR__){let{filename:t,line:n,column:r,code:i,message:a}=f.exports.__JITI_ERROR__,o=Error(`${i}: ${a} \n ${`${t}:${n}:${r}`}`);Error.captureStackTrace(o,Jr),e.onError(o)}return f.loaded=!0,Lr(e,f.exports)}return n.async?Promise.resolve(g).then(_):_()}let ei=(0,e.platform)()===`win32`;function ti(e,t={},n,r=!1){let i=r?t:function(e){let t={fsCache:zr(`JITI_FS_CACHE`,zr(`JITI_CACHE`,!0)),rebuildFsCache:zr(`JITI_REBUILD_FS_CACHE`,!1),moduleCache:zr(`JITI_MODULE_CACHE`,zr(`JITI_REQUIRE_CACHE`,!0)),debug:zr(`JITI_DEBUG`,!1),sourceMaps:zr(`JITI_SOURCE_MAPS`,!1),interopDefault:zr(`JITI_INTEROP_DEFAULT`,!0),extensions:Br(`JITI_EXTENSIONS`,[`.js`,`.mjs`,`.cjs`,`.ts`,`.tsx`,`.mts`,`.cts`,`.mtsx`,`.ctsx`]),alias:Br(`JITI_ALIAS`,{}),nativeModules:Br(`JITI_NATIVE_MODULES`,[]),transformModules:Br(`JITI_TRANSFORM_MODULES`,[]),tryNative:Br(`JITI_TRY_NATIVE`,`Bun`in globalThis),jsx:zr(`JITI_JSX`,!1)};t.jsx&&t.extensions.push(`.jsx`,`.tsx`);let n={};return e.cache!==void 0&&(n.fsCache=e.cache),e.requireCache!==void 0&&(n.moduleCache=e.requireCache),{...t,...n,...e}}(t),a=i.alias&&Object.keys(i.alias).length>0?rr(i.alias||{}):void 0,o=[`typescript`,`jiti`,...i.nativeModules||[]],s=RegExp(`node_modules/(${o.map(e=>$n(e)).join(`|`)})/`),c=[...i.transformModules||[]],l=RegExp(`node_modules/(${c.map(e=>$n(e)).join(`|`)})/`);e||=process.cwd(),!r&&Nr(e)&&(e=V(e,`_index.js`));let u=Hn(e),d=[...i.extensions].filter(e=>e!==`.js`),f=n.createRequire(ei?e.replace(/\//g,`\\`):e),p={filename:e,url:u,opts:i,alias:a,nativeModules:o,transformModules:c,isNativeRe:s,isTransformRe:l,additionalExts:d,nativeRequire:f,onError:n.onError,parentModule:n.parentModule,parentCache:n.parentCache,nativeImport:n.nativeImport,createRequire:n.createRequire};return r||Ir(p,`[init]`,...[[`version:`,ar.rE],[`module-cache:`,i.moduleCache],[`fs-cache:`,i.fsCache],[`rebuild-fs-cache:`,i.rebuildFsCache],[`interop-defaults:`,i.interopDefault]].flat()),r||Zr(p),Object.assign(function(e){return Jr(p,e,{async:!1})},{cache:i.moduleCache?f.cache:Object.create(null),extensions:f.extensions,main:f.main,options:i,resolve:Object.assign(function(e){return Ur(p,e,{async:!1})},{paths:f.resolve.paths}),transform:e=>Qr(p,e),evalModule:(e,t)=>$r(p,e,t),async import(e,t){let n=await Jr(p,e,{...t,async:!0});return t?.default?n?.default??n:n},esmResolve(e,t){typeof t==`string`&&(t={parentURL:t});let n=Ur(p,e,{parentURL:u,...t,async:!0});return!n||typeof n!=`string`||n.startsWith(`file://`)?n:Hn(n)}})}})(),t.exports=i.default})()}))(),1);function Hr(e){throw e}const Ur=e=>import(e);let Wr;function Gr(...t){return Wr||=e(import.meta.url)(`../dist/babel.cjs`),Wr(...t)}function Kr(t,n={}){return n.transform||(n={...n,transform:Gr}),(0,Vr.default)(t,n,{onError:Hr,nativeImport:Ur,createRequire:e})}const qr=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,Jr=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Yr=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Xr(e,t){if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){Zr(e);return}return t}function Zr(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function Qr(e,t={}){if(typeof e!=`string`)return e;if(e[0]===`"`&&e[e.length-1]===`"`&&e.indexOf(`\\`)===-1)return e.slice(1,-1);let n=e.trim();if(n.length<=9)switch(n.toLowerCase()){case`true`:return!0;case`false`:return!1;case`undefined`:return;case`null`:return null;case`nan`:return NaN;case`infinity`:return 1/0;case`-infinity`:return-1/0}if(!Yr.test(e)){if(t.strict)throw SyntaxError(`[destr] Invalid JSON`);return e}try{if(qr.test(e)||Jr.test(e)){if(t.strict)throw Error(`[destr] Possible prototype pollution`);return JSON.parse(e,Xr)}return JSON.parse(e)}catch(n){if(t.strict)throw n;return e}}function $r(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function ei(e,t,n=`.`,r){if(!$r(t))return ei(e,{},n,r);let i=Object.assign({},t);for(let t in e){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:$r(a)&&$r(i[t])?i[t]=ei(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function ti(e){return(...t)=>t.reduce((t,n)=>ei(t,n,``,e),{})}const ni=ti();function ri(e){return e&&e.constructor&&typeof e.constructor.isBuffer==`function`&&e.constructor.isBuffer(e)}function ii(e){return e}function ai(e,t){t||={};let n=t.delimiter||`.`,r=t.maxDepth,i=t.transformKey||ii,a={};function o(e,s,c){c||=1,Object.keys(e).forEach(function(l){let u=e[l],d=t.safe&&Array.isArray(u),f=Object.prototype.toString.call(u),p=ri(u),m=f===`[object Object]`||f===`[object Array]`,h=s?s+n+i(l):i(l);if(!d&&!p&&m&&Object.keys(u).length&&(!t.maxDepth||c<r))return o(u,h,c+1);a[h]=u})}return o(e),a}function oi(e,t){t||={};let n=t.delimiter||`.`,r=t.overwrite||!1,i=t.transformKey||ii,a={};if(ri(e)||Object.prototype.toString.call(e)!==`[object Object]`)return e;function o(e){let n=Number(e);return isNaN(n)||e.indexOf(`.`)!==-1||t.object?e:n}function s(e,t,r){return Object.keys(r).reduce(function(t,i){return t[e+n+i]=r[i],t},t)}function c(e){let t=Object.prototype.toString.call(e),n=t===`[object Array]`,r=t===`[object Object]`;if(e){if(n)return!e.length;if(r)return!Object.keys(e).length}else return!0}return e=Object.keys(e).reduce(function(n,r){let i=Object.prototype.toString.call(e[r]);return!(i===`[object Object]`||i===`[object Array]`)||c(e[r])?(n[r]=e[r],n):s(r,n,ai(e[r],t))},{}),Object.keys(e).forEach(function(s){let c=s.split(n).map(i),l=o(c.shift()),u=o(c[0]),d=a;for(;u!==void 0;){if(l===`__proto__`)return;let e=Object.prototype.toString.call(d[l]),n=e===`[object Object]`||e===`[object Array]`;if(!r&&!n&&d[l]!==void 0)return;(r&&!n||!r&&d[l]==null)&&(d[l]=typeof u==`number`&&!t.object?[]:{}),d=d[l],c.length>0&&(l=o(c.shift()),u=o(c[0]))}d[l]=oi(e[s],t)}),a}const si=/^\s*([^\s=]+)\s*=\s*(.*)?\s*$/,ci=/\n|\r|\r\n/,li={name:`.conf`,dir:process.cwd(),flat:!1};function ui(e){return typeof e==`string`&&(e={name:e}),{...li,...e}}function di(e,t={}){let n={},r=e.split(ci);for(let e of r){let t=e.match(si);if(!t)continue;let r=t[1];if(!r||r===`__proto__`||r===`constructor`)continue;let i=Qr((t[2]||``).trim());if(r.endsWith(`[]`)){let e=r.slice(0,Math.max(0,r.length-2));n[e]=(n[e]||[]).concat(i);continue}n[r]=i}return t.flat?n:oi(n,{overwrite:!0})}function fi(e,t){return x(e)?di(ee(e,`utf8`),t):{}}function pi(e){return e=ui(e),fi(o(e.dir,e.name),e)}function mi(e){return e=ui(e),e.dir=process.env.XDG_CONFIG_HOME||_(),pi(e)}const hi=Symbol.for(`__confbox_fmt__`),gi=/^(\s+)/,_i=/(\s+)$/;function vi(e,t={}){return{sample:t.indent===void 0&&t.preserveIndentation!==!1&&e.slice(0,t?.sampleSize||1024),whiteSpace:t.preserveWhitespace===!1?void 0:{start:gi.exec(e)?.[0]||``,end:_i.exec(e)?.[0]||``}}}function yi(e,t,n){!t||typeof t!=`object`||Object.defineProperty(t,hi,{enumerable:!1,configurable:!0,writable:!0,value:vi(e,n)})}function bi(e,t=!1){let n=e.length,r=0,i=``,a=0,o=16,s=0,c=0,l=0,u=0,d=0;function f(t,n){let i=0,a=0;for(;i<t;){let t=e.charCodeAt(r);if(t>=48&&t<=57)a=a*16+t-48;else if(t>=65&&t<=70)a=a*16+t-65+10;else if(t>=97&&t<=102)a=a*16+t-97+10;else break;r++,i++}return i<t&&(a=-1),a}function p(e){r=e,i=``,a=0,o=16,d=0}function m(){let t=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&Ci(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&Ci(e.charCodeAt(r)))for(r++;r<e.length&&Ci(e.charCodeAt(r));)r++;else return d=3,e.substring(t,r);let n=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&Ci(e.charCodeAt(r))){for(r++;r<e.length&&Ci(e.charCodeAt(r));)r++;n=r}else d=3;return e.substring(t,n)}function h(){let t=``,i=r;for(;;){if(r>=n){t+=e.substring(i,r),d=2;break}let a=e.charCodeAt(r);if(a===34){t+=e.substring(i,r),r++;break}if(a===92){if(t+=e.substring(i,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
65
+ `;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=f(4);e>=0?t+=String.fromCharCode(e):d=4;break;default:d=5}i=r;continue}if(a>=0&&a<=31)if(Si(a)){t+=e.substring(i,r),d=2;break}else d=6;r++}return t}function g(){if(i=``,d=0,a=r,c=s,u=l,r>=n)return a=n,o=17;let t=e.charCodeAt(r);if(xi(t)){do r++,i+=String.fromCharCode(t),t=e.charCodeAt(r);while(xi(t));return o=15}if(Si(t))return r++,i+=String.fromCharCode(t),t===13&&e.charCodeAt(r)===10&&(r++,i+=`
66
+ `),s++,l=r,o=14;switch(t){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,i=h(),o=10;case 47:let c=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!Si(e.charCodeAt(r));)r++;return i=e.substring(c,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;let t=n-1,a=!1;for(;r<t;){let t=e.charCodeAt(r);if(t===42&&e.charCodeAt(r+1)===47){r+=2,a=!0;break}r++,Si(t)&&(t===13&&e.charCodeAt(r)===10&&r++,s++,l=r)}return a||(r++,d=1),i=e.substring(c,r),o=13}return i+=String.fromCharCode(t),r++,o=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!Ci(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;r<n&&_(t);)r++,t=e.charCodeAt(r);if(a!==r){switch(i=e.substring(a,r),i){case`true`:return o=8;case`false`:return o=9;case`null`:return o=7}return o=16}return i+=String.fromCharCode(t),r++,o=16}}function _(e){if(xi(e)||Si(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let e;do e=g();while(e>=12&&e<=15);return e}return{setPosition:p,getPosition:()=>r,scan:t?v:g,getToken:()=>o,getTokenValue:()=>i,getTokenOffset:()=>a,getTokenLength:()=>r-a,getTokenStartLine:()=>c,getTokenStartCharacter:()=>a-u,getTokenError:()=>d}}function xi(e){return e===32||e===9}function Si(e){return e===10||e===13}function Ci(e){return e>=48&&e<=57}var wi;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(wi||={}),Array(20).fill(0).map((e,t)=>` `.repeat(t)),Array(200).fill(0).map((e,t)=>`
67
67
  `+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r
68
68
  `+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`
69
69
  `+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r
70
- `+` `.repeat(t));var Si;(function(e){e.DEFAULT={allowTrailingComma:!1}})(Si||={});function Ci(e,t=[],n=Si.DEFAULT){let r=null,i=[],a=[];function o(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return wi(e,{onObjectBegin:()=>{let e={};o(e),a.push(i),i=e,r=null},onObjectProperty:e=>{r=e},onObjectEnd:()=>{i=a.pop()},onArrayBegin:()=>{let e=[];o(e),a.push(i),i=e,r=null},onArrayEnd:()=>{i=a.pop()},onLiteralValue:o,onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n),i[0]}function wi(e,t,n=Si.DEFAULT){let r=_i(e,!1),i=[],a=0;function o(e){return e?()=>a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function s(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function c(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function l(e){return e?()=>{a>0?a++:e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())===!1&&(a=1)}:()=>!0}function u(e){return e?()=>{a>0&&a--,a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let d=l(t.onObjectBegin),f=c(t.onObjectProperty),p=u(t.onObjectEnd),m=l(t.onArrayBegin),h=u(t.onArrayEnd),g=c(t.onLiteralValue),_=s(t.onSeparator),v=o(t.onComment),y=s(t.onError),b=n&&n.disallowComments,x=n&&n.allowTrailingComma;function S(){for(;;){let e=r.scan();switch(r.getTokenError()){case 4:C(14);break;case 5:C(15);break;case 3:C(13);break;case 1:b||C(11);break;case 2:C(12);break;case 6:C(16);break}switch(e){case 12:case 13:b?C(10):v();break;case 16:C(1);break;case 15:case 14:break;default:return e}}}function C(e,t=[],n=[]){if(y(e),t.length+n.length>0){let e=r.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){S();break}else if(n.indexOf(e)!==-1)break;e=S()}}}function w(e){let t=r.getTokenValue();return e?g(t):(f(t),i.push(t)),S(),!0}function ee(){switch(r.getToken()){case 11:let e=r.getTokenValue(),t=Number(e);isNaN(t)&&(C(2),t=0),g(t);break;case 7:g(null);break;case 8:g(!0);break;case 9:g(!1);break;default:return!1}return S(),!0}function te(){return r.getToken()===10?(w(!1),r.getToken()===6?(_(`:`),S(),re()||C(4,[],[2,5])):C(5,[],[2,5]),i.pop(),!0):(C(3,[],[2,5]),!1)}function T(){d(),S();let e=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(e||C(4,[],[]),_(`,`),S(),r.getToken()===2&&x)break}else e&&C(6,[],[]);te()||C(4,[],[2,5]),e=!0}return p(),r.getToken()===2?S():C(7,[2],[]),!0}function ne(){m(),S();let e=!0,t=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(t||C(4,[],[]),_(`,`),S(),r.getToken()===4&&x)break}else t&&C(6,[],[]);e?(i.push(0),e=!1):i[i.length-1]++,re()||C(4,[],[4,5]),t=!0}return h(),e||i.pop(),r.getToken()===4?S():C(8,[4],[]),!0}function re(){switch(r.getToken()){case 3:return ne();case 1:return T();case 10:return w(!0);default:return ee()}}return S(),r.getToken()===17?n.allowEmptyContent?!0:(C(4,[],[]),!1):re()?(r.getToken()!==17&&C(9,[],[]),!0):(C(4,[],[]),!1)}var Ti;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(Ti||={});var Ei;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(Ei||={});const Di=Ci;var Oi;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(Oi||={});function ki(e,t){let n=JSON.parse(e,t?.reviver);return gi(e,n,t),n}function Ai(e,t){let n=Di(e,t?.errors,t);return gi(e,n,t),n}const ji={startingFrom:`.`,rootPattern:/^node_modules$/,reverse:!1,test:e=>{try{if(ne(e).isFile())return!0}catch{}}};async function Mi(e,t={}){let n=Array.isArray(e)?e:[e],r={...ji,...t},i=an(r.startingFrom),a=i[0]===`/`,o=i.split(`/`).filter(Boolean);if(n.includes(o.at(-1))&&await r.test(i))return i;a&&(o[0]=`/`+o[0]);let s=o.findIndex(e=>e.match(r.rootPattern));if(s===-1&&(s=0),r.reverse)for(let e=s+1;e<=o.length;e++)for(let t of n){let n=nn(...o.slice(0,e),t);if(await r.test(n))return n}else for(let e=o.length;e>s;e--)for(let t of n){let n=nn(...o.slice(0,e),t);if(await r.test(n))return n}throw Error(`Cannot find matching ${e} in ${r.startingFrom} or parent directories`)}function Ni(e,t={}){return Mi(e,t)}function Pi(e,t={}){return e instanceof URL||e.startsWith(`file://`)?tn(D(e)):sn(e)?tn(e):kr(e,{...t,from:t.from||t.parent||t.url})}const Fi=[`yarn.lock`,`package-lock.json`,`pnpm-lock.yaml`,`npm-shrinkwrap.json`,`bun.lockb`,`bun.lock`,`deno.lock`],Ii=[`package.json`,`package.json5`,`package.yaml`],Li=[`pnpm-workspace.yaml`,`lerna.json`,`turbo.json`,`rush.json`,`deno.json`,`deno.jsonc`],Ri=new Map;async function zi(e,t={}){let n=await Bi(e,t),r=t.cache&&typeof t.cache!=`boolean`?t.cache:Ri;if(t.cache&&r.has(n))return r.get(n);let i=await w.readFile(n,`utf8`),a;try{a=ki(i)}catch{a=Ai(i)}return r.set(n,a),a}async function Bi(e=process.cwd(),t={}){return Ni(`package.json`,{...t,startingFrom:Pi(e,t)})}const Vi={workspaceFile:e=>Mi(Li,e).then(e=>ln(e)),gitConfig:e=>Mi(`.git/config`,e).then(e=>an(e,`../..`)),lockFile:e=>Mi(Fi,e).then(e=>ln(e)),packageJson:e=>Mi(Ii,e).then(e=>ln(e))};async function Hi(e=process.cwd(),t={}){let n=Pi(e,t),r=t.tests||[`workspaceFile`,`gitConfig`,`lockFile`,`packageJson`];for(let e of r){let r=Vi[e];if(t[e]===!1||!r)continue;let i=t[e]||(e===`gitConfig`?`closest`:`furthest`),a=await r({...t,startingFrom:n,reverse:i===`furthest`}).catch(()=>{});if(a)return a}throw Error(`Cannot detect workspace root from ${e}`)}async function Ui(e){let t=e.env??process.env,n=await Wi({cwd:e.cwd,fileName:e.fileName??`.env`,env:t,interpolate:e.interpolate??!0}),r=Ki(t);for(let e in n)e.startsWith(`_`)||(t[e]===void 0||r.has(e))&&(t[e]=n[e]);return n}async function Wi(e){let t=Object.create(null),n=an(e.cwd||`.`),r=e.fileName||`.env`,i=typeof r==`string`?[r]:r,a=Ki(e.env||{});Object.assign(t,e.env);for(let e of i){let r=an(n,e);if(!ne(r,{throwIfNoEntry:!1})?.isFile())continue;let i=fn.parse(await w.readFile(r,`utf8`));for(let e in i)e in t&&!a.has(e)||(t[e]=i[e],a.add(e))}return e.interpolate&&Gi(t),t}function Gi(e,t={},n=e=>e){function r(n){return t[n]===void 0?e[n]:t[n]}function i(e,t=[]){return typeof e==`string`?n((e.match(/(.?\${?(?:[\w:]+)?}?)/g)||[]).reduce((e,n)=>{let a=/(.?)\${?([\w:]+)?}?/g.exec(n)||[],o=a[1],s,c;if(o===`\\`)c=a[0]||``,s=c.replace(String.raw`\$`,`$`);else{let e=a[2];if(c=(a[0]||``).slice(o.length),t.includes(e))return console.warn(`Please avoid recursive environment variables ( loop: ${t.join(` > `)} > ${e} )`),``;s=r(e),s=i(s,[...t,e])}return s===void 0?e:e.replace(c,s)},e)):e}for(let t in e)e[t]=i(r(t))}function Ki(e){let t=globalThis.__c12_dotenv_vars__||=new Map;return t.has(e)||t.set(e,new Set),t.get(e)}const qi=e=>e?.replace(/\\/g,`/`),Ji={".yaml":()=>import(`./yaml-BXCvYnwM.mjs`).then(e=>e.parseYAML),".yml":()=>import(`./yaml-BXCvYnwM.mjs`).then(e=>e.parseYAML),".jsonc":()=>import(`./jsonc-CscIKind.mjs`).then(e=>e.parseJSONC),".json5":()=>import(`./json5-CqfoYXO4.mjs`).then(e=>e.parseJSON5),".toml":()=>import(`./toml-ctrC-cFf.mjs`).then(e=>e.parseTOML)},Yi=Object.freeze([`.js`,`.ts`,`.mjs`,`.cjs`,`.mts`,`.cts`,`.json`,`.jsonc`,`.json5`,`.yaml`,`.yml`,`.toml`]);async function Xi(e){e.cwd=an(process.cwd(),e.cwd||`.`),e.name=e.name||`config`,e.envName=e.envName??process.env.NODE_ENV,e.configFile=e.configFile??(e.name===`config`?`config`:`${e.name}.config`),e.rcFile=e.rcFile??`.${e.name}rc`,e.extend!==!1&&(e.extend={extendKey:`extends`,...e.extend});let t=e.merger||$r;e.jiti=e.jiti||Ur(nn(e.cwd,e.configFile),{interopDefault:!0,moduleCache:!1,extensions:[...Yi],...e.jitiOptions});let n={config:{},cwd:e.cwd,configFile:an(e.cwd,e.configFile),layers:[],_configFile:void 0},r={overrides:e.overrides,main:void 0,rc:void 0,packageJson:void 0,defaultConfig:e.defaultConfig};e.dotenv&&await Ui({cwd:e.cwd,...e.dotenv===!0?{}:e.dotenv});let i=await ea(`.`,e);if(i.configFile&&(r.main=i.config,n.configFile=i.configFile,n._configFile=i._configFile),i.meta&&(n.meta=i.meta),e.rcFile){let n=[];if(n.push(ui({name:e.rcFile,dir:e.cwd})),e.globalRc){let t=await Hi(e.cwd).catch(()=>{});t&&n.push(ui({name:e.rcFile,dir:t})),n.push(di({name:e.rcFile,dir:e.cwd}))}r.rc=t({},...n)}if(e.packageJson){let n=(Array.isArray(e.packageJson)?e.packageJson:[typeof e.packageJson==`string`?e.packageJson:e.name]).filter(e=>e&&typeof e==`string`),i=await zi(e.cwd).catch(()=>{});r.packageJson=t({},...n.map(e=>i?.[e]))}let a={};for(let e in r){let t=r[e];a[e]=await(typeof t==`function`?t({configs:a,rawConfigs:r}):t)}if(Array.isArray(a.main)?n.config=a.main:(n.config=t(a.overrides,a.main,a.rc,a.packageJson,a.defaultConfig),e.extend&&(await Zi(n.config,e),n.layers=n.config._layers,delete n.config._layers,n.config=t(n.config,...n.layers.map(e=>e.config)))),n.layers=[...[a.overrides&&{config:a.overrides,configFile:void 0,cwd:void 0},{config:a.main,configFile:e.configFile,cwd:e.cwd},a.rc&&{config:a.rc,configFile:e.rcFile},a.packageJson&&{config:a.packageJson,configFile:`package.json`}].filter(e=>e&&e.config),...n.layers],e.defaults&&(n.config=t(n.config,e.defaults)),e.omit$Keys)for(let e in n.config)e.startsWith(`$`)&&delete n.config[e];if(e.configFileRequired&&!n._configFile)throw Error(`Required config (${n.configFile}) cannot be resolved.`);return n}async function Zi(e,t){if(e._layers=e._layers||[],!t.extend)return;let n=t.extend.extendKey;typeof n==`string`&&(n=[n]);let r=[];for(let t of n)r.push(...(Array.isArray(e[t])?e[t]:[e[t]]).filter(Boolean)),delete e[t];for(let n of r){let r=n,i={};if(n.source&&(i=n.options||{},n=n.source),Array.isArray(n)&&(i=n[1]||{},n=n[0]),typeof n!=`string`){console.warn(`Cannot extend config from \`${JSON.stringify(r)}\` in ${t.cwd}`);continue}let a=await ea(n,t,i);if(!a.config){console.warn(`Cannot extend config from \`${n}\` in ${t.cwd}`);continue}await Zi(a.config,{...t,cwd:a.cwd}),e._layers.push(a),a.config._layers&&(e._layers.push(...a.config._layers),delete a.config._layers)}}const Qi=[`gh:`,`github:`,`gitlab:`,`bitbucket:`,`https://`,`http://`],$i=/^(@[\da-z~-][\d._a-z~-]*\/)?[\da-z~-][\d._a-z~-]*($|\/.*)/;async function ea(e,t,n={}){if(t.resolve){let n=await t.resolve(e,t);if(n)return n}let r=t.merger||$r,i=Object.keys(n.giget?.providers||{}).map(e=>`${e}:`),a=i.length>0?[...new Set([...i,...Qi])]:Qi;if(t.giget!==!1&&a.some(t=>e.startsWith(t))){let{downloadTemplate:r}=await import(`./dist-DbgTcLIx.mjs`),{digest:i}=await import(`./dist-6F1kEZsq.mjs`),a=e.replace(/\W+/g,`_`).split(`_`).splice(0,3).join(`_`)+`_`+i(e).slice(0,10).replace(/[-_]/g,``),o,s=an(t.cwd,`node_modules`),c=ln(t.cwd);o=un(c)===`.c12`?nn(c,a):x(s)?nn(s,`.c12`,a):process.env.XDG_CACHE_HOME?an(process.env.XDG_CACHE_HOME,`c12`,a):an(_(),`.cache/c12`,a),x(o)&&!n.install&&await oe(o,{recursive:!0}),e=(await r(e,{dir:o,install:n.install,force:n.install,auth:n.auth,...t.giget,...n.giget})).dir}$i.test(e)&&(e=ta(e,t)||e);let o=cn(e),s=!o||o===un(e),c=an(t.cwd,s?e:ln(e));s&&(e=t.configFile);let l={config:void 0,configFile:void 0,cwd:c,source:e,sourceOptions:n};if(l.configFile=ta(an(c,e),t)||ta(an(c,`.config`,e.replace(/\.config$/,``)),t)||ta(an(c,`.config`,e),t)||e,!x(l.configFile))return l;l._configFile=l.configFile;let u=cn(l.configFile)||``;if(u in Ji?l.config=(await Ji[u]())(await ae(l.configFile,`utf8`)):l.config=await t.jiti.import(l.configFile,{default:!0}),typeof l.config==`function`&&(l.config=await l.config(t.context)),t.envName){let e={...l.config[`$`+t.envName],...l.config.$env?.[t.envName]};Object.keys(e).length>0&&(l.config=r(e,l.config))}return l.meta=$r(l.sourceOptions.meta,l.config.$meta),delete l.config.$meta,l.sourceOptions.overrides&&(l.config=r(l.sourceOptions.overrides,l.config)),l.configFile=qi(l.configFile),l.source=qi(l.source),l}function ta(e,t){let n=kr(e,{try:!0,from:ce(nn(t.cwd||`.`,t.configFile||`/`)),suffixes:[``,`/index`],extensions:Yi,cache:!1});return n?tn(n):void 0}const na={openaiApiKey:``,language:`fr`,model:`whisper-1`,templatesDir:a(_(),`.config`,`video-toolkit`,`templates`)};async function ra(){let{config:e}=await Xi({name:`video-toolkit`,defaults:na,globalRc:!0});return{openaiApiKey:e.openaiApiKey||``,language:e.language||`fr`,model:e.model||`whisper-1`,templatesDir:e.templatesDir}}function ia(e){let t=o(e),i=n(t,r(t)),s=o(t,`..`),c=a(s,`${i}_audio.mp3`),l=a(s,`${i}.srt`),u=a(s,`thumbnails`);x(u)||C(u,{recursive:!0});let d=[`first`,`25`,`50`,`75`,`last`];return{videoPath:t,audioPath:c,srtPath:l,thumbnailTempPaths:d.map(e=>a(u,`${i}_thumbnail_${e}_temp.png`)),thumbnailPaths:d.map(e=>a(u,`${i}_thumbnail_${e}.png`))}}var aa=M(((e,t)=>{
70
+ `+` `.repeat(t));var Ti;(function(e){e.DEFAULT={allowTrailingComma:!1}})(Ti||={});function Ei(e,t=[],n=Ti.DEFAULT){let r=null,i=[],a=[];function o(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return Di(e,{onObjectBegin:()=>{let e={};o(e),a.push(i),i=e,r=null},onObjectProperty:e=>{r=e},onObjectEnd:()=>{i=a.pop()},onArrayBegin:()=>{let e=[];o(e),a.push(i),i=e,r=null},onArrayEnd:()=>{i=a.pop()},onLiteralValue:o,onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n),i[0]}function Di(e,t,n=Ti.DEFAULT){let r=bi(e,!1),i=[],a=0;function o(e){return e?()=>a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function s(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function c(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function l(e){return e?()=>{a>0?a++:e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())===!1&&(a=1)}:()=>!0}function u(e){return e?()=>{a>0&&a--,a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let d=l(t.onObjectBegin),f=c(t.onObjectProperty),p=u(t.onObjectEnd),m=l(t.onArrayBegin),h=u(t.onArrayEnd),g=c(t.onLiteralValue),_=s(t.onSeparator),v=o(t.onComment),y=s(t.onError),b=n&&n.disallowComments,x=n&&n.allowTrailingComma;function S(){for(;;){let e=r.scan();switch(r.getTokenError()){case 4:C(14);break;case 5:C(15);break;case 3:C(13);break;case 1:b||C(11);break;case 2:C(12);break;case 6:C(16);break}switch(e){case 12:case 13:b?C(10):v();break;case 16:C(1);break;case 15:case 14:break;default:return e}}}function C(e,t=[],n=[]){if(y(e),t.length+n.length>0){let e=r.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){S();break}else if(n.indexOf(e)!==-1)break;e=S()}}}function w(e){let t=r.getTokenValue();return e?g(t):(f(t),i.push(t)),S(),!0}function ee(){switch(r.getToken()){case 11:let e=r.getTokenValue(),t=Number(e);isNaN(t)&&(C(2),t=0),g(t);break;case 7:g(null);break;case 8:g(!0);break;case 9:g(!1);break;default:return!1}return S(),!0}function te(){return r.getToken()===10?(w(!1),r.getToken()===6?(_(`:`),S(),re()||C(4,[],[2,5])):C(5,[],[2,5]),i.pop(),!0):(C(3,[],[2,5]),!1)}function T(){d(),S();let e=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(e||C(4,[],[]),_(`,`),S(),r.getToken()===2&&x)break}else e&&C(6,[],[]);te()||C(4,[],[2,5]),e=!0}return p(),r.getToken()===2?S():C(7,[2],[]),!0}function ne(){m(),S();let e=!0,t=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(t||C(4,[],[]),_(`,`),S(),r.getToken()===4&&x)break}else t&&C(6,[],[]);e?(i.push(0),e=!1):i[i.length-1]++,re()||C(4,[],[4,5]),t=!0}return h(),e||i.pop(),r.getToken()===4?S():C(8,[4],[]),!0}function re(){switch(r.getToken()){case 3:return ne();case 1:return T();case 10:return w(!0);default:return ee()}}return S(),r.getToken()===17?n.allowEmptyContent?!0:(C(4,[],[]),!1):re()?(r.getToken()!==17&&C(9,[],[]),!0):(C(4,[],[]),!1)}var Oi;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(Oi||={});var ki;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(ki||={});const Ai=Ei;var ji;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(ji||={});function Mi(e,t){let n=JSON.parse(e,t?.reviver);return yi(e,n,t),n}function Ni(e,t){let n=Ai(e,t?.errors,t);return yi(e,n,t),n}const Pi={startingFrom:`.`,rootPattern:/^node_modules$/,reverse:!1,test:e=>{try{if(ne(e).isFile())return!0}catch{}}};async function Fi(e,t={}){let n=Array.isArray(e)?e:[e],r={...Pi,...t},i=sn(r.startingFrom),a=i[0]===`/`,o=i.split(`/`).filter(Boolean);if(n.includes(o.at(-1))&&await r.test(i))return i;a&&(o[0]=`/`+o[0]);let s=o.findIndex(e=>e.match(r.rootPattern));if(s===-1&&(s=0),r.reverse)for(let e=s+1;e<=o.length;e++)for(let t of n){let n=an(...o.slice(0,e),t);if(await r.test(n))return n}else for(let e=o.length;e>s;e--)for(let t of n){let n=an(...o.slice(0,e),t);if(await r.test(n))return n}throw Error(`Cannot find matching ${e} in ${r.startingFrom} or parent directories`)}function Ii(e,t={}){return Fi(e,t)}function Li(e,t={}){return e instanceof URL||e.startsWith(`file://`)?rn(D(e)):ln(e)?rn(e):jr(e,{...t,from:t.from||t.parent||t.url})}const Ri=[`yarn.lock`,`package-lock.json`,`pnpm-lock.yaml`,`npm-shrinkwrap.json`,`bun.lockb`,`bun.lock`,`deno.lock`],zi=[`package.json`,`package.json5`,`package.yaml`],Bi=[`pnpm-workspace.yaml`,`lerna.json`,`turbo.json`,`rush.json`,`deno.json`,`deno.jsonc`],Vi=new Map;async function Hi(e,t={}){let n=await Ui(e,t),r=t.cache&&typeof t.cache!=`boolean`?t.cache:Vi;if(t.cache&&r.has(n))return r.get(n);let i=await w.readFile(n,`utf8`),a;try{a=Mi(i)}catch{a=Ni(i)}return r.set(n,a),a}async function Ui(e=process.cwd(),t={}){return Ii(`package.json`,{...t,startingFrom:Li(e,t)})}const Wi={workspaceFile:e=>Fi(Bi,e).then(e=>dn(e)),gitConfig:e=>Fi(`.git/config`,e).then(e=>sn(e,`../..`)),lockFile:e=>Fi(Ri,e).then(e=>dn(e)),packageJson:e=>Fi(zi,e).then(e=>dn(e))};async function Gi(e=process.cwd(),t={}){let n=Li(e,t),r=t.tests||[`workspaceFile`,`gitConfig`,`lockFile`,`packageJson`];for(let e of r){let r=Wi[e];if(t[e]===!1||!r)continue;let i=t[e]||(e===`gitConfig`?`closest`:`furthest`),a=await r({...t,startingFrom:n,reverse:i===`furthest`}).catch(()=>{});if(a)return a}throw Error(`Cannot detect workspace root from ${e}`)}async function Ki(e){let t=e.env??process.env,n=await qi({cwd:e.cwd,fileName:e.fileName??`.env`,env:t,interpolate:e.interpolate??!0}),r=Yi(t);for(let e in n)e.startsWith(`_`)||(t[e]===void 0||r.has(e))&&(t[e]=n[e]);return n}async function qi(e){let t=Object.create(null),n=sn(e.cwd||`.`),r=e.fileName||`.env`,i=typeof r==`string`?[r]:r,a=Yi(e.env||{});Object.assign(t,e.env);for(let e of i){let r=sn(n,e);if(!ne(r,{throwIfNoEntry:!1})?.isFile())continue;let i=mn.parse(await w.readFile(r,`utf8`));for(let e in i)e in t&&!a.has(e)||(t[e]=i[e],a.add(e))}return e.interpolate&&Ji(t),t}function Ji(e,t={},n=e=>e){function r(n){return t[n]===void 0?e[n]:t[n]}function i(e,t=[]){return typeof e==`string`?n((e.match(/(.?\${?(?:[\w:]+)?}?)/g)||[]).reduce((e,n)=>{let a=/(.?)\${?([\w:]+)?}?/g.exec(n)||[],o=a[1],s,c;if(o===`\\`)c=a[0]||``,s=c.replace(String.raw`\$`,`$`);else{let e=a[2];if(c=(a[0]||``).slice(o.length),t.includes(e))return console.warn(`Please avoid recursive environment variables ( loop: ${t.join(` > `)} > ${e} )`),``;s=r(e),s=i(s,[...t,e])}return s===void 0?e:e.replace(c,s)},e)):e}for(let t in e)e[t]=i(r(t))}function Yi(e){let t=globalThis.__c12_dotenv_vars__||=new Map;return t.has(e)||t.set(e,new Set),t.get(e)}const Xi=e=>e?.replace(/\\/g,`/`),Zi={".yaml":()=>import(`./yaml-BXCvYnwM.mjs`).then(e=>e.parseYAML),".yml":()=>import(`./yaml-BXCvYnwM.mjs`).then(e=>e.parseYAML),".jsonc":()=>import(`./jsonc-CscIKind.mjs`).then(e=>e.parseJSONC),".json5":()=>import(`./json5-CqfoYXO4.mjs`).then(e=>e.parseJSON5),".toml":()=>import(`./toml-ctrC-cFf.mjs`).then(e=>e.parseTOML)},Qi=Object.freeze([`.js`,`.ts`,`.mjs`,`.cjs`,`.mts`,`.cts`,`.json`,`.jsonc`,`.json5`,`.yaml`,`.yml`,`.toml`]);async function $i(e){e.cwd=sn(process.cwd(),e.cwd||`.`),e.name=e.name||`config`,e.envName=e.envName??process.env.NODE_ENV,e.configFile=e.configFile??(e.name===`config`?`config`:`${e.name}.config`),e.rcFile=e.rcFile??`.${e.name}rc`,e.extend!==!1&&(e.extend={extendKey:`extends`,...e.extend});let t=e.merger||ni;e.jiti=e.jiti||Kr(an(e.cwd,e.configFile),{interopDefault:!0,moduleCache:!1,extensions:[...Qi],...e.jitiOptions});let n={config:{},cwd:e.cwd,configFile:sn(e.cwd,e.configFile),layers:[],_configFile:void 0},r={overrides:e.overrides,main:void 0,rc:void 0,packageJson:void 0,defaultConfig:e.defaultConfig};e.dotenv&&await Ki({cwd:e.cwd,...e.dotenv===!0?{}:e.dotenv});let i=await ra(`.`,e);if(i.configFile&&(r.main=i.config,n.configFile=i.configFile,n._configFile=i._configFile),i.meta&&(n.meta=i.meta),e.rcFile){let n=[];if(n.push(pi({name:e.rcFile,dir:e.cwd})),e.globalRc){let t=await Gi(e.cwd).catch(()=>{});t&&n.push(pi({name:e.rcFile,dir:t})),n.push(mi({name:e.rcFile,dir:e.cwd}))}r.rc=t({},...n)}if(e.packageJson){let n=(Array.isArray(e.packageJson)?e.packageJson:[typeof e.packageJson==`string`?e.packageJson:e.name]).filter(e=>e&&typeof e==`string`),i=await Hi(e.cwd).catch(()=>{});r.packageJson=t({},...n.map(e=>i?.[e]))}let a={};for(let e in r){let t=r[e];a[e]=await(typeof t==`function`?t({configs:a,rawConfigs:r}):t)}if(Array.isArray(a.main)?n.config=a.main:(n.config=t(a.overrides,a.main,a.rc,a.packageJson,a.defaultConfig),e.extend&&(await ea(n.config,e),n.layers=n.config._layers,delete n.config._layers,n.config=t(n.config,...n.layers.map(e=>e.config)))),n.layers=[...[a.overrides&&{config:a.overrides,configFile:void 0,cwd:void 0},{config:a.main,configFile:e.configFile,cwd:e.cwd},a.rc&&{config:a.rc,configFile:e.rcFile},a.packageJson&&{config:a.packageJson,configFile:`package.json`}].filter(e=>e&&e.config),...n.layers],e.defaults&&(n.config=t(n.config,e.defaults)),e.omit$Keys)for(let e in n.config)e.startsWith(`$`)&&delete n.config[e];if(e.configFileRequired&&!n._configFile)throw Error(`Required config (${n.configFile}) cannot be resolved.`);return n}async function ea(e,t){if(e._layers=e._layers||[],!t.extend)return;let n=t.extend.extendKey;typeof n==`string`&&(n=[n]);let r=[];for(let t of n)r.push(...(Array.isArray(e[t])?e[t]:[e[t]]).filter(Boolean)),delete e[t];for(let n of r){let r=n,i={};if(n.source&&(i=n.options||{},n=n.source),Array.isArray(n)&&(i=n[1]||{},n=n[0]),typeof n!=`string`){console.warn(`Cannot extend config from \`${JSON.stringify(r)}\` in ${t.cwd}`);continue}let a=await ra(n,t,i);if(!a.config){console.warn(`Cannot extend config from \`${n}\` in ${t.cwd}`);continue}await ea(a.config,{...t,cwd:a.cwd}),e._layers.push(a),a.config._layers&&(e._layers.push(...a.config._layers),delete a.config._layers)}}const ta=[`gh:`,`github:`,`gitlab:`,`bitbucket:`,`https://`,`http://`],na=/^(@[\da-z~-][\d._a-z~-]*\/)?[\da-z~-][\d._a-z~-]*($|\/.*)/;async function ra(e,t,n={}){if(t.resolve){let n=await t.resolve(e,t);if(n)return n}let r=t.merger||ni,i=Object.keys(n.giget?.providers||{}).map(e=>`${e}:`),a=i.length>0?[...new Set([...i,...ta])]:ta;if(t.giget!==!1&&a.some(t=>e.startsWith(t))){let{downloadTemplate:r}=await import(`./dist-DbgTcLIx.mjs`),{digest:i}=await import(`./dist-6F1kEZsq.mjs`),a=e.replace(/\W+/g,`_`).split(`_`).splice(0,3).join(`_`)+`_`+i(e).slice(0,10).replace(/[-_]/g,``),o,s=sn(t.cwd,`node_modules`),c=dn(t.cwd);o=fn(c)===`.c12`?an(c,a):x(s)?an(s,`.c12`,a):process.env.XDG_CACHE_HOME?sn(process.env.XDG_CACHE_HOME,`c12`,a):sn(_(),`.cache/c12`,a),x(o)&&!n.install&&await oe(o,{recursive:!0}),e=(await r(e,{dir:o,install:n.install,force:n.install,auth:n.auth,...t.giget,...n.giget})).dir}na.test(e)&&(e=ia(e,t)||e);let o=un(e),s=!o||o===fn(e),c=sn(t.cwd,s?e:dn(e));s&&(e=t.configFile);let l={config:void 0,configFile:void 0,cwd:c,source:e,sourceOptions:n};if(l.configFile=ia(sn(c,e),t)||ia(sn(c,`.config`,e.replace(/\.config$/,``)),t)||ia(sn(c,`.config`,e),t)||e,!x(l.configFile))return l;l._configFile=l.configFile;let u=un(l.configFile)||``;if(u in Zi?l.config=(await Zi[u]())(await ae(l.configFile,`utf8`)):l.config=await t.jiti.import(l.configFile,{default:!0}),typeof l.config==`function`&&(l.config=await l.config(t.context)),t.envName){let e={...l.config[`$`+t.envName],...l.config.$env?.[t.envName]};Object.keys(e).length>0&&(l.config=r(e,l.config))}return l.meta=ni(l.sourceOptions.meta,l.config.$meta),delete l.config.$meta,l.sourceOptions.overrides&&(l.config=r(l.sourceOptions.overrides,l.config)),l.configFile=Xi(l.configFile),l.source=Xi(l.source),l}function ia(e,t){let n=jr(e,{try:!0,from:ce(an(t.cwd||`.`,t.configFile||`/`)),suffixes:[``,`/index`],extensions:Qi,cache:!1});return n?rn(n):void 0}const aa={openaiApiKey:``,language:`fr`,model:`whisper-1`,templatesDir:a(_(),`.config`,`video-toolkit`,`templates`)};async function oa(){let{config:e}=await $i({name:`video-toolkit`,defaults:aa,globalRc:!0});return{openaiApiKey:e.openaiApiKey||``,language:e.language||`fr`,model:e.model||`whisper-1`,templatesDir:e.templatesDir}}function sa(e){let t=o(e),i=n(t,r(t)),s=o(t,`..`),c=a(s,`${i}_audio.mp3`),l=a(s,`${i}.srt`),u=a(s,`thumbnails`);x(u)||C(u,{recursive:!0});let d=[`first`,`25`,`50`,`75`,`last`];return{videoPath:t,audioPath:c,srtPath:l,thumbnailTempPaths:d.map(e=>a(u,`${i}_thumbnail_${e}_temp.png`)),thumbnailPaths:d.map(e=>a(u,`${i}_thumbnail_${e}.png`))}}const ca=6048e5,la=3600*24;la*7,la*365.2425;const ua=Symbol.for(`constructDateFrom`);function da(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&ua in e?e[ua](t):e instanceof Date?new e.constructor(t):new Date(t)}function fa(e,t){return da(t||e,e)}function pa(e,t,n){let r=fa(e,n?.in);return isNaN(t)?da(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}let ma={};function ha(){return ma}function ga(e,t){let n=ha(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=fa(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function _a(e,t){return ga(e,{...t,weekStartsOn:1})}function va(e,t){let n=fa(e,t?.in),r=n.getFullYear(),i=da(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=_a(i),o=da(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=_a(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function ya(e){let t=fa(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function ba(e,...t){let n=da.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function xa(e,t){let n=fa(e,t?.in);return n.setHours(0,0,0,0),n}function Sa(e,t,n){let[r,i]=ba(n?.in,e,t),a=xa(r),o=xa(i),s=+a-ya(a),c=+o-ya(o);return Math.round((s-c)/864e5)}function Ca(e,t){let n=va(e,t),r=da(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),_a(r)}function wa(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function Ta(e){return!(!wa(e)&&typeof e!=`number`||isNaN(+fa(e)))}function Ea(e,t){let n=fa(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const Da={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},Oa=(e,t,n)=>{let r,i=Da[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function ka(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Aa={date:ka({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:ka({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:ka({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},ja={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},Ma=(e,t,n,r)=>ja[e];function Na(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}const Pa={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:Na({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:Na({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:Na({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:Na({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:Na({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function Fa(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?La(s,e=>e.test(o)):Ia(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function Ia(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function La(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Ra(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}const za={code:`en-US`,formatDistance:Oa,formatLong:Aa,formatRelative:Ma,localize:Pa,match:{ordinalNumber:Ra({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:Fa({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:Fa({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:Fa({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:Fa({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:Fa({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ba(e,t){let n=fa(e,t?.in);return Sa(n,Ea(n))+1}function Va(e,t){let n=fa(e,t?.in),r=_a(n)-+Ca(n);return Math.round(r/ca)+1}function Ha(e,t){let n=fa(e,t?.in),r=n.getFullYear(),i=ha(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=da(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=ga(o,t),c=da(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=ga(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function Ua(e,t){let n=ha(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Ha(e,t),a=da(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),ga(a,t)}function Wa(e,t){let n=fa(e,t?.in),r=ga(n,t)-+Ua(n,t);return Math.round(r/ca)+1}function W(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}const Ga={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return W(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):W(n+1,2)},d(e,t){return W(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];case`aaaa`:default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return W(e.getHours()%12||12,t.length)},H(e,t){return W(e.getHours(),t.length)},m(e,t){return W(e.getMinutes(),t.length)},s(e,t){return W(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return W(Math.trunc(r*10**(n-3)),t.length)}},Ka={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},qa={G:function(e,t,n){let r=e.getFullYear()>0?1:0;switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});case`GGGG`:default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return Ga.y(e,t)},Y:function(e,t,n,r){let i=Ha(e,r),a=i>0?i:1-i;return t===`YY`?W(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):W(a,t.length)},R:function(e,t){return W(va(e),t.length)},u:function(e,t){return W(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return W(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});case`QQQQ`:default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return W(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});case`qqqq`:default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return Ga.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});case`MMMM`:default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return W(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});case`LLLL`:default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=Wa(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):W(i,t.length)},I:function(e,t,n){let r=Va(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):W(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):Ga.d(e,t)},D:function(e,t,n){let r=Ba(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):W(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});case`EEEE`:default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return W(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});case`eeee`:default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return W(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});case`cccc`:default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return W(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});case`iiii`:default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});case`aaaa`:default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?Ka.noon:r===0?Ka.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});case`bbbb`:default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?Ka.evening:r>=12?Ka.afternoon:r>=4?Ka.morning:Ka.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});case`BBBB`:default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return Ga.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):Ga.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):W(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):W(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):Ga.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):Ga.s(e,t)},S:function(e,t){return Ga.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return Ya(r);case`XXXX`:case`XX`:return Xa(r);case`XXXXX`:case`XXX`:default:return Xa(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return Ya(r);case`xxxx`:case`xx`:return Xa(r);case`xxxxx`:case`xxx`:default:return Xa(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+Ja(r,`:`);case`OOOO`:default:return`GMT`+Xa(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+Ja(r,`:`);case`zzzz`:default:return`GMT`+Xa(r,`:`)}},t:function(e,t,n){return W(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return W(+e,t.length)}};function Ja(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+W(a,2)}function Ya(e,t){return e%60==0?(e>0?`-`:`+`)+W(Math.abs(e)/60,2):Xa(e,t)}function Xa(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=W(Math.trunc(r/60),2),a=W(r%60,2);return n+i+t+a}const Za=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});case`PPPP`:default:return t.date({width:`full`})}},Qa=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});case`pppp`:default:return t.time({width:`full`})}},$a={p:Qa,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Za(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;case`PPPP`:default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,Za(r,t)).replace(`{{time}}`,Qa(i,t))}},eo=/^D+$/,to=/^Y+$/,no=[`D`,`DD`,`YY`,`YYYY`];function ro(e){return eo.test(e)}function io(e){return to.test(e)}function ao(e,t,n){let r=oo(e,t,n);if(console.warn(r),no.includes(e))throw RangeError(r)}function oo(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const so=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,co=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,lo=/^'([^]*?)'?$/,uo=/''/g,fo=/[a-zA-Z]/;function po(e,t,n){let r=ha(),i=n?.locale??r.locale??za,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=fa(e,n?.in);if(!Ta(s))throw RangeError(`Invalid time value`);let c=t.match(co).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=$a[t];return n(e,i.formatLong)}return e}).join(``).match(so).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:mo(e)};if(qa[t])return{isToken:!0,value:e};if(t.match(fo))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&io(a)||!n?.useAdditionalDayOfYearTokens&&ro(a))&&ao(a,t,String(e));let o=qa[a[0]];return o(s,a,i.localize,l)}).join(``)}function mo(e){let t=e.match(lo);return t?t[1].replace(uo,`'`):e}function ho(){return Object.assign({},ha())}function go(e,t){let n=fa(e,t?.in).getDay();return n===0?7:n}function _o(e,t){let n=vo(t)?new t(0):da(t,0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}function vo(e){return typeof e==`function`&&e.prototype?.constructor===e}var yo=class{subPriority=0;validate(e,t){return!0}},bo=class extends yo{constructor(e,t,n,r,i){super(),this.value=e,this.validateValue=t,this.setValue=n,this.priority=r,i&&(this.subPriority=i)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,n){return this.setValue(e,t,this.value,n)}},xo=class extends yo{priority=10;subPriority=-1;constructor(e,t){super(),this.context=e||(e=>da(t,e))}set(e,t){return t.timestampIsSet?e:da(e,_o(e,this.context))}},G=class{run(e,t,n,r){let i=this.parse(e,t,n,r);return i?{setter:new bo(i.value,this.validate,this.set,this.priority,this.subPriority),rest:i.rest}:null}validate(e,t,n){return!0}},So=class extends G{priority=140;parse(e,t,n){switch(t){case`G`:case`GG`:case`GGG`:return n.era(e,{width:`abbreviated`})||n.era(e,{width:`narrow`});case`GGGGG`:return n.era(e,{width:`narrow`});case`GGGG`:default:return n.era(e,{width:`wide`})||n.era(e,{width:`abbreviated`})||n.era(e,{width:`narrow`})}}set(e,t,n){return t.era=n,e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`R`,`u`,`t`,`T`]};const Co={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},wo={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function To(e,t){return e&&{value:t(e.value),rest:e.rest}}function K(e,t){let n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function Eo(e,t){let n=t.match(e);if(!n)return null;if(n[0]===`Z`)return{value:0,rest:t.slice(1)};let r=n[1]===`+`?1:-1,i=n[2]?parseInt(n[2],10):0,a=n[3]?parseInt(n[3],10):0,o=n[5]?parseInt(n[5],10):0;return{value:r*(i*36e5+a*6e4+o*1e3),rest:t.slice(n[0].length)}}function Do(e){return K(Co.anyDigitsSigned,e)}function Oo(e,t){switch(e){case 1:return K(Co.singleDigit,t);case 2:return K(Co.twoDigits,t);case 3:return K(Co.threeDigits,t);case 4:return K(Co.fourDigits,t);default:return K(RegExp(`^\\d{1,`+e+`}`),t)}}function ko(e,t){switch(e){case 1:return K(Co.singleDigitSigned,t);case 2:return K(Co.twoDigitsSigned,t);case 3:return K(Co.threeDigitsSigned,t);case 4:return K(Co.fourDigitsSigned,t);default:return K(RegExp(`^-?\\d{1,`+e+`}`),t)}}function Ao(e){switch(e){case`morning`:return 4;case`evening`:return 17;case`pm`:case`noon`:case`afternoon`:return 12;case`am`:case`midnight`:case`night`:default:return 0}}function jo(e,t){let n=t>0,r=n?t:1-t,i;if(r<=50)i=e||100;else{let t=r+50,n=Math.trunc(t/100)*100,a=e>=t%100;i=e+n-(a?100:0)}return n?i:1-i}function Mo(e){return e%400==0||e%4==0&&e%100!=0}var No=class extends G{priority=130;incompatibleTokens=[`Y`,`R`,`u`,`w`,`I`,`i`,`e`,`c`,`t`,`T`];parse(e,t,n){let r=e=>({year:e,isTwoDigitYear:t===`yy`});switch(t){case`y`:return To(Oo(4,e),r);case`yo`:return To(n.ordinalNumber(e,{unit:`year`}),r);default:return To(Oo(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n){let r=e.getFullYear();if(n.isTwoDigitYear){let t=jo(n.year,r);return e.setFullYear(t,0,1),e.setHours(0,0,0,0),e}let i=!(`era`in t)||t.era===1?n.year:1-n.year;return e.setFullYear(i,0,1),e.setHours(0,0,0,0),e}},Po=class extends G{priority=130;parse(e,t,n){let r=e=>({year:e,isTwoDigitYear:t===`YY`});switch(t){case`Y`:return To(Oo(4,e),r);case`Yo`:return To(n.ordinalNumber(e,{unit:`year`}),r);default:return To(Oo(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n,r){let i=Ha(e,r);if(n.isTwoDigitYear){let t=jo(n.year,i);return e.setFullYear(t,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),ga(e,r)}let a=!(`era`in t)||t.era===1?n.year:1-n.year;return e.setFullYear(a,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),ga(e,r)}incompatibleTokens=[`y`,`R`,`u`,`Q`,`q`,`M`,`L`,`I`,`d`,`D`,`i`,`t`,`T`]},Fo=class extends G{priority=130;parse(e,t){return ko(t===`R`?4:t.length,e)}set(e,t,n){let r=da(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),_a(r)}incompatibleTokens=[`G`,`y`,`Y`,`u`,`Q`,`q`,`M`,`L`,`w`,`d`,`D`,`e`,`c`,`t`,`T`]},Io=class extends G{priority=130;parse(e,t){return ko(t===`u`?4:t.length,e)}set(e,t,n){return e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`G`,`y`,`Y`,`R`,`w`,`I`,`i`,`e`,`c`,`t`,`T`]},Lo=class extends G{priority=120;parse(e,t,n){switch(t){case`Q`:case`QQ`:return Oo(t.length,e);case`Qo`:return n.ordinalNumber(e,{unit:`quarter`});case`QQQ`:return n.quarter(e,{width:`abbreviated`,context:`formatting`})||n.quarter(e,{width:`narrow`,context:`formatting`});case`QQQQQ`:return n.quarter(e,{width:`narrow`,context:`formatting`});case`QQQQ`:default:return n.quarter(e,{width:`wide`,context:`formatting`})||n.quarter(e,{width:`abbreviated`,context:`formatting`})||n.quarter(e,{width:`narrow`,context:`formatting`})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`q`,`M`,`L`,`w`,`I`,`d`,`D`,`i`,`e`,`c`,`t`,`T`]},Ro=class extends G{priority=120;parse(e,t,n){switch(t){case`q`:case`qq`:return Oo(t.length,e);case`qo`:return n.ordinalNumber(e,{unit:`quarter`});case`qqq`:return n.quarter(e,{width:`abbreviated`,context:`standalone`})||n.quarter(e,{width:`narrow`,context:`standalone`});case`qqqqq`:return n.quarter(e,{width:`narrow`,context:`standalone`});case`qqqq`:default:return n.quarter(e,{width:`wide`,context:`standalone`})||n.quarter(e,{width:`abbreviated`,context:`standalone`})||n.quarter(e,{width:`narrow`,context:`standalone`})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`Q`,`M`,`L`,`w`,`I`,`d`,`D`,`i`,`e`,`c`,`t`,`T`]},zo=class extends G{incompatibleTokens=[`Y`,`R`,`q`,`Q`,`L`,`w`,`I`,`D`,`i`,`e`,`c`,`t`,`T`];priority=110;parse(e,t,n){let r=e=>e-1;switch(t){case`M`:return To(K(Co.month,e),r);case`MM`:return To(Oo(2,e),r);case`Mo`:return To(n.ordinalNumber(e,{unit:`month`}),r);case`MMM`:return n.month(e,{width:`abbreviated`,context:`formatting`})||n.month(e,{width:`narrow`,context:`formatting`});case`MMMMM`:return n.month(e,{width:`narrow`,context:`formatting`});case`MMMM`:default:return n.month(e,{width:`wide`,context:`formatting`})||n.month(e,{width:`abbreviated`,context:`formatting`})||n.month(e,{width:`narrow`,context:`formatting`})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}},Bo=class extends G{priority=110;parse(e,t,n){let r=e=>e-1;switch(t){case`L`:return To(K(Co.month,e),r);case`LL`:return To(Oo(2,e),r);case`Lo`:return To(n.ordinalNumber(e,{unit:`month`}),r);case`LLL`:return n.month(e,{width:`abbreviated`,context:`standalone`})||n.month(e,{width:`narrow`,context:`standalone`});case`LLLLL`:return n.month(e,{width:`narrow`,context:`standalone`});case`LLLL`:default:return n.month(e,{width:`wide`,context:`standalone`})||n.month(e,{width:`abbreviated`,context:`standalone`})||n.month(e,{width:`narrow`,context:`standalone`})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`q`,`Q`,`M`,`w`,`I`,`D`,`i`,`e`,`c`,`t`,`T`]};function Vo(e,t,n){let r=fa(e,n?.in),i=Wa(r,n)-t;return r.setDate(r.getDate()-i*7),fa(r,n?.in)}var Ho=class extends G{priority=100;parse(e,t,n){switch(t){case`w`:return K(Co.week,e);case`wo`:return n.ordinalNumber(e,{unit:`week`});default:return Oo(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n,r){return ga(Vo(e,n,r),r)}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`i`,`t`,`T`]};function Uo(e,t,n){let r=fa(e,n?.in),i=Va(r,n)-t;return r.setDate(r.getDate()-i*7),r}var Wo=class extends G{priority=100;parse(e,t,n){switch(t){case`I`:return K(Co.week,e);case`Io`:return n.ordinalNumber(e,{unit:`week`});default:return Oo(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n){return _a(Uo(e,n))}incompatibleTokens=[`y`,`Y`,`u`,`q`,`Q`,`M`,`L`,`w`,`d`,`D`,`e`,`c`,`t`,`T`]};const Go=[31,28,31,30,31,30,31,31,30,31,30,31],Ko=[31,29,31,30,31,30,31,31,30,31,30,31];var qo=class extends G{priority=90;subPriority=1;parse(e,t,n){switch(t){case`d`:return K(Co.date,e);case`do`:return n.ordinalNumber(e,{unit:`date`});default:return Oo(t.length,e)}}validate(e,t){let n=Mo(e.getFullYear()),r=e.getMonth();return n?t>=1&&t<=Ko[r]:t>=1&&t<=Go[r]}set(e,t,n){return e.setDate(n),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`q`,`Q`,`w`,`I`,`D`,`i`,`e`,`c`,`t`,`T`]},Jo=class extends G{priority=90;subpriority=1;parse(e,t,n){switch(t){case`D`:case`DD`:return K(Co.dayOfYear,e);case`Do`:return n.ordinalNumber(e,{unit:`date`});default:return Oo(t.length,e)}}validate(e,t){return Mo(e.getFullYear())?t>=1&&t<=366:t>=1&&t<=365}set(e,t,n){return e.setMonth(0,n),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`q`,`Q`,`M`,`L`,`w`,`I`,`d`,`E`,`i`,`e`,`c`,`t`,`T`]};function Yo(e,t,n){let r=ha(),i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=fa(e,n?.in),o=a.getDay(),s=(t%7+7)%7,c=7-i;return pa(a,t<0||t>6?t-(o+c)%7:(s+c)%7-(o+c)%7,n)}var Xo=class extends G{priority=90;parse(e,t,n){switch(t){case`E`:case`EE`:case`EEE`:return n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`});case`EEEEE`:return n.day(e,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`});case`EEEE`:default:return n.day(e,{width:`wide`,context:`formatting`})||n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return e=Yo(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`D`,`i`,`e`,`c`,`t`,`T`]},Zo=class extends G{priority=90;parse(e,t,n,r){let i=e=>{let t=Math.floor((e-1)/7)*7;return(e+r.weekStartsOn+6)%7+t};switch(t){case`e`:case`ee`:return To(Oo(t.length,e),i);case`eo`:return To(n.ordinalNumber(e,{unit:`day`}),i);case`eee`:return n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`});case`eeeee`:return n.day(e,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`});case`eeee`:default:return n.day(e,{width:`wide`,context:`formatting`})||n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return e=Yo(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`E`,`i`,`c`,`t`,`T`]},Qo=class extends G{priority=90;parse(e,t,n,r){let i=e=>{let t=Math.floor((e-1)/7)*7;return(e+r.weekStartsOn+6)%7+t};switch(t){case`c`:case`cc`:return To(Oo(t.length,e),i);case`co`:return To(n.ordinalNumber(e,{unit:`day`}),i);case`ccc`:return n.day(e,{width:`abbreviated`,context:`standalone`})||n.day(e,{width:`short`,context:`standalone`})||n.day(e,{width:`narrow`,context:`standalone`});case`ccccc`:return n.day(e,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(e,{width:`short`,context:`standalone`})||n.day(e,{width:`narrow`,context:`standalone`});case`cccc`:default:return n.day(e,{width:`wide`,context:`standalone`})||n.day(e,{width:`abbreviated`,context:`standalone`})||n.day(e,{width:`short`,context:`standalone`})||n.day(e,{width:`narrow`,context:`standalone`})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return e=Yo(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`E`,`i`,`e`,`t`,`T`]};function $o(e,t,n){let r=fa(e,n?.in);return pa(r,t-go(r,n),n)}var es=class extends G{priority=90;parse(e,t,n){let r=e=>e===0?7:e;switch(t){case`i`:case`ii`:return Oo(t.length,e);case`io`:return n.ordinalNumber(e,{unit:`day`});case`iii`:return To(n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r);case`iiiii`:return To(n.day(e,{width:`narrow`,context:`formatting`}),r);case`iiiiii`:return To(n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r);case`iiii`:default:return To(n.day(e,{width:`wide`,context:`formatting`})||n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r)}}validate(e,t){return t>=1&&t<=7}set(e,t,n){return e=$o(e,n),e.setHours(0,0,0,0),e}incompatibleTokens=[`y`,`Y`,`u`,`q`,`Q`,`M`,`L`,`w`,`d`,`D`,`E`,`e`,`c`,`t`,`T`]},ts=class extends G{priority=80;parse(e,t,n){switch(t){case`a`:case`aa`:case`aaa`:return n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`});case`aaaaa`:return n.dayPeriod(e,{width:`narrow`,context:`formatting`});case`aaaa`:default:return n.dayPeriod(e,{width:`wide`,context:`formatting`})||n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`})}}set(e,t,n){return e.setHours(Ao(n),0,0,0),e}incompatibleTokens=[`b`,`B`,`H`,`k`,`t`,`T`]},ns=class extends G{priority=80;parse(e,t,n){switch(t){case`b`:case`bb`:case`bbb`:return n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`});case`bbbbb`:return n.dayPeriod(e,{width:`narrow`,context:`formatting`});case`bbbb`:default:return n.dayPeriod(e,{width:`wide`,context:`formatting`})||n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`})}}set(e,t,n){return e.setHours(Ao(n),0,0,0),e}incompatibleTokens=[`a`,`B`,`H`,`k`,`t`,`T`]},rs=class extends G{priority=80;parse(e,t,n){switch(t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`});case`BBBBB`:return n.dayPeriod(e,{width:`narrow`,context:`formatting`});case`BBBB`:default:return n.dayPeriod(e,{width:`wide`,context:`formatting`})||n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`})}}set(e,t,n){return e.setHours(Ao(n),0,0,0),e}incompatibleTokens=[`a`,`b`,`t`,`T`]},is=class extends G{priority=70;parse(e,t,n){switch(t){case`h`:return K(Co.hour12h,e);case`ho`:return n.ordinalNumber(e,{unit:`hour`});default:return Oo(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,n){let r=e.getHours()>=12;return r&&n<12?e.setHours(n+12,0,0,0):!r&&n===12?e.setHours(0,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=[`H`,`K`,`k`,`t`,`T`]},as=class extends G{priority=70;parse(e,t,n){switch(t){case`H`:return K(Co.hour23h,e);case`Ho`:return n.ordinalNumber(e,{unit:`hour`});default:return Oo(t.length,e)}}validate(e,t){return t>=0&&t<=23}set(e,t,n){return e.setHours(n,0,0,0),e}incompatibleTokens=[`a`,`b`,`h`,`K`,`k`,`t`,`T`]},os=class extends G{priority=70;parse(e,t,n){switch(t){case`K`:return K(Co.hour11h,e);case`Ko`:return n.ordinalNumber(e,{unit:`hour`});default:return Oo(t.length,e)}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.getHours()>=12&&n<12?e.setHours(n+12,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=[`h`,`H`,`k`,`t`,`T`]},ss=class extends G{priority=70;parse(e,t,n){switch(t){case`k`:return K(Co.hour24h,e);case`ko`:return n.ordinalNumber(e,{unit:`hour`});default:return Oo(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,n){let r=n<=24?n%24:n;return e.setHours(r,0,0,0),e}incompatibleTokens=[`a`,`b`,`h`,`H`,`K`,`t`,`T`]},cs=class extends G{priority=60;parse(e,t,n){switch(t){case`m`:return K(Co.minute,e);case`mo`:return n.ordinalNumber(e,{unit:`minute`});default:return Oo(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setMinutes(n,0,0),e}incompatibleTokens=[`t`,`T`]},ls=class extends G{priority=50;parse(e,t,n){switch(t){case`s`:return K(Co.second,e);case`so`:return n.ordinalNumber(e,{unit:`second`});default:return Oo(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setSeconds(n,0),e}incompatibleTokens=[`t`,`T`]},us=class extends G{priority=30;parse(e,t){return To(Oo(t.length,e),e=>Math.trunc(e*10**(-t.length+3)))}set(e,t,n){return e.setMilliseconds(n),e}incompatibleTokens=[`t`,`T`]},ds=class extends G{priority=10;parse(e,t){switch(t){case`X`:return Eo(wo.basicOptionalMinutes,e);case`XX`:return Eo(wo.basic,e);case`XXXX`:return Eo(wo.basicOptionalSeconds,e);case`XXXXX`:return Eo(wo.extendedOptionalSeconds,e);case`XXX`:default:return Eo(wo.extended,e)}}set(e,t,n){return t.timestampIsSet?e:da(e,e.getTime()-ya(e)-n)}incompatibleTokens=[`t`,`T`,`x`]},fs=class extends G{priority=10;parse(e,t){switch(t){case`x`:return Eo(wo.basicOptionalMinutes,e);case`xx`:return Eo(wo.basic,e);case`xxxx`:return Eo(wo.basicOptionalSeconds,e);case`xxxxx`:return Eo(wo.extendedOptionalSeconds,e);case`xxx`:default:return Eo(wo.extended,e)}}set(e,t,n){return t.timestampIsSet?e:da(e,e.getTime()-ya(e)-n)}incompatibleTokens=[`t`,`T`,`X`]},ps=class extends G{priority=40;parse(e){return Do(e)}set(e,t,n){return[da(e,n*1e3),{timestampIsSet:!0}]}incompatibleTokens=`*`},ms=class extends G{priority=20;parse(e){return Do(e)}set(e,t,n){return[da(e,n),{timestampIsSet:!0}]}incompatibleTokens=`*`};const hs={G:new So,y:new No,Y:new Po,R:new Fo,u:new Io,Q:new Lo,q:new Ro,M:new zo,L:new Bo,w:new Ho,I:new Wo,d:new qo,D:new Jo,E:new Xo,e:new Zo,c:new Qo,i:new es,a:new ts,b:new ns,B:new rs,h:new is,H:new as,K:new os,k:new ss,m:new cs,s:new ls,S:new us,X:new ds,x:new fs,t:new ps,T:new ms},gs=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,_s=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,vs=/^'([^]*?)'?$/,ys=/''/g,bs=/\S/,xs=/[a-zA-Z]/;function Ss(e,t,n,r){let i=()=>da(r?.in||n,NaN),a=ho(),o=r?.locale??a.locale??za,s=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,c=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0;if(!t)return e?i():fa(n,r?.in);let l={firstWeekContainsDate:s,weekStartsOn:c,locale:o},u=[new xo(r?.in,n)],d=t.match(_s).map(e=>{let t=e[0];if(t in $a){let n=$a[t];return n(e,o.formatLong)}return e}).join(``).match(gs),f=[];for(let n of d){!r?.useAdditionalWeekYearTokens&&io(n)&&ao(n,t,e),!r?.useAdditionalDayOfYearTokens&&ro(n)&&ao(n,t,e);let a=n[0],s=hs[a];if(s){let{incompatibleTokens:t}=s;if(Array.isArray(t)){let e=f.find(e=>t.includes(e.token)||e.token===a);if(e)throw RangeError(`The format string mustn't contain \`${e.fullToken}\` and \`${n}\` at the same time`)}else if(s.incompatibleTokens===`*`&&f.length>0)throw RangeError(`The format string mustn't contain \`${n}\` and any other token at the same time`);f.push({token:a,fullToken:n});let r=s.run(e,n,o.match,l);if(!r)return i();u.push(r.setter),e=r.rest}else{if(a.match(xs))throw RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");if(n===`''`?n=`'`:a===`'`&&(n=Cs(n)),e.indexOf(n)===0)e=e.slice(n.length);else return i()}}if(e.length>0&&bs.test(e))return i();let p=u.map(e=>e.priority).sort((e,t)=>t-e).filter((e,t,n)=>n.indexOf(e)===t).map(e=>u.filter(t=>t.priority===e).sort((e,t)=>t.subPriority-e.subPriority)).map(e=>e[0]),m=fa(n,r?.in);if(isNaN(+m))return i();let h={};for(let e of p){if(!e.validate(m,l))return i();let t=e.set(m,h,l);Array.isArray(t)?(m=t[0],Object.assign(h,t[1])):m=t}return m}function Cs(e){return e.match(vs)[1].replace(ys,`'`)}var ws=A(((e,t)=>{
71
71
  /*!
72
72
  Copyright 2013 Lovell Fuller and others.
73
73
  SPDX-License-Identifier: Apache-2.0
74
74
  */
75
- let n=e=>e!=null;t.exports={defined:n,object:e=>typeof e==`object`,plainObject:e=>Object.prototype.toString.call(e)===`[object Object]`,fn:e=>typeof e==`function`,bool:e=>typeof e==`boolean`,buffer:e=>e instanceof Buffer,typedArray:e=>{if(n(e))switch(e.constructor){case Uint8Array:case Uint8ClampedArray:case Int8Array:case Uint16Array:case Int16Array:case Uint32Array:case Int32Array:case Float32Array:case Float64Array:return!0}return!1},arrayBuffer:e=>e instanceof ArrayBuffer,string:e=>typeof e==`string`&&e.length>0,number:e=>typeof e==`number`&&!Number.isNaN(e),integer:e=>Number.isInteger(e),inRange:(e,t,n)=>e>=t&&e<=n,inArray:(e,t)=>t.includes(e),invalidParameterError:(e,t,n)=>Error(`Expected ${t} for ${e} but received ${n} of type ${typeof n}`),nativeError:(e,t)=>(t.message=e.message,t)}})),oa=M(((e,t)=>{let n=()=>process.platform===`linux`,r=null;t.exports={isLinux:n,getReport:()=>{if(!r)if(n()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,r=process.report.getReport(),process.report.excludeNetwork=e}else r={};return r}}})),sa=M(((e,t)=>{let n=N(`fs`),r=2048;t.exports={LDD_PATH:`/usr/bin/ldd`,SELF_PATH:`/proc/self/exe`,readFileSync:e=>{let t=n.openSync(e,`r`),i=Buffer.alloc(r),a=n.readSync(t,i,0,r,0);return n.close(t,()=>{}),i.subarray(0,a)},readFile:e=>new Promise((t,i)=>{n.open(e,`r`,(e,a)=>{if(e)i(e);else{let e=Buffer.alloc(r);n.read(a,e,0,r,0,(r,i)=>{t(e.subarray(0,i)),n.close(a,()=>{})})}})})}})),ca=M(((e,t)=>{t.exports={interpreterPath:e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),n=e.readUInt16LE(54),r=e.readUInt16LE(56);for(let i=0;i<r;i++){let r=t+i*n;if(e.readUInt32LE(r)===3){let t=e.readUInt32LE(r+8),n=e.readUInt32LE(r+32);return e.subarray(t,t+n).toString().replace(/\0.*$/g,``)}}return null}}})),la=M(((e,t)=>{let n=N(`child_process`),{isLinux:r,getReport:i}=oa(),{LDD_PATH:a,SELF_PATH:o,readFile:s,readFileSync:c}=sa(),{interpreterPath:l}=ca(),u,d,f,p=`getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true`,m=``,h=()=>m||new Promise(e=>{n.exec(p,(t,n)=>{m=t?` `:n,e(m)})}),g=()=>{if(!m)try{m=n.execSync(p,{encoding:`utf8`})}catch{m=` `}return m},_=`glibc`,v=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,y=`musl`,b=e=>e.includes(`libc.musl-`)||e.includes(`ld-musl-`),x=()=>{let e=i();return e.header&&e.header.glibcVersionRuntime?_:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(b)?y:null},S=e=>{let[t,n]=e.split(/[\r\n]+/);return t&&t.includes(_)?_:n&&n.includes(y)?y:null},C=e=>{if(e){if(e.includes(`/ld-musl-`))return y;if(e.includes(`/ld-linux-`))return _}return null},w=e=>(e=e.toString(),e.includes(`musl`)?y:e.includes(`GNU C Library`)?_:null),ee=async()=>{if(d!==void 0)return d;d=null;try{d=w(await s(a))}catch{}return d},te=()=>{if(d!==void 0)return d;d=null;try{d=w(c(a))}catch{}return d},T=async()=>{if(u!==void 0)return u;u=null;try{u=C(l(await s(o)))}catch{}return u},ne=()=>{if(u!==void 0)return u;u=null;try{u=C(l(c(o)))}catch{}return u},re=async()=>{let e=null;return r()&&(e=await T(),e||(e=await ee(),e||=x(),e||=S(await h()))),e},ie=()=>{let e=null;return r()&&(e=ne(),e||(e=te(),e||=x(),e||=S(g()))),e},ae=async()=>r()&&await re()!==_,oe=()=>r()&&ie()!==_,se=async()=>{if(f!==void 0)return f;f=null;try{let e=(await s(a)).match(v);e&&(f=e[1])}catch{}return f},E=()=>{if(f!==void 0)return f;f=null;try{let e=c(a).match(v);e&&(f=e[1])}catch{}return f},D=()=>{let e=i();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},ce=e=>e.trim().split(/\s+/)[1],O=e=>{let[t,n,r]=e.split(/[\r\n]+/);return t&&t.includes(_)?ce(t):n&&r&&n.includes(y)?ce(r):null};t.exports={GLIBC:_,MUSL:y,family:re,familySync:ie,isNonGlibcLinux:ae,isNonGlibcLinuxSync:oe,version:async()=>{let e=null;return r()&&(e=await se(),e||=D(),e||=O(await h())),e},versionSync:()=>{let e=null;return r()&&(e=E(),e||=D(),e||=O(g())),e}}})),ua=M(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),da=M(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),fa=M(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=da(),a=ua();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),pa=M(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),ma=M(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),ha=M(((e,t)=>{let n=ua(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=da(),{safeRe:a,t:o}=fa(),s=pa(),{compareIdentifiers:c}=ma();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),ga=M(((e,t)=>{let n=ha();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),_a=M(((e,t)=>{let n=ha(),r=ga(),{safeRe:i,t:a}=fa();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),va=M(((e,t)=>{let n=ha();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),ya=M(((e,t)=>{let n=va();t.exports=(e,t,r)=>n(e,t,r)>=0})),ba=M(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),xa=M(((e,t)=>{let n=va();t.exports=(e,t,r)=>n(e,t,r)===0})),Sa=M(((e,t)=>{let n=va();t.exports=(e,t,r)=>n(e,t,r)!==0})),Ca=M(((e,t)=>{let n=va();t.exports=(e,t,r)=>n(e,t,r)>0})),wa=M(((e,t)=>{let n=va();t.exports=(e,t,r)=>n(e,t,r)<0})),Ta=M(((e,t)=>{let n=va();t.exports=(e,t,r)=>n(e,t,r)<=0})),Ea=M(((e,t)=>{let n=xa(),r=Sa(),i=Ca(),a=ya(),o=wa(),s=Ta();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),Da=M(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=pa(),{safeRe:i,t:a}=fa(),o=Ea(),s=ua(),c=ha(),l=Oa()})),Oa=M(((e,t)=>{let n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,ne(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>T(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let b=[..._.values()];return r.set(t,b),b}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(re(this.set[t],e,this.options))return!0;return!1}};let r=new(ba()),i=pa(),a=Da(),o=ua(),s=ha(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=fa(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=da(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=S(e,t),o(`caret`,e),e=b(e,t),o(`tildes`,e),e=w(e,t),o(`xrange`,e),e=te(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,b=(e,t)=>e.trim().split(/\s+/).map(e=>x(e,t)).join(` `),x=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},S=(e,t)=>e.trim().split(/\s+/).map(e=>C(e,t)).join(` `),C=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},w=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>ee(e,t)).join(` `)),ee=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},te=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),T=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),ne=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),re=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),ka=M(((e,t)=>{let n=Oa();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),Aa=M(((e,t)=>{t.exports={name:`sharp`,description:`High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images`,version:`0.34.5`,author:`Lovell Fuller <npm@lovell.info>`,homepage:`https://sharp.pixelplumbing.com`,contributors:`Pierre Inglebert <pierre.inglebert@gmail.com>,Jonathan Ong <jonathanrichardong@gmail.com>,Chanon Sajjamanochai <chanon.s@gmail.com>,Juliano Julio <julianojulio@gmail.com>,Daniel Gasienica <daniel@gasienica.ch>,Julian Walker <julian@fiftythree.com>,Amit Pitaru <pitaru.amit@gmail.com>,Brandon Aaron <hello.brandon@aaron.sh>,Andreas Lind <andreas@one.com>,Maurus Cuelenaere <mcuelenaere@gmail.com>,Linus Unnebäck <linus@folkdatorn.se>,Victor Mateevitsi <mvictoras@gmail.com>,Alaric Holloway <alaric.holloway@gmail.com>,Bernhard K. Weisshuhn <bkw@codingforce.com>,Chris Riley <criley@primedia.com>,David Carley <dacarley@gmail.com>,John Tobin <john@limelightmobileinc.com>,Kenton Gray <kentongray@gmail.com>,Felix Bünemann <Felix.Buenemann@gmail.com>,Samy Al Zahrani <samyalzahrany@gmail.com>,Chintan Thakkar <lemnisk8@gmail.com>,F. Orlando Galashan <frulo@gmx.de>,Kleis Auke Wolthuizen <info@kleisauke.nl>,Matt Hirsch <mhirsch@media.mit.edu>,Matthias Thoemmes <thoemmes@gmail.com>,Patrick Paskaris <patrick@paskaris.gr>,Jérémy Lal <kapouer@melix.org>,Rahul Nanwani <r.nanwani@gmail.com>,Alice Monday <alice0meta@gmail.com>,Kristo Jorgenson <kristo.jorgenson@gmail.com>,YvesBos <yves_bos@outlook.com>,Guy Maliar <guy@tailorbrands.com>,Nicolas Coden <nicolas@ncoden.fr>,Matt Parrish <matt.r.parrish@gmail.com>,Marcel Bretschneider <marcel.bretschneider@gmail.com>,Matthew McEachen <matthew+github@mceachen.org>,Jarda Kotěšovec <jarda.kotesovec@gmail.com>,Kenric D'Souza <kenric.dsouza@gmail.com>,Oleh Aleinyk <oleg.aleynik@gmail.com>,Marcel Bretschneider <marcel.bretschneider@gmail.com>,Andrea Bianco <andrea.bianco@unibas.ch>,Rik Heywood <rik@rik.org>,Thomas Parisot <hi@oncletom.io>,Nathan Graves <nathanrgraves+github@gmail.com>,Tom Lokhorst <tom@lokhorst.eu>,Espen Hovlandsdal <espen@hovlandsdal.com>,Sylvain Dumont <sylvain.dumont35@gmail.com>,Alun Davies <alun.owain.davies@googlemail.com>,Aidan Hoolachan <ajhoolachan21@gmail.com>,Axel Eirola <axel.eirola@iki.fi>,Freezy <freezy@xbmc.org>,Daiz <taneli.vatanen@gmail.com>,Julian Aubourg <j@ubourg.net>,Keith Belovay <keith@picthrive.com>,Michael B. Klein <mbklein@gmail.com>,Jordan Prudhomme <jordan@raboland.fr>,Ilya Ovdin <iovdin@gmail.com>,Andargor <andargor@yahoo.com>,Paul Neave <paul.neave@gmail.com>,Brendan Kennedy <brenwken@gmail.com>,Brychan Bennett-Odlum <git@brychan.io>,Edward Silverton <e.silverton@gmail.com>,Roman Malieiev <aromaleev@gmail.com>,Tomas Szabo <tomas.szabo@deftomat.com>,Robert O'Rourke <robert@o-rourke.org>,Guillermo Alfonso Varela Chouciño <guillevch@gmail.com>,Christian Flintrup <chr@gigahost.dk>,Manan Jadhav <manan@motionden.com>,Leon Radley <leon@radley.se>,alza54 <alza54@thiocod.in>,Jacob Smith <jacob@frende.me>,Michael Nutt <michael@nutt.im>,Brad Parham <baparham@gmail.com>,Taneli Vatanen <taneli.vatanen@gmail.com>,Joris Dugué <zaruike10@gmail.com>,Chris Banks <christopher.bradley.banks@gmail.com>,Ompal Singh <ompal.hitm09@gmail.com>,Brodan <christopher.hranj@gmail.com>,Ankur Parihar <ankur.github@gmail.com>,Brahim Ait elhaj <brahima@gmail.com>,Mart Jansink <m.jansink@gmail.com>,Lachlan Newman <lachnewman007@gmail.com>,Dennis Beatty <dennis@dcbeatty.com>,Ingvar Stepanyan <me@rreverser.com>,Don Denton <don@happycollision.com>`.split(`,`),scripts:{build:`node install/build.js`,install:`node install/check.js || npm run build`,clean:`rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*`,test:`npm run lint && npm run test-unit`,lint:`npm run lint-cpp && npm run lint-js && npm run lint-types`,"lint-cpp":`cpplint --quiet src/*.h src/*.cc`,"lint-js":`biome lint`,"lint-types":`tsd --files ./test/types/sharp.test-d.ts`,"test-leak":`./test/leak/leak.sh`,"test-unit":`node --experimental-test-coverage test/unit.mjs`,"package-from-local-build":`node npm/from-local-build.js`,"package-release-notes":`node npm/release-notes.js`,"docs-build":`node docs/build.mjs`,"docs-serve":`cd docs && npm start`,"docs-publish":`cd docs && npm run build && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp`},type:`commonjs`,main:`lib/index.js`,types:`lib/index.d.ts`,files:[`install`,`lib`,`src/*.{cc,h,gyp}`],repository:{type:`git`,url:`git://github.com/lovell/sharp.git`},keywords:[`jpeg`,`png`,`webp`,`avif`,`tiff`,`gif`,`svg`,`jp2`,`dzi`,`image`,`resize`,`thumbnail`,`crop`,`embed`,`libvips`,`vips`],dependencies:{"@img/colour":`^1.0.0`,"detect-libc":`^2.1.2`,semver:`^7.7.3`},optionalDependencies:{"@img/sharp-darwin-arm64":`0.34.5`,"@img/sharp-darwin-x64":`0.34.5`,"@img/sharp-libvips-darwin-arm64":`1.2.4`,"@img/sharp-libvips-darwin-x64":`1.2.4`,"@img/sharp-libvips-linux-arm":`1.2.4`,"@img/sharp-libvips-linux-arm64":`1.2.4`,"@img/sharp-libvips-linux-ppc64":`1.2.4`,"@img/sharp-libvips-linux-riscv64":`1.2.4`,"@img/sharp-libvips-linux-s390x":`1.2.4`,"@img/sharp-libvips-linux-x64":`1.2.4`,"@img/sharp-libvips-linuxmusl-arm64":`1.2.4`,"@img/sharp-libvips-linuxmusl-x64":`1.2.4`,"@img/sharp-linux-arm":`0.34.5`,"@img/sharp-linux-arm64":`0.34.5`,"@img/sharp-linux-ppc64":`0.34.5`,"@img/sharp-linux-riscv64":`0.34.5`,"@img/sharp-linux-s390x":`0.34.5`,"@img/sharp-linux-x64":`0.34.5`,"@img/sharp-linuxmusl-arm64":`0.34.5`,"@img/sharp-linuxmusl-x64":`0.34.5`,"@img/sharp-wasm32":`0.34.5`,"@img/sharp-win32-arm64":`0.34.5`,"@img/sharp-win32-ia32":`0.34.5`,"@img/sharp-win32-x64":`0.34.5`},devDependencies:{"@biomejs/biome":`^2.3.4`,"@cpplint/cli":`^0.1.0`,"@emnapi/runtime":`^1.7.0`,"@img/sharp-libvips-dev":`1.2.4`,"@img/sharp-libvips-dev-wasm32":`1.2.4`,"@img/sharp-libvips-win32-arm64":`1.2.4`,"@img/sharp-libvips-win32-ia32":`1.2.4`,"@img/sharp-libvips-win32-x64":`1.2.4`,"@types/node":`*`,emnapi:`^1.7.0`,"exif-reader":`^2.0.2`,"extract-zip":`^2.0.1`,icc:`^3.0.0`,"jsdoc-to-markdown":`^9.1.3`,"node-addon-api":`^8.5.0`,"node-gyp":`^11.5.0`,"tar-fs":`^3.1.1`,tsd:`^0.33.0`},license:`Apache-2.0`,engines:{node:`^18.17.0 || ^20.3.0 || >=21.0.0`},config:{libvips:`>=8.17.3`},funding:{url:`https://opencollective.com/libvips`}}})),ja=M(((e,t)=>{
75
+ let n=e=>e!=null;t.exports={defined:n,object:e=>typeof e==`object`,plainObject:e=>Object.prototype.toString.call(e)===`[object Object]`,fn:e=>typeof e==`function`,bool:e=>typeof e==`boolean`,buffer:e=>e instanceof Buffer,typedArray:e=>{if(n(e))switch(e.constructor){case Uint8Array:case Uint8ClampedArray:case Int8Array:case Uint16Array:case Int16Array:case Uint32Array:case Int32Array:case Float32Array:case Float64Array:return!0}return!1},arrayBuffer:e=>e instanceof ArrayBuffer,string:e=>typeof e==`string`&&e.length>0,number:e=>typeof e==`number`&&!Number.isNaN(e),integer:e=>Number.isInteger(e),inRange:(e,t,n)=>e>=t&&e<=n,inArray:(e,t)=>t.includes(e),invalidParameterError:(e,t,n)=>Error(`Expected ${t} for ${e} but received ${n} of type ${typeof n}`),nativeError:(e,t)=>(t.message=e.message,t)}})),Ts=A(((e,t)=>{let n=()=>process.platform===`linux`,r=null;t.exports={isLinux:n,getReport:()=>{if(!r)if(n()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,r=process.report.getReport(),process.report.excludeNetwork=e}else r={};return r}}})),Es=A(((e,t)=>{let n=j(`fs`),r=2048;t.exports={LDD_PATH:`/usr/bin/ldd`,SELF_PATH:`/proc/self/exe`,readFileSync:e=>{let t=n.openSync(e,`r`),i=Buffer.alloc(r),a=n.readSync(t,i,0,r,0);return n.close(t,()=>{}),i.subarray(0,a)},readFile:e=>new Promise((t,i)=>{n.open(e,`r`,(e,a)=>{if(e)i(e);else{let e=Buffer.alloc(r);n.read(a,e,0,r,0,(r,i)=>{t(e.subarray(0,i)),n.close(a,()=>{})})}})})}})),Ds=A(((e,t)=>{t.exports={interpreterPath:e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),n=e.readUInt16LE(54),r=e.readUInt16LE(56);for(let i=0;i<r;i++){let r=t+i*n;if(e.readUInt32LE(r)===3){let t=e.readUInt32LE(r+8),n=e.readUInt32LE(r+32);return e.subarray(t,t+n).toString().replace(/\0.*$/g,``)}}return null}}})),Os=A(((e,t)=>{let n=j(`child_process`),{isLinux:r,getReport:i}=Ts(),{LDD_PATH:a,SELF_PATH:o,readFile:s,readFileSync:c}=Es(),{interpreterPath:l}=Ds(),u,d,f,p=`getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true`,m=``,h=()=>m||new Promise(e=>{n.exec(p,(t,n)=>{m=t?` `:n,e(m)})}),g=()=>{if(!m)try{m=n.execSync(p,{encoding:`utf8`})}catch{m=` `}return m},_=`glibc`,v=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,y=`musl`,b=e=>e.includes(`libc.musl-`)||e.includes(`ld-musl-`),x=()=>{let e=i();return e.header&&e.header.glibcVersionRuntime?_:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(b)?y:null},S=e=>{let[t,n]=e.split(/[\r\n]+/);return t&&t.includes(_)?_:n&&n.includes(y)?y:null},C=e=>{if(e){if(e.includes(`/ld-musl-`))return y;if(e.includes(`/ld-linux-`))return _}return null},w=e=>(e=e.toString(),e.includes(`musl`)?y:e.includes(`GNU C Library`)?_:null),ee=async()=>{if(d!==void 0)return d;d=null;try{d=w(await s(a))}catch{}return d},te=()=>{if(d!==void 0)return d;d=null;try{d=w(c(a))}catch{}return d},T=async()=>{if(u!==void 0)return u;u=null;try{u=C(l(await s(o)))}catch{}return u},ne=()=>{if(u!==void 0)return u;u=null;try{u=C(l(c(o)))}catch{}return u},re=async()=>{let e=null;return r()&&(e=await T(),e||(e=await ee(),e||=x(),e||=S(await h()))),e},ie=()=>{let e=null;return r()&&(e=ne(),e||(e=te(),e||=x(),e||=S(g()))),e},ae=async()=>r()&&await re()!==_,oe=()=>r()&&ie()!==_,se=async()=>{if(f!==void 0)return f;f=null;try{let e=(await s(a)).match(v);e&&(f=e[1])}catch{}return f},E=()=>{if(f!==void 0)return f;f=null;try{let e=c(a).match(v);e&&(f=e[1])}catch{}return f},D=()=>{let e=i();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},ce=e=>e.trim().split(/\s+/)[1],O=e=>{let[t,n,r]=e.split(/[\r\n]+/);return t&&t.includes(_)?ce(t):n&&r&&n.includes(y)?ce(r):null};t.exports={GLIBC:_,MUSL:y,family:re,familySync:ie,isNonGlibcLinux:ae,isNonGlibcLinuxSync:oe,version:async()=>{let e=null;return r()&&(e=await se(),e||=D(),e||=O(await h())),e},versionSync:()=>{let e=null;return r()&&(e=E(),e||=D(),e||=O(g())),e}}})),ks=A(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),As=A(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),js=A(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=As(),a=ks();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),Ms=A(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),Ns=A(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),Ps=A(((e,t)=>{let n=ks(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=As(),{safeRe:a,t:o}=js(),s=Ms(),{compareIdentifiers:c}=Ns();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),Fs=A(((e,t)=>{let n=Ps();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),Is=A(((e,t)=>{let n=Ps(),r=Fs(),{safeRe:i,t:a}=js();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),Ls=A(((e,t)=>{let n=Ps();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),Rs=A(((e,t)=>{let n=Ls();t.exports=(e,t,r)=>n(e,t,r)>=0})),zs=A(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),Bs=A(((e,t)=>{let n=Ls();t.exports=(e,t,r)=>n(e,t,r)===0})),Vs=A(((e,t)=>{let n=Ls();t.exports=(e,t,r)=>n(e,t,r)!==0})),Hs=A(((e,t)=>{let n=Ls();t.exports=(e,t,r)=>n(e,t,r)>0})),Us=A(((e,t)=>{let n=Ls();t.exports=(e,t,r)=>n(e,t,r)<0})),Ws=A(((e,t)=>{let n=Ls();t.exports=(e,t,r)=>n(e,t,r)<=0})),Gs=A(((e,t)=>{let n=Bs(),r=Vs(),i=Hs(),a=Rs(),o=Us(),s=Ws();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),Ks=A(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=Ms(),{safeRe:i,t:a}=js(),o=Gs(),s=ks(),c=Ps(),l=qs()})),qs=A(((e,t)=>{let n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,ne(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>T(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let b=[..._.values()];return r.set(t,b),b}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(re(this.set[t],e,this.options))return!0;return!1}};let r=new(zs()),i=Ms(),a=Ks(),o=ks(),s=Ps(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=js(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=As(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=S(e,t),o(`caret`,e),e=b(e,t),o(`tildes`,e),e=w(e,t),o(`xrange`,e),e=te(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,b=(e,t)=>e.trim().split(/\s+/).map(e=>x(e,t)).join(` `),x=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},S=(e,t)=>e.trim().split(/\s+/).map(e=>C(e,t)).join(` `),C=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},w=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>ee(e,t)).join(` `)),ee=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},te=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),T=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),ne=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),re=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),Js=A(((e,t)=>{let n=qs();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),Ys=A(((e,t)=>{t.exports={name:`sharp`,description:`High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images`,version:`0.34.5`,author:`Lovell Fuller <npm@lovell.info>`,homepage:`https://sharp.pixelplumbing.com`,contributors:`Pierre Inglebert <pierre.inglebert@gmail.com>,Jonathan Ong <jonathanrichardong@gmail.com>,Chanon Sajjamanochai <chanon.s@gmail.com>,Juliano Julio <julianojulio@gmail.com>,Daniel Gasienica <daniel@gasienica.ch>,Julian Walker <julian@fiftythree.com>,Amit Pitaru <pitaru.amit@gmail.com>,Brandon Aaron <hello.brandon@aaron.sh>,Andreas Lind <andreas@one.com>,Maurus Cuelenaere <mcuelenaere@gmail.com>,Linus Unnebäck <linus@folkdatorn.se>,Victor Mateevitsi <mvictoras@gmail.com>,Alaric Holloway <alaric.holloway@gmail.com>,Bernhard K. Weisshuhn <bkw@codingforce.com>,Chris Riley <criley@primedia.com>,David Carley <dacarley@gmail.com>,John Tobin <john@limelightmobileinc.com>,Kenton Gray <kentongray@gmail.com>,Felix Bünemann <Felix.Buenemann@gmail.com>,Samy Al Zahrani <samyalzahrany@gmail.com>,Chintan Thakkar <lemnisk8@gmail.com>,F. Orlando Galashan <frulo@gmx.de>,Kleis Auke Wolthuizen <info@kleisauke.nl>,Matt Hirsch <mhirsch@media.mit.edu>,Matthias Thoemmes <thoemmes@gmail.com>,Patrick Paskaris <patrick@paskaris.gr>,Jérémy Lal <kapouer@melix.org>,Rahul Nanwani <r.nanwani@gmail.com>,Alice Monday <alice0meta@gmail.com>,Kristo Jorgenson <kristo.jorgenson@gmail.com>,YvesBos <yves_bos@outlook.com>,Guy Maliar <guy@tailorbrands.com>,Nicolas Coden <nicolas@ncoden.fr>,Matt Parrish <matt.r.parrish@gmail.com>,Marcel Bretschneider <marcel.bretschneider@gmail.com>,Matthew McEachen <matthew+github@mceachen.org>,Jarda Kotěšovec <jarda.kotesovec@gmail.com>,Kenric D'Souza <kenric.dsouza@gmail.com>,Oleh Aleinyk <oleg.aleynik@gmail.com>,Marcel Bretschneider <marcel.bretschneider@gmail.com>,Andrea Bianco <andrea.bianco@unibas.ch>,Rik Heywood <rik@rik.org>,Thomas Parisot <hi@oncletom.io>,Nathan Graves <nathanrgraves+github@gmail.com>,Tom Lokhorst <tom@lokhorst.eu>,Espen Hovlandsdal <espen@hovlandsdal.com>,Sylvain Dumont <sylvain.dumont35@gmail.com>,Alun Davies <alun.owain.davies@googlemail.com>,Aidan Hoolachan <ajhoolachan21@gmail.com>,Axel Eirola <axel.eirola@iki.fi>,Freezy <freezy@xbmc.org>,Daiz <taneli.vatanen@gmail.com>,Julian Aubourg <j@ubourg.net>,Keith Belovay <keith@picthrive.com>,Michael B. Klein <mbklein@gmail.com>,Jordan Prudhomme <jordan@raboland.fr>,Ilya Ovdin <iovdin@gmail.com>,Andargor <andargor@yahoo.com>,Paul Neave <paul.neave@gmail.com>,Brendan Kennedy <brenwken@gmail.com>,Brychan Bennett-Odlum <git@brychan.io>,Edward Silverton <e.silverton@gmail.com>,Roman Malieiev <aromaleev@gmail.com>,Tomas Szabo <tomas.szabo@deftomat.com>,Robert O'Rourke <robert@o-rourke.org>,Guillermo Alfonso Varela Chouciño <guillevch@gmail.com>,Christian Flintrup <chr@gigahost.dk>,Manan Jadhav <manan@motionden.com>,Leon Radley <leon@radley.se>,alza54 <alza54@thiocod.in>,Jacob Smith <jacob@frende.me>,Michael Nutt <michael@nutt.im>,Brad Parham <baparham@gmail.com>,Taneli Vatanen <taneli.vatanen@gmail.com>,Joris Dugué <zaruike10@gmail.com>,Chris Banks <christopher.bradley.banks@gmail.com>,Ompal Singh <ompal.hitm09@gmail.com>,Brodan <christopher.hranj@gmail.com>,Ankur Parihar <ankur.github@gmail.com>,Brahim Ait elhaj <brahima@gmail.com>,Mart Jansink <m.jansink@gmail.com>,Lachlan Newman <lachnewman007@gmail.com>,Dennis Beatty <dennis@dcbeatty.com>,Ingvar Stepanyan <me@rreverser.com>,Don Denton <don@happycollision.com>`.split(`,`),scripts:{build:`node install/build.js`,install:`node install/check.js || npm run build`,clean:`rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*`,test:`npm run lint && npm run test-unit`,lint:`npm run lint-cpp && npm run lint-js && npm run lint-types`,"lint-cpp":`cpplint --quiet src/*.h src/*.cc`,"lint-js":`biome lint`,"lint-types":`tsd --files ./test/types/sharp.test-d.ts`,"test-leak":`./test/leak/leak.sh`,"test-unit":`node --experimental-test-coverage test/unit.mjs`,"package-from-local-build":`node npm/from-local-build.js`,"package-release-notes":`node npm/release-notes.js`,"docs-build":`node docs/build.mjs`,"docs-serve":`cd docs && npm start`,"docs-publish":`cd docs && npm run build && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp`},type:`commonjs`,main:`lib/index.js`,types:`lib/index.d.ts`,files:[`install`,`lib`,`src/*.{cc,h,gyp}`],repository:{type:`git`,url:`git://github.com/lovell/sharp.git`},keywords:[`jpeg`,`png`,`webp`,`avif`,`tiff`,`gif`,`svg`,`jp2`,`dzi`,`image`,`resize`,`thumbnail`,`crop`,`embed`,`libvips`,`vips`],dependencies:{"@img/colour":`^1.0.0`,"detect-libc":`^2.1.2`,semver:`^7.7.3`},optionalDependencies:{"@img/sharp-darwin-arm64":`0.34.5`,"@img/sharp-darwin-x64":`0.34.5`,"@img/sharp-libvips-darwin-arm64":`1.2.4`,"@img/sharp-libvips-darwin-x64":`1.2.4`,"@img/sharp-libvips-linux-arm":`1.2.4`,"@img/sharp-libvips-linux-arm64":`1.2.4`,"@img/sharp-libvips-linux-ppc64":`1.2.4`,"@img/sharp-libvips-linux-riscv64":`1.2.4`,"@img/sharp-libvips-linux-s390x":`1.2.4`,"@img/sharp-libvips-linux-x64":`1.2.4`,"@img/sharp-libvips-linuxmusl-arm64":`1.2.4`,"@img/sharp-libvips-linuxmusl-x64":`1.2.4`,"@img/sharp-linux-arm":`0.34.5`,"@img/sharp-linux-arm64":`0.34.5`,"@img/sharp-linux-ppc64":`0.34.5`,"@img/sharp-linux-riscv64":`0.34.5`,"@img/sharp-linux-s390x":`0.34.5`,"@img/sharp-linux-x64":`0.34.5`,"@img/sharp-linuxmusl-arm64":`0.34.5`,"@img/sharp-linuxmusl-x64":`0.34.5`,"@img/sharp-wasm32":`0.34.5`,"@img/sharp-win32-arm64":`0.34.5`,"@img/sharp-win32-ia32":`0.34.5`,"@img/sharp-win32-x64":`0.34.5`},devDependencies:{"@biomejs/biome":`^2.3.4`,"@cpplint/cli":`^0.1.0`,"@emnapi/runtime":`^1.7.0`,"@img/sharp-libvips-dev":`1.2.4`,"@img/sharp-libvips-dev-wasm32":`1.2.4`,"@img/sharp-libvips-win32-arm64":`1.2.4`,"@img/sharp-libvips-win32-ia32":`1.2.4`,"@img/sharp-libvips-win32-x64":`1.2.4`,"@types/node":`*`,emnapi:`^1.7.0`,"exif-reader":`^2.0.2`,"extract-zip":`^2.0.1`,icc:`^3.0.0`,"jsdoc-to-markdown":`^9.1.3`,"node-addon-api":`^8.5.0`,"node-gyp":`^11.5.0`,"tar-fs":`^3.1.1`,tsd:`^0.33.0`},license:`Apache-2.0`,engines:{node:`^18.17.0 || ^20.3.0 || >=21.0.0`},config:{libvips:`>=8.17.3`},funding:{url:`https://opencollective.com/libvips`}}})),Xs=A(((e,t)=>{
76
76
  /*!
77
77
  Copyright 2013 Lovell Fuller and others.
78
78
  SPDX-License-Identifier: Apache-2.0
79
79
  */
80
- let{spawnSync:n}=N(`node:child_process`),{createHash:r}=N(`node:crypto`),i=_a(),a=ya(),o=ka(),s=la(),{config:c,engines:l,optionalDependencies:u}=Aa(),d=i(process.env.npm_package_config_libvips||c.libvips).version,f=[`darwin-arm64`,`darwin-x64`,`linux-arm`,`linux-arm64`,`linux-ppc64`,`linux-riscv64`,`linux-s390x`,`linux-x64`,`linuxmusl-arm64`,`linuxmusl-x64`,`win32-arm64`,`win32-ia32`,`win32-x64`],p={encoding:`utf8`,shell:!0},m=e=>{e instanceof Error?console.error(`sharp: Installation error: ${e.message}`):console.log(`sharp: ${e}`)},h=()=>s.isNonGlibcLinuxSync()?s.familySync():``,g=()=>`${process.platform}${h()}-${process.arch}`,_=()=>{if(S())return`wasm32`;let{npm_config_arch:e,npm_config_platform:t,npm_config_libc:n}=process.env,r=typeof n==`string`?n:h();return`${t||process.platform}${r}-${e||process.arch}`},v=()=>{try{return N(`@img/sharp-libvips-dev-${_()}/include`)}catch{try{return N(`@img/sharp-libvips-dev/include`)}catch{}}return``},y=()=>{try{return N(`@img/sharp-libvips-dev/cplusplus`)}catch{}return``},b=()=>{try{return N(`@img/sharp-libvips-dev-${_()}/lib`)}catch{try{return N(`@img/sharp-libvips-${_()}/lib`)}catch{}}return``},x=()=>{if(process.release?.name===`node`&&process.versions&&!o(process.versions.node,l.node))return{found:process.versions.node,expected:l.node}},S=()=>{let{CC:e}=process.env;return!!e?.endsWith(`/emcc`)},C=()=>process.platform===`darwin`&&process.arch===`x64`?(n(`sysctl sysctl.proc_translated`,p).stdout||``).trim()===`sysctl.proc_translated: 1`:!1,w=e=>r(`sha512`).update(e).digest(`hex`),ee=()=>{try{let e=w(`imgsharp-libvips-${_()}`),t=i(u[`@img/sharp-libvips-${_()}`],{includePrerelease:!0}).version;return w(`${e}npm:${t}`).slice(0,10)}catch{}return``},te=()=>n(`node-gyp rebuild --directory=src ${S()?`--nodedir=emscripten`:``}`,{...p,stdio:`inherit`}).status,T=()=>process.platform===`win32`?``:(n(`pkg-config --modversion vips-cpp`,{...p,env:{...process.env,PKG_CONFIG_PATH:ne()}}).stdout||``).trim(),ne=()=>process.platform===`win32`?``:[(n(`which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2`,p).stdout||``).trim(),process.env.PKG_CONFIG_PATH,`/usr/local/lib/pkgconfig`,`/usr/lib/pkgconfig`,`/usr/local/libdata/pkgconfig`,`/usr/libdata/pkgconfig`].filter(Boolean).join(`:`),re=(e,t,n)=>(n&&n(`Detected ${t}, skipping search for globally-installed libvips`),e);t.exports={minimumLibvipsVersion:d,prebuiltPlatforms:f,buildPlatformArch:_,buildSharpLibvipsIncludeDir:v,buildSharpLibvipsCPlusPlusDir:y,buildSharpLibvipsLibDir:b,isUnsupportedNodeRuntime:x,runtimePlatformArch:g,log:m,yarnLocator:ee,spawnRebuild:te,globalLibvipsVersion:T,pkgConfigPath:ne,useGlobalLibvips:e=>{if(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)return re(!1,`SHARP_IGNORE_GLOBAL_LIBVIPS`,e);if(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)return re(!0,`SHARP_FORCE_GLOBAL_LIBVIPS`,e);if(C())return re(!1,`Rosetta`,e);let t=T();return!!t&&a(t,d)}}})),Ma=M(((e,t)=>{
80
+ let{spawnSync:n}=j(`node:child_process`),{createHash:r}=j(`node:crypto`),i=Is(),a=Rs(),o=Js(),s=Os(),{config:c,engines:l,optionalDependencies:u}=Ys(),d=i(process.env.npm_package_config_libvips||c.libvips).version,f=[`darwin-arm64`,`darwin-x64`,`linux-arm`,`linux-arm64`,`linux-ppc64`,`linux-riscv64`,`linux-s390x`,`linux-x64`,`linuxmusl-arm64`,`linuxmusl-x64`,`win32-arm64`,`win32-ia32`,`win32-x64`],p={encoding:`utf8`,shell:!0},m=e=>{e instanceof Error?console.error(`sharp: Installation error: ${e.message}`):console.log(`sharp: ${e}`)},h=()=>s.isNonGlibcLinuxSync()?s.familySync():``,g=()=>`${process.platform}${h()}-${process.arch}`,_=()=>{if(S())return`wasm32`;let{npm_config_arch:e,npm_config_platform:t,npm_config_libc:n}=process.env,r=typeof n==`string`?n:h();return`${t||process.platform}${r}-${e||process.arch}`},v=()=>{try{return j(`@img/sharp-libvips-dev-${_()}/include`)}catch{try{return j(`@img/sharp-libvips-dev/include`)}catch{}}return``},y=()=>{try{return j(`@img/sharp-libvips-dev/cplusplus`)}catch{}return``},b=()=>{try{return j(`@img/sharp-libvips-dev-${_()}/lib`)}catch{try{return j(`@img/sharp-libvips-${_()}/lib`)}catch{}}return``},x=()=>{if(process.release?.name===`node`&&process.versions&&!o(process.versions.node,l.node))return{found:process.versions.node,expected:l.node}},S=()=>{let{CC:e}=process.env;return!!e?.endsWith(`/emcc`)},C=()=>process.platform===`darwin`&&process.arch===`x64`?(n(`sysctl sysctl.proc_translated`,p).stdout||``).trim()===`sysctl.proc_translated: 1`:!1,w=e=>r(`sha512`).update(e).digest(`hex`),ee=()=>{try{let e=w(`imgsharp-libvips-${_()}`),t=i(u[`@img/sharp-libvips-${_()}`],{includePrerelease:!0}).version;return w(`${e}npm:${t}`).slice(0,10)}catch{}return``},te=()=>n(`node-gyp rebuild --directory=src ${S()?`--nodedir=emscripten`:``}`,{...p,stdio:`inherit`}).status,T=()=>process.platform===`win32`?``:(n(`pkg-config --modversion vips-cpp`,{...p,env:{...process.env,PKG_CONFIG_PATH:ne()}}).stdout||``).trim(),ne=()=>process.platform===`win32`?``:[(n(`which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2`,p).stdout||``).trim(),process.env.PKG_CONFIG_PATH,`/usr/local/lib/pkgconfig`,`/usr/lib/pkgconfig`,`/usr/local/libdata/pkgconfig`,`/usr/libdata/pkgconfig`].filter(Boolean).join(`:`),re=(e,t,n)=>(n&&n(`Detected ${t}, skipping search for globally-installed libvips`),e);t.exports={minimumLibvipsVersion:d,prebuiltPlatforms:f,buildPlatformArch:_,buildSharpLibvipsIncludeDir:v,buildSharpLibvipsCPlusPlusDir:y,buildSharpLibvipsLibDir:b,isUnsupportedNodeRuntime:x,runtimePlatformArch:g,log:m,yarnLocator:ee,spawnRebuild:te,globalLibvipsVersion:T,pkgConfigPath:ne,useGlobalLibvips:e=>{if(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)return re(!1,`SHARP_IGNORE_GLOBAL_LIBVIPS`,e);if(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)return re(!0,`SHARP_FORCE_GLOBAL_LIBVIPS`,e);if(C())return re(!1,`Rosetta`,e);let t=T();return!!t&&a(t,d)}}})),Zs=A(((e,t)=>{
81
81
  /*!
82
82
  Copyright 2013 Lovell Fuller and others.
83
83
  SPDX-License-Identifier: Apache-2.0
84
84
  */
85
- let{familySync:n,versionSync:r}=la(),{runtimePlatformArch:i,isUnsupportedNodeRuntime:a,prebuiltPlatforms:o,minimumLibvipsVersion:s}=ja(),c=i(),l=[`../src/build/Release/sharp-${c}.node`,`../src/build/Release/sharp-wasm32.node`,`@img/sharp-${c}/sharp.node`,`@img/sharp-wasm32/sharp.node`],u,d,f=[];for(u of l)try{d=N(u);break}catch(e){f.push(e)}if(d&&u.startsWith(`@img/sharp-linux-x64`)&&!d._isUsingX64V2()){let e=Error(`Prebuilt binaries for linux-x64 require v2 microarchitecture`);e.code=`Unsupported CPU`,f.push(e),d=null}if(d)t.exports=d;else{let[e,t,i]=[`linux`,`darwin`,`win32`].map(e=>c.startsWith(e)),l=[`Could not load the "sharp" module using the ${c} runtime`];f.forEach(e=>{e.code!==`MODULE_NOT_FOUND`&&l.push(`${e.code}: ${e.message}`)});let u=f.map(e=>e.message).join(` `);if(l.push(`Possible solutions:`),a()){let{found:e,expected:t}=a();l.push(`- Please upgrade Node.js:`,` Found ${e}`,` Requires ${t}`)}else if(o.includes(c)){let[e,t]=c.split(`-`),n=e.endsWith(`musl`)?` --libc=musl`:``;l.push(`- Ensure optional dependencies can be installed:`,` npm install --include=optional sharp`,`- Ensure your package manager supports multi-platform installation:`,` See https://sharp.pixelplumbing.com/install#cross-platform`,`- Add platform-specific dependencies:`,` npm install --os=${e.replace(`musl`,``)}${n} --cpu=${t} sharp`)}else l.push(`- Manually install libvips >= ${s}`,`- Add experimental WebAssembly-based dependencies:`,` npm install --cpu=wasm32 sharp`,` npm install @img/sharp-wasm32`);if(e&&/(symbol not found|CXXABI_)/i.test(u))try{let{config:e}=N(`@img/sharp-libvips-${c}/package`),t=`${n()} ${r()}`,i=`${e.musl?`musl`:`glibc`} ${e.musl||e.glibc}`;l.push(`- Update your OS:`,` Found ${t}`,` Requires ${i}`)}catch{}throw e&&/\/snap\/core[0-9]{2}/.test(u)&&l.push(`- Remove the Node.js Snap, which does not support native modules`,` snap remove node`),t&&/Incompatible library version/.test(u)&&l.push(`- Update Homebrew:`,` brew update && brew upgrade vips`),f.some(e=>e.code===`ERR_DLOPEN_DISABLED`)&&l.push(`- Run Node.js without using the --no-addons flag`),i&&/The specified procedure could not be found/.test(u)&&l.push(`- Using the canvas package on Windows?`,` See https://sharp.pixelplumbing.com/install#canvas-and-windows`,`- Check for outdated versions of sharp in the dependency tree:`,` npm ls sharp`),l.push(`- Consult the installation documentation:`,` See https://sharp.pixelplumbing.com/install`),Error(l.join(`
86
- `))}})),Na=M(((e,t)=>{
85
+ let{familySync:n,versionSync:r}=Os(),{runtimePlatformArch:i,isUnsupportedNodeRuntime:a,prebuiltPlatforms:o,minimumLibvipsVersion:s}=Xs(),c=i(),l=[`../src/build/Release/sharp-${c}.node`,`../src/build/Release/sharp-wasm32.node`,`@img/sharp-${c}/sharp.node`,`@img/sharp-wasm32/sharp.node`],u,d,f=[];for(u of l)try{d=j(u);break}catch(e){f.push(e)}if(d&&u.startsWith(`@img/sharp-linux-x64`)&&!d._isUsingX64V2()){let e=Error(`Prebuilt binaries for linux-x64 require v2 microarchitecture`);e.code=`Unsupported CPU`,f.push(e),d=null}if(d)t.exports=d;else{let[e,t,i]=[`linux`,`darwin`,`win32`].map(e=>c.startsWith(e)),l=[`Could not load the "sharp" module using the ${c} runtime`];f.forEach(e=>{e.code!==`MODULE_NOT_FOUND`&&l.push(`${e.code}: ${e.message}`)});let u=f.map(e=>e.message).join(` `);if(l.push(`Possible solutions:`),a()){let{found:e,expected:t}=a();l.push(`- Please upgrade Node.js:`,` Found ${e}`,` Requires ${t}`)}else if(o.includes(c)){let[e,t]=c.split(`-`),n=e.endsWith(`musl`)?` --libc=musl`:``;l.push(`- Ensure optional dependencies can be installed:`,` npm install --include=optional sharp`,`- Ensure your package manager supports multi-platform installation:`,` See https://sharp.pixelplumbing.com/install#cross-platform`,`- Add platform-specific dependencies:`,` npm install --os=${e.replace(`musl`,``)}${n} --cpu=${t} sharp`)}else l.push(`- Manually install libvips >= ${s}`,`- Add experimental WebAssembly-based dependencies:`,` npm install --cpu=wasm32 sharp`,` npm install @img/sharp-wasm32`);if(e&&/(symbol not found|CXXABI_)/i.test(u))try{let{config:e}=j(`@img/sharp-libvips-${c}/package`),t=`${n()} ${r()}`,i=`${e.musl?`musl`:`glibc`} ${e.musl||e.glibc}`;l.push(`- Update your OS:`,` Found ${t}`,` Requires ${i}`)}catch{}throw e&&/\/snap\/core[0-9]{2}/.test(u)&&l.push(`- Remove the Node.js Snap, which does not support native modules`,` snap remove node`),t&&/Incompatible library version/.test(u)&&l.push(`- Update Homebrew:`,` brew update && brew upgrade vips`),f.some(e=>e.code===`ERR_DLOPEN_DISABLED`)&&l.push(`- Run Node.js without using the --no-addons flag`),i&&/The specified procedure could not be found/.test(u)&&l.push(`- Using the canvas package on Windows?`,` See https://sharp.pixelplumbing.com/install#canvas-and-windows`,`- Check for outdated versions of sharp in the dependency tree:`,` npm ls sharp`),l.push(`- Consult the installation documentation:`,` See https://sharp.pixelplumbing.com/install`),Error(l.join(`
86
+ `))}})),Qs=A(((e,t)=>{
87
87
  /*!
88
88
  Copyright 2013 Lovell Fuller and others.
89
89
  SPDX-License-Identifier: Apache-2.0
90
90
  */
91
- let n=N(`node:util`),r=N(`node:stream`),i=aa();Ma();let a=n.debuglog(`sharp`),o=e=>{s.queue.emit(`change`,e)},s=function(e,t){if(arguments.length===1&&!i.defined(e))throw Error(`Invalid input`);return this instanceof s?(r.Duplex.call(this),this.options={topOffsetPre:-1,leftOffsetPre:-1,widthPre:-1,heightPre:-1,topOffsetPost:-1,leftOffsetPost:-1,widthPost:-1,heightPost:-1,width:-1,height:-1,canvas:`crop`,position:0,resizeBackground:[0,0,0,255],angle:0,rotationAngle:0,rotationBackground:[0,0,0,255],rotateBefore:!1,orientBefore:!1,flip:!1,flop:!1,extendTop:0,extendBottom:0,extendLeft:0,extendRight:0,extendBackground:[0,0,0,255],extendWith:`background`,withoutEnlargement:!1,withoutReduction:!1,affineMatrix:[],affineBackground:[0,0,0,255],affineIdx:0,affineIdy:0,affineOdx:0,affineOdy:0,affineInterpolator:this.constructor.interpolators.bilinear,kernel:`lanczos3`,fastShrinkOnLoad:!0,tint:[-1,0,0,0],flatten:!1,flattenBackground:[0,0,0],unflatten:!1,negate:!1,negateAlpha:!0,medianSize:0,blurSigma:0,precision:`integer`,minAmpl:.2,sharpenSigma:0,sharpenM1:1,sharpenM2:2,sharpenX1:2,sharpenY2:10,sharpenY3:20,threshold:0,thresholdGrayscale:!0,trimBackground:[],trimThreshold:-1,trimLineArt:!1,dilateWidth:0,erodeWidth:0,gamma:0,gammaOut:0,greyscale:!1,normalise:!1,normaliseLower:1,normaliseUpper:99,claheWidth:0,claheHeight:0,claheMaxSlope:3,brightness:1,saturation:1,hue:0,lightness:0,booleanBufferIn:null,booleanFileIn:``,joinChannelIn:[],extractChannel:-1,removeAlpha:!1,ensureAlpha:-1,colourspace:`srgb`,colourspacePipeline:`last`,composite:[],fileOut:``,formatOut:`input`,streamOut:!1,keepMetadata:0,withMetadataOrientation:-1,withMetadataDensity:0,withIccProfile:``,withExif:{},withExifMerge:!0,withXmp:``,resolveWithObject:!1,loop:-1,delay:[],jpegQuality:80,jpegProgressive:!1,jpegChromaSubsampling:`4:2:0`,jpegTrellisQuantisation:!1,jpegOvershootDeringing:!1,jpegOptimiseScans:!1,jpegOptimiseCoding:!0,jpegQuantisationTable:0,pngProgressive:!1,pngCompressionLevel:6,pngAdaptiveFiltering:!1,pngPalette:!1,pngQuality:100,pngEffort:7,pngBitdepth:8,pngDither:1,jp2Quality:80,jp2TileHeight:512,jp2TileWidth:512,jp2Lossless:!1,jp2ChromaSubsampling:`4:4:4`,webpQuality:80,webpAlphaQuality:100,webpLossless:!1,webpNearLossless:!1,webpSmartSubsample:!1,webpSmartDeblock:!1,webpPreset:`default`,webpEffort:4,webpMinSize:!1,webpMixed:!1,gifBitdepth:8,gifEffort:7,gifDither:1,gifInterFrameMaxError:0,gifInterPaletteMaxError:3,gifKeepDuplicateFrames:!1,gifReuse:!0,gifProgressive:!1,tiffQuality:80,tiffCompression:`jpeg`,tiffBigtiff:!1,tiffPredictor:`horizontal`,tiffPyramid:!1,tiffMiniswhite:!1,tiffBitdepth:8,tiffTile:!1,tiffTileHeight:256,tiffTileWidth:256,tiffXres:1,tiffYres:1,tiffResolutionUnit:`inch`,heifQuality:50,heifLossless:!1,heifCompression:`av1`,heifEffort:4,heifChromaSubsampling:`4:4:4`,heifBitdepth:8,jxlDistance:1,jxlDecodingTier:0,jxlEffort:7,jxlLossless:!1,rawDepth:`uchar`,tileSize:256,tileOverlap:0,tileContainer:`fs`,tileLayout:`dz`,tileFormat:`last`,tileDepth:`last`,tileAngle:0,tileSkipBlanks:-1,tileBackground:[255,255,255,255],tileCentre:!1,tileId:`https://example.com/iiif`,tileBasename:``,timeoutSeconds:0,linearA:[],linearB:[],pdfBackground:[255,255,255,255],debuglog:e=>{this.emit(`warning`,e),a(e)},queueListener:o},this.options.input=this._createInputDescriptor(e,t,{allowStream:!0}),this):new s(e,t)};Object.setPrototypeOf(s.prototype,r.Duplex.prototype),Object.setPrototypeOf(s,r.Duplex);function c(){let e=this.constructor.call(),{debuglog:t,queueListener:n,...r}=this.options;return e.options=structuredClone(r),e.options.debuglog=t,e.options.queueListener=n,this._isStreamInput()&&this.on(`finish`,()=>{this._flattenBufferIn(),e.options.input.buffer=this.options.input.buffer,e.emit(`finish`)}),e}Object.assign(s.prototype,{clone:c}),t.exports=s})),Pa=M(((e,t)=>{
91
+ let n=j(`node:util`),r=j(`node:stream`),i=ws();Zs();let a=n.debuglog(`sharp`),o=e=>{s.queue.emit(`change`,e)},s=function(e,t){if(arguments.length===1&&!i.defined(e))throw Error(`Invalid input`);return this instanceof s?(r.Duplex.call(this),this.options={topOffsetPre:-1,leftOffsetPre:-1,widthPre:-1,heightPre:-1,topOffsetPost:-1,leftOffsetPost:-1,widthPost:-1,heightPost:-1,width:-1,height:-1,canvas:`crop`,position:0,resizeBackground:[0,0,0,255],angle:0,rotationAngle:0,rotationBackground:[0,0,0,255],rotateBefore:!1,orientBefore:!1,flip:!1,flop:!1,extendTop:0,extendBottom:0,extendLeft:0,extendRight:0,extendBackground:[0,0,0,255],extendWith:`background`,withoutEnlargement:!1,withoutReduction:!1,affineMatrix:[],affineBackground:[0,0,0,255],affineIdx:0,affineIdy:0,affineOdx:0,affineOdy:0,affineInterpolator:this.constructor.interpolators.bilinear,kernel:`lanczos3`,fastShrinkOnLoad:!0,tint:[-1,0,0,0],flatten:!1,flattenBackground:[0,0,0],unflatten:!1,negate:!1,negateAlpha:!0,medianSize:0,blurSigma:0,precision:`integer`,minAmpl:.2,sharpenSigma:0,sharpenM1:1,sharpenM2:2,sharpenX1:2,sharpenY2:10,sharpenY3:20,threshold:0,thresholdGrayscale:!0,trimBackground:[],trimThreshold:-1,trimLineArt:!1,dilateWidth:0,erodeWidth:0,gamma:0,gammaOut:0,greyscale:!1,normalise:!1,normaliseLower:1,normaliseUpper:99,claheWidth:0,claheHeight:0,claheMaxSlope:3,brightness:1,saturation:1,hue:0,lightness:0,booleanBufferIn:null,booleanFileIn:``,joinChannelIn:[],extractChannel:-1,removeAlpha:!1,ensureAlpha:-1,colourspace:`srgb`,colourspacePipeline:`last`,composite:[],fileOut:``,formatOut:`input`,streamOut:!1,keepMetadata:0,withMetadataOrientation:-1,withMetadataDensity:0,withIccProfile:``,withExif:{},withExifMerge:!0,withXmp:``,resolveWithObject:!1,loop:-1,delay:[],jpegQuality:80,jpegProgressive:!1,jpegChromaSubsampling:`4:2:0`,jpegTrellisQuantisation:!1,jpegOvershootDeringing:!1,jpegOptimiseScans:!1,jpegOptimiseCoding:!0,jpegQuantisationTable:0,pngProgressive:!1,pngCompressionLevel:6,pngAdaptiveFiltering:!1,pngPalette:!1,pngQuality:100,pngEffort:7,pngBitdepth:8,pngDither:1,jp2Quality:80,jp2TileHeight:512,jp2TileWidth:512,jp2Lossless:!1,jp2ChromaSubsampling:`4:4:4`,webpQuality:80,webpAlphaQuality:100,webpLossless:!1,webpNearLossless:!1,webpSmartSubsample:!1,webpSmartDeblock:!1,webpPreset:`default`,webpEffort:4,webpMinSize:!1,webpMixed:!1,gifBitdepth:8,gifEffort:7,gifDither:1,gifInterFrameMaxError:0,gifInterPaletteMaxError:3,gifKeepDuplicateFrames:!1,gifReuse:!0,gifProgressive:!1,tiffQuality:80,tiffCompression:`jpeg`,tiffBigtiff:!1,tiffPredictor:`horizontal`,tiffPyramid:!1,tiffMiniswhite:!1,tiffBitdepth:8,tiffTile:!1,tiffTileHeight:256,tiffTileWidth:256,tiffXres:1,tiffYres:1,tiffResolutionUnit:`inch`,heifQuality:50,heifLossless:!1,heifCompression:`av1`,heifEffort:4,heifChromaSubsampling:`4:4:4`,heifBitdepth:8,jxlDistance:1,jxlDecodingTier:0,jxlEffort:7,jxlLossless:!1,rawDepth:`uchar`,tileSize:256,tileOverlap:0,tileContainer:`fs`,tileLayout:`dz`,tileFormat:`last`,tileDepth:`last`,tileAngle:0,tileSkipBlanks:-1,tileBackground:[255,255,255,255],tileCentre:!1,tileId:`https://example.com/iiif`,tileBasename:``,timeoutSeconds:0,linearA:[],linearB:[],pdfBackground:[255,255,255,255],debuglog:e=>{this.emit(`warning`,e),a(e)},queueListener:o},this.options.input=this._createInputDescriptor(e,t,{allowStream:!0}),this):new s(e,t)};Object.setPrototypeOf(s.prototype,r.Duplex.prototype),Object.setPrototypeOf(s,r.Duplex);function c(){let e=this.constructor.call(),{debuglog:t,queueListener:n,...r}=this.options;return e.options=structuredClone(r),e.options.debuglog=t,e.options.queueListener=n,this._isStreamInput()&&this.on(`finish`,()=>{this._flattenBufferIn(),e.options.input.buffer=this.options.input.buffer,e.emit(`finish`)}),e}Object.assign(s.prototype,{clone:c}),t.exports=s})),$s=A(((e,t)=>{
92
92
  /*!
93
93
  Copyright 2013 Lovell Fuller and others.
94
94
  SPDX-License-Identifier: Apache-2.0
95
95
  */
96
- let n=aa(),r=Ma(),i={left:`low`,top:`low`,low:`low`,center:`centre`,centre:`centre`,right:`high`,bottom:`high`,high:`high`},a=[`failOn`,`limitInputPixels`,`unlimited`,`animated`,`autoOrient`,`density`,`ignoreIcc`,`page`,`pages`,`sequentialRead`,`jp2`,`openSlide`,`pdf`,`raw`,`svg`,`tiff`,`failOnError`,`openSlideLevel`,`pdfBackground`,`tiffSubifd`];function o(e){let t=a.filter(t=>n.defined(e[t])).map(t=>[t,e[t]]);return t.length?Object.fromEntries(t):void 0}function s(e,t,r){let i={autoOrient:!1,failOn:`warning`,limitInputPixels:16383**2,ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(n.string(e))i.file=e;else if(n.buffer(e)){if(e.length===0)throw Error(`Input Buffer is empty`);i.buffer=e}else if(n.arrayBuffer(e)){if(e.byteLength===0)throw Error(`Input bit Array is empty`);i.buffer=Buffer.from(e,0,e.byteLength)}else if(n.typedArray(e)){if(e.length===0)throw Error(`Input Bit Array is empty`);i.buffer=Buffer.from(e.buffer,e.byteOffset,e.byteLength)}else if(n.plainObject(e)&&!n.defined(t))t=e,o(t)&&(i.buffer=[]);else if(!n.defined(e)&&!n.defined(t)&&n.object(r)&&r.allowStream)i.buffer=[];else if(Array.isArray(e))if(e.length>1)if(!this.options.joining)this.options.joining=!0,this.options.join=e.map(e=>this._createInputDescriptor(e));else throw Error(`Recursive join is unsupported`);else throw Error(`Expected at least two images to join`);else throw Error(`Unsupported input '${e}' of type ${typeof e}${n.defined(t)?` when also providing options of type ${typeof t}`:``}`);if(n.object(t)){if(n.defined(t.failOnError))if(n.bool(t.failOnError))i.failOn=t.failOnError?`warning`:`none`;else throw n.invalidParameterError(`failOnError`,`boolean`,t.failOnError);if(n.defined(t.failOn))if(n.string(t.failOn)&&n.inArray(t.failOn,[`none`,`truncated`,`error`,`warning`]))i.failOn=t.failOn;else throw n.invalidParameterError(`failOn`,`one of: none, truncated, error, warning`,t.failOn);if(n.defined(t.autoOrient))if(n.bool(t.autoOrient))i.autoOrient=t.autoOrient;else throw n.invalidParameterError(`autoOrient`,`boolean`,t.autoOrient);if(n.defined(t.density))if(n.inRange(t.density,1,1e5))i.density=t.density;else throw n.invalidParameterError(`density`,`number between 1 and 100000`,t.density);if(n.defined(t.ignoreIcc))if(n.bool(t.ignoreIcc))i.ignoreIcc=t.ignoreIcc;else throw n.invalidParameterError(`ignoreIcc`,`boolean`,t.ignoreIcc);if(n.defined(t.limitInputPixels))if(n.bool(t.limitInputPixels))i.limitInputPixels=t.limitInputPixels?16383**2:0;else if(n.integer(t.limitInputPixels)&&n.inRange(t.limitInputPixels,0,2**53-1))i.limitInputPixels=t.limitInputPixels;else throw n.invalidParameterError(`limitInputPixels`,`positive integer`,t.limitInputPixels);if(n.defined(t.unlimited))if(n.bool(t.unlimited))i.unlimited=t.unlimited;else throw n.invalidParameterError(`unlimited`,`boolean`,t.unlimited);if(n.defined(t.sequentialRead))if(n.bool(t.sequentialRead))i.sequentialRead=t.sequentialRead;else throw n.invalidParameterError(`sequentialRead`,`boolean`,t.sequentialRead);if(n.defined(t.raw)){if(n.object(t.raw)&&n.integer(t.raw.width)&&t.raw.width>0&&n.integer(t.raw.height)&&t.raw.height>0&&n.integer(t.raw.channels)&&n.inRange(t.raw.channels,1,4))switch(i.rawWidth=t.raw.width,i.rawHeight=t.raw.height,i.rawChannels=t.raw.channels,e.constructor){case Uint8Array:case Uint8ClampedArray:i.rawDepth=`uchar`;break;case Int8Array:i.rawDepth=`char`;break;case Uint16Array:i.rawDepth=`ushort`;break;case Int16Array:i.rawDepth=`short`;break;case Uint32Array:i.rawDepth=`uint`;break;case Int32Array:i.rawDepth=`int`;break;case Float32Array:i.rawDepth=`float`;break;case Float64Array:i.rawDepth=`double`;break;default:i.rawDepth=`uchar`;break}else throw Error(`Expected width, height and channels for raw pixel input`);if(i.rawPremultiplied=!1,n.defined(t.raw.premultiplied))if(n.bool(t.raw.premultiplied))i.rawPremultiplied=t.raw.premultiplied;else throw n.invalidParameterError(`raw.premultiplied`,`boolean`,t.raw.premultiplied);if(i.rawPageHeight=0,n.defined(t.raw.pageHeight))if(n.integer(t.raw.pageHeight)&&t.raw.pageHeight>0&&t.raw.pageHeight<=t.raw.height){if(t.raw.height%t.raw.pageHeight!==0)throw Error(`Expected raw.height ${t.raw.height} to be a multiple of raw.pageHeight ${t.raw.pageHeight}`);i.rawPageHeight=t.raw.pageHeight}else throw n.invalidParameterError(`raw.pageHeight`,`positive integer`,t.raw.pageHeight)}if(n.defined(t.animated))if(n.bool(t.animated))i.pages=t.animated?-1:1;else throw n.invalidParameterError(`animated`,`boolean`,t.animated);if(n.defined(t.pages))if(n.integer(t.pages)&&n.inRange(t.pages,-1,1e5))i.pages=t.pages;else throw n.invalidParameterError(`pages`,`integer between -1 and 100000`,t.pages);if(n.defined(t.page))if(n.integer(t.page)&&n.inRange(t.page,0,1e5))i.page=t.page;else throw n.invalidParameterError(`page`,`integer between 0 and 100000`,t.page);if(n.object(t.openSlide)&&n.defined(t.openSlide.level))if(n.integer(t.openSlide.level)&&n.inRange(t.openSlide.level,0,256))i.openSlideLevel=t.openSlide.level;else throw n.invalidParameterError(`openSlide.level`,`integer between 0 and 256`,t.openSlide.level);else if(n.defined(t.level))if(n.integer(t.level)&&n.inRange(t.level,0,256))i.openSlideLevel=t.level;else throw n.invalidParameterError(`level`,`integer between 0 and 256`,t.level);if(n.object(t.tiff)&&n.defined(t.tiff.subifd))if(n.integer(t.tiff.subifd)&&n.inRange(t.tiff.subifd,-1,1e5))i.tiffSubifd=t.tiff.subifd;else throw n.invalidParameterError(`tiff.subifd`,`integer between -1 and 100000`,t.tiff.subifd);else if(n.defined(t.subifd))if(n.integer(t.subifd)&&n.inRange(t.subifd,-1,1e5))i.tiffSubifd=t.subifd;else throw n.invalidParameterError(`subifd`,`integer between -1 and 100000`,t.subifd);if(n.object(t.svg)){if(n.defined(t.svg.stylesheet))if(n.string(t.svg.stylesheet))i.svgStylesheet=t.svg.stylesheet;else throw n.invalidParameterError(`svg.stylesheet`,`string`,t.svg.stylesheet);if(n.defined(t.svg.highBitdepth))if(n.bool(t.svg.highBitdepth))i.svgHighBitdepth=t.svg.highBitdepth;else throw n.invalidParameterError(`svg.highBitdepth`,`boolean`,t.svg.highBitdepth)}if(n.object(t.pdf)&&n.defined(t.pdf.background)?i.pdfBackground=this._getBackgroundColourOption(t.pdf.background):n.defined(t.pdfBackground)&&(i.pdfBackground=this._getBackgroundColourOption(t.pdfBackground)),n.object(t.jp2)&&n.defined(t.jp2.oneshot))if(n.bool(t.jp2.oneshot))i.jp2Oneshot=t.jp2.oneshot;else throw n.invalidParameterError(`jp2.oneshot`,`boolean`,t.jp2.oneshot);if(n.defined(t.create))if(n.object(t.create)&&n.integer(t.create.width)&&t.create.width>0&&n.integer(t.create.height)&&t.create.height>0&&n.integer(t.create.channels)){if(i.createWidth=t.create.width,i.createHeight=t.create.height,i.createChannels=t.create.channels,i.createPageHeight=0,n.defined(t.create.pageHeight))if(n.integer(t.create.pageHeight)&&t.create.pageHeight>0&&t.create.pageHeight<=t.create.height){if(t.create.height%t.create.pageHeight!==0)throw Error(`Expected create.height ${t.create.height} to be a multiple of create.pageHeight ${t.create.pageHeight}`);i.createPageHeight=t.create.pageHeight}else throw n.invalidParameterError(`create.pageHeight`,`positive integer`,t.create.pageHeight);if(n.defined(t.create.noise)){if(!n.object(t.create.noise))throw Error(`Expected noise to be an object`);if(t.create.noise.type!==`gaussian`)throw Error(`Only gaussian noise is supported at the moment`);if(i.createNoiseType=t.create.noise.type,!n.inRange(t.create.channels,1,4))throw n.invalidParameterError(`create.channels`,`number between 1 and 4`,t.create.channels);if(i.createNoiseMean=128,n.defined(t.create.noise.mean))if(n.number(t.create.noise.mean)&&n.inRange(t.create.noise.mean,0,1e4))i.createNoiseMean=t.create.noise.mean;else throw n.invalidParameterError(`create.noise.mean`,`number between 0 and 10000`,t.create.noise.mean);if(i.createNoiseSigma=30,n.defined(t.create.noise.sigma))if(n.number(t.create.noise.sigma)&&n.inRange(t.create.noise.sigma,0,1e4))i.createNoiseSigma=t.create.noise.sigma;else throw n.invalidParameterError(`create.noise.sigma`,`number between 0 and 10000`,t.create.noise.sigma)}else if(n.defined(t.create.background)){if(!n.inRange(t.create.channels,3,4))throw n.invalidParameterError(`create.channels`,`number between 3 and 4`,t.create.channels);i.createBackground=this._getBackgroundColourOption(t.create.background)}else throw Error(`Expected valid noise or background to create a new input image`);delete i.buffer}else throw Error(`Expected valid width, height and channels to create a new input image`);if(n.defined(t.text))if(n.object(t.text)&&n.string(t.text.text)){if(i.textValue=t.text.text,n.defined(t.text.height)&&n.defined(t.text.dpi))throw Error(`Expected only one of dpi or height`);if(n.defined(t.text.font))if(n.string(t.text.font))i.textFont=t.text.font;else throw n.invalidParameterError(`text.font`,`string`,t.text.font);if(n.defined(t.text.fontfile))if(n.string(t.text.fontfile))i.textFontfile=t.text.fontfile;else throw n.invalidParameterError(`text.fontfile`,`string`,t.text.fontfile);if(n.defined(t.text.width))if(n.integer(t.text.width)&&t.text.width>0)i.textWidth=t.text.width;else throw n.invalidParameterError(`text.width`,`positive integer`,t.text.width);if(n.defined(t.text.height))if(n.integer(t.text.height)&&t.text.height>0)i.textHeight=t.text.height;else throw n.invalidParameterError(`text.height`,`positive integer`,t.text.height);if(n.defined(t.text.align))if(n.string(t.text.align)&&n.string(this.constructor.align[t.text.align]))i.textAlign=this.constructor.align[t.text.align];else throw n.invalidParameterError(`text.align`,`valid alignment`,t.text.align);if(n.defined(t.text.justify))if(n.bool(t.text.justify))i.textJustify=t.text.justify;else throw n.invalidParameterError(`text.justify`,`boolean`,t.text.justify);if(n.defined(t.text.dpi))if(n.integer(t.text.dpi)&&n.inRange(t.text.dpi,1,1e6))i.textDpi=t.text.dpi;else throw n.invalidParameterError(`text.dpi`,`integer between 1 and 1000000`,t.text.dpi);if(n.defined(t.text.rgba))if(n.bool(t.text.rgba))i.textRgba=t.text.rgba;else throw n.invalidParameterError(`text.rgba`,`bool`,t.text.rgba);if(n.defined(t.text.spacing))if(n.integer(t.text.spacing)&&n.inRange(t.text.spacing,-1e6,1e6))i.textSpacing=t.text.spacing;else throw n.invalidParameterError(`text.spacing`,`integer between -1000000 and 1000000`,t.text.spacing);if(n.defined(t.text.wrap))if(n.string(t.text.wrap)&&n.inArray(t.text.wrap,[`word`,`char`,`word-char`,`none`]))i.textWrap=t.text.wrap;else throw n.invalidParameterError(`text.wrap`,`one of: word, char, word-char, none`,t.text.wrap);delete i.buffer}else throw Error(`Expected a valid string to create an image with text.`);if(n.defined(t.join))if(n.defined(this.options.join)){if(n.defined(t.join.animated))if(n.bool(t.join.animated))i.joinAnimated=t.join.animated;else throw n.invalidParameterError(`join.animated`,`boolean`,t.join.animated);if(n.defined(t.join.across))if(n.integer(t.join.across)&&n.inRange(t.join.across,1,1e6))i.joinAcross=t.join.across;else throw n.invalidParameterError(`join.across`,`integer between 1 and 100000`,t.join.across);if(n.defined(t.join.shim))if(n.integer(t.join.shim)&&n.inRange(t.join.shim,0,1e6))i.joinShim=t.join.shim;else throw n.invalidParameterError(`join.shim`,`integer between 0 and 100000`,t.join.shim);if(n.defined(t.join.background)&&(i.joinBackground=this._getBackgroundColourOption(t.join.background)),n.defined(t.join.halign))if(n.string(t.join.halign)&&n.string(this.constructor.align[t.join.halign]))i.joinHalign=this.constructor.align[t.join.halign];else throw n.invalidParameterError(`join.halign`,`valid alignment`,t.join.halign);if(n.defined(t.join.valign))if(n.string(t.join.valign)&&n.string(this.constructor.align[t.join.valign]))i.joinValign=this.constructor.align[t.join.valign];else throw n.invalidParameterError(`join.valign`,`valid alignment`,t.join.valign)}else throw Error(`Expected input to be an array of images to join`)}else if(n.defined(t))throw Error(`Invalid input options ${t}`);return i}function c(e,t,r){Array.isArray(this.options.input.buffer)?n.buffer(e)?(this.options.input.buffer.length===0&&this.on(`finish`,()=>{this.streamInFinished=!0}),this.options.input.buffer.push(e),r()):r(Error(`Non-Buffer data on Writable Stream`)):r(Error(`Unexpected data on Writable Stream`))}function l(){this._isStreamInput()&&(this.options.input.buffer=Buffer.concat(this.options.input.buffer))}function u(){return Array.isArray(this.options.input.buffer)}function d(e){let t=Error();return n.fn(e)?(this._isStreamInput()?this.on(`finish`,()=>{this._flattenBufferIn(),r.metadata(this.options,(r,i)=>{r?e(n.nativeError(r,t)):e(null,i)})}):r.metadata(this.options,(r,i)=>{r?e(n.nativeError(r,t)):e(null,i)}),this):this._isStreamInput()?new Promise((e,i)=>{let a=()=>{this._flattenBufferIn(),r.metadata(this.options,(r,a)=>{r?i(n.nativeError(r,t)):e(a)})};this.writableFinished?a():this.once(`finish`,a)}):new Promise((e,i)=>{r.metadata(this.options,(r,a)=>{r?i(n.nativeError(r,t)):e(a)})})}function f(e){let t=Error();return n.fn(e)?(this._isStreamInput()?this.on(`finish`,()=>{this._flattenBufferIn(),r.stats(this.options,(r,i)=>{r?e(n.nativeError(r,t)):e(null,i)})}):r.stats(this.options,(r,i)=>{r?e(n.nativeError(r,t)):e(null,i)}),this):this._isStreamInput()?new Promise((e,i)=>{this.on(`finish`,function(){this._flattenBufferIn(),r.stats(this.options,(r,a)=>{r?i(n.nativeError(r,t)):e(a)})})}):new Promise((e,i)=>{r.stats(this.options,(r,a)=>{r?i(n.nativeError(r,t)):e(a)})})}t.exports=e=>{Object.assign(e.prototype,{_inputOptionsFromObject:o,_createInputDescriptor:s,_write:c,_flattenBufferIn:l,_isStreamInput:u,metadata:d,stats:f}),e.align=i}})),Fa=M(((e,t)=>{
96
+ let n=ws(),r=Zs(),i={left:`low`,top:`low`,low:`low`,center:`centre`,centre:`centre`,right:`high`,bottom:`high`,high:`high`},a=[`failOn`,`limitInputPixels`,`unlimited`,`animated`,`autoOrient`,`density`,`ignoreIcc`,`page`,`pages`,`sequentialRead`,`jp2`,`openSlide`,`pdf`,`raw`,`svg`,`tiff`,`failOnError`,`openSlideLevel`,`pdfBackground`,`tiffSubifd`];function o(e){let t=a.filter(t=>n.defined(e[t])).map(t=>[t,e[t]]);return t.length?Object.fromEntries(t):void 0}function s(e,t,r){let i={autoOrient:!1,failOn:`warning`,limitInputPixels:16383**2,ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(n.string(e))i.file=e;else if(n.buffer(e)){if(e.length===0)throw Error(`Input Buffer is empty`);i.buffer=e}else if(n.arrayBuffer(e)){if(e.byteLength===0)throw Error(`Input bit Array is empty`);i.buffer=Buffer.from(e,0,e.byteLength)}else if(n.typedArray(e)){if(e.length===0)throw Error(`Input Bit Array is empty`);i.buffer=Buffer.from(e.buffer,e.byteOffset,e.byteLength)}else if(n.plainObject(e)&&!n.defined(t))t=e,o(t)&&(i.buffer=[]);else if(!n.defined(e)&&!n.defined(t)&&n.object(r)&&r.allowStream)i.buffer=[];else if(Array.isArray(e))if(e.length>1)if(!this.options.joining)this.options.joining=!0,this.options.join=e.map(e=>this._createInputDescriptor(e));else throw Error(`Recursive join is unsupported`);else throw Error(`Expected at least two images to join`);else throw Error(`Unsupported input '${e}' of type ${typeof e}${n.defined(t)?` when also providing options of type ${typeof t}`:``}`);if(n.object(t)){if(n.defined(t.failOnError))if(n.bool(t.failOnError))i.failOn=t.failOnError?`warning`:`none`;else throw n.invalidParameterError(`failOnError`,`boolean`,t.failOnError);if(n.defined(t.failOn))if(n.string(t.failOn)&&n.inArray(t.failOn,[`none`,`truncated`,`error`,`warning`]))i.failOn=t.failOn;else throw n.invalidParameterError(`failOn`,`one of: none, truncated, error, warning`,t.failOn);if(n.defined(t.autoOrient))if(n.bool(t.autoOrient))i.autoOrient=t.autoOrient;else throw n.invalidParameterError(`autoOrient`,`boolean`,t.autoOrient);if(n.defined(t.density))if(n.inRange(t.density,1,1e5))i.density=t.density;else throw n.invalidParameterError(`density`,`number between 1 and 100000`,t.density);if(n.defined(t.ignoreIcc))if(n.bool(t.ignoreIcc))i.ignoreIcc=t.ignoreIcc;else throw n.invalidParameterError(`ignoreIcc`,`boolean`,t.ignoreIcc);if(n.defined(t.limitInputPixels))if(n.bool(t.limitInputPixels))i.limitInputPixels=t.limitInputPixels?16383**2:0;else if(n.integer(t.limitInputPixels)&&n.inRange(t.limitInputPixels,0,2**53-1))i.limitInputPixels=t.limitInputPixels;else throw n.invalidParameterError(`limitInputPixels`,`positive integer`,t.limitInputPixels);if(n.defined(t.unlimited))if(n.bool(t.unlimited))i.unlimited=t.unlimited;else throw n.invalidParameterError(`unlimited`,`boolean`,t.unlimited);if(n.defined(t.sequentialRead))if(n.bool(t.sequentialRead))i.sequentialRead=t.sequentialRead;else throw n.invalidParameterError(`sequentialRead`,`boolean`,t.sequentialRead);if(n.defined(t.raw)){if(n.object(t.raw)&&n.integer(t.raw.width)&&t.raw.width>0&&n.integer(t.raw.height)&&t.raw.height>0&&n.integer(t.raw.channels)&&n.inRange(t.raw.channels,1,4))switch(i.rawWidth=t.raw.width,i.rawHeight=t.raw.height,i.rawChannels=t.raw.channels,e.constructor){case Uint8Array:case Uint8ClampedArray:i.rawDepth=`uchar`;break;case Int8Array:i.rawDepth=`char`;break;case Uint16Array:i.rawDepth=`ushort`;break;case Int16Array:i.rawDepth=`short`;break;case Uint32Array:i.rawDepth=`uint`;break;case Int32Array:i.rawDepth=`int`;break;case Float32Array:i.rawDepth=`float`;break;case Float64Array:i.rawDepth=`double`;break;default:i.rawDepth=`uchar`;break}else throw Error(`Expected width, height and channels for raw pixel input`);if(i.rawPremultiplied=!1,n.defined(t.raw.premultiplied))if(n.bool(t.raw.premultiplied))i.rawPremultiplied=t.raw.premultiplied;else throw n.invalidParameterError(`raw.premultiplied`,`boolean`,t.raw.premultiplied);if(i.rawPageHeight=0,n.defined(t.raw.pageHeight))if(n.integer(t.raw.pageHeight)&&t.raw.pageHeight>0&&t.raw.pageHeight<=t.raw.height){if(t.raw.height%t.raw.pageHeight!==0)throw Error(`Expected raw.height ${t.raw.height} to be a multiple of raw.pageHeight ${t.raw.pageHeight}`);i.rawPageHeight=t.raw.pageHeight}else throw n.invalidParameterError(`raw.pageHeight`,`positive integer`,t.raw.pageHeight)}if(n.defined(t.animated))if(n.bool(t.animated))i.pages=t.animated?-1:1;else throw n.invalidParameterError(`animated`,`boolean`,t.animated);if(n.defined(t.pages))if(n.integer(t.pages)&&n.inRange(t.pages,-1,1e5))i.pages=t.pages;else throw n.invalidParameterError(`pages`,`integer between -1 and 100000`,t.pages);if(n.defined(t.page))if(n.integer(t.page)&&n.inRange(t.page,0,1e5))i.page=t.page;else throw n.invalidParameterError(`page`,`integer between 0 and 100000`,t.page);if(n.object(t.openSlide)&&n.defined(t.openSlide.level))if(n.integer(t.openSlide.level)&&n.inRange(t.openSlide.level,0,256))i.openSlideLevel=t.openSlide.level;else throw n.invalidParameterError(`openSlide.level`,`integer between 0 and 256`,t.openSlide.level);else if(n.defined(t.level))if(n.integer(t.level)&&n.inRange(t.level,0,256))i.openSlideLevel=t.level;else throw n.invalidParameterError(`level`,`integer between 0 and 256`,t.level);if(n.object(t.tiff)&&n.defined(t.tiff.subifd))if(n.integer(t.tiff.subifd)&&n.inRange(t.tiff.subifd,-1,1e5))i.tiffSubifd=t.tiff.subifd;else throw n.invalidParameterError(`tiff.subifd`,`integer between -1 and 100000`,t.tiff.subifd);else if(n.defined(t.subifd))if(n.integer(t.subifd)&&n.inRange(t.subifd,-1,1e5))i.tiffSubifd=t.subifd;else throw n.invalidParameterError(`subifd`,`integer between -1 and 100000`,t.subifd);if(n.object(t.svg)){if(n.defined(t.svg.stylesheet))if(n.string(t.svg.stylesheet))i.svgStylesheet=t.svg.stylesheet;else throw n.invalidParameterError(`svg.stylesheet`,`string`,t.svg.stylesheet);if(n.defined(t.svg.highBitdepth))if(n.bool(t.svg.highBitdepth))i.svgHighBitdepth=t.svg.highBitdepth;else throw n.invalidParameterError(`svg.highBitdepth`,`boolean`,t.svg.highBitdepth)}if(n.object(t.pdf)&&n.defined(t.pdf.background)?i.pdfBackground=this._getBackgroundColourOption(t.pdf.background):n.defined(t.pdfBackground)&&(i.pdfBackground=this._getBackgroundColourOption(t.pdfBackground)),n.object(t.jp2)&&n.defined(t.jp2.oneshot))if(n.bool(t.jp2.oneshot))i.jp2Oneshot=t.jp2.oneshot;else throw n.invalidParameterError(`jp2.oneshot`,`boolean`,t.jp2.oneshot);if(n.defined(t.create))if(n.object(t.create)&&n.integer(t.create.width)&&t.create.width>0&&n.integer(t.create.height)&&t.create.height>0&&n.integer(t.create.channels)){if(i.createWidth=t.create.width,i.createHeight=t.create.height,i.createChannels=t.create.channels,i.createPageHeight=0,n.defined(t.create.pageHeight))if(n.integer(t.create.pageHeight)&&t.create.pageHeight>0&&t.create.pageHeight<=t.create.height){if(t.create.height%t.create.pageHeight!==0)throw Error(`Expected create.height ${t.create.height} to be a multiple of create.pageHeight ${t.create.pageHeight}`);i.createPageHeight=t.create.pageHeight}else throw n.invalidParameterError(`create.pageHeight`,`positive integer`,t.create.pageHeight);if(n.defined(t.create.noise)){if(!n.object(t.create.noise))throw Error(`Expected noise to be an object`);if(t.create.noise.type!==`gaussian`)throw Error(`Only gaussian noise is supported at the moment`);if(i.createNoiseType=t.create.noise.type,!n.inRange(t.create.channels,1,4))throw n.invalidParameterError(`create.channels`,`number between 1 and 4`,t.create.channels);if(i.createNoiseMean=128,n.defined(t.create.noise.mean))if(n.number(t.create.noise.mean)&&n.inRange(t.create.noise.mean,0,1e4))i.createNoiseMean=t.create.noise.mean;else throw n.invalidParameterError(`create.noise.mean`,`number between 0 and 10000`,t.create.noise.mean);if(i.createNoiseSigma=30,n.defined(t.create.noise.sigma))if(n.number(t.create.noise.sigma)&&n.inRange(t.create.noise.sigma,0,1e4))i.createNoiseSigma=t.create.noise.sigma;else throw n.invalidParameterError(`create.noise.sigma`,`number between 0 and 10000`,t.create.noise.sigma)}else if(n.defined(t.create.background)){if(!n.inRange(t.create.channels,3,4))throw n.invalidParameterError(`create.channels`,`number between 3 and 4`,t.create.channels);i.createBackground=this._getBackgroundColourOption(t.create.background)}else throw Error(`Expected valid noise or background to create a new input image`);delete i.buffer}else throw Error(`Expected valid width, height and channels to create a new input image`);if(n.defined(t.text))if(n.object(t.text)&&n.string(t.text.text)){if(i.textValue=t.text.text,n.defined(t.text.height)&&n.defined(t.text.dpi))throw Error(`Expected only one of dpi or height`);if(n.defined(t.text.font))if(n.string(t.text.font))i.textFont=t.text.font;else throw n.invalidParameterError(`text.font`,`string`,t.text.font);if(n.defined(t.text.fontfile))if(n.string(t.text.fontfile))i.textFontfile=t.text.fontfile;else throw n.invalidParameterError(`text.fontfile`,`string`,t.text.fontfile);if(n.defined(t.text.width))if(n.integer(t.text.width)&&t.text.width>0)i.textWidth=t.text.width;else throw n.invalidParameterError(`text.width`,`positive integer`,t.text.width);if(n.defined(t.text.height))if(n.integer(t.text.height)&&t.text.height>0)i.textHeight=t.text.height;else throw n.invalidParameterError(`text.height`,`positive integer`,t.text.height);if(n.defined(t.text.align))if(n.string(t.text.align)&&n.string(this.constructor.align[t.text.align]))i.textAlign=this.constructor.align[t.text.align];else throw n.invalidParameterError(`text.align`,`valid alignment`,t.text.align);if(n.defined(t.text.justify))if(n.bool(t.text.justify))i.textJustify=t.text.justify;else throw n.invalidParameterError(`text.justify`,`boolean`,t.text.justify);if(n.defined(t.text.dpi))if(n.integer(t.text.dpi)&&n.inRange(t.text.dpi,1,1e6))i.textDpi=t.text.dpi;else throw n.invalidParameterError(`text.dpi`,`integer between 1 and 1000000`,t.text.dpi);if(n.defined(t.text.rgba))if(n.bool(t.text.rgba))i.textRgba=t.text.rgba;else throw n.invalidParameterError(`text.rgba`,`bool`,t.text.rgba);if(n.defined(t.text.spacing))if(n.integer(t.text.spacing)&&n.inRange(t.text.spacing,-1e6,1e6))i.textSpacing=t.text.spacing;else throw n.invalidParameterError(`text.spacing`,`integer between -1000000 and 1000000`,t.text.spacing);if(n.defined(t.text.wrap))if(n.string(t.text.wrap)&&n.inArray(t.text.wrap,[`word`,`char`,`word-char`,`none`]))i.textWrap=t.text.wrap;else throw n.invalidParameterError(`text.wrap`,`one of: word, char, word-char, none`,t.text.wrap);delete i.buffer}else throw Error(`Expected a valid string to create an image with text.`);if(n.defined(t.join))if(n.defined(this.options.join)){if(n.defined(t.join.animated))if(n.bool(t.join.animated))i.joinAnimated=t.join.animated;else throw n.invalidParameterError(`join.animated`,`boolean`,t.join.animated);if(n.defined(t.join.across))if(n.integer(t.join.across)&&n.inRange(t.join.across,1,1e6))i.joinAcross=t.join.across;else throw n.invalidParameterError(`join.across`,`integer between 1 and 100000`,t.join.across);if(n.defined(t.join.shim))if(n.integer(t.join.shim)&&n.inRange(t.join.shim,0,1e6))i.joinShim=t.join.shim;else throw n.invalidParameterError(`join.shim`,`integer between 0 and 100000`,t.join.shim);if(n.defined(t.join.background)&&(i.joinBackground=this._getBackgroundColourOption(t.join.background)),n.defined(t.join.halign))if(n.string(t.join.halign)&&n.string(this.constructor.align[t.join.halign]))i.joinHalign=this.constructor.align[t.join.halign];else throw n.invalidParameterError(`join.halign`,`valid alignment`,t.join.halign);if(n.defined(t.join.valign))if(n.string(t.join.valign)&&n.string(this.constructor.align[t.join.valign]))i.joinValign=this.constructor.align[t.join.valign];else throw n.invalidParameterError(`join.valign`,`valid alignment`,t.join.valign)}else throw Error(`Expected input to be an array of images to join`)}else if(n.defined(t))throw Error(`Invalid input options ${t}`);return i}function c(e,t,r){Array.isArray(this.options.input.buffer)?n.buffer(e)?(this.options.input.buffer.length===0&&this.on(`finish`,()=>{this.streamInFinished=!0}),this.options.input.buffer.push(e),r()):r(Error(`Non-Buffer data on Writable Stream`)):r(Error(`Unexpected data on Writable Stream`))}function l(){this._isStreamInput()&&(this.options.input.buffer=Buffer.concat(this.options.input.buffer))}function u(){return Array.isArray(this.options.input.buffer)}function d(e){let t=Error();return n.fn(e)?(this._isStreamInput()?this.on(`finish`,()=>{this._flattenBufferIn(),r.metadata(this.options,(r,i)=>{r?e(n.nativeError(r,t)):e(null,i)})}):r.metadata(this.options,(r,i)=>{r?e(n.nativeError(r,t)):e(null,i)}),this):this._isStreamInput()?new Promise((e,i)=>{let a=()=>{this._flattenBufferIn(),r.metadata(this.options,(r,a)=>{r?i(n.nativeError(r,t)):e(a)})};this.writableFinished?a():this.once(`finish`,a)}):new Promise((e,i)=>{r.metadata(this.options,(r,a)=>{r?i(n.nativeError(r,t)):e(a)})})}function f(e){let t=Error();return n.fn(e)?(this._isStreamInput()?this.on(`finish`,()=>{this._flattenBufferIn(),r.stats(this.options,(r,i)=>{r?e(n.nativeError(r,t)):e(null,i)})}):r.stats(this.options,(r,i)=>{r?e(n.nativeError(r,t)):e(null,i)}),this):this._isStreamInput()?new Promise((e,i)=>{this.on(`finish`,function(){this._flattenBufferIn(),r.stats(this.options,(r,a)=>{r?i(n.nativeError(r,t)):e(a)})})}):new Promise((e,i)=>{r.stats(this.options,(r,a)=>{r?i(n.nativeError(r,t)):e(a)})})}t.exports=e=>{Object.assign(e.prototype,{_inputOptionsFromObject:o,_createInputDescriptor:s,_write:c,_flattenBufferIn:l,_isStreamInput:u,metadata:d,stats:f}),e.align=i}})),ec=A(((e,t)=>{
97
97
  /*!
98
98
  Copyright 2013 Lovell Fuller and others.
99
99
  SPDX-License-Identifier: Apache-2.0
100
100
  */
101
- let n=aa(),r={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},i={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},a={background:`background`,copy:`copy`,repeat:`repeat`,mirror:`mirror`},o={entropy:16,attention:17},s={nearest:`nearest`,linear:`linear`,cubic:`cubic`,mitchell:`mitchell`,lanczos2:`lanczos2`,lanczos3:`lanczos3`,mks2013:`mks2013`,mks2021:`mks2021`},c={contain:`contain`,cover:`cover`,fill:`fill`,inside:`inside`,outside:`outside`},l={contain:`embed`,cover:`crop`,fill:`ignore_aspect`,inside:`max`,outside:`min`};function u(e){return e.angle%360!=0||e.rotationAngle!==0}function d(e){return e.width!==-1||e.height!==-1}function f(e,t,a){if(d(this.options)&&this.options.debuglog(`ignoring previous resize options`),this.options.widthPost!==-1&&this.options.debuglog(`operation order will be: extract, resize, extract`),n.defined(e))if(n.object(e)&&!n.defined(a))a=e;else if(n.integer(e)&&e>0)this.options.width=e;else throw n.invalidParameterError(`width`,`positive integer`,e);else this.options.width=-1;if(n.defined(t))if(n.integer(t)&&t>0)this.options.height=t;else throw n.invalidParameterError(`height`,`positive integer`,t);else this.options.height=-1;if(n.object(a)){if(n.defined(a.width))if(n.integer(a.width)&&a.width>0)this.options.width=a.width;else throw n.invalidParameterError(`width`,`positive integer`,a.width);if(n.defined(a.height))if(n.integer(a.height)&&a.height>0)this.options.height=a.height;else throw n.invalidParameterError(`height`,`positive integer`,a.height);if(n.defined(a.fit)){let e=l[a.fit];if(n.string(e))this.options.canvas=e;else throw n.invalidParameterError(`fit`,`valid fit`,a.fit)}if(n.defined(a.position)){let e=n.integer(a.position)?a.position:o[a.position]||i[a.position]||r[a.position];if(n.integer(e)&&(n.inRange(e,0,8)||n.inRange(e,16,17)))this.options.position=e;else throw n.invalidParameterError(`position`,`valid position/gravity/strategy`,a.position)}if(this._setBackgroundColourOption(`resizeBackground`,a.background),n.defined(a.kernel))if(n.string(s[a.kernel]))this.options.kernel=s[a.kernel];else throw n.invalidParameterError(`kernel`,`valid kernel name`,a.kernel);n.defined(a.withoutEnlargement)&&this._setBooleanOption(`withoutEnlargement`,a.withoutEnlargement),n.defined(a.withoutReduction)&&this._setBooleanOption(`withoutReduction`,a.withoutReduction),n.defined(a.fastShrinkOnLoad)&&this._setBooleanOption(`fastShrinkOnLoad`,a.fastShrinkOnLoad)}return u(this.options)&&d(this.options)&&(this.options.rotateBefore=!0),this}function p(e){if(n.integer(e)&&e>0)this.options.extendTop=e,this.options.extendBottom=e,this.options.extendLeft=e,this.options.extendRight=e;else if(n.object(e)){if(n.defined(e.top))if(n.integer(e.top)&&e.top>=0)this.options.extendTop=e.top;else throw n.invalidParameterError(`top`,`positive integer`,e.top);if(n.defined(e.bottom))if(n.integer(e.bottom)&&e.bottom>=0)this.options.extendBottom=e.bottom;else throw n.invalidParameterError(`bottom`,`positive integer`,e.bottom);if(n.defined(e.left))if(n.integer(e.left)&&e.left>=0)this.options.extendLeft=e.left;else throw n.invalidParameterError(`left`,`positive integer`,e.left);if(n.defined(e.right))if(n.integer(e.right)&&e.right>=0)this.options.extendRight=e.right;else throw n.invalidParameterError(`right`,`positive integer`,e.right);if(this._setBackgroundColourOption(`extendBackground`,e.background),n.defined(e.extendWith))if(n.string(a[e.extendWith]))this.options.extendWith=a[e.extendWith];else throw n.invalidParameterError(`extendWith`,`one of: background, copy, repeat, mirror`,e.extendWith)}else throw n.invalidParameterError(`extend`,`integer or object`,e);return this}function m(e){let t=d(this.options)||this.options.widthPre!==-1?`Post`:`Pre`;return this.options[`width${t}`]!==-1&&this.options.debuglog(`ignoring previous extract options`),[`left`,`top`,`width`,`height`].forEach(function(r){let i=e[r];if(n.integer(i)&&i>=0)this.options[r+(r===`left`||r===`top`?`Offset`:``)+t]=i;else throw n.invalidParameterError(r,`integer`,i)},this),u(this.options)&&!d(this.options)&&(this.options.widthPre===-1||this.options.widthPost===-1)&&(this.options.rotateBefore=!0),this.options.input.autoOrient&&(this.options.orientBefore=!0),this}function h(e){if(this.options.trimThreshold=10,n.defined(e))if(n.object(e)){if(n.defined(e.background)&&this._setBackgroundColourOption(`trimBackground`,e.background),n.defined(e.threshold))if(n.number(e.threshold)&&e.threshold>=0)this.options.trimThreshold=e.threshold;else throw n.invalidParameterError(`threshold`,`positive number`,e.threshold);n.defined(e.lineArt)&&this._setBooleanOption(`trimLineArt`,e.lineArt)}else throw n.invalidParameterError(`trim`,`object`,e);return u(this.options)&&(this.options.rotateBefore=!0),this}t.exports=e=>{Object.assign(e.prototype,{resize:f,extend:p,extract:m,trim:h}),e.gravity=r,e.strategy=o,e.kernel=s,e.fit=c,e.position=i}})),Ia=M(((e,t)=>{
101
+ let n=ws(),r={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},i={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},a={background:`background`,copy:`copy`,repeat:`repeat`,mirror:`mirror`},o={entropy:16,attention:17},s={nearest:`nearest`,linear:`linear`,cubic:`cubic`,mitchell:`mitchell`,lanczos2:`lanczos2`,lanczos3:`lanczos3`,mks2013:`mks2013`,mks2021:`mks2021`},c={contain:`contain`,cover:`cover`,fill:`fill`,inside:`inside`,outside:`outside`},l={contain:`embed`,cover:`crop`,fill:`ignore_aspect`,inside:`max`,outside:`min`};function u(e){return e.angle%360!=0||e.rotationAngle!==0}function d(e){return e.width!==-1||e.height!==-1}function f(e,t,a){if(d(this.options)&&this.options.debuglog(`ignoring previous resize options`),this.options.widthPost!==-1&&this.options.debuglog(`operation order will be: extract, resize, extract`),n.defined(e))if(n.object(e)&&!n.defined(a))a=e;else if(n.integer(e)&&e>0)this.options.width=e;else throw n.invalidParameterError(`width`,`positive integer`,e);else this.options.width=-1;if(n.defined(t))if(n.integer(t)&&t>0)this.options.height=t;else throw n.invalidParameterError(`height`,`positive integer`,t);else this.options.height=-1;if(n.object(a)){if(n.defined(a.width))if(n.integer(a.width)&&a.width>0)this.options.width=a.width;else throw n.invalidParameterError(`width`,`positive integer`,a.width);if(n.defined(a.height))if(n.integer(a.height)&&a.height>0)this.options.height=a.height;else throw n.invalidParameterError(`height`,`positive integer`,a.height);if(n.defined(a.fit)){let e=l[a.fit];if(n.string(e))this.options.canvas=e;else throw n.invalidParameterError(`fit`,`valid fit`,a.fit)}if(n.defined(a.position)){let e=n.integer(a.position)?a.position:o[a.position]||i[a.position]||r[a.position];if(n.integer(e)&&(n.inRange(e,0,8)||n.inRange(e,16,17)))this.options.position=e;else throw n.invalidParameterError(`position`,`valid position/gravity/strategy`,a.position)}if(this._setBackgroundColourOption(`resizeBackground`,a.background),n.defined(a.kernel))if(n.string(s[a.kernel]))this.options.kernel=s[a.kernel];else throw n.invalidParameterError(`kernel`,`valid kernel name`,a.kernel);n.defined(a.withoutEnlargement)&&this._setBooleanOption(`withoutEnlargement`,a.withoutEnlargement),n.defined(a.withoutReduction)&&this._setBooleanOption(`withoutReduction`,a.withoutReduction),n.defined(a.fastShrinkOnLoad)&&this._setBooleanOption(`fastShrinkOnLoad`,a.fastShrinkOnLoad)}return u(this.options)&&d(this.options)&&(this.options.rotateBefore=!0),this}function p(e){if(n.integer(e)&&e>0)this.options.extendTop=e,this.options.extendBottom=e,this.options.extendLeft=e,this.options.extendRight=e;else if(n.object(e)){if(n.defined(e.top))if(n.integer(e.top)&&e.top>=0)this.options.extendTop=e.top;else throw n.invalidParameterError(`top`,`positive integer`,e.top);if(n.defined(e.bottom))if(n.integer(e.bottom)&&e.bottom>=0)this.options.extendBottom=e.bottom;else throw n.invalidParameterError(`bottom`,`positive integer`,e.bottom);if(n.defined(e.left))if(n.integer(e.left)&&e.left>=0)this.options.extendLeft=e.left;else throw n.invalidParameterError(`left`,`positive integer`,e.left);if(n.defined(e.right))if(n.integer(e.right)&&e.right>=0)this.options.extendRight=e.right;else throw n.invalidParameterError(`right`,`positive integer`,e.right);if(this._setBackgroundColourOption(`extendBackground`,e.background),n.defined(e.extendWith))if(n.string(a[e.extendWith]))this.options.extendWith=a[e.extendWith];else throw n.invalidParameterError(`extendWith`,`one of: background, copy, repeat, mirror`,e.extendWith)}else throw n.invalidParameterError(`extend`,`integer or object`,e);return this}function m(e){let t=d(this.options)||this.options.widthPre!==-1?`Post`:`Pre`;return this.options[`width${t}`]!==-1&&this.options.debuglog(`ignoring previous extract options`),[`left`,`top`,`width`,`height`].forEach(function(r){let i=e[r];if(n.integer(i)&&i>=0)this.options[r+(r===`left`||r===`top`?`Offset`:``)+t]=i;else throw n.invalidParameterError(r,`integer`,i)},this),u(this.options)&&!d(this.options)&&(this.options.widthPre===-1||this.options.widthPost===-1)&&(this.options.rotateBefore=!0),this.options.input.autoOrient&&(this.options.orientBefore=!0),this}function h(e){if(this.options.trimThreshold=10,n.defined(e))if(n.object(e)){if(n.defined(e.background)&&this._setBackgroundColourOption(`trimBackground`,e.background),n.defined(e.threshold))if(n.number(e.threshold)&&e.threshold>=0)this.options.trimThreshold=e.threshold;else throw n.invalidParameterError(`threshold`,`positive number`,e.threshold);n.defined(e.lineArt)&&this._setBooleanOption(`trimLineArt`,e.lineArt)}else throw n.invalidParameterError(`trim`,`object`,e);return u(this.options)&&(this.options.rotateBefore=!0),this}t.exports=e=>{Object.assign(e.prototype,{resize:f,extend:p,extract:m,trim:h}),e.gravity=r,e.strategy=o,e.kernel=s,e.fit=c,e.position=i}})),tc=A(((e,t)=>{
102
102
  /*!
103
103
  Copyright 2013 Lovell Fuller and others.
104
104
  SPDX-License-Identifier: Apache-2.0
105
105
  */
106
- let n=aa(),r={clear:`clear`,source:`source`,over:`over`,in:`in`,out:`out`,atop:`atop`,dest:`dest`,"dest-over":`dest-over`,"dest-in":`dest-in`,"dest-out":`dest-out`,"dest-atop":`dest-atop`,xor:`xor`,add:`add`,saturate:`saturate`,multiply:`multiply`,screen:`screen`,overlay:`overlay`,darken:`darken`,lighten:`lighten`,"colour-dodge":`colour-dodge`,"color-dodge":`colour-dodge`,"colour-burn":`colour-burn`,"color-burn":`colour-burn`,"hard-light":`hard-light`,"soft-light":`soft-light`,difference:`difference`,exclusion:`exclusion`};function i(e){if(!Array.isArray(e))throw n.invalidParameterError(`images to composite`,`array`,e);return this.options.composite=e.map(e=>{if(!n.object(e))throw n.invalidParameterError(`image to composite`,`object`,e);let t=this._inputOptionsFromObject(e),i={input:this._createInputDescriptor(e.input,t,{allowStream:!1}),blend:`over`,tile:!1,left:0,top:0,hasOffset:!1,gravity:0,premultiplied:!1};if(n.defined(e.blend))if(n.string(r[e.blend]))i.blend=r[e.blend];else throw n.invalidParameterError(`blend`,`valid blend name`,e.blend);if(n.defined(e.tile))if(n.bool(e.tile))i.tile=e.tile;else throw n.invalidParameterError(`tile`,`boolean`,e.tile);if(n.defined(e.left))if(n.integer(e.left))i.left=e.left;else throw n.invalidParameterError(`left`,`integer`,e.left);if(n.defined(e.top))if(n.integer(e.top))i.top=e.top;else throw n.invalidParameterError(`top`,`integer`,e.top);if(n.defined(e.top)!==n.defined(e.left))throw Error(`Expected both left and top to be set`);if(i.hasOffset=n.integer(e.top)&&n.integer(e.left),n.defined(e.gravity))if(n.integer(e.gravity)&&n.inRange(e.gravity,0,8))i.gravity=e.gravity;else if(n.string(e.gravity)&&n.integer(this.constructor.gravity[e.gravity]))i.gravity=this.constructor.gravity[e.gravity];else throw n.invalidParameterError(`gravity`,`valid gravity`,e.gravity);if(n.defined(e.premultiplied))if(n.bool(e.premultiplied))i.premultiplied=e.premultiplied;else throw n.invalidParameterError(`premultiplied`,`boolean`,e.premultiplied);return i}),this}t.exports=e=>{e.prototype.composite=i,e.blend=r}})),La=M(((e,t)=>{
106
+ let n=ws(),r={clear:`clear`,source:`source`,over:`over`,in:`in`,out:`out`,atop:`atop`,dest:`dest`,"dest-over":`dest-over`,"dest-in":`dest-in`,"dest-out":`dest-out`,"dest-atop":`dest-atop`,xor:`xor`,add:`add`,saturate:`saturate`,multiply:`multiply`,screen:`screen`,overlay:`overlay`,darken:`darken`,lighten:`lighten`,"colour-dodge":`colour-dodge`,"color-dodge":`colour-dodge`,"colour-burn":`colour-burn`,"color-burn":`colour-burn`,"hard-light":`hard-light`,"soft-light":`soft-light`,difference:`difference`,exclusion:`exclusion`};function i(e){if(!Array.isArray(e))throw n.invalidParameterError(`images to composite`,`array`,e);return this.options.composite=e.map(e=>{if(!n.object(e))throw n.invalidParameterError(`image to composite`,`object`,e);let t=this._inputOptionsFromObject(e),i={input:this._createInputDescriptor(e.input,t,{allowStream:!1}),blend:`over`,tile:!1,left:0,top:0,hasOffset:!1,gravity:0,premultiplied:!1};if(n.defined(e.blend))if(n.string(r[e.blend]))i.blend=r[e.blend];else throw n.invalidParameterError(`blend`,`valid blend name`,e.blend);if(n.defined(e.tile))if(n.bool(e.tile))i.tile=e.tile;else throw n.invalidParameterError(`tile`,`boolean`,e.tile);if(n.defined(e.left))if(n.integer(e.left))i.left=e.left;else throw n.invalidParameterError(`left`,`integer`,e.left);if(n.defined(e.top))if(n.integer(e.top))i.top=e.top;else throw n.invalidParameterError(`top`,`integer`,e.top);if(n.defined(e.top)!==n.defined(e.left))throw Error(`Expected both left and top to be set`);if(i.hasOffset=n.integer(e.top)&&n.integer(e.left),n.defined(e.gravity))if(n.integer(e.gravity)&&n.inRange(e.gravity,0,8))i.gravity=e.gravity;else if(n.string(e.gravity)&&n.integer(this.constructor.gravity[e.gravity]))i.gravity=this.constructor.gravity[e.gravity];else throw n.invalidParameterError(`gravity`,`valid gravity`,e.gravity);if(n.defined(e.premultiplied))if(n.bool(e.premultiplied))i.premultiplied=e.premultiplied;else throw n.invalidParameterError(`premultiplied`,`boolean`,e.premultiplied);return i}),this}t.exports=e=>{e.prototype.composite=i,e.blend=r}})),nc=A(((e,t)=>{
107
107
  /*!
108
108
  Copyright 2013 Lovell Fuller and others.
109
109
  SPDX-License-Identifier: Apache-2.0
110
110
  */
111
- let n=aa(),r={integer:`integer`,float:`float`,approximate:`approximate`};function i(e,t){if(!n.defined(e))return this.autoOrient();if((this.options.angle||this.options.rotationAngle)&&(this.options.debuglog(`ignoring previous rotate options`),this.options.angle=0,this.options.rotationAngle=0),n.integer(e)&&!(e%90))this.options.angle=e;else if(n.number(e))this.options.rotationAngle=e,n.object(t)&&t.background&&this._setBackgroundColourOption(`rotationBackground`,t.background);else throw n.invalidParameterError(`angle`,`numeric`,e);return this}function a(){return this.options.input.autoOrient=!0,this}function o(e){return this.options.flip=n.bool(e)?e:!0,this}function s(e){return this.options.flop=n.bool(e)?e:!0,this}function c(e,t){let r=[].concat(...e);if(r.length===4&&r.every(n.number))this.options.affineMatrix=r;else throw n.invalidParameterError(`matrix`,`1x4 or 2x2 array`,e);if(n.defined(t))if(n.object(t)){if(this._setBackgroundColourOption(`affineBackground`,t.background),n.defined(t.idx))if(n.number(t.idx))this.options.affineIdx=t.idx;else throw n.invalidParameterError(`options.idx`,`number`,t.idx);if(n.defined(t.idy))if(n.number(t.idy))this.options.affineIdy=t.idy;else throw n.invalidParameterError(`options.idy`,`number`,t.idy);if(n.defined(t.odx))if(n.number(t.odx))this.options.affineOdx=t.odx;else throw n.invalidParameterError(`options.odx`,`number`,t.odx);if(n.defined(t.ody))if(n.number(t.ody))this.options.affineOdy=t.ody;else throw n.invalidParameterError(`options.ody`,`number`,t.ody);if(n.defined(t.interpolator))if(n.inArray(t.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=t.interpolator;else throw n.invalidParameterError(`options.interpolator`,`valid interpolator name`,t.interpolator)}else throw n.invalidParameterError(`options`,`object`,t);return this}function l(e,t,r){if(!n.defined(e))this.options.sharpenSigma=-1;else if(n.bool(e))this.options.sharpenSigma=e?-1:0;else if(n.number(e)&&n.inRange(e,.01,1e4)){if(this.options.sharpenSigma=e,n.defined(t))if(n.number(t)&&n.inRange(t,0,1e4))this.options.sharpenM1=t;else throw n.invalidParameterError(`flat`,`number between 0 and 10000`,t);if(n.defined(r))if(n.number(r)&&n.inRange(r,0,1e4))this.options.sharpenM2=r;else throw n.invalidParameterError(`jagged`,`number between 0 and 10000`,r)}else if(n.plainObject(e)){if(n.number(e.sigma)&&n.inRange(e.sigma,1e-6,10))this.options.sharpenSigma=e.sigma;else throw n.invalidParameterError(`options.sigma`,`number between 0.000001 and 10`,e.sigma);if(n.defined(e.m1))if(n.number(e.m1)&&n.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw n.invalidParameterError(`options.m1`,`number between 0 and 1000000`,e.m1);if(n.defined(e.m2))if(n.number(e.m2)&&n.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw n.invalidParameterError(`options.m2`,`number between 0 and 1000000`,e.m2);if(n.defined(e.x1))if(n.number(e.x1)&&n.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw n.invalidParameterError(`options.x1`,`number between 0 and 1000000`,e.x1);if(n.defined(e.y2))if(n.number(e.y2)&&n.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw n.invalidParameterError(`options.y2`,`number between 0 and 1000000`,e.y2);if(n.defined(e.y3))if(n.number(e.y3)&&n.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw n.invalidParameterError(`options.y3`,`number between 0 and 1000000`,e.y3)}else throw n.invalidParameterError(`sigma`,`number between 0.01 and 10000`,e);return this}function u(e){if(!n.defined(e))this.options.medianSize=3;else if(n.integer(e)&&n.inRange(e,1,1e3))this.options.medianSize=e;else throw n.invalidParameterError(`size`,`integer between 1 and 1000`,e);return this}function d(e){let t;if(n.number(e))t=e;else if(n.plainObject(e)){if(!n.number(e.sigma))throw n.invalidParameterError(`options.sigma`,`number between 0.3 and 1000`,t);if(t=e.sigma,`precision`in e)if(n.string(r[e.precision]))this.options.precision=r[e.precision];else throw n.invalidParameterError(`precision`,`one of: integer, float, approximate`,e.precision);if(`minAmplitude`in e)if(n.number(e.minAmplitude)&&n.inRange(e.minAmplitude,.001,1))this.options.minAmpl=e.minAmplitude;else throw n.invalidParameterError(`minAmplitude`,`number between 0.001 and 1`,e.minAmplitude)}if(!n.defined(e))this.options.blurSigma=-1;else if(n.bool(e))this.options.blurSigma=e?-1:0;else if(n.number(t)&&n.inRange(t,.3,1e3))this.options.blurSigma=t;else throw n.invalidParameterError(`sigma`,`number between 0.3 and 1000`,t);return this}function f(e){if(!n.defined(e))this.options.dilateWidth=1;else if(n.integer(e)&&e>0)this.options.dilateWidth=e;else throw n.invalidParameterError(`dilate`,`positive integer`,f);return this}function p(e){if(!n.defined(e))this.options.erodeWidth=1;else if(n.integer(e)&&e>0)this.options.erodeWidth=e;else throw n.invalidParameterError(`erode`,`positive integer`,p);return this}function m(e){return this.options.flatten=n.bool(e)?e:!0,n.object(e)&&this._setBackgroundColourOption(`flattenBackground`,e.background),this}function h(){return this.options.unflatten=!0,this}function g(e,t){if(!n.defined(e))this.options.gamma=2.2;else if(n.number(e)&&n.inRange(e,1,3))this.options.gamma=e;else throw n.invalidParameterError(`gamma`,`number between 1.0 and 3.0`,e);if(!n.defined(t))this.options.gammaOut=this.options.gamma;else if(n.number(t)&&n.inRange(t,1,3))this.options.gammaOut=t;else throw n.invalidParameterError(`gammaOut`,`number between 1.0 and 3.0`,t);return this}function _(e){if(this.options.negate=n.bool(e)?e:!0,n.plainObject(e)&&`alpha`in e)if(n.bool(e.alpha))this.options.negateAlpha=e.alpha;else throw n.invalidParameterError(`alpha`,`should be boolean value`,e.alpha);return this}function v(e){if(n.plainObject(e)){if(n.defined(e.lower))if(n.number(e.lower)&&n.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw n.invalidParameterError(`lower`,`number between 0 and 99`,e.lower);if(n.defined(e.upper))if(n.number(e.upper)&&n.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw n.invalidParameterError(`upper`,`number between 1 and 100`,e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw n.invalidParameterError(`range`,`lower to be less than upper`,`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function y(e){return this.normalise(e)}function b(e){if(n.plainObject(e)){if(n.integer(e.width)&&e.width>0)this.options.claheWidth=e.width;else throw n.invalidParameterError(`width`,`integer greater than zero`,e.width);if(n.integer(e.height)&&e.height>0)this.options.claheHeight=e.height;else throw n.invalidParameterError(`height`,`integer greater than zero`,e.height);if(n.defined(e.maxSlope))if(n.integer(e.maxSlope)&&n.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw n.invalidParameterError(`maxSlope`,`integer between 0 and 100`,e.maxSlope)}else throw n.invalidParameterError(`options`,`plain object`,e);return this}function x(e){if(!n.object(e)||!Array.isArray(e.kernel)||!n.integer(e.width)||!n.integer(e.height)||!n.inRange(e.width,3,1001)||!n.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length)throw Error(`Invalid convolution kernel`);return n.integer(e.scale)||(e.scale=e.kernel.reduce((e,t)=>e+t,0)),e.scale<1&&(e.scale=1),n.integer(e.offset)||(e.offset=0),this.options.convKernel=e,this}function S(e,t){if(!n.defined(e))this.options.threshold=128;else if(n.bool(e))this.options.threshold=e?128:0;else if(n.integer(e)&&n.inRange(e,0,255))this.options.threshold=e;else throw n.invalidParameterError(`threshold`,`integer between 0 and 255`,e);return!n.object(t)||t.greyscale===!0||t.grayscale===!0?this.options.thresholdGrayscale=!0:this.options.thresholdGrayscale=!1,this}function C(e,t,r){if(this.options.boolean=this._createInputDescriptor(e,r),n.string(t)&&n.inArray(t,[`and`,`or`,`eor`]))this.options.booleanOp=t;else throw n.invalidParameterError(`operator`,`one of: and, or, eor`,t);return this}function w(e,t){if(!n.defined(e)&&n.number(t)?e=1:n.number(e)&&!n.defined(t)&&(t=0),!n.defined(e))this.options.linearA=[];else if(n.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&e.length&&e.every(n.number))this.options.linearA=e;else throw n.invalidParameterError(`a`,`number or array of numbers`,e);if(!n.defined(t))this.options.linearB=[];else if(n.number(t))this.options.linearB=[t];else if(Array.isArray(t)&&t.length&&t.every(n.number))this.options.linearB=t;else throw n.invalidParameterError(`b`,`number or array of numbers`,t);if(this.options.linearA.length!==this.options.linearB.length)throw Error(`Expected a and b to be arrays of the same length`);return this}function ee(e){if(!Array.isArray(e))throw n.invalidParameterError(`inputMatrix`,`array`,e);if(e.length!==3&&e.length!==4)throw n.invalidParameterError(`inputMatrix`,`3x3 or 4x4 array`,e.length);let t=e.flat().map(Number);if(t.length!==9&&t.length!==16)throw n.invalidParameterError(`inputMatrix`,`cardinality of 9 or 16`,t.length);return this.options.recombMatrix=t,this}function te(e){if(!n.plainObject(e))throw n.invalidParameterError(`options`,`plain object`,e);if(`brightness`in e)if(n.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw n.invalidParameterError(`brightness`,`number above zero`,e.brightness);if(`saturation`in e)if(n.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw n.invalidParameterError(`saturation`,`number above zero`,e.saturation);if(`hue`in e)if(n.integer(e.hue))this.options.hue=e.hue%360;else throw n.invalidParameterError(`hue`,`number`,e.hue);if(`lightness`in e)if(n.number(e.lightness))this.options.lightness=e.lightness;else throw n.invalidParameterError(`lightness`,`number`,e.lightness);return this}t.exports=e=>{Object.assign(e.prototype,{autoOrient:a,rotate:i,flip:o,flop:s,affine:c,sharpen:l,erode:p,dilate:f,median:u,blur:d,flatten:m,unflatten:h,gamma:g,negate:_,normalise:v,normalize:y,clahe:b,convolve:x,threshold:S,boolean:C,linear:w,recomb:ee,modulate:te})}})),Ra=M(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{default:()=>pe}),t.exports=c(l);var u={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},d=Object.create(null);for(let e in u)Object.hasOwn(u,e)&&(d[u[e]]=e);var f={to:{},get:{}};f.get=function(e){let t=e.slice(0,3).toLowerCase(),n,r;switch(t){case`hsl`:n=f.get.hsl(e),r=`hsl`;break;case`hwb`:n=f.get.hwb(e),r=`hwb`;break;default:n=f.get.rgb(e),r=`rgb`;break}return n?{model:r,value:n}:null},f.get.rgb=function(e){if(!e)return null;let t=/^#([a-f\d]{3,4})$/i,n=/^#([a-f\d]{6})([a-f\d]{2})?$/i,r=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,i=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,a=/^(\w+)$/,o=[0,0,0,1],s,c,l;if(s=e.match(n)){for(l=s[2],s=s[1],c=0;c<3;c++){let e=c*2;o[c]=Number.parseInt(s.slice(e,e+2),16)}l&&(o[3]=Number.parseInt(l,16)/255)}else if(s=e.match(t)){for(s=s[1],l=s[3],c=0;c<3;c++)o[c]=Number.parseInt(s[c]+s[c],16);l&&(o[3]=Number.parseInt(l+l,16)/255)}else if(s=e.match(r)){for(c=0;c<3;c++)o[c]=Number.parseInt(s[c+1],10);s[4]&&(o[3]=s[5]?Number.parseFloat(s[4])*.01:Number.parseFloat(s[4]))}else if(s=e.match(i)){for(c=0;c<3;c++)o[c]=Math.round(Number.parseFloat(s[c+1])*2.55);s[4]&&(o[3]=s[5]?Number.parseFloat(s[4])*.01:Number.parseFloat(s[4]))}else if(s=e.match(a))return s[1]===`transparent`?[0,0,0,0]:Object.hasOwn(u,s[1])?(o=u[s[1]],o[3]=1,o):null;else return null;for(c=0;c<3;c++)o[c]=p(o[c],0,255);return o[3]=p(o[3],0,1),o},f.get.hsl=function(e){if(!e)return null;let t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){let e=Number.parseFloat(t[4]);return[(Number.parseFloat(t[1])%360+360)%360,p(Number.parseFloat(t[2]),0,100),p(Number.parseFloat(t[3]),0,100),p(Number.isNaN(e)?1:e,0,1)]}return null},f.get.hwb=function(e){if(!e)return null;let t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){let e=Number.parseFloat(t[4]);return[(Number.parseFloat(t[1])%360+360)%360,p(Number.parseFloat(t[2]),0,100),p(Number.parseFloat(t[3]),0,100),p(Number.isNaN(e)?1:e,0,1)]}return null},f.to.hex=function(...e){return`#`+m(e[0])+m(e[1])+m(e[2])+(e[3]<1?m(Math.round(e[3]*255)):``)},f.to.rgb=function(...e){return e.length<4||e[3]===1?`rgb(`+Math.round(e[0])+`, `+Math.round(e[1])+`, `+Math.round(e[2])+`)`:`rgba(`+Math.round(e[0])+`, `+Math.round(e[1])+`, `+Math.round(e[2])+`, `+e[3]+`)`},f.to.rgb.percent=function(...e){let t=Math.round(e[0]/255*100),n=Math.round(e[1]/255*100),r=Math.round(e[2]/255*100);return e.length<4||e[3]===1?`rgb(`+t+`%, `+n+`%, `+r+`%)`:`rgba(`+t+`%, `+n+`%, `+r+`%, `+e[3]+`)`},f.to.hsl=function(...e){return e.length<4||e[3]===1?`hsl(`+e[0]+`, `+e[1]+`%, `+e[2]+`%)`:`hsla(`+e[0]+`, `+e[1]+`%, `+e[2]+`%, `+e[3]+`)`},f.to.hwb=function(...e){let t=``;return e.length>=4&&e[3]!==1&&(t=`, `+e[3]),`hwb(`+e[0]+`, `+e[1]+`%, `+e[2]+`%`+t+`)`},f.to.keyword=function(...e){return d[e.slice(0,3)]};function p(e,t,n){return Math.min(Math.max(t,e),n)}function m(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?`0`+t:t}var h=f,g={};for(let e of Object.keys(u))g[u[e]]=e;var _={rgb:{channels:3,labels:`rgb`},hsl:{channels:3,labels:`hsl`},hsv:{channels:3,labels:`hsv`},hwb:{channels:3,labels:`hwb`},cmyk:{channels:4,labels:`cmyk`},xyz:{channels:3,labels:`xyz`},lab:{channels:3,labels:`lab`},oklab:{channels:3,labels:[`okl`,`oka`,`okb`]},lch:{channels:3,labels:`lch`},oklch:{channels:3,labels:[`okl`,`okc`,`okh`]},hex:{channels:1,labels:[`hex`]},keyword:{channels:1,labels:[`keyword`]},ansi16:{channels:1,labels:[`ansi16`]},ansi256:{channels:1,labels:[`ansi256`]},hcg:{channels:3,labels:[`h`,`c`,`g`]},apple:{channels:3,labels:[`r16`,`g16`,`b16`]},gray:{channels:1,labels:[`gray`]}},v=_,y=(6/29)**3;function b(e){let t=e>.0031308?1.055*e**(1/2.4)-.055:e*12.92;return Math.min(Math.max(0,t),1)}function x(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(_)){if(!(`channels`in _[e]))throw Error(`missing channels property: `+e);if(!(`labels`in _[e]))throw Error(`missing channel labels property: `+e);if(_[e].labels.length!==_[e].channels)throw Error(`channel and label counts mismatch: `+e);let{channels:t,labels:n}=_[e];delete _[e].channels,delete _[e].labels,Object.defineProperty(_[e],`channels`,{value:t}),Object.defineProperty(_[e],`labels`,{value:n})}_.rgb.hsl=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s,c;switch(a){case i:s=0;break;case t:s=(n-r)/o;break;case n:s=2+(r-t)/o;break;case r:s=4+(t-n)/o;break}s=Math.min(s*60,360),s<0&&(s+=360);let l=(i+a)/2;return c=a===i?0:l<=.5?o/(a+i):o/(2-a-i),[s,c*100,l*100]},_.rgb.hsv=function(e){let t,n,r,i,a,o=e[0]/255,s=e[1]/255,c=e[2]/255,l=Math.max(o,s,c),u=l-Math.min(o,s,c),d=function(e){return(l-e)/6/u+1/2};if(u===0)i=0,a=0;else{switch(a=u/l,t=d(o),n=d(s),r=d(c),l){case o:i=r-n;break;case s:i=1/3+t-r;break;case c:i=2/3+n-t;break}i<0?i+=1:i>1&&--i}return[i*360,a*100,l*100]},_.rgb.hwb=function(e){let t=e[0],n=e[1],r=e[2],i=_.rgb.hsl(e)[0],a=1/255*Math.min(t,Math.min(n,r));return r=1-1/255*Math.max(t,Math.max(n,r)),[i,a*100,r*100]},_.rgb.oklab=function(e){let t=x(e[0]/255),n=x(e[1]/255),r=x(e[2]/255),i=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),o=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r),s=.2104542553*i+.793617785*a-.0040720468*o,c=1.9779984951*i-2.428592205*a+.4505937099*o,l=.0259040371*i+.7827717662*a-.808675766*o;return[s*100,c*100,l*100]},_.rgb.cmyk=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(1-t,1-n,1-r),a=(1-t-i)/(1-i)||0,o=(1-n-i)/(1-i)||0,s=(1-r-i)/(1-i)||0;return[a*100,o*100,s*100,i*100]};function S(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}_.rgb.keyword=function(e){let t=g[e];if(t)return t;let n=1/0,r;for(let t of Object.keys(u)){let i=u[t],a=S(e,i);a<n&&(n=a,r=t)}return r},_.keyword.rgb=function(e){return u[e]},_.rgb.xyz=function(e){let t=x(e[0]/255),n=x(e[1]/255),r=x(e[2]/255),i=t*.4124564+n*.3575761+r*.1804375,a=t*.2126729+n*.7151522+r*.072175,o=t*.0193339+n*.119192+r*.9503041;return[i*100,a*100,o*100]},_.rgb.lab=function(e){let t=_.rgb.xyz(e),n=t[0],r=t[1],i=t[2];return n/=95.047,r/=100,i/=108.883,n=n>y?n**(1/3):7.787*n+16/116,r=r>y?r**(1/3):7.787*r+16/116,i=i>y?i**(1/3):7.787*i+16/116,[116*r-16,500*(n-r),200*(r-i)]},_.hsl.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i,a;if(n===0)return a=r*255,[a,a,a];let o=r<.5?r*(1+n):r+n-r*n,s=2*r-o,c=[0,0,0];for(let e=0;e<3;e++)i=t+1/3*-(e-1),i<0&&i++,i>1&&i--,a=6*i<1?s+(o-s)*6*i:2*i<1?o:3*i<2?s+(o-s)*(2/3-i)*6:s,c[e]=a*255;return c},_.hsl.hsv=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=n,a=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,i*=a<=1?a:2-a;let o=(r+n)/2;return[t,(r===0?2*i/(a+i):2*n/(r+n))*100,o*100]},_.hsv.rgb=function(e){let t=e[0]/60,n=e[1]/100,r=e[2]/100,i=Math.floor(t)%6,a=t-Math.floor(t),o=255*r*(1-n),s=255*r*(1-n*a),c=255*r*(1-n*(1-a));switch(r*=255,i){case 0:return[r,c,o];case 1:return[s,r,o];case 2:return[o,r,c];case 3:return[o,s,r];case 4:return[c,o,r];case 5:return[r,o,s]}},_.hsv.hsl=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=Math.max(r,.01),a,o;o=(2-n)*r;let s=(2-n)*i;return a=n*i,a/=s<=1?s:2-s,a||=0,o/=2,[t,a*100,o*100]},_.hwb.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i=n+r,a;i>1&&(n/=i,r/=i);let o=Math.floor(6*t),s=1-r;a=6*t-o,o&1&&(a=1-a);let c=n+a*(s-n),l,u,d;switch(o){default:case 6:case 0:l=s,u=c,d=n;break;case 1:l=c,u=s,d=n;break;case 2:l=n,u=s,d=c;break;case 3:l=n,u=c,d=s;break;case 4:l=c,u=n,d=s;break;case 5:l=s,u=n,d=c;break}return[l*255,u*255,d*255]},_.cmyk.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=e[3]/100,a=1-Math.min(1,t*(1-i)+i),o=1-Math.min(1,n*(1-i)+i),s=1-Math.min(1,r*(1-i)+i);return[a*255,o*255,s*255]},_.xyz.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i,a,o;return i=t*3.2404542+n*-1.5371385+r*-.4985314,a=t*-.969266+n*1.8760108+r*.041556,o=t*.0556434+n*-.2040259+r*1.0572252,i=b(i),a=b(a),o=b(o),[i*255,a*255,o*255]},_.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];return t/=95.047,n/=100,r/=108.883,t=t>y?t**(1/3):7.787*t+16/116,n=n>y?n**(1/3):7.787*n+16/116,r=r>y?r**(1/3):7.787*r+16/116,[116*n-16,500*(t-n),200*(n-r)]},_.xyz.oklab=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=Math.cbrt(.8189330101*t+.3618667424*n-.1288597137*r),a=Math.cbrt(.0329845436*t+.9293118715*n+.0361456387*r),o=Math.cbrt(.0482003018*t+.2643662691*n+.633851707*r),s=.2104542553*i+.793617785*a-.0040720468*o,c=1.9779984951*i-2.428592205*a+.4505937099*o,l=.0259040371*i+.7827717662*a-.808675766*o;return[s*100,c*100,l*100]},_.oklab.oklch=function(e){return _.lab.lch(e)},_.oklab.xyz=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=(.999999998*t+.396337792*n+.215803758*r)**3,a=(1.000000008*t-.105561342*n-.063854175*r)**3,o=(1.000000055*t-.089484182*n-1.291485538*r)**3,s=1.227013851*i-.55779998*a+.281256149*o,c=-.040580178*i+1.11225687*a-.071676679*o,l=-.076381285*i-.421481978*a+1.58616322*o;return[s*100,c*100,l*100]},_.oklab.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=(t+.3963377774*n+.2158037573*r)**3,a=(t-.1055613458*n-.0638541728*r)**3,o=(t-.0894841775*n-1.291485548*r)**3,s=b(4.0767416621*i-3.3077115913*a+.2309699292*o),c=b(-1.2684380046*i+2.6097574011*a-.3413193965*o),l=b(-.0041960863*i-.7034186147*a+1.707614701*o);return[s*255,c*255,l*255]},_.oklch.oklab=function(e){return _.lch.lab(e)},_.lab.xyz=function(e){let t=e[0],n=e[1],r=e[2],i,a,o;a=(t+16)/116,i=n/500+a,o=a-r/200;let s=a**3,c=i**3,l=o**3;return a=s>y?s:(a-16/116)/7.787,i=c>y?c:(i-16/116)/7.787,o=l>y?l:(o-16/116)/7.787,i*=95.047,a*=100,o*=108.883,[i,a,o]},_.lab.lch=function(e){let t=e[0],n=e[1],r=e[2],i;return i=Math.atan2(r,n)*360/2/Math.PI,i<0&&(i+=360),[t,Math.sqrt(n*n+r*r),i]},_.lch.lab=function(e){let t=e[0],n=e[1],r=e[2]/360*2*Math.PI;return[t,n*Math.cos(r),n*Math.sin(r)]},_.rgb.ansi16=function(e,t=null){let[n,r,i]=e,a=t===null?_.rgb.hsv(e)[2]:t;if(a=Math.round(a/50),a===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return a===2&&(o+=60),o},_.hsv.ansi16=function(e){return _.rgb.ansi16(_.hsv.rgb(e),e[2])},_.rgb.ansi256=function(e){let t=e[0],n=e[1],r=e[2];return t>>4==n>>4&&n>>4==r>>4?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},_.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let n=(Math.trunc(e>50)+1)*.5;return[(t&1)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},_.ansi256.rgb=function(e){if(e=e[0],e>=232){let t=(e-232)*10+8;return[t,t,t]}e-=16;let t;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},_.rgb.hex=function(e){let t=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return`000000`.slice(t.length)+t},_.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let n=t[0];t[0].length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},_.rgb.hcg=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.max(Math.max(t,n),r),a=Math.min(Math.min(t,n),r),o=i-a,s,c=o<1?a/(1-o):0;return s=o<=0?0:i===t?(n-r)/o%6:i===n?2+(r-t)/o:4+(t-n)/o,s/=6,s%=1,[s*360,o*100,c*100]},_.hsl.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=n<.5?2*t*n:2*t*(1-n),i=0;return r<1&&(i=(n-.5*r)/(1-r)),[e[0],r*100,i*100]},_.hsv.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=t*n,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},_.hcg.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100;if(n===0)return[r*255,r*255,r*255];let i=[0,0,0],a=t%1*6,o=a%1,s=1-o,c=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return c=(1-n)*r,[(n*i[0]+c)*255,(n*i[1]+c)*255,(n*i[2]+c)*255]},_.hcg.hsv=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t),r=0;return n>0&&(r=t/n),[e[0],r*100,n*100]},_.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+.5*t,r=0;return n>0&&n<.5?r=t/(2*n):n>=.5&&n<1&&(r=t/(2*(1-n))),[e[0],r*100,n*100]},_.hcg.hwb=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],(n-t)*100,(1-n)*100]},_.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,r=n-t,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},_.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},_.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},_.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},_.gray.hsl=function(e){return[0,0,e[0]]},_.gray.hsv=_.gray.hsl,_.gray.hwb=function(e){return[0,100,e[0]]},_.gray.cmyk=function(e){return[0,0,0,e[0]]},_.gray.lab=function(e){return[e[0],0,0]},_.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return`000000`.slice(n.length)+n},_.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function C(){let e={},t=Object.keys(v);for(let{length:n}=t,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}function w(e){let t=C(),n=[e];for(t[e].distance=0;n.length>0;){let e=n.pop(),r=Object.keys(v[e]);for(let{length:i}=r,a=0;a<i;a++){let i=r[a],o=t[i];o.distance===-1&&(o.distance=t[e].distance+1,o.parent=e,n.unshift(i))}}return t}function ee(e,t){return function(n){return t(e(n))}}function te(e,t){let n=[t[e].parent,e],r=v[t[e].parent][e],i=t[e].parent;for(;t[i].parent;)n.unshift(t[i].parent),r=ee(v[t[i].parent][i],r),i=t[i].parent;return r.conversion=n,r}function T(e){let t=w(e),n={},r=Object.keys(t);for(let{length:e}=r,i=0;i<e;i++){let e=r[i];t[e].parent!==null&&(n[e]=te(e,t))}return n}var ne=T,re={},ie=Object.keys(v);function ae(e){let t=function(...t){let n=t[0];return n==null?n:(n.length>1&&(t=n),e(t))};return`conversion`in e&&(t.conversion=e.conversion),t}function oe(e){let t=function(...t){let n=t[0];if(n==null)return n;n.length>1&&(t=n);let r=e(t);if(typeof r==`object`)for(let{length:e}=r,t=0;t<e;t++)r[t]=Math.round(r[t]);return r};return`conversion`in e&&(t.conversion=e.conversion),t}for(let e of ie){re[e]={},Object.defineProperty(re[e],`channels`,{value:v[e].channels}),Object.defineProperty(re[e],`labels`,{value:v[e].labels});let t=ne(e),n=Object.keys(t);for(let r of n){let n=t[r];re[e][r]=oe(n),re[e][r].raw=ae(n)}}var se=re,E=[`keyword`,`gray`,`hex`],D={};for(let e of Object.keys(se))D[[...se[e].labels].sort().join(``)]=e;var ce={};function O(e,t){if(!(this instanceof O))return new O(e,t);if(t&&t in E&&(t=null),t&&!(t in se))throw Error(`Unknown model: `+t);let n,r;if(e==null)this.model=`rgb`,this.color=[0,0,0],this.valpha=1;else if(e instanceof O)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e==`string`){let t=h.get(e);if(t===null)throw Error(`Unable to parse color from string: `+e);this.model=t.model,r=se[this.model].channels,this.color=t.value.slice(0,r),this.valpha=typeof t.value[r]==`number`?t.value[r]:1}else if(e.length>0)this.model=t||`rgb`,r=se[this.model].channels,this.color=fe(Array.prototype.slice.call(e,0,r),r),this.valpha=typeof e[r]==`number`?e[r]:1;else if(typeof e==`number`)this.model=`rgb`,this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let t=Object.keys(e);`alpha`in e&&(t.splice(t.indexOf(`alpha`),1),this.valpha=typeof e.alpha==`number`?e.alpha:0);let r=t.sort().join(``);if(!(r in D))throw Error(`Unable to parse color from object: `+JSON.stringify(e));this.model=D[r];let{labels:i}=se[this.model],a=[];for(n=0;n<i.length;n++)a.push(e[i[n]]);this.color=fe(a)}if(ce[this.model])for(r=se[this.model].channels,n=0;n<r;n++){let e=ce[this.model][n];e&&(this.color[n]=e(this.color[n]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}O.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in h.to?this:this.rgb();t=t.round(typeof e==`number`?e:1);let n=t.valpha===1?t.color:[...t.color,this.valpha];return h.to[t.model](...n)},percentString(e){let t=this.rgb().round(typeof e==`number`?e:1),n=t.valpha===1?t.color:[...t.color,this.valpha];return h.to.rgb.percent(...n)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=se[this.model],{labels:n}=se[this.model];for(let r=0;r<t;r++)e[n[r]]=this.color[r];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){let e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){let e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new O([...this.color.map(ue(e)),this.valpha],this.model)},alpha(e){return e===void 0?this.valpha:new O([...this.color,Math.max(0,Math.min(1,e))],this.model)},red:k(`rgb`,0,A(255)),green:k(`rgb`,1,A(255)),blue:k(`rgb`,2,A(255)),hue:k([`hsl`,`hsv`,`hsl`,`hwb`,`hcg`],0,e=>(e%360+360)%360),saturationl:k(`hsl`,1,A(100)),lightness:k(`hsl`,2,A(100)),saturationv:k(`hsv`,1,A(100)),value:k(`hsv`,2,A(100)),chroma:k(`hcg`,1,A(100)),gray:k(`hcg`,2,A(100)),white:k(`hwb`,1,A(100)),wblack:k(`hwb`,2,A(100)),cyan:k(`cmyk`,0,A(100)),magenta:k(`cmyk`,1,A(100)),yellow:k(`cmyk`,2,A(100)),black:k(`cmyk`,3,A(100)),x:k(`xyz`,0,A(95.047)),y:k(`xyz`,1,A(100)),z:k(`xyz`,2,A(108.833)),l:k(`lab`,0,A(100)),a:k(`lab`,1),b:k(`lab`,2),keyword(e){return e===void 0?se[this.model].keyword(this.color):new O(e)},hex(e){return e===void 0?h.to.hex(...this.rgb().round().color):new O(e)},hexa(e){if(e!==void 0)return new O(e);let t=this.rgb().round().color,n=Math.round(this.valpha*255).toString(16).toUpperCase();return n.length===1&&(n=`0`+n),h.to.hex(...t)+n},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,t=[];for(let[n,r]of e.entries()){let e=r/255;t[n]=e<=.04045?e/12.92:((e+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){let t=this.luminosity(),n=e.luminosity();return t>n?(t+.05)/(n+.05):(n+.05)/(t+.05)},level(e){let t=this.contrast(e);return t>=7?`AAA`:t>=4.5?`AA`:``},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){let t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){let t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){let t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){let t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){let t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){let t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){let e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return O.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let t=this.hsl(),n=t.color[0];return n=(n+e)%360,n=n<0?360+n:n,t.color[0]=n,t},mix(e,t){if(!e||!e.rgb)throw Error(`Argument to "mix" was not a Color instance, but rather an instance of `+typeof e);let n=e.rgb(),r=this.rgb(),i=t===void 0?.5:t,a=2*i-1,o=n.alpha()-r.alpha(),s=((a*o===-1?a:(a+o)/(1+a*o))+1)/2,c=1-s;return O.rgb(s*n.red()+c*r.red(),s*n.green()+c*r.green(),s*n.blue()+c*r.blue(),n.alpha()*i+r.alpha()*(1-i))}};for(let e of Object.keys(se)){if(E.includes(e))continue;let{channels:t}=se[e];O.prototype[e]=function(...t){return this.model===e?new O(this):t.length>0?new O(t,e):new O([...de(se[this.model][e].raw(this.color)),this.valpha],e)},O[e]=function(...n){let r=n[0];return typeof r==`number`&&(r=fe(n,t)),new O(r,e)}}function le(e,t){return Number(e.toFixed(t))}function ue(e){return function(t){return le(t,e)}}function k(e,t,n){e=Array.isArray(e)?e:[e];for(let r of e)(ce[r]||=[])[t]=n;return e=e[0],function(r){let i;return r===void 0?(i=this[e]().color[t],n&&(i=n(i)),i):(n&&(r=n(r)),i=this[e](),i.color[t]=r,i)}}function A(e){return function(t){return Math.max(0,Math.min(e,t))}}function de(e){return Array.isArray(e)?e:[e]}function fe(e,t){for(let n=0;n<t;n++)typeof e[n]!=`number`&&(e[n]=0);return e}var pe=O})),za=M(((e,t)=>{t.exports=Ra().default})),Ba=M(((e,t)=>{
111
+ let n=ws(),r={integer:`integer`,float:`float`,approximate:`approximate`};function i(e,t){if(!n.defined(e))return this.autoOrient();if((this.options.angle||this.options.rotationAngle)&&(this.options.debuglog(`ignoring previous rotate options`),this.options.angle=0,this.options.rotationAngle=0),n.integer(e)&&!(e%90))this.options.angle=e;else if(n.number(e))this.options.rotationAngle=e,n.object(t)&&t.background&&this._setBackgroundColourOption(`rotationBackground`,t.background);else throw n.invalidParameterError(`angle`,`numeric`,e);return this}function a(){return this.options.input.autoOrient=!0,this}function o(e){return this.options.flip=n.bool(e)?e:!0,this}function s(e){return this.options.flop=n.bool(e)?e:!0,this}function c(e,t){let r=[].concat(...e);if(r.length===4&&r.every(n.number))this.options.affineMatrix=r;else throw n.invalidParameterError(`matrix`,`1x4 or 2x2 array`,e);if(n.defined(t))if(n.object(t)){if(this._setBackgroundColourOption(`affineBackground`,t.background),n.defined(t.idx))if(n.number(t.idx))this.options.affineIdx=t.idx;else throw n.invalidParameterError(`options.idx`,`number`,t.idx);if(n.defined(t.idy))if(n.number(t.idy))this.options.affineIdy=t.idy;else throw n.invalidParameterError(`options.idy`,`number`,t.idy);if(n.defined(t.odx))if(n.number(t.odx))this.options.affineOdx=t.odx;else throw n.invalidParameterError(`options.odx`,`number`,t.odx);if(n.defined(t.ody))if(n.number(t.ody))this.options.affineOdy=t.ody;else throw n.invalidParameterError(`options.ody`,`number`,t.ody);if(n.defined(t.interpolator))if(n.inArray(t.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=t.interpolator;else throw n.invalidParameterError(`options.interpolator`,`valid interpolator name`,t.interpolator)}else throw n.invalidParameterError(`options`,`object`,t);return this}function l(e,t,r){if(!n.defined(e))this.options.sharpenSigma=-1;else if(n.bool(e))this.options.sharpenSigma=e?-1:0;else if(n.number(e)&&n.inRange(e,.01,1e4)){if(this.options.sharpenSigma=e,n.defined(t))if(n.number(t)&&n.inRange(t,0,1e4))this.options.sharpenM1=t;else throw n.invalidParameterError(`flat`,`number between 0 and 10000`,t);if(n.defined(r))if(n.number(r)&&n.inRange(r,0,1e4))this.options.sharpenM2=r;else throw n.invalidParameterError(`jagged`,`number between 0 and 10000`,r)}else if(n.plainObject(e)){if(n.number(e.sigma)&&n.inRange(e.sigma,1e-6,10))this.options.sharpenSigma=e.sigma;else throw n.invalidParameterError(`options.sigma`,`number between 0.000001 and 10`,e.sigma);if(n.defined(e.m1))if(n.number(e.m1)&&n.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw n.invalidParameterError(`options.m1`,`number between 0 and 1000000`,e.m1);if(n.defined(e.m2))if(n.number(e.m2)&&n.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw n.invalidParameterError(`options.m2`,`number between 0 and 1000000`,e.m2);if(n.defined(e.x1))if(n.number(e.x1)&&n.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw n.invalidParameterError(`options.x1`,`number between 0 and 1000000`,e.x1);if(n.defined(e.y2))if(n.number(e.y2)&&n.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw n.invalidParameterError(`options.y2`,`number between 0 and 1000000`,e.y2);if(n.defined(e.y3))if(n.number(e.y3)&&n.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw n.invalidParameterError(`options.y3`,`number between 0 and 1000000`,e.y3)}else throw n.invalidParameterError(`sigma`,`number between 0.01 and 10000`,e);return this}function u(e){if(!n.defined(e))this.options.medianSize=3;else if(n.integer(e)&&n.inRange(e,1,1e3))this.options.medianSize=e;else throw n.invalidParameterError(`size`,`integer between 1 and 1000`,e);return this}function d(e){let t;if(n.number(e))t=e;else if(n.plainObject(e)){if(!n.number(e.sigma))throw n.invalidParameterError(`options.sigma`,`number between 0.3 and 1000`,t);if(t=e.sigma,`precision`in e)if(n.string(r[e.precision]))this.options.precision=r[e.precision];else throw n.invalidParameterError(`precision`,`one of: integer, float, approximate`,e.precision);if(`minAmplitude`in e)if(n.number(e.minAmplitude)&&n.inRange(e.minAmplitude,.001,1))this.options.minAmpl=e.minAmplitude;else throw n.invalidParameterError(`minAmplitude`,`number between 0.001 and 1`,e.minAmplitude)}if(!n.defined(e))this.options.blurSigma=-1;else if(n.bool(e))this.options.blurSigma=e?-1:0;else if(n.number(t)&&n.inRange(t,.3,1e3))this.options.blurSigma=t;else throw n.invalidParameterError(`sigma`,`number between 0.3 and 1000`,t);return this}function f(e){if(!n.defined(e))this.options.dilateWidth=1;else if(n.integer(e)&&e>0)this.options.dilateWidth=e;else throw n.invalidParameterError(`dilate`,`positive integer`,f);return this}function p(e){if(!n.defined(e))this.options.erodeWidth=1;else if(n.integer(e)&&e>0)this.options.erodeWidth=e;else throw n.invalidParameterError(`erode`,`positive integer`,p);return this}function m(e){return this.options.flatten=n.bool(e)?e:!0,n.object(e)&&this._setBackgroundColourOption(`flattenBackground`,e.background),this}function h(){return this.options.unflatten=!0,this}function g(e,t){if(!n.defined(e))this.options.gamma=2.2;else if(n.number(e)&&n.inRange(e,1,3))this.options.gamma=e;else throw n.invalidParameterError(`gamma`,`number between 1.0 and 3.0`,e);if(!n.defined(t))this.options.gammaOut=this.options.gamma;else if(n.number(t)&&n.inRange(t,1,3))this.options.gammaOut=t;else throw n.invalidParameterError(`gammaOut`,`number between 1.0 and 3.0`,t);return this}function _(e){if(this.options.negate=n.bool(e)?e:!0,n.plainObject(e)&&`alpha`in e)if(n.bool(e.alpha))this.options.negateAlpha=e.alpha;else throw n.invalidParameterError(`alpha`,`should be boolean value`,e.alpha);return this}function v(e){if(n.plainObject(e)){if(n.defined(e.lower))if(n.number(e.lower)&&n.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw n.invalidParameterError(`lower`,`number between 0 and 99`,e.lower);if(n.defined(e.upper))if(n.number(e.upper)&&n.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw n.invalidParameterError(`upper`,`number between 1 and 100`,e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw n.invalidParameterError(`range`,`lower to be less than upper`,`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function y(e){return this.normalise(e)}function b(e){if(n.plainObject(e)){if(n.integer(e.width)&&e.width>0)this.options.claheWidth=e.width;else throw n.invalidParameterError(`width`,`integer greater than zero`,e.width);if(n.integer(e.height)&&e.height>0)this.options.claheHeight=e.height;else throw n.invalidParameterError(`height`,`integer greater than zero`,e.height);if(n.defined(e.maxSlope))if(n.integer(e.maxSlope)&&n.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw n.invalidParameterError(`maxSlope`,`integer between 0 and 100`,e.maxSlope)}else throw n.invalidParameterError(`options`,`plain object`,e);return this}function x(e){if(!n.object(e)||!Array.isArray(e.kernel)||!n.integer(e.width)||!n.integer(e.height)||!n.inRange(e.width,3,1001)||!n.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length)throw Error(`Invalid convolution kernel`);return n.integer(e.scale)||(e.scale=e.kernel.reduce((e,t)=>e+t,0)),e.scale<1&&(e.scale=1),n.integer(e.offset)||(e.offset=0),this.options.convKernel=e,this}function S(e,t){if(!n.defined(e))this.options.threshold=128;else if(n.bool(e))this.options.threshold=e?128:0;else if(n.integer(e)&&n.inRange(e,0,255))this.options.threshold=e;else throw n.invalidParameterError(`threshold`,`integer between 0 and 255`,e);return!n.object(t)||t.greyscale===!0||t.grayscale===!0?this.options.thresholdGrayscale=!0:this.options.thresholdGrayscale=!1,this}function C(e,t,r){if(this.options.boolean=this._createInputDescriptor(e,r),n.string(t)&&n.inArray(t,[`and`,`or`,`eor`]))this.options.booleanOp=t;else throw n.invalidParameterError(`operator`,`one of: and, or, eor`,t);return this}function w(e,t){if(!n.defined(e)&&n.number(t)?e=1:n.number(e)&&!n.defined(t)&&(t=0),!n.defined(e))this.options.linearA=[];else if(n.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&e.length&&e.every(n.number))this.options.linearA=e;else throw n.invalidParameterError(`a`,`number or array of numbers`,e);if(!n.defined(t))this.options.linearB=[];else if(n.number(t))this.options.linearB=[t];else if(Array.isArray(t)&&t.length&&t.every(n.number))this.options.linearB=t;else throw n.invalidParameterError(`b`,`number or array of numbers`,t);if(this.options.linearA.length!==this.options.linearB.length)throw Error(`Expected a and b to be arrays of the same length`);return this}function ee(e){if(!Array.isArray(e))throw n.invalidParameterError(`inputMatrix`,`array`,e);if(e.length!==3&&e.length!==4)throw n.invalidParameterError(`inputMatrix`,`3x3 or 4x4 array`,e.length);let t=e.flat().map(Number);if(t.length!==9&&t.length!==16)throw n.invalidParameterError(`inputMatrix`,`cardinality of 9 or 16`,t.length);return this.options.recombMatrix=t,this}function te(e){if(!n.plainObject(e))throw n.invalidParameterError(`options`,`plain object`,e);if(`brightness`in e)if(n.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw n.invalidParameterError(`brightness`,`number above zero`,e.brightness);if(`saturation`in e)if(n.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw n.invalidParameterError(`saturation`,`number above zero`,e.saturation);if(`hue`in e)if(n.integer(e.hue))this.options.hue=e.hue%360;else throw n.invalidParameterError(`hue`,`number`,e.hue);if(`lightness`in e)if(n.number(e.lightness))this.options.lightness=e.lightness;else throw n.invalidParameterError(`lightness`,`number`,e.lightness);return this}t.exports=e=>{Object.assign(e.prototype,{autoOrient:a,rotate:i,flip:o,flop:s,affine:c,sharpen:l,erode:p,dilate:f,median:u,blur:d,flatten:m,unflatten:h,gamma:g,negate:_,normalise:v,normalize:y,clahe:b,convolve:x,threshold:S,boolean:C,linear:w,recomb:ee,modulate:te})}})),rc=A(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{default:()=>me}),t.exports=c(l);var u={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},d=Object.create(null);for(let e in u)Object.hasOwn(u,e)&&(d[u[e]]=e);var f={to:{},get:{}};f.get=function(e){let t=e.slice(0,3).toLowerCase(),n,r;switch(t){case`hsl`:n=f.get.hsl(e),r=`hsl`;break;case`hwb`:n=f.get.hwb(e),r=`hwb`;break;default:n=f.get.rgb(e),r=`rgb`;break}return n?{model:r,value:n}:null},f.get.rgb=function(e){if(!e)return null;let t=/^#([a-f\d]{3,4})$/i,n=/^#([a-f\d]{6})([a-f\d]{2})?$/i,r=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,i=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,a=/^(\w+)$/,o=[0,0,0,1],s,c,l;if(s=e.match(n)){for(l=s[2],s=s[1],c=0;c<3;c++){let e=c*2;o[c]=Number.parseInt(s.slice(e,e+2),16)}l&&(o[3]=Number.parseInt(l,16)/255)}else if(s=e.match(t)){for(s=s[1],l=s[3],c=0;c<3;c++)o[c]=Number.parseInt(s[c]+s[c],16);l&&(o[3]=Number.parseInt(l+l,16)/255)}else if(s=e.match(r)){for(c=0;c<3;c++)o[c]=Number.parseInt(s[c+1],10);s[4]&&(o[3]=s[5]?Number.parseFloat(s[4])*.01:Number.parseFloat(s[4]))}else if(s=e.match(i)){for(c=0;c<3;c++)o[c]=Math.round(Number.parseFloat(s[c+1])*2.55);s[4]&&(o[3]=s[5]?Number.parseFloat(s[4])*.01:Number.parseFloat(s[4]))}else if(s=e.match(a))return s[1]===`transparent`?[0,0,0,0]:Object.hasOwn(u,s[1])?(o=u[s[1]],o[3]=1,o):null;else return null;for(c=0;c<3;c++)o[c]=p(o[c],0,255);return o[3]=p(o[3],0,1),o},f.get.hsl=function(e){if(!e)return null;let t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){let e=Number.parseFloat(t[4]);return[(Number.parseFloat(t[1])%360+360)%360,p(Number.parseFloat(t[2]),0,100),p(Number.parseFloat(t[3]),0,100),p(Number.isNaN(e)?1:e,0,1)]}return null},f.get.hwb=function(e){if(!e)return null;let t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){let e=Number.parseFloat(t[4]);return[(Number.parseFloat(t[1])%360+360)%360,p(Number.parseFloat(t[2]),0,100),p(Number.parseFloat(t[3]),0,100),p(Number.isNaN(e)?1:e,0,1)]}return null},f.to.hex=function(...e){return`#`+m(e[0])+m(e[1])+m(e[2])+(e[3]<1?m(Math.round(e[3]*255)):``)},f.to.rgb=function(...e){return e.length<4||e[3]===1?`rgb(`+Math.round(e[0])+`, `+Math.round(e[1])+`, `+Math.round(e[2])+`)`:`rgba(`+Math.round(e[0])+`, `+Math.round(e[1])+`, `+Math.round(e[2])+`, `+e[3]+`)`},f.to.rgb.percent=function(...e){let t=Math.round(e[0]/255*100),n=Math.round(e[1]/255*100),r=Math.round(e[2]/255*100);return e.length<4||e[3]===1?`rgb(`+t+`%, `+n+`%, `+r+`%)`:`rgba(`+t+`%, `+n+`%, `+r+`%, `+e[3]+`)`},f.to.hsl=function(...e){return e.length<4||e[3]===1?`hsl(`+e[0]+`, `+e[1]+`%, `+e[2]+`%)`:`hsla(`+e[0]+`, `+e[1]+`%, `+e[2]+`%, `+e[3]+`)`},f.to.hwb=function(...e){let t=``;return e.length>=4&&e[3]!==1&&(t=`, `+e[3]),`hwb(`+e[0]+`, `+e[1]+`%, `+e[2]+`%`+t+`)`},f.to.keyword=function(...e){return d[e.slice(0,3)]};function p(e,t,n){return Math.min(Math.max(t,e),n)}function m(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?`0`+t:t}var h=f,g={};for(let e of Object.keys(u))g[u[e]]=e;var _={rgb:{channels:3,labels:`rgb`},hsl:{channels:3,labels:`hsl`},hsv:{channels:3,labels:`hsv`},hwb:{channels:3,labels:`hwb`},cmyk:{channels:4,labels:`cmyk`},xyz:{channels:3,labels:`xyz`},lab:{channels:3,labels:`lab`},oklab:{channels:3,labels:[`okl`,`oka`,`okb`]},lch:{channels:3,labels:`lch`},oklch:{channels:3,labels:[`okl`,`okc`,`okh`]},hex:{channels:1,labels:[`hex`]},keyword:{channels:1,labels:[`keyword`]},ansi16:{channels:1,labels:[`ansi16`]},ansi256:{channels:1,labels:[`ansi256`]},hcg:{channels:3,labels:[`h`,`c`,`g`]},apple:{channels:3,labels:[`r16`,`g16`,`b16`]},gray:{channels:1,labels:[`gray`]}},v=_,y=(6/29)**3;function b(e){let t=e>.0031308?1.055*e**(1/2.4)-.055:e*12.92;return Math.min(Math.max(0,t),1)}function x(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(_)){if(!(`channels`in _[e]))throw Error(`missing channels property: `+e);if(!(`labels`in _[e]))throw Error(`missing channel labels property: `+e);if(_[e].labels.length!==_[e].channels)throw Error(`channel and label counts mismatch: `+e);let{channels:t,labels:n}=_[e];delete _[e].channels,delete _[e].labels,Object.defineProperty(_[e],`channels`,{value:t}),Object.defineProperty(_[e],`labels`,{value:n})}_.rgb.hsl=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s,c;switch(a){case i:s=0;break;case t:s=(n-r)/o;break;case n:s=2+(r-t)/o;break;case r:s=4+(t-n)/o;break}s=Math.min(s*60,360),s<0&&(s+=360);let l=(i+a)/2;return c=a===i?0:l<=.5?o/(a+i):o/(2-a-i),[s,c*100,l*100]},_.rgb.hsv=function(e){let t,n,r,i,a,o=e[0]/255,s=e[1]/255,c=e[2]/255,l=Math.max(o,s,c),u=l-Math.min(o,s,c),d=function(e){return(l-e)/6/u+1/2};if(u===0)i=0,a=0;else{switch(a=u/l,t=d(o),n=d(s),r=d(c),l){case o:i=r-n;break;case s:i=1/3+t-r;break;case c:i=2/3+n-t;break}i<0?i+=1:i>1&&--i}return[i*360,a*100,l*100]},_.rgb.hwb=function(e){let t=e[0],n=e[1],r=e[2],i=_.rgb.hsl(e)[0],a=1/255*Math.min(t,Math.min(n,r));return r=1-1/255*Math.max(t,Math.max(n,r)),[i,a*100,r*100]},_.rgb.oklab=function(e){let t=x(e[0]/255),n=x(e[1]/255),r=x(e[2]/255),i=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),o=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r),s=.2104542553*i+.793617785*a-.0040720468*o,c=1.9779984951*i-2.428592205*a+.4505937099*o,l=.0259040371*i+.7827717662*a-.808675766*o;return[s*100,c*100,l*100]},_.rgb.cmyk=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(1-t,1-n,1-r),a=(1-t-i)/(1-i)||0,o=(1-n-i)/(1-i)||0,s=(1-r-i)/(1-i)||0;return[a*100,o*100,s*100,i*100]};function S(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}_.rgb.keyword=function(e){let t=g[e];if(t)return t;let n=1/0,r;for(let t of Object.keys(u)){let i=u[t],a=S(e,i);a<n&&(n=a,r=t)}return r},_.keyword.rgb=function(e){return u[e]},_.rgb.xyz=function(e){let t=x(e[0]/255),n=x(e[1]/255),r=x(e[2]/255),i=t*.4124564+n*.3575761+r*.1804375,a=t*.2126729+n*.7151522+r*.072175,o=t*.0193339+n*.119192+r*.9503041;return[i*100,a*100,o*100]},_.rgb.lab=function(e){let t=_.rgb.xyz(e),n=t[0],r=t[1],i=t[2];return n/=95.047,r/=100,i/=108.883,n=n>y?n**(1/3):7.787*n+16/116,r=r>y?r**(1/3):7.787*r+16/116,i=i>y?i**(1/3):7.787*i+16/116,[116*r-16,500*(n-r),200*(r-i)]},_.hsl.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i,a;if(n===0)return a=r*255,[a,a,a];let o=r<.5?r*(1+n):r+n-r*n,s=2*r-o,c=[0,0,0];for(let e=0;e<3;e++)i=t+1/3*-(e-1),i<0&&i++,i>1&&i--,a=6*i<1?s+(o-s)*6*i:2*i<1?o:3*i<2?s+(o-s)*(2/3-i)*6:s,c[e]=a*255;return c},_.hsl.hsv=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=n,a=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,i*=a<=1?a:2-a;let o=(r+n)/2;return[t,(r===0?2*i/(a+i):2*n/(r+n))*100,o*100]},_.hsv.rgb=function(e){let t=e[0]/60,n=e[1]/100,r=e[2]/100,i=Math.floor(t)%6,a=t-Math.floor(t),o=255*r*(1-n),s=255*r*(1-n*a),c=255*r*(1-n*(1-a));switch(r*=255,i){case 0:return[r,c,o];case 1:return[s,r,o];case 2:return[o,r,c];case 3:return[o,s,r];case 4:return[c,o,r];case 5:return[r,o,s]}},_.hsv.hsl=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=Math.max(r,.01),a,o;o=(2-n)*r;let s=(2-n)*i;return a=n*i,a/=s<=1?s:2-s,a||=0,o/=2,[t,a*100,o*100]},_.hwb.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i=n+r,a;i>1&&(n/=i,r/=i);let o=Math.floor(6*t),s=1-r;a=6*t-o,o&1&&(a=1-a);let c=n+a*(s-n),l,u,d;switch(o){default:case 6:case 0:l=s,u=c,d=n;break;case 1:l=c,u=s,d=n;break;case 2:l=n,u=s,d=c;break;case 3:l=n,u=c,d=s;break;case 4:l=c,u=n,d=s;break;case 5:l=s,u=n,d=c;break}return[l*255,u*255,d*255]},_.cmyk.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=e[3]/100,a=1-Math.min(1,t*(1-i)+i),o=1-Math.min(1,n*(1-i)+i),s=1-Math.min(1,r*(1-i)+i);return[a*255,o*255,s*255]},_.xyz.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i,a,o;return i=t*3.2404542+n*-1.5371385+r*-.4985314,a=t*-.969266+n*1.8760108+r*.041556,o=t*.0556434+n*-.2040259+r*1.0572252,i=b(i),a=b(a),o=b(o),[i*255,a*255,o*255]},_.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];return t/=95.047,n/=100,r/=108.883,t=t>y?t**(1/3):7.787*t+16/116,n=n>y?n**(1/3):7.787*n+16/116,r=r>y?r**(1/3):7.787*r+16/116,[116*n-16,500*(t-n),200*(n-r)]},_.xyz.oklab=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=Math.cbrt(.8189330101*t+.3618667424*n-.1288597137*r),a=Math.cbrt(.0329845436*t+.9293118715*n+.0361456387*r),o=Math.cbrt(.0482003018*t+.2643662691*n+.633851707*r),s=.2104542553*i+.793617785*a-.0040720468*o,c=1.9779984951*i-2.428592205*a+.4505937099*o,l=.0259040371*i+.7827717662*a-.808675766*o;return[s*100,c*100,l*100]},_.oklab.oklch=function(e){return _.lab.lch(e)},_.oklab.xyz=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=(.999999998*t+.396337792*n+.215803758*r)**3,a=(1.000000008*t-.105561342*n-.063854175*r)**3,o=(1.000000055*t-.089484182*n-1.291485538*r)**3,s=1.227013851*i-.55779998*a+.281256149*o,c=-.040580178*i+1.11225687*a-.071676679*o,l=-.076381285*i-.421481978*a+1.58616322*o;return[s*100,c*100,l*100]},_.oklab.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=(t+.3963377774*n+.2158037573*r)**3,a=(t-.1055613458*n-.0638541728*r)**3,o=(t-.0894841775*n-1.291485548*r)**3,s=b(4.0767416621*i-3.3077115913*a+.2309699292*o),c=b(-1.2684380046*i+2.6097574011*a-.3413193965*o),l=b(-.0041960863*i-.7034186147*a+1.707614701*o);return[s*255,c*255,l*255]},_.oklch.oklab=function(e){return _.lch.lab(e)},_.lab.xyz=function(e){let t=e[0],n=e[1],r=e[2],i,a,o;a=(t+16)/116,i=n/500+a,o=a-r/200;let s=a**3,c=i**3,l=o**3;return a=s>y?s:(a-16/116)/7.787,i=c>y?c:(i-16/116)/7.787,o=l>y?l:(o-16/116)/7.787,i*=95.047,a*=100,o*=108.883,[i,a,o]},_.lab.lch=function(e){let t=e[0],n=e[1],r=e[2],i;return i=Math.atan2(r,n)*360/2/Math.PI,i<0&&(i+=360),[t,Math.sqrt(n*n+r*r),i]},_.lch.lab=function(e){let t=e[0],n=e[1],r=e[2]/360*2*Math.PI;return[t,n*Math.cos(r),n*Math.sin(r)]},_.rgb.ansi16=function(e,t=null){let[n,r,i]=e,a=t===null?_.rgb.hsv(e)[2]:t;if(a=Math.round(a/50),a===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return a===2&&(o+=60),o},_.hsv.ansi16=function(e){return _.rgb.ansi16(_.hsv.rgb(e),e[2])},_.rgb.ansi256=function(e){let t=e[0],n=e[1],r=e[2];return t>>4==n>>4&&n>>4==r>>4?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},_.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let n=(Math.trunc(e>50)+1)*.5;return[(t&1)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},_.ansi256.rgb=function(e){if(e=e[0],e>=232){let t=(e-232)*10+8;return[t,t,t]}e-=16;let t;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},_.rgb.hex=function(e){let t=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return`000000`.slice(t.length)+t},_.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let n=t[0];t[0].length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},_.rgb.hcg=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.max(Math.max(t,n),r),a=Math.min(Math.min(t,n),r),o=i-a,s,c=o<1?a/(1-o):0;return s=o<=0?0:i===t?(n-r)/o%6:i===n?2+(r-t)/o:4+(t-n)/o,s/=6,s%=1,[s*360,o*100,c*100]},_.hsl.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=n<.5?2*t*n:2*t*(1-n),i=0;return r<1&&(i=(n-.5*r)/(1-r)),[e[0],r*100,i*100]},_.hsv.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=t*n,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},_.hcg.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100;if(n===0)return[r*255,r*255,r*255];let i=[0,0,0],a=t%1*6,o=a%1,s=1-o,c=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return c=(1-n)*r,[(n*i[0]+c)*255,(n*i[1]+c)*255,(n*i[2]+c)*255]},_.hcg.hsv=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t),r=0;return n>0&&(r=t/n),[e[0],r*100,n*100]},_.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+.5*t,r=0;return n>0&&n<.5?r=t/(2*n):n>=.5&&n<1&&(r=t/(2*(1-n))),[e[0],r*100,n*100]},_.hcg.hwb=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],(n-t)*100,(1-n)*100]},_.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,r=n-t,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},_.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},_.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},_.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},_.gray.hsl=function(e){return[0,0,e[0]]},_.gray.hsv=_.gray.hsl,_.gray.hwb=function(e){return[0,100,e[0]]},_.gray.cmyk=function(e){return[0,0,0,e[0]]},_.gray.lab=function(e){return[e[0],0,0]},_.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return`000000`.slice(n.length)+n},_.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function C(){let e={},t=Object.keys(v);for(let{length:n}=t,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}function w(e){let t=C(),n=[e];for(t[e].distance=0;n.length>0;){let e=n.pop(),r=Object.keys(v[e]);for(let{length:i}=r,a=0;a<i;a++){let i=r[a],o=t[i];o.distance===-1&&(o.distance=t[e].distance+1,o.parent=e,n.unshift(i))}}return t}function ee(e,t){return function(n){return t(e(n))}}function te(e,t){let n=[t[e].parent,e],r=v[t[e].parent][e],i=t[e].parent;for(;t[i].parent;)n.unshift(t[i].parent),r=ee(v[t[i].parent][i],r),i=t[i].parent;return r.conversion=n,r}function T(e){let t=w(e),n={},r=Object.keys(t);for(let{length:e}=r,i=0;i<e;i++){let e=r[i];t[e].parent!==null&&(n[e]=te(e,t))}return n}var ne=T,re={},ie=Object.keys(v);function ae(e){let t=function(...t){let n=t[0];return n==null?n:(n.length>1&&(t=n),e(t))};return`conversion`in e&&(t.conversion=e.conversion),t}function oe(e){let t=function(...t){let n=t[0];if(n==null)return n;n.length>1&&(t=n);let r=e(t);if(typeof r==`object`)for(let{length:e}=r,t=0;t<e;t++)r[t]=Math.round(r[t]);return r};return`conversion`in e&&(t.conversion=e.conversion),t}for(let e of ie){re[e]={},Object.defineProperty(re[e],`channels`,{value:v[e].channels}),Object.defineProperty(re[e],`labels`,{value:v[e].labels});let t=ne(e),n=Object.keys(t);for(let r of n){let n=t[r];re[e][r]=oe(n),re[e][r].raw=ae(n)}}var se=re,E=[`keyword`,`gray`,`hex`],D={};for(let e of Object.keys(se))D[[...se[e].labels].sort().join(``)]=e;var ce={};function O(e,t){if(!(this instanceof O))return new O(e,t);if(t&&t in E&&(t=null),t&&!(t in se))throw Error(`Unknown model: `+t);let n,r;if(e==null)this.model=`rgb`,this.color=[0,0,0],this.valpha=1;else if(e instanceof O)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e==`string`){let t=h.get(e);if(t===null)throw Error(`Unable to parse color from string: `+e);this.model=t.model,r=se[this.model].channels,this.color=t.value.slice(0,r),this.valpha=typeof t.value[r]==`number`?t.value[r]:1}else if(e.length>0)this.model=t||`rgb`,r=se[this.model].channels,this.color=pe(Array.prototype.slice.call(e,0,r),r),this.valpha=typeof e[r]==`number`?e[r]:1;else if(typeof e==`number`)this.model=`rgb`,this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let t=Object.keys(e);`alpha`in e&&(t.splice(t.indexOf(`alpha`),1),this.valpha=typeof e.alpha==`number`?e.alpha:0);let r=t.sort().join(``);if(!(r in D))throw Error(`Unable to parse color from object: `+JSON.stringify(e));this.model=D[r];let{labels:i}=se[this.model],a=[];for(n=0;n<i.length;n++)a.push(e[i[n]]);this.color=pe(a)}if(ce[this.model])for(r=se[this.model].channels,n=0;n<r;n++){let e=ce[this.model][n];e&&(this.color[n]=e(this.color[n]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}O.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in h.to?this:this.rgb();t=t.round(typeof e==`number`?e:1);let n=t.valpha===1?t.color:[...t.color,this.valpha];return h.to[t.model](...n)},percentString(e){let t=this.rgb().round(typeof e==`number`?e:1),n=t.valpha===1?t.color:[...t.color,this.valpha];return h.to.rgb.percent(...n)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=se[this.model],{labels:n}=se[this.model];for(let r=0;r<t;r++)e[n[r]]=this.color[r];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){let e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){let e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new O([...this.color.map(ue(e)),this.valpha],this.model)},alpha(e){return e===void 0?this.valpha:new O([...this.color,Math.max(0,Math.min(1,e))],this.model)},red:k(`rgb`,0,de(255)),green:k(`rgb`,1,de(255)),blue:k(`rgb`,2,de(255)),hue:k([`hsl`,`hsv`,`hsl`,`hwb`,`hcg`],0,e=>(e%360+360)%360),saturationl:k(`hsl`,1,de(100)),lightness:k(`hsl`,2,de(100)),saturationv:k(`hsv`,1,de(100)),value:k(`hsv`,2,de(100)),chroma:k(`hcg`,1,de(100)),gray:k(`hcg`,2,de(100)),white:k(`hwb`,1,de(100)),wblack:k(`hwb`,2,de(100)),cyan:k(`cmyk`,0,de(100)),magenta:k(`cmyk`,1,de(100)),yellow:k(`cmyk`,2,de(100)),black:k(`cmyk`,3,de(100)),x:k(`xyz`,0,de(95.047)),y:k(`xyz`,1,de(100)),z:k(`xyz`,2,de(108.833)),l:k(`lab`,0,de(100)),a:k(`lab`,1),b:k(`lab`,2),keyword(e){return e===void 0?se[this.model].keyword(this.color):new O(e)},hex(e){return e===void 0?h.to.hex(...this.rgb().round().color):new O(e)},hexa(e){if(e!==void 0)return new O(e);let t=this.rgb().round().color,n=Math.round(this.valpha*255).toString(16).toUpperCase();return n.length===1&&(n=`0`+n),h.to.hex(...t)+n},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,t=[];for(let[n,r]of e.entries()){let e=r/255;t[n]=e<=.04045?e/12.92:((e+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){let t=this.luminosity(),n=e.luminosity();return t>n?(t+.05)/(n+.05):(n+.05)/(t+.05)},level(e){let t=this.contrast(e);return t>=7?`AAA`:t>=4.5?`AA`:``},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){let t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){let t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){let t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){let t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){let t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){let t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){let e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return O.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let t=this.hsl(),n=t.color[0];return n=(n+e)%360,n=n<0?360+n:n,t.color[0]=n,t},mix(e,t){if(!e||!e.rgb)throw Error(`Argument to "mix" was not a Color instance, but rather an instance of `+typeof e);let n=e.rgb(),r=this.rgb(),i=t===void 0?.5:t,a=2*i-1,o=n.alpha()-r.alpha(),s=((a*o===-1?a:(a+o)/(1+a*o))+1)/2,c=1-s;return O.rgb(s*n.red()+c*r.red(),s*n.green()+c*r.green(),s*n.blue()+c*r.blue(),n.alpha()*i+r.alpha()*(1-i))}};for(let e of Object.keys(se)){if(E.includes(e))continue;let{channels:t}=se[e];O.prototype[e]=function(...t){return this.model===e?new O(this):t.length>0?new O(t,e):new O([...fe(se[this.model][e].raw(this.color)),this.valpha],e)},O[e]=function(...n){let r=n[0];return typeof r==`number`&&(r=pe(n,t)),new O(r,e)}}function le(e,t){return Number(e.toFixed(t))}function ue(e){return function(t){return le(t,e)}}function k(e,t,n){e=Array.isArray(e)?e:[e];for(let r of e)(ce[r]||=[])[t]=n;return e=e[0],function(r){let i;return r===void 0?(i=this[e]().color[t],n&&(i=n(i)),i):(n&&(r=n(r)),i=this[e](),i.color[t]=r,i)}}function de(e){return function(t){return Math.max(0,Math.min(e,t))}}function fe(e){return Array.isArray(e)?e:[e]}function pe(e,t){for(let n=0;n<t;n++)typeof e[n]!=`number`&&(e[n]=0);return e}var me=O})),ic=A(((e,t)=>{t.exports=rc().default})),ac=A(((e,t)=>{
112
112
  /*!
113
113
  Copyright 2013 Lovell Fuller and others.
114
114
  SPDX-License-Identifier: Apache-2.0
115
115
  */
116
- let n=za(),r=aa(),i={multiband:`multiband`,"b-w":`b-w`,bw:`b-w`,cmyk:`cmyk`,srgb:`srgb`};function a(e){return this._setBackgroundColourOption(`tint`,e),this}function o(e){return this.options.greyscale=r.bool(e)?e:!0,this}function s(e){return this.greyscale(e)}function c(e){if(!r.string(e))throw r.invalidParameterError(`colourspace`,`string`,e);return this.options.colourspacePipeline=e,this}function l(e){return this.pipelineColourspace(e)}function u(e){if(!r.string(e))throw r.invalidParameterError(`colourspace`,`string`,e);return this.options.colourspace=e,this}function d(e){return this.toColourspace(e)}function f(e){if(r.object(e)||r.string(e)&&e.length>=3&&e.length<=200){let t=n(e);return[t.red(),t.green(),t.blue(),Math.round(t.alpha()*255)]}else throw r.invalidParameterError(`background`,`object or string`,e)}function p(e,t){r.defined(t)&&(this.options[e]=f(t))}t.exports=e=>{Object.assign(e.prototype,{tint:a,greyscale:o,grayscale:s,pipelineColourspace:c,pipelineColorspace:l,toColourspace:u,toColorspace:d,_getBackgroundColourOption:f,_setBackgroundColourOption:p}),e.colourspace=i,e.colorspace=i}})),Va=M(((e,t)=>{
116
+ let n=ic(),r=ws(),i={multiband:`multiband`,"b-w":`b-w`,bw:`b-w`,cmyk:`cmyk`,srgb:`srgb`};function a(e){return this._setBackgroundColourOption(`tint`,e),this}function o(e){return this.options.greyscale=r.bool(e)?e:!0,this}function s(e){return this.greyscale(e)}function c(e){if(!r.string(e))throw r.invalidParameterError(`colourspace`,`string`,e);return this.options.colourspacePipeline=e,this}function l(e){return this.pipelineColourspace(e)}function u(e){if(!r.string(e))throw r.invalidParameterError(`colourspace`,`string`,e);return this.options.colourspace=e,this}function d(e){return this.toColourspace(e)}function f(e){if(r.object(e)||r.string(e)&&e.length>=3&&e.length<=200){let t=n(e);return[t.red(),t.green(),t.blue(),Math.round(t.alpha()*255)]}else throw r.invalidParameterError(`background`,`object or string`,e)}function p(e,t){r.defined(t)&&(this.options[e]=f(t))}t.exports=e=>{Object.assign(e.prototype,{tint:a,greyscale:o,grayscale:s,pipelineColourspace:c,pipelineColorspace:l,toColourspace:u,toColorspace:d,_getBackgroundColourOption:f,_setBackgroundColourOption:p}),e.colourspace=i,e.colorspace=i}})),oc=A(((e,t)=>{
117
117
  /*!
118
118
  Copyright 2013 Lovell Fuller and others.
119
119
  SPDX-License-Identifier: Apache-2.0
120
120
  */
121
- let n=aa(),r={and:`and`,or:`or`,eor:`eor`};function i(){return this.options.removeAlpha=!0,this}function a(e){if(n.defined(e))if(n.number(e)&&n.inRange(e,0,1))this.options.ensureAlpha=e;else throw n.invalidParameterError(`alpha`,`number between 0 and 1`,e);else this.options.ensureAlpha=1;return this}function o(e){let t={red:0,green:1,blue:2,alpha:3};if(Object.keys(t).includes(e)&&(e=t[e]),n.integer(e)&&n.inRange(e,0,4))this.options.extractChannel=e;else throw n.invalidParameterError(`channel`,`integer or one of: red, green, blue, alpha`,e);return this}function s(e,t){return Array.isArray(e)?e.forEach(function(e){this.options.joinChannelIn.push(this._createInputDescriptor(e,t))},this):this.options.joinChannelIn.push(this._createInputDescriptor(e,t)),this}function c(e){if(n.string(e)&&n.inArray(e,[`and`,`or`,`eor`]))this.options.bandBoolOp=e;else throw n.invalidParameterError(`boolOp`,`one of: and, or, eor`,e);return this}t.exports=e=>{Object.assign(e.prototype,{removeAlpha:i,ensureAlpha:a,extractChannel:o,joinChannel:s,bandbool:c}),e.bool=r}})),Ha=M(((e,t)=>{
121
+ let n=ws(),r={and:`and`,or:`or`,eor:`eor`};function i(){return this.options.removeAlpha=!0,this}function a(e){if(n.defined(e))if(n.number(e)&&n.inRange(e,0,1))this.options.ensureAlpha=e;else throw n.invalidParameterError(`alpha`,`number between 0 and 1`,e);else this.options.ensureAlpha=1;return this}function o(e){let t={red:0,green:1,blue:2,alpha:3};if(Object.keys(t).includes(e)&&(e=t[e]),n.integer(e)&&n.inRange(e,0,4))this.options.extractChannel=e;else throw n.invalidParameterError(`channel`,`integer or one of: red, green, blue, alpha`,e);return this}function s(e,t){return Array.isArray(e)?e.forEach(function(e){this.options.joinChannelIn.push(this._createInputDescriptor(e,t))},this):this.options.joinChannelIn.push(this._createInputDescriptor(e,t)),this}function c(e){if(n.string(e)&&n.inArray(e,[`and`,`or`,`eor`]))this.options.bandBoolOp=e;else throw n.invalidParameterError(`boolOp`,`one of: and, or, eor`,e);return this}t.exports=e=>{Object.assign(e.prototype,{removeAlpha:i,ensureAlpha:a,extractChannel:o,joinChannel:s,bandbool:c}),e.bool=r}})),sc=A(((e,t)=>{
122
122
  /*!
123
123
  Copyright 2013 Lovell Fuller and others.
124
124
  SPDX-License-Identifier: Apache-2.0
125
125
  */
126
- let n=N(`node:path`),r=aa(),i=Ma(),a=new Map([[`heic`,`heif`],[`heif`,`heif`],[`avif`,`avif`],[`jpeg`,`jpeg`],[`jpg`,`jpeg`],[`jpe`,`jpeg`],[`tile`,`tile`],[`dz`,`tile`],[`png`,`png`],[`raw`,`raw`],[`tiff`,`tiff`],[`tif`,`tiff`],[`webp`,`webp`],[`gif`,`gif`],[`jp2`,`jp2`],[`jpx`,`jp2`],[`j2k`,`jp2`],[`j2c`,`jp2`],[`jxl`,`jxl`]]),o=/\.(jp[2x]|j2[kc])$/i,s=()=>Error(`JP2 output requires libvips with support for OpenJPEG`),c=e=>1<<31-Math.clz32(Math.ceil(Math.log2(e)));function l(e,t){let i;if(r.string(e)?r.string(this.options.input.file)&&n.resolve(this.options.input.file)===n.resolve(e)?i=Error(`Cannot use same file for input and output`):o.test(n.extname(e))&&!this.constructor.format.jp2k.output.file&&(i=s()):i=Error(`Missing output file path`),i)if(r.fn(t))t(i);else return Promise.reject(i);else{this.options.fileOut=e;let n=Error();return this._pipeline(t,n)}return this}function u(e,t){r.object(e)?this._setBooleanOption(`resolveWithObject`,e.resolveWithObject):this.options.resolveWithObject&&(this.options.resolveWithObject=!1),this.options.fileOut=``;let n=Error();return this._pipeline(r.fn(e)?e:t,n)}function d(){return this.options.keepMetadata|=1,this}function f(e){if(r.object(e))for(let[t,n]of Object.entries(e))if(r.object(n))for(let[e,i]of Object.entries(n))if(r.string(i))this.options.withExif[`exif-${t.toLowerCase()}-${e}`]=i;else throw r.invalidParameterError(`${t}.${e}`,`string`,i);else throw r.invalidParameterError(t,`object`,n);else throw r.invalidParameterError(`exif`,`object`,e);return this.options.withExifMerge=!1,this.keepExif()}function p(e){return this.withExif(e),this.options.withExifMerge=!0,this}function m(){return this.options.keepMetadata|=8,this}function h(e,t){if(r.string(e))this.options.withIccProfile=e;else throw r.invalidParameterError(`icc`,`string`,e);if(this.keepIccProfile(),r.object(t)&&r.defined(t.attach))if(r.bool(t.attach))t.attach||(this.options.keepMetadata&=-9);else throw r.invalidParameterError(`attach`,`boolean`,t.attach);return this}function g(){return this.options.keepMetadata|=2,this}function _(e){if(r.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw r.invalidParameterError(`xmp`,`non-empty string`,e);return this}function v(){return this.options.keepMetadata=31,this}function y(e){if(this.keepMetadata(),this.withIccProfile(`srgb`),r.object(e)){if(r.defined(e.orientation))if(r.integer(e.orientation)&&r.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw r.invalidParameterError(`orientation`,`integer between 1 and 8`,e.orientation);if(r.defined(e.density))if(r.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw r.invalidParameterError(`density`,`positive number`,e.density);r.defined(e.icc)&&this.withIccProfile(e.icc),r.defined(e.exif)&&this.withExifMerge(e.exif)}return this}function b(e,t){let n=a.get((r.object(e)&&r.string(e.id)?e.id:e).toLowerCase());if(!n)throw r.invalidParameterError(`format`,`one of: ${[...a.keys()].join(`, `)}`,e);return this[n](t)}function x(e){if(r.object(e)){if(r.defined(e.quality))if(r.integer(e.quality)&&r.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw r.invalidParameterError(`quality`,`integer between 1 and 100`,e.quality);if(r.defined(e.progressive)&&this._setBooleanOption(`jpegProgressive`,e.progressive),r.defined(e.chromaSubsampling))if(r.string(e.chromaSubsampling)&&r.inArray(e.chromaSubsampling,[`4:2:0`,`4:4:4`]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw r.invalidParameterError(`chromaSubsampling`,`one of: 4:2:0, 4:4:4`,e.chromaSubsampling);let t=r.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(r.defined(t)&&this._setBooleanOption(`jpegOptimiseCoding`,t),r.defined(e.mozjpeg))if(r.bool(e.mozjpeg))e.mozjpeg&&(this.options.jpegTrellisQuantisation=!0,this.options.jpegOvershootDeringing=!0,this.options.jpegOptimiseScans=!0,this.options.jpegProgressive=!0,this.options.jpegQuantisationTable=3);else throw r.invalidParameterError(`mozjpeg`,`boolean`,e.mozjpeg);let n=r.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;r.defined(n)&&this._setBooleanOption(`jpegTrellisQuantisation`,n),r.defined(e.overshootDeringing)&&this._setBooleanOption(`jpegOvershootDeringing`,e.overshootDeringing);let i=r.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;r.defined(i)&&(this._setBooleanOption(`jpegOptimiseScans`,i),i&&(this.options.jpegProgressive=!0));let a=r.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(r.defined(a))if(r.integer(a)&&r.inRange(a,0,8))this.options.jpegQuantisationTable=a;else throw r.invalidParameterError(`quantisationTable`,`integer between 0 and 8`,a)}return this._updateFormatOut(`jpeg`,e)}function S(e){if(r.object(e)){if(r.defined(e.progressive)&&this._setBooleanOption(`pngProgressive`,e.progressive),r.defined(e.compressionLevel))if(r.integer(e.compressionLevel)&&r.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw r.invalidParameterError(`compressionLevel`,`integer between 0 and 9`,e.compressionLevel);r.defined(e.adaptiveFiltering)&&this._setBooleanOption(`pngAdaptiveFiltering`,e.adaptiveFiltering);let t=e.colours||e.colors;if(r.defined(t))if(r.integer(t)&&r.inRange(t,2,256))this.options.pngBitdepth=c(t);else throw r.invalidParameterError(`colours`,`integer between 2 and 256`,t);if(r.defined(e.palette)?this._setBooleanOption(`pngPalette`,e.palette):[e.quality,e.effort,e.colours,e.colors,e.dither].some(r.defined)&&this._setBooleanOption(`pngPalette`,!0),this.options.pngPalette){if(r.defined(e.quality))if(r.integer(e.quality)&&r.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw r.invalidParameterError(`quality`,`integer between 0 and 100`,e.quality);if(r.defined(e.effort))if(r.integer(e.effort)&&r.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw r.invalidParameterError(`effort`,`integer between 1 and 10`,e.effort);if(r.defined(e.dither))if(r.number(e.dither)&&r.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw r.invalidParameterError(`dither`,`number between 0.0 and 1.0`,e.dither)}}return this._updateFormatOut(`png`,e)}function C(e){if(r.object(e)){if(r.defined(e.quality))if(r.integer(e.quality)&&r.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw r.invalidParameterError(`quality`,`integer between 1 and 100`,e.quality);if(r.defined(e.alphaQuality))if(r.integer(e.alphaQuality)&&r.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw r.invalidParameterError(`alphaQuality`,`integer between 0 and 100`,e.alphaQuality);if(r.defined(e.lossless)&&this._setBooleanOption(`webpLossless`,e.lossless),r.defined(e.nearLossless)&&this._setBooleanOption(`webpNearLossless`,e.nearLossless),r.defined(e.smartSubsample)&&this._setBooleanOption(`webpSmartSubsample`,e.smartSubsample),r.defined(e.smartDeblock)&&this._setBooleanOption(`webpSmartDeblock`,e.smartDeblock),r.defined(e.preset))if(r.string(e.preset)&&r.inArray(e.preset,[`default`,`photo`,`picture`,`drawing`,`icon`,`text`]))this.options.webpPreset=e.preset;else throw r.invalidParameterError(`preset`,`one of: default, photo, picture, drawing, icon, text`,e.preset);if(r.defined(e.effort))if(r.integer(e.effort)&&r.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw r.invalidParameterError(`effort`,`integer between 0 and 6`,e.effort);r.defined(e.minSize)&&this._setBooleanOption(`webpMinSize`,e.minSize),r.defined(e.mixed)&&this._setBooleanOption(`webpMixed`,e.mixed)}return te(e,this.options),this._updateFormatOut(`webp`,e)}function w(e){if(r.object(e)){r.defined(e.reuse)&&this._setBooleanOption(`gifReuse`,e.reuse),r.defined(e.progressive)&&this._setBooleanOption(`gifProgressive`,e.progressive);let t=e.colours||e.colors;if(r.defined(t))if(r.integer(t)&&r.inRange(t,2,256))this.options.gifBitdepth=c(t);else throw r.invalidParameterError(`colours`,`integer between 2 and 256`,t);if(r.defined(e.effort))if(r.number(e.effort)&&r.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw r.invalidParameterError(`effort`,`integer between 1 and 10`,e.effort);if(r.defined(e.dither))if(r.number(e.dither)&&r.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw r.invalidParameterError(`dither`,`number between 0.0 and 1.0`,e.dither);if(r.defined(e.interFrameMaxError))if(r.number(e.interFrameMaxError)&&r.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw r.invalidParameterError(`interFrameMaxError`,`number between 0.0 and 32.0`,e.interFrameMaxError);if(r.defined(e.interPaletteMaxError))if(r.number(e.interPaletteMaxError)&&r.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw r.invalidParameterError(`interPaletteMaxError`,`number between 0.0 and 256.0`,e.interPaletteMaxError);if(r.defined(e.keepDuplicateFrames))if(r.bool(e.keepDuplicateFrames))this._setBooleanOption(`gifKeepDuplicateFrames`,e.keepDuplicateFrames);else throw r.invalidParameterError(`keepDuplicateFrames`,`boolean`,e.keepDuplicateFrames)}return te(e,this.options),this._updateFormatOut(`gif`,e)}function ee(e){if(!this.constructor.format.jp2k.output.buffer)throw s();if(r.object(e)){if(r.defined(e.quality))if(r.integer(e.quality)&&r.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw r.invalidParameterError(`quality`,`integer between 1 and 100`,e.quality);if(r.defined(e.lossless))if(r.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw r.invalidParameterError(`lossless`,`boolean`,e.lossless);if(r.defined(e.tileWidth))if(r.integer(e.tileWidth)&&r.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw r.invalidParameterError(`tileWidth`,`integer between 1 and 32768`,e.tileWidth);if(r.defined(e.tileHeight))if(r.integer(e.tileHeight)&&r.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw r.invalidParameterError(`tileHeight`,`integer between 1 and 32768`,e.tileHeight);if(r.defined(e.chromaSubsampling))if(r.string(e.chromaSubsampling)&&r.inArray(e.chromaSubsampling,[`4:2:0`,`4:4:4`]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw r.invalidParameterError(`chromaSubsampling`,`one of: 4:2:0, 4:4:4`,e.chromaSubsampling)}return this._updateFormatOut(`jp2`,e)}function te(e,t){if(r.object(e)&&r.defined(e.loop))if(r.integer(e.loop)&&r.inRange(e.loop,0,65535))t.loop=e.loop;else throw r.invalidParameterError(`loop`,`integer between 0 and 65535`,e.loop);if(r.object(e)&&r.defined(e.delay))if(r.integer(e.delay)&&r.inRange(e.delay,0,65535))t.delay=[e.delay];else if(Array.isArray(e.delay)&&e.delay.every(r.integer)&&e.delay.every(e=>r.inRange(e,0,65535)))t.delay=e.delay;else throw r.invalidParameterError(`delay`,`integer or an array of integers between 0 and 65535`,e.delay)}function T(e){if(r.object(e)){if(r.defined(e.quality))if(r.integer(e.quality)&&r.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw r.invalidParameterError(`quality`,`integer between 1 and 100`,e.quality);if(r.defined(e.bitdepth))if(r.integer(e.bitdepth)&&r.inArray(e.bitdepth,[1,2,4,8]))this.options.tiffBitdepth=e.bitdepth;else throw r.invalidParameterError(`bitdepth`,`1, 2, 4 or 8`,e.bitdepth);if(r.defined(e.tile)&&this._setBooleanOption(`tiffTile`,e.tile),r.defined(e.tileWidth))if(r.integer(e.tileWidth)&&e.tileWidth>0)this.options.tiffTileWidth=e.tileWidth;else throw r.invalidParameterError(`tileWidth`,`integer greater than zero`,e.tileWidth);if(r.defined(e.tileHeight))if(r.integer(e.tileHeight)&&e.tileHeight>0)this.options.tiffTileHeight=e.tileHeight;else throw r.invalidParameterError(`tileHeight`,`integer greater than zero`,e.tileHeight);if(r.defined(e.miniswhite)&&this._setBooleanOption(`tiffMiniswhite`,e.miniswhite),r.defined(e.pyramid)&&this._setBooleanOption(`tiffPyramid`,e.pyramid),r.defined(e.xres))if(r.number(e.xres)&&e.xres>0)this.options.tiffXres=e.xres;else throw r.invalidParameterError(`xres`,`number greater than zero`,e.xres);if(r.defined(e.yres))if(r.number(e.yres)&&e.yres>0)this.options.tiffYres=e.yres;else throw r.invalidParameterError(`yres`,`number greater than zero`,e.yres);if(r.defined(e.compression))if(r.string(e.compression)&&r.inArray(e.compression,[`none`,`jpeg`,`deflate`,`packbits`,`ccittfax4`,`lzw`,`webp`,`zstd`,`jp2k`]))this.options.tiffCompression=e.compression;else throw r.invalidParameterError(`compression`,`one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k`,e.compression);if(r.defined(e.bigtiff)&&this._setBooleanOption(`tiffBigtiff`,e.bigtiff),r.defined(e.predictor))if(r.string(e.predictor)&&r.inArray(e.predictor,[`none`,`horizontal`,`float`]))this.options.tiffPredictor=e.predictor;else throw r.invalidParameterError(`predictor`,`one of: none, horizontal, float`,e.predictor);if(r.defined(e.resolutionUnit))if(r.string(e.resolutionUnit)&&r.inArray(e.resolutionUnit,[`inch`,`cm`]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw r.invalidParameterError(`resolutionUnit`,`one of: inch, cm`,e.resolutionUnit)}return this._updateFormatOut(`tiff`,e)}function ne(e){return this.heif({...e,compression:`av1`})}function re(e){if(r.object(e)){if(r.string(e.compression)&&r.inArray(e.compression,[`av1`,`hevc`]))this.options.heifCompression=e.compression;else throw r.invalidParameterError(`compression`,`one of: av1, hevc`,e.compression);if(r.defined(e.quality))if(r.integer(e.quality)&&r.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw r.invalidParameterError(`quality`,`integer between 1 and 100`,e.quality);if(r.defined(e.lossless))if(r.bool(e.lossless))this.options.heifLossless=e.lossless;else throw r.invalidParameterError(`lossless`,`boolean`,e.lossless);if(r.defined(e.effort))if(r.integer(e.effort)&&r.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw r.invalidParameterError(`effort`,`integer between 0 and 9`,e.effort);if(r.defined(e.chromaSubsampling))if(r.string(e.chromaSubsampling)&&r.inArray(e.chromaSubsampling,[`4:2:0`,`4:4:4`]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw r.invalidParameterError(`chromaSubsampling`,`one of: 4:2:0, 4:4:4`,e.chromaSubsampling);if(r.defined(e.bitdepth))if(r.integer(e.bitdepth)&&r.inArray(e.bitdepth,[8,10,12])){if(e.bitdepth!==8&&this.constructor.versions.heif)throw r.invalidParameterError(`bitdepth when using prebuilt binaries`,8,e.bitdepth);this.options.heifBitdepth=e.bitdepth}else throw r.invalidParameterError(`bitdepth`,`8, 10 or 12`,e.bitdepth)}else throw r.invalidParameterError(`options`,`Object`,e);return this._updateFormatOut(`heif`,e)}function ie(e){if(r.object(e)){if(r.defined(e.quality))if(r.integer(e.quality)&&r.inRange(e.quality,1,100))this.options.jxlDistance=e.quality>=30?.1+(100-e.quality)*.09:53/3e3*e.quality*e.quality-23/20*e.quality+25;else throw r.invalidParameterError(`quality`,`integer between 1 and 100`,e.quality);else if(r.defined(e.distance))if(r.number(e.distance)&&r.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw r.invalidParameterError(`distance`,`number between 0.0 and 15.0`,e.distance);if(r.defined(e.decodingTier))if(r.integer(e.decodingTier)&&r.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw r.invalidParameterError(`decodingTier`,`integer between 0 and 4`,e.decodingTier);if(r.defined(e.lossless))if(r.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw r.invalidParameterError(`lossless`,`boolean`,e.lossless);if(r.defined(e.effort))if(r.integer(e.effort)&&r.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw r.invalidParameterError(`effort`,`integer between 1 and 9`,e.effort)}return te(e,this.options),this._updateFormatOut(`jxl`,e)}function ae(e){if(r.object(e)&&r.defined(e.depth))if(r.string(e.depth)&&r.inArray(e.depth,[`char`,`uchar`,`short`,`ushort`,`int`,`uint`,`float`,`complex`,`double`,`dpcomplex`]))this.options.rawDepth=e.depth;else throw r.invalidParameterError(`depth`,`one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex`,e.depth);return this._updateFormatOut(`raw`)}function oe(e){if(r.object(e)){if(r.defined(e.size))if(r.integer(e.size)&&r.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw r.invalidParameterError(`size`,`integer between 1 and 8192`,e.size);if(r.defined(e.overlap))if(r.integer(e.overlap)&&r.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw r.invalidParameterError(`overlap`,`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw r.invalidParameterError(`overlap`,`integer between 0 and 8192`,e.overlap);if(r.defined(e.container))if(r.string(e.container)&&r.inArray(e.container,[`fs`,`zip`]))this.options.tileContainer=e.container;else throw r.invalidParameterError(`container`,`one of: fs, zip`,e.container);if(r.defined(e.layout))if(r.string(e.layout)&&r.inArray(e.layout,[`dz`,`google`,`iiif`,`iiif3`,`zoomify`]))this.options.tileLayout=e.layout;else throw r.invalidParameterError(`layout`,`one of: dz, google, iiif, iiif3, zoomify`,e.layout);if(r.defined(e.angle))if(r.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw r.invalidParameterError(`angle`,`positive/negative multiple of 90`,e.angle);if(this._setBackgroundColourOption(`tileBackground`,e.background),r.defined(e.depth))if(r.string(e.depth)&&r.inArray(e.depth,[`onepixel`,`onetile`,`one`]))this.options.tileDepth=e.depth;else throw r.invalidParameterError(`depth`,`one of: onepixel, onetile, one`,e.depth);if(r.defined(e.skipBlanks))if(r.integer(e.skipBlanks)&&r.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw r.invalidParameterError(`skipBlanks`,`integer between -1 and 255/65535`,e.skipBlanks);else r.defined(e.layout)&&e.layout===`google`&&(this.options.tileSkipBlanks=5);let t=r.bool(e.center)?e.center:e.centre;if(r.defined(t)&&this._setBooleanOption(`tileCentre`,t),r.defined(e.id))if(r.string(e.id))this.options.tileId=e.id;else throw r.invalidParameterError(`id`,`string`,e.id);if(r.defined(e.basename))if(r.string(e.basename))this.options.tileBasename=e.basename;else throw r.invalidParameterError(`basename`,`string`,e.basename)}if(r.inArray(this.options.formatOut,[`jpeg`,`png`,`webp`]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!==`input`)throw r.invalidParameterError(`format`,`one of: jpeg, png, webp`,this.options.formatOut);return this._updateFormatOut(`dz`)}function se(e){if(!r.plainObject(e))throw r.invalidParameterError(`options`,`object`,e);if(r.integer(e.seconds)&&r.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw r.invalidParameterError(`seconds`,`integer between 0 and 3600`,e.seconds);return this}function E(e,t){return r.object(t)&&t.force===!1||(this.options.formatOut=e),this}function D(e,t){if(r.bool(t))this.options[e]=t;else throw r.invalidParameterError(e,`boolean`,t)}function ce(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function O(e,t){return typeof e==`function`?(this._isStreamInput()?this.on(`finish`,()=>{this._flattenBufferIn(),i.pipeline(this.options,(n,i,a)=>{n?e(r.nativeError(n,t)):e(null,i,a)})}):i.pipeline(this.options,(n,i,a)=>{n?e(r.nativeError(n,t)):e(null,i,a)}),this):this.options.streamOut?(this._isStreamInput()?(this.once(`finish`,()=>{this._flattenBufferIn(),i.pipeline(this.options,(e,n,i)=>{e?this.emit(`error`,r.nativeError(e,t)):(this.emit(`info`,i),this.push(n)),this.push(null),this.on(`end`,()=>this.emit(`close`))})}),this.streamInFinished&&this.emit(`finish`)):i.pipeline(this.options,(e,n,i)=>{e?this.emit(`error`,r.nativeError(e,t)):(this.emit(`info`,i),this.push(n)),this.push(null),this.on(`end`,()=>this.emit(`close`))}),this):this._isStreamInput()?new Promise((e,n)=>{this.once(`finish`,()=>{this._flattenBufferIn(),i.pipeline(this.options,(i,a,o)=>{i?n(r.nativeError(i,t)):this.options.resolveWithObject?e({data:a,info:o}):e(a)})})}):new Promise((e,n)=>{i.pipeline(this.options,(i,a,o)=>{i?n(r.nativeError(i,t)):this.options.resolveWithObject?e({data:a,info:o}):e(a)})})}t.exports=e=>{Object.assign(e.prototype,{toFile:l,toBuffer:u,keepExif:d,withExif:f,withExifMerge:p,keepIccProfile:m,withIccProfile:h,keepXmp:g,withXmp:_,keepMetadata:v,withMetadata:y,toFormat:b,jpeg:x,jp2:ee,png:S,webp:C,tiff:T,avif:ne,heif:re,jxl:ie,gif:w,raw:ae,tile:oe,timeout:se,_updateFormatOut:E,_setBooleanOption:D,_read:ce,_pipeline:O})}})),Ua=M(((e,t)=>{
126
+ let n=j(`node:path`),r=ws(),i=Zs(),a=new Map([[`heic`,`heif`],[`heif`,`heif`],[`avif`,`avif`],[`jpeg`,`jpeg`],[`jpg`,`jpeg`],[`jpe`,`jpeg`],[`tile`,`tile`],[`dz`,`tile`],[`png`,`png`],[`raw`,`raw`],[`tiff`,`tiff`],[`tif`,`tiff`],[`webp`,`webp`],[`gif`,`gif`],[`jp2`,`jp2`],[`jpx`,`jp2`],[`j2k`,`jp2`],[`j2c`,`jp2`],[`jxl`,`jxl`]]),o=/\.(jp[2x]|j2[kc])$/i,s=()=>Error(`JP2 output requires libvips with support for OpenJPEG`),c=e=>1<<31-Math.clz32(Math.ceil(Math.log2(e)));function l(e,t){let i;if(r.string(e)?r.string(this.options.input.file)&&n.resolve(this.options.input.file)===n.resolve(e)?i=Error(`Cannot use same file for input and output`):o.test(n.extname(e))&&!this.constructor.format.jp2k.output.file&&(i=s()):i=Error(`Missing output file path`),i)if(r.fn(t))t(i);else return Promise.reject(i);else{this.options.fileOut=e;let n=Error();return this._pipeline(t,n)}return this}function u(e,t){r.object(e)?this._setBooleanOption(`resolveWithObject`,e.resolveWithObject):this.options.resolveWithObject&&(this.options.resolveWithObject=!1),this.options.fileOut=``;let n=Error();return this._pipeline(r.fn(e)?e:t,n)}function d(){return this.options.keepMetadata|=1,this}function f(e){if(r.object(e))for(let[t,n]of Object.entries(e))if(r.object(n))for(let[e,i]of Object.entries(n))if(r.string(i))this.options.withExif[`exif-${t.toLowerCase()}-${e}`]=i;else throw r.invalidParameterError(`${t}.${e}`,`string`,i);else throw r.invalidParameterError(t,`object`,n);else throw r.invalidParameterError(`exif`,`object`,e);return this.options.withExifMerge=!1,this.keepExif()}function p(e){return this.withExif(e),this.options.withExifMerge=!0,this}function m(){return this.options.keepMetadata|=8,this}function h(e,t){if(r.string(e))this.options.withIccProfile=e;else throw r.invalidParameterError(`icc`,`string`,e);if(this.keepIccProfile(),r.object(t)&&r.defined(t.attach))if(r.bool(t.attach))t.attach||(this.options.keepMetadata&=-9);else throw r.invalidParameterError(`attach`,`boolean`,t.attach);return this}function g(){return this.options.keepMetadata|=2,this}function _(e){if(r.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw r.invalidParameterError(`xmp`,`non-empty string`,e);return this}function v(){return this.options.keepMetadata=31,this}function y(e){if(this.keepMetadata(),this.withIccProfile(`srgb`),r.object(e)){if(r.defined(e.orientation))if(r.integer(e.orientation)&&r.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw r.invalidParameterError(`orientation`,`integer between 1 and 8`,e.orientation);if(r.defined(e.density))if(r.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw r.invalidParameterError(`density`,`positive number`,e.density);r.defined(e.icc)&&this.withIccProfile(e.icc),r.defined(e.exif)&&this.withExifMerge(e.exif)}return this}function b(e,t){let n=a.get((r.object(e)&&r.string(e.id)?e.id:e).toLowerCase());if(!n)throw r.invalidParameterError(`format`,`one of: ${[...a.keys()].join(`, `)}`,e);return this[n](t)}function x(e){if(r.object(e)){if(r.defined(e.quality))if(r.integer(e.quality)&&r.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw r.invalidParameterError(`quality`,`integer between 1 and 100`,e.quality);if(r.defined(e.progressive)&&this._setBooleanOption(`jpegProgressive`,e.progressive),r.defined(e.chromaSubsampling))if(r.string(e.chromaSubsampling)&&r.inArray(e.chromaSubsampling,[`4:2:0`,`4:4:4`]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw r.invalidParameterError(`chromaSubsampling`,`one of: 4:2:0, 4:4:4`,e.chromaSubsampling);let t=r.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(r.defined(t)&&this._setBooleanOption(`jpegOptimiseCoding`,t),r.defined(e.mozjpeg))if(r.bool(e.mozjpeg))e.mozjpeg&&(this.options.jpegTrellisQuantisation=!0,this.options.jpegOvershootDeringing=!0,this.options.jpegOptimiseScans=!0,this.options.jpegProgressive=!0,this.options.jpegQuantisationTable=3);else throw r.invalidParameterError(`mozjpeg`,`boolean`,e.mozjpeg);let n=r.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;r.defined(n)&&this._setBooleanOption(`jpegTrellisQuantisation`,n),r.defined(e.overshootDeringing)&&this._setBooleanOption(`jpegOvershootDeringing`,e.overshootDeringing);let i=r.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;r.defined(i)&&(this._setBooleanOption(`jpegOptimiseScans`,i),i&&(this.options.jpegProgressive=!0));let a=r.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(r.defined(a))if(r.integer(a)&&r.inRange(a,0,8))this.options.jpegQuantisationTable=a;else throw r.invalidParameterError(`quantisationTable`,`integer between 0 and 8`,a)}return this._updateFormatOut(`jpeg`,e)}function S(e){if(r.object(e)){if(r.defined(e.progressive)&&this._setBooleanOption(`pngProgressive`,e.progressive),r.defined(e.compressionLevel))if(r.integer(e.compressionLevel)&&r.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw r.invalidParameterError(`compressionLevel`,`integer between 0 and 9`,e.compressionLevel);r.defined(e.adaptiveFiltering)&&this._setBooleanOption(`pngAdaptiveFiltering`,e.adaptiveFiltering);let t=e.colours||e.colors;if(r.defined(t))if(r.integer(t)&&r.inRange(t,2,256))this.options.pngBitdepth=c(t);else throw r.invalidParameterError(`colours`,`integer between 2 and 256`,t);if(r.defined(e.palette)?this._setBooleanOption(`pngPalette`,e.palette):[e.quality,e.effort,e.colours,e.colors,e.dither].some(r.defined)&&this._setBooleanOption(`pngPalette`,!0),this.options.pngPalette){if(r.defined(e.quality))if(r.integer(e.quality)&&r.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw r.invalidParameterError(`quality`,`integer between 0 and 100`,e.quality);if(r.defined(e.effort))if(r.integer(e.effort)&&r.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw r.invalidParameterError(`effort`,`integer between 1 and 10`,e.effort);if(r.defined(e.dither))if(r.number(e.dither)&&r.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw r.invalidParameterError(`dither`,`number between 0.0 and 1.0`,e.dither)}}return this._updateFormatOut(`png`,e)}function C(e){if(r.object(e)){if(r.defined(e.quality))if(r.integer(e.quality)&&r.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw r.invalidParameterError(`quality`,`integer between 1 and 100`,e.quality);if(r.defined(e.alphaQuality))if(r.integer(e.alphaQuality)&&r.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw r.invalidParameterError(`alphaQuality`,`integer between 0 and 100`,e.alphaQuality);if(r.defined(e.lossless)&&this._setBooleanOption(`webpLossless`,e.lossless),r.defined(e.nearLossless)&&this._setBooleanOption(`webpNearLossless`,e.nearLossless),r.defined(e.smartSubsample)&&this._setBooleanOption(`webpSmartSubsample`,e.smartSubsample),r.defined(e.smartDeblock)&&this._setBooleanOption(`webpSmartDeblock`,e.smartDeblock),r.defined(e.preset))if(r.string(e.preset)&&r.inArray(e.preset,[`default`,`photo`,`picture`,`drawing`,`icon`,`text`]))this.options.webpPreset=e.preset;else throw r.invalidParameterError(`preset`,`one of: default, photo, picture, drawing, icon, text`,e.preset);if(r.defined(e.effort))if(r.integer(e.effort)&&r.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw r.invalidParameterError(`effort`,`integer between 0 and 6`,e.effort);r.defined(e.minSize)&&this._setBooleanOption(`webpMinSize`,e.minSize),r.defined(e.mixed)&&this._setBooleanOption(`webpMixed`,e.mixed)}return te(e,this.options),this._updateFormatOut(`webp`,e)}function w(e){if(r.object(e)){r.defined(e.reuse)&&this._setBooleanOption(`gifReuse`,e.reuse),r.defined(e.progressive)&&this._setBooleanOption(`gifProgressive`,e.progressive);let t=e.colours||e.colors;if(r.defined(t))if(r.integer(t)&&r.inRange(t,2,256))this.options.gifBitdepth=c(t);else throw r.invalidParameterError(`colours`,`integer between 2 and 256`,t);if(r.defined(e.effort))if(r.number(e.effort)&&r.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw r.invalidParameterError(`effort`,`integer between 1 and 10`,e.effort);if(r.defined(e.dither))if(r.number(e.dither)&&r.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw r.invalidParameterError(`dither`,`number between 0.0 and 1.0`,e.dither);if(r.defined(e.interFrameMaxError))if(r.number(e.interFrameMaxError)&&r.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw r.invalidParameterError(`interFrameMaxError`,`number between 0.0 and 32.0`,e.interFrameMaxError);if(r.defined(e.interPaletteMaxError))if(r.number(e.interPaletteMaxError)&&r.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw r.invalidParameterError(`interPaletteMaxError`,`number between 0.0 and 256.0`,e.interPaletteMaxError);if(r.defined(e.keepDuplicateFrames))if(r.bool(e.keepDuplicateFrames))this._setBooleanOption(`gifKeepDuplicateFrames`,e.keepDuplicateFrames);else throw r.invalidParameterError(`keepDuplicateFrames`,`boolean`,e.keepDuplicateFrames)}return te(e,this.options),this._updateFormatOut(`gif`,e)}function ee(e){if(!this.constructor.format.jp2k.output.buffer)throw s();if(r.object(e)){if(r.defined(e.quality))if(r.integer(e.quality)&&r.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw r.invalidParameterError(`quality`,`integer between 1 and 100`,e.quality);if(r.defined(e.lossless))if(r.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw r.invalidParameterError(`lossless`,`boolean`,e.lossless);if(r.defined(e.tileWidth))if(r.integer(e.tileWidth)&&r.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw r.invalidParameterError(`tileWidth`,`integer between 1 and 32768`,e.tileWidth);if(r.defined(e.tileHeight))if(r.integer(e.tileHeight)&&r.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw r.invalidParameterError(`tileHeight`,`integer between 1 and 32768`,e.tileHeight);if(r.defined(e.chromaSubsampling))if(r.string(e.chromaSubsampling)&&r.inArray(e.chromaSubsampling,[`4:2:0`,`4:4:4`]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw r.invalidParameterError(`chromaSubsampling`,`one of: 4:2:0, 4:4:4`,e.chromaSubsampling)}return this._updateFormatOut(`jp2`,e)}function te(e,t){if(r.object(e)&&r.defined(e.loop))if(r.integer(e.loop)&&r.inRange(e.loop,0,65535))t.loop=e.loop;else throw r.invalidParameterError(`loop`,`integer between 0 and 65535`,e.loop);if(r.object(e)&&r.defined(e.delay))if(r.integer(e.delay)&&r.inRange(e.delay,0,65535))t.delay=[e.delay];else if(Array.isArray(e.delay)&&e.delay.every(r.integer)&&e.delay.every(e=>r.inRange(e,0,65535)))t.delay=e.delay;else throw r.invalidParameterError(`delay`,`integer or an array of integers between 0 and 65535`,e.delay)}function T(e){if(r.object(e)){if(r.defined(e.quality))if(r.integer(e.quality)&&r.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw r.invalidParameterError(`quality`,`integer between 1 and 100`,e.quality);if(r.defined(e.bitdepth))if(r.integer(e.bitdepth)&&r.inArray(e.bitdepth,[1,2,4,8]))this.options.tiffBitdepth=e.bitdepth;else throw r.invalidParameterError(`bitdepth`,`1, 2, 4 or 8`,e.bitdepth);if(r.defined(e.tile)&&this._setBooleanOption(`tiffTile`,e.tile),r.defined(e.tileWidth))if(r.integer(e.tileWidth)&&e.tileWidth>0)this.options.tiffTileWidth=e.tileWidth;else throw r.invalidParameterError(`tileWidth`,`integer greater than zero`,e.tileWidth);if(r.defined(e.tileHeight))if(r.integer(e.tileHeight)&&e.tileHeight>0)this.options.tiffTileHeight=e.tileHeight;else throw r.invalidParameterError(`tileHeight`,`integer greater than zero`,e.tileHeight);if(r.defined(e.miniswhite)&&this._setBooleanOption(`tiffMiniswhite`,e.miniswhite),r.defined(e.pyramid)&&this._setBooleanOption(`tiffPyramid`,e.pyramid),r.defined(e.xres))if(r.number(e.xres)&&e.xres>0)this.options.tiffXres=e.xres;else throw r.invalidParameterError(`xres`,`number greater than zero`,e.xres);if(r.defined(e.yres))if(r.number(e.yres)&&e.yres>0)this.options.tiffYres=e.yres;else throw r.invalidParameterError(`yres`,`number greater than zero`,e.yres);if(r.defined(e.compression))if(r.string(e.compression)&&r.inArray(e.compression,[`none`,`jpeg`,`deflate`,`packbits`,`ccittfax4`,`lzw`,`webp`,`zstd`,`jp2k`]))this.options.tiffCompression=e.compression;else throw r.invalidParameterError(`compression`,`one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k`,e.compression);if(r.defined(e.bigtiff)&&this._setBooleanOption(`tiffBigtiff`,e.bigtiff),r.defined(e.predictor))if(r.string(e.predictor)&&r.inArray(e.predictor,[`none`,`horizontal`,`float`]))this.options.tiffPredictor=e.predictor;else throw r.invalidParameterError(`predictor`,`one of: none, horizontal, float`,e.predictor);if(r.defined(e.resolutionUnit))if(r.string(e.resolutionUnit)&&r.inArray(e.resolutionUnit,[`inch`,`cm`]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw r.invalidParameterError(`resolutionUnit`,`one of: inch, cm`,e.resolutionUnit)}return this._updateFormatOut(`tiff`,e)}function ne(e){return this.heif({...e,compression:`av1`})}function re(e){if(r.object(e)){if(r.string(e.compression)&&r.inArray(e.compression,[`av1`,`hevc`]))this.options.heifCompression=e.compression;else throw r.invalidParameterError(`compression`,`one of: av1, hevc`,e.compression);if(r.defined(e.quality))if(r.integer(e.quality)&&r.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw r.invalidParameterError(`quality`,`integer between 1 and 100`,e.quality);if(r.defined(e.lossless))if(r.bool(e.lossless))this.options.heifLossless=e.lossless;else throw r.invalidParameterError(`lossless`,`boolean`,e.lossless);if(r.defined(e.effort))if(r.integer(e.effort)&&r.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw r.invalidParameterError(`effort`,`integer between 0 and 9`,e.effort);if(r.defined(e.chromaSubsampling))if(r.string(e.chromaSubsampling)&&r.inArray(e.chromaSubsampling,[`4:2:0`,`4:4:4`]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw r.invalidParameterError(`chromaSubsampling`,`one of: 4:2:0, 4:4:4`,e.chromaSubsampling);if(r.defined(e.bitdepth))if(r.integer(e.bitdepth)&&r.inArray(e.bitdepth,[8,10,12])){if(e.bitdepth!==8&&this.constructor.versions.heif)throw r.invalidParameterError(`bitdepth when using prebuilt binaries`,8,e.bitdepth);this.options.heifBitdepth=e.bitdepth}else throw r.invalidParameterError(`bitdepth`,`8, 10 or 12`,e.bitdepth)}else throw r.invalidParameterError(`options`,`Object`,e);return this._updateFormatOut(`heif`,e)}function ie(e){if(r.object(e)){if(r.defined(e.quality))if(r.integer(e.quality)&&r.inRange(e.quality,1,100))this.options.jxlDistance=e.quality>=30?.1+(100-e.quality)*.09:53/3e3*e.quality*e.quality-23/20*e.quality+25;else throw r.invalidParameterError(`quality`,`integer between 1 and 100`,e.quality);else if(r.defined(e.distance))if(r.number(e.distance)&&r.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw r.invalidParameterError(`distance`,`number between 0.0 and 15.0`,e.distance);if(r.defined(e.decodingTier))if(r.integer(e.decodingTier)&&r.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw r.invalidParameterError(`decodingTier`,`integer between 0 and 4`,e.decodingTier);if(r.defined(e.lossless))if(r.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw r.invalidParameterError(`lossless`,`boolean`,e.lossless);if(r.defined(e.effort))if(r.integer(e.effort)&&r.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw r.invalidParameterError(`effort`,`integer between 1 and 9`,e.effort)}return te(e,this.options),this._updateFormatOut(`jxl`,e)}function ae(e){if(r.object(e)&&r.defined(e.depth))if(r.string(e.depth)&&r.inArray(e.depth,[`char`,`uchar`,`short`,`ushort`,`int`,`uint`,`float`,`complex`,`double`,`dpcomplex`]))this.options.rawDepth=e.depth;else throw r.invalidParameterError(`depth`,`one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex`,e.depth);return this._updateFormatOut(`raw`)}function oe(e){if(r.object(e)){if(r.defined(e.size))if(r.integer(e.size)&&r.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw r.invalidParameterError(`size`,`integer between 1 and 8192`,e.size);if(r.defined(e.overlap))if(r.integer(e.overlap)&&r.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw r.invalidParameterError(`overlap`,`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw r.invalidParameterError(`overlap`,`integer between 0 and 8192`,e.overlap);if(r.defined(e.container))if(r.string(e.container)&&r.inArray(e.container,[`fs`,`zip`]))this.options.tileContainer=e.container;else throw r.invalidParameterError(`container`,`one of: fs, zip`,e.container);if(r.defined(e.layout))if(r.string(e.layout)&&r.inArray(e.layout,[`dz`,`google`,`iiif`,`iiif3`,`zoomify`]))this.options.tileLayout=e.layout;else throw r.invalidParameterError(`layout`,`one of: dz, google, iiif, iiif3, zoomify`,e.layout);if(r.defined(e.angle))if(r.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw r.invalidParameterError(`angle`,`positive/negative multiple of 90`,e.angle);if(this._setBackgroundColourOption(`tileBackground`,e.background),r.defined(e.depth))if(r.string(e.depth)&&r.inArray(e.depth,[`onepixel`,`onetile`,`one`]))this.options.tileDepth=e.depth;else throw r.invalidParameterError(`depth`,`one of: onepixel, onetile, one`,e.depth);if(r.defined(e.skipBlanks))if(r.integer(e.skipBlanks)&&r.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw r.invalidParameterError(`skipBlanks`,`integer between -1 and 255/65535`,e.skipBlanks);else r.defined(e.layout)&&e.layout===`google`&&(this.options.tileSkipBlanks=5);let t=r.bool(e.center)?e.center:e.centre;if(r.defined(t)&&this._setBooleanOption(`tileCentre`,t),r.defined(e.id))if(r.string(e.id))this.options.tileId=e.id;else throw r.invalidParameterError(`id`,`string`,e.id);if(r.defined(e.basename))if(r.string(e.basename))this.options.tileBasename=e.basename;else throw r.invalidParameterError(`basename`,`string`,e.basename)}if(r.inArray(this.options.formatOut,[`jpeg`,`png`,`webp`]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!==`input`)throw r.invalidParameterError(`format`,`one of: jpeg, png, webp`,this.options.formatOut);return this._updateFormatOut(`dz`)}function se(e){if(!r.plainObject(e))throw r.invalidParameterError(`options`,`object`,e);if(r.integer(e.seconds)&&r.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw r.invalidParameterError(`seconds`,`integer between 0 and 3600`,e.seconds);return this}function E(e,t){return r.object(t)&&t.force===!1||(this.options.formatOut=e),this}function D(e,t){if(r.bool(t))this.options[e]=t;else throw r.invalidParameterError(e,`boolean`,t)}function ce(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function O(e,t){return typeof e==`function`?(this._isStreamInput()?this.on(`finish`,()=>{this._flattenBufferIn(),i.pipeline(this.options,(n,i,a)=>{n?e(r.nativeError(n,t)):e(null,i,a)})}):i.pipeline(this.options,(n,i,a)=>{n?e(r.nativeError(n,t)):e(null,i,a)}),this):this.options.streamOut?(this._isStreamInput()?(this.once(`finish`,()=>{this._flattenBufferIn(),i.pipeline(this.options,(e,n,i)=>{e?this.emit(`error`,r.nativeError(e,t)):(this.emit(`info`,i),this.push(n)),this.push(null),this.on(`end`,()=>this.emit(`close`))})}),this.streamInFinished&&this.emit(`finish`)):i.pipeline(this.options,(e,n,i)=>{e?this.emit(`error`,r.nativeError(e,t)):(this.emit(`info`,i),this.push(n)),this.push(null),this.on(`end`,()=>this.emit(`close`))}),this):this._isStreamInput()?new Promise((e,n)=>{this.once(`finish`,()=>{this._flattenBufferIn(),i.pipeline(this.options,(i,a,o)=>{i?n(r.nativeError(i,t)):this.options.resolveWithObject?e({data:a,info:o}):e(a)})})}):new Promise((e,n)=>{i.pipeline(this.options,(i,a,o)=>{i?n(r.nativeError(i,t)):this.options.resolveWithObject?e({data:a,info:o}):e(a)})})}t.exports=e=>{Object.assign(e.prototype,{toFile:l,toBuffer:u,keepExif:d,withExif:f,withExifMerge:p,keepIccProfile:m,withIccProfile:h,keepXmp:g,withXmp:_,keepMetadata:v,withMetadata:y,toFormat:b,jpeg:x,jp2:ee,png:S,webp:C,tiff:T,avif:ne,heif:re,jxl:ie,gif:w,raw:ae,tile:oe,timeout:se,_updateFormatOut:E,_setBooleanOption:D,_read:ce,_pipeline:O})}})),cc=A(((e,t)=>{
127
127
  /*!
128
128
  Copyright 2013 Lovell Fuller and others.
129
129
  SPDX-License-Identifier: Apache-2.0
130
130
  */
131
- let n=N(`node:events`),r=la(),i=aa(),{runtimePlatformArch:a}=ja(),o=Ma(),s=a(),c=o.libvipsVersion(),l=o.format();l.heif.output.alias=[`avif`,`heic`],l.jpeg.output.alias=[`jpe`,`jpg`],l.tiff.output.alias=[`tif`],l.jp2k.output.alias=[`j2c`,`j2k`,`jp2`,`jpx`];let u={nearest:`nearest`,bilinear:`bilinear`,bicubic:`bicubic`,locallyBoundedBicubic:`lbb`,nohalo:`nohalo`,vertexSplitQuadraticBasisSpline:`vsqbs`},d={vips:c.semver};if(!c.isGlobal)if(c.isWasm)try{d=N(`@img/sharp-wasm32/versions`)}catch{}else try{d=N(`@img/sharp-${s}/versions`)}catch{try{d=N(`@img/sharp-libvips-${s}/versions`)}catch{}}d.sharp=Aa().version,d.heif&&l.heif&&(l.heif.input.fileSuffix=[`.avif`],l.heif.output.alias=[`avif`]);function f(e){return i.bool(e)?e?o.cache(50,20,100):o.cache(0,0,0):i.object(e)?o.cache(e.memory,e.files,e.items):o.cache()}f(!0);function p(e){return o.concurrency(i.integer(e)?e:null)}r.familySync()===r.GLIBC&&!o._isUsingJemalloc()?o.concurrency(1):r.familySync()===r.MUSL&&o.concurrency()===1024&&o.concurrency(N(`node:os`).availableParallelism());let m=new n.EventEmitter;function h(){return o.counters()}function g(e){return o.simd(i.bool(e)?e:null)}function _(e){if(i.object(e))if(Array.isArray(e.operation)&&e.operation.every(i.string))o.block(e.operation,!0);else throw i.invalidParameterError(`operation`,`Array<string>`,e.operation);else throw i.invalidParameterError(`options`,`object`,e)}function v(e){if(i.object(e))if(Array.isArray(e.operation)&&e.operation.every(i.string))o.block(e.operation,!1);else throw i.invalidParameterError(`operation`,`Array<string>`,e.operation);else throw i.invalidParameterError(`options`,`object`,e)}t.exports=e=>{e.cache=f,e.concurrency=p,e.counters=h,e.simd=g,e.format=l,e.interpolators=u,e.versions=d,e.queue=m,e.block=_,e.unblock=v}})),Wa=ge(M(((e,t)=>{
131
+ let n=j(`node:events`),r=Os(),i=ws(),{runtimePlatformArch:a}=Xs(),o=Zs(),s=a(),c=o.libvipsVersion(),l=o.format();l.heif.output.alias=[`avif`,`heic`],l.jpeg.output.alias=[`jpe`,`jpg`],l.tiff.output.alias=[`tif`],l.jp2k.output.alias=[`j2c`,`j2k`,`jp2`,`jpx`];let u={nearest:`nearest`,bilinear:`bilinear`,bicubic:`bicubic`,locallyBoundedBicubic:`lbb`,nohalo:`nohalo`,vertexSplitQuadraticBasisSpline:`vsqbs`},d={vips:c.semver};if(!c.isGlobal)if(c.isWasm)try{d=j(`@img/sharp-wasm32/versions`)}catch{}else try{d=j(`@img/sharp-${s}/versions`)}catch{try{d=j(`@img/sharp-libvips-${s}/versions`)}catch{}}d.sharp=Ys().version,d.heif&&l.heif&&(l.heif.input.fileSuffix=[`.avif`],l.heif.output.alias=[`avif`]);function f(e){return i.bool(e)?e?o.cache(50,20,100):o.cache(0,0,0):i.object(e)?o.cache(e.memory,e.files,e.items):o.cache()}f(!0);function p(e){return o.concurrency(i.integer(e)?e:null)}r.familySync()===r.GLIBC&&!o._isUsingJemalloc()?o.concurrency(1):r.familySync()===r.MUSL&&o.concurrency()===1024&&o.concurrency(j(`node:os`).availableParallelism());let m=new n.EventEmitter;function h(){return o.counters()}function g(e){return o.simd(i.bool(e)?e:null)}function _(e){if(i.object(e))if(Array.isArray(e.operation)&&e.operation.every(i.string))o.block(e.operation,!0);else throw i.invalidParameterError(`operation`,`Array<string>`,e.operation);else throw i.invalidParameterError(`options`,`object`,e)}function v(e){if(i.object(e))if(Array.isArray(e.operation)&&e.operation.every(i.string))o.block(e.operation,!1);else throw i.invalidParameterError(`operation`,`Array<string>`,e.operation);else throw i.invalidParameterError(`options`,`object`,e)}t.exports=e=>{e.cache=f,e.concurrency=p,e.counters=h,e.simd=g,e.format=l,e.interpolators=u,e.versions=d,e.queue=m,e.block=_,e.unblock=v}})),lc=ve(A(((e,t)=>{
132
132
  /*!
133
133
  Copyright 2013 Lovell Fuller and others.
134
134
  SPDX-License-Identifier: Apache-2.0
135
135
  */
136
- let n=Na();Pa()(n),Fa()(n),Ia()(n),La()(n),Ba()(n),Va()(n),Ha()(n),Ua()(n),t.exports=n}))(),1);function Ga(e){return i(e)?e:o(s.cwd(),e)}function Ka(e){let t=Ga(e);if(!x(t))return[];try{return te(t,{withFileTypes:!0}).filter(e=>e.isFile()&&r(e.name).toLowerCase()===`.svg`).map(e=>e.name.replace(/\.svg$/i,``))}catch{return[]}}function qa(e,t){return a(Ga(t),`${e}.svg`)}function Ja(e,t,n){let r=i(e)?e:qa(e,n);if(!x(r))throw Error(`SVG template not found at ${r}. Please ensure the template exists in ${Ga(n)}.`);let a;try{a=ee(r,`utf-8`)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to load SVG template from ${r}: ${t}`)}let o=t.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`);return a.replace(/\{\{text\}\}/g,o)}async function Ya(e,t,n,r,i){try{let a=Ja(r,n,i),o=ue.from(a);await(0,Wa.default)(e).composite([{input:o,blend:`over`}]).toFile(t)}catch(e){throw console.error(`Error adding text to image:`,e),e}}async function Xa(){let e=s.cwd(),t=te(e,{withFileTypes:!0}).filter(e=>e.isFile()&&r(e.name).toLowerCase()===`.mp4`).map(e=>e.name);t.length===0&&(H.error(`No .mp4 files found in the current directory.`),s.exit(1)),St(`Video Toolkit - Select video file`);let n=await xt({message:`Choose a video file:`,options:t.map(e=>({label:e,value:e}))});return n||(H.error(`No file selected. Exiting.`),s.exit(1)),Ct(),a(e,n)}async function Za(){let e=await bt({message:`Enter text for the thumbnail (or press Enter to skip):`,placeholder:`Optional thumbnail text`});if(typeof e!=`symbol`)return e.trim()||void 0}async function Qa(e){let t=Ka(e);if(t.length===0){H.error(`No templates found in ${e}`),H.info(`Please add SVG templates to ${e} before proceeding.`);return}let n=await xt({message:`Choose a template:`,options:t.map(e=>({label:e,value:e}))});if(typeof n!=`symbol`)return n}function $a(e,t){let n=`ffmpeg -i ${e} -q:a 0 -map a ${t}`;try{k(n,{stdio:`inherit`})}catch(e){console.error(`Error extracting audio:`,e)}}function eo(e){try{let t=k(`ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "${e}"`,{encoding:`utf-8`});return Number.parseFloat(t.trim())}catch(e){throw console.error(`Error getting video duration:`,e),e}}function to(e,t,n=`first`){let r=``;r=n===`first`?`ffmpeg -i "${e}" -vf "select=eq(n\\,0)" -vframes 1 "${t}" -y`:n===`last`?`ffmpeg -sseof -0.1 -i "${e}" -vframes 1 "${t}" -y`:`ffmpeg -ss ${eo(e)*(Number.parseInt(n)/100)} -i "${e}" -vframes 1 "${t}" -y`;try{k(r,{stdio:`inherit`})}catch(e){throw console.error(`Error extracting thumbnail:`,e),e}}function K(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function q(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}let no=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return no=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))};function ro(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}const io=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)};var J=class extends Error{},ao=class e extends J{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`x-request-id`),this.error=n;let a=n;this.code=a?.code,this.param=a?.param,this.type=a?.type}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new so({message:r,cause:io(n)});let a=n?.error;return t===400?new lo(t,a,r,i):t===401?new uo(t,a,r,i):t===403?new fo(t,a,r,i):t===404?new po(t,a,r,i):t===409?new mo(t,a,r,i):t===422?new ho(t,a,r,i):t===429?new go(t,a,r,i):t>=500?new _o(t,a,r,i):new e(t,a,r,i)}},oo=class extends ao{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},so=class extends ao{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},co=class extends so{constructor({message:e}={}){super({message:e??`Request timed out.`})}},lo=class extends ao{},uo=class extends ao{},fo=class extends ao{},po=class extends ao{},mo=class extends ao{},ho=class extends ao{},go=class extends ao{},_o=class extends ao{},vo=class extends J{constructor(){super(`Could not parse response content as the length limit was reached`)}},yo=class extends J{constructor(){super(`Could not parse response content as the request was rejected by the content filter`)}},bo=class extends Error{constructor(e){super(e)}};const xo=/^[a-z][a-z0-9+.-]*:/i,So=e=>xo.test(e);let Co=e=>(Co=Array.isArray,Co(e)),wo=Co;function To(e){return typeof e==`object`?e??{}:{}}function Eo(e){if(!e)return!0;for(let t in e)return!1;return!0}function Do(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Oo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const ko=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new J(`${e} must be an integer`);if(t<0)throw new J(`${e} must be a positive integer`);return t},Ao=e=>{try{return JSON.parse(e)}catch{return}},jo=e=>new Promise(t=>setTimeout(t,e)),Mo=`6.15.0`,No=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`;function Po(){return typeof Deno<`u`&&Deno.build!=null?`deno`:typeof EdgeRuntime<`u`?`edge`:Object.prototype.toString.call(globalThis.process===void 0?0:globalThis.process)===`[object process]`?`node`:`unknown`}const Fo=()=>{let e=Po();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":Mo,"X-Stainless-OS":Ro(Deno.build.os),"X-Stainless-Arch":Lo(Deno.build.arch),"X-Stainless-Runtime":`deno`,"X-Stainless-Runtime-Version":typeof Deno.version==`string`?Deno.version:Deno.version?.deno??`unknown`};if(typeof EdgeRuntime<`u`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":Mo,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":`edge`,"X-Stainless-Runtime-Version":globalThis.process.version};if(e===`node`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":Mo,"X-Stainless-OS":Ro(globalThis.process.platform??`unknown`),"X-Stainless-Arch":Lo(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=Io();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":Mo,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":Mo,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}};function Io(){if(typeof navigator>`u`||!navigator)return null;for(let{key:e,pattern:t}of[{key:`edge`,pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`chrome`,pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`firefox`,pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`safari`,pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let n=t.exec(navigator.userAgent);if(n)return{browser:e,version:`${n[1]||0}.${n[2]||0}.${n[3]||0}`}}return null}const Lo=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,Ro=e=>(e=e.toLowerCase(),e.includes(`ios`)?`iOS`:e===`android`?`Android`:e===`darwin`?`MacOS`:e===`win32`?`Windows`:e===`freebsd`?`FreeBSD`:e===`openbsd`?`OpenBSD`:e===`linux`?`Linux`:e?`Other:${e}`:`Unknown`);let zo;const Bo=()=>zo??=Fo();function Vo(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Ho(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function Uo(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return Ho({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function Wo(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Go(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}const Ko=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)}),qo=`RFC3986`,Jo=e=>String(e),Yo={RFC1738:e=>String(e).replace(/%20/g,`+`),RFC3986:Jo};let Xo=(e,t)=>(Xo=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Xo(e,t));const Zo=(()=>{let e=[];for(let t=0;t<256;++t)e.push(`%`+((t<16?`0`:``)+t.toString(16)).toUpperCase());return e})(),Qo=1024,$o=(e,t,n,r,i)=>{if(e.length===0)return e;let a=e;if(typeof e==`symbol`?a=Symbol.prototype.toString.call(e):typeof e!=`string`&&(a=String(e)),n===`iso-8859-1`)return escape(a).replace(/%u[0-9a-f]{4}/gi,function(e){return`%26%23`+parseInt(e.slice(2),16)+`%3B`});let o=``;for(let e=0;e<a.length;e+=Qo){let t=a.length>=Qo?a.slice(e,e+Qo):a,n=[];for(let e=0;e<t.length;++e){let r=t.charCodeAt(e);if(r===45||r===46||r===95||r===126||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||i===`RFC1738`&&(r===40||r===41)){n[n.length]=t.charAt(e);continue}if(r<128){n[n.length]=Zo[r];continue}if(r<2048){n[n.length]=Zo[192|r>>6]+Zo[128|r&63];continue}if(r<55296||r>=57344){n[n.length]=Zo[224|r>>12]+Zo[128|r>>6&63]+Zo[128|r&63];continue}e+=1,r=65536+((r&1023)<<10|t.charCodeAt(e)&1023),n[n.length]=Zo[240|r>>18]+Zo[128|r>>12&63]+Zo[128|r>>6&63]+Zo[128|r&63]}o+=n.join(``)}return o};function es(e){return!e||typeof e!=`object`?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function ts(e,t){if(Co(e)){let n=[];for(let r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)}const ns={brackets(e){return String(e)+`[]`},comma:`comma`,indices(e,t){return String(e)+`[`+t+`]`},repeat(e){return String(e)}},rs=function(e,t){Array.prototype.push.apply(e,Co(t)?t:[t])};let is;const as={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:`indices`,charset:`utf-8`,charsetSentinel:!1,delimiter:`&`,encode:!0,encodeDotInKeys:!1,encoder:$o,encodeValuesOnly:!1,format:qo,formatter:Jo,indices:!1,serializeDate(e){return(is??=Function.prototype.call.bind(Date.prototype.toISOString))(e)},skipNulls:!1,strictNullHandling:!1};function os(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`symbol`||typeof e==`bigint`}const ss={};function cs(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=e,y=_,b=0,x=!1;for(;(y=y.get(ss))!==void 0&&!x;){let t=y.get(e);if(b+=1,t!==void 0){if(t===b)throw RangeError(`Cyclic object value`);x=!0}y.get(ss)===void 0&&(b=0)}if(typeof l==`function`?v=l(t,v):v instanceof Date?v=f?.(v):n===`comma`&&Co(v)&&(v=ts(v,function(e){return e instanceof Date?f?.(e):e})),v===null){if(a)return c&&!h?c(t,as.encoder,g,`key`,p):t;v=``}if(os(v)||es(v)){if(c){let e=h?t:c(t,as.encoder,g,`key`,p);return[m?.(e)+`=`+m?.(c(v,as.encoder,g,`value`,p))]}return[m?.(t)+`=`+m?.(String(v))]}let S=[];if(v===void 0)return S;let C;if(n===`comma`&&Co(v))h&&c&&(v=ts(v,c)),C=[{value:v.length>0?v.join(`,`)||null:void 0}];else if(Co(l))C=l;else{let e=Object.keys(v);C=u?e.sort(u):e}let w=s?String(t).replace(/\./g,`%2E`):String(t),ee=r&&Co(v)&&v.length===1?w+`[]`:w;if(i&&Co(v)&&v.length===0)return ee+`[]`;for(let t=0;t<C.length;++t){let y=C[t],x=typeof y==`object`&&y.value!==void 0?y.value:v[y];if(o&&x===null)continue;let w=d&&s?y.replace(/\./g,`%2E`):y,te=Co(v)?typeof n==`function`?n(ee,w):ee:ee+(d?`.`+w:`[`+w+`]`);_.set(e,b);let T=new WeakMap;T.set(ss,_),rs(S,cs(x,te,n,r,i,a,o,s,n===`comma`&&h&&Co(v)?null:c,l,u,d,f,p,m,h,g,T))}return S}function ls(e=as){if(e.allowEmptyArrays!==void 0&&typeof e.allowEmptyArrays!=`boolean`)throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(e.encodeDotInKeys!==void 0&&typeof e.encodeDotInKeys!=`boolean`)throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&e.encoder!==void 0&&typeof e.encoder!=`function`)throw TypeError(`Encoder has to be a function.`);let t=e.charset||as.charset;if(e.charset!==void 0&&e.charset!==`utf-8`&&e.charset!==`iso-8859-1`)throw TypeError(`The charset option must be either utf-8, iso-8859-1, or undefined`);let n=qo;if(e.format!==void 0){if(!Xo(Yo,e.format))throw TypeError(`Unknown format option provided.`);n=e.format}let r=Yo[n],i=as.filter;(typeof e.filter==`function`||Co(e.filter))&&(i=e.filter);let a;if(a=e.arrayFormat&&e.arrayFormat in ns?e.arrayFormat:`indices`in e?e.indices?`indices`:`repeat`:as.arrayFormat,`commaRoundTrip`in e&&typeof e.commaRoundTrip!=`boolean`)throw TypeError("`commaRoundTrip` must be a boolean, or absent");let o=e.allowDots===void 0?e.encodeDotInKeys?!0:as.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix==`boolean`?e.addQueryPrefix:as.addQueryPrefix,allowDots:o,allowEmptyArrays:typeof e.allowEmptyArrays==`boolean`?!!e.allowEmptyArrays:as.allowEmptyArrays,arrayFormat:a,charset:t,charsetSentinel:typeof e.charsetSentinel==`boolean`?e.charsetSentinel:as.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:e.delimiter===void 0?as.delimiter:e.delimiter,encode:typeof e.encode==`boolean`?e.encode:as.encode,encodeDotInKeys:typeof e.encodeDotInKeys==`boolean`?e.encodeDotInKeys:as.encodeDotInKeys,encoder:typeof e.encoder==`function`?e.encoder:as.encoder,encodeValuesOnly:typeof e.encodeValuesOnly==`boolean`?e.encodeValuesOnly:as.encodeValuesOnly,filter:i,format:n,formatter:r,serializeDate:typeof e.serializeDate==`function`?e.serializeDate:as.serializeDate,skipNulls:typeof e.skipNulls==`boolean`?e.skipNulls:as.skipNulls,sort:typeof e.sort==`function`?e.sort:null,strictNullHandling:typeof e.strictNullHandling==`boolean`?e.strictNullHandling:as.strictNullHandling}}function us(e,t={}){let n=e,r=ls(t),i,a;typeof r.filter==`function`?(a=r.filter,n=a(``,n)):Co(r.filter)&&(a=r.filter,i=a);let o=[];if(typeof n!=`object`||!n)return``;let s=ns[r.arrayFormat],c=s===`comma`&&r.commaRoundTrip;i||=Object.keys(n),r.sort&&i.sort(r.sort);let l=new WeakMap;for(let e=0;e<i.length;++e){let t=i[e];r.skipNulls&&n[t]===null||rs(o,cs(n[t],t,s,c,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}let u=o.join(r.delimiter),d=r.addQueryPrefix===!0?`?`:``;return r.charsetSentinel&&(r.charset===`iso-8859-1`?d+=`utf8=%26%2310003%3B&`:d+=`utf8=%E2%9C%93&`),u.length>0?d+u:``}function ds(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}let fs;function ps(e){let t;return(fs??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}let ms;function hs(e){let t;return(ms??=(t=new globalThis.TextDecoder,t.decode.bind(t)))(e)}var gs,_s,vs=class{constructor(){gs.set(this,void 0),_s.set(this,void 0),K(this,gs,new Uint8Array,`f`),K(this,_s,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?ps(e):e;K(this,gs,ds([q(this,gs,`f`),t]),`f`);let n=[],r;for(;(r=ys(q(this,gs,`f`),q(this,_s,`f`)))!=null;){if(r.carriage&&q(this,_s,`f`)==null){K(this,_s,r.index,`f`);continue}if(q(this,_s,`f`)!=null&&(r.index!==q(this,_s,`f`)+1||r.carriage)){n.push(hs(q(this,gs,`f`).subarray(0,q(this,_s,`f`)-1))),K(this,gs,q(this,gs,`f`).subarray(q(this,_s,`f`)),`f`),K(this,_s,null,`f`);continue}let e=q(this,_s,`f`)===null?r.preceding:r.preceding-1,t=hs(q(this,gs,`f`).subarray(0,e));n.push(t),K(this,gs,q(this,gs,`f`).subarray(r.index),`f`),K(this,_s,null,`f`)}return n}flush(){return q(this,gs,`f`).length?this.decode(`
137
- `):[]}};gs=new WeakMap,_s=new WeakMap,vs.NEWLINE_CHARS=new Set([`
138
- `,`\r`]),vs.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function ys(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function bs(e){for(let t=0;t<e.length-1;t++){if(e[t]===10&&e[t+1]===10||e[t]===13&&e[t+1]===13)return t+2;if(e[t]===13&&e[t+1]===10&&t+3<e.length&&e[t+2]===13&&e[t+3]===10)return t+4}return-1}const xs={off:0,error:200,warn:300,info:400,debug:500},Ss=(e,t,n)=>{if(e){if(Do(xs,e))return e;Ds(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(xs))}`)}};function Cs(){}function ws(e,t,n){return!t||xs[e]>xs[n]?Cs:t[e].bind(t)}const Ts={error:Cs,warn:Cs,info:Cs,debug:Cs};let Es=new WeakMap;function Ds(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return Ts;let r=Es.get(t);if(r&&r[0]===n)return r[1];let i={error:ws(`error`,t,n),warn:ws(`warn`,t,n),info:ws(`info`,t,n),debug:ws(`debug`,t,n)};return Es.set(t,[n,i]),i}const Os=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`authorization`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t])),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e);var ks,As=class e{constructor(e,t,n){this.iterator=e,ks.set(this,void 0),this.controller=t,K(this,ks,n,`f`)}static fromSSEResponse(t,n,r){let i=!1,a=r?Ds(r):console;async function*o(){if(i)throw new J("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let r of js(t,n))if(!e){if(r.data.startsWith(`[DONE]`)){e=!0;continue}if(r.event===null||!r.event.startsWith(`thread.`)){let e;try{e=JSON.parse(r.data)}catch(e){throw a.error(`Could not parse message into JSON:`,r.data),a.error(`From chunk:`,r.raw),e}if(e&&e.error)throw new ao(void 0,e.error,void 0,t.headers);yield e}else{let e;try{e=JSON.parse(r.data)}catch(e){throw console.error(`Could not parse message into JSON:`,r.data),console.error(`From chunk:`,r.raw),e}if(r.event==`error`)throw new ao(void 0,e.error,e.message,void 0);yield{event:r.event,data:e}}}e=!0}catch(e){if(ro(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new vs,n=Wo(t);for await(let t of n)for(let n of e.decode(t))yield n;for(let t of e.flush())yield t}async function*o(){if(i)throw new J("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(ro(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(ks=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,q(this,ks,`f`)),new e(()=>i(n),this.controller,q(this,ks,`f`))]}toReadableStream(){let e=this,t;return Ho({async start(){t=e[Symbol.asyncIterator]()},async pull(e){try{let{value:n,done:r}=await t.next();if(r)return e.close();let i=ps(JSON.stringify(n)+`
139
- `);e.enqueue(i)}catch(t){e.error(t)}},async cancel(){await t.return?.()}})}};async function*js(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new J(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new J(`Attempted to iterate over a response with no body`);let n=new Ns,r=new vs,i=Wo(e.body);for await(let e of Ms(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}async function*Ms(e){let t=new Uint8Array;for await(let n of e){if(n==null)continue;let e=n instanceof ArrayBuffer?new Uint8Array(n):typeof n==`string`?ps(n):n,r=new Uint8Array(t.length+e.length);r.set(t),r.set(e,t.length),t=r;let i;for(;(i=bs(t))!==-1;)yield t.slice(0,i),t=t.slice(i)}t.length>0&&(yield t)}var Ns=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
140
- `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],e}if(this.chunks.push(e),e.startsWith(`:`))return null;let[t,n,r]=Ps(e,`:`);return r.startsWith(` `)&&(r=r.substring(1)),t===`event`?this.event=r:t===`data`&&this.data.push(r),null}};function Ps(e,t){let n=e.indexOf(t);return n===-1?[e,``,``]:[e.substring(0,n),t,e.substring(n+t.length)]}async function Fs(e,t){let{response:n,requestLogID:r,retryOfRequestLogID:i,startTime:a}=t,o=await(async()=>{if(t.options.stream)return Ds(e).debug(`response`,n.status,n.url,n.headers,n.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(n,t.controller,e):As.fromSSEResponse(n,t.controller,e);if(n.status===204)return null;if(t.options.__binaryResponse)return n;let r=n.headers.get(`content-type`)?.split(`;`)[0]?.trim();return r?.includes(`application/json`)||r?.endsWith(`+json`)?Is(await n.json(),n):await n.text()})();return Ds(e).debug(`[${r}] response parsed`,Os({retryOfRequestLogID:i,url:n.url,status:n.status,body:o,durationMs:Date.now()-a})),o}function Is(e,t){return!e||typeof e!=`object`||Array.isArray(e)?e:Object.defineProperty(e,`_request_id`,{value:t.headers.get(`x-request-id`),enumerable:!1})}var Ls,Rs=class e extends Promise{constructor(e,t,n=Fs){super(e=>{e(null)}),this.responsePromise=t,this.parseResponse=n,Ls.set(this,void 0),K(this,Ls,e,`f`)}_thenUnwrap(t){return new e(q(this,Ls,`f`),this.responsePromise,async(e,n)=>Is(t(await this.parseResponse(e,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t,request_id:t.headers.get(`x-request-id`)}}parse(){return this.parsedPromise||=this.responsePromise.then(e=>this.parseResponse(q(this,Ls,`f`),e)),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};Ls=new WeakMap;var zs,Bs=class{constructor(e,t,n,r){zs.set(this,void 0),K(this,zs,e,`f`),this.options=r,this.response=t,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new J("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await q(this,zs,`f`).requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(zs=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}},Vs=class extends Rs{constructor(e,t,n){super(e,t,async(e,t)=>new n(e,t.response,await Fs(e,t),t.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let t of e)yield t}},Hs=class extends Bs{constructor(e,t,n,r){super(e,t,n,r),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}},Y=class extends Bs{constructor(e,t,n,r){super(e,t,n,r),this.data=n.data||[],this.has_more=n.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.getPaginatedItems(),t=e[e.length-1]?.id;return t?{...this.options,query:{...To(this.options.query),after:t}}:null}},Us=class extends Bs{constructor(e,t,n,r){super(e,t,n,r),this.data=n.data||[],this.has_more=n.has_more||!1,this.last_id=n.last_id||``}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.last_id;return e?{...this.options,query:{...To(this.options.query),after:e}}:null}};const Ws=()=>{if(typeof File>`u`){let{process:e}=globalThis,t=typeof e?.versions?.node==`string`&&parseInt(e.versions.node.split(`.`))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(t?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":``))}};function Gs(e,t,n){return Ws(),new File(e,t??`unknown_file`,n)}function Ks(e){return(typeof e==`object`&&!!e&&(`name`in e&&e.name&&String(e.name)||`url`in e&&e.url&&String(e.url)||`filename`in e&&e.filename&&String(e.filename)||`path`in e&&e.path&&String(e.path))||``).split(/[\\/]/).pop()||void 0}const qs=e=>typeof e==`object`&&!!e&&typeof e[Symbol.asyncIterator]==`function`,Js=async(e,t)=>tc(e.body)?{...e,body:await Qs(e.body,t)}:e,Ys=async(e,t)=>({...e,body:await Qs(e.body,t)}),Xs=new WeakMap;function Zs(e){let t=typeof e==`function`?e:e.fetch,n=Xs.get(t);if(n)return n;let r=(async()=>{try{let e=`Response`in t?t.Response:(await t(`data:,`)).constructor,n=new FormData;return n.toString()!==await new e(n).text()}catch{return!0}})();return Xs.set(t,r),r}const Qs=async(e,t)=>{if(!await Zs(t))throw TypeError(`The provided fetch function does not support file uploads with the current global FormData class.`);let n=new FormData;return await Promise.all(Object.entries(e||{}).map(([e,t])=>nc(n,e,t))),n},$s=e=>e instanceof Blob&&`name`in e,ec=e=>typeof e==`object`&&!!e&&(e instanceof Response||qs(e)||$s(e)),tc=e=>{if(ec(e))return!0;if(Array.isArray(e))return e.some(tc);if(e&&typeof e==`object`){for(let t in e)if(tc(e[t]))return!0}return!1},nc=async(e,t,n)=>{if(n!==void 0){if(n==null)throw TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if(typeof n==`string`||typeof n==`number`||typeof n==`boolean`)e.append(t,String(n));else if(n instanceof Response)e.append(t,Gs([await n.blob()],Ks(n)));else if(qs(n))e.append(t,Gs([await new Response(Uo(n)).blob()],Ks(n)));else if($s(n))e.append(t,n,Ks(n));else if(Array.isArray(n))await Promise.all(n.map(n=>nc(e,t+`[]`,n)));else if(typeof n==`object`)await Promise.all(Object.entries(n).map(([n,r])=>nc(e,`${t}[${n}]`,r)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${n} instead`)}},rc=e=>typeof e==`object`&&!!e&&typeof e.size==`number`&&typeof e.type==`string`&&typeof e.text==`function`&&typeof e.slice==`function`&&typeof e.arrayBuffer==`function`,ic=e=>typeof e==`object`&&!!e&&typeof e.name==`string`&&typeof e.lastModified==`number`&&rc(e),ac=e=>typeof e==`object`&&!!e&&typeof e.url==`string`&&typeof e.blob==`function`;async function oc(e,t,n){if(Ws(),e=await e,ic(e))return e instanceof File?e:Gs([await e.arrayBuffer()],e.name);if(ac(e)){let r=await e.blob();return t||=new URL(e.url).pathname.split(/[\\/]/).pop(),Gs(await sc(r),t,n)}let r=await sc(e);if(t||=Ks(e),!n?.type){let e=r.find(e=>typeof e==`object`&&`type`in e&&e.type);typeof e==`string`&&(n={...n,type:e})}return Gs(r,t,n)}async function sc(e){let t=[];if(typeof e==`string`||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(rc(e))t.push(e instanceof Blob?e:await e.arrayBuffer());else if(qs(e))for await(let n of e)t.push(...await sc(n));else{let t=e?.constructor?.name;throw Error(`Unexpected data type: ${typeof e}${t?`; constructor: ${t}`:``}${cc(e)}`)}return t}function cc(e){return typeof e!=`object`||!e?``:`; props: [${Object.getOwnPropertyNames(e).map(e=>`"${e}"`).join(`, `)}]`}var X=class{constructor(e){this._client=e}};function lc(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}const uc=Object.freeze(Object.create(null)),Z=((e=lc)=>function(t,...n){if(t.length===1)return t[0];let r=!1,i=[],a=t.reduce((t,a,o)=>{/[?#]/.test(a)&&(r=!0);let s=n[o],c=(r?encodeURIComponent:e)(``+s);return o!==n.length&&(s==null||typeof s==`object`&&s.toString===Object.getPrototypeOf(Object.getPrototypeOf(s.hasOwnProperty??uc)??uc)?.toString)&&(c=s+``,i.push({start:t.length+a.length,length:c.length,error:`Value of type ${Object.prototype.toString.call(s).slice(8,-1)} is not a valid path parameter`})),t+a+(o===n.length?``:c)},``),o=a.split(/[?#]/,1)[0],s=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,c;for(;(c=s.exec(o))!==null;)i.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can\'t be safely passed as a path parameter`});if(i.sort((e,t)=>e.start-t.start),i.length>0){let e=0,t=i.reduce((t,n)=>{let r=` `.repeat(n.start-e),i=`^`.repeat(n.length);return e=n.start+n.length,t+r+i},``);throw new J(`Path parameters result in path with invalid segments:\n${i.map(e=>e.error).join(`
141
- `)}\n${a}\n${t}`)}return a})(lc);var dc=class extends X{list(e,t={},n){return this._client.getAPIList(Z`/chat/completions/${e}/messages`,Y,{query:t,...n})}};function fc(e){return e!==void 0&&`function`in e&&e.function!==void 0}function pc(e){return e?.$brand===`auto-parseable-response-format`}function mc(e){return e?.$brand===`auto-parseable-tool`}function hc(e,t){return!t||!bc(t)?{...e,choices:e.choices.map(e=>(xc(e.message.tool_calls),{...e,message:{...e.message,parsed:null,...e.message.tool_calls?{tool_calls:e.message.tool_calls}:void 0}}))}:gc(e,t)}function gc(e,t){let n=e.choices.map(e=>{if(e.finish_reason===`length`)throw new vo;if(e.finish_reason===`content_filter`)throw new yo;return xc(e.message.tool_calls),{...e,message:{...e.message,...e.message.tool_calls?{tool_calls:e.message.tool_calls?.map(e=>vc(t,e))??void 0}:void 0,parsed:e.message.content&&!e.message.refusal?_c(t,e.message.content):null}}});return{...e,choices:n}}function _c(e,t){return e.response_format?.type===`json_schema`&&e.response_format?.type===`json_schema`?`$parseRaw`in e.response_format?e.response_format.$parseRaw(t):JSON.parse(t):null}function vc(e,t){let n=e.tools?.find(e=>fc(e)&&e.function?.name===t.function.name);return{...t,function:{...t.function,parsed_arguments:mc(n)?n.$parseRaw(t.function.arguments):n?.function.strict?JSON.parse(t.function.arguments):null}}}function yc(e,t){if(!e||!(`tools`in e)||!e.tools)return!1;let n=e.tools?.find(e=>fc(e)&&e.function?.name===t.function.name);return fc(n)&&(mc(n)||n?.function.strict||!1)}function bc(e){return pc(e.response_format)?!0:e.tools?.some(e=>mc(e)||e.type===`function`&&e.function.strict===!0)??!1}function xc(e){for(let t of e||[])if(t.type!==`function`)throw new J(`Currently only \`function\` tool calls are supported; Received \`${t.type}\``)}function Sc(e){for(let t of e??[]){if(t.type!==`function`)throw new J(`Currently only \`function\` tool types support auto-parsing; Received \`${t.type}\``);if(t.function.strict!==!0)throw new J(`The \`${t.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}const Cc=e=>e?.role===`assistant`,wc=e=>e?.role===`tool`;var Tc,Ec,Dc,Oc,kc,Ac,jc,Mc,Nc,Pc,Fc,Ic,Lc,Rc=class{constructor(){Tc.add(this),this.controller=new AbortController,Ec.set(this,void 0),Dc.set(this,()=>{}),Oc.set(this,()=>{}),kc.set(this,void 0),Ac.set(this,()=>{}),jc.set(this,()=>{}),Mc.set(this,{}),Nc.set(this,!1),Pc.set(this,!1),Fc.set(this,!1),Ic.set(this,!1),K(this,Ec,new Promise((e,t)=>{K(this,Dc,e,`f`),K(this,Oc,t,`f`)}),`f`),K(this,kc,new Promise((e,t)=>{K(this,Ac,e,`f`),K(this,jc,t,`f`)}),`f`),q(this,Ec,`f`).catch(()=>{}),q(this,kc,`f`).catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit(`end`)},q(this,Tc,`m`,Lc).bind(this))},0)}_connected(){this.ended||(q(this,Dc,`f`).call(this),this._emit(`connect`))}get ended(){return q(this,Nc,`f`)}get errored(){return q(this,Pc,`f`)}get aborted(){return q(this,Fc,`f`)}abort(){this.controller.abort()}on(e,t){return(q(this,Mc,`f`)[e]||(q(this,Mc,`f`)[e]=[])).push({listener:t}),this}off(e,t){let n=q(this,Mc,`f`)[e];if(!n)return this;let r=n.findIndex(e=>e.listener===t);return r>=0&&n.splice(r,1),this}once(e,t){return(q(this,Mc,`f`)[e]||(q(this,Mc,`f`)[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,n)=>{K(this,Ic,!0,`f`),e!==`error`&&this.once(`error`,n),this.once(e,t)})}async done(){K(this,Ic,!0,`f`),await q(this,kc,`f`)}_emit(e,...t){if(q(this,Nc,`f`))return;e===`end`&&(K(this,Nc,!0,`f`),q(this,Ac,`f`).call(this));let n=q(this,Mc,`f`)[e];if(n&&(q(this,Mc,`f`)[e]=n.filter(e=>!e.once),n.forEach(({listener:e})=>e(...t))),e===`abort`){let e=t[0];!q(this,Ic,`f`)&&!n?.length&&Promise.reject(e),q(this,Oc,`f`).call(this,e),q(this,jc,`f`).call(this,e),this._emit(`end`);return}if(e===`error`){let e=t[0];!q(this,Ic,`f`)&&!n?.length&&Promise.reject(e),q(this,Oc,`f`).call(this,e),q(this,jc,`f`).call(this,e),this._emit(`end`)}}_emitFinal(){}};Ec=new WeakMap,Dc=new WeakMap,Oc=new WeakMap,kc=new WeakMap,Ac=new WeakMap,jc=new WeakMap,Mc=new WeakMap,Nc=new WeakMap,Pc=new WeakMap,Fc=new WeakMap,Ic=new WeakMap,Tc=new WeakSet,Lc=function(e){if(K(this,Pc,!0,`f`),e instanceof Error&&e.name===`AbortError`&&(e=new oo),e instanceof oo)return K(this,Fc,!0,`f`),this._emit(`abort`,e);if(e instanceof J)return this._emit(`error`,e);if(e instanceof Error){let t=new J(e.message);return t.cause=e,this._emit(`error`,t)}return this._emit(`error`,new J(String(e)))};function zc(e){return typeof e.parse==`function`}var Bc,Vc,Hc,Uc,Wc,Gc,Kc,qc,Jc=class extends Rc{constructor(){super(...arguments),Bc.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit(`chatCompletion`,e);let t=e.choices[0]?.message;return t&&this._addMessage(t),e}_addMessage(e,t=!0){if(`content`in e||(e.content=null),this.messages.push(e),t){if(this._emit(`message`,e),wc(e)&&e.content)this._emit(`functionToolCallResult`,e.content);else if(Cc(e)&&e.tool_calls)for(let t of e.tool_calls)t.type===`function`&&this._emit(`functionToolCall`,t.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new J(`stream ended without producing a ChatCompletion`);return e}async finalContent(){return await this.done(),q(this,Bc,`m`,Vc).call(this)}async finalMessage(){return await this.done(),q(this,Bc,`m`,Hc).call(this)}async finalFunctionToolCall(){return await this.done(),q(this,Bc,`m`,Uc).call(this)}async finalFunctionToolCallResult(){return await this.done(),q(this,Bc,`m`,Wc).call(this)}async totalUsage(){return await this.done(),q(this,Bc,`m`,Gc).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit(`finalChatCompletion`,e);let t=q(this,Bc,`m`,Hc).call(this);t&&this._emit(`finalMessage`,t);let n=q(this,Bc,`m`,Vc).call(this);n&&this._emit(`finalContent`,n);let r=q(this,Bc,`m`,Uc).call(this);r&&this._emit(`finalFunctionToolCall`,r);let i=q(this,Bc,`m`,Wc).call(this);i!=null&&this._emit(`finalFunctionToolCallResult`,i),this._chatCompletions.some(e=>e.usage)&&this._emit(`totalUsage`,q(this,Bc,`m`,Gc).call(this))}async _createChatCompletion(e,t,n){let r=n?.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener(`abort`,()=>this.controller.abort())),q(this,Bc,`m`,Kc).call(this,t);let i=await e.chat.completions.create({...t,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(gc(i,t))}async _runChatCompletion(e,t,n){for(let e of t.messages)this._addMessage(e,!1);return await this._createChatCompletion(e,t,n)}async _runTools(e,t,n){let r=`tool`,{tool_choice:i=`auto`,stream:a,...o}=t,s=typeof i!=`string`&&i.type===`function`&&i?.function?.name,{maxChatCompletions:c=10}=n||{},l=t.tools.map(e=>{if(mc(e)){if(!e.$callback)throw new J("Tool given to `.runTools()` that does not have an associated function");return{type:`function`,function:{function:e.$callback,name:e.function.name,description:e.function.description||``,parameters:e.function.parameters,parse:e.$parseRaw,strict:!0}}}return e}),u={};for(let e of l)e.type===`function`&&(u[e.function.name||e.function.function.name]=e.function);let d=`tools`in t?l.map(e=>e.type===`function`?{type:`function`,function:{name:e.function.name||e.function.function.name,parameters:e.function.parameters,description:e.function.description,strict:e.function.strict}}:e):void 0;for(let e of t.messages)this._addMessage(e,!1);for(let t=0;t<c;++t){let t=(await this._createChatCompletion(e,{...o,tool_choice:i,tools:d,messages:[...this.messages]},n)).choices[0]?.message;if(!t)throw new J(`missing message in ChatCompletion response`);if(!t.tool_calls?.length)return;for(let e of t.tool_calls){if(e.type!==`function`)continue;let t=e.id,{name:n,arguments:i}=e.function,a=u[n];if(a){if(s&&s!==n){let e=`Invalid tool_call: ${JSON.stringify(n)}. ${JSON.stringify(s)} requested. Please try again`;this._addMessage({role:r,tool_call_id:t,content:e});continue}}else{let e=`Invalid tool_call: ${JSON.stringify(n)}. Available options are: ${Object.keys(u).map(e=>JSON.stringify(e)).join(`, `)}. Please try again`;this._addMessage({role:r,tool_call_id:t,content:e});continue}let o;try{o=zc(a)?await a.parse(i):i}catch(e){let n=e instanceof Error?e.message:String(e);this._addMessage({role:r,tool_call_id:t,content:n});continue}let c=await a.function(o,this),l=q(this,Bc,`m`,qc).call(this,c);if(this._addMessage({role:r,tool_call_id:t,content:l}),s)return}}}};Bc=new WeakSet,Vc=function(){return q(this,Bc,`m`,Hc).call(this).content??null},Hc=function(){let e=this.messages.length;for(;e-- >0;){let t=this.messages[e];if(Cc(t))return{...t,content:t.content??null,refusal:t.refusal??null}}throw new J(`stream ended without producing a ChatCompletionMessage with role=assistant`)},Uc=function(){for(let e=this.messages.length-1;e>=0;e--){let t=this.messages[e];if(Cc(t)&&t?.tool_calls?.length)return t.tool_calls.filter(e=>e.type===`function`).at(-1)?.function}},Wc=function(){for(let e=this.messages.length-1;e>=0;e--){let t=this.messages[e];if(wc(t)&&t.content!=null&&typeof t.content==`string`&&this.messages.some(e=>e.role===`assistant`&&e.tool_calls?.some(e=>e.type===`function`&&e.id===t.tool_call_id)))return t.content}},Gc=function(){let e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:t}of this._chatCompletions)t&&(e.completion_tokens+=t.completion_tokens,e.prompt_tokens+=t.prompt_tokens,e.total_tokens+=t.total_tokens);return e},Kc=function(e){if(e.n!=null&&e.n>1)throw new J(`ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.`)},qc=function(e){return typeof e==`string`?e:e===void 0?`undefined`:JSON.stringify(e)};var Yc=class e extends Jc{static runTools(t,n,r){let i=new e,a={...r,headers:{...r?.headers,"X-Stainless-Helper-Method":`runTools`}};return i._run(()=>i._runTools(t,n,a)),i}_addMessage(e,t=!0){super._addMessage(e,t),Cc(e)&&e.content&&this._emit(`content`,e.content)}};const Xc={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511};var Zc=class extends Error{},Qc=class extends Error{};function $c(e,t=Xc.ALL){if(typeof e!=`string`)throw TypeError(`expecting str, got ${typeof e}`);if(!e.trim())throw Error(`${e} is empty`);return el(e.trim(),t)}const el=(e,t)=>{let n=e.length,r=0,i=e=>{throw new Zc(`${e} at position ${r}`)},a=e=>{throw new Qc(`${e} at position ${r}`)},o=()=>(d(),r>=n&&i(`Unexpected end of input`),e[r]===`"`?s():e[r]===`{`?c():e[r]===`[`?l():e.substring(r,r+4)===`null`||Xc.NULL&t&&n-r<4&&`null`.startsWith(e.substring(r))?(r+=4,null):e.substring(r,r+4)===`true`||Xc.BOOL&t&&n-r<4&&`true`.startsWith(e.substring(r))?(r+=4,!0):e.substring(r,r+5)===`false`||Xc.BOOL&t&&n-r<5&&`false`.startsWith(e.substring(r))?(r+=5,!1):e.substring(r,r+8)===`Infinity`||Xc.INFINITY&t&&n-r<8&&`Infinity`.startsWith(e.substring(r))?(r+=8,1/0):e.substring(r,r+9)===`-Infinity`||Xc.MINUS_INFINITY&t&&1<n-r&&n-r<9&&`-Infinity`.startsWith(e.substring(r))?(r+=9,-1/0):e.substring(r,r+3)===`NaN`||Xc.NAN&t&&n-r<3&&`NaN`.startsWith(e.substring(r))?(r+=3,NaN):u()),s=()=>{let o=r,s=!1;for(r++;r<n&&(e[r]!==`"`||s&&e[r-1]===`\\`);)s=e[r]===`\\`?!s:!1,r++;if(e.charAt(r)==`"`)try{return JSON.parse(e.substring(o,++r-Number(s)))}catch(e){a(String(e))}else if(Xc.STR&t)try{return JSON.parse(e.substring(o,r-Number(s))+`"`)}catch{return JSON.parse(e.substring(o,e.lastIndexOf(`\\`))+`"`)}i(`Unterminated string literal`)},c=()=>{r++,d();let a={};try{for(;e[r]!==`}`;){if(d(),r>=n&&Xc.OBJ&t)return a;let i=s();d(),r++;try{let e=o();Object.defineProperty(a,i,{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){if(Xc.OBJ&t)return a;throw e}d(),e[r]===`,`&&r++}}catch{if(Xc.OBJ&t)return a;i(`Expected '}' at end of object`)}return r++,a},l=()=>{r++;let n=[];try{for(;e[r]!==`]`;)n.push(o()),d(),e[r]===`,`&&r++}catch{if(Xc.ARR&t)return n;i(`Expected ']' at end of array`)}return r++,n},u=()=>{if(r===0){e===`-`&&Xc.NUM&t&&i(`Not sure what '-' is`);try{return JSON.parse(e)}catch(n){if(Xc.NUM&t)try{return e[e.length-1]===`.`?JSON.parse(e.substring(0,e.lastIndexOf(`.`))):JSON.parse(e.substring(0,e.lastIndexOf(`e`)))}catch{}a(String(n))}}let o=r;for(e[r]===`-`&&r++;e[r]&&!`,]}`.includes(e[r]);)r++;r==n&&!(Xc.NUM&t)&&i(`Unterminated number literal`);try{return JSON.parse(e.substring(o,r))}catch{e.substring(o,r)===`-`&&Xc.NUM&t&&i(`Not sure what '-' is`);try{return JSON.parse(e.substring(o,e.lastIndexOf(`e`)))}catch(e){a(String(e))}}},d=()=>{for(;r<n&&`
142
- \r `.includes(e[r]);)r++};return o()},tl=e=>$c(e,Xc.ALL^Xc.NUM);var nl,rl,il,al,ol,sl,cl,ll,ul,dl,fl,pl,ml=class e extends Jc{constructor(e){super(),nl.add(this),rl.set(this,void 0),il.set(this,void 0),al.set(this,void 0),K(this,rl,e,`f`),K(this,il,[],`f`)}get currentChatCompletionSnapshot(){return q(this,al,`f`)}static fromReadableStream(t){let n=new e(null);return n._run(()=>n._fromReadableStream(t)),n}static createChatCompletion(t,n,r){let i=new e(n);return i._run(()=>i._runChatCompletion(t,{...n,stream:!0},{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":`stream`}})),i}async _createChatCompletion(e,t,n){super._createChatCompletion;let r=n?.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener(`abort`,()=>this.controller.abort())),q(this,nl,`m`,ol).call(this);let i=await e.chat.completions.create({...t,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let e of i)q(this,nl,`m`,cl).call(this,e);if(i.controller.signal?.aborted)throw new oo;return this._addChatCompletion(q(this,nl,`m`,dl).call(this))}async _fromReadableStream(e,t){let n=t?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener(`abort`,()=>this.controller.abort())),q(this,nl,`m`,ol).call(this),this._connected();let r=As.fromReadableStream(e,this.controller),i;for await(let e of r)i&&i!==e.id&&this._addChatCompletion(q(this,nl,`m`,dl).call(this)),q(this,nl,`m`,cl).call(this,e),i=e.id;if(r.controller.signal?.aborted)throw new oo;return this._addChatCompletion(q(this,nl,`m`,dl).call(this))}[(rl=new WeakMap,il=new WeakMap,al=new WeakMap,nl=new WeakSet,ol=function(){this.ended||K(this,al,void 0,`f`)},sl=function(e){let t=q(this,il,`f`)[e.index];return t||(t={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},q(this,il,`f`)[e.index]=t,t)},cl=function(e){if(this.ended)return;let t=q(this,nl,`m`,pl).call(this,e);this._emit(`chunk`,e,t);for(let n of e.choices){let e=t.choices[n.index];n.delta.content!=null&&e.message?.role===`assistant`&&e.message?.content&&(this._emit(`content`,n.delta.content,e.message.content),this._emit(`content.delta`,{delta:n.delta.content,snapshot:e.message.content,parsed:e.message.parsed})),n.delta.refusal!=null&&e.message?.role===`assistant`&&e.message?.refusal&&this._emit(`refusal.delta`,{delta:n.delta.refusal,snapshot:e.message.refusal}),n.logprobs?.content!=null&&e.message?.role===`assistant`&&this._emit(`logprobs.content.delta`,{content:n.logprobs?.content,snapshot:e.logprobs?.content??[]}),n.logprobs?.refusal!=null&&e.message?.role===`assistant`&&this._emit(`logprobs.refusal.delta`,{refusal:n.logprobs?.refusal,snapshot:e.logprobs?.refusal??[]});let r=q(this,nl,`m`,sl).call(this,e);e.finish_reason&&(q(this,nl,`m`,ul).call(this,e),r.current_tool_call_index!=null&&q(this,nl,`m`,ll).call(this,e,r.current_tool_call_index));for(let t of n.delta.tool_calls??[])r.current_tool_call_index!==t.index&&(q(this,nl,`m`,ul).call(this,e),r.current_tool_call_index!=null&&q(this,nl,`m`,ll).call(this,e,r.current_tool_call_index)),r.current_tool_call_index=t.index;for(let t of n.delta.tool_calls??[]){let n=e.message.tool_calls?.[t.index];n?.type&&(n?.type===`function`?this._emit(`tool_calls.function.arguments.delta`,{name:n.function?.name,index:t.index,arguments:n.function.arguments,parsed_arguments:n.function.parsed_arguments,arguments_delta:t.function?.arguments??``}):n?.type)}}},ll=function(e,t){if(q(this,nl,`m`,sl).call(this,e).done_tool_calls.has(t))return;let n=e.message.tool_calls?.[t];if(!n)throw Error(`no tool call snapshot`);if(!n.type)throw Error("tool call snapshot missing `type`");if(n.type===`function`){let e=q(this,rl,`f`)?.tools?.find(e=>fc(e)&&e.function.name===n.function.name);this._emit(`tool_calls.function.arguments.done`,{name:n.function.name,index:t,arguments:n.function.arguments,parsed_arguments:mc(e)?e.$parseRaw(n.function.arguments):e?.function.strict?JSON.parse(n.function.arguments):null})}else n.type},ul=function(e){let t=q(this,nl,`m`,sl).call(this,e);if(e.message.content&&!t.content_done){t.content_done=!0;let n=q(this,nl,`m`,fl).call(this);this._emit(`content.done`,{content:e.message.content,parsed:n?n.$parseRaw(e.message.content):null})}e.message.refusal&&!t.refusal_done&&(t.refusal_done=!0,this._emit(`refusal.done`,{refusal:e.message.refusal})),e.logprobs?.content&&!t.logprobs_content_done&&(t.logprobs_content_done=!0,this._emit(`logprobs.content.done`,{content:e.logprobs.content})),e.logprobs?.refusal&&!t.logprobs_refusal_done&&(t.logprobs_refusal_done=!0,this._emit(`logprobs.refusal.done`,{refusal:e.logprobs.refusal}))},dl=function(){if(this.ended)throw new J(`stream has ended, this shouldn't happen`);let e=q(this,al,`f`);if(!e)throw new J(`request ended without sending any chunks`);return K(this,al,void 0,`f`),K(this,il,[],`f`),hl(e,q(this,rl,`f`))},fl=function(){let e=q(this,rl,`f`)?.response_format;return pc(e)?e:null},pl=function(e){var t,n,r,i;let a=q(this,al,`f`),{choices:o,...s}=e;a?Object.assign(a,s):a=K(this,al,{...s,choices:[]},`f`);for(let{delta:o,finish_reason:s,index:c,logprobs:l=null,...u}of e.choices){let e=a.choices[c];if(e||=a.choices[c]={finish_reason:s,index:c,message:{},logprobs:l,...u},l)if(!e.logprobs)e.logprobs=Object.assign({},l);else{let{content:r,refusal:i,...a}=l;Object.assign(e.logprobs,a),r&&((t=e.logprobs).content??(t.content=[]),e.logprobs.content.push(...r)),i&&((n=e.logprobs).refusal??(n.refusal=[]),e.logprobs.refusal.push(...i))}if(s&&(e.finish_reason=s,q(this,rl,`f`)&&bc(q(this,rl,`f`)))){if(s===`length`)throw new vo;if(s===`content_filter`)throw new yo}if(Object.assign(e,u),!o)continue;let{content:d,refusal:f,function_call:p,role:m,tool_calls:h,...g}=o;if(Object.assign(e.message,g),f&&(e.message.refusal=(e.message.refusal||``)+f),m&&(e.message.role=m),p&&(e.message.function_call?(p.name&&(e.message.function_call.name=p.name),p.arguments&&((r=e.message.function_call).arguments??(r.arguments=``),e.message.function_call.arguments+=p.arguments)):e.message.function_call=p),d&&(e.message.content=(e.message.content||``)+d,!e.message.refusal&&q(this,nl,`m`,fl).call(this)&&(e.message.parsed=tl(e.message.content))),h){e.message.tool_calls||(e.message.tool_calls=[]);for(let{index:t,id:n,type:r,function:a,...o}of h){let s=(i=e.message.tool_calls)[t]??(i[t]={});Object.assign(s,o),n&&(s.id=n),r&&(s.type=r),a&&(s.function??={name:a.name??``,arguments:``}),a?.name&&(s.function.name=a.name),a?.arguments&&(s.function.arguments+=a.arguments,yc(q(this,rl,`f`),s)&&(s.function.parsed_arguments=tl(s.function.arguments)))}}}return a},Symbol.asyncIterator)](){let e=[],t=[],n=!1;return this.on(`chunk`,n=>{let r=t.shift();r?r.resolve(n):e.push(n)}),this.on(`end`,()=>{n=!0;for(let e of t)e.resolve(void 0);t.length=0}),this.on(`abort`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),this.on(`error`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((e,n)=>t.push({resolve:e,reject:n})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new As(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};function hl(e,t){let{id:n,choices:r,created:i,model:a,system_fingerprint:o,...s}=e;return hc({...s,id:n,choices:r.map(({message:t,finish_reason:n,index:r,logprobs:i,...a})=>{if(!n)throw new J(`missing finish_reason for choice ${r}`);let{content:o=null,function_call:s,tool_calls:c,...l}=t,u=t.role;if(!u)throw new J(`missing role for choice ${r}`);if(s){let{arguments:e,name:c}=s;if(e==null)throw new J(`missing function_call.arguments for choice ${r}`);if(!c)throw new J(`missing function_call.name for choice ${r}`);return{...a,message:{content:o,function_call:{arguments:e,name:c},role:u,refusal:t.refusal??null},finish_reason:n,index:r,logprobs:i}}return c?{...a,index:r,finish_reason:n,logprobs:i,message:{...l,role:u,content:o,refusal:t.refusal??null,tool_calls:c.map((t,n)=>{let{function:i,type:a,id:o,...s}=t,{arguments:c,name:l,...u}=i||{};if(o==null)throw new J(`missing choices[${r}].tool_calls[${n}].id\n${gl(e)}`);if(a==null)throw new J(`missing choices[${r}].tool_calls[${n}].type\n${gl(e)}`);if(l==null)throw new J(`missing choices[${r}].tool_calls[${n}].function.name\n${gl(e)}`);if(c==null)throw new J(`missing choices[${r}].tool_calls[${n}].function.arguments\n${gl(e)}`);return{...s,id:o,type:a,function:{...u,name:l,arguments:c}}})}}:{...a,message:{...l,content:o,role:u,refusal:t.refusal??null},finish_reason:n,index:r,logprobs:i}}),created:i,model:a,object:`chat.completion`,...o?{system_fingerprint:o}:{}},t)}function gl(e){return JSON.stringify(e)}var _l=class e extends ml{static fromReadableStream(t){let n=new e(null);return n._run(()=>n._fromReadableStream(t)),n}static runTools(t,n,r){let i=new e(n),a={...r,headers:{...r?.headers,"X-Stainless-Helper-Method":`runTools`}};return i._run(()=>i._runTools(t,n,a)),i}},vl=class extends X{constructor(){super(...arguments),this.messages=new dc(this._client)}create(e,t){return this._client.post(`/chat/completions`,{body:e,...t,stream:e.stream??!1})}retrieve(e,t){return this._client.get(Z`/chat/completions/${e}`,t)}update(e,t,n){return this._client.post(Z`/chat/completions/${e}`,{body:t,...n})}list(e={},t){return this._client.getAPIList(`/chat/completions`,Y,{query:e,...t})}delete(e,t){return this._client.delete(Z`/chat/completions/${e}`,t)}parse(e,t){return Sc(e.tools),this._client.chat.completions.create(e,{...t,headers:{...t?.headers,"X-Stainless-Helper-Method":`chat.completions.parse`}})._thenUnwrap(t=>gc(t,e))}runTools(e,t){return e.stream?_l.runTools(this._client,e,t):Yc.runTools(this._client,e,t)}stream(e,t){return ml.createChatCompletion(this._client,e,t)}};vl.Messages=dc;var yl=class extends X{constructor(){super(...arguments),this.completions=new vl(this._client)}};yl.Completions=vl;const bl=Symbol(`brand.privateNullableHeaders`);function*xl(e){if(!e)return;if(bl in e){let{values:t,nulls:n}=e;yield*t.entries();for(let e of n)yield[e,null];return}let t=!1,n;e instanceof Headers?n=e.entries():wo(e)?n=e:(t=!0,n=Object.entries(e??{}));for(let e of n){let n=e[0];if(typeof n!=`string`)throw TypeError(`expected header name to be a string`);let r=wo(e[1])?e[1]:[e[1]],i=!1;for(let e of r)e!==void 0&&(t&&!i&&(i=!0,yield[n,null]),yield[n,e])}}const Q=e=>{let t=new Headers,n=new Set;for(let r of e){let e=new Set;for(let[i,a]of xl(r)){let r=i.toLowerCase();e.has(r)||(t.delete(i),e.add(r)),a===null?(t.delete(i),n.add(r)):(t.append(i,a),n.delete(r))}}return{[bl]:!0,values:t,nulls:n}};var Sl=class extends X{create(e,t){return this._client.post(`/audio/speech`,{body:e,...t,headers:Q([{Accept:`application/octet-stream`},t?.headers]),__binaryResponse:!0})}},Cl=class extends X{create(e,t){return this._client.post(`/audio/transcriptions`,Ys({body:e,...t,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}},wl=class extends X{create(e,t){return this._client.post(`/audio/translations`,Ys({body:e,...t,__metadata:{model:e.model}},this._client))}},Tl=class extends X{constructor(){super(...arguments),this.transcriptions=new Cl(this._client),this.translations=new wl(this._client),this.speech=new Sl(this._client)}};Tl.Transcriptions=Cl,Tl.Translations=wl,Tl.Speech=Sl;var El=class extends X{create(e,t){return this._client.post(`/batches`,{body:e,...t})}retrieve(e,t){return this._client.get(Z`/batches/${e}`,t)}list(e={},t){return this._client.getAPIList(`/batches`,Y,{query:e,...t})}cancel(e,t){return this._client.post(Z`/batches/${e}/cancel`,t)}},Dl=class extends X{create(e,t){return this._client.post(`/assistants`,{body:e,...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}retrieve(e,t){return this._client.get(Z`/assistants/${e}`,{...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}update(e,t,n){return this._client.post(Z`/assistants/${e}`,{body:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}list(e={},t){return this._client.getAPIList(`/assistants`,Y,{query:e,...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}delete(e,t){return this._client.delete(Z`/assistants/${e}`,{...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}},Ol=class extends X{create(e,t){return this._client.post(`/realtime/sessions`,{body:e,...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}},kl=class extends X{create(e,t){return this._client.post(`/realtime/transcription_sessions`,{body:e,...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}},Al=class extends X{constructor(){super(...arguments),this.sessions=new Ol(this._client),this.transcriptionSessions=new kl(this._client)}};Al.Sessions=Ol,Al.TranscriptionSessions=kl;var jl=class extends X{create(e,t){return this._client.post(`/chatkit/sessions`,{body:e,...t,headers:Q([{"OpenAI-Beta":`chatkit_beta=v1`},t?.headers])})}cancel(e,t){return this._client.post(Z`/chatkit/sessions/${e}/cancel`,{...t,headers:Q([{"OpenAI-Beta":`chatkit_beta=v1`},t?.headers])})}},Ml=class extends X{retrieve(e,t){return this._client.get(Z`/chatkit/threads/${e}`,{...t,headers:Q([{"OpenAI-Beta":`chatkit_beta=v1`},t?.headers])})}list(e={},t){return this._client.getAPIList(`/chatkit/threads`,Us,{query:e,...t,headers:Q([{"OpenAI-Beta":`chatkit_beta=v1`},t?.headers])})}delete(e,t){return this._client.delete(Z`/chatkit/threads/${e}`,{...t,headers:Q([{"OpenAI-Beta":`chatkit_beta=v1`},t?.headers])})}listItems(e,t={},n){return this._client.getAPIList(Z`/chatkit/threads/${e}/items`,Us,{query:t,...n,headers:Q([{"OpenAI-Beta":`chatkit_beta=v1`},n?.headers])})}},Nl=class extends X{constructor(){super(...arguments),this.sessions=new jl(this._client),this.threads=new Ml(this._client)}};Nl.Sessions=jl,Nl.Threads=Ml;var Pl=class extends X{create(e,t,n){return this._client.post(Z`/threads/${e}/messages`,{body:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}retrieve(e,t,n){let{thread_id:r}=t;return this._client.get(Z`/threads/${r}/messages/${e}`,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}update(e,t,n){let{thread_id:r,...i}=t;return this._client.post(Z`/threads/${r}/messages/${e}`,{body:i,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}list(e,t={},n){return this._client.getAPIList(Z`/threads/${e}/messages`,Y,{query:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}delete(e,t,n){let{thread_id:r}=t;return this._client.delete(Z`/threads/${r}/messages/${e}`,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}},Fl=class extends X{retrieve(e,t,n){let{thread_id:r,run_id:i,...a}=t;return this._client.get(Z`/threads/${r}/runs/${i}/steps/${e}`,{query:a,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}list(e,t,n){let{thread_id:r,...i}=t;return this._client.getAPIList(Z`/threads/${r}/runs/${e}/steps`,Y,{query:i,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}};const Il=e=>{if(typeof Buffer<`u`){let t=Buffer.from(e,`base64`);return Array.from(new Float32Array(t.buffer,t.byteOffset,t.length/Float32Array.BYTES_PER_ELEMENT))}else{let t=atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return Array.from(new Float32Array(r.buffer))}},Ll=e=>{if(globalThis.process!==void 0)return globalThis.process.env?.[e]?.trim()??void 0;if(globalThis.Deno!==void 0)return globalThis.Deno.env?.get?.(e)?.trim()};var Rl,zl,Bl,Vl,Hl,Ul,Wl,Gl,Kl,ql,Jl,Yl,Xl,Zl,Ql,$l,eu,tu,nu,ru,iu,au,ou,su=class extends Rc{constructor(){super(...arguments),Rl.add(this),Bl.set(this,[]),Vl.set(this,{}),Hl.set(this,{}),Ul.set(this,void 0),Wl.set(this,void 0),Gl.set(this,void 0),Kl.set(this,void 0),ql.set(this,void 0),Jl.set(this,void 0),Yl.set(this,void 0),Xl.set(this,void 0),Zl.set(this,void 0)}[(Bl=new WeakMap,Vl=new WeakMap,Hl=new WeakMap,Ul=new WeakMap,Wl=new WeakMap,Gl=new WeakMap,Kl=new WeakMap,ql=new WeakMap,Jl=new WeakMap,Yl=new WeakMap,Xl=new WeakMap,Zl=new WeakMap,Rl=new WeakSet,Symbol.asyncIterator)](){let e=[],t=[],n=!1;return this.on(`event`,n=>{let r=t.shift();r?r.resolve(n):e.push(n)}),this.on(`end`,()=>{n=!0;for(let e of t)e.resolve(void 0);t.length=0}),this.on(`abort`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),this.on(`error`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((e,n)=>t.push({resolve:e,reject:n})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let t=new zl;return t._run(()=>t._fromReadableStream(e)),t}async _fromReadableStream(e,t){let n=t?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener(`abort`,()=>this.controller.abort())),this._connected();let r=As.fromReadableStream(e,this.controller);for await(let e of r)q(this,Rl,`m`,Ql).call(this,e);if(r.controller.signal?.aborted)throw new oo;return this._addRun(q(this,Rl,`m`,$l).call(this))}toReadableStream(){return new As(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,t,n,r){let i=new zl;return i._run(()=>i._runToolAssistantStream(e,t,n,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":`stream`}})),i}async _createToolAssistantStream(e,t,n,r){let i=r?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener(`abort`,()=>this.controller.abort()));let a={...n,stream:!0},o=await e.submitToolOutputs(t,a,{...r,signal:this.controller.signal});this._connected();for await(let e of o)q(this,Rl,`m`,Ql).call(this,e);if(o.controller.signal?.aborted)throw new oo;return this._addRun(q(this,Rl,`m`,$l).call(this))}static createThreadAssistantStream(e,t,n){let r=new zl;return r._run(()=>r._threadAssistantStream(e,t,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":`stream`}})),r}static createAssistantStream(e,t,n,r){let i=new zl;return i._run(()=>i._runAssistantStream(e,t,n,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":`stream`}})),i}currentEvent(){return q(this,Yl,`f`)}currentRun(){return q(this,Xl,`f`)}currentMessageSnapshot(){return q(this,Ul,`f`)}currentRunStepSnapshot(){return q(this,Zl,`f`)}async finalRunSteps(){return await this.done(),Object.values(q(this,Vl,`f`))}async finalMessages(){return await this.done(),Object.values(q(this,Hl,`f`))}async finalRun(){if(await this.done(),!q(this,Wl,`f`))throw Error(`Final run was not received.`);return q(this,Wl,`f`)}async _createThreadAssistantStream(e,t,n){let r=n?.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener(`abort`,()=>this.controller.abort()));let i={...t,stream:!0},a=await e.createAndRun(i,{...n,signal:this.controller.signal});this._connected();for await(let e of a)q(this,Rl,`m`,Ql).call(this,e);if(a.controller.signal?.aborted)throw new oo;return this._addRun(q(this,Rl,`m`,$l).call(this))}async _createAssistantStream(e,t,n,r){let i=r?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener(`abort`,()=>this.controller.abort()));let a={...n,stream:!0},o=await e.create(t,a,{...r,signal:this.controller.signal});this._connected();for await(let e of o)q(this,Rl,`m`,Ql).call(this,e);if(o.controller.signal?.aborted)throw new oo;return this._addRun(q(this,Rl,`m`,$l).call(this))}static accumulateDelta(e,t){for(let[n,r]of Object.entries(t)){if(!e.hasOwnProperty(n)){e[n]=r;continue}let t=e[n];if(t==null){e[n]=r;continue}if(n===`index`||n===`type`){e[n]=r;continue}if(typeof t==`string`&&typeof r==`string`)t+=r;else if(typeof t==`number`&&typeof r==`number`)t+=r;else if(Oo(t)&&Oo(r))t=this.accumulateDelta(t,r);else if(Array.isArray(t)&&Array.isArray(r)){if(t.every(e=>typeof e==`string`||typeof e==`number`)){t.push(...r);continue}for(let e of r){if(!Oo(e))throw Error(`Expected array delta entry to be an object but got: ${e}`);let n=e.index;if(n==null)throw console.error(e),Error("Expected array delta entry to have an `index` property");if(typeof n!=`number`)throw Error(`Expected array delta entry \`index\` property to be a number but got ${n}`);let r=t[n];r==null?t.push(e):t[n]=this.accumulateDelta(r,e)}continue}else throw Error(`Unhandled record type: ${n}, deltaValue: ${r}, accValue: ${t}`);e[n]=t}return e}_addRun(e){return e}async _threadAssistantStream(e,t,n){return await this._createThreadAssistantStream(t,e,n)}async _runAssistantStream(e,t,n,r){return await this._createAssistantStream(t,e,n,r)}async _runToolAssistantStream(e,t,n,r){return await this._createToolAssistantStream(t,e,n,r)}};zl=su,Ql=function(e){if(!this.ended)switch(K(this,Yl,e,`f`),q(this,Rl,`m`,nu).call(this,e),e.event){case`thread.created`:break;case`thread.run.created`:case`thread.run.queued`:case`thread.run.in_progress`:case`thread.run.requires_action`:case`thread.run.completed`:case`thread.run.incomplete`:case`thread.run.failed`:case`thread.run.cancelling`:case`thread.run.cancelled`:case`thread.run.expired`:q(this,Rl,`m`,ou).call(this,e);break;case`thread.run.step.created`:case`thread.run.step.in_progress`:case`thread.run.step.delta`:case`thread.run.step.completed`:case`thread.run.step.failed`:case`thread.run.step.cancelled`:case`thread.run.step.expired`:q(this,Rl,`m`,tu).call(this,e);break;case`thread.message.created`:case`thread.message.in_progress`:case`thread.message.delta`:case`thread.message.completed`:case`thread.message.incomplete`:q(this,Rl,`m`,eu).call(this,e);break;case`error`:throw Error(`Encountered an error event in event processing - errors should be processed earlier`);default:}},$l=function(){if(this.ended)throw new J(`stream has ended, this shouldn't happen`);if(!q(this,Wl,`f`))throw Error(`Final run has not been received`);return q(this,Wl,`f`)},eu=function(e){let[t,n]=q(this,Rl,`m`,iu).call(this,e,q(this,Ul,`f`));K(this,Ul,t,`f`),q(this,Hl,`f`)[t.id]=t;for(let e of n){let n=t.content[e.index];n?.type==`text`&&this._emit(`textCreated`,n.text)}switch(e.event){case`thread.message.created`:this._emit(`messageCreated`,e.data);break;case`thread.message.in_progress`:break;case`thread.message.delta`:if(this._emit(`messageDelta`,e.data.delta,t),e.data.delta.content)for(let n of e.data.delta.content){if(n.type==`text`&&n.text){let e=n.text,r=t.content[n.index];if(r&&r.type==`text`)this._emit(`textDelta`,e,r.text);else throw Error(`The snapshot associated with this text delta is not text or missing`)}if(n.index!=q(this,Gl,`f`)){if(q(this,Kl,`f`))switch(q(this,Kl,`f`).type){case`text`:this._emit(`textDone`,q(this,Kl,`f`).text,q(this,Ul,`f`));break;case`image_file`:this._emit(`imageFileDone`,q(this,Kl,`f`).image_file,q(this,Ul,`f`));break}K(this,Gl,n.index,`f`)}K(this,Kl,t.content[n.index],`f`)}break;case`thread.message.completed`:case`thread.message.incomplete`:if(q(this,Gl,`f`)!==void 0){let t=e.data.content[q(this,Gl,`f`)];if(t)switch(t.type){case`image_file`:this._emit(`imageFileDone`,t.image_file,q(this,Ul,`f`));break;case`text`:this._emit(`textDone`,t.text,q(this,Ul,`f`));break}}q(this,Ul,`f`)&&this._emit(`messageDone`,e.data),K(this,Ul,void 0,`f`)}},tu=function(e){let t=q(this,Rl,`m`,ru).call(this,e);switch(K(this,Zl,t,`f`),e.event){case`thread.run.step.created`:this._emit(`runStepCreated`,e.data);break;case`thread.run.step.delta`:let n=e.data.delta;if(n.step_details&&n.step_details.type==`tool_calls`&&n.step_details.tool_calls&&t.step_details.type==`tool_calls`)for(let e of n.step_details.tool_calls)e.index==q(this,ql,`f`)?this._emit(`toolCallDelta`,e,t.step_details.tool_calls[e.index]):(q(this,Jl,`f`)&&this._emit(`toolCallDone`,q(this,Jl,`f`)),K(this,ql,e.index,`f`),K(this,Jl,t.step_details.tool_calls[e.index],`f`),q(this,Jl,`f`)&&this._emit(`toolCallCreated`,q(this,Jl,`f`)));this._emit(`runStepDelta`,e.data.delta,t);break;case`thread.run.step.completed`:case`thread.run.step.failed`:case`thread.run.step.cancelled`:case`thread.run.step.expired`:K(this,Zl,void 0,`f`),e.data.step_details.type==`tool_calls`&&q(this,Jl,`f`)&&(this._emit(`toolCallDone`,q(this,Jl,`f`)),K(this,Jl,void 0,`f`)),this._emit(`runStepDone`,e.data,t);break;case`thread.run.step.in_progress`:break}},nu=function(e){q(this,Bl,`f`).push(e),this._emit(`event`,e)},ru=function(e){switch(e.event){case`thread.run.step.created`:return q(this,Vl,`f`)[e.data.id]=e.data,e.data;case`thread.run.step.delta`:let t=q(this,Vl,`f`)[e.data.id];if(!t)throw Error(`Received a RunStepDelta before creation of a snapshot`);let n=e.data;if(n.delta){let r=zl.accumulateDelta(t,n.delta);q(this,Vl,`f`)[e.data.id]=r}return q(this,Vl,`f`)[e.data.id];case`thread.run.step.completed`:case`thread.run.step.failed`:case`thread.run.step.cancelled`:case`thread.run.step.expired`:case`thread.run.step.in_progress`:q(this,Vl,`f`)[e.data.id]=e.data;break}if(q(this,Vl,`f`)[e.data.id])return q(this,Vl,`f`)[e.data.id];throw Error(`No snapshot available`)},iu=function(e,t){let n=[];switch(e.event){case`thread.message.created`:return[e.data,n];case`thread.message.delta`:if(!t)throw Error(`Received a delta with no existing snapshot (there should be one from message creation)`);let r=e.data;if(r.delta.content)for(let e of r.delta.content)if(e.index in t.content){let n=t.content[e.index];t.content[e.index]=q(this,Rl,`m`,au).call(this,e,n)}else t.content[e.index]=e,n.push(e);return[t,n];case`thread.message.in_progress`:case`thread.message.completed`:case`thread.message.incomplete`:if(t)return[t,n];throw Error(`Received thread message event with no existing snapshot`)}throw Error(`Tried to accumulate a non-message event`)},au=function(e,t){return zl.accumulateDelta(t,e)},ou=function(e){switch(K(this,Xl,e.data,`f`),e.event){case`thread.run.created`:break;case`thread.run.queued`:break;case`thread.run.in_progress`:break;case`thread.run.requires_action`:case`thread.run.cancelled`:case`thread.run.failed`:case`thread.run.completed`:case`thread.run.expired`:case`thread.run.incomplete`:K(this,Wl,e.data,`f`),q(this,Jl,`f`)&&(this._emit(`toolCallDone`,q(this,Jl,`f`)),K(this,Jl,void 0,`f`));break;case`thread.run.cancelling`:break}};var cu=class extends X{constructor(){super(...arguments),this.steps=new Fl(this._client)}create(e,t,n){let{include:r,...i}=t;return this._client.post(Z`/threads/${e}/runs`,{query:{include:r},body:i,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers]),stream:t.stream??!1})}retrieve(e,t,n){let{thread_id:r}=t;return this._client.get(Z`/threads/${r}/runs/${e}`,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}update(e,t,n){let{thread_id:r,...i}=t;return this._client.post(Z`/threads/${r}/runs/${e}`,{body:i,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}list(e,t={},n){return this._client.getAPIList(Z`/threads/${e}/runs`,Y,{query:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}cancel(e,t,n){let{thread_id:r}=t;return this._client.post(Z`/threads/${r}/runs/${e}/cancel`,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}async createAndPoll(e,t,n){let r=await this.create(e,t,n);return await this.poll(r.id,{thread_id:e},n)}createAndStream(e,t,n){return su.createAssistantStream(e,this._client.beta.threads.runs,t,n)}async poll(e,t,n){let r=Q([n?.headers,{"X-Stainless-Poll-Helper":`true`,"X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:a}=await this.retrieve(e,t,{...n,headers:{...n?.headers,...r}}).withResponse();switch(i.status){case`queued`:case`in_progress`:case`cancelling`:let e=5e3;if(n?.pollIntervalMs)e=n.pollIntervalMs;else{let t=a.headers.get(`openai-poll-after-ms`);if(t){let n=parseInt(t);isNaN(n)||(e=n)}}await jo(e);break;case`requires_action`:case`incomplete`:case`cancelled`:case`completed`:case`failed`:case`expired`:return i}}}stream(e,t,n){return su.createAssistantStream(e,this._client.beta.threads.runs,t,n)}submitToolOutputs(e,t,n){let{thread_id:r,...i}=t;return this._client.post(Z`/threads/${r}/runs/${e}/submit_tool_outputs`,{body:i,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers]),stream:t.stream??!1})}async submitToolOutputsAndPoll(e,t,n){let r=await this.submitToolOutputs(e,t,n);return await this.poll(r.id,t,n)}submitToolOutputsStream(e,t,n){return su.createToolAssistantStream(e,this._client.beta.threads.runs,t,n)}};cu.Steps=Fl;var lu=class extends X{constructor(){super(...arguments),this.runs=new cu(this._client),this.messages=new Pl(this._client)}create(e={},t){return this._client.post(`/threads`,{body:e,...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}retrieve(e,t){return this._client.get(Z`/threads/${e}`,{...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}update(e,t,n){return this._client.post(Z`/threads/${e}`,{body:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}delete(e,t){return this._client.delete(Z`/threads/${e}`,{...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}createAndRun(e,t){return this._client.post(`/threads/runs`,{body:e,...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers]),stream:e.stream??!1})}async createAndRunPoll(e,t){let n=await this.createAndRun(e,t);return await this.runs.poll(n.id,{thread_id:n.thread_id},t)}createAndRunStream(e,t){return su.createThreadAssistantStream(e,this._client.beta.threads,t)}};lu.Runs=cu,lu.Messages=Pl;var uu=class extends X{constructor(){super(...arguments),this.realtime=new Al(this._client),this.chatkit=new Nl(this._client),this.assistants=new Dl(this._client),this.threads=new lu(this._client)}};uu.Realtime=Al,uu.ChatKit=Nl,uu.Assistants=Dl,uu.Threads=lu;var du=class extends X{create(e,t){return this._client.post(`/completions`,{body:e,...t,stream:e.stream??!1})}},fu=class extends X{retrieve(e,t,n){let{container_id:r}=t;return this._client.get(Z`/containers/${r}/files/${e}/content`,{...n,headers:Q([{Accept:`application/binary`},n?.headers]),__binaryResponse:!0})}},pu=class extends X{constructor(){super(...arguments),this.content=new fu(this._client)}create(e,t,n){return this._client.post(Z`/containers/${e}/files`,Ys({body:t,...n},this._client))}retrieve(e,t,n){let{container_id:r}=t;return this._client.get(Z`/containers/${r}/files/${e}`,n)}list(e,t={},n){return this._client.getAPIList(Z`/containers/${e}/files`,Y,{query:t,...n})}delete(e,t,n){let{container_id:r}=t;return this._client.delete(Z`/containers/${r}/files/${e}`,{...n,headers:Q([{Accept:`*/*`},n?.headers])})}};pu.Content=fu;var mu=class extends X{constructor(){super(...arguments),this.files=new pu(this._client)}create(e,t){return this._client.post(`/containers`,{body:e,...t})}retrieve(e,t){return this._client.get(Z`/containers/${e}`,t)}list(e={},t){return this._client.getAPIList(`/containers`,Y,{query:e,...t})}delete(e,t){return this._client.delete(Z`/containers/${e}`,{...t,headers:Q([{Accept:`*/*`},t?.headers])})}};mu.Files=pu;var hu=class extends X{create(e,t,n){let{include:r,...i}=t;return this._client.post(Z`/conversations/${e}/items`,{query:{include:r},body:i,...n})}retrieve(e,t,n){let{conversation_id:r,...i}=t;return this._client.get(Z`/conversations/${r}/items/${e}`,{query:i,...n})}list(e,t={},n){return this._client.getAPIList(Z`/conversations/${e}/items`,Us,{query:t,...n})}delete(e,t,n){let{conversation_id:r}=t;return this._client.delete(Z`/conversations/${r}/items/${e}`,n)}},gu=class extends X{constructor(){super(...arguments),this.items=new hu(this._client)}create(e={},t){return this._client.post(`/conversations`,{body:e,...t})}retrieve(e,t){return this._client.get(Z`/conversations/${e}`,t)}update(e,t,n){return this._client.post(Z`/conversations/${e}`,{body:t,...n})}delete(e,t){return this._client.delete(Z`/conversations/${e}`,t)}};gu.Items=hu;var _u=class extends X{create(e,t){let n=!!e.encoding_format,r=n?e.encoding_format:`base64`;n&&Ds(this._client).debug(`embeddings/user defined encoding_format:`,e.encoding_format);let i=this._client.post(`/embeddings`,{body:{...e,encoding_format:r},...t});return n?i:(Ds(this._client).debug(`embeddings/decoding base64 embeddings from base64`),i._thenUnwrap(e=>(e&&e.data&&e.data.forEach(e=>{let t=e.embedding;e.embedding=Il(t)}),e)))}},vu=class extends X{retrieve(e,t,n){let{eval_id:r,run_id:i}=t;return this._client.get(Z`/evals/${r}/runs/${i}/output_items/${e}`,n)}list(e,t,n){let{eval_id:r,...i}=t;return this._client.getAPIList(Z`/evals/${r}/runs/${e}/output_items`,Y,{query:i,...n})}},yu=class extends X{constructor(){super(...arguments),this.outputItems=new vu(this._client)}create(e,t,n){return this._client.post(Z`/evals/${e}/runs`,{body:t,...n})}retrieve(e,t,n){let{eval_id:r}=t;return this._client.get(Z`/evals/${r}/runs/${e}`,n)}list(e,t={},n){return this._client.getAPIList(Z`/evals/${e}/runs`,Y,{query:t,...n})}delete(e,t,n){let{eval_id:r}=t;return this._client.delete(Z`/evals/${r}/runs/${e}`,n)}cancel(e,t,n){let{eval_id:r}=t;return this._client.post(Z`/evals/${r}/runs/${e}`,n)}};yu.OutputItems=vu;var bu=class extends X{constructor(){super(...arguments),this.runs=new yu(this._client)}create(e,t){return this._client.post(`/evals`,{body:e,...t})}retrieve(e,t){return this._client.get(Z`/evals/${e}`,t)}update(e,t,n){return this._client.post(Z`/evals/${e}`,{body:t,...n})}list(e={},t){return this._client.getAPIList(`/evals`,Y,{query:e,...t})}delete(e,t){return this._client.delete(Z`/evals/${e}`,t)}};bu.Runs=yu;var xu=class extends X{create(e,t){return this._client.post(`/files`,Ys({body:e,...t},this._client))}retrieve(e,t){return this._client.get(Z`/files/${e}`,t)}list(e={},t){return this._client.getAPIList(`/files`,Y,{query:e,...t})}delete(e,t){return this._client.delete(Z`/files/${e}`,t)}content(e,t){return this._client.get(Z`/files/${e}/content`,{...t,headers:Q([{Accept:`application/binary`},t?.headers]),__binaryResponse:!0})}async waitForProcessing(e,{pollInterval:t=5e3,maxWait:n=1800*1e3}={}){let r=new Set([`processed`,`error`,`deleted`]),i=Date.now(),a=await this.retrieve(e);for(;!a.status||!r.has(a.status);)if(await jo(t),a=await this.retrieve(e),Date.now()-i>n)throw new co({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}},Su=class extends X{},Cu=class extends X{run(e,t){return this._client.post(`/fine_tuning/alpha/graders/run`,{body:e,...t})}validate(e,t){return this._client.post(`/fine_tuning/alpha/graders/validate`,{body:e,...t})}},wu=class extends X{constructor(){super(...arguments),this.graders=new Cu(this._client)}};wu.Graders=Cu;var Tu=class extends X{create(e,t,n){return this._client.getAPIList(Z`/fine_tuning/checkpoints/${e}/permissions`,Hs,{body:t,method:`post`,...n})}retrieve(e,t={},n){return this._client.get(Z`/fine_tuning/checkpoints/${e}/permissions`,{query:t,...n})}delete(e,t,n){let{fine_tuned_model_checkpoint:r}=t;return this._client.delete(Z`/fine_tuning/checkpoints/${r}/permissions/${e}`,n)}},Eu=class extends X{constructor(){super(...arguments),this.permissions=new Tu(this._client)}};Eu.Permissions=Tu;var Du=class extends X{list(e,t={},n){return this._client.getAPIList(Z`/fine_tuning/jobs/${e}/checkpoints`,Y,{query:t,...n})}},Ou=class extends X{constructor(){super(...arguments),this.checkpoints=new Du(this._client)}create(e,t){return this._client.post(`/fine_tuning/jobs`,{body:e,...t})}retrieve(e,t){return this._client.get(Z`/fine_tuning/jobs/${e}`,t)}list(e={},t){return this._client.getAPIList(`/fine_tuning/jobs`,Y,{query:e,...t})}cancel(e,t){return this._client.post(Z`/fine_tuning/jobs/${e}/cancel`,t)}listEvents(e,t={},n){return this._client.getAPIList(Z`/fine_tuning/jobs/${e}/events`,Y,{query:t,...n})}pause(e,t){return this._client.post(Z`/fine_tuning/jobs/${e}/pause`,t)}resume(e,t){return this._client.post(Z`/fine_tuning/jobs/${e}/resume`,t)}};Ou.Checkpoints=Du;var ku=class extends X{constructor(){super(...arguments),this.methods=new Su(this._client),this.jobs=new Ou(this._client),this.checkpoints=new Eu(this._client),this.alpha=new wu(this._client)}};ku.Methods=Su,ku.Jobs=Ou,ku.Checkpoints=Eu,ku.Alpha=wu;var Au=class extends X{},ju=class extends X{constructor(){super(...arguments),this.graderModels=new Au(this._client)}};ju.GraderModels=Au;var Mu=class extends X{createVariation(e,t){return this._client.post(`/images/variations`,Ys({body:e,...t},this._client))}edit(e,t){return this._client.post(`/images/edits`,Ys({body:e,...t,stream:e.stream??!1},this._client))}generate(e,t){return this._client.post(`/images/generations`,{body:e,...t,stream:e.stream??!1})}},Nu=class extends X{retrieve(e,t){return this._client.get(Z`/models/${e}`,t)}list(e){return this._client.getAPIList(`/models`,Hs,e)}delete(e,t){return this._client.delete(Z`/models/${e}`,t)}},Pu=class extends X{create(e,t){return this._client.post(`/moderations`,{body:e,...t})}},Fu=class extends X{accept(e,t,n){return this._client.post(Z`/realtime/calls/${e}/accept`,{body:t,...n,headers:Q([{Accept:`*/*`},n?.headers])})}hangup(e,t){return this._client.post(Z`/realtime/calls/${e}/hangup`,{...t,headers:Q([{Accept:`*/*`},t?.headers])})}refer(e,t,n){return this._client.post(Z`/realtime/calls/${e}/refer`,{body:t,...n,headers:Q([{Accept:`*/*`},n?.headers])})}reject(e,t={},n){return this._client.post(Z`/realtime/calls/${e}/reject`,{body:t,...n,headers:Q([{Accept:`*/*`},n?.headers])})}},Iu=class extends X{create(e,t){return this._client.post(`/realtime/client_secrets`,{body:e,...t})}},Lu=class extends X{constructor(){super(...arguments),this.clientSecrets=new Iu(this._client),this.calls=new Fu(this._client)}};Lu.ClientSecrets=Iu,Lu.Calls=Fu;function Ru(e,t){return!t||!Vu(t)?{...e,output_parsed:null,output:e.output.map(e=>e.type===`function_call`?{...e,parsed_arguments:null}:e.type===`message`?{...e,content:e.content.map(e=>({...e,parsed:null}))}:e)}:zu(e,t)}function zu(e,t){let n=e.output.map(e=>{if(e.type===`function_call`)return{...e,parsed_arguments:Wu(t,e)};if(e.type===`message`){let n=e.content.map(e=>e.type===`output_text`?{...e,parsed:Bu(t,e.text)}:e);return{...e,content:n}}return e}),r=Object.assign({},e,{output:n});return Object.getOwnPropertyDescriptor(e,`output_text`)||Gu(r),Object.defineProperty(r,`output_parsed`,{enumerable:!0,get(){for(let e of r.output)if(e.type===`message`){for(let t of e.content)if(t.type===`output_text`&&t.parsed!==null)return t.parsed}return null}}),r}function Bu(e,t){return e.text?.format?.type===`json_schema`?`$parseRaw`in e.text?.format?(e.text?.format).$parseRaw(t):JSON.parse(t):null}function Vu(e){return!!pc(e.text?.format)}function Hu(e){return e?.$brand===`auto-parseable-tool`}function Uu(e,t){return e.find(e=>e.type===`function`&&e.name===t)}function Wu(e,t){let n=Uu(e.tools??[],t.name);return{...t,...t,parsed_arguments:Hu(n)?n.$parseRaw(t.arguments):n?.strict?JSON.parse(t.arguments):null}}function Gu(e){let t=[];for(let n of e.output)if(n.type===`message`)for(let e of n.content)e.type===`output_text`&&t.push(e.text);e.output_text=t.join(``)}var Ku,qu,Ju,Yu,Xu,Zu,Qu,$u,ed=class e extends Rc{constructor(e){super(),Ku.add(this),qu.set(this,void 0),Ju.set(this,void 0),Yu.set(this,void 0),K(this,qu,e,`f`)}static createResponse(t,n,r){let i=new e(n);return i._run(()=>i._createOrRetrieveResponse(t,n,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":`stream`}})),i}async _createOrRetrieveResponse(e,t,n){let r=n?.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener(`abort`,()=>this.controller.abort())),q(this,Ku,`m`,Xu).call(this);let i,a=null;`response_id`in t?(i=await e.responses.retrieve(t.response_id,{stream:!0},{...n,signal:this.controller.signal,stream:!0}),a=t.starting_after??null):i=await e.responses.create({...t,stream:!0},{...n,signal:this.controller.signal}),this._connected();for await(let e of i)q(this,Ku,`m`,Zu).call(this,e,a);if(i.controller.signal?.aborted)throw new oo;return q(this,Ku,`m`,Qu).call(this)}[(qu=new WeakMap,Ju=new WeakMap,Yu=new WeakMap,Ku=new WeakSet,Xu=function(){this.ended||K(this,Ju,void 0,`f`)},Zu=function(e,t){if(this.ended)return;let n=(e,n)=>{(t==null||n.sequence_number>t)&&this._emit(e,n)},r=q(this,Ku,`m`,$u).call(this,e);switch(n(`event`,e),e.type){case`response.output_text.delta`:{let t=r.output[e.output_index];if(!t)throw new J(`missing output at index ${e.output_index}`);if(t.type===`message`){let r=t.content[e.content_index];if(!r)throw new J(`missing content at index ${e.content_index}`);if(r.type!==`output_text`)throw new J(`expected content to be 'output_text', got ${r.type}`);n(`response.output_text.delta`,{...e,snapshot:r.text})}break}case`response.function_call_arguments.delta`:{let t=r.output[e.output_index];if(!t)throw new J(`missing output at index ${e.output_index}`);t.type===`function_call`&&n(`response.function_call_arguments.delta`,{...e,snapshot:t.arguments});break}default:n(e.type,e);break}},Qu=function(){if(this.ended)throw new J(`stream has ended, this shouldn't happen`);let e=q(this,Ju,`f`);if(!e)throw new J(`request ended without sending any events`);K(this,Ju,void 0,`f`);let t=td(e,q(this,qu,`f`));return K(this,Yu,t,`f`),t},$u=function(e){let t=q(this,Ju,`f`);if(!t){if(e.type!==`response.created`)throw new J(`When snapshot hasn't been set yet, expected 'response.created' event, got ${e.type}`);return t=K(this,Ju,e.response,`f`),t}switch(e.type){case`response.output_item.added`:t.output.push(e.item);break;case`response.content_part.added`:{let n=t.output[e.output_index];if(!n)throw new J(`missing output at index ${e.output_index}`);let r=n.type,i=e.part;r===`message`&&i.type!==`reasoning_text`?n.content.push(i):r===`reasoning`&&i.type===`reasoning_text`&&(n.content||=[],n.content.push(i));break}case`response.output_text.delta`:{let n=t.output[e.output_index];if(!n)throw new J(`missing output at index ${e.output_index}`);if(n.type===`message`){let t=n.content[e.content_index];if(!t)throw new J(`missing content at index ${e.content_index}`);if(t.type!==`output_text`)throw new J(`expected content to be 'output_text', got ${t.type}`);t.text+=e.delta}break}case`response.function_call_arguments.delta`:{let n=t.output[e.output_index];if(!n)throw new J(`missing output at index ${e.output_index}`);n.type===`function_call`&&(n.arguments+=e.delta);break}case`response.reasoning_text.delta`:{let n=t.output[e.output_index];if(!n)throw new J(`missing output at index ${e.output_index}`);if(n.type===`reasoning`){let t=n.content?.[e.content_index];if(!t)throw new J(`missing content at index ${e.content_index}`);if(t.type!==`reasoning_text`)throw new J(`expected content to be 'reasoning_text', got ${t.type}`);t.text+=e.delta}break}case`response.completed`:K(this,Ju,e.response,`f`);break}return t},Symbol.asyncIterator)](){let e=[],t=[],n=!1;return this.on(`event`,n=>{let r=t.shift();r?r.resolve(n):e.push(n)}),this.on(`end`,()=>{n=!0;for(let e of t)e.resolve(void 0);t.length=0}),this.on(`abort`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),this.on(`error`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((e,n)=>t.push({resolve:e,reject:n})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();let e=q(this,Yu,`f`);if(!e)throw new J(`stream ended without producing a ChatCompletion`);return e}};function td(e,t){return Ru(e,t)}var nd=class extends X{list(e,t={},n){return this._client.getAPIList(Z`/responses/${e}/input_items`,Y,{query:t,...n})}},rd=class extends X{count(e={},t){return this._client.post(`/responses/input_tokens`,{body:e,...t})}},id=class extends X{constructor(){super(...arguments),this.inputItems=new nd(this._client),this.inputTokens=new rd(this._client)}create(e,t){return this._client.post(`/responses`,{body:e,...t,stream:e.stream??!1})._thenUnwrap(e=>(`object`in e&&e.object===`response`&&Gu(e),e))}retrieve(e,t={},n){return this._client.get(Z`/responses/${e}`,{query:t,...n,stream:t?.stream??!1})._thenUnwrap(e=>(`object`in e&&e.object===`response`&&Gu(e),e))}delete(e,t){return this._client.delete(Z`/responses/${e}`,{...t,headers:Q([{Accept:`*/*`},t?.headers])})}parse(e,t){return this._client.responses.create(e,t)._thenUnwrap(t=>zu(t,e))}stream(e,t){return ed.createResponse(this._client,e,t)}cancel(e,t){return this._client.post(Z`/responses/${e}/cancel`,t)}compact(e,t){return this._client.post(`/responses/compact`,{body:e,...t})}};id.InputItems=nd,id.InputTokens=rd;var ad=class extends X{create(e,t,n){return this._client.post(Z`/uploads/${e}/parts`,Ys({body:t,...n},this._client))}},od=class extends X{constructor(){super(...arguments),this.parts=new ad(this._client)}create(e,t){return this._client.post(`/uploads`,{body:e,...t})}cancel(e,t){return this._client.post(Z`/uploads/${e}/cancel`,t)}complete(e,t,n){return this._client.post(Z`/uploads/${e}/complete`,{body:t,...n})}};od.Parts=ad;const sd=async e=>{let t=await Promise.allSettled(e),n=t.filter(e=>e.status===`rejected`);if(n.length){for(let e of n)console.error(e.reason);throw Error(`${n.length} promise(s) failed - see the above errors`)}let r=[];for(let e of t)e.status===`fulfilled`&&r.push(e.value);return r};var cd=class extends X{create(e,t,n){return this._client.post(Z`/vector_stores/${e}/file_batches`,{body:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}retrieve(e,t,n){let{vector_store_id:r}=t;return this._client.get(Z`/vector_stores/${r}/file_batches/${e}`,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}cancel(e,t,n){let{vector_store_id:r}=t;return this._client.post(Z`/vector_stores/${r}/file_batches/${e}/cancel`,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}async createAndPoll(e,t,n){let r=await this.create(e,t);return await this.poll(e,r.id,n)}listFiles(e,t,n){let{vector_store_id:r,...i}=t;return this._client.getAPIList(Z`/vector_stores/${r}/file_batches/${e}/files`,Y,{query:i,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}async poll(e,t,n){let r=Q([n?.headers,{"X-Stainless-Poll-Helper":`true`,"X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:a}=await this.retrieve(t,{vector_store_id:e},{...n,headers:r}).withResponse();switch(i.status){case`in_progress`:let e=5e3;if(n?.pollIntervalMs)e=n.pollIntervalMs;else{let t=a.headers.get(`openai-poll-after-ms`);if(t){let n=parseInt(t);isNaN(n)||(e=n)}}await jo(e);break;case`failed`:case`cancelled`:case`completed`:return i}}}async uploadAndPoll(e,{files:t,fileIds:n=[]},r){if(t==null||t.length==0)throw Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=r?.maxConcurrency??5,a=Math.min(i,t.length),o=this._client,s=t.values(),c=[...n];async function l(e){for(let t of e){let e=await o.files.create({file:t,purpose:`assistants`},r);c.push(e.id)}}return await sd(Array(a).fill(s).map(l)),await this.createAndPoll(e,{file_ids:c})}},ld=class extends X{create(e,t,n){return this._client.post(Z`/vector_stores/${e}/files`,{body:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}retrieve(e,t,n){let{vector_store_id:r}=t;return this._client.get(Z`/vector_stores/${r}/files/${e}`,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}update(e,t,n){let{vector_store_id:r,...i}=t;return this._client.post(Z`/vector_stores/${r}/files/${e}`,{body:i,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}list(e,t={},n){return this._client.getAPIList(Z`/vector_stores/${e}/files`,Y,{query:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}delete(e,t,n){let{vector_store_id:r}=t;return this._client.delete(Z`/vector_stores/${r}/files/${e}`,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}async createAndPoll(e,t,n){let r=await this.create(e,t,n);return await this.poll(e,r.id,n)}async poll(e,t,n){let r=Q([n?.headers,{"X-Stainless-Poll-Helper":`true`,"X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let i=await this.retrieve(t,{vector_store_id:e},{...n,headers:r}).withResponse(),a=i.data;switch(a.status){case`in_progress`:let e=5e3;if(n?.pollIntervalMs)e=n.pollIntervalMs;else{let t=i.response.headers.get(`openai-poll-after-ms`);if(t){let n=parseInt(t);isNaN(n)||(e=n)}}await jo(e);break;case`failed`:case`completed`:return a}}}async upload(e,t,n){let r=await this._client.files.create({file:t,purpose:`assistants`},n);return this.create(e,{file_id:r.id},n)}async uploadAndPoll(e,t,n){let r=await this.upload(e,t,n);return await this.poll(e,r.id,n)}content(e,t,n){let{vector_store_id:r}=t;return this._client.getAPIList(Z`/vector_stores/${r}/files/${e}/content`,Hs,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}},ud=class extends X{constructor(){super(...arguments),this.files=new ld(this._client),this.fileBatches=new cd(this._client)}create(e,t){return this._client.post(`/vector_stores`,{body:e,...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}retrieve(e,t){return this._client.get(Z`/vector_stores/${e}`,{...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}update(e,t,n){return this._client.post(Z`/vector_stores/${e}`,{body:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}list(e={},t){return this._client.getAPIList(`/vector_stores`,Y,{query:e,...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}delete(e,t){return this._client.delete(Z`/vector_stores/${e}`,{...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}search(e,t,n){return this._client.getAPIList(Z`/vector_stores/${e}/search`,Hs,{body:t,method:`post`,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}};ud.Files=ld,ud.FileBatches=cd;var dd=class extends X{create(e,t){return this._client.post(`/videos`,Js({body:e,...t},this._client))}retrieve(e,t){return this._client.get(Z`/videos/${e}`,t)}list(e={},t){return this._client.getAPIList(`/videos`,Us,{query:e,...t})}delete(e,t){return this._client.delete(Z`/videos/${e}`,t)}downloadContent(e,t={},n){return this._client.get(Z`/videos/${e}/content`,{query:t,...n,headers:Q([{Accept:`application/binary`},n?.headers]),__binaryResponse:!0})}remix(e,t,n){return this._client.post(Z`/videos/${e}/remix`,Js({body:t,...n},this._client))}},fd,pd,md,hd=class extends X{constructor(){super(...arguments),fd.add(this)}async unwrap(e,t,n=this._client.webhookSecret,r=300){return await this.verifySignature(e,t,n,r),JSON.parse(e)}async verifySignature(e,t,n=this._client.webhookSecret,r=300){if(typeof crypto>`u`||typeof crypto.subtle.importKey!=`function`||typeof crypto.subtle.verify!=`function`)throw Error("Webhook signature verification is only supported when the `crypto` global is defined");q(this,fd,`m`,pd).call(this,n);let i=Q([t]).values,a=q(this,fd,`m`,md).call(this,i,`webhook-signature`),o=q(this,fd,`m`,md).call(this,i,`webhook-timestamp`),s=q(this,fd,`m`,md).call(this,i,`webhook-id`),c=parseInt(o,10);if(isNaN(c))throw new bo(`Invalid webhook timestamp format`);let l=Math.floor(Date.now()/1e3);if(l-c>r)throw new bo(`Webhook timestamp is too old`);if(c>l+r)throw new bo(`Webhook timestamp is too new`);let u=a.split(` `).map(e=>e.startsWith(`v1,`)?e.substring(3):e),d=n.startsWith(`whsec_`)?Buffer.from(n.replace(`whsec_`,``),`base64`):Buffer.from(n,`utf-8`),f=s?`${s}.${o}.${e}`:`${o}.${e}`,p=await crypto.subtle.importKey(`raw`,d,{name:`HMAC`,hash:`SHA-256`},!1,[`verify`]);for(let e of u)try{let t=Buffer.from(e,`base64`);if(await crypto.subtle.verify(`HMAC`,p,t,new TextEncoder().encode(f)))return}catch{continue}throw new bo(`The given webhook signature does not match the expected signature`)}};fd=new WeakSet,pd=function(e){if(typeof e!=`string`||e.length===0)throw Error(`The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function`)},md=function(e,t){if(!e)throw Error(`Headers are required`);let n=e.get(t);if(n==null)throw Error(`Missing required header: ${t}`);return n};var gd,_d,vd,yd,$=class{constructor({baseURL:e=Ll(`OPENAI_BASE_URL`),apiKey:t=Ll(`OPENAI_API_KEY`),organization:n=Ll(`OPENAI_ORG_ID`)??null,project:r=Ll(`OPENAI_PROJECT_ID`)??null,webhookSecret:i=Ll(`OPENAI_WEBHOOK_SECRET`)??null,...a}={}){if(gd.add(this),vd.set(this,void 0),this.completions=new du(this),this.chat=new yl(this),this.embeddings=new _u(this),this.files=new xu(this),this.images=new Mu(this),this.audio=new Tl(this),this.moderations=new Pu(this),this.models=new Nu(this),this.fineTuning=new ku(this),this.graders=new ju(this),this.vectorStores=new ud(this),this.webhooks=new hd(this),this.beta=new uu(this),this.batches=new El(this),this.uploads=new od(this),this.responses=new id(this),this.realtime=new Lu(this),this.conversations=new gu(this),this.evals=new bu(this),this.containers=new mu(this),this.videos=new dd(this),t===void 0)throw new J("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");let o={apiKey:t,organization:n,project:r,webhookSecret:i,...a,baseURL:e||`https://api.openai.com/v1`};if(!o.dangerouslyAllowBrowser&&No())throw new J(`It looks like you're running in a browser-like environment.
136
+ let n=Qs();$s()(n),ec()(n),tc()(n),nc()(n),ac()(n),oc()(n),sc()(n),cc()(n),t.exports=n}))(),1);function uc(e){return i(e)?e:o(s.cwd(),e)}function dc(e){let t=uc(e);if(!x(t))return[];try{return te(t,{withFileTypes:!0}).filter(e=>e.isFile()&&r(e.name).toLowerCase()===`.svg`).map(e=>e.name.replace(/\.svg$/i,``))}catch{return[]}}function fc(e,t){return a(uc(t),`${e}.svg`)}function pc(e,t,n){let r=i(e)?e:fc(e,n);if(!x(r))throw Error(`SVG template not found at ${r}. Please ensure the template exists in ${uc(n)}.`);let a;try{a=ee(r,`utf-8`)}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Failed to load SVG template from ${r}: ${t}`)}let o=t.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`);return a.replace(/\{\{text\}\}/g,o)}async function mc(e,t,n,r,i){try{let a=pc(r,n,i),o=ue.from(a);await(0,lc.default)(e).composite([{input:o,blend:`over`}]).toFile(t)}catch(e){throw console.error(`Error adding text to image:`,e),e}}function hc(e=s.cwd()){let t=[];try{let n=te(e).filter(t=>ne(a(e,t)).isDirectory()&&/^\d{4}$/.test(t));for(let i of n){let n=a(e,i),o=te(n).filter(e=>ne(a(n,e)).isDirectory()&&/^\d{2}$/.test(e));for(let e of o){let o=a(n,e),s=te(o).filter(e=>ne(a(o,e)).isDirectory()&&/^\d{2}$/.test(e));for(let n of s){let s=a(o,n),c=te(s,{withFileTypes:!0}).filter(e=>e.isFile()&&r(e.name).toLowerCase()===`.mp4`).map(e=>e.name);if(c.length>0){let r=`${i}-${e}-${n}`;t.push({path:s,date:new Date(r),displayPath:`${i}/${e}/${n}`,videoFile:c[0]})}}}}}catch(e){return V.error(`Error reading directories: ${e}`),[]}return t.sort((e,t)=>t.date.getTime()-e.date.getTime()).slice(0,8)}async function gc(e=s.cwd()){let t=hc(e);t.length===0&&(V.error(`No dated folders with video files found.`),V.info(`Expected structure: YYYY/MM/DD/*.mp4`),s.exit(1));let n=t.map(e=>({label:`${e.displayPath} (${e.videoFile})`,value:e.path,hint:`Process video from ${e.displayPath}`}));n.push({label:`Custom date`,value:`custom`,hint:`Enter a specific date`});let i=await Ct({message:`Select a content folder with video:`,options:n});if(Xe(i)&&(V.error(`Operation cancelled.`),s.exit(0)),i===`custom`){let t=await St({message:`Enter date (YYYY-MM-DD):`,placeholder:po(new Date,`yyyy-MM-dd`),validate:e=>{if(!e)return`Date is required`;if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return`Invalid date format. Please use YYYY-MM-DD`;try{let t=Ss(e,`yyyy-MM-dd`,new Date);if(Number.isNaN(t.getTime()))return`Invalid date`}catch{return`Invalid date`}}});Xe(t)&&(V.error(`Operation cancelled.`),s.exit(0));let n=Ss(t,`yyyy-MM-dd`,new Date),i=a(e,po(n,`yyyy`),po(n,`MM`),po(n,`dd`));x(i)||(V.error(`Folder does not exist: ${i}`),s.exit(1));let o=te(i,{withFileTypes:!0}).filter(e=>e.isFile()&&r(e.name).toLowerCase()===`.mp4`).map(e=>e.name);return o.length===0&&(V.error(`No .mp4 files found in: ${i}`),s.exit(1)),{folderPath:i,videoPath:a(i,o[0])}}let o=t.find(e=>e.path===i);o||(V.error(`Selected folder not found.`),s.exit(1));let c=a(o.path,o.videoFile);return{folderPath:o.path,videoPath:c}}async function _c(){let e=await St({message:`Enter text for the thumbnail (or press Enter to skip):`,placeholder:`Optional thumbnail text`});if(typeof e!=`symbol`)return e.trim()||void 0}async function vc(e){let t=dc(e);if(t.length===0){V.error(`No templates found in ${e}`),V.info(`Please add SVG templates to ${e} before proceeding.`);return}let n=await Ct({message:`Choose a template:`,options:t.map(e=>({label:e,value:e}))});if(typeof n!=`symbol`)return n}function yc(e,t){let n=`ffmpeg -i ${e} -q:a 0 -map a ${t}`;try{k(n,{stdio:`inherit`})}catch(e){console.error(`Error extracting audio:`,e)}}function bc(e){try{let t=k(`ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "${e}"`,{encoding:`utf-8`});return Number.parseFloat(t.trim())}catch(e){throw console.error(`Error getting video duration:`,e),e}}function xc(e,t,n=`first`){let r=``;r=n===`first`?`ffmpeg -i "${e}" -vf "select=eq(n\\,0)" -vframes 1 "${t}" -y`:n===`last`?`ffmpeg -sseof -0.1 -i "${e}" -vframes 1 "${t}" -y`:`ffmpeg -ss ${bc(e)*(Number.parseInt(n)/100)} -i "${e}" -vframes 1 "${t}" -y`;try{k(r,{stdio:`inherit`})}catch(e){throw console.error(`Error extracting thumbnail:`,e),e}}function q(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function J(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}let Sc=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return Sc=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))};function Cc(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}const wc=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)};var Y=class extends Error{},Tc=class e extends Y{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`x-request-id`),this.error=n;let a=n;this.code=a?.code,this.param=a?.param,this.type=a?.type}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new Dc({message:r,cause:wc(n)});let a=n?.error;return t===400?new kc(t,a,r,i):t===401?new Ac(t,a,r,i):t===403?new jc(t,a,r,i):t===404?new Mc(t,a,r,i):t===409?new Nc(t,a,r,i):t===422?new Pc(t,a,r,i):t===429?new Fc(t,a,r,i):t>=500?new Ic(t,a,r,i):new e(t,a,r,i)}},Ec=class extends Tc{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},Dc=class extends Tc{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},Oc=class extends Dc{constructor({message:e}={}){super({message:e??`Request timed out.`})}},kc=class extends Tc{},Ac=class extends Tc{},jc=class extends Tc{},Mc=class extends Tc{},Nc=class extends Tc{},Pc=class extends Tc{},Fc=class extends Tc{},Ic=class extends Tc{},Lc=class extends Y{constructor(){super(`Could not parse response content as the length limit was reached`)}},Rc=class extends Y{constructor(){super(`Could not parse response content as the request was rejected by the content filter`)}},zc=class extends Error{constructor(e){super(e)}};const Bc=/^[a-z][a-z0-9+.-]*:/i,Vc=e=>Bc.test(e);let Hc=e=>(Hc=Array.isArray,Hc(e)),Uc=Hc;function Wc(e){return typeof e==`object`?e??{}:{}}function Gc(e){if(!e)return!0;for(let t in e)return!1;return!0}function Kc(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function qc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Jc=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new Y(`${e} must be an integer`);if(t<0)throw new Y(`${e} must be a positive integer`);return t},Yc=e=>{try{return JSON.parse(e)}catch{return}},Xc=e=>new Promise(t=>setTimeout(t,e)),Zc=`6.15.0`,Qc=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`;function $c(){return typeof Deno<`u`&&Deno.build!=null?`deno`:typeof EdgeRuntime<`u`?`edge`:Object.prototype.toString.call(globalThis.process===void 0?0:globalThis.process)===`[object process]`?`node`:`unknown`}const el=()=>{let e=$c();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":Zc,"X-Stainless-OS":rl(Deno.build.os),"X-Stainless-Arch":nl(Deno.build.arch),"X-Stainless-Runtime":`deno`,"X-Stainless-Runtime-Version":typeof Deno.version==`string`?Deno.version:Deno.version?.deno??`unknown`};if(typeof EdgeRuntime<`u`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":Zc,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":`edge`,"X-Stainless-Runtime-Version":globalThis.process.version};if(e===`node`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":Zc,"X-Stainless-OS":rl(globalThis.process.platform??`unknown`),"X-Stainless-Arch":nl(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=tl();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":Zc,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":Zc,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}};function tl(){if(typeof navigator>`u`||!navigator)return null;for(let{key:e,pattern:t}of[{key:`edge`,pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`chrome`,pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`firefox`,pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`safari`,pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let n=t.exec(navigator.userAgent);if(n)return{browser:e,version:`${n[1]||0}.${n[2]||0}.${n[3]||0}`}}return null}const nl=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,rl=e=>(e=e.toLowerCase(),e.includes(`ios`)?`iOS`:e===`android`?`Android`:e===`darwin`?`MacOS`:e===`win32`?`Windows`:e===`freebsd`?`FreeBSD`:e===`openbsd`?`OpenBSD`:e===`linux`?`Linux`:e?`Other:${e}`:`Unknown`);let il;const al=()=>il??=el();function ol(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function sl(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function cl(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return sl({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function ll(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function ul(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}const dl=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)}),fl=`RFC3986`,pl=e=>String(e),ml={RFC1738:e=>String(e).replace(/%20/g,`+`),RFC3986:pl};let hl=(e,t)=>(hl=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),hl(e,t));const gl=(()=>{let e=[];for(let t=0;t<256;++t)e.push(`%`+((t<16?`0`:``)+t.toString(16)).toUpperCase());return e})(),_l=1024,vl=(e,t,n,r,i)=>{if(e.length===0)return e;let a=e;if(typeof e==`symbol`?a=Symbol.prototype.toString.call(e):typeof e!=`string`&&(a=String(e)),n===`iso-8859-1`)return escape(a).replace(/%u[0-9a-f]{4}/gi,function(e){return`%26%23`+parseInt(e.slice(2),16)+`%3B`});let o=``;for(let e=0;e<a.length;e+=_l){let t=a.length>=_l?a.slice(e,e+_l):a,n=[];for(let e=0;e<t.length;++e){let r=t.charCodeAt(e);if(r===45||r===46||r===95||r===126||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||i===`RFC1738`&&(r===40||r===41)){n[n.length]=t.charAt(e);continue}if(r<128){n[n.length]=gl[r];continue}if(r<2048){n[n.length]=gl[192|r>>6]+gl[128|r&63];continue}if(r<55296||r>=57344){n[n.length]=gl[224|r>>12]+gl[128|r>>6&63]+gl[128|r&63];continue}e+=1,r=65536+((r&1023)<<10|t.charCodeAt(e)&1023),n[n.length]=gl[240|r>>18]+gl[128|r>>12&63]+gl[128|r>>6&63]+gl[128|r&63]}o+=n.join(``)}return o};function yl(e){return!e||typeof e!=`object`?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function bl(e,t){if(Hc(e)){let n=[];for(let r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)}const xl={brackets(e){return String(e)+`[]`},comma:`comma`,indices(e,t){return String(e)+`[`+t+`]`},repeat(e){return String(e)}},Sl=function(e,t){Array.prototype.push.apply(e,Hc(t)?t:[t])};let Cl;const wl={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:`indices`,charset:`utf-8`,charsetSentinel:!1,delimiter:`&`,encode:!0,encodeDotInKeys:!1,encoder:vl,encodeValuesOnly:!1,format:fl,formatter:pl,indices:!1,serializeDate(e){return(Cl??=Function.prototype.call.bind(Date.prototype.toISOString))(e)},skipNulls:!1,strictNullHandling:!1};function Tl(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`symbol`||typeof e==`bigint`}const El={};function Dl(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=e,y=_,b=0,x=!1;for(;(y=y.get(El))!==void 0&&!x;){let t=y.get(e);if(b+=1,t!==void 0){if(t===b)throw RangeError(`Cyclic object value`);x=!0}y.get(El)===void 0&&(b=0)}if(typeof l==`function`?v=l(t,v):v instanceof Date?v=f?.(v):n===`comma`&&Hc(v)&&(v=bl(v,function(e){return e instanceof Date?f?.(e):e})),v===null){if(a)return c&&!h?c(t,wl.encoder,g,`key`,p):t;v=``}if(Tl(v)||yl(v)){if(c){let e=h?t:c(t,wl.encoder,g,`key`,p);return[m?.(e)+`=`+m?.(c(v,wl.encoder,g,`value`,p))]}return[m?.(t)+`=`+m?.(String(v))]}let S=[];if(v===void 0)return S;let C;if(n===`comma`&&Hc(v))h&&c&&(v=bl(v,c)),C=[{value:v.length>0?v.join(`,`)||null:void 0}];else if(Hc(l))C=l;else{let e=Object.keys(v);C=u?e.sort(u):e}let w=s?String(t).replace(/\./g,`%2E`):String(t),ee=r&&Hc(v)&&v.length===1?w+`[]`:w;if(i&&Hc(v)&&v.length===0)return ee+`[]`;for(let t=0;t<C.length;++t){let y=C[t],x=typeof y==`object`&&y.value!==void 0?y.value:v[y];if(o&&x===null)continue;let w=d&&s?y.replace(/\./g,`%2E`):y,te=Hc(v)?typeof n==`function`?n(ee,w):ee:ee+(d?`.`+w:`[`+w+`]`);_.set(e,b);let T=new WeakMap;T.set(El,_),Sl(S,Dl(x,te,n,r,i,a,o,s,n===`comma`&&h&&Hc(v)?null:c,l,u,d,f,p,m,h,g,T))}return S}function Ol(e=wl){if(e.allowEmptyArrays!==void 0&&typeof e.allowEmptyArrays!=`boolean`)throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(e.encodeDotInKeys!==void 0&&typeof e.encodeDotInKeys!=`boolean`)throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&e.encoder!==void 0&&typeof e.encoder!=`function`)throw TypeError(`Encoder has to be a function.`);let t=e.charset||wl.charset;if(e.charset!==void 0&&e.charset!==`utf-8`&&e.charset!==`iso-8859-1`)throw TypeError(`The charset option must be either utf-8, iso-8859-1, or undefined`);let n=fl;if(e.format!==void 0){if(!hl(ml,e.format))throw TypeError(`Unknown format option provided.`);n=e.format}let r=ml[n],i=wl.filter;(typeof e.filter==`function`||Hc(e.filter))&&(i=e.filter);let a;if(a=e.arrayFormat&&e.arrayFormat in xl?e.arrayFormat:`indices`in e?e.indices?`indices`:`repeat`:wl.arrayFormat,`commaRoundTrip`in e&&typeof e.commaRoundTrip!=`boolean`)throw TypeError("`commaRoundTrip` must be a boolean, or absent");let o=e.allowDots===void 0?e.encodeDotInKeys?!0:wl.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix==`boolean`?e.addQueryPrefix:wl.addQueryPrefix,allowDots:o,allowEmptyArrays:typeof e.allowEmptyArrays==`boolean`?!!e.allowEmptyArrays:wl.allowEmptyArrays,arrayFormat:a,charset:t,charsetSentinel:typeof e.charsetSentinel==`boolean`?e.charsetSentinel:wl.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:e.delimiter===void 0?wl.delimiter:e.delimiter,encode:typeof e.encode==`boolean`?e.encode:wl.encode,encodeDotInKeys:typeof e.encodeDotInKeys==`boolean`?e.encodeDotInKeys:wl.encodeDotInKeys,encoder:typeof e.encoder==`function`?e.encoder:wl.encoder,encodeValuesOnly:typeof e.encodeValuesOnly==`boolean`?e.encodeValuesOnly:wl.encodeValuesOnly,filter:i,format:n,formatter:r,serializeDate:typeof e.serializeDate==`function`?e.serializeDate:wl.serializeDate,skipNulls:typeof e.skipNulls==`boolean`?e.skipNulls:wl.skipNulls,sort:typeof e.sort==`function`?e.sort:null,strictNullHandling:typeof e.strictNullHandling==`boolean`?e.strictNullHandling:wl.strictNullHandling}}function kl(e,t={}){let n=e,r=Ol(t),i,a;typeof r.filter==`function`?(a=r.filter,n=a(``,n)):Hc(r.filter)&&(a=r.filter,i=a);let o=[];if(typeof n!=`object`||!n)return``;let s=xl[r.arrayFormat],c=s===`comma`&&r.commaRoundTrip;i||=Object.keys(n),r.sort&&i.sort(r.sort);let l=new WeakMap;for(let e=0;e<i.length;++e){let t=i[e];r.skipNulls&&n[t]===null||Sl(o,Dl(n[t],t,s,c,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}let u=o.join(r.delimiter),d=r.addQueryPrefix===!0?`?`:``;return r.charsetSentinel&&(r.charset===`iso-8859-1`?d+=`utf8=%26%2310003%3B&`:d+=`utf8=%E2%9C%93&`),u.length>0?d+u:``}function Al(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}let jl;function Ml(e){let t;return(jl??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}let Nl;function Pl(e){let t;return(Nl??=(t=new globalThis.TextDecoder,t.decode.bind(t)))(e)}var Fl,Il,Ll=class{constructor(){Fl.set(this,void 0),Il.set(this,void 0),q(this,Fl,new Uint8Array,`f`),q(this,Il,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?Ml(e):e;q(this,Fl,Al([J(this,Fl,`f`),t]),`f`);let n=[],r;for(;(r=Rl(J(this,Fl,`f`),J(this,Il,`f`)))!=null;){if(r.carriage&&J(this,Il,`f`)==null){q(this,Il,r.index,`f`);continue}if(J(this,Il,`f`)!=null&&(r.index!==J(this,Il,`f`)+1||r.carriage)){n.push(Pl(J(this,Fl,`f`).subarray(0,J(this,Il,`f`)-1))),q(this,Fl,J(this,Fl,`f`).subarray(J(this,Il,`f`)),`f`),q(this,Il,null,`f`);continue}let e=J(this,Il,`f`)===null?r.preceding:r.preceding-1,t=Pl(J(this,Fl,`f`).subarray(0,e));n.push(t),q(this,Fl,J(this,Fl,`f`).subarray(r.index),`f`),q(this,Il,null,`f`)}return n}flush(){return J(this,Fl,`f`).length?this.decode(`
137
+ `):[]}};Fl=new WeakMap,Il=new WeakMap,Ll.NEWLINE_CHARS=new Set([`
138
+ `,`\r`]),Ll.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Rl(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function zl(e){for(let t=0;t<e.length-1;t++){if(e[t]===10&&e[t+1]===10||e[t]===13&&e[t+1]===13)return t+2;if(e[t]===13&&e[t+1]===10&&t+3<e.length&&e[t+2]===13&&e[t+3]===10)return t+4}return-1}const Bl={off:0,error:200,warn:300,info:400,debug:500},Vl=(e,t,n)=>{if(e){if(Kc(Bl,e))return e;Kl(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Bl))}`)}};function Hl(){}function Ul(e,t,n){return!t||Bl[e]>Bl[n]?Hl:t[e].bind(t)}const Wl={error:Hl,warn:Hl,info:Hl,debug:Hl};let Gl=new WeakMap;function Kl(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return Wl;let r=Gl.get(t);if(r&&r[0]===n)return r[1];let i={error:Ul(`error`,t,n),warn:Ul(`warn`,t,n),info:Ul(`info`,t,n),debug:Ul(`debug`,t,n)};return Gl.set(t,[n,i]),i}const ql=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`authorization`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t])),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e);var Jl,Yl=class e{constructor(e,t,n){this.iterator=e,Jl.set(this,void 0),this.controller=t,q(this,Jl,n,`f`)}static fromSSEResponse(t,n,r){let i=!1,a=r?Kl(r):console;async function*o(){if(i)throw new Y("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let r of Xl(t,n))if(!e){if(r.data.startsWith(`[DONE]`)){e=!0;continue}if(r.event===null||!r.event.startsWith(`thread.`)){let e;try{e=JSON.parse(r.data)}catch(e){throw a.error(`Could not parse message into JSON:`,r.data),a.error(`From chunk:`,r.raw),e}if(e&&e.error)throw new Tc(void 0,e.error,void 0,t.headers);yield e}else{let e;try{e=JSON.parse(r.data)}catch(e){throw console.error(`Could not parse message into JSON:`,r.data),console.error(`From chunk:`,r.raw),e}if(r.event==`error`)throw new Tc(void 0,e.error,e.message,void 0);yield{event:r.event,data:e}}}e=!0}catch(e){if(Cc(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new Ll,n=ll(t);for await(let t of n)for(let n of e.decode(t))yield n;for(let t of e.flush())yield t}async function*o(){if(i)throw new Y("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(Cc(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(Jl=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,J(this,Jl,`f`)),new e(()=>i(n),this.controller,J(this,Jl,`f`))]}toReadableStream(){let e=this,t;return sl({async start(){t=e[Symbol.asyncIterator]()},async pull(e){try{let{value:n,done:r}=await t.next();if(r)return e.close();let i=Ml(JSON.stringify(n)+`
139
+ `);e.enqueue(i)}catch(t){e.error(t)}},async cancel(){await t.return?.()}})}};async function*Xl(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new Y(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new Y(`Attempted to iterate over a response with no body`);let n=new Ql,r=new Ll,i=ll(e.body);for await(let e of Zl(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}async function*Zl(e){let t=new Uint8Array;for await(let n of e){if(n==null)continue;let e=n instanceof ArrayBuffer?new Uint8Array(n):typeof n==`string`?Ml(n):n,r=new Uint8Array(t.length+e.length);r.set(t),r.set(e,t.length),t=r;let i;for(;(i=zl(t))!==-1;)yield t.slice(0,i),t=t.slice(i)}t.length>0&&(yield t)}var Ql=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
140
+ `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],e}if(this.chunks.push(e),e.startsWith(`:`))return null;let[t,n,r]=$l(e,`:`);return r.startsWith(` `)&&(r=r.substring(1)),t===`event`?this.event=r:t===`data`&&this.data.push(r),null}};function $l(e,t){let n=e.indexOf(t);return n===-1?[e,``,``]:[e.substring(0,n),t,e.substring(n+t.length)]}async function eu(e,t){let{response:n,requestLogID:r,retryOfRequestLogID:i,startTime:a}=t,o=await(async()=>{if(t.options.stream)return Kl(e).debug(`response`,n.status,n.url,n.headers,n.body),t.options.__streamClass?t.options.__streamClass.fromSSEResponse(n,t.controller,e):Yl.fromSSEResponse(n,t.controller,e);if(n.status===204)return null;if(t.options.__binaryResponse)return n;let r=n.headers.get(`content-type`)?.split(`;`)[0]?.trim();return r?.includes(`application/json`)||r?.endsWith(`+json`)?tu(await n.json(),n):await n.text()})();return Kl(e).debug(`[${r}] response parsed`,ql({retryOfRequestLogID:i,url:n.url,status:n.status,body:o,durationMs:Date.now()-a})),o}function tu(e,t){return!e||typeof e!=`object`||Array.isArray(e)?e:Object.defineProperty(e,`_request_id`,{value:t.headers.get(`x-request-id`),enumerable:!1})}var nu,ru=class e extends Promise{constructor(e,t,n=eu){super(e=>{e(null)}),this.responsePromise=t,this.parseResponse=n,nu.set(this,void 0),q(this,nu,e,`f`)}_thenUnwrap(t){return new e(J(this,nu,`f`),this.responsePromise,async(e,n)=>tu(t(await this.parseResponse(e,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t,request_id:t.headers.get(`x-request-id`)}}parse(){return this.parsedPromise||=this.responsePromise.then(e=>this.parseResponse(J(this,nu,`f`),e)),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};nu=new WeakMap;var iu,au=class{constructor(e,t,n,r){iu.set(this,void 0),q(this,iu,e,`f`),this.options=r,this.response=t,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new Y("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await J(this,iu,`f`).requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(iu=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}},ou=class extends ru{constructor(e,t,n){super(e,t,async(e,t)=>new n(e,t.response,await eu(e,t),t.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let t of e)yield t}},su=class extends au{constructor(e,t,n,r){super(e,t,n,r),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}},cu=class extends au{constructor(e,t,n,r){super(e,t,n,r),this.data=n.data||[],this.has_more=n.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.getPaginatedItems(),t=e[e.length-1]?.id;return t?{...this.options,query:{...Wc(this.options.query),after:t}}:null}},lu=class extends au{constructor(e,t,n,r){super(e,t,n,r),this.data=n.data||[],this.has_more=n.has_more||!1,this.last_id=n.last_id||``}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.last_id;return e?{...this.options,query:{...Wc(this.options.query),after:e}}:null}};const uu=()=>{if(typeof File>`u`){let{process:e}=globalThis,t=typeof e?.versions?.node==`string`&&parseInt(e.versions.node.split(`.`))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(t?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":``))}};function du(e,t,n){return uu(),new File(e,t??`unknown_file`,n)}function fu(e){return(typeof e==`object`&&!!e&&(`name`in e&&e.name&&String(e.name)||`url`in e&&e.url&&String(e.url)||`filename`in e&&e.filename&&String(e.filename)||`path`in e&&e.path&&String(e.path))||``).split(/[\\/]/).pop()||void 0}const pu=e=>typeof e==`object`&&!!e&&typeof e[Symbol.asyncIterator]==`function`,mu=async(e,t)=>xu(e.body)?{...e,body:await vu(e.body,t)}:e,hu=async(e,t)=>({...e,body:await vu(e.body,t)}),gu=new WeakMap;function _u(e){let t=typeof e==`function`?e:e.fetch,n=gu.get(t);if(n)return n;let r=(async()=>{try{let e=`Response`in t?t.Response:(await t(`data:,`)).constructor,n=new FormData;return n.toString()!==await new e(n).text()}catch{return!0}})();return gu.set(t,r),r}const vu=async(e,t)=>{if(!await _u(t))throw TypeError(`The provided fetch function does not support file uploads with the current global FormData class.`);let n=new FormData;return await Promise.all(Object.entries(e||{}).map(([e,t])=>Su(n,e,t))),n},yu=e=>e instanceof Blob&&`name`in e,bu=e=>typeof e==`object`&&!!e&&(e instanceof Response||pu(e)||yu(e)),xu=e=>{if(bu(e))return!0;if(Array.isArray(e))return e.some(xu);if(e&&typeof e==`object`){for(let t in e)if(xu(e[t]))return!0}return!1},Su=async(e,t,n)=>{if(n!==void 0){if(n==null)throw TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if(typeof n==`string`||typeof n==`number`||typeof n==`boolean`)e.append(t,String(n));else if(n instanceof Response)e.append(t,du([await n.blob()],fu(n)));else if(pu(n))e.append(t,du([await new Response(cl(n)).blob()],fu(n)));else if(yu(n))e.append(t,n,fu(n));else if(Array.isArray(n))await Promise.all(n.map(n=>Su(e,t+`[]`,n)));else if(typeof n==`object`)await Promise.all(Object.entries(n).map(([n,r])=>Su(e,`${t}[${n}]`,r)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${n} instead`)}},Cu=e=>typeof e==`object`&&!!e&&typeof e.size==`number`&&typeof e.type==`string`&&typeof e.text==`function`&&typeof e.slice==`function`&&typeof e.arrayBuffer==`function`,wu=e=>typeof e==`object`&&!!e&&typeof e.name==`string`&&typeof e.lastModified==`number`&&Cu(e),Tu=e=>typeof e==`object`&&!!e&&typeof e.url==`string`&&typeof e.blob==`function`;async function Eu(e,t,n){if(uu(),e=await e,wu(e))return e instanceof File?e:du([await e.arrayBuffer()],e.name);if(Tu(e)){let r=await e.blob();return t||=new URL(e.url).pathname.split(/[\\/]/).pop(),du(await Du(r),t,n)}let r=await Du(e);if(t||=fu(e),!n?.type){let e=r.find(e=>typeof e==`object`&&`type`in e&&e.type);typeof e==`string`&&(n={...n,type:e})}return du(r,t,n)}async function Du(e){let t=[];if(typeof e==`string`||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(Cu(e))t.push(e instanceof Blob?e:await e.arrayBuffer());else if(pu(e))for await(let n of e)t.push(...await Du(n));else{let t=e?.constructor?.name;throw Error(`Unexpected data type: ${typeof e}${t?`; constructor: ${t}`:``}${Ou(e)}`)}return t}function Ou(e){return typeof e!=`object`||!e?``:`; props: [${Object.getOwnPropertyNames(e).map(e=>`"${e}"`).join(`, `)}]`}var X=class{constructor(e){this._client=e}};function ku(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}const Au=Object.freeze(Object.create(null)),Z=((e=ku)=>function(t,...n){if(t.length===1)return t[0];let r=!1,i=[],a=t.reduce((t,a,o)=>{/[?#]/.test(a)&&(r=!0);let s=n[o],c=(r?encodeURIComponent:e)(``+s);return o!==n.length&&(s==null||typeof s==`object`&&s.toString===Object.getPrototypeOf(Object.getPrototypeOf(s.hasOwnProperty??Au)??Au)?.toString)&&(c=s+``,i.push({start:t.length+a.length,length:c.length,error:`Value of type ${Object.prototype.toString.call(s).slice(8,-1)} is not a valid path parameter`})),t+a+(o===n.length?``:c)},``),o=a.split(/[?#]/,1)[0],s=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,c;for(;(c=s.exec(o))!==null;)i.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can\'t be safely passed as a path parameter`});if(i.sort((e,t)=>e.start-t.start),i.length>0){let e=0,t=i.reduce((t,n)=>{let r=` `.repeat(n.start-e),i=`^`.repeat(n.length);return e=n.start+n.length,t+r+i},``);throw new Y(`Path parameters result in path with invalid segments:\n${i.map(e=>e.error).join(`
141
+ `)}\n${a}\n${t}`)}return a})(ku);var ju=class extends X{list(e,t={},n){return this._client.getAPIList(Z`/chat/completions/${e}/messages`,cu,{query:t,...n})}};function Mu(e){return e!==void 0&&`function`in e&&e.function!==void 0}function Nu(e){return e?.$brand===`auto-parseable-response-format`}function Pu(e){return e?.$brand===`auto-parseable-tool`}function Fu(e,t){return!t||!Bu(t)?{...e,choices:e.choices.map(e=>(Vu(e.message.tool_calls),{...e,message:{...e.message,parsed:null,...e.message.tool_calls?{tool_calls:e.message.tool_calls}:void 0}}))}:Iu(e,t)}function Iu(e,t){let n=e.choices.map(e=>{if(e.finish_reason===`length`)throw new Lc;if(e.finish_reason===`content_filter`)throw new Rc;return Vu(e.message.tool_calls),{...e,message:{...e.message,...e.message.tool_calls?{tool_calls:e.message.tool_calls?.map(e=>Ru(t,e))??void 0}:void 0,parsed:e.message.content&&!e.message.refusal?Lu(t,e.message.content):null}}});return{...e,choices:n}}function Lu(e,t){return e.response_format?.type===`json_schema`&&e.response_format?.type===`json_schema`?`$parseRaw`in e.response_format?e.response_format.$parseRaw(t):JSON.parse(t):null}function Ru(e,t){let n=e.tools?.find(e=>Mu(e)&&e.function?.name===t.function.name);return{...t,function:{...t.function,parsed_arguments:Pu(n)?n.$parseRaw(t.function.arguments):n?.function.strict?JSON.parse(t.function.arguments):null}}}function zu(e,t){if(!e||!(`tools`in e)||!e.tools)return!1;let n=e.tools?.find(e=>Mu(e)&&e.function?.name===t.function.name);return Mu(n)&&(Pu(n)||n?.function.strict||!1)}function Bu(e){return Nu(e.response_format)?!0:e.tools?.some(e=>Pu(e)||e.type===`function`&&e.function.strict===!0)??!1}function Vu(e){for(let t of e||[])if(t.type!==`function`)throw new Y(`Currently only \`function\` tool calls are supported; Received \`${t.type}\``)}function Hu(e){for(let t of e??[]){if(t.type!==`function`)throw new Y(`Currently only \`function\` tool types support auto-parsing; Received \`${t.type}\``);if(t.function.strict!==!0)throw new Y(`The \`${t.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}const Uu=e=>e?.role===`assistant`,Wu=e=>e?.role===`tool`;var Gu,Ku,qu,Ju,Yu,Xu,Zu,Qu,$u,ed,td,nd,rd,id=class{constructor(){Gu.add(this),this.controller=new AbortController,Ku.set(this,void 0),qu.set(this,()=>{}),Ju.set(this,()=>{}),Yu.set(this,void 0),Xu.set(this,()=>{}),Zu.set(this,()=>{}),Qu.set(this,{}),$u.set(this,!1),ed.set(this,!1),td.set(this,!1),nd.set(this,!1),q(this,Ku,new Promise((e,t)=>{q(this,qu,e,`f`),q(this,Ju,t,`f`)}),`f`),q(this,Yu,new Promise((e,t)=>{q(this,Xu,e,`f`),q(this,Zu,t,`f`)}),`f`),J(this,Ku,`f`).catch(()=>{}),J(this,Yu,`f`).catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit(`end`)},J(this,Gu,`m`,rd).bind(this))},0)}_connected(){this.ended||(J(this,qu,`f`).call(this),this._emit(`connect`))}get ended(){return J(this,$u,`f`)}get errored(){return J(this,ed,`f`)}get aborted(){return J(this,td,`f`)}abort(){this.controller.abort()}on(e,t){return(J(this,Qu,`f`)[e]||(J(this,Qu,`f`)[e]=[])).push({listener:t}),this}off(e,t){let n=J(this,Qu,`f`)[e];if(!n)return this;let r=n.findIndex(e=>e.listener===t);return r>=0&&n.splice(r,1),this}once(e,t){return(J(this,Qu,`f`)[e]||(J(this,Qu,`f`)[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,n)=>{q(this,nd,!0,`f`),e!==`error`&&this.once(`error`,n),this.once(e,t)})}async done(){q(this,nd,!0,`f`),await J(this,Yu,`f`)}_emit(e,...t){if(J(this,$u,`f`))return;e===`end`&&(q(this,$u,!0,`f`),J(this,Xu,`f`).call(this));let n=J(this,Qu,`f`)[e];if(n&&(J(this,Qu,`f`)[e]=n.filter(e=>!e.once),n.forEach(({listener:e})=>e(...t))),e===`abort`){let e=t[0];!J(this,nd,`f`)&&!n?.length&&Promise.reject(e),J(this,Ju,`f`).call(this,e),J(this,Zu,`f`).call(this,e),this._emit(`end`);return}if(e===`error`){let e=t[0];!J(this,nd,`f`)&&!n?.length&&Promise.reject(e),J(this,Ju,`f`).call(this,e),J(this,Zu,`f`).call(this,e),this._emit(`end`)}}_emitFinal(){}};Ku=new WeakMap,qu=new WeakMap,Ju=new WeakMap,Yu=new WeakMap,Xu=new WeakMap,Zu=new WeakMap,Qu=new WeakMap,$u=new WeakMap,ed=new WeakMap,td=new WeakMap,nd=new WeakMap,Gu=new WeakSet,rd=function(e){if(q(this,ed,!0,`f`),e instanceof Error&&e.name===`AbortError`&&(e=new Ec),e instanceof Ec)return q(this,td,!0,`f`),this._emit(`abort`,e);if(e instanceof Y)return this._emit(`error`,e);if(e instanceof Error){let t=new Y(e.message);return t.cause=e,this._emit(`error`,t)}return this._emit(`error`,new Y(String(e)))};function ad(e){return typeof e.parse==`function`}var od,sd,cd,ld,ud,dd,fd,pd,md=class extends id{constructor(){super(...arguments),od.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit(`chatCompletion`,e);let t=e.choices[0]?.message;return t&&this._addMessage(t),e}_addMessage(e,t=!0){if(`content`in e||(e.content=null),this.messages.push(e),t){if(this._emit(`message`,e),Wu(e)&&e.content)this._emit(`functionToolCallResult`,e.content);else if(Uu(e)&&e.tool_calls)for(let t of e.tool_calls)t.type===`function`&&this._emit(`functionToolCall`,t.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new Y(`stream ended without producing a ChatCompletion`);return e}async finalContent(){return await this.done(),J(this,od,`m`,sd).call(this)}async finalMessage(){return await this.done(),J(this,od,`m`,cd).call(this)}async finalFunctionToolCall(){return await this.done(),J(this,od,`m`,ld).call(this)}async finalFunctionToolCallResult(){return await this.done(),J(this,od,`m`,ud).call(this)}async totalUsage(){return await this.done(),J(this,od,`m`,dd).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit(`finalChatCompletion`,e);let t=J(this,od,`m`,cd).call(this);t&&this._emit(`finalMessage`,t);let n=J(this,od,`m`,sd).call(this);n&&this._emit(`finalContent`,n);let r=J(this,od,`m`,ld).call(this);r&&this._emit(`finalFunctionToolCall`,r);let i=J(this,od,`m`,ud).call(this);i!=null&&this._emit(`finalFunctionToolCallResult`,i),this._chatCompletions.some(e=>e.usage)&&this._emit(`totalUsage`,J(this,od,`m`,dd).call(this))}async _createChatCompletion(e,t,n){let r=n?.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener(`abort`,()=>this.controller.abort())),J(this,od,`m`,fd).call(this,t);let i=await e.chat.completions.create({...t,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(Iu(i,t))}async _runChatCompletion(e,t,n){for(let e of t.messages)this._addMessage(e,!1);return await this._createChatCompletion(e,t,n)}async _runTools(e,t,n){let r=`tool`,{tool_choice:i=`auto`,stream:a,...o}=t,s=typeof i!=`string`&&i.type===`function`&&i?.function?.name,{maxChatCompletions:c=10}=n||{},l=t.tools.map(e=>{if(Pu(e)){if(!e.$callback)throw new Y("Tool given to `.runTools()` that does not have an associated function");return{type:`function`,function:{function:e.$callback,name:e.function.name,description:e.function.description||``,parameters:e.function.parameters,parse:e.$parseRaw,strict:!0}}}return e}),u={};for(let e of l)e.type===`function`&&(u[e.function.name||e.function.function.name]=e.function);let d=`tools`in t?l.map(e=>e.type===`function`?{type:`function`,function:{name:e.function.name||e.function.function.name,parameters:e.function.parameters,description:e.function.description,strict:e.function.strict}}:e):void 0;for(let e of t.messages)this._addMessage(e,!1);for(let t=0;t<c;++t){let t=(await this._createChatCompletion(e,{...o,tool_choice:i,tools:d,messages:[...this.messages]},n)).choices[0]?.message;if(!t)throw new Y(`missing message in ChatCompletion response`);if(!t.tool_calls?.length)return;for(let e of t.tool_calls){if(e.type!==`function`)continue;let t=e.id,{name:n,arguments:i}=e.function,a=u[n];if(a){if(s&&s!==n){let e=`Invalid tool_call: ${JSON.stringify(n)}. ${JSON.stringify(s)} requested. Please try again`;this._addMessage({role:r,tool_call_id:t,content:e});continue}}else{let e=`Invalid tool_call: ${JSON.stringify(n)}. Available options are: ${Object.keys(u).map(e=>JSON.stringify(e)).join(`, `)}. Please try again`;this._addMessage({role:r,tool_call_id:t,content:e});continue}let o;try{o=ad(a)?await a.parse(i):i}catch(e){let n=e instanceof Error?e.message:String(e);this._addMessage({role:r,tool_call_id:t,content:n});continue}let c=await a.function(o,this),l=J(this,od,`m`,pd).call(this,c);if(this._addMessage({role:r,tool_call_id:t,content:l}),s)return}}}};od=new WeakSet,sd=function(){return J(this,od,`m`,cd).call(this).content??null},cd=function(){let e=this.messages.length;for(;e-- >0;){let t=this.messages[e];if(Uu(t))return{...t,content:t.content??null,refusal:t.refusal??null}}throw new Y(`stream ended without producing a ChatCompletionMessage with role=assistant`)},ld=function(){for(let e=this.messages.length-1;e>=0;e--){let t=this.messages[e];if(Uu(t)&&t?.tool_calls?.length)return t.tool_calls.filter(e=>e.type===`function`).at(-1)?.function}},ud=function(){for(let e=this.messages.length-1;e>=0;e--){let t=this.messages[e];if(Wu(t)&&t.content!=null&&typeof t.content==`string`&&this.messages.some(e=>e.role===`assistant`&&e.tool_calls?.some(e=>e.type===`function`&&e.id===t.tool_call_id)))return t.content}},dd=function(){let e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:t}of this._chatCompletions)t&&(e.completion_tokens+=t.completion_tokens,e.prompt_tokens+=t.prompt_tokens,e.total_tokens+=t.total_tokens);return e},fd=function(e){if(e.n!=null&&e.n>1)throw new Y(`ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.`)},pd=function(e){return typeof e==`string`?e:e===void 0?`undefined`:JSON.stringify(e)};var hd=class e extends md{static runTools(t,n,r){let i=new e,a={...r,headers:{...r?.headers,"X-Stainless-Helper-Method":`runTools`}};return i._run(()=>i._runTools(t,n,a)),i}_addMessage(e,t=!0){super._addMessage(e,t),Uu(e)&&e.content&&this._emit(`content`,e.content)}};const gd={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511};var _d=class extends Error{},vd=class extends Error{};function yd(e,t=gd.ALL){if(typeof e!=`string`)throw TypeError(`expecting str, got ${typeof e}`);if(!e.trim())throw Error(`${e} is empty`);return bd(e.trim(),t)}const bd=(e,t)=>{let n=e.length,r=0,i=e=>{throw new _d(`${e} at position ${r}`)},a=e=>{throw new vd(`${e} at position ${r}`)},o=()=>(d(),r>=n&&i(`Unexpected end of input`),e[r]===`"`?s():e[r]===`{`?c():e[r]===`[`?l():e.substring(r,r+4)===`null`||gd.NULL&t&&n-r<4&&`null`.startsWith(e.substring(r))?(r+=4,null):e.substring(r,r+4)===`true`||gd.BOOL&t&&n-r<4&&`true`.startsWith(e.substring(r))?(r+=4,!0):e.substring(r,r+5)===`false`||gd.BOOL&t&&n-r<5&&`false`.startsWith(e.substring(r))?(r+=5,!1):e.substring(r,r+8)===`Infinity`||gd.INFINITY&t&&n-r<8&&`Infinity`.startsWith(e.substring(r))?(r+=8,1/0):e.substring(r,r+9)===`-Infinity`||gd.MINUS_INFINITY&t&&1<n-r&&n-r<9&&`-Infinity`.startsWith(e.substring(r))?(r+=9,-1/0):e.substring(r,r+3)===`NaN`||gd.NAN&t&&n-r<3&&`NaN`.startsWith(e.substring(r))?(r+=3,NaN):u()),s=()=>{let o=r,s=!1;for(r++;r<n&&(e[r]!==`"`||s&&e[r-1]===`\\`);)s=e[r]===`\\`?!s:!1,r++;if(e.charAt(r)==`"`)try{return JSON.parse(e.substring(o,++r-Number(s)))}catch(e){a(String(e))}else if(gd.STR&t)try{return JSON.parse(e.substring(o,r-Number(s))+`"`)}catch{return JSON.parse(e.substring(o,e.lastIndexOf(`\\`))+`"`)}i(`Unterminated string literal`)},c=()=>{r++,d();let a={};try{for(;e[r]!==`}`;){if(d(),r>=n&&gd.OBJ&t)return a;let i=s();d(),r++;try{let e=o();Object.defineProperty(a,i,{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){if(gd.OBJ&t)return a;throw e}d(),e[r]===`,`&&r++}}catch{if(gd.OBJ&t)return a;i(`Expected '}' at end of object`)}return r++,a},l=()=>{r++;let n=[];try{for(;e[r]!==`]`;)n.push(o()),d(),e[r]===`,`&&r++}catch{if(gd.ARR&t)return n;i(`Expected ']' at end of array`)}return r++,n},u=()=>{if(r===0){e===`-`&&gd.NUM&t&&i(`Not sure what '-' is`);try{return JSON.parse(e)}catch(n){if(gd.NUM&t)try{return e[e.length-1]===`.`?JSON.parse(e.substring(0,e.lastIndexOf(`.`))):JSON.parse(e.substring(0,e.lastIndexOf(`e`)))}catch{}a(String(n))}}let o=r;for(e[r]===`-`&&r++;e[r]&&!`,]}`.includes(e[r]);)r++;r==n&&!(gd.NUM&t)&&i(`Unterminated number literal`);try{return JSON.parse(e.substring(o,r))}catch{e.substring(o,r)===`-`&&gd.NUM&t&&i(`Not sure what '-' is`);try{return JSON.parse(e.substring(o,e.lastIndexOf(`e`)))}catch(e){a(String(e))}}},d=()=>{for(;r<n&&`
142
+ \r `.includes(e[r]);)r++};return o()},xd=e=>yd(e,gd.ALL^gd.NUM);var Sd,Cd,wd,Td,Ed,Dd,Od,kd,Ad,jd,Md,Nd,Pd=class e extends md{constructor(e){super(),Sd.add(this),Cd.set(this,void 0),wd.set(this,void 0),Td.set(this,void 0),q(this,Cd,e,`f`),q(this,wd,[],`f`)}get currentChatCompletionSnapshot(){return J(this,Td,`f`)}static fromReadableStream(t){let n=new e(null);return n._run(()=>n._fromReadableStream(t)),n}static createChatCompletion(t,n,r){let i=new e(n);return i._run(()=>i._runChatCompletion(t,{...n,stream:!0},{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":`stream`}})),i}async _createChatCompletion(e,t,n){super._createChatCompletion;let r=n?.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener(`abort`,()=>this.controller.abort())),J(this,Sd,`m`,Ed).call(this);let i=await e.chat.completions.create({...t,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let e of i)J(this,Sd,`m`,Od).call(this,e);if(i.controller.signal?.aborted)throw new Ec;return this._addChatCompletion(J(this,Sd,`m`,jd).call(this))}async _fromReadableStream(e,t){let n=t?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener(`abort`,()=>this.controller.abort())),J(this,Sd,`m`,Ed).call(this),this._connected();let r=Yl.fromReadableStream(e,this.controller),i;for await(let e of r)i&&i!==e.id&&this._addChatCompletion(J(this,Sd,`m`,jd).call(this)),J(this,Sd,`m`,Od).call(this,e),i=e.id;if(r.controller.signal?.aborted)throw new Ec;return this._addChatCompletion(J(this,Sd,`m`,jd).call(this))}[(Cd=new WeakMap,wd=new WeakMap,Td=new WeakMap,Sd=new WeakSet,Ed=function(){this.ended||q(this,Td,void 0,`f`)},Dd=function(e){let t=J(this,wd,`f`)[e.index];return t||(t={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},J(this,wd,`f`)[e.index]=t,t)},Od=function(e){if(this.ended)return;let t=J(this,Sd,`m`,Nd).call(this,e);this._emit(`chunk`,e,t);for(let n of e.choices){let e=t.choices[n.index];n.delta.content!=null&&e.message?.role===`assistant`&&e.message?.content&&(this._emit(`content`,n.delta.content,e.message.content),this._emit(`content.delta`,{delta:n.delta.content,snapshot:e.message.content,parsed:e.message.parsed})),n.delta.refusal!=null&&e.message?.role===`assistant`&&e.message?.refusal&&this._emit(`refusal.delta`,{delta:n.delta.refusal,snapshot:e.message.refusal}),n.logprobs?.content!=null&&e.message?.role===`assistant`&&this._emit(`logprobs.content.delta`,{content:n.logprobs?.content,snapshot:e.logprobs?.content??[]}),n.logprobs?.refusal!=null&&e.message?.role===`assistant`&&this._emit(`logprobs.refusal.delta`,{refusal:n.logprobs?.refusal,snapshot:e.logprobs?.refusal??[]});let r=J(this,Sd,`m`,Dd).call(this,e);e.finish_reason&&(J(this,Sd,`m`,Ad).call(this,e),r.current_tool_call_index!=null&&J(this,Sd,`m`,kd).call(this,e,r.current_tool_call_index));for(let t of n.delta.tool_calls??[])r.current_tool_call_index!==t.index&&(J(this,Sd,`m`,Ad).call(this,e),r.current_tool_call_index!=null&&J(this,Sd,`m`,kd).call(this,e,r.current_tool_call_index)),r.current_tool_call_index=t.index;for(let t of n.delta.tool_calls??[]){let n=e.message.tool_calls?.[t.index];n?.type&&(n?.type===`function`?this._emit(`tool_calls.function.arguments.delta`,{name:n.function?.name,index:t.index,arguments:n.function.arguments,parsed_arguments:n.function.parsed_arguments,arguments_delta:t.function?.arguments??``}):n?.type)}}},kd=function(e,t){if(J(this,Sd,`m`,Dd).call(this,e).done_tool_calls.has(t))return;let n=e.message.tool_calls?.[t];if(!n)throw Error(`no tool call snapshot`);if(!n.type)throw Error("tool call snapshot missing `type`");if(n.type===`function`){let e=J(this,Cd,`f`)?.tools?.find(e=>Mu(e)&&e.function.name===n.function.name);this._emit(`tool_calls.function.arguments.done`,{name:n.function.name,index:t,arguments:n.function.arguments,parsed_arguments:Pu(e)?e.$parseRaw(n.function.arguments):e?.function.strict?JSON.parse(n.function.arguments):null})}else n.type},Ad=function(e){let t=J(this,Sd,`m`,Dd).call(this,e);if(e.message.content&&!t.content_done){t.content_done=!0;let n=J(this,Sd,`m`,Md).call(this);this._emit(`content.done`,{content:e.message.content,parsed:n?n.$parseRaw(e.message.content):null})}e.message.refusal&&!t.refusal_done&&(t.refusal_done=!0,this._emit(`refusal.done`,{refusal:e.message.refusal})),e.logprobs?.content&&!t.logprobs_content_done&&(t.logprobs_content_done=!0,this._emit(`logprobs.content.done`,{content:e.logprobs.content})),e.logprobs?.refusal&&!t.logprobs_refusal_done&&(t.logprobs_refusal_done=!0,this._emit(`logprobs.refusal.done`,{refusal:e.logprobs.refusal}))},jd=function(){if(this.ended)throw new Y(`stream has ended, this shouldn't happen`);let e=J(this,Td,`f`);if(!e)throw new Y(`request ended without sending any chunks`);return q(this,Td,void 0,`f`),q(this,wd,[],`f`),Fd(e,J(this,Cd,`f`))},Md=function(){let e=J(this,Cd,`f`)?.response_format;return Nu(e)?e:null},Nd=function(e){var t,n,r,i;let a=J(this,Td,`f`),{choices:o,...s}=e;a?Object.assign(a,s):a=q(this,Td,{...s,choices:[]},`f`);for(let{delta:o,finish_reason:s,index:c,logprobs:l=null,...u}of e.choices){let e=a.choices[c];if(e||=a.choices[c]={finish_reason:s,index:c,message:{},logprobs:l,...u},l)if(!e.logprobs)e.logprobs=Object.assign({},l);else{let{content:r,refusal:i,...a}=l;Object.assign(e.logprobs,a),r&&((t=e.logprobs).content??(t.content=[]),e.logprobs.content.push(...r)),i&&((n=e.logprobs).refusal??(n.refusal=[]),e.logprobs.refusal.push(...i))}if(s&&(e.finish_reason=s,J(this,Cd,`f`)&&Bu(J(this,Cd,`f`)))){if(s===`length`)throw new Lc;if(s===`content_filter`)throw new Rc}if(Object.assign(e,u),!o)continue;let{content:d,refusal:f,function_call:p,role:m,tool_calls:h,...g}=o;if(Object.assign(e.message,g),f&&(e.message.refusal=(e.message.refusal||``)+f),m&&(e.message.role=m),p&&(e.message.function_call?(p.name&&(e.message.function_call.name=p.name),p.arguments&&((r=e.message.function_call).arguments??(r.arguments=``),e.message.function_call.arguments+=p.arguments)):e.message.function_call=p),d&&(e.message.content=(e.message.content||``)+d,!e.message.refusal&&J(this,Sd,`m`,Md).call(this)&&(e.message.parsed=xd(e.message.content))),h){e.message.tool_calls||(e.message.tool_calls=[]);for(let{index:t,id:n,type:r,function:a,...o}of h){let s=(i=e.message.tool_calls)[t]??(i[t]={});Object.assign(s,o),n&&(s.id=n),r&&(s.type=r),a&&(s.function??={name:a.name??``,arguments:``}),a?.name&&(s.function.name=a.name),a?.arguments&&(s.function.arguments+=a.arguments,zu(J(this,Cd,`f`),s)&&(s.function.parsed_arguments=xd(s.function.arguments)))}}}return a},Symbol.asyncIterator)](){let e=[],t=[],n=!1;return this.on(`chunk`,n=>{let r=t.shift();r?r.resolve(n):e.push(n)}),this.on(`end`,()=>{n=!0;for(let e of t)e.resolve(void 0);t.length=0}),this.on(`abort`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),this.on(`error`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((e,n)=>t.push({resolve:e,reject:n})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Yl(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};function Fd(e,t){let{id:n,choices:r,created:i,model:a,system_fingerprint:o,...s}=e;return Fu({...s,id:n,choices:r.map(({message:t,finish_reason:n,index:r,logprobs:i,...a})=>{if(!n)throw new Y(`missing finish_reason for choice ${r}`);let{content:o=null,function_call:s,tool_calls:c,...l}=t,u=t.role;if(!u)throw new Y(`missing role for choice ${r}`);if(s){let{arguments:e,name:c}=s;if(e==null)throw new Y(`missing function_call.arguments for choice ${r}`);if(!c)throw new Y(`missing function_call.name for choice ${r}`);return{...a,message:{content:o,function_call:{arguments:e,name:c},role:u,refusal:t.refusal??null},finish_reason:n,index:r,logprobs:i}}return c?{...a,index:r,finish_reason:n,logprobs:i,message:{...l,role:u,content:o,refusal:t.refusal??null,tool_calls:c.map((t,n)=>{let{function:i,type:a,id:o,...s}=t,{arguments:c,name:l,...u}=i||{};if(o==null)throw new Y(`missing choices[${r}].tool_calls[${n}].id\n${Id(e)}`);if(a==null)throw new Y(`missing choices[${r}].tool_calls[${n}].type\n${Id(e)}`);if(l==null)throw new Y(`missing choices[${r}].tool_calls[${n}].function.name\n${Id(e)}`);if(c==null)throw new Y(`missing choices[${r}].tool_calls[${n}].function.arguments\n${Id(e)}`);return{...s,id:o,type:a,function:{...u,name:l,arguments:c}}})}}:{...a,message:{...l,content:o,role:u,refusal:t.refusal??null},finish_reason:n,index:r,logprobs:i}}),created:i,model:a,object:`chat.completion`,...o?{system_fingerprint:o}:{}},t)}function Id(e){return JSON.stringify(e)}var Ld=class e extends Pd{static fromReadableStream(t){let n=new e(null);return n._run(()=>n._fromReadableStream(t)),n}static runTools(t,n,r){let i=new e(n),a={...r,headers:{...r?.headers,"X-Stainless-Helper-Method":`runTools`}};return i._run(()=>i._runTools(t,n,a)),i}},Rd=class extends X{constructor(){super(...arguments),this.messages=new ju(this._client)}create(e,t){return this._client.post(`/chat/completions`,{body:e,...t,stream:e.stream??!1})}retrieve(e,t){return this._client.get(Z`/chat/completions/${e}`,t)}update(e,t,n){return this._client.post(Z`/chat/completions/${e}`,{body:t,...n})}list(e={},t){return this._client.getAPIList(`/chat/completions`,cu,{query:e,...t})}delete(e,t){return this._client.delete(Z`/chat/completions/${e}`,t)}parse(e,t){return Hu(e.tools),this._client.chat.completions.create(e,{...t,headers:{...t?.headers,"X-Stainless-Helper-Method":`chat.completions.parse`}})._thenUnwrap(t=>Iu(t,e))}runTools(e,t){return e.stream?Ld.runTools(this._client,e,t):hd.runTools(this._client,e,t)}stream(e,t){return Pd.createChatCompletion(this._client,e,t)}};Rd.Messages=ju;var zd=class extends X{constructor(){super(...arguments),this.completions=new Rd(this._client)}};zd.Completions=Rd;const Bd=Symbol(`brand.privateNullableHeaders`);function*Vd(e){if(!e)return;if(Bd in e){let{values:t,nulls:n}=e;yield*t.entries();for(let e of n)yield[e,null];return}let t=!1,n;e instanceof Headers?n=e.entries():Uc(e)?n=e:(t=!0,n=Object.entries(e??{}));for(let e of n){let n=e[0];if(typeof n!=`string`)throw TypeError(`expected header name to be a string`);let r=Uc(e[1])?e[1]:[e[1]],i=!1;for(let e of r)e!==void 0&&(t&&!i&&(i=!0,yield[n,null]),yield[n,e])}}const Q=e=>{let t=new Headers,n=new Set;for(let r of e){let e=new Set;for(let[i,a]of Vd(r)){let r=i.toLowerCase();e.has(r)||(t.delete(i),e.add(r)),a===null?(t.delete(i),n.add(r)):(t.append(i,a),n.delete(r))}}return{[Bd]:!0,values:t,nulls:n}};var Hd=class extends X{create(e,t){return this._client.post(`/audio/speech`,{body:e,...t,headers:Q([{Accept:`application/octet-stream`},t?.headers]),__binaryResponse:!0})}},Ud=class extends X{create(e,t){return this._client.post(`/audio/transcriptions`,hu({body:e,...t,stream:e.stream??!1,__metadata:{model:e.model}},this._client))}},Wd=class extends X{create(e,t){return this._client.post(`/audio/translations`,hu({body:e,...t,__metadata:{model:e.model}},this._client))}},Gd=class extends X{constructor(){super(...arguments),this.transcriptions=new Ud(this._client),this.translations=new Wd(this._client),this.speech=new Hd(this._client)}};Gd.Transcriptions=Ud,Gd.Translations=Wd,Gd.Speech=Hd;var Kd=class extends X{create(e,t){return this._client.post(`/batches`,{body:e,...t})}retrieve(e,t){return this._client.get(Z`/batches/${e}`,t)}list(e={},t){return this._client.getAPIList(`/batches`,cu,{query:e,...t})}cancel(e,t){return this._client.post(Z`/batches/${e}/cancel`,t)}},qd=class extends X{create(e,t){return this._client.post(`/assistants`,{body:e,...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}retrieve(e,t){return this._client.get(Z`/assistants/${e}`,{...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}update(e,t,n){return this._client.post(Z`/assistants/${e}`,{body:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}list(e={},t){return this._client.getAPIList(`/assistants`,cu,{query:e,...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}delete(e,t){return this._client.delete(Z`/assistants/${e}`,{...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}},Jd=class extends X{create(e,t){return this._client.post(`/realtime/sessions`,{body:e,...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}},Yd=class extends X{create(e,t){return this._client.post(`/realtime/transcription_sessions`,{body:e,...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}},Xd=class extends X{constructor(){super(...arguments),this.sessions=new Jd(this._client),this.transcriptionSessions=new Yd(this._client)}};Xd.Sessions=Jd,Xd.TranscriptionSessions=Yd;var Zd=class extends X{create(e,t){return this._client.post(`/chatkit/sessions`,{body:e,...t,headers:Q([{"OpenAI-Beta":`chatkit_beta=v1`},t?.headers])})}cancel(e,t){return this._client.post(Z`/chatkit/sessions/${e}/cancel`,{...t,headers:Q([{"OpenAI-Beta":`chatkit_beta=v1`},t?.headers])})}},Qd=class extends X{retrieve(e,t){return this._client.get(Z`/chatkit/threads/${e}`,{...t,headers:Q([{"OpenAI-Beta":`chatkit_beta=v1`},t?.headers])})}list(e={},t){return this._client.getAPIList(`/chatkit/threads`,lu,{query:e,...t,headers:Q([{"OpenAI-Beta":`chatkit_beta=v1`},t?.headers])})}delete(e,t){return this._client.delete(Z`/chatkit/threads/${e}`,{...t,headers:Q([{"OpenAI-Beta":`chatkit_beta=v1`},t?.headers])})}listItems(e,t={},n){return this._client.getAPIList(Z`/chatkit/threads/${e}/items`,lu,{query:t,...n,headers:Q([{"OpenAI-Beta":`chatkit_beta=v1`},n?.headers])})}},$d=class extends X{constructor(){super(...arguments),this.sessions=new Zd(this._client),this.threads=new Qd(this._client)}};$d.Sessions=Zd,$d.Threads=Qd;var ef=class extends X{create(e,t,n){return this._client.post(Z`/threads/${e}/messages`,{body:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}retrieve(e,t,n){let{thread_id:r}=t;return this._client.get(Z`/threads/${r}/messages/${e}`,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}update(e,t,n){let{thread_id:r,...i}=t;return this._client.post(Z`/threads/${r}/messages/${e}`,{body:i,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}list(e,t={},n){return this._client.getAPIList(Z`/threads/${e}/messages`,cu,{query:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}delete(e,t,n){let{thread_id:r}=t;return this._client.delete(Z`/threads/${r}/messages/${e}`,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}},tf=class extends X{retrieve(e,t,n){let{thread_id:r,run_id:i,...a}=t;return this._client.get(Z`/threads/${r}/runs/${i}/steps/${e}`,{query:a,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}list(e,t,n){let{thread_id:r,...i}=t;return this._client.getAPIList(Z`/threads/${r}/runs/${e}/steps`,cu,{query:i,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}};const nf=e=>{if(typeof Buffer<`u`){let t=Buffer.from(e,`base64`);return Array.from(new Float32Array(t.buffer,t.byteOffset,t.length/Float32Array.BYTES_PER_ELEMENT))}else{let t=atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return Array.from(new Float32Array(r.buffer))}},rf=e=>{if(globalThis.process!==void 0)return globalThis.process.env?.[e]?.trim()??void 0;if(globalThis.Deno!==void 0)return globalThis.Deno.env?.get?.(e)?.trim()};var af,of,sf,cf,lf,uf,df,ff,pf,mf,hf,gf,_f,vf,yf,bf,xf,Sf,Cf,wf,Tf,Ef,Df,Of=class extends id{constructor(){super(...arguments),af.add(this),sf.set(this,[]),cf.set(this,{}),lf.set(this,{}),uf.set(this,void 0),df.set(this,void 0),ff.set(this,void 0),pf.set(this,void 0),mf.set(this,void 0),hf.set(this,void 0),gf.set(this,void 0),_f.set(this,void 0),vf.set(this,void 0)}[(sf=new WeakMap,cf=new WeakMap,lf=new WeakMap,uf=new WeakMap,df=new WeakMap,ff=new WeakMap,pf=new WeakMap,mf=new WeakMap,hf=new WeakMap,gf=new WeakMap,_f=new WeakMap,vf=new WeakMap,af=new WeakSet,Symbol.asyncIterator)](){let e=[],t=[],n=!1;return this.on(`event`,n=>{let r=t.shift();r?r.resolve(n):e.push(n)}),this.on(`end`,()=>{n=!0;for(let e of t)e.resolve(void 0);t.length=0}),this.on(`abort`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),this.on(`error`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((e,n)=>t.push({resolve:e,reject:n})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let t=new of;return t._run(()=>t._fromReadableStream(e)),t}async _fromReadableStream(e,t){let n=t?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener(`abort`,()=>this.controller.abort())),this._connected();let r=Yl.fromReadableStream(e,this.controller);for await(let e of r)J(this,af,`m`,yf).call(this,e);if(r.controller.signal?.aborted)throw new Ec;return this._addRun(J(this,af,`m`,bf).call(this))}toReadableStream(){return new Yl(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,t,n,r){let i=new of;return i._run(()=>i._runToolAssistantStream(e,t,n,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":`stream`}})),i}async _createToolAssistantStream(e,t,n,r){let i=r?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener(`abort`,()=>this.controller.abort()));let a={...n,stream:!0},o=await e.submitToolOutputs(t,a,{...r,signal:this.controller.signal});this._connected();for await(let e of o)J(this,af,`m`,yf).call(this,e);if(o.controller.signal?.aborted)throw new Ec;return this._addRun(J(this,af,`m`,bf).call(this))}static createThreadAssistantStream(e,t,n){let r=new of;return r._run(()=>r._threadAssistantStream(e,t,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":`stream`}})),r}static createAssistantStream(e,t,n,r){let i=new of;return i._run(()=>i._runAssistantStream(e,t,n,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":`stream`}})),i}currentEvent(){return J(this,gf,`f`)}currentRun(){return J(this,_f,`f`)}currentMessageSnapshot(){return J(this,uf,`f`)}currentRunStepSnapshot(){return J(this,vf,`f`)}async finalRunSteps(){return await this.done(),Object.values(J(this,cf,`f`))}async finalMessages(){return await this.done(),Object.values(J(this,lf,`f`))}async finalRun(){if(await this.done(),!J(this,df,`f`))throw Error(`Final run was not received.`);return J(this,df,`f`)}async _createThreadAssistantStream(e,t,n){let r=n?.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener(`abort`,()=>this.controller.abort()));let i={...t,stream:!0},a=await e.createAndRun(i,{...n,signal:this.controller.signal});this._connected();for await(let e of a)J(this,af,`m`,yf).call(this,e);if(a.controller.signal?.aborted)throw new Ec;return this._addRun(J(this,af,`m`,bf).call(this))}async _createAssistantStream(e,t,n,r){let i=r?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener(`abort`,()=>this.controller.abort()));let a={...n,stream:!0},o=await e.create(t,a,{...r,signal:this.controller.signal});this._connected();for await(let e of o)J(this,af,`m`,yf).call(this,e);if(o.controller.signal?.aborted)throw new Ec;return this._addRun(J(this,af,`m`,bf).call(this))}static accumulateDelta(e,t){for(let[n,r]of Object.entries(t)){if(!e.hasOwnProperty(n)){e[n]=r;continue}let t=e[n];if(t==null){e[n]=r;continue}if(n===`index`||n===`type`){e[n]=r;continue}if(typeof t==`string`&&typeof r==`string`)t+=r;else if(typeof t==`number`&&typeof r==`number`)t+=r;else if(qc(t)&&qc(r))t=this.accumulateDelta(t,r);else if(Array.isArray(t)&&Array.isArray(r)){if(t.every(e=>typeof e==`string`||typeof e==`number`)){t.push(...r);continue}for(let e of r){if(!qc(e))throw Error(`Expected array delta entry to be an object but got: ${e}`);let n=e.index;if(n==null)throw console.error(e),Error("Expected array delta entry to have an `index` property");if(typeof n!=`number`)throw Error(`Expected array delta entry \`index\` property to be a number but got ${n}`);let r=t[n];r==null?t.push(e):t[n]=this.accumulateDelta(r,e)}continue}else throw Error(`Unhandled record type: ${n}, deltaValue: ${r}, accValue: ${t}`);e[n]=t}return e}_addRun(e){return e}async _threadAssistantStream(e,t,n){return await this._createThreadAssistantStream(t,e,n)}async _runAssistantStream(e,t,n,r){return await this._createAssistantStream(t,e,n,r)}async _runToolAssistantStream(e,t,n,r){return await this._createToolAssistantStream(t,e,n,r)}};of=Of,yf=function(e){if(!this.ended)switch(q(this,gf,e,`f`),J(this,af,`m`,Cf).call(this,e),e.event){case`thread.created`:break;case`thread.run.created`:case`thread.run.queued`:case`thread.run.in_progress`:case`thread.run.requires_action`:case`thread.run.completed`:case`thread.run.incomplete`:case`thread.run.failed`:case`thread.run.cancelling`:case`thread.run.cancelled`:case`thread.run.expired`:J(this,af,`m`,Df).call(this,e);break;case`thread.run.step.created`:case`thread.run.step.in_progress`:case`thread.run.step.delta`:case`thread.run.step.completed`:case`thread.run.step.failed`:case`thread.run.step.cancelled`:case`thread.run.step.expired`:J(this,af,`m`,Sf).call(this,e);break;case`thread.message.created`:case`thread.message.in_progress`:case`thread.message.delta`:case`thread.message.completed`:case`thread.message.incomplete`:J(this,af,`m`,xf).call(this,e);break;case`error`:throw Error(`Encountered an error event in event processing - errors should be processed earlier`);default:}},bf=function(){if(this.ended)throw new Y(`stream has ended, this shouldn't happen`);if(!J(this,df,`f`))throw Error(`Final run has not been received`);return J(this,df,`f`)},xf=function(e){let[t,n]=J(this,af,`m`,Tf).call(this,e,J(this,uf,`f`));q(this,uf,t,`f`),J(this,lf,`f`)[t.id]=t;for(let e of n){let n=t.content[e.index];n?.type==`text`&&this._emit(`textCreated`,n.text)}switch(e.event){case`thread.message.created`:this._emit(`messageCreated`,e.data);break;case`thread.message.in_progress`:break;case`thread.message.delta`:if(this._emit(`messageDelta`,e.data.delta,t),e.data.delta.content)for(let n of e.data.delta.content){if(n.type==`text`&&n.text){let e=n.text,r=t.content[n.index];if(r&&r.type==`text`)this._emit(`textDelta`,e,r.text);else throw Error(`The snapshot associated with this text delta is not text or missing`)}if(n.index!=J(this,ff,`f`)){if(J(this,pf,`f`))switch(J(this,pf,`f`).type){case`text`:this._emit(`textDone`,J(this,pf,`f`).text,J(this,uf,`f`));break;case`image_file`:this._emit(`imageFileDone`,J(this,pf,`f`).image_file,J(this,uf,`f`));break}q(this,ff,n.index,`f`)}q(this,pf,t.content[n.index],`f`)}break;case`thread.message.completed`:case`thread.message.incomplete`:if(J(this,ff,`f`)!==void 0){let t=e.data.content[J(this,ff,`f`)];if(t)switch(t.type){case`image_file`:this._emit(`imageFileDone`,t.image_file,J(this,uf,`f`));break;case`text`:this._emit(`textDone`,t.text,J(this,uf,`f`));break}}J(this,uf,`f`)&&this._emit(`messageDone`,e.data),q(this,uf,void 0,`f`)}},Sf=function(e){let t=J(this,af,`m`,wf).call(this,e);switch(q(this,vf,t,`f`),e.event){case`thread.run.step.created`:this._emit(`runStepCreated`,e.data);break;case`thread.run.step.delta`:let n=e.data.delta;if(n.step_details&&n.step_details.type==`tool_calls`&&n.step_details.tool_calls&&t.step_details.type==`tool_calls`)for(let e of n.step_details.tool_calls)e.index==J(this,mf,`f`)?this._emit(`toolCallDelta`,e,t.step_details.tool_calls[e.index]):(J(this,hf,`f`)&&this._emit(`toolCallDone`,J(this,hf,`f`)),q(this,mf,e.index,`f`),q(this,hf,t.step_details.tool_calls[e.index],`f`),J(this,hf,`f`)&&this._emit(`toolCallCreated`,J(this,hf,`f`)));this._emit(`runStepDelta`,e.data.delta,t);break;case`thread.run.step.completed`:case`thread.run.step.failed`:case`thread.run.step.cancelled`:case`thread.run.step.expired`:q(this,vf,void 0,`f`),e.data.step_details.type==`tool_calls`&&J(this,hf,`f`)&&(this._emit(`toolCallDone`,J(this,hf,`f`)),q(this,hf,void 0,`f`)),this._emit(`runStepDone`,e.data,t);break;case`thread.run.step.in_progress`:break}},Cf=function(e){J(this,sf,`f`).push(e),this._emit(`event`,e)},wf=function(e){switch(e.event){case`thread.run.step.created`:return J(this,cf,`f`)[e.data.id]=e.data,e.data;case`thread.run.step.delta`:let t=J(this,cf,`f`)[e.data.id];if(!t)throw Error(`Received a RunStepDelta before creation of a snapshot`);let n=e.data;if(n.delta){let r=of.accumulateDelta(t,n.delta);J(this,cf,`f`)[e.data.id]=r}return J(this,cf,`f`)[e.data.id];case`thread.run.step.completed`:case`thread.run.step.failed`:case`thread.run.step.cancelled`:case`thread.run.step.expired`:case`thread.run.step.in_progress`:J(this,cf,`f`)[e.data.id]=e.data;break}if(J(this,cf,`f`)[e.data.id])return J(this,cf,`f`)[e.data.id];throw Error(`No snapshot available`)},Tf=function(e,t){let n=[];switch(e.event){case`thread.message.created`:return[e.data,n];case`thread.message.delta`:if(!t)throw Error(`Received a delta with no existing snapshot (there should be one from message creation)`);let r=e.data;if(r.delta.content)for(let e of r.delta.content)if(e.index in t.content){let n=t.content[e.index];t.content[e.index]=J(this,af,`m`,Ef).call(this,e,n)}else t.content[e.index]=e,n.push(e);return[t,n];case`thread.message.in_progress`:case`thread.message.completed`:case`thread.message.incomplete`:if(t)return[t,n];throw Error(`Received thread message event with no existing snapshot`)}throw Error(`Tried to accumulate a non-message event`)},Ef=function(e,t){return of.accumulateDelta(t,e)},Df=function(e){switch(q(this,_f,e.data,`f`),e.event){case`thread.run.created`:break;case`thread.run.queued`:break;case`thread.run.in_progress`:break;case`thread.run.requires_action`:case`thread.run.cancelled`:case`thread.run.failed`:case`thread.run.completed`:case`thread.run.expired`:case`thread.run.incomplete`:q(this,df,e.data,`f`),J(this,hf,`f`)&&(this._emit(`toolCallDone`,J(this,hf,`f`)),q(this,hf,void 0,`f`));break;case`thread.run.cancelling`:break}};var kf=class extends X{constructor(){super(...arguments),this.steps=new tf(this._client)}create(e,t,n){let{include:r,...i}=t;return this._client.post(Z`/threads/${e}/runs`,{query:{include:r},body:i,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers]),stream:t.stream??!1})}retrieve(e,t,n){let{thread_id:r}=t;return this._client.get(Z`/threads/${r}/runs/${e}`,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}update(e,t,n){let{thread_id:r,...i}=t;return this._client.post(Z`/threads/${r}/runs/${e}`,{body:i,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}list(e,t={},n){return this._client.getAPIList(Z`/threads/${e}/runs`,cu,{query:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}cancel(e,t,n){let{thread_id:r}=t;return this._client.post(Z`/threads/${r}/runs/${e}/cancel`,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}async createAndPoll(e,t,n){let r=await this.create(e,t,n);return await this.poll(r.id,{thread_id:e},n)}createAndStream(e,t,n){return Of.createAssistantStream(e,this._client.beta.threads.runs,t,n)}async poll(e,t,n){let r=Q([n?.headers,{"X-Stainless-Poll-Helper":`true`,"X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:a}=await this.retrieve(e,t,{...n,headers:{...n?.headers,...r}}).withResponse();switch(i.status){case`queued`:case`in_progress`:case`cancelling`:let e=5e3;if(n?.pollIntervalMs)e=n.pollIntervalMs;else{let t=a.headers.get(`openai-poll-after-ms`);if(t){let n=parseInt(t);isNaN(n)||(e=n)}}await Xc(e);break;case`requires_action`:case`incomplete`:case`cancelled`:case`completed`:case`failed`:case`expired`:return i}}}stream(e,t,n){return Of.createAssistantStream(e,this._client.beta.threads.runs,t,n)}submitToolOutputs(e,t,n){let{thread_id:r,...i}=t;return this._client.post(Z`/threads/${r}/runs/${e}/submit_tool_outputs`,{body:i,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers]),stream:t.stream??!1})}async submitToolOutputsAndPoll(e,t,n){let r=await this.submitToolOutputs(e,t,n);return await this.poll(r.id,t,n)}submitToolOutputsStream(e,t,n){return Of.createToolAssistantStream(e,this._client.beta.threads.runs,t,n)}};kf.Steps=tf;var Af=class extends X{constructor(){super(...arguments),this.runs=new kf(this._client),this.messages=new ef(this._client)}create(e={},t){return this._client.post(`/threads`,{body:e,...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}retrieve(e,t){return this._client.get(Z`/threads/${e}`,{...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}update(e,t,n){return this._client.post(Z`/threads/${e}`,{body:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}delete(e,t){return this._client.delete(Z`/threads/${e}`,{...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}createAndRun(e,t){return this._client.post(`/threads/runs`,{body:e,...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers]),stream:e.stream??!1})}async createAndRunPoll(e,t){let n=await this.createAndRun(e,t);return await this.runs.poll(n.id,{thread_id:n.thread_id},t)}createAndRunStream(e,t){return Of.createThreadAssistantStream(e,this._client.beta.threads,t)}};Af.Runs=kf,Af.Messages=ef;var jf=class extends X{constructor(){super(...arguments),this.realtime=new Xd(this._client),this.chatkit=new $d(this._client),this.assistants=new qd(this._client),this.threads=new Af(this._client)}};jf.Realtime=Xd,jf.ChatKit=$d,jf.Assistants=qd,jf.Threads=Af;var Mf=class extends X{create(e,t){return this._client.post(`/completions`,{body:e,...t,stream:e.stream??!1})}},Nf=class extends X{retrieve(e,t,n){let{container_id:r}=t;return this._client.get(Z`/containers/${r}/files/${e}/content`,{...n,headers:Q([{Accept:`application/binary`},n?.headers]),__binaryResponse:!0})}},Pf=class extends X{constructor(){super(...arguments),this.content=new Nf(this._client)}create(e,t,n){return this._client.post(Z`/containers/${e}/files`,hu({body:t,...n},this._client))}retrieve(e,t,n){let{container_id:r}=t;return this._client.get(Z`/containers/${r}/files/${e}`,n)}list(e,t={},n){return this._client.getAPIList(Z`/containers/${e}/files`,cu,{query:t,...n})}delete(e,t,n){let{container_id:r}=t;return this._client.delete(Z`/containers/${r}/files/${e}`,{...n,headers:Q([{Accept:`*/*`},n?.headers])})}};Pf.Content=Nf;var Ff=class extends X{constructor(){super(...arguments),this.files=new Pf(this._client)}create(e,t){return this._client.post(`/containers`,{body:e,...t})}retrieve(e,t){return this._client.get(Z`/containers/${e}`,t)}list(e={},t){return this._client.getAPIList(`/containers`,cu,{query:e,...t})}delete(e,t){return this._client.delete(Z`/containers/${e}`,{...t,headers:Q([{Accept:`*/*`},t?.headers])})}};Ff.Files=Pf;var If=class extends X{create(e,t,n){let{include:r,...i}=t;return this._client.post(Z`/conversations/${e}/items`,{query:{include:r},body:i,...n})}retrieve(e,t,n){let{conversation_id:r,...i}=t;return this._client.get(Z`/conversations/${r}/items/${e}`,{query:i,...n})}list(e,t={},n){return this._client.getAPIList(Z`/conversations/${e}/items`,lu,{query:t,...n})}delete(e,t,n){let{conversation_id:r}=t;return this._client.delete(Z`/conversations/${r}/items/${e}`,n)}},Lf=class extends X{constructor(){super(...arguments),this.items=new If(this._client)}create(e={},t){return this._client.post(`/conversations`,{body:e,...t})}retrieve(e,t){return this._client.get(Z`/conversations/${e}`,t)}update(e,t,n){return this._client.post(Z`/conversations/${e}`,{body:t,...n})}delete(e,t){return this._client.delete(Z`/conversations/${e}`,t)}};Lf.Items=If;var Rf=class extends X{create(e,t){let n=!!e.encoding_format,r=n?e.encoding_format:`base64`;n&&Kl(this._client).debug(`embeddings/user defined encoding_format:`,e.encoding_format);let i=this._client.post(`/embeddings`,{body:{...e,encoding_format:r},...t});return n?i:(Kl(this._client).debug(`embeddings/decoding base64 embeddings from base64`),i._thenUnwrap(e=>(e&&e.data&&e.data.forEach(e=>{let t=e.embedding;e.embedding=nf(t)}),e)))}},zf=class extends X{retrieve(e,t,n){let{eval_id:r,run_id:i}=t;return this._client.get(Z`/evals/${r}/runs/${i}/output_items/${e}`,n)}list(e,t,n){let{eval_id:r,...i}=t;return this._client.getAPIList(Z`/evals/${r}/runs/${e}/output_items`,cu,{query:i,...n})}},Bf=class extends X{constructor(){super(...arguments),this.outputItems=new zf(this._client)}create(e,t,n){return this._client.post(Z`/evals/${e}/runs`,{body:t,...n})}retrieve(e,t,n){let{eval_id:r}=t;return this._client.get(Z`/evals/${r}/runs/${e}`,n)}list(e,t={},n){return this._client.getAPIList(Z`/evals/${e}/runs`,cu,{query:t,...n})}delete(e,t,n){let{eval_id:r}=t;return this._client.delete(Z`/evals/${r}/runs/${e}`,n)}cancel(e,t,n){let{eval_id:r}=t;return this._client.post(Z`/evals/${r}/runs/${e}`,n)}};Bf.OutputItems=zf;var Vf=class extends X{constructor(){super(...arguments),this.runs=new Bf(this._client)}create(e,t){return this._client.post(`/evals`,{body:e,...t})}retrieve(e,t){return this._client.get(Z`/evals/${e}`,t)}update(e,t,n){return this._client.post(Z`/evals/${e}`,{body:t,...n})}list(e={},t){return this._client.getAPIList(`/evals`,cu,{query:e,...t})}delete(e,t){return this._client.delete(Z`/evals/${e}`,t)}};Vf.Runs=Bf;var Hf=class extends X{create(e,t){return this._client.post(`/files`,hu({body:e,...t},this._client))}retrieve(e,t){return this._client.get(Z`/files/${e}`,t)}list(e={},t){return this._client.getAPIList(`/files`,cu,{query:e,...t})}delete(e,t){return this._client.delete(Z`/files/${e}`,t)}content(e,t){return this._client.get(Z`/files/${e}/content`,{...t,headers:Q([{Accept:`application/binary`},t?.headers]),__binaryResponse:!0})}async waitForProcessing(e,{pollInterval:t=5e3,maxWait:n=1800*1e3}={}){let r=new Set([`processed`,`error`,`deleted`]),i=Date.now(),a=await this.retrieve(e);for(;!a.status||!r.has(a.status);)if(await Xc(t),a=await this.retrieve(e),Date.now()-i>n)throw new Oc({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return a}},Uf=class extends X{},Wf=class extends X{run(e,t){return this._client.post(`/fine_tuning/alpha/graders/run`,{body:e,...t})}validate(e,t){return this._client.post(`/fine_tuning/alpha/graders/validate`,{body:e,...t})}},Gf=class extends X{constructor(){super(...arguments),this.graders=new Wf(this._client)}};Gf.Graders=Wf;var Kf=class extends X{create(e,t,n){return this._client.getAPIList(Z`/fine_tuning/checkpoints/${e}/permissions`,su,{body:t,method:`post`,...n})}retrieve(e,t={},n){return this._client.get(Z`/fine_tuning/checkpoints/${e}/permissions`,{query:t,...n})}delete(e,t,n){let{fine_tuned_model_checkpoint:r}=t;return this._client.delete(Z`/fine_tuning/checkpoints/${r}/permissions/${e}`,n)}},qf=class extends X{constructor(){super(...arguments),this.permissions=new Kf(this._client)}};qf.Permissions=Kf;var Jf=class extends X{list(e,t={},n){return this._client.getAPIList(Z`/fine_tuning/jobs/${e}/checkpoints`,cu,{query:t,...n})}},Yf=class extends X{constructor(){super(...arguments),this.checkpoints=new Jf(this._client)}create(e,t){return this._client.post(`/fine_tuning/jobs`,{body:e,...t})}retrieve(e,t){return this._client.get(Z`/fine_tuning/jobs/${e}`,t)}list(e={},t){return this._client.getAPIList(`/fine_tuning/jobs`,cu,{query:e,...t})}cancel(e,t){return this._client.post(Z`/fine_tuning/jobs/${e}/cancel`,t)}listEvents(e,t={},n){return this._client.getAPIList(Z`/fine_tuning/jobs/${e}/events`,cu,{query:t,...n})}pause(e,t){return this._client.post(Z`/fine_tuning/jobs/${e}/pause`,t)}resume(e,t){return this._client.post(Z`/fine_tuning/jobs/${e}/resume`,t)}};Yf.Checkpoints=Jf;var Xf=class extends X{constructor(){super(...arguments),this.methods=new Uf(this._client),this.jobs=new Yf(this._client),this.checkpoints=new qf(this._client),this.alpha=new Gf(this._client)}};Xf.Methods=Uf,Xf.Jobs=Yf,Xf.Checkpoints=qf,Xf.Alpha=Gf;var Zf=class extends X{},Qf=class extends X{constructor(){super(...arguments),this.graderModels=new Zf(this._client)}};Qf.GraderModels=Zf;var $f=class extends X{createVariation(e,t){return this._client.post(`/images/variations`,hu({body:e,...t},this._client))}edit(e,t){return this._client.post(`/images/edits`,hu({body:e,...t,stream:e.stream??!1},this._client))}generate(e,t){return this._client.post(`/images/generations`,{body:e,...t,stream:e.stream??!1})}},ep=class extends X{retrieve(e,t){return this._client.get(Z`/models/${e}`,t)}list(e){return this._client.getAPIList(`/models`,su,e)}delete(e,t){return this._client.delete(Z`/models/${e}`,t)}},tp=class extends X{create(e,t){return this._client.post(`/moderations`,{body:e,...t})}},np=class extends X{accept(e,t,n){return this._client.post(Z`/realtime/calls/${e}/accept`,{body:t,...n,headers:Q([{Accept:`*/*`},n?.headers])})}hangup(e,t){return this._client.post(Z`/realtime/calls/${e}/hangup`,{...t,headers:Q([{Accept:`*/*`},t?.headers])})}refer(e,t,n){return this._client.post(Z`/realtime/calls/${e}/refer`,{body:t,...n,headers:Q([{Accept:`*/*`},n?.headers])})}reject(e,t={},n){return this._client.post(Z`/realtime/calls/${e}/reject`,{body:t,...n,headers:Q([{Accept:`*/*`},n?.headers])})}},rp=class extends X{create(e,t){return this._client.post(`/realtime/client_secrets`,{body:e,...t})}},ip=class extends X{constructor(){super(...arguments),this.clientSecrets=new rp(this._client),this.calls=new np(this._client)}};ip.ClientSecrets=rp,ip.Calls=np;function ap(e,t){return!t||!cp(t)?{...e,output_parsed:null,output:e.output.map(e=>e.type===`function_call`?{...e,parsed_arguments:null}:e.type===`message`?{...e,content:e.content.map(e=>({...e,parsed:null}))}:e)}:op(e,t)}function op(e,t){let n=e.output.map(e=>{if(e.type===`function_call`)return{...e,parsed_arguments:dp(t,e)};if(e.type===`message`){let n=e.content.map(e=>e.type===`output_text`?{...e,parsed:sp(t,e.text)}:e);return{...e,content:n}}return e}),r=Object.assign({},e,{output:n});return Object.getOwnPropertyDescriptor(e,`output_text`)||fp(r),Object.defineProperty(r,`output_parsed`,{enumerable:!0,get(){for(let e of r.output)if(e.type===`message`){for(let t of e.content)if(t.type===`output_text`&&t.parsed!==null)return t.parsed}return null}}),r}function sp(e,t){return e.text?.format?.type===`json_schema`?`$parseRaw`in e.text?.format?(e.text?.format).$parseRaw(t):JSON.parse(t):null}function cp(e){return!!Nu(e.text?.format)}function lp(e){return e?.$brand===`auto-parseable-tool`}function up(e,t){return e.find(e=>e.type===`function`&&e.name===t)}function dp(e,t){let n=up(e.tools??[],t.name);return{...t,...t,parsed_arguments:lp(n)?n.$parseRaw(t.arguments):n?.strict?JSON.parse(t.arguments):null}}function fp(e){let t=[];for(let n of e.output)if(n.type===`message`)for(let e of n.content)e.type===`output_text`&&t.push(e.text);e.output_text=t.join(``)}var pp,mp,hp,gp,_p,vp,yp,bp,xp=class e extends id{constructor(e){super(),pp.add(this),mp.set(this,void 0),hp.set(this,void 0),gp.set(this,void 0),q(this,mp,e,`f`)}static createResponse(t,n,r){let i=new e(n);return i._run(()=>i._createOrRetrieveResponse(t,n,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":`stream`}})),i}async _createOrRetrieveResponse(e,t,n){let r=n?.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener(`abort`,()=>this.controller.abort())),J(this,pp,`m`,_p).call(this);let i,a=null;`response_id`in t?(i=await e.responses.retrieve(t.response_id,{stream:!0},{...n,signal:this.controller.signal,stream:!0}),a=t.starting_after??null):i=await e.responses.create({...t,stream:!0},{...n,signal:this.controller.signal}),this._connected();for await(let e of i)J(this,pp,`m`,vp).call(this,e,a);if(i.controller.signal?.aborted)throw new Ec;return J(this,pp,`m`,yp).call(this)}[(mp=new WeakMap,hp=new WeakMap,gp=new WeakMap,pp=new WeakSet,_p=function(){this.ended||q(this,hp,void 0,`f`)},vp=function(e,t){if(this.ended)return;let n=(e,n)=>{(t==null||n.sequence_number>t)&&this._emit(e,n)},r=J(this,pp,`m`,bp).call(this,e);switch(n(`event`,e),e.type){case`response.output_text.delta`:{let t=r.output[e.output_index];if(!t)throw new Y(`missing output at index ${e.output_index}`);if(t.type===`message`){let r=t.content[e.content_index];if(!r)throw new Y(`missing content at index ${e.content_index}`);if(r.type!==`output_text`)throw new Y(`expected content to be 'output_text', got ${r.type}`);n(`response.output_text.delta`,{...e,snapshot:r.text})}break}case`response.function_call_arguments.delta`:{let t=r.output[e.output_index];if(!t)throw new Y(`missing output at index ${e.output_index}`);t.type===`function_call`&&n(`response.function_call_arguments.delta`,{...e,snapshot:t.arguments});break}default:n(e.type,e);break}},yp=function(){if(this.ended)throw new Y(`stream has ended, this shouldn't happen`);let e=J(this,hp,`f`);if(!e)throw new Y(`request ended without sending any events`);q(this,hp,void 0,`f`);let t=Sp(e,J(this,mp,`f`));return q(this,gp,t,`f`),t},bp=function(e){let t=J(this,hp,`f`);if(!t){if(e.type!==`response.created`)throw new Y(`When snapshot hasn't been set yet, expected 'response.created' event, got ${e.type}`);return t=q(this,hp,e.response,`f`),t}switch(e.type){case`response.output_item.added`:t.output.push(e.item);break;case`response.content_part.added`:{let n=t.output[e.output_index];if(!n)throw new Y(`missing output at index ${e.output_index}`);let r=n.type,i=e.part;r===`message`&&i.type!==`reasoning_text`?n.content.push(i):r===`reasoning`&&i.type===`reasoning_text`&&(n.content||=[],n.content.push(i));break}case`response.output_text.delta`:{let n=t.output[e.output_index];if(!n)throw new Y(`missing output at index ${e.output_index}`);if(n.type===`message`){let t=n.content[e.content_index];if(!t)throw new Y(`missing content at index ${e.content_index}`);if(t.type!==`output_text`)throw new Y(`expected content to be 'output_text', got ${t.type}`);t.text+=e.delta}break}case`response.function_call_arguments.delta`:{let n=t.output[e.output_index];if(!n)throw new Y(`missing output at index ${e.output_index}`);n.type===`function_call`&&(n.arguments+=e.delta);break}case`response.reasoning_text.delta`:{let n=t.output[e.output_index];if(!n)throw new Y(`missing output at index ${e.output_index}`);if(n.type===`reasoning`){let t=n.content?.[e.content_index];if(!t)throw new Y(`missing content at index ${e.content_index}`);if(t.type!==`reasoning_text`)throw new Y(`expected content to be 'reasoning_text', got ${t.type}`);t.text+=e.delta}break}case`response.completed`:q(this,hp,e.response,`f`);break}return t},Symbol.asyncIterator)](){let e=[],t=[],n=!1;return this.on(`event`,n=>{let r=t.shift();r?r.resolve(n):e.push(n)}),this.on(`end`,()=>{n=!0;for(let e of t)e.resolve(void 0);t.length=0}),this.on(`abort`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),this.on(`error`,e=>{n=!0;for(let n of t)n.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((e,n)=>t.push({resolve:e,reject:n})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();let e=J(this,gp,`f`);if(!e)throw new Y(`stream ended without producing a ChatCompletion`);return e}};function Sp(e,t){return ap(e,t)}var Cp=class extends X{list(e,t={},n){return this._client.getAPIList(Z`/responses/${e}/input_items`,cu,{query:t,...n})}},wp=class extends X{count(e={},t){return this._client.post(`/responses/input_tokens`,{body:e,...t})}},Tp=class extends X{constructor(){super(...arguments),this.inputItems=new Cp(this._client),this.inputTokens=new wp(this._client)}create(e,t){return this._client.post(`/responses`,{body:e,...t,stream:e.stream??!1})._thenUnwrap(e=>(`object`in e&&e.object===`response`&&fp(e),e))}retrieve(e,t={},n){return this._client.get(Z`/responses/${e}`,{query:t,...n,stream:t?.stream??!1})._thenUnwrap(e=>(`object`in e&&e.object===`response`&&fp(e),e))}delete(e,t){return this._client.delete(Z`/responses/${e}`,{...t,headers:Q([{Accept:`*/*`},t?.headers])})}parse(e,t){return this._client.responses.create(e,t)._thenUnwrap(t=>op(t,e))}stream(e,t){return xp.createResponse(this._client,e,t)}cancel(e,t){return this._client.post(Z`/responses/${e}/cancel`,t)}compact(e,t){return this._client.post(`/responses/compact`,{body:e,...t})}};Tp.InputItems=Cp,Tp.InputTokens=wp;var Ep=class extends X{create(e,t,n){return this._client.post(Z`/uploads/${e}/parts`,hu({body:t,...n},this._client))}},Dp=class extends X{constructor(){super(...arguments),this.parts=new Ep(this._client)}create(e,t){return this._client.post(`/uploads`,{body:e,...t})}cancel(e,t){return this._client.post(Z`/uploads/${e}/cancel`,t)}complete(e,t,n){return this._client.post(Z`/uploads/${e}/complete`,{body:t,...n})}};Dp.Parts=Ep;const Op=async e=>{let t=await Promise.allSettled(e),n=t.filter(e=>e.status===`rejected`);if(n.length){for(let e of n)console.error(e.reason);throw Error(`${n.length} promise(s) failed - see the above errors`)}let r=[];for(let e of t)e.status===`fulfilled`&&r.push(e.value);return r};var kp=class extends X{create(e,t,n){return this._client.post(Z`/vector_stores/${e}/file_batches`,{body:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}retrieve(e,t,n){let{vector_store_id:r}=t;return this._client.get(Z`/vector_stores/${r}/file_batches/${e}`,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}cancel(e,t,n){let{vector_store_id:r}=t;return this._client.post(Z`/vector_stores/${r}/file_batches/${e}/cancel`,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}async createAndPoll(e,t,n){let r=await this.create(e,t);return await this.poll(e,r.id,n)}listFiles(e,t,n){let{vector_store_id:r,...i}=t;return this._client.getAPIList(Z`/vector_stores/${r}/file_batches/${e}/files`,cu,{query:i,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}async poll(e,t,n){let r=Q([n?.headers,{"X-Stainless-Poll-Helper":`true`,"X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:i,response:a}=await this.retrieve(t,{vector_store_id:e},{...n,headers:r}).withResponse();switch(i.status){case`in_progress`:let e=5e3;if(n?.pollIntervalMs)e=n.pollIntervalMs;else{let t=a.headers.get(`openai-poll-after-ms`);if(t){let n=parseInt(t);isNaN(n)||(e=n)}}await Xc(e);break;case`failed`:case`cancelled`:case`completed`:return i}}}async uploadAndPoll(e,{files:t,fileIds:n=[]},r){if(t==null||t.length==0)throw Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let i=r?.maxConcurrency??5,a=Math.min(i,t.length),o=this._client,s=t.values(),c=[...n];async function l(e){for(let t of e){let e=await o.files.create({file:t,purpose:`assistants`},r);c.push(e.id)}}return await Op(Array(a).fill(s).map(l)),await this.createAndPoll(e,{file_ids:c})}},Ap=class extends X{create(e,t,n){return this._client.post(Z`/vector_stores/${e}/files`,{body:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}retrieve(e,t,n){let{vector_store_id:r}=t;return this._client.get(Z`/vector_stores/${r}/files/${e}`,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}update(e,t,n){let{vector_store_id:r,...i}=t;return this._client.post(Z`/vector_stores/${r}/files/${e}`,{body:i,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}list(e,t={},n){return this._client.getAPIList(Z`/vector_stores/${e}/files`,cu,{query:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}delete(e,t,n){let{vector_store_id:r}=t;return this._client.delete(Z`/vector_stores/${r}/files/${e}`,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}async createAndPoll(e,t,n){let r=await this.create(e,t,n);return await this.poll(e,r.id,n)}async poll(e,t,n){let r=Q([n?.headers,{"X-Stainless-Poll-Helper":`true`,"X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let i=await this.retrieve(t,{vector_store_id:e},{...n,headers:r}).withResponse(),a=i.data;switch(a.status){case`in_progress`:let e=5e3;if(n?.pollIntervalMs)e=n.pollIntervalMs;else{let t=i.response.headers.get(`openai-poll-after-ms`);if(t){let n=parseInt(t);isNaN(n)||(e=n)}}await Xc(e);break;case`failed`:case`completed`:return a}}}async upload(e,t,n){let r=await this._client.files.create({file:t,purpose:`assistants`},n);return this.create(e,{file_id:r.id},n)}async uploadAndPoll(e,t,n){let r=await this.upload(e,t,n);return await this.poll(e,r.id,n)}content(e,t,n){let{vector_store_id:r}=t;return this._client.getAPIList(Z`/vector_stores/${r}/files/${e}/content`,su,{...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}},jp=class extends X{constructor(){super(...arguments),this.files=new Ap(this._client),this.fileBatches=new kp(this._client)}create(e,t){return this._client.post(`/vector_stores`,{body:e,...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}retrieve(e,t){return this._client.get(Z`/vector_stores/${e}`,{...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}update(e,t,n){return this._client.post(Z`/vector_stores/${e}`,{body:t,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}list(e={},t){return this._client.getAPIList(`/vector_stores`,cu,{query:e,...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}delete(e,t){return this._client.delete(Z`/vector_stores/${e}`,{...t,headers:Q([{"OpenAI-Beta":`assistants=v2`},t?.headers])})}search(e,t,n){return this._client.getAPIList(Z`/vector_stores/${e}/search`,su,{body:t,method:`post`,...n,headers:Q([{"OpenAI-Beta":`assistants=v2`},n?.headers])})}};jp.Files=Ap,jp.FileBatches=kp;var Mp=class extends X{create(e,t){return this._client.post(`/videos`,mu({body:e,...t},this._client))}retrieve(e,t){return this._client.get(Z`/videos/${e}`,t)}list(e={},t){return this._client.getAPIList(`/videos`,lu,{query:e,...t})}delete(e,t){return this._client.delete(Z`/videos/${e}`,t)}downloadContent(e,t={},n){return this._client.get(Z`/videos/${e}/content`,{query:t,...n,headers:Q([{Accept:`application/binary`},n?.headers]),__binaryResponse:!0})}remix(e,t,n){return this._client.post(Z`/videos/${e}/remix`,mu({body:t,...n},this._client))}},Np,Pp,Fp,Ip=class extends X{constructor(){super(...arguments),Np.add(this)}async unwrap(e,t,n=this._client.webhookSecret,r=300){return await this.verifySignature(e,t,n,r),JSON.parse(e)}async verifySignature(e,t,n=this._client.webhookSecret,r=300){if(typeof crypto>`u`||typeof crypto.subtle.importKey!=`function`||typeof crypto.subtle.verify!=`function`)throw Error("Webhook signature verification is only supported when the `crypto` global is defined");J(this,Np,`m`,Pp).call(this,n);let i=Q([t]).values,a=J(this,Np,`m`,Fp).call(this,i,`webhook-signature`),o=J(this,Np,`m`,Fp).call(this,i,`webhook-timestamp`),s=J(this,Np,`m`,Fp).call(this,i,`webhook-id`),c=parseInt(o,10);if(isNaN(c))throw new zc(`Invalid webhook timestamp format`);let l=Math.floor(Date.now()/1e3);if(l-c>r)throw new zc(`Webhook timestamp is too old`);if(c>l+r)throw new zc(`Webhook timestamp is too new`);let u=a.split(` `).map(e=>e.startsWith(`v1,`)?e.substring(3):e),d=n.startsWith(`whsec_`)?Buffer.from(n.replace(`whsec_`,``),`base64`):Buffer.from(n,`utf-8`),f=s?`${s}.${o}.${e}`:`${o}.${e}`,p=await crypto.subtle.importKey(`raw`,d,{name:`HMAC`,hash:`SHA-256`},!1,[`verify`]);for(let e of u)try{let t=Buffer.from(e,`base64`);if(await crypto.subtle.verify(`HMAC`,p,t,new TextEncoder().encode(f)))return}catch{continue}throw new zc(`The given webhook signature does not match the expected signature`)}};Np=new WeakSet,Pp=function(e){if(typeof e!=`string`||e.length===0)throw Error(`The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function`)},Fp=function(e,t){if(!e)throw Error(`Headers are required`);let n=e.get(t);if(n==null)throw Error(`Missing required header: ${t}`);return n};var Lp,Rp,zp,Bp,$=class{constructor({baseURL:e=rf(`OPENAI_BASE_URL`),apiKey:t=rf(`OPENAI_API_KEY`),organization:n=rf(`OPENAI_ORG_ID`)??null,project:r=rf(`OPENAI_PROJECT_ID`)??null,webhookSecret:i=rf(`OPENAI_WEBHOOK_SECRET`)??null,...a}={}){if(Lp.add(this),zp.set(this,void 0),this.completions=new Mf(this),this.chat=new zd(this),this.embeddings=new Rf(this),this.files=new Hf(this),this.images=new $f(this),this.audio=new Gd(this),this.moderations=new tp(this),this.models=new ep(this),this.fineTuning=new Xf(this),this.graders=new Qf(this),this.vectorStores=new jp(this),this.webhooks=new Ip(this),this.beta=new jf(this),this.batches=new Kd(this),this.uploads=new Dp(this),this.responses=new Tp(this),this.realtime=new ip(this),this.conversations=new Lf(this),this.evals=new Vf(this),this.containers=new Ff(this),this.videos=new Mp(this),t===void 0)throw new Y("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");let o={apiKey:t,organization:n,project:r,webhookSecret:i,...a,baseURL:e||`https://api.openai.com/v1`};if(!o.dangerouslyAllowBrowser&&Qc())throw new Y(`It looks like you're running in a browser-like environment.
143
143
 
144
144
  This is disabled by default, as it risks exposing your secret API credentials to attackers.
145
145
  If you understand the risks and have appropriate mitigations in place,
@@ -148,5 +148,5 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
148
148
  new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
149
149
 
150
150
  https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
151
- `);this.baseURL=o.baseURL,this.timeout=o.timeout??_d.DEFAULT_TIMEOUT,this.logger=o.logger??console;let s=`warn`;this.logLevel=s,this.logLevel=Ss(o.logLevel,`ClientOptions.logLevel`,this)??Ss(Ll(`OPENAI_LOG`),`process.env['OPENAI_LOG']`,this)??s,this.fetchOptions=o.fetchOptions,this.maxRetries=o.maxRetries??2,this.fetch=o.fetch??Vo(),K(this,vd,Ko,`f`),this._options=o,this.apiKey=typeof t==`string`?t:`Missing Key`,this.organization=n,this.project=r,this.webhookSecret=i}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){}async authHeaders(e){return Q([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return us(e,{arrayFormat:`brackets`})}getUserAgent(){return`${this.constructor.name}/JS ${Mo}`}defaultIdempotencyKey(){return`stainless-node-retry-${no()}`}makeStatusError(e,t,n,r){return ao.generate(e,t,n,r)}async _callApiKey(){let e=this._options.apiKey;if(typeof e!=`function`)return!1;let t;try{t=await e()}catch(e){throw e instanceof J?e:new J(`Failed to get token from 'apiKey' function: ${e.message}`,{cause:e})}if(typeof t!=`string`||!t)throw new J(`Expected 'apiKey' function argument to return a string but it returned ${t}`);return this.apiKey=t,!0}buildURL(e,t,n){let r=!q(this,gd,`m`,yd).call(this)&&n||this.baseURL,i=So(e)?new URL(e):new URL(r+(r.endsWith(`/`)&&e.startsWith(`/`)?e.slice(1):e)),a=this.defaultQuery();return Eo(a)||(t={...a,...t}),typeof t==`object`&&t&&!Array.isArray(t)&&(i.search=this.stringifyQuery(t)),i.toString()}async prepareOptions(e){await this._callApiKey()}async prepareRequest(e,{url:t,options:n}){}get(e,t){return this.methodRequest(`get`,e,t)}post(e,t){return this.methodRequest(`post`,e,t)}patch(e,t){return this.methodRequest(`patch`,e,t)}put(e,t){return this.methodRequest(`put`,e,t)}delete(e,t){return this.methodRequest(`delete`,e,t)}methodRequest(e,t,n){return this.request(Promise.resolve(n).then(n=>({method:e,path:t,...n})))}request(e,t=null){return new Rs(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,n){let r=await e,i=r.maxRetries??this.maxRetries;t??=i,await this.prepareOptions(r);let{req:a,url:o,timeout:s}=await this.buildRequest(r,{retryCount:i-t});await this.prepareRequest(a,{url:o,options:r});let c=`log_`+(Math.random()*(1<<24)|0).toString(16).padStart(6,`0`),l=n===void 0?``:`, retryOf: ${n}`,u=Date.now();if(Ds(this).debug(`[${c}] sending request`,Os({retryOfRequestLogID:n,method:r.method,url:o,options:r,headers:a.headers})),r.signal?.aborted)throw new oo;let d=new AbortController,f=await this.fetchWithTimeout(o,a,s,d).catch(io),p=Date.now();if(f instanceof globalThis.Error){let e=`retrying, ${t} attempts remaining`;if(r.signal?.aborted)throw new oo;let i=ro(f)||/timed? ?out/i.test(String(f)+(`cause`in f?String(f.cause):``));if(t)return Ds(this).info(`[${c}] connection ${i?`timed out`:`failed`} - ${e}`),Ds(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (${e})`,Os({retryOfRequestLogID:n,url:o,durationMs:p-u,message:f.message})),this.retryRequest(r,t,n??c);throw Ds(this).info(`[${c}] connection ${i?`timed out`:`failed`} - error; no more retries left`),Ds(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (error; no more retries left)`,Os({retryOfRequestLogID:n,url:o,durationMs:p-u,message:f.message})),i?new co:new so({cause:f})}let m=`[${c}${l}${[...f.headers.entries()].filter(([e])=>e===`x-request-id`).map(([e,t])=>`, `+e+`: `+JSON.stringify(t)).join(``)}] ${a.method} ${o} ${f.ok?`succeeded`:`failed`} with status ${f.status} in ${p-u}ms`;if(!f.ok){let e=await this.shouldRetry(f);if(t&&e){let e=`retrying, ${t} attempts remaining`;return await Go(f.body),Ds(this).info(`${m} - ${e}`),Ds(this).debug(`[${c}] response error (${e})`,Os({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,durationMs:p-u})),this.retryRequest(r,t,n??c,f.headers)}let i=e?`error; no more retries left`:`error; not retryable`;Ds(this).info(`${m} - ${i}`);let a=await f.text().catch(e=>io(e).message),o=Ao(a),s=o?void 0:a;throw Ds(this).debug(`[${c}] response error (${i})`,Os({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,message:s,durationMs:Date.now()-u})),this.makeStatusError(f.status,o,s,f.headers)}return Ds(this).info(m),Ds(this).debug(`[${c}] response start`,Os({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,durationMs:p-u})),{response:f,options:r,controller:d,requestLogID:c,retryOfRequestLogID:n,startTime:u}}getAPIList(e,t,n){return this.requestAPIList(t,{method:`get`,path:e,...n})}requestAPIList(e,t){let n=this.makeRequest(t,null,void 0);return new Vs(this,n,e)}async fetchWithTimeout(e,t,n,r){let{signal:i,method:a,...o}=t||{};i&&i.addEventListener(`abort`,()=>r.abort());let s=setTimeout(()=>r.abort(),n),c=globalThis.ReadableStream&&o.body instanceof globalThis.ReadableStream||typeof o.body==`object`&&o.body!==null&&Symbol.asyncIterator in o.body,l={signal:r.signal,...c?{duplex:`half`}:{},method:`GET`,...o};a&&(l.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,l)}finally{clearTimeout(s)}}async shouldRetry(e){let t=e.headers.get(`x-should-retry`);return t===`true`?!0:t===`false`?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,t,n,r){let i,a=r?.get(`retry-after-ms`);if(a){let e=parseFloat(a);Number.isNaN(e)||(i=e)}let o=r?.get(`retry-after`);if(o&&!i){let e=parseFloat(o);i=Number.isNaN(e)?Date.parse(o)-Date.now():e*1e3}if(!(i&&0<=i&&i<60*1e3)){let n=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(t,n)}return await jo(i),this.makeRequest(e,t-1,n)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e;return Math.min(.5*2**n,8)*(1-Math.random()*.25)*1e3}async buildRequest(e,{retryCount:t=0}={}){let n={...e},{method:r,path:i,query:a,defaultBaseURL:o}=n,s=this.buildURL(i,a,o);`timeout`in n&&ko(`timeout`,n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:c,body:l}=this.buildBody({options:n});return{req:{method:r,headers:await this.buildHeaders({options:e,method:r,bodyHeaders:c,retryCount:t}),...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:`half`},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:s,timeout:n.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:n,retryCount:r}){let i={};this.idempotencyHeader&&t!==`get`&&(e.idempotencyKey||=this.defaultIdempotencyKey(),i[this.idempotencyHeader]=e.idempotencyKey);let a=Q([i,{Accept:`application/json`,"User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...Bo(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=Q([t]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==`string`&&n.values.has(`content-type`)||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e==`object`&&(Symbol.asyncIterator in e||Symbol.iterator in e&&`next`in e&&typeof e.next==`function`)?{bodyHeaders:void 0,body:Uo(e)}:q(this,vd,`f`).call(this,{body:e,headers:n})}};_d=$,vd=new WeakMap,gd=new WeakSet,yd=function(){return this.baseURL!==`https://api.openai.com/v1`},$.OpenAI=_d,$.DEFAULT_TIMEOUT=6e5,$.OpenAIError=J,$.APIError=ao,$.APIConnectionError=so,$.APIConnectionTimeoutError=co,$.APIUserAbortError=oo,$.NotFoundError=po,$.ConflictError=mo,$.RateLimitError=go,$.BadRequestError=lo,$.AuthenticationError=uo,$.InternalServerError=_o,$.PermissionDeniedError=fo,$.UnprocessableEntityError=ho,$.InvalidWebhookSignatureError=bo,$.toFile=oc,$.Completions=du,$.Chat=yl,$.Embeddings=_u,$.Files=xu,$.Images=Mu,$.Audio=Tl,$.Moderations=Pu,$.Models=Nu,$.FineTuning=ku,$.Graders=ju,$.VectorStores=ud,$.Webhooks=hd,$.Beta=uu,$.Batches=El,$.Uploads=od,$.Responses=id,$.Realtime=Lu,$.Conversations=gu,$.Evals=bu,$.Containers=mu,$.Videos=dd;async function bd(e,t){return await new $({apiKey:t.openaiApiKey}).audio.transcriptions.create({file:b(e),model:t.model,language:t.language,response_format:`srt`})}async function xd(e,t){let n=Et();n.start(`Extracting audio...`);try{$a(e,t),n.stop(`Audio extracted successfully`)}catch(e){n.stop(`Audio extraction failed`),H.error(`Error during audio extraction: ${e}`),s.exit(1)}}async function Sd(e,t,n){let r=Et();r.start(`Generating transcription with OpenAI...`);try{ie(t,await bd(e,n)),r.stop(`Transcription generated successfully`)}catch(t){r.stop(`Transcription generation failed`),H.error(`Error during transcription generation: ${t}`);try{re(e)}catch{}s.exit(1)}}async function Cd(e,t,n){let r=Et(),i=n===`first`?`start`:n===`last`?`end`:`${n}%`;r.start(`Extracting thumbnail at ${i}...`);try{to(e,t,n),r.stop(`Thumbnail extracted successfully`)}catch(e){r.stop(`Thumbnail extraction failed`),H.error(`Error during thumbnail extraction: ${e}`),s.exit(1)}}async function wd(e,t,n,r,i){let a=Et();a.start(`Adding text to thumbnail...`);try{await Ya(e,t,n,r,i),a.stop(`Text added to thumbnail successfully`)}catch(e){a.stop(`Failed to add text to thumbnail`),H.error(`Error adding text to thumbnail: ${e}`),s.exit(1)}}function Td(e,t=`temporary file`){try{re(e)}catch{H.warn(`Could not delete ${t}: ${e}`)}}async function Ed(e){St(`Video Toolkit - Add Template`);let t=await ra(),n=o(e);x(n)||(H.error(`Source file not found: ${n}`),s.exit(1)),n.toLowerCase().endsWith(`.svg`)||(H.error(`Source file must be an SVG file`),s.exit(1));let r=await bt({message:`Enter a name for this template:`,placeholder:`e.g., series-x, youtube-intro`,validate:e=>{if(!e||e.trim()===``)return`Template name is required`;if(!/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(e))return`Template name should start and end with lowercase letters or numbers, and can contain hyphens in between`}});typeof r==`symbol`&&(H.error(`Template name is required. Exiting.`),s.exit(1));let i=Ga(t.templatesDir);x(i)||(C(i,{recursive:!0}),H.success(`Created templates directory: ${i}`));let a=o(i,`${r}.svg`);x(a)&&H.warn(`Template '${r}' already exists. Overwriting...`);try{y(n,a),Ct(`✓ Template '${r}' added successfully at ${a}`)}catch(e){let t=e instanceof Error?e.message:String(e);H.error(`Failed to copy template: ${t}`),s.exit(1)}}const Dd=qt(`video-toolkit`);async function Od(e){let t=await ra();t.openaiApiKey||(H.error(`OpenAI API key is required. Please set it in:`),H.error(` - Config file: ~/.video-toolkitrc`),s.exit(1));let{videoPath:r,audioPath:i,srtPath:a,thumbnailTempPaths:o,thumbnailPaths:c}=ia(e);St(`Video Toolkit - Processing: ${n(r)}`),await xd(r,i),await Sd(i,a,t),Td(i,`audio file`);let l=await Za();if(l){let e=await Qa(t.templatesDir);if(!e){H.warn(`No template selected. Skipping thumbnail generation.`),Ct(`✓ Transcription saved to: ${a}`);return}let n=[`first`,`25`,`50`,`75`,`last`];for(let i=0;i<n.length;i++)await Cd(r,o[i],n[i]),await wd(o[i],c[i],l,e,t.templatesDir),Td(o[i],`temporary thumbnail`);Ct(`✓ Transcription saved to: ${a}\n✓ Thumbnails saved:\n - ${c.join(`
152
- - `)}`)}else Ct(`✓ Transcription saved to: ${a}`)}Dd.command(`[video]`,`Process a video file to generate SRT subtitles`).action(async e=>{await Od(e||await Xa())}),Dd.command(`add-template <file>`,`Add an SVG template to the templates directory`).action(async e=>{await Ed(e)}),Dd.help(),Dd.version(Jt),Dd.parse();export{ln as a,an as c,_e as d,un as i,M as l,gi as n,nn as o,$r as r,tn as s,Ai as t,N as u};
151
+ `);this.baseURL=o.baseURL,this.timeout=o.timeout??Rp.DEFAULT_TIMEOUT,this.logger=o.logger??console;let s=`warn`;this.logLevel=s,this.logLevel=Vl(o.logLevel,`ClientOptions.logLevel`,this)??Vl(rf(`OPENAI_LOG`),`process.env['OPENAI_LOG']`,this)??s,this.fetchOptions=o.fetchOptions,this.maxRetries=o.maxRetries??2,this.fetch=o.fetch??ol(),q(this,zp,dl,`f`),this._options=o,this.apiKey=typeof t==`string`?t:`Missing Key`,this.organization=n,this.project=r,this.webhookSecret=i}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){}async authHeaders(e){return Q([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return kl(e,{arrayFormat:`brackets`})}getUserAgent(){return`${this.constructor.name}/JS ${Zc}`}defaultIdempotencyKey(){return`stainless-node-retry-${Sc()}`}makeStatusError(e,t,n,r){return Tc.generate(e,t,n,r)}async _callApiKey(){let e=this._options.apiKey;if(typeof e!=`function`)return!1;let t;try{t=await e()}catch(e){throw e instanceof Y?e:new Y(`Failed to get token from 'apiKey' function: ${e.message}`,{cause:e})}if(typeof t!=`string`||!t)throw new Y(`Expected 'apiKey' function argument to return a string but it returned ${t}`);return this.apiKey=t,!0}buildURL(e,t,n){let r=!J(this,Lp,`m`,Bp).call(this)&&n||this.baseURL,i=Vc(e)?new URL(e):new URL(r+(r.endsWith(`/`)&&e.startsWith(`/`)?e.slice(1):e)),a=this.defaultQuery();return Gc(a)||(t={...a,...t}),typeof t==`object`&&t&&!Array.isArray(t)&&(i.search=this.stringifyQuery(t)),i.toString()}async prepareOptions(e){await this._callApiKey()}async prepareRequest(e,{url:t,options:n}){}get(e,t){return this.methodRequest(`get`,e,t)}post(e,t){return this.methodRequest(`post`,e,t)}patch(e,t){return this.methodRequest(`patch`,e,t)}put(e,t){return this.methodRequest(`put`,e,t)}delete(e,t){return this.methodRequest(`delete`,e,t)}methodRequest(e,t,n){return this.request(Promise.resolve(n).then(n=>({method:e,path:t,...n})))}request(e,t=null){return new ru(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,n){let r=await e,i=r.maxRetries??this.maxRetries;t??=i,await this.prepareOptions(r);let{req:a,url:o,timeout:s}=await this.buildRequest(r,{retryCount:i-t});await this.prepareRequest(a,{url:o,options:r});let c=`log_`+(Math.random()*(1<<24)|0).toString(16).padStart(6,`0`),l=n===void 0?``:`, retryOf: ${n}`,u=Date.now();if(Kl(this).debug(`[${c}] sending request`,ql({retryOfRequestLogID:n,method:r.method,url:o,options:r,headers:a.headers})),r.signal?.aborted)throw new Ec;let d=new AbortController,f=await this.fetchWithTimeout(o,a,s,d).catch(wc),p=Date.now();if(f instanceof globalThis.Error){let e=`retrying, ${t} attempts remaining`;if(r.signal?.aborted)throw new Ec;let i=Cc(f)||/timed? ?out/i.test(String(f)+(`cause`in f?String(f.cause):``));if(t)return Kl(this).info(`[${c}] connection ${i?`timed out`:`failed`} - ${e}`),Kl(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (${e})`,ql({retryOfRequestLogID:n,url:o,durationMs:p-u,message:f.message})),this.retryRequest(r,t,n??c);throw Kl(this).info(`[${c}] connection ${i?`timed out`:`failed`} - error; no more retries left`),Kl(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (error; no more retries left)`,ql({retryOfRequestLogID:n,url:o,durationMs:p-u,message:f.message})),i?new Oc:new Dc({cause:f})}let m=`[${c}${l}${[...f.headers.entries()].filter(([e])=>e===`x-request-id`).map(([e,t])=>`, `+e+`: `+JSON.stringify(t)).join(``)}] ${a.method} ${o} ${f.ok?`succeeded`:`failed`} with status ${f.status} in ${p-u}ms`;if(!f.ok){let e=await this.shouldRetry(f);if(t&&e){let e=`retrying, ${t} attempts remaining`;return await ul(f.body),Kl(this).info(`${m} - ${e}`),Kl(this).debug(`[${c}] response error (${e})`,ql({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,durationMs:p-u})),this.retryRequest(r,t,n??c,f.headers)}let i=e?`error; no more retries left`:`error; not retryable`;Kl(this).info(`${m} - ${i}`);let a=await f.text().catch(e=>wc(e).message),o=Yc(a),s=o?void 0:a;throw Kl(this).debug(`[${c}] response error (${i})`,ql({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,message:s,durationMs:Date.now()-u})),this.makeStatusError(f.status,o,s,f.headers)}return Kl(this).info(m),Kl(this).debug(`[${c}] response start`,ql({retryOfRequestLogID:n,url:f.url,status:f.status,headers:f.headers,durationMs:p-u})),{response:f,options:r,controller:d,requestLogID:c,retryOfRequestLogID:n,startTime:u}}getAPIList(e,t,n){return this.requestAPIList(t,{method:`get`,path:e,...n})}requestAPIList(e,t){let n=this.makeRequest(t,null,void 0);return new ou(this,n,e)}async fetchWithTimeout(e,t,n,r){let{signal:i,method:a,...o}=t||{};i&&i.addEventListener(`abort`,()=>r.abort());let s=setTimeout(()=>r.abort(),n),c=globalThis.ReadableStream&&o.body instanceof globalThis.ReadableStream||typeof o.body==`object`&&o.body!==null&&Symbol.asyncIterator in o.body,l={signal:r.signal,...c?{duplex:`half`}:{},method:`GET`,...o};a&&(l.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,l)}finally{clearTimeout(s)}}async shouldRetry(e){let t=e.headers.get(`x-should-retry`);return t===`true`?!0:t===`false`?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,t,n,r){let i,a=r?.get(`retry-after-ms`);if(a){let e=parseFloat(a);Number.isNaN(e)||(i=e)}let o=r?.get(`retry-after`);if(o&&!i){let e=parseFloat(o);i=Number.isNaN(e)?Date.parse(o)-Date.now():e*1e3}if(!(i&&0<=i&&i<60*1e3)){let n=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(t,n)}return await Xc(i),this.makeRequest(e,t-1,n)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e;return Math.min(.5*2**n,8)*(1-Math.random()*.25)*1e3}async buildRequest(e,{retryCount:t=0}={}){let n={...e},{method:r,path:i,query:a,defaultBaseURL:o}=n,s=this.buildURL(i,a,o);`timeout`in n&&Jc(`timeout`,n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:c,body:l}=this.buildBody({options:n});return{req:{method:r,headers:await this.buildHeaders({options:e,method:r,bodyHeaders:c,retryCount:t}),...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:`half`},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:s,timeout:n.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:n,retryCount:r}){let i={};this.idempotencyHeader&&t!==`get`&&(e.idempotencyKey||=this.defaultIdempotencyKey(),i[this.idempotencyHeader]=e.idempotencyKey);let a=Q([i,{Accept:`application/json`,"User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...al(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=Q([t]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==`string`&&n.values.has(`content-type`)||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e==`object`&&(Symbol.asyncIterator in e||Symbol.iterator in e&&`next`in e&&typeof e.next==`function`)?{bodyHeaders:void 0,body:cl(e)}:J(this,zp,`f`).call(this,{body:e,headers:n})}};Rp=$,zp=new WeakMap,Lp=new WeakSet,Bp=function(){return this.baseURL!==`https://api.openai.com/v1`},$.OpenAI=Rp,$.DEFAULT_TIMEOUT=6e5,$.OpenAIError=Y,$.APIError=Tc,$.APIConnectionError=Dc,$.APIConnectionTimeoutError=Oc,$.APIUserAbortError=Ec,$.NotFoundError=Mc,$.ConflictError=Nc,$.RateLimitError=Fc,$.BadRequestError=kc,$.AuthenticationError=Ac,$.InternalServerError=Ic,$.PermissionDeniedError=jc,$.UnprocessableEntityError=Pc,$.InvalidWebhookSignatureError=zc,$.toFile=Eu,$.Completions=Mf,$.Chat=zd,$.Embeddings=Rf,$.Files=Hf,$.Images=$f,$.Audio=Gd,$.Moderations=tp,$.Models=ep,$.FineTuning=Xf,$.Graders=Qf,$.VectorStores=jp,$.Webhooks=Ip,$.Beta=jf,$.Batches=Kd,$.Uploads=Dp,$.Responses=Tp,$.Realtime=ip,$.Conversations=Lf,$.Evals=Vf,$.Containers=Ff,$.Videos=Mp;async function Vp(e,t){return await new $({apiKey:t.openaiApiKey}).audio.transcriptions.create({file:b(e),model:t.model,language:t.language,response_format:`srt`})}async function Hp(e,t){let n=Ot();n.start(`Extracting audio...`);try{yc(e,t),n.stop(`Audio extracted successfully`)}catch(e){n.stop(`Audio extraction failed`),V.error(`Error during audio extraction: ${e}`),s.exit(1)}}async function Up(e,t,n){let r=Ot();r.start(`Generating transcription with OpenAI...`);try{ie(t,await Vp(e,n)),r.stop(`Transcription generated successfully`)}catch(t){r.stop(`Transcription generation failed`),V.error(`Error during transcription generation: ${t}`);try{re(e)}catch{}s.exit(1)}}async function Wp(e,t,n){let r=Ot(),i=n===`first`?`start`:n===`last`?`end`:`${n}%`;r.start(`Extracting thumbnail at ${i}...`);try{xc(e,t,n),r.stop(`Thumbnail extracted successfully`)}catch(e){r.stop(`Thumbnail extraction failed`),V.error(`Error during thumbnail extraction: ${e}`),s.exit(1)}}async function Gp(e,t,n,r,i){let a=Ot();a.start(`Adding text to thumbnail...`);try{await mc(e,t,n,r,i),a.stop(`Text added to thumbnail successfully`)}catch(e){a.stop(`Failed to add text to thumbnail`),V.error(`Error adding text to thumbnail: ${e}`),s.exit(1)}}function Kp(e,t=`temporary file`){try{re(e)}catch{V.warn(`Could not delete ${t}: ${e}`)}}async function qp(e){wt(`Video Toolkit - Add Template`);let t=await oa(),n=o(e);x(n)||(V.error(`Source file not found: ${n}`),s.exit(1)),n.toLowerCase().endsWith(`.svg`)||(V.error(`Source file must be an SVG file`),s.exit(1));let r=await St({message:`Enter a name for this template:`,placeholder:`e.g., series-x, youtube-intro`,validate:e=>{if(!e||e.trim()===``)return`Template name is required`;if(!/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(e))return`Template name should start and end with lowercase letters or numbers, and can contain hyphens in between`}});typeof r==`symbol`&&(V.error(`Template name is required. Exiting.`),s.exit(1));let i=uc(t.templatesDir);x(i)||(C(i,{recursive:!0}),V.success(`Created templates directory: ${i}`));let a=o(i,`${r}.svg`);x(a)&&V.warn(`Template '${r}' already exists. Overwriting...`);try{y(n,a),Tt(`✓ Template '${r}' added successfully at ${a}`)}catch(e){let t=e instanceof Error?e.message:String(e);V.error(`Failed to copy template: ${t}`),s.exit(1)}}const Jp=Yt(`video-toolkit`);async function Yp(e){let t=await oa();t.openaiApiKey||(V.error(`OpenAI API key is required. Please set it in:`),V.error(` - Config file: ~/.video-toolkitrc`),s.exit(1));let{videoPath:r,audioPath:i,srtPath:a,thumbnailTempPaths:o,thumbnailPaths:c}=sa(e);wt(`Video Toolkit - Processing: ${n(r)}`),await Hp(r,i),await Up(i,a,t),Kp(i,`audio file`);let l=await _c();if(l){let e=await vc(t.templatesDir);if(!e){V.warn(`No template selected. Skipping thumbnail generation.`),Tt(`✓ Transcription saved to: ${a}`);return}let n=[`first`,`25`,`50`,`75`,`last`];for(let i=0;i<n.length;i++)await Wp(r,o[i],n[i]),await Gp(o[i],c[i],l,e,t.templatesDir),Kp(o[i],`temporary thumbnail`);Tt(`✓ Transcription saved to: ${a}\n✓ Thumbnails saved:\n - ${c.join(`
152
+ - `)}`)}else Tt(`✓ Transcription saved to: ${a}`)}Jp.command(`[path]`,`Process a video from dated content folders`).option(`--path <path>`,`Base path for content directory (defaults to current directory)`).action(async(e,t)=>{let n=e||t?.path||s.cwd();wt(`Video Toolkit - Process video from content folder`);let{videoPath:r}=await gc(n);await Yp(r)}),Jp.command(`add-template <file>`,`Add an SVG template to the templates directory`).action(async e=>{await qp(e)}),Jp.help(),Jp.version(Xt),Jp.parse();export{dn as a,sn as c,ye as d,fn as i,A as l,yi as n,an as o,ni as r,rn as s,Ni as t,j as u};