jQuery(document).ready(function(e){if("undefined"==typeof fiksef_MetaboxFieldManagerData)return void console.error("Brak danych: fiksef_MetaboxFieldManagerData nie zostało zdefiniowane.");const t=fiksef_MetaboxFieldManagerData,n=e(".products_container"),a={specialRates:[{id:t.zwRate,container:e("#ksef_defaults_exemption").closest(".form-field")},{id:t.npRate,container:e("#ksef_defaults_np_vat_rate_type").closest(".form-field")}],zeroRate:{container:e("#ksef_zero_rate_mapping").closest(".form-field"),exceptionIds:[t.zwRate,t.npRate]}};function o(){const t=new Set;let n=!1;const o=a.zeroRate.exceptionIds.map(String);e(".products_container .vat_type").each(function(){const a=e(this).val();if(!a)return;const[i,s]=a.split("|");t.add(i);const c=o.includes(i);"0"!==String(s)||c||(n=!0)}),a.specialRates.forEach(e=>{const n=t.has(String(e.id));e.container.toggle(n)}),a.zeroRate.container.toggle(n)}o(),e(document).on("change",".vat_type",o),e(document).on("click",".remove_product, .add_product",function(){setTimeout(o,100)}),n.length>0&&new MutationObserver(o).observe(n[0],{childList:!0,subtree:!0}),e(document).on("change input","#ksef_defaults_exemption, #ksef_zero_rate_mapping, #ksef_defaults_np_vat_rate_type",function(){e("body").addClass("invoice-changed")})});