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AAK,MAAO,CACR,MAAM,EAAM,EAAiB,MACjB,OAAR,GACA,QAAQ,KAAK,GAEjB,QAAQ,IAAI,GACZ,KACJ,CACA,IAAK,OACD,EAAiB,OACjB,MACJ,UAAK,EACD,OACA,MACJ,QACI,QAAQ,MAAM,oBAAoB,KAClC,OACA,QAAQ,KAAK,GAEzB,CACA,SAAS,OACL,QAAQ,IAAI,yCACZ,QAAQ,IAAI,IACZ,QAAQ,IAAI,aACZ,QAAQ,IAAI,oDACZ,QAAQ,IAAI,sDACZ,QAAQ,IAAI,kDACZ,QAAQ,IAAI,iDACZ,QAAQ,IAAI,oDACZ,QAAQ,IAAI,kEACZ,QAAQ,IAAI,kDACZ,QAAQ,IAAI,IACZ,QAAQ,IAAI,mBACZ,QAAQ,IAAI,gBACZ,QAAQ,IAAI,mBACZ,QAAQ,IAAI,IACZ,QAAQ,IAAI,oBACZ,QAAQ,IAAI,uBACZ,QAAQ,IAAI,WACZ,QAAQ,IAAI,GAChB,CACA,OAAO,OAAM,GAAO,QAAQ,MAAM","file":"/npm/mb-service@0.7.0/bin/mb-service.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/mb-service@0.7.0/bin/mb-service.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","#!/usr/bin/env node\nimport { readFileSync } from 'node:fs';\nimport { platform } from 'node:os';\nimport { parseArgs } from 'node:util';\nimport { LinuxPlatform } from './linux.js';\nimport { MacPlatform } from './mac.js';\nimport { PlatformCommands } from './platform.js';\nasync function main() {\n    const args = parseArgs({\n        args: process.argv.slice(2),\n        options: {\n            help: { type: 'boolean', short: 'h' },\n            version: { type: 'boolean', short: 'v' },\n            frontend: { type: 'string' },\n            ssl: { type: 'boolean' }\n        },\n        strict: false,\n        allowPositionals: true\n    });\n    if (args.values.help) {\n        help();\n        process.exit(0);\n    }\n    if (args.values.version) {\n        const packageJson = readFileSync(new URL('../package.json', import.meta.url), 'utf8');\n        const packageInfo = JSON.parse(packageJson);\n        console.log(packageInfo.version);\n        process.exit(0);\n    }\n    let platformCommands;\n    switch (platform()) {\n        case 'linux':\n            platformCommands = new LinuxPlatform();\n            break;\n        case 'darwin':\n            platformCommands = new MacPlatform();\n            break;\n        default:\n            console.error('Platform not supported:', platform());\n            process.exit(2);\n    }\n    const installArgs = ['-service'];\n    if (args.values.frontend) {\n        if (typeof args.values.frontend === 'string' && /^\\d+$/.test(args.values.frontend)) {\n            installArgs.push('-frontend', args.values.frontend);\n        }\n        else {\n            console.error(`Specify a valid number in --frontend <port>`);\n            help();\n            process.exit(1);\n        }\n    }\n    if (args.values.ssl) {\n        installArgs.push('-ssl');\n    }\n    const command = args.positionals[0];\n    switch (command) {\n        case 'install':\n            platformCommands.install(installArgs);\n            break;\n        case 'uninstall':\n            platformCommands.uninstall();\n            break;\n        case 'start':\n            platformCommands.start();\n            break;\n        case 'stop':\n            platformCommands.stop();\n            break;\n        case 'restart':\n            platformCommands.stop();\n            setTimeout(() => {\n                platformCommands.start();\n            }, 2000);\n            break;\n        case 'pid': {\n            const pid = platformCommands.pid();\n            if (pid === null) {\n                process.exit(1);\n            }\n            console.log(pid);\n            break;\n        }\n        case 'tail':\n            platformCommands.tail();\n            break;\n        case undefined:\n            help();\n            break;\n        default:\n            console.error(`Unknown command: ${command}`);\n            help();\n            process.exit(1);\n    }\n}\nfunction help() {\n    console.log('Usage: mb-service <command> [options]');\n    console.log('');\n    console.log('Commands:');\n    console.log('  install       Install the Matterbridge service');\n    console.log('  uninstall     Uninstall the Matterbridge service');\n    console.log('  start         Start the Matterbridge service');\n    console.log('  stop          Stop the Matterbridge service');\n    console.log('  restart       Restart the Matterbridge service');\n    console.log('  pid           Get the process id of the Matterbridge service');\n    console.log('  tail          Tail the Matterbridge log file');\n    console.log('');\n    console.log('Global Options:');\n    console.log('  -h, --help');\n    console.log('  -v, --version');\n    console.log('');\n    console.log('Install Options:');\n    console.log('  --frontend <port>');\n    console.log('  --ssl');\n    console.log('');\n}\nmain().catch(err => console.error(err));\n"]}