(()=>{var e,a;e=jQuery,a=null,window.setWooOrder=function(e){a=e},e(document).on("iframebeforeready",(function(){})),e(document).on("iframeready",(function(){})),e(document).on("iframeformjsready",(function(){null!=a&&("53"==a.shipping_method&&(a.woo_order_address.country="UA"),e("#epakaFormIframe")[0].contentWindow.iframeSession=a.api_session,null!=a.dimensions&&(e("#epakaFormIframe").contents().find("#ZamowieniePaczka0Waga").val(a.dimensions.weight),e("#epakaFormIframe").contents().find("#ZamowieniePaczka0Dlugosc").val(a.dimensions.length),e("#epakaFormIframe").contents().find("#ZamowieniePaczka0Szerokosc").val(a.dimensions.width),e("#epakaFormIframe").contents().find("#ZamowieniePaczka0Wysokosc").val(a.dimensions.height)),e("#epakaFormIframe").contents().find("#ZamowienieOdbiorcaImie").val(a.woo_order_address.first_name),e("#epakaFormIframe").contents().find("#ZamowienieOdbiorcaNazwisko").val(a.woo_order_address.last_name),e("#epakaFormIframe").contents().find("#ZamowienieOdbiorcaKod").val(a.woo_order_address.postcode),e("#epakaFormIframe").contents().find("#ZamowienieOdbiorcaMiasto").val(a.woo_order_address.city),e("#epakaFormIframe").contents().find("#ZamowienieOdbiorcaUlica").val(a.woo_order_address.street),e("#epakaFormIframe").contents().find("#ZamowienieOdbiorcaNrdomu").val(a.woo_order_address.house_number),e("#epakaFormIframe").contents().find("#ZamowienieOdbiorcaNrlokalu").val(a.woo_order_address.flat_number),e("#epakaFormIframe").contents().find("#ZamowienieOdbiorcaTelefon").val(a.woo_order_billing_address.phone),e("#epakaFormIframe").contents().find("#ZamowienieOdbiorcaEmail").val(a.woo_order_billing_address.email),e("#epakaFormIframe").contents().find("#ZamowienieZawartosc").val(a.content),"PL"!=a.woo_order_address.country&&(e("#epakaFormIframe").contents().find("#ZamowienieOdbiorcaKraj")[0].selectize.setValue(a.woo_order_address.country),e("#epakaFormIframe").contents().find("#wysylamzagranice").prop("checked",!0)),e("#epakaFormIframe").contents().find("#ZamowienieKurierId"+a.shipping_method).click(),e("#epakaFormIframe")[0].contentWindow.countPrices((function(){e("#epakaFormIframe")[0].contentWindow.preference_flag=1,e("#epakaFormIframe")[0].contentWindow.inputsHoudini(e("#epakaFormIframe")[0].contentWindow.selected_courier,!1),""!=a.epaka_point&&""!=a.epaka_point_description&&(e("#epakaFormIframe").contents().find("#ZamowienieOdbiorcaPaczkomat").val(a.epaka_point),e("#epakaFormIframe").contents().find("#ZamowienieOdbiorcaPaczkomatOpis").val(a.epaka_point_description)),setTimeout((function(){e("#epakaFormIframe")[0].contentWindow.preference_flag=0}),1e3),e("#epakaFormIframe")[0].contentWindow.getDatesAndServices(e("#epakaFormIframe")[0].contentWindow.selected_courier,void 0,e("#epakaFormIframe")[0].contentWindow.extras)})),e("#epakaFormIframe")[0].contentWindow.document.getElementById("ZamowienieZlozForm").onsubmit=function(o){o.preventDefault();var n=e("#epakaFormIframe").contents().find("#ZamowienieZlozForm").serializeArray();n.push({name:"data[WooCommerceData][id]",value:a.woo_order_id}),e.post(epaka_admin_object.api_endpoint+"/send-order?token="+epaka_admin_object.admin_token,n,(function(e){window.location.reload()})).fail((function(){alert("Nie udało się złożyć zamówienia")}))},""!=a.epaka_point&&""!=a.epaka_point_description&&(e("#epakaFormIframe").contents().find("#ZamowienieOdbiorcaPaczkomat").val(a.epaka_point),e("#epakaFormIframe").contents().find("#ZamowienieOdbiorcaPaczkomatOpis").val(a.epaka_point_description))),e("#epakaFormIframe")[0].contentWindow.document.getElementById("submit-button").onclick=function(){var a=setInterval((function(){if(e("#epakaFormIframe")[0].contentWindow.submitPopup){clearTimeout(a);var o=e("#epaka-iframe-order-header").offset();e("html, body").animate({scrollTop:o.top-100},250)}}),250)}}))})();