Stripe Payments For WooCommerce by Checkout Plugins - Version 1.4.5

Version Description

  • MONDAY, 6TH JUNE 2022 =
  • Improvement: Added free trial/zero amount subscription support.
Download this release

Release Info

Developer brainstormworg
Plugin Icon 128x128 Stripe Payments For WooCommerce by Checkout Plugins
Version 1.4.5
Comparing to
See all releases

Code changes from version 1.4.4 to 1.4.5

admin/assets/js/stripe-elements.js CHANGED
@@ -13,7 +13,7 @@
13
  stripe.registerAppInfo( {
14
  name: 'WordPress Checkout Plugins - Stripe for WooCommerce',
15
  partner_id: 'pp_partner_KOjySVEy3ClX6G',
16
- version: cpsw_global_settings.cpsw_version,
17
  url: 'https://wordpress.org/plugins/checkout-plugins-stripe-woo/',
18
  } );
19
 
13
  stripe.registerAppInfo( {
14
  name: 'WordPress Checkout Plugins - Stripe for WooCommerce',
15
  partner_id: 'pp_partner_KOjySVEy3ClX6G',
16
+ version: cpsw_admin_stripe_elements.cpsw_version,
17
  url: 'https://wordpress.org/plugins/checkout-plugins-stripe-woo/',
18
  } );
19
 
assets/js/payment-request.js CHANGED
@@ -3,6 +3,8 @@
3
  const ajaxUrl = cpsw_payment_request.ajax_url;
4
  const nonce = cpsw_payment_request.nonce;
5
  const isProductPage = cpsw_payment_request.is_product_page;
 
 
6
  const currencyCode = cpsw_payment_request.currency_code;
7
  const countryCode = cpsw_payment_request.country_code;
8
  const style = cpsw_payment_request.style;
@@ -142,6 +144,7 @@
142
  attachPaymentRequestButtonEventListeners( prButton, paymentRequest );
143
 
144
  $( '#cpsw-payment-request-wrapper' ).css( 'display', 'inline-block' );
 
145
 
146
  makeButtonInline();
147
 
@@ -507,7 +510,7 @@
507
  }
508
 
