(()=>{var e,t,i=i||{};e=jQuery,(t=i).selectors={apiKey:".tec-tickets__admin-etp-app-settings-generate-api-key",apiKeyMsg:".tribe-generate-qr-api-key-msg",apiKeyInput:'[name="tickets-plus-qr-options-api-key"]',qrCodeImage:"#connection_qr_code",refreshWarning:"#tec-tickets__admin-etp-app-settings-confirmation-text"},t.init=function(){t.init_generate()},t.init_generate=function(){t.$generate_key=e(t.selectors.apiKey),this.$generate_key.on("click",(function(i){i.preventDefault(),confirm(e(t.selectors.refreshWarning).text())&&t.qr_ajax()}))},t.qr_ajax=function(){t.$generate_key_msg=e(t.selectors.apiKeyMsg),t.$generate_key_input=e(t.selectors.apiKeyInput),t.$qr_code_img=e(t.selectors.qrCodeImage);const i={action:"tribe_tickets_plus_generate_api_key",confirm:tribe_qr.generate_qr_nonce};t.$generate_key.prop("disabled",!0),t.$qr_code_img.css("opacity",.1),t.$generate_key_input.val("--------"),e.post(ajaxurl,i,(function(e){e.success?(t.$generate_key_msg.html('<p class="optin-success">'+e.data.msg+"</p>"),t.$generate_key_input.val(e.data.key),t.$qr_code_img.attr("src",e.data.qr_src)):t.$generate_key_msg.html('<p class="optin-fail">'+e.data+"</p>"),t.$generate_key.prop("disabled",!1),t.$qr_code_img.css("opacity",1)}))},e(t.init),window.ticketsPlus=window.ticketsPlus||{},window.ticketsPlus.qr={}})();