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GAExB,MAAM,EAAsB,uBAAuB,qBAAqB,OAAO,EAAqB,GAAW,EAAW,GAC1H,GAA2B,MAAvB,EAA6B,CAC7B,MAAM,EAAc,UAAU,QAAQ,+BAA+B,GAC/D,EAAa,IAAI,YAAY,sBAAsB,KACzD,EAAW,QAAQ,EAAc,SACjC,EAAW,WAAW,YAAY,UAAU,OAAO,UAAW,IAC9D,EAAgB,QAAQ,EAE5B,KAGJ,MAAM,EAAgB,sBAAsB,oBAAoB,OAAO,EAAW,YAC5E,EAAc,IAAI,YAAY,sBAAsB,KAC1D,EAAY,QAAQ,YACpB,EAAY,WAAW,GACvB,EAAgB,QAAQ,GAExB,MAAM,EAAgB,sBAAsB,oBAAoB,OAAO,EAAW,aAC5E,EAAe,IAAI,YAAY,sBAAsB,KAC3D,EAAa,QAAQ,cACrB,EAAa,WAAW,GACxB,EAAgB,QAAQ,GAExB,MAAM,EAAoB,sBAAsB,oBAAoB,OAAO,EAAY,aACjF,EAAmB,IAAI,YAAY,sBAAsB,KAC/D,EAAiB,QAAQ,iBACzB,EAAiB,WAAW,GAC5B,EAAgB,QAAQ,GACxB,QAAQ,OAAO,MAAM,OAAO,KAAK,EAAgB,mBACrD,CACA,MAAO,GACH,QAAQ,MAAM,wBAA0B,EAAI,MAAQ,MACpD,QAAQ,KAAK,EACjB","file":"/npm/@zakhenry/grpc_tools_node_protoc_ts@5.3.4/build/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@zakhenry/grpc_tools_node_protoc_ts@5.3.4/build/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\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * This is the ProtoC compiler plugin.\n *\n * It only accepts stdin/stdout output according to the protocol\n * specified in [plugin.proto](https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/plugin.proto).\n */\nconst ExportMap_1 = require(\"./lib/ExportMap\");\nconst Utility_1 = require(\"./lib/Utility\");\nconst plugin_pb_1 = require(\"google-protobuf/google/protobuf/compiler/plugin_pb\");\nconst ProtoMsgTsdFormatter_1 = require(\"./lib/format/ProtoMsgTsdFormatter\");\nconst ProtoSvcTsdFormatter_1 = require(\"./lib/format/ProtoSvcTsdFormatter\");\nconst TplEngine_1 = require(\"./lib/TplEngine\");\nconst ProtoIndexFormatter_1 = require(\"./lib/format/ProtoIndexFormatter\");\nUtility_1.Utility.withAllStdIn((inputBuff) => {\n    try {\n        const typedInputBuff = new Uint8Array(inputBuff.length);\n        typedInputBuff.set(inputBuff);\n        const codeGenRequest = plugin_pb_1.CodeGeneratorRequest.deserializeBinary(typedInputBuff);\n        const codeGenResponse = new plugin_pb_1.CodeGeneratorResponse();\n        const exportMap = new ExportMap_1.ExportMap();\n        const fileNameToDescriptor = {};\n        codeGenResponse.setSupportedFeatures(plugin_pb_1.CodeGeneratorResponse.Feature.FEATURE_PROTO3_OPTIONAL);\n        const isGrpcJs = [\"generate_package_definition\", \"grpc_js\"].indexOf(codeGenRequest.getParameter()) !== -1;\n        codeGenRequest.getProtoFileList().forEach((protoFileDescriptor) => {\n            fileNameToDescriptor[protoFileDescriptor.getName()] = protoFileDescriptor;\n            exportMap.addFileDescriptor(protoFileDescriptor);\n        });\n        const filesList = [];\n        const interfaces = [];\n        codeGenRequest.getFileToGenerateList().forEach((fileName) => {\n            // message part\n            const msgFileName = Utility_1.Utility.filePathFromProtoWithoutExt(fileName);\n            filesList.push(msgFileName);\n            const msgTsdFile = new plugin_pb_1.CodeGeneratorResponse.File();\n            msgTsdFile.setName(msgFileName + \".d.ts\");\n            const msgModel = ProtoMsgTsdFormatter_1.ProtoMsgTsdFormatter.format(fileNameToDescriptor[fileName], exportMap);\n            msgTsdFile.setContent(TplEngine_1.TplEngine.render(\"msg_tsd\", msgModel));\n            codeGenResponse.addFile(msgTsdFile);\n            const msgInterfaceFile = new plugin_pb_1.CodeGeneratorResponse.File();\n            msgInterfaceFile.setName(msgFileName + \".interface.ts\");\n            interfaces.push(msgFileName + \".interface\");\n            const msgInterfaceModel = ProtoMsgTsdFormatter_1.ProtoMsgTsdFormatter.format(fileNameToDescriptor[fileName], exportMap, true);\n            msgInterfaceFile.setContent(TplEngine_1.TplEngine.render(\"msg_tsd\", msgInterfaceModel));\n            codeGenResponse.addFile(msgInterfaceFile);\n            // service part\n            const fileDescriptorModel = ProtoSvcTsdFormatter_1.ProtoSvcTsdFormatter.format(fileNameToDescriptor[fileName], exportMap, isGrpcJs);\n            if (fileDescriptorModel != null) {\n                const svcFileName = Utility_1.Utility.svcFilePathFromProtoWithoutExt(fileName);\n                const svtTsdFile = new plugin_pb_1.CodeGeneratorResponse.File();\n                svtTsdFile.setName(svcFileName + \".d.ts\");\n                svtTsdFile.setContent(TplEngine_1.TplEngine.render(\"svc_tsd\", fileDescriptorModel));\n                codeGenResponse.addFile(svtTsdFile);\n                // fileList.push(msgFileName);\n            }\n        });\n        // message js index\n        const indexJsOutput = ProtoIndexFormatter_1.ProtoIndexFormatter.format(filesList, \"index_js\");\n        const indexJsFile = new plugin_pb_1.CodeGeneratorResponse.File();\n        indexJsFile.setName(\"index.js\");\n        indexJsFile.setContent(indexJsOutput);\n        codeGenResponse.addFile(indexJsFile);\n        // message ts index\n        const indexTsOutput = ProtoIndexFormatter_1.ProtoIndexFormatter.format(filesList, \"index_tsd\");\n        const indexTsdFile = new plugin_pb_1.CodeGeneratorResponse.File();\n        indexTsdFile.setName(\"index.d.ts\");\n        indexTsdFile.setContent(indexTsOutput);\n        codeGenResponse.addFile(indexTsdFile);\n        // interface index\n        const interfaceTsOutput = ProtoIndexFormatter_1.ProtoIndexFormatter.format(interfaces, \"index_tsd\");\n        const interfaceTsdFile = new plugin_pb_1.CodeGeneratorResponse.File();\n        interfaceTsdFile.setName(\"interfaces.ts\");\n        interfaceTsdFile.setContent(interfaceTsOutput);\n        codeGenResponse.addFile(interfaceTsdFile);\n        process.stdout.write(Buffer.from(codeGenResponse.serializeBinary()));\n    }\n    catch (err) {\n        console.error(\"protoc-gen-ts error: \" + err.stack + \"\\n\");\n        process.exit(1);\n    }\n});\n"]}