509
  function cpswAdjustButtonOnCheckoutPage() {
510
- if ( $( '.place-order #place_order' ).length > 0 ) {
511
  const wcCheckoutButton = $( '.place-order #place_order' );
512
  const cpswExpressCheckoutButtonWrap = $( '.cpsw-payment-request-custom-button-render' );
513
  const cpswExpressCheckoutButton = $( '#cpsw-payment-request-custom-button' );
@@ -528,7 +531,7 @@
528
  }
529
 
530
  function cpswAdjustButtonOnCartPage() {
531
- if ( $( '.wc-proceed-to-checkout .checkout-button' ).length > 0 ) {
532
  const wcCartButton = $( '.wc-proceed-to-checkout .checkout-button' );
533
  const cpswExpressCheckoutButton = $( '.cpsw-payment-request-custom-button-render' );
534
  if ( $( '.place-order #place_order' ).outerHeight() > 30 ) {
@@ -541,7 +544,7 @@
541
  }
542
 
543
  function cpswAdjustButtonOnProductPage() {
544
- if ( $( 'form.cart button.single_add_to_cart_button' ).length > 0 ) {
545
  const wcAddToCartButton = $( 'form.cart button.single_add_to_cart_button' );
546
  const cpswExpressCheckoutButton = $( '.cpsw-payment-request-custom-button-render' );
547
  const cpswExpressCheckoutWrapper = $( '#cpsw-payment-request-wrapper' );
3
  const ajaxUrl = cpsw_payment_request.ajax_url;
4
  const nonce = cpsw_payment_request.nonce;
5
  const isProductPage = cpsw_payment_request.is_product_page;
6
+ const isCheckoutPage = cpsw_payment_request.is_checkout;
7
+ const isCartPage = cpsw_payment_request.is_cart;
8
  const currencyCode = cpsw_payment_request.currency_code;
9
  const countryCode = cpsw_payment_request.country_code;
10
  const style = cpsw_payment_request.style;
144
  attachPaymentRequestButtonEventListeners( prButton, paymentRequest );
145
 
146
  $( '#cpsw-payment-request-wrapper' ).css( 'display', 'inline-block' );
147
+ $( '.cpsw-payment-request-main-wrapper' ).addClass( 'cpsw-payment-request-is-visible' );
148
 
149
  makeButtonInline();
150
 
510
  }
511
 
512
  function cpswAdjustButtonOnCheckoutPage() {
513
+ if ( isCheckoutPage && $( '.place-order #place_order' ).length > 0 ) {
514
  const wcCheckoutButton = $( '.place-order #place_order' );
515
  const cpswExpressCheckoutButtonWrap = $( '.cpsw-payment-request-custom-button-render' );
516
  const cpswExpressCheckoutButton = $( '#cpsw-payment-request-custom-button' );
531
  }
532
 
533
  function cpswAdjustButtonOnCartPage() {
534
+ if ( isCartPage && $( '.wc-proceed-to-checkout .checkout-button' ).length > 0 ) {
535
  const wcCartButton = $( '.wc-proceed-to-checkout .checkout-button' );
536
  const cpswExpressCheckoutButton = $( '.cpsw-payment-request-custom-button-render' );
537
  if ( $( '.place-order #place_order' ).outerHeight() > 30 ) {
544
  }
545
 
546
  function cpswAdjustButtonOnProductPage() {
547
+ if ( isProductPage && $( 'form.cart button.single_add_to_cart_button' ).length > 0 ) {
548
  const wcAddToCartButton = $( 'form.cart button.single_add_to_cart_button' );
549
  const cpswExpressCheckoutButton = $( '.cpsw-payment-request-custom-button-render' );
550
  const cpswExpressCheckoutWrapper = $( '#cpsw-payment-request-wrapper' );
assets/js/stripe-elements.js CHANGED
@@ -23,6 +23,7 @@
23
  let cardCvc = null;
24
  let paymentForm = null;
25
  let paymentMethod = '';
 
26
  let isAllowedCard = '';
27
  let selectedGatewayId = '';
28
  let selectedIdealBank = '';
@@ -290,26 +291,27 @@
290
  } );
291
  break;
292
  case 'cpsw_sepa':
293
- if ( $( 'form.woocommerce-checkout' ).length ) {
294
  return true;
295
  }
296
 
 
297
  stripe.createPaymentMethod( {
298
  type: 'sepa_debit',
299
  sepa_debit: sepa,
300
- billing_details: currentUserBilling,
301
  } ).then( function( result ) {
 
302
  // Handle result.error or result.paymentMethod
303
  if ( result.paymentMethod ) {
304
- paymentMethod = result.paymentMethod.id;
305
  paymentForm.append(
306
  "<input type='hidden' class='cpsw_payment_method' name='payment_method_created' value='" +
307
- paymentMethod +
308
  "'/>",
309
  );
310
  paymentForm.trigger( 'submit' );
311
  } else if ( result.error ) {
312
- $( '.woocommerce-error' ).remove();
313
  $( 'form.woocommerce-checkout' ).unblock();
314
  logError( result.error );
315
  $( '.woocommerce-notices-wrapper:first-child' ).html( '<div class="woocommerce-error cpsw-errors">' + getStripeLocalizedMessage( result.error.code, result.error.message ) + '</div>' ).show();
@@ -698,22 +700,18 @@
698
  }
699
 
700
  const processingSubmit = function( e ) {
701
- if ( ( 'cpsw_stripe' === selectedGateway() || 'cpsw_sepa' === selectedGateway() ) && ! savedCard && '' === paymentMethod ) {
702
- if ( false === isAllowedCard ) {
703
- return false;
704
- }
705
-
706
- if ( 'cpsw_sepa' === selectedGateway() && isSepaSaveCardChosen() ) {
707
- return true;
708
- }
709
-
710
  e.preventDefault();
711
  createStripePaymentMethod();
712
 
713
  return false;
714
  }
715
 
716
- if ( 'cpsw_sepa' === selectedGateway() && ! isSepaSaveCardChosen() && $( 'form#order_review' ).length && '' === paymentMethod ) {
 
 
 
 
717
  e.preventDefault();
718
  createStripePaymentMethod();
719
 
@@ -774,7 +772,7 @@
774
  }
775
  } );
776
 
777
- $( 'form.woocommerce-checkout' ).on( 'submit checkout_place_order_cpsw_stripe', processingSubmit );
778
 
779
  if ( $( 'form#order_review' ).length ) {
780
  showSavedCards();
23
  let cardCvc = null;
24
  let paymentForm = null;
25
  let paymentMethod = '';
26
+ let paymentMethodSepa = '';
27
  let isAllowedCard = '';
28
  let selectedGatewayId = '';
29
  let selectedIdealBank = '';
291
  } );
292
  break;
293
  case 'cpsw_sepa':
294
+ if ( $( 'form.woocommerce-checkout' ).length && 'no' === cpsw_global_settings.is_cart_amount_zero ) {
295
  return true;
296
  }
297
 
298
+ $( '.woocommerce-error' ).remove();
299
  stripe.createPaymentMethod( {
300
  type: 'sepa_debit',
301
  sepa_debit: sepa,
302
+ billing_details: $( 'form.woocommerce-checkout' ).length ? getBillingDetails() : currentUserBilling,
303
  } ).then( function( result ) {
304
+ $( 'input.cpsw_payment_method' ).remove();
305
  // Handle result.error or result.paymentMethod
306
  if ( result.paymentMethod ) {
307
+ paymentMethodSepa = result.paymentMethod.id;
308
  paymentForm.append(
309
  "<input type='hidden' class='cpsw_payment_method' name='payment_method_created' value='" +
310
+ paymentMethodSepa +
311
  "'/>",
312
  );
313
  paymentForm.trigger( 'submit' );
314
  } else if ( result.error ) {
 
315
  $( 'form.woocommerce-checkout' ).unblock();
316
  logError( result.error );
317
  $( '.woocommerce-notices-wrapper:first-child' ).html( '<div class="woocommerce-error cpsw-errors">' + getStripeLocalizedMessage( result.error.code, result.error.message ) + '</div>' ).show();
700
  }
701
 
702
  const processingSubmit = function( e ) {
703
+ if ( ( 'yes' === cpsw_global_settings.is_cart_amount_zero || $( 'form#order_review' ).length || $( 'form#add_payment_method' ).length ) && 'cpsw_sepa' === selectedGateway() && ! isSepaSaveCardChosen() && '' === paymentMethodSepa ) {
 
 
 
 
 
 
 
 
704
  e.preventDefault();
705
  createStripePaymentMethod();
706
 
707
  return false;
708
  }
709
 
710
+ if ( 'cpsw_stripe' === selectedGateway() && ! savedCard && '' === paymentMethod ) {
711
+ if ( false === isAllowedCard ) {
712
+ return false;
713
+ }
714
+
715
  e.preventDefault();
716
  createStripePaymentMethod();
717
 
772
  }
773
  } );
774
 
775
+ $( 'form.woocommerce-checkout' ).on( 'submit checkout_place_order_cpsw_stripe checkout_place_order_cpsw_sepa', processingSubmit );
776
 
777
  if ( $( 'form#order_review' ).length ) {
778
  showSavedCards();
checkout-plugins-stripe-woo.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Checkout Plugins - Stripe for WooCommerce
4
  * Plugin URI: https://www.checkoutplugins.com/
5
  * Description: Stripe for WooCommerce delivers a simple, secure way to accept credit card payments in your WooCommerce store. Reduce payment friction and boost conversions using this free plugin!
6
- * Version: 1.4.4
7
  * Author: Checkout Plugins
8
  * Author URI: https://checkoutplugins.com/
9
  * License: GPLv2 or later
@@ -20,6 +20,6 @@ define( 'CPSW_FILE', __FILE__ );
20
  define( 'CPSW_BASE', plugin_basename( CPSW_FILE ) );
21
  define( 'CPSW_DIR', plugin_dir_path( CPSW_FILE ) );
22
  define( 'CPSW_URL', plugins_url( '/', CPSW_FILE ) );
23
- define( 'CPSW_VERSION', '1.4.4' );
24
 
25
  require_once 'autoloader.php';
3
  * Plugin Name: Checkout Plugins - Stripe for WooCommerce
4
  * Plugin URI: https://www.checkoutplugins.com/
5
  * Description: Stripe for WooCommerce delivers a simple, secure way to accept credit card payments in your WooCommerce store. Reduce payment friction and boost conversions using this free plugin!
6
+ * Version: 1.4.5
7
  * Author: Checkout Plugins
8
  * Author URI: https://checkoutplugins.com/
9
  * License: GPLv2 or later
20
  define( 'CPSW_BASE', plugin_basename( CPSW_FILE ) );
21
  define( 'CPSW_DIR', plugin_dir_path( CPSW_FILE ) );
22
  define( 'CPSW_URL', plugins_url( '/', CPSW_FILE ) );
23
+ define( 'CPSW_VERSION', '1.4.5' );
24
 
25
  require_once 'autoloader.php';
compatibility/cart-plugin.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Cart plugin compatibility
4
+ *
5
+ * @package checkout-plugins-stripe-woo
6
+ * @since 1.4.5
7
+ */
8
+
9
+ namespace CPSW\Compatibility;
10
+
11
+ use CPSW\Inc\Traits\Get_Instance;
12
+ use CPSW\Gateway\Stripe\Payment_Request_Api;
13
+
14
+ /**
15
+ * Cart plugin class
16
+ */
17
+ class Cart_Plugin {
18
+
19
+ use Get_Instance;
20
+
21
+ /**
22
+ * Constructor
23
+ */
24
+ public function __construct() {
25
+ $this->payment_request = Payment_Request_Api::get_instance();
26
+ add_action( 'wcp_slide_out_footer_after', [ $this, 'render_payment_request_button' ] );
27
+ }
28
+
29
+ /**
30
+ * Payment request button render for cart plugin
31
+ *
32
+ * @return void
33
+ */
34
+ public function render_payment_request_button() {
35
+ $this->payment_request->payment_request_button();
36
+ }
37
+ }
gateway/abstract-payment-gateway.php CHANGED
@@ -345,7 +345,9 @@ abstract class Abstract_Payment_Gateway extends WC_Payment_Gateway {
345
  }
346
 
347
  /* translators: transaction id */
348
- $order->update_status( 'on-hold', sprintf( __( 'Stripe charge authorized (Charge ID: %s). Process order to take payment, or cancel to remove the pre-authorization. Attempting to refund the order in part or in full will release the authorization and cancel the payment.', 'checkout-plugins-stripe-woo' ), $response->id ) );
 
 
349
  }
350
 
351
  if ( is_callable( [ $order, 'save' ] ) ) {
345
  }
346
 
347
  /* translators: transaction id */
348
+ $order_info = 'cpsw_sepa' === $this->id ? sprintf( __( 'Stripe charge awaiting payment: %1$s. Payment will be completed once payment_intent.succeeded webhook received from Stripe.', 'checkout-plugins-stripe-woo' ), $response->id ) : sprintf( __( 'Stripe charge authorized (Charge ID: %s). Process order to take payment, or cancel to remove the pre-authorization. Attempting to refund the order in part or in full will release the authorization and cancel the payment.', 'checkout-plugins-stripe-woo' ), $response->id );
349
+
350
+ $order->update_status( 'on-hold', $order_info );
351
  }
352
 
353
  if ( is_callable( [ $order, 'save' ] ) ) {
gateway/stripe/card-payments.php CHANGED
@@ -218,6 +218,12 @@ $ */
218
  return $this->process_change_subscription_payment_method( $order_id );
219
  }
220
 
 
 
 
 
 
 
221
  if ( $this->is_using_saved_payment_method() ) {
222
  return $this->process_payment_with_saved_payment_method( $order_id );
223
  }
@@ -227,7 +233,6 @@ $ */
227
  return;
228
  }
229
 
230
- $order = wc_get_order( $order_id );
231
  $payment_method = sanitize_text_field( $_POST['payment_method_created'] ); //phpcs:ignore WordPress.Security.NonceVerification.Missing
232
  $customer_id = $this->get_customer_id( $order );
233
  $idempotency_key = $payment_method . '_' . $order->get_order_key();
@@ -277,6 +282,23 @@ $ */
277
  }
278
  }
279
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
280
  /**
281
  * Process payment method functionality
282
  *
218
  return $this->process_change_subscription_payment_method( $order_id );
219
  }
220
 
221
+ $order = wc_get_order( $order_id );
222
+
223
+ if ( 0 === absint( $order->get_total() ) ) {
224
+ return $this->process_zero_amount_order( $order );
225
+ }
226
+
227
  if ( $this->is_using_saved_payment_method() ) {
228
  return $this->process_payment_with_saved_payment_method( $order_id );
229
  }
233
  return;
234
  }
235
 
 
236
  $payment_method = sanitize_text_field( $_POST['payment_method_created'] ); //phpcs:ignore WordPress.Security.NonceVerification.Missing
237
  $customer_id = $this->get_customer_id( $order );
238
  $idempotency_key = $payment_method . '_' . $order->get_order_key();
282
  }
283
  }
284
 
285
+ /**
286
+ * Process zero amount order
287
+ *
288
+ * @since 1.4.5
289
+ *
290
+ * @param WC_Order $order WooCommerce order.
291
+ */
292
+ public function process_zero_amount_order( $order ) {
293
+ if ( 'automatic' === $this->capture_method ) {
294
+ $order->payment_complete();
295
+ } else {
296
+ $order->update_status( apply_filters( 'cpsw_stripe_authorized_order_status', 'on-hold' ) );
297
+ }
298
+
299
+ return $this->process_change_subscription_payment_method( $order->get_id() );
300
+ }
301
+
302
  /**
303
  * Process payment method functionality
304
  *
gateway/stripe/frontend-scripts.php CHANGED
@@ -129,6 +129,7 @@ class Frontend_Scripts {
129
  ],
130
  ],
131
  ],
 
132
  'empty_sepa_iban_message' => __( 'Please enter a IBAN number to proceed.', 'checkout-plugins-stripe-woo' ),
133
  'empty_bank_message' => __( 'Please select a bank to proceed.', 'checkout-plugins-stripe-woo' ),
134
  ]
@@ -188,6 +189,8 @@ class Frontend_Scripts {
188
  ],
189
  'is_product_page' => is_product() || wc_post_content_has_shortcode( 'product_page' ),
190
  'is_responsive' => Helper::get_setting( 'express_checkout_product_sticky_footer', 'cpsw_stripe' ),
 
 
191
  ]
192
  )
193
  );
129
  ],
130
  ],
131
  ],
132
+ 'is_cart_amount_zero' => WC()->cart->total > 0 ? 'no' : 'yes',
133
  'empty_sepa_iban_message' => __( 'Please enter a IBAN number to proceed.', 'checkout-plugins-stripe-woo' ),
134
  'empty_bank_message' => __( 'Please select a bank to proceed.', 'checkout-plugins-stripe-woo' ),
135
  ]
189
  ],
190
  'is_product_page' => is_product() || wc_post_content_has_shortcode( 'product_page' ),
191
  'is_responsive' => Helper::get_setting( 'express_checkout_product_sticky_footer', 'cpsw_stripe' ),
192
+ 'is_checkout' => is_checkout(),
193
+ 'is_cart' => is_cart(),
194
  ]
195
  )
196
  );
gateway/stripe/payment-request-api.php CHANGED
@@ -45,7 +45,6 @@ class Payment_Request_Api extends Card_Payments {
45
  }
46
 
47
  add_action( $product_page_action, [ $this, 'payment_request_button' ], $product_page_priority );
48
-
49
  add_action( 'woocommerce_proceed_to_checkout', [ $this, 'payment_request_button' ], 1 );
50
 
51
  $checkout_page_action = 'woocommerce_checkout_before_customer_details';
@@ -75,10 +74,13 @@ class Payment_Request_Api extends Card_Payments {
75
  * @return boolean
76
  */
77
  private function is_page_supported() {
78
- return $this->is_product()
 
 
79
  || is_cart()
80
  || is_checkout()
81
- || isset( $_GET['pay_for_order'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
 
82
  }
83
 
84
  /**
@@ -102,7 +104,7 @@ class Payment_Request_Api extends Card_Payments {
102
  }
103
  }
104
 
105
- return false;
106
  }
107
 
108
  /**
@@ -129,7 +131,7 @@ class Payment_Request_Api extends Card_Payments {
129
  return;
130
  }
131
 
132
- $container_class = '';
133
  $button_tag = 'button';
134
  $button_class = 'button alt';
135
 
@@ -186,11 +188,18 @@ class Payment_Request_Api extends Card_Payments {
186
  }
187
 
188
  ?>
189
- <div id="cpsw-payment-request-wrapper" class="<?php echo esc_attr( $container_class . ' ' . $position_class . ' ' . $alignment_class ); ?>" style="display: none;">
190
  <?php
191
  if ( ! $separator_below ) {
192
  $this->payment_request_button_separator();
193
  }
 
 
 
 
 
 
 
194
  ?>
195
  <div class="cpsw-payment-request-button-wrapper">
196
  <?php
@@ -223,6 +232,14 @@ class Payment_Request_Api extends Card_Payments {
223
  </div>
224
  </div>
225
  <?php
 
 
 
 
 
 
 
 
226
  if ( $separator_below ) {
227
  $this->payment_request_button_separator();
228
  }
45
  }
46
 
47
  add_action( $product_page_action, [ $this, 'payment_request_button' ], $product_page_priority );
 
48
  add_action( 'woocommerce_proceed_to_checkout', [ $this, 'payment_request_button' ], 1 );
49
 
50
  $checkout_page_action = 'woocommerce_checkout_before_customer_details';
74
  * @return boolean
75
  */
76
  private function is_page_supported() {
77
+ return apply_filters(
78
+ 'cpsw_express_checkout_allow_custom_pages',
79
+ $this->is_product()
80
  || is_cart()
81
  || is_checkout()
82
+ || isset( $_GET['pay_for_order'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
83
+ );
84
  }
85
 
86
  /**
104
  }
105
  }
106
 
107
+ return apply_filters( 'cpsw_express_checkout_selected_location_status', false );
108
  }
109
 
110
  /**
131
  return;
132
  }
133
 
134
+ $container_class = 'cpsw-product';
135
  $button_tag = 'button';
136
  $button_class = 'button alt';
137
 
188
  }
189
 
190
  ?>
191
+ <div id="cpsw-payment-request-wrapper" class="cpsw-payment-request-main-wrapper <?php echo esc_attr( $container_class . ' ' . $position_class . ' ' . $alignment_class ); ?>" style="display: none;">
192
  <?php
193
  if ( ! $separator_below ) {
194
  $this->payment_request_button_separator();
195
  }
196
+
197
+ /**
198
+ * Express checkout button before action
199
+ *
200
+ * @since 1.4.5
201
+ */
202
+ do_action( 'cpsw_payment_request_button_before' );
203
  ?>
204
  <div class="cpsw-payment-request-button-wrapper">
205
  <?php
232
  </div>
233
  </div>
234
  <?php
235
+
236
+ /**
237
+ * Express checkout button after action
238
+ *
239
+ * @since 1.4.5
240
+ */
241
+ do_action( 'cpsw_payment_request_button_after' );
242
+
243
  if ( $separator_below ) {
244
  $this->payment_request_button_separator();
245
  }
gateway/stripe/sepa.php CHANGED
@@ -409,12 +409,17 @@ class Sepa extends Local_Gateway {
409
  return $this->process_change_subscription_payment_method( $order_id );
410
  }
411
 
 
 
 
 
 
 
412
  if ( $this->is_using_saved_payment_method() ) {
413
  return $this->process_payment_with_saved_payment_method( $order_id );
414
  }
415
 
416
  try {
417
- $order = wc_get_order( $order_id );
418
  $customer_id = $this->get_customer_id( $order );
419
  $idempotency_key = $order->get_order_key() . time();
420
 
@@ -458,6 +463,68 @@ class Sepa extends Local_Gateway {
458
  }
459
  }
460
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  /**
462
  * Verify intent state and redirect.
463
  *
409
  return $this->process_change_subscription_payment_method( $order_id );
410
  }
411
 
412
+ $order = wc_get_order( $order_id );
413
+
414
+ if ( 0 === absint( $order->get_total() ) ) {
415
+ return $this->process_zero_amount_order( $order );
416
+ }
417
+
418
  if ( $this->is_using_saved_payment_method() ) {
419
  return $this->process_payment_with_saved_payment_method( $order_id );
420
  }
421
 
422
  try {
 
423
  $customer_id = $this->get_customer_id( $order );
424
  $idempotency_key = $order->get_order_key() . time();
425
 
463
  }
464
  }
465
 
466
+ /**
467
+ * Prepare payment method object
468
+ *
469
+ * @since 1.4.5
470
+ *
471
+ * @param object $payment_method payment method object from intent.
472
+ * @param object $token token object used for payment.
473
+ *
474
+ * @return object
475
+ */
476
+ public function prepare_payment_method_zero_amount( $payment_method, $token ) {
477
+ return (object) apply_filters(
478
+ 'cpsw_prepare_payment_method_args',
479
+ [
480
+ 'token_id' => $token,
481
+ 'customer' => $payment_method->customer,
482
+ 'source' => $payment_method->id,
483
+ 'source_object' => $payment_method,
484
+ 'payment_method' => $payment_method->id,
485
+ 'payment_method_object' => $payment_method,
486
+ ]
487
+ );
488
+ }
489
+
490
+ /**
491
+ * Process zero amount order
492
+ *
493
+ * @since 1.4.5
494
+ *
495
+ * @param WC_Order $order WooCommerce order.
496
+ */
497
+ public function process_zero_amount_order( $order ) {
498
+ $token = '';
499
+ $prepared_payment_method = '';
500
+
501
+ if ( isset( $_POST['payment_method_created'] ) ) { //phpcs:ignore
502
+ $method_created = ! empty( $_POST['payment_method_created'] ) ? wc_clean( wp_unslash( $_POST['payment_method_created'] ) ) : ''; //phpcs:ignore WordPress.Security.NonceVerification.Missing
503
+ $stripe_api = new Stripe_Api();
504
+ $response = $stripe_api->payment_methods( 'retrieve', [ $method_created ] );
505
+ $payment_method = $response['success'] ? $response['data'] : false;
506
+ $user = $order->get_id() ? $order->get_user() : wp_get_current_user();
507
+ $user_id = $user->ID;
508
+ $token = $this->create_payment_token_for_user( $user_id, $payment_method );
509
+ $prepared_payment_method = $this->prepare_payment_method( $payment_method, $token );
510
+ } elseif ( $this->is_using_saved_payment_method() ) {
511
+ $token = $this->get_token_from_request( $_POST ); //phpcs:ignore WordPress.Security.NonceVerification.Missing
512
+ $stripe_api = new Stripe_Api();
513
+ $response = $stripe_api->payment_methods( 'retrieve', [ $token ] );
514
+ $payment_method = $response['success'] ? $response['data'] : false;
515
+ $prepared_payment_method = $this->prepare_payment_method_zero_amount( $payment_method, $token );
516
+ }
517
+
518
+ if ( ! empty( $token ) ) {
519
+ $order->payment_complete();
520
+ $this->save_payment_method_to_order( $order, $prepared_payment_method );
521
+
522
+ return $this->process_change_subscription_payment_method( $order->get_id() );
523
+ }
524
+
525
+ return false;
526
+ }
527
+
528
  /**
529
  * Verify intent state and redirect.
530
  *
inc/traits/subscriptions.php CHANGED
@@ -811,7 +811,7 @@ trait Subscriptions {
811
  }
812
 
813
  if ( empty( $source_object ) && ! $is_token ) {
814
- $source_object = self::get_source_object( $source_id );
815
  }
816
 
817
  return (object) [
@@ -822,4 +822,23 @@ trait Subscriptions {
822
  'payment_method' => null,
823
  ];
824
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
825
  }
811
  }
812
 
813
  if ( empty( $source_object ) && ! $is_token ) {
814
+ $source_object = $this->get_source_object( $source_id );
815
  }
816
 
817
  return (object) [
822
  'payment_method' => null,
823
  ];
824
  }
825
+
826
+ /**
827
+ * Get source object by source id.
828
+ *
829
+ * @since 1.4.5
830
+ *
831
+ * @param string $source_id The source ID to get source object for.
832
+ */
833
+ public function get_source_object( $source_id = '' ) {
834
+ if ( empty( $source_id ) ) {
835
+ return '';
836
+ }
837
+
838
+ $stripe_api = new Stripe_Api();
839
+ $response = $stripe_api->payment_methods( 'retrieve', [ $source_id ] );
840
+ $source_object = $response['success'] ? $response['data'] : false;
841
+
842
+ return $source_object;
843
+ }
844
  }
languages/checkout-plugins-stripe-woo.pot CHANGED
@@ -2,16 +2,16 @@
2
  # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Checkout Plugins - Stripe for WooCommerce 1.4.4\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/checkout-plugins-stripe-woo\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2022-04-22T13:13:31+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
- "X-Generator: WP-CLI 2.5.0\n"
15
  "X-Domain: checkout-plugins-stripe-woo\n"
16
 
17
  #. Plugin Name of the plugin
@@ -117,8 +117,8 @@ msgstr ""
117
 
118
  #: admin/admin-controller.php:297
119
  #: admin/admin-controller.php:322
120
- #: gateway/stripe/frontend-scripts.php:145
121
- #: gateway/stripe/payment-request-api.php:152
122
  #: inc/helper.php:84
123
  msgid "Pay now"
124
  msgstr ""
@@ -616,16 +616,16 @@ msgstr ""
616
  msgid "Add separator text for Checkout page. If empty will show default separator text."
617
  msgstr ""
618
 
619
- #: autoloader.php:143
620
  msgid "Settings"
621
  msgstr ""
622
 
623
- #: autoloader.php:144
624
  msgid "Documentation"
625
  msgstr ""
626
 
627
  #. translators: 1$-2$: opening and closing <strong> tags, 3$-4$: link tags, takes to woocommerce plugin on wp.org, 5$-6$: opening and closing link tags, leads to plugins.php in admin.
628
- #: autoloader.php:197
629
  msgid "%1$sCheckout Plugins - Stripe for WooCommerce is inactive.%2$s The %3$sWooCommerce plugin%4$s must be active for Checkout Plugins - Stripe for WooCommerce to work. Please %5$sinstall & activate WooCommerce &raquo;%6$s"
630
  msgstr ""
631
 
@@ -699,13 +699,13 @@ msgid " Status : Failed "
699
  msgstr ""
700
 
701
  #: gateway/abstract-payment-gateway.php:318
702
- #: gateway/stripe/sepa.php:506
703
  msgid "Payment will be completed once payment_intent.succeeded webhook received from Stripe."
704
  msgstr ""
705
 
706
  #. translators: transaction id, other info
707
  #: gateway/abstract-payment-gateway.php:321
708
- #: gateway/stripe/sepa.php:509
709
  msgid "Stripe charge awaiting payment: %1$s. %2$s"
710
  msgstr ""
711
 
@@ -720,65 +720,70 @@ msgstr ""
720
  msgid "Payment processing failed. Please retry."
721
  msgstr ""
722
 
 
 
 
 
 
723
  #. translators: transaction id
724
  #: gateway/abstract-payment-gateway.php:348
725
  msgid "Stripe charge authorized (Charge ID: %s). Process order to take payment, or cancel to remove the pre-authorization. Attempting to refund the order in part or in full will release the authorization and cancel the payment."
726
  msgstr ""
727
 
728
- #: gateway/abstract-payment-gateway.php:400
729
  msgid "An error has occurred internally, due to which you are not redirected to the order received page."
730
  msgstr ""
731
 
732
- #: gateway/abstract-payment-gateway.php:548
733
- #: gateway/abstract-payment-gateway.php:549
734
  msgid "Uncaptured Amount cannot be refunded"
735
  msgstr ""
736
 
737
  #. translators: order id
738
- #: gateway/abstract-payment-gateway.php:623
739
  msgid "Payment successful Order id - %1s"
740
  msgstr ""
741
 
742
- #: gateway/abstract-payment-gateway.php:627
743
  msgid "Payment Status: "
744
  msgstr ""
745
 
746
- #: gateway/abstract-payment-gateway.php:627
747
  msgid "Source: Payment is Completed via "
748
  msgstr ""
749
 
750
  #. translators: transaction id
751
- #: gateway/abstract-payment-gateway.php:630
752
  msgid "Charge authorized (Charge ID: %s). Process order to take payment, or cancel to remove the pre-authorization. Attempting to refund the order in part or in full will release the authorization and cancel the payment."
753
  msgstr ""
754
 
755
  #. translators: transaction id
756
- #: gateway/abstract-payment-gateway.php:632
757
  msgid "Charge authorized Order id - %1s"
758
  msgstr ""
759
 
760
  #. translators: %1$1s order id, %2$2s order total amount
761
- #: gateway/abstract-payment-gateway.php:777
762
  msgid "Begin processing payment with saved payment method for order %1$1s for the amount of %2$2s"
763
  msgstr ""
764
 
765
- #: gateway/abstract-payment-gateway.php:903
766
  msgid "Fee charged by stripe for this order."
767
  msgstr ""
768
 
769
- #: gateway/abstract-payment-gateway.php:904
770
  msgid "Stripe Fee:"
771
  msgstr ""
772
 
773
- #: gateway/abstract-payment-gateway.php:913
774
  msgid "Net amount that will be credited to your Stripe bank account."
775
  msgstr ""
776
 
777
- #: gateway/abstract-payment-gateway.php:914
778
  msgid "Stripe Payout:"
779
  msgstr ""
780
 
781
- #: gateway/abstract-payment-gateway.php:993
782
  msgid "Unable to update stripe transaction balance"
783
  msgstr ""
784
 
@@ -907,8 +912,8 @@ msgstr ""
907
 
908
  #. translators: %s: payment fail message.
909
  #: gateway/local-gateway.php:551
910
- #: gateway/stripe/card-payments.php:374
911
- #: gateway/stripe/sepa.php:517
912
  msgid "Payment failed. %s"
913
  msgstr ""
914
 
@@ -1067,69 +1072,69 @@ msgid "Pay via Stripe"
1067
  msgstr ""
1068
 
1069
  #. translators: %1$1s order id, %2$2s order total amount
1070
- #: gateway/stripe/card-payments.php:255
1071
  msgid "Begin processing payment with new payment method for order %1$1s for the amount of %2$2s"
1072
  msgstr ""
1073
 
1074
- #: gateway/stripe/card-payments.php:289
1075
  #: gateway/stripe/sepa.php:177
1076
  msgid "There was a problem adding the payment method."
1077
  msgstr ""
1078
 
1079
  #. translators: error msg
1080
- #: gateway/stripe/card-payments.php:291
1081
- #: gateway/stripe/card-payments.php:307
1082
- #: gateway/stripe/card-payments.php:324
1083
  #: gateway/stripe/sepa.php:179
1084
  #: gateway/stripe/sepa.php:194
1085
  #: gateway/stripe/sepa.php:211
1086
  msgid "Add payment method Error: %1$1s"
1087
  msgstr ""
1088
 
1089
- #: gateway/stripe/card-payments.php:304
1090
  #: gateway/stripe/sepa.php:191
1091
  msgid "Invalid stripe source"
1092
  msgstr ""
1093
 
1094
- #: gateway/stripe/card-payments.php:321
1095
  #: gateway/stripe/sepa.php:208
1096
  msgid "Unble to attach payment method to customer"
1097
  msgstr ""
1098
 
1099
- #: gateway/stripe/card-payments.php:330
1100
  #: gateway/stripe/sepa.php:217
1101
  msgid "New payment method added successfully"
1102
  msgstr ""
1103
 
1104
  #. translators: %1$1s order id, %2$2s token id
1105
- #: gateway/stripe/card-payments.php:361
1106
- #: gateway/stripe/sepa.php:489
1107
  msgid "Payment method tokenized for Order id - %1$1s with token id - %2$2s"
1108
  msgstr ""
1109
 
1110
  #. translators: %1$1s, %2$2s: HTML Markup
1111
- #: gateway/stripe/card-payments.php:491
1112
  msgid "Live Stripe.js integrations must use HTTPS. %1$1s For more information:%2$2s"
1113
  msgstr ""
1114
 
1115
- #: gateway/stripe/card-payments.php:521
1116
  msgid "Enter Card Details"
1117
  msgstr ""
1118
 
1119
- #: gateway/stripe/card-payments.php:524
1120
  msgid "Expiry Date"
1121
  msgstr ""
1122
 
1123
- #: gateway/stripe/card-payments.php:528
1124
  msgid "CVC"
1125
  msgstr ""
1126
 
1127
- #: gateway/stripe/card-payments.php:533
1128
  msgid "Save Card for Future Payments"
1129
  msgstr ""
1130
 
1131
  #. translators: %1$1s - %6$6s: HTML Markup
1132
- #: gateway/stripe/card-payments.php:539
1133
  msgid "%1$1s Test Mode Enabled:%2$2s Use demo card 4242424242424242 with any future date and CVV. Check more %3$3sdemo cards%4$4s"
1134
  msgstr ""
1135
 
@@ -1165,11 +1170,11 @@ msgstr ""
1165
  msgid "is not allowed"
1166
  msgstr ""
1167
 
1168
- #: gateway/stripe/frontend-scripts.php:132
1169
  msgid "Please enter a IBAN number to proceed."
1170
  msgstr ""
1171
 
1172
- #: gateway/stripe/frontend-scripts.php:133
1173
  msgid "Please select a bank to proceed."
1174
  msgstr ""
1175
 
@@ -1197,51 +1202,51 @@ msgstr ""
1197
  msgid "Accept payment using Przelewy24. %1$s %2$s"
1198
  msgstr ""
1199
 
1200
- #: gateway/stripe/payment-request-api.php:296
1201
  msgid "Empty cart"
1202
  msgstr ""
1203
 
1204
- #: gateway/stripe/payment-request-api.php:391
1205
  msgid "Sign up Fee"
1206
  msgstr ""
1207
 
1208
- #: gateway/stripe/payment-request-api.php:403
1209
- #: gateway/stripe/payment-request-api.php:504
1210
- #: gateway/stripe/payment-request-api.php:677
1211
  msgid "Tax"
1212
  msgstr ""
1213
 
1214
- #: gateway/stripe/payment-request-api.php:411
1215
- #: gateway/stripe/payment-request-api.php:511
1216
- #: gateway/stripe/payment-request-api.php:685
1217
  msgid "Shipping"
1218
  msgstr ""
1219
 
1220
- #: gateway/stripe/payment-request-api.php:418
1221
- #: gateway/stripe/payment-request-api.php:692
1222
  msgid "Pending"
1223
  msgstr ""
1224
 
1225
- #: gateway/stripe/payment-request-api.php:518
1226
  msgid "Discount"
1227
  msgstr ""
1228
 
1229
  #. translators: %d is the product Id
1230
- #: gateway/stripe/payment-request-api.php:639
1231
  msgid "Product with the ID (%d) cannot be found."
1232
  msgstr ""
1233
 
1234
  #. translators: 1: product name 2: quantity in stock
1235
- #: gateway/stripe/payment-request-api.php:660
1236
  msgid "You cannot add that amount of \"%1$s\"; to the cart because there is not enough stock (%2$s remaining)."
1237
  msgstr ""
1238
 
1239
- #: gateway/stripe/payment-request-api.php:789
1240
  #: gateway/stripe/payment-request-api.php:806
 
1241
  msgid "Unable to find shipping method for address."
1242
  msgstr ""
1243
 
1244
- #: gateway/stripe/payment-request-api.php:794
1245
  msgid "Unable to provide shipping options for Payment Requests."
1246
  msgstr ""
1247
 
@@ -1293,7 +1298,7 @@ msgid "%1$1s Test Mode Enabled %2$2s : Use demo IBAN number DE893704004405320130
1293
  msgstr ""
1294
 
1295
  #. translators: %1$1s order id, %2$2s order total amount
1296
- #: gateway/stripe/sepa.php:439
1297
  msgid "Begin processing payment with SEPA for order %1$1s for the amount of %2$2s"
1298
  msgstr ""
1299
 
2
  # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Checkout Plugins - Stripe for WooCommerce 1.4.5\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/checkout-plugins-stripe-woo\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2022-06-03T12:30:57+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
+ "X-Generator: WP-CLI 2.6.0\n"
15
  "X-Domain: checkout-plugins-stripe-woo\n"
16
 
17
  #. Plugin Name of the plugin
117
 
118
  #: admin/admin-controller.php:297
119
  #: admin/admin-controller.php:322
120
+ #: gateway/stripe/frontend-scripts.php:146
121
+ #: gateway/stripe/payment-request-api.php:154
122
  #: inc/helper.php:84
123
  msgid "Pay now"
124
  msgstr ""
616
  msgid "Add separator text for Checkout page. If empty will show default separator text."
617
  msgstr ""
618
 
619
+ #: autoloader.php:144
620
  msgid "Settings"
621
  msgstr ""
622
 
623
+ #: autoloader.php:145
624
  msgid "Documentation"
625
  msgstr ""
626
 
627
  #. translators: 1$-2$: opening and closing <strong> tags, 3$-4$: link tags, takes to woocommerce plugin on wp.org, 5$-6$: opening and closing link tags, leads to plugins.php in admin.
628
+ #: autoloader.php:202
629
  msgid "%1$sCheckout Plugins - Stripe for WooCommerce is inactive.%2$s The %3$sWooCommerce plugin%4$s must be active for Checkout Plugins - Stripe for WooCommerce to work. Please %5$sinstall & activate WooCommerce &raquo;%6$s"
630
  msgstr ""
631
 
699
  msgstr ""
700
 
701
  #: gateway/abstract-payment-gateway.php:318
702
+ #: gateway/stripe/sepa.php:573
703
  msgid "Payment will be completed once payment_intent.succeeded webhook received from Stripe."
704
  msgstr ""
705
 
706
  #. translators: transaction id, other info
707
  #: gateway/abstract-payment-gateway.php:321
708
+ #: gateway/stripe/sepa.php:576
709
  msgid "Stripe charge awaiting payment: %1$s. %2$s"
710
  msgstr ""
711
 
720
  msgid "Payment processing failed. Please retry."
721
  msgstr ""
722
 
723
+ #. translators: transaction id
724
+ #: gateway/abstract-payment-gateway.php:348
725
+ msgid "Stripe charge awaiting payment: %1$s. Payment will be completed once payment_intent.succeeded webhook received from Stripe."
726
+ msgstr ""
727
+
728
  #. translators: transaction id
729
  #: gateway/abstract-payment-gateway.php:348
730
  msgid "Stripe charge authorized (Charge ID: %s). Process order to take payment, or cancel to remove the pre-authorization. Attempting to refund the order in part or in full will release the authorization and cancel the payment."
731
  msgstr ""
732
 
733
+ #: gateway/abstract-payment-gateway.php:402
734
  msgid "An error has occurred internally, due to which you are not redirected to the order received page."
735
  msgstr ""
736
 
737
+ #: gateway/abstract-payment-gateway.php:550
738
+ #: gateway/abstract-payment-gateway.php:551
739
  msgid "Uncaptured Amount cannot be refunded"
740
  msgstr ""
741
 
742
  #. translators: order id
743
+ #: gateway/abstract-payment-gateway.php:625
744
  msgid "Payment successful Order id - %1s"
745
  msgstr ""
746
 
747
+ #: gateway/abstract-payment-gateway.php:629
748
  msgid "Payment Status: "
749
  msgstr ""
750
 
751
+ #: gateway/abstract-payment-gateway.php:629
752
  msgid "Source: Payment is Completed via "
753
  msgstr ""
754
 
755
  #. translators: transaction id
756
+ #: gateway/abstract-payment-gateway.php:632
757
  msgid "Charge authorized (Charge ID: %s). Process order to take payment, or cancel to remove the pre-authorization. Attempting to refund the order in part or in full will release the authorization and cancel the payment."
758
  msgstr ""
759
 
760
  #. translators: transaction id
761
+ #: gateway/abstract-payment-gateway.php:634
762
  msgid "Charge authorized Order id - %1s"
763
  msgstr ""
764
 
765
  #. translators: %1$1s order id, %2$2s order total amount
766
+ #: gateway/abstract-payment-gateway.php:779
767
  msgid "Begin processing payment with saved payment method for order %1$1s for the amount of %2$2s"
768
  msgstr ""
769
 
770
+ #: gateway/abstract-payment-gateway.php:905
771
  msgid "Fee charged by stripe for this order."
772
  msgstr ""
773
 
774
+ #: gateway/abstract-payment-gateway.php:906
775
  msgid "Stripe Fee:"
776
  msgstr ""
777
 
778
+ #: gateway/abstract-payment-gateway.php:915
779
  msgid "Net amount that will be credited to your Stripe bank account."
780
  msgstr ""
781
 
782
+ #: gateway/abstract-payment-gateway.php:916
783
  msgid "Stripe Payout:"
784
  msgstr ""
785
 
786
+ #: gateway/abstract-payment-gateway.php:995
787
  msgid "Unable to update stripe transaction balance"
788
  msgstr ""
789
 
912
 
913
  #. translators: %s: payment fail message.
914
  #: gateway/local-gateway.php:551
915
+ #: gateway/stripe/card-payments.php:396
916
+ #: gateway/stripe/sepa.php:584
917
  msgid "Payment failed. %s"
918
  msgstr ""
919
 
1072
  msgstr ""
1073
 
1074
  #. translators: %1$1s order id, %2$2s order total amount
1075
+ #: gateway/stripe/card-payments.php:260
1076
  msgid "Begin processing payment with new payment method for order %1$1s for the amount of %2$2s"
1077
  msgstr ""
1078
 
1079
+ #: gateway/stripe/card-payments.php:311
1080
  #: gateway/stripe/sepa.php:177
1081
  msgid "There was a problem adding the payment method."
1082
  msgstr ""
1083
 
1084
  #. translators: error msg
1085
+ #: gateway/stripe/card-payments.php:313
1086
+ #: gateway/stripe/card-payments.php:329
1087
+ #: gateway/stripe/card-payments.php:346
1088
  #: gateway/stripe/sepa.php:179
1089
  #: gateway/stripe/sepa.php:194
1090
  #: gateway/stripe/sepa.php:211
1091
  msgid "Add payment method Error: %1$1s"
1092
  msgstr ""
1093
 
1094
+ #: gateway/stripe/card-payments.php:326
1095
  #: gateway/stripe/sepa.php:191
1096
  msgid "Invalid stripe source"
1097
  msgstr ""
1098
 
1099
+ #: gateway/stripe/card-payments.php:343
1100
  #: gateway/stripe/sepa.php:208
1101
  msgid "Unble to attach payment method to customer"
1102
  msgstr ""
1103
 
1104
+ #: gateway/stripe/card-payments.php:352
1105
  #: gateway/stripe/sepa.php:217
1106
  msgid "New payment method added successfully"
1107
  msgstr ""
1108
 
1109
  #. translators: %1$1s order id, %2$2s token id
1110
+ #: gateway/stripe/card-payments.php:383
1111
+ #: gateway/stripe/sepa.php:556
1112
  msgid "Payment method tokenized for Order id - %1$1s with token id - %2$2s"
1113
  msgstr ""
1114
 
1115
  #. translators: %1$1s, %2$2s: HTML Markup
1116
+ #: gateway/stripe/card-payments.php:513
1117
  msgid "Live Stripe.js integrations must use HTTPS. %1$1s For more information:%2$2s"
1118
  msgstr ""
1119
 
1120
+ #: gateway/stripe/card-payments.php:543
1121
  msgid "Enter Card Details"
1122
  msgstr ""
1123
 
1124
+ #: gateway/stripe/card-payments.php:546
1125
  msgid "Expiry Date"
1126
  msgstr ""
1127
 
1128
+ #: gateway/stripe/card-payments.php:550
1129
  msgid "CVC"
1130
  msgstr ""
1131
 
1132
+ #: gateway/stripe/card-payments.php:555
1133
  msgid "Save Card for Future Payments"
1134
  msgstr ""
1135
 
1136
  #. translators: %1$1s - %6$6s: HTML Markup
1137
+ #: gateway/stripe/card-payments.php:561
1138
  msgid "%1$1s Test Mode Enabled:%2$2s Use demo card 4242424242424242 with any future date and CVV. Check more %3$3sdemo cards%4$4s"
1139
  msgstr ""
1140
 
1170
  msgid "is not allowed"
1171
  msgstr ""
1172
 
1173
+ #: gateway/stripe/frontend-scripts.php:133
1174
  msgid "Please enter a IBAN number to proceed."
1175
  msgstr ""
1176
 
1177
+ #: gateway/stripe/frontend-scripts.php:134
1178
  msgid "Please select a bank to proceed."
1179
  msgstr ""
1180
 
1202
  msgid "Accept payment using Przelewy24. %1$s %2$s"
1203
  msgstr ""
1204
 
1205
+ #: gateway/stripe/payment-request-api.php:313
1206
  msgid "Empty cart"
1207
  msgstr ""
1208
 
1209
+ #: gateway/stripe/payment-request-api.php:408
1210
  msgid "Sign up Fee"
1211
  msgstr ""
1212
 
1213
+ #: gateway/stripe/payment-request-api.php:420
1214
+ #: gateway/stripe/payment-request-api.php:521
1215
+ #: gateway/stripe/payment-request-api.php:694
1216
  msgid "Tax"
1217
  msgstr ""
1218
 
1219
+ #: gateway/stripe/payment-request-api.php:428
1220
+ #: gateway/stripe/payment-request-api.php:528
1221
+ #: gateway/stripe/payment-request-api.php:702
1222
  msgid "Shipping"
1223
  msgstr ""
1224
 
1225
+ #: gateway/stripe/payment-request-api.php:435
1226
+ #: gateway/stripe/payment-request-api.php:709
1227
  msgid "Pending"
1228
  msgstr ""
1229
 
1230
+ #: gateway/stripe/payment-request-api.php:535
1231
  msgid "Discount"
1232
  msgstr ""
1233
 
1234
  #. translators: %d is the product Id
1235
+ #: gateway/stripe/payment-request-api.php:656
1236
  msgid "Product with the ID (%d) cannot be found."
1237
  msgstr ""
1238
 
1239
  #. translators: 1: product name 2: quantity in stock
1240
+ #: gateway/stripe/payment-request-api.php:677
1241
  msgid "You cannot add that amount of \"%1$s\"; to the cart because there is not enough stock (%2$s remaining)."
1242
  msgstr ""
1243
 
 
1244
  #: gateway/stripe/payment-request-api.php:806
1245
+ #: gateway/stripe/payment-request-api.php:823
1246
  msgid "Unable to find shipping method for address."
1247
  msgstr ""
1248
 
1249
+ #: gateway/stripe/payment-request-api.php:811
1250
  msgid "Unable to provide shipping options for Payment Requests."
1251
  msgstr ""
1252
 
1298
  msgstr ""
1299
 
1300
  #. translators: %1$1s order id, %2$2s order total amount
1301
+ #: gateway/stripe/sepa.php:444
1302
  msgid "Begin processing payment with SEPA for order %1$1s for the amount of %2$2s"
1303
  msgstr ""
1304
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: brainstormforce
3
  Tags: stripe, credit card, apple pay, google pay, express checkout
4
  Requires at least: 5.4
5
  Tested up to: 6.0
6
- Stable tag: 1.4.4
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -64,8 +64,6 @@ Currently used by nearly 2 million websites, Starter Templates offers hundreds o
64
 
65
  As you can see, we know WooCommerce inside and out and help thousands of store owners build highly profitable stores everyday.
66
 
67
- Stripe for WooCommerce will also bring support for Apple pay, Google pay, ACH and iDeal in upcoming updates.
68
-
69
  Stripe for WooCommerce supports WooCommerce Subscriptions where users can make recurring payments for products and services. It’s the only payment plugin you need for your store!
70
 
71
  == Installation ==
@@ -110,6 +108,9 @@ We understand the need for a quality product backed by dedicated support that ca
110
 
111
  == Changelog ==
112
 
 
 
 
113
  = 1.4.4 - FRIDAY, 22ND APRIL 2022 =
114
  * Improvement: Added support for older PHP versions.
115
  * Improvement: Modified display strings.
3
  Tags: stripe, credit card, apple pay, google pay, express checkout
4
  Requires at least: 5.4
5
  Tested up to: 6.0
6
+ Stable tag: 1.4.5
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
64
 
65
  As you can see, we know WooCommerce inside and out and help thousands of store owners build highly profitable stores everyday.
66
 
 
 
67
  Stripe for WooCommerce supports WooCommerce Subscriptions where users can make recurring payments for products and services. It’s the only payment plugin you need for your store!
68
 
69
  == Installation ==
108
 
109
  == Changelog ==
110
 
111
+ = 1.4.5 - MONDAY, 6TH JUNE 2022 =
112
+ * Improvement: Added free trial/zero amount subscription support.
113
+
114
  = 1.4.4 - FRIDAY, 22ND APRIL 2022 =
115
  * Improvement: Added support for older PHP versions.
116
  * Improvement: Modified display strings.
wizard/build/app.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-element', 'wp-i18n'), 'version' => 'd6fec05cb9f53b98348d85fce5db895b');
1
+ <?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-element', 'wp-i18n'), 'version' => 'bbe89647a0cdd39a568dc1cdfa6fd45f');
wizard/build/app.css CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- ! tailwindcss v3.0.12 | MIT License | https://tailwindcss.com
3
  *//*
4
  1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
5
  2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
1
  /*
2
+ ! tailwindcss v3.0.23 | MIT License | https://tailwindcss.com
3
  *//*
4
  1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
5
  2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
wizard/build/app.js CHANGED
@@ -1 +1 @@
1
- !function(){"use strict";var e={n:function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},d:function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.element,n=window.React,r=e.n(n),a=window.ReactDOM,o=e.n(a);function i(){return i=Object.assign||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},i.apply(this,arguments)}var l,s=l||(l={});s.Pop="POP",s.Push="PUSH",s.Replace="REPLACE";function c(e){e.preventDefault(),e.returnValue=""}function u(){var e=[];return{get length(){return e.length},push:function(t){return e.push(t),function(){e=e.filter((function(e){return e!==t}))}},call:function(t){e.forEach((function(e){return e&&e(t)}))}}}function m(e){var t={};if(e){var n=e.indexOf("#");0<=n&&(t.hash=e.substr(n),e=e.substr(0,n)),0<=(n=e.indexOf("?"))&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function d(e,t){if(!e)throw new Error(t)}const p=(0,n.createContext)(null),f=(0,n.createContext)(null),b=(0,n.createContext)({outlet:null,matches:[]});function v(e){let{basename:t="/",children:r=null,location:a,navigationType:o=l.Pop,navigator:i,static:s=!1}=e;x()&&d(!1);let c=y(t),u=(0,n.useMemo)((()=>({basename:c,navigator:i,static:s})),[c,i,s]);"string"==typeof a&&(a=m(a));let{pathname:b="/",search:v="",hash:g="",state:h=null,key:w="default"}=a,E=(0,n.useMemo)((()=>{let e=function(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=e.charAt(t.length);return n&&"/"!==n?null:e.slice(t.length)||"/"}(b,c);return null==e?null:{pathname:e,search:v,hash:g,state:h,key:w}}),[c,b,v,g,h,w]);return null==E?null:(0,n.createElement)(p.Provider,{value:u},(0,n.createElement)(f.Provider,{children:r,value:{location:E,navigationType:o}}))}function x(){return null!=(0,n.useContext)(f)}function g(){return x()||d(!1),(0,n.useContext)(f).location}function h(){x()||d(!1);let{basename:e,navigator:t}=(0,n.useContext)(p),{matches:r}=(0,n.useContext)(b),{pathname:a}=g(),o=JSON.stringify(r.map((e=>e.pathnameBase))),i=(0,n.useRef)(!1);return(0,n.useEffect)((()=>{i.current=!0})),(0,n.useCallback)((function(n,r){if(void 0===r&&(r={}),!i.current)return;if("number"==typeof n)return void t.go(n);let l=function(e,t,n){let r,a="string"==typeof e?m(e):e,o=""===e||""===a.pathname?"/":a.pathname;if(null==o)r=n;else{let e=t.length-1;if(o.startsWith("..")){let t=o.split("/");for(;".."===t[0];)t.shift(),e-=1;a.pathname=t.join("/")}r=e>=0?t[e]:"/"}let i=function(e,t){void 0===t&&(t="/");let{pathname:n,search:r="",hash:a=""}="string"==typeof e?m(e):e,o=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:o,search:E(r),hash:k(a)}}(a,r);return o&&"/"!==o&&o.endsWith("/")&&!i.pathname.endsWith("/")&&(i.pathname+="/"),i}(n,JSON.parse(o),a);"/"!==e&&(l.pathname=w([e,l.pathname])),(r.replace?t.replace:t.push)(l,r.state)}),[e,t,o,a])}const w=e=>e.join("/").replace(/\/\/+/g,"/"),y=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),E=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",k=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";var _,N,S,C=window.wp.i18n,O=function(){return(0,t.createElement)("svg",{className:"animate-spin ml-2 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},(0,t.createElement)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,t.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"}))},R=function(){const[e,r]=(0,n.useState)(!1),a=h();return(0,t.createElement)("main",{className:"mt-10 mx-auto w-auto max-w-7xl px-4 sm:mt-12 sm:px-6 md:mt-16 lg:mt-20 lg:px-8 xl:mt-28"},(0,t.createElement)("div",{className:"text-center"},(0,t.createElement)("h1",{className:"text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl"},(0,t.createElement)("span",{className:"block xl"}," ",(0,C.__)("Let's Connect","checkout-plugins-stripe-woo")),(0,t.createElement)("span",{className:"block text-cart-500 xl:inline"},(0,C.__)("with Stripe","checkout-plugins-stripe-woo"))),(0,t.createElement)("p",{className:"mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:mx-auto md:mt-5 md:text-xl lg:mx-0"},(0,t.createElement)("span",{className:"block"},(0,t.createElement)("span",{className:"block text-gray-700 inline font-bold"},(0,C.__)("Checkout Plugins","checkout-plugins-stripe-woo"))," ",(0,C.__)("recommends to connect with","checkout-plugins-stripe-woo")," ",(0,t.createElement)("span",{className:"block text-gray-700 xl:inline font-bold"},(0,C.__)("Stripe connect.","checkout-plugins-stripe-woo"))),(0,t.createElement)("span",null,(0,C.__)("One click onboarding solution provided by","checkout-plugins-stripe-woo")," ",(0,t.createElement)("span",{className:"block text-gray-700 xl:inline font-bold"},(0,C.__)("Stripe.","checkout-plugins-stripe-woo")))),(0,t.createElement)("div",{className:"mt-5 sm:mt-8 sm:inline-block lg:inline-block sm:justify-center lg:justify-center"},(0,t.createElement)("div",{className:"rounded-md shadow"},e?(0,t.createElement)("button",{className:"disabled w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-wait"},(0,C.__)("Connecting…","checkout-plugins-stripe-woo"),(0,t.createElement)(O,null)):(0,t.createElement)("button",{onClick:function(){r(!0),""===onboarding_vars.woocommerce_installed||""===onboarding_vars.woocommerce_activated?a(onboarding_vars.navigator_base+"&cpsw_call=setup-woocommerce"):window.location.replace(onboarding_vars.authorization_url)},className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-pointer"},(0,C.__)("Connect with Stripe","checkout-plugins-stripe-woo"))),(0,t.createElement)("div",{className:"mt-3 sm:mt-0 sm:ml-3"},(0,t.createElement)("a",{href:onboarding_vars.settings_url,className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-slate-300 md:py-4 md:text-lg md:px-10"},(0,C.__)("Leave onboarding process","checkout-plugins-stripe-woo"))))))};function L(){return L=Object.assign||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},L.apply(this,arguments)}function j(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function P(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return T(e,t);var n=Object.prototype.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)?T(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[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.")}return(n=e[Symbol.iterator]()).next.bind(n)}function D(e,t){if(e in t){for(var n=t[e],r=arguments.length,a=new Array(r>2?r-2:0),o=2;o<r;o++)a[o-2]=arguments[o];return"function"==typeof n?n.apply(void 0,a):n}var i=new Error('Tried to handle "'+e+'" but there is no handler defined. Only defined handlers are: '+Object.keys(t).map((function(e){return'"'+e+'"'})).join(", ")+".");throw Error.captureStackTrace&&Error.captureStackTrace(i,D),i}function A(e){var t=e.props,n=e.slot,r=e.defaultTag,a=e.features,o=e.visible,i=void 0===o||o,l=e.name;if(i)return F(t,n,r,l);var s=null!=a?a:_.None;if(s&_.Static){var c=t.static,u=void 0!==c&&c,m=j(t,["static"]);if(u)return F(m,n,r,l)}if(s&_.RenderStrategy){var d,p=t.unmount,f=void 0===p||p,b=j(t,["unmount"]);return D(f?N.Unmount:N.Hidden,((d={})[N.Unmount]=function(){return null},d[N.Hidden]=function(){return F(L({},b,{hidden:!0,style:{display:"none"}}),n,r,l)},d))}return F(t,n,r,l)}function F(e,t,r,a){var o;void 0===t&&(t={});var i=M(e,["unmount","static"]),l=i.as,s=void 0===l?r:l,c=i.children,u=i.refName,m=void 0===u?"ref":u,d=j(i,["as","children","refName"]),p=void 0!==e.ref?((o={})[m]=e.ref,o):{},f="function"==typeof c?c(t):c;if(d.className&&"function"==typeof d.className&&(d.className=d.className(t)),s===n.Fragment&&Object.keys(d).length>0){if(!(0,n.isValidElement)(f)||Array.isArray(f)&&f.length>1)throw new Error(['Passing props on "Fragment"!',"","The current component <"+a+' /> is rendering a "Fragment".',"However we need to passthrough the following props:",Object.keys(d).map((function(e){return" - "+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((function(e){return" - "+e})).join("\n")].join("\n"));return(0,n.cloneElement)(f,Object.assign({},function(e,t,n){for(var r,a=Object.assign({},e),o=function(){var n,o=r.value;void 0!==e[o]&&void 0!==t[o]&&Object.assign(a,((n={})[o]=function(n){n.defaultPrevented||e[o](n),n.defaultPrevented||t[o](n)},n))},i=P(["onClick"]);!(r=i()).done;)o();return a}(function(e){var t=Object.assign({},e);for(var n in t)void 0===t[n]&&delete t[n];return t}(M(d,["ref"])),f.props),p))}return(0,n.createElement)(s,Object.assign({},M(d,["ref"]),s!==n.Fragment&&p),f)}function I(e){var t;return Object.assign((0,n.forwardRef)(e),{displayName:null!=(t=e.displayName)?t:e.name})}function M(e,t){void 0===t&&(t=[]);for(var n,r=Object.assign({},e),a=P(t);!(n=a()).done;){var o=n.value;o in r&&delete r[o]}return r}function H(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var a=(0,n.useRef)(t);return(0,n.useEffect)((function(){a.current=t}),[t]),(0,n.useCallback)((function(e){for(var t,n=P(a.current);!(t=n()).done;){var r=t.value;null!=r&&("function"==typeof r?r(e):r.current=e)}}),[a])}function U(e){for(var t,n,r=e.parentElement,a=null;r&&!(r instanceof HTMLFieldSetElement);)r instanceof HTMLLegendElement&&(a=r),r=r.parentElement;var o=null!=(t=""===(null==(n=r)?void 0:n.getAttribute("disabled")))&&t;return(!o||!function(e){if(!e)return!1;for(var t=e.previousElementSibling;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(a))&&o}!function(e){e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static"}(_||(_={})),function(e){e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden"}(N||(N={})),function(e){e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",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"}(S||(S={}));var W="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,V={serverHandoffComplete:!1};function G(){var e=(0,n.useState)(V.serverHandoffComplete),t=e[0],r=e[1];return(0,n.useEffect)((function(){!0!==t&&r(!0)}),[t]),(0,n.useEffect)((function(){!1===V.serverHandoffComplete&&(V.serverHandoffComplete=!0)}),[]),t}var B=0;function z(){return++B}function Q(){var e=G(),t=(0,n.useState)(e?z:null),r=t[0],a=t[1];return W((function(){null===r&&a(z())}),[r]),null!=r?""+r:void 0}var q=(0,n.createContext)(null);function Y(){var e=(0,n.useContext)(q);if(null===e){var t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Y),t}return e}function K(e){var t;if(e.type)return e.type;var n=null!=(t=e.as)?t:"button";return"string"==typeof n&&"button"===n.toLowerCase()?"button":void 0}function J(e,t){var r=(0,n.useState)((function(){return K(e)})),a=r[0],o=r[1];return W((function(){o(K(e))}),[e.type,e.as]),W((function(){a||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&o("button")}),[a,t]),a}var $=(0,n.createContext)(null);function X(){var e=(0,n.useContext)($);if(null===e){var t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,X),t}return e}var Z=(0,n.createContext)(null);Z.displayName="GroupContext";var ee=n.Fragment;function te(e){var t=e.checked,r=e.onChange,a=j(e,["checked","onChange"]),o="headlessui-switch-"+Q(),i=(0,n.useContext)(Z),l=(0,n.useRef)(null),s=H(l,null===i?null:i.setSwitch),c=(0,n.useCallback)((function(){return r(!t)}),[r,t]),u=(0,n.useCallback)((function(e){if(U(e.currentTarget))return e.preventDefault();e.preventDefault(),c()}),[c]),m=(0,n.useCallback)((function(e){e.key!==S.Tab&&e.preventDefault(),e.key===S.Space&&c()}),[c]),d=(0,n.useCallback)((function(e){return e.preventDefault()}),[]),p=(0,n.useMemo)((function(){return{checked:t}}),[t]);return A({props:L({},a,{id:o,ref:s,role:"switch",type:J(e,l),tabIndex:0,"aria-checked":t,"aria-labelledby":null==i?void 0:i.labelledby,"aria-describedby":null==i?void 0:i.describedby,onClick:u,onKeyUp:m,onKeyPress:d}),slot:p,defaultTag:"button",name:"Switch"})}te.Group=function(e){var t=(0,n.useState)(null),a=t[0],o=t[1],i=function(){var e=(0,n.useState)([]),t=e[0],a=e[1];return[t.length>0?t.join(" "):void 0,(0,n.useMemo)((function(){return function(e){var t=(0,n.useCallback)((function(e){return a((function(t){return[].concat(t,[e])})),function(){return a((function(t){var n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))}}),[]),o=(0,n.useMemo)((function(){return{register:t,slot:e.slot,name:e.name,props:e.props}}),[t,e.slot,e.name,e.props]);return r().createElement($.Provider,{value:o},e.children)}}),[a])]}(),l=i[0],s=i[1],c=function(){var e=(0,n.useState)([]),t=e[0],a=e[1];return[t.length>0?t.join(" "):void 0,(0,n.useMemo)((function(){return function(e){var t=(0,n.useCallback)((function(e){return a((function(t){return[].concat(t,[e])})),function(){return a((function(t){var n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))}}),[]),o=(0,n.useMemo)((function(){return{register:t,slot:e.slot,name:e.name,props:e.props}}),[t,e.slot,e.name,e.props]);return r().createElement(q.Provider,{value:o},e.children)}}),[a])]}(),u=c[0],m=c[1],d=(0,n.useMemo)((function(){return{switch:a,setSwitch:o,labelledby:l,describedby:u}}),[a,o,l,u]);return r().createElement(m,{name:"Switch.Description"},r().createElement(s,{name:"Switch.Label",props:{onClick:function(){a&&(a.click(),a.focus({preventScroll:!0}))}}},r().createElement(Z.Provider,{value:d},A({props:e,defaultTag:ee,name:"Switch.Group"}))))},te.Label=function(e){var t=e.passive,n=void 0!==t&&t,r=j(e,["passive"]),a=X(),o="headlessui-label-"+Q();W((function(){return a.register(o)}),[o,a.register]);var i=L({},a.props,{id:o}),l=L({},r,i);return n&&delete l.onClick,A({props:l,slot:a.slot||{},defaultTag:"label",name:a.name||"Label"})},te.Description=function(e){var t=Y(),n="headlessui-description-"+Q();W((function(){return t.register(n)}),[n,t.register]);var r=e,a=L({},t.props,{id:n});return A({props:L({},r,a),slot:t.slot||{},defaultTag:"p",name:t.name||"Description"})};var ne=window.wp.apiFetch,re=e.n(ne);function ae(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(Boolean).join(" ")}var oe,ie,le,se,ce=function(){const[e,r]=(0,n.useState)(!1),[a,o]=(0,n.useState)(onboarding_vars.available_gateways),i=h();return(0,t.createElement)("main",{className:"mt-4 mb-4 mx-auto w-auto max-w-7xl px-4 sm:mt-6 sm:px-6 md:mt-8 lg:mt-10 lg:px-8 xl:mt-16"},(0,t.createElement)("div",{className:"text-center"},(0,t.createElement)("p",{className:"mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:mx-auto md:mt-5 md:text-xl lg:mx-0"},(0,t.createElement)("span",{className:"block"},(0,t.createElement)("span",{className:"text-gray-700 inline font-bold"},(0,C.__)("Congratulations!!","checkout-plugins-stripe-woo")," "),(0,C.__)("You are connected to Stripe successfully.","checkout-plugins-stripe-woo")),(0,t.createElement)("span",{className:"block"},(0,C.__)("Let's enable gateways","checkout-plugins-stripe-woo"))),(0,t.createElement)("ul",{role:"list",className:"divide-y divide-gray-200 bg-white overflow-hidden sm:rounded-md mt-10 max-w-screen-md mx-auto"},a.map((e=>(0,t.createElement)("li",{key:e.id},(0,t.createElement)("span",{href:"#",className:"block hover:bg-gray-50"},(0,t.createElement)("div",{className:"flex items-center px-4 py-4 sm:px-6"},(0,t.createElement)("div",{className:"min-w-0 flex-1 flex items-center"},(0,t.createElement)("div",{className:"flex-shrink-0"},(0,t.createElement)("img",{className:"h-12 w-32 max-w-80",src:e.icon,alt:e.name})),(0,t.createElement)("div",{className:"min-w-0 flex-1 px-4 md:gap-4"},(0,t.createElement)("div",null,(0,t.createElement)("p",{className:"text-sm font-medium text-cart-500 flex truncate"},e.name," ",e.recommended?(0,t.createElement)("span",{className:"ml-2 px-2 py-1 text-green-800 text-xs font-medium bg-green-100 rounded-full"},(0,C.__)("Recommended","checkout-plugins-stripe-woo")):""),(0,t.createElement)("p",{className:"text-sm font-medium text-gray-400 flex"},(0,t.createElement)("span",{className:"text-left text-sm"},"all"===e.currencies?(0,C.__)("Works with all currencies","checkout-plugins-stripe-woo"):(0,C.__)("Works with ","checkout-plugins-stripe-woo")+e.currencies))))),(0,t.createElement)("div",null,(0,t.createElement)(te,{checked:e.enabled,value:e.enabled,name:e.id,onChange:()=>{e.enabled=!e.enabled,o([...a])},className:ae(e.enabled?"bg-cart-500 ":"bg-gray-200","relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-cart-500")},(0,t.createElement)("span",{className:"sr-only"},e.id),(0,t.createElement)("span",{"aria-hidden":"true",className:ae(e.enabled?"translate-x-5":"translate-x-0","pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow transform ring-0 transition ease-in-out duration-200")}))))))))),(0,t.createElement)("div",{className:"mt-5 sm:mt-8 sm:inline-block lg:inline-block sm:justify-center lg:justify-center"},(0,t.createElement)("div",{className:"rounded-md shadow"},e?(0,t.createElement)("button",{className:"disabled w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-wait"},(0,C.__)("Enabling…","checkout-plugins-stripe-woo"),(0,t.createElement)(O,null)):(0,t.createElement)("button",{onClick:function(e){e.preventDefault(),r(!0);const t=new window.FormData,n={};a.forEach((function(e){n[e.id]=document.getElementsByName(e.id)[0].value}));const o=JSON.stringify(n);t.append("formdata",o),t.append("action","cpsw_onboarding_enable_gateway"),t.append("security",onboarding_vars.cpsw_onboarding_enable_gateway),re()({url:onboarding_vars.ajax_url,method:"POST",body:t}).then((e=>{e.success&&(!0===e.data.activated_gateways.cpsw_stripe?i(onboarding_vars.navigator_base+"&cpsw_call=express-checkout"):i(onboarding_vars.navigator_base+"&cpsw_call=webhooks"))}))},className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-pointer"},(0,C.__)("Enable Gateways","checkout-plugins-stripe-woo"))))))},ue=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((function(e){return e+":not([tabindex='-1'])"})).join(",");!function(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"}(oe||(oe={})),function(e){e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow"}(ie||(ie={})),function(e){e[e.Previous=-1]="Previous",e[e.Next=1]="Next"}(le||(le={})),function(e){e[e.Strict=0]="Strict",e[e.Loose=1]="Loose"}(se||(se={}));var me,de,pe,fe,be,ve=(0,n.createContext)(null);function xe(){return(0,n.useContext)(ve)}function ge(e){var t=e.value,n=e.children;return r().createElement(ve.Provider,{value:t},n)}function he(){var e=[],t={requestAnimationFrame:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=requestAnimationFrame.apply(void 0,arguments);t.add((function(){return cancelAnimationFrame(e)}))})),nextFrame:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t.requestAnimationFrame((function(){t.requestAnimationFrame.apply(t,n)}))},setTimeout:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){var e=setTimeout.apply(void 0,arguments);t.add((function(){return clearTimeout(e)}))})),add:function(t){e.push(t)},dispose:function(){for(var t,n=P(e.splice(0));!(t=n()).done;){(0,t.value)()}}};return t}function we(){var e=(0,n.useState)(he)[0];return(0,n.useEffect)((function(){return function(){return e.dispose()}}),[e]),e}function ye(e,t){var r=(0,n.useState)(e),a=r[0],o=r[1],i=(0,n.useRef)(e);return W((function(){i.current=e}),[e]),W((function(){return o(i.current)}),[i,o].concat(t)),a}ve.displayName="OpenClosedContext",function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(me||(me={})),function(e){e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing"}(de||(de={})),function(e){e[e.Open=0]="Open",e[e.Closed=1]="Closed"}(fe||(fe={})),function(e){e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.SetDisabled=2]="SetDisabled",e[e.SetOrientation=3]="SetOrientation",e[e.GoToOption=4]="GoToOption",e[e.Search=5]="Search",e[e.ClearSearch=6]="ClearSearch",e[e.RegisterOption=7]="RegisterOption",e[e.UnregisterOption=8]="UnregisterOption"}(be||(be={}));var Ee=((pe={})[be.CloseListbox]=function(e){return e.disabled||e.listboxState===fe.Closed?e:L({},e,{activeOptionIndex:null,listboxState:fe.Closed})},pe[be.OpenListbox]=function(e){return e.disabled||e.listboxState===fe.Open?e:L({},e,{listboxState:fe.Open})},pe[be.SetDisabled]=function(e,t){return e.disabled===t.disabled?e:L({},e,{disabled:t.disabled})},pe[be.SetOrientation]=function(e,t){return e.orientation===t.orientation?e:L({},e,{orientation:t.orientation})},pe[be.GoToOption]=function(e,t){if(e.disabled)return e;if(e.listboxState===fe.Closed)return e;var n=function(e,t){var n=t.resolveItems();if(n.length<=0)return null;var r=t.resolveActiveIndex(),a=null!=r?r:-1,o=function(){switch(e.focus){case de.First:return n.findIndex((function(e){return!t.resolveDisabled(e)}));case de.Previous:var r=n.slice().reverse().findIndex((function(e,n,r){return!(-1!==a&&r.length-n-1>=a||t.resolveDisabled(e))}));return-1===r?r:n.length-1-r;case de.Next:return n.findIndex((function(e,n){return!(n<=a||t.resolveDisabled(e))}));case de.Last:var o=n.slice().reverse().findIndex((function(e){return!t.resolveDisabled(e)}));return-1===o?o:n.length-1-o;case de.Specific:return n.findIndex((function(n){return t.resolveId(n)===e.id}));case de.Nothing:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}}();return-1===o?r:o}(t,{resolveItems:function(){return e.options},resolveActiveIndex:function(){return e.activeOptionIndex},resolveId:function(e){return e.id},resolveDisabled:function(e){return e.dataRef.current.disabled}});return""===e.searchQuery&&e.activeOptionIndex===n?e:L({},e,{searchQuery:"",activeOptionIndex:n})},pe[be.Search]=function(e,t){if(e.disabled)return e;if(e.listboxState===fe.Closed)return e;var n=e.searchQuery+t.value.toLowerCase(),r=e.options.findIndex((function(e){var t;return!e.dataRef.current.disabled&&(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(n))}));return-1===r||r===e.activeOptionIndex?L({},e,{searchQuery:n}):L({},e,{searchQuery:n,activeOptionIndex:r})},pe[be.ClearSearch]=function(e){return e.disabled||e.listboxState===fe.Closed||""===e.searchQuery?e:L({},e,{searchQuery:""})},pe[be.RegisterOption]=function(e,t){return L({},e,{options:[].concat(e.options,[{id:t.id,dataRef:t.dataRef}])})},pe[be.UnregisterOption]=function(e,t){var n=e.options.slice(),r=null!==e.activeOptionIndex?n[e.activeOptionIndex]:null,a=n.findIndex((function(e){return e.id===t.id}));return-1!==a&&n.splice(a,1),L({},e,{options:n,activeOptionIndex:a===e.activeOptionIndex||null===r?null:n.indexOf(r)})},pe),ke=(0,n.createContext)(null);function _e(e){var t=(0,n.useContext)(ke);if(null===t){var r=new Error("<"+e+" /> is missing a parent <"+Ce.name+" /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(r,_e),r}return t}function Ne(e,t){return D(t.type,Ee,e,t)}ke.displayName="ListboxContext";var Se=n.Fragment;function Ce(e){var t,a,o,i,l,s=e.value,c=e.onChange,u=e.disabled,m=void 0!==u&&u,d=e.horizontal,p=void 0!==d&&d,f=j(e,["value","onChange","disabled","horizontal"]),b=p?"horizontal":"vertical",v=(0,n.useReducer)(Ne,{listboxState:fe.Closed,propsRef:{current:{value:s,onChange:c}},labelRef:(0,n.createRef)(),buttonRef:(0,n.createRef)(),optionsRef:(0,n.createRef)(),disabled:m,orientation:b,options:[],searchQuery:"",activeOptionIndex:null}),x=v[0],g=x.listboxState,h=x.propsRef,w=x.optionsRef,y=x.buttonRef,E=v[1];W((function(){h.current.value=s}),[s,h]),W((function(){h.current.onChange=c}),[c,h]),W((function(){return E({type:be.SetDisabled,disabled:m})}),[m]),W((function(){return E({type:be.SetOrientation,orientation:b})}),[b]),a="mousedown",o=function(e){var t,n,r,a=e.target;g===fe.Open&&((null==(t=y.current)?void 0:t.contains(a))||(null==(n=w.current)?void 0:n.contains(a))||(E({type:be.CloseListbox}),function(e,t){var n;return void 0===t&&(t=se.Strict),e!==document.body&&D(t,((n={})[se.Strict]=function(){return e.matches(ue)},n[se.Loose]=function(){for(var t=e;null!==t;){if(t.matches(ue))return!0;t=t.parentElement}return!1},n))}(a,se.Loose)||(e.preventDefault(),null==(r=y.current)||r.focus())))},(l=(0,n.useRef)(o)).current=o,(0,n.useEffect)((function(){function e(e){l.current.call(window,e)}return window.addEventListener(a,e,i),function(){return window.removeEventListener(a,e,i)}}),[a,i]);var k=(0,n.useMemo)((function(){return{open:g===fe.Open,disabled:m}}),[g,m]);return r().createElement(ke.Provider,{value:v},r().createElement(ge,{value:D(g,(t={},t[fe.Open]=me.Open,t[fe.Closed]=me.Closed,t))},A({props:f,slot:k,defaultTag:Se,name:"Listbox"})))}var Oe,Re=I((function e(t,r){var a,o=_e([Ce.name,e.name].join(".")),i=o[0],l=o[1],s=H(i.buttonRef,r),c="headlessui-listbox-button-"+Q(),u=we(),m=(0,n.useCallback)((function(e){switch(e.key){case S.Space:case S.Enter:case S.ArrowDown:e.preventDefault(),l({type:be.OpenListbox}),u.nextFrame((function(){i.propsRef.current.value||l({type:be.GoToOption,focus:de.First})}));break;case S.ArrowUp:e.preventDefault(),l({type:be.OpenListbox}),u.nextFrame((function(){i.propsRef.current.value||l({type:be.GoToOption,focus:de.Last})}))}}),[l,i,u]),d=(0,n.useCallback)((function(e){e.key===S.Space&&e.preventDefault()}),[]),p=(0,n.useCallback)((function(e){if(U(e.currentTarget))return e.preventDefault();i.listboxState===fe.Open?(l({type:be.CloseListbox}),u.nextFrame((function(){var e;return null==(e=i.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),l({type:be.OpenListbox}))}),[l,u,i]),f=ye((function(){if(i.labelRef.current)return[i.labelRef.current.id,c].join(" ")}),[i.labelRef.current,c]),b=(0,n.useMemo)((function(){return{open:i.listboxState===fe.Open,disabled:i.disabled}}),[i]);return A({props:L({},t,{ref:s,id:c,type:J(t,i.buttonRef),"aria-haspopup":!0,"aria-controls":null==(a=i.optionsRef.current)?void 0:a.id,"aria-expanded":i.disabled?void 0:i.listboxState===fe.Open,"aria-labelledby":f,disabled:i.disabled,onKeyDown:m,onKeyUp:d,onClick:p}),slot:b,defaultTag:"button",name:"Listbox.Button"})})),Le=_.RenderStrategy|_.Static,je=I((function e(t,r){var a,o=_e([Ce.name,e.name].join(".")),i=o[0],l=o[1],s=H(i.optionsRef,r),c="headlessui-listbox-options-"+Q(),u=we(),m=we(),d=xe(),p=null!==d?d===me.Open:i.listboxState===fe.Open;W((function(){var e=i.optionsRef.current;e&&i.listboxState===fe.Open&&e!==document.activeElement&&e.focus({preventScroll:!0})}),[i.listboxState,i.optionsRef]);var f=(0,n.useCallback)((function(e){switch(m.dispose(),e.key){case S.Space:if(""!==i.searchQuery)return e.preventDefault(),e.stopPropagation(),l({type:be.Search,value:e.key});case S.Enter:if(e.preventDefault(),e.stopPropagation(),l({type:be.CloseListbox}),null!==i.activeOptionIndex){var t=i.options[i.activeOptionIndex].dataRef;i.propsRef.current.onChange(t.current.value)}he().nextFrame((function(){var e;return null==(e=i.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case D(i.orientation,{vertical:S.ArrowDown,horizontal:S.ArrowRight}):return e.preventDefault(),e.stopPropagation(),l({type:be.GoToOption,focus:de.Next});case D(i.orientation,{vertical:S.ArrowUp,horizontal:S.ArrowLeft}):return e.preventDefault(),e.stopPropagation(),l({type:be.GoToOption,focus:de.Previous});case S.Home:case S.PageUp:return e.preventDefault(),e.stopPropagation(),l({type:be.GoToOption,focus:de.First});case S.End:case S.PageDown:return e.preventDefault(),e.stopPropagation(),l({type:be.GoToOption,focus:de.Last});case S.Escape:return e.preventDefault(),e.stopPropagation(),l({type:be.CloseListbox}),u.nextFrame((function(){var e;return null==(e=i.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case S.Tab:e.preventDefault(),e.stopPropagation();break;default:1===e.key.length&&(l({type:be.Search,value:e.key}),m.setTimeout((function(){return l({type:be.ClearSearch})}),350))}}),[u,l,m,i]),b=ye((function(){var e,t,n;return null!=(e=null==(t=i.labelRef.current)?void 0:t.id)?e:null==(n=i.buttonRef.current)?void 0:n.id}),[i.labelRef.current,i.buttonRef.current]),v=(0,n.useMemo)((function(){return{open:i.listboxState===fe.Open}}),[i]);return A({props:L({},t,{"aria-activedescendant":null===i.activeOptionIndex||null==(a=i.options[i.activeOptionIndex])?void 0:a.id,"aria-labelledby":b,"aria-orientation":i.orientation,id:c,onKeyDown:f,role:"listbox",tabIndex:0,ref:s}),slot:v,defaultTag:"ul",features:Le,visible:p,name:"Listbox.Options"})}));function Te(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];e&&r.length>0&&(t=e.classList).add.apply(t,r)}function Pe(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];e&&r.length>0&&(t=e.classList).remove.apply(t,r)}function De(e,t,n,r,a,o){var i=he(),l=void 0!==o?function(e){var t={called:!1};return function(){if(!t.called)return t.called=!0,e.apply(void 0,arguments)}}(o):function(){};return Pe.apply(void 0,[e].concat(a)),Te.apply(void 0,[e].concat(t,n)),i.nextFrame((function(){Pe.apply(void 0,[e].concat(n)),Te.apply(void 0,[e].concat(r)),i.add(function(e,t){var n=he();if(!e)return n.dispose;var r=getComputedStyle(e),a=[r.transitionDuration,r.transitionDelay].map((function(e){var t=e.split(",").filter(Boolean).map((function(e){return e.includes("ms")?parseFloat(e):1e3*parseFloat(e)})).sort((function(e,t){return t-e}))[0];return void 0===t?0:t})),o=a[0],i=a[1];return 0!==o?n.setTimeout((function(){t(Oe.Finished)}),o+i):t(Oe.Finished),n.add((function(){return t(Oe.Cancelled)})),n.dispose}(e,(function(n){return Pe.apply(void 0,[e].concat(r,t)),Te.apply(void 0,[e].concat(a)),l(n)})))})),i.add((function(){return Pe.apply(void 0,[e].concat(t,n,r,a))})),i.add((function(){return l(Oe.Cancelled)})),i.dispose}function Ae(e){return void 0===e&&(e=""),(0,n.useMemo)((function(){return e.split(" ").filter((function(e){return e.trim().length>1}))}),[e])}Ce.Button=Re,Ce.Label=function e(t){var r=_e([Ce.name,e.name].join("."))[0],a="headlessui-listbox-label-"+Q(),o=(0,n.useCallback)((function(){var e;return null==(e=r.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[r.buttonRef]),i=(0,n.useMemo)((function(){return{open:r.listboxState===fe.Open,disabled:r.disabled}}),[r]);return A({props:L({},t,{ref:r.labelRef,id:a,onClick:o}),slot:i,defaultTag:"label",name:"Listbox.Label"})},Ce.Options=je,Ce.Option=function e(t){var r=t.disabled,a=void 0!==r&&r,o=t.value,i=j(t,["disabled","value"]),l=_e([Ce.name,e.name].join(".")),s=l[0],c=l[1],u="headlessui-listbox-option-"+Q(),m=null!==s.activeOptionIndex&&s.options[s.activeOptionIndex].id===u,d=s.propsRef.current.value===o,p=(0,n.useRef)({disabled:a,value:o});W((function(){p.current.disabled=a}),[p,a]),W((function(){p.current.value=o}),[p,o]),W((function(){var e,t;p.current.textValue=null==(e=document.getElementById(u))||null==(t=e.textContent)?void 0:t.toLowerCase()}),[p,u]);var f=(0,n.useCallback)((function(){return s.propsRef.current.onChange(o)}),[s.propsRef,o]);W((function(){return c({type:be.RegisterOption,id:u,dataRef:p}),function(){return c({type:be.UnregisterOption,id:u})}}),[p,u]),W((function(){var e;s.listboxState===fe.Open&&d&&(c({type:be.GoToOption,focus:de.Specific,id:u}),null==(e=document.getElementById(u))||null==e.focus||e.focus())}),[s.listboxState]),W((function(){if(s.listboxState===fe.Open&&m){var e=he();return e.nextFrame((function(){var e;return null==(e=document.getElementById(u))||null==e.scrollIntoView?void 0:e.scrollIntoView({block:"nearest"})})),e.dispose}}),[u,m,s.listboxState]);var b=(0,n.useCallback)((function(e){if(a)return e.preventDefault();f(),c({type:be.CloseListbox}),he().nextFrame((function(){var e;return null==(e=s.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[c,s.buttonRef,a,f]),v=(0,n.useCallback)((function(){if(a)return c({type:be.GoToOption,focus:de.Nothing});c({type:be.GoToOption,focus:de.Specific,id:u})}),[a,u,c]),x=(0,n.useCallback)((function(){a||m||c({type:be.GoToOption,focus:de.Specific,id:u})}),[a,m,u,c]),g=(0,n.useCallback)((function(){a||m&&c({type:be.GoToOption,focus:de.Nothing})}),[a,m,c]),h=(0,n.useMemo)((function(){return{active:m,selected:d,disabled:a}}),[m,d,a]);return A({props:L({},i,{id:u,role:"option",tabIndex:!0===a?void 0:-1,"aria-disabled":!0===a||void 0,"aria-selected":!0===d||void 0,disabled:void 0,onClick:b,onFocus:v,onPointerMove:x,onMouseMove:x,onPointerLeave:g,onMouseLeave:g}),slot:h,defaultTag:"li",name:"Listbox.Option"})},function(e){e.Finished="finished",e.Cancelled="cancelled"}(Oe||(Oe={}));var Fe,Ie=(0,n.createContext)(null);Ie.displayName="TransitionContext",function(e){e.Visible="visible",e.Hidden="hidden"}(Fe||(Fe={}));var Me=(0,n.createContext)(null);function He(e){return"children"in e?He(e.children):e.current.filter((function(e){return e.state===Fe.Visible})).length>0}function Ue(e){var t=(0,n.useRef)(e),r=(0,n.useRef)([]),a=function(){var e=(0,n.useRef)(!1);return(0,n.useEffect)((function(){return e.current=!0,function(){e.current=!1}}),[]),e}();(0,n.useEffect)((function(){t.current=e}),[e]);var o=(0,n.useCallback)((function(e,n){var o;void 0===n&&(n=N.Hidden);var i=r.current.findIndex((function(t){return t.id===e}));-1!==i&&(D(n,((o={})[N.Unmount]=function(){r.current.splice(i,1)},o[N.Hidden]=function(){r.current[i].state=Fe.Hidden},o)),!He(r)&&a.current&&(null==t.current||t.current()))}),[t,a,r]),i=(0,n.useCallback)((function(e){var t=r.current.find((function(t){return t.id===e}));return t?t.state!==Fe.Visible&&(t.state=Fe.Visible):r.current.push({id:e,state:Fe.Visible}),function(){return o(e,N.Unmount)}}),[r,o]);return(0,n.useMemo)((function(){return{children:r,register:i,unregister:o}}),[i,o,r])}function We(){}Me.displayName="NestingContext";var Ve=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Ge(e){for(var t,n={},r=P(Ve);!(t=r()).done;){var a,o=t.value;n[o]=null!=(a=e[o])?a:We}return n}var Be=_.RenderStrategy;function ze(e){var t,a=e.beforeEnter,o=e.afterEnter,i=e.beforeLeave,l=e.afterLeave,s=e.enter,c=e.enterFrom,u=e.enterTo,m=e.entered,d=e.leave,p=e.leaveFrom,f=e.leaveTo,b=j(e,["beforeEnter","afterEnter","beforeLeave","afterLeave","enter","enterFrom","enterTo","entered","leave","leaveFrom","leaveTo"]),v=(0,n.useRef)(null),x=(0,n.useState)(Fe.Visible),g=x[0],h=x[1],w=b.unmount?N.Unmount:N.Hidden,y=function(){var e=(0,n.useContext)(Ie);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),E=y.show,k=y.appear,_=y.initial,S=function(){var e=(0,n.useContext)(Me);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),C=S.register,O=S.unregister,R=Q(),T=(0,n.useRef)(!1),P=Ue((function(){T.current||(h(Fe.Hidden),O(R),z.current.afterLeave())}));W((function(){if(R)return C(R)}),[C,R]),W((function(){var e;w===N.Hidden&&R&&(E&&g!==Fe.Visible?h(Fe.Visible):D(g,((e={})[Fe.Hidden]=function(){return O(R)},e[Fe.Visible]=function(){return C(R)},e)))}),[g,R,C,O,E,w]);var F=Ae(s),I=Ae(c),M=Ae(u),H=Ae(m),U=Ae(d),V=Ae(p),B=Ae(f),z=function(e){var t=(0,n.useRef)(Ge(e));return(0,n.useEffect)((function(){t.current=Ge(e)}),[e]),t}({beforeEnter:a,afterEnter:o,beforeLeave:i,afterLeave:l}),q=G();(0,n.useEffect)((function(){if(q&&g===Fe.Visible&&null===v.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[v,g,q]);var Y=_&&!k;W((function(){var e=v.current;if(e&&!Y)return T.current=!0,E&&z.current.beforeEnter(),E||z.current.beforeLeave(),E?De(e,F,I,M,H,(function(e){T.current=!1,e===Oe.Finished&&z.current.afterEnter()})):De(e,U,V,B,H,(function(e){T.current=!1,e===Oe.Finished&&(He(P)||(h(Fe.Hidden),O(R),z.current.afterLeave()))}))}),[z,R,T,O,P,v,Y,E,F,I,M,U,V,B]);var K={ref:v},J=b;return r().createElement(Me.Provider,{value:P},r().createElement(ge,{value:D(g,(t={},t[Fe.Visible]=me.Open,t[Fe.Hidden]=me.Closed,t))},A({props:L({},J,K),defaultTag:"div",features:Be,visible:g===Fe.Visible,name:"Transition.Child"})))}function Qe(e){var t,a=e.show,o=e.appear,i=void 0!==o&&o,l=e.unmount,s=j(e,["show","appear","unmount"]),c=xe();if(void 0===a&&null!==c&&(a=D(c,((t={})[me.Open]=!0,t[me.Closed]=!1,t))),![!0,!1].includes(a))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");var u=(0,n.useState)(a?Fe.Visible:Fe.Hidden),m=u[0],d=u[1],p=Ue((function(){d(Fe.Hidden)})),f=function(){var e=(0,n.useRef)(!0);return(0,n.useEffect)((function(){e.current=!1}),[]),e.current}(),b=(0,n.useMemo)((function(){return{show:a,appear:i||!f,initial:f}}),[a,i,f]);(0,n.useEffect)((function(){a?d(Fe.Visible):He(p)||d(Fe.Hidden)}),[a,p]);var v={unmount:l};return r().createElement(Me.Provider,{value:p},r().createElement(Ie.Provider,{value:b},A({props:L({},v,{as:n.Fragment,children:r().createElement(ze,Object.assign({},v,s))}),defaultTag:n.Fragment,features:Be,visible:m===Fe.Visible,name:"Transition"})))}Qe.Child=function(e){var t=null!==(0,n.useContext)(Ie),a=null!==xe();return!t&&a?r().createElement(Qe,Object.assign({},e)):r().createElement(ze,Object.assign({},e))},Qe.Root=Qe;var qe=function(){const[e,r]=(0,n.useState)(!1),[a,o]=(0,n.useState)(onboarding_vars.get_webhook_secret),i=[{id:"test",name:(0,C.__)("Test","cart-plugin")},{id:"live",name:(0,C.__)("Live","cart-plugin")}],l=Object.keys(i).find((e=>i[e].id===onboarding_vars.get_payment_mode)),[s,c]=(0,n.useState)(i[l]),u=h();return(0,t.createElement)("main",{className:"mt-4 mb-4 mx-auto w-auto max-w-7xl px-4 sm:mt-6 sm:px-6 md:mt-8 lg:mt-10 lg:px-8 xl:mt-16"},(0,t.createElement)("div",{className:"text-center"},(0,t.createElement)("h1",{className:"text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl"},(0,t.createElement)("span",{className:"block text-cart-500 xl:inline"},(0,C.__)("This is important!!","checkout-plugins-stripe-woo"))),(0,t.createElement)("h3",{className:"text-2xl tracking-tight mt-5 font-bold text-gray-700"},(0,t.createElement)("span",{className:"block xl:inline"},(0,C.__)("Enable Webhooks","checkout-plugins-stripe-woo"))),(0,t.createElement)("p",{className:"mt-2 text-sm mb-5 text-gray-500 sm:mt-2 sm:text-xl sm:mx-auto md:mt-2 md:text-xl lg:mx-0"},(0,t.createElement)("span",{className:"block xl:inline font-bold select-none text-gray-700"},(0,C.__)("Webhook URL","checkout-plugins-stripe-woo"),": ")," ",(0,t.createElement)("span",{className:"block xl:inline font-bold select-text"},onboarding_vars.webhook_url)),(0,t.createElement)("div",{className:"block mx-auto mt-2 mb-5 w-full md:w-6/12 lg:w-6/12"},(0,t.createElement)("p",{className:"mt-2 text-sm text-gray-400 sm:mt-2 sm:text-sm sm:mx-auto md:mt-2 md:text-md lg:mx-0"},(0,t.createElement)("span",{className:"block"}," ",(0,C.__)("The webhook URL is called by","checkout-plugins-stripe-woo")," ",(0,t.createElement)("span",{className:"block text-gray-700 xl:inline font-bold"},(0,C.__)("Stripe","checkout-plugins-stripe-woo"),","),(0,C.__)(" when events occur in your account, like a source becomes chargeable.","checkout-plugins-stripe-woo")," ",(0,t.createElement)("a",{href:"https://checkoutplugins.com/docs/stripe-card-payments/#webhook",target:"_blank",rel:"noreferrer"},(0,t.createElement)("span",{className:"block xl:inline font-bold text-cart-500"},(0,C.__)("Webhook Guide","checkout-plugins-stripe-woo")))," ",(0,C.__)("or create webhook secret on","checkout-plugins-stripe-woo")," ",(0,t.createElement)("a",{href:"https://dashboard.stripe.com/webhooks/create",target:"_blank",rel:"noreferrer"},(0,t.createElement)("span",{className:"block text-cart-500 xl:inline font-bold"},(0,C.__)("Stripe Dashboard","checkout-plugins-stripe-woo"))),".")),(0,t.createElement)("p",{className:"text-left mt-3 text-sm text-gray-400 sm:mt-5 sm:text-sm sm:mx-auto md:mt-5 md:text-md lg:mx-0"},(0,t.createElement)("span",{className:"block text-gray-700 xl:inline font-bold"}," ",(0,C.__)("This is the list of the supported webhook events: ","checkout-plugins-stripe-woo")," ")),(0,t.createElement)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-1 text-left"},(0,t.createElement)("div",null,(0,t.createElement)("ul",{className:"list-disc mt-3 pl-4 text-sm text-gray-400"},(0,t.createElement)("li",null,"charge.captured"),(0,t.createElement)("li",null,"charge.refunded"),(0,t.createElement)("li",null,"charge.dispute.created"),(0,t.createElement)("li",null,"charge.dispute.closed"),(0,t.createElement)("li",null,"payment_intent.succeeded"))),(0,t.createElement)("div",null,(0,t.createElement)("ul",{className:"list-disc md:mt-3 lg:mt-3 pl-4 text-sm text-gray-400"},(0,t.createElement)("li",null,"payment_intent.amount_capturable_updated"),(0,t.createElement)("li",null,"payment_intent.payment_failed"),(0,t.createElement)("li",null,"review.opened"),(0,t.createElement)("li",null,"review.closed"))))),(0,t.createElement)("div",{className:"block mx-auto mt-5 mb-5 w-full md:w-6/12 lg:w-6/12"},(0,t.createElement)("span",{className:"block text-gray-700 font-bold text-left"},(0,C.__)("Select Mode","checkout-plugins-stripe-woo")),(0,t.createElement)(Ce,{value:s,onChange:c},(0,t.createElement)("div",{className:"relative mt-1"},(0,t.createElement)(Ce.Button,{className:"relative w-full py-2 pl-3 pr-10 h-12 text-left bg-white rounded appearance-none border shadow cursor-default focus:outline-none focus-visible:ring-2 focus-visible:ring-opacity-75 focus-visible:ring-white focus-visible:ring-offset-orange-300 focus-visible:ring-offset-2 focus-visible:border-indigo-500 sm:text-sm"},(0,t.createElement)("span",{className:"block truncate"},s.name),(0,t.createElement)("span",{className:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"},(0,t.createElement)("span",{className:"dashicons dashicons-arrow-down-alt2"}))),(0,t.createElement)(Qe,{as:n.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0"},(0,t.createElement)(Ce.Options,{className:"absolute w-full py-1 mt-1 z-40 text-left overflow-auto text-base bg-white rounded border shadow max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"},i.map(((e,r)=>(0,t.createElement)(Ce.Option,{key:r,className:e=>{let{active:t}=e;return(t?" text-gray-500 bg-wpcolor":"text-gray-900")+"\n\t\t\t\t\t\t\t\tcursor-default select-none relative py-1 pl-4"},value:e},(r=>{let{active:a}=r;return(0,t.createElement)(n.Fragment,null,(0,t.createElement)("span",{className:(s?"font-medium":"font-normal")+" block"},e.name),s?(0,t.createElement)("span",{className:(a?"text-wpcolor":"text-wpcolor20")+"\n\t\t\t\t\t\t\t\t\t\tabsolute inset-y-0 left-0 flex items-center pl-3"}):null)})))))))),(0,t.createElement)("input",{type:"hidden",name:"cpsw_mode",id:"cpsw_mode",value:s.id})),(0,t.createElement)("div",{className:"w-full md:w-6/12 lg:w-6/12 block mx-auto mt-5 mb-5"},(0,t.createElement)("span",{className:"block text-gray-700 font-bold text-left"},s.name," ",(0,C.__)("Webhook Secret","checkout-plugins-stripe-woo")),(0,t.createElement)("p",{className:"mt-2 text-sm text-gray-400 sm:mt-2 sm:text-sm sm:mx-auto md:mt-2 md:text-md lg:mx-0"},(0,t.createElement)("input",{type:"text",value:a,onChange:function(e){o(e.target.value)},name:"webhook_secret",id:"cpsw_webhook_secret",placeholder:(0,C.__)("Enter key here","checkout-plugins-stripe-woo"),className:"w-full shadow appearance-none border rounded h-12 py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"}),(0,t.createElement)("span",{className:"block mt-3"}," ",(0,C.__)("The webhook secret is used to authenticate webhooks sent from Stripe. It ensures nobody else can send you events pretending to be Stripe","checkout-plugins-stripe-woo"),"."))),(0,t.createElement)("div",{className:"sm:inline-block lg:inline-block sm:justify-center lg:justify-center"},(0,t.createElement)("div",{className:"rounded-md shadow"},e?(0,t.createElement)("button",{className:"disabled w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-wait"},(0,C.__)("Saving…","checkout-plugins-stripe-woo"),(0,t.createElement)(O,null)):(0,t.createElement)("button",{onClick:function(){const e=new window.FormData;e.append("action","cpsw_onboarding_enable_webhooks");const t=document.getElementById("cpsw_webhook_secret").value,n=document.getElementById("cpsw_mode").value;if(""===t)return window.alert((0,C.__)("Webhook Secret field is Required.","checkout-plugins-stripe-woo")),!1;r(!0),e.append("webhook_secret",t),e.append("cpsw_mode",n),e.append("security",onboarding_vars.cpsw_onboarding_enable_webhooks),re()({url:onboarding_vars.ajax_url,method:"POST",body:e}).then((e=>{e.success&&u(onboarding_vars.navigator_base+"&cpsw_call=thank-you")}))},className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-pointer"},(0,C.__)("Save & Continue","checkout-plugins-stripe-woo"))),(0,t.createElement)("div",{className:"mt-3 sm:mt-0"},(0,t.createElement)("a",{href:onboarding_vars.base_url+"&cpsw_call=thank-you",className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-slate-300 md:py-4 md:text-lg md:px-10"},(0,C.__)("Skip","checkout-plugins-stripe-woo"))))))},Ye=function(){const[e,r]=(0,n.useState)(!1),a=h();return(0,t.createElement)("main",{className:"mt-10 mx-auto w-auto max-w-7xl px-4 sm:mt-12 sm:px-6 md:mt-16 lg:mt-20 lg:px-8 xl:mt-28"},(0,t.createElement)("div",{className:"text-center"},(0,t.createElement)("h1",{className:"text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl"},(0,t.createElement)("span",{className:"block xl"},(0,C.__)("Wooho!!","checkout-plugins-stripe-woo")),(0,t.createElement)("span",{className:"block text-cart-500 xl:inline"},(0,C.__)("You are almost done.","checkout-plugins-stripe-woo"))),(0,t.createElement)("p",{className:"mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:mx-auto md:mt-5 md:text-xl lg:mx-0"},(0,t.createElement)("span",{className:"block"}," ",(0,C.__)("Since you have enabled","checkout-plugins-stripe-woo")," ",(0,t.createElement)("span",{className:"block text-gray-700 xl:inline font-bold"},(0,C.__)("Stripe Card Processing","checkout-plugins-stripe-woo"),","),(0,C.__)(" We recommend you to enable","checkout-plugins-stripe-woo")," ",(0,t.createElement)("span",{className:"block text-gray-700 xl:inline font-bold"},(0,C.__)("Express Checkout","checkout-plugins-stripe-woo"))," ",(0,C.__)("feature","checkout-plugins-stripe-woo"),"."),(0,t.createElement)("span",null,(0,C.__)("Express Checkout generates more conversions!!","checkout-plugins-stripe-woo"))),(0,t.createElement)("div",{className:"block mx-auto mt-1 mb-1"},(0,t.createElement)("img",{className:"inline mx-4 py-5 h-24",src:onboarding_vars.assets_url+"images/apple-pay.svg",alt:"Express Checkout"}),(0,t.createElement)("img",{className:"inline mx-4 py-5 h-24",src:onboarding_vars.assets_url+"images/gpay.svg",alt:"Express Checkout"})),(0,t.createElement)("div",{className:"sm:inline-block lg:inline-block sm:justify-center lg:justify-center"},(0,t.createElement)("div",{className:"rounded-md shadow"},e?(0,t.createElement)("button",{className:"disabled w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-wait"},(0,C.__)("Enabling…","checkout-plugins-stripe-woo"),(0,t.createElement)(O,null)):(0,t.createElement)("button",{onClick:function(){r(!0);const e=new window.FormData;e.append("action","cpsw_onboarding_enable_express_checkout"),e.append("security",onboarding_vars.cpsw_onboarding_enable_express_checkout),re()({url:onboarding_vars.ajax_url,method:"POST",body:e}).then((e=>{e.success&&a(onboarding_vars.navigator_base+"&cpsw_call=webhooks")}))},className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-pointer"},(0,C.__)("Enable Express Checkout","checkout-plugins-stripe-woo"))),(0,t.createElement)("div",{className:"mt-3 sm:mt-0 sm:ml-3"},(0,t.createElement)("a",{href:onboarding_vars.base_url+"&cpsw_call=webhooks",className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-slate-300 md:py-4 md:text-lg md:px-10"},(0,C.__)("Skip Express Checkout","checkout-plugins-stripe-woo"))))))},Ke=function(){return(0,t.createElement)("main",{className:"mt-10 mx-auto w-auto max-w-7xl px-4 sm:mt-12 sm:px-6 md:mt-14 lg:mt-16 lg:px-8 xl:mt-18"},(0,t.createElement)("div",{className:"text-center"},(0,t.createElement)("h1",{className:"text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl"},(0,t.createElement)("span",{className:"block text-red-600 xl:inline"},(0,C.__)("Failed!!","checkout-plugins-stripe-woo"))),(0,t.createElement)("p",{className:"mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:mx-auto md:mt-5 md:text-xl lg:mx-0"},(0,t.createElement)("span",{className:"block"},(0,C.__)("Unfortunately Connection to Stripe failed.","checkout-plugins-stripe-woo"))),(0,t.createElement)("div",{className:"mt-5 sm:mt-8 sm:inline-block lg:inline-block sm:justify-center lg:justify-center"},(0,t.createElement)("div",{className:"rounded-md shadow"},(0,t.createElement)("a",{href:onboarding_vars.authorization_url,className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10"},(0,C.__)("Try Again","checkout-plugins-stripe-woo"))),(0,t.createElement)("div",{className:"mt-3 sm:mt-0 sm:ml-3"},(0,t.createElement)("a",{href:onboarding_vars.manual_connect_url,className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-slate-300 md:py-4 md:text-lg md:px-10"},(0,C.__)("Manage API keys manually","checkout-plugins-stripe-woo"))))))},Je=function(){const[e,r]=(0,n.useState)(!1);return(0,t.createElement)("main",{className:"mt-10 mx-auto w-auto max-w-7xl px-4 sm:mt-12 sm:px-6 md:mt-14 lg:mt-16 lg:px-8 xl:mt-18"},(0,t.createElement)("div",{className:"text-center"},(0,t.createElement)("h1",{className:"text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl"},(0,t.createElement)("span",{className:"block text-cart-500 xl:inline"},(0,C.__)("Great!!","checkout-plugins-stripe-woo"))),(0,t.createElement)("p",{className:"mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:mx-auto md:mt-5 md:text-xl lg:mx-0"},(0,t.createElement)("span",{className:"block"},(0,C.__)("Your store is all set to accept payment.","checkout-plugins-stripe-woo")),(0,t.createElement)("span",null,(0,C.__)("We provide lots of customization options to match your needs, don't forget to explore them.","checkout-plugins-stripe-woo"))),(0,t.createElement)("div",{className:"mt-5 sm:mt-8 sm:inline-block lg:inline-block sm:justify-center lg:justify-center"},(0,t.createElement)("div",{className:"rounded-md shadow"},e?(0,t.createElement)("button",{className:"disabled w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-wait"},(0,C.__)("Let's Customize…","checkout-plugins-stripe-woo"),(0,t.createElement)(O,null)):(0,t.createElement)("button",{onClick:function(){r(!0),window.location.replace(onboarding_vars.gateways_url)},className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-pointer"},(0,C.__)("Let's Customize","checkout-plugins-stripe-woo"))))))},$e=function(){""!==onboarding_vars.woocommerce_installed&&""!==onboarding_vars.woocommerce_activated&&window.location.replace(onboarding_vars.navigator_base);const[e,r]=(0,n.useState)(""),[a,o]=(0,n.useState)(!1),[i,l]=(0,n.useState)(!1);return(0,t.createElement)("main",{className:"mt-10 mx-auto max-w-7xl px-4 sm:mt-12 sm:px-6 md:mt-16 lg:mt-20 lg:px-8 xl:mt-28"},(0,t.createElement)("div",{className:"text-center"},(0,t.createElement)("h1",{className:"text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl"},(0,t.createElement)("span",{className:"block xl"},""===onboarding_vars.woocommerce_installed?(0,C.__)("Missing","checkout-plugins-stripe-woo"):(0,C.__)("Inactiave","checkout-plugins-stripe-woo")),(0,t.createElement)("span",{className:"block text-cart-500 xl:inline"},(0,C.__)("WooCoomerce","checkout-plugins-stripe-woo"))),(0,t.createElement)("p",{className:"mt-6 text-base justify-center text-gray-500 sm:mt-5 sm:text-lg sm:w-full sm:mx-auto md:mt-5 md:text-xl lg:mx-0"},(0,t.createElement)("span",{className:"block text-gray-700 xl:inline font-bold"},(0,C.__)("Checkout Plugins - Stripe for WooCoomerce","checkout-plugins-stripe-woo"))," ",(0,C.__)("requires","checkout-plugins-stripe-woo")," ",(0,t.createElement)("span",{className:"block text-gray-700 xl:inline font-bold"},(0,C.__)("WooCommerce","checkout-plugins-stripe-woo"))," ",(0,C.__)("to be active on your store.","checkout-plugins-stripe-woo")),(0,t.createElement)("div",{className:"mt-5 sm:mt-8 sm:flex justify-center"},(0,t.createElement)("div",{className:"rounded-md shadow"},"installing"===e?(0,t.createElement)("button",{className:"disabled w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-wait"},(0,C.__)("Installing…","checkout-plugins-stripe-woo"),(0,t.createElement)(O,null)):"activating"===e?(0,t.createElement)("button",{className:"disabled w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-wait"},(0,C.__)("Activating…","checkout-plugins-stripe-woo"),(0,t.createElement)(O,null)):(0,t.createElement)("button",{onClick:function(){if(""===onboarding_vars.woocommerce_installed)r("installing"),setTimeout((()=>{o(!0)}),1e4),wp.updates.queue.push({action:"install-plugin",data:{slug:"woocommerce"}}),wp.updates.queueChecker();else{r("activating");const e=new window.FormData;e.append("action","cpsw_onboarding_install_woocommerce"),e.append("security",onboarding_vars.cpsw_onboarding_install_woocommerce),re()({url:onboarding_vars.ajax_url,method:"POST",body:e}).then((e=>{e.success?window.location.replace(onboarding_vars.onboarding_base):l(!0)}))}},className:"install-dependency w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-pointer"},""===onboarding_vars.woocommerce_installed?(0,C.__)("Install and continue","checkout-plugins-stripe-woo"):(0,C.__)("Activate and continue","checkout-plugins-stripe-woo"))))),a?(0,t.createElement)("div",{className:"bg-cart-50 p-4 fixed left-0 top-0 right-0 transition ease-in-out delay-150"},(0,t.createElement)("div",{className:"block"},(0,t.createElement)("div",{className:"text-center justify-center"},(0,t.createElement)("p",{className:"text-sm mx-auto w-full text-cart-500 text-center"},(0,C.__)("Installing WooCommerce will take time. Please be patient.","checkout-plugins-stripe-woo"))))):"",i?(0,t.createElement)("div",{className:"bg-cart-50 p-4 fixed left-0 top-0 right-0 transition ease-in-out delay-150"},(0,t.createElement)("div",{className:"block"},(0,t.createElement)("div",{className:"text-center justify-center"},(0,t.createElement)("p",{className:"text-sm mx-auto w-full text-cart-500 text-center"},(0,C.__)("WooCommerce installing failed. Please try again.","checkout-plugins-stripe-woo"))))):"")},Xe=function(){return(0,t.createElement)("div",null,(0,t.createElement)("div",{className:"relative pt-6 px-4 sm:px-6 lg:px-8"},(0,t.createElement)("nav",{className:"relative flex items-center justify-center sm:h-10","aria-label":"Logo"},(0,t.createElement)("div",{className:"flex items-center justify-center flex-grow"},(0,t.createElement)("div",{className:"flex items-center w-auto"},(0,t.createElement)("img",{className:"h-16 w-full",src:onboarding_vars.assets_url+"images/cpsw-logo.svg",alt:"Checkout Plugins - Stripe for WooCommerce"}))))))};o().render((0,t.createElement)((function(e){let{basename:t,children:r,window:a}=e,o=(0,n.useRef)();null==o.current&&(o.current=function(e){function t(){var e=s.location,t=d.state||{};return[t.idx,{pathname:e.pathname,search:e.search,hash:e.hash,state:t.usr||null,key:t.key||"default"}]}function n(e){return"string"==typeof e?e:function(e){var t=e.pathname;t=void 0===t?"/":t;var n=e.search;return n=void 0===n?"":n,e=void 0===(e=e.hash)?"":e,n&&"?"!==n&&(t+="?"===n.charAt(0)?n:"?"+n),e&&"#"!==e&&(t+="#"===e.charAt(0)?e:"#"+e),t}(e)}function r(e,t){return void 0===t&&(t=null),i({pathname:v.pathname,hash:"",search:""},"string"==typeof e?m(e):e,{state:t,key:Math.random().toString(36).substr(2,8)})}function a(e){f=e,e=t(),b=e[0],v=e[1],x.call({action:f,location:v})}function o(e){d.go(e)}void 0===e&&(e={});var s=void 0===(e=e.window)?document.defaultView:e,d=s.history,p=null;s.addEventListener("popstate",(function(){if(p)g.call(p),p=null;else{var e=l.Pop,n=t(),r=n[0];if(n=n[1],g.length){if(null!=r){var i=b-r;i&&(p={action:e,location:n,retry:function(){o(-1*i)}},o(i))}}else a(e)}}));var f=l.Pop,b=(e=t())[0],v=e[1],x=u(),g=u();return null==b&&(b=0,d.replaceState(i({},d.state,{idx:b}),"")),{get action(){return f},get location(){return v},createHref:n,push:function e(t,o){var i=l.Push,c=r(t,o);if(!g.length||(g.call({action:i,location:c,retry:function(){e(t,o)}}),0)){var u=[{usr:c.state,key:c.key,idx:b+1},n(c)];c=u[0],u=u[1];try{d.pushState(c,"",u)}catch(e){s.location.assign(u)}a(i)}},replace:function e(t,o){var i=l.Replace,s=r(t,o);g.length&&(g.call({action:i,location:s,retry:function(){e(t,o)}}),1)||(s=[{usr:s.state,key:s.key,idx:b},n(s)],d.replaceState(s[0],"",s[1]),a(i))},go:o,back:function(){o(-1)},forward:function(){o(1)},listen:function(e){return x.push(e)},block:function(e){var t=g.push(e);return 1===g.length&&s.addEventListener("beforeunload",c),function(){t(),g.length||s.removeEventListener("beforeunload",c)}}}}({window:a}));let s=o.current,[d,p]=(0,n.useState)({action:s.action,location:s.location});return(0,n.useLayoutEffect)((()=>s.listen(p)),[s]),(0,n.createElement)(v,{basename:t,children:r,location:d.location,navigationType:d.action,navigator:s})}),null,(0,t.createElement)((function(){const e=new URLSearchParams(g().search).get("cpsw_call");let n=(0,t.createElement)("p",null);switch(e){case"success":n=(0,t.createElement)(ce,null);break;case"failed":n=(0,t.createElement)(Ke,null);break;case"webhooks":n=(0,t.createElement)(qe,null);break;case"express-checkout":n=(0,t.createElement)(Ye,null);break;case"thank-you":n=(0,t.createElement)(Je,null);break;case"setup-woocommerce":n=(0,t.createElement)($e,null);break;default:n=(0,t.createElement)(R,null)}return(0,t.createElement)("div",{className:"relative bg-white overflow-hidden w-10/12 mx-auto my-0 rounded-xl mt-12"},(0,t.createElement)("div",{className:"max-w-7xl mx-auto overflow-x-hidden"},(0,t.createElement)("div",{className:"relative z-10 bg-white lg:w-full"},(0,t.createElement)(Xe,null),n)))}),null)),document.getElementById("cpsw-onboarding-content"))}();
1
+ !function(){"use strict";var e,t={n:function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,{a:n}),n},d:function(e,n){for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},n=window.wp.element,r=window.React,a=window.ReactDOM,o=t.n(a);function l(){return l=Object.assign||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},l.apply(this,arguments)}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(e||(e={}));var i="beforeunload";function s(e){e.preventDefault(),e.returnValue=""}function u(){var e=[];return{get length(){return e.length},push:function(t){return e.push(t),function(){e=e.filter((function(e){return e!==t}))}},call:function(t){e.forEach((function(e){return e&&e(t)}))}}}function c(e){var t={};if(e){var n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));var r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function d(e,t){if(!e)throw new Error(t)}const p=(0,r.createContext)(null),m=(0,r.createContext)(null),f=(0,r.createContext)({outlet:null,matches:[]});function b(t){let{basename:n="/",children:a=null,location:o,navigationType:l=e.Pop,navigator:i,static:s=!1}=t;v()&&d(!1);let u=y(n),f=(0,r.useMemo)((()=>({basename:u,navigator:i,static:s})),[u,i,s]);"string"==typeof o&&(o=c(o));let{pathname:b="/",search:x="",hash:g="",state:h=null,key:w="default"}=o,E=(0,r.useMemo)((()=>{let e=function(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=e.charAt(t.length);return n&&"/"!==n?null:e.slice(t.length)||"/"}(b,u);return null==e?null:{pathname:e,search:x,hash:g,state:h,key:w}}),[u,b,x,g,h,w]);return null==E?null:(0,r.createElement)(p.Provider,{value:f},(0,r.createElement)(m.Provider,{children:a,value:{location:E,navigationType:l}}))}function v(){return null!=(0,r.useContext)(m)}function x(){return v()||d(!1),(0,r.useContext)(m).location}function g(){v()||d(!1);let{basename:e,navigator:t}=(0,r.useContext)(p),{matches:n}=(0,r.useContext)(f),{pathname:a}=x(),o=JSON.stringify(n.map((e=>e.pathnameBase))),l=(0,r.useRef)(!1);(0,r.useEffect)((()=>{l.current=!0}));let i=(0,r.useCallback)((function(n,r){if(void 0===r&&(r={}),!l.current)return;if("number"==typeof n)return void t.go(n);let i=function(e,t,n){let r,a="string"==typeof e?c(e):e,o=""===e||""===a.pathname?"/":a.pathname;if(null==o)r=n;else{let e=t.length-1;if(o.startsWith("..")){let t=o.split("/");for(;".."===t[0];)t.shift(),e-=1;a.pathname=t.join("/")}r=e>=0?t[e]:"/"}let l=function(e,t){void 0===t&&(t="/");let{pathname:n,search:r="",hash:a=""}="string"==typeof e?c(e):e,o=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:o,search:w(r),hash:E(a)}}(a,r);return o&&"/"!==o&&o.endsWith("/")&&!l.pathname.endsWith("/")&&(l.pathname+="/"),l}(n,JSON.parse(o),a);"/"!==e&&(i.pathname=h([e,i.pathname])),(r.replace?t.replace:t.push)(i,r.state)}),[e,t,o,a]);return i}const h=e=>e.join("/").replace(/\/\/+/g,"/"),y=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),w=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",E=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";var k=window.wp.i18n,C=function(){return(0,n.createElement)("svg",{className:"animate-spin ml-2 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},(0,n.createElement)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.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(){const[e,t]=(0,r.useState)(!1),a=g();return(0,n.createElement)("main",{className:"mt-10 mx-auto w-auto max-w-7xl px-4 sm:mt-12 sm:px-6 md:mt-16 lg:mt-20 lg:px-8 xl:mt-28"},(0,n.createElement)("div",{className:"text-center"},(0,n.createElement)("h1",{className:"text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl"},(0,n.createElement)("span",{className:"block xl"}," ",(0,k.__)("Let's Connect","checkout-plugins-stripe-woo")),(0,n.createElement)("span",{className:"block text-cart-500 xl:inline"},(0,k.__)("with Stripe","checkout-plugins-stripe-woo"))),(0,n.createElement)("p",{className:"mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:mx-auto md:mt-5 md:text-xl lg:mx-0"},(0,n.createElement)("span",{className:"block"},(0,n.createElement)("span",{className:"block text-gray-700 inline font-bold"},(0,k.__)("Checkout Plugins","checkout-plugins-stripe-woo"))," ",(0,k.__)("recommends to connect with","checkout-plugins-stripe-woo")," ",(0,n.createElement)("span",{className:"block text-gray-700 xl:inline font-bold"},(0,k.__)("Stripe connect.","checkout-plugins-stripe-woo"))),(0,n.createElement)("span",null,(0,k.__)("One click onboarding solution provided by","checkout-plugins-stripe-woo")," ",(0,n.createElement)("span",{className:"block text-gray-700 xl:inline font-bold"},(0,k.__)("Stripe.","checkout-plugins-stripe-woo")))),(0,n.createElement)("div",{className:"mt-5 sm:mt-8 sm:inline-block lg:inline-block sm:justify-center lg:justify-center"},(0,n.createElement)("div",{className:"rounded-md shadow"},e?(0,n.createElement)("button",{className:"disabled w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-wait"},(0,k.__)("Connecting…","checkout-plugins-stripe-woo"),(0,n.createElement)(C,null)):(0,n.createElement)("button",{onClick:function(){t(!0),""===onboarding_vars.woocommerce_installed||""===onboarding_vars.woocommerce_activated?a(onboarding_vars.navigator_base+"&cpsw_call=setup-woocommerce"):window.location.replace(onboarding_vars.authorization_url)},className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-pointer"},(0,k.__)("Connect with Stripe","checkout-plugins-stripe-woo"))),(0,n.createElement)("div",{className:"mt-3 sm:mt-0 sm:ml-3"},(0,n.createElement)("a",{href:onboarding_vars.settings_url,className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-slate-300 md:py-4 md:text-lg md:px-10"},(0,k.__)("Leave onboarding process","checkout-plugins-stripe-woo"))))))};function I(){let e=[],t=[],n={enqueue(e){t.push(e)},requestAnimationFrame(...e){let t=requestAnimationFrame(...e);n.add((()=>cancelAnimationFrame(t)))},nextFrame(...e){n.requestAnimationFrame((()=>{n.requestAnimationFrame(...e)}))},setTimeout(...e){let t=setTimeout(...e);n.add((()=>clearTimeout(t)))},add(t){e.push(t)},dispose(){for(let t of e.splice(0))t()},async workQueue(){for(let e of t.splice(0))await e()}};return n}function S(){let[e]=(0,r.useState)(I);return(0,r.useEffect)((()=>()=>e.dispose()),[e]),e}var R="undefined"!=typeof window?r.useLayoutEffect:r.useEffect,N={serverHandoffComplete:!1};function P(){let[e,t]=(0,r.useState)(N.serverHandoffComplete);return(0,r.useEffect)((()=>{!0!==e&&t(!0)}),[e]),(0,r.useEffect)((()=>{!1===N.serverHandoffComplete&&(N.serverHandoffComplete=!0)}),[]),e}var T=0;function D(){return++T}function O(){let e=P(),[t,n]=(0,r.useState)(e?D:null);return R((()=>{null===t&&n(D())}),[t]),null!=t?""+t:void 0}function F(e){let t=(0,r.useRef)(e);return(0,r.useEffect)((()=>{t.current=e}),[e]),t}function L(e,t){let[n,a]=(0,r.useState)(e),o=F(e);return R((()=>a(o.current)),[o,a,...t]),n}function M(...e){let t=(0,r.useRef)(e);return(0,r.useEffect)((()=>{t.current=e}),[e]),(0,r.useCallback)((e=>{for(let n of t.current)null!=n&&("function"==typeof n?n(e):n.current=e)}),[t])}function A(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,A),r}function j({props:e,slot:t,defaultTag:n,features:r,visible:a=!0,name:o}){if(a)return $(e,t,n,o);let l=null!=r?r:0;if(2&l){let{static:r=!1,...a}=e;if(r)return $(a,t,n,o)}if(1&l){let{unmount:r=!0,...a}=e;return A(r?0:1,{0:()=>null,1:()=>$({...a,hidden:!0,style:{display:"none"}},t,n,o)})}return $(e,t,n,o)}function $(e,t={},n,a){let{as:o=n,children:l,refName:i="ref",...s}=W(e,["unmount","static"]),u=void 0!==e.ref?{[i]:e.ref}:{},c="function"==typeof l?l(t):l;if(s.className&&"function"==typeof s.className&&(s.className=s.className(t)),o===r.Fragment&&Object.keys(s).length>0){if(!(0,r.isValidElement)(c)||Array.isArray(c)&&c.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${a} /> 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"));return(0,r.cloneElement)(c,Object.assign({},function(e,t,n){let r=Object.assign({},e);for(let n of["onClick"])void 0!==e[n]&&void 0!==t[n]&&Object.assign(r,{[n](r){r.defaultPrevented||e[n](r),r.defaultPrevented||t[n](r)}});return r}(function(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}(W(s,["ref"])),c.props),u))}return(0,r.createElement)(o,Object.assign({},W(s,["ref"]),o!==r.Fragment&&u),c)}function B(e){var t;return Object.assign((0,r.forwardRef)(e),{displayName:null!=(t=e.displayName)?t:e.name})}function W(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}function U(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),a=null!=r?r:-1,o=(()=>{switch(e.focus){case 0:return n.findIndex((e=>!t.resolveDisabled(e)));case 1:{let e=n.slice().reverse().findIndex(((e,n,r)=>!(-1!==a&&r.length-n-1>=a||t.resolveDisabled(e))));return-1===e?e:n.length-1-e}case 2:return n.findIndex(((e,n)=>!(n<=a||t.resolveDisabled(e))));case 3:{let e=n.slice().reverse().findIndex((e=>!t.resolveDisabled(e)));return-1===e?e:n.length-1-e}case 4:return n.findIndex((n=>t.resolveId(n)===e.id));case 5:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}})();return-1===o?r:o}function G(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 K(e,t,n){let a=(0,r.useRef)(t);a.current=t,(0,r.useEffect)((()=>{function t(e){a.current.call(window,e)}return window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)}),[e,n])}var H=(0,r.createContext)(null);function Q(){return(0,r.useContext)(H)}function q({value:e,children:t}){return r.createElement(H.Provider,{value:e},t)}function z(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 V(e,t){let[n,a]=(0,r.useState)((()=>z(e)));return R((()=>{a(z(e))}),[e.type,e.as]),R((()=>{n||!t.current||t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&a("button")}),[n,t]),n}function Y({container:e,accept:t,walk:n,enabled:a=!0}){let o=(0,r.useRef)(t),l=(0,r.useRef)(n);(0,r.useEffect)((()=>{o.current=t,l.current=n}),[t,n]),R((()=>{if(!e||!a)return;let t=o.current,n=l.current,r=Object.assign((e=>t(e)),{acceptNode:t}),i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,r,!1);for(;i.nextNode();)n(i.currentNode)}),[e,a,o,l])}H.displayName="OpenClosedContext";var J={1:e=>e.disabled||1===e.comboboxState?e:{...e,activeOptionIndex:null,comboboxState:1},0:e=>e.disabled||0===e.comboboxState?e:{...e,comboboxState:0},2:(e,t)=>e.disabled===t.disabled?e:{...e,disabled:t.disabled},3(e,t){if(e.disabled||e.optionsRef.current&&!e.optionsPropsRef.current.static&&1===e.comboboxState)return e;let n=U(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});return e.activeOptionIndex===n?e:{...e,activeOptionIndex:n}},4:(e,t)=>{var n;let r=null!==e.activeOptionIndex?e.options[e.activeOptionIndex]:null,a=Array.from(null==(n=e.optionsRef.current)?void 0:n.querySelectorAll('[id^="headlessui-combobox-option-"]')).reduce(((e,t,n)=>Object.assign(e,{[t.id]:n})),{}),o=[...e.options,{id:t.id,dataRef:t.dataRef}].sort(((e,t)=>a[e.id]-a[t.id]));return{...e,options:o,activeOptionIndex:null===r?null:o.indexOf(r)}},5:(e,t)=>{let n=e.options.slice(),r=null!==e.activeOptionIndex?n[e.activeOptionIndex]:null,a=n.findIndex((e=>e.id===t.id));return-1!==a&&n.splice(a,1),{...e,options:n,activeOptionIndex:a===e.activeOptionIndex||null===r?null:n.indexOf(r)}}},X=(0,r.createContext)(null);function Z(e){let t=(0,r.useContext)(X);if(null===t){let t=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Z),t}return t}X.displayName="ComboboxContext";var ee=(0,r.createContext)(null);function te(){let e=(0,r.useContext)(ee);if(null===e){let e=new Error("ComboboxActions is missing a parent <Combobox /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(e,te),e}return e}function ne(e,t){return A(t.type,J,e,t)}ee.displayName="ComboboxActions";var re=r.Fragment,ae=B((function(e,t){let{value:n,onChange:a,disabled:o=!1,...l}=e,i=(0,r.useRef)({value:n,onChange:a}),s=(0,r.useRef)({static:!1,hold:!1}),u=(0,r.useRef)({displayValue:void 0}),c=(0,r.useReducer)(ne,{comboboxState:1,comboboxPropsRef:i,optionsPropsRef:s,inputPropsRef:u,labelRef:(0,r.createRef)(),inputRef:(0,r.createRef)(),buttonRef:(0,r.createRef)(),optionsRef:(0,r.createRef)(),disabled:o,options:[],activeOptionIndex:null}),[{comboboxState:d,options:p,activeOptionIndex:m,optionsRef:f,inputRef:b,buttonRef:v},x]=c;R((()=>{i.current.value=n}),[n,i]),R((()=>{i.current.onChange=a}),[a,i]),R((()=>x({type:2,disabled:o})),[o]),K("mousedown",(e=>{var t,n,r;let a=e.target;0===d&&((null==(t=v.current)?void 0:t.contains(a))||(null==(n=b.current)?void 0:n.contains(a))||(null==(r=f.current)?void 0:r.contains(a))||x({type:1}))}));let g=null===m?null:p[m].dataRef.current.value,h=(0,r.useMemo)((()=>({open:0===d,disabled:o,activeIndex:m,activeOption:g})),[d,o,p,m]),y=(0,r.useCallback)((()=>{if(!b.current||void 0===n)return;let e=u.current.displayValue;"function"==typeof e?b.current.value=e(n):"string"==typeof n&&(b.current.value=n)}),[n,b,u]),w=(0,r.useCallback)((e=>{let t=p.find((t=>t.id===e));if(!t)return;let{dataRef:n}=t;i.current.onChange(n.current.value),y()}),[p,i,b]),E=(0,r.useCallback)((()=>{if(null!==m){let{dataRef:e}=p[m];i.current.onChange(e.current.value),y()}}),[m,p,i,b]),k=(0,r.useMemo)((()=>({selectOption:w,selectActiveOption:E})),[w,E]);return R((()=>{1===d&&y()}),[y,d]),R(y,[y]),r.createElement(ee.Provider,{value:k},r.createElement(X.Provider,{value:c},r.createElement(q,{value:A(d,{0:0,1:1})},j({props:null===t?l:{...l,ref:t},slot:h,defaultTag:re,name:"Combobox"}))))})),oe=B((function(e,t){var n,a;let{value:o,onChange:l,displayValue:i,...s}=e,[u,c]=Z("Combobox.Input"),d=te(),p=M(u.inputRef,t),m=u.inputPropsRef,f=`headlessui-combobox-input-${O()}`,b=S(),v=F(l);R((()=>{m.current.displayValue=i}),[i,m]);let x=(0,r.useCallback)((e=>{switch(e.key){case"Enter":e.preventDefault(),e.stopPropagation(),d.selectActiveOption(),c({type:1});break;case"ArrowDown":return e.preventDefault(),e.stopPropagation(),A(u.comboboxState,{0:()=>c({type:3,focus:2}),1:()=>{c({type:0}),b.nextFrame((()=>{u.comboboxPropsRef.current.value||c({type:3,focus:0})}))}});case"ArrowUp":return e.preventDefault(),e.stopPropagation(),A(u.comboboxState,{0:()=>c({type:3,focus:1}),1:()=>{c({type:0}),b.nextFrame((()=>{u.comboboxPropsRef.current.value||c({type:3,focus:3})}))}});case"Home":case"PageUp":return e.preventDefault(),e.stopPropagation(),c({type:3,focus:0});case"End":case"PageDown":return e.preventDefault(),e.stopPropagation(),c({type:3,focus:3});case"Escape":return e.preventDefault(),u.optionsRef.current&&!u.optionsPropsRef.current.static&&e.stopPropagation(),c({type:1});case"Tab":d.selectActiveOption(),c({type:1})}}),[b,c,u,d]),g=(0,r.useCallback)((e=>{var t;c({type:0}),null==(t=v.current)||t.call(v,e)}),[c,v]),h=L((()=>{if(u.labelRef.current)return[u.labelRef.current.id].join(" ")}),[u.labelRef.current]),y=(0,r.useMemo)((()=>({open:0===u.comboboxState,disabled:u.disabled})),[u]);return j({props:{...s,ref:p,id:f,role:"combobox",type:"text","aria-controls":null==(n=u.optionsRef.current)?void 0:n.id,"aria-expanded":u.disabled?void 0:0===u.comboboxState,"aria-activedescendant":null===u.activeOptionIndex||null==(a=u.options[u.activeOptionIndex])?void 0:a.id,"aria-labelledby":h,disabled:u.disabled,onKeyDown:x,onChange:g},slot:y,defaultTag:"input",name:"Combobox.Input"})})),le=B((function(e,t){var n;let[a,o]=Z("Combobox.Button"),l=te(),i=M(a.buttonRef,t),s=`headlessui-combobox-button-${O()}`,u=S(),c=(0,r.useCallback)((e=>{switch(e.key){case"ArrowDown":return e.preventDefault(),e.stopPropagation(),1===a.comboboxState&&(o({type:0}),u.nextFrame((()=>{a.comboboxPropsRef.current.value||o({type:3,focus:0})}))),u.nextFrame((()=>{var e;return null==(e=a.inputRef.current)?void 0:e.focus({preventScroll:!0})}));case"ArrowUp":return e.preventDefault(),e.stopPropagation(),1===a.comboboxState&&(o({type:0}),u.nextFrame((()=>{a.comboboxPropsRef.current.value||o({type:3,focus:3})}))),u.nextFrame((()=>{var e;return null==(e=a.inputRef.current)?void 0:e.focus({preventScroll:!0})}));case"Escape":return e.preventDefault(),a.optionsRef.current&&!a.optionsPropsRef.current.static&&e.stopPropagation(),o({type:1}),u.nextFrame((()=>{var e;return null==(e=a.inputRef.current)?void 0:e.focus({preventScroll:!0})}))}}),[u,o,a,l]),d=(0,r.useCallback)((e=>{if(G(e.currentTarget))return e.preventDefault();0===a.comboboxState?o({type:1}):(e.preventDefault(),o({type:0})),u.nextFrame((()=>{var e;return null==(e=a.inputRef.current)?void 0:e.focus({preventScroll:!0})}))}),[o,u,a]),p=L((()=>{if(a.labelRef.current)return[a.labelRef.current.id,s].join(" ")}),[a.labelRef.current,s]),m=(0,r.useMemo)((()=>({open:0===a.comboboxState,disabled:a.disabled})),[a]);return j({props:{...e,ref:i,id:s,type:V(e,a.buttonRef),tabIndex:-1,"aria-haspopup":!0,"aria-controls":null==(n=a.optionsRef.current)?void 0:n.id,"aria-expanded":a.disabled?void 0:0===a.comboboxState,"aria-labelledby":p,disabled:a.disabled,onClick:d,onKeyDown:c},slot:m,defaultTag:"button",name:"Combobox.Button"})})),ie=B((function(e,t){var n;let{hold:a=!1,...o}=e,[l]=Z("Combobox.Options"),{optionsPropsRef:i}=l,s=M(l.optionsRef,t),u=`headlessui-combobox-options-${O()}`,c=Q(),d=null!==c?0===c:0===l.comboboxState;R((()=>{var t;i.current.static=null!=(t=e.static)&&t}),[i,e.static]),R((()=>{i.current.hold=a}),[a,i]),Y({container:l.optionsRef.current,enabled:0===l.comboboxState,accept:e=>"option"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let p=L((()=>{var e,t,n;return null!=(n=null==(e=l.labelRef.current)?void 0:e.id)?n:null==(t=l.buttonRef.current)?void 0:t.id}),[l.labelRef.current,l.buttonRef.current]),m=(0,r.useMemo)((()=>({open:0===l.comboboxState})),[l]);return j({props:{...o,"aria-activedescendant":null===l.activeOptionIndex||null==(n=l.options[l.activeOptionIndex])?void 0:n.id,"aria-labelledby":p,role:"listbox",id:u,ref:s},slot:m,defaultTag:"ul",features:3,visible:d,name:"Combobox.Options"})}));Object.assign(ae,{Input:oe,Button:le,Label:function(e){let[t]=Z("Combobox.Label"),n=`headlessui-combobox-label-${O()}`,a=(0,r.useCallback)((()=>{var e;return null==(e=t.inputRef.current)?void 0:e.focus({preventScroll:!0})}),[t.inputRef]),o=(0,r.useMemo)((()=>({open:0===t.comboboxState,disabled:t.disabled})),[t]);return j({props:{...e,ref:t.labelRef,id:n,onClick:a},slot:o,defaultTag:"label",name:"Combobox.Label"})},Options:ie,Option:function(e){let{disabled:t=!1,value:n,...a}=e,[o,l]=Z("Combobox.Option"),i=te(),s=`headlessui-combobox-option-${O()}`,u=null!==o.activeOptionIndex&&o.options[o.activeOptionIndex].id===s,c=o.comboboxPropsRef.current.value===n,d=(0,r.useRef)({disabled:t,value:n});R((()=>{d.current.disabled=t}),[d,t]),R((()=>{d.current.value=n}),[d,n]),R((()=>{var e,t;d.current.textValue=null==(t=null==(e=document.getElementById(s))?void 0:e.textContent)?void 0:t.toLowerCase()}),[d,s]);let p=(0,r.useCallback)((()=>i.selectOption(s)),[i,s]);R((()=>(l({type:4,id:s,dataRef:d}),()=>l({type:5,id:s}))),[d,s]),R((()=>{0===o.comboboxState&&(!c||l({type:3,focus:4,id:s}))}),[o.comboboxState,c,s]),R((()=>{if(0!==o.comboboxState||!u)return;let e=I();return e.requestAnimationFrame((()=>{var e,t;null==(t=null==(e=document.getElementById(s))?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"})})),e.dispose}),[s,u,o.comboboxState,o.activeOptionIndex]);let m=(0,r.useCallback)((e=>{if(t)return e.preventDefault();p(),l({type:1}),I().nextFrame((()=>{var e;return null==(e=o.inputRef.current)?void 0:e.focus({preventScroll:!0})}))}),[l,o.inputRef,t,p]),f=(0,r.useCallback)((()=>{if(t)return l({type:3,focus:5});l({type:3,focus:4,id:s})}),[t,s,l]),b=(0,r.useCallback)((()=>{t||u||l({type:3,focus:4,id:s})}),[t,u,s,l]),v=(0,r.useCallback)((()=>{t||!u||o.optionsPropsRef.current.hold||l({type:3,focus:5})}),[t,u,l,o.comboboxState,o.comboboxPropsRef]),x=(0,r.useMemo)((()=>({active:u,selected:c,disabled:t})),[u,c,t]);return j({props:{...a,id:s,role:"option",tabIndex:!0===t?void 0:-1,"aria-disabled":!0===t||void 0,"aria-selected":!0===c||void 0,disabled:void 0,onClick:m,onFocus:f,onPointerMove:b,onMouseMove:b,onPointerLeave:v,onMouseLeave:v},slot:x,defaultTag:"li",name:"Combobox.Option"})}});var se=["[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(",");function ue(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(se))}function ce(e,t=0){return e!==document.body&&A(t,{0:()=>e.matches(se),1(){let t=e;for(;null!==t;){if(t.matches(se))return!0;t=t.parentElement}return!1}})}function de(e){null==e||e.focus({preventScroll:!0})}function pe(e,t){let n,r=Array.isArray(e)?e.slice().sort(((e,t)=>{let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING?-1:n&Node.DOCUMENT_POSITION_PRECEDING?1:0})):ue(e),a=document.activeElement,o=(()=>{if(5&t)return 1;if(10&t)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=(()=>{if(1&t)return 0;if(2&t)return Math.max(0,r.indexOf(a))-1;if(4&t)return Math.max(0,r.indexOf(a))+1;if(8&t)return r.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),i=32&t?{preventScroll:!0}:{},s=0,u=r.length;do{if(s>=u||s+u<=0)return 0;let e=l+s;if(16&t)e=(e+u)%u;else{if(e<0)return 3;if(e>=u)return 1}n=r[e],null==n||n.focus(i),s+=o}while(n!==document.activeElement);return n.hasAttribute("tabindex")||n.setAttribute("tabindex","0"),2}function me(){let e=(0,r.useRef)(!1);return(0,r.useEffect)((()=>(e.current=!0,()=>{e.current=!1})),[]),e}var fe=new Set,be=new Map;function ve(e){e.setAttribute("aria-hidden","true"),e.inert=!0}function xe(e){let t=be.get(e);!t||(null===t["aria-hidden"]?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t["aria-hidden"]),e.inert=t.inert)}var ge=(0,r.createContext)(!1);function he(e){return r.createElement(ge.Provider,{value:e.force},e.children)}var ye=r.Fragment;function we(e){let t=e,n=function(){let e=(0,r.useContext)(ge),t=(0,r.useContext)(ke),[n,a]=(0,r.useState)((()=>{if(!e&&null!==t||"undefined"==typeof window)return null;let n=document.getElementById("headlessui-portal-root");if(n)return n;let r=document.createElement("div");return r.setAttribute("id","headlessui-portal-root"),document.body.appendChild(r)}));return(0,r.useEffect)((()=>{null!==n&&(document.body.contains(n)||document.body.appendChild(n))}),[n]),(0,r.useEffect)((()=>{e||null!==t&&a(t.current)}),[t,a,e]),n}(),[o]=(0,r.useState)((()=>"undefined"==typeof window?null:document.createElement("div"))),l=P();return R((()=>{if(n&&o)return n.appendChild(o),()=>{var e;!n||!o||(n.removeChild(o),n.childNodes.length<=0&&(null==(e=n.parentElement)||e.removeChild(n)))}}),[n,o]),l&&n&&o?(0,a.createPortal)(j({props:t,defaultTag:ye,name:"Portal"}),o):null}var Ee=r.Fragment,ke=(0,r.createContext)(null);we.Group=function(e){let{target:t,...n}=e;return r.createElement(ke.Provider,{value:t},j({props:n,defaultTag:Ee,name:"Popover.Group"}))};var Ce=(0,r.createContext)(null);function _e(){let e=(0,r.useContext)(Ce);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,_e),e}return e}function Ie(){let[e,t]=(0,r.useState)([]);return[e.length>0?e.join(" "):void 0,(0,r.useMemo)((()=>function(e){let n=(0,r.useCallback)((e=>(t((t=>[...t,e])),()=>t((t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n})))),[]),a=(0,r.useMemo)((()=>({register:n,slot:e.slot,name:e.name,props:e.props})),[n,e.slot,e.name,e.props]);return r.createElement(Ce.Provider,{value:a},e.children)}),[t])]}function Se(e){let t=_e(),n=`headlessui-description-${O()}`;return R((()=>t.register(n)),[n,t.register]),j({props:{...e,...{...t.props,id:n}},slot:t.slot||{},defaultTag:"p",name:t.name||"Description"})}var Re=(0,r.createContext)((()=>{}));function Ne({children:e,onUpdate:t,type:n,element:a}){let o=(0,r.useContext)(Re),l=(0,r.useCallback)(((...e)=>{null==t||t(...e),o(...e)}),[o,t]);return R((()=>(l(0,n,a),()=>l(1,n,a))),[l,n,a]),r.createElement(Re.Provider,{value:l},e)}Re.displayName="StackContext";var Pe={0:(e,t)=>e.titleId===t.id?e:{...e,titleId:t.id}},Te=(0,r.createContext)(null);function De(e){let t=(0,r.useContext)(Te);if(null===t){let t=new Error(`<${e} /> is missing a parent <${Me.displayName} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,De),t}return t}function Oe(e,t){return A(t.type,Pe,e,t)}Te.displayName="DialogContext";var Fe=B((function(e,t){let{open:n,onClose:a,initialFocus:o,...l}=e,[i,s]=(0,r.useState)(0),u=Q();void 0===n&&null!==u&&(n=A(u,{0:!0,1:!1}));let c=(0,r.useRef)(new Set),d=(0,r.useRef)(null),p=M(d,t),m=e.hasOwnProperty("open")||null!==u,f=e.hasOwnProperty("onClose");if(!m&&!f)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!m)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!f)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof n)throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${n}`);if("function"!=typeof a)throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${a}`);let b=n?0:1,v=null!==u?0===u:0===b,[x,g]=(0,r.useReducer)(Oe,{titleId:null,descriptionId:null}),h=(0,r.useCallback)((()=>a(!1)),[a]),y=(0,r.useCallback)((e=>g({type:0,id:e})),[g]),w=P()&&0===b,E=i>1,k=null!==(0,r.useContext)(Te);(function(e,t=30,{initialFocus:n,containers:a}={}){let o=(0,r.useRef)("undefined"!=typeof window?document.activeElement:null),l=(0,r.useRef)(null),i=me(),s=Boolean(16&t),u=Boolean(2&t);(0,r.useEffect)((()=>{!s||(o.current=document.activeElement)}),[s]),(0,r.useEffect)((()=>{if(s)return()=>{de(o.current),o.current=null}}),[s]),(0,r.useEffect)((()=>{if(!u||!e.current)return;let t=document.activeElement;if(null==n?void 0:n.current){if((null==n?void 0:n.current)===t)return void(l.current=t)}else if(e.current.contains(t))return void(l.current=t);(null==n?void 0:n.current)?de(n.current):0===pe(e.current,1)&&console.warn("There are no focusable elements inside the <FocusTrap />"),l.current=document.activeElement}),[e,n,u]),K("keydown",(n=>{!(4&t)||!e.current||"Tab"===n.key&&(n.preventDefault(),2===pe(e.current,16|(n.shiftKey?2:4))&&(l.current=document.activeElement))})),K("focus",(n=>{if(!(8&t))return;let r=new Set(null==a?void 0:a.current);if(r.add(e),!r.size)return;let o=l.current;if(!o||!i.current)return;let s=n.target;s&&s instanceof HTMLElement?function(e,t){var n;for(let r of e)if(null==(n=r.current)?void 0:n.contains(t))return!0;return!1}(r,s)?(l.current=s,de(s)):(n.preventDefault(),n.stopPropagation(),de(o)):de(l.current)}),!0)})(d,w?A(E?"parent":"leaf",{parent:16,leaf:30}):1,{initialFocus:o,containers:c}),function(e,t=!0){R((()=>{if(!t||!e.current)return;let n=e.current;fe.add(n);for(let e of be.keys())e.contains(n)&&(xe(e),be.delete(e));return document.querySelectorAll("body > *").forEach((e=>{if(e instanceof HTMLElement){for(let t of fe)if(e.contains(t))return;1===fe.size&&(be.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),ve(e))}})),()=>{if(fe.delete(n),fe.size>0)document.querySelectorAll("body > *").forEach((e=>{if(e instanceof HTMLElement&&!be.has(e)){for(let t of fe)if(e.contains(t))return;be.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),ve(e)}}));else for(let e of be.keys())xe(e),be.delete(e)}}),[t])}(d,!!E&&w),K("mousedown",(e=>{var t;let n=e.target;0===b&&(E||(null==(t=d.current)?void 0:t.contains(n))||h())})),K("keydown",(e=>{"Escape"===e.key&&0===b&&(E||(e.preventDefault(),e.stopPropagation(),h()))})),(0,r.useEffect)((()=>{if(0!==b||k)return;let e=document.documentElement.style.overflow,t=document.documentElement.style.paddingRight,n=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=`${n}px`,()=>{document.documentElement.style.overflow=e,document.documentElement.style.paddingRight=t}}),[b,k]),(0,r.useEffect)((()=>{if(0!==b||!d.current)return;let e=new IntersectionObserver((e=>{for(let t of e)0===t.boundingClientRect.x&&0===t.boundingClientRect.y&&0===t.boundingClientRect.width&&0===t.boundingClientRect.height&&h()}));return e.observe(d.current),()=>e.disconnect()}),[b,d,h]);let[C,_]=Ie(),I=`headlessui-dialog-${O()}`,S=(0,r.useMemo)((()=>[{dialogState:b,close:h,setTitleId:y},x]),[b,x,h,y]),N=(0,r.useMemo)((()=>({open:0===b})),[b]),T={ref:p,id:I,role:"dialog","aria-modal":0===b||void 0,"aria-labelledby":x.titleId,"aria-describedby":C,onClick(e){e.stopPropagation()}},D=l;return r.createElement(Ne,{type:"Dialog",element:d,onUpdate:(0,r.useCallback)(((e,t,n)=>{"Dialog"===t&&A(e,{0(){c.current.add(n),s((e=>e+1))},1(){c.current.add(n),s((e=>e-1))}})}),[])},r.createElement(he,{force:!0},r.createElement(we,null,r.createElement(Te.Provider,{value:S},r.createElement(we.Group,{target:d},r.createElement(he,{force:!1},r.createElement(_,{slot:N,name:"Dialog.Description"},j({props:{...D,...T},slot:N,defaultTag:"div",features:3,visible:v,name:"Dialog"}))))))))})),Le=B((function(e,t){let[{dialogState:n,close:a}]=De("Dialog.Overlay");return j({props:{...e,ref:M(t),id:`headlessui-dialog-overlay-${O()}`,"aria-hidden":!0,onClick:(0,r.useCallback)((e=>{if(e.target===e.currentTarget){if(G(e.currentTarget))return e.preventDefault();e.preventDefault(),e.stopPropagation(),a()}}),[a])},slot:(0,r.useMemo)((()=>({open:0===n})),[n]),defaultTag:"div",name:"Dialog.Overlay"})})),Me=Object.assign(Fe,{Overlay:Le,Title:function(e){let[{dialogState:t,setTitleId:n}]=De("Dialog.Title"),a=`headlessui-dialog-title-${O()}`;(0,r.useEffect)((()=>(n(a),()=>n(null))),[a,n]);let o=(0,r.useMemo)((()=>({open:0===t})),[t]);return j({props:{...e,id:a},slot:o,defaultTag:"h2",name:"Dialog.Title"})},Description:Se}),Ae={0:e=>({...e,disclosureState:A(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},4:e=>!0===e.linkedPanel?e:{...e,linkedPanel:!0},5:e=>!1===e.linkedPanel?e:{...e,linkedPanel:!1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId}},je=(0,r.createContext)(null);function $e(e){let t=(0,r.useContext)(je);if(null===t){let t=new Error(`<${e} /> is missing a parent <${He.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,$e),t}return t}je.displayName="DisclosureContext";var Be=(0,r.createContext)(null);function We(e){let t=(0,r.useContext)(Be);if(null===t){let t=new Error(`<${e} /> is missing a parent <${He.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,We),t}return t}Be.displayName="DisclosureAPIContext";var Ue=(0,r.createContext)(null);function Ge(e,t){return A(t.type,Ae,e,t)}Ue.displayName="DisclosurePanelContext";var Ke=r.Fragment;function He(e){let{defaultOpen:t=!1,...n}=e,a=`headlessui-disclosure-button-${O()}`,o=`headlessui-disclosure-panel-${O()}`,l=(0,r.useReducer)(Ge,{disclosureState:t?0:1,linkedPanel:!1,buttonId:a,panelId:o}),[{disclosureState:i},s]=l;(0,r.useEffect)((()=>s({type:2,buttonId:a})),[a,s]),(0,r.useEffect)((()=>s({type:3,panelId:o})),[o,s]);let u=(0,r.useCallback)((e=>{s({type:1});let t=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:document.getElementById(a):document.getElementById(a);null==t||t.focus()}),[s,a]),c=(0,r.useMemo)((()=>({close:u})),[u]),d=(0,r.useMemo)((()=>({open:0===i,close:u})),[i,u]);return r.createElement(je.Provider,{value:l},r.createElement(Be.Provider,{value:c},r.createElement(q,{value:A(i,{0:0,1:1})},j({props:n,slot:d,defaultTag:Ke,name:"Disclosure"}))))}var Qe=B((function(e,t){let[n,a]=$e("Disclosure.Button"),o=(0,r.useRef)(null),l=M(o,t),i=(0,r.useContext)(Ue),s=null!==i&&i===n.panelId,u=(0,r.useCallback)((e=>{var t;if(s){if(1===n.disclosureState)return;switch(e.key){case" ":case"Enter":e.preventDefault(),e.stopPropagation(),a({type:0}),null==(t=document.getElementById(n.buttonId))||t.focus()}}else switch(e.key){case" ":case"Enter":e.preventDefault(),e.stopPropagation(),a({type:0})}}),[a,s,n.disclosureState,n.buttonId]),c=(0,r.useCallback)((e=>{" "===e.key&&e.preventDefault()}),[]),d=(0,r.useCallback)((t=>{var r;G(t.currentTarget)||e.disabled||(s?(a({type:0}),null==(r=document.getElementById(n.buttonId))||r.focus()):a({type:0}))}),[a,e.disabled,n.buttonId,s]),p=(0,r.useMemo)((()=>({open:0===n.disclosureState})),[n]),m=V(e,o);return j({props:{...e,...s?{ref:l,type:m,onKeyDown:u,onClick:d}:{ref:l,id:n.buttonId,type:m,"aria-expanded":e.disabled?void 0:0===n.disclosureState,"aria-controls":n.linkedPanel?n.panelId:void 0,onKeyDown:u,onKeyUp:c,onClick:d}},slot:p,defaultTag:"button",name:"Disclosure.Button"})})),qe=B((function(e,t){let[n,a]=$e("Disclosure.Panel"),{close:o}=We("Disclosure.Panel"),l=M(t,(()=>{n.linkedPanel||a({type:4})})),i=Q(),s=null!==i?0===i:0===n.disclosureState;(0,r.useEffect)((()=>()=>a({type:5})),[a]),(0,r.useEffect)((()=>{var t;1===n.disclosureState&&(null==(t=e.unmount)||t)&&a({type:5})}),[n.disclosureState,e.unmount,a]);let u=(0,r.useMemo)((()=>({open:0===n.disclosureState,close:o})),[n,o]),c={ref:l,id:n.panelId},d=e;return r.createElement(Ue.Provider,{value:n.panelId},j({props:{...d,...c},slot:u,defaultTag:"div",features:3,visible:s,name:"Disclosure.Panel"}))}));He.Button=Qe,He.Panel=qe;var ze={1:e=>e.disabled||1===e.listboxState?e:{...e,activeOptionIndex:null,listboxState:1},0:e=>e.disabled||0===e.listboxState?e:{...e,listboxState:0},2:(e,t)=>e.disabled===t.disabled?e:{...e,disabled:t.disabled},3:(e,t)=>e.orientation===t.orientation?e:{...e,orientation:t.orientation},4(e,t){if(e.disabled||1===e.listboxState)return e;let n=U(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});return""===e.searchQuery&&e.activeOptionIndex===n?e:{...e,searchQuery:"",activeOptionIndex:n}},5:(e,t)=>{if(e.disabled||1===e.listboxState)return e;let n=""!==e.searchQuery?0:1,r=e.searchQuery+t.value.toLowerCase(),a=(null!==e.activeOptionIndex?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find((e=>{var t;return!e.dataRef.current.disabled&&(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(r))})),o=a?e.options.indexOf(a):-1;return-1===o||o===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:o}},6:e=>e.disabled||1===e.listboxState||""===e.searchQuery?e:{...e,searchQuery:""},7:(e,t)=>{var n;let r=Array.from(null==(n=e.optionsRef.current)?void 0:n.querySelectorAll('[id^="headlessui-listbox-option-"]')).reduce(((e,t,n)=>Object.assign(e,{[t.id]:n})),{}),a=[...e.options,{id:t.id,dataRef:t.dataRef}].sort(((e,t)=>r[e.id]-r[t.id]));return{...e,options:a}},8:(e,t)=>{let n=e.options.slice(),r=null!==e.activeOptionIndex?n[e.activeOptionIndex]:null,a=n.findIndex((e=>e.id===t.id));return-1!==a&&n.splice(a,1),{...e,options:n,activeOptionIndex:a===e.activeOptionIndex||null===r?null:n.indexOf(r)}}},Ve=(0,r.createContext)(null);function Ye(e){let t=(0,r.useContext)(Ve);if(null===t){let t=new Error(`<${e} /> is missing a parent <${Ze.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Ye),t}return t}function Je(e,t){return A(t.type,ze,e,t)}Ve.displayName="ListboxContext";var Xe=r.Fragment;function Ze(e){let{value:t,onChange:n,disabled:a=!1,horizontal:o=!1,...l}=e,i=o?"horizontal":"vertical",s=(0,r.useReducer)(Je,{listboxState:1,propsRef:{current:{value:t,onChange:n}},labelRef:(0,r.createRef)(),buttonRef:(0,r.createRef)(),optionsRef:(0,r.createRef)(),disabled:a,orientation:i,options:[],searchQuery:"",activeOptionIndex:null}),[{listboxState:u,propsRef:c,optionsRef:d,buttonRef:p},m]=s;R((()=>{c.current.value=t}),[t,c]),R((()=>{c.current.onChange=n}),[n,c]),R((()=>m({type:2,disabled:a})),[a]),R((()=>m({type:3,orientation:i})),[i]),K("mousedown",(e=>{var t,n,r;let a=e.target;0===u&&((null==(t=p.current)?void 0:t.contains(a))||(null==(n=d.current)?void 0:n.contains(a))||(m({type:1}),ce(a,1)||(e.preventDefault(),null==(r=p.current)||r.focus())))}));let f=(0,r.useMemo)((()=>({open:0===u,disabled:a})),[u,a]);return r.createElement(Ve.Provider,{value:s},r.createElement(q,{value:A(u,{0:0,1:1})},j({props:l,slot:f,defaultTag:Xe,name:"Listbox"})))}var et=B((function(e,t){var n;let[a,o]=Ye("Listbox.Button"),l=M(a.buttonRef,t),i=`headlessui-listbox-button-${O()}`,s=S(),u=(0,r.useCallback)((e=>{switch(e.key){case" ":case"Enter":case"ArrowDown":e.preventDefault(),o({type:0}),s.nextFrame((()=>{a.propsRef.current.value||o({type:4,focus:0})}));break;case"ArrowUp":e.preventDefault(),o({type:0}),s.nextFrame((()=>{a.propsRef.current.value||o({type:4,focus:3})}))}}),[o,a,s]),c=(0,r.useCallback)((e=>{" "===e.key&&e.preventDefault()}),[]),d=(0,r.useCallback)((e=>{if(G(e.currentTarget))return e.preventDefault();0===a.listboxState?(o({type:1}),s.nextFrame((()=>{var e;return null==(e=a.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(e.preventDefault(),o({type:0}))}),[o,s,a]),p=L((()=>{if(a.labelRef.current)return[a.labelRef.current.id,i].join(" ")}),[a.labelRef.current,i]),m=(0,r.useMemo)((()=>({open:0===a.listboxState,disabled:a.disabled})),[a]);return j({props:{...e,ref:l,id:i,type:V(e,a.buttonRef),"aria-haspopup":!0,"aria-controls":null==(n=a.optionsRef.current)?void 0:n.id,"aria-expanded":a.disabled?void 0:0===a.listboxState,"aria-labelledby":p,disabled:a.disabled,onKeyDown:u,onKeyUp:c,onClick:d},slot:m,defaultTag:"button",name:"Listbox.Button"})})),tt=B((function(e,t){var n;let[a,o]=Ye("Listbox.Options"),l=M(a.optionsRef,t),i=`headlessui-listbox-options-${O()}`,s=S(),u=S(),c=Q(),d=null!==c?0===c:0===a.listboxState;R((()=>{let e=a.optionsRef.current;!e||0===a.listboxState&&e!==document.activeElement&&e.focus({preventScroll:!0})}),[a.listboxState,a.optionsRef]);let p=(0,r.useCallback)((e=>{switch(u.dispose(),e.key){case" ":if(""!==a.searchQuery)return e.preventDefault(),e.stopPropagation(),o({type:5,value:e.key});case"Enter":if(e.preventDefault(),e.stopPropagation(),o({type:1}),null!==a.activeOptionIndex){let{dataRef:e}=a.options[a.activeOptionIndex];a.propsRef.current.onChange(e.current.value)}I().nextFrame((()=>{var e;return null==(e=a.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case A(a.orientation,{vertical:"ArrowDown",horizontal:"ArrowRight"}):return e.preventDefault(),e.stopPropagation(),o({type:4,focus:2});case A(a.orientation,{vertical:"ArrowUp",horizontal:"ArrowLeft"}):return e.preventDefault(),e.stopPropagation(),o({type:4,focus:1});case"Home":case"PageUp":return e.preventDefault(),e.stopPropagation(),o({type:4,focus:0});case"End":case"PageDown":return e.preventDefault(),e.stopPropagation(),o({type:4,focus:3});case"Escape":return e.preventDefault(),e.stopPropagation(),o({type:1}),s.nextFrame((()=>{var e;return null==(e=a.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));case"Tab":e.preventDefault(),e.stopPropagation();break;default:1===e.key.length&&(o({type:5,value:e.key}),u.setTimeout((()=>o({type:6})),350))}}),[s,o,u,a]),m=L((()=>{var e,t,n;return null!=(n=null==(e=a.labelRef.current)?void 0:e.id)?n:null==(t=a.buttonRef.current)?void 0:t.id}),[a.labelRef.current,a.buttonRef.current]),f=(0,r.useMemo)((()=>({open:0===a.listboxState})),[a]);return j({props:{...e,"aria-activedescendant":null===a.activeOptionIndex||null==(n=a.options[a.activeOptionIndex])?void 0:n.id,"aria-labelledby":m,"aria-orientation":a.orientation,id:i,onKeyDown:p,role:"listbox",tabIndex:0,ref:l},slot:f,defaultTag:"ul",features:3,visible:d,name:"Listbox.Options"})}));Ze.Button=et,Ze.Label=function(e){let[t]=Ye("Listbox.Label"),n=`headlessui-listbox-label-${O()}`,a=(0,r.useCallback)((()=>{var e;return null==(e=t.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),[t.buttonRef]),o=(0,r.useMemo)((()=>({open:0===t.listboxState,disabled:t.disabled})),[t]);return j({props:{...e,ref:t.labelRef,id:n,onClick:a},slot:o,defaultTag:"label",name:"Listbox.Label"})},Ze.Options=tt,Ze.Option=function(e){let{disabled:t=!1,value:n,...a}=e,[o,l]=Ye("Listbox.Option"),i=`headlessui-listbox-option-${O()}`,s=null!==o.activeOptionIndex&&o.options[o.activeOptionIndex].id===i,u=o.propsRef.current.value===n,c=(0,r.useRef)({disabled:t,value:n});R((()=>{c.current.disabled=t}),[c,t]),R((()=>{c.current.value=n}),[c,n]),R((()=>{var e,t;c.current.textValue=null==(t=null==(e=document.getElementById(i))?void 0:e.textContent)?void 0:t.toLowerCase()}),[c,i]);let d=(0,r.useCallback)((()=>o.propsRef.current.onChange(n)),[o.propsRef,n]);R((()=>(l({type:7,id:i,dataRef:c}),()=>l({type:8,id:i}))),[c,i]),R((()=>{var e,t;0===o.listboxState&&(!u||(l({type:4,focus:4,id:i}),null==(t=null==(e=document.getElementById(i))?void 0:e.focus)||t.call(e)))}),[o.listboxState]),R((()=>{if(0!==o.listboxState||!s)return;let e=I();return e.requestAnimationFrame((()=>{var e,t;null==(t=null==(e=document.getElementById(i))?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"})})),e.dispose}),[i,s,o.listboxState,o.activeOptionIndex]);let p=(0,r.useCallback)((e=>{if(t)return e.preventDefault();d(),l({type:1}),I().nextFrame((()=>{var e;return null==(e=o.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),[l,o.buttonRef,t,d]),m=(0,r.useCallback)((()=>{if(t)return l({type:4,focus:5});l({type:4,focus:4,id:i})}),[t,i,l]),f=(0,r.useCallback)((()=>{t||s||l({type:4,focus:4,id:i})}),[t,s,i,l]),b=(0,r.useCallback)((()=>{t||!s||l({type:4,focus:5})}),[t,s,l]),v=(0,r.useMemo)((()=>({active:s,selected:u,disabled:t})),[s,u,t]);return j({props:{...a,id:i,role:"option",tabIndex:!0===t?void 0:-1,"aria-disabled":!0===t||void 0,"aria-selected":!0===u||void 0,disabled:void 0,onClick:p,onFocus:m,onPointerMove:f,onMouseMove:f,onPointerLeave:b,onMouseLeave:b},slot:v,defaultTag:"li",name:"Listbox.Option"})};var nt={1:e=>1===e.menuState?e:{...e,activeItemIndex:null,menuState:1},0:e=>0===e.menuState?e:{...e,menuState:0},2:(e,t)=>{let n=U(t,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});return""===e.searchQuery&&e.activeItemIndex===n?e:{...e,searchQuery:"",activeItemIndex:n}},3:(e,t)=>{let n=""!==e.searchQuery?0:1,r=e.searchQuery+t.value.toLowerCase(),a=(null!==e.activeItemIndex?e.items.slice(e.activeItemIndex+n).concat(e.items.slice(0,e.activeItemIndex+n)):e.items).find((e=>{var t;return(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(r))&&!e.dataRef.current.disabled})),o=a?e.items.indexOf(a):-1;return-1===o||o===e.activeItemIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeItemIndex:o}},4:e=>""===e.searchQuery?e:{...e,searchQuery:"",searchActiveItemIndex:null},5:(e,t)=>{var n;let r=Array.from(null==(n=e.itemsRef.current)?void 0:n.querySelectorAll('[id^="headlessui-menu-item-"]')).reduce(((e,t,n)=>Object.assign(e,{[t.id]:n})),{}),a=[...e.items,{id:t.id,dataRef:t.dataRef}].sort(((e,t)=>r[e.id]-r[t.id]));return{...e,items:a}},6:(e,t)=>{let n=e.items.slice(),r=null!==e.activeItemIndex?n[e.activeItemIndex]:null,a=n.findIndex((e=>e.id===t.id));return-1!==a&&n.splice(a,1),{...e,items:n,activeItemIndex:a===e.activeItemIndex||null===r?null:n.indexOf(r)}}},rt=(0,r.createContext)(null);function at(e){let t=(0,r.useContext)(rt);if(null===t){let t=new Error(`<${e} /> is missing a parent <${it.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,at),t}return t}function ot(e,t){return A(t.type,nt,e,t)}rt.displayName="MenuContext";var lt=r.Fragment;function it(e){let t=(0,r.useReducer)(ot,{menuState:1,buttonRef:(0,r.createRef)(),itemsRef:(0,r.createRef)(),items:[],searchQuery:"",activeItemIndex:null}),[{menuState:n,itemsRef:a,buttonRef:o},l]=t;K("mousedown",(e=>{var t,r,i;let s=e.target;0===n&&((null==(t=o.current)?void 0:t.contains(s))||(null==(r=a.current)?void 0:r.contains(s))||(l({type:1}),ce(s,1)||(e.preventDefault(),null==(i=o.current)||i.focus())))}));let i=(0,r.useMemo)((()=>({open:0===n})),[n]);return r.createElement(rt.Provider,{value:t},r.createElement(q,{value:A(n,{0:0,1:1})},j({props:e,slot:i,defaultTag:lt,name:"Menu"})))}var st=B((function(e,t){var n;let[a,o]=at("Menu.Button"),l=M(a.buttonRef,t),i=`headlessui-menu-button-${O()}`,s=S(),u=(0,r.useCallback)((e=>{switch(e.key){case" ":case"Enter":case"ArrowDown":e.preventDefault(),e.stopPropagation(),o({type:0}),s.nextFrame((()=>o({type:2,focus:0})));break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),o({type:0}),s.nextFrame((()=>o({type:2,focus:3})))}}),[o,s]),c=(0,r.useCallback)((e=>{" "===e.key&&e.preventDefault()}),[]),d=(0,r.useCallback)((t=>{if(G(t.currentTarget))return t.preventDefault();e.disabled||(0===a.menuState?(o({type:1}),s.nextFrame((()=>{var e;return null==(e=a.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))):(t.preventDefault(),t.stopPropagation(),o({type:0})))}),[o,s,a,e.disabled]),p=(0,r.useMemo)((()=>({open:0===a.menuState})),[a]);return j({props:{...e,ref:l,id:i,type:V(e,a.buttonRef),"aria-haspopup":!0,"aria-controls":null==(n=a.itemsRef.current)?void 0:n.id,"aria-expanded":e.disabled?void 0:0===a.menuState,onKeyDown:u,onKeyUp:c,onClick:d},slot:p,defaultTag:"button",name:"Menu.Button"})})),ut=B((function(e,t){var n,a;let[o,l]=at("Menu.Items"),i=M(o.itemsRef,t),s=`headlessui-menu-items-${O()}`,u=S(),c=Q(),d=null!==c?0===c:0===o.menuState;(0,r.useEffect)((()=>{let e=o.itemsRef.current;!e||0===o.menuState&&e!==document.activeElement&&e.focus({preventScroll:!0})}),[o.menuState,o.itemsRef]),Y({container:o.itemsRef.current,enabled:0===o.menuState,accept:e=>"menuitem"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let p=(0,r.useCallback)((e=>{var t;switch(u.dispose(),e.key){case" ":if(""!==o.searchQuery)return e.preventDefault(),e.stopPropagation(),l({type:3,value:e.key});case"Enter":if(e.preventDefault(),e.stopPropagation(),l({type:1}),null!==o.activeItemIndex){let{id:e}=o.items[o.activeItemIndex];null==(t=document.getElementById(e))||t.click()}I().nextFrame((()=>{var e;return null==(e=o.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case"ArrowDown":return e.preventDefault(),e.stopPropagation(),l({type:2,focus:2});case"ArrowUp":return e.preventDefault(),e.stopPropagation(),l({type:2,focus:1});case"Home":case"PageUp":return e.preventDefault(),e.stopPropagation(),l({type:2,focus:0});case"End":case"PageDown":return e.preventDefault(),e.stopPropagation(),l({type:2,focus:3});case"Escape":e.preventDefault(),e.stopPropagation(),l({type:1}),I().nextFrame((()=>{var e;return null==(e=o.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case"Tab":e.preventDefault(),e.stopPropagation();break;default:1===e.key.length&&(l({type:3,value:e.key}),u.setTimeout((()=>l({type:4})),350))}}),[l,u,o]),m=(0,r.useCallback)((e=>{" "===e.key&&e.preventDefault()}),[]),f=(0,r.useMemo)((()=>({open:0===o.menuState})),[o]);return j({props:{...e,"aria-activedescendant":null===o.activeItemIndex||null==(n=o.items[o.activeItemIndex])?void 0:n.id,"aria-labelledby":null==(a=o.buttonRef.current)?void 0:a.id,id:s,onKeyDown:p,onKeyUp:m,role:"menu",tabIndex:0,ref:i},slot:f,defaultTag:"div",features:3,visible:d,name:"Menu.Items"})})),ct=r.Fragment;it.Button=st,it.Items=ut,it.Item=function(e){let{disabled:t=!1,onClick:n,...a}=e,[o,l]=at("Menu.Item"),i=`headlessui-menu-item-${O()}`,s=null!==o.activeItemIndex&&o.items[o.activeItemIndex].id===i;R((()=>{if(0!==o.menuState||!s)return;let e=I();return e.requestAnimationFrame((()=>{var e,t;null==(t=null==(e=document.getElementById(i))?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"})})),e.dispose}),[i,s,o.menuState,o.activeItemIndex]);let u=(0,r.useRef)({disabled:t});R((()=>{u.current.disabled=t}),[u,t]),R((()=>{var e,t;u.current.textValue=null==(t=null==(e=document.getElementById(i))?void 0:e.textContent)?void 0:t.toLowerCase()}),[u,i]),R((()=>(l({type:5,id:i,dataRef:u}),()=>l({type:6,id:i}))),[u,i]);let c=(0,r.useCallback)((e=>t?e.preventDefault():(l({type:1}),I().nextFrame((()=>{var e;return null==(e=o.buttonRef.current)?void 0:e.focus({preventScroll:!0})})),n?n(e):void 0)),[l,o.buttonRef,t,n]),d=(0,r.useCallback)((()=>{if(t)return l({type:2,focus:5});l({type:2,focus:4,id:i})}),[t,i,l]),p=(0,r.useCallback)((()=>{t||s||l({type:2,focus:4,id:i})}),[t,s,i,l]),m=(0,r.useCallback)((()=>{t||!s||l({type:2,focus:5})}),[t,s,l]),f=(0,r.useMemo)((()=>({active:s,disabled:t})),[s,t]);return j({props:{...a,id:i,role:"menuitem",tabIndex:!0===t?void 0:-1,"aria-disabled":!0===t||void 0,disabled:void 0,onClick:c,onFocus:d,onPointerMove:p,onMouseMove:p,onPointerLeave:m,onMouseLeave:m},slot:f,defaultTag:ct,name:"Menu.Item"})};var dt={0:e=>({...e,popoverState:A(e.popoverState,{0:1,1:0})}),1:e=>1===e.popoverState?e:{...e,popoverState:1},2:(e,t)=>e.button===t.button?e:{...e,button:t.button},3:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},4:(e,t)=>e.panel===t.panel?e:{...e,panel:t.panel},5:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId}},pt=(0,r.createContext)(null);function mt(e){let t=(0,r.useContext)(pt);if(null===t){let t=new Error(`<${e} /> is missing a parent <${yt.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,mt),t}return t}pt.displayName="PopoverContext";var ft=(0,r.createContext)(null);function bt(e){let t=(0,r.useContext)(ft);if(null===t){let t=new Error(`<${e} /> is missing a parent <${yt.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,bt),t}return t}ft.displayName="PopoverAPIContext";var vt=(0,r.createContext)(null);function xt(){return(0,r.useContext)(vt)}vt.displayName="PopoverGroupContext";var gt=(0,r.createContext)(null);function ht(e,t){return A(t.type,dt,e,t)}function yt(e){let t=`headlessui-popover-button-${O()}`,n=`headlessui-popover-panel-${O()}`,a=(0,r.useReducer)(ht,{popoverState:1,button:null,buttonId:t,panel:null,panelId:n}),[{popoverState:o,button:l,panel:i},s]=a;(0,r.useEffect)((()=>s({type:3,buttonId:t})),[t,s]),(0,r.useEffect)((()=>s({type:5,panelId:n})),[n,s]);let u=(0,r.useMemo)((()=>({buttonId:t,panelId:n,close:()=>s({type:1})})),[t,n,s]),c=xt(),d=null==c?void 0:c.registerPopover,p=(0,r.useCallback)((()=>{var e;return null!=(e=null==c?void 0:c.isFocusWithinPopoverGroup())?e:(null==l?void 0:l.contains(document.activeElement))||(null==i?void 0:i.contains(document.activeElement))}),[c,l,i]);(0,r.useEffect)((()=>null==d?void 0:d(u)),[d,u]),K("focus",(()=>{0===o&&(p()||!l||!i||s({type:1}))}),!0),K("mousedown",(e=>{let t=e.target;0===o&&((null==l?void 0:l.contains(t))||(null==i?void 0:i.contains(t))||(s({type:1}),ce(t,1)||(e.preventDefault(),null==l||l.focus())))}));let m=(0,r.useCallback)((e=>{s({type:1});let t=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:l:l;null==t||t.focus()}),[s,l]),f=(0,r.useMemo)((()=>({close:m})),[m]),b=(0,r.useMemo)((()=>({open:0===o,close:m})),[o,m]);return r.createElement(pt.Provider,{value:a},r.createElement(ft.Provider,{value:f},r.createElement(q,{value:A(o,{0:0,1:1})},j({props:e,slot:b,defaultTag:"div",name:"Popover"}))))}gt.displayName="PopoverPanelContext";var wt=B((function(e,t){let[n,a]=mt("Popover.Button"),o=(0,r.useRef)(null),l=xt(),i=null==l?void 0:l.closeOthers,s=(0,r.useContext)(gt),u=null!==s&&s===n.panelId,c=M(o,t,u?null:e=>a({type:2,button:e})),d=M(o,t),p=(0,r.useRef)(null),m=(0,r.useRef)("undefined"==typeof window?null:document.activeElement);K("focus",(()=>{m.current=p.current,p.current=document.activeElement}),!0);let f=(0,r.useCallback)((e=>{var t,r;if(u){if(1===n.popoverState)return;switch(e.key){case" ":case"Enter":e.preventDefault(),e.stopPropagation(),a({type:1}),null==(t=n.button)||t.focus()}}else switch(e.key){case" ":case"Enter":e.preventDefault(),e.stopPropagation(),1===n.popoverState&&(null==i||i(n.buttonId)),a({type:0});break;case"Escape":if(0!==n.popoverState)return null==i?void 0:i(n.buttonId);if(!o.current||!o.current.contains(document.activeElement))return;e.preventDefault(),e.stopPropagation(),a({type:1});break;case"Tab":if(0!==n.popoverState||!n.panel||!n.button)return;if(e.shiftKey){if(!m.current||(null==(r=n.button)?void 0:r.contains(m.current))||n.panel.contains(m.current))return;let t=ue(),a=t.indexOf(m.current);if(t.indexOf(n.button)>a)return;e.preventDefault(),e.stopPropagation(),pe(n.panel,8)}else e.preventDefault(),e.stopPropagation(),pe(n.panel,1)}}),[a,n.popoverState,n.buttonId,n.button,n.panel,o,i,u]),b=(0,r.useCallback)((e=>{var t;if(!u&&(" "===e.key&&e.preventDefault(),0===n.popoverState&&n.panel&&n.button)&&"Tab"===e.key){if(!m.current||(null==(t=n.button)?void 0:t.contains(m.current))||n.panel.contains(m.current))return;let r=ue(),a=r.indexOf(m.current);if(r.indexOf(n.button)>a)return;e.preventDefault(),e.stopPropagation(),pe(n.panel,8)}}),[n.popoverState,n.panel,n.button,u]),v=(0,r.useCallback)((t=>{var r,o;G(t.currentTarget)||e.disabled||(u?(a({type:1}),null==(r=n.button)||r.focus()):(1===n.popoverState&&(null==i||i(n.buttonId)),null==(o=n.button)||o.focus(),a({type:0})))}),[a,n.button,n.popoverState,n.buttonId,e.disabled,i,u]),x=(0,r.useMemo)((()=>({open:0===n.popoverState})),[n]),g=V(e,o);return j({props:{...e,...u?{ref:d,type:g,onKeyDown:f,onClick:v}:{ref:c,id:n.buttonId,type:g,"aria-expanded":e.disabled?void 0:0===n.popoverState,"aria-controls":n.panel?n.panelId:void 0,onKeyDown:f,onKeyUp:b,onClick:v}},slot:x,defaultTag:"button",name:"Popover.Button"})})),Et=B((function(e,t){let[{popoverState:n},a]=mt("Popover.Overlay"),o=M(t),l=`headlessui-popover-overlay-${O()}`,i=Q(),s=null!==i?0===i:0===n;return j({props:{...e,ref:o,id:l,"aria-hidden":!0,onClick:(0,r.useCallback)((e=>{if(G(e.currentTarget))return e.preventDefault();a({type:1})}),[a])},slot:(0,r.useMemo)((()=>({open:0===n})),[n]),defaultTag:"div",features:3,visible:s,name:"Popover.Overlay"})})),kt=B((function(e,t){let{focus:n=!1,...a}=e,[o,l]=mt("Popover.Panel"),{close:i}=bt("Popover.Panel"),s=(0,r.useRef)(null),u=M(s,t,(e=>{l({type:4,panel:e})})),c=Q(),d=null!==c?0===c:0===o.popoverState,p=(0,r.useCallback)((e=>{var t;if("Escape"===e.key){if(0!==o.popoverState||!s.current||!s.current.contains(document.activeElement))return;e.preventDefault(),e.stopPropagation(),l({type:1}),null==(t=o.button)||t.focus()}}),[o,s,l]);(0,r.useEffect)((()=>()=>l({type:4,panel:null})),[l]),(0,r.useEffect)((()=>{var t;e.static||1===o.popoverState&&(null==(t=e.unmount)||t)&&l({type:4,panel:null})}),[o.popoverState,e.unmount,e.static,l]),(0,r.useEffect)((()=>{if(!n||0!==o.popoverState||!s.current)return;let e=document.activeElement;s.current.contains(e)||pe(s.current,1)}),[n,s,o.popoverState]),K("keydown",(e=>{var t;if(!(0===o.popoverState&&s.current&&"Tab"===e.key&&document.activeElement&&s.current&&s.current.contains(document.activeElement)))return;e.preventDefault();let n=pe(s.current,e.shiftKey?2:4);if(3===n)return null==(t=o.button)?void 0:t.focus();if(1===n){if(!o.button)return;let e=ue(),t=e.indexOf(o.button);0===pe(e.splice(t+1).filter((e=>{var t;return!(null==(t=s.current)?void 0:t.contains(e))})),1)&&pe(document.body,1)}})),K("focus",(()=>{var e;!n||0===o.popoverState&&(!s.current||(null==(e=s.current)?void 0:e.contains(document.activeElement))||l({type:1}))}),!0);let m=(0,r.useMemo)((()=>({open:0===o.popoverState,close:i})),[o,i]),f={ref:u,id:o.panelId,onKeyDown:p};return r.createElement(gt.Provider,{value:o.panelId},j({props:{...a,...f},slot:m,defaultTag:"div",features:3,visible:d,name:"Popover.Panel"}))}));yt.Button=wt,yt.Overlay=Et,yt.Panel=kt,yt.Group=function(e){let t=(0,r.useRef)(null),[n,a]=(0,r.useState)([]),o=(0,r.useCallback)((e=>{a((t=>{let n=t.indexOf(e);if(-1!==n){let e=t.slice();return e.splice(n,1),e}return t}))}),[a]),l=(0,r.useCallback)((e=>(a((t=>[...t,e])),()=>o(e))),[a,o]),i=(0,r.useCallback)((()=>{var e;let r=document.activeElement;return!!(null==(e=t.current)?void 0:e.contains(r))||n.some((e=>{var t,n;return(null==(t=document.getElementById(e.buttonId))?void 0:t.contains(r))||(null==(n=document.getElementById(e.panelId))?void 0:n.contains(r))}))}),[t,n]),s=(0,r.useCallback)((e=>{for(let t of n)t.buttonId!==e&&t.close()}),[n]),u=(0,r.useMemo)((()=>({registerPopover:l,unregisterPopover:o,isFocusWithinPopoverGroup:i,closeOthers:s})),[l,o,i,s]),c=(0,r.useMemo)((()=>({})),[]),d={ref:t},p=e;return r.createElement(vt.Provider,{value:u},j({props:{...p,...d},slot:c,defaultTag:"div",name:"Popover.Group"}))};var Ct=(0,r.createContext)(null);function _t(){let e=(0,r.useContext)(Ct);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,_t),e}return e}function It(){let[e,t]=(0,r.useState)([]);return[e.length>0?e.join(" "):void 0,(0,r.useMemo)((()=>function(e){let n=(0,r.useCallback)((e=>(t((t=>[...t,e])),()=>t((t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n})))),[]),a=(0,r.useMemo)((()=>({register:n,slot:e.slot,name:e.name,props:e.props})),[n,e.slot,e.name,e.props]);return r.createElement(Ct.Provider,{value:a},e.children)}),[t])]}function St(e){let{passive:t=!1,...n}=e,r=_t(),a=`headlessui-label-${O()}`;R((()=>r.register(a)),[a,r.register]);let o={...n,...{...r.props,id:a}};return t&&delete o.onClick,j({props:o,slot:r.slot||{},defaultTag:"label",name:r.name||"Label"})}var Rt={0:(e,t)=>({...e,options:[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}]}),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})}},Nt=(0,r.createContext)(null);function Pt(e){let t=(0,r.useContext)(Nt);if(null===t){let t=new Error(`<${e} /> is missing a parent <${Dt.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Pt),t}return t}function Tt(e,t){return A(t.type,Rt,e,t)}function Dt(e){let{value:t,onChange:n,disabled:a=!1,...o}=e,[{options:l},i]=(0,r.useReducer)(Tt,{options:[]}),[s,u]=It(),[c,d]=Ie(),p=`headlessui-radiogroup-${O()}`,m=(0,r.useRef)(null),f=(0,r.useMemo)((()=>l.find((e=>!e.propsRef.current.disabled))),[l]),b=(0,r.useMemo)((()=>l.some((e=>e.propsRef.current.value===t))),[l,t]),v=(0,r.useCallback)((e=>{var r;if(a||e===t)return!1;let o=null==(r=l.find((t=>t.propsRef.current.value===e)))?void 0:r.propsRef.current;return!(null==o?void 0:o.disabled)&&(n(e),!0)}),[n,t,a,l]);Y({container:m.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 x=(0,r.useCallback)((e=>{if(!m.current)return;let t=l.filter((e=>!1===e.propsRef.current.disabled)).map((e=>e.element.current));switch(e.key){case"ArrowLeft":case"ArrowUp":if(e.preventDefault(),e.stopPropagation(),2===pe(t,18)){let e=l.find((e=>e.element.current===document.activeElement));e&&v(e.propsRef.current.value)}break;case"ArrowRight":case"ArrowDown":if(e.preventDefault(),e.stopPropagation(),2===pe(t,20)){let e=l.find((e=>e.element.current===document.activeElement));e&&v(e.propsRef.current.value)}break;case" ":{e.preventDefault(),e.stopPropagation();let t=l.find((e=>e.element.current===document.activeElement));t&&v(t.propsRef.current.value)}}}),[m,l,v]),g=(0,r.useCallback)((e=>(i({type:0,...e}),()=>i({type:1,id:e.id}))),[i]),h=(0,r.useMemo)((()=>({registerOption:g,firstOption:f,containsCheckedOption:b,change:v,disabled:a,value:t})),[g,f,b,v,a,t]),y={ref:m,id:p,role:"radiogroup","aria-labelledby":s,"aria-describedby":c,onKeyDown:x};return r.createElement(d,{name:"RadioGroup.Description"},r.createElement(u,{name:"RadioGroup.Label"},r.createElement(Nt.Provider,{value:h},j({props:{...o,...y},defaultTag:"div",name:"RadioGroup"}))))}Nt.displayName="RadioGroupContext",Dt.Option=function(e){let t=(0,r.useRef)(null),n=`headlessui-radiogroup-option-${O()}`,[a,o]=It(),[l,i]=Ie(),{addFlag:s,removeFlag:u,hasFlag:c}=function(e=0){let[t,n]=(0,r.useState)(e);return{addFlag:(0,r.useCallback)((e=>n((t=>t|e))),[n]),hasFlag:(0,r.useCallback)((e=>Boolean(t&e)),[t]),removeFlag:(0,r.useCallback)((e=>n((t=>t&~e))),[n]),toggleFlag:(0,r.useCallback)((e=>n((t=>t^e))),[n])}}(1),{value:d,disabled:p=!1,...m}=e,f=(0,r.useRef)({value:d,disabled:p});R((()=>{f.current.value=d}),[d,f]),R((()=>{f.current.disabled=p}),[p,f]);let{registerOption:b,disabled:v,change:x,firstOption:g,containsCheckedOption:h,value:y}=Pt("RadioGroup.Option");R((()=>b({id:n,element:t,propsRef:f})),[n,b,t,e]);let w=(0,r.useCallback)((()=>{var e;!x(d)||(s(2),null==(e=t.current)||e.focus())}),[s,x,d]),E=(0,r.useCallback)((()=>s(2)),[s]),k=(0,r.useCallback)((()=>u(2)),[u]),C=(null==g?void 0:g.id)===n,_=v||p,I=y===d,S={ref:t,id:n,role:"radio","aria-checked":I?"true":"false","aria-labelledby":a,"aria-describedby":l,"aria-disabled":!!_||void 0,tabIndex:_?-1:I||!h&&C?0:-1,onClick:_?void 0:w,onFocus:_?void 0:E,onBlur:_?void 0:k},N=(0,r.useMemo)((()=>({checked:I,disabled:_,active:c(2)})),[I,_,c]);return r.createElement(i,{name:"RadioGroup.Description"},r.createElement(o,{name:"RadioGroup.Label"},j({props:{...m,...S},slot:N,defaultTag:"div",name:"RadioGroup.Option"})))},Dt.Label=St,Dt.Description=Se;var Ot=(0,r.createContext)(null);Ot.displayName="GroupContext";var Ft=r.Fragment;function Lt(e){let{checked:t,onChange:n,...a}=e,o=`headlessui-switch-${O()}`,l=(0,r.useContext)(Ot),i=(0,r.useRef)(null),s=M(i,null===l?null:l.setSwitch),u=(0,r.useCallback)((()=>n(!t)),[n,t]),c=(0,r.useCallback)((e=>{if(G(e.currentTarget))return e.preventDefault();e.preventDefault(),u()}),[u]),d=(0,r.useCallback)((e=>{"Tab"!==e.key&&e.preventDefault()," "===e.key&&u()}),[u]),p=(0,r.useCallback)((e=>e.preventDefault()),[]),m=(0,r.useMemo)((()=>({checked:t})),[t]);return j({props:{...a,id:o,ref:s,role:"switch",type:V(e,i),tabIndex:0,"aria-checked":t,"aria-labelledby":null==l?void 0:l.labelledby,"aria-describedby":null==l?void 0:l.describedby,onClick:c,onKeyUp:d,onKeyPress:p},slot:m,defaultTag:"button",name:"Switch"})}Lt.Group=function(e){let[t,n]=(0,r.useState)(null),[a,o]=It(),[l,i]=Ie(),s=(0,r.useMemo)((()=>({switch:t,setSwitch:n,labelledby:a,describedby:l})),[t,n,a,l]);return r.createElement(i,{name:"Switch.Description"},r.createElement(o,{name:"Switch.Label",props:{onClick(){!t||(t.click(),t.focus({preventScroll:!0}))}}},r.createElement(Ot.Provider,{value:s},j({props:e,defaultTag:Ft,name:"Switch.Group"}))))},Lt.Label=St,Lt.Description=Se;var Mt={0:(e,t)=>e.selectedIndex===t.index?e:{...e,selectedIndex:t.index},1:(e,t)=>e.orientation===t.orientation?e:{...e,orientation:t.orientation},2:(e,t)=>e.activation===t.activation?e:{...e,activation:t.activation},3:(e,t)=>e.tabs.includes(t.tab)?e:{...e,tabs:[...e.tabs,t.tab]},4:(e,t)=>({...e,tabs:e.tabs.filter((e=>e!==t.tab))}),5:(e,t)=>e.panels.includes(t.panel)?e:{...e,panels:[...e.panels,t.panel]},6:(e,t)=>({...e,panels:e.panels.filter((e=>e!==t.panel))}),7:e=>({...e})},At=(0,r.createContext)(null);function jt(e){let t=(0,r.useContext)(At);if(null===t){let t=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,jt),t}return t}function $t(e,t){return A(t.type,Mt,e,t)}At.displayName="TabsContext";var Bt=r.Fragment;function Wt(e){var t,n;let a=`headlessui-tabs-tab-${O()}`,[{selectedIndex:o,tabs:l,panels:i,orientation:s,activation:u},{dispatch:c,change:d}]=jt(Wt.name),p=(0,r.useRef)(null),m=M(p,(e=>{!e||c({type:7})}));R((()=>(c({type:3,tab:p}),()=>c({type:4,tab:p}))),[c,p]);let f=l.indexOf(p),b=f===o,v=(0,r.useCallback)((e=>{let t=l.map((e=>e.current)).filter(Boolean);if(" "===e.key||"Enter"===e.key)return e.preventDefault(),e.stopPropagation(),void d(f);switch(e.key){case"Home":case"PageUp":return e.preventDefault(),e.stopPropagation(),pe(t,1);case"End":case"PageDown":return e.preventDefault(),e.stopPropagation(),pe(t,8)}return A(s,{vertical:()=>"ArrowUp"===e.key?pe(t,18):"ArrowDown"===e.key?pe(t,20):void 0,horizontal:()=>"ArrowLeft"===e.key?pe(t,18):"ArrowRight"===e.key?pe(t,20):void 0})}),[l,s,f,d]),x=(0,r.useCallback)((()=>{var e;null==(e=p.current)||e.focus()}),[p]),g=(0,r.useCallback)((()=>{var e;null==(e=p.current)||e.focus(),d(f)}),[d,f,p]),h=(0,r.useMemo)((()=>({selected:b})),[b]),y={ref:m,onKeyDown:v,onFocus:"manual"===u?x:g,onClick:g,id:a,role:"tab",type:V(e,p),"aria-controls":null==(n=null==(t=i[f])?void 0:t.current)?void 0:n.id,"aria-selected":b,tabIndex:b?0:-1};return j({props:{...e,...y},slot:h,defaultTag:"button",name:"Tabs.Tab"})}function Ut(e,...t){e&&t.length>0&&e.classList.add(...t)}function Gt(e,...t){e&&t.length>0&&e.classList.remove(...t)}function Kt(e,t,n,r,a,o){let l=I(),i=void 0!==o?function(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}(o):()=>{};return Gt(e,...a),Ut(e,...t,...n),l.nextFrame((()=>{Gt(e,...n),Ut(e,...r),l.add(function(e,t){let n=I();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:a}=getComputedStyle(e),[o,l]=[r,a].map((e=>{let[t=0]=e.split(",").filter(Boolean).map((e=>e.includes("ms")?parseFloat(e):1e3*parseFloat(e))).sort(((e,t)=>t-e));return t}));return 0!==o?n.setTimeout((()=>{t("finished")}),o+l):t("finished"),n.add((()=>t("cancelled"))),n.dispose}(e,(n=>(Gt(e,...r,...t),Ut(e,...a),i(n)))))})),l.add((()=>Gt(e,...t,...n,...r,...a))),l.add((()=>i("cancelled"))),l.dispose}function Ht(e=""){return(0,r.useMemo)((()=>e.split(" ").filter((e=>e.trim().length>1))),[e])}Wt.Group=function(e){let{defaultIndex:t=0,vertical:n=!1,manual:a=!1,onChange:o,selectedIndex:l=null,...i}=e,s=n?"vertical":"horizontal",u=a?"manual":"auto",[c,d]=(0,r.useReducer)($t,{selectedIndex:null,tabs:[],panels:[],orientation:s,activation:u}),p=(0,r.useMemo)((()=>({selectedIndex:c.selectedIndex})),[c.selectedIndex]),m=(0,r.useRef)((()=>{}));(0,r.useEffect)((()=>{d({type:1,orientation:s})}),[s]),(0,r.useEffect)((()=>{d({type:2,activation:u})}),[u]),(0,r.useEffect)((()=>{"function"==typeof o&&(m.current=o)}),[o]),(0,r.useEffect)((()=>{if(c.tabs.length<=0||null===l&&null!==c.selectedIndex)return;let e=c.tabs.map((e=>e.current)).filter(Boolean),n=e.filter((e=>!e.hasAttribute("disabled"))),r=null!=l?l:t;if(r<0)d({type:0,index:e.indexOf(n[0])});else if(r>c.tabs.length)d({type:0,index:e.indexOf(n[n.length-1])});else{let t=e.slice(0,r),a=[...e.slice(r),...t].find((e=>n.includes(e)));if(!a)return;d({type:0,index:e.indexOf(a)})}}),[t,l,c.tabs,c.selectedIndex]);let f=(0,r.useRef)(c.selectedIndex);(0,r.useEffect)((()=>{f.current=c.selectedIndex}),[c.selectedIndex]);let b=(0,r.useMemo)((()=>[c,{dispatch:d,change(e){f.current!==e&&m.current(e),f.current=e,d({type:0,index:e})}}]),[c,d]);return r.createElement(At.Provider,{value:b},j({props:{...i},slot:p,defaultTag:Bt,name:"Tabs"}))},Wt.List=function(e){let[{selectedIndex:t,orientation:n}]=jt("Tab.List");return j({props:{...e,role:"tablist","aria-orientation":n},slot:{selectedIndex:t},defaultTag:"div",name:"Tabs.List"})},Wt.Panels=function(e){let[{selectedIndex:t}]=jt("Tab.Panels");return j({props:e,slot:(0,r.useMemo)((()=>({selectedIndex:t})),[t]),defaultTag:"div",name:"Tabs.Panels"})},Wt.Panel=function(e){var t,n;let[{selectedIndex:a,tabs:o,panels:l},{dispatch:i}]=jt("Tab.Panel"),s=`headlessui-tabs-panel-${O()}`,u=(0,r.useRef)(null),c=M(u,(e=>{!e||i({type:7})}));R((()=>(i({type:5,panel:u}),()=>i({type:6,panel:u}))),[i,u]);let d=l.indexOf(u),p=d===a,m=(0,r.useMemo)((()=>({selected:p})),[p]);return j({props:{...e,ref:c,id:s,role:"tabpanel","aria-labelledby":null==(n=null==(t=o[d])?void 0:t.current)?void 0:n.id,tabIndex:p?0:-1},slot:m,defaultTag:"div",features:3,visible:p,name:"Tabs.Panel"})};var Qt=(0,r.createContext)(null);Qt.displayName="TransitionContext";var qt=(0,r.createContext)(null);function zt(e){return"children"in e?zt(e.children):e.current.filter((({state:e})=>"visible"===e)).length>0}function Vt(e){let t=(0,r.useRef)(e),n=(0,r.useRef)([]),a=me();(0,r.useEffect)((()=>{t.current=e}),[e]);let o=(0,r.useCallback)(((e,r=1)=>{var o;let l=n.current.findIndex((({id:t})=>t===e));-1!==l&&(A(r,{0(){n.current.splice(l,1)},1(){n.current[l].state="hidden"}}),!zt(n)&&a.current&&(null==(o=t.current)||o.call(t)))}),[t,a,n]),l=(0,r.useCallback)((e=>{let t=n.current.find((({id:t})=>t===e));return t?"visible"!==t.state&&(t.state="visible"):n.current.push({id:e,state:"visible"}),()=>o(e,0)}),[n,o]);return(0,r.useMemo)((()=>({children:n,register:l,unregister:o})),[l,o,n])}function Yt(){}qt.displayName="NestingContext";var Jt=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Xt(e){var t;let n={};for(let r of Jt)n[r]=null!=(t=e[r])?t:Yt;return n}function Zt(e){let{beforeEnter:t,afterEnter:n,beforeLeave:a,afterLeave:o,enter:l,enterFrom:i,enterTo:s,entered:u,leave:c,leaveFrom:d,leaveTo:p,...m}=e,f=(0,r.useRef)(null),[b,v]=(0,r.useState)("visible"),x=m.unmount?0:1,{show:g,appear:h,initial:y}=function(){let e=(0,r.useContext)(Qt);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),{register:w,unregister:E}=function(){let e=(0,r.useContext)(qt);if(null===e)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),k=O(),C=(0,r.useRef)(!1),_=Vt((()=>{C.current||(v("hidden"),E(k),M.current.afterLeave())}));R((()=>{if(k)return w(k)}),[w,k]),R((()=>{if(1===x&&k){if(g&&"visible"!==b)return void v("visible");A(b,{hidden:()=>E(k),visible:()=>w(k)})}}),[b,k,w,E,g,x]);let I=Ht(l),S=Ht(i),N=Ht(s),T=Ht(u),D=Ht(c),F=Ht(d),L=Ht(p),M=function(e){let t=(0,r.useRef)(Xt(e));return(0,r.useEffect)((()=>{t.current=Xt(e)}),[e]),t}({beforeEnter:t,afterEnter:n,beforeLeave:a,afterLeave:o}),$=P();(0,r.useEffect)((()=>{if($&&"visible"===b&&null===f.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[f,b,$]);let B=y&&!h;R((()=>{let e=f.current;if(e&&!B)return C.current=!0,g&&M.current.beforeEnter(),g||M.current.beforeLeave(),g?Kt(e,I,S,N,T,(e=>{C.current=!1,"finished"===e&&M.current.afterEnter()})):Kt(e,D,F,L,T,(e=>{C.current=!1,"finished"===e&&(zt(_)||(v("hidden"),E(k),M.current.afterLeave()))}))}),[M,k,C,E,_,f,B,g,I,S,N,D,F,L]);let W={ref:f},U=m;return r.createElement(qt.Provider,{value:_},r.createElement(q,{value:A(b,{visible:0,hidden:1})},j({props:{...U,...W},defaultTag:"div",features:1,visible:"visible"===b,name:"Transition.Child"})))}function en(e){let{show:t,appear:n=!1,unmount:a,...o}=e,l=Q();if(void 0===t&&null!==l&&(t=A(l,{0:!0,1:!1})),![!0,!1].includes(t))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[i,s]=(0,r.useState)(t?"visible":"hidden"),u=Vt((()=>{s("hidden")})),c=function(){let e=(0,r.useRef)(!0);return(0,r.useEffect)((()=>{e.current=!1}),[]),e.current}(),d=(0,r.useMemo)((()=>({show:t,appear:n||!c,initial:c})),[t,n,c]);(0,r.useEffect)((()=>{t?s("visible"):zt(u)||s("hidden")}),[t,u]);let p={unmount:a};return r.createElement(qt.Provider,{value:u},r.createElement(Qt.Provider,{value:d},j({props:{...p,as:r.Fragment,children:r.createElement(Zt,{...p,...o})},defaultTag:r.Fragment,features:1,visible:"visible"===i,name:"Transition"})))}en.Child=function(e){let t=null!==(0,r.useContext)(Qt),n=null!==Q();return!t&&n?r.createElement(en,{...e}):r.createElement(Zt,{...e})},en.Root=en;var tn=window.wp.apiFetch,nn=t.n(tn);function rn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(Boolean).join(" ")}var an=function(){const[e,t]=(0,r.useState)(!1),[a,o]=(0,r.useState)(onboarding_vars.available_gateways),l=g();return(0,n.createElement)("main",{className:"mt-4 mb-4 mx-auto w-auto max-w-7xl px-4 sm:mt-6 sm:px-6 md:mt-8 lg:mt-10 lg:px-8 xl:mt-16"},(0,n.createElement)("div",{className:"text-center"},(0,n.createElement)("p",{className:"mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:mx-auto md:mt-5 md:text-xl lg:mx-0"},(0,n.createElement)("span",{className:"block"},(0,n.createElement)("span",{className:"text-gray-700 inline font-bold"},(0,k.__)("Congratulations!!","checkout-plugins-stripe-woo")," "),(0,k.__)("You are connected to Stripe successfully.","checkout-plugins-stripe-woo")),(0,n.createElement)("span",{className:"block"},(0,k.__)("Let's enable gateways","checkout-plugins-stripe-woo"))),(0,n.createElement)("ul",{role:"list",className:"divide-y divide-gray-200 bg-white overflow-hidden sm:rounded-md mt-10 max-w-screen-md mx-auto"},a.map((e=>(0,n.createElement)("li",{key:e.id},(0,n.createElement)("span",{href:"#",className:"block hover:bg-gray-50"},(0,n.createElement)("div",{className:"flex items-center px-4 py-4 sm:px-6"},(0,n.createElement)("div",{className:"min-w-0 flex-1 flex items-center"},(0,n.createElement)("div",{className:"flex-shrink-0"},(0,n.createElement)("img",{className:"h-12 w-32 max-w-80",src:e.icon,alt:e.name})),(0,n.createElement)("div",{className:"min-w-0 flex-1 px-4 md:gap-4"},(0,n.createElement)("div",null,(0,n.createElement)("p",{className:"text-sm font-medium text-cart-500 flex truncate"},e.name," ",e.recommended?(0,n.createElement)("span",{className:"ml-2 px-2 py-1 text-green-800 text-xs font-medium bg-green-100 rounded-full"},(0,k.__)("Recommended","checkout-plugins-stripe-woo")):""),(0,n.createElement)("p",{className:"text-sm font-medium text-gray-400 flex"},(0,n.createElement)("span",{className:"text-left text-sm"},"all"===e.currencies?(0,k.__)("Works with all currencies","checkout-plugins-stripe-woo"):(0,k.__)("Works with ","checkout-plugins-stripe-woo")+e.currencies))))),(0,n.createElement)("div",null,(0,n.createElement)(Lt,{checked:e.enabled,value:e.enabled,name:e.id,onChange:()=>{e.enabled=!e.enabled,o([...a])},className:rn(e.enabled?"bg-cart-500 ":"bg-gray-200","relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-cart-500")},(0,n.createElement)("span",{className:"sr-only"},e.id),(0,n.createElement)("span",{"aria-hidden":"true",className:rn(e.enabled?"translate-x-5":"translate-x-0","pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow transform ring-0 transition ease-in-out duration-200")}))))))))),(0,n.createElement)("div",{className:"mt-5 sm:mt-8 sm:inline-block lg:inline-block sm:justify-center lg:justify-center"},(0,n.createElement)("div",{className:"rounded-md shadow"},e?(0,n.createElement)("button",{className:"disabled w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-wait"},(0,k.__)("Enabling…","checkout-plugins-stripe-woo"),(0,n.createElement)(C,null)):(0,n.createElement)("button",{onClick:function(e){e.preventDefault(),t(!0);const n=new window.FormData,r={};a.forEach((function(e){r[e.id]=document.getElementsByName(e.id)[0].value}));const o=JSON.stringify(r);n.append("formdata",o),n.append("action","cpsw_onboarding_enable_gateway"),n.append("security",onboarding_vars.cpsw_onboarding_enable_gateway),nn()({url:onboarding_vars.ajax_url,method:"POST",body:n}).then((e=>{e.success&&(!0===e.data.activated_gateways.cpsw_stripe?l(onboarding_vars.navigator_base+"&cpsw_call=express-checkout"):l(onboarding_vars.navigator_base+"&cpsw_call=webhooks"))}))},className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-pointer"},(0,k.__)("Enable Gateways","checkout-plugins-stripe-woo"))))))},on=function(){const[e,t]=(0,r.useState)(!1),[a,o]=(0,r.useState)(onboarding_vars.get_webhook_secret),l=[{id:"test",name:(0,k.__)("Test","cart-plugin")},{id:"live",name:(0,k.__)("Live","cart-plugin")}],i=Object.keys(l).find((e=>l[e].id===onboarding_vars.get_payment_mode)),[s,u]=(0,r.useState)(l[i]),c=g();return(0,n.createElement)("main",{className:"mt-4 mb-4 mx-auto w-auto max-w-7xl px-4 sm:mt-6 sm:px-6 md:mt-8 lg:mt-10 lg:px-8 xl:mt-16"},(0,n.createElement)("div",{className:"text-center"},(0,n.createElement)("h1",{className:"text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl"},(0,n.createElement)("span",{className:"block text-cart-500 xl:inline"},(0,k.__)("This is important!!","checkout-plugins-stripe-woo"))),(0,n.createElement)("h3",{className:"text-2xl tracking-tight mt-5 font-bold text-gray-700"},(0,n.createElement)("span",{className:"block xl:inline"},(0,k.__)("Enable Webhooks","checkout-plugins-stripe-woo"))),(0,n.createElement)("p",{className:"mt-2 text-sm mb-5 text-gray-500 sm:mt-2 sm:text-xl sm:mx-auto md:mt-2 md:text-xl lg:mx-0"},(0,n.createElement)("span",{className:"block xl:inline font-bold select-none text-gray-700"},(0,k.__)("Webhook URL","checkout-plugins-stripe-woo"),": ")," ",(0,n.createElement)("span",{className:"block xl:inline font-bold select-text"},onboarding_vars.webhook_url)),(0,n.createElement)("div",{className:"block mx-auto mt-2 mb-5 w-full md:w-6/12 lg:w-6/12"},(0,n.createElement)("p",{className:"mt-2 text-sm text-gray-400 sm:mt-2 sm:text-sm sm:mx-auto md:mt-2 md:text-md lg:mx-0"},(0,n.createElement)("span",{className:"block"}," ",(0,k.__)("The webhook URL is called by","checkout-plugins-stripe-woo")," ",(0,n.createElement)("span",{className:"block text-gray-700 xl:inline font-bold"},(0,k.__)("Stripe","checkout-plugins-stripe-woo"),","),(0,k.__)(" when events occur in your account, like a source becomes chargeable.","checkout-plugins-stripe-woo")," ",(0,n.createElement)("a",{href:"https://checkoutplugins.com/docs/stripe-card-payments/#webhook",target:"_blank",rel:"noreferrer"},(0,n.createElement)("span",{className:"block xl:inline font-bold text-cart-500"},(0,k.__)("Webhook Guide","checkout-plugins-stripe-woo")))," ",(0,k.__)("or create webhook secret on","checkout-plugins-stripe-woo")," ",(0,n.createElement)("a",{href:"https://dashboard.stripe.com/webhooks/create",target:"_blank",rel:"noreferrer"},(0,n.createElement)("span",{className:"block text-cart-500 xl:inline font-bold"},(0,k.__)("Stripe Dashboard","checkout-plugins-stripe-woo"))),".")),(0,n.createElement)("p",{className:"text-left mt-3 text-sm text-gray-400 sm:mt-5 sm:text-sm sm:mx-auto md:mt-5 md:text-md lg:mx-0"},(0,n.createElement)("span",{className:"block text-gray-700 xl:inline font-bold"}," ",(0,k.__)("This is the list of the supported webhook events: ","checkout-plugins-stripe-woo")," ")),(0,n.createElement)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-2 gap-1 text-left"},(0,n.createElement)("div",null,(0,n.createElement)("ul",{className:"list-disc mt-3 pl-4 text-sm text-gray-400"},(0,n.createElement)("li",null,"charge.captured"),(0,n.createElement)("li",null,"charge.refunded"),(0,n.createElement)("li",null,"charge.dispute.created"),(0,n.createElement)("li",null,"charge.dispute.closed"),(0,n.createElement)("li",null,"payment_intent.succeeded"))),(0,n.createElement)("div",null,(0,n.createElement)("ul",{className:"list-disc md:mt-3 lg:mt-3 pl-4 text-sm text-gray-400"},(0,n.createElement)("li",null,"payment_intent.amount_capturable_updated"),(0,n.createElement)("li",null,"payment_intent.payment_failed"),(0,n.createElement)("li",null,"review.opened"),(0,n.createElement)("li",null,"review.closed"))))),(0,n.createElement)("div",{className:"block mx-auto mt-5 mb-5 w-full md:w-6/12 lg:w-6/12"},(0,n.createElement)("span",{className:"block text-gray-700 font-bold text-left"},(0,k.__)("Select Mode","checkout-plugins-stripe-woo")),(0,n.createElement)(Ze,{value:s,onChange:u},(0,n.createElement)("div",{className:"relative mt-1"},(0,n.createElement)(Ze.Button,{className:"relative w-full py-2 pl-3 pr-10 h-12 text-left bg-white rounded appearance-none border shadow cursor-default focus:outline-none focus-visible:ring-2 focus-visible:ring-opacity-75 focus-visible:ring-white focus-visible:ring-offset-orange-300 focus-visible:ring-offset-2 focus-visible:border-indigo-500 sm:text-sm"},(0,n.createElement)("span",{className:"block truncate"},s.name),(0,n.createElement)("span",{className:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"},(0,n.createElement)("span",{className:"dashicons dashicons-arrow-down-alt2"}))),(0,n.createElement)(en,{as:r.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0"},(0,n.createElement)(Ze.Options,{className:"absolute w-full py-1 mt-1 z-40 text-left overflow-auto text-base bg-white rounded border shadow max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"},l.map(((e,t)=>(0,n.createElement)(Ze.Option,{key:t,className:e=>{let{active:t}=e;return(t?" text-gray-500 bg-wpcolor":"text-gray-900")+"\n\t\t\t\t\t\t\t\tcursor-default select-none relative py-1 pl-4"},value:e},(t=>{let{active:a}=t;return(0,n.createElement)(r.Fragment,null,(0,n.createElement)("span",{className:(s?"font-medium":"font-normal")+" block"},e.name),s?(0,n.createElement)("span",{className:(a?"text-wpcolor":"text-wpcolor20")+"\n\t\t\t\t\t\t\t\t\t\tabsolute inset-y-0 left-0 flex items-center pl-3"}):null)})))))))),(0,n.createElement)("input",{type:"hidden",name:"cpsw_mode",id:"cpsw_mode",value:s.id})),(0,n.createElement)("div",{className:"w-full md:w-6/12 lg:w-6/12 block mx-auto mt-5 mb-5"},(0,n.createElement)("span",{className:"block text-gray-700 font-bold text-left"},s.name," ",(0,k.__)("Webhook Secret","checkout-plugins-stripe-woo")),(0,n.createElement)("p",{className:"mt-2 text-sm text-gray-400 sm:mt-2 sm:text-sm sm:mx-auto md:mt-2 md:text-md lg:mx-0"},(0,n.createElement)("input",{type:"text",value:a,onChange:function(e){o(e.target.value)},name:"webhook_secret",id:"cpsw_webhook_secret",placeholder:(0,k.__)("Enter key here","checkout-plugins-stripe-woo"),className:"w-full shadow appearance-none border rounded h-12 py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"}),(0,n.createElement)("span",{className:"block mt-3"}," ",(0,k.__)("The webhook secret is used to authenticate webhooks sent from Stripe. It ensures nobody else can send you events pretending to be Stripe","checkout-plugins-stripe-woo"),"."))),(0,n.createElement)("div",{className:"sm:inline-block lg:inline-block sm:justify-center lg:justify-center"},(0,n.createElement)("div",{className:"rounded-md shadow"},e?(0,n.createElement)("button",{className:"disabled w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-wait"},(0,k.__)("Saving…","checkout-plugins-stripe-woo"),(0,n.createElement)(C,null)):(0,n.createElement)("button",{onClick:function(){const e=new window.FormData;e.append("action","cpsw_onboarding_enable_webhooks");const n=document.getElementById("cpsw_webhook_secret").value,r=document.getElementById("cpsw_mode").value;if(""===n)return window.alert((0,k.__)("Webhook Secret field is Required.","checkout-plugins-stripe-woo")),!1;t(!0),e.append("webhook_secret",n),e.append("cpsw_mode",r),e.append("security",onboarding_vars.cpsw_onboarding_enable_webhooks),nn()({url:onboarding_vars.ajax_url,method:"POST",body:e}).then((e=>{e.success&&c(onboarding_vars.navigator_base+"&cpsw_call=thank-you")}))},className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-pointer"},(0,k.__)("Save & Continue","checkout-plugins-stripe-woo"))),(0,n.createElement)("div",{className:"mt-3 sm:mt-0"},(0,n.createElement)("a",{href:onboarding_vars.base_url+"&cpsw_call=thank-you",className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-slate-300 md:py-4 md:text-lg md:px-10"},(0,k.__)("Skip","checkout-plugins-stripe-woo"))))))},ln=function(){const[e,t]=(0,r.useState)(!1),a=g();return(0,n.createElement)("main",{className:"mt-10 mx-auto w-auto max-w-7xl px-4 sm:mt-12 sm:px-6 md:mt-16 lg:mt-20 lg:px-8 xl:mt-28"},(0,n.createElement)("div",{className:"text-center"},(0,n.createElement)("h1",{className:"text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl"},(0,n.createElement)("span",{className:"block xl"},(0,k.__)("Wooho!!","checkout-plugins-stripe-woo")),(0,n.createElement)("span",{className:"block text-cart-500 xl:inline"},(0,k.__)("You are almost done.","checkout-plugins-stripe-woo"))),(0,n.createElement)("p",{className:"mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:mx-auto md:mt-5 md:text-xl lg:mx-0"},(0,n.createElement)("span",{className:"block"}," ",(0,k.__)("Since you have enabled","checkout-plugins-stripe-woo")," ",(0,n.createElement)("span",{className:"block text-gray-700 xl:inline font-bold"},(0,k.__)("Stripe Card Processing","checkout-plugins-stripe-woo"),","),(0,k.__)(" We recommend you to enable","checkout-plugins-stripe-woo")," ",(0,n.createElement)("span",{className:"block text-gray-700 xl:inline font-bold"},(0,k.__)("Express Checkout","checkout-plugins-stripe-woo"))," ",(0,k.__)("feature","checkout-plugins-stripe-woo"),"."),(0,n.createElement)("span",null,(0,k.__)("Express Checkout generates more conversions!!","checkout-plugins-stripe-woo"))),(0,n.createElement)("div",{className:"block mx-auto mt-1 mb-1"},(0,n.createElement)("img",{className:"inline mx-4 py-5 h-24",src:onboarding_vars.assets_url+"images/apple-pay.svg",alt:"Express Checkout"}),(0,n.createElement)("img",{className:"inline mx-4 py-5 h-24",src:onboarding_vars.assets_url+"images/gpay.svg",alt:"Express Checkout"})),(0,n.createElement)("div",{className:"sm:inline-block lg:inline-block sm:justify-center lg:justify-center"},(0,n.createElement)("div",{className:"rounded-md shadow"},e?(0,n.createElement)("button",{className:"disabled w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-wait"},(0,k.__)("Enabling…","checkout-plugins-stripe-woo"),(0,n.createElement)(C,null)):(0,n.createElement)("button",{onClick:function(){t(!0);const e=new window.FormData;e.append("action","cpsw_onboarding_enable_express_checkout"),e.append("security",onboarding_vars.cpsw_onboarding_enable_express_checkout),nn()({url:onboarding_vars.ajax_url,method:"POST",body:e}).then((e=>{e.success&&a(onboarding_vars.navigator_base+"&cpsw_call=webhooks")}))},className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-pointer"},(0,k.__)("Enable Express Checkout","checkout-plugins-stripe-woo"))),(0,n.createElement)("div",{className:"mt-3 sm:mt-0 sm:ml-3"},(0,n.createElement)("a",{href:onboarding_vars.base_url+"&cpsw_call=webhooks",className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-slate-300 md:py-4 md:text-lg md:px-10"},(0,k.__)("Skip Express Checkout","checkout-plugins-stripe-woo"))))))},sn=function(){return(0,n.createElement)("main",{className:"mt-10 mx-auto w-auto max-w-7xl px-4 sm:mt-12 sm:px-6 md:mt-14 lg:mt-16 lg:px-8 xl:mt-18"},(0,n.createElement)("div",{className:"text-center"},(0,n.createElement)("h1",{className:"text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl"},(0,n.createElement)("span",{className:"block text-red-600 xl:inline"},(0,k.__)("Failed!!","checkout-plugins-stripe-woo"))),(0,n.createElement)("p",{className:"mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:mx-auto md:mt-5 md:text-xl lg:mx-0"},(0,n.createElement)("span",{className:"block"},(0,k.__)("Unfortunately Connection to Stripe failed.","checkout-plugins-stripe-woo"))),(0,n.createElement)("div",{className:"mt-5 sm:mt-8 sm:inline-block lg:inline-block sm:justify-center lg:justify-center"},(0,n.createElement)("div",{className:"rounded-md shadow"},(0,n.createElement)("a",{href:onboarding_vars.authorization_url,className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10"},(0,k.__)("Try Again","checkout-plugins-stripe-woo"))),(0,n.createElement)("div",{className:"mt-3 sm:mt-0 sm:ml-3"},(0,n.createElement)("a",{href:onboarding_vars.manual_connect_url,className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-slate-300 md:py-4 md:text-lg md:px-10"},(0,k.__)("Manage API keys manually","checkout-plugins-stripe-woo"))))))},un=function(){const[e,t]=(0,r.useState)(!1);return(0,n.createElement)("main",{className:"mt-10 mx-auto w-auto max-w-7xl px-4 sm:mt-12 sm:px-6 md:mt-14 lg:mt-16 lg:px-8 xl:mt-18"},(0,n.createElement)("div",{className:"text-center"},(0,n.createElement)("h1",{className:"text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl"},(0,n.createElement)("span",{className:"block text-cart-500 xl:inline"},(0,k.__)("Great!!","checkout-plugins-stripe-woo"))),(0,n.createElement)("p",{className:"mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:mx-auto md:mt-5 md:text-xl lg:mx-0"},(0,n.createElement)("span",{className:"block"},(0,k.__)("Your store is all set to accept payment.","checkout-plugins-stripe-woo")),(0,n.createElement)("span",null,(0,k.__)("We provide lots of customization options to match your needs, don't forget to explore them.","checkout-plugins-stripe-woo"))),(0,n.createElement)("div",{className:"mt-5 sm:mt-8 sm:inline-block lg:inline-block sm:justify-center lg:justify-center"},(0,n.createElement)("div",{className:"rounded-md shadow"},e?(0,n.createElement)("button",{className:"disabled w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-wait"},(0,k.__)("Let's Customize…","checkout-plugins-stripe-woo"),(0,n.createElement)(C,null)):(0,n.createElement)("button",{onClick:function(){t(!0),window.location.replace(onboarding_vars.gateways_url)},className:"w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-pointer"},(0,k.__)("Let's Customize","checkout-plugins-stripe-woo"))))))},cn=function(){""!==onboarding_vars.woocommerce_installed&&""!==onboarding_vars.woocommerce_activated&&window.location.replace(onboarding_vars.navigator_base);const[e,t]=(0,r.useState)(""),[a,o]=(0,r.useState)(!1),[l,i]=(0,r.useState)(!1);return(0,n.createElement)("main",{className:"mt-10 mx-auto max-w-7xl px-4 sm:mt-12 sm:px-6 md:mt-16 lg:mt-20 lg:px-8 xl:mt-28"},(0,n.createElement)("div",{className:"text-center"},(0,n.createElement)("h1",{className:"text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl"},(0,n.createElement)("span",{className:"block xl"},""===onboarding_vars.woocommerce_installed?(0,k.__)("Missing","checkout-plugins-stripe-woo"):(0,k.__)("Inactiave","checkout-plugins-stripe-woo")),(0,n.createElement)("span",{className:"block text-cart-500 xl:inline"},(0,k.__)("WooCoomerce","checkout-plugins-stripe-woo"))),(0,n.createElement)("p",{className:"mt-6 text-base justify-center text-gray-500 sm:mt-5 sm:text-lg sm:w-full sm:mx-auto md:mt-5 md:text-xl lg:mx-0"},(0,n.createElement)("span",{className:"block text-gray-700 xl:inline font-bold"},(0,k.__)("Checkout Plugins - Stripe for WooCoomerce","checkout-plugins-stripe-woo"))," ",(0,k.__)("requires","checkout-plugins-stripe-woo")," ",(0,n.createElement)("span",{className:"block text-gray-700 xl:inline font-bold"},(0,k.__)("WooCommerce","checkout-plugins-stripe-woo"))," ",(0,k.__)("to be active on your store.","checkout-plugins-stripe-woo")),(0,n.createElement)("div",{className:"mt-5 sm:mt-8 sm:flex justify-center"},(0,n.createElement)("div",{className:"rounded-md shadow"},"installing"===e?(0,n.createElement)("button",{className:"disabled w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-wait"},(0,k.__)("Installing…","checkout-plugins-stripe-woo"),(0,n.createElement)(C,null)):"activating"===e?(0,n.createElement)("button",{className:"disabled w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-wait"},(0,k.__)("Activating…","checkout-plugins-stripe-woo"),(0,n.createElement)(C,null)):(0,n.createElement)("button",{onClick:function(){if(""===onboarding_vars.woocommerce_installed)t("installing"),setTimeout((()=>{o(!0)}),1e4),wp.updates.queue.push({action:"install-plugin",data:{slug:"woocommerce"}}),wp.updates.queueChecker();else{t("activating");const e=new window.FormData;e.append("action","cpsw_onboarding_install_woocommerce"),e.append("security",onboarding_vars.cpsw_onboarding_install_woocommerce),nn()({url:onboarding_vars.ajax_url,method:"POST",body:e}).then((e=>{e.success?window.location.replace(onboarding_vars.onboarding_base):i(!0)}))}},className:"install-dependency w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-cart-500 hover:bg-cart-700 md:py-4 md:text-lg md:px-10 cursor-pointer"},""===onboarding_vars.woocommerce_installed?(0,k.__)("Install and continue","checkout-plugins-stripe-woo"):(0,k.__)("Activate and continue","checkout-plugins-stripe-woo"))))),a?(0,n.createElement)("div",{className:"bg-cart-50 p-4 fixed left-0 top-0 right-0 transition ease-in-out delay-150"},(0,n.createElement)("div",{className:"block"},(0,n.createElement)("div",{className:"text-center justify-center"},(0,n.createElement)("p",{className:"text-sm mx-auto w-full text-cart-500 text-center"},(0,k.__)("Installing WooCommerce will take time. Please be patient.","checkout-plugins-stripe-woo"))))):"",l?(0,n.createElement)("div",{className:"bg-cart-50 p-4 fixed left-0 top-0 right-0 transition ease-in-out delay-150"},(0,n.createElement)("div",{className:"block"},(0,n.createElement)("div",{className:"text-center justify-center"},(0,n.createElement)("p",{className:"text-sm mx-auto w-full text-cart-500 text-center"},(0,k.__)("WooCommerce installing failed. Please try again.","checkout-plugins-stripe-woo"))))):"")},dn=function(){return(0,n.createElement)("div",null,(0,n.createElement)("div",{className:"relative pt-6 px-4 sm:px-6 lg:px-8"},(0,n.createElement)("nav",{className:"relative flex items-center justify-center sm:h-10","aria-label":"Logo"},(0,n.createElement)("div",{className:"flex items-center justify-center flex-grow"},(0,n.createElement)("div",{className:"flex items-center w-auto"},(0,n.createElement)("img",{className:"h-16 w-full",src:onboarding_vars.assets_url+"images/cpsw-logo.svg",alt:"Checkout Plugins - Stripe for WooCommerce"}))))))};o().render((0,n.createElement)((function(t){let{basename:n,children:a,window:o}=t,d=(0,r.useRef)();null==d.current&&(d.current=function(t){void 0===t&&(t={});var n=t.window,r=void 0===n?document.defaultView:n,a=r.history;function o(){var e=r.location,t=e.pathname,n=e.search,o=e.hash,l=a.state||{};return[l.idx,{pathname:t,search:n,hash:o,state:l.usr||null,key:l.key||"default"}]}var d=null;r.addEventListener("popstate",(function(){if(d)x.call(d),d=null;else{var t=e.Pop,n=o(),r=n[0],a=n[1];if(x.length){if(null!=r){var l=f-r;l&&(d={action:t,location:a,retry:function(){k(-1*l)}},k(l))}}else E(t)}}));var p=e.Pop,m=o(),f=m[0],b=m[1],v=u(),x=u();function g(e){return"string"==typeof e?e:function(e){var t=e.pathname,n=void 0===t?"/":t,r=e.search,a=void 0===r?"":r,o=e.hash,l=void 0===o?"":o;return a&&"?"!==a&&(n+="?"===a.charAt(0)?a:"?"+a),l&&"#"!==l&&(n+="#"===l.charAt(0)?l:"#"+l),n}(e)}function h(e,t){return void 0===t&&(t=null),l({pathname:b.pathname,hash:"",search:""},"string"==typeof e?c(e):e,{state:t,key:Math.random().toString(36).substr(2,8)})}function y(e,t){return[{usr:e.state,key:e.key,idx:t},g(e)]}function w(e,t,n){return!x.length||(x.call({action:e,location:t,retry:n}),!1)}function E(e){p=e;var t=o();f=t[0],b=t[1],v.call({action:p,location:b})}function k(e){a.go(e)}null==f&&(f=0,a.replaceState(l({},a.state,{idx:f}),""));var C={get action(){return p},get location(){return b},createHref:g,push:function t(n,o){var l=e.Push,i=h(n,o);if(w(l,i,(function(){t(n,o)}))){var s=y(i,f+1),u=s[0],c=s[1];try{a.pushState(u,"",c)}catch(e){r.location.assign(c)}E(l)}},replace:function t(n,r){var o=e.Replace,l=h(n,r);if(w(o,l,(function(){t(n,r)}))){var i=y(l,f),s=i[0],u=i[1];a.replaceState(s,"",u),E(o)}},go:k,back:function(){k(-1)},forward:function(){k(1)},listen:function(e){return v.push(e)},block:function(e){var t=x.push(e);return 1===x.length&&r.addEventListener(i,s),function(){t(),x.length||r.removeEventListener(i,s)}}};return C}({window:o}));let p=d.current,[m,f]=(0,r.useState)({action:p.action,location:p.location});return(0,r.useLayoutEffect)((()=>p.listen(f)),[p]),(0,r.createElement)(b,{basename:n,children:a,location:m.location,navigationType:m.action,navigator:p})}),null,(0,n.createElement)((function(){const e=new URLSearchParams(x().search).get("cpsw_call");let t=(0,n.createElement)("p",null);switch(e){case"success":t=(0,n.createElement)(an,null);break;case"failed":t=(0,n.createElement)(sn,null);break;case"webhooks":t=(0,n.createElement)(on,null);break;case"express-checkout":t=(0,n.createElement)(ln,null);break;case"thank-you":t=(0,n.createElement)(un,null);break;case"setup-woocommerce":t=(0,n.createElement)(cn,null);break;default:t=(0,n.createElement)(_,null)}return(0,n.createElement)("div",{className:"relative bg-white overflow-hidden w-10/12 mx-auto my-0 rounded-xl mt-12"},(0,n.createElement)("div",{className:"max-w-7xl mx-auto overflow-x-hidden"},(0,n.createElement)("div",{className:"relative z-10 bg-white lg:w-full"},(0,n.createElement)(dn,null),t)))}),null)),document.getElementById("cpsw-onboarding-content"))}();