Changeset 3292205
- Timestamp:
- 05/13/2025 03:18:46 AM (9 months ago)
- Location:
- squarewoosync/trunk
- Files:
-
- 17 edited
-
assets/js/credit-card.js (modified) (9 diffs)
-
assets/js/square-gateway.js (modified) (1 diff)
-
assets/js/sync-metabox.js (modified) (3 diffs)
-
assets/js/utils.js (modified) (4 diffs)
-
assets/js/wallets.js (modified) (9 diffs)
-
assets/screenshot-1.png (modified) (previous)
-
build/index.asset.php (modified) (1 diff)
-
build/index.js (modified) (1 diff)
-
includes/Payments/Blocks/WC_SquareSync_Gateway_Blocks_Support.php (modified) (1 diff)
-
includes/Payments/WC_SquareSync_Gateway.php (modified) (35 diffs)
-
languages/square-woo-sync.pot (modified) (4 diffs)
-
readme.txt (modified) (5 diffs)
-
squarewoosync.php (modified) (2 diffs)
-
vendor/autoload.php (modified) (1 diff)
-
vendor/composer/autoload_real.php (modified) (2 diffs)
-
vendor/composer/autoload_static.php (modified) (2 diffs)
-
vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
squarewoosync/trunk/assets/js/credit-card.js
r3198659 r3292205 1 let card; // Store the card instance 1 /***************************************************** 2 * credit-card.js (No-destroy, consistent reattach) 3 *****************************************************/ 2 4 5 window.squareCard = null; // We'll store the Square card instance globally 6 7 // Update this mapping if you need specific brand codes. 3 8 const cardTypeMapping = { 4 9 visa: "VISA", … … 11 16 }; 12 17 13 // Initialize Credit Card Payment 14 function initCreditCardPayment(payments, creditCardPaymentRequest) { 15 const cardFormContainer = document.getElementById("card-container"); 16 const cardForm = document.querySelector(".sq-card-wrapper"); 17 18 if (!cardFormContainer) { 19 console.error("Credit card form container not found."); 18 /** 19 * Initialize Credit Card Payment (attach the card fields if not already). 20 * 21 * Called by square-gateway.js after forcibly removing old .sq-card-wrapper. 22 */ 23 function initCreditCardPayment(payments, paymentRequest) { 24 const container = document.getElementById("card-container"); 25 if (!container) { 26 console.error("No #card-container found on the page."); 20 27 return; 21 28 } 22 29 23 if (!payments || !creditCardPaymentRequest) { 24 console.error("Payments or creditCardPaymentRequest object is missing."); 25 return; 26 } 27 28 if (cardForm) { 30 // If there's already an iframe in the container, skip creating another 31 const existingIframe = container.querySelector(".sq-card-iframe-container iframe"); 32 if (existingIframe) { 29 33 return; 30 34 } … … 32 36 payments 33 37 .card() 34 .then(function (cardInstance) { 35 card = cardInstance; 36 card.attach("#card-container"); 38 .then((cardInstance) => { 39 window.squareCard = cardInstance; 40 41 // The attach call is async; returns a promise once the field is mounted 42 cardInstance.attach("#card-container"); 37 43 }) 38 .catch( function (e){39 console.error("Failed to initialize card payment:", e);44 .catch((e) => { 45 console.error("Failed to initialize card:", e); 40 46 }); 41 47 } 42 48 43 // Process Credit Card Payment 49 /** 50 * Process Credit Card Payment 51 */ 44 52 async function processCreditCardPayment(payments, creditCardPaymentRequest) { 45 const savedPaymentToken = jQuery('input[name="wc-squaresync_credit-payment-token"]:checked').val(); 46 if (savedPaymentToken && savedPaymentToken !== 'new') { 47 // Using saved payment method, skip card processing and validation 53 const savedPaymentToken = jQuery( 54 'input[name="wc-squaresync_credit-payment-token"]:checked' 55 ).val(); 56 if (savedPaymentToken && savedPaymentToken !== "new") { 57 // Using a saved payment method, skip card processing 48 58 return true; 49 59 } 50 60 51 if (! card) {52 console.error("Card form not initialized .");61 if (!window.squareCard) { 62 console.error("Card form not initialized (no 'window.squareCard' instance)."); 53 63 logPaymentError("Card form not initialized."); 54 64 return false; … … 56 66 57 67 if (!creditCardPaymentRequest || !creditCardPaymentRequest.total) { 58 console.error( 59 "Credit Card Payment Request object is not available or total is missing." 60 ); 68 console.error("Payment request object is missing or total is missing."); 61 69 logPaymentError("Payment request object is not available."); 62 70 return false; … … 66 74 jQuery("#payment-loader").show(); 67 75 68 const tokenResult = await card.tokenize();69 76 // Tokenize with the global card instance 77 const tokenResult = await window.squareCard.tokenize(); 70 78 71 79 if (tokenResult.status === "OK") { 72 80 const token = tokenResult.token; 73 const cardBrand = tokenResult.details.card.brand; 81 const cardBrand = tokenResult.details.card.brand || ""; 82 74 83 // Convert accepted credit cards into the Square SDK card brands 75 const acceptedBrands = SquareConfig.availableCardTypes.map(76 ( card) => cardTypeMapping[card]84 const acceptedBrands = (SquareConfig.availableCardTypes || []).map( 85 (type) => cardTypeMapping[type] 77 86 ); 78 87 … … 84 93 } 85 94 86 if (SquareConfig.context === 'account') { 87 attachTokenToMyAccountForm(token) 95 // Attach the token to the form (or My Account form) 96 if (SquareConfig.context === "account") { 97 attachTokenToMyAccountForm(token); 88 98 } else { 89 attachTokenToForm(token); // Attach the token to the form99 attachTokenToForm(token); 90 100 } 91 101 92 102 // If we're just adding a card in My Account, no buyer verification needed 103 if (SquareConfig.context === "account") { 104 jQuery("#payment-loader").hide(); 105 return true; 106 } 93 107 94 // Prepare billing data for verification108 // Otherwise, verify buyer 95 109 const billingData = { 96 familyName: jQuery("#billing_last_name").val() ,97 givenName: jQuery("#billing_first_name").val() ,98 email: jQuery("#billing_email").val() ,99 phone: jQuery("#billing_phone").val() ,100 country: jQuery("#billing_country").val() ,101 region: jQuery("#billing_state").val() ,102 city: jQuery("#billing_city").val() ,103 postalCode: jQuery("#billing_postcode").val() ,110 familyName: jQuery("#billing_last_name").val() || "", 111 givenName: jQuery("#billing_first_name").val() || "", 112 email: jQuery("#billing_email").val() || "", 113 phone: jQuery("#billing_phone").val() || "", 114 country: jQuery("#billing_country").val() || "", 115 region: jQuery("#billing_state").val() || "", 116 city: jQuery("#billing_city").val() || "", 117 postalCode: jQuery("#billing_postcode").val() || "", 104 118 addressLines: [ 105 119 jQuery("#billing_address_1").val(), … … 109 123 110 124 const orderTotal = creditCardPaymentRequest.total.amount; 111 112 if (SquareConfig.context === 'account') {113 jQuery("#payment-loader").hide();114 return true;115 }116 117 118 125 const verificationDetails = buildVerificationDetails( 119 126 billingData, … … 122 129 ); 123 130 124 // Verify the buyer 125 const verificationResult = await payments.verifyBuyer( 126 token, 127 verificationDetails 128 ); 131 const verificationResult = await payments.verifyBuyer(token, verificationDetails); 132 129 133 130 134 if (verificationResult.token) { 131 attachVerificationTokenToForm(verificationResult.token); // Attach verification token to the form135 attachVerificationTokenToForm(verificationResult.token); 132 136 jQuery("#payment-loader").hide(); 133 137 return true; … … 139 143 } 140 144 } else { 141 logPaymentError( 142 "Card tokenization failed: " + tokenResult.errors.map(error => error.message).join(", ") 143 ); 145 const errorMsg = tokenResult.errors 146 ? tokenResult.errors.map((error) => error.message).join(", ") 147 : "Unknown error"; 148 logPaymentError("Card tokenization failed: " + errorMsg); 144 149 jQuery("#payment-loader").hide(); 145 150 clearStoredTokens(); -
squarewoosync/trunk/assets/js/square-gateway.js
r3205148 r3292205 1 let payments; // Declare a global variable for payments 2 let creditCardPaymentRequest; 3 let walletPaymentRequest; 1 (function ($) { 4 2 3 let payments = null; 4 let walletPaymentRequest = null; 5 let paymentInProgress = false; 5 6 7 let alreadyInitialized = false; // Guard for initial load 6 8 7 (function (jQuery) { 8 // Function to initialize Square payments 9 async function initializeSquarePayments() { 9 // Debounce timer 10 let squareInitTimeout = null; 11 const DEBOUNCE_DELAY = 150; 12 13 // We remove lastKnownTotal logic & the booleans, allowing each partial refresh to re-init 14 15 /** 16 * Debounces the Square init calls so multiple near-simultaneous triggers 17 * only cause a single actual initialization attempt. 18 */ 19 function scheduleSquareInit() { 20 if (squareInitTimeout) { 21 clearTimeout(squareInitTimeout); 22 } 23 squareInitTimeout = setTimeout(handleSquareInit, DEBOUNCE_DELAY); 24 } 25 26 /** 27 * Main initialization if squaresync_credit is chosen. 28 * Called after the debounce timer. 29 */ 30 async function handleSquareInit() { 31 const selectedMethod = $('#payment input[name="payment_method"]:checked').val(); 32 if (selectedMethod !== 'squaresync_credit') { 33 return; 34 } 35 36 // const existingIframe = $(".sq-card-iframe-container iframe"); 37 38 // if (alreadyInitialized && existingIframe.length > 0) { 39 // return; 40 // } 41 10 42 clearStoredTokens(); 11 43 12 if (typeof Square !== "undefined") { 13 try { 44 if (typeof Square === 'undefined') { 45 console.error('Square Web Payments SDK not loaded'); 46 return; 47 } 48 49 try { 50 // Create 'payments' once if not done yet 51 if (!payments) { 14 52 const applicationId = SquareConfig.applicationId; 15 53 const locationId = SquareConfig.locationId; 16 54 payments = await Square.payments(applicationId, locationId); 55 if (!payments) { 56 throw new Error('Square payments init failed'); 57 } 58 } 17 59 18 if (!payments) { 19 throw new Error("Square payments initialization failed."); 20 } 60 const needsShipping = await checkNeedsShipping(); 61 const couponApplied = false; 62 // Build or refresh the PaymentRequest object 63 walletPaymentRequest = await initPaymentRequest(payments, needsShipping, couponApplied); 21 64 22 const needsShipping = await checkNeedsShipping();23 const couponApplied = false;65 // Show/hide card fields 66 toggleCardFields(); 24 67 25 walletPaymentRequest = await initPaymentRequest( 26 payments, 27 needsShipping, 28 couponApplied 29 ); 68 // Force-clean the container and re-mount the card 69 forceCleanCardContainer(); 70 initCreditCardPayment(payments, walletPaymentRequest); 30 71 31 waitForForm("#payment-form, #payment", function () { 32 initCreditCardPayment(payments, walletPaymentRequest); 33 if ( 34 (SquareConfig.applePayEnabled === "yes" || 35 SquareConfig.googlePayEnabled === "yes") && SquareConfig.context !== 'account' 36 ) { 37 initWalletPayments( 38 payments, 39 walletPaymentRequest, 40 needsShipping, 41 couponApplied 42 ); 43 } 44 }); 45 } catch (error) { 46 console.error("Error during initialization:", error); 72 // Also forcibly remove leftover wallet buttons, then re-init 73 if (walletPaymentRequest) { 74 forceCleanWalletButtons(); 75 initWalletPayments(payments, walletPaymentRequest, needsShipping, couponApplied); 47 76 } 48 } else { 49 console.error("Square Web Payments SDK is not loaded."); 77 78 alreadyInitialized = true; 79 80 } catch (err) { 81 console.error('Square init error:', err); 50 82 } 51 83 } 52 84 53 / / Wait for the payment form to be available before initializing payments54 function waitForForm(selector, callback, interval = 100) {55 const formCheck = setInterval(() => {56 if (jQuery(selector).length > 0) {57 clearInterval(formCheck);58 callback();59 }60 } , interval);85 /** 86 * Remove any leftover .sq-card-wrapper from partial refresh 87 */ 88 function forceCleanCardContainer() { 89 const $container = $('#payment #card-container'); 90 if ($container.length) { 91 $container.find('.sq-card-wrapper').remove(); 92 } 61 93 } 62 94 63 // Listen for payment method changes and reinitialize Square when 'squaresync_credit' is selected 64 jQuery(document.body).on("wc_payment_method_selected wc_cart_totals_refreshed updated_checkout", function () { 65 const selectedPaymentMethod = jQuery('input[name="payment_method"]:checked').val(); 95 /** 96 * Remove leftover wallet button elements 97 */ 98 function forceCleanWalletButtons() { 99 jQuery("#apple-pay-button").empty(); 100 jQuery("#google-pay-button").empty(); 101 jQuery("#afterpay-button").empty(); 66 102 67 if (selectedPaymentMethod === "squaresync_credit") { 68 // Reinitialize Square payments when 'squaresync_credit' is selected 69 initializeSquarePayments(); 70 toggleCardFields(); 71 } 103 // Also re-allow initWalletPayments() if you use a guard inside it 104 // e.g. `walletPaymentsInitialized = false;` 105 window.walletPaymentsInitialized = false; 106 walletPaymentsInitialized = false; 107 } 108 109 /** 110 * Intercept place_order if squaresync_credit is chosen, so we can tokenize. 111 */ 112 $(document).on('click', '#place_order', function (e) { 113 const method = $('#payment input[name="payment_method"]:checked').val(); 114 if (method !== 'squaresync_credit' || paymentInProgress) return; 115 116 e.preventDefault(); 117 paymentInProgress = true; 118 $(document.body).trigger('checkout_place_order_squaresync_credit'); 72 119 }); 73 120 74 jQuery(document).ready(function () { 75 jQuery('form.checkout').on('change', 'input[name="payment_method"]', function () { 76 const selectedPaymentMethod = jQuery('input[name="payment_method"]:checked').val(); 77 if (selectedPaymentMethod === "squaresync_credit") { 78 initializeSquarePayments(); 79 toggleCardFields(); 80 } 81 }); 82 }); 83 84 85 86 87 if (SquareConfig.context === 'account') { 88 // Ensure initialization runs on page load 89 jQuery(document).ready(function () { 90 initializeSquarePayments(); 91 }); 92 } 93 94 95 // Handle the place order button click 96 let paymentInProgress = false; 97 jQuery(document).on("click", "#place_order", function (e) { 98 99 const selectedPaymentMethod = jQuery('input[name="payment_method"]:checked').val(); 100 101 if (selectedPaymentMethod === "squaresync_credit") { 102 if (paymentInProgress) return; 103 104 e.preventDefault(); 105 paymentInProgress = true; 106 107 jQuery(document.body).trigger("checkout_place_order_squaresync_credit"); 108 } 109 }); 110 111 // Process the credit card payment when the custom event is triggered 112 jQuery(document.body).on("checkout_place_order_squaresync_credit", async function () { 113 console.log('process') 114 const success = await processCreditCardPayment(payments, paymentRequest); 115 121 /** 122 * Actually tokenize the card, store nonce, then re-submit. 123 */ 124 $(document.body).on('checkout_place_order_squaresync_credit', async function () { 125 const success = await processCreditCardPayment(payments, walletPaymentRequest); 126 paymentInProgress = false; 116 127 if (success) { 117 paymentInProgress = false;118 128 if (SquareConfig.context === 'account') { 119 jQuery("#add_payment_method").trigger("submit");129 $('#add_payment_method').trigger('submit'); 120 130 } else { 121 jQuery("form.checkout").trigger("submit");131 $('form.checkout').trigger('submit'); 122 132 } 123 133 } else { 124 paymentInProgress = false;125 134 clearStoredTokens(); 126 135 } 127 136 }); 128 137 129 // Clear stored tokens on payment error 130 jQuery(document.body).on("checkout_error", function () { 131 console.error("Payment error occurred."); 132 clearStoredTokens(); // Clear stored tokens on payment failure 133 }); 134 })(jQuery); 138 /** 139 * Show/hide the new card fields vs. saved tokens 140 */ 141 function toggleCardFields() { 142 const token = $('#payment input[name="wc-squaresync_credit-payment-token"]:checked').val(); 143 if (token && token !== 'new') { 144 $('#payment-form').hide(); 145 $('.woocommerce-SavedPaymentMethods-saveNew').hide(); 146 } else { 147 $('#payment-form').show(); 148 $('.woocommerce-SavedPaymentMethods-saveNew').show(); 149 } 150 } 151 152 // Debounced triggers from WooCommerce 153 $(document.body).on('updated_checkout', scheduleSquareInit); 154 // $(document.body).on('change', '#payment input[name="payment_method"]', scheduleSquareInit); 135 155 136 156 137 // Function to toggle card fields visibility based on selected payment token 138 function toggleCardFields() { 139 const savedPaymentToken = jQuery('input[name="wc-squaresync_credit-payment-token"]:checked').val(); 140 if (savedPaymentToken && savedPaymentToken !== 'new') { 141 // Saved payment method selected, hide all card fields 142 jQuery('#payment-form').hide(); 143 jQuery('.woocommerce-SavedPaymentMethods-saveNew').hide(); 144 } else { 145 // New payment method selected, show all card fields 146 jQuery('#payment-form').show(); 147 jQuery('.woocommerce-SavedPaymentMethods-saveNew').show(); 148 } 149 } 157 // If user picks "Use a new card," re-check 158 $(document).on('change', '#payment input[name="wc-squaresync_credit-payment-token"]', function () { 159 toggleCardFields(); 160 const method = $('#payment input[name="payment_method"]:checked').val(); 161 if ($(this).val() === 'new' && method === 'squaresync_credit') { 162 forceCleanCardContainer() 163 forceCleanWalletButtons() 164 scheduleSquareInit(); 165 } 166 }); 150 167 151 jQuery(document.body).on('change', 'input[name="wc-squaresync_credit-payment-token"]', function () { 152 toggleCardFields(); // Add this line153 if (card) {154 card.recalculateSize()155 }156 });168 // On account page "Add Payment Method", do an init once 169 $(document).ready(function () { 170 if (SquareConfig.context === 'account') { 171 $(document.body).trigger('wc_payment_method_selected'); 172 } 173 }); 157 174 175 // On checkout_error, clear tokens 176 $(document.body).on('checkout_error', function () { 177 clearStoredTokens(); 178 }); 179 180 })(jQuery); -
squarewoosync/trunk/assets/js/sync-metabox.js
r3198659 r3292205 1 1 jQuery(document).ready(function ($) { 2 'use strict'; 3 $(document).on("click", "#sync_to_square_button", function (event) { 2 var nonce = swsAjax.nonce; 3 4 // =============== Export Button Logic =============== 5 const exportBtn = $("#export_to_square_button"); 6 if (exportBtn.length) { 7 const productId = exportBtn.data("product-id"); 8 9 // Create a container for error messages and place it right after the button 10 const errorContainer = $("<div>", { 11 id: "export-validation-errors", 12 css: { 13 color: "red", 14 "margin-top": "10px", 15 }, 16 }); 17 exportBtn.after(errorContainer); 18 19 // Initially disable the button until validation completes 20 exportBtn.prop("disabled", true).text("Checking..."); 21 22 // Validate the product on page load 23 // We always validate the regular data, plus optional fields (images, categories) if checked 24 var exportFields = []; 25 $(".sws-export-field:checked").each(function () { 26 exportFields.push($(this).val()); 27 }); 28 29 $.ajax({ 30 url: ajaxurl, // or swsAjax.ajaxurl if localized 31 type: "POST", 32 dataType: "json", 33 data: { 34 action: "check_export_validation", 35 product_id: productId, 36 nonce: nonce, 37 export_fields: exportFields, // new param for dynamic validation 38 }, 39 success: function (response) { 40 if (response.success) { 41 // Valid -> enable Export button 42 exportBtn.prop("disabled", false).text("Export to Square"); 43 } else { 44 // Not valid -> stay disabled, display reasons 45 exportBtn.prop("disabled", true).text("Not Exportable"); 46 47 let reasonsHtml = ""; 48 if ( 49 response.data && 50 response.data.reasons && 51 Array.isArray(response.data.reasons) 52 ) { 53 reasonsHtml = "<ul>"; 54 response.data.reasons.forEach(function (reason) { 55 reasonsHtml += "<li>" + reason + "</li>"; 56 }); 57 reasonsHtml += "</ul>"; 58 } else { 59 reasonsHtml = 60 "<p>" + 61 (response.data && response.data.message 62 ? response.data.message 63 : "Product cannot be exported.") + 64 "</p>"; 65 } 66 errorContainer.html(reasonsHtml); 67 } 68 }, 69 error: function () { 70 exportBtn.prop("disabled", true).text("Validation Error"); 71 $("#post").prepend( 72 '<div class="notice notice-error is-dismissible"><p>Validation request failed unexpectedly.</p></div>' 73 ); 74 }, 75 }); 76 77 // Re-validate on checkbox changes (optional but recommended), 78 // so the user doesn't have to refresh to see updated validation: 79 $(document).on("change", ".sws-export-field", function () { 80 exportBtn.prop("disabled", true).text("Re-checking..."); 81 82 // Gather fields again 83 let newExportFields = []; 84 $(".sws-export-field:checked").each(function () { 85 newExportFields.push($(this).val()); 86 }); 87 88 $.ajax({ 89 url: ajaxurl, 90 type: "POST", 91 dataType: "json", 92 data: { 93 action: "check_export_validation", 94 product_id: productId, 95 nonce: nonce, 96 export_fields: newExportFields, 97 }, 98 success: function (response) { 99 if (response.success) { 100 exportBtn.prop("disabled", false).text("Export to Square"); 101 errorContainer.empty(); 102 } else { 103 exportBtn.prop("disabled", true).text("Not Exportable"); 104 105 let reasonsHtml = ""; 106 if ( 107 response.data && 108 response.data.reasons && 109 Array.isArray(response.data.reasons) 110 ) { 111 reasonsHtml = "<ul>"; 112 response.data.reasons.forEach(function (reason) { 113 reasonsHtml += "<li>" + reason + "</li>"; 114 }); 115 reasonsHtml += "</ul>"; 116 } else { 117 reasonsHtml = 118 "<p>" + 119 (response.data && response.data.message 120 ? response.data.message 121 : "Product cannot be exported.") + 122 "</p>"; 123 } 124 errorContainer.html(reasonsHtml); 125 } 126 }, 127 error: function () { 128 exportBtn.prop("disabled", true).text("Validation Error"); 129 $("#post").prepend( 130 '<div class="notice notice-error is-dismissible"><p>Validation request failed unexpectedly (checkbox changed).</p></div>' 131 ); 132 }, 133 }); 134 }); 135 } 136 137 // When the user clicks the export button 138 $(document).on("click", "#export_to_square_button", function (event) { 4 139 event.preventDefault(); 5 140 6 var nonce = swsAjax.nonce; 7 // Disable the button and change the text to "Loading" 8 $(this).prop("disabled", true).text("Updating..."); 141 // Disable the button and change the text 142 $(this).prop("disabled", true).text("Exporting..."); 9 143 10 144 var productId = $(this).data("product-id"); 145 146 // Gather the currently selected export fields 147 var exportFields = []; 148 $(".sws-export-field:checked").each(function () { 149 exportFields.push($(this).val()); 150 }); 151 11 152 $.ajax({ 12 153 url: ajaxurl, 13 154 type: "post", 14 155 data: { 15 action: " sync_to_square",156 action: "export_to_square", 16 157 product_id: productId, 17 158 nonce: nonce, 159 export_fields: exportFields, 18 160 }, 19 161 success: function (response) { … … 27 169 "</p></div>"; 28 170 29 // Insert the notice at the top of the .wrap container, or after existing notices30 171 $("#post").prepend(noticeHtml); 31 172 32 173 if (data.success) { 33 174 $(".sws-notice") 34 .text(" Sync completed! Make some more changes to sync again.")175 .text("Export completed!") 35 176 .css("color", "rgb(0,180,0)"); 36 // Update the button text on success 37 $("#sync_to_square_button") 177 $("#export_to_square_button") 38 178 .addClass("success-button") 39 .text("Successfully Updated");179 .text("Successfully Exported"); 40 180 } else { 41 $("# sync_to_square_button").prop("disabled", true).text("Failed");181 $("#export_to_square_button").prop("disabled", true).text("Failed"); 42 182 } 43 183 }, 44 184 error: function () { 45 185 $("#post").prepend( 46 '<div class="notice notice-error is-dismissible"><p>Error occurred while syncing.</p></div>'186 '<div class="notice notice-error is-dismissible"><p>Error occurred while exporting.</p></div>' 47 187 ); 48 $("# sync_to_square_button").prop("disabled", true).text("Failed");188 $("#export_to_square_button").prop("disabled", true).text("Failed"); 49 189 }, 50 190 }); 51 191 }); 52 192 53 $(document).on("click", "#export_to_square_button", function (event) { 193 // =============== Sync Button Logic (Already in your code) =============== 194 // We’ll include the final version for completeness: 195 196 $(document).on("click", "#sync_to_square_button", function (event) { 54 197 event.preventDefault(); 55 56 var nonce = swsAjax.nonce;57 58 // Disable the button and change the text to "Loading"59 198 $(this).prop("disabled", true).text("Updating..."); 60 199 61 200 var productId = $(this).data("product-id"); 201 202 // Collect sync checkboxes 203 var syncFields = []; 204 $(".sws-data-field:checked").each(function () { 205 syncFields.push($(this).val()); 206 }); 207 62 208 $.ajax({ 63 209 url: ajaxurl, 64 type: " post",210 type: "POST", 65 211 data: { 66 action: " export_to_square",212 action: "sync_to_square", 67 213 product_id: productId, 68 214 nonce: nonce, 215 sync_fields: syncFields, 69 216 }, 70 217 success: function (response) { … … 78 225 "</p></div>"; 79 226 80 // Insert the notice at the top of the .wrap container, or after existing notices81 227 $("#post").prepend(noticeHtml); 82 228 83 229 if (data.success) { 84 230 $(".sws-notice") 85 .text(" Export completed!")231 .text("Sync completed! Make some more changes to sync again.") 86 232 .css("color", "rgb(0,180,0)"); 87 // Update the button text on success 88 $("#export_to_square_button") 233 $("#sync_to_square_button") 89 234 .addClass("success-button") 90 .text("Successfully Exported");235 .text("Successfully Updated"); 91 236 } else { 92 $("# export_to_square_button").prop("disabled", true).text("Failed");237 $("#sync_to_square_button").prop("disabled", true).text("Failed"); 93 238 } 94 239 }, 95 240 error: function () { 96 241 $("#post").prepend( 97 '<div class="notice notice-error is-dismissible"><p>Error occurred while exporting.</p></div>'242 '<div class="notice notice-error is-dismissible"><p>Error occurred while syncing.</p></div>' 98 243 ); 99 $("# export_to_square_button").prop("disabled", true).text("Failed");244 $("#sync_to_square_button").prop("disabled", true).text("Failed"); 100 245 }, 101 246 }); -
squarewoosync/trunk/assets/js/utils.js
r3198659 r3292205 3 3 let paymentRequestRef = null; // This replaces the useRef in React 4 4 let paymentRequest = null; // This replaces the useState in React 5 /** 6 * Builds and returns the payment request object. 7 * 8 * @param {Object} payments - The Square payments object used to create the payment request. 9 * @param {boolean} needsShipping - A value from the Block checkout that indicates whether shipping is required. 10 * @param {boolean} couponApplied - Indicates if a coupon has been applied to the checkout. 11 * @returns {Promise<Object>} The payment request object or null if not ready. 12 */ 5 13 6 function initPaymentRequest(payments, needsShipping, couponApplied) { 14 7 if (!payments) { … … 36 29 const __paymentRequestObject = JSON.parse(__paymentRequestJson); 37 30 // Filter out other shipping options and include only the selected shipping method 38 if (__paymentRequestObject.shippingOptions && selectedShippingMethod) { 39 __paymentRequestObject.shippingOptions = 40 __paymentRequestObject.shippingOptions.filter((option) => { 41 return option.id === selectedShippingMethod; 42 }); 31 if (__paymentRequestObject) { 32 if (Array.isArray(__paymentRequestObject.lineItems)) { 33 // const shippingIndex = __paymentRequestObject.lineItems.findIndex( 34 // (item) => item.label?.toLowerCase().includes("shipping") 35 // ); 36 // if (shippingIndex !== -1) { 37 // __paymentRequestObject.lineItems.splice(shippingIndex, 1); 38 // } 39 40 const discountIndex = __paymentRequestObject.lineItems.findIndex( 41 (item) => item.label?.toLowerCase().includes("discount") 42 ); 43 if (discountIndex !== -1) { 44 __paymentRequestObject.lineItems.splice(discountIndex, 1); 45 } 46 } 47 48 if (needsShipping) { 49 __paymentRequestObject.requestShippingAddress = true; 50 // const shippingOptions = await buildAdvancedShippingOptions(); 51 // __paymentRequestObject.shippingOptions = shippingOptions; 52 } 43 53 } 44 54 … … 93 103 } 94 104 105 async function getAjaxUrl(action) { 106 return SquareConfig.wc_ajax_url.replace( 107 "%%endpoint%%", 108 `square_digital_wallet_${action}` 109 ); 110 } 111 112 async function recalculateTotals(data) { 113 return new Promise((resolve, reject) => { 114 jQuery.ajax({ 115 url: SquareConfig.ajax_url, 116 type: "POST", 117 data: { 118 action: "recalculate_totals", // Your PHP handler action 119 ...data, // Spread the data into the request 120 }, 121 success: function (response) { 122 if (response.success) { 123 resolve(response.data); // Resolve with the data 124 } else { 125 reject(response.data); // Reject with the error data 126 } 127 }, 128 error: function (error) { 129 reject("Error occurred: " + error.statusText); 130 }, 131 }); 132 }); 133 } 134 135 async function handleShippingAddressChanged(shippingContact) { 136 const data = { 137 context: "checkout", 138 shipping_contact: shippingContact, 139 security: SquareConfig.recalculate_totals_nonce, 140 is_pay_for_order_page: "false", 141 }; 142 143 const response = await recalculateTotals(data); 144 return response; 145 } 146 147 /** 148 * @param {Object} option 149 * Example: { amount: "15.00", id: "flat_rate:1", label: "Flat rate" } 150 */ 151 async function handleShippingOptionChanged(option) { 152 // option.id typically matches the WooCommerce shipping method input value: "flat_rate:1", "free_shipping:2", etc. 153 const shippingRadio = jQuery( 154 `input[name="shipping_method[0]"][value="${option.id}"]` 155 ); 156 157 if (shippingRadio.length) { 158 // Check the radio for this shipping method 159 shippingRadio.prop("checked", true); 160 161 // Trigger WooCommerce to recalculate totals 162 // Many themes or plugins watch these events: 163 shippingRadio.trigger("change"); 164 jQuery("body").trigger("update_checkout"); 165 } else { 166 console.warn( 167 `No matching shipping method input found in WooCommerce for "${option.id}"` 168 ); 169 } 170 } 171 95 172 function attachTokenToForm(token) { 96 173 jQuery("<input>") … … 104 181 105 182 function attachTokenToMyAccountForm(token) { 106 console.log(token)107 183 jQuery("<input>") 108 184 .attr({ -
squarewoosync/trunk/assets/js/wallets.js
r3220600 r3292205 1 let walletPaymentsInitialized = false; 2 1 3 async function initWalletPayments( 2 4 payments, … … 5 7 couponApplied 6 8 ) { 9 if (walletPaymentsInitialized) { 10 return; // Don't run again 11 } 12 walletPaymentsInitialized = true; 13 7 14 if (!payments) { 8 15 console.error("Payments object is required for wallet payments."); … … 19 26 20 27 if (updatedWalletPaymentRequest) { 21 await attachWalletButtons(updatedWalletPaymentRequest, payments, needsShipping, couponApplied); 28 await attachWalletButtons( 29 updatedWalletPaymentRequest, 30 payments, 31 needsShipping, 32 couponApplied 33 ); 22 34 } 23 35 } … … 25 37 // Attach initial wallet buttons on page load 26 38 if (walletPaymentRequest) { 27 await attachWalletButtons(walletPaymentRequest, payments, needsShipping, couponApplied); 28 } 29 reinitializeWalletButtons() 39 await attachWalletButtons( 40 walletPaymentRequest, 41 payments, 42 needsShipping, 43 couponApplied 44 ); 45 } 46 // reinitializeWalletButtons(); 30 47 // // Reinitialize wallet buttons whenever cart totals update 31 48 // jQuery(document.body).on( … … 37 54 } 38 55 39 async function attachWalletButtons(paymentRequest, payments, needsShipping, couponApplied) { 56 /**********************************************************/ 57 /** 1) Helper: transformContact **/ 58 /**********************************************************/ 59 function transformContact(contact, isAfterpay, fallback = {}) { 60 // If there's no contact at all, we immediately fallback. 61 if (!contact || typeof contact !== "object") { 62 contact = {}; 63 } 64 65 const { 66 familyName, 67 givenName, 68 region, // Afterpay uses `region` 69 state, // Apple/Google Pay uses `state` 70 country, // Afterpay uses `country` 71 countryCode, // Apple/Google uses `countryCode` 72 city, 73 addressLines, 74 postalCode, 75 phone, 76 email, 77 } = contact; 78 79 const { 80 first_name: fallbackGivenName = "", 81 last_name: fallbackFamilyName = "", 82 address_1: fallbackAddress1 = "", 83 address_2: fallbackAddress2 = "", 84 city: fallbackCity = "", 85 state: fallbackState = "", 86 country: fallbackCountry = "", 87 postcode: fallbackPostcode = "", 88 phone: fallbackPhone = "", 89 email: fallbackEmail = "", 90 } = fallback; 91 92 const mergedGivenName = givenName ?? fallbackGivenName; 93 const mergedFamilyName = familyName ?? fallbackFamilyName; 94 const mergedCity = city ?? fallbackCity; 95 const mergedPostalCode = postalCode ?? fallbackPostcode; 96 const mergedEmail = email ?? fallbackEmail; 97 const mergedPhone = phone ?? fallbackPhone; 98 99 // For region/state 100 const mergedState = isAfterpay 101 ? region ?? fallbackState 102 : state ?? region ?? fallbackState; 103 104 // For country / countryCode 105 const mergedCountry = isAfterpay 106 ? country ?? fallbackCountry 107 : countryCode ?? country ?? fallbackCountry; 108 109 // For address lines 110 let mergedAddressLines = []; 111 if (Array.isArray(addressLines) && addressLines.length > 0) { 112 mergedAddressLines = addressLines; 113 } else { 114 // Merge fallback address_1 and address_2 if present 115 mergedAddressLines = [fallbackAddress1, fallbackAddress2].filter(Boolean); 116 } 117 118 return { 119 givenName: mergedGivenName, 120 familyName: mergedFamilyName, 121 state: mergedState, 122 countryCode: mergedCountry, 123 city: mergedCity, 124 addressLines: mergedAddressLines, 125 postalCode: mergedPostalCode, 126 phone: mergedPhone, 127 email: mergedEmail, 128 }; 129 } 130 131 /**********************************************************/ 132 /** 2) Helper: isBillingComplete **/ 133 /**********************************************************/ 134 function isBillingComplete(billingContact) { 135 // Define whatever fields you consider "required" 136 // Adjust as needed for your store’s requirements 137 return ( 138 billingContact && 139 billingContact.givenName && 140 billingContact.familyName && 141 billingContact.addressLines && 142 billingContact.addressLines.length > 0 && 143 billingContact.city && 144 billingContact.state && 145 billingContact.postalCode && 146 billingContact.countryCode 147 ); 148 } 149 150 async function attachWalletButtons( 151 paymentRequest, 152 payments, 153 needsShipping, 154 couponApplied 155 ) { 40 156 // Common function to handle wallet tokenization and verification 157 /**********************************************************/ 158 /** 1) Helper: transformContact **/ 159 /**********************************************************/ 160 function transformContact(contact, isAfterpay, fallback = {}) { 161 // If there's no contact at all, we immediately fallback. 162 if (!contact || typeof contact !== "object") { 163 contact = {}; 164 } 165 166 const { 167 familyName, 168 givenName, 169 region, // Afterpay uses `region` 170 state, // Apple/Google Pay uses `state` 171 country, // Afterpay uses `country` 172 countryCode, // Apple/Google uses `countryCode` 173 city, 174 addressLines, 175 postalCode, 176 phone, 177 email, 178 } = contact; 179 180 const { 181 first_name: fallbackGivenName = "", 182 last_name: fallbackFamilyName = "", 183 address_1: fallbackAddress1 = "", 184 address_2: fallbackAddress2 = "", 185 city: fallbackCity = "", 186 state: fallbackState = "", 187 country: fallbackCountry = "", 188 postcode: fallbackPostcode = "", 189 phone: fallbackPhone = "", 190 email: fallbackEmail = "", 191 } = fallback; 192 193 const mergedGivenName = givenName ?? fallbackGivenName; 194 const mergedFamilyName = familyName ?? fallbackFamilyName; 195 const mergedCity = city ?? fallbackCity; 196 const mergedPostalCode = postalCode ?? fallbackPostcode; 197 const mergedEmail = email ?? fallbackEmail; 198 const mergedPhone = phone ?? fallbackPhone; 199 200 // For region/state 201 const mergedState = isAfterpay 202 ? region ?? fallbackState 203 : state ?? region ?? fallbackState; 204 205 // For country / countryCode 206 const mergedCountry = isAfterpay 207 ? country ?? fallbackCountry 208 : countryCode ?? country ?? fallbackCountry; 209 210 // For address lines 211 let mergedAddressLines = []; 212 if (Array.isArray(addressLines) && addressLines.length > 0) { 213 mergedAddressLines = addressLines; 214 } else { 215 // Merge fallback address_1 and address_2 if present 216 mergedAddressLines = [fallbackAddress1, fallbackAddress2].filter(Boolean); 217 } 218 219 return { 220 givenName: mergedGivenName, 221 familyName: mergedFamilyName, 222 state: mergedState, 223 countryCode: mergedCountry, 224 city: mergedCity, 225 addressLines: mergedAddressLines, 226 postalCode: mergedPostalCode, 227 phone: mergedPhone, 228 email: mergedEmail, 229 }; 230 } 231 232 /**********************************************************/ 233 /** 2) Helper: isBillingComplete **/ 234 /**********************************************************/ 235 function isBillingComplete(billingContact) { 236 // Define whatever fields you consider "required" 237 // Adjust as needed for your store’s requirements 238 return ( 239 billingContact && 240 billingContact.givenName && 241 billingContact.familyName && 242 billingContact.addressLines && 243 billingContact.addressLines.length > 0 && 244 billingContact.city && 245 billingContact.state && 246 billingContact.postalCode && 247 billingContact.countryCode 248 ); 249 } 250 251 /**********************************************************/ 252 /** 3) handleTokenizationAndVerification (UPDATED) **/ 253 /**********************************************************/ 41 254 async function handleTokenizationAndVerification(walletInstance, walletType) { 42 255 try { … … 44 257 45 258 if (tokenResult.status === "OK") { 259 // Attach raw nonce/token to a hidden field 46 260 attachTokenToForm(tokenResult.token); 47 261 48 49 50 // Ensure the "Ship to a different address" checkbox is checked 51 const shipToDifferentAddressCheckbox = jQuery("#ship-to-different-address-checkbox"); 262 // We assume `walletType === "AfterpayClearpay"` for Afterpay logic 263 const isAfterpay = walletType === "AfterpayClearpay"; 264 265 // Ensure "Ship to a different address" is checked if we have shipping details 266 const shipToDifferentAddressCheckbox = jQuery( 267 "#ship-to-different-address-checkbox" 268 ); 52 269 if (!shipToDifferentAddressCheckbox.is(":checked")) { 53 270 shipToDifferentAddressCheckbox.prop("checked", true); 54 jQuery("div.shipping_address").show(); // Ensure the shipping fields are visible271 jQuery("div.shipping_address").show(); // Make sure shipping fields are visible 55 272 } 56 273 57 const shippingDetails = tokenResult?.details?.shipping?.contact; 58 if (shippingDetails) { 59 // Only update shipping fields if shipping info is actually returned 60 updateWooCommerceShippingFields(shippingDetails); 274 /*******************************************************/ 275 /** 3a) Extract shipping & billing from tokenResult **/ 276 /*******************************************************/ 277 const shippingDetails = tokenResult?.details?.shipping?.contact || {}; 278 const billingDetails = tokenResult?.details?.billing || {}; 279 280 // In case your legacy checkout still needs to fallback to 281 // current form values if the contact is missing data: 282 const fallbackShipping = { 283 first_name: jQuery("#shipping_first_name").val(), 284 last_name: jQuery("#shipping_last_name").val(), 285 address_1: jQuery("#shipping_address_1").val(), 286 address_2: jQuery("#shipping_address_2").val(), 287 city: jQuery("#shipping_city").val(), 288 state: jQuery("#shipping_state").val(), 289 postcode: jQuery("#shipping_postcode").val(), 290 country: jQuery("#shipping_country").val(), 291 phone: jQuery("#shipping_phone").val(), 292 email: jQuery("#billing_email").val(), // Sometimes shipping doesn't have its own email 293 }; 294 const fallbackBilling = { 295 first_name: jQuery("#billing_first_name").val(), 296 last_name: jQuery("#billing_last_name").val(), 297 address_1: jQuery("#billing_address_1").val(), 298 address_2: jQuery("#billing_address_2").val(), 299 city: jQuery("#billing_city").val(), 300 state: jQuery("#billing_state").val(), 301 postcode: jQuery("#billing_postcode").val(), 302 country: jQuery("#billing_country").val(), 303 phone: jQuery("#billing_phone").val(), 304 email: jQuery("#billing_email").val(), 305 }; 306 307 // Transform shipping contact 308 const shippingContact = transformContact( 309 shippingDetails, 310 isAfterpay, 311 fallbackShipping 312 ); 313 314 // Transform billing contact 315 let billingContact = transformContact( 316 billingDetails, 317 isAfterpay, 318 fallbackBilling 319 ); 320 321 // If billing is incomplete, fallback to shipping 322 if (!isBillingComplete(billingContact)) { 323 const shippingAsBilling = transformContact( 324 shippingDetails, 325 isAfterpay, 326 fallbackShipping 327 ); 328 // Preserve billingContact.email if it exists, otherwise use shipping email 329 billingContact = { 330 ...shippingAsBilling, 331 email: 332 billingContact.email || 333 shippingAsBilling.email || 334 shippingDetails.email, 335 }; 61 336 } 62 337 63 jQuery("form.checkout").trigger("submit"); 338 339 // Shipping: 340 // Only update shipping if your store "needs shipping" 341 if (typeof needsShipping !== "undefined" && needsShipping) { 342 jQuery("#shipping_first_name").val(shippingContact.givenName || ""); 343 jQuery("#shipping_last_name").val(shippingContact.familyName || ""); 344 jQuery("#shipping_company").val(""); 345 jQuery("#shipping_address_1").val( 346 shippingContact.addressLines[0] || "" 347 ); 348 jQuery("#shipping_address_2").val( 349 shippingContact.addressLines[1] || "" 350 ); 351 jQuery("#shipping_city").val(shippingContact.city || ""); 352 jQuery("#shipping_state").val(shippingContact.state || ""); 353 jQuery("#shipping_postcode").val(shippingContact.postalCode || ""); 354 jQuery("#shipping_country").val(shippingContact.countryCode || ""); 355 jQuery("#shipping_phone").val(shippingContact.phone || ""); 356 } 357 358 console.log(billingContact) 359 360 /*********************************************************/ 361 /** 3b) Update Legacy Billing & Shipping form fields **/ 362 /*********************************************************/ 363 // — now country/state — 364 jQuery("#billing_country") 365 .val(billingContact.countryCode || "") 366 .trigger("change"); // ⬅️ rebuild states 367 368 369 370 371 // give WooCommerce a moment to repopulate the state <select> 372 setTimeout(function () { 373 jQuery("#billing_state") 374 .val(billingContact.state || "") 375 .trigger("change"); 376 377 // Billing: 378 jQuery("#billing_first_name").val(billingContact.givenName || ""); 379 jQuery("#billing_last_name").val(billingContact.familyName || ""); 380 jQuery("#billing_company").val(""); // no company in token result 381 jQuery("#billing_address_1").val(billingContact.addressLines[0] || ""); 382 jQuery("#billing_address_2").val(billingContact.addressLines[1] || ""); 383 // … your other field‐fills … 384 jQuery("#billing_city").val(billingContact.city || ""); 385 jQuery("#billing_postcode").val(billingContact.postalCode || ""); 386 387 // … then the rest … 388 jQuery("#billing_phone").val(billingContact.phone || ""); 389 jQuery("#billing_email").val(billingContact.email || ""); 390 391 jQuery("form.checkout").trigger("submit"); 392 }, 100); 393 394 64 395 } else { 396 // Clear stored tokens or error-handling 65 397 clearStoredTokens(); 66 398 if (tokenResult.status !== "Cancel") { 67 logPaymentError(`${walletType} tokenization failed: ${JSON.stringify(tokenResult.errors)}`); 399 logPaymentError( 400 `${walletType} tokenization failed: ${JSON.stringify( 401 tokenResult.errors 402 )}` 403 ); 68 404 } 69 405 } 70 406 } catch (error) { 71 407 clearStoredTokens(); 72 logPaymentError(`${walletType} tokenization or verification error: ${error.message}`); 408 logPaymentError( 409 `${walletType} tokenization or verification error: ${error.message}` 410 ); 73 411 } 74 412 } … … 77 415 if (SquareConfig.applePayEnabled === "yes") { 78 416 try { 79 const applePayButtonContainer = document.querySelector("#apple-pay-button"); 417 const applePayButtonContainer = 418 document.querySelector("#apple-pay-button"); 80 419 if (applePayButtonContainer) { 81 420 applePayButtonContainer.style.display = "block"; 82 421 83 const applePayInstance = await payments.applePay(paymentRequest); 84 jQuery("#apple-pay-button").off("click").on("click", async function (e) { 85 e.preventDefault(); 86 await handleTokenizationAndVerification(applePayInstance, "Apple Pay"); 87 }); 422 const removedShippingOptions = paymentRequest; 423 removedShippingOptions["_shippingOptions"] = []; 424 425 const applePayInstance = await payments.applePay( 426 removedShippingOptions 427 ); 428 429 430 jQuery("#apple-pay-button") 431 .off("click") 432 .on("click", async function (e) { 433 e.preventDefault(); 434 await handleTokenizationAndVerification( 435 applePayInstance, 436 "Apple Pay" 437 ); 438 }); 88 439 } 89 440 } catch (error) { … … 95 446 if (SquareConfig.googlePayEnabled === "yes") { 96 447 try { 97 const googlePayButtonContainer = document.querySelector("#google-pay-button"); 448 const googlePayButtonContainer = 449 document.querySelector("#google-pay-button"); 98 450 99 451 // Check if the Google Pay button is already present by checking the element 'gpay-button-online-api-id' 100 const googlePayButtonExists = document.querySelector("#gpay-button-online-api-id"); 452 const googlePayButtonExists = document.querySelector( 453 "#gpay-button-online-api-id" 454 ); 101 455 102 456 if (googlePayButtonContainer && !googlePayButtonExists) { 457 const removedShippingOptions = paymentRequest; 458 removedShippingOptions["_shippingOptions"] = []; 459 103 460 // Initialize the Google Pay instance 104 const googlePayInstance = await payments.googlePay(paymentRequest); 105 461 const googlePayInstance = await payments.googlePay( 462 removedShippingOptions 463 ); 106 464 // Remove any existing click handler before attaching the new one 107 jQuery("#google-pay-button").off("click").on("click", async function (e) { 108 e.preventDefault(); 109 await handleTokenizationAndVerification(googlePayInstance, "Google Pay"); 110 }); 465 jQuery("#google-pay-button") 466 .off("click") 467 .on("click", async function (e) { 468 e.preventDefault(); 469 await handleTokenizationAndVerification( 470 googlePayInstance, 471 "Google Pay" 472 ); 473 }); 111 474 112 475 // Attach the Google Pay button … … 118 481 } 119 482 } 483 484 if (SquareConfig.afterPayEnabled === "yes") { 485 try { 486 const afterPayButtonContainer = 487 document.querySelector("#afterpay-button"); 488 // Check for an existing Afterpay button *inside* the container 489 const afterPayButtonExists = afterPayButtonContainer 490 ? afterPayButtonContainer.querySelector(".sq-ap__button") 491 : null; 492 493 if (afterPayButtonContainer) { 494 const afterPayInstance = 495 await payments.afterpayClearpay(paymentRequest); 496 497 jQuery("#afterpay-button") 498 .off("click") 499 .on("click", async function (e) { 500 e.preventDefault(); 501 await handleTokenizationAndVerification( 502 afterPayInstance, 503 "Afterpay" 504 ); 505 }); 506 507 await afterPayInstance.attach("#afterpay-button"); 508 509 // Set a minimum width to prevent it from being cut off 510 afterPayButtonContainer.style.minWidth = "240px"; 511 512 paymentRequest?.addEventListener( 513 "afterpay_shippingaddresschanged", 514 (shippingContact) => handleShippingAddressChanged(shippingContact) 515 ); 516 paymentRequest?.addEventListener( 517 "afterpay_shippingoptionchanged", 518 (option) => handleShippingOptionChanged(option) 519 ); 520 } 521 } catch (error) { 522 console.error("Failed to initialize Afterpay:", error); 523 } 524 } 120 525 } 121 526 122 123 527 function updateWooCommerceShippingFields(shipping) { 124 // Update shipping fields 528 // Bail out if shipping or addressLines is missing 529 if ( 530 !shipping || 531 !Array.isArray(shipping.addressLines) || 532 shipping.addressLines.length === 0 533 ) { 534 return; 535 } 536 125 537 jQuery("#shipping_first_name").val(shipping.givenName); 126 538 jQuery("#shipping_last_name").val(shipping.familyName); -
squarewoosync/trunk/build/index.asset.php
r3205148 r3292205 1 <?php return array('dependencies' => array('moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-element'), 'version' => ' 314d96a60ee231e1030d');1 <?php return array('dependencies' => array('moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-element'), 'version' => '81c35b13e6127648262b'); -
squarewoosync/trunk/build/index.js
r3205148 r3292205 1 (()=>{var e,t,n={42:(e,t,n)=>{"use strict";var r=n(664),o={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,a,l,i,c,s,u=!1;t||(t={}),n=t.debug||!1;try{if(l=r(),i=document.createRange(),c=document.getSelection(),(s=document.createElement("span")).textContent=e,s.ariaHidden="true",s.style.all="unset",s.style.position="fixed",s.style.top=0,s.style.clip="rect(0, 0, 0, 0)",s.style.whiteSpace="pre",s.style.webkitUserSelect="text",s.style.MozUserSelect="text",s.style.msUserSelect="text",s.style.userSelect="text",s.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var a=o[t.format]||o.default;window.clipboardData.setData(a,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(s),i.selectNodeContents(s),c.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");u=!0}catch(r){n&&console.error("unable to copy using execCommand: ",r),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(r){n&&console.error("unable to copy using clipboardData: ",r),n&&console.error("falling back to prompt"),a=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(a,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(i):c.removeAllRanges()),s&&document.body.removeChild(s),l()}return u}},35:(e,t,n)=>{"use strict";var r=n(959),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},l={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},i={};function c(e){return r.isMemo(e)?l:i[e.$$typeof]||o}i[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},i[r.Memo]=l;var s=Object.defineProperty,u=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,d=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(d){var o=f(n);o&&o!==d&&e(t,o,r)}var l=u(n);m&&(l=l.concat(m(n)));for(var i=c(t),h=c(n),g=0;g<l.length;++g){var y=l[g];if(!(a[y]||r&&r[y]||h&&h[y]||i&&i[y])){var v=p(n,y);try{s(t,y,v)}catch(e){}}}}return t}},889:(e,t,n)=>{var r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,i=parseInt,c="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,s="object"==typeof self&&self&&self.Object===Object&&self,u=c||s||Function("return this")(),m=Object.prototype.toString,p=Math.max,f=Math.min,d=function(){return u.Date.now()};function h(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==m.call(e)}(e))return NaN;if(h(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=h(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var n=a.test(e);return n||l.test(e)?i(e.slice(2),n?2:8):o.test(e)?NaN:+e}e.exports=function(e,t,n){var r,o,a,l,i,c,s=0,u=!1,m=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var n=r,a=o;return r=o=void 0,s=t,l=e.apply(a,n)}function w(e){var n=e-c;return void 0===c||n>=t||n<0||m&&e-s>=a}function b(){var e=d();if(w(e))return x(e);i=setTimeout(b,function(e){var n=t-(e-c);return m?f(n,a-(e-s)):n}(e))}function x(e){return i=void 0,y&&r?v(e):(r=o=void 0,l)}function E(){var e=d(),n=w(e);if(r=arguments,o=this,c=e,n){if(void 0===i)return function(e){return s=e,i=setTimeout(b,t),u?v(e):l}(c);if(m)return i=setTimeout(b,t),v(c)}return void 0===i&&(i=setTimeout(b,t)),l}return t=g(t)||0,h(n)&&(u=!!n.leading,a=(m="maxWait"in n)?p(g(n.maxWait)||0,t):a,y="trailing"in n?!!n.trailing:y),E.cancel=function(){void 0!==i&&clearTimeout(i),s=0,r=c=o=i=void 0},E.flush=function(){return void 0===i?l:x(d())},E}},843:(e,t)=>{"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,a=n?Symbol.for("react.fragment"):60107,l=n?Symbol.for("react.strict_mode"):60108,i=n?Symbol.for("react.profiler"):60114,c=n?Symbol.for("react.provider"):60109,s=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,m=n?Symbol.for("react.concurrent_mode"):60111,p=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,d=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,g=n?Symbol.for("react.lazy"):60116,y=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,w=n?Symbol.for("react.responder"):60118,b=n?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case m:case a:case i:case l:case f:return e;default:switch(e=e&&e.$$typeof){case s:case p:case g:case h:case c:return e;default:return t}}case o:return t}}}function E(e){return x(e)===m}t.AsyncMode=u,t.ConcurrentMode=m,t.ContextConsumer=s,t.ContextProvider=c,t.Element=r,t.ForwardRef=p,t.Fragment=a,t.Lazy=g,t.Memo=h,t.Portal=o,t.Profiler=i,t.StrictMode=l,t.Suspense=f,t.isAsyncMode=function(e){return E(e)||x(e)===u},t.isConcurrentMode=E,t.isContextConsumer=function(e){return x(e)===s},t.isContextProvider=function(e){return x(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return x(e)===p},t.isFragment=function(e){return x(e)===a},t.isLazy=function(e){return x(e)===g},t.isMemo=function(e){return x(e)===h},t.isPortal=function(e){return x(e)===o},t.isProfiler=function(e){return x(e)===i},t.isStrictMode=function(e){return x(e)===l},t.isSuspense=function(e){return x(e)===f},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===m||e===i||e===l||e===f||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===h||e.$$typeof===c||e.$$typeof===s||e.$$typeof===p||e.$$typeof===v||e.$$typeof===w||e.$$typeof===b||e.$$typeof===y)},t.typeOf=x},959:(e,t,n)=>{"use strict";e.exports=n(843)},604:(e,t)=>{"use strict";Symbol.for("react.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.context"),Symbol.for("react.server_context"),Symbol.for("react.forward_ref"),Symbol.for("react.suspense"),Symbol.for("react.suspense_list"),Symbol.for("react.memo"),Symbol.for("react.lazy"),Symbol.for("react.offscreen");Symbol.for("react.module.reference")},176:(e,t,n)=>{"use strict";n(604)}, 515:(e,t,n)=>{"use strict";t.__esModule=!0,t.default=function(e){var t=(0,o.default)(e);return{getItem:function(e){return new Promise((function(n,r){n(t.getItem(e))}))},setItem:function(e,n){return new Promise((function(r,o){r(t.setItem(e,n))}))},removeItem:function(e){return new Promise((function(n,r){n(t.removeItem(e))}))}}};var r,o=(r=n(941))&&r.__esModule?r:{default:r}},941:(e,t)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(){}t.__esModule=!0,t.default=function(e){var t="".concat(e,"Storage");return function(e){if("object"!==("undefined"==typeof self?"undefined":n(self))||!(e in self))return!1;try{var t=self[e],r="redux-persist ".concat(e," test");t.setItem(r,"test"),t.getItem(r),t.removeItem(r)}catch(e){return!1}return!0}(t)?self[t]:o};var o={getItem:r,setItem:r,removeItem:r}},274:(e,t,n)=>{"use strict";var r;t.A=void 0;var o=(0,((r=n(515))&&r.__esModule?r:{default:r}).default)("session");t.A=o},664:e=>{e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}}},392:(e,t,n)=>{"use strict";var r=n(609),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,l=r.useEffect,i=r.useLayoutEffect,c=r.useDebugValue;function s(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),o=r[0].inst,u=r[1];return i((function(){o.value=n,o.getSnapshot=t,s(o)&&u({inst:o})}),[e,n,t]),l((function(){return s(o)&&u({inst:o}),e((function(){s(o)&&u({inst:o})}))}),[e]),c(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},547:(e,t,n)=>{"use strict";var r=n(609),o=n(289),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},l=o.useSyncExternalStore,i=r.useRef,c=r.useEffect,s=r.useMemo,u=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var m=i(null);if(null===m.current){var p={hasValue:!1,value:null};m.current=p}else p=m.current;m=s((function(){function e(e){if(!c){if(c=!0,l=e,e=r(e),void 0!==o&&p.hasValue){var t=p.value;if(o(t,e))return i=t}return i=e}if(t=i,a(l,e))return t;var n=r(e);return void 0!==o&&o(t,n)?t:(l=e,i=n)}var l,i,c=!1,s=void 0===n?null:n;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]}),[t,n,r,o]);var f=l(e,m[0],m[1]);return c((function(){p.hasValue=!0,p.value=f}),[f]),u(f),f}},289:(e,t,n)=>{"use strict";e.exports=n(392)},591:(e,t,n)=>{"use strict";e.exports=n(547)},609:e=>{"use strict";e.exports=window.React}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var a=r[e]={exports:{}};return n[e](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var a=Object.create(null);o.r(a);var l={};e=e||[null,t({}),t([]),t(t)];for(var i=2&r&&n;"object"==typeof i&&!~e.indexOf(i);i=t(i))Object.getOwnPropertyNames(i).forEach((e=>l[e]=()=>n[e]));return l.default=()=>n,o.d(a,l),a},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=n[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{"use strict";const e=window.wp.element;var t=o(609),n=o.t(t,2),r=o.n(t);function a(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=a(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}const l=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=a(e))&&(r&&(r+=" "),r+=t);return r},i=e=>"number"==typeof e&&!isNaN(e),c=e=>"string"==typeof e,s=e=>"function"==typeof e,u=e=>c(e)||s(e)?e:null,m=e=>(0,t.isValidElement)(e)||c(e)||s(e)||i(e);function p(e){let{enter:n,exit:r,appendPosition:o=!1,collapse:a=!0,collapseDuration:l=300}=e;return function(e){let{children:i,position:c,preventExitTransition:s,done:u,nodeRef:m,isIn:p}=e;const f=o?`${n}--${c}`:n,d=o?`${r}--${c}`:r,h=(0,t.useRef)(0);return(0,t.useLayoutEffect)((()=>{const e=m.current,t=f.split(" "),n=r=>{r.target===m.current&&(e.dispatchEvent(new Event("d")),e.removeEventListener("animationend",n),e.removeEventListener("animationcancel",n),0===h.current&&"animationcancel"!==r.type&&e.classList.remove(...t))};e.classList.add(...t),e.addEventListener("animationend",n),e.addEventListener("animationcancel",n)}),[]),(0,t.useEffect)((()=>{const e=m.current,t=()=>{e.removeEventListener("animationend",t),a?function(e,t,n){void 0===n&&(n=300);const{scrollHeight:r,style:o}=e;requestAnimationFrame((()=>{o.minHeight="initial",o.height=r+"px",o.transition=`all ${n}ms`,requestAnimationFrame((()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(t,n)}))}))}(e,u,l):u()};p||(s?t():(h.current=1,e.className+=` ${d}`,e.addEventListener("animationend",t)))}),[p]),t.createElement(t.Fragment,null,i)}}function f(e,t){return null!=e?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const d={list:new Map,emitQueue:new Map,on(e,t){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(t),this},off(e,t){if(t){const n=this.list.get(e).filter((e=>e!==t));return this.list.set(e,n),this}return this.list.delete(e),this},cancelEmit(e){const t=this.emitQueue.get(e);return t&&(t.forEach(clearTimeout),this.emitQueue.delete(e)),this},emit(e){this.list.has(e)&&this.list.get(e).forEach((t=>{const n=setTimeout((()=>{t(...[].slice.call(arguments,1))}),0);this.emitQueue.has(e)||this.emitQueue.set(e,[]),this.emitQueue.get(e).push(n)}))}},h=e=>{let{theme:n,type:r,...o}=e;return t.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"colored"===n?"currentColor":`var(--toastify-icon-color-${r})`,...o})},g={info:function(e){return t.createElement(h,{...e},t.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return t.createElement(h,{...e},t.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return t.createElement(h,{...e},t.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return t.createElement(h,{...e},t.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return t.createElement("div",{className:"Toastify__spinner"})}};function y(e){const[,n]=(0,t.useReducer)((e=>e+1),0),[r,o]=(0,t.useState)([]),a=(0,t.useRef)(null),l=(0,t.useRef)(new Map).current,p=e=>-1!==r.indexOf(e),h=(0,t.useRef)({toastKey:1,displayedToast:0,count:0,queue:[],props:e,containerId:null,isToastActive:p,getToast:e=>l.get(e)}).current;function y(e){let{containerId:t}=e;const{limit:n}=h.props;!n||t&&h.containerId!==t||(h.count-=h.queue.length,h.queue=[])}function v(e){o((t=>null==e?[]:t.filter((t=>t!==e))))}function w(){const{toastContent:e,toastProps:t,staleId:n}=h.queue.shift();x(e,t,n)}function b(e,r){let{delay:o,staleId:p,...y}=r;if(!m(e)||function(e){return!a.current||h.props.enableMultiContainer&&e.containerId!==h.props.containerId||l.has(e.toastId)&&null==e.updateId}(y))return;const{toastId:b,updateId:E,data:S}=y,{props:k}=h,N=()=>v(b),O=null==E;O&&h.count++;const C={...k,style:k.toastStyle,key:h.toastKey++,...Object.fromEntries(Object.entries(y).filter((e=>{let[t,n]=e;return null!=n}))),toastId:b,updateId:E,data:S,closeToast:N,isIn:!1,className:u(y.className||k.toastClassName),bodyClassName:u(y.bodyClassName||k.bodyClassName),progressClassName:u(y.progressClassName||k.progressClassName),autoClose:!y.isLoading&&(j=y.autoClose,P=k.autoClose,!1===j||i(j)&&j>0?j:P),deleteToast(){const e=f(l.get(b),"removed");l.delete(b),d.emit(4,e);const t=h.queue.length;if(h.count=null==b?h.count-h.displayedToast:h.count-1,h.count<0&&(h.count=0),t>0){const e=null==b?h.props.limit:1;if(1===t||1===e)h.displayedToast++,w();else{const n=e>t?t:e;h.displayedToast=n;for(let e=0;e<n;e++)w()}}else n()}};var j,P;C.iconOut=function(e){let{theme:n,type:r,isLoading:o,icon:a}=e,l=null;const u={theme:n,type:r};return!1===a||(s(a)?l=a(u):(0,t.isValidElement)(a)?l=(0,t.cloneElement)(a,u):c(a)||i(a)?l=a:o?l=g.spinner():(e=>e in g)(r)&&(l=g[r](u))),l}(C),s(y.onOpen)&&(C.onOpen=y.onOpen),s(y.onClose)&&(C.onClose=y.onClose),C.closeButton=k.closeButton,!1===y.closeButton||m(y.closeButton)?C.closeButton=y.closeButton:!0===y.closeButton&&(C.closeButton=!m(k.closeButton)||k.closeButton);let L=e;(0,t.isValidElement)(e)&&!c(e.type)?L=(0,t.cloneElement)(e,{closeToast:N,toastProps:C,data:S}):s(e)&&(L=e({closeToast:N,toastProps:C,data:S})),k.limit&&k.limit>0&&h.count>k.limit&&O?h.queue.push({toastContent:L,toastProps:C,staleId:p}):i(o)?setTimeout((()=>{x(L,C,p)}),o):x(L,C,p)}function x(e,t,n){const{toastId:r}=t;n&&l.delete(n);const a={content:e,props:t};l.set(r,a),o((e=>[...e,r].filter((e=>e!==n)))),d.emit(4,f(a,null==a.props.updateId?"added":"updated"))}return(0,t.useEffect)((()=>(h.containerId=e.containerId,d.cancelEmit(3).on(0,b).on(1,(e=>a.current&&v(e))).on(5,y).emit(2,h),()=>{l.clear(),d.emit(3,h)})),[]),(0,t.useEffect)((()=>{h.props=e,h.isToastActive=p,h.displayedToast=r.length})),{getToastToRender:function(t){const n=new Map,r=Array.from(l.values());return e.newestOnTop&&r.reverse(),r.forEach((e=>{const{position:t}=e.props;n.has(t)||n.set(t,[]),n.get(t).push(e)})),Array.from(n,(e=>t(e[0],e[1])))},containerRef:a,isToastActive:p}}function v(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientX:e.clientX}function w(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientY:e.clientY}function b(e){const[n,r]=(0,t.useState)(!1),[o,a]=(0,t.useState)(!1),l=(0,t.useRef)(null),i=(0,t.useRef)({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,c=(0,t.useRef)(e),{autoClose:u,pauseOnHover:m,closeToast:p,onClick:f,closeOnClick:d}=e;function h(t){if(e.draggable){"touchstart"===t.nativeEvent.type&&t.nativeEvent.preventDefault(),i.didMove=!1,document.addEventListener("mousemove",x),document.addEventListener("mouseup",E),document.addEventListener("touchmove",x),document.addEventListener("touchend",E);const n=l.current;i.canCloseOnClick=!0,i.canDrag=!0,i.boundingRect=n.getBoundingClientRect(),n.style.transition="",i.x=v(t.nativeEvent),i.y=w(t.nativeEvent),"x"===e.draggableDirection?(i.start=i.x,i.removalDistance=n.offsetWidth*(e.draggablePercent/100)):(i.start=i.y,i.removalDistance=n.offsetHeight*(80===e.draggablePercent?1.5*e.draggablePercent:e.draggablePercent/100))}}function g(t){if(i.boundingRect){const{top:n,bottom:r,left:o,right:a}=i.boundingRect;"touchend"!==t.nativeEvent.type&&e.pauseOnHover&&i.x>=o&&i.x<=a&&i.y>=n&&i.y<=r?b():y()}}function y(){r(!0)}function b(){r(!1)}function x(t){const r=l.current;i.canDrag&&r&&(i.didMove=!0,n&&b(),i.x=v(t),i.y=w(t),i.delta="x"===e.draggableDirection?i.x-i.start:i.y-i.start,i.start!==i.x&&(i.canCloseOnClick=!1),r.style.transform=`translate${e.draggableDirection}(${i.delta}px)`,r.style.opacity=""+(1-Math.abs(i.delta/i.removalDistance)))}function E(){document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",E),document.removeEventListener("touchmove",x),document.removeEventListener("touchend",E);const t=l.current;if(i.canDrag&&i.didMove&&t){if(i.canDrag=!1,Math.abs(i.delta)>i.removalDistance)return a(!0),void e.closeToast();t.style.transition="transform 0.2s, opacity 0.2s",t.style.transform=`translate${e.draggableDirection}(0)`,t.style.opacity="1"}}(0,t.useEffect)((()=>{c.current=e})),(0,t.useEffect)((()=>(l.current&&l.current.addEventListener("d",y,{once:!0}),s(e.onOpen)&&e.onOpen((0,t.isValidElement)(e.children)&&e.children.props),()=>{const e=c.current;s(e.onClose)&&e.onClose((0,t.isValidElement)(e.children)&&e.children.props)})),[]),(0,t.useEffect)((()=>(e.pauseOnFocusLoss&&(document.hasFocus()||b(),window.addEventListener("focus",y),window.addEventListener("blur",b)),()=>{e.pauseOnFocusLoss&&(window.removeEventListener("focus",y),window.removeEventListener("blur",b))})),[e.pauseOnFocusLoss]);const S={onMouseDown:h,onTouchStart:h,onMouseUp:g,onTouchEnd:g};return u&&m&&(S.onMouseEnter=b,S.onMouseLeave=y),d&&(S.onClick=e=>{f&&f(e),i.canCloseOnClick&&p()}),{playToast:y,pauseToast:b,isRunning:n,preventExitTransition:o,toastRef:l,eventHandlers:S}}function x(e){let{closeToast:n,theme:r,ariaLabel:o="close"}=e;return t.createElement("button",{className:`Toastify__close-button Toastify__close-button--${r}`,type:"button",onClick:e=>{e.stopPropagation(),n(e)},"aria-label":o},t.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},t.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function E(e){let{delay:n,isRunning:r,closeToast:o,type:a="default",hide:i,className:c,style:u,controlledProgress:m,progress:p,rtl:f,isIn:d,theme:h}=e;const g=i||m&&0===p,y={...u,animationDuration:`${n}ms`,animationPlayState:r?"running":"paused",opacity:g?0:1};m&&(y.transform=`scaleX(${p})`);const v=l("Toastify__progress-bar",m?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${h}`,`Toastify__progress-bar--${a}`,{"Toastify__progress-bar--rtl":f}),w=s(c)?c({rtl:f,type:a,defaultClassName:v}):l(v,c);return t.createElement("div",{role:"progressbar","aria-hidden":g?"true":"false","aria-label":"notification timer",className:w,style:y,[m&&p>=1?"onTransitionEnd":"onAnimationEnd"]:m&&p<1?null:()=>{d&&o()}})}const S=e=>{const{isRunning:n,preventExitTransition:r,toastRef:o,eventHandlers:a}=b(e),{closeButton:i,children:c,autoClose:u,onClick:m,type:p,hideProgressBar:f,closeToast:d,transition:h,position:g,className:y,style:v,bodyClassName:w,bodyStyle:S,progressClassName:k,progressStyle:N,updateId:O,role:C,progress:j,rtl:P,toastId:L,deleteToast:_,isIn:R,isLoading:I,iconOut:A,closeOnClick:T,theme:F}=e,M=l("Toastify__toast",`Toastify__toast-theme--${F}`,`Toastify__toast--${p}`,{"Toastify__toast--rtl":P},{"Toastify__toast--close-on-click":T}),D=s(y)?y({rtl:P,position:g,type:p,defaultClassName:M}):l(M,y),G=!!j||!u,q={closeToast:d,type:p,theme:F};let V=null;return!1===i||(V=s(i)?i(q):(0,t.isValidElement)(i)?(0,t.cloneElement)(i,q):x(q)),t.createElement(h,{isIn:R,done:_,position:g,preventExitTransition:r,nodeRef:o},t.createElement("div",{id:L,onClick:m,className:D,...a,style:v,ref:o},t.createElement("div",{...R&&{role:C},className:s(w)?w({type:p}):l("Toastify__toast-body",w),style:S},null!=A&&t.createElement("div",{className:l("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!I})},A),t.createElement("div",null,c)),V,t.createElement(E,{...O&&!G?{key:`pb-${O}`}:{},rtl:P,theme:F,delay:u,isRunning:n,isIn:R,closeToast:d,hide:f,type:p,style:N,className:k,controlledProgress:G,progress:j||0})))},k=function(e,t){return void 0===t&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},N=p(k("bounce",!0)),O=(p(k("slide",!0)),p(k("zoom")),p(k("flip")),(0,t.forwardRef)(((e,n)=>{const{getToastToRender:r,containerRef:o,isToastActive:a}=y(e),{className:i,style:c,rtl:m,containerId:p}=e;function f(e){const t=l("Toastify__toast-container",`Toastify__toast-container--${e}`,{"Toastify__toast-container--rtl":m});return s(i)?i({position:e,rtl:m,defaultClassName:t}):l(t,u(i))}return(0,t.useEffect)((()=>{n&&(n.current=o.current)}),[]),t.createElement("div",{ref:o,className:"Toastify",id:p},r(((e,n)=>{const r=n.length?{...c}:{...c,pointerEvents:"none"};return t.createElement("div",{className:f(e),style:r,key:`container-${e}`},n.map(((e,r)=>{let{content:o,props:l}=e;return t.createElement(S,{...l,isIn:a(l.toastId),style:{...l.style,"--nth":r+1,"--len":n.length},key:`toast-${l.key}`},o)})))})))})));O.displayName="ToastContainer",O.defaultProps={position:"top-right",transition:N,autoClose:5e3,closeButton:x,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};let C,j=new Map,P=[],L=1;function _(){return""+L++}function R(e){return e&&(c(e.toastId)||i(e.toastId))?e.toastId:_()}function I(e,t){return j.size>0?d.emit(0,e,t):P.push({content:e,options:t}),t.toastId}function A(e,t){return{...t,type:t&&t.type||e,toastId:R(t)}}function T(e){return(t,n)=>I(t,A(e,n))}function F(e,t){return I(e,A("default",t))}F.loading=(e,t)=>I(e,A("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),F.promise=function(e,t,n){let r,{pending:o,error:a,success:l}=t;o&&(r=c(o)?F.loading(o,n):F.loading(o.render,{...n,...o}));const i={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},u=(e,t,o)=>{if(null==t)return void F.dismiss(r);const a={type:e,...i,...n,data:o},l=c(t)?{render:t}:t;return r?F.update(r,{...a,...l}):F(l.render,{...a,...l}),o},m=s(e)?e():e;return m.then((e=>u("success",l,e))).catch((e=>u("error",a,e))),m},F.success=T("success"),F.info=T("info"),F.error=T("error"),F.warning=T("warning"),F.warn=F.warning,F.dark=(e,t)=>I(e,A("default",{theme:"dark",...t})),F.dismiss=e=>{j.size>0?d.emit(1,e):P=P.filter((t=>null!=e&&t.options.toastId!==e))},F.clearWaitingQueue=function(e){return void 0===e&&(e={}),d.emit(5,e)},F.isActive=e=>{let t=!1;return j.forEach((n=>{n.isToastActive&&n.isToastActive(e)&&(t=!0)})),t},F.update=function(e,t){void 0===t&&(t={}),setTimeout((()=>{const n=function(e,t){let{containerId:n}=t;const r=j.get(n||C);return r&&r.getToast(e)}(e,t);if(n){const{props:r,content:o}=n,a={delay:100,...r,...t,toastId:t.toastId||e,updateId:_()};a.toastId!==e&&(a.staleId=e);const l=a.render||o;delete a.render,I(l,a)}}),0)},F.done=e=>{F.update(e,{progress:1})},F.onChange=e=>(d.on(4,e),()=>{d.off(4,e)}),F.POSITION={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},F.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},d.on(2,(e=>{C=e.containerId||e,j.set(C,e),P.forEach((e=>{d.emit(0,e.content,e.options)})),P=[]})).on(3,(e=>{j.delete(e.containerId||e),0===j.size&&d.off(0).off(1).off(5)}));var M=o(289),D=o(591);const G=window.ReactDOM;let q=function(e){e()};const V=()=>q,W=Symbol.for("react-redux-context"),B="undefined"!=typeof globalThis?globalThis:{};function H(){var e;if(!t.createContext)return{};const n=null!=(e=B[W])?e:B[W]=new Map;let r=n.get(t.createContext);return r||(r=t.createContext(null),n.set(t.createContext,r)),r}const z=H();function U(e=z){return function(){return(0,t.useContext)(e)}}const $=U();let Z=()=>{throw new Error("uSES not initialized!")};const Y=(e,t)=>e===t;function K(e=z){const n=e===z?$:U(e);return function(e,r={}){const{equalityFn:o=Y,stabilityCheck:a,noopCheck:l}="function"==typeof r?{equalityFn:r}:r,{store:i,subscription:c,getServerState:s,stabilityCheck:u,noopCheck:m}=n(),p=((0,t.useRef)(!0),(0,t.useCallback)({[e.name]:t=>e(t)}[e.name],[e,u,a])),f=Z(c.addNestedSub,i.getState,s||i.getState,p,o);return(0,t.useDebugValue)(f),f}}const X=K();o(35),o(176);const J={notify(){},get:()=>[]};const Q="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;let ee=null;function te(e=z){const t=e===z?$:U(e);return function(){const{store:e}=t();return e}}const ne=te();function re(e=z){const t=e===z?ne:te(e);return function(){return t().dispatch}}const oe=re();var ae;function le(e){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},le(e)}function ie(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ce(e){return ce=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ce(e)}function se(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ue(e,t){return ue=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ue(e,t)}function me(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}(e=>{Z=e})(D.useSyncExternalStoreWithSelector),(e=>{ee=e})(M.useSyncExternalStore),ae=G.unstable_batchedUpdates,q=ae;var pe,fe=function(e){function t(){var e,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return n=function(e,t){return!t||"object"!==le(t)&&"function"!=typeof t?se(e):t}(this,(e=ce(t)).call.apply(e,[this].concat(o))),me(se(n),"state",{bootstrapped:!1}),me(se(n),"_unsubscribe",void 0),me(se(n),"handlePersistorState",(function(){n.props.persistor.getState().bootstrapped&&(n.props.onBeforeLift?Promise.resolve(n.props.onBeforeLift()).finally((function(){return n.setState({bootstrapped:!0})})):n.setState({bootstrapped:!0}),n._unsubscribe&&n._unsubscribe())})),n}var n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ue(e,t)}(t,e),n=t,(r=[{key:"componentDidMount",value:function(){this._unsubscribe=this.props.persistor.subscribe(this.handlePersistorState),this.handlePersistorState()}},{key:"componentWillUnmount",value:function(){this._unsubscribe&&this._unsubscribe()}},{key:"render",value:function(){return"function"==typeof this.props.children?this.props.children(this.state.bootstrapped):this.state.bootstrapped?this.props.children:this.props.loading}}])&&ie(n.prototype,r),t}(t.PureComponent);function de(){return de=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},de.apply(this,arguments)}me(fe,"defaultProps",{children:null,loading:null}),function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(pe||(pe={}));const he="popstate";function ge(e,t){if(!1===e||null==e)throw new Error(t)}function ye(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function ve(e,t){return{usr:e.state,key:e.key,idx:t}}function we(e,t,n,r){return void 0===n&&(n=null),de({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof t?xe(t):t,{state:n,key:t&&t.key||r||Math.random().toString(36).substr(2,8)})}function be(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&"?"!==n&&(t+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(t+="#"===r.charAt(0)?r:"#"+r),t}function xe(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}var Ee;function Se(e,t,n){void 0===n&&(n="/");let r=Me(("string"==typeof t?xe(t):t).pathname||"/",n);if(null==r)return null;let o=ke(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let n=e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]));return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let a=null;for(let e=0;null==a&&e<o.length;++e){let t=Fe(r);a=Ae(o[e],t)}return a}function ke(e,t,n,r){void 0===t&&(t=[]),void 0===n&&(n=[]),void 0===r&&(r="");let o=(e,o,a)=>{let l={relativePath:void 0===a?e.path||"":a,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};l.relativePath.startsWith("/")&&(ge(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path "'+r+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),l.relativePath=l.relativePath.slice(r.length));let i=Ve([r,l.relativePath]),c=n.concat(l);e.children&&e.children.length>0&&(ge(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+i+'".'),ke(e.children,t,c,i)),(null!=e.path||e.index)&&t.push({path:i,score:Ie(i,e.index),routesMeta:c})};return e.forEach(((e,t)=>{var n;if(""!==e.path&&null!=(n=e.path)&&n.includes("?"))for(let n of Ne(e.path))o(e,t,n);else o(e,t)})),t}function Ne(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,o=n.endsWith("?"),a=n.replace(/\?$/,"");if(0===r.length)return o?[a,""]:[a];let l=Ne(r.join("/")),i=[];return i.push(...l.map((e=>""===e?a:[a,e].join("/")))),o&&i.push(...l),i.map((t=>e.startsWith("/")&&""===t?"/":t))}!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(Ee||(Ee={})),new Set(["lazy","caseSensitive","path","id","index","children"]);const Oe=/^:[\w-]+$/,Ce=3,je=2,Pe=1,Le=10,_e=-2,Re=e=>"*"===e;function Ie(e,t){let n=e.split("/"),r=n.length;return n.some(Re)&&(r+=_e),t&&(r+=je),n.filter((e=>!Re(e))).reduce(((e,t)=>e+(Oe.test(t)?Ce:""===t?Pe:Le)),r)}function Ae(e,t){let{routesMeta:n}=e,r={},o="/",a=[];for(let e=0;e<n.length;++e){let l=n[e],i=e===n.length-1,c="/"===o?t:t.slice(o.length)||"/",s=Te({path:l.relativePath,caseSensitive:l.caseSensitive,end:i},c);if(!s)return null;Object.assign(r,s.params);let u=l.route;a.push({params:r,pathname:Ve([o,s.pathname]),pathnameBase:We(Ve([o,s.pathnameBase])),route:u}),"/"!==s.pathnameBase&&(o=Ve([o,s.pathnameBase]))}return a}function Te(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),ye("*"===e||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were "'+e.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+e.replace(/\*$/,"/*")+'".');let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,n)=>(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")));return e.endsWith("*")?(r.push({paramName:"*"}),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let a=o[0],l=a.replace(/(.)\/+$/,"$1"),i=o.slice(1),c=r.reduce(((e,t,n)=>{let{paramName:r,isOptional:o}=t;if("*"===r){let e=i[n]||"";l=a.slice(0,a.length-e.length).replace(/(.)\/+$/,"$1")}const c=i[n];return e[r]=o&&!c?void 0:(c||"").replace(/%2F/g,"/"),e}),{});return{params:c,pathname:a,pathnameBase:l,pattern:e}}function Fe(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return ye(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function Me(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}function De(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the `to."+n+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function Ge(e,t){let n=function(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}(e);return t?n.map(((t,n)=>n===e.length-1?t.pathname:t.pathnameBase)):n.map((e=>e.pathnameBase))}function qe(e,t,n,r){let o;void 0===r&&(r=!1),"string"==typeof e?o=xe(e):(o=de({},e),ge(!o.pathname||!o.pathname.includes("?"),De("?","pathname","search",o)),ge(!o.pathname||!o.pathname.includes("#"),De("#","pathname","hash",o)),ge(!o.search||!o.search.includes("#"),De("#","search","hash",o)));let a,l=""===e||""===o.pathname,i=l?"/":o.pathname;if(null==i)a=n;else{let e=t.length-1;if(!r&&i.startsWith("..")){let t=i.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}a=e>=0?t[e]:"/"}let c=function(e,t){void 0===t&&(t="/");let{pathname:n,search:r="",hash:o=""}="string"==typeof e?xe(e):e,a=n?n.startsWith("/")?n:function(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(n,t):t;return{pathname:a,search:Be(r),hash:He(o)}}(o,a),s=i&&"/"!==i&&i.endsWith("/"),u=(l||"."===i)&&n.endsWith("/");return c.pathname.endsWith("/")||!s&&!u||(c.pathname+="/"),c}const Ve=e=>e.join("/").replace(/\/\/+/g,"/"),We=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Be=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",He=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";Error;const ze=["post","put","patch","delete"],Ue=(new Set(ze),["get",...ze]);function $e(){return $e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$e.apply(this,arguments)}new Set(Ue),new Set([301,302,303,307,308]),new Set([307,308]),Symbol("deferred");const Ze=t.createContext(null),Ye=t.createContext(null),Ke=t.createContext(null),Xe=t.createContext(null),Je=t.createContext({outlet:null,matches:[],isDataRoute:!1}),Qe=t.createContext(null);function et(){return null!=t.useContext(Xe)}function tt(){return et()||ge(!1),t.useContext(Xe).location}function nt(e){t.useContext(Ke).static||t.useLayoutEffect(e)}function rt(){let{isDataRoute:e}=t.useContext(Je);return e?function(){let{router:e}=function(e){let n=t.useContext(Ze);return n||ge(!1),n}(ut.UseNavigateStable),n=pt(mt.UseNavigateStable),r=t.useRef(!1);return nt((()=>{r.current=!0})),t.useCallback((function(t,o){void 0===o&&(o={}),r.current&&("number"==typeof t?e.navigate(t):e.navigate(t,$e({fromRouteId:n},o)))}),[e,n])}():function(){et()||ge(!1);let e=t.useContext(Ze),{basename:n,future:r,navigator:o}=t.useContext(Ke),{matches:a}=t.useContext(Je),{pathname:l}=tt(),i=JSON.stringify(Ge(a,r.v7_relativeSplatPath)),c=t.useRef(!1);return nt((()=>{c.current=!0})),t.useCallback((function(t,r){if(void 0===r&&(r={}),!c.current)return;if("number"==typeof t)return void o.go(t);let a=qe(t,JSON.parse(i),l,"path"===r.relative);null==e&&"/"!==n&&(a.pathname="/"===a.pathname?n:Ve([n,a.pathname])),(r.replace?o.replace:o.push)(a,r.state,r)}),[n,o,i,l,e])}()}function ot(e,n){let{relative:r}=void 0===n?{}:n,{future:o}=t.useContext(Ke),{matches:a}=t.useContext(Je),{pathname:l}=tt(),i=JSON.stringify(Ge(a,o.v7_relativeSplatPath));return t.useMemo((()=>qe(e,JSON.parse(i),l,"path"===r)),[e,i,l,r])}function at(e,n,r,o){et()||ge(!1);let{navigator:a}=t.useContext(Ke),{matches:l}=t.useContext(Je),i=l[l.length-1],c=i?i.params:{},s=(i&&i.pathname,i?i.pathnameBase:"/");i&&i.route;let u,m=tt();if(n){var p;let e="string"==typeof n?xe(n):n;"/"===s||(null==(p=e.pathname)?void 0:p.startsWith(s))||ge(!1),u=e}else u=m;let f=u.pathname||"/",d=f;if("/"!==s){let e=s.replace(/^\//,"").split("/");d="/"+f.replace(/^\//,"").split("/").slice(e.length).join("/")}let h=Se(e,{pathname:d}),g=function(e,n,r,o){var a;if(void 0===n&&(n=[]),void 0===r&&(r=null),void 0===o&&(o=null),null==e){var l;if(null==(l=r)||!l.errors)return null;e=r.matches}let i=e,c=null==(a=r)?void 0:a.errors;if(null!=c){let e=i.findIndex((e=>e.route.id&&(null==c?void 0:c[e.route.id])));e>=0||ge(!1),i=i.slice(0,Math.min(i.length,e+1))}let s=!1,u=-1;if(r&&o&&o.v7_partialHydration)for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(u=e),t.route.id){let{loaderData:e,errors:n}=r,o=t.route.loader&&void 0===e[t.route.id]&&(!n||void 0===n[t.route.id]);if(t.route.lazy||o){s=!0,i=u>=0?i.slice(0,u+1):[i[0]];break}}}return i.reduceRight(((e,o,a)=>{let l,m=!1,p=null,f=null;var d;r&&(l=c&&o.route.id?c[o.route.id]:void 0,p=o.route.errorElement||it,s&&(u<0&&0===a?(ft[d="route-fallback"]||(ft[d]=!0),m=!0,f=null):u===a&&(m=!0,f=o.route.hydrateFallbackElement||null)));let h=n.concat(i.slice(0,a+1)),g=()=>{let n;return n=l?p:m?f:o.route.Component?t.createElement(o.route.Component,null):o.route.element?o.route.element:e,t.createElement(st,{match:o,routeContext:{outlet:e,matches:h,isDataRoute:null!=r},children:n})};return r&&(o.route.ErrorBoundary||o.route.errorElement||0===a)?t.createElement(ct,{location:r.location,revalidation:r.revalidation,component:p,error:l,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):g()}),null)}(h&&h.map((e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:Ve([s,a.encodeLocation?a.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?s:Ve([s,a.encodeLocation?a.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),l,r,o);return n&&g?t.createElement(Xe.Provider,{value:{location:$e({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:pe.Pop}},g):g}function lt(){let e=function(){var e;let n=t.useContext(Qe),r=function(e){let n=t.useContext(Ye);return n||ge(!1),n}(mt.UseRouteError),o=pt(mt.UseRouteError);return void 0!==n?n:null==(e=r.errors)?void 0:e[o]}(),n=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return t.createElement(t.Fragment,null,t.createElement("h2",null,"Unexpected Application Error!"),t.createElement("h3",{style:{fontStyle:"italic"}},n),r?t.createElement("pre",{style:o},r):null,null)}const it=t.createElement(lt,null);class ct extends t.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?t.createElement(Je.Provider,{value:this.props.routeContext},t.createElement(Qe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function st(e){let{routeContext:n,match:r,children:o}=e,a=t.useContext(Ze);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),t.createElement(Je.Provider,{value:n},o)}var ut=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(ut||{}),mt=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(mt||{});function pt(e){let n=function(e){let n=t.useContext(Je);return n||ge(!1),n}(),r=n.matches[n.matches.length-1];return r.route.id||ge(!1),r.route.id}const ft={};function dt(e){ge(!1)}function ht(e){let{basename:n="/",children:r=null,location:o,navigationType:a=pe.Pop,navigator:l,static:i=!1,future:c}=e;et()&&ge(!1);let s=n.replace(/^\/*/,"/"),u=t.useMemo((()=>({basename:s,navigator:l,static:i,future:$e({v7_relativeSplatPath:!1},c)})),[s,c,l,i]);"string"==typeof o&&(o=xe(o));let{pathname:m="/",search:p="",hash:f="",state:d=null,key:h="default"}=o,g=t.useMemo((()=>{let e=Me(m,s);return null==e?null:{location:{pathname:e,search:p,hash:f,state:d,key:h},navigationType:a}}),[s,m,p,f,d,h,a]);return null==g?null:t.createElement(Ke.Provider,{value:u},t.createElement(Xe.Provider,{children:r,value:g}))}function gt(e){let{children:t,location:n}=e;return function(e,t){return at(e,t)}(yt(t),n)}function yt(e,n){void 0===n&&(n=[]);let r=[];return t.Children.forEach(e,((e,o)=>{if(!t.isValidElement(e))return;let a=[...n,o];if(e.type===t.Fragment)return void r.push.apply(r,yt(e.props.children,a));e.type!==dt&&ge(!1),e.props.index&&e.props.children&&ge(!1);let l={id:e.props.id||a.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(l.children=yt(e.props.children,a)),r.push(l)})),r}function vt(){return vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vt.apply(this,arguments)}function wt(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}t.startTransition,new Promise((()=>{})),t.Component,new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);const bt=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],xt=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"];try{window.__reactRouterVersion="6"}catch(Is){}const Et=t.createContext({isTransitioning:!1});new Map;const St=t.startTransition;function kt(e){let{basename:n,children:r,future:o,window:a}=e,l=t.useRef();var i;null==l.current&&(l.current=(void 0===(i={window:a,v5Compat:!0})&&(i={}),function(e,t,n,r){void 0===r&&(r={});let{window:o=document.defaultView,v5Compat:a=!1}=r,l=o.history,i=pe.Pop,c=null,s=u();function u(){return(l.state||{idx:null}).idx}function m(){i=pe.Pop;let e=u(),t=null==e?null:e-s;s=e,c&&c({action:i,location:f.location,delta:t})}function p(e){let t="null"!==o.location.origin?o.location.origin:o.location.href,n="string"==typeof e?e:be(e);return n=n.replace(/ $/,"%20"),ge(t,"No window.location.(origin|href) available to create URL for href: "+n),new URL(n,t)}null==s&&(s=0,l.replaceState(de({},l.state,{idx:s}),""));let f={get action(){return i},get location(){return e(o,l)},listen(e){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(he,m),c=e,()=>{o.removeEventListener(he,m),c=null}},createHref:e=>t(o,e),createURL:p,encodeLocation(e){let t=p(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){i=pe.Push;let r=we(f.location,e,t);n&&n(r,e),s=u()+1;let m=ve(r,s),p=f.createHref(r);try{l.pushState(m,"",p)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;o.location.assign(p)}a&&c&&c({action:i,location:f.location,delta:1})},replace:function(e,t){i=pe.Replace;let r=we(f.location,e,t);n&&n(r,e),s=u();let o=ve(r,s),m=f.createHref(r);l.replaceState(o,"",m),a&&c&&c({action:i,location:f.location,delta:0})},go:e=>l.go(e)};return f}((function(e,t){let{pathname:n="/",search:r="",hash:o=""}=xe(e.location.hash.substr(1));return n.startsWith("/")||n.startsWith(".")||(n="/"+n),we("",{pathname:n,search:r,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let n=e.document.querySelector("base"),r="";if(n&&n.getAttribute("href")){let t=e.location.href,n=t.indexOf("#");r=-1===n?t:t.slice(0,n)}return r+"#"+("string"==typeof t?t:be(t))}),(function(e,t){ye("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")}),i)));let c=l.current,[s,u]=t.useState({action:c.action,location:c.location}),{v7_startTransition:m}=o||{},p=t.useCallback((e=>{m&&St?St((()=>u(e))):u(e)}),[u,m]);return t.useLayoutEffect((()=>c.listen(p)),[c,p]),t.createElement(ht,{basename:n,children:r,location:s.location,navigationType:s.action,navigator:c,future:o})}G.flushSync,t.useId;const Nt="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Ot=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ct=t.forwardRef((function(e,n){let r,{onClick:o,relative:a,reloadDocument:l,replace:i,state:c,target:s,to:u,preventScrollReset:m,unstable_viewTransition:p}=e,f=wt(e,bt),{basename:d}=t.useContext(Ke),h=!1;if("string"==typeof u&&Ot.test(u)&&(r=u,Nt))try{let e=new URL(window.location.href),t=u.startsWith("//")?new URL(e.protocol+u):new URL(u),n=Me(t.pathname,d);t.origin===e.origin&&null!=n?u=n+t.search+t.hash:h=!0}catch(e){}let g=function(e,n){let{relative:r}=void 0===n?{}:n;et()||ge(!1);let{basename:o,navigator:a}=t.useContext(Ke),{hash:l,pathname:i,search:c}=ot(e,{relative:r}),s=i;return"/"!==o&&(s="/"===i?o:Ve([o,i])),a.createHref({pathname:s,search:c,hash:l})}(u,{relative:a}),y=function(e,n){let{target:r,replace:o,state:a,preventScrollReset:l,relative:i,unstable_viewTransition:c}=void 0===n?{}:n,s=rt(),u=tt(),m=ot(e,{relative:i});return t.useCallback((t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,r)){t.preventDefault();let n=void 0!==o?o:be(u)===be(m);s(e,{replace:n,state:a,preventScrollReset:l,relative:i,unstable_viewTransition:c})}}),[u,s,m,o,a,r,e,l,i,c])}(u,{replace:i,state:c,target:s,preventScrollReset:m,relative:a,unstable_viewTransition:p});return t.createElement("a",vt({},f,{href:r||g,onClick:h||l?o:function(e){o&&o(e),e.defaultPrevented||y(e)},ref:n,target:s}))})),jt=t.forwardRef((function(e,n){let{"aria-current":r="page",caseSensitive:o=!1,className:a="",end:l=!1,style:i,to:c,unstable_viewTransition:s,children:u}=e,m=wt(e,xt),p=ot(c,{relative:m.relative}),f=tt(),d=t.useContext(Ye),{navigator:h,basename:g}=t.useContext(Ke),y=null!=d&&function(e,n){void 0===n&&(n={});let r=t.useContext(Et);null==r&&ge(!1);let{basename:o}=function(e){let n=t.useContext(Ze);return n||ge(!1),n}(Pt.useViewTransitionState),a=ot(e,{relative:n.relative});if(!r.isTransitioning)return!1;let l=Me(r.currentLocation.pathname,o)||r.currentLocation.pathname,i=Me(r.nextLocation.pathname,o)||r.nextLocation.pathname;return null!=Te(a.pathname,i)||null!=Te(a.pathname,l)}(p)&&!0===s,v=h.encodeLocation?h.encodeLocation(p).pathname:p.pathname,w=f.pathname,b=d&&d.navigation&&d.navigation.location?d.navigation.location.pathname:null;o||(w=w.toLowerCase(),b=b?b.toLowerCase():null,v=v.toLowerCase()),b&&g&&(b=Me(b,g)||b);const x="/"!==v&&v.endsWith("/")?v.length-1:v.length;let E,S=w===v||!l&&w.startsWith(v)&&"/"===w.charAt(x),k=null!=b&&(b===v||!l&&b.startsWith(v)&&"/"===b.charAt(v.length)),N={isActive:S,isPending:k,isTransitioning:y},O=S?r:void 0;E="function"==typeof a?a(N):[a,S?"active":null,k?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let C="function"==typeof i?i(N):i;return t.createElement(Ct,vt({},m,{"aria-current":O,className:E,ref:n,style:C,to:c,unstable_viewTransition:s}),"function"==typeof u?u(N):u)}));var Pt,Lt;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Pt||(Pt={})),function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(Lt||(Lt={}));const _t=o.p+"images/logo.4a5282be.png";function Rt(e){var t=e.to,n=e.children;return wp.element.createElement(jt,{to:t,className:function(e){return e.isActive?"text-sky-400 focus:!shadow-none active:text-sky-400 focus:text-sky-400 hover:!text-sky-400":"focus:!shadow-none active:text-sky-400 focus:text-sky-400 hover:!text-sky-400"}},n)}const It=function(e){var t=e.children,n="h-full flex items-center justify-center mb-0";return wp.element.createElement("div",{className:"relative"},wp.element.createElement("header",{className:"bg-white px-6 items-stretch justify-between h-14 hidden md:flex"},wp.element.createElement("div",{className:"flex items-center gap-px py-4 "},wp.element.createElement("img",{className:"h-10 w-auto",src:_t,alt:"SquareWooSync"}),wp.element.createElement("nav",{className:"h-full ml-2"},wp.element.createElement("ul",{className:"flex items-center h-full gap-4 justify-center divide-x divide-gray-200 font-semibold "},wp.element.createElement("li",{className:n},wp.element.createElement(Rt,{to:"/"},"Dashboard")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement(Rt,{to:"/inventory"},"Products")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement(Rt,{to:"/customers"},"Customers")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement(Rt,{to:"/loyalty"},"Loyalty")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement(Rt,{to:"/orders"},"Orders")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement(Rt,{to:"/settings/general"},"Settings")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement("a",{target:"_blank",href:"https://squaresyncforwoo.com/documentation",className:function(e){return e.isActive?"text-sky-400 focus:!shadow-none active:text-sky-400 focus:text-sky-400 hover:!text-sky-400":"focus:!shadow-none active:text-sky-400 focus:text-sky-400 hover:!text-sky-400"}},"Documentation")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement("a",{target:"_blank",href:"https://squaresyncforwoo.com",className:"text-green-500 font-bold"},"GO PRO")))))),wp.element.createElement("main",{className:" mx-auto pb-20 mt-6 px-6"},t))},At=function(){return wp.element.createElement("span",{className:"inline-flex items-center rounded-full bg-purple-100 px-1.5 py-0.5 text-xs font-medium text-purple-700"},"PRO ONLY")};function Tt(){return wp.element.createElement("div",{className:"bg-white p-6 rounded-xl not-prose grid grid-cols-1 gap-6 sm:grid-cols-2 w-full"},wp.element.createElement("header",{className:"mb-2 col-span-full flex flex-col"},wp.element.createElement("p",{className:" text-sm font-medium text-sky-500"},"Introduction"),wp.element.createElement("h1",{className:"text-3xl tracking-tight text-slate-900 font-bold "},"Getting started"),wp.element.createElement("p",{className:"text-xl text-gray-600 mt-2"},"Welcome to SquareWooSync. See below to learn how to start importing and syncronizing products with Square and Woo.")),wp.element.createElement("div",{className:"group relative rounded-xl border border-slate-400 "},wp.element.createElement("div",{className:"absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.sky.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 "}),wp.element.createElement("div",{className:"relative overflow-hidden rounded-xl p-6"},wp.element.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 32 32",fill:"none",className:"h-8 w-8 [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"},wp.element.createElement("defs",null,wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S3:-gradient",gradientTransform:"matrix(0 21 -21 0 20 11)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S3:-gradient-dark-1",gradientTransform:"matrix(0 22.75 -22.75 0 16 6.25)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S3:-gradient-dark-2",gradientTransform:"matrix(0 14 -14 0 16 10)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"}))),wp.element.createElement("g",{className:""},wp.element.createElement("circle",{cx:"20",cy:"20",r:"12",fill:"url(#:S3:-gradient)"}),wp.element.createElement("g",{fillOpacity:"0.5",className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},wp.element.createElement("path",{d:"M3 9v14l12 6V15L3 9Z"}),wp.element.createElement("path",{d:"M27 9v14l-12 6V15l12-6Z"})),wp.element.createElement("path",{d:"M11 4h8v2l6 3-10 6L5 9l6-3V4Z",fillOpacity:"0.5",className:"fill-[var(--icon-background)]"}),wp.element.createElement("g",{className:"stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},wp.element.createElement("path",{d:"M20 5.5 27 9l-12 6L3 9l7-3.5"}),wp.element.createElement("path",{d:"M20 5c0 1.105-2.239 2-5 2s-5-.895-5-2m10 0c0-1.105-2.239-2-5-2s-5 .895-5 2m10 0v3c0 1.105-2.239 2-5 2s-5-.895-5-2V5"}))),wp.element.createElement("g",{className:"hidden ",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},wp.element.createElement("path",{d:"M17.676 3.38a3.887 3.887 0 0 0-3.352 0l-9 4.288C3.907 8.342 3 9.806 3 11.416v9.168c0 1.61.907 3.073 2.324 3.748l9 4.288a3.887 3.887 0 0 0 3.352 0l9-4.288C28.093 23.657 29 22.194 29 20.584v-9.168c0-1.61-.907-3.074-2.324-3.748l-9-4.288Z",stroke:"url(#:S3:-gradient-dark-1)"}),wp.element.createElement("path",{d:"M16.406 8.087a.989.989 0 0 0-.812 0l-7 3.598A1.012 1.012 0 0 0 8 12.61v6.78c0 .4.233.762.594.925l7 3.598a.989.989 0 0 0 .812 0l7-3.598c.361-.163.594-.525.594-.925v-6.78c0-.4-.233-.762-.594-.925l-7-3.598Z",fill:"url(#:S3:-gradient-dark-2)",stroke:"url(#:S3:-gradient-dark-2)"}))),wp.element.createElement("h2",{className:"mt-4 text-base text-slate-900 "},wp.element.createElement("a",{href:"/wp-admin/admin.php?page=squarewoosync#/inventory"},wp.element.createElement("span",{className:"absolute -inset-px rounded-xl"}),"Start a new import")),wp.element.createElement("p",{className:"mt-1 text-sm text-slate-700 "},"Click here to begin importing or syncronizing products from Square to Woo"))),wp.element.createElement("div",{className:"group relative rounded-xl border border-slate-400 "},wp.element.createElement("div",{className:"absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.sky.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 "}),wp.element.createElement("div",{className:"relative overflow-hidden rounded-xl p-6"},wp.element.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 32 32",fill:"none",className:"h-8 w-8 [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"},wp.element.createElement("defs",null,wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S1:-gradient",gradientTransform:"matrix(0 21 -21 0 12 3)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S1:-gradient-dark",gradientTransform:"matrix(0 21 -21 0 16 7)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"}))),wp.element.createElement("g",{className:""},wp.element.createElement("circle",{cx:"12",cy:"12",r:"12",fill:"url(#:S1:-gradient)"}),wp.element.createElement("path",{d:"m8 8 9 21 2-10 10-2L8 8Z",fillOpacity:"0.5",className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),wp.element.createElement("g",{className:"hidden "},wp.element.createElement("path",{d:"m4 4 10.286 24 2.285-11.429L28 14.286 4 4Z",fill:"url(#:S1:-gradient-dark)",stroke:"url(#:S1:-gradient-dark)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}))),wp.element.createElement("h2",{className:"mt-4 text-base text-slate-900 "},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/documentation",target:"_blank"},wp.element.createElement("span",{className:"absolute -inset-px rounded-xl"}),"Installation")),wp.element.createElement("p",{className:"mt-1 text-sm text-slate-700 "},"Step-by-step guides to setting up your Square account and Woo to talk to each other"))),wp.element.createElement("div",{className:"group relative rounded-xl border border-slate-400 "},wp.element.createElement("div",{className:"absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.sky.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 "}),wp.element.createElement("div",{className:"relative overflow-hidden rounded-xl p-6"},wp.element.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 32 32",fill:"none",className:"h-8 w-8 [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"},wp.element.createElement("defs",null,wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S2:-gradient",gradientTransform:"matrix(0 21 -21 0 20 3)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S2:-gradient-dark",gradientTransform:"matrix(0 22.75 -22.75 0 16 6.25)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"}))),wp.element.createElement("g",{className:""},wp.element.createElement("circle",{cx:"20",cy:"12",r:"12",fill:"url(#:S2:-gradient)"}),wp.element.createElement("g",{className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",fillOpacity:"0.5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},wp.element.createElement("path",{d:"M3 5v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2Z"}),wp.element.createElement("path",{d:"M18 17v10a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2V17a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2Z"}),wp.element.createElement("path",{d:"M18 5v4a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2Z"}),wp.element.createElement("path",{d:"M3 25v2a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2v-2a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2Z"}))),wp.element.createElement("g",{className:"hidden ",fill:"url(#:S2:-gradient-dark)"},wp.element.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 17V4a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1Zm16 10v-9a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2Zm0-23v5a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1h-8a1 1 0 0 0-1 1ZM3 28v-3a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1Z"}),wp.element.createElement("path",{d:"M2 4v13h2V4H2Zm2-2a2 2 0 0 0-2 2h2V2Zm8 0H4v2h8V2Zm2 2a2 2 0 0 0-2-2v2h2Zm0 13V4h-2v13h2Zm-2 2a2 2 0 0 0 2-2h-2v2Zm-8 0h8v-2H4v2Zm-2-2a2 2 0 0 0 2 2v-2H2Zm16 1v9h2v-9h-2Zm3-3a3 3 0 0 0-3 3h2a1 1 0 0 1 1-1v-2Zm6 0h-6v2h6v-2Zm3 3a3 3 0 0 0-3-3v2a1 1 0 0 1 1 1h2Zm0 9v-9h-2v9h2Zm-3 3a3 3 0 0 0 3-3h-2a1 1 0 0 1-1 1v2Zm-6 0h6v-2h-6v2Zm-3-3a3 3 0 0 0 3 3v-2a1 1 0 0 1-1-1h-2Zm2-18V4h-2v5h2Zm0 0h-2a2 2 0 0 0 2 2V9Zm8 0h-8v2h8V9Zm0 0v2a2 2 0 0 0 2-2h-2Zm0-5v5h2V4h-2Zm0 0h2a2 2 0 0 0-2-2v2Zm-8 0h8V2h-8v2Zm0 0V2a2 2 0 0 0-2 2h2ZM2 25v3h2v-3H2Zm2-2a2 2 0 0 0-2 2h2v-2Zm9 0H4v2h9v-2Zm2 2a2 2 0 0 0-2-2v2h2Zm0 3v-3h-2v3h2Zm-2 2a2 2 0 0 0 2-2h-2v2Zm-9 0h9v-2H4v2Zm-2-2a2 2 0 0 0 2 2v-2H2Z"}))),wp.element.createElement("h2",{className:"mt-4 text-base text-slate-900 "},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/documentation#import-data",target:"_blank"},wp.element.createElement("span",{className:"absolute -inset-px rounded-xl"}),"Controlling your import data")),wp.element.createElement("p",{className:"mt-1 text-sm text-slate-700 "},"Learn how the internals work and how you can choose which data you would like to sync."))),wp.element.createElement("div",{className:"group relative rounded-xl border border-slate-400 "},wp.element.createElement("div",{className:"absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.sky.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 "}),wp.element.createElement("div",{className:"relative overflow-hidden rounded-xl p-6"},wp.element.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 32 32",fill:"none",className:"h-8 w-8 [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"},wp.element.createElement("defs",null,wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S4:-gradient",gradientTransform:"matrix(0 21 -21 0 12 11)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S4:-gradient-dark",gradientTransform:"matrix(0 24.5 -24.5 0 16 5.5)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"}))),wp.element.createElement("g",{className:""},wp.element.createElement("circle",{cx:"12",cy:"20",r:"12",fill:"url(#:S4:-gradient)"}),wp.element.createElement("path",{d:"M27 12.13 19.87 5 13 11.87v14.26l14-14Z",className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",fillOpacity:"0.5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),wp.element.createElement("path",{d:"M3 3h10v22a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V3Z",className:"fill-[var(--icon-background)]",fillOpacity:"0.5"}),wp.element.createElement("path",{d:"M3 9v16a4 4 0 0 0 4 4h2a4 4 0 0 0 4-4V9M3 9V3h10v6M3 9h10M3 15h10M3 21h10",className:"stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),wp.element.createElement("path",{d:"M29 29V19h-8.5L13 26c0 1.5-2.5 3-5 3h21Z",fillOpacity:"0.5",className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),wp.element.createElement("g",{className:"hidden "},wp.element.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 2a1 1 0 0 0-1 1v21a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H3Zm16.752 3.293a1 1 0 0 0-1.593.244l-1.045 2A1 1 0 0 0 17 8v13a1 1 0 0 0 1.71.705l7.999-8.045a1 1 0 0 0-.002-1.412l-6.955-6.955ZM26 18a1 1 0 0 0-.707.293l-10 10A1 1 0 0 0 16 30h13a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1h-3ZM5 18a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2H5Zm-1-5a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Zm1-7a1 1 0 0 0 0 2h6a1 1 0 1 0 0-2H5Z",fill:"url(#:S4:-gradient-dark)"}))),wp.element.createElement("h2",{className:"mt-4 text-base text-slate-900 "},wp.element.createElement("a",{href:"/wp-admin/admin.php?page=squarewoosync#/settings/general"},wp.element.createElement("span",{className:"absolute -inset-px rounded-xl"}),"Settings")),wp.element.createElement("p",{className:"mt-1 text-sm text-slate-700 "},"Manage your access token, import data and webhook url for automatic synchronization"))))}const Ft=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 0 1-.825-.242m9.345-8.334a2.126 2.126 0 0 0-.476-.095 48.64 48.64 0 0 0-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0 0 11.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155"}))})),Mt=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 12.75c1.148 0 2.278.08 3.383.237 1.037.146 1.866.966 1.866 2.013 0 3.728-2.35 6.75-5.25 6.75S6.75 18.728 6.75 15c0-1.046.83-1.867 1.866-2.013A24.204 24.204 0 0 1 12 12.75Zm0 0c2.883 0 5.647.508 8.207 1.44a23.91 23.91 0 0 1-1.152 6.06M12 12.75c-2.883 0-5.647.508-8.208 1.44.125 2.104.52 4.136 1.153 6.06M12 12.75a2.25 2.25 0 0 0 2.248-2.354M12 12.75a2.25 2.25 0 0 1-2.248-2.354M12 8.25c.995 0 1.971-.08 2.922-.236.403-.066.74-.358.795-.762a3.778 3.778 0 0 0-.399-2.25M12 8.25c-.995 0-1.97-.08-2.922-.236-.402-.066-.74-.358-.795-.762a3.734 3.734 0 0 1 .4-2.253M12 8.25a2.25 2.25 0 0 0-2.248 2.146M12 8.25a2.25 2.25 0 0 1 2.248 2.146M8.683 5a6.032 6.032 0 0 1-1.155-1.002c.07-.63.27-1.222.574-1.747m.581 2.749A3.75 3.75 0 0 1 15.318 5m0 0c.427-.283.815-.62 1.155-.999a4.471 4.471 0 0 0-.575-1.752M4.921 6a24.048 24.048 0 0 0-.392 3.314c1.668.546 3.416.914 5.223 1.082M19.08 6c.205 1.08.337 2.187.392 3.314a23.882 23.882 0 0 1-5.223 1.082"}))})),Dt=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25"}))}));function Gt(){return wp.element.createElement("div",{className:"isolate bg-white p-5 rounded-xl"},wp.element.createElement("div",{className:""},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 "},"Support"),wp.element.createElement("p",{className:"leading-8 text-gray-600"})),wp.element.createElement("div",{className:"mt-3 space-y-4"},wp.element.createElement("div",{className:"flex gap-x-4"},wp.element.createElement("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-sky-600"},wp.element.createElement(Ft,{className:"h-6 w-6 text-white","aria-hidden":"true"})),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-sm font-semibold text-gray-900"},"Sales/License support"),wp.element.createElement("p",{className:" text-gray-600"},"Wish to talk to us about your licence or have another questions related to sales?"),wp.element.createElement("p",{className:""},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/my-account/support-portal/",target:"_blank",className:"text-sm font-semibold text-sky-600"},"Contact us"," ",wp.element.createElement("span",{"aria-hidden":"true"},"→"))))),wp.element.createElement("div",{className:"flex gap-x-4"},wp.element.createElement("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-sky-600"},wp.element.createElement(Mt,{className:"h-6 w-6 text-white","aria-hidden":"true"})),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-sm font-semibold text-gray-900"},"Bug reports"),wp.element.createElement("p",{className:" text-gray-600"},"Found a bug? Let us know so we can jump on it right away! And thank you for your help!"),wp.element.createElement("p",{className:""},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/my-account/support-portal/",target:"_blank",className:"text-sm font-semibold leading-6 text-sky-600"},"Report a bug"," ",wp.element.createElement("span",{"aria-hidden":"true"},"→"))))),wp.element.createElement("div",{className:"flex gap-x-4"},wp.element.createElement("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-sky-600"},wp.element.createElement(Dt,{className:"h-6 w-6 text-white","aria-hidden":"true"})),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-sm font-semibold text-gray-900"},"Technical support"),wp.element.createElement("p",{className:" text-gray-600"},"Can't figure out how to setup this plugin or having another technical issue? Let us know and we would be glad to assist you."),wp.element.createElement("p",{className:""},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/#contact",target:"_blank",className:"text-sm font-semibold text-sky-600"},"Contact us"," ",wp.element.createElement("span",{"aria-hidden":"true"},"→")))))))}const qt=window.wp.apiFetch;var Vt=o.n(qt);function Wt(e){return Wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wt(e)}function Bt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ht(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bt(Object(n),!0).forEach((function(t){zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function zt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Wt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Wt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Wt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Vt().use((function(e,t){return e.headers=Ht(Ht({},e.headers),{},{nonce:swsData.nonce}),t(e)}));const Ut=Vt(),$t=window.moment;var Zt=o.n($t);const Yt=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z",clipRule:"evenodd"}))})),Kt=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-8-5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0v-4.5A.75.75 0 0 1 10 5Zm0 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"}))})),Xt=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-7-4a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM9 9a.75.75 0 0 0 0 1.5h.253a.25.25 0 0 1 .244.304l-.459 2.066A1.75 1.75 0 0 0 10.747 15H11a.75.75 0 0 0 0-1.5h-.253a.25.25 0 0 1-.244-.304l.459-2.066A1.75 1.75 0 0 0 9.253 9H9Z",clipRule:"evenodd"}))})),Jt=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))})),Qt=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"}))}));function en(e){return en="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},en(e)}function tn(){tn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==en(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(en(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function nn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function rn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nn(Object(n),!0).forEach((function(t){on(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function on(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=en(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=en(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==en(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function an(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function ln(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return cn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cn(e,t):void 0}}(e,t)||function(){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 cn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const sn=function(){var t=ln((0,e.useState)([]),2),n=t[0],r=t[1],o=ln((0,e.useState)(null),2),a=(o[0],o[1]);(0,e.useEffect)((function(){var e=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){an(a,r,o,l,i,"next",e)}function i(e){an(a,r,o,l,i,"throw",e)}l(void 0)}))}}(tn().mark((function e(){var t,n,o;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Ut({path:"/sws/v1/logs",method:"GET"});case 3:if(!((t=e.sent)instanceof Error||401===t.status)){e.next=7;break}return console.error("Error fetching logs:",t.message),e.abrupt("return");case 7:t.logs&&(n={},t.logs.forEach((function(e){var t=e.context;if(t&&t.parent_id){var r=t.parent_id;n[r]||(n[r]={children:[]}),n[r].children.push(e)}else{var o=t.process_id||e.id;n[o]?n[o]=rn(rn({},e),{},{children:n[o].children}):n[o]=rn(rn({},e),{},{children:[]})}})),o=Object.values(n).filter((function(e){return e.id})).map((function(e){return rn(rn({},e),{},{children:e.children.sort((function(e,t){return Zt()(t.timestamp).valueOf()-Zt()(e.timestamp).valueOf()}))})})).sort((function(e,t){return Zt()(t.timestamp).valueOf()-Zt()(e.timestamp).valueOf()})),r(o)),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),console.error("Failed to fetch logs:",e.t0);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(){return e.apply(this,arguments)}}();e();var t=setInterval(e,3e4);return a(t),function(){return clearInterval(t)}}),[]);var l=function(e){var t=e.log,r=e.isSummary,o=e.isChild;return wp.element.createElement("div",{className:"relative pb-4 ".concat(r?"flex justify-between items-center":"")},t.id===n[n.length-1].id||o?null:wp.element.createElement("span",{className:"absolute left-5 top-5 -ml-px h-full w-0.5 bg-gray-200","aria-hidden":"true"}),wp.element.createElement("div",{className:"flex items-start space-x-3 ".concat(o&&"ml-10")},wp.element.createElement("div",null,wp.element.createElement("div",{className:"relative px-1"},wp.element.createElement("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-gray-100 ring-8 ring-white"},"success"===t.log_level?wp.element.createElement(Yt,{className:"h-5 w-5 text-green-500","aria-hidden":"true"}):"error"===t.log_level||"failed"===t.log_level?wp.element.createElement(Kt,{className:"h-5 w-5 text-red-500","aria-hidden":"true"}):wp.element.createElement(Xt,{className:"h-5 w-5 text-blue-500","aria-hidden":"true"})))),wp.element.createElement("div",{className:"min-w-0 flex-1"},wp.element.createElement("p",{className:"text-sm text-gray-500 whitespace-nowrap"},Zt()(t.timestamp).format("MMM D h:mma")),wp.element.createElement("p",null,t.message)),r&&wp.element.createElement(Jt,{className:"h-5 w-5 text-gray-400"})))};return wp.element.createElement("div",{className:" bg-white rounded-xl p-5 w-full"},wp.element.createElement("h3",{className:"text-base font-semibold text-gray-900 mb-6 flex justify-start items-center gap-2"},wp.element.createElement(Qt,{className:"w-6 h-6"}),"Sync Feed",wp.element.createElement("span",{className:"text-xs text-gray-500 font-normal mt-[1px] -ml-1"}," ","- Shows last 1000 logs")),n.length<1&&wp.element.createElement("p",null,"No data, starting import/syncing to view logs"),wp.element.createElement("ul",{role:"list",className:"overflow-auto max-h-[1042px] h-auto overflow-y-auto"},n.map((function(e,t){return wp.element.createElement("li",{key:e.id||"parent-".concat(t)},e.children&&e.children.length>0?wp.element.createElement("details",{open:!0,className:"log-details"},wp.element.createElement("summary",{className:"list-none"},wp.element.createElement(l,{log:e,isChild:!1,isSummary:!0})),e.children.map((function(e){return wp.element.createElement(l,{key:e.id,log:e,isChild:!0})}))):wp.element.createElement(l,{log:e,isChild:!1}))}))))};var un="squarewoosync";function mn(){var t=tt();return(0,e.useEffect)((function(){!function(){var e=jQuery,t=e("#toplevel_page_"+un),n=window.location.href,r=n.substr(n.indexOf("admin.php"));e("ul.wp-submenu li",t).removeClass("current"),t.on("click","a",(function(){var n=e(this);e("ul.wp-submenu li",t).removeClass("current"),n.hasClass("wp-has-submenu")?e("li.wp-first-item",t).addClass("current"):n.parents("li").addClass("current")}));var o=r.split("/");e("ul.wp-submenu a",t).each((function(t,n){void 0!==o[1]&&o[1];var a=!1;e(n).attr("href")===r&&(a=!0),a&&e(n).parent().addClass("current")}))}()}),[t.pathname]),null}function pn(e){var t=e.cron;return wp.element.createElement("section",{className:" bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-start justify-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"#000",className:"w-6 h-6"},wp.element.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})),wp.element.createElement(At,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic scheduler is ",t&&t.status?"on":"off"),t&&t.status?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.status?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"text-gray-500 "},"The next automatic data sync to"," ",wp.element.createElement("span",{className:"text-sky-500"},t.direction)," will occur:"," ",wp.element.createElement("br",null),wp.element.createElement("span",{className:"text-sky-500"},t.next_run),t.time_until_next_run.length>0&&wp.element.createElement(React.Fragment,null,","," ",wp.element.createElement("span",{className:"text-sky-500"},"(",t.time_until_next_run,")"))),wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"The following data will be synced:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},Object.keys(t.data_to_import).filter((function(e){return t.data_to_import[e]})).map((function(e,t,n){return wp.element.createElement("span",{key:e},wp.element.createElement("span",{className:"text-sky-500"},e),t!==n.length-1?", ":"")})))):wp.element.createElement("p",{className:"mt-2 text-gray-500 "},"Automatic scheduler is currently disabled."))}function fn(e){var t=e.wooAuto;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5"},wp.element.createElement("polyline",{points:"17 1 21 5 17 9"}),wp.element.createElement("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),wp.element.createElement("polyline",{points:"7 23 3 19 7 15"}),wp.element.createElement("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})),wp.element.createElement(At,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time automatic sync from Woo to Square is ",t&&t.isActive?"on":"off"),t&&t.isActive?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.isActive?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-2 text-gray-500 "},"The following data will be synced on new woocommerce orders:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},wp.element.createElement("span",{className:"text-sky-500"},"stock"))):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatical sync is currently disabled."))}function dn(e){var t=e.squareAuto;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5"},wp.element.createElement("polyline",{points:"17 1 21 5 17 9"}),wp.element.createElement("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),wp.element.createElement("polyline",{points:"7 23 3 19 7 15"}),wp.element.createElement("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})),wp.element.createElement(At,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time automatic sync from Square to Woo is ",t&&t.isActive?"on":"off"),t&&t.isActive?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.isActive?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"The following data will be synced:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},Object.keys(t).filter((function(e){return("stock"===e||"title"===e||"description"===e||"sku"===e||"images"===e||"category"===e||"price"===e)&&!0===t[e]})).map((function(e,t,n){return wp.element.createElement("span",{key:e},wp.element.createElement("span",{className:"text-sky-500"},e),t!==n.length-1?", ":"")})))):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatic sync from Square to Woocommerce is currently disabled."))}function hn(e){var t=e.wooAuto;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5 text-black"},wp.element.createElement("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),wp.element.createElement("line",{x1:"12",y1:"8",x2:"12",y2:"16"}),wp.element.createElement("line",{x1:"8",y1:"12",x2:"16",y2:"12"})),wp.element.createElement(At,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Auto product creation is ",null!=t&&t.autoCreateProduct||null!=t&&t.autoWooCreation?"on":"off"),null!=t&&t.autoCreateProduct||null!=t&&t.autoWooCreation?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500"},t&&t.autoCreateProduct&&t.autoWooCreation?"Products are being automatically created both ways between WooCommerce and Square.":t&&t.autoCreateProduct?"When a new product is created in WooCommerce, it will automatically be created in Square.":t&&t.autoWooCreation?"When a new product is created in Square, it will automatically be created in WooCommerce.":"Auto product creation is currently disabled."),!(null!=t&&t.autoCreateProduct)&&!(null!=t&&t.autoWooCreation)&&wp.element.createElement("p",{className:"text-gray-500"})))}function gn(e){var t=e.orders,n=e.gatewaySettings;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full text-black"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5 text-black"},wp.element.createElement("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),wp.element.createElement("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Auto sync of orders, transactions and customers is ",t&&t.enabled||n&&"yes"===n.enabled?"on":"off"),t&&t.enabled||n&&"yes"===n.enabled?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.enabled||n&&"yes"===n.enabled?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"When a new order is created with a status of ",wp.element.createElement("span",{className:"text-sky-500"},'"',t.stage,'"'),", a corresponding order, transaction and customer will be created in Square.")):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Auto orders, transactions and customer sync to Square is currently disabled. To enable, to go the order settings ",wp.element.createElement(Ct,{to:"/settings/orders",className:"text-sky-500"},"here"),"."))}const yn=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"}))}));function vn(e){var t=e.squareWoo;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("div",{className:"flex gap-2 items-center"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5"},wp.element.createElement("polyline",{points:"17 1 21 5 17 9"}),wp.element.createElement("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),wp.element.createElement("polyline",{points:"7 23 3 19 7 15"}),wp.element.createElement("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})),wp.element.createElement(yn,{className:"w-5 h-5"}),wp.element.createElement(At,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Customer real-time automatic sync from Square to Woo is ",t&&t.is_active?"on":"off"),t&&t.is_active?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.is_active?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"The following data will be synced:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},Object.keys(t).filter((function(e){return("first_name"===e||"last_name"===e||"phone"===e||"role"===e||"address"===e)&&!0===t[e]})).map((function(e,t,n){return wp.element.createElement("span",{key:e},wp.element.createElement("span",{className:"text-sky-500"},e.replace("_"," ")),t!==n.length-1?", ":"")})))):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatic sync of customers from Square to Woocommerce is currently disabled."))}function wn(e){var t=e.wooSquare;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("div",{className:"flex gap-2 items-center"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5"},wp.element.createElement("polyline",{points:"17 1 21 5 17 9"}),wp.element.createElement("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),wp.element.createElement("polyline",{points:"7 23 3 19 7 15"}),wp.element.createElement("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})),wp.element.createElement(yn,{className:"w-5 h-5"}),wp.element.createElement(At,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Customer real-time automatic sync from Woo to Square is ",t&&t.is_active?"on":"off"),t&&t.is_active?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.is_active?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"The following data will be synced:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},Object.keys(t).filter((function(e){return("first_name"===e||"last_name"===e||"phone"===e||"role"===e||"address"===e)&&!0===t[e]})).map((function(e,t,n){return wp.element.createElement("span",{key:e},wp.element.createElement("span",{className:"text-sky-500"},e.replace("_"," ")),t!==n.length-1?", ":"")})))):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatic sync of customers from Square to Woocommerce is currently disabled."))}const bn=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}));function xn(e){var t=e.wooAuto,n=e.squareAuto;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement(bn,{className:"w-5"}),wp.element.createElement(At,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time automatic delete/archive is ",t&&t.autoDeleteProduct||n&&n.autoDeleteProduct?"on":"off"),t&&t.autoDeleteProduct||n&&n.autoDeleteProduct?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.autoDeleteProduct||n&&n.autoDeleteProduct?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-2 text-gray-500 "},"When a product is deleted/archived in ",t.autoDeleteProduct?"WooCommerce":"Square",", it will also be deleted/archived in ",t.autoDeleteProduct?"Square":"WooCommerce")):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatic sync is currently disabled."))}function En(e){return En="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},En(e)}function Sn(){Sn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==En(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(En(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function kn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Nn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?kn(Object(n),!0).forEach((function(t){On(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function On(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=En(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=En(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==En(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cn(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function jn(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){Cn(a,r,o,l,i,"next",e)}function i(e){Cn(a,r,o,l,i,"throw",e)}l(void 0)}))}}function Pn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ln(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ln(e,t):void 0}}(e,t)||function(){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 Ln(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}(0,e.createContext)();var Rn=(0,t.createContext)(),In=function(e){var n=e.children,r=Pn((0,t.useState)(!0),2),o=r[0],a=r[1],l=Pn((0,t.useState)({environment:"live",location:"",iventory:{isFetching:0},squareAuto:{isActive:!1,stock:!0,sku:!0,title:!0,description:!0,images:!0,price:!0,category:!0,attributesDisabled:!1},wooAuto:{autoCreateProduct:!1,autoWooCreation:!1,isActive:!1,stock:!1,sku:!0,title:!1,description:!1,images:!1,category:!1,price:!1,allLocationsStock:!1},orders:{enabled:!1,transactions:!1,stage:"processing",pickupMethod:"local_pickup",statusSync:!1,orderImport:!1,orderImportAllLocations:!1},cron:{enabled:!1,source:"square",schedule:"hourly",batches:30,data_to_import:{stock:!1,sku:!1,title:!1,description:!1,images:!1,category:!1,price:!1}},customers:{isFetching:0,roleMappings:[],filters:{group:0,segment:0},auto:{squareWoo:{is_active:!1,first_name:!1,last_name:!1,phone:!1,role:!1,address:!1},wooSquare:{is_active:!1,first_name:!1,last_name:!1,phone:!1,role:!1,address:!1}}},loyalty:{enabled:!1,program:null,method:"square",redemptionMethod:"square",redeem:!1},accessToken:null,exportStatus:0,exportSynced:1,exportResults:null}),2),i=l[0],c=l[1];(0,t.useEffect)((function(){var e=function(){var e=jn(Sn().mark((function e(){var t;return Sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Vt()({path:"/sws/v1/settings",method:"GET"});case 3:t=e.sent,c((function(e){return Nn(Nn({},e),t)})),a(!1),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),a(!1),F({render:"Failed to update settings: "+e.t0.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 12:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}();e()}),[]);var s=function(){var e=jn(Sn().mark((function e(t,n){var r,o;return Sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=F.loading("Updating setting: ".concat(t)),e.prev=1,e.next=4,Vt()({path:"/sws/v1/settings",method:"POST",data:On({},t,n)});case 4:(o=e.sent)&&(console.log(o),F.update(r,{render:"".concat(t," updated successfully"),type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),c((function(e){return Nn(Nn({},e),o)}))),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),F.update(r,{render:"Failed to update ".concat(t,": ").concat(e.t0.message),type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(_x,t){return e.apply(this,arguments)}}(),u=function(){var e=jn(Sn().mark((function e(){var t,n,r,o=arguments;return Sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=(o.length>0&&void 0!==o[0]?o[0]:{}).silent,n=void 0!==t&&t,e.prev=1,e.next=4,Vt()({path:"/sws/v1/settings/access-token",method:"GET"});case 4:if(!(r=e.sent).access_token||"Token not set or empty"===r.access_token){e.next=11;break}return c((function(e){return Nn(Nn({},e),{},{accessToken:r.access_token})})),n||F.success("Access token retrieved successfully"),e.abrupt("return",r.access_token);case 11:return n||F.warning("Access token not set"),e.abrupt("return",null);case 13:e.next=19;break;case 15:throw e.prev=15,e.t0=e.catch(1),F.error("Failed to retrieve access token: ".concat(e.t0.message)),e.t0;case 19:case"end":return e.stop()}}),e,null,[[1,15]])})));return function(){return e.apply(this,arguments)}}();(0,t.useEffect)((function(){u()}),[]);var m=function(){var e=jn(Sn().mark((function e(t){var n,r;return Sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=F.loading("Updating access token"),e.prev=1,e.next=4,Vt()({path:"/sws/v1/settings/access-token",method:"POST",data:{access_token:t}});case 4:if(200!==(r=e.sent).status){e.next=10;break}c((function(e){return Nn(Nn({},e),{},{accessToken:t})})),F.update(n,{render:"Access token updated successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.next=11;break;case 10:throw new Error(r.message);case 11:e.next=16;break;case 13:e.prev=13,e.t0=e.catch(1),F.update(n,{render:"Failed to update access token: ".concat(e.t0.message),type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 16:case"end":return e.stop()}}),e,null,[[1,13]])})));return function(t){return e.apply(this,arguments)}}(),p=function(){var e=jn(Sn().mark((function e(){var t;return Sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=F.loading("Removing access token"),e.prev=1,e.next=4,Vt()({path:"/sws/v1/settings/access-token",method:"DELETE"});case 4:c((function(e){return Nn(Nn({},e),{},{accessToken:null})})),F.update(t,{render:"Access token removed successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),F.update(t,{render:"Failed to remove access token: ".concat(e.t0.message),type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}(),f=Pn((0,t.useState)(),2),d=f[0],h=f[1],g=Pn((0,t.useState)(!0),2),y=g[0],v=g[1];(0,t.useEffect)((function(){var e=function(){var e=jn(Sn().mark((function e(){return Sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Vt()({path:"/sws/v1/settings/get-gateway-settings",method:"GET"}).then((function(e){h((function(t){return Nn(Nn({},t),e)})),v(!1)})).catch((function(e){v(!1),F({render:"Failed to update settings: "+e.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0})}));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]);var w=Pn((0,t.useState)([]),2),b=w[0],x=w[1],E=Pn((0,t.useState)(!0),2),S=E[0],k=E[1];return(0,t.useEffect)((function(){k(!0);var e=function(){var e=jn(Sn().mark((function e(){return Sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Vt()({path:"/sws/v1/settings/get-shipping-methods",method:"GET"}).then((function(e){x(e),k(!1)})).catch((function(e){F({render:"Failed to get shipping methods: "+e.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0}),k(!1)}));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]),wp.element.createElement(Rn.Provider,{value:{settings:i,updateSettings:s,settingsLoading:o,getAccessToken:u,updateAccessToken:m,removeAccessToken:p,gatewaySettings:d,gatewayLoading:y,shippingMethods:b,shippingMethodsLoading:S}},n)},An=function(){return(0,t.useContext)(Rn)};const Tn=function(){var e,t,n,r,o=An(),a=o.settings,l=o.gatewaySettings,i=o.gatewayLoading;return wp.element.createElement("div",{className:"col-span-full grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 items-stretch gap-6"},wp.element.createElement(gn,{orders:a.orders,gatewaySettings:l,gatewayLoading:i}),wp.element.createElement(fn,{wooAuto:a.wooAuto}),wp.element.createElement(dn,{squareAuto:a.squareAuto}),wp.element.createElement(pn,null),wp.element.createElement(hn,{wooAuto:a.wooAuto}),wp.element.createElement(xn,{wooAuto:a.wooAuto,squareAuto:a.squareAuto}),wp.element.createElement(vn,{squareWoo:null!==(e=null===(t=a.customers)||void 0===t||null===(t=t.auto)||void 0===t?void 0:t.squareWoo)&&void 0!==e?e:{is_active:!1,first_name:!1,last_name:!1,phone:!1,role:!1,address:!1}}),wp.element.createElement(wn,{wooSquare:null!==(n=null===(r=a.customers)||void 0===r||null===(r=r.auto)||void 0===r?void 0:r.wooSquare)&&void 0!==n?n:{is_active:!1,first_name:!1,last_name:!1,phone:!1,role:!1,address:!1}}))};function Fn(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Mn(e){return!!e&&!!e[Sr]}function Dn(e){var t;return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===kr}(e)||Array.isArray(e)||!!e[Er]||!!(null===(t=e.constructor)||void 0===t?void 0:t[Er])||Hn(e)||zn(e))}function Gn(e,t,n){void 0===n&&(n=!1),0===qn(e)?(n?Object.keys:Nr)(e).forEach((function(r){n&&"symbol"==typeof r||t(r,e[r],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function qn(e){var t=e[Sr];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:Hn(e)?2:zn(e)?3:0}function Vn(e,t){return 2===qn(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Wn(e,t,n){var r=qn(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function Bn(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function Hn(e){return vr&&e instanceof Map}function zn(e){return wr&&e instanceof Set}function Un(e){return e.o||e.t}function $n(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Or(e);delete t[Sr];for(var n=Nr(t),r=0;r<n.length;r++){var o=n[r],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function Zn(e,t){return void 0===t&&(t=!1),Kn(e)||Mn(e)||!Dn(e)||(qn(e)>1&&(e.set=e.add=e.clear=e.delete=Yn),Object.freeze(e),t&&Gn(e,(function(e,t){return Zn(t,!0)}),!0)),e}function Yn(){Fn(2)}function Kn(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Xn(e){var t=Cr[e];return t||Fn(18,e),t}function Jn(){return gr}function Qn(e,t){t&&(Xn("Patches"),e.u=[],e.s=[],e.v=t)}function er(e){tr(e),e.p.forEach(rr),e.p=null}function tr(e){e===gr&&(gr=e.l)}function nr(e){return gr={p:[],l:gr,h:e,m:!0,_:0}}function rr(e){var t=e[Sr];0===t.i||1===t.i?t.j():t.g=!0}function or(e,t){t._=t.p.length;var n=t.p[0],r=void 0!==e&&e!==n;return t.h.O||Xn("ES5").S(t,e,r),r?(n[Sr].P&&(er(t),Fn(4)),Dn(e)&&(e=ar(t,e),t.l||ir(t,e)),t.u&&Xn("Patches").M(n[Sr].t,e,t.u,t.s)):e=ar(t,n,[]),er(t),t.u&&t.v(t.u,t.s),e!==xr?e:void 0}function ar(e,t,n){if(Kn(t))return t;var r=t[Sr];if(!r)return Gn(t,(function(o,a){return lr(e,r,t,o,a,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return ir(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var o=4===r.i||5===r.i?r.o=$n(r.k):r.o,a=o,l=!1;3===r.i&&(a=new Set(o),o.clear(),l=!0),Gn(a,(function(t,a){return lr(e,r,o,t,a,n,l)})),ir(e,o,!1),n&&e.u&&Xn("Patches").N(r,n,e.u,e.s)}return r.o}function lr(e,t,n,r,o,a,l){if(Mn(o)){var i=ar(e,o,a&&t&&3!==t.i&&!Vn(t.R,r)?a.concat(r):void 0);if(Wn(n,r,i),!Mn(i))return;e.m=!1}else l&&n.add(o);if(Dn(o)&&!Kn(o)){if(!e.h.D&&e._<1)return;ar(e,o),t&&t.A.l||ir(e,o)}}function ir(e,t,n){void 0===n&&(n=!1),!e.l&&e.h.D&&e.m&&Zn(t,n)}function cr(e,t){var n=e[Sr];return(n?Un(n):e)[t]}function sr(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function ur(e){e.P||(e.P=!0,e.l&&ur(e.l))}function mr(e){e.o||(e.o=$n(e.t))}function pr(e,t,n){var r=Hn(t)?Xn("MapSet").F(t,n):zn(t)?Xn("MapSet").T(t,n):e.O?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:Jn(),P:!1,I:!1,R:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=r,a=jr;n&&(o=[r],a=Pr);var l=Proxy.revocable(o,a),i=l.revoke,c=l.proxy;return r.k=c,r.j=i,c}(t,n):Xn("ES5").J(t,n);return(n?n.A:Jn()).p.push(r),r}function fr(e){return Mn(e)||Fn(22,e),function e(t){if(!Dn(t))return t;var n,r=t[Sr],o=qn(t);if(r){if(!r.P&&(r.i<4||!Xn("ES5").K(r)))return r.t;r.I=!0,n=dr(t,o),r.I=!1}else n=dr(t,o);return Gn(n,(function(t,o){r&&function(e,t){return 2===qn(e)?e.get(t):e[t]}(r.t,t)===o||Wn(n,t,e(o))})),3===o?new Set(n):n}(e)}function dr(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return $n(e)}var hr,gr,yr="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),vr="undefined"!=typeof Map,wr="undefined"!=typeof Set,br="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,xr=yr?Symbol.for("immer-nothing"):((hr={})["immer-nothing"]=!0,hr),Er=yr?Symbol.for("immer-draftable"):"__$immer_draftable",Sr=yr?Symbol.for("immer-state"):"__$immer_state",kr=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Nr="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Or=Object.getOwnPropertyDescriptors||function(e){var t={};return Nr(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Cr={},jr={get:function(e,t){if(t===Sr)return e;var n=Un(e);if(!Vn(n,t))return function(e,t,n){var r,o=sr(t,n);return o?"value"in o?o.value:null===(r=o.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!Dn(r)?r:r===cr(e.t,t)?(mr(e),e.o[t]=pr(e.A.h,r,e)):r},has:function(e,t){return t in Un(e)},ownKeys:function(e){return Reflect.ownKeys(Un(e))},set:function(e,t,n){var r=sr(Un(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var o=cr(Un(e),t),a=null==o?void 0:o[Sr];if(a&&a.t===n)return e.o[t]=n,e.R[t]=!1,!0;if(Bn(n,o)&&(void 0!==n||Vn(e.t,t)))return!0;mr(e),ur(e)}return e.o[t]===n&&(void 0!==n||t in e.o)||Number.isNaN(n)&&Number.isNaN(e.o[t])||(e.o[t]=n,e.R[t]=!0),!0},deleteProperty:function(e,t){return void 0!==cr(e.t,t)||t in e.t?(e.R[t]=!1,mr(e),ur(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=Un(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){Fn(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){Fn(12)}},Pr={};Gn(jr,(function(e,t){Pr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Pr.deleteProperty=function(e,t){return Pr.set.call(this,e,t,void 0)},Pr.set=function(e,t,n){return jr.set.call(this,e[0],t,n,e[0])};var Lr=function(){function e(e){var t=this;this.O=br,this.D=!0,this.produce=function(e,n,r){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var r=arguments.length,l=Array(r>1?r-1:0),i=1;i<r;i++)l[i-1]=arguments[i];return a.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(l))}))}}var l;if("function"!=typeof n&&Fn(6),void 0!==r&&"function"!=typeof r&&Fn(7),Dn(e)){var i=nr(t),c=pr(t,e,void 0),s=!0;try{l=n(c),s=!1}finally{s?er(i):tr(i)}return"undefined"!=typeof Promise&&l instanceof Promise?l.then((function(e){return Qn(i,r),or(e,i)}),(function(e){throw er(i),e})):(Qn(i,r),or(l,i))}if(!e||"object"!=typeof e){if(void 0===(l=n(e))&&(l=e),l===xr&&(l=void 0),t.D&&Zn(l,!0),r){var u=[],m=[];Xn("Patches").M(e,l,u,m),r(u,m)}return l}Fn(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var r=arguments.length,o=Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var r,o,a=t.produce(e,n,(function(e,t){r=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,r,o]})):[a,r,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){Dn(e)||Fn(8),Mn(e)&&(e=fr(e));var t=nr(this),n=pr(this,e,void 0);return n[Sr].C=!0,tr(t),n},t.finishDraft=function(e,t){var n=(e&&e[Sr]).A;return Qn(n,t),or(void 0,n)},t.setAutoFreeze=function(e){this.D=e},t.setUseProxies=function(e){e&&!br&&Fn(20),this.O=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));var o=Xn("Patches").$;return Mn(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),_r=new Lr,Rr=_r.produce;_r.produceWithPatches.bind(_r),_r.setAutoFreeze.bind(_r),_r.setUseProxies.bind(_r),_r.applyPatches.bind(_r),_r.createDraft.bind(_r),_r.finishDraft.bind(_r);const Ir=Rr;function Ar(e){return Ar="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ar(e)}function Tr(e){var t=function(e,t){if("object"!=Ar(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ar(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ar(t)?t:String(t)}function Fr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Mr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fr(Object(n),!0).forEach((function(t){var r,o,a;r=e,o=t,a=n[t],(o=Tr(o))in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Dr(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Gr="function"==typeof Symbol&&Symbol.observable||"@@observable",qr=function(){return Math.random().toString(36).substring(7).split("").join(".")},Vr={INIT:"@@redux/INIT"+qr(),REPLACE:"@@redux/REPLACE"+qr(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+qr()}};function Wr(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Dr(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Dr(1));return n(Wr)(e,t)}if("function"!=typeof e)throw new Error(Dr(2));var o=e,a=t,l=[],i=l,c=!1;function s(){i===l&&(i=l.slice())}function u(){if(c)throw new Error(Dr(3));return a}function m(e){if("function"!=typeof e)throw new Error(Dr(4));if(c)throw new Error(Dr(5));var t=!0;return s(),i.push(e),function(){if(t){if(c)throw new Error(Dr(6));t=!1,s();var n=i.indexOf(e);i.splice(n,1),l=null}}}function p(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(Dr(7));if(void 0===e.type)throw new Error(Dr(8));if(c)throw new Error(Dr(9));try{c=!0,a=o(a,e)}finally{c=!1}for(var t=l=i,n=0;n<t.length;n++)(0,t[n])();return e}return p({type:Vr.INIT}),(r={dispatch:p,subscribe:m,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(Dr(10));o=e,p({type:Vr.REPLACE})}})[Gr]=function(){var e,t=m;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Dr(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Gr]=function(){return this},e},r}function Br(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}var a,l=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Vr.INIT}))throw new Error(Dr(12));if(void 0===n(void 0,{type:Vr.PROBE_UNKNOWN_ACTION()}))throw new Error(Dr(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var r=!1,o={},i=0;i<l.length;i++){var c=l[i],s=n[c],u=e[c],m=s(u,t);if(void 0===m)throw t&&t.type,new Error(Dr(14));o[c]=m,r=r||m!==u}return(r=r||l.length!==Object.keys(e).length)?o:e}}function Hr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function zr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),r=function(){throw new Error(Dr(15))},o={getState:n.getState,dispatch:function(){return r.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return r=Hr.apply(void 0,a)(n.dispatch),Mr(Mr({},n),{},{dispatch:r})}}}function Ur(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,r,e):t(o)}}}}var $r=Ur();$r.withExtraArgument=Ur;const Zr=$r;var Yr,Kr=(Yr=function(e,t){return Yr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Yr(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function __(){this.constructor=e}Yr(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),Xr=function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e},Jr=Object.defineProperty,Qr=Object.defineProperties,eo=Object.getOwnPropertyDescriptors,to=Object.getOwnPropertySymbols,no=Object.prototype.hasOwnProperty,ro=Object.prototype.propertyIsEnumerable,oo=function(e,t,n){return t in e?Jr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},ao=function(e,t){for(var n in t||(t={}))no.call(t,n)&&oo(e,n,t[n]);if(to)for(var r=0,o=to(t);r<o.length;r++)n=o[r],ro.call(t,n)&&oo(e,n,t[n]);return e},lo=function(e,t){return Qr(e,eo(t))},io="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Hr:Hr.apply(null,arguments)};function co(e,t){function n(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return ao(ao({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var so=function(e){function t(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return Kr(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Xr([void 0],e[0].concat(this)))):new(t.bind.apply(t,Xr([void 0],e.concat(this))))},t}(Array),uo=function(e){function t(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return Kr(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Xr([void 0],e[0].concat(this)))):new(t.bind.apply(t,Xr([void 0],e.concat(this))))},t}(Array);function mo(e){return Dn(e)?Ir(e,(function(){})):e}function po(e){var t,n={},r=[],o={addCase:function(e,t){var r="string"==typeof e?e:e.type;if(!r)throw new Error("`builder.addCase` cannot be called with an empty action type");if(r in n)throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");return n[r]=t,o},addMatcher:function(e,t){return r.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,r,t]}function fo(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,r="function"==typeof e.initialState?e.initialState:mo(e.initialState),o=e.reducers||{},a=Object.keys(o),l={},i={},c={};function s(){var t="function"==typeof e.extraReducers?po(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],l=void 0===a?[]:a,c=t[2],s=void 0===c?void 0:c,u=ao(ao({},o),i);return function(e,t,n,r){void 0===n&&(n=[]);var o,a=po(t),l=a[0],i=a[1],c=a[2];if("function"==typeof e)o=function(){return mo(e())};else{var s=mo(e);o=function(){return s}}function u(e,t){void 0===e&&(e=o());var n=Xr([l[t.type]],i.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[c]),n.reduce((function(e,n){if(n){var r;if(Mn(e))return void 0===(r=n(e,t))?e:r;if(Dn(e))return Ir(e,(function(e){return n(e,t)}));if(void 0===(r=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return e}),e)}return u.getInitialState=o,u}(r,(function(e){for(var t in u)e.addCase(t,u[t]);for(var n=0,r=l;n<r.length;n++){var o=r[n];e.addMatcher(o.matcher,o.reducer)}s&&e.addDefaultCase(s)}))}return a.forEach((function(e){var n,r,a=o[e],s=t+"/"+e;"reducer"in a?(n=a.reducer,r=a.prepare):n=a,l[e]=n,i[s]=n,c[e]=r?co(s,r):co(s)})),{name:t,reducer:function(e,t){return n||(n=s()),n(e,t)},actions:c,caseReducers:l,getInitialState:function(){return n||(n=s()),n.getInitialState()}}}var ho=["name","message","stack","code"],go=function(e,t){this.payload=e,this.meta=t},yo=function(e,t){this.payload=e,this.meta=t},vo=function(e){if("object"==typeof e&&null!==e){for(var t={},n=0,r=ho;n<r.length;n++){var o=r[n];"string"==typeof e[o]&&(t[o]=e[o])}return t}return{message:String(e)}},wo=function(){function e(e,t,n){var r=co(e+"/fulfilled",(function(e,t,n,r){return{payload:e,meta:lo(ao({},r||{}),{arg:n,requestId:t,requestStatus:"fulfilled"})}})),o=co(e+"/pending",(function(e,t,n){return{payload:void 0,meta:lo(ao({},n||{}),{arg:t,requestId:e,requestStatus:"pending"})}})),a=co(e+"/rejected",(function(e,t,r,o,a){return{payload:o,error:(n&&n.serializeError||vo)(e||"Rejected"),meta:lo(ao({},a||{}),{arg:r,requestId:t,rejectedWithValue:!!o,requestStatus:"rejected",aborted:"AbortError"===(null==e?void 0:e.name),condition:"ConditionError"===(null==e?void 0:e.name)})}})),l="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(i,c,s){var u,m=(null==n?void 0:n.idGenerator)?n.idGenerator(e):function(e){void 0===e&&(e=21);for(var t="",n=e;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t}(),p=new l;function f(e){u=e,p.abort()}var d=function(){return l=this,d=null,h=function(){var l,d,h,g,y,v;return function(e,t){var n,r,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!((o=(o=l.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}}(this,(function(w){switch(w.label){case 0:return w.trys.push([0,4,,5]),null===(b=g=null==(l=null==n?void 0:n.condition)?void 0:l.call(n,e,{getState:c,extra:s}))||"object"!=typeof b||"function"!=typeof b.then?[3,2]:[4,g];case 1:g=w.sent(),w.label=2;case 2:if(!1===g||p.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return y=new Promise((function(e,t){return p.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:u||"Aborted"})}))})),i(o(m,e,null==(d=null==n?void 0:n.getPendingMeta)?void 0:d.call(n,{requestId:m,arg:e},{getState:c,extra:s}))),[4,Promise.race([y,Promise.resolve(t(e,{dispatch:i,getState:c,extra:s,requestId:m,signal:p.signal,abort:f,rejectWithValue:function(e,t){return new go(e,t)},fulfillWithValue:function(e,t){return new yo(e,t)}})).then((function(t){if(t instanceof go)throw t;return t instanceof yo?r(t.payload,m,e,t.meta):r(t,m,e)}))])];case 3:return h=w.sent(),[3,5];case 4:return v=w.sent(),h=v instanceof go?a(null,m,e,v.payload,v.meta):a(v,m,e),[3,5];case 5:return n&&!n.dispatchConditionRejection&&a.match(h)&&h.meta.condition||i(h),[2,h]}var b}))},new Promise((function(e,t){var n=function(e){try{o(h.next(e))}catch(e){t(e)}},r=function(e){try{o(h.throw(e))}catch(e){t(e)}},o=function(t){return t.done?e(t.value):Promise.resolve(t.value).then(n,r)};o((h=h.apply(l,d)).next())}));var l,d,h}();return Object.assign(d,{abort:f,requestId:m,arg:e,unwrap:function(){return d.then(bo)}})}}),{pending:o,rejected:a,fulfilled:r,typePrefix:e})}return e.withTypes=function(){return e},e}();function bo(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}Object.assign;var xo="listenerMiddleware";co(xo+"/add"),co(xo+"/removeAll"),co(xo+"/remove"),"function"==typeof queueMicrotask&&queueMicrotask.bind("undefined"!=typeof window?window:void 0!==o.g?o.g:globalThis);function Eo(e){return Eo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Eo(e)}function So(){So=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Eo(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Eo(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function ko(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function No(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){ko(a,r,o,l,i,"next",e)}function i(e){ko(a,r,o,l,i,"throw",e)}l(void 0)}))}}"undefined"!=typeof window&&window.requestAnimationFrame&&window.requestAnimationFrame,function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[Sr];return jr.get(t,e)},set:function(t){var n=this[Sr];jr.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][Sr];if(!o.P)switch(o.i){case 5:r(o)&&ur(o);break;case 4:n(o)&&ur(o)}}}function n(e){for(var t=e.t,n=e.k,r=Nr(n),o=r.length-1;o>=0;o--){var a=r[o];if(a!==Sr){var l=t[a];if(void 0===l&&!Vn(t,a))return!0;var i=n[a],c=i&&i[Sr];if(c?c.t!==l:!Bn(i,l))return!0}}var s=!!t[Sr];return r.length!==Nr(t).length+(s?0:1)}function r(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var r=0;r<t.length;r++)if(!t.hasOwnProperty(r))return!0;return!1}var o={};!function(e,t){Cr[e]||(Cr[e]=t)}("ES5",{J:function(t,n){var r=Array.isArray(t),o=function(t,n){if(t){for(var r=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(r,""+o,e(o,!0));return r}var a=Or(n);delete a[Sr];for(var l=Nr(a),i=0;i<l.length;i++){var c=l[i];a[c]=e(c,t||!!a[c].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(r,t),a={i:r?5:4,A:n?n.A:Jn(),P:!1,I:!1,R:{},l:n,t,k:o,o:null,g:!1,C:!1};return Object.defineProperty(o,Sr,{value:a,writable:!0}),o},S:function(e,n,o){o?Mn(n)&&n[Sr].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Sr];if(n){var o=n.t,a=n.k,l=n.R,i=n.i;if(4===i)Gn(a,(function(t){t!==Sr&&(void 0!==o[t]||Vn(o,t)?l[t]||e(a[t]):(l[t]=!0,ur(n)))})),Gn(o,(function(e){void 0!==a[e]||Vn(a,e)||(l[e]=!1,ur(n))}));else if(5===i){if(r(n)&&(ur(n),l.length=!0),a.length<o.length)for(var c=a.length;c<o.length;c++)l[c]=!1;else for(var s=o.length;s<a.length;s++)l[s]=!0;for(var u=Math.min(a.length,o.length),m=0;m<u;m++)a.hasOwnProperty(m)||(l[m]=!0),void 0===l[m]&&e(a[m])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):r(e)}})}();var Oo=wo("license/fetchLicense",No(So().mark((function e(){var t;return So().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ut({path:"/sws/v1/licence"});case 2:return t=e.sent,e.abrupt("return",t.licence);case 4:case"end":return e.stop()}}),e)})))),Co=fo({name:"license",initialState:{data:{is_valid:!1},loading:!0,error:null},reducers:{removeLicense:function(e){e.data=null},setLicense:function(e,t){e.data=t.payload}},extraReducers:function(e){e.addCase(Oo.pending,(function(e){e.loading=!0,e.error=null})).addCase(Oo.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload})).addCase(Oo.rejected,(function(e,t){e.loading=!1,e.error=t.error.message}))}});const jo=Co.reducer;function Po(e,t){return"function"==typeof e?e(t):e}function Lo(e,t){return n=>{t.setState((t=>({...t,[e]:Po(n,t[e])})))}}function _o(e){return e instanceof Function}function Ro(e,t,n){let r,o=[];return a=>{let l;n.key&&n.debug&&(l=Date.now());const i=e(a);if(i.length===o.length&&!i.some(((e,t)=>o[t]!==e)))return r;let c;if(o=i,n.key&&n.debug&&(c=Date.now()),r=t(...i),null==n||null==n.onChange||n.onChange(r),n.key&&n.debug&&null!=n&&n.debug()){const e=Math.round(100*(Date.now()-l))/100,t=Math.round(100*(Date.now()-c))/100,r=t/16,o=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${o(t,5)} /${o(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,null==n?void 0:n.key)}return r}}function Io(e,t,n,r){return{debug:()=>{var n;return null!=(n=null==e?void 0:e.debugAll)?n:e[t]},key:!1,onChange:r}}Co.actions.removeLicense,Co.actions.setLicense;const Ao="debugHeaders";function To(e,t,n){var r;let o={id:null!=(r=n.id)?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(o),e},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach((t=>{null==t.createHeader||t.createHeader(o,e)})),o}const Fo={createTable:e=>{e.getHeaderGroups=Ro((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((t,n,r,o)=>{var a,l;const i=null!=(a=null==r?void 0:r.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?a:[],c=null!=(l=null==o?void 0:o.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?l:[];return Mo(t,[...i,...n.filter((e=>!(null!=r&&r.includes(e.id)||null!=o&&o.includes(e.id)))),...c],e)}),Io(e.options,Ao)),e.getCenterHeaderGroups=Ro((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((t,n,r,o)=>Mo(t,n=n.filter((e=>!(null!=r&&r.includes(e.id)||null!=o&&o.includes(e.id)))),e,"center")),Io(e.options,Ao)),e.getLeftHeaderGroups=Ro((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left]),((t,n,r)=>{var o;const a=null!=(o=null==r?void 0:r.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?o:[];return Mo(t,a,e,"left")}),Io(e.options,Ao)),e.getRightHeaderGroups=Ro((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right]),((t,n,r)=>{var o;const a=null!=(o=null==r?void 0:r.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?o:[];return Mo(t,a,e,"right")}),Io(e.options,Ao)),e.getFooterGroups=Ro((()=>[e.getHeaderGroups()]),(e=>[...e].reverse()),Io(e.options,Ao)),e.getLeftFooterGroups=Ro((()=>[e.getLeftHeaderGroups()]),(e=>[...e].reverse()),Io(e.options,Ao)),e.getCenterFooterGroups=Ro((()=>[e.getCenterHeaderGroups()]),(e=>[...e].reverse()),Io(e.options,Ao)),e.getRightFooterGroups=Ro((()=>[e.getRightHeaderGroups()]),(e=>[...e].reverse()),Io(e.options,Ao)),e.getFlatHeaders=Ro((()=>[e.getHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),Io(e.options,Ao)),e.getLeftFlatHeaders=Ro((()=>[e.getLeftHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),Io(e.options,Ao)),e.getCenterFlatHeaders=Ro((()=>[e.getCenterHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),Io(e.options,Ao)),e.getRightFlatHeaders=Ro((()=>[e.getRightHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),Io(e.options,Ao)),e.getCenterLeafHeaders=Ro((()=>[e.getCenterFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),Io(e.options,Ao)),e.getLeftLeafHeaders=Ro((()=>[e.getLeftFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),Io(e.options,Ao)),e.getRightLeafHeaders=Ro((()=>[e.getRightFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),Io(e.options,Ao)),e.getLeafHeaders=Ro((()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()]),((e,t,n)=>{var r,o,a,l,i,c;return[...null!=(r=null==(o=e[0])?void 0:o.headers)?r:[],...null!=(a=null==(l=t[0])?void 0:l.headers)?a:[],...null!=(i=null==(c=n[0])?void 0:c.headers)?i:[]].map((e=>e.getLeafHeaders())).flat()}),Io(e.options,Ao))}};function Mo(e,t,n,r){var o,a;let l=0;const i=function(e,t){void 0===t&&(t=1),l=Math.max(l,t),e.filter((e=>e.getIsVisible())).forEach((e=>{var n;null!=(n=e.columns)&&n.length&&i(e.columns,t+1)}),0)};i(e);let c=[];const s=(e,t)=>{const o={depth:t,id:[r,`${t}`].filter(Boolean).join("_"),headers:[]},a=[];e.forEach((e=>{const l=[...a].reverse()[0];let i,c=!1;if(e.column.depth===o.depth&&e.column.parent?i=e.column.parent:(i=e.column,c=!0),l&&(null==l?void 0:l.column)===i)l.subHeaders.push(e);else{const o=To(n,i,{id:[r,t,i.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:c,placeholderId:c?`${a.filter((e=>e.column===i)).length}`:void 0,depth:t,index:a.length});o.subHeaders.push(e),a.push(o)}o.headers.push(e),e.headerGroup=o})),c.push(o),t>0&&s(a,t-1)},u=t.map(((e,t)=>To(n,e,{depth:l,index:t})));s(u,l-1),c.reverse();const m=e=>e.filter((e=>e.column.getIsVisible())).map((e=>{let t=0,n=0,r=[0];return e.subHeaders&&e.subHeaders.length?(r=[],m(e.subHeaders).forEach((e=>{let{colSpan:n,rowSpan:o}=e;t+=n,r.push(o)}))):t=1,n+=Math.min(...r),e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}}));return m(null!=(o=null==(a=c[0])?void 0:a.headers)?o:[]),c}const Do={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Go={getDefaultColumnDef:()=>Do,getInitialState:e=>({columnSizing:{},columnSizingInfo:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]},...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Lo("columnSizing",e),onColumnSizingInfoChange:Lo("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,o;const a=t.getState().columnSizing[e.id];return Math.min(Math.max(null!=(n=e.columnDef.minSize)?n:Do.minSize,null!=(r=null!=a?a:e.columnDef.size)?r:Do.size),null!=(o=e.columnDef.maxSize)?o:Do.maxSize)},e.getStart=Ro((e=>[e,wa(t,e),t.getState().columnSizing]),((t,n)=>n.slice(0,e.getIndex(t)).reduce(((e,t)=>e+t.getSize()),0)),Io(t.options,"debugColumns")),e.getAfter=Ro((e=>[e,wa(t,e),t.getState().columnSizing]),((t,n)=>n.slice(e.getIndex(t)+1).reduce(((e,t)=>e+t.getSize()),0)),Io(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing((t=>{let{[e.id]:n,...r}=t;return r}))},e.getCanResize=()=>{var n,r;return(null==(n=e.columnDef.enableResizing)||n)&&(null==(r=t.options.enableColumnResizing)||r)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0;const n=e=>{var r;e.subHeaders.length?e.subHeaders.forEach(n):t+=null!=(r=e.column.getSize())?r:0};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),o=null==r?void 0:r.getCanResize();return a=>{if(!r||!o)return;if(null==a.persist||a.persist(),Vo(a)&&a.touches&&a.touches.length>1)return;const l=e.getSize(),i=e?e.getLeafHeaders().map((e=>[e.column.id,e.column.getSize()])):[[r.id,r.getSize()]],c=Vo(a)?Math.round(a.touches[0].clientX):a.clientX,s={},u=(e,n)=>{"number"==typeof n&&(t.setColumnSizingInfo((e=>{var r,o;const a="rtl"===t.options.columnResizeDirection?-1:1,l=(n-(null!=(r=null==e?void 0:e.startOffset)?r:0))*a,i=Math.max(l/(null!=(o=null==e?void 0:e.startSize)?o:0),-.999999);return e.columnSizingStart.forEach((e=>{let[t,n]=e;s[t]=Math.round(100*Math.max(n+n*i,0))/100})),{...e,deltaOffset:l,deltaPercentage:i}})),"onChange"!==t.options.columnResizeMode&&"end"!==e||t.setColumnSizing((e=>({...e,...s}))))},m=e=>u("move",e),p=e=>{u("end",e),t.setColumnSizingInfo((e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]})))},f=n||"undefined"!=typeof document?document:null,d={moveHandler:e=>m(e.clientX),upHandler:e=>{null==f||f.removeEventListener("mousemove",d.moveHandler),null==f||f.removeEventListener("mouseup",d.upHandler),p(e.clientX)}},h={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),m(e.touches[0].clientX),!1),upHandler:e=>{var t;null==f||f.removeEventListener("touchmove",h.moveHandler),null==f||f.removeEventListener("touchend",h.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),p(null==(t=e.touches[0])?void 0:t.clientX)}},g=!!function(){if("boolean"==typeof qo)return qo;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch(t){e=!1}return qo=e,qo}()&&{passive:!1};Vo(a)?(null==f||f.addEventListener("touchmove",h.moveHandler,g),null==f||f.addEventListener("touchend",h.upHandler,g)):(null==f||f.addEventListener("mousemove",d.moveHandler,g),null==f||f.addEventListener("mouseup",d.upHandler,g)),t.setColumnSizingInfo((e=>({...e,startOffset:c,startSize:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:i,isResizingColumn:r.id})))}}},createTable:e=>{e.setColumnSizing=t=>null==e.options.onColumnSizingChange?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>null==e.options.onColumnSizingInfoChange?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:null!=(n=e.initialState.columnSizing)?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}:null!=(n=e.initialState.columnSizingInfo)?n:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]})},e.getTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getLeftTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getLeftHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getCenterTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getCenterHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getRightTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getRightHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0}}};let qo=null;function Vo(e){return"touchstart"===e.type}const Wo={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Lo("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,o;if(t){if(null!=(r=null!=(o=e.options.autoResetAll)?o:e.options.autoResetExpanded)?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue((()=>{e.resetExpanded(),n=!1}))}}else e._queue((()=>{t=!0}))},e.setExpanded=t=>null==e.options.onExpandedChange?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{(null!=t?t:!e.getIsAllRowsExpanded())?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{var n,r;e.setExpanded(t?{}:null!=(n=null==(r=e.initialState)?void 0:r.expanded)?n:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some((e=>e.getCanExpand())),e.getToggleAllRowsExpandedHandler=()=>t=>{null==t.persist||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const t=e.getState().expanded;return!0===t||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{const t=e.getState().expanded;return"boolean"==typeof t?!0===t:!!Object.keys(t).length&&!e.getRowModel().flatRows.some((e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(!0===e.getState().expanded?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach((e=>{const n=e.split(".");t=Math.max(t,n.length)})),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded((r=>{var o;const a=!0===r||!(null==r||!r[e.id]);let l={};if(!0===r?Object.keys(t.getRowModel().rowsById).forEach((e=>{l[e]=!0})):l=r,n=null!=(o=n)?o:!a,!a&&n)return{...l,[e.id]:!0};if(a&&!n){const{[e.id]:t,...n}=l;return n}return r}))},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!(null!=(n=null==t.options.getIsRowExpanded?void 0:t.options.getIsRowExpanded(e))?n:!0===r||(null==r?void 0:r[e.id]))},e.getCanExpand=()=>{var n,r,o;return null!=(n=null==t.options.getRowCanExpand?void 0:t.options.getRowCanExpand(e))?n:(null==(r=t.options.enableExpanding)||r)&&!(null==(o=e.subRows)||!o.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},Bo=(e,t,n)=>{var r;const o=n.toLowerCase();return Boolean(null==(r=e.getValue(t))||null==(r=r.toString())||null==(r=r.toLowerCase())?void 0:r.includes(o))};Bo.autoRemove=e=>Qo(e);const Ho=(e,t,n)=>{var r;return Boolean(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.includes(n))};Ho.autoRemove=e=>Qo(e);const zo=(e,t,n)=>{var r;return(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.toLowerCase())===(null==n?void 0:n.toLowerCase())};zo.autoRemove=e=>Qo(e);const Uo=(e,t,n)=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)};Uo.autoRemove=e=>Qo(e)||!(null!=e&&e.length);const $o=(e,t,n)=>!n.some((n=>{var r;return!(null!=(r=e.getValue(t))&&r.includes(n))}));$o.autoRemove=e=>Qo(e)||!(null!=e&&e.length);const Zo=(e,t,n)=>n.some((n=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)}));Zo.autoRemove=e=>Qo(e)||!(null!=e&&e.length);const Yo=(e,t,n)=>e.getValue(t)===n;Yo.autoRemove=e=>Qo(e);const Ko=(e,t,n)=>e.getValue(t)==n;Ko.autoRemove=e=>Qo(e);const Xo=(e,t,n)=>{let[r,o]=n;const a=e.getValue(t);return a>=r&&a<=o};Xo.resolveFilterValue=e=>{let[t,n]=e,r="number"!=typeof t?parseFloat(t):t,o="number"!=typeof n?parseFloat(n):n,a=null===t||Number.isNaN(r)?-1/0:r,l=null===n||Number.isNaN(o)?1/0:o;if(a>l){const e=a;a=l,l=e}return[a,l]},Xo.autoRemove=e=>Qo(e)||Qo(e[0])&&Qo(e[1]);const Jo={includesString:Bo,includesStringSensitive:Ho,equalsString:zo,arrIncludes:Uo,arrIncludesAll:$o,arrIncludesSome:Zo,equals:Yo,weakEquals:Ko,inNumberRange:Xo};function Qo(e){return null==e||""===e}const ea={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:Lo("columnFilters",e),onGlobalFilterChange:Lo("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=null==(n=e.getCoreRowModel().flatRows[0])||null==(n=n._getAllCellsByColumnId()[t.id])?void 0:n.getValue();return"string"==typeof r||"number"==typeof r}}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=null==n?void 0:n.getValue(e.id);return"string"==typeof r?Jo.includesString:"number"==typeof r?Jo.inNumberRange:"boolean"==typeof r||null!==r&&"object"==typeof r?Jo.equals:Array.isArray(r)?Jo.arrIncludes:Jo.weakEquals},e.getFilterFn=()=>{var n,r;return _o(e.columnDef.filterFn)?e.columnDef.filterFn:"auto"===e.columnDef.filterFn?e.getAutoFilterFn():null!=(n=null==(r=t.options.filterFns)?void 0:r[e.columnDef.filterFn])?n:Jo[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,o;return(null==(n=e.columnDef.enableColumnFilter)||n)&&(null==(r=t.options.enableColumnFilters)||r)&&(null==(o=t.options.enableFilters)||o)&&!!e.accessorFn},e.getCanGlobalFilter=()=>{var n,r,o,a;return(null==(n=e.columnDef.enableGlobalFilter)||n)&&(null==(r=t.options.enableGlobalFilter)||r)&&(null==(o=t.options.enableFilters)||o)&&(null==(a=null==t.options.getColumnCanGlobalFilter?void 0:t.options.getColumnCanGlobalFilter(e))||a)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return null==(n=t.getState().columnFilters)||null==(n=n.find((t=>t.id===e.id)))?void 0:n.value},e.getFilterIndex=()=>{var n,r;return null!=(n=null==(r=t.getState().columnFilters)?void 0:r.findIndex((t=>t.id===e.id)))?n:-1},e.setFilterValue=n=>{t.setColumnFilters((t=>{const r=e.getFilterFn(),o=null==t?void 0:t.find((t=>t.id===e.id)),a=Po(n,o?o.value:void 0);var l;if(ta(r,a,e))return null!=(l=null==t?void 0:t.filter((t=>t.id!==e.id)))?l:[];const i={id:e.id,value:a};var c;return o?null!=(c=null==t?void 0:t.map((t=>t.id===e.id?i:t)))?c:[]:null!=t&&t.length?[...t,i]:[i]}))},e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Jo.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return _o(r)?r:"auto"===r?e.getGlobalAutoFilterFn():null!=(t=null==(n=e.options.filterFns)?void 0:n[r])?t:Jo[r]},e.setColumnFilters=t=>{const n=e.getAllLeafColumns();null==e.options.onColumnFiltersChange||e.options.onColumnFiltersChange((e=>{var r;return null==(r=Po(t,e))?void 0:r.filter((e=>{const t=n.find((t=>t.id===e.id));return!t||!ta(t.getFilterFn(),e.value,t)}))}))},e.setGlobalFilter=t=>{null==e.options.onGlobalFilterChange||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.columnFilters)?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel()),e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}};function ta(e,t,n){return!(!e||!e.autoRemove)&&e.autoRemove(t,n)||void 0===t||"string"==typeof t&&!t}const na={sum:(e,t,n)=>n.reduce(((t,n)=>{const r=n.getValue(e);return t+("number"==typeof r?r:0)}),0),min:(e,t,n)=>{let r;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(r>n||void 0===r&&n>=n)&&(r=n)})),r},max:(e,t,n)=>{let r;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(r<n||void 0===r&&n>=n)&&(r=n)})),r},extent:(e,t,n)=>{let r,o;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(void 0===r?n>=n&&(r=o=n):(r>n&&(r=n),o<n&&(o=n)))})),[r,o]},mean:(e,t)=>{let n=0,r=0;if(t.forEach((t=>{let o=t.getValue(e);null!=o&&(o=+o)>=o&&(++n,r+=o)})),n)return r/n},median:(e,t)=>{if(!t.length)return;const n=t.map((t=>t.getValue(e)));if(!function(e){return Array.isArray(e)&&e.every((e=>"number"==typeof e))}(n))return;if(1===n.length)return n[0];const r=Math.floor(n.length/2),o=n.sort(((e,t)=>e-t));return n.length%2!=0?o[r]:(o[r-1]+o[r])/2},unique:(e,t)=>Array.from(new Set(t.map((t=>t.getValue(e)))).values()),uniqueCount:(e,t)=>new Set(t.map((t=>t.getValue(e)))).size,count:(e,t)=>t.length},ra={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return null!=(t=null==(n=e.getValue())||null==n.toString?void 0:n.toString())?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Lo("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping((t=>null!=t&&t.includes(e.id)?t.filter((t=>t!==e.id)):[...null!=t?t:[],e.id]))},e.getCanGroup=()=>{var n,r,o,a;return null!=(n=null==(r=null!=(o=null==(a=e.columnDef.enableGrouping)||a)?o:t.options.enableGrouping)||r)?n:!!e.accessorFn},e.getIsGrouped=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=null==n?void 0:n.getValue(e.id);return"number"==typeof r?na.sum:"[object Date]"===Object.prototype.toString.call(r)?na.extent:void 0},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return _o(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:"auto"===e.columnDef.aggregationFn?e.getAutoAggregationFn():null!=(n=null==(r=t.options.aggregationFns)?void 0:r[e.columnDef.aggregationFn])?n:na[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>null==e.options.onGroupingChange?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.grouping)?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return null!=r&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!(null==(t=n.subRows)||!t.length)}}},oa={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Lo("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Ro((e=>[wa(t,e)]),(t=>t.findIndex((t=>t.id===e.id))),Io(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return(null==(r=wa(t,n)[0])?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const o=wa(t,n);return(null==(r=o[o.length-1])?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>null==e.options.onColumnOrderChange?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:null!=(n=e.initialState.columnOrder)?n:[])},e._getOrderColumnsFn=Ro((()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode]),((e,t,n)=>r=>{let o=[];if(null!=e&&e.length){const t=[...e],n=[...r];for(;n.length&&t.length;){const e=t.shift(),r=n.findIndex((t=>t.id===e));r>-1&&o.push(n.splice(r,1)[0])}o=[...o,...n]}else o=r;return function(e,t,n){if(null==t||!t.length||!n)return e;const r=e.filter((e=>!t.includes(e.id)));if("remove"===n)return r;return[...t.map((t=>e.find((e=>e.id===t)))).filter(Boolean),...r]}(o,t,n)}),Io(e.options,"debugTable"))}},aa={getInitialState:e=>({...e,pagination:{pageIndex:0,pageSize:10,...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Lo("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,o;if(t){if(null!=(r=null!=(o=e.options.autoResetAll)?o:e.options.autoResetPageIndex)?r:!e.options.manualPagination){if(n)return;n=!0,e._queue((()=>{e.resetPageIndex(),n=!1}))}}else e._queue((()=>{t=!0}))},e.setPagination=t=>null==e.options.onPaginationChange?void 0:e.options.onPaginationChange((e=>Po(t,e))),e.resetPagination=t=>{var n;e.setPagination(t?{pageIndex:0,pageSize:10}:null!=(n=e.initialState.pagination)?n:{pageIndex:0,pageSize:10})},e.setPageIndex=t=>{e.setPagination((n=>{let r=Po(t,n.pageIndex);const o=void 0===e.options.pageCount||-1===e.options.pageCount?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return r=Math.max(0,Math.min(r,o)),{...n,pageIndex:r}}))},e.resetPageIndex=t=>{var n,r;e.setPageIndex(t?0:null!=(n=null==(r=e.initialState)||null==(r=r.pagination)?void 0:r.pageIndex)?n:0)},e.resetPageSize=t=>{var n,r;e.setPageSize(t?10:null!=(n=null==(r=e.initialState)||null==(r=r.pagination)?void 0:r.pageSize)?n:10)},e.setPageSize=t=>{e.setPagination((e=>{const n=Math.max(1,Po(t,e.pageSize)),r=e.pageSize*e.pageIndex,o=Math.floor(r/n);return{...e,pageIndex:o,pageSize:n}}))},e.setPageCount=t=>e.setPagination((n=>{var r;let o=Po(t,null!=(r=e.options.pageCount)?r:-1);return"number"==typeof o&&(o=Math.max(-1,o)),{...n,pageCount:o}})),e.getPageOptions=Ro((()=>[e.getPageCount()]),(e=>{let t=[];return e&&e>0&&(t=[...new Array(e)].fill(null).map(((e,t)=>t))),t}),Io(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return-1===n||0!==n&&t<n-1},e.previousPage=()=>e.setPageIndex((e=>e-1)),e.nextPage=()=>e.setPageIndex((e=>e+1)),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var t;return null!=(t=e.options.pageCount)?t:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var t;return null!=(t=e.options.rowCount)?t:e.getPrePaginationRowModel().rows.length}}},la={getInitialState:e=>({columnPinning:{left:[],right:[]},rowPinning:{top:[],bottom:[]},...e}),getDefaultOptions:e=>({onColumnPinningChange:Lo("columnPinning",e),onRowPinningChange:Lo("rowPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map((e=>e.id)).filter(Boolean);t.setColumnPinning((e=>{var t,o,a,l,i,c;return"right"===n?{left:(null!=(a=null==e?void 0:e.left)?a:[]).filter((e=>!(null!=r&&r.includes(e)))),right:[...(null!=(l=null==e?void 0:e.right)?l:[]).filter((e=>!(null!=r&&r.includes(e)))),...r]}:"left"===n?{left:[...(null!=(i=null==e?void 0:e.left)?i:[]).filter((e=>!(null!=r&&r.includes(e)))),...r],right:(null!=(c=null==e?void 0:e.right)?c:[]).filter((e=>!(null!=r&&r.includes(e))))}:{left:(null!=(t=null==e?void 0:e.left)?t:[]).filter((e=>!(null!=r&&r.includes(e)))),right:(null!=(o=null==e?void 0:e.right)?o:[]).filter((e=>!(null!=r&&r.includes(e))))}}))},e.getCanPin=()=>e.getLeafColumns().some((e=>{var n,r,o;return(null==(n=e.columnDef.enablePinning)||n)&&(null==(r=null!=(o=t.options.enableColumnPinning)?o:t.options.enablePinning)||r)})),e.getIsPinned=()=>{const n=e.getLeafColumns().map((e=>e.id)),{left:r,right:o}=t.getState().columnPinning,a=n.some((e=>null==r?void 0:r.includes(e))),l=n.some((e=>null==o?void 0:o.includes(e)));return a?"left":!!l&&"right"},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();return o?null!=(n=null==(r=t.getState().columnPinning)||null==(r=r[o])?void 0:r.indexOf(e.id))?n:-1:0}},createRow:(e,t)=>{e.pin=(n,r,o)=>{const a=r?e.getLeafRows().map((e=>{let{id:t}=e;return t})):[],l=o?e.getParentRows().map((e=>{let{id:t}=e;return t})):[],i=new Set([...l,e.id,...a]);t.setRowPinning((e=>{var t,r,o,a,l,c;return"bottom"===n?{top:(null!=(o=null==e?void 0:e.top)?o:[]).filter((e=>!(null!=i&&i.has(e)))),bottom:[...(null!=(a=null==e?void 0:e.bottom)?a:[]).filter((e=>!(null!=i&&i.has(e)))),...Array.from(i)]}:"top"===n?{top:[...(null!=(l=null==e?void 0:e.top)?l:[]).filter((e=>!(null!=i&&i.has(e)))),...Array.from(i)],bottom:(null!=(c=null==e?void 0:e.bottom)?c:[]).filter((e=>!(null!=i&&i.has(e))))}:{top:(null!=(t=null==e?void 0:e.top)?t:[]).filter((e=>!(null!=i&&i.has(e)))),bottom:(null!=(r=null==e?void 0:e.bottom)?r:[]).filter((e=>!(null!=i&&i.has(e))))}}))},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:o}=t.options;return"function"==typeof r?r(e):null==(n=null!=r?r:o)||n},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:o}=t.getState().rowPinning,a=n.some((e=>null==r?void 0:r.includes(e))),l=n.some((e=>null==o?void 0:o.includes(e)));return a?"top":!!l&&"bottom"},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();if(!o)return-1;const a=null==(n=t._getPinnedRows(o))?void 0:n.map((e=>{let{id:t}=e;return t}));return null!=(r=null==a?void 0:a.indexOf(e.id))?r:-1},e.getCenterVisibleCells=Ro((()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right]),((e,t,n)=>{const r=[...null!=t?t:[],...null!=n?n:[]];return e.filter((e=>!r.includes(e.column.id)))}),Io(t.options,"debugRows")),e.getLeftVisibleCells=Ro((()=>[e._getAllVisibleCells(),t.getState().columnPinning.left]),((e,t)=>{const n=(null!=t?t:[]).map((t=>e.find((e=>e.column.id===t)))).filter(Boolean).map((e=>({...e,position:"left"})));return n}),Io(t.options,"debugRows")),e.getRightVisibleCells=Ro((()=>[e._getAllVisibleCells(),t.getState().columnPinning.right]),((e,t)=>{const n=(null!=t?t:[]).map((t=>e.find((e=>e.column.id===t)))).filter(Boolean).map((e=>({...e,position:"right"})));return n}),Io(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>null==e.options.onColumnPinningChange?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?{left:[],right:[]}:null!=(n=null==(r=e.initialState)?void 0:r.columnPinning)?n:{left:[],right:[]})},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;var o,a;return t?Boolean(null==(n=r[t])?void 0:n.length):Boolean((null==(o=r.left)?void 0:o.length)||(null==(a=r.right)?void 0:a.length))},e.getLeftLeafColumns=Ro((()=>[e.getAllLeafColumns(),e.getState().columnPinning.left]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.id===t)))).filter(Boolean)),Io(e.options,"debugColumns")),e.getRightLeafColumns=Ro((()=>[e.getAllLeafColumns(),e.getState().columnPinning.right]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.id===t)))).filter(Boolean)),Io(e.options,"debugColumns")),e.getCenterLeafColumns=Ro((()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((e,t,n)=>{const r=[...null!=t?t:[],...null!=n?n:[]];return e.filter((e=>!r.includes(e.id)))}),Io(e.options,"debugColumns")),e.setRowPinning=t=>null==e.options.onRowPinningChange?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?{top:[],bottom:[]}:null!=(n=null==(r=e.initialState)?void 0:r.rowPinning)?n:{top:[],bottom:[]})},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;var o,a;return t?Boolean(null==(n=r[t])?void 0:n.length):Boolean((null==(o=r.top)?void 0:o.length)||(null==(a=r.bottom)?void 0:a.length))},e._getPinnedRows=Ro((t=>[e.getRowModel().rows,e.getState().rowPinning[t],t]),((t,n,r)=>{var o;return(null==(o=e.options.keepPinnedRows)||o?(null!=n?n:[]).map((t=>{const n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null})):(null!=n?n:[]).map((e=>t.find((t=>t.id===e))))).filter(Boolean).map((e=>({...e,position:r})))}),Io(e.options,"debugRows")),e.getTopRows=()=>e._getPinnedRows("top"),e.getBottomRows=()=>e._getPinnedRows("bottom"),e.getCenterRows=Ro((()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom]),((e,t,n)=>{const r=new Set([...null!=t?t:[],...null!=n?n:[]]);return e.filter((e=>!r.has(e.id)))}),Io(e.options,"debugRows"))}},ia={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Lo("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>null==e.options.onRowSelectionChange?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:null!=(n=e.initialState.rowSelection)?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection((n=>{t=void 0!==t?t:!e.getIsAllRowsSelected();const r={...n},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach((e=>{e.getCanSelect()&&(r[e.id]=!0)})):o.forEach((e=>{delete r[e.id]})),r}))},e.toggleAllPageRowsSelected=t=>e.setRowSelection((n=>{const r=void 0!==t?t:!e.getIsAllPageRowsSelected(),o={...n};return e.getRowModel().rows.forEach((t=>{ca(o,t.id,r,!0,e)})),o})),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Ro((()=>[e.getState().rowSelection,e.getCoreRowModel()]),((t,n)=>Object.keys(t).length?sa(e,n):{rows:[],flatRows:[],rowsById:{}}),Io(e.options,"debugTable")),e.getFilteredSelectedRowModel=Ro((()=>[e.getState().rowSelection,e.getFilteredRowModel()]),((t,n)=>Object.keys(t).length?sa(e,n):{rows:[],flatRows:[],rowsById:{}}),Io(e.options,"debugTable")),e.getGroupedSelectedRowModel=Ro((()=>[e.getState().rowSelection,e.getSortedRowModel()]),((t,n)=>Object.keys(t).length?sa(e,n):{rows:[],flatRows:[],rowsById:{}}),Io(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=Boolean(t.length&&Object.keys(n).length);return r&&t.some((e=>e.getCanSelect()&&!n[e.id]))&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter((e=>e.getCanSelect())),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some((e=>!n[e.id]))&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys(null!=(t=e.getState().rowSelection)?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter((e=>e.getCanSelect())).some((e=>e.getIsSelected()||e.getIsSomeSelected()))},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const o=e.getIsSelected();t.setRowSelection((a=>{var l;if(n=void 0!==n?n:!o,e.getCanSelect()&&o===n)return a;const i={...a};return ca(i,e.id,n,null==(l=null==r?void 0:r.selectChildren)||l,t),i}))},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return ua(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return"some"===ma(e,n)},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return"all"===ma(e,n)},e.getCanSelect=()=>{var n;return"function"==typeof t.options.enableRowSelection?t.options.enableRowSelection(e):null==(n=t.options.enableRowSelection)||n},e.getCanSelectSubRows=()=>{var n;return"function"==typeof t.options.enableSubRowSelection?t.options.enableSubRowSelection(e):null==(n=t.options.enableSubRowSelection)||n},e.getCanMultiSelect=()=>{var n;return"function"==typeof t.options.enableMultiRowSelection?t.options.enableMultiRowSelection(e):null==(n=t.options.enableMultiRowSelection)||n},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var r;t&&e.toggleSelected(null==(r=n.target)?void 0:r.checked)}}}},ca=(e,t,n,r,o)=>{var a;const l=o.getRow(t,!0);n?(l.getCanMultiSelect()||Object.keys(e).forEach((t=>delete e[t])),l.getCanSelect()&&(e[t]=!0)):delete e[t],r&&null!=(a=l.subRows)&&a.length&&l.getCanSelectSubRows()&&l.subRows.forEach((t=>ca(e,t.id,n,r,o)))};function sa(e,t){const n=e.getState().rowSelection,r=[],o={},a=function(e,t){return e.map((e=>{var t;const l=ua(e,n);if(l&&(r.push(e),o[e.id]=e),null!=(t=e.subRows)&&t.length&&(e={...e,subRows:a(e.subRows)}),l)return e})).filter(Boolean)};return{rows:a(t.rows),flatRows:r,rowsById:o}}function ua(e,t){var n;return null!=(n=t[e.id])&&n}function ma(e,t,n){var r;if(null==(r=e.subRows)||!r.length)return!1;let o=!0,a=!1;return e.subRows.forEach((e=>{if((!a||o)&&(e.getCanSelect()&&(ua(e,t)?a=!0:o=!1),e.subRows&&e.subRows.length)){const n=ma(e,t);"all"===n?a=!0:"some"===n?(a=!0,o=!1):o=!1}})),o?"all":!!a&&"some"}const pa=/([0-9]+)/gm;function fa(e,t){return e===t?0:e>t?1:-1}function da(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function ha(e,t){const n=e.split(pa).filter(Boolean),r=t.split(pa).filter(Boolean);for(;n.length&&r.length;){const e=n.shift(),t=r.shift(),o=parseInt(e,10),a=parseInt(t,10),l=[o,a].sort();if(isNaN(l[0])){if(e>t)return 1;if(t>e)return-1}else{if(isNaN(l[1]))return isNaN(o)?-1:1;if(o>a)return 1;if(a>o)return-1}}return n.length-r.length}const ga={alphanumeric:(e,t,n)=>ha(da(e.getValue(n)).toLowerCase(),da(t.getValue(n)).toLowerCase()),alphanumericCaseSensitive:(e,t,n)=>ha(da(e.getValue(n)),da(t.getValue(n))),text:(e,t,n)=>fa(da(e.getValue(n)).toLowerCase(),da(t.getValue(n)).toLowerCase()),textCaseSensitive:(e,t,n)=>fa(da(e.getValue(n)),da(t.getValue(n))),datetime:(e,t,n)=>{const r=e.getValue(n),o=t.getValue(n);return r>o?1:r<o?-1:0},basic:(e,t,n)=>fa(e.getValue(n),t.getValue(n))},ya={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Lo("sorting",e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const t of n){const n=null==t?void 0:t.getValue(e.id);if("[object Date]"===Object.prototype.toString.call(n))return ga.datetime;if("string"==typeof n&&(r=!0,n.split(pa).length>1))return ga.alphanumeric}return r?ga.text:ga.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return"string"==typeof(null==n?void 0:n.getValue(e.id))?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return _o(e.columnDef.sortingFn)?e.columnDef.sortingFn:"auto"===e.columnDef.sortingFn?e.getAutoSortingFn():null!=(n=null==(r=t.options.sortingFns)?void 0:r[e.columnDef.sortingFn])?n:ga[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const o=e.getNextSortingOrder(),a=null!=n;t.setSorting((l=>{const i=null==l?void 0:l.find((t=>t.id===e.id)),c=null==l?void 0:l.findIndex((t=>t.id===e.id));let s,u=[],m=a?n:"desc"===o;var p;return s=null!=l&&l.length&&e.getCanMultiSort()&&r?i?"toggle":"add":null!=l&&l.length&&c!==l.length-1?"replace":i?"toggle":"replace","toggle"===s&&(a||o||(s="remove")),"add"===s?(u=[...l,{id:e.id,desc:m}],u.splice(0,u.length-(null!=(p=t.options.maxMultiSortColCount)?p:Number.MAX_SAFE_INTEGER))):u="toggle"===s?l.map((t=>t.id===e.id?{...t,desc:m}:t)):"remove"===s?l.filter((t=>t.id!==e.id)):[{id:e.id,desc:m}],u}))},e.getFirstSortDir=()=>{var n,r;return(null!=(n=null!=(r=e.columnDef.sortDescFirst)?r:t.options.sortDescFirst)?n:"desc"===e.getAutoSortDir())?"desc":"asc"},e.getNextSortingOrder=n=>{var r,o;const a=e.getFirstSortDir(),l=e.getIsSorted();return l?!!(l===a||null!=(r=t.options.enableSortingRemoval)&&!r||n&&null!=(o=t.options.enableMultiRemove)&&!o)&&("desc"===l?"asc":"desc"):a},e.getCanSort=()=>{var n,r;return(null==(n=e.columnDef.enableSorting)||n)&&(null==(r=t.options.enableSorting)||r)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return null!=(n=null!=(r=e.columnDef.enableMultiSort)?r:t.options.enableMultiSort)?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=null==(n=t.getState().sorting)?void 0:n.find((t=>t.id===e.id));return!!r&&(r.desc?"desc":"asc")},e.getSortIndex=()=>{var n,r;return null!=(n=null==(r=t.getState().sorting)?void 0:r.findIndex((t=>t.id===e.id)))?n:-1},e.clearSorting=()=>{t.setSorting((t=>null!=t&&t.length?t.filter((t=>t.id!==e.id)):[]))},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(null==r.persist||r.persist(),null==e.toggleSorting||e.toggleSorting(void 0,!!e.getCanMultiSort()&&(null==t.options.isMultiSortEvent?void 0:t.options.isMultiSortEvent(r))))}}},createTable:e=>{e.setSorting=t=>null==e.options.onSortingChange?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.sorting)?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},va={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Lo("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility((t=>({...t,[e.id]:null!=n?n:!e.getIsVisible()})))},e.getIsVisible=()=>{var n,r;const o=e.columns;return null==(n=o.length?o.some((e=>e.getIsVisible())):null==(r=t.getState().columnVisibility)?void 0:r[e.id])||n},e.getCanHide=()=>{var n,r;return(null==(n=e.columnDef.enableHiding)||n)&&(null==(r=t.options.enableHiding)||r)},e.getToggleVisibilityHandler=()=>t=>{null==e.toggleVisibility||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Ro((()=>[e.getAllCells(),t.getState().columnVisibility]),(e=>e.filter((e=>e.column.getIsVisible()))),Io(t.options,"debugRows")),e.getVisibleCells=Ro((()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()]),((e,t,n)=>[...e,...t,...n]),Io(t.options,"debugRows"))},createTable:e=>{const t=(t,n)=>Ro((()=>[n(),n().filter((e=>e.getIsVisible())).map((e=>e.id)).join("_")]),(e=>e.filter((e=>null==e.getIsVisible?void 0:e.getIsVisible()))),Io(e.options,"debugColumns"));e.getVisibleFlatColumns=t(0,(()=>e.getAllFlatColumns())),e.getVisibleLeafColumns=t(0,(()=>e.getAllLeafColumns())),e.getLeftVisibleLeafColumns=t(0,(()=>e.getLeftLeafColumns())),e.getRightVisibleLeafColumns=t(0,(()=>e.getRightLeafColumns())),e.getCenterVisibleLeafColumns=t(0,(()=>e.getCenterLeafColumns())),e.setColumnVisibility=t=>null==e.options.onColumnVisibilityChange?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:null!=(n=e.initialState.columnVisibility)?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=null!=(n=t)?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce(((e,n)=>({...e,[n.id]:t||!(null!=n.getCanHide&&n.getCanHide())})),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some((e=>!(null!=e.getIsVisible&&e.getIsVisible()))),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some((e=>null==e.getIsVisible?void 0:e.getIsVisible())),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible(null==(n=t.target)?void 0:n.checked)}}};function wa(e,t){return t?"center"===t?e.getCenterVisibleLeafColumns():"left"===t?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const ba=[Fo,va,oa,la,ea,ya,ra,Wo,aa,ia,Go];function xa(e){var t;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let n={_features:ba};const r=n._features.reduce(((e,t)=>Object.assign(e,null==t.getDefaultOptions?void 0:t.getDefaultOptions(n))),{});let o={...null!=(t=e.initialState)?t:{}};n._features.forEach((e=>{var t;o=null!=(t=null==e.getInitialState?void 0:e.getInitialState(o))?t:o}));const a=[];let l=!1;const i={_features:ba,options:{...r,...e},initialState:o,_queue:e=>{a.push(e),l||(l=!0,Promise.resolve().then((()=>{for(;a.length;)a.shift()();l=!1})).catch((e=>setTimeout((()=>{throw e})))))},reset:()=>{n.setState(n.initialState)},setOptions:e=>{const t=Po(e,n.options);n.options=(e=>n.options.mergeOptions?n.options.mergeOptions(r,e):{...r,...e})(t)},getState:()=>n.options.state,setState:e=>{null==n.options.onStateChange||n.options.onStateChange(e)},_getRowId:(e,t,r)=>{var o;return null!=(o=null==n.options.getRowId?void 0:n.options.getRowId(e,t,r))?o:`${r?[r.id,t].join("."):t}`},getCoreRowModel:()=>(n._getCoreRowModel||(n._getCoreRowModel=n.options.getCoreRowModel(n)),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:(e,t)=>{let r=(t?n.getPrePaginationRowModel():n.getRowModel()).rowsById[e];if(!r&&(r=n.getCoreRowModel().rowsById[e],!r))throw new Error;return r},_getDefaultColumnDef:Ro((()=>[n.options.defaultColumn]),(e=>{var t;return e=null!=(t=e)?t:{},{header:e=>{const t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t,n;return null!=(t=null==(n=e.renderValue())||null==n.toString?void 0:n.toString())?t:null},...n._features.reduce(((e,t)=>Object.assign(e,null==t.getDefaultColumnDef?void 0:t.getDefaultColumnDef())),{}),...e}}),Io(e,"debugColumns")),_getColumnDefs:()=>n.options.columns,getAllColumns:Ro((()=>[n._getColumnDefs()]),(e=>{const t=function(e,r,o){return void 0===o&&(o=0),e.map((e=>{const a=function(e,t,n,r){var o,a;const l={...e._getDefaultColumnDef(),...t},i=l.accessorKey;let c,s=null!=(o=null!=(a=l.id)?a:i?i.replace(".","_"):void 0)?o:"string"==typeof l.header?l.header:void 0;if(l.accessorFn?c=l.accessorFn:i&&(c=i.includes(".")?e=>{let t=e;for(const e of i.split(".")){var n;t=null==(n=t)?void 0:n[e]}return t}:e=>e[l.accessorKey]),!s)throw new Error;let u={id:`${String(s)}`,accessorFn:c,parent:r,depth:n,columnDef:l,columns:[],getFlatColumns:Ro((()=>[!0]),(()=>{var e;return[u,...null==(e=u.columns)?void 0:e.flatMap((e=>e.getFlatColumns()))]}),Io(e.options,"debugColumns")),getLeafColumns:Ro((()=>[e._getOrderColumnsFn()]),(e=>{var t;if(null!=(t=u.columns)&&t.length){let t=u.columns.flatMap((e=>e.getLeafColumns()));return e(t)}return[u]}),Io(e.options,"debugColumns"))};for(const t of e._features)null==t.createColumn||t.createColumn(u,e);return u}(n,e,o,r),l=e;return a.columns=l.columns?t(l.columns,a,o+1):[],a}))};return t(e)}),Io(e,"debugColumns")),getAllFlatColumns:Ro((()=>[n.getAllColumns()]),(e=>e.flatMap((e=>e.getFlatColumns()))),Io(e,"debugColumns")),_getAllFlatColumnsById:Ro((()=>[n.getAllFlatColumns()]),(e=>e.reduce(((e,t)=>(e[t.id]=t,e)),{})),Io(e,"debugColumns")),getAllLeafColumns:Ro((()=>[n.getAllColumns(),n._getOrderColumnsFn()]),((e,t)=>t(e.flatMap((e=>e.getLeafColumns())))),Io(e,"debugColumns")),getColumn:e=>n._getAllFlatColumnsById()[e]};Object.assign(n,i);for(let e=0;e<n._features.length;e++){const t=n._features[e];null==t||null==t.createTable||t.createTable(n)}return n}const Ea=(e,t,n,r,o,a,l)=>{let i={id:t,index:r,original:n,depth:o,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(i._valuesCache.hasOwnProperty(t))return i._valuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?(i._valuesCache[t]=n.accessorFn(i.original,r),i._valuesCache[t]):void 0},getUniqueValues:t=>{if(i._uniqueValuesCache.hasOwnProperty(t))return i._uniqueValuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?n.columnDef.getUniqueValues?(i._uniqueValuesCache[t]=n.columnDef.getUniqueValues(i.original,r),i._uniqueValuesCache[t]):(i._uniqueValuesCache[t]=[i.getValue(t)],i._uniqueValuesCache[t]):void 0},renderValue:t=>{var n;return null!=(n=i.getValue(t))?n:e.options.renderFallbackValue},subRows:null!=a?a:[],getLeafRows:()=>function(e,t){const n=[],r=e=>{e.forEach((e=>{n.push(e);const o=t(e);null!=o&&o.length&&r(o)}))};return r(e),n}(i.subRows,(e=>e.subRows)),getParentRow:()=>i.parentId?e.getRow(i.parentId,!0):void 0,getParentRows:()=>{let e=[],t=i;for(;;){const n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:Ro((()=>[e.getAllLeafColumns()]),(t=>t.map((t=>function(e,t,n,r){const o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:()=>{var t;return null!=(t=o.getValue())?t:e.options.renderFallbackValue},getContext:Ro((()=>[e,n,t,o]),((e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue})),Io(e.options,"debugCells"))};return e._features.forEach((r=>{null==r.createCell||r.createCell(o,n,t,e)}),{}),o}(e,i,t,t.id)))),Io(e.options,"debugRows")),_getAllCellsByColumnId:Ro((()=>[i.getAllCells()]),(e=>e.reduce(((e,t)=>(e[t.column.id]=t,e)),{})),Io(e.options,"debugRows"))};for(let t=0;t<e._features.length;t++){const n=e._features[t];null==n||null==n.createRow||n.createRow(i,e)}return i};function Sa(){return e=>Ro((()=>[e.options.data]),(t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(t,o,a){void 0===o&&(o=0);const l=[];for(let c=0;c<t.length;c++){const s=Ea(e,e._getRowId(t[c],c,a),t[c],c,o,void 0,null==a?void 0:a.id);var i;n.flatRows.push(s),n.rowsById[s.id]=s,l.push(s),e.options.getSubRows&&(s.originalSubRows=e.options.getSubRows(t[c],c),null!=(i=s.originalSubRows)&&i.length&&(s.subRows=r(s.originalSubRows,o+1,s)))}return l};return n.rows=r(t),n}),Io(e.options,"debugTable",0,(()=>e._autoResetPageIndex())))}function ka(){return e=>Ro((()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter]),((t,n,r)=>{if(!t.rows.length||(null==n||!n.length)&&!r){for(let e=0;e<t.flatRows.length;e++)t.flatRows[e].columnFilters={},t.flatRows[e].columnFiltersMeta={};return t}const o=[],a=[];(null!=n?n:[]).forEach((t=>{var n;const r=e.getColumn(t.id);if(!r)return;const a=r.getFilterFn();a&&o.push({id:t.id,filterFn:a,resolvedValue:null!=(n=null==a.resolveFilterValue?void 0:a.resolveFilterValue(t.value))?n:t.value})}));const l=n.map((e=>e.id)),i=e.getGlobalFilterFn(),c=e.getAllLeafColumns().filter((e=>e.getCanGlobalFilter()));let s,u;r&&i&&c.length&&(l.push("__global__"),c.forEach((e=>{var t;a.push({id:e.id,filterFn:i,resolvedValue:null!=(t=null==i.resolveFilterValue?void 0:i.resolveFilterValue(r))?t:r})})));for(let e=0;e<t.flatRows.length;e++){const n=t.flatRows[e];if(n.columnFilters={},o.length)for(let e=0;e<o.length;e++){s=o[e];const t=s.id;n.columnFilters[t]=s.filterFn(n,t,s.resolvedValue,(e=>{n.columnFiltersMeta[t]=e}))}if(a.length){for(let e=0;e<a.length;e++){u=a[e];const t=u.id;if(u.filterFn(n,t,u.resolvedValue,(e=>{n.columnFiltersMeta[t]=e}))){n.columnFilters.__global__=!0;break}}!0!==n.columnFilters.__global__&&(n.columnFilters.__global__=!1)}}return function(e,t,n){return n.options.filterFromLeafRows?function(e,t,n){var r;const o=[],a={},l=null!=(r=n.options.maxLeafRowFilterDepth)?r:100,i=function(e,r){void 0===r&&(r=0);const c=[];for(let u=0;u<e.length;u++){var s;let m=e[u];const p=Ea(n,m.id,m.original,m.index,m.depth,void 0,m.parentId);if(p.columnFilters=m.columnFilters,null!=(s=m.subRows)&&s.length&&r<l){if(p.subRows=i(m.subRows,r+1),m=p,t(m)&&!p.subRows.length){c.push(m),a[m.id]=m,o.push(m);continue}if(t(m)||p.subRows.length){c.push(m),a[m.id]=m,o.push(m);continue}}else m=p,t(m)&&(c.push(m),a[m.id]=m,o.push(m))}return c};return{rows:i(e),flatRows:o,rowsById:a}}(e,t,n):function(e,t,n){var r;const o=[],a={},l=null!=(r=n.options.maxLeafRowFilterDepth)?r:100,i=function(e,r){void 0===r&&(r=0);const c=[];for(let u=0;u<e.length;u++){let m=e[u];if(t(m)){var s;if(null!=(s=m.subRows)&&s.length&&r<l){const e=Ea(n,m.id,m.original,m.index,m.depth,void 0,m.parentId);e.subRows=i(m.subRows,r+1),m=e}c.push(m),o.push(m),a[m.id]=m}}return c};return{rows:i(e),flatRows:o,rowsById:a}}(e,t,n)}(t.rows,(e=>{for(let t=0;t<l.length;t++)if(!1===e.columnFilters[l[t]])return!1;return!0}),e)}),Io(e.options,"debugTable",0,(()=>e._autoResetPageIndex())))}function Na(){return e=>Ro((()=>[e.getState().sorting,e.getPreSortedRowModel()]),((t,n)=>{if(!n.rows.length||null==t||!t.length)return n;const r=e.getState().sorting,o=[],a=r.filter((t=>{var n;return null==(n=e.getColumn(t.id))?void 0:n.getCanSort()})),l={};a.forEach((t=>{const n=e.getColumn(t.id);n&&(l[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})}));const i=e=>{const t=e.map((e=>({...e})));return t.sort(((e,t)=>{for(let r=0;r<a.length;r+=1){var n;const o=a[r],i=l[o.id],c=null!=(n=null==o?void 0:o.desc)&&n;let s=0;if(i.sortUndefined){const n=void 0===e.getValue(o.id),r=void 0===t.getValue(o.id);(n||r)&&(s=n&&r?0:n?i.sortUndefined:-i.sortUndefined)}if(0===s&&(s=i.sortingFn(e,t,o.id)),0!==s)return c&&(s*=-1),i.invertSorting&&(s*=-1),s}return e.index-t.index})),t.forEach((e=>{var t;o.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=i(e.subRows))})),t};return{rows:i(n.rows),flatRows:o,rowsById:n.rowsById}}),Io(e.options,"debugTable",0,(()=>e._autoResetPageIndex())))}function Oa(){return e=>Ro((()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows]),((e,t,n)=>!t.rows.length||!0!==e&&!Object.keys(null!=e?e:{}).length?t:n?Ca(t):t),Io(e.options,"debugTable"))}function Ca(e){const t=[],n=e=>{var r;t.push(e),null!=(r=e.subRows)&&r.length&&e.getIsExpanded()&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function ja(e){return e=>Ro((()=>[e.getState().pagination,e.getPrePaginationRowModel(),e.options.paginateExpandedRows?void 0:e.getState().expanded]),((t,n)=>{if(!n.rows.length)return n;const{pageSize:r,pageIndex:o}=t;let{rows:a,flatRows:l,rowsById:i}=n;const c=r*o,s=c+r;let u;a=a.slice(c,s),u=e.options.paginateExpandedRows?{rows:a,flatRows:l,rowsById:i}:Ca({rows:a,flatRows:l,rowsById:i}),u.flatRows=[];const m=e=>{u.flatRows.push(e),e.subRows.length&&e.subRows.forEach(m)};return u.rows.forEach(m),u}),Io(e.options,"debugTable"))}function Pa(e,n){return e?function(e){return"function"==typeof e&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}(r=e)||"function"==typeof r||function(e){return"object"==typeof e&&"symbol"==typeof e.$$typeof&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}(r)?t.createElement(e,n):e:null;var r}function La(e){const n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=t.useState((()=>({current:xa(n)}))),[o,a]=t.useState((()=>r.current.initialState));return r.current.setOptions((t=>({...t,...e,state:{...o,...e.state},onStateChange:t=>{a(t),null==e.onStateChange||e.onStateChange(t)}}))),r.current}const _a=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"}))})),Ra=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 7.5h-.75A2.25 2.25 0 0 0 4.5 9.75v7.5a2.25 2.25 0 0 0 2.25 2.25h7.5a2.25 2.25 0 0 0 2.25-2.25v-7.5a2.25 2.25 0 0 0-2.25-2.25h-.75m-6 3.75 3 3m0 0 3-3m-3 3V1.5m6 9h.75a2.25 2.25 0 0 1 2.25 2.25v7.5a2.25 2.25 0 0 1-2.25 2.25h-7.5a2.25 2.25 0 0 1-2.25-2.25v-.75"}))}));var Ia=["value","onChange","debounce"];function Aa(){return Aa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Aa.apply(null,arguments)}function Ta(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Fa(t){var n=t.value,r=t.onChange,o=t.debounce,a=void 0===o?500:o,l=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Ia),i=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ta(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ta(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(n),2),c=i[0],s=i[1];return(0,e.useEffect)((function(){s(n)}),[n]),(0,e.useEffect)((function(){var e=setTimeout((function(){r(c)}),a);return function(){return clearTimeout(e)}}),[c]),wp.element.createElement("input",Aa({},l,{value:c,onChange:function(e){return s(e.target.value)}}))}const Ma=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))})),Da=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"}))})),Ga=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"}))})),qa=function(e){var t=e.table;return wp.element.createElement("thead",{className:"border-b border-gray-900/10 text-sm leading-6 text-gray-900"},t.getHeaderGroups().map((function(e){return wp.element.createElement("tr",{key:e.id},e.headers.map((function(e,t){return wp.element.createElement("th",{onClick:e.column.getToggleSortingHandler(),key:e.id,colSpan:e.colSpan,className:"py-2 font-bold select-none",style:{width:0==t?"50px":"auto",cursor:e.column.getCanSort()?"pointer":"default"}},e.isPlaceholder?null:wp.element.createElement("div",{className:"flex items-end leading-none capitalize"},Pa(e.column.columnDef.header,e.getContext()),wp.element.createElement("span",null,e.column.getIsSorted()?"desc"===e.column.getIsSorted()?wp.element.createElement(Ma,{className:"w-3 h-3"}):wp.element.createElement(Da,{className:"w-3 h-3"}):e.column.getCanSort()?wp.element.createElement(Ga,{className:"w-3 h-3"}):"")))})))})))};function Va(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(Boolean).join(" ")}const Wa=function(e){var t=e.row,n=e.loadingProductId,r=e.toggleExpanded,o="variation"===t.original.type,a=t.getIsExpanded(),l=Va(o?"bg-sky-50":"",t.original.id===n?"bg-gray-100":"","py-4 wrap");return wp.element.createElement("tr",{key:t.id,className:Va(l,a?"bg-sky-300":"")},t.getVisibleCells().map((function(e,n){return wp.element.createElement("td",{key:e.id,onClick:function(){"select"!==e.column.id&&"actions"!==e.column.id&&r()},className:"py-4 wrap text-gray-600 ".concat(n===t.getVisibleCells().length-1?"text-right":"text-left"," ").concat(t.getCanExpand()&&"cursor-pointer"," ")},Pa(e.column.columnDef.cell,e.getContext()))})))},Ba=function(e){var t=e.table;return e.selectablePageRows,e.rowSelection,e.setRowSelection,wp.element.createElement("div",{className:"flex justify-between items-center py-2"},wp.element.createElement("div",{className:"flex items-center gap-2 "},wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.setPageIndex(0)},disabled:!t.getCanPreviousPage()},"<<"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.previousPage()},disabled:!t.getCanPreviousPage()},"<"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.nextPage()},disabled:!t.getCanNextPage()},">"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.setPageIndex(t.getPageCount()-1)},disabled:!t.getCanNextPage()},">>"),wp.element.createElement("span",{className:"flex items-center gap-1"},wp.element.createElement("div",null,"Page"),wp.element.createElement("strong",null,t.getState().pagination.pageIndex+1," of"," ",t.getPageCount())),wp.element.createElement("span",{className:"flex items-center gap-1"},"| Go to page:",wp.element.createElement("input",{type:"number",defaultValue:t.getState().pagination.pageIndex+1,onChange:function(e){var n=e.target.value?Number(e.target.value)-1:0;t.setPageIndex(n)},className:"border p-1 rounded w-16"})),wp.element.createElement("select",{value:t.getState().pagination.pageSize,onChange:function(e){t.setPageSize(Number(e.target.value))}},[10,20,30,40,50].map((function(e){return wp.element.createElement("option",{key:e,value:e},"Show ",e)})))),wp.element.createElement("div",{className:"flex justify-center items-center pr-2 gap-2 py-4"}))},Ha=function(t){var n=t.children,r=t.open,o=(t.onClose,t.className),a=t.backdrop,l=void 0===a||a,i=(0,e.useRef)(null);return r?wp.element.createElement("div",{className:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-start p-4 z-50",style:{marginLeft:"160px"}},l&&wp.element.createElement("div",{className:"absolute top-0 left-0 right-0 bottom-0 bg-black/30","aria-hidden":"true"}),wp.element.createElement("div",{ref:i,tabIndex:-1,className:Va("flex justify-center z-50 mx-auto",o),onClick:function(e){return e.stopPropagation()}},n)):null},za=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 9-3 3m0 0 3 3m-3-3h7.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))})),Ua=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m12.75 15 3-3m0 0-3-3m3 3h-7.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}));var $a=function(e){e.productsToImport;var t=e.rangeValue,n=e.dataToImport,r=e.handleStepChange,o=e.importProduct,a=e.importCount;return wp.element.createElement("div",null,wp.element.createElement("h4",{className:"text-base mb-4"},"Review"),wp.element.createElement("p",null,"You are about to import"," ",wp.element.createElement("span",{className:"font-semibold"},a)," products in batches of"," ",wp.element.createElement("span",{className:"font-semibold"},t),". Existing products will have their data updated, while new entries will be created for products not already in the system."),wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",null,"You have chosen to import/sync the following:"),wp.element.createElement("ul",{className:"flex gap-2 mt-2 flex-wrap"},Object.keys(n).map((function(e,t){if(n[e])return wp.element.createElement("li",{key:n[e]+t,className:"p-2 border border-gray-300 uppercase text-xs font-semibold"},e)})))),wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(){return r("backward")},className:"relative inline-flex items-center rounded-md bg-gray-400 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement(za,{className:"mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Go back")),wp.element.createElement("button",{type:"button",onClick:function(){r("forward"),o()},className:"relative inline-flex items-center rounded-md bg-red-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"IMPORT"),wp.element.createElement(Ua,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"}))))};const Za=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}));function Ya(e){return Ya="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ya(e)}function Ka(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Xa(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Ya(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ya(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ya(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ja=function(t){var n=t.progress,r=t.importCount,o=t.isImporting,a=t.setIsDialogOpen,l=t.setCurrentStep,i=(0,e.useRef)(null);return(0,e.useEffect)((function(){i.current&&(i.current.scrollTop=i.current.scrollHeight)}),[n]),wp.element.createElement("div",null,wp.element.createElement("div",null,wp.element.createElement("div",{className:""},wp.element.createElement("div",{className:"h-4 bg-gray-200 w-full rounded-lg mt-2"},wp.element.createElement("div",{className:"h-full bg-blue-500 rounded-lg",style:{width:"".concat(n.filter((function(e){return"string"!=typeof e})).length/r*100,"%")}})),wp.element.createElement("div",{className:"text-sm text-gray-500 mt-1"},"Imported"," ",n.filter((function(e){return"string"!=typeof e&&"success"===e.status})).length," ","of ",r," products."," ",Number(n.filter((function(e){return"string"!=typeof e})).length/r*100).toFixed(1),"%")),wp.element.createElement("div",{ref:i,className:"bg-slate-950 p-4 rounded-xl max-h-52 overflow-y-auto overflow-x-hidden w-full flex flex-col gap-2 mt-2"},n.map((function(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ka(Object(n),!0).forEach((function(t){Xa(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ka(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e);return delete n.variations,wp.element.createElement("p",{className:"break-words ".concat(e.status&&"success"===e.status?"text-green-500":e.status&&"failed"===e.status?"text-red-500":"text-blue-500"),key:e.square_id||t},JSON.stringify(n))}))),!o&&wp.element.createElement("div",{className:"flex flex-col items-center justify-center gap-2 py-4"},wp.element.createElement(Yt,{className:"w-12 h-12 text-green-500"}),wp.element.createElement("h3",{className:"text-xl text-green-500 font-semibold"},"Import complete!"),wp.element.createElement("p",{className:"font-semibold"},"You can now safely close this window."))),!o&&wp.element.createElement("div",{className:"flex items-center justify-end gap-2 mt-6"},wp.element.createElement("button",{type:"button",onClick:function(){a(!1),l(0)},className:"relative inline-flex items-center rounded-md bg-gray-400 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement(Za,{className:"mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Close"))))};function Qa(e){return Qa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qa(e)}function el(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function tl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?el(Object(n),!0).forEach((function(t){nl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):el(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function nl(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Qa(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Qa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Qa(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var rl=function(e){var t=e.dataToImport,n=e.setDataToImport,r=e.rangeValue,o=e.handleRangeChange,a=e.handleStepChange,l=e.setCurrentStep,i=e.setIsDialogOpen;return wp.element.createElement("div",null,wp.element.createElement("h4",{className:"text-base mb-4"},"Select the data you wish to import / sync:"),wp.element.createElement("fieldset",{className:"mb-3"},wp.element.createElement("legend",{className:"sr-only"},"data to sync"),wp.element.createElement("div",{className:"flex gap-x-6 gap-y-4 items-start flex-wrap"},wp.element.createElement("label",{htmlFor:"title",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",checked:t.title,onChange:function(){return n(tl(tl({},t),{},{title:!t.title}))},id:"title",className:"h-full !m-0"}),"Title"),wp.element.createElement("label",{htmlFor:"SKU",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",checked:t.sku,id:"SKU",className:"h-full !m-0",onChange:function(){return n(tl(tl({},t),{},{sku:!t.sku}))}}),"SKU"),wp.element.createElement("label",{htmlFor:"price",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"price",className:"h-full !m-0",checked:t.price,onChange:function(){return n(tl(tl({},t),{},{price:!t.price}))}}),"Price"),wp.element.createElement("label",{htmlFor:"description",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"description",checked:t.description,onChange:function(){return n(tl(tl({},t),{},{description:!t.description}))},className:"h-full !m-0"}),"Description"),wp.element.createElement("label",{htmlFor:"image",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"image",className:"h-full !m-0",checked:!1}),"Image ",wp.element.createElement(At,null)),wp.element.createElement("label",{htmlFor:"categories",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"categories",className:"h-full !m-0",checked:!1}),"Categories ",wp.element.createElement(At,null)),wp.element.createElement("label",{htmlFor:"stock",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"stock",className:"h-full !m-0",checked:t.stock,onChange:function(){return n(tl(tl({},t),{},{stock:!t.stock}))}}),"Stock"))),wp.element.createElement("p",null,"Existing products will have their data updated, while new entries will be created for products not already in the system."),wp.element.createElement("h4",{className:"text-base mt-4 mb-2"},"How many products to import in each batch?"),wp.element.createElement("p",null,"Increasing the number in each batch places a greater load on the server (especially when import images). If you encounter errors, consider reducing this value for better stability or disabling image import."),wp.element.createElement("div",{className:"relative mb-6 mt-3"},wp.element.createElement("label",{htmlFor:"labels-range-input",className:"sr-only"},"Labels range"),wp.element.createElement("input",{id:"labels-range-input",type:"range",value:r,onChange:o,step:5,min:"5",max:"50",className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer"}),wp.element.createElement("span",{className:"text-sm text-gray-500 absolute start-0 -bottom-6"},"Min 5"),wp.element.createElement("span",{className:"text-sm text-gray-600 font-semibold absolute start-1/2 -translate-x-1/2 -bottom-6"},r),wp.element.createElement("span",{className:"text-sm text-gray-500 absolute end-0 -bottom-6"},"Max 50")),wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(){l(0),i(!1)},className:"relative inline-flex items-center rounded-md bg-gray-400 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"Cancel"),wp.element.createElement(Za,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"})),wp.element.createElement("button",{type:"button",onClick:function(){return a("forward")},className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"Continue"),wp.element.createElement(Ua,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"}))))},ol=function(e){var t=e.currentStep,n=e.rangeValue,r=e.dataToImport,o=e.handleStepChange,a=e.setCurrentStep,l=e.handleRangeChange,i=e.setDataToImport,c=e.importProduct,s=e.importCount,u=e.productsToImport,m=e.isImporting,p=e.setIsDialogOpen,f=e.progress;switch(t){case 0:return wp.element.createElement(rl,{dataToImport:r,setDataToImport:i,rangeValue:n,handleRangeChange:l,handleStepChange:o,setCurrentStep:a,setIsDialogOpen:p});case 1:return wp.element.createElement($a,{progress:f,dataToImport:r,importProduct:c,importCount:s,handleStepChange:o,setCurrentStep:a,productsToImport:u,isImporting:m,rangeValue:n,setIsDialogOpen:p});case 2:return wp.element.createElement(Ja,{progress:f,importCount:s,handleStepChange:o,setCurrentStep:a,isImporting:m,setIsDialogOpen:p});default:return wp.element.createElement("div",null,"Invalid step")}};function al(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const ll=function(t){var n=t.isDialogOpen,r=t.setIsDialogOpen,o=t.progress,a=t.rangeValue,l=t.setRangeValue,i=t.setDataToImport,c=t.dataToImport,s=t.importProduct,u=t.productsToImport,m=t.importCount,p=t.isImporting,f=[{name:"Step 1",href:"#",status:"current"},{name:"Step 2",href:"#",status:"upcoming"},{name:"Step 3",href:"#",status:"upcoming"}],d=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return al(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?al(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(0),2),h=d[0],g=d[1];return wp.element.createElement(Ha,{open:n,onClose:function(){return r(!1)},className:"w-[40vw] max-w-[40vw] mx-auto bg-white p-6 rounded-xl"},wp.element.createElement("div",{className:"w-full"},wp.element.createElement("header",{className:"flex justify-between items-center gap-2 mb-4"},wp.element.createElement("h3",{className:"text-lg font-medium leading-6 text-gray-900"},"Import from Square"),wp.element.createElement("nav",{className:"flex items-center justify-center","aria-label":"Progress"},wp.element.createElement("p",{className:"text-sm font-medium"},"Step ",h+1," of ",f.length),wp.element.createElement("ol",{role:"list",className:"ml-8 flex items-center space-x-5"},f.map((function(e,t){return wp.element.createElement("li",{key:e.name},"complete"===e.status?wp.element.createElement("span",{className:"block h-2.5 w-2.5 rounded-full bg-sky-600 hover:bg-sky-900"},wp.element.createElement("span",{className:"sr-only"},e.name)):h===t?wp.element.createElement("span",{className:"relative flex items-center justify-center","aria-current":"step"},wp.element.createElement("span",{className:"absolute flex h-5 w-5 p-px","aria-hidden":"true"},wp.element.createElement("span",{className:"h-full w-full rounded-full bg-sky-200"})),wp.element.createElement("span",{className:"relative block h-2.5 w-2.5 rounded-full bg-sky-600","aria-hidden":"true"}),wp.element.createElement("span",{className:"sr-only"},e.name)):wp.element.createElement("span",{className:"block h-2.5 w-2.5 rounded-full bg-gray-200 hover:bg-gray-400"},wp.element.createElement("span",{className:"sr-only"},e.name)))}))))),wp.element.createElement(ol,{currentStep:h,rangeValue:a,dataToImport:c,handleStepChange:function(e){g((function(t){return"forward"===e&&t<f.length-1?t+1:"backward"===e&&t>0?t-1:t}))},setCurrentStep:g,handleRangeChange:function(e){l(Number(e.target.value))},importCount:m,productsToImport:u,setDataToImport:i,importProduct:s,isImporting:p,setIsDialogOpen:r,progress:o}),p&&wp.element.createElement("p",{className:"text-red-500 font-semibold text-center mt-2"},"Do not close this window, import will be cancelled")))};function il(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var cl=(0,e.createContext)({blockNavigation:!1,setBlockNavigation:function(){}}),sl=function(t){var n=t.children,r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return il(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?il(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(!1),2),o=r[0],a=r[1];return wp.element.createElement(cl.Provider,{value:{blockNavigation:o,setBlockNavigation:a}},n)};function ul(e){return ul="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ul(e)}function ml(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pl(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=ul(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ul(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ul(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fl(e){return function(e){if(Array.isArray(e))return dl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return dl(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dl(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var hl=function(e){var t=e.isExpanded;return e.row.getCanExpand()?wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4 ".concat(t?"rotate-90":"")},wp.element.createElement("polyline",{points:"9 18 15 12 9 6"})):wp.element.createElement(React.Fragment,null)},gl=function(){return wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-gray-300"},wp.element.createElement("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),wp.element.createElement("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"}))},yl=function(e){var t={false:{bgColor:"bg-red-100",textColor:"text-red-700",fillColor:"fill-red-500",text:"Not imported"},partial:{bgColor:"bg-yellow-100",textColor:"text-yellow-700",fillColor:"fill-yellow-500",text:"Partial"},true:{bgColor:"bg-green-100",textColor:"text-green-700",fillColor:"fill-green-500",text:"Imported"}},n=t[e.status]||t.false,r=n.bgColor,o=n.textColor,a=n.fillColor,l=n.text;return wp.element.createElement("span",{className:"inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium ".concat(r," ").concat(o)},wp.element.createElement("svg",{className:"h-1.5 w-1.5 ".concat(a),viewBox:"0 0 6 6","aria-hidden":"true"},wp.element.createElement("circle",{cx:"3",cy:"3",r:"3"})),l)},vl=function(e){var t=e.value;return wp.element.createElement("div",{className:"group relative w-10 h-10"},t.map((function(e,n){return wp.element.createElement("img",{key:n,src:e,alt:"",width:40,height:40,className:Va("w-10 h-10 rounded object-cover flex items-center gap-2 shadow top-0 absolute transition-transform duration-300",0===n&&t.length>1&&"group-hover:-translate-y-2 rotate-12 group-hover:rotate-[-16deg]",1===n&&t.length>1&&"group-hover:translate-y-2 group-hover:rotate-[16deg]")})})))},wl=["indeterminate","className"];function bl(){return bl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bl.apply(null,arguments)}const xl=function(e){var n=e.indeterminate,r=e.className,o=void 0===r?"":r,a=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,wl),l=(0,t.useRef)(null);return(0,t.useEffect)((function(){"boolean"==typeof n&&(l.current.indeterminate=!a.checked&&n)}),[n,a.checked]),wp.element.createElement("input",bl({type:"checkbox",ref:l,className:o+" cursor-pointer"},a))};var El=function(e,t,n,r,o){var a=!o||e.original.present_at_location_ids&&e.original.present_at_location_ids.includes(r),l=!!e.getValue(t)&&e.getValue(t).toString().toLowerCase().includes(n.toLowerCase()),i=e.subRows&&e.subRows.some((function(e){var r=e.getValue(t);return!!r&&r.toString().toLowerCase().includes(n.toLowerCase())}));return(l||i)&&a},Sl=function(e,t,n){if(!n)return!0;var r=function(e){return!e||!0===e.getValue(t)||r(e.parent)};return r(e)},kl=function(e,t,n){if(!n)return!0;var r=function(e){return!e||!0!==e.getValue(t)||r(e.parent)};return r(e)};function Nl(e){return Nl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nl(e)}function Ol(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Cl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ol(Object(n),!0).forEach((function(t){jl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ol(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function jl(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Nl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Nl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Nl(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pl(e){return Pl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pl(e)}function Ll(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ll(Object(n),!0).forEach((function(t){Rl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ll(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rl(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Pl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Pl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Pl(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Il(){Il=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Pl(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Pl(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function Al(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function Tl(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){Al(a,r,o,l,i,"next",e)}function i(e){Al(a,r,o,l,i,"throw",e)}l(void 0)}))}}function Fl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Ml=function(e,t){return e.reduce((function(n,r,o){return o%t?n:[].concat(function(e){return function(e){if(Array.isArray(e))return Fl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Fl(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fl(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(n),[e.slice(o,o+t)])}),[])};function Dl(_x,e,t,n){return Gl.apply(this,arguments)}function Gl(){return Gl=Tl(Il().mark((function e(t,n,r,o){var a,l,i,c;return Il().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=n.find((function(e){return e.id===t.id}))){e.next=3;break}return e.abrupt("return",{error:"Product ".concat(t.id," not found in inventory")});case 3:return l=_l({},a),"Variable"===t.type&&(l.variable=!0),t.subRows&&t.subRows.length>0&&(i=t.subRows.map((function(e){return e.id})),c=a.item_data.variations.filter((function(e){return i.includes(e.id)})),l=_l(_l({},l),{},{item_data:_l(_l({},a.item_data),{},{variations:c})})),e.prev=6,e.next=9,Ut({path:"/sws/v1/square-inventory/import",signal:null==r?void 0:r.signal,method:"POST",data:{product:[l],datatoimport:o}});case 9:return e.abrupt("return",e.sent);case 12:return e.prev=12,e.t0=e.catch(6),e.abrupt("return",{error:e.t0});case 15:case"end":return e.stop()}}),e,null,[[6,12]])}))),Gl.apply(this,arguments)}var ql=function(){var e=Tl(Il().mark((function e(t){return Il().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Ut({path:"/sws/v1/logs",method:"POST",data:{log:t}});case 3:return e.abrupt("return",e.sent);case 6:e.prev=6,e.t0=e.catch(0),console.error("Error logging to backend:",e.t0);case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}(),Vl=function(e,t){return t.map((function(t){var n=e.find((function(e){return e.square_id===t.id})),r=n&&"success"===n.status;return _l(_l({},t),{},{woocommerce_product_id:(null==n?void 0:n.product_id)||t.woocommerce_product_id,imported:n?r:t.imported,status:n?r:t.status,item_data:_l(_l({},t.item_data),{},{variations:t.item_data.variations?t.item_data.variations.map((function(e){var t,o=null==n||null===(t=n.variations)||void 0===t?void 0:t.find((function(t){return t.square_product_id===e.id})),a=o?r:e.imported,l=o?r:e.status;return _l(_l({},e),{},{imported:a,status:l})})):t.item_data.variations})})}))},Wl=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;return new Promise((function(n,r){var o=function(){var a=Tl(Il().mark((function a(l){var i,c;return Il().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,i=null,e)try{localStorage.removeItem("inventoryData")}catch(e){console.warn("Failed to remove data from local storage:",e)}else{try{i=localStorage.getItem("inventoryData")}catch(e){console.warn("Failed to retrieve data from local storage:",e)}i&&setTimeout((function(){var e=JSON.parse(i);return n({status:"success",data:e})}),100)}return a.next=5,Ut({path:"/sws/v1/square-inventory".concat(l&&e?"?force=true":"")});case 5:if((c=a.sent).loading)l&&F.info("Fetching data, please wait...",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!1}),setTimeout((function(){return o(!1)}),t);else if(0===c.data.length)F.info("No data available",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),n({status:"success",data:[]});else{try{localStorage.setItem("inventoryData",JSON.stringify(c.data))}catch(e){console.warn("Failed to store data in local storage:",e)}F.success("Products Retreived",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),n({status:"success",data:c.data})}a.next=13;break;case 9:a.prev=9,a.t0=a.catch(0),F.error("Error fetching products: ".concat(a.t0.message||"Server error"),{autoClose:5e3,closeOnClick:!0}),r({status:"error",error:a.t0.message||"Server error"});case 13:case"end":return a.stop()}}),a,null,[[0,9]])})));return function(e){return a.apply(this,arguments)}}();o(!0)}))};function Bl(e){return Bl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bl(e)}function Hl(){Hl=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Bl(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Bl(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function zl(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function Ul(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){zl(a,r,o,l,i,"next",e)}function i(e){zl(a,r,o,l,i,"throw",e)}l(void 0)}))}}var $l=wo("inventory/fetchIfNeeded",Ul(Hl().mark((function e(){var t,n,r,o,a,l,i,c,s=arguments;return Hl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]&&s[0],r=(n=s.length>1?s[1]:void 0).getState,o=n.rejectWithValue,a=r(),l=a.inventory,!t&&null!==l.data){e.next=25;break}return e.prev=4,e.next=7,Wl(t);case 7:if(i=e.sent,console.log(i),"success"!==i.status){e.next=13;break}return e.abrupt("return",i.data);case 13:if("loading"!==i.status){e.next=17;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 17:throw new Error(i.error);case 18:e.next=23;break;case 20:return e.prev=20,e.t0=e.catch(4),e.abrupt("return",o(e.t0.message));case 23:e.next=45;break;case 25:if(!l.loading){e.next=44;break}return e.prev=26,e.next=29,Wl(!1);case 29:if("success"!==(c=e.sent).status){e.next=34;break}return e.abrupt("return",c.data);case 34:if("loading"!==c.status){e.next=38;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 38:throw new Error(c.error);case 39:e.next=44;break;case 41:return e.prev=41,e.t1=e.catch(26),e.abrupt("return",o(e.t1.message));case 44:return e.abrupt("return",l.data);case 45:case"end":return e.stop()}}),e,null,[[4,20],[26,41]])})))),Zl=fo({name:"inventory",initialState:{data:null,loading:!1,error:null,fetchAttempted:!1},reducers:{setInventory:function(e,t){e.data=t.payload},addItem:function(e,t){e.data.push(t.payload)},removeItem:function(e,t){e.data=e.data.filter((function(e){return e.id!==t.payload}))}},extraReducers:function(e){e.addCase($l.pending,(function(e){e.loading=!0,e.fetchAttempted=!0})).addCase($l.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase($l.rejected,(function(e,t){e.loading=!1,e.data=[],e.error=t.payload}))}}),Yl=Zl.actions,Kl=Yl.setInventory;Yl.addItem,Yl.removeItem;const Xl=Zl.reducer;function Jl(e){return Jl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jl(e)}function Ql(e){return function(e){if(Array.isArray(e))return si(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ci(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ei(){ei=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Jl(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Jl(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function ti(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ni(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ti(Object(n),!0).forEach((function(t){ri(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ti(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ri(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Jl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Jl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Jl(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oi(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=ci(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw o}}}}function ai(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function li(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){ai(a,r,o,l,i,"next",e)}function i(e){ai(a,r,o,l,i,"throw",e)}l(void 0)}))}}function ii(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||ci(e,t)||function(){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 ci(e,t){if(e){if("string"==typeof e)return si(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?si(e,t):void 0}}function si(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ui(e){return ui="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ui(e)}function mi(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=gi(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw o}}}}function pi(){pi=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==ui(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(ui(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function fi(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function di(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){fi(a,r,o,l,i,"next",e)}function i(e){fi(a,r,o,l,i,"throw",e)}l(void 0)}))}}function hi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||gi(e,t)||function(){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 gi(e,t){if(e){if("string"==typeof e)return yi(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yi(e,t):void 0}}function yi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const vi=function(t){var n=t.setIsAutoMatchOpen,r=t.inventory,o=hi((0,e.useState)("sku"),2),a=o[0],l=o[1],i=hi((0,e.useState)(!1),2),c=i[0],s=i[1],u=hi((0,e.useState)(""),2),m=u[0],p=u[1],f=function(e,t){for(var n=[],r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n},d=function(){var e=di(pi().mark((function e(t,n){return pi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Ut({path:"/sws/v1/matcher",method:"POST",data:{match_key:n,inventory:t}});case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),console.error("Error sending batch:",e.t0);case 8:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(_x,t){return e.apply(this,arguments)}}(),h=function(){var e=di(pi().mark((function e(){var t,n,o,l;return pi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s(!0),t=f(r,100),n=mi(t),e.prev=4,n.s();case 6:if((o=n.n()).done){e.next=12;break}return l=o.value,e.next=10,d(l,a);case 10:e.next=6;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(4),n.e(e.t0);case 17:return e.prev=17,n.f(),e.finish(17);case 20:p("Auto matcher complete, reload inventory table to see results"),s(!1);case 22:case"end":return e.stop()}}),e,null,[[4,14,17,20]])})));return function(){return e.apply(this,arguments)}}();return wp.element.createElement("div",{className:"w-[40vw] max-w-[40vw] mx-auto bg-white p-6 rounded-xl"},wp.element.createElement("div",{className:"w-full"},wp.element.createElement("header",{className:"flex justify-between items-center gap-2 mb-4"},wp.element.createElement("h3",{className:"text-lg font-medium leading-6 text-gray-900"},"Auto Matcher"))),wp.element.createElement("p",null,"Automatically link your existing WooCommerce products with Square using the SKU matcher. Products that are already linked will be skipped to avoid duplication. For the best results, ensure your WooCommerce product structure aligns with Square—for example, Square variations should correspond to WooCommerce variable products. Make sure each product has a unique SKU, as duplicates may cause issues with automatic syncing."),wp.element.createElement("p",{className:"text-sm font-semibold mt-3"},"Match via:"),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:a,onChange:function(e){return l(e.target.value)}},wp.element.createElement("option",{value:"sku"},"SKU")),m&&wp.element.createElement("p",{className:"text-sky-500 mt-4"},m),c?wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400",disabled:""},wp.element.createElement("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},wp.element.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),wp.element.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})),"Processing...")):wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(){return n(!1)},className:"relative inline-flex items-center rounded-md bg-gray-400 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"Close"),wp.element.createElement(Za,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"})),wp.element.createElement("button",{type:"button",onClick:h,className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"Start matching"),wp.element.createElement(Ua,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"}))))};function wi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return bi(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bi(e,t):void 0}}(e,t)||function(){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 bi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var xi="undefined"==typeof AbortController?void 0:new AbortController;const Ei=function(t){var n=t.getInventory,r=t.settings,o=X((function(e){return e.inventory})),a=o.data,l=o.loading,i=o.error,c=(o.fetchAttempted,wi((0,e.useState)(!1),2)),s=c[0],u=c[1],m=wi((0,e.useState)(!1),2),p=m[0],f=m[1],d=wi((0,e.useState)(15),2),h=d[0],g=d[1],y=function(){var t=ii((0,e.useState)(!1),2),n=t[0],r=t[1],o=ii((0,e.useState)([]),2),a=o[0],l=o[1],i=oe(),c=(0,e.useCallback)(function(){var e=li(ei().mark((function e(t,o,a,c){var s,u,m,p,f,d,h,g=arguments;return ei().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=g.length>4&&void 0!==g[4]?g[4]:15,!n){e.next=3;break}return e.abrupt("return");case 3:r(!0),l([]),u=Ml(t,s),m=[],p=oi(u),e.prev=8,d=ei().mark((function e(){var t,n;return ei().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=f.value,e.next=3,Promise.all(t.map(function(){var e=li(ei().mark((function e(t){var n,r,l,i;return ei().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Dl(t,o,a,c);case 3:return n=e.sent,r=n.error?{status:"failed",product_id:"N/A",square_id:t.id,message:n.error}:ni(ni({},n[0]),{},{status:"success"}),ql({type:r.status,message:r.message,context:{product_id:r.product_id,square_id:t.id}}),e.abrupt("return",r);case 9:return e.prev=9,e.t0=e.catch(0),l="AbortError"===e.t0.name?"Request Aborted":e.t0.message,i={status:"failed",product_id:"N/A",square_id:t.id,message:l},ql({type:"error",message:l,context:{product_id:i.product_id,square_id:t.id}}),e.abrupt("return",i);case 15:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(t){return e.apply(this,arguments)}}()));case 3:n=e.sent,m=[].concat(Ql(m),Ql(n)),l((function(e){return[].concat(Ql(e),Ql(n.map((function(e){return e}))))}));case 6:case"end":return e.stop()}}),e)})),p.s();case 11:if((f=p.n()).done){e.next=15;break}return e.delegateYield(d(),"t0",13);case 13:e.next=11;break;case 15:e.next=20;break;case 17:e.prev=17,e.t1=e.catch(8),p.e(e.t1);case 20:return e.prev=20,p.f(),e.finish(20);case 23:if(h=Vl(m,o)){try{localStorage.setItem("inventoryData",JSON.stringify(h))}catch(e){console.warn("Failed to store data in local storage:",e)}i(Kl(h))}r(!1);case 26:case"end":return e.stop()}}),e,null,[[8,17,20,23]])})));return function(_x,t,n,r){return e.apply(this,arguments)}}(),[n,i]);return{isImporting:n,progress:a,importProduct:c}}(),v=y.isImporting,w=y.progress,b=y.importProduct,x=wi((0,e.useState)([]),2),E=x[0],S=x[1],k=wi((0,e.useState)({title:!0,sku:!0,description:!0,stock:!0,image:!0,categories:!0,price:!0}),2),N=k[0],O=k[1],C=wi((0,e.useState)({}),2),j=C[0],P=C[1],L=wi((0,e.useState)([]),2),_=L[0],R=L[1],I=wi((0,e.useState)(""),2),A=I[0],T=I[1],F=wi((0,e.useState)({}),2),M=F[0],D=F[1],G=wi((0,e.useState)([]),2),q=G[0],V=G[1],W=wi((0,e.useState)([]),2),B=W[0],H=(W[1],wi((0,e.useState)(!0),2)),z=H[0],U=H[1],$=wi((0,e.useState)(!1),2),Z=$[0],Y=$[1],K=wi((0,e.useState)(!1),2),J=K[0],Q=K[1],ee=function(t,n,r,o,a,l){var i=n.expanded,c=n.setExpanded,s=n.sorting,u=n.setSorting,m=n.globalFilter,p=n.setGlobalFilter,f=n.isImporting,d=n.setProductsToImport,h=n.setIsDialogOpen,g=n.rowSelection,y=n.setRowSelection,v=n.selectableRows,w=n.setSelectableRows,b=(0,e.useMemo)((function(){return function(e){return e.map((function(e){var t,n,r,o,a,l,i,c,s,u,m,p=((null===(t=e.item_data)||void 0===t?void 0:t.variations)||[]).map((function(e){var t=isNaN(parseInt(e.inventory_count))?0:parseInt(e.inventory_count),n=e.item_variation_data.price_money?e.item_variation_data.price_money.amount/100:0;return{sku:e.item_variation_data.sku,name:e.item_variation_data.name,type:"variation",price:n,status:e.imported,stock:t,id:e.id,woocommerce_product_id:e.woocommerce_product_id||null}})),f=((null===(n=e.item_data)||void 0===n?void 0:n.variations)||[]).map((function(e){return e.item_variation_data.price_money?e.item_variation_data.price_money.amount/100:0})),d=((null===(r=e.item_data)||void 0===r?void 0:r.variations)||[]).map((function(e){return isNaN(parseInt(e.inventory_count))?0:parseInt(e.inventory_count)}));f.length>0?(u=Math.min.apply(Math,fl(f)),m=Math.max.apply(Math,fl(f))):u=m=0;var h=d.length?Math.min.apply(Math,fl(d)):0,g=d.length?Math.max.apply(Math,fl(d)):0;return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ml(Object(n),!0).forEach((function(t){pl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ml(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({sku:Array.isArray(null===(o=e.item_data)||void 0===o?void 0:o.variations)&&e.item_data.variations.length>0&&(null===(a=e.item_data.variations[0])||void 0===a||null===(a=a.item_variation_data)||void 0===a?void 0:a.sku)||"",id:e.id,visibility:e.visibility,is_archived:e.is_archived,name:(null===(l=e.item_data)||void 0===l?void 0:l.name)||"",present_at_location_ids:e.present_at_location_ids,stock:h===g?"".concat(h):"".concat(h," - ").concat(g),image:null!==(i=e.item_data)&&void 0!==i&&i.image_urls?e.item_data.image_urls:null,woocommerce_product_id:e.woocommerce_product_id||null,type:((null===(c=e.item_data)||void 0===c||null===(c=c.variations)||void 0===c?void 0:c.length)||0)>1?"Variable":"Simple",price:u===m?"$".concat(u):"$".concat(u," - $").concat(m),categories:null!==(s=e.item_data)&&void 0!==s&&s.categories?e.item_data.categories:"",status:e.imported},p.length>1&&{subRows:p})}))}(t)}),[t]),x=(0,e.useMemo)((function(){return[{id:"expander",width:50,cell:function(e){var t=e.row;return wp.element.createElement(React.Fragment,null,t.getCanExpand()?wp.element.createElement("button",{type:"button"},wp.element.createElement(hl,{isExpanded:t.getIsExpanded(),row:t})):null)}},{accessorKey:"id",header:function(){return"id"},show:!1},{id:"visibility",accessorKey:"visibility",header:"Visibility",accessorFn:function(e){return e.visibility||""},filterFn:Sl,show:!1},{id:"is_archived",accessorKey:"is_archived",header:"Is Archived",accessorFn:function(e){return e.is_archived},filterFn:kl,show:!1},{accessorKey:"sku",header:function(){return"SKU"},canSort:!0},{accessorKey:"image",header:function(){return""},enableSorting:!1,width:50,cell:function(e){var t=(0,e.getValue)();return t?wp.element.createElement(vl,{value:t}):wp.element.createElement(gl,null)}},{accessorKey:"name",header:function(){return"Name"},canSort:!0,cell:function(e){var t=e.getValue,n=e.row,r=t();return wp.element.createElement("div",null,wp.element.createElement("p",null,r),wp.element.createElement("p",{className:"text-xs text-gray-500"},"ID: ",n.original.id))}},{accessorKey:"type",header:function(){return"Type"},canSort:!0},{accessorKey:"price",canSort:!0,header:function(){return"Price"}},{accessorKey:"stock",canSort:!0,header:function(){return"Stock"}},{accessorKey:"categories",header:function(){return"categories"},canSort:!0,cell:function(e){var t=(0,e.getValue)();return t&&t.length>0?function(e){var t="",n=e.filter((function(e){return!1===e.parent_id}));n.forEach((function(n){var r=e.filter((function(e){return e.parent_id===n.id})).map((function(e){return e.name}));t+=(t?" | ":"")+n.name,r.length>0&&(t+=" -> "+r.join(", "))}));var r=e.filter((function(e){return!n.find((function(t){return t.id===e.id}))&&!n.some((function(t){return t.id===e.parent_id}))}));if(r.length>0){var o=r.map((function(e){return e.name})).join(", ");t+=(t?" | ":"")+o}return t}(t):""}},{accessorKey:"status",canSort:!0,header:function(){return"Status"},cell:function(e){var t=(0,e.getValue)();return wp.element.createElement(yl,{status:t})}},{id:"actions",colSpan:2,cell:function(e){var t,n=e.row;if(!(n.original.subRows&&n.original.subRows.length>0||n.parentId)){var r=(null===(t=n.original.subRows)||void 0===t?void 0:t.filter((function(e){var t;return null===(t=n.subRows)||void 0===t?void 0:t.find((function(t){return t.id===e.id&&t.getIsSelected()}))})))||[],o=Cl(Cl({},n.original),{},{subRows:r.length>0?r:n.original.subRows});return wp.element.createElement("div",{className:"flex items-center justify-end gap-2"},n.original.woocommerce_product_id&&wp.element.createElement("a",{className:"rounded px-2 py-1 text-xs font-semibold text-sky-500 border-sky-500 border hover:border-sky-200 shadow-sm hover:text-sky-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-purple-600 cursor-pointer",href:"/wp-admin/post.php?post=".concat(n.original.woocommerce_product_id,"&action=edit"),target:"_blank",rel:"noopener noreferrer"},"View Woo Product"),wp.element.createElement("button",{type:"button",onClick:function(){d([o]),h(!0)},disabled:f,className:"rounded bg-sky-600 px-2 py-1 text-xs font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 ".concat(f?"opacity-50 cursor-not-allowed":"")},!0===n.original.status?"Sync":"Import"))}}},{id:"select",header:function(e){var t=e.table.getFilteredRowModel().rows.filter((function(e){return!e.original.subRows||0===e.original.subRows.length})),n=t.length>0&&t.every((function(e){return e.getIsSelected()})),r=t.some((function(e){return e.getIsSelected()}))&&!n;return wp.element.createElement("div",{className:"flex justify-center items-center w-full gap-2 relative"},wp.element.createElement(xl,{checked:n,indeterminate:r,onChange:function(e){t.forEach((function(t){t.toggleSelected(e.target.checked)}))}}))},cell:function(e){var t=e.row,n=e.table;return t.original.subRows&&t.original.subRows.length>0||t.parentId?wp.element.createElement(At,{text:"Has Subrows"}):wp.element.createElement("div",{className:"px-1"},wp.element.createElement(xl,{checked:t.getIsSelected(),disabled:!t.getCanSelect(),indeterminate:t.getIsSomeSelected(),onChange:function(e){if(t.depth>0&&e.target.checked){var r=t.getParentRow();null==r||r.toggleSelected(!0),n.setRowSelection((function(n){return Cl(Cl({},n),{},jl({},t.id,e.target.checked))}))}else if(0===t.depth&&e.target.checked){var o;t.toggleSelected(e.target.checked),null===(o=t.subRows)||void 0===o||o.forEach((function(t){n.setRowSelection((function(n){return Cl(Cl({},n),{},jl({},t.id,e.target.checked))}))}))}else if(0!==t.depth||e.target.checked)n.setRowSelection((function(n){return Cl(Cl({},n),{},jl({},t.id,e.target.checked))}));else{var a;t.toggleSelected(e.target.checked),null===(a=t.subRows)||void 0===a||a.forEach((function(t){n.setRowSelection((function(n){return Cl(Cl({},n),{},jl({},t.id,e.target.checked))}))}))}}}))}},{accessorKey:"present_at_location_ids",header:"Location IDs",accessorFn:function(e){return e.present_at_location_ids?e.present_at_location_ids.join(","):""},filterFn:function(e,t,n){return function(e,t,n,r){if(!r)return!0;if(0===e.depth){var o=e.getValue(t);return 0===o.length||o.includes(n)}return!0}(e,t,n,o)},enableSorting:!1,columnVisibility:!1}]}),[]);return(0,e.useMemo)((function(){return jl(jl({data:b,columns:x,state:{expanded:i,sorting:s,columnVisibility:{id:!1,visibility:!1,is_archived:!1,present_at_location_ids:!1},globalFilter:m,rowSelection:g},filterFns:{custom:function(e,t,n){return El(e,t,n,r,o)}},onExpandedChange:c,onRowSelectionChange:y,globalFilterFn:"custom",getSubRows:function(e){return e.subRows||[]},getCoreRowModel:Sa(),getPaginationRowModel:ja(),getFilteredRowModel:ka(),getExpandedRowModel:Oa(),onSortingChange:u,onGlobalFilterChange:p,getSortedRowModel:Na(),autoResetPageIndex:!1,enableRowSelection:!0},"onRowSelectionChange",y),"getRowId",(function(e){return e.id}))}),[b,x,i,s,m,c,u,p,g,y,v,w,r,o])}(a||[],{expanded:j,setExpanded:P,sorting:_,setSorting:R,globalFilter:A,setGlobalFilter:T,isImporting:v,setProductsToImport:S,setIsDialogOpen:u,rowSelection:M,setRowSelection:D,selectableRows:q,setSelectableRows:V},r.location,z),te=La(ee);(0,e.useEffect)((function(){var e=[];z&&e.push({id:"present_at_location_ids",value:r.location}),Z&&e.push({id:"visibility",value:!0}),J&&e.push({id:"is_archived",value:!0}),te.setColumnFilters(e)}),[z,Z,J,r.location,te]),(0,e.useEffect)((function(){te.getCoreRowModel().rows.map((function(e){return e.id}))}),[te.getRowModel()]),(0,e.useEffect)((function(){te.getRowModel().rows.map((function(e){return e.id}))}),[te.getRowModel()]),(0,e.useEffect)((function(){function e(e){v&&(e.preventDefault(),e.returnValue="")}return v&&window.addEventListener("beforeunload",e),function(){window.removeEventListener("beforeunload",e)}}),[v]);var ne=(0,e.useContext)(cl).setBlockNavigation;(0,e.useEffect)((function(){ne(!!v)}),[v,ne]);var re=function(){return te.getFilteredRowModel().rows.filter((function(e){return e.getIsSelected()})).map((function(e){return e.original})).length};return wp.element.createElement("div",null,wp.element.createElement(Ha,{open:p,onClose:function(){return f(!1)},className:"custom-dialog-class"},wp.element.createElement(vi,{setIsAutoMatchOpen:f,inventory:a})),wp.element.createElement(ll,{dataToImport:N,setDataToImport:O,importCount:E.length,importProduct:function(){b(E,a,xi,N,h),te.getState().pagination.pageIndex},controller:xi,isImporting:v,productsToImport:E,rangeValue:h,setRangeValue:g,isDialogOpen:s,progress:w,setIsDialogOpen:function(e){return function(e){u(e)}(e)}}),wp.element.createElement("div",{className:"px-4 pt-5 sm:px-6"},wp.element.createElement("div",{className:"grid grid-cols-3 gap-2 mb-4 items-center"},wp.element.createElement("div",{className:"flex flex-wrap items-center justify-start sm:flex-nowrap"},wp.element.createElement("h2",{className:"text-xl font-semibold"},"Square Inventory"),wp.element.createElement("div",{className:"ml-4 flex flex-shrink-0"},wp.element.createElement("button",{type:"button",onClick:function(){return n(!0)},className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement(_a,{className:"-ml-0.5 mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Refresh")))),wp.element.createElement("div",{className:"relative flex"},wp.element.createElement(Fa,{value:null!=A?A:"",onChange:function(e){return T(e)},className:"block w-full rounded-md border-0 py-1.5 pr-14 pl-4 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sku-600 sm:text-sm sm:leading-6",placeholder:"Search inventory..."}),wp.element.createElement("div",{className:"absolute inset-y-0 right-0 flex py-1.5 pr-1.5"},wp.element.createElement("kbd",{className:"inline-flex items-center rounded border border-gray-200 px-1 font-sans text-xs text-gray-400"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-search w-3 h-3"},wp.element.createElement("circle",{cx:"11",cy:"11",r:"8"}),wp.element.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}))))),wp.element.createElement("div",{className:"flex justify-end items-center gap-2"},wp.element.createElement("button",{type:"button",className:"disabled:bg-gray-200 relative inline-flex items-center rounded-md border border-sky-500 px-3 py-2 text-xs font-semibold text-sky-500 shadow-sm hover:bg-sky-500 hover:text-white gap-2"},"Auto Match ",wp.element.createElement(At,null)),wp.element.createElement("button",{type:"button",onClick:function(){var e=te.getFilteredRowModel().rows,t=function(e){return e.subRows&&e.subRows.length>0},n=function(e){return e.depth>0},r=e.filter((function(e){return e.getIsSelected()&&!t(e)&&!n(e)})).map((function(e){return e.original}));if(0===r.length){var o=e.filter((function(e){return!t(e)&&!n(e)})).map((function(e){return e.original}));S(o)}else S(r);u(!0)},className:"disabled:bg-gray-200 relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400 border border-sky-500 hover:border-sky-400"},wp.element.createElement(Ra,{className:"-ml-0.5 mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,re()<1?"Import all":"Import "+re()+" selected products"))),wp.element.createElement("p",{className:"text-xs text-gray-500"},"Data is cached, refresh to update"))),l&&wp.element.createElement("div",{className:"flex gap-2 items-center col-span-full sm:px-6 lg:px-8 relative overflow-auto w-full pb-8"},wp.element.createElement("svg",{className:"text-sky-300 animate-spin",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24"},wp.element.createElement("path",{d:"M32 3C35.8083 3 39.5794 3.75011 43.0978 5.20749C46.6163 6.66488 49.8132 8.80101 52.5061 11.4939C55.199 14.1868 57.3351 17.3837 58.7925 20.9022C60.2499 24.4206 61 28.1917 61 32C61 35.8083 60.2499 39.5794 58.7925 43.0978C57.3351 46.6163 55.199 49.8132 52.5061 52.5061C49.8132 55.199 46.6163 57.3351 43.0978 58.7925C39.5794 60.2499 35.8083 61 32 61C28.1917 61 24.4206 60.2499 20.9022 58.7925C17.3837 57.3351 14.1868 55.199 11.4939 52.5061C8.801 49.8132 6.66487 46.6163 5.20749 43.0978C3.7501 39.5794 3 35.8083 3 32C3 28.1917 3.75011 24.4206 5.2075 20.9022C6.66489 17.3837 8.80101 14.1868 11.4939 11.4939C14.1868 8.80099 17.3838 6.66487 20.9022 5.20749C24.4206 3.7501 28.1917 3 32 3L32 3Z",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"}),wp.element.createElement("path",{d:"M32 3C36.5778 3 41.0906 4.08374 45.1692 6.16256C49.2477 8.24138 52.7762 11.2562 55.466 14.9605C58.1558 18.6647 59.9304 22.9531 60.6448 27.4748C61.3591 31.9965 60.9928 36.6232 59.5759 40.9762",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-sky-500"})),wp.element.createElement("p",null,"Product data is being fetched in the background. Depending on your product database this may take awhile. Feel free to leave this page and come back later.")),i&&wp.element.createElement("p",null,"Error: ",i),!l&&!i&&wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"flex gap-4 items-center sm:px-6 lg:px-8 pb-6"},r.location&&r.location.length>1&&wp.element.createElement("label",{htmlFor:"locationFilterToggle",className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{id:"locationFilterToggle",type:"checkbox",checked:z,onChange:function(){U((function(e){return!e}))},className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Only show products from set location")),wp.element.createElement("label",{htmlFor:"visibilityFilterToggle",className:"relative inline-flex items-center cursor-pointer justify-start mt-0"},wp.element.createElement("input",{id:"visibilityFilterToggle",type:"checkbox",checked:Z,onChange:function(){Y((function(e){return!e}))},className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Filter by Ecom availability")),wp.element.createElement("label",{htmlFor:"archivedFilterToggle",className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{id:"archivedFilterToggle",type:"checkbox",checked:J,onChange:function(){Q((function(e){return!e}))},className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Hide archived products"))),wp.element.createElement("div",{className:"sm:px-6 lg:px-8 relative overflow-auto w-full"},wp.element.createElement("table",{className:"w-full min-w-full whitespace-nowrap text-left bg-white"},wp.element.createElement(qa,{table:te}),wp.element.createElement("tbody",{className:"divide-y divide-gray-200"},te.getRowModel().rows.map((function(e){return wp.element.createElement(Wa,{key:e.id,row:e,toggleExpanded:function(){e.getCanExpand()&&e.toggleExpanded()}})}))))),wp.element.createElement("hr",null),wp.element.createElement(Ba,{table:te,selectablePageRows:B,rowSelection:M,setRowSelection:D})))};function Si(e){return Si="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Si(e)}function ki(){ki=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Si(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Si(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function Ni(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Oi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ni(Object(n),!0).forEach((function(t){Ci(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ni(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ci(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Si(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Si(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Si(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ji(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function Pi(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){ji(a,r,o,l,i,"next",e)}function i(e){ji(a,r,o,l,i,"throw",e)}l(void 0)}))}}function Li(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_i(e,t):void 0}}(e,t)||function(){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 _i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ri(e){return Ri="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ri(e)}function Ii(){Ii=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Ri(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Ri(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function Ai(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function Ti(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){Ai(a,r,o,l,i,"next",e)}function i(e){Ai(a,r,o,l,i,"throw",e)}l(void 0)}))}}function Fi(){return Mi.apply(this,arguments)}function Mi(){return Mi=Ti(Ii().mark((function e(){var t,n,r,o,a,l=arguments;return Ii().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]?l[0]:0,n=l.length>1&&void 0!==l[1]?l[1]:20,r=l.length>2&&void 0!==l[2]?l[2]:[],e.prev=3,e.next=6,Ut({path:"/sws/v1/orders?page=".concat(t,"&per_page=").concat(n)});case 6:if(o=e.sent,(a=o.orders||o)&&0!==a.length){e.next=10;break}return e.abrupt("return",r);case 10:if(r=r.concat(a),!(a.length<n)){e.next=13;break}return e.abrupt("return",r);case 13:return e.abrupt("return",Fi(t+1,n,r));case 16:throw e.prev=16,e.t0=e.catch(3),e.t0;case 19:case"end":return e.stop()}}),e,null,[[3,16]])}))),Mi.apply(this,arguments)}var Di=function(){var e=Ti(Ii().mark((function e(){var t,n,r,o=arguments;return Ii().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:99,n=F.loading("Retrieving Woo Orders"),e.prev=2,e.next=5,Fi(1,t);case 5:return r=e.sent,F.update(n,{render:"Orders Received",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.abrupt("return",{status:"success",data:{orders:r}});case 10:throw e.prev=10,e.t0=e.catch(2),F.update(n,{render:"Error fetching orders: ".concat(e.t0.message||"Server error"),type:"error",isLoading:!1,closeOnClick:!0,autoClose:5e3}),console.error("Error fetching orders:",e.t0),e.t0;case 15:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(){return e.apply(this,arguments)}}();function Gi(e){return Gi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gi(e)}function qi(){qi=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Gi(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Gi(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function Vi(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function Wi(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){Vi(a,r,o,l,i,"next",e)}function i(e){Vi(a,r,o,l,i,"throw",e)}l(void 0)}))}}var Bi=wo("orders/fetchIfNeeded",Wi(qi().mark((function e(){var t,n,r,o,a,l,i,c,s,u=arguments;return qi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=(t=u.length>0&&void 0!==u[0]?u[0]:{}).forceRefresh,r=void 0!==n&&n,t.page,t.perPage,a=(o=u.length>1?u[1]:void 0).getState,l=o.rejectWithValue,i=a(),c=i.orders,!(r||!c.data||c.data.length<1)){e.next=16;break}return e.prev=4,e.next=7,Di();case 7:return s=e.sent,e.abrupt("return",s.data.orders);case 11:return e.prev=11,e.t0=e.catch(4),e.abrupt("return",l(e.t0.error));case 14:e.next=17;break;case 16:return e.abrupt("return",c.data);case 17:case"end":return e.stop()}}),e,null,[[4,11]])})))),Hi=fo({name:"orders",initialState:{data:null,loading:!1,error:null},reducers:{setOrders:function(e,t){e.data=t.payload}},extraReducers:function(e){e.addCase(Bi.pending,(function(e){e.loading=!0})).addCase(Bi.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase(Bi.rejected,(function(e,t){e.loading=!1,e.data=[],e.error=t.payload}))}}),zi=Hi.actions.setOrders;const Ui=Hi.reducer,$i=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M15.312 11.424a5.5 5.5 0 0 1-9.201 2.466l-.312-.311h2.433a.75.75 0 0 0 0-1.5H3.989a.75.75 0 0 0-.75.75v4.242a.75.75 0 0 0 1.5 0v-2.43l.31.31a7 7 0 0 0 11.712-3.138.75.75 0 0 0-1.449-.39Zm1.23-3.723a.75.75 0 0 0 .219-.53V2.929a.75.75 0 0 0-1.5 0V5.36l-.31-.31A7 7 0 0 0 3.239 8.188a.75.75 0 1 0 1.448.389A5.5 5.5 0 0 1 13.89 6.11l.311.31h-2.432a.75.75 0 0 0 0 1.5h4.243a.75.75 0 0 0 .53-.219Z",clipRule:"evenodd"}))})),Zi=function(e){var t=e.fetchOrders;return e.globalFilter,e.setGlobalFilter,wp.element.createElement("div",{className:"flex flex-col justify-between items-start w-full mb-4"},wp.element.createElement("div",{className:"text-sm leading-6 text-gray-900 pt-4 flex gap-4 items-center"},wp.element.createElement("h2",{className:"text-xl font-semibold"},"Woo Orders"),wp.element.createElement("button",{type:"button",onClick:function(){return t()},className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement($i,{className:"-ml-0.5 mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Refresh"))),wp.element.createElement("p",{className:"text-base"},"Integrating your orders with Square seamlessly generates both a transaction and a customer profile. For orders that require fulfillment, such as shipping, they will automatically appear on Square's Orders page."))},Yi=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))})),Ki=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M9.47 6.47a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 1 1-1.06 1.06L10 8.06l-3.72 3.72a.75.75 0 0 1-1.06-1.06l4.25-4.25Z",clipRule:"evenodd"}))})),Xi=function(e){var t=e.table;return wp.element.createElement("div",{className:"flex justify-between items-center"},wp.element.createElement("div",{className:"flex items-center gap-2 "},wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.setPageIndex(0)},disabled:!t.getCanPreviousPage()},"<<"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.previousPage()},disabled:!t.getCanPreviousPage()},"<"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.nextPage()},disabled:!t.getCanNextPage()},">"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.setPageIndex(t.getPageCount()-1)},disabled:!t.getCanNextPage()},">>"),wp.element.createElement("span",{className:"flex items-center gap-1"},wp.element.createElement("div",null,"Page"),wp.element.createElement("strong",null,t.getState().pagination.pageIndex+1," of"," ",t.getPageCount())),wp.element.createElement("span",{className:"flex items-center gap-1"},"| Go to page:",wp.element.createElement("input",{type:"number",defaultValue:t.getState().pagination.pageIndex+1,onChange:function(e){var n=e.target.value?Number(e.target.value)-1:0;t.setPageIndex(n)},className:"border p-1 rounded w-16"})),wp.element.createElement("select",{value:t.getState().pagination.pageSize,onChange:function(e){t.setPageSize(Number(e.target.value))}},[10,20,30,40,50].map((function(e){return wp.element.createElement("option",{key:e,value:e},"Show ",e)})))))};function Ji(e){return Ji="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ji(e)}function Qi(){Qi=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Ji(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Ji(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function ec(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function tc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function nc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tc(Object(n),!0).forEach((function(t){rc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function rc(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Ji(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ji(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ji(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ac(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ac(e,t):void 0}}(e,t)||function(){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 ac(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const lc=function(t){var n=t.data,r=oe(),o=(X((function(e){return e.orders})).loading,oc((0,e.useState)(""),2)),a=o[0],l=o[1],i=oc((0,e.useState)([]),2),c=i[0],s=i[1],u=oc((0,e.useState)({}),2),m=u[0],p=u[1],f=oc((0,e.useState)(null),2),d=f[0],h=f[1],g=function(e,t){return n.map((function(n){return n&&n.id&&n.id===e?nc(nc({},n),{},{square_data:JSON.stringify(t)}):n}))},y=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){ec(a,r,o,l,i,"next",e)}function i(e){ec(a,r,o,l,i,"throw",e)}l(void 0)}))}}(Qi().mark((function e(t){var n,o;return Qi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h(t),n=F.loading("Attempting to create Square order & transaction"),e.prev=2,e.next=5,Ut({path:"/sws/v1/orders",method:"POST",data:{order_id:t}});case 5:(o=e.sent).data.payment||o.data.order?(F.update(n,{render:"Created successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),r(zi(g(t,o.data)))):F.update(n,{render:"Failed to create order & transaction",type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0}),h(null),e.next=15;break;case 10:e.prev=10,e.t0=e.catch(2),F.update(n,{render:"Failed to create order & transaction: "+e.t0.error,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0}),console.log(e.t0),h(null);case 15:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(_x){return e.apply(this,arguments)}}(),v=(0,e.useMemo)((function(){return[{id:"expander",width:50,cell:function(e){var t=e.row;return t.getCanExpand()?wp.element.createElement("button",{type:"button",onClick:function(){p((function(e){return nc(nc({},e),{},rc({},t.id,!e[t.id]))}))}},t.getIsExpanded()?wp.element.createElement(Jt,{className:"w-4 h-4 text-black"}):wp.element.createElement(Yi,{className:"w-4 h-4 text-black"})):null}},{accessorKey:"id",header:function(){return"ID"},enableSorting:!0},{accessorKey:"date",header:function(){return"Order Created"},enableSorting:!0},{accessorKey:"status",header:function(){return"Order Status"},cell:function(e){var t=(0,e.getValue)();return wp.element.createElement("span",{className:Va("capitalize inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium","pending"===t?"bg-orange-100 text-orange-700":"completed"===t?"bg-green-100 text-green-700":"processing"===t?"bg-sky-100 text-sky-700":"bg-gray-100 text-gray-700")},wp.element.createElement("svg",{className:"h-1.5 w-1.5 mt-[2px]",viewBox:"0 0 6 6","aria-hidden":"true",fill:"currentColor"},wp.element.createElement("circle",{cx:3,cy:3,r:3})),t)},enableSorting:!0},{accessorKey:"customer",header:function(){return"Customer"},cell:function(e){var t=(0,e.getValue)();return wp.element.createElement("span",null,t.first_name?t.first_name:"Guest"," ",t.last_name)},enableSorting:!0},{accessorKey:"total",header:function(){return"Order Total"},cell:function(e){var t=e.getValue;return wp.element.createElement("span",null,"$",t())},enableSorting:!0},{accessorKey:"sync_statuc",header:function(){return"Sync Status"},cell:function(e){return e.row.original.square_data?wp.element.createElement("span",{className:"inline-flex items-center gap-x-1.5 rounded-md bg-green-100 px-2 py-1 text-xs font-medium text-green-700"},wp.element.createElement("svg",{className:"h-1.5 w-1.5 fill-green-500",viewBox:"0 0 6 6","aria-hidden":"true"},wp.element.createElement("circle",{cx:"3",cy:"3",r:"3"})),"Synced"):wp.element.createElement("span",{className:"inline-flex items-center gap-x-1.5 rounded-md bg-red-100 px-2 py-1 text-xs font-medium text-red-700"},wp.element.createElement("svg",{className:"h-1.5 w-1.5 fill-red-500",viewBox:"0 0 6 6","aria-hidden":"true"},wp.element.createElement("circle",{cx:3,cy:3,r:3})),"Not synced")},enableSorting:!0},{id:"actions",colSpan:2,cell:function(e){var t=e.row;return wp.element.createElement("div",{className:"flex items-center justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(e){e.stopPropagation(),w.setExpanded((function(e){return nc(nc({},e),{},rc({},t.id,!e[t.id]))}))},className:"rounded px-2 py-1 text-xs font-semibold text-sky-500 border-sky-500 border hover:border-sky-200 shadow-sm hover:text-sky-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-purple-600 cursor-pointer"},"View details"))}}]}),[]),w=La(rc(rc(rc({data:n,columns:v,state:{sorting:c,globalFilter:a,expanded:m},filterFns:{custom:El},onSortingChange:s,onExpandedChange:p,globalFilterFn:"custom",onGlobalFilterChange:l,getCoreRowModel:Sa(),getSortedRowModel:Na(),getFilteredRowModel:ka(),getPaginationRowModel:ja(),getExpandedRowModel:Oa()},"onSortingChange",s),"onGlobalFilterChange",l),"debugTable",!0)),b=function(e){return JSON.parse(e)};return wp.element.createElement(React.Fragment,null,wp.element.createElement(Zi,{fetchOrders:function(){return r(Bi({forceRefresh:!0}))},setGlobalFilter:l,globalFilter:a}),wp.element.createElement("table",{className:"w-full"},wp.element.createElement("thead",{className:"border-b border-gray-900/10 text-sm leading-6 text-gray-900"},w.getHeaderGroups().map((function(e){return wp.element.createElement("tr",{key:e.id},e.headers.map((function(e){var t;return wp.element.createElement("th",{key:e.id,colSpan:e.colSpan,className:"p-2 font-bold text-left"},e.isPlaceholder?null:wp.element.createElement("div",{className:e.column.getCanSort()?"cursor-pointer select-none":"",onClick:e.column.getToggleSortingHandler()},Pa(e.column.columnDef.header,e.getContext()),null!==(t={asc:wp.element.createElement(Ki,{className:"w-4 h-4 inline-block ml-1"}),desc:wp.element.createElement(Jt,{className:"w-4 h-4 inline-block ml-1"})}[e.column.getIsSorted()])&&void 0!==t?t:null))})))}))),wp.element.createElement("tbody",{className:"divide-y divide-gray-200"},w.getRowModel().rows.map((function(t){return d&&d===t.original.id?wp.element.createElement("tr",{key:t.id},wp.element.createElement("td",{colSpan:100},wp.element.createElement("div",{className:"animate-pulse h-6 bg-gray-200 rounded my-1"}))):wp.element.createElement(e.Fragment,{key:t.id},wp.element.createElement("tr",{className:"cursor-pointer",onClick:function(){w.setExpanded((function(e){return nc(nc({},e),{},rc({},t.id,!e[t.id]))}))}},t.getVisibleCells().map((function(e){return"expander"===e.column.id?wp.element.createElement("td",{key:e.id,className:"py-4 px-2",onClick:function(e){e.stopPropagation(),w.setExpanded((function(e){return nc(nc({},e),{},rc({},t.id,!e[t.id]))}))}},wp.element.createElement("button",{type:"button","aria-label":"Expand row"},t.getIsExpanded()?wp.element.createElement(Jt,{className:"w-4 h-4 text-black"}):wp.element.createElement(Yi,{className:"w-4 h-4 text-black"}))):wp.element.createElement("td",{key:e.id,className:"py-4 px-2 text-gray-600"},Pa(e.column.columnDef.cell,e.getContext()))}))),t.getIsExpanded()&&wp.element.createElement("tr",null,wp.element.createElement("td",{colSpan:100,className:""}," ",wp.element.createElement("div",{className:"p-6 mb-4 grid md:grid-cols-12 w-full gap-10 bg-slate-50 rounded-b-xl"},wp.element.createElement("div",{className:"md:col-span-full"},wp.element.createElement("div",{className:" flex items-center justify-center gap-4"},wp.element.createElement("a",{className:"rounded px-2 py-1 text-xs font-semibold text-sky-500 border-sky-500 border hover:border-sky-200 shadow-sm hover:text-sky-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-purple-600 cursor-pointer",href:"/wp-admin/post.php?post=".concat(t.original.id,"&action=edit"),target:"_blank"},"View Woo Order"),t.original.square_data||"completed"!==t.original.status&&"processing"!==t.original.status?wp.element.createElement(React.Fragment,null):wp.element.createElement("button",{type:"button",onClick:function(){return y(t.original.id)},className:"rounded bg-sky-600 px-2 py-1 text-xs font-semibold text-white border border-sky-600 hover:border-sky-500 shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600"},"Sync to Square")),t.original.square_data||"completed"===t.original.status&&"processing"===t.original.status?wp.element.createElement(React.Fragment,null):wp.element.createElement("p",{className:"text-center mt-2 mx-auto max-w-xl"},"Only completed or processing orders can be synced to Square")),wp.element.createElement("div",{className:"md:col-span-6"},wp.element.createElement("p",{className:"font-semibold text-lg mb-4"},"Order Line Items"),wp.element.createElement("ul",{className:"divide-y divide-gray-200"},t.original.line_items.map((function(e){return wp.element.createElement("li",{key:e.product_id,className:"flex gap-2 items-center py-2"},e.image?wp.element.createElement("img",{src:e.image,className:"w-12 h-12 object-contain rounded-lg"}):wp.element.createElement("div",{className:"w-12 h-12 object-contain rounded-lg bg-white flex items-center justify-center"},wp.element.createElement(gl,null)),wp.element.createElement("div",null,wp.element.createElement("p",{className:"font-semibold"},e.product_name),wp.element.createElement("p",null,"SKU:"," ",wp.element.createElement("span",{className:"text-sky-500"},e.sku)),wp.element.createElement("p",null,"Square product ID:"," ",wp.element.createElement("span",{className:"".concat(e.square_product_id.length>0?"text-sky-500":"text-red-500")},e.square_product_id.length>0?e.square_product_id:"Not Linked")),wp.element.createElement("p",null,"Price: $",e.price," ","x"," ",e.quantity," ","| Total cost: $",e.total)))})))),wp.element.createElement("div",{className:"md:col-span-6"},wp.element.createElement("p",{className:"font-semibold text-lg mb-4"},"Order Totals"),wp.element.createElement("ul",{className:"w-fulldivide-y divide-slate-100"},wp.element.createElement("li",{className:"flex justify-between"},"Subtotal:"," ",wp.element.createElement("strong",null,"$",t.original.order_subtotal.toFixed(2))),wp.element.createElement("li",{className:"flex justify-between"},"Discount Total:"," ",wp.element.createElement("strong",null,"-$",t.original.discount_total)),wp.element.createElement("li",{className:"flex justify-between"},"Shipping Total:"," ",wp.element.createElement("strong",null,"$",t.original.shipping_total)),wp.element.createElement("li",{className:"flex justify-between"},"Total Tax:"," ",wp.element.createElement("strong",null,"$",t.original.total_tax)),wp.element.createElement("li",{className:"flex justify-between"},"Total:"," ",wp.element.createElement("strong",null,"$",t.original.total))),wp.element.createElement("p",{className:"font-semibold text-lg mb-4 mt-8"},"Customer Details"),wp.element.createElement("ul",{className:"divide-y divide-slate-100"},t.original.customer&&Object.keys(t.original.customer).length>0?Object.keys(t.original.customer).map((function(e){return wp.element.createElement(React.Fragment,null,t.original.customer[e]&&wp.element.createElement("li",{key:t.original.customer[e],className:"grid grid-cols-2"},wp.element.createElement("span",{className:"capitalize"},e.replace("_"," "),":")," ",wp.element.createElement("span",{className:"text-left font-bold"},t.original.customer[e])))})):wp.element.createElement("p",null,"Guest Customer"))),wp.element.createElement("div",{className:"md:col-span-full"},wp.element.createElement("p",{className:"font-semibold text-lg mb-4"},"Square Order Details"),t.original.square_data?wp.element.createElement("div",{className:"flex justify-start gap-20 items-start"},wp.element.createElement("div",null,wp.element.createElement("p",{className:"text-base font-semibold"},"Order details:"),wp.element.createElement("p",null,"Order ID:"," ",wp.element.createElement("span",{className:"font-semibold"},b(t.original.square_data).order.data.order.id)),wp.element.createElement("p",null,"Ticket name:"," ",wp.element.createElement("span",{className:"font-semibold"},b(t.original.square_data).order.data.order.ticket_name)),wp.element.createElement("a",{href:"https://squareup.com/dashboard/orders/overview/".concat(b(t.original.square_data).order.data.order.id),target:"_blank",className:"text-sky-500"},"View order")),wp.element.createElement("div",null,b(t.original.square_data).payment&&b(t.original.square_data).payment.data&&wp.element.createElement(React.Fragment,null," ",wp.element.createElement("p",{className:"text-base font-semibold"},"Payment Details:"),wp.element.createElement("p",null,"Payment ID:"," ",wp.element.createElement("span",{className:"font-semibold"},b(t.original.square_data).payment.data.payment.id)),wp.element.createElement("p",null,"Receipt Number:"," ",wp.element.createElement("span",{className:"font-semibold"},b(t.original.square_data).payment.data.payment.receipt_number)),wp.element.createElement("a",{href:b(t.original.square_data).payment.data.payment.receipt_url,target:"_blank",className:"text-sky-500"},"View receipt")))):wp.element.createElement("p",null,"Sync this order with Square to view orders details provided by Square"))))))})))),wp.element.createElement("hr",null),wp.element.createElement("div",{className:"py-4"},wp.element.createElement(Xi,{table:w})))};function ic(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const cc=function(){return wp.element.createElement("div",null,wp.element.createElement("div",{className:" sm:px-6 px-4 py-5"},wp.element.createElement("div",{className:"flex flex-wrap items-center justify-start sm:flex-nowrap"},wp.element.createElement("h2",{className:"text-base font-semibold leading-7 text-gray-900"},"Woo Orders"))),wp.element.createElement("div",{className:"overflow-x-auto"},wp.element.createElement("table",{className:"whitespace-nowrap text-left bg-white w-full"},wp.element.createElement("colgroup",null,wp.element.createElement("col",{className:"w-full lg:w-1/12"}),wp.element.createElement("col",{className:"w-full lg:w-2/12"})),wp.element.createElement("thead",{className:"border-b border-gray-900/10 text-sm leading-6 text-gray-900"},wp.element.createElement("tr",null,wp.element.createElement("th",{scope:"col",className:"py-2 pl-4 pr-8 font-semibold sm:pl-6 lg:pl-8"},"ID"),wp.element.createElement("th",{scope:"col",className:"py-2 pl-4 pr-8 font-semibold sm:pl-6 lg:pl-8"},"Order Created"),wp.element.createElement("th",{scope:"col",className:"hidden py-2 pl-0 pr-8 font-semibold sm:table-cell"},"Order Status"),wp.element.createElement("th",{scope:"col",className:"hidden py-2 pl-0 pr-8 font-semibold sm:table-cell"},"Customer"),wp.element.createElement("th",{scope:"col",className:"hidden py-2 pl-0 pr-8 font-semibold sm:table-cell"},"Order Total"),wp.element.createElement("th",{scope:"col",className:"py-2 pl-0 pr-4 text-right font-semibold sm:pr-8 sm:text-left lg:pr-20"},"Sync Status"),wp.element.createElement("th",{scope:"col",className:"hidden py-2 pl-0 pr-4 text-right font-semibold sm:table-cell sm:pr-6 lg:pr-8"},"Actions"))),wp.element.createElement("tbody",{className:"divide-y divide-gray-200 animate-pulse"},function(e){return function(e){if(Array.isArray(e))return ic(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return ic(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ic(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Array(3)).map((function(e,t){return wp.element.createElement("tr",{key:t},wp.element.createElement("td",{colSpan:7,className:"py-2 pl-4 pr-8 sm:pl-6 lg:pl-8"},wp.element.createElement("div",{className:"h-6 bg-gray-200 rounded"})))}))))))};function sc(e){return sc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sc(e)}function uc(){uc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==sc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(sc(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function mc(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function pc(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){mc(a,r,o,l,i,"next",e)}function i(e){mc(a,r,o,l,i,"throw",e)}l(void 0)}))}}function fc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return dc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dc(e,t):void 0}}(e,t)||function(){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 dc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var hc=(0,t.createContext)(),gc=function(e){var n=e.children,r=An().settings,o=fc((0,t.useState)([]),2),a=o[0],l=o[1],i=fc((0,t.useState)(!1),2),c=i[0],s=i[1],u=fc((0,t.useState)(""),2),m=u[0],p=u[1];(0,t.useEffect)((function(){var e=function(){var e=pc(uc().mark((function e(){var t;return uc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s(!0),e.prev=1,e.next=4,Ut({path:"/sws/v1/settings/get-locations",method:"GET"});case 4:t=e.sent,l(t.locations.data.locations),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),p("Failed to get locations"),F({render:"Failed to get locations: "+e.t0.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 12:return e.prev=12,s(!1),e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[1,8,12,15]])})));return function(){return e.apply(this,arguments)}}();r.accessToken&&e()}),[r.accessToken]);var f=function(){var e=pc(uc().mark((function e(){var t;return uc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s(!0),e.prev=1,e.next=4,Ut({path:"/sws/v1/settings/get-locations",method:"GET"});case 4:t=e.sent,l(t.locations.data.locations),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),p("Failed to get locations"),F({render:"Failed to get locations: "+e.t0.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 12:return e.prev=12,s(!1),e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[1,8,12,15]])})));return function(){return e.apply(this,arguments)}}();return wp.element.createElement(hc.Provider,{value:{locations:a,loading:c,error:m,refetchLocations:f,setLocations:l}},n)},yc=function(){return(0,t.useContext)(hc)};function vc(e){return vc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vc(e)}function wc(){wc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==vc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(vc(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function bc(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function xc(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){bc(a,r,o,l,i,"next",e)}function i(e){bc(a,r,o,l,i,"throw",e)}l(void 0)}))}}function Ec(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Sc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Sc(e,t):void 0}}(e,t)||function(){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 Sc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function kc(t){t.getLocations,t.setLocationsLoading;var n=An(),r=n.settings,o=n.getAccessToken,a=n.updateAccessToken,l=n.removeAccessToken,i=n.updateSettings,c=yc(),s=(c.locations,c.refetchLocations),u=c.setLocations,m=Ec((0,e.useState)(""),2),p=m[0],f=m[1],d=Ec((0,e.useState)(!0),2),h=d[0],g=d[1];(0,e.useEffect)((function(){var e=function(){var e=xc(wc().mark((function e(){return wc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g(!0),r.accessToken){e.next=4;break}return e.next=4,o({silent:!0});case 4:g(!1);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[r.accessToken,o]);var y=function(){var e=xc(wc().mark((function e(t){return wc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.preventDefault(),g(!0),e.next=4,a(p);case 4:f(""),g(!1),s();case 7:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}(),v=function(){var e=xc(wc().mark((function e(){return wc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return g(!0),e.next=3,l().then((function(){i("location",""),u([])}));case 3:g(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return wp.element.createElement("div",{className:"px-4 pb-5"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Your Square Access Token"),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500"},wp.element.createElement("p",null,"Read the following documentation on how to create a Square access token: ",wp.element.createElement("br",null),wp.element.createElement("a",{href:"https://squaresyncforwoo.com/documentation#access-token",target:"_blank",rel:"noopener noreferrer",className:"underline text-sky-500"},"How to obtain Square Access Token"))),r.accessToken?wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"mt-5 sm:flex sm:items-center"},wp.element.createElement("input",{type:"text",name:"existingToken",id:"existingToken",className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 !pr-10",value:r.accessToken,disabled:!0}),wp.element.createElement("button",{onClick:v,type:"button",className:"mt-3 w-full sm:ml-3 sm:mt-0 sm:w-auto inline-flex justify-center items-center rounded-md bg-red-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600",disabled:h},h?"Loading":"Remove token")),wp.element.createElement("p",{className:"mt-2"},"Removing your access token will stop all synchronization with Square.")):wp.element.createElement("form",{className:"mt-5 sm:flex sm:items-center",onSubmit:y},wp.element.createElement("div",{className:"w-full sm:max-w-xs"},wp.element.createElement("label",{htmlFor:"accessToken",className:"sr-only"},"Access Token"),wp.element.createElement("input",{type:"text",name:"accessToken",id:"accessToken",className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 !pr-10 w-full",placeholder:"Enter your access token",value:p,onChange:function(e){return f(e.target.value)},disabled:h})),wp.element.createElement("button",{type:"submit",className:"mt-3 w-full sm:ml-3 sm:mt-0 sm:w-auto inline-flex justify-center items-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600",disabled:h},h?"Loading":"Save")))}o(42);const Nc=function(){return wp.element.createElement("div",{className:"px-6 pb-6 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Webhook URL"),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500"},wp.element.createElement("p",null,"The webhook URL is used to keep a live sync between square and woocommerce. Copy this URL and paste it into your square developer webhook subscriptions. Read the following documentation on how to do this:",wp.element.createElement("br",null),wp.element.createElement("a",{href:"https://squaresyncforwoo.com/documentation#webhook",target:"_blank",className:"underline text-sky-500"},"Setting up webhook url to retrieve inventory and customer updates"))),wp.element.createElement("div",{className:"max-w-xl flex items-center mt-4"},wp.element.createElement("input",{disabled:!0,name:"webhookURL",className:"block disabled:text-gray-700 w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 blur",value:"https://".concat(window.location.hostname)})))},Oc=function(){return wp.element.createElement("svg",{className:"animate-spin mt-4 h-5 w-5 text-sky-500",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},wp.element.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),wp.element.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"}))};function Cc(e){return Cc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cc(e)}function jc(){jc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Cc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Cc(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function Pc(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function Lc(e){var t=e.updateSettings,n=e.locations,r=e.settings,o=e.locationsLoading,a=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){Pc(a,r,o,l,i,"next",e)}function i(e){Pc(a,r,o,l,i,"throw",e)}l(void 0)}))}}(jc().mark((function e(n){return jc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n.preventDefault(),t("location",n.target.value);case 2:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}();return wp.element.createElement("div",{className:"px-4 pb-5"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Square Locations"),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500"},wp.element.createElement("p",null,"Select the location you wish to derive your websites products and inventory from: ",wp.element.createElement("br",null))),o?wp.element.createElement(Oc,null):wp.element.createElement("div",null,wp.element.createElement("select",{id:"location",name:"location",onChange:function(e){return a(e)},value:r.location?r.location:"",className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10"},wp.element.createElement("option",{value:"",disabled:!0},"Select your location"),n.map((function(e){return wp.element.createElement("option",{key:e.id,value:e.id},e.name)})))))}const _c=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 0 1 1.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.559.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.894.149c-.424.07-.764.383-.929.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 0 1-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.398.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 0 1-.12-1.45l.527-.737c.25-.35.272-.806.108-1.204-.165-.397-.506-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.108-1.204l-.526-.738a1.125 1.125 0 0 1 .12-1.45l.773-.773a1.125 1.125 0 0 1 1.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894Z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))})),Rc=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 8.25h19.5M2.25 9h19.5m-16.5 5.25h6m-6 2.25h3m-3.75 3h15a2.25 2.25 0 0 0 2.25-2.25V6.75A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25v10.5A2.25 2.25 0 0 0 4.5 19.5Z"}))})),Ic=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"}))})),Ac=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25ZM6.75 12h.008v.008H6.75V12Zm0 3h.008v.008H6.75V15Zm0 3h.008v.008H6.75V18Z"}))})),Tc=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 11.25v8.25a1.5 1.5 0 0 1-1.5 1.5H5.25a1.5 1.5 0 0 1-1.5-1.5v-8.25M12 4.875A2.625 2.625 0 1 0 9.375 7.5H12m0-2.625V7.5m0-2.625A2.625 2.625 0 1 1 14.625 7.5H12m0 0V21m-8.625-9.75h18c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125h-18c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"}))}));var Fc=[{name:"General",href:"/settings/general",icon:_c},{name:"Payments",href:"/settings/payments",icon:Rc},{name:"Products",href:"/settings/inventory",icon:Ic},{name:"Customers",href:"/settings/customers",icon:yn},{name:"Orders",href:"/settings/orders",icon:Ac},{name:"Loyalty",href:"/settings/loyalty",icon:Tc}];function Mc(e){var t=e.children;return mn(),wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"lg:flex lg:gap-x-4 bg-white rounded-2xl shadow-lg p-6"},wp.element.createElement("aside",{className:"flex border-b border-gray-900/5 lg:block lg:w-64 lg:flex-none lg:border-0 "},wp.element.createElement("nav",{className:"flex-none px-4 sm:px-6 lg:px-0"},wp.element.createElement("ul",{role:"list",className:"flex gap-x-3 gap-y-1 whitespace-nowrap lg:flex-col"},Fc.map((function(e){return"Payments"===e.name?wp.element.createElement("li",{key:e.name},wp.element.createElement("a",{href:"/wp-admin/admin.php?page=wc-settings&tab=checkout§ion=squaresync_credit",className:Va(location.hash.replace(/^#/,"")===e.href?"bg-gray-50 text-sky-600":"text-gray-700 hover:text-sky-600 hover:bg-gray-50","group flex gap-x-3 rounded-lg py-2 pl-2 pr-3 text-sm leading-6 font-semibold")},wp.element.createElement(e.icon,{className:Va(location.hash.replace(/^#/,"")===e.href?"text-sky-600":"text-gray-400 group-hover:text-sky-600","h-6 w-6 shrink-0"),"aria-hidden":"true"}),e.name)):wp.element.createElement("li",{key:e.name},wp.element.createElement(Ct,{to:e.href,className:Va(location.hash.replace(/^#/,"")===e.href?"bg-gray-50 text-sky-600":"text-gray-700 hover:text-sky-600 hover:bg-gray-50","group flex gap-x-3 rounded-lg py-2 pl-2 pr-3 text-sm leading-6 font-semibold")},wp.element.createElement(e.icon,{className:Va(location.hash.replace(/^#/,"")===e.href?"text-sky-600":"text-gray-400 group-hover:text-sky-600","h-6 w-6 shrink-0"),"aria-hidden":"true"}),e.name))}))))),wp.element.createElement("main",{className:"px-4 sm:px-6 lg:flex-auto lg:px-0"},t)))}function Dc(e){return Dc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Dc(e)}function Gc(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Dc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Dc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Dc(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qc(){qc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Dc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Dc(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function Vc(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function Wc(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){Vc(a,r,o,l,i,"next",e)}function i(e){Vc(a,r,o,l,i,"throw",e)}l(void 0)}))}}function Bc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Hc(t){var n=t.updateSettings,r=(t.environment,t.settings),o=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Bc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(!0),2),a=(o[0],o[1],function(){var e=Wc(qc().mark((function e(t){return qc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.preventDefault(),n("environment",t.target.value);case 2:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}()),l=function(){var e=Wc(qc().mark((function e(t,n){var r;return qc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Vt()({path:"/sws/v1/settings/update-gateway-settings",method:"POST",data:Gc({},t,n)});case 3:return r=e.sent,F.success("Settings updated successfully!"),e.abrupt("return",r);case 8:e.prev=8,e.t0=e.catch(0),F.error("Failed to update settings: ".concat(e.t0.message));case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(t,n){return e.apply(this,arguments)}}();return wp.element.createElement("div",{className:"px-4 pb-5"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Environment"),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500"},wp.element.createElement("p",null,"Switch between testing (sandbox) account and live environment, you'll also need to change your access token and location above to the matching environments",wp.element.createElement("br",null))),wp.element.createElement("div",null,wp.element.createElement("select",{id:"environment",name:"location",onChange:function(e){a(e),l("square_mode",e.target.value)},value:r.environment?r.environment:"live",className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10"},wp.element.createElement("option",{value:"live"},"Live"),wp.element.createElement("option",{value:"sandbox"},"Sandbox"))))}function zc(){mn();var e=An(),t=e.settings,n=e.updateSettings,r=e.settingsLoading,o=yc(),a=o.locations,l=o.loading,i=(o.error,o.refetchLocations);return wp.element.createElement(Mc,null,r?wp.element.createElement("div",null,"Loading..."):wp.element.createElement(React.Fragment,null,wp.element.createElement(kc,{updateSettings:n,settings:t,setLocationsLoading:i,setLocations:i,getLocations:i}),wp.element.createElement(Lc,{updateSettings:n,locations:a,locationsLoading:l,settings:t}),wp.element.createElement(Hc,{updateSettings:n,environment:t.environment,settings:t}),wp.element.createElement(Nc,null)))}function Uc(e){return Uc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uc(e)}function $c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Zc(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Uc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Uc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Uc(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const Kc=function(t){var n=t.settings,r=(t.updateSettings,t.settingsLoading,function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Yc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$c(Object(n),!0).forEach((function(t){Zc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},n.customers.auto.squareWoo)),2)),o=r[0],a=r[1];return(0,e.useEffect)((function(){a(n.customers.auto.squareWoo)}),[n]),o.first_name,o.last_name,o.address,o.phone,o.role,wp.element.createElement("div",{className:"px-4 pb-3 sm:px-6 mt-4"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic Customer Syncing",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",null,"Sync your customer info in real-time from Square to WooCommerce and vise-versa.",wp.element.createElement("br",null))),wp.element.createElement("div",{className:""},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to Woo (Webhook customer.updated must be setup)"))))};function Xc(e){return Xc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xc(e)}function Jc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Qc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jc(Object(n),!0).forEach((function(t){es(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function es(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Xc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Xc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Xc(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ts(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const ns=function(t){var n=t.settings,r=t.updateSettings,o=(t.settingsLoading,function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ts(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ts(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(Qc({},n.customers.auto.wooSquare)),2)),a=o[0],l=o[1];return(0,e.useEffect)((function(){l(n.customers.auto.wooSquare)}),[n]),a.first_name,a.last_name,a.address,a.phone,a.role,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("div",{className:""},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,onChange:function(){r("customers",Qc(Qc({},n.customers),{},{auto:Qc(Qc({},n.customers.auto),{},{wooSquare:Qc(Qc({},a),{},{is_active:!a.is_active})})}))},className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square"))))},rs=function(e){var t=e.settings;return e.updateSettings,e.setSettings,t.customers,wp.element.createElement("div",{className:"px-4 pb-3 sm:px-6 mt-4"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Auto Customer Matching",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Automatically match newly created WordPress or Square users with existing accounts on the corresponding platform. This will also set the users role based on the role mapping setup.")),wp.element.createElement("div",{className:"flex flex-col gap-3"},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to Woo (Webhook customer.created must be setup)")),wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square"))))},os=function(e){var t=e.settings;return e.updateSettings,e.setSettings,t.customers,wp.element.createElement("div",{className:"px-4 pb-3 sm:px-6 mt-4"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Auto Customer Creation",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Automatically create Square and WordPress users when one is created on either platform. User roles and groups will be automatically assigned based on role mappings.")),wp.element.createElement("div",{className:"flex flex-col gap-3"},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to Woo (Webhook customer.created must be setup)")),wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square"))))};function as(e){return as="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},as(e)}function ls(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function is(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=as(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=as(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==as(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cs(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const ss=function(t){var n=t.settings,r=(t.updateSettings,t.settingsLoading),o=(0,e.useState)(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ls(Object(n),!0).forEach((function(t){is(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ls(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},n.squareAuto)),a=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return cs(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cs(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(o,2),l=a[0],i=a[1];(0,e.useEffect)((function(){i(n.squareAuto)}),[n]);var c=function(e){var t=e.id,n=e.label;return e.checked,e.squareWoo,wp.element.createElement("li",{className:"w-auto mb-0"},wp.element.createElement("div",{className:"flex items-center gap-2 p-4"},wp.element.createElement("input",{id:t,type:"checkbox",checked:!1,className:"!m-0 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2 leading-normal"}),wp.element.createElement("label",{htmlFor:t,className:"w-full text-sm font-light text-gray-700 leading-normal"},n)))},s=[{id:"stock",label:"Stock",checked:l.stock||!1},{id:"title",label:"Title",checked:l.title||!1},{id:"sku",label:"SKU",checked:l.sku||!1},{id:"price",label:"Price",checked:l.price||!1},{id:"description",label:"Description",checked:l.description||!1},{id:"images",label:"Images",checked:l.images||!1},{id:"category",label:"Category",checked:l.category||!1}];return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic syncing on product update",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",null,"Enable or disable automatic inventory syncing between Woo and Square effortlessly with our Inventory Sync Toggle. This automatic update is triggered when your Square or Woocommerce data is updated.",wp.element.createElement("br",null),wp.element.createElement("a",{href:"https://squaresyncforwoo.com/documentation#import-data",className:"underline text-sky-500",target:"_blank"},"How to setup and control automatic syncing between Square and Woo"))),wp.element.createElement("div",{className:""},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to woo (Webhook must be setup)")),l.isActive&&!r&&wp.element.createElement(React.Fragment,null,wp.element.createElement("ul",{className:"text-sm font-medium text-gray-900 bg-white my-3 flex flex-wrap fit-content"},s.map((function(e){return wp.element.createElement(c,{key:e.id,id:e.id,label:e.label,checked:e.checked,squareWoo:l})}))))))};function us(e){return us="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},us(e)}function ms(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ps(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ms(Object(n),!0).forEach((function(t){fs(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ms(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function fs(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=us(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=us(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==us(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ds(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const hs=function(t){var n=t.settings,r=t.updateSettings,o=t.settingsLoading,a=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ds(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ds(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(ps({},n.wooAuto)),2),l=a[0],i=a[1];(0,e.useEffect)((function(){i(n.wooAuto)}),[n]);var c=function(e){var t=e.id,n=e.label,o=e.checked;return e.squareWoo,wp.element.createElement("li",{className:"w-auto mb-0"},wp.element.createElement("div",{className:"flex items-center gap-2 p-4"},wp.element.createElement("input",{id:t,type:"checkbox",checked:!1,onChange:function(){return r("wooAuto",ps(ps({},l),{},fs({},t,!o)))},className:"!m-0 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2 leading-normal"}),wp.element.createElement("label",{htmlFor:t,className:"w-full text-sm font-light text-gray-700 leading-normal"},n)))},s=[{id:"stock",label:"Stock",checked:l.stock||!1}];return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("div",{className:"mb-6"},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer"},wp.element.createElement("input",{type:"checkbox",checked:!1,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square")),l.isActive&&!o&&wp.element.createElement(React.Fragment,null,wp.element.createElement("p",{className:"mt-4"},"Sync stock on order processing. Stock/Inventory count is the the sole permitted auto-sync option from Woo to Square (other wise an infinite update loop is created, we don't want that). You can also manually sync from the product actions."),wp.element.createElement("ul",{className:"fit-content flex-wrap items-center justify-start text-sm font-medium text-gray-900 bg-white sm:flex"},s.map((function(e){return wp.element.createElement(c,{key:e.id,id:e.id,label:e.label,checked:e.checked,squareWoo:l})}))))))};var gs=Object.defineProperty,ys=(e,t,n)=>(((e,t,n)=>{t in e?gs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);let vs=new class{constructor(){ys(this,"current",this.detect()),ys(this,"handoffState","pending"),ys(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return"server"===this.current}get isClient(){return"client"===this.current}detect(){return"undefined"==typeof window||"undefined"==typeof document?"server":"client"}handoff(){"pending"===this.handoffState&&(this.handoffState="complete")}get isHandoffComplete(){return"complete"===this.handoffState}},ws=(e,n)=>{vs.isServer?(0,t.useEffect)(e,n):(0,t.useLayoutEffect)(e,n)};function bs(e){let n=(0,t.useRef)(e);return ws((()=>{n.current=e}),[e]),n}let xs=function(e){let n=bs(e);return t.useCallback(((...e)=>n.current(...e)),[n])};function Es(e,n,r){let[o,a]=(0,t.useState)(r),l=void 0!==e,i=(0,t.useRef)(l),c=(0,t.useRef)(!1),s=(0,t.useRef)(!1);return!l||i.current||c.current?!l&&i.current&&!s.current&&(s.current=!0,i.current=l,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(c.current=!0,i.current=l,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[l?e:o,xs((e=>(l||a(e),null==n?void 0:n(e))))]}function Ss(){let e=[],t={addEventListener:(e,n,r,o)=>(e.addEventListener(n,r,o),t.add((()=>e.removeEventListener(n,r,o)))),requestAnimationFrame(...e){let n=requestAnimationFrame(...e);return t.add((()=>cancelAnimationFrame(n)))},nextFrame:(...e)=>t.requestAnimationFrame((()=>t.requestAnimationFrame(...e))),setTimeout(...e){let n=setTimeout(...e);return t.add((()=>clearTimeout(n)))},microTask(...e){let n={current:!0};return function(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch((e=>setTimeout((()=>{throw e}))))}((()=>{n.current&&e[0]()})),t.add((()=>{n.current=!1}))},style(e,t,n){let r=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:n}),this.add((()=>{Object.assign(e.style,{[t]:r})}))},group(e){let t=Ss();return e(t),this.add((()=>t.dispose()))},add:t=>(e.push(t),()=>{let n=e.indexOf(t);if(n>=0)for(let t of e.splice(n,1))t()}),dispose(){for(let t of e.splice(0))t()}};return t}function ks(){let[e]=(0,t.useState)(Ss);return(0,t.useEffect)((()=>()=>e.dispose()),[e]),e}var Ns;let Os=null!=(Ns=t.useId)?Ns:function(){let e=function(){let e=function(){let e="undefined"==typeof document;return"useSyncExternalStore"in n&&(e=>e.useSyncExternalStore)(n)((()=>()=>{}),(()=>!1),(()=>!e))}(),[r,o]=t.useState(vs.isHandoffComplete);return r&&!1===vs.isHandoffComplete&&o(!1),t.useEffect((()=>{!0!==r&&o(!0)}),[r]),t.useEffect((()=>vs.handoff()),[]),!e&&r}(),[r,o]=t.useState(e?()=>vs.nextId():null);return ws((()=>{null===r&&o(vs.nextId())}),[r]),null!=r?""+r:void 0};function Cs(e){var t;if(e.type)return e.type;let n=null!=(t=e.as)?t:"button";return"string"==typeof n&&"button"===n.toLowerCase()?"button":void 0}function js(e,n){let[r,o]=(0,t.useState)((()=>Cs(e)));return ws((()=>{o(Cs(e))}),[e.type,e.as]),ws((()=>{r||n.current&&n.current instanceof HTMLButtonElement&&!n.current.hasAttribute("type")&&o("button")}),[r,n]),r}let Ps=Symbol();function Ls(...e){let n=(0,t.useRef)(e);(0,t.useEffect)((()=>{n.current=e}),[e]);let r=xs((e=>{for(let t of n.current)null!=t&&("function"==typeof t?t(e):t.current=e)}));return e.every((e=>null==e||(null==e?void 0:e[Ps])))?void 0:r}function _s(...e){return Array.from(new Set(e.flatMap((e=>"string"==typeof e?e.split(" "):[])))).filter(Boolean).join(" ")}function Rs(e,t,...n){if(e in t){let r=t[e];return"function"==typeof r?r(...n):r}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map((e=>`"${e}"`)).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Rs),r}var Is,As=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(As||{}),Ts=((Is=Ts||{})[Is.Unmount=0]="Unmount",Is[Is.Hidden=1]="Hidden",Is);function Fs({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:a=!0,name:l,mergeRefs:i}){i=null!=i?i:Ds;let c=Gs(t,e);if(a)return Ms(c,n,r,l,i);let s=null!=o?o:0;if(2&s){let{static:e=!1,...t}=c;if(e)return Ms(t,n,r,l,i)}if(1&s){let{unmount:e=!0,...t}=c;return Rs(e?0:1,{0:()=>null,1:()=>Ms({...t,hidden:!0,style:{display:"none"}},n,r,l,i)})}return Ms(c,n,r,l,i)}function Ms(e,n={},r,o,a){let{as:l=r,children:i,refName:c="ref",...s}=Ws(e,["unmount","static"]),u=void 0!==e.ref?{[c]:e.ref}:{},m="function"==typeof i?i(n):i;"className"in s&&s.className&&"function"==typeof s.className&&(s.className=s.className(n));let p={};if(n){let e=!1,t=[];for(let[r,o]of Object.entries(n))"boolean"==typeof o&&(e=!0),!0===o&&t.push(r);e&&(p["data-headlessui-state"]=t.join(" "))}if(l===t.Fragment&&Object.keys(Vs(s)).length>0){if(!(0,t.isValidElement)(m)||Array.isArray(m)&&m.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${o} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(s).map((e=>` - ${e}`)).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map((e=>` - ${e}`)).join("\n")].join("\n"));let e=m.props,n="function"==typeof(null==e?void 0:e.className)?(...t)=>_s(null==e?void 0:e.className(...t),s.className):_s(null==e?void 0:e.className,s.className),r=n?{className:n}:{};return(0,t.cloneElement)(m,Object.assign({},Gs(m.props,Vs(Ws(s,["ref"]))),p,u,{ref:a(m.ref,u.ref)},r))}return(0,t.createElement)(l,Object.assign({},Ws(s,["ref"]),l!==t.Fragment&&u,l!==t.Fragment&&p),m)}function Ds(...e){return e.every((e=>null==e))?void 0:t=>{for(let n of e)null!=n&&("function"==typeof n?n(t):n.current=t)}}function Gs(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith("on")&&"function"==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map((e=>[e,void 0]))));for(let e in n)Object.assign(t,{[e](t,...r){let o=n[e];for(let e of o){if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;e(t,...r)}}});return t}function qs(e){var n;return Object.assign((0,t.forwardRef)(e),{displayName:null!=(n=e.displayName)?n:e.name})}function Vs(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function Ws(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}var Bs=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Bs||{});let Hs=qs((function(e,t){var n;let{features:r=1,...o}=e;return Fs({ourProps:{ref:t,"aria-hidden":2==(2&r)||(null!=(n=o["aria-hidden"])?n:void 0),style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...4==(4&r)&&2!=(2&r)&&{display:"none"}}},theirProps:o,slot:{},defaultTag:"div",name:"Hidden"})}));function zs(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=""===(null==t?void 0:t.getAttribute("disabled"));return(!r||!function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(n))&&r}function Us(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Zs(n,$s(t,r),o);return n}function $s(e,t){return e?e+"["+t+"]":t}function Zs(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Zs(e,$s(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):"boolean"==typeof n?e.push([t,n?"1":"0"]):"string"==typeof n?e.push([t,n]):"number"==typeof n?e.push([t,`${n}`]):null==n?e.push([t,""]):Us(n,t,e)}function Ys(e){var t,n;let r=null!=(t=null==e?void 0:e.form)?t:e.closest("form");if(r){for(let t of r.elements)if(t!==e&&("INPUT"===t.tagName&&"submit"===t.type||"BUTTON"===t.tagName&&"submit"===t.type||"INPUT"===t.nodeName&&"image"===t.type))return void t.click();null==(n=r.requestSubmit)||n.call(r)}}let Ks=(0,t.createContext)(null);function Xs(){let e=(0,t.useContext)(Ks);if(null===e){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,Xs),e}return e}function Js(){let[e,n]=(0,t.useState)([]);return[e.length>0?e.join(" "):void 0,(0,t.useMemo)((()=>function(e){let r=xs((e=>(n((t=>[...t,e])),()=>n((t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))))),o=(0,t.useMemo)((()=>({register:r,slot:e.slot,name:e.name,props:e.props})),[r,e.slot,e.name,e.props]);return t.createElement(Ks.Provider,{value:o},e.children)}),[n])]}let Qs=qs((function(e,t){let n=Os(),{id:r=`headlessui-description-${n}`,...o}=e,a=Xs(),l=Ls(t);return ws((()=>a.register(r)),[r,a.register]),Fs({ourProps:{ref:l,...a.props,id:r},theirProps:o,slot:a.slot||{},defaultTag:"p",name:a.name||"Description"})})),eu=Object.assign(Qs,{});var tu=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(tu||{});let nu=(0,t.createContext)(null);function ru(){let e=(0,t.useContext)(nu);if(null===e){let e=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,ru),e}return e}function ou(){let[e,n]=(0,t.useState)([]);return[e.length>0?e.join(" "):void 0,(0,t.useMemo)((()=>function(e){let r=xs((e=>(n((t=>[...t,e])),()=>n((t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))))),o=(0,t.useMemo)((()=>({register:r,slot:e.slot,name:e.name,props:e.props})),[r,e.slot,e.name,e.props]);return t.createElement(nu.Provider,{value:o},e.children)}),[n])]}let au=qs((function(e,t){let n=Os(),{id:r=`headlessui-label-${n}`,passive:o=!1,...a}=e,l=ru(),i=Ls(t);ws((()=>l.register(r)),[r,l.register]);let c={ref:i,...l.props,id:r};return o&&("onClick"in c&&(delete c.htmlFor,delete c.onClick),"onClick"in a&&delete a.onClick),Fs({ourProps:c,theirProps:a,slot:l.slot||{},defaultTag:"label",name:l.name||"Label"})})),lu=Object.assign(au,{}),iu=(0,t.createContext)(null);iu.displayName="GroupContext";let cu=t.Fragment,su=qs((function(e,n){let r=Os(),{id:o=`headlessui-switch-${r}`,checked:a,defaultChecked:l=!1,onChange:i,name:c,value:s,form:u,...m}=e,p=(0,t.useContext)(iu),f=(0,t.useRef)(null),d=Ls(f,n,null===p?null:p.setSwitch),[h,g]=Es(a,i,l),y=xs((()=>null==g?void 0:g(!h))),v=xs((e=>{if(zs(e.currentTarget))return e.preventDefault();e.preventDefault(),y()})),w=xs((e=>{e.key===tu.Space?(e.preventDefault(),y()):e.key===tu.Enter&&Ys(e.currentTarget)})),b=xs((e=>e.preventDefault())),x=(0,t.useMemo)((()=>({checked:h})),[h]),E={id:o,ref:d,role:"switch",type:js(e,f),tabIndex:0,"aria-checked":h,"aria-labelledby":null==p?void 0:p.labelledby,"aria-describedby":null==p?void 0:p.describedby,onClick:v,onKeyUp:w,onKeyPress:b},S=ks();return(0,t.useEffect)((()=>{var e;let t=null==(e=f.current)?void 0:e.closest("form");t&&void 0!==l&&S.addEventListener(t,"reset",(()=>{g(l)}))}),[f,g]),t.createElement(t.Fragment,null,null!=c&&h&&t.createElement(Hs,{features:Bs.Hidden,...Vs({as:"input",type:"checkbox",hidden:!0,readOnly:!0,form:u,checked:h,name:c,value:s})}),Fs({ourProps:E,theirProps:m,slot:x,defaultTag:"button",name:"Switch"}))})),uu=Object.assign(su,{Group:function(e){var n;let[r,o]=(0,t.useState)(null),[a,l]=ou(),[i,c]=Js(),s=(0,t.useMemo)((()=>({switch:r,setSwitch:o,labelledby:a,describedby:i})),[r,o,a,i]),u=e;return t.createElement(c,{name:"Switch.Description"},t.createElement(l,{name:"Switch.Label",props:{htmlFor:null==(n=s.switch)?void 0:n.id,onClick(e){r&&("LABEL"===e.currentTarget.tagName&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},t.createElement(iu.Provider,{value:s},Fs({ourProps:{},theirProps:u,defaultTag:cu,name:"Switch.Group"}))))},Label:lu,Description:eu});const mu=function(e){return e.setSettings,e.updateSettings,e.settings,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatically create Square products",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"When this feature is enabled, every time you create a new product in WooCommerce, it will automatically be exported and linked to your Square account. This ensures that your product listings are consistently updated across both platforms, saving you time and maintaining synchronization between your WooCommerce store and Square inventory."),wp.element.createElement(uu,{checked:!1,className:"bg-gray-200 relative inline-flex h-6 w-11 items-center rounded-full"},wp.element.createElement("span",{className:"sr-only"},"Enable auto product creation"),wp.element.createElement("span",{className:"translate-x-1 inline-block h-4 w-4 transform rounded-full bg-white transition"}))))};function pu(e){return pu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pu(e)}function fu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function du(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fu(Object(n),!0).forEach((function(t){hu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function hu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=pu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=pu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==pu(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const yu=function(n){var r,o,a,l,i,c=n.settings,s=n.updateSettings,u=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return gu(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gu(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useState)(c.cron.schedule||"hourly"),2),m=u[0],p=u[1];(0,e.useEffect)((function(){c.cron&&c.cron.schedule?p(c.cron.schedule):console.log("Settings not loaded or missing cron.scheduleFrequency")}),[c]);var f=[{id:"stock",label:"Stock",checked:(null===(r=c.cron.dataToUpdate)||void 0===r?void 0:r.stock)||!1},{id:"title",label:"Title",checked:(null===(o=c.cron.dataToUpdate)||void 0===o?void 0:o.title)||!1},{id:"sku",label:"SKU",checked:(null===(a=c.cron.dataToUpdate)||void 0===a?void 0:a.sku)||!1},{id:"price",label:"Price",checked:(null===(l=c.cron.dataToUpdate)||void 0===l?void 0:l.price)||!1},{id:"description",label:"Description",checked:(null===(i=c.cron.dataToUpdate)||void 0===i?void 0:i.description)||!1}],d=function(e){var t=e.id,n=e.label,r=e.checked,o=e.cron;return wp.element.createElement("li",{className:"w-auto mb-0"},wp.element.createElement("div",{className:"flex items-center gap-1"},wp.element.createElement("input",{id:t,type:"checkbox",checked:r,onChange:function(){return s("cron",du(du({},o),{},{dataToUpdate:du(du({},o.dataToUpdate),{},hu({},t,!r))}))},className:"!m-0 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2 leading-normal"}),wp.element.createElement("label",{htmlFor:t,className:"w-full text-sm font-light text-gray-700 leading-normal"},n)))};return wp.element.createElement("div",null,wp.element.createElement("div",{className:"flex flex-col gap-2 my-2"},wp.element.createElement("fieldset",null,wp.element.createElement("legend",{className:"font-semibold text-base mb-4"},"Select schedule frequency:"),wp.element.createElement("div",{className:"space-y-2"},["hourly","twicedaily","daily","weekly"].map((function(e){return wp.element.createElement("div",{key:e,className:"flex items-center"},wp.element.createElement("input",{id:e,type:"radio",name:"scheduleFrequency",value:e,checked:m===e,onChange:function(e){s("cron",du(du({},c.cron),{},{schedule:e.target.value})),p(e.target.value)},className:"focus:ring-sky-500 h-4 w-4 text-sky-600 border-gray-300"}),wp.element.createElement("label",{htmlFor:e,className:"ml-1 block text-sm capitalize"},e," ",wp.element.createElement("span",{className:"text-gray-500 text-sm"},"twicedaily"===e||"daily"===e?"(starting midnight)":"weekly"===e?"(starting monday at midnight)":"")))})),wp.element.createElement("div",{className:"flex items-center"},wp.element.createElement("input",{id:"custom",type:"radio",name:"scheduleFrequency",disabled:!0,className:"focus:ring-sky-500 h-4 w-4 text-sky-600 border-gray-300"}),wp.element.createElement("label",{htmlFor:"custom",className:"ml-1 block text-sm capitalize"},"Custom",wp.element.createElement("span",{className:"text-gray-500 text-sm"}," (coming soon)")))))),wp.element.createElement("p",{className:"font-semibold text-base mt-4"},"Data to update:"),wp.element.createElement("ul",{className:"text-sm font-medium text-gray-900 bg-white flex flex-wrap gap-2 mt-2"},f.map((function(e){return wp.element.createElement(d,{key:e.id,id:e.id,label:e.label,checked:e.checked,cron:c.cron})}))))};function vu(e){return vu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vu(e)}function wu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function bu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?wu(Object(n),!0).forEach((function(t){xu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=vu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=vu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==vu(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Eu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Su(t){var n=t.settings,r=t.updateSettings,o=t.setSettings,a=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Eu(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Eu(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)("square"===n.cron.source),2),l=a[0],i=a[1];return wp.element.createElement("div",{className:"blur-sm"},wp.element.createElement("p",{className:"text-base font-semibold mb-2"},"Source of truth:"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"The Source of Trust setting determines the primary source for your product information. Choose Square to automatically sync and update your product details based on data from Square. This option is ideal if Square is your primary platform for inventory and sales management. Alternatively, selecting Woocommerce means your product updates will be based on the information stored within your WooCommerce system, best for those who manage their inventory directly through WooCommerce."),wp.element.createElement("div",{className:"flex gap-2 items-center my-4"},wp.element.createElement("p",{className:"font-semibold text-sm"},"Woocommerce"),wp.element.createElement(uu,{checked:l,onChange:function(e){i(e),r("cron",bu(bu({},n.cron),{},{source:e?"square":"woocommerce"}))},className:Va(l?"bg-slate-950":"bg-purple-500","relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-sky-600 focus:ring-offset-2")},wp.element.createElement("span",{className:"sr-only"},"Source of truth"),wp.element.createElement("span",{className:Va(l?"translate-x-5":"translate-x-0","pointer-events-none relative inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out")},wp.element.createElement("span",{className:Va(l?"opacity-0 duration-100 ease-out":"opacity-100 duration-200 ease-in","absolute inset-0 flex h-full w-full items-center justify-center transition-opacity"),"aria-hidden":"true"},wp.element.createElement("span",{className:"font-semibold text-purple-500 p-0 m-0 flex items-center justify-center text-xs leading-none pb-[2px]"},"w")),wp.element.createElement("span",{className:Va(l?"opacity-100 duration-200 ease-in":"opacity-0 duration-100 ease-out","absolute inset-0 flex h-full w-full items-center justify-center transition-opacity"),"aria-hidden":"true"},wp.element.createElement("span",{className:"font-semibold text-slate-950 p-0 m-0 flex items-center justify-center text-xs leading-none pb-[3px]"},"s")))),wp.element.createElement("p",{className:"font-semibold text-sm"},"Square")),wp.element.createElement("p",{className:"text-base font-semibold mb-2"},"Build your own schedule:"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"Setup your update schedule! Please be aware that updating, particularly with a large product inventory, may significantly impact server performance. To minimize potential strain, we recommend spacing your updates to the maximum extent feasible and verifying that your server infrastructure is robust enough to manage the load smoothly. This approach helps ensure a seamless operation and maintains optimal system performance."),wp.element.createElement("div",null,wp.element.createElement(yu,{settings:n,updateSettings:r})),wp.element.createElement("p",{className:"text-base font-semibold mt-4"},"Batches:"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"How many products to be updated per batch. A higher number will put greater load on the server."),wp.element.createElement("p",{className:"mt-2"},"Products will be updated in batches of:"," ",wp.element.createElement("span",{className:"text-sky-500 font-bold"},n.cron.batches)),wp.element.createElement("div",{className:"flex items-center gap-1 mt-2"},wp.element.createElement("p",null,"10"),wp.element.createElement("div",{className:"relative w-[300px]"},wp.element.createElement("input",{id:"steps-range",type:"range",min:"10",max:"100",onChange:function(e){console.log(e),o((function(t){return bu(bu({},t),{},{batches:e.target.value})})),r("cron",bu(bu({},n.cron),{},{batches:e.target.value}))},value:n.cron.batches,step:"10",className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer"})),wp.element.createElement("p",null,"100")))}const ku=function(e){var t=e.setSettings,n=e.updateSettings,r=e.settings;return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic update scheduler",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"The Automatic Update Scheduler allows you to set up a recurring schedule for product updates, adding another level of data accuracy, ensuring your information stays current without manual intervention. Simply select the frequency of updates—daily, weekly, or monthly—and the system will automatically apply the latest updates according to your chosen schedule."),wp.element.createElement(uu,{checked:r.cron.enabled,className:"".concat(r.cron.enabled?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"sr-only"},"Enable notifications"),wp.element.createElement("span",{className:"".concat(r.cron.enabled?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")}))),wp.element.createElement(Su,{settings:r,updateSettings:n,setSettings:t}))},Nu=function(e){e.setSettings,e.updateSettings;var t=e.settings;return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatically delete Square & Woo products",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Choose whether to automatically delete or archive products in Square or WooCommerce when they are removed from their respective catalogs. Archived products in Square will be put to 'draft' in WooCommerce, whereas deleted products will be moved to trash."),t.squareAuto.isActive?wp.element.createElement(React.Fragment,null," ",wp.element.createElement("div",{className:"flex items-center"},wp.element.createElement(uu,{checked:t.wooAuto.autoDeleteProduct,className:"".concat(t.wooAuto.autoDeleteProduct?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"sr-only"},"Enable auto product deletion"),wp.element.createElement("span",{className:"".concat(t.wooAuto.autoDeleteProduct?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square")),wp.element.createElement("div",{className:"flex items-center mt-4"},wp.element.createElement(uu,{checked:t.squareAuto.autoDeleteProduct,className:"".concat(t.squareAuto.autoDeleteProduct?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"sr-only"},"Enable auto product deletion"),wp.element.createElement("span",{className:"".concat(t.squareAuto.autoDeleteProduct?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to Woo"))):wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"font-semibold"},"Square to Woo automatic syncing on product update with webhook setup must be enabled to use this feature."))))},Ou=function(e){return e.updateSettings,e.settings,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatically create WooCommerce products",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"When this feature is enabled, every time you create a new product in Square, it will be imported into WooCommerce and linked automatically. This ensures that your product listings are consistently updated across both platforms, saving you time and maintaining synchronization between your WooCommerce store and Square inventory. ",wp.element.createElement("span",{className:"italic font-semibold"},"Automatic syncing on product update (Square to Woo) must be enabled."))))};function Cu(e){return vs.isServer?null:e instanceof Node?e.ownerDocument:null!=e&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let ju=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((e=>`${e}:not([tabindex='-1'])`)).join(",");var Pu=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(Pu||{}),Lu=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Lu||{}),_u=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(_u||{});var Ru=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Ru||{}),Iu=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Iu||{});"undefined"!=typeof window&&"undefined"!=typeof document&&(document.addEventListener("keydown",(e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")}),!0),document.addEventListener("click",(e=>{1===e.detail?delete document.documentElement.dataset.headlessuiFocusVisible:0===e.detail&&(document.documentElement.dataset.headlessuiFocusVisible="")}),!0));let Au=["textarea","input"].join(",");function Tu(e,t=(e=>e)){return e.slice().sort(((e,n)=>{let r=t(e),o=t(n);if(null===r||null===o)return 0;let a=r.compareDocumentPosition(o);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0}))}function Fu(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let a=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,l=Array.isArray(e)?n?Tu(e):e:function(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(ju)).sort(((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER))))}(e);o.length>0&&l.length>1&&(l=l.filter((e=>!o.includes(e)))),r=null!=r?r:a.activeElement;let i,c=(()=>{if(5&t)return 1;if(10&t)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),s=(()=>{if(1&t)return 0;if(2&t)return Math.max(0,l.indexOf(r))-1;if(4&t)return Math.max(0,l.indexOf(r))+1;if(8&t)return l.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=32&t?{preventScroll:!0}:{},m=0,p=l.length;do{if(m>=p||m+p<=0)return 0;let e=s+m;if(16&t)e=(e+p)%p;else{if(e<0)return 3;if(e>=p)return 1}i=l[e],null==i||i.focus(u),m+=c}while(i!==a.activeElement);return 6&t&&function(e){var t,n;return null!=(n=null==(t=null==e?void 0:e.matches)?void 0:t.call(e,Au))&&n}(i)&&i.select(),2}var Mu=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(Mu||{});let Du={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:Tu(n,(e=>e.element.current))}},1(e,t){let n=e.options.slice(),r=e.options.findIndex((e=>e.id===t.id));return-1===r?e:(n.splice(r,1),{...e,options:n})}},Gu=(0,t.createContext)(null);function qu(e){let n=(0,t.useContext)(Gu);if(null===n){let t=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,qu),t}return n}Gu.displayName="RadioGroupDataContext";let Vu=(0,t.createContext)(null);function Wu(e){let n=(0,t.useContext)(Vu);if(null===n){let t=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Wu),t}return n}function Bu(e,t){return Rs(t.type,Du,e,t)}Vu.displayName="RadioGroupActionsContext";var Hu=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(Hu||{});let zu=qs((function(e,n){let r=Os(),{id:o=`headlessui-radiogroup-${r}`,value:a,defaultValue:l,form:i,name:c,onChange:s,by:u=((e,t)=>e===t),disabled:m=!1,...p}=e,f=xs("string"==typeof u?(e,t)=>{let n=u;return(null==e?void 0:e[n])===(null==t?void 0:t[n])}:u),[d,h]=(0,t.useReducer)(Bu,{options:[]}),g=d.options,[y,v]=ou(),[w,b]=Js(),x=(0,t.useRef)(null),E=Ls(x,n),[S,k]=Es(a,s,l),N=(0,t.useMemo)((()=>g.find((e=>!e.propsRef.current.disabled))),[g]),O=(0,t.useMemo)((()=>g.some((e=>f(e.propsRef.current.value,S)))),[g,S]),C=xs((e=>{var t;if(m||f(e,S))return!1;let n=null==(t=g.find((t=>f(t.propsRef.current.value,e))))?void 0:t.propsRef.current;return!(null!=n&&n.disabled||(null==k||k(e),0))}));!function({container:e,accept:n,walk:r,enabled:o=!0}){let a=(0,t.useRef)(n),l=(0,t.useRef)(r);(0,t.useEffect)((()=>{a.current=n,l.current=r}),[n,r]),ws((()=>{if(!e||!o)return;let t=Cu(e);if(!t)return;let n=a.current,r=l.current,i=Object.assign((e=>n(e)),{acceptNode:n}),c=t.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,i,!1);for(;c.nextNode();)r(c.currentNode)}),[e,o,a,l])}({container:x.current,accept:e=>"radio"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let j=xs((e=>{let t=x.current;if(!t)return;let n=Cu(t),r=g.filter((e=>!1===e.propsRef.current.disabled)).map((e=>e.element.current));switch(e.key){case tu.Enter:Ys(e.currentTarget);break;case tu.ArrowLeft:case tu.ArrowUp:if(e.preventDefault(),e.stopPropagation(),Fu(r,Pu.Previous|Pu.WrapAround)===Lu.Success){let e=g.find((e=>e.element.current===(null==n?void 0:n.activeElement)));e&&C(e.propsRef.current.value)}break;case tu.ArrowRight:case tu.ArrowDown:if(e.preventDefault(),e.stopPropagation(),Fu(r,Pu.Next|Pu.WrapAround)===Lu.Success){let e=g.find((e=>e.element.current===(null==n?void 0:n.activeElement)));e&&C(e.propsRef.current.value)}break;case tu.Space:{e.preventDefault(),e.stopPropagation();let t=g.find((e=>e.element.current===(null==n?void 0:n.activeElement)));t&&C(t.propsRef.current.value)}}})),P=xs((e=>(h({type:0,...e}),()=>h({type:1,id:e.id})))),L=(0,t.useMemo)((()=>({value:S,firstOption:N,containsCheckedOption:O,disabled:m,compare:f,...d})),[S,N,O,m,f,d]),_=(0,t.useMemo)((()=>({registerOption:P,change:C})),[P,C]),R={ref:E,id:o,role:"radiogroup","aria-labelledby":y,"aria-describedby":w,onKeyDown:j},I=(0,t.useMemo)((()=>({value:S})),[S]),A=(0,t.useRef)(null),T=ks();return(0,t.useEffect)((()=>{A.current&&void 0!==l&&T.addEventListener(A.current,"reset",(()=>{C(l)}))}),[A,C]),t.createElement(b,{name:"RadioGroup.Description"},t.createElement(v,{name:"RadioGroup.Label"},t.createElement(Vu.Provider,{value:_},t.createElement(Gu.Provider,{value:L},null!=c&&null!=S&&Us({[c]:S}).map((([e,n],r)=>t.createElement(Hs,{features:Bs.Hidden,ref:0===r?e=>{var t;A.current=null!=(t=null==e?void 0:e.closest("form"))?t:null}:void 0,...Vs({key:e,as:"input",type:"radio",checked:null!=n,hidden:!0,readOnly:!0,form:i,name:e,value:n})}))),Fs({ourProps:R,theirProps:p,slot:I,defaultTag:"div",name:"RadioGroup"})))))})),Uu=qs((function(e,n){var r;let o=Os(),{id:a=`headlessui-radiogroup-option-${o}`,value:l,disabled:i=!1,...c}=e,s=(0,t.useRef)(null),u=Ls(s,n),[m,p]=ou(),[f,d]=Js(),{addFlag:h,removeFlag:g,hasFlag:y}=function(e=0){let[n,r]=(0,t.useState)(e),o=function(){let e=(0,t.useRef)(!1);return ws((()=>(e.current=!0,()=>{e.current=!1})),[]),e}(),a=(0,t.useCallback)((e=>{o.current&&r((t=>t|e))}),[n,o]),l=(0,t.useCallback)((e=>Boolean(n&e)),[n]),i=(0,t.useCallback)((e=>{o.current&&r((t=>t&~e))}),[r,o]),c=(0,t.useCallback)((e=>{o.current&&r((t=>t^e))}),[r]);return{flags:n,addFlag:a,hasFlag:l,removeFlag:i,toggleFlag:c}}(1),v=bs({value:l,disabled:i}),w=qu("RadioGroup.Option"),b=Wu("RadioGroup.Option");ws((()=>b.registerOption({id:a,element:s,propsRef:v})),[a,b,s,v]);let x=xs((e=>{var t;if(zs(e.currentTarget))return e.preventDefault();b.change(l)&&(h(2),null==(t=s.current)||t.focus())})),E=xs((e=>{if(zs(e.currentTarget))return e.preventDefault();h(2)})),S=xs((()=>g(2))),k=(null==(r=w.firstOption)?void 0:r.id)===a,N=w.disabled||i,O=w.compare(w.value,l),C={ref:u,id:a,role:"radio","aria-checked":O?"true":"false","aria-labelledby":m,"aria-describedby":f,"aria-disabled":!!N||void 0,tabIndex:N?-1:O||!w.containsCheckedOption&&k?0:-1,onClick:N?void 0:x,onFocus:N?void 0:E,onBlur:N?void 0:S},j=(0,t.useMemo)((()=>({checked:O,disabled:N,active:y(2)})),[O,N,y]);return t.createElement(d,{name:"RadioGroup.Description"},t.createElement(p,{name:"RadioGroup.Label"},Fs({ourProps:C,theirProps:c,slot:j,defaultTag:"div",name:"RadioGroup.Option"})))})),$u=Object.assign(zu,{Option:Uu,Label:lu,Description:eu});function Zu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Yu(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yu(e,t):void 0}}(e,t)||function(){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 Yu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Ku=[{id:"square",title:"Let Square calculate",description:"Square will calculate points based on items contained in the order id. Item eligibility is determined by Square settings.",pros:["Points will be assigned to order and transaction","Easy to track point earning"],cons:["Shipping will be included in point calculation","May earn more points then desired"]},{id:"custom",title:"Custom calculation",description:"This plugin will manually calculate points based on item eligibility defined in Square and program details below.",pros:["Shipping not included in point earnings","Only give points for revenue generating items"],cons:["Points are not tied to Square order or transaction","Harder to track point earning"]}],Xu=[{id:"square",title:"Square redemption",description:"We'll use Square's orders and loyalty API to attached reward redemptions to orders and transcations.",pros:["Reward redemptions are tied to orders","Easy to track point earning"],cons:["Must use SquareSync for Woo payment gateway","Strict point redemption"]},{id:"custom",title:"Custom redemption",description:"Using a custom integration, we'll adjust a customers points manually.",pros:["Compatible with any WooCommerce payment gateway","More flexibility"],cons:["Reward redemptions are added to Square orders as discounts not rewards","Harder to track reward redemptions"]}];const Ju=function(t){var n=t.settings,r=(t.updateSettings,t.getLoyaltyProgram,Zu((0,e.useState)(""),2)),o=r[0],a=(r[1],Zu((0,e.useState)(n.loyalty.method),2)),l=a[0],i=a[1],c=Zu((0,e.useState)(n.loyalty.redemptionMethod),2),s=c[0],u=c[1];return(0,e.useEffect)((function(){i(n.loyalty.method),u(n.loyalty.redemptionMethod)}),[n]),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 flex gap-2 items-center"},"Loyalty Program",wp.element.createElement(At,null)),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Integrate Square's Loyalty program into your website, allowing customers to earn points on purchases through online orders.")),wp.element.createElement("div",{className:"flex items-center gap-2"},wp.element.createElement(uu,{checked:!1,className:"bg-gray-200 relative inline-flex h-6 w-11 items-center rounded-full"},wp.element.createElement("span",{className:"translate-x-1 inline-block h-4 w-4 transform rounded-full bg-white transition"})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable accrual of points on customer orders")),o&&wp.element.createElement("p",{className:"text-red-600 font-semibold text-sm mt-2"},o),n.loyalty.program&&n.loyalty.enabled&&wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(uu,{checked:!1,className:"".concat(n.loyalty.redeem?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.loyalty.redeem?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable redeeming of points on orders")),wp.element.createElement(React.Fragment,null,wp.element.createElement("fieldset",{className:"my-12"},wp.element.createElement("legend",{className:"text-base font-semibold leading-6 text-gray-900 text-center"},"Select a point ",wp.element.createElement("span",{className:"text-sky-500"},"accumulation")," option"),wp.element.createElement("p",{className:"text-center max-w-lg mx-auto text-gray-500"},"Due to the nature of Square and their current API, we have to make a compromise. Pro's and Cons of each are defined below."),wp.element.createElement($u,{value:l,className:"mt-6 grid grid-cols-1 gap-y-6 sm:grid-cols-2 sm:gap-x-4"},Ku.map((function(e,t){return wp.element.createElement($u.Option,{key:e.id,value:e.id,className:function(e){var t=e.active,n=e.checked;return"group relative flex cursor-pointer rounded-lg border p-4 shadow-sm focus:outline-none ".concat(n?"border-sky-600":"border-gray-300"," ").concat(t?"ring-2 ring-sky-600":"")}},(function(n){var r=n.checked;return wp.element.createElement(React.Fragment,null,wp.element.createElement("span",{className:"flex flex-1"},wp.element.createElement("span",{className:"flex flex-col justify-between"},wp.element.createElement("span",{className:"block text-sm font-medium text-gray-900"},e.title),wp.element.createElement("span",{className:"mt-1 flex items-center text-sm text-gray-500"},e.description),wp.element.createElement("div",{className:"mt-4 gap-2 flex flex-col ".concat(1===t&&"flex-col-reverse")},e.pros.map((function(e){return wp.element.createElement("div",{className:"flex gap-2 "},wp.element.createElement(Yt,{className:"min-w-5 w-5 h-5 text-green-500 min-h-5"}),wp.element.createElement("span",{className:" text-sm text-gray-900"},e))})),e.cons.map((function(e){return wp.element.createElement("div",{className:"flex gap-2 "},wp.element.createElement(Za,{className:"min-w-5 w-5 min-h-5 text-red-500"}),wp.element.createElement("span",{className:"text-sm text-gray-900"},e))}))))),wp.element.createElement(Yt,{"aria-hidden":"true",className:"h-5 w-5 ".concat(r?"text-sky-600":"invisible")}),wp.element.createElement("span",{"aria-hidden":"true",className:"pointer-events-none absolute -inset-px rounded-lg border-2 ".concat(r?"border-sky-600":"border-transparent")}))}))}))))),wp.element.createElement(React.Fragment,null,wp.element.createElement("fieldset",{className:"my-12"},wp.element.createElement("legend",{className:"text-base font-semibold leading-6 text-gray-900 text-center"},"Select a point ",wp.element.createElement("span",{className:"text-sky-500"},"redemption")," option"),wp.element.createElement("p",{className:"text-center max-w-lg mx-auto text-gray-500"},"Again, due to the nature of Square and their current API, we have to make a compromise. Pro's and Cons of each are defined below."),wp.element.createElement($u,{value:s,className:"mt-6 grid grid-cols-1 gap-y-6 sm:grid-cols-2 sm:gap-x-4"},Xu.map((function(e,t){return wp.element.createElement($u.Option,{key:e.id,value:e.id,className:function(e){var t=e.active,n=e.checked;return"group relative flex cursor-pointer rounded-lg border p-4 shadow-sm focus:outline-none ".concat(n?"border-sky-600":"border-gray-300"," ").concat(t?"ring-2 ring-sky-600":"")}},(function(n){var r=n.checked;return wp.element.createElement(React.Fragment,null,wp.element.createElement("span",{className:"flex flex-1"},wp.element.createElement("span",{className:"flex flex-col justify-between"},wp.element.createElement("span",{className:"block text-sm font-medium text-gray-900"},e.title),wp.element.createElement("span",{className:"mt-1 flex items-center text-sm text-gray-500"},e.description),wp.element.createElement("div",{className:"mt-4 gap-2 flex flex-col ".concat(1===t&&"flex-col-reverse")},e.pros.map((function(e){return wp.element.createElement("div",{className:"flex gap-2 "},wp.element.createElement(Yt,{className:"min-w-5 w-5 h-5 text-green-500 min-h-5"}),wp.element.createElement("span",{className:" text-sm text-gray-900"},e))})),e.cons.map((function(e){return wp.element.createElement("div",{className:"flex gap-2 "},wp.element.createElement(Za,{className:"min-w-5 w-5 min-h-5 text-red-500"}),wp.element.createElement("span",{className:"text-sm text-gray-900"},e))}))))),wp.element.createElement(Yt,{"aria-hidden":"true",className:"h-5 w-5 ".concat(r?"text-sky-600":"invisible")}),wp.element.createElement("span",{"aria-hidden":"true",className:"pointer-events-none absolute -inset-px rounded-lg border-2 ".concat(r?"border-sky-600":"border-transparent")}))}))}))))))},Qu=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z"}))}));function em(e){var t=e.program;return wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"mt-6 p-4 border rounded-lg border-gray-300"},wp.element.createElement("div",{className:"flex flex-col gap-2 items-center justify-center mb-4 border-b pb-2"},wp.element.createElement(Qu,{className:"size-10"}),wp.element.createElement("h3",{className:"text-lg font-semibold leading-7 text-gray-900 flex gap-2 items-center"},"Your Loyalty Program"),wp.element.createElement("p",{className:"text-center text-gray-500 -mt-2"},"You can only edit your loyalty program on Square")),wp.element.createElement("div",{className:"mb-3"},wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-base font-semibold leading-7 text-gray-900 flex gap-2 items-center"},"Loyalty Program Terminology"),wp.element.createElement("div",{className:"max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Customize the terminology of your loyalty program to fit your brand (Examples: Star/Stars, Point/Points, Punch/Punches).")))),wp.element.createElement("dl",{className:"divide-y divide-gray-100 border border-gray-200 rounded-lg px-4"},wp.element.createElement("div",{className:"px-4 py-3 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"},wp.element.createElement("dt",{className:"text-sm font-medium leading-6 text-gray-900"},"Singular"),wp.element.createElement("dd",{className:"mt-1 flex text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"},wp.element.createElement("span",{className:"flex-grow"},t.terminology.one))),wp.element.createElement("div",{className:"px-4 py-3 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"},wp.element.createElement("dt",{className:"text-sm font-medium leading-6 text-gray-900"},"Plural"),wp.element.createElement("dd",{className:"mt-1 flex text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"},wp.element.createElement("span",{className:"flex-grow"},t.terminology.other)))),wp.element.createElement("div",{className:"px-4 sm:px-0 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-7 text-gray-900"},"Earning Points"),wp.element.createElement("div",{className:"max-w-xl text-sm text-gray-500 mb-2"},wp.element.createElement("p",{className:""},"Allow customers to earn points on purchases made through your website."))),wp.element.createElement("dl",null,wp.element.createElement("div",{className:"-mx-4 flow-root sm:mx-0"},wp.element.createElement("table",{className:"min-w-full"},wp.element.createElement("colgroup",null,wp.element.createElement("col",{className:"sm:w-1/6"}),wp.element.createElement("col",{className:"sm:w-3/6"}),wp.element.createElement("col",{className:"sm:w-2/6"})),wp.element.createElement("thead",{className:"border-b border-gray-300 text-gray-900"},wp.element.createElement("tr",null,wp.element.createElement("th",{scope:"col",className:"py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-0"},"Rule value"),wp.element.createElement("th",{scope:"col",className:"hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell"},"Rule description"))),wp.element.createElement("tbody",null,t.accrual_rules.map((function(e,n){return wp.element.createElement("tr",{key:n,className:"border-b border-gray-200"},wp.element.createElement("td",{className:"max-w-0 py-5 pl-4 pr-3 text-sm sm:pl-0"},wp.element.createElement("div",{className:"font-medium text-gray-900"},e.points," ",1===e.points?t.terminology.one:t.terminology.other)),wp.element.createElement("td",{className:"px-3 py-5 text-left text-sm text-gray-500 sm:table-cell"},wp.element.createElement("div",{className:"mt-1 truncate text-gray-500"},"Earn ",e.points," ",1===e.points?t.terminology.one:t.terminology.other," for every $",(e.spend_data.amount_money.amount/100).toFixed(2)," spend in a single transaction")))})))))),wp.element.createElement("dl",null,wp.element.createElement("div",{className:"px-4 sm:px-0 mt-6 mb-3"},wp.element.createElement("h3",{className:"text-base font-semibold leading-7 text-gray-900"},"Redeeming rewards"),wp.element.createElement("div",{className:"max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Allow customers to redeem their points for discounts on purchases. Currently product and category specific rewards are not supported. Stay tuned for a future release."))),wp.element.createElement("div",{className:"px-4 pb-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"},wp.element.createElement("dd",{className:"mt-1 text-sm leading-6 text-gray-700 sm:col-span-3 sm:mt-0"},wp.element.createElement("div",{className:"-mx-4 flow-root sm:mx-0"},wp.element.createElement("table",{className:"min-w-full"},wp.element.createElement("colgroup",null,wp.element.createElement("col",{className:"sm:w-1/6"}),wp.element.createElement("col",{className:"sm:w-3/6"})),wp.element.createElement("thead",{className:"border-b border-gray-300 text-gray-900"},wp.element.createElement("tr",null,wp.element.createElement("th",{scope:"col",className:"py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-0"},"Reward Value"),wp.element.createElement("th",{scope:"col",className:"hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell"},"Reward Description"))),wp.element.createElement("tbody",null,t.reward_tiers.map((function(e,n){var r;return wp.element.createElement("tr",{key:n,className:"border-b border-gray-200 relative select-none"},wp.element.createElement("td",{className:"max-w-0 py-5 pl-4 pr-3 text-sm sm:pl-0"},wp.element.createElement("div",{className:"font-medium text-gray-900"},e.points," ",1===e.points?t.terminology.one:t.terminology.other)),wp.element.createElement("td",{className:"px-3 py-5 text-left text-sm text-gray-500 sm:table-cell"},wp.element.createElement("div",{className:"mt-1 truncate text-gray-500"},e.name)),(null===(r=e.definition.catalog_object_ids)||void 0===r?void 0:r.length)>0&&wp.element.createElement("td",{className:"absolute left-0 w-full h-full flex justify-center items-center select-none"},wp.element.createElement("div",{className:"w-full h-full bg-red-300 opacity-30 absolute left-0 top-0 z-0"}),wp.element.createElement("div",{className:"relative z-10 text-base font-semibold bg-red-300 p-2"},"Disabled, not yet compatible with plugin")))}))))))))))}function tm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return nm(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nm(e,t):void 0}}(e,t)||function(){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 nm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function rm(e){return rm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rm(e)}function om(){om=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==rm(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(rm(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function am(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function lm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?am(Object(n),!0).forEach((function(t){im(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):am(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function im(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=rm(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=rm(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==rm(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cm(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function sm(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){cm(a,r,o,l,i,"next",e)}function i(e){cm(a,r,o,l,i,"throw",e)}l(void 0)}))}}function um(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return mm(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mm(e,t):void 0}}(e,t)||function(){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 mm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var pm=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];function fm(e){return fm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fm(e)}function dm(){dm=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==fm(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(fm(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function hm(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function gm(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){hm(a,r,o,l,i,"next",e)}function i(e){hm(a,r,o,l,i,"throw",e)}l(void 0)}))}}function ym(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function vm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ym(Object(n),!0).forEach((function(t){wm(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ym(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function wm(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=fm(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=fm(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==fm(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||xm(e,t)||function(){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 xm(e,t){if(e){if("string"==typeof e)return Em(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Em(e,t):void 0}}function Em(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}o(889);var Sm=[{path:"/",element:function(){return mn(),wp.element.createElement("div",{className:"dashboard-grid gap-x-6 gap-y-6"},wp.element.createElement(Tn,null),wp.element.createElement("div",{className:"flex flex-col gap-6"},wp.element.createElement(Tt,null),wp.element.createElement(Gt,null)),wp.element.createElement("div",null,wp.element.createElement(sn,null)))}},{path:"/inventory",element:function(){mn();var t=oe(),n=X((function(e){return e.inventory})),r=(n.data,n.loading,n.error,n.fetchAttempted,Li((0,e.useState)(!1),2)),o=(r[0],r[1]),a=Li((0,e.useState)({location:"",squareAuto:{isActive:!1,stock:!0,sku:!0,title:!0,description:!0,images:!0,price:!0,category:!0},wooAuto:{isActive:!1,stock:!1,sku:!0,title:!1,description:!1,images:!1,category:!1,price:!1},exportStatus:0,exportSynced:1,exportResults:null}),2),l=a[0],i=a[1];return(0,e.useEffect)((function(){var e=function(){var e=Pi(ki().mark((function e(){return ki().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Ut({path:"/sws/v1/settings",method:"GET"}).then((function(e){i((function(t){return Oi(Oi({},e),{},{customers:Oi(Oi({},t.customers),e.customers)})}))}));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]),(0,e.useEffect)((function(){var e=function(){var e=Pi(ki().mark((function e(){var t;return ki().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Ut({path:"/sws/v1/settings/access-token"});case 3:(t=e.sent).access_token&&t.access_token.length>0&&"Token not set or empty"!==t.access_token&&o(t.access_token),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.error(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}();e()}),[]),(0,e.useEffect)((function(){t($l())}),[]),wp.element.createElement("div",null,wp.element.createElement("div",{className:"bg-white rounded-xl shadow-lg overflow-auto"},wp.element.createElement(Ei,{getInventory:function(e){return t($l(e))},settings:l})))}},{path:"/customers",element:function(){return wp.element.createElement(r().Fragment,null,wp.element.createElement("div",null,wp.element.createElement("div",{className:"bg-white p-6 rounded-xl not-prose grid grid-cols-1 gap-3 sm:grid-cols-2 w-full mb-4"},wp.element.createElement("header",{className:"col-span-full flex gap-2 items-center"},wp.element.createElement("p",{className:"text-xl font-semibold"},"Customer Syncing and Role Mapping"),wp.element.createElement(At,null)),wp.element.createElement("div",{className:" w-full col-span-full"},wp.element.createElement("ul",{className:"grid grid-cols-2 w-full text-lg gap-x-24 gap-y-3"},wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Customer Import"),wp.element.createElement("p",{className:"text-base"},"Import and link your existing Square customers to WooCommerce")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Role & Group Mapping"),wp.element.createElement("p",{className:"text-base"},"Map Square groups to WordPress roles, perfect for role based pricing or restritced content")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Customer Export"),wp.element.createElement("p",{className:"text-base"},"Export and link your existing WordPress users to Square")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Real-time Customer Sync"),wp.element.createElement("p",{className:"text-base"},"Sync customers from Square and WordPress in real-time.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Auto Customer Match"),wp.element.createElement("p",{className:"text-base"},"Match your existing WordPress users to Square users automatically")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Auto Customer Create"),wp.element.createElement("p",{className:"text-base"},"Create customers on Square or WordPress automatically")))),wp.element.createElement("h2",{className:"text-xl text-center col-span-full mt-4 font-bold"},"Watch Demo"))),wp.element.createElement("div",{style:{position:"relative",paddingBottom:"56.25%",height:0,overflow:"hidden"}},wp.element.createElement("iframe",{src:"https://www.youtube.com/embed/K4Ac4q7vEGg?si=mKp08JGnHBiiwd6N",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"},frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"YouTube video"})))}},{path:"/loyalty",element:function(){return wp.element.createElement(r().Fragment,null,wp.element.createElement("div",null,wp.element.createElement("div",{className:"bg-white p-6 rounded-xl not-prose grid grid-cols-1 gap-3 sm:grid-cols-2 w-full mb-4"},wp.element.createElement("header",{className:"col-span-full flex gap-2 items-center"},wp.element.createElement("p",{className:"text-xl font-semibold"},"Square Loyalty Program"),wp.element.createElement(At,null)),wp.element.createElement("div",{className:" w-full col-span-full"},wp.element.createElement("ul",{className:"grid grid-cols-2 w-full text-lg gap-x-24 gap-y-3"},wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Point Earning"),wp.element.createElement("p",{className:"text-base"},"Customers earn points for every purchase they make, with the ability to set customizable point accrual rates based on purchase amounts.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Reward Redemption"),wp.element.createElement("p",{className:"text-base"},"Allow customers to redeem their loyalty points for exclusive rewards, discounts, or special offers directly through your online store.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Auto Customer Loyalty Account Creation"),wp.element.createElement("p",{className:"text-base"},"Automatically create loyalty accounts for customers upon their first purchase, streamlining the process and ensuring seamless point tracking.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Rewards Dashboard"),wp.element.createElement("p",{className:"text-base"},"A user-friendly dashboard where customers can view their current points balance, reward tiers, and track their progress towards their next reward.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Customizable Reward Tiers"),wp.element.createElement("p",{className:"text-base"},"Create multiple reward tiers with varying points requirements, allowing you to offer different levels of rewards to your loyal customers.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Points Progress Tracking"),wp.element.createElement("p",{className:"text-base"},"Display a visual progress bar for customers, showing how close they are to unlocking their next reward, encouraging more purchases.")))),wp.element.createElement("h2",{className:"text-xl text-center col-span-full mt-4 font-bold"},"Watch Demo"))),wp.element.createElement("div",{style:{position:"relative",paddingBottom:"56.25%",height:0,overflow:"hidden"}},wp.element.createElement("iframe",{src:"https://www.youtube.com/embed/kQtLJesQSGI?si=QP4tGkFsKkgB68JD",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"},frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"YouTube video"})))}},{path:"/orders",element:function(){mn();var t=oe(),n=X((function(e){return e.orders})),r=n.data,o=n.loading,a=n.error;return(0,e.useEffect)((function(){t(Bi())}),[t]),wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"bg-white rounded-xl overflow-hidden"},o&&wp.element.createElement(cc,null),!o&&!a&&wp.element.createElement("div",{className:"sm:px-6 px-4"},r&&r.length>0?wp.element.createElement(lc,{data:r.filter((function(e){return null!==e}))}):wp.element.createElement("div",null,"No orders found.")),!o&&a&&wp.element.createElement("div",{className:"sm:px-6 px-4 py-5"},"Unable to fetch orders: ",a)))}},{path:"/settings",element:function(){return mn(),wp.element.createElement(zc,null)}},{path:"/settings/general",element:zc},{path:"/settings/payments",element:function(){mn();var t=bm((0,e.useState)({enabled:"no",title:"Credit Card",description:"Pay securely using your credit card.",accepted_credit_cards:["visa","mastercard","amex","discover","jcb","diners","union"],square_application_id_sandbox:"",square_application_id_live:"",enable_google_pay:"no",enable_apple_pay:"no"}),2),n=t[0],r=t[1],o=bm((0,e.useState)({title:!1,description:!1,sandboxId:!1,liveId:!1}),2),a=o[0],l=o[1],i=bm((0,e.useState)(!0),2),c=i[0],s=i[1];(0,e.useEffect)((function(){Vt()({path:"/sws/v1/settings/get-gateway-settings",method:"GET"}).then((function(e){r(e),s(!1)})).catch((function(e){s(!1),F.error("Failed to update settings: ".concat(e.message))}))}),[]);var u=function(e){var t="yes"===n[e]?"no":"yes";r((function(n){return vm(vm({},n),{},wm({},e,t))})),p(e,t)},m=function(){var e=gm(dm().mark((function e(t,r){return dm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l((function(e){return vm(vm({},e),{},wm({},r,!0))})),e.next=3,p(t,n[t]);case 3:l((function(e){return vm(vm({},e),{},wm({},r,!1))}));case 4:case"end":return e.stop()}}),e)})));return function(_x,t){return e.apply(this,arguments)}}(),p=function(){var e=gm(dm().mark((function e(t,n){var r;return dm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Vt()({path:"/sws/v1/settings/update-gateway-settings",method:"POST",data:wm({},t,n)});case 3:return r=e.sent,F.success("Settings updated successfully!"),e.abrupt("return",r);case 8:e.prev=8,e.t0=e.catch(0),F.error("Failed to update settings: ".concat(e.t0.message));case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(t,n){return e.apply(this,arguments)}}();return wp.element.createElement(Mc,null,wp.element.createElement("div",{className:"px-4"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Payment Settings"),wp.element.createElement("div",null,c?wp.element.createElement(Oc,null):wp.element.createElement(React.Fragment,null,wp.element.createElement("p",{className:"mb-4"},"Modify the payment settings for your store."),wp.element.createElement("div",{className:"flex items-center gap-2 mb-4 mt-3"},wp.element.createElement(uu,{checked:"yes"===n.enabled,onChange:function(){return u("enabled")},className:"".concat("yes"===n.enabled?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat("yes"===n.enabled?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable Gateway")),wp.element.createElement("div",{className:"max-w-xl flex items-end mt-4"},wp.element.createElement("div",{className:"flex-grow items-end"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Title"),wp.element.createElement("input",{type:"text",value:n.title,onChange:function(e){return r(vm(vm({},n),{},{title:e.target.value}))},className:"block w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6"})),wp.element.createElement("button",{onClick:function(){return m("title","title")},type:"button",className:"mt-3 inline-flex w-full items-center justify-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 sm:ml-3 sm:mt-0 sm:w-auto",loading:a.title},a.title?"Saving...":"Save")),wp.element.createElement("div",{className:"max-w-xl flex items-end mt-4"},wp.element.createElement("div",{className:"flex-grow items-end"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Description"),wp.element.createElement("input",{type:"text",value:n.description,onChange:function(e){return r(vm(vm({},n),{},{description:e.target.value}))},className:"block w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6"})),wp.element.createElement("button",{onClick:function(){return m("description","description")},type:"button",className:"mt-3 inline-flex w-full items-center justify-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 sm:ml-3 sm:mt-0 sm:w-auto",loading:a.description},a.description?"Saving...":"Save")),wp.element.createElement("div",{className:"max-w-xl flex items-end mt-4"},wp.element.createElement("div",{className:"flex-grow items-end"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Square Sandbox Application ID"),wp.element.createElement("input",{type:"text",value:n.square_application_id_sandbox,onChange:function(e){return r(vm(vm({},n),{},{square_application_id_sandbox:e.target.value}))},className:"block w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6"})),wp.element.createElement("button",{onClick:function(){return m("square_application_id_sandbox","square_application_id_sandbox")},type:"button",className:"mt-3 inline-flex w-full items-center justify-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 sm:ml-3 sm:mt-0 sm:w-auto",loading:a.square_application_id_sandbox},a.square_application_id_sandbox?"Saving...":"Save")),wp.element.createElement("div",{className:"max-w-xl flex items-end mt-4"},wp.element.createElement("div",{className:"flex-grow items-end"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Square Live Application ID"),wp.element.createElement("input",{type:"text",value:n.square_application_id_live,onChange:function(e){return r(vm(vm({},n),{},{square_application_id_live:e.target.value}))},className:"block w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6"})),wp.element.createElement("button",{onClick:function(){return m("square_application_id_live","square_application_id_live")},type:"button",className:"mt-3 inline-flex w-full items-center justify-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 sm:ml-3 sm:mt-0 sm:w-auto",loading:a.square_application_id_live},a.square_application_id_live?"Saving...":"Save")),wp.element.createElement("div",{className:"mb-4 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 mb-3"},"Payment Methods"),wp.element.createElement("div",{className:"grid grid-cols-2 gap-4"},["visa","mastercard","amex","discover","jcb","diners","union"].map((function(e){var t=!!n.accepted_credit_cards&&n.accepted_credit_cards.includes(e);return wp.element.createElement("div",{key:e,className:"flex items-center"},wp.element.createElement("input",{type:"checkbox",checked:t,onChange:function(){return function(e){var t,o=!!n.accepted_credit_cards&&n.accepted_credit_cards.includes(e);t=o?n.accepted_credit_cards.filter((function(t){return t!==e})):[].concat(function(e){return function(e){if(Array.isArray(e))return Em(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||xm(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(n.accepted_credit_cards),[e]),r((function(e){return vm(vm({},e),{},{accepted_credit_cards:t})})),p("accepted_credit_cards",t)}(e)},className:"h-4 w-4 text-sky-600 border-gray-300 rounded"}),wp.element.createElement("label",{htmlFor:e,className:"ml-2 block text-sm font-medium text-gray-700"},e.charAt(0).toUpperCase()+e.slice(1)))})),".")),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 mt-6"},"Digital Wallets"),wp.element.createElement("div",{className:"flex items-center gap-2 mb-4 mt-6"},wp.element.createElement(uu,{checked:"yes"===n.enable_google_pay,onChange:function(){return u("enable_google_pay")},className:"".concat("yes"===n.enable_google_pay?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat("yes"===n.enable_google_pay?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable Google Pay")),wp.element.createElement("div",{className:"flex items-center gap-2 mb-4"},wp.element.createElement(uu,{checked:"yes"===n.enable_apple_pay,onChange:function(){return u("enable_apple_pay")},className:"".concat("yes"===n.enable_apple_pay?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat("yes"===n.enable_apple_pay?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable Apple Pay"))))))}},{path:"/settings/inventory",element:function(){mn();var e=An(),t=e.settings,n=e.updateSettings,r=e.settingsLoading;return wp.element.createElement(Mc,null,wp.element.createElement(React.Fragment,null,!r&&wp.element.createElement(React.Fragment,null,wp.element.createElement(ss,{settings:t,updateSettings:n,settingsLoading:r}),wp.element.createElement(hs,{settings:t,updateSettings:n,settingsLoading:r}),wp.element.createElement(ku,{settings:t,updateSettings:n}),wp.element.createElement(mu,{settings:t,updateSettings:n}),wp.element.createElement(Ou,{settings:t,updateSettings:n}),wp.element.createElement(Nu,{settings:t,updateSettings:n}))))}},{path:"/settings/customers",element:function(){mn();var e=An(),t=e.settings,n=e.updateSettings,r=e.settingsLoading;return wp.element.createElement(Mc,null,wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 text-black"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Filter Square Customers",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Select the Square customer segment or group you wish to use for WordPress syncing (if any)."))),wp.element.createElement(Kc,{settings:t,updateSettings:n,settingsLoading:r}),wp.element.createElement(ns,{settings:t,updateSettings:n,settingsLoading:r}),wp.element.createElement(rs,{settings:t,updateSettings:n,settingsLoading:r}),wp.element.createElement(os,{settings:t,updateSettings:n,settingsLoading:r})))}},{path:"/settings/orders",element:function(){mn();var t=An(),n=t.settings,r=t.updateSettings,o=t.settingsLoading,a=um((0,e.useState)([]),2),l=a[0],i=a[1],c=um((0,e.useState)(!0),2),s=c[0],u=c[1],m=um((0,e.useState)(),2),p=m[0],f=m[1],d=um((0,e.useState)(!0),2),h=d[0],g=d[1];(0,e.useEffect)((function(){var e=function(){var e=sm(om().mark((function e(){return om().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Vt()({path:"/sws/v1/settings/get-gateway-settings",method:"GET"}).then((function(e){f((function(t){return lm(lm({},t),e)})),g(!1)})).catch((function(e){g(!1),F({render:"Failed to update settings: "+e.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0})}));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]),(0,e.useEffect)((function(){u(!0);var e=function(){var e=sm(om().mark((function e(){return om().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Vt()({path:"/sws/v1/settings/get-shipping-methods",method:"GET"}).then((function(e){i(e),u(!1)})).catch((function(e){F({render:"Failed to get shipping methods: "+e.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0}),u(!1)}));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]);var y=n.orders.pickupSchedule||pm.reduce((function(e,t){return lm(lm({},e),{},im({},t,{enabled:!1,from:"09:00",to:"17:00"}))}),{});return wp.element.createElement(Mc,null,wp.element.createElement(React.Fragment,null,o&&!h?wp.element.createElement("div",null,"Loading..."):wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic Order Sync"),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Streamline your business operations by synchronizing your WooCommerce orders with Square automatically."),p&&"yes"!==p.enabled?wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("div",{className:"flex items-center gap-2"},wp.element.createElement(uu,{checked:n.orders.enabled,onChange:function(e){r("orders",lm(lm({},n.orders),{},{enabled:e}))},className:"".concat(n.orders.enabled?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.orders.enabled?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable automatic order sync")),wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(uu,{checked:n.orders.transactions,onChange:function(e){r("orders",lm(lm({},n.orders),{},{transactions:e}))},className:"".concat(n.orders.transactions?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.orders.transactions?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable transaction/receipt sync")),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 mt-6"},"Woo Status"),wp.element.createElement("p",{className:"mb-4"},"Select the specific stage within the WooCommerce order cycle at which the order will be synchronized with Square."),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:n.orders.stage,onChange:function(e){r("orders",lm(lm({},n.orders),{},{stage:e.target.value}))}},wp.element.createElement("option",{value:"processing"},"processing"),wp.element.createElement("option",{value:"completed"},"completed")))):wp.element.createElement("div",null,wp.element.createElement("p",{className:"mb-4 text-sky-500"},"SquareSync Payment Gateway is currently enabled, and because orders and transactions are automatically generated, these settings cannot be edited. To make changes, please disable the SquareSync Payment Gateway."))))),wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mb-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time Order Import ",wp.element.createElement(At,null)),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Automatically import your Square orders into WooCommerce")),wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(uu,{checked:!1,className:"".concat(n.orders.orderImport?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.orders.orderImport?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable real-time order import")),wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(uu,{checked:!1,className:"".concat(n.orders.orderImportAllLocations?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.orders.orderImportAllLocations?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Import orders from all locations ",wp.element.createElement("span",{className:"font-normal"},"(Default is the currently selected location on general settings page)"))),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 "},wp.element.createElement("p",{className:""},"Ensure your webhook has been subscribed to event ",wp.element.createElement("span",{className:"font-semibold"},"order.created")))),wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mb-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time Order Status Sync ",wp.element.createElement(At,null)),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Syncronize your order statuses from Square to WooCommerce.")),wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(uu,{checked:!1,className:"".concat(n.orders.statusSync?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.orders.statusSync?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable real-time order status sync")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 "},wp.element.createElement("p",{className:""},"Ensure your webhook has been subscribed to event ",wp.element.createElement("span",{className:"font-semibold"},"order.fulfillment.updated")))),s?wp.element.createElement("div",null,"Shipping methods loading.."):wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Local Pickup Setup",wp.element.createElement(At,null)),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Configure the linkage between WooCommerce shipping methods and Square's local pickup orders. Select which WooCommerce shipping method corresponds to local pickups at your Square locations. Additionally, set preferences for the pickup time window and specify the default Square location for pickups.")),wp.element.createElement("div",{className:"blur-sm"},wp.element.createElement("div",null,wp.element.createElement("select",{id:"pickup",name:"pickup",value:n.orders.pickupMethod||"local_pickup",className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10"},wp.element.createElement("option",{value:"",disabled:!0},"Select your local pickup shipping method"),l.map((function(e){return wp.element.createElement("option",{key:e.id,value:e.id},e.title)})))),wp.element.createElement("div",{className:"mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Preparation Time"),wp.element.createElement("p",{className:"text-sm text-gray-500 mb-4"},"Specify the time required for order preparation before it can be available for pickup. Enter the time in minutes."),wp.element.createElement("input",{type:"number",min:"0",value:n.orders.preparationTime||60,className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2"}),wp.element.createElement("p",{className:"text-sm text-gray-500 mt-1"},'Time in minutes before a pickup order can be available after being placed. For example, enter "30" for a 30-minute preparation time.')),wp.element.createElement("div",{className:"mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Pickup Schedule"),wp.element.createElement("p",{className:"text-sm text-gray-500 mb-4"},"Define your pickup times for each day of the week. Enable pickup on specific days and set available time ranges."),wp.element.createElement("table",{className:"min-w-full"},wp.element.createElement("thead",null,wp.element.createElement("tr",null,wp.element.createElement("th",{className:"text-left"},"Day"),wp.element.createElement("th",{className:"text-left"},"Enable Pickup"),wp.element.createElement("th",{className:"text-left"},"From"),wp.element.createElement("th",{className:"text-left"},"To"))),wp.element.createElement("tbody",null,pm.map((function(e){var t,n,r,o,a;return wp.element.createElement("tr",{key:e},wp.element.createElement("td",null,e),wp.element.createElement("td",null,wp.element.createElement("input",{type:"checkbox",checked:(null===(t=y[e])||void 0===t?void 0:t.enabled)||!1})),wp.element.createElement("td",null,wp.element.createElement("input",{type:"time",value:(null===(n=y[e])||void 0===n?void 0:n.from)||"09:00",disabled:!(null!==(r=y[e])&&void 0!==r&&r.enabled),className:"ml-2"})),wp.element.createElement("td",null,wp.element.createElement("input",{type:"time",value:(null===(o=y[e])||void 0===o?void 0:o.to)||"17:00",disabled:!(null!==(a=y[e])&&void 0!==a&&a.enabled),className:"ml-2"})))})))))))))}},{path:"/settings/loyalty",element:function(){mn();var t=An(),n=t.settings,r=t.updateSettings,o=tm((0,e.useState)(!1),2),a=o[0],l=(o[1],tm((0,e.useState)(""),2)),i=l[0],c=(l[1],tm((0,e.useState)(n.loyalty.program||null),2)),s=c[0];return c[1],wp.element.createElement(Mc,null,wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 text-black"},wp.element.createElement(Ju,{settings:n,updateSettings:r}),a&&wp.element.createElement("div",{className:"flex gap-2 mt-4"},wp.element.createElement("svg",{className:"animate-spin h-5 w-5 text-sky-500",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},wp.element.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),wp.element.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})),wp.element.createElement("p",null,"Loading loyalty program")),i&&wp.element.createElement("p",{className:"text-sm text-red-500 mt-2"},i),s&&!a&&wp.element.createElement(em,{program:s}))))}}];const km=Sm,Nm=function(e){var t=e.children;return wp.element.createElement(sl,null,wp.element.createElement(In,null,wp.element.createElement(gc,null,t)))};var Om="persist:",Cm="persist/FLUSH",jm="persist/REHYDRATE",Pm="persist/PAUSE",Lm="persist/PERSIST",_m="persist/PURGE",Rm="persist/REGISTER";function Im(e){return Im="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Im(e)}function Am(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Tm(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fm(e){return JSON.stringify(e)}function Mm(e){return JSON.parse(e)}function Dm(e){}function Gm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gm(n,!0).forEach((function(t){Vm(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gm(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Vm(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wm(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function Bm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Hm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bm(n,!0).forEach((function(t){zm(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bm(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function zm(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Um={registry:[],bootstrapped:!1},$m=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Um,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case Rm:return Hm({},e,{registry:[].concat(Wm(e.registry),[t.key])});case jm:var n=e.registry.indexOf(t.key),r=Wm(e.registry);return r.splice(n,1),Hm({},e,{registry:r,bootstrapped:0===r.length});default:return e}},Zm=o(274);function Ym(e){return Ym="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ym(e)}function Km(){Km=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Ym(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Ym(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function Xm(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function Jm(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){Xm(a,r,o,l,i,"next",e)}function i(e){Xm(a,r,o,l,i,"throw",e)}l(void 0)}))}}function Qm(){return ep.apply(this,arguments)}function ep(){return(ep=Jm(Km().mark((function e(){var t;return Km().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Ut({path:"/sws/v1/customers/get-groups"});case 3:if(t=e.sent,console.log("API Response:",t),!(t&&t.square_groups&&t.wp_user_roles)){e.next=9;break}return e.abrupt("return",{groups:t.square_groups,roles:t.wp_user_roles,roleMappings:t.roleMappings||[]});case 9:throw new Error("Invalid API response format");case 10:e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(0),console.error("API Fetch Error:",e.t0),e.t0;case 16:case"end":return e.stop()}}),e,null,[[0,12]])})))).apply(this,arguments)}var tp=function(){var e=Jm(Km().mark((function e(){var t,n;return Km().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("Fetching Customer Groups and Roles"),t=F.loading("Retrieving Customer Groups and Roles"),e.prev=2,e.next=5,Qm();case 5:return n=e.sent,F.update(t,{render:"Groups and Roles Received",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.abrupt("return",{status:"success",data:n});case 10:return e.prev=10,e.t0=e.catch(2),F.update(t,{render:"Error fetching groups and roles: ".concat(e.t0),type:"error",isLoading:!1,closeOnClick:!0,autoClose:5e3}),console.error(e.t0),e.abrupt("return",{status:"error",error:e.t0});case 15:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(){return e.apply(this,arguments)}}(),np=function(){var e=Jm(Km().mark((function e(t){var n,r;return Km().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("Saving Role Mappings"),n=F.loading("Saving Role Mappings"),e.prev=2,e.next=5,Ut({path:"/sws/v1/customers/role-mappings",method:"POST",data:{roleMappings:t}});case 5:if(r=e.sent,console.log("Save Response:",r),!r||"success"!==r.status){e.next=12;break}return F.update(n,{render:"Role Mappings Saved",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.abrupt("return",{status:"success",roleMappings:r.roleMappings});case 12:throw new Error("Invalid API response format");case 13:e.next=20;break;case 15:return e.prev=15,e.t0=e.catch(2),F.update(n,{render:"Error saving role mappings: ".concat(e.t0.message||"Server error"),type:"error",isLoading:!1,closeOnClick:!0,autoClose:5e3}),console.error("Error saving role mappings:",e.t0),e.abrupt("return",{status:"error",error:e.t0.message||"Server error"});case 20:case"end":return e.stop()}}),e,null,[[2,15]])})));return function(_x){return e.apply(this,arguments)}}(),rp=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;return new Promise((function(n,r){var o=function(){var a=Jm(Km().mark((function a(l){var i,c;return Km().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,i=null,e)try{localStorage.removeItem("customersData")}catch(e){console.warn("Failed to remove data from local storage:",e)}else{try{i=localStorage.getItem("customersData")}catch(e){console.warn("Failed to retrieve data from local storage:",e)}i&&setTimeout((function(){var e=JSON.parse(i);return n({status:"success",data:e})}),100)}return a.next=5,Ut({path:"/sws/v1/customers".concat(l&&e?"?force=true":"")});case 5:if(c=a.sent,console.log(c),c.loading)l&&F.info("Fetching data, please wait...",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!1}),setTimeout((function(){return o(!1)}),t);else if(0===c.data.length)F.info("No data available",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),n({status:"success",data:[]});else{try{localStorage.setItem("customersData",JSON.stringify(c.data))}catch(e){console.warn("Failed to store data in local storage:",e)}F.success("Customers Retrieved",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),n({status:"success",data:c.data})}a.next=14;break;case 10:a.prev=10,a.t0=a.catch(0),F.error("Error fetching customers: ".concat(a.t0.message||"Server error"),{autoClose:5e3,closeOnClick:!0}),r({status:"error",error:a.t0.message||"Server error"});case 14:case"end":return a.stop()}}),a,null,[[0,10]])})));return function(e){return a.apply(this,arguments)}}();o(!0)}))};function op(e){return op="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},op(e)}function ap(){ap=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==op(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(op(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function lp(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function ip(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){lp(a,r,o,l,i,"next",e)}function i(e){lp(a,r,o,l,i,"throw",e)}l(void 0)}))}}var cp=wo("customerGroupsAndRoles/fetchIfNeeded",ip(ap().mark((function e(){var t,n,r,o,a,l,i,c,s=arguments;return ap().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]&&s[0],r=(n=s.length>1?s[1]:void 0).getState,o=n.rejectWithValue,a=r(),l=a.customerGroupsAndRoles,i=0,c=function(){var e=ip(ap().mark((function e(){var n;return ap().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!t&&(l.data.groups.length||l.data.roles.length)){e.next=12;break}return e.next=4,tp();case 4:if("success"!==(n=e.sent).status){e.next=9;break}return e.abrupt("return",n.data);case 9:throw new Error(n.error);case 10:e.next=13;break;case 12:return e.abrupt("return",l.data);case 13:e.next=27;break;case 15:if(e.prev=15,e.t0=e.catch(0),!(i<1)){e.next=25;break}return i++,console.warn("Retrying fetch groups and roles (".concat(i,"/").concat(1,")...")),e.next=22,c();case 22:return e.abrupt("return",e.sent);case 25:return console.error("Max retries reached. Unable to fetch groups and roles."),e.abrupt("return",o(e.t0.message));case 27:case"end":return e.stop()}}),e,null,[[0,15]])})));return function(){return e.apply(this,arguments)}}(),e.next=8,c();case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)})))),sp=wo("customerGroupsAndRoles/saveMappings",function(){var e=ip(ap().mark((function e(t,n){var r,o,a,l;return ap().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.rejectWithValue,e.prev=1,o=Object.values(t).map((function(e){return e.priority})),a=new Set(o),o.length===a.size){e.next=6;break}throw new Error("Each mapping must have a unique priority.");case 6:return e.next=8,np(t);case 8:if("success"!==(l=e.sent).status){e.next=13;break}return e.abrupt("return",{roleMappings:l.roleMappings});case 13:throw new Error(l.error);case 14:e.next=19;break;case 16:return e.prev=16,e.t0=e.catch(1),e.abrupt("return",r(e.t0.message));case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(_x,t){return e.apply(this,arguments)}}());const up=fo({name:"customerGroupsAndRoles",initialState:{data:{groups:[],roles:{},roleMappings:{}},loading:!1,error:null},reducers:{},extraReducers:function(e){e.addCase(cp.pending,(function(e){e.loading=!0})).addCase(cp.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase(cp.rejected,(function(e,t){e.loading=!1,e.data={groups:[],roles:{},roleMappings:{}},e.error=t.payload})).addCase(sp.pending,(function(e){e.loading=!0})).addCase(sp.fulfilled,(function(e,t){e.loading=!1,e.data.roleMappings=t.payload.roleMappings,e.error=null})).addCase(sp.rejected,(function(e,t){e.loading=!1,e.error=t.payload}))}}).reducer;function mp(e){return mp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mp(e)}function pp(){pp=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==mp(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(mp(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function fp(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function dp(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){fp(a,r,o,l,i,"next",e)}function i(e){fp(a,r,o,l,i,"throw",e)}l(void 0)}))}}var hp,gp,yp,vp,bp,xp,Ep,Sp,kp,Np,Op=wo("customers/fetchIfNeeded",dp(pp().mark((function e(){var t,n,r,o,a,l,i,c,s=arguments;return pp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]&&s[0],r=(n=s.length>1?s[1]:void 0).getState,o=n.rejectWithValue,a=r(),l=a.customers,!t&&null!==l.data){e.next=24;break}return e.prev=4,e.next=7,rp(t);case 7:if("success"!==(i=e.sent).status){e.next=12;break}return e.abrupt("return",i.data);case 12:if("loading"!==i.status){e.next=16;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 16:throw new Error(i.error);case 17:e.next=22;break;case 19:return e.prev=19,e.t0=e.catch(4),e.abrupt("return",o(e.t0.message));case 22:e.next=44;break;case 24:if(!l.loading){e.next=43;break}return e.prev=25,e.next=28,rp(!1);case 28:if("success"!==(c=e.sent).status){e.next=33;break}return e.abrupt("return",c.data);case 33:if("loading"!==c.status){e.next=37;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 37:throw new Error(c.error);case 38:e.next=43;break;case 40:return e.prev=40,e.t1=e.catch(25),e.abrupt("return",o(e.t1.message));case 43:return e.abrupt("return",l.data);case 44:case"end":return e.stop()}}),e,null,[[4,19],[25,40]])})))),Cp=Br({inventory:Xl,licence:jo,orders:Ui,customerGroupsAndRoles:up,customers:fo({name:"customers",initialState:{data:null,loading:!1,error:null,fetchAttempted:!1},reducers:{},extraReducers:function(e){e.addCase(Op.pending,(function(e){e.loading=!0,e.fetchAttempted=!0})).addCase(Op.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase(Op.rejected,(function(e,t){e.loading=!1,e.data=[],e.error=t.payload}))}}).reducer}),jp={key:"root",storage:Zm.A,whitelist:["inventory","customerGroupsAndRoles","customers"]},Pp=(gp=Cp,yp=void 0!==(hp=jp).version?hp.version:-1,vp=void 0===hp.stateReconciler?function(e,t,n,r){r.debug;var o=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Am(n,!0).forEach((function(t){Tm(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Am(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},n);return e&&"object"===Im(e)&&Object.keys(e).forEach((function(r){"_persist"!==r&&t[r]===n[r]&&(o[r]=e[r])})),o}:hp.stateReconciler,bp=hp.getStoredState||function(e){var t,n=e.transforms||[],r="".concat(void 0!==e.keyPrefix?e.keyPrefix:Om).concat(e.key),o=e.storage;return e.debug,t=!1===e.deserialize?function(e){return e}:"function"==typeof e.deserialize?e.deserialize:Mm,o.getItem(r).then((function(e){if(e)try{var r={},o=t(e);return Object.keys(o).forEach((function(e){r[e]=n.reduceRight((function(t,n){return n.out(t,e,o)}),t(o[e]))})),r}catch(e){throw e}}))},xp=void 0!==hp.timeout?hp.timeout:5e3,Ep=null,Sp=!1,kp=!0,Np=function(e){return e._persist.rehydrated&&Ep&&!kp&&Ep.update(e),e},function(e,t){var n=e||{},r=n._persist,o=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(n,["_persist"]);if(t.type===Lm){var a=!1,l=function(e,n){a||(t.rehydrate(hp.key,e,n),a=!0)};if(xp&&setTimeout((function(){!a&&l(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(hp.key,'"')))}),xp),kp=!1,Ep||(Ep=function(e){var t,n=e.blacklist||null,r=e.whitelist||null,o=e.transforms||[],a=e.throttle||0,l="".concat(void 0!==e.keyPrefix?e.keyPrefix:Om).concat(e.key),i=e.storage;t=!1===e.serialize?function(e){return e}:"function"==typeof e.serialize?e.serialize:Fm;var c=e.writeFailHandler||null,s={},u={},m=[],p=null,f=null;function d(){if(0===m.length)return p&&clearInterval(p),void(p=null);var e=m.shift(),n=o.reduce((function(t,n){return n.in(t,e,s)}),s[e]);if(void 0!==n)try{u[e]=t(n)}catch(e){console.error("redux-persist/createPersistoid: error serializing state",e)}else delete u[e];0===m.length&&(Object.keys(u).forEach((function(e){void 0===s[e]&&delete u[e]})),f=i.setItem(l,t(u)).catch(g))}function h(e){return!(r&&-1===r.indexOf(e)&&"_persist"!==e||n&&-1!==n.indexOf(e))}function g(e){c&&c(e)}return{update:function(e){Object.keys(e).forEach((function(t){h(t)&&s[t]!==e[t]&&-1===m.indexOf(t)&&m.push(t)})),Object.keys(s).forEach((function(t){void 0===e[t]&&h(t)&&-1===m.indexOf(t)&&void 0!==s[t]&&m.push(t)})),null===p&&(p=setInterval(d,a)),s=e},flush:function(){for(;0!==m.length;)d();return f||Promise.resolve()}}}(hp)),r)return qm({},gp(o,t),{_persist:r});if("function"!=typeof t.rehydrate||"function"!=typeof t.register)throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return t.register(hp.key),bp(hp).then((function(e){var t=hp.migrate||function(e,t){return Promise.resolve(e)};t(e,yp).then((function(e){l(e)}),(function(e){l(void 0,e)}))}),(function(e){l(void 0,e)})),qm({},gp(o,t),{_persist:{version:yp,rehydrated:!1}})}if(t.type===_m)return Sp=!0,t.result(function(e){var t=e.storage,n="".concat(void 0!==e.keyPrefix?e.keyPrefix:Om).concat(e.key);return t.removeItem(n,Dm)}(hp)),qm({},gp(o,t),{_persist:r});if(t.type===Cm)return t.result(Ep&&Ep.flush()),qm({},gp(o,t),{_persist:r});if(t.type===Pm)kp=!0;else if(t.type===jm){if(Sp)return qm({},o,{_persist:qm({},r,{rehydrated:!0})});if(t.key===hp.key){var i=gp(o,t),c=t.payload,s=qm({},!1!==vp&&void 0!==c?vp(c,e,i,hp):i,{_persist:qm({},r,{rehydrated:!0})});return Np(s)}}if(!r)return gp(e,t);var u=gp(o,t);return u===o?e:Np(qm({},u,{_persist:r}))}),Lp=function(e){var t,n=function(e){return function(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,r=(e.immutableCheck,e.serializableCheck,e.actionCreatorCheck,new so);return n&&("boolean"!=typeof n?r.push(Zr.withExtraArgument(n.extraArgument)):r.push(Zr)),r}(e)},r=e||{},o=r.reducer,a=void 0===o?void 0:o,l=r.middleware,i=void 0===l?n():l,c=r.devTools,s=void 0===c||c,u=r.preloadedState,m=void 0===u?void 0:u,p=r.enhancers,f=void 0===p?void 0:p;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=Br(a)}var d=i;"function"==typeof d&&(d=d(n));var h=zr.apply(void 0,d),g=Hr;s&&(g=io(ao({trace:!1},"object"==typeof s&&s)));var y=new uo(h),v=y;return Array.isArray(f)?v=Xr([h],f):"function"==typeof f&&(v=f(y)),Wr(t,m,g.apply(void 0,v))}({reducer:Pp,middleware:function(e){return e({serializableCheck:!1})}}),_p=function(e,t,n){var r=!1,o=Wr($m,Um,void 0),a=function(e){o.dispatch({type:Rm,key:e})},l=function(t,n,a){var l={type:jm,payload:n,err:a,key:t};e.dispatch(l),o.dispatch(l),r&&i.getState().bootstrapped&&(r(),r=!1)},i=Hm({},o,{purge:function(){var t=[];return e.dispatch({type:_m,result:function(e){t.push(e)}}),Promise.all(t)},flush:function(){var t=[];return e.dispatch({type:Cm,result:function(e){t.push(e)}}),Promise.all(t)},pause:function(){e.dispatch({type:Pm})},persist:function(){e.dispatch({type:Lm,register:a,rehydrate:l})}});return i.persist(),i}(Lp),Rp=document.getElementById("square-woo-sync");null!=Rp&&(0,e.createRoot)(Rp).render(wp.element.createElement(React.Fragment,null,wp.element.createElement(O,{className:"toast-position",position:"top-right",autoClose:500,hideProgressBar:!0,newestOnTop:!1,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"}),wp.element.createElement((function({store:e,context:n,children:r,serverState:o,stabilityCheck:a="once",noopCheck:l="once"}){const i=t.useMemo((()=>{const t=function(e,t){let n,r=J,o=0,a=!1;function l(){s.onStateChange&&s.onStateChange()}function i(){o++,n||(n=t?t.addNestedSub(l):e.subscribe(l),r=function(){const e=V();let t=null,n=null;return{clear(){t=null,n=null},notify(){e((()=>{let e=t;for(;e;)e.callback(),e=e.next}))},get(){let e=[],n=t;for(;n;)e.push(n),n=n.next;return e},subscribe(e){let r=!0,o=n={callback:e,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){r&&null!==t&&(r=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}())}function c(){o--,n&&0===o&&(n(),n=void 0,r.clear(),r=J)}const s={addNestedSub:function(e){i();const t=r.subscribe(e);let n=!1;return()=>{n||(n=!0,t(),c())}},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:l,isSubscribed:function(){return a},trySubscribe:function(){a||(a=!0,i())},tryUnsubscribe:function(){a&&(a=!1,c())},getListeners:()=>r};return s}(e);return{store:e,subscription:t,getServerState:o?()=>o:void 0,stabilityCheck:a,noopCheck:l}}),[e,o,a,l]),c=t.useMemo((()=>e.getState()),[e]);Q((()=>{const{subscription:t}=i;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),c!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[i,c]);const s=n||z;return t.createElement(s.Provider,{value:i},r)}),{store:Lp},wp.element.createElement(fe,{loading:null,persistor:_p},wp.element.createElement((function(){return wp.element.createElement(kt,null,wp.element.createElement(It,null,wp.element.createElement(Nm,null,wp.element.createElement(gt,null,km.map((function(e,t){return wp.element.createElement(dt,{key:t,path:e.path,element:wp.element.createElement(e.element,null)})}))))))}),null)))))})()})();1 (()=>{var e,t,n={42:(e,t,n)=>{"use strict";var r=n(664),o={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,a,l,i,c,s,u=!1;t||(t={}),n=t.debug||!1;try{if(l=r(),i=document.createRange(),c=document.getSelection(),(s=document.createElement("span")).textContent=e,s.ariaHidden="true",s.style.all="unset",s.style.position="fixed",s.style.top=0,s.style.clip="rect(0, 0, 0, 0)",s.style.whiteSpace="pre",s.style.webkitUserSelect="text",s.style.MozUserSelect="text",s.style.msUserSelect="text",s.style.userSelect="text",s.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var a=o[t.format]||o.default;window.clipboardData.setData(a,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(s),i.selectNodeContents(s),c.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");u=!0}catch(r){n&&console.error("unable to copy using execCommand: ",r),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),u=!0}catch(r){n&&console.error("unable to copy using clipboardData: ",r),n&&console.error("falling back to prompt"),a=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(a,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(i):c.removeAllRanges()),s&&document.body.removeChild(s),l()}return u}},35:(e,t,n)=>{"use strict";var r=n(959),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},l={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},i={};function c(e){return r.isMemo(e)?l:i[e.$$typeof]||o}i[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},i[r.Memo]=l;var s=Object.defineProperty,u=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,d=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(d){var o=f(n);o&&o!==d&&e(t,o,r)}var l=u(n);m&&(l=l.concat(m(n)));for(var i=c(t),h=c(n),g=0;g<l.length;++g){var y=l[g];if(!(a[y]||r&&r[y]||h&&h[y]||i&&i[y])){var v=p(n,y);try{s(t,y,v)}catch(e){}}}}return t}},889:(e,t,n)=>{var r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,l=/^0o[0-7]+$/i,i=parseInt,c="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,s="object"==typeof self&&self&&self.Object===Object&&self,u=c||s||Function("return this")(),m=Object.prototype.toString,p=Math.max,f=Math.min,d=function(){return u.Date.now()};function h(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==m.call(e)}(e))return NaN;if(h(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=h(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var n=a.test(e);return n||l.test(e)?i(e.slice(2),n?2:8):o.test(e)?NaN:+e}e.exports=function(e,t,n){var r,o,a,l,i,c,s=0,u=!1,m=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var n=r,a=o;return r=o=void 0,s=t,l=e.apply(a,n)}function w(e){var n=e-c;return void 0===c||n>=t||n<0||m&&e-s>=a}function b(){var e=d();if(w(e))return x(e);i=setTimeout(b,function(e){var n=t-(e-c);return m?f(n,a-(e-s)):n}(e))}function x(e){return i=void 0,y&&r?v(e):(r=o=void 0,l)}function E(){var e=d(),n=w(e);if(r=arguments,o=this,c=e,n){if(void 0===i)return function(e){return s=e,i=setTimeout(b,t),u?v(e):l}(c);if(m)return i=setTimeout(b,t),v(c)}return void 0===i&&(i=setTimeout(b,t)),l}return t=g(t)||0,h(n)&&(u=!!n.leading,a=(m="maxWait"in n)?p(g(n.maxWait)||0,t):a,y="trailing"in n?!!n.trailing:y),E.cancel=function(){void 0!==i&&clearTimeout(i),s=0,r=c=o=i=void 0},E.flush=function(){return void 0===i?l:x(d())},E}},843:(e,t)=>{"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,a=n?Symbol.for("react.fragment"):60107,l=n?Symbol.for("react.strict_mode"):60108,i=n?Symbol.for("react.profiler"):60114,c=n?Symbol.for("react.provider"):60109,s=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,m=n?Symbol.for("react.concurrent_mode"):60111,p=n?Symbol.for("react.forward_ref"):60112,f=n?Symbol.for("react.suspense"):60113,d=n?Symbol.for("react.suspense_list"):60120,h=n?Symbol.for("react.memo"):60115,g=n?Symbol.for("react.lazy"):60116,y=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,w=n?Symbol.for("react.responder"):60118,b=n?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case m:case a:case i:case l:case f:return e;default:switch(e=e&&e.$$typeof){case s:case p:case g:case h:case c:return e;default:return t}}case o:return t}}}function E(e){return x(e)===m}t.AsyncMode=u,t.ConcurrentMode=m,t.ContextConsumer=s,t.ContextProvider=c,t.Element=r,t.ForwardRef=p,t.Fragment=a,t.Lazy=g,t.Memo=h,t.Portal=o,t.Profiler=i,t.StrictMode=l,t.Suspense=f,t.isAsyncMode=function(e){return E(e)||x(e)===u},t.isConcurrentMode=E,t.isContextConsumer=function(e){return x(e)===s},t.isContextProvider=function(e){return x(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return x(e)===p},t.isFragment=function(e){return x(e)===a},t.isLazy=function(e){return x(e)===g},t.isMemo=function(e){return x(e)===h},t.isPortal=function(e){return x(e)===o},t.isProfiler=function(e){return x(e)===i},t.isStrictMode=function(e){return x(e)===l},t.isSuspense=function(e){return x(e)===f},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===m||e===i||e===l||e===f||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===h||e.$$typeof===c||e.$$typeof===s||e.$$typeof===p||e.$$typeof===v||e.$$typeof===w||e.$$typeof===b||e.$$typeof===y)},t.typeOf=x},959:(e,t,n)=>{"use strict";e.exports=n(843)},604:(e,t)=>{"use strict";Symbol.for("react.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.context"),Symbol.for("react.server_context"),Symbol.for("react.forward_ref"),Symbol.for("react.suspense"),Symbol.for("react.suspense_list"),Symbol.for("react.memo"),Symbol.for("react.lazy"),Symbol.for("react.offscreen");Symbol.for("react.module.reference")},176:(e,t,n)=>{"use strict";n(604)},670:(e,t,n)=>{"use strict";t.__esModule=!0,t.default=function(e){var t=(0,o.default)(e);return{getItem:function(e){return new Promise((function(n,r){n(t.getItem(e))}))},setItem:function(e,n){return new Promise((function(r,o){r(t.setItem(e,n))}))},removeItem:function(e){return new Promise((function(n,r){n(t.removeItem(e))}))}}};var r,o=(r=n(532))&&r.__esModule?r:{default:r}},532:(e,t)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(){}t.__esModule=!0,t.default=function(e){var t="".concat(e,"Storage");return function(e){if("object"!==("undefined"==typeof self?"undefined":n(self))||!(e in self))return!1;try{var t=self[e],r="redux-persist ".concat(e," test");t.setItem(r,"test"),t.getItem(r),t.removeItem(r)}catch(e){return!1}return!0}(t)?self[t]:o};var o={getItem:r,setItem:r,removeItem:r}},181:(e,t,n)=>{"use strict";var r;t.A=void 0;var o=(0,((r=n(670))&&r.__esModule?r:{default:r}).default)("session");t.A=o},664:e=>{e.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}}},859:(e,t,n)=>{"use strict";var r=n(609),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,l=r.useEffect,i=r.useLayoutEffect,c=r.useDebugValue;function s(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),o=r[0].inst,u=r[1];return i((function(){o.value=n,o.getSnapshot=t,s(o)&&u({inst:o})}),[e,n,t]),l((function(){return s(o)&&u({inst:o}),e((function(){s(o)&&u({inst:o})}))}),[e]),c(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},632:(e,t,n)=>{"use strict";var r=n(609),o=n(524),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},l=o.useSyncExternalStore,i=r.useRef,c=r.useEffect,s=r.useMemo,u=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var m=i(null);if(null===m.current){var p={hasValue:!1,value:null};m.current=p}else p=m.current;m=s((function(){function e(e){if(!c){if(c=!0,l=e,e=r(e),void 0!==o&&p.hasValue){var t=p.value;if(o(t,e))return i=t}return i=e}if(t=i,a(l,e))return t;var n=r(e);return void 0!==o&&o(t,n)?t:(l=e,i=n)}var l,i,c=!1,s=void 0===n?null:n;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]}),[t,n,r,o]);var f=l(e,m[0],m[1]);return c((function(){p.hasValue=!0,p.value=f}),[f]),u(f),f}},524:(e,t,n)=>{"use strict";e.exports=n(859)},822:(e,t,n)=>{"use strict";e.exports=n(632)},609:e=>{"use strict";e.exports=window.React}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var a=r[e]={exports:{}};return n[e](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var a=Object.create(null);o.r(a);var l={};e=e||[null,t({}),t([]),t(t)];for(var i=2&r&&n;"object"==typeof i&&!~e.indexOf(i);i=t(i))Object.getOwnPropertyNames(i).forEach((e=>l[e]=()=>n[e]));return l.default=()=>n,o.d(a,l),a},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=n[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{"use strict";const e=window.wp.element;var t=o(609),n=o.t(t,2),r=o.n(t);function a(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=a(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}const l=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=a(e))&&(r&&(r+=" "),r+=t);return r},i=e=>"number"==typeof e&&!isNaN(e),c=e=>"string"==typeof e,s=e=>"function"==typeof e,u=e=>c(e)||s(e)?e:null,m=e=>(0,t.isValidElement)(e)||c(e)||s(e)||i(e);function p(e){let{enter:n,exit:r,appendPosition:o=!1,collapse:a=!0,collapseDuration:l=300}=e;return function(e){let{children:i,position:c,preventExitTransition:s,done:u,nodeRef:m,isIn:p}=e;const f=o?`${n}--${c}`:n,d=o?`${r}--${c}`:r,h=(0,t.useRef)(0);return(0,t.useLayoutEffect)((()=>{const e=m.current,t=f.split(" "),n=r=>{r.target===m.current&&(e.dispatchEvent(new Event("d")),e.removeEventListener("animationend",n),e.removeEventListener("animationcancel",n),0===h.current&&"animationcancel"!==r.type&&e.classList.remove(...t))};e.classList.add(...t),e.addEventListener("animationend",n),e.addEventListener("animationcancel",n)}),[]),(0,t.useEffect)((()=>{const e=m.current,t=()=>{e.removeEventListener("animationend",t),a?function(e,t,n){void 0===n&&(n=300);const{scrollHeight:r,style:o}=e;requestAnimationFrame((()=>{o.minHeight="initial",o.height=r+"px",o.transition=`all ${n}ms`,requestAnimationFrame((()=>{o.height="0",o.padding="0",o.margin="0",setTimeout(t,n)}))}))}(e,u,l):u()};p||(s?t():(h.current=1,e.className+=` ${d}`,e.addEventListener("animationend",t)))}),[p]),t.createElement(t.Fragment,null,i)}}function f(e,t){return null!=e?{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}:{}}const d={list:new Map,emitQueue:new Map,on(e,t){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(t),this},off(e,t){if(t){const n=this.list.get(e).filter((e=>e!==t));return this.list.set(e,n),this}return this.list.delete(e),this},cancelEmit(e){const t=this.emitQueue.get(e);return t&&(t.forEach(clearTimeout),this.emitQueue.delete(e)),this},emit(e){this.list.has(e)&&this.list.get(e).forEach((t=>{const n=setTimeout((()=>{t(...[].slice.call(arguments,1))}),0);this.emitQueue.has(e)||this.emitQueue.set(e,[]),this.emitQueue.get(e).push(n)}))}},h=e=>{let{theme:n,type:r,...o}=e;return t.createElement("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"colored"===n?"currentColor":`var(--toastify-icon-color-${r})`,...o})},g={info:function(e){return t.createElement(h,{...e},t.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))},warning:function(e){return t.createElement(h,{...e},t.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))},success:function(e){return t.createElement(h,{...e},t.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))},error:function(e){return t.createElement(h,{...e},t.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))},spinner:function(){return t.createElement("div",{className:"Toastify__spinner"})}};function y(e){const[,n]=(0,t.useReducer)((e=>e+1),0),[r,o]=(0,t.useState)([]),a=(0,t.useRef)(null),l=(0,t.useRef)(new Map).current,p=e=>-1!==r.indexOf(e),h=(0,t.useRef)({toastKey:1,displayedToast:0,count:0,queue:[],props:e,containerId:null,isToastActive:p,getToast:e=>l.get(e)}).current;function y(e){let{containerId:t}=e;const{limit:n}=h.props;!n||t&&h.containerId!==t||(h.count-=h.queue.length,h.queue=[])}function v(e){o((t=>null==e?[]:t.filter((t=>t!==e))))}function w(){const{toastContent:e,toastProps:t,staleId:n}=h.queue.shift();x(e,t,n)}function b(e,r){let{delay:o,staleId:p,...y}=r;if(!m(e)||function(e){return!a.current||h.props.enableMultiContainer&&e.containerId!==h.props.containerId||l.has(e.toastId)&&null==e.updateId}(y))return;const{toastId:b,updateId:E,data:S}=y,{props:k}=h,N=()=>v(b),O=null==E;O&&h.count++;const C={...k,style:k.toastStyle,key:h.toastKey++,...Object.fromEntries(Object.entries(y).filter((e=>{let[t,n]=e;return null!=n}))),toastId:b,updateId:E,data:S,closeToast:N,isIn:!1,className:u(y.className||k.toastClassName),bodyClassName:u(y.bodyClassName||k.bodyClassName),progressClassName:u(y.progressClassName||k.progressClassName),autoClose:!y.isLoading&&(j=y.autoClose,P=k.autoClose,!1===j||i(j)&&j>0?j:P),deleteToast(){const e=f(l.get(b),"removed");l.delete(b),d.emit(4,e);const t=h.queue.length;if(h.count=null==b?h.count-h.displayedToast:h.count-1,h.count<0&&(h.count=0),t>0){const e=null==b?h.props.limit:1;if(1===t||1===e)h.displayedToast++,w();else{const n=e>t?t:e;h.displayedToast=n;for(let e=0;e<n;e++)w()}}else n()}};var j,P;C.iconOut=function(e){let{theme:n,type:r,isLoading:o,icon:a}=e,l=null;const u={theme:n,type:r};return!1===a||(s(a)?l=a(u):(0,t.isValidElement)(a)?l=(0,t.cloneElement)(a,u):c(a)||i(a)?l=a:o?l=g.spinner():(e=>e in g)(r)&&(l=g[r](u))),l}(C),s(y.onOpen)&&(C.onOpen=y.onOpen),s(y.onClose)&&(C.onClose=y.onClose),C.closeButton=k.closeButton,!1===y.closeButton||m(y.closeButton)?C.closeButton=y.closeButton:!0===y.closeButton&&(C.closeButton=!m(k.closeButton)||k.closeButton);let L=e;(0,t.isValidElement)(e)&&!c(e.type)?L=(0,t.cloneElement)(e,{closeToast:N,toastProps:C,data:S}):s(e)&&(L=e({closeToast:N,toastProps:C,data:S})),k.limit&&k.limit>0&&h.count>k.limit&&O?h.queue.push({toastContent:L,toastProps:C,staleId:p}):i(o)?setTimeout((()=>{x(L,C,p)}),o):x(L,C,p)}function x(e,t,n){const{toastId:r}=t;n&&l.delete(n);const a={content:e,props:t};l.set(r,a),o((e=>[...e,r].filter((e=>e!==n)))),d.emit(4,f(a,null==a.props.updateId?"added":"updated"))}return(0,t.useEffect)((()=>(h.containerId=e.containerId,d.cancelEmit(3).on(0,b).on(1,(e=>a.current&&v(e))).on(5,y).emit(2,h),()=>{l.clear(),d.emit(3,h)})),[]),(0,t.useEffect)((()=>{h.props=e,h.isToastActive=p,h.displayedToast=r.length})),{getToastToRender:function(t){const n=new Map,r=Array.from(l.values());return e.newestOnTop&&r.reverse(),r.forEach((e=>{const{position:t}=e.props;n.has(t)||n.set(t,[]),n.get(t).push(e)})),Array.from(n,(e=>t(e[0],e[1])))},containerRef:a,isToastActive:p}}function v(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientX:e.clientX}function w(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientY:e.clientY}function b(e){const[n,r]=(0,t.useState)(!1),[o,a]=(0,t.useState)(!1),l=(0,t.useRef)(null),i=(0,t.useRef)({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,c=(0,t.useRef)(e),{autoClose:u,pauseOnHover:m,closeToast:p,onClick:f,closeOnClick:d}=e;function h(t){if(e.draggable){"touchstart"===t.nativeEvent.type&&t.nativeEvent.preventDefault(),i.didMove=!1,document.addEventListener("mousemove",x),document.addEventListener("mouseup",E),document.addEventListener("touchmove",x),document.addEventListener("touchend",E);const n=l.current;i.canCloseOnClick=!0,i.canDrag=!0,i.boundingRect=n.getBoundingClientRect(),n.style.transition="",i.x=v(t.nativeEvent),i.y=w(t.nativeEvent),"x"===e.draggableDirection?(i.start=i.x,i.removalDistance=n.offsetWidth*(e.draggablePercent/100)):(i.start=i.y,i.removalDistance=n.offsetHeight*(80===e.draggablePercent?1.5*e.draggablePercent:e.draggablePercent/100))}}function g(t){if(i.boundingRect){const{top:n,bottom:r,left:o,right:a}=i.boundingRect;"touchend"!==t.nativeEvent.type&&e.pauseOnHover&&i.x>=o&&i.x<=a&&i.y>=n&&i.y<=r?b():y()}}function y(){r(!0)}function b(){r(!1)}function x(t){const r=l.current;i.canDrag&&r&&(i.didMove=!0,n&&b(),i.x=v(t),i.y=w(t),i.delta="x"===e.draggableDirection?i.x-i.start:i.y-i.start,i.start!==i.x&&(i.canCloseOnClick=!1),r.style.transform=`translate${e.draggableDirection}(${i.delta}px)`,r.style.opacity=""+(1-Math.abs(i.delta/i.removalDistance)))}function E(){document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",E),document.removeEventListener("touchmove",x),document.removeEventListener("touchend",E);const t=l.current;if(i.canDrag&&i.didMove&&t){if(i.canDrag=!1,Math.abs(i.delta)>i.removalDistance)return a(!0),void e.closeToast();t.style.transition="transform 0.2s, opacity 0.2s",t.style.transform=`translate${e.draggableDirection}(0)`,t.style.opacity="1"}}(0,t.useEffect)((()=>{c.current=e})),(0,t.useEffect)((()=>(l.current&&l.current.addEventListener("d",y,{once:!0}),s(e.onOpen)&&e.onOpen((0,t.isValidElement)(e.children)&&e.children.props),()=>{const e=c.current;s(e.onClose)&&e.onClose((0,t.isValidElement)(e.children)&&e.children.props)})),[]),(0,t.useEffect)((()=>(e.pauseOnFocusLoss&&(document.hasFocus()||b(),window.addEventListener("focus",y),window.addEventListener("blur",b)),()=>{e.pauseOnFocusLoss&&(window.removeEventListener("focus",y),window.removeEventListener("blur",b))})),[e.pauseOnFocusLoss]);const S={onMouseDown:h,onTouchStart:h,onMouseUp:g,onTouchEnd:g};return u&&m&&(S.onMouseEnter=b,S.onMouseLeave=y),d&&(S.onClick=e=>{f&&f(e),i.canCloseOnClick&&p()}),{playToast:y,pauseToast:b,isRunning:n,preventExitTransition:o,toastRef:l,eventHandlers:S}}function x(e){let{closeToast:n,theme:r,ariaLabel:o="close"}=e;return t.createElement("button",{className:`Toastify__close-button Toastify__close-button--${r}`,type:"button",onClick:e=>{e.stopPropagation(),n(e)},"aria-label":o},t.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},t.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function E(e){let{delay:n,isRunning:r,closeToast:o,type:a="default",hide:i,className:c,style:u,controlledProgress:m,progress:p,rtl:f,isIn:d,theme:h}=e;const g=i||m&&0===p,y={...u,animationDuration:`${n}ms`,animationPlayState:r?"running":"paused",opacity:g?0:1};m&&(y.transform=`scaleX(${p})`);const v=l("Toastify__progress-bar",m?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated",`Toastify__progress-bar-theme--${h}`,`Toastify__progress-bar--${a}`,{"Toastify__progress-bar--rtl":f}),w=s(c)?c({rtl:f,type:a,defaultClassName:v}):l(v,c);return t.createElement("div",{role:"progressbar","aria-hidden":g?"true":"false","aria-label":"notification timer",className:w,style:y,[m&&p>=1?"onTransitionEnd":"onAnimationEnd"]:m&&p<1?null:()=>{d&&o()}})}const S=e=>{const{isRunning:n,preventExitTransition:r,toastRef:o,eventHandlers:a}=b(e),{closeButton:i,children:c,autoClose:u,onClick:m,type:p,hideProgressBar:f,closeToast:d,transition:h,position:g,className:y,style:v,bodyClassName:w,bodyStyle:S,progressClassName:k,progressStyle:N,updateId:O,role:C,progress:j,rtl:P,toastId:L,deleteToast:_,isIn:R,isLoading:I,iconOut:A,closeOnClick:T,theme:F}=e,M=l("Toastify__toast",`Toastify__toast-theme--${F}`,`Toastify__toast--${p}`,{"Toastify__toast--rtl":P},{"Toastify__toast--close-on-click":T}),D=s(y)?y({rtl:P,position:g,type:p,defaultClassName:M}):l(M,y),G=!!j||!u,q={closeToast:d,type:p,theme:F};let V=null;return!1===i||(V=s(i)?i(q):(0,t.isValidElement)(i)?(0,t.cloneElement)(i,q):x(q)),t.createElement(h,{isIn:R,done:_,position:g,preventExitTransition:r,nodeRef:o},t.createElement("div",{id:L,onClick:m,className:D,...a,style:v,ref:o},t.createElement("div",{...R&&{role:C},className:s(w)?w({type:p}):l("Toastify__toast-body",w),style:S},null!=A&&t.createElement("div",{className:l("Toastify__toast-icon",{"Toastify--animate-icon Toastify__zoom-enter":!I})},A),t.createElement("div",null,c)),V,t.createElement(E,{...O&&!G?{key:`pb-${O}`}:{},rtl:P,theme:F,delay:u,isRunning:n,isIn:R,closeToast:d,hide:f,type:p,style:N,className:k,controlledProgress:G,progress:j||0})))},k=function(e,t){return void 0===t&&(t=!1),{enter:`Toastify--animate Toastify__${e}-enter`,exit:`Toastify--animate Toastify__${e}-exit`,appendPosition:t}},N=p(k("bounce",!0)),O=(p(k("slide",!0)),p(k("zoom")),p(k("flip")),(0,t.forwardRef)(((e,n)=>{const{getToastToRender:r,containerRef:o,isToastActive:a}=y(e),{className:i,style:c,rtl:m,containerId:p}=e;function f(e){const t=l("Toastify__toast-container",`Toastify__toast-container--${e}`,{"Toastify__toast-container--rtl":m});return s(i)?i({position:e,rtl:m,defaultClassName:t}):l(t,u(i))}return(0,t.useEffect)((()=>{n&&(n.current=o.current)}),[]),t.createElement("div",{ref:o,className:"Toastify",id:p},r(((e,n)=>{const r=n.length?{...c}:{...c,pointerEvents:"none"};return t.createElement("div",{className:f(e),style:r,key:`container-${e}`},n.map(((e,r)=>{let{content:o,props:l}=e;return t.createElement(S,{...l,isIn:a(l.toastId),style:{...l.style,"--nth":r+1,"--len":n.length},key:`toast-${l.key}`},o)})))})))})));O.displayName="ToastContainer",O.defaultProps={position:"top-right",transition:N,autoClose:5e3,closeButton:x,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};let C,j=new Map,P=[],L=1;function _(){return""+L++}function R(e){return e&&(c(e.toastId)||i(e.toastId))?e.toastId:_()}function I(e,t){return j.size>0?d.emit(0,e,t):P.push({content:e,options:t}),t.toastId}function A(e,t){return{...t,type:t&&t.type||e,toastId:R(t)}}function T(e){return(t,n)=>I(t,A(e,n))}function F(e,t){return I(e,A("default",t))}F.loading=(e,t)=>I(e,A("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...t})),F.promise=function(e,t,n){let r,{pending:o,error:a,success:l}=t;o&&(r=c(o)?F.loading(o,n):F.loading(o.render,{...n,...o}));const i={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},u=(e,t,o)=>{if(null==t)return void F.dismiss(r);const a={type:e,...i,...n,data:o},l=c(t)?{render:t}:t;return r?F.update(r,{...a,...l}):F(l.render,{...a,...l}),o},m=s(e)?e():e;return m.then((e=>u("success",l,e))).catch((e=>u("error",a,e))),m},F.success=T("success"),F.info=T("info"),F.error=T("error"),F.warning=T("warning"),F.warn=F.warning,F.dark=(e,t)=>I(e,A("default",{theme:"dark",...t})),F.dismiss=e=>{j.size>0?d.emit(1,e):P=P.filter((t=>null!=e&&t.options.toastId!==e))},F.clearWaitingQueue=function(e){return void 0===e&&(e={}),d.emit(5,e)},F.isActive=e=>{let t=!1;return j.forEach((n=>{n.isToastActive&&n.isToastActive(e)&&(t=!0)})),t},F.update=function(e,t){void 0===t&&(t={}),setTimeout((()=>{const n=function(e,t){let{containerId:n}=t;const r=j.get(n||C);return r&&r.getToast(e)}(e,t);if(n){const{props:r,content:o}=n,a={delay:100,...r,...t,toastId:t.toastId||e,updateId:_()};a.toastId!==e&&(a.staleId=e);const l=a.render||o;delete a.render,I(l,a)}}),0)},F.done=e=>{F.update(e,{progress:1})},F.onChange=e=>(d.on(4,e),()=>{d.off(4,e)}),F.POSITION={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},F.TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},d.on(2,(e=>{C=e.containerId||e,j.set(C,e),P.forEach((e=>{d.emit(0,e.content,e.options)})),P=[]})).on(3,(e=>{j.delete(e.containerId||e),0===j.size&&d.off(0).off(1).off(5)}));var M=o(524),D=o(822);const G=window.ReactDOM;let q=function(e){e()};const V=()=>q,W=Symbol.for("react-redux-context"),B="undefined"!=typeof globalThis?globalThis:{};function H(){var e;if(!t.createContext)return{};const n=null!=(e=B[W])?e:B[W]=new Map;let r=n.get(t.createContext);return r||(r=t.createContext(null),n.set(t.createContext,r)),r}const z=H();function U(e=z){return function(){return(0,t.useContext)(e)}}const $=U();let Z=()=>{throw new Error("uSES not initialized!")};const Y=(e,t)=>e===t;function K(e=z){const n=e===z?$:U(e);return function(e,r={}){const{equalityFn:o=Y,stabilityCheck:a,noopCheck:l}="function"==typeof r?{equalityFn:r}:r,{store:i,subscription:c,getServerState:s,stabilityCheck:u,noopCheck:m}=n(),p=((0,t.useRef)(!0),(0,t.useCallback)({[e.name]:t=>e(t)}[e.name],[e,u,a])),f=Z(c.addNestedSub,i.getState,s||i.getState,p,o);return(0,t.useDebugValue)(f),f}}const X=K();o(35),o(176);const J={notify(){},get:()=>[]};const Q="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;let ee=null;function te(e=z){const t=e===z?$:U(e);return function(){const{store:e}=t();return e}}const ne=te();function re(e=z){const t=e===z?ne:te(e);return function(){return t().dispatch}}const oe=re();var ae;function le(e){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},le(e)}function ie(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ce(e){return ce=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ce(e)}function se(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ue(e,t){return ue=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ue(e,t)}function me(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}(e=>{Z=e})(D.useSyncExternalStoreWithSelector),(e=>{ee=e})(M.useSyncExternalStore),ae=G.unstable_batchedUpdates,q=ae;var pe,fe=function(e){function t(){var e,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return n=function(e,t){return!t||"object"!==le(t)&&"function"!=typeof t?se(e):t}(this,(e=ce(t)).call.apply(e,[this].concat(o))),me(se(n),"state",{bootstrapped:!1}),me(se(n),"_unsubscribe",void 0),me(se(n),"handlePersistorState",(function(){n.props.persistor.getState().bootstrapped&&(n.props.onBeforeLift?Promise.resolve(n.props.onBeforeLift()).finally((function(){return n.setState({bootstrapped:!0})})):n.setState({bootstrapped:!0}),n._unsubscribe&&n._unsubscribe())})),n}var n,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ue(e,t)}(t,e),n=t,(r=[{key:"componentDidMount",value:function(){this._unsubscribe=this.props.persistor.subscribe(this.handlePersistorState),this.handlePersistorState()}},{key:"componentWillUnmount",value:function(){this._unsubscribe&&this._unsubscribe()}},{key:"render",value:function(){return"function"==typeof this.props.children?this.props.children(this.state.bootstrapped):this.state.bootstrapped?this.props.children:this.props.loading}}])&&ie(n.prototype,r),t}(t.PureComponent);function de(){return de=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},de.apply(this,arguments)}me(fe,"defaultProps",{children:null,loading:null}),function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(pe||(pe={}));const he="popstate";function ge(e,t){if(!1===e||null==e)throw new Error(t)}function ye(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function ve(e,t){return{usr:e.state,key:e.key,idx:t}}function we(e,t,n,r){return void 0===n&&(n=null),de({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof t?xe(t):t,{state:n,key:t&&t.key||r||Math.random().toString(36).substr(2,8)})}function be(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&"?"!==n&&(t+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(t+="#"===r.charAt(0)?r:"#"+r),t}function xe(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}var Ee;function Se(e,t,n){void 0===n&&(n="/");let r=Me(("string"==typeof t?xe(t):t).pathname||"/",n);if(null==r)return null;let o=ke(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let n=e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]));return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let a=null;for(let e=0;null==a&&e<o.length;++e){let t=Fe(r);a=Ae(o[e],t)}return a}function ke(e,t,n,r){void 0===t&&(t=[]),void 0===n&&(n=[]),void 0===r&&(r="");let o=(e,o,a)=>{let l={relativePath:void 0===a?e.path||"":a,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};l.relativePath.startsWith("/")&&(ge(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path "'+r+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),l.relativePath=l.relativePath.slice(r.length));let i=Ve([r,l.relativePath]),c=n.concat(l);e.children&&e.children.length>0&&(ge(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+i+'".'),ke(e.children,t,c,i)),(null!=e.path||e.index)&&t.push({path:i,score:Ie(i,e.index),routesMeta:c})};return e.forEach(((e,t)=>{var n;if(""!==e.path&&null!=(n=e.path)&&n.includes("?"))for(let n of Ne(e.path))o(e,t,n);else o(e,t)})),t}function Ne(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,o=n.endsWith("?"),a=n.replace(/\?$/,"");if(0===r.length)return o?[a,""]:[a];let l=Ne(r.join("/")),i=[];return i.push(...l.map((e=>""===e?a:[a,e].join("/")))),o&&i.push(...l),i.map((t=>e.startsWith("/")&&""===t?"/":t))}!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(Ee||(Ee={})),new Set(["lazy","caseSensitive","path","id","index","children"]);const Oe=/^:[\w-]+$/,Ce=3,je=2,Pe=1,Le=10,_e=-2,Re=e=>"*"===e;function Ie(e,t){let n=e.split("/"),r=n.length;return n.some(Re)&&(r+=_e),t&&(r+=je),n.filter((e=>!Re(e))).reduce(((e,t)=>e+(Oe.test(t)?Ce:""===t?Pe:Le)),r)}function Ae(e,t){let{routesMeta:n}=e,r={},o="/",a=[];for(let e=0;e<n.length;++e){let l=n[e],i=e===n.length-1,c="/"===o?t:t.slice(o.length)||"/",s=Te({path:l.relativePath,caseSensitive:l.caseSensitive,end:i},c);if(!s)return null;Object.assign(r,s.params);let u=l.route;a.push({params:r,pathname:Ve([o,s.pathname]),pathnameBase:We(Ve([o,s.pathnameBase])),route:u}),"/"!==s.pathnameBase&&(o=Ve([o,s.pathnameBase]))}return a}function Te(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),ye("*"===e||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were "'+e.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+e.replace(/\*$/,"/*")+'".');let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,n)=>(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")));return e.endsWith("*")?(r.push({paramName:"*"}),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let a=o[0],l=a.replace(/(.)\/+$/,"$1"),i=o.slice(1),c=r.reduce(((e,t,n)=>{let{paramName:r,isOptional:o}=t;if("*"===r){let e=i[n]||"";l=a.slice(0,a.length-e.length).replace(/(.)\/+$/,"$1")}const c=i[n];return e[r]=o&&!c?void 0:(c||"").replace(/%2F/g,"/"),e}),{});return{params:c,pathname:a,pathnameBase:l,pattern:e}}function Fe(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return ye(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function Me(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}function De(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the `to."+n+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function Ge(e,t){let n=function(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}(e);return t?n.map(((t,n)=>n===e.length-1?t.pathname:t.pathnameBase)):n.map((e=>e.pathnameBase))}function qe(e,t,n,r){let o;void 0===r&&(r=!1),"string"==typeof e?o=xe(e):(o=de({},e),ge(!o.pathname||!o.pathname.includes("?"),De("?","pathname","search",o)),ge(!o.pathname||!o.pathname.includes("#"),De("#","pathname","hash",o)),ge(!o.search||!o.search.includes("#"),De("#","search","hash",o)));let a,l=""===e||""===o.pathname,i=l?"/":o.pathname;if(null==i)a=n;else{let e=t.length-1;if(!r&&i.startsWith("..")){let t=i.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}a=e>=0?t[e]:"/"}let c=function(e,t){void 0===t&&(t="/");let{pathname:n,search:r="",hash:o=""}="string"==typeof e?xe(e):e,a=n?n.startsWith("/")?n:function(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(n,t):t;return{pathname:a,search:Be(r),hash:He(o)}}(o,a),s=i&&"/"!==i&&i.endsWith("/"),u=(l||"."===i)&&n.endsWith("/");return c.pathname.endsWith("/")||!s&&!u||(c.pathname+="/"),c}const Ve=e=>e.join("/").replace(/\/\/+/g,"/"),We=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Be=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",He=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";Error;const ze=["post","put","patch","delete"],Ue=(new Set(ze),["get",...ze]);function $e(){return $e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$e.apply(this,arguments)}new Set(Ue),new Set([301,302,303,307,308]),new Set([307,308]),Symbol("deferred");const Ze=t.createContext(null),Ye=t.createContext(null),Ke=t.createContext(null),Xe=t.createContext(null),Je=t.createContext({outlet:null,matches:[],isDataRoute:!1}),Qe=t.createContext(null);function et(){return null!=t.useContext(Xe)}function tt(){return et()||ge(!1),t.useContext(Xe).location}function nt(e){t.useContext(Ke).static||t.useLayoutEffect(e)}function rt(){let{isDataRoute:e}=t.useContext(Je);return e?function(){let{router:e}=function(e){let n=t.useContext(Ze);return n||ge(!1),n}(ut.UseNavigateStable),n=pt(mt.UseNavigateStable),r=t.useRef(!1);return nt((()=>{r.current=!0})),t.useCallback((function(t,o){void 0===o&&(o={}),r.current&&("number"==typeof t?e.navigate(t):e.navigate(t,$e({fromRouteId:n},o)))}),[e,n])}():function(){et()||ge(!1);let e=t.useContext(Ze),{basename:n,future:r,navigator:o}=t.useContext(Ke),{matches:a}=t.useContext(Je),{pathname:l}=tt(),i=JSON.stringify(Ge(a,r.v7_relativeSplatPath)),c=t.useRef(!1);return nt((()=>{c.current=!0})),t.useCallback((function(t,r){if(void 0===r&&(r={}),!c.current)return;if("number"==typeof t)return void o.go(t);let a=qe(t,JSON.parse(i),l,"path"===r.relative);null==e&&"/"!==n&&(a.pathname="/"===a.pathname?n:Ve([n,a.pathname])),(r.replace?o.replace:o.push)(a,r.state,r)}),[n,o,i,l,e])}()}function ot(e,n){let{relative:r}=void 0===n?{}:n,{future:o}=t.useContext(Ke),{matches:a}=t.useContext(Je),{pathname:l}=tt(),i=JSON.stringify(Ge(a,o.v7_relativeSplatPath));return t.useMemo((()=>qe(e,JSON.parse(i),l,"path"===r)),[e,i,l,r])}function at(e,n,r,o){et()||ge(!1);let{navigator:a}=t.useContext(Ke),{matches:l}=t.useContext(Je),i=l[l.length-1],c=i?i.params:{},s=(i&&i.pathname,i?i.pathnameBase:"/");i&&i.route;let u,m=tt();if(n){var p;let e="string"==typeof n?xe(n):n;"/"===s||(null==(p=e.pathname)?void 0:p.startsWith(s))||ge(!1),u=e}else u=m;let f=u.pathname||"/",d=f;if("/"!==s){let e=s.replace(/^\//,"").split("/");d="/"+f.replace(/^\//,"").split("/").slice(e.length).join("/")}let h=Se(e,{pathname:d}),g=function(e,n,r,o){var a;if(void 0===n&&(n=[]),void 0===r&&(r=null),void 0===o&&(o=null),null==e){var l;if(null==(l=r)||!l.errors)return null;e=r.matches}let i=e,c=null==(a=r)?void 0:a.errors;if(null!=c){let e=i.findIndex((e=>e.route.id&&(null==c?void 0:c[e.route.id])));e>=0||ge(!1),i=i.slice(0,Math.min(i.length,e+1))}let s=!1,u=-1;if(r&&o&&o.v7_partialHydration)for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(u=e),t.route.id){let{loaderData:e,errors:n}=r,o=t.route.loader&&void 0===e[t.route.id]&&(!n||void 0===n[t.route.id]);if(t.route.lazy||o){s=!0,i=u>=0?i.slice(0,u+1):[i[0]];break}}}return i.reduceRight(((e,o,a)=>{let l,m=!1,p=null,f=null;var d;r&&(l=c&&o.route.id?c[o.route.id]:void 0,p=o.route.errorElement||it,s&&(u<0&&0===a?(ft[d="route-fallback"]||(ft[d]=!0),m=!0,f=null):u===a&&(m=!0,f=o.route.hydrateFallbackElement||null)));let h=n.concat(i.slice(0,a+1)),g=()=>{let n;return n=l?p:m?f:o.route.Component?t.createElement(o.route.Component,null):o.route.element?o.route.element:e,t.createElement(st,{match:o,routeContext:{outlet:e,matches:h,isDataRoute:null!=r},children:n})};return r&&(o.route.ErrorBoundary||o.route.errorElement||0===a)?t.createElement(ct,{location:r.location,revalidation:r.revalidation,component:p,error:l,children:g(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):g()}),null)}(h&&h.map((e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:Ve([s,a.encodeLocation?a.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?s:Ve([s,a.encodeLocation?a.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),l,r,o);return n&&g?t.createElement(Xe.Provider,{value:{location:$e({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:pe.Pop}},g):g}function lt(){let e=function(){var e;let n=t.useContext(Qe),r=function(e){let n=t.useContext(Ye);return n||ge(!1),n}(mt.UseRouteError),o=pt(mt.UseRouteError);return void 0!==n?n:null==(e=r.errors)?void 0:e[o]}(),n=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return t.createElement(t.Fragment,null,t.createElement("h2",null,"Unexpected Application Error!"),t.createElement("h3",{style:{fontStyle:"italic"}},n),r?t.createElement("pre",{style:o},r):null,null)}const it=t.createElement(lt,null);class ct extends t.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?t.createElement(Je.Provider,{value:this.props.routeContext},t.createElement(Qe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function st(e){let{routeContext:n,match:r,children:o}=e,a=t.useContext(Ze);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),t.createElement(Je.Provider,{value:n},o)}var ut=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(ut||{}),mt=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(mt||{});function pt(e){let n=function(e){let n=t.useContext(Je);return n||ge(!1),n}(),r=n.matches[n.matches.length-1];return r.route.id||ge(!1),r.route.id}const ft={};function dt(e){ge(!1)}function ht(e){let{basename:n="/",children:r=null,location:o,navigationType:a=pe.Pop,navigator:l,static:i=!1,future:c}=e;et()&&ge(!1);let s=n.replace(/^\/*/,"/"),u=t.useMemo((()=>({basename:s,navigator:l,static:i,future:$e({v7_relativeSplatPath:!1},c)})),[s,c,l,i]);"string"==typeof o&&(o=xe(o));let{pathname:m="/",search:p="",hash:f="",state:d=null,key:h="default"}=o,g=t.useMemo((()=>{let e=Me(m,s);return null==e?null:{location:{pathname:e,search:p,hash:f,state:d,key:h},navigationType:a}}),[s,m,p,f,d,h,a]);return null==g?null:t.createElement(Ke.Provider,{value:u},t.createElement(Xe.Provider,{children:r,value:g}))}function gt(e){let{children:t,location:n}=e;return function(e,t){return at(e,t)}(yt(t),n)}function yt(e,n){void 0===n&&(n=[]);let r=[];return t.Children.forEach(e,((e,o)=>{if(!t.isValidElement(e))return;let a=[...n,o];if(e.type===t.Fragment)return void r.push.apply(r,yt(e.props.children,a));e.type!==dt&&ge(!1),e.props.index&&e.props.children&&ge(!1);let l={id:e.props.id||a.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(l.children=yt(e.props.children,a)),r.push(l)})),r}function vt(){return vt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vt.apply(this,arguments)}function wt(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}t.startTransition,new Promise((()=>{})),t.Component,new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);const bt=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],xt=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"];try{window.__reactRouterVersion="6"}catch(Is){}const Et=t.createContext({isTransitioning:!1});new Map;const St=t.startTransition;function kt(e){let{basename:n,children:r,future:o,window:a}=e,l=t.useRef();var i;null==l.current&&(l.current=(void 0===(i={window:a,v5Compat:!0})&&(i={}),function(e,t,n,r){void 0===r&&(r={});let{window:o=document.defaultView,v5Compat:a=!1}=r,l=o.history,i=pe.Pop,c=null,s=u();function u(){return(l.state||{idx:null}).idx}function m(){i=pe.Pop;let e=u(),t=null==e?null:e-s;s=e,c&&c({action:i,location:f.location,delta:t})}function p(e){let t="null"!==o.location.origin?o.location.origin:o.location.href,n="string"==typeof e?e:be(e);return n=n.replace(/ $/,"%20"),ge(t,"No window.location.(origin|href) available to create URL for href: "+n),new URL(n,t)}null==s&&(s=0,l.replaceState(de({},l.state,{idx:s}),""));let f={get action(){return i},get location(){return e(o,l)},listen(e){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(he,m),c=e,()=>{o.removeEventListener(he,m),c=null}},createHref:e=>t(o,e),createURL:p,encodeLocation(e){let t=p(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){i=pe.Push;let r=we(f.location,e,t);n&&n(r,e),s=u()+1;let m=ve(r,s),p=f.createHref(r);try{l.pushState(m,"",p)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;o.location.assign(p)}a&&c&&c({action:i,location:f.location,delta:1})},replace:function(e,t){i=pe.Replace;let r=we(f.location,e,t);n&&n(r,e),s=u();let o=ve(r,s),m=f.createHref(r);l.replaceState(o,"",m),a&&c&&c({action:i,location:f.location,delta:0})},go:e=>l.go(e)};return f}((function(e,t){let{pathname:n="/",search:r="",hash:o=""}=xe(e.location.hash.substr(1));return n.startsWith("/")||n.startsWith(".")||(n="/"+n),we("",{pathname:n,search:r,hash:o},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){let n=e.document.querySelector("base"),r="";if(n&&n.getAttribute("href")){let t=e.location.href,n=t.indexOf("#");r=-1===n?t:t.slice(0,n)}return r+"#"+("string"==typeof t?t:be(t))}),(function(e,t){ye("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")}),i)));let c=l.current,[s,u]=t.useState({action:c.action,location:c.location}),{v7_startTransition:m}=o||{},p=t.useCallback((e=>{m&&St?St((()=>u(e))):u(e)}),[u,m]);return t.useLayoutEffect((()=>c.listen(p)),[c,p]),t.createElement(ht,{basename:n,children:r,location:s.location,navigationType:s.action,navigator:c,future:o})}G.flushSync,t.useId;const Nt="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Ot=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ct=t.forwardRef((function(e,n){let r,{onClick:o,relative:a,reloadDocument:l,replace:i,state:c,target:s,to:u,preventScrollReset:m,unstable_viewTransition:p}=e,f=wt(e,bt),{basename:d}=t.useContext(Ke),h=!1;if("string"==typeof u&&Ot.test(u)&&(r=u,Nt))try{let e=new URL(window.location.href),t=u.startsWith("//")?new URL(e.protocol+u):new URL(u),n=Me(t.pathname,d);t.origin===e.origin&&null!=n?u=n+t.search+t.hash:h=!0}catch(e){}let g=function(e,n){let{relative:r}=void 0===n?{}:n;et()||ge(!1);let{basename:o,navigator:a}=t.useContext(Ke),{hash:l,pathname:i,search:c}=ot(e,{relative:r}),s=i;return"/"!==o&&(s="/"===i?o:Ve([o,i])),a.createHref({pathname:s,search:c,hash:l})}(u,{relative:a}),y=function(e,n){let{target:r,replace:o,state:a,preventScrollReset:l,relative:i,unstable_viewTransition:c}=void 0===n?{}:n,s=rt(),u=tt(),m=ot(e,{relative:i});return t.useCallback((t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,r)){t.preventDefault();let n=void 0!==o?o:be(u)===be(m);s(e,{replace:n,state:a,preventScrollReset:l,relative:i,unstable_viewTransition:c})}}),[u,s,m,o,a,r,e,l,i,c])}(u,{replace:i,state:c,target:s,preventScrollReset:m,relative:a,unstable_viewTransition:p});return t.createElement("a",vt({},f,{href:r||g,onClick:h||l?o:function(e){o&&o(e),e.defaultPrevented||y(e)},ref:n,target:s}))})),jt=t.forwardRef((function(e,n){let{"aria-current":r="page",caseSensitive:o=!1,className:a="",end:l=!1,style:i,to:c,unstable_viewTransition:s,children:u}=e,m=wt(e,xt),p=ot(c,{relative:m.relative}),f=tt(),d=t.useContext(Ye),{navigator:h,basename:g}=t.useContext(Ke),y=null!=d&&function(e,n){void 0===n&&(n={});let r=t.useContext(Et);null==r&&ge(!1);let{basename:o}=function(e){let n=t.useContext(Ze);return n||ge(!1),n}(Pt.useViewTransitionState),a=ot(e,{relative:n.relative});if(!r.isTransitioning)return!1;let l=Me(r.currentLocation.pathname,o)||r.currentLocation.pathname,i=Me(r.nextLocation.pathname,o)||r.nextLocation.pathname;return null!=Te(a.pathname,i)||null!=Te(a.pathname,l)}(p)&&!0===s,v=h.encodeLocation?h.encodeLocation(p).pathname:p.pathname,w=f.pathname,b=d&&d.navigation&&d.navigation.location?d.navigation.location.pathname:null;o||(w=w.toLowerCase(),b=b?b.toLowerCase():null,v=v.toLowerCase()),b&&g&&(b=Me(b,g)||b);const x="/"!==v&&v.endsWith("/")?v.length-1:v.length;let E,S=w===v||!l&&w.startsWith(v)&&"/"===w.charAt(x),k=null!=b&&(b===v||!l&&b.startsWith(v)&&"/"===b.charAt(v.length)),N={isActive:S,isPending:k,isTransitioning:y},O=S?r:void 0;E="function"==typeof a?a(N):[a,S?"active":null,k?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let C="function"==typeof i?i(N):i;return t.createElement(Ct,vt({},m,{"aria-current":O,className:E,ref:n,style:C,to:c,unstable_viewTransition:s}),"function"==typeof u?u(N):u)}));var Pt,Lt;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Pt||(Pt={})),function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(Lt||(Lt={}));const _t=o.p+"images/logo.4a5282be.png";function Rt(e){var t=e.to,n=e.children;return wp.element.createElement(jt,{to:t,className:function(e){return e.isActive?"text-sky-400 focus:!shadow-none active:text-sky-400 focus:text-sky-400 hover:!text-sky-400":"focus:!shadow-none active:text-sky-400 focus:text-sky-400 hover:!text-sky-400"}},n)}const It=function(e){var t=e.children,n="h-full flex items-center justify-center mb-0";return wp.element.createElement("div",{className:"relative"},wp.element.createElement("header",{className:"bg-white px-6 items-stretch justify-between h-14 hidden md:flex"},wp.element.createElement("div",{className:"flex items-center gap-px py-4 "},wp.element.createElement("img",{className:"h-10 w-auto",src:_t,alt:"SquareWooSync"}),wp.element.createElement("nav",{className:"h-full ml-2"},wp.element.createElement("ul",{className:"flex items-center h-full gap-4 justify-center divide-x divide-gray-200 font-semibold "},wp.element.createElement("li",{className:n},wp.element.createElement(Rt,{to:"/"},"Dashboard")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement(Rt,{to:"/inventory"},"Products")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement(Rt,{to:"/customers"},"Customers")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement(Rt,{to:"/loyalty"},"Loyalty")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement(Rt,{to:"/orders"},"Orders")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement(Rt,{to:"/settings/general"},"Settings")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement("a",{target:"_blank",href:"https://squaresyncforwoo.com/documentation",className:function(e){return e.isActive?"text-sky-400 focus:!shadow-none active:text-sky-400 focus:text-sky-400 hover:!text-sky-400":"focus:!shadow-none active:text-sky-400 focus:text-sky-400 hover:!text-sky-400"}},"Documentation")),wp.element.createElement("li",{className:"".concat(n," pl-4")},wp.element.createElement("a",{target:"_blank",href:"https://squaresyncforwoo.com",className:"text-green-500 font-bold"},"GO PRO")))))),wp.element.createElement("main",{className:" mx-auto pb-20 mt-6 px-6"},t))},At=function(){return wp.element.createElement("span",{className:"inline-flex items-center rounded-full bg-purple-100 px-1.5 py-0.5 text-xs font-medium text-purple-700"},"PRO ONLY")};function Tt(){return wp.element.createElement("div",{className:"bg-white p-6 rounded-xl not-prose grid grid-cols-1 gap-6 sm:grid-cols-2 w-full"},wp.element.createElement("header",{className:"mb-2 col-span-full flex flex-col"},wp.element.createElement("p",{className:" text-sm font-medium text-sky-500"},"Introduction"),wp.element.createElement("h1",{className:"text-3xl tracking-tight text-slate-900 font-bold "},"Getting started"),wp.element.createElement("p",{className:"text-xl text-gray-600 mt-2"},"Welcome to SquareWooSync. See below to learn how to start importing and syncronizing products with Square and Woo.")),wp.element.createElement("div",{className:"group relative rounded-xl border border-slate-400 "},wp.element.createElement("div",{className:"absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.sky.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 "}),wp.element.createElement("div",{className:"relative overflow-hidden rounded-xl p-6"},wp.element.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 32 32",fill:"none",className:"h-8 w-8 [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"},wp.element.createElement("defs",null,wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S3:-gradient",gradientTransform:"matrix(0 21 -21 0 20 11)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S3:-gradient-dark-1",gradientTransform:"matrix(0 22.75 -22.75 0 16 6.25)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S3:-gradient-dark-2",gradientTransform:"matrix(0 14 -14 0 16 10)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"}))),wp.element.createElement("g",{className:""},wp.element.createElement("circle",{cx:"20",cy:"20",r:"12",fill:"url(#:S3:-gradient)"}),wp.element.createElement("g",{fillOpacity:"0.5",className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},wp.element.createElement("path",{d:"M3 9v14l12 6V15L3 9Z"}),wp.element.createElement("path",{d:"M27 9v14l-12 6V15l12-6Z"})),wp.element.createElement("path",{d:"M11 4h8v2l6 3-10 6L5 9l6-3V4Z",fillOpacity:"0.5",className:"fill-[var(--icon-background)]"}),wp.element.createElement("g",{className:"stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},wp.element.createElement("path",{d:"M20 5.5 27 9l-12 6L3 9l7-3.5"}),wp.element.createElement("path",{d:"M20 5c0 1.105-2.239 2-5 2s-5-.895-5-2m10 0c0-1.105-2.239-2-5-2s-5 .895-5 2m10 0v3c0 1.105-2.239 2-5 2s-5-.895-5-2V5"}))),wp.element.createElement("g",{className:"hidden ",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},wp.element.createElement("path",{d:"M17.676 3.38a3.887 3.887 0 0 0-3.352 0l-9 4.288C3.907 8.342 3 9.806 3 11.416v9.168c0 1.61.907 3.073 2.324 3.748l9 4.288a3.887 3.887 0 0 0 3.352 0l9-4.288C28.093 23.657 29 22.194 29 20.584v-9.168c0-1.61-.907-3.074-2.324-3.748l-9-4.288Z",stroke:"url(#:S3:-gradient-dark-1)"}),wp.element.createElement("path",{d:"M16.406 8.087a.989.989 0 0 0-.812 0l-7 3.598A1.012 1.012 0 0 0 8 12.61v6.78c0 .4.233.762.594.925l7 3.598a.989.989 0 0 0 .812 0l7-3.598c.361-.163.594-.525.594-.925v-6.78c0-.4-.233-.762-.594-.925l-7-3.598Z",fill:"url(#:S3:-gradient-dark-2)",stroke:"url(#:S3:-gradient-dark-2)"}))),wp.element.createElement("h2",{className:"mt-4 text-base text-slate-900 "},wp.element.createElement("a",{href:"/wp-admin/admin.php?page=squarewoosync#/inventory"},wp.element.createElement("span",{className:"absolute -inset-px rounded-xl"}),"Start a new import")),wp.element.createElement("p",{className:"mt-1 text-sm text-slate-700 "},"Click here to begin importing or syncronizing products from Square to Woo"))),wp.element.createElement("div",{className:"group relative rounded-xl border border-slate-400 "},wp.element.createElement("div",{className:"absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.sky.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 "}),wp.element.createElement("div",{className:"relative overflow-hidden rounded-xl p-6"},wp.element.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 32 32",fill:"none",className:"h-8 w-8 [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"},wp.element.createElement("defs",null,wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S1:-gradient",gradientTransform:"matrix(0 21 -21 0 12 3)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S1:-gradient-dark",gradientTransform:"matrix(0 21 -21 0 16 7)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"}))),wp.element.createElement("g",{className:""},wp.element.createElement("circle",{cx:"12",cy:"12",r:"12",fill:"url(#:S1:-gradient)"}),wp.element.createElement("path",{d:"m8 8 9 21 2-10 10-2L8 8Z",fillOpacity:"0.5",className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),wp.element.createElement("g",{className:"hidden "},wp.element.createElement("path",{d:"m4 4 10.286 24 2.285-11.429L28 14.286 4 4Z",fill:"url(#:S1:-gradient-dark)",stroke:"url(#:S1:-gradient-dark)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}))),wp.element.createElement("h2",{className:"mt-4 text-base text-slate-900 "},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/documentation",target:"_blank"},wp.element.createElement("span",{className:"absolute -inset-px rounded-xl"}),"Installation")),wp.element.createElement("p",{className:"mt-1 text-sm text-slate-700 "},"Step-by-step guides to setting up your Square account and Woo to talk to each other"))),wp.element.createElement("div",{className:"group relative rounded-xl border border-slate-400 "},wp.element.createElement("div",{className:"absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.sky.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 "}),wp.element.createElement("div",{className:"relative overflow-hidden rounded-xl p-6"},wp.element.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 32 32",fill:"none",className:"h-8 w-8 [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"},wp.element.createElement("defs",null,wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S2:-gradient",gradientTransform:"matrix(0 21 -21 0 20 3)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S2:-gradient-dark",gradientTransform:"matrix(0 22.75 -22.75 0 16 6.25)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"}))),wp.element.createElement("g",{className:""},wp.element.createElement("circle",{cx:"20",cy:"12",r:"12",fill:"url(#:S2:-gradient)"}),wp.element.createElement("g",{className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",fillOpacity:"0.5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},wp.element.createElement("path",{d:"M3 5v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2Z"}),wp.element.createElement("path",{d:"M18 17v10a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2V17a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2Z"}),wp.element.createElement("path",{d:"M18 5v4a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2Z"}),wp.element.createElement("path",{d:"M3 25v2a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2v-2a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2Z"}))),wp.element.createElement("g",{className:"hidden ",fill:"url(#:S2:-gradient-dark)"},wp.element.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 17V4a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1Zm16 10v-9a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2Zm0-23v5a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1h-8a1 1 0 0 0-1 1ZM3 28v-3a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1Z"}),wp.element.createElement("path",{d:"M2 4v13h2V4H2Zm2-2a2 2 0 0 0-2 2h2V2Zm8 0H4v2h8V2Zm2 2a2 2 0 0 0-2-2v2h2Zm0 13V4h-2v13h2Zm-2 2a2 2 0 0 0 2-2h-2v2Zm-8 0h8v-2H4v2Zm-2-2a2 2 0 0 0 2 2v-2H2Zm16 1v9h2v-9h-2Zm3-3a3 3 0 0 0-3 3h2a1 1 0 0 1 1-1v-2Zm6 0h-6v2h6v-2Zm3 3a3 3 0 0 0-3-3v2a1 1 0 0 1 1 1h2Zm0 9v-9h-2v9h2Zm-3 3a3 3 0 0 0 3-3h-2a1 1 0 0 1-1 1v2Zm-6 0h6v-2h-6v2Zm-3-3a3 3 0 0 0 3 3v-2a1 1 0 0 1-1-1h-2Zm2-18V4h-2v5h2Zm0 0h-2a2 2 0 0 0 2 2V9Zm8 0h-8v2h8V9Zm0 0v2a2 2 0 0 0 2-2h-2Zm0-5v5h2V4h-2Zm0 0h2a2 2 0 0 0-2-2v2Zm-8 0h8V2h-8v2Zm0 0V2a2 2 0 0 0-2 2h2ZM2 25v3h2v-3H2Zm2-2a2 2 0 0 0-2 2h2v-2Zm9 0H4v2h9v-2Zm2 2a2 2 0 0 0-2-2v2h2Zm0 3v-3h-2v3h2Zm-2 2a2 2 0 0 0 2-2h-2v2Zm-9 0h9v-2H4v2Zm-2-2a2 2 0 0 0 2 2v-2H2Z"}))),wp.element.createElement("h2",{className:"mt-4 text-base text-slate-900 "},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/documentation#import-data",target:"_blank"},wp.element.createElement("span",{className:"absolute -inset-px rounded-xl"}),"Controlling your import data")),wp.element.createElement("p",{className:"mt-1 text-sm text-slate-700 "},"Learn how the internals work and how you can choose which data you would like to sync."))),wp.element.createElement("div",{className:"group relative rounded-xl border border-slate-400 "},wp.element.createElement("div",{className:"absolute -inset-px rounded-xl border-2 border-transparent opacity-0 [background:linear-gradient(var(--quick-links-hover-bg,theme(colors.sky.50)),var(--quick-links-hover-bg,theme(colors.sky.50)))_padding-box,linear-gradient(to_top,theme(colors.sky.400),theme(colors.cyan.400),theme(colors.sky.500))_border-box] group-hover:opacity-100 "}),wp.element.createElement("div",{className:"relative overflow-hidden rounded-xl p-6"},wp.element.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 32 32",fill:"none",className:"h-8 w-8 [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"},wp.element.createElement("defs",null,wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S4:-gradient",gradientTransform:"matrix(0 21 -21 0 12 11)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"})),wp.element.createElement("radialGradient",{cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",id:":S4:-gradient-dark",gradientTransform:"matrix(0 24.5 -24.5 0 16 5.5)"},wp.element.createElement("stop",{stopColor:"#0EA5E9"}),wp.element.createElement("stop",{stopColor:"#22D3EE",offset:".527"}),wp.element.createElement("stop",{stopColor:"#818CF8",offset:"1"}))),wp.element.createElement("g",{className:""},wp.element.createElement("circle",{cx:"12",cy:"20",r:"12",fill:"url(#:S4:-gradient)"}),wp.element.createElement("path",{d:"M27 12.13 19.87 5 13 11.87v14.26l14-14Z",className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",fillOpacity:"0.5",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),wp.element.createElement("path",{d:"M3 3h10v22a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V3Z",className:"fill-[var(--icon-background)]",fillOpacity:"0.5"}),wp.element.createElement("path",{d:"M3 9v16a4 4 0 0 0 4 4h2a4 4 0 0 0 4-4V9M3 9V3h10v6M3 9h10M3 15h10M3 21h10",className:"stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),wp.element.createElement("path",{d:"M29 29V19h-8.5L13 26c0 1.5-2.5 3-5 3h21Z",fillOpacity:"0.5",className:"fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),wp.element.createElement("g",{className:"hidden "},wp.element.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 2a1 1 0 0 0-1 1v21a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H3Zm16.752 3.293a1 1 0 0 0-1.593.244l-1.045 2A1 1 0 0 0 17 8v13a1 1 0 0 0 1.71.705l7.999-8.045a1 1 0 0 0-.002-1.412l-6.955-6.955ZM26 18a1 1 0 0 0-.707.293l-10 10A1 1 0 0 0 16 30h13a1 1 0 0 0 1-1V19a1 1 0 0 0-1-1h-3ZM5 18a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2H5Zm-1-5a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Zm1-7a1 1 0 0 0 0 2h6a1 1 0 1 0 0-2H5Z",fill:"url(#:S4:-gradient-dark)"}))),wp.element.createElement("h2",{className:"mt-4 text-base text-slate-900 "},wp.element.createElement("a",{href:"/wp-admin/admin.php?page=squarewoosync#/settings/general"},wp.element.createElement("span",{className:"absolute -inset-px rounded-xl"}),"Settings")),wp.element.createElement("p",{className:"mt-1 text-sm text-slate-700 "},"Manage your access token, import data and webhook url for automatic synchronization"))))}const Ft=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 0 1-.825-.242m9.345-8.334a2.126 2.126 0 0 0-.476-.095 48.64 48.64 0 0 0-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0 0 11.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155"}))})),Mt=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 12.75c1.148 0 2.278.08 3.383.237 1.037.146 1.866.966 1.866 2.013 0 3.728-2.35 6.75-5.25 6.75S6.75 18.728 6.75 15c0-1.046.83-1.867 1.866-2.013A24.204 24.204 0 0 1 12 12.75Zm0 0c2.883 0 5.647.508 8.207 1.44a23.91 23.91 0 0 1-1.152 6.06M12 12.75c-2.883 0-5.647.508-8.208 1.44.125 2.104.52 4.136 1.153 6.06M12 12.75a2.25 2.25 0 0 0 2.248-2.354M12 12.75a2.25 2.25 0 0 1-2.248-2.354M12 8.25c.995 0 1.971-.08 2.922-.236.403-.066.74-.358.795-.762a3.778 3.778 0 0 0-.399-2.25M12 8.25c-.995 0-1.97-.08-2.922-.236-.402-.066-.74-.358-.795-.762a3.734 3.734 0 0 1 .4-2.253M12 8.25a2.25 2.25 0 0 0-2.248 2.146M12 8.25a2.25 2.25 0 0 1 2.248 2.146M8.683 5a6.032 6.032 0 0 1-1.155-1.002c.07-.63.27-1.222.574-1.747m.581 2.749A3.75 3.75 0 0 1 15.318 5m0 0c.427-.283.815-.62 1.155-.999a4.471 4.471 0 0 0-.575-1.752M4.921 6a24.048 24.048 0 0 0-.392 3.314c1.668.546 3.416.914 5.223 1.082M19.08 6c.205 1.08.337 2.187.392 3.314a23.882 23.882 0 0 1-5.223 1.082"}))})),Dt=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25"}))}));function Gt(){return wp.element.createElement("div",{className:"isolate bg-white p-5 rounded-xl"},wp.element.createElement("div",{className:""},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 "},"Support"),wp.element.createElement("p",{className:"leading-8 text-gray-600"})),wp.element.createElement("div",{className:"mt-3 space-y-4"},wp.element.createElement("div",{className:"flex gap-x-4"},wp.element.createElement("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-sky-600"},wp.element.createElement(Ft,{className:"h-6 w-6 text-white","aria-hidden":"true"})),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-sm font-semibold text-gray-900"},"Sales/License support"),wp.element.createElement("p",{className:" text-gray-600"},"Wish to talk to us about your licence or have another questions related to sales?"),wp.element.createElement("p",{className:""},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/my-account/support-portal/",target:"_blank",className:"text-sm font-semibold text-sky-600"},"Contact us"," ",wp.element.createElement("span",{"aria-hidden":"true"},"→"))))),wp.element.createElement("div",{className:"flex gap-x-4"},wp.element.createElement("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-sky-600"},wp.element.createElement(Mt,{className:"h-6 w-6 text-white","aria-hidden":"true"})),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-sm font-semibold text-gray-900"},"Bug reports"),wp.element.createElement("p",{className:" text-gray-600"},"Found a bug? Let us know so we can jump on it right away! And thank you for your help!"),wp.element.createElement("p",{className:""},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/my-account/support-portal/",target:"_blank",className:"text-sm font-semibold leading-6 text-sky-600"},"Report a bug"," ",wp.element.createElement("span",{"aria-hidden":"true"},"→"))))),wp.element.createElement("div",{className:"flex gap-x-4"},wp.element.createElement("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-sky-600"},wp.element.createElement(Dt,{className:"h-6 w-6 text-white","aria-hidden":"true"})),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-sm font-semibold text-gray-900"},"Technical support"),wp.element.createElement("p",{className:" text-gray-600"},"Can't figure out how to setup this plugin or having another technical issue? Let us know and we would be glad to assist you."),wp.element.createElement("p",{className:""},wp.element.createElement("a",{href:"https://squaresyncforwoo.com/#contact",target:"_blank",className:"text-sm font-semibold text-sky-600"},"Contact us"," ",wp.element.createElement("span",{"aria-hidden":"true"},"→")))))))}const qt=window.wp.apiFetch;var Vt=o.n(qt);function Wt(e){return Wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wt(e)}function Bt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ht(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bt(Object(n),!0).forEach((function(t){zt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function zt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Wt(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Wt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Wt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Vt().use((function(e,t){return e.headers=Ht(Ht({},e.headers),{},{nonce:swsData.nonce}),t(e)}));const Ut=Vt(),$t=window.moment;var Zt=o.n($t);const Yt=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z",clipRule:"evenodd"}))})),Kt=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-8-5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0v-4.5A.75.75 0 0 1 10 5Zm0 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"}))})),Xt=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-7-4a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM9 9a.75.75 0 0 0 0 1.5h.253a.25.25 0 0 1 .244.304l-.459 2.066A1.75 1.75 0 0 0 10.747 15H11a.75.75 0 0 0 0-1.5h-.253a.25.25 0 0 1-.244-.304l.459-2.066A1.75 1.75 0 0 0 9.253 9H9Z",clipRule:"evenodd"}))})),Jt=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))})),Qt=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"}))}));function en(e){return en="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},en(e)}function tn(){tn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==en(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(en(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function nn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function rn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nn(Object(n),!0).forEach((function(t){on(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function on(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=en(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=en(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==en(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function an(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function ln(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return cn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cn(e,t):void 0}}(e,t)||function(){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 cn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const sn=function(){var t=ln((0,e.useState)([]),2),n=t[0],r=t[1],o=ln((0,e.useState)(null),2),a=(o[0],o[1]);(0,e.useEffect)((function(){var e=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){an(a,r,o,l,i,"next",e)}function i(e){an(a,r,o,l,i,"throw",e)}l(void 0)}))}}(tn().mark((function e(){var t,n,o;return tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Ut({path:"/sws/v1/logs",method:"GET"});case 3:if(!((t=e.sent)instanceof Error||401===t.status)){e.next=7;break}return console.error("Error fetching logs:",t.message),e.abrupt("return");case 7:t.logs&&(n={},t.logs.forEach((function(e){var t=e.context;if(t&&t.parent_id){var r=t.parent_id;n[r]||(n[r]={children:[]}),n[r].children.push(e)}else{var o=t.process_id||e.id;n[o]?n[o]=rn(rn({},e),{},{children:n[o].children}):n[o]=rn(rn({},e),{},{children:[]})}})),o=Object.values(n).filter((function(e){return e.id})).map((function(e){return rn(rn({},e),{},{children:e.children.sort((function(e,t){return Zt()(t.timestamp).valueOf()-Zt()(e.timestamp).valueOf()}))})})).sort((function(e,t){return Zt()(t.timestamp).valueOf()-Zt()(e.timestamp).valueOf()})),r(o)),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),console.error("Failed to fetch logs:",e.t0);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(){return e.apply(this,arguments)}}();e();var t=setInterval(e,3e4);return a(t),function(){return clearInterval(t)}}),[]);var l=function(e){var t=e.log,r=e.isSummary,o=e.isChild;return wp.element.createElement("div",{className:"relative pb-4 ".concat(r?"flex justify-between items-center":"")},t.id===n[n.length-1].id||o?null:wp.element.createElement("span",{className:"absolute left-5 top-5 -ml-px h-full w-0.5 bg-gray-200","aria-hidden":"true"}),wp.element.createElement("div",{className:"flex items-start space-x-3 ".concat(o&&"ml-10")},wp.element.createElement("div",null,wp.element.createElement("div",{className:"relative px-1"},wp.element.createElement("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-gray-100 ring-8 ring-white"},"success"===t.log_level?wp.element.createElement(Yt,{className:"h-5 w-5 text-green-500","aria-hidden":"true"}):"error"===t.log_level||"failed"===t.log_level?wp.element.createElement(Kt,{className:"h-5 w-5 text-red-500","aria-hidden":"true"}):wp.element.createElement(Xt,{className:"h-5 w-5 text-blue-500","aria-hidden":"true"})))),wp.element.createElement("div",{className:"min-w-0 flex-1"},wp.element.createElement("p",{className:"text-sm text-gray-500 whitespace-nowrap"},Zt()(t.timestamp).format("MMM D h:mma")),wp.element.createElement("p",null,t.message)),r&&wp.element.createElement(Jt,{className:"h-5 w-5 text-gray-400"})))};return wp.element.createElement("div",{className:" bg-white rounded-xl p-5 w-full"},wp.element.createElement("h3",{className:"text-base font-semibold text-gray-900 mb-6 flex justify-start items-center gap-2"},wp.element.createElement(Qt,{className:"w-6 h-6"}),"Sync Feed",wp.element.createElement("span",{className:"text-xs text-gray-500 font-normal mt-[1px] -ml-1"}," ","- Shows last 1000 logs")),n.length<1&&wp.element.createElement("p",null,"No data, starting import/syncing to view logs"),wp.element.createElement("ul",{role:"list",className:"overflow-auto max-h-[1042px] h-auto overflow-y-auto"},n.map((function(e,t){return wp.element.createElement("li",{key:e.id||"parent-".concat(t)},e.children&&e.children.length>0?wp.element.createElement("details",{open:!0,className:"log-details"},wp.element.createElement("summary",{className:"list-none"},wp.element.createElement(l,{log:e,isChild:!1,isSummary:!0})),e.children.map((function(e){return wp.element.createElement(l,{key:e.id,log:e,isChild:!0})}))):wp.element.createElement(l,{log:e,isChild:!1}))}))))};var un="squarewoosync";function mn(){var t=tt();return(0,e.useEffect)((function(){!function(){var e=jQuery,t=e("#toplevel_page_"+un),n=window.location.href,r=n.substr(n.indexOf("admin.php"));e("ul.wp-submenu li",t).removeClass("current"),t.on("click","a",(function(){var n=e(this);e("ul.wp-submenu li",t).removeClass("current"),n.hasClass("wp-has-submenu")?e("li.wp-first-item",t).addClass("current"):n.parents("li").addClass("current")}));var o=r.split("/");e("ul.wp-submenu a",t).each((function(t,n){void 0!==o[1]&&o[1];var a=!1;e(n).attr("href")===r&&(a=!0),a&&e(n).parent().addClass("current")}))}()}),[t.pathname]),null}function pn(e){var t=e.cron;return wp.element.createElement("section",{className:" bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-start justify-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"#000",className:"w-6 h-6"},wp.element.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})),wp.element.createElement(At,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic scheduler is ",t&&t.status?"on":"off"),t&&t.status?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.status?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"text-gray-500 "},"The next automatic data sync to"," ",wp.element.createElement("span",{className:"text-sky-500"},t.direction)," will occur:"," ",wp.element.createElement("br",null),wp.element.createElement("span",{className:"text-sky-500"},t.next_run),t.time_until_next_run.length>0&&wp.element.createElement(React.Fragment,null,","," ",wp.element.createElement("span",{className:"text-sky-500"},"(",t.time_until_next_run,")"))),wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"The following data will be synced:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},Object.keys(t.data_to_import).filter((function(e){return t.data_to_import[e]})).map((function(e,t,n){return wp.element.createElement("span",{key:e},wp.element.createElement("span",{className:"text-sky-500"},e),t!==n.length-1?", ":"")})))):wp.element.createElement("p",{className:"mt-2 text-gray-500 "},"Automatic scheduler is currently disabled."))}function fn(e){var t=e.wooAuto;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5"},wp.element.createElement("polyline",{points:"17 1 21 5 17 9"}),wp.element.createElement("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),wp.element.createElement("polyline",{points:"7 23 3 19 7 15"}),wp.element.createElement("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})),wp.element.createElement(At,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time automatic sync from Woo to Square is ",t&&t.isActive?"on":"off"),t&&t.isActive?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.isActive?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-2 text-gray-500 "},"The following data will be synced on new woocommerce orders:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},wp.element.createElement("span",{className:"text-sky-500"},"stock"))):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatical sync is currently disabled."))}function dn(e){var t=e.squareAuto;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5"},wp.element.createElement("polyline",{points:"17 1 21 5 17 9"}),wp.element.createElement("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),wp.element.createElement("polyline",{points:"7 23 3 19 7 15"}),wp.element.createElement("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})),wp.element.createElement(At,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time automatic sync from Square to Woo is ",t&&t.isActive?"on":"off"),t&&t.isActive?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.isActive?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"The following data will be synced:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},Object.keys(t).filter((function(e){return("stock"===e||"title"===e||"description"===e||"sku"===e||"images"===e||"category"===e||"price"===e)&&!0===t[e]})).map((function(e,t,n){return wp.element.createElement("span",{key:e},wp.element.createElement("span",{className:"text-sky-500"},e),t!==n.length-1?", ":"")})))):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatic sync from Square to Woocommerce is currently disabled."))}function hn(e){var t=e.wooAuto;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5 text-black"},wp.element.createElement("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),wp.element.createElement("line",{x1:"12",y1:"8",x2:"12",y2:"16"}),wp.element.createElement("line",{x1:"8",y1:"12",x2:"16",y2:"12"})),wp.element.createElement(At,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Auto product creation is ",null!=t&&t.autoCreateProduct||null!=t&&t.autoWooCreation?"on":"off"),null!=t&&t.autoCreateProduct||null!=t&&t.autoWooCreation?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500"},t&&t.autoCreateProduct&&t.autoWooCreation?"Products are being automatically created both ways between WooCommerce and Square.":t&&t.autoCreateProduct?"When a new product is created in WooCommerce, it will automatically be created in Square.":t&&t.autoWooCreation?"When a new product is created in Square, it will automatically be created in WooCommerce.":"Auto product creation is currently disabled."),!(null!=t&&t.autoCreateProduct)&&!(null!=t&&t.autoWooCreation)&&wp.element.createElement("p",{className:"text-gray-500"})))}function gn(e){var t=e.orders,n=e.gatewaySettings;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full text-black"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5 text-black"},wp.element.createElement("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),wp.element.createElement("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Auto sync of orders, transactions and customers is ",t&&t.enabled||n&&"yes"===n.enabled?"on":"off"),t&&t.enabled||n&&"yes"===n.enabled?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.enabled||n&&"yes"===n.enabled?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"When a new order is created with a status of ",wp.element.createElement("span",{className:"text-sky-500"},'"',t.stage,'"'),", a corresponding order, transaction and customer will be created in Square.")):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Auto orders, transactions and customer sync to Square is currently disabled. To enable, to go the order settings ",wp.element.createElement(Ct,{to:"/settings/orders",className:"text-sky-500"},"here"),"."))}const yn=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"}))}));function vn(e){var t=e.squareWoo;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("div",{className:"flex gap-2 items-center"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5"},wp.element.createElement("polyline",{points:"17 1 21 5 17 9"}),wp.element.createElement("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),wp.element.createElement("polyline",{points:"7 23 3 19 7 15"}),wp.element.createElement("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})),wp.element.createElement(yn,{className:"w-5 h-5"}),wp.element.createElement(At,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Customer real-time automatic sync from Square to Woo is ",t&&t.is_active?"on":"off"),t&&t.is_active?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.is_active?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"The following data will be synced:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},Object.keys(t).filter((function(e){return("first_name"===e||"last_name"===e||"phone"===e||"role"===e||"address"===e)&&!0===t[e]})).map((function(e,t,n){return wp.element.createElement("span",{key:e},wp.element.createElement("span",{className:"text-sky-500"},e.replace("_"," ")),t!==n.length-1?", ":"")})))):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatic sync of customers from Square to Woocommerce is currently disabled."))}function wn(e){var t=e.wooSquare;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("div",{className:"flex gap-2 items-center"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5"},wp.element.createElement("polyline",{points:"17 1 21 5 17 9"}),wp.element.createElement("path",{d:"M3 11V9a4 4 0 0 1 4-4h14"}),wp.element.createElement("polyline",{points:"7 23 3 19 7 15"}),wp.element.createElement("path",{d:"M21 13v2a4 4 0 0 1-4 4H3"})),wp.element.createElement(yn,{className:"w-5 h-5"}),wp.element.createElement(At,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Customer real-time automatic sync from Woo to Square is ",t&&t.is_active?"on":"off"),t&&t.is_active?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.is_active?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-3 text-gray-500 "},"The following data will be synced:"),wp.element.createElement("p",{className:"mt-px text-gray-500 "},Object.keys(t).filter((function(e){return("first_name"===e||"last_name"===e||"phone"===e||"role"===e||"address"===e)&&!0===t[e]})).map((function(e,t,n){return wp.element.createElement("span",{key:e},wp.element.createElement("span",{className:"text-sky-500"},e.replace("_"," ")),t!==n.length-1?", ":"")})))):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatic sync of customers from Square to Woocommerce is currently disabled."))}const bn=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}));function xn(e){var t=e.wooAuto,n=e.squareAuto;return wp.element.createElement("section",{className:"bg-white rounded-xl p-4 w-full"},wp.element.createElement("header",{className:"flex flex-col items-between flex-start gap-2 relative w-full"},wp.element.createElement("span",{className:"flex gap-2"},wp.element.createElement(bn,{className:"w-5"}),wp.element.createElement(At,null)),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time automatic delete/archive is ",t&&t.autoDeleteProduct||n&&n.autoDeleteProduct?"on":"off"),t&&t.autoDeleteProduct||n&&n.autoDeleteProduct?wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-green-500"}))):wp.element.createElement("div",{className:"absolute top-1 right-0"},wp.element.createElement("span",{className:"relative flex h-3 w-3"},wp.element.createElement("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),wp.element.createElement("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-red-500"})))),t&&t.autoDeleteProduct||n&&n.autoDeleteProduct?wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",{className:"mt-2 text-gray-500 "},"When a product is deleted/archived in ",t.autoDeleteProduct?"WooCommerce":"Square",", it will also be deleted/archived in ",t.autoDeleteProduct?"Square":"WooCommerce")):wp.element.createElement("p",{className:"text-gray-500 mt-2"},"Real-time automatic sync is currently disabled."))}function En(e){return En="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},En(e)}function Sn(){Sn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==En(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(En(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function kn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Nn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?kn(Object(n),!0).forEach((function(t){On(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function On(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=En(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=En(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==En(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cn(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function jn(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){Cn(a,r,o,l,i,"next",e)}function i(e){Cn(a,r,o,l,i,"throw",e)}l(void 0)}))}}function Pn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ln(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ln(e,t):void 0}}(e,t)||function(){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 Ln(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}(0,e.createContext)();var Rn=(0,t.createContext)(),In=function(e){var n=e.children,r=Pn((0,t.useState)(!0),2),o=r[0],a=r[1],l=Pn((0,t.useState)({environment:"live",location:"",iventory:{isFetching:0},squareAuto:{isActive:!1,stock:!0,sku:!0,title:!0,description:!0,images:!0,price:!0,category:!0,attributesDisabled:!1},wooAuto:{autoCreateProduct:!1,autoWooCreation:!1,isActive:!1,stock:!1,sku:!0,title:!1,description:!1,images:!1,category:!1,price:!1,allLocationsStock:!1},orders:{enabled:!1,transactions:!1,stage:"processing",pickupMethod:"local_pickup",statusSync:!1,orderImport:!1,orderImportAllLocations:!1},cron:{enabled:!1,source:"square",schedule:"hourly",batches:30,data_to_import:{stock:!1,sku:!1,title:!1,description:!1,images:!1,category:!1,price:!1}},customers:{isFetching:0,roleMappings:[],filters:{group:0,segment:0},auto:{squareWoo:{is_active:!1,first_name:!1,last_name:!1,phone:!1,role:!1,address:!1},wooSquare:{is_active:!1,first_name:!1,last_name:!1,phone:!1,role:!1,address:!1}}},loyalty:{enabled:!1,program:null,method:"square",redemptionMethod:"square",redeem:!1},accessToken:null,exportStatus:0,exportSynced:1,exportResults:null}),2),i=l[0],c=l[1];(0,t.useEffect)((function(){var e=function(){var e=jn(Sn().mark((function e(){var t;return Sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Vt()({path:"/sws/v1/settings",method:"GET"});case 3:t=e.sent,c((function(e){return Nn(Nn({},e),t)})),a(!1),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),a(!1),F({render:"Failed to update settings: "+e.t0.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 12:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}();e()}),[]);var s=function(){var e=jn(Sn().mark((function e(t,n){var r,o;return Sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=F.loading("Updating setting: ".concat(t)),e.prev=1,e.next=4,Vt()({path:"/sws/v1/settings",method:"POST",data:On({},t,n)});case 4:(o=e.sent)&&(console.log(o),F.update(r,{render:"".concat(t," updated successfully"),type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),c((function(e){return Nn(Nn({},e),o)}))),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),F.update(r,{render:"Failed to update ".concat(t,": ").concat(e.t0.message),type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(_x,t){return e.apply(this,arguments)}}(),u=function(){var e=jn(Sn().mark((function e(){var t,n,r,o=arguments;return Sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=(o.length>0&&void 0!==o[0]?o[0]:{}).silent,n=void 0!==t&&t,e.prev=1,e.next=4,Vt()({path:"/sws/v1/settings/access-token",method:"GET"});case 4:if(!(r=e.sent).access_token||"Token not set or empty"===r.access_token){e.next=11;break}return c((function(e){return Nn(Nn({},e),{},{accessToken:r.access_token})})),n||F.success("Access token retrieved successfully"),e.abrupt("return",r.access_token);case 11:return n||F.warning("Access token not set"),e.abrupt("return",null);case 13:e.next=19;break;case 15:throw e.prev=15,e.t0=e.catch(1),F.error("Failed to retrieve access token: ".concat(e.t0.message)),e.t0;case 19:case"end":return e.stop()}}),e,null,[[1,15]])})));return function(){return e.apply(this,arguments)}}();(0,t.useEffect)((function(){u()}),[]);var m=function(){var e=jn(Sn().mark((function e(t){var n,r;return Sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=F.loading("Updating access token"),e.prev=1,e.next=4,Vt()({path:"/sws/v1/settings/access-token",method:"POST",data:{access_token:t}});case 4:if(200!==(r=e.sent).status){e.next=10;break}c((function(e){return Nn(Nn({},e),{},{accessToken:t})})),F.update(n,{render:"Access token updated successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.next=11;break;case 10:throw new Error(r.message);case 11:e.next=16;break;case 13:e.prev=13,e.t0=e.catch(1),F.update(n,{render:"Failed to update access token: ".concat(e.t0.message),type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 16:case"end":return e.stop()}}),e,null,[[1,13]])})));return function(t){return e.apply(this,arguments)}}(),p=function(){var e=jn(Sn().mark((function e(){var t;return Sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=F.loading("Removing access token"),e.prev=1,e.next=4,Vt()({path:"/sws/v1/settings/access-token",method:"DELETE"});case 4:c((function(e){return Nn(Nn({},e),{},{accessToken:null})})),F.update(t,{render:"Access token removed successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),F.update(t,{render:"Failed to remove access token: ".concat(e.t0.message),type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}(),f=Pn((0,t.useState)(),2),d=f[0],h=f[1],g=Pn((0,t.useState)(!0),2),y=g[0],v=g[1];(0,t.useEffect)((function(){var e=function(){var e=jn(Sn().mark((function e(){return Sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Vt()({path:"/sws/v1/settings/get-gateway-settings",method:"GET"}).then((function(e){h((function(t){return Nn(Nn({},t),e)})),v(!1)})).catch((function(e){v(!1),F({render:"Failed to update settings: "+e.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0})}));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]);var w=Pn((0,t.useState)([]),2),b=w[0],x=w[1],E=Pn((0,t.useState)(!0),2),S=E[0],k=E[1];return(0,t.useEffect)((function(){k(!0);var e=function(){var e=jn(Sn().mark((function e(){return Sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Vt()({path:"/sws/v1/settings/get-shipping-methods",method:"GET"}).then((function(e){x(e),k(!1)})).catch((function(e){F({render:"Failed to get shipping methods: "+e.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0}),k(!1)}));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]),wp.element.createElement(Rn.Provider,{value:{settings:i,updateSettings:s,settingsLoading:o,getAccessToken:u,updateAccessToken:m,removeAccessToken:p,gatewaySettings:d,gatewayLoading:y,shippingMethods:b,shippingMethodsLoading:S}},n)},An=function(){return(0,t.useContext)(Rn)};const Tn=function(){var e,t,n,r,o=An(),a=o.settings,l=o.gatewaySettings,i=o.gatewayLoading;return wp.element.createElement("div",{className:"col-span-full grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 items-stretch gap-6"},wp.element.createElement(gn,{orders:a.orders,gatewaySettings:l,gatewayLoading:i}),wp.element.createElement(fn,{wooAuto:a.wooAuto}),wp.element.createElement(dn,{squareAuto:a.squareAuto}),wp.element.createElement(pn,null),wp.element.createElement(hn,{wooAuto:a.wooAuto}),wp.element.createElement(xn,{wooAuto:a.wooAuto,squareAuto:a.squareAuto}),wp.element.createElement(vn,{squareWoo:null!==(e=null===(t=a.customers)||void 0===t||null===(t=t.auto)||void 0===t?void 0:t.squareWoo)&&void 0!==e?e:{is_active:!1,first_name:!1,last_name:!1,phone:!1,role:!1,address:!1}}),wp.element.createElement(wn,{wooSquare:null!==(n=null===(r=a.customers)||void 0===r||null===(r=r.auto)||void 0===r?void 0:r.wooSquare)&&void 0!==n?n:{is_active:!1,first_name:!1,last_name:!1,phone:!1,role:!1,address:!1}}))};function Fn(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Mn(e){return!!e&&!!e[Sr]}function Dn(e){var t;return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===kr}(e)||Array.isArray(e)||!!e[Er]||!!(null===(t=e.constructor)||void 0===t?void 0:t[Er])||Hn(e)||zn(e))}function Gn(e,t,n){void 0===n&&(n=!1),0===qn(e)?(n?Object.keys:Nr)(e).forEach((function(r){n&&"symbol"==typeof r||t(r,e[r],e)})):e.forEach((function(n,r){return t(r,n,e)}))}function qn(e){var t=e[Sr];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:Hn(e)?2:zn(e)?3:0}function Vn(e,t){return 2===qn(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Wn(e,t,n){var r=qn(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function Bn(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function Hn(e){return vr&&e instanceof Map}function zn(e){return wr&&e instanceof Set}function Un(e){return e.o||e.t}function $n(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Or(e);delete t[Sr];for(var n=Nr(t),r=0;r<n.length;r++){var o=n[r],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function Zn(e,t){return void 0===t&&(t=!1),Kn(e)||Mn(e)||!Dn(e)||(qn(e)>1&&(e.set=e.add=e.clear=e.delete=Yn),Object.freeze(e),t&&Gn(e,(function(e,t){return Zn(t,!0)}),!0)),e}function Yn(){Fn(2)}function Kn(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Xn(e){var t=Cr[e];return t||Fn(18,e),t}function Jn(){return gr}function Qn(e,t){t&&(Xn("Patches"),e.u=[],e.s=[],e.v=t)}function er(e){tr(e),e.p.forEach(rr),e.p=null}function tr(e){e===gr&&(gr=e.l)}function nr(e){return gr={p:[],l:gr,h:e,m:!0,_:0}}function rr(e){var t=e[Sr];0===t.i||1===t.i?t.j():t.g=!0}function or(e,t){t._=t.p.length;var n=t.p[0],r=void 0!==e&&e!==n;return t.h.O||Xn("ES5").S(t,e,r),r?(n[Sr].P&&(er(t),Fn(4)),Dn(e)&&(e=ar(t,e),t.l||ir(t,e)),t.u&&Xn("Patches").M(n[Sr].t,e,t.u,t.s)):e=ar(t,n,[]),er(t),t.u&&t.v(t.u,t.s),e!==xr?e:void 0}function ar(e,t,n){if(Kn(t))return t;var r=t[Sr];if(!r)return Gn(t,(function(o,a){return lr(e,r,t,o,a,n)}),!0),t;if(r.A!==e)return t;if(!r.P)return ir(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var o=4===r.i||5===r.i?r.o=$n(r.k):r.o,a=o,l=!1;3===r.i&&(a=new Set(o),o.clear(),l=!0),Gn(a,(function(t,a){return lr(e,r,o,t,a,n,l)})),ir(e,o,!1),n&&e.u&&Xn("Patches").N(r,n,e.u,e.s)}return r.o}function lr(e,t,n,r,o,a,l){if(Mn(o)){var i=ar(e,o,a&&t&&3!==t.i&&!Vn(t.R,r)?a.concat(r):void 0);if(Wn(n,r,i),!Mn(i))return;e.m=!1}else l&&n.add(o);if(Dn(o)&&!Kn(o)){if(!e.h.D&&e._<1)return;ar(e,o),t&&t.A.l||ir(e,o)}}function ir(e,t,n){void 0===n&&(n=!1),!e.l&&e.h.D&&e.m&&Zn(t,n)}function cr(e,t){var n=e[Sr];return(n?Un(n):e)[t]}function sr(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function ur(e){e.P||(e.P=!0,e.l&&ur(e.l))}function mr(e){e.o||(e.o=$n(e.t))}function pr(e,t,n){var r=Hn(t)?Xn("MapSet").F(t,n):zn(t)?Xn("MapSet").T(t,n):e.O?function(e,t){var n=Array.isArray(e),r={i:n?1:0,A:t?t.A:Jn(),P:!1,I:!1,R:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=r,a=jr;n&&(o=[r],a=Pr);var l=Proxy.revocable(o,a),i=l.revoke,c=l.proxy;return r.k=c,r.j=i,c}(t,n):Xn("ES5").J(t,n);return(n?n.A:Jn()).p.push(r),r}function fr(e){return Mn(e)||Fn(22,e),function e(t){if(!Dn(t))return t;var n,r=t[Sr],o=qn(t);if(r){if(!r.P&&(r.i<4||!Xn("ES5").K(r)))return r.t;r.I=!0,n=dr(t,o),r.I=!1}else n=dr(t,o);return Gn(n,(function(t,o){r&&function(e,t){return 2===qn(e)?e.get(t):e[t]}(r.t,t)===o||Wn(n,t,e(o))})),3===o?new Set(n):n}(e)}function dr(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return $n(e)}var hr,gr,yr="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),vr="undefined"!=typeof Map,wr="undefined"!=typeof Set,br="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,xr=yr?Symbol.for("immer-nothing"):((hr={})["immer-nothing"]=!0,hr),Er=yr?Symbol.for("immer-draftable"):"__$immer_draftable",Sr=yr?Symbol.for("immer-state"):"__$immer_state",kr=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Nr="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Or=Object.getOwnPropertyDescriptors||function(e){var t={};return Nr(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Cr={},jr={get:function(e,t){if(t===Sr)return e;var n=Un(e);if(!Vn(n,t))return function(e,t,n){var r,o=sr(t,n);return o?"value"in o?o.value:null===(r=o.get)||void 0===r?void 0:r.call(e.k):void 0}(e,n,t);var r=n[t];return e.I||!Dn(r)?r:r===cr(e.t,t)?(mr(e),e.o[t]=pr(e.A.h,r,e)):r},has:function(e,t){return t in Un(e)},ownKeys:function(e){return Reflect.ownKeys(Un(e))},set:function(e,t,n){var r=sr(Un(e),t);if(null==r?void 0:r.set)return r.set.call(e.k,n),!0;if(!e.P){var o=cr(Un(e),t),a=null==o?void 0:o[Sr];if(a&&a.t===n)return e.o[t]=n,e.R[t]=!1,!0;if(Bn(n,o)&&(void 0!==n||Vn(e.t,t)))return!0;mr(e),ur(e)}return e.o[t]===n&&(void 0!==n||t in e.o)||Number.isNaN(n)&&Number.isNaN(e.o[t])||(e.o[t]=n,e.R[t]=!0),!0},deleteProperty:function(e,t){return void 0!==cr(e.t,t)||t in e.t?(e.R[t]=!1,mr(e),ur(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=Un(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty:function(){Fn(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){Fn(12)}},Pr={};Gn(jr,(function(e,t){Pr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Pr.deleteProperty=function(e,t){return Pr.set.call(this,e,t,void 0)},Pr.set=function(e,t,n){return jr.set.call(this,e[0],t,n,e[0])};var Lr=function(){function e(e){var t=this;this.O=br,this.D=!0,this.produce=function(e,n,r){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var r=arguments.length,l=Array(r>1?r-1:0),i=1;i<r;i++)l[i-1]=arguments[i];return a.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(l))}))}}var l;if("function"!=typeof n&&Fn(6),void 0!==r&&"function"!=typeof r&&Fn(7),Dn(e)){var i=nr(t),c=pr(t,e,void 0),s=!0;try{l=n(c),s=!1}finally{s?er(i):tr(i)}return"undefined"!=typeof Promise&&l instanceof Promise?l.then((function(e){return Qn(i,r),or(e,i)}),(function(e){throw er(i),e})):(Qn(i,r),or(l,i))}if(!e||"object"!=typeof e){if(void 0===(l=n(e))&&(l=e),l===xr&&(l=void 0),t.D&&Zn(l,!0),r){var u=[],m=[];Xn("Patches").M(e,l,u,m),r(u,m)}return l}Fn(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var r=arguments.length,o=Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var r,o,a=t.produce(e,n,(function(e,t){r=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,r,o]})):[a,r,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){Dn(e)||Fn(8),Mn(e)&&(e=fr(e));var t=nr(this),n=pr(this,e,void 0);return n[Sr].C=!0,tr(t),n},t.finishDraft=function(e,t){var n=(e&&e[Sr]).A;return Qn(n,t),or(void 0,n)},t.setAutoFreeze=function(e){this.D=e},t.setUseProxies=function(e){e&&!br&&Fn(20),this.O=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));var o=Xn("Patches").$;return Mn(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),_r=new Lr,Rr=_r.produce;_r.produceWithPatches.bind(_r),_r.setAutoFreeze.bind(_r),_r.setUseProxies.bind(_r),_r.applyPatches.bind(_r),_r.createDraft.bind(_r),_r.finishDraft.bind(_r);const Ir=Rr;function Ar(e){return Ar="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ar(e)}function Tr(e){var t=function(e,t){if("object"!=Ar(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ar(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ar(t)?t:String(t)}function Fr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Mr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fr(Object(n),!0).forEach((function(t){var r,o,a;r=e,o=t,a=n[t],(o=Tr(o))in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Dr(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Gr="function"==typeof Symbol&&Symbol.observable||"@@observable",qr=function(){return Math.random().toString(36).substring(7).split("").join(".")},Vr={INIT:"@@redux/INIT"+qr(),REPLACE:"@@redux/REPLACE"+qr(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+qr()}};function Wr(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Dr(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Dr(1));return n(Wr)(e,t)}if("function"!=typeof e)throw new Error(Dr(2));var o=e,a=t,l=[],i=l,c=!1;function s(){i===l&&(i=l.slice())}function u(){if(c)throw new Error(Dr(3));return a}function m(e){if("function"!=typeof e)throw new Error(Dr(4));if(c)throw new Error(Dr(5));var t=!0;return s(),i.push(e),function(){if(t){if(c)throw new Error(Dr(6));t=!1,s();var n=i.indexOf(e);i.splice(n,1),l=null}}}function p(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(Dr(7));if(void 0===e.type)throw new Error(Dr(8));if(c)throw new Error(Dr(9));try{c=!0,a=o(a,e)}finally{c=!1}for(var t=l=i,n=0;n<t.length;n++)(0,t[n])();return e}return p({type:Vr.INIT}),(r={dispatch:p,subscribe:m,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error(Dr(10));o=e,p({type:Vr.REPLACE})}})[Gr]=function(){var e,t=m;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Dr(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Gr]=function(){return this},e},r}function Br(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}var a,l=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Vr.INIT}))throw new Error(Dr(12));if(void 0===n(void 0,{type:Vr.PROBE_UNKNOWN_ACTION()}))throw new Error(Dr(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var r=!1,o={},i=0;i<l.length;i++){var c=l[i],s=n[c],u=e[c],m=s(u,t);if(void 0===m)throw t&&t.type,new Error(Dr(14));o[c]=m,r=r||m!==u}return(r=r||l.length!==Object.keys(e).length)?o:e}}function Hr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function zr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),r=function(){throw new Error(Dr(15))},o={getState:n.getState,dispatch:function(){return r.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return r=Hr.apply(void 0,a)(n.dispatch),Mr(Mr({},n),{},{dispatch:r})}}}function Ur(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,r,e):t(o)}}}}var $r=Ur();$r.withExtraArgument=Ur;const Zr=$r;var Yr,Kr=(Yr=function(e,t){return Yr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Yr(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function __(){this.constructor=e}Yr(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}),Xr=function(e,t){for(var n=0,r=t.length,o=e.length;n<r;n++,o++)e[o]=t[n];return e},Jr=Object.defineProperty,Qr=Object.defineProperties,eo=Object.getOwnPropertyDescriptors,to=Object.getOwnPropertySymbols,no=Object.prototype.hasOwnProperty,ro=Object.prototype.propertyIsEnumerable,oo=function(e,t,n){return t in e?Jr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},ao=function(e,t){for(var n in t||(t={}))no.call(t,n)&&oo(e,n,t[n]);if(to)for(var r=0,o=to(t);r<o.length;r++)n=o[r],ro.call(t,n)&&oo(e,n,t[n]);return e},lo=function(e,t){return Qr(e,eo(t))},io="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Hr:Hr.apply(null,arguments)};function co(e,t){function n(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return ao(ao({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var so=function(e){function t(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return Kr(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Xr([void 0],e[0].concat(this)))):new(t.bind.apply(t,Xr([void 0],e.concat(this))))},t}(Array),uo=function(e){function t(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return Kr(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Xr([void 0],e[0].concat(this)))):new(t.bind.apply(t,Xr([void 0],e.concat(this))))},t}(Array);function mo(e){return Dn(e)?Ir(e,(function(){})):e}function po(e){var t,n={},r=[],o={addCase:function(e,t){var r="string"==typeof e?e:e.type;if(!r)throw new Error("`builder.addCase` cannot be called with an empty action type");if(r in n)throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");return n[r]=t,o},addMatcher:function(e,t){return r.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,r,t]}function fo(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,r="function"==typeof e.initialState?e.initialState:mo(e.initialState),o=e.reducers||{},a=Object.keys(o),l={},i={},c={};function s(){var t="function"==typeof e.extraReducers?po(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],l=void 0===a?[]:a,c=t[2],s=void 0===c?void 0:c,u=ao(ao({},o),i);return function(e,t,n,r){void 0===n&&(n=[]);var o,a=po(t),l=a[0],i=a[1],c=a[2];if("function"==typeof e)o=function(){return mo(e())};else{var s=mo(e);o=function(){return s}}function u(e,t){void 0===e&&(e=o());var n=Xr([l[t.type]],i.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[c]),n.reduce((function(e,n){if(n){var r;if(Mn(e))return void 0===(r=n(e,t))?e:r;if(Dn(e))return Ir(e,(function(e){return n(e,t)}));if(void 0===(r=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return e}),e)}return u.getInitialState=o,u}(r,(function(e){for(var t in u)e.addCase(t,u[t]);for(var n=0,r=l;n<r.length;n++){var o=r[n];e.addMatcher(o.matcher,o.reducer)}s&&e.addDefaultCase(s)}))}return a.forEach((function(e){var n,r,a=o[e],s=t+"/"+e;"reducer"in a?(n=a.reducer,r=a.prepare):n=a,l[e]=n,i[s]=n,c[e]=r?co(s,r):co(s)})),{name:t,reducer:function(e,t){return n||(n=s()),n(e,t)},actions:c,caseReducers:l,getInitialState:function(){return n||(n=s()),n.getInitialState()}}}var ho=["name","message","stack","code"],go=function(e,t){this.payload=e,this.meta=t},yo=function(e,t){this.payload=e,this.meta=t},vo=function(e){if("object"==typeof e&&null!==e){for(var t={},n=0,r=ho;n<r.length;n++){var o=r[n];"string"==typeof e[o]&&(t[o]=e[o])}return t}return{message:String(e)}},wo=function(){function e(e,t,n){var r=co(e+"/fulfilled",(function(e,t,n,r){return{payload:e,meta:lo(ao({},r||{}),{arg:n,requestId:t,requestStatus:"fulfilled"})}})),o=co(e+"/pending",(function(e,t,n){return{payload:void 0,meta:lo(ao({},n||{}),{arg:t,requestId:e,requestStatus:"pending"})}})),a=co(e+"/rejected",(function(e,t,r,o,a){return{payload:o,error:(n&&n.serializeError||vo)(e||"Rejected"),meta:lo(ao({},a||{}),{arg:r,requestId:t,rejectedWithValue:!!o,requestStatus:"rejected",aborted:"AbortError"===(null==e?void 0:e.name),condition:"ConditionError"===(null==e?void 0:e.name)})}})),l="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(i,c,s){var u,m=(null==n?void 0:n.idGenerator)?n.idGenerator(e):function(e){void 0===e&&(e=21);for(var t="",n=e;n--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t}(),p=new l;function f(e){u=e,p.abort()}var d=function(){return l=this,d=null,h=function(){var l,d,h,g,y,v;return function(e,t){var n,r,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!((o=(o=l.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}}(this,(function(w){switch(w.label){case 0:return w.trys.push([0,4,,5]),null===(b=g=null==(l=null==n?void 0:n.condition)?void 0:l.call(n,e,{getState:c,extra:s}))||"object"!=typeof b||"function"!=typeof b.then?[3,2]:[4,g];case 1:g=w.sent(),w.label=2;case 2:if(!1===g||p.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return y=new Promise((function(e,t){return p.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:u||"Aborted"})}))})),i(o(m,e,null==(d=null==n?void 0:n.getPendingMeta)?void 0:d.call(n,{requestId:m,arg:e},{getState:c,extra:s}))),[4,Promise.race([y,Promise.resolve(t(e,{dispatch:i,getState:c,extra:s,requestId:m,signal:p.signal,abort:f,rejectWithValue:function(e,t){return new go(e,t)},fulfillWithValue:function(e,t){return new yo(e,t)}})).then((function(t){if(t instanceof go)throw t;return t instanceof yo?r(t.payload,m,e,t.meta):r(t,m,e)}))])];case 3:return h=w.sent(),[3,5];case 4:return v=w.sent(),h=v instanceof go?a(null,m,e,v.payload,v.meta):a(v,m,e),[3,5];case 5:return n&&!n.dispatchConditionRejection&&a.match(h)&&h.meta.condition||i(h),[2,h]}var b}))},new Promise((function(e,t){var n=function(e){try{o(h.next(e))}catch(e){t(e)}},r=function(e){try{o(h.throw(e))}catch(e){t(e)}},o=function(t){return t.done?e(t.value):Promise.resolve(t.value).then(n,r)};o((h=h.apply(l,d)).next())}));var l,d,h}();return Object.assign(d,{abort:f,requestId:m,arg:e,unwrap:function(){return d.then(bo)}})}}),{pending:o,rejected:a,fulfilled:r,typePrefix:e})}return e.withTypes=function(){return e},e}();function bo(e){if(e.meta&&e.meta.rejectedWithValue)throw e.payload;if(e.error)throw e.error;return e.payload}Object.assign;var xo="listenerMiddleware";co(xo+"/add"),co(xo+"/removeAll"),co(xo+"/remove"),"function"==typeof queueMicrotask&&queueMicrotask.bind("undefined"!=typeof window?window:void 0!==o.g?o.g:globalThis);function Eo(e){return Eo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Eo(e)}function So(){So=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Eo(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Eo(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function ko(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function No(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){ko(a,r,o,l,i,"next",e)}function i(e){ko(a,r,o,l,i,"throw",e)}l(void 0)}))}}"undefined"!=typeof window&&window.requestAnimationFrame&&window.requestAnimationFrame,function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[Sr];return jr.get(t,e)},set:function(t){var n=this[Sr];jr.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][Sr];if(!o.P)switch(o.i){case 5:r(o)&&ur(o);break;case 4:n(o)&&ur(o)}}}function n(e){for(var t=e.t,n=e.k,r=Nr(n),o=r.length-1;o>=0;o--){var a=r[o];if(a!==Sr){var l=t[a];if(void 0===l&&!Vn(t,a))return!0;var i=n[a],c=i&&i[Sr];if(c?c.t!==l:!Bn(i,l))return!0}}var s=!!t[Sr];return r.length!==Nr(t).length+(s?0:1)}function r(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var r=0;r<t.length;r++)if(!t.hasOwnProperty(r))return!0;return!1}var o={};!function(e,t){Cr[e]||(Cr[e]=t)}("ES5",{J:function(t,n){var r=Array.isArray(t),o=function(t,n){if(t){for(var r=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(r,""+o,e(o,!0));return r}var a=Or(n);delete a[Sr];for(var l=Nr(a),i=0;i<l.length;i++){var c=l[i];a[c]=e(c,t||!!a[c].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(r,t),a={i:r?5:4,A:n?n.A:Jn(),P:!1,I:!1,R:{},l:n,t,k:o,o:null,g:!1,C:!1};return Object.defineProperty(o,Sr,{value:a,writable:!0}),o},S:function(e,n,o){o?Mn(n)&&n[Sr].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Sr];if(n){var o=n.t,a=n.k,l=n.R,i=n.i;if(4===i)Gn(a,(function(t){t!==Sr&&(void 0!==o[t]||Vn(o,t)?l[t]||e(a[t]):(l[t]=!0,ur(n)))})),Gn(o,(function(e){void 0!==a[e]||Vn(a,e)||(l[e]=!1,ur(n))}));else if(5===i){if(r(n)&&(ur(n),l.length=!0),a.length<o.length)for(var c=a.length;c<o.length;c++)l[c]=!1;else for(var s=o.length;s<a.length;s++)l[s]=!0;for(var u=Math.min(a.length,o.length),m=0;m<u;m++)a.hasOwnProperty(m)||(l[m]=!0),void 0===l[m]&&e(a[m])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):r(e)}})}();var Oo=wo("license/fetchLicense",No(So().mark((function e(){var t;return So().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ut({path:"/sws/v1/licence"});case 2:return t=e.sent,e.abrupt("return",t.licence);case 4:case"end":return e.stop()}}),e)})))),Co=fo({name:"license",initialState:{data:{is_valid:!1},loading:!0,error:null},reducers:{removeLicense:function(e){e.data=null},setLicense:function(e,t){e.data=t.payload}},extraReducers:function(e){e.addCase(Oo.pending,(function(e){e.loading=!0,e.error=null})).addCase(Oo.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload})).addCase(Oo.rejected,(function(e,t){e.loading=!1,e.error=t.error.message}))}});const jo=Co.reducer;function Po(e,t){return"function"==typeof e?e(t):e}function Lo(e,t){return n=>{t.setState((t=>({...t,[e]:Po(n,t[e])})))}}function _o(e){return e instanceof Function}function Ro(e,t,n){let r,o=[];return a=>{let l;n.key&&n.debug&&(l=Date.now());const i=e(a);if(i.length===o.length&&!i.some(((e,t)=>o[t]!==e)))return r;let c;if(o=i,n.key&&n.debug&&(c=Date.now()),r=t(...i),null==n||null==n.onChange||n.onChange(r),n.key&&n.debug&&null!=n&&n.debug()){const e=Math.round(100*(Date.now()-l))/100,t=Math.round(100*(Date.now()-c))/100,r=t/16,o=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${o(t,5)} /${o(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,null==n?void 0:n.key)}return r}}function Io(e,t,n,r){return{debug:()=>{var n;return null!=(n=null==e?void 0:e.debugAll)?n:e[t]},key:!1,onChange:r}}Co.actions.removeLicense,Co.actions.setLicense;const Ao="debugHeaders";function To(e,t,n){var r;let o={id:null!=(r=n.id)?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(o),e},getContext:()=>({table:e,header:o,column:t})};return e._features.forEach((t=>{null==t.createHeader||t.createHeader(o,e)})),o}const Fo={createTable:e=>{e.getHeaderGroups=Ro((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((t,n,r,o)=>{var a,l;const i=null!=(a=null==r?void 0:r.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?a:[],c=null!=(l=null==o?void 0:o.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?l:[];return Mo(t,[...i,...n.filter((e=>!(null!=r&&r.includes(e.id)||null!=o&&o.includes(e.id)))),...c],e)}),Io(e.options,Ao)),e.getCenterHeaderGroups=Ro((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((t,n,r,o)=>Mo(t,n=n.filter((e=>!(null!=r&&r.includes(e.id)||null!=o&&o.includes(e.id)))),e,"center")),Io(e.options,Ao)),e.getLeftHeaderGroups=Ro((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left]),((t,n,r)=>{var o;const a=null!=(o=null==r?void 0:r.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?o:[];return Mo(t,a,e,"left")}),Io(e.options,Ao)),e.getRightHeaderGroups=Ro((()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right]),((t,n,r)=>{var o;const a=null!=(o=null==r?void 0:r.map((e=>n.find((t=>t.id===e)))).filter(Boolean))?o:[];return Mo(t,a,e,"right")}),Io(e.options,Ao)),e.getFooterGroups=Ro((()=>[e.getHeaderGroups()]),(e=>[...e].reverse()),Io(e.options,Ao)),e.getLeftFooterGroups=Ro((()=>[e.getLeftHeaderGroups()]),(e=>[...e].reverse()),Io(e.options,Ao)),e.getCenterFooterGroups=Ro((()=>[e.getCenterHeaderGroups()]),(e=>[...e].reverse()),Io(e.options,Ao)),e.getRightFooterGroups=Ro((()=>[e.getRightHeaderGroups()]),(e=>[...e].reverse()),Io(e.options,Ao)),e.getFlatHeaders=Ro((()=>[e.getHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),Io(e.options,Ao)),e.getLeftFlatHeaders=Ro((()=>[e.getLeftHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),Io(e.options,Ao)),e.getCenterFlatHeaders=Ro((()=>[e.getCenterHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),Io(e.options,Ao)),e.getRightFlatHeaders=Ro((()=>[e.getRightHeaderGroups()]),(e=>e.map((e=>e.headers)).flat()),Io(e.options,Ao)),e.getCenterLeafHeaders=Ro((()=>[e.getCenterFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),Io(e.options,Ao)),e.getLeftLeafHeaders=Ro((()=>[e.getLeftFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),Io(e.options,Ao)),e.getRightLeafHeaders=Ro((()=>[e.getRightFlatHeaders()]),(e=>e.filter((e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}))),Io(e.options,Ao)),e.getLeafHeaders=Ro((()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()]),((e,t,n)=>{var r,o,a,l,i,c;return[...null!=(r=null==(o=e[0])?void 0:o.headers)?r:[],...null!=(a=null==(l=t[0])?void 0:l.headers)?a:[],...null!=(i=null==(c=n[0])?void 0:c.headers)?i:[]].map((e=>e.getLeafHeaders())).flat()}),Io(e.options,Ao))}};function Mo(e,t,n,r){var o,a;let l=0;const i=function(e,t){void 0===t&&(t=1),l=Math.max(l,t),e.filter((e=>e.getIsVisible())).forEach((e=>{var n;null!=(n=e.columns)&&n.length&&i(e.columns,t+1)}),0)};i(e);let c=[];const s=(e,t)=>{const o={depth:t,id:[r,`${t}`].filter(Boolean).join("_"),headers:[]},a=[];e.forEach((e=>{const l=[...a].reverse()[0];let i,c=!1;if(e.column.depth===o.depth&&e.column.parent?i=e.column.parent:(i=e.column,c=!0),l&&(null==l?void 0:l.column)===i)l.subHeaders.push(e);else{const o=To(n,i,{id:[r,t,i.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:c,placeholderId:c?`${a.filter((e=>e.column===i)).length}`:void 0,depth:t,index:a.length});o.subHeaders.push(e),a.push(o)}o.headers.push(e),e.headerGroup=o})),c.push(o),t>0&&s(a,t-1)},u=t.map(((e,t)=>To(n,e,{depth:l,index:t})));s(u,l-1),c.reverse();const m=e=>e.filter((e=>e.column.getIsVisible())).map((e=>{let t=0,n=0,r=[0];return e.subHeaders&&e.subHeaders.length?(r=[],m(e.subHeaders).forEach((e=>{let{colSpan:n,rowSpan:o}=e;t+=n,r.push(o)}))):t=1,n+=Math.min(...r),e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}}));return m(null!=(o=null==(a=c[0])?void 0:a.headers)?o:[]),c}const Do={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Go={getDefaultColumnDef:()=>Do,getInitialState:e=>({columnSizing:{},columnSizingInfo:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]},...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Lo("columnSizing",e),onColumnSizingInfoChange:Lo("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,o;const a=t.getState().columnSizing[e.id];return Math.min(Math.max(null!=(n=e.columnDef.minSize)?n:Do.minSize,null!=(r=null!=a?a:e.columnDef.size)?r:Do.size),null!=(o=e.columnDef.maxSize)?o:Do.maxSize)},e.getStart=Ro((e=>[e,wa(t,e),t.getState().columnSizing]),((t,n)=>n.slice(0,e.getIndex(t)).reduce(((e,t)=>e+t.getSize()),0)),Io(t.options,"debugColumns")),e.getAfter=Ro((e=>[e,wa(t,e),t.getState().columnSizing]),((t,n)=>n.slice(e.getIndex(t)+1).reduce(((e,t)=>e+t.getSize()),0)),Io(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing((t=>{let{[e.id]:n,...r}=t;return r}))},e.getCanResize=()=>{var n,r;return(null==(n=e.columnDef.enableResizing)||n)&&(null==(r=t.options.enableColumnResizing)||r)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0;const n=e=>{var r;e.subHeaders.length?e.subHeaders.forEach(n):t+=null!=(r=e.column.getSize())?r:0};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),o=null==r?void 0:r.getCanResize();return a=>{if(!r||!o)return;if(null==a.persist||a.persist(),Vo(a)&&a.touches&&a.touches.length>1)return;const l=e.getSize(),i=e?e.getLeafHeaders().map((e=>[e.column.id,e.column.getSize()])):[[r.id,r.getSize()]],c=Vo(a)?Math.round(a.touches[0].clientX):a.clientX,s={},u=(e,n)=>{"number"==typeof n&&(t.setColumnSizingInfo((e=>{var r,o;const a="rtl"===t.options.columnResizeDirection?-1:1,l=(n-(null!=(r=null==e?void 0:e.startOffset)?r:0))*a,i=Math.max(l/(null!=(o=null==e?void 0:e.startSize)?o:0),-.999999);return e.columnSizingStart.forEach((e=>{let[t,n]=e;s[t]=Math.round(100*Math.max(n+n*i,0))/100})),{...e,deltaOffset:l,deltaPercentage:i}})),"onChange"!==t.options.columnResizeMode&&"end"!==e||t.setColumnSizing((e=>({...e,...s}))))},m=e=>u("move",e),p=e=>{u("end",e),t.setColumnSizingInfo((e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]})))},f=n||"undefined"!=typeof document?document:null,d={moveHandler:e=>m(e.clientX),upHandler:e=>{null==f||f.removeEventListener("mousemove",d.moveHandler),null==f||f.removeEventListener("mouseup",d.upHandler),p(e.clientX)}},h={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),m(e.touches[0].clientX),!1),upHandler:e=>{var t;null==f||f.removeEventListener("touchmove",h.moveHandler),null==f||f.removeEventListener("touchend",h.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),p(null==(t=e.touches[0])?void 0:t.clientX)}},g=!!function(){if("boolean"==typeof qo)return qo;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch(t){e=!1}return qo=e,qo}()&&{passive:!1};Vo(a)?(null==f||f.addEventListener("touchmove",h.moveHandler,g),null==f||f.addEventListener("touchend",h.upHandler,g)):(null==f||f.addEventListener("mousemove",d.moveHandler,g),null==f||f.addEventListener("mouseup",d.upHandler,g)),t.setColumnSizingInfo((e=>({...e,startOffset:c,startSize:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:i,isResizingColumn:r.id})))}}},createTable:e=>{e.setColumnSizing=t=>null==e.options.onColumnSizingChange?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>null==e.options.onColumnSizingInfoChange?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:null!=(n=e.initialState.columnSizing)?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}:null!=(n=e.initialState.columnSizingInfo)?n:{startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]})},e.getTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getLeftTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getLeftHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getCenterTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getCenterHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0},e.getRightTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getRightHeaderGroups()[0])?void 0:n.headers.reduce(((e,t)=>e+t.getSize()),0))?t:0}}};let qo=null;function Vo(e){return"touchstart"===e.type}const Wo={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Lo("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,o;if(t){if(null!=(r=null!=(o=e.options.autoResetAll)?o:e.options.autoResetExpanded)?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue((()=>{e.resetExpanded(),n=!1}))}}else e._queue((()=>{t=!0}))},e.setExpanded=t=>null==e.options.onExpandedChange?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{(null!=t?t:!e.getIsAllRowsExpanded())?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{var n,r;e.setExpanded(t?{}:null!=(n=null==(r=e.initialState)?void 0:r.expanded)?n:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some((e=>e.getCanExpand())),e.getToggleAllRowsExpandedHandler=()=>t=>{null==t.persist||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const t=e.getState().expanded;return!0===t||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{const t=e.getState().expanded;return"boolean"==typeof t?!0===t:!!Object.keys(t).length&&!e.getRowModel().flatRows.some((e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(!0===e.getState().expanded?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach((e=>{const n=e.split(".");t=Math.max(t,n.length)})),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded((r=>{var o;const a=!0===r||!(null==r||!r[e.id]);let l={};if(!0===r?Object.keys(t.getRowModel().rowsById).forEach((e=>{l[e]=!0})):l=r,n=null!=(o=n)?o:!a,!a&&n)return{...l,[e.id]:!0};if(a&&!n){const{[e.id]:t,...n}=l;return n}return r}))},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!(null!=(n=null==t.options.getIsRowExpanded?void 0:t.options.getIsRowExpanded(e))?n:!0===r||(null==r?void 0:r[e.id]))},e.getCanExpand=()=>{var n,r,o;return null!=(n=null==t.options.getRowCanExpand?void 0:t.options.getRowCanExpand(e))?n:(null==(r=t.options.enableExpanding)||r)&&!(null==(o=e.subRows)||!o.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},Bo=(e,t,n)=>{var r;const o=n.toLowerCase();return Boolean(null==(r=e.getValue(t))||null==(r=r.toString())||null==(r=r.toLowerCase())?void 0:r.includes(o))};Bo.autoRemove=e=>Qo(e);const Ho=(e,t,n)=>{var r;return Boolean(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.includes(n))};Ho.autoRemove=e=>Qo(e);const zo=(e,t,n)=>{var r;return(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.toLowerCase())===(null==n?void 0:n.toLowerCase())};zo.autoRemove=e=>Qo(e);const Uo=(e,t,n)=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)};Uo.autoRemove=e=>Qo(e)||!(null!=e&&e.length);const $o=(e,t,n)=>!n.some((n=>{var r;return!(null!=(r=e.getValue(t))&&r.includes(n))}));$o.autoRemove=e=>Qo(e)||!(null!=e&&e.length);const Zo=(e,t,n)=>n.some((n=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)}));Zo.autoRemove=e=>Qo(e)||!(null!=e&&e.length);const Yo=(e,t,n)=>e.getValue(t)===n;Yo.autoRemove=e=>Qo(e);const Ko=(e,t,n)=>e.getValue(t)==n;Ko.autoRemove=e=>Qo(e);const Xo=(e,t,n)=>{let[r,o]=n;const a=e.getValue(t);return a>=r&&a<=o};Xo.resolveFilterValue=e=>{let[t,n]=e,r="number"!=typeof t?parseFloat(t):t,o="number"!=typeof n?parseFloat(n):n,a=null===t||Number.isNaN(r)?-1/0:r,l=null===n||Number.isNaN(o)?1/0:o;if(a>l){const e=a;a=l,l=e}return[a,l]},Xo.autoRemove=e=>Qo(e)||Qo(e[0])&&Qo(e[1]);const Jo={includesString:Bo,includesStringSensitive:Ho,equalsString:zo,arrIncludes:Uo,arrIncludesAll:$o,arrIncludesSome:Zo,equals:Yo,weakEquals:Ko,inNumberRange:Xo};function Qo(e){return null==e||""===e}const ea={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],globalFilter:void 0,...e}),getDefaultOptions:e=>({onColumnFiltersChange:Lo("columnFilters",e),onGlobalFilterChange:Lo("globalFilter",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100,globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=null==(n=e.getCoreRowModel().flatRows[0])||null==(n=n._getAllCellsByColumnId()[t.id])?void 0:n.getValue();return"string"==typeof r||"number"==typeof r}}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=null==n?void 0:n.getValue(e.id);return"string"==typeof r?Jo.includesString:"number"==typeof r?Jo.inNumberRange:"boolean"==typeof r||null!==r&&"object"==typeof r?Jo.equals:Array.isArray(r)?Jo.arrIncludes:Jo.weakEquals},e.getFilterFn=()=>{var n,r;return _o(e.columnDef.filterFn)?e.columnDef.filterFn:"auto"===e.columnDef.filterFn?e.getAutoFilterFn():null!=(n=null==(r=t.options.filterFns)?void 0:r[e.columnDef.filterFn])?n:Jo[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,o;return(null==(n=e.columnDef.enableColumnFilter)||n)&&(null==(r=t.options.enableColumnFilters)||r)&&(null==(o=t.options.enableFilters)||o)&&!!e.accessorFn},e.getCanGlobalFilter=()=>{var n,r,o,a;return(null==(n=e.columnDef.enableGlobalFilter)||n)&&(null==(r=t.options.enableGlobalFilter)||r)&&(null==(o=t.options.enableFilters)||o)&&(null==(a=null==t.options.getColumnCanGlobalFilter?void 0:t.options.getColumnCanGlobalFilter(e))||a)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return null==(n=t.getState().columnFilters)||null==(n=n.find((t=>t.id===e.id)))?void 0:n.value},e.getFilterIndex=()=>{var n,r;return null!=(n=null==(r=t.getState().columnFilters)?void 0:r.findIndex((t=>t.id===e.id)))?n:-1},e.setFilterValue=n=>{t.setColumnFilters((t=>{const r=e.getFilterFn(),o=null==t?void 0:t.find((t=>t.id===e.id)),a=Po(n,o?o.value:void 0);var l;if(ta(r,a,e))return null!=(l=null==t?void 0:t.filter((t=>t.id!==e.id)))?l:[];const i={id:e.id,value:a};var c;return o?null!=(c=null==t?void 0:t.map((t=>t.id===e.id?i:t)))?c:[]:null!=t&&t.length?[...t,i]:[i]}))},e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Jo.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return _o(r)?r:"auto"===r?e.getGlobalAutoFilterFn():null!=(t=null==(n=e.options.filterFns)?void 0:n[r])?t:Jo[r]},e.setColumnFilters=t=>{const n=e.getAllLeafColumns();null==e.options.onColumnFiltersChange||e.options.onColumnFiltersChange((e=>{var r;return null==(r=Po(t,e))?void 0:r.filter((e=>{const t=n.find((t=>t.id===e.id));return!t||!ta(t.getFilterFn(),e.value,t)}))}))},e.setGlobalFilter=t=>{null==e.options.onGlobalFilterChange||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.columnFilters)?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel()),e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}};function ta(e,t,n){return!(!e||!e.autoRemove)&&e.autoRemove(t,n)||void 0===t||"string"==typeof t&&!t}const na={sum:(e,t,n)=>n.reduce(((t,n)=>{const r=n.getValue(e);return t+("number"==typeof r?r:0)}),0),min:(e,t,n)=>{let r;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(r>n||void 0===r&&n>=n)&&(r=n)})),r},max:(e,t,n)=>{let r;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(r<n||void 0===r&&n>=n)&&(r=n)})),r},extent:(e,t,n)=>{let r,o;return n.forEach((t=>{const n=t.getValue(e);null!=n&&(void 0===r?n>=n&&(r=o=n):(r>n&&(r=n),o<n&&(o=n)))})),[r,o]},mean:(e,t)=>{let n=0,r=0;if(t.forEach((t=>{let o=t.getValue(e);null!=o&&(o=+o)>=o&&(++n,r+=o)})),n)return r/n},median:(e,t)=>{if(!t.length)return;const n=t.map((t=>t.getValue(e)));if(!function(e){return Array.isArray(e)&&e.every((e=>"number"==typeof e))}(n))return;if(1===n.length)return n[0];const r=Math.floor(n.length/2),o=n.sort(((e,t)=>e-t));return n.length%2!=0?o[r]:(o[r-1]+o[r])/2},unique:(e,t)=>Array.from(new Set(t.map((t=>t.getValue(e)))).values()),uniqueCount:(e,t)=>new Set(t.map((t=>t.getValue(e)))).size,count:(e,t)=>t.length},ra={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return null!=(t=null==(n=e.getValue())||null==n.toString?void 0:n.toString())?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Lo("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping((t=>null!=t&&t.includes(e.id)?t.filter((t=>t!==e.id)):[...null!=t?t:[],e.id]))},e.getCanGroup=()=>{var n,r,o,a;return null!=(n=null==(r=null!=(o=null==(a=e.columnDef.enableGrouping)||a)?o:t.options.enableGrouping)||r)?n:!!e.accessorFn},e.getIsGrouped=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=null==n?void 0:n.getValue(e.id);return"number"==typeof r?na.sum:"[object Date]"===Object.prototype.toString.call(r)?na.extent:void 0},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return _o(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:"auto"===e.columnDef.aggregationFn?e.getAutoAggregationFn():null!=(n=null==(r=t.options.aggregationFns)?void 0:r[e.columnDef.aggregationFn])?n:na[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>null==e.options.onGroupingChange?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.grouping)?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return null!=r&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!(null==(t=n.subRows)||!t.length)}}},oa={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Lo("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Ro((e=>[wa(t,e)]),(t=>t.findIndex((t=>t.id===e.id))),Io(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return(null==(r=wa(t,n)[0])?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const o=wa(t,n);return(null==(r=o[o.length-1])?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>null==e.options.onColumnOrderChange?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:null!=(n=e.initialState.columnOrder)?n:[])},e._getOrderColumnsFn=Ro((()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode]),((e,t,n)=>r=>{let o=[];if(null!=e&&e.length){const t=[...e],n=[...r];for(;n.length&&t.length;){const e=t.shift(),r=n.findIndex((t=>t.id===e));r>-1&&o.push(n.splice(r,1)[0])}o=[...o,...n]}else o=r;return function(e,t,n){if(null==t||!t.length||!n)return e;const r=e.filter((e=>!t.includes(e.id)));if("remove"===n)return r;return[...t.map((t=>e.find((e=>e.id===t)))).filter(Boolean),...r]}(o,t,n)}),Io(e.options,"debugTable"))}},aa={getInitialState:e=>({...e,pagination:{pageIndex:0,pageSize:10,...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Lo("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,o;if(t){if(null!=(r=null!=(o=e.options.autoResetAll)?o:e.options.autoResetPageIndex)?r:!e.options.manualPagination){if(n)return;n=!0,e._queue((()=>{e.resetPageIndex(),n=!1}))}}else e._queue((()=>{t=!0}))},e.setPagination=t=>null==e.options.onPaginationChange?void 0:e.options.onPaginationChange((e=>Po(t,e))),e.resetPagination=t=>{var n;e.setPagination(t?{pageIndex:0,pageSize:10}:null!=(n=e.initialState.pagination)?n:{pageIndex:0,pageSize:10})},e.setPageIndex=t=>{e.setPagination((n=>{let r=Po(t,n.pageIndex);const o=void 0===e.options.pageCount||-1===e.options.pageCount?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return r=Math.max(0,Math.min(r,o)),{...n,pageIndex:r}}))},e.resetPageIndex=t=>{var n,r;e.setPageIndex(t?0:null!=(n=null==(r=e.initialState)||null==(r=r.pagination)?void 0:r.pageIndex)?n:0)},e.resetPageSize=t=>{var n,r;e.setPageSize(t?10:null!=(n=null==(r=e.initialState)||null==(r=r.pagination)?void 0:r.pageSize)?n:10)},e.setPageSize=t=>{e.setPagination((e=>{const n=Math.max(1,Po(t,e.pageSize)),r=e.pageSize*e.pageIndex,o=Math.floor(r/n);return{...e,pageIndex:o,pageSize:n}}))},e.setPageCount=t=>e.setPagination((n=>{var r;let o=Po(t,null!=(r=e.options.pageCount)?r:-1);return"number"==typeof o&&(o=Math.max(-1,o)),{...n,pageCount:o}})),e.getPageOptions=Ro((()=>[e.getPageCount()]),(e=>{let t=[];return e&&e>0&&(t=[...new Array(e)].fill(null).map(((e,t)=>t))),t}),Io(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return-1===n||0!==n&&t<n-1},e.previousPage=()=>e.setPageIndex((e=>e-1)),e.nextPage=()=>e.setPageIndex((e=>e+1)),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var t;return null!=(t=e.options.pageCount)?t:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var t;return null!=(t=e.options.rowCount)?t:e.getPrePaginationRowModel().rows.length}}},la={getInitialState:e=>({columnPinning:{left:[],right:[]},rowPinning:{top:[],bottom:[]},...e}),getDefaultOptions:e=>({onColumnPinningChange:Lo("columnPinning",e),onRowPinningChange:Lo("rowPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map((e=>e.id)).filter(Boolean);t.setColumnPinning((e=>{var t,o,a,l,i,c;return"right"===n?{left:(null!=(a=null==e?void 0:e.left)?a:[]).filter((e=>!(null!=r&&r.includes(e)))),right:[...(null!=(l=null==e?void 0:e.right)?l:[]).filter((e=>!(null!=r&&r.includes(e)))),...r]}:"left"===n?{left:[...(null!=(i=null==e?void 0:e.left)?i:[]).filter((e=>!(null!=r&&r.includes(e)))),...r],right:(null!=(c=null==e?void 0:e.right)?c:[]).filter((e=>!(null!=r&&r.includes(e))))}:{left:(null!=(t=null==e?void 0:e.left)?t:[]).filter((e=>!(null!=r&&r.includes(e)))),right:(null!=(o=null==e?void 0:e.right)?o:[]).filter((e=>!(null!=r&&r.includes(e))))}}))},e.getCanPin=()=>e.getLeafColumns().some((e=>{var n,r,o;return(null==(n=e.columnDef.enablePinning)||n)&&(null==(r=null!=(o=t.options.enableColumnPinning)?o:t.options.enablePinning)||r)})),e.getIsPinned=()=>{const n=e.getLeafColumns().map((e=>e.id)),{left:r,right:o}=t.getState().columnPinning,a=n.some((e=>null==r?void 0:r.includes(e))),l=n.some((e=>null==o?void 0:o.includes(e)));return a?"left":!!l&&"right"},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();return o?null!=(n=null==(r=t.getState().columnPinning)||null==(r=r[o])?void 0:r.indexOf(e.id))?n:-1:0}},createRow:(e,t)=>{e.pin=(n,r,o)=>{const a=r?e.getLeafRows().map((e=>{let{id:t}=e;return t})):[],l=o?e.getParentRows().map((e=>{let{id:t}=e;return t})):[],i=new Set([...l,e.id,...a]);t.setRowPinning((e=>{var t,r,o,a,l,c;return"bottom"===n?{top:(null!=(o=null==e?void 0:e.top)?o:[]).filter((e=>!(null!=i&&i.has(e)))),bottom:[...(null!=(a=null==e?void 0:e.bottom)?a:[]).filter((e=>!(null!=i&&i.has(e)))),...Array.from(i)]}:"top"===n?{top:[...(null!=(l=null==e?void 0:e.top)?l:[]).filter((e=>!(null!=i&&i.has(e)))),...Array.from(i)],bottom:(null!=(c=null==e?void 0:e.bottom)?c:[]).filter((e=>!(null!=i&&i.has(e))))}:{top:(null!=(t=null==e?void 0:e.top)?t:[]).filter((e=>!(null!=i&&i.has(e)))),bottom:(null!=(r=null==e?void 0:e.bottom)?r:[]).filter((e=>!(null!=i&&i.has(e))))}}))},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:o}=t.options;return"function"==typeof r?r(e):null==(n=null!=r?r:o)||n},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:o}=t.getState().rowPinning,a=n.some((e=>null==r?void 0:r.includes(e))),l=n.some((e=>null==o?void 0:o.includes(e)));return a?"top":!!l&&"bottom"},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();if(!o)return-1;const a=null==(n=t._getPinnedRows(o))?void 0:n.map((e=>{let{id:t}=e;return t}));return null!=(r=null==a?void 0:a.indexOf(e.id))?r:-1},e.getCenterVisibleCells=Ro((()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right]),((e,t,n)=>{const r=[...null!=t?t:[],...null!=n?n:[]];return e.filter((e=>!r.includes(e.column.id)))}),Io(t.options,"debugRows")),e.getLeftVisibleCells=Ro((()=>[e._getAllVisibleCells(),t.getState().columnPinning.left]),((e,t)=>{const n=(null!=t?t:[]).map((t=>e.find((e=>e.column.id===t)))).filter(Boolean).map((e=>({...e,position:"left"})));return n}),Io(t.options,"debugRows")),e.getRightVisibleCells=Ro((()=>[e._getAllVisibleCells(),t.getState().columnPinning.right]),((e,t)=>{const n=(null!=t?t:[]).map((t=>e.find((e=>e.column.id===t)))).filter(Boolean).map((e=>({...e,position:"right"})));return n}),Io(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>null==e.options.onColumnPinningChange?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?{left:[],right:[]}:null!=(n=null==(r=e.initialState)?void 0:r.columnPinning)?n:{left:[],right:[]})},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;var o,a;return t?Boolean(null==(n=r[t])?void 0:n.length):Boolean((null==(o=r.left)?void 0:o.length)||(null==(a=r.right)?void 0:a.length))},e.getLeftLeafColumns=Ro((()=>[e.getAllLeafColumns(),e.getState().columnPinning.left]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.id===t)))).filter(Boolean)),Io(e.options,"debugColumns")),e.getRightLeafColumns=Ro((()=>[e.getAllLeafColumns(),e.getState().columnPinning.right]),((e,t)=>(null!=t?t:[]).map((t=>e.find((e=>e.id===t)))).filter(Boolean)),Io(e.options,"debugColumns")),e.getCenterLeafColumns=Ro((()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right]),((e,t,n)=>{const r=[...null!=t?t:[],...null!=n?n:[]];return e.filter((e=>!r.includes(e.id)))}),Io(e.options,"debugColumns")),e.setRowPinning=t=>null==e.options.onRowPinningChange?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?{top:[],bottom:[]}:null!=(n=null==(r=e.initialState)?void 0:r.rowPinning)?n:{top:[],bottom:[]})},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;var o,a;return t?Boolean(null==(n=r[t])?void 0:n.length):Boolean((null==(o=r.top)?void 0:o.length)||(null==(a=r.bottom)?void 0:a.length))},e._getPinnedRows=Ro((t=>[e.getRowModel().rows,e.getState().rowPinning[t],t]),((t,n,r)=>{var o;return(null==(o=e.options.keepPinnedRows)||o?(null!=n?n:[]).map((t=>{const n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null})):(null!=n?n:[]).map((e=>t.find((t=>t.id===e))))).filter(Boolean).map((e=>({...e,position:r})))}),Io(e.options,"debugRows")),e.getTopRows=()=>e._getPinnedRows("top"),e.getBottomRows=()=>e._getPinnedRows("bottom"),e.getCenterRows=Ro((()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom]),((e,t,n)=>{const r=new Set([...null!=t?t:[],...null!=n?n:[]]);return e.filter((e=>!r.has(e.id)))}),Io(e.options,"debugRows"))}},ia={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Lo("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>null==e.options.onRowSelectionChange?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:null!=(n=e.initialState.rowSelection)?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection((n=>{t=void 0!==t?t:!e.getIsAllRowsSelected();const r={...n},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach((e=>{e.getCanSelect()&&(r[e.id]=!0)})):o.forEach((e=>{delete r[e.id]})),r}))},e.toggleAllPageRowsSelected=t=>e.setRowSelection((n=>{const r=void 0!==t?t:!e.getIsAllPageRowsSelected(),o={...n};return e.getRowModel().rows.forEach((t=>{ca(o,t.id,r,!0,e)})),o})),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Ro((()=>[e.getState().rowSelection,e.getCoreRowModel()]),((t,n)=>Object.keys(t).length?sa(e,n):{rows:[],flatRows:[],rowsById:{}}),Io(e.options,"debugTable")),e.getFilteredSelectedRowModel=Ro((()=>[e.getState().rowSelection,e.getFilteredRowModel()]),((t,n)=>Object.keys(t).length?sa(e,n):{rows:[],flatRows:[],rowsById:{}}),Io(e.options,"debugTable")),e.getGroupedSelectedRowModel=Ro((()=>[e.getState().rowSelection,e.getSortedRowModel()]),((t,n)=>Object.keys(t).length?sa(e,n):{rows:[],flatRows:[],rowsById:{}}),Io(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=Boolean(t.length&&Object.keys(n).length);return r&&t.some((e=>e.getCanSelect()&&!n[e.id]))&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter((e=>e.getCanSelect())),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some((e=>!n[e.id]))&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys(null!=(t=e.getState().rowSelection)?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter((e=>e.getCanSelect())).some((e=>e.getIsSelected()||e.getIsSomeSelected()))},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const o=e.getIsSelected();t.setRowSelection((a=>{var l;if(n=void 0!==n?n:!o,e.getCanSelect()&&o===n)return a;const i={...a};return ca(i,e.id,n,null==(l=null==r?void 0:r.selectChildren)||l,t),i}))},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return ua(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return"some"===ma(e,n)},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return"all"===ma(e,n)},e.getCanSelect=()=>{var n;return"function"==typeof t.options.enableRowSelection?t.options.enableRowSelection(e):null==(n=t.options.enableRowSelection)||n},e.getCanSelectSubRows=()=>{var n;return"function"==typeof t.options.enableSubRowSelection?t.options.enableSubRowSelection(e):null==(n=t.options.enableSubRowSelection)||n},e.getCanMultiSelect=()=>{var n;return"function"==typeof t.options.enableMultiRowSelection?t.options.enableMultiRowSelection(e):null==(n=t.options.enableMultiRowSelection)||n},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var r;t&&e.toggleSelected(null==(r=n.target)?void 0:r.checked)}}}},ca=(e,t,n,r,o)=>{var a;const l=o.getRow(t,!0);n?(l.getCanMultiSelect()||Object.keys(e).forEach((t=>delete e[t])),l.getCanSelect()&&(e[t]=!0)):delete e[t],r&&null!=(a=l.subRows)&&a.length&&l.getCanSelectSubRows()&&l.subRows.forEach((t=>ca(e,t.id,n,r,o)))};function sa(e,t){const n=e.getState().rowSelection,r=[],o={},a=function(e,t){return e.map((e=>{var t;const l=ua(e,n);if(l&&(r.push(e),o[e.id]=e),null!=(t=e.subRows)&&t.length&&(e={...e,subRows:a(e.subRows)}),l)return e})).filter(Boolean)};return{rows:a(t.rows),flatRows:r,rowsById:o}}function ua(e,t){var n;return null!=(n=t[e.id])&&n}function ma(e,t,n){var r;if(null==(r=e.subRows)||!r.length)return!1;let o=!0,a=!1;return e.subRows.forEach((e=>{if((!a||o)&&(e.getCanSelect()&&(ua(e,t)?a=!0:o=!1),e.subRows&&e.subRows.length)){const n=ma(e,t);"all"===n?a=!0:"some"===n?(a=!0,o=!1):o=!1}})),o?"all":!!a&&"some"}const pa=/([0-9]+)/gm;function fa(e,t){return e===t?0:e>t?1:-1}function da(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function ha(e,t){const n=e.split(pa).filter(Boolean),r=t.split(pa).filter(Boolean);for(;n.length&&r.length;){const e=n.shift(),t=r.shift(),o=parseInt(e,10),a=parseInt(t,10),l=[o,a].sort();if(isNaN(l[0])){if(e>t)return 1;if(t>e)return-1}else{if(isNaN(l[1]))return isNaN(o)?-1:1;if(o>a)return 1;if(a>o)return-1}}return n.length-r.length}const ga={alphanumeric:(e,t,n)=>ha(da(e.getValue(n)).toLowerCase(),da(t.getValue(n)).toLowerCase()),alphanumericCaseSensitive:(e,t,n)=>ha(da(e.getValue(n)),da(t.getValue(n))),text:(e,t,n)=>fa(da(e.getValue(n)).toLowerCase(),da(t.getValue(n)).toLowerCase()),textCaseSensitive:(e,t,n)=>fa(da(e.getValue(n)),da(t.getValue(n))),datetime:(e,t,n)=>{const r=e.getValue(n),o=t.getValue(n);return r>o?1:r<o?-1:0},basic:(e,t,n)=>fa(e.getValue(n),t.getValue(n))},ya={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Lo("sorting",e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const t of n){const n=null==t?void 0:t.getValue(e.id);if("[object Date]"===Object.prototype.toString.call(n))return ga.datetime;if("string"==typeof n&&(r=!0,n.split(pa).length>1))return ga.alphanumeric}return r?ga.text:ga.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return"string"==typeof(null==n?void 0:n.getValue(e.id))?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return _o(e.columnDef.sortingFn)?e.columnDef.sortingFn:"auto"===e.columnDef.sortingFn?e.getAutoSortingFn():null!=(n=null==(r=t.options.sortingFns)?void 0:r[e.columnDef.sortingFn])?n:ga[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const o=e.getNextSortingOrder(),a=null!=n;t.setSorting((l=>{const i=null==l?void 0:l.find((t=>t.id===e.id)),c=null==l?void 0:l.findIndex((t=>t.id===e.id));let s,u=[],m=a?n:"desc"===o;var p;return s=null!=l&&l.length&&e.getCanMultiSort()&&r?i?"toggle":"add":null!=l&&l.length&&c!==l.length-1?"replace":i?"toggle":"replace","toggle"===s&&(a||o||(s="remove")),"add"===s?(u=[...l,{id:e.id,desc:m}],u.splice(0,u.length-(null!=(p=t.options.maxMultiSortColCount)?p:Number.MAX_SAFE_INTEGER))):u="toggle"===s?l.map((t=>t.id===e.id?{...t,desc:m}:t)):"remove"===s?l.filter((t=>t.id!==e.id)):[{id:e.id,desc:m}],u}))},e.getFirstSortDir=()=>{var n,r;return(null!=(n=null!=(r=e.columnDef.sortDescFirst)?r:t.options.sortDescFirst)?n:"desc"===e.getAutoSortDir())?"desc":"asc"},e.getNextSortingOrder=n=>{var r,o;const a=e.getFirstSortDir(),l=e.getIsSorted();return l?!!(l===a||null!=(r=t.options.enableSortingRemoval)&&!r||n&&null!=(o=t.options.enableMultiRemove)&&!o)&&("desc"===l?"asc":"desc"):a},e.getCanSort=()=>{var n,r;return(null==(n=e.columnDef.enableSorting)||n)&&(null==(r=t.options.enableSorting)||r)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return null!=(n=null!=(r=e.columnDef.enableMultiSort)?r:t.options.enableMultiSort)?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=null==(n=t.getState().sorting)?void 0:n.find((t=>t.id===e.id));return!!r&&(r.desc?"desc":"asc")},e.getSortIndex=()=>{var n,r;return null!=(n=null==(r=t.getState().sorting)?void 0:r.findIndex((t=>t.id===e.id)))?n:-1},e.clearSorting=()=>{t.setSorting((t=>null!=t&&t.length?t.filter((t=>t.id!==e.id)):[]))},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(null==r.persist||r.persist(),null==e.toggleSorting||e.toggleSorting(void 0,!!e.getCanMultiSort()&&(null==t.options.isMultiSortEvent?void 0:t.options.isMultiSortEvent(r))))}}},createTable:e=>{e.setSorting=t=>null==e.options.onSortingChange?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.sorting)?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},va={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Lo("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility((t=>({...t,[e.id]:null!=n?n:!e.getIsVisible()})))},e.getIsVisible=()=>{var n,r;const o=e.columns;return null==(n=o.length?o.some((e=>e.getIsVisible())):null==(r=t.getState().columnVisibility)?void 0:r[e.id])||n},e.getCanHide=()=>{var n,r;return(null==(n=e.columnDef.enableHiding)||n)&&(null==(r=t.options.enableHiding)||r)},e.getToggleVisibilityHandler=()=>t=>{null==e.toggleVisibility||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Ro((()=>[e.getAllCells(),t.getState().columnVisibility]),(e=>e.filter((e=>e.column.getIsVisible()))),Io(t.options,"debugRows")),e.getVisibleCells=Ro((()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()]),((e,t,n)=>[...e,...t,...n]),Io(t.options,"debugRows"))},createTable:e=>{const t=(t,n)=>Ro((()=>[n(),n().filter((e=>e.getIsVisible())).map((e=>e.id)).join("_")]),(e=>e.filter((e=>null==e.getIsVisible?void 0:e.getIsVisible()))),Io(e.options,"debugColumns"));e.getVisibleFlatColumns=t(0,(()=>e.getAllFlatColumns())),e.getVisibleLeafColumns=t(0,(()=>e.getAllLeafColumns())),e.getLeftVisibleLeafColumns=t(0,(()=>e.getLeftLeafColumns())),e.getRightVisibleLeafColumns=t(0,(()=>e.getRightLeafColumns())),e.getCenterVisibleLeafColumns=t(0,(()=>e.getCenterLeafColumns())),e.setColumnVisibility=t=>null==e.options.onColumnVisibilityChange?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:null!=(n=e.initialState.columnVisibility)?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=null!=(n=t)?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce(((e,n)=>({...e,[n.id]:t||!(null!=n.getCanHide&&n.getCanHide())})),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some((e=>!(null!=e.getIsVisible&&e.getIsVisible()))),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some((e=>null==e.getIsVisible?void 0:e.getIsVisible())),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible(null==(n=t.target)?void 0:n.checked)}}};function wa(e,t){return t?"center"===t?e.getCenterVisibleLeafColumns():"left"===t?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const ba=[Fo,va,oa,la,ea,ya,ra,Wo,aa,ia,Go];function xa(e){var t;(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");let n={_features:ba};const r=n._features.reduce(((e,t)=>Object.assign(e,null==t.getDefaultOptions?void 0:t.getDefaultOptions(n))),{});let o={...null!=(t=e.initialState)?t:{}};n._features.forEach((e=>{var t;o=null!=(t=null==e.getInitialState?void 0:e.getInitialState(o))?t:o}));const a=[];let l=!1;const i={_features:ba,options:{...r,...e},initialState:o,_queue:e=>{a.push(e),l||(l=!0,Promise.resolve().then((()=>{for(;a.length;)a.shift()();l=!1})).catch((e=>setTimeout((()=>{throw e})))))},reset:()=>{n.setState(n.initialState)},setOptions:e=>{const t=Po(e,n.options);n.options=(e=>n.options.mergeOptions?n.options.mergeOptions(r,e):{...r,...e})(t)},getState:()=>n.options.state,setState:e=>{null==n.options.onStateChange||n.options.onStateChange(e)},_getRowId:(e,t,r)=>{var o;return null!=(o=null==n.options.getRowId?void 0:n.options.getRowId(e,t,r))?o:`${r?[r.id,t].join("."):t}`},getCoreRowModel:()=>(n._getCoreRowModel||(n._getCoreRowModel=n.options.getCoreRowModel(n)),n._getCoreRowModel()),getRowModel:()=>n.getPaginationRowModel(),getRow:(e,t)=>{let r=(t?n.getPrePaginationRowModel():n.getRowModel()).rowsById[e];if(!r&&(r=n.getCoreRowModel().rowsById[e],!r))throw new Error;return r},_getDefaultColumnDef:Ro((()=>[n.options.defaultColumn]),(e=>{var t;return e=null!=(t=e)?t:{},{header:e=>{const t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t,n;return null!=(t=null==(n=e.renderValue())||null==n.toString?void 0:n.toString())?t:null},...n._features.reduce(((e,t)=>Object.assign(e,null==t.getDefaultColumnDef?void 0:t.getDefaultColumnDef())),{}),...e}}),Io(e,"debugColumns")),_getColumnDefs:()=>n.options.columns,getAllColumns:Ro((()=>[n._getColumnDefs()]),(e=>{const t=function(e,r,o){return void 0===o&&(o=0),e.map((e=>{const a=function(e,t,n,r){var o,a;const l={...e._getDefaultColumnDef(),...t},i=l.accessorKey;let c,s=null!=(o=null!=(a=l.id)?a:i?i.replace(".","_"):void 0)?o:"string"==typeof l.header?l.header:void 0;if(l.accessorFn?c=l.accessorFn:i&&(c=i.includes(".")?e=>{let t=e;for(const e of i.split(".")){var n;t=null==(n=t)?void 0:n[e]}return t}:e=>e[l.accessorKey]),!s)throw new Error;let u={id:`${String(s)}`,accessorFn:c,parent:r,depth:n,columnDef:l,columns:[],getFlatColumns:Ro((()=>[!0]),(()=>{var e;return[u,...null==(e=u.columns)?void 0:e.flatMap((e=>e.getFlatColumns()))]}),Io(e.options,"debugColumns")),getLeafColumns:Ro((()=>[e._getOrderColumnsFn()]),(e=>{var t;if(null!=(t=u.columns)&&t.length){let t=u.columns.flatMap((e=>e.getLeafColumns()));return e(t)}return[u]}),Io(e.options,"debugColumns"))};for(const t of e._features)null==t.createColumn||t.createColumn(u,e);return u}(n,e,o,r),l=e;return a.columns=l.columns?t(l.columns,a,o+1):[],a}))};return t(e)}),Io(e,"debugColumns")),getAllFlatColumns:Ro((()=>[n.getAllColumns()]),(e=>e.flatMap((e=>e.getFlatColumns()))),Io(e,"debugColumns")),_getAllFlatColumnsById:Ro((()=>[n.getAllFlatColumns()]),(e=>e.reduce(((e,t)=>(e[t.id]=t,e)),{})),Io(e,"debugColumns")),getAllLeafColumns:Ro((()=>[n.getAllColumns(),n._getOrderColumnsFn()]),((e,t)=>t(e.flatMap((e=>e.getLeafColumns())))),Io(e,"debugColumns")),getColumn:e=>n._getAllFlatColumnsById()[e]};Object.assign(n,i);for(let e=0;e<n._features.length;e++){const t=n._features[e];null==t||null==t.createTable||t.createTable(n)}return n}const Ea=(e,t,n,r,o,a,l)=>{let i={id:t,index:r,original:n,depth:o,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(i._valuesCache.hasOwnProperty(t))return i._valuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?(i._valuesCache[t]=n.accessorFn(i.original,r),i._valuesCache[t]):void 0},getUniqueValues:t=>{if(i._uniqueValuesCache.hasOwnProperty(t))return i._uniqueValuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?n.columnDef.getUniqueValues?(i._uniqueValuesCache[t]=n.columnDef.getUniqueValues(i.original,r),i._uniqueValuesCache[t]):(i._uniqueValuesCache[t]=[i.getValue(t)],i._uniqueValuesCache[t]):void 0},renderValue:t=>{var n;return null!=(n=i.getValue(t))?n:e.options.renderFallbackValue},subRows:null!=a?a:[],getLeafRows:()=>function(e,t){const n=[],r=e=>{e.forEach((e=>{n.push(e);const o=t(e);null!=o&&o.length&&r(o)}))};return r(e),n}(i.subRows,(e=>e.subRows)),getParentRow:()=>i.parentId?e.getRow(i.parentId,!0):void 0,getParentRows:()=>{let e=[],t=i;for(;;){const n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:Ro((()=>[e.getAllLeafColumns()]),(t=>t.map((t=>function(e,t,n,r){const o={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:()=>{var t;return null!=(t=o.getValue())?t:e.options.renderFallbackValue},getContext:Ro((()=>[e,n,t,o]),((e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue})),Io(e.options,"debugCells"))};return e._features.forEach((r=>{null==r.createCell||r.createCell(o,n,t,e)}),{}),o}(e,i,t,t.id)))),Io(e.options,"debugRows")),_getAllCellsByColumnId:Ro((()=>[i.getAllCells()]),(e=>e.reduce(((e,t)=>(e[t.column.id]=t,e)),{})),Io(e.options,"debugRows"))};for(let t=0;t<e._features.length;t++){const n=e._features[t];null==n||null==n.createRow||n.createRow(i,e)}return i};function Sa(){return e=>Ro((()=>[e.options.data]),(t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(t,o,a){void 0===o&&(o=0);const l=[];for(let c=0;c<t.length;c++){const s=Ea(e,e._getRowId(t[c],c,a),t[c],c,o,void 0,null==a?void 0:a.id);var i;n.flatRows.push(s),n.rowsById[s.id]=s,l.push(s),e.options.getSubRows&&(s.originalSubRows=e.options.getSubRows(t[c],c),null!=(i=s.originalSubRows)&&i.length&&(s.subRows=r(s.originalSubRows,o+1,s)))}return l};return n.rows=r(t),n}),Io(e.options,"debugTable",0,(()=>e._autoResetPageIndex())))}function ka(){return e=>Ro((()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter]),((t,n,r)=>{if(!t.rows.length||(null==n||!n.length)&&!r){for(let e=0;e<t.flatRows.length;e++)t.flatRows[e].columnFilters={},t.flatRows[e].columnFiltersMeta={};return t}const o=[],a=[];(null!=n?n:[]).forEach((t=>{var n;const r=e.getColumn(t.id);if(!r)return;const a=r.getFilterFn();a&&o.push({id:t.id,filterFn:a,resolvedValue:null!=(n=null==a.resolveFilterValue?void 0:a.resolveFilterValue(t.value))?n:t.value})}));const l=n.map((e=>e.id)),i=e.getGlobalFilterFn(),c=e.getAllLeafColumns().filter((e=>e.getCanGlobalFilter()));let s,u;r&&i&&c.length&&(l.push("__global__"),c.forEach((e=>{var t;a.push({id:e.id,filterFn:i,resolvedValue:null!=(t=null==i.resolveFilterValue?void 0:i.resolveFilterValue(r))?t:r})})));for(let e=0;e<t.flatRows.length;e++){const n=t.flatRows[e];if(n.columnFilters={},o.length)for(let e=0;e<o.length;e++){s=o[e];const t=s.id;n.columnFilters[t]=s.filterFn(n,t,s.resolvedValue,(e=>{n.columnFiltersMeta[t]=e}))}if(a.length){for(let e=0;e<a.length;e++){u=a[e];const t=u.id;if(u.filterFn(n,t,u.resolvedValue,(e=>{n.columnFiltersMeta[t]=e}))){n.columnFilters.__global__=!0;break}}!0!==n.columnFilters.__global__&&(n.columnFilters.__global__=!1)}}return function(e,t,n){return n.options.filterFromLeafRows?function(e,t,n){var r;const o=[],a={},l=null!=(r=n.options.maxLeafRowFilterDepth)?r:100,i=function(e,r){void 0===r&&(r=0);const c=[];for(let u=0;u<e.length;u++){var s;let m=e[u];const p=Ea(n,m.id,m.original,m.index,m.depth,void 0,m.parentId);if(p.columnFilters=m.columnFilters,null!=(s=m.subRows)&&s.length&&r<l){if(p.subRows=i(m.subRows,r+1),m=p,t(m)&&!p.subRows.length){c.push(m),a[m.id]=m,o.push(m);continue}if(t(m)||p.subRows.length){c.push(m),a[m.id]=m,o.push(m);continue}}else m=p,t(m)&&(c.push(m),a[m.id]=m,o.push(m))}return c};return{rows:i(e),flatRows:o,rowsById:a}}(e,t,n):function(e,t,n){var r;const o=[],a={},l=null!=(r=n.options.maxLeafRowFilterDepth)?r:100,i=function(e,r){void 0===r&&(r=0);const c=[];for(let u=0;u<e.length;u++){let m=e[u];if(t(m)){var s;if(null!=(s=m.subRows)&&s.length&&r<l){const e=Ea(n,m.id,m.original,m.index,m.depth,void 0,m.parentId);e.subRows=i(m.subRows,r+1),m=e}c.push(m),o.push(m),a[m.id]=m}}return c};return{rows:i(e),flatRows:o,rowsById:a}}(e,t,n)}(t.rows,(e=>{for(let t=0;t<l.length;t++)if(!1===e.columnFilters[l[t]])return!1;return!0}),e)}),Io(e.options,"debugTable",0,(()=>e._autoResetPageIndex())))}function Na(){return e=>Ro((()=>[e.getState().sorting,e.getPreSortedRowModel()]),((t,n)=>{if(!n.rows.length||null==t||!t.length)return n;const r=e.getState().sorting,o=[],a=r.filter((t=>{var n;return null==(n=e.getColumn(t.id))?void 0:n.getCanSort()})),l={};a.forEach((t=>{const n=e.getColumn(t.id);n&&(l[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})}));const i=e=>{const t=e.map((e=>({...e})));return t.sort(((e,t)=>{for(let r=0;r<a.length;r+=1){var n;const o=a[r],i=l[o.id],c=null!=(n=null==o?void 0:o.desc)&&n;let s=0;if(i.sortUndefined){const n=void 0===e.getValue(o.id),r=void 0===t.getValue(o.id);(n||r)&&(s=n&&r?0:n?i.sortUndefined:-i.sortUndefined)}if(0===s&&(s=i.sortingFn(e,t,o.id)),0!==s)return c&&(s*=-1),i.invertSorting&&(s*=-1),s}return e.index-t.index})),t.forEach((e=>{var t;o.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=i(e.subRows))})),t};return{rows:i(n.rows),flatRows:o,rowsById:n.rowsById}}),Io(e.options,"debugTable",0,(()=>e._autoResetPageIndex())))}function Oa(){return e=>Ro((()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows]),((e,t,n)=>!t.rows.length||!0!==e&&!Object.keys(null!=e?e:{}).length?t:n?Ca(t):t),Io(e.options,"debugTable"))}function Ca(e){const t=[],n=e=>{var r;t.push(e),null!=(r=e.subRows)&&r.length&&e.getIsExpanded()&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function ja(e){return e=>Ro((()=>[e.getState().pagination,e.getPrePaginationRowModel(),e.options.paginateExpandedRows?void 0:e.getState().expanded]),((t,n)=>{if(!n.rows.length)return n;const{pageSize:r,pageIndex:o}=t;let{rows:a,flatRows:l,rowsById:i}=n;const c=r*o,s=c+r;let u;a=a.slice(c,s),u=e.options.paginateExpandedRows?{rows:a,flatRows:l,rowsById:i}:Ca({rows:a,flatRows:l,rowsById:i}),u.flatRows=[];const m=e=>{u.flatRows.push(e),e.subRows.length&&e.subRows.forEach(m)};return u.rows.forEach(m),u}),Io(e.options,"debugTable"))}function Pa(e,n){return e?function(e){return"function"==typeof e&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}(r=e)||"function"==typeof r||function(e){return"object"==typeof e&&"symbol"==typeof e.$$typeof&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}(r)?t.createElement(e,n):e:null;var r}function La(e){const n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=t.useState((()=>({current:xa(n)}))),[o,a]=t.useState((()=>r.current.initialState));return r.current.setOptions((t=>({...t,...e,state:{...o,...e.state},onStateChange:t=>{a(t),null==e.onStateChange||e.onStateChange(t)}}))),r.current}const _a=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"}))})),Ra=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 7.5h-.75A2.25 2.25 0 0 0 4.5 9.75v7.5a2.25 2.25 0 0 0 2.25 2.25h7.5a2.25 2.25 0 0 0 2.25-2.25v-7.5a2.25 2.25 0 0 0-2.25-2.25h-.75m-6 3.75 3 3m0 0 3-3m-3 3V1.5m6 9h.75a2.25 2.25 0 0 1 2.25 2.25v7.5a2.25 2.25 0 0 1-2.25 2.25h-7.5a2.25 2.25 0 0 1-2.25-2.25v-.75"}))}));var Ia=["value","onChange","debounce"];function Aa(){return Aa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Aa.apply(null,arguments)}function Ta(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Fa(t){var n=t.value,r=t.onChange,o=t.debounce,a=void 0===o?500:o,l=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Ia),i=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ta(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ta(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(n),2),c=i[0],s=i[1];return(0,e.useEffect)((function(){s(n)}),[n]),(0,e.useEffect)((function(){var e=setTimeout((function(){r(c)}),a);return function(){return clearTimeout(e)}}),[c]),wp.element.createElement("input",Aa({},l,{value:c,onChange:function(e){return s(e.target.value)}}))}const Ma=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"}))})),Da=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"}))})),Ga=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"}))})),qa=function(e){var t=e.table;return wp.element.createElement("thead",{className:"border-b border-gray-900/10 text-sm leading-6 text-gray-900"},t.getHeaderGroups().map((function(e){return wp.element.createElement("tr",{key:e.id},e.headers.map((function(e,t){return wp.element.createElement("th",{onClick:e.column.getToggleSortingHandler(),key:e.id,colSpan:e.colSpan,className:"py-2 font-bold select-none",style:{width:0==t?"50px":"auto",cursor:e.column.getCanSort()?"pointer":"default"}},e.isPlaceholder?null:wp.element.createElement("div",{className:"flex items-end leading-none capitalize"},Pa(e.column.columnDef.header,e.getContext()),wp.element.createElement("span",null,e.column.getIsSorted()?"desc"===e.column.getIsSorted()?wp.element.createElement(Ma,{className:"w-3 h-3"}):wp.element.createElement(Da,{className:"w-3 h-3"}):e.column.getCanSort()?wp.element.createElement(Ga,{className:"w-3 h-3"}):"")))})))})))};function Va(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(Boolean).join(" ")}const Wa=function(e){var t=e.row,n=e.loadingProductId,r=e.toggleExpanded,o="variation"===t.original.type,a=t.getIsExpanded(),l=Va(o?"bg-sky-50":"",t.original.id===n?"bg-gray-100":"","py-4 wrap");return wp.element.createElement("tr",{key:t.id,className:Va(l,a?"bg-sky-300":"")},t.getVisibleCells().map((function(e,n){return wp.element.createElement("td",{key:e.id,onClick:function(){"select"!==e.column.id&&"actions"!==e.column.id&&r()},className:"py-4 wrap text-gray-600 ".concat(n===t.getVisibleCells().length-1?"text-right":"text-left"," ").concat(t.getCanExpand()&&"cursor-pointer"," ")},Pa(e.column.columnDef.cell,e.getContext()))})))},Ba=function(e){var t=e.table;return e.selectablePageRows,e.rowSelection,e.setRowSelection,wp.element.createElement("div",{className:"flex justify-between items-center py-2"},wp.element.createElement("div",{className:"flex items-center gap-2 "},wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.setPageIndex(0)},disabled:!t.getCanPreviousPage()},"<<"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.previousPage()},disabled:!t.getCanPreviousPage()},"<"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.nextPage()},disabled:!t.getCanNextPage()},">"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.setPageIndex(t.getPageCount()-1)},disabled:!t.getCanNextPage()},">>"),wp.element.createElement("span",{className:"flex items-center gap-1"},wp.element.createElement("div",null,"Page"),wp.element.createElement("strong",null,t.getState().pagination.pageIndex+1," of"," ",t.getPageCount())),wp.element.createElement("span",{className:"flex items-center gap-1"},"| Go to page:",wp.element.createElement("input",{type:"number",defaultValue:t.getState().pagination.pageIndex+1,onChange:function(e){var n=e.target.value?Number(e.target.value)-1:0;t.setPageIndex(n)},className:"border p-1 rounded w-16"})),wp.element.createElement("select",{value:t.getState().pagination.pageSize,onChange:function(e){t.setPageSize(Number(e.target.value))}},[10,20,30,40,50].map((function(e){return wp.element.createElement("option",{key:e,value:e},"Show ",e)})))),wp.element.createElement("div",{className:"flex justify-center items-center pr-2 gap-2 py-4"}))},Ha=function(t){var n=t.children,r=t.open,o=(t.onClose,t.className),a=t.backdrop,l=void 0===a||a,i=(0,e.useRef)(null);return r?wp.element.createElement("div",{className:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-start p-4 z-50",style:{marginLeft:"160px"}},l&&wp.element.createElement("div",{className:"absolute top-0 left-0 right-0 bottom-0 bg-black/30","aria-hidden":"true"}),wp.element.createElement("div",{ref:i,tabIndex:-1,className:Va("flex justify-center z-50 mx-auto",o),onClick:function(e){return e.stopPropagation()}},n)):null},za=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 9-3 3m0 0 3 3m-3-3h7.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))})),Ua=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m12.75 15 3-3m0 0-3-3m3 3h-7.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}));var $a=function(e){e.productsToImport;var t=e.rangeValue,n=e.dataToImport,r=e.handleStepChange,o=e.importProduct,a=e.importCount;return wp.element.createElement("div",null,wp.element.createElement("h4",{className:"text-base mb-4"},"Review"),wp.element.createElement("p",null,"You are about to import"," ",wp.element.createElement("span",{className:"font-semibold"},a)," products in batches of"," ",wp.element.createElement("span",{className:"font-semibold"},t),". Existing products will have their data updated, while new entries will be created for products not already in the system."),wp.element.createElement("div",{className:"mt-2"},wp.element.createElement("p",null,"You have chosen to import/sync the following:"),wp.element.createElement("ul",{className:"flex gap-2 mt-2 flex-wrap"},Object.keys(n).map((function(e,t){if(n[e])return wp.element.createElement("li",{key:n[e]+t,className:"p-2 border border-gray-300 uppercase text-xs font-semibold"},e)})))),wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(){return r("backward")},className:"relative inline-flex items-center rounded-md bg-gray-400 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement(za,{className:"mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Go back")),wp.element.createElement("button",{type:"button",onClick:function(){r("forward"),o()},className:"relative inline-flex items-center rounded-md bg-red-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"IMPORT"),wp.element.createElement(Ua,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"}))))};const Za=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}));function Ya(e){return Ya="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ya(e)}function Ka(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Xa(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Ya(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ya(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ya(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ja=function(t){var n=t.progress,r=t.importCount,o=t.isImporting,a=t.setIsDialogOpen,l=t.setCurrentStep,i=(0,e.useRef)(null);return(0,e.useEffect)((function(){i.current&&(i.current.scrollTop=i.current.scrollHeight)}),[n]),wp.element.createElement("div",null,wp.element.createElement("div",null,wp.element.createElement("div",{className:""},wp.element.createElement("div",{className:"h-4 bg-gray-200 w-full rounded-lg mt-2"},wp.element.createElement("div",{className:"h-full bg-blue-500 rounded-lg",style:{width:"".concat(n.filter((function(e){return"string"!=typeof e})).length/r*100,"%")}})),wp.element.createElement("div",{className:"text-sm text-gray-500 mt-1"},"Imported"," ",n.filter((function(e){return"string"!=typeof e&&"success"===e.status})).length," ","of ",r," products."," ",Number(n.filter((function(e){return"string"!=typeof e})).length/r*100).toFixed(1),"%")),wp.element.createElement("div",{ref:i,className:"bg-slate-950 p-4 rounded-xl max-h-52 overflow-y-auto overflow-x-hidden w-full flex flex-col gap-2 mt-2"},n.map((function(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ka(Object(n),!0).forEach((function(t){Xa(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ka(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e);return delete n.variations,wp.element.createElement("p",{className:"break-words ".concat(e.status&&"success"===e.status?"text-green-500":e.status&&"failed"===e.status?"text-red-500":"text-blue-500"),key:e.square_id||t},JSON.stringify(n))}))),!o&&wp.element.createElement("div",{className:"flex flex-col items-center justify-center gap-2 py-4"},wp.element.createElement(Yt,{className:"w-12 h-12 text-green-500"}),wp.element.createElement("h3",{className:"text-xl text-green-500 font-semibold"},"Import complete!"),wp.element.createElement("p",{className:"font-semibold"},"You can now safely close this window."))),!o&&wp.element.createElement("div",{className:"flex items-center justify-end gap-2 mt-6"},wp.element.createElement("button",{type:"button",onClick:function(){a(!1),l(0)},className:"relative inline-flex items-center rounded-md bg-gray-400 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement(Za,{className:"mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Close"))))};function Qa(e){return Qa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qa(e)}function el(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function tl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?el(Object(n),!0).forEach((function(t){nl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):el(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function nl(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Qa(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Qa(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Qa(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var rl=function(e){var t=e.dataToImport,n=e.setDataToImport,r=e.rangeValue,o=e.handleRangeChange,a=e.handleStepChange,l=e.setCurrentStep,i=e.setIsDialogOpen;return wp.element.createElement("div",null,wp.element.createElement("h4",{className:"text-base mb-4"},"Select the data you wish to import / sync:"),wp.element.createElement("fieldset",{className:"mb-3"},wp.element.createElement("legend",{className:"sr-only"},"data to sync"),wp.element.createElement("div",{className:"flex gap-x-6 gap-y-4 items-start flex-wrap"},wp.element.createElement("label",{htmlFor:"title",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",checked:t.title,onChange:function(){return n(tl(tl({},t),{},{title:!t.title}))},id:"title",className:"h-full !m-0"}),"Title"),wp.element.createElement("label",{htmlFor:"SKU",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",checked:t.sku,id:"SKU",className:"h-full !m-0",onChange:function(){return n(tl(tl({},t),{},{sku:!t.sku}))}}),"SKU"),wp.element.createElement("label",{htmlFor:"price",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"price",className:"h-full !m-0",checked:t.price,onChange:function(){return n(tl(tl({},t),{},{price:!t.price}))}}),"Price"),wp.element.createElement("label",{htmlFor:"description",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"description",checked:t.description,onChange:function(){return n(tl(tl({},t),{},{description:!t.description}))},className:"h-full !m-0"}),"Description"),wp.element.createElement("label",{htmlFor:"image",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"image",className:"h-full !m-0",checked:!1}),"Image ",wp.element.createElement(At,null)),wp.element.createElement("label",{htmlFor:"categories",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"categories",className:"h-full !m-0",checked:!1}),"Categories ",wp.element.createElement(At,null)),wp.element.createElement("label",{htmlFor:"stock",className:"flex items-center gap-1 leading-none"},wp.element.createElement("input",{type:"checkbox",id:"stock",className:"h-full !m-0",checked:t.stock,onChange:function(){return n(tl(tl({},t),{},{stock:!t.stock}))}}),"Stock"))),wp.element.createElement("p",null,"Existing products will have their data updated, while new entries will be created for products not already in the system."),wp.element.createElement("h4",{className:"text-base mt-4 mb-2"},"How many products to import in each batch?"),wp.element.createElement("p",null,"Increasing the number in each batch places a greater load on the server (especially when import images). If you encounter errors, consider reducing this value for better stability or disabling image import."),wp.element.createElement("div",{className:"relative mb-6 mt-3"},wp.element.createElement("label",{htmlFor:"labels-range-input",className:"sr-only"},"Labels range"),wp.element.createElement("input",{id:"labels-range-input",type:"range",value:r,onChange:o,step:5,min:"5",max:"50",className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer"}),wp.element.createElement("span",{className:"text-sm text-gray-500 absolute start-0 -bottom-6"},"Min 5"),wp.element.createElement("span",{className:"text-sm text-gray-600 font-semibold absolute start-1/2 -translate-x-1/2 -bottom-6"},r),wp.element.createElement("span",{className:"text-sm text-gray-500 absolute end-0 -bottom-6"},"Max 50")),wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(){l(0),i(!1)},className:"relative inline-flex items-center rounded-md bg-gray-400 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"Cancel"),wp.element.createElement(Za,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"})),wp.element.createElement("button",{type:"button",onClick:function(){return a("forward")},className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"Continue"),wp.element.createElement(Ua,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"}))))},ol=function(e){var t=e.currentStep,n=e.rangeValue,r=e.dataToImport,o=e.handleStepChange,a=e.setCurrentStep,l=e.handleRangeChange,i=e.setDataToImport,c=e.importProduct,s=e.importCount,u=e.productsToImport,m=e.isImporting,p=e.setIsDialogOpen,f=e.progress;switch(t){case 0:return wp.element.createElement(rl,{dataToImport:r,setDataToImport:i,rangeValue:n,handleRangeChange:l,handleStepChange:o,setCurrentStep:a,setIsDialogOpen:p});case 1:return wp.element.createElement($a,{progress:f,dataToImport:r,importProduct:c,importCount:s,handleStepChange:o,setCurrentStep:a,productsToImport:u,isImporting:m,rangeValue:n,setIsDialogOpen:p});case 2:return wp.element.createElement(Ja,{progress:f,importCount:s,handleStepChange:o,setCurrentStep:a,isImporting:m,setIsDialogOpen:p});default:return wp.element.createElement("div",null,"Invalid step")}};function al(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const ll=function(t){var n=t.isDialogOpen,r=t.setIsDialogOpen,o=t.progress,a=t.rangeValue,l=t.setRangeValue,i=t.setDataToImport,c=t.dataToImport,s=t.importProduct,u=t.productsToImport,m=t.importCount,p=t.isImporting,f=[{name:"Step 1",href:"#",status:"current"},{name:"Step 2",href:"#",status:"upcoming"},{name:"Step 3",href:"#",status:"upcoming"}],d=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return al(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?al(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(0),2),h=d[0],g=d[1];return wp.element.createElement(Ha,{open:n,onClose:function(){return r(!1)},className:"w-[40vw] max-w-[40vw] mx-auto bg-white p-6 rounded-xl"},wp.element.createElement("div",{className:"w-full"},wp.element.createElement("header",{className:"flex justify-between items-center gap-2 mb-4"},wp.element.createElement("h3",{className:"text-lg font-medium leading-6 text-gray-900"},"Import from Square"),wp.element.createElement("nav",{className:"flex items-center justify-center","aria-label":"Progress"},wp.element.createElement("p",{className:"text-sm font-medium"},"Step ",h+1," of ",f.length),wp.element.createElement("ol",{role:"list",className:"ml-8 flex items-center space-x-5"},f.map((function(e,t){return wp.element.createElement("li",{key:e.name},"complete"===e.status?wp.element.createElement("span",{className:"block h-2.5 w-2.5 rounded-full bg-sky-600 hover:bg-sky-900"},wp.element.createElement("span",{className:"sr-only"},e.name)):h===t?wp.element.createElement("span",{className:"relative flex items-center justify-center","aria-current":"step"},wp.element.createElement("span",{className:"absolute flex h-5 w-5 p-px","aria-hidden":"true"},wp.element.createElement("span",{className:"h-full w-full rounded-full bg-sky-200"})),wp.element.createElement("span",{className:"relative block h-2.5 w-2.5 rounded-full bg-sky-600","aria-hidden":"true"}),wp.element.createElement("span",{className:"sr-only"},e.name)):wp.element.createElement("span",{className:"block h-2.5 w-2.5 rounded-full bg-gray-200 hover:bg-gray-400"},wp.element.createElement("span",{className:"sr-only"},e.name)))}))))),wp.element.createElement(ol,{currentStep:h,rangeValue:a,dataToImport:c,handleStepChange:function(e){g((function(t){return"forward"===e&&t<f.length-1?t+1:"backward"===e&&t>0?t-1:t}))},setCurrentStep:g,handleRangeChange:function(e){l(Number(e.target.value))},importCount:m,productsToImport:u,setDataToImport:i,importProduct:s,isImporting:p,setIsDialogOpen:r,progress:o}),p&&wp.element.createElement("p",{className:"text-red-500 font-semibold text-center mt-2"},"Do not close this window, import will be cancelled")))};function il(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var cl=(0,e.createContext)({blockNavigation:!1,setBlockNavigation:function(){}}),sl=function(t){var n=t.children,r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return il(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?il(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(!1),2),o=r[0],a=r[1];return wp.element.createElement(cl.Provider,{value:{blockNavigation:o,setBlockNavigation:a}},n)};function ul(e){return ul="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ul(e)}function ml(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pl(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=ul(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=ul(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ul(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fl(e){return function(e){if(Array.isArray(e))return dl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return dl(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dl(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var hl=function(e){var t=e.isExpanded;return e.row.getCanExpand()?wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4 ".concat(t?"rotate-90":"")},wp.element.createElement("polyline",{points:"9 18 15 12 9 6"})):wp.element.createElement(React.Fragment,null)},gl=function(){return wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-gray-300"},wp.element.createElement("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),wp.element.createElement("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"}))},yl=function(e){var t={false:{bgColor:"bg-red-100",textColor:"text-red-700",fillColor:"fill-red-500",text:"Not imported"},partial:{bgColor:"bg-yellow-100",textColor:"text-yellow-700",fillColor:"fill-yellow-500",text:"Partial"},true:{bgColor:"bg-green-100",textColor:"text-green-700",fillColor:"fill-green-500",text:"Imported"}},n=t[e.status]||t.false,r=n.bgColor,o=n.textColor,a=n.fillColor,l=n.text;return wp.element.createElement("span",{className:"inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium ".concat(r," ").concat(o)},wp.element.createElement("svg",{className:"h-1.5 w-1.5 ".concat(a),viewBox:"0 0 6 6","aria-hidden":"true"},wp.element.createElement("circle",{cx:"3",cy:"3",r:"3"})),l)},vl=function(e){var t=e.value;return wp.element.createElement("div",{className:"group relative w-10 h-10"},t.map((function(e,n){return wp.element.createElement("img",{key:n,src:e,alt:"",width:40,height:40,className:Va("w-10 h-10 rounded object-cover flex items-center gap-2 shadow top-0 absolute transition-transform duration-300",0===n&&t.length>1&&"group-hover:-translate-y-2 rotate-12 group-hover:rotate-[-16deg]",1===n&&t.length>1&&"group-hover:translate-y-2 group-hover:rotate-[16deg]")})})))},wl=["indeterminate","className"];function bl(){return bl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bl.apply(null,arguments)}const xl=function(e){var n=e.indeterminate,r=e.className,o=void 0===r?"":r,a=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,wl),l=(0,t.useRef)(null);return(0,t.useEffect)((function(){"boolean"==typeof n&&(l.current.indeterminate=!a.checked&&n)}),[n,a.checked]),wp.element.createElement("input",bl({type:"checkbox",ref:l,className:o+" cursor-pointer"},a))};var El=function(e,t,n,r,o){var a=!o||e.original.present_at_location_ids&&e.original.present_at_location_ids.includes(r),l=!!e.getValue(t)&&e.getValue(t).toString().toLowerCase().includes(n.toLowerCase()),i=e.subRows&&e.subRows.some((function(e){var r=e.getValue(t);return!!r&&r.toString().toLowerCase().includes(n.toLowerCase())}));return(l||i)&&a},Sl=function(e,t,n){if(!n)return!0;var r=function(e){return!e||!0===e.getValue(t)||r(e.parent)};return r(e)},kl=function(e,t,n){if(!n)return!0;var r=function(e){return!e||!0!==e.getValue(t)||r(e.parent)};return r(e)};function Nl(e){return Nl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Nl(e)}function Ol(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Cl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ol(Object(n),!0).forEach((function(t){jl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ol(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function jl(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Nl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Nl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Nl(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pl(e){return Pl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pl(e)}function Ll(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ll(Object(n),!0).forEach((function(t){Rl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ll(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rl(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Pl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Pl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Pl(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Il(){Il=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Pl(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Pl(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function Al(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function Tl(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){Al(a,r,o,l,i,"next",e)}function i(e){Al(a,r,o,l,i,"throw",e)}l(void 0)}))}}function Fl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Ml=function(e,t){return e.reduce((function(n,r,o){return o%t?n:[].concat(function(e){return function(e){if(Array.isArray(e))return Fl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Fl(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Fl(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(n),[e.slice(o,o+t)])}),[])};function Dl(_x,e,t,n){return Gl.apply(this,arguments)}function Gl(){return Gl=Tl(Il().mark((function e(t,n,r,o){var a,l,i,c;return Il().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=n.find((function(e){return e.id===t.id}))){e.next=3;break}return e.abrupt("return",{error:"Product ".concat(t.id," not found in inventory")});case 3:return l=_l({},a),"Variable"===t.type&&(l.variable=!0),t.subRows&&t.subRows.length>0&&(i=t.subRows.map((function(e){return e.id})),c=a.item_data.variations.filter((function(e){return i.includes(e.id)})),l=_l(_l({},l),{},{item_data:_l(_l({},a.item_data),{},{variations:c})})),e.prev=6,e.next=9,Ut({path:"/sws/v1/square-inventory/import",signal:null==r?void 0:r.signal,method:"POST",data:{product:[l],datatoimport:o}});case 9:return e.abrupt("return",e.sent);case 12:return e.prev=12,e.t0=e.catch(6),e.abrupt("return",{error:e.t0});case 15:case"end":return e.stop()}}),e,null,[[6,12]])}))),Gl.apply(this,arguments)}var ql=function(){var e=Tl(Il().mark((function e(t){return Il().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Ut({path:"/sws/v1/logs",method:"POST",data:{log:t}});case 3:return e.abrupt("return",e.sent);case 6:e.prev=6,e.t0=e.catch(0),console.error("Error logging to backend:",e.t0);case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}(),Vl=function(e,t){return t.map((function(t){var n=e.find((function(e){return e.square_id===t.id})),r=n&&"success"===n.status;return _l(_l({},t),{},{woocommerce_product_id:(null==n?void 0:n.product_id)||t.woocommerce_product_id,imported:n?r:t.imported,status:n?r:t.status,item_data:_l(_l({},t.item_data),{},{variations:t.item_data.variations?t.item_data.variations.map((function(e){var t,o=null==n||null===(t=n.variations)||void 0===t?void 0:t.find((function(t){return t.square_product_id===e.id})),a=o?r:e.imported,l=o?r:e.status;return _l(_l({},e),{},{imported:a,status:l})})):t.item_data.variations})})}))},Wl=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;return new Promise((function(n,r){var o=function(){var a=Tl(Il().mark((function a(l){var i,c;return Il().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,i=null,e)try{localStorage.removeItem("inventoryData")}catch(e){console.warn("Failed to remove data from local storage:",e)}else{try{i=localStorage.getItem("inventoryData")}catch(e){console.warn("Failed to retrieve data from local storage:",e)}i&&setTimeout((function(){var e=JSON.parse(i);return n({status:"success",data:e})}),100)}return a.next=5,Ut({path:"/sws/v1/square-inventory".concat(l&&e?"?force=true":"")});case 5:if((c=a.sent).loading)l&&F.info("Fetching data, please wait...",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!1}),setTimeout((function(){return o(!1)}),t);else if(0===c.data.length)F.info("No data available",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),n({status:"success",data:[]});else{try{localStorage.setItem("inventoryData",JSON.stringify(c.data))}catch(e){console.warn("Failed to store data in local storage:",e)}F.success("Products Retreived",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),n({status:"success",data:c.data})}a.next=13;break;case 9:a.prev=9,a.t0=a.catch(0),F.error("Error fetching products: ".concat(a.t0.message||"Server error"),{autoClose:5e3,closeOnClick:!0}),r({status:"error",error:a.t0.message||"Server error"});case 13:case"end":return a.stop()}}),a,null,[[0,9]])})));return function(e){return a.apply(this,arguments)}}();o(!0)}))};function Bl(e){return Bl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bl(e)}function Hl(){Hl=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Bl(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Bl(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function zl(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function Ul(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){zl(a,r,o,l,i,"next",e)}function i(e){zl(a,r,o,l,i,"throw",e)}l(void 0)}))}}var $l=wo("inventory/fetchIfNeeded",Ul(Hl().mark((function e(){var t,n,r,o,a,l,i,c,s=arguments;return Hl().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]&&s[0],r=(n=s.length>1?s[1]:void 0).getState,o=n.rejectWithValue,a=r(),l=a.inventory,!t&&null!==l.data){e.next=25;break}return e.prev=4,e.next=7,Wl(t);case 7:if(i=e.sent,console.log(i),"success"!==i.status){e.next=13;break}return e.abrupt("return",i.data);case 13:if("loading"!==i.status){e.next=17;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 17:throw new Error(i.error);case 18:e.next=23;break;case 20:return e.prev=20,e.t0=e.catch(4),e.abrupt("return",o(e.t0.message));case 23:e.next=45;break;case 25:if(!l.loading){e.next=44;break}return e.prev=26,e.next=29,Wl(!1);case 29:if("success"!==(c=e.sent).status){e.next=34;break}return e.abrupt("return",c.data);case 34:if("loading"!==c.status){e.next=38;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 38:throw new Error(c.error);case 39:e.next=44;break;case 41:return e.prev=41,e.t1=e.catch(26),e.abrupt("return",o(e.t1.message));case 44:return e.abrupt("return",l.data);case 45:case"end":return e.stop()}}),e,null,[[4,20],[26,41]])})))),Zl=fo({name:"inventory",initialState:{data:null,loading:!1,error:null,fetchAttempted:!1},reducers:{setInventory:function(e,t){e.data=t.payload},addItem:function(e,t){e.data.push(t.payload)},removeItem:function(e,t){e.data=e.data.filter((function(e){return e.id!==t.payload}))}},extraReducers:function(e){e.addCase($l.pending,(function(e){e.loading=!0,e.fetchAttempted=!0})).addCase($l.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase($l.rejected,(function(e,t){e.loading=!1,e.data=[],e.error=t.payload}))}}),Yl=Zl.actions,Kl=Yl.setInventory;Yl.addItem,Yl.removeItem;const Xl=Zl.reducer;function Jl(e){return Jl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jl(e)}function Ql(e){return function(e){if(Array.isArray(e))return si(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ci(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ei(){ei=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Jl(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Jl(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function ti(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ni(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ti(Object(n),!0).forEach((function(t){ri(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ti(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ri(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Jl(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Jl(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Jl(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oi(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=ci(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw o}}}}function ai(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function li(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){ai(a,r,o,l,i,"next",e)}function i(e){ai(a,r,o,l,i,"throw",e)}l(void 0)}))}}function ii(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||ci(e,t)||function(){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 ci(e,t){if(e){if("string"==typeof e)return si(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?si(e,t):void 0}}function si(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ui(e){return ui="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ui(e)}function mi(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=gi(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw o}}}}function pi(){pi=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==ui(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(ui(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function fi(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function di(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){fi(a,r,o,l,i,"next",e)}function i(e){fi(a,r,o,l,i,"throw",e)}l(void 0)}))}}function hi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||gi(e,t)||function(){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 gi(e,t){if(e){if("string"==typeof e)return yi(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yi(e,t):void 0}}function yi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const vi=function(t){var n=t.setIsAutoMatchOpen,r=t.inventory,o=hi((0,e.useState)("sku"),2),a=o[0],l=o[1],i=hi((0,e.useState)(!1),2),c=i[0],s=i[1],u=hi((0,e.useState)(""),2),m=u[0],p=u[1],f=function(e,t){for(var n=[],r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n},d=function(){var e=di(pi().mark((function e(t,n){return pi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Ut({path:"/sws/v1/matcher",method:"POST",data:{match_key:n,inventory:t}});case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),console.error("Error sending batch:",e.t0);case 8:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(_x,t){return e.apply(this,arguments)}}(),h=function(){var e=di(pi().mark((function e(){var t,n,o,l;return pi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s(!0),t=f(r,100),n=mi(t),e.prev=4,n.s();case 6:if((o=n.n()).done){e.next=12;break}return l=o.value,e.next=10,d(l,a);case 10:e.next=6;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(4),n.e(e.t0);case 17:return e.prev=17,n.f(),e.finish(17);case 20:p("Auto matcher complete, reload inventory table to see results"),s(!1);case 22:case"end":return e.stop()}}),e,null,[[4,14,17,20]])})));return function(){return e.apply(this,arguments)}}();return wp.element.createElement("div",{className:"w-[40vw] max-w-[40vw] mx-auto bg-white p-6 rounded-xl"},wp.element.createElement("div",{className:"w-full"},wp.element.createElement("header",{className:"flex justify-between items-center gap-2 mb-4"},wp.element.createElement("h3",{className:"text-lg font-medium leading-6 text-gray-900"},"Auto Matcher"))),wp.element.createElement("p",null,"Automatically link your existing WooCommerce products with Square using the SKU matcher. Products that are already linked will be skipped to avoid duplication. For the best results, ensure your WooCommerce product structure aligns with Square—for example, Square variations should correspond to WooCommerce variable products. Make sure each product has a unique SKU, as duplicates may cause issues with automatic syncing."),wp.element.createElement("p",{className:"text-sm font-semibold mt-3"},"Match via:"),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:a,onChange:function(e){return l(e.target.value)}},wp.element.createElement("option",{value:"sku"},"SKU")),m&&wp.element.createElement("p",{className:"text-sky-500 mt-4"},m),c?wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400",disabled:""},wp.element.createElement("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},wp.element.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),wp.element.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})),"Processing...")):wp.element.createElement("div",{className:"flex items-center mt-10 justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(){return n(!1)},className:"relative inline-flex items-center rounded-md bg-gray-400 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"Close"),wp.element.createElement(Za,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"})),wp.element.createElement("button",{type:"button",onClick:h,className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement("span",null,"Start matching"),wp.element.createElement(Ua,{className:"ml-1.5 h-4 w-4 text-white","aria-hidden":"true"}))))};function wi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return bi(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bi(e,t):void 0}}(e,t)||function(){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 bi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var xi="undefined"==typeof AbortController?void 0:new AbortController;const Ei=function(t){var n=t.getInventory,r=t.settings,o=X((function(e){return e.inventory})),a=o.data,l=o.loading,i=o.error,c=(o.fetchAttempted,wi((0,e.useState)(!1),2)),s=c[0],u=c[1],m=wi((0,e.useState)(!1),2),p=m[0],f=m[1],d=wi((0,e.useState)(15),2),h=d[0],g=d[1],y=function(){var t=ii((0,e.useState)(!1),2),n=t[0],r=t[1],o=ii((0,e.useState)([]),2),a=o[0],l=o[1],i=oe(),c=(0,e.useCallback)(function(){var e=li(ei().mark((function e(t,o,a,c){var s,u,m,p,f,d,h,g=arguments;return ei().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=g.length>4&&void 0!==g[4]?g[4]:15,!n){e.next=3;break}return e.abrupt("return");case 3:r(!0),l([]),u=Ml(t,s),m=[],p=oi(u),e.prev=8,d=ei().mark((function e(){var t,n;return ei().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=f.value,e.next=3,Promise.all(t.map(function(){var e=li(ei().mark((function e(t){var n,r,l,i;return ei().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Dl(t,o,a,c);case 3:return n=e.sent,r=n.error?{status:"failed",product_id:"N/A",square_id:t.id,message:n.error}:ni(ni({},n[0]),{},{status:"success"}),ql({type:r.status,message:r.message,context:{product_id:r.product_id,square_id:t.id}}),e.abrupt("return",r);case 9:return e.prev=9,e.t0=e.catch(0),l="AbortError"===e.t0.name?"Request Aborted":e.t0.message,i={status:"failed",product_id:"N/A",square_id:t.id,message:l},ql({type:"error",message:l,context:{product_id:i.product_id,square_id:t.id}}),e.abrupt("return",i);case 15:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(t){return e.apply(this,arguments)}}()));case 3:n=e.sent,m=[].concat(Ql(m),Ql(n)),l((function(e){return[].concat(Ql(e),Ql(n.map((function(e){return e}))))}));case 6:case"end":return e.stop()}}),e)})),p.s();case 11:if((f=p.n()).done){e.next=15;break}return e.delegateYield(d(),"t0",13);case 13:e.next=11;break;case 15:e.next=20;break;case 17:e.prev=17,e.t1=e.catch(8),p.e(e.t1);case 20:return e.prev=20,p.f(),e.finish(20);case 23:if(h=Vl(m,o)){try{localStorage.setItem("inventoryData",JSON.stringify(h))}catch(e){console.warn("Failed to store data in local storage:",e)}i(Kl(h))}r(!1);case 26:case"end":return e.stop()}}),e,null,[[8,17,20,23]])})));return function(_x,t,n,r){return e.apply(this,arguments)}}(),[n,i]);return{isImporting:n,progress:a,importProduct:c}}(),v=y.isImporting,w=y.progress,b=y.importProduct,x=wi((0,e.useState)([]),2),E=x[0],S=x[1],k=wi((0,e.useState)({title:!0,sku:!0,description:!0,stock:!0,image:!0,categories:!0,price:!0}),2),N=k[0],O=k[1],C=wi((0,e.useState)({}),2),j=C[0],P=C[1],L=wi((0,e.useState)([]),2),_=L[0],R=L[1],I=wi((0,e.useState)(""),2),A=I[0],T=I[1],F=wi((0,e.useState)({}),2),M=F[0],D=F[1],G=wi((0,e.useState)([]),2),q=G[0],V=G[1],W=wi((0,e.useState)([]),2),B=W[0],H=(W[1],wi((0,e.useState)(!0),2)),z=H[0],U=H[1],$=wi((0,e.useState)(!1),2),Z=$[0],Y=$[1],K=wi((0,e.useState)(!1),2),J=K[0],Q=K[1],ee=function(t,n,r,o,a,l){var i=n.expanded,c=n.setExpanded,s=n.sorting,u=n.setSorting,m=n.globalFilter,p=n.setGlobalFilter,f=n.isImporting,d=n.setProductsToImport,h=n.setIsDialogOpen,g=n.rowSelection,y=n.setRowSelection,v=n.selectableRows,w=n.setSelectableRows,b=(0,e.useMemo)((function(){return function(e){return e.map((function(e){var t,n,r,o,a,l,i,c,s,u,m,p=((null===(t=e.item_data)||void 0===t?void 0:t.variations)||[]).map((function(e){var t=isNaN(parseInt(e.inventory_count))?0:parseInt(e.inventory_count),n=e.item_variation_data.price_money?e.item_variation_data.price_money.amount/100:0;return{sku:e.item_variation_data.sku,name:e.item_variation_data.name,type:"variation",price:n,status:e.imported,stock:t,id:e.id,woocommerce_product_id:e.woocommerce_product_id||null}})),f=((null===(n=e.item_data)||void 0===n?void 0:n.variations)||[]).map((function(e){return e.item_variation_data.price_money?e.item_variation_data.price_money.amount/100:0})),d=((null===(r=e.item_data)||void 0===r?void 0:r.variations)||[]).map((function(e){return isNaN(parseInt(e.inventory_count))?0:parseInt(e.inventory_count)}));f.length>0?(u=Math.min.apply(Math,fl(f)),m=Math.max.apply(Math,fl(f))):u=m=0;var h=d.length?Math.min.apply(Math,fl(d)):0,g=d.length?Math.max.apply(Math,fl(d)):0;return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ml(Object(n),!0).forEach((function(t){pl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ml(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({sku:Array.isArray(null===(o=e.item_data)||void 0===o?void 0:o.variations)&&e.item_data.variations.length>0&&(null===(a=e.item_data.variations[0])||void 0===a||null===(a=a.item_variation_data)||void 0===a?void 0:a.sku)||"",id:e.id,visibility:e.visibility,is_archived:e.is_archived,name:(null===(l=e.item_data)||void 0===l?void 0:l.name)||"",present_at_location_ids:e.present_at_location_ids,stock:h===g?"".concat(h):"".concat(h," - ").concat(g),image:null!==(i=e.item_data)&&void 0!==i&&i.image_urls?e.item_data.image_urls:null,woocommerce_product_id:e.woocommerce_product_id||null,type:((null===(c=e.item_data)||void 0===c||null===(c=c.variations)||void 0===c?void 0:c.length)||0)>1?"Variable":"Simple",price:u===m?"$".concat(u):"$".concat(u," - $").concat(m),categories:null!==(s=e.item_data)&&void 0!==s&&s.categories?e.item_data.categories:"",status:e.imported},p.length>1&&{subRows:p})}))}(t)}),[t]),x=(0,e.useMemo)((function(){return[{id:"expander",width:50,cell:function(e){var t=e.row;return wp.element.createElement(React.Fragment,null,t.getCanExpand()?wp.element.createElement("button",{type:"button"},wp.element.createElement(hl,{isExpanded:t.getIsExpanded(),row:t})):null)}},{accessorKey:"id",header:function(){return"id"},show:!1},{id:"visibility",accessorKey:"visibility",header:"Visibility",accessorFn:function(e){return e.visibility||""},filterFn:Sl,show:!1},{id:"is_archived",accessorKey:"is_archived",header:"Is Archived",accessorFn:function(e){return e.is_archived},filterFn:kl,show:!1},{accessorKey:"sku",header:function(){return"SKU"},canSort:!0},{accessorKey:"image",header:function(){return""},enableSorting:!1,width:50,cell:function(e){var t=(0,e.getValue)();return t?wp.element.createElement(vl,{value:t}):wp.element.createElement(gl,null)}},{accessorKey:"name",header:function(){return"Name"},canSort:!0,cell:function(e){var t=e.getValue,n=e.row,r=t();return wp.element.createElement("div",null,wp.element.createElement("p",null,r),wp.element.createElement("p",{className:"text-xs text-gray-500"},"ID: ",n.original.id))}},{accessorKey:"type",header:function(){return"Type"},canSort:!0},{accessorKey:"price",canSort:!0,header:function(){return"Price"}},{accessorKey:"stock",canSort:!0,header:function(){return"Stock"}},{accessorKey:"categories",header:function(){return"categories"},canSort:!0,cell:function(e){var t=(0,e.getValue)();return t&&t.length>0?function(e){var t="",n=e.filter((function(e){return!1===e.parent_id}));n.forEach((function(n){var r=e.filter((function(e){return e.parent_id===n.id})).map((function(e){return e.name}));t+=(t?" | ":"")+n.name,r.length>0&&(t+=" -> "+r.join(", "))}));var r=e.filter((function(e){return!n.find((function(t){return t.id===e.id}))&&!n.some((function(t){return t.id===e.parent_id}))}));if(r.length>0){var o=r.map((function(e){return e.name})).join(", ");t+=(t?" | ":"")+o}return t}(t):""}},{accessorKey:"status",canSort:!0,header:function(){return"Status"},cell:function(e){var t=(0,e.getValue)();return wp.element.createElement(yl,{status:t})}},{id:"actions",colSpan:2,cell:function(e){var t,n=e.row;if(!(n.original.subRows&&n.original.subRows.length>0||n.parentId)){var r=(null===(t=n.original.subRows)||void 0===t?void 0:t.filter((function(e){var t;return null===(t=n.subRows)||void 0===t?void 0:t.find((function(t){return t.id===e.id&&t.getIsSelected()}))})))||[],o=Cl(Cl({},n.original),{},{subRows:r.length>0?r:n.original.subRows});return wp.element.createElement("div",{className:"flex items-center justify-end gap-2"},n.original.woocommerce_product_id&&wp.element.createElement("a",{className:"rounded px-2 py-1 text-xs font-semibold text-sky-500 border-sky-500 border hover:border-sky-200 shadow-sm hover:text-sky-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-purple-600 cursor-pointer",href:"/wp-admin/post.php?post=".concat(n.original.woocommerce_product_id,"&action=edit"),target:"_blank",rel:"noopener noreferrer"},"View Woo Product"),wp.element.createElement("button",{type:"button",onClick:function(){d([o]),h(!0)},disabled:f,className:"rounded bg-sky-600 px-2 py-1 text-xs font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 ".concat(f?"opacity-50 cursor-not-allowed":"")},!0===n.original.status?"Sync":"Import"))}}},{id:"select",header:function(e){var t=e.table.getFilteredRowModel().rows.filter((function(e){return!e.original.subRows||0===e.original.subRows.length})),n=t.length>0&&t.every((function(e){return e.getIsSelected()})),r=t.some((function(e){return e.getIsSelected()}))&&!n;return wp.element.createElement("div",{className:"flex justify-center items-center w-full gap-2 relative"},wp.element.createElement(xl,{checked:n,indeterminate:r,onChange:function(e){t.forEach((function(t){t.toggleSelected(e.target.checked)}))}}))},cell:function(e){var t=e.row,n=e.table;return t.original.subRows&&t.original.subRows.length>0||t.parentId?wp.element.createElement(At,{text:"Has Subrows"}):wp.element.createElement("div",{className:"px-1"},wp.element.createElement(xl,{checked:t.getIsSelected(),disabled:!t.getCanSelect(),indeterminate:t.getIsSomeSelected(),onChange:function(e){if(t.depth>0&&e.target.checked){var r=t.getParentRow();null==r||r.toggleSelected(!0),n.setRowSelection((function(n){return Cl(Cl({},n),{},jl({},t.id,e.target.checked))}))}else if(0===t.depth&&e.target.checked){var o;t.toggleSelected(e.target.checked),null===(o=t.subRows)||void 0===o||o.forEach((function(t){n.setRowSelection((function(n){return Cl(Cl({},n),{},jl({},t.id,e.target.checked))}))}))}else if(0!==t.depth||e.target.checked)n.setRowSelection((function(n){return Cl(Cl({},n),{},jl({},t.id,e.target.checked))}));else{var a;t.toggleSelected(e.target.checked),null===(a=t.subRows)||void 0===a||a.forEach((function(t){n.setRowSelection((function(n){return Cl(Cl({},n),{},jl({},t.id,e.target.checked))}))}))}}}))}},{accessorKey:"present_at_location_ids",header:"Location IDs",accessorFn:function(e){return e.present_at_location_ids?e.present_at_location_ids.join(","):""},filterFn:function(e,t,n){return function(e,t,n,r){if(!r)return!0;if(0===e.depth){var o=e.getValue(t);return 0===o.length||o.includes(n)}return!0}(e,t,n,o)},enableSorting:!1,columnVisibility:!1}]}),[]);return(0,e.useMemo)((function(){return jl(jl({data:b,columns:x,state:{expanded:i,sorting:s,columnVisibility:{id:!1,visibility:!1,is_archived:!1,present_at_location_ids:!1},globalFilter:m,rowSelection:g},filterFns:{custom:function(e,t,n){return El(e,t,n,r,o)}},onExpandedChange:c,onRowSelectionChange:y,globalFilterFn:"custom",getSubRows:function(e){return e.subRows||[]},getCoreRowModel:Sa(),getPaginationRowModel:ja(),getFilteredRowModel:ka(),getExpandedRowModel:Oa(),onSortingChange:u,onGlobalFilterChange:p,getSortedRowModel:Na(),autoResetPageIndex:!1,enableRowSelection:!0},"onRowSelectionChange",y),"getRowId",(function(e){return e.id}))}),[b,x,i,s,m,c,u,p,g,y,v,w,r,o])}(a||[],{expanded:j,setExpanded:P,sorting:_,setSorting:R,globalFilter:A,setGlobalFilter:T,isImporting:v,setProductsToImport:S,setIsDialogOpen:u,rowSelection:M,setRowSelection:D,selectableRows:q,setSelectableRows:V},r.location,z),te=La(ee);(0,e.useEffect)((function(){var e=[];z&&e.push({id:"present_at_location_ids",value:r.location}),Z&&e.push({id:"visibility",value:!0}),J&&e.push({id:"is_archived",value:!0}),te.setColumnFilters(e)}),[z,Z,J,r.location,te]),(0,e.useEffect)((function(){te.getCoreRowModel().rows.map((function(e){return e.id}))}),[te.getRowModel()]),(0,e.useEffect)((function(){te.getRowModel().rows.map((function(e){return e.id}))}),[te.getRowModel()]),(0,e.useEffect)((function(){function e(e){v&&(e.preventDefault(),e.returnValue="")}return v&&window.addEventListener("beforeunload",e),function(){window.removeEventListener("beforeunload",e)}}),[v]);var ne=(0,e.useContext)(cl).setBlockNavigation;(0,e.useEffect)((function(){ne(!!v)}),[v,ne]);var re=function(){return te.getFilteredRowModel().rows.filter((function(e){return e.getIsSelected()})).map((function(e){return e.original})).length};return wp.element.createElement("div",null,wp.element.createElement(Ha,{open:p,onClose:function(){return f(!1)},className:"custom-dialog-class"},wp.element.createElement(vi,{setIsAutoMatchOpen:f,inventory:a})),wp.element.createElement(ll,{dataToImport:N,setDataToImport:O,importCount:E.length,importProduct:function(){b(E,a,xi,N,h),te.getState().pagination.pageIndex},controller:xi,isImporting:v,productsToImport:E,rangeValue:h,setRangeValue:g,isDialogOpen:s,progress:w,setIsDialogOpen:function(e){return function(e){u(e)}(e)}}),wp.element.createElement("div",{className:"px-4 pt-5 sm:px-6"},wp.element.createElement("div",{className:"grid grid-cols-3 gap-2 mb-4 items-center"},wp.element.createElement("div",{className:"flex flex-wrap items-center justify-start sm:flex-nowrap"},wp.element.createElement("h2",{className:"text-xl font-semibold"},"Square Inventory"),wp.element.createElement("div",{className:"ml-4 flex flex-shrink-0"},wp.element.createElement("button",{type:"button",onClick:function(){return n(!0)},className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement(_a,{className:"-ml-0.5 mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Refresh")))),wp.element.createElement("div",{className:"relative flex"},wp.element.createElement(Fa,{value:null!=A?A:"",onChange:function(e){return T(e)},className:"block w-full rounded-md border-0 py-1.5 pr-14 pl-4 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sku-600 sm:text-sm sm:leading-6",placeholder:"Search inventory..."}),wp.element.createElement("div",{className:"absolute inset-y-0 right-0 flex py-1.5 pr-1.5"},wp.element.createElement("kbd",{className:"inline-flex items-center rounded border border-gray-200 px-1 font-sans text-xs text-gray-400"},wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-search w-3 h-3"},wp.element.createElement("circle",{cx:"11",cy:"11",r:"8"}),wp.element.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}))))),wp.element.createElement("div",{className:"flex justify-end items-center gap-2"},wp.element.createElement("button",{type:"button",className:"disabled:bg-gray-200 relative inline-flex items-center rounded-md border border-sky-500 px-3 py-2 text-xs font-semibold text-sky-500 shadow-sm hover:bg-sky-500 hover:text-white gap-2"},"Auto Match ",wp.element.createElement(At,null)),wp.element.createElement("button",{type:"button",onClick:function(){var e=te.getFilteredRowModel().rows,t=function(e){return e.subRows&&e.subRows.length>0},n=function(e){return e.depth>0},r=e.filter((function(e){return e.getIsSelected()&&!t(e)&&!n(e)})).map((function(e){return e.original}));if(0===r.length){var o=e.filter((function(e){return!t(e)&&!n(e)})).map((function(e){return e.original}));S(o)}else S(r);u(!0)},className:"disabled:bg-gray-200 relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400 border border-sky-500 hover:border-sky-400"},wp.element.createElement(Ra,{className:"-ml-0.5 mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,re()<1?"Import all":"Import "+re()+" selected products"))),wp.element.createElement("p",{className:"text-xs text-gray-500"},"Data is cached, refresh to update"))),l&&wp.element.createElement("div",{className:"flex gap-2 items-center col-span-full sm:px-6 lg:px-8 relative overflow-auto w-full pb-8"},wp.element.createElement("svg",{className:"text-sky-300 animate-spin",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24"},wp.element.createElement("path",{d:"M32 3C35.8083 3 39.5794 3.75011 43.0978 5.20749C46.6163 6.66488 49.8132 8.80101 52.5061 11.4939C55.199 14.1868 57.3351 17.3837 58.7925 20.9022C60.2499 24.4206 61 28.1917 61 32C61 35.8083 60.2499 39.5794 58.7925 43.0978C57.3351 46.6163 55.199 49.8132 52.5061 52.5061C49.8132 55.199 46.6163 57.3351 43.0978 58.7925C39.5794 60.2499 35.8083 61 32 61C28.1917 61 24.4206 60.2499 20.9022 58.7925C17.3837 57.3351 14.1868 55.199 11.4939 52.5061C8.801 49.8132 6.66487 46.6163 5.20749 43.0978C3.7501 39.5794 3 35.8083 3 32C3 28.1917 3.75011 24.4206 5.2075 20.9022C6.66489 17.3837 8.80101 14.1868 11.4939 11.4939C14.1868 8.80099 17.3838 6.66487 20.9022 5.20749C24.4206 3.7501 28.1917 3 32 3L32 3Z",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"}),wp.element.createElement("path",{d:"M32 3C36.5778 3 41.0906 4.08374 45.1692 6.16256C49.2477 8.24138 52.7762 11.2562 55.466 14.9605C58.1558 18.6647 59.9304 22.9531 60.6448 27.4748C61.3591 31.9965 60.9928 36.6232 59.5759 40.9762",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round",className:"text-sky-500"})),wp.element.createElement("p",null,"Product data is being fetched in the background. Depending on your product database this may take awhile. Feel free to leave this page and come back later.")),i&&wp.element.createElement("p",null,"Error: ",i),!l&&!i&&wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"flex gap-4 items-center sm:px-6 lg:px-8 pb-6"},r.location&&r.location.length>1&&wp.element.createElement("label",{htmlFor:"locationFilterToggle",className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{id:"locationFilterToggle",type:"checkbox",checked:z,onChange:function(){U((function(e){return!e}))},className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Only show products from set location")),wp.element.createElement("label",{htmlFor:"visibilityFilterToggle",className:"relative inline-flex items-center cursor-pointer justify-start mt-0"},wp.element.createElement("input",{id:"visibilityFilterToggle",type:"checkbox",checked:Z,onChange:function(){Y((function(e){return!e}))},className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Filter by Ecom availability")),wp.element.createElement("label",{htmlFor:"archivedFilterToggle",className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{id:"archivedFilterToggle",type:"checkbox",checked:J,onChange:function(){Q((function(e){return!e}))},className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Hide archived products"))),wp.element.createElement("div",{className:"sm:px-6 lg:px-8 relative overflow-auto w-full"},wp.element.createElement("table",{className:"w-full min-w-full whitespace-nowrap text-left bg-white"},wp.element.createElement(qa,{table:te}),wp.element.createElement("tbody",{className:"divide-y divide-gray-200"},te.getRowModel().rows.map((function(e){return wp.element.createElement(Wa,{key:e.id,row:e,toggleExpanded:function(){e.getCanExpand()&&e.toggleExpanded()}})}))))),wp.element.createElement("hr",null),wp.element.createElement(Ba,{table:te,selectablePageRows:B,rowSelection:M,setRowSelection:D})))};function Si(e){return Si="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Si(e)}function ki(){ki=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Si(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Si(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function Ni(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Oi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ni(Object(n),!0).forEach((function(t){Ci(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ni(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ci(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Si(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Si(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Si(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ji(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function Pi(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){ji(a,r,o,l,i,"next",e)}function i(e){ji(a,r,o,l,i,"throw",e)}l(void 0)}))}}function Li(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_i(e,t):void 0}}(e,t)||function(){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 _i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ri(e){return Ri="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ri(e)}function Ii(){Ii=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Ri(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Ri(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function Ai(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function Ti(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){Ai(a,r,o,l,i,"next",e)}function i(e){Ai(a,r,o,l,i,"throw",e)}l(void 0)}))}}function Fi(){return Mi.apply(this,arguments)}function Mi(){return Mi=Ti(Ii().mark((function e(){var t,n,r,o,a,l=arguments;return Ii().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]?l[0]:0,n=l.length>1&&void 0!==l[1]?l[1]:20,r=l.length>2&&void 0!==l[2]?l[2]:[],e.prev=3,e.next=6,Ut({path:"/sws/v1/orders?page=".concat(t,"&per_page=").concat(n)});case 6:if(o=e.sent,(a=o.orders||o)&&0!==a.length){e.next=10;break}return e.abrupt("return",r);case 10:if(r=r.concat(a),!(a.length<n)){e.next=13;break}return e.abrupt("return",r);case 13:return e.abrupt("return",Fi(t+1,n,r));case 16:throw e.prev=16,e.t0=e.catch(3),e.t0;case 19:case"end":return e.stop()}}),e,null,[[3,16]])}))),Mi.apply(this,arguments)}var Di=function(){var e=Ti(Ii().mark((function e(){var t,n,r,o=arguments;return Ii().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:99,n=F.loading("Retrieving Woo Orders"),e.prev=2,e.next=5,Fi(1,t);case 5:return r=e.sent,F.update(n,{render:"Orders Received",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.abrupt("return",{status:"success",data:{orders:r}});case 10:throw e.prev=10,e.t0=e.catch(2),F.update(n,{render:"Error fetching orders: ".concat(e.t0.message||"Server error"),type:"error",isLoading:!1,closeOnClick:!0,autoClose:5e3}),console.error("Error fetching orders:",e.t0),e.t0;case 15:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(){return e.apply(this,arguments)}}();function Gi(e){return Gi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gi(e)}function qi(){qi=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Gi(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Gi(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function Vi(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function Wi(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){Vi(a,r,o,l,i,"next",e)}function i(e){Vi(a,r,o,l,i,"throw",e)}l(void 0)}))}}var Bi=wo("orders/fetchIfNeeded",Wi(qi().mark((function e(){var t,n,r,o,a,l,i,c,s,u=arguments;return qi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=(t=u.length>0&&void 0!==u[0]?u[0]:{}).forceRefresh,r=void 0!==n&&n,t.page,t.perPage,a=(o=u.length>1?u[1]:void 0).getState,l=o.rejectWithValue,i=a(),c=i.orders,!(r||!c.data||c.data.length<1)){e.next=16;break}return e.prev=4,e.next=7,Di();case 7:return s=e.sent,e.abrupt("return",s.data.orders);case 11:return e.prev=11,e.t0=e.catch(4),e.abrupt("return",l(e.t0.error));case 14:e.next=17;break;case 16:return e.abrupt("return",c.data);case 17:case"end":return e.stop()}}),e,null,[[4,11]])})))),Hi=fo({name:"orders",initialState:{data:null,loading:!1,error:null},reducers:{setOrders:function(e,t){e.data=t.payload}},extraReducers:function(e){e.addCase(Bi.pending,(function(e){e.loading=!0})).addCase(Bi.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase(Bi.rejected,(function(e,t){e.loading=!1,e.data=[],e.error=t.payload}))}}),zi=Hi.actions.setOrders;const Ui=Hi.reducer,$i=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M15.312 11.424a5.5 5.5 0 0 1-9.201 2.466l-.312-.311h2.433a.75.75 0 0 0 0-1.5H3.989a.75.75 0 0 0-.75.75v4.242a.75.75 0 0 0 1.5 0v-2.43l.31.31a7 7 0 0 0 11.712-3.138.75.75 0 0 0-1.449-.39Zm1.23-3.723a.75.75 0 0 0 .219-.53V2.929a.75.75 0 0 0-1.5 0V5.36l-.31-.31A7 7 0 0 0 3.239 8.188a.75.75 0 1 0 1.448.389A5.5 5.5 0 0 1 13.89 6.11l.311.31h-2.432a.75.75 0 0 0 0 1.5h4.243a.75.75 0 0 0 .53-.219Z",clipRule:"evenodd"}))})),Zi=function(e){var t=e.fetchOrders;return e.globalFilter,e.setGlobalFilter,wp.element.createElement("div",{className:"flex flex-col justify-between items-start w-full mb-4"},wp.element.createElement("div",{className:"text-sm leading-6 text-gray-900 pt-4 flex gap-4 items-center"},wp.element.createElement("h2",{className:"text-xl font-semibold"},"Woo Orders"),wp.element.createElement("button",{type:"button",onClick:function(){return t()},className:"relative inline-flex items-center rounded-md bg-sky-500 px-3 py-2 text-xs font-semibold text-white shadow-sm hover:bg-sky-400"},wp.element.createElement($i,{className:"-ml-0.5 mr-1.5 h-4 w-4 text-white","aria-hidden":"true"}),wp.element.createElement("span",null,"Refresh"))),wp.element.createElement("p",{className:"text-base"},"Integrating your orders with Square seamlessly generates both a transaction and a customer profile. For orders that require fulfillment, such as shipping, they will automatically appear on Square's Orders page."))},Yi=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))})),Ki=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{fillRule:"evenodd",d:"M9.47 6.47a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 1 1-1.06 1.06L10 8.06l-3.72 3.72a.75.75 0 0 1-1.06-1.06l4.25-4.25Z",clipRule:"evenodd"}))})),Xi=function(e){var t=e.table;return wp.element.createElement("div",{className:"flex justify-between items-center"},wp.element.createElement("div",{className:"flex items-center gap-2 "},wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.setPageIndex(0)},disabled:!t.getCanPreviousPage()},"<<"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.previousPage()},disabled:!t.getCanPreviousPage()},"<"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.nextPage()},disabled:!t.getCanNextPage()},">"),wp.element.createElement("button",{className:"border rounded p-1",onClick:function(){return t.setPageIndex(t.getPageCount()-1)},disabled:!t.getCanNextPage()},">>"),wp.element.createElement("span",{className:"flex items-center gap-1"},wp.element.createElement("div",null,"Page"),wp.element.createElement("strong",null,t.getState().pagination.pageIndex+1," of"," ",t.getPageCount())),wp.element.createElement("span",{className:"flex items-center gap-1"},"| Go to page:",wp.element.createElement("input",{type:"number",defaultValue:t.getState().pagination.pageIndex+1,onChange:function(e){var n=e.target.value?Number(e.target.value)-1:0;t.setPageIndex(n)},className:"border p-1 rounded w-16"})),wp.element.createElement("select",{value:t.getState().pagination.pageSize,onChange:function(e){t.setPageSize(Number(e.target.value))}},[10,20,30,40,50].map((function(e){return wp.element.createElement("option",{key:e,value:e},"Show ",e)})))))};function Ji(e){return Ji="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ji(e)}function Qi(){Qi=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Ji(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Ji(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function ec(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function tc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function nc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tc(Object(n),!0).forEach((function(t){rc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function rc(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Ji(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Ji(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ji(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ac(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ac(e,t):void 0}}(e,t)||function(){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 ac(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const lc=function(t){var n=t.data,r=oe(),o=(X((function(e){return e.orders})).loading,oc((0,e.useState)(""),2)),a=o[0],l=o[1],i=oc((0,e.useState)([]),2),c=i[0],s=i[1],u=oc((0,e.useState)({}),2),m=u[0],p=u[1],f=oc((0,e.useState)(null),2),d=f[0],h=f[1],g=function(e,t){return n.map((function(n){return n&&n.id&&n.id===e?nc(nc({},n),{},{square_data:JSON.stringify(t)}):n}))},y=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){ec(a,r,o,l,i,"next",e)}function i(e){ec(a,r,o,l,i,"throw",e)}l(void 0)}))}}(Qi().mark((function e(t){var n,o;return Qi().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h(t),n=F.loading("Attempting to create Square order & transaction"),e.prev=2,e.next=5,Ut({path:"/sws/v1/orders",method:"POST",data:{order_id:t}});case 5:(o=e.sent).data.payment||o.data.order?(F.update(n,{render:"Created successfully",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),r(zi(g(t,o.data)))):F.update(n,{render:"Failed to create order & transaction",type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0}),h(null),e.next=15;break;case 10:e.prev=10,e.t0=e.catch(2),F.update(n,{render:"Failed to create order & transaction: "+e.t0.error,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0}),console.log(e.t0),h(null);case 15:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(_x){return e.apply(this,arguments)}}(),v=(0,e.useMemo)((function(){return[{id:"expander",width:50,cell:function(e){var t=e.row;return t.getCanExpand()?wp.element.createElement("button",{type:"button",onClick:function(){p((function(e){return nc(nc({},e),{},rc({},t.id,!e[t.id]))}))}},t.getIsExpanded()?wp.element.createElement(Jt,{className:"w-4 h-4 text-black"}):wp.element.createElement(Yi,{className:"w-4 h-4 text-black"})):null}},{accessorKey:"id",header:function(){return"ID"},enableSorting:!0},{accessorKey:"date",header:function(){return"Order Created"},enableSorting:!0},{accessorKey:"status",header:function(){return"Order Status"},cell:function(e){var t=(0,e.getValue)();return wp.element.createElement("span",{className:Va("capitalize inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium","pending"===t?"bg-orange-100 text-orange-700":"completed"===t?"bg-green-100 text-green-700":"processing"===t?"bg-sky-100 text-sky-700":"bg-gray-100 text-gray-700")},wp.element.createElement("svg",{className:"h-1.5 w-1.5 mt-[2px]",viewBox:"0 0 6 6","aria-hidden":"true",fill:"currentColor"},wp.element.createElement("circle",{cx:3,cy:3,r:3})),t)},enableSorting:!0},{accessorKey:"customer",header:function(){return"Customer"},cell:function(e){var t=(0,e.getValue)();return wp.element.createElement("span",null,t.first_name?t.first_name:"Guest"," ",t.last_name)},enableSorting:!0},{accessorKey:"total",header:function(){return"Order Total"},cell:function(e){var t=e.getValue;return wp.element.createElement("span",null,"$",t())},enableSorting:!0},{accessorKey:"sync_statuc",header:function(){return"Sync Status"},cell:function(e){return e.row.original.square_data?wp.element.createElement("span",{className:"inline-flex items-center gap-x-1.5 rounded-md bg-green-100 px-2 py-1 text-xs font-medium text-green-700"},wp.element.createElement("svg",{className:"h-1.5 w-1.5 fill-green-500",viewBox:"0 0 6 6","aria-hidden":"true"},wp.element.createElement("circle",{cx:"3",cy:"3",r:"3"})),"Synced"):wp.element.createElement("span",{className:"inline-flex items-center gap-x-1.5 rounded-md bg-red-100 px-2 py-1 text-xs font-medium text-red-700"},wp.element.createElement("svg",{className:"h-1.5 w-1.5 fill-red-500",viewBox:"0 0 6 6","aria-hidden":"true"},wp.element.createElement("circle",{cx:3,cy:3,r:3})),"Not synced")},enableSorting:!0},{id:"actions",colSpan:2,cell:function(e){var t=e.row;return wp.element.createElement("div",{className:"flex items-center justify-end gap-2"},wp.element.createElement("button",{type:"button",onClick:function(e){e.stopPropagation(),w.setExpanded((function(e){return nc(nc({},e),{},rc({},t.id,!e[t.id]))}))},className:"rounded px-2 py-1 text-xs font-semibold text-sky-500 border-sky-500 border hover:border-sky-200 shadow-sm hover:text-sky-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-purple-600 cursor-pointer"},"View details"))}}]}),[]),w=La(rc(rc(rc({data:n,columns:v,state:{sorting:c,globalFilter:a,expanded:m},filterFns:{custom:El},onSortingChange:s,onExpandedChange:p,globalFilterFn:"custom",onGlobalFilterChange:l,getCoreRowModel:Sa(),getSortedRowModel:Na(),getFilteredRowModel:ka(),getPaginationRowModel:ja(),getExpandedRowModel:Oa()},"onSortingChange",s),"onGlobalFilterChange",l),"debugTable",!0)),b=function(e){return JSON.parse(e)};return wp.element.createElement(React.Fragment,null,wp.element.createElement(Zi,{fetchOrders:function(){return r(Bi({forceRefresh:!0}))},setGlobalFilter:l,globalFilter:a}),wp.element.createElement("table",{className:"w-full"},wp.element.createElement("thead",{className:"border-b border-gray-900/10 text-sm leading-6 text-gray-900"},w.getHeaderGroups().map((function(e){return wp.element.createElement("tr",{key:e.id},e.headers.map((function(e){var t;return wp.element.createElement("th",{key:e.id,colSpan:e.colSpan,className:"p-2 font-bold text-left"},e.isPlaceholder?null:wp.element.createElement("div",{className:e.column.getCanSort()?"cursor-pointer select-none":"",onClick:e.column.getToggleSortingHandler()},Pa(e.column.columnDef.header,e.getContext()),null!==(t={asc:wp.element.createElement(Ki,{className:"w-4 h-4 inline-block ml-1"}),desc:wp.element.createElement(Jt,{className:"w-4 h-4 inline-block ml-1"})}[e.column.getIsSorted()])&&void 0!==t?t:null))})))}))),wp.element.createElement("tbody",{className:"divide-y divide-gray-200"},w.getRowModel().rows.map((function(t){return d&&d===t.original.id?wp.element.createElement("tr",{key:t.id},wp.element.createElement("td",{colSpan:100},wp.element.createElement("div",{className:"animate-pulse h-6 bg-gray-200 rounded my-1"}))):wp.element.createElement(e.Fragment,{key:t.id},wp.element.createElement("tr",{className:"cursor-pointer",onClick:function(){w.setExpanded((function(e){return nc(nc({},e),{},rc({},t.id,!e[t.id]))}))}},t.getVisibleCells().map((function(e){return"expander"===e.column.id?wp.element.createElement("td",{key:e.id,className:"py-4 px-2",onClick:function(e){e.stopPropagation(),w.setExpanded((function(e){return nc(nc({},e),{},rc({},t.id,!e[t.id]))}))}},wp.element.createElement("button",{type:"button","aria-label":"Expand row"},t.getIsExpanded()?wp.element.createElement(Jt,{className:"w-4 h-4 text-black"}):wp.element.createElement(Yi,{className:"w-4 h-4 text-black"}))):wp.element.createElement("td",{key:e.id,className:"py-4 px-2 text-gray-600"},Pa(e.column.columnDef.cell,e.getContext()))}))),t.getIsExpanded()&&wp.element.createElement("tr",null,wp.element.createElement("td",{colSpan:100,className:""}," ",wp.element.createElement("div",{className:"p-6 mb-4 grid md:grid-cols-12 w-full gap-10 bg-slate-50 rounded-b-xl"},wp.element.createElement("div",{className:"md:col-span-full"},wp.element.createElement("div",{className:" flex items-center justify-center gap-4"},wp.element.createElement("a",{className:"rounded px-2 py-1 text-xs font-semibold text-sky-500 border-sky-500 border hover:border-sky-200 shadow-sm hover:text-sky-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-purple-600 cursor-pointer",href:"/wp-admin/post.php?post=".concat(t.original.id,"&action=edit"),target:"_blank"},"View Woo Order"),t.original.square_data||"completed"!==t.original.status&&"processing"!==t.original.status?wp.element.createElement(React.Fragment,null):wp.element.createElement("button",{type:"button",onClick:function(){return y(t.original.id)},className:"rounded bg-sky-600 px-2 py-1 text-xs font-semibold text-white border border-sky-600 hover:border-sky-500 shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600"},"Sync to Square")),t.original.square_data||"completed"===t.original.status&&"processing"===t.original.status?wp.element.createElement(React.Fragment,null):wp.element.createElement("p",{className:"text-center mt-2 mx-auto max-w-xl"},"Only completed or processing orders can be synced to Square")),wp.element.createElement("div",{className:"md:col-span-6"},wp.element.createElement("p",{className:"font-semibold text-lg mb-4"},"Order Line Items"),wp.element.createElement("ul",{className:"divide-y divide-gray-200"},t.original.line_items.map((function(e){return wp.element.createElement("li",{key:e.product_id,className:"flex gap-2 items-center py-2"},e.image?wp.element.createElement("img",{src:e.image,className:"w-12 h-12 object-contain rounded-lg"}):wp.element.createElement("div",{className:"w-12 h-12 object-contain rounded-lg bg-white flex items-center justify-center"},wp.element.createElement(gl,null)),wp.element.createElement("div",null,wp.element.createElement("p",{className:"font-semibold"},e.product_name),wp.element.createElement("p",null,"SKU:"," ",wp.element.createElement("span",{className:"text-sky-500"},e.sku)),wp.element.createElement("p",null,"Square product ID:"," ",wp.element.createElement("span",{className:"".concat(e.square_product_id.length>0?"text-sky-500":"text-red-500")},e.square_product_id.length>0?e.square_product_id:"Not Linked")),wp.element.createElement("p",null,"Price: $",e.price," ","x"," ",e.quantity," ","| Total cost: $",e.total)))})))),wp.element.createElement("div",{className:"md:col-span-6"},wp.element.createElement("p",{className:"font-semibold text-lg mb-4"},"Order Totals"),wp.element.createElement("ul",{className:"w-fulldivide-y divide-slate-100"},wp.element.createElement("li",{className:"flex justify-between"},"Subtotal:"," ",wp.element.createElement("strong",null,"$",t.original.order_subtotal.toFixed(2))),wp.element.createElement("li",{className:"flex justify-between"},"Discount Total:"," ",wp.element.createElement("strong",null,"-$",t.original.discount_total)),wp.element.createElement("li",{className:"flex justify-between"},"Shipping Total:"," ",wp.element.createElement("strong",null,"$",t.original.shipping_total)),wp.element.createElement("li",{className:"flex justify-between"},"Total Tax:"," ",wp.element.createElement("strong",null,"$",t.original.total_tax)),wp.element.createElement("li",{className:"flex justify-between"},"Total:"," ",wp.element.createElement("strong",null,"$",t.original.total))),wp.element.createElement("p",{className:"font-semibold text-lg mb-4 mt-8"},"Customer Details"),wp.element.createElement("ul",{className:"divide-y divide-slate-100"},t.original.customer&&Object.keys(t.original.customer).length>0?Object.keys(t.original.customer).map((function(e){return wp.element.createElement(React.Fragment,null,t.original.customer[e]&&wp.element.createElement("li",{key:t.original.customer[e],className:"grid grid-cols-2"},wp.element.createElement("span",{className:"capitalize"},e.replace("_"," "),":")," ",wp.element.createElement("span",{className:"text-left font-bold"},t.original.customer[e])))})):wp.element.createElement("p",null,"Guest Customer"))),wp.element.createElement("div",{className:"md:col-span-full"},wp.element.createElement("p",{className:"font-semibold text-lg mb-4"},"Square Order Details"),t.original.square_data?wp.element.createElement("div",{className:"flex justify-start gap-20 items-start"},wp.element.createElement("div",null,wp.element.createElement("p",{className:"text-base font-semibold"},"Order details:"),wp.element.createElement("p",null,"Order ID:"," ",wp.element.createElement("span",{className:"font-semibold"},b(t.original.square_data).order.data.order.id)),wp.element.createElement("p",null,"Ticket name:"," ",wp.element.createElement("span",{className:"font-semibold"},b(t.original.square_data).order.data.order.ticket_name)),wp.element.createElement("a",{href:"https://squareup.com/dashboard/orders/overview/".concat(b(t.original.square_data).order.data.order.id),target:"_blank",className:"text-sky-500"},"View order")),wp.element.createElement("div",null,b(t.original.square_data).payment&&b(t.original.square_data).payment.data&&wp.element.createElement(React.Fragment,null," ",wp.element.createElement("p",{className:"text-base font-semibold"},"Payment Details:"),wp.element.createElement("p",null,"Payment ID:"," ",wp.element.createElement("span",{className:"font-semibold"},b(t.original.square_data).payment.data.payment.id)),wp.element.createElement("p",null,"Receipt Number:"," ",wp.element.createElement("span",{className:"font-semibold"},b(t.original.square_data).payment.data.payment.receipt_number)),wp.element.createElement("a",{href:b(t.original.square_data).payment.data.payment.receipt_url,target:"_blank",className:"text-sky-500"},"View receipt")))):wp.element.createElement("p",null,"Sync this order with Square to view orders details provided by Square"))))))})))),wp.element.createElement("hr",null),wp.element.createElement("div",{className:"py-4"},wp.element.createElement(Xi,{table:w})))};function ic(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const cc=function(){return wp.element.createElement("div",null,wp.element.createElement("div",{className:" sm:px-6 px-4 py-5"},wp.element.createElement("div",{className:"flex flex-wrap items-center justify-start sm:flex-nowrap"},wp.element.createElement("h2",{className:"text-base font-semibold leading-7 text-gray-900"},"Woo Orders"))),wp.element.createElement("div",{className:"overflow-x-auto"},wp.element.createElement("table",{className:"whitespace-nowrap text-left bg-white w-full"},wp.element.createElement("colgroup",null,wp.element.createElement("col",{className:"w-full lg:w-1/12"}),wp.element.createElement("col",{className:"w-full lg:w-2/12"})),wp.element.createElement("thead",{className:"border-b border-gray-900/10 text-sm leading-6 text-gray-900"},wp.element.createElement("tr",null,wp.element.createElement("th",{scope:"col",className:"py-2 pl-4 pr-8 font-semibold sm:pl-6 lg:pl-8"},"ID"),wp.element.createElement("th",{scope:"col",className:"py-2 pl-4 pr-8 font-semibold sm:pl-6 lg:pl-8"},"Order Created"),wp.element.createElement("th",{scope:"col",className:"hidden py-2 pl-0 pr-8 font-semibold sm:table-cell"},"Order Status"),wp.element.createElement("th",{scope:"col",className:"hidden py-2 pl-0 pr-8 font-semibold sm:table-cell"},"Customer"),wp.element.createElement("th",{scope:"col",className:"hidden py-2 pl-0 pr-8 font-semibold sm:table-cell"},"Order Total"),wp.element.createElement("th",{scope:"col",className:"py-2 pl-0 pr-4 text-right font-semibold sm:pr-8 sm:text-left lg:pr-20"},"Sync Status"),wp.element.createElement("th",{scope:"col",className:"hidden py-2 pl-0 pr-4 text-right font-semibold sm:table-cell sm:pr-6 lg:pr-8"},"Actions"))),wp.element.createElement("tbody",{className:"divide-y divide-gray-200 animate-pulse"},function(e){return function(e){if(Array.isArray(e))return ic(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return ic(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ic(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Array(3)).map((function(e,t){return wp.element.createElement("tr",{key:t},wp.element.createElement("td",{colSpan:7,className:"py-2 pl-4 pr-8 sm:pl-6 lg:pl-8"},wp.element.createElement("div",{className:"h-6 bg-gray-200 rounded"})))}))))))};function sc(e){return sc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sc(e)}function uc(){uc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==sc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(sc(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function mc(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function pc(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){mc(a,r,o,l,i,"next",e)}function i(e){mc(a,r,o,l,i,"throw",e)}l(void 0)}))}}function fc(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return dc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dc(e,t):void 0}}(e,t)||function(){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 dc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var hc=(0,t.createContext)(),gc=function(e){var n=e.children,r=An().settings,o=fc((0,t.useState)([]),2),a=o[0],l=o[1],i=fc((0,t.useState)(!1),2),c=i[0],s=i[1],u=fc((0,t.useState)(""),2),m=u[0],p=u[1];(0,t.useEffect)((function(){var e=function(){var e=pc(uc().mark((function e(){var t;return uc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s(!0),e.prev=1,e.next=4,Ut({path:"/sws/v1/settings/get-locations",method:"GET"});case 4:t=e.sent,l(t.locations.data.locations),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),p("Failed to get locations"),F({render:"Failed to get locations: "+e.t0.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 12:return e.prev=12,s(!1),e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[1,8,12,15]])})));return function(){return e.apply(this,arguments)}}();r.accessToken&&e()}),[r.accessToken]);var f=function(){var e=pc(uc().mark((function e(){var t;return uc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s(!0),e.prev=1,e.next=4,Ut({path:"/sws/v1/settings/get-locations",method:"GET"});case 4:t=e.sent,l(t.locations.data.locations),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),p("Failed to get locations"),F({render:"Failed to get locations: "+e.t0.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0});case 12:return e.prev=12,s(!1),e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[1,8,12,15]])})));return function(){return e.apply(this,arguments)}}();return wp.element.createElement(hc.Provider,{value:{locations:a,loading:c,error:m,refetchLocations:f,setLocations:l}},n)},yc=function(){return(0,t.useContext)(hc)};function vc(e){return vc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vc(e)}function wc(){wc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==vc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(vc(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function bc(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function xc(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){bc(a,r,o,l,i,"next",e)}function i(e){bc(a,r,o,l,i,"throw",e)}l(void 0)}))}}function Ec(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Sc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Sc(e,t):void 0}}(e,t)||function(){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 Sc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function kc(t){t.getLocations,t.setLocationsLoading;var n=An(),r=n.settings,o=n.getAccessToken,a=n.updateAccessToken,l=n.removeAccessToken,i=n.updateSettings,c=yc(),s=(c.locations,c.refetchLocations),u=c.setLocations,m=Ec((0,e.useState)(""),2),p=m[0],f=m[1],d=Ec((0,e.useState)(!0),2),h=d[0],g=d[1];(0,e.useEffect)((function(){var e=function(){var e=xc(wc().mark((function e(){return wc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g(!0),r.accessToken){e.next=4;break}return e.next=4,o({silent:!0});case 4:g(!1);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[r.accessToken,o]);var y=function(){var e=xc(wc().mark((function e(t){return wc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.preventDefault(),g(!0),e.next=4,a(p);case 4:f(""),g(!1),s();case 7:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}(),v=function(){var e=xc(wc().mark((function e(){return wc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return g(!0),e.next=3,l().then((function(){i("location",""),u([])}));case 3:g(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return wp.element.createElement("div",{className:"px-4 pb-5"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Your Square Access Token"),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500"},wp.element.createElement("p",null,"Read the following documentation on how to create a Square access token: ",wp.element.createElement("br",null),wp.element.createElement("a",{href:"https://squaresyncforwoo.com/documentation#access-token",target:"_blank",rel:"noopener noreferrer",className:"underline text-sky-500"},"How to obtain Square Access Token"))),r.accessToken?wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"mt-5 sm:flex sm:items-center"},wp.element.createElement("input",{type:"text",name:"existingToken",id:"existingToken",className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 !pr-10",value:r.accessToken,disabled:!0}),wp.element.createElement("button",{onClick:v,type:"button",className:"mt-3 w-full sm:ml-3 sm:mt-0 sm:w-auto inline-flex justify-center items-center rounded-md bg-red-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600",disabled:h},h?"Loading":"Remove token")),wp.element.createElement("p",{className:"mt-2"},"Removing your access token will stop all synchronization with Square.")):wp.element.createElement("form",{className:"mt-5 sm:flex sm:items-center",onSubmit:y},wp.element.createElement("div",{className:"w-full sm:max-w-xs"},wp.element.createElement("label",{htmlFor:"accessToken",className:"sr-only"},"Access Token"),wp.element.createElement("input",{type:"text",name:"accessToken",id:"accessToken",className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 !pr-10 w-full",placeholder:"Enter your access token",value:p,onChange:function(e){return f(e.target.value)},disabled:h})),wp.element.createElement("button",{type:"submit",className:"mt-3 w-full sm:ml-3 sm:mt-0 sm:w-auto inline-flex justify-center items-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600",disabled:h},h?"Loading":"Save")))}o(42);const Nc=function(){return wp.element.createElement("div",{className:"px-6 pb-6 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Webhook URL"),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500"},wp.element.createElement("p",null,"The webhook URL is used to keep a live sync between square and woocommerce. Copy this URL and paste it into your square developer webhook subscriptions. Read the following documentation on how to do this:",wp.element.createElement("br",null),wp.element.createElement("a",{href:"https://squaresyncforwoo.com/documentation#webhook",target:"_blank",className:"underline text-sky-500"},"Setting up webhook url to retrieve inventory and customer updates"))),wp.element.createElement("div",{className:"max-w-xl flex items-center mt-4"},wp.element.createElement("input",{disabled:!0,name:"webhookURL",className:"block disabled:text-gray-700 w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 blur",value:"https://".concat(window.location.hostname)})))},Oc=function(){return wp.element.createElement("svg",{className:"animate-spin mt-4 h-5 w-5 text-sky-500",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},wp.element.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),wp.element.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"}))};function Cc(e){return Cc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cc(e)}function jc(){jc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Cc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Cc(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function Pc(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function Lc(e){var t=e.updateSettings,n=e.locations,r=e.settings,o=e.locationsLoading,a=function(){var e=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){Pc(a,r,o,l,i,"next",e)}function i(e){Pc(a,r,o,l,i,"throw",e)}l(void 0)}))}}(jc().mark((function e(n){return jc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n.preventDefault(),t("location",n.target.value);case 2:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}();return wp.element.createElement("div",{className:"px-4 pb-5"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Square Locations"),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500"},wp.element.createElement("p",null,"Select the location you wish to derive your websites products and inventory from: ",wp.element.createElement("br",null))),o?wp.element.createElement(Oc,null):wp.element.createElement("div",null,wp.element.createElement("select",{id:"location",name:"location",onChange:function(e){return a(e)},value:r.location?r.location:"",className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10"},wp.element.createElement("option",{value:"",disabled:!0},"Select your location"),n.map((function(e){return wp.element.createElement("option",{key:e.id,value:e.id},e.name)})))))}const _c=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 0 1 1.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.559.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.894.149c-.424.07-.764.383-.929.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 0 1-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.398.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 0 1-.12-1.45l.527-.737c.25-.35.272-.806.108-1.204-.165-.397-.506-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.108-1.204l-.526-.738a1.125 1.125 0 0 1 .12-1.45l.773-.773a1.125 1.125 0 0 1 1.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894Z"}),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))})),Rc=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 8.25h19.5M2.25 9h19.5m-16.5 5.25h6m-6 2.25h3m-3.75 3h15a2.25 2.25 0 0 0 2.25-2.25V6.75A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25v10.5A2.25 2.25 0 0 0 4.5 19.5Z"}))})),Ic=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"}))})),Ac=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25ZM6.75 12h.008v.008H6.75V12Zm0 3h.008v.008H6.75V15Zm0 3h.008v.008H6.75V18Z"}))})),Tc=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 11.25v8.25a1.5 1.5 0 0 1-1.5 1.5H5.25a1.5 1.5 0 0 1-1.5-1.5v-8.25M12 4.875A2.625 2.625 0 1 0 9.375 7.5H12m0-2.625V7.5m0-2.625A2.625 2.625 0 1 1 14.625 7.5H12m0 0V21m-8.625-9.75h18c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125h-18c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"}))}));var Fc=[{name:"General",href:"/settings/general",icon:_c},{name:"Payments",href:"/settings/payments",icon:Rc},{name:"Products",href:"/settings/inventory",icon:Ic},{name:"Customers",href:"/settings/customers",icon:yn},{name:"Orders",href:"/settings/orders",icon:Ac},{name:"Loyalty",href:"/settings/loyalty",icon:Tc}];function Mc(e){var t=e.children;return mn(),wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"lg:flex lg:gap-x-4 bg-white rounded-2xl shadow-lg p-6"},wp.element.createElement("aside",{className:"flex border-b border-gray-900/5 lg:block lg:w-64 lg:flex-none lg:border-0 "},wp.element.createElement("nav",{className:"flex-none px-4 sm:px-6 lg:px-0"},wp.element.createElement("ul",{role:"list",className:"flex gap-x-3 gap-y-1 whitespace-nowrap lg:flex-col"},Fc.map((function(e){return"Payments"===e.name?wp.element.createElement("li",{key:e.name},wp.element.createElement("a",{href:"/wp-admin/admin.php?page=wc-settings&tab=checkout§ion=squaresync_credit",className:Va(location.hash.replace(/^#/,"")===e.href?"bg-gray-50 text-sky-600":"text-gray-700 hover:text-sky-600 hover:bg-gray-50","group flex gap-x-3 rounded-lg py-2 pl-2 pr-3 text-sm leading-6 font-semibold")},wp.element.createElement(e.icon,{className:Va(location.hash.replace(/^#/,"")===e.href?"text-sky-600":"text-gray-400 group-hover:text-sky-600","h-6 w-6 shrink-0"),"aria-hidden":"true"}),e.name)):wp.element.createElement("li",{key:e.name},wp.element.createElement(Ct,{to:e.href,className:Va(location.hash.replace(/^#/,"")===e.href?"bg-gray-50 text-sky-600":"text-gray-700 hover:text-sky-600 hover:bg-gray-50","group flex gap-x-3 rounded-lg py-2 pl-2 pr-3 text-sm leading-6 font-semibold")},wp.element.createElement(e.icon,{className:Va(location.hash.replace(/^#/,"")===e.href?"text-sky-600":"text-gray-400 group-hover:text-sky-600","h-6 w-6 shrink-0"),"aria-hidden":"true"}),e.name))}))))),wp.element.createElement("main",{className:"px-4 sm:px-6 lg:flex-auto lg:px-0"},t)))}function Dc(e){return Dc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Dc(e)}function Gc(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Dc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Dc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Dc(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qc(){qc=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Dc(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Dc(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function Vc(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function Wc(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){Vc(a,r,o,l,i,"next",e)}function i(e){Vc(a,r,o,l,i,"throw",e)}l(void 0)}))}}function Bc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Hc(t){var n=t.updateSettings,r=(t.environment,t.settings),o=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Bc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(!0),2),a=(o[0],o[1],function(){var e=Wc(qc().mark((function e(t){return qc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.preventDefault(),n("environment",t.target.value);case 2:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}()),l=function(){var e=Wc(qc().mark((function e(t,n){var r;return qc().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Vt()({path:"/sws/v1/settings/update-gateway-settings",method:"POST",data:Gc({},t,n)});case 3:return r=e.sent,F.success("Settings updated successfully!"),e.abrupt("return",r);case 8:e.prev=8,e.t0=e.catch(0),F.error("Failed to update settings: ".concat(e.t0.message));case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(t,n){return e.apply(this,arguments)}}();return wp.element.createElement("div",{className:"px-4 pb-5"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Environment"),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500"},wp.element.createElement("p",null,"Switch between testing (sandbox) account and live environment, you'll also need to change your access token and location above to the matching environments",wp.element.createElement("br",null))),wp.element.createElement("div",null,wp.element.createElement("select",{id:"environment",name:"location",onChange:function(e){a(e),l("square_mode",e.target.value)},value:r.environment?r.environment:"live",className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10"},wp.element.createElement("option",{value:"live"},"Live"),wp.element.createElement("option",{value:"sandbox"},"Sandbox"))))}function zc(){mn();var e=An(),t=e.settings,n=e.updateSettings,r=e.settingsLoading,o=yc(),a=o.locations,l=o.loading,i=(o.error,o.refetchLocations);return wp.element.createElement(Mc,null,r?wp.element.createElement("div",null,"Loading..."):wp.element.createElement(React.Fragment,null,wp.element.createElement(kc,{updateSettings:n,settings:t,setLocationsLoading:i,setLocations:i,getLocations:i}),wp.element.createElement(Lc,{updateSettings:n,locations:a,locationsLoading:l,settings:t}),wp.element.createElement(Hc,{updateSettings:n,environment:t.environment,settings:t}),wp.element.createElement(Nc,null)))}function Uc(e){return Uc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uc(e)}function $c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Zc(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Uc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Uc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Uc(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const Kc=function(t){var n=t.settings,r=(t.updateSettings,t.settingsLoading,function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Yc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yc(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$c(Object(n),!0).forEach((function(t){Zc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},n.customers.auto.squareWoo)),2)),o=r[0],a=r[1];return(0,e.useEffect)((function(){a(n.customers.auto.squareWoo)}),[n]),o.first_name,o.last_name,o.address,o.phone,o.role,wp.element.createElement("div",{className:"px-4 pb-3 sm:px-6 mt-4"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic Customer Syncing",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",null,"Sync your customer info in real-time from Square to WooCommerce and vise-versa.",wp.element.createElement("br",null))),wp.element.createElement("div",{className:""},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to Woo (Webhook customer.updated must be setup)"))))};function Xc(e){return Xc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xc(e)}function Jc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Qc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jc(Object(n),!0).forEach((function(t){es(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function es(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=Xc(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=Xc(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Xc(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ts(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const ns=function(t){var n=t.settings,r=t.updateSettings,o=(t.settingsLoading,function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ts(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ts(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(Qc({},n.customers.auto.wooSquare)),2)),a=o[0],l=o[1];return(0,e.useEffect)((function(){l(n.customers.auto.wooSquare)}),[n]),a.first_name,a.last_name,a.address,a.phone,a.role,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("div",{className:""},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,onChange:function(){r("customers",Qc(Qc({},n.customers),{},{auto:Qc(Qc({},n.customers.auto),{},{wooSquare:Qc(Qc({},a),{},{is_active:!a.is_active})})}))},className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square"))))},rs=function(e){var t=e.settings;return e.updateSettings,e.setSettings,t.customers,wp.element.createElement("div",{className:"px-4 pb-3 sm:px-6 mt-4"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Auto Customer Matching",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Automatically match newly created WordPress or Square users with existing accounts on the corresponding platform. This will also set the users role based on the role mapping setup.")),wp.element.createElement("div",{className:"flex flex-col gap-3"},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to Woo (Webhook customer.created must be setup)")),wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square"))))},os=function(e){var t=e.settings;return e.updateSettings,e.setSettings,t.customers,wp.element.createElement("div",{className:"px-4 pb-3 sm:px-6 mt-4"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Auto Customer Creation",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Automatically create Square and WordPress users when one is created on either platform. User roles and groups will be automatically assigned based on role mappings.")),wp.element.createElement("div",{className:"flex flex-col gap-3"},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to Woo (Webhook customer.created must be setup)")),wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square"))))};function as(e){return as="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},as(e)}function ls(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function is(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=as(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=as(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==as(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cs(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const ss=function(t){var n=t.settings,r=(t.updateSettings,t.settingsLoading),o=(0,e.useState)(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ls(Object(n),!0).forEach((function(t){is(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ls(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},n.squareAuto)),a=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return cs(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?cs(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(o,2),l=a[0],i=a[1];(0,e.useEffect)((function(){i(n.squareAuto)}),[n]);var c=function(e){var t=e.id,n=e.label;return e.checked,e.squareWoo,wp.element.createElement("li",{className:"w-auto mb-0"},wp.element.createElement("div",{className:"flex items-center gap-2 p-4"},wp.element.createElement("input",{id:t,type:"checkbox",checked:!1,className:"!m-0 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2 leading-normal"}),wp.element.createElement("label",{htmlFor:t,className:"w-full text-sm font-light text-gray-700 leading-normal"},n)))},s=[{id:"stock",label:"Stock",checked:l.stock||!1},{id:"title",label:"Title",checked:l.title||!1},{id:"sku",label:"SKU",checked:l.sku||!1},{id:"price",label:"Price",checked:l.price||!1},{id:"description",label:"Description",checked:l.description||!1},{id:"images",label:"Images",checked:l.images||!1},{id:"category",label:"Category",checked:l.category||!1}];return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic syncing on product update",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",null,"Enable or disable automatic inventory syncing between Woo and Square effortlessly with our Inventory Sync Toggle. This automatic update is triggered when your Square or Woocommerce data is updated.",wp.element.createElement("br",null),wp.element.createElement("a",{href:"https://squaresyncforwoo.com/documentation#import-data",className:"underline text-sky-500",target:"_blank"},"How to setup and control automatic syncing between Square and Woo"))),wp.element.createElement("div",{className:""},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer justify-start"},wp.element.createElement("input",{type:"checkbox",checked:!1,disabled:!0,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to woo (Webhook must be setup)")),l.isActive&&!r&&wp.element.createElement(React.Fragment,null,wp.element.createElement("ul",{className:"text-sm font-medium text-gray-900 bg-white my-3 flex flex-wrap fit-content"},s.map((function(e){return wp.element.createElement(c,{key:e.id,id:e.id,label:e.label,checked:e.checked,squareWoo:l})}))))))};function us(e){return us="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},us(e)}function ms(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ps(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ms(Object(n),!0).forEach((function(t){fs(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ms(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function fs(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=us(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=us(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==us(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ds(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const hs=function(t){var n=t.settings,r=t.updateSettings,o=t.settingsLoading,a=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ds(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ds(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)(ps({},n.wooAuto)),2),l=a[0],i=a[1];(0,e.useEffect)((function(){i(n.wooAuto)}),[n]);var c=function(e){var t=e.id,n=e.label,o=e.checked;return e.squareWoo,wp.element.createElement("li",{className:"w-auto mb-0"},wp.element.createElement("div",{className:"flex items-center gap-2 p-4"},wp.element.createElement("input",{id:t,type:"checkbox",checked:!1,onChange:function(){return r("wooAuto",ps(ps({},l),{},fs({},t,!o)))},className:"!m-0 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2 leading-normal"}),wp.element.createElement("label",{htmlFor:t,className:"w-full text-sm font-light text-gray-700 leading-normal"},n)))},s=[{id:"stock",label:"Stock",checked:l.stock||!1}];return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("div",{className:"mb-6"},wp.element.createElement("label",{className:"relative inline-flex items-center cursor-pointer"},wp.element.createElement("input",{type:"checkbox",checked:!1,className:"sr-only peer"}),wp.element.createElement("div",{className:"w-11 h-6 bg-gray-200 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-0.5 after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"}),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square")),l.isActive&&!o&&wp.element.createElement(React.Fragment,null,wp.element.createElement("p",{className:"mt-4"},"Sync stock on order processing. Stock/Inventory count is the the sole permitted auto-sync option from Woo to Square (other wise an infinite update loop is created, we don't want that). You can also manually sync from the product actions."),wp.element.createElement("ul",{className:"fit-content flex-wrap items-center justify-start text-sm font-medium text-gray-900 bg-white sm:flex"},s.map((function(e){return wp.element.createElement(c,{key:e.id,id:e.id,label:e.label,checked:e.checked,squareWoo:l})}))))))};var gs=Object.defineProperty,ys=(e,t,n)=>(((e,t,n)=>{t in e?gs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);let vs=new class{constructor(){ys(this,"current",this.detect()),ys(this,"handoffState","pending"),ys(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return"server"===this.current}get isClient(){return"client"===this.current}detect(){return"undefined"==typeof window||"undefined"==typeof document?"server":"client"}handoff(){"pending"===this.handoffState&&(this.handoffState="complete")}get isHandoffComplete(){return"complete"===this.handoffState}},ws=(e,n)=>{vs.isServer?(0,t.useEffect)(e,n):(0,t.useLayoutEffect)(e,n)};function bs(e){let n=(0,t.useRef)(e);return ws((()=>{n.current=e}),[e]),n}let xs=function(e){let n=bs(e);return t.useCallback(((...e)=>n.current(...e)),[n])};function Es(e,n,r){let[o,a]=(0,t.useState)(r),l=void 0!==e,i=(0,t.useRef)(l),c=(0,t.useRef)(!1),s=(0,t.useRef)(!1);return!l||i.current||c.current?!l&&i.current&&!s.current&&(s.current=!0,i.current=l,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(c.current=!0,i.current=l,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[l?e:o,xs((e=>(l||a(e),null==n?void 0:n(e))))]}function Ss(){let e=[],t={addEventListener:(e,n,r,o)=>(e.addEventListener(n,r,o),t.add((()=>e.removeEventListener(n,r,o)))),requestAnimationFrame(...e){let n=requestAnimationFrame(...e);return t.add((()=>cancelAnimationFrame(n)))},nextFrame:(...e)=>t.requestAnimationFrame((()=>t.requestAnimationFrame(...e))),setTimeout(...e){let n=setTimeout(...e);return t.add((()=>clearTimeout(n)))},microTask(...e){let n={current:!0};return function(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch((e=>setTimeout((()=>{throw e}))))}((()=>{n.current&&e[0]()})),t.add((()=>{n.current=!1}))},style(e,t,n){let r=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:n}),this.add((()=>{Object.assign(e.style,{[t]:r})}))},group(e){let t=Ss();return e(t),this.add((()=>t.dispose()))},add:t=>(e.push(t),()=>{let n=e.indexOf(t);if(n>=0)for(let t of e.splice(n,1))t()}),dispose(){for(let t of e.splice(0))t()}};return t}function ks(){let[e]=(0,t.useState)(Ss);return(0,t.useEffect)((()=>()=>e.dispose()),[e]),e}var Ns;let Os=null!=(Ns=t.useId)?Ns:function(){let e=function(){let e=function(){let e="undefined"==typeof document;return"useSyncExternalStore"in n&&(e=>e.useSyncExternalStore)(n)((()=>()=>{}),(()=>!1),(()=>!e))}(),[r,o]=t.useState(vs.isHandoffComplete);return r&&!1===vs.isHandoffComplete&&o(!1),t.useEffect((()=>{!0!==r&&o(!0)}),[r]),t.useEffect((()=>vs.handoff()),[]),!e&&r}(),[r,o]=t.useState(e?()=>vs.nextId():null);return ws((()=>{null===r&&o(vs.nextId())}),[r]),null!=r?""+r:void 0};function Cs(e){var t;if(e.type)return e.type;let n=null!=(t=e.as)?t:"button";return"string"==typeof n&&"button"===n.toLowerCase()?"button":void 0}function js(e,n){let[r,o]=(0,t.useState)((()=>Cs(e)));return ws((()=>{o(Cs(e))}),[e.type,e.as]),ws((()=>{r||n.current&&n.current instanceof HTMLButtonElement&&!n.current.hasAttribute("type")&&o("button")}),[r,n]),r}let Ps=Symbol();function Ls(...e){let n=(0,t.useRef)(e);(0,t.useEffect)((()=>{n.current=e}),[e]);let r=xs((e=>{for(let t of n.current)null!=t&&("function"==typeof t?t(e):t.current=e)}));return e.every((e=>null==e||(null==e?void 0:e[Ps])))?void 0:r}function _s(...e){return Array.from(new Set(e.flatMap((e=>"string"==typeof e?e.split(" "):[])))).filter(Boolean).join(" ")}function Rs(e,t,...n){if(e in t){let r=t[e];return"function"==typeof r?r(...n):r}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map((e=>`"${e}"`)).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Rs),r}var Is,As=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(As||{}),Ts=((Is=Ts||{})[Is.Unmount=0]="Unmount",Is[Is.Hidden=1]="Hidden",Is);function Fs({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:a=!0,name:l,mergeRefs:i}){i=null!=i?i:Ds;let c=Gs(t,e);if(a)return Ms(c,n,r,l,i);let s=null!=o?o:0;if(2&s){let{static:e=!1,...t}=c;if(e)return Ms(t,n,r,l,i)}if(1&s){let{unmount:e=!0,...t}=c;return Rs(e?0:1,{0:()=>null,1:()=>Ms({...t,hidden:!0,style:{display:"none"}},n,r,l,i)})}return Ms(c,n,r,l,i)}function Ms(e,n={},r,o,a){let{as:l=r,children:i,refName:c="ref",...s}=Ws(e,["unmount","static"]),u=void 0!==e.ref?{[c]:e.ref}:{},m="function"==typeof i?i(n):i;"className"in s&&s.className&&"function"==typeof s.className&&(s.className=s.className(n));let p={};if(n){let e=!1,t=[];for(let[r,o]of Object.entries(n))"boolean"==typeof o&&(e=!0),!0===o&&t.push(r);e&&(p["data-headlessui-state"]=t.join(" "))}if(l===t.Fragment&&Object.keys(Vs(s)).length>0){if(!(0,t.isValidElement)(m)||Array.isArray(m)&&m.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${o} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(s).map((e=>` - ${e}`)).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map((e=>` - ${e}`)).join("\n")].join("\n"));let e=m.props,n="function"==typeof(null==e?void 0:e.className)?(...t)=>_s(null==e?void 0:e.className(...t),s.className):_s(null==e?void 0:e.className,s.className),r=n?{className:n}:{};return(0,t.cloneElement)(m,Object.assign({},Gs(m.props,Vs(Ws(s,["ref"]))),p,u,{ref:a(m.ref,u.ref)},r))}return(0,t.createElement)(l,Object.assign({},Ws(s,["ref"]),l!==t.Fragment&&u,l!==t.Fragment&&p),m)}function Ds(...e){return e.every((e=>null==e))?void 0:t=>{for(let n of e)null!=n&&("function"==typeof n?n(t):n.current=t)}}function Gs(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith("on")&&"function"==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map((e=>[e,void 0]))));for(let e in n)Object.assign(t,{[e](t,...r){let o=n[e];for(let e of o){if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;e(t,...r)}}});return t}function qs(e){var n;return Object.assign((0,t.forwardRef)(e),{displayName:null!=(n=e.displayName)?n:e.name})}function Vs(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function Ws(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}var Bs=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Bs||{});let Hs=qs((function(e,t){var n;let{features:r=1,...o}=e;return Fs({ourProps:{ref:t,"aria-hidden":2==(2&r)||(null!=(n=o["aria-hidden"])?n:void 0),style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...4==(4&r)&&2!=(2&r)&&{display:"none"}}},theirProps:o,slot:{},defaultTag:"div",name:"Hidden"})}));function zs(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=""===(null==t?void 0:t.getAttribute("disabled"));return(!r||!function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(n))&&r}function Us(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))Zs(n,$s(t,r),o);return n}function $s(e,t){return e?e+"["+t+"]":t}function Zs(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())Zs(e,$s(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):"boolean"==typeof n?e.push([t,n?"1":"0"]):"string"==typeof n?e.push([t,n]):"number"==typeof n?e.push([t,`${n}`]):null==n?e.push([t,""]):Us(n,t,e)}function Ys(e){var t,n;let r=null!=(t=null==e?void 0:e.form)?t:e.closest("form");if(r){for(let t of r.elements)if(t!==e&&("INPUT"===t.tagName&&"submit"===t.type||"BUTTON"===t.tagName&&"submit"===t.type||"INPUT"===t.nodeName&&"image"===t.type))return void t.click();null==(n=r.requestSubmit)||n.call(r)}}let Ks=(0,t.createContext)(null);function Xs(){let e=(0,t.useContext)(Ks);if(null===e){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,Xs),e}return e}function Js(){let[e,n]=(0,t.useState)([]);return[e.length>0?e.join(" "):void 0,(0,t.useMemo)((()=>function(e){let r=xs((e=>(n((t=>[...t,e])),()=>n((t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))))),o=(0,t.useMemo)((()=>({register:r,slot:e.slot,name:e.name,props:e.props})),[r,e.slot,e.name,e.props]);return t.createElement(Ks.Provider,{value:o},e.children)}),[n])]}let Qs=qs((function(e,t){let n=Os(),{id:r=`headlessui-description-${n}`,...o}=e,a=Xs(),l=Ls(t);return ws((()=>a.register(r)),[r,a.register]),Fs({ourProps:{ref:l,...a.props,id:r},theirProps:o,slot:a.slot||{},defaultTag:"p",name:a.name||"Description"})})),eu=Object.assign(Qs,{});var tu=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(tu||{});let nu=(0,t.createContext)(null);function ru(){let e=(0,t.useContext)(nu);if(null===e){let e=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,ru),e}return e}function ou(){let[e,n]=(0,t.useState)([]);return[e.length>0?e.join(" "):void 0,(0,t.useMemo)((()=>function(e){let r=xs((e=>(n((t=>[...t,e])),()=>n((t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))))),o=(0,t.useMemo)((()=>({register:r,slot:e.slot,name:e.name,props:e.props})),[r,e.slot,e.name,e.props]);return t.createElement(nu.Provider,{value:o},e.children)}),[n])]}let au=qs((function(e,t){let n=Os(),{id:r=`headlessui-label-${n}`,passive:o=!1,...a}=e,l=ru(),i=Ls(t);ws((()=>l.register(r)),[r,l.register]);let c={ref:i,...l.props,id:r};return o&&("onClick"in c&&(delete c.htmlFor,delete c.onClick),"onClick"in a&&delete a.onClick),Fs({ourProps:c,theirProps:a,slot:l.slot||{},defaultTag:"label",name:l.name||"Label"})})),lu=Object.assign(au,{}),iu=(0,t.createContext)(null);iu.displayName="GroupContext";let cu=t.Fragment,su=qs((function(e,n){let r=Os(),{id:o=`headlessui-switch-${r}`,checked:a,defaultChecked:l=!1,onChange:i,name:c,value:s,form:u,...m}=e,p=(0,t.useContext)(iu),f=(0,t.useRef)(null),d=Ls(f,n,null===p?null:p.setSwitch),[h,g]=Es(a,i,l),y=xs((()=>null==g?void 0:g(!h))),v=xs((e=>{if(zs(e.currentTarget))return e.preventDefault();e.preventDefault(),y()})),w=xs((e=>{e.key===tu.Space?(e.preventDefault(),y()):e.key===tu.Enter&&Ys(e.currentTarget)})),b=xs((e=>e.preventDefault())),x=(0,t.useMemo)((()=>({checked:h})),[h]),E={id:o,ref:d,role:"switch",type:js(e,f),tabIndex:0,"aria-checked":h,"aria-labelledby":null==p?void 0:p.labelledby,"aria-describedby":null==p?void 0:p.describedby,onClick:v,onKeyUp:w,onKeyPress:b},S=ks();return(0,t.useEffect)((()=>{var e;let t=null==(e=f.current)?void 0:e.closest("form");t&&void 0!==l&&S.addEventListener(t,"reset",(()=>{g(l)}))}),[f,g]),t.createElement(t.Fragment,null,null!=c&&h&&t.createElement(Hs,{features:Bs.Hidden,...Vs({as:"input",type:"checkbox",hidden:!0,readOnly:!0,form:u,checked:h,name:c,value:s})}),Fs({ourProps:E,theirProps:m,slot:x,defaultTag:"button",name:"Switch"}))})),uu=Object.assign(su,{Group:function(e){var n;let[r,o]=(0,t.useState)(null),[a,l]=ou(),[i,c]=Js(),s=(0,t.useMemo)((()=>({switch:r,setSwitch:o,labelledby:a,describedby:i})),[r,o,a,i]),u=e;return t.createElement(c,{name:"Switch.Description"},t.createElement(l,{name:"Switch.Label",props:{htmlFor:null==(n=s.switch)?void 0:n.id,onClick(e){r&&("LABEL"===e.currentTarget.tagName&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},t.createElement(iu.Provider,{value:s},Fs({ourProps:{},theirProps:u,defaultTag:cu,name:"Switch.Group"}))))},Label:lu,Description:eu});const mu=function(e){return e.setSettings,e.updateSettings,e.settings,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatically create Square products",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"When this feature is enabled, every time you create a new product in WooCommerce, it will automatically be exported and linked to your Square account. This ensures that your product listings are consistently updated across both platforms, saving you time and maintaining synchronization between your WooCommerce store and Square inventory."),wp.element.createElement(uu,{checked:!1,className:"bg-gray-200 relative inline-flex h-6 w-11 items-center rounded-full"},wp.element.createElement("span",{className:"sr-only"},"Enable auto product creation"),wp.element.createElement("span",{className:"translate-x-1 inline-block h-4 w-4 transform rounded-full bg-white transition"}))))};function pu(e){return pu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pu(e)}function fu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function du(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fu(Object(n),!0).forEach((function(t){hu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function hu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=pu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=pu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==pu(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const yu=function(n){var r,o,a,l,i,c=n.settings,s=n.updateSettings,u=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return gu(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gu(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,t.useState)(c.cron.schedule||"hourly"),2),m=u[0],p=u[1];(0,e.useEffect)((function(){c.cron&&c.cron.schedule?p(c.cron.schedule):console.log("Settings not loaded or missing cron.scheduleFrequency")}),[c]);var f=[{id:"stock",label:"Stock",checked:(null===(r=c.cron.dataToUpdate)||void 0===r?void 0:r.stock)||!1},{id:"title",label:"Title",checked:(null===(o=c.cron.dataToUpdate)||void 0===o?void 0:o.title)||!1},{id:"sku",label:"SKU",checked:(null===(a=c.cron.dataToUpdate)||void 0===a?void 0:a.sku)||!1},{id:"price",label:"Price",checked:(null===(l=c.cron.dataToUpdate)||void 0===l?void 0:l.price)||!1},{id:"description",label:"Description",checked:(null===(i=c.cron.dataToUpdate)||void 0===i?void 0:i.description)||!1}],d=function(e){var t=e.id,n=e.label,r=e.checked,o=e.cron;return wp.element.createElement("li",{className:"w-auto mb-0"},wp.element.createElement("div",{className:"flex items-center gap-1"},wp.element.createElement("input",{id:t,type:"checkbox",checked:r,onChange:function(){return s("cron",du(du({},o),{},{dataToUpdate:du(du({},o.dataToUpdate),{},hu({},t,!r))}))},className:"!m-0 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 focus:ring-2 leading-normal"}),wp.element.createElement("label",{htmlFor:t,className:"w-full text-sm font-light text-gray-700 leading-normal"},n)))};return wp.element.createElement("div",null,wp.element.createElement("div",{className:"flex flex-col gap-2 my-2"},wp.element.createElement("fieldset",null,wp.element.createElement("legend",{className:"font-semibold text-base mb-4"},"Select schedule frequency:"),wp.element.createElement("div",{className:"space-y-2"},["hourly","twicedaily","daily","weekly"].map((function(e){return wp.element.createElement("div",{key:e,className:"flex items-center"},wp.element.createElement("input",{id:e,type:"radio",name:"scheduleFrequency",value:e,checked:m===e,onChange:function(e){s("cron",du(du({},c.cron),{},{schedule:e.target.value})),p(e.target.value)},className:"focus:ring-sky-500 h-4 w-4 text-sky-600 border-gray-300"}),wp.element.createElement("label",{htmlFor:e,className:"ml-1 block text-sm capitalize"},e," ",wp.element.createElement("span",{className:"text-gray-500 text-sm"},"twicedaily"===e||"daily"===e?"(starting midnight)":"weekly"===e?"(starting monday at midnight)":"")))})),wp.element.createElement("div",{className:"flex items-center"},wp.element.createElement("input",{id:"custom",type:"radio",name:"scheduleFrequency",disabled:!0,className:"focus:ring-sky-500 h-4 w-4 text-sky-600 border-gray-300"}),wp.element.createElement("label",{htmlFor:"custom",className:"ml-1 block text-sm capitalize"},"Custom",wp.element.createElement("span",{className:"text-gray-500 text-sm"}," (coming soon)")))))),wp.element.createElement("p",{className:"font-semibold text-base mt-4"},"Data to update:"),wp.element.createElement("ul",{className:"text-sm font-medium text-gray-900 bg-white flex flex-wrap gap-2 mt-2"},f.map((function(e){return wp.element.createElement(d,{key:e.id,id:e.id,label:e.label,checked:e.checked,cron:c.cron})}))))};function vu(e){return vu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vu(e)}function wu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function bu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?wu(Object(n),!0).forEach((function(t){xu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xu(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=vu(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=vu(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==vu(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Eu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Su(t){var n=t.settings,r=t.updateSettings,o=t.setSettings,a=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Eu(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Eu(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((0,e.useState)("square"===n.cron.source),2),l=a[0],i=a[1];return wp.element.createElement("div",{className:"blur-sm"},wp.element.createElement("p",{className:"text-base font-semibold mb-2"},"Source of truth:"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"The Source of Trust setting determines the primary source for your product information. Choose Square to automatically sync and update your product details based on data from Square. This option is ideal if Square is your primary platform for inventory and sales management. Alternatively, selecting Woocommerce means your product updates will be based on the information stored within your WooCommerce system, best for those who manage their inventory directly through WooCommerce."),wp.element.createElement("div",{className:"flex gap-2 items-center my-4"},wp.element.createElement("p",{className:"font-semibold text-sm"},"Woocommerce"),wp.element.createElement(uu,{checked:l,onChange:function(e){i(e),r("cron",bu(bu({},n.cron),{},{source:e?"square":"woocommerce"}))},className:Va(l?"bg-slate-950":"bg-purple-500","relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-sky-600 focus:ring-offset-2")},wp.element.createElement("span",{className:"sr-only"},"Source of truth"),wp.element.createElement("span",{className:Va(l?"translate-x-5":"translate-x-0","pointer-events-none relative inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out")},wp.element.createElement("span",{className:Va(l?"opacity-0 duration-100 ease-out":"opacity-100 duration-200 ease-in","absolute inset-0 flex h-full w-full items-center justify-center transition-opacity"),"aria-hidden":"true"},wp.element.createElement("span",{className:"font-semibold text-purple-500 p-0 m-0 flex items-center justify-center text-xs leading-none pb-[2px]"},"w")),wp.element.createElement("span",{className:Va(l?"opacity-100 duration-200 ease-in":"opacity-0 duration-100 ease-out","absolute inset-0 flex h-full w-full items-center justify-center transition-opacity"),"aria-hidden":"true"},wp.element.createElement("span",{className:"font-semibold text-slate-950 p-0 m-0 flex items-center justify-center text-xs leading-none pb-[3px]"},"s")))),wp.element.createElement("p",{className:"font-semibold text-sm"},"Square")),wp.element.createElement("p",{className:"text-base font-semibold mb-2"},"Build your own schedule:"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"Setup your update schedule! Please be aware that updating, particularly with a large product inventory, may significantly impact server performance. To minimize potential strain, we recommend spacing your updates to the maximum extent feasible and verifying that your server infrastructure is robust enough to manage the load smoothly. This approach helps ensure a seamless operation and maintains optimal system performance."),wp.element.createElement("div",null,wp.element.createElement(yu,{settings:n,updateSettings:r})),wp.element.createElement("p",{className:"text-base font-semibold mt-4"},"Batches:"),wp.element.createElement("p",{className:"text-sm text-gray-500"},"How many products to be updated per batch. A higher number will put greater load on the server."),wp.element.createElement("p",{className:"mt-2"},"Products will be updated in batches of:"," ",wp.element.createElement("span",{className:"text-sky-500 font-bold"},n.cron.batches)),wp.element.createElement("div",{className:"flex items-center gap-1 mt-2"},wp.element.createElement("p",null,"10"),wp.element.createElement("div",{className:"relative w-[300px]"},wp.element.createElement("input",{id:"steps-range",type:"range",min:"10",max:"100",onChange:function(e){console.log(e),o((function(t){return bu(bu({},t),{},{batches:e.target.value})})),r("cron",bu(bu({},n.cron),{},{batches:e.target.value}))},value:n.cron.batches,step:"10",className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer"})),wp.element.createElement("p",null,"100")))}const ku=function(e){var t=e.setSettings,n=e.updateSettings,r=e.settings;return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic update scheduler",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"The Automatic Update Scheduler allows you to set up a recurring schedule for product updates, adding another level of data accuracy, ensuring your information stays current without manual intervention. Simply select the frequency of updates—daily, weekly, or monthly—and the system will automatically apply the latest updates according to your chosen schedule."),wp.element.createElement(uu,{checked:r.cron.enabled,className:"".concat(r.cron.enabled?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"sr-only"},"Enable notifications"),wp.element.createElement("span",{className:"".concat(r.cron.enabled?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")}))),wp.element.createElement(Su,{settings:r,updateSettings:n,setSettings:t}))},Nu=function(e){e.setSettings,e.updateSettings;var t=e.settings;return wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatically delete Square & Woo products",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Choose whether to automatically delete or archive products in Square or WooCommerce when they are removed from their respective catalogs. Archived products in Square will be put to 'draft' in WooCommerce, whereas deleted products will be moved to trash."),t.squareAuto.isActive?wp.element.createElement(React.Fragment,null," ",wp.element.createElement("div",{className:"flex items-center"},wp.element.createElement(uu,{checked:t.wooAuto.autoDeleteProduct,className:"".concat(t.wooAuto.autoDeleteProduct?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"sr-only"},"Enable auto product deletion"),wp.element.createElement("span",{className:"".concat(t.wooAuto.autoDeleteProduct?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Woo to Square")),wp.element.createElement("div",{className:"flex items-center mt-4"},wp.element.createElement(uu,{checked:t.squareAuto.autoDeleteProduct,className:"".concat(t.squareAuto.autoDeleteProduct?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"sr-only"},"Enable auto product deletion"),wp.element.createElement("span",{className:"".concat(t.squareAuto.autoDeleteProduct?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("span",{className:"ms-3 text-sm font-medium text-gray-700 "},"Square to Woo"))):wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"font-semibold"},"Square to Woo automatic syncing on product update with webhook setup must be enabled to use this feature."))))},Ou=function(e){return e.updateSettings,e.settings,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatically create WooCommerce products",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"When this feature is enabled, every time you create a new product in Square, it will be imported into WooCommerce and linked automatically. This ensures that your product listings are consistently updated across both platforms, saving you time and maintaining synchronization between your WooCommerce store and Square inventory. ",wp.element.createElement("span",{className:"italic font-semibold"},"Automatic syncing on product update (Square to Woo) must be enabled."))))};function Cu(e){return vs.isServer?null:e instanceof Node?e.ownerDocument:null!=e&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let ju=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((e=>`${e}:not([tabindex='-1'])`)).join(",");var Pu=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(Pu||{}),Lu=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Lu||{}),_u=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(_u||{});var Ru=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Ru||{}),Iu=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Iu||{});"undefined"!=typeof window&&"undefined"!=typeof document&&(document.addEventListener("keydown",(e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")}),!0),document.addEventListener("click",(e=>{1===e.detail?delete document.documentElement.dataset.headlessuiFocusVisible:0===e.detail&&(document.documentElement.dataset.headlessuiFocusVisible="")}),!0));let Au=["textarea","input"].join(",");function Tu(e,t=(e=>e)){return e.slice().sort(((e,n)=>{let r=t(e),o=t(n);if(null===r||null===o)return 0;let a=r.compareDocumentPosition(o);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0}))}function Fu(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let a=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,l=Array.isArray(e)?n?Tu(e):e:function(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(ju)).sort(((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER))))}(e);o.length>0&&l.length>1&&(l=l.filter((e=>!o.includes(e)))),r=null!=r?r:a.activeElement;let i,c=(()=>{if(5&t)return 1;if(10&t)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),s=(()=>{if(1&t)return 0;if(2&t)return Math.max(0,l.indexOf(r))-1;if(4&t)return Math.max(0,l.indexOf(r))+1;if(8&t)return l.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=32&t?{preventScroll:!0}:{},m=0,p=l.length;do{if(m>=p||m+p<=0)return 0;let e=s+m;if(16&t)e=(e+p)%p;else{if(e<0)return 3;if(e>=p)return 1}i=l[e],null==i||i.focus(u),m+=c}while(i!==a.activeElement);return 6&t&&function(e){var t,n;return null!=(n=null==(t=null==e?void 0:e.matches)?void 0:t.call(e,Au))&&n}(i)&&i.select(),2}var Mu=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(Mu||{});let Du={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:Tu(n,(e=>e.element.current))}},1(e,t){let n=e.options.slice(),r=e.options.findIndex((e=>e.id===t.id));return-1===r?e:(n.splice(r,1),{...e,options:n})}},Gu=(0,t.createContext)(null);function qu(e){let n=(0,t.useContext)(Gu);if(null===n){let t=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,qu),t}return n}Gu.displayName="RadioGroupDataContext";let Vu=(0,t.createContext)(null);function Wu(e){let n=(0,t.useContext)(Vu);if(null===n){let t=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Wu),t}return n}function Bu(e,t){return Rs(t.type,Du,e,t)}Vu.displayName="RadioGroupActionsContext";var Hu=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(Hu||{});let zu=qs((function(e,n){let r=Os(),{id:o=`headlessui-radiogroup-${r}`,value:a,defaultValue:l,form:i,name:c,onChange:s,by:u=((e,t)=>e===t),disabled:m=!1,...p}=e,f=xs("string"==typeof u?(e,t)=>{let n=u;return(null==e?void 0:e[n])===(null==t?void 0:t[n])}:u),[d,h]=(0,t.useReducer)(Bu,{options:[]}),g=d.options,[y,v]=ou(),[w,b]=Js(),x=(0,t.useRef)(null),E=Ls(x,n),[S,k]=Es(a,s,l),N=(0,t.useMemo)((()=>g.find((e=>!e.propsRef.current.disabled))),[g]),O=(0,t.useMemo)((()=>g.some((e=>f(e.propsRef.current.value,S)))),[g,S]),C=xs((e=>{var t;if(m||f(e,S))return!1;let n=null==(t=g.find((t=>f(t.propsRef.current.value,e))))?void 0:t.propsRef.current;return!(null!=n&&n.disabled||(null==k||k(e),0))}));!function({container:e,accept:n,walk:r,enabled:o=!0}){let a=(0,t.useRef)(n),l=(0,t.useRef)(r);(0,t.useEffect)((()=>{a.current=n,l.current=r}),[n,r]),ws((()=>{if(!e||!o)return;let t=Cu(e);if(!t)return;let n=a.current,r=l.current,i=Object.assign((e=>n(e)),{acceptNode:n}),c=t.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,i,!1);for(;c.nextNode();)r(c.currentNode)}),[e,o,a,l])}({container:x.current,accept:e=>"radio"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let j=xs((e=>{let t=x.current;if(!t)return;let n=Cu(t),r=g.filter((e=>!1===e.propsRef.current.disabled)).map((e=>e.element.current));switch(e.key){case tu.Enter:Ys(e.currentTarget);break;case tu.ArrowLeft:case tu.ArrowUp:if(e.preventDefault(),e.stopPropagation(),Fu(r,Pu.Previous|Pu.WrapAround)===Lu.Success){let e=g.find((e=>e.element.current===(null==n?void 0:n.activeElement)));e&&C(e.propsRef.current.value)}break;case tu.ArrowRight:case tu.ArrowDown:if(e.preventDefault(),e.stopPropagation(),Fu(r,Pu.Next|Pu.WrapAround)===Lu.Success){let e=g.find((e=>e.element.current===(null==n?void 0:n.activeElement)));e&&C(e.propsRef.current.value)}break;case tu.Space:{e.preventDefault(),e.stopPropagation();let t=g.find((e=>e.element.current===(null==n?void 0:n.activeElement)));t&&C(t.propsRef.current.value)}}})),P=xs((e=>(h({type:0,...e}),()=>h({type:1,id:e.id})))),L=(0,t.useMemo)((()=>({value:S,firstOption:N,containsCheckedOption:O,disabled:m,compare:f,...d})),[S,N,O,m,f,d]),_=(0,t.useMemo)((()=>({registerOption:P,change:C})),[P,C]),R={ref:E,id:o,role:"radiogroup","aria-labelledby":y,"aria-describedby":w,onKeyDown:j},I=(0,t.useMemo)((()=>({value:S})),[S]),A=(0,t.useRef)(null),T=ks();return(0,t.useEffect)((()=>{A.current&&void 0!==l&&T.addEventListener(A.current,"reset",(()=>{C(l)}))}),[A,C]),t.createElement(b,{name:"RadioGroup.Description"},t.createElement(v,{name:"RadioGroup.Label"},t.createElement(Vu.Provider,{value:_},t.createElement(Gu.Provider,{value:L},null!=c&&null!=S&&Us({[c]:S}).map((([e,n],r)=>t.createElement(Hs,{features:Bs.Hidden,ref:0===r?e=>{var t;A.current=null!=(t=null==e?void 0:e.closest("form"))?t:null}:void 0,...Vs({key:e,as:"input",type:"radio",checked:null!=n,hidden:!0,readOnly:!0,form:i,name:e,value:n})}))),Fs({ourProps:R,theirProps:p,slot:I,defaultTag:"div",name:"RadioGroup"})))))})),Uu=qs((function(e,n){var r;let o=Os(),{id:a=`headlessui-radiogroup-option-${o}`,value:l,disabled:i=!1,...c}=e,s=(0,t.useRef)(null),u=Ls(s,n),[m,p]=ou(),[f,d]=Js(),{addFlag:h,removeFlag:g,hasFlag:y}=function(e=0){let[n,r]=(0,t.useState)(e),o=function(){let e=(0,t.useRef)(!1);return ws((()=>(e.current=!0,()=>{e.current=!1})),[]),e}(),a=(0,t.useCallback)((e=>{o.current&&r((t=>t|e))}),[n,o]),l=(0,t.useCallback)((e=>Boolean(n&e)),[n]),i=(0,t.useCallback)((e=>{o.current&&r((t=>t&~e))}),[r,o]),c=(0,t.useCallback)((e=>{o.current&&r((t=>t^e))}),[r]);return{flags:n,addFlag:a,hasFlag:l,removeFlag:i,toggleFlag:c}}(1),v=bs({value:l,disabled:i}),w=qu("RadioGroup.Option"),b=Wu("RadioGroup.Option");ws((()=>b.registerOption({id:a,element:s,propsRef:v})),[a,b,s,v]);let x=xs((e=>{var t;if(zs(e.currentTarget))return e.preventDefault();b.change(l)&&(h(2),null==(t=s.current)||t.focus())})),E=xs((e=>{if(zs(e.currentTarget))return e.preventDefault();h(2)})),S=xs((()=>g(2))),k=(null==(r=w.firstOption)?void 0:r.id)===a,N=w.disabled||i,O=w.compare(w.value,l),C={ref:u,id:a,role:"radio","aria-checked":O?"true":"false","aria-labelledby":m,"aria-describedby":f,"aria-disabled":!!N||void 0,tabIndex:N?-1:O||!w.containsCheckedOption&&k?0:-1,onClick:N?void 0:x,onFocus:N?void 0:E,onBlur:N?void 0:S},j=(0,t.useMemo)((()=>({checked:O,disabled:N,active:y(2)})),[O,N,y]);return t.createElement(d,{name:"RadioGroup.Description"},t.createElement(p,{name:"RadioGroup.Label"},Fs({ourProps:C,theirProps:c,slot:j,defaultTag:"div",name:"RadioGroup.Option"})))})),$u=Object.assign(zu,{Option:Uu,Label:lu,Description:eu});function Zu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Yu(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yu(e,t):void 0}}(e,t)||function(){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 Yu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Ku=[{id:"square",title:"Let Square calculate",description:"Square will calculate points based on items contained in the order id. Item eligibility is determined by Square settings.",pros:["Points will be assigned to order and transaction","Easy to track point earning"],cons:["Shipping will be included in point calculation","May earn more points then desired"]},{id:"custom",title:"Custom calculation",description:"This plugin will manually calculate points based on item eligibility defined in Square and program details below.",pros:["Shipping not included in point earnings","Only give points for revenue generating items"],cons:["Points are not tied to Square order or transaction","Harder to track point earning"]}],Xu=[{id:"square",title:"Square redemption",description:"We'll use Square's orders and loyalty API to attached reward redemptions to orders and transcations.",pros:["Reward redemptions are tied to orders","Easy to track point earning"],cons:["Must use SquareSync for Woo payment gateway","Strict point redemption"]},{id:"custom",title:"Custom redemption",description:"Using a custom integration, we'll adjust a customers points manually.",pros:["Compatible with any WooCommerce payment gateway","More flexibility"],cons:["Reward redemptions are added to Square orders as discounts not rewards","Harder to track reward redemptions"]}];const Ju=function(t){var n=t.settings,r=(t.updateSettings,t.getLoyaltyProgram,Zu((0,e.useState)(""),2)),o=r[0],a=(r[1],Zu((0,e.useState)(n.loyalty.method),2)),l=a[0],i=a[1],c=Zu((0,e.useState)(n.loyalty.redemptionMethod),2),s=c[0],u=c[1];return(0,e.useEffect)((function(){i(n.loyalty.method),u(n.loyalty.redemptionMethod)}),[n]),wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 flex gap-2 items-center"},"Loyalty Program",wp.element.createElement(At,null)),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Integrate Square's Loyalty program into your website, allowing customers to earn points on purchases through online orders.")),wp.element.createElement("div",{className:"flex items-center gap-2"},wp.element.createElement(uu,{checked:!1,className:"bg-gray-200 relative inline-flex h-6 w-11 items-center rounded-full"},wp.element.createElement("span",{className:"translate-x-1 inline-block h-4 w-4 transform rounded-full bg-white transition"})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable accrual of points on customer orders")),o&&wp.element.createElement("p",{className:"text-red-600 font-semibold text-sm mt-2"},o),n.loyalty.program&&n.loyalty.enabled&&wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(uu,{checked:!1,className:"".concat(n.loyalty.redeem?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.loyalty.redeem?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable redeeming of points on orders")),wp.element.createElement(React.Fragment,null,wp.element.createElement("fieldset",{className:"my-12"},wp.element.createElement("legend",{className:"text-base font-semibold leading-6 text-gray-900 text-center"},"Select a point ",wp.element.createElement("span",{className:"text-sky-500"},"accumulation")," option"),wp.element.createElement("p",{className:"text-center max-w-lg mx-auto text-gray-500"},"Due to the nature of Square and their current API, we have to make a compromise. Pro's and Cons of each are defined below."),wp.element.createElement($u,{value:l,className:"mt-6 grid grid-cols-1 gap-y-6 sm:grid-cols-2 sm:gap-x-4"},Ku.map((function(e,t){return wp.element.createElement($u.Option,{key:e.id,value:e.id,className:function(e){var t=e.active,n=e.checked;return"group relative flex cursor-pointer rounded-lg border p-4 shadow-sm focus:outline-none ".concat(n?"border-sky-600":"border-gray-300"," ").concat(t?"ring-2 ring-sky-600":"")}},(function(n){var r=n.checked;return wp.element.createElement(React.Fragment,null,wp.element.createElement("span",{className:"flex flex-1"},wp.element.createElement("span",{className:"flex flex-col justify-between"},wp.element.createElement("span",{className:"block text-sm font-medium text-gray-900"},e.title),wp.element.createElement("span",{className:"mt-1 flex items-center text-sm text-gray-500"},e.description),wp.element.createElement("div",{className:"mt-4 gap-2 flex flex-col ".concat(1===t&&"flex-col-reverse")},e.pros.map((function(e){return wp.element.createElement("div",{className:"flex gap-2 "},wp.element.createElement(Yt,{className:"min-w-5 w-5 h-5 text-green-500 min-h-5"}),wp.element.createElement("span",{className:" text-sm text-gray-900"},e))})),e.cons.map((function(e){return wp.element.createElement("div",{className:"flex gap-2 "},wp.element.createElement(Za,{className:"min-w-5 w-5 min-h-5 text-red-500"}),wp.element.createElement("span",{className:"text-sm text-gray-900"},e))}))))),wp.element.createElement(Yt,{"aria-hidden":"true",className:"h-5 w-5 ".concat(r?"text-sky-600":"invisible")}),wp.element.createElement("span",{"aria-hidden":"true",className:"pointer-events-none absolute -inset-px rounded-lg border-2 ".concat(r?"border-sky-600":"border-transparent")}))}))}))))),wp.element.createElement(React.Fragment,null,wp.element.createElement("fieldset",{className:"my-12"},wp.element.createElement("legend",{className:"text-base font-semibold leading-6 text-gray-900 text-center"},"Select a point ",wp.element.createElement("span",{className:"text-sky-500"},"redemption")," option"),wp.element.createElement("p",{className:"text-center max-w-lg mx-auto text-gray-500"},"Again, due to the nature of Square and their current API, we have to make a compromise. Pro's and Cons of each are defined below."),wp.element.createElement($u,{value:s,className:"mt-6 grid grid-cols-1 gap-y-6 sm:grid-cols-2 sm:gap-x-4"},Xu.map((function(e,t){return wp.element.createElement($u.Option,{key:e.id,value:e.id,className:function(e){var t=e.active,n=e.checked;return"group relative flex cursor-pointer rounded-lg border p-4 shadow-sm focus:outline-none ".concat(n?"border-sky-600":"border-gray-300"," ").concat(t?"ring-2 ring-sky-600":"")}},(function(n){var r=n.checked;return wp.element.createElement(React.Fragment,null,wp.element.createElement("span",{className:"flex flex-1"},wp.element.createElement("span",{className:"flex flex-col justify-between"},wp.element.createElement("span",{className:"block text-sm font-medium text-gray-900"},e.title),wp.element.createElement("span",{className:"mt-1 flex items-center text-sm text-gray-500"},e.description),wp.element.createElement("div",{className:"mt-4 gap-2 flex flex-col ".concat(1===t&&"flex-col-reverse")},e.pros.map((function(e){return wp.element.createElement("div",{className:"flex gap-2 "},wp.element.createElement(Yt,{className:"min-w-5 w-5 h-5 text-green-500 min-h-5"}),wp.element.createElement("span",{className:" text-sm text-gray-900"},e))})),e.cons.map((function(e){return wp.element.createElement("div",{className:"flex gap-2 "},wp.element.createElement(Za,{className:"min-w-5 w-5 min-h-5 text-red-500"}),wp.element.createElement("span",{className:"text-sm text-gray-900"},e))}))))),wp.element.createElement(Yt,{"aria-hidden":"true",className:"h-5 w-5 ".concat(r?"text-sky-600":"invisible")}),wp.element.createElement("span",{"aria-hidden":"true",className:"pointer-events-none absolute -inset-px rounded-lg border-2 ".concat(r?"border-sky-600":"border-transparent")}))}))}))))))},Qu=t.forwardRef((function({title:e,titleId:n,...r},o){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":n},r),e?t.createElement("title",{id:n},e):null,t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z"}))}));function em(e){var t=e.program;return wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"mt-6 p-4 border rounded-lg border-gray-300"},wp.element.createElement("div",{className:"flex flex-col gap-2 items-center justify-center mb-4 border-b pb-2"},wp.element.createElement(Qu,{className:"size-10"}),wp.element.createElement("h3",{className:"text-lg font-semibold leading-7 text-gray-900 flex gap-2 items-center"},"Your Loyalty Program"),wp.element.createElement("p",{className:"text-center text-gray-500 -mt-2"},"You can only edit your loyalty program on Square")),wp.element.createElement("div",{className:"mb-3"},wp.element.createElement("div",null,wp.element.createElement("h3",{className:"text-base font-semibold leading-7 text-gray-900 flex gap-2 items-center"},"Loyalty Program Terminology"),wp.element.createElement("div",{className:"max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Customize the terminology of your loyalty program to fit your brand (Examples: Star/Stars, Point/Points, Punch/Punches).")))),wp.element.createElement("dl",{className:"divide-y divide-gray-100 border border-gray-200 rounded-lg px-4"},wp.element.createElement("div",{className:"px-4 py-3 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"},wp.element.createElement("dt",{className:"text-sm font-medium leading-6 text-gray-900"},"Singular"),wp.element.createElement("dd",{className:"mt-1 flex text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"},wp.element.createElement("span",{className:"flex-grow"},t.terminology.one))),wp.element.createElement("div",{className:"px-4 py-3 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"},wp.element.createElement("dt",{className:"text-sm font-medium leading-6 text-gray-900"},"Plural"),wp.element.createElement("dd",{className:"mt-1 flex text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"},wp.element.createElement("span",{className:"flex-grow"},t.terminology.other)))),wp.element.createElement("div",{className:"px-4 sm:px-0 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-7 text-gray-900"},"Earning Points"),wp.element.createElement("div",{className:"max-w-xl text-sm text-gray-500 mb-2"},wp.element.createElement("p",{className:""},"Allow customers to earn points on purchases made through your website."))),wp.element.createElement("dl",null,wp.element.createElement("div",{className:"-mx-4 flow-root sm:mx-0"},wp.element.createElement("table",{className:"min-w-full"},wp.element.createElement("colgroup",null,wp.element.createElement("col",{className:"sm:w-1/6"}),wp.element.createElement("col",{className:"sm:w-3/6"}),wp.element.createElement("col",{className:"sm:w-2/6"})),wp.element.createElement("thead",{className:"border-b border-gray-300 text-gray-900"},wp.element.createElement("tr",null,wp.element.createElement("th",{scope:"col",className:"py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-0"},"Rule value"),wp.element.createElement("th",{scope:"col",className:"hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell"},"Rule description"))),wp.element.createElement("tbody",null,t.accrual_rules.map((function(e,n){return wp.element.createElement("tr",{key:n,className:"border-b border-gray-200"},wp.element.createElement("td",{className:"max-w-0 py-5 pl-4 pr-3 text-sm sm:pl-0"},wp.element.createElement("div",{className:"font-medium text-gray-900"},e.points," ",1===e.points?t.terminology.one:t.terminology.other)),wp.element.createElement("td",{className:"px-3 py-5 text-left text-sm text-gray-500 sm:table-cell"},wp.element.createElement("div",{className:"mt-1 truncate text-gray-500"},"Earn ",e.points," ",1===e.points?t.terminology.one:t.terminology.other," for every $",(e.spend_data.amount_money.amount/100).toFixed(2)," spend in a single transaction")))})))))),wp.element.createElement("dl",null,wp.element.createElement("div",{className:"px-4 sm:px-0 mt-6 mb-3"},wp.element.createElement("h3",{className:"text-base font-semibold leading-7 text-gray-900"},"Redeeming rewards"),wp.element.createElement("div",{className:"max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Allow customers to redeem their points for discounts on purchases. Currently product and category specific rewards are not supported. Stay tuned for a future release."))),wp.element.createElement("div",{className:"px-4 pb-6 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"},wp.element.createElement("dd",{className:"mt-1 text-sm leading-6 text-gray-700 sm:col-span-3 sm:mt-0"},wp.element.createElement("div",{className:"-mx-4 flow-root sm:mx-0"},wp.element.createElement("table",{className:"min-w-full"},wp.element.createElement("colgroup",null,wp.element.createElement("col",{className:"sm:w-1/6"}),wp.element.createElement("col",{className:"sm:w-3/6"})),wp.element.createElement("thead",{className:"border-b border-gray-300 text-gray-900"},wp.element.createElement("tr",null,wp.element.createElement("th",{scope:"col",className:"py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-0"},"Reward Value"),wp.element.createElement("th",{scope:"col",className:"hidden px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell"},"Reward Description"))),wp.element.createElement("tbody",null,t.reward_tiers.map((function(e,n){var r;return wp.element.createElement("tr",{key:n,className:"border-b border-gray-200 relative select-none"},wp.element.createElement("td",{className:"max-w-0 py-5 pl-4 pr-3 text-sm sm:pl-0"},wp.element.createElement("div",{className:"font-medium text-gray-900"},e.points," ",1===e.points?t.terminology.one:t.terminology.other)),wp.element.createElement("td",{className:"px-3 py-5 text-left text-sm text-gray-500 sm:table-cell"},wp.element.createElement("div",{className:"mt-1 truncate text-gray-500"},e.name)),(null===(r=e.definition.catalog_object_ids)||void 0===r?void 0:r.length)>0&&wp.element.createElement("td",{className:"absolute left-0 w-full h-full flex justify-center items-center select-none"},wp.element.createElement("div",{className:"w-full h-full bg-red-300 opacity-30 absolute left-0 top-0 z-0"}),wp.element.createElement("div",{className:"relative z-10 text-base font-semibold bg-red-300 p-2"},"Disabled, not yet compatible with plugin")))}))))))))))}function tm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return nm(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nm(e,t):void 0}}(e,t)||function(){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 nm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function rm(e){return rm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rm(e)}function om(){om=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==rm(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(rm(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function am(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function lm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?am(Object(n),!0).forEach((function(t){im(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):am(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function im(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=rm(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=rm(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==rm(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cm(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function sm(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){cm(a,r,o,l,i,"next",e)}function i(e){cm(a,r,o,l,i,"throw",e)}l(void 0)}))}}function um(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return mm(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mm(e,t):void 0}}(e,t)||function(){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 mm(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var pm=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];function fm(e){return fm="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fm(e)}function dm(){dm=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==fm(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(fm(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function hm(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function gm(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){hm(a,r,o,l,i,"next",e)}function i(e){hm(a,r,o,l,i,"throw",e)}l(void 0)}))}}function ym(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function vm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ym(Object(n),!0).forEach((function(t){wm(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ym(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function wm(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=fm(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=fm(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==fm(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,l,i=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(s)throw o}}return i}}(e,t)||xm(e,t)||function(){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 xm(e,t){if(e){if("string"==typeof e)return Em(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Em(e,t):void 0}}function Em(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}o(889);var Sm=[{path:"/",element:function(){return mn(),wp.element.createElement("div",{className:"dashboard-grid gap-x-6 gap-y-6"},wp.element.createElement(Tn,null),wp.element.createElement("div",{className:"flex flex-col gap-6"},wp.element.createElement(Tt,null),wp.element.createElement(Gt,null)),wp.element.createElement("div",null,wp.element.createElement(sn,null)))}},{path:"/inventory",element:function(){mn();var t=oe(),n=X((function(e){return e.inventory})),r=(n.data,n.loading,n.error,n.fetchAttempted,Li((0,e.useState)(!1),2)),o=(r[0],r[1]),a=Li((0,e.useState)({location:"",squareAuto:{isActive:!1,stock:!0,sku:!0,title:!0,description:!0,images:!0,price:!0,category:!0},wooAuto:{isActive:!1,stock:!1,sku:!0,title:!1,description:!1,images:!1,category:!1,price:!1},exportStatus:0,exportSynced:1,exportResults:null}),2),l=a[0],i=a[1];return(0,e.useEffect)((function(){var e=function(){var e=Pi(ki().mark((function e(){return ki().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Ut({path:"/sws/v1/settings",method:"GET"}).then((function(e){i((function(t){return Oi(Oi({},e),{},{customers:Oi(Oi({},t.customers),e.customers)})}))}));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]),(0,e.useEffect)((function(){var e=function(){var e=Pi(ki().mark((function e(){var t;return ki().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Ut({path:"/sws/v1/settings/access-token"});case 3:(t=e.sent).access_token&&t.access_token.length>0&&"Token not set or empty"!==t.access_token&&o(t.access_token),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.error(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}();e()}),[]),(0,e.useEffect)((function(){t($l())}),[]),wp.element.createElement("div",null,wp.element.createElement("div",{className:"bg-white rounded-xl shadow-lg overflow-auto"},wp.element.createElement(Ei,{getInventory:function(e){return t($l(e))},settings:l})))}},{path:"/customers",element:function(){return wp.element.createElement(r().Fragment,null,wp.element.createElement("div",null,wp.element.createElement("div",{className:"bg-white p-6 rounded-xl not-prose grid grid-cols-1 gap-3 sm:grid-cols-2 w-full mb-4"},wp.element.createElement("header",{className:"col-span-full flex gap-2 items-center"},wp.element.createElement("p",{className:"text-xl font-semibold"},"Customer Syncing and Role Mapping"),wp.element.createElement(At,null)),wp.element.createElement("div",{className:" w-full col-span-full"},wp.element.createElement("ul",{className:"grid grid-cols-2 w-full text-lg gap-x-24 gap-y-3"},wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Customer Import"),wp.element.createElement("p",{className:"text-base"},"Import and link your existing Square customers to WooCommerce")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Role & Group Mapping"),wp.element.createElement("p",{className:"text-base"},"Map Square groups to WordPress roles, perfect for role based pricing or restritced content")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Customer Export"),wp.element.createElement("p",{className:"text-base"},"Export and link your existing WordPress users to Square")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Real-time Customer Sync"),wp.element.createElement("p",{className:"text-base"},"Sync customers from Square and WordPress in real-time.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Auto Customer Match"),wp.element.createElement("p",{className:"text-base"},"Match your existing WordPress users to Square users automatically")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Auto Customer Create"),wp.element.createElement("p",{className:"text-base"},"Create customers on Square or WordPress automatically")))),wp.element.createElement("h2",{className:"text-xl text-center col-span-full mt-4 font-bold"},"Watch Demo"))),wp.element.createElement("div",{style:{position:"relative",paddingBottom:"56.25%",height:0,overflow:"hidden"}},wp.element.createElement("iframe",{src:"https://www.youtube.com/embed/K4Ac4q7vEGg?si=mKp08JGnHBiiwd6N",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"},frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"YouTube video"})))}},{path:"/loyalty",element:function(){return wp.element.createElement(r().Fragment,null,wp.element.createElement("div",null,wp.element.createElement("div",{className:"bg-white p-6 rounded-xl not-prose grid grid-cols-1 gap-3 sm:grid-cols-2 w-full mb-4"},wp.element.createElement("header",{className:"col-span-full flex gap-2 items-center"},wp.element.createElement("p",{className:"text-xl font-semibold"},"Square Loyalty Program"),wp.element.createElement(At,null)),wp.element.createElement("div",{className:" w-full col-span-full"},wp.element.createElement("ul",{className:"grid grid-cols-2 w-full text-lg gap-x-24 gap-y-3"},wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Point Earning"),wp.element.createElement("p",{className:"text-base"},"Customers earn points for every purchase they make, with the ability to set customizable point accrual rates based on purchase amounts.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Reward Redemption"),wp.element.createElement("p",{className:"text-base"},"Allow customers to redeem their loyalty points for exclusive rewards, discounts, or special offers directly through your online store.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Auto Customer Loyalty Account Creation"),wp.element.createElement("p",{className:"text-base"},"Automatically create loyalty accounts for customers upon their first purchase, streamlining the process and ensuring seamless point tracking.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Rewards Dashboard"),wp.element.createElement("p",{className:"text-base"},"A user-friendly dashboard where customers can view their current points balance, reward tiers, and track their progress towards their next reward.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Customizable Reward Tiers"),wp.element.createElement("p",{className:"text-base"},"Create multiple reward tiers with varying points requirements, allowing you to offer different levels of rewards to your loyal customers.")),wp.element.createElement("li",{className:"border-b pb-3"},wp.element.createElement("span",{className:"font-semibold"},"Points Progress Tracking"),wp.element.createElement("p",{className:"text-base"},"Display a visual progress bar for customers, showing how close they are to unlocking their next reward, encouraging more purchases.")))),wp.element.createElement("h2",{className:"text-xl text-center col-span-full mt-4 font-bold"},"Watch Demo"))),wp.element.createElement("div",{style:{position:"relative",paddingBottom:"56.25%",height:0,overflow:"hidden"}},wp.element.createElement("iframe",{src:"https://www.youtube.com/embed/kQtLJesQSGI?si=QP4tGkFsKkgB68JD",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"},frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"YouTube video"})))}},{path:"/orders",element:function(){mn();var t=oe(),n=X((function(e){return e.orders})),r=n.data,o=n.loading,a=n.error;return(0,e.useEffect)((function(){t(Bi())}),[t]),wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"bg-white rounded-xl overflow-hidden"},o&&wp.element.createElement(cc,null),!o&&!a&&wp.element.createElement("div",{className:"sm:px-6 px-4"},r&&r.length>0?wp.element.createElement(lc,{data:r.filter((function(e){return null!==e}))}):wp.element.createElement("div",null,"No orders found.")),!o&&a&&wp.element.createElement("div",{className:"sm:px-6 px-4 py-5"},"Unable to fetch orders: ",a)))}},{path:"/settings",element:function(){return mn(),wp.element.createElement(zc,null)}},{path:"/settings/general",element:zc},{path:"/settings/payments",element:function(){mn();var t=bm((0,e.useState)({enabled:"no",title:"Credit Card",description:"Pay securely using your credit card.",accepted_credit_cards:["visa","mastercard","amex","discover","jcb","diners","union"],square_application_id_sandbox:"",square_application_id_live:"",enable_google_pay:"no",enable_apple_pay:"no"}),2),n=t[0],r=t[1],o=bm((0,e.useState)({title:!1,description:!1,sandboxId:!1,liveId:!1}),2),a=o[0],l=o[1],i=bm((0,e.useState)(!0),2),c=i[0],s=i[1];(0,e.useEffect)((function(){Vt()({path:"/sws/v1/settings/get-gateway-settings",method:"GET"}).then((function(e){r(e),s(!1)})).catch((function(e){s(!1),F.error("Failed to update settings: ".concat(e.message))}))}),[]);var u=function(e){var t="yes"===n[e]?"no":"yes";r((function(n){return vm(vm({},n),{},wm({},e,t))})),p(e,t)},m=function(){var e=gm(dm().mark((function e(t,r){return dm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l((function(e){return vm(vm({},e),{},wm({},r,!0))})),e.next=3,p(t,n[t]);case 3:l((function(e){return vm(vm({},e),{},wm({},r,!1))}));case 4:case"end":return e.stop()}}),e)})));return function(_x,t){return e.apply(this,arguments)}}(),p=function(){var e=gm(dm().mark((function e(t,n){var r;return dm().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Vt()({path:"/sws/v1/settings/update-gateway-settings",method:"POST",data:wm({},t,n)});case 3:return r=e.sent,F.success("Settings updated successfully!"),e.abrupt("return",r);case 8:e.prev=8,e.t0=e.catch(0),F.error("Failed to update settings: ".concat(e.t0.message));case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(t,n){return e.apply(this,arguments)}}();return wp.element.createElement(Mc,null,wp.element.createElement("div",{className:"px-4"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Payment Settings"),wp.element.createElement("div",null,c?wp.element.createElement(Oc,null):wp.element.createElement(React.Fragment,null,wp.element.createElement("p",{className:"mb-4"},"Modify the payment settings for your store."),wp.element.createElement("div",{className:"flex items-center gap-2 mb-4 mt-3"},wp.element.createElement(uu,{checked:"yes"===n.enabled,onChange:function(){return u("enabled")},className:"".concat("yes"===n.enabled?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat("yes"===n.enabled?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable Gateway")),wp.element.createElement("div",{className:"max-w-xl flex items-end mt-4"},wp.element.createElement("div",{className:"flex-grow items-end"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Title"),wp.element.createElement("input",{type:"text",value:n.title,onChange:function(e){return r(vm(vm({},n),{},{title:e.target.value}))},className:"block w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6"})),wp.element.createElement("button",{onClick:function(){return m("title","title")},type:"button",className:"mt-3 inline-flex w-full items-center justify-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 sm:ml-3 sm:mt-0 sm:w-auto",loading:a.title},a.title?"Saving...":"Save")),wp.element.createElement("div",{className:"max-w-xl flex items-end mt-4"},wp.element.createElement("div",{className:"flex-grow items-end"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Description"),wp.element.createElement("input",{type:"text",value:n.description,onChange:function(e){return r(vm(vm({},n),{},{description:e.target.value}))},className:"block w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6"})),wp.element.createElement("button",{onClick:function(){return m("description","description")},type:"button",className:"mt-3 inline-flex w-full items-center justify-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 sm:ml-3 sm:mt-0 sm:w-auto",loading:a.description},a.description?"Saving...":"Save")),wp.element.createElement("div",{className:"max-w-xl flex items-end mt-4"},wp.element.createElement("div",{className:"flex-grow items-end"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Square Sandbox Application ID"),wp.element.createElement("input",{type:"text",value:n.square_application_id_sandbox,onChange:function(e){return r(vm(vm({},n),{},{square_application_id_sandbox:e.target.value}))},className:"block w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6"})),wp.element.createElement("button",{onClick:function(){return m("square_application_id_sandbox","square_application_id_sandbox")},type:"button",className:"mt-3 inline-flex w-full items-center justify-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 sm:ml-3 sm:mt-0 sm:w-auto",loading:a.square_application_id_sandbox},a.square_application_id_sandbox?"Saving...":"Save")),wp.element.createElement("div",{className:"max-w-xl flex items-end mt-4"},wp.element.createElement("div",{className:"flex-grow items-end"},wp.element.createElement("label",{className:"block text-sm font-medium text-gray-700 mb-2"},"Square Live Application ID"),wp.element.createElement("input",{type:"text",value:n.square_application_id_live,onChange:function(e){return r(vm(vm({},n),{},{square_application_id_live:e.target.value}))},className:"block w-full !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6"})),wp.element.createElement("button",{onClick:function(){return m("square_application_id_live","square_application_id_live")},type:"button",className:"mt-3 inline-flex w-full items-center justify-center rounded-md bg-sky-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-sky-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-600 sm:ml-3 sm:mt-0 sm:w-auto",loading:a.square_application_id_live},a.square_application_id_live?"Saving...":"Save")),wp.element.createElement("div",{className:"mb-4 mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 mb-3"},"Payment Methods"),wp.element.createElement("div",{className:"grid grid-cols-2 gap-4"},["visa","mastercard","amex","discover","jcb","diners","union"].map((function(e){var t=!!n.accepted_credit_cards&&n.accepted_credit_cards.includes(e);return wp.element.createElement("div",{key:e,className:"flex items-center"},wp.element.createElement("input",{type:"checkbox",checked:t,onChange:function(){return function(e){var t,o=!!n.accepted_credit_cards&&n.accepted_credit_cards.includes(e);t=o?n.accepted_credit_cards.filter((function(t){return t!==e})):[].concat(function(e){return function(e){if(Array.isArray(e))return Em(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||xm(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(n.accepted_credit_cards),[e]),r((function(e){return vm(vm({},e),{},{accepted_credit_cards:t})})),p("accepted_credit_cards",t)}(e)},className:"h-4 w-4 text-sky-600 border-gray-300 rounded"}),wp.element.createElement("label",{htmlFor:e,className:"ml-2 block text-sm font-medium text-gray-700"},e.charAt(0).toUpperCase()+e.slice(1)))})),".")),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 mt-6"},"Digital Wallets"),wp.element.createElement("div",{className:"flex items-center gap-2 mb-4 mt-6"},wp.element.createElement(uu,{checked:"yes"===n.enable_google_pay,onChange:function(){return u("enable_google_pay")},className:"".concat("yes"===n.enable_google_pay?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat("yes"===n.enable_google_pay?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable Google Pay")),wp.element.createElement("div",{className:"flex items-center gap-2 mb-4"},wp.element.createElement(uu,{checked:"yes"===n.enable_apple_pay,onChange:function(){return u("enable_apple_pay")},className:"".concat("yes"===n.enable_apple_pay?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat("yes"===n.enable_apple_pay?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable Apple Pay"))))))}},{path:"/settings/inventory",element:function(){mn();var e=An(),t=e.settings,n=e.updateSettings,r=e.settingsLoading;return wp.element.createElement(Mc,null,wp.element.createElement(React.Fragment,null,!r&&wp.element.createElement(React.Fragment,null,wp.element.createElement(ss,{settings:t,updateSettings:n,settingsLoading:r}),wp.element.createElement(hs,{settings:t,updateSettings:n,settingsLoading:r}),wp.element.createElement(ku,{settings:t,updateSettings:n}),wp.element.createElement(mu,{settings:t,updateSettings:n}),wp.element.createElement(Ou,{settings:t,updateSettings:n}),wp.element.createElement(Nu,{settings:t,updateSettings:n}))))}},{path:"/settings/customers",element:function(){mn();var e=An(),t=e.settings,n=e.updateSettings,r=e.settingsLoading;return wp.element.createElement(Mc,null,wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 text-black"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Filter Square Customers",wp.element.createElement("a",{className:"pro-badge !relative",href:"https://squaresyncforwoo.com",target:"_blank"},"PRO ONLY")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Select the Square customer segment or group you wish to use for WordPress syncing (if any)."))),wp.element.createElement(Kc,{settings:t,updateSettings:n,settingsLoading:r}),wp.element.createElement(ns,{settings:t,updateSettings:n,settingsLoading:r}),wp.element.createElement(rs,{settings:t,updateSettings:n,settingsLoading:r}),wp.element.createElement(os,{settings:t,updateSettings:n,settingsLoading:r})))}},{path:"/settings/orders",element:function(){mn();var t=An(),n=t.settings,r=t.updateSettings,o=t.settingsLoading,a=um((0,e.useState)([]),2),l=a[0],i=a[1],c=um((0,e.useState)(!0),2),s=c[0],u=c[1],m=um((0,e.useState)(),2),p=m[0],f=m[1],d=um((0,e.useState)(!0),2),h=d[0],g=d[1];(0,e.useEffect)((function(){var e=function(){var e=sm(om().mark((function e(){return om().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Vt()({path:"/sws/v1/settings/get-gateway-settings",method:"GET"}).then((function(e){f((function(t){return lm(lm({},t),e)})),g(!1)})).catch((function(e){g(!1),F({render:"Failed to update settings: "+e.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0})}));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]),(0,e.useEffect)((function(){u(!0);var e=function(){var e=sm(om().mark((function e(){return om().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Vt()({path:"/sws/v1/settings/get-shipping-methods",method:"GET"}).then((function(e){i(e),u(!1)})).catch((function(e){F({render:"Failed to get shipping methods: "+e.message,type:"error",isLoading:!1,autoClose:!1,closeOnClick:!0}),u(!1)}));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]);var y=n.orders.pickupSchedule||pm.reduce((function(e,t){return lm(lm({},e),{},im({},t,{enabled:!1,from:"09:00",to:"17:00"}))}),{});return wp.element.createElement(Mc,null,wp.element.createElement(React.Fragment,null,o&&!h?wp.element.createElement("div",null,"Loading..."):wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Automatic Order Sync"),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Streamline your business operations by synchronizing your WooCommerce orders with Square automatically."),p&&"yes"!==p.enabled?wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("div",{className:"flex items-center gap-2"},wp.element.createElement(uu,{checked:n.orders.enabled,onChange:function(e){r("orders",lm(lm({},n.orders),{},{enabled:e}))},className:"".concat(n.orders.enabled?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.orders.enabled?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable automatic order sync")),wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(uu,{checked:n.orders.transactions,onChange:function(e){r("orders",lm(lm({},n.orders),{},{transactions:e}))},className:"".concat(n.orders.transactions?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.orders.transactions?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable transaction/receipt sync")),wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900 mt-6"},"Woo Status"),wp.element.createElement("p",{className:"mb-4"},"Select the specific stage within the WooCommerce order cycle at which the order will be synchronized with Square."),wp.element.createElement("select",{className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10",value:n.orders.stage,onChange:function(e){r("orders",lm(lm({},n.orders),{},{stage:e.target.value}))}},wp.element.createElement("option",{value:"processing"},"processing"),wp.element.createElement("option",{value:"completed"},"completed")))):wp.element.createElement("div",null,wp.element.createElement("p",{className:"mb-4 text-sky-500"},"SquareSync Payment Gateway is currently enabled, and because orders and transactions are automatically generated, these settings cannot be edited. To make changes, please disable the SquareSync Payment Gateway."))))),wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mb-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time Order Import ",wp.element.createElement(At,null)),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Automatically import your Square orders into WooCommerce")),wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(uu,{checked:!1,className:"".concat(n.orders.orderImport?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.orders.orderImport?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable real-time order import")),wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(uu,{checked:!1,className:"".concat(n.orders.orderImportAllLocations?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.orders.orderImportAllLocations?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Import orders from all locations ",wp.element.createElement("span",{className:"font-normal"},"(Default is the currently selected location on general settings page)"))),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 "},wp.element.createElement("p",{className:""},"Ensure your webhook has been subscribed to event ",wp.element.createElement("span",{className:"font-semibold"},"order.created")))),wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 mb-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Real-time Order Status Sync ",wp.element.createElement(At,null)),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Syncronize your order statuses from Square to WooCommerce.")),wp.element.createElement("div",{className:"flex items-center gap-2 mt-4"},wp.element.createElement(uu,{checked:!1,className:"".concat(n.orders.statusSync?"bg-sky-500":"bg-gray-200"," relative inline-flex h-6 w-11 items-center rounded-full")},wp.element.createElement("span",{className:"".concat(n.orders.statusSync?"translate-x-6":"translate-x-1"," inline-block h-4 w-4 transform rounded-full bg-white transition")})),wp.element.createElement("p",{className:"font-semibold text-sm"},"Enable or disable real-time order status sync")),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 "},wp.element.createElement("p",{className:""},"Ensure your webhook has been subscribed to event ",wp.element.createElement("span",{className:"font-semibold"},"order.fulfillment.updated")))),s?wp.element.createElement("div",null,"Shipping methods loading.."):wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Local Pickup Setup",wp.element.createElement(At,null)),wp.element.createElement("div",{className:"mt-2 max-w-xl text-sm text-gray-500 mb-4"},wp.element.createElement("p",{className:"mb-4"},"Configure the linkage between WooCommerce shipping methods and Square's local pickup orders. Select which WooCommerce shipping method corresponds to local pickups at your Square locations. Additionally, set preferences for the pickup time window and specify the default Square location for pickups.")),wp.element.createElement("div",{className:"blur-sm"},wp.element.createElement("div",null,wp.element.createElement("select",{id:"pickup",name:"pickup",value:n.orders.pickupMethod||"local_pickup",className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2 !pr-10"},wp.element.createElement("option",{value:"",disabled:!0},"Select your local pickup shipping method"),l.map((function(e){return wp.element.createElement("option",{key:e.id,value:e.id},e.title)})))),wp.element.createElement("div",{className:"mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Preparation Time"),wp.element.createElement("p",{className:"text-sm text-gray-500 mb-4"},"Specify the time required for order preparation before it can be available for pickup. Enter the time in minutes."),wp.element.createElement("input",{type:"number",min:"0",value:n.orders.preparationTime||60,className:"block !rounded-lg !border-0 !py-1.5 text-gray-900 !ring-1 !ring-inset !ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-sky-600 sm:text-sm !px-4 !leading-6 mt-2"}),wp.element.createElement("p",{className:"text-sm text-gray-500 mt-1"},'Time in minutes before a pickup order can be available after being placed. For example, enter "30" for a 30-minute preparation time.')),wp.element.createElement("div",{className:"mt-6"},wp.element.createElement("h3",{className:"text-base font-semibold leading-6 text-gray-900"},"Pickup Schedule"),wp.element.createElement("p",{className:"text-sm text-gray-500 mb-4"},"Define your pickup times for each day of the week. Enable pickup on specific days and set available time ranges."),wp.element.createElement("table",{className:"min-w-full"},wp.element.createElement("thead",null,wp.element.createElement("tr",null,wp.element.createElement("th",{className:"text-left"},"Day"),wp.element.createElement("th",{className:"text-left"},"Enable Pickup"),wp.element.createElement("th",{className:"text-left"},"From"),wp.element.createElement("th",{className:"text-left"},"To"))),wp.element.createElement("tbody",null,pm.map((function(e){var t,n,r,o,a;return wp.element.createElement("tr",{key:e},wp.element.createElement("td",null,e),wp.element.createElement("td",null,wp.element.createElement("input",{type:"checkbox",checked:(null===(t=y[e])||void 0===t?void 0:t.enabled)||!1})),wp.element.createElement("td",null,wp.element.createElement("input",{type:"time",value:(null===(n=y[e])||void 0===n?void 0:n.from)||"09:00",disabled:!(null!==(r=y[e])&&void 0!==r&&r.enabled),className:"ml-2"})),wp.element.createElement("td",null,wp.element.createElement("input",{type:"time",value:(null===(o=y[e])||void 0===o?void 0:o.to)||"17:00",disabled:!(null!==(a=y[e])&&void 0!==a&&a.enabled),className:"ml-2"})))})))))))))}},{path:"/settings/loyalty",element:function(){mn();var t=An(),n=t.settings,r=t.updateSettings,o=tm((0,e.useState)(!1),2),a=o[0],l=(o[1],tm((0,e.useState)(""),2)),i=l[0],c=(l[1],tm((0,e.useState)(n.loyalty.program||null),2)),s=c[0];return c[1],wp.element.createElement(Mc,null,wp.element.createElement(React.Fragment,null,wp.element.createElement("div",{className:"px-4 pb-5 sm:px-6 text-black"},wp.element.createElement(Ju,{settings:n,updateSettings:r}),a&&wp.element.createElement("div",{className:"flex gap-2 mt-4"},wp.element.createElement("svg",{className:"animate-spin h-5 w-5 text-sky-500",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},wp.element.createElement("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),wp.element.createElement("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})),wp.element.createElement("p",null,"Loading loyalty program")),i&&wp.element.createElement("p",{className:"text-sm text-red-500 mt-2"},i),s&&!a&&wp.element.createElement(em,{program:s}))))}}];const km=Sm,Nm=function(e){var t=e.children;return wp.element.createElement(sl,null,wp.element.createElement(In,null,wp.element.createElement(gc,null,t)))};var Om="persist:",Cm="persist/FLUSH",jm="persist/REHYDRATE",Pm="persist/PAUSE",Lm="persist/PERSIST",_m="persist/PURGE",Rm="persist/REGISTER";function Im(e){return Im="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Im(e)}function Am(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Tm(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fm(e){return JSON.stringify(e)}function Mm(e){return JSON.parse(e)}function Dm(e){}function Gm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gm(n,!0).forEach((function(t){Vm(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gm(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Vm(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wm(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function Bm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Hm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bm(n,!0).forEach((function(t){zm(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bm(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function zm(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Um={registry:[],bootstrapped:!1},$m=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Um,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case Rm:return Hm({},e,{registry:[].concat(Wm(e.registry),[t.key])});case jm:var n=e.registry.indexOf(t.key),r=Wm(e.registry);return r.splice(n,1),Hm({},e,{registry:r,bootstrapped:0===r.length});default:return e}},Zm=o(181);function Ym(e){return Ym="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ym(e)}function Km(){Km=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==Ym(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Ym(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function Xm(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function Jm(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){Xm(a,r,o,l,i,"next",e)}function i(e){Xm(a,r,o,l,i,"throw",e)}l(void 0)}))}}function Qm(){return ep.apply(this,arguments)}function ep(){return(ep=Jm(Km().mark((function e(){var t;return Km().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Ut({path:"/sws/v1/customers/get-groups"});case 3:if(t=e.sent,console.log("API Response:",t),!(t&&t.square_groups&&t.wp_user_roles)){e.next=9;break}return e.abrupt("return",{groups:t.square_groups,roles:t.wp_user_roles,roleMappings:t.roleMappings||[]});case 9:throw new Error("Invalid API response format");case 10:e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(0),console.error("API Fetch Error:",e.t0),e.t0;case 16:case"end":return e.stop()}}),e,null,[[0,12]])})))).apply(this,arguments)}var tp=function(){var e=Jm(Km().mark((function e(){var t,n;return Km().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("Fetching Customer Groups and Roles"),t=F.loading("Retrieving Customer Groups and Roles"),e.prev=2,e.next=5,Qm();case 5:return n=e.sent,F.update(t,{render:"Groups and Roles Received",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.abrupt("return",{status:"success",data:n});case 10:return e.prev=10,e.t0=e.catch(2),F.update(t,{render:"Error fetching groups and roles: ".concat(e.t0),type:"error",isLoading:!1,closeOnClick:!0,autoClose:5e3}),console.error(e.t0),e.abrupt("return",{status:"error",error:e.t0});case 15:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(){return e.apply(this,arguments)}}(),np=function(){var e=Jm(Km().mark((function e(t){var n,r;return Km().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("Saving Role Mappings"),n=F.loading("Saving Role Mappings"),e.prev=2,e.next=5,Ut({path:"/sws/v1/customers/role-mappings",method:"POST",data:{roleMappings:t}});case 5:if(r=e.sent,console.log("Save Response:",r),!r||"success"!==r.status){e.next=12;break}return F.update(n,{render:"Role Mappings Saved",type:"success",isLoading:!1,autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),e.abrupt("return",{status:"success",roleMappings:r.roleMappings});case 12:throw new Error("Invalid API response format");case 13:e.next=20;break;case 15:return e.prev=15,e.t0=e.catch(2),F.update(n,{render:"Error saving role mappings: ".concat(e.t0.message||"Server error"),type:"error",isLoading:!1,closeOnClick:!0,autoClose:5e3}),console.error("Error saving role mappings:",e.t0),e.abrupt("return",{status:"error",error:e.t0.message||"Server error"});case 20:case"end":return e.stop()}}),e,null,[[2,15]])})));return function(_x){return e.apply(this,arguments)}}(),rp=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;return new Promise((function(n,r){var o=function(){var a=Jm(Km().mark((function a(l){var i,c;return Km().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(a.prev=0,i=null,e)try{localStorage.removeItem("customersData")}catch(e){console.warn("Failed to remove data from local storage:",e)}else{try{i=localStorage.getItem("customersData")}catch(e){console.warn("Failed to retrieve data from local storage:",e)}i&&setTimeout((function(){var e=JSON.parse(i);return n({status:"success",data:e})}),100)}return a.next=5,Ut({path:"/sws/v1/customers".concat(l&&e?"?force=true":"")});case 5:if(c=a.sent,console.log(c),c.loading)l&&F.info("Fetching data, please wait...",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!1}),setTimeout((function(){return o(!1)}),t);else if(0===c.data.length)F.info("No data available",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),n({status:"success",data:[]});else{try{localStorage.setItem("customersData",JSON.stringify(c.data))}catch(e){console.warn("Failed to store data in local storage:",e)}F.success("Customers Retrieved",{autoClose:2e3,hideProgressBar:!1,closeOnClick:!0}),n({status:"success",data:c.data})}a.next=14;break;case 10:a.prev=10,a.t0=a.catch(0),F.error("Error fetching customers: ".concat(a.t0.message||"Server error"),{autoClose:5e3,closeOnClick:!0}),r({status:"error",error:a.t0.message||"Server error"});case 14:case"end":return a.stop()}}),a,null,[[0,10]])})));return function(e){return a.apply(this,arguments)}}();o(!0)}))};function op(e){return op="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},op(e)}function ap(){ap=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==op(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(op(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function lp(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function ip(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){lp(a,r,o,l,i,"next",e)}function i(e){lp(a,r,o,l,i,"throw",e)}l(void 0)}))}}var cp=wo("customerGroupsAndRoles/fetchIfNeeded",ip(ap().mark((function e(){var t,n,r,o,a,l,i,c,s=arguments;return ap().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]&&s[0],r=(n=s.length>1?s[1]:void 0).getState,o=n.rejectWithValue,a=r(),l=a.customerGroupsAndRoles,i=0,c=function(){var e=ip(ap().mark((function e(){var n;return ap().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!t&&(l.data.groups.length||l.data.roles.length)){e.next=12;break}return e.next=4,tp();case 4:if("success"!==(n=e.sent).status){e.next=9;break}return e.abrupt("return",n.data);case 9:throw new Error(n.error);case 10:e.next=13;break;case 12:return e.abrupt("return",l.data);case 13:e.next=27;break;case 15:if(e.prev=15,e.t0=e.catch(0),!(i<1)){e.next=25;break}return i++,console.warn("Retrying fetch groups and roles (".concat(i,"/").concat(1,")...")),e.next=22,c();case 22:return e.abrupt("return",e.sent);case 25:return console.error("Max retries reached. Unable to fetch groups and roles."),e.abrupt("return",o(e.t0.message));case 27:case"end":return e.stop()}}),e,null,[[0,15]])})));return function(){return e.apply(this,arguments)}}(),e.next=8,c();case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)})))),sp=wo("customerGroupsAndRoles/saveMappings",function(){var e=ip(ap().mark((function e(t,n){var r,o,a,l;return ap().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.rejectWithValue,e.prev=1,o=Object.values(t).map((function(e){return e.priority})),a=new Set(o),o.length===a.size){e.next=6;break}throw new Error("Each mapping must have a unique priority.");case 6:return e.next=8,np(t);case 8:if("success"!==(l=e.sent).status){e.next=13;break}return e.abrupt("return",{roleMappings:l.roleMappings});case 13:throw new Error(l.error);case 14:e.next=19;break;case 16:return e.prev=16,e.t0=e.catch(1),e.abrupt("return",r(e.t0.message));case 19:case"end":return e.stop()}}),e,null,[[1,16]])})));return function(_x,t){return e.apply(this,arguments)}}());const up=fo({name:"customerGroupsAndRoles",initialState:{data:{groups:[],roles:{},roleMappings:{}},loading:!1,error:null},reducers:{},extraReducers:function(e){e.addCase(cp.pending,(function(e){e.loading=!0})).addCase(cp.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase(cp.rejected,(function(e,t){e.loading=!1,e.data={groups:[],roles:{},roleMappings:{}},e.error=t.payload})).addCase(sp.pending,(function(e){e.loading=!0})).addCase(sp.fulfilled,(function(e,t){e.loading=!1,e.data.roleMappings=t.payload.roleMappings,e.error=null})).addCase(sp.rejected,(function(e,t){e.loading=!1,e.error=t.payload}))}}).reducer;function mp(e){return mp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mp(e)}function pp(){pp=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var a=t&&t.prototype instanceof y?t:y,l=Object.create(a.prototype),i=new L(r||[]);return o(l,"_invoke",{value:O(e,n,i)}),l}function m(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",f="suspendedYield",d="executing",h="completed",g={};function y(){}function v(){}function w(){}var b={};s(b,l,(function(){return this}));var x=Object.getPrototypeOf,E=x&&x(x(_([])));E&&E!==n&&r.call(E,l)&&(b=E);var S=w.prototype=y.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,a,l,i){var c=m(e[o],e,a);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==mp(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,l,i)}),(function(e){n("throw",e,l,i)})):t.resolve(u).then((function(e){s.value=e,l(s)}),(function(e){return n("throw",e,l,i)}))}i(c.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function O(t,n,r){var o=p;return function(a,l){if(o===d)throw Error("Generator is already running");if(o===h){if("throw"===a)throw l;return{value:e,done:!0}}for(r.method=a,r.arg=l;;){var i=r.delegate;if(i){var c=C(i,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=m(t,n,r);if("normal"===s.type){if(o=r.done?h:f,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=h,r.method="throw",r.arg=s.arg)}}}function C(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var a=m(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,g;var l=a.arg;return l?l.done?(n[t.resultName]=l.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):l:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function _(t){if(t||""===t){var n=t[l];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(mp(t)+" is not iterable")}return v.prototype=w,o(S,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:v,configurable:!0}),v.displayName=s(w,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(N.prototype),s(N.prototype,i,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var l=new N(u(e,n,r,o),a);return t.isGeneratorFunction(n)?l:l.next().then((function(e){return e.done?e.value:l.next()}))},k(S),s(S,c,"Generator"),s(S,l,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=_,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return i.type="throw",i.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var l=this.tryEntries[a],i=l.completion;if("root"===l.tryLoc)return o("end");if(l.tryLoc<=this.prev){var c=r.call(l,"catchLoc"),s=r.call(l,"finallyLoc");if(c&&s){if(this.prev<l.catchLoc)return o(l.catchLoc,!0);if(this.prev<l.finallyLoc)return o(l.finallyLoc)}else if(c){if(this.prev<l.catchLoc)return o(l.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return o(l.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(l)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:_(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function fp(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function dp(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function l(e){fp(a,r,o,l,i,"next",e)}function i(e){fp(a,r,o,l,i,"throw",e)}l(void 0)}))}}var hp,gp,yp,vp,bp,xp,Ep,Sp,kp,Np,Op=wo("customers/fetchIfNeeded",dp(pp().mark((function e(){var t,n,r,o,a,l,i,c,s=arguments;return pp().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]&&s[0],r=(n=s.length>1?s[1]:void 0).getState,o=n.rejectWithValue,a=r(),l=a.customers,!t&&null!==l.data){e.next=24;break}return e.prev=4,e.next=7,rp(t);case 7:if("success"!==(i=e.sent).status){e.next=12;break}return e.abrupt("return",i.data);case 12:if("loading"!==i.status){e.next=16;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 16:throw new Error(i.error);case 17:e.next=22;break;case 19:return e.prev=19,e.t0=e.catch(4),e.abrupt("return",o(e.t0.message));case 22:e.next=44;break;case 24:if(!l.loading){e.next=43;break}return e.prev=25,e.next=28,rp(!1);case 28:if("success"!==(c=e.sent).status){e.next=33;break}return e.abrupt("return",c.data);case 33:if("loading"!==c.status){e.next=37;break}return e.abrupt("return",o("Data is being fetched, please wait..."));case 37:throw new Error(c.error);case 38:e.next=43;break;case 40:return e.prev=40,e.t1=e.catch(25),e.abrupt("return",o(e.t1.message));case 43:return e.abrupt("return",l.data);case 44:case"end":return e.stop()}}),e,null,[[4,19],[25,40]])})))),Cp=Br({inventory:Xl,licence:jo,orders:Ui,customerGroupsAndRoles:up,customers:fo({name:"customers",initialState:{data:null,loading:!1,error:null,fetchAttempted:!1},reducers:{},extraReducers:function(e){e.addCase(Op.pending,(function(e){e.loading=!0,e.fetchAttempted=!0})).addCase(Op.fulfilled,(function(e,t){e.loading=!1,e.data=t.payload,e.error=null})).addCase(Op.rejected,(function(e,t){e.loading=!1,e.data=[],e.error=t.payload}))}}).reducer}),jp={key:"root",storage:Zm.A,whitelist:["inventory","customerGroupsAndRoles","customers"]},Pp=(gp=Cp,yp=void 0!==(hp=jp).version?hp.version:-1,vp=void 0===hp.stateReconciler?function(e,t,n,r){r.debug;var o=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Am(n,!0).forEach((function(t){Tm(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Am(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},n);return e&&"object"===Im(e)&&Object.keys(e).forEach((function(r){"_persist"!==r&&t[r]===n[r]&&(o[r]=e[r])})),o}:hp.stateReconciler,bp=hp.getStoredState||function(e){var t,n=e.transforms||[],r="".concat(void 0!==e.keyPrefix?e.keyPrefix:Om).concat(e.key),o=e.storage;return e.debug,t=!1===e.deserialize?function(e){return e}:"function"==typeof e.deserialize?e.deserialize:Mm,o.getItem(r).then((function(e){if(e)try{var r={},o=t(e);return Object.keys(o).forEach((function(e){r[e]=n.reduceRight((function(t,n){return n.out(t,e,o)}),t(o[e]))})),r}catch(e){throw e}}))},xp=void 0!==hp.timeout?hp.timeout:5e3,Ep=null,Sp=!1,kp=!0,Np=function(e){return e._persist.rehydrated&&Ep&&!kp&&Ep.update(e),e},function(e,t){var n=e||{},r=n._persist,o=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(n,["_persist"]);if(t.type===Lm){var a=!1,l=function(e,n){a||(t.rehydrate(hp.key,e,n),a=!0)};if(xp&&setTimeout((function(){!a&&l(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(hp.key,'"')))}),xp),kp=!1,Ep||(Ep=function(e){var t,n=e.blacklist||null,r=e.whitelist||null,o=e.transforms||[],a=e.throttle||0,l="".concat(void 0!==e.keyPrefix?e.keyPrefix:Om).concat(e.key),i=e.storage;t=!1===e.serialize?function(e){return e}:"function"==typeof e.serialize?e.serialize:Fm;var c=e.writeFailHandler||null,s={},u={},m=[],p=null,f=null;function d(){if(0===m.length)return p&&clearInterval(p),void(p=null);var e=m.shift(),n=o.reduce((function(t,n){return n.in(t,e,s)}),s[e]);if(void 0!==n)try{u[e]=t(n)}catch(e){console.error("redux-persist/createPersistoid: error serializing state",e)}else delete u[e];0===m.length&&(Object.keys(u).forEach((function(e){void 0===s[e]&&delete u[e]})),f=i.setItem(l,t(u)).catch(g))}function h(e){return!(r&&-1===r.indexOf(e)&&"_persist"!==e||n&&-1!==n.indexOf(e))}function g(e){c&&c(e)}return{update:function(e){Object.keys(e).forEach((function(t){h(t)&&s[t]!==e[t]&&-1===m.indexOf(t)&&m.push(t)})),Object.keys(s).forEach((function(t){void 0===e[t]&&h(t)&&-1===m.indexOf(t)&&void 0!==s[t]&&m.push(t)})),null===p&&(p=setInterval(d,a)),s=e},flush:function(){for(;0!==m.length;)d();return f||Promise.resolve()}}}(hp)),r)return qm({},gp(o,t),{_persist:r});if("function"!=typeof t.rehydrate||"function"!=typeof t.register)throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return t.register(hp.key),bp(hp).then((function(e){var t=hp.migrate||function(e,t){return Promise.resolve(e)};t(e,yp).then((function(e){l(e)}),(function(e){l(void 0,e)}))}),(function(e){l(void 0,e)})),qm({},gp(o,t),{_persist:{version:yp,rehydrated:!1}})}if(t.type===_m)return Sp=!0,t.result(function(e){var t=e.storage,n="".concat(void 0!==e.keyPrefix?e.keyPrefix:Om).concat(e.key);return t.removeItem(n,Dm)}(hp)),qm({},gp(o,t),{_persist:r});if(t.type===Cm)return t.result(Ep&&Ep.flush()),qm({},gp(o,t),{_persist:r});if(t.type===Pm)kp=!0;else if(t.type===jm){if(Sp)return qm({},o,{_persist:qm({},r,{rehydrated:!0})});if(t.key===hp.key){var i=gp(o,t),c=t.payload,s=qm({},!1!==vp&&void 0!==c?vp(c,e,i,hp):i,{_persist:qm({},r,{rehydrated:!0})});return Np(s)}}if(!r)return gp(e,t);var u=gp(o,t);return u===o?e:Np(qm({},u,{_persist:r}))}),Lp=function(e){var t,n=function(e){return function(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,r=(e.immutableCheck,e.serializableCheck,e.actionCreatorCheck,new so);return n&&("boolean"!=typeof n?r.push(Zr.withExtraArgument(n.extraArgument)):r.push(Zr)),r}(e)},r=e||{},o=r.reducer,a=void 0===o?void 0:o,l=r.middleware,i=void 0===l?n():l,c=r.devTools,s=void 0===c||c,u=r.preloadedState,m=void 0===u?void 0:u,p=r.enhancers,f=void 0===p?void 0:p;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=Br(a)}var d=i;"function"==typeof d&&(d=d(n));var h=zr.apply(void 0,d),g=Hr;s&&(g=io(ao({trace:!1},"object"==typeof s&&s)));var y=new uo(h),v=y;return Array.isArray(f)?v=Xr([h],f):"function"==typeof f&&(v=f(y)),Wr(t,m,g.apply(void 0,v))}({reducer:Pp,middleware:function(e){return e({serializableCheck:!1})}}),_p=function(e,t,n){var r=!1,o=Wr($m,Um,void 0),a=function(e){o.dispatch({type:Rm,key:e})},l=function(t,n,a){var l={type:jm,payload:n,err:a,key:t};e.dispatch(l),o.dispatch(l),r&&i.getState().bootstrapped&&(r(),r=!1)},i=Hm({},o,{purge:function(){var t=[];return e.dispatch({type:_m,result:function(e){t.push(e)}}),Promise.all(t)},flush:function(){var t=[];return e.dispatch({type:Cm,result:function(e){t.push(e)}}),Promise.all(t)},pause:function(){e.dispatch({type:Pm})},persist:function(){e.dispatch({type:Lm,register:a,rehydrate:l})}});return i.persist(),i}(Lp),Rp=document.getElementById("square-woo-sync");null!=Rp&&(0,e.createRoot)(Rp).render(wp.element.createElement(React.Fragment,null,wp.element.createElement(O,{className:"toast-position",position:"top-right",autoClose:500,hideProgressBar:!0,newestOnTop:!1,closeOnClick:!0,rtl:!1,pauseOnFocusLoss:!0,draggable:!0,pauseOnHover:!0,theme:"light"}),wp.element.createElement((function({store:e,context:n,children:r,serverState:o,stabilityCheck:a="once",noopCheck:l="once"}){const i=t.useMemo((()=>{const t=function(e,t){let n,r=J,o=0,a=!1;function l(){s.onStateChange&&s.onStateChange()}function i(){o++,n||(n=t?t.addNestedSub(l):e.subscribe(l),r=function(){const e=V();let t=null,n=null;return{clear(){t=null,n=null},notify(){e((()=>{let e=t;for(;e;)e.callback(),e=e.next}))},get(){let e=[],n=t;for(;n;)e.push(n),n=n.next;return e},subscribe(e){let r=!0,o=n={callback:e,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){r&&null!==t&&(r=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}())}function c(){o--,n&&0===o&&(n(),n=void 0,r.clear(),r=J)}const s={addNestedSub:function(e){i();const t=r.subscribe(e);let n=!1;return()=>{n||(n=!0,t(),c())}},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:l,isSubscribed:function(){return a},trySubscribe:function(){a||(a=!0,i())},tryUnsubscribe:function(){a&&(a=!1,c())},getListeners:()=>r};return s}(e);return{store:e,subscription:t,getServerState:o?()=>o:void 0,stabilityCheck:a,noopCheck:l}}),[e,o,a,l]),c=t.useMemo((()=>e.getState()),[e]);Q((()=>{const{subscription:t}=i;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),c!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[i,c]);const s=n||z;return t.createElement(s.Provider,{value:i},r)}),{store:Lp},wp.element.createElement(fe,{loading:null,persistor:_p},wp.element.createElement((function(){return wp.element.createElement(kt,null,wp.element.createElement(It,null,wp.element.createElement(Nm,null,wp.element.createElement(gt,null,km.map((function(e,t){return wp.element.createElement(dt,{key:t,path:e.path,element:wp.element.createElement(e.element,null)})}))))))}),null)))))})()})(); -
squarewoosync/trunk/includes/Payments/Blocks/WC_SquareSync_Gateway_Blocks_Support.php
r3220600 r3292205 113 113 'enable_google_pay' => $this->gateway->get_option('enable_google_pay'), 114 114 'enable_apple_pay' => $this->gateway->get_option('enable_apple_pay'), 115 'enable_after_pay' => $this->gateway->get_option('enable_after_pay'), 115 116 'general_error' => __('An error occurred, please try again or try an alternate form of payment.', 'woocommerce-square'), 116 117 'ajax_url' => \WC_AJAX::get_endpoint('%%endpoint%%'), -
squarewoosync/trunk/includes/Payments/WC_SquareSync_Gateway.php
r3220600 r3292205 84 84 85 85 add_action('wc_ajax_square_digital_wallet_recalculate_totals', array($this, 'ajax_recalculate_totals')); 86 add_action('wp_ajax_recalculate_totals', array($this, 'ajax_recalculate_totals')); 87 add_action('wp_ajax_nopriv_recalculate_totals', array($this, 'ajax_recalculate_totals')); 86 88 87 89 add_action('wp_ajax_nopriv_get_needs_shipping', array($this, 'get_needs_shipping')); … … 106 108 * 107 109 * @param float $amount_to_charge The amount to charge this renewal. 108 * @param WC_Order $renewal_order The renewal order object.110 * @param \WC_Order $renewal_order The renewal order object. 109 111 */ 110 112 public function scheduled_subscription_payment($amount_to_charge, $renewal_order) … … 145 147 $total_amount = intval(round($amount_to_charge * $multiplier)); 146 148 $currency = $renewal_order->get_currency(); 149 150 $settings = get_option('square-woo-sync_settings', []); 151 $locationId = $settings['location']; 152 if ( 153 ! empty($settings['orders']['orderable']) 154 && class_exists('Orderable_Location_Single_Pro') 155 && class_exists('Orderable_Location') 156 && method_exists('Orderable_Location', 'get_selected_location') 157 ) { 158 // 2) Get the ID of the selected Orderable location for this order (if set) 159 $selected_orderable_location_id = \Orderable_Location::get_selected_location(); 160 161 if ($selected_orderable_location_id) { 162 // 3) Load the Orderable location object 163 $orderable_location_obj = new \Orderable_Location_Single_Pro($selected_orderable_location_id); 164 165 // 4) The data includes location_id (the database ID from wp_orderable_locations) 166 $orderable_db_id = $orderable_location_obj->location_data['location_id'] ?? null; 167 168 // 5) See if your settings have a mapping for that Orderable location → Square location 169 $orderable_mapping = $settings['orders']['orderable_location_mapping'] ?? []; 170 171 if (! empty($orderable_db_id) && isset($orderable_mapping[$orderable_db_id])) { 172 // Mapped Square ID 173 $squareMappedId = $orderable_mapping[$orderable_db_id]; 174 175 if (! empty($squareMappedId)) { 176 $locationId = $squareMappedId; 177 } 178 } 179 } 180 } 147 181 148 182 // 4. Prepare the body for the Square charge request … … 155 189 'currency' => $currency, 156 190 ], 157 'location_id' => $ this->location_id,191 'location_id' => $locationId, 158 192 'customer_id' => $square_customer_id, 159 193 'autocomplete' => true, … … 174 208 $renewal_order->payment_complete($payment_id); 175 209 $renewal_order->add_order_note(sprintf( 176 __('Subscription renewal of %1$s via Square succeeded. Transaction ID: %2$s', 'squarewoosync -pro'),210 __('Subscription renewal of %1$s via Square succeeded. Transaction ID: %2$s', 'squarewoosync'), 177 211 wc_price($amount_to_charge), 178 212 $payment_id … … 181 215 // If something failed, mark the order as failed & add a note 182 216 $renewal_order->update_status('failed', sprintf( 183 __('Square renewal failed: %s', 'squarewoosync -pro'),217 __('Square renewal failed: %s', 'squarewoosync'), 184 218 $e->getMessage() 185 219 )); … … 247 281 } 248 282 283 /** 284 * Hook for shipping check AJAX 285 */ 249 286 public function get_needs_shipping() 250 287 { 251 // Check if WooCommerce cart is available252 288 if (WC()->cart) { 253 289 $needs_shipping = WC()->cart->needs_shipping(); 254 wp_send_json_success( array('needs_shipping' => $needs_shipping));290 wp_send_json_success(['needs_shipping' => $needs_shipping]); 255 291 } else { 256 292 wp_send_json_error('Cart not found'); … … 309 345 'title' => 'Environment Mode', 310 346 'type' => 'select', 311 'description' => 'Choose the environment mode. You must also change your Square access token and location via SquareSync plugin settings <a href="/wp-admin/admin.php?page=squarewoosync -pro#/settings/general">here</a>',347 'description' => 'Choose the environment mode. You must also change your Square access token and location via SquareSync plugin settings <a href="/wp-admin/admin.php?page=squarewoosync#/settings/general">here</a>', 312 348 'default' => $settings['environment'] ?? 'live', 313 349 'options' => ['sandbox' => 'Sandbox', 'live' => 'Live'], … … 353 389 'description' => 'Apple Pay requires domain authentication. To authorize your domain follow <a href="">this guide.</a>', 354 390 ], 391 'enable_after_pay' => [ 392 'title' => 'Enable Afterpay / Clearpay', 393 'type' => 'checkbox', 394 'label' => 'Enable Afterpay / Clearpay as a payment method', 395 'default' => 'no', 396 'description' => 'Ensure your Square account has afterpay enabled. <a href="https://squareup.com/help/us/en/article/7770-accept-in-person-payments-with-afterpay-and-square"> Read guide here</a>', 397 ], 355 398 ]; 356 399 } … … 358 401 public function enqueue_scripts() 359 402 { 360 $is_checkout = is_account_page() || is_checkout() || is_cart(); 361 362 // Bail if not a checkout or account page 363 if (!$is_checkout) { 364 403 // Bail if not cart, checkout, or account page 404 if (! is_cart() && ! is_checkout() && ! is_account_page()) { 365 405 return; 366 406 } 367 407 408 // Always load your shared styles or scripts here 368 409 if ($this->square_op_mode === 'sandbox') { 369 410 $url = 'https://sandbox.web.squarecdn.com/v1/square.js'; … … 372 413 } 373 414 374 wp_enqueue_style('wc-square-payments-sdk-css', SQUAREWOOSYNC_URL . '/assets/styles/checkout.css', array(), SQUAREWOOSYNC_VERSION, 'all'); 375 376 wp_enqueue_script('wc-square-payments-sdk', $url, array(), SQUAREWOOSYNC_VERSION, true); 377 378 if (!has_block('woocommerce/checkout')) { 379 415 wp_enqueue_style( 416 'wc-square-payments-sdk-css', 417 SQUAREWOOSYNC_URL . '/assets/styles/checkout.css', 418 array(), 419 SQUAREWOOSYNC_VERSION, 420 'all' 421 ); 422 423 wp_enqueue_script( 424 'wc-square-payments-sdk', 425 $url, 426 array(), 427 SQUAREWOOSYNC_VERSION, 428 true 429 ); 430 431 // Now check if it’s *actually* a block-based checkout. 432 $is_block_checkout = false; 433 434 if ( 435 function_exists('WC') && 436 method_exists(WC()->checkout, 'is_blocks_checkout') && 437 WC()->checkout->is_blocks_checkout() 438 ) { 439 $is_block_checkout = true; 440 } elseif (defined('WC_BLOCKS_IS_CHECKOUT_PAGE') && WC_BLOCKS_IS_CHECKOUT_PAGE) { 441 // Fallback for older versions or blocks plugin usage 442 $is_block_checkout = true; 443 } 444 445 if (! $is_block_checkout) { 446 // Enqueue your “classic”/legacy checkout scripts 380 447 wp_register_script('utils-js', SQUAREWOOSYNC_URL . '/assets/js/utils.js', array('jquery'), null, true); 381 448 wp_register_script('credit-card-js', SQUAREWOOSYNC_URL . '/assets/js/credit-card.js', array('jquery'), null, true); … … 386 453 wp_enqueue_script('wallets-js'); 387 454 388 wp_enqueue_script('squaresync-legacy', SQUAREWOOSYNC_URL . '/assets/js/square-gateway.js', null, null, true); 455 wp_enqueue_script( 456 'squaresync-legacy', 457 SQUAREWOOSYNC_URL . '/assets/js/square-gateway.js', 458 null, 459 null, 460 true 461 ); 389 462 390 463 // Localize script with WooCommerce parameters 391 464 $params = array( 392 'applicationId' => $this->square_application_id, 393 'locationId' => $this->location_id, 394 'applePayEnabled' => $this->get_option('enable_apple_pay'), 395 'googlePayEnabled' => $this->get_option('enable_google_pay'), 396 'availableCardTypes' => $this->get_option('accepted_credit_cards'), 397 'total' => 0, 398 'currency' => get_woocommerce_currency(), 465 'applicationId' => $this->square_application_id, 466 'locationId' => $this->location_id, 467 'applePayEnabled' => $this->get_option('enable_apple_pay'), 468 'googlePayEnabled' => $this->get_option('enable_google_pay'), 469 'afterPayEnabled' => $this->get_option('enable_after_pay'), 470 'availableCardTypes' => $this->get_option('accepted_credit_cards'), 471 'total' => 0, 472 'currency' => get_woocommerce_currency(), 399 473 'paymentRequestNonce' => wp_create_nonce('wc-square-get-payment-request'), 400 'context' => $this->get_current_page(), 401 'countryCode' => 'AUD', 402 'ajax_url' => admin_url('admin-ajax.php'), 474 'recalculate_totals_nonce' => wp_create_nonce('wc-square-recalculate-totals-legacy'), 475 'context' => $this->get_current_page(), 476 'countryCode' => 'AUD', 477 'ajax_url' => admin_url('admin-ajax.php'), 478 'wc_ajax_url' => \WC_AJAX::get_endpoint('%%endpoint%%'), 403 479 ); 404 480 405 // Apply localization to the correct script406 481 wp_localize_script('utils-js', 'SquareConfig', $params); 407 482 wp_localize_script('squaresync-legacy', 'SquareConfig', $params); 408 483 } 409 484 } 485 410 486 411 487 /** … … 439 515 440 516 /** 441 * Recalculate shipping methods and cart totals and send the updated information 442 * data as a square payment request json object. 517 * Recalculate shipping methods and cart totals and send updated PaymentRequest JSON. 443 518 * 444 519 * @since 2.3 … … 447 522 public function ajax_recalculate_totals() 448 523 { 449 check_ajax_referer('wc-square-recalculate-totals', 'security'); 450 451 452 if (!WC()->cart) { 524 // 1) Try the first nonce, but do NOT kill on failure (3rd param = false). 525 check_ajax_referer('wc-square-recalculate-totals', 'security', false); 526 527 // 2) If it's invalid, we fallback to the legacy nonce (normal check). 528 if (! wp_verify_nonce($_REQUEST['security'] ?? '', 'wc-square-recalculate-totals')) { 529 // This call will kill the request if the legacy nonce is also invalid 530 check_ajax_referer('wc-square-recalculate-totals-legacy', 'security'); 531 } 532 533 if (! WC()->cart) { 453 534 wp_send_json_error(__('Cart not available.', 'woocommerce-square')); 454 535 return; 455 536 } 456 537 457 $chosen_methods = WC()->session->get('chosen_shipping_methods'); 458 $shipping_address = array(); 459 $payment_request = array(); 460 461 $is_pay_for_order_page = isset($_POST['is_pay_for_order_page']) ? 'true' === sanitize_text_field(wp_unslash($_POST['is_pay_for_order_page'])) : is_wc_endpoint_url('order-pay'); 462 $order_id = isset($_POST['order_id']) ? (int) sanitize_text_field(wp_unslash($_POST['order_id'])) : absint(get_query_var('order-pay')); 463 $order_data = array(); 464 538 $chosen_methods = WC()->session->get('chosen_shipping_methods', array()); 539 $shipping_address = array(); 540 $payment_request = array(); 541 542 $is_pay_for_order_page = isset($_POST['is_pay_for_order_page']) 543 ? ('true' === sanitize_text_field(wp_unslash($_POST['is_pay_for_order_page']))) 544 : is_wc_endpoint_url('order-pay'); 545 546 $order_id = isset($_POST['order_id']) 547 ? (int) sanitize_text_field(wp_unslash($_POST['order_id'])) 548 : absint(get_query_var('order-pay')); 549 550 // We'll only do shipping logic if the cart needs it or we are on a pay-for-order page. 465 551 if (WC()->cart->needs_shipping() || $is_pay_for_order_page) { 552 // 1) Possibly parse shipping_contact and recalc shipping. 466 553 if (! empty($_POST['shipping_contact'])) { 554 $shipping_contact = wc_clean(wp_unslash($_POST['shipping_contact'])); 467 555 $shipping_address = wp_parse_args( 468 wc_clean(wp_unslash($_POST['shipping_contact'])),556 $shipping_contact, 469 557 array( 470 'countryCode' => null,471 'state' => null,472 'city' => null,473 'postalCode' => null,474 'address' => null,475 'address_2' => null,558 'countryCode' => '', 559 'state' => '', 560 'city' => '', 561 'postalCode' => '', 562 'address' => '', 563 'address_2' => '', 476 564 ) 477 565 ); 478 566 479 /** 480 * WooCommerce requires state code but for few countries, Google Pay 481 * returns the state's full name instead of the state code. 482 * 483 * The following line converts state name to code. 484 */ 485 if (isset($shipping_address['countryCode']) && isset($shipping_address['state'])) { 486 $shipping_address['state'] = self::get_state_code_by_name($shipping_address['countryCode'], $shipping_address['state']); 487 } 488 567 // Convert full state name to code if necessary. 568 if (! empty($shipping_address['countryCode']) && ! empty($shipping_address['state'])) { 569 $shipping_address['state'] = self::get_state_code_by_name( 570 $shipping_address['countryCode'], 571 $shipping_address['state'] 572 ); 573 } 574 575 // Recalc shipping using that address. 489 576 $this->calculate_shipping($shipping_address); 490 491 $packages = WC()->shipping->get_packages(); 492 $packages = array_values($packages); /// reindex the array. 493 494 if (! empty($packages)) { 495 foreach ($packages[0]['rates'] as $method) { 577 error_log('WooSquare: Recalculated shipping with address: ' . print_r($shipping_address, true)); 578 } 579 580 // 2) Possibly parse shipping_option and set chosen shipping method. 581 if (! empty($_POST['shipping_option'])) { 582 $selected_option = wc_clean(wp_unslash($_POST['shipping_option'])); 583 $chosen_methods = array($selected_option); 584 $this->update_shipping_method($chosen_methods); 585 error_log('WooSquare: Chosen shipping method updated to: ' . $selected_option); 586 } 587 588 // 3) Gather all shipping packages/rates. 589 $packages = WC()->shipping->get_packages(); 590 $packages = array_values($packages); // re-index if needed. 591 592 // We want to build an array of shippingOptions. 593 $payment_request['shippingOptions'] = array(); 594 595 if (! empty($packages)) { 596 // Store the user's originally chosen methods & totals so we can restore after the loop. 597 $original_chosen_methods = $chosen_methods; 598 $original_totals = WC()->cart->get_totals(); 599 600 foreach ($packages as $index => $package) { 601 if (empty($package['rates'])) { 602 error_log('WooSquare: No shipping rates found for package index ' . $index); 603 continue; 604 } 605 606 foreach ($package['rates'] as $method_key => $method) { 607 // We want shipping cost + shipping tax for this rate. 608 $shipping_cost = (float) $method->cost; 609 $shipping_tax = ! empty($method->taxes) ? array_sum($method->taxes) : 0.0; 610 611 // Temporarily choose THIS method, recalc totals to see the entire cart total. 612 WC()->session->set('chosen_shipping_methods', array($method->id)); 613 WC()->cart->calculate_totals(); 614 615 $recalc_totals = WC()->cart->get_totals(); 616 $cart_total_for_method = isset($recalc_totals['total']) 617 ? (float) $recalc_totals['total'] 618 : 0.0; 619 620 // Build shipping option structure: 496 621 $payment_request['shippingOptions'][] = array( 497 'id' => $method->id, 498 'label' => $method->get_label(), 499 'amount' => number_format($method->cost, 2, '.', ''), 622 'id' => $method->id, // e.g., "flat_rate:5" 623 'label' => $method->get_label(), // e.g., "Flat Rate" 624 'amount' => number_format($shipping_cost, 2, '.', ''), // Shipping-only cost 625 626 // Optional shipping tax breakdown 627 'taxLineItems' => array( 628 array( 629 'id' => 'taxItem1', 630 'label' => 'Taxes', 631 'amount' => number_format($shipping_tax, 2, '.', ''), 632 ), 633 ), 634 // The full cart total IF this method is chosen 635 'total' => array( 636 'label' => 'Total', 637 'amount' => number_format($cart_total_for_method, 2, '.', ''), 638 ), 500 639 ); 501 640 } 502 641 } 503 642 504 // sort the shippingOptions so that the default/chosen shipping method is the first option so that it's displayed first in the Apple Pay/Google Pay window 505 if (isset($payment_request['shippingOptions'][0])) { 506 if (isset($chosen_methods[0])) { 507 $chosen_method_id = $chosen_methods[0]; 508 $compare_shipping_options = function ($a, $b) use ($chosen_method_id) { 509 if ($a['id'] === $chosen_method_id) { 510 return -1; 511 } 512 513 if ($b['id'] === $chosen_method_id) { 514 return 1; 515 } 516 517 return 0; 518 }; 519 520 usort($payment_request['shippingOptions'], $compare_shipping_options); 521 } 522 523 $first_shipping_method_id = $payment_request['shippingOptions'][0]['id']; 524 $this->update_shipping_method(array($first_shipping_method_id)); 525 } 526 } elseif (! empty($_POST['shipping_option'])) { 527 $chosen_methods = array(wc_clean(wp_unslash($_POST['shipping_option']))); 528 $this->update_shipping_method($chosen_methods); 529 } 530 } 531 532 if (!$is_pay_for_order_page) { 643 // Restore the user's original shipping choice & totals 644 WC()->session->set('chosen_shipping_methods', $original_chosen_methods); 645 WC()->cart->calculate_totals(); 646 647 // Reorder so the currently chosen method is first 648 $chosen_method_id = ! empty($original_chosen_methods[0]) ? $original_chosen_methods[0] : ''; 649 if ($chosen_method_id) { 650 usort($payment_request['shippingOptions'], function ($a, $b) use ($chosen_method_id) { 651 if ($a['id'] === $chosen_method_id) { 652 return -1; 653 } 654 if ($b['id'] === $chosen_method_id) { 655 return 1; 656 } 657 return 0; 658 }); 659 } 660 661 // The first shipping option is now the chosen method, store that in session again. 662 if (! empty($payment_request['shippingOptions'])) { 663 $first_id = $payment_request['shippingOptions'][0]['id']; 664 $this->update_shipping_method(array($first_id)); 665 WC()->cart->calculate_totals(); 666 } 667 668 error_log('WooSquare: Final shippingOptions: ' . print_r($payment_request['shippingOptions'], true)); 669 } else { 670 error_log('WooSquare: $packages array is empty - no shipping packages found.'); 671 } 672 } else { 673 // Cart doesn't need shipping or not pay-for-order page => no shippingOptions 674 error_log('WooSquare: Cart does not need shipping or is not pay_for_order_page. shippingOptions = []'); 675 $payment_request['shippingOptions'] = array(); 676 } 677 678 // 4) Recalculate totals if not pay_for_order_page. 679 if (! $is_pay_for_order_page) { 533 680 WC()->cart->calculate_totals(); 534 681 } 535 682 683 // 5) Build lineItems 684 $order_data = array(); 536 685 if ($is_pay_for_order_page) { 537 $order = wc_get_order($order_id);686 $order = wc_get_order($order_id); 538 687 $order_data = array( 539 688 'subtotal' => $order->get_subtotal(), … … 547 696 $payment_request['lineItems'] = $this->build_payment_request_line_items($order_data); 548 697 549 698 // 6) Build total — i.e., the final cart total with the user’s *actual* chosen shipping method. 550 699 if ($is_pay_for_order_page) { 551 $total_amount = $order->get_total();700 $total_amount = (float) wc_get_order($order_id)->get_total(); 552 701 } else { 553 $total_amount = WC()->cart->total;702 $total_amount = (float) WC()->cart->total; // or get_totals()['total'] 554 703 } 555 704 556 705 $payment_request['total'] = array( 557 'label' => get_bloginfo('name', 'display') . esc_html($this->total_label_suffix),558 'amount' => number_format($total_amount, 2, '.', ''),706 'label' => get_bloginfo('name', 'display') . esc_html($this->total_label_suffix), 707 'amount' => number_format($total_amount, 2, '.', ''), 559 708 'pending' => false, 560 709 ); … … 562 711 wp_send_json_success($payment_request); 563 712 } 713 714 715 564 716 565 717 /** … … 935 1087 936 1088 /** 937 * Build a payment request object to be sent to Payments.1089 * Build the PaymentRequest object that includes shipping, line items, and the grand total. 938 1090 * 939 * Documentation: https://developer.squareup.com/docs/api/paymentform#paymentform-paymentrequestobjects 940 * 941 * @since 2.3 942 * @param string $amount - format '100.00' 943 * @param array $data 1091 * @param array $data Additional data controlling how the request is built. 944 1092 * @return array 945 1093 * @throws \Exception 946 1094 */ 947 public function build_payment_request($amount, $data = array()) 948 { 949 // 1) Ensure we have a cart, unless you specifically allow building requests without a cart 950 if (!WC()->cart) { 1095 public function build_payment_request($data = []) 1096 { 1097 if (! WC()->cart) { 951 1098 throw new \Exception('Cart not available.'); 952 1099 } 953 1100 954 // 2) Figure out if we're on the "pay for order" page 955 $is_pay_for_order_page = isset($data['is_pay_for_order_page']) ? $data['is_pay_for_order_page'] : false; 956 $order_id = isset($data['order_id']) ? $data['order_id'] : 0; 957 958 // 3) Decide if we should request a shipping contact 959 if ($is_pay_for_order_page) { 960 $request_shipping_contact = false; // Typically no shipping info on pay-for-order pages 961 } else { 962 $request_shipping_contact = isset(WC()->cart) && WC()->cart->needs_shipping(); 963 } 964 965 // 4) Parse the store's default country code (e.g. "US" even if the user has "US:CA") 966 // Fallback to 'US' if empty or invalid 967 $default_country = get_option('woocommerce_default_country'); 968 if (empty($default_country)) { 969 $default_country = 'US'; // fallback 970 } 971 // If stored as 'US:CA', split on ':' to get just 'US' 972 $country_bits = explode(':', $default_country); 973 $country_only = strtoupper($country_bits[0]); 974 975 // 5) Merge $data with sensible defaults, including valid countryCode/currencyCode 1101 $is_pay_for_order_page = ! empty($data['is_pay_for_order_page']) ? $data['is_pay_for_order_page'] : false; 1102 $order_id = ! empty($data['order_id']) ? $data['order_id'] : 0; 1103 1104 // Check if shipping is needed. 1105 $request_shipping_address = false; 1106 if (! $is_pay_for_order_page) { 1107 $request_shipping_address = WC()->cart->needs_shipping(); 1108 } 1109 1110 // Base country & currency 1111 $default_country = get_option('woocommerce_default_country', 'AU'); 1112 $country_bits = explode(':', $default_country); 1113 $country_only = strtoupper($country_bits[0]); 1114 $currency_code = get_woocommerce_currency() ?: 'AUD'; 1115 1116 // Merge defaults. 976 1117 $data = wp_parse_args( 977 1118 $data, 978 array( 979 'requestShippingContact' => $request_shipping_contact, 1119 [ 1120 // For Afterpay, Apple Pay, Google Pay, etc. 1121 'requestShippingAddress' => $request_shipping_address, 1122 'requestShippingContact' => $request_shipping_address, 980 1123 'requestEmailAddress' => true, 981 1124 'requestBillingContact' => true, 982 'countryCode' => $country_only, // e.g. 'US'983 'currencyCode' => get_woocommerce_currency() ?: 'USD',984 )1125 'countryCode' => $country_only, 1126 'currencyCode' => $currency_code, 1127 ] 985 1128 ); 986 1129 987 // 6) If we're on a pay-for-order page, gather the order's totals 988 $order_data = array(); 989 if ($is_pay_for_order_page) { 990 $order = wc_get_order($order_id); 991 $order_data = array( 992 'subtotal' => $order->get_subtotal(), 993 'discount' => $order->get_discount_total(), 994 'shipping' => $order->get_shipping_total(), 995 'fees' => $order->get_total_fees(), 996 'taxes' => $order->get_total_tax(), 997 ); 998 999 // Remove these keys from $data since we won't pass them back down 1000 unset($data['is_pay_for_order_page'], $data['order_id']); 1001 } 1002 1003 // 7) If we need shipping options, retrieve them 1004 if (true === $data['requestShippingContact']) { 1005 $chosen_shipping_methods = WC()->session->get('chosen_shipping_methods'); 1006 $shipping_packages = WC()->shipping()->get_packages(); 1007 1008 $shippingOptions = array(); 1009 1010 if (!empty($shipping_packages)) { 1011 foreach ($shipping_packages[0]['rates'] as $method) { 1012 $shippingOptions[] = array( 1013 'id' => $method->id, 1130 // If shipping is needed, build out shipping options, each with: 1131 // - 'amount' => Just the shipping cost 1132 // - 'total.amount' => The entire cart total if that shipping method is selected 1133 if ($data['requestShippingAddress']) { 1134 $shipping_options = []; 1135 1136 // Store original shipping method selection & totals so we can restore it 1137 $original_chosen_methods = WC()->session->get('chosen_shipping_methods'); 1138 $original_cart_totals = WC()->cart->get_totals(); 1139 1140 $packages = WC()->shipping->get_packages(); 1141 1142 if (! empty($packages[0]['rates'])) { 1143 foreach ($packages[0]['rates'] as $method) { 1144 // Shipping cost & taxes for this method 1145 $shipping_cost = (float) $method->cost; 1146 $shipping_tax = ! empty($method->taxes) ? array_sum($method->taxes) : 0; 1147 1148 // Temporarily set this shipping method, then force WooCommerce 1149 // to recalc totals so we know the entire cart total with this method. 1150 WC()->session->set('chosen_shipping_methods', [$method->id]); 1151 WC()->cart->calculate_totals(); 1152 1153 // Grab the newly computed total 1154 $recalc_totals = WC()->cart->get_totals(); 1155 $cart_total_for_method = isset($recalc_totals['total']) ? (float) $recalc_totals['total'] : 0.0; 1156 1157 // Build the shipping option array 1158 $shipping_options[] = [ 1159 'id' => $method->id, // e.g. "flat_rate:1" 1014 1160 'label' => $method->get_label(), 1015 'amount' => number_format($method->cost, 2, '.', ''), 1016 ); 1017 } 1018 } 1019 1020 // Sort so that the chosen shipping method is on top 1021 if (!empty($chosen_shipping_methods[0])) { 1022 usort($shippingOptions, function ($a, $b) use ($chosen_shipping_methods) { 1023 return ($a['id'] === $chosen_shipping_methods[0]) ? -1 : 1; 1161 'amount' => number_format($shipping_cost, 2, '.', ''), // shipping-only cost 1162 1163 // Optionally show shipping tax: 1164 'taxLineItems' => [ 1165 [ 1166 'id' => 'taxItem1', 1167 'label' => 'Taxes', 1168 'amount' => number_format($shipping_tax, 2, '.', ''), 1169 ], 1170 ], 1171 // Show the total cart price if this shipping method is selected 1172 'total' => [ 1173 'label' => 'Total', 1174 'amount' => number_format($cart_total_for_method, 2, '.', ''), 1175 ], 1176 ]; 1177 } 1178 } 1179 1180 // Restore the original shipping method & recalc 1181 WC()->session->set('chosen_shipping_methods', $original_chosen_methods); 1182 WC()->cart->calculate_totals(); 1183 1184 // Sort chosen shipping method to the top if you wish 1185 if (! empty($original_chosen_methods[0])) { 1186 usort($shipping_options, function ($a, $b) use ($original_chosen_methods) { 1187 return ($a['id'] === $original_chosen_methods[0]) ? -1 : 1; 1024 1188 }); 1025 1189 } 1026 1190 1027 $data['shippingOptions'] = $shippingOptions; 1028 } 1029 1030 // 8) Always build a valid 'total' object, even if $amount is 0.00 1031 $data['total'] = array( 1032 'label' => get_bloginfo('name', 'display') . esc_html($this->total_label_suffix), 1033 'amount' => number_format($amount, 2, '.', ''), 1191 $data['shippingOptions'] = $shipping_options; 1192 } 1193 1194 // Now that we've restored the original method, get the final cart total 1195 // which includes items, shipping, taxes, fees, discounts, etc. 1196 $restored_totals = WC()->cart->get_totals(); 1197 $final_cart_total = isset($restored_totals['total']) ? (float) $restored_totals['total'] : 0.0; 1198 1199 // Build the top-level PaymentRequest total 1200 $data['total'] = [ 1201 // E.g. "Your Site — Total" 1202 'label' => get_bloginfo('name', 'display') . $this->total_label_suffix, 1203 'amount' => number_format($final_cart_total, 2, '.', ''), 1034 1204 'pending' => false, 1035 ); 1036 1037 // 9) Build line items from either the cart or the order 1038 // (We only do so if it's not "My Account" context, or you can skip them if total=0) 1039 $data['lineItems'] = $this->build_payment_request_line_items($order_data); 1040 1041 // If it's the "account" context for adding a payment method, skip extras 1042 if (isset($data['context']) && $data['context'] === 'account') { 1043 $data['requestShippingContact'] = false; 1044 $data['shippingOptions'] = array(); 1045 $data['lineItems'] = array(); // Not needed when simply adding a payment method 1046 } 1047 1205 ]; 1206 1207 // Optionally, build line items from cart or order details 1208 $data['lineItems'] = $this->build_payment_request_line_items(); 1048 1209 1049 1210 return $data; … … 1241 1402 ?> 1242 1403 <form id="payment-form"> 1404 1243 1405 <div class="wallets-container" style="display: flex; column-gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap;"> 1406 <div id="afterpay-button"></div> 1244 1407 <div id="google-pay-button"></div> 1245 1408 <div id="apple-pay-button" class="apple-pay-button squaresync-wallet-buttons" role="button" style="height: 40px; width: 240px; display: none;"> … … 1269 1432 $user_id = $order->get_user_id(); 1270 1433 1271 // Retrieve the token ID from POST1434 // 2) Payment token from POST if using a saved card or new token 1272 1435 $token_id = isset($_POST['wc-' . $this->id . '-payment-token']) 1273 ? wc_clean($_POST['wc-' . $this->id . '-payment-token']) 1274 : ''; 1436 ? wc_clean($_POST['wc-' . $this->id . '-payment-token']) 1437 : ''; 1438 1275 1439 1276 1440 /** 1277 * ------------------------------------------------1278 * FORCE TOKENIZATION IF ORDER CONTAINS SUBSCRIPTION1279 * ------------------------------------------------1280 */1281 if (1282 class_exists('WC_Subscriptions')1283 && wcs_order_contains_subscription($order) // If the order has a subscription1441 * ------------------------------------------------ 1442 * FORCE TOKENIZATION IF ORDER CONTAINS SUBSCRIPTION 1443 * ------------------------------------------------ 1444 */ 1445 if ( 1446 class_exists('WC_Subscriptions') 1447 && wcs_order_contains_subscription($order) // If the order has a subscription 1284 1448 ) { 1285 // If they're NOT using an existing saved token (i.e. $token_id = '' or 'new'), 1286 // force "save payment method" so that a new token is created. 1287 if (empty($token_id) || 'new' === $token_id) { 1288 // This ensures the code path for "save new card" is triggered further down 1289 $_POST['wc-' . $this->id . '-new-payment-method'] = 'true'; 1290 $_POST['wc-squaresync_credit-new-payment-method'] = '1'; 1291 } 1292 } 1293 1294 1295 // Handle multiple data formats by checking for specific tokens in the POST data 1449 // If they're NOT using an existing saved token (i.e. $token_id = '' or 'new'), 1450 // force "save payment method" so that a new token is created. 1451 if (empty($token_id) || 'new' === $token_id) { 1452 $_POST['wc-' . $this->id . '-new-payment-method'] = 'true'; 1453 $_POST['wc-squaresync_credit-new-payment-method'] = '1'; 1454 } 1455 } 1456 1457 // Gather potential tokens from POST 1296 1458 $square_verification_token = sanitize_text_field( 1297 1459 $_POST['square_verification_token'] … … 1303 1465 ); 1304 1466 1305 1306 1467 // We'll keep a reference to the WC_Payment_Token_CC object if it exists 1307 1468 $payment_token = null; 1308 1469 $square_token = ''; 1309 1470 1310 // Determine if the order total is greater than01471 // 3) Determine if order total is > 0 1311 1472 $total_amount = intval(round($order->get_total() * $multiplier)); 1312 1473 $currency = $order->get_currency(); … … 1314 1475 // If user chose an existing saved token, load it 1315 1476 if ($token_id && $token_id !== 'new') { 1316 // Use the saved token1317 1477 $payment_token = \WC_Payment_Tokens::get($token_id); 1318 1478 1319 1479 if (!$payment_token || $payment_token->get_user_id() !== get_current_user_id()) { 1320 wc_add_notice(__('Invalid payment method. Please try again.', 'squarewoosync -pro'), 'error');1480 wc_add_notice(__('Invalid payment method. Please try again.', 'squarewoosync'), 'error'); 1321 1481 return; 1322 1482 } 1323 1324 1483 // The actual Square card ID (e.g. ccof:xxxx) 1325 1484 $square_token = $payment_token->get_token(); 1326 1485 } else { 1327 // Process a new payment method with square_payment_token1486 // New payment method with square_payment_token 1328 1487 $square_token = $square_payment_token; 1329 1330 if (empty($square_token)) {1488 if (empty($square_token) && $total_amount > 0) { 1489 // If we have a total > 0 but no token, that's an error 1331 1490 return $this->handle_error($order_id, 'Payment token is missing.'); 1332 1491 } 1333 1492 } 1334 1493 1335 // Retrieve or create the Square customer ID, log warning if missing but continue1494 // 4) Retrieve or create the Square customer ID 1336 1495 $square_customer_id = $ordersController->getOrCreateSquareCustomer($order, $squareHelper); 1337 1496 if (!$square_customer_id) { 1338 1497 error_log("Warning: Square customer ID not available for Order ID: $order_id."); 1339 1498 } 1340 1341 1499 if ($user_id) { 1342 1500 update_user_meta($user_id, 'square_customer_id', $square_customer_id); 1343 1501 } 1344 1502 1345 // Create a Square order for record-keeping or loyalty, but handle gracefully1503 // 5) Create a Square order for record-keeping or loyalty 1346 1504 $square_order_response = $this->attempt_create_square_order( 1347 1505 $ordersController, … … 1351 1509 $order_id 1352 1510 ); 1353 1354 1511 if (!$square_order_response) { 1355 1512 error_log("Warning: Square order could not be created for Order ID: $order_id."); 1356 1513 } 1357 1514 1358 1359 // If we have a valid Square order ID, fetch the updated Square order 1360 $updated_square_order_response = null; 1361 if (isset($square_order_response['data']['order']['id'])) { 1362 $updated_square_order_response = $squareHelper->square_api_request( 1363 '/orders/' . $square_order_response['data']['order']['id'] 1364 ); 1365 } else { 1366 $updated_square_order_response = $square_order_response; 1367 } 1368 1369 $square_order_net_amount_due = isset($updated_square_order_response['data']['order']['net_amount_due_money']['amount']) 1370 ? intval($updated_square_order_response['data']['order']['net_amount_due_money']['amount']) 1515 // Possibly do rounding adjustment 1516 $square_order_net_amount_due = isset($square_order_response['data']['order']['net_amount_due_money']['amount']) 1517 ? intval($square_order_response['data']['order']['net_amount_due_money']['amount']) 1371 1518 : 0; 1372 1519 1373 // Rounding adjustment if net_amount_due != total_amount1374 1520 if ($square_order_net_amount_due !== $total_amount) { 1375 1521 $rounding_adjustment = $square_order_net_amount_due - $total_amount; 1376 $multiplier = $ordersController->get_currency_multiplier();1377 1378 1522 $service_charge = [ 1379 1523 'name' => 'Rounding Adjustment', … … 1383 1527 'currency' => $currency, 1384 1528 ], 1385 'taxable' => false,1386 'scope' => 'ORDER',1529 'taxable' => false, 1530 'scope' => 'ORDER', 1387 1531 ]; 1532 1533 $settings = get_option('square-woo-sync_settings', []); 1534 $locationId = $settings['location']; 1388 1535 1389 1536 if (isset($square_order_response['data']['order']['id'])) { … … 1395 1542 'order' => [ 1396 1543 'service_charges' => [$service_charge], 1397 'location_id' => $ settings['location'],1544 'location_id' => $locationId, 1398 1545 'version' => $square_order_response['data']['order']['version'], 1399 1546 ], … … 1403 1550 } 1404 1551 1405 /** 1406 * ------------------------------------------------ 1407 * HANDLE ZERO-TOTAL vs NON-ZERO TOTAL 1408 * ------------------------------------------------ 1409 */ 1410 if ($total_amount > 0) { 1411 // Non-zero total: proceed with Square charge 1412 1413 // Prepare payment data 1414 $payment_data = $this->prepare_payment_data( 1415 $square_token, 1416 $order_id, 1417 $total_amount, 1418 $currency, 1419 $square_customer_id, 1420 $settings['location'], 1421 $square_order_response 1422 ); 1423 1424 if (!empty($square_verification_token)) { 1425 $payment_data['verification_token'] = $square_verification_token; 1426 } 1427 1428 // Process the payment with Square 1429 $payment_response = $squareHelper->square_api_request("/payments", 'POST', $payment_data, null, false); 1430 if (!$this->validate_payment_response($payment_response, $order_id)) { 1431 // If payment failed, handle error 1432 $error_message = 'Square payment failed.'; 1433 if (isset($payment_response['error'])) { 1434 $error_message = $payment_response['error']; 1552 $settings = get_option('square-woo-sync_settings', []); 1553 $locationId = $settings['location']; 1554 1555 1556 // SCENARIOS: 1557 // If Gift Card is not set, fallback to your old single payment 1558 1559 // Prepare single payment data 1560 $payment_data = $this->prepare_payment_data( 1561 $square_token, 1562 $order_id, 1563 $total_amount, 1564 $currency, 1565 $square_customer_id, 1566 $locationId, 1567 $square_order_response 1568 ); 1569 1570 if (!empty($square_verification_token)) { 1571 $payment_data['verification_token'] = $square_verification_token; 1572 } 1573 1574 // Charge 1575 $payment_response = $squareHelper->square_api_request("/payments", 'POST', $payment_data, null, false); 1576 if (!$this->validate_payment_response($payment_response, $order_id)) { 1577 // if fail => restore loyalty, handle error 1578 $error_message = 'Square payment failed.'; 1579 if (isset($payment_response['error'])) { 1580 $error_message = $payment_response['error']; 1581 } 1582 return $this->handle_error($order_id, $error_message); 1583 } 1584 1585 // success => finalize 1586 $payment_id = $payment_response['data']['payment']['id']; 1587 // Save new card if requested 1588 if ( 1589 (isset($_POST['wc-' . $this->id . '-new-payment-method']) && 'true' === $_POST['wc-' . $this->id . '-new-payment-method']) 1590 || (isset($_POST['wc-squaresync_credit-new-payment-method']) && '1' === $_POST['wc-squaresync_credit-new-payment-method']) 1591 ) { 1592 if (empty($token_id) || $token_id === 'new') { 1593 $card_response = $this->save_card_on_square($payment_id, $square_customer_id); 1594 if (!$card_response['success']) { 1595 wc_add_notice(__('There was a problem saving your payment method.', 'squarewoosync'), 'error'); 1596 } else { 1597 $card_data = $card_response['data']['card']; 1598 $payment_token = new \WC_Payment_Token_CC(); 1599 $payment_token->set_token($card_data['id']); 1600 $payment_token->set_gateway_id($this->id); 1601 $payment_token->set_card_type(strtolower($card_data['card_brand'])); 1602 $payment_token->set_last4($card_data['last_4']); 1603 $payment_token->set_expiry_month($card_data['exp_month']); 1604 $payment_token->set_expiry_year($card_data['exp_year']); 1605 $payment_token->set_user_id(get_current_user_id()); 1606 $payment_token->save(); 1607 // attach to order 1608 $order->add_payment_token($payment_token->get_id()); 1435 1609 } 1436 1437 1438 return $this->handle_error($order_id, $error_message); 1439 } 1440 1441 // Payment success 1442 $payment_id = $payment_response['data']['payment']['id']; 1443 1444 // If user wants to save a NEW payment method 1445 if ( 1446 (isset($_POST['wc-' . $this->id . '-new-payment-method']) && 'true' === $_POST['wc-' . $this->id . '-new-payment-method']) 1447 || (isset($_POST['wc-squaresync_credit-new-payment-method']) && '1' === $_POST['wc-squaresync_credit-new-payment-method']) 1448 ) { 1449 // Only if user didn't choose an existing token 1450 if (empty($token_id) || $token_id === 'new') { 1451 // Use the payment ID to save the card in Square 1452 $card_response = $this->save_card_on_square($payment_id, $square_customer_id); 1453 if (!$card_response['success']) { 1454 wc_add_notice(__('There was a problem saving your payment method.', 'squarewoosync-pro'), 'error'); 1455 } else { 1456 // Create a new payment token in WooCommerce 1457 $card_data = $card_response['data']['card']; 1458 1459 $payment_token = new \WC_Payment_Token_CC(); 1460 $payment_token->set_token($card_data['id']); // The card ID from Square 1461 $payment_token->set_gateway_id($this->id); 1462 $payment_token->set_card_type(strtolower($card_data['card_brand'])); 1463 $payment_token->set_last4($card_data['last_4']); 1464 $payment_token->set_expiry_month($card_data['exp_month']); 1465 $payment_token->set_expiry_year($card_data['exp_year']); 1466 $payment_token->set_user_id(get_current_user_id()); 1467 $payment_token->save(); 1468 1469 // Link this token to the order 1470 $order->add_payment_token($payment_token->get_id()); 1471 } 1472 } 1473 } 1474 1475 // Finalize the payment and update order status 1476 $this->finalize_order_payment($order, $payment_response, $square_order_response, $total_amount); 1477 } else { 1478 // total_amount == 0 : Skip Square charge, but still "complete" the payment 1479 // If user wants to save a card, we do so via the "square_payment_token" nonce (not an actual payment ID) 1480 1481 1482 // If the user wants to save a new payment method 1483 if ( 1484 (isset($_POST['wc-' . $this->id . '-new-payment-method']) && 'true' === $_POST['wc-' . $this->id . '-new-payment-method']) 1485 || (isset($_POST['wc-squaresync_credit-new-payment-method']) && '1' === $_POST['wc-squaresync_credit-new-payment-method']) 1486 ) { 1487 1488 if (empty($token_id) || $token_id === 'new') { 1489 $card_response = $this->save_card_on_square($square_token, $square_customer_id); 1490 if (!$card_response['success']) { 1491 wc_add_notice( 1492 __('There was a problem saving your payment method (0 total).', 'squarewoosync-pro'), 1493 'error' 1494 ); 1495 } else { 1496 $card_data = $card_response['data']['card']; 1497 1498 // Create a new payment token in WooCommerce 1499 $payment_token = new \WC_Payment_Token_CC(); 1500 $payment_token->set_token($card_data['id']); // The card ID from Square 1501 $payment_token->set_gateway_id($this->id); 1502 $payment_token->set_card_type(strtolower($card_data['card_brand'])); 1503 $payment_token->set_last4($card_data['last_4']); 1504 $payment_token->set_expiry_month($card_data['exp_month']); 1505 $payment_token->set_expiry_year($card_data['exp_year']); 1506 $payment_token->set_user_id(get_current_user_id()); 1507 $payment_token->save(); 1508 1509 // Optionally link this token to the order 1510 $order->add_payment_token($payment_token->get_id()); 1511 } 1512 } 1513 } 1514 1515 // Mark the order as paid because total is 0 1516 $order->payment_complete(); 1517 $order->add_order_note( 1518 __('Order total was $0; no Square charge needed. Payment method saved if requested.', 'squarewoosync-pro') 1519 ); 1520 } 1610 } 1611 } 1612 1613 // finalize 1614 $this->finalize_order_payment($order, $payment_response, $square_order_response, $total_amount); 1615 1521 1616 1522 1617 // Handle subscriptions (attach token if available) … … 1541 1636 WC()->cart->empty_cart(); 1542 1637 1543 1544 1638 return ['result' => 'success', 'redirect' => $this->get_return_url($order)]; 1545 1639 } catch (\Exception $e) { 1640 1546 1641 return $this->handle_exception($order_id, $e); 1547 1642 } 1548 1643 } 1549 1644 1645 1646 1647 private function check_net_amount_due($square_order_response, $total_amount, $currency, $order_id) 1648 { 1649 $net_amount_due = $square_order_response['data']['order']['net_amount_due_money']['amount'] ?? 0; 1650 $net_currency = $square_order_response['data']['order']['net_amount_due_money']['currency'] ?? ''; 1651 1652 if ($net_amount_due != $total_amount || $net_currency != $currency) { 1653 error_log("Warning: Net amount due ($net_amount_due $net_currency) does not match the expected amount ($total_amount $currency) for Order ID: $order_id."); 1654 } 1655 } 1550 1656 1551 1657 // Error handling function … … 1554 1660 // Recalculate the cart totals 1555 1661 WC()->cart->calculate_totals(); 1556 wc_add_notice(__('Payment error: ', 'squarewoosync-pro') . $message, 'error'); 1557 error_log("Order ID $order_id: $message"); 1662 wc_add_notice(__('Payment error: ', 'squarewoosync') . $message, 'error'); 1558 1663 return ['result' => 'failure', 'redirect' => wc_get_checkout_url()]; 1559 1664 } … … 1626 1731 if (isset($square_order_response['data']['order']['id'])) { 1627 1732 $order->update_meta_data('square_order_id', $square_order_response['data']['order']['id']); 1733 1734 do_action( 1735 'squarewoosync_square_order_created', 1736 $square_order_response['data']['order']['id'], 1737 $order->get_id() 1738 ); 1628 1739 } 1629 1740 $order->payment_complete($payment_response['data']['payment']['id']); 1630 1741 $order->add_order_note(sprintf( 1631 __('Payment of %1$s via Square successfully completed (Square Transaction ID: %2$s)', 'squarewoosync -pro'),1742 __('Payment of %1$s via Square successfully completed (Square Transaction ID: %2$s)', 'squarewoosync'), 1632 1743 wc_price($total_amount / $multiplier), 1633 1744 $payment_response['data']['payment']['id'] … … 1638 1749 private function handle_exception($order_id, $exception) 1639 1750 { 1640 wc_add_notice(__('Payment error: An unexpected error occurred. Please try again.', 'squarewoosync -pro'), 'error');1751 wc_add_notice(__('Payment error: An unexpected error occurred. Please try again.', 'squarewoosync'), 'error'); 1641 1752 error_log("Payment processing exception for Order ID: $order_id - " . $exception->getMessage()); 1642 1753 return ['result' => 'failure', 'redirect' => wc_get_checkout_url()]; … … 1650 1761 // Verify nonce for security 1651 1762 if (!isset($_POST['nonce_sec']) || !wp_verify_nonce($_POST['nonce_sec'], 'sws_add_payment_method')) { 1652 wc_add_notice(__('Nonce verification failed', 'squarewoosync -pro'), 'error');1763 wc_add_notice(__('Nonce verification failed', 'squarewoosync'), 'error'); 1653 1764 wp_redirect(wc_get_account_endpoint_url('payment-methods')); 1654 1765 exit; … … 1658 1769 1659 1770 if (empty($token)) { 1660 wc_add_notice(__('Payment token is missing.', 'squarewoosync -pro'), 'error');1771 wc_add_notice(__('Payment token is missing.', 'squarewoosync'), 'error'); 1661 1772 wp_redirect(wc_get_account_endpoint_url('payment-methods')); 1662 1773 exit; … … 1670 1781 1671 1782 if (!$square_customer_id) { 1672 wc_add_notice(__('Could not retrieve or create Square customer.', 'squarewoosync -pro'), 'error');1783 wc_add_notice(__('Could not retrieve or create Square customer.', 'squarewoosync'), 'error'); 1673 1784 wp_redirect(wc_get_account_endpoint_url('payment-methods')); 1674 1785 exit; … … 1679 1790 1680 1791 if (!$card_response['success']) { 1681 wc_add_notice(__('There was a problem adding your payment method: Invalid card data.', 'squarewoosync -pro'), 'error');1792 wc_add_notice(__('There was a problem adding your payment method: Invalid card data.', 'squarewoosync'), 'error'); 1682 1793 wp_redirect(wc_get_account_endpoint_url('payment-methods')); 1683 1794 exit; … … 1699 1810 if ($payment_token->get_id()) { 1700 1811 // Success 1701 wc_add_notice(__('Payment method added successfully.', 'squarewoosync -pro'), 'success');1812 wc_add_notice(__('Payment method added successfully.', 'squarewoosync'), 'success'); 1702 1813 } else { 1703 wc_add_notice(__('There was a problem saving your payment method.', 'squarewoosync -pro'), 'error');1814 wc_add_notice(__('There was a problem saving your payment method.', 'squarewoosync'), 'error'); 1704 1815 } 1705 1816 … … 1808 1919 } 1809 1920 1921 1922 // public function process_refund($order_id, $amount = null, $reason = '') 1923 // { 1924 // if (!$amount || $amount <= 0) { 1925 // return new WP_Error('invalid_amount', __('Refund amount must be greater than zero.', 'woocommerce')); 1926 // } 1927 1928 // $order = wc_get_order($order_id); 1929 // $token = $this->square_access_token; 1930 // $squareHelper = new SquareHelper(); 1931 1932 // $orderMeta = json_decode(get_post_meta($order_id, '_order_success_object', true), true)['order']; 1933 // $payment_methods = $orderMeta['tenders']; 1934 1935 // $payment_id = null; 1936 // foreach ($payment_methods as $method) { 1937 // if ($method['type'] !== 'SQUARE_GIFT_CARD') { 1938 // $payment_id = $method['id']; 1939 // break; 1940 // } 1941 // } 1942 1943 // if (!$payment_id) { 1944 // return new WP_Error('refund_failed', __('Refund failed: Payment method not found.', 'woocommerce')); 1945 // } 1946 1947 // $refund_data = [ 1948 // "idempotency_key" => wp_generate_uuid4(), 1949 // "payment_id" => $payment_id, 1950 // "amount_money" => ['amount' => $amount * 100, 'currency' => $order->get_currency()], 1951 // "reason" => $reason, 1952 // ]; 1953 1954 // $response = $squareHelper->CurlApi($refund_data, $this->square_url . "/refunds", 'POST', $token); 1955 // if (is_wp_error($response)) { 1956 // return $response; 1957 // } 1958 1959 // $refundResp = json_decode($response[1]); 1960 // if (isset($refundResp->refund->status) && in_array($refundResp->refund->status, ['PENDING', 'COMPLETED'])) { 1961 // $order->add_order_note(sprintf(__('Refunded %1$s - Reason: %2$s', 'woocommerce'), wc_price($amount), $reason)); 1962 // return true; 1963 // } 1964 1965 // return new WP_Error('refund_failed', __('Refund failed: Could not complete the refund process.', 'woocommerce')); 1966 // } 1810 1967 } -
squarewoosync/trunk/languages/square-woo-sync.pot
r3225869 r3292205 2 2 msgid "" 3 3 msgstr "" 4 "Project-Id-Version: Square Sync for Woocommerce 5. 1.1\n"4 "Project-Id-Version: Square Sync for Woocommerce 5.2.0\n" 5 5 "Report-Msgid-Bugs-To: https://github.com/LiamHillier/square-woo-sync/issues\n" 6 6 "Last-Translator: [email protected]\n" … … 9 9 "Content-Type: text/plain; charset=UTF-8\n" 10 10 "Content-Transfer-Encoding: 8bit\n" 11 "POT-Creation-Date: 2025-0 1-21T12:49:08+11:00\n"11 "POT-Creation-Date: 2025-05-13T13:14:03+10:00\n" 12 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 13 "X-Generator: WP-CLI 2.10.0\n" … … 36 36 37 37 #: includes/Abstracts/RESTController.php:35 38 #: includes/Payments/WC_SquareSync_Gateway.php:1763 38 39 msgid "Nonce verification failed" 39 40 msgstr "" … … 68 69 msgstr "" 69 70 71 #: includes/Payments/WC_SquareSync_Gateway.php:210 72 msgid "Subscription renewal of %1$s via Square succeeded. Transaction ID: %2$s" 73 msgstr "" 74 75 #: includes/Payments/WC_SquareSync_Gateway.php:217 76 msgid "Square renewal failed: %s" 77 msgstr "" 78 79 #: includes/Payments/WC_SquareSync_Gateway.php:1480 80 msgid "Invalid payment method. Please try again." 81 msgstr "" 82 83 #: includes/Payments/WC_SquareSync_Gateway.php:1595 84 #: includes/Payments/WC_SquareSync_Gateway.php:1814 85 msgid "There was a problem saving your payment method." 86 msgstr "" 87 88 #: includes/Payments/WC_SquareSync_Gateway.php:1662 89 msgid "Payment error: " 90 msgstr "" 91 92 #: includes/Payments/WC_SquareSync_Gateway.php:1742 93 msgid "Payment of %1$s via Square successfully completed (Square Transaction ID: %2$s)" 94 msgstr "" 95 96 #: includes/Payments/WC_SquareSync_Gateway.php:1751 97 msgid "Payment error: An unexpected error occurred. Please try again." 98 msgstr "" 99 100 #: includes/Payments/WC_SquareSync_Gateway.php:1771 101 msgid "Payment token is missing." 102 msgstr "" 103 104 #: includes/Payments/WC_SquareSync_Gateway.php:1783 105 msgid "Could not retrieve or create Square customer." 106 msgstr "" 107 108 #: includes/Payments/WC_SquareSync_Gateway.php:1792 109 msgid "There was a problem adding your payment method: Invalid card data." 110 msgstr "" 111 112 #: includes/Payments/WC_SquareSync_Gateway.php:1812 113 msgid "Payment method added successfully." 114 msgstr "" 115 70 116 #: includes/REST/LogController.php:89 71 117 msgid "Unable to retrieve logs" -
squarewoosync/trunk/readme.txt
r3237580 r3292205 6 6 Tested up to: 6.7 7 7 Requires PHP: 7.4 8 Stable tag: 5. 1.18 Stable tag: 5.2.0 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 14 14 == Description == 15 15 SquareSync for WooCommerce makes your WooCommerce Square integration effortless. Connect WooCommerce directly with Square to automatically sync products, inventory, orders, and customer data. No more manual updates or inventory mismatches. Offer versatile payment options like Google Pay, Apple Pay, Afterpay, and standard credit cards, and keep your store running smoothly with real-time syncing available in the Pro version. 16 17 ### :18 https://www.youtube.com/watch?v=bg0l32Zeuts19 16 20 17 … … 42 39 43 40 - **Real-Time Sync:** Get instant updates for orders, inventory, pricing, customers and all product data. 44 - **Redeem Gift cards:** Allow customers to redeem their in-store bought gift cards.45 - **Purcahse gift cards:** Allow customers buy gift cards with varying amounts online (COMING SOON)46 41 - **Auto Order import/Export** Automatically import your Square orders into WooCommerce and vise-versa 47 42 - **Order status syncing** Automatically sync your Square order statuses to WooCommerce and vise-versa … … 63 58 Learn more at [squaresyncforwoo.com](https://squaresyncforwoo.com) 64 59 65 ### Product & PaymentsDemo:60 ### Product Syncing Demo: 66 61 https://www.youtube.com/watch?v=bg0l32Zeuts 67 62 … … 113 108 3-Dynamic Data Import 114 109 4-Order and Transaction Sync 115 5-Payments116 6-Sync Feed117 110 118 111 == Changelog == 112 = 5.2.0 = 113 * Added afterpay / clearpay support 114 * legacy checkout reliability improvements 115 119 116 = 5.1.1 = 120 117 * Fix auto order sync for non Square-Sync gateways -
squarewoosync/trunk/squarewoosync.php
r3225869 r3292205 12 12 * License URI: http://www.gnu.org/licenses/gpl-2.0.html 13 13 * Domain Path: /languages 14 * Version: 5. 1.114 * Version: 5.2.0 15 15 * Requires at least: 5.4 16 16 * Requires PHP: 7.4 … … 29 29 final class SquareWooSync 30 30 { 31 const VERSION = '5. 1.1';31 const VERSION = '5.2.0'; 32 32 const SLUG = 'squarewoosync'; 33 33 -
squarewoosync/trunk/vendor/autoload.php
r3045330 r3292205 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit 42320dfc2be27ca2fe9fd2059502af6f::getLoader();25 return ComposerAutoloaderInit2f3c6b6bb65ce8e2f7b091a2f5afd4ef::getLoader(); -
squarewoosync/trunk/vendor/composer/autoload_real.php
r3045330 r3292205 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 42320dfc2be27ca2fe9fd2059502af6f5 class ComposerAutoloaderInit2f3c6b6bb65ce8e2f7b091a2f5afd4ef 6 6 { 7 7 private static $loader; … … 23 23 } 24 24 25 spl_autoload_register(array('ComposerAutoloaderInit 42320dfc2be27ca2fe9fd2059502af6f', 'loadClassLoader'), true, true);25 spl_autoload_register(array('ComposerAutoloaderInit2f3c6b6bb65ce8e2f7b091a2f5afd4ef', 'loadClassLoader'), true, true); 26 26 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 27 spl_autoload_unregister(array('ComposerAutoloaderInit 42320dfc2be27ca2fe9fd2059502af6f', 'loadClassLoader'));27 spl_autoload_unregister(array('ComposerAutoloaderInit2f3c6b6bb65ce8e2f7b091a2f5afd4ef', 'loadClassLoader')); 28 28 29 29 require __DIR__ . '/autoload_static.php'; 30 call_user_func(\Composer\Autoload\ComposerStaticInit 42320dfc2be27ca2fe9fd2059502af6f::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInit2f3c6b6bb65ce8e2f7b091a2f5afd4ef::getInitializer($loader)); 31 31 32 32 $loader->register(true); -
squarewoosync/trunk/vendor/composer/autoload_static.php
r3045330 r3292205 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 42320dfc2be27ca2fe9fd2059502af6f7 class ComposerStaticInit2f3c6b6bb65ce8e2f7b091a2f5afd4ef 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 36 36 { 37 37 return \Closure::bind(function () use ($loader) { 38 $loader->prefixLengthsPsr4 = ComposerStaticInit 42320dfc2be27ca2fe9fd2059502af6f::$prefixLengthsPsr4;39 $loader->prefixDirsPsr4 = ComposerStaticInit 42320dfc2be27ca2fe9fd2059502af6f::$prefixDirsPsr4;40 $loader->classMap = ComposerStaticInit 42320dfc2be27ca2fe9fd2059502af6f::$classMap;38 $loader->prefixLengthsPsr4 = ComposerStaticInit2f3c6b6bb65ce8e2f7b091a2f5afd4ef::$prefixLengthsPsr4; 39 $loader->prefixDirsPsr4 = ComposerStaticInit2f3c6b6bb65ce8e2f7b091a2f5afd4ef::$prefixDirsPsr4; 40 $loader->classMap = ComposerStaticInit2f3c6b6bb65ce8e2f7b091a2f5afd4ef::$classMap; 41 41 42 42 }, null, ClassLoader::class); -
squarewoosync/trunk/vendor/composer/installed.php
r3225869 r3292205 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 862e4e7b346b246b0cab176f1b96c60614a4e3ba',6 'reference' => '53bf1be2e5377ad21352d839c6dbba10cc21e5f9', 7 7 'type' => 'project', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' 862e4e7b346b246b0cab176f1b96c60614a4e3ba',16 'reference' => '53bf1be2e5377ad21352d839c6dbba10cc21e5f9', 17 17 'type' => 'project', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.