azot 5.0.0-alpha.1 → 5.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/azt.cjs +2 -0
- package/dist/azt.mjs +2 -0
- package/dist/chunk-350yNsax.cjs +1 -0
- package/dist/chunk-DtROqxiw.mjs +1 -0
- package/dist/context-BdQ_7L4n.cjs +4 -0
- package/dist/context-vs4jQyij.mjs +4 -0
- package/dist/context.cjs +1 -0
- package/dist/context.mjs +1 -0
- package/dist/main.cjs +1 -0
- package/dist/main.mjs +1 -0
- package/dist/vitest.cjs +1 -0
- package/dist/vitest.mjs +1 -0
- package/package.json +57 -125
- package/types/context.d.ts +4 -0
- package/types/extension.d.ts +203 -0
- package/types/feedback.d.ts +62 -0
- package/{azot.d.ts → types/main.d.ts} +4 -19
- package/out/azt.js +0 -2
- package/out/chunk-nOFOJqeH.js +0 -1
- package/out/main.js +0 -3
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Azot API
|
|
2
2
|
|
|
3
|
-
Type definitions for the latest [Azot](https://azot.
|
|
3
|
+
Type definitions for the latest [Azot](https://azot.mov) API.
|
|
4
4
|
|
|
5
5
|
## Getting Started
|
|
6
6
|
|
|
7
|
-
Check [TypeScript interfaces](https://www.npmjs.com/package/azot?activeTab=code) to get started with our API. If you want to discover and install extensions, check out [Extension List](https://github.com/azot-labs/
|
|
7
|
+
Check [TypeScript interfaces](https://www.npmjs.com/package/azot?activeTab=code) to get started with our API. If you want to discover and install extensions, check out [Extension List](https://github.com/azot-labs/azot/blob/main/extensions.json).
|
|
8
8
|
|
|
9
9
|
## Community
|
|
10
10
|
|
package/dist/azt.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const e=require(`./chunk-350yNsax.cjs`);let t=require(`node:util`),n=require(`node:fs`),r=require(`node:path`);r=e.n(r);let i=require(`tsdown`),a=require(`node:crypto`),o=require(`javascript-obfuscator`);o=e.n(o);const s=Buffer.from(`STX`,`utf8`),c=(e,t,r)=>{let i=(0,a.randomBytes)(32),o=(0,a.randomBytes)(16),c=(0,n.readFileSync)(t),l=(0,a.createCipheriv)(`aes-256-cbc`,i,o),u=Buffer.concat([l.update(c),l.final()]),d=(0,a.publicEncrypt)(e,i),f=Buffer.concat([s,o,d,u]);return r&&(0,n.writeFileSync)(r,f),{aesIv:o,encryptedAesKey:d,encryptedCode:u}},l=(e,t,r)=>{let i=(0,n.readFileSync)(t),o=s.byteLength;if(!i.subarray(0,o).equals(s))throw Error(`Incorrect file format`);let c=o,l=c+16,u=l+512,d=i.subarray(c,l),f=i.subarray(l,u),p=i.subarray(u),m=(0,a.createDecipheriv)(`aes-256-cbc`,(0,a.privateDecrypt)(e,f),d),h=Buffer.concat([m.update(p),m.final()]).toString(`utf8`);return r&&(0,n.writeFileSync)(r,h),h},u=(e,t)=>{let r=(0,n.readFileSync)(e,`utf8`);console.log(`Obfuscating...`),console.time(`Obfuscation complete in`);let i=o.default.obfuscate(r,{target:`node`,compact:!0,controlFlowFlattening:!0,controlFlowFlatteningThreshold:1,deadCodeInjection:!0,debugProtection:!0,identifierNamesGenerator:`hexadecimal`,numbersToExpressions:!0,selfDefending:!0,simplify:!0,splitStrings:!0,splitStringsChunkLength:5,stringArray:!0,stringArrayCallsTransform:!0,stringArrayCallsTransformThreshold:1,stringArrayEncoding:[`base64`],stringArrayIndexShift:!0,stringArrayRotate:!0,stringArrayShuffle:!0,stringArrayWrappersCount:2,stringArrayWrappersChainedCalls:!0,stringArrayWrappersType:`function`,stringArrayThreshold:1,transformObjectKeys:!0,unicodeEscapeSequence:!1});console.timeEnd(`Obfuscation complete in`);let a=i.getObfuscatedCode();return(0,n.writeFileSync)(t||e,a),a},d=(0,t.parseArgs)({allowPositionals:!0,allowNegative:!0,options:{input:{type:`string`,short:`i`,description:`Path to the input file`},key:{type:`string`,short:`k`,description:`Path to the key file (public for encrypt, private for decrypt)`},output:{type:`string`,short:`o`,description:`Path to the output file`},format:{type:`string`,short:`f`,description:`Output format`},watch:{type:`boolean`,description:`Watch file changes`},minify:{type:`boolean`,description:`Minify output`},obfuscate:{type:`boolean`,description:`Obfuscate output`},encrypt:{type:`boolean`,description:`Encrypt extension source code (.js will be packed inside .stx)`},decrypt:{type:`boolean`,description:`Decrypt encrypted extension`}}}),f=()=>{let e=[process.cwd(),r.default.join(process.cwd(),`src`),r.default.join(process.cwd(),`lib`)];for(let t of e){let e=(0,n.readdirSync)(t).filter(e=>!e.endsWith(`.d.ts`)).filter(e=>new Set([`.ts`,`.js`,`.cjs`,`.mjs`]).has(r.default.extname(e))),i=e=>r.default.basename(e,r.default.extname(e)),a=e.find(e=>i(e)===`index`)||e.find(e=>i(e)===`main`)||e[0];if(a)return r.default.join(t,a)}};(async()=>{let[e,...t]=d.positionals,a=d.values.input||t[0]||f();if(!a)throw Error(`No entry file found`);if(e===`build`||e===`pack`){let t=typeof d.values.minify==`boolean`?d.values.minify:!0;await(0,i.build)({entry:a.replace(process.cwd(),`.`).replace(r.default.sep,`/`),format:d.values.format??`cjs`,platform:`node`,target:`node22`,watch:d.values.watch,minify:t});let o=d.values.format??`cjs`;d.values.input=r.default.join(process.cwd(),`dist`,r.default.basename(a).replace(/\.ts$/,`.${o}`));let s=require(r.default.join(process.cwd(),`package.json`));if((typeof d.values.obfuscate==`boolean`?d.values.obfuscate:s.private)&&u(d.values.input,d.values.input),d.values.encrypt||e===`pack`){let e=(0,n.readFileSync)(d.values.key||r.default.join(__dirname,`../public.pem`),`utf8`),t=d.values.output||d.values.input.replace(/\.js$/,`-${s.version}.stx`);c(e,d.values.input,t),(0,n.rmSync)(d.values.input)}}else if(e===`decrypt`)l((0,n.readFileSync)(d.values.key||r.default.join(__dirname,`../private.pem`),`utf8`),a,d.values.output||a.replace(/\.stx$/,`.js`)),d.values.input&&(0,n.rmSync)(d.values.input);else if(e===`dev`||e===`develop`||!e){let e=typeof d.values.minify==`boolean`?d.values.minify:!1;await(0,i.build)({entry:a,format:d.values.format??`cjs`,platform:`node`,target:`node22`,watch:!0,minify:e})}})();
|
package/dist/azt.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{n as e}from"./chunk-DtROqxiw.mjs";import{parseArgs as t}from"node:util";import{readFileSync as n,readdirSync as r,rmSync as i,writeFileSync as a}from"node:fs";import o from"node:path";import{build as s}from"tsdown";import{createCipheriv as c,createDecipheriv as l,privateDecrypt as u,publicEncrypt as d,randomBytes as f}from"node:crypto";import p from"javascript-obfuscator";const m=Buffer.from(`STX`,`utf8`),h=(e,t,r)=>{let i=f(32),o=f(16),s=n(t),l=c(`aes-256-cbc`,i,o),u=Buffer.concat([l.update(s),l.final()]),p=d(e,i),h=Buffer.concat([m,o,p,u]);return r&&a(r,h),{aesIv:o,encryptedAesKey:p,encryptedCode:u}},g=(e,t,r)=>{let i=n(t),o=m.byteLength;if(!i.subarray(0,o).equals(m))throw Error(`Incorrect file format`);let s=o,c=s+16,d=c+512,f=i.subarray(s,c),p=i.subarray(c,d),h=i.subarray(d),g=l(`aes-256-cbc`,u(e,p),f),_=Buffer.concat([g.update(h),g.final()]).toString(`utf8`);return r&&a(r,_),_},_=(e,t)=>{let r=n(e,`utf8`);console.log(`Obfuscating...`),console.time(`Obfuscation complete in`);let i=p.obfuscate(r,{target:`node`,compact:!0,controlFlowFlattening:!0,controlFlowFlatteningThreshold:1,deadCodeInjection:!0,debugProtection:!0,identifierNamesGenerator:`hexadecimal`,numbersToExpressions:!0,selfDefending:!0,simplify:!0,splitStrings:!0,splitStringsChunkLength:5,stringArray:!0,stringArrayCallsTransform:!0,stringArrayCallsTransformThreshold:1,stringArrayEncoding:[`base64`],stringArrayIndexShift:!0,stringArrayRotate:!0,stringArrayShuffle:!0,stringArrayWrappersCount:2,stringArrayWrappersChainedCalls:!0,stringArrayWrappersType:`function`,stringArrayThreshold:1,transformObjectKeys:!0,unicodeEscapeSequence:!1});console.timeEnd(`Obfuscation complete in`);let o=i.getObfuscatedCode();return a(t||e,o),o},v=t({allowPositionals:!0,allowNegative:!0,options:{input:{type:`string`,short:`i`,description:`Path to the input file`},key:{type:`string`,short:`k`,description:`Path to the key file (public for encrypt, private for decrypt)`},output:{type:`string`,short:`o`,description:`Path to the output file`},format:{type:`string`,short:`f`,description:`Output format`},watch:{type:`boolean`,description:`Watch file changes`},minify:{type:`boolean`,description:`Minify output`},obfuscate:{type:`boolean`,description:`Obfuscate output`},encrypt:{type:`boolean`,description:`Encrypt extension source code (.js will be packed inside .stx)`},decrypt:{type:`boolean`,description:`Decrypt encrypted extension`}}}),y=()=>{let e=[process.cwd(),o.join(process.cwd(),`src`),o.join(process.cwd(),`lib`)];for(let t of e){let e=r(t).filter(e=>!e.endsWith(`.d.ts`)).filter(e=>new Set([`.ts`,`.js`,`.cjs`,`.mjs`]).has(o.extname(e))),n=e=>o.basename(e,o.extname(e)),i=e.find(e=>n(e)===`index`)||e.find(e=>n(e)===`main`)||e[0];if(i)return o.join(t,i)}};(async()=>{let[t,...r]=v.positionals,a=v.values.input||r[0]||y();if(!a)throw Error(`No entry file found`);if(t===`build`||t===`pack`){let r=typeof v.values.minify==`boolean`?v.values.minify:!0;await s({entry:a.replace(process.cwd(),`.`).replace(o.sep,`/`),format:v.values.format??`cjs`,platform:`node`,target:`node22`,watch:v.values.watch,minify:r});let c=v.values.format??`cjs`;v.values.input=o.join(process.cwd(),`dist`,o.basename(a).replace(/\.ts$/,`.${c}`));let l=e(o.join(process.cwd(),`package.json`));if((typeof v.values.obfuscate==`boolean`?v.values.obfuscate:l.private)&&_(v.values.input,v.values.input),v.values.encrypt||t===`pack`){let e=n(v.values.key||o.join(__dirname,`../public.pem`),`utf8`),t=v.values.output||v.values.input.replace(/\.js$/,`-${l.version}.stx`);h(e,v.values.input,t),i(v.values.input)}}else if(t===`decrypt`)g(n(v.values.key||o.join(__dirname,`../private.pem`),`utf8`),a,v.values.output||a.replace(/\.stx$/,`.js`)),v.values.input&&i(v.values.input);else if(t===`dev`||t===`develop`||!t){let e=typeof v.values.minify==`boolean`?v.values.minify:!1;await s({entry:a,format:v.values.format??`cjs`,platform:`node`,target:`node22`,watch:!0,minify:e})}})();export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return o}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as e}from"node:module";var t=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),n=e(import.meta.url);export{n,t};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const e=require(`./chunk-350yNsax.cjs`);let t=require(`node:fs`),n=require(`node:path`);n=e.n(n);let r=require(`node:os`);r=e.n(r);let i=require(`node:timers/promises`),a=require(`@inquirer/prompts`),o=require(`node:fs/promises`);o=e.n(o);let s=require(`@logtape/logtape`),c=require(`@logtape/file`),l=require(`@logtape/pretty`),u=require(`node:process`),d=require(`node:events`);d=e.n(d),require(`urlpattern-polyfill`);let f=require(`node:readline/promises`),p=require(`impit`),m=require(`undici`),h=require(`metavm`);h=e.n(h),require(`picocolors`),require(`nanospinner`);let g=require(`conf`);g=e.n(g);var _=`azot-desktop`,v=`5.0.0-alpha.39`,y=`Azot`,b={name:_,version:v,description:`A powerful, extensible app for downloading videos`,keywords:[`api`,`azot`,`extensions`,`types`],homepage:`https://azot.mov`,author:`Vitaly Gashkov <vitalygashkov@vk.com>`,repository:{type:`git`,url:`https://github.com/azot-labs/azot.git`},funding:[{type:`individual`,url:`https://t.me/tribute/app?startapp=dqW2`}],files:[`out`],os:[`darwin`,`linux`,`win32`],main:`./out/main.js`,scripts:{start:`tsx --env-file .env ./src/main/cli.ts`,preview:`electron-vite preview --config vite.desktop.config.mjs`,dev:`electron-vite dev --config vite.desktop.config.mjs --watch`,cli:`pnpm run bundle:extensions && bun run ./src/main/cli.ts --env-file .env`,test:`vitest`,coverage:`vitest run --coverage`,"bundle:extensions":`node ./scripts/bundle-extensions.mjs`,"bundle:cli":`pnpm run bundle:extensions && node -e "require('fs').rmSync('azot',{force:true})" && STANDALONE=1 electron-vite build --config vite.cli.config.mjs`,bundle:`pnpm run bundle:cli && electron-vite build --config vite.desktop.config.mjs`,prebuild:`pnpm -C ../../packages/api build`,"build:cli":`pnpm run bundle:cli && bun build --compile ./out/cli.mjs --minify --outfile ./release/azot`,build:`pnpm run bundle && electron-builder build --config electron-builder.config.js`,"build:mac":`pnpm run bundle && electron-builder build --mac --arm64 --config electron-builder.config.js`,"build:mac:intel":`pnpm run bundle && electron-builder build --mac --x64 --config electron-builder.config.js`,"build:win":`pnpm run bundle && electron-builder build --win --config electron-builder.config.js`,"build:linux":`pnpm run bundle && electron-builder build --linux --config electron-builder.config.js`,"publish:desktop":`pnpm run bundle && electron-builder build --publish always --config electron-builder.config.js`,typecheck:`pnpm run typecheck:node && pnpm run typecheck:web`,"typecheck:node":`tsc --noEmit -p tsconfig.node.json --composite false`,"typecheck:web":`vue-tsc --noEmit -p tsconfig.web.json --composite false`,lint:`../../node_modules/.bin/oxlint -c ../../.oxlintrc.json .`,"lint:fix":`../../node_modules/.bin/oxlint -c ../../.oxlintrc.json --fix .`,fmt:`../../node_modules/.bin/oxfmt -c ../../.oxfmtrc.json .`,"fmt:check":`../../node_modules/.bin/oxfmt -c ../../.oxfmtrc.json --check .`},dependencies:{"@electron-toolkit/preload":`^3.0.2`,"@electron-toolkit/utils":`^4.0.0`,"@gitbeaker/rest":`^43.8.0`,"@inquirer/prompts":`^8.2.0`,"@logtape/file":`^2.0.2`,"@logtape/logtape":`^2.0.2`,"@logtape/pretty":`^2.0.2`,"@tanstack/query-core":`^5.90.20`,"@tribute-tg/better-auth":`^2.1.8`,azot:`workspace:*`,"better-auth":`^1.4.18`,bytenode:`^1.5.7`,conf:`^15.1.0`,cookie:`^1.1.1`,"cross-spawn":`^7.0.6`,dasha:`4.0.0-alpha.11`,"electron-squirrel-startup":`^1.0.1`,"electron-updater":`^6.7.3`,impit:`^0.9.1`,ky:`^1.14.3`,mediabunny:`^1.32.2`,metavm:`^1.4.5`,molnia:`workspace:*`,nanospinner:`^1.2.2`,okova:`^0.10.5`,open:`^11.0.0`,"p-queue":`^9.1.0`,picocolors:`^1.1.1`,"posthog-js":`^1.342.1`,semver:`^7.7.4`,"telegram-better-auth":`^0.0.8`,undici:`^7.21.0`,"urlpattern-polyfill":`^10.1.0`,yargs:`^18.0.0`,yauzl:`^3.2.0`,zod:`^4.3.6`},devDependencies:{"@electron-toolkit/tsconfig":`^2.0.0`,"@iconify/vue":`^5.0.0`,"@intlify/unplugin-vue-i18n":`^11.0.3`,"@tailwindcss/vite":`^4.1.18`,"@tanstack/vue-query":`^5.92.9`,"@types/node":`^25.2.1`,"@types/semver":`^7.7.1`,"@types/wicg-file-system-access":`^2023.10.7`,"@types/yargs":`^17.0.35`,"@vee-validate/zod":`^4.15.1`,"@vitejs/plugin-vue":`^6.0.4`,"@vueuse/core":`^14.2.0`,"class-variance-authority":`^0.7.1`,clsx:`^2.1.1`,dotenv:`^17.2.4`,electron:`39.5.1`,"electron-builder":`^26.4.0`,"electron-vite":`^5.0.0`,esbuild:`^0.27.3`,execa:`^9.6.0`,globals:`^16.3.0`,"lucide-vue-next":`^0.541.0`,"non.geist":`^1.0.4`,pinia:`^3.0.4`,postcss:`^8.5.6`,"reka-ui":`^2.8.0`,rolldown:`^1.0.0-rc.3`,sass:`^1.90.0`,"tailwind-merge":`^3.3.1`,tailwindcss:`^4.1.12`,"tailwindcss-animate":`^1.0.7`,tsdown:`^0.20.3`,tsx:`^4.21.0`,typescript:`^5.9.3`,"vee-validate":`^4.15.1`,vite:`^7.3.1`,"vite-plugin-static-copy":`^3.1.2`,vitest:`^4.0.18`,vue:`^3.5.27`,"vue-i18n":`^11.2.8`,"vue-sonner":`^2.0.9`,"vue-tsc":`^3.2.4`},peerDependencies:{vitest:`>=3.2.0`},engines:{node:`>=22`},productName:y,readmeFilename:`README.md`};`pkg`in process&&process.pkg,process.versions.electron,`${v}${u.platform}${u.arch}${u.version}`,`${v}`,_.split(`/`)[0]?.split(`-`)[0]?.replace(`@`,``);const x=y,ee={darwin:`macOS`,win32:`Windows`,linux:`Linux`}[process.platform],S=e=>{let n=typeof e==`string`?e:e[ee];return(0,t.existsSync)(n)||(0,t.mkdirSync)(n,{recursive:!0}),n},C=(0,r.homedir)(),te=(0,r.tmpdir)(),w=S({Windows:process.env.APPDATA||(0,n.join)(C,`AppData`,`Roaming`),macOS:(0,n.join)(C,`Library`,`Application Support`),Linux:process.env.XDG_DATA_HOME||(0,n.join)(C,`.local`,`share`)}),T=S({Windows:process.env.APPDATA||(0,n.join)(C,`AppData`,`Roaming`),macOS:(0,n.join)(C,`Library`,`Application Support`),Linux:process.env.XDG_CONFIG_HOME||(0,n.join)(C,`.config`)});S({Windows:process.env.LOCALAPPDATA||(0,n.join)(C,`AppData`,`Local`),macOS:(0,n.join)(C,`Library`,`Caches`),Linux:process.env.XDG_CACHE_HOME||(0,n.join)(C,`.cache`)}),S({Windows:(0,n.join)(C,`Downloads`),macOS:(0,n.join)(C,`Downloads`),Linux:process.env.XDG_DOWNLOAD_DIR||(0,n.join)(C,`Downloads`)});const ne=S({Windows:(0,n.join)(w,x),macOS:(0,n.join)(w,x),Linux:(0,n.join)(w,x.toLowerCase())}),re=S({Windows:(0,n.join)(T,x),macOS:(0,n.join)(T,x),Linux:(0,n.join)(T,x.toLowerCase())}),ie=S({Windows:(0,n.join)(T,x,`logs`),macOS:(0,n.join)(C,`Library`,`Logs`,x),Linux:(0,n.join)(T,x.toLowerCase(),`logs`)});(0,n.join)(te,x.toLowerCase());const E=S((0,n.join)(ne,`extensions`));S((0,n.join)(E,`installed`)),S((0,n.join)(E,`work`)),S((0,n.join)(E,`index.json`)),(0,n.join)(re,`settings.json`);const ae=process.argv.includes(`-d`)||process.argv.includes(`--debug`)||process.env.NODE_ENV_ELECTRON_VITE===`development`||!!process.env.ELECTRON_CLI_ARGS;(0,s.configureSync)({sinks:{console:(0,s.withFilter)((0,s.getConsoleSink)({formatter:(0,l.getPrettyFormatter)({timestamp:`time`,messageColor:null,messageStyle:null,levelStyle:null,icons:!1,colors:!0,level:`FULL`,categoryWidth:0,categoryStyle:null,categoryTruncate:`end`,wordWrap:!0})}),ae?`debug`:`info`),file:(0,c.getFileSink)((0,n.join)(ie,`Azot_${new Date().toISOString().split(`.`)[0].replace(`T`,`_`).replaceAll(`-`,``).replaceAll(`:`,``)}.log`),{flushInterval:0})},loggers:[{category:[],lowestLevel:`trace`,sinks:[`console`,`file`]},{category:[`logtape`,`meta`],lowestLevel:`error`,sinks:[`console`]}]});const D=(0,s.getLogger)([]),O=new class e extends d.EventEmitter{static requestEventName=`feedback`;static responseEventName=`feedback:response`;#e=Promise.resolve();async ask(t){let n=()=>new Promise(n=>{this.once(e.responseEventName,e=>{n(e)}),this.emit(e.requestEventName,t)}),r=this.#e.then(n,n);return this.#e=r.then(()=>void 0,()=>void 0),r}listen(t){this.addListener(e.requestEventName,async n=>{let r=await t(n);this.emit(e.responseEventName,r)})}},oe=e=>{let t=[`}`,`{`,`%`,`>`,`<`,`^`,`;`,"`",`$`,`"`,`@`,`=`],n=e;for(let e in t)n=n.replaceAll(`/`,`_`).replaceAll(t[e],``);return n},se=(e,t,n)=>{let r={},i={};for(let a of n)for(let n of t){let t=new URLPattern(n,a).exec(e);t&&(Object.assign(r,t.pathname.groups),Object.assign(i,t.search.groups))}return{pathname:r,search:i}},ce=(e=new Map)=>{let t=(t,n)=>{for(let r of e.keys())for(let i of e.get(r)||[]){let e=n===void 0||isNaN(n),a=t===void 0||isNaN(t),o=!1;if(o=a?r===n:(e?isNaN(r):r===n)&&i===t,o)return!0}return!1},n=(t,n)=>{let r=n||NaN,i=t||NaN;e.has(r)?e.get(r)?.add(i):e.set(r,new Set([i]))},r=()=>Array.from(e.values()).flatMap(e=>Array.from(e)),i=e.size,a=r();return{items:e,has:t,set:n,getMin:()=>Math.min(...a),getMax:()=>Math.max(...a),seasonsCount:i,episodesCount:a.length}};new Intl.DateTimeFormat(`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}),new Intl.DateTimeFormat(`en-US`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1});const k=new class e extends d.EventEmitter{static requestEventName=`form`;static responseEventName=`form:response`;title;#e=Promise.resolve();constructor(e={}){super(),this.title=e.title,this.listen(async e=>{let t=(0,f.createInterface)({input:u.stdin,output:u.stdout}),{title:n,description:r,fields:a,...o}=e,s={};for(let[e,{label:c,type:l}]of Object.entries(a||o)){let a=l===`confirm`,o=[n,r,c].filter(Boolean).join(`. `)+(a?` (y/n)`:``)+`: `;s[e]=await Promise.race([t.question(o),(0,i.setTimeout)(ue,``)])}return t.close(),s})}async ask(t){let n=()=>new Promise(n=>{this.once(e.responseEventName,e=>{n(e)}),this.emit(e.requestEventName,t)}),r=this.#e.then(n,n);return this.#e=r.then(()=>void 0,()=>void 0),r}listen(t){this.addListener(e.requestEventName,async n=>{let r=await t(n);this.emit(e.responseEventName,r)})}},le=async(e,t)=>{let n=t?.fields??{answer:{label:e}};return await k.ask({title:t?.title,description:e,fields:n})},ue=12e4;var A=class extends Error{response;request;options;constructor(e,t,n){let r=`${e.status||e.status===0?e.status:``} ${e.statusText??``}`.trim(),i=r?`status code ${r}`:`an unknown error`;super(`Request failed with ${i}: ${t.method} ${t.url}`),this.name=`HTTPError`,this.response=e,this.request=t,this.options=n}},de=class extends Error{name=`NonError`;value;constructor(e){let t=`Non-error value was thrown`;try{typeof e==`string`?t=e:e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`&&(t=e.message)}catch{}super(t),this.value=e}},j=class extends Error{name=`ForceRetryError`;customDelay;code;customRequest;constructor(e){let t=e?.cause?e.cause instanceof Error?e.cause:new de(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:`Forced retry`,t?{cause:t}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}};const fe=(()=>{let e=!1,t=!1,n=typeof globalThis.ReadableStream==`function`,r=typeof globalThis.Request==`function`;if(n&&r)try{t=new globalThis.Request(`https://empty.invalid`,{body:new globalThis.ReadableStream,method:`POST`,get duplex(){return e=!0,`half`}}).headers.has(`Content-Type`)}catch(e){if(e instanceof Error&&e.message===`unsupported BodyInit type`)return!1;throw e}return e&&!t})(),pe=typeof globalThis.AbortController==`function`,M=typeof globalThis.AbortSignal==`function`&&typeof globalThis.AbortSignal.any==`function`,me=typeof globalThis.ReadableStream==`function`,he=typeof globalThis.FormData==`function`,N=[`get`,`post`,`put`,`patch`,`head`,`delete`],ge={json:`application/json`,text:`text/*`,formData:`multipart/form-data`,arrayBuffer:`*/*`,blob:`*/*`,bytes:`*/*`},P=2147483647,_e=new TextEncoder().encode(`------WebKitFormBoundaryaxpyiPgbbPti10Rw`).length,F=Symbol(`stop`);var I=class{options;constructor(e){this.options=e}};const ve=e=>new I(e),ye={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},be={next:!0},xe={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},Se=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[n,r]of e)t+=_e,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${n}"`).length,t+=typeof r==`string`?new TextEncoder().encode(r).length:r.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e==`string`)return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if(`byteLength`in e)return e.byteLength;if(typeof e==`object`&&e)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},L=(e,t,n)=>{let r,i=0;return e.pipeThrough(new TransformStream({transform(e,a){if(a.enqueue(e),r){i+=r.byteLength;let e=t===0?0:i/t;e>=1&&(e=1-2**-52),n?.({percent:e,totalBytes:Math.max(t,i),transferredBytes:i},r)}r=e},flush(){r&&(i+=r.byteLength,n?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},r))}}))},Ce=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let n=Math.max(0,Number(e.headers.get(`content-length`))||0);return new Response(L(e.body,n,t),{status:e.status,statusText:e.statusText,headers:e.headers})},we=(e,t,n)=>{if(!e.body)return e;let r=Se(n??e.body);return new Request(e,{duplex:`half`,body:L(e.body,r,t)})},R=e=>typeof e==`object`&&!!e,z=(...e)=>{for(let t of e)if((!R(t)||Array.isArray(t))&&t!==void 0)throw TypeError("The `options` argument must be an object");return U({},...e)},B=(e={},t={})=>{let n=new globalThis.Headers(e),r=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[e,t]of i.entries())r&&t===`undefined`||t===void 0?n.delete(e):n.set(e,t);return n};function V(e,t,n){return Object.hasOwn(t,n)&&t[n]===void 0?[]:U(e[n]??[],t[n]??[])}const H=(e={},t={})=>({beforeRequest:V(e,t,`beforeRequest`),beforeRetry:V(e,t,`beforeRetry`),afterResponse:V(e,t,`afterResponse`),beforeError:V(e,t,`beforeError`)}),Te=(e,t)=>{let n=new URLSearchParams;for(let r of[e,t])if(r!==void 0)if(r instanceof URLSearchParams)for(let[e,t]of r.entries())n.append(e,t);else if(Array.isArray(r))for(let e of r){if(!Array.isArray(e)||e.length!==2)throw TypeError(`Array search parameters must be provided in [[key, value], ...] format`);n.append(String(e[0]),String(e[1]))}else if(R(r))for(let[e,t]of Object.entries(r))t!==void 0&&n.append(e,String(t));else{let e=new URLSearchParams(r);for(let[t,r]of e.entries())n.append(t,r)}return n},U=(...e)=>{let t={},n={},r={},i,a=[];for(let o of e)if(Array.isArray(o))Array.isArray(t)||(t=[]),t=[...t,...o];else if(R(o)){for(let[e,n]of Object.entries(o)){if(e===`signal`&&n instanceof globalThis.AbortSignal){a.push(n);continue}if(e===`context`){if(n!=null&&(!R(n)||Array.isArray(n)))throw TypeError("The `context` option must be an object");t={...t,context:n==null?{}:{...t.context,...n}};continue}if(e===`searchParams`){i=n==null?void 0:i===void 0?n:Te(i,n);continue}R(n)&&e in t&&(n=U(t[e],n)),t={...t,[e]:n}}R(o.hooks)&&(r=H(r,o.hooks),t.hooks=r),R(o.headers)&&(n=B(n,o.headers),t.headers=n)}return i!==void 0&&(t.searchParams=i),a.length>0&&(a.length===1?t.signal=a[0]:M?t.signal=AbortSignal.any(a):t.signal=a.at(-1)),t},Ee=e=>N.includes(e)?e.toUpperCase():e,De={limit:2,methods:[`get`,`put`,`head`,`delete`,`options`,`trace`],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:1/0,backoffLimit:1/0,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},Oe=(e={})=>{if(typeof e==`number`)return{...De,limit:e};if(e.methods&&!Array.isArray(e.methods))throw Error(`retry.methods must be an array`);if(e.methods&&=e.methods.map(e=>e.toLowerCase()),e.statusCodes&&!Array.isArray(e.statusCodes))throw Error(`retry.statusCodes must be an array`);let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0));return{...De,...t}};var W=class extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name=`TimeoutError`,this.request=e}};async function ke(e,t,n,r){return new Promise((i,a)=>{let o=setTimeout(()=>{n&&n.abort(),a(new W(e))},r.timeout);r.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function Ae(e,{signal:t}){return new Promise((n,r)=>{t&&(t.throwIfAborted(),t.addEventListener(`abort`,i,{once:!0}));function i(){clearTimeout(a),r(t.reason)}let a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e)})}const je=(e,t)=>{let n={};for(let r in t)Object.hasOwn(t,r)&&!(r in xe)&&!(r in ye)&&(!(r in e)||r in be)&&(n[r]=t[r]);return n},Me=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e==`object`?Object.keys(e).length>0:typeof e==`string`?e.trim().length>0:!!e;function Ne(e){return e instanceof A||e?.name===A.name}function Pe(e){return e instanceof W||e?.name===W.name}var Fe=class e{static create(t,n){let r=new e(t,n),i=r.#p(async()=>{if(typeof r.#i.timeout==`number`&&r.#i.timeout>P)throw RangeError(`The \`timeout\` option cannot be greater than ${P}`);await Promise.resolve();let e=await r.#m();for(let t of r.#i.hooks.afterResponse){let n=r.#u(e.clone()),i;try{i=await t(r.request,r.#h(),n,{retryCount:r.#n})}catch(t){throw r.#f(n),r.#f(e),t}if(i instanceof I)throw r.#f(n),r.#f(e),new j(i.options);let a=i instanceof globalThis.Response?i:e;n!==a&&r.#f(n),e!==a&&r.#f(e),e=a}if(r.#u(e),!e.ok&&(typeof r.#i.throwHttpErrors==`function`?r.#i.throwHttpErrors(e.status):r.#i.throwHttpErrors)){let t=new A(e,r.request,r.#h());for(let e of r.#i.hooks.beforeError)t=await e(t,{retryCount:r.#n});throw t}if(r.#i.onDownloadProgress){if(typeof r.#i.onDownloadProgress!=`function`)throw TypeError("The `onDownloadProgress` option must be a function");if(!me)throw Error("Streams are not supported in your environment. `ReadableStream` is missing.");let t=e.clone();return r.#f(e),Ce(t,r.#i.onDownloadProgress)}return e}).finally(()=>{let e=r.#a;r.#d(e?.body??void 0),r.#d(r.request.body??void 0)});for(let[e,t]of Object.entries(ge))e===`bytes`&&typeof globalThis.Response?.prototype?.bytes!=`function`||(i[e]=async()=>{r.request.headers.set(`accept`,r.request.headers.get(`accept`)||t);let a=await i;if(e===`json`){if(a.status===204)return``;let e=await a.text();return e===``?``:n.parseJson?n.parseJson(e):JSON.parse(e)}return a[e]()});return i}static#e(e){return e&&typeof e==`object`&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0)):e}request;#t;#n=0;#r;#i;#a;#o;#s;constructor(t,n={}){if(this.#r=t,this.#i={...n,headers:B(this.#r.headers,n.headers),hooks:H({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},n.hooks),method:Ee(n.method??this.#r.method??`GET`),prefixUrl:String(n.prefixUrl||``),retry:Oe(n.retry),throwHttpErrors:n.throwHttpErrors??!0,timeout:n.timeout??1e4,fetch:n.fetch??globalThis.fetch.bind(globalThis),context:n.context??{}},typeof this.#r!=`string`&&!(this.#r instanceof URL||this.#r instanceof globalThis.Request))throw TypeError("`input` must be a string, URL, or Request");if(this.#i.prefixUrl&&typeof this.#r==`string`){if(this.#r.startsWith(`/`))throw Error("`input` must not begin with a slash when using `prefixUrl`");this.#i.prefixUrl.endsWith(`/`)||(this.#i.prefixUrl+=`/`),this.#r=this.#i.prefixUrl+this.#r}pe&&M&&(this.#o=this.#i.signal??this.#r.signal,this.#t=new globalThis.AbortController,this.#i.signal=this.#o?AbortSignal.any([this.#o,this.#t.signal]):this.#t.signal),fe&&(this.#i.duplex=`half`),this.#i.json!==void 0&&(this.#i.body=this.#i.stringifyJson?.(this.#i.json)??JSON.stringify(this.#i.json),this.#i.headers.set(`content-type`,this.#i.headers.get(`content-type`)??`application/json`));let r=n.headers&&new globalThis.Headers(n.headers).has(`content-type`);if(this.#r instanceof globalThis.Request&&(he&&this.#i.body instanceof globalThis.FormData||this.#i.body instanceof URLSearchParams)&&!r&&this.#i.headers.delete(`content-type`),this.request=new globalThis.Request(this.#r,this.#i),Me(this.#i.searchParams)){let t=`?`+(typeof this.#i.searchParams==`string`?this.#i.searchParams.replace(/^\?/,``):new URLSearchParams(e.#e(this.#i.searchParams)).toString()),n=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,t);this.request=new globalThis.Request(n,this.#i)}if(this.#i.onUploadProgress){if(typeof this.#i.onUploadProgress!=`function`)throw TypeError("The `onUploadProgress` option must be a function");if(!fe)throw Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#_(this.request,this.#i.body??void 0)}}#c(){let e=this.#i.retry.delay(this.#n),t=e;this.#i.retry.jitter===!0?t=Math.random()*e:typeof this.#i.retry.jitter==`function`&&(t=this.#i.retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e));let n=this.#i.retry.backoffLimit??1/0;return Math.min(n,t)}async#l(e){if(this.#n++,this.#n>this.#i.retry.limit)throw e;let t=e instanceof Error?e:new de(e);if(t instanceof j)return t.customDelay??this.#c();if(!this.#i.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#i.retry.shouldRetry!==void 0){let n=await this.#i.retry.shouldRetry({error:t,retryCount:this.#n});if(n===!1)throw e;if(n===!0)return this.#c()}if(Pe(e)&&!this.#i.retry.retryOnTimeout)throw e;if(Ne(e)){if(!this.#i.retry.statusCodes.includes(e.response.status))throw e;let t=e.response.headers.get(`Retry-After`)??e.response.headers.get(`RateLimit-Reset`)??e.response.headers.get(`X-RateLimit-Retry-After`)??e.response.headers.get(`X-RateLimit-Reset`)??e.response.headers.get(`X-Rate-Limit-Reset`);if(t&&this.#i.retry.afterStatusCodes.includes(e.response.status)){let e=Number(t)*1e3;Number.isNaN(e)?e=Date.parse(t)-Date.now():e>=Date.parse(`2024-01-01`)&&(e-=Date.now());let n=this.#i.retry.maxRetryAfter??e;return e<n?e:n}if(e.response.status===413)throw e}return this.#c()}#u(e){return this.#i.parseJson&&(e.json=async()=>this.#i.parseJson(await e.text())),e}#d(e){e&&e.cancel().catch(()=>void 0)}#f(e){this.#d(e.body??void 0)}async#p(e){try{return await e()}catch(t){let n=Math.min(await this.#l(t),P);if(this.#n<1)throw t;if(await Ae(n,this.#o?{signal:this.#o}:{}),t instanceof j&&t.customRequest){let e=this.#i.signal?new globalThis.Request(t.customRequest,{signal:this.#i.signal}):new globalThis.Request(t.customRequest);this.#g(e)}for(let e of this.#i.hooks.beforeRetry){let n=await e({request:this.request,options:this.#h(),error:t,retryCount:this.#n});if(n instanceof globalThis.Request){this.#g(n);break}if(n instanceof globalThis.Response)return n;if(n===F)return}return this.#p(e)}}async#m(){this.#t?.signal.aborted&&(this.#t=new globalThis.AbortController,this.#i.signal=this.#o?AbortSignal.any([this.#o,this.#t.signal]):this.#t.signal,this.request=new globalThis.Request(this.request,{signal:this.#i.signal}));for(let e of this.#i.hooks.beforeRequest){let t=await e(this.request,this.#h(),{retryCount:this.#n});if(t instanceof Response)return t;if(t instanceof globalThis.Request){this.#g(t);break}}let e=je(this.request,this.#i);return this.#a=this.request,this.request=this.#a.clone(),this.#i.timeout===!1?this.#i.fetch(this.#a,e):ke(this.#a,e,this.#t,this.#i)}#h(){if(!this.#s){let{hooks:e,...t}=this.#i;this.#s=Object.freeze(t)}return this.#s}#g(e){this.#s=void 0,this.request=this.#_(e)}#_(e,t){return!this.#i.onUploadProgress||!e.body?e:we(e,this.#i.onUploadProgress,t??this.#i.body??void 0)}};
|
|
2
|
+
/*! MIT License © Sindre Sorhus */
|
|
3
|
+
const G=e=>{let t=(t,n)=>Fe.create(t,z(e,n));for(let n of N)t[n]=(t,r)=>Fe.create(t,z(e,r,{method:n}));return t.create=e=>G(z(e)),t.extend=t=>(typeof t==`function`&&(t=t(e??{})),G(z(e,t))),t.stop=F,t.retry=ve,t},Ie=G();var Le=e.t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.stringifySetCookie=s,e.serialize=s,e.parseSetCookie=c,e.stringifySetCookie=s,e.serialize=s;let t=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,n=/^[\u0021-\u003A\u003C-\u007E]*$/,r=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,i=/^[\u0020-\u003A\u003D-\u007E]*$/,a=/^-?\d+$/,o=Object.prototype.toString;function s(e,a,o){let s=typeof e==`object`?e:{...o,name:e,value:String(a)},c=(typeof a==`object`?a:o)?.encode||encodeURIComponent;if(!t.test(s.name))throw TypeError(`argument name is invalid: ${s.name}`);let l=s.value?c(s.value):``;if(!n.test(l))throw TypeError(`argument val is invalid: ${s.value}`);let u=s.name+`=`+l;if(s.maxAge!==void 0){if(!Number.isInteger(s.maxAge))throw TypeError(`option maxAge is invalid: ${s.maxAge}`);u+=`; Max-Age=`+s.maxAge}if(s.domain){if(!r.test(s.domain))throw TypeError(`option domain is invalid: ${s.domain}`);u+=`; Domain=`+s.domain}if(s.path){if(!i.test(s.path))throw TypeError(`option path is invalid: ${s.path}`);u+=`; Path=`+s.path}if(s.expires){if(!p(s.expires)||!Number.isFinite(s.expires.valueOf()))throw TypeError(`option expires is invalid: ${s.expires}`);u+=`; Expires=`+s.expires.toUTCString()}if(s.httpOnly&&(u+=`; HttpOnly`),s.secure&&(u+=`; Secure`),s.partitioned&&(u+=`; Partitioned`),s.priority)switch(typeof s.priority==`string`?s.priority.toLowerCase():void 0){case`low`:u+=`; Priority=Low`;break;case`medium`:u+=`; Priority=Medium`;break;case`high`:u+=`; Priority=High`;break;default:throw TypeError(`option priority is invalid: ${s.priority}`)}if(s.sameSite)switch(typeof s.sameSite==`string`?s.sameSite.toLowerCase():s.sameSite){case!0:case`strict`:u+=`; SameSite=Strict`;break;case`lax`:u+=`; SameSite=Lax`;break;case`none`:u+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid: ${s.sameSite}`)}return u}function c(e,t){let n=t?.decode||f,r=e.length,i=l(e,0,r),o=u(e,0,i),s=o===-1?{name:``,value:n(d(e,0,i))}:{name:d(e,0,o),value:n(d(e,o+1,i))},c=i+1;for(;c<r;){let t=l(e,c,r),n=u(e,c,t),i=n===-1?d(e,c,t):d(e,c,n),o=n===-1?void 0:d(e,n+1,t);switch(i.toLowerCase()){case`httponly`:s.httpOnly=!0;break;case`secure`:s.secure=!0;break;case`partitioned`:s.partitioned=!0;break;case`domain`:s.domain=o;break;case`path`:s.path=o;break;case`max-age`:o&&a.test(o)&&(s.maxAge=Number(o));break;case`expires`:if(!o)break;let e=new Date(o);Number.isFinite(e.valueOf())&&(s.expires=e);break;case`priority`:if(!o)break;let t=o.toLowerCase();(t===`low`||t===`medium`||t===`high`)&&(s.priority=t);break;case`samesite`:if(!o)break;let n=o.toLowerCase();(n===`lax`||n===`strict`||n===`none`)&&(s.sameSite=n);break}c=t+1}return s}function l(e,t,n){let r=e.indexOf(`;`,t);return r===-1?n:r}function u(e,t,n){let r=e.indexOf(`=`,t);return r<n?r:-1}function d(e,t,n){let r=t,i=n;do{let t=e.charCodeAt(r);if(t!==32&&t!==9)break}while(++r<i);for(;i>r;){let t=e.charCodeAt(i-1);if(t!==32&&t!==9)break;i--}return e.slice(r,i)}function f(e){if(e.indexOf(`%`)===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function p(e){return o.call(e)===`[object Date]`}}))();const K=e=>{let t=[];for(let n of e)try{let e=(0,Le.parseSetCookie)(n),r={...e,expires:e.expires instanceof Date?e.expires.getTime():e.expires,sameSite:typeof e.sameSite==`boolean`?`strict`:e.sameSite};t.push(r)}catch(e){D.debug(e)}return t},Re=async e=>{let t=await(0,o.readFile)(e,`utf8`).catch(()=>``);if(!t)return[];let n=t.split(r.EOL).flatMap(e=>e.split(`
|
|
4
|
+
`)).filter(e=>!!e.trim()&&!e.startsWith(`# `)).map(e=>e.split(` `)),i=[];for(let e of n){let[t,n,r,a,o,s,c]=e;i.push({name:s,value:c,expires:Number(o),maxAge:void 0,domain:t.replace(`#HttpOnly_`,``),path:r,secure:a===`TRUE`,httpOnly:void 0,sameSite:void 0})}return i};var ze=class{#e={};#t;#n;#r=!1;static parse(e){return K(e)}constructor({storagePath:e}={}){this.#n=e,this.#t=[]}async import(e){(await(0,o.stat)(e).catch(()=>null))?.isFile()&&(this.#t=await Re(e),await(0,o.rm)(e,{recursive:!0,force:!0}))}async#i(){if(!(!this.#n||this.#r)){if((await(0,o.stat)(this.#n).catch(()=>null))?.isFile()){let e=await(0,o.readFile)(this.#n,`utf8`);this.#e=e?JSON.parse(e):{},this.#t=`cookies`in this.#e?this.#e.cookies:[]}this.#r=!0}}async#a(){if(!this.#n)return;let e=JSON.stringify({...this.#e,cookies:this.#t},null,2);await(0,o.writeFile)(this.#n,e,`utf8`)}async get(e){await this.#i();let t=typeof e==`string`?e:e.name;return this.#t.find(e=>e.name===t)??null}async getAll(e){if(await this.#i(),!e)return this.#t;let t=typeof e==`string`?e:e.name;return this.#t.filter(e=>e.name===t)??null}async set(e){await this.#i(),this.#t=this.#t.filter(t=>!(t.name===e.name&&t.domain===e.domain)),this.#t.push(e),await this.#a()}async delete(e){if(await this.#i(),!e)this.#t=[];else{let t=typeof e==`string`?e:e.name;this.#t=this.#t.filter(e=>e.name!==t)}await this.#a()}toString(){return this.#t.map(e=>`${e.name}=${e.value}`).join(`; `)}};const Be=Ie.default??Ie,Ve=e=>e?e instanceof Headers?e.has(`User-Agent`):typeof e==`object`&&e?`User-Agent`in e||`user-agent`in e:!1:!1,He=e=>e instanceof URL?e:e instanceof Request?new URL(e.url):new URL(e);var Ue=class{cookieStore;headers;#e;#t;constructor(e={}){this.headers=new Headers,this.configure(e)}configure({maxRetries:e=3,proxyUrl:t,allowH2:n=!0,cookieStore:r}={}){this.cookieStore=r??this.cookieStore??new ze;let i=t?new m.ProxyAgent({uri:t,allowH2:n}):new m.Agent({allowH2:n}),a={retry:e};this.#e=Be.create({dispatcher:i,proxy:t,...a});let o=new p.Impit({browser:`chrome`,proxyUrl:t,ignoreTlsErrors:!0,followRedirects:!0});this.#t=Be.create({fetch:o.fetch.bind(o),...a})}async fetch(e,t={}){let n=this.appendHeaders(t?.headers),r=await this.cookieStore.getAll(),i=r.filter(t=>!t.domain||He(e).hostname.includes(t.domain));for(let e of r)i.find(t=>t.name===e.name)||e.domain||i.push(e);let a=i.map(e=>`${e.name}=${e.value}`).join(`; `);n.has(`cookie`)?n.get(`cookie`)||n.delete(`cookie`):n.set(`cookie`,a);let o=(Ve(t?.headers)?this.#e:this.#t)[t?.method?.toLowerCase()??`get`],s=await o(e,{...t,headers:n}),c=s.headers.getSetCookie();return c&&await this.setCookies(c),s}async setCookies(e){let t=[];if(typeof e==`string`){let[n]=K([e]);n&&t.push(n)}else if(Array.isArray(e)&&typeof e.at(0)==`string`){let n=K(e);t.push(...n)}else Array.isArray(e)&&typeof e[0]!=`string`&&t.push(...e);if(!(!t||!t?.length))for(let e of t)await this.cookieStore.set(e)}appendHeaders(e){let t=new Headers(this.headers);for(let[n,r]of Object.entries(e??{}))t.set(n,r);return t}setHeader(e,t){this.headers.set(e,t)}removeHeader(e){this.headers.delete(e)}};new Ue;const{COMMON_CONTEXT:We}=h.default,Ge=(e,t=`Eval`,n)=>{try{return h.default.createScript(t,e,n)}catch(t){return console.debug(t),console.debug(e),console.error(`Syntax Error: ${t.message}`),null}},Ke=(e,t=1)=>{if(Array.isArray(e)||typeof e==`string`){let n=[];for(let r=1;r<=t;r++)n.push(e[Math.floor(Math.random()*e.length)]);return n}else return[]},qe=e=>new(`default`in g.default?g.default.default:g.default)(e);var Je=class{#e;constructor(e){this.#e=qe({cwd:(0,n.dirname)(e),configName:(0,n.basename)(e,`.json`)})}get length(){return Object.keys(this.#e.store).length}clear(){this.#e.clear()}getItem(e){return this.#e.get(e)??null}key(e){return Object.keys(this.#e.store).at(e)??null}removeItem(e){this.#e.delete(e)}setItem(e,t){this.#e.set(e,t)}};const Ye=new d.default,q=e=>{if(!e||typeof e!=`object`)return!1;let t=`name`in e?String(e.name):``;return t===`ExitPromptError`||t===`AbortPromptError`},Xe=e=>e[0].toUpperCase()+e.slice(1),J=(e,t=!1)=>{if(typeof e==`boolean`)return e;if(typeof e!=`string`)return t;let n=e.trim().toLowerCase();return[`1`,`true`,`yes`,`y`,`on`].includes(n)?!0:[`0`,`false`,`no`,`n`,`off`].includes(n)?!1:t},Y=(e,t=0)=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`)return t;let n=Number(e);return Number.isFinite(n)?n:t},Ze=e=>{switch(e.type){case`checkbox`:return J(e.defaultValue,!1);case`number`:return Y(e.defaultValue,0);default:return e.defaultValue??``}},Qe=(e,t)=>{switch(e.type){case`checkbox`:return J(t,J(e.defaultValue,!1));case`number`:return Y(t,Y(e.defaultValue,0));default:return typeof t==`string`?t:t==null?e.defaultValue??``:String(t)}},$e=e=>{let t=Object.entries(e).map(([e,t])=>[e,Ze(t)]);return Object.fromEntries(t)},X=(e,t)=>{let n=Object.entries(e).map(([e,n])=>[e,Qe(n,t[e])]);return Object.fromEntries(n)},Z=async e=>{e?.onAction&&await e.onAction()},Q=async(e,t)=>{if(!t.length)return`dismiss`;try{return await(0,a.select)({message:e,loop:!1,choices:t.map(e=>({name:e.action.title,value:e.kind}))})}catch(e){if(q(e))return`dismiss`;throw e}},$=()=>{switch(r.default.type()){case`Darwin`:return`macOS`;case`Windows_NT`:return`Windows`;default:return`Linux`}};Object.defineProperties(Uint8Array.prototype,{toBase64:{value:function(){return Buffer.from(this).toString(`base64`)},writable:!0,configurable:!0},toHex:{value:function(){return Buffer.from(this).toString(`hex`)},writable:!0,configurable:!0}}),Object.defineProperties(Uint8Array,{fromBase64:{value:function(e){return new Uint8Array(Buffer.from(e,`base64`))},writable:!0,configurable:!0},fromHex:{value:function(e){return new Uint8Array(Buffer.from(e,`hex`))},writable:!0,configurable:!0}});const et=new Map([[24,[`Sequoia`,`15`]],[23,[`Sonoma`,`14`]],[22,[`Ventura`,`13`]],[21,[`Monterey`,`12`]],[20,[`Big Sur`,`11`]],[19,[`Catalina`,`10.15`]],[18,[`Mojave`,`10.14`]],[17,[`High Sierra`,`10.13`]],[16,[`Sierra`,`10.12`]],[15,[`El Capitan`,`10.11`]],[14,[`Yosemite`,`10.10`]],[13,[`Mavericks`,`10.9`]],[12,[`Mountain Lion`,`10.8`]],[11,[`Lion`,`10.7`]],[10,[`Snow Leopard`,`10.6`]],[9,[`Leopard`,`10.5`]],[8,[`Tiger`,`10.4`]],[7,[`Panther`,`10.3`]],[6,[`Jaguar`,`10.2`]],[5,[`Puma`,`10.1`]]]),tt=()=>{let e=Number(r.default.release().split(`.`)[0]),[t,n]=et.get(e)||[`Unknown`,``];return{name:t,version:n}},nt=()=>{switch($()){case`macOS`:return tt().version;case`Windows`:return r.default.release();case`Linux`:return r.default.release()}},rt=()=>{let e=[{brand:`Azot`,version:b.version.split(`.`).slice(0,2).join(`.`)},{brand:`Node.js`,version:process.version.replace(`v`,``).split(`.`).slice(0,1).join(`.`)}];return{mobile:!1,platform:$(),brands:e,getHighEntropyValues:async t=>{let n={mobile:!1,platform:$(),brands:e};return t.includes(`architecture`)&&(n.architecture=r.default.arch()),t.includes(`platform`)&&(n.platform=$()),t.includes(`platformVersion`)&&(n.platformVersion=nt()),t.includes(`fullVersionList`)&&(n.fullVersionList=[{brand:`Azot`,version:b.version},{brand:`Node.js`,version:process.version}]),n}}},it=({name:e=`extension`,dir:t=process.cwd(),title:r}={})=>{let o=S((0,n.join)(t,e)),s=new Je((0,n.join)(o,`storage.json`)),c=new ze({storagePath:(0,n.join)(o,`cookies.json`)}),l=new Ue({cookieStore:c}),u=(e,t,n)=>e.split(t)[1]?.split(n)[0]?.trim(),d={sanitizeString:oe,execUrlPatterns:se,extendEpisodes:ce,between:u,getRandomElements:Ke},f=r?Xe(r):void 0,p=e=>e||f,m=async e=>(e.title||=f,await k.ask(e)),h={defineExtension:e=>e,version:b.version,sleep:i.setTimeout,sanitizeString:oe,execUrlPatterns:se,extendEpisodes:ce,between:u,getRandomElements:Ke,utils:d,prompt:m,input:le,notify:async(e,t={})=>{let n=p(t.title)??`Azot`,r=[t.primaryAction?{kind:`primary`,action:t.primaryAction}:null,t.secondaryAction?{kind:`secondary`,action:t.secondaryAction}:null].filter(Boolean);{if(D.info(`[Extension notification] ${n}: ${e}`),!r.length)return;let i=await Q(e,r);i===`primary`&&await Z(t.primaryAction),i===`secondary`&&await Z(t.secondaryAction);return}let i=(await O.ask({variant:`notify`,title:n,message:e,style:t.style,primaryAction:t.primaryAction?{title:t.primaryAction.title,style:t.primaryAction.style}:void 0,secondaryAction:t.secondaryAction?{title:t.secondaryAction.title,style:t.secondaryAction.style}:void 0})).action??`dismiss`;i===`primary`&&await Z(t.primaryAction),i===`secondary`&&await Z(t.secondaryAction)},confirm:async(e,t={})=>{let n=p(t.title)??`Azot`,r=!!t.primaryAction||!!t.secondaryAction,i=t.primaryAction??{title:`OK`},o=t.secondaryAction??{title:`Cancel`,style:`cancel`};if(r){let t=await Q(e,[{kind:`primary`,action:i},{kind:`secondary`,action:o}]);return t===`primary`?(await Z(i),!0):(t===`secondary`&&await Z(o),!1)}try{let n=await(0,a.confirm)({message:e,default:!0});return n?await Z(t.primaryAction):await Z(t.secondaryAction),n}catch(e){if(q(e))return!1;throw e}let s=await O.ask({variant:`confirm`,title:n,message:e,style:t.style,primaryAction:{title:i.title,style:i.style},secondaryAction:{title:o.title,style:o.style}}),c=s.action===`primary`;return c?await Z(i):s.action===`secondary`&&await Z(o),c},ask:async(e,t)=>{let n=$e(t.form),r=Object.entries(t.form),i=!!t.primaryAction||!!t.secondaryAction,o=t.primaryAction??{title:`Submit`},s=t.secondaryAction??{title:`Cancel`,style:`cancel`};{let c={};try{for(let[e,t]of r){let n=[t.title||e,t.description].filter(Boolean).join(` - `);if(t.type===`checkbox`){c[e]=await(0,a.confirm)({message:n,default:J(t.defaultValue,!1)});continue}if(t.type===`number`){let r=Y(t.defaultValue,NaN);c[e]=await(0,a.number)({message:n,default:Number.isFinite(r)?r:void 0,validate:e=>(e===void 0||Number.isNaN(e))&&t.required?`This field is required`:!0});continue}if(t.type===`password`){c[e]=await(0,a.password)({message:n,validate:t.required?e=>String(e??``).trim()?!0:`This field is required`:void 0});continue}c[e]=await(0,a.input)({message:n,default:t.defaultValue,validate:t.required?e=>String(e??``).trim()?!0:`This field is required`:void 0})}}catch(e){if(q(e))return n;throw e}if(!i)return X(t.form,c);let l=await Q(e,[{kind:`primary`,action:o},{kind:`secondary`,action:s}]);return l===`primary`?(await Z(o),X(t.form,c)):(l===`secondary`&&await Z(s),n)}let c=Object.fromEntries(r.map(([e,t])=>[e,{type:t.type,label:t.title||e,description:t.description,placeholder:t.placeholder,defaultValue:t.defaultValue,value:t.defaultValue,required:t.required,autoFocus:t.autoFocus}])),l=await m({title:p(t.title),description:e,fields:c,actions:i?{primaryAction:{title:o.title,style:o.style},secondaryAction:{title:s.title,style:s.style}}:void 0}),u=l.__action??`primary`,d={...l};return delete d.__action,u===`primary`?(await Z(t.primaryAction),X(t.form,d)):(u===`secondary`&&await Z(t.secondaryAction),n)}};class g{get cookie(){return c.toString()}}let _={fetch:l.fetch.bind(l),Response,Request,Headers,AbortController,AbortSignal,URL,URLSearchParams,URLPattern,Blob,structuredClone,btoa,atob,TextEncoder,TextDecoder,Uint8Array,crypto,console:{log:console.log,info:D.info.bind(D),warn:D.warn.bind(D),error:(...e)=>{let t=String(e[0]??`Unknown error`);Ye.emit(`error`,{message:t}),D.error(t)},trace:D.trace.bind(D),debug:D.debug.bind(D)},Event,EventTarget,localStorage:s,cookieStore:c,document:new g,eval:e=>Ge(e)?.exports,navigator:{appName:`Azot`,appVersion:b.version,platform:process.platform,userAgent:`Azot/${b.version}`,userAgentData:rt()}};return{http:l,question:k,common:d,Streamyx:h,Azot:h,window:_,..._}};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return it}});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{t as e}from"./chunk-DtROqxiw.mjs";import{existsSync as t,mkdirSync as n}from"node:fs";import r,{basename as i,dirname as a,join as o}from"node:path";import s,{EOL as c,homedir as l,tmpdir as u}from"node:os";import{setTimeout as d}from"node:timers/promises";import{confirm as f,input as ee,number as te,password as ne,select as p}from"@inquirer/prompts";import{readFile as m,rm as h,stat as g,writeFile as _}from"node:fs/promises";import{configureSync as re,getConsoleSink as ie,getLogger as ae,withFilter as oe}from"@logtape/logtape";import{getFileSink as se}from"@logtape/file";import{getPrettyFormatter as ce}from"@logtape/pretty";import{arch as le,platform as ue,stdin as de,stdout as fe,version as pe}from"node:process";import me,{EventEmitter as v}from"node:events";import"urlpattern-polyfill";import{createInterface as he}from"node:readline/promises";import{Impit as ge}from"impit";import{Agent as _e,ProxyAgent as ve}from"undici";import y from"metavm";import"picocolors";import"nanospinner";import b from"conf";var x=`azot-desktop`,S=`5.0.0-alpha.39`,ye=`Azot`,C={name:x,version:S,description:`A powerful, extensible app for downloading videos`,keywords:[`api`,`azot`,`extensions`,`types`],homepage:`https://azot.mov`,author:`Vitaly Gashkov <vitalygashkov@vk.com>`,repository:{type:`git`,url:`https://github.com/azot-labs/azot.git`},funding:[{type:`individual`,url:`https://t.me/tribute/app?startapp=dqW2`}],files:[`out`],os:[`darwin`,`linux`,`win32`],main:`./out/main.js`,scripts:{start:`tsx --env-file .env ./src/main/cli.ts`,preview:`electron-vite preview --config vite.desktop.config.mjs`,dev:`electron-vite dev --config vite.desktop.config.mjs --watch`,cli:`pnpm run bundle:extensions && bun run ./src/main/cli.ts --env-file .env`,test:`vitest`,coverage:`vitest run --coverage`,"bundle:extensions":`node ./scripts/bundle-extensions.mjs`,"bundle:cli":`pnpm run bundle:extensions && node -e "require('fs').rmSync('azot',{force:true})" && STANDALONE=1 electron-vite build --config vite.cli.config.mjs`,bundle:`pnpm run bundle:cli && electron-vite build --config vite.desktop.config.mjs`,prebuild:`pnpm -C ../../packages/api build`,"build:cli":`pnpm run bundle:cli && bun build --compile ./out/cli.mjs --minify --outfile ./release/azot`,build:`pnpm run bundle && electron-builder build --config electron-builder.config.js`,"build:mac":`pnpm run bundle && electron-builder build --mac --arm64 --config electron-builder.config.js`,"build:mac:intel":`pnpm run bundle && electron-builder build --mac --x64 --config electron-builder.config.js`,"build:win":`pnpm run bundle && electron-builder build --win --config electron-builder.config.js`,"build:linux":`pnpm run bundle && electron-builder build --linux --config electron-builder.config.js`,"publish:desktop":`pnpm run bundle && electron-builder build --publish always --config electron-builder.config.js`,typecheck:`pnpm run typecheck:node && pnpm run typecheck:web`,"typecheck:node":`tsc --noEmit -p tsconfig.node.json --composite false`,"typecheck:web":`vue-tsc --noEmit -p tsconfig.web.json --composite false`,lint:`../../node_modules/.bin/oxlint -c ../../.oxlintrc.json .`,"lint:fix":`../../node_modules/.bin/oxlint -c ../../.oxlintrc.json --fix .`,fmt:`../../node_modules/.bin/oxfmt -c ../../.oxfmtrc.json .`,"fmt:check":`../../node_modules/.bin/oxfmt -c ../../.oxfmtrc.json --check .`},dependencies:{"@electron-toolkit/preload":`^3.0.2`,"@electron-toolkit/utils":`^4.0.0`,"@gitbeaker/rest":`^43.8.0`,"@inquirer/prompts":`^8.2.0`,"@logtape/file":`^2.0.2`,"@logtape/logtape":`^2.0.2`,"@logtape/pretty":`^2.0.2`,"@tanstack/query-core":`^5.90.20`,"@tribute-tg/better-auth":`^2.1.8`,azot:`workspace:*`,"better-auth":`^1.4.18`,bytenode:`^1.5.7`,conf:`^15.1.0`,cookie:`^1.1.1`,"cross-spawn":`^7.0.6`,dasha:`4.0.0-alpha.11`,"electron-squirrel-startup":`^1.0.1`,"electron-updater":`^6.7.3`,impit:`^0.9.1`,ky:`^1.14.3`,mediabunny:`^1.32.2`,metavm:`^1.4.5`,molnia:`workspace:*`,nanospinner:`^1.2.2`,okova:`^0.10.5`,open:`^11.0.0`,"p-queue":`^9.1.0`,picocolors:`^1.1.1`,"posthog-js":`^1.342.1`,semver:`^7.7.4`,"telegram-better-auth":`^0.0.8`,undici:`^7.21.0`,"urlpattern-polyfill":`^10.1.0`,yargs:`^18.0.0`,yauzl:`^3.2.0`,zod:`^4.3.6`},devDependencies:{"@electron-toolkit/tsconfig":`^2.0.0`,"@iconify/vue":`^5.0.0`,"@intlify/unplugin-vue-i18n":`^11.0.3`,"@tailwindcss/vite":`^4.1.18`,"@tanstack/vue-query":`^5.92.9`,"@types/node":`^25.2.1`,"@types/semver":`^7.7.1`,"@types/wicg-file-system-access":`^2023.10.7`,"@types/yargs":`^17.0.35`,"@vee-validate/zod":`^4.15.1`,"@vitejs/plugin-vue":`^6.0.4`,"@vueuse/core":`^14.2.0`,"class-variance-authority":`^0.7.1`,clsx:`^2.1.1`,dotenv:`^17.2.4`,electron:`39.5.1`,"electron-builder":`^26.4.0`,"electron-vite":`^5.0.0`,esbuild:`^0.27.3`,execa:`^9.6.0`,globals:`^16.3.0`,"lucide-vue-next":`^0.541.0`,"non.geist":`^1.0.4`,pinia:`^3.0.4`,postcss:`^8.5.6`,"reka-ui":`^2.8.0`,rolldown:`^1.0.0-rc.3`,sass:`^1.90.0`,"tailwind-merge":`^3.3.1`,tailwindcss:`^4.1.12`,"tailwindcss-animate":`^1.0.7`,tsdown:`^0.20.3`,tsx:`^4.21.0`,typescript:`^5.9.3`,"vee-validate":`^4.15.1`,vite:`^7.3.1`,"vite-plugin-static-copy":`^3.1.2`,vitest:`^4.0.18`,vue:`^3.5.27`,"vue-i18n":`^11.2.8`,"vue-sonner":`^2.0.9`,"vue-tsc":`^3.2.4`},peerDependencies:{vitest:`>=3.2.0`},engines:{node:`>=22`},productName:ye,readmeFilename:`README.md`};`pkg`in process&&process.pkg,process.versions.electron,`${S}${ue}${le}${pe}`,`${S}`,x.split(`/`)[0]?.split(`-`)[0]?.replace(`@`,``);const w=ye,be={darwin:`macOS`,win32:`Windows`,linux:`Linux`}[process.platform],T=e=>{let r=typeof e==`string`?e:e[be];return t(r)||n(r,{recursive:!0}),r},E=l(),xe=u(),D=T({Windows:process.env.APPDATA||o(E,`AppData`,`Roaming`),macOS:o(E,`Library`,`Application Support`),Linux:process.env.XDG_DATA_HOME||o(E,`.local`,`share`)}),O=T({Windows:process.env.APPDATA||o(E,`AppData`,`Roaming`),macOS:o(E,`Library`,`Application Support`),Linux:process.env.XDG_CONFIG_HOME||o(E,`.config`)});T({Windows:process.env.LOCALAPPDATA||o(E,`AppData`,`Local`),macOS:o(E,`Library`,`Caches`),Linux:process.env.XDG_CACHE_HOME||o(E,`.cache`)}),T({Windows:o(E,`Downloads`),macOS:o(E,`Downloads`),Linux:process.env.XDG_DOWNLOAD_DIR||o(E,`Downloads`)});const Se=T({Windows:o(D,w),macOS:o(D,w),Linux:o(D,w.toLowerCase())}),Ce=T({Windows:o(O,w),macOS:o(O,w),Linux:o(O,w.toLowerCase())}),we=T({Windows:o(O,w,`logs`),macOS:o(E,`Library`,`Logs`,w),Linux:o(O,w.toLowerCase(),`logs`)});o(xe,w.toLowerCase());const k=T(o(Se,`extensions`));T(o(k,`installed`)),T(o(k,`work`)),T(o(k,`index.json`)),o(Ce,`settings.json`);const Te=process.argv.includes(`-d`)||process.argv.includes(`--debug`)||process.env.NODE_ENV_ELECTRON_VITE===`development`||!!process.env.ELECTRON_CLI_ARGS;re({sinks:{console:oe(ie({formatter:ce({timestamp:`time`,messageColor:null,messageStyle:null,levelStyle:null,icons:!1,colors:!0,level:`FULL`,categoryWidth:0,categoryStyle:null,categoryTruncate:`end`,wordWrap:!0})}),Te?`debug`:`info`),file:se(o(we,`Azot_${new Date().toISOString().split(`.`)[0].replace(`T`,`_`).replaceAll(`-`,``).replaceAll(`:`,``)}.log`),{flushInterval:0})},loggers:[{category:[],lowestLevel:`trace`,sinks:[`console`,`file`]},{category:[`logtape`,`meta`],lowestLevel:`error`,sinks:[`console`]}]});const A=ae([]),Ee=new class e extends v{static requestEventName=`feedback`;static responseEventName=`feedback:response`;#e=Promise.resolve();async ask(t){let n=()=>new Promise(n=>{this.once(e.responseEventName,e=>{n(e)}),this.emit(e.requestEventName,t)}),r=this.#e.then(n,n);return this.#e=r.then(()=>void 0,()=>void 0),r}listen(t){this.addListener(e.requestEventName,async n=>{let r=await t(n);this.emit(e.responseEventName,r)})}},De=e=>{let t=[`}`,`{`,`%`,`>`,`<`,`^`,`;`,"`",`$`,`"`,`@`,`=`],n=e;for(let e in t)n=n.replaceAll(`/`,`_`).replaceAll(t[e],``);return n},Oe=(e,t,n)=>{let r={},i={};for(let a of n)for(let n of t){let t=new URLPattern(n,a).exec(e);t&&(Object.assign(r,t.pathname.groups),Object.assign(i,t.search.groups))}return{pathname:r,search:i}},j=(e=new Map)=>{let t=(t,n)=>{for(let r of e.keys())for(let i of e.get(r)||[]){let e=n===void 0||isNaN(n),a=t===void 0||isNaN(t),o=!1;if(o=a?r===n:(e?isNaN(r):r===n)&&i===t,o)return!0}return!1},n=(t,n)=>{let r=n||NaN,i=t||NaN;e.has(r)?e.get(r)?.add(i):e.set(r,new Set([i]))},r=()=>Array.from(e.values()).flatMap(e=>Array.from(e)),i=e.size,a=r();return{items:e,has:t,set:n,getMin:()=>Math.min(...a),getMax:()=>Math.max(...a),seasonsCount:i,episodesCount:a.length}};new Intl.DateTimeFormat(`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}),new Intl.DateTimeFormat(`en-US`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1});const M=new class e extends v{static requestEventName=`form`;static responseEventName=`form:response`;title;#e=Promise.resolve();constructor(e={}){super(),this.title=e.title,this.listen(async e=>{let t=he({input:de,output:fe}),{title:n,description:r,fields:i,...a}=e,o={};for(let[e,{label:s,type:c}]of Object.entries(i||a)){let i=c===`confirm`,a=[n,r,s].filter(Boolean).join(`. `)+(i?` (y/n)`:``)+`: `;o[e]=await Promise.race([t.question(a),d(Ae,``)])}return t.close(),o})}async ask(t){let n=()=>new Promise(n=>{this.once(e.responseEventName,e=>{n(e)}),this.emit(e.requestEventName,t)}),r=this.#e.then(n,n);return this.#e=r.then(()=>void 0,()=>void 0),r}listen(t){this.addListener(e.requestEventName,async n=>{let r=await t(n);this.emit(e.responseEventName,r)})}},ke=async(e,t)=>{let n=t?.fields??{answer:{label:e}};return await M.ask({title:t?.title,description:e,fields:n})},Ae=12e4;var N=class extends Error{response;request;options;constructor(e,t,n){let r=`${e.status||e.status===0?e.status:``} ${e.statusText??``}`.trim(),i=r?`status code ${r}`:`an unknown error`;super(`Request failed with ${i}: ${t.method} ${t.url}`),this.name=`HTTPError`,this.response=e,this.request=t,this.options=n}},je=class extends Error{name=`NonError`;value;constructor(e){let t=`Non-error value was thrown`;try{typeof e==`string`?t=e:e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`&&(t=e.message)}catch{}super(t),this.value=e}},P=class extends Error{name=`ForceRetryError`;customDelay;code;customRequest;constructor(e){let t=e?.cause?e.cause instanceof Error?e.cause:new je(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:`Forced retry`,t?{cause:t}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}};const Me=(()=>{let e=!1,t=!1,n=typeof globalThis.ReadableStream==`function`,r=typeof globalThis.Request==`function`;if(n&&r)try{t=new globalThis.Request(`https://empty.invalid`,{body:new globalThis.ReadableStream,method:`POST`,get duplex(){return e=!0,`half`}}).headers.has(`Content-Type`)}catch(e){if(e instanceof Error&&e.message===`unsupported BodyInit type`)return!1;throw e}return e&&!t})(),Ne=typeof globalThis.AbortController==`function`,Pe=typeof globalThis.AbortSignal==`function`&&typeof globalThis.AbortSignal.any==`function`,Fe=typeof globalThis.ReadableStream==`function`,Ie=typeof globalThis.FormData==`function`,Le=[`get`,`post`,`put`,`patch`,`head`,`delete`],Re={json:`application/json`,text:`text/*`,formData:`multipart/form-data`,arrayBuffer:`*/*`,blob:`*/*`,bytes:`*/*`},F=2147483647,ze=new TextEncoder().encode(`------WebKitFormBoundaryaxpyiPgbbPti10Rw`).length,Be=Symbol(`stop`);var Ve=class{options;constructor(e){this.options=e}};const He=e=>new Ve(e),Ue={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},We={next:!0},Ge={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},Ke=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[n,r]of e)t+=ze,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${n}"`).length,t+=typeof r==`string`?new TextEncoder().encode(r).length:r.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e==`string`)return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if(`byteLength`in e)return e.byteLength;if(typeof e==`object`&&e)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},I=(e,t,n)=>{let r,i=0;return e.pipeThrough(new TransformStream({transform(e,a){if(a.enqueue(e),r){i+=r.byteLength;let e=t===0?0:i/t;e>=1&&(e=1-2**-52),n?.({percent:e,totalBytes:Math.max(t,i),transferredBytes:i},r)}r=e},flush(){r&&(i+=r.byteLength,n?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},r))}}))},qe=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let n=Math.max(0,Number(e.headers.get(`content-length`))||0);return new Response(I(e.body,n,t),{status:e.status,statusText:e.statusText,headers:e.headers})},Je=(e,t,n)=>{if(!e.body)return e;let r=Ke(n??e.body);return new Request(e,{duplex:`half`,body:I(e.body,r,t)})},L=e=>typeof e==`object`&&!!e,R=(...e)=>{for(let t of e)if((!L(t)||Array.isArray(t))&&t!==void 0)throw TypeError("The `options` argument must be an object");return H({},...e)},z=(e={},t={})=>{let n=new globalThis.Headers(e),r=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[e,t]of i.entries())r&&t===`undefined`||t===void 0?n.delete(e):n.set(e,t);return n};function B(e,t,n){return Object.hasOwn(t,n)&&t[n]===void 0?[]:H(e[n]??[],t[n]??[])}const V=(e={},t={})=>({beforeRequest:B(e,t,`beforeRequest`),beforeRetry:B(e,t,`beforeRetry`),afterResponse:B(e,t,`afterResponse`),beforeError:B(e,t,`beforeError`)}),Ye=(e,t)=>{let n=new URLSearchParams;for(let r of[e,t])if(r!==void 0)if(r instanceof URLSearchParams)for(let[e,t]of r.entries())n.append(e,t);else if(Array.isArray(r))for(let e of r){if(!Array.isArray(e)||e.length!==2)throw TypeError(`Array search parameters must be provided in [[key, value], ...] format`);n.append(String(e[0]),String(e[1]))}else if(L(r))for(let[e,t]of Object.entries(r))t!==void 0&&n.append(e,String(t));else{let e=new URLSearchParams(r);for(let[t,r]of e.entries())n.append(t,r)}return n},H=(...e)=>{let t={},n={},r={},i,a=[];for(let o of e)if(Array.isArray(o))Array.isArray(t)||(t=[]),t=[...t,...o];else if(L(o)){for(let[e,n]of Object.entries(o)){if(e===`signal`&&n instanceof globalThis.AbortSignal){a.push(n);continue}if(e===`context`){if(n!=null&&(!L(n)||Array.isArray(n)))throw TypeError("The `context` option must be an object");t={...t,context:n==null?{}:{...t.context,...n}};continue}if(e===`searchParams`){i=n==null?void 0:i===void 0?n:Ye(i,n);continue}L(n)&&e in t&&(n=H(t[e],n)),t={...t,[e]:n}}L(o.hooks)&&(r=V(r,o.hooks),t.hooks=r),L(o.headers)&&(n=z(n,o.headers),t.headers=n)}return i!==void 0&&(t.searchParams=i),a.length>0&&(a.length===1?t.signal=a[0]:Pe?t.signal=AbortSignal.any(a):t.signal=a.at(-1)),t},Xe=e=>Le.includes(e)?e.toUpperCase():e,U={limit:2,methods:[`get`,`put`,`head`,`delete`,`options`,`trace`],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:1/0,backoffLimit:1/0,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},Ze=(e={})=>{if(typeof e==`number`)return{...U,limit:e};if(e.methods&&!Array.isArray(e.methods))throw Error(`retry.methods must be an array`);if(e.methods&&=e.methods.map(e=>e.toLowerCase()),e.statusCodes&&!Array.isArray(e.statusCodes))throw Error(`retry.statusCodes must be an array`);let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0));return{...U,...t}};var W=class extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name=`TimeoutError`,this.request=e}};async function Qe(e,t,n,r){return new Promise((i,a)=>{let o=setTimeout(()=>{n&&n.abort(),a(new W(e))},r.timeout);r.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function $e(e,{signal:t}){return new Promise((n,r)=>{t&&(t.throwIfAborted(),t.addEventListener(`abort`,i,{once:!0}));function i(){clearTimeout(a),r(t.reason)}let a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e)})}const et=(e,t)=>{let n={};for(let r in t)Object.hasOwn(t,r)&&!(r in Ge)&&!(r in Ue)&&(!(r in e)||r in We)&&(n[r]=t[r]);return n},tt=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e==`object`?Object.keys(e).length>0:typeof e==`string`?e.trim().length>0:!!e;function nt(e){return e instanceof N||e?.name===N.name}function rt(e){return e instanceof W||e?.name===W.name}var it=class e{static create(t,n){let r=new e(t,n),i=r.#p(async()=>{if(typeof r.#i.timeout==`number`&&r.#i.timeout>F)throw RangeError(`The \`timeout\` option cannot be greater than ${F}`);await Promise.resolve();let e=await r.#m();for(let t of r.#i.hooks.afterResponse){let n=r.#u(e.clone()),i;try{i=await t(r.request,r.#h(),n,{retryCount:r.#n})}catch(t){throw r.#f(n),r.#f(e),t}if(i instanceof Ve)throw r.#f(n),r.#f(e),new P(i.options);let a=i instanceof globalThis.Response?i:e;n!==a&&r.#f(n),e!==a&&r.#f(e),e=a}if(r.#u(e),!e.ok&&(typeof r.#i.throwHttpErrors==`function`?r.#i.throwHttpErrors(e.status):r.#i.throwHttpErrors)){let t=new N(e,r.request,r.#h());for(let e of r.#i.hooks.beforeError)t=await e(t,{retryCount:r.#n});throw t}if(r.#i.onDownloadProgress){if(typeof r.#i.onDownloadProgress!=`function`)throw TypeError("The `onDownloadProgress` option must be a function");if(!Fe)throw Error("Streams are not supported in your environment. `ReadableStream` is missing.");let t=e.clone();return r.#f(e),qe(t,r.#i.onDownloadProgress)}return e}).finally(()=>{let e=r.#a;r.#d(e?.body??void 0),r.#d(r.request.body??void 0)});for(let[e,t]of Object.entries(Re))e===`bytes`&&typeof globalThis.Response?.prototype?.bytes!=`function`||(i[e]=async()=>{r.request.headers.set(`accept`,r.request.headers.get(`accept`)||t);let a=await i;if(e===`json`){if(a.status===204)return``;let e=await a.text();return e===``?``:n.parseJson?n.parseJson(e):JSON.parse(e)}return a[e]()});return i}static#e(e){return e&&typeof e==`object`&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0)):e}request;#t;#n=0;#r;#i;#a;#o;#s;constructor(t,n={}){if(this.#r=t,this.#i={...n,headers:z(this.#r.headers,n.headers),hooks:V({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},n.hooks),method:Xe(n.method??this.#r.method??`GET`),prefixUrl:String(n.prefixUrl||``),retry:Ze(n.retry),throwHttpErrors:n.throwHttpErrors??!0,timeout:n.timeout??1e4,fetch:n.fetch??globalThis.fetch.bind(globalThis),context:n.context??{}},typeof this.#r!=`string`&&!(this.#r instanceof URL||this.#r instanceof globalThis.Request))throw TypeError("`input` must be a string, URL, or Request");if(this.#i.prefixUrl&&typeof this.#r==`string`){if(this.#r.startsWith(`/`))throw Error("`input` must not begin with a slash when using `prefixUrl`");this.#i.prefixUrl.endsWith(`/`)||(this.#i.prefixUrl+=`/`),this.#r=this.#i.prefixUrl+this.#r}Ne&&Pe&&(this.#o=this.#i.signal??this.#r.signal,this.#t=new globalThis.AbortController,this.#i.signal=this.#o?AbortSignal.any([this.#o,this.#t.signal]):this.#t.signal),Me&&(this.#i.duplex=`half`),this.#i.json!==void 0&&(this.#i.body=this.#i.stringifyJson?.(this.#i.json)??JSON.stringify(this.#i.json),this.#i.headers.set(`content-type`,this.#i.headers.get(`content-type`)??`application/json`));let r=n.headers&&new globalThis.Headers(n.headers).has(`content-type`);if(this.#r instanceof globalThis.Request&&(Ie&&this.#i.body instanceof globalThis.FormData||this.#i.body instanceof URLSearchParams)&&!r&&this.#i.headers.delete(`content-type`),this.request=new globalThis.Request(this.#r,this.#i),tt(this.#i.searchParams)){let t=`?`+(typeof this.#i.searchParams==`string`?this.#i.searchParams.replace(/^\?/,``):new URLSearchParams(e.#e(this.#i.searchParams)).toString()),n=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,t);this.request=new globalThis.Request(n,this.#i)}if(this.#i.onUploadProgress){if(typeof this.#i.onUploadProgress!=`function`)throw TypeError("The `onUploadProgress` option must be a function");if(!Me)throw Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#_(this.request,this.#i.body??void 0)}}#c(){let e=this.#i.retry.delay(this.#n),t=e;this.#i.retry.jitter===!0?t=Math.random()*e:typeof this.#i.retry.jitter==`function`&&(t=this.#i.retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e));let n=this.#i.retry.backoffLimit??1/0;return Math.min(n,t)}async#l(e){if(this.#n++,this.#n>this.#i.retry.limit)throw e;let t=e instanceof Error?e:new je(e);if(t instanceof P)return t.customDelay??this.#c();if(!this.#i.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#i.retry.shouldRetry!==void 0){let n=await this.#i.retry.shouldRetry({error:t,retryCount:this.#n});if(n===!1)throw e;if(n===!0)return this.#c()}if(rt(e)&&!this.#i.retry.retryOnTimeout)throw e;if(nt(e)){if(!this.#i.retry.statusCodes.includes(e.response.status))throw e;let t=e.response.headers.get(`Retry-After`)??e.response.headers.get(`RateLimit-Reset`)??e.response.headers.get(`X-RateLimit-Retry-After`)??e.response.headers.get(`X-RateLimit-Reset`)??e.response.headers.get(`X-Rate-Limit-Reset`);if(t&&this.#i.retry.afterStatusCodes.includes(e.response.status)){let e=Number(t)*1e3;Number.isNaN(e)?e=Date.parse(t)-Date.now():e>=Date.parse(`2024-01-01`)&&(e-=Date.now());let n=this.#i.retry.maxRetryAfter??e;return e<n?e:n}if(e.response.status===413)throw e}return this.#c()}#u(e){return this.#i.parseJson&&(e.json=async()=>this.#i.parseJson(await e.text())),e}#d(e){e&&e.cancel().catch(()=>void 0)}#f(e){this.#d(e.body??void 0)}async#p(e){try{return await e()}catch(t){let n=Math.min(await this.#l(t),F);if(this.#n<1)throw t;if(await $e(n,this.#o?{signal:this.#o}:{}),t instanceof P&&t.customRequest){let e=this.#i.signal?new globalThis.Request(t.customRequest,{signal:this.#i.signal}):new globalThis.Request(t.customRequest);this.#g(e)}for(let e of this.#i.hooks.beforeRetry){let n=await e({request:this.request,options:this.#h(),error:t,retryCount:this.#n});if(n instanceof globalThis.Request){this.#g(n);break}if(n instanceof globalThis.Response)return n;if(n===Be)return}return this.#p(e)}}async#m(){this.#t?.signal.aborted&&(this.#t=new globalThis.AbortController,this.#i.signal=this.#o?AbortSignal.any([this.#o,this.#t.signal]):this.#t.signal,this.request=new globalThis.Request(this.request,{signal:this.#i.signal}));for(let e of this.#i.hooks.beforeRequest){let t=await e(this.request,this.#h(),{retryCount:this.#n});if(t instanceof Response)return t;if(t instanceof globalThis.Request){this.#g(t);break}}let e=et(this.request,this.#i);return this.#a=this.request,this.request=this.#a.clone(),this.#i.timeout===!1?this.#i.fetch(this.#a,e):Qe(this.#a,e,this.#t,this.#i)}#h(){if(!this.#s){let{hooks:e,...t}=this.#i;this.#s=Object.freeze(t)}return this.#s}#g(e){this.#s=void 0,this.request=this.#_(e)}#_(e,t){return!this.#i.onUploadProgress||!e.body?e:Je(e,this.#i.onUploadProgress,t??this.#i.body??void 0)}};
|
|
2
|
+
/*! MIT License © Sindre Sorhus */
|
|
3
|
+
const G=e=>{let t=(t,n)=>it.create(t,R(e,n));for(let n of Le)t[n]=(t,r)=>it.create(t,R(e,r,{method:n}));return t.create=e=>G(R(e)),t.extend=t=>(typeof t==`function`&&(t=t(e??{})),G(R(e,t))),t.stop=Be,t.retry=He,t},at=G();var ot=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.stringifySetCookie=s,e.serialize=s,e.parseSetCookie=c,e.stringifySetCookie=s,e.serialize=s;let t=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,n=/^[\u0021-\u003A\u003C-\u007E]*$/,r=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,i=/^[\u0020-\u003A\u003D-\u007E]*$/,a=/^-?\d+$/,o=Object.prototype.toString;function s(e,a,o){let s=typeof e==`object`?e:{...o,name:e,value:String(a)},c=(typeof a==`object`?a:o)?.encode||encodeURIComponent;if(!t.test(s.name))throw TypeError(`argument name is invalid: ${s.name}`);let l=s.value?c(s.value):``;if(!n.test(l))throw TypeError(`argument val is invalid: ${s.value}`);let u=s.name+`=`+l;if(s.maxAge!==void 0){if(!Number.isInteger(s.maxAge))throw TypeError(`option maxAge is invalid: ${s.maxAge}`);u+=`; Max-Age=`+s.maxAge}if(s.domain){if(!r.test(s.domain))throw TypeError(`option domain is invalid: ${s.domain}`);u+=`; Domain=`+s.domain}if(s.path){if(!i.test(s.path))throw TypeError(`option path is invalid: ${s.path}`);u+=`; Path=`+s.path}if(s.expires){if(!ee(s.expires)||!Number.isFinite(s.expires.valueOf()))throw TypeError(`option expires is invalid: ${s.expires}`);u+=`; Expires=`+s.expires.toUTCString()}if(s.httpOnly&&(u+=`; HttpOnly`),s.secure&&(u+=`; Secure`),s.partitioned&&(u+=`; Partitioned`),s.priority)switch(typeof s.priority==`string`?s.priority.toLowerCase():void 0){case`low`:u+=`; Priority=Low`;break;case`medium`:u+=`; Priority=Medium`;break;case`high`:u+=`; Priority=High`;break;default:throw TypeError(`option priority is invalid: ${s.priority}`)}if(s.sameSite)switch(typeof s.sameSite==`string`?s.sameSite.toLowerCase():s.sameSite){case!0:case`strict`:u+=`; SameSite=Strict`;break;case`lax`:u+=`; SameSite=Lax`;break;case`none`:u+=`; SameSite=None`;break;default:throw TypeError(`option sameSite is invalid: ${s.sameSite}`)}return u}function c(e,t){let n=t?.decode||f,r=e.length,i=l(e,0,r),o=u(e,0,i),s=o===-1?{name:``,value:n(d(e,0,i))}:{name:d(e,0,o),value:n(d(e,o+1,i))},c=i+1;for(;c<r;){let t=l(e,c,r),n=u(e,c,t),i=n===-1?d(e,c,t):d(e,c,n),o=n===-1?void 0:d(e,n+1,t);switch(i.toLowerCase()){case`httponly`:s.httpOnly=!0;break;case`secure`:s.secure=!0;break;case`partitioned`:s.partitioned=!0;break;case`domain`:s.domain=o;break;case`path`:s.path=o;break;case`max-age`:o&&a.test(o)&&(s.maxAge=Number(o));break;case`expires`:if(!o)break;let e=new Date(o);Number.isFinite(e.valueOf())&&(s.expires=e);break;case`priority`:if(!o)break;let t=o.toLowerCase();(t===`low`||t===`medium`||t===`high`)&&(s.priority=t);break;case`samesite`:if(!o)break;let n=o.toLowerCase();(n===`lax`||n===`strict`||n===`none`)&&(s.sameSite=n);break}c=t+1}return s}function l(e,t,n){let r=e.indexOf(`;`,t);return r===-1?n:r}function u(e,t,n){let r=e.indexOf(`=`,t);return r<n?r:-1}function d(e,t,n){let r=t,i=n;do{let t=e.charCodeAt(r);if(t!==32&&t!==9)break}while(++r<i);for(;i>r;){let t=e.charCodeAt(i-1);if(t!==32&&t!==9)break;i--}return e.slice(r,i)}function f(e){if(e.indexOf(`%`)===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function ee(e){return o.call(e)===`[object Date]`}}))();const K=e=>{let t=[];for(let n of e)try{let e=(0,ot.parseSetCookie)(n),r={...e,expires:e.expires instanceof Date?e.expires.getTime():e.expires,sameSite:typeof e.sameSite==`boolean`?`strict`:e.sameSite};t.push(r)}catch(e){A.debug(e)}return t},st=async e=>{let t=await m(e,`utf8`).catch(()=>``);if(!t)return[];let n=t.split(c).flatMap(e=>e.split(`
|
|
4
|
+
`)).filter(e=>!!e.trim()&&!e.startsWith(`# `)).map(e=>e.split(` `)),r=[];for(let e of n){let[t,n,i,a,o,s,c]=e;r.push({name:s,value:c,expires:Number(o),maxAge:void 0,domain:t.replace(`#HttpOnly_`,``),path:i,secure:a===`TRUE`,httpOnly:void 0,sameSite:void 0})}return r};var ct=class{#e={};#t;#n;#r=!1;static parse(e){return K(e)}constructor({storagePath:e}={}){this.#n=e,this.#t=[]}async import(e){(await g(e).catch(()=>null))?.isFile()&&(this.#t=await st(e),await h(e,{recursive:!0,force:!0}))}async#i(){if(!(!this.#n||this.#r)){if((await g(this.#n).catch(()=>null))?.isFile()){let e=await m(this.#n,`utf8`);this.#e=e?JSON.parse(e):{},this.#t=`cookies`in this.#e?this.#e.cookies:[]}this.#r=!0}}async#a(){if(!this.#n)return;let e=JSON.stringify({...this.#e,cookies:this.#t},null,2);await _(this.#n,e,`utf8`)}async get(e){await this.#i();let t=typeof e==`string`?e:e.name;return this.#t.find(e=>e.name===t)??null}async getAll(e){if(await this.#i(),!e)return this.#t;let t=typeof e==`string`?e:e.name;return this.#t.filter(e=>e.name===t)??null}async set(e){await this.#i(),this.#t=this.#t.filter(t=>!(t.name===e.name&&t.domain===e.domain)),this.#t.push(e),await this.#a()}async delete(e){if(await this.#i(),!e)this.#t=[];else{let t=typeof e==`string`?e:e.name;this.#t=this.#t.filter(e=>e.name!==t)}await this.#a()}toString(){return this.#t.map(e=>`${e.name}=${e.value}`).join(`; `)}};const lt=at.default??at,ut=e=>e?e instanceof Headers?e.has(`User-Agent`):typeof e==`object`&&e?`User-Agent`in e||`user-agent`in e:!1:!1,dt=e=>e instanceof URL?e:e instanceof Request?new URL(e.url):new URL(e);var ft=class{cookieStore;headers;#e;#t;constructor(e={}){this.headers=new Headers,this.configure(e)}configure({maxRetries:e=3,proxyUrl:t,allowH2:n=!0,cookieStore:r}={}){this.cookieStore=r??this.cookieStore??new ct;let i=t?new ve({uri:t,allowH2:n}):new _e({allowH2:n}),a={retry:e};this.#e=lt.create({dispatcher:i,proxy:t,...a});let o=new ge({browser:`chrome`,proxyUrl:t,ignoreTlsErrors:!0,followRedirects:!0});this.#t=lt.create({fetch:o.fetch.bind(o),...a})}async fetch(e,t={}){let n=this.appendHeaders(t?.headers),r=await this.cookieStore.getAll(),i=r.filter(t=>!t.domain||dt(e).hostname.includes(t.domain));for(let e of r)i.find(t=>t.name===e.name)||e.domain||i.push(e);let a=i.map(e=>`${e.name}=${e.value}`).join(`; `);n.has(`cookie`)?n.get(`cookie`)||n.delete(`cookie`):n.set(`cookie`,a);let o=(ut(t?.headers)?this.#e:this.#t)[t?.method?.toLowerCase()??`get`],s=await o(e,{...t,headers:n}),c=s.headers.getSetCookie();return c&&await this.setCookies(c),s}async setCookies(e){let t=[];if(typeof e==`string`){let[n]=K([e]);n&&t.push(n)}else if(Array.isArray(e)&&typeof e.at(0)==`string`){let n=K(e);t.push(...n)}else Array.isArray(e)&&typeof e[0]!=`string`&&t.push(...e);if(!(!t||!t?.length))for(let e of t)await this.cookieStore.set(e)}appendHeaders(e){let t=new Headers(this.headers);for(let[n,r]of Object.entries(e??{}))t.set(n,r);return t}setHeader(e,t){this.headers.set(e,t)}removeHeader(e){this.headers.delete(e)}};new ft;const{COMMON_CONTEXT:pt}=y,mt=(e,t=`Eval`,n)=>{try{return y.createScript(t,e,n)}catch(t){return console.debug(t),console.debug(e),console.error(`Syntax Error: ${t.message}`),null}},ht=(e,t=1)=>{if(Array.isArray(e)||typeof e==`string`){let n=[];for(let r=1;r<=t;r++)n.push(e[Math.floor(Math.random()*e.length)]);return n}else return[]},gt=e=>new(`default`in b?b.default:b)(e);var _t=class{#e;constructor(e){this.#e=gt({cwd:a(e),configName:i(e,`.json`)})}get length(){return Object.keys(this.#e.store).length}clear(){this.#e.clear()}getItem(e){return this.#e.get(e)??null}key(e){return Object.keys(this.#e.store).at(e)??null}removeItem(e){this.#e.delete(e)}setItem(e,t){this.#e.set(e,t)}};const vt=new me,q=e=>{if(!e||typeof e!=`object`)return!1;let t=`name`in e?String(e.name):``;return t===`ExitPromptError`||t===`AbortPromptError`},yt=e=>e[0].toUpperCase()+e.slice(1),J=(e,t=!1)=>{if(typeof e==`boolean`)return e;if(typeof e!=`string`)return t;let n=e.trim().toLowerCase();return[`1`,`true`,`yes`,`y`,`on`].includes(n)?!0:[`0`,`false`,`no`,`n`,`off`].includes(n)?!1:t},Y=(e,t=0)=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`)return t;let n=Number(e);return Number.isFinite(n)?n:t},bt=e=>{switch(e.type){case`checkbox`:return J(e.defaultValue,!1);case`number`:return Y(e.defaultValue,0);default:return e.defaultValue??``}},xt=(e,t)=>{switch(e.type){case`checkbox`:return J(t,J(e.defaultValue,!1));case`number`:return Y(t,Y(e.defaultValue,0));default:return typeof t==`string`?t:t==null?e.defaultValue??``:String(t)}},St=e=>{let t=Object.entries(e).map(([e,t])=>[e,bt(t)]);return Object.fromEntries(t)},X=(e,t)=>{let n=Object.entries(e).map(([e,n])=>[e,xt(n,t[e])]);return Object.fromEntries(n)},Z=async e=>{e?.onAction&&await e.onAction()},Q=async(e,t)=>{if(!t.length)return`dismiss`;try{return await p({message:e,loop:!1,choices:t.map(e=>({name:e.action.title,value:e.kind}))})}catch(e){if(q(e))return`dismiss`;throw e}},$=()=>{switch(s.type()){case`Darwin`:return`macOS`;case`Windows_NT`:return`Windows`;default:return`Linux`}};Object.defineProperties(Uint8Array.prototype,{toBase64:{value:function(){return Buffer.from(this).toString(`base64`)},writable:!0,configurable:!0},toHex:{value:function(){return Buffer.from(this).toString(`hex`)},writable:!0,configurable:!0}}),Object.defineProperties(Uint8Array,{fromBase64:{value:function(e){return new Uint8Array(Buffer.from(e,`base64`))},writable:!0,configurable:!0},fromHex:{value:function(e){return new Uint8Array(Buffer.from(e,`hex`))},writable:!0,configurable:!0}});const Ct=new Map([[24,[`Sequoia`,`15`]],[23,[`Sonoma`,`14`]],[22,[`Ventura`,`13`]],[21,[`Monterey`,`12`]],[20,[`Big Sur`,`11`]],[19,[`Catalina`,`10.15`]],[18,[`Mojave`,`10.14`]],[17,[`High Sierra`,`10.13`]],[16,[`Sierra`,`10.12`]],[15,[`El Capitan`,`10.11`]],[14,[`Yosemite`,`10.10`]],[13,[`Mavericks`,`10.9`]],[12,[`Mountain Lion`,`10.8`]],[11,[`Lion`,`10.7`]],[10,[`Snow Leopard`,`10.6`]],[9,[`Leopard`,`10.5`]],[8,[`Tiger`,`10.4`]],[7,[`Panther`,`10.3`]],[6,[`Jaguar`,`10.2`]],[5,[`Puma`,`10.1`]]]),wt=()=>{let e=Number(s.release().split(`.`)[0]),[t,n]=Ct.get(e)||[`Unknown`,``];return{name:t,version:n}},Tt=()=>{switch($()){case`macOS`:return wt().version;case`Windows`:return s.release();case`Linux`:return s.release()}},Et=()=>{let e=[{brand:`Azot`,version:C.version.split(`.`).slice(0,2).join(`.`)},{brand:`Node.js`,version:process.version.replace(`v`,``).split(`.`).slice(0,1).join(`.`)}];return{mobile:!1,platform:$(),brands:e,getHighEntropyValues:async t=>{let n={mobile:!1,platform:$(),brands:e};return t.includes(`architecture`)&&(n.architecture=s.arch()),t.includes(`platform`)&&(n.platform=$()),t.includes(`platformVersion`)&&(n.platformVersion=Tt()),t.includes(`fullVersionList`)&&(n.fullVersionList=[{brand:`Azot`,version:C.version},{brand:`Node.js`,version:process.version}]),n}}},Dt=({name:e=`extension`,dir:t=process.cwd(),title:n}={})=>{let r=T(o(t,e)),i=new _t(o(r,`storage.json`)),a=new ct({storagePath:o(r,`cookies.json`)}),s=new ft({cookieStore:a}),c=(e,t,n)=>e.split(t)[1]?.split(n)[0]?.trim(),l={sanitizeString:De,execUrlPatterns:Oe,extendEpisodes:j,between:c,getRandomElements:ht},u=n?yt(n):void 0,p=e=>e||u,m=async e=>(e.title||=u,await M.ask(e)),h={defineExtension:e=>e,version:C.version,sleep:d,sanitizeString:De,execUrlPatterns:Oe,extendEpisodes:j,between:c,getRandomElements:ht,utils:l,prompt:m,input:ke,notify:async(e,t={})=>{let n=p(t.title)??`Azot`,r=[t.primaryAction?{kind:`primary`,action:t.primaryAction}:null,t.secondaryAction?{kind:`secondary`,action:t.secondaryAction}:null].filter(Boolean);{if(A.info(`[Extension notification] ${n}: ${e}`),!r.length)return;let i=await Q(e,r);i===`primary`&&await Z(t.primaryAction),i===`secondary`&&await Z(t.secondaryAction);return}let i=(await Ee.ask({variant:`notify`,title:n,message:e,style:t.style,primaryAction:t.primaryAction?{title:t.primaryAction.title,style:t.primaryAction.style}:void 0,secondaryAction:t.secondaryAction?{title:t.secondaryAction.title,style:t.secondaryAction.style}:void 0})).action??`dismiss`;i===`primary`&&await Z(t.primaryAction),i===`secondary`&&await Z(t.secondaryAction)},confirm:async(e,t={})=>{let n=p(t.title)??`Azot`,r=!!t.primaryAction||!!t.secondaryAction,i=t.primaryAction??{title:`OK`},a=t.secondaryAction??{title:`Cancel`,style:`cancel`};if(r){let t=await Q(e,[{kind:`primary`,action:i},{kind:`secondary`,action:a}]);return t===`primary`?(await Z(i),!0):(t===`secondary`&&await Z(a),!1)}try{let n=await f({message:e,default:!0});return n?await Z(t.primaryAction):await Z(t.secondaryAction),n}catch(e){if(q(e))return!1;throw e}let o=await Ee.ask({variant:`confirm`,title:n,message:e,style:t.style,primaryAction:{title:i.title,style:i.style},secondaryAction:{title:a.title,style:a.style}}),s=o.action===`primary`;return s?await Z(i):o.action===`secondary`&&await Z(a),s},ask:async(e,t)=>{let n=St(t.form),r=Object.entries(t.form),i=!!t.primaryAction||!!t.secondaryAction,a=t.primaryAction??{title:`Submit`},o=t.secondaryAction??{title:`Cancel`,style:`cancel`};{let s={};try{for(let[e,t]of r){let n=[t.title||e,t.description].filter(Boolean).join(` - `);if(t.type===`checkbox`){s[e]=await f({message:n,default:J(t.defaultValue,!1)});continue}if(t.type===`number`){let r=Y(t.defaultValue,NaN);s[e]=await te({message:n,default:Number.isFinite(r)?r:void 0,validate:e=>(e===void 0||Number.isNaN(e))&&t.required?`This field is required`:!0});continue}if(t.type===`password`){s[e]=await ne({message:n,validate:t.required?e=>String(e??``).trim()?!0:`This field is required`:void 0});continue}s[e]=await ee({message:n,default:t.defaultValue,validate:t.required?e=>String(e??``).trim()?!0:`This field is required`:void 0})}}catch(e){if(q(e))return n;throw e}if(!i)return X(t.form,s);let c=await Q(e,[{kind:`primary`,action:a},{kind:`secondary`,action:o}]);return c===`primary`?(await Z(a),X(t.form,s)):(c===`secondary`&&await Z(o),n)}let s=Object.fromEntries(r.map(([e,t])=>[e,{type:t.type,label:t.title||e,description:t.description,placeholder:t.placeholder,defaultValue:t.defaultValue,value:t.defaultValue,required:t.required,autoFocus:t.autoFocus}])),c=await m({title:p(t.title),description:e,fields:s,actions:i?{primaryAction:{title:a.title,style:a.style},secondaryAction:{title:o.title,style:o.style}}:void 0}),l=c.__action??`primary`,u={...c};return delete u.__action,l===`primary`?(await Z(t.primaryAction),X(t.form,u)):(l===`secondary`&&await Z(t.secondaryAction),n)}};class g{get cookie(){return a.toString()}}let _={fetch:s.fetch.bind(s),Response,Request,Headers,AbortController,AbortSignal,URL,URLSearchParams,URLPattern,Blob,structuredClone,btoa,atob,TextEncoder,TextDecoder,Uint8Array,crypto,console:{log:console.log,info:A.info.bind(A),warn:A.warn.bind(A),error:(...e)=>{let t=String(e[0]??`Unknown error`);vt.emit(`error`,{message:t}),A.error(t)},trace:A.trace.bind(A),debug:A.debug.bind(A)},Event,EventTarget,localStorage:i,cookieStore:a,document:new g,eval:e=>mt(e)?.exports,navigator:{appName:`Azot`,appVersion:C.version,platform:process.platform,userAgent:`Azot/${C.version}`,userAgentData:Et()}};return{http:s,question:M,common:l,Streamyx:h,Azot:h,window:_,..._}};export{Dt as t};
|
package/dist/context.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./context-BdQ_7L4n.cjs`);exports.createContext=e.t;
|
package/dist/context.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./context-vs4jQyij.mjs";export{e as createContext};
|
package/dist/main.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=Azot??Streamyx??{};e&&(!e.input&&e.prompt&&(e.input=async(t,n)=>{let r=n?.fields??{answer:{label:t}};return await e.prompt({title:n?.title,description:n?.description,fields:r})}),e.defineExtension||=e=>e);const t=e.defineExtension,n=e.version,r=e.sleep,i=e.input,a=e.prompt,o=e.notify,s=e.confirm,c=e.ask,l=e.utils;exports.ask=c,exports.confirm=s,exports.default=e,exports.defineExtension=t,exports.input=i,exports.notify=o,exports.prompt=a,exports.sleep=r,exports.utils=l,exports.version=n;
|
package/dist/main.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=Azot??Streamyx??{};e&&(!e.input&&e.prompt&&(e.input=async(t,n)=>{let r=n?.fields??{answer:{label:t}};return await e.prompt({title:n?.title,description:n?.description,fields:r})}),e.defineExtension||=e=>e);const t=e.defineExtension,n=e.version,r=e.sleep,i=e.input,a=e.prompt,o=e.notify,s=e.confirm,c=e.ask,l=e.utils;export{c as ask,s as confirm,e as default,t as defineExtension,i as input,o as notify,a as prompt,r as sleep,l as utils,n as version};
|
package/dist/vitest.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./chunk-350yNsax.cjs`);const e=require(`./context-BdQ_7L4n.cjs`);require(`./context.cjs`);let t=require(`vitest`);t.vi.mock(`azot`,()=>{let n=e.t();return Object.entries(n).forEach(([e,n])=>{t.vi.stubGlobal(e,n)}),n.Azot});
|
package/dist/vitest.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./context-vs4jQyij.mjs";import"./context.mjs";import{vi as t}from"vitest";t.mock(`azot`,()=>{let n=e();return Object.entries(n).forEach(([e,n])=>{t.stubGlobal(e,n)}),n.Azot});export{};
|
package/package.json
CHANGED
|
@@ -1,140 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azot",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "5.0.0-alpha.11",
|
|
4
|
+
"description": "Build extensions for Azot with Node.js",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"api",
|
|
7
|
+
"azot",
|
|
8
|
+
"extensions",
|
|
9
|
+
"types"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://azot.mov/docs",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"author": "Vitaly Gashkov <vitalygashkov@vk.com>",
|
|
6
14
|
"bin": {
|
|
7
|
-
"azt": "
|
|
15
|
+
"azt": "./dist/azt.cjs"
|
|
8
16
|
},
|
|
9
|
-
"types": "azot.d.ts",
|
|
10
17
|
"files": [
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
".npmrc"
|
|
18
|
+
"dist",
|
|
19
|
+
"types"
|
|
14
20
|
],
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
21
|
+
"main": "./dist/main.cjs",
|
|
22
|
+
"types": "./types/main.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./types/main.d.ts",
|
|
26
|
+
"import": "./dist/main.mjs",
|
|
27
|
+
"require": "./dist/main.cjs"
|
|
28
|
+
},
|
|
29
|
+
"./context": {
|
|
30
|
+
"types": "./types/context.d.ts",
|
|
31
|
+
"import": "./dist/context.mjs",
|
|
32
|
+
"require": "./dist/context.cjs"
|
|
33
|
+
},
|
|
34
|
+
"./vitest": {
|
|
35
|
+
"import": "./dist/vitest.mjs",
|
|
36
|
+
"require": "./dist/vitest.cjs"
|
|
37
|
+
}
|
|
20
38
|
},
|
|
21
|
-
"homepage": "https://azot.so",
|
|
22
39
|
"scripts": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"bundle:cli": "electron-vite build --config vite.cli.config.mjs",
|
|
30
|
-
"bundle": "npm run bundle:cli && electron-vite build --config vite.desktop.config.mjs",
|
|
31
|
-
"build": "npm run bundle && electron-builder build --config electron-builder.config.js",
|
|
32
|
-
"build:mac": "npm run bundle && electron-builder build --mac --config electron-builder.config.js",
|
|
33
|
-
"build:win": "npm run bundle && electron-builder build --win --config electron-builder.config.js",
|
|
34
|
-
"build:linux": "npm run bundle && electron-builder build --linux --config electron-builder.config.js",
|
|
35
|
-
"publish": "npm run bundle && electron-builder build --publish always --config electron-builder.config.js",
|
|
36
|
-
"typecheck": "npm run typecheck:node && npm run typecheck:web",
|
|
37
|
-
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false",
|
|
38
|
-
"typecheck:web": "vue-tsc --noEmit -p tsconfig.web.json --composite false",
|
|
39
|
-
"format": "prettier --write .",
|
|
40
|
-
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.vue --fix"
|
|
40
|
+
"dev": "tsdown --watch",
|
|
41
|
+
"build": "tsdown",
|
|
42
|
+
"lint": "../../node_modules/.bin/oxlint -c ../../.oxlintrc.json .",
|
|
43
|
+
"lint:fix": "../../node_modules/.bin/oxlint -c ../../.oxlintrc.json --fix .",
|
|
44
|
+
"fmt": "../../node_modules/.bin/oxfmt -c ../../.oxfmtrc.json .",
|
|
45
|
+
"fmt:check": "../../node_modules/.bin/oxfmt -c ../../.oxfmtrc.json --check ."
|
|
41
46
|
},
|
|
42
|
-
"engines": {
|
|
43
|
-
"node": "22"
|
|
44
|
-
},
|
|
45
|
-
"os": [
|
|
46
|
-
"darwin",
|
|
47
|
-
"linux",
|
|
48
|
-
"win32"
|
|
49
|
-
],
|
|
50
|
-
"funding": [
|
|
51
|
-
{
|
|
52
|
-
"type": "individual",
|
|
53
|
-
"url": "https://t.me/tribute/app?startapp=dqW2"
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
47
|
"dependencies": {
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"@logtape/pretty": "^1.0.4",
|
|
63
|
-
"@tanstack/query-core": "^5.85.5",
|
|
64
|
-
"@tribute-tg/better-auth": "^1.0.9",
|
|
65
|
-
"better-auth": "^1.3.7",
|
|
66
|
-
"bytenode": "^1.5.7",
|
|
67
|
-
"conf": "^14.0.0",
|
|
68
|
-
"cross-spawn": "^7.0.6",
|
|
69
|
-
"dasha": "3.1.8",
|
|
70
|
-
"electron-squirrel-startup": "^1.0.1",
|
|
71
|
-
"electron-updater": "^6.6.2",
|
|
72
|
-
"impit": "^0.5.4",
|
|
48
|
+
"@logtape/file": "^2.0.2",
|
|
49
|
+
"@logtape/logtape": "^2.0.2",
|
|
50
|
+
"@logtape/pretty": "^2.0.2",
|
|
51
|
+
"conf": "^15.1.0",
|
|
52
|
+
"impit": "^0.9.2",
|
|
73
53
|
"javascript-obfuscator": "^4.1.1",
|
|
74
|
-
"metavm": "^1.4.
|
|
75
|
-
"molnia": "^0.1.5",
|
|
54
|
+
"metavm": "^1.4.5",
|
|
76
55
|
"nanospinner": "^1.2.2",
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"tsdown": "^0.14.2",
|
|
81
|
-
"undici": "^7.15.0",
|
|
82
|
-
"urlpattern-polyfill": "^10.1.0",
|
|
83
|
-
"yargs": "^18.0.0",
|
|
84
|
-
"yauzl": "^3.2.0"
|
|
56
|
+
"tsdown": "^0.20.3",
|
|
57
|
+
"undici": "^7.22.0",
|
|
58
|
+
"urlpattern-polyfill": "^10.1.0"
|
|
85
59
|
},
|
|
86
60
|
"devDependencies": {
|
|
87
|
-
"@
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"@types/wicg-file-system-access": "^2023.10.5",
|
|
99
|
-
"@types/yargs": "^17.0.33",
|
|
100
|
-
"@vee-validate/zod": "^4.15.1",
|
|
101
|
-
"@vitejs/plugin-vue": "^6.0.1",
|
|
102
|
-
"@vue/eslint-config-prettier": "^10.2.0",
|
|
103
|
-
"@vue/eslint-config-typescript": "^14.5.0",
|
|
104
|
-
"@vueuse/core": "^13.7.0",
|
|
105
|
-
"class-variance-authority": "^0.7.1",
|
|
106
|
-
"clsx": "^2.1.1",
|
|
107
|
-
"dotenv": "^17.2.1",
|
|
108
|
-
"electron": "37.3.1",
|
|
109
|
-
"electron-builder": "^26.0.12",
|
|
110
|
-
"electron-vite": "^4.0.0",
|
|
111
|
-
"eslint": "^9.34.0",
|
|
112
|
-
"eslint-plugin-import": "^2.32.0",
|
|
113
|
-
"eslint-plugin-n": "^17.21.3",
|
|
114
|
-
"eslint-plugin-vue": "^10.4.0",
|
|
115
|
-
"execa": "^9.6.0",
|
|
116
|
-
"globals": "^16.3.0",
|
|
117
|
-
"lucide-vue-next": "^0.541.0",
|
|
118
|
-
"non.geist": "^1.0.4",
|
|
119
|
-
"pinia": "^3.0.3",
|
|
120
|
-
"postcss": "^8.5.6",
|
|
121
|
-
"prettier": "^3.6.2",
|
|
122
|
-
"reka-ui": "^2.4.1",
|
|
123
|
-
"sass": "^1.90.0",
|
|
124
|
-
"tailwind-merge": "^3.3.1",
|
|
125
|
-
"tailwindcss": "^4.1.12",
|
|
126
|
-
"tailwindcss-animate": "^1.0.7",
|
|
127
|
-
"tsx": "^4.20.5",
|
|
128
|
-
"typescript": "^5.9.2",
|
|
129
|
-
"vee-validate": "^4.15.1",
|
|
130
|
-
"vite": "^7.1.3",
|
|
131
|
-
"vite-plugin-static-copy": "^3.1.2",
|
|
132
|
-
"vitest": "^3.2.4",
|
|
133
|
-
"vue": "^3.5.18",
|
|
134
|
-
"vue-eslint-parser": "^10.2.0",
|
|
135
|
-
"vue-i18n": "^11.1.11",
|
|
136
|
-
"vue-sonner": "^1.3.0",
|
|
137
|
-
"vue-tsc": "^3.0.6",
|
|
138
|
-
"zod": "^3.25.42"
|
|
139
|
-
}
|
|
61
|
+
"@types/node": "^25.3.0",
|
|
62
|
+
"dasha": "^3.1.9",
|
|
63
|
+
"typescript": "^5.9.3"
|
|
64
|
+
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"vitest": ">=4.0.0"
|
|
67
|
+
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": ">=22"
|
|
70
|
+
},
|
|
71
|
+
"readmeFilename": "README.md"
|
|
140
72
|
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import type { VideoCodec, DynamicRange, AudioCodec } from 'dasha';
|
|
2
|
+
|
|
3
|
+
export interface ExtensionConfig {
|
|
4
|
+
id: string;
|
|
5
|
+
version: string;
|
|
6
|
+
name: string;
|
|
7
|
+
tag?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface Extension {
|
|
12
|
+
/**
|
|
13
|
+
* Can handle URL or URL pattern
|
|
14
|
+
*/
|
|
15
|
+
canHandle?: ((url: string) => boolean | Promise<boolean>) | string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Performs initialization of extension (e.g. token refresh)
|
|
19
|
+
*/
|
|
20
|
+
init?(): void | Promise<void>;
|
|
21
|
+
|
|
22
|
+
isAuthenticated?(): Promise<boolean>;
|
|
23
|
+
login?(credentials: { username?: string; password?: string; otp?: string }): Promise<void>;
|
|
24
|
+
logout?(): Promise<void>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Fetches content metadata from URL
|
|
28
|
+
*/
|
|
29
|
+
fetchContentMetadata: (url: string, options: Options) => Promise<ContentMetadata[]>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Fetches data about content source (e.g. manifest URL, external subtitles, etc.)
|
|
33
|
+
*/
|
|
34
|
+
fetchContentSource?: (contentId: string, options: Options) => Promise<ContentSource | null>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Fetches just content DRM config (e.g. license server URL, request headers, etc.)
|
|
38
|
+
*/
|
|
39
|
+
fetchContentDrm?: (payload: any, options: Options) => Promise<DrmConfig>;
|
|
40
|
+
|
|
41
|
+
onDownloadFinished?(): Promise<void>;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Extension name (e.g. Netflix, Prime Video, Apple TV+, etc.)
|
|
45
|
+
* @deprecated Use `config.title` field in package.json
|
|
46
|
+
*/
|
|
47
|
+
name?: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Short tag which will be used in filename (e.g. NF, AMZN, ATVP, etc.)
|
|
51
|
+
* @deprecated Use `config.tag` field in package.json
|
|
52
|
+
*/
|
|
53
|
+
tag?: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Logo icon URL
|
|
57
|
+
* @deprecated Use `config.icon` field in package.json
|
|
58
|
+
*/
|
|
59
|
+
icon?: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Substring pattern to match URL host handled by this plugin
|
|
63
|
+
* @deprecated
|
|
64
|
+
*/
|
|
65
|
+
match?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type Options = {
|
|
69
|
+
videoQuality?: string;
|
|
70
|
+
videoCodecs?: VideoCodec[];
|
|
71
|
+
videoRange?: DynamicRange;
|
|
72
|
+
videoBitrate?: number;
|
|
73
|
+
videoDimension?: '2D' | '3D';
|
|
74
|
+
|
|
75
|
+
audioCodecs?: AudioCodec[];
|
|
76
|
+
audioChannels?: number;
|
|
77
|
+
audioBitrate?: number;
|
|
78
|
+
|
|
79
|
+
subtitleFormat?: string;
|
|
80
|
+
subtitleLanguages?: string[];
|
|
81
|
+
|
|
82
|
+
languages?: string[];
|
|
83
|
+
|
|
84
|
+
skipVideo?: boolean;
|
|
85
|
+
skipAudio?: boolean;
|
|
86
|
+
skipSubtitles?: boolean;
|
|
87
|
+
skipMux?: boolean;
|
|
88
|
+
|
|
89
|
+
select?: boolean;
|
|
90
|
+
|
|
91
|
+
episodes?: Map<number, Set<number>>;
|
|
92
|
+
retry?: number;
|
|
93
|
+
connections?: number;
|
|
94
|
+
proxy?: string | null;
|
|
95
|
+
proxyMeta?: string | null;
|
|
96
|
+
proxyMedia?: string | null;
|
|
97
|
+
|
|
98
|
+
movieTemplate?: string;
|
|
99
|
+
episodeTemplate?: string;
|
|
100
|
+
hardsub?: boolean;
|
|
101
|
+
trimBegin?: string;
|
|
102
|
+
trimEnd?: string;
|
|
103
|
+
|
|
104
|
+
pssh?: string;
|
|
105
|
+
drmTemplate?: string;
|
|
106
|
+
header?: Record<string, string>;
|
|
107
|
+
|
|
108
|
+
http2?: boolean;
|
|
109
|
+
keys?: { kid: string; key: string }[];
|
|
110
|
+
debug?: boolean;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export interface MediaInfo {
|
|
114
|
+
id: string;
|
|
115
|
+
type?: 'movie' | 'tv';
|
|
116
|
+
title?: string;
|
|
117
|
+
description?: string;
|
|
118
|
+
thumbnailUrl?: string;
|
|
119
|
+
author?: string;
|
|
120
|
+
year?: number;
|
|
121
|
+
|
|
122
|
+
season?: number;
|
|
123
|
+
episode?: number;
|
|
124
|
+
episodeTitle?: string;
|
|
125
|
+
|
|
126
|
+
sources: (MediaSource | string)[];
|
|
127
|
+
|
|
128
|
+
[key: string]: any;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface MediaSource {
|
|
132
|
+
url: string;
|
|
133
|
+
|
|
134
|
+
headers?: Record<string, string>;
|
|
135
|
+
drm?: string | MediaDrm | MediaDrm[];
|
|
136
|
+
type?: 'progressive' | 'direct' | 'hls' | 'dash';
|
|
137
|
+
|
|
138
|
+
language?: string;
|
|
139
|
+
size?: number;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface MediaDrm {
|
|
143
|
+
type?: 'widevine' | 'playready';
|
|
144
|
+
server: string;
|
|
145
|
+
|
|
146
|
+
headers?: Record<string, string>;
|
|
147
|
+
|
|
148
|
+
transformRequest?(request: Request): Request;
|
|
149
|
+
transformResponse?(response: Response): Response;
|
|
150
|
+
|
|
151
|
+
fetchCertificate?(message: Uint8Array, sessionId: string): Promise<Uint8Array>;
|
|
152
|
+
fetchLicense?(message: Uint8Array, sessionId: string): Promise<Uint8Array>;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export { Options };
|
|
156
|
+
|
|
157
|
+
export interface CommonContentMetadata {
|
|
158
|
+
tag?: string;
|
|
159
|
+
/**
|
|
160
|
+
* Required if no `fetchContentSource` method is provided
|
|
161
|
+
*/
|
|
162
|
+
source?: ContentSource;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface MovieMetadata extends CommonContentMetadata {
|
|
166
|
+
id?: string;
|
|
167
|
+
title?: string;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface EpisodeMetadata extends CommonContentMetadata {
|
|
171
|
+
id?: string;
|
|
172
|
+
title?: string;
|
|
173
|
+
episodeNumber: number;
|
|
174
|
+
seasonNumber?: number;
|
|
175
|
+
episodeTitle?: string;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export type ContentMetadata = MovieMetadata | EpisodeMetadata;
|
|
179
|
+
|
|
180
|
+
export type ContentSource = {
|
|
181
|
+
/**
|
|
182
|
+
* URL of the content: manifest URL / playlist URL / direct link to media file
|
|
183
|
+
*/
|
|
184
|
+
url: string;
|
|
185
|
+
headers?: Record<string, string>;
|
|
186
|
+
http2?: boolean;
|
|
187
|
+
type?: 'video' | 'audio' | 'subtitle' | 'any';
|
|
188
|
+
audioLanguage?: string;
|
|
189
|
+
audioType?: string;
|
|
190
|
+
subtitles?: any[];
|
|
191
|
+
drm?: DrmConfig;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export type DrmConfig =
|
|
195
|
+
| {
|
|
196
|
+
server: string;
|
|
197
|
+
headers?: Record<string, string>;
|
|
198
|
+
params?: object;
|
|
199
|
+
template?: string;
|
|
200
|
+
http2?: boolean;
|
|
201
|
+
}
|
|
202
|
+
| { payload: any }
|
|
203
|
+
| { keys: { kid: string; key: string }[] };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export type AlertStyle = 'default' | 'destructive';
|
|
2
|
+
|
|
3
|
+
export type ActionOptions = {
|
|
4
|
+
title: string;
|
|
5
|
+
style?: 'default' | 'destructive' | 'cancel';
|
|
6
|
+
onAction: () => void | Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export async function notify(
|
|
10
|
+
message: string,
|
|
11
|
+
options?: {
|
|
12
|
+
title?: string;
|
|
13
|
+
style?: AlertStyle;
|
|
14
|
+
primaryAction?: ActionOptions;
|
|
15
|
+
secondaryAction?: ActionOptions;
|
|
16
|
+
},
|
|
17
|
+
): Promise<void>;
|
|
18
|
+
|
|
19
|
+
export async function confirm(
|
|
20
|
+
message: string,
|
|
21
|
+
options?: {
|
|
22
|
+
title?: string;
|
|
23
|
+
style?: AlertStyle;
|
|
24
|
+
primaryAction?: ActionOptions;
|
|
25
|
+
secondaryAction?: ActionOptions;
|
|
26
|
+
},
|
|
27
|
+
): Promise<boolean>;
|
|
28
|
+
|
|
29
|
+
export type AskFieldType = 'text' | 'password' | 'number' | 'checkbox';
|
|
30
|
+
|
|
31
|
+
export type AskField = {
|
|
32
|
+
type: AskFieldType;
|
|
33
|
+
title?: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
defaultValue?: string;
|
|
37
|
+
required?: boolean;
|
|
38
|
+
autoFocus?: boolean;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type AskForm = Record<string, AskField>;
|
|
42
|
+
|
|
43
|
+
export type AskFieldValue<T extends AskField> = T['type'] extends 'checkbox'
|
|
44
|
+
? boolean
|
|
45
|
+
: T['type'] extends 'number'
|
|
46
|
+
? number
|
|
47
|
+
: string;
|
|
48
|
+
|
|
49
|
+
export type AskResult<TForm extends AskForm> = {
|
|
50
|
+
[K in keyof TForm]: AskFieldValue<TForm[K]>;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export async function ask<TForm extends AskForm>(
|
|
54
|
+
message: string,
|
|
55
|
+
options: {
|
|
56
|
+
title?: string;
|
|
57
|
+
style?: AlertStyle;
|
|
58
|
+
primaryAction?: ActionOptions;
|
|
59
|
+
secondaryAction?: ActionOptions;
|
|
60
|
+
form: TForm;
|
|
61
|
+
},
|
|
62
|
+
): Promise<AskResult<TForm>>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { Extension } from './
|
|
2
|
-
|
|
1
|
+
import { Extension } from './extension';
|
|
2
|
+
|
|
3
|
+
export * from './extension';
|
|
4
|
+
export * from './feedback';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Simple wrapper to support type checking
|
|
@@ -36,11 +38,6 @@ export const utils: {
|
|
|
36
38
|
getRandomElements: (array: unknown, count?: number) => unknown[];
|
|
37
39
|
};
|
|
38
40
|
|
|
39
|
-
export function input<T extends string = 'answer'>(
|
|
40
|
-
message: string,
|
|
41
|
-
options?: DialogOptions<T>,
|
|
42
|
-
): Promise<Record<T, string>>;
|
|
43
|
-
|
|
44
41
|
declare global {
|
|
45
42
|
/**
|
|
46
43
|
*
|
|
@@ -51,12 +48,6 @@ declare global {
|
|
|
51
48
|
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Window/cookieStore) */
|
|
52
49
|
const cookieStore: CookieStore;
|
|
53
50
|
|
|
54
|
-
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Window/prompt) */
|
|
55
|
-
function prompt(message?: string, _default?: string): string | null;
|
|
56
|
-
|
|
57
|
-
/** [MDN Reference](https://developer.mozilla.org/ru/docs/Web/API/Window/alert) */
|
|
58
|
-
function alert(message?: any): void;
|
|
59
|
-
|
|
60
51
|
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch) */
|
|
61
52
|
function fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
62
53
|
|
|
@@ -139,9 +130,3 @@ declare global {
|
|
|
139
130
|
fromHex(hexString: string): Uint8Array;
|
|
140
131
|
}
|
|
141
132
|
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Create a new context for extension script
|
|
145
|
-
* Only for testing purposes
|
|
146
|
-
*/
|
|
147
|
-
export function createContext(options?: { name?: string; dir?: string }): Record<string, any>;
|
package/out/azt.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const e=require(`./chunk-nOFOJqeH.js`),t=e.__toESM(require(`node:path`)),n=e.__toESM(require(`node:fs`)),r=e.__toESM(require(`node:util`)),i=e.__toESM(require(`tsdown`)),a=e.__toESM(require(`node:crypto`)),o=e.__toESM(require(`javascript-obfuscator`)),s=Buffer.from(`STX`,`utf8`),c=(e,t,r)=>{let i=(0,a.randomBytes)(32),o=(0,a.randomBytes)(16),c=(0,n.readFileSync)(t),l=(0,a.createCipheriv)(`aes-256-cbc`,i,o),u=Buffer.concat([l.update(c),l.final()]),d=(0,a.publicEncrypt)(e,i),f=Buffer.concat([s,o,d,u]);return r&&(0,n.writeFileSync)(r,f),{aesIv:o,encryptedAesKey:d,encryptedCode:u}},l=(e,t,r)=>{let i=(0,n.readFileSync)(t),o=s.byteLength,c=i.subarray(0,o);if(!c.equals(s))throw Error(`Incorrect file format`);let l=o,u=l+16,d=u+512,f=i.subarray(l,u),p=i.subarray(u,d),m=i.subarray(d),h=(0,a.privateDecrypt)(e,p),g=(0,a.createDecipheriv)(`aes-256-cbc`,h,f),_=Buffer.concat([g.update(m),g.final()]),v=_.toString(`utf8`);return r&&(0,n.writeFileSync)(r,v),v},u=(e,t)=>{let r=(0,n.readFileSync)(e,`utf8`);console.log(`Obfuscating...`),console.time(`Obfuscation complete in`);let i=o.default.obfuscate(r,{target:`node`,compact:!0,controlFlowFlattening:!0,controlFlowFlatteningThreshold:1,deadCodeInjection:!0,debugProtection:!0,identifierNamesGenerator:`hexadecimal`,numbersToExpressions:!0,selfDefending:!0,simplify:!0,splitStrings:!0,splitStringsChunkLength:5,stringArray:!0,stringArrayCallsTransform:!0,stringArrayCallsTransformThreshold:1,stringArrayEncoding:[`base64`],stringArrayIndexShift:!0,stringArrayRotate:!0,stringArrayShuffle:!0,stringArrayWrappersCount:2,stringArrayWrappersChainedCalls:!0,stringArrayWrappersType:`function`,stringArrayThreshold:1,transformObjectKeys:!0,unicodeEscapeSequence:!1});console.timeEnd(`Obfuscation complete in`);let a=i.getObfuscatedCode();return(0,n.writeFileSync)(t||e,a),a},d=(0,r.parseArgs)({allowPositionals:!0,allowNegative:!0,options:{input:{type:`string`,short:`i`,description:`Path to the input file`},key:{type:`string`,short:`k`,description:`Path to the key file (public for encrypt, private for decrypt)`},output:{type:`string`,short:`o`,description:`Path to the output file`},format:{type:`string`,short:`f`,description:`Output format`},watch:{type:`boolean`,description:`Watch file changes`},minify:{type:`boolean`,description:`Minify output`},obfuscate:{type:`boolean`,description:`Obfuscate output`},encrypt:{type:`boolean`,description:`Encrypt extension source code (.js will be packed inside .stx)`},decrypt:{type:`boolean`,description:`Decrypt encrypted extension`}}}),f=()=>{let e=[process.cwd(),t.default.join(process.cwd(),`src`),t.default.join(process.cwd(),`lib`)];for(let r of e){let e=(0,n.readdirSync)(r),i=e.filter(e=>!e.endsWith(`.d.ts`)).filter(e=>new Set([`.ts`,`.js`]).has(t.default.extname(e))),a=e=>t.default.basename(e,t.default.extname(e)),o=i.find(e=>a(e)===`index`)||i.find(e=>a(e)===`main`)||i[0];if(o)return t.default.join(r,o)}};(async()=>{let[e,...r]=d.positionals,a=d.values.input||r[0]||f();if(!a)throw Error(`No entry file found`);if(e===`build`||e===`pack`){let r=typeof d.values.minify==`boolean`?d.values.minify:!0;await(0,i.build)({entry:a,format:d.values.format??`cjs`,platform:`node`,target:`node22`,watch:d.values.watch,minify:r}),d.values.input=t.default.join(process.cwd(),`dist`,t.default.basename(a).replace(/\.ts$/,`.js`));let o=require(t.default.join(process.cwd(),`package.json`)),s=typeof d.values.obfuscate==`boolean`,l=s?d.values.obfuscate:o.private;l&&u(d.values.input,d.values.input);let f=d.values.encrypt||e===`pack`;if(f){let e=(0,n.readFileSync)(d.values.key||t.default.join(__dirname,`../public.pem`),`utf8`),r=d.values.output||d.values.input.replace(/\.js$/,`-${o.version}.stx`);c(e,d.values.input,r),(0,n.rmSync)(d.values.input)}}else if(e===`decrypt`){let e=(0,n.readFileSync)(d.values.key||t.default.join(__dirname,`../private.pem`),`utf8`),r=d.values.output||a.replace(/\.stx$/,`.js`);l(e,a,r),d.values.input&&(0,n.rmSync)(d.values.input)}else if(e===`dev`||e===`develop`||!e){let e=typeof d.values.minify==`boolean`?d.values.minify:!1;await(0,i.build)({entry:a,format:d.values.format??`cjs`,platform:`node`,target:`node20`,watch:!0,minify:e})}})();
|
package/out/chunk-nOFOJqeH.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));Object.defineProperty(exports,`__toESM`,{enumerable:!0,get:function(){return s}});
|
package/out/main.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const e=require(`./chunk-nOFOJqeH.js`),t=e.__toESM(require(`node:os`)),n=e.__toESM(require(`node:path`)),r=e.__toESM(require(`node:timers/promises`)),i=e.__toESM(require(`node:fs/promises`)),a=e.__toESM(require(`@logtape/logtape`)),o=e.__toESM(require(`@logtape/file`)),s=e.__toESM(require(`@logtape/pretty`)),c=e.__toESM(require(`node:fs`)),l=e.__toESM(require(`node:process`));require(`urlpattern-polyfill`);const u=e.__toESM(require(`node:events`)),d=e.__toESM(require(`node:readline/promises`)),f=e.__toESM(require(`node:url`)),p=e.__toESM(require(`undici`)),m=e.__toESM(require(`impit`)),h=e.__toESM(require(`metavm`));require(`picocolors`),require(`nanospinner`);const g=e.__toESM(require(`conf`));var _=`azot`,v=`Azot`,ee=`5.0.0-alpha.1`,y=`out/main.js`,b={azt:`out/azt.js`},x=`azot.d.ts`,S=[`out`,`azot.d.ts`,`.npmrc`],C=`Vitaly Gashkov <vitalygashkov@vk.com>`,w=`A powerful, extensible app for downloading videos`,te={type:`git`,url:`https://github.com/azot-labs/azot.git`},ne=`https://azot.so`,re={start:`tsx --env-file .env ./src/main/cli.ts`,preview:`electron-vite preview --config vite.desktop.config.mjs`,dev:`electron-vite dev --config vite.desktop.config.mjs --watch`,test:`vitest`,coverage:`vitest run --coverage`,"bundle:lib":`tsdown`,"bundle:cli":`electron-vite build --config vite.cli.config.mjs`,bundle:`npm run bundle:cli && electron-vite build --config vite.desktop.config.mjs`,build:`npm run bundle && electron-builder build --config electron-builder.config.js`,"build:mac":`npm run bundle && electron-builder build --mac --config electron-builder.config.js`,"build:win":`npm run bundle && electron-builder build --win --config electron-builder.config.js`,"build:linux":`npm run bundle && electron-builder build --linux --config electron-builder.config.js`,publish:`npm run bundle && electron-builder build --publish always --config electron-builder.config.js`,typecheck:`npm run typecheck:node && npm run typecheck:web`,"typecheck:node":`tsc --noEmit -p tsconfig.node.json --composite false`,"typecheck:web":`vue-tsc --noEmit -p tsconfig.web.json --composite false`,format:`prettier --write .`,lint:`eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.vue --fix`},ie={node:`22`},ae=[`darwin`,`linux`,`win32`],oe=[{type:`individual`,url:`https://t.me/tribute/app?startapp=dqW2`}],se={"@electron-toolkit/preload":`^3.0.2`,"@electron-toolkit/utils":`^4.0.0`,"@inquirer/prompts":`^7.8.3`,"@logtape/file":`^1.0.4`,"@logtape/logtape":`^1.0.4`,"@logtape/pretty":`^1.0.4`,"@tanstack/query-core":`^5.85.5`,"@tribute-tg/better-auth":`^1.0.9`,"better-auth":`^1.3.7`,bytenode:`^1.5.7`,conf:`^14.0.0`,"cross-spawn":`^7.0.6`,dasha:`3.1.8`,"electron-squirrel-startup":`^1.0.1`,"electron-updater":`^6.6.2`,impit:`^0.5.4`,"javascript-obfuscator":`^4.1.1`,metavm:`^1.4.4`,molnia:`^0.1.5`,nanospinner:`^1.2.2`,okova:`^0.9.3`,"p-queue":`^8.1.0`,picocolors:`^1.1.1`,tsdown:`^0.14.2`,undici:`^7.15.0`,"urlpattern-polyfill":`^10.1.0`,yargs:`^18.0.0`,yauzl:`^3.2.0`},ce={"@electron-toolkit/eslint-config":`^2.1.0`,"@electron-toolkit/eslint-config-prettier":`^3.0.0`,"@electron-toolkit/eslint-config-ts":`^3.1.0`,"@electron-toolkit/tsconfig":`^1.0.1`,"@eslint/js":`^9.26.0`,"@iconify/vue":`^4.3.0`,"@intlify/unplugin-vue-i18n":`^6.0.8`,"@rushstack/eslint-patch":`^1.10.5`,"@tailwindcss/vite":`^4.1.12`,"@tanstack/vue-query":`^5.85.5`,"@types/node":`^24.3.0`,"@types/wicg-file-system-access":`^2023.10.5`,"@types/yargs":`^17.0.33`,"@vee-validate/zod":`^4.15.1`,"@vitejs/plugin-vue":`^6.0.1`,"@vue/eslint-config-prettier":`^10.2.0`,"@vue/eslint-config-typescript":`^14.5.0`,"@vueuse/core":`^13.7.0`,"class-variance-authority":`^0.7.1`,clsx:`^2.1.1`,dotenv:`^17.2.1`,electron:`37.3.1`,"electron-builder":`^26.0.12`,"electron-vite":`^4.0.0`,eslint:`^9.34.0`,"eslint-plugin-import":`^2.32.0`,"eslint-plugin-n":`^17.21.3`,"eslint-plugin-vue":`^10.4.0`,execa:`^9.6.0`,globals:`^16.3.0`,"lucide-vue-next":`^0.541.0`,"non.geist":`^1.0.4`,pinia:`^3.0.3`,postcss:`^8.5.6`,prettier:`^3.6.2`,"reka-ui":`^2.4.1`,sass:`^1.90.0`,"tailwind-merge":`^3.3.1`,tailwindcss:`^4.1.12`,"tailwindcss-animate":`^1.0.7`,tsx:`^4.20.5`,typescript:`^5.9.2`,"vee-validate":`^4.15.1`,vite:`^7.1.3`,"vite-plugin-static-copy":`^3.1.2`,vitest:`^3.2.4`,vue:`^3.5.18`,"vue-eslint-parser":`^10.2.0`,"vue-i18n":`^11.1.11`,"vue-sonner":`^1.3.0`,"vue-tsc":`^3.0.6`,zod:`^3.25.42`},T={name:_,productName:v,version:ee,main:y,bin:b,types:x,files:S,author:C,description:w,repository:te,homepage:ne,scripts:re,engines:ie,os:ae,funding:oe,dependencies:se,devDependencies:ce};const le=`pkg`in process&&process.pkg!==void 0,E=!!process.versions.electron&&!1,D=!E,ue=`v${T.version} ${l.platform}-${l.arch} node-${l.version}`,de=`v${T.version}`,fe=T.name,O=T.productName,k={darwin:`macOS`,win32:`Windows`,linux:`Linux`},A=k[process.platform],j=e=>{let t=typeof e==`string`?e:e[A];return(0,c.existsSync)(t)||(0,c.mkdirSync)(t,{recursive:!0}),t},M=(0,t.homedir)(),N=(0,t.tmpdir)(),P=j({Windows:process.env.APPDATA||(0,n.join)(M,`AppData`,`Roaming`),macOS:(0,n.join)(M,`Library`,`Application Support`),Linux:process.env.XDG_DATA_HOME||(0,n.join)(M,`.local`,`share`)}),F=j({Windows:process.env.APPDATA||(0,n.join)(M,`AppData`,`Roaming`),macOS:(0,n.join)(M,`Library`,`Application Support`),Linux:process.env.XDG_CONFIG_HOME||(0,n.join)(M,`.config`)}),pe=j({Windows:process.env.LOCALAPPDATA||(0,n.join)(M,`AppData`,`Local`),macOS:(0,n.join)(M,`Library`,`Caches`),Linux:process.env.XDG_CACHE_HOME||(0,n.join)(M,`.cache`)}),me=j({Windows:(0,n.join)(M,`Downloads`),macOS:(0,n.join)(M,`Downloads`),Linux:process.env.XDG_DOWNLOAD_DIR||(0,n.join)(M,`Downloads`)}),I=j({Windows:(0,n.join)(P,O),macOS:(0,n.join)(P,O),Linux:(0,n.join)(P,O.toLowerCase())}),L=j({Windows:(0,n.join)(F,O),macOS:(0,n.join)(F,O),Linux:(0,n.join)(F,O.toLowerCase())}),R=j({Windows:(0,n.join)(F,O,`logs`),macOS:(0,n.join)(M,`Library`,`Logs`,O),Linux:(0,n.join)(F,O.toLowerCase(),`logs`)}),he=(0,n.join)(N,O.toLowerCase()),z=j((0,n.join)(I,`extensions`)),ge=j((0,n.join)(z,`installed`)),_e=j((0,n.join)(z,`work`)),ve=(0,n.join)(L,`settings.json`),B=process.argv.includes(`-d`)||process.argv.includes(`--debug`)||process.env.NODE_ENV_ELECTRON_VITE===`development`||!!process.env.ELECTRON_CLI_ARGS,V=()=>{let e=new Date().toISOString().split(`.`)[0].replace(`T`,`_`).replaceAll(`-`,``).replaceAll(`:`,``);return`Azot_${e}.log`},H=()=>(0,n.join)(R,V()),ye=(0,s.getPrettyFormatter)({timestamp:`time`,levelStyle:null,icons:!1,colors:!0,level:`FULL`,categoryWidth:0,categoryStyle:null,categoryTruncate:`end`,wordWrap:!0});(0,a.configureSync)({sinks:{console:(0,a.withFilter)((0,a.getConsoleSink)({formatter:ye}),B?`debug`:`info`),file:(0,o.getFileSink)(H(),{flushInterval:0})},loggers:[{category:[],lowestLevel:`trace`,sinks:[`console`,`file`]},{category:[`logtape`,`meta`],lowestLevel:`error`,sinks:[`console`]}]});const U=(0,a.getLogger)([]),W=e=>{let t=[`}`,`{`,`%`,`>`,`<`,`^`,`;`,"`",`$`,`"`,`@`,`=`],n=e;for(let e in t)n=n.replaceAll(`/`,`_`).replaceAll(t[e],``);return n},G=(e,t,n)=>{let r={},i={};for(let a of n)for(let n of t){let t=new URLPattern(n,a),o=t.exec(e);o&&(Object.assign(r,o.pathname.groups),Object.assign(i,o.search.groups))}return{pathname:r,search:i}},K=(e=new Map)=>{let t=(t,n)=>{for(let r of e.keys())for(let i of e.get(r)||[]){let e=n===void 0||isNaN(n),a=t===void 0||isNaN(t),o=!1;if(o=a?r===n:(e?isNaN(r):r===n)&&i===t,o)return!0}return!1},n=(t,n)=>{let r=n||NaN,i=t||NaN;e.has(r)?e.get(r)?.add(i):e.set(r,new Set([i]))},r=()=>Array.from(e.values()).flatMap(e=>Array.from(e)),i=e.size,a=r(),o=a.length,s=()=>Math.min(...a),c=()=>Math.max(...a);return{items:e,has:t,set:n,getMin:s,getMax:c,seasonsCount:i,episodesCount:o}},be=new Intl.DateTimeFormat(`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}),xe=new Intl.DateTimeFormat(`en-US`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1});var Se=class e extends u.EventEmitter{static{this.requestEventName=`form`}static{this.responseEventName=`form:response`}constructor(){super(),D&&this.listen(async e=>{let t=(0,d.createInterface)({input:l.stdin,output:l.stdout}),{title:n,description:i,fields:a,...o}=e,s={};for(let[e,{label:c,type:l}]of Object.entries(a||o)){let a=l===`confirm`,o=[n,i,c].filter(Boolean).join(`. `)+(a?` (y/n)`:``)+`: `,u=await Promise.race([t.question(o),(0,r.setTimeout)(we,``)]);s[e]=u}return t.close(),s})}async ask(t){let n=new Promise(n=>{this.emit(e.requestEventName,t),this.addListener(e.responseEventName,e=>{n(e)})});return n}listen(t){this.addListener(e.requestEventName,async n=>{let r=await t(n);this.emit(e.responseEventName,r)})}};const q=new Se,Ce=async(e,t)=>{let n=t?.fields??{answer:{label:e}},r=await q.ask({title:t?.title,description:e,fields:n});return r},we=12e4,Te=(e,t)=>{(0,c.writeSync)(1,e||``);let n=Buffer.alloc(1),r=``;for(;;){try{(0,c.readSync)(0,n,0,1,null)}catch(e){if(e.code===`EOF`)break;throw e}let e=n.toString(`utf-8`);if(e===`
|
|
2
|
-
`||e===`\r`){if(e===`\r`)try{(0,c.readSync)(0,n,0,1,null),n.toString(`utf-8`)}catch(e){if(e.code===`EOF`)break;throw e}break}r+=e}return r.trim()||t},Ee=e=>{let t=e.expires instanceof Date?e.expires.getTime():e.expires,n;return e.sameSite===`Strict`?n=`strict`:e.sameSite===`Lax`&&(n=`lax`),{name:e.name,value:e.value,expires:t,domain:e.domain,path:e.path,sameSite:n,partitioned:!1,maxAge:e.maxAge,secure:e.secure,httpOnly:e.httpOnly,unparsed:e.unparsed}},J=e=>{let t=[];for(let n of e)try{let e=(0,p.parseCookie)(n);e&&t.push(Ee(e))}catch(e){U.debug(e)}return t},De=async e=>{let n=await(0,i.readFile)(e,`utf8`).catch(()=>``);if(!n)return[];let r=n.split(t.EOL).flatMap(e=>e.split(`
|
|
3
|
-
`)),a=r.filter(e=>!!e.trim()&&!e.startsWith(`# `)),o=a.map(e=>e.split(` `)),s=[];for(let e of o){let[t,n,r,i,a,o,c]=e;s.push({name:o,value:c,expires:Number(a),maxAge:void 0,domain:t.replace(`#HttpOnly_`,``),path:r,secure:i===`TRUE`,httpOnly:void 0,sameSite:void 0,unparsed:e})}return s};var Y=class{#data={};#cookies;#storagePath;#hasBeenRead=!1;static parse(e){return J(e)}constructor({storagePath:e}={}){this.#storagePath=e,this.#cookies=[]}async import(e){let t=await(0,i.stat)(e).catch(()=>null);t?.isFile()&&(this.#cookies=await De(e),await(0,i.rm)(e,{recursive:!0,force:!0}))}async#read(){if(!this.#storagePath||this.#hasBeenRead)return;let e=await(0,i.stat)(this.#storagePath).catch(()=>null);if(e?.isFile()){let e=await(0,i.readFile)(this.#storagePath,`utf8`);this.#data=e?JSON.parse(e):{},this.#cookies=`cookies`in this.#data?this.#data.cookies:[]}this.#hasBeenRead=!0}async#write(){if(!this.#storagePath)return;let e=JSON.stringify({...this.#data,cookies:this.#cookies},null,2);await(0,i.writeFile)(this.#storagePath,e,`utf8`)}async get(e){await this.#read();let t=typeof e==`string`?e:e.name;return this.#cookies.find(e=>e.name===t)??null}async getAll(e){if(await this.#read(),!e)return this.#cookies;let t=typeof e==`string`?e:e.name;return this.#cookies.filter(e=>e.name===t)??null}async set(e){await this.#read(),this.#cookies=this.#cookies.filter(t=>!(t.name===e.name&&t.domain===e.domain)),this.#cookies.push(e),await this.#write()}async delete(e){if(await this.#read(),!e)this.#cookies=[];else{let t=typeof e==`string`?e:e.name;this.#cookies=this.#cookies.filter(e=>e.name!==t)}}toString(){return this.#cookies.map(e=>`${e.name}=${e.value}`).join(`; `)}},X=class{#impit;#agent;#retryThreshold;#retryDelayMs;#failures=new Map;constructor(e={}){this.headers=new Headers,this.#retryThreshold=3,this.#retryDelayMs=1500,this.configure(e)}configure({proxyUrl:e,allowH2:t=!0,maxRedirections:n=3,maxRetries:r=3,cookieStore:i}={}){this.cookieStore=i??this.cookieStore??new Y,this.#impit=new m.Impit({browser:`chrome`,ignoreTlsErrors:!0,proxyUrl:e,followRedirects:!0,maxRedirects:n});let{redirect:a,retry:o}=p.interceptors;e?this.#agent=new p.ProxyAgent({uri:e,allowH2:t}).compose(a({maxRedirections:n}),o({maxRetries:r})):this.#agent=new p.Agent({allowH2:t}).compose(a({maxRedirections:n}),o({maxRetries:r}))}get retries(){return this.#retryThreshold}async fetch(e,t={}){let n=t.headers&&(t.headers instanceof Headers?t.headers.has(`User-Agent`):`User-Agent`in t.headers),r=this.appendHeaders(t?.headers||{}),i=await this.cookieStore.getAll(),a=i.filter(t=>!t.domain||new f.URL(e).hostname.includes(t.domain));for(let e of i){let t=a.find(t=>t.name===e.name);if(t)continue;e.domain||a.push(e)}let o=a.map(e=>`${e.name}=${e.value}`).join(`; `);r.has(`cookie`)?r.get(`cookie`)||r.delete(`cookie`):r.set(`cookie`,o);let s={...t,body:t?.body,headers:r};t&&(t.headers=r);let c=await(n?(0,p.fetch)(e,{...s,dispatcher:this.#agent}):this.withRetry(this.#impit.fetch.bind(this.#impit),e,s)),l=c.headers.getSetCookie();return l&&await this.setCookies(l),c}async withRetry(e,t,n){try{let r=await e(t,n),i=r.status>=300&&r.status<=399,a=r.status>=200&&r.status<=299||i;return!a&&this.#hasAttempts(t)?(await this.#nextRetry(t),U.debug(await r.text()),U.debug(String(r.status)),this.withRetry(e,t,n)):r}catch(r){let i=r;if(U.debug(i.stack),U.debug({input:t,init:{method:n?.method,headers:n?.headers,body:`...`}}),!this.#hasAttempts(t))throw r;return await this.#nextRetry(t),this.withRetry(e,t,n)}}async setCookies(e){let t=[];if(typeof e==`string`){let[n]=J([e]);n&&t.push(n)}else if(Array.isArray(e)&&typeof e.at(0)==`string`){let n=J(e);t.push(...n)}else Array.isArray(e)&&typeof e[0]!=`string`&&t.push(...e);if(!(!t||!t?.length))for(let e of t)await this.cookieStore.set(e)}appendHeaders(e){let t=new Headers(this.headers);for(let[n,r]of Object.entries(e))t.set(n,r);return t}#hasAttempts(e){return this.#getFailuresCount(e)<=this.#retryThreshold}#getFailuresCount(e){return this.#failures.get(e)||1}#addFailure(e){this.#failures.set(e,this.#getFailuresCount(e)+1)}async#nextRetry(e){let t=this.#getFailuresCount(e);t&&await new Promise(e=>setTimeout(e,this.#retryDelayMs)),this.#addFailure(e),U.debug(`Retry ${t}/${this.#retryThreshold}: ${String(e)}`)}setHeader(e,t){this.headers.set(e,t)}removeHeader(e){this.headers.delete(e)}setRetryCount(e){e>1&&(this.#retryThreshold=e)}};const Oe=new X,{COMMON_CONTEXT:ke}=h.default,Ae=(e,t=`Eval`)=>{try{let n=h.default.createScript(t,e);return n}catch(e){return console.error(`Syntax Error: ${e.message}`),null}},Z=(e,t=1)=>{if(Array.isArray(e)||typeof e==`string`){let n=[];for(let r=1;r<=t;r++)n.push(e[Math.floor(Math.random()*e.length)]);return n}else return[]},je=e=>{let t=`default`in g.default?g.default.default:g.default;return new t(e)};var Me=class{#store;constructor({storagePath:e}){this.#store=je({cwd:(0,n.dirname)(e),configName:(0,n.basename)(e,`.json`)})}get length(){return Object.keys(this.#store.store).length}clear(){this.#store.clear()}getItem(e){return this.#store.get(e)??null}key(e){return Object.keys(this.#store.store).at(e)??null}removeItem(e){this.#store.delete(e)}setItem(e,t){this.#store.set(e,t)}};const Q=()=>{switch(t.default.type()){case`Darwin`:return`macOS`;case`Windows_NT`:return`Windows`;default:return`Linux`}};Object.defineProperties(Uint8Array.prototype,{toBase64:{value:function(){return Buffer.from(this).toString(`base64`)},writable:!0,configurable:!0},toHex:{value:function(){return Buffer.from(this).toString(`hex`)},writable:!0,configurable:!0}}),Object.defineProperties(Uint8Array,{fromBase64:{value:function(e){return new Uint8Array(Buffer.from(e,`base64`))},writable:!0,configurable:!0},fromHex:{value:function(e){return new Uint8Array(Buffer.from(e,`hex`))},writable:!0,configurable:!0}});const Ne=new Map([[24,[`Sequoia`,`15`]],[23,[`Sonoma`,`14`]],[22,[`Ventura`,`13`]],[21,[`Monterey`,`12`]],[20,[`Big Sur`,`11`]],[19,[`Catalina`,`10.15`]],[18,[`Mojave`,`10.14`]],[17,[`High Sierra`,`10.13`]],[16,[`Sierra`,`10.12`]],[15,[`El Capitan`,`10.11`]],[14,[`Yosemite`,`10.10`]],[13,[`Mavericks`,`10.9`]],[12,[`Mountain Lion`,`10.8`]],[11,[`Lion`,`10.7`]],[10,[`Snow Leopard`,`10.6`]],[9,[`Leopard`,`10.5`]],[8,[`Tiger`,`10.4`]],[7,[`Panther`,`10.3`]],[6,[`Jaguar`,`10.2`]],[5,[`Puma`,`10.1`]]]),Pe=()=>{let e=Number(t.default.release().split(`.`)[0]),[n,r]=Ne.get(e)||[`Unknown`,``];return{name:n,version:r}},Fe=()=>{switch(Q()){case`macOS`:return Pe().version;case`Windows`:return t.default.release();case`Linux`:return t.default.release()}},Ie=()=>{let e=[{brand:`Azot`,version:T.version.split(`.`).slice(0,2).join(`.`)},{brand:`Node.js`,version:process.version.replace(`v`,``).split(`.`).slice(0,1).join(`.`)}];return{mobile:!1,platform:Q(),brands:e,getHighEntropyValues:async n=>{let r={mobile:!1,platform:Q(),brands:e};return n.includes(`architecture`)&&(r.architecture=t.default.arch()),n.includes(`platform`)&&(r.platform=Q()),n.includes(`platformVersion`)&&(r.platformVersion=Fe()),n.includes(`fullVersionList`)&&(r.fullVersionList=[{brand:`Azot`,version:T.version},{brand:`Node.js`,version:process.version}]),r}}},$=({name:e=`extension`,dir:t=process.cwd()}={})=>{let i=j((0,n.join)(t,e)),a=new Me({storagePath:(0,n.join)(i,`storage.json`)}),o=new Y({storagePath:(0,n.join)(i,`cookies.json`)}),s=new X({cookieStore:o}),c=(e,t,n)=>e.split(t)[1]?.split(n)[0]?.trim(),l={sanitizeString:W,execUrlPatterns:G,extendEpisodes:K,between:c,getRandomElements:Z},u={version:T.version,input:Ce,sleep:r.setTimeout,sanitizeString:W,execUrlPatterns:G,extendEpisodes:K,between:c,getRandomElements:Z,utils:l,prompt:q.ask.bind(q)};class d{get cookie(){return o.toString()}}let f={fetch:s.fetch.bind(s),Response,Request,Headers,AbortController,AbortSignal,URL,URLSearchParams,URLPattern,Blob,structuredClone,btoa,atob,TextEncoder,TextDecoder,Uint8Array,crypto,console:U,prompt:Te,alert:e=>{U.warn(e)},Event,EventTarget,localStorage:a,cookieStore:o,document:new d,eval:e=>Ae(e)?.exports,navigator:{appName:`Azot`,appVersion:T.version,platform:process.platform,userAgentData:Ie()}},p={http:s,question:q,common:l,Streamyx:u,Azot:u,window:f,...f};return p};exports.createContext=$;
|