"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useKafkaProperties=void 0;var a=require("react"),b=require("react-i18next"),c=require("./../contexts/ApiHandler/index.js"),d=e(require("./../code-snippets/KafkaSnippets/JavaKafkaCodeSnippet.js"));function e(a){return a&&a.__esModule?a:{default:a}}function f(a,b){return k(a)||j(a,b)||h(a,b)||g()}function g(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(a,b){if(a){if("string"==typeof a)return i(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?i(a,b):void 0}}function i(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function j(a,b){var c=null==a?null:"undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=c){var d,e,f=[],g=!0,h=!1;try{for(c=c.call(a);!(g=(d=c.next()).done)&&(f.push(d.value),!(b&&f.length===b));g=!0);}catch(a){h=!0,e=a}finally{try{g||null==c["return"]||c["return"]()}finally{if(h)throw e}}return f}}function k(a){if(Array.isArray(a))return a}var l={keyDeserializer:"key.deserializer",valueDeserializer:"value.deserializer",bootstrapServers:"bootstrap.servers",clientId:"client.id",saslMechanism:"sasl.mechanism",securityProtocol:"security.protocol"},m=function(e){var g=(0,a.useState)([]),h=f(g,2),i=h[0],j=h[1],k=(0,b.useTranslation)(),m=k.t,n=(0,c.useApi)(),o=n.apiHandler,p=(0,a.useMemo)(function(){return new d["default"](o,e,{},m)},[o,e,m]),q=(0,a.useCallback)(function(a){switch(a){case l.keyDeserializer:return{key:a,value:p.getKeyDeserializer().deserializerClass};case l.valueDeserializer:return{key:a,value:p.getSchemaInformation().deserializerClass};case l.bootstrapServers:return{key:a,value:p.getBootstrapServers()};case l.clientId:return{key:a,value:p.getOperationBindings().clientId};case l.saslMechanism:return{key:a,value:p.getSecurityDetails().saslMechanism};case l.securityProtocol:return{key:a,value:p.getSecurityDetails().securityProtocol};default:}},[p]);return(0,a.useEffect)(function(){var a=Object.values(l).map(function(a){return q(a)}).filter(function(a){return!!a.value});j(a)},[e,q]),i};exports.useKafkaProperties=m;