(()=>{"use strict";window.jQuery,jQuery,jQuery((()=>{jQuery("body").on("click","#check-cembrapay-order-status",(function(e){e.preventDefault(),(()=>{const e=jQuery("#cembrapay-order-status-spinner");e.css("visibility","visible");const t=jQuery("#cembrapay-order-status");t.empty(),jQuery.ajax("/wp-json/cembrapay/v1/get-cembrapay-order-status",{method:"POST",headers:{"Content-Type":"application/json"},beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",cembrapayAdminOrder.nonce)},data:JSON.stringify({orderId:cembrapayAdminOrder.orderId}),dataType:"json",success:function(s){if(s.lastCheck&&s.lastCheck.checkoutStatus){if(t.append("<p><strong>Status:</strong> "+s.lastCheck.checkoutStatus.checkoutStatus+"</p>"),s.moreChecks&&Object.keys(s.moreChecks).length>0){let e=`\n                                <p><a id="more-status-checks" style="cursor:pointer;"><strong>${cembrapayAdminOrder.strings.moreStatusChecks}</strong></a></p>\n                                <div id="more-status-checks-container" style="display:none;">\n                                    <table style="width:100%;">\n                                        <thead>\n                                            <tr>\n                                                <th style="text-align: left;">${cembrapayAdminOrder.strings.date}</th>\n                                                <th style="text-align: left;">${cembrapayAdminOrder.strings.status}</th>\n                                            </tr>\n                                        </thead>\n                                        <tbody>`;Object.keys(s.moreChecks).map(((t,r)=>{e+=`\n                                                <tr>\n                                                    <td>${s.moreChecks[t].date}</td>\n                                                    <td>${s.moreChecks[t].checkoutStatus.checkoutStatus}</td>\n                                                </tr>\n                                            `})),e+="</tbody>\n                                    </table>\n                                </div>\n                            ",t.append(e)}}else t.append(`<p>${cembrapayAdminOrder.strings.noStatus}</p>`);e.css("visibility","hidden")}})})()})),jQuery("body").on("click","#more-status-checks",(function(e){e.preventDefault(),jQuery("#more-status-checks-container").toggle()}))}))})();