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M,OAAQ,GAAQ,YACnC,MAAM,EAAgB,OAAO,OAAO,CAAE,SAAU,KAAM,SAAS,EAAM,YAAY,EAAO,WAAW,EAAM,eAAe,EAAO,WAAW,EAAM,eAAe,EAAO,iBAAiB,EAAO,UAAW,EAAG,QAAS,GAAK,GAC1N,IAAK,EAAc,MACf,MAAM,IAAI,MAAM,0BAEpB,IAAK,EAAc,YAAc,EAAc,OAC3C,MAAM,IAAI,MAAM,+BAEpB,OAAO,aAAa,EACxB,GACJ,CACA,GAAI,QAAQ,OAAS,OAAQ,CAQzB,WAPe,QAAQ,KAAK,MAAM,GAAG,QAAO,CAAC,EAAK,KAC9C,GAAI,EAAI,WAAW,MAAO,CACtB,MAAO,EAAK,GAAS,EAAI,MAAM,GAAG,MAAM,KACxC,EAAI,IAAO,IAAS,MAAM,OAAO,IAAU,EAAQ,OAAO,GAC9D,CACA,OAAO,CAAG,GACX,CAAC,IAEC,KAAK,QAAQ,KACb,OAAM,IACP,QAAQ,MAAM,wBAAyB,GACvC,QAAQ,KAAK,EAAE,GAEvB","file":"/npm/@kutalia/whisper-node-addon@1.1.0/dist/js/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@kutalia/whisper-node-addon@1.1.0/dist/js/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n    return new (P || (P = Promise))(function (resolve, reject) {\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\n    });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.transcribe = transcribe;\nconst os_1 = require(\"os\");\nconst path_1 = require(\"path\");\nconst util_1 = require(\"util\");\nconst PLATFORM_MAPPING = {\n    darwin: 'darwin',\n    win32: 'win32',\n    linux: 'linux'\n};\nfunction loadAddon() {\n    const currentPlatform = PLATFORM_MAPPING[(0, os_1.platform)()];\n    const currentArch = (0, os_1.arch)();\n    if (!currentPlatform) {\n        throw new Error(`Unsupported platform: ${(0, os_1.platform)()}`);\n    }\n    const addonPath = (0, path_1.join)((0, path_1.resolve)(__dirname), '..', `${currentPlatform}-${currentArch}`, 'whisper.node');\n    try {\n        const { whisper } = require(addonPath);\n        return (0, util_1.promisify)(whisper);\n    }\n    catch (error) {\n        throw new Error(`Failed to load native addon: ${error}`);\n    }\n}\nconst whisperAsync = loadAddon();\nfunction transcribe(options) {\n    return __awaiter(this, void 0, void 0, function* () {\n        const defaultParams = Object.assign({ language: 'en', use_gpu: true, flash_attn: false, no_prints: true, comma_in_time: false, translate: true, no_timestamps: false, detect_language: false, audio_ctx: 0, max_len: 0 }, options);\n        if (!defaultParams.model) {\n            throw new Error('Model path is required');\n        }\n        if (!defaultParams.fname_inp && !defaultParams.pcmf32) {\n            throw new Error('Input file path is required');\n        }\n        return whisperAsync(defaultParams);\n    });\n}\nif (require.main === module) {\n    const params = process.argv.slice(2).reduce((acc, arg) => {\n        if (arg.startsWith('--')) {\n            const [key, value] = arg.slice(2).split('=');\n            acc[key] = value ? (isNaN(Number(value)) ? value : Number(value)) : true;\n        }\n        return acc;\n    }, {});\n    transcribe(params)\n        .then(console.log)\n        .catch(err => {\n        console.error('Transcription failed:', err);\n        process.exit(1);\n    });\n}\n"]